summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_mul.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bn/bn_mul.c')
-rw-r--r--src/lib/libcrypto/bn/bn_mul.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/lib/libcrypto/bn/bn_mul.c b/src/lib/libcrypto/bn/bn_mul.c
index 7794d59707..fa9d559da9 100644
--- a/src/lib/libcrypto/bn/bn_mul.c
+++ b/src/lib/libcrypto/bn/bn_mul.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_mul.c,v 1.20 2015/02/09 15:49:22 jsing Exp $ */ 1/* $OpenBSD: bn_mul.c,v 1.21 2022/11/24 01:30:01 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -982,7 +982,7 @@ BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
982 if (i == 0) { 982 if (i == 0) {
983# if 0 983# if 0
984 if (al == 4) { 984 if (al == 4) {
985 if (bn_wexpand(rr, 8) == NULL) 985 if (!bn_wexpand(rr, 8))
986 goto err; 986 goto err;
987 rr->top = 8; 987 rr->top = 8;
988 bn_mul_comba4(rr->d, a->d, b->d); 988 bn_mul_comba4(rr->d, a->d, b->d);
@@ -990,7 +990,7 @@ BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
990 } 990 }
991# endif 991# endif
992 if (al == 8) { 992 if (al == 8) {
993 if (bn_wexpand(rr, 16) == NULL) 993 if (!bn_wexpand(rr, 16))
994 goto err; 994 goto err;
995 rr->top = 16; 995 rr->top = 16;
996 bn_mul_comba8(rr->d, a->d, b->d); 996 bn_mul_comba8(rr->d, a->d, b->d);
@@ -1015,18 +1015,18 @@ BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
1015 if ((t = BN_CTX_get(ctx)) == NULL) 1015 if ((t = BN_CTX_get(ctx)) == NULL)
1016 goto err; 1016 goto err;
1017 if (al > j || bl > j) { 1017 if (al > j || bl > j) {
1018 if (bn_wexpand(t, k * 4) == NULL) 1018 if (!bn_wexpand(t, k * 4))
1019 goto err; 1019 goto err;
1020 if (bn_wexpand(rr, k * 4) == NULL) 1020 if (!bn_wexpand(rr, k * 4))
1021 goto err; 1021 goto err;
1022 bn_mul_part_recursive(rr->d, a->d, b->d, 1022 bn_mul_part_recursive(rr->d, a->d, b->d,
1023 j, al - j, bl - j, t->d); 1023 j, al - j, bl - j, t->d);
1024 } 1024 }
1025 else /* al <= j || bl <= j */ 1025 else /* al <= j || bl <= j */
1026 { 1026 {
1027 if (bn_wexpand(t, k * 2) == NULL) 1027 if (!bn_wexpand(t, k * 2))
1028 goto err; 1028 goto err;
1029 if (bn_wexpand(rr, k * 2) == NULL) 1029 if (!bn_wexpand(rr, k * 2))
1030 goto err; 1030 goto err;
1031 bn_mul_recursive(rr->d, a->d, b->d, 1031 bn_mul_recursive(rr->d, a->d, b->d,
1032 j, al - j, bl - j, t->d); 1032 j, al - j, bl - j, t->d);
@@ -1037,14 +1037,14 @@ BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
1037#if 0 1037#if 0
1038 if (i == 1 && !BN_get_flags(b, BN_FLG_STATIC_DATA)) { 1038 if (i == 1 && !BN_get_flags(b, BN_FLG_STATIC_DATA)) {
1039 BIGNUM *tmp_bn = (BIGNUM *)b; 1039 BIGNUM *tmp_bn = (BIGNUM *)b;
1040 if (bn_wexpand(tmp_bn, al) == NULL) 1040 if (!bn_wexpand(tmp_bn, al))
1041 goto err; 1041 goto err;
1042 tmp_bn->d[bl] = 0; 1042 tmp_bn->d[bl] = 0;
1043 bl++; 1043 bl++;
1044 i--; 1044 i--;
1045 } else if (i == -1 && !BN_get_flags(a, BN_FLG_STATIC_DATA)) { 1045 } else if (i == -1 && !BN_get_flags(a, BN_FLG_STATIC_DATA)) {
1046 BIGNUM *tmp_bn = (BIGNUM *)a; 1046 BIGNUM *tmp_bn = (BIGNUM *)a;
1047 if (bn_wexpand(tmp_bn, bl) == NULL) 1047 if (!bn_wexpand(tmp_bn, bl))
1048 goto err; 1048 goto err;
1049 tmp_bn->d[al] = 0; 1049 tmp_bn->d[al] = 0;
1050 al++; 1050 al++;
@@ -1060,15 +1060,15 @@ BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
1060 goto err; 1060 goto err;
1061 if (al == j) /* exact multiple */ 1061 if (al == j) /* exact multiple */
1062 { 1062 {
1063 if (bn_wexpand(t, k * 2) == NULL) 1063 if (!bn_wexpand(t, k * 2))
1064 goto err; 1064 goto err;
1065 if (bn_wexpand(rr, k * 2) == NULL) 1065 if (!bn_wexpand(rr, k * 2))
1066 goto err; 1066 goto err;
1067 bn_mul_recursive(rr->d, a->d, b->d, al, t->d); 1067 bn_mul_recursive(rr->d, a->d, b->d, al, t->d);
1068 } else { 1068 } else {
1069 if (bn_wexpand(t, k * 4) == NULL) 1069 if (!bn_wexpand(t, k * 4))
1070 goto err; 1070 goto err;
1071 if (bn_wexpand(rr, k * 4) == NULL) 1071 if (!bn_wexpand(rr, k * 4))
1072 goto err; 1072 goto err;
1073 bn_mul_part_recursive(rr->d, a->d, b->d, 1073 bn_mul_part_recursive(rr->d, a->d, b->d,
1074 al - j, j, t->d); 1074 al - j, j, t->d);
@@ -1079,7 +1079,7 @@ BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
1079#endif 1079#endif
1080 } 1080 }
1081#endif /* BN_RECURSION */ 1081#endif /* BN_RECURSION */
1082 if (bn_wexpand(rr, top) == NULL) 1082 if (!bn_wexpand(rr, top))
1083 goto err; 1083 goto err;
1084 rr->top = top; 1084 rr->top = top;
1085 bn_mul_normal(rr->d, a->d, al, b->d, bl); 1085 bn_mul_normal(rr->d, a->d, al, b->d, bl);