summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dsa/dsa_meth.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa_meth.c')
-rw-r--r--src/lib/libcrypto/dsa/dsa_meth.c110
1 files changed, 0 insertions, 110 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_meth.c b/src/lib/libcrypto/dsa/dsa_meth.c
deleted file mode 100644
index c84b5287e1..0000000000
--- a/src/lib/libcrypto/dsa/dsa_meth.c
+++ /dev/null
@@ -1,110 +0,0 @@
1/* $OpenBSD: dsa_meth.c,v 1.7 2023/07/08 14:28:15 beck Exp $ */
2/*
3 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <stdlib.h>
19#include <string.h>
20
21#include <openssl/dsa.h>
22#include <openssl/err.h>
23
24#include "dsa_local.h"
25
26DSA_METHOD *
27DSA_meth_new(const char *name, int flags)
28{
29 DSA_METHOD *meth;
30
31 if ((meth = calloc(1, sizeof(*meth))) == NULL)
32 return NULL;
33 if ((meth->name = strdup(name)) == NULL) {
34 free(meth);
35 return NULL;
36 }
37 meth->flags = flags;
38
39 return meth;
40}
41LCRYPTO_ALIAS(DSA_meth_new);
42
43void
44DSA_meth_free(DSA_METHOD *meth)
45{
46 if (meth == NULL)
47 return;
48
49 free(meth->name);
50 free(meth);
51}
52LCRYPTO_ALIAS(DSA_meth_free);
53
54DSA_METHOD *
55DSA_meth_dup(const DSA_METHOD *meth)
56{
57 DSA_METHOD *copy;
58
59 if ((copy = calloc(1, sizeof(*copy))) == NULL)
60 return NULL;
61 memcpy(copy, meth, sizeof(*copy));
62 if ((copy->name = strdup(meth->name)) == NULL) {
63 free(copy);
64 return NULL;
65 }
66
67 return copy;
68}
69LCRYPTO_ALIAS(DSA_meth_dup);
70
71const char *
72DSA_meth_get0_name(const DSA_METHOD *meth)
73{
74 return meth->name;
75}
76LCRYPTO_ALIAS(DSA_meth_get0_name);
77
78int
79DSA_meth_set1_name(DSA_METHOD *meth, const char *name)
80{
81 char *new_name;
82
83 if ((new_name = strdup(name)) == NULL) {
84 DSAerror(ERR_R_MALLOC_FAILURE);
85 return 0;
86 }
87
88 free(meth->name);
89 meth->name = new_name;
90
91 return 1;
92}
93LCRYPTO_ALIAS(DSA_meth_set1_name);
94
95int
96DSA_meth_set_sign(DSA_METHOD *meth,
97 DSA_SIG *(*sign)(const unsigned char *, int, DSA *))
98{
99 meth->dsa_do_sign = sign;
100 return 1;
101}
102LCRYPTO_ALIAS(DSA_meth_set_sign);
103
104int
105DSA_meth_set_finish(DSA_METHOD *meth, int (*finish)(DSA *))
106{
107 meth->finish = finish;
108 return 1;
109}
110LCRYPTO_ALIAS(DSA_meth_set_finish);