Update test suite so that 'make test' succeeds in 'no-rsa' configuration.
[openssl.git] / doc / crypto / DSA_set_method.pod
1 =pod
2
3 =head1 NAME
4
5 DSA_set_default_method, DSA_get_default_method, DSA_set_method,
6 DSA_new_method, DSA_OpenSSL - select RSA method
7
8 =head1 SYNOPSIS
9
10  #include <openssl/DSA.h>
11
12  void DSA_set_default_method(DSA_METHOD *meth);
13
14  DSA_METHOD *DSA_get_default_method(void);
15
16  DSA_METHOD *DSA_set_method(DSA *dsa, DSA_METHOD *meth);
17
18  DSA *DSA_new_method(DSA_METHOD *meth);
19
20  DSA_METHOD *DSA_OpenSSL(void);
21
22 =head1 DESCRIPTION
23
24 A B<DSA_METHOD> specifies the functions that OpenSSL uses for DSA
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 DSA_OpenSSL() returns a pointer to that method.
30
31 DSA_set_default_method() makes B<meth> the default method for all B<DSA>
32 structures created later.
33
34 DSA_get_default_method() returns a pointer to the current default
35 method.
36
37 DSA_set_method() selects B<meth> for all operations using the structure B<DSA>.
38
39 DSA_get_method() returns a pointer to the method currently selected
40 for B<DSA>.
41
42 DSA_new_method() allocates and initializes a B<DSA> structure so that
43 B<method> will be used for the DSA operations. If B<method> is B<NULL>,
44 the default method is used.
45
46 =head1 THE DSA_METHOD STRUCTURE
47
48 struct
49  {
50      /* name of the implementation */
51         const char *name;
52
53      /* sign */
54         DSA_SIG *(*dsa_do_sign)(const unsigned char *dgst, int dlen,
55                                  DSA *dsa);
56
57      /* pre-compute k^-1 and r */
58         int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,
59                                  BIGNUM **rp);
60
61      /* verify */
62         int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len,
63                                  DSA_SIG *sig, DSA *dsa);
64
65      /* compute rr = a1^p1 * a2^p2 mod m (May be NULL for some
66                                           implementations) */
67         int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
68                                  BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
69                                  BN_CTX *ctx, BN_MONT_CTX *in_mont);
70
71      /* compute r = a ^ p mod m (May be NULL for some implementations) */
72         int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a,
73                                  const BIGNUM *p, const BIGNUM *m,
74                                  BN_CTX *ctx, BN_MONT_CTX *m_ctx);
75
76      /* called at DSA_new */
77         int (*init)(DSA *DSA);
78
79      /* called at DSA_free */
80         int (*finish)(DSA *DSA);
81
82         int flags;
83
84         char *app_data; /* ?? */
85
86  } DSA_METHOD;
87
88 =head1 RETURN VALUES
89
90 DSA_OpenSSL(), DSA_get_default_method() and DSA_get_method() return
91 pointers to the respective B<DSA_METHOD>s.
92
93 DSA_set_default_method() returns no value.
94
95 DSA_set_method() returns a pointer to the B<DSA_METHOD> previously
96 associated with B<dsa>.
97
98 DSA_new_method() returns B<NULL> and sets an error code that can be
99 obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation
100 fails. Otherwise it returns a pointer to the newly allocated
101 structure.
102
103 =head1 SEE ALSO
104
105 L<dsa(3)|dsa(3)>, L<DSA_new(3)|DSA_new(3)>
106
107 =head1 HISTORY
108
109 DSA_set_default_method(), DSA_get_default_method(), DSA_set_method(),
110 DSA_new_method() and DSA_OpenSSL() were added in OpenSSL 0.9.4.
111
112 =cut