| OLD | NEW |
| 1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | 4 |
| 5 #include "mpi.h" | 5 #include "mpi.h" |
| 6 #include "mplogic.h" | 6 #include "mplogic.h" |
| 7 #include "ecl.h" | 7 #include "ecl.h" |
| 8 #include "ecl-priv.h" | 8 #include "ecl-priv.h" |
| 9 #include "ec2.h" | 9 #include "ec2.h" |
| 10 #include "ecp.h" | 10 #include "ecp.h" |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; } | 249 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; } |
| 250 MP_CHECKOK(ec_group_set_nistp224_fp(group)); | 250 MP_CHECKOK(ec_group_set_nistp224_fp(group)); |
| 251 #else | 251 #else |
| 252 group = | 252 group = |
| 253 ECGroup_consGFp(&irr, &curvea, &curveb, &genx, &
geny, | 253 ECGroup_consGFp(&irr, &curvea, &curveb, &genx, &
geny, |
| 254 &order, params->
cofactor); | 254 &order, params->
cofactor); |
| 255 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; } | 255 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; } |
| 256 MP_CHECKOK(ec_group_set_gfp224(group, name)); | 256 MP_CHECKOK(ec_group_set_gfp224(group, name)); |
| 257 #endif | 257 #endif |
| 258 break; | 258 break; |
| 259 #endif /* NSS_ECC_MORE_THAN_SUITE_B */ |
| 260 case ECCurve_SECG_PRIME_256R1: |
| 261 group = |
| 262 ECGroup_consGFp(&irr, &curvea, &curveb, &genx, &
geny, |
| 263 &order, params->
cofactor); |
| 264 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; } |
| 265 MP_CHECKOK(ec_group_set_gfp256(group, name)); |
| 266 MP_CHECKOK(ec_group_set_gfp256_32(group, name)); |
| 267 break; |
| 259 case ECCurve_SECG_PRIME_521R1: | 268 case ECCurve_SECG_PRIME_521R1: |
| 260 group = | 269 group = |
| 261 ECGroup_consGFp(&irr, &curvea, &curveb, &genx, &
geny, | 270 ECGroup_consGFp(&irr, &curvea, &curveb, &genx, &
geny, |
| 262 &order, params->
cofactor); | 271 &order, params->
cofactor); |
| 263 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; } | 272 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; } |
| 264 MP_CHECKOK(ec_group_set_gfp521(group, name)); | 273 MP_CHECKOK(ec_group_set_gfp521(group, name)); |
| 265 break; | 274 break; |
| 266 #endif /* NSS_ECC_MORE_THAN_SUITE_B */ | |
| 267 case ECCurve_SECG_PRIME_256R1: | |
| 268 group = | |
| 269 ECGroup_consGFp(&irr, &curvea, &curveb, &genx, &
geny, | |
| 270 &order, params->
cofactor); | |
| 271 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; } | |
| 272 #ifdef NSS_ECC_MORE_THAN_SUITE_B | |
| 273 MP_CHECKOK(ec_group_set_gfp256(group, name)); | |
| 274 #endif | |
| 275 MP_CHECKOK(ec_group_set_gfp256_32(group, name)); | |
| 276 break; | |
| 277 default: | 275 default: |
| 278 /* use generic arithmetic */ | 276 /* use generic arithmetic */ |
| 279 group = | 277 group = |
| 280 ECGroup_consGFp_mont(&irr, &curvea, &curveb, &ge
nx, &geny, | 278 ECGroup_consGFp_mont(&irr, &curvea, &curveb, &ge
nx, &geny, |
| 281 &order,
params->cofactor); | 279 &order,
params->cofactor); |
| 282 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; } | 280 if (group == NULL) { res = MP_UNDEF; goto CLEANUP; } |
| 283 } | 281 } |
| 284 #ifdef NSS_ECC_MORE_THAN_SUITE_B | 282 #ifdef NSS_ECC_MORE_THAN_SUITE_B |
| 285 } else if (params->field == ECField_GF2m) { | 283 } else if (params->field == ECField_GF2m) { |
| 286 group = ECGroup_consGF2m(&irr, NULL, &curvea, &curveb, &genx, &g
eny, &order, params->cofactor); | 284 group = ECGroup_consGF2m(&irr, NULL, &curvea, &curveb, &genx, &g
eny, &order, params->cofactor); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 mp_clear(&group->curveb); | 387 mp_clear(&group->curveb); |
| 390 mp_clear(&group->genx); | 388 mp_clear(&group->genx); |
| 391 mp_clear(&group->geny); | 389 mp_clear(&group->geny); |
| 392 mp_clear(&group->order); | 390 mp_clear(&group->order); |
| 393 if (group->text != NULL) | 391 if (group->text != NULL) |
| 394 free(group->text); | 392 free(group->text); |
| 395 if (group->extra_free != NULL) | 393 if (group->extra_free != NULL) |
| 396 group->extra_free(group); | 394 group->extra_free(group); |
| 397 free(group); | 395 free(group); |
| 398 } | 396 } |
| OLD | NEW |