summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorTJ Saunders <tj@castaglia.org>2016-06-10 00:36:45 -0700
committerRich Salz <rsalz@openssl.org>2016-06-13 15:44:49 -0400
commitbbaa9dd850152bc85cad094e0aa0c685553d149c (patch)
tree9089f4a5ace81d14136c4d2d222ca404ed0844dc /crypto
parent1d454d58a80971eac941911965e894fdf1621cd8 (diff)
Ensure that NULL r and s parameters cannot be set on DSA_SIG/ECDSA_SIGs.
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1193)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/dsa/dsa_asn1.c2
-rw-r--r--crypto/ec/ec_asn1.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/crypto/dsa/dsa_asn1.c b/crypto/dsa/dsa_asn1.c
index f2818f3ab6..f79e1d1404 100644
--- a/crypto/dsa/dsa_asn1.c
+++ b/crypto/dsa/dsa_asn1.c
@@ -34,6 +34,8 @@ void DSA_SIG_get0(BIGNUM **pr, BIGNUM **ps, const DSA_SIG *sig)
int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s)
{
+ if (r == NULL || s == NULL)
+ return 0;
BN_clear_free(sig->r);
BN_clear_free(sig->s);
sig->r = r;
diff --git a/crypto/ec/ec_asn1.c b/crypto/ec/ec_asn1.c
index 9bc4ca7b27..9f7e837308 100644
--- a/crypto/ec/ec_asn1.c
+++ b/crypto/ec/ec_asn1.c
@@ -1182,6 +1182,8 @@ void ECDSA_SIG_get0(BIGNUM **pr, BIGNUM **ps, const ECDSA_SIG *sig)
int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s)
{
+ if (r == NULL || s == NULL)
+ return 0;
BN_clear_free(sig->r);
BN_clear_free(sig->s);
sig->r = r;