diff options
author | tb <> | 2018-02-20 17:48:35 +0000 |
---|---|---|
committer | tb <> | 2018-02-20 17:48:35 +0000 |
commit | d5b2f67cbed2fbcdcb6e7429f71fd4a875ad9361 (patch) | |
tree | 0b7135337ad574a607f3dd748bfe269074e8623e | |
parent | 90a2cac2c9296c6001b956f786252ce7b31af437 (diff) | |
download | openbsd-d5b2f67cbed2fbcdcb6e7429f71fd4a875ad9361.tar.gz openbsd-d5b2f67cbed2fbcdcb6e7429f71fd4a875ad9361.tar.bz2 openbsd-d5b2f67cbed2fbcdcb6e7429f71fd4a875ad9361.zip |
Provide DSA_SIG_{g,s}et0()
ok jsing
-rw-r--r-- | src/lib/libcrypto/Symbols.list | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsa.h | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_asn1.c | 25 |
3 files changed, 29 insertions, 2 deletions
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list index 0cb1c38106..7e5b59f019 100644 --- a/src/lib/libcrypto/Symbols.list +++ b/src/lib/libcrypto/Symbols.list | |||
@@ -798,8 +798,10 @@ DSAPrivateKey_it | |||
798 | DSAPublicKey_it | 798 | DSAPublicKey_it |
799 | DSA_OpenSSL | 799 | DSA_OpenSSL |
800 | DSA_SIG_free | 800 | DSA_SIG_free |
801 | DSA_SIG_get0 | ||
801 | DSA_SIG_it | 802 | DSA_SIG_it |
802 | DSA_SIG_new | 803 | DSA_SIG_new |
804 | DSA_SIG_set0 | ||
803 | DSA_clear_flags | 805 | DSA_clear_flags |
804 | DSA_do_sign | 806 | DSA_do_sign |
805 | DSA_do_verify | 807 | DSA_do_verify |
diff --git a/src/lib/libcrypto/dsa/dsa.h b/src/lib/libcrypto/dsa/dsa.h index 6d618113fd..7e73b205b0 100644 --- a/src/lib/libcrypto/dsa/dsa.h +++ b/src/lib/libcrypto/dsa/dsa.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dsa.h,v 1.27 2018/02/20 17:45:44 tb Exp $ */ | 1 | /* $OpenBSD: dsa.h,v 1.28 2018/02/20 17:48:35 tb Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -183,6 +183,8 @@ DSA_SIG * DSA_SIG_new(void); | |||
183 | void DSA_SIG_free(DSA_SIG *a); | 183 | void DSA_SIG_free(DSA_SIG *a); |
184 | int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); | 184 | int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp); |
185 | DSA_SIG * d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length); | 185 | DSA_SIG * d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length); |
186 | void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); | ||
187 | int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s); | ||
186 | 188 | ||
187 | DSA_SIG * DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa); | 189 | DSA_SIG * DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa); |
188 | int DSA_do_verify(const unsigned char *dgst,int dgst_len, | 190 | int DSA_do_verify(const unsigned char *dgst,int dgst_len, |
diff --git a/src/lib/libcrypto/dsa/dsa_asn1.c b/src/lib/libcrypto/dsa/dsa_asn1.c index f7dfaf1d9c..aac67dbd03 100644 --- a/src/lib/libcrypto/dsa/dsa_asn1.c +++ b/src/lib/libcrypto/dsa/dsa_asn1.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dsa_asn1.c,v 1.20 2017/05/02 03:59:44 deraadt Exp $ */ | 1 | /* $OpenBSD: dsa_asn1.c,v 1.21 2018/02/20 17:48:35 tb Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
@@ -133,6 +133,29 @@ i2d_DSA_SIG(const DSA_SIG *a, unsigned char **out) | |||
133 | return ASN1_item_i2d((ASN1_VALUE *)a, out, &DSA_SIG_it); | 133 | return ASN1_item_i2d((ASN1_VALUE *)a, out, &DSA_SIG_it); |
134 | } | 134 | } |
135 | 135 | ||
136 | void | ||
137 | DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps) | ||
138 | { | ||
139 | if (pr != NULL) | ||
140 | *pr = sig->r; | ||
141 | if (ps != NULL) | ||
142 | *ps = sig->s; | ||
143 | } | ||
144 | |||
145 | int | ||
146 | DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s) | ||
147 | { | ||
148 | if (r == NULL || s == NULL) | ||
149 | return 0; | ||
150 | |||
151 | BN_clear_free(sig->r); | ||
152 | sig->r = r; | ||
153 | BN_clear_free(sig->s); | ||
154 | sig->s = s; | ||
155 | |||
156 | return 1; | ||
157 | } | ||
158 | |||
136 | /* Override the default free and new methods */ | 159 | /* Override the default free and new methods */ |
137 | static int | 160 | static int |
138 | dsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) | 161 | dsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) |