(DH_check_pubkey): describe what the function do

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17469 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2006-05-06 07:12:51 +00:00
parent 4b0f206868
commit 87845fef3a

View File

@@ -149,6 +149,14 @@ DH_generate_parameters_ex(DH *dh, int prime_len, int generator, BN_GENCB *cb)
return 0;
}
/*
* Check that
*
* pub_key > 1 and pub_key < p - 1
*
* to avoid small subgroups attack.
*/
int
DH_check_pubkey(const DH *dh, const BIGNUM *pub_key, int *codes)
{
@@ -167,9 +175,6 @@ DH_check_pubkey(const DH *dh, const BIGNUM *pub_key, int *codes)
if (BN_cmp(bn, pub_key) >= 0)
*codes |= DH_CHECK_PUBKEY_TOO_SMALL;
if (!BN_set_word(bn, 2))
goto out;
sum = BN_new();
if (sum == NULL)
goto out;