summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man
diff options
context:
space:
mode:
authorschwarze <>2016-11-05 13:36:33 +0000
committerschwarze <>2016-11-05 13:36:33 +0000
commit71b431bd059aaefaa67b54a34adfaadc4014902c (patch)
tree7bf60aef63735e9638d12b0d8302b14d9860466e /src/lib/libcrypto/man
parent5074288f0801a2b426584402e81b5953f706a44f (diff)
downloadopenbsd-71b431bd059aaefaa67b54a34adfaadc4014902c.tar.gz
openbsd-71b431bd059aaefaa67b54a34adfaadc4014902c.tar.bz2
openbsd-71b431bd059aaefaa67b54a34adfaadc4014902c.zip
convert the remaining manual pages from pod to mdoc
Diffstat (limited to 'src/lib/libcrypto/man')
-rw-r--r--src/lib/libcrypto/man/Makefile41
-rw-r--r--src/lib/libcrypto/man/RC4.379
-rw-r--r--src/lib/libcrypto/man/RIPEMD160.396
-rw-r--r--src/lib/libcrypto/man/SHA1.3102
-rw-r--r--src/lib/libcrypto/man/bn.3576
-rw-r--r--src/lib/libcrypto/man/d2i_DHparams.330
-rw-r--r--src/lib/libcrypto/man/d2i_DSAPublicKey.3159
-rw-r--r--src/lib/libcrypto/man/d2i_ECPKParameters.3188
-rw-r--r--src/lib/libcrypto/man/dh.3148
-rw-r--r--src/lib/libcrypto/man/dsa.3244
-rw-r--r--src/lib/libcrypto/man/ec.3710
-rw-r--r--src/lib/libcrypto/man/engine.31187
-rw-r--r--src/lib/libcrypto/man/lh_stats.383
13 files changed, 3615 insertions, 28 deletions
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index 7819029ff6..81840a0b29 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,9 +1,7 @@
1# $OpenBSD: Makefile,v 1.47 2016/11/04 18:07:23 beck Exp $ 1# $OpenBSD: Makefile,v 1.48 2016/11/05 13:36:33 schwarze Exp $
2 2
3.include <bsd.own.mk> # for NOMAN 3.include <bsd.own.mk> # for NOMAN
4 4
5POD2MAN=pod2man --official --release="OpenBSD ${OSREV}" --center=OpenSSL
6
7.ifndef NOMAN 5.ifndef NOMAN
8MAN= \ 6MAN= \
9 ASN1_OBJECT_new.3 \ 7 ASN1_OBJECT_new.3 \
@@ -138,6 +136,8 @@ MAN= \
138 RAND_cleanup.3 \ 136 RAND_cleanup.3 \
139 RAND_load_file.3 \ 137 RAND_load_file.3 \
140 RAND_set_rand_method.3 \ 138 RAND_set_rand_method.3 \
139 RC4.3 \
140 RIPEMD160.3 \
141 RSA_blinding_on.3 \ 141 RSA_blinding_on.3 \
142 RSA_check_key.3 \ 142 RSA_check_key.3 \
143 RSA_generate_key.3 \ 143 RSA_generate_key.3 \
@@ -151,6 +151,7 @@ MAN= \
151 RSA_sign.3 \ 151 RSA_sign.3 \
152 RSA_sign_ASN1_OCTET_STRING.3 \ 152 RSA_sign_ASN1_OCTET_STRING.3 \
153 RSA_size.3 \ 153 RSA_size.3 \
154 SHA1.3 \
154 SMIME_read_PKCS7.3 \ 155 SMIME_read_PKCS7.3 \
155 SMIME_write_PKCS7.3 \ 156 SMIME_write_PKCS7.3 \
156 UI_new.3 \ 157 UI_new.3 \
@@ -166,9 +167,13 @@ MAN= \
166 X509_VERIFY_PARAM_set_flags.3 \ 167 X509_VERIFY_PARAM_set_flags.3 \
167 X509_new.3 \ 168 X509_new.3 \
168 X509_verify_cert.3 \ 169 X509_verify_cert.3 \
170 bn.3 \
169 bn_dump.3 \ 171 bn_dump.3 \
170 crypto.3 \ 172 crypto.3 \
171 d2i_ASN1_OBJECT.3 \ 173 d2i_ASN1_OBJECT.3 \
174 d2i_DHparams.3 \
175 d2i_DSAPublicKey.3 \
176 d2i_ECPKParameters.3 \
172 d2i_PKCS8PrivateKey_bio.3 \ 177 d2i_PKCS8PrivateKey_bio.3 \
173 d2i_RSAPublicKey.3 \ 178 d2i_RSAPublicKey.3 \
174 d2i_X509.3 \ 179 d2i_X509.3 \
@@ -178,27 +183,16 @@ MAN= \
178 d2i_X509_REQ.3 \ 183 d2i_X509_REQ.3 \
179 d2i_X509_SIG.3 \ 184 d2i_X509_SIG.3 \
180 des_read_pw.3 \ 185 des_read_pw.3 \
181 evp.3 \
182 i2d_PKCS7_bio_stream.3 \
183 lh_new.3 \
184 rsa.3 \
185 x509.3
186
187GENMAN= \
188 RC4.3 \
189 RIPEMD160.3 \
190 SHA1.3 \
191 bn.3 \
192 d2i_DHparams.3 \
193 d2i_DSAPublicKey.3 \
194 d2i_ECPKParameters.3 \
195 dh.3 \ 186 dh.3 \
196 dsa.3 \ 187 dsa.3 \
197 ec.3 \ 188 ec.3 \
198 engine.3 \ 189 engine.3 \
190 evp.3 \
191 i2d_PKCS7_bio_stream.3 \
192 lh_new.3 \
199 lh_stats.3 \ 193 lh_stats.3 \
200 194 rsa.3 \
201MAN+= ${GENMAN} 195 x509.3
202 196
203.include <bsd.man.mk> 197.include <bsd.man.mk>
204.else 198.else
@@ -206,16 +200,7 @@ maninstall:
206 200
207.endif 201.endif
208 202
209.PATH: ${.CURDIR}/../doc
210.SUFFIXES: .pod .1 .3 .7
211.for sect in 1 3 7
212.pod.${sect}:
213 @echo '${POD2MAN} --section=${sect} --name=${*:U} $< > $@'
214 @${POD2MAN} --section=${sect} --name=${*:U} $< > $@.tmp && mv $@.tmp $@
215.endfor
216
217.include <bsd.obj.mk> 203.include <bsd.obj.mk>
218.include <bsd.subdir.mk> 204.include <bsd.subdir.mk>
219 205
220clean cleandir: 206clean cleandir:
221 rm -f ${GENMAN}
diff --git a/src/lib/libcrypto/man/RC4.3 b/src/lib/libcrypto/man/RC4.3
new file mode 100644
index 0000000000..2c631c36be
--- /dev/null
+++ b/src/lib/libcrypto/man/RC4.3
@@ -0,0 +1,79 @@
1.Dd $Mdocdate: November 5 2016 $
2.Dt RC4 3
3.Os
4.Sh NAME
5.Nm RC4_set_key ,
6.Nm RC4
7.Nd RC4 encryption
8.Sh SYNOPSIS
9.In openssl/rc4.h
10.Ft void
11.Fo RC4_set_key
12.Fa "RC4_KEY *key"
13.Fa "int len"
14.Fa "const unsigned char *data"
15.Fc
16.Ft void
17.Fo RC4
18.Fa "RC4_KEY *key"
19.Fa "unsigned long len"
20.Fa "const unsigned char *indata"
21.Fa "unsigned char *outdata"
22.Fc
23.Sh DESCRIPTION
24This library implements the alleged RC4 cipher, which is described for
25example in
26.%B Applied Cryptography .
27It is believed to be compatible with RC4[TM], a proprietary cipher of
28RSA Security Inc.
29.Pp
30RC4 is a stream cipher with variable key length.
31Typically, 128 bit (16 byte) keys are used for strong encryption, but
32shorter insecure key sizes have been widely used due to export
33restrictions.
34.Pp
35RC4 consists of a key setup phase and the actual encryption or
36decryption phase.
37.Pp
38.Fn RC4_set_key
39sets up the
40.Vt RC4_KEY
41.Fa key
42using the
43.Fa len
44bytes long key at
45.Fa data .
46.Pp
47.Fn RC4
48encrypts or decrypts the
49.Fa len
50bytes of data at
51.Fa indata
52using
53.Fa key
54and places the result at
55.Fa outdata .
56Repeated
57.Fn RC4
58calls with the same
59.Fa key
60yield a continuous key stream.
61.Pp
62Since RC4 is a stream cipher (the input is XOR'ed with a pseudo-random
63key stream to produce the output), decryption uses the same function
64calls as encryption.
65.Sh RETURN VALUES
66.Fn RC4_set_key
67and
68.Fn RC4
69do not return values.
70.Sh SEE ALSO
71.Xr blowfish 3 ,
72.Xr EVP_EncryptInit 3
73.Sh HISTORY
74.Fn RC4_set_key
75and
76.Fn RC4
77are available in all versions of SSLeay and OpenSSL.
78.Sh BUGS
79This cipher is broken and should no longer be used.
diff --git a/src/lib/libcrypto/man/RIPEMD160.3 b/src/lib/libcrypto/man/RIPEMD160.3
new file mode 100644
index 0000000000..57cff8a9e4
--- /dev/null
+++ b/src/lib/libcrypto/man/RIPEMD160.3
@@ -0,0 +1,96 @@
1.Dd $Mdocdate: November 5 2016 $
2.Dt RIPEMD160 3
3.Os
4.Sh NAME
5.Nm RIPEMD160 ,
6.Nm RIPEMD160_Init ,
7.Nm RIPEMD160_Update ,
8.Nm RIPEMD160_Final
9.Nd RIPEMD-160 hash function
10.Sh SYNOPSIS
11.In openssl/ripemd.h
12.Ft unsigned char *
13.Fo RIPEMD160
14.Fa "const unsigned char *d"
15.Fa "unsigned long n"
16.Fa "unsigned char *md"
17.Fc
18.Ft int
19.Fo RIPEMD160_Init
20.Fa "RIPEMD160_CTX *c"
21.Fc
22.Ft int
23.Fo RIPEMD160_Update
24.Fa "RIPEMD_CTX *c"
25.Fa "const void *data"
26.Fa "unsigned long len"
27.Fc
28.Ft int
29.Fo RIPEMD160_Final
30.Fa "unsigned char *md"
31.Fa "RIPEMD160_CTX *c"
32.Fc
33.Sh DESCRIPTION
34RIPEMD-160 is a cryptographic hash function with a 160 bit output.
35.Pp
36.Fn RIPEMD160
37computes the RIPEMD-160 message digest of the
38.Fa n
39bytes at
40.Fa d
41and places it in
42.Fa md ,
43which must have space for
44.Dv RIPEMD160_DIGEST_LENGTH
45== 20 bytes of output.
46If
47.Fa md
48is
49.Dv NULL ,
50the digest is placed in a static array.
51.Pp
52The following functions may be used if the message is not completely
53stored in memory:
54.Pp
55.Fn RIPEMD160_Init
56initializes a
57.Vt RIPEMD160_CTX
58structure.
59.Pp
60.Fn RIPEMD160_Update
61can be called repeatedly with chunks of the message to be hashed
62.Pq Fa len No bytes at Fa data .
63.Pp
64.Fn RIPEMD160_Final
65places the message digest in
66.Fa md ,
67which must have space for
68.Dv RIPEMD160_DIGEST_LENGTH
69== 20 bytes of output,
70and erases the
71.Vt RIPEMD160_CTX .
72.Pp
73Applications should use the higher level functions
74.Xr EVP_DigestInit 3
75etc. instead of calling the hash functions directly.
76.Sh RETURN VALUES
77.Fn RIPEMD160
78returns a pointer to the hash value.
79.Pp
80.Fn RIPEMD160_Init ,
81.Fn RIPEMD160_Update ,
82and
83.Fn RIPEMD160_Final
84return 1 for success or 0 otherwise.
85.Sh SEE ALSO
86.Xr EVP_DigestInit 3 ,
87.Xr HMAC 3
88.Sh STANDARDS
89ISO/IEC 10118-3 (draft) (??)
90.Sh HISTORY
91.Fn RIPEMD160 ,
92.Fn RIPEMD160_Init ,
93.Fn RIPEMD160_Update ,
94and
95.Fn RIPEMD160_Final
96are available since SSLeay 0.9.0.
diff --git a/src/lib/libcrypto/man/SHA1.3 b/src/lib/libcrypto/man/SHA1.3
new file mode 100644
index 0000000000..c873a8cbb7
--- /dev/null
+++ b/src/lib/libcrypto/man/SHA1.3
@@ -0,0 +1,102 @@
1.Dd $Mdocdate: November 5 2016 $
2.Dt SHA1 3
3.Os
4.Sh NAME
5.Nm SHA1 ,
6.Nm SHA1_Init ,
7.Nm SHA1_Update ,
8.Nm SHA1_Final
9.Nd Secure Hash Algorithm
10.Sh SYNOPSIS
11.In openssl/sha.h
12.Ft unsigned char *
13.Fo SHA1
14.Fa "const unsigned char *d"
15.Fa "unsigned long n"
16.Fa "unsigned char *md"
17.Fc
18.Ft int
19.Fo SHA1_Init
20.Fa "SHA_CTX *c"
21.Fc
22.Ft int
23.Fo SHA1_Update
24.Fa "SHA_CTX *c"
25.Fa "const void *data"
26.Fa "unsigned long len"
27.Fc
28.Ft int
29.Fo SHA1_Final
30.Fa "unsigned char *md"
31.Fa "SHA_CTX *c"
32.Fc
33.Sh DESCRIPTION
34SHA-1 (Secure Hash Algorithm) is a cryptographic hash function with a
35160 bit output.
36.Pp
37.Fn SHA1
38computes the SHA-1 message digest of the
39.Fa n
40bytes at
41.Fa d
42and places it in
43.Fa md ,
44which must have space for
45.Dv SHA_DIGEST_LENGTH
46== 20 bytes of output.
47If
48.Fa md
49is
50.Dv NULL ,
51the digest is placed in a static array.
52.Pp
53The following functions may be used if the message is not completely
54stored in memory:
55.Pp
56.Fn SHA1_Init
57initializes a
58.Vt SHA_CTX
59structure.
60.Pp
61.Fn SHA1_Update
62can be called repeatedly with chunks of the message to be hashed
63.Pq Fa len No bytes at Fa data .
64.Pp
65.Fn SHA1_Final
66places the message digest in
67.Fa md ,
68which must have space for
69.Dv SHA_DIGEST_LENGTH
70== 20 bytes of output, and erases the
71.Vt SHA_CTX .
72.Pp
73Applications should use the higher level functions
74.Xr EVP_DigestInit 3
75etc. instead of calling the hash functions directly.
76.Pp
77The predecessor of SHA-1, SHA, is also implemented, but it should be
78used only when backward compatibility is required.
79.Sh RETURN VALUES
80.Fn SHA1
81returns a pointer to the hash value.
82.Pp
83.Fn SHA1_Init ,
84.Fn SHA1_Update ,
85and
86.Fn SHA1_Final
87return 1 for success or 0 otherwise.
88.Sh SEE ALSO
89.Xr EVP_DigestInit 3 ,
90.Xr HMAC 3 ,
91.Xr RIPEMD160 3
92.Sh STANDARDS
93SHA: US Federal Information Processing Standard FIPS PUB 180 (Secure
94Hash Standard), SHA-1: US Federal Information Processing Standard FIPS
95PUB 180-1 (Secure Hash Standard), ANSI X9.30
96.Sh HISTORY
97.Fn SHA1 ,
98.Fn SHA1_Init ,
99.Fn SHA1_Update ,
100and
101.Fn SHA1_Final
102are available in all versions of SSLeay and OpenSSL.
diff --git a/src/lib/libcrypto/man/bn.3 b/src/lib/libcrypto/man/bn.3
new file mode 100644
index 0000000000..6406be1663
--- /dev/null
+++ b/src/lib/libcrypto/man/bn.3
@@ -0,0 +1,576 @@
1.Dd $Mdocdate: November 5 2016 $
2.Dt BN 3
3.Os
4.Sh NAME
5.Nm bn
6.Nd multiprecision integer arithmetics
7.Sh SYNOPSIS
8.In openssl/bn.h
9.Ft BIGNUM *
10.Fn BN_new void
11.Ft void
12.Fo BN_free
13.Fa "BIGNUM *a"
14.Fc
15.Ft void
16.Fo BN_init
17.Fa "BIGNUM *"
18.Fc
19.Ft void
20.Fo BN_clear
21.Fa "BIGNUM *a"
22.Fc
23.Ft void
24.Fo BN_clear_free
25.Fa "BIGNUM *a"
26.Fc
27.Ft BN_CTX *
28.Fn BN_CTX_new void
29.Ft void
30.Fo BN_CTX_init
31.Fa "BN_CTX *c"
32.Fc
33.Ft void
34.Fo BN_CTX_free
35.Fa "BN_CTX *c"
36.Fc
37.Ft BIGNUM *
38.Fo BN_copy
39.Fa "BIGNUM *a"
40.Fa "const BIGNUM *b"
41.Fc
42.Ft BIGNUM *
43.Fo BN_dup
44.Fa "const BIGNUM *a"
45.Fc
46.Ft BIGNUM *
47.Fo BN_swap
48.Fa "BIGNUM *a"
49.Fa "BIGNUM *b"
50.Fc
51.Ft int
52.Fo BN_num_bytes
53.Fa "const BIGNUM *a"
54.Fc
55.Ft int
56.Fo BN_num_bits
57.Fa "const BIGNUM *a"
58.Fc
59.Ft int
60.Fo BN_num_bits_word
61.Fa "BN_ULONG w"
62.Fc
63.Ft void
64.Fo BN_set_negative
65.Fa "BIGNUM *a"
66.Fa "int n"
67.Fc
68.Ft int
69.Fo BN_is_negative
70.Fa "const BIGNUM *a"
71.Fc
72.Ft int
73.Fo BN_add
74.Fa "BIGNUM *r"
75.Fa "const BIGNUM *a"
76.Fa "const BIGNUM *b"
77.Fc
78.Ft int
79.Fo BN_sub
80.Fa "BIGNUM *r"
81.Fa "const BIGNUM *a"
82.Fa "const BIGNUM *b"
83.Fc
84.Ft int
85.Fo BN_mul
86.Fa "BIGNUM *r"
87.Fa "BIGNUM *a"
88.Fa "BIGNUM *b"
89.Fa "BN_CTX *ctx"
90.Fc
91.Ft int
92.Fo BN_sqr
93.Fa "BIGNUM *r"
94.Fa "BIGNUM *a"
95.Fa "BN_CTX *ctx"
96.Fc
97.Ft int
98.Fo BN_div
99.Fa "BIGNUM *dv"
100.Fa "BIGNUM *rem"
101.Fa "const BIGNUM *a"
102.Fa "const BIGNUM *d"
103.Fa "BN_CTX *ctx"
104.Fc
105.Ft int
106.Fo BN_mod
107.Fa "BIGNUM *rem"
108.Fa "const BIGNUM *a"
109.Fa "const BIGNUM *m"
110.Fa "BN_CTX *ctx"
111.Fc
112.Ft int
113.Fo BN_nnmod
114.Fa "BIGNUM *rem"
115.Fa "const BIGNUM *a"
116.Fa "const BIGNUM *m"
117.Fa "BN_CTX *ctx"
118.Fc
119.Ft int
120.Fo BN_mod_add
121.Fa "BIGNUM *ret"
122.Fa "BIGNUM *a"
123.Fa "BIGNUM *b"
124.Fa "const BIGNUM *m"
125.Fa "BN_CTX *ctx"
126.Fc
127.Ft int
128.Fo BN_mod_sub
129.Fa "BIGNUM *ret"
130.Fa "BIGNUM *a"
131.Fa "BIGNUM *b"
132.Fa "const BIGNUM *m"
133.Fa "BN_CTX *ctx"
134.Fc
135.Ft int
136.Fo BN_mod_mul
137.Fa "BIGNUM *ret"
138.Fa "BIGNUM *a"
139.Fa "BIGNUM *b"
140.Fa "const BIGNUM *m"
141.Fa "BN_CTX *ctx"
142.Fc
143.Ft int
144.Fo BN_mod_sqr
145.Fa "BIGNUM *ret"
146.Fa "BIGNUM *a"
147.Fa "const BIGNUM *m"
148.Fa "BN_CTX *ctx"
149.Fc
150.Ft int
151.Fo BN_exp
152.Fa "BIGNUM *r"
153.Fa "BIGNUM *a"
154.Fa "BIGNUM *p"
155.Fa "BN_CTX *ctx"
156.Fc
157.Ft int
158.Fo BN_mod_exp
159.Fa "BIGNUM *r"
160.Fa "BIGNUM *a"
161.Fa "const BIGNUM *p"
162.Fa "const BIGNUM *m"
163.Fa "BN_CTX *ctx"
164.Fc
165.Ft int
166.Fo BN_gcd
167.Fa "BIGNUM *r"
168.Fa "BIGNUM *a"
169.Fa "BIGNUM *b"
170.Fa "BN_CTX *ctx"
171.Fc
172.Ft int
173.Fo BN_add_word
174.Fa "BIGNUM *a"
175.Fa "BN_ULONG w"
176.Fc
177.Ft int
178.Fo BN_sub_word
179.Fa "BIGNUM *a"
180.Fa "BN_ULONG w"
181.Fc
182.Ft int
183.Fo BN_mul_word
184.Fa "BIGNUM *a"
185.Fa "BN_ULONG w"
186.Fc
187.Ft BN_ULONG
188.Fo BN_div_word
189.Fa "BIGNUM *a"
190.Fa "BN_ULONG w"
191.Fc
192.Ft BN_ULONG
193.Fo BN_mod_word
194.Fa "const BIGNUM *a"
195.Fa "BN_ULONG w"
196.Fc
197.Ft int
198.Fo BN_cmp
199.Fa "BIGNUM *a"
200.Fa "BIGNUM *b"
201.Fc
202.Ft int
203.Fo BN_ucmp
204.Fa "BIGNUM *a"
205.Fa "BIGNUM *b"
206.Fc
207.Ft int
208.Fo BN_is_zero
209.Fa "BIGNUM *a"
210.Fc
211.Ft int
212.Fo BN_is_one
213.Fa "BIGNUM *a"
214.Fc
215.Ft int
216.Fo BN_is_word
217.Fa "BIGNUM *a"
218.Fa "BN_ULONG w"
219.Fc
220.Ft int
221.Fo BN_is_odd
222.Fa "BIGNUM *a"
223.Fc
224.Ft int
225.Fo BN_zero
226.Fa "BIGNUM *a"
227.Fc
228.Ft int
229.Fo BN_one
230.Fa "BIGNUM *a"
231.Fc
232.Ft const BIGNUM *
233.Fn BN_value_one void
234.Ft int
235.Fo BN_set_word
236.Fa "BIGNUM *a"
237.Fa "unsigned long w"
238.Fc
239.Ft unsigned long
240.Fo BN_get_word
241.Fa "BIGNUM *a"
242.Fc
243.Ft int
244.Fo BN_rand
245.Fa "BIGNUM *rnd"
246.Fa "int bits"
247.Fa "int top"
248.Fa "int bottom"
249.Fc
250.Ft int
251.Fo BN_pseudo_rand
252.Fa "BIGNUM *rnd"
253.Fa "int bits"
254.Fa "int top"
255.Fa "int bottom"
256.Fc
257.Ft int
258.Fo BN_rand_range
259.Fa "BIGNUM *rnd"
260.Fa "BIGNUM *range"
261.Fc
262.Ft int
263.Fo BN_pseudo_rand_range
264.Fa "BIGNUM *rnd"
265.Fa "BIGNUM *range"
266.Fc
267.Ft BIGNUM *
268.Fo BN_generate_prime
269.Fa "BIGNUM *ret"
270.Fa "int bits"
271.Fa "int safe"
272.Fa "BIGNUM *add"
273.Fa "BIGNUM *rem"
274.Fa "void (*callback)(int, int, void *)"
275.Fa "void *cb_arg"
276.Fc
277.Ft int
278.Fo BN_is_prime
279.Fa "const BIGNUM *p"
280.Fa "int nchecks"
281.Fa "void (*callback)(int, int, void *)"
282.Fa "BN_CTX *ctx"
283.Fa "void *cb_arg"
284.Fc
285.Ft int
286.Fo BN_set_bit
287.Fa "BIGNUM *a"
288.Fa "int n"
289.Fc
290.Ft int
291.Fo BN_clear_bit
292.Fa "BIGNUM *a"
293.Fa "int n"
294.Fc
295.Ft int
296.Fo BN_is_bit_set
297.Fa "const BIGNUM *a"
298.Fa "int n"
299.Fc
300.Ft int
301.Fo BN_mask_bits
302.Fa "BIGNUM *a"
303.Fa "int n"
304.Fc
305.Ft int
306.Fo BN_lshift
307.Fa "BIGNUM *r"
308.Fa "const BIGNUM *a"
309.Fa "int n"
310.Fc
311.Ft int
312.Fo BN_lshift1
313.Fa "BIGNUM *r"
314.Fa "BIGNUM *a"
315.Fc
316.Ft int
317.Fo BN_rshift
318.Fa "BIGNUM *r"
319.Fa "BIGNUM *a"
320.Fa "int n"
321.Fc
322.Ft int
323.Fo BN_rshift1
324.Fa "BIGNUM *r"
325.Fa "BIGNUM *a"
326.Fc
327.Ft int
328.Fo BN_bn2bin
329.Fa "const BIGNUM *a"
330.Fa "unsigned char *to"
331.Fc
332.Ft BIGNUM *
333.Fo BN_bin2bn
334.Fa "const unsigned char *s"
335.Fa "int len"
336.Fa "BIGNUM *ret"
337.Fc
338.Ft char *
339.Fo BN_bn2hex
340.Fa "const BIGNUM *a"
341.Fc
342.Ft char *
343.Fo BN_bn2dec
344.Fa "const BIGNUM *a"
345.Fc
346.Ft int
347.Fo BN_hex2bn
348.Fa "BIGNUM **a"
349.Fa "const char *str"
350.Fc
351.Ft int
352.Fo BN_dec2bn
353.Fa "BIGNUM **a"
354.Fa "const char *str"
355.Fc
356.Ft int
357.Fo BN_print
358.Fa "BIO *fp"
359.Fa "const BIGNUM *a"
360.Fc
361.Ft int
362.Fo BN_print_fp
363.Fa "FILE *fp"
364.Fa "const BIGNUM *a"
365.Fc
366.Ft int
367.Fo BN_bn2mpi
368.Fa "const BIGNUM *a"
369.Fa "unsigned char *to"
370.Fc
371.Ft BIGNUM *
372.Fo BN_mpi2bn
373.Fa "unsigned char *s"
374.Fa "int len"
375.Fa "BIGNUM *ret"
376.Fc
377.Ft BIGNUM *
378.Fo BN_mod_inverse
379.Fa "BIGNUM *r"
380.Fa "BIGNUM *a"
381.Fa "const BIGNUM *n"
382.Fa "BN_CTX *ctx"
383.Fc
384.Ft BN_RECP_CTX *
385.Fn BN_RECP_CTX_new void
386.Ft void
387.Fo BN_RECP_CTX_init
388.Fa "BN_RECP_CTX *recp"
389.Fc
390.Ft void
391.Fo BN_RECP_CTX_free
392.Fa "BN_RECP_CTX *recp"
393.Fc
394.Ft int
395.Fo BN_RECP_CTX_set
396.Fa "BN_RECP_CTX *recp"
397.Fa "const BIGNUM *m"
398.Fa "BN_CTX *ctx"
399.Fc
400.Ft int
401.Fo BN_mod_mul_reciprocal
402.Fa "BIGNUM *r"
403.Fa "BIGNUM *a"
404.Fa "BIGNUM *b"
405.Fa "BN_RECP_CTX *recp"
406.Fa "BN_CTX *ctx"
407.Fc
408.Ft BN_MONT_CTX *
409.Fn BN_MONT_CTX_new void
410.Ft void
411.Fo BN_MONT_CTX_init
412.Fa "BN_MONT_CTX *ctx"
413.Fc
414.Ft void
415.Fo BN_MONT_CTX_free
416.Fa "BN_MONT_CTX *mont"
417.Fc
418.Ft int
419.Fo BN_MONT_CTX_set
420.Fa "BN_MONT_CTX *mont"
421.Fa "const BIGNUM *m"
422.Fa "BN_CTX *ctx"
423.Fc
424.Ft BN_MONT_CTX *
425.Fo BN_MONT_CTX_copy
426.Fa "BN_MONT_CTX *to"
427.Fa "BN_MONT_CTX *from"
428.Fc
429.Ft int
430.Fo BN_mod_mul_montgomery
431.Fa "BIGNUM *r"
432.Fa "BIGNUM *a"
433.Fa "BIGNUM *b"
434.Fa "BN_MONT_CTX *mont"
435.Fa "BN_CTX *ctx"
436.Fc
437.Ft int
438.Fo BN_from_montgomery
439.Fa "BIGNUM *r"
440.Fa "BIGNUM *a"
441.Fa "BN_MONT_CTX *mont"
442.Fa "BN_CTX *ctx"
443.Fc
444.Ft int
445.Fo BN_to_montgomery
446.Fa "BIGNUM *r"
447.Fa "BIGNUM *a"
448.Fa "BN_MONT_CTX *mont"
449.Fa "BN_CTX *ctx"
450.Fc
451.Ft BN_BLINDING *
452.Fo BN_BLINDING_new
453.Fa "const BIGNUM *A"
454.Fa "const BIGNUM *Ai"
455.Fa "BIGNUM *mod"
456.Fc
457.Ft void
458.Fo BN_BLINDING_free
459.Fa "BN_BLINDING *b"
460.Fc
461.Ft int
462.Fo BN_BLINDING_update
463.Fa "BN_BLINDING *b"
464.Fa "BN_CTX *ctx"
465.Fc
466.Ft int
467.Fo BN_BLINDING_convert
468.Fa "BIGNUM *n"
469.Fa "BN_BLINDING *b"
470.Fa "BN_CTX *ctx"
471.Fc
472.Ft int
473.Fo BN_BLINDING_invert
474.Fa "BIGNUM *n"
475.Fa "BN_BLINDING *b"
476.Fa "BN_CTX *ctx"
477.Fc
478.Ft int
479.Fo BN_BLINDING_convert_ex
480.Fa "BIGNUM *n"
481.Fa "BIGNUM *r"
482.Fa "BN_BLINDING *b"
483.Fa "BN_CTX *ctx"
484.Fc
485.Ft int
486.Fo BN_BLINDING_invert_ex
487.Fa "BIGNUM *n"
488.Fa "const BIGNUM *r"
489.Fa "BN_BLINDING *b"
490.Fa "BN_CTX *ctx"
491.Fc
492.Ft unsigned long
493.Fo BN_BLINDING_get_thread_id
494.Fa "const BN_BLINDING *"
495.Fc
496.Ft void
497.Fo BN_BLINDING_set_thread_id
498.Fa "BN_BLINDING *"
499.Fa "unsigned long"
500.Fc
501.Ft unsigned long
502.Fo BN_BLINDING_get_flags
503.Fa "const BN_BLINDING *"
504.Fc
505.Ft void
506.Fo BN_BLINDING_set_flags
507.Fa "BN_BLINDING *"
508.Fa "unsigned long"
509.Fc
510.Ft BN_BLINDING *
511.Fo BN_BLINDING_create_param
512.Fa "BN_BLINDING *b"
513.Fa "const BIGNUM *e"
514.Fa "BIGNUM *m"
515.Fa "BN_CTX *ctx"
516.Fa "int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)"
517.Fa "BN_MONT_CTX *m_ctx"
518.Fc
519.Sh DESCRIPTION
520This library performs arithmetic operations on integers of arbitrary size.
521It was written for use in public key cryptography, such as RSA and
522Diffie-Hellman.
523.Pp
524It uses dynamic memory allocation for storing its data structures.
525That means that there is no limit on the size of the numbers manipulated
526by these functions, but return values must always be checked in case a
527memory allocation error has occurred.
528.Pp
529The basic object in this library is a
530.Vt BIGNUM .
531It is used to hold a single large integer.
532This type should be considered opaque and fields should not be modified
533or accessed directly.
534.Pp
535The creation of
536.Vt BIGNUM
537objects is described in
538.Xr BN_new 3 ;
539.Xr BN_add 3
540describes most of the arithmetic operations.
541Comparison is described in
542.Xr BN_cmp 3 ;
543.Xr BN_zero 3
544describes certain assignments,
545.Xr BN_rand 3
546the generation of random numbers,
547.Xr BN_generate_prime 3
548deals with prime numbers and
549.Xr BN_set_bit 3
550with bit operations.
551The conversion of
552.Vt BIGNUM Ns s
553to external formats is described in
554.Xr BN_bn2bin 3 .
555.Sh SEE ALSO
556.Xr BN_add 3 ,
557.Xr BN_add_word 3 ,
558.Xr BN_BLINDING_new 3 ,
559.Xr BN_bn2bin 3 ,
560.Xr BN_cmp 3 ,
561.Xr BN_copy 3 ,
562.Xr BN_CTX_new 3 ,
563.Xr bn_dump 3 ,
564.Xr BN_generate_prime 3 ,
565.Xr BN_mod_inverse 3 ,
566.Xr BN_mod_mul_montgomery 3 ,
567.Xr BN_mod_mul_reciprocal 3 ,
568.Xr BN_new 3 ,
569.Xr BN_num_bytes 3 ,
570.Xr BN_rand 3 ,
571.Xr BN_set_bit 3 ,
572.Xr BN_swap 3 ,
573.Xr BN_zero 3 ,
574.Xr dh 3 ,
575.Xr ERR 3 ,
576.Xr rsa 3
diff --git a/src/lib/libcrypto/man/d2i_DHparams.3 b/src/lib/libcrypto/man/d2i_DHparams.3
new file mode 100644
index 0000000000..73aec0269b
--- /dev/null
+++ b/src/lib/libcrypto/man/d2i_DHparams.3
@@ -0,0 +1,30 @@
1.Dd $Mdocdate: November 5 2016 $
2.Dt D2I_DHPARAMS 3
3.Os
4.Sh NAME
5.Nm d2i_DHparams ,
6.Nm i2d_DHparams
7.Nd PKCS#3 DH parameter functions
8.Sh SYNOPSIS
9.In openssl/dh.h
10.Ft DH *
11.Fo d2i_DHparams
12.Fa "DH **a"
13.Fa "unsigned char **pp"
14.Fa "long length"
15.Fc
16.Ft int
17.Fo i2d_DHparams
18.Fa "DH *a"
19.Fa "unsigned char **pp"
20.Fc
21.Sh DESCRIPTION
22These functions decode and encode PKCS#3 DH parameters using the
23DHparameter structure described in PKCS#3.
24.Pp
25Otherwise these behave in a way similar to
26.Xr d2i_X509 3
27and
28.Xr i2d_X509 3 .
29.Sh SEE ALSO
30.Xr d2i_X509 3
diff --git a/src/lib/libcrypto/man/d2i_DSAPublicKey.3 b/src/lib/libcrypto/man/d2i_DSAPublicKey.3
new file mode 100644
index 0000000000..aff5d0f814
--- /dev/null
+++ b/src/lib/libcrypto/man/d2i_DSAPublicKey.3
@@ -0,0 +1,159 @@
1.Dd $Mdocdate: November 5 2016 $
2.Dt D2I_DSAPUBLICKEY 3
3.Os
4.Sh NAME
5.Nm d2i_DSAPublicKey ,
6.Nm i2d_DSAPublicKey ,
7.Nm d2i_DSAPrivateKey ,
8.Nm i2d_DSAPrivateKey ,
9.Nm d2i_DSA_PUBKEY ,
10.Nm i2d_DSA_PUBKEY ,
11.Nm d2i_DSAparams ,
12.Nm i2d_DSAparams ,
13.Nm d2i_DSA_SIG ,
14.Nm i2d_DSA_SIG
15.Nd DSA key encoding and parsing functions
16.Sh SYNOPSIS
17.In openssl/dsa.h
18.In openssl/x509.h
19.Ft DSA *
20.Fo d2i_DSAPublicKey
21.Fa "DSA **a"
22.Fa "const unsigned char **pp"
23.Fa "long length"
24.Fc
25.Ft int
26.Fo i2d_DSAPublicKey
27.Fa "const DSA *a"
28.Fa "unsigned char **pp"
29.Fc
30.Ft DSA *
31.Fo d2i_DSA_PUBKEY
32.Fa "DSA **a"
33.Fa "const unsigned char **pp"
34.Fa "long length"
35.Fc
36.Ft int
37.Fo i2d_DSA_PUBKEY
38.Fa "const DSA *a"
39.Fa "unsigned char **pp"
40.Fc
41.Ft DSA *
42.Fo d2i_DSAPrivateKey
43.Fa "DSA **a"
44.Fa "const unsigned char **pp"
45.Fa "long length"
46.Fc
47.Ft int
48.Fo i2d_DSAPrivateKey
49.Fa "const DSA *a"
50.Fa "unsigned char **pp"
51.Fc
52.Ft DSA *
53.Fo d2i_DSAparams
54.Fa "DSA **a"
55.Fa "const unsigned char **pp"
56.Fa "long length"
57.Fc
58.Ft int
59.Fo i2d_DSAparams
60.Fa "const DSA *a"
61.Fa "unsigned char **pp"
62.Fc
63.Ft DSA *
64.Fo d2i_DSA_SIG
65.Fa "DSA_SIG **a"
66.Fa "const unsigned char **pp"
67.Fa "long length"
68.Fc
69.Ft int
70.Fo i2d_DSA_SIG
71.Fa "const DSA_SIG *a"
72.Fa "unsigned char **pp"
73.Fc
74.Sh DESCRIPTION
75.Fn d2i_DSAPublicKey
76and
77.Fn i2d_DSAPublicKey
78decode and encode the DSA public key components structure.
79.Pp
80.Fn d2i_DSA_PUBKEY
81and
82.Fn i2d_DSA_PUBKEY
83decode and encode a DSA public key using a SubjectPublicKeyInfo
84(certificate public key) structure.
85.Pp
86.Fn d2i_DSAPrivateKey
87and
88.Fn i2d_DSAPrivateKey
89decode and encode the DSA private key components.
90.Pp
91.Fn d2i_DSAparams
92and
93.Fn i2d_DSAparams
94decode and encode the DSA parameters using a
95.Sy Dss-Parms
96structure as defined in RFC2459.
97.Pp
98.Fn d2i_DSA_SIG
99and
100.Fn i2d_DSA_SIG
101decode and encode a DSA signature using a
102.Sy Dss-Sig-Value
103structure as defined in RFC2459.
104.Pp
105The usage of all of these functions is similar to
106.Xr d2i_X509 3
107and
108.Xr i2d_X509 3 .
109.Pp
110The
111.Vt DSA
112structure passed to the private key encoding functions should have all
113the private key components present.
114.Pp
115The data encoded by the private key functions is unencrypted and
116therefore offers no private key security.
117.Pp
118The
119.Fn *_DSA_PUBKEY
120functions should be used in preference to the
121.Fn *_DSAPublicKey
122functions when encoding public keys because they use a standard format.
123.Pp
124The
125.Fn *_DSAPublicKey
126functions use an non-standard format.
127The actual data encoded depends on the value of
128.Fa a->write_params .
129If
130.Fa a->write_params
131is zero, then only the
132.Fa a->pub_key
133field is encoded as an
134.Sy INTEGER .
135If
136.Fa a->write_params
137is 1, then a
138.Sy SEQUENCE
139consisting of the
140.Fa a->p ,
141.Fa a->q ,
142.Fa a->g ,
143and
144.Fa a->pub_key
145fields is encoded.
146.Pp
147The
148.Fn *_DSAPrivateKey
149functions also use a non-standard structure consisting consisting of a
150SEQUENCE containing the
151.Fa a->p ,
152.Fa a->q ,
153.Fa a->g ,
154.Fa a->pub_key ,
155and
156.Fa a->priv_key
157fields.
158.Sh SEE ALSO
159.Xr d2i_X509 3
diff --git a/src/lib/libcrypto/man/d2i_ECPKParameters.3 b/src/lib/libcrypto/man/d2i_ECPKParameters.3
new file mode 100644
index 0000000000..71d84b95c9
--- /dev/null
+++ b/src/lib/libcrypto/man/d2i_ECPKParameters.3
@@ -0,0 +1,188 @@
1.Dd $Mdocdate: November 5 2016 $
2.Dt D2I_ECPKPARAMETERS 3
3.Os
4.Sh NAME
5.Nm d2i_ECPKParameters ,
6.Nm i2d_ECPKParameters ,
7.Nm d2i_ECPKParameters_bio ,
8.Nm i2d_ECPKParameters_bio ,
9.Nm d2i_ECPKParameters_fp ,
10.Nm i2d_ECPKParameters_fp ,
11.Nm ECPKParameters_print ,
12.Nm ECPKParameters_print_fp
13.Nd decode and encode ASN.1 representations of elliptic curve entities
14.Sh SYNOPSIS
15.In openssl/ec.h
16.Ft EC_GROUP *
17.Fo d2i_ECPKParameters
18.Fa "EC_GROUP **px"
19.Fa "const unsigned char **in"
20.Fa "long len"
21.Fc
22.Ft int
23.Fo i2d_ECPKParameters
24.Fa "const EC_GROUP *x"
25.Fa "unsigned char **out"
26.Fc
27.Fd #define d2i_ECPKParameters_bio(bp,x)\
28 ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x)
29.Fd #define i2d_ECPKParameters_bio(bp,x)\
30 ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x)
31.Fd #define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL,\
32 (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x))
33.Fd #define i2d_ECPKParameters_fp(fp,x)\
34 ASN1_i2d_fp(i2d_ECPKParameters,(fp), (unsigned char *)(x))
35.Ft int
36.Fo ECPKParameters_print
37.Fa "BIO *bp"
38.Fa "const EC_GROUP *x"
39.Fa "int off"
40.Fc
41.Ft int
42.Fo ECPKParameters_print_fp
43.Fa "FILE *fp"
44.Fa "const EC_GROUP *x"
45.Fa "int off"
46.Fc
47.Sh DESCRIPTION
48The ECPKParameters encode and decode routines encode and parse the
49public parameters for an
50.Vt EC_GROUP
51structure, which represents a curve.
52.Pp
53.Fn d2i_ECPKParameters
54attempts to decode
55.Fa len
56bytes at
57.Pf * Fa in .
58If successful, a pointer to the
59.Vt EC_GROUP
60structure is returned.
61If an error occurred, then
62.Dv NULL
63is returned.
64If
65.Fa px
66is not
67.Dv NULL ,
68then the returned structure is written to
69.Pf * Fa px .
70If
71.Pf * Fa px
72is not
73.Dv NULL ,
74then it is assumed that
75.Pf * Fa px
76contains a valid
77.Vt EC_GROUP
78structure and an attempt is made to reuse it.
79If the call is successful,
80.Pf * Fa in
81is incremented to the byte following the parsed data.
82.Pp
83.Fn i2d_ECPKParameters
84encodes the structure pointed to by
85.Fa x
86into DER format.
87If
88.Fa out
89is not
90.Dv NULL ,
91is writes the DER encoded data to the buffer at
92.Pf * Fa out
93and increments it to point after the data just written.
94If the return value is negative, an error occurred, otherwise it returns
95the length of the encoded data.
96.Pp
97If
98.Pf * Fa out
99is
100.Dv NULL ,
101memory will be allocated for a buffer and the encoded data written to it.
102In this case
103.Pf * Fa out
104is not incremented, and it points to the start of the data just written.
105.Pp
106.Fn d2i_ECPKParameters_bio
107is similar to
108.Fn d2i_ECPKParameters
109except it attempts to parse data from
110.Vt BIO
111.Fa bp .
112.Pp
113.Fn d2i_ECPKParameters_fp
114is similar to
115.Fn d2i_ECPKParameters
116except it attempts to parse data from the
117.Vt FILE
118pointer
119.Fa fp .
120.Pp
121.Fn i2d_ECPKParameters_bio
122is similar to
123.Fn i2d_ECPKParameters
124except it writes the encoding of the structure
125.Fa x
126to
127.Vt BIO
128.Fa bp
129and it returns 1 for success or 0 for failure.
130.Pp
131.Fn i2d_ECPKParameters_fp
132is similar to
133.Fn i2d_ECPKParameters
134except it writes the encoding of the structure
135.Fa x
136to
137.Vt BIO
138.Sy bp
139and it returns 1 for success or 0 for failure.
140.Pp
141These functions are very similar to the X.509 functions described in
142.Xr d2i_X509 3 ,
143where further notes and examples are available.
144.Pp
145The
146.Fn ECPKParameters_print
147and
148.Fn ECPKParameters_print_fp
149functions print human-readable output of the public parameters of the
150.Vt EC_GROUP
151to
152.Fa bp
153or
154.Fa fp .
155The output lines are indented by
156.Fa off
157spaces.
158.Sh RETURN VALUES
159.Fn d2i_ECPKParameters ,
160.Fn d2i_ECPKParameters_bio ,
161and
162.Fn d2i_ECPKParameters_fp
163return a valid
164.Vt EC_GROUP
165structure or
166.Dv NULL
167if an error occurs.
168.Pp
169.Fn i2d_ECPKParameters
170returns the number of bytes successfully encoded or a negative value if
171an error occurs.
172.Pp
173.Fn i2d_ECPKParameters_bio ,
174.Fn i2d_ECPKParameters_fp ,
175.Fn ECPKParameters_print ,
176and
177.Fn ECPKParameters_print_fp
178return 1 for success or 0 if an error occurs.
179.Sh SEE ALSO
180.Xr crypto 3 ,
181.Xr d2i_X509 3 ,
182.Xr ec 3 ,
183.Xr EC_GFp_simple_method 3 ,
184.Xr EC_GROUP_copy 3 ,
185.Xr EC_GROUP_new 3 ,
186.Xr EC_KEY_new 3 ,
187.Xr EC_POINT_add 3 ,
188.Xr EC_POINT_new 3
diff --git a/src/lib/libcrypto/man/dh.3 b/src/lib/libcrypto/man/dh.3
new file mode 100644
index 0000000000..2a8f172e2b
--- /dev/null
+++ b/src/lib/libcrypto/man/dh.3
@@ -0,0 +1,148 @@
1.Dd $Mdocdate: November 5 2016 $
2.Dt DH 3
3.Os
4.Sh NAME
5.Nm dh
6.Nd Diffie-Hellman key agreement
7.Sh SYNOPSIS
8.In openssl/dh.h
9.In openssl/engine.h
10.Ft DH *
11.Fn DH_new void
12.Ft void
13.Fo DH_free
14.Fa "DH *dh"
15.Fc
16.Ft int
17.Fo DH_size
18.Fa "const DH *dh"
19.Fc
20.Ft DH *
21.Fo DH_generate_parameters
22.Fa "int prime_len"
23.Fa "int generator"
24.Fa "void (*callback)(int, int, void *)"
25.Fa "void *cb_arg"
26.Fc
27.Ft int
28.Fo DH_check
29.Fa "const DH *dh"
30.Fa "int *codes"
31.Fc
32.Ft int
33.Fo DH_generate_key
34.Fa "DH *dh"
35.Fc
36.Ft int
37.Fo DH_compute_key
38.Fa "unsigned char *key"
39.Fa "BIGNUM *pub_key"
40.Fa "DH *dh"
41.Fc
42.Ft void
43.Fo DH_set_default_method
44.Fa "const DH_METHOD *meth"
45.Fc
46.Ft const DH_METHOD *
47.Fn DH_get_default_method void
48.Ft int
49.Fo DH_set_method
50.Fa "DH *dh"
51.Fa "const DH_METHOD *meth"
52.Fc
53.Ft DH *
54.Fo DH_new_method
55.Fa "ENGINE *engine"
56.Fc
57.Ft const DH_METHOD *
58.Fn DH_OpenSSL void
59.Ft int
60.Fo DH_get_ex_new_index
61.Fa "long argl"
62.Fa "char *argp"
63.Fa "int (*new_func)()"
64.Fa "int (*dup_func)()"
65.Fa "void (*free_func)()"
66.Fc
67.Ft int
68.Fo DH_set_ex_data
69.Fa "DH *d"
70.Fa "int idx"
71.Fa "char *arg"
72.Fc
73.Ft char *
74.Fo DH_get_ex_data
75.Fa "DH *d"
76.Fa "int idx"
77.Fc
78.Ft DH *
79.Fo d2i_DHparams
80.Fa "DH **a"
81.Fa "unsigned char **pp"
82.Fa "long length"
83.Fc
84.Ft int
85.Fo i2d_DHparams
86.Fa "const DH *a"
87.Fa "unsigned char **pp"
88.Fc
89.Ft int
90.Fo DHparams_print_fp
91.Fa "FILE *fp"
92.Fa "const DH *x"
93.Fc
94.Ft int
95.Fo DHparams_print
96.Fa "BIO *bp"
97.Fa "const DH *x"
98.Fc
99.Sh DESCRIPTION
100These functions implement the Diffie-Hellman key agreement protocol.
101The generation of shared DH parameters is described in
102.Xr DH_generate_parameters 3 ;
103.Xr DH_generate_key 3
104describes how to perform a key agreement.
105.Pp
106The
107.Vt DH
108structure consists of several
109.Vt BIGNUM
110components.
111.Bd -literal
112typedef struct {
113 BIGNUM *p; // prime number (shared)
114 BIGNUM *g; // generator of Z_p (shared)
115 BIGNUM *priv_key; // private DH value x
116 BIGNUM *pub_key; // public DH value g^x
117 // ...
118} DH;
119.Ed
120.Pp
121Note that DH keys may use non-standard
122.Vt DH_METHOD
123implementations, either directly or by the use of
124.Vt ENGINE
125modules.
126In some cases (eg. an
127.Vt ENGINE
128providing support for hardware-embedded keys), these
129.Vt BIGNUM
130values will not be used by the implementation or may be used for
131alternative data storage.
132For this reason, applications should generally avoid using
133.Vt DH
134structure elements directly and instead use API functions to query
135or modify keys.
136.Sh SEE ALSO
137.Xr bn 3 ,
138.Xr d2i_DHparams 3 ,
139.Xr DH_compute_key 3 ,
140.Xr DH_generate_parameters 3 ,
141.Xr DH_get_ex_new_index 3 ,
142.Xr DH_new 3 ,
143.Xr DH_set_method 3 ,
144.Xr dsa 3 ,
145.Xr engine 3 ,
146.Xr ERR 3 ,
147.Xr rsa 3 ,
148.Xr RSA_print 3
diff --git a/src/lib/libcrypto/man/dsa.3 b/src/lib/libcrypto/man/dsa.3
new file mode 100644
index 0000000000..b374f18d27
--- /dev/null
+++ b/src/lib/libcrypto/man/dsa.3
@@ -0,0 +1,244 @@
1.Dd $Mdocdate: November 5 2016 $
2.Dt DSA 3
3.Os
4.Sh NAME
5.Nm dsa
6.Nd Digital Signature Algorithm
7.Sh SYNOPSIS
8.In openssl/dsa.h
9.In openssl/engine.h
10.Ft DSA *
11.Fn DSA_new void
12.Ft void
13.Fo DSA_free
14.Fa "DSA *dsa"
15.Fc
16.Ft int
17.Fo DSA_size
18.Fa "const DSA *dsa"
19.Fc
20.Ft DSA *
21.Fo DSA_generate_parameters
22.Fa "int bits"
23.Fa "unsigned char *seed"
24.Fa "int seed_len"
25.Fa "int *counter_ret"
26.Fa "unsigned long *h_ret"
27.Fa "void (*callback)(int, int, void *)"
28.Fa "void *cb_arg"
29.Fc
30.Ft DH *
31.Fo DSA_dup_DH
32.Fa "const DSA *r"
33.Fc
34.Ft int
35.Fo DSA_generate_key
36.Fa "DSA *dsa"
37.Fc
38.Ft int
39.Fo DSA_sign
40.Fa "int dummy"
41.Fa "const unsigned char *dgst"
42.Fa "int len"
43.Fa "unsigned char *sigret"
44.Fa "unsigned int *siglen"
45.Fa "DSA *dsa"
46.Fc
47.Ft int
48.Fo DSA_sign_setup
49.Fa "DSA *dsa"
50.Fa "BN_CTX *ctx"
51.Fa "BIGNUM **kinvp"
52.Fa "BIGNUM **rp"
53.Fc
54.Ft int
55.Fo DSA_verify
56.Fa "int dummy"
57.Fa "const unsigned char *dgst"
58.Fa "int len"
59.Fa "const unsigned char *sigbuf"
60.Fa "int siglen"
61.Fa "DSA *dsa"
62.Fc
63.Ft void
64.Fo DSA_set_default_method
65.Fa "const DSA_METHOD *meth"
66.Fc
67.Ft const DSA_METHOD *
68.Fn DSA_get_default_method void
69.Ft int
70.Fo DSA_set_method
71.Fa "DSA *dsa"
72.Fa "const DSA_METHOD *meth"
73.Fc
74.Ft DSA *
75.Fo DSA_new_method
76.Fa "ENGINE *engine"
77.Fc
78.Ft const DSA_METHOD *
79.Fn DSA_OpenSSL void
80.Ft int
81.Fo DSA_get_ex_new_index
82.Fa "long argl"
83.Fa "char *argp"
84.Fa "int (*new_func)()"
85.Fa "int (*dup_func)()"
86.Fa "void (*free_func)()"
87.Fc
88.Ft int
89.Fo DSA_set_ex_data
90.Fa "DSA *d"
91.Fa "int idx"
92.Fa "char *arg"
93.Fc
94.Ft char *
95.Fo DSA_get_ex_data
96.Fa "DSA *d"
97.Fa "int idx"
98.Fc
99.Ft DSA_SIG *
100.Fn DSA_SIG_new void
101.Ft void
102.Fo DSA_SIG_free
103.Fa "DSA_SIG *a"
104.Fc
105.Ft int
106.Fo i2d_DSA_SIG
107.Fa "const DSA_SIG *a"
108.Fa "unsigned char **pp"
109.Fc
110.Ft DSA_SIG *
111.Fo d2i_DSA_SIG
112.Fa "DSA_SIG **v"
113.Fa "unsigned char **pp"
114.Fa "long length"
115.Fc
116.Ft DSA_SIG *
117.Fo DSA_do_sign
118.Fa "const unsigned char *dgst"
119.Fa "int dlen"
120.Fa "DSA *dsa"
121.Fc
122.Ft int
123.Fo DSA_do_verify
124.Fa "const unsigned char *dgst"
125.Fa "int dgst_len"
126.Fa "DSA_SIG *sig"
127.Fa "DSA *dsa"
128.Fc
129.Ft DSA *
130.Fo d2i_DSAPublicKey
131.Fa "DSA **a"
132.Fa "unsigned char **pp"
133.Fa "long length"
134.Fc
135.Ft DSA *
136.Fo d2i_DSAPrivateKey
137.Fa "DSA **a"
138.Fa "unsigned char **pp"
139.Fa "long length"
140.Fc
141.Ft DSA *
142.Fo d2i_DSAparams
143.Fa "DSA **a"
144.Fa "unsigned char **pp"
145.Fa "long length"
146.Fc
147.Ft int
148.Fo i2d_DSAPublicKey
149.Fa "const DSA *a"
150.Fa "unsigned char **pp"
151.Fc
152.Ft int
153.Fo i2d_DSAPrivateKey
154.Fa "const DSA *a"
155.Fa "unsigned char **pp"
156.Fc
157.Ft int
158.Fo i2d_DSAparams
159.Fa "const DSA *a"
160.Fa "unsigned char **pp"
161.Fc
162.Ft int
163.Fo DSAparams_print
164.Fa "BIO *bp"
165.Fa "const DSA *x"
166.Fc
167.Ft int
168.Fo DSAparams_print_fp
169.Fa "FILE *fp"
170.Fa "const DSA *x"
171.Fc
172.Ft int
173.Fo DSA_print
174.Fa "BIO *bp"
175.Fa "const DSA *x"
176.Fa "int off"
177.Fc
178.Ft int
179.Fo DSA_print_fp
180.Fa "FILE *bp"
181.Fa "const DSA *x"
182.Fa "int off"
183.Fc
184.Sh DESCRIPTION
185These functions implement the Digital Signature Algorithm (DSA).
186The generation of shared DSA parameters is described in
187.Xr DSA_generate_parameters 3 ;
188.Xr DSA_generate_key 3
189describes how to generate a signature key.
190Signature generation and verification are described in
191.Xr DSA_sign 3 .
192.Pp
193The
194.Vt DSA
195structure consists of several BIGNUM components.
196.Bd -literal
197typedef struct {
198 BIGNUM *p; // prime number (public)
199 BIGNUM *q; // 160-bit subprime, q | p-1 (public)
200 BIGNUM *g; // generator of subgroup (public)
201 BIGNUM *priv_key; // private key x
202 BIGNUM *pub_key; // public key y = g^x
203 // ...
204} DSA;
205.Ed
206.Pp
207In public keys,
208.Fa priv_key
209is
210.Dv NULL .
211.Pp
212Note that DSA keys may use non-standard
213.Vt DSA_METHOD
214implementations, either directly or by the use of
215.Vt ENGINE
216modules.
217In some cases (eg. an
218.Vt ENGINE
219providing support for hardware-embedded keys), these
220.Vt BIGNUM
221values will not be used by the implementation or may be used for
222alternative data storage.
223For this reason, applications should generally avoid using
224.Vt DSA
225structure elements directly and instead use API functions to query
226or modify keys.
227.Sh SEE ALSO
228.Xr bn 3 ,
229.Xr dh 3 ,
230.Xr DSA_dup_DH 3 ,
231.Xr DSA_generate_key 3 ,
232.Xr DSA_generate_parameters 3 ,
233.Xr DSA_get_ex_new_index 3 ,
234.Xr DSA_new 3 ,
235.Xr DSA_set_method 3 ,
236.Xr DSA_sign 3 ,
237.Xr DSA_size 3 ,
238.Xr engine 3 ,
239.Xr err 3 ,
240.Xr rsa 3 ,
241.Xr RSA_print 3
242.Sh STANDARDS
243US Federal Information Processing Standard FIPS 186 (Digital Signature
244Standard, DSS), ANSI X9.30
diff --git a/src/lib/libcrypto/man/ec.3 b/src/lib/libcrypto/man/ec.3
new file mode 100644
index 0000000000..3ecdd5dd8d
--- /dev/null
+++ b/src/lib/libcrypto/man/ec.3
@@ -0,0 +1,710 @@
1.Dd $Mdocdate: November 5 2016 $
2.Dt EC 3
3.Os
4.Sh NAME
5.Nm ec
6.Nd Elliptic Curve functions
7.Sh SYNOPSIS
8.In openssl/ec.h
9.In openssl/bn.h
10.Ft const EC_METHOD *
11.Fn EC_GFp_simple_method void
12.Ft const EC_METHOD *
13.Fn EC_GFp_mont_method void
14.Ft const EC_METHOD *
15.Fn EC_GFp_nist_method void
16.Ft const EC_METHOD *
17.Fn EC_GFp_nistp224_method void
18.Ft const EC_METHOD *
19.Fn EC_GFp_nistp256_method void
20.Ft const EC_METHOD *
21.Fn EC_GFp_nistp521_method void
22.Ft const EC_METHOD *
23.Fn EC_GF2m_simple_method void
24.Ft EC_GROUP *
25.Fo EC_GROUP_new
26.Fa "const EC_METHOD *meth"
27.Fc
28.Ft void
29.Fo EC_GROUP_free
30.Fa "EC_GROUP *group"
31.Fc
32.Ft void
33.Fo EC_GROUP_clear_free
34.Fa "EC_GROUP *group"
35.Fc
36.Ft int
37.Fo EC_GROUP_copy
38.Fa "EC_GROUP *dst"
39.Fa "const EC_GROUP *src"
40.Fc
41.Ft EC_GROUP *
42.Fo EC_GROUP_dup
43.Fa "const EC_GROUP *src"
44.Fc
45.Ft const EC_METHOD *
46.Fo EC_GROUP_method_of
47.Fa "const EC_GROUP *group"
48.Fc
49.Ft int
50.Fo EC_METHOD_get_field_type
51.Fa "const EC_METHOD *meth"
52.Fc
53.Ft int
54.Fo EC_GROUP_set_generator
55.Fa "EC_GROUP *group"
56.Fa "const EC_POINT *generator"
57.Fa "const BIGNUM *order"
58.Fa "const BIGNUM *cofactor"
59.Fc
60.Ft const EC_POINT *
61.Fo EC_GROUP_get0_generator
62.Fa "const EC_GROUP *group"
63.Fc
64.Ft int
65.Fo EC_GROUP_get_order
66.Fa "const EC_GROUP *group"
67.Fa "BIGNUM *order"
68.Fa "BN_CTX *ctx"
69.Fc
70.Ft int
71.Fo EC_GROUP_get_cofactor
72.Fa "const EC_GROUP *group"
73.Fa "BIGNUM *cofactor"
74.Fa "BN_CTX *ctx"
75.Fc
76.Ft void
77.Fo EC_GROUP_set_curve_name
78.Fa "EC_GROUP *group"
79.Fa "int nid"
80.Fc
81.Ft int
82.Fo EC_GROUP_get_curve_name
83.Fa "const EC_GROUP *group"
84.Fc
85.Ft void
86.Fo EC_GROUP_set_asn1_flag
87.Fa "EC_GROUP *group"
88.Fa "int flag"
89.Fc
90.Ft int
91.Fo EC_GROUP_get_asn1_flag
92.Fa "const EC_GROUP *group"
93.Fc
94.Ft void
95.Fo EC_GROUP_set_point_conversion_form
96.Fa "EC_GROUP *group"
97.Fa "point_conversion_form_t form"
98.Fc
99.Ft point_conversion_form_t
100.Fo EC_GROUP_get_point_conversion_form
101.Fa "const EC_GROUP *"
102.Fc
103.Ft unsigned char *
104.Fo EC_GROUP_get0_seed
105.Fa "const EC_GROUP *x"
106.Fc
107.Ft size_t
108.Fo EC_GROUP_get_seed_len
109.Fa "const EC_GROUP *"
110.Fc
111.Ft size_t
112.Fo EC_GROUP_set_seed
113.Fa "EC_GROUP *"
114.Fa "const unsigned char *"
115.Fa "size_t len"
116.Fc
117.Ft int
118.Fo EC_GROUP_set_curve_GFp
119.Fa "EC_GROUP *group"
120.Fa "const BIGNUM *p"
121.Fa "const BIGNUM *a"
122.Fa "const BIGNUM *b"
123.Fa "BN_CTX *ctx"
124.Fc
125.Ft int
126.Fo EC_GROUP_get_curve_GFp
127.Fa "const EC_GROUP *group"
128.Fa "BIGNUM *p"
129.Fa "BIGNUM *a"
130.Fa "BIGNUM *b"
131.Fa "BN_CTX *ctx"
132.Fc
133.Ft int
134.Fo EC_GROUP_set_curve_GF2m
135.Fa "EC_GROUP *group"
136.Fa "const BIGNUM *p"
137.Fa "const BIGNUM *a"
138.Fa "const BIGNUM *b"
139.Fa "BN_CTX *ctx"
140.Fc
141.Ft int
142.Fo EC_GROUP_get_curve_GF2m
143.Fa "const EC_GROUP *group"
144.Fa "BIGNUM *p"
145.Fa "BIGNUM *a"
146.Fa "BIGNUM *b"
147.Fa "BN_CTX *ctx"
148.Fc
149.Ft int
150.Fo EC_GROUP_get_degree
151.Fa "const EC_GROUP *group"
152.Fc
153.Ft int
154.Fo EC_GROUP_check
155.Fa "const EC_GROUP *group"
156.Fa "BN_CTX *ctx"
157.Fc
158.Ft int
159.Fo EC_GROUP_check_discriminant
160.Fa "const EC_GROUP *group"
161.Fa "BN_CTX *ctx"
162.Fc
163.Ft int
164.Fo EC_GROUP_cmp
165.Fa "const EC_GROUP *a"
166.Fa "const EC_GROUP *b"
167.Fa "BN_CTX *ctx"
168.Fc
169.Ft EC_GROUP *
170.Fo EC_GROUP_new_curve_GFp
171.Fa "const BIGNUM *p"
172.Fa "const BIGNUM *a"
173.Fa "const BIGNUM *b"
174.Fa "BN_CTX *ctx"
175.Fc
176.Ft EC_GROUP *
177.Fo EC_GROUP_new_curve_GF2m
178.Fa "const BIGNUM *p"
179.Fa "const BIGNUM *a"
180.Fa "const BIGNUM *b"
181.Fa "BN_CTX *ctx"
182.Fc
183.Ft EC_GROUP *
184.Fo EC_GROUP_new_by_curve_name
185.Fa "int nid"
186.Fc
187.Ft size_t
188.Fo EC_get_builtin_curves
189.Fa "EC_builtin_curve *r"
190.Fa "size_t nitems"
191.Fc
192.Ft EC_POINT *
193.Fo EC_POINT_new
194.Fa "const EC_GROUP *group"
195.Fc
196.Ft void
197.Fo EC_POINT_free
198.Fa "EC_POINT *point"
199.Fc
200.Ft void
201.Fo EC_POINT_clear_free
202.Fa "EC_POINT *point"
203.Fc
204.Ft int
205.Fo EC_POINT_copy
206.Fa "EC_POINT *dst"
207.Fa "const EC_POINT *src"
208.Fc
209.Ft EC_POINT *
210.Fo EC_POINT_dup
211.Fa "const EC_POINT *src"
212.Fa "const EC_GROUP *group"
213.Fc
214.Ft const EC_METHOD *
215.Fo EC_POINT_method_of
216.Fa "const EC_POINT *point"
217.Fc
218.Ft int
219.Fo EC_POINT_set_to_infinity
220.Fa "const EC_GROUP *group"
221.Fa "EC_POINT *point"
222.Fc
223.Ft int
224.Fo EC_POINT_set_Jprojective_coordinates_GFp
225.Fa "const EC_GROUP *group"
226.Fa "EC_POINT *p"
227.Fa "const BIGNUM *x"
228.Fa "const BIGNUM *y"
229.Fa "const BIGNUM *z"
230.Fa "BN_CTX *ctx"
231.Fc
232.Ft int
233.Fo EC_POINT_get_Jprojective_coordinates_GFp
234.Fa "const EC_GROUP *group"
235.Fa "const EC_POINT *p"
236.Fa "BIGNUM *x"
237.Fa "BIGNUM *y"
238.Fa "BIGNUM *z"
239.Fa "BN_CTX *ctx"
240.Fc
241.Ft int
242.Fo EC_POINT_set_affine_coordinates_GFp
243.Fa "const EC_GROUP *group"
244.Fa "EC_POINT *p"
245.Fa "const BIGNUM *x"
246.Fa "const BIGNUM *y"
247.Fa "BN_CTX *ctx"
248.Fc
249.Ft int
250.Fo EC_POINT_get_affine_coordinates_GFp
251.Fa "const EC_GROUP *group"
252.Fa "const EC_POINT *p"
253.Fa "BIGNUM *x"
254.Fa "BIGNUM *y"
255.Fa "BN_CTX *ctx"
256.Fc
257.Ft int
258.Fo EC_POINT_set_compressed_coordinates_GFp
259.Fa "const EC_GROUP *group"
260.Fa "EC_POINT *p"
261.Fa "const BIGNUM *x"
262.Fa "int y_bit"
263.Fa "BN_CTX *ctx"
264.Fc
265.Ft int
266.Fo EC_POINT_set_affine_coordinates_GF2m
267.Fa "const EC_GROUP *group"
268.Fa "EC_POINT *p"
269.Fa "const BIGNUM *x"
270.Fa "const BIGNUM *y"
271.Fa "BN_CTX *ctx"
272.Fc
273.Ft int
274.Fo EC_POINT_get_affine_coordinates_GF2m
275.Fa "const EC_GROUP *group"
276.Fa "const EC_POINT *p"
277.Fa "BIGNUM *x"
278.Fa "BIGNUM *y"
279.Fa "BN_CTX *ctx"
280.Fc
281.Ft int
282.Fo EC_POINT_set_compressed_coordinates_GF2m
283.Fa "const EC_GROUP *group"
284.Fa "EC_POINT *p"
285.Fa "const BIGNUM *x"
286.Fa "int y_bit"
287.Fa "BN_CTX *ctx"
288.Fc
289.Ft size_t
290.Fo EC_POINT_point2oct
291.Fa "const EC_GROUP *group"
292.Fa "const EC_POINT *p"
293.Fa "point_conversion_form_t form"
294.Fa "unsigned char *buf"
295.Fa "size_t len"
296.Fa "BN_CTX *ctx"
297.Fc
298.Ft int
299.Fo EC_POINT_oct2point
300.Fa "const EC_GROUP *group"
301.Fa "EC_POINT *p"
302.Fa "const unsigned char *buf"
303.Fa "size_t len"
304.Fa "BN_CTX *ctx"
305.Fc
306.Ft BIGNUM *
307.Fo EC_POINT_point2bn
308.Fa "const EC_GROUP *"
309.Fa "const EC_POINT *"
310.Fa "point_conversion_form_t form"
311.Fa "BIGNUM *"
312.Fa "BN_CTX *"
313.Fc
314.Ft EC_POINT *
315.Fo EC_POINT_bn2point
316.Fa "const EC_GROUP *"
317.Fa "const BIGNUM *"
318.Fa "EC_POINT *"
319.Fa "BN_CTX *"
320.Fc
321.Ft char *
322.Fo EC_POINT_point2hex
323.Fa "const EC_GROUP *"
324.Fa "const EC_POINT *"
325.Fa "point_conversion_form_t form"
326.Fa "BN_CTX *"
327.Fc
328.Ft EC_POINT *
329.Fo EC_POINT_hex2point
330.Fa "const EC_GROUP *"
331.Fa "const char *"
332.Fa "EC_POINT *"
333.Fa "BN_CTX *"
334.Fc
335.Ft int
336.Fo EC_POINT_add
337.Fa "const EC_GROUP *group"
338.Fa "EC_POINT *r"
339.Fa "const EC_POINT *a"
340.Fa "const EC_POINT *b"
341.Fa "BN_CTX *ctx"
342.Fc
343.Ft int
344.Fo EC_POINT_dbl
345.Fa "const EC_GROUP *group"
346.Fa "EC_POINT *r"
347.Fa "const EC_POINT *a"
348.Fa "BN_CTX *ctx"
349.Fc
350.Ft int
351.Fo EC_POINT_invert
352.Fa "const EC_GROUP *group"
353.Fa "EC_POINT *a"
354.Fa "BN_CTX *ctx"
355.Fc
356.Ft int
357.Fo EC_POINT_is_at_infinity
358.Fa "const EC_GROUP *group"
359.Fa "const EC_POINT *p"
360.Fc
361.Ft int
362.Fo EC_POINT_is_on_curve
363.Fa "const EC_GROUP *group"
364.Fa "const EC_POINT *point"
365.Fa "BN_CTX *ctx"
366.Fc
367.Ft int
368.Fo EC_POINT_cmp
369.Fa "const EC_GROUP *group"
370.Fa "const EC_POINT *a"
371.Fa "const EC_POINT *b"
372.Fa "BN_CTX *ctx"
373.Fc
374.Ft int
375.Fo EC_POINT_make_affine
376.Fa "const EC_GROUP *group"
377.Fa "EC_POINT *point"
378.Fa "BN_CTX *ctx"
379.Fc
380.Ft int
381.Fo EC_POINTs_make_affine
382.Fa "const EC_GROUP *group"
383.Fa "size_t num"
384.Fa "EC_POINT *points[]"
385.Fa "BN_CTX *ctx"
386.Fc
387.Ft int
388.Fo EC_POINTs_mul
389.Fa "const EC_GROUP *group"
390.Fa "EC_POINT *r"
391.Fa "const BIGNUM *n"
392.Fa "size_t num"
393.Fa "const EC_POINT *p[]"
394.Fa "const BIGNUM *m[]"
395.Fa "BN_CTX *ctx"
396.Fc
397.Ft int
398.Fo EC_POINT_mul
399.Fa "const EC_GROUP *group"
400.Fa "EC_POINT *r"
401.Fa "const BIGNUM *n"
402.Fa "const EC_POINT *q"
403.Fa "const BIGNUM *m"
404.Fa "BN_CTX *ctx"
405.Fc
406.Ft int
407.Fo EC_GROUP_precompute_mult
408.Fa "EC_GROUP *group"
409.Fa "BN_CTX *ctx"
410.Fc
411.Ft int
412.Fo EC_GROUP_have_precompute_mult
413.Fa "const EC_GROUP *group"
414.Fc
415.Ft int
416.Fo EC_GROUP_get_basis_type
417.Fa "const EC_GROUP *"
418.Fc
419.Ft int
420.Fo EC_GROUP_get_trinomial_basis
421.Fa "const EC_GROUP *"
422.Fa "unsigned int *k"
423.Fc
424.Ft int
425.Fo EC_GROUP_get_pentanomial_basis
426.Fa "const EC_GROUP *"
427.Fa "unsigned int *k1"
428.Fa "unsigned int *k2"
429.Fa "unsigned int *k3"
430.Fc
431.Ft EC_GROUP *
432.Fo d2i_ECPKParameters
433.Fa "EC_GROUP **"
434.Fa "const unsigned char **in"
435.Fa "long len"
436.Fc
437.Ft int
438.Fo i2d_ECPKParameters
439.Fa "const EC_GROUP *"
440.Fa "unsigned char **out"
441.Fc
442.Fd #define d2i_ECPKParameters_bio(bp,x)\
443 ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x)
444.Fd #define i2d_ECPKParameters_bio(bp,x)\
445 ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x)
446.Fd #define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL,\
447 (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x))
448.Fd #define i2d_ECPKParameters_fp(fp,x)\
449 ASN1_i2d_fp(i2d_ECPKParameters,(fp), (unsigned char *)(x))
450.Ft int
451.Fo ECPKParameters_print
452.Fa "BIO *bp"
453.Fa "const EC_GROUP *x"
454.Fa "int off"
455.Fc
456.Ft int
457.Fo ECPKParameters_print_fp
458.Fa "FILE *fp"
459.Fa "const EC_GROUP *x"
460.Fa "int off"
461.Fc
462.Ft EC_KEY *
463.Fn EC_KEY_new void
464.Ft int
465.Fo EC_KEY_get_flags
466.Fa "const EC_KEY *key"
467.Fc
468.Ft void
469.Fo EC_KEY_set_flags
470.Fa "EC_KEY *key"
471.Fa "int flags"
472.Fc
473.Ft void
474.Fo EC_KEY_clear_flags
475.Fa "EC_KEY *key"
476.Fa "int flags"
477.Fc
478.Ft EC_KEY *
479.Fo EC_KEY_new_by_curve_name
480.Fa "int nid"
481.Fc
482.Ft void
483.Fo EC_KEY_free
484.Fa "EC_KEY *key"
485.Fc
486.Ft EC_KEY *
487.Fo EC_KEY_copy
488.Fa "EC_KEY *dst"
489.Fa "const EC_KEY *src"
490.Fc
491.Ft EC_KEY *
492.Fo EC_KEY_dup
493.Fa "const EC_KEY *src"
494.Fc
495.Ft int
496.Fo EC_KEY_up_ref
497.Fa "EC_KEY *key"
498.Fc
499.Ft const EC_GROUP *
500.Fo EC_KEY_get0_group
501.Fa "const EC_KEY *key"
502.Fc
503.Ft int
504.Fo EC_KEY_set_group
505.Fa "EC_KEY *key"
506.Fa "const EC_GROUP *group"
507.Fc
508.Ft const BIGNUM *
509.Fo EC_KEY_get0_private_key
510.Fa "const EC_KEY *key"
511.Fc
512.Ft int
513.Fo EC_KEY_set_private_key
514.Fa "EC_KEY *key"
515.Fa "const BIGNUM *prv"
516.Fc
517.Ft const EC_POINT *
518.Fo EC_KEY_get0_public_key
519.Fa "const EC_KEY *key"
520.Fc
521.Ft int
522.Fo EC_KEY_set_public_key
523.Fa "EC_KEY *key"
524.Fa "const EC_POINT *pub"
525.Fc
526.Ft unsigned
527.Fo EC_KEY_get_enc_flags
528.Fa "const EC_KEY *key"
529.Fc
530.Ft void
531.Fo EC_KEY_set_enc_flags
532.Fa "EC_KEY *eckey"
533.Fa "unsigned int flags"
534.Fc
535.Ft point_conversion_form_t
536.Fo EC_KEY_get_conv_form
537.Fa "const EC_KEY *key"
538.Fc
539.Ft void
540.Fo EC_KEY_set_conv_form
541.Fa "EC_KEY *eckey"
542.Fa "point_conversion_form_t cform"
543.Fc
544.Ft void *
545.Fo EC_KEY_get_key_method_data
546.Fa "EC_KEY *key"
547.Fa "void *(*dup_func)(void *)"
548.Fa "void (*free_func)(void *)"
549.Fa "void (*clear_free_func)(void *)"
550.Fc
551.Ft void
552.Fo EC_KEY_insert_key_method_data
553.Fa "EC_KEY *key"
554.Fa "void *data"
555.Fa "void *(*dup_func)(void *)"
556.Fa "void (*free_func)(void *)"
557.Fa "void (*clear_free_func)(void *)"
558.Fc
559.Ft void
560.Fo EC_KEY_set_asn1_flag
561.Fa "EC_KEY *eckey"
562.Fa "int asn1_flag"
563.Fc
564.Ft int
565.Fo EC_KEY_precompute_mult
566.Fa "EC_KEY *key"
567.Fa "BN_CTX *ctx"
568.Fc
569.Ft int
570.Fo EC_KEY_generate_key
571.Fa "EC_KEY *key"
572.Fc
573.Ft int
574.Fo EC_KEY_check_key
575.Fa "const EC_KEY *key"
576.Fc
577.Ft int
578.Fo EC_KEY_set_public_key_affine_coordinates
579.Fa "EC_KEY *key"
580.Fa "BIGNUM *x"
581.Fa "BIGNUM *y"
582.Fc
583.Ft EC_KEY *
584.Fo d2i_ECPrivateKey
585.Fa "EC_KEY **key"
586.Fa "const unsigned char **in"
587.Fa "long len"
588.Fc
589.Ft int
590.Fo i2d_ECPrivateKey
591.Fa "EC_KEY *key"
592.Fa "unsigned char **out"
593.Fc
594.Ft EC_KEY *
595.Fo d2i_ECParameters
596.Fa "EC_KEY **key"
597.Fa "const unsigned char **in"
598.Fa "long len"
599.Fc
600.Ft int
601.Fo i2d_ECParameters
602.Fa "EC_KEY *key"
603.Fa "unsigned char **out"
604.Fc
605.Ft EC_KEY *
606.Fo o2i_ECPublicKey
607.Fa "EC_KEY **key"
608.Fa "const unsigned char **in"
609.Fa "long len"
610.Fc
611.Ft int
612.Fo i2o_ECPublicKey
613.Fa "EC_KEY *key"
614.Fa "unsigned char **out"
615.Fc
616.Ft int
617.Fo ECParameters_print
618.Fa "BIO *bp"
619.Fa "const EC_KEY *key"
620.Fc
621.Ft int
622.Fo EC_KEY_print
623.Fa "BIO *bp"
624.Fa "const EC_KEY *key"
625.Fa "int off"
626.Fc
627.Ft int
628.Fo ECParameters_print_fp
629.Fa "FILE *fp"
630.Fa "const EC_KEY *key"
631.Fc
632.Ft int
633.Fo EC_KEY_print_fp
634.Fa "FILE *fp"
635.Fa "const EC_KEY *key"
636.Fa "int off"
637.Fc
638.Ft EC_KEY *
639.Fo ECParameters_dup
640.Fa "EC_KEY *key"
641.Fc
642.Fd #define EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx, nid)\
643 EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_EC, EVP_PKEY_OP_PARAMGEN,\
644 EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID, nid, NULL)
645.Sh DESCRIPTION
646This library provides an extensive set of functions for performing
647operations on elliptic curves over finite fields.
648In general an elliptic curve is one with an equation of the form:
649.Pp
650.Dl y^2 = x^3 + ax + b
651.Pp
652An
653.Vt EC_GROUP
654structure is used to represent the definition of an elliptic curve.
655Points on a curve are stored using an
656.Vt EC_POINT
657structure.
658An
659.Vt EC_KEY
660is used to hold a private/public key pair, where a private key is simply a
661.Vt BIGNUM
662and a public key is a point on a curve represented by an
663.Vt EC_POINT .
664.Pp
665The library contains a number of alternative implementations of the
666different functions.
667Each implementation is optimised for different scenarios.
668No matter which implementation is being used, the interface remains the
669same.
670The library handles calling the correct implementation when an interface
671function is invoked.
672An implementation is represented by an
673.Vt EC_METHOD
674structure.
675.Pp
676The creation and destruction of
677.Vt EC_GROUP
678objects is described in
679.Xr EC_GROUP_new 3 .
680Functions for manipulating
681.Vt EC_GROUP
682objects are described in
683.Xr EC_GROUP_copy 3 .
684.Pp
685Functions for creating, destroying and manipulating
686.Vt EC_POINT
687objects are explained in
688.Xr EC_POINT_new 3 ,
689whilst functions for performing mathematical operations and tests on
690.Vt EC_POINT Ns s
691are coverd in
692.Xr EC_POINT_add 3 .
693.Pp
694For working with private and public keys refer to
695.Xr EC_KEY_new 3 .
696Implementations are covered in
697.Xr EC_GFp_simple_method 3 .
698.Pp
699For information on encoding and decoding curve parameters to and
700from ASN.1 see
701.Xr d2i_ECPKParameters 3 .
702.Sh SEE ALSO
703.Xr crypto 3 ,
704.Xr d2i_ECPKParameters 3 ,
705.Xr EC_GFp_simple_method 3 ,
706.Xr EC_GROUP_copy 3 ,
707.Xr EC_GROUP_new 3 ,
708.Xr EC_KEY_new 3 ,
709.Xr EC_POINT_add 3 ,
710.Xr EC_POINT_new 3
diff --git a/src/lib/libcrypto/man/engine.3 b/src/lib/libcrypto/man/engine.3
new file mode 100644
index 0000000000..3624fa76e4
--- /dev/null
+++ b/src/lib/libcrypto/man/engine.3
@@ -0,0 +1,1187 @@
1.Dd $Mdocdate: November 5 2016 $
2.Dt ENGINE 3
3.Os
4.Sh NAME
5.Nm ENGINE_add ,
6.Nm ENGINE_by_id ,
7.Nm ENGINE_finish ,
8.Nm ENGINE_get_first ,
9.Nm ENGINE_get_last ,
10.Nm ENGINE_get_next ,
11.Nm ENGINE_get_prev ,
12.Nm ENGINE_init ,
13.Nm ENGINE_load_builtin_engines ,
14.Nm ENGINE_remove
15.Nd ENGINE cryptographic module support
16.Sh SYNOPSIS
17.In openssl/engine.h
18.Ft ENGINE *
19.Fn ENGINE_get_first void
20.Ft ENGINE *
21.Fn ENGINE_get_last void
22.Ft ENGINE *
23.Fo ENGINE_get_next
24.Fa "ENGINE *e"
25.Fc
26.Ft ENGINE *
27.Fo ENGINE_get_prev
28.Fa "ENGINE *e"
29.Fc
30.Ft int
31.Fo ENGINE_add
32.Fa "ENGINE *e"
33.Fc
34.Ft int
35.Fo ENGINE_remove
36.Fa "ENGINE *e"
37.Fc
38.Ft ENGINE *
39.Fo ENGINE_by_id
40.Fa "const char *id"
41.Fc
42.Ft int
43.Fo ENGINE_init
44.Fa "ENGINE *e"
45.Fc
46.Ft int
47.Fo ENGINE_finish
48.Fa "ENGINE *e"
49.Fc
50.Ft void
51.Fn ENGINE_load_openssl void
52.Ft void
53.Fn ENGINE_load_dynamic void
54.Ft void
55.Fn ENGINE_load_cryptodev void
56.Ft void
57.Fn ENGINE_load_builtin_engines void
58.Ft void
59.Fn ENGINE_cleanup void
60.Ft ENGINE *
61.Fn ENGINE_get_default_RSA void
62.Ft ENGINE *
63.Fn ENGINE_get_default_DSA void
64.Ft ENGINE *
65.Fn ENGINE_get_default_ECDH void
66.Ft ENGINE *
67.Fn ENGINE_get_default_ECDSA void
68.Ft ENGINE *
69.Fn ENGINE_get_default_DH void
70.Ft ENGINE *
71.Fn ENGINE_get_default_RAND void
72.Ft ENGINE *
73.Fo ENGINE_get_cipher_engine
74.Fa "int nid"
75.Fc
76.Ft ENGINE *
77.Fo ENGINE_get_digest_engine
78.Fa "int nid"
79.Fc
80.Ft int
81.Fo ENGINE_set_default_RSA
82.Fa "ENGINE *e"
83.Fc
84.Ft int
85.Fo ENGINE_set_default_DSA
86.Fa "ENGINE *e"
87.Fc
88.Ft int
89.Fo ENGINE_set_default_ECDH
90.Fa "ENGINE *e"
91.Fc
92.Ft int
93.Fo ENGINE_set_default_ECDSA
94.Fa "ENGINE *e"
95.Fc
96.Ft int
97.Fo ENGINE_set_default_DH
98.Fa "ENGINE *e"
99.Fc
100.Ft int
101.Fo ENGINE_set_default_RAND
102.Fa "ENGINE *e"
103.Fc
104.Ft int
105.Fo ENGINE_set_default_ciphers
106.Fa "ENGINE *e"
107.Fc
108.Ft int
109.Fo ENGINE_set_default_digests
110.Fa "ENGINE *e"
111.Fc
112.Ft int
113.Fo ENGINE_set_default_string
114.Fa "ENGINE *e"
115.Fa "const char *list"
116.Fc
117.Ft int
118.Fo ENGINE_set_default
119.Fa "ENGINE *e"
120.Fa "unsigned int flags"
121.Fc
122.Ft unsigned int
123.Fn ENGINE_get_table_flags void
124.Ft void
125.Fo ENGINE_set_table_flags
126.Fa "unsigned int flags"
127.Fc
128.Ft int
129.Fo ENGINE_register_RSA
130.Fa "ENGINE *e"
131.Fc
132.Ft void
133.Fo ENGINE_unregister_RSA
134.Fa "ENGINE *e"
135.Fc
136.Ft void
137.Fn ENGINE_register_all_RSA void
138.Ft int
139.Fo ENGINE_register_DSA
140.Fa "ENGINE *e"
141.Fc
142.Ft void
143.Fo ENGINE_unregister_DSA
144.Fa "ENGINE *e"
145.Fc
146.Ft void
147.Fn ENGINE_register_all_DSA void
148.Ft int
149.Fo ENGINE_register_ECDH
150.Fa "ENGINE *e"
151.Fc
152.Ft void
153.Fo ENGINE_unregister_ECDH
154.Fa "ENGINE *e"
155.Fc
156.Ft void
157.Fn ENGINE_register_all_ECDH void
158.Ft int
159.Fo ENGINE_register_ECDSA
160.Fa "ENGINE *e"
161.Fc
162.Ft void
163.Fo ENGINE_unregister_ECDSA
164.Fa "ENGINE *e"
165.Fc
166.Ft void
167.Fn ENGINE_register_all_ECDSA void
168.Ft int
169.Fo ENGINE_register_DH
170.Fa "ENGINE *e"
171.Fc
172.Ft void
173.Fo ENGINE_unregister_DH
174.Fa "ENGINE *e"
175.Fc
176.Ft void
177.Fn ENGINE_register_all_DH void
178.Ft int
179.Fo ENGINE_register_RAND
180.Fa "ENGINE *e"
181.Fc
182.Ft void
183.Fo ENGINE_unregister_RAND
184.Fa "ENGINE *e"
185.Fc
186.Ft void
187.Fn ENGINE_register_all_RAND void
188.Ft int
189.Fo ENGINE_register_STORE
190.Fa "ENGINE *e"
191.Fc
192.Ft void
193.Fo ENGINE_unregister_STORE
194.Fa "ENGINE *e"
195.Fc
196.Ft void
197.Fn ENGINE_register_all_STORE void
198.Ft int
199.Fo ENGINE_register_ciphers
200.Fa "ENGINE *e"
201.Fc
202.Ft void
203.Fo ENGINE_unregister_ciphers
204.Fa "ENGINE *e"
205.Fc
206.Ft void
207.Fn ENGINE_register_all_ciphers void
208.Ft int
209.Fo ENGINE_register_digests
210.Fa "ENGINE *e"
211.Fc
212.Ft void
213.Fo ENGINE_unregister_digests
214.Fa "ENGINE *e"
215.Fc
216.Ft void
217.Fn ENGINE_register_all_digests void
218.Ft int
219.Fo ENGINE_register_complete
220.Fa "ENGINE *e"
221.Fc
222.Ft int
223.Fn ENGINE_register_all_complete void
224.Ft int
225.Fo ENGINE_ctrl
226.Fa "ENGINE *e"
227.Fa "int cmd"
228.Fa "long i"
229.Fa "void *p"
230.Fa "void (*f)(void)"
231.Fc
232.Ft int
233.Fo ENGINE_cmd_is_executable
234.Fa "ENGINE *e"
235.Fa "int cmd"
236.Fc
237.Ft int
238.Fo ENGINE_ctrl_cmd
239.Fa "ENGINE *e"
240.Fa "const char *cmd_name"
241.Fa "long i"
242.Fa "void *p"
243.Fa "void (*f)(void)"
244.Fa "int cmd_optional"
245.Fc
246.Ft int
247.Fo ENGINE_ctrl_cmd_string
248.Fa "ENGINE *e"
249.Fa "const char *cmd_name"
250.Fa "const char *arg"
251.Fa "int cmd_optional"
252.Fc
253.Ft int
254.Fo ENGINE_set_ex_data
255.Fa "ENGINE *e"
256.Fa "int idx"
257.Fa "void *arg"
258.Fc
259.Ft void *
260.Fo ENGINE_get_ex_data
261.Fa "const ENGINE *e"
262.Fa "int idx"
263.Fc
264.Ft int
265.Fo ENGINE_get_ex_new_index
266.Fa "long argl"
267.Fa "void *argp"
268.Fa "CRYPTO_EX_new *new_func"
269.Fa "CRYPTO_EX_dup *dup_func"
270.Fa "CRYPTO_EX_free *free_func"
271.Fc
272.Ft ENGINE *
273.Fn ENGINE_new void
274.Ft int
275.Fo ENGINE_free
276.Fa "ENGINE *e"
277.Fc
278.Ft int
279.Fo ENGINE_up_ref
280.Fa "ENGINE *e"
281.Fc
282.Ft int
283.Fo ENGINE_set_id
284.Fa "ENGINE *e"
285.Fa "const char *id"
286.Fc
287.Ft int
288.Fo ENGINE_set_name
289.Fa "ENGINE *e"
290.Fa "const char *name"
291.Fc
292.Ft int
293.Fo ENGINE_set_RSA
294.Fa "ENGINE *e"
295.Fa "const RSA_METHOD *rsa_meth"
296.Fc
297.Ft int
298.Fo ENGINE_set_DSA
299.Fa "ENGINE *e"
300.Fa "const DSA_METHOD *dsa_meth"
301.Fc
302.Ft int
303.Fo ENGINE_set_ECDH
304.Fa "ENGINE *e"
305.Fa "const ECDH_METHOD *dh_meth"
306.Fc
307.Ft int
308.Fo ENGINE_set_ECDSA
309.Fa "ENGINE *e"
310.Fa "const ECDSA_METHOD *dh_meth"
311.Fc
312.Ft int
313.Fo ENGINE_set_DH
314.Fa "ENGINE *e"
315.Fa "const DH_METHOD *dh_meth"
316.Fc
317.Ft int
318.Fo ENGINE_set_RAND
319.Fa "ENGINE *e"
320.Fa "const RAND_METHOD *rand_meth"
321.Fc
322.Ft int
323.Fo ENGINE_set_STORE
324.Fa "ENGINE *e"
325.Fa "const STORE_METHOD *rand_meth"
326.Fc
327.Ft int
328.Fo ENGINE_set_destroy_function
329.Fa "ENGINE *e"
330.Fa "ENGINE_GEN_INT_FUNC_PTR destroy_f"
331.Fc
332.Ft int
333.Fo ENGINE_set_init_function
334.Fa "ENGINE *e"
335.Fa "ENGINE_GEN_INT_FUNC_PTR init_f"
336.Fc
337.Ft int
338.Fo ENGINE_set_finish_function
339.Fa "ENGINE *e"
340.Fa "ENGINE_GEN_INT_FUNC_PTR finish_f"
341.Fc
342.Ft int
343.Fo ENGINE_set_ctrl_function
344.Fa "ENGINE *e"
345.Fa "ENGINE_CTRL_FUNC_PTR ctrl_f"
346.Fc
347.Ft int
348.Fo ENGINE_set_load_privkey_function
349.Fa "ENGINE *e"
350.Fa "ENGINE_LOAD_KEY_PTR loadpriv_f"
351.Fc
352.Ft int
353.Fo ENGINE_set_load_pubkey_function
354.Fa "ENGINE *e"
355.Fa "ENGINE_LOAD_KEY_PTR loadpub_f"
356.Fc
357.Ft int
358.Fo ENGINE_set_ciphers
359.Fa "ENGINE *e"
360.Fa "ENGINE_CIPHERS_PTR f"
361.Fc
362.Ft int
363.Fo ENGINE_set_digests
364.Fa "ENGINE *e"
365.Fa "ENGINE_DIGESTS_PTR f"
366.Fc
367.Ft int
368.Fo ENGINE_set_flags
369.Fa "ENGINE *e"
370.Fa "int flags"
371.Fc
372.Ft int
373.Fo ENGINE_set_cmd_defns
374.Fa "ENGINE *e"
375.Fa "const ENGINE_CMD_DEFN *defns"
376.Fc
377.Ft const char *
378.Fo ENGINE_get_id
379.Fa "const ENGINE *e"
380.Fc
381.Ft const char *
382.Fo ENGINE_get_name
383.Fa "const ENGINE *e"
384.Fc
385.Ft const RSA_METHOD *
386.Fo ENGINE_get_RSA
387.Fa "const ENGINE *e"
388.Fc
389.Ft const DSA_METHOD *
390.Fo ENGINE_get_DSA
391.Fa "const ENGINE *e"
392.Fc
393.Ft const ECDH_METHOD *
394.Fo ENGINE_get_ECDH
395.Fa "const ENGINE *e"
396.Fc
397.Ft const ECDSA_METHOD *
398.Fo ENGINE_get_ECDSA
399.Fa "const ENGINE *e"
400.Fc
401.Ft const DH_METHOD *
402.Fo ENGINE_get_DH
403.Fa "const ENGINE *e"
404.Fc
405.Ft const RAND_METHOD *
406.Fo ENGINE_get_RAND
407.Fa "const ENGINE *e"
408.Fc
409.Ft const STORE_METHOD *
410.Fo ENGINE_get_STORE
411.Fa "const ENGINE *e"
412.Fc
413.Ft ENGINE_GEN_INT_FUNC_PTR
414.Fo ENGINE_get_destroy_function
415.Fa "const ENGINE *e"
416.Fc
417.Ft ENGINE_GEN_INT_FUNC_PTR
418.Fo ENGINE_get_init_function
419.Fa "const ENGINE *e"
420.Fc
421.Ft ENGINE_GEN_INT_FUNC_PTR
422.Fo ENGINE_get_finish_function
423.Fa "const ENGINE *e"
424.Fc
425.Ft ENGINE_CTRL_FUNC_PTR
426.Fo ENGINE_get_ctrl_function
427.Fa "const ENGINE *e"
428.Fc
429.Ft ENGINE_LOAD_KEY_PTR
430.Fo ENGINE_get_load_privkey_function
431.Fa "const ENGINE *e"
432.Fc
433.Ft ENGINE_LOAD_KEY_PTR
434.Fo ENGINE_get_load_pubkey_function
435.Fa "const ENGINE *e"
436.Fc
437.Ft ENGINE_CIPHERS_PTR
438.Fo ENGINE_get_ciphers
439.Fa "const ENGINE *e"
440.Fc
441.Ft ENGINE_DIGESTS_PTR
442.Fo ENGINE_get_digests
443.Fa "const ENGINE *e"
444.Fc
445.Ft const EVP_CIPHER *
446.Fo ENGINE_get_cipher
447.Fa "ENGINE *e"
448.Fa "int nid"
449.Fc
450.Ft const EVP_MD *
451.Fo ENGINE_get_digest
452.Fa "ENGINE *e"
453.Fa "int nid"
454.Fc
455.Ft int
456.Fo ENGINE_get_flags
457.Fa "const ENGINE *e"
458.Fc
459.Ft const ENGINE_CMD_DEFN *
460.Fo ENGINE_get_cmd_defns
461.Fa "const ENGINE *e"
462.Fc
463.Ft EVP_PKEY *
464.Fo ENGINE_load_private_key
465.Fa "ENGINE *e"
466.Fa "const char *key_id"
467.Fa "UI_METHOD *ui_method"
468.Fa "void *callback_data"
469.Fc
470.Ft EVP_PKEY *
471.Fo ENGINE_load_public_key
472.Fa "ENGINE *e"
473.Fa "const char *key_id"
474.Fa "UI_METHOD *ui_method"
475.Fa "void *callback_data"
476.Fc
477.Ft void
478.Fn ENGINE_add_conf_module void
479.Sh DESCRIPTION
480These functions create, manipulate, and use cryptographic modules
481in the form of
482.Vt ENGINE
483objects.
484These objects act as containers for implementations of cryptographic
485algorithms, and support a reference-counted mechanism to allow them to
486be dynamically loaded in and out of the running application.
487.Pp
488The cryptographic functionality that can be provided by an
489.Vt ENGINE
490implementation includes the following abstractions:
491.Pp
492.Bl -bullet -compact
493.It
494.Vt RSA_METHOD :
495for providing alternative RSA implementations
496.It
497.Vt DSA_METHOD , DH_METHOD , RAND_METHOD , ECDH_METHOD ,
498.Vt ECDSA_METHOD , STORE_METHOD :
499similarly for other OpenSSL APIs
500.It
501.Vt EVP_CIPHER :
502potentially multiple cipher algorithms (indexed by 'nid')
503.It
504.Vt EVP_DIGEST :
505potentially multiple hash algorithms (indexed by 'nid')
506.It
507key-loading: loading public and/or private EVP_PKEY keys
508.El
509.Ss Reference counting and handles
510Due to the modular nature of the
511.Nm engine
512API, pointers to
513.Vt ENGINE Ns s
514need to be treated as handles - ie. not only as pointers, but also
515as references to the underlying
516.Vt ENGINE
517object.
518One should obtain a new reference when making copies of an
519.Vt ENGINE
520pointer if the copies will be used (and released) independently.
521.Pp
522.Vt ENGINE
523objects have two levels of reference-counting to match the way in
524which the objects are used.
525At the most basic level, each
526.Vt ENGINE
527pointer is inherently a
528.Sy structural
529reference - a structural reference is required to use the pointer value
530at all, as this kind of reference is a guarantee that the structure can
531not be deallocated until the reference is released.
532.Pp
533However, a structural reference provides no guarantee that the
534.Vt ENGINE
535is initialised and able to use any of its cryptographic implementations.
536Indeed it's quite possible that most
537.Vt ENGINE Ns s
538will not initialise at all in typical environments, as
539.Vt ENGINE Ns s
540are typically used to support specialised hardware.
541To use an
542.Vt ENGINE Ap s
543functionality, you need a
544.Sy functional
545reference.
546This kind of reference can be considered a specialised form of
547structural reference, because each functional reference implicitly
548contains a structural reference as well - however to avoid
549difficult-to-find programming bugs, it is recommended to treat the two
550kinds of reference independently.
551If you have a functional reference to an
552.Vt ENGINE ,
553you have a guarantee that the
554.Vt ENGINE
555has been initialised ready to perform cryptographic operations and
556will remain uninitialised until after you have released your
557reference.
558.Pp
559.Em Structural references
560.Pp
561This basic type of reference is used for instantiating new
562.Vt ENGINE Ns s,
563iterating across OpenSSL's internal linked-list of loaded
564.Vt ENGINE Ns s,
565reading information about an
566.Vt ENGINE ,
567etc.
568Essentially a structural reference is sufficient if you only need to
569query or manipulate the data of an
570.Vt ENGINE
571implementation rather than use its functionality.
572.Pp
573The
574.Fn ENGINE_new
575function returns a structural reference to a new (empty)
576.Vt ENGINE
577object.
578There are other
579.Nm engine
580API functions that return structural references such as
581.Fn ENGINE_by_id ,
582.Fn ENGINE_get_first ,
583.Fn ENGINE_get_last ,
584.Fn ENGINE_get_next ,
585and
586.Fn ENGINE_get_prev .
587All structural references should be released by a corresponding call
588to the
589.Fn ENGINE_free
590function.
591The
592.Vt ENGINE
593object itself will only actually be cleaned up and deallocated when
594the last structural reference is released.
595.Pp
596It should also be noted that many
597.Nm engine
598API function calls that accept a structural reference will internally
599obtain another reference.
600Typically this happens whenever the supplied
601.Vt ENGINE
602will be needed by OpenSSL after the function has returned.
603For example, the function to add a new
604.Vt ENGINE
605to OpenSSL's internal list is
606.Fn ENGINE_add .
607If this function returns success, OpenSSL will have stored a new
608structural reference internally so the caller is still responsible for
609freeing their own reference with
610.Fn ENGINE_free
611when they are finished with it.
612In a similar way, some functions will automatically release the
613structural reference passed to it if part of the function's job is
614to do so.
615For example, the
616.Fn ENGINE_get_next
617and
618.Fn ENGINE_get_prev
619functions are used for iterating across the internal
620.Vt ENGINE
621list.
622They
623will return a new structural reference to the next (or previous)
624.Vt ENGINE
625in the list or
626.Dv NULL
627if at the end (or beginning) of the list, but in either case the
628structural reference passed to the function is released on behalf
629of the caller.
630.Pp
631To clarify a particular function's handling of references, one should
632always consult that function's manual page, or failing that the
633.In openssl/engine.h
634header file includes some hints.
635.Pp
636.Em Functional references
637.Pp
638As mentioned, functional references exist when the cryptographic
639functionality of an
640.Vt ENGINE
641is required to be available.
642A functional reference can be obtained in one of two ways; from an
643existing structural reference to the required
644.Vt ENGINE ,
645or by asking OpenSSL for the default operational
646.Vt ENGINE
647for a given cryptographic purpose.
648.Pp
649To obtain a functional reference from an existing structural reference,
650call the
651.Fn ENGINE_init
652function.
653This returns zero if the
654.Vt ENGINE
655was not already operational and couldn't be successfully initialised
656(eg. lack of system drivers, no special hardware attached, etc.),
657otherwise it will return non-zero to indicate that the
658.Vt ENGINE
659is now operational and will have allocated a new
660.Sy functional
661reference to the
662.Vt ENGINE .
663All functional references are released by calling
664.Fn ENGINE_finish ,
665which removes the implicit structural reference as well.
666.Pp
667The second way to get a functional reference is by asking OpenSSL for a
668default implementation for a given task, eg.
669by
670.Fn ENGINE_get_default_RSA ,
671.Fn ENGINE_get_default_cipher_engine ,
672etc.
673These are discussed in the next section, though they are not usually
674required by application programmers as they are used automatically when
675creating and using the relevant algorithm-specific types in OpenSSL,
676such as RSA, DSA, EVP_CIPHER_CTX, etc.
677.Ss Default implementations
678For each supported abstraction, the
679.Nm engine
680code maintains an internal table of state to control which
681implementations are available for a given abstraction and which
682should be used by default.
683These implementations are registered in the tables and indexed by an
684.Fa nid
685value, because abstractions like
686.Vt EVP_CIPHER
687and
688.Vt EVP_DIGEST
689support many distinct algorithms and modes, and
690.Vt ENGINE Ns s
691can support arbitrarily many of them.
692In the case of other abstractions like RSA, DSA, etc., there is
693only one "algorithm" so all implementations implicitly register
694using the same
695.Fa nid
696index.
697.Pp
698When a default
699.Vt ENGINE
700is requested for a given abstraction/algorithm/mode, (eg. when
701calling
702.Fn RSA_new_method NULL ) ,
703a "get_default" call will be made to the
704.Nm engine
705subsystem to process the corresponding state table and return
706a functional reference to an initialised
707.Vt ENGINE
708whose implementation should be used.
709If no
710.Vt ENGINE
711should (or can) be used, it will return
712.Dv NULL
713and the caller will operate with a
714.Dv NULL
715.Vt ENGINE
716handle.
717This usually equates to using the conventional software implementation.
718In the latter case, OpenSSL will from then on behave the way it used to
719before the
720.Nm engine
721API existed.
722.Pp
723Each state table has a flag to note whether it has processed this
724"get_default" query since the table was last modified, because to
725process this question it must iterate across all the registered
726.Vt ENGINE Ns s
727in the table trying to initialise each of them in turn, in case one of
728them is operational.
729If it returns a functional reference to an
730.Vt ENGINE ,
731it will also cache another reference to speed up processing future
732queries (without needing to iterate across the table).
733Likewise, it will cache a
734.Dv NULL
735response if no
736.Vt ENGINE
737was available so that future queries won't repeat the same iteration
738unless the state table changes.
739This behaviour can also be changed; if the
740.Dv ENGINE_TABLE_FLAG_NOINIT
741flag is set (using
742.Fn ENGINE_set_table_flags ) ,
743no attempted initialisations will take place, instead the only way for
744the state table to return a
745.Pf non- Dv NULL
746.Vt ENGINE
747to the "get_default" query will be if one is expressly set in the table.
748For example,
749.Fn ENGINE_set_default_RSA
750does the same job as
751.Fn ENGINE_register_RSA
752except that it also sets the state table's cached response for the
753"get_default" query.
754In the case of abstractions like
755.Vt EVP_CIPHER ,
756where implementations are indexed by
757.Fa nid ,
758these flags and cached-responses are distinct for each
759.Fa nid
760value.
761.Ss Application requirements
762This section will explain the basic things an application programmer
763should support to make the most useful elements of the
764.Nm engine
765functionality available to the user.
766The first thing to consider is whether the programmer wishes to make
767alternative
768.Vt ENGINE
769modules available to the application and user.
770OpenSSL maintains an internal linked list of "visible"
771.Vt ENGINE Ns s
772from which it has to operate.
773At start-up, this list is empty, and in fact if an application does
774not call any
775.Nm engine
776API calls and it uses static
777linking against openssl, then the resulting application binary will
778not contain any alternative
779.Nm engine
780code at all.
781So the first consideration is whether any/all available
782.Vt ENGINE
783implementations should be made visible to OpenSSL.
784This is controlled by calling the various "load" functions, eg.
785.Fn ENGINE_load_builtin_engines
786to make all
787.Vt ENGINE
788implementations bundled with OpenSSL available.
789.Pp
790Note that
791.Fn ENGINE_load_dynamic
792is a placeholder and does not enable dynamic engine loading support.
793.Pp
794Having called any of these functions,
795.Vt ENGINE
796objects would have been dynamically allocated and populated with
797these implementations and linked into OpenSSL's internal linked
798list.
799.Pp
800If no
801.Nm engine
802API functions are called at all in an application, then there are
803no inherent memory leaks to worry about from the
804.Nm engine
805functionality, however if any
806.Vt ENGINE Ns s
807are loaded, even if they are never registered or used, it is necessary
808to use the
809.Fn ENGINE_cleanup
810function to correspondingly cleanup before program exit, if the caller
811wishes to avoid memory leaks.
812This mechanism uses an internal callback registration table so that any
813.Nm engine
814API functionality that knows it requires cleanup can register its
815cleanup details to be called during
816.Fn ENGINE_cleanup .
817This approach allows
818.Fn ENGINE_cleanup
819to clean up after any
820.Nm engine
821functionality at all that your program uses, yet doesn't automatically
822create linker dependencies to all possible
823.Nm engine
824functionality - only the cleanup callbacks required by the functionality
825you do use will be required by the linker.
826.Pp
827The fact that
828.Vt ENGINE Ns s
829are made visible to OpenSSL (and thus are linked into the program
830and loaded into memory at run-time) does not mean they are "registered"
831or called into use by OpenSSL automatically - that behaviour is
832something for the application to control.
833Some applications will want to allow the user to specify exactly which
834.Vt ENGINE
835they want used if any is to be used at all.
836Others may prefer to load all support and have OpenSSL automatically use
837at run-time any
838.Vt ENGINE
839that is able to successfully initialised - ie. to assume that this
840corresponds to acceleration hardware attached to the machine or
841some such thing.
842There are probably numerous other ways in which applications may prefer
843to handle things, so we will simply illustrate the consequences as they
844apply to a couple of simple cases and leave developers to consider these
845and the source code to openssl's builtin utilities as guides.
846.Pp
847.Em Using a specific ENGINE implementation
848.Pp
849Here we'll assume an application has been configured by its user or
850admin to want to use the "ACME"
851.Vt ENGINE
852if it is available in the version of OpenSSL the application was
853compiled with.
854If it is available, it should be used by default for all RSA, DSA, and
855symmetric cipher operation, otherwise OpenSSL should use its builtin
856software as usual.
857The following code illustrates how to approach this:
858.Bd -literal
859ENGINE *e;
860const char *engine_id = "ACME";
861ENGINE_load_builtin_engines();
862e = ENGINE_by_id(engine_id);
863if (!e)
864 /* the engine isn't available */
865 return;
866if (!ENGINE_init(e)) {
867 /* the engine couldn't initialise, release 'e' */
868 ENGINE_free(e);
869 return;
870}
871if (!ENGINE_set_default_RSA(e))
872 /* This should only happen when 'e' can't initialise, but the previous
873 * statement suggests it did. */
874 abort();
875ENGINE_set_default_DSA(e);
876ENGINE_set_default_ciphers(e);
877/* Release the functional reference from ENGINE_init() */
878ENGINE_finish(e);
879/* Release the structural reference from ENGINE_by_id() */
880ENGINE_free(e);
881.Ed
882.Pp
883.Em Automatically using builtin ENGINE implementations
884.Pp
885Here we'll assume we want to load and register all
886.Vt ENGINE
887implementations bundled with OpenSSL, such that for any cryptographic
888algorithm required by OpenSSL - if there is an
889.Vt ENGINE
890that implements it and can be initialise, it should be used.
891The following code illustrates how this can work;
892.Bd -literal
893/* Load all bundled ENGINEs into memory and make them visible */
894ENGINE_load_builtin_engines();
895/* Register all of them for every algorithm they collectively implement */
896ENGINE_register_all_complete();
897.Ed
898.Pp
899That's all that's required.
900For example, the next time OpenSSL tries to set up an RSA key, any bundled
901.Vt ENGINE Ns s
902that implement
903.Vt RSA_METHOD
904will be passed to
905.Fn ENGINE_init
906and if any of those succeed, that
907.Vt ENGINE
908will be set as the default for RSA use from then on.
909.Ss Advanced configuration support
910There is a mechanism supported by the
911.Nm engine
912framework that allows each
913.Vt ENGINE
914implementation to define an arbitrary set of configuration
915"commands" and expose them to OpenSSL and any applications based on
916OpenSSL.
917This mechanism is entirely based on the use of name-value pairs
918and assumes ASCII input (no unicode or UTF for now!), so it is ideal if
919applications want to provide a transparent way for users to provide
920arbitrary configuration "directives" directly to such
921.Vt ENGINE Ns s.
922It is also possible for the application to dynamically interrogate the
923loaded
924.Vt ENGINE
925implementations for the names, descriptions, and input flags of
926their available "control commands", providing a more flexible
927configuration scheme.
928However, if the user is expected to know which
929.Vt ENGINE
930device he/she is using (in the case of specialised hardware, this
931goes without saying) then applications may not need to concern
932themselves with discovering the supported control commands and
933simply prefer to pass settings into
934.Vt ENGINE s
935exactly as they are provided by the user.
936.Pp
937Before illustrating how control commands work, it is worth mentioning
938what they are typically used for.
939Broadly speaking there are two uses for control commands; the first is
940to provide the necessary details to the implementation (which may know
941nothing at all specific to the host system) so that it can be
942initialised for use.
943This could include the path to any driver or config files it needs to
944load, required network addresses, smart-card identifiers, passwords to
945initialise protected devices, logging information, etc etc.
946This class of commands typically needs to be passed to an
947.Vt ENGINE
948.Sy before
949attempting to initialise it, ie. before calling
950.Fn ENGINE_init .
951The other class of commands consist of settings or operations that tweak
952certain behaviour or cause certain operations to take place, and these
953commands may work either before or after
954.Fn ENGINE_init ,
955or in some cases both.
956.Vt ENGINE
957implementations should provide indications of this in the descriptions
958attached to builtin control commands and/or in external product
959documentation.
960.Pp
961.Em Issuing control commands to an ENGINE
962.Pp
963Let's illustrate by example; a function for which the caller supplies
964the name of the
965.Vt ENGINE
966it wishes to use, a table of string-pairs for use before initialisation,
967and another table for use after initialisation.
968Note that the string-pairs used for control commands consist of a
969command "name" followed by the command "parameter" - the parameter
970could be
971.Dv NULL
972in some cases but the name can not.
973This function should initialise the
974.Vt ENGINE
975(issuing the "pre" commands beforehand and the "post" commands
976afterwards) and set it as the default for everything except RAND
977and then return a boolean success or failure.
978.Bd -literal
979int
980generic_load_engine_fn(const char *engine_id,
981 const char **pre_cmds, int pre_num,
982 const char **post_cmds, int post_num)
983{
984 ENGINE *e = ENGINE_by_id(engine_id);
985
986 if (!e)
987 return 0;
988 while (pre_num--) {
989 if (!ENGINE_ctrl_cmd_string(e,
990 pre_cmds[0], pre_cmds[1], 0)) {
991 fprintf(stderr,
992 "Failed command (%s - %s:%s)\en",
993 engine_id, pre_cmds[0],
994 pre_cmds[1] ? pre_cmds[1] : "(NULL)");
995 ENGINE_free(e);
996 return 0;
997 }
998 pre_cmds += 2;
999 }
1000 if (!ENGINE_init(e)) {
1001 fprintf(stderr, "Failed initialisation\en");
1002 ENGINE_free(e);
1003 return 0;
1004 }
1005 /*
1006 * ENGINE_init() returned a functional reference,
1007 * so free the structural reference from
1008 * ENGINE_by_id().
1009 */
1010 ENGINE_free(e);
1011 while (post_num--) {
1012 if (!ENGINE_ctrl_cmd_string(e,
1013 post_cmds[0], post_cmds[1], 0)) {
1014 fprintf(stderr,
1015 "Failed command (%s - %s:%s)\en",
1016 engine_id, post_cmds[0],
1017 post_cmds[1] ? post_cmds[1] : "(NULL)");
1018 ENGINE_finish(e);
1019 return 0;
1020 }
1021 post_cmds += 2;
1022 }
1023 ENGINE_set_default(e, ENGINE_METHOD_ALL & ~ENGINE_METHOD_RAND);
1024 /* Success */
1025 return 1;
1026}
1027.Ed
1028.Pp
1029Note that
1030.Fn ENGINE_ctrl_cmd_string
1031accepts a boolean argument that can relax the semantics of the function.
1032If set to non-zero it will only return failure if the
1033.Vt ENGINE
1034supported the given command name but failed while executing it, if the
1035.Vt ENGINE
1036doesn't support the command name it will simply return success without
1037doing anything.
1038In this case we assume the user is only supplying commands specific to
1039the given
1040.Vt ENGINE
1041so we set this to FALSE.
1042.Pp
1043.Em Discovering supported control commands
1044.Pp
1045It is possible to discover at run-time the names, numerical-ids,
1046descriptions and input parameters of the control commands supported by an
1047.Vt ENGINE
1048using a structural reference.
1049Note that some control commands are defined by OpenSSL itself and it
1050will intercept and handle these control commands on behalf of the
1051.Vt ENGINE ,
1052ie. the
1053.Vt ENGINE Ap s
1054ctrl() handler is not used for the control command.
1055.In openssl/engine.h
1056defines an index,
1057.Dv ENGINE_CMD_BASE ,
1058that all control commands implemented by
1059.Vt ENGINE Ns s
1060should be numbered from.
1061Any command value lower than this symbol is considered a "generic"
1062command is handled directly by the OpenSSL core routines.
1063.Pp
1064It is using these "core" control commands that one can discover the
1065control commands implemented by a given
1066.Vt ENGINE ,
1067specifically the commands:
1068.Bd -literal
1069#define ENGINE_HAS_CTRL_FUNCTION 10
1070#define ENGINE_CTRL_GET_FIRST_CMD_TYPE 11
1071#define ENGINE_CTRL_GET_NEXT_CMD_TYPE 12
1072#define ENGINE_CTRL_GET_CMD_FROM_NAME 13
1073#define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD 14
1074#define ENGINE_CTRL_GET_NAME_FROM_CMD 15
1075#define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD 16
1076#define ENGINE_CTRL_GET_DESC_FROM_CMD 17
1077#define ENGINE_CTRL_GET_CMD_FLAGS 18
1078.Ed
1079.Pp
1080Whilst these commands are automatically processed by the OpenSSL
1081framework code, they use various properties exposed by each
1082.Vt ENGINE
1083to process these queries.
1084An
1085.Vt ENGINE
1086has 3 properties it exposes that can affect how this behaves;
1087it can supply a ctrl() handler, it can specify
1088.Dv ENGINE_FLAGS_MANUAL_CMD_CTRL
1089in the
1090.Vt ENGINE Ap s
1091flags, and it can expose an array of control command descriptions.
1092If an
1093.Vt ENGINE
1094specifies the
1095.Dv ENGINE_FLAGS_MANUAL_CMD_CTRL
1096flag, then it will simply pass all these "core" control commands
1097directly to the
1098.Vt ENGINE Ap s
1099ctrl() handler (and thus, it must have supplied one), so it is up
1100to the
1101.Vt ENGINE
1102to reply to these "discovery" commands itself.
1103If that flag is not set, then the OpenSSL framework code will work with
1104the following rules;
1105.Bl -tag -width Ds
1106.It If no ctrl() handler is supplied:
1107.Dv ENGINE_HAS_CTRL_FUNCTION
1108returns FALSE (zero), all other commands fail.
1109.It If a ctrl() handler was supplied but no array of control commands:
1110.Dv ENGINE_HAS_CTRL_FUNCTION
1111returns TRUE, all other commands fail.
1112.It If a ctrl() handler and array of control commands was supplied:
1113.Dv ENGINE_HAS_CTRL_FUNCTION
1114returns TRUE, all other commands proceed processing...
1115.El
1116.Pp
1117If the
1118.Vt ENGINE Ns s
1119array of control commands is empty, then all other commands will fail.
1120Otherwise
1121.Dv ENGINE_CTRL_GET_FIRST_CMD_TYPE
1122returns the identifier of the first command supported by the
1123.Vt ENGINE ,
1124.Dv ENGINE_GET_NEXT_CMD_TYPE
1125takes the identifier of a command supported by the
1126.Vt ENGINE
1127and returns the next command identifier or fails if there are no more,
1128.Dv ENGINE_CMD_FROM_NAME
1129takes a string name for a command and returns the corresponding
1130identifier or fails if no such command name exists, and the remaining
1131commands take a command identifier and return properties of the
1132corresponding commands.
1133All except
1134.Dv ENGINE_CTRL_GET_FLAGS
1135return the string length of a command name or description, or
1136populate a supplied character buffer with a copy of the command
1137name or description.
1138.Dv ENGINE_CTRL_GET_FLAGS
1139returns a bitwise-OR'd mask of the following possible values:
1140.Bd -literal
1141#define ENGINE_CMD_FLAG_NUMERIC (unsigned int)0x0001
1142#define ENGINE_CMD_FLAG_STRING (unsigned int)0x0002
1143#define ENGINE_CMD_FLAG_NO_INPUT (unsigned int)0x0004
1144#define ENGINE_CMD_FLAG_INTERNAL (unsigned int)0x0008
1145.Ed
1146.Pp
1147If the
1148.Dv ENGINE_CMD_FLAG_INTERNAL
1149flag is set, then any other flags are purely informational to the caller.
1150This flag will prevent the command being usable for any higher-level
1151.Vt ENGINE
1152functions such as
1153.Fn ENGINE_ctrl_cmd_string .
1154"INTERNAL" commands are not intended to be exposed to text-based
1155configuration by applications, administrations, users, etc.
1156These can support arbitrary operations via
1157.Fn ENGINE_ctrl ,
1158including passing to and/or from the control commands data of any
1159arbitrary type.
1160These commands are supported in the discovery mechanisms simply allow
1161applications to determine if an
1162.Vt ENGINE
1163supports certain specific commands it might want to use (eg.
1164application "foo" might query various
1165.Vt ENGINE Ns s
1166to see if they implement "FOO_GET_VENDOR_LOGO_GIF" - and
1167.Vt ENGINE
1168could therefore decide whether or not to support this "foo"-specific
1169extension).
1170.Ss Future developments
1171The
1172.Nm engine
1173API and internal architecture is currently being reviewed.
1174Slated for possible release in 0.9.8 is support for transparent loading
1175of "dynamic"
1176.Vt ENGINE Ns s (built as self-contained shared libraries).
1177This would allow
1178.Vt ENGINE
1179implementations to be provided independently of
1180OpenSSL libraries and/or OpenSSL-based applications, and would also
1181remove any requirement for applications to explicitly use the "dynamic"
1182.Vt ENGINE
1183to bind to shared-library implementations.
1184.Sh SEE ALSO
1185.Xr dh 3 ,
1186.Xr dsa 3 ,
1187.Xr rsa 3
diff --git a/src/lib/libcrypto/man/lh_stats.3 b/src/lib/libcrypto/man/lh_stats.3
new file mode 100644
index 0000000000..b56bb81979
--- /dev/null
+++ b/src/lib/libcrypto/man/lh_stats.3
@@ -0,0 +1,83 @@
1.Dd $Mdocdate: November 5 2016 $
2.Dt LH_STATS 3
3.Os
4.Sh NAME
5.Nm lh_stats ,
6.Nm lh_node_stats ,
7.Nm lh_node_usage_stats ,
8.Nm lh_stats_bio ,
9.Nm lh_node_stats_bio ,
10.Nm lh_node_usage_stats_bio
11.Nd LHASH statistics
12.Sh SYNOPSIS
13.In openssl/lhash.h
14.Ft void
15.Fo lh_stats
16.Fa "LHASH *table"
17.Fa "FILE *out"
18.Fc
19.Ft void
20.Fo lh_node_stats
21.Fa "LHASH *table"
22.Fa "FILE *out"
23.Fc
24.Ft void
25.Fo lh_node_usage_stats
26.Fa "LHASH *table"
27.Fa "FILE *out"
28.Fc
29.Ft void
30.Fo lh_stats_bio
31.Fa "LHASH *table"
32.Fa "BIO *out"
33.Fc
34.Ft void
35.Fo lh_node_stats_bio
36.Fa "LHASH *table"
37.Fa "BIO *out"
38.Fc
39.Ft void
40.Fo lh_node_usage_stats_bio
41.Fa "LHASH *table"
42.Fa "BIO *out"
43.Fc
44.Sh DESCRIPTION
45The
46.Vt LHASH
47structure records statistics about most aspects of accessing the hash
48table.
49.Pp
50.Fn lh_stats
51prints out statistics on the size of the hash table, how many entries
52are in it, and the number and result of calls to the routines in this
53library.
54.Pp
55.Fn lh_node_stats
56prints the number of entries for each 'bucket' in the hash table.
57.Pp
58.Fn lh_node_usage_stats
59prints out a short summary of the state of the hash table.
60It prints the 'load' and the 'actual load'.
61The load is the average number of data items per 'bucket' in the hash
62table.
63The 'actual load' is the average number of items per 'bucket', but only
64for buckets which contain entries.
65So the 'actual load' is the average number of searches that will need to
66find an item in the hash table, while the 'load' is the average number
67that will be done to record a miss.
68.Pp
69.Fn lh_stats_bio ,
70.Fn lh_node_stats_bio ,
71and
72.Fn lh_node_usage_stats_bio
73are the same as the above, except that the output goes to a
74.Vt BIO .
75.Sh RETURN VALUES
76These functions do not return values.
77.Sh SEE ALSO
78.Xr bio 3 ,
79.Xr lh_new 3
80.Sh HISTORY
81These functions are available in all versions of SSLeay and OpenSSL.
82.Sh AUTHORS
83.An Eric Young