2000-01-22 20:05:23 +00:00
|
|
|
=pod
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
dh - Diffie-Hellman key agreement
|
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
#include <openssl/dh.h>
|
2000-10-26 21:07:28 +00:00
|
|
|
#include <openssl/engine.h>
|
2000-01-22 20:05:23 +00:00
|
|
|
|
|
|
|
DH * DH_new(void);
|
|
|
|
void DH_free(DH *dh);
|
|
|
|
|
|
|
|
int DH_size(DH *dh);
|
|
|
|
|
|
|
|
DH * DH_generate_parameters(int prime_len, int generator,
|
|
|
|
void (*callback)(int, int, void *), void *cb_arg);
|
|
|
|
int DH_check(DH *dh, int *codes);
|
|
|
|
|
|
|
|
int DH_generate_key(DH *dh);
|
|
|
|
int DH_compute_key(unsigned char *key, BIGNUM *pub_key, DH *dh);
|
|
|
|
|
2000-10-26 21:07:28 +00:00
|
|
|
void DH_set_default_openssl_method(DH_METHOD *meth);
|
|
|
|
DH_METHOD *DH_get_default_openssl_method(void);
|
|
|
|
int DH_set_method(DH *dh, ENGINE *engine);
|
|
|
|
DH *DH_new_method(ENGINE *engine);
|
2000-01-27 19:31:26 +00:00
|
|
|
DH_METHOD *DH_OpenSSL(void);
|
|
|
|
|
|
|
|
int DH_get_ex_new_index(long argl, char *argp, int (*new_func)(),
|
|
|
|
int (*dup_func)(), void (*free_func)());
|
|
|
|
int DH_set_ex_data(DH *d, int idx, char *arg);
|
|
|
|
char *DH_get_ex_data(DH *d, int idx);
|
|
|
|
|
2000-01-22 20:05:23 +00:00
|
|
|
DH * d2i_DHparams(DH **a, unsigned char **pp, long length);
|
|
|
|
int i2d_DHparams(DH *a, unsigned char **pp);
|
|
|
|
|
|
|
|
int DHparams_print_fp(FILE *fp, DH *x);
|
|
|
|
int DHparams_print(BIO *bp, DH *x);
|
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
|
|
|
These functions implement the Diffie-Hellman key agreement protocol.
|
|
|
|
The generation of shared DH parameters is described in
|
2000-01-27 01:25:31 +00:00
|
|
|
L<DH_generate_parameters(3)|DH_generate_parameters(3)>; L<DH_generate_key(3)|DH_generate_key(3)> describes how
|
2000-01-22 20:05:23 +00:00
|
|
|
to perform a key agreement.
|
|
|
|
|
|
|
|
The B<DH> structure consists of several BIGNUM components.
|
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
BIGNUM *p; // prime number (shared)
|
|
|
|
BIGNUM *g; // generator of Z_p (shared)
|
|
|
|
BIGNUM *priv_key; // private DH value x
|
|
|
|
BIGNUM *pub_key; // public DH value g^x
|
2000-01-23 22:06:24 +00:00
|
|
|
// ...
|
2000-01-22 20:05:23 +00:00
|
|
|
};
|
|
|
|
DH
|
|
|
|
|
|
|
|
=head1 SEE ALSO
|
|
|
|
|
2000-01-27 01:25:31 +00:00
|
|
|
L<dhparam(1)|dhparam(1)>, L<bn(3)|bn(3)>, L<dsa(3)|dsa(3)>, L<err(3)|err(3)>,
|
|
|
|
L<rand(3)|rand(3)>, L<rsa(3)|rsa(3)>, L<DH_set_method(3)|DH_set_method(3)>,
|
|
|
|
L<DH_new(3)|DH_new(3)>, L<DH_get_ex_new_index(3)|DH_get_ex_new_index(3)>,
|
|
|
|
L<DH_generate_parameters(3)|DH_generate_parameters(3)>,
|
|
|
|
L<DH_compute_key(3)|DH_compute_key(3)>, L<d2i_DHparams(3)|d2i_DHparams(3)>,
|
|
|
|
L<RSA_print(3)|RSA_print(3)>
|
2000-01-22 20:05:23 +00:00
|
|
|
|
|
|
|
=cut
|