Define MODP_CUSTOM constructors as variadic functions
They now match the dh_constructor_t signature. This is a follow up for
the changes merged with b668bf3f9e and should fix use of MODP_CUSTOM on
Apple's ARM64 platform.
This commit is contained in:
@@ -289,11 +289,13 @@ gcrypt_dh_t *gcrypt_dh_create(diffie_hellman_group_t group)
|
||||
/*
|
||||
* Described in header.
|
||||
*/
|
||||
gcrypt_dh_t *gcrypt_dh_create_custom(diffie_hellman_group_t group,
|
||||
chunk_t g, chunk_t p)
|
||||
gcrypt_dh_t *gcrypt_dh_create_custom(diffie_hellman_group_t group, ...)
|
||||
{
|
||||
if (group == MODP_CUSTOM)
|
||||
{
|
||||
chunk_t g, p;
|
||||
|
||||
VA_ARGS_GET(group, g, p);
|
||||
return create_generic(group, p.len, g, p);
|
||||
}
|
||||
return NULL;
|
||||
|
||||
@@ -48,12 +48,10 @@ gcrypt_dh_t *gcrypt_dh_create(diffie_hellman_group_t group);
|
||||
* Creates a new gcrypt_dh_t object for MODP_CUSTOM.
|
||||
*
|
||||
* @param group MODP_CUSTOM
|
||||
* @param g generator
|
||||
* @param p prime
|
||||
* @param ... expects generator and prime as chunk_t
|
||||
* @return gcrypt_dh_t object, NULL if not supported
|
||||
*/
|
||||
gcrypt_dh_t *gcrypt_dh_create_custom(diffie_hellman_group_t group,
|
||||
chunk_t g, chunk_t p);
|
||||
gcrypt_dh_t *gcrypt_dh_create_custom(diffie_hellman_group_t group, ...);
|
||||
|
||||
#endif /** GCRYPT_DH_H_ @}*/
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ static gmp_diffie_hellman_t *create_generic(diffie_hellman_group_t group,
|
||||
}
|
||||
|
||||
/*
|
||||
* Described in header.
|
||||
* Described in header
|
||||
*/
|
||||
gmp_diffie_hellman_t *gmp_diffie_hellman_create(diffie_hellman_group_t group)
|
||||
{
|
||||
@@ -287,12 +287,17 @@ gmp_diffie_hellman_t *gmp_diffie_hellman_create(diffie_hellman_group_t group)
|
||||
params->generator, params->prime);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Described in header
|
||||
*/
|
||||
gmp_diffie_hellman_t *gmp_diffie_hellman_create_custom(
|
||||
diffie_hellman_group_t group, chunk_t g, chunk_t p)
|
||||
diffie_hellman_group_t group, ...)
|
||||
{
|
||||
if (group == MODP_CUSTOM)
|
||||
{
|
||||
chunk_t g, p;
|
||||
|
||||
VA_ARGS_GET(group, g, p);
|
||||
return create_generic(MODP_CUSTOM, p.len, g, p);
|
||||
}
|
||||
return NULL;
|
||||
|
||||
@@ -49,12 +49,11 @@ gmp_diffie_hellman_t *gmp_diffie_hellman_create(diffie_hellman_group_t group);
|
||||
* Creates a new gmp_diffie_hellman_t object for MODP_CUSTOM.
|
||||
*
|
||||
* @param group MODP_CUSTOM
|
||||
* @param g generator
|
||||
* @param p prime
|
||||
* @param ... expects generator and prime as chunk_t
|
||||
* @return gmp_diffie_hellman_t object, NULL if not supported
|
||||
*/
|
||||
gmp_diffie_hellman_t *gmp_diffie_hellman_create_custom(
|
||||
diffie_hellman_group_t group, chunk_t g, chunk_t p);
|
||||
diffie_hellman_group_t group, ...);
|
||||
|
||||
#endif /** GMP_DIFFIE_HELLMAN_H_ @}*/
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ METHOD(diffie_hellman_t, destroy, void,
|
||||
* Described in header.
|
||||
*/
|
||||
openssl_diffie_hellman_t *openssl_diffie_hellman_create(
|
||||
diffie_hellman_group_t group, chunk_t g, chunk_t p)
|
||||
diffie_hellman_group_t group, ...)
|
||||
{
|
||||
private_openssl_diffie_hellman_t *this;
|
||||
const BIGNUM *privkey;
|
||||
@@ -225,6 +225,9 @@ openssl_diffie_hellman_t *openssl_diffie_hellman_create(
|
||||
|
||||
if (group == MODP_CUSTOM)
|
||||
{
|
||||
chunk_t g, p;
|
||||
|
||||
VA_ARGS_GET(group, g, p);
|
||||
if (!DH_set0_pqg(this->dh, BN_bin2bn(p.ptr, p.len, NULL), NULL,
|
||||
BN_bin2bn(g.ptr, g.len, NULL)))
|
||||
{
|
||||
|
||||
@@ -40,12 +40,11 @@ struct openssl_diffie_hellman_t {
|
||||
* Creates a new openssl_diffie_hellman_t object.
|
||||
*
|
||||
* @param group Diffie Hellman group number to use
|
||||
* @param g custom generator, if MODP_CUSTOM
|
||||
* @param p custom prime, if MODP_CUSTOM
|
||||
* @param ... expects generator and prime as chunk_t if MODP_CUSTOM
|
||||
* @return openssl_diffie_hellman_t object, NULL if not supported
|
||||
*/
|
||||
openssl_diffie_hellman_t *openssl_diffie_hellman_create(
|
||||
diffie_hellman_group_t group, chunk_t g, chunk_t p);
|
||||
diffie_hellman_group_t group, ...);
|
||||
|
||||
#endif /** OPENSSL_DIFFIE_HELLMAN_H_ @}*/
|
||||
|
||||
|
||||
@@ -415,13 +415,15 @@ static chunk_t ecparams_lookup(diffie_hellman_group_t group)
|
||||
/**
|
||||
* Described in header.
|
||||
*/
|
||||
pkcs11_dh_t *pkcs11_dh_create(diffie_hellman_group_t group,
|
||||
chunk_t g, chunk_t p)
|
||||
pkcs11_dh_t *pkcs11_dh_create(diffie_hellman_group_t group, ...)
|
||||
{
|
||||
switch (group)
|
||||
{
|
||||
case MODP_CUSTOM:
|
||||
{
|
||||
chunk_t g, p;
|
||||
|
||||
VA_ARGS_GET(group, g, p);
|
||||
return create_modp(group, p.len, g, p);
|
||||
}
|
||||
case ECP_192_BIT:
|
||||
|
||||
@@ -40,12 +40,10 @@ struct pkcs11_dh_t {
|
||||
* Creates a new pkcs11_dh_t object.
|
||||
*
|
||||
* @param group Diffie Hellman group number to use
|
||||
* @param g generator in case group is MODP_CUSTOM
|
||||
* @param p prime in case group is MODP_CUSTOM
|
||||
* @param ... expects generator and prime as chunk_t if MODP_CUSTOM
|
||||
* @return pkcs11_dh_t object, NULL if not supported
|
||||
*/
|
||||
pkcs11_dh_t *pkcs11_dh_create(diffie_hellman_group_t group,
|
||||
chunk_t g, chunk_t p);
|
||||
pkcs11_dh_t *pkcs11_dh_create(diffie_hellman_group_t group, ...);
|
||||
|
||||
#endif /** PKCS11_DH_H_ @}*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user