/src/cryptofuzz-sp-math-all-8bit/include/cryptofuzz/repository.h
Line | Count | Source (jump to first uncovered line) |
1 | | #pragma once |
2 | | |
3 | | #include <fuzzing/datasource/id.hpp> |
4 | | #include <string> |
5 | | #include <stdexcept> |
6 | | |
7 | | namespace cryptofuzz { |
8 | | namespace repository { |
9 | | |
10 | | bool IsCBC(const uint64_t id); |
11 | | bool IsCCM(const uint64_t id); |
12 | | bool IsCFB(const uint64_t id); |
13 | | bool IsCTR(const uint64_t id); |
14 | | bool IsECB(const uint64_t id); |
15 | | bool IsGCM(const uint64_t id); |
16 | | bool IsOCB(const uint64_t id); |
17 | | bool IsOFB(const uint64_t id); |
18 | | bool IsXTS(const uint64_t id); |
19 | | bool IsAEAD(const uint64_t id); |
20 | | bool IsWRAP(const uint64_t id); |
21 | | bool IsAES(const uint64_t id); |
22 | | std::string DigestToString(const uint64_t id); |
23 | | std::optional<uint64_t> DigestFromString(const std::string& s); |
24 | | std::string CipherToString(const uint64_t id); |
25 | | std::string ECC_CurveToString(const uint64_t id); |
26 | | std::optional<uint64_t> ECC_CurveFromString(const std::string& s); |
27 | | std::optional<size_t> ECC_CurveToBits(const uint64_t id); |
28 | | std::optional<std::string> ECC_CurveToPrime(const uint64_t id); |
29 | | std::optional<std::string> ECC_CurveToA(const uint64_t id); |
30 | | std::optional<std::string> ECC_CurveToB(const uint64_t id); |
31 | | std::optional<std::string> ECC_CurveToX(const uint64_t id); |
32 | | std::optional<std::string> ECC_CurveToY(const uint64_t id); |
33 | | std::optional<std::string> ECC_CurveToOrderMin1(const uint64_t id); |
34 | | std::optional<std::string> ECC_CurveToOrder(const uint64_t id); |
35 | | std::string CalcOpToString(const uint64_t id); |
36 | | size_t CalcOpToNumParams(const uint64_t id); |
37 | | std::optional<size_t> DigestSize(const uint64_t id); |
38 | | |
39 | | #include "../../repository_tbl.h" |
40 | | |
41 | | template <typename LUT> |
42 | | inline constexpr long LUTCheck(const uint64_t id, const LUT* lut, const size_t lutSize) noexcept { |
43 | | for (size_t i = 0; i < lutSize; i++) { |
44 | | if ( lut[i].id == id ) { |
45 | | return i; |
46 | | } |
47 | | } |
48 | | |
49 | | return -1; |
50 | | } |
51 | | |
52 | | template <uint64_t id> |
53 | | constexpr long moduleIndex(void) { |
54 | | constexpr long index = LUTCheck(id, ModuleLUT, sizeof(ModuleLUT) / sizeof(ModuleLUT[0])); |
55 | | static_assert(-1 != index, "Not a valid module"); |
56 | | return index; |
57 | | } |
58 | | |
59 | | template <uint64_t id> |
60 | | constexpr uint64_t Module(void) { |
61 | | (void)moduleIndex<id>(); |
62 | | return id; |
63 | | } |
64 | | |
65 | | template <uint64_t id> |
66 | | constexpr long operationIndex(void) { |
67 | | constexpr long index = LUTCheck(id, OperationLUT, sizeof(OperationLUT) / sizeof(OperationLUT[0])); |
68 | | static_assert(-1 != index, "Not a valid operation"); |
69 | | return index; |
70 | | } |
71 | | |
72 | | template <uint64_t id> |
73 | | constexpr uint64_t Operation(void) { |
74 | | (void)operationIndex<id>(); |
75 | | return id; |
76 | | } |
77 | | |
78 | | template <uint64_t id> |
79 | 0 | constexpr long digestIndex(void) { |
80 | 0 | constexpr long index = LUTCheck(id, DigestLUT, sizeof(DigestLUT) / sizeof(DigestLUT[0])); |
81 | 0 | static_assert(-1 != index, "Not a valid digest"); |
82 | 0 | return index; |
83 | 0 | } Unexecuted instantiation: long cryptofuzz::repository::digestIndex<2531185399873972180ul>() Unexecuted instantiation: long cryptofuzz::repository::digestIndex<13948243250661989563ul>() Unexecuted instantiation: long cryptofuzz::repository::digestIndex<7193266003474423991ul>() Unexecuted instantiation: long cryptofuzz::repository::digestIndex<10117987346593531560ul>() Unexecuted instantiation: long cryptofuzz::repository::digestIndex<9804783951172089512ul>() |
84 | | |
85 | | template <uint64_t id> |
86 | 0 | constexpr uint64_t Digest(void) { |
87 | 0 | (void)digestIndex<id>(); |
88 | 0 | return id; |
89 | 0 | } Unexecuted instantiation: unsigned long cryptofuzz::repository::Digest<2531185399873972180ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Digest<13948243250661989563ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Digest<7193266003474423991ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Digest<10117987346593531560ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Digest<9804783951172089512ul>() |
90 | | |
91 | | template <uint64_t id> |
92 | 0 | constexpr long cipherIndex(void) { |
93 | 0 | constexpr long index = LUTCheck(id, CipherLUT, sizeof(CipherLUT) / sizeof(CipherLUT[0])); |
94 | 0 | static_assert(-1 != index, "Not a valid cipher"); |
95 | 0 | return index; |
96 | 0 | } Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<7564088869236869393ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<4040454399894886242ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<17545169476671327590ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<16403139470927532787ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<168239428651064518ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<10961528883423616596ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<10028991152867051488ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<2105873454297073299ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<916744443905566016ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<10029001048471705387ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<2105881150878470776ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<916754339510219915ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<5348827950297912837ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<1577848050000181708ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<6418501238498790373ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<14281920195456605635ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<13427899349556222646ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<10243334185369797563ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<11789540548779567904ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<11281717605982429235ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<2554922593668931776ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<2562230406809551580ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<2572658175089423229ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<2034690225297568860ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<1092635628194589707ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<14241624657856954292ul>() Unexecuted instantiation: long cryptofuzz::repository::cipherIndex<8739115493129040043ul>() |
97 | | |
98 | | template <uint64_t id> |
99 | 0 | constexpr uint64_t Cipher(void) { |
100 | 0 | (void)cipherIndex<id>(); |
101 | 0 | return id; |
102 | 0 | } Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<7564088869236869393ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<4040454399894886242ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<17545169476671327590ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<16403139470927532787ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<168239428651064518ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<10961528883423616596ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<10028991152867051488ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<2105873454297073299ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<916744443905566016ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<10029001048471705387ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<2105881150878470776ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<916754339510219915ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<5348827950297912837ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<1577848050000181708ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<6418501238498790373ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<14281920195456605635ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<13427899349556222646ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<10243334185369797563ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<11789540548779567904ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<11281717605982429235ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<2554922593668931776ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<2562230406809551580ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<2572658175089423229ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<2034690225297568860ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<1092635628194589707ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<14241624657856954292ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::Cipher<8739115493129040043ul>() |
103 | | |
104 | | template <uint64_t id> |
105 | 46.2k | constexpr long ecc_CurveIndex(void) { |
106 | 46.2k | constexpr long index = LUTCheck(id, ECC_CurveLUT, sizeof(ECC_CurveLUT) / sizeof(ECC_CurveLUT[0])); |
107 | 46.2k | static_assert(-1 != index, "Not a valid ECC curve"); |
108 | 46.2k | return index; |
109 | 46.2k | } long cryptofuzz::repository::ecc_CurveIndex<14893194006091039478ul>() Line | Count | Source | 105 | 26.2k | constexpr long ecc_CurveIndex(void) { | 106 | 26.2k | constexpr long index = LUTCheck(id, ECC_CurveLUT, sizeof(ECC_CurveLUT) / sizeof(ECC_CurveLUT[0])); | 107 | 26.2k | static_assert(-1 != index, "Not a valid ECC curve"); | 108 | 26.2k | return index; | 109 | 26.2k | } |
long cryptofuzz::repository::ecc_CurveIndex<870543739552251972ul>() Line | Count | Source | 105 | 19.9k | constexpr long ecc_CurveIndex(void) { | 106 | 19.9k | constexpr long index = LUTCheck(id, ECC_CurveLUT, sizeof(ECC_CurveLUT) / sizeof(ECC_CurveLUT[0])); | 107 | 19.9k | static_assert(-1 != index, "Not a valid ECC curve"); | 108 | 19.9k | return index; | 109 | 19.9k | } |
Unexecuted instantiation: long cryptofuzz::repository::ecc_CurveIndex<11497597491031329196ul>() Unexecuted instantiation: long cryptofuzz::repository::ecc_CurveIndex<11497600789566213829ul>() Unexecuted instantiation: long cryptofuzz::repository::ecc_CurveIndex<10741749114683782961ul>() Unexecuted instantiation: long cryptofuzz::repository::ecc_CurveIndex<10741745816148898328ul>() Unexecuted instantiation: long cryptofuzz::repository::ecc_CurveIndex<8101366718201711118ul>() Unexecuted instantiation: long cryptofuzz::repository::ecc_CurveIndex<8101367817713339329ul>() Unexecuted instantiation: long cryptofuzz::repository::ecc_CurveIndex<8101360121131941852ul>() Unexecuted instantiation: long cryptofuzz::repository::ecc_CurveIndex<8101361220643570063ul>() Unexecuted instantiation: long cryptofuzz::repository::ecc_CurveIndex<11562709123469336751ul>() Unexecuted instantiation: long cryptofuzz::repository::ecc_CurveIndex<14934304310443215140ul>() Unexecuted instantiation: long cryptofuzz::repository::ecc_CurveIndex<7725066371645658521ul>() Unexecuted instantiation: long cryptofuzz::repository::ecc_CurveIndex<13401848446798274007ul>() Unexecuted instantiation: long cryptofuzz::repository::ecc_CurveIndex<13401849546309902218ul>() |
110 | | |
111 | | template <uint64_t id> |
112 | 46.2k | constexpr uint64_t ECC_Curve(void) { |
113 | 46.2k | (void)ecc_CurveIndex<id>(); |
114 | 46.2k | return id; |
115 | 46.2k | } unsigned long cryptofuzz::repository::ECC_Curve<14893194006091039478ul>() Line | Count | Source | 112 | 26.2k | constexpr uint64_t ECC_Curve(void) { | 113 | 26.2k | (void)ecc_CurveIndex<id>(); | 114 | 26.2k | return id; | 115 | 26.2k | } |
unsigned long cryptofuzz::repository::ECC_Curve<870543739552251972ul>() Line | Count | Source | 112 | 19.9k | constexpr uint64_t ECC_Curve(void) { | 113 | 19.9k | (void)ecc_CurveIndex<id>(); | 114 | 19.9k | return id; | 115 | 19.9k | } |
Unexecuted instantiation: unsigned long cryptofuzz::repository::ECC_Curve<11497597491031329196ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::ECC_Curve<11497600789566213829ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::ECC_Curve<10741749114683782961ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::ECC_Curve<10741745816148898328ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::ECC_Curve<8101366718201711118ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::ECC_Curve<8101367817713339329ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::ECC_Curve<8101360121131941852ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::ECC_Curve<8101361220643570063ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::ECC_Curve<11562709123469336751ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::ECC_Curve<14934304310443215140ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::ECC_Curve<7725066371645658521ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::ECC_Curve<13401848446798274007ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::ECC_Curve<13401849546309902218ul>() |
116 | | |
117 | | template <uint64_t id> |
118 | 0 | constexpr long calcOpIndex(void) { |
119 | 0 | constexpr long index = LUTCheck(id, CalcOpLUT, sizeof(CalcOpLUT) / sizeof(CalcOpLUT[0])); |
120 | 0 | static_assert(-1 != index, "Not a valid calculation operation"); |
121 | 0 | return index; |
122 | 0 | } Unexecuted instantiation: long cryptofuzz::repository::calcOpIndex<7565474059520578463ul>() Unexecuted instantiation: long cryptofuzz::repository::calcOpIndex<5785484340816638963ul>() Unexecuted instantiation: long cryptofuzz::repository::calcOpIndex<8313790271709138543ul>() Unexecuted instantiation: long cryptofuzz::repository::calcOpIndex<497803678004747625ul>() Unexecuted instantiation: long cryptofuzz::repository::calcOpIndex<17395210549452595161ul>() Unexecuted instantiation: long cryptofuzz::repository::calcOpIndex<12234676516579856929ul>() Unexecuted instantiation: long cryptofuzz::repository::calcOpIndex<3914790112055834161ul>() Unexecuted instantiation: long cryptofuzz::repository::calcOpIndex<7388945974529068435ul>() Unexecuted instantiation: long cryptofuzz::repository::calcOpIndex<5575473018973207767ul>() Unexecuted instantiation: long cryptofuzz::repository::calcOpIndex<5028249431888347578ul>() Unexecuted instantiation: long cryptofuzz::repository::calcOpIndex<2910448180055264741ul>() |
123 | | |
124 | | template <uint64_t id> |
125 | 0 | constexpr uint64_t CalcOp(void) { |
126 | 0 | (void)calcOpIndex<id>(); |
127 | 0 | return id; |
128 | 0 | } Unexecuted instantiation: unsigned long cryptofuzz::repository::CalcOp<7565474059520578463ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::CalcOp<5785484340816638963ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::CalcOp<8313790271709138543ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::CalcOp<497803678004747625ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::CalcOp<17395210549452595161ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::CalcOp<12234676516579856929ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::CalcOp<3914790112055834161ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::CalcOp<7388945974529068435ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::CalcOp<5575473018973207767ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::CalcOp<5028249431888347578ul>() Unexecuted instantiation: unsigned long cryptofuzz::repository::CalcOp<2910448180055264741ul>() |
129 | | |
130 | | } /* namespace repository */ |
131 | | } /* namespace cryptofuzz */ |
132 | | |
133 | 0 | #define CF_CIPHER(s) cryptofuzz::repository::Cipher<fuzzing::datasource::ID("Cryptofuzz/Cipher/" s)>() |
134 | 9.47k | #define CF_DIGEST(s) cryptofuzz::repository::Digest<fuzzing::datasource::ID("Cryptofuzz/Digest/" s)>() |
135 | | #define CF_MODULE(s) cryptofuzz::repository::Module<fuzzing::datasource::ID("Cryptofuzz/Module/" s)>() |
136 | | #define CF_OPERATION(s) cryptofuzz::repository::Operation<fuzzing::datasource::ID("Cryptofuzz/Operation/" s)>() |
137 | 1.23M | #define CF_ECC_CURVE(s) cryptofuzz::repository::ECC_Curve<fuzzing::datasource::ID("Cryptofuzz/ECC_Curve/" s)>() |
138 | 34.8k | #define CF_CALCOP(s) cryptofuzz::repository::CalcOp<fuzzing::datasource::ID("Cryptofuzz/CalcOp/" s)>() |