Commit 1c7eceac authored by David Johnson's avatar David Johnson

Bugfix: used wrong 1.1.0 OPENSSL_VERSION_NUMBER.

Also fixed a small build bug for < 1.1.0.
parent 2204eda9
...@@ -1720,7 +1720,7 @@ event_notification_insert_hmac(event_handle_t handle, ...@@ -1720,7 +1720,7 @@ event_notification_insert_hmac(event_handle_t handle,
pubsub_notification_remove(notification->pubsub_notification, pubsub_notification_remove(notification->pubsub_notification,
"___elvin_ordered___", &handle->status); "___elvin_ordered___", &handle->status);
#if (OPENSSL_VERSION_NUMBER >= 0x01010000L) #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
ctxp = HMAC_CTX_new(); ctxp = HMAC_CTX_new();
if (!ctxp) { if (!ctxp) {
ERROR("HMAC_CTX_new failed to alloc ctx\n"); ERROR("HMAC_CTX_new failed to alloc ctx\n");
...@@ -1742,7 +1742,7 @@ event_notification_insert_hmac(event_handle_t handle, ...@@ -1742,7 +1742,7 @@ event_notification_insert_hmac(event_handle_t handle,
hmac_traverse, hmac_traverse,
ctxp, &handle->status)) { ctxp, &handle->status)) {
ERROR("event_notification_insert_hmac failed: hmac_traverse\n"); ERROR("event_notification_insert_hmac failed: hmac_traverse\n");
#if (OPENSSL_VERSION_NUMBER >= 0x01010000L) #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
HMAC_CTX_free(ctxp); HMAC_CTX_free(ctxp);
#else #else
HMAC_cleanup(ctxp); HMAC_cleanup(ctxp);
...@@ -1750,7 +1750,7 @@ event_notification_insert_hmac(event_handle_t handle, ...@@ -1750,7 +1750,7 @@ event_notification_insert_hmac(event_handle_t handle,
return 1; return 1;
} }
HMAC_Final(ctxp, mac, &len); HMAC_Final(ctxp, mac, &len);
#if (OPENSSL_VERSION_NUMBER >= 0x01010000L) #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
HMAC_CTX_free(ctxp); HMAC_CTX_free(ctxp);
#else #else
HMAC_cleanup(ctxp); HMAC_cleanup(ctxp);
...@@ -1853,6 +1853,9 @@ static int ...@@ -1853,6 +1853,9 @@ static int
event_notification_check_hmac(event_handle_t handle, event_notification_check_hmac(event_handle_t handle,
event_notification_t notification) event_notification_t notification)
{ {
#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
HMAC_CTX ctx;
#endif
HMAC_CTX *ctxp = NULL; HMAC_CTX *ctxp = NULL;
unsigned char srcmac[EVP_MAX_MD_SIZE], mac[EVP_MAX_MD_SIZE]; unsigned char srcmac[EVP_MAX_MD_SIZE], mac[EVP_MAX_MD_SIZE];
char *pmac; char *pmac;
...@@ -1862,6 +1865,11 @@ event_notification_check_hmac(event_handle_t handle, ...@@ -1862,6 +1865,11 @@ event_notification_check_hmac(event_handle_t handle,
#ifdef ELVIN_COMPAT #ifdef ELVIN_COMPAT
struct elvin_hashtable *hashtable; struct elvin_hashtable *hashtable;
#endif #endif
#if (OPENSSL_VERSION_NUMBER < 0x10100000L)
ctxp = &ctx;
#endif
if (0) if (0)
INFO("event_notification_check_hmac (key): %s\n", INFO("event_notification_check_hmac (key): %s\n",
handle->keydata); handle->keydata);
...@@ -1920,7 +1928,7 @@ event_notification_check_hmac(event_handle_t handle, ...@@ -1920,7 +1928,7 @@ event_notification_check_hmac(event_handle_t handle,
* order, and uses __hmac__ to compare against. * order, and uses __hmac__ to compare against.
*/ */
if (! elvin_ordered) { if (! elvin_ordered) {
#if (OPENSSL_VERSION_NUMBER >= 0x01010000L) #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
ctxp = HMAC_CTX_new(); ctxp = HMAC_CTX_new();
if (!ctxp) { if (!ctxp) {
ERROR("HMAC_CTX_new failed to alloc ctx\n"); ERROR("HMAC_CTX_new failed to alloc ctx\n");
...@@ -1928,8 +1936,6 @@ event_notification_check_hmac(event_handle_t handle, ...@@ -1928,8 +1936,6 @@ event_notification_check_hmac(event_handle_t handle,
} }
HMAC_Init_ex(ctxp, handle->keydata, handle->keylen, EVP_sha1(), NULL); HMAC_Init_ex(ctxp, handle->keydata, handle->keylen, EVP_sha1(), NULL);
#else #else
HMAC_CTX ctx;
ctxp = &ctx;
memset(ctxp, 0, sizeof(ctx)); memset(ctxp, 0, sizeof(ctx));
#if (OPENSSL_VERSION_NUMBER < 0x0090703f) #if (OPENSSL_VERSION_NUMBER < 0x0090703f)
HMAC_Init(ctxp, handle->keydata, handle->keylen, EVP_sha1()); HMAC_Init(ctxp, handle->keydata, handle->keylen, EVP_sha1());
...@@ -1943,7 +1949,7 @@ event_notification_check_hmac(event_handle_t handle, ...@@ -1943,7 +1949,7 @@ event_notification_check_hmac(event_handle_t handle,
if (hashtable == NULL) { if (hashtable == NULL) {
ERROR("event_notification_check_hmac failed: " ERROR("event_notification_check_hmac failed: "
"hashtable alloc\n"); "hashtable alloc\n");
#if (OPENSSL_VERSION_NUMBER >= 0x01010000L) #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
HMAC_CTX_free(ctxp); HMAC_CTX_free(ctxp);
#else #else
HMAC_cleanup(ctxp); HMAC_cleanup(ctxp);
...@@ -1957,7 +1963,7 @@ event_notification_check_hmac(event_handle_t handle, ...@@ -1957,7 +1963,7 @@ event_notification_check_hmac(event_handle_t handle,
ERROR("event_notification_check_hmac failed: " ERROR("event_notification_check_hmac failed: "
"hmac_fill_hash\n"); "hmac_fill_hash\n");
elvin_hashtable_free(hashtable); elvin_hashtable_free(hashtable);
#if (OPENSSL_VERSION_NUMBER >= 0x01010000L) #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
HMAC_CTX_free(ctxp); HMAC_CTX_free(ctxp);
#else #else
HMAC_cleanup(ctxp); HMAC_cleanup(ctxp);
...@@ -1969,7 +1975,7 @@ event_notification_check_hmac(event_handle_t handle, ...@@ -1969,7 +1975,7 @@ event_notification_check_hmac(event_handle_t handle,
ERROR("event_notification_check_hmac failed: " ERROR("event_notification_check_hmac failed: "
"notify_traverse\n"); "notify_traverse\n");
elvin_hashtable_free(hashtable); elvin_hashtable_free(hashtable);
#if (OPENSSL_VERSION_NUMBER >= 0x01010000L) #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
HMAC_CTX_free(ctxp); HMAC_CTX_free(ctxp);
#else #else
HMAC_cleanup(ctxp); HMAC_cleanup(ctxp);
...@@ -1978,7 +1984,7 @@ event_notification_check_hmac(event_handle_t handle, ...@@ -1978,7 +1984,7 @@ event_notification_check_hmac(event_handle_t handle,
} }
elvin_hashtable_free(hashtable); elvin_hashtable_free(hashtable);
HMAC_Final(ctxp, mac, &len); HMAC_Final(ctxp, mac, &len);
#if (OPENSSL_VERSION_NUMBER >= 0x01010000L) #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
HMAC_reset(ctxp); HMAC_reset(ctxp);
#else #else
HMAC_cleanup(ctxp); HMAC_cleanup(ctxp);
...@@ -1995,7 +2001,7 @@ event_notification_check_hmac(event_handle_t handle, ...@@ -1995,7 +2001,7 @@ event_notification_check_hmac(event_handle_t handle,
/* /*
* Do a normal HMAC check. * Do a normal HMAC check.
*/ */
#if (OPENSSL_VERSION_NUMBER >= 0x01010000L) #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
if (!ctxp) { if (!ctxp) {
ctxp = HMAC_CTX_new(); ctxp = HMAC_CTX_new();
if (!ctxp) { if (!ctxp) {
...@@ -2019,7 +2025,7 @@ event_notification_check_hmac(event_handle_t handle, ...@@ -2019,7 +2025,7 @@ event_notification_check_hmac(event_handle_t handle,
if (!pubsub_notification_traverse(pubsub_notification, if (!pubsub_notification_traverse(pubsub_notification,
hmac_traverse, hmac_traverse,
ctxp, &handle->status)) { ctxp, &handle->status)) {
#if (OPENSSL_VERSION_NUMBER >= 0x01010000L) #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
HMAC_CTX_free(ctxp); HMAC_CTX_free(ctxp);
#else #else
HMAC_cleanup(ctxp); HMAC_cleanup(ctxp);
...@@ -2028,7 +2034,7 @@ event_notification_check_hmac(event_handle_t handle, ...@@ -2028,7 +2034,7 @@ event_notification_check_hmac(event_handle_t handle,
} }
HMAC_Final(ctxp, mac, &len); HMAC_Final(ctxp, mac, &len);
#if (OPENSSL_VERSION_NUMBER >= 0x01010000L) #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
HMAC_CTX_free(ctxp); HMAC_CTX_free(ctxp);
#else #else
HMAC_cleanup(ctxp); HMAC_cleanup(ctxp);
......
...@@ -750,7 +750,7 @@ convpubkey(struct pubkeydata *k) ...@@ -750,7 +750,7 @@ convpubkey(struct pubkeydata *k)
BN_bin2bn(k->modulus, k->keylength, mod); BN_bin2bn(k->modulus, k->keylength, mod);
BN_bin2bn(k->exponent, k->expsize, exp); BN_bin2bn(k->exponent, k->expsize, exp);
/* set up the RSA public key structure */ /* set up the RSA public key structure */
#if (OPENSSL_VERSION_NUMBER >= 0x01010000L) #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
RSA_set0_key(rsa,mod,exp,NULL); RSA_set0_key(rsa,mod,exp,NULL);
#else #else
rsa->n = mod; rsa->n = mod;
......
...@@ -100,7 +100,7 @@ init_checksum(char *keyfile) ...@@ -100,7 +100,7 @@ init_checksum(char *keyfile)
goto bad; goto bad;
BN_hex2bn(&iqmp, str); BN_hex2bn(&iqmp, str);
fclose(file); fclose(file);
#if (OPENSSL_VERSION_NUMBER >= 0x01010000L) #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
RSA_set0_key(signature_key, n, e, NULL); RSA_set0_key(signature_key, n, e, NULL);
RSA_set0_crt_params(signature_key, dmp1, dmq1, iqmp); RSA_set0_crt_params(signature_key, dmp1, dmq1, iqmp);
#else #else
......
...@@ -1396,13 +1396,13 @@ decrypt_buffer(unsigned char *dest, const unsigned char *source, ...@@ -1396,13 +1396,13 @@ decrypt_buffer(unsigned char *dest, const unsigned char *source,
int update_count = 0; int update_count = 0;
int final_count = 0; int final_count = 0;
int error = 0; int error = 0;
#if (OPENSSL_VERSION_NUMBER < 0x01010000L) #if (OPENSSL_VERSION_NUMBER < 0x10100000L)
EVP_CIPHER_CTX context; EVP_CIPHER_CTX context;
#endif #endif
EVP_CIPHER_CTX *contextp; EVP_CIPHER_CTX *contextp;
EVP_CIPHER const *ecipher; EVP_CIPHER const *ecipher;
#if (OPENSSL_VERSION_NUMBER >= 0x01010000L) #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
contextp = EVP_CIPHER_CTX_new(); contextp = EVP_CIPHER_CTX_new();
#else #else
contextp = &context; contextp = &context;
......
...@@ -3215,7 +3215,7 @@ output_public_key(char *imagename, RSA *key) ...@@ -3215,7 +3215,7 @@ output_public_key(char *imagename, RSA *key)
fprintf(stderr, "Cannot create keyfile %s\n", fname); fprintf(stderr, "Cannot create keyfile %s\n", fname);
exit(1); exit(1);
} }
#if (OPENSSL_VERSION_NUMBER >= 0x01010000L) #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
const BIGNUM *n = NULL, *e = NULL; const BIGNUM *n = NULL, *e = NULL;
const BIGNUM *dmp1 = NULL, *dmq1 = NULL, *iqmp = NULL; const BIGNUM *dmp1 = NULL, *dmq1 = NULL, *iqmp = NULL;
RSA_get0_key(key,&n,&e,NULL); RSA_get0_key(key,&n,&e,NULL);
...@@ -3321,7 +3321,7 @@ checksum_finish(blockhdr_t *hdr) ...@@ -3321,7 +3321,7 @@ checksum_finish(blockhdr_t *hdr)
/* /*
* Encryption functions * Encryption functions
*/ */
#if (OPENSSL_VERSION_NUMBER >= 0x01010000L) #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
static EVP_CIPHER_CTX *cipher_ctxp; static EVP_CIPHER_CTX *cipher_ctxp;
#else #else
static EVP_CIPHER_CTX cipher_ctx; static EVP_CIPHER_CTX cipher_ctx;
...@@ -3346,7 +3346,7 @@ encrypt_start(blockhdr_t *hdr) ...@@ -3346,7 +3346,7 @@ encrypt_start(blockhdr_t *hdr)
/* /*
* Pick our cipher - currently, only Blowfish in CBC mode is supported * Pick our cipher - currently, only Blowfish in CBC mode is supported
*/ */
#if (OPENSSL_VERSION_NUMBER >= 0x01010000L) #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
cipher_ctxp = EVP_CIPHER_CTX_new(); cipher_ctxp = EVP_CIPHER_CTX_new();
#else #else
EVP_CIPHER_CTX_init(cipher_ctxp); EVP_CIPHER_CTX_init(cipher_ctxp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment