diff options
author | Damien Miller <djm@mindrot.org> | 2010-09-24 22:03:24 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2010-09-24 22:03:24 +1000 |
commit | f7540cd5c4047675d03b2426bb6c32d3ff811bf7 (patch) | |
tree | 6a1f00877c30f14cb8243dd965290c073489cd8c /jpake.c | |
parent | 857b02e37f3bd6d5390711521e2dd021beca3a3c (diff) |
- djm@cvs.openbsd.org 2010/09/20 04:50:53
[jpake.c schnorr.c]
check that received values are smaller than the group size in the
disabled and unfinished J-PAKE code.
avoids catastrophic security failure found by Sebastien Martini
Diffstat (limited to 'jpake.c')
-rw-r--r-- | jpake.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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.5 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 | * |
@@ -257,8 +257,12 @@ jpake_step2(struct modp_group *grp, BIGNUM *s, | |||
257 | /* Validate peer's step 1 values */ | 257 | /* Validate peer's step 1 values */ |
258 | if (BN_cmp(theirpub1, BN_value_one()) <= 0) | 258 | if (BN_cmp(theirpub1, BN_value_one()) <= 0) |
259 | fatal("%s: theirpub1 <= 1", __func__); | 259 | fatal("%s: theirpub1 <= 1", __func__); |
260 | if (BN_cmp(theirpub1, grp->p) >= 0) | ||
261 | fatal("%s: theirpub1 >= p", __func__); | ||
260 | if (BN_cmp(theirpub2, BN_value_one()) <= 0) | 262 | if (BN_cmp(theirpub2, BN_value_one()) <= 0) |
261 | fatal("%s: theirpub2 <= 1", __func__); | 263 | fatal("%s: theirpub2 <= 1", __func__); |
264 | if (BN_cmp(theirpub2, grp->p) >= 0) | ||
265 | fatal("%s: theirpub2 >= p", __func__); | ||
262 | 266 | ||
263 | if (schnorr_verify_buf(grp->p, grp->q, grp->g, theirpub1, | 267 | if (schnorr_verify_buf(grp->p, grp->q, grp->g, theirpub1, |
264 | theirid, theirid_len, theirpub1_proof, theirpub1_proof_len) != 1) | 268 | theirid, theirid_len, theirpub1_proof, theirpub1_proof_len) != 1) |
@@ -363,6 +367,8 @@ jpake_key_confirm(struct modp_group *grp, BIGNUM *s, BIGNUM *step2_val, | |||
363 | /* Validate step 2 values */ | 367 | /* Validate step 2 values */ |
364 | if (BN_cmp(step2_val, BN_value_one()) <= 0) | 368 | if (BN_cmp(step2_val, BN_value_one()) <= 0) |
365 | fatal("%s: step2_val <= 1", __func__); | 369 | fatal("%s: step2_val <= 1", __func__); |
370 | if (BN_cmp(step2_val, grp->p) >= 0) | ||
371 | fatal("%s: step2_val >= p", __func__); | ||
366 | 372 | ||
367 | /* | 373 | /* |
368 | * theirpriv2_s_proof is calculated with a different generator: | 374 | * theirpriv2_s_proof is calculated with a different generator: |