| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/libressl/src/crypto/rsa/rsa_asn1.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | static int | - | ||||||||||||
| 6 | rsa_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) | - | ||||||||||||
| 7 | { | - | ||||||||||||
| 8 | if (operation == 0
| 252-513 | ||||||||||||
| 9 | *pval = (ASN1_VALUE *)RSA_new(); | - | ||||||||||||
| 10 | if (*
| 0-252 | ||||||||||||
| 11 | return executed 252 times by 5 tests: 2;return 2;Executed by:
executed 252 times by 5 tests: return 2;Executed by:
| 252 | ||||||||||||
| 12 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||
| 13 | } else if (operation == 2
| 0-513 | ||||||||||||
| 14 | RSA_free((RSA *)*pval); | - | ||||||||||||
| 15 | *pval = | - | ||||||||||||
| 16 | ((void *)0) | - | ||||||||||||
| 17 | ; | - | ||||||||||||
| 18 | return never executed: 2;return 2;never executed: return 2; | 0 | ||||||||||||
| 19 | } | - | ||||||||||||
| 20 | return executed 513 times by 5 tests: 1;return 1;Executed by:
executed 513 times by 5 tests: return 1;Executed by:
| 513 | ||||||||||||
| 21 | } | - | ||||||||||||
| 22 | - | |||||||||||||
| 23 | static const ASN1_AUX RSAPrivateKey_aux = { | - | ||||||||||||
| 24 | .app_data = | - | ||||||||||||
| 25 | ((void *)0) | - | ||||||||||||
| 26 | , | - | ||||||||||||
| 27 | .flags = 0, | - | ||||||||||||
| 28 | .ref_offset = 0, | - | ||||||||||||
| 29 | .ref_lock = 0, | - | ||||||||||||
| 30 | .asn1_cb = rsa_cb, | - | ||||||||||||
| 31 | .enc_offset = 0, | - | ||||||||||||
| 32 | }; | - | ||||||||||||
| 33 | static const ASN1_TEMPLATE RSAPrivateKey_seq_tt[] = { | - | ||||||||||||
| 34 | { | - | ||||||||||||
| 35 | .flags = 0, | - | ||||||||||||
| 36 | .tag = 0, | - | ||||||||||||
| 37 | .offset = | - | ||||||||||||
| 38 | __builtin_offsetof ( | - | ||||||||||||
| 39 | RSA | - | ||||||||||||
| 40 | , | - | ||||||||||||
| 41 | version | - | ||||||||||||
| 42 | ) | - | ||||||||||||
| 43 | , | - | ||||||||||||
| 44 | .field_name = "version", | - | ||||||||||||
| 45 | .item = &LONG_it, | - | ||||||||||||
| 46 | }, | - | ||||||||||||
| 47 | { | - | ||||||||||||
| 48 | .flags = 0, | - | ||||||||||||
| 49 | .tag = 0, | - | ||||||||||||
| 50 | .offset = | - | ||||||||||||
| 51 | __builtin_offsetof ( | - | ||||||||||||
| 52 | RSA | - | ||||||||||||
| 53 | , | - | ||||||||||||
| 54 | n | - | ||||||||||||
| 55 | ) | - | ||||||||||||
| 56 | , | - | ||||||||||||
| 57 | .field_name = "n", | - | ||||||||||||
| 58 | .item = &BIGNUM_it, | - | ||||||||||||
| 59 | }, | - | ||||||||||||
| 60 | { | - | ||||||||||||
| 61 | .flags = 0, | - | ||||||||||||
| 62 | .tag = 0, | - | ||||||||||||
| 63 | .offset = | - | ||||||||||||
| 64 | __builtin_offsetof ( | - | ||||||||||||
| 65 | RSA | - | ||||||||||||
| 66 | , | - | ||||||||||||
| 67 | e | - | ||||||||||||
| 68 | ) | - | ||||||||||||
| 69 | , | - | ||||||||||||
| 70 | .field_name = "e", | - | ||||||||||||
| 71 | .item = &BIGNUM_it, | - | ||||||||||||
| 72 | }, | - | ||||||||||||
| 73 | { | - | ||||||||||||
| 74 | .flags = 0, | - | ||||||||||||
| 75 | .tag = 0, | - | ||||||||||||
| 76 | .offset = | - | ||||||||||||
| 77 | __builtin_offsetof ( | - | ||||||||||||
| 78 | RSA | - | ||||||||||||
| 79 | , | - | ||||||||||||
| 80 | d | - | ||||||||||||
| 81 | ) | - | ||||||||||||
| 82 | , | - | ||||||||||||
| 83 | .field_name = "d", | - | ||||||||||||
| 84 | .item = &BIGNUM_it, | - | ||||||||||||
| 85 | }, | - | ||||||||||||
| 86 | { | - | ||||||||||||
| 87 | .flags = 0, | - | ||||||||||||
| 88 | .tag = 0, | - | ||||||||||||
| 89 | .offset = | - | ||||||||||||
| 90 | __builtin_offsetof ( | - | ||||||||||||
| 91 | RSA | - | ||||||||||||
| 92 | , | - | ||||||||||||
| 93 | p | - | ||||||||||||
| 94 | ) | - | ||||||||||||
| 95 | , | - | ||||||||||||
| 96 | .field_name = "p", | - | ||||||||||||
| 97 | .item = &BIGNUM_it, | - | ||||||||||||
| 98 | }, | - | ||||||||||||
| 99 | { | - | ||||||||||||
| 100 | .flags = 0, | - | ||||||||||||
| 101 | .tag = 0, | - | ||||||||||||
| 102 | .offset = | - | ||||||||||||
| 103 | __builtin_offsetof ( | - | ||||||||||||
| 104 | RSA | - | ||||||||||||
| 105 | , | - | ||||||||||||
| 106 | q | - | ||||||||||||
| 107 | ) | - | ||||||||||||
| 108 | , | - | ||||||||||||
| 109 | .field_name = "q", | - | ||||||||||||
| 110 | .item = &BIGNUM_it, | - | ||||||||||||
| 111 | }, | - | ||||||||||||
| 112 | { | - | ||||||||||||
| 113 | .flags = 0, | - | ||||||||||||
| 114 | .tag = 0, | - | ||||||||||||
| 115 | .offset = | - | ||||||||||||
| 116 | __builtin_offsetof ( | - | ||||||||||||
| 117 | RSA | - | ||||||||||||
| 118 | , | - | ||||||||||||
| 119 | dmp1 | - | ||||||||||||
| 120 | ) | - | ||||||||||||
| 121 | , | - | ||||||||||||
| 122 | .field_name = "dmp1", | - | ||||||||||||
| 123 | .item = &BIGNUM_it, | - | ||||||||||||
| 124 | }, | - | ||||||||||||
| 125 | { | - | ||||||||||||
| 126 | .flags = 0, | - | ||||||||||||
| 127 | .tag = 0, | - | ||||||||||||
| 128 | .offset = | - | ||||||||||||
| 129 | __builtin_offsetof ( | - | ||||||||||||
| 130 | RSA | - | ||||||||||||
| 131 | , | - | ||||||||||||
| 132 | dmq1 | - | ||||||||||||
| 133 | ) | - | ||||||||||||
| 134 | , | - | ||||||||||||
| 135 | .field_name = "dmq1", | - | ||||||||||||
| 136 | .item = &BIGNUM_it, | - | ||||||||||||
| 137 | }, | - | ||||||||||||
| 138 | { | - | ||||||||||||
| 139 | .flags = 0, | - | ||||||||||||
| 140 | .tag = 0, | - | ||||||||||||
| 141 | .offset = | - | ||||||||||||
| 142 | __builtin_offsetof ( | - | ||||||||||||
| 143 | RSA | - | ||||||||||||
| 144 | , | - | ||||||||||||
| 145 | iqmp | - | ||||||||||||
| 146 | ) | - | ||||||||||||
| 147 | , | - | ||||||||||||
| 148 | .field_name = "iqmp", | - | ||||||||||||
| 149 | .item = &BIGNUM_it, | - | ||||||||||||
| 150 | }, | - | ||||||||||||
| 151 | }; | - | ||||||||||||
| 152 | - | |||||||||||||
| 153 | const ASN1_ITEM RSAPrivateKey_it = { | - | ||||||||||||
| 154 | .itype = 0x1, | - | ||||||||||||
| 155 | .utype = 16, | - | ||||||||||||
| 156 | .templates = RSAPrivateKey_seq_tt, | - | ||||||||||||
| 157 | .tcount = sizeof(RSAPrivateKey_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||
| 158 | .funcs = &RSAPrivateKey_aux, | - | ||||||||||||
| 159 | .size = sizeof(RSA), | - | ||||||||||||
| 160 | .sname = "RSA", | - | ||||||||||||
| 161 | }; | - | ||||||||||||
| 162 | - | |||||||||||||
| 163 | - | |||||||||||||
| 164 | static const ASN1_AUX RSAPublicKey_aux = { | - | ||||||||||||
| 165 | .app_data = | - | ||||||||||||
| 166 | ((void *)0) | - | ||||||||||||
| 167 | , | - | ||||||||||||
| 168 | .flags = 0, | - | ||||||||||||
| 169 | .ref_offset = 0, | - | ||||||||||||
| 170 | .ref_lock = 0, | - | ||||||||||||
| 171 | .asn1_cb = rsa_cb, | - | ||||||||||||
| 172 | .enc_offset = 0, | - | ||||||||||||
| 173 | }; | - | ||||||||||||
| 174 | static const ASN1_TEMPLATE RSAPublicKey_seq_tt[] = { | - | ||||||||||||
| 175 | { | - | ||||||||||||
| 176 | .flags = 0, | - | ||||||||||||
| 177 | .tag = 0, | - | ||||||||||||
| 178 | .offset = | - | ||||||||||||
| 179 | __builtin_offsetof ( | - | ||||||||||||
| 180 | RSA | - | ||||||||||||
| 181 | , | - | ||||||||||||
| 182 | n | - | ||||||||||||
| 183 | ) | - | ||||||||||||
| 184 | , | - | ||||||||||||
| 185 | .field_name = "n", | - | ||||||||||||
| 186 | .item = &BIGNUM_it, | - | ||||||||||||
| 187 | }, | - | ||||||||||||
| 188 | { | - | ||||||||||||
| 189 | .flags = 0, | - | ||||||||||||
| 190 | .tag = 0, | - | ||||||||||||
| 191 | .offset = | - | ||||||||||||
| 192 | __builtin_offsetof ( | - | ||||||||||||
| 193 | RSA | - | ||||||||||||
| 194 | , | - | ||||||||||||
| 195 | e | - | ||||||||||||
| 196 | ) | - | ||||||||||||
| 197 | , | - | ||||||||||||
| 198 | .field_name = "e", | - | ||||||||||||
| 199 | .item = &BIGNUM_it, | - | ||||||||||||
| 200 | }, | - | ||||||||||||
| 201 | }; | - | ||||||||||||
| 202 | - | |||||||||||||
| 203 | const ASN1_ITEM RSAPublicKey_it = { | - | ||||||||||||
| 204 | .itype = 0x1, | - | ||||||||||||
| 205 | .utype = 16, | - | ||||||||||||
| 206 | .templates = RSAPublicKey_seq_tt, | - | ||||||||||||
| 207 | .tcount = sizeof(RSAPublicKey_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||
| 208 | .funcs = &RSAPublicKey_aux, | - | ||||||||||||
| 209 | .size = sizeof(RSA), | - | ||||||||||||
| 210 | .sname = "RSA", | - | ||||||||||||
| 211 | }; | - | ||||||||||||
| 212 | - | |||||||||||||
| 213 | static const ASN1_TEMPLATE RSA_PSS_PARAMS_seq_tt[] = { | - | ||||||||||||
| 214 | { | - | ||||||||||||
| 215 | .flags = (0x2 << 3)|(0x2<<6) | (0x1), | - | ||||||||||||
| 216 | .tag = 0, | - | ||||||||||||
| 217 | .offset = | - | ||||||||||||
| 218 | __builtin_offsetof ( | - | ||||||||||||
| 219 | RSA_PSS_PARAMS | - | ||||||||||||
| 220 | , | - | ||||||||||||
| 221 | hashAlgorithm | - | ||||||||||||
| 222 | ) | - | ||||||||||||
| 223 | , | - | ||||||||||||
| 224 | .field_name = "hashAlgorithm", | - | ||||||||||||
| 225 | .item = &X509_ALGOR_it, | - | ||||||||||||
| 226 | }, | - | ||||||||||||
| 227 | { | - | ||||||||||||
| 228 | .flags = (0x2 << 3)|(0x2<<6) | (0x1), | - | ||||||||||||
| 229 | .tag = 1, | - | ||||||||||||
| 230 | .offset = | - | ||||||||||||
| 231 | __builtin_offsetof ( | - | ||||||||||||
| 232 | RSA_PSS_PARAMS | - | ||||||||||||
| 233 | , | - | ||||||||||||
| 234 | maskGenAlgorithm | - | ||||||||||||
| 235 | ) | - | ||||||||||||
| 236 | , | - | ||||||||||||
| 237 | .field_name = "maskGenAlgorithm", | - | ||||||||||||
| 238 | .item = &X509_ALGOR_it, | - | ||||||||||||
| 239 | }, | - | ||||||||||||
| 240 | { | - | ||||||||||||
| 241 | .flags = (0x2 << 3)|(0x2<<6) | (0x1), | - | ||||||||||||
| 242 | .tag = 2, | - | ||||||||||||
| 243 | .offset = | - | ||||||||||||
| 244 | __builtin_offsetof ( | - | ||||||||||||
| 245 | RSA_PSS_PARAMS | - | ||||||||||||
| 246 | , | - | ||||||||||||
| 247 | saltLength | - | ||||||||||||
| 248 | ) | - | ||||||||||||
| 249 | , | - | ||||||||||||
| 250 | .field_name = "saltLength", | - | ||||||||||||
| 251 | .item = &ASN1_INTEGER_it, | - | ||||||||||||
| 252 | }, | - | ||||||||||||
| 253 | { | - | ||||||||||||
| 254 | .flags = (0x2 << 3)|(0x2<<6) | (0x1), | - | ||||||||||||
| 255 | .tag = 3, | - | ||||||||||||
| 256 | .offset = | - | ||||||||||||
| 257 | __builtin_offsetof ( | - | ||||||||||||
| 258 | RSA_PSS_PARAMS | - | ||||||||||||
| 259 | , | - | ||||||||||||
| 260 | trailerField | - | ||||||||||||
| 261 | ) | - | ||||||||||||
| 262 | , | - | ||||||||||||
| 263 | .field_name = "trailerField", | - | ||||||||||||
| 264 | .item = &ASN1_INTEGER_it, | - | ||||||||||||
| 265 | }, | - | ||||||||||||
| 266 | }; | - | ||||||||||||
| 267 | - | |||||||||||||
| 268 | const ASN1_ITEM RSA_PSS_PARAMS_it = { | - | ||||||||||||
| 269 | .itype = 0x1, | - | ||||||||||||
| 270 | .utype = 16, | - | ||||||||||||
| 271 | .templates = RSA_PSS_PARAMS_seq_tt, | - | ||||||||||||
| 272 | .tcount = sizeof(RSA_PSS_PARAMS_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||
| 273 | .funcs = | - | ||||||||||||
| 274 | ((void *)0) | - | ||||||||||||
| 275 | , | - | ||||||||||||
| 276 | .size = sizeof(RSA_PSS_PARAMS), | - | ||||||||||||
| 277 | .sname = "RSA_PSS_PARAMS", | - | ||||||||||||
| 278 | }; | - | ||||||||||||
| 279 | - | |||||||||||||
| 280 | - | |||||||||||||
| 281 | RSA_PSS_PARAMS * | - | ||||||||||||
| 282 | d2i_RSA_PSS_PARAMS(RSA_PSS_PARAMS **a, const unsigned char **in, long len) | - | ||||||||||||
| 283 | { | - | ||||||||||||
| 284 | return never executed: (RSA_PSS_PARAMS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,return (RSA_PSS_PARAMS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &RSA_PSS_PARAMS_it);never executed: return (RSA_PSS_PARAMS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &RSA_PSS_PARAMS_it); | 0 | ||||||||||||
| 285 | &RSA_PSS_PARAMS_it); never executed: return (RSA_PSS_PARAMS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &RSA_PSS_PARAMS_it); | 0 | ||||||||||||
| 286 | } | - | ||||||||||||
| 287 | - | |||||||||||||
| 288 | int | - | ||||||||||||
| 289 | i2d_RSA_PSS_PARAMS(RSA_PSS_PARAMS *a, unsigned char **out) | - | ||||||||||||
| 290 | { | - | ||||||||||||
| 291 | return never executed: ASN1_item_i2d((ASN1_VALUE *)a, out, &RSA_PSS_PARAMS_it);return ASN1_item_i2d((ASN1_VALUE *)a, out, &RSA_PSS_PARAMS_it);never executed: return ASN1_item_i2d((ASN1_VALUE *)a, out, &RSA_PSS_PARAMS_it); | 0 | ||||||||||||
| 292 | } | - | ||||||||||||
| 293 | - | |||||||||||||
| 294 | RSA_PSS_PARAMS * | - | ||||||||||||
| 295 | RSA_PSS_PARAMS_new(void) | - | ||||||||||||
| 296 | { | - | ||||||||||||
| 297 | return never executed: (RSA_PSS_PARAMS *)ASN1_item_new(&RSA_PSS_PARAMS_it);return (RSA_PSS_PARAMS *)ASN1_item_new(&RSA_PSS_PARAMS_it);never executed: return (RSA_PSS_PARAMS *)ASN1_item_new(&RSA_PSS_PARAMS_it); | 0 | ||||||||||||
| 298 | } | - | ||||||||||||
| 299 | - | |||||||||||||
| 300 | void | - | ||||||||||||
| 301 | RSA_PSS_PARAMS_free(RSA_PSS_PARAMS *a) | - | ||||||||||||
| 302 | { | - | ||||||||||||
| 303 | ASN1_item_free((ASN1_VALUE *)a, &RSA_PSS_PARAMS_it); | - | ||||||||||||
| 304 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 305 | - | |||||||||||||
| 306 | - | |||||||||||||
| 307 | RSA * | - | ||||||||||||
| 308 | d2i_RSAPrivateKey(RSA **a, const unsigned char **in, long len) | - | ||||||||||||
| 309 | { | - | ||||||||||||
| 310 | return executed 65 times by 5 tests: (RSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,return (RSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &RSAPrivateKey_it);Executed by:
executed 65 times by 5 tests: return (RSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &RSAPrivateKey_it);Executed by:
| 65 | ||||||||||||
| 311 | &RSAPrivateKey_it); executed 65 times by 5 tests: return (RSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &RSAPrivateKey_it);Executed by:
| 65 | ||||||||||||
| 312 | } | - | ||||||||||||
| 313 | - | |||||||||||||
| 314 | int | - | ||||||||||||
| 315 | i2d_RSAPrivateKey(const RSA *a, unsigned char **out) | - | ||||||||||||
| 316 | { | - | ||||||||||||
| 317 | return executed 2 times by 1 test: ASN1_item_i2d((ASN1_VALUE *)a, out, &RSAPrivateKey_it);return ASN1_item_i2d((ASN1_VALUE *)a, out, &RSAPrivateKey_it);Executed by:
executed 2 times by 1 test: return ASN1_item_i2d((ASN1_VALUE *)a, out, &RSAPrivateKey_it);Executed by:
| 2 | ||||||||||||
| 318 | } | - | ||||||||||||
| 319 | - | |||||||||||||
| 320 | - | |||||||||||||
| 321 | RSA * | - | ||||||||||||
| 322 | d2i_RSAPublicKey(RSA **a, const unsigned char **in, long len) | - | ||||||||||||
| 323 | { | - | ||||||||||||
| 324 | return executed 187 times by 5 tests: (RSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,return (RSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &RSAPublicKey_it);Executed by:
executed 187 times by 5 tests: return (RSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &RSAPublicKey_it);Executed by:
| 187 | ||||||||||||
| 325 | &RSAPublicKey_it); executed 187 times by 5 tests: return (RSA *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, &RSAPublicKey_it);Executed by:
| 187 | ||||||||||||
| 326 | } | - | ||||||||||||
| 327 | - | |||||||||||||
| 328 | int | - | ||||||||||||
| 329 | i2d_RSAPublicKey(const RSA *a, unsigned char **out) | - | ||||||||||||
| 330 | { | - | ||||||||||||
| 331 | return executed 2 times by 1 test: ASN1_item_i2d((ASN1_VALUE *)a, out, &RSAPublicKey_it);return ASN1_item_i2d((ASN1_VALUE *)a, out, &RSAPublicKey_it);Executed by:
executed 2 times by 1 test: return ASN1_item_i2d((ASN1_VALUE *)a, out, &RSAPublicKey_it);Executed by:
| 2 | ||||||||||||
| 332 | } | - | ||||||||||||
| 333 | - | |||||||||||||
| 334 | RSA * | - | ||||||||||||
| 335 | RSAPublicKey_dup(RSA *rsa) | - | ||||||||||||
| 336 | { | - | ||||||||||||
| 337 | return never executed: ASN1_item_dup(&RSAPublicKey_it, rsa);return ASN1_item_dup(&RSAPublicKey_it, rsa);never executed: return ASN1_item_dup(&RSAPublicKey_it, rsa); | 0 | ||||||||||||
| 338 | } | - | ||||||||||||
| 339 | - | |||||||||||||
| 340 | RSA * | - | ||||||||||||
| 341 | RSAPrivateKey_dup(RSA *rsa) | - | ||||||||||||
| 342 | { | - | ||||||||||||
| 343 | return never executed: ASN1_item_dup(&RSAPrivateKey_it, rsa);return ASN1_item_dup(&RSAPrivateKey_it, rsa);never executed: return ASN1_item_dup(&RSAPrivateKey_it, rsa); | 0 | ||||||||||||
| 344 | } | - | ||||||||||||
| Switch to Source code | Preprocessed file |