| OLD | NEW |
| 1 /* crypto/ec/ecp_smpl.c */ | 1 /* crypto/ec/ecp_smpl.c */ |
| 2 /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> | 2 /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> |
| 3 * for the OpenSSL project. | 3 * for the OpenSSL project. |
| 4 * Includes code written by Bodo Moeller for the OpenSSL project. | 4 * Includes code written by Bodo Moeller for the OpenSSL project. |
| 5 */ | 5 */ |
| 6 /* ==================================================================== | 6 /* ==================================================================== |
| 7 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. | 7 * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. |
| 8 * | 8 * |
| 9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
| 10 * modification, are permitted provided that the following conditions | 10 * modification, are permitted provided that the following conditions |
| (...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1399 int (*field_sqr)(const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *); | 1399 int (*field_sqr)(const EC_GROUP *, BIGNUM *, const BIGNUM *, BN_CTX *); |
| 1400 BN_CTX *new_ctx = NULL; | 1400 BN_CTX *new_ctx = NULL; |
| 1401 BIGNUM *tmp1, *tmp2, *Za23, *Zb23; | 1401 BIGNUM *tmp1, *tmp2, *Za23, *Zb23; |
| 1402 const BIGNUM *tmp1_, *tmp2_; | 1402 const BIGNUM *tmp1_, *tmp2_; |
| 1403 int ret = -1; | 1403 int ret = -1; |
| 1404 | 1404 |
| 1405 if (EC_POINT_is_at_infinity(group, a)) | 1405 if (EC_POINT_is_at_infinity(group, a)) |
| 1406 { | 1406 { |
| 1407 return EC_POINT_is_at_infinity(group, b) ? 0 : 1; | 1407 return EC_POINT_is_at_infinity(group, b) ? 0 : 1; |
| 1408 } | 1408 } |
| 1409 |
| 1410 if (EC_POINT_is_at_infinity(group, b)) |
| 1411 return 1; |
| 1409 | 1412 |
| 1410 if (a->Z_is_one && b->Z_is_one) | 1413 if (a->Z_is_one && b->Z_is_one) |
| 1411 { | 1414 { |
| 1412 return ((BN_cmp(&a->X, &b->X) == 0) && BN_cmp(&a->Y, &b->Y) == 0
) ? 0 : 1; | 1415 return ((BN_cmp(&a->X, &b->X) == 0) && BN_cmp(&a->Y, &b->Y) == 0
) ? 0 : 1; |
| 1413 } | 1416 } |
| 1414 | 1417 |
| 1415 field_mul = group->meth->field_mul; | 1418 field_mul = group->meth->field_mul; |
| 1416 field_sqr = group->meth->field_sqr; | 1419 field_sqr = group->meth->field_sqr; |
| 1417 | 1420 |
| 1418 if (ctx == NULL) | 1421 if (ctx == NULL) |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1707 int ec_GFp_simple_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, c
onst BIGNUM *b, BN_CTX *ctx) | 1710 int ec_GFp_simple_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, c
onst BIGNUM *b, BN_CTX *ctx) |
| 1708 { | 1711 { |
| 1709 return BN_mod_mul(r, a, b, &group->field, ctx); | 1712 return BN_mod_mul(r, a, b, &group->field, ctx); |
| 1710 } | 1713 } |
| 1711 | 1714 |
| 1712 | 1715 |
| 1713 int ec_GFp_simple_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, B
N_CTX *ctx) | 1716 int ec_GFp_simple_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, B
N_CTX *ctx) |
| 1714 { | 1717 { |
| 1715 return BN_mod_sqr(r, a, &group->field, ctx); | 1718 return BN_mod_sqr(r, a, &group->field, ctx); |
| 1716 } | 1719 } |
| OLD | NEW |