(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:
11
lib/des/dh.c
11
lib/des/dh.c
@@ -149,6 +149,14 @@ DH_generate_parameters_ex(DH *dh, int prime_len, int generator, BN_GENCB *cb)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check that
|
||||||
|
*
|
||||||
|
* pub_key > 1 and pub_key < p - 1
|
||||||
|
*
|
||||||
|
* to avoid small subgroups attack.
|
||||||
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
DH_check_pubkey(const DH *dh, const BIGNUM *pub_key, int *codes)
|
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)
|
if (BN_cmp(bn, pub_key) >= 0)
|
||||||
*codes |= DH_CHECK_PUBKEY_TOO_SMALL;
|
*codes |= DH_CHECK_PUBKEY_TOO_SMALL;
|
||||||
|
|
||||||
if (!BN_set_word(bn, 2))
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
sum = BN_new();
|
sum = BN_new();
|
||||||
if (sum == NULL)
|
if (sum == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
Reference in New Issue
Block a user