diff options
author | Richard Levitte <levitte@openssl.org> | 2021-06-22 18:09:25 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2021-06-23 23:00:36 +0200 |
commit | 006de7670a12dff617e86a55b6db7c6e3b1f8fef (patch) | |
tree | b0492fea1e11622a05a5aaeebe195eb4f333f005 /crypto/evp | |
parent | 86ff7cf2a6cdf26f2ba7e64db6fe5c92c64bf9ac (diff) |
EVP: Change the output size type of EVP_Q_digest() and EVP_Q_mac()
This makes them more consistent with other new interfaces.
Fixes #15839
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15861)
Diffstat (limited to 'crypto/evp')
-rw-r--r-- | crypto/evp/digest.c | 9 | ||||
-rw-r--r-- | crypto/evp/mac_lib.c | 9 |
2 files changed, 11 insertions, 7 deletions
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index 98c39343be..4a5c926103 100644 --- a/crypto/evp/digest.c +++ b/crypto/evp/digest.c @@ -630,16 +630,19 @@ int EVP_Digest(const void *data, size_t count, } int EVP_Q_digest(OSSL_LIB_CTX *libctx, const char *name, const char *propq, - const void *data, size_t count, - unsigned char *md, unsigned int *size) + const void *data, size_t datalen, + unsigned char *md, size_t *mdlen) { EVP_MD *digest = EVP_MD_fetch(libctx, name, propq); + unsigned int temp = 0; int ret = 0; if (digest != NULL) { - ret = EVP_Digest(data, count, md, size, digest, NULL); + ret = EVP_Digest(data, datalen, md, &temp, digest, NULL); EVP_MD_free(digest); } + if (mdlen != NULL) + *mdlen = temp; return ret; } diff --git a/crypto/evp/mac_lib.c b/crypto/evp/mac_lib.c index 339d10919f..1a68c58919 100644 --- a/crypto/evp/mac_lib.c +++ b/crypto/evp/mac_lib.c @@ -233,16 +233,17 @@ int EVP_MAC_names_do_all(const EVP_MAC *mac, return 1; } -unsigned char *EVP_Q_mac(OSSL_LIB_CTX *libctx, const char *name, const char *propq, +unsigned char *EVP_Q_mac(OSSL_LIB_CTX *libctx, + const char *name, const char *propq, const char *subalg, const OSSL_PARAM *params, const void *key, size_t keylen, const unsigned char *data, size_t datalen, - unsigned char *out, size_t outsize, unsigned int *outlen) + unsigned char *out, size_t outsize, size_t *outlen) { EVP_MAC *mac = EVP_MAC_fetch(libctx, name, propq); OSSL_PARAM subalg_param[] = { OSSL_PARAM_END, OSSL_PARAM_END }; EVP_MAC_CTX *ctx = NULL; - size_t len; + size_t len = 0; unsigned char *res = NULL; if (outlen != NULL) @@ -286,7 +287,7 @@ unsigned char *EVP_Q_mac(OSSL_LIB_CTX *libctx, const char *name, const char *pro } res = out; if (res != NULL && outlen != NULL) - *outlen = (unsigned int)len; + *outlen = len; } err: |