summaryrefslogtreecommitdiff
path: root/src/lib/libssl/src/doc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/src/doc')
-rw-r--r--src/lib/libssl/src/doc/crypto/bn_internal.pod238
-rw-r--r--src/lib/libssl/src/doc/crypto/d2i_PKCS8PrivateKey.pod58
-rw-r--r--src/lib/libssl/src/doc/crypto/ecdsa.pod205
-rw-r--r--src/lib/libssl/src/doc/crypto/lhash.pod303
-rw-r--r--src/lib/libssl/src/doc/crypto/ui.pod194
-rw-r--r--src/lib/libssl/src/doc/crypto/ui_compat.pod57
6 files changed, 0 insertions, 1055 deletions
diff --git a/src/lib/libssl/src/doc/crypto/bn_internal.pod b/src/lib/libssl/src/doc/crypto/bn_internal.pod
deleted file mode 100644
index 9c59ed623b..0000000000
--- a/src/lib/libssl/src/doc/crypto/bn_internal.pod
+++ /dev/null
@@ -1,238 +0,0 @@
1=pod
2
3=head1 NAME
4
5bn_mul_words, bn_mul_add_words, bn_sqr_words, bn_div_words,
6bn_add_words, bn_sub_words, bn_mul_comba4, bn_mul_comba8,
7bn_sqr_comba4, bn_sqr_comba8, bn_cmp_words, bn_mul_normal,
8bn_mul_low_normal, bn_mul_recursive, bn_mul_part_recursive,
9bn_mul_low_recursive, bn_mul_high, bn_sqr_normal, bn_sqr_recursive,
10bn_expand, bn_wexpand, bn_expand2, bn_fix_top, bn_check_top,
11bn_print, bn_dump, bn_set_max, bn_set_high, bn_set_low, sqr
12- BIGNUM library internal functions
13
14=head1 SYNOPSIS
15
16 #include <openssl/bn.h>
17
18 BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w);
19 BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num,
20 BN_ULONG w);
21 void bn_sqr_words(BN_ULONG *rp, BN_ULONG *ap, int num);
22 BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d);
23 BN_ULONG bn_add_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,
24 int num);
25 BN_ULONG bn_sub_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,
26 int num);
27
28 void bn_mul_comba4(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b);
29 void bn_mul_comba8(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b);
30 void bn_sqr_comba4(BN_ULONG *r, BN_ULONG *a);
31 void bn_sqr_comba8(BN_ULONG *r, BN_ULONG *a);
32
33 int bn_cmp_words(BN_ULONG *a, BN_ULONG *b, int n);
34
35 void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b,
36 int nb);
37 void bn_mul_low_normal(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n);
38 void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
39 int dna,int dnb,BN_ULONG *tmp);
40 void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b,
41 int n, int tna,int tnb, BN_ULONG *tmp);
42 void bn_mul_low_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b,
43 int n2, BN_ULONG *tmp);
44 void bn_mul_high(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, BN_ULONG *l,
45 int n2, BN_ULONG *tmp);
46
47 void bn_sqr_normal(BN_ULONG *r, BN_ULONG *a, int n, BN_ULONG *tmp);
48 void bn_sqr_recursive(BN_ULONG *r, BN_ULONG *a, int n2, BN_ULONG *tmp);
49
50 void mul(BN_ULONG r, BN_ULONG a, BN_ULONG w, BN_ULONG c);
51 void mul_add(BN_ULONG r, BN_ULONG a, BN_ULONG w, BN_ULONG c);
52 void sqr(BN_ULONG r0, BN_ULONG r1, BN_ULONG a);
53
54 BIGNUM *bn_expand(BIGNUM *a, int bits);
55 BIGNUM *bn_wexpand(BIGNUM *a, int n);
56 BIGNUM *bn_expand2(BIGNUM *a, int n);
57 void bn_fix_top(BIGNUM *a);
58
59 void bn_check_top(BIGNUM *a);
60 void bn_print(BIGNUM *a);
61 void bn_dump(BN_ULONG *d, int n);
62 void bn_set_max(BIGNUM *a);
63 void bn_set_high(BIGNUM *r, BIGNUM *a, int n);
64 void bn_set_low(BIGNUM *r, BIGNUM *a, int n);
65
66=head1 DESCRIPTION
67
68This page documents the internal functions used by the OpenSSL
69B<BIGNUM> implementation. They are described here to facilitate
70debugging and extending the library. They are I<not> to be used by
71applications.
72
73=head2 The BIGNUM structure
74
75 typedef struct bignum_st BIGNUM;
76
77 struct bignum_st
78 {
79 BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */
80 int top; /* Index of last used d +1. */
81 /* The next are internal book keeping for bn_expand. */
82 int dmax; /* Size of the d array. */
83 int neg; /* one if the number is negative */
84 int flags;
85 };
86
87
88The integer value is stored in B<d>, a malloc()ed array of words (B<BN_ULONG>),
89least significant word first. A B<BN_ULONG> can be either 16, 32 or 64 bits
90in size, depending on the 'number of bits' (B<BITS2>) specified in
91C<openssl/bn.h>.
92
93B<dmax> is the size of the B<d> array that has been allocated. B<top>
94is the number of words being used, so for a value of 4, bn.d[0]=4 and
95bn.top=1. B<neg> is 1 if the number is negative. When a B<BIGNUM> is
96B<0>, the B<d> field can be B<NULL> and B<top> == B<0>.
97
98B<flags> is a bit field of flags which are defined in C<openssl/bn.h>. The
99flags begin with B<BN_FLG_>. The macros BN_set_flags(b,n) and
100BN_get_flags(b,n) exist to enable or fetch flag(s) B<n> from B<BIGNUM>
101structure B<b>.
102
103Various routines in this library require the use of temporary
104B<BIGNUM> variables during their execution. Since dynamic memory
105allocation to create B<BIGNUM>s is rather expensive when used in
106conjunction with repeated subroutine calls, the B<BN_CTX> structure is
107used. This structure contains B<BN_CTX_NUM> B<BIGNUM>s, see
108L<BN_CTX_start(3)|BN_CTX_start(3)>.
109
110=head2 Low-level arithmetic operations
111
112These functions are implemented in C and for several platforms in
113assembly language:
114
115bn_mul_words(B<rp>, B<ap>, B<num>, B<w>) operates on the B<num> word
116arrays B<rp> and B<ap>. It computes B<ap> * B<w>, places the result
117in B<rp>, and returns the high word (carry).
118
119bn_mul_add_words(B<rp>, B<ap>, B<num>, B<w>) operates on the B<num>
120word arrays B<rp> and B<ap>. It computes B<ap> * B<w> + B<rp>, places
121the result in B<rp>, and returns the high word (carry).
122
123bn_sqr_words(B<rp>, B<ap>, B<n>) operates on the B<num> word array
124B<ap> and the 2*B<num> word array B<ap>. It computes B<ap> * B<ap>
125word-wise, and places the low and high bytes of the result in B<rp>.
126
127bn_div_words(B<h>, B<l>, B<d>) divides the two word number (B<h>,B<l>)
128by B<d> and returns the result.
129
130bn_add_words(B<rp>, B<ap>, B<bp>, B<num>) operates on the B<num> word
131arrays B<ap>, B<bp> and B<rp>. It computes B<ap> + B<bp>, places the
132result in B<rp>, and returns the high word (carry).
133
134bn_sub_words(B<rp>, B<ap>, B<bp>, B<num>) operates on the B<num> word
135arrays B<ap>, B<bp> and B<rp>. It computes B<ap> - B<bp>, places the
136result in B<rp>, and returns the carry (1 if B<bp> E<gt> B<ap>, 0
137otherwise).
138
139bn_mul_comba4(B<r>, B<a>, B<b>) operates on the 4 word arrays B<a> and
140B<b> and the 8 word array B<r>. It computes B<a>*B<b> and places the
141result in B<r>.
142
143bn_mul_comba8(B<r>, B<a>, B<b>) operates on the 8 word arrays B<a> and
144B<b> and the 16 word array B<r>. It computes B<a>*B<b> and places the
145result in B<r>.
146
147bn_sqr_comba4(B<r>, B<a>, B<b>) operates on the 4 word arrays B<a> and
148B<b> and the 8 word array B<r>.
149
150bn_sqr_comba8(B<r>, B<a>, B<b>) operates on the 8 word arrays B<a> and
151B<b> and the 16 word array B<r>.
152
153The following functions are implemented in C:
154
155bn_cmp_words(B<a>, B<b>, B<n>) operates on the B<n> word arrays B<a>
156and B<b>. It returns 1, 0 and -1 if B<a> is greater than, equal and
157less than B<b>.
158
159bn_mul_normal(B<r>, B<a>, B<na>, B<b>, B<nb>) operates on the B<na>
160word array B<a>, the B<nb> word array B<b> and the B<na>+B<nb> word
161array B<r>. It computes B<a>*B<b> and places the result in B<r>.
162
163bn_mul_low_normal(B<r>, B<a>, B<b>, B<n>) operates on the B<n> word
164arrays B<r>, B<a> and B<b>. It computes the B<n> low words of
165B<a>*B<b> and places the result in B<r>.
166
167bn_mul_recursive(B<r>, B<a>, B<b>, B<n2>, B<dna>, B<dnb>, B<t>) operates
168on the word arrays B<a> and B<b> of length B<n2>+B<dna> and B<n2>+B<dnb>
169(B<dna> and B<dnb> are currently allowed to be 0 or negative) and the 2*B<n2>
170word arrays B<r> and B<t>. B<n2> must be a power of 2. It computes
171B<a>*B<b> and places the result in B<r>.
172
173bn_mul_part_recursive(B<r>, B<a>, B<b>, B<n>, B<tna>, B<tnb>, B<tmp>)
174operates on the word arrays B<a> and B<b> of length B<n>+B<tna> and
175B<n>+B<tnb> and the 4*B<n> word arrays B<r> and B<tmp>.
176
177bn_mul_low_recursive(B<r>, B<a>, B<b>, B<n2>, B<tmp>) operates on the
178B<n2> word arrays B<r> and B<tmp> and the B<n2>/2 word arrays B<a>
179and B<b>.
180
181bn_mul_high(B<r>, B<a>, B<b>, B<l>, B<n2>, B<tmp>) operates on the
182B<n2> word arrays B<r>, B<a>, B<b> and B<l> (?) and the 3*B<n2> word
183array B<tmp>.
184
185BN_mul() calls bn_mul_normal(), or an optimized implementation if the
186factors have the same size: bn_mul_comba8() is used if they are 8
187words long, bn_mul_recursive() if they are larger than
188B<BN_MULL_SIZE_NORMAL> and the size is an exact multiple of the word
189size, and bn_mul_part_recursive() for others that are larger than
190B<BN_MULL_SIZE_NORMAL>.
191
192bn_sqr_normal(B<r>, B<a>, B<n>, B<tmp>) operates on the B<n> word array
193B<a> and the 2*B<n> word arrays B<tmp> and B<r>.
194
195The implementations use the following macros which, depending on the
196architecture, may use "long long" C operations or inline assembler.
197They are defined in C<bn_lcl.h>.
198
199mul(B<r>, B<a>, B<w>, B<c>) computes B<w>*B<a>+B<c> and places the
200low word of the result in B<r> and the high word in B<c>.
201
202mul_add(B<r>, B<a>, B<w>, B<c>) computes B<w>*B<a>+B<r>+B<c> and
203places the low word of the result in B<r> and the high word in B<c>.
204
205sqr(B<r0>, B<r1>, B<a>) computes B<a>*B<a> and places the low word
206of the result in B<r0> and the high word in B<r1>.
207
208=head2 Size changes
209
210bn_expand() ensures that B<b> has enough space for a B<bits> bit
211number. bn_wexpand() ensures that B<b> has enough space for an
212B<n> word number. If the number has to be expanded, both macros
213call bn_expand2(), which allocates a new B<d> array and copies the
214data. They return B<NULL> on error, B<b> otherwise.
215
216The bn_fix_top() macro reduces B<a-E<gt>top> to point to the most
217significant non-zero word plus one when B<a> has shrunk.
218
219=head2 Debugging
220
221bn_check_top() verifies that C<((a)-E<gt>top E<gt>= 0 && (a)-E<gt>top
222E<lt>= (a)-E<gt>dmax)>. A violation will cause the program to abort.
223
224bn_print() prints B<a> to stderr. bn_dump() prints B<n> words at B<d>
225(in reverse order, i.e. most significant word first) to stderr.
226
227bn_set_max() makes B<a> a static number with a B<dmax> of its current size.
228This is used by bn_set_low() and bn_set_high() to make B<r> a read-only
229B<BIGNUM> that contains the B<n> low or high words of B<a>.
230
231If B<BN_DEBUG> is not defined, bn_check_top(), bn_print(), bn_dump()
232and bn_set_max() are defined as empty macros.
233
234=head1 SEE ALSO
235
236L<bn(3)|bn(3)>
237
238=cut
diff --git a/src/lib/libssl/src/doc/crypto/d2i_PKCS8PrivateKey.pod b/src/lib/libssl/src/doc/crypto/d2i_PKCS8PrivateKey.pod
deleted file mode 100644
index fc7335c7a1..0000000000
--- a/src/lib/libssl/src/doc/crypto/d2i_PKCS8PrivateKey.pod
+++ /dev/null
@@ -1,58 +0,0 @@
1=pod
2
3=head1 NAME
4
5d2i_PKCS8PrivateKey_bio, d2i_PKCS8PrivateKey_fp, i2d_PKCS8PrivateKey_bio,
6i2d_PKCS8PrivateKey_fp, i2d_PKCS8PrivateKey_nid_bio, i2d_PKCS8PrivateKey_nid_fp
7- PKCS#8 format private key functions
8
9=head1 SYNOPSIS
10
11 #include <openssl/evp.h>
12
13 EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u);
14 EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, void *u);
15
16 int i2d_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
17 char *kstr, int klen,
18 pem_password_cb *cb, void *u);
19
20 int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
21 char *kstr, int klen,
22 pem_password_cb *cb, void *u);
23
24 int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,
25 char *kstr, int klen,
26 pem_password_cb *cb, void *u);
27
28 int i2d_PKCS8PrivateKey_nid_fp(FILE *fp, EVP_PKEY *x, int nid,
29 char *kstr, int klen,
30 pem_password_cb *cb, void *u);
31
32=head1 DESCRIPTION
33
34The PKCS#8 functions encode and decode private keys in PKCS#8 format using both
35PKCS#5 v1.5 and PKCS#5 v2.0 password based encryption algorithms.
36
37Other than the use of DER as opposed to PEM these functions are identical to the
38corresponding B<PEM> function as described in the L<pem(3)|pem(3)> manual page.
39
40=head1 NOTES
41
42Before using these functions
43L<OpenSSL_add_all_algorithms(3)|OpenSSL_add_all_algorithms(3)> should be called
44to initialize the internal algorithm lookup tables otherwise errors about
45unknown algorithms will occur if an attempt is made to decrypt a private key.
46
47These functions are currently the only way to store encrypted private keys
48using DER format.
49
50Currently all the functions use BIOs or FILE pointers, there are no functions
51which work directly on memory: this can be readily worked around by converting
52the buffers to memory BIOs, see L<BIO_s_mem(3)|BIO_s_mem(3)> for details.
53
54=head1 SEE ALSO
55
56L<pem(3)|pem(3)>
57
58=cut
diff --git a/src/lib/libssl/src/doc/crypto/ecdsa.pod b/src/lib/libssl/src/doc/crypto/ecdsa.pod
deleted file mode 100644
index 9e9608155a..0000000000
--- a/src/lib/libssl/src/doc/crypto/ecdsa.pod
+++ /dev/null
@@ -1,205 +0,0 @@
1=pod
2
3=head1 NAME
4
5ECDSA_SIG_new, ECDSA_SIG_free, i2d_ECDSA_SIG, d2i_ECDSA_SIG,
6ECDSA_size, ECDSA_sign_setup, ECDSA_sign, ECDSA_sign_ex,
7ECDSA_verify, ECDSA_do_sign, ECDSA_do_sign_ex, ECDSA_do_verify,
8ECDSA_OpenSSL, ECDSA_get_default_method, ECDSA_get_ex_data,
9ECDSA_get_ex_new_index, ECDSA_set_default_method, ECDSA_set_ex_data,
10ECDSA_set_method - Elliptic Curve Digital Signature Algorithm
11
12=head1 SYNOPSIS
13
14 #include <openssl/ecdsa.h>
15
16 ECDSA_SIG* ECDSA_SIG_new(void);
17 void ECDSA_SIG_free(ECDSA_SIG *sig);
18 int i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp);
19 ECDSA_SIG* d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp,
20 long len);
21
22 ECDSA_SIG* ECDSA_do_sign(const unsigned char *dgst, int dgst_len,
23 EC_KEY *eckey);
24 ECDSA_SIG* ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen,
25 const BIGNUM *kinv, const BIGNUM *rp,
26 EC_KEY *eckey);
27 int ECDSA_do_verify(const unsigned char *dgst, int dgst_len,
28 const ECDSA_SIG *sig, EC_KEY* eckey);
29 int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx,
30 BIGNUM **kinv, BIGNUM **rp);
31 int ECDSA_sign(int type, const unsigned char *dgst,
32 int dgstlen, unsigned char *sig,
33 unsigned int *siglen, EC_KEY *eckey);
34 int ECDSA_sign_ex(int type, const unsigned char *dgst,
35 int dgstlen, unsigned char *sig,
36 unsigned int *siglen, const BIGNUM *kinv,
37 const BIGNUM *rp, EC_KEY *eckey);
38 int ECDSA_verify(int type, const unsigned char *dgst,
39 int dgstlen, const unsigned char *sig,
40 int siglen, EC_KEY *eckey);
41 int ECDSA_size(const EC_KEY *eckey);
42
43 const ECDSA_METHOD* ECDSA_OpenSSL(void);
44 void ECDSA_set_default_method(const ECDSA_METHOD *meth);
45 const ECDSA_METHOD* ECDSA_get_default_method(void);
46 int ECDSA_set_method(EC_KEY *eckey,const ECDSA_METHOD *meth);
47
48 int ECDSA_get_ex_new_index(long argl, void *argp,
49 CRYPTO_EX_new *new_func,
50 CRYPTO_EX_dup *dup_func,
51 CRYPTO_EX_free *free_func);
52 int ECDSA_set_ex_data(EC_KEY *d, int idx, void *arg);
53 void* ECDSA_get_ex_data(EC_KEY *d, int idx);
54
55=head1 DESCRIPTION
56
57The B<ECDSA_SIG> structure consists of two BIGNUMs for the
58r and s value of a ECDSA signature (see X9.62 or FIPS 186-2).
59
60 struct
61 {
62 BIGNUM *r;
63 BIGNUM *s;
64 } ECDSA_SIG;
65
66ECDSA_SIG_new() allocates a new B<ECDSA_SIG> structure (note: this
67function also allocates the BIGNUMs) and initialize it.
68
69ECDSA_SIG_free() frees the B<ECDSA_SIG> structure B<sig>.
70
71i2d_ECDSA_SIG() creates the DER encoding of the ECDSA signature
72B<sig> and writes the encoded signature to B<*pp> (note: if B<pp>
73is NULL B<i2d_ECDSA_SIG> returns the expected length in bytes of
74the DER encoded signature). B<i2d_ECDSA_SIG> returns the length
75of the DER encoded signature (or 0 on error).
76
77d2i_ECDSA_SIG() decodes a DER encoded ECDSA signature and returns
78the decoded signature in a newly allocated B<ECDSA_SIG> structure.
79B<*sig> points to the buffer containing the DER encoded signature
80of size B<len>.
81
82ECDSA_size() returns the maximum length of a DER encoded
83ECDSA signature created with the private EC key B<eckey>.
84
85ECDSA_sign_setup() may be used to precompute parts of the
86signing operation. B<eckey> is the private EC key and B<ctx>
87is a pointer to B<BN_CTX> structure (or NULL). The precomputed
88values or returned in B<kinv> and B<rp> and can be used in a
89later call to B<ECDSA_sign_ex> or B<ECDSA_do_sign_ex>.
90
91ECDSA_sign() is wrapper function for ECDSA_sign_ex with B<kinv>
92and B<rp> set to NULL.
93
94ECDSA_sign_ex() computes a digital signature of the B<dgstlen> bytes
95hash value B<dgst> using the private EC key B<eckey> and the optional
96pre-computed values B<kinv> and B<rp>. The DER encoded signatures is
97stored in B<sig> and it's length is returned in B<sig_len>. Note: B<sig>
98must point to B<ECDSA_size> bytes of memory. The parameter B<type>
99is ignored.
100
101ECDSA_verify() verifies that the signature in B<sig> of size
102B<siglen> is a valid ECDSA signature of the hash value
103B<dgst> of size B<dgstlen> using the public key B<eckey>.
104The parameter B<type> is ignored.
105
106ECDSA_do_sign() is wrapper function for ECDSA_do_sign_ex with B<kinv>
107and B<rp> set to NULL.
108
109ECDSA_do_sign_ex() computes a digital signature of the B<dgst_len>
110bytes hash value B<dgst> using the private key B<eckey> and the
111optional pre-computed values B<kinv> and B<rp>. The signature is
112returned in a newly allocated B<ECDSA_SIG> structure (or NULL on error).
113
114ECDSA_do_verify() verifies that the signature B<sig> is a valid
115ECDSA signature of the hash value B<dgst> of size B<dgst_len>
116using the public key B<eckey>.
117
118=head1 RETURN VALUES
119
120ECDSA_size() returns the maximum length signature or 0 on error.
121
122ECDSA_sign_setup() and ECDSA_sign() return 1 if successful or 0
123on error.
124
125ECDSA_verify() and ECDSA_do_verify() return 1 for a valid
126signature, 0 for an invalid signature and -1 on error.
127The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
128
129=head1 EXAMPLES
130
131Creating a ECDSA signature of given SHA-1 hash value using the
132named curve secp192k1.
133
134First step: create a EC_KEY object (note: this part is B<not> ECDSA
135specific)
136
137 int ret;
138 ECDSA_SIG *sig;
139 EC_KEY *eckey;
140
141 eckey = EC_KEY_new_by_curve_name(NID_secp192k1);
142 if (eckey == NULL) {
143 /* error */
144 }
145 if (!EC_KEY_generate_key(eckey)) {
146 /* error */
147 }
148
149Second step: compute the ECDSA signature of a SHA-1 hash value
150using B<ECDSA_do_sign>
151
152 sig = ECDSA_do_sign(digest, 20, eckey);
153 if (sig == NULL) {
154 /* error */
155 }
156
157or using B<ECDSA_sign>
158
159 unsigned char *buffer, *pp;
160 int buf_len;
161
162 buf_len = ECDSA_size(eckey);
163 buffer = malloc(buf_len);
164 pp = buffer;
165 if (!ECDSA_sign(0, dgst, dgstlen, pp, &buf_len, eckey) {
166 /* error */
167 }
168
169Third step: verify the created ECDSA signature using B<ECDSA_do_verify>
170
171 ret = ECDSA_do_verify(digest, 20, sig, eckey);
172
173or using B<ECDSA_verify>
174
175 ret = ECDSA_verify(0, digest, 20, buffer, buf_len, eckey);
176
177and finally evaluate the return value:
178
179 if (ret == -1) {
180 /* error */
181 } else if (ret == 0) {
182 /* incorrect signature */
183 } else {
184 /* ret == 1 */
185 /* signature ok */
186 }
187
188=head1 CONFORMING TO
189
190ANSI X9.62, US Federal Information Processing Standard FIPS 186-2
191(Digital Signature Standard, DSS)
192
193=head1 SEE ALSO
194
195L<dsa(3)|dsa(3)>, L<rsa(3)|rsa(3)>
196
197=head1 HISTORY
198
199The ecdsa implementation was first introduced in OpenSSL 0.9.8
200
201=head1 AUTHOR
202
203Nils Larsch for the OpenSSL project (http://www.openssl.org).
204
205=cut
diff --git a/src/lib/libssl/src/doc/crypto/lhash.pod b/src/lib/libssl/src/doc/crypto/lhash.pod
deleted file mode 100644
index a9c44dd9ef..0000000000
--- a/src/lib/libssl/src/doc/crypto/lhash.pod
+++ /dev/null
@@ -1,303 +0,0 @@
1=pod
2
3=head1 NAME
4
5lh_new, lh_free, lh_insert, lh_delete, lh_retrieve, lh_doall, lh_doall_arg,
6lh_error - dynamic hash table
7
8=head1 SYNOPSIS
9
10 #include <openssl/lhash.h>
11
12 DECLARE_LHASH_OF(<type>);
13
14 LHASH *lh_<type>_new();
15 void lh_<type>_free(LHASH_OF(<type> *table);
16
17 <type> *lh_<type>_insert(LHASH_OF(<type> *table, <type> *data);
18 <type> *lh_<type>_delete(LHASH_OF(<type> *table, <type> *data);
19 <type> *lh_retrieve(LHASH_OF<type> *table, <type> *data);
20
21 void lh_<type>_doall(LHASH_OF(<type> *table, LHASH_DOALL_FN_TYPE func);
22 void lh_<type>_doall_arg(LHASH_OF(<type> *table, LHASH_DOALL_ARG_FN_TYPE func,
23 <type2>, <type2> *arg);
24
25 int lh_<type>_error(LHASH_OF(<type> *table);
26
27 typedef int (*LHASH_COMP_FN_TYPE)(const void *, const void *);
28 typedef unsigned long (*LHASH_HASH_FN_TYPE)(const void *);
29 typedef void (*LHASH_DOALL_FN_TYPE)(const void *);
30 typedef void (*LHASH_DOALL_ARG_FN_TYPE)(const void *, const void *);
31
32=head1 DESCRIPTION
33
34This library implements type-checked dynamic hash tables. The hash
35table entries can be arbitrary structures. Usually they consist of key
36and value fields.
37
38lh_<type>_new() creates a new B<LHASH_OF(<type>> structure to store
39arbitrary data entries, and provides the 'hash' and 'compare'
40callbacks to be used in organising the table's entries. The B<hash>
41callback takes a pointer to a table entry as its argument and returns
42an unsigned long hash value for its key field. The hash value is
43normally truncated to a power of 2, so make sure that your hash
44function returns well mixed low order bits. The B<compare> callback
45takes two arguments (pointers to two hash table entries), and returns
460 if their keys are equal, non-zero otherwise. If your hash table
47will contain items of some particular type and the B<hash> and
48B<compare> callbacks hash/compare these types, then the
49B<DECLARE_LHASH_HASH_FN> and B<IMPLEMENT_LHASH_COMP_FN> macros can be
50used to create callback wrappers of the prototypes required by
51lh_<type>_new(). These provide per-variable casts before calling the
52type-specific callbacks written by the application author. These
53macros, as well as those used for the "doall" callbacks, are defined
54as;
55
56 #define DECLARE_LHASH_HASH_FN(name, o_type) \
57 unsigned long name##_LHASH_HASH(const void *);
58 #define IMPLEMENT_LHASH_HASH_FN(name, o_type) \
59 unsigned long name##_LHASH_HASH(const void *arg) { \
60 const o_type *a = arg; \
61 return name##_hash(a); }
62 #define LHASH_HASH_FN(name) name##_LHASH_HASH
63
64 #define DECLARE_LHASH_COMP_FN(name, o_type) \
65 int name##_LHASH_COMP(const void *, const void *);
66 #define IMPLEMENT_LHASH_COMP_FN(name, o_type) \
67 int name##_LHASH_COMP(const void *arg1, const void *arg2) { \
68 const o_type *a = arg1; \
69 const o_type *b = arg2; \
70 return name##_cmp(a,b); }
71 #define LHASH_COMP_FN(name) name##_LHASH_COMP
72
73 #define DECLARE_LHASH_DOALL_FN(name, o_type) \
74 void name##_LHASH_DOALL(void *);
75 #define IMPLEMENT_LHASH_DOALL_FN(name, o_type) \
76 void name##_LHASH_DOALL(void *arg) { \
77 o_type *a = arg; \
78 name##_doall(a); }
79 #define LHASH_DOALL_FN(name) name##_LHASH_DOALL
80
81 #define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \
82 void name##_LHASH_DOALL_ARG(void *, void *);
83 #define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \
84 void name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \
85 o_type *a = arg1; \
86 a_type *b = arg2; \
87 name##_doall_arg(a, b); }
88 #define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG
89
90 An example of a hash table storing (pointers to) structures of type 'STUFF'
91 could be defined as follows;
92
93 /* Calculates the hash value of 'tohash' (implemented elsewhere) */
94 unsigned long STUFF_hash(const STUFF *tohash);
95 /* Orders 'arg1' and 'arg2' (implemented elsewhere) */
96 int stuff_cmp(const STUFF *arg1, const STUFF *arg2);
97 /* Create the type-safe wrapper functions for use in the LHASH internals */
98 static IMPLEMENT_LHASH_HASH_FN(stuff, STUFF);
99 static IMPLEMENT_LHASH_COMP_FN(stuff, STUFF);
100 /* ... */
101 int main(int argc, char *argv[]) {
102 /* Create the new hash table using the hash/compare wrappers */
103 LHASH_OF(STUFF) *hashtable = lh_STUFF_new(LHASH_HASH_FN(STUFF_hash),
104 LHASH_COMP_FN(STUFF_cmp));
105 /* ... */
106 }
107
108lh_<type>_free() frees the B<LHASH_OF(<type>> structure
109B<table>. Allocated hash table entries will not be freed; consider
110using lh_<type>_doall() to deallocate any remaining entries in the
111hash table (see below).
112
113lh_<type>_insert() inserts the structure pointed to by B<data> into
114B<table>. If there already is an entry with the same key, the old
115value is replaced. Note that lh_<type>_insert() stores pointers, the
116data are not copied.
117
118lh_<type>_delete() deletes an entry from B<table>.
119
120lh_<type>_retrieve() looks up an entry in B<table>. Normally, B<data>
121is a structure with the key field(s) set; the function will return a
122pointer to a fully populated structure.
123
124lh_<type>_doall() will, for every entry in the hash table, call
125B<func> with the data item as its parameter. For lh_<type>_doall()
126and lh_<type>_doall_arg(), function pointer casting should be avoided
127in the callbacks (see B<NOTE>) - instead use the declare/implement
128macros to create type-checked wrappers that cast variables prior to
129calling your type-specific callbacks. An example of this is
130illustrated here where the callback is used to cleanup resources for
131items in the hash table prior to the hashtable itself being
132deallocated:
133
134 /* Cleans up resources belonging to 'a' (this is implemented elsewhere) */
135 void STUFF_cleanup_doall(STUFF *a);
136 /* Implement a prototype-compatible wrapper for "STUFF_cleanup" */
137 IMPLEMENT_LHASH_DOALL_FN(STUFF_cleanup, STUFF)
138 /* ... then later in the code ... */
139 /* So to run "STUFF_cleanup" against all items in a hash table ... */
140 lh_STUFF_doall(hashtable, LHASH_DOALL_FN(STUFF_cleanup));
141 /* Then the hash table itself can be deallocated */
142 lh_STUFF_free(hashtable);
143
144When doing this, be careful if you delete entries from the hash table
145in your callbacks: the table may decrease in size, moving the item
146that you are currently on down lower in the hash table - this could
147cause some entries to be skipped during the iteration. The second
148best solution to this problem is to set hash-E<gt>down_load=0 before
149you start (which will stop the hash table ever decreasing in size).
150The best solution is probably to avoid deleting items from the hash
151table inside a "doall" callback!
152
153lh_<type>_doall_arg() is the same as lh_<type>_doall() except that
154B<func> will be called with B<arg> as the second argument and B<func>
155should be of type B<LHASH_DOALL_ARG_FN_TYPE> (a callback prototype
156that is passed both the table entry and an extra argument). As with
157lh_doall(), you can instead choose to declare your callback with a
158prototype matching the types you are dealing with and use the
159declare/implement macros to create compatible wrappers that cast
160variables before calling your type-specific callbacks. An example of
161this is demonstrated here (printing all hash table entries to a BIO
162that is provided by the caller):
163
164 /* Prints item 'a' to 'output_bio' (this is implemented elsewhere) */
165 void STUFF_print_doall_arg(const STUFF *a, BIO *output_bio);
166 /* Implement a prototype-compatible wrapper for "STUFF_print" */
167 static IMPLEMENT_LHASH_DOALL_ARG_FN(STUFF, const STUFF, BIO)
168 /* ... then later in the code ... */
169 /* Print out the entire hashtable to a particular BIO */
170 lh_STUFF_doall_arg(hashtable, LHASH_DOALL_ARG_FN(STUFF_print), BIO,
171 logging_bio);
172
173lh_<type>_error() can be used to determine if an error occurred in the last
174operation. lh_<type>_error() is a macro.
175
176=head1 RETURN VALUES
177
178lh_<type>_new() returns B<NULL> on error, otherwise a pointer to the new
179B<LHASH> structure.
180
181When a hash table entry is replaced, lh_<type>_insert() returns the value
182being replaced. B<NULL> is returned on normal operation and on error.
183
184lh_<type>_delete() returns the entry being deleted. B<NULL> is returned if
185there is no such value in the hash table.
186
187lh_<type>_retrieve() returns the hash table entry if it has been found,
188B<NULL> otherwise.
189
190lh_<type>_error() returns 1 if an error occurred in the last operation, 0
191otherwise.
192
193lh_<type>_free(), lh_<type>_doall() and lh_<type>_doall_arg() return no values.
194
195=head1 NOTE
196
197The various LHASH macros and callback types exist to make it possible
198to write type-checked code without resorting to function-prototype
199casting - an evil that makes application code much harder to
200audit/verify and also opens the window of opportunity for stack
201corruption and other hard-to-find bugs. It also, apparently, violates
202ANSI-C.
203
204The LHASH code regards table entries as constant data. As such, it
205internally represents lh_insert()'d items with a "const void *"
206pointer type. This is why callbacks such as those used by lh_doall()
207and lh_doall_arg() declare their prototypes with "const", even for the
208parameters that pass back the table items' data pointers - for
209consistency, user-provided data is "const" at all times as far as the
210LHASH code is concerned. However, as callers are themselves providing
211these pointers, they can choose whether they too should be treating
212all such parameters as constant.
213
214As an example, a hash table may be maintained by code that, for
215reasons of encapsulation, has only "const" access to the data being
216indexed in the hash table (ie. it is returned as "const" from
217elsewhere in their code) - in this case the LHASH prototypes are
218appropriate as-is. Conversely, if the caller is responsible for the
219life-time of the data in question, then they may well wish to make
220modifications to table item passed back in the lh_doall() or
221lh_doall_arg() callbacks (see the "STUFF_cleanup" example above). If
222so, the caller can either cast the "const" away (if they're providing
223the raw callbacks themselves) or use the macros to declare/implement
224the wrapper functions without "const" types.
225
226Callers that only have "const" access to data they're indexing in a
227table, yet declare callbacks without constant types (or cast the
228"const" away themselves), are therefore creating their own risks/bugs
229without being encouraged to do so by the API. On a related note,
230those auditing code should pay special attention to any instances of
231DECLARE/IMPLEMENT_LHASH_DOALL_[ARG_]_FN macros that provide types
232without any "const" qualifiers.
233
234=head1 BUGS
235
236lh_<type>_insert() returns B<NULL> both for success and error.
237
238=head1 INTERNALS
239
240The following description is based on the SSLeay documentation:
241
242The B<lhash> library implements a hash table described in the
243I<Communications of the ACM> in 1991. What makes this hash table
244different is that as the table fills, the hash table is increased (or
245decreased) in size via OPENSSL_realloc(). When a 'resize' is done, instead of
246all hashes being redistributed over twice as many 'buckets', one
247bucket is split. So when an 'expand' is done, there is only a minimal
248cost to redistribute some values. Subsequent inserts will cause more
249single 'bucket' redistributions but there will never be a sudden large
250cost due to redistributing all the 'buckets'.
251
252The state for a particular hash table is kept in the B<LHASH> structure.
253The decision to increase or decrease the hash table size is made
254depending on the 'load' of the hash table. The load is the number of
255items in the hash table divided by the size of the hash table. The
256default values are as follows. If (hash->up_load E<lt> load) =E<gt>
257expand. if (hash-E<gt>down_load E<gt> load) =E<gt> contract. The
258B<up_load> has a default value of 1 and B<down_load> has a default value
259of 2. These numbers can be modified by the application by just
260playing with the B<up_load> and B<down_load> variables. The 'load' is
261kept in a form which is multiplied by 256. So
262hash-E<gt>up_load=8*256; will cause a load of 8 to be set.
263
264If you are interested in performance the field to watch is
265num_comp_calls. The hash library keeps track of the 'hash' value for
266each item so when a lookup is done, the 'hashes' are compared, if
267there is a match, then a full compare is done, and
268hash-E<gt>num_comp_calls is incremented. If num_comp_calls is not equal
269to num_delete plus num_retrieve it means that your hash function is
270generating hashes that are the same for different values. It is
271probably worth changing your hash function if this is the case because
272even if your hash table has 10 items in a 'bucket', it can be searched
273with 10 B<unsigned long> compares and 10 linked list traverses. This
274will be much less expensive that 10 calls to your compare function.
275
276lh_strhash() is a demo string hashing function:
277
278 unsigned long lh_strhash(const char *c);
279
280Since the B<LHASH> routines would normally be passed structures, this
281routine would not normally be passed to lh_<type>_new(), rather it would be
282used in the function passed to lh_<type>_new().
283
284=head1 SEE ALSO
285
286L<lh_stats(3)|lh_stats(3)>
287
288=head1 HISTORY
289
290The B<lhash> library is available in all versions of SSLeay and OpenSSL.
291lh_error() was added in SSLeay 0.9.1b.
292
293This manpage is derived from the SSLeay documentation.
294
295In OpenSSL 0.9.7, all lhash functions that were passed function pointers
296were changed for better type safety, and the function types LHASH_COMP_FN_TYPE,
297LHASH_HASH_FN_TYPE, LHASH_DOALL_FN_TYPE and LHASH_DOALL_ARG_FN_TYPE
298became available.
299
300In OpenSSL 1.0.0, the lhash interface was revamped for even better
301type checking.
302
303=cut
diff --git a/src/lib/libssl/src/doc/crypto/ui.pod b/src/lib/libssl/src/doc/crypto/ui.pod
deleted file mode 100644
index 6df68d604a..0000000000
--- a/src/lib/libssl/src/doc/crypto/ui.pod
+++ /dev/null
@@ -1,194 +0,0 @@
1=pod
2
3=head1 NAME
4
5UI_new, UI_new_method, UI_free, UI_add_input_string, UI_dup_input_string,
6UI_add_verify_string, UI_dup_verify_string, UI_add_input_boolean,
7UI_dup_input_boolean, UI_add_info_string, UI_dup_info_string,
8UI_add_error_string, UI_dup_error_string, UI_construct_prompt,
9UI_add_user_data, UI_get0_user_data, UI_get0_result, UI_process,
10UI_ctrl, UI_set_default_method, UI_get_default_method, UI_get_method,
11UI_set_method, UI_OpenSSL, ERR_load_UI_strings - New User Interface
12
13=head1 SYNOPSIS
14
15 #include <openssl/ui.h>
16
17 typedef struct ui_st UI;
18 typedef struct ui_method_st UI_METHOD;
19
20 UI *UI_new(void);
21 UI *UI_new_method(const UI_METHOD *method);
22 void UI_free(UI *ui);
23
24 int UI_add_input_string(UI *ui, const char *prompt, int flags,
25 char *result_buf, int minsize, int maxsize);
26 int UI_dup_input_string(UI *ui, const char *prompt, int flags,
27 char *result_buf, int minsize, int maxsize);
28 int UI_add_verify_string(UI *ui, const char *prompt, int flags,
29 char *result_buf, int minsize, int maxsize, const char *test_buf);
30 int UI_dup_verify_string(UI *ui, const char *prompt, int flags,
31 char *result_buf, int minsize, int maxsize, const char *test_buf);
32 int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc,
33 const char *ok_chars, const char *cancel_chars,
34 int flags, char *result_buf);
35 int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc,
36 const char *ok_chars, const char *cancel_chars,
37 int flags, char *result_buf);
38 int UI_add_info_string(UI *ui, const char *text);
39 int UI_dup_info_string(UI *ui, const char *text);
40 int UI_add_error_string(UI *ui, const char *text);
41 int UI_dup_error_string(UI *ui, const char *text);
42
43 /* These are the possible flags. They can be or'ed together. */
44 #define UI_INPUT_FLAG_ECHO 0x01
45 #define UI_INPUT_FLAG_DEFAULT_PWD 0x02
46
47 char *UI_construct_prompt(UI *ui_method,
48 const char *object_desc, const char *object_name);
49
50 void *UI_add_user_data(UI *ui, void *user_data);
51 void *UI_get0_user_data(UI *ui);
52
53 const char *UI_get0_result(UI *ui, int i);
54
55 int UI_process(UI *ui);
56
57 int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)());
58 #define UI_CTRL_PRINT_ERRORS 1
59 #define UI_CTRL_IS_REDOABLE 2
60
61 void UI_set_default_method(const UI_METHOD *meth);
62 const UI_METHOD *UI_get_default_method(void);
63 const UI_METHOD *UI_get_method(UI *ui);
64 const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth);
65
66 UI_METHOD *UI_OpenSSL(void);
67
68=head1 DESCRIPTION
69
70UI stands for User Interface, and is general purpose set of routines to
71prompt the user for text-based information. Through user-written methods
72(see L<ui_create(3)|ui_create(3)>), prompting can be done in any way
73imaginable, be it plain text prompting, through dialog boxes or from a
74cell phone.
75
76All the functions work through a context of the type UI. This context
77contains all the information needed to prompt correctly as well as a
78reference to a UI_METHOD, which is an ordered vector of functions that
79carry out the actual prompting.
80
81The first thing to do is to create a UI with UI_new() or UI_new_method(),
82then add information to it with the UI_add or UI_dup functions. Also,
83user-defined random data can be passed down to the underlying method
84through calls to UI_add_user_data. The default UI method doesn't care
85about these data, but other methods might. Finally, use UI_process()
86to actually perform the prompting and UI_get0_result() to find the result
87to the prompt.
88
89A UI can contain more than one prompt, which are performed in the given
90sequence. Each prompt gets an index number which is returned by the
91UI_add and UI_dup functions, and has to be used to get the corresponding
92result with UI_get0_result().
93
94The functions are as follows:
95
96UI_new() creates a new UI using the default UI method. When done with
97this UI, it should be freed using UI_free().
98
99UI_new_method() creates a new UI using the given UI method. When done with
100this UI, it should be freed using UI_free().
101
102UI_OpenSSL() returns the built-in UI method (note: not the default one,
103since the default can be changed. See further on). This method is the
104most machine/OS dependent part of OpenSSL and normally generates the
105most problems when porting.
106
107UI_free() removes a UI from memory, along with all other pieces of memory
108that's connected to it, like duplicated input strings, results and others.
109
110UI_add_input_string() and UI_add_verify_string() add a prompt to the UI,
111as well as flags and a result buffer and the desired minimum and maximum
112sizes of the result. The given information is used to prompt for
113information, for example a password, and to verify a password (i.e. having
114the user enter it twice and check that the same string was entered twice).
115UI_add_verify_string() takes and extra argument that should be a pointer
116to the result buffer of the input string that it's supposed to verify, or
117verification will fail.
118
119UI_add_input_boolean() adds a prompt to the UI that's supposed to be answered
120in a boolean way, with a single character for yes and a different character
121for no. A set of characters that can be used to cancel the prompt is given
122as well. The prompt itself is really divided in two, one part being the
123descriptive text (given through the I<prompt> argument) and one describing
124the possible answers (given through the I<action_desc> argument).
125
126UI_add_info_string() and UI_add_error_string() add strings that are shown at
127the same time as the prompt for extra information or to show an error string.
128The difference between the two is only conceptual. With the builtin method,
129there's no technical difference between them. Other methods may make a
130difference between them, however.
131
132The flags currently supported are UI_INPUT_FLAG_ECHO, which is relevant for
133UI_add_input_string() and will have the users response be echoed (when
134prompting for a password, this flag should obviously not be used, and
135UI_INPUT_FLAG_DEFAULT_PWD, which means that a default password of some
136sort will be used (completely depending on the application and the UI
137method).
138
139UI_dup_input_string(), UI_dup_verify_string(), UI_dup_input_boolean(),
140UI_dup_info_string() and UI_dup_error_string() are basically the same
141as their UI_add counterparts, except that they make their own copies
142of all strings.
143
144UI_construct_prompt() is a helper function that can be used to create
145a prompt from two pieces of information: an description and a name.
146The default constructor (if there is none provided by the method used)
147creates a string "Enter I<description> for I<name>:". With the
148description "pass phrase" and the file name "foo.key", that becomes
149"Enter pass phrase for foo.key:". Other methods may create whatever
150string and may include encodings that will be processed by the other
151method functions.
152
153UI_add_user_data() adds a piece of memory for the method to use at any
154time. The builtin UI method doesn't care about this info. Note that several
155calls to this function doesn't add data, it replaces the previous blob
156with the one given as argument.
157
158UI_get0_user_data() retrieves the data that has last been given to the
159UI with UI_add_user_data().
160
161UI_get0_result() returns a pointer to the result buffer associated with
162the information indexed by I<i>.
163
164UI_process() goes through the information given so far, does all the printing
165and prompting and returns.
166
167UI_ctrl() adds extra control for the application author. For now, it
168understands two commands: UI_CTRL_PRINT_ERRORS, which makes UI_process()
169print the OpenSSL error stack as part of processing the UI, and
170UI_CTRL_IS_REDOABLE, which returns a flag saying if the used UI can
171be used again or not.
172
173UI_set_default_method() changes the default UI method to the one given.
174
175UI_get_default_method() returns a pointer to the current default UI method.
176
177UI_get_method() returns the UI method associated with a given UI.
178
179UI_set_method() changes the UI method associated with a given UI.
180
181=head1 SEE ALSO
182
183L<ui_create(3)|ui_create(3)>, L<ui_compat(3)|ui_compat(3)>
184
185=head1 HISTORY
186
187The UI section was first introduced in OpenSSL 0.9.7.
188
189=head1 AUTHOR
190
191Richard Levitte (richard@levitte.org) for the OpenSSL project
192(http://www.openssl.org).
193
194=cut
diff --git a/src/lib/libssl/src/doc/crypto/ui_compat.pod b/src/lib/libssl/src/doc/crypto/ui_compat.pod
deleted file mode 100644
index 4ef5465539..0000000000
--- a/src/lib/libssl/src/doc/crypto/ui_compat.pod
+++ /dev/null
@@ -1,57 +0,0 @@
1=pod
2
3=head1 NAME
4
5des_read_password, des_read_2passwords, des_read_pw_string, des_read_pw -
6Compatibility user interface functions
7
8=head1 SYNOPSIS
9
10 #include <openssl/des_old.h>
11
12 int des_read_password(DES_cblock *key,const char *prompt,int verify);
13 int des_read_2passwords(DES_cblock *key1,DES_cblock *key2,
14 const char *prompt,int verify);
15
16 int des_read_pw_string(char *buf,int length,const char *prompt,int verify);
17 int des_read_pw(char *buf,char *buff,int size,const char *prompt,int verify);
18
19=head1 DESCRIPTION
20
21The DES library contained a few routines to prompt for passwords. These
22aren't necessarily dependent on DES, and have therefore become part of the
23UI compatibility library.
24
25des_read_pw() writes the string specified by I<prompt> to standard output
26turns echo off and reads an input string from the terminal. The string is
27returned in I<buf>, which must have space for at least I<size> bytes.
28If I<verify> is set, the user is asked for the password twice and unless
29the two copies match, an error is returned. The second password is stored
30in I<buff>, which must therefore also be at least I<size> bytes. A return
31code of -1 indicates a system error, 1 failure due to use interaction, and
320 is success. All other functions described here use des_read_pw() to do
33the work.
34
35des_read_pw_string() is a variant of des_read_pw() that provides a buffer
36for you if I<verify> is set.
37
38des_read_password() calls des_read_pw() and converts the password to a
39DES key by calling DES_string_to_key(); des_read_2password() operates in
40the same way as des_read_password() except that it generates two keys
41by using the DES_string_to_2key() function.
42
43=head1 NOTES
44
45des_read_pw_string() is available in the MIT Kerberos library as well, and
46is also available under the name EVP_read_pw_string().
47
48=head1 SEE ALSO
49
50L<ui(3)|ui(3)>, L<ui_create(3)|ui_create(3)>
51
52=head1 AUTHOR
53
54Richard Levitte (richard@levitte.org) for the OpenSSL project
55(http://www.openssl.org).
56
57=cut