From cad6a08f10c22cd58b227372b2bc383fedbd3388 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Mon, 1 Feb 2016 17:11:01 -0700 Subject: [PATCH] comment for clarifying table of DH sizes --- wolfcrypt/src/dh.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wolfcrypt/src/dh.c b/wolfcrypt/src/dh.c index 9277e670f..05f5fb4d8 100644 --- a/wolfcrypt/src/dh.c +++ b/wolfcrypt/src/dh.c @@ -107,8 +107,11 @@ static int GeneratePrivate(DhKey* key, WC_RNG* rng, byte* priv, word32* privSz) int ret; word32 sz = mp_unsigned_bin_size(&key->p); - /* predetermined values that operation would return for size */ - WOLFSSL_DH_ROUND(sz); /* if using fixed points only, than round up */ + /* Table of predetermined values from the operation + 2 * DiscreteLogWorkFactor(sz * WOLFSSL_BIT_SIZE) / WOLFSSL_BIT_SIZE + 1 + Sizes in table checked against RFC 3526 + */ + WOLFSSL_DH_ROUND(sz); /* if using fixed points only, then round up */ switch (sz) { case 128: sz = 21; break; case 256: sz = 29; break;