diff options
| author | tb <> | 2023-02-13 09:21:35 +0000 |
|---|---|---|
| committer | tb <> | 2023-02-13 09:21:35 +0000 |
| commit | c0901cb4aef7ee8681b9f6f5a9ac897e1aa4dd5e (patch) | |
| tree | 93cf4c01812df0863a7992bc2b8ea0027d56b2db /src | |
| parent | 84173ec1c6f89cc5597d8d51c50dd6f215764a43 (diff) | |
| download | openbsd-c0901cb4aef7ee8681b9f6f5a9ac897e1aa4dd5e.tar.gz openbsd-c0901cb4aef7ee8681b9f6f5a9ac897e1aa4dd5e.tar.bz2 openbsd-c0901cb4aef7ee8681b9f6f5a9ac897e1aa4dd5e.zip | |
Merge dsa_sign.c and dsa_vrf.c into dsa_ossl.c
discussed with jsing
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/Makefile | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa_ossl.c | 37 | ||||
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa_sign.c | 93 | ||||
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa_vrf.c | 69 |
4 files changed, 37 insertions, 166 deletions
diff --git a/src/lib/libcrypto/Makefile b/src/lib/libcrypto/Makefile index 45a2ca5a02..edd38b536a 100644 --- a/src/lib/libcrypto/Makefile +++ b/src/lib/libcrypto/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.97 2023/02/11 12:17:57 jsing Exp $ | 1 | # $OpenBSD: Makefile,v 1.98 2023/02/13 09:21:35 tb Exp $ |
| 2 | 2 | ||
| 3 | LIB= crypto | 3 | LIB= crypto |
| 4 | LIBREBUILD=y | 4 | LIBREBUILD=y |
| @@ -330,8 +330,6 @@ SRCS+= dsa_meth.c | |||
| 330 | SRCS+= dsa_ossl.c | 330 | SRCS+= dsa_ossl.c |
| 331 | SRCS+= dsa_pmeth.c | 331 | SRCS+= dsa_pmeth.c |
| 332 | SRCS+= dsa_prn.c | 332 | SRCS+= dsa_prn.c |
| 333 | SRCS+= dsa_sign.c | ||
| 334 | SRCS+= dsa_vrf.c | ||
| 335 | 333 | ||
| 336 | # dso/ | 334 | # dso/ |
| 337 | SRCS+= dso_dlfcn.c | 335 | SRCS+= dso_dlfcn.c |
diff --git a/src/lib/libcrypto/dsa/dsa_ossl.c b/src/lib/libcrypto/dsa/dsa_ossl.c index a242291a62..fd5fac64bb 100644 --- a/src/lib/libcrypto/dsa/dsa_ossl.c +++ b/src/lib/libcrypto/dsa/dsa_ossl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa_ossl.c,v 1.47 2023/01/11 04:39:42 jsing Exp $ */ | 1 | /* $OpenBSD: dsa_ossl.c,v 1.48 2023/02/13 09:21: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 | * |
| @@ -433,3 +433,38 @@ dsa_finish(DSA *dsa) | |||
| 433 | BN_MONT_CTX_free(dsa->method_mont_p); | 433 | BN_MONT_CTX_free(dsa->method_mont_p); |
| 434 | return 1; | 434 | return 1; |
| 435 | } | 435 | } |
| 436 | |||
| 437 | DSA_SIG * | ||
| 438 | DSA_SIG_new(void) | ||
| 439 | { | ||
| 440 | return calloc(1, sizeof(DSA_SIG)); | ||
| 441 | } | ||
| 442 | |||
| 443 | void | ||
| 444 | DSA_SIG_free(DSA_SIG *sig) | ||
| 445 | { | ||
| 446 | if (sig == NULL) | ||
| 447 | return; | ||
| 448 | |||
| 449 | BN_free(sig->r); | ||
| 450 | BN_free(sig->s); | ||
| 451 | free(sig); | ||
| 452 | } | ||
| 453 | |||
| 454 | int | ||
| 455 | DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | ||
| 456 | { | ||
| 457 | return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); | ||
| 458 | } | ||
| 459 | |||
| 460 | DSA_SIG * | ||
| 461 | DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | ||
| 462 | { | ||
| 463 | return dsa->meth->dsa_do_sign(dgst, dlen, dsa); | ||
| 464 | } | ||
| 465 | |||
| 466 | int | ||
| 467 | DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, DSA *dsa) | ||
| 468 | { | ||
| 469 | return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); | ||
| 470 | } | ||
diff --git a/src/lib/libcrypto/dsa/dsa_sign.c b/src/lib/libcrypto/dsa/dsa_sign.c deleted file mode 100644 index 1e0c327e3f..0000000000 --- a/src/lib/libcrypto/dsa/dsa_sign.c +++ /dev/null | |||
| @@ -1,93 +0,0 @@ | |||
| 1 | /* $OpenBSD: dsa_sign.c,v 1.25 2023/02/13 09:17:50 tb Exp $ */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ | ||
| 60 | |||
| 61 | #include <openssl/bn.h> | ||
| 62 | #include <openssl/dsa.h> | ||
| 63 | |||
| 64 | #include "dsa_local.h" | ||
| 65 | |||
| 66 | DSA_SIG * | ||
| 67 | DSA_SIG_new(void) | ||
| 68 | { | ||
| 69 | return calloc(1, sizeof(DSA_SIG)); | ||
| 70 | } | ||
| 71 | |||
| 72 | void | ||
| 73 | DSA_SIG_free(DSA_SIG *sig) | ||
| 74 | { | ||
| 75 | if (sig == NULL) | ||
| 76 | return; | ||
| 77 | |||
| 78 | BN_free(sig->r); | ||
| 79 | BN_free(sig->s); | ||
| 80 | free(sig); | ||
| 81 | } | ||
| 82 | |||
| 83 | int | ||
| 84 | DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | ||
| 85 | { | ||
| 86 | return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); | ||
| 87 | } | ||
| 88 | |||
| 89 | DSA_SIG * | ||
| 90 | DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | ||
| 91 | { | ||
| 92 | return dsa->meth->dsa_do_sign(dgst, dlen, dsa); | ||
| 93 | } | ||
diff --git a/src/lib/libcrypto/dsa/dsa_vrf.c b/src/lib/libcrypto/dsa/dsa_vrf.c deleted file mode 100644 index 6fa6534e7e..0000000000 --- a/src/lib/libcrypto/dsa/dsa_vrf.c +++ /dev/null | |||
| @@ -1,69 +0,0 @@ | |||
| 1 | /* $OpenBSD: dsa_vrf.c,v 1.19 2022/11/26 16:08:52 tb Exp $ */ | ||
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This package is an SSL implementation written | ||
| 6 | * by Eric Young (eay@cryptsoft.com). | ||
| 7 | * The implementation was written so as to conform with Netscapes SSL. | ||
| 8 | * | ||
| 9 | * This library is free for commercial and non-commercial use as long as | ||
| 10 | * the following conditions are aheared to. The following conditions | ||
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
| 13 | * included with this distribution is covered by the same copyright terms | ||
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
| 15 | * | ||
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
| 17 | * the code are not to be removed. | ||
| 18 | * If this package is used in a product, Eric Young should be given attribution | ||
| 19 | * as the author of the parts of the library used. | ||
| 20 | * This can be in the form of a textual message at program startup or | ||
| 21 | * in documentation (online or textual) provided with the package. | ||
| 22 | * | ||
| 23 | * Redistribution and use in source and binary forms, with or without | ||
| 24 | * modification, are permitted provided that the following conditions | ||
| 25 | * are met: | ||
| 26 | * 1. Redistributions of source code must retain the copyright | ||
| 27 | * notice, this list of conditions and the following disclaimer. | ||
| 28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
| 29 | * notice, this list of conditions and the following disclaimer in the | ||
| 30 | * documentation and/or other materials provided with the distribution. | ||
| 31 | * 3. All advertising materials mentioning features or use of this software | ||
| 32 | * must display the following acknowledgement: | ||
| 33 | * "This product includes cryptographic software written by | ||
| 34 | * Eric Young (eay@cryptsoft.com)" | ||
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
| 36 | * being used are not cryptographic related :-). | ||
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
| 38 | * the apps directory (application code) you must include an acknowledgement: | ||
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
| 40 | * | ||
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
| 45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
| 46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
| 47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
| 48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
| 51 | * SUCH DAMAGE. | ||
| 52 | * | ||
| 53 | * The licence and distribution terms for any publically available version or | ||
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
| 55 | * copied and put under another distribution licence | ||
| 56 | * [including the GNU Public Licence.] | ||
| 57 | */ | ||
| 58 | |||
| 59 | /* Original version from Steven Schoch <schoch@sheba.arc.nasa.gov> */ | ||
| 60 | |||
| 61 | #include <openssl/dsa.h> | ||
| 62 | |||
| 63 | #include "dsa_local.h" | ||
| 64 | |||
| 65 | int | ||
| 66 | DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, DSA *dsa) | ||
| 67 | { | ||
| 68 | return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); | ||
| 69 | } | ||
