OpenCoverage

p_lib.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/evp/p_lib.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 1995-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#include <stdio.h>-
11#include "internal/cryptlib.h"-
12#include "internal/refcount.h"-
13#include <openssl/bn.h>-
14#include <openssl/err.h>-
15#include <openssl/objects.h>-
16#include <openssl/evp.h>-
17#include <openssl/x509.h>-
18#include <openssl/rsa.h>-
19#include <openssl/dsa.h>-
20#include <openssl/dh.h>-
21#include <openssl/cmac.h>-
22#include <openssl/engine.h>-
23-
24#include "internal/asn1_int.h"-
25#include "internal/evp_int.h"-
26-
27static void EVP_PKEY_free_it(EVP_PKEY *x);-
28-
29int EVP_PKEY_bits(const EVP_PKEY *pkey)-
30{-
31 if (pkey && pkey->ameth && pkey->ameth->pkey_bits)
pkeyDescription
TRUEevaluated 457 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
pkey->amethDescription
TRUEevaluated 457 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
pkey->ameth->pkey_bitsDescription
TRUEevaluated 457 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-457
32 return pkey->ameth->pkey_bits(pkey);
executed 457 times by 1 test: return pkey->ameth->pkey_bits(pkey);
Executed by:
  • libcrypto.so.1.1
457
33 return 0;
never executed: return 0;
0
34}-
35-
36int EVP_PKEY_security_bits(const EVP_PKEY *pkey)-
37{-
38 if (pkey == NULL)
pkey == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 13278 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-13278
39 return 0;
never executed: return 0;
0
40 if (!pkey->ameth || !pkey->ameth->pkey_security_bits)
!pkey->amethDescription
TRUEnever evaluated
FALSEevaluated 13278 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
!pkey->ameth->..._security_bitsDescription
TRUEnever evaluated
FALSEevaluated 13278 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-13278
41 return -2;
never executed: return -2;
0
42 return pkey->ameth->pkey_security_bits(pkey);
executed 13278 times by 1 test: return pkey->ameth->pkey_security_bits(pkey);
Executed by:
  • libcrypto.so.1.1
13278
43}-
44-
45int EVP_PKEY_size(EVP_PKEY *pkey)-
46{-
47 if (pkey && pkey->ameth && pkey->ameth->pkey_size)
pkeyDescription
TRUEevaluated 8850 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
pkey->amethDescription
TRUEevaluated 8850 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
pkey->ameth->pkey_sizeDescription
TRUEevaluated 8850 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-8850
48 return pkey->ameth->pkey_size(pkey);
executed 8850 times by 1 test: return pkey->ameth->pkey_size(pkey);
Executed by:
  • libcrypto.so.1.1
8850
49 return 0;
never executed: return 0;
0
50}-
51-
52int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode)-
53{-
54#ifndef OPENSSL_NO_DSA-
55 if (pkey->type == EVP_PKEY_DSA) {
pkey->type == 116Description
TRUEnever evaluated
FALSEnever evaluated
0
56 int ret = pkey->save_parameters;-
57-
58 if (mode >= 0)
mode >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
59 pkey->save_parameters = mode;
never executed: pkey->save_parameters = mode;
0
60 return ret;
never executed: return ret;
0
61 }-
62#endif-
63#ifndef OPENSSL_NO_EC-
64 if (pkey->type == EVP_PKEY_EC) {
pkey->type == 408Description
TRUEnever evaluated
FALSEnever evaluated
0
65 int ret = pkey->save_parameters;-
66-
67 if (mode >= 0)
mode >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
68 pkey->save_parameters = mode;
never executed: pkey->save_parameters = mode;
0
69 return ret;
never executed: return ret;
0
70 }-
71#endif-
72 return 0;
never executed: return 0;
0
73}-
74-
75int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)-
76{-
77 if (to->type == EVP_PKEY_NONE) {
to->type == 0Description
TRUEevaluated 1062 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 8461 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1062-8461
78 if (EVP_PKEY_set_type(to, from->type) == 0)
EVP_PKEY_set_t...om->type) == 0Description
TRUEnever evaluated
FALSEevaluated 1062 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1062
79 return 0;
never executed: return 0;
0
80 } else if (to->type != from->type) {
executed 1062 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
to->type != from->typeDescription
TRUEnever evaluated
FALSEevaluated 8461 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8461
81 EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS, EVP_R_DIFFERENT_KEY_TYPES);-
82 goto err;
never executed: goto err;
0
83 }-
84-
85 if (EVP_PKEY_missing_parameters(from)) {
EVP_PKEY_missi...rameters(from)Description
TRUEnever evaluated
FALSEevaluated 9523 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-9523
86 EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS, EVP_R_MISSING_PARAMETERS);-
87 goto err;
never executed: goto err;
0
88 }-
89-
90 if (!EVP_PKEY_missing_parameters(to)) {
!EVP_PKEY_miss...parameters(to)Description
TRUEevaluated 8889 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 634 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
634-8889
91 if (EVP_PKEY_cmp_parameters(to, from) == 1)
EVP_PKEY_cmp_p...to, from) == 1Description
TRUEevaluated 4934 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3955 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
3955-4934
92 return 1;
executed 4934 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
4934
93 EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS, EVP_R_DIFFERENT_PARAMETERS);-
94 return 0;
executed 3955 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
3955
95 }-
96-
97 if (from->ameth && from->ameth->param_copy)
from->amethDescription
TRUEevaluated 634 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
from->ameth->param_copyDescription
TRUEevaluated 634 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-634
98 return from->ameth->param_copy(to, from);
executed 634 times by 1 test: return from->ameth->param_copy(to, from);
Executed by:
  • libcrypto.so.1.1
634
99 err:
code before this statement never executed: err:
0
100 return 0;
never executed: return 0;
0
101}-
102-
103int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey)-
104{-
105 if (pkey->ameth && pkey->ameth->param_missing)
pkey->amethDescription
TRUEevaluated 30687 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
pkey->ameth->param_missingDescription
TRUEevaluated 12121 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 18566 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-30687
106 return pkey->ameth->param_missing(pkey);
executed 12121 times by 1 test: return pkey->ameth->param_missing(pkey);
Executed by:
  • libcrypto.so.1.1
12121
107 return 0;
executed 18566 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
18566
108}-
109-
110int EVP_PKEY_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)-
111{-
112 if (a->type != b->type)
a->type != b->typeDescription
TRUEnever evaluated
FALSEevaluated 13256 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-13256
113 return -1;
never executed: return -1;
0
114 if (a->ameth && a->ameth->param_cmp)
a->amethDescription
TRUEevaluated 13256 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
a->ameth->param_cmpDescription
TRUEevaluated 9301 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3955 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-13256
115 return a->ameth->param_cmp(a, b);
executed 9301 times by 1 test: return a->ameth->param_cmp(a, b);
Executed by:
  • libcrypto.so.1.1
9301
116 return -2;
executed 3955 times by 1 test: return -2;
Executed by:
  • libcrypto.so.1.1
3955
117}-
118-
119int EVP_PKEY_cmp(const EVP_PKEY *a, const EVP_PKEY *b)-
120{-
121 if (a->type != b->type)
a->type != b->typeDescription
TRUEevaluated 5 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 9415 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
5-9415
122 return -1;
executed 5 times by 1 test: return -1;
Executed by:
  • libcrypto.so.1.1
5
123-
124 if (a->ameth) {
a->amethDescription
TRUEevaluated 9415 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-9415
125 int ret;-
126 /* Compare parameters if the algorithm has them */-
127 if (a->ameth->param_cmp) {
a->ameth->param_cmpDescription
TRUEevaluated 4879 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 4536 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
4536-4879
128 ret = a->ameth->param_cmp(a, b);-
129 if (ret <= 0)
ret <= 0Description
TRUEnever evaluated
FALSEevaluated 4879 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4879
130 return ret;
never executed: return ret;
0
131 }
executed 4879 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
4879
132-
133 if (a->ameth->pub_cmp)
a->ameth->pub_cmpDescription
TRUEevaluated 9415 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-9415
134 return a->ameth->pub_cmp(a, b);
executed 9415 times by 1 test: return a->ameth->pub_cmp(a, b);
Executed by:
  • libcrypto.so.1.1
9415
135 }
never executed: end of block
0
136-
137 return -2;
never executed: return -2;
0
138}-
139-
140EVP_PKEY *EVP_PKEY_new(void)-
141{-
142 EVP_PKEY *ret = OPENSSL_zalloc(sizeof(*ret));-
143-
144 if (ret == NULL) {
ret == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 98797 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-98797
145 EVPerr(EVP_F_EVP_PKEY_NEW, ERR_R_MALLOC_FAILURE);-
146 return NULL;
never executed: return ((void *)0) ;
0
147 }-
148 ret->type = EVP_PKEY_NONE;-
149 ret->save_type = EVP_PKEY_NONE;-
150 ret->references = 1;-
151 ret->save_parameters = 1;-
152 ret->lock = CRYPTO_THREAD_lock_new();-
153 if (ret->lock == NULL) {
ret->lock == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 98797 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-98797
154 EVPerr(EVP_F_EVP_PKEY_NEW, ERR_R_MALLOC_FAILURE);-
155 OPENSSL_free(ret);-
156 return NULL;
never executed: return ((void *)0) ;
0
157 }-
158 return ret;
executed 98797 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
98797
159}-
160-
161int EVP_PKEY_up_ref(EVP_PKEY *pkey)-
162{-
163 int i;-
164-
165 if (CRYPTO_UP_REF(&pkey->references, &i, pkey->lock) <= 0)
CRYPTO_UP_REF(...ey->lock) <= 0Description
TRUEnever evaluated
FALSEevaluated 249355 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-249355
166 return 0;
never executed: return 0;
0
167-
168 REF_PRINT_COUNT("EVP_PKEY", pkey);-
169 REF_ASSERT_ISNT(i < 2);-
170 return ((i > 1) ? 1 : 0);
executed 249355 times by 1 test: return ((i > 1) ? 1 : 0);
Executed by:
  • libcrypto.so.1.1
(i > 1)Description
TRUEevaluated 249355 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-249355
171}-
172-
173/*-
174 * Setup a public key ASN1 method and ENGINE from a NID or a string. If pkey-
175 * is NULL just return 1 or 0 if the algorithm exists.-
176 */-
177-
178static int pkey_set_type(EVP_PKEY *pkey, ENGINE *e, int type, const char *str,-
179 int len)-
180{-
181 const EVP_PKEY_ASN1_METHOD *ameth;-
182 ENGINE **eptr = (e == NULL) ? &e : NULL;
(e == ((void *)0) )Description
TRUEevaluated 146230 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-146230
183-
184 if (pkey) {
pkeyDescription
TRUEevaluated 146230 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-146230
185 if (pkey->pkey.ptr)
pkey->pkey.ptrDescription
TRUEevaluated 590 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 145640 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
590-145640
186 EVP_PKEY_free_it(pkey);
executed 590 times by 1 test: EVP_PKEY_free_it(pkey);
Executed by:
  • libcrypto.so.1.1
590
187 /*-
188 * If key type matches and a method exists then this lookup has-
189 * succeeded once so just indicate success.-
190 */-
191 if ((type == pkey->save_type) && pkey->ameth)
(type == pkey->save_type)Description
TRUEevaluated 49473 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 96757 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
pkey->amethDescription
TRUEevaluated 47401 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2072 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2072-96757
192 return 1;
executed 47401 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
47401
193#ifndef OPENSSL_NO_ENGINE-
194 /* If we have ENGINEs release them */-
195 ENGINE_finish(pkey->engine);-
196 pkey->engine = NULL;-
197 ENGINE_finish(pkey->pmeth_engine);-
198 pkey->pmeth_engine = NULL;-
199#endif-
200 }
executed 98829 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
98829
201 if (str)
strDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 98828 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
1-98828
202 ameth = EVP_PKEY_asn1_find_str(eptr, str, len);
executed 1 time by 1 test: ameth = EVP_PKEY_asn1_find_str(eptr, str, len);
Executed by:
  • libcrypto.so.1.1
1
203 else-
204 ameth = EVP_PKEY_asn1_find(eptr, type);
executed 98828 times by 1 test: ameth = EVP_PKEY_asn1_find(eptr, type);
Executed by:
  • libcrypto.so.1.1
98828
205#ifndef OPENSSL_NO_ENGINE-
206 if (pkey == NULL && eptr != NULL)
pkey == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 98829 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
eptr != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0-98829
207 ENGINE_finish(e);
never executed: ENGINE_finish(e);
0
208#endif-
209 if (ameth == NULL) {
ameth == ((void *)0)Description
TRUEevaluated 2174 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 96655 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
2174-96655
210 EVPerr(EVP_F_PKEY_SET_TYPE, EVP_R_UNSUPPORTED_ALGORITHM);-
211 return 0;
executed 2174 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
2174
212 }-
213 if (pkey) {
pkeyDescription
TRUEevaluated 96655 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-96655
214 pkey->ameth = ameth;-
215 pkey->engine = e;-
216-
217 pkey->type = pkey->ameth->pkey_id;-
218 pkey->save_type = type;-
219 }
executed 96655 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
96655
220 return 1;
executed 96655 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
96655
221}-
222-
223EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *e,-
224 const unsigned char *priv,-
225 size_t len)-
226{-
227 EVP_PKEY *ret = EVP_PKEY_new();-
228-
229 if (ret == NULL
ret == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16541 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-16541
230 || !pkey_set_type(ret, e, type, NULL, -1)) {
!pkey_set_type...oid *)0) , -1)Description
TRUEnever evaluated
FALSEevaluated 16541 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-16541
231 /* EVPerr already called */-
232 goto err;
never executed: goto err;
0
233 }-
234-
235 if (ret->ameth->set_priv_key == NULL) {
ret->ameth->se...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 16541 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-16541
236 EVPerr(EVP_F_EVP_PKEY_NEW_RAW_PRIVATE_KEY,-
237 EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);-
238 goto err;
never executed: goto err;
0
239 }-
240-
241 if (!ret->ameth->set_priv_key(ret, priv, len)) {
!ret->ameth->s...et, priv, len)Description
TRUEnever evaluated
FALSEevaluated 16541 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-16541
242 EVPerr(EVP_F_EVP_PKEY_NEW_RAW_PRIVATE_KEY, EVP_R_KEY_SETUP_FAILED);-
243 goto err;
never executed: goto err;
0
244 }-
245-
246 return ret;
executed 16541 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
16541
247-
248 err:-
249 EVP_PKEY_free(ret);-
250 return NULL;
never executed: return ((void *)0) ;
0
251}-
252-
253EVP_PKEY *EVP_PKEY_new_raw_public_key(int type, ENGINE *e,-
254 const unsigned char *pub,-
255 size_t len)-
256{-
257 EVP_PKEY *ret = EVP_PKEY_new();-
258-
259 if (ret == NULL
ret == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15
260 || !pkey_set_type(ret, e, type, NULL, -1)) {
!pkey_set_type...oid *)0) , -1)Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15
261 /* EVPerr already called */-
262 goto err;
never executed: goto err;
0
263 }-
264-
265 if (ret->ameth->set_pub_key == NULL) {
ret->ameth->se...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15
266 EVPerr(EVP_F_EVP_PKEY_NEW_RAW_PUBLIC_KEY,-
267 EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);-
268 goto err;
never executed: goto err;
0
269 }-
270-
271 if (!ret->ameth->set_pub_key(ret, pub, len)) {
!ret->ameth->s...ret, pub, len)Description
TRUEnever evaluated
FALSEevaluated 15 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-15
272 EVPerr(EVP_F_EVP_PKEY_NEW_RAW_PUBLIC_KEY, EVP_R_KEY_SETUP_FAILED);-
273 goto err;
never executed: goto err;
0
274 }-
275-
276 return ret;
executed 15 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
15
277-
278 err:-
279 EVP_PKEY_free(ret);-
280 return NULL;
never executed: return ((void *)0) ;
0
281}-
282-
283int EVP_PKEY_get_raw_private_key(const EVP_PKEY *pkey, unsigned char *priv,-
284 size_t *len)-
285{-
286 if (pkey->ameth->get_priv_key == NULL) {
pkey->ameth->g...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
287 EVPerr(EVP_F_EVP_PKEY_GET_RAW_PRIVATE_KEY,-
288 EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);-
289 return 0;
never executed: return 0;
0
290 }-
291-
292 if (!pkey->ameth->get_priv_key(pkey, priv, len)) {
!pkey->ameth->...ey, priv, len)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
293 EVPerr(EVP_F_EVP_PKEY_GET_RAW_PRIVATE_KEY, EVP_R_GET_RAW_KEY_FAILED);-
294 return 0;
never executed: return 0;
0
295 }-
296-
297 return 1;
executed 8 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
8
298}-
299-
300int EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub,-
301 size_t *len)-
302{-
303 if (pkey->ameth->get_pub_key == NULL) {
pkey->ameth->g...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
304 EVPerr(EVP_F_EVP_PKEY_GET_RAW_PUBLIC_KEY,-
305 EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);-
306 return 0;
never executed: return 0;
0
307 }-
308-
309 if (!pkey->ameth->get_pub_key(pkey, pub, len)) {
!pkey->ameth->...key, pub, len)Description
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-8
310 EVPerr(EVP_F_EVP_PKEY_GET_RAW_PUBLIC_KEY, EVP_R_GET_RAW_KEY_FAILED);-
311 return 0;
never executed: return 0;
0
312 }-
313-
314 return 1;
executed 8 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
8
315}-
316-
317EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv,-
318 size_t len, const EVP_CIPHER *cipher)-
319{-
320#ifndef OPENSSL_NO_CMAC-
321 EVP_PKEY *ret = EVP_PKEY_new();-
322 CMAC_CTX *cmctx = CMAC_CTX_new();-
323-
324 if (ret == NULL
ret == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
325 || cmctx == NULL
cmctx == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
326 || !pkey_set_type(ret, e, EVP_PKEY_CMAC, NULL, -1)) {
!pkey_set_type...oid *)0) , -1)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
327 /* EVPerr already called */-
328 goto err;
never executed: goto err;
0
329 }-
330-
331 if (!CMAC_Init(cmctx, priv, len, cipher, e)) {
!CMAC_Init(cmc...en, cipher, e)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4
332 EVPerr(EVP_F_EVP_PKEY_NEW_CMAC_KEY, EVP_R_KEY_SETUP_FAILED);-
333 goto err;
never executed: goto err;
0
334 }-
335-
336 ret->pkey.ptr = cmctx;-
337 return ret;
executed 4 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
4
338-
339 err:-
340 EVP_PKEY_free(ret);-
341 CMAC_CTX_free(cmctx);-
342 return NULL;
never executed: return ((void *)0) ;
0
343#else-
344 EVPerr(EVP_F_EVP_PKEY_NEW_CMAC_KEY,-
345 EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);-
346 return NULL;-
347#endif-
348}-
349-
350int EVP_PKEY_set_type(EVP_PKEY *pkey, int type)-
351{-
352 return pkey_set_type(pkey, NULL, type, NULL, -1);
executed 129669 times by 1 test: return pkey_set_type(pkey, ((void *)0) , type, ((void *)0) , -1);
Executed by:
  • libcrypto.so.1.1
129669
353}-
354-
355int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len)-
356{-
357 return pkey_set_type(pkey, NULL, EVP_PKEY_NONE, str, len);
executed 1 time by 1 test: return pkey_set_type(pkey, ((void *)0) , 0, str, len);
Executed by:
  • libcrypto.so.1.1
1
358}-
359-
360int EVP_PKEY_set_alias_type(EVP_PKEY *pkey, int type)-
361{-
362 if (pkey->type == type) {
pkey->type == typeDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-3
363 return 1; /* it already is that type */
never executed: return 1;
0
364 }-
365-
366 /*-
367 * The application is requesting to alias this to a different pkey type,-
368 * but not one that resolves to the base type.-
369 */-
370 if (EVP_PKEY_type(type) != EVP_PKEY_base_id(pkey)) {
EVP_PKEY_type(..._base_id(pkey)Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-3
371 EVPerr(EVP_F_EVP_PKEY_SET_ALIAS_TYPE, EVP_R_UNSUPPORTED_ALGORITHM);-
372 return 0;
never executed: return 0;
0
373 }-
374-
375 pkey->type = type;-
376 return 1;
executed 3 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
3
377}-
378-
379#ifndef OPENSSL_NO_ENGINE-
380int EVP_PKEY_set1_engine(EVP_PKEY *pkey, ENGINE *e)-
381{-
382 if (e != NULL) {
e != ((void *)0)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-2
383 if (!ENGINE_init(e)) {
!ENGINE_init(e)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-2
384 EVPerr(EVP_F_EVP_PKEY_SET1_ENGINE, ERR_R_ENGINE_LIB);-
385 return 0;
never executed: return 0;
0
386 }-
387 if (ENGINE_get_pkey_meth(e, pkey->type) == NULL) {
ENGINE_get_pke...== ((void *)0)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 1 time by 1 test
Evaluated by:
  • libcrypto.so.1.1
1
388 ENGINE_finish(e);-
389 EVPerr(EVP_F_EVP_PKEY_SET1_ENGINE, EVP_R_UNSUPPORTED_ALGORITHM);-
390 return 0;
executed 1 time by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
1
391 }-
392 }
executed 1 time by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
1
393 ENGINE_finish(pkey->pmeth_engine);-
394 pkey->pmeth_engine = e;-
395 return 1;
executed 1 time by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
1
396}-
397#endif-
398int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key)-
399{-
400 if (pkey == NULL || !EVP_PKEY_set_type(pkey, type))
pkey == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 63914 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
!EVP_PKEY_set_type(pkey, type)Description
TRUEnever evaluated
FALSEevaluated 63914 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-63914
401 return 0;
never executed: return 0;
0
402 pkey->pkey.ptr = key;-
403 return (key != NULL);
executed 63914 times by 1 test: return (key != ((void *)0) );
Executed by:
  • libcrypto.so.1.1
63914
404}-
405-
406void *EVP_PKEY_get0(const EVP_PKEY *pkey)-
407{-
408 return pkey->pkey.ptr;
executed 20553 times by 1 test: return pkey->pkey.ptr;
Executed by:
  • libcrypto.so.1.1
20553
409}-
410-
411const unsigned char *EVP_PKEY_get0_hmac(const EVP_PKEY *pkey, size_t *len)-
412{-
413 ASN1_OCTET_STRING *os = NULL;-
414 if (pkey->type != EVP_PKEY_HMAC) {
pkey->type != 855Description
TRUEnever evaluated
FALSEnever evaluated
0
415 EVPerr(EVP_F_EVP_PKEY_GET0_HMAC, EVP_R_EXPECTING_AN_HMAC_KEY);-
416 return NULL;
never executed: return ((void *)0) ;
0
417 }-
418 os = EVP_PKEY_get0(pkey);-
419 *len = os->length;-
420 return os->data;
never executed: return os->data;
0
421}-
422-
423#ifndef OPENSSL_NO_POLY1305-
424const unsigned char *EVP_PKEY_get0_poly1305(const EVP_PKEY *pkey, size_t *len)-
425{-
426 ASN1_OCTET_STRING *os = NULL;-
427 if (pkey->type != EVP_PKEY_POLY1305) {
pkey->type != 1061Description
TRUEnever evaluated
FALSEnever evaluated
0
428 EVPerr(EVP_F_EVP_PKEY_GET0_POLY1305, EVP_R_EXPECTING_A_POLY1305_KEY);-
429 return NULL;
never executed: return ((void *)0) ;
0
430 }-
431 os = EVP_PKEY_get0(pkey);-
432 *len = os->length;-
433 return os->data;
never executed: return os->data;
0
434}-
435#endif-
436-
437#ifndef OPENSSL_NO_SIPHASH-
438const unsigned char *EVP_PKEY_get0_siphash(const EVP_PKEY *pkey, size_t *len)-
439{-
440 ASN1_OCTET_STRING *os = NULL;-
441-
442 if (pkey->type != EVP_PKEY_SIPHASH) {
pkey->type != 1062Description
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-26
443 EVPerr(EVP_F_EVP_PKEY_GET0_SIPHASH, EVP_R_EXPECTING_A_SIPHASH_KEY);-
444 return NULL;
never executed: return ((void *)0) ;
0
445 }-
446 os = EVP_PKEY_get0(pkey);-
447 *len = os->length;-
448 return os->data;
executed 26 times by 1 test: return os->data;
Executed by:
  • libcrypto.so.1.1
26
449}-
450#endif-
451-
452#ifndef OPENSSL_NO_RSA-
453int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key)-
454{-
455 int ret = EVP_PKEY_assign_RSA(pkey, key);-
456 if (ret)
retDescription
TRUEevaluated 36 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-36
457 RSA_up_ref(key);
executed 36 times by 1 test: RSA_up_ref(key);
Executed by:
  • libcrypto.so.1.1
36
458 return ret;
executed 36 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
36
459}-
460-
461RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)-
462{-
463 if (pkey->type != EVP_PKEY_RSA) {
pkey->type != 6Description
TRUEnever evaluated
FALSEevaluated 4575 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-4575
464 EVPerr(EVP_F_EVP_PKEY_GET0_RSA, EVP_R_EXPECTING_AN_RSA_KEY);-
465 return NULL;
never executed: return ((void *)0) ;
0
466 }-
467 return pkey->pkey.rsa;
executed 4575 times by 1 test: return pkey->pkey.rsa;
Executed by:
  • libcrypto.so.1.1
4575
468}-
469-
470RSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey)-
471{-
472 RSA *ret = EVP_PKEY_get0_RSA(pkey);-
473 if (ret != NULL)
ret != ((void *)0)Description
TRUEevaluated 33 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-33
474 RSA_up_ref(ret);
executed 33 times by 1 test: RSA_up_ref(ret);
Executed by:
  • libcrypto.so.1.1
33
475 return ret;
executed 33 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
33
476}-
477#endif-
478-
479#ifndef OPENSSL_NO_DSA-
480int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, DSA *key)-
481{-
482 int ret = EVP_PKEY_assign_DSA(pkey, key);-
483 if (ret)
retDescription
TRUEevaluated 51 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-51
484 DSA_up_ref(key);
executed 51 times by 1 test: DSA_up_ref(key);
Executed by:
  • libcrypto.so.1.1
51
485 return ret;
executed 51 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
51
486}-
487-
488DSA *EVP_PKEY_get0_DSA(EVP_PKEY *pkey)-
489{-
490 if (pkey->type != EVP_PKEY_DSA) {
pkey->type != 116Description
TRUEnever evaluated
FALSEevaluated 1827 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-1827
491 EVPerr(EVP_F_EVP_PKEY_GET0_DSA, EVP_R_EXPECTING_A_DSA_KEY);-
492 return NULL;
never executed: return ((void *)0) ;
0
493 }-
494 return pkey->pkey.dsa;
executed 1827 times by 1 test: return pkey->pkey.dsa;
Executed by:
  • libcrypto.so.1.1
1827
495}-
496-
497DSA *EVP_PKEY_get1_DSA(EVP_PKEY *pkey)-
498{-
499 DSA *ret = EVP_PKEY_get0_DSA(pkey);-
500 if (ret != NULL)
ret != ((void *)0)Description
TRUEevaluated 1819 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1819
501 DSA_up_ref(ret);
executed 1819 times by 1 test: DSA_up_ref(ret);
Executed by:
  • libcrypto.so.1.1
1819
502 return ret;
executed 1819 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
1819
503}-
504#endif-
505-
506#ifndef OPENSSL_NO_EC-
507-
508int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, EC_KEY *key)-
509{-
510 int ret = EVP_PKEY_assign_EC_KEY(pkey, key);-
511 if (ret)
retDescription
TRUEevaluated 17 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-17
512 EC_KEY_up_ref(key);
executed 17 times by 1 test: EC_KEY_up_ref(key);
Executed by:
  • libcrypto.so.1.1
17
513 return ret;
executed 17 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
17
514}-
515-
516EC_KEY *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey)-
517{-
518 if (pkey->type != EVP_PKEY_EC) {
pkey->type != 408Description
TRUEnever evaluated
FALSEevaluated 7185 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-7185
519 EVPerr(EVP_F_EVP_PKEY_GET0_EC_KEY, EVP_R_EXPECTING_A_EC_KEY);-
520 return NULL;
never executed: return ((void *)0) ;
0
521 }-
522 return pkey->pkey.ec;
executed 7185 times by 1 test: return pkey->pkey.ec;
Executed by:
  • libcrypto.so.1.1
7185
523}-
524-
525EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey)-
526{-
527 EC_KEY *ret = EVP_PKEY_get0_EC_KEY(pkey);-
528 if (ret != NULL)
ret != ((void *)0)Description
TRUEevaluated 1842 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1842
529 EC_KEY_up_ref(ret);
executed 1842 times by 1 test: EC_KEY_up_ref(ret);
Executed by:
  • libcrypto.so.1.1
1842
530 return ret;
executed 1842 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
1842
531}-
532#endif-
533-
534#ifndef OPENSSL_NO_DH-
535-
536int EVP_PKEY_set1_DH(EVP_PKEY *pkey, DH *key)-
537{-
538 int ret = EVP_PKEY_assign_DH(pkey, key);-
539 if (ret)
retDescription
TRUEevaluated 235 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-235
540 DH_up_ref(key);
executed 235 times by 1 test: DH_up_ref(key);
Executed by:
  • libcrypto.so.1.1
235
541 return ret;
executed 235 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
235
542}-
543-
544DH *EVP_PKEY_get0_DH(EVP_PKEY *pkey)-
545{-
546 if (pkey->type != EVP_PKEY_DH && pkey->type != EVP_PKEY_DHX) {
pkey->type != 28Description
TRUEnever evaluated
FALSEevaluated 274 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
pkey->type != 920Description
TRUEnever evaluated
FALSEnever evaluated
0-274
547 EVPerr(EVP_F_EVP_PKEY_GET0_DH, EVP_R_EXPECTING_A_DH_KEY);-
548 return NULL;
never executed: return ((void *)0) ;
0
549 }-
550 return pkey->pkey.dh;
executed 274 times by 1 test: return pkey->pkey.dh;
Executed by:
  • libcrypto.so.1.1
274
551}-
552-
553DH *EVP_PKEY_get1_DH(EVP_PKEY *pkey)-
554{-
555 DH *ret = EVP_PKEY_get0_DH(pkey);-
556 if (ret != NULL)
ret != ((void *)0)Description
TRUEnever evaluated
FALSEnever evaluated
0
557 DH_up_ref(ret);
never executed: DH_up_ref(ret);
0
558 return ret;
never executed: return ret;
0
559}-
560#endif-
561-
562int EVP_PKEY_type(int type)-
563{-
564 int ret;-
565 const EVP_PKEY_ASN1_METHOD *ameth;-
566 ENGINE *e;-
567 ameth = EVP_PKEY_asn1_find(&e, type);-
568 if (ameth)
amethDescription
TRUEevaluated 1373 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-1373
569 ret = ameth->pkey_id;
executed 1373 times by 1 test: ret = ameth->pkey_id;
Executed by:
  • libcrypto.so.1.1
1373
570 else-
571 ret = NID_undef;
never executed: ret = 0;
0
572#ifndef OPENSSL_NO_ENGINE-
573 ENGINE_finish(e);-
574#endif-
575 return ret;
executed 1373 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
1373
576}-
577-
578int EVP_PKEY_id(const EVP_PKEY *pkey)-
579{-
580 return pkey->type;
executed 38125 times by 1 test: return pkey->type;
Executed by:
  • libcrypto.so.1.1
38125
581}-
582-
583int EVP_PKEY_base_id(const EVP_PKEY *pkey)-
584{-
585 return EVP_PKEY_type(pkey->type);
executed 4 times by 1 test: return EVP_PKEY_type(pkey->type);
Executed by:
  • libcrypto.so.1.1
4
586}-
587-
588void EVP_PKEY_free(EVP_PKEY *x)-
589{-
590 int i;-
591-
592 if (x == NULL)
x == ((void *)0)Description
TRUEevaluated 624970 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 348152 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
348152-624970
593 return;
executed 624970 times by 1 test: return;
Executed by:
  • libcrypto.so.1.1
624970
594-
595 CRYPTO_DOWN_REF(&x->references, &i, x->lock);-
596 REF_PRINT_COUNT("EVP_PKEY", x);-
597 if (i > 0)
i > 0Description
TRUEevaluated 249355 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 98797 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
98797-249355
598 return;
executed 249355 times by 1 test: return;
Executed by:
  • libcrypto.so.1.1
249355
599 REF_ASSERT_ISNT(i < 0);-
600 EVP_PKEY_free_it(x);-
601 CRYPTO_THREAD_lock_free(x->lock);-
602 sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free);-
603 OPENSSL_free(x);-
604}
executed 98797 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
98797
605-
606static void EVP_PKEY_free_it(EVP_PKEY *x)-
607{-
608 /* internal function; x is never NULL */-
609 if (x->ameth && x->ameth->pkey_free) {
x->amethDescription
TRUEevaluated 97204 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 2183 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
x->ameth->pkey_freeDescription
TRUEevaluated 97204 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-97204
610 x->ameth->pkey_free(x);-
611 x->pkey.ptr = NULL;-
612 }
executed 97204 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
97204
613#ifndef OPENSSL_NO_ENGINE-
614 ENGINE_finish(x->engine);-
615 x->engine = NULL;-
616 ENGINE_finish(x->pmeth_engine);-
617 x->pmeth_engine = NULL;-
618#endif-
619}
executed 99387 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
99387
620-
621static int unsup_alg(BIO *out, const EVP_PKEY *pkey, int indent,-
622 const char *kstr)-
623{-
624 BIO_indent(out, indent, 128);-
625 BIO_printf(out, "%s algorithm \"%s\" unsupported\n",-
626 kstr, OBJ_nid2ln(pkey->type));-
627 return 1;
never executed: return 1;
0
628}-
629-
630int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey,-
631 int indent, ASN1_PCTX *pctx)-
632{-
633 if (pkey->ameth && pkey->ameth->pub_print)
pkey->amethDescription
TRUEevaluated 244 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
pkey->ameth->pub_printDescription
TRUEevaluated 244 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-244
634 return pkey->ameth->pub_print(out, pkey, indent, pctx);
executed 244 times by 1 test: return pkey->ameth->pub_print(out, pkey, indent, pctx);
Executed by:
  • libcrypto.so.1.1
244
635-
636 return unsup_alg(out, pkey, indent, "Public Key");
never executed: return unsup_alg(out, pkey, indent, "Public Key");
0
637}-
638-
639int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey,-
640 int indent, ASN1_PCTX *pctx)-
641{-
642 if (pkey->ameth && pkey->ameth->priv_print)
pkey->amethDescription
TRUEevaluated 116 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
pkey->ameth->priv_printDescription
TRUEevaluated 116 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-116
643 return pkey->ameth->priv_print(out, pkey, indent, pctx);
executed 116 times by 1 test: return pkey->ameth->priv_print(out, pkey, indent, pctx);
Executed by:
  • libcrypto.so.1.1
116
644-
645 return unsup_alg(out, pkey, indent, "Private Key");
never executed: return unsup_alg(out, pkey, indent, "Private Key");
0
646}-
647-
648int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey,-
649 int indent, ASN1_PCTX *pctx)-
650{-
651 if (pkey->ameth && pkey->ameth->param_print)
pkey->amethDescription
TRUEevaluated 13 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
pkey->ameth->param_printDescription
TRUEevaluated 13 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-13
652 return pkey->ameth->param_print(out, pkey, indent, pctx);
executed 13 times by 1 test: return pkey->ameth->param_print(out, pkey, indent, pctx);
Executed by:
  • libcrypto.so.1.1
13
653 return unsup_alg(out, pkey, indent, "Parameters");
never executed: return unsup_alg(out, pkey, indent, "Parameters");
0
654}-
655-
656static int evp_pkey_asn1_ctrl(EVP_PKEY *pkey, int op, int arg1, void *arg2)-
657{-
658 if (pkey->ameth == NULL || pkey->ameth->pkey_ctrl == NULL)
pkey->ameth == ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 10282 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
pkey->ameth->p...== ((void *)0)Description
TRUEnever evaluated
FALSEevaluated 10282 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-10282
659 return -2;
never executed: return -2;
0
660 return pkey->ameth->pkey_ctrl(pkey, op, arg1, arg2);
executed 10282 times by 1 test: return pkey->ameth->pkey_ctrl(pkey, op, arg1, arg2);
Executed by:
  • libcrypto.so.1.1
10282
661}-
662-
663int EVP_PKEY_get_default_digest_nid(EVP_PKEY *pkey, int *pnid)-
664{-
665 return evp_pkey_asn1_ctrl(pkey, ASN1_PKEY_CTRL_DEFAULT_MD_NID, 0, pnid);
executed 104 times by 1 test: return evp_pkey_asn1_ctrl(pkey, 0x3, 0, pnid);
Executed by:
  • libcrypto.so.1.1
104
666}-
667-
668int EVP_PKEY_set1_tls_encodedpoint(EVP_PKEY *pkey,-
669 const unsigned char *pt, size_t ptlen)-
670{-
671 if (ptlen > INT_MAX)
ptlen > 0x7fffffffDescription
TRUEnever evaluated
FALSEevaluated 3528 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-3528
672 return 0;
never executed: return 0;
0
673 if (evp_pkey_asn1_ctrl(pkey, ASN1_PKEY_CTRL_SET1_TLS_ENCPT, ptlen,
evp_pkey_asn1_...oid *)pt) <= 0Description
TRUEevaluated 72 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3456 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
72-3456
674 (void *)pt) <= 0)
evp_pkey_asn1_...oid *)pt) <= 0Description
TRUEevaluated 72 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEevaluated 3456 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
72-3456
675 return 0;
executed 72 times by 1 test: return 0;
Executed by:
  • libcrypto.so.1.1
72
676 return 1;
executed 3456 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
3456
677}-
678-
679size_t EVP_PKEY_get1_tls_encodedpoint(EVP_PKEY *pkey, unsigned char **ppt)-
680{-
681 int rv;-
682 rv = evp_pkey_asn1_ctrl(pkey, ASN1_PKEY_CTRL_GET1_TLS_ENCPT, 0, ppt);-
683 if (rv <= 0)
rv <= 0Description
TRUEnever evaluated
FALSEevaluated 6650 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-6650
684 return 0;
never executed: return 0;
0
685 return rv;
executed 6650 times by 1 test: return rv;
Executed by:
  • libcrypto.so.1.1
6650
686}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2