From 865adf97c9b8271788ee7293ecde9e8a643a1c45 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Thu, 18 Jun 2020 09:26:22 +0100 Subject: Revert "The EVP_MAC functions have been renamed for consistency. The EVP_MAC_CTX_*" The commit claimed to make things more consistent. In fact it makes it less so. Revert back to the previous namig convention. This reverts commit d9c2fd51e2e278bc3f7793a104ff7b4879f6d63a. Reviewed-by: Tomas Mraz Reviewed-by: Nicola Tuveri Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/12186) --- crypto/modes/siv128.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'crypto/modes') diff --git a/crypto/modes/siv128.c b/crypto/modes/siv128.c index f7fadf2..d365567 100644 --- a/crypto/modes/siv128.c +++ b/crypto/modes/siv128.c @@ -94,7 +94,7 @@ __owur static ossl_inline int siv128_do_s2v_p(SIV128_CONTEXT *ctx, SIV_BLOCK *ou EVP_MAC_CTX *mac_ctx; int ret = 0; - mac_ctx = EVP_MAC_dup_ctx(ctx->mac_ctx_init); + mac_ctx = EVP_MAC_CTX_dup(ctx->mac_ctx_init); if (mac_ctx == NULL) return 0; @@ -121,7 +121,7 @@ __owur static ossl_inline int siv128_do_s2v_p(SIV128_CONTEXT *ctx, SIV_BLOCK *ou ret = 1; err: - EVP_MAC_free_ctx(mac_ctx); + EVP_MAC_CTX_free(mac_ctx); return ret; } @@ -182,20 +182,20 @@ int CRYPTO_siv128_init(SIV128_CONTEXT *ctx, const unsigned char *key, int klen, /* TODO(3.0) library context */ || (ctx->mac = EVP_MAC_fetch(NULL, OSSL_MAC_NAME_CMAC, NULL)) == NULL - || (ctx->mac_ctx_init = EVP_MAC_new_ctx(ctx->mac)) == NULL - || !EVP_MAC_set_ctx_params(ctx->mac_ctx_init, params) + || (ctx->mac_ctx_init = EVP_MAC_CTX_new(ctx->mac)) == NULL + || !EVP_MAC_CTX_set_params(ctx->mac_ctx_init, params) || !EVP_EncryptInit_ex(ctx->cipher_ctx, ctr, NULL, key + klen, NULL) - || (mac_ctx = EVP_MAC_dup_ctx(ctx->mac_ctx_init)) == NULL + || (mac_ctx = EVP_MAC_CTX_dup(ctx->mac_ctx_init)) == NULL || !EVP_MAC_update(mac_ctx, zero, sizeof(zero)) || !EVP_MAC_final(mac_ctx, ctx->d.byte, &out_len, sizeof(ctx->d.byte))) { EVP_CIPHER_CTX_free(ctx->cipher_ctx); - EVP_MAC_free_ctx(ctx->mac_ctx_init); - EVP_MAC_free_ctx(mac_ctx); + EVP_MAC_CTX_free(ctx->mac_ctx_init); + EVP_MAC_CTX_free(mac_ctx); EVP_MAC_free(ctx->mac); return 0; } - EVP_MAC_free_ctx(mac_ctx); + EVP_MAC_CTX_free(mac_ctx); ctx->final_ret = -1; ctx->crypto_ok = 1; @@ -211,8 +211,8 @@ int CRYPTO_siv128_copy_ctx(SIV128_CONTEXT *dest, SIV128_CONTEXT *src) memcpy(&dest->d, &src->d, sizeof(src->d)); if (!EVP_CIPHER_CTX_copy(dest->cipher_ctx, src->cipher_ctx)) return 0; - EVP_MAC_free_ctx(dest->mac_ctx_init); - dest->mac_ctx_init = EVP_MAC_dup_ctx(src->mac_ctx_init); + EVP_MAC_CTX_free(dest->mac_ctx_init); + dest->mac_ctx_init = EVP_MAC_CTX_dup(src->mac_ctx_init); if (dest->mac_ctx_init == NULL) return 0; return 1; @@ -232,15 +232,15 @@ int CRYPTO_siv128_aad(SIV128_CONTEXT *ctx, const unsigned char *aad, siv128_dbl(&ctx->d); - if ((mac_ctx = EVP_MAC_dup_ctx(ctx->mac_ctx_init)) == NULL + if ((mac_ctx = EVP_MAC_CTX_dup(ctx->mac_ctx_init)) == NULL || !EVP_MAC_update(mac_ctx, aad, len) || !EVP_MAC_final(mac_ctx, mac_out.byte, &out_len, sizeof(mac_out.byte)) || out_len != SIV_LEN) { - EVP_MAC_free_ctx(mac_ctx); + EVP_MAC_CTX_free(mac_ctx); return 0; } - EVP_MAC_free_ctx(mac_ctx); + EVP_MAC_CTX_free(mac_ctx); siv128_xorblock(&ctx->d, &mac_out); @@ -352,7 +352,7 @@ int CRYPTO_siv128_cleanup(SIV128_CONTEXT *ctx) if (ctx != NULL) { EVP_CIPHER_CTX_free(ctx->cipher_ctx); ctx->cipher_ctx = NULL; - EVP_MAC_free_ctx(ctx->mac_ctx_init); + EVP_MAC_CTX_free(ctx->mac_ctx_init); ctx->mac_ctx_init = NULL; EVP_MAC_free(ctx->mac); ctx->mac = NULL; -- cgit v1.1