summaryrefslogtreecommitdiffstats
path: root/src/crypto/evp
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/evp')
-rw-r--r--src/crypto/evp/CMakeLists.txt5
-rw-r--r--src/crypto/evp/evp.c9
-rw-r--r--src/crypto/evp/p_hmac.c10
3 files changed, 17 insertions, 7 deletions
diff --git a/src/crypto/evp/CMakeLists.txt b/src/crypto/evp/CMakeLists.txt
index 6db9752..5769fa4 100644
--- a/src/crypto/evp/CMakeLists.txt
+++ b/src/crypto/evp/CMakeLists.txt
@@ -26,12 +26,15 @@ add_executable(
evp_extra_test
evp_extra_test.cc
+
+ $<TARGET_OBJECTS:test_support>
)
add_executable(
evp_test
evp_test.cc
+
$<TARGET_OBJECTS:test_support>
)
@@ -39,6 +42,8 @@ add_executable(
pbkdf_test
pbkdf_test.cc
+
+ $<TARGET_OBJECTS:test_support>
)
target_link_libraries(evp_extra_test crypto)
diff --git a/src/crypto/evp/evp.c b/src/crypto/evp/evp.c
index 58fd9a9..0ad5c27 100644
--- a/src/crypto/evp/evp.c
+++ b/src/crypto/evp/evp.c
@@ -70,6 +70,7 @@
#include <openssl/thread.h>
#include "internal.h"
+#include "../internal.h"
extern const EVP_PKEY_ASN1_METHOD dsa_asn1_meth;
@@ -106,7 +107,7 @@ void EVP_PKEY_free(EVP_PKEY *pkey) {
return;
}
- if (CRYPTO_add(&pkey->references, -1, CRYPTO_LOCK_EVP_PKEY)) {
+ if (!CRYPTO_refcount_dec_and_test_zero(&pkey->references)) {
return;
}
@@ -115,7 +116,7 @@ void EVP_PKEY_free(EVP_PKEY *pkey) {
}
EVP_PKEY *EVP_PKEY_up_ref(EVP_PKEY *pkey) {
- CRYPTO_add(&pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
+ CRYPTO_refcount_inc(&pkey->references);
return pkey;
}
@@ -441,4 +442,8 @@ EVP_PKEY *EVP_PKEY_dup(EVP_PKEY *pkey) {
void OpenSSL_add_all_algorithms(void) {}
+void OpenSSL_add_all_ciphers(void) {}
+
+void OpenSSL_add_all_digests(void) {}
+
void EVP_cleanup(void) {}
diff --git a/src/crypto/evp/p_hmac.c b/src/crypto/evp/p_hmac.c
index 21703ed..7d3254a 100644
--- a/src/crypto/evp/p_hmac.c
+++ b/src/crypto/evp/p_hmac.c
@@ -64,6 +64,7 @@
#include <openssl/obj.h>
#include "internal.h"
+#include "../digest/internal.h"
typedef struct {
@@ -142,15 +143,14 @@ static int pkey_hmac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) {
return 1;
}
-static int int_update(EVP_MD_CTX *ctx, const void *data, size_t count) {
+static void int_update(EVP_MD_CTX *ctx, const void *data, size_t count) {
HMAC_PKEY_CTX *hctx = ctx->pctx->data;
- return HMAC_Update(&hctx->ctx, data, count);
+ HMAC_Update(&hctx->ctx, data, count);
}
static int hmac_signctx_init(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx) {
- HMAC_PKEY_CTX *hctx = ctx->data;
-
- HMAC_CTX_set_flags(&hctx->ctx, mctx->flags & ~EVP_MD_CTX_FLAG_NO_INIT);
+ /* |mctx| gets repurposed as a hook to call |HMAC_Update|. Suppress the
+ * automatic setting of |mctx->update| and the rest of its initialization. */
EVP_MD_CTX_set_flags(mctx, EVP_MD_CTX_FLAG_NO_INIT);
mctx->update = int_update;
return 1;