diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa.h | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa_locl.h | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa_meth.c | 33 |
3 files changed, 35 insertions, 8 deletions
diff --git a/src/lib/libcrypto/dsa/dsa.h b/src/lib/libcrypto/dsa/dsa.h index 2ee27d775f..12b1faadf3 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.36 2022/06/27 12:28:46 tb Exp $ */ | 1 | /* $OpenBSD: dsa.h,v 1.37 2022/07/04 12:22:32 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 | * |
| @@ -222,6 +222,10 @@ ENGINE *DSA_get0_engine(DSA *d); | |||
| 222 | DSA_METHOD *DSA_meth_new(const char *name, int flags); | 222 | DSA_METHOD *DSA_meth_new(const char *name, int flags); |
| 223 | void DSA_meth_free(DSA_METHOD *meth); | 223 | void DSA_meth_free(DSA_METHOD *meth); |
| 224 | DSA_METHOD *DSA_meth_dup(const DSA_METHOD *meth); | 224 | DSA_METHOD *DSA_meth_dup(const DSA_METHOD *meth); |
| 225 | #ifdef LIBRESSL_INTERNAL | ||
| 226 | const char *DSA_meth_get0_name(const DSA_METHOD *meth); | ||
| 227 | int DSA_meth_set1_name(DSA_METHOD *meth, const char *name); | ||
| 228 | #endif | ||
| 225 | int DSA_meth_set_sign(DSA_METHOD *meth, | 229 | int DSA_meth_set_sign(DSA_METHOD *meth, |
| 226 | DSA_SIG *(*sign)(const unsigned char *, int, DSA *)); | 230 | DSA_SIG *(*sign)(const unsigned char *, int, DSA *)); |
| 227 | int DSA_meth_set_finish(DSA_METHOD *meth, int (*finish)(DSA *)); | 231 | int DSA_meth_set_finish(DSA_METHOD *meth, int (*finish)(DSA *)); |
diff --git a/src/lib/libcrypto/dsa/dsa_locl.h b/src/lib/libcrypto/dsa/dsa_locl.h index 299c67a6b9..f78ff818ab 100644 --- a/src/lib/libcrypto/dsa/dsa_locl.h +++ b/src/lib/libcrypto/dsa/dsa_locl.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa_locl.h,v 1.5 2022/01/14 08:29:06 tb Exp $ */ | 1 | /* $OpenBSD: dsa_locl.h,v 1.6 2022/07/04 12:22:32 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 2007 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 2007 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -63,7 +63,7 @@ struct DSA_SIG_st { | |||
| 63 | } /* DSA_SIG */; | 63 | } /* DSA_SIG */; |
| 64 | 64 | ||
| 65 | struct dsa_method { | 65 | struct dsa_method { |
| 66 | const char *name; | 66 | char *name; |
| 67 | DSA_SIG *(*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa); | 67 | DSA_SIG *(*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa); |
| 68 | int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, | 68 | int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, |
| 69 | BIGNUM **rp); | 69 | BIGNUM **rp); |
diff --git a/src/lib/libcrypto/dsa/dsa_meth.c b/src/lib/libcrypto/dsa/dsa_meth.c index cd232835eb..2cb0426d43 100644 --- a/src/lib/libcrypto/dsa/dsa_meth.c +++ b/src/lib/libcrypto/dsa/dsa_meth.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa_meth.c,v 1.3 2022/05/07 10:31:54 tb Exp $ */ | 1 | /* $OpenBSD: dsa_meth.c,v 1.4 2022/07/04 12:22:32 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> |
| 4 | * | 4 | * |
| @@ -42,10 +42,11 @@ DSA_meth_new(const char *name, int flags) | |||
| 42 | void | 42 | void |
| 43 | DSA_meth_free(DSA_METHOD *meth) | 43 | DSA_meth_free(DSA_METHOD *meth) |
| 44 | { | 44 | { |
| 45 | if (meth != NULL) { | 45 | if (meth == NULL) |
| 46 | free((char *)meth->name); | 46 | return |
| 47 | free(meth); | 47 | |
| 48 | } | 48 | free(meth->name); |
| 49 | free(meth); | ||
| 49 | } | 50 | } |
| 50 | 51 | ||
| 51 | DSA_METHOD * | 52 | DSA_METHOD * |
| @@ -64,6 +65,28 @@ DSA_meth_dup(const DSA_METHOD *meth) | |||
| 64 | return copy; | 65 | return copy; |
| 65 | } | 66 | } |
| 66 | 67 | ||
| 68 | const char * | ||
| 69 | DSA_meth_get0_name(const DSA_METHOD *meth) | ||
| 70 | { | ||
| 71 | return meth->name; | ||
| 72 | } | ||
| 73 | |||
| 74 | int | ||
| 75 | DSA_meth_set1_name(DSA_METHOD *meth, const char *name) | ||
| 76 | { | ||
| 77 | char *new_name; | ||
| 78 | |||
| 79 | if ((new_name = strdup(name)) == NULL) { | ||
| 80 | DSAerror(ERR_R_MALLOC_FAILURE); | ||
| 81 | return 0; | ||
| 82 | } | ||
| 83 | |||
| 84 | free(meth->name); | ||
| 85 | meth->name = new_name; | ||
| 86 | |||
| 87 | return 1; | ||
| 88 | } | ||
| 89 | |||
| 67 | int | 90 | int |
| 68 | DSA_meth_set_sign(DSA_METHOD *meth, | 91 | DSA_meth_set_sign(DSA_METHOD *meth, |
| 69 | DSA_SIG *(*sign)(const unsigned char *, int, DSA *)) | 92 | DSA_SIG *(*sign)(const unsigned char *, int, DSA *)) |
