OpenCoverage

tb_digest.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/engine/tb_digest.c
Source codeSwitch to Preprocessed file
LineSourceCount
1/*-
2 * Copyright 2001-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 "eng_int.h"-
11-
12static ENGINE_TABLE *digest_table = NULL;-
13-
14void ENGINE_unregister_digests(ENGINE *e)-
15{-
16 engine_table_unregister(&digest_table, e);-
17}
never executed: end of block
0
18-
19static void engine_unregister_all_digests(void)-
20{-
21 engine_table_cleanup(&digest_table);-
22}
executed 367 times by 1 test: end of block
Executed by:
  • libcrypto.so.1.1
367
23-
24int ENGINE_register_digests(ENGINE *e)-
25{-
26 if (e->digests) {
e->digestsDescription
TRUEnever evaluated
FALSEevaluated 3748 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-3748
27 const int *nids;-
28 int num_nids = e->digests(e, NULL, &nids, 0);-
29 if (num_nids > 0)
num_nids > 0Description
TRUEnever evaluated
FALSEnever evaluated
0
30 return engine_table_register(&digest_table,
never executed: return engine_table_register(&digest_table, engine_unregister_all_digests, e, nids, num_nids, 0);
0
31 engine_unregister_all_digests, e,
never executed: return engine_table_register(&digest_table, engine_unregister_all_digests, e, nids, num_nids, 0);
0
32 nids, num_nids, 0);
never executed: return engine_table_register(&digest_table, engine_unregister_all_digests, e, nids, num_nids, 0);
0
33 }
never executed: end of block
0
34 return 1;
executed 3748 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
3748
35}-
36-
37void ENGINE_register_all_digests(void)-
38{-
39 ENGINE *e;-
40-
41 for (e = ENGINE_get_first(); e; e = ENGINE_get_next(e))
eDescription
TRUEnever evaluated
FALSEnever evaluated
0
42 ENGINE_register_digests(e);
never executed: ENGINE_register_digests(e);
0
43}
never executed: end of block
0
44-
45int ENGINE_set_default_digests(ENGINE *e)-
46{-
47 if (e->digests) {
e->digestsDescription
TRUEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-367
48 const int *nids;-
49 int num_nids = e->digests(e, NULL, &nids, 0);-
50 if (num_nids > 0)
num_nids > 0Description
TRUEevaluated 367 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
FALSEnever evaluated
0-367
51 return engine_table_register(&digest_table,
executed 367 times by 1 test: return engine_table_register(&digest_table, engine_unregister_all_digests, e, nids, num_nids, 1);
Executed by:
  • libcrypto.so.1.1
367
52 engine_unregister_all_digests, e,
executed 367 times by 1 test: return engine_table_register(&digest_table, engine_unregister_all_digests, e, nids, num_nids, 1);
Executed by:
  • libcrypto.so.1.1
367
53 nids, num_nids, 1);
executed 367 times by 1 test: return engine_table_register(&digest_table, engine_unregister_all_digests, e, nids, num_nids, 1);
Executed by:
  • libcrypto.so.1.1
367
54 }
never executed: end of block
0
55 return 1;
never executed: return 1;
0
56}-
57-
58/*-
59 * Exposed API function to get a functional reference from the implementation-
60 * table (ie. try to get a functional reference from the tabled structural-
61 * references) for a given digest 'nid'-
62 */-
63ENGINE *ENGINE_get_digest_engine(int nid)-
64{-
65 return engine_table_select(&digest_table, nid);
executed 689700 times by 3 tests: return engine_table_select(&digest_table, nid);
Executed by:
  • curve448_internal_test
  • libcrypto.so.1.1
  • sm2_internal_test
689700
66}-
67-
68/* Obtains a digest implementation from an ENGINE functional reference */-
69const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid)-
70{-
71 const EVP_MD *ret;-
72 ENGINE_DIGESTS_PTR fn = ENGINE_get_digests(e);-
73 if (!fn || !fn(e, &ret, NULL, nid)) {
!fnDescription
TRUEnever evaluated
FALSEevaluated 10747 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
!fn(e, &ret, (...id *)0) , nid)Description
TRUEnever evaluated
FALSEevaluated 10747 times by 1 test
Evaluated by:
  • libcrypto.so.1.1
0-10747
74 ENGINEerr(ENGINE_F_ENGINE_GET_DIGEST, ENGINE_R_UNIMPLEMENTED_DIGEST);-
75 return NULL;
never executed: return ((void *)0) ;
0
76 }-
77 return ret;
executed 10747 times by 1 test: return ret;
Executed by:
  • libcrypto.so.1.1
10747
78}-
79-
80/* Gets the digest callback from an ENGINE structure */-
81ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e)-
82{-
83 return e->digests;
executed 10747 times by 1 test: return e->digests;
Executed by:
  • libcrypto.so.1.1
10747
84}-
85-
86/* Sets the digest callback in an ENGINE structure */-
87int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f)-
88{-
89 e->digests = f;-
90 return 1;
executed 367 times by 1 test: return 1;
Executed by:
  • libcrypto.so.1.1
367
91}-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.2