OpenCoverage

dsa_meth.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/dsa/dsa_meth.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.-
3 *-
4 * Licensed under the OpenSSL license (the "License"). You may not use-
5 * this file except in compliance with the License. You can obtain a copy-
6 * in the file LICENSE in the source distribution or at-
7 * https://www.openssl.org/source/license.html-
8 */-
9-
10/*-
11 * Licensed under the OpenSSL licenses, (the "License");-
12 * you may not use this file except in compliance with the License.-
13 * You may obtain a copy of the License at-
14 * https://www.openssl.org/source/license.html-
15 * or in the file LICENSE in the source distribution.-
16 */-
17-
18#include "dsa_locl.h"-
19#include <string.h>-
20#include <openssl/err.h>-
21-
22DSA_METHOD *DSA_meth_new(const char *name, int flags)-
23{-
24 DSA_METHOD *dsam = OPENSSL_zalloc(sizeof(*dsam));-
25-
26 if (dsam != NULL) {
dsam != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
27 dsam->flags = flags;-
28-
29 dsam->name = OPENSSL_strdup(name);-
30 if (dsam->name != NULL)
dsam->name != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
31 return dsam;
never executed: return dsam;
0
32-
33 OPENSSL_free(dsam);-
34 }
never executed: end of block
0
35-
36 DSAerr(DSA_F_DSA_METH_NEW, ERR_R_MALLOC_FAILURE);-
37 return NULL;
never executed: return ((void *)0) ;
0
38}-
39-
40void DSA_meth_free(DSA_METHOD *dsam)-
41{-
42 if (dsam != NULL) {
dsam != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
43 OPENSSL_free(dsam->name);-
44 OPENSSL_free(dsam);-
45 }
never executed: end of block
0
46}
never executed: end of block
0
47-
48DSA_METHOD *DSA_meth_dup(const DSA_METHOD *dsam)-
49{-
50 DSA_METHOD *ret = OPENSSL_malloc(sizeof(*ret));-
51-
52 if (ret != NULL) {
ret != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
53 memcpy(ret, dsam, sizeof(*dsam));-
54-
55 ret->name = OPENSSL_strdup(dsam->name);-
56 if (ret->name != NULL)
ret->name != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
57 return ret;
never executed: return ret;
0
58-
59 OPENSSL_free(ret);-
60 }
never executed: end of block
0
61-
62 DSAerr(DSA_F_DSA_METH_DUP, ERR_R_MALLOC_FAILURE);-
63 return NULL;
never executed: return ((void *)0) ;
0
64}-
65-
66const char *DSA_meth_get0_name(const DSA_METHOD *dsam)-
67{-
68 return dsam->name;
never executed: return dsam->name;
0
69}-
70-
71int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name)-
72{-
73 char *tmpname = OPENSSL_strdup(name);-
74-
75 if (tmpname == NULL) {
tmpname == ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
76 DSAerr(DSA_F_DSA_METH_SET1_NAME, ERR_R_MALLOC_FAILURE);-
77 return 0;
never executed: return 0;
0
78 }-
79-
80 OPENSSL_free(dsam->name);-
81 dsam->name = tmpname;-
82-
83 return 1;
never executed: return 1;
0
84}-
85-
86int DSA_meth_get_flags(const DSA_METHOD *dsam)-
87{-
88 return dsam->flags;
never executed: return dsam->flags;
0
89}-
90-
91int DSA_meth_set_flags(DSA_METHOD *dsam, int flags)-
92{-
93 dsam->flags = flags;-
94 return 1;
never executed: return 1;
0
95}-
96-
97void *DSA_meth_get0_app_data(const DSA_METHOD *dsam)-
98{-
99 return dsam->app_data;
never executed: return dsam->app_data;
0
100}-
101-
102int DSA_meth_set0_app_data(DSA_METHOD *dsam, void *app_data)-
103{-
104 dsam->app_data = app_data;-
105 return 1;
never executed: return 1;
0
106}-
107-
108DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam))-
109 (const unsigned char *, int, DSA *)-
110{-
111 return dsam->dsa_do_sign;
never executed: return dsam->dsa_do_sign;
0
112}-
113-
114int DSA_meth_set_sign(DSA_METHOD *dsam,-
115 DSA_SIG *(*sign) (const unsigned char *, int, DSA *))-
116{-
117 dsam->dsa_do_sign = sign;-
118 return 1;
never executed: return 1;
0
119}-
120-
121int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam))-
122 (DSA *, BN_CTX *, BIGNUM **, BIGNUM **)-
123{-
124 return dsam->dsa_sign_setup;
never executed: return dsam->dsa_sign_setup;
0
125}-
126-
127int DSA_meth_set_sign_setup(DSA_METHOD *dsam,-
128 int (*sign_setup) (DSA *, BN_CTX *, BIGNUM **, BIGNUM **))-
129{-
130 dsam->dsa_sign_setup = sign_setup;-
131 return 1;
never executed: return 1;
0
132}-
133-
134int (*DSA_meth_get_verify(const DSA_METHOD *dsam))-
135 (const unsigned char *, int, DSA_SIG *, DSA *)-
136{-
137 return dsam->dsa_do_verify;
never executed: return dsam->dsa_do_verify;
0
138}-
139-
140int DSA_meth_set_verify(DSA_METHOD *dsam,-
141 int (*verify) (const unsigned char *, int, DSA_SIG *, DSA *))-
142{-
143 dsam->dsa_do_verify = verify;-
144 return 1;
never executed: return 1;
0
145}-
146-
147int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam))-
148 (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *,-
149 const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *)-
150{-
151 return dsam->dsa_mod_exp;
never executed: return dsam->dsa_mod_exp;
0
152}-
153-
154int DSA_meth_set_mod_exp(DSA_METHOD *dsam,-
155 int (*mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *,-
156 const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *,-
157 BN_MONT_CTX *))-
158{-
159 dsam->dsa_mod_exp = mod_exp;-
160 return 1;
never executed: return 1;
0
161}-
162-
163int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam))-
164 (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *,-
165 BN_MONT_CTX *)-
166{-
167 return dsam->bn_mod_exp;
never executed: return dsam->bn_mod_exp;
0
168}-
169-
170int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam,-
171 int (*bn_mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *,-
172 const BIGNUM *, BN_CTX *, BN_MONT_CTX *))-
173{-
174 dsam->bn_mod_exp = bn_mod_exp;-
175 return 1;
never executed: return 1;
0
176}-
177-
178int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *)-
179{-
180 return dsam->init;
never executed: return dsam->init;
0
181}-
182-
183int DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *))-
184{-
185 dsam->init = init;-
186 return 1;
never executed: return 1;
0
187}-
188-
189int (*DSA_meth_get_finish(const DSA_METHOD *dsam)) (DSA *)-
190{-
191 return dsam->finish;
never executed: return dsam->finish;
0
192}-
193-
194int DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish) (DSA *))-
195{-
196 dsam->finish = finish;-
197 return 1;
never executed: return 1;
0
198}-
199-
200int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam))-
201 (DSA *, int, const unsigned char *, int, int *, unsigned long *,-
202 BN_GENCB *)-
203{-
204 return dsam->dsa_paramgen;
never executed: return dsam->dsa_paramgen;
0
205}-
206-
207int DSA_meth_set_paramgen(DSA_METHOD *dsam,-
208 int (*paramgen) (DSA *, int, const unsigned char *, int, int *,-
209 unsigned long *, BN_GENCB *))-
210{-
211 dsam->dsa_paramgen = paramgen;-
212 return 1;
never executed: return 1;
0
213}-
214-
215int (*DSA_meth_get_keygen(const DSA_METHOD *dsam)) (DSA *)-
216{-
217 return dsam->dsa_keygen;
never executed: return dsam->dsa_keygen;
0
218}-
219-
220int DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen) (DSA *))-
221{-
222 dsam->dsa_keygen = keygen;-
223 return 1;
never executed: return 1;
0
224}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2