diff options
author | Richard Levitte <levitte@openssl.org> | 2020-01-09 21:38:47 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-01-19 02:47:46 +0100 |
commit | 9767a3dca781563a3dcc20094610d8ed0cb6061e (patch) | |
tree | f15daf496eaf7ecc28a7e61d5e56f74a7329504d /crypto/asn1/a_sign.c | |
parent | 0a054d2a0b1ccab07587185245455093454fe353 (diff) |
libcrypto: Eliminate as much use of EVP_PKEY_size() as possible
Some uses were going against documented recommendations.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10798)
Diffstat (limited to 'crypto/asn1/a_sign.c')
-rw-r--r-- | crypto/asn1/a_sign.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/asn1/a_sign.c b/crypto/asn1/a_sign.c index fdf25b204b..564a500cf4 100644 --- a/crypto/asn1/a_sign.c +++ b/crypto/asn1/a_sign.c @@ -216,7 +216,12 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it, goto err; } inl = buf_len; - outll = outl = EVP_PKEY_size(pkey); + if (!EVP_DigestSign(ctx, NULL, &outll, buf_in, inl)) { + outl = 0; + ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX, ERR_R_EVP_LIB); + goto err; + } + outl = outll; buf_out = OPENSSL_malloc(outll); if (buf_in == NULL || buf_out == NULL) { outl = 0; |