diff options
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa_meth.c')
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_meth.c | 33 |
1 files changed, 28 insertions, 5 deletions
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 *)) |