| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/ec/ecx_meth.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||||||||
| 2 | typedef enum { | - | ||||||||||||||||||||||||||||||||||||
| 3 | KEY_OP_PUBLIC, | - | ||||||||||||||||||||||||||||||||||||
| 4 | KEY_OP_PRIVATE, | - | ||||||||||||||||||||||||||||||||||||
| 5 | KEY_OP_KEYGEN | - | ||||||||||||||||||||||||||||||||||||
| 6 | } ecx_key_op_t; | - | ||||||||||||||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||||||||||||||
| 9 | static int ecx_key_op(EVP_PKEY *pkey, int id, const X509_ALGOR *palg, | - | ||||||||||||||||||||||||||||||||||||
| 10 | const unsigned char *p, int plen, ecx_key_op_t op) | - | ||||||||||||||||||||||||||||||||||||
| 11 | { | - | ||||||||||||||||||||||||||||||||||||
| 12 | ECX_KEY *key = | - | ||||||||||||||||||||||||||||||||||||
| 13 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 14 | ; | - | ||||||||||||||||||||||||||||||||||||
| 15 | unsigned char *privkey, *pubkey; | - | ||||||||||||||||||||||||||||||||||||
| 16 | - | |||||||||||||||||||||||||||||||||||||
| 17 | if (op != KEY_OP_KEYGEN
| 3347-6273 | ||||||||||||||||||||||||||||||||||||
| 18 | if (palg !=
| 194-3153 | ||||||||||||||||||||||||||||||||||||
| 19 | ((void *)0)
| 194-3153 | ||||||||||||||||||||||||||||||||||||
| 20 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 21 | int ptype; | - | ||||||||||||||||||||||||||||||||||||
| 22 | - | |||||||||||||||||||||||||||||||||||||
| 23 | - | |||||||||||||||||||||||||||||||||||||
| 24 | X509_ALGOR_get0( | - | ||||||||||||||||||||||||||||||||||||
| 25 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 26 | , &ptype, | - | ||||||||||||||||||||||||||||||||||||
| 27 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 28 | , palg); | - | ||||||||||||||||||||||||||||||||||||
| 29 | if (ptype != -1
| 4-190 | ||||||||||||||||||||||||||||||||||||
| 30 | ERR_put_error(16,(266),(102),__FILE__,58); | - | ||||||||||||||||||||||||||||||||||||
| 31 | return executed 4 times by 1 test: 0;return 0;Executed by:
executed 4 times by 1 test: return 0;Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||
| 32 | } | - | ||||||||||||||||||||||||||||||||||||
| 33 | } executed 190 times by 1 test: end of blockExecuted by:
| 190 | ||||||||||||||||||||||||||||||||||||
| 34 | - | |||||||||||||||||||||||||||||||||||||
| 35 | if (p ==
| 4-3339 | ||||||||||||||||||||||||||||||||||||
| 36 | ((void *)0)
| 4-3339 | ||||||||||||||||||||||||||||||||||||
| 37 | || plen != (((
| 14-3325 | ||||||||||||||||||||||||||||||||||||
| 38 | ERR_put_error(16,(266),(102),__FILE__,64); | - | ||||||||||||||||||||||||||||||||||||
| 39 | return executed 18 times by 1 test: 0;return 0;Executed by:
executed 18 times by 1 test: return 0;Executed by:
| 18 | ||||||||||||||||||||||||||||||||||||
| 40 | } | - | ||||||||||||||||||||||||||||||||||||
| 41 | } executed 3325 times by 1 test: end of blockExecuted by:
| 3325 | ||||||||||||||||||||||||||||||||||||
| 42 | - | |||||||||||||||||||||||||||||||||||||
| 43 | key = CRYPTO_zalloc(sizeof(*key), __FILE__, 69); | - | ||||||||||||||||||||||||||||||||||||
| 44 | if (key ==
| 0-9598 | ||||||||||||||||||||||||||||||||||||
| 45 | ((void *)0)
| 0-9598 | ||||||||||||||||||||||||||||||||||||
| 46 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 47 | ERR_put_error(16,(266),((1|64)),__FILE__,71); | - | ||||||||||||||||||||||||||||||||||||
| 48 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 49 | } | - | ||||||||||||||||||||||||||||||||||||
| 50 | pubkey = key->pubkey; | - | ||||||||||||||||||||||||||||||||||||
| 51 | - | |||||||||||||||||||||||||||||||||||||
| 52 | if (op == KEY_OP_PUBLIC
| 3237-6361 | ||||||||||||||||||||||||||||||||||||
| 53 | memcpy(pubkey, p, plen); | - | ||||||||||||||||||||||||||||||||||||
| 54 | } executed 3237 times by 1 test: else {end of blockExecuted by:
| 3237 | ||||||||||||||||||||||||||||||||||||
| 55 | privkey = key->privkey = CRYPTO_secure_malloc((((id) == 1034 || (id) == 1087) ? 32 : ((id) == 1035 ? 56 : 57)), __FILE__, 79); | - | ||||||||||||||||||||||||||||||||||||
| 56 | if (privkey ==
| 0-6361 | ||||||||||||||||||||||||||||||||||||
| 57 | ((void *)0)
| 0-6361 | ||||||||||||||||||||||||||||||||||||
| 58 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 59 | ERR_put_error(16,(266),((1|64)),__FILE__,81); | - | ||||||||||||||||||||||||||||||||||||
| 60 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
| 61 | } | - | ||||||||||||||||||||||||||||||||||||
| 62 | if (op == KEY_OP_KEYGEN
| 88-6273 | ||||||||||||||||||||||||||||||||||||
| 63 | if (RAND_priv_bytes(privkey, (((id) == 1034 || (id) == 1087) ? 32 : ((id) == 1035 ? 56 : 57))) <= 0
| 0-6273 | ||||||||||||||||||||||||||||||||||||
| 64 | CRYPTO_secure_free(privkey, __FILE__, 86); | - | ||||||||||||||||||||||||||||||||||||
| 65 | key->privkey = | - | ||||||||||||||||||||||||||||||||||||
| 66 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 67 | ; | - | ||||||||||||||||||||||||||||||||||||
| 68 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||||||||||||||
| 69 | } | - | ||||||||||||||||||||||||||||||||||||
| 70 | if (id == 1034
| 53-6220 | ||||||||||||||||||||||||||||||||||||
| 71 | privkey[0] &= 248; | - | ||||||||||||||||||||||||||||||||||||
| 72 | privkey[32 - 1] &= 127; | - | ||||||||||||||||||||||||||||||||||||
| 73 | privkey[32 - 1] |= 64; | - | ||||||||||||||||||||||||||||||||||||
| 74 | } executed 6220 times by 1 test: else if (id == 1035end of blockExecuted by:
| 0-6220 | ||||||||||||||||||||||||||||||||||||
| 75 | privkey[0] &= 252; | - | ||||||||||||||||||||||||||||||||||||
| 76 | privkey[56 - 1] |= 128; | - | ||||||||||||||||||||||||||||||||||||
| 77 | } executed 53 times by 1 test: end of blockExecuted by:
| 53 | ||||||||||||||||||||||||||||||||||||
| 78 | } executed 6273 times by 1 test: else {end of blockExecuted by:
| 6273 | ||||||||||||||||||||||||||||||||||||
| 79 | memcpy(privkey, p, (((id) == 1034 || (id) == 1087) ? 32 : ((id) == 1035 ? 56 : 57))); | - | ||||||||||||||||||||||||||||||||||||
| 80 | } executed 88 times by 1 test: end of blockExecuted by:
| 88 | ||||||||||||||||||||||||||||||||||||
| 81 | switch (id) { | - | ||||||||||||||||||||||||||||||||||||
| 82 | case executed 6229 times by 1 test: 1034:case 1034:Executed by:
executed 6229 times by 1 test: case 1034:Executed by:
| 6229 | ||||||||||||||||||||||||||||||||||||
| 83 | X25519_public_from_private(pubkey, privkey); | - | ||||||||||||||||||||||||||||||||||||
| 84 | break; executed 6229 times by 1 test: break;Executed by:
| 6229 | ||||||||||||||||||||||||||||||||||||
| 85 | case executed 35 times by 1 test: 1087:case 1087:Executed by:
executed 35 times by 1 test: case 1087:Executed by:
| 35 | ||||||||||||||||||||||||||||||||||||
| 86 | ED25519_public_from_private(pubkey, privkey); | - | ||||||||||||||||||||||||||||||||||||
| 87 | break; executed 35 times by 1 test: break;Executed by:
| 35 | ||||||||||||||||||||||||||||||||||||
| 88 | case executed 59 times by 1 test: 1035:case 1035:Executed by:
executed 59 times by 1 test: case 1035:Executed by:
| 59 | ||||||||||||||||||||||||||||||||||||
| 89 | X448_public_from_private(pubkey, privkey); | - | ||||||||||||||||||||||||||||||||||||
| 90 | break; executed 59 times by 1 test: break;Executed by:
| 59 | ||||||||||||||||||||||||||||||||||||
| 91 | case executed 38 times by 1 test: 1088:case 1088:Executed by:
executed 38 times by 1 test: case 1088:Executed by:
| 38 | ||||||||||||||||||||||||||||||||||||
| 92 | ED448_public_from_private(pubkey, privkey); | - | ||||||||||||||||||||||||||||||||||||
| 93 | break; executed 38 times by 1 test: break;Executed by:
| 38 | ||||||||||||||||||||||||||||||||||||
| 94 | } | - | ||||||||||||||||||||||||||||||||||||
| 95 | } executed 6361 times by 1 test: end of blockExecuted by:
| 6361 | ||||||||||||||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||||||||||||||
| 97 | EVP_PKEY_assign(pkey, id, key); | - | ||||||||||||||||||||||||||||||||||||
| 98 | return executed 9598 times by 1 test: 1;return 1;Executed by:
executed 9598 times by 1 test: return 1;Executed by:
| 9598 | ||||||||||||||||||||||||||||||||||||
| 99 | err: | - | ||||||||||||||||||||||||||||||||||||
| 100 | CRYPTO_free(key, __FILE__, 120); | - | ||||||||||||||||||||||||||||||||||||
| 101 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 102 | } | - | ||||||||||||||||||||||||||||||||||||
| 103 | - | |||||||||||||||||||||||||||||||||||||
| 104 | static int ecx_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) | - | ||||||||||||||||||||||||||||||||||||
| 105 | { | - | ||||||||||||||||||||||||||||||||||||
| 106 | const ECX_KEY *ecxkey = pkey->pkey.ecx; | - | ||||||||||||||||||||||||||||||||||||
| 107 | unsigned char *penc; | - | ||||||||||||||||||||||||||||||||||||
| 108 | - | |||||||||||||||||||||||||||||||||||||
| 109 | if (ecxkey ==
| 0 | ||||||||||||||||||||||||||||||||||||
| 110 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||
| 111 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 112 | ERR_put_error(16,(268),(116),__FILE__,130); | - | ||||||||||||||||||||||||||||||||||||
| 113 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 114 | } | - | ||||||||||||||||||||||||||||||||||||
| 115 | - | |||||||||||||||||||||||||||||||||||||
| 116 | penc = CRYPTO_memdup((ecxkey->pubkey), ((((pkey)->ameth->pkey_id) == 1034 || ((pkey)->ameth->pkey_id) == 1087) ? 32 : (((pkey)->ameth->pkey_id) == 1035 ? 56 : 57)), __FILE__, 134); | - | ||||||||||||||||||||||||||||||||||||
| 117 | if (penc ==
| 0 | ||||||||||||||||||||||||||||||||||||
| 118 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||
| 119 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 120 | ERR_put_error(16,(268),((1|64)),__FILE__,136); | - | ||||||||||||||||||||||||||||||||||||
| 121 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 122 | } | - | ||||||||||||||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||||||||||||||
| 124 | if (!X509_PUBKEY_set0_param(pk, OBJ_nid2obj(pkey->ameth->pkey_id),
| 0 | ||||||||||||||||||||||||||||||||||||
| 125 | -1,
| 0 | ||||||||||||||||||||||||||||||||||||
| 126 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||
| 127 | , penc, ((((pkey)->ameth->pkey_id) == 1034 || ((pkey)->ameth->pkey_id) == 1087) ? 32 : (((pkey)->ameth->pkey_id) == 1035 ? 56 : 57)))
| 0 | ||||||||||||||||||||||||||||||||||||
| 128 | CRYPTO_free(penc, __FILE__, 142); | - | ||||||||||||||||||||||||||||||||||||
| 129 | ERR_put_error(16,(268),((1|64)),__FILE__,143); | - | ||||||||||||||||||||||||||||||||||||
| 130 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 131 | } | - | ||||||||||||||||||||||||||||||||||||
| 132 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 133 | } | - | ||||||||||||||||||||||||||||||||||||
| 134 | - | |||||||||||||||||||||||||||||||||||||
| 135 | static int ecx_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey) | - | ||||||||||||||||||||||||||||||||||||
| 136 | { | - | ||||||||||||||||||||||||||||||||||||
| 137 | const unsigned char *p; | - | ||||||||||||||||||||||||||||||||||||
| 138 | int pklen; | - | ||||||||||||||||||||||||||||||||||||
| 139 | X509_ALGOR *palg; | - | ||||||||||||||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||||||||||||||
| 141 | if (!X509_PUBKEY_get0_param(
| 0-118 | ||||||||||||||||||||||||||||||||||||
| 142 | ((void *)0)
| 0-118 | ||||||||||||||||||||||||||||||||||||
| 143 | , &p, &pklen, &palg, pubkey)
| 0-118 | ||||||||||||||||||||||||||||||||||||
| 144 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 145 | return executed 118 times by 1 test: ecx_key_op(pkey, pkey->ameth->pkey_id, palg, p, pklen,return ecx_key_op(pkey, pkey->ameth->pkey_id, palg, p, pklen, KEY_OP_PUBLIC);Executed by:
executed 118 times by 1 test: return ecx_key_op(pkey, pkey->ameth->pkey_id, palg, p, pklen, KEY_OP_PUBLIC);Executed by:
| 118 | ||||||||||||||||||||||||||||||||||||
| 146 | KEY_OP_PUBLIC); executed 118 times by 1 test: return ecx_key_op(pkey, pkey->ameth->pkey_id, palg, p, pklen, KEY_OP_PUBLIC);Executed by:
| 118 | ||||||||||||||||||||||||||||||||||||
| 147 | } | - | ||||||||||||||||||||||||||||||||||||
| 148 | - | |||||||||||||||||||||||||||||||||||||
| 149 | static int ecx_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b) | - | ||||||||||||||||||||||||||||||||||||
| 150 | { | - | ||||||||||||||||||||||||||||||||||||
| 151 | const ECX_KEY *akey = a->pkey.ecx; | - | ||||||||||||||||||||||||||||||||||||
| 152 | const ECX_KEY *bkey = b->pkey.ecx; | - | ||||||||||||||||||||||||||||||||||||
| 153 | - | |||||||||||||||||||||||||||||||||||||
| 154 | if (akey ==
| 0-82 | ||||||||||||||||||||||||||||||||||||
| 155 | ((void *)0)
| 0-82 | ||||||||||||||||||||||||||||||||||||
| 156 | || bkey ==
| 0-82 | ||||||||||||||||||||||||||||||||||||
| 157 | ((void *)0)
| 0-82 | ||||||||||||||||||||||||||||||||||||
| 158 | ) | - | ||||||||||||||||||||||||||||||||||||
| 159 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||||||||||||||||||||||||||
| 160 | - | |||||||||||||||||||||||||||||||||||||
| 161 | return executed 82 times by 1 test: CRYPTO_memcmp(akey->pubkey, bkey->pubkey, ((((a)->ameth->pkey_id) == 1034 || ((a)->ameth->pkey_id) == 1087) ? 32 : (((a)->ameth->pkey_id) == 1035 ? 56 : 57))) == 0;return CRYPTO_memcmp(akey->pubkey, bkey->pubkey, ((((a)->ameth->pkey_id) == 1034 || ((a)->ameth->pkey_id) == 1087) ? 32 : (((a)->ameth->pkey_id) == 1035 ? 56 : 57))) == 0;Executed by:
executed 82 times by 1 test: return CRYPTO_memcmp(akey->pubkey, bkey->pubkey, ((((a)->ameth->pkey_id) == 1034 || ((a)->ameth->pkey_id) == 1087) ? 32 : (((a)->ameth->pkey_id) == 1035 ? 56 : 57))) == 0;Executed by:
| 82 | ||||||||||||||||||||||||||||||||||||
| 162 | } | - | ||||||||||||||||||||||||||||||||||||
| 163 | - | |||||||||||||||||||||||||||||||||||||
| 164 | static int ecx_priv_decode(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8) | - | ||||||||||||||||||||||||||||||||||||
| 165 | { | - | ||||||||||||||||||||||||||||||||||||
| 166 | const unsigned char *p; | - | ||||||||||||||||||||||||||||||||||||
| 167 | int plen; | - | ||||||||||||||||||||||||||||||||||||
| 168 | ASN1_OCTET_STRING *oct = | - | ||||||||||||||||||||||||||||||||||||
| 169 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 170 | ; | - | ||||||||||||||||||||||||||||||||||||
| 171 | const X509_ALGOR *palg; | - | ||||||||||||||||||||||||||||||||||||
| 172 | int rv; | - | ||||||||||||||||||||||||||||||||||||
| 173 | - | |||||||||||||||||||||||||||||||||||||
| 174 | if (!PKCS8_pkey_get0(
| 0-76 | ||||||||||||||||||||||||||||||||||||
| 175 | ((void *)0)
| 0-76 | ||||||||||||||||||||||||||||||||||||
| 176 | , &p, &plen, &palg, p8)
| 0-76 | ||||||||||||||||||||||||||||||||||||
| 177 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 178 | - | |||||||||||||||||||||||||||||||||||||
| 179 | oct = d2i_ASN1_OCTET_STRING( | - | ||||||||||||||||||||||||||||||||||||
| 180 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 181 | , &p, plen); | - | ||||||||||||||||||||||||||||||||||||
| 182 | if (oct ==
| 1-75 | ||||||||||||||||||||||||||||||||||||
| 183 | ((void *)0)
| 1-75 | ||||||||||||||||||||||||||||||||||||
| 184 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 185 | p = | - | ||||||||||||||||||||||||||||||||||||
| 186 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 187 | ; | - | ||||||||||||||||||||||||||||||||||||
| 188 | plen = 0; | - | ||||||||||||||||||||||||||||||||||||
| 189 | } executed 1 time by 1 test: else {end of blockExecuted by:
| 1 | ||||||||||||||||||||||||||||||||||||
| 190 | p = ASN1_STRING_get0_data(oct); | - | ||||||||||||||||||||||||||||||||||||
| 191 | plen = ASN1_STRING_length(oct); | - | ||||||||||||||||||||||||||||||||||||
| 192 | } executed 75 times by 1 test: end of blockExecuted by:
| 75 | ||||||||||||||||||||||||||||||||||||
| 193 | - | |||||||||||||||||||||||||||||||||||||
| 194 | rv = ecx_key_op(pkey, pkey->ameth->pkey_id, palg, p, plen, KEY_OP_PRIVATE); | - | ||||||||||||||||||||||||||||||||||||
| 195 | ASN1_OCTET_STRING_free(oct); | - | ||||||||||||||||||||||||||||||||||||
| 196 | return executed 76 times by 1 test: rv;return rv;Executed by:
executed 76 times by 1 test: return rv;Executed by:
| 76 | ||||||||||||||||||||||||||||||||||||
| 197 | } | - | ||||||||||||||||||||||||||||||||||||
| 198 | - | |||||||||||||||||||||||||||||||||||||
| 199 | static int ecx_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) | - | ||||||||||||||||||||||||||||||||||||
| 200 | { | - | ||||||||||||||||||||||||||||||||||||
| 201 | const ECX_KEY *ecxkey = pkey->pkey.ecx; | - | ||||||||||||||||||||||||||||||||||||
| 202 | ASN1_OCTET_STRING oct; | - | ||||||||||||||||||||||||||||||||||||
| 203 | unsigned char *penc = | - | ||||||||||||||||||||||||||||||||||||
| 204 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 205 | ; | - | ||||||||||||||||||||||||||||||||||||
| 206 | int penclen; | - | ||||||||||||||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||||||||||||||
| 208 | if (ecxkey ==
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 209 | ((void *)0)
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 210 | || ecxkey->privkey ==
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 211 | ((void *)0)
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 212 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 213 | ERR_put_error(16,(267),(123),__FILE__,205); | - | ||||||||||||||||||||||||||||||||||||
| 214 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 215 | } | - | ||||||||||||||||||||||||||||||||||||
| 216 | - | |||||||||||||||||||||||||||||||||||||
| 217 | oct.data = ecxkey->privkey; | - | ||||||||||||||||||||||||||||||||||||
| 218 | oct.length = ((((
| 1-3 | ||||||||||||||||||||||||||||||||||||
| 219 | oct.flags = 0; | - | ||||||||||||||||||||||||||||||||||||
| 220 | - | |||||||||||||||||||||||||||||||||||||
| 221 | penclen = i2d_ASN1_OCTET_STRING(&oct, &penc); | - | ||||||||||||||||||||||||||||||||||||
| 222 | if (penclen < 0
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 223 | ERR_put_error(16,(267),((1|64)),__FILE__,215); | - | ||||||||||||||||||||||||||||||||||||
| 224 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 225 | } | - | ||||||||||||||||||||||||||||||||||||
| 226 | - | |||||||||||||||||||||||||||||||||||||
| 227 | if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(pkey->ameth->pkey_id), 0,
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 228 | -1,
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 229 | ((void *)0)
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 230 | , penc, penclen)
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 231 | CRYPTO_clear_free(penc, penclen, __FILE__, 221); | - | ||||||||||||||||||||||||||||||||||||
| 232 | ERR_put_error(16,(267),((1|64)),__FILE__,222); | - | ||||||||||||||||||||||||||||||||||||
| 233 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 234 | } | - | ||||||||||||||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||||||||||||||
| 236 | return executed 4 times by 1 test: 1;return 1;Executed by:
executed 4 times by 1 test: return 1;Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||
| 237 | } | - | ||||||||||||||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||||||||||||||
| 239 | static int ecx_size(const EVP_PKEY *pkey) | - | ||||||||||||||||||||||||||||||||||||
| 240 | { | - | ||||||||||||||||||||||||||||||||||||
| 241 | return never executed: ((((return ((((pkey)->ameth->pkey_id) == 1034 || ((pkey)->ameth->pkey_id) == 1087) ? 32 : (((pkey)->ameth->pkey_id) == 1035 ? 56 : 57));
never executed: return ((((pkey)->ameth->pkey_id) == 1034 || ((pkey)->ameth->pkey_id) == 1087) ? 32 : (((pkey)->ameth->pkey_id) == 1035 ? 56 : 57)); | 0 | ||||||||||||||||||||||||||||||||||||
| 242 | } | - | ||||||||||||||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||||||||||||||
| 244 | static int ecx_bits(const EVP_PKEY *pkey) | - | ||||||||||||||||||||||||||||||||||||
| 245 | { | - | ||||||||||||||||||||||||||||||||||||
| 246 | if (((
| 0-121 | ||||||||||||||||||||||||||||||||||||
| 247 | return executed 121 times by 1 test: 253;return 253;Executed by:
executed 121 times by 1 test: return 253;Executed by:
| 121 | ||||||||||||||||||||||||||||||||||||
| 248 | } else if(((
| 0 | ||||||||||||||||||||||||||||||||||||
| 249 | return never executed: 448;return 448;never executed: return 448; | 0 | ||||||||||||||||||||||||||||||||||||
| 250 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 251 | return never executed: 456;return 456;never executed: return 456; | 0 | ||||||||||||||||||||||||||||||||||||
| 252 | } | - | ||||||||||||||||||||||||||||||||||||
| 253 | } | - | ||||||||||||||||||||||||||||||||||||
| 254 | - | |||||||||||||||||||||||||||||||||||||
| 255 | static int ecx_security_bits(const EVP_PKEY *pkey) | - | ||||||||||||||||||||||||||||||||||||
| 256 | { | - | ||||||||||||||||||||||||||||||||||||
| 257 | if (((
| 1-75 | ||||||||||||||||||||||||||||||||||||
| 258 | return executed 39 times by 1 test: 128;return 128;Executed by:
executed 39 times by 1 test: return 128;Executed by:
| 39 | ||||||||||||||||||||||||||||||||||||
| 259 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 260 | return executed 37 times by 1 test: 224;return 224;Executed by:
executed 37 times by 1 test: return 224;Executed by:
| 37 | ||||||||||||||||||||||||||||||||||||
| 261 | } | - | ||||||||||||||||||||||||||||||||||||
| 262 | } | - | ||||||||||||||||||||||||||||||||||||
| 263 | - | |||||||||||||||||||||||||||||||||||||
| 264 | static void ecx_free(EVP_PKEY *pkey) | - | ||||||||||||||||||||||||||||||||||||
| 265 | { | - | ||||||||||||||||||||||||||||||||||||
| 266 | if (pkey->pkey.ecx !=
| 22-9598 | ||||||||||||||||||||||||||||||||||||
| 267 | ((void *)0)
| 22-9598 | ||||||||||||||||||||||||||||||||||||
| 268 | ) | - | ||||||||||||||||||||||||||||||||||||
| 269 | CRYPTO_secure_clear_free(pkey->pkey.ecx->privkey, ((((pkey)->ameth->pkey_id) == 1034 || ((pkey)->ameth->pkey_id) == 1087) ? 32 : (((pkey)->ameth->pkey_id) == 1035 ? 56 : 57)), __FILE__, 257); executed 9598 times by 1 test: CRYPTO_secure_clear_free(pkey->pkey.ecx->privkey, ((((pkey)->ameth->pkey_id) == 1034 || ((pkey)->ameth->pkey_id) == 1087) ? 32 : (((pkey)->ameth->pkey_id) == 1035 ? 56 : 57)), __FILE__, 257);Executed by:
| 9598 | ||||||||||||||||||||||||||||||||||||
| 270 | CRYPTO_free(pkey->pkey.ecx, __FILE__, 258); | - | ||||||||||||||||||||||||||||||||||||
| 271 | } executed 9620 times by 1 test: end of blockExecuted by:
| 9620 | ||||||||||||||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||||||||||||||
| 273 | - | |||||||||||||||||||||||||||||||||||||
| 274 | static int ecx_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b) | - | ||||||||||||||||||||||||||||||||||||
| 275 | { | - | ||||||||||||||||||||||||||||||||||||
| 276 | return executed 3917 times by 1 test: 1;return 1;Executed by:
executed 3917 times by 1 test: return 1;Executed by:
| 3917 | ||||||||||||||||||||||||||||||||||||
| 277 | } | - | ||||||||||||||||||||||||||||||||||||
| 278 | - | |||||||||||||||||||||||||||||||||||||
| 279 | static int ecx_key_print(BIO *bp, const EVP_PKEY *pkey, int indent, | - | ||||||||||||||||||||||||||||||||||||
| 280 | ASN1_PCTX *ctx, ecx_key_op_t op) | - | ||||||||||||||||||||||||||||||||||||
| 281 | { | - | ||||||||||||||||||||||||||||||||||||
| 282 | const ECX_KEY *ecxkey = pkey->pkey.ecx; | - | ||||||||||||||||||||||||||||||||||||
| 283 | const char *nm = OBJ_nid2ln(pkey->ameth->pkey_id); | - | ||||||||||||||||||||||||||||||||||||
| 284 | - | |||||||||||||||||||||||||||||||||||||
| 285 | if (op == KEY_OP_PRIVATE
| 3-4 | ||||||||||||||||||||||||||||||||||||
| 286 | if (ecxkey ==
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 287 | ((void *)0)
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 288 | || ecxkey->privkey ==
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 289 | ((void *)0)
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 290 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 291 | if (BIO_printf(bp, "%*s<INVALID PRIVATE KEY>\n", indent, "") <= 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 292 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 293 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 294 | } | - | ||||||||||||||||||||||||||||||||||||
| 295 | if (BIO_printf(bp, "%*s%s Private-Key:\n", indent, "", nm) <= 0
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 296 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 297 | if (BIO_printf(bp, "%*spriv:\n", indent, "") <= 0
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 298 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 299 | if (ASN1_buf_print(bp, ecxkey->privkey, ((((pkey)->ameth->pkey_id) == 1034 || ((pkey)->ameth->pkey_id) == 1087) ? 32 : (((pkey)->ameth->pkey_id) == 1035 ? 56 : 57)),
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 300 | indent + 4) == 0
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 301 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 302 | } executed 4 times by 1 test: else {end of blockExecuted by:
| 4 | ||||||||||||||||||||||||||||||||||||
| 303 | if (ecxkey ==
| 0-3 | ||||||||||||||||||||||||||||||||||||
| 304 | ((void *)0)
| 0-3 | ||||||||||||||||||||||||||||||||||||
| 305 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 306 | if (BIO_printf(bp, "%*s<INVALID PUBLIC KEY>\n", indent, "") <= 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 307 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 308 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 309 | } | - | ||||||||||||||||||||||||||||||||||||
| 310 | if (BIO_printf(bp, "%*s%s Public-Key:\n", indent, "", nm) <= 0
| 0-3 | ||||||||||||||||||||||||||||||||||||
| 311 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 312 | } executed 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||||||||||||||||||||||||||
| 313 | if (BIO_printf(bp, "%*spub:\n", indent, "") <= 0
| 0-7 | ||||||||||||||||||||||||||||||||||||
| 314 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 315 | - | |||||||||||||||||||||||||||||||||||||
| 316 | if (ASN1_buf_print(bp, ecxkey->pubkey, ((((pkey)->ameth->pkey_id) == 1034 || ((pkey)->ameth->pkey_id) == 1087) ? 32 : (((pkey)->ameth->pkey_id) == 1035 ? 56 : 57)),
| 0-7 | ||||||||||||||||||||||||||||||||||||
| 317 | indent + 4) == 0
| 0-7 | ||||||||||||||||||||||||||||||||||||
| 318 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 319 | return executed 7 times by 1 test: 1;return 1;Executed by:
executed 7 times by 1 test: return 1;Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||
| 320 | } | - | ||||||||||||||||||||||||||||||||||||
| 321 | - | |||||||||||||||||||||||||||||||||||||
| 322 | static int ecx_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent, | - | ||||||||||||||||||||||||||||||||||||
| 323 | ASN1_PCTX *ctx) | - | ||||||||||||||||||||||||||||||||||||
| 324 | { | - | ||||||||||||||||||||||||||||||||||||
| 325 | return executed 4 times by 1 test: ecx_key_print(bp, pkey, indent, ctx, KEY_OP_PRIVATE);return ecx_key_print(bp, pkey, indent, ctx, KEY_OP_PRIVATE);Executed by:
executed 4 times by 1 test: return ecx_key_print(bp, pkey, indent, ctx, KEY_OP_PRIVATE);Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||
| 326 | } | - | ||||||||||||||||||||||||||||||||||||
| 327 | - | |||||||||||||||||||||||||||||||||||||
| 328 | static int ecx_pub_print(BIO *bp, const EVP_PKEY *pkey, int indent, | - | ||||||||||||||||||||||||||||||||||||
| 329 | ASN1_PCTX *ctx) | - | ||||||||||||||||||||||||||||||||||||
| 330 | { | - | ||||||||||||||||||||||||||||||||||||
| 331 | return executed 3 times by 1 test: ecx_key_print(bp, pkey, indent, ctx, KEY_OP_PUBLIC);return ecx_key_print(bp, pkey, indent, ctx, KEY_OP_PUBLIC);Executed by:
executed 3 times by 1 test: return ecx_key_print(bp, pkey, indent, ctx, KEY_OP_PUBLIC);Executed by:
| 3 | ||||||||||||||||||||||||||||||||||||
| 332 | } | - | ||||||||||||||||||||||||||||||||||||
| 333 | - | |||||||||||||||||||||||||||||||||||||
| 334 | static int ecx_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) | - | ||||||||||||||||||||||||||||||||||||
| 335 | { | - | ||||||||||||||||||||||||||||||||||||
| 336 | switch (op) { | - | ||||||||||||||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||||||||||||||
| 338 | case executed 3125 times by 1 test: 0x9:case 0x9:Executed by:
executed 3125 times by 1 test: case 0x9:Executed by:
| 3125 | ||||||||||||||||||||||||||||||||||||
| 339 | return executed 3125 times by 1 test: ecx_key_op(pkey, pkey->ameth->pkey_id, return ecx_key_op(pkey, pkey->ameth->pkey_id, ((void *)0) , arg2, arg1, KEY_OP_PUBLIC);Executed by:
executed 3125 times by 1 test: return ecx_key_op(pkey, pkey->ameth->pkey_id, ((void *)0) , arg2, arg1, KEY_OP_PUBLIC);Executed by:
| 3125 | ||||||||||||||||||||||||||||||||||||
| 340 | ((void *)0) executed 3125 times by 1 test: return ecx_key_op(pkey, pkey->ameth->pkey_id, ((void *)0) , arg2, arg1, KEY_OP_PUBLIC);Executed by:
| 3125 | ||||||||||||||||||||||||||||||||||||
| 341 | , arg2, arg1, executed 3125 times by 1 test: return ecx_key_op(pkey, pkey->ameth->pkey_id, ((void *)0) , arg2, arg1, KEY_OP_PUBLIC);Executed by:
| 3125 | ||||||||||||||||||||||||||||||||||||
| 342 | KEY_OP_PUBLIC); executed 3125 times by 1 test: return ecx_key_op(pkey, pkey->ameth->pkey_id, ((void *)0) , arg2, arg1, KEY_OP_PUBLIC);Executed by:
| 3125 | ||||||||||||||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||||||||||||||
| 344 | case executed 5759 times by 1 test: 0xa:case 0xa:Executed by:
executed 5759 times by 1 test: case 0xa:Executed by:
| 5759 | ||||||||||||||||||||||||||||||||||||
| 345 | if (pkey->pkey.ecx !=
| 0-5759 | ||||||||||||||||||||||||||||||||||||
| 346 | ((void *)0)
| 0-5759 | ||||||||||||||||||||||||||||||||||||
| 347 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 348 | unsigned char **ppt = arg2; | - | ||||||||||||||||||||||||||||||||||||
| 349 | - | |||||||||||||||||||||||||||||||||||||
| 350 | *ppt = CRYPTO_memdup((pkey->pkey.ecx->pubkey), ((((pkey)->ameth->pkey_id) == 1034 || ((pkey)->ameth->pkey_id) == 1087) ? 32 : (((pkey)->ameth->pkey_id) == 1035 ? 56 : 57)), __FILE__, 328); | - | ||||||||||||||||||||||||||||||||||||
| 351 | if (*
| 0-5759 | ||||||||||||||||||||||||||||||||||||
| 352 | ((void *)0)
| 0-5759 | ||||||||||||||||||||||||||||||||||||
| 353 | ) | - | ||||||||||||||||||||||||||||||||||||
| 354 | return executed 5759 times by 1 test: ((((return ((((pkey)->ameth->pkey_id) == 1034 || ((pkey)->ameth->pkey_id) == 1087) ? 32 : (((pkey)->ameth->pkey_id) == 1035 ? 56 : 57));Executed by:
executed 5759 times by 1 test: return ((((pkey)->ameth->pkey_id) == 1034 || ((pkey)->ameth->pkey_id) == 1087) ? 32 : (((pkey)->ameth->pkey_id) == 1035 ? 56 : 57));Executed by:
| 0-5759 | ||||||||||||||||||||||||||||||||||||
| 355 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 356 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 357 | - | |||||||||||||||||||||||||||||||||||||
| 358 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 359 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||||||||||||||||||||||||||
| 360 | - | |||||||||||||||||||||||||||||||||||||
| 361 | } | - | ||||||||||||||||||||||||||||||||||||
| 362 | } | - | ||||||||||||||||||||||||||||||||||||
| 363 | - | |||||||||||||||||||||||||||||||||||||
| 364 | static int ecd_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) | - | ||||||||||||||||||||||||||||||||||||
| 365 | { | - | ||||||||||||||||||||||||||||||||||||
| 366 | switch (op) { | - | ||||||||||||||||||||||||||||||||||||
| 367 | case never executed: 0x3:case 0x3:never executed: case 0x3: | 0 | ||||||||||||||||||||||||||||||||||||
| 368 | - | |||||||||||||||||||||||||||||||||||||
| 369 | *(int *)arg2 = 0; | - | ||||||||||||||||||||||||||||||||||||
| 370 | return never executed: 2;return 2;never executed: return 2; | 0 | ||||||||||||||||||||||||||||||||||||
| 371 | - | |||||||||||||||||||||||||||||||||||||
| 372 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 373 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||||||||||||||||||||||||||
| 374 | - | |||||||||||||||||||||||||||||||||||||
| 375 | } | - | ||||||||||||||||||||||||||||||||||||
| 376 | } | - | ||||||||||||||||||||||||||||||||||||
| 377 | - | |||||||||||||||||||||||||||||||||||||
| 378 | static int ecx_set_priv_key(EVP_PKEY *pkey, const unsigned char *priv, | - | ||||||||||||||||||||||||||||||||||||
| 379 | size_t len) | - | ||||||||||||||||||||||||||||||||||||
| 380 | { | - | ||||||||||||||||||||||||||||||||||||
| 381 | return executed 13 times by 1 test: ecx_key_op(pkey, pkey->ameth->pkey_id, return ecx_key_op(pkey, pkey->ameth->pkey_id, ((void *)0) , priv, len, KEY_OP_PRIVATE);Executed by:
executed 13 times by 1 test: return ecx_key_op(pkey, pkey->ameth->pkey_id, ((void *)0) , priv, len, KEY_OP_PRIVATE);Executed by:
| 13 | ||||||||||||||||||||||||||||||||||||
| 382 | ((void *)0) executed 13 times by 1 test: return ecx_key_op(pkey, pkey->ameth->pkey_id, ((void *)0) , priv, len, KEY_OP_PRIVATE);Executed by:
| 13 | ||||||||||||||||||||||||||||||||||||
| 383 | , priv, len, executed 13 times by 1 test: return ecx_key_op(pkey, pkey->ameth->pkey_id, ((void *)0) , priv, len, KEY_OP_PRIVATE);Executed by:
| 13 | ||||||||||||||||||||||||||||||||||||
| 384 | KEY_OP_PRIVATE); executed 13 times by 1 test: return ecx_key_op(pkey, pkey->ameth->pkey_id, ((void *)0) , priv, len, KEY_OP_PRIVATE);Executed by:
| 13 | ||||||||||||||||||||||||||||||||||||
| 385 | } | - | ||||||||||||||||||||||||||||||||||||
| 386 | - | |||||||||||||||||||||||||||||||||||||
| 387 | static int ecx_set_pub_key(EVP_PKEY *pkey, const unsigned char *pub, size_t len) | - | ||||||||||||||||||||||||||||||||||||
| 388 | { | - | ||||||||||||||||||||||||||||||||||||
| 389 | return executed 15 times by 1 test: ecx_key_op(pkey, pkey->ameth->pkey_id, return ecx_key_op(pkey, pkey->ameth->pkey_id, ((void *)0) , pub, len, KEY_OP_PUBLIC);Executed by:
executed 15 times by 1 test: return ecx_key_op(pkey, pkey->ameth->pkey_id, ((void *)0) , pub, len, KEY_OP_PUBLIC);Executed by:
| 15 | ||||||||||||||||||||||||||||||||||||
| 390 | ((void *)0) executed 15 times by 1 test: return ecx_key_op(pkey, pkey->ameth->pkey_id, ((void *)0) , pub, len, KEY_OP_PUBLIC);Executed by:
| 15 | ||||||||||||||||||||||||||||||||||||
| 391 | , pub, len, executed 15 times by 1 test: return ecx_key_op(pkey, pkey->ameth->pkey_id, ((void *)0) , pub, len, KEY_OP_PUBLIC);Executed by:
| 15 | ||||||||||||||||||||||||||||||||||||
| 392 | KEY_OP_PUBLIC); executed 15 times by 1 test: return ecx_key_op(pkey, pkey->ameth->pkey_id, ((void *)0) , pub, len, KEY_OP_PUBLIC);Executed by:
| 15 | ||||||||||||||||||||||||||||||||||||
| 393 | } | - | ||||||||||||||||||||||||||||||||||||
| 394 | - | |||||||||||||||||||||||||||||||||||||
| 395 | static int ecx_get_priv_key(const EVP_PKEY *pkey, unsigned char *priv, | - | ||||||||||||||||||||||||||||||||||||
| 396 | size_t *len) | - | ||||||||||||||||||||||||||||||||||||
| 397 | { | - | ||||||||||||||||||||||||||||||||||||
| 398 | const ECX_KEY *key = pkey->pkey.ecx; | - | ||||||||||||||||||||||||||||||||||||
| 399 | - | |||||||||||||||||||||||||||||||||||||
| 400 | if (priv ==
| 4 | ||||||||||||||||||||||||||||||||||||
| 401 | ((void *)0)
| 4 | ||||||||||||||||||||||||||||||||||||
| 402 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 403 | *len = (((
| 1-3 | ||||||||||||||||||||||||||||||||||||
| 404 | return executed 4 times by 1 test: 1;return 1;Executed by:
executed 4 times by 1 test: return 1;Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||
| 405 | } | - | ||||||||||||||||||||||||||||||||||||
| 406 | - | |||||||||||||||||||||||||||||||||||||
| 407 | if (key ==
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 408 | ((void *)0)
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 409 | - | |||||||||||||||||||||||||||||||||||||
| 410 | || key->privkey ==
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 411 | ((void *)0)
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 412 | - | |||||||||||||||||||||||||||||||||||||
| 413 | || *
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 414 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 415 | - | |||||||||||||||||||||||||||||||||||||
| 416 | *len = (((
| 1-3 | ||||||||||||||||||||||||||||||||||||
| 417 | memcpy(priv, key->privkey, *len); | - | ||||||||||||||||||||||||||||||||||||
| 418 | - | |||||||||||||||||||||||||||||||||||||
| 419 | return executed 4 times by 1 test: 1;return 1;Executed by:
executed 4 times by 1 test: return 1;Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||
| 420 | } | - | ||||||||||||||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||||||||||||||
| 422 | static int ecx_get_pub_key(const EVP_PKEY *pkey, unsigned char *pub, | - | ||||||||||||||||||||||||||||||||||||
| 423 | size_t *len) | - | ||||||||||||||||||||||||||||||||||||
| 424 | { | - | ||||||||||||||||||||||||||||||||||||
| 425 | const ECX_KEY *key = pkey->pkey.ecx; | - | ||||||||||||||||||||||||||||||||||||
| 426 | - | |||||||||||||||||||||||||||||||||||||
| 427 | if (pub ==
| 4 | ||||||||||||||||||||||||||||||||||||
| 428 | ((void *)0)
| 4 | ||||||||||||||||||||||||||||||||||||
| 429 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 430 | *len = (((
| 1-3 | ||||||||||||||||||||||||||||||||||||
| 431 | return executed 4 times by 1 test: 1;return 1;Executed by:
executed 4 times by 1 test: return 1;Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||
| 432 | } | - | ||||||||||||||||||||||||||||||||||||
| 433 | - | |||||||||||||||||||||||||||||||||||||
| 434 | if (key ==
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 435 | ((void *)0)
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 436 | - | |||||||||||||||||||||||||||||||||||||
| 437 | || *
| 0-4 | ||||||||||||||||||||||||||||||||||||
| 438 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 439 | - | |||||||||||||||||||||||||||||||||||||
| 440 | *len = (((
| 1-3 | ||||||||||||||||||||||||||||||||||||
| 441 | memcpy(pub, key->pubkey, *len); | - | ||||||||||||||||||||||||||||||||||||
| 442 | - | |||||||||||||||||||||||||||||||||||||
| 443 | return executed 4 times by 1 test: 1;return 1;Executed by:
executed 4 times by 1 test: return 1;Executed by:
| 4 | ||||||||||||||||||||||||||||||||||||
| 444 | } | - | ||||||||||||||||||||||||||||||||||||
| 445 | - | |||||||||||||||||||||||||||||||||||||
| 446 | const EVP_PKEY_ASN1_METHOD ecx25519_asn1_meth = { | - | ||||||||||||||||||||||||||||||||||||
| 447 | 1034, | - | ||||||||||||||||||||||||||||||||||||
| 448 | 1034, | - | ||||||||||||||||||||||||||||||||||||
| 449 | 0, | - | ||||||||||||||||||||||||||||||||||||
| 450 | "X25519", | - | ||||||||||||||||||||||||||||||||||||
| 451 | "OpenSSL X25519 algorithm", | - | ||||||||||||||||||||||||||||||||||||
| 452 | - | |||||||||||||||||||||||||||||||||||||
| 453 | ecx_pub_decode, | - | ||||||||||||||||||||||||||||||||||||
| 454 | ecx_pub_encode, | - | ||||||||||||||||||||||||||||||||||||
| 455 | ecx_pub_cmp, | - | ||||||||||||||||||||||||||||||||||||
| 456 | ecx_pub_print, | - | ||||||||||||||||||||||||||||||||||||
| 457 | - | |||||||||||||||||||||||||||||||||||||
| 458 | ecx_priv_decode, | - | ||||||||||||||||||||||||||||||||||||
| 459 | ecx_priv_encode, | - | ||||||||||||||||||||||||||||||||||||
| 460 | ecx_priv_print, | - | ||||||||||||||||||||||||||||||||||||
| 461 | - | |||||||||||||||||||||||||||||||||||||
| 462 | ecx_size, | - | ||||||||||||||||||||||||||||||||||||
| 463 | ecx_bits, | - | ||||||||||||||||||||||||||||||||||||
| 464 | ecx_security_bits, | - | ||||||||||||||||||||||||||||||||||||
| 465 | - | |||||||||||||||||||||||||||||||||||||
| 466 | 0, 0, 0, 0, | - | ||||||||||||||||||||||||||||||||||||
| 467 | ecx_cmp_parameters, | - | ||||||||||||||||||||||||||||||||||||
| 468 | 0, 0, | - | ||||||||||||||||||||||||||||||||||||
| 469 | - | |||||||||||||||||||||||||||||||||||||
| 470 | ecx_free, | - | ||||||||||||||||||||||||||||||||||||
| 471 | ecx_ctrl, | - | ||||||||||||||||||||||||||||||||||||
| 472 | - | |||||||||||||||||||||||||||||||||||||
| 473 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 474 | , | - | ||||||||||||||||||||||||||||||||||||
| 475 | - | |||||||||||||||||||||||||||||||||||||
| 476 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 477 | , | - | ||||||||||||||||||||||||||||||||||||
| 478 | - | |||||||||||||||||||||||||||||||||||||
| 479 | - | |||||||||||||||||||||||||||||||||||||
| 480 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 481 | , | - | ||||||||||||||||||||||||||||||||||||
| 482 | - | |||||||||||||||||||||||||||||||||||||
| 483 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 484 | , | - | ||||||||||||||||||||||||||||||||||||
| 485 | - | |||||||||||||||||||||||||||||||||||||
| 486 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 487 | , | - | ||||||||||||||||||||||||||||||||||||
| 488 | - | |||||||||||||||||||||||||||||||||||||
| 489 | - | |||||||||||||||||||||||||||||||||||||
| 490 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 491 | , | - | ||||||||||||||||||||||||||||||||||||
| 492 | - | |||||||||||||||||||||||||||||||||||||
| 493 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 494 | , | - | ||||||||||||||||||||||||||||||||||||
| 495 | - | |||||||||||||||||||||||||||||||||||||
| 496 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 497 | , | - | ||||||||||||||||||||||||||||||||||||
| 498 | - | |||||||||||||||||||||||||||||||||||||
| 499 | ecx_set_priv_key, | - | ||||||||||||||||||||||||||||||||||||
| 500 | ecx_set_pub_key, | - | ||||||||||||||||||||||||||||||||||||
| 501 | ecx_get_priv_key, | - | ||||||||||||||||||||||||||||||||||||
| 502 | ecx_get_pub_key, | - | ||||||||||||||||||||||||||||||||||||
| 503 | }; | - | ||||||||||||||||||||||||||||||||||||
| 504 | - | |||||||||||||||||||||||||||||||||||||
| 505 | const EVP_PKEY_ASN1_METHOD ecx448_asn1_meth = { | - | ||||||||||||||||||||||||||||||||||||
| 506 | 1035, | - | ||||||||||||||||||||||||||||||||||||
| 507 | 1035, | - | ||||||||||||||||||||||||||||||||||||
| 508 | 0, | - | ||||||||||||||||||||||||||||||||||||
| 509 | "X448", | - | ||||||||||||||||||||||||||||||||||||
| 510 | "OpenSSL X448 algorithm", | - | ||||||||||||||||||||||||||||||||||||
| 511 | - | |||||||||||||||||||||||||||||||||||||
| 512 | ecx_pub_decode, | - | ||||||||||||||||||||||||||||||||||||
| 513 | ecx_pub_encode, | - | ||||||||||||||||||||||||||||||||||||
| 514 | ecx_pub_cmp, | - | ||||||||||||||||||||||||||||||||||||
| 515 | ecx_pub_print, | - | ||||||||||||||||||||||||||||||||||||
| 516 | - | |||||||||||||||||||||||||||||||||||||
| 517 | ecx_priv_decode, | - | ||||||||||||||||||||||||||||||||||||
| 518 | ecx_priv_encode, | - | ||||||||||||||||||||||||||||||||||||
| 519 | ecx_priv_print, | - | ||||||||||||||||||||||||||||||||||||
| 520 | - | |||||||||||||||||||||||||||||||||||||
| 521 | ecx_size, | - | ||||||||||||||||||||||||||||||||||||
| 522 | ecx_bits, | - | ||||||||||||||||||||||||||||||||||||
| 523 | ecx_security_bits, | - | ||||||||||||||||||||||||||||||||||||
| 524 | - | |||||||||||||||||||||||||||||||||||||
| 525 | 0, 0, 0, 0, | - | ||||||||||||||||||||||||||||||||||||
| 526 | ecx_cmp_parameters, | - | ||||||||||||||||||||||||||||||||||||
| 527 | 0, 0, | - | ||||||||||||||||||||||||||||||||||||
| 528 | - | |||||||||||||||||||||||||||||||||||||
| 529 | ecx_free, | - | ||||||||||||||||||||||||||||||||||||
| 530 | ecx_ctrl, | - | ||||||||||||||||||||||||||||||||||||
| 531 | - | |||||||||||||||||||||||||||||||||||||
| 532 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 533 | , | - | ||||||||||||||||||||||||||||||||||||
| 534 | - | |||||||||||||||||||||||||||||||||||||
| 535 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 536 | , | - | ||||||||||||||||||||||||||||||||||||
| 537 | - | |||||||||||||||||||||||||||||||||||||
| 538 | - | |||||||||||||||||||||||||||||||||||||
| 539 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 540 | , | - | ||||||||||||||||||||||||||||||||||||
| 541 | - | |||||||||||||||||||||||||||||||||||||
| 542 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 543 | , | - | ||||||||||||||||||||||||||||||||||||
| 544 | - | |||||||||||||||||||||||||||||||||||||
| 545 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 546 | , | - | ||||||||||||||||||||||||||||||||||||
| 547 | - | |||||||||||||||||||||||||||||||||||||
| 548 | - | |||||||||||||||||||||||||||||||||||||
| 549 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 550 | , | - | ||||||||||||||||||||||||||||||||||||
| 551 | - | |||||||||||||||||||||||||||||||||||||
| 552 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 553 | , | - | ||||||||||||||||||||||||||||||||||||
| 554 | - | |||||||||||||||||||||||||||||||||||||
| 555 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 556 | , | - | ||||||||||||||||||||||||||||||||||||
| 557 | - | |||||||||||||||||||||||||||||||||||||
| 558 | ecx_set_priv_key, | - | ||||||||||||||||||||||||||||||||||||
| 559 | ecx_set_pub_key, | - | ||||||||||||||||||||||||||||||||||||
| 560 | ecx_get_priv_key, | - | ||||||||||||||||||||||||||||||||||||
| 561 | ecx_get_pub_key, | - | ||||||||||||||||||||||||||||||||||||
| 562 | }; | - | ||||||||||||||||||||||||||||||||||||
| 563 | - | |||||||||||||||||||||||||||||||||||||
| 564 | static int ecd_size25519(const EVP_PKEY *pkey) | - | ||||||||||||||||||||||||||||||||||||
| 565 | { | - | ||||||||||||||||||||||||||||||||||||
| 566 | return executed 10 times by 1 test: 64;return 64;Executed by:
executed 10 times by 1 test: return 64;Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||
| 567 | } | - | ||||||||||||||||||||||||||||||||||||
| 568 | - | |||||||||||||||||||||||||||||||||||||
| 569 | static int ecd_size448(const EVP_PKEY *pkey) | - | ||||||||||||||||||||||||||||||||||||
| 570 | { | - | ||||||||||||||||||||||||||||||||||||
| 571 | return executed 10 times by 1 test: 114;return 114;Executed by:
executed 10 times by 1 test: return 114;Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||
| 572 | } | - | ||||||||||||||||||||||||||||||||||||
| 573 | - | |||||||||||||||||||||||||||||||||||||
| 574 | static int ecd_item_verify(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, | - | ||||||||||||||||||||||||||||||||||||
| 575 | X509_ALGOR *sigalg, ASN1_BIT_STRING *str, | - | ||||||||||||||||||||||||||||||||||||
| 576 | EVP_PKEY *pkey) | - | ||||||||||||||||||||||||||||||||||||
| 577 | { | - | ||||||||||||||||||||||||||||||||||||
| 578 | const ASN1_OBJECT *obj; | - | ||||||||||||||||||||||||||||||||||||
| 579 | int ptype; | - | ||||||||||||||||||||||||||||||||||||
| 580 | int nid; | - | ||||||||||||||||||||||||||||||||||||
| 581 | - | |||||||||||||||||||||||||||||||||||||
| 582 | - | |||||||||||||||||||||||||||||||||||||
| 583 | X509_ALGOR_get0(&obj, &ptype, | - | ||||||||||||||||||||||||||||||||||||
| 584 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 585 | , sigalg); | - | ||||||||||||||||||||||||||||||||||||
| 586 | nid = OBJ_obj2nid(obj); | - | ||||||||||||||||||||||||||||||||||||
| 587 | if ((nid != 1087
| 0-1 | ||||||||||||||||||||||||||||||||||||
| 588 | ERR_put_error(16,(270),(102),__FILE__,516); | - | ||||||||||||||||||||||||||||||||||||
| 589 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 590 | } | - | ||||||||||||||||||||||||||||||||||||
| 591 | - | |||||||||||||||||||||||||||||||||||||
| 592 | if (!EVP_DigestVerifyInit(ctx,
| 0-1 | ||||||||||||||||||||||||||||||||||||
| 593 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||||||||||||||
| 594 | ,
| 0-1 | ||||||||||||||||||||||||||||||||||||
| 595 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||||||||||||||
| 596 | ,
| 0-1 | ||||||||||||||||||||||||||||||||||||
| 597 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||||||||||||||
| 598 | , pkey)
| 0-1 | ||||||||||||||||||||||||||||||||||||
| 599 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 600 | - | |||||||||||||||||||||||||||||||||||||
| 601 | return executed 1 time by 1 test: 2;return 2;Executed by:
executed 1 time by 1 test: return 2;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
| 602 | } | - | ||||||||||||||||||||||||||||||||||||
| 603 | - | |||||||||||||||||||||||||||||||||||||
| 604 | static int ecd_item_sign25519(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, | - | ||||||||||||||||||||||||||||||||||||
| 605 | X509_ALGOR *alg1, X509_ALGOR *alg2, | - | ||||||||||||||||||||||||||||||||||||
| 606 | ASN1_BIT_STRING *str) | - | ||||||||||||||||||||||||||||||||||||
| 607 | { | - | ||||||||||||||||||||||||||||||||||||
| 608 | - | |||||||||||||||||||||||||||||||||||||
| 609 | X509_ALGOR_set0(alg1, OBJ_nid2obj(1087), -1, | - | ||||||||||||||||||||||||||||||||||||
| 610 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 611 | ); | - | ||||||||||||||||||||||||||||||||||||
| 612 | if (alg2
| 0 | ||||||||||||||||||||||||||||||||||||
| 613 | X509_ALGOR_set0(alg2, OBJ_nid2obj(1087), -1, never executed: X509_ALGOR_set0(alg2, OBJ_nid2obj(1087), -1, ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 614 | ((void *)0) never executed: X509_ALGOR_set0(alg2, OBJ_nid2obj(1087), -1, ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 615 | ); never executed: X509_ALGOR_set0(alg2, OBJ_nid2obj(1087), -1, ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 616 | - | |||||||||||||||||||||||||||||||||||||
| 617 | return never executed: 3;return 3;never executed: return 3; | 0 | ||||||||||||||||||||||||||||||||||||
| 618 | } | - | ||||||||||||||||||||||||||||||||||||
| 619 | - | |||||||||||||||||||||||||||||||||||||
| 620 | static int ecd_sig_info_set25519(X509_SIG_INFO *siginf, const X509_ALGOR *alg, | - | ||||||||||||||||||||||||||||||||||||
| 621 | const ASN1_STRING *sig) | - | ||||||||||||||||||||||||||||||||||||
| 622 | { | - | ||||||||||||||||||||||||||||||||||||
| 623 | X509_SIG_INFO_set(siginf, 0, 1087, 128, | - | ||||||||||||||||||||||||||||||||||||
| 624 | 0x2); | - | ||||||||||||||||||||||||||||||||||||
| 625 | return executed 7 times by 1 test: 1;return 1;Executed by:
executed 7 times by 1 test: return 1;Executed by:
| 7 | ||||||||||||||||||||||||||||||||||||
| 626 | } | - | ||||||||||||||||||||||||||||||||||||
| 627 | - | |||||||||||||||||||||||||||||||||||||
| 628 | static int ecd_item_sign448(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, | - | ||||||||||||||||||||||||||||||||||||
| 629 | X509_ALGOR *alg1, X509_ALGOR *alg2, | - | ||||||||||||||||||||||||||||||||||||
| 630 | ASN1_BIT_STRING *str) | - | ||||||||||||||||||||||||||||||||||||
| 631 | { | - | ||||||||||||||||||||||||||||||||||||
| 632 | - | |||||||||||||||||||||||||||||||||||||
| 633 | X509_ALGOR_set0(alg1, OBJ_nid2obj(1088), -1, | - | ||||||||||||||||||||||||||||||||||||
| 634 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 635 | ); | - | ||||||||||||||||||||||||||||||||||||
| 636 | if (alg2 !=
| 0 | ||||||||||||||||||||||||||||||||||||
| 637 | ((void *)0)
| 0 | ||||||||||||||||||||||||||||||||||||
| 638 | ) | - | ||||||||||||||||||||||||||||||||||||
| 639 | X509_ALGOR_set0(alg2, OBJ_nid2obj(1088), -1, never executed: X509_ALGOR_set0(alg2, OBJ_nid2obj(1088), -1, ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 640 | ((void *)0) never executed: X509_ALGOR_set0(alg2, OBJ_nid2obj(1088), -1, ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 641 | ); never executed: X509_ALGOR_set0(alg2, OBJ_nid2obj(1088), -1, ((void *)0) ); | 0 | ||||||||||||||||||||||||||||||||||||
| 642 | - | |||||||||||||||||||||||||||||||||||||
| 643 | return never executed: 3;return 3;never executed: return 3; | 0 | ||||||||||||||||||||||||||||||||||||
| 644 | } | - | ||||||||||||||||||||||||||||||||||||
| 645 | - | |||||||||||||||||||||||||||||||||||||
| 646 | static int ecd_sig_info_set448(X509_SIG_INFO *siginf, const X509_ALGOR *alg, | - | ||||||||||||||||||||||||||||||||||||
| 647 | const ASN1_STRING *sig) | - | ||||||||||||||||||||||||||||||||||||
| 648 | { | - | ||||||||||||||||||||||||||||||||||||
| 649 | X509_SIG_INFO_set(siginf, 0, 1088, 224, | - | ||||||||||||||||||||||||||||||||||||
| 650 | 0x2); | - | ||||||||||||||||||||||||||||||||||||
| 651 | return executed 1 time by 1 test: 1;return 1;Executed by:
executed 1 time by 1 test: return 1;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
| 652 | } | - | ||||||||||||||||||||||||||||||||||||
| 653 | - | |||||||||||||||||||||||||||||||||||||
| 654 | - | |||||||||||||||||||||||||||||||||||||
| 655 | const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth = { | - | ||||||||||||||||||||||||||||||||||||
| 656 | 1087, | - | ||||||||||||||||||||||||||||||||||||
| 657 | 1087, | - | ||||||||||||||||||||||||||||||||||||
| 658 | 0, | - | ||||||||||||||||||||||||||||||||||||
| 659 | "ED25519", | - | ||||||||||||||||||||||||||||||||||||
| 660 | "OpenSSL ED25519 algorithm", | - | ||||||||||||||||||||||||||||||||||||
| 661 | - | |||||||||||||||||||||||||||||||||||||
| 662 | ecx_pub_decode, | - | ||||||||||||||||||||||||||||||||||||
| 663 | ecx_pub_encode, | - | ||||||||||||||||||||||||||||||||||||
| 664 | ecx_pub_cmp, | - | ||||||||||||||||||||||||||||||||||||
| 665 | ecx_pub_print, | - | ||||||||||||||||||||||||||||||||||||
| 666 | - | |||||||||||||||||||||||||||||||||||||
| 667 | ecx_priv_decode, | - | ||||||||||||||||||||||||||||||||||||
| 668 | ecx_priv_encode, | - | ||||||||||||||||||||||||||||||||||||
| 669 | ecx_priv_print, | - | ||||||||||||||||||||||||||||||||||||
| 670 | - | |||||||||||||||||||||||||||||||||||||
| 671 | ecd_size25519, | - | ||||||||||||||||||||||||||||||||||||
| 672 | ecx_bits, | - | ||||||||||||||||||||||||||||||||||||
| 673 | ecx_security_bits, | - | ||||||||||||||||||||||||||||||||||||
| 674 | - | |||||||||||||||||||||||||||||||||||||
| 675 | 0, 0, 0, 0, | - | ||||||||||||||||||||||||||||||||||||
| 676 | ecx_cmp_parameters, | - | ||||||||||||||||||||||||||||||||||||
| 677 | 0, 0, | - | ||||||||||||||||||||||||||||||||||||
| 678 | - | |||||||||||||||||||||||||||||||||||||
| 679 | ecx_free, | - | ||||||||||||||||||||||||||||||||||||
| 680 | ecd_ctrl, | - | ||||||||||||||||||||||||||||||||||||
| 681 | - | |||||||||||||||||||||||||||||||||||||
| 682 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 683 | , | - | ||||||||||||||||||||||||||||||||||||
| 684 | - | |||||||||||||||||||||||||||||||||||||
| 685 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 686 | , | - | ||||||||||||||||||||||||||||||||||||
| 687 | ecd_item_verify, | - | ||||||||||||||||||||||||||||||||||||
| 688 | ecd_item_sign25519, | - | ||||||||||||||||||||||||||||||||||||
| 689 | ecd_sig_info_set25519, | - | ||||||||||||||||||||||||||||||||||||
| 690 | - | |||||||||||||||||||||||||||||||||||||
| 691 | - | |||||||||||||||||||||||||||||||||||||
| 692 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 693 | , | - | ||||||||||||||||||||||||||||||||||||
| 694 | - | |||||||||||||||||||||||||||||||||||||
| 695 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 696 | , | - | ||||||||||||||||||||||||||||||||||||
| 697 | - | |||||||||||||||||||||||||||||||||||||
| 698 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 699 | , | - | ||||||||||||||||||||||||||||||||||||
| 700 | - | |||||||||||||||||||||||||||||||||||||
| 701 | ecx_set_priv_key, | - | ||||||||||||||||||||||||||||||||||||
| 702 | ecx_set_pub_key, | - | ||||||||||||||||||||||||||||||||||||
| 703 | ecx_get_priv_key, | - | ||||||||||||||||||||||||||||||||||||
| 704 | ecx_get_pub_key, | - | ||||||||||||||||||||||||||||||||||||
| 705 | }; | - | ||||||||||||||||||||||||||||||||||||
| 706 | - | |||||||||||||||||||||||||||||||||||||
| 707 | const EVP_PKEY_ASN1_METHOD ed448_asn1_meth = { | - | ||||||||||||||||||||||||||||||||||||
| 708 | 1088, | - | ||||||||||||||||||||||||||||||||||||
| 709 | 1088, | - | ||||||||||||||||||||||||||||||||||||
| 710 | 0, | - | ||||||||||||||||||||||||||||||||||||
| 711 | "ED448", | - | ||||||||||||||||||||||||||||||||||||
| 712 | "OpenSSL ED448 algorithm", | - | ||||||||||||||||||||||||||||||||||||
| 713 | - | |||||||||||||||||||||||||||||||||||||
| 714 | ecx_pub_decode, | - | ||||||||||||||||||||||||||||||||||||
| 715 | ecx_pub_encode, | - | ||||||||||||||||||||||||||||||||||||
| 716 | ecx_pub_cmp, | - | ||||||||||||||||||||||||||||||||||||
| 717 | ecx_pub_print, | - | ||||||||||||||||||||||||||||||||||||
| 718 | - | |||||||||||||||||||||||||||||||||||||
| 719 | ecx_priv_decode, | - | ||||||||||||||||||||||||||||||||||||
| 720 | ecx_priv_encode, | - | ||||||||||||||||||||||||||||||||||||
| 721 | ecx_priv_print, | - | ||||||||||||||||||||||||||||||||||||
| 722 | - | |||||||||||||||||||||||||||||||||||||
| 723 | ecd_size448, | - | ||||||||||||||||||||||||||||||||||||
| 724 | ecx_bits, | - | ||||||||||||||||||||||||||||||||||||
| 725 | ecx_security_bits, | - | ||||||||||||||||||||||||||||||||||||
| 726 | - | |||||||||||||||||||||||||||||||||||||
| 727 | 0, 0, 0, 0, | - | ||||||||||||||||||||||||||||||||||||
| 728 | ecx_cmp_parameters, | - | ||||||||||||||||||||||||||||||||||||
| 729 | 0, 0, | - | ||||||||||||||||||||||||||||||||||||
| 730 | - | |||||||||||||||||||||||||||||||||||||
| 731 | ecx_free, | - | ||||||||||||||||||||||||||||||||||||
| 732 | ecd_ctrl, | - | ||||||||||||||||||||||||||||||||||||
| 733 | - | |||||||||||||||||||||||||||||||||||||
| 734 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 735 | , | - | ||||||||||||||||||||||||||||||||||||
| 736 | - | |||||||||||||||||||||||||||||||||||||
| 737 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 738 | , | - | ||||||||||||||||||||||||||||||||||||
| 739 | ecd_item_verify, | - | ||||||||||||||||||||||||||||||||||||
| 740 | ecd_item_sign448, | - | ||||||||||||||||||||||||||||||||||||
| 741 | ecd_sig_info_set448, | - | ||||||||||||||||||||||||||||||||||||
| 742 | - | |||||||||||||||||||||||||||||||||||||
| 743 | - | |||||||||||||||||||||||||||||||||||||
| 744 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 745 | , | - | ||||||||||||||||||||||||||||||||||||
| 746 | - | |||||||||||||||||||||||||||||||||||||
| 747 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 748 | , | - | ||||||||||||||||||||||||||||||||||||
| 749 | - | |||||||||||||||||||||||||||||||||||||
| 750 | ((void *)0) | - | ||||||||||||||||||||||||||||||||||||
| 751 | , | - | ||||||||||||||||||||||||||||||||||||
| 752 | - | |||||||||||||||||||||||||||||||||||||
| 753 | ecx_set_priv_key, | - | ||||||||||||||||||||||||||||||||||||
| 754 | ecx_set_pub_key, | - | ||||||||||||||||||||||||||||||||||||
| 755 | ecx_get_priv_key, | - | ||||||||||||||||||||||||||||||||||||
| 756 | ecx_get_pub_key, | - | ||||||||||||||||||||||||||||||||||||
| 757 | }; | - | ||||||||||||||||||||||||||||||||||||
| 758 | - | |||||||||||||||||||||||||||||||||||||
| 759 | static int pkey_ecx_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) | - | ||||||||||||||||||||||||||||||||||||
| 760 | { | - | ||||||||||||||||||||||||||||||||||||
| 761 | return executed 6273 times by 1 test: ecx_key_op(pkey, ctx->pmeth->pkey_id, return ecx_key_op(pkey, ctx->pmeth->pkey_id, ((void *)0) , ((void *)0) , 0, KEY_OP_KEYGEN);Executed by:
executed 6273 times by 1 test: return ecx_key_op(pkey, ctx->pmeth->pkey_id, ((void *)0) , ((void *)0) , 0, KEY_OP_KEYGEN);Executed by:
| 6273 | ||||||||||||||||||||||||||||||||||||
| 762 | ((void *)0) executed 6273 times by 1 test: return ecx_key_op(pkey, ctx->pmeth->pkey_id, ((void *)0) , ((void *)0) , 0, KEY_OP_KEYGEN);Executed by:
| 6273 | ||||||||||||||||||||||||||||||||||||
| 763 | , executed 6273 times by 1 test: return ecx_key_op(pkey, ctx->pmeth->pkey_id, ((void *)0) , ((void *)0) , 0, KEY_OP_KEYGEN);Executed by:
| 6273 | ||||||||||||||||||||||||||||||||||||
| 764 | ((void *)0) executed 6273 times by 1 test: return ecx_key_op(pkey, ctx->pmeth->pkey_id, ((void *)0) , ((void *)0) , 0, KEY_OP_KEYGEN);Executed by:
| 6273 | ||||||||||||||||||||||||||||||||||||
| 765 | , 0, KEY_OP_KEYGEN); executed 6273 times by 1 test: return ecx_key_op(pkey, ctx->pmeth->pkey_id, ((void *)0) , ((void *)0) , 0, KEY_OP_KEYGEN);Executed by:
| 6273 | ||||||||||||||||||||||||||||||||||||
| 766 | } | - | ||||||||||||||||||||||||||||||||||||
| 767 | - | |||||||||||||||||||||||||||||||||||||
| 768 | static int validate_ecx_derive(EVP_PKEY_CTX *ctx, unsigned char *key, | - | ||||||||||||||||||||||||||||||||||||
| 769 | size_t *keylen, | - | ||||||||||||||||||||||||||||||||||||
| 770 | const unsigned char **privkey, | - | ||||||||||||||||||||||||||||||||||||
| 771 | const unsigned char **pubkey) | - | ||||||||||||||||||||||||||||||||||||
| 772 | { | - | ||||||||||||||||||||||||||||||||||||
| 773 | const ECX_KEY *ecxkey, *peerkey; | - | ||||||||||||||||||||||||||||||||||||
| 774 | - | |||||||||||||||||||||||||||||||||||||
| 775 | if (ctx->pkey ==
| 0-5856 | ||||||||||||||||||||||||||||||||||||
| 776 | ((void *)0)
| 0-5856 | ||||||||||||||||||||||||||||||||||||
| 777 | || ctx->peerkey ==
| 0-5856 | ||||||||||||||||||||||||||||||||||||
| 778 | ((void *)0)
| 0-5856 | ||||||||||||||||||||||||||||||||||||
| 779 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 780 | ERR_put_error(16,(278),(140),__FILE__,664); | - | ||||||||||||||||||||||||||||||||||||
| 781 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 782 | } | - | ||||||||||||||||||||||||||||||||||||
| 783 | ecxkey = ctx->pkey->pkey.ecx; | - | ||||||||||||||||||||||||||||||||||||
| 784 | peerkey = ctx->peerkey->pkey.ecx; | - | ||||||||||||||||||||||||||||||||||||
| 785 | if (ecxkey ==
| 0-5856 | ||||||||||||||||||||||||||||||||||||
| 786 | ((void *)0)
| 0-5856 | ||||||||||||||||||||||||||||||||||||
| 787 | || ecxkey->privkey ==
| 0-5856 | ||||||||||||||||||||||||||||||||||||
| 788 | ((void *)0)
| 0-5856 | ||||||||||||||||||||||||||||||||||||
| 789 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 790 | ERR_put_error(16,(278),(123),__FILE__,670); | - | ||||||||||||||||||||||||||||||||||||
| 791 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 792 | } | - | ||||||||||||||||||||||||||||||||||||
| 793 | if (peerkey ==
| 0-5856 | ||||||||||||||||||||||||||||||||||||
| 794 | ((void *)0)
| 0-5856 | ||||||||||||||||||||||||||||||||||||
| 795 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 796 | ERR_put_error(16,(278),(133),__FILE__,674); | - | ||||||||||||||||||||||||||||||||||||
| 797 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 798 | } | - | ||||||||||||||||||||||||||||||||||||
| 799 | *privkey = ecxkey->privkey; | - | ||||||||||||||||||||||||||||||||||||
| 800 | *pubkey = peerkey->pubkey; | - | ||||||||||||||||||||||||||||||||||||
| 801 | - | |||||||||||||||||||||||||||||||||||||
| 802 | return executed 5856 times by 1 test: 1;return 1;Executed by:
executed 5856 times by 1 test: return 1;Executed by:
| 5856 | ||||||||||||||||||||||||||||||||||||
| 803 | } | - | ||||||||||||||||||||||||||||||||||||
| 804 | - | |||||||||||||||||||||||||||||||||||||
| 805 | static int pkey_ecx_derive25519(EVP_PKEY_CTX *ctx, unsigned char *key, | - | ||||||||||||||||||||||||||||||||||||
| 806 | size_t *keylen) | - | ||||||||||||||||||||||||||||||||||||
| 807 | { | - | ||||||||||||||||||||||||||||||||||||
| 808 | const unsigned char *privkey, *pubkey; | - | ||||||||||||||||||||||||||||||||||||
| 809 | - | |||||||||||||||||||||||||||||||||||||
| 810 | if (!validate_ecx_derive(ctx, key, keylen, &privkey, &pubkey)
| 0-5832 | ||||||||||||||||||||||||||||||||||||
| 811 | || (key !=
| 2916 | ||||||||||||||||||||||||||||||||||||
| 812 | ((void *)0)
| 2916 | ||||||||||||||||||||||||||||||||||||
| 813 | - | |||||||||||||||||||||||||||||||||||||
| 814 | && X25519(key, privkey, pubkey) == 0
| 2-2914 | ||||||||||||||||||||||||||||||||||||
| 815 | return executed 2 times by 1 test: 0;return 0;Executed by:
executed 2 times by 1 test: return 0;Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||
| 816 | *keylen = 32; | - | ||||||||||||||||||||||||||||||||||||
| 817 | return executed 5830 times by 1 test: 1;return 1;Executed by:
executed 5830 times by 1 test: return 1;Executed by:
| 5830 | ||||||||||||||||||||||||||||||||||||
| 818 | } | - | ||||||||||||||||||||||||||||||||||||
| 819 | - | |||||||||||||||||||||||||||||||||||||
| 820 | static int pkey_ecx_derive448(EVP_PKEY_CTX *ctx, unsigned char *key, | - | ||||||||||||||||||||||||||||||||||||
| 821 | size_t *keylen) | - | ||||||||||||||||||||||||||||||||||||
| 822 | { | - | ||||||||||||||||||||||||||||||||||||
| 823 | const unsigned char *privkey, *pubkey; | - | ||||||||||||||||||||||||||||||||||||
| 824 | - | |||||||||||||||||||||||||||||||||||||
| 825 | if (!validate_ecx_derive(ctx, key, keylen, &privkey, &pubkey)
| 0-24 | ||||||||||||||||||||||||||||||||||||
| 826 | || (key !=
| 12 | ||||||||||||||||||||||||||||||||||||
| 827 | ((void *)0)
| 12 | ||||||||||||||||||||||||||||||||||||
| 828 | - | |||||||||||||||||||||||||||||||||||||
| 829 | && X448(key, privkey, pubkey) == 0
| 1-11 | ||||||||||||||||||||||||||||||||||||
| 830 | return executed 1 time by 1 test: 0;return 0;Executed by:
executed 1 time by 1 test: return 0;Executed by:
| 1 | ||||||||||||||||||||||||||||||||||||
| 831 | *keylen = 56; | - | ||||||||||||||||||||||||||||||||||||
| 832 | return executed 23 times by 1 test: 1;return 1;Executed by:
executed 23 times by 1 test: return 1;Executed by:
| 23 | ||||||||||||||||||||||||||||||||||||
| 833 | } | - | ||||||||||||||||||||||||||||||||||||
| 834 | - | |||||||||||||||||||||||||||||||||||||
| 835 | static int pkey_ecx_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) | - | ||||||||||||||||||||||||||||||||||||
| 836 | { | - | ||||||||||||||||||||||||||||||||||||
| 837 | - | |||||||||||||||||||||||||||||||||||||
| 838 | if (type == 2
| 0-5856 | ||||||||||||||||||||||||||||||||||||
| 839 | return executed 5856 times by 1 test: 1;return 1;Executed by:
executed 5856 times by 1 test: return 1;Executed by:
| 5856 | ||||||||||||||||||||||||||||||||||||
| 840 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||||||||||||||||||||||||||
| 841 | } | - | ||||||||||||||||||||||||||||||||||||
| 842 | - | |||||||||||||||||||||||||||||||||||||
| 843 | const EVP_PKEY_METHOD ecx25519_pkey_meth = { | - | ||||||||||||||||||||||||||||||||||||
| 844 | 1034, | - | ||||||||||||||||||||||||||||||||||||
| 845 | 0, 0, 0, 0, 0, 0, 0, | - | ||||||||||||||||||||||||||||||||||||
| 846 | pkey_ecx_keygen, | - | ||||||||||||||||||||||||||||||||||||
| 847 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | - | ||||||||||||||||||||||||||||||||||||
| 848 | pkey_ecx_derive25519, | - | ||||||||||||||||||||||||||||||||||||
| 849 | pkey_ecx_ctrl, | - | ||||||||||||||||||||||||||||||||||||
| 850 | 0 | - | ||||||||||||||||||||||||||||||||||||
| 851 | }; | - | ||||||||||||||||||||||||||||||||||||
| 852 | - | |||||||||||||||||||||||||||||||||||||
| 853 | const EVP_PKEY_METHOD ecx448_pkey_meth = { | - | ||||||||||||||||||||||||||||||||||||
| 854 | 1035, | - | ||||||||||||||||||||||||||||||||||||
| 855 | 0, 0, 0, 0, 0, 0, 0, | - | ||||||||||||||||||||||||||||||||||||
| 856 | pkey_ecx_keygen, | - | ||||||||||||||||||||||||||||||||||||
| 857 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | - | ||||||||||||||||||||||||||||||||||||
| 858 | pkey_ecx_derive448, | - | ||||||||||||||||||||||||||||||||||||
| 859 | pkey_ecx_ctrl, | - | ||||||||||||||||||||||||||||||||||||
| 860 | 0 | - | ||||||||||||||||||||||||||||||||||||
| 861 | }; | - | ||||||||||||||||||||||||||||||||||||
| 862 | - | |||||||||||||||||||||||||||||||||||||
| 863 | static int pkey_ecd_digestsign25519(EVP_MD_CTX *ctx, unsigned char *sig, | - | ||||||||||||||||||||||||||||||||||||
| 864 | size_t *siglen, const unsigned char *tbs, | - | ||||||||||||||||||||||||||||||||||||
| 865 | size_t tbslen) | - | ||||||||||||||||||||||||||||||||||||
| 866 | { | - | ||||||||||||||||||||||||||||||||||||
| 867 | const ECX_KEY *edkey = EVP_MD_CTX_pkey_ctx(ctx)->pkey->pkey.ecx; | - | ||||||||||||||||||||||||||||||||||||
| 868 | - | |||||||||||||||||||||||||||||||||||||
| 869 | if (sig ==
| 6-11 | ||||||||||||||||||||||||||||||||||||
| 870 | ((void *)0)
| 6-11 | ||||||||||||||||||||||||||||||||||||
| 871 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 872 | *siglen = 64; | - | ||||||||||||||||||||||||||||||||||||
| 873 | return executed 6 times by 1 test: 1;return 1;Executed by:
executed 6 times by 1 test: return 1;Executed by:
| 6 | ||||||||||||||||||||||||||||||||||||
| 874 | } | - | ||||||||||||||||||||||||||||||||||||
| 875 | if (*
| 0-11 | ||||||||||||||||||||||||||||||||||||
| 876 | ERR_put_error(16,(276),(100),__FILE__,748); | - | ||||||||||||||||||||||||||||||||||||
| 877 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 878 | } | - | ||||||||||||||||||||||||||||||||||||
| 879 | - | |||||||||||||||||||||||||||||||||||||
| 880 | if (ED25519_sign(sig, tbs, tbslen, edkey->pubkey, edkey->privkey) == 0
| 0-11 | ||||||||||||||||||||||||||||||||||||
| 881 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 882 | *siglen = 64; | - | ||||||||||||||||||||||||||||||||||||
| 883 | return executed 11 times by 1 test: 1;return 1;Executed by:
executed 11 times by 1 test: return 1;Executed by:
| 11 | ||||||||||||||||||||||||||||||||||||
| 884 | } | - | ||||||||||||||||||||||||||||||||||||
| 885 | - | |||||||||||||||||||||||||||||||||||||
| 886 | static int pkey_ecd_digestsign448(EVP_MD_CTX *ctx, unsigned char *sig, | - | ||||||||||||||||||||||||||||||||||||
| 887 | size_t *siglen, const unsigned char *tbs, | - | ||||||||||||||||||||||||||||||||||||
| 888 | size_t tbslen) | - | ||||||||||||||||||||||||||||||||||||
| 889 | { | - | ||||||||||||||||||||||||||||||||||||
| 890 | const ECX_KEY *edkey = EVP_MD_CTX_pkey_ctx(ctx)->pkey->pkey.ecx; | - | ||||||||||||||||||||||||||||||||||||
| 891 | - | |||||||||||||||||||||||||||||||||||||
| 892 | if (sig ==
| 9-14 | ||||||||||||||||||||||||||||||||||||
| 893 | ((void *)0)
| 9-14 | ||||||||||||||||||||||||||||||||||||
| 894 | ) { | - | ||||||||||||||||||||||||||||||||||||
| 895 | *siglen = 114; | - | ||||||||||||||||||||||||||||||||||||
| 896 | return executed 9 times by 1 test: 1;return 1;Executed by:
executed 9 times by 1 test: return 1;Executed by:
| 9 | ||||||||||||||||||||||||||||||||||||
| 897 | } | - | ||||||||||||||||||||||||||||||||||||
| 898 | if (*
| 0-14 | ||||||||||||||||||||||||||||||||||||
| 899 | ERR_put_error(16,(277),(100),__FILE__,769); | - | ||||||||||||||||||||||||||||||||||||
| 900 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 901 | } | - | ||||||||||||||||||||||||||||||||||||
| 902 | - | |||||||||||||||||||||||||||||||||||||
| 903 | if (ED448_sign(sig, tbs, tbslen, edkey->pubkey, edkey->privkey,
| 0-14 | ||||||||||||||||||||||||||||||||||||
| 904 | ((void *)0)
| 0-14 | ||||||||||||||||||||||||||||||||||||
| 905 | ,
| 0-14 | ||||||||||||||||||||||||||||||||||||
| 906 | 0) == 0
| 0-14 | ||||||||||||||||||||||||||||||||||||
| 907 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 908 | *siglen = 114; | - | ||||||||||||||||||||||||||||||||||||
| 909 | return executed 14 times by 1 test: 1;return 1;Executed by:
executed 14 times by 1 test: return 1;Executed by:
| 14 | ||||||||||||||||||||||||||||||||||||
| 910 | } | - | ||||||||||||||||||||||||||||||||||||
| 911 | - | |||||||||||||||||||||||||||||||||||||
| 912 | static int pkey_ecd_digestverify25519(EVP_MD_CTX *ctx, const unsigned char *sig, | - | ||||||||||||||||||||||||||||||||||||
| 913 | size_t siglen, const unsigned char *tbs, | - | ||||||||||||||||||||||||||||||||||||
| 914 | size_t tbslen) | - | ||||||||||||||||||||||||||||||||||||
| 915 | { | - | ||||||||||||||||||||||||||||||||||||
| 916 | const ECX_KEY *edkey = EVP_MD_CTX_pkey_ctx(ctx)->pkey->pkey.ecx; | - | ||||||||||||||||||||||||||||||||||||
| 917 | - | |||||||||||||||||||||||||||||||||||||
| 918 | if (siglen != 64
| 0-10 | ||||||||||||||||||||||||||||||||||||
| 919 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 920 | - | |||||||||||||||||||||||||||||||||||||
| 921 | return executed 10 times by 1 test: ED25519_verify(tbs, tbslen, sig, edkey->pubkey);return ED25519_verify(tbs, tbslen, sig, edkey->pubkey);Executed by:
executed 10 times by 1 test: return ED25519_verify(tbs, tbslen, sig, edkey->pubkey);Executed by:
| 10 | ||||||||||||||||||||||||||||||||||||
| 922 | } | - | ||||||||||||||||||||||||||||||||||||
| 923 | - | |||||||||||||||||||||||||||||||||||||
| 924 | static int pkey_ecd_digestverify448(EVP_MD_CTX *ctx, const unsigned char *sig, | - | ||||||||||||||||||||||||||||||||||||
| 925 | size_t siglen, const unsigned char *tbs, | - | ||||||||||||||||||||||||||||||||||||
| 926 | size_t tbslen) | - | ||||||||||||||||||||||||||||||||||||
| 927 | { | - | ||||||||||||||||||||||||||||||||||||
| 928 | const ECX_KEY *edkey = EVP_MD_CTX_pkey_ctx(ctx)->pkey->pkey.ecx; | - | ||||||||||||||||||||||||||||||||||||
| 929 | - | |||||||||||||||||||||||||||||||||||||
| 930 | if (siglen != 114
| 0-9 | ||||||||||||||||||||||||||||||||||||
| 931 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 932 | - | |||||||||||||||||||||||||||||||||||||
| 933 | return executed 9 times by 1 test: ED448_verify(tbs, tbslen, sig, edkey->pubkey, return ED448_verify(tbs, tbslen, sig, edkey->pubkey, ((void *)0) , 0);Executed by:
executed 9 times by 1 test: return ED448_verify(tbs, tbslen, sig, edkey->pubkey, ((void *)0) , 0);Executed by:
| 9 | ||||||||||||||||||||||||||||||||||||
| 934 | ((void *)0) executed 9 times by 1 test: return ED448_verify(tbs, tbslen, sig, edkey->pubkey, ((void *)0) , 0);Executed by:
| 9 | ||||||||||||||||||||||||||||||||||||
| 935 | , 0); executed 9 times by 1 test: return ED448_verify(tbs, tbslen, sig, edkey->pubkey, ((void *)0) , 0);Executed by:
| 9 | ||||||||||||||||||||||||||||||||||||
| 936 | } | - | ||||||||||||||||||||||||||||||||||||
| 937 | - | |||||||||||||||||||||||||||||||||||||
| 938 | static int pkey_ecd_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) | - | ||||||||||||||||||||||||||||||||||||
| 939 | { | - | ||||||||||||||||||||||||||||||||||||
| 940 | switch (type) { | - | ||||||||||||||||||||||||||||||||||||
| 941 | case executed 50 times by 1 test: 1:case 1:Executed by:
executed 50 times by 1 test: case 1:Executed by:
| 50 | ||||||||||||||||||||||||||||||||||||
| 942 | - | |||||||||||||||||||||||||||||||||||||
| 943 | if (p2 ==
| 2-48 | ||||||||||||||||||||||||||||||||||||
| 944 | ((void *)0)
| 2-48 | ||||||||||||||||||||||||||||||||||||
| 945 | || (const
| 0-2 | ||||||||||||||||||||||||||||||||||||
| 946 | return executed 48 times by 1 test: 1;return 1;Executed by:
executed 48 times by 1 test: return 1;Executed by:
| 48 | ||||||||||||||||||||||||||||||||||||
| 947 | ERR_put_error(16,(271),(138),__FILE__,811); | - | ||||||||||||||||||||||||||||||||||||
| 948 | return executed 2 times by 1 test: 0;return 0;Executed by:
executed 2 times by 1 test: return 0;Executed by:
| 2 | ||||||||||||||||||||||||||||||||||||
| 949 | - | |||||||||||||||||||||||||||||||||||||
| 950 | case never executed: 7:case 7:never executed: case 7: | 0 | ||||||||||||||||||||||||||||||||||||
| 951 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 952 | } | - | ||||||||||||||||||||||||||||||||||||
| 953 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||||||||||||||||||||||||||
| 954 | } | - | ||||||||||||||||||||||||||||||||||||
| 955 | - | |||||||||||||||||||||||||||||||||||||
| 956 | const EVP_PKEY_METHOD ed25519_pkey_meth = { | - | ||||||||||||||||||||||||||||||||||||
| 957 | 1087, 4, | - | ||||||||||||||||||||||||||||||||||||
| 958 | 0, 0, 0, 0, 0, 0, | - | ||||||||||||||||||||||||||||||||||||
| 959 | pkey_ecx_keygen, | - | ||||||||||||||||||||||||||||||||||||
| 960 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | - | ||||||||||||||||||||||||||||||||||||
| 961 | pkey_ecd_ctrl, | - | ||||||||||||||||||||||||||||||||||||
| 962 | 0, | - | ||||||||||||||||||||||||||||||||||||
| 963 | pkey_ecd_digestsign25519, | - | ||||||||||||||||||||||||||||||||||||
| 964 | pkey_ecd_digestverify25519 | - | ||||||||||||||||||||||||||||||||||||
| 965 | }; | - | ||||||||||||||||||||||||||||||||||||
| 966 | - | |||||||||||||||||||||||||||||||||||||
| 967 | const EVP_PKEY_METHOD ed448_pkey_meth = { | - | ||||||||||||||||||||||||||||||||||||
| 968 | 1088, 4, | - | ||||||||||||||||||||||||||||||||||||
| 969 | 0, 0, 0, 0, 0, 0, | - | ||||||||||||||||||||||||||||||||||||
| 970 | pkey_ecx_keygen, | - | ||||||||||||||||||||||||||||||||||||
| 971 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | - | ||||||||||||||||||||||||||||||||||||
| 972 | pkey_ecd_ctrl, | - | ||||||||||||||||||||||||||||||||||||
| 973 | 0, | - | ||||||||||||||||||||||||||||||||||||
| 974 | pkey_ecd_digestsign448, | - | ||||||||||||||||||||||||||||||||||||
| 975 | pkey_ecd_digestverify448 | - | ||||||||||||||||||||||||||||||||||||
| 976 | }; | - | ||||||||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |