summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/DSA_set_method.3
diff options
context:
space:
mode:
authorschwarze <>2016-11-02 11:57:56 +0000
committerschwarze <>2016-11-02 11:57:56 +0000
commit90c573eba184fe31184d14ce10367f810fa1d417 (patch)
tree62d26e7f75bb451eba292aad57737306b2f28280 /src/lib/libcrypto/man/DSA_set_method.3
parentdb06cab2812484b360f2873ade2dd8277ad08a42 (diff)
downloadopenbsd-90c573eba184fe31184d14ce10367f810fa1d417.tar.gz
openbsd-90c573eba184fe31184d14ce10367f810fa1d417.tar.bz2
openbsd-90c573eba184fe31184d14ce10367f810fa1d417.zip
convert DSA and EC manuals from pod to mdoc
Diffstat (limited to 'src/lib/libcrypto/man/DSA_set_method.3')
-rw-r--r--src/lib/libcrypto/man/DSA_set_method.3224
1 files changed, 224 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/DSA_set_method.3 b/src/lib/libcrypto/man/DSA_set_method.3
new file mode 100644
index 0000000000..2ba34ddf94
--- /dev/null
+++ b/src/lib/libcrypto/man/DSA_set_method.3
@@ -0,0 +1,224 @@
1.Dd $Mdocdate: November 2 2016 $
2.Dt DSA_SET_METHOD 3
3.Os
4.Sh NAME
5.Nm DSA_set_default_method ,
6.Nm DSA_get_default_method ,
7.Nm DSA_set_method ,
8.Nm DSA_new_method ,
9.Nm DSA_OpenSSL ,
10.Nm DSA_set_default_openssl_method ,
11.Nm DSA_get_default_openssl_method
12.Nd select DSA method
13.Sh SYNOPSIS
14.In openssl/dsa.h
15.In openssl/engine.h
16.Ft void
17.Fo DSA_set_default_method
18.Fa "const DSA_METHOD *meth"
19.Fc
20.Ft const DSA_METHOD *
21.Fn DSA_get_default_method void
22.Ft int
23.Fo DSA_set_method
24.Fa "DSA *dsa"
25.Fa "const DSA_METHOD *meth"
26.Fc
27.Ft DSA *
28.Fo DSA_new_method
29.Fa "ENGINE *engine"
30.Fc
31.Ft DSA_METHOD *
32.Fn DSA_OpenSSL void
33.Sh DESCRIPTION
34A
35.Vt DSA_METHOD
36specifies the functions that OpenSSL uses for DSA operations.
37By modifying the method, alternative implementations such as hardware
38accelerators may be used.
39See the
40.Sx CAVEATS
41section for how these DSA API functions are affected by the use of
42.Xr engine 3
43API calls.
44.Pp
45Initially, the default
46.Vt DSA_METHOD
47is the OpenSSL internal implementation, as returned by
48.Fn DSA_OpenSSL .
49.Pp
50.Fn DSA_set_default_method
51makes
52.Fa meth
53the default method for all
54.Vt DSA
55structures created later.
56.Sy NB :
57This is true only whilst no
58.Vt ENGINE
59has been set as a default for DSA, so this function is no longer
60recommended.
61.Pp
62.Fn DSA_get_default_method
63returns a pointer to the current default
64.Vt DSA_METHOD .
65However, the meaningfulness of this result is dependent on whether the
66.Xr engine 3
67API is being used, so this function is no longer recommended.
68.Pp
69.Fn DSA_set_method
70selects
71.Fa meth
72to perform all operations using the key
73.Fa dsa .
74This will replace the
75.Vt DSA_METHOD
76used by the DSA key and if the previous method was supplied by an
77.Vt ENGINE ,
78the handle to that
79.Vt ENGINE
80will be released during the change.
81It is possible to have DSA keys that only work with certain
82.Vt DSA_METHOD
83implementations (eg. from an
84.Vt ENGINE
85module that supports embedded hardware-protected keys),
86and in such cases attempting to change the
87.Vt DSA_METHOD
88for the key can have unexpected results.
89.Pp
90.Fn DSA_new_method
91allocates and initializes a
92.Vt DSA
93structure so that
94.Fa engine
95will be used for the DSA operations.
96If
97.Fa engine
98is
99.Dv NULL ,
100the default engine for DSA operations is used, and if no
101default
102.Vt ENGINE
103is set, the
104.Vt DSA_METHOD
105controlled by
106.Fn DSA_set_default_method
107is used.
108.Sh THE DSA_METHOD STRUCTURE
109.Bd -literal
110struct
111{
112 /* name of the implementation */
113 const char *name;
114
115 /* sign */
116 DSA_SIG *(*dsa_do_sign)(const unsigned char *dgst, int dlen,
117 DSA *dsa);
118
119 /* pre-compute k^-1 and r */
120 int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,
121 BIGNUM **rp);
122
123 /* verify */
124 int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len,
125 DSA_SIG *sig, DSA *dsa);
126
127 /* compute rr = a1^p1 * a2^p2 mod m (May be NULL for some
128 implementations) */
129 int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
130 BIGNUM *a2, BIGNUM *p2, BIGNUM *m,
131 BN_CTX *ctx, BN_MONT_CTX *in_mont);
132
133 /* compute r = a ^ p mod m (May be NULL for some implementations) */
134 int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a,
135 const BIGNUM *p, const BIGNUM *m,
136 BN_CTX *ctx, BN_MONT_CTX *m_ctx);
137
138 /* called at DSA_new */
139 int (*init)(DSA *DSA);
140
141 /* called at DSA_free */
142 int (*finish)(DSA *DSA);
143
144 int flags;
145
146 char *app_data; /* ?? */
147
148} DSA_METHOD;
149.Ed
150.Sh RETURN VALUES
151.Fn DSA_OpenSSL
152and
153.Fn DSA_get_default_method
154return pointers to the respective
155.Vt DSA_METHOD Ns s.
156.Pp
157.Fn DSA_set_method
158returns non-zero if the provided
159.Fa meth
160was successfully set as the method for
161.Fa dsa
162(including unloading the
163.Vt ENGINE
164handle if the previous method was supplied by an
165.Vt ENGINE ) .
166.Pp
167.Fn DSA_new_method
168returns
169.Dv NULL
170and sets an error code that can be obtained by
171.Xr ERR_get_error 3
172if the allocation fails.
173Otherwise it returns a pointer to the newly allocated structure.
174.Sh SEE ALSO
175.Xr dsa 3 ,
176.Xr DSA_new 3
177.Sh HISTORY
178.Fn DSA_set_default_method ,
179.Fn DSA_get_default_method ,
180.Fn DSA_set_method ,
181.Fn DSA_new_method ,
182and
183.Fn DSA_OpenSSL
184were added in OpenSSL 0.9.4.
185.Pp
186.Fn DSA_set_default_openssl_method
187and
188.Fn DSA_get_default_openssl_method
189replaced
190.Fn DSA_set_default_method
191and
192.Fn DSA_get_default_method
193respectively, and
194.Fn DSA_set_method
195and
196.Fn DSA_new_method
197were altered to use
198.Vt ENGINE Ns s
199rather than
200.Vt DSA_METHOD Ns s
201during development of the engine version of OpenSSL 0.9.6.
202For 0.9.7, the handling of defaults in the
203.Xr engine 3
204API was restructured so that this change was reversed, and behaviour
205of the other functions resembled more closely the previous behaviour.
206The behaviour of defaults in the
207.Xr engine 3
208API now transparently overrides the behaviour of defaults in the
209DSA API without requiring changing these function prototypes.
210.Sh CAVEATS
211As of version 0.9.7, DSA_METHOD implementations are grouped together
212with other algorithmic APIs (eg. RSA_METHOD, EVP_CIPHER, etc) in
213.Vt ENGINE
214modules.
215If a default
216.Vt ENGINE
217is specified for DSA functionality using an
218.Xr engine 3
219API function, that will override any DSA defaults set using the DSA API
220.Pq ie. DSA_set_default_method .
221For this reason, the
222.Xr engine 3
223API is the recommended way to control default implementations for
224use in DSA and other cryptographic algorithms.