Overview
Comment: | Make all C-/H-files Tcl 9-ready, with all kinds of code-cleanup. Build environment not handled yet. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | nijtmans |
Files: | files | file ages | folders |
SHA3-256: |
ceb72b0012e3af3505c168fc0ebe48e6 |
User & Date: | jan.nijtmans on 2024-02-20 13:00:50 |
Other Links: | branch diff | manifest | tags |
Context
2024-02-20
| ||
13:12 | Merge makefile.vc improvements from Kevin, and his README.txt check-in: 66551cd602 user: jan.nijtmans tags: nijtmans | |
13:10 | Merge 1.8 Closed-Leaf check-in: 08c2b4ad63 user: jan.nijtmans tags: codebykevin, nijtmans | |
13:00 | Make all C-/H-files Tcl 9-ready, with all kinds of code-cleanup. Build environment not handled yet. check-in: ceb72b0012 user: jan.nijtmans tags: nijtmans | |
2024-02-19
| ||
21:55 | Less compiler warnings check-in: 0cfe6dfb3c user: jan.nijtmans tags: nijtmans | |
Changes
Modified tls.c
from [b29b9e852d]
to [03228c38ef].
36 37 38 39 40 41 42 | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | - - - - + + - - + - - - + - - - + - - - + - - - + - - | #define F2N( key, dsp) \ (((key) == NULL) ? (char *) NULL : \ Tcl_TranslateFileName(interp, (key), (dsp))) #define REASON() ERR_reason_error_string(ERR_get_error()) static void InfoCallback(const SSL *ssl, int where, int ret); |
171 172 173 174 175 176 177 | 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | - + | *------------------------------------------------------------------- */ static void InfoCallback(const SSL *ssl, int where, int ret) { State *statePtr = (State*)SSL_get_app_data((SSL *)ssl); Tcl_Obj *cmdPtr; |
269 270 271 272 273 274 275 | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | - + | *------------------------------------------------------------------- */ static int VerifyCallback(int ok, X509_STORE_CTX *ctx) { Tcl_Obj *cmdPtr, *result; char *errStr, *string; |
489 490 491 492 493 494 495 | 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | - - - - - + + + + + | * * Side effects: * constructs and destroys SSL context (CTX) * *------------------------------------------------------------------- */ static int |
593 594 595 596 597 598 599 | 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 | - + - - + + + + + + | Tcl_ListObjAppendElement( interp, objPtr, Tcl_NewStringObj( cp, -1) ); } } else { sk = SSL_get_ciphers(ssl); for (index = 0; index < sk_SSL_CIPHER_num(sk); index++) { |
695 696 697 698 699 700 701 | 686 687 688 689 690 691 692 693 694 695 696 697 698 699 | - - | ret = 1; } dprintf("Returning TCL_OK with data \"%i\"", ret); Tcl_SetObjResult(interp, Tcl_NewIntObj(ret)); return(TCL_OK); |
718 719 720 721 722 723 724 | 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 | - - - - - + + + + + - + + - - - + + + | * Side effects: * May modify the behavior of an IO channel. * *------------------------------------------------------------------- */ static int |
815 816 817 818 819 820 821 | 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 | - - - + + + | #endif OPTBOOL( "-ssl2", ssl2); OPTBOOL( "-ssl3", ssl3); OPTBOOL( "-tls1", tls1); OPTBOOL( "-tls1.1", tls1_1); OPTBOOL( "-tls1.2", tls1_2); |
876 877 878 879 880 881 882 | 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 | - + - + - + | } if (model != NULL) { int mode; /* Get the "model" context */ chan = Tcl_GetChannel(interp, model, &mode); if (chan == (Tcl_Channel) NULL) { |
925 926 927 928 929 930 931 | 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 | - + - + - + | dprintf("Consuming Tcl channel %s", Tcl_GetChannelName(chan)); statePtr->self = Tcl_StackChannel(interp, Tls_ChannelType(), statePtr, (TCL_READABLE | TCL_WRITABLE), chan); dprintf("Created channel named %s", Tcl_GetChannelName(statePtr->self)); if (statePtr->self == (Tcl_Channel) NULL) { /* * No use of Tcl_EventuallyFree because no possible Tcl_Preserve. */ |
988 989 990 991 992 993 994 | 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 | - - - - - - + + + + + | /* * End of SSL Init */ dprintf("Returning %s", Tcl_GetChannelName(statePtr->self)); Tcl_SetResult(interp, (char *) Tcl_GetChannelName(statePtr->self), TCL_VOLATILE); return TCL_OK; |
1044 1045 1046 1047 1048 1049 1050 | 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 | - - + - - - - - - - - - - - - - - + + + + + + + + + + + + + | } if (Tcl_UnstackChannel(interp, chan) == TCL_ERROR) { return TCL_ERROR; } return TCL_OK; |
1395 1396 1397 1398 1399 1400 1401 | 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 | - - - - - + + + + + - + | * * Side effects: * None. * *------------------------------------------------------------------- */ static int |
1472 1473 1474 1475 1476 1477 1478 | 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 | - - - - - - + + + + + - - - - - - - - + + + + + | Tcl_ListObjAppendElement(interp, objPtr, Tcl_NewStringObj("version", -1)); Tcl_ListObjAppendElement(interp, objPtr, Tcl_NewStringObj(SSL_get_version(statePtr->ssl), -1)); Tcl_SetObjResult( interp, objPtr); return TCL_OK; |
1549 1550 1551 1552 1553 1554 1555 | 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 | - + - + | switch ((enum command) cmd) { case C_REQ: { EVP_PKEY *pkey=NULL; X509 *cert=NULL; X509_NAME *name=NULL; Tcl_Obj **listv; |
1670 1671 1672 1673 1674 1675 1676 | 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 | - + + + + | } } break; default: break; } return TCL_OK; |
Modified tlsBIO.c
from [b685c38f11]
to [fc3b42ebe3].
74 75 76 77 78 79 80 | 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | - + - + | * with the SSL library since it will likely be optimized for this. */ parentChannel = Tls_GetParent(statePtr, 0); parentChannelType = Tcl_GetChannelType(parentChannel); validParentChannelFd = 0; if (strcmp(parentChannelType->typeName, "tcp") == 0) { |
222 223 224 225 226 227 228 | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | - + + + + + | static long BioCtrl(BIO *bio, int cmd, long num, void *ptr) { Tcl_Channel chan; long ret = 1; chan = Tls_GetParent((State *) BIO_get_data(bio), 0); |
Modified tlsIO.c
from [dfc2f2f680]
to [15faee591f].
18 19 20 21 22 23 24 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | - - - - - - - - - + + + + + + + + + + - + - + + + + | */ #include "tlsInt.h" /* * Forward declarations */ |
83 84 85 86 87 88 89 | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | - + | * 0 if successful, errno when failed. * * Side effects: * Sets the device into blocking or nonblocking mode. * *------------------------------------------------------------------- */ |
114 115 116 117 118 119 120 | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | - + + + + + + + + | * 0 if successful, the value of Tcl_GetErrno() if failed. * * Side effects: * Closes the socket of the channel. * *------------------------------------------------------------------- */ |
324 325 326 327 328 329 330 | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | - + | * * Side effects: * Reads input from the input device of the channel. * *------------------------------------------------------------------- */ |
452 453 454 455 456 457 458 | 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | - + | * * Side effects: * Writes output on the output device of the channel. * *------------------------------------------------------------------- */ |
592 593 594 595 596 597 598 | 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 | - + | * * Side effects: * None. * *------------------------------------------------------------------- */ static int |
639 640 641 642 643 644 645 | 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 | - + | * Sets up the notifier so that a future event on the channel * will be seen by Tcl. * *------------------------------------------------------------------- */ static void |
703 704 705 706 707 708 709 | 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 | - + - + | if (mask & TCL_READABLE) { if (Tcl_InputBuffered(statePtr->self) > 0 || BIO_ctrl_pending(statePtr->bio) > 0) { /* * There is interest in readable events and we actually have * data waiting, so generate a timer to flush that. */ dprintf("Creating a new timer since data appears to be waiting"); |
747 748 749 750 751 752 753 | 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 | - + | * * Side effects: * May process the incoming event by itself. * *------------------------------------------------------------------- */ |
814 815 816 817 818 819 820 | 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 | - + - + | * None. * *------------------------------------------------------* */ static void TlsChannelHandler (clientData, mask) |
866 867 868 869 870 871 872 | 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 | - + - + | statePtr->timer = (Tcl_TimerToken)NULL; } if ((mask & TCL_READABLE) && Tcl_InputBuffered(statePtr->self) > 0) { /* * Data is waiting, flush it out in short time */ statePtr->timer = Tcl_CreateTimerHandler(TLS_TCL_DELAY, |
891 892 893 894 895 896 897 | 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 | - + | * * Result: * None. * *------------------------------------------------------* */ |
Modified tlsInt.h
from [c6763ae233]
to [16703359db].
143 144 145 146 147 148 149 | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | - + | int vflags; /* verify flags */ SSL *ssl; /* Struct for SSL processing */ SSL_CTX *ctx; /* SSL Context */ BIO *bio; /* Struct for SSL processing */ BIO *p_bio; /* Parent BIO (that is layered on Tcl_Channel) */ |
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | + + + + + + + | # elif defined(__GNUC__) && (__GNUC__ > 2) # define TCL_UNUSED(T) T JOIN(dummy, __LINE__) __attribute__((unused)) # else # define TCL_UNUSED(T) T JOIN(dummy, __LINE__) # endif #endif #if (TCL_MAJOR_VERSION < 9) && defined(TCL_MINOR_VERSION) && (TCL_MINOR_VERSION < 7) && !defined(Tcl_Size) # define Tcl_Size int #endif /* * Forward declarations */ const Tcl_ChannelType *Tls_ChannelType(void); Tcl_Channel Tls_GetParent(State *statePtr, int maskFlags); Tcl_Obj *Tls_NewX509Obj(Tcl_Interp *interp, X509 *cert); void Tls_Error(State *statePtr, char *msg); #if TCL_MAJOR_VERSION > 8 void Tls_Free(void *blockPtr); #else void Tls_Free(char *blockPtr); #endif void Tls_Clean(State *statePtr); int Tls_WaitForConnect(State *statePtr, int *errorCodePtr, int handshakeFailureIsPermanent); BIO *BIO_new_tcl(State* statePtr, int flags); #define PTR2INT(x) ((int) ((intptr_t) (x))) #endif /* _TLSINT_H */ |