int FuzzerInitialize(int *argc, char ***argv) { OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL); ERR_get_state(); CRYPTO_free_ex_index(0, -1); return 1; }
static void free_ec_key_ex_index() { /* CRYPTO_free_ex_index requires OpenSSL version >= 1.1.0-pre1 */ if (ec_key_ex_index > 0) { CRYPTO_free_ex_index(CRYPTO_EX_INDEX_EC_KEY, ec_key_ex_index); ec_key_ex_index = 0; } }
static void free_ecdsa_ex_index() { /* CRYPTO_free_ex_index requires OpenSSL version >= 1.1.0-pre1 */ #if OPENSSL_VERSION_NUMBER >= 0x10100001L if (ecdsa_ex_index > 0) { CRYPTO_free_ex_index(CRYPTO_EX_INDEX_ECDSA, ecdsa_ex_index); ecdsa_ex_index = 0; } #endif }
/* TODO: Free the indexes on unload */ static void free_ec_ex_index() { if (ec_ex_index > 0) { #if OPENSSL_VERSION_NUMBER >= 0x10100002L /* CRYPTO_free_ex_index requires OpenSSL version >= 1.1.0-pre1 */ CRYPTO_free_ex_index(CRYPTO_EX_INDEX_EC_KEY, ec_ex_index); #endif ec_ex_index = 0; } }
int FuzzerInitialize(int *argc, char ***argv) { STACK_OF(SSL_COMP) *comp_methods; OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS | OPENSSL_INIT_ASYNC, NULL); OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS, NULL); ERR_get_state(); CRYPTO_free_ex_index(0, -1); idx = SSL_get_ex_data_X509_STORE_CTX_idx(); FuzzerSetRand(); comp_methods = SSL_COMP_get_compression_methods(); if (comp_methods != NULL) sk_SSL_COMP_sort(comp_methods); return 1; }