Overview
Comment: | Added shutdown handler |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | tls-1.8 |
Files: | files | file ages | folders |
SHA3-256: |
2e607e483a6540c88eca0317655faa27 |
User & Date: | bohagan on 2024-06-16 20:23:52 |
Other Links: | branch diff | manifest | tags |
Context
2024-06-19
| ||
20:40 | Added more connection status check-in: ab1aa551c0 user: bohagan tags: tls-1.8 | |
2024-06-16
| ||
20:23 | Added shutdown handler check-in: 2e607e483a user: bohagan tags: tls-1.8 | |
2024-06-15
| ||
21:49 | Removed obsolete locking code and added support for checking system OpenSSL config file for crypto policies. check-in: 449470132e user: bohagan tags: tls-1.8 | |
Changes
Modified generic/tls.c from [5d61adfac5] to [c568200b91].
︙ | ︙ | |||
2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 | * Side effects: * Frees all the state * *------------------------------------------------------------------- */ void Tls_Clean(State *statePtr) { dprintf("Called"); /* * we're assuming here that we're single-threaded */ if (statePtr->timer != (Tcl_TimerToken) NULL) { Tcl_DeleteTimerHandler(statePtr->timer); statePtr->timer = NULL; } | > > > > > > < < < < < | < < < < < < < < < < < < < > > > > > > > > > > > > > > > > > > > > > > > | 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 | * Side effects: * Frees all the state * *------------------------------------------------------------------- */ void Tls_Clean(State *statePtr) { dprintf("Called"); if (statePtr->ssl) { /* Send close_notify message */ dprintf("SSL_shutdown(%p)", statePtr->ssl); SSL_shutdown(statePtr->ssl); } /* * we're assuming here that we're single-threaded */ if (statePtr->timer != (Tcl_TimerToken) NULL) { Tcl_DeleteTimerHandler(statePtr->timer); statePtr->timer = NULL; } /* Remove callbacks */ if (statePtr->callback) { Tcl_DecrRefCount(statePtr->callback); statePtr->callback = NULL; } if (statePtr->password) { Tcl_DecrRefCount(statePtr->password); statePtr->password = NULL; } if (statePtr->vcmd) { Tcl_DecrRefCount(statePtr->vcmd); statePtr->vcmd = NULL; } if (statePtr->protos) { ckfree(statePtr->protos); statePtr->protos = NULL; } if (statePtr->bio) { /* This will call SSL_shutdown. Bug 1414045 */ dprintf("BIO_free_all(%p)", statePtr->bio); BIO_free_all(statePtr->bio); statePtr->bio = NULL; } if (statePtr->ssl) { dprintf("SSL_free(%p)", statePtr->ssl); SSL_free(statePtr->ssl); statePtr->ssl = NULL; } if (statePtr->ctx) { SSL_CTX_free(statePtr->ctx); statePtr->ctx = NULL; } dprintf("Returning"); } /* *---------------------------------------------------------------------- * |
︙ | ︙ | |||
2876 2877 2878 2879 2880 2881 2882 | } return TCL_OK; } /* *------------------------------------------------------* * | | > > > > > > > > | > > > > > | > | | > | | | > > > | < | > > | | > | | 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 | } return TCL_OK; } /* *------------------------------------------------------* * * TlsLibShutdown -- * * Shutdown SSL library once per application * * Results: * A standard TCL result * * Side effects: * Shutdown SSL library * *------------------------------------------------------* */ static int TlsLibShutdown(ClientData clientData) { BIO_cleanup(); return TCL_OK; } /* *------------------------------------------------------* * * TlsLibInit -- * * Initializes SSL library once per application * * Results: * A standard Tcl result * * Side effects: * Initializes SSL library * *------------------------------------------------------* */ static int TlsLibInit() { static int initialized = 0; dprintf("Called"); if (!initialized) { /* Initialize BOTH libcrypto and libssl. */ if (!OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS | OPENSSL_INIT_ADD_ALL_CIPHERS | OPENSSL_INIT_ADD_ALL_DIGESTS | OPENSSL_INIT_LOAD_CONFIG | OPENSSL_INIT_ASYNC, NULL)) { return TCL_ERROR; } /* Create BIO handlers */ BIO_new_tcl(NULL, 0); /* Create exit handler */ Tcl_CreateExitHandler(TlsLibShutdown, NULL); initialized = 1; } return TCL_OK; } /* Init script */ static const char tlsTclInitScript[] = { #include "tls.tcl.h" }; /* *------------------------------------------------------------------- * * Tls_Init -- * * This is a package initialization procedure, which is called * by TCL when this package is to be added to an interpreter. * * Results: * Initializes structures and creates commands. * * Side effects: * Create the commands * *------------------------------------------------------------------- */ #if TCL_MAJOR_VERSION > 8 #define MIN_VERSION "9.0" #else |
︙ | ︙ | |||
2978 2979 2980 2981 2982 2983 2984 | return TCL_ERROR; } return Tcl_PkgProvide(interp, PACKAGE_NAME, PACKAGE_VERSION); } /* | | < | < < | | > | < | | 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 | return TCL_ERROR; } return Tcl_PkgProvide(interp, PACKAGE_NAME, PACKAGE_VERSION); } /* *------------------------------------------------------------------- * * Tls_SafeInit -- * * This is a package initialization procedure for safe interps. * * Results: * Same as of 'Tls_Init' * * Side effects: * Same as of 'Tls_Init' * *------------------------------------------------------------------- */ DLLEXPORT int Tls_SafeInit(Tcl_Interp *interp) { dprintf("Called"); return Tls_Init(interp); } |