34
34
#include <xmlsec/openssl/x509.h>
35
35
36
36
static int xmlSecOpenSSLErrorsInit (void );
37
+ static void xmlSecOpenSSLErrorsShutdown (void );
37
38
38
39
static xmlSecCryptoDLFunctionsPtr gXmlSecOpenSSLFunctions = NULL ;
39
40
static xmlChar * gXmlSecOpenSSLTrustedCertsFolder = NULL ;
@@ -357,6 +358,7 @@ xmlSecOpenSSLInit (void) {
357
358
int
358
359
xmlSecOpenSSLShutdown (void ) {
359
360
xmlSecOpenSSLSetDefaultTrustedCertsFolder (NULL );
361
+ xmlSecOpenSSLErrorsShutdown ();
360
362
return (0 );
361
363
}
362
364
@@ -452,18 +454,21 @@ xmlSecOpenSSLErrorsDefaultCallback(const char* file, int line, const char* func,
452
454
reason , msg );
453
455
}
454
456
457
+ #ifndef OPENSSL_IS_BORINGSSL
458
+ static ERR_STRING_DATA xmlSecOpenSSLStrReasons [XMLSEC_ERRORS_MAX_NUMBER + 1 ];
459
+ static ERR_STRING_DATA xmlSecOpenSSLStrLib [] = {
460
+ { ERR_PACK (XMLSEC_OPENSSL_ERRORS_LIB ,0 ,0 ), "xmlsec routines" },
461
+ { 0 , NULL }
462
+ };
463
+ static ERR_STRING_DATA xmlSecOpenSSLStrDefReason []= {
464
+ { XMLSEC_OPENSSL_ERRORS_LIB , "xmlsec lib" },
465
+ { 0 , NULL }
466
+ };
467
+ #endif /* OPENSSL_IS_BORINGSSL */
468
+
455
469
static int
456
470
xmlSecOpenSSLErrorsInit (void ) {
457
471
#ifndef OPENSSL_IS_BORINGSSL
458
- static ERR_STRING_DATA xmlSecOpenSSLStrReasons [XMLSEC_ERRORS_MAX_NUMBER + 1 ];
459
- static ERR_STRING_DATA xmlSecOpenSSLStrLib []= {
460
- { ERR_PACK (XMLSEC_OPENSSL_ERRORS_LIB ,0 ,0 ), "xmlsec routines" },
461
- { 0 , NULL }
462
- };
463
- static ERR_STRING_DATA xmlSecOpenSSLStrDefReason []= {
464
- { XMLSEC_OPENSSL_ERRORS_LIB , "xmlsec lib" },
465
- { 0 , NULL }
466
- };
467
472
xmlSecSize pos ;
468
473
469
474
/* initialize reasons array */
@@ -473,7 +478,7 @@ xmlSecOpenSSLErrorsInit(void) {
473
478
xmlSecOpenSSLStrReasons [pos ].string = xmlSecErrorsGetMsg (pos );
474
479
}
475
480
476
- /* finally load xmlsec strings in OpenSSL */
481
+ /* load xmlsec strings in OpenSSL */
477
482
ERR_load_strings (XMLSEC_OPENSSL_ERRORS_LIB , xmlSecOpenSSLStrLib ); /* define xmlsec lib name */
478
483
ERR_load_strings (XMLSEC_OPENSSL_ERRORS_LIB , xmlSecOpenSSLStrDefReason ); /* define default reason */
479
484
ERR_load_strings (XMLSEC_OPENSSL_ERRORS_LIB , xmlSecOpenSSLStrReasons );
@@ -485,6 +490,20 @@ xmlSecOpenSSLErrorsInit(void) {
485
490
return (0 );
486
491
}
487
492
493
+
494
+ static void
495
+ xmlSecOpenSSLErrorsShutdown (void ) {
496
+ /* remove callback */
497
+ xmlSecErrorsSetCallback (NULL );
498
+
499
+ #ifndef OPENSSL_IS_BORINGSSL
500
+ /* unload xmlsec strings from OpenSSL */
501
+ ERR_unload_strings (XMLSEC_OPENSSL_ERRORS_LIB , xmlSecOpenSSLStrLib );
502
+ ERR_unload_strings (XMLSEC_OPENSSL_ERRORS_LIB , xmlSecOpenSSLStrDefReason );
503
+ ERR_unload_strings (XMLSEC_OPENSSL_ERRORS_LIB , xmlSecOpenSSLStrReasons );
504
+ #endif /* OPENSSL_IS_BORINGSSL */
505
+ }
506
+
488
507
/**
489
508
* xmlSecOpenSSLSetDefaultTrustedCertsFolder:
490
509
* @path: the default trusted certs path.
0 commit comments