]>
Commit | Line | Data |
---|---|---|
4486d0cd UM |
1 | =pod |
2 | ||
3 | =head1 NAME | |
4 | ||
5 | DH_set_default_method, DH_get_default_method, DH_set_method, | |
6 | DH_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 | ||
24 | A B<DH_METHOD> specifies the functions that OpenSSL uses for Diffie-Hellman | |
25 | operations. By modifying the method, alternative implementations | |
26 | such as hardware accelerators may be used. | |
27 | ||
28 | Initially, the default is to use the OpenSSL internal implementation. | |
29 | DH_OpenSSL() returns a pointer to that method. | |
30 | ||
31 | DH_set_default_method() makes B<meth> the default method for all B<DH> | |
32 | structures created later. | |
33 | ||
34 | DH_get_default_method() returns a pointer to the current default | |
35 | method. | |
36 | ||
37 | DH_set_method() selects B<meth> for all operations using the structure B<dh>. | |
38 | ||
39 | DH_get_method() returns a pointer to the method currently selected | |
40 | for B<dh>. | |
41 | ||
42 | DH_new_method() allocates and initializes a B<DH> structure so that | |
43 | B<method> will be used for the DH operations. If B<method> is B<NULL>, | |
44 | the 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 | ||
78 | DH_OpenSSL(), DH_get_default_method() and DH_get_method() return | |
79 | pointers to the respective B<DH_METHOD>s. | |
80 | ||
81 | DH_set_default_method() returns no value. | |
82 | ||
83 | DH_set_method() returns a pointer to the B<DH_METHOD> previously | |
84 | associated with B<dh>. | |
85 | ||
86 | DH_new_method() returns B<NULL> and sets an error code that can be | |
87 | obtained by ERR_get_error(3) if the allocation fails. Otherwise it | |
88 | returns a pointer to the newly allocated structure. | |
89 | ||
90 | =head1 SEE ALSO | |
91 | ||
92 | dh(3), DH_new(3) | |
93 | ||
94 | =head1 HISTORY | |
95 | ||
96 | DH_set_default_method(), DH_get_default_method(), DH_set_method(), | |
97 | DH_new_method() and DH_OpenSSL() were added in OpenSSL 0.9.4. | |
98 | ||
99 | =cut |