summaryrefslogtreecommitdiffstats
path: root/crypto/hmac
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-05-21 16:58:08 +0200
committerTomas Mraz <tomas@openssl.org>2021-06-01 12:40:00 +0200
commited576acdf591d4164905ab98e89ca5a3b99d90ab (patch)
treec0f36ca1b3d42f34c0c502e700ad09b69b713d3c /crypto/hmac
parent5e2d22d53ed322a7124e26a4fbd116a8210eb77a (diff)
Rename all getters to use get/get0 in name
For functions that exist in 1.1.1 provide a simple aliases via #define. Fixes #15236 Functions with OSSL_DECODER_, OSSL_ENCODER_, OSSL_STORE_LOADER_, EVP_KEYEXCH_, EVP_KEM_, EVP_ASYM_CIPHER_, EVP_SIGNATURE_, EVP_KEYMGMT_, EVP_RAND_, EVP_MAC_, EVP_KDF_, EVP_PKEY_, EVP_MD_, and EVP_CIPHER_ prefixes are renamed. Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15405)
Diffstat (limited to 'crypto/hmac')
-rw-r--r--crypto/hmac/hmac.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/crypto/hmac/hmac.c b/crypto/hmac/hmac.c
index 86cdb7bde5..618b0a6196 100644
--- a/crypto/hmac/hmac.c
+++ b/crypto/hmac/hmac.c
@@ -46,13 +46,13 @@ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
* The HMAC construction is not allowed to be used with the
* extendable-output functions (XOF) shake128 and shake256.
*/
- if ((EVP_MD_flags(md) & EVP_MD_FLAG_XOF) != 0)
+ if ((EVP_MD_get_flags(md) & EVP_MD_FLAG_XOF) != 0)
return 0;
if (key != NULL) {
reset = 1;
- j = EVP_MD_block_size(md);
+ j = EVP_MD_get_block_size(md);
if (!ossl_assert(j <= (int)sizeof(keytmp)))
return 0;
if (j < 0)
@@ -76,13 +76,15 @@ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
for (i = 0; i < HMAC_MAX_MD_CBLOCK_SIZE; i++)
pad[i] = 0x36 ^ keytmp[i];
if (!EVP_DigestInit_ex(ctx->i_ctx, md, impl)
- || !EVP_DigestUpdate(ctx->i_ctx, pad, EVP_MD_block_size(md)))
+ || !EVP_DigestUpdate(ctx->i_ctx, pad,
+ EVP_MD_get_block_size(md)))
goto err;
for (i = 0; i < HMAC_MAX_MD_CBLOCK_SIZE; i++)
pad[i] = 0x5c ^ keytmp[i];
if (!EVP_DigestInit_ex(ctx->o_ctx, md, impl)
- || !EVP_DigestUpdate(ctx->o_ctx, pad, EVP_MD_block_size(md)))
+ || !EVP_DigestUpdate(ctx->o_ctx, pad,
+ EVP_MD_get_block_size(md)))
goto err;
}
if (!EVP_MD_CTX_copy_ex(ctx->md_ctx, ctx->i_ctx))
@@ -135,7 +137,7 @@ int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len)
size_t HMAC_size(const HMAC_CTX *ctx)
{
- int size = EVP_MD_size((ctx)->md);
+ int size = EVP_MD_get_size((ctx)->md);
return (size < 0) ? 0 : size;
}
@@ -221,11 +223,11 @@ unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
unsigned char *md, unsigned int *md_len)
{
static unsigned char static_md[EVP_MAX_MD_SIZE];
- int size = EVP_MD_size(evp_md);
+ int size = EVP_MD_get_size(evp_md);
if (size < 0)
return NULL;
- return EVP_Q_mac(NULL, "HMAC", NULL, EVP_MD_name(evp_md), NULL,
+ return EVP_Q_mac(NULL, "HMAC", NULL, EVP_MD_get0_name(evp_md), NULL,
key, key_len, data, data_len,
md == NULL ? static_md : md, size, md_len);
}