summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ec/ecp_smpl.c
diff options
context:
space:
mode:
authorjsing <>2022-11-24 01:30:01 +0000
committerjsing <>2022-11-24 01:30:01 +0000
commit8a7c8abfd4f8805f2a5101e89356e9411d908a0c (patch)
treefaea38f1c86dae9f6d4b143b2aa9f7752ecd0a34 /src/lib/libcrypto/ec/ecp_smpl.c
parent095ccaedd0631462c52a1a2d9aa19b35c3e45b12 (diff)
downloadopenbsd-8a7c8abfd4f8805f2a5101e89356e9411d908a0c.tar.gz
openbsd-8a7c8abfd4f8805f2a5101e89356e9411d908a0c.tar.bz2
openbsd-8a7c8abfd4f8805f2a5101e89356e9411d908a0c.zip
Change bn_expand()/bn_wexpand() to indicate failure/success via 0/1.
Currently bn_expand()/bn_wexpand() return a BIGNUM *, however none of the callers use this (and many already treat it as a true/false value). Change these functions to return 0 on failure and 1 on success, revising callers that test against NULL in the process. ok tb@
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/ec/ecp_smpl.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/libcrypto/ec/ecp_smpl.c b/src/lib/libcrypto/ec/ecp_smpl.c
index 55fb46869d..71d403b854 100644
--- a/src/lib/libcrypto/ec/ecp_smpl.c
+++ b/src/lib/libcrypto/ec/ecp_smpl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecp_smpl.c,v 1.36 2022/11/19 07:29:29 tb Exp $ */ 1/* $OpenBSD: ecp_smpl.c,v 1.37 2022/11/24 01:30:01 jsing Exp $ */
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.
@@ -1556,8 +1556,8 @@ ec_GFp_simple_mul_ct(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
1556 */ 1556 */
1557 cardinality_bits = BN_num_bits(cardinality); 1557 cardinality_bits = BN_num_bits(cardinality);
1558 group_top = cardinality->top; 1558 group_top = cardinality->top;
1559 if ((bn_wexpand(k, group_top + 2) == NULL) || 1559 if (!bn_wexpand(k, group_top + 2) ||
1560 (bn_wexpand(lambda, group_top + 2) == NULL)) 1560 !bn_wexpand(lambda, group_top + 2))
1561 goto err; 1561 goto err;
1562 1562
1563 if (!BN_copy(k, scalar)) 1563 if (!BN_copy(k, scalar))
@@ -1588,12 +1588,12 @@ ec_GFp_simple_mul_ct(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
1588 goto err; 1588 goto err;
1589 1589
1590 group_top = group->field.top; 1590 group_top = group->field.top;
1591 if ((bn_wexpand(&s->X, group_top) == NULL) || 1591 if (!bn_wexpand(&s->X, group_top) ||
1592 (bn_wexpand(&s->Y, group_top) == NULL) || 1592 !bn_wexpand(&s->Y, group_top) ||
1593 (bn_wexpand(&s->Z, group_top) == NULL) || 1593 !bn_wexpand(&s->Z, group_top) ||
1594 (bn_wexpand(&r->X, group_top) == NULL) || 1594 !bn_wexpand(&r->X, group_top) ||
1595 (bn_wexpand(&r->Y, group_top) == NULL) || 1595 !bn_wexpand(&r->Y, group_top) ||
1596 (bn_wexpand(&r->Z, group_top) == NULL)) 1596 !bn_wexpand(&r->Z, group_top))
1597 goto err; 1597 goto err;
1598 1598
1599 /* 1599 /*