# HG changeset patch # User Matt Johnston # Date 1170585108 0 # Node ID 0e69e948cabab579d365bada7cb88fc0c416ed3e # Parent 28b10e93685ce709b127dceaf7903f008ee5e86d Add comments about requiring keysize <= 2*SHA1_HASH_SIZE diff -r 28b10e93685c -r 0e69e948caba common-algo.c --- a/common-algo.c Sat Feb 03 13:57:35 2007 +0000 +++ b/common-algo.c Sun Feb 04 10:31:48 2007 +0000 @@ -31,6 +31,8 @@ /* Mappings for ciphers, parameters are {&cipher_desc, keysize, blocksize} */ +/* NOTE: if keysize > 2*SHA1_HASH_SIZE, code such as hashkeys() + needs revisiting */ #ifdef DROPBEAR_AES256_CBC static const struct dropbear_cipher dropbear_aes256 = diff -r 28b10e93685c -r 0e69e948caba common-kex.c --- a/common-kex.c Sat Feb 03 13:57:35 2007 +0000 +++ b/common-kex.c Sun Feb 04 10:31:48 2007 +0000 @@ -217,12 +217,10 @@ * already initialised hash_state hs, which should already have processed * the dh_K and hash, since these are common. X is the letter 'A', 'B' etc. * out must have at least min(SHA1_HASH_SIZE, outlen) bytes allocated. - * The output will only be expanded once, since that is all that is required - * (for 3DES and SHA, with 24 and 20 bytes respectively). + * The output will only be expanded once, as we are assured that + * outlen <= 2*SHA1_HASH_SIZE for all known hashes. * - * See Section 5.2 of the IETF secsh Transport Draft for details */ - -/* Duplicated verbatim from kex.c --mihnea */ + * See Section 7.2 of rfc4253 (ssh transport) for details */ static void hashkeys(unsigned char *out, int outlen, const hash_state * hs, const unsigned char X) {