doxygen.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@22354 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -50,6 +50,8 @@ RCSID("$Id$");
|
|||||||
* to establish a shared secret key.
|
* to establish a shared secret key.
|
||||||
*
|
*
|
||||||
* Include and example how to use DH_new() and friends here.
|
* Include and example how to use DH_new() and friends here.
|
||||||
|
*
|
||||||
|
* See the library functions here: @ref hcrypto_dh
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -300,12 +302,36 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a new DH private-public key pair. The dh parameter must be
|
||||||
|
* allocted first with DH_new().
|
||||||
|
*
|
||||||
|
* @param dh dh parameter.
|
||||||
|
*
|
||||||
|
* @return 1 on success.
|
||||||
|
*
|
||||||
|
* @ingroup hcrypto_dh
|
||||||
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
DH_generate_key(DH *dh)
|
DH_generate_key(DH *dh)
|
||||||
{
|
{
|
||||||
return dh->meth->generate_key(dh);
|
return dh->meth->generate_key(dh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Complute the shared secret key.
|
||||||
|
*
|
||||||
|
* @param shared_key the resulting shared key, need to be at least
|
||||||
|
* DH_size() large.
|
||||||
|
* @param peer_pub_key the peer's public key.
|
||||||
|
* @param dh the dh key pair.
|
||||||
|
*
|
||||||
|
* @return 1 on success.
|
||||||
|
*
|
||||||
|
* @ingroup hcrypto_dh
|
||||||
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
DH_compute_key(unsigned char *shared_key,
|
DH_compute_key(unsigned char *shared_key,
|
||||||
const BIGNUM *peer_pub_key, DH *dh)
|
const BIGNUM *peer_pub_key, DH *dh)
|
||||||
@@ -318,6 +344,17 @@ DH_compute_key(unsigned char *shared_key,
|
|||||||
return dh->meth->compute_key(shared_key, peer_pub_key, dh);
|
return dh->meth->compute_key(shared_key, peer_pub_key, dh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a new method for the DH keypair.
|
||||||
|
*
|
||||||
|
* @param dh dh parameter.
|
||||||
|
* @param method the new method for the DH parameter.
|
||||||
|
*
|
||||||
|
* @return 1 on success.
|
||||||
|
*
|
||||||
|
* @ingroup hcrypto_dh
|
||||||
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
DH_set_method(DH *dh, const DH_METHOD *method)
|
DH_set_method(DH *dh, const DH_METHOD *method)
|
||||||
{
|
{
|
||||||
@@ -380,18 +417,42 @@ static const DH_METHOD dh_null_method = {
|
|||||||
extern const DH_METHOD hc_dh_imath_method;
|
extern const DH_METHOD hc_dh_imath_method;
|
||||||
static const DH_METHOD *dh_default_method = &hc_dh_imath_method;
|
static const DH_METHOD *dh_default_method = &hc_dh_imath_method;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the dummy DH implementation.
|
||||||
|
*
|
||||||
|
* @return pointer to a DH_METHOD.
|
||||||
|
*
|
||||||
|
* @ingroup hcrypto_dh
|
||||||
|
*/
|
||||||
|
|
||||||
const DH_METHOD *
|
const DH_METHOD *
|
||||||
DH_null_method(void)
|
DH_null_method(void)
|
||||||
{
|
{
|
||||||
return &dh_null_method;
|
return &dh_null_method;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the default DH implementation.
|
||||||
|
*
|
||||||
|
* @param meth pointer to a DH_METHOD.
|
||||||
|
*
|
||||||
|
* @ingroup hcrypto_dh
|
||||||
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
DH_set_default_method(const DH_METHOD *meth)
|
DH_set_default_method(const DH_METHOD *meth)
|
||||||
{
|
{
|
||||||
dh_default_method = meth;
|
dh_default_method = meth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the default DH implementation.
|
||||||
|
*
|
||||||
|
* @return pointer to a DH_METHOD.
|
||||||
|
*
|
||||||
|
* @ingroup hcrypto_dh
|
||||||
|
*/
|
||||||
|
|
||||||
const DH_METHOD *
|
const DH_METHOD *
|
||||||
DH_get_default_method(void)
|
DH_get_default_method(void)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user