summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kexc25519.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/kexc25519.c b/kexc25519.c
index b6e6c4010..8d8cd4a2b 100644
--- a/kexc25519.c
+++ b/kexc25519.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kexc25519.c,v 1.8 2015/01/19 20:16:15 markus Exp $ */ 1/* $OpenBSD: kexc25519.c,v 1.9 2015/03/26 07:00:04 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2001, 2013 Markus Friedl. All rights reserved. 3 * Copyright (c) 2001, 2013 Markus Friedl. All rights reserved.
4 * Copyright (c) 2010 Damien Miller. All rights reserved. 4 * Copyright (c) 2010 Damien Miller. All rights reserved.
@@ -66,6 +66,11 @@ kexc25519_shared_key(const u_char key[CURVE25519_SIZE],
66 u_char shared_key[CURVE25519_SIZE]; 66 u_char shared_key[CURVE25519_SIZE];
67 int r; 67 int r;
68 68
69 /* Check for all-zero public key */
70 explicit_bzero(shared_key, CURVE25519_SIZE);
71 if (timingsafe_bcmp(pub, shared_key, CURVE25519_SIZE) == 0)
72 return SSH_ERR_KEY_INVALID_EC_VALUE;
73
69 crypto_scalarmult_curve25519(shared_key, key, pub); 74 crypto_scalarmult_curve25519(shared_key, key, pub);
70#ifdef DEBUG_KEXECDH 75#ifdef DEBUG_KEXECDH
71 dump_digest("shared secret", shared_key, CURVE25519_SIZE); 76 dump_digest("shared secret", shared_key, CURVE25519_SIZE);