summaryrefslogtreecommitdiff
path: root/jpake.c
diff options
context:
space:
mode:
Diffstat (limited to 'jpake.c')
-rw-r--r--jpake.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/jpake.c b/jpake.c
index cdf65f509..ac9a4bc34 100644
--- a/jpake.c
+++ b/jpake.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: jpake.c,v 1.4 2010/07/13 23:13:16 djm Exp $ */ 1/* $OpenBSD: jpake.c,v 1.6 2010/09/20 04:54:07 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2008 Damien Miller. All rights reserved. 3 * Copyright (c) 2008 Damien Miller. All rights reserved.
4 * 4 *
@@ -45,6 +45,7 @@
45#include "packet.h" 45#include "packet.h"
46#include "dispatch.h" 46#include "dispatch.h"
47#include "log.h" 47#include "log.h"
48#include "misc.h"
48 49
49#include "jpake.h" 50#include "jpake.h"
50#include "schnorr.h" 51#include "schnorr.h"
@@ -257,8 +258,12 @@ jpake_step2(struct modp_group *grp, BIGNUM *s,
257 /* Validate peer's step 1 values */ 258 /* Validate peer's step 1 values */
258 if (BN_cmp(theirpub1, BN_value_one()) <= 0) 259 if (BN_cmp(theirpub1, BN_value_one()) <= 0)
259 fatal("%s: theirpub1 <= 1", __func__); 260 fatal("%s: theirpub1 <= 1", __func__);
261 if (BN_cmp(theirpub1, grp->p) >= 0)
262 fatal("%s: theirpub1 >= p", __func__);
260 if (BN_cmp(theirpub2, BN_value_one()) <= 0) 263 if (BN_cmp(theirpub2, BN_value_one()) <= 0)
261 fatal("%s: theirpub2 <= 1", __func__); 264 fatal("%s: theirpub2 <= 1", __func__);
265 if (BN_cmp(theirpub2, grp->p) >= 0)
266 fatal("%s: theirpub2 >= p", __func__);
262 267
263 if (schnorr_verify_buf(grp->p, grp->q, grp->g, theirpub1, 268 if (schnorr_verify_buf(grp->p, grp->q, grp->g, theirpub1,
264 theirid, theirid_len, theirpub1_proof, theirpub1_proof_len) != 1) 269 theirid, theirid_len, theirpub1_proof, theirpub1_proof_len) != 1)
@@ -363,6 +368,8 @@ jpake_key_confirm(struct modp_group *grp, BIGNUM *s, BIGNUM *step2_val,
363 /* Validate step 2 values */ 368 /* Validate step 2 values */
364 if (BN_cmp(step2_val, BN_value_one()) <= 0) 369 if (BN_cmp(step2_val, BN_value_one()) <= 0)
365 fatal("%s: step2_val <= 1", __func__); 370 fatal("%s: step2_val <= 1", __func__);
371 if (BN_cmp(step2_val, grp->p) >= 0)
372 fatal("%s: step2_val >= p", __func__);
366 373
367 /* 374 /*
368 * theirpriv2_s_proof is calculated with a different generator: 375 * theirpriv2_s_proof is calculated with a different generator: