| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/ec/ec_asn1.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | int EC_GROUP_get_basis_type(const EC_GROUP *group) | - | ||||||||||||||||||||||||
| 3 | { | - | ||||||||||||||||||||||||
| 4 | int i; | - | ||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=
| 0 | ||||||||||||||||||||||||
| 7 | 407
| 0 | ||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | for (i = 0; | - | ||||||||||||||||||||||||
| 13 | i < (int)(sizeof(group->poly)/sizeof((group->poly)[0]))
| 0 | ||||||||||||||||||||||||
| 14 | i++) | - | ||||||||||||||||||||||||
| 15 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 16 | - | |||||||||||||||||||||||||
| 17 | if (i == 4
| 0 | ||||||||||||||||||||||||
| 18 | return never executed: 683;return 683;never executed: return 683; | 0 | ||||||||||||||||||||||||
| 19 | else if (i == 2
| 0 | ||||||||||||||||||||||||
| 20 | return never executed: 682;return 682;never executed: return 682; | 0 | ||||||||||||||||||||||||
| 21 | else | - | ||||||||||||||||||||||||
| 22 | - | |||||||||||||||||||||||||
| 23 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 24 | } | - | ||||||||||||||||||||||||
| 25 | - | |||||||||||||||||||||||||
| 26 | - | |||||||||||||||||||||||||
| 27 | int EC_GROUP_get_trinomial_basis(const EC_GROUP *group, unsigned int *k) | - | ||||||||||||||||||||||||
| 28 | { | - | ||||||||||||||||||||||||
| 29 | if (group ==
| 0 | ||||||||||||||||||||||||
| 30 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 31 | ) | - | ||||||||||||||||||||||||
| 32 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||
| 34 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=
| 0 | ||||||||||||||||||||||||
| 35 | 407
| 0 | ||||||||||||||||||||||||
| 36 | || !((
| 0 | ||||||||||||||||||||||||
| 37 | && (
| 0 | ||||||||||||||||||||||||
| 38 | ERR_put_error(16,(194),((2|64)),__FILE__,52) | - | ||||||||||||||||||||||||
| 39 | ; | - | ||||||||||||||||||||||||
| 40 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 41 | } | - | ||||||||||||||||||||||||
| 42 | - | |||||||||||||||||||||||||
| 43 | if (k
| 0 | ||||||||||||||||||||||||
| 44 | * never executed: k = group->poly[1];*k = group->poly[1];never executed: *k = group->poly[1]; | 0 | ||||||||||||||||||||||||
| 45 | - | |||||||||||||||||||||||||
| 46 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 47 | } | - | ||||||||||||||||||||||||
| 48 | - | |||||||||||||||||||||||||
| 49 | int EC_GROUP_get_pentanomial_basis(const EC_GROUP *group, unsigned int *k1, | - | ||||||||||||||||||||||||
| 50 | unsigned int *k2, unsigned int *k3) | - | ||||||||||||||||||||||||
| 51 | { | - | ||||||||||||||||||||||||
| 52 | if (group ==
| 0 | ||||||||||||||||||||||||
| 53 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 54 | ) | - | ||||||||||||||||||||||||
| 55 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 56 | - | |||||||||||||||||||||||||
| 57 | if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) !=
| 0 | ||||||||||||||||||||||||
| 58 | 407
| 0 | ||||||||||||||||||||||||
| 59 | || !((
| 0 | ||||||||||||||||||||||||
| 60 | && (
| 0 | ||||||||||||||||||||||||
| 61 | && (
| 0 | ||||||||||||||||||||||||
| 62 | ERR_put_error(16,(193),((2|64)),__FILE__,74) | - | ||||||||||||||||||||||||
| 63 | ; | - | ||||||||||||||||||||||||
| 64 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 65 | } | - | ||||||||||||||||||||||||
| 66 | - | |||||||||||||||||||||||||
| 67 | if (k1
| 0 | ||||||||||||||||||||||||
| 68 | * never executed: k1 = group->poly[3];*k1 = group->poly[3];never executed: *k1 = group->poly[3]; | 0 | ||||||||||||||||||||||||
| 69 | if (k2
| 0 | ||||||||||||||||||||||||
| 70 | * never executed: k2 = group->poly[2];*k2 = group->poly[2];never executed: *k2 = group->poly[2]; | 0 | ||||||||||||||||||||||||
| 71 | if (k3
| 0 | ||||||||||||||||||||||||
| 72 | * never executed: k3 = group->poly[1];*k3 = group->poly[1];never executed: *k3 = group->poly[1]; | 0 | ||||||||||||||||||||||||
| 73 | - | |||||||||||||||||||||||||
| 74 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 75 | } | - | ||||||||||||||||||||||||
| 76 | - | |||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||
| 78 | - | |||||||||||||||||||||||||
| 79 | typedef struct x9_62_pentanomial_st { | - | ||||||||||||||||||||||||
| 80 | int32_t k1; | - | ||||||||||||||||||||||||
| 81 | int32_t k2; | - | ||||||||||||||||||||||||
| 82 | int32_t k3; | - | ||||||||||||||||||||||||
| 83 | } X9_62_PENTANOMIAL; | - | ||||||||||||||||||||||||
| 84 | - | |||||||||||||||||||||||||
| 85 | typedef struct x9_62_characteristic_two_st { | - | ||||||||||||||||||||||||
| 86 | int32_t m; | - | ||||||||||||||||||||||||
| 87 | ASN1_OBJECT *type; | - | ||||||||||||||||||||||||
| 88 | union { | - | ||||||||||||||||||||||||
| 89 | char *ptr; | - | ||||||||||||||||||||||||
| 90 | - | |||||||||||||||||||||||||
| 91 | ASN1_NULL *onBasis; | - | ||||||||||||||||||||||||
| 92 | - | |||||||||||||||||||||||||
| 93 | ASN1_INTEGER *tpBasis; | - | ||||||||||||||||||||||||
| 94 | - | |||||||||||||||||||||||||
| 95 | X9_62_PENTANOMIAL *ppBasis; | - | ||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||
| 97 | ASN1_TYPE *other; | - | ||||||||||||||||||||||||
| 98 | } p; | - | ||||||||||||||||||||||||
| 99 | } X9_62_CHARACTERISTIC_TWO; | - | ||||||||||||||||||||||||
| 100 | - | |||||||||||||||||||||||||
| 101 | typedef struct x9_62_fieldid_st { | - | ||||||||||||||||||||||||
| 102 | ASN1_OBJECT *fieldType; | - | ||||||||||||||||||||||||
| 103 | union { | - | ||||||||||||||||||||||||
| 104 | char *ptr; | - | ||||||||||||||||||||||||
| 105 | - | |||||||||||||||||||||||||
| 106 | ASN1_INTEGER *prime; | - | ||||||||||||||||||||||||
| 107 | - | |||||||||||||||||||||||||
| 108 | X9_62_CHARACTERISTIC_TWO *char_two; | - | ||||||||||||||||||||||||
| 109 | - | |||||||||||||||||||||||||
| 110 | ASN1_TYPE *other; | - | ||||||||||||||||||||||||
| 111 | } p; | - | ||||||||||||||||||||||||
| 112 | } X9_62_FIELDID; | - | ||||||||||||||||||||||||
| 113 | - | |||||||||||||||||||||||||
| 114 | typedef struct x9_62_curve_st { | - | ||||||||||||||||||||||||
| 115 | ASN1_OCTET_STRING *a; | - | ||||||||||||||||||||||||
| 116 | ASN1_OCTET_STRING *b; | - | ||||||||||||||||||||||||
| 117 | ASN1_BIT_STRING *seed; | - | ||||||||||||||||||||||||
| 118 | } X9_62_CURVE; | - | ||||||||||||||||||||||||
| 119 | - | |||||||||||||||||||||||||
| 120 | struct ec_parameters_st { | - | ||||||||||||||||||||||||
| 121 | int32_t version; | - | ||||||||||||||||||||||||
| 122 | X9_62_FIELDID *fieldID; | - | ||||||||||||||||||||||||
| 123 | X9_62_CURVE *curve; | - | ||||||||||||||||||||||||
| 124 | ASN1_OCTET_STRING *base; | - | ||||||||||||||||||||||||
| 125 | ASN1_INTEGER *order; | - | ||||||||||||||||||||||||
| 126 | ASN1_INTEGER *cofactor; | - | ||||||||||||||||||||||||
| 127 | } ; | - | ||||||||||||||||||||||||
| 128 | - | |||||||||||||||||||||||||
| 129 | struct ecpk_parameters_st { | - | ||||||||||||||||||||||||
| 130 | int type; | - | ||||||||||||||||||||||||
| 131 | union { | - | ||||||||||||||||||||||||
| 132 | ASN1_OBJECT *named_curve; | - | ||||||||||||||||||||||||
| 133 | ECPARAMETERS *parameters; | - | ||||||||||||||||||||||||
| 134 | ASN1_NULL *implicitlyCA; | - | ||||||||||||||||||||||||
| 135 | } value; | - | ||||||||||||||||||||||||
| 136 | } ; | - | ||||||||||||||||||||||||
| 137 | - | |||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||
| 139 | typedef struct ec_privatekey_st { | - | ||||||||||||||||||||||||
| 140 | int32_t version; | - | ||||||||||||||||||||||||
| 141 | ASN1_OCTET_STRING *privateKey; | - | ||||||||||||||||||||||||
| 142 | ECPKPARAMETERS *parameters; | - | ||||||||||||||||||||||||
| 143 | ASN1_BIT_STRING *publicKey; | - | ||||||||||||||||||||||||
| 144 | } EC_PRIVATEKEY; | - | ||||||||||||||||||||||||
| 145 | - | |||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||
| 147 | static const ASN1_TEMPLATE X9_62_PENTANOMIAL_seq_tt[] = { | - | ||||||||||||||||||||||||
| 148 | { ((0x1 << 12)), (0), | - | ||||||||||||||||||||||||
| 149 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 150 | X9_62_PENTANOMIAL | - | ||||||||||||||||||||||||
| 151 | , | - | ||||||||||||||||||||||||
| 152 | k1 | - | ||||||||||||||||||||||||
| 153 | ) | - | ||||||||||||||||||||||||
| 154 | , "k1", (&(INT32_it)) }, | - | ||||||||||||||||||||||||
| 155 | { ((0x1 << 12)), (0), | - | ||||||||||||||||||||||||
| 156 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 157 | X9_62_PENTANOMIAL | - | ||||||||||||||||||||||||
| 158 | , | - | ||||||||||||||||||||||||
| 159 | k2 | - | ||||||||||||||||||||||||
| 160 | ) | - | ||||||||||||||||||||||||
| 161 | , "k2", (&(INT32_it)) }, | - | ||||||||||||||||||||||||
| 162 | { ((0x1 << 12)), (0), | - | ||||||||||||||||||||||||
| 163 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 164 | X9_62_PENTANOMIAL | - | ||||||||||||||||||||||||
| 165 | , | - | ||||||||||||||||||||||||
| 166 | k3 | - | ||||||||||||||||||||||||
| 167 | ) | - | ||||||||||||||||||||||||
| 168 | , "k3", (&(INT32_it)) } | - | ||||||||||||||||||||||||
| 169 | } ; static const ASN1_ITEM X9_62_PENTANOMIAL_it = { 0x1, 16, X9_62_PENTANOMIAL_seq_tt, sizeof(X9_62_PENTANOMIAL_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||||||||||||||
| 170 | ((void *)0) | - | ||||||||||||||||||||||||
| 171 | , sizeof(X9_62_PENTANOMIAL), "X9_62_PENTANOMIAL" }; | - | ||||||||||||||||||||||||
| 172 | - | |||||||||||||||||||||||||
| 173 | X9_62_PENTANOMIAL *X9_62_PENTANOMIAL_new(void); void X9_62_PENTANOMIAL_free(X9_62_PENTANOMIAL *a); | - | ||||||||||||||||||||||||
| 174 | X9_62_PENTANOMIAL *X9_62_PENTANOMIAL_new(void) { return never executed: (X9_62_PENTANOMIAL *)ASN1_item_new((&(X9_62_PENTANOMIAL_it)));return (X9_62_PENTANOMIAL *)ASN1_item_new((&(X9_62_PENTANOMIAL_it)));never executed: } void X9_62_PENTANOMIAL_free(X9_62_PENTANOMIAL *a) { ASN1_item_free((ASN1_VALUE *)a, (&(X9_62_PENTANOMIAL_it))); }return (X9_62_PENTANOMIAL *)ASN1_item_new((&(X9_62_PENTANOMIAL_it)));never executed: end of block | 0 | ||||||||||||||||||||||||
| 175 | - | |||||||||||||||||||||||||
| 176 | static const ASN1_TEMPLATE char_two_def_tt = { (0), (0), | - | ||||||||||||||||||||||||
| 177 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 178 | X9_62_CHARACTERISTIC_TWO | - | ||||||||||||||||||||||||
| 179 | , | - | ||||||||||||||||||||||||
| 180 | p.other | - | ||||||||||||||||||||||||
| 181 | ) | - | ||||||||||||||||||||||||
| 182 | , "p.other", (&(ASN1_ANY_it)) }; | - | ||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||
| 184 | static const ASN1_ADB_TABLE X9_62_CHARACTERISTIC_TWO_adbtbl[] = { | - | ||||||||||||||||||||||||
| 185 | {681, { (0), (0), | - | ||||||||||||||||||||||||
| 186 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 187 | X9_62_CHARACTERISTIC_TWO | - | ||||||||||||||||||||||||
| 188 | , | - | ||||||||||||||||||||||||
| 189 | p.onBasis | - | ||||||||||||||||||||||||
| 190 | ) | - | ||||||||||||||||||||||||
| 191 | , "p.onBasis", (&(ASN1_NULL_it)) }}, | - | ||||||||||||||||||||||||
| 192 | {682, { (0), (0), | - | ||||||||||||||||||||||||
| 193 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 194 | X9_62_CHARACTERISTIC_TWO | - | ||||||||||||||||||||||||
| 195 | , | - | ||||||||||||||||||||||||
| 196 | p.tpBasis | - | ||||||||||||||||||||||||
| 197 | ) | - | ||||||||||||||||||||||||
| 198 | , "p.tpBasis", (&(ASN1_INTEGER_it)) }}, | - | ||||||||||||||||||||||||
| 199 | {683, { (0), (0), | - | ||||||||||||||||||||||||
| 200 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 201 | X9_62_CHARACTERISTIC_TWO | - | ||||||||||||||||||||||||
| 202 | , | - | ||||||||||||||||||||||||
| 203 | p.ppBasis | - | ||||||||||||||||||||||||
| 204 | ) | - | ||||||||||||||||||||||||
| 205 | , "p.ppBasis", (&(X9_62_PENTANOMIAL_it)) }} | - | ||||||||||||||||||||||||
| 206 | } ; static const ASN1_ADB X9_62_CHARACTERISTIC_TWO_adb = { 0, | - | ||||||||||||||||||||||||
| 207 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 208 | X9_62_CHARACTERISTIC_TWO | - | ||||||||||||||||||||||||
| 209 | , | - | ||||||||||||||||||||||||
| 210 | type | - | ||||||||||||||||||||||||
| 211 | ) | - | ||||||||||||||||||||||||
| 212 | , 0, X9_62_CHARACTERISTIC_TWO_adbtbl, sizeof(X9_62_CHARACTERISTIC_TWO_adbtbl) / sizeof(ASN1_ADB_TABLE), &char_two_def_tt, | - | ||||||||||||||||||||||||
| 213 | ((void *)0) | - | ||||||||||||||||||||||||
| 214 | }; | - | ||||||||||||||||||||||||
| 215 | - | |||||||||||||||||||||||||
| 216 | static const ASN1_TEMPLATE X9_62_CHARACTERISTIC_TWO_seq_tt[] = { | - | ||||||||||||||||||||||||
| 217 | { ((0x1 << 12)), (0), | - | ||||||||||||||||||||||||
| 218 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 219 | X9_62_CHARACTERISTIC_TWO | - | ||||||||||||||||||||||||
| 220 | , | - | ||||||||||||||||||||||||
| 221 | m | - | ||||||||||||||||||||||||
| 222 | ) | - | ||||||||||||||||||||||||
| 223 | , "m", (&(INT32_it)) }, | - | ||||||||||||||||||||||||
| 224 | { (0), (0), | - | ||||||||||||||||||||||||
| 225 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 226 | X9_62_CHARACTERISTIC_TWO | - | ||||||||||||||||||||||||
| 227 | , | - | ||||||||||||||||||||||||
| 228 | type | - | ||||||||||||||||||||||||
| 229 | ) | - | ||||||||||||||||||||||||
| 230 | , "type", (&(ASN1_OBJECT_it)) }, | - | ||||||||||||||||||||||||
| 231 | { (0x1<<8), -1, 0, "X9_62_CHARACTERISTIC_TWO", (const ASN1_ITEM *)&(X9_62_CHARACTERISTIC_TWO_adb) } | - | ||||||||||||||||||||||||
| 232 | } ; static const ASN1_ITEM X9_62_CHARACTERISTIC_TWO_it = { 0x1, 16, X9_62_CHARACTERISTIC_TWO_seq_tt, sizeof(X9_62_CHARACTERISTIC_TWO_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||||||||||||||
| 233 | ((void *)0) | - | ||||||||||||||||||||||||
| 234 | , sizeof(X9_62_CHARACTERISTIC_TWO), "X9_62_CHARACTERISTIC_TWO" }; | - | ||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||
| 236 | X9_62_CHARACTERISTIC_TWO *X9_62_CHARACTERISTIC_TWO_new(void); void X9_62_CHARACTERISTIC_TWO_free(X9_62_CHARACTERISTIC_TWO *a); | - | ||||||||||||||||||||||||
| 237 | X9_62_CHARACTERISTIC_TWO *X9_62_CHARACTERISTIC_TWO_new(void) { return never executed: (X9_62_CHARACTERISTIC_TWO *)ASN1_item_new((&(X9_62_CHARACTERISTIC_TWO_it)));return (X9_62_CHARACTERISTIC_TWO *)ASN1_item_new((&(X9_62_CHARACTERISTIC_TWO_it)));never executed: } void X9_62_CHARACTERISTIC_TWO_free(X9_62_CHARACTERISTIC_TWO *a) { ASN1_item_free((ASN1_VALUE *)a, (&(X9_62_CHARACTERISTIC_TWO_it))); }return (X9_62_CHARACTERISTIC_TWO *)ASN1_item_new((&(X9_62_CHARACTERISTIC_TWO_it)));never executed: end of block | 0 | ||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||
| 239 | static const ASN1_TEMPLATE fieldID_def_tt = { (0), (0), | - | ||||||||||||||||||||||||
| 240 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 241 | X9_62_FIELDID | - | ||||||||||||||||||||||||
| 242 | , | - | ||||||||||||||||||||||||
| 243 | p.other | - | ||||||||||||||||||||||||
| 244 | ) | - | ||||||||||||||||||||||||
| 245 | , "p.other", (&(ASN1_ANY_it)) }; | - | ||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||
| 247 | static const ASN1_ADB_TABLE X9_62_FIELDID_adbtbl[] = { | - | ||||||||||||||||||||||||
| 248 | {406, { (0), (0), | - | ||||||||||||||||||||||||
| 249 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 250 | X9_62_FIELDID | - | ||||||||||||||||||||||||
| 251 | , | - | ||||||||||||||||||||||||
| 252 | p.prime | - | ||||||||||||||||||||||||
| 253 | ) | - | ||||||||||||||||||||||||
| 254 | , "p.prime", (&(ASN1_INTEGER_it)) }}, | - | ||||||||||||||||||||||||
| 255 | {407, { (0), (0), | - | ||||||||||||||||||||||||
| 256 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 257 | X9_62_FIELDID | - | ||||||||||||||||||||||||
| 258 | , | - | ||||||||||||||||||||||||
| 259 | p.char_two | - | ||||||||||||||||||||||||
| 260 | ) | - | ||||||||||||||||||||||||
| 261 | , "p.char_two", (&(X9_62_CHARACTERISTIC_TWO_it)) }} | - | ||||||||||||||||||||||||
| 262 | } ; static const ASN1_ADB X9_62_FIELDID_adb = { 0, | - | ||||||||||||||||||||||||
| 263 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 264 | X9_62_FIELDID | - | ||||||||||||||||||||||||
| 265 | , | - | ||||||||||||||||||||||||
| 266 | fieldType | - | ||||||||||||||||||||||||
| 267 | ) | - | ||||||||||||||||||||||||
| 268 | , 0, X9_62_FIELDID_adbtbl, sizeof(X9_62_FIELDID_adbtbl) / sizeof(ASN1_ADB_TABLE), &fieldID_def_tt, | - | ||||||||||||||||||||||||
| 269 | ((void *)0) | - | ||||||||||||||||||||||||
| 270 | }; | - | ||||||||||||||||||||||||
| 271 | - | |||||||||||||||||||||||||
| 272 | static const ASN1_TEMPLATE X9_62_FIELDID_seq_tt[] = { | - | ||||||||||||||||||||||||
| 273 | { (0), (0), | - | ||||||||||||||||||||||||
| 274 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 275 | X9_62_FIELDID | - | ||||||||||||||||||||||||
| 276 | , | - | ||||||||||||||||||||||||
| 277 | fieldType | - | ||||||||||||||||||||||||
| 278 | ) | - | ||||||||||||||||||||||||
| 279 | , "fieldType", (&(ASN1_OBJECT_it)) }, | - | ||||||||||||||||||||||||
| 280 | { (0x1<<8), -1, 0, "X9_62_FIELDID", (const ASN1_ITEM *)&(X9_62_FIELDID_adb) } | - | ||||||||||||||||||||||||
| 281 | } ; static const ASN1_ITEM X9_62_FIELDID_it = { 0x1, 16, X9_62_FIELDID_seq_tt, sizeof(X9_62_FIELDID_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||||||||||||||
| 282 | ((void *)0) | - | ||||||||||||||||||||||||
| 283 | , sizeof(X9_62_FIELDID), "X9_62_FIELDID" }; | - | ||||||||||||||||||||||||
| 284 | - | |||||||||||||||||||||||||
| 285 | static const ASN1_TEMPLATE X9_62_CURVE_seq_tt[] = { | - | ||||||||||||||||||||||||
| 286 | { (0), (0), | - | ||||||||||||||||||||||||
| 287 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 288 | X9_62_CURVE | - | ||||||||||||||||||||||||
| 289 | , | - | ||||||||||||||||||||||||
| 290 | a | - | ||||||||||||||||||||||||
| 291 | ) | - | ||||||||||||||||||||||||
| 292 | , "a", (&(ASN1_OCTET_STRING_it)) }, | - | ||||||||||||||||||||||||
| 293 | { (0), (0), | - | ||||||||||||||||||||||||
| 294 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 295 | X9_62_CURVE | - | ||||||||||||||||||||||||
| 296 | , | - | ||||||||||||||||||||||||
| 297 | b | - | ||||||||||||||||||||||||
| 298 | ) | - | ||||||||||||||||||||||||
| 299 | , "b", (&(ASN1_OCTET_STRING_it)) }, | - | ||||||||||||||||||||||||
| 300 | { ((0x1)), (0), | - | ||||||||||||||||||||||||
| 301 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 302 | X9_62_CURVE | - | ||||||||||||||||||||||||
| 303 | , | - | ||||||||||||||||||||||||
| 304 | seed | - | ||||||||||||||||||||||||
| 305 | ) | - | ||||||||||||||||||||||||
| 306 | , "seed", (&(ASN1_BIT_STRING_it)) } | - | ||||||||||||||||||||||||
| 307 | } ; static const ASN1_ITEM X9_62_CURVE_it = { 0x1, 16, X9_62_CURVE_seq_tt, sizeof(X9_62_CURVE_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||||||||||||||
| 308 | ((void *)0) | - | ||||||||||||||||||||||||
| 309 | , sizeof(X9_62_CURVE), "X9_62_CURVE" }; | - | ||||||||||||||||||||||||
| 310 | - | |||||||||||||||||||||||||
| 311 | static const ASN1_TEMPLATE ECPARAMETERS_seq_tt[] = { | - | ||||||||||||||||||||||||
| 312 | { ((0x1 << 12)), (0), | - | ||||||||||||||||||||||||
| 313 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 314 | ECPARAMETERS | - | ||||||||||||||||||||||||
| 315 | , | - | ||||||||||||||||||||||||
| 316 | version | - | ||||||||||||||||||||||||
| 317 | ) | - | ||||||||||||||||||||||||
| 318 | , "version", (&(INT32_it)) }, | - | ||||||||||||||||||||||||
| 319 | { (0), (0), | - | ||||||||||||||||||||||||
| 320 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 321 | ECPARAMETERS | - | ||||||||||||||||||||||||
| 322 | , | - | ||||||||||||||||||||||||
| 323 | fieldID | - | ||||||||||||||||||||||||
| 324 | ) | - | ||||||||||||||||||||||||
| 325 | , "fieldID", (&(X9_62_FIELDID_it)) }, | - | ||||||||||||||||||||||||
| 326 | { (0), (0), | - | ||||||||||||||||||||||||
| 327 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 328 | ECPARAMETERS | - | ||||||||||||||||||||||||
| 329 | , | - | ||||||||||||||||||||||||
| 330 | curve | - | ||||||||||||||||||||||||
| 331 | ) | - | ||||||||||||||||||||||||
| 332 | , "curve", (&(X9_62_CURVE_it)) }, | - | ||||||||||||||||||||||||
| 333 | { (0), (0), | - | ||||||||||||||||||||||||
| 334 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 335 | ECPARAMETERS | - | ||||||||||||||||||||||||
| 336 | , | - | ||||||||||||||||||||||||
| 337 | base | - | ||||||||||||||||||||||||
| 338 | ) | - | ||||||||||||||||||||||||
| 339 | , "base", (&(ASN1_OCTET_STRING_it)) }, | - | ||||||||||||||||||||||||
| 340 | { (0), (0), | - | ||||||||||||||||||||||||
| 341 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 342 | ECPARAMETERS | - | ||||||||||||||||||||||||
| 343 | , | - | ||||||||||||||||||||||||
| 344 | order | - | ||||||||||||||||||||||||
| 345 | ) | - | ||||||||||||||||||||||||
| 346 | , "order", (&(ASN1_INTEGER_it)) }, | - | ||||||||||||||||||||||||
| 347 | { ((0x1)), (0), | - | ||||||||||||||||||||||||
| 348 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 349 | ECPARAMETERS | - | ||||||||||||||||||||||||
| 350 | , | - | ||||||||||||||||||||||||
| 351 | cofactor | - | ||||||||||||||||||||||||
| 352 | ) | - | ||||||||||||||||||||||||
| 353 | , "cofactor", (&(ASN1_INTEGER_it)) } | - | ||||||||||||||||||||||||
| 354 | } ; const ASN1_ITEM ECPARAMETERS_it = { 0x1, 16, ECPARAMETERS_seq_tt, sizeof(ECPARAMETERS_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||||||||||||||
| 355 | ((void *)0) | - | ||||||||||||||||||||||||
| 356 | , sizeof(ECPARAMETERS), "ECPARAMETERS" }; | - | ||||||||||||||||||||||||
| 357 | - | |||||||||||||||||||||||||
| 358 | ECPARAMETERS *ECPARAMETERS_new(void); void ECPARAMETERS_free(ECPARAMETERS *a); | - | ||||||||||||||||||||||||
| 359 | ECPARAMETERS *ECPARAMETERS_new(void) { return executed 47 times by 1 test: (ECPARAMETERS *)ASN1_item_new((&(ECPARAMETERS_it)));return (ECPARAMETERS *)ASN1_item_new((&(ECPARAMETERS_it)));Executed by:
executed 47 times by 1 test: } void ECPARAMETERS_free(ECPARAMETERS *a) { ASN1_item_free((ASN1_VALUE *)a, (&(ECPARAMETERS_it))); }return (ECPARAMETERS *)ASN1_item_new((&(ECPARAMETERS_it)));Executed by:
executed 1 time by 1 test: end of blockExecuted by:
| 1-47 | ||||||||||||||||||||||||
| 360 | - | |||||||||||||||||||||||||
| 361 | static const ASN1_TEMPLATE ECPKPARAMETERS_ch_tt[] = { | - | ||||||||||||||||||||||||
| 362 | { (0), (0), | - | ||||||||||||||||||||||||
| 363 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 364 | ECPKPARAMETERS | - | ||||||||||||||||||||||||
| 365 | , | - | ||||||||||||||||||||||||
| 366 | value.named_curve | - | ||||||||||||||||||||||||
| 367 | ) | - | ||||||||||||||||||||||||
| 368 | , "value.named_curve", (&(ASN1_OBJECT_it)) }, | - | ||||||||||||||||||||||||
| 369 | { (0), (0), | - | ||||||||||||||||||||||||
| 370 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 371 | ECPKPARAMETERS | - | ||||||||||||||||||||||||
| 372 | , | - | ||||||||||||||||||||||||
| 373 | value.parameters | - | ||||||||||||||||||||||||
| 374 | ) | - | ||||||||||||||||||||||||
| 375 | , "value.parameters", (&(ECPARAMETERS_it)) }, | - | ||||||||||||||||||||||||
| 376 | { (0), (0), | - | ||||||||||||||||||||||||
| 377 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 378 | ECPKPARAMETERS | - | ||||||||||||||||||||||||
| 379 | , | - | ||||||||||||||||||||||||
| 380 | value.implicitlyCA | - | ||||||||||||||||||||||||
| 381 | ) | - | ||||||||||||||||||||||||
| 382 | , "value.implicitlyCA", (&(ASN1_NULL_it)) } | - | ||||||||||||||||||||||||
| 383 | } ; const ASN1_ITEM ECPKPARAMETERS_it = { 0x2, | - | ||||||||||||||||||||||||
| 384 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 385 | ECPKPARAMETERS | - | ||||||||||||||||||||||||
| 386 | , | - | ||||||||||||||||||||||||
| 387 | type | - | ||||||||||||||||||||||||
| 388 | ) | - | ||||||||||||||||||||||||
| 389 | , ECPKPARAMETERS_ch_tt, sizeof(ECPKPARAMETERS_ch_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||||||||||||||
| 390 | ((void *)0) | - | ||||||||||||||||||||||||
| 391 | , sizeof(ECPKPARAMETERS), "ECPKPARAMETERS" }; | - | ||||||||||||||||||||||||
| 392 | - | |||||||||||||||||||||||||
| 393 | ECPKPARAMETERS *ECPKPARAMETERS_new(void); void ECPKPARAMETERS_free(ECPKPARAMETERS *a); ECPKPARAMETERS *d2i_ECPKPARAMETERS(ECPKPARAMETERS **a, const unsigned char **in, long len); int i2d_ECPKPARAMETERS(const ECPKPARAMETERS *a, unsigned char **out); extern const ASN1_ITEM ECPKPARAMETERS_it; | - | ||||||||||||||||||||||||
| 394 | ECPKPARAMETERS *d2i_ECPKPARAMETERS(ECPKPARAMETERS **a, const unsigned char **in, long len); int i2d_ECPKPARAMETERS(const ECPKPARAMETERS *a, unsigned char **out); extern const ASN1_ITEM ECPKPARAMETERS_it; | - | ||||||||||||||||||||||||
| 395 | ECPKPARAMETERS *d2i_ECPKPARAMETERS(ECPKPARAMETERS **a, const unsigned char **in, long len) { return executed 8699 times by 1 test: (ECPKPARAMETERS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ECPKPARAMETERS_it)));return (ECPKPARAMETERS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ECPKPARAMETERS_it)));Executed by:
executed 8699 times by 1 test: } int i2d_ECPKPARAMETERS(const ECPKPARAMETERS *a, unsigned char **out) { returnreturn (ECPKPARAMETERS *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ECPKPARAMETERS_it)));Executed by:
executed 48 times by 1 test: ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ECPKPARAMETERS_it)));return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ECPKPARAMETERS_it)));Executed by:
executed 48 times by 1 test: } ECPKPARAMETERS *ECPKPARAMETERS_new(void) { returnreturn ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ECPKPARAMETERS_it)));Executed by:
executed 254 times by 1 test: (ECPKPARAMETERS *)ASN1_item_new((&(ECPKPARAMETERS_it)));return (ECPKPARAMETERS *)ASN1_item_new((&(ECPKPARAMETERS_it)));Executed by:
executed 254 times by 1 test: } void ECPKPARAMETERS_free(ECPKPARAMETERS *a) { ASN1_item_free((ASN1_VALUE *)a, (&(ECPKPARAMETERS_it))); }return (ECPKPARAMETERS *)ASN1_item_new((&(ECPKPARAMETERS_it)));Executed by:
executed 8747 times by 1 test: end of blockExecuted by:
| 48-8747 | ||||||||||||||||||||||||
| 396 | - | |||||||||||||||||||||||||
| 397 | static const ASN1_TEMPLATE EC_PRIVATEKEY_seq_tt[] = { | - | ||||||||||||||||||||||||
| 398 | { ((0x1 << 12)), (0), | - | ||||||||||||||||||||||||
| 399 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 400 | EC_PRIVATEKEY | - | ||||||||||||||||||||||||
| 401 | , | - | ||||||||||||||||||||||||
| 402 | version | - | ||||||||||||||||||||||||
| 403 | ) | - | ||||||||||||||||||||||||
| 404 | , "version", (&(INT32_it)) }, | - | ||||||||||||||||||||||||
| 405 | { (0), (0), | - | ||||||||||||||||||||||||
| 406 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 407 | EC_PRIVATEKEY | - | ||||||||||||||||||||||||
| 408 | , | - | ||||||||||||||||||||||||
| 409 | privateKey | - | ||||||||||||||||||||||||
| 410 | ) | - | ||||||||||||||||||||||||
| 411 | , "privateKey", (&(ASN1_OCTET_STRING_it)) }, | - | ||||||||||||||||||||||||
| 412 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (0), | - | ||||||||||||||||||||||||
| 413 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 414 | EC_PRIVATEKEY | - | ||||||||||||||||||||||||
| 415 | , | - | ||||||||||||||||||||||||
| 416 | parameters | - | ||||||||||||||||||||||||
| 417 | ) | - | ||||||||||||||||||||||||
| 418 | , "parameters", (&(ECPKPARAMETERS_it)) }, | - | ||||||||||||||||||||||||
| 419 | { (((0x2 << 3)|(0x2<<6)) | ((0x1))), (1), | - | ||||||||||||||||||||||||
| 420 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 421 | EC_PRIVATEKEY | - | ||||||||||||||||||||||||
| 422 | , | - | ||||||||||||||||||||||||
| 423 | publicKey | - | ||||||||||||||||||||||||
| 424 | ) | - | ||||||||||||||||||||||||
| 425 | , "publicKey", (&(ASN1_BIT_STRING_it)) } | - | ||||||||||||||||||||||||
| 426 | } ; static const ASN1_ITEM EC_PRIVATEKEY_it = { 0x1, 16, EC_PRIVATEKEY_seq_tt, sizeof(EC_PRIVATEKEY_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||||||||||||||
| 427 | ((void *)0) | - | ||||||||||||||||||||||||
| 428 | , sizeof(EC_PRIVATEKEY), "EC_PRIVATEKEY" }; | - | ||||||||||||||||||||||||
| 429 | - | |||||||||||||||||||||||||
| 430 | EC_PRIVATEKEY *EC_PRIVATEKEY_new(void); void EC_PRIVATEKEY_free(EC_PRIVATEKEY *a); EC_PRIVATEKEY *d2i_EC_PRIVATEKEY(EC_PRIVATEKEY **a, const unsigned char **in, long len); int i2d_EC_PRIVATEKEY(const EC_PRIVATEKEY *a, unsigned char **out); extern const ASN1_ITEM EC_PRIVATEKEY_it; | - | ||||||||||||||||||||||||
| 431 | EC_PRIVATEKEY *d2i_EC_PRIVATEKEY(EC_PRIVATEKEY **a, const unsigned char **in, long len); int i2d_EC_PRIVATEKEY(const EC_PRIVATEKEY *a, unsigned char **out); extern const ASN1_ITEM EC_PRIVATEKEY_it; | - | ||||||||||||||||||||||||
| 432 | EC_PRIVATEKEY *d2i_EC_PRIVATEKEY(EC_PRIVATEKEY **a, const unsigned char **in, long len) { return executed 6352 times by 1 test: (EC_PRIVATEKEY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(EC_PRIVATEKEY_it)));return (EC_PRIVATEKEY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(EC_PRIVATEKEY_it)));Executed by:
executed 6352 times by 1 test: } int i2d_EC_PRIVATEKEY(const EC_PRIVATEKEY *a, unsigned char **out) { returnreturn (EC_PRIVATEKEY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(EC_PRIVATEKEY_it)));Executed by:
executed 216 times by 1 test: ASN1_item_i2d((ASN1_VALUE *)a, out, (&(EC_PRIVATEKEY_it)));return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(EC_PRIVATEKEY_it)));Executed by:
executed 216 times by 1 test: } EC_PRIVATEKEY *EC_PRIVATEKEY_new(void) { returnreturn ASN1_item_i2d((ASN1_VALUE *)a, out, (&(EC_PRIVATEKEY_it)));Executed by:
executed 255 times by 1 test: (EC_PRIVATEKEY *)ASN1_item_new((&(EC_PRIVATEKEY_it)));return (EC_PRIVATEKEY *)ASN1_item_new((&(EC_PRIVATEKEY_it)));Executed by:
executed 255 times by 1 test: } void EC_PRIVATEKEY_free(EC_PRIVATEKEY *a) { ASN1_item_free((ASN1_VALUE *)a, (&(EC_PRIVATEKEY_it))); }return (EC_PRIVATEKEY *)ASN1_item_new((&(EC_PRIVATEKEY_it)));Executed by:
executed 3315 times by 1 test: end of blockExecuted by:
| 216-6352 | ||||||||||||||||||||||||
| 433 | - | |||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||
| 435 | - | |||||||||||||||||||||||||
| 436 | - | |||||||||||||||||||||||||
| 437 | static int ec_asn1_group2fieldid(const EC_GROUP *, X9_62_FIELDID *); | - | ||||||||||||||||||||||||
| 438 | - | |||||||||||||||||||||||||
| 439 | static int ec_asn1_group2curve(const EC_GROUP *, X9_62_CURVE *); | - | ||||||||||||||||||||||||
| 440 | - | |||||||||||||||||||||||||
| 441 | - | |||||||||||||||||||||||||
| 442 | - | |||||||||||||||||||||||||
| 443 | static int ec_asn1_group2fieldid(const EC_GROUP *group, X9_62_FIELDID *field) | - | ||||||||||||||||||||||||
| 444 | { | - | ||||||||||||||||||||||||
| 445 | int ok = 0, nid; | - | ||||||||||||||||||||||||
| 446 | BIGNUM *tmp = | - | ||||||||||||||||||||||||
| 447 | ((void *)0) | - | ||||||||||||||||||||||||
| 448 | ; | - | ||||||||||||||||||||||||
| 449 | - | |||||||||||||||||||||||||
| 450 | if (group ==
| 0-47 | ||||||||||||||||||||||||
| 451 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 452 | || field ==
| 0-47 | ||||||||||||||||||||||||
| 453 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 454 | ) | - | ||||||||||||||||||||||||
| 455 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 456 | - | |||||||||||||||||||||||||
| 457 | - | |||||||||||||||||||||||||
| 458 | ASN1_OBJECT_free(field->fieldType); | - | ||||||||||||||||||||||||
| 459 | ASN1_TYPE_free(field->p.other); | - | ||||||||||||||||||||||||
| 460 | - | |||||||||||||||||||||||||
| 461 | nid = EC_METHOD_get_field_type(EC_GROUP_method_of(group)); | - | ||||||||||||||||||||||||
| 462 | - | |||||||||||||||||||||||||
| 463 | if ((
| 0-47 | ||||||||||||||||||||||||
| 464 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 465 | ) { | - | ||||||||||||||||||||||||
| 466 | ERR_put_error(16,(154),(8),__FILE__,259); | - | ||||||||||||||||||||||||
| 467 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 468 | } | - | ||||||||||||||||||||||||
| 469 | - | |||||||||||||||||||||||||
| 470 | if (nid == 406
| 0-47 | ||||||||||||||||||||||||
| 471 | if ((
| 0-47 | ||||||||||||||||||||||||
| 472 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 473 | ) { | - | ||||||||||||||||||||||||
| 474 | ERR_put_error(16,(154),((1|64)),__FILE__,265); | - | ||||||||||||||||||||||||
| 475 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 476 | } | - | ||||||||||||||||||||||||
| 477 | - | |||||||||||||||||||||||||
| 478 | if (!EC_GROUP_get_curve(group, tmp,
| 0-47 | ||||||||||||||||||||||||
| 479 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 480 | ,
| 0-47 | ||||||||||||||||||||||||
| 481 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 482 | ,
| 0-47 | ||||||||||||||||||||||||
| 483 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 484 | )
| 0-47 | ||||||||||||||||||||||||
| 485 | ERR_put_error(16,(154),(16),__FILE__,270); | - | ||||||||||||||||||||||||
| 486 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 487 | } | - | ||||||||||||||||||||||||
| 488 | - | |||||||||||||||||||||||||
| 489 | field->p.prime = BN_to_ASN1_INTEGER(tmp, | - | ||||||||||||||||||||||||
| 490 | ((void *)0) | - | ||||||||||||||||||||||||
| 491 | ); | - | ||||||||||||||||||||||||
| 492 | if (field->p.prime ==
| 0-47 | ||||||||||||||||||||||||
| 493 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 494 | ) { | - | ||||||||||||||||||||||||
| 495 | ERR_put_error(16,(154),(13),__FILE__,276); | - | ||||||||||||||||||||||||
| 496 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 497 | } | - | ||||||||||||||||||||||||
| 498 | } executed 47 times by 1 test: else if (nid == 407end of blockExecuted by:
| 0-47 | ||||||||||||||||||||||||
| 499 | - | |||||||||||||||||||||||||
| 500 | - | |||||||||||||||||||||||||
| 501 | - | |||||||||||||||||||||||||
| 502 | - | |||||||||||||||||||||||||
| 503 | - | |||||||||||||||||||||||||
| 504 | - | |||||||||||||||||||||||||
| 505 | { | - | ||||||||||||||||||||||||
| 506 | int field_type; | - | ||||||||||||||||||||||||
| 507 | X9_62_CHARACTERISTIC_TWO *char_two; | - | ||||||||||||||||||||||||
| 508 | - | |||||||||||||||||||||||||
| 509 | field->p.char_two = X9_62_CHARACTERISTIC_TWO_new(); | - | ||||||||||||||||||||||||
| 510 | char_two = field->p.char_two; | - | ||||||||||||||||||||||||
| 511 | - | |||||||||||||||||||||||||
| 512 | if (char_two ==
| 0 | ||||||||||||||||||||||||
| 513 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 514 | ) { | - | ||||||||||||||||||||||||
| 515 | ERR_put_error(16,(154),((1|64)),__FILE__,294); | - | ||||||||||||||||||||||||
| 516 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 517 | } | - | ||||||||||||||||||||||||
| 518 | - | |||||||||||||||||||||||||
| 519 | char_two->m = (long)EC_GROUP_get_degree(group); | - | ||||||||||||||||||||||||
| 520 | - | |||||||||||||||||||||||||
| 521 | field_type = EC_GROUP_get_basis_type(group); | - | ||||||||||||||||||||||||
| 522 | - | |||||||||||||||||||||||||
| 523 | if (field_type == 0
| 0 | ||||||||||||||||||||||||
| 524 | ERR_put_error(16,(154),(16),__FILE__,303); | - | ||||||||||||||||||||||||
| 525 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 526 | } | - | ||||||||||||||||||||||||
| 527 | - | |||||||||||||||||||||||||
| 528 | if ((
| 0 | ||||||||||||||||||||||||
| 529 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 530 | ) { | - | ||||||||||||||||||||||||
| 531 | ERR_put_error(16,(154),(8),__FILE__,308); | - | ||||||||||||||||||||||||
| 532 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 533 | } | - | ||||||||||||||||||||||||
| 534 | - | |||||||||||||||||||||||||
| 535 | if (field_type == 682
| 0 | ||||||||||||||||||||||||
| 536 | unsigned int k; | - | ||||||||||||||||||||||||
| 537 | - | |||||||||||||||||||||||||
| 538 | if (!EC_GROUP_get_trinomial_basis(group, &k)
| 0 | ||||||||||||||||||||||||
| 539 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 540 | - | |||||||||||||||||||||||||
| 541 | char_two->p.tpBasis = ASN1_INTEGER_new(); | - | ||||||||||||||||||||||||
| 542 | if (char_two->p.tpBasis ==
| 0 | ||||||||||||||||||||||||
| 543 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 544 | ) { | - | ||||||||||||||||||||||||
| 545 | ERR_put_error(16,(154),((1|64)),__FILE__,320); | - | ||||||||||||||||||||||||
| 546 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 547 | } | - | ||||||||||||||||||||||||
| 548 | if (!ASN1_INTEGER_set(char_two->p.tpBasis, (long)k)
| 0 | ||||||||||||||||||||||||
| 549 | ERR_put_error(16,(154),(13),__FILE__,324); | - | ||||||||||||||||||||||||
| 550 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 551 | } | - | ||||||||||||||||||||||||
| 552 | } never executed: else if (field_type == 683end of block
| 0 | ||||||||||||||||||||||||
| 553 | unsigned int k1, k2, k3; | - | ||||||||||||||||||||||||
| 554 | - | |||||||||||||||||||||||||
| 555 | if (!EC_GROUP_get_pentanomial_basis(group, &k1, &k2, &k3)
| 0 | ||||||||||||||||||||||||
| 556 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 557 | - | |||||||||||||||||||||||||
| 558 | char_two->p.ppBasis = X9_62_PENTANOMIAL_new(); | - | ||||||||||||||||||||||||
| 559 | if (char_two->p.ppBasis ==
| 0 | ||||||||||||||||||||||||
| 560 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 561 | ) { | - | ||||||||||||||||||||||||
| 562 | ERR_put_error(16,(154),((1|64)),__FILE__,335); | - | ||||||||||||||||||||||||
| 563 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 564 | } | - | ||||||||||||||||||||||||
| 565 | - | |||||||||||||||||||||||||
| 566 | - | |||||||||||||||||||||||||
| 567 | char_two->p.ppBasis->k1 = (long)k1; | - | ||||||||||||||||||||||||
| 568 | char_two->p.ppBasis->k2 = (long)k2; | - | ||||||||||||||||||||||||
| 569 | char_two->p.ppBasis->k3 = (long)k3; | - | ||||||||||||||||||||||||
| 570 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 571 | - | |||||||||||||||||||||||||
| 572 | - | |||||||||||||||||||||||||
| 573 | char_two->p.onBasis = ASN1_NULL_new(); | - | ||||||||||||||||||||||||
| 574 | if (char_two->p.onBasis ==
| 0 | ||||||||||||||||||||||||
| 575 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 576 | ) { | - | ||||||||||||||||||||||||
| 577 | ERR_put_error(16,(154),((1|64)),__FILE__,348); | - | ||||||||||||||||||||||||
| 578 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 579 | } | - | ||||||||||||||||||||||||
| 580 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 581 | } | - | ||||||||||||||||||||||||
| 582 | - | |||||||||||||||||||||||||
| 583 | else { | - | ||||||||||||||||||||||||
| 584 | ERR_put_error(16,(154),(131),__FILE__,355); | - | ||||||||||||||||||||||||
| 585 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 586 | } | - | ||||||||||||||||||||||||
| 587 | - | |||||||||||||||||||||||||
| 588 | ok = 1; | - | ||||||||||||||||||||||||
| 589 | - | |||||||||||||||||||||||||
| 590 | err: code before this statement executed 47 times by 1 test: err:Executed by:
| 47 | ||||||||||||||||||||||||
| 591 | BN_free(tmp); | - | ||||||||||||||||||||||||
| 592 | return executed 47 times by 1 test: ok;return ok;Executed by:
executed 47 times by 1 test: return ok;Executed by:
| 47 | ||||||||||||||||||||||||
| 593 | } | - | ||||||||||||||||||||||||
| 594 | - | |||||||||||||||||||||||||
| 595 | static int ec_asn1_group2curve(const EC_GROUP *group, X9_62_CURVE *curve) | - | ||||||||||||||||||||||||
| 596 | { | - | ||||||||||||||||||||||||
| 597 | int ok = 0; | - | ||||||||||||||||||||||||
| 598 | BIGNUM *tmp_1 = | - | ||||||||||||||||||||||||
| 599 | ((void *)0) | - | ||||||||||||||||||||||||
| 600 | , *tmp_2 = | - | ||||||||||||||||||||||||
| 601 | ((void *)0) | - | ||||||||||||||||||||||||
| 602 | ; | - | ||||||||||||||||||||||||
| 603 | unsigned char *a_buf = | - | ||||||||||||||||||||||||
| 604 | ((void *)0) | - | ||||||||||||||||||||||||
| 605 | , *b_buf = | - | ||||||||||||||||||||||||
| 606 | ((void *)0) | - | ||||||||||||||||||||||||
| 607 | ; | - | ||||||||||||||||||||||||
| 608 | size_t len; | - | ||||||||||||||||||||||||
| 609 | - | |||||||||||||||||||||||||
| 610 | if (!group
| 0-47 | ||||||||||||||||||||||||
| 611 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 612 | - | |||||||||||||||||||||||||
| 613 | if ((
| 0-47 | ||||||||||||||||||||||||
| 614 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 615 | || (
| 0-47 | ||||||||||||||||||||||||
| 616 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 617 | ) { | - | ||||||||||||||||||||||||
| 618 | ERR_put_error(16,(153),((1|64)),__FILE__,377); | - | ||||||||||||||||||||||||
| 619 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 620 | } | - | ||||||||||||||||||||||||
| 621 | - | |||||||||||||||||||||||||
| 622 | - | |||||||||||||||||||||||||
| 623 | if (!EC_GROUP_get_curve(group,
| 0-47 | ||||||||||||||||||||||||
| 624 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 625 | , tmp_1, tmp_2,
| 0-47 | ||||||||||||||||||||||||
| 626 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 627 | )
| 0-47 | ||||||||||||||||||||||||
| 628 | ERR_put_error(16,(153),(16),__FILE__,383); | - | ||||||||||||||||||||||||
| 629 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 630 | } | - | ||||||||||||||||||||||||
| 631 | - | |||||||||||||||||||||||||
| 632 | - | |||||||||||||||||||||||||
| 633 | - | |||||||||||||||||||||||||
| 634 | - | |||||||||||||||||||||||||
| 635 | - | |||||||||||||||||||||||||
| 636 | - | |||||||||||||||||||||||||
| 637 | len = ((size_t)EC_GROUP_get_degree(group) + 7) / 8; | - | ||||||||||||||||||||||||
| 638 | if ((
| 0-47 | ||||||||||||||||||||||||
| 639 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 640 | - | |||||||||||||||||||||||||
| 641 | || (
| 0-47 | ||||||||||||||||||||||||
| 642 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 643 | ) { | - | ||||||||||||||||||||||||
| 644 | ERR_put_error(16,(153),((1|64)),__FILE__,395); | - | ||||||||||||||||||||||||
| 645 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 646 | } | - | ||||||||||||||||||||||||
| 647 | if (BN_bn2binpad(tmp_1, a_buf, len) < 0
| 0-47 | ||||||||||||||||||||||||
| 648 | || BN_bn2binpad(tmp_2, b_buf, len) < 0
| 0-47 | ||||||||||||||||||||||||
| 649 | ERR_put_error(16,(153),(3),__FILE__,400); | - | ||||||||||||||||||||||||
| 650 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 651 | } | - | ||||||||||||||||||||||||
| 652 | - | |||||||||||||||||||||||||
| 653 | - | |||||||||||||||||||||||||
| 654 | if (!ASN1_OCTET_STRING_set(curve->a, a_buf, len)
| 0-47 | ||||||||||||||||||||||||
| 655 | || !ASN1_OCTET_STRING_set(curve->b, b_buf, len)
| 0-47 | ||||||||||||||||||||||||
| 656 | ERR_put_error(16,(153),(13),__FILE__,407); | - | ||||||||||||||||||||||||
| 657 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 658 | } | - | ||||||||||||||||||||||||
| 659 | - | |||||||||||||||||||||||||
| 660 | - | |||||||||||||||||||||||||
| 661 | if (group->seed
| 19-28 | ||||||||||||||||||||||||
| 662 | if (!curve->seed
| 0-19 | ||||||||||||||||||||||||
| 663 | if ((
| 0-19 | ||||||||||||||||||||||||
| 664 | ((void *)0)
| 0-19 | ||||||||||||||||||||||||
| 665 | ) { | - | ||||||||||||||||||||||||
| 666 | ERR_put_error(16,(153),((1|64)),__FILE__,415); | - | ||||||||||||||||||||||||
| 667 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 668 | } | - | ||||||||||||||||||||||||
| 669 | curve->seed->flags &= ~(0x08 | 0x07); | - | ||||||||||||||||||||||||
| 670 | curve->seed->flags |= 0x08; | - | ||||||||||||||||||||||||
| 671 | if (!ASN1_BIT_STRING_set(curve->seed, group->seed,
| 0-19 | ||||||||||||||||||||||||
| 672 | (int)group->seed_len)
| 0-19 | ||||||||||||||||||||||||
| 673 | ERR_put_error(16,(153),(13),__FILE__,422); | - | ||||||||||||||||||||||||
| 674 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 675 | } | - | ||||||||||||||||||||||||
| 676 | } executed 19 times by 1 test: else {end of blockExecuted by:
| 19 | ||||||||||||||||||||||||
| 677 | ASN1_BIT_STRING_free(curve->seed); | - | ||||||||||||||||||||||||
| 678 | curve->seed = | - | ||||||||||||||||||||||||
| 679 | ((void *)0) | - | ||||||||||||||||||||||||
| 680 | ; | - | ||||||||||||||||||||||||
| 681 | } executed 28 times by 1 test: end of blockExecuted by:
| 28 | ||||||||||||||||||||||||
| 682 | - | |||||||||||||||||||||||||
| 683 | ok = 1; | - | ||||||||||||||||||||||||
| 684 | - | |||||||||||||||||||||||||
| 685 | err: code before this statement executed 47 times by 1 test: err:Executed by:
| 47 | ||||||||||||||||||||||||
| 686 | CRYPTO_free(a_buf, __FILE__, 433); | - | ||||||||||||||||||||||||
| 687 | CRYPTO_free(b_buf, __FILE__, 434); | - | ||||||||||||||||||||||||
| 688 | BN_free(tmp_1); | - | ||||||||||||||||||||||||
| 689 | BN_free(tmp_2); | - | ||||||||||||||||||||||||
| 690 | return executed 47 times by 1 test: ok;return ok;Executed by:
executed 47 times by 1 test: return ok;Executed by:
| 47 | ||||||||||||||||||||||||
| 691 | } | - | ||||||||||||||||||||||||
| 692 | - | |||||||||||||||||||||||||
| 693 | ECPARAMETERS *EC_GROUP_get_ecparameters(const EC_GROUP *group, | - | ||||||||||||||||||||||||
| 694 | ECPARAMETERS *params) | - | ||||||||||||||||||||||||
| 695 | { | - | ||||||||||||||||||||||||
| 696 | size_t len = 0; | - | ||||||||||||||||||||||||
| 697 | ECPARAMETERS *ret = | - | ||||||||||||||||||||||||
| 698 | ((void *)0) | - | ||||||||||||||||||||||||
| 699 | ; | - | ||||||||||||||||||||||||
| 700 | const BIGNUM *tmp; | - | ||||||||||||||||||||||||
| 701 | unsigned char *buffer = | - | ||||||||||||||||||||||||
| 702 | ((void *)0) | - | ||||||||||||||||||||||||
| 703 | ; | - | ||||||||||||||||||||||||
| 704 | const EC_POINT *point = | - | ||||||||||||||||||||||||
| 705 | ((void *)0) | - | ||||||||||||||||||||||||
| 706 | ; | - | ||||||||||||||||||||||||
| 707 | point_conversion_form_t form; | - | ||||||||||||||||||||||||
| 708 | - | |||||||||||||||||||||||||
| 709 | if (params ==
| 0-47 | ||||||||||||||||||||||||
| 710 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 711 | ) { | - | ||||||||||||||||||||||||
| 712 | if ((
| 0-47 | ||||||||||||||||||||||||
| 713 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 714 | ) { | - | ||||||||||||||||||||||||
| 715 | ERR_put_error(16,(261),((1|64)),__FILE__,452); | - | ||||||||||||||||||||||||
| 716 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 717 | } | - | ||||||||||||||||||||||||
| 718 | } executed 47 times by 1 test: elseend of blockExecuted by:
| 47 | ||||||||||||||||||||||||
| 719 | ret = params; never executed: ret = params; | 0 | ||||||||||||||||||||||||
| 720 | - | |||||||||||||||||||||||||
| 721 | - | |||||||||||||||||||||||||
| 722 | ret->version = (long)0x1; | - | ||||||||||||||||||||||||
| 723 | - | |||||||||||||||||||||||||
| 724 | - | |||||||||||||||||||||||||
| 725 | if (!ec_asn1_group2fieldid(group, ret->fieldID)
| 0-47 | ||||||||||||||||||||||||
| 726 | ERR_put_error(16,(261),(16),__FILE__,463); | - | ||||||||||||||||||||||||
| 727 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 728 | } | - | ||||||||||||||||||||||||
| 729 | - | |||||||||||||||||||||||||
| 730 | - | |||||||||||||||||||||||||
| 731 | if (!ec_asn1_group2curve(group, ret->curve)
| 0-47 | ||||||||||||||||||||||||
| 732 | ERR_put_error(16,(261),(16),__FILE__,469); | - | ||||||||||||||||||||||||
| 733 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 734 | } | - | ||||||||||||||||||||||||
| 735 | - | |||||||||||||||||||||||||
| 736 | - | |||||||||||||||||||||||||
| 737 | if ((
| 0-47 | ||||||||||||||||||||||||
| 738 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 739 | ) { | - | ||||||||||||||||||||||||
| 740 | ERR_put_error(16,(261),(113),__FILE__,475); | - | ||||||||||||||||||||||||
| 741 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 742 | } | - | ||||||||||||||||||||||||
| 743 | - | |||||||||||||||||||||||||
| 744 | form = EC_GROUP_get_point_conversion_form(group); | - | ||||||||||||||||||||||||
| 745 | - | |||||||||||||||||||||||||
| 746 | len = EC_POINT_point2buf(group, point, form, &buffer, | - | ||||||||||||||||||||||||
| 747 | ((void *)0) | - | ||||||||||||||||||||||||
| 748 | ); | - | ||||||||||||||||||||||||
| 749 | if (len == 0
| 0-47 | ||||||||||||||||||||||||
| 750 | ERR_put_error(16,(261),(16),__FILE__,483); | - | ||||||||||||||||||||||||
| 751 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 752 | } | - | ||||||||||||||||||||||||
| 753 | if (ret->base ==
| 0-47 | ||||||||||||||||||||||||
| 754 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 755 | && (
| 0 | ||||||||||||||||||||||||
| 756 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 757 | ) { | - | ||||||||||||||||||||||||
| 758 | CRYPTO_free(buffer, __FILE__, 487); | - | ||||||||||||||||||||||||
| 759 | ERR_put_error(16,(261),((1|64)),__FILE__,488); | - | ||||||||||||||||||||||||
| 760 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 761 | } | - | ||||||||||||||||||||||||
| 762 | ASN1_STRING_set0(ret->base, buffer, len); | - | ||||||||||||||||||||||||
| 763 | - | |||||||||||||||||||||||||
| 764 | - | |||||||||||||||||||||||||
| 765 | tmp = EC_GROUP_get0_order(group); | - | ||||||||||||||||||||||||
| 766 | if (tmp ==
| 0-47 | ||||||||||||||||||||||||
| 767 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 768 | ) { | - | ||||||||||||||||||||||||
| 769 | ERR_put_error(16,(261),(16),__FILE__,496); | - | ||||||||||||||||||||||||
| 770 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 771 | } | - | ||||||||||||||||||||||||
| 772 | ret->order = BN_to_ASN1_INTEGER(tmp, ret->order); | - | ||||||||||||||||||||||||
| 773 | if (ret->order ==
| 0-47 | ||||||||||||||||||||||||
| 774 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 775 | ) { | - | ||||||||||||||||||||||||
| 776 | ERR_put_error(16,(261),(13),__FILE__,501); | - | ||||||||||||||||||||||||
| 777 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 778 | } | - | ||||||||||||||||||||||||
| 779 | - | |||||||||||||||||||||||||
| 780 | - | |||||||||||||||||||||||||
| 781 | tmp = EC_GROUP_get0_cofactor(group); | - | ||||||||||||||||||||||||
| 782 | if (tmp !=
| 0-47 | ||||||||||||||||||||||||
| 783 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 784 | ) { | - | ||||||||||||||||||||||||
| 785 | ret->cofactor = BN_to_ASN1_INTEGER(tmp, ret->cofactor); | - | ||||||||||||||||||||||||
| 786 | if (ret->cofactor ==
| 0-47 | ||||||||||||||||||||||||
| 787 | ((void *)0)
| 0-47 | ||||||||||||||||||||||||
| 788 | ) { | - | ||||||||||||||||||||||||
| 789 | ERR_put_error(16,(261),(13),__FILE__,510); | - | ||||||||||||||||||||||||
| 790 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 791 | } | - | ||||||||||||||||||||||||
| 792 | } executed 47 times by 1 test: end of blockExecuted by:
| 47 | ||||||||||||||||||||||||
| 793 | - | |||||||||||||||||||||||||
| 794 | return executed 47 times by 1 test: ret;return ret;Executed by:
executed 47 times by 1 test: return ret;Executed by:
| 47 | ||||||||||||||||||||||||
| 795 | - | |||||||||||||||||||||||||
| 796 | err: | - | ||||||||||||||||||||||||
| 797 | if (params ==
| 0 | ||||||||||||||||||||||||
| 798 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 799 | ) | - | ||||||||||||||||||||||||
| 800 | ECPARAMETERS_free(ret); never executed: ECPARAMETERS_free(ret); | 0 | ||||||||||||||||||||||||
| 801 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 802 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 803 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 804 | } | - | ||||||||||||||||||||||||
| 805 | - | |||||||||||||||||||||||||
| 806 | ECPKPARAMETERS *EC_GROUP_get_ecpkparameters(const EC_GROUP *group, | - | ||||||||||||||||||||||||
| 807 | ECPKPARAMETERS *params) | - | ||||||||||||||||||||||||
| 808 | { | - | ||||||||||||||||||||||||
| 809 | int ok = 1, tmp; | - | ||||||||||||||||||||||||
| 810 | ECPKPARAMETERS *ret = params; | - | ||||||||||||||||||||||||
| 811 | - | |||||||||||||||||||||||||
| 812 | if (ret ==
| 0-254 | ||||||||||||||||||||||||
| 813 | ((void *)0)
| 0-254 | ||||||||||||||||||||||||
| 814 | ) { | - | ||||||||||||||||||||||||
| 815 | if ((
| 0-254 | ||||||||||||||||||||||||
| 816 | ((void *)0)
| 0-254 | ||||||||||||||||||||||||
| 817 | ) { | - | ||||||||||||||||||||||||
| 818 | ERR_put_error(16,(262),((1|64)),__FILE__,531); | - | ||||||||||||||||||||||||
| 819 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 820 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 821 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 822 | } | - | ||||||||||||||||||||||||
| 823 | } executed 254 times by 1 test: else {end of blockExecuted by:
| 254 | ||||||||||||||||||||||||
| 824 | if (ret->type == 0
| 0 | ||||||||||||||||||||||||
| 825 | ASN1_OBJECT_free(ret->value.named_curve); never executed: ASN1_OBJECT_free(ret->value.named_curve); | 0 | ||||||||||||||||||||||||
| 826 | else if (ret->type == 1
| 0 | ||||||||||||||||||||||||
| 827 | ECPARAMETERS_free(ret->value.parameters); never executed: ECPARAMETERS_free(ret->value.parameters); | 0 | ||||||||||||||||||||||||
| 828 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 829 | - | |||||||||||||||||||||||||
| 830 | if (EC_GROUP_get_asn1_flag(group)
| 46-208 | ||||||||||||||||||||||||
| 831 | - | |||||||||||||||||||||||||
| 832 | - | |||||||||||||||||||||||||
| 833 | - | |||||||||||||||||||||||||
| 834 | tmp = EC_GROUP_get_curve_name(group); | - | ||||||||||||||||||||||||
| 835 | if (tmp
| 0-208 | ||||||||||||||||||||||||
| 836 | ret->type = 0; | - | ||||||||||||||||||||||||
| 837 | if ((
| 0-208 | ||||||||||||||||||||||||
| 838 | ((void *)0)
| 0-208 | ||||||||||||||||||||||||
| 839 | ) | - | ||||||||||||||||||||||||
| 840 | ok = 0; never executed: ok = 0; | 0 | ||||||||||||||||||||||||
| 841 | } executed 208 times by 1 test: elseend of blockExecuted by:
| 208 | ||||||||||||||||||||||||
| 842 | - | |||||||||||||||||||||||||
| 843 | ok = 0; never executed: ok = 0; | 0 | ||||||||||||||||||||||||
| 844 | } else { | - | ||||||||||||||||||||||||
| 845 | - | |||||||||||||||||||||||||
| 846 | ret->type = 1; | - | ||||||||||||||||||||||||
| 847 | if ((
| 0-46 | ||||||||||||||||||||||||
| 848 | EC_GROUP_get_ecparameters(group,
| 0-46 | ||||||||||||||||||||||||
| 849 | ((void *)0)
| 0-46 | ||||||||||||||||||||||||
| 850 | )) ==
| 0-46 | ||||||||||||||||||||||||
| 851 | ((void *)0)
| 0-46 | ||||||||||||||||||||||||
| 852 | ) | - | ||||||||||||||||||||||||
| 853 | ok = 0; never executed: ok = 0; | 0 | ||||||||||||||||||||||||
| 854 | } executed 46 times by 1 test: end of blockExecuted by:
| 46 | ||||||||||||||||||||||||
| 855 | - | |||||||||||||||||||||||||
| 856 | if (!ok
| 0-254 | ||||||||||||||||||||||||
| 857 | ECPKPARAMETERS_free(ret); | - | ||||||||||||||||||||||||
| 858 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 859 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 860 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 861 | } | - | ||||||||||||||||||||||||
| 862 | return executed 254 times by 1 test: ret;return ret;Executed by:
executed 254 times by 1 test: return ret;Executed by:
| 254 | ||||||||||||||||||||||||
| 863 | } | - | ||||||||||||||||||||||||
| 864 | - | |||||||||||||||||||||||||
| 865 | EC_GROUP *EC_GROUP_new_from_ecparameters(const ECPARAMETERS *params) | - | ||||||||||||||||||||||||
| 866 | { | - | ||||||||||||||||||||||||
| 867 | int ok = 0, tmp; | - | ||||||||||||||||||||||||
| 868 | EC_GROUP *ret = | - | ||||||||||||||||||||||||
| 869 | ((void *)0) | - | ||||||||||||||||||||||||
| 870 | ; | - | ||||||||||||||||||||||||
| 871 | BIGNUM *p = | - | ||||||||||||||||||||||||
| 872 | ((void *)0) | - | ||||||||||||||||||||||||
| 873 | , *a = | - | ||||||||||||||||||||||||
| 874 | ((void *)0) | - | ||||||||||||||||||||||||
| 875 | , *b = | - | ||||||||||||||||||||||||
| 876 | ((void *)0) | - | ||||||||||||||||||||||||
| 877 | ; | - | ||||||||||||||||||||||||
| 878 | EC_POINT *point = | - | ||||||||||||||||||||||||
| 879 | ((void *)0) | - | ||||||||||||||||||||||||
| 880 | ; | - | ||||||||||||||||||||||||
| 881 | long field_bits; | - | ||||||||||||||||||||||||
| 882 | - | |||||||||||||||||||||||||
| 883 | if (!params->fieldID
| 0-1046 | ||||||||||||||||||||||||
| 884 | !params->fieldID->p.ptr
| 0-1046 | ||||||||||||||||||||||||
| 885 | ERR_put_error(16,(263),(115),__FILE__,578); | - | ||||||||||||||||||||||||
| 886 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 887 | } | - | ||||||||||||||||||||||||
| 888 | - | |||||||||||||||||||||||||
| 889 | - | |||||||||||||||||||||||||
| 890 | - | |||||||||||||||||||||||||
| 891 | - | |||||||||||||||||||||||||
| 892 | - | |||||||||||||||||||||||||
| 893 | - | |||||||||||||||||||||||||
| 894 | - | |||||||||||||||||||||||||
| 895 | if (!params->curve
| 0-1046 | ||||||||||||||||||||||||
| 896 | !params->curve->a->data
| 0-1046 | ||||||||||||||||||||||||
| 897 | !params->curve->b->data
| 0-1046 | ||||||||||||||||||||||||
| 898 | ERR_put_error(16,(263),(115),__FILE__,591); | - | ||||||||||||||||||||||||
| 899 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 900 | } | - | ||||||||||||||||||||||||
| 901 | a = BN_bin2bn(params->curve->a->data, params->curve->a->length, | - | ||||||||||||||||||||||||
| 902 | ((void *)0) | - | ||||||||||||||||||||||||
| 903 | ); | - | ||||||||||||||||||||||||
| 904 | if (a ==
| 0-1046 | ||||||||||||||||||||||||
| 905 | ((void *)0)
| 0-1046 | ||||||||||||||||||||||||
| 906 | ) { | - | ||||||||||||||||||||||||
| 907 | ERR_put_error(16,(263),(3),__FILE__,596); | - | ||||||||||||||||||||||||
| 908 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 909 | } | - | ||||||||||||||||||||||||
| 910 | b = BN_bin2bn(params->curve->b->data, params->curve->b->length, | - | ||||||||||||||||||||||||
| 911 | ((void *)0) | - | ||||||||||||||||||||||||
| 912 | ); | - | ||||||||||||||||||||||||
| 913 | if (b ==
| 0-1046 | ||||||||||||||||||||||||
| 914 | ((void *)0)
| 0-1046 | ||||||||||||||||||||||||
| 915 | ) { | - | ||||||||||||||||||||||||
| 916 | ERR_put_error(16,(263),(3),__FILE__,601); | - | ||||||||||||||||||||||||
| 917 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 918 | } | - | ||||||||||||||||||||||||
| 919 | - | |||||||||||||||||||||||||
| 920 | - | |||||||||||||||||||||||||
| 921 | tmp = OBJ_obj2nid(params->fieldID->fieldType); | - | ||||||||||||||||||||||||
| 922 | if (tmp == 407
| 41-1005 | ||||||||||||||||||||||||
| 923 | - | |||||||||||||||||||||||||
| 924 | - | |||||||||||||||||||||||||
| 925 | - | |||||||||||||||||||||||||
| 926 | - | |||||||||||||||||||||||||
| 927 | - | |||||||||||||||||||||||||
| 928 | - | |||||||||||||||||||||||||
| 929 | { | - | ||||||||||||||||||||||||
| 930 | X9_62_CHARACTERISTIC_TWO *char_two; | - | ||||||||||||||||||||||||
| 931 | - | |||||||||||||||||||||||||
| 932 | char_two = params->fieldID->p.char_two; | - | ||||||||||||||||||||||||
| 933 | - | |||||||||||||||||||||||||
| 934 | field_bits = char_two->m; | - | ||||||||||||||||||||||||
| 935 | if (field_bits > 661
| 0-41 | ||||||||||||||||||||||||
| 936 | ERR_put_error(16,(263),(143),__FILE__,621); | - | ||||||||||||||||||||||||
| 937 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 938 | } | - | ||||||||||||||||||||||||
| 939 | - | |||||||||||||||||||||||||
| 940 | if ((
| 0-41 | ||||||||||||||||||||||||
| 941 | ((void *)0)
| 0-41 | ||||||||||||||||||||||||
| 942 | ) { | - | ||||||||||||||||||||||||
| 943 | ERR_put_error(16,(263),((1|64)),__FILE__,626); | - | ||||||||||||||||||||||||
| 944 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 945 | } | - | ||||||||||||||||||||||||
| 946 | - | |||||||||||||||||||||||||
| 947 | - | |||||||||||||||||||||||||
| 948 | tmp = OBJ_obj2nid(char_two->type); | - | ||||||||||||||||||||||||
| 949 | - | |||||||||||||||||||||||||
| 950 | if (tmp == 682
| 20-21 | ||||||||||||||||||||||||
| 951 | long tmp_long; | - | ||||||||||||||||||||||||
| 952 | - | |||||||||||||||||||||||||
| 953 | if (!char_two->p.tpBasis
| 0-21 | ||||||||||||||||||||||||
| 954 | ERR_put_error(16,(263),(115),__FILE__,637); | - | ||||||||||||||||||||||||
| 955 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 956 | } | - | ||||||||||||||||||||||||
| 957 | - | |||||||||||||||||||||||||
| 958 | tmp_long = ASN1_INTEGER_get(char_two->p.tpBasis); | - | ||||||||||||||||||||||||
| 959 | - | |||||||||||||||||||||||||
| 960 | if (!(char_two->m > tmp_long
| 0-21 | ||||||||||||||||||||||||
| 961 | ERR_put_error(16,(263),(137),__FILE__,645) | - | ||||||||||||||||||||||||
| 962 | ; | - | ||||||||||||||||||||||||
| 963 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 964 | } | - | ||||||||||||||||||||||||
| 965 | - | |||||||||||||||||||||||||
| 966 | - | |||||||||||||||||||||||||
| 967 | if (!BN_set_bit(p, (int)char_two->m)
| 0-21 | ||||||||||||||||||||||||
| 968 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 969 | if (!BN_set_bit(p, (int)tmp_long)
| 0-21 | ||||||||||||||||||||||||
| 970 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 971 | if (!BN_set_bit(p, 0)
| 0-21 | ||||||||||||||||||||||||
| 972 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 973 | } executed 21 times by 1 test: else if (tmp == 683end of blockExecuted by:
| 0-21 | ||||||||||||||||||||||||
| 974 | X9_62_PENTANOMIAL *penta; | - | ||||||||||||||||||||||||
| 975 | - | |||||||||||||||||||||||||
| 976 | penta = char_two->p.ppBasis; | - | ||||||||||||||||||||||||
| 977 | if (!penta
| 0-20 | ||||||||||||||||||||||||
| 978 | ERR_put_error(16,(263),(115),__FILE__,661); | - | ||||||||||||||||||||||||
| 979 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 980 | } | - | ||||||||||||||||||||||||
| 981 | - | |||||||||||||||||||||||||
| 982 | if (! | - | ||||||||||||||||||||||||
| 983 | (char_two->m > penta->k3
| 0-20 | ||||||||||||||||||||||||
| 984 | && penta->k2 > penta->k1
| 0-20 | ||||||||||||||||||||||||
| 985 | ERR_put_error(16,(263),(132),__FILE__,669) | - | ||||||||||||||||||||||||
| 986 | ; | - | ||||||||||||||||||||||||
| 987 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 988 | } | - | ||||||||||||||||||||||||
| 989 | - | |||||||||||||||||||||||||
| 990 | - | |||||||||||||||||||||||||
| 991 | if (!BN_set_bit(p, (int)char_two->m)
| 0-20 | ||||||||||||||||||||||||
| 992 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 993 | if (!BN_set_bit(p, (int)penta->k1)
| 0-20 | ||||||||||||||||||||||||
| 994 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 995 | if (!BN_set_bit(p, (int)penta->k2)
| 0-20 | ||||||||||||||||||||||||
| 996 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 997 | if (!BN_set_bit(p, (int)penta->k3)
| 0-20 | ||||||||||||||||||||||||
| 998 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 999 | if (!BN_set_bit(p, 0)
| 0-20 | ||||||||||||||||||||||||
| 1000 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1001 | } executed 20 times by 1 test: else if (tmp == 681end of blockExecuted by:
| 0-20 | ||||||||||||||||||||||||
| 1002 | ERR_put_error(16,(263),(126),__FILE__,685); | - | ||||||||||||||||||||||||
| 1003 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1004 | } else { | - | ||||||||||||||||||||||||
| 1005 | - | |||||||||||||||||||||||||
| 1006 | ERR_put_error(16,(263),(115),__FILE__,689); | - | ||||||||||||||||||||||||
| 1007 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1008 | } | - | ||||||||||||||||||||||||
| 1009 | - | |||||||||||||||||||||||||
| 1010 | - | |||||||||||||||||||||||||
| 1011 | ret = EC_GROUP_new_curve_GF2m(p, a, b, | - | ||||||||||||||||||||||||
| 1012 | ((void *)0) | - | ||||||||||||||||||||||||
| 1013 | ); | - | ||||||||||||||||||||||||
| 1014 | } executed 41 times by 1 test: end of blockExecuted by:
| 41 | ||||||||||||||||||||||||
| 1015 | - | |||||||||||||||||||||||||
| 1016 | else if (tmp == 406
| 37-968 | ||||||||||||||||||||||||
| 1017 | - | |||||||||||||||||||||||||
| 1018 | - | |||||||||||||||||||||||||
| 1019 | if (!params->fieldID->p.prime
| 0-968 | ||||||||||||||||||||||||
| 1020 | ERR_put_error(16,(263),(115),__FILE__,701); | - | ||||||||||||||||||||||||
| 1021 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1022 | } | - | ||||||||||||||||||||||||
| 1023 | p = ASN1_INTEGER_to_BN(params->fieldID->p.prime, | - | ||||||||||||||||||||||||
| 1024 | ((void *)0) | - | ||||||||||||||||||||||||
| 1025 | ); | - | ||||||||||||||||||||||||
| 1026 | if (p ==
| 0-968 | ||||||||||||||||||||||||
| 1027 | ((void *)0)
| 0-968 | ||||||||||||||||||||||||
| 1028 | ) { | - | ||||||||||||||||||||||||
| 1029 | ERR_put_error(16,(263),(13),__FILE__,706); | - | ||||||||||||||||||||||||
| 1030 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1031 | } | - | ||||||||||||||||||||||||
| 1032 | - | |||||||||||||||||||||||||
| 1033 | if (BN_is_negative(p)
| 0-899 | ||||||||||||||||||||||||
| 1034 | ERR_put_error(16,(263),(103),__FILE__,711); | - | ||||||||||||||||||||||||
| 1035 | goto executed 69 times by 1 test: err;goto err;Executed by:
executed 69 times by 1 test: goto err;Executed by:
| 69 | ||||||||||||||||||||||||
| 1036 | } | - | ||||||||||||||||||||||||
| 1037 | - | |||||||||||||||||||||||||
| 1038 | field_bits = BN_num_bits(p); | - | ||||||||||||||||||||||||
| 1039 | if (field_bits > 661
| 0-899 | ||||||||||||||||||||||||
| 1040 | ERR_put_error(16,(263),(143),__FILE__,717); | - | ||||||||||||||||||||||||
| 1041 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1042 | } | - | ||||||||||||||||||||||||
| 1043 | - | |||||||||||||||||||||||||
| 1044 | - | |||||||||||||||||||||||||
| 1045 | ret = EC_GROUP_new_curve_GFp(p, a, b, | - | ||||||||||||||||||||||||
| 1046 | ((void *)0) | - | ||||||||||||||||||||||||
| 1047 | ); | - | ||||||||||||||||||||||||
| 1048 | } executed 899 times by 1 test: else {end of blockExecuted by:
| 899 | ||||||||||||||||||||||||
| 1049 | ERR_put_error(16,(263),(103),__FILE__,724); | - | ||||||||||||||||||||||||
| 1050 | goto executed 37 times by 1 test: err;goto err;Executed by:
executed 37 times by 1 test: goto err;Executed by:
| 37 | ||||||||||||||||||||||||
| 1051 | } | - | ||||||||||||||||||||||||
| 1052 | - | |||||||||||||||||||||||||
| 1053 | if (ret ==
| 422-518 | ||||||||||||||||||||||||
| 1054 | ((void *)0)
| 422-518 | ||||||||||||||||||||||||
| 1055 | ) { | - | ||||||||||||||||||||||||
| 1056 | ERR_put_error(16,(263),(16),__FILE__,729); | - | ||||||||||||||||||||||||
| 1057 | goto executed 422 times by 1 test: err;goto err;Executed by:
executed 422 times by 1 test: goto err;Executed by:
| 422 | ||||||||||||||||||||||||
| 1058 | } | - | ||||||||||||||||||||||||
| 1059 | - | |||||||||||||||||||||||||
| 1060 | - | |||||||||||||||||||||||||
| 1061 | if (params->curve->seed !=
| 93-425 | ||||||||||||||||||||||||
| 1062 | ((void *)0)
| 93-425 | ||||||||||||||||||||||||
| 1063 | ) { | - | ||||||||||||||||||||||||
| 1064 | CRYPTO_free(ret->seed, __FILE__, 735); | - | ||||||||||||||||||||||||
| 1065 | if ((
| 6-419 | ||||||||||||||||||||||||
| 1066 | ((void *)0)
| 6-419 | ||||||||||||||||||||||||
| 1067 | ) { | - | ||||||||||||||||||||||||
| 1068 | ERR_put_error(16,(263),((1|64)),__FILE__,737); | - | ||||||||||||||||||||||||
| 1069 | goto executed 6 times by 1 test: err;goto err;Executed by:
executed 6 times by 1 test: goto err;Executed by:
| 6 | ||||||||||||||||||||||||
| 1070 | } | - | ||||||||||||||||||||||||
| 1071 | memcpy(ret->seed, params->curve->seed->data, | - | ||||||||||||||||||||||||
| 1072 | params->curve->seed->length); | - | ||||||||||||||||||||||||
| 1073 | ret->seed_len = params->curve->seed->length; | - | ||||||||||||||||||||||||
| 1074 | } executed 419 times by 1 test: end of blockExecuted by:
| 419 | ||||||||||||||||||||||||
| 1075 | - | |||||||||||||||||||||||||
| 1076 | if (!params->order
| 0-512 | ||||||||||||||||||||||||
| 1077 | ERR_put_error(16,(263),(115),__FILE__,746); | - | ||||||||||||||||||||||||
| 1078 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1079 | } | - | ||||||||||||||||||||||||
| 1080 | - | |||||||||||||||||||||||||
| 1081 | if ((
| 0-512 | ||||||||||||||||||||||||
| 1082 | ((void *)0)
| 0-512 | ||||||||||||||||||||||||
| 1083 | ) | - | ||||||||||||||||||||||||
| 1084 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1085 | - | |||||||||||||||||||||||||
| 1086 | - | |||||||||||||||||||||||||
| 1087 | EC_GROUP_set_point_conversion_form(ret, (point_conversion_form_t) | - | ||||||||||||||||||||||||
| 1088 | (params->base->data[0] & ~0x01)); | - | ||||||||||||||||||||||||
| 1089 | - | |||||||||||||||||||||||||
| 1090 | - | |||||||||||||||||||||||||
| 1091 | if (!EC_POINT_oct2point(ret, point, params->base->data,
| 190-322 | ||||||||||||||||||||||||
| 1092 | params->base->length,
| 190-322 | ||||||||||||||||||||||||
| 1093 | ((void *)0)
| 190-322 | ||||||||||||||||||||||||
| 1094 | )
| 190-322 | ||||||||||||||||||||||||
| 1095 | ERR_put_error(16,(263),(16),__FILE__,760); | - | ||||||||||||||||||||||||
| 1096 | goto executed 190 times by 1 test: err;goto err;Executed by:
executed 190 times by 1 test: goto err;Executed by:
| 190 | ||||||||||||||||||||||||
| 1097 | } | - | ||||||||||||||||||||||||
| 1098 | - | |||||||||||||||||||||||||
| 1099 | - | |||||||||||||||||||||||||
| 1100 | if ((
| 0-322 | ||||||||||||||||||||||||
| 1101 | ((void *)0)
| 0-322 | ||||||||||||||||||||||||
| 1102 | ) { | - | ||||||||||||||||||||||||
| 1103 | ERR_put_error(16,(263),(13),__FILE__,766); | - | ||||||||||||||||||||||||
| 1104 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1105 | } | - | ||||||||||||||||||||||||
| 1106 | if (BN_is_negative(a)
| 14-285 | ||||||||||||||||||||||||
| 1107 | ERR_put_error(16,(263),(122),__FILE__,770); | - | ||||||||||||||||||||||||
| 1108 | goto executed 51 times by 1 test: err;goto err;Executed by:
executed 51 times by 1 test: goto err;Executed by:
| 51 | ||||||||||||||||||||||||
| 1109 | } | - | ||||||||||||||||||||||||
| 1110 | if (BN_num_bits(a) > (int)field_bits + 1
| 37-234 | ||||||||||||||||||||||||
| 1111 | ERR_put_error(16,(263),(122),__FILE__,774); | - | ||||||||||||||||||||||||
| 1112 | goto executed 37 times by 1 test: err;goto err;Executed by:
executed 37 times by 1 test: goto err;Executed by:
| 37 | ||||||||||||||||||||||||
| 1113 | } | - | ||||||||||||||||||||||||
| 1114 | - | |||||||||||||||||||||||||
| 1115 | - | |||||||||||||||||||||||||
| 1116 | if (params->cofactor ==
| 40-194 | ||||||||||||||||||||||||
| 1117 | ((void *)0)
| 40-194 | ||||||||||||||||||||||||
| 1118 | ) { | - | ||||||||||||||||||||||||
| 1119 | BN_free(b); | - | ||||||||||||||||||||||||
| 1120 | b = | - | ||||||||||||||||||||||||
| 1121 | ((void *)0) | - | ||||||||||||||||||||||||
| 1122 | ; | - | ||||||||||||||||||||||||
| 1123 | } executed 40 times by 1 test: else if ((end of blockExecuted by:
| 0-194 | ||||||||||||||||||||||||
| 1124 | ((void *)0)
| 0-194 | ||||||||||||||||||||||||
| 1125 | ) { | - | ||||||||||||||||||||||||
| 1126 | ERR_put_error(16,(263),(13),__FILE__,783); | - | ||||||||||||||||||||||||
| 1127 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1128 | } | - | ||||||||||||||||||||||||
| 1129 | - | |||||||||||||||||||||||||
| 1130 | if (!EC_GROUP_set_generator(ret, point, a, b)
| 0-234 | ||||||||||||||||||||||||
| 1131 | ERR_put_error(16,(263),(16),__FILE__,788); | - | ||||||||||||||||||||||||
| 1132 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1133 | } | - | ||||||||||||||||||||||||
| 1134 | - | |||||||||||||||||||||||||
| 1135 | ok = 1; | - | ||||||||||||||||||||||||
| 1136 | - | |||||||||||||||||||||||||
| 1137 | err: code before this statement executed 234 times by 1 test: err:Executed by:
| 234 | ||||||||||||||||||||||||
| 1138 | if (!ok
| 234-812 | ||||||||||||||||||||||||
| 1139 | EC_GROUP_clear_free(ret); | - | ||||||||||||||||||||||||
| 1140 | ret = | - | ||||||||||||||||||||||||
| 1141 | ((void *)0) | - | ||||||||||||||||||||||||
| 1142 | ; | - | ||||||||||||||||||||||||
| 1143 | } executed 812 times by 1 test: end of blockExecuted by:
| 812 | ||||||||||||||||||||||||
| 1144 | - | |||||||||||||||||||||||||
| 1145 | BN_free(p); | - | ||||||||||||||||||||||||
| 1146 | BN_free(a); | - | ||||||||||||||||||||||||
| 1147 | BN_free(b); | - | ||||||||||||||||||||||||
| 1148 | EC_POINT_free(point); | - | ||||||||||||||||||||||||
| 1149 | return executed 1046 times by 1 test: ret;return ret;Executed by:
executed 1046 times by 1 test: return ret;Executed by:
| 1046 | ||||||||||||||||||||||||
| 1150 | } | - | ||||||||||||||||||||||||
| 1151 | - | |||||||||||||||||||||||||
| 1152 | EC_GROUP *EC_GROUP_new_from_ecpkparameters(const ECPKPARAMETERS *params) | - | ||||||||||||||||||||||||
| 1153 | { | - | ||||||||||||||||||||||||
| 1154 | EC_GROUP *ret = | - | ||||||||||||||||||||||||
| 1155 | ((void *)0) | - | ||||||||||||||||||||||||
| 1156 | ; | - | ||||||||||||||||||||||||
| 1157 | int tmp = 0; | - | ||||||||||||||||||||||||
| 1158 | - | |||||||||||||||||||||||||
| 1159 | if (params ==
| 0-3165 | ||||||||||||||||||||||||
| 1160 | ((void *)0)
| 0-3165 | ||||||||||||||||||||||||
| 1161 | ) { | - | ||||||||||||||||||||||||
| 1162 | ERR_put_error(16,(264),(124),__FILE__,813); | - | ||||||||||||||||||||||||
| 1163 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 1164 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 1165 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 1166 | } | - | ||||||||||||||||||||||||
| 1167 | - | |||||||||||||||||||||||||
| 1168 | if (params->type == 0
| 1048-2117 | ||||||||||||||||||||||||
| 1169 | tmp = OBJ_obj2nid(params->value.named_curve); | - | ||||||||||||||||||||||||
| 1170 | if ((
| 17-2100 | ||||||||||||||||||||||||
| 1171 | ((void *)0)
| 17-2100 | ||||||||||||||||||||||||
| 1172 | ) { | - | ||||||||||||||||||||||||
| 1173 | ERR_put_error(16,(264),(119),__FILE__,821) | - | ||||||||||||||||||||||||
| 1174 | ; | - | ||||||||||||||||||||||||
| 1175 | return executed 17 times by 1 test: return ((void *)0) ;Executed by:
executed 17 times by 1 test: return ((void *)0) ;Executed by:
| 17 | ||||||||||||||||||||||||
| 1176 | ((void *)0) executed 17 times by 1 test: return ((void *)0) ;Executed by:
| 17 | ||||||||||||||||||||||||
| 1177 | ; executed 17 times by 1 test: return ((void *)0) ;Executed by:
| 17 | ||||||||||||||||||||||||
| 1178 | } | - | ||||||||||||||||||||||||
| 1179 | EC_GROUP_set_asn1_flag(ret, 0x001); | - | ||||||||||||||||||||||||
| 1180 | } executed 2100 times by 1 test: else if (params->type == 1end of blockExecuted by:
| 3-2100 | ||||||||||||||||||||||||
| 1181 | - | |||||||||||||||||||||||||
| 1182 | ret = EC_GROUP_new_from_ecparameters(params->value.parameters); | - | ||||||||||||||||||||||||
| 1183 | if (!ret
| 233-812 | ||||||||||||||||||||||||
| 1184 | ERR_put_error(16,(264),(16),__FILE__,829); | - | ||||||||||||||||||||||||
| 1185 | return executed 812 times by 1 test: return ((void *)0) ;Executed by:
executed 812 times by 1 test: return ((void *)0) ;Executed by:
| 812 | ||||||||||||||||||||||||
| 1186 | ((void *)0) executed 812 times by 1 test: return ((void *)0) ;Executed by:
| 812 | ||||||||||||||||||||||||
| 1187 | ; executed 812 times by 1 test: return ((void *)0) ;Executed by:
| 812 | ||||||||||||||||||||||||
| 1188 | } | - | ||||||||||||||||||||||||
| 1189 | EC_GROUP_set_asn1_flag(ret, 0x000); | - | ||||||||||||||||||||||||
| 1190 | } executed 233 times by 1 test: else if (params->type == 2end of blockExecuted by:
| 0-233 | ||||||||||||||||||||||||
| 1191 | return executed 3 times by 1 test: return ((void *)0) ;Executed by:
executed 3 times by 1 test: return ((void *)0) ;Executed by:
| 3 | ||||||||||||||||||||||||
| 1192 | ((void *)0) executed 3 times by 1 test: return ((void *)0) ;Executed by:
| 3 | ||||||||||||||||||||||||
| 1193 | ; executed 3 times by 1 test: return ((void *)0) ;Executed by:
| 3 | ||||||||||||||||||||||||
| 1194 | } else { | - | ||||||||||||||||||||||||
| 1195 | ERR_put_error(16,(264),(115),__FILE__,836); | - | ||||||||||||||||||||||||
| 1196 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 1197 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 1198 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 1199 | } | - | ||||||||||||||||||||||||
| 1200 | - | |||||||||||||||||||||||||
| 1201 | return executed 2333 times by 1 test: ret;return ret;Executed by:
executed 2333 times by 1 test: return ret;Executed by:
| 2333 | ||||||||||||||||||||||||
| 1202 | } | - | ||||||||||||||||||||||||
| 1203 | - | |||||||||||||||||||||||||
| 1204 | - | |||||||||||||||||||||||||
| 1205 | - | |||||||||||||||||||||||||
| 1206 | EC_GROUP *d2i_ECPKParameters(EC_GROUP **a, const unsigned char **in, long len) | - | ||||||||||||||||||||||||
| 1207 | { | - | ||||||||||||||||||||||||
| 1208 | EC_GROUP *group = | - | ||||||||||||||||||||||||
| 1209 | ((void *)0) | - | ||||||||||||||||||||||||
| 1210 | ; | - | ||||||||||||||||||||||||
| 1211 | ECPKPARAMETERS *params = | - | ||||||||||||||||||||||||
| 1212 | ((void *)0) | - | ||||||||||||||||||||||||
| 1213 | ; | - | ||||||||||||||||||||||||
| 1214 | const unsigned char *p = *in; | - | ||||||||||||||||||||||||
| 1215 | - | |||||||||||||||||||||||||
| 1216 | if ((
| 1075-7624 | ||||||||||||||||||||||||
| 1217 | ((void *)0)
| 1075-7624 | ||||||||||||||||||||||||
| 1218 | , &p, len)) ==
| 1075-7624 | ||||||||||||||||||||||||
| 1219 | ((void *)0)
| 1075-7624 | ||||||||||||||||||||||||
| 1220 | ) { | - | ||||||||||||||||||||||||
| 1221 | ERR_put_error(16,(145),(117),__FILE__,852); | - | ||||||||||||||||||||||||
| 1222 | ECPKPARAMETERS_free(params); | - | ||||||||||||||||||||||||
| 1223 | return executed 7624 times by 1 test: return ((void *)0) ;Executed by:
executed 7624 times by 1 test: return ((void *)0) ;Executed by:
| 7624 | ||||||||||||||||||||||||
| 1224 | ((void *)0) executed 7624 times by 1 test: return ((void *)0) ;Executed by:
| 7624 | ||||||||||||||||||||||||
| 1225 | ; executed 7624 times by 1 test: return ((void *)0) ;Executed by:
| 7624 | ||||||||||||||||||||||||
| 1226 | } | - | ||||||||||||||||||||||||
| 1227 | - | |||||||||||||||||||||||||
| 1228 | if ((
| 286-789 | ||||||||||||||||||||||||
| 1229 | ((void *)0)
| 286-789 | ||||||||||||||||||||||||
| 1230 | ) { | - | ||||||||||||||||||||||||
| 1231 | ERR_put_error(16,(145),(127),__FILE__,858); | - | ||||||||||||||||||||||||
| 1232 | ECPKPARAMETERS_free(params); | - | ||||||||||||||||||||||||
| 1233 | return executed 789 times by 1 test: return ((void *)0) ;Executed by:
executed 789 times by 1 test: return ((void *)0) ;Executed by:
| 789 | ||||||||||||||||||||||||
| 1234 | ((void *)0) executed 789 times by 1 test: return ((void *)0) ;Executed by:
| 789 | ||||||||||||||||||||||||
| 1235 | ; executed 789 times by 1 test: return ((void *)0) ;Executed by:
| 789 | ||||||||||||||||||||||||
| 1236 | } | - | ||||||||||||||||||||||||
| 1237 | - | |||||||||||||||||||||||||
| 1238 | if (a
| 133-153 | ||||||||||||||||||||||||
| 1239 | EC_GROUP_clear_free(*a); | - | ||||||||||||||||||||||||
| 1240 | *a = group; | - | ||||||||||||||||||||||||
| 1241 | } executed 133 times by 1 test: end of blockExecuted by:
| 133 | ||||||||||||||||||||||||
| 1242 | - | |||||||||||||||||||||||||
| 1243 | ECPKPARAMETERS_free(params); | - | ||||||||||||||||||||||||
| 1244 | *in = p; | - | ||||||||||||||||||||||||
| 1245 | return executed 286 times by 1 test: group;return group;Executed by:
executed 286 times by 1 test: return group;Executed by:
| 286 | ||||||||||||||||||||||||
| 1246 | } | - | ||||||||||||||||||||||||
| 1247 | - | |||||||||||||||||||||||||
| 1248 | int i2d_ECPKParameters(const EC_GROUP *a, unsigned char **out) | - | ||||||||||||||||||||||||
| 1249 | { | - | ||||||||||||||||||||||||
| 1250 | int ret = 0; | - | ||||||||||||||||||||||||
| 1251 | ECPKPARAMETERS *tmp = EC_GROUP_get_ecpkparameters(a, | - | ||||||||||||||||||||||||
| 1252 | ((void *)0) | - | ||||||||||||||||||||||||
| 1253 | ); | - | ||||||||||||||||||||||||
| 1254 | if (tmp ==
| 0-48 | ||||||||||||||||||||||||
| 1255 | ((void *)0)
| 0-48 | ||||||||||||||||||||||||
| 1256 | ) { | - | ||||||||||||||||||||||||
| 1257 | ERR_put_error(16,(191),(120),__FILE__,878); | - | ||||||||||||||||||||||||
| 1258 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1259 | } | - | ||||||||||||||||||||||||
| 1260 | if ((
| 0-48 | ||||||||||||||||||||||||
| 1261 | ERR_put_error(16,(191),(121),__FILE__,882); | - | ||||||||||||||||||||||||
| 1262 | ECPKPARAMETERS_free(tmp); | - | ||||||||||||||||||||||||
| 1263 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1264 | } | - | ||||||||||||||||||||||||
| 1265 | ECPKPARAMETERS_free(tmp); | - | ||||||||||||||||||||||||
| 1266 | return executed 48 times by 1 test: ret;return ret;Executed by:
executed 48 times by 1 test: return ret;Executed by:
| 48 | ||||||||||||||||||||||||
| 1267 | } | - | ||||||||||||||||||||||||
| 1268 | - | |||||||||||||||||||||||||
| 1269 | - | |||||||||||||||||||||||||
| 1270 | - | |||||||||||||||||||||||||
| 1271 | EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len) | - | ||||||||||||||||||||||||
| 1272 | { | - | ||||||||||||||||||||||||
| 1273 | EC_KEY *ret = | - | ||||||||||||||||||||||||
| 1274 | ((void *)0) | - | ||||||||||||||||||||||||
| 1275 | ; | - | ||||||||||||||||||||||||
| 1276 | EC_PRIVATEKEY *priv_key = | - | ||||||||||||||||||||||||
| 1277 | ((void *)0) | - | ||||||||||||||||||||||||
| 1278 | ; | - | ||||||||||||||||||||||||
| 1279 | const unsigned char *p = *in; | - | ||||||||||||||||||||||||
| 1280 | - | |||||||||||||||||||||||||
| 1281 | if ((
| 3060-3292 | ||||||||||||||||||||||||
| 1282 | ((void *)0)
| 3060-3292 | ||||||||||||||||||||||||
| 1283 | , &p, len)) ==
| 3060-3292 | ||||||||||||||||||||||||
| 1284 | ((void *)0)
| 3060-3292 | ||||||||||||||||||||||||
| 1285 | ) { | - | ||||||||||||||||||||||||
| 1286 | ERR_put_error(16,(146),(16),__FILE__,899); | - | ||||||||||||||||||||||||
| 1287 | return executed 3292 times by 1 test: return ((void *)0) ;Executed by:
executed 3292 times by 1 test: return ((void *)0) ;Executed by:
| 3292 | ||||||||||||||||||||||||
| 1288 | ((void *)0) executed 3292 times by 1 test: return ((void *)0) ;Executed by:
| 3292 | ||||||||||||||||||||||||
| 1289 | ; executed 3292 times by 1 test: return ((void *)0) ;Executed by:
| 3292 | ||||||||||||||||||||||||
| 1290 | } | - | ||||||||||||||||||||||||
| 1291 | - | |||||||||||||||||||||||||
| 1292 | if (a ==
| 969-2091 | ||||||||||||||||||||||||
| 1293 | ((void *)0)
| 969-2091 | ||||||||||||||||||||||||
| 1294 | || *
| 0-969 | ||||||||||||||||||||||||
| 1295 | ((void *)0)
| 0-969 | ||||||||||||||||||||||||
| 1296 | ) { | - | ||||||||||||||||||||||||
| 1297 | if ((
| 0-2091 | ||||||||||||||||||||||||
| 1298 | ((void *)0)
| 0-2091 | ||||||||||||||||||||||||
| 1299 | ) { | - | ||||||||||||||||||||||||
| 1300 | ERR_put_error(16,(146),((1|64)),__FILE__,905); | - | ||||||||||||||||||||||||
| 1301 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1302 | } | - | ||||||||||||||||||||||||
| 1303 | } executed 2091 times by 1 test: elseend of blockExecuted by:
| 2091 | ||||||||||||||||||||||||
| 1304 | ret = *a; executed 969 times by 1 test: ret = *a;Executed by:
| 969 | ||||||||||||||||||||||||
| 1305 | - | |||||||||||||||||||||||||
| 1306 | if (priv_key->parameters
| 970-2090 | ||||||||||||||||||||||||
| 1307 | EC_GROUP_clear_free(ret->group); | - | ||||||||||||||||||||||||
| 1308 | ret->group = EC_GROUP_new_from_ecpkparameters(priv_key->parameters); | - | ||||||||||||||||||||||||
| 1309 | } executed 2090 times by 1 test: end of blockExecuted by:
| 2090 | ||||||||||||||||||||||||
| 1310 | - | |||||||||||||||||||||||||
| 1311 | if (ret->group ==
| 44-3016 | ||||||||||||||||||||||||
| 1312 | ((void *)0)
| 44-3016 | ||||||||||||||||||||||||
| 1313 | ) { | - | ||||||||||||||||||||||||
| 1314 | ERR_put_error(16,(146),(16),__FILE__,917); | - | ||||||||||||||||||||||||
| 1315 | goto executed 44 times by 1 test: err;goto err;Executed by:
executed 44 times by 1 test: goto err;Executed by:
| 44 | ||||||||||||||||||||||||
| 1316 | } | - | ||||||||||||||||||||||||
| 1317 | - | |||||||||||||||||||||||||
| 1318 | ret->version = priv_key->version; | - | ||||||||||||||||||||||||
| 1319 | - | |||||||||||||||||||||||||
| 1320 | if (priv_key->privateKey
| 0-3016 | ||||||||||||||||||||||||
| 1321 | ASN1_OCTET_STRING *pkey = priv_key->privateKey; | - | ||||||||||||||||||||||||
| 1322 | if (EC_KEY_oct2priv(ret, ASN1_STRING_get0_data(pkey),
| 0-3016 | ||||||||||||||||||||||||
| 1323 | ASN1_STRING_length(pkey)) == 0
| 0-3016 | ||||||||||||||||||||||||
| 1324 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1325 | } executed 3016 times by 1 test: else {end of blockExecuted by:
| 3016 | ||||||||||||||||||||||||
| 1326 | ERR_put_error(16,(146),(125),__FILE__,929); | - | ||||||||||||||||||||||||
| 1327 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1328 | } | - | ||||||||||||||||||||||||
| 1329 | - | |||||||||||||||||||||||||
| 1330 | EC_POINT_clear_free(ret->pub_key); | - | ||||||||||||||||||||||||
| 1331 | ret->pub_key = EC_POINT_new(ret->group); | - | ||||||||||||||||||||||||
| 1332 | if (ret->pub_key ==
| 0-3016 | ||||||||||||||||||||||||
| 1333 | ((void *)0)
| 0-3016 | ||||||||||||||||||||||||
| 1334 | ) { | - | ||||||||||||||||||||||||
| 1335 | ERR_put_error(16,(146),(16),__FILE__,936); | - | ||||||||||||||||||||||||
| 1336 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1337 | } | - | ||||||||||||||||||||||||
| 1338 | - | |||||||||||||||||||||||||
| 1339 | if (priv_key->publicKey
| 399-2617 | ||||||||||||||||||||||||
| 1340 | const unsigned char *pub_oct; | - | ||||||||||||||||||||||||
| 1341 | int pub_oct_len; | - | ||||||||||||||||||||||||
| 1342 | - | |||||||||||||||||||||||||
| 1343 | pub_oct = ASN1_STRING_get0_data(priv_key->publicKey); | - | ||||||||||||||||||||||||
| 1344 | pub_oct_len = ASN1_STRING_length(priv_key->publicKey); | - | ||||||||||||||||||||||||
| 1345 | if (!EC_KEY_oct2key(ret, pub_oct, pub_oct_len,
| 7-2610 | ||||||||||||||||||||||||
| 1346 | ((void *)0)
| 7-2610 | ||||||||||||||||||||||||
| 1347 | )
| 7-2610 | ||||||||||||||||||||||||
| 1348 | ERR_put_error(16,(146),(16),__FILE__,947); | - | ||||||||||||||||||||||||
| 1349 | goto executed 7 times by 1 test: err;goto err;Executed by:
executed 7 times by 1 test: goto err;Executed by:
| 7 | ||||||||||||||||||||||||
| 1350 | } | - | ||||||||||||||||||||||||
| 1351 | } executed 2610 times by 1 test: else {end of blockExecuted by:
| 2610 | ||||||||||||||||||||||||
| 1352 | if (ret->group->meth->keygenpub ==
| 0-399 | ||||||||||||||||||||||||
| 1353 | ((void *)0)
| 0-399 | ||||||||||||||||||||||||
| 1354 | - | |||||||||||||||||||||||||
| 1355 | || ret->group->meth->keygenpub(ret) == 0
| 0-399 | ||||||||||||||||||||||||
| 1356 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1357 | - | |||||||||||||||||||||||||
| 1358 | ret->enc_flag |= 0x002; | - | ||||||||||||||||||||||||
| 1359 | } executed 399 times by 1 test: end of blockExecuted by:
| 399 | ||||||||||||||||||||||||
| 1360 | - | |||||||||||||||||||||||||
| 1361 | if (a
| 968-2041 | ||||||||||||||||||||||||
| 1362 | * executed 968 times by 1 test: a = ret;*a = ret;Executed by:
executed 968 times by 1 test: *a = ret;Executed by:
| 968 | ||||||||||||||||||||||||
| 1363 | EC_PRIVATEKEY_free(priv_key); | - | ||||||||||||||||||||||||
| 1364 | *in = p; | - | ||||||||||||||||||||||||
| 1365 | return executed 3009 times by 1 test: ret;return ret;Executed by:
executed 3009 times by 1 test: return ret;Executed by:
| 3009 | ||||||||||||||||||||||||
| 1366 | - | |||||||||||||||||||||||||
| 1367 | err: | - | ||||||||||||||||||||||||
| 1368 | if (a ==
| 1-50 | ||||||||||||||||||||||||
| 1369 | ((void *)0)
| 1-50 | ||||||||||||||||||||||||
| 1370 | || *
| 0-1 | ||||||||||||||||||||||||
| 1371 | EC_KEY_free(ret); executed 50 times by 1 test: EC_KEY_free(ret);Executed by:
| 50 | ||||||||||||||||||||||||
| 1372 | EC_PRIVATEKEY_free(priv_key); | - | ||||||||||||||||||||||||
| 1373 | return executed 51 times by 1 test: return ((void *)0) ;Executed by:
executed 51 times by 1 test: return ((void *)0) ;Executed by:
| 51 | ||||||||||||||||||||||||
| 1374 | ((void *)0) executed 51 times by 1 test: return ((void *)0) ;Executed by:
| 51 | ||||||||||||||||||||||||
| 1375 | ; executed 51 times by 1 test: return ((void *)0) ;Executed by:
| 51 | ||||||||||||||||||||||||
| 1376 | } | - | ||||||||||||||||||||||||
| 1377 | - | |||||||||||||||||||||||||
| 1378 | int i2d_ECPrivateKey(EC_KEY *a, unsigned char **out) | - | ||||||||||||||||||||||||
| 1379 | { | - | ||||||||||||||||||||||||
| 1380 | int ret = 0, ok = 0; | - | ||||||||||||||||||||||||
| 1381 | unsigned char *priv= | - | ||||||||||||||||||||||||
| 1382 | ((void *)0) | - | ||||||||||||||||||||||||
| 1383 | , *pub= | - | ||||||||||||||||||||||||
| 1384 | ((void *)0) | - | ||||||||||||||||||||||||
| 1385 | ; | - | ||||||||||||||||||||||||
| 1386 | size_t privlen = 0, publen = 0; | - | ||||||||||||||||||||||||
| 1387 | - | |||||||||||||||||||||||||
| 1388 | EC_PRIVATEKEY *priv_key = | - | ||||||||||||||||||||||||
| 1389 | ((void *)0) | - | ||||||||||||||||||||||||
| 1390 | ; | - | ||||||||||||||||||||||||
| 1391 | - | |||||||||||||||||||||||||
| 1392 | if (a ==
| 0-255 | ||||||||||||||||||||||||
| 1393 | ((void *)0)
| 0-255 | ||||||||||||||||||||||||
| 1394 | || a->group ==
| 0-255 | ||||||||||||||||||||||||
| 1395 | ((void *)0)
| 0-255 | ||||||||||||||||||||||||
| 1396 | || | - | ||||||||||||||||||||||||
| 1397 | (!(a->enc_flag & 0x002)
| 0-227 | ||||||||||||||||||||||||
| 1398 | ((void *)0)
| 0-28 | ||||||||||||||||||||||||
| 1399 | )) { | - | ||||||||||||||||||||||||
| 1400 | ERR_put_error(16,(192),((3|64)),__FILE__,981); | - | ||||||||||||||||||||||||
| 1401 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1402 | } | - | ||||||||||||||||||||||||
| 1403 | - | |||||||||||||||||||||||||
| 1404 | if ((
| 0-255 | ||||||||||||||||||||||||
| 1405 | ((void *)0)
| 0-255 | ||||||||||||||||||||||||
| 1406 | ) { | - | ||||||||||||||||||||||||
| 1407 | ERR_put_error(16,(192),((1|64)),__FILE__,986); | - | ||||||||||||||||||||||||
| 1408 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1409 | } | - | ||||||||||||||||||||||||
| 1410 | - | |||||||||||||||||||||||||
| 1411 | priv_key->version = a->version; | - | ||||||||||||||||||||||||
| 1412 | - | |||||||||||||||||||||||||
| 1413 | privlen = EC_KEY_priv2buf(a, &priv); | - | ||||||||||||||||||||||||
| 1414 | - | |||||||||||||||||||||||||
| 1415 | if (privlen == 0
| 39-216 | ||||||||||||||||||||||||
| 1416 | ERR_put_error(16,(192),(16),__FILE__,995); | - | ||||||||||||||||||||||||
| 1417 | goto executed 39 times by 1 test: err;goto err;Executed by:
executed 39 times by 1 test: goto err;Executed by:
| 39 | ||||||||||||||||||||||||
| 1418 | } | - | ||||||||||||||||||||||||
| 1419 | - | |||||||||||||||||||||||||
| 1420 | ASN1_STRING_set0(priv_key->privateKey, priv, privlen); | - | ||||||||||||||||||||||||
| 1421 | priv = | - | ||||||||||||||||||||||||
| 1422 | ((void *)0) | - | ||||||||||||||||||||||||
| 1423 | ; | - | ||||||||||||||||||||||||
| 1424 | - | |||||||||||||||||||||||||
| 1425 | if (!(a->enc_flag & 0x001)
| 10-206 | ||||||||||||||||||||||||
| 1426 | if ((
| 0-206 | ||||||||||||||||||||||||
| 1427 | EC_GROUP_get_ecpkparameters(a->group,
| 0-206 | ||||||||||||||||||||||||
| 1428 | priv_key->parameters)) ==
| 0-206 | ||||||||||||||||||||||||
| 1429 | ((void *)0)
| 0-206 | ||||||||||||||||||||||||
| 1430 | ) { | - | ||||||||||||||||||||||||
| 1431 | ERR_put_error(16,(192),(16),__FILE__,1006); | - | ||||||||||||||||||||||||
| 1432 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1433 | } | - | ||||||||||||||||||||||||
| 1434 | } executed 206 times by 1 test: end of blockExecuted by:
| 206 | ||||||||||||||||||||||||
| 1435 | - | |||||||||||||||||||||||||
| 1436 | if (!(a->enc_flag & 0x002)
| 28-188 | ||||||||||||||||||||||||
| 1437 | priv_key->publicKey = ASN1_BIT_STRING_new(); | - | ||||||||||||||||||||||||
| 1438 | if (priv_key->publicKey ==
| 0-28 | ||||||||||||||||||||||||
| 1439 | ((void *)0)
| 0-28 | ||||||||||||||||||||||||
| 1440 | ) { | - | ||||||||||||||||||||||||
| 1441 | ERR_put_error(16,(192),((1|64)),__FILE__,1014); | - | ||||||||||||||||||||||||
| 1442 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1443 | } | - | ||||||||||||||||||||||||
| 1444 | - | |||||||||||||||||||||||||
| 1445 | publen = EC_KEY_key2buf(a, a->conv_form, &pub, | - | ||||||||||||||||||||||||
| 1446 | ((void *)0) | - | ||||||||||||||||||||||||
| 1447 | ); | - | ||||||||||||||||||||||||
| 1448 | - | |||||||||||||||||||||||||
| 1449 | if (publen == 0
| 0-28 | ||||||||||||||||||||||||
| 1450 | ERR_put_error(16,(192),(16),__FILE__,1021); | - | ||||||||||||||||||||||||
| 1451 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1452 | } | - | ||||||||||||||||||||||||
| 1453 | - | |||||||||||||||||||||||||
| 1454 | priv_key->publicKey->flags &= ~(0x08 | 0x07); | - | ||||||||||||||||||||||||
| 1455 | priv_key->publicKey->flags |= 0x08; | - | ||||||||||||||||||||||||
| 1456 | ASN1_STRING_set0(priv_key->publicKey, pub, publen); | - | ||||||||||||||||||||||||
| 1457 | pub = | - | ||||||||||||||||||||||||
| 1458 | ((void *)0) | - | ||||||||||||||||||||||||
| 1459 | ; | - | ||||||||||||||||||||||||
| 1460 | } executed 28 times by 1 test: end of blockExecuted by:
| 28 | ||||||||||||||||||||||||
| 1461 | - | |||||||||||||||||||||||||
| 1462 | if ((
| 0-216 | ||||||||||||||||||||||||
| 1463 | ERR_put_error(16,(192),(16),__FILE__,1032); | - | ||||||||||||||||||||||||
| 1464 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||||||||
| 1465 | } | - | ||||||||||||||||||||||||
| 1466 | ok = 1; | - | ||||||||||||||||||||||||
| 1467 | err: code before this statement executed 216 times by 1 test: err:Executed by:
| 216 | ||||||||||||||||||||||||
| 1468 | CRYPTO_clear_free(priv, privlen, __FILE__, 1037); | - | ||||||||||||||||||||||||
| 1469 | CRYPTO_free(pub, __FILE__, 1038); | - | ||||||||||||||||||||||||
| 1470 | EC_PRIVATEKEY_free(priv_key); | - | ||||||||||||||||||||||||
| 1471 | return executed 255 times by 1 test: (okreturn (ok ? ret : 0);Executed by:
executed 255 times by 1 test: return (ok ? ret : 0);Executed by:
| 39-255 | ||||||||||||||||||||||||
| 1472 | } | - | ||||||||||||||||||||||||
| 1473 | - | |||||||||||||||||||||||||
| 1474 | int i2d_ECParameters(EC_KEY *a, unsigned char **out) | - | ||||||||||||||||||||||||
| 1475 | { | - | ||||||||||||||||||||||||
| 1476 | if (a ==
| 0-22 | ||||||||||||||||||||||||
| 1477 | ((void *)0)
| 0-22 | ||||||||||||||||||||||||
| 1478 | ) { | - | ||||||||||||||||||||||||
| 1479 | ERR_put_error(16,(190),((3|64)),__FILE__,1046); | - | ||||||||||||||||||||||||
| 1480 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1481 | } | - | ||||||||||||||||||||||||
| 1482 | return executed 22 times by 1 test: i2d_ECPKParameters(a->group, out);return i2d_ECPKParameters(a->group, out);Executed by:
executed 22 times by 1 test: return i2d_ECPKParameters(a->group, out);Executed by:
| 22 | ||||||||||||||||||||||||
| 1483 | } | - | ||||||||||||||||||||||||
| 1484 | - | |||||||||||||||||||||||||
| 1485 | EC_KEY *d2i_ECParameters(EC_KEY **a, const unsigned char **in, long len) | - | ||||||||||||||||||||||||
| 1486 | { | - | ||||||||||||||||||||||||
| 1487 | EC_KEY *ret; | - | ||||||||||||||||||||||||
| 1488 | - | |||||||||||||||||||||||||
| 1489 | if (in ==
| 0-5242 | ||||||||||||||||||||||||
| 1490 | ((void *)0)
| 0-5242 | ||||||||||||||||||||||||
| 1491 | || *
| 0-5242 | ||||||||||||||||||||||||
| 1492 | ((void *)0)
| 0-5242 | ||||||||||||||||||||||||
| 1493 | ) { | - | ||||||||||||||||||||||||
| 1494 | ERR_put_error(16,(144),((3|64)),__FILE__,1057); | - | ||||||||||||||||||||||||
| 1495 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 1496 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 1497 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 1498 | } | - | ||||||||||||||||||||||||
| 1499 | - | |||||||||||||||||||||||||
| 1500 | if (a ==
| 0-5242 | ||||||||||||||||||||||||
| 1501 | ((void *)0)
| 0-5242 | ||||||||||||||||||||||||
| 1502 | || *
| 0 | ||||||||||||||||||||||||
| 1503 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 1504 | ) { | - | ||||||||||||||||||||||||
| 1505 | if ((
| 0-5242 | ||||||||||||||||||||||||
| 1506 | ((void *)0)
| 0-5242 | ||||||||||||||||||||||||
| 1507 | ) { | - | ||||||||||||||||||||||||
| 1508 | ERR_put_error(16,(144),((1|64)),__FILE__,1063); | - | ||||||||||||||||||||||||
| 1509 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 1510 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 1511 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||
| 1512 | } | - | ||||||||||||||||||||||||
| 1513 | } executed 5242 times by 1 test: elseend of blockExecuted by:
| 5242 | ||||||||||||||||||||||||
| 1514 | ret = *a; never executed: ret = *a; | 0 | ||||||||||||||||||||||||
| 1515 | - | |||||||||||||||||||||||||
| 1516 | if (!d2i_ECPKParameters(&ret->group, in, len)
| 133-5109 | ||||||||||||||||||||||||
| 1517 | ERR_put_error(16,(144),(16),__FILE__,1070); | - | ||||||||||||||||||||||||
| 1518 | if (a ==
| 0-5109 | ||||||||||||||||||||||||
| 1519 | ((void *)0)
| 0-5109 | ||||||||||||||||||||||||
| 1520 | || *
| 0 | ||||||||||||||||||||||||
| 1521 | EC_KEY_free(ret); executed 5109 times by 1 test: EC_KEY_free(ret);Executed by:
| 5109 | ||||||||||||||||||||||||
| 1522 | return executed 5109 times by 1 test: return ((void *)0) ;Executed by:
executed 5109 times by 1 test: return ((void *)0) ;Executed by:
| 5109 | ||||||||||||||||||||||||
| 1523 | ((void *)0) executed 5109 times by 1 test: return ((void *)0) ;Executed by:
| 5109 | ||||||||||||||||||||||||
| 1524 | ; executed 5109 times by 1 test: return ((void *)0) ;Executed by:
| 5109 | ||||||||||||||||||||||||
| 1525 | } | - | ||||||||||||||||||||||||
| 1526 | - | |||||||||||||||||||||||||
| 1527 | if (a
| 0-133 | ||||||||||||||||||||||||
| 1528 | * never executed: a = ret;*a = ret;never executed: *a = ret; | 0 | ||||||||||||||||||||||||
| 1529 | - | |||||||||||||||||||||||||
| 1530 | return executed 133 times by 1 test: ret;return ret;Executed by:
executed 133 times by 1 test: return ret;Executed by:
| 133 | ||||||||||||||||||||||||
| 1531 | } | - | ||||||||||||||||||||||||
| 1532 | - | |||||||||||||||||||||||||
| 1533 | EC_KEY *o2i_ECPublicKey(EC_KEY **a, const unsigned char **in, long len) | - | ||||||||||||||||||||||||
| 1534 | { | - | ||||||||||||||||||||||||
| 1535 | EC_KEY *ret = | - | ||||||||||||||||||||||||
| 1536 | ((void *)0) | - | ||||||||||||||||||||||||
| 1537 | ; | - | ||||||||||||||||||||||||
| 1538 | - | |||||||||||||||||||||||||
| 1539 | if (a ==
| 0-30886 | ||||||||||||||||||||||||
| 1540 | ((void *)0)
| 0-30886 | ||||||||||||||||||||||||
| 1541 | || (*
| 0-30886 | ||||||||||||||||||||||||
| 1542 | ((void *)0)
| 0-30886 | ||||||||||||||||||||||||
| 1543 | || (*
| 0-30886 | ||||||||||||||||||||||||
| 1544 | ((void *)0)
| 0-30886 | ||||||||||||||||||||||||
| 1545 | ) { | - | ||||||||||||||||||||||||
| 1546 | - | |||||||||||||||||||||||||
| 1547 | - | |||||||||||||||||||||||||
| 1548 | - | |||||||||||||||||||||||||
| 1549 | ERR_put_error(16,(152),((3|64)),__FILE__,1090); | - | ||||||||||||||||||||||||
| 1550 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1551 | } | - | ||||||||||||||||||||||||
| 1552 | ret = *a; | - | ||||||||||||||||||||||||
| 1553 | if (!EC_KEY_oct2key(ret, *in, len,
| 7011-23875 | ||||||||||||||||||||||||
| 1554 | ((void *)0)
| 7011-23875 | ||||||||||||||||||||||||
| 1555 | )
| 7011-23875 | ||||||||||||||||||||||||
| 1556 | ERR_put_error(16,(152),(16),__FILE__,1095); | - | ||||||||||||||||||||||||
| 1557 | return executed 7011 times by 1 test: 0;return 0;Executed by:
executed 7011 times by 1 test: return 0;Executed by:
| 7011 | ||||||||||||||||||||||||
| 1558 | } | - | ||||||||||||||||||||||||
| 1559 | *in += len; | - | ||||||||||||||||||||||||
| 1560 | return executed 23875 times by 1 test: ret;return ret;Executed by:
executed 23875 times by 1 test: return ret;Executed by:
| 23875 | ||||||||||||||||||||||||
| 1561 | } | - | ||||||||||||||||||||||||
| 1562 | - | |||||||||||||||||||||||||
| 1563 | int i2o_ECPublicKey(const EC_KEY *a, unsigned char **out) | - | ||||||||||||||||||||||||
| 1564 | { | - | ||||||||||||||||||||||||
| 1565 | size_t buf_len = 0; | - | ||||||||||||||||||||||||
| 1566 | int new_buffer = 0; | - | ||||||||||||||||||||||||
| 1567 | - | |||||||||||||||||||||||||
| 1568 | if (a ==
| 0-26186 | ||||||||||||||||||||||||
| 1569 | ((void *)0)
| 0-26186 | ||||||||||||||||||||||||
| 1570 | ) { | - | ||||||||||||||||||||||||
| 1571 | ERR_put_error(16,(151),((3|64)),__FILE__,1108); | - | ||||||||||||||||||||||||
| 1572 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1573 | } | - | ||||||||||||||||||||||||
| 1574 | - | |||||||||||||||||||||||||
| 1575 | buf_len = EC_POINT_point2oct(a->group, a->pub_key, | - | ||||||||||||||||||||||||
| 1576 | a->conv_form, | - | ||||||||||||||||||||||||
| 1577 | ((void *)0) | - | ||||||||||||||||||||||||
| 1578 | , 0, | - | ||||||||||||||||||||||||
| 1579 | ((void *)0) | - | ||||||||||||||||||||||||
| 1580 | ); | - | ||||||||||||||||||||||||
| 1581 | - | |||||||||||||||||||||||||
| 1582 | if (out ==
| 13093 | ||||||||||||||||||||||||
| 1583 | ((void *)0)
| 13093 | ||||||||||||||||||||||||
| 1584 | || buf_len == 0
| 0-13093 | ||||||||||||||||||||||||
| 1585 | - | |||||||||||||||||||||||||
| 1586 | return executed 13093 times by 1 test: buf_len;return buf_len;Executed by:
executed 13093 times by 1 test: return buf_len;Executed by:
| 13093 | ||||||||||||||||||||||||
| 1587 | - | |||||||||||||||||||||||||
| 1588 | if (*
| 0-13093 | ||||||||||||||||||||||||
| 1589 | ((void *)0)
| 0-13093 | ||||||||||||||||||||||||
| 1590 | ) { | - | ||||||||||||||||||||||||
| 1591 | if ((*
| 0 | ||||||||||||||||||||||||
| 1592 | ((void *)0)
| 0 | ||||||||||||||||||||||||
| 1593 | ) { | - | ||||||||||||||||||||||||
| 1594 | ERR_put_error(16,(151),((1|64)),__FILE__,1121); | - | ||||||||||||||||||||||||
| 1595 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1596 | } | - | ||||||||||||||||||||||||
| 1597 | new_buffer = 1; | - | ||||||||||||||||||||||||
| 1598 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1599 | if (!EC_POINT_point2oct(a->group, a->pub_key, a->conv_form,
| 0-13093 | ||||||||||||||||||||||||
| 1600 | *out, buf_len,
| 0-13093 | ||||||||||||||||||||||||
| 1601 | ((void *)0)
| 0-13093 | ||||||||||||||||||||||||
| 1602 | )
| 0-13093 | ||||||||||||||||||||||||
| 1603 | ERR_put_error(16,(151),(16),__FILE__,1128); | - | ||||||||||||||||||||||||
| 1604 | if (new_buffer
| 0 | ||||||||||||||||||||||||
| 1605 | CRYPTO_free(*out, __FILE__, 1130); | - | ||||||||||||||||||||||||
| 1606 | *out = | - | ||||||||||||||||||||||||
| 1607 | ((void *)0) | - | ||||||||||||||||||||||||
| 1608 | ; | - | ||||||||||||||||||||||||
| 1609 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1610 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1611 | } | - | ||||||||||||||||||||||||
| 1612 | if (!new_buffer
| 0-13093 | ||||||||||||||||||||||||
| 1613 | * executed 13093 times by 1 test: out += buf_len;*out += buf_len;Executed by:
executed 13093 times by 1 test: *out += buf_len;Executed by:
| 13093 | ||||||||||||||||||||||||
| 1614 | return executed 13093 times by 1 test: buf_len;return buf_len;Executed by:
executed 13093 times by 1 test: return buf_len;Executed by:
| 13093 | ||||||||||||||||||||||||
| 1615 | } | - | ||||||||||||||||||||||||
| 1616 | - | |||||||||||||||||||||||||
| 1617 | static const ASN1_TEMPLATE ECDSA_SIG_seq_tt[] = { | - | ||||||||||||||||||||||||
| 1618 | { (0), (0), | - | ||||||||||||||||||||||||
| 1619 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 1620 | ECDSA_SIG | - | ||||||||||||||||||||||||
| 1621 | , | - | ||||||||||||||||||||||||
| 1622 | r | - | ||||||||||||||||||||||||
| 1623 | ) | - | ||||||||||||||||||||||||
| 1624 | , "r", (&(CBIGNUM_it)) }, | - | ||||||||||||||||||||||||
| 1625 | { (0), (0), | - | ||||||||||||||||||||||||
| 1626 | __builtin_offsetof ( | - | ||||||||||||||||||||||||
| 1627 | ECDSA_SIG | - | ||||||||||||||||||||||||
| 1628 | , | - | ||||||||||||||||||||||||
| 1629 | s | - | ||||||||||||||||||||||||
| 1630 | ) | - | ||||||||||||||||||||||||
| 1631 | , "s", (&(CBIGNUM_it)) } | - | ||||||||||||||||||||||||
| 1632 | } ; static const ASN1_ITEM ECDSA_SIG_it = { 0x1, 16, ECDSA_SIG_seq_tt, sizeof(ECDSA_SIG_seq_tt) / sizeof(ASN1_TEMPLATE), | - | ||||||||||||||||||||||||
| 1633 | ((void *)0) | - | ||||||||||||||||||||||||
| 1634 | , sizeof(ECDSA_SIG), "ECDSA_SIG" }; | - | ||||||||||||||||||||||||
| 1635 | - | |||||||||||||||||||||||||
| 1636 | ECDSA_SIG *ECDSA_SIG_new(void); void ECDSA_SIG_free(ECDSA_SIG *a); ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **a, const unsigned char **in, long len); int i2d_ECDSA_SIG(const ECDSA_SIG *a, unsigned char **out); extern const ASN1_ITEM ECDSA_SIG_it; | - | ||||||||||||||||||||||||
| 1637 | ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **a, const unsigned char **in, long len); int i2d_ECDSA_SIG(const ECDSA_SIG *a, unsigned char **out); extern const ASN1_ITEM ECDSA_SIG_it; | - | ||||||||||||||||||||||||
| 1638 | ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **a, const unsigned char **in, long len) { return executed 4060 times by 1 test: (ECDSA_SIG *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ECDSA_SIG_it)));return (ECDSA_SIG *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ECDSA_SIG_it)));Executed by:
executed 4060 times by 1 test: } int i2d_ECDSA_SIG(const ECDSA_SIG *a, unsigned char **out) { returnreturn (ECDSA_SIG *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (&(ECDSA_SIG_it)));Executed by:
executed 1106 times by 1 test: ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ECDSA_SIG_it)));return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ECDSA_SIG_it)));Executed by:
executed 1106 times by 1 test: }return ASN1_item_i2d((ASN1_VALUE *)a, out, (&(ECDSA_SIG_it)));Executed by:
| 1106-4060 | ||||||||||||||||||||||||
| 1639 | - | |||||||||||||||||||||||||
| 1640 | ECDSA_SIG *ECDSA_SIG_new(void) | - | ||||||||||||||||||||||||
| 1641 | { | - | ||||||||||||||||||||||||
| 1642 | ECDSA_SIG *sig = CRYPTO_zalloc(sizeof(*sig), __FILE__, 1151); | - | ||||||||||||||||||||||||
| 1643 | if (sig ==
| 0-1107 | ||||||||||||||||||||||||
| 1644 | ((void *)0)
| 0-1107 | ||||||||||||||||||||||||
| 1645 | ) | - | ||||||||||||||||||||||||
| 1646 | ERR_put_error(16,(265),((1|64)),__FILE__,1153); never executed: ERR_put_error(16,(265),((1|64)),__FILE__,1153); | 0 | ||||||||||||||||||||||||
| 1647 | return executed 1107 times by 2 tests: sig;return sig;Executed by:
executed 1107 times by 2 tests: return sig;Executed by:
| 1107 | ||||||||||||||||||||||||
| 1648 | } | - | ||||||||||||||||||||||||
| 1649 | - | |||||||||||||||||||||||||
| 1650 | void ECDSA_SIG_free(ECDSA_SIG *sig) | - | ||||||||||||||||||||||||
| 1651 | { | - | ||||||||||||||||||||||||
| 1652 | if (sig ==
| 76-1111 | ||||||||||||||||||||||||
| 1653 | ((void *)0)
| 76-1111 | ||||||||||||||||||||||||
| 1654 | ) | - | ||||||||||||||||||||||||
| 1655 | return; executed 76 times by 1 test: return;Executed by:
| 76 | ||||||||||||||||||||||||
| 1656 | BN_clear_free(sig->r); | - | ||||||||||||||||||||||||
| 1657 | BN_clear_free(sig->s); | - | ||||||||||||||||||||||||
| 1658 | CRYPTO_free(sig, __FILE__, 1163); | - | ||||||||||||||||||||||||
| 1659 | } executed 1111 times by 2 tests: end of blockExecuted by:
| 1111 | ||||||||||||||||||||||||
| 1660 | - | |||||||||||||||||||||||||
| 1661 | void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps) | - | ||||||||||||||||||||||||
| 1662 | { | - | ||||||||||||||||||||||||
| 1663 | if (pr !=
| 0-79 | ||||||||||||||||||||||||
| 1664 | ((void *)0)
| 0-79 | ||||||||||||||||||||||||
| 1665 | ) | - | ||||||||||||||||||||||||
| 1666 | * executed 79 times by 2 tests: pr = sig->r;*pr = sig->r;Executed by:
executed 79 times by 2 tests: *pr = sig->r;Executed by:
| 79 | ||||||||||||||||||||||||
| 1667 | if (ps !=
| 0-79 | ||||||||||||||||||||||||
| 1668 | ((void *)0)
| 0-79 | ||||||||||||||||||||||||
| 1669 | ) | - | ||||||||||||||||||||||||
| 1670 | * executed 79 times by 2 tests: ps = sig->s;*ps = sig->s;Executed by:
executed 79 times by 2 tests: *ps = sig->s;Executed by:
| 79 | ||||||||||||||||||||||||
| 1671 | } executed 79 times by 2 tests: end of blockExecuted by:
| 79 | ||||||||||||||||||||||||
| 1672 | - | |||||||||||||||||||||||||
| 1673 | const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig) | - | ||||||||||||||||||||||||
| 1674 | { | - | ||||||||||||||||||||||||
| 1675 | return never executed: sig->r;return sig->r;never executed: return sig->r; | 0 | ||||||||||||||||||||||||
| 1676 | } | - | ||||||||||||||||||||||||
| 1677 | - | |||||||||||||||||||||||||
| 1678 | const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig) | - | ||||||||||||||||||||||||
| 1679 | { | - | ||||||||||||||||||||||||
| 1680 | return never executed: sig->s;return sig->s;never executed: return sig->s; | 0 | ||||||||||||||||||||||||
| 1681 | } | - | ||||||||||||||||||||||||
| 1682 | - | |||||||||||||||||||||||||
| 1683 | int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s) | - | ||||||||||||||||||||||||
| 1684 | { | - | ||||||||||||||||||||||||
| 1685 | if (r ==
| 0-139 | ||||||||||||||||||||||||
| 1686 | ((void *)0)
| 0-139 | ||||||||||||||||||||||||
| 1687 | || s ==
| 0-139 | ||||||||||||||||||||||||
| 1688 | ((void *)0)
| 0-139 | ||||||||||||||||||||||||
| 1689 | ) | - | ||||||||||||||||||||||||
| 1690 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1691 | BN_clear_free(sig->r); | - | ||||||||||||||||||||||||
| 1692 | BN_clear_free(sig->s); | - | ||||||||||||||||||||||||
| 1693 | sig->r = r; | - | ||||||||||||||||||||||||
| 1694 | sig->s = s; | - | ||||||||||||||||||||||||
| 1695 | return executed 139 times by 2 tests: 1;return 1;Executed by:
executed 139 times by 2 tests: return 1;Executed by:
| 139 | ||||||||||||||||||||||||
| 1696 | } | - | ||||||||||||||||||||||||
| 1697 | - | |||||||||||||||||||||||||
| 1698 | int ECDSA_size(const EC_KEY *r) | - | ||||||||||||||||||||||||
| 1699 | { | - | ||||||||||||||||||||||||
| 1700 | int ret, i; | - | ||||||||||||||||||||||||
| 1701 | ASN1_INTEGER bs; | - | ||||||||||||||||||||||||
| 1702 | unsigned char buf[4]; | - | ||||||||||||||||||||||||
| 1703 | const EC_GROUP *group; | - | ||||||||||||||||||||||||
| 1704 | - | |||||||||||||||||||||||||
| 1705 | if (r ==
| 0-849 | ||||||||||||||||||||||||
| 1706 | ((void *)0)
| 0-849 | ||||||||||||||||||||||||
| 1707 | ) | - | ||||||||||||||||||||||||
| 1708 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1709 | group = EC_KEY_get0_group(r); | - | ||||||||||||||||||||||||
| 1710 | if (group ==
| 0-849 | ||||||||||||||||||||||||
| 1711 | ((void *)0)
| 0-849 | ||||||||||||||||||||||||
| 1712 | ) | - | ||||||||||||||||||||||||
| 1713 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1714 | - | |||||||||||||||||||||||||
| 1715 | i = EC_GROUP_order_bits(group); | - | ||||||||||||||||||||||||
| 1716 | if (i == 0
| 0-849 | ||||||||||||||||||||||||
| 1717 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 1718 | bs.length = (i + 7) / 8; | - | ||||||||||||||||||||||||
| 1719 | bs.data = buf; | - | ||||||||||||||||||||||||
| 1720 | bs.type = 2; | - | ||||||||||||||||||||||||
| 1721 | - | |||||||||||||||||||||||||
| 1722 | buf[0] = 0xff; | - | ||||||||||||||||||||||||
| 1723 | - | |||||||||||||||||||||||||
| 1724 | i = i2d_ASN1_INTEGER(&bs, | - | ||||||||||||||||||||||||
| 1725 | ((void *)0) | - | ||||||||||||||||||||||||
| 1726 | ); | - | ||||||||||||||||||||||||
| 1727 | i += i; | - | ||||||||||||||||||||||||
| 1728 | ret = ASN1_object_size(1, i, 16); | - | ||||||||||||||||||||||||
| 1729 | return executed 849 times by 1 test: ret;return ret;Executed by:
executed 849 times by 1 test: return ret;Executed by:
| 849 | ||||||||||||||||||||||||
| 1730 | } | - | ||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |