diff options
author | TJ Saunders <tj@castaglia.org> | 2016-06-08 13:54:22 -0700 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2016-06-13 15:44:49 -0400 |
commit | 6a571a18dd4381940d61a3c2f0d65d2b6515c693 (patch) | |
tree | 742283b7c96076c7d443a6818278c4a63e4d413f /crypto/ec/ec_asn1.c | |
parent | d356dc561925ec9cecc58a69e2280c18a49ec41a (diff) |
Implement DSA_SIG_set0() and ECDSA_SIG_set0(), for setting signature values.
SSH2 implementations which use DSA_do_verify() and ECDSA_do_verify() are given
the R and S values, and the data to be signed, by the client. Thus in order
to validate these signatures, SSH2 implementations will digest and sign
the data -- and then pass in properly provisioned DSA_SIG and ECDSA_SIG objects.
Unfortunately, the existing OpenSSL-1.1.0 APIs do not allow for directly setting
those R and S values in these objects, which makes using OpenSSL for such
SSH2 implementations much more difficult.
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/ec/ec_asn1.c')
-rw-r--r-- | crypto/ec/ec_asn1.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crypto/ec/ec_asn1.c b/crypto/ec/ec_asn1.c index 9272e1f1ba..89cc67d8aa 100644 --- a/crypto/ec/ec_asn1.c +++ b/crypto/ec/ec_asn1.c @@ -1180,6 +1180,15 @@ void ECDSA_SIG_get0(BIGNUM **pr, BIGNUM **ps, const ECDSA_SIG *sig) *ps = sig->s; } +int ECDSA_SIG_set0(BIGNUM *r, BIGNUM *s, ECDSA_SIG *sig) +{ + BN_clear_free(sig->r); + BN_clear_free(sig->s); + sig->r = r; + sig->s = s; + return 1; +} + int ECDSA_size(const EC_KEY *r) { int ret, i; |