]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/crypto/DH_set_method.pod
Document the DH library, and make some minor changes along the way.
[thirdparty/openssl.git] / doc / crypto / DH_set_method.pod
CommitLineData
4486d0cd
UM
1=pod
2
3=head1 NAME
4
5DH_set_default_method, DH_get_default_method, DH_set_method,
6DH_new_method, DH_OpenSSL - Select RSA method
7
8=head1 SYNOPSIS
9
10 #include <openssl/dh.h>
11
12 void DH_set_default_method(DH_METHOD *meth);
13
14 DH_METHOD *DH_get_default_method(void);
15
16 DH_METHOD *DH_set_method(DH *dh, DH_METHOD *meth);
17
18 DH *DH_new_method(DH_METHOD *meth);
19
20 DH_METHOD *DH_OpenSSL(void);
21
22=head1 DESCRIPTION
23
24A B<DH_METHOD> specifies the functions that OpenSSL uses for Diffie-Hellman
25operations. By modifying the method, alternative implementations
26such as hardware accelerators may be used.
27
28Initially, the default is to use the OpenSSL internal implementation.
29DH_OpenSSL() returns a pointer to that method.
30
31DH_set_default_method() makes B<meth> the default method for all B<DH>
32structures created later.
33
34DH_get_default_method() returns a pointer to the current default
35method.
36
37DH_set_method() selects B<meth> for all operations using the structure B<dh>.
38
39DH_get_method() returns a pointer to the method currently selected
40for B<dh>.
41
42DH_new_method() allocates and initializes a B<DH> structure so that
43B<method> will be used for the DH operations. If B<method> is B<NULL>,
44the default method is used.
45
46=head1 THE DH_METHOD STRUCTURE
47
48 typedef struct dh_meth_st
49 {
50 /* name of the implementation */
51 const char *name;
52
53 /* generate private and public DH values for key agreement */
54 int (*generate_key)(DH *dh);
55
56 /* compute shared secret */
57 int (*compute_key)(unsigned char *key, BIGNUM *pub_key, DH *dh);
58
59 /* compute r = a ^ p mod m. May be NULL */
60 int (*bn_mod_exp)(DH *dh, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
61 const BIGNUM *m, BN_CTX *ctx,
62 BN_MONT_CTX *m_ctx);
63
64 /* called at DH_new */
65 int (*init)(DH *dh);
66
67 /* called at DH_free */
68 int (*finish)(DH *dh);
69
70 int flags;
71
72 char *app_data; /* ?? */
73
74 } DH_METHOD;
75
76=head1 RETURN VALUES
77
78DH_OpenSSL(), DH_get_default_method() and DH_get_method() return
79pointers to the respective B<DH_METHOD>s.
80
81DH_set_default_method() returns no value.
82
83DH_set_method() returns a pointer to the B<DH_METHOD> previously
84associated with B<dh>.
85
86DH_new_method() returns B<NULL> and sets an error code that can be
87obtained by ERR_get_error(3) if the allocation fails. Otherwise it
88returns a pointer to the newly allocated structure.
89
90=head1 SEE ALSO
91
92dh(3), DH_new(3)
93
94=head1 HISTORY
95
96DH_set_default_method(), DH_get_default_method(), DH_set_method(),
97DH_new_method() and DH_OpenSSL() were added in OpenSSL 0.9.4.
98
99=cut