diff options
author | tb <> | 2018-03-17 15:24:44 +0000 |
---|---|---|
committer | tb <> | 2018-03-17 15:24:44 +0000 |
commit | 2650ae604a4290c33d7b66ac010a0704ba8e4bff (patch) | |
tree | 619e213ed501025640361aa63c9bad7b54e56e64 | |
parent | ff154a0391cfcee220c90f520739c6f08f97c2aa (diff) | |
download | openbsd-2650ae604a4290c33d7b66ac010a0704ba8e4bff.tar.gz openbsd-2650ae604a4290c33d7b66ac010a0704ba8e4bff.tar.bz2 openbsd-2650ae604a4290c33d7b66ac010a0704ba8e4bff.zip |
Provide ECDSA_SIG_{g,s}et0().
ok jsing
-rw-r--r-- | src/lib/libcrypto/Symbols.list | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/ecdsa/ecdsa.h | 16 | ||||
-rw-r--r-- | src/lib/libcrypto/ecdsa/ecs_asn1.c | 24 |
3 files changed, 40 insertions, 2 deletions
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list index 6777e8cc13..6383355a13 100644 --- a/src/lib/libcrypto/Symbols.list +++ b/src/lib/libcrypto/Symbols.list | |||
@@ -891,8 +891,10 @@ ECDH_set_method | |||
891 | ECDH_size | 891 | ECDH_size |
892 | ECDSA_OpenSSL | 892 | ECDSA_OpenSSL |
893 | ECDSA_SIG_free | 893 | ECDSA_SIG_free |
894 | ECDSA_SIG_get0 | ||
894 | ECDSA_SIG_it | 895 | ECDSA_SIG_it |
895 | ECDSA_SIG_new | 896 | ECDSA_SIG_new |
897 | ECDSA_SIG_set0 | ||
896 | ECDSA_do_sign | 898 | ECDSA_do_sign |
897 | ECDSA_do_sign_ex | 899 | ECDSA_do_sign_ex |
898 | ECDSA_do_verify | 900 | ECDSA_do_verify |
diff --git a/src/lib/libcrypto/ecdsa/ecdsa.h b/src/lib/libcrypto/ecdsa/ecdsa.h index 530ab265bb..9c53230a88 100644 --- a/src/lib/libcrypto/ecdsa/ecdsa.h +++ b/src/lib/libcrypto/ecdsa/ecdsa.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecdsa.h,v 1.4 2015/02/08 13:35:06 jsing Exp $ */ | 1 | /* $OpenBSD: ecdsa.h,v 1.5 2018/03/17 15:24:44 tb Exp $ */ |
2 | /** | 2 | /** |
3 | * \file crypto/ecdsa/ecdsa.h Include file for the OpenSSL ECDSA functions | 3 | * \file crypto/ecdsa/ecdsa.h Include file for the OpenSSL ECDSA functions |
4 | * \author Written by Nils Larsch for the OpenSSL project | 4 | * \author Written by Nils Larsch for the OpenSSL project |
@@ -133,6 +133,20 @@ int i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp); | |||
133 | */ | 133 | */ |
134 | ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len); | 134 | ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len); |
135 | 135 | ||
136 | /** Accessor for r and s fields of ECDSA_SIG | ||
137 | * \param sig pointer to ECDSA_SIG pointer | ||
138 | * \param pr pointer to BIGNUM pointer for r (may be NULL) | ||
139 | * \param ps pointer to BIGNUM pointer for s (may be NULL) | ||
140 | */ | ||
141 | void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); | ||
142 | |||
143 | /** Setter for r and s fields of ECDSA_SIG | ||
144 | * \param sig pointer to ECDSA_SIG pointer | ||
145 | * \param r pointer to BIGNUM for r (may be NULL) | ||
146 | * \param s pointer to BIGNUM for s (may be NULL) | ||
147 | */ | ||
148 | int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s); | ||
149 | |||
136 | /** Computes the ECDSA signature of the given hash value using | 150 | /** Computes the ECDSA signature of the given hash value using |
137 | * the supplied private key and returns the created signature. | 151 | * the supplied private key and returns the created signature. |
138 | * \param dgst pointer to the hash value | 152 | * \param dgst pointer to the hash value |
diff --git a/src/lib/libcrypto/ecdsa/ecs_asn1.c b/src/lib/libcrypto/ecdsa/ecs_asn1.c index 725fe44a36..e463858669 100644 --- a/src/lib/libcrypto/ecdsa/ecs_asn1.c +++ b/src/lib/libcrypto/ecdsa/ecs_asn1.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecs_asn1.c,v 1.8 2015/10/16 15:15:39 jsing Exp $ */ | 1 | /* $OpenBSD: ecs_asn1.c,v 1.9 2018/03/17 15:24:44 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -113,3 +113,25 @@ ECDSA_SIG_free(ECDSA_SIG *a) | |||
113 | { | 113 | { |
114 | ASN1_item_free((ASN1_VALUE *)a, &ECDSA_SIG_it); | 114 | ASN1_item_free((ASN1_VALUE *)a, &ECDSA_SIG_it); |
115 | } | 115 | } |
116 | |||
117 | void | ||
118 | ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps) | ||
119 | { | ||
120 | if (pr != NULL) | ||
121 | *pr = sig->r; | ||
122 | if (ps != NULL) | ||
123 | *ps = sig->s; | ||
124 | } | ||
125 | |||
126 | int | ||
127 | ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s) | ||
128 | { | ||
129 | if (r == NULL || s == NULL) | ||
130 | return 0; | ||
131 | |||
132 | BN_clear_free(sig->r); | ||
133 | BN_clear_free(sig->s); | ||
134 | sig->r = r; | ||
135 | sig->s = s; | ||
136 | return 1; | ||
137 | } | ||