summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorWilliam Brawner <me@wbrawner.com>2020-04-05 09:39:41 -0700
committerTomas Mraz <tmraz@fedoraproject.org>2020-04-07 13:13:53 +0200
commitf9f2e609db4de8d1f2022189a99c8277c3f6289d (patch)
treeafc46418f037c1e0df44f118831d316390228f06 /crypto
parente78f2a8f269a4dcf820ca994e2b89b77972d79e1 (diff)
Ensure ECDSA_size always returns >= 0
Fixes #10484 Signed-off-by: William Brawner <me@wbrawner.com> Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/11472)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/ec/ec_asn1.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/ec/ec_asn1.c b/crypto/ec/ec_asn1.c
index 336afc989d..831b74ce6c 100644
--- a/crypto/ec/ec_asn1.c
+++ b/crypto/ec/ec_asn1.c
@@ -1297,5 +1297,7 @@ int ECDSA_size(const EC_KEY *r)
i = i2d_ASN1_INTEGER(&bs, NULL);
i += i; /* r and s */
ret = ASN1_object_size(1, i, V_ASN1_SEQUENCE);
+ if (ret < 0)
+ return 0;
return ret;
}