Rename EVP_MAC_size() to EVP_MAC_CTX_get_mac_size().
authorShane Lontis <shane.lontis@oracle.com>
Tue, 13 Oct 2020 04:22:17 +0000 (14:22 +1000)
committerShane Lontis <shane.lontis@oracle.com>
Thu, 22 Oct 2020 10:47:02 +0000 (20:47 +1000)
Fixes #11320

Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13116)

15 files changed:
apps/fipsinstall.c
crypto/evp/mac_lib.c
doc/man3/EVP_MAC.pod
doc/man7/EVP_MAC-BLAKE2.pod
doc/man7/EVP_MAC-CMAC.pod
doc/man7/EVP_MAC-GMAC.pod
doc/man7/EVP_MAC-HMAC.pod
doc/man7/EVP_MAC-KMAC.pod
doc/man7/EVP_MAC-Poly1305.pod
doc/man7/EVP_MAC-Siphash.pod
include/openssl/evp.h
providers/implementations/kdfs/kbkdf.c
providers/implementations/kdfs/sskdf.c
providers/implementations/kdfs/tls1_prf.c
ssl/t1_lib.c

index cb78489eef1d468e08364edc14c25f4e653ced77..d1cda249410c4ddd06ab148007598113f314c66f 100644 (file)
@@ -80,7 +80,7 @@ static int do_mac(EVP_MAC_CTX *ctx, unsigned char *tmp, BIO *in,
 
     if (!EVP_MAC_init(ctx))
         goto err;
-    if (EVP_MAC_size(ctx) > outsz)
+    if (EVP_MAC_CTX_get_mac_size(ctx) > outsz)
         goto end;
     while ((i = BIO_read(in, (char *)tmp, BUFSIZE)) != 0) {
         if (i < 0 || !EVP_MAC_update(ctx, tmp, i))
index d76ffedcb8ccb3b1bffac02a58d365844baaebdc..ac8bfb150cf84f00a470d94e5582f5790cec4c02 100644 (file)
@@ -82,7 +82,7 @@ EVP_MAC *EVP_MAC_CTX_mac(EVP_MAC_CTX *ctx)
     return ctx->meth;
 }
 
-size_t EVP_MAC_size(EVP_MAC_CTX *ctx)
+size_t EVP_MAC_CTX_get_mac_size(EVP_MAC_CTX *ctx)
 {
     size_t sz = 0;
 
@@ -124,7 +124,7 @@ int EVP_MAC_final(EVP_MAC_CTX *ctx,
     if (out != NULL)
         res = ctx->meth->final(ctx->data, out, &l, outsize);
     else
-        l = EVP_MAC_size(ctx);
+        l = EVP_MAC_CTX_get_mac_size(ctx);
     if (outl != NULL)
         *outl = l;
     return res;
index 87f2518754d0ddc0461af6898ce0559a5387df6e..455d154ceedd05368f138b12032ed9d13f42cb4b 100644 (file)
@@ -7,7 +7,7 @@ EVP_MAC_is_a, EVP_MAC_number, EVP_MAC_name, EVP_MAC_names_do_all,
 EVP_MAC_provider, EVP_MAC_get_params, EVP_MAC_gettable_params,
 EVP_MAC_CTX, EVP_MAC_CTX_new, EVP_MAC_CTX_free, EVP_MAC_CTX_dup,
 EVP_MAC_CTX_mac, EVP_MAC_CTX_get_params, EVP_MAC_CTX_set_params,
-EVP_MAC_size, EVP_MAC_init, EVP_MAC_update, EVP_MAC_final,
+EVP_MAC_CTX_get_mac_size, EVP_MAC_init, EVP_MAC_update, EVP_MAC_final,
 EVP_MAC_gettable_ctx_params, EVP_MAC_settable_ctx_params,
 EVP_MAC_do_all_provided - EVP MAC routines
 
@@ -38,7 +38,7 @@ EVP_MAC_do_all_provided - EVP MAC routines
  int EVP_MAC_CTX_get_params(EVP_MAC_CTX *ctx, OSSL_PARAM params[]);
  int EVP_MAC_CTX_set_params(EVP_MAC_CTX *ctx, const OSSL_PARAM params[]);
 
- size_t EVP_MAC_size(EVP_MAC_CTX *ctx);
+ size_t EVP_MAC_CTX_get_mac_size(EVP_MAC_CTX *ctx);
  int EVP_MAC_init(EVP_MAC_CTX *ctx);
  int EVP_MAC_update(EVP_MAC_CTX *ctx, const unsigned char *data, size_t datalen);
  int EVP_MAC_final(EVP_MAC_CTX *ctx,
@@ -162,7 +162,7 @@ See L<OSSL_PARAM(3)> for the use of B<OSSL_PARAM> as parameter descriptor.
 
 =head2 Information functions
 
-EVP_MAC_size() returns the MAC output size for the given context.
+EVP_MAC_CTX_get_mac_size() returns the MAC output size for the given context.
 
 EVP_MAC_is_a() checks if the given I<mac> is an implementation of an
 algorithm that's identifiable with I<name>.
@@ -303,8 +303,7 @@ success, 0 on error.
 EVP_MAC_init(), EVP_MAC_update(), and EVP_MAC_final() return 1 on success, 0
 on error.
 
-EVP_MAC_size() returns the expected output size, or 0 if it isn't
-set.
+EVP_MAC_CTX_get_mac_size() returns the expected output size, or 0 if it isn't set.
 If it isn't set, a call to EVP_MAC_init() should get it set.
 
 EVP_MAC_do_all_provided() returns nothing at all.
index 90b065340d86b6c6716ee8ebf1dbf14f64ba49a1..51bac880b57f2c4ebaa118a249e12a47738ab9c2 100644 (file)
@@ -29,7 +29,7 @@ L<EVP_MAC(3)/PARAMETERS>.
 
 All these parameters can be set with EVP_MAC_CTX_set_params().
 Furthermore, the "size" parameter can be retrieved with
-EVP_MAC_CTX_get_params(), or with EVP_MAC_size().
+EVP_MAC_CTX_get_params(), or with EVP_MAC_CTX_get_mac_size().
 The length of the "size" parameter should not exceed that of a B<size_t>.
 
 =over 4
index c210d693ced6d614cd9b8b59dc789966b9e62b4a..4d05919b8f22620aacbaef3cfeab3fab8db1b9a7 100644 (file)
@@ -45,7 +45,7 @@ EVP_MAC_CTX_get_params():
 
 =back
 
-The "size" parameter can also be retrieved with with EVP_MAC_size().
+The "size" parameter can also be retrieved with with EVP_MAC_CTX_get_mac_size().
 The length of the "size" parameter is equal to that of an B<unsigned int>.
 
 =head1 SEE ALSO
index 7c9477c2154950dd875d1b8a2e292e9b65ab0bfe..d662e7d5d2f6f257f7f4950fa74c36b27349c76c 100644 (file)
@@ -47,7 +47,7 @@ EVP_MAC_CTX_get_params():
 
 =back
 
-The "size" parameter can also be retrieved with EVP_MAC_size().
+The "size" parameter can also be retrieved with EVP_MAC_CTX_get_mac_size().
 The length of the "size" parameter is equal to that of an B<unsigned int>.
 
 =head1 SEE ALSO
index 45ccd17211216463948e66a01f73de1d32885507..94bac8dbcf29689c97e83f325644a5ffd0445a96 100644 (file)
@@ -51,7 +51,7 @@ EVP_MAC_CTX_get_params():
 
 =back
 
-The "size" parameter can also be retrieved with EVP_MAC_size().
+The "size" parameter can also be retrieved with EVP_MAC_CTX_get_mac_size().
 The length of the "size" parameter is equal to that of an B<unsigned int>.
 
 =head1 SEE ALSO
index df7ac1ddf6ea66d55afe0631af8f416ab39017bf..245d998e4a02c6ef6436f227a0033401b18a519a 100644 (file)
@@ -29,7 +29,7 @@ L<EVP_MAC(3)/PARAMETERS>.
 
 All these parameters can be set with EVP_MAC_CTX_set_params().
 Furthermore, the "size" parameter can be retrieved with
-EVP_MAC_CTX_get_params(), or with EVP_MAC_size().
+EVP_MAC_CTX_get_params(), or with EVP_MAC_CTX_get_mac_size().
 The length of the "size" parameter should not exceed that of a B<size_t>.
 
 =over 4
index da9953a1d51d21bcc5bc6822c4539d7b9c7bbc9e..8a0989ab71f45fa4924e3e6a076b01ebb3234826 100644 (file)
@@ -41,7 +41,7 @@ EVP_MAC_CTX_get_params():
 
 =back
 
-The "size" parameter can also be retrieved with with EVP_MAC_size().
+The "size" parameter can also be retrieved with with EVP_MAC_CTX_get_mac_size().
 The length of the "size" parameter should not exceed that of an B<unsigned int>.
 
 =head1 SEE ALSO
index 8b610c43831924a8c83577603194f7b81687f91d..d0a4226ae5f9c16f1d2e4a5c1b9a9634bc61be6c 100644 (file)
@@ -27,7 +27,7 @@ L<EVP_MAC(3)/PARAMETERS>.
 
 All these parameters can be set with EVP_MAC_CTX_set_params().
 Furthermore, the "size" parameter can be retrieved with
-EVP_MAC_CTX_get_params(), or with EVP_MAC_size().
+EVP_MAC_CTX_get_params(), or with EVP_MAC_CTX_get_mac_size().
 The length of the "size" parameter should not exceed that of a B<size_t>.
 
 =over 4
index 7c36e78ce17064ec962e9c4f4b4ac804e269be02..b2b87f2ab468ec45ecab2e4d439424a2a6bbaefa 100644 (file)
@@ -1105,7 +1105,7 @@ EVP_MAC *EVP_MAC_CTX_mac(EVP_MAC_CTX *ctx);
 int EVP_MAC_CTX_get_params(EVP_MAC_CTX *ctx, OSSL_PARAM params[]);
 int EVP_MAC_CTX_set_params(EVP_MAC_CTX *ctx, const OSSL_PARAM params[]);
 
-size_t EVP_MAC_size(EVP_MAC_CTX *ctx);
+size_t EVP_MAC_CTX_get_mac_size(EVP_MAC_CTX *ctx);
 int EVP_MAC_init(EVP_MAC_CTX *ctx);
 int EVP_MAC_update(EVP_MAC_CTX *ctx, const unsigned char *data, size_t datalen);
 int EVP_MAC_final(EVP_MAC_CTX *ctx,
index cf3b90c19c34ec3c856dba2f509f47a6c1499a5c..74a694e8eaba7d2f5c7e2e38713d77e87a3013e6 100644 (file)
@@ -218,7 +218,7 @@ static int kbkdf_derive(void *vctx, unsigned char *key, size_t keylen)
         return 0;
     }
 
-    h = EVP_MAC_size(ctx->ctx_init);
+    h = EVP_MAC_CTX_get_mac_size(ctx->ctx_init);
     if (h == 0)
         goto done;
     if (ctx->iv_len != 0 && ctx->iv_len != h) {
index 6cfde9784271d69bc980c26c6e9e8069971962f0..84711dde272d92ea14f2eeb31ee12ea6a900f186 100644 (file)
@@ -246,7 +246,7 @@ static int SSKDF_mac_kdm(EVP_MAC_CTX *ctx_init,
     if (!EVP_MAC_init(ctx_init))
         goto end;
 
-    out_len = EVP_MAC_size(ctx_init); /* output size */
+    out_len = EVP_MAC_CTX_get_mac_size(ctx_init); /* output size */
     if (out_len <= 0)
         goto end;
     len = derived_key_len;
index 315971a96eaf5c37e749a2dbfce5a480df4e1d9d..aba08068ca72d99de1a5dee45c35e4357eb01b3f 100644 (file)
@@ -296,7 +296,7 @@ static int tls1_prf_P_hash(EVP_MAC_CTX *ctx_init,
         goto err;
     if (!EVP_MAC_init(ctx_init))
         goto err;
-    chunk = EVP_MAC_size(ctx_init);
+    chunk = EVP_MAC_CTX_get_mac_size(ctx_init);
     if (chunk == 0)
         goto err;
     /* A(0) = seed */
index 1971a8e0bc444f82f11daa3b816561e422fc90ac..8836069097a047b70b79528bcbfbedcff9dea3df 100644 (file)
@@ -3461,7 +3461,7 @@ int ssl_hmac_final(SSL_HMAC *ctx, unsigned char *md, size_t *len,
 size_t ssl_hmac_size(const SSL_HMAC *ctx)
 {
     if (ctx->ctx != NULL)
-        return EVP_MAC_size(ctx->ctx);
+        return EVP_MAC_CTX_get_mac_size(ctx->ctx);
 #ifndef OPENSSL_NO_DEPRECATED_3_0
     if (ctx->old_ctx != NULL)
         return ssl_hmac_old_size(ctx);