diff options
author | Richard Levitte <levitte@openssl.org> | 2015-11-27 14:10:15 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2015-12-07 17:36:57 +0100 |
commit | fa0c23de83efaf92da17cffce12444adbca48c89 (patch) | |
tree | eabc5d551793512d436f4cecd34c24bd82c3505b /crypto/engine | |
parent | 77a01145be26ceeefa6870e1e9dd7f99ac123fa3 (diff) |
Adapt HMAC to the EVP_MD_CTX changes
This change required some special treatment, as HMAC is intertwined
with EVP_MD. For now, all local HMAC_CTX variables MUST be
initialised with HMAC_CTX_EMPTY, or whatever happens to be on the
stack will be mistaken for actual pointers to EVP_MD_CTX. This will
change as soon as HMAC_CTX becomes opaque.
Also, since HMAC_CTX_init() can fail now, its return type changes from
void to int, and it will return 0 on failure, 1 on success.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/engine')
-rw-r--r-- | crypto/engine/eng_openssl.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/engine/eng_openssl.c b/crypto/engine/eng_openssl.c index ba9adf0efa..8927ee190f 100644 --- a/crypto/engine/eng_openssl.c +++ b/crypto/engine/eng_openssl.c @@ -448,7 +448,8 @@ static int ossl_hmac_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src) sctx = EVP_PKEY_CTX_get_data(src); dctx = EVP_PKEY_CTX_get_data(dst); dctx->md = sctx->md; - HMAC_CTX_init(&dctx->ctx); + /* Because HMAC_CTX_copy does HMAC_CTX_init */ + HMAC_CTX_cleanup(&dctx->ctx); if (!HMAC_CTX_copy(&dctx->ctx, &sctx->ctx)) return 0; if (sctx->ktmp.data) { |