diff options
-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", |