OpenCoverage

dsa_meth.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/dsa/dsa_meth.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/* $OpenBSD: dsa_meth.c,v 1.1 2018/03/17 15:19:12 tb 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-
24DSA_METHOD *-
25DSA_meth_new(const char *name, int flags)-
26{-
27 DSA_METHOD *meth;-
28-
29 if ((meth = calloc(1, sizeof(*meth))) == NULL)
(meth = calloc...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
30 return NULL;
never executed: return ((void *)0) ;
0
31 if ((meth->name = strdup(name)) == NULL) {
never executed: __retval = (char *) memcpy (__retval, name , __len);
(meth->name = ...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
__retval != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
((const char *... ))[0] == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_constant_p ( name )Description
TRUEnever evaluated
FALSEnever evaluated
((size_t)(cons...( name ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
0
32 free(meth);-
33 return NULL;
never executed: return ((void *)0) ;
0
34 }-
35 meth->flags = flags;-
36-
37 return meth;
never executed: return meth;
0
38}-
39-
40void-
41DSA_meth_free(DSA_METHOD *meth)-
42{-
43 if (meth != NULL) {
meth != ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • freenull
0-1
44 free((char *)meth->name);-
45 free(meth);-
46 }
never executed: end of block
0
47}
executed 1 time by 1 test: end of block
Executed by:
  • freenull
1
48-
49DSA_METHOD *-
50DSA_meth_dup(const DSA_METHOD *meth)-
51{-
52 DSA_METHOD *copy;-
53-
54 if ((copy = calloc(1, sizeof(*copy))) == NULL)
(copy = calloc...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
55 return NULL;
never executed: return ((void *)0) ;
0
56 memcpy(copy, meth, sizeof(*copy));-
57 if ((copy->name = strdup(meth->name)) == NULL) {
never executed: __retval = (char *) memcpy (__retval, meth->name , __len);
(copy->name = ...== ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
__retval != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
((const char *... ))[0] == '\0'Description
TRUEnever evaluated
FALSEnever evaluated
__builtin_cons...( meth->name )Description
TRUEnever evaluated
FALSEnever evaluated
((size_t)(cons...->name ) == 1)Description
TRUEnever evaluated
FALSEnever evaluated
0
58 free(copy);-
59 return NULL;
never executed: return ((void *)0) ;
0
60 }-
61 -
62 return copy;
never executed: return copy;
0
63}-
64-
65int-
66DSA_meth_set_sign(DSA_METHOD *meth,-
67 DSA_SIG *(*sign)(const unsigned char *, int, DSA *))-
68{-
69 meth->dsa_do_sign = sign;-
70 return 1;
never executed: return 1;
0
71}-
72-
73int-
74DSA_meth_set_finish(DSA_METHOD *meth, int (*finish)(DSA *))-
75{-
76 meth->finish = finish;-
77 return 1;
never executed: return 1;
0
78}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2