summaryrefslogtreecommitdiff
path: root/schnorr.c
diff options
context:
space:
mode:
Diffstat (limited to 'schnorr.c')
-rw-r--r--schnorr.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/schnorr.c b/schnorr.c
index c17ff3241..8da2feaad 100644
--- a/schnorr.c
+++ b/schnorr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: schnorr.c,v 1.3 2009/03/05 07:18:19 djm Exp $ */ 1/* $OpenBSD: schnorr.c,v 1.4 2010/09/20 04:50:53 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2008 Damien Miller. All rights reserved. 3 * Copyright (c) 2008 Damien Miller. All rights reserved.
4 * 4 *
@@ -138,6 +138,10 @@ schnorr_sign(const BIGNUM *grp_p, const BIGNUM *grp_q, const BIGNUM *grp_g,
138 error("%s: g_x < 1", __func__); 138 error("%s: g_x < 1", __func__);
139 return -1; 139 return -1;
140 } 140 }
141 if (BN_cmp(g_x, grp_p) >= 0) {
142 error("%s: g_x > g", __func__);
143 return -1;
144 }
141 145
142 h = g_v = r = tmp = v = NULL; 146 h = g_v = r = tmp = v = NULL;
143 if ((bn_ctx = BN_CTX_new()) == NULL) { 147 if ((bn_ctx = BN_CTX_new()) == NULL) {
@@ -264,6 +268,10 @@ schnorr_verify(const BIGNUM *grp_p, const BIGNUM *grp_q, const BIGNUM *grp_g,
264 error("%s: g_x < 1", __func__); 268 error("%s: g_x < 1", __func__);
265 return -1; 269 return -1;
266 } 270 }
271 if (BN_cmp(g_x, grp_p) >= 0) {
272 error("%s: g_x >= p", __func__);
273 return -1;
274 }
267 275
268 h = g_xh = g_r = expected = NULL; 276 h = g_xh = g_r = expected = NULL;
269 if ((bn_ctx = BN_CTX_new()) == NULL) { 277 if ((bn_ctx = BN_CTX_new()) == NULL) {