diff options
author | Alberto Compagno <acompagn+fdio@cisco.com> | 2018-11-26 16:13:10 +0100 |
---|---|---|
committer | Alberto Compagno <acompagn+fdio@cisco.com> | 2018-11-26 16:13:10 +0100 |
commit | 7f560eb2b8af423ae1f0f0de1ef5d043f93eaa08 (patch) | |
tree | bf554822008d6db4d7a60008bc24e1f237f112b8 | |
parent | 7093864d4cce1967d36f9d675d3df257e97d5944 (diff) |
Added support for openssl 1.1.1
Change-Id: I596fd56152c32106c5279fc3033d48164328a903
Signed-off-by: Alberto Compagno <acompagn+fdio@cisco.com>
-rw-r--r-- | libparc/parc/security/parc_Pkcs12KeyStore.c | 6 | ||||
-rw-r--r-- | libparc/parc/security/parc_SymmetricKeySigner.c | 2 | ||||
-rw-r--r-- | libparc/parc/security/test/test_parc_SymmetricKeySigner.c | 7 |
3 files changed, 11 insertions, 4 deletions
diff --git a/libparc/parc/security/parc_Pkcs12KeyStore.c b/libparc/parc/security/parc_Pkcs12KeyStore.c index 392c9d34..c0d673c4 100644 --- a/libparc/parc/security/parc_Pkcs12KeyStore.c +++ b/libparc/parc/security/parc_Pkcs12KeyStore.c @@ -127,7 +127,11 @@ _parcPkcs12KeyStore_ParseFile(PARCPkcs12KeyStore *keystore, const char *filename keystore->public_key = X509_get_pubkey(keystore->x509_cert); if (keystore->public_key) { - switch (keystore->public_key->type) { +#if OPENSSL_VERSION_NUMBER >= 0X10100000L + switch (EVP_PKEY_id(keystore->public_key)) { +#else + switch (keystore->public_key->type) { +#endif case EVP_PKEY_RSA: keystore->signAlgo = PARCSigningAlgorithm_RSA; break; diff --git a/libparc/parc/security/parc_SymmetricKeySigner.c b/libparc/parc/security/parc_SymmetricKeySigner.c index 5cde896b..b06389dd 100644 --- a/libparc/parc/security/parc_SymmetricKeySigner.c +++ b/libparc/parc/security/parc_SymmetricKeySigner.c @@ -116,8 +116,8 @@ _hmacDestroy(void **ctxPtr) HMAC_CTX_free(*ctxPtr); #else HMAC_CTX_cleanup(*ctxPtr); -#endif parcMemory_Deallocate((void **) ctxPtr); +#endif *ctxPtr = NULL; } diff --git a/libparc/parc/security/test/test_parc_SymmetricKeySigner.c b/libparc/parc/security/test/test_parc_SymmetricKeySigner.c index 01874e75..44b169eb 100644 --- a/libparc/parc/security/test/test_parc_SymmetricKeySigner.c +++ b/libparc/parc/security/test/test_parc_SymmetricKeySigner.c @@ -155,11 +155,12 @@ LONGBOW_TEST_CASE(Specialization, test_hmac_sha256) #if OPENSSL_VERSION_NUMBER >= 0x10100000L _hmacInit(ctx); _hmacUpdate(ctx, to_digest_buffer, to_digest_length); + PARCBuffer *output = _hmacFinalize(ctx); #else _hmacInit(&ctx); _hmacUpdate(&ctx, to_digest_buffer, to_digest_length); -#endif PARCBuffer *output = _hmacFinalize(&ctx); +#endif assertTrue(parcBuffer_Position(output) == true_hmac_length, "hmac wrong length, expected %zu got %zu", @@ -168,6 +169,7 @@ LONGBOW_TEST_CASE(Specialization, test_hmac_sha256) assertTrue(memcmp(parcByteArray_Array(parcBuffer_Array(output)), true_hmac_buffer, true_hmac_length) == 0, "hmac values did not match"); + #if OPENSSL_VERSION_NUMBER >= 0x10100000L HMAC_CTX_free(ctx); #else @@ -214,11 +216,12 @@ LONGBOW_TEST_CASE(Specialization, test_hmac_sha512) #if OPENSSL_VERSION_NUMBER >= 0x10100000L _hmacInit(ctx); _hmacUpdate(ctx, to_digest_buffer, to_digest_length); + PARCBuffer *output = _hmacFinalize(ctx); #else _hmacInit(&ctx); _hmacUpdate(&ctx, to_digest_buffer, to_digest_length); -#endif PARCBuffer *output = _hmacFinalize(&ctx); +#endif assertTrue(parcBuffer_Position(output) == true_hmac_length, "hmac wrong length, expected %zu got %zu", |