diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2018-02-20 17:48:36 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2018-02-20 17:48:36 +0000 |
commit | 9b258274e64b255d6e2283eaf33832c1c9dff37c (patch) | |
tree | 91f793637b09000dda150ef65a702ba598e8eeec /lib/libcrypto/dsa | |
parent | 919188ce4a6d6eee142ec1271f14746672bcf24c (diff) |
Provide DSA_SIG_{g,s}et0()
ok jsing
Diffstat (limited to 'lib/libcrypto/dsa')
-rw-r--r-- | lib/libcrypto/dsa/dsa.h | 4 | ||||
-rw-r--r-- | lib/libcrypto/dsa/dsa_asn1.c | 25 |
2 files changed, 27 insertions, 2 deletions
diff --git a/lib/libcrypto/dsa/dsa.h b/lib/libcrypto/dsa/dsa.h index 6d618113fdb..7e73b205b09 100644 --- a/lib/libcrypto/dsa/dsa.h +++ b/lib/libcrypto/dsa/dsa.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa.h,v 1.27 2018/02/20 17:45:44 tb Exp $ */ +/* $OpenBSD: dsa.h,v 1.28 2018/02/20 17:48:35 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -183,6 +183,8 @@ DSA_SIG * DSA_SIG_new(void); void DSA_SIG_free(DSA_SIG *a); int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); DSA_SIG * d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length); +void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); +int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s); DSA_SIG * DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa); int DSA_do_verify(const unsigned char *dgst,int dgst_len, diff --git a/lib/libcrypto/dsa/dsa_asn1.c b/lib/libcrypto/dsa/dsa_asn1.c index f7dfaf1d9c4..aac67dbd034 100644 --- a/lib/libcrypto/dsa/dsa_asn1.c +++ b/lib/libcrypto/dsa/dsa_asn1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa_asn1.c,v 1.20 2017/05/02 03:59:44 deraadt Exp $ */ +/* $OpenBSD: dsa_asn1.c,v 1.21 2018/02/20 17:48:35 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -133,6 +133,29 @@ i2d_DSA_SIG(const DSA_SIG *a, unsigned char **out) return ASN1_item_i2d((ASN1_VALUE *)a, out, &DSA_SIG_it); } +void +DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps) +{ + if (pr != NULL) + *pr = sig->r; + if (ps != NULL) + *ps = sig->s; +} + +int +DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s) +{ + if (r == NULL || s == NULL) + return 0; + + BN_clear_free(sig->r); + sig->r = r; + BN_clear_free(sig->s); + sig->s = s; + + return 1; +} + /* Override the default free and new methods */ static int dsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) |