diff options
Diffstat (limited to 'src/lib/libcrypto/bn/bn_gf2m.c')
-rw-r--r-- | src/lib/libcrypto/bn/bn_gf2m.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/src/lib/libcrypto/bn/bn_gf2m.c b/src/lib/libcrypto/bn/bn_gf2m.c index 1cd38c7797..4544369248 100644 --- a/src/lib/libcrypto/bn/bn_gf2m.c +++ b/src/lib/libcrypto/bn/bn_gf2m.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bn_gf2m.c,v 1.16 2014/10/28 07:35:58 jsg Exp $ */ | 1 | /* $OpenBSD: bn_gf2m.c,v 1.17 2015/02/09 15:49:22 jsing Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
4 | * | 4 | * |
@@ -840,8 +840,7 @@ BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *y, const BIGNUM *x, const BIGNUM *p, | |||
840 | bn_check_top(p); | 840 | bn_check_top(p); |
841 | 841 | ||
842 | BN_CTX_start(ctx); | 842 | BN_CTX_start(ctx); |
843 | xinv = BN_CTX_get(ctx); | 843 | if ((xinv = BN_CTX_get(ctx)) == NULL) |
844 | if (xinv == NULL) | ||
845 | goto err; | 844 | goto err; |
846 | 845 | ||
847 | if (!BN_GF2m_mod_inv(xinv, x, p, ctx)) | 846 | if (!BN_GF2m_mod_inv(xinv, x, p, ctx)) |
@@ -875,11 +874,13 @@ BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *y, const BIGNUM *x, const BIGNUM *p, | |||
875 | 874 | ||
876 | BN_CTX_start(ctx); | 875 | BN_CTX_start(ctx); |
877 | 876 | ||
878 | a = BN_CTX_get(ctx); | 877 | if ((a = BN_CTX_get(ctx)) == NULL) |
879 | b = BN_CTX_get(ctx); | 878 | goto err; |
880 | u = BN_CTX_get(ctx); | 879 | if ((b = BN_CTX_get(ctx)) == NULL) |
881 | v = BN_CTX_get(ctx); | 880 | goto err; |
882 | if (v == NULL) | 881 | if ((u = BN_CTX_get(ctx)) == NULL) |
882 | goto err; | ||
883 | if ((v = BN_CTX_get(ctx)) == NULL) | ||
883 | goto err; | 884 | goto err; |
884 | 885 | ||
885 | /* reduce x and y mod p */ | 886 | /* reduce x and y mod p */ |
@@ -1137,10 +1138,11 @@ BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const int p[], | |||
1137 | } | 1138 | } |
1138 | 1139 | ||
1139 | BN_CTX_start(ctx); | 1140 | BN_CTX_start(ctx); |
1140 | a = BN_CTX_get(ctx); | 1141 | if ((a = BN_CTX_get(ctx)) == NULL) |
1141 | z = BN_CTX_get(ctx); | 1142 | goto err; |
1142 | w = BN_CTX_get(ctx); | 1143 | if ((z = BN_CTX_get(ctx)) == NULL) |
1143 | if (w == NULL) | 1144 | goto err; |
1145 | if ((w = BN_CTX_get(ctx)) == NULL) | ||
1144 | goto err; | 1146 | goto err; |
1145 | 1147 | ||
1146 | if (!BN_GF2m_mod_arr(a, a_, p)) | 1148 | if (!BN_GF2m_mod_arr(a, a_, p)) |
@@ -1169,10 +1171,11 @@ BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const int p[], | |||
1169 | } | 1171 | } |
1170 | else /* m is even */ | 1172 | else /* m is even */ |
1171 | { | 1173 | { |
1172 | rho = BN_CTX_get(ctx); | 1174 | if ((rho = BN_CTX_get(ctx)) == NULL) |
1173 | w2 = BN_CTX_get(ctx); | 1175 | goto err; |
1174 | tmp = BN_CTX_get(ctx); | 1176 | if ((w2 = BN_CTX_get(ctx)) == NULL) |
1175 | if (tmp == NULL) | 1177 | goto err; |
1178 | if ((tmp = BN_CTX_get(ctx)) == NULL) | ||
1176 | goto err; | 1179 | goto err; |
1177 | do { | 1180 | do { |
1178 | if (!BN_rand(rho, p[0], 0, 0)) | 1181 | if (!BN_rand(rho, p[0], 0, 0)) |