diff options
Diffstat (limited to 'src')
33 files changed, 2658 insertions, 1241 deletions
diff --git a/src/lib/libcrypto/doc/DSA_SIG_new.pod b/src/lib/libcrypto/doc/DSA_SIG_new.pod deleted file mode 100644 index 77aa649db0..0000000000 --- a/src/lib/libcrypto/doc/DSA_SIG_new.pod +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_SIG_new, DSA_SIG_free - allocate and free DSA signature objects | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dsa.h> | ||
10 | |||
11 | DSA_SIG *DSA_SIG_new(void); | ||
12 | |||
13 | void DSA_SIG_free(DSA_SIG *a); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | DSA_SIG_new() allocates and initializes a B<DSA_SIG> structure. | ||
18 | |||
19 | DSA_SIG_free() frees the B<DSA_SIG> structure and its components. The | ||
20 | values are erased before the memory is returned to the system. | ||
21 | |||
22 | =head1 RETURN VALUES | ||
23 | |||
24 | If the allocation fails, DSA_SIG_new() returns B<NULL> and sets an | ||
25 | error code that can be obtained by | ||
26 | L<ERR_get_error(3)|ERR_get_error(3)>. Otherwise it returns a pointer | ||
27 | to the newly allocated structure. | ||
28 | |||
29 | =head1 SEE ALSO | ||
30 | |||
31 | L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, | ||
32 | L<DSA_do_sign(3)|DSA_do_sign(3)> | ||
33 | |||
34 | =head1 HISTORY | ||
35 | |||
36 | DSA_SIG_new() and DSA_SIG_free() were added in OpenSSL 0.9.3. | ||
37 | |||
38 | =cut | ||
diff --git a/src/lib/libcrypto/doc/DSA_do_sign.pod b/src/lib/libcrypto/doc/DSA_do_sign.pod deleted file mode 100644 index 5dfc733b20..0000000000 --- a/src/lib/libcrypto/doc/DSA_do_sign.pod +++ /dev/null | |||
@@ -1,47 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_do_sign, DSA_do_verify - raw DSA signature operations | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dsa.h> | ||
10 | |||
11 | DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa); | ||
12 | |||
13 | int DSA_do_verify(const unsigned char *dgst, int dgst_len, | ||
14 | DSA_SIG *sig, DSA *dsa); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | DSA_do_sign() computes a digital signature on the B<len> byte message | ||
19 | digest B<dgst> using the private key B<dsa> and returns it in a | ||
20 | newly allocated B<DSA_SIG> structure. | ||
21 | |||
22 | L<DSA_sign_setup(3)|DSA_sign_setup(3)> may be used to precompute part | ||
23 | of the signing operation in case signature generation is | ||
24 | time-critical. | ||
25 | |||
26 | DSA_do_verify() verifies that the signature B<sig> matches a given | ||
27 | message digest B<dgst> of size B<len>. B<dsa> is the signer's public | ||
28 | key. | ||
29 | |||
30 | =head1 RETURN VALUES | ||
31 | |||
32 | DSA_do_sign() returns the signature, NULL on error. DSA_do_verify() | ||
33 | returns 1 for a valid signature, 0 for an incorrect signature and -1 | ||
34 | on error. The error codes can be obtained by | ||
35 | L<ERR_get_error(3)|ERR_get_error(3)>. | ||
36 | |||
37 | =head1 SEE ALSO | ||
38 | |||
39 | L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, | ||
40 | L<DSA_SIG_new(3)|DSA_SIG_new(3)>, | ||
41 | L<DSA_sign(3)|DSA_sign(3)> | ||
42 | |||
43 | =head1 HISTORY | ||
44 | |||
45 | DSA_do_sign() and DSA_do_verify() were added in OpenSSL 0.9.3. | ||
46 | |||
47 | =cut | ||
diff --git a/src/lib/libcrypto/doc/DSA_dup_DH.pod b/src/lib/libcrypto/doc/DSA_dup_DH.pod deleted file mode 100644 index 7f6f0d1115..0000000000 --- a/src/lib/libcrypto/doc/DSA_dup_DH.pod +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_dup_DH - create a DH structure out of DSA structure | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dsa.h> | ||
10 | |||
11 | DH * DSA_dup_DH(const DSA *r); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | DSA_dup_DH() duplicates DSA parameters/keys as DH parameters/keys. q | ||
16 | is lost during that conversion, but the resulting DH parameters | ||
17 | contain its length. | ||
18 | |||
19 | =head1 RETURN VALUE | ||
20 | |||
21 | DSA_dup_DH() returns the new B<DH> structure, and NULL on error. The | ||
22 | error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
23 | |||
24 | =head1 NOTE | ||
25 | |||
26 | Be careful to avoid small subgroup attacks when using this. | ||
27 | |||
28 | =head1 SEE ALSO | ||
29 | |||
30 | L<dh(3)|dh(3)>, L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)> | ||
31 | |||
32 | =head1 HISTORY | ||
33 | |||
34 | DSA_dup_DH() was added in OpenSSL 0.9.4. | ||
35 | |||
36 | =cut | ||
diff --git a/src/lib/libcrypto/doc/DSA_generate_key.pod b/src/lib/libcrypto/doc/DSA_generate_key.pod deleted file mode 100644 index 069a05767c..0000000000 --- a/src/lib/libcrypto/doc/DSA_generate_key.pod +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_generate_key - generate DSA key pair | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dsa.h> | ||
10 | |||
11 | int DSA_generate_key(DSA *a); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | DSA_generate_key() expects B<a> to contain DSA parameters. It generates | ||
16 | a new key pair and stores it in B<a-E<gt>pub_key> and B<a-E<gt>priv_key>. | ||
17 | |||
18 | =head1 RETURN VALUE | ||
19 | |||
20 | DSA_generate_key() returns 1 on success, 0 otherwise. | ||
21 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
22 | |||
23 | =head1 SEE ALSO | ||
24 | |||
25 | L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, | ||
26 | L<DSA_generate_parameters(3)|DSA_generate_parameters(3)> | ||
27 | |||
28 | =head1 HISTORY | ||
29 | |||
30 | DSA_generate_key() is available since SSLeay 0.8. | ||
31 | |||
32 | =cut | ||
diff --git a/src/lib/libcrypto/doc/DSA_generate_parameters.pod b/src/lib/libcrypto/doc/DSA_generate_parameters.pod deleted file mode 100644 index 698b555a0e..0000000000 --- a/src/lib/libcrypto/doc/DSA_generate_parameters.pod +++ /dev/null | |||
@@ -1,122 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_generate_parameters_ex, DSA_generate_parameters - generate DSA parameters | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dsa.h> | ||
10 | |||
11 | int DSA_generate_parameters_ex(DSA *dsa, int bits, | ||
12 | const unsigned char *seed,int seed_len, | ||
13 | int *counter_ret, unsigned long *h_ret, BN_GENCB *cb); | ||
14 | |||
15 | Deprecated: | ||
16 | |||
17 | DSA *DSA_generate_parameters(int bits, unsigned char *seed, | ||
18 | int seed_len, int *counter_ret, unsigned long *h_ret, | ||
19 | void (*callback)(int, int, void *), void *cb_arg); | ||
20 | |||
21 | =head1 DESCRIPTION | ||
22 | |||
23 | DSA_generate_parameters_ex() generates primes p and q and a generator g | ||
24 | for use in the DSA and stores the result in B<dsa>. | ||
25 | |||
26 | B<bits> is the length of the prime to be generated; the DSS allows a | ||
27 | maximum of 1024 bits. | ||
28 | |||
29 | If B<seed> is B<NULL> or B<seed_len> E<lt> 20, the primes will be | ||
30 | generated at random. Otherwise, the seed is used to generate | ||
31 | them. If the given seed does not yield a prime q, a new random | ||
32 | seed is chosen and placed at B<seed>. | ||
33 | |||
34 | DSA_generate_parameters_ex() places the iteration count in | ||
35 | *B<counter_ret> and a counter used for finding a generator in | ||
36 | *B<h_ret>, unless these are B<NULL>. | ||
37 | |||
38 | A callback function may be used to provide feedback about the progress | ||
39 | of the key generation. If B<cb> is not B<NULL>, it will be | ||
40 | called as shown below. For information on the BN_GENCB structure and the | ||
41 | BN_GENCB_call function discussed below, refer to | ||
42 | L<BN_generate_prime(3)|BN_generate_prime(3)>. | ||
43 | |||
44 | =over 4 | ||
45 | |||
46 | =item * | ||
47 | |||
48 | When a candidate for q is generated, B<BN_GENCB_call(cb, 0, m++)> is called | ||
49 | (m is 0 for the first candidate). | ||
50 | |||
51 | =item * | ||
52 | |||
53 | When a candidate for q has passed a test by trial division, | ||
54 | B<BN_GENCB_call(cb, 1, -1)> is called. | ||
55 | While a candidate for q is tested by Miller-Rabin primality tests, | ||
56 | B<BN_GENCB_call(cb, 1, i)> is called in the outer loop | ||
57 | (once for each witness that confirms that the candidate may be prime); | ||
58 | i is the loop counter (starting at 0). | ||
59 | |||
60 | =item * | ||
61 | |||
62 | When a prime q has been found, B<BN_GENCB_call(cb, 2, 0)> and | ||
63 | B<BN_GENCB_call(cb, 3, 0)> are called. | ||
64 | |||
65 | =item * | ||
66 | |||
67 | Before a candidate for p (other than the first) is generated and tested, | ||
68 | B<BN_GENCB_call(cb, 0, counter)> is called. | ||
69 | |||
70 | =item * | ||
71 | |||
72 | When a candidate for p has passed the test by trial division, | ||
73 | B<BN_GENCB_call(cb, 1, -1)> is called. | ||
74 | While it is tested by the Miller-Rabin primality test, | ||
75 | B<BN_GENCB_call(cb, 1, i)> is called in the outer loop | ||
76 | (once for each witness that confirms that the candidate may be prime). | ||
77 | i is the loop counter (starting at 0). | ||
78 | |||
79 | =item * | ||
80 | |||
81 | When p has been found, B<BN_GENCB_call(cb, 2, 1)> is called. | ||
82 | |||
83 | =item * | ||
84 | |||
85 | When the generator has been found, B<BN_GENCB_call(cb, 3, 1)> is called. | ||
86 | |||
87 | =back | ||
88 | |||
89 | DSA_generate_parameters() (deprecated) works in much the same way as for DSA_generate_parameters_ex, except that no B<dsa> parameter is passed and | ||
90 | instead a newly allocated B<DSA> structure is returned. Additionally "old | ||
91 | style" callbacks are used instead of the newer BN_GENCB based approach. | ||
92 | Refer to L<BN_generate_prime(3)|BN_generate_prime(3)> for further information. | ||
93 | |||
94 | =head1 RETURN VALUE | ||
95 | |||
96 | DSA_generate_parameters_ex() returns a 1 on success, or 0 otherwise. | ||
97 | |||
98 | DSA_generate_parameters() returns a pointer to the DSA structure, or | ||
99 | B<NULL> if the parameter generation fails. | ||
100 | |||
101 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
102 | |||
103 | =head1 BUGS | ||
104 | |||
105 | Seed lengths E<gt> 20 are not supported. | ||
106 | |||
107 | =head1 SEE ALSO | ||
108 | |||
109 | L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, | ||
110 | L<DSA_free(3)|DSA_free(3)>, L<BN_generate_prime(3)|BN_generate_prime(3)> | ||
111 | |||
112 | =head1 HISTORY | ||
113 | |||
114 | DSA_generate_parameters() appeared in SSLeay 0.8. The B<cb_arg> | ||
115 | argument was added in SSLeay 0.9.0. | ||
116 | In versions up to OpenSSL 0.9.4, B<callback(1, ...)> was called | ||
117 | in the inner loop of the Miller-Rabin test whenever it reached the | ||
118 | squaring step (the parameters to B<callback> did not reveal how many | ||
119 | witnesses had been tested); since OpenSSL 0.9.5, B<callback(1, ...)> | ||
120 | is called as in BN_is_prime(3), i.e. once for each witness. | ||
121 | |||
122 | =cut | ||
diff --git a/src/lib/libcrypto/doc/DSA_get_ex_new_index.pod b/src/lib/libcrypto/doc/DSA_get_ex_new_index.pod deleted file mode 100644 index e2fcabf370..0000000000 --- a/src/lib/libcrypto/doc/DSA_get_ex_new_index.pod +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_get_ex_new_index, DSA_set_ex_data, DSA_get_ex_data - add application | ||
6 | specific data to DSA structures | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/dsa.h> | ||
11 | |||
12 | int DSA_get_ex_new_index(long argl, void *argp, | ||
13 | CRYPTO_EX_new *new_func, | ||
14 | CRYPTO_EX_dup *dup_func, | ||
15 | CRYPTO_EX_free *free_func); | ||
16 | |||
17 | int DSA_set_ex_data(DSA *d, int idx, void *arg); | ||
18 | |||
19 | char *DSA_get_ex_data(DSA *d, int idx); | ||
20 | |||
21 | =head1 DESCRIPTION | ||
22 | |||
23 | These functions handle application specific data in DSA | ||
24 | structures. Their usage is identical to that of | ||
25 | RSA_get_ex_new_index(), RSA_set_ex_data() and RSA_get_ex_data() | ||
26 | as described in L<RSA_get_ex_new_index(3)>. | ||
27 | |||
28 | =head1 SEE ALSO | ||
29 | |||
30 | L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, L<dsa(3)|dsa(3)> | ||
31 | |||
32 | =head1 HISTORY | ||
33 | |||
34 | DSA_get_ex_new_index(), DSA_set_ex_data() and DSA_get_ex_data() are | ||
35 | available since OpenSSL 0.9.5. | ||
36 | |||
37 | =cut | ||
diff --git a/src/lib/libcrypto/doc/DSA_new.pod b/src/lib/libcrypto/doc/DSA_new.pod deleted file mode 100644 index e1e30b9a07..0000000000 --- a/src/lib/libcrypto/doc/DSA_new.pod +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_new, DSA_free - allocate and free DSA objects | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dsa.h> | ||
10 | |||
11 | DSA* DSA_new(void); | ||
12 | |||
13 | void DSA_free(DSA *dsa); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | DSA_new() allocates and initializes a B<DSA> structure. It is equivalent to | ||
18 | calling DSA_new_method(NULL). | ||
19 | |||
20 | DSA_free() frees the B<DSA> structure and its components. The values are | ||
21 | erased before the memory is returned to the system. | ||
22 | |||
23 | =head1 RETURN VALUES | ||
24 | |||
25 | If the allocation fails, DSA_new() returns B<NULL> and sets an error | ||
26 | code that can be obtained by | ||
27 | L<ERR_get_error(3)|ERR_get_error(3)>. Otherwise it returns a pointer | ||
28 | to the newly allocated structure. | ||
29 | |||
30 | =head1 SEE ALSO | ||
31 | |||
32 | L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, | ||
33 | L<DSA_generate_parameters(3)|DSA_generate_parameters(3)>, | ||
34 | L<DSA_generate_key(3)|DSA_generate_key(3)> | ||
35 | |||
36 | =head1 HISTORY | ||
37 | |||
38 | DSA_new() and DSA_free() are available in all versions of SSLeay and OpenSSL. | ||
39 | |||
40 | =cut | ||
diff --git a/src/lib/libcrypto/doc/DSA_set_method.pod b/src/lib/libcrypto/doc/DSA_set_method.pod deleted file mode 100644 index bc57a3e8e2..0000000000 --- a/src/lib/libcrypto/doc/DSA_set_method.pod +++ /dev/null | |||
@@ -1,143 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_set_default_method, DSA_get_default_method, | ||
6 | DSA_set_method, DSA_new_method, DSA_OpenSSL, | ||
7 | DSA_set_default_openssl_method, DSA_get_default_openssl_method | ||
8 | - select DSA method | ||
9 | |||
10 | =head1 SYNOPSIS | ||
11 | |||
12 | #include <openssl/dsa.h> | ||
13 | #include <openssl/engine.h> | ||
14 | |||
15 | void DSA_set_default_method(const DSA_METHOD *meth); | ||
16 | |||
17 | const DSA_METHOD *DSA_get_default_method(void); | ||
18 | |||
19 | int DSA_set_method(DSA *dsa, const DSA_METHOD *meth); | ||
20 | |||
21 | DSA *DSA_new_method(ENGINE *engine); | ||
22 | |||
23 | DSA_METHOD *DSA_OpenSSL(void); | ||
24 | |||
25 | =head1 DESCRIPTION | ||
26 | |||
27 | A B<DSA_METHOD> specifies the functions that OpenSSL uses for DSA | ||
28 | operations. By modifying the method, alternative implementations | ||
29 | such as hardware accelerators may be used. IMPORTANT: See the NOTES section for | ||
30 | important information about how these DSA API functions are affected by the use | ||
31 | of B<ENGINE> API calls. | ||
32 | |||
33 | Initially, the default DSA_METHOD is the OpenSSL internal implementation, | ||
34 | as returned by DSA_OpenSSL(). | ||
35 | |||
36 | DSA_set_default_method() makes B<meth> the default method for all DSA | ||
37 | structures created later. B<NB>: This is true only whilst no ENGINE has | ||
38 | been set as a default for DSA, so this function is no longer recommended. | ||
39 | |||
40 | DSA_get_default_method() returns a pointer to the current default | ||
41 | DSA_METHOD. However, the meaningfulness of this result is dependent on | ||
42 | whether the ENGINE API is being used, so this function is no longer | ||
43 | recommended. | ||
44 | |||
45 | DSA_set_method() selects B<meth> to perform all operations using the key | ||
46 | B<rsa>. This will replace the DSA_METHOD used by the DSA key and if the | ||
47 | previous method was supplied by an ENGINE, the handle to that ENGINE will | ||
48 | be released during the change. It is possible to have DSA keys that only | ||
49 | work with certain DSA_METHOD implementations (eg. from an ENGINE module | ||
50 | that supports embedded hardware-protected keys), and in such cases | ||
51 | attempting to change the DSA_METHOD for the key can have unexpected | ||
52 | results. | ||
53 | |||
54 | DSA_new_method() allocates and initializes a DSA structure so that B<engine> | ||
55 | will be used for the DSA operations. If B<engine> is NULL, the default engine | ||
56 | for DSA operations is used, and if no default ENGINE is set, the DSA_METHOD | ||
57 | controlled by DSA_set_default_method() is used. | ||
58 | |||
59 | =head1 THE DSA_METHOD STRUCTURE | ||
60 | |||
61 | struct | ||
62 | { | ||
63 | /* name of the implementation */ | ||
64 | const char *name; | ||
65 | |||
66 | /* sign */ | ||
67 | DSA_SIG *(*dsa_do_sign)(const unsigned char *dgst, int dlen, | ||
68 | DSA *dsa); | ||
69 | |||
70 | /* pre-compute k^-1 and r */ | ||
71 | int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, | ||
72 | BIGNUM **rp); | ||
73 | |||
74 | /* verify */ | ||
75 | int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len, | ||
76 | DSA_SIG *sig, DSA *dsa); | ||
77 | |||
78 | /* compute rr = a1^p1 * a2^p2 mod m (May be NULL for some | ||
79 | implementations) */ | ||
80 | int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, | ||
81 | BIGNUM *a2, BIGNUM *p2, BIGNUM *m, | ||
82 | BN_CTX *ctx, BN_MONT_CTX *in_mont); | ||
83 | |||
84 | /* compute r = a ^ p mod m (May be NULL for some implementations) */ | ||
85 | int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a, | ||
86 | const BIGNUM *p, const BIGNUM *m, | ||
87 | BN_CTX *ctx, BN_MONT_CTX *m_ctx); | ||
88 | |||
89 | /* called at DSA_new */ | ||
90 | int (*init)(DSA *DSA); | ||
91 | |||
92 | /* called at DSA_free */ | ||
93 | int (*finish)(DSA *DSA); | ||
94 | |||
95 | int flags; | ||
96 | |||
97 | char *app_data; /* ?? */ | ||
98 | |||
99 | } DSA_METHOD; | ||
100 | |||
101 | =head1 RETURN VALUES | ||
102 | |||
103 | DSA_OpenSSL() and DSA_get_default_method() return pointers to the respective | ||
104 | B<DSA_METHOD>s. | ||
105 | |||
106 | DSA_set_method() returns non-zero if the provided B<meth> was successfully set | ||
107 | as the method for B<dsa> (including unloading the ENGINE handle if the previous | ||
108 | method was supplied by an ENGINE). | ||
109 | |||
110 | DSA_new_method() returns NULL and sets an error code that can be | ||
111 | obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation | ||
112 | fails. Otherwise it returns a pointer to the newly allocated structure. | ||
113 | |||
114 | =head1 NOTES | ||
115 | |||
116 | As of version 0.9.7, DSA_METHOD implementations are grouped together with other | ||
117 | algorithmic APIs (eg. RSA_METHOD, EVP_CIPHER, etc) in B<ENGINE> modules. If a | ||
118 | default ENGINE is specified for DSA functionality using an ENGINE API function, | ||
119 | that will override any DSA defaults set using the DSA API (ie. | ||
120 | DSA_set_default_method()). For this reason, the ENGINE API is the recommended | ||
121 | way to control default implementations for use in DSA and other cryptographic | ||
122 | algorithms. | ||
123 | |||
124 | =head1 SEE ALSO | ||
125 | |||
126 | L<dsa(3)|dsa(3)>, L<DSA_new(3)|DSA_new(3)> | ||
127 | |||
128 | =head1 HISTORY | ||
129 | |||
130 | DSA_set_default_method(), DSA_get_default_method(), DSA_set_method(), | ||
131 | DSA_new_method() and DSA_OpenSSL() were added in OpenSSL 0.9.4. | ||
132 | |||
133 | DSA_set_default_openssl_method() and DSA_get_default_openssl_method() replaced | ||
134 | DSA_set_default_method() and DSA_get_default_method() respectively, and | ||
135 | DSA_set_method() and DSA_new_method() were altered to use B<ENGINE>s rather than | ||
136 | B<DSA_METHOD>s during development of the engine version of OpenSSL 0.9.6. For | ||
137 | 0.9.7, the handling of defaults in the ENGINE API was restructured so that this | ||
138 | change was reversed, and behaviour of the other functions resembled more closely | ||
139 | the previous behaviour. The behaviour of defaults in the ENGINE API now | ||
140 | transparently overrides the behaviour of defaults in the DSA API without | ||
141 | requiring changing these function prototypes. | ||
142 | |||
143 | =cut | ||
diff --git a/src/lib/libcrypto/doc/DSA_sign.pod b/src/lib/libcrypto/doc/DSA_sign.pod deleted file mode 100644 index 4e78a71390..0000000000 --- a/src/lib/libcrypto/doc/DSA_sign.pod +++ /dev/null | |||
@@ -1,63 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_sign, DSA_sign_setup, DSA_verify - DSA signatures | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dsa.h> | ||
10 | |||
11 | int DSA_sign(int type, const unsigned char *dgst, int len, | ||
12 | unsigned char *sigret, unsigned int *siglen, DSA *dsa); | ||
13 | |||
14 | int DSA_sign_setup(DSA *dsa, BN_CTX *ctx, BIGNUM **kinvp, | ||
15 | BIGNUM **rp); | ||
16 | |||
17 | int DSA_verify(int type, const unsigned char *dgst, int len, | ||
18 | unsigned char *sigbuf, int siglen, DSA *dsa); | ||
19 | |||
20 | =head1 DESCRIPTION | ||
21 | |||
22 | DSA_sign() computes a digital signature on the B<len> byte message | ||
23 | digest B<dgst> using the private key B<dsa> and places its ASN.1 DER | ||
24 | encoding at B<sigret>. The length of the signature is places in | ||
25 | *B<siglen>. B<sigret> must point to DSA_size(B<dsa>) bytes of memory. | ||
26 | |||
27 | DSA_sign_setup() may be used to precompute part of the signing | ||
28 | operation in case signature generation is time-critical. It expects | ||
29 | B<dsa> to contain DSA parameters. It places the precomputed values | ||
30 | in newly allocated B<BIGNUM>s at *B<kinvp> and *B<rp>, after freeing | ||
31 | the old ones unless *B<kinvp> and *B<rp> are NULL. These values may | ||
32 | be passed to DSA_sign() in B<dsa-E<gt>kinv> and B<dsa-E<gt>r>. | ||
33 | B<ctx> is a pre-allocated B<BN_CTX> or NULL. | ||
34 | |||
35 | DSA_verify() verifies that the signature B<sigbuf> of size B<siglen> | ||
36 | matches a given message digest B<dgst> of size B<len>. | ||
37 | B<dsa> is the signer's public key. | ||
38 | |||
39 | The B<type> parameter is ignored. | ||
40 | |||
41 | =head1 RETURN VALUES | ||
42 | |||
43 | DSA_sign() and DSA_sign_setup() return 1 on success, 0 on error. | ||
44 | DSA_verify() returns 1 for a valid signature, 0 for an incorrect | ||
45 | signature and -1 on error. The error codes can be obtained by | ||
46 | L<ERR_get_error(3)|ERR_get_error(3)>. | ||
47 | |||
48 | =head1 CONFORMING TO | ||
49 | |||
50 | US Federal Information Processing Standard FIPS 186 (Digital Signature | ||
51 | Standard, DSS), ANSI X9.30 | ||
52 | |||
53 | =head1 SEE ALSO | ||
54 | |||
55 | L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, | ||
56 | L<DSA_do_sign(3)|DSA_do_sign(3)> | ||
57 | |||
58 | =head1 HISTORY | ||
59 | |||
60 | DSA_sign() and DSA_verify() are available in all versions of SSLeay. | ||
61 | DSA_sign_setup() was added in SSLeay 0.8. | ||
62 | |||
63 | =cut | ||
diff --git a/src/lib/libcrypto/doc/DSA_size.pod b/src/lib/libcrypto/doc/DSA_size.pod deleted file mode 100644 index ba4f650361..0000000000 --- a/src/lib/libcrypto/doc/DSA_size.pod +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | DSA_size - get DSA signature size | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/dsa.h> | ||
10 | |||
11 | int DSA_size(const DSA *dsa); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | This function returns the size of an ASN.1 encoded DSA signature in | ||
16 | bytes. It can be used to determine how much memory must be allocated | ||
17 | for a DSA signature. | ||
18 | |||
19 | B<dsa-E<gt>q> must not be B<NULL>. | ||
20 | |||
21 | =head1 RETURN VALUE | ||
22 | |||
23 | The size in bytes. | ||
24 | |||
25 | =head1 SEE ALSO | ||
26 | |||
27 | L<dsa(3)|dsa(3)>, L<DSA_sign(3)|DSA_sign(3)> | ||
28 | |||
29 | =head1 HISTORY | ||
30 | |||
31 | DSA_size() is available in all versions of SSLeay and OpenSSL. | ||
32 | |||
33 | =cut | ||
diff --git a/src/lib/libcrypto/doc/EC_GFp_simple_method.pod b/src/lib/libcrypto/doc/EC_GFp_simple_method.pod deleted file mode 100644 index aff20ac175..0000000000 --- a/src/lib/libcrypto/doc/EC_GFp_simple_method.pod +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EC_GFp_simple_method, EC_GFp_mont_method, EC_GFp_nist_method, EC_GFp_nistp224_method, EC_GFp_nistp256_method, EC_GFp_nistp521_method, EC_GF2m_simple_method, EC_METHOD_get_field_type - Functions for obtaining B<EC_METHOD> objects. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ec.h> | ||
10 | |||
11 | const EC_METHOD *EC_GFp_simple_method(void); | ||
12 | const EC_METHOD *EC_GFp_mont_method(void); | ||
13 | const EC_METHOD *EC_GFp_nist_method(void); | ||
14 | const EC_METHOD *EC_GFp_nistp224_method(void); | ||
15 | const EC_METHOD *EC_GFp_nistp256_method(void); | ||
16 | const EC_METHOD *EC_GFp_nistp521_method(void); | ||
17 | |||
18 | const EC_METHOD *EC_GF2m_simple_method(void); | ||
19 | |||
20 | int EC_METHOD_get_field_type(const EC_METHOD *meth); | ||
21 | |||
22 | =head1 DESCRIPTION | ||
23 | |||
24 | The Elliptic Curve library provides a number of different implementations through a single common interface. | ||
25 | When constructing a curve using EC_GROUP_new (see L<EC_GROUP_new(3)|EC_GROUP_new(3)>) an | ||
26 | implementation method must be provided. The functions described here all return a const pointer to an | ||
27 | B<EC_METHOD> structure that can be passed to EC_GROUP_NEW. It is important that the correct implementation | ||
28 | type for the form of curve selected is used. | ||
29 | |||
30 | For F2^m curves there is only one implementation choice, i.e. EC_GF2_simple_method. | ||
31 | |||
32 | For Fp curves the lowest common denominator implementation is the EC_GFp_simple_method implementation. All | ||
33 | other implementations are based on this one. EC_GFp_mont_method builds on EC_GFp_simple_method but adds the | ||
34 | use of montgomery multiplication (see L<BN_mod_mul_montgomery(3)|BN_mod_mul_montgomery(3)>). EC_GFp_nist_method | ||
35 | offers an implementation optimised for use with NIST recommended curves (NIST curves are available through | ||
36 | EC_GROUP_new_by_curve_name as described in L<EC_GROUP_new(3)|EC_GROUP_new(3)>). | ||
37 | |||
38 | The functions EC_GFp_nistp224_method, EC_GFp_nistp256_method and EC_GFp_nistp521_method offer 64 bit | ||
39 | optimised implementations for the NIST P224, P256 and P521 curves respectively. Note, however, that these | ||
40 | implementations are not available on all platforms. | ||
41 | |||
42 | EC_METHOD_get_field_type identifies what type of field the EC_METHOD structure supports, which will be either | ||
43 | F2^m or Fp. If the field type is Fp then the value B<NID_X9_62_prime_field> is returned. If the field type is | ||
44 | F2^m then the value B<NID_X9_62_characteristic_two_field> is returned. These values are defined in the | ||
45 | obj_mac.h header file. | ||
46 | |||
47 | =head1 RETURN VALUES | ||
48 | |||
49 | All EC_GFp* functions and EC_GF2m_simple_method always return a const pointer to an EC_METHOD structure. | ||
50 | |||
51 | EC_METHOD_get_field_type returns an integer that identifies the type of field the EC_METHOD structure supports. | ||
52 | |||
53 | =head1 SEE ALSO | ||
54 | |||
55 | L<crypto(3)|crypto(3)>, L<ec(3)|ec(3)>, L<EC_GROUP_new(3)|EC_GROUP_new(3)>, L<EC_GROUP_copy(3)|EC_GROUP_copy(3)>, | ||
56 | L<EC_POINT_new(3)|EC_POINT_new(3)>, L<EC_POINT_add(3)|EC_POINT_add(3)>, L<EC_KEY_new(3)|EC_KEY_new(3)>, | ||
57 | L<d2i_ECPKParameters(3)|d2i_ECPKParameters(3)>, | ||
58 | L<BN_mod_mul_montgomery(3)|BN_mod_mul_montgomery(3)> | ||
59 | |||
60 | =cut | ||
diff --git a/src/lib/libcrypto/doc/EC_GROUP_copy.pod b/src/lib/libcrypto/doc/EC_GROUP_copy.pod deleted file mode 100644 index d4896af1d5..0000000000 --- a/src/lib/libcrypto/doc/EC_GROUP_copy.pod +++ /dev/null | |||
@@ -1,174 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EC_GROUP_copy, EC_GROUP_dup, EC_GROUP_method_of, EC_GROUP_set_generator, EC_GROUP_get0_generator, EC_GROUP_get_order, EC_GROUP_get_cofactor, EC_GROUP_set_curve_name, EC_GROUP_get_curve_name, EC_GROUP_set_asn1_flag, EC_GROUP_get_asn1_flag, EC_GROUP_set_point_conversion_form, EC_GROUP_get_point_conversion_form, EC_GROUP_get0_seed, EC_GROUP_get_seed_len, EC_GROUP_set_seed, EC_GROUP_get_degree, EC_GROUP_check, EC_GROUP_check_discriminant, EC_GROUP_cmp, EC_GROUP_get_basis_type, EC_GROUP_get_trinomial_basis, EC_GROUP_get_pentanomial_basis - Functions for manipulating B<EC_GROUP> objects. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ec.h> | ||
10 | #include <openssl/bn.h> | ||
11 | |||
12 | int EC_GROUP_copy(EC_GROUP *dst, const EC_GROUP *src); | ||
13 | EC_GROUP *EC_GROUP_dup(const EC_GROUP *src); | ||
14 | |||
15 | const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group); | ||
16 | |||
17 | int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor); | ||
18 | const EC_POINT *EC_GROUP_get0_generator(const EC_GROUP *group); | ||
19 | |||
20 | int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx); | ||
21 | int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx); | ||
22 | |||
23 | void EC_GROUP_set_curve_name(EC_GROUP *group, int nid); | ||
24 | int EC_GROUP_get_curve_name(const EC_GROUP *group); | ||
25 | |||
26 | void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag); | ||
27 | int EC_GROUP_get_asn1_flag(const EC_GROUP *group); | ||
28 | |||
29 | void EC_GROUP_set_point_conversion_form(EC_GROUP *group, point_conversion_form_t form); | ||
30 | point_conversion_form_t EC_GROUP_get_point_conversion_form(const EC_GROUP *); | ||
31 | |||
32 | unsigned char *EC_GROUP_get0_seed(const EC_GROUP *x); | ||
33 | size_t EC_GROUP_get_seed_len(const EC_GROUP *); | ||
34 | size_t EC_GROUP_set_seed(EC_GROUP *, const unsigned char *, size_t len); | ||
35 | |||
36 | int EC_GROUP_get_degree(const EC_GROUP *group); | ||
37 | |||
38 | int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx); | ||
39 | |||
40 | int EC_GROUP_check_discriminant(const EC_GROUP *group, BN_CTX *ctx); | ||
41 | |||
42 | int EC_GROUP_cmp(const EC_GROUP *a, const EC_GROUP *b, BN_CTX *ctx); | ||
43 | |||
44 | int EC_GROUP_get_basis_type(const EC_GROUP *); | ||
45 | int EC_GROUP_get_trinomial_basis(const EC_GROUP *, unsigned int *k); | ||
46 | int EC_GROUP_get_pentanomial_basis(const EC_GROUP *, unsigned int *k1, | ||
47 | unsigned int *k2, unsigned int *k3); | ||
48 | |||
49 | =head1 DESCRIPTION | ||
50 | |||
51 | EC_GROUP_copy copies the curve B<src> into B<dst>. Both B<src> and B<dst> must use the same EC_METHOD. | ||
52 | |||
53 | EC_GROUP_dup creates a new EC_GROUP object and copies the content from B<src> to the newly created | ||
54 | EC_GROUP object. | ||
55 | |||
56 | EC_GROUP_method_of obtains the EC_METHOD of B<group>. | ||
57 | |||
58 | EC_GROUP_set_generator sets curve paramaters that must be agreed by all participants using the curve. These | ||
59 | paramaters include the B<generator>, the B<order> and the B<cofactor>. The B<generator> is a well defined point on the | ||
60 | curve chosen for cryptographic operations. Integers used for point multiplications will be between 0 and | ||
61 | n-1 where n is the B<order>. The B<order> multipied by the B<cofactor> gives the number of points on the curve. | ||
62 | |||
63 | EC_GROUP_get0_generator returns the generator for the identified B<group>. | ||
64 | |||
65 | The functions EC_GROUP_get_order and EC_GROUP_get_cofactor populate the provided B<order> and B<cofactor> parameters | ||
66 | with the respective order and cofactors for the B<group>. | ||
67 | |||
68 | The functions EC_GROUP_set_curve_name and EC_GROUP_get_curve_name, set and get the NID for the curve respectively | ||
69 | (see L<EC_GROUP_new(3)|EC_GROUP_new(3)>). If a curve does not have a NID associated with it, then EC_GROUP_get_curve_name | ||
70 | will return 0. | ||
71 | |||
72 | The asn1_flag value on a curve is used to determine whether there is a specific ASN1 OID to describe the curve or not. | ||
73 | If the asn1_flag is 1 then this is a named curve with an associated ASN1 OID. If not then asn1_flag is 0. The functions | ||
74 | EC_GROUP_get_asn1_flag and EC_GROUP_set_asn1_flag get and set the status of the asn1_flag for the curve. If set then | ||
75 | the curve_name must also be set. | ||
76 | |||
77 | The point_conversion_form for a curve controls how EC_POINT data is encoded as ASN1 as defined in X9.62 (ECDSA). | ||
78 | point_conversion_form_t is an enum defined as follows: | ||
79 | |||
80 | typedef enum { | ||
81 | /** the point is encoded as z||x, where the octet z specifies | ||
82 | * which solution of the quadratic equation y is */ | ||
83 | POINT_CONVERSION_COMPRESSED = 2, | ||
84 | /** the point is encoded as z||x||y, where z is the octet 0x02 */ | ||
85 | POINT_CONVERSION_UNCOMPRESSED = 4, | ||
86 | /** the point is encoded as z||x||y, where the octet z specifies | ||
87 | * which solution of the quadratic equation y is */ | ||
88 | POINT_CONVERSION_HYBRID = 6 | ||
89 | } point_conversion_form_t; | ||
90 | |||
91 | |||
92 | For POINT_CONVERSION_UNCOMPRESSED the point is encoded as an octet signifying the UNCOMPRESSED form has been used followed by | ||
93 | the octets for x, followed by the octets for y. | ||
94 | |||
95 | For any given x co-ordinate for a point on a curve it is possible to derive two possible y values. For | ||
96 | POINT_CONVERSION_COMPRESSED the point is encoded as an octet signifying that the COMPRESSED form has been used AND which of | ||
97 | the two possible solutions for y has been used, followed by the octets for x. | ||
98 | |||
99 | For POINT_CONVERSION_HYBRID the point is encoded as an octet signifying the HYBRID form has been used AND which of the two | ||
100 | possible solutions for y has been used, followed by the octets for x, followed by the octets for y. | ||
101 | |||
102 | The functions EC_GROUP_set_point_conversion_form and EC_GROUP_get_point_conversion_form set and get the point_conversion_form | ||
103 | for the curve respectively. | ||
104 | |||
105 | ANSI X9.62 (ECDSA standard) defines a method of generating the curve parameter b from a random number. This provides advantages | ||
106 | in that a parameter obtained in this way is highly unlikely to be susceptible to special purpose attacks, or have any trapdoors in it. | ||
107 | If the seed is present for a curve then the b parameter was generated in a verifiable fashion using that seed. The OpenSSL EC library | ||
108 | does not use this seed value but does enable you to inspect it using EC_GROUP_get0_seed. This returns a pointer to a memory block | ||
109 | containing the seed that was used. The length of the memory block can be obtained using EC_GROUP_get_seed_len. A number of the | ||
110 | builtin curves within the library provide seed values that can be obtained. It is also possible to set a custom seed using | ||
111 | EC_GROUP_set_seed and passing a pointer to a memory block, along with the length of the seed. Again, the EC library will not use | ||
112 | this seed value, although it will be preserved in any ASN1 based communications. | ||
113 | |||
114 | EC_GROUP_get_degree gets the degree of the field. For Fp fields this will be the number of bits in p. For F2^m fields this will be | ||
115 | the value m. | ||
116 | |||
117 | The function EC_GROUP_check_discriminant calculates the discriminant for the curve and verifies that it is valid. | ||
118 | For a curve defined over Fp the discriminant is given by the formula 4*a^3 + 27*b^2 whilst for F2^m curves the discriminant is | ||
119 | simply b. In either case for the curve to be valid the discriminant must be non zero. | ||
120 | |||
121 | The function EC_GROUP_check performs a number of checks on a curve to verify that it is valid. Checks performed include | ||
122 | verifying that the discriminant is non zero; that a generator has been defined; that the generator is on the curve and has | ||
123 | the correct order. | ||
124 | |||
125 | EC_GROUP_cmp compares B<a> and B<b> to determine whether they represent the same curve or not. | ||
126 | |||
127 | The functions EC_GROUP_get_basis_type, EC_GROUP_get_trinomial_basis and EC_GROUP_get_pentanomial_basis should only be called for curves | ||
128 | defined over an F2^m field. Addition and multiplication operations within an F2^m field are performed using an irreducible polynomial | ||
129 | function f(x). This function is either a trinomial of the form: | ||
130 | |||
131 | f(x) = x^m + x^k + 1 with m > k >= 1 | ||
132 | |||
133 | or a pentanomial of the form: | ||
134 | |||
135 | f(x) = x^m + x^k3 + x^k2 + x^k1 + 1 with m > k3 > k2 > k1 >= 1 | ||
136 | |||
137 | The function EC_GROUP_get_basis_type returns a NID identifying whether a trinomial or pentanomial is in use for the field. The | ||
138 | function EC_GROUP_get_trinomial_basis must only be called where f(x) is of the trinomial form, and returns the value of B<k>. Similarly | ||
139 | the function EC_GROUP_get_pentanomial_basis must only be called where f(x) is of the pentanomial form, and returns the values of B<k1>, | ||
140 | B<k2> and B<k3> respectively. | ||
141 | |||
142 | =head1 RETURN VALUES | ||
143 | |||
144 | The following functions return 1 on success or 0 on error: EC_GROUP_copy, EC_GROUP_set_generator, EC_GROUP_check, | ||
145 | EC_GROUP_check_discriminant, EC_GROUP_get_trinomial_basis and EC_GROUP_get_pentanomial_basis. | ||
146 | |||
147 | EC_GROUP_dup returns a pointer to the duplicated curve, or NULL on error. | ||
148 | |||
149 | EC_GROUP_method_of returns the EC_METHOD implementation in use for the given curve or NULL on error. | ||
150 | |||
151 | EC_GROUP_get0_generator returns the generator for the given curve or NULL on error. | ||
152 | |||
153 | EC_GROUP_get_order, EC_GROUP_get_cofactor, EC_GROUP_get_curve_name, EC_GROUP_get_asn1_flag, EC_GROUP_get_point_conversion_form | ||
154 | and EC_GROUP_get_degree return the order, cofactor, curve name (NID), ASN1 flag, point_conversion_form and degree for the | ||
155 | specified curve respectively. If there is no curve name associated with a curve then EC_GROUP_get_curve_name will return 0. | ||
156 | |||
157 | EC_GROUP_get0_seed returns a pointer to the seed that was used to generate the parameter b, or NULL if the seed is not | ||
158 | specified. EC_GROUP_get_seed_len returns the length of the seed or 0 if the seed is not specified. | ||
159 | |||
160 | EC_GROUP_set_seed returns the length of the seed that has been set. If the supplied seed is NULL, or the supplied seed length is | ||
161 | 0, the return value will be 1. On error 0 is returned. | ||
162 | |||
163 | EC_GROUP_cmp returns 0 if the curves are equal, 1 if they are not equal, or -1 on error. | ||
164 | |||
165 | EC_GROUP_get_basis_type returns the values NID_X9_62_tpBasis or NID_X9_62_ppBasis (as defined in <openssl/obj_mac.h>) for a | ||
166 | trinomial or pentanomial respectively. Alternatively in the event of an error a 0 is returned. | ||
167 | |||
168 | =head1 SEE ALSO | ||
169 | |||
170 | L<crypto(3)|crypto(3)>, L<ec(3)|ec(3)>, L<EC_GROUP_new(3)|EC_GROUP_new(3)>, | ||
171 | L<EC_POINT_new(3)|EC_POINT_new(3)>, L<EC_POINT_add(3)|EC_POINT_add(3)>, L<EC_KEY_new(3)|EC_KEY_new(3)>, | ||
172 | L<EC_GFp_simple_method(3)|EC_GFp_simple_method(3)>, L<d2i_ECPKParameters(3)|d2i_ECPKParameters(3)> | ||
173 | |||
174 | =cut | ||
diff --git a/src/lib/libcrypto/doc/EC_GROUP_new.pod b/src/lib/libcrypto/doc/EC_GROUP_new.pod deleted file mode 100644 index 9ab3566e65..0000000000 --- a/src/lib/libcrypto/doc/EC_GROUP_new.pod +++ /dev/null | |||
@@ -1,95 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EC_GROUP_new, EC_GROUP_free, EC_GROUP_clear_free, EC_GROUP_new_curve_GFp, EC_GROUP_new_curve_GF2m, EC_GROUP_new_by_curve_name, EC_GROUP_set_curve_GFp, EC_GROUP_get_curve_GFp, EC_GROUP_set_curve_GF2m, EC_GROUP_get_curve_GF2m, EC_get_builtin_curves - Functions for creating and destroying B<EC_GROUP> objects. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ec.h> | ||
10 | #include <openssl/bn.h> | ||
11 | |||
12 | EC_GROUP *EC_GROUP_new(const EC_METHOD *meth); | ||
13 | void EC_GROUP_free(EC_GROUP *group); | ||
14 | void EC_GROUP_clear_free(EC_GROUP *group); | ||
15 | |||
16 | EC_GROUP *EC_GROUP_new_curve_GFp(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); | ||
17 | EC_GROUP *EC_GROUP_new_curve_GF2m(const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); | ||
18 | EC_GROUP *EC_GROUP_new_by_curve_name(int nid); | ||
19 | |||
20 | int EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); | ||
21 | int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); | ||
22 | int EC_GROUP_set_curve_GF2m(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx); | ||
23 | int EC_GROUP_get_curve_GF2m(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); | ||
24 | |||
25 | size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems); | ||
26 | |||
27 | =head1 DESCRIPTION | ||
28 | |||
29 | Within the library there are two forms of elliptic curve that are of interest. The first form is those defined over the | ||
30 | prime field Fp. The elements of Fp are the integers 0 to p-1, where p is a prime number. This gives us a revised | ||
31 | elliptic curve equation as follows: | ||
32 | |||
33 | y^2 mod p = x^3 +ax + b mod p | ||
34 | |||
35 | The second form is those defined over a binary field F2^m where the elements of the field are integers of length at | ||
36 | most m bits. For this form the elliptic curve equation is modified to: | ||
37 | |||
38 | y^2 + xy = x^3 + ax^2 + b (where b != 0) | ||
39 | |||
40 | Operations in a binary field are performed relative to an B<irreducible polynomial>. All such curves with OpenSSL | ||
41 | use a trinomial or a pentanomial for this parameter. | ||
42 | |||
43 | A new curve can be constructed by calling EC_GROUP_new, using the implementation provided by B<meth> (see | ||
44 | L<EC_GFp_simple_method(3)|EC_GFp_simple_method(3)>). It is then necessary to call either EC_GROUP_set_curve_GFp or | ||
45 | EC_GROUP_set_curve_GF2m as appropriate to create a curve defined over Fp or over F2^m respectively. | ||
46 | |||
47 | EC_GROUP_set_curve_GFp sets the curve parameters B<p>, B<a> and B<b> for a curve over Fp stored in B<group>. | ||
48 | EC_group_get_curve_GFp obtains the previously set curve parameters. | ||
49 | |||
50 | EC_GROUP_set_curve_GF2m sets the equivalent curve parameters for a curve over F2^m. In this case B<p> represents | ||
51 | the irreducible polynomial - each bit represents a term in the polynomial. Therefore there will either be three | ||
52 | or five bits set dependent on whether the polynomial is a trinomial or a pentanomial. | ||
53 | EC_group_get_curve_GF2m obtains the previously set curve parameters. | ||
54 | |||
55 | The functions EC_GROUP_new_curve_GFp and EC_GROUP_new_curve_GF2m are shortcuts for calling EC_GROUP_new and the | ||
56 | appropriate EC_group_set_curve function. An appropriate default implementation method will be used. | ||
57 | |||
58 | Whilst the library can be used to create any curve using the functions described above, there are also a number of | ||
59 | predefined curves that are available. In order to obtain a list of all of the predefined curves, call the function | ||
60 | EC_get_builtin_curves. The parameter B<r> should be an array of EC_builtin_curve structures of size B<nitems>. The function | ||
61 | will populate the B<r> array with information about the builtin curves. If B<nitems> is less than the total number of | ||
62 | curves available, then the first B<nitems> curves will be returned. Otherwise the total number of curves will be | ||
63 | provided. The return value is the total number of curves available (whether that number has been populated in B<r> or | ||
64 | not). Passing a NULL B<r>, or setting B<nitems> to 0 will do nothing other than return the total number of curves available. | ||
65 | The EC_builtin_curve structure is defined as follows: | ||
66 | |||
67 | typedef struct { | ||
68 | int nid; | ||
69 | const char *comment; | ||
70 | } EC_builtin_curve; | ||
71 | |||
72 | Each EC_builtin_curve item has a unique integer id (B<nid>), and a human readable comment string describing the curve. | ||
73 | |||
74 | In order to construct a builtin curve use the function EC_GROUP_new_by_curve_name and provide the B<nid> of the curve to | ||
75 | be constructed. | ||
76 | |||
77 | EC_GROUP_free frees the memory associated with the EC_GROUP. | ||
78 | |||
79 | EC_GROUP_clear_free destroys any sensitive data held within the EC_GROUP and then frees its memory. | ||
80 | |||
81 | =head1 RETURN VALUES | ||
82 | |||
83 | All EC_GROUP_new* functions return a pointer to the newly constructed group, or NULL on error. | ||
84 | |||
85 | EC_get_builtin_curves returns the number of builtin curves that are available. | ||
86 | |||
87 | EC_GROUP_set_curve_GFp, EC_GROUP_get_curve_GFp, EC_GROUP_set_curve_GF2m, EC_GROUP_get_curve_GF2m return 1 on success or 0 on error. | ||
88 | |||
89 | =head1 SEE ALSO | ||
90 | |||
91 | L<crypto(3)|crypto(3)>, L<ec(3)|ec(3)>, L<EC_GROUP_copy(3)|EC_GROUP_copy(3)>, | ||
92 | L<EC_POINT_new(3)|EC_POINT_new(3)>, L<EC_POINT_add(3)|EC_POINT_add(3)>, L<EC_KEY_new(3)|EC_KEY_new(3)>, | ||
93 | L<EC_GFp_simple_method(3)|EC_GFp_simple_method(3)>, L<d2i_ECPKParameters(3)|d2i_ECPKParameters(3)> | ||
94 | |||
95 | =cut | ||
diff --git a/src/lib/libcrypto/doc/EC_KEY_new.pod b/src/lib/libcrypto/doc/EC_KEY_new.pod deleted file mode 100644 index 02d7bac82c..0000000000 --- a/src/lib/libcrypto/doc/EC_KEY_new.pod +++ /dev/null | |||
@@ -1,115 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EC_KEY_new, EC_KEY_get_flags, EC_KEY_set_flags, EC_KEY_clear_flags, EC_KEY_new_by_curve_name, EC_KEY_free, EC_KEY_copy, EC_KEY_dup, EC_KEY_up_ref, EC_KEY_get0_group, EC_KEY_set_group, EC_KEY_get0_private_key, EC_KEY_set_private_key, EC_KEY_get0_public_key, EC_KEY_set_public_key, EC_KEY_get_enc_flags, EC_KEY_set_enc_flags, EC_KEY_get_conv_form, EC_KEY_set_conv_form, EC_KEY_get_key_method_data, EC_KEY_insert_key_method_data, EC_KEY_set_asn1_flag, EC_KEY_precompute_mult, EC_KEY_generate_key, EC_KEY_check_key, EC_KEY_set_public_key_affine_coordinates - Functions for creating, destroying and manipulating B<EC_KEY> objects. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ec.h> | ||
10 | #include <openssl/bn.h> | ||
11 | |||
12 | EC_KEY *EC_KEY_new(void); | ||
13 | int EC_KEY_get_flags(const EC_KEY *key); | ||
14 | void EC_KEY_set_flags(EC_KEY *key, int flags); | ||
15 | void EC_KEY_clear_flags(EC_KEY *key, int flags); | ||
16 | EC_KEY *EC_KEY_new_by_curve_name(int nid); | ||
17 | void EC_KEY_free(EC_KEY *key); | ||
18 | EC_KEY *EC_KEY_copy(EC_KEY *dst, const EC_KEY *src); | ||
19 | EC_KEY *EC_KEY_dup(const EC_KEY *src); | ||
20 | int EC_KEY_up_ref(EC_KEY *key); | ||
21 | const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key); | ||
22 | int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group); | ||
23 | const BIGNUM *EC_KEY_get0_private_key(const EC_KEY *key); | ||
24 | int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *prv); | ||
25 | const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key); | ||
26 | int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub); | ||
27 | unsigned int EC_KEY_get_enc_flags(const EC_KEY *key); | ||
28 | void EC_KEY_set_enc_flags(EC_KEY *eckey, unsigned int flags); | ||
29 | point_conversion_form_t EC_KEY_get_conv_form(const EC_KEY *key); | ||
30 | void EC_KEY_set_conv_form(EC_KEY *eckey, point_conversion_form_t cform); | ||
31 | void *EC_KEY_get_key_method_data(EC_KEY *key, | ||
32 | void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *)); | ||
33 | void EC_KEY_insert_key_method_data(EC_KEY *key, void *data, | ||
34 | void *(*dup_func)(void *), void (*free_func)(void *), void (*clear_free_func)(void *)); | ||
35 | void EC_KEY_set_asn1_flag(EC_KEY *eckey, int asn1_flag); | ||
36 | int EC_KEY_precompute_mult(EC_KEY *key, BN_CTX *ctx); | ||
37 | int EC_KEY_generate_key(EC_KEY *key); | ||
38 | int EC_KEY_check_key(const EC_KEY *key); | ||
39 | int EC_KEY_set_public_key_affine_coordinates(EC_KEY *key, BIGNUM *x, BIGNUM *y); | ||
40 | |||
41 | =head1 DESCRIPTION | ||
42 | |||
43 | An EC_KEY represents a public key and (optionally) an associated private key. A new EC_KEY (with no associated curve) can be constructed by calling EC_KEY_new. | ||
44 | The reference count for the newly created EC_KEY is initially set to 1. A curve can be associated with the EC_KEY by calling | ||
45 | EC_KEY_set_group. | ||
46 | |||
47 | Alternatively a new EC_KEY can be constructed by calling EC_KEY_new_by_curve_name and supplying the nid of the associated curve. Refer to L<EC_GROUP_new(3)|EC_GROUP_new(3)> for a description of curve names. This function simply wraps calls to EC_KEY_new and | ||
48 | EC_GROUP_new_by_curve_name. | ||
49 | |||
50 | Calling EC_KEY_free decrements the reference count for the EC_KEY object, and if it has dropped to zero then frees the memory associated | ||
51 | with it. | ||
52 | |||
53 | EC_KEY_copy copies the contents of the EC_KEY in B<src> into B<dest>. | ||
54 | |||
55 | EC_KEY_dup creates a new EC_KEY object and copies B<ec_key> into it. | ||
56 | |||
57 | EC_KEY_up_ref increments the reference count associated with the EC_KEY object. | ||
58 | |||
59 | EC_KEY_generate_key generates a new public and private key for the supplied B<eckey> object. B<eckey> must have an EC_GROUP object | ||
60 | associated with it before calling this function. The private key is a random integer (0 < priv_key < order, where order is the order | ||
61 | of the EC_GROUP object). The public key is an EC_POINT on the curve calculated by multiplying the generator for the curve by the | ||
62 | private key. | ||
63 | |||
64 | EC_KEY_check_key performs various sanity checks on the EC_KEY object to confirm that it is valid. | ||
65 | |||
66 | EC_KEY_set_public_key_affine_coordinates sets the public key for B<key> based on its affine co-ordinates, i.e. it constructs an EC_POINT | ||
67 | object based on the supplied B<x> and B<y> values and sets the public key to be this EC_POINT. It will also performs certain sanity checks | ||
68 | on the key to confirm that it is valid. | ||
69 | |||
70 | The functions EC_KEY_get0_group, EC_KEY_set_group, EC_KEY_get0_private_key, EC_KEY_set_private_key, EC_KEY_get0_public_key, and EC_KEY_set_public_key get and set the EC_GROUP object, the private key and the EC_POINT public key for the B<key> respectively. | ||
71 | |||
72 | The functions EC_KEY_get_enc_flags and EC_KEY_set_enc_flags get and set the value of the encoding flags for the B<key>. There are two encoding | ||
73 | flags currently defined - EC_PKEY_NO_PARAMETERS and EC_PKEY_NO_PUBKEY. These flags define the behaviour of how the B<key> is | ||
74 | converted into ASN1 in a call to i2d_ECPrivateKey. If EC_PKEY_NO_PARAMETERS is set then the public parameters for the curve are not encoded | ||
75 | along with the private key. If EC_PKEY_NO_PUBKEY is set then the public key is not encoded along with the private key. | ||
76 | |||
77 | The functions EC_KEY_get_conv_form and EC_KEY_set_conv_form get and set the point_conversion_form for the B<key>. For a description | ||
78 | of point_conversion_forms please refer to L<EC_POINT_new(3)|EC_POINT_new(3)>. | ||
79 | |||
80 | EC_KEY_insert_key_method_data and EC_KEY_get_key_method_data enable the caller to associate arbitrary additional data specific to the | ||
81 | elliptic curve scheme being used with the EC_KEY object. This data is treated as a "black box" by the ec library. The data to be stored by EC_KEY_insert_key_method_data is provided in the B<data> parameter, which must have associated functions for duplicating, freeing and "clear_freeing" the data item. If a subsequent EC_KEY_get_key_method_data call is issued, the functions for duplicating, freeing and "clear_freeing" the data item must be provided again, and they must be the same as they were when the data item was inserted. | ||
82 | |||
83 | EC_KEY_set_flags sets the flags in the B<flags> parameter on the EC_KEY object. Any flags that are already set are left set. The currently defined standard flags are EC_FLAG_NON_FIPS_ALLOW and EC_FLAG_FIPS_CHECKED. In addition there is the flag EC_FLAG_COFACTOR_ECDH which is specific to ECDH and is defined in ecdh.h. EC_KEY_get_flags returns the current flags that are set for this EC_KEY. EC_KEY_clear_flags clears the flags indicated by the B<flags> parameter. All other flags are left in their existing state. | ||
84 | |||
85 | EC_KEY_set_asn1_flag sets the asn1_flag on the underlying EC_GROUP object (if set). Refer to L<EC_GROUP_copy(3)|EC_GROUP_copy(3)> for further information on the asn1_flag. | ||
86 | |||
87 | EC_KEY_precompute_mult stores multiples of the underlying EC_GROUP generator for faster point multiplication. See also L<EC_POINT_add(3)|EC_POINT_add(3)>. | ||
88 | |||
89 | |||
90 | =head1 RETURN VALUES | ||
91 | |||
92 | EC_KEY_new, EC_KEY_new_by_curve_name and EC_KEY_dup return a pointer to the newly created EC_KEY object, or NULL on error. | ||
93 | |||
94 | EC_KEY_get_flags returns the flags associated with the EC_KEY object as an integer. | ||
95 | |||
96 | EC_KEY_copy returns a pointer to the destination key, or NULL on error. | ||
97 | |||
98 | EC_KEY_up_ref, EC_KEY_set_group, EC_KEY_set_private_key, EC_KEY_set_public_key, EC_KEY_precompute_mult, EC_KEY_generate_key, EC_KEY_check_key and EC_KEY_set_public_key_affine_coordinates return 1 on success or 0 on error. | ||
99 | |||
100 | EC_KEY_get0_group returns the EC_GROUP associated with the EC_KEY. | ||
101 | |||
102 | EC_KEY_get0_private_key returns the private key associated with the EC_KEY. | ||
103 | |||
104 | EC_KEY_get_enc_flags returns the value of the current encoding flags for the EC_KEY. | ||
105 | |||
106 | EC_KEY_get_conv_form return the point_conversion_form for the EC_KEY. | ||
107 | |||
108 | |||
109 | =head1 SEE ALSO | ||
110 | |||
111 | L<crypto(3)|crypto(3)>, L<ec(3)|ec(3)>, L<EC_GROUP_new(3)|EC_GROUP_new(3)>, L<EC_GROUP_copy(3)|EC_GROUP_copy(3)>, | ||
112 | L<EC_POINT_new(3)|EC_POINT_new(3)>, L<EC_POINT_add(3)|EC_POINT_add(3)>, | ||
113 | L<EC_GFp_simple_method(3)|EC_GFp_simple_method(3)>, L<d2i_ECPKParameters(3)|d2i_ECPKParameters(3)> | ||
114 | |||
115 | =cut | ||
diff --git a/src/lib/libcrypto/doc/EC_POINT_add.pod b/src/lib/libcrypto/doc/EC_POINT_add.pod deleted file mode 100644 index ae92640843..0000000000 --- a/src/lib/libcrypto/doc/EC_POINT_add.pod +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EC_POINT_add, EC_POINT_dbl, EC_POINT_invert, EC_POINT_is_at_infinity, EC_POINT_is_on_curve, EC_POINT_cmp, EC_POINT_make_affine, EC_POINTs_make_affine, EC_POINTs_mul, EC_POINT_mul, EC_GROUP_precompute_mult, EC_GROUP_have_precompute_mult - Functions for performing mathematical operations and tests on B<EC_POINT> objects. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ec.h> | ||
10 | #include <openssl/bn.h> | ||
11 | |||
12 | int EC_POINT_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx); | ||
13 | int EC_POINT_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX *ctx); | ||
14 | int EC_POINT_invert(const EC_GROUP *group, EC_POINT *a, BN_CTX *ctx); | ||
15 | int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *p); | ||
16 | int EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point, BN_CTX *ctx); | ||
17 | int EC_POINT_cmp(const EC_GROUP *group, const EC_POINT *a, const EC_POINT *b, BN_CTX *ctx); | ||
18 | int EC_POINT_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx); | ||
19 | int EC_POINTs_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx); | ||
20 | int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, size_t num, const EC_POINT *p[], const BIGNUM *m[], BN_CTX *ctx); | ||
21 | int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *n, const EC_POINT *q, const BIGNUM *m, BN_CTX *ctx); | ||
22 | int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx); | ||
23 | int EC_GROUP_have_precompute_mult(const EC_GROUP *group); | ||
24 | |||
25 | |||
26 | =head1 DESCRIPTION | ||
27 | |||
28 | EC_POINT_add adds the two points B<a> and B<b> and places the result in B<r>. Similarly EC_POINT_dbl doubles the point B<a> and places the | ||
29 | result in B<r>. In both cases it is valid for B<r> to be one of B<a> or B<b>. | ||
30 | |||
31 | EC_POINT_invert calculates the inverse of the supplied point B<a>. The result is placed back in B<a>. | ||
32 | |||
33 | The function EC_POINT_is_at_infinity tests whether the supplied point is at infinity or not. | ||
34 | |||
35 | EC_POINT_is_on_curve tests whether the supplied point is on the curve or not. | ||
36 | |||
37 | EC_POINT_cmp compares the two supplied points and tests whether or not they are equal. | ||
38 | |||
39 | The functions EC_POINT_make_affine and EC_POINTs_make_affine force the internal representation of the EC_POINT(s) into the affine | ||
40 | co-ordinate system. In the case of EC_POINTs_make_affine the value B<num> provides the number of points in the array B<points> to be | ||
41 | forced. | ||
42 | |||
43 | EC_POINT_mul calculates the value generator * B<n> + B<q> * B<m> and stores the result in B<r>. The value B<n> may be NULL in which case the result is just B<q> * B<m>. | ||
44 | |||
45 | EC_POINTs_mul calculates the value generator * B<n> + B<q[0]> * B<m[0]> + ... + B<q[num-1]> * B<m[num-1]>. As for EC_POINT_mul the value | ||
46 | B<n> may be NULL. | ||
47 | |||
48 | The function EC_GROUP_precompute_mult stores multiples of the generator for faster point multiplication, whilst | ||
49 | EC_GROUP_have_precompute_mult tests whether precomputation has already been done. See L<EC_GROUP_copy(3)|EC_GROUP_copy(3)> for information | ||
50 | about the generator. | ||
51 | |||
52 | |||
53 | =head1 RETURN VALUES | ||
54 | |||
55 | The following functions return 1 on success or 0 on error: EC_POINT_add, EC_POINT_dbl, EC_POINT_invert, EC_POINT_make_affine, | ||
56 | EC_POINTs_make_affine, EC_POINTs_make_affine, EC_POINT_mul, EC_POINTs_mul and EC_GROUP_precompute_mult. | ||
57 | |||
58 | EC_POINT_is_at_infinity returns 1 if the point is at infinity, or 0 otherwise. | ||
59 | |||
60 | EC_POINT_is_on_curve returns 1 if the point is on the curve, 0 if not, or -1 on error. | ||
61 | |||
62 | EC_POINT_cmp returns 1 if the points are not equal, 0 if they are, or -1 on error. | ||
63 | |||
64 | EC_GROUP_have_precompute_mult return 1 if a precomputation has been done, or 0 if not. | ||
65 | |||
66 | =head1 SEE ALSO | ||
67 | |||
68 | L<crypto(3)|crypto(3)>, L<ec(3)|ec(3)>, L<EC_GROUP_new(3)|EC_GROUP_new(3)>, L<EC_GROUP_copy(3)|EC_GROUP_copy(3)>, | ||
69 | L<EC_POINT_new(3)|EC_POINT_new(3)>, L<EC_KEY_new(3)|EC_KEY_new(3)>, | ||
70 | L<EC_GFp_simple_method(3)|EC_GFp_simple_method(3)>, L<d2i_ECPKParameters(3)|d2i_ECPKParameters(3)> | ||
71 | |||
72 | =cut | ||
diff --git a/src/lib/libcrypto/doc/EC_POINT_new.pod b/src/lib/libcrypto/doc/EC_POINT_new.pod deleted file mode 100644 index b41ca0ed0c..0000000000 --- a/src/lib/libcrypto/doc/EC_POINT_new.pod +++ /dev/null | |||
@@ -1,123 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EC_POINT_new, EC_POINT_free, EC_POINT_clear_free, EC_POINT_copy, EC_POINT_dup, EC_POINT_method_of, EC_POINT_set_to_infinity, EC_POINT_set_Jprojective_coordinates, EC_POINT_get_Jprojective_coordinates_GFp, EC_POINT_set_affine_coordinates_GFp, EC_POINT_get_affine_coordinates_GFp, EC_POINT_set_compressed_coordinates_GFp, EC_POINT_set_affine_coordinates_GF2m, EC_POINT_get_affine_coordinates_GF2m, EC_POINT_set_compressed_coordinates_GF2m, EC_POINT_point2oct, EC_POINT_oct2point, EC_POINT_point2bn, EC_POINT_bn2point, EC_POINT_point2hex, EC_POINT_hex2point - Functions for creating, destroying and manipulating B<EC_POINT> objects. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ec.h> | ||
10 | #include <openssl/bn.h> | ||
11 | |||
12 | EC_POINT *EC_POINT_new(const EC_GROUP *group); | ||
13 | void EC_POINT_free(EC_POINT *point); | ||
14 | void EC_POINT_clear_free(EC_POINT *point); | ||
15 | int EC_POINT_copy(EC_POINT *dst, const EC_POINT *src); | ||
16 | EC_POINT *EC_POINT_dup(const EC_POINT *src, const EC_GROUP *group); | ||
17 | const EC_METHOD *EC_POINT_method_of(const EC_POINT *point); | ||
18 | int EC_POINT_set_to_infinity(const EC_GROUP *group, EC_POINT *point); | ||
19 | int EC_POINT_set_Jprojective_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, | ||
20 | const BIGNUM *x, const BIGNUM *y, const BIGNUM *z, BN_CTX *ctx); | ||
21 | int EC_POINT_get_Jprojective_coordinates_GFp(const EC_GROUP *group, | ||
22 | const EC_POINT *p, BIGNUM *x, BIGNUM *y, BIGNUM *z, BN_CTX *ctx); | ||
23 | int EC_POINT_set_affine_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, | ||
24 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx); | ||
25 | int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group, | ||
26 | const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx); | ||
27 | int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, EC_POINT *p, | ||
28 | const BIGNUM *x, int y_bit, BN_CTX *ctx); | ||
29 | int EC_POINT_set_affine_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p, | ||
30 | const BIGNUM *x, const BIGNUM *y, BN_CTX *ctx); | ||
31 | int EC_POINT_get_affine_coordinates_GF2m(const EC_GROUP *group, | ||
32 | const EC_POINT *p, BIGNUM *x, BIGNUM *y, BN_CTX *ctx); | ||
33 | int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, EC_POINT *p, | ||
34 | const BIGNUM *x, int y_bit, BN_CTX *ctx); | ||
35 | size_t EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *p, | ||
36 | point_conversion_form_t form, | ||
37 | unsigned char *buf, size_t len, BN_CTX *ctx); | ||
38 | int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *p, | ||
39 | const unsigned char *buf, size_t len, BN_CTX *ctx); | ||
40 | BIGNUM *EC_POINT_point2bn(const EC_GROUP *, const EC_POINT *, | ||
41 | point_conversion_form_t form, BIGNUM *, BN_CTX *); | ||
42 | EC_POINT *EC_POINT_bn2point(const EC_GROUP *, const BIGNUM *, | ||
43 | EC_POINT *, BN_CTX *); | ||
44 | char *EC_POINT_point2hex(const EC_GROUP *, const EC_POINT *, | ||
45 | point_conversion_form_t form, BN_CTX *); | ||
46 | EC_POINT *EC_POINT_hex2point(const EC_GROUP *, const char *, | ||
47 | EC_POINT *, BN_CTX *); | ||
48 | |||
49 | |||
50 | =head1 DESCRIPTION | ||
51 | |||
52 | An EC_POINT represents a point on a curve. A new point is constructed by calling the function EC_POINT_new and providing the B<group> | ||
53 | object that the point relates to. | ||
54 | |||
55 | EC_POINT_free frees the memory associated with the EC_POINT. | ||
56 | |||
57 | EC_POINT_clear_free destroys any sensitive data held within the EC_POINT and then frees its memory. | ||
58 | |||
59 | EC_POINT_copy copies the point B<src> into B<dst>. Both B<src> and B<dst> must use the same EC_METHOD. | ||
60 | |||
61 | EC_POINT_dup creates a new EC_POINT object and copies the content from B<src> to the newly created | ||
62 | EC_POINT object. | ||
63 | |||
64 | EC_POINT_method_of obtains the EC_METHOD associated with B<point>. | ||
65 | |||
66 | A valid point on a curve is the special point at infinity. A point is set to be at infinity by calling EC_POINT_set_to_infinity. | ||
67 | |||
68 | The affine co-ordinates for a point describe a point in terms of its x and y position. The functions | ||
69 | EC_POINT_set_affine_coordinates_GFp and EC_POINT_set_affine_coordinates_GF2m set the B<x> and B<y> co-ordinates for the point | ||
70 | B<p> defined over the curve given in B<group>. | ||
71 | |||
72 | As well as the affine co-ordinates, a point can alternatively be described in terms of its Jacobian | ||
73 | projective co-ordinates (for Fp curves only). Jacobian projective co-ordinates are expressed as three values x, y and z. Working in | ||
74 | this co-ordinate system provides more efficient point multiplication operations. | ||
75 | A mapping exists between Jacobian projective co-ordinates and affine co-ordinates. A Jacobian projective co-ordinate (x, y, z) can be written as an affine co-ordinate as (x/(z^2), y/(z^3)). Conversion to Jacobian projective to affine co-ordinates is simple. The co-ordinate (x, y) is | ||
76 | mapped to (x, y, 1). To set or get the projective co-ordinates use EC_POINT_set_Jprojective_coordinates_GFp and | ||
77 | EC_POINT_get_Jprojective_coordinates_GFp respectively. | ||
78 | |||
79 | Points can also be described in terms of their compressed co-ordinates. For a point (x, y), for any given value for x such that the point is | ||
80 | on the curve there will only ever be two possible values for y. Therefore a point can be set using the EC_POINT_set_compressed_coordinates_GFp | ||
81 | and EC_POINT_set_compressed_coordinates_GF2m functions where B<x> is the x co-ordinate and B<y_bit> is a value 0 or 1 to identify which of | ||
82 | the two possible values for y should be used. | ||
83 | |||
84 | In addition EC_POINTs can be converted to and from various external representations. Supported representations are octet strings, BIGNUMs and hexadecimal. The format of the external representation is described by the point_conversion_form. See L<EC_GROUP_copy(3)|EC_GROUP_copy(3)> for | ||
85 | a description of point_conversion_form. Octet strings are stored in a buffer along with an associated buffer length. A point held in a BIGNUM is calculated by converting the point to an octet string and then converting that octet string into a BIGNUM integer. Points in hexadecimal format are stored in a NULL terminated character string where each character is one of the printable values 0-9 or A-F (or a-f). | ||
86 | |||
87 | The functions EC_POINT_point2oct, EC_POINT_oct2point, EC_POINT_point2bn, EC_POINT_bn2point, EC_POINT_point2hex and EC_POINT_hex2point convert | ||
88 | from and to EC_POINTs for the formats: octet string, BIGNUM and hexadecimal respectively. | ||
89 | |||
90 | The function EC_POINT_point2oct must be supplied with a buffer long enough to store the octet string. The return value provides the number of | ||
91 | octets stored. Calling the function with a NULL buffer will not perform the conversion but will still return the required buffer length. | ||
92 | |||
93 | The function EC_POINT_point2hex will allocate sufficient memory to store the hexadecimal string. It is the caller's responsibility to free | ||
94 | this memory with a subsequent call to free(). | ||
95 | |||
96 | =head1 RETURN VALUES | ||
97 | |||
98 | EC_POINT_new and EC_POINT_dup return the newly allocated EC_POINT or NULL on error. | ||
99 | |||
100 | The following functions return 1 on success or 0 on error: EC_POINT_copy, EC_POINT_set_to_infinity, EC_POINT_set_Jprojective_coordinates_GFp, | ||
101 | EC_POINT_get_Jprojective_coordinates_GFp, EC_POINT_set_affine_coordinates_GFp, EC_POINT_get_affine_coordinates_GFp, | ||
102 | EC_POINT_set_compressed_coordinates_GFp, EC_POINT_set_affine_coordinates_GF2m, EC_POINT_get_affine_coordinates_GF2m, | ||
103 | EC_POINT_set_compressed_coordinates_GF2m and EC_POINT_oct2point. | ||
104 | |||
105 | EC_POINT_method_of returns the EC_METHOD associated with the supplied EC_POINT. | ||
106 | |||
107 | EC_POINT_point2oct returns the length of the required buffer, or 0 on error. | ||
108 | |||
109 | EC_POINT_point2bn returns the pointer to the BIGNUM supplied, or NULL on error. | ||
110 | |||
111 | EC_POINT_bn2point returns the pointer to the EC_POINT supplied, or NULL on error. | ||
112 | |||
113 | EC_POINT_point2hex returns a pointer to the hex string, or NULL on error. | ||
114 | |||
115 | EC_POINT_hex2point returns the pointer to the EC_POINT supplied, or NULL on error. | ||
116 | |||
117 | =head1 SEE ALSO | ||
118 | |||
119 | L<crypto(3)|crypto(3)>, L<ec(3)|ec(3)>, L<EC_GROUP_new(3)|EC_GROUP_new(3)>, L<EC_GROUP_copy(3)|EC_GROUP_copy(3)>, | ||
120 | L<EC_POINT_add(3)|EC_POINT_add(3)>, L<EC_KEY_new(3)|EC_KEY_new(3)>, | ||
121 | L<EC_GFp_simple_method(3)|EC_GFp_simple_method(3)>, L<d2i_ECPKParameters(3)|d2i_ECPKParameters(3)> | ||
122 | |||
123 | =cut | ||
diff --git a/src/lib/libcrypto/man/DSA_SIG_new.3 b/src/lib/libcrypto/man/DSA_SIG_new.3 new file mode 100644 index 0000000000..32d21fb782 --- /dev/null +++ b/src/lib/libcrypto/man/DSA_SIG_new.3 | |||
@@ -0,0 +1,43 @@ | |||
1 | .Dd $Mdocdate: November 2 2016 $ | ||
2 | .Dt DSA_SIG_NEW 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm DSA_SIG_new , | ||
6 | .Nm DSA_SIG_free | ||
7 | .Nd allocate and free DSA signature objects | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/dsa.h | ||
10 | .Ft DSA_SIG * | ||
11 | .Fn DSA_SIG_new void | ||
12 | .Ft void | ||
13 | .Fo DSA_SIG_free | ||
14 | .Fa "DSA_SIG *a" | ||
15 | .Fc | ||
16 | .Sh DESCRIPTION | ||
17 | .Fn DSA_SIG_new | ||
18 | allocates and initializes a | ||
19 | .Vt DSA_SIG | ||
20 | structure. | ||
21 | .Pp | ||
22 | .Fn DSA_SIG_free | ||
23 | frees the | ||
24 | .Vt DSA_SIG | ||
25 | structure and its components. | ||
26 | The values are erased before the memory is returned to the system. | ||
27 | .Sh RETURN VALUES | ||
28 | If the allocation fails, | ||
29 | .Fn DSA_SIG_new | ||
30 | returns | ||
31 | .Dv NULL | ||
32 | and sets an error code that can be obtained by | ||
33 | .Xr ERR_get_error 3 . | ||
34 | Otherwise it returns a pointer to the newly allocated structure. | ||
35 | .Sh SEE ALSO | ||
36 | .Xr dsa 3 , | ||
37 | .Xr DSA_do_sign 3 , | ||
38 | .Xr ERR_get_error 3 | ||
39 | .Sh HISTORY | ||
40 | .Fn DSA_SIG_new | ||
41 | and | ||
42 | .Fn DSA_SIG_free | ||
43 | were added in OpenSSL 0.9.3. | ||
diff --git a/src/lib/libcrypto/man/DSA_do_sign.3 b/src/lib/libcrypto/man/DSA_do_sign.3 new file mode 100644 index 0000000000..c61ff925bb --- /dev/null +++ b/src/lib/libcrypto/man/DSA_do_sign.3 | |||
@@ -0,0 +1,68 @@ | |||
1 | .Dd $Mdocdate: November 2 2016 $ | ||
2 | .Dt DSA_DO_SIGN 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm DSA_do_sign , | ||
6 | .Nm DSA_do_verify | ||
7 | .Nd raw DSA signature operations | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/dsa.h | ||
10 | .Ft DSA_SIG * | ||
11 | .Fo DSA_do_sign | ||
12 | .Fa "const unsigned char *dgst" | ||
13 | .Fa "int dlen" | ||
14 | .Fa "DSA *dsa" | ||
15 | .Fc | ||
16 | .Ft int | ||
17 | .Fo DSA_do_verify | ||
18 | .Fa "const unsigned char *dgst" | ||
19 | .Fa "int dgst_len" | ||
20 | .Fa "DSA_SIG *sig" | ||
21 | .Fa "DSA *dsa" | ||
22 | .Fc | ||
23 | .Sh DESCRIPTION | ||
24 | .Fn DSA_do_sign | ||
25 | computes a digital signature on the | ||
26 | .Fa dlen | ||
27 | byte message digest | ||
28 | .Fa dgst | ||
29 | using the private key | ||
30 | .Fa dsa | ||
31 | and returns it in a newly allocated | ||
32 | .Vt DSA_SIG | ||
33 | structure. | ||
34 | .Pp | ||
35 | .Xr DSA_sign_setup 3 | ||
36 | may be used to precompute part of the signing operation in case | ||
37 | signature generation is time-critical. | ||
38 | .Pp | ||
39 | .Fn DSA_do_verify | ||
40 | verifies that the signature | ||
41 | .Fa sig | ||
42 | matches a given message digest | ||
43 | .Fa dgst | ||
44 | of size | ||
45 | .Fa dgst_len . | ||
46 | .Fa dsa | ||
47 | is the signer's public key. | ||
48 | .Sh RETURN VALUES | ||
49 | .Fn DSA_do_sign | ||
50 | returns the signature or | ||
51 | .Dv NULL | ||
52 | on error. | ||
53 | .Fn DSA_do_verify | ||
54 | returns 1 for a valid signature, 0 for an incorrect signature, | ||
55 | and -1 on error. | ||
56 | The error codes can be obtained by | ||
57 | .Xr ERR_get_error 3 . | ||
58 | .Sh SEE ALSO | ||
59 | .Xr dsa 3 , | ||
60 | .Xr DSA_SIG_new 3 , | ||
61 | .Xr DSA_sign 3 , | ||
62 | .Xr ERR_get_error 3 , | ||
63 | .Xr rand 3 | ||
64 | .Sh HISTORY | ||
65 | .Fn DSA_do_sign | ||
66 | and | ||
67 | .Fn DSA_do_verify | ||
68 | were added in OpenSSL 0.9.3. | ||
diff --git a/src/lib/libcrypto/man/DSA_dup_DH.3 b/src/lib/libcrypto/man/DSA_dup_DH.3 new file mode 100644 index 0000000000..c8b7ec60ab --- /dev/null +++ b/src/lib/libcrypto/man/DSA_dup_DH.3 | |||
@@ -0,0 +1,41 @@ | |||
1 | .Dd $Mdocdate: November 2 2016 $ | ||
2 | .Dt DSA_DUP_DH 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm DSA_dup_DH | ||
6 | .Nd create a DH structure out of DSA structure | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/dsa.h | ||
9 | .Ft DH * | ||
10 | .Fo DSA_dup_DH | ||
11 | .Fa "const DSA *r" | ||
12 | .Fc | ||
13 | .Sh DESCRIPTION | ||
14 | .Fn DSA_dup_DH | ||
15 | duplicates | ||
16 | .Vt DSA | ||
17 | parameters/keys as | ||
18 | .Vt DH | ||
19 | parameters/keys. | ||
20 | .Fa r->q | ||
21 | is lost during that conversion, but the resulting | ||
22 | .Vt DH | ||
23 | parameters contain its length. | ||
24 | .Sh RETURN VALUE | ||
25 | .Fn DSA_dup_DH | ||
26 | returns the new | ||
27 | .Vt DH | ||
28 | structure or | ||
29 | .Dv NULL | ||
30 | on error. | ||
31 | The error codes can be obtained by | ||
32 | .Xr ERR_get_error 3 . | ||
33 | .Sh SEE ALSO | ||
34 | .Xr dh 3 , | ||
35 | .Xr dsa 3 , | ||
36 | .Xr ERR_get_error 3 | ||
37 | .Sh HISTORY | ||
38 | .Fn DSA_dup_DH | ||
39 | was added in OpenSSL 0.9.4. | ||
40 | .Sh CAVEATS | ||
41 | Be careful to avoid small subgroup attacks when using this. | ||
diff --git a/src/lib/libcrypto/man/DSA_generate_key.3 b/src/lib/libcrypto/man/DSA_generate_key.3 new file mode 100644 index 0000000000..cf0872463f --- /dev/null +++ b/src/lib/libcrypto/man/DSA_generate_key.3 | |||
@@ -0,0 +1,34 @@ | |||
1 | .Dd $Mdocdate: November 2 2016 $ | ||
2 | .Dt DSA_GENERATE_KEY 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm DSA_generate_key | ||
6 | .Nd generate DSA key pair | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/dsa.h | ||
9 | .Ft int | ||
10 | .Fo DSA_generate_key | ||
11 | .Fa "DSA *a" | ||
12 | .Fc | ||
13 | .Sh DESCRIPTION | ||
14 | .Fn DSA_generate_key | ||
15 | expects | ||
16 | .Fa a | ||
17 | to contain DSA parameters. | ||
18 | It generates a new key pair and stores it in | ||
19 | .Fa a->pub_key | ||
20 | and | ||
21 | .Fa a->priv_key . | ||
22 | .Sh RETURN VALUE | ||
23 | .Fn DSA_generate_key | ||
24 | returns 1 on success or 0 otherwise. | ||
25 | The error codes can be obtained by | ||
26 | .Xr ERR_get_error 3 . | ||
27 | .Sh SEE ALSO | ||
28 | .Xr dsa 3 , | ||
29 | .Xr DSA_generate_parameters 3 , | ||
30 | .Xr ERR_get_error 3 , | ||
31 | .Xr rand 3 | ||
32 | .Sh HISTORY | ||
33 | .Fn DSA_generate_key | ||
34 | is available since SSLeay 0.8. | ||
diff --git a/src/lib/libcrypto/man/DSA_generate_parameters.3 b/src/lib/libcrypto/man/DSA_generate_parameters.3 new file mode 100644 index 0000000000..1acb85e77a --- /dev/null +++ b/src/lib/libcrypto/man/DSA_generate_parameters.3 | |||
@@ -0,0 +1,171 @@ | |||
1 | .Dd $Mdocdate: November 2 2016 $ | ||
2 | .Dt DSA_GENERATE_PARAMETERS 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm DSA_generate_parameters_ex , | ||
6 | .Nm DSA_generate_parameters | ||
7 | .Nd generate DSA parameters | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/dsa.h | ||
10 | .Ft int | ||
11 | .Fo DSA_generate_parameters_ex | ||
12 | .Fa "DSA *dsa" | ||
13 | .Fa "int bits" | ||
14 | .Fa "const unsigned char *seed" | ||
15 | .Fa "int seed_len" | ||
16 | .Fa "int *counter_ret" | ||
17 | .Fa "unsigned long *h_ret" | ||
18 | .Fa "BN_GENCB *cb" | ||
19 | .Fc | ||
20 | .Pp | ||
21 | Deprecated: | ||
22 | .Pp | ||
23 | .Ft DSA * | ||
24 | .Fo DSA_generate_parameters | ||
25 | .Fa "int bits" | ||
26 | .Fa "unsigned char *seed" | ||
27 | .Fa "int seed_len" | ||
28 | .Fa "int *counter_ret" | ||
29 | .Fa "unsigned long *h_ret" | ||
30 | .Fa "void (*callback)(int, int, void *)" | ||
31 | .Fa "void *cb_arg" | ||
32 | .Fc | ||
33 | .Sh DESCRIPTION | ||
34 | .Fn DSA_generate_parameters_ex | ||
35 | generates primes p and q and a generator g for use in the DSA and stores | ||
36 | the result in | ||
37 | .Fa dsa . | ||
38 | .Pp | ||
39 | .Fa bits | ||
40 | is the length of the prime to be generated; the DSS allows a maximum of | ||
41 | 1024 bits. | ||
42 | .Pp | ||
43 | If | ||
44 | .Fa seed | ||
45 | is | ||
46 | .Dv NULL | ||
47 | or | ||
48 | .Fa seed_len | ||
49 | < 20, the primes will be generated at random. | ||
50 | Otherwise, the seed is used to generate them. | ||
51 | If the given seed does not yield a prime q, a new random seed is chosen | ||
52 | and placed at | ||
53 | .Fa seed . | ||
54 | .Pp | ||
55 | .Fn DSA_generate_parameters_ex | ||
56 | places the iteration count in | ||
57 | .Pf * Fa counter_ret | ||
58 | and a counter used for finding a generator in | ||
59 | .Pf * Fa h_ret , | ||
60 | unless these are | ||
61 | .Dv NULL . | ||
62 | .Pp | ||
63 | A callback function may be used to provide feedback about the progress | ||
64 | of the key generation. | ||
65 | If | ||
66 | .Fa cb | ||
67 | is not | ||
68 | .Dv NULL , | ||
69 | it will be called as shown below. | ||
70 | For information on the | ||
71 | .Vt BN_GENCB | ||
72 | structure, refer to | ||
73 | .Xr BN_GENCB_call 3 . | ||
74 | .Bl -bullet | ||
75 | .It | ||
76 | When a candidate for q is generated, | ||
77 | .Fn BN_GENCB_call cb 0 m++ | ||
78 | is called | ||
79 | .Pf ( Fa m | ||
80 | is 0 for the first candidate). | ||
81 | .It | ||
82 | When a candidate for q has passed a test by trial division, | ||
83 | .Fn BN_GENCB_call cb 1 -1 | ||
84 | is called. | ||
85 | While a candidate for q is tested by Miller-Rabin primality tests, | ||
86 | .Fn BN_GENCB_call cb 1 i | ||
87 | is called in the outer loop (once for each witness that confirms that | ||
88 | the candidate may be prime); | ||
89 | .Fa i | ||
90 | is the loop counter (starting at 0). | ||
91 | .It | ||
92 | When a prime q has been found, | ||
93 | .Fn BN_GENCB_call cb 2 0 | ||
94 | and | ||
95 | .Fn BN_GENCB_call cb 3 0 | ||
96 | are called. | ||
97 | .It | ||
98 | Before a candidate for p (other than the first) is generated and tested, | ||
99 | .Fn BN_GENCB_call cb 0 counter | ||
100 | is called. | ||
101 | .It | ||
102 | When a candidate for p has passed the test by trial division, | ||
103 | .Fn BN_GENCB_call cb 1 -1 | ||
104 | is called. | ||
105 | While it is tested by the Miller-Rabin primality test, | ||
106 | .Fn BN_GENCB_call cb 1 i | ||
107 | is called in the outer loop (once for each witness that confirms that | ||
108 | the candidate may be prime). | ||
109 | .Fa i | ||
110 | is the loop counter (starting at 0). | ||
111 | .It | ||
112 | When p has been found, | ||
113 | .Fn BN_GENCB_call cb 2 1 | ||
114 | is called. | ||
115 | .It | ||
116 | When the generator has been found, | ||
117 | .Fn BN_GENCB_call cb 3 1 | ||
118 | is called. | ||
119 | .El | ||
120 | .Pp | ||
121 | .Fn DSA_generate_parameters | ||
122 | (deprecated) works in much the same way as for | ||
123 | .Fn DSA_generate_parameters_ex , | ||
124 | except that no | ||
125 | .Fa dsa | ||
126 | parameter is passed and instead a newly allocated | ||
127 | .Vt DSA | ||
128 | structure is returned. | ||
129 | Additionally "old style" callbacks are used instead of the newer | ||
130 | .Vt BN_GENCB | ||
131 | based approach. | ||
132 | Refer to | ||
133 | .Xr BN_generate_prime 3 | ||
134 | for further information. | ||
135 | .Sh RETURN VALUE | ||
136 | .Fn DSA_generate_parameters_ex | ||
137 | returns a 1 on success, or 0 otherwise. | ||
138 | .Pp | ||
139 | .Fn DSA_generate_parameters | ||
140 | returns a pointer to the | ||
141 | .Vt DSA | ||
142 | structure, or | ||
143 | .Dv NULL | ||
144 | if the parameter generation fails. | ||
145 | .Pp | ||
146 | The error codes can be obtained by | ||
147 | .Xr ERR_get_error 3 . | ||
148 | .Sh SEE ALSO | ||
149 | .Xr BN_generate_prime 3 , | ||
150 | .Xr dsa 3 , | ||
151 | .Xr DSA_free 3 , | ||
152 | .Xr ERR_get_error 3 , | ||
153 | .Xr rand 3 | ||
154 | .Sh HISTORY | ||
155 | .Fn DSA_generate_parameters | ||
156 | appeared in SSLeay 0.8. | ||
157 | The | ||
158 | .Fa cb_arg | ||
159 | argument was added in SSLeay 0.9.0. | ||
160 | In versions up to OpenSSL 0.9.4, | ||
161 | .Fn callback 1 ...\& | ||
162 | was called in the inner loop of the Miller-Rabin test whenever it | ||
163 | reached the squaring step (the parameters to | ||
164 | .Fn callback | ||
165 | did not reveal how many witnesses had been tested); since OpenSSL 0.9.5, | ||
166 | .Fn callback 1 ...\& | ||
167 | is called as in | ||
168 | .Xr BN_is_prime 3 , | ||
169 | i.e. once for each witness. | ||
170 | .Sh BUGS | ||
171 | Seed lengths > 20 are not supported. | ||
diff --git a/src/lib/libcrypto/man/DSA_get_ex_new_index.3 b/src/lib/libcrypto/man/DSA_get_ex_new_index.3 new file mode 100644 index 0000000000..da2a6ae7aa --- /dev/null +++ b/src/lib/libcrypto/man/DSA_get_ex_new_index.3 | |||
@@ -0,0 +1,47 @@ | |||
1 | .Dd $Mdocdate: November 2 2016 $ | ||
2 | .Dt DSA_GET_EX_NEW_INDEX 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm DSA_get_ex_new_index , | ||
6 | .Nm DSA_set_ex_data , | ||
7 | .Nm DSA_get_ex_data | ||
8 | .Nd add application specific data to DSA structures | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/dsa.h | ||
11 | .Ft int | ||
12 | .Fo DSA_get_ex_new_index | ||
13 | .Fa "long argl" | ||
14 | .Fa "void *argp" | ||
15 | .Fa "CRYPTO_EX_new *new_func" | ||
16 | .Fa "CRYPTO_EX_dup *dup_func" | ||
17 | .Fa "CRYPTO_EX_free *free_func" | ||
18 | .Fc | ||
19 | .Ft int | ||
20 | .Fo DSA_set_ex_data | ||
21 | .Fa "DSA *d" | ||
22 | .Fa "int idx" | ||
23 | .Fa "void *arg" | ||
24 | .Fc | ||
25 | .Ft char * | ||
26 | .Fo DSA_get_ex_data | ||
27 | .Fa "DSA *d" | ||
28 | .Fa "int idx" | ||
29 | .Fc | ||
30 | .Sh DESCRIPTION | ||
31 | These functions handle application specific data in | ||
32 | .Vt DSA | ||
33 | structures. | ||
34 | Their usage is identical to that of | ||
35 | .Xr RSA_get_ex_new_index 3 , | ||
36 | .Xr RSA_set_ex_data 3 , | ||
37 | and | ||
38 | .Xr RSA_get_ex_data 3 . | ||
39 | .Sh SEE ALSO | ||
40 | .Xr dsa 3 , | ||
41 | .Xr RSA_get_ex_new_index 3 | ||
42 | .Sh HISTORY | ||
43 | .Fn DSA_get_ex_new_index , | ||
44 | .Fn DSA_set_ex_data , | ||
45 | and | ||
46 | .Fn DSA_get_ex_data | ||
47 | are available since OpenSSL 0.9.5. | ||
diff --git a/src/lib/libcrypto/man/DSA_new.3 b/src/lib/libcrypto/man/DSA_new.3 new file mode 100644 index 0000000000..0e8e87deed --- /dev/null +++ b/src/lib/libcrypto/man/DSA_new.3 | |||
@@ -0,0 +1,46 @@ | |||
1 | .Dd $Mdocdate: November 2 2016 $ | ||
2 | .Dt DSA_NEW 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm DSA_new , | ||
6 | .Nm DSA_free | ||
7 | .Nd allocate and free DSA objects | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/dsa.h | ||
10 | .Ft DSA* | ||
11 | .Fn DSA_new void | ||
12 | .Ft void | ||
13 | .Fo DSA_free | ||
14 | .Fa "DSA *dsa" | ||
15 | .Fc | ||
16 | .Sh DESCRIPTION | ||
17 | .Fn DSA_new | ||
18 | allocates and initializes a | ||
19 | .Vt DSA | ||
20 | structure. | ||
21 | It is equivalent to calling | ||
22 | .Fn DSA_new_method NULL . | ||
23 | .Pp | ||
24 | .Fn DSA_free | ||
25 | frees the | ||
26 | .Vt DSA | ||
27 | structure and its components. | ||
28 | The values are erased before the memory is returned to the system. | ||
29 | .Sh RETURN VALUES | ||
30 | If the allocation fails, | ||
31 | .Fn DSA_new | ||
32 | returns | ||
33 | .Dv NULL | ||
34 | and sets an error code that can be obtained by | ||
35 | .Xr ERR_get_error 3 . | ||
36 | Otherwise it returns a pointer to the newly allocated structure. | ||
37 | .Sh SEE ALSO | ||
38 | .Xr dsa 3 , | ||
39 | .Xr DSA_generate_key 3 , | ||
40 | .Xr DSA_generate_parameters 3 , | ||
41 | .Xr ERR_get_error 3 | ||
42 | .Sh HISTORY | ||
43 | .Fn DSA_new | ||
44 | and | ||
45 | .Fn DSA_free | ||
46 | are available in all versions of SSLeay and OpenSSL. | ||
diff --git a/src/lib/libcrypto/man/DSA_set_method.3 b/src/lib/libcrypto/man/DSA_set_method.3 new file mode 100644 index 0000000000..2ba34ddf94 --- /dev/null +++ b/src/lib/libcrypto/man/DSA_set_method.3 | |||
@@ -0,0 +1,224 @@ | |||
1 | .Dd $Mdocdate: November 2 2016 $ | ||
2 | .Dt DSA_SET_METHOD 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm DSA_set_default_method , | ||
6 | .Nm DSA_get_default_method , | ||
7 | .Nm DSA_set_method , | ||
8 | .Nm DSA_new_method , | ||
9 | .Nm DSA_OpenSSL , | ||
10 | .Nm DSA_set_default_openssl_method , | ||
11 | .Nm DSA_get_default_openssl_method | ||
12 | .Nd select DSA method | ||
13 | .Sh SYNOPSIS | ||
14 | .In openssl/dsa.h | ||
15 | .In openssl/engine.h | ||
16 | .Ft void | ||
17 | .Fo DSA_set_default_method | ||
18 | .Fa "const DSA_METHOD *meth" | ||
19 | .Fc | ||
20 | .Ft const DSA_METHOD * | ||
21 | .Fn DSA_get_default_method void | ||
22 | .Ft int | ||
23 | .Fo DSA_set_method | ||
24 | .Fa "DSA *dsa" | ||
25 | .Fa "const DSA_METHOD *meth" | ||
26 | .Fc | ||
27 | .Ft DSA * | ||
28 | .Fo DSA_new_method | ||
29 | .Fa "ENGINE *engine" | ||
30 | .Fc | ||
31 | .Ft DSA_METHOD * | ||
32 | .Fn DSA_OpenSSL void | ||
33 | .Sh DESCRIPTION | ||
34 | A | ||
35 | .Vt DSA_METHOD | ||
36 | specifies the functions that OpenSSL uses for DSA operations. | ||
37 | By modifying the method, alternative implementations such as hardware | ||
38 | accelerators may be used. | ||
39 | See the | ||
40 | .Sx CAVEATS | ||
41 | section for how these DSA API functions are affected by the use of | ||
42 | .Xr engine 3 | ||
43 | API calls. | ||
44 | .Pp | ||
45 | Initially, the default | ||
46 | .Vt DSA_METHOD | ||
47 | is the OpenSSL internal implementation, as returned by | ||
48 | .Fn DSA_OpenSSL . | ||
49 | .Pp | ||
50 | .Fn DSA_set_default_method | ||
51 | makes | ||
52 | .Fa meth | ||
53 | the default method for all | ||
54 | .Vt DSA | ||
55 | structures created later. | ||
56 | .Sy NB : | ||
57 | This is true only whilst no | ||
58 | .Vt ENGINE | ||
59 | has been set as a default for DSA, so this function is no longer | ||
60 | recommended. | ||
61 | .Pp | ||
62 | .Fn DSA_get_default_method | ||
63 | returns a pointer to the current default | ||
64 | .Vt DSA_METHOD . | ||
65 | However, the meaningfulness of this result is dependent on whether the | ||
66 | .Xr engine 3 | ||
67 | API is being used, so this function is no longer recommended. | ||
68 | .Pp | ||
69 | .Fn DSA_set_method | ||
70 | selects | ||
71 | .Fa meth | ||
72 | to perform all operations using the key | ||
73 | .Fa dsa . | ||
74 | This will replace the | ||
75 | .Vt DSA_METHOD | ||
76 | used by the DSA key and if the previous method was supplied by an | ||
77 | .Vt ENGINE , | ||
78 | the handle to that | ||
79 | .Vt ENGINE | ||
80 | will be released during the change. | ||
81 | It is possible to have DSA keys that only work with certain | ||
82 | .Vt DSA_METHOD | ||
83 | implementations (eg. from an | ||
84 | .Vt ENGINE | ||
85 | module that supports embedded hardware-protected keys), | ||
86 | and in such cases attempting to change the | ||
87 | .Vt DSA_METHOD | ||
88 | for the key can have unexpected results. | ||
89 | .Pp | ||
90 | .Fn DSA_new_method | ||
91 | allocates and initializes a | ||
92 | .Vt DSA | ||
93 | structure so that | ||
94 | .Fa engine | ||
95 | will be used for the DSA operations. | ||
96 | If | ||
97 | .Fa engine | ||
98 | is | ||
99 | .Dv NULL , | ||
100 | the default engine for DSA operations is used, and if no | ||
101 | default | ||
102 | .Vt ENGINE | ||
103 | is set, the | ||
104 | .Vt DSA_METHOD | ||
105 | controlled by | ||
106 | .Fn DSA_set_default_method | ||
107 | is used. | ||
108 | .Sh THE DSA_METHOD STRUCTURE | ||
109 | .Bd -literal | ||
110 | struct | ||
111 | { | ||
112 | /* name of the implementation */ | ||
113 | const char *name; | ||
114 | |||
115 | /* sign */ | ||
116 | DSA_SIG *(*dsa_do_sign)(const unsigned char *dgst, int dlen, | ||
117 | DSA *dsa); | ||
118 | |||
119 | /* pre-compute k^-1 and r */ | ||
120 | int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, | ||
121 | BIGNUM **rp); | ||
122 | |||
123 | /* verify */ | ||
124 | int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len, | ||
125 | DSA_SIG *sig, DSA *dsa); | ||
126 | |||
127 | /* compute rr = a1^p1 * a2^p2 mod m (May be NULL for some | ||
128 | implementations) */ | ||
129 | int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1, | ||
130 | BIGNUM *a2, BIGNUM *p2, BIGNUM *m, | ||
131 | BN_CTX *ctx, BN_MONT_CTX *in_mont); | ||
132 | |||
133 | /* compute r = a ^ p mod m (May be NULL for some implementations) */ | ||
134 | int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a, | ||
135 | const BIGNUM *p, const BIGNUM *m, | ||
136 | BN_CTX *ctx, BN_MONT_CTX *m_ctx); | ||
137 | |||
138 | /* called at DSA_new */ | ||
139 | int (*init)(DSA *DSA); | ||
140 | |||
141 | /* called at DSA_free */ | ||
142 | int (*finish)(DSA *DSA); | ||
143 | |||
144 | int flags; | ||
145 | |||
146 | char *app_data; /* ?? */ | ||
147 | |||
148 | } DSA_METHOD; | ||
149 | .Ed | ||
150 | .Sh RETURN VALUES | ||
151 | .Fn DSA_OpenSSL | ||
152 | and | ||
153 | .Fn DSA_get_default_method | ||
154 | return pointers to the respective | ||
155 | .Vt DSA_METHOD Ns s. | ||
156 | .Pp | ||
157 | .Fn DSA_set_method | ||
158 | returns non-zero if the provided | ||
159 | .Fa meth | ||
160 | was successfully set as the method for | ||
161 | .Fa dsa | ||
162 | (including unloading the | ||
163 | .Vt ENGINE | ||
164 | handle if the previous method was supplied by an | ||
165 | .Vt ENGINE ) . | ||
166 | .Pp | ||
167 | .Fn DSA_new_method | ||
168 | returns | ||
169 | .Dv NULL | ||
170 | and sets an error code that can be obtained by | ||
171 | .Xr ERR_get_error 3 | ||
172 | if the allocation fails. | ||
173 | Otherwise it returns a pointer to the newly allocated structure. | ||
174 | .Sh SEE ALSO | ||
175 | .Xr dsa 3 , | ||
176 | .Xr DSA_new 3 | ||
177 | .Sh HISTORY | ||
178 | .Fn DSA_set_default_method , | ||
179 | .Fn DSA_get_default_method , | ||
180 | .Fn DSA_set_method , | ||
181 | .Fn DSA_new_method , | ||
182 | and | ||
183 | .Fn DSA_OpenSSL | ||
184 | were added in OpenSSL 0.9.4. | ||
185 | .Pp | ||
186 | .Fn DSA_set_default_openssl_method | ||
187 | and | ||
188 | .Fn DSA_get_default_openssl_method | ||
189 | replaced | ||
190 | .Fn DSA_set_default_method | ||
191 | and | ||
192 | .Fn DSA_get_default_method | ||
193 | respectively, and | ||
194 | .Fn DSA_set_method | ||
195 | and | ||
196 | .Fn DSA_new_method | ||
197 | were altered to use | ||
198 | .Vt ENGINE Ns s | ||
199 | rather than | ||
200 | .Vt DSA_METHOD Ns s | ||
201 | during development of the engine version of OpenSSL 0.9.6. | ||
202 | For 0.9.7, the handling of defaults in the | ||
203 | .Xr engine 3 | ||
204 | API was restructured so that this change was reversed, and behaviour | ||
205 | of the other functions resembled more closely the previous behaviour. | ||
206 | The behaviour of defaults in the | ||
207 | .Xr engine 3 | ||
208 | API now transparently overrides the behaviour of defaults in the | ||
209 | DSA API without requiring changing these function prototypes. | ||
210 | .Sh CAVEATS | ||
211 | As of version 0.9.7, DSA_METHOD implementations are grouped together | ||
212 | with other algorithmic APIs (eg. RSA_METHOD, EVP_CIPHER, etc) in | ||
213 | .Vt ENGINE | ||
214 | modules. | ||
215 | If a default | ||
216 | .Vt ENGINE | ||
217 | is specified for DSA functionality using an | ||
218 | .Xr engine 3 | ||
219 | API function, that will override any DSA defaults set using the DSA API | ||
220 | .Pq ie. DSA_set_default_method . | ||
221 | For this reason, the | ||
222 | .Xr engine 3 | ||
223 | API is the recommended way to control default implementations for | ||
224 | use in DSA and other cryptographic algorithms. | ||
diff --git a/src/lib/libcrypto/man/DSA_sign.3 b/src/lib/libcrypto/man/DSA_sign.3 new file mode 100644 index 0000000000..371f1f4555 --- /dev/null +++ b/src/lib/libcrypto/man/DSA_sign.3 | |||
@@ -0,0 +1,122 @@ | |||
1 | .Dd $Mdocdate: November 2 2016 $ | ||
2 | .Dt DSA_SIGN 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm DSA_sign , | ||
6 | .Nm DSA_sign_setup , | ||
7 | .Nm DSA_verify | ||
8 | .Nd DSA signatures | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/dsa.h | ||
11 | .Ft int | ||
12 | .Fo DSA_sign | ||
13 | .Fa "int type" | ||
14 | .Fa "const unsigned char *dgst" | ||
15 | .Fa "int len" | ||
16 | .Fa "unsigned char *sigret" | ||
17 | .Fa "unsigned int *siglen" | ||
18 | .Fa "DSA *dsa" | ||
19 | .Fc | ||
20 | .Ft int | ||
21 | .Fo DSA_sign_setup | ||
22 | .Fa "DSA *dsa" | ||
23 | .Fa "BN_CTX *ctx" | ||
24 | .Fa "BIGNUM **kinvp" | ||
25 | .Fa "BIGNUM **rp" | ||
26 | .Fc | ||
27 | .Ft int | ||
28 | .Fo DSA_verify | ||
29 | .Fa "int type" | ||
30 | .Fa "const unsigned char *dgst" | ||
31 | .Fa "int len" | ||
32 | .Fa "unsigned char *sigbuf" | ||
33 | .Fa "int siglen" | ||
34 | .Fa "DSA *dsa" | ||
35 | .Fc | ||
36 | .Sh DESCRIPTION | ||
37 | .Fn DSA_sign | ||
38 | computes a digital signature on the | ||
39 | .Fa len | ||
40 | byte message digest | ||
41 | .Fa dgst | ||
42 | using the private key | ||
43 | .Fa dsa | ||
44 | and places its ASN.1 DER encoding at | ||
45 | .Fa sigret . | ||
46 | The length of the signature is placed in | ||
47 | .Pf * Fa siglen . | ||
48 | .Fa sigret | ||
49 | must point to | ||
50 | .Fn DSA_size dsa | ||
51 | bytes of memory. | ||
52 | .Pp | ||
53 | .Fn DSA_sign_setup | ||
54 | may be used to precompute part of the signing operation in case | ||
55 | signature generation is time-critical. | ||
56 | It expects | ||
57 | .Fa dsa | ||
58 | to contain DSA parameters. | ||
59 | It places the precomputed values in newly allocated | ||
60 | .Vt BIGNUM Ns s | ||
61 | at | ||
62 | .Pf * Fa kinvp | ||
63 | and | ||
64 | .Pf * Fa rp , | ||
65 | after freeing the old ones unless | ||
66 | .Fa kinvp | ||
67 | and | ||
68 | .Fa rp | ||
69 | are | ||
70 | .Dv NULL . | ||
71 | These values may be passed to | ||
72 | .Fn DSA_sign | ||
73 | in | ||
74 | .Fa dsa->kinv | ||
75 | and | ||
76 | .Sy dsa->r . | ||
77 | .Fa ctx | ||
78 | is a pre-allocated | ||
79 | .Vt BN_CTX | ||
80 | or | ||
81 | .Dv NULL . | ||
82 | .Pp | ||
83 | .Fn DSA_verify | ||
84 | verifies that the signature | ||
85 | .Fa sigbuf | ||
86 | of size | ||
87 | .Fa siglen | ||
88 | matches a given message digest | ||
89 | .Fa dgst | ||
90 | of size | ||
91 | .Fa len . | ||
92 | .Fa dsa | ||
93 | is the signer's public key. | ||
94 | .Pp | ||
95 | The | ||
96 | .Fa type | ||
97 | parameter is ignored. | ||
98 | .Sh RETURN VALUES | ||
99 | .Fn DSA_sign | ||
100 | and | ||
101 | .Fn DSA_sign_setup | ||
102 | return 1 on success or 0 on error. | ||
103 | .Fn DSA_verify | ||
104 | returns 1 for a valid signature, 0 for an incorrect signature, | ||
105 | and -1 on error. | ||
106 | The error codes can be obtained by | ||
107 | .Xr ERR_get_error 3 . | ||
108 | .Sh SEE ALSO | ||
109 | .Xr dsa 3 , | ||
110 | .Xr DSA_do_sign 3 , | ||
111 | .Xr ERR_get_error 3 , | ||
112 | .Xr rand 3 | ||
113 | .Sh STANDARDS | ||
114 | US Federal Information Processing Standard FIPS 186 (Digital Signature | ||
115 | Standard, DSS), ANSI X9.30 | ||
116 | .Sh HISTORY | ||
117 | .Fn DSA_sign | ||
118 | and | ||
119 | .Fn DSA_verify | ||
120 | are available in all versions of SSLeay. | ||
121 | .Fn DSA_sign_setup | ||
122 | was added in SSLeay 0.8. | ||
diff --git a/src/lib/libcrypto/man/DSA_size.3 b/src/lib/libcrypto/man/DSA_size.3 new file mode 100644 index 0000000000..64dce38f7c --- /dev/null +++ b/src/lib/libcrypto/man/DSA_size.3 | |||
@@ -0,0 +1,29 @@ | |||
1 | .Dd $Mdocdate: November 2 2016 $ | ||
2 | .Dt DSA_SIZE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm DSA_size | ||
6 | .Nd get DSA signature size | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/dsa.h | ||
9 | .Ft int | ||
10 | .Fo DSA_size | ||
11 | .Fa "const DSA *dsa" | ||
12 | .Fc | ||
13 | .Sh DESCRIPTION | ||
14 | This function returns the size of an ASN.1 encoded DSA signature in | ||
15 | bytes. | ||
16 | It can be used to determine how much memory must be allocated for a DSA | ||
17 | signature. | ||
18 | .Pp | ||
19 | .Fa dsa->q | ||
20 | must not be | ||
21 | .Dv NULL . | ||
22 | .Sh RETURN VALUE | ||
23 | The size in bytes. | ||
24 | .Sh SEE ALSO | ||
25 | .Xr dsa 3 , | ||
26 | .Xr DSA_sign 3 | ||
27 | .Sh HISTORY | ||
28 | .Fn DSA_size | ||
29 | is available in all versions of SSLeay and OpenSSL. | ||
diff --git a/src/lib/libcrypto/man/EC_GFp_simple_method.3 b/src/lib/libcrypto/man/EC_GFp_simple_method.3 new file mode 100644 index 0000000000..8f401e85c8 --- /dev/null +++ b/src/lib/libcrypto/man/EC_GFp_simple_method.3 | |||
@@ -0,0 +1,108 @@ | |||
1 | .Dd $Mdocdate: November 2 2016 $ | ||
2 | .Dt EC_GFP_SIMPLE_METHOD 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm EC_GFp_simple_method , | ||
6 | .Nm EC_GFp_mont_method , | ||
7 | .Nm EC_GFp_nist_method , | ||
8 | .Nm EC_GFp_nistp224_method , | ||
9 | .Nm EC_GFp_nistp256_method , | ||
10 | .Nm EC_GFp_nistp521_method , | ||
11 | .Nm EC_GF2m_simple_method , | ||
12 | .Nm EC_METHOD_get_field_type | ||
13 | .Nd obtain EC_METHOD objects | ||
14 | .Sh SYNOPSIS | ||
15 | .In openssl/ec.h | ||
16 | .Ft const EC_METHOD * | ||
17 | .Fn EC_GFp_simple_method void | ||
18 | .Ft const EC_METHOD * | ||
19 | .Fn EC_GFp_mont_method void | ||
20 | .Ft const EC_METHOD * | ||
21 | .Fn EC_GFp_nist_method void | ||
22 | .Ft const EC_METHOD * | ||
23 | .Fn EC_GFp_nistp224_method void | ||
24 | .Ft const EC_METHOD * | ||
25 | .Fn EC_GFp_nistp256_method void | ||
26 | .Ft const EC_METHOD * | ||
27 | .Fn EC_GFp_nistp521_method void | ||
28 | .Ft const EC_METHOD * | ||
29 | .Fn EC_GF2m_simple_method void | ||
30 | .Ft int | ||
31 | .Fo EC_METHOD_get_field_type | ||
32 | .Fa "const EC_METHOD *meth" | ||
33 | .Fc | ||
34 | .Sh DESCRIPTION | ||
35 | The elliptic curve library provides a number of different | ||
36 | implementations through a single common interface. | ||
37 | When constructing a curve using | ||
38 | .Xr EC_GROUP_new 3 , | ||
39 | an implementation method must be provided. | ||
40 | The functions described here all return a const pointer to an | ||
41 | .Sy EC_METHOD | ||
42 | structure that can be passed to | ||
43 | .Xr EC_GROUP_new . | ||
44 | It is important that the correct implementation type for the form | ||
45 | of curve selected is used. | ||
46 | .Pp | ||
47 | For F2^m curves there is only one implementation choice, | ||
48 | .Fn EC_GF2_simple_method . | ||
49 | .Pp | ||
50 | For Fp curves the lowest common denominator implementation is the | ||
51 | .Fn EC_GFp_simple_method | ||
52 | implementation. | ||
53 | All other implementations are based on this one. | ||
54 | .Fn EC_GFp_mont_method | ||
55 | adds the use of montgomery multiplication (see | ||
56 | .Xr BN_mod_mul_montgomery 3 ) . | ||
57 | .Fn EC_GFp_nist_method | ||
58 | offers an implementation optimised for use with NIST recommended | ||
59 | curves. | ||
60 | NIST curves are available through | ||
61 | .Xr EC_GROUP_new_by_curve_name 3 . | ||
62 | .Pp | ||
63 | The functions | ||
64 | .Fn EC_GFp_nistp224_method , | ||
65 | .Fn EC_GFp_nistp256_method , | ||
66 | and | ||
67 | .Fn EC_GFp_nistp521_method | ||
68 | offer 64 bit optimised implementations for the NIST P224, P256 and | ||
69 | P521 curves respectively. | ||
70 | Note, however, that these implementations are not available on all | ||
71 | platforms. | ||
72 | .Pp | ||
73 | .Fn EC_METHOD_get_field_type | ||
74 | identifies what type of field the | ||
75 | .Vt EC_METHOD | ||
76 | structure supports, which will be either F2^m or Fp. | ||
77 | If the field type is Fp, then the value | ||
78 | .Dv NID_X9_62_prime_field | ||
79 | is returned. | ||
80 | If the field type is F2^m, then the value | ||
81 | .Dv NID_X9_62_characteristic_two_field | ||
82 | is returned. | ||
83 | These values are defined in the | ||
84 | .In openssl/obj_mac.h | ||
85 | header file. | ||
86 | .Sh RETURN VALUES | ||
87 | All | ||
88 | .Fn EC_GFp* | ||
89 | functions and | ||
90 | .Fn EC_GF2m_simple_method | ||
91 | always return a const pointer to an | ||
92 | .Vt EC_METHOD | ||
93 | structure. | ||
94 | .Pp | ||
95 | .Fn EC_METHOD_get_field_type | ||
96 | returns an integer that identifies the type of field the | ||
97 | .Vt EC_METHOD | ||
98 | structure supports. | ||
99 | .Sh SEE ALSO | ||
100 | .Xr BN_mod_mul_montgomery 3 , | ||
101 | .Xr crypto 3 , | ||
102 | .Xr d2i_ECPKParameters 3 , | ||
103 | .Xr ec 3 , | ||
104 | .Xr EC_GROUP_copy 3 , | ||
105 | .Xr EC_GROUP_new 3 , | ||
106 | .Xr EC_KEY_new 3 , | ||
107 | .Xr EC_POINT_add 3 , | ||
108 | .Xr EC_POINT_new 3 | ||
diff --git a/src/lib/libcrypto/man/EC_GROUP_copy.3 b/src/lib/libcrypto/man/EC_GROUP_copy.3 new file mode 100644 index 0000000000..61c094700a --- /dev/null +++ b/src/lib/libcrypto/man/EC_GROUP_copy.3 | |||
@@ -0,0 +1,434 @@ | |||
1 | .Dd $Mdocdate: November 2 2016 $ | ||
2 | .Dt EC_GROUP_COPY 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm EC_GROUP_copy , | ||
6 | .Nm EC_GROUP_dup , | ||
7 | .Nm EC_GROUP_method_of , | ||
8 | .Nm EC_GROUP_set_generator , | ||
9 | .Nm EC_GROUP_get0_generator , | ||
10 | .Nm EC_GROUP_get_order , | ||
11 | .Nm EC_GROUP_get_cofactor , | ||
12 | .Nm EC_GROUP_set_curve_name , | ||
13 | .Nm EC_GROUP_get_curve_name , | ||
14 | .Nm EC_GROUP_set_asn1_flag , | ||
15 | .Nm EC_GROUP_get_asn1_flag , | ||
16 | .Nm EC_GROUP_set_point_conversion_form , | ||
17 | .Nm EC_GROUP_get_point_conversion_form , | ||
18 | .Nm EC_GROUP_get0_seed , | ||
19 | .Nm EC_GROUP_get_seed_len , | ||
20 | .Nm EC_GROUP_set_seed , | ||
21 | .Nm EC_GROUP_get_degree , | ||
22 | .Nm EC_GROUP_check , | ||
23 | .Nm EC_GROUP_check_discriminant , | ||
24 | .Nm EC_GROUP_cmp , | ||
25 | .Nm EC_GROUP_get_basis_type , | ||
26 | .Nm EC_GROUP_get_trinomial_basis , | ||
27 | .Nm EC_GROUP_get_pentanomial_basis | ||
28 | .Nd manipulate EC_GROUP objects | ||
29 | .Sh SYNOPSIS | ||
30 | .In openssl/ec.h | ||
31 | .In openssl/bn.h | ||
32 | .Ft int | ||
33 | .Fo EC_GROUP_copy | ||
34 | .Fa "EC_GROUP *dst" | ||
35 | .Fa "const EC_GROUP *src" | ||
36 | .Fc | ||
37 | .Ft EC_GROUP * | ||
38 | .Fo EC_GROUP_dup | ||
39 | .Fa "const EC_GROUP *src" | ||
40 | .Fc | ||
41 | .Ft const EC_METHOD * | ||
42 | .Fo EC_GROUP_method_of | ||
43 | .Fa "const EC_GROUP *group" | ||
44 | .Fc | ||
45 | .Ft int | ||
46 | .Fo EC_GROUP_set_generator | ||
47 | .Fa "EC_GROUP *group" | ||
48 | .Fa "const EC_POINT *generator" | ||
49 | .Fa "const BIGNUM *order" | ||
50 | .Fa "const BIGNUM *cofactor" | ||
51 | .Fc | ||
52 | .Ft const EC_POINT * | ||
53 | .Fo EC_GROUP_get0_generator | ||
54 | .Fa "const EC_GROUP *group" | ||
55 | .Fc | ||
56 | .Ft int | ||
57 | .Fo EC_GROUP_get_order | ||
58 | .Fa "const EC_GROUP *group" | ||
59 | .Fa "BIGNUM *order" | ||
60 | .Fa "BN_CTX *ctx" | ||
61 | .Fc | ||
62 | .Ft int | ||
63 | .Fo EC_GROUP_get_cofactor | ||
64 | .Fa "const EC_GROUP *group" | ||
65 | .Fa "BIGNUM *cofactor" | ||
66 | .Fa "BN_CTX *ctx" | ||
67 | .Fc | ||
68 | .Ft void | ||
69 | .Fo EC_GROUP_set_curve_name | ||
70 | .Fa "EC_GROUP *group" | ||
71 | .Fa "int nid" | ||
72 | .Fc | ||
73 | .Ft int | ||
74 | .Fo EC_GROUP_get_curve_name | ||
75 | .Fa "const EC_GROUP *group" | ||
76 | .Fc | ||
77 | .Ft void | ||
78 | .Fo EC_GROUP_set_asn1_flag | ||
79 | .Fa "EC_GROUP *group" | ||
80 | .Fa "int flag" | ||
81 | .Fc | ||
82 | .Ft int | ||
83 | .Fo EC_GROUP_get_asn1_flag | ||
84 | .Fa "const EC_GROUP *group" | ||
85 | .Fc | ||
86 | .Ft void | ||
87 | .Fo EC_GROUP_set_point_conversion_form | ||
88 | .Fa "EC_GROUP *group" | ||
89 | .Fa "point_conversion_form_t form" | ||
90 | .Fc | ||
91 | .Ft point_conversion_form_t | ||
92 | .Fo EC_GROUP_get_point_conversion_form | ||
93 | .Fa "const EC_GROUP *" | ||
94 | .Fc | ||
95 | .Ft unsigned char * | ||
96 | .Fo EC_GROUP_get0_seed | ||
97 | .Fa "const EC_GROUP *x" | ||
98 | .Fc | ||
99 | .Ft size_t | ||
100 | .Fo EC_GROUP_get_seed_len | ||
101 | .Fa "const EC_GROUP *" | ||
102 | .Fc | ||
103 | .Ft size_t | ||
104 | .Fo EC_GROUP_set_seed | ||
105 | .Fa "EC_GROUP *" | ||
106 | .Fa "const unsigned char *" | ||
107 | .Fa "size_t len" | ||
108 | .Fc | ||
109 | .Ft int | ||
110 | .Fo EC_GROUP_get_degree | ||
111 | .Fa "const EC_GROUP *group" | ||
112 | .Fc | ||
113 | .Ft int | ||
114 | .Fo EC_GROUP_check | ||
115 | .Fa "const EC_GROUP *group" | ||
116 | .Fa "BN_CTX *ctx" | ||
117 | .Fc | ||
118 | .Ft int | ||
119 | .Fo EC_GROUP_check_discriminant | ||
120 | .Fa "const EC_GROUP *group" | ||
121 | .Fa "BN_CTX *ctx" | ||
122 | .Fc | ||
123 | .Ft int | ||
124 | .Fo EC_GROUP_cmp | ||
125 | .Fa "const EC_GROUP *a" | ||
126 | .Fa "const EC_GROUP *b" | ||
127 | .Fa "BN_CTX *ctx" | ||
128 | .Fc | ||
129 | .Ft int | ||
130 | .Fo EC_GROUP_get_basis_type | ||
131 | .Fa "const EC_GROUP *" | ||
132 | .Fc | ||
133 | .Ft int | ||
134 | .Fo EC_GROUP_get_trinomial_basis | ||
135 | .Fa "const EC_GROUP *" | ||
136 | .Fa "unsigned int *k" | ||
137 | .Fc | ||
138 | .Ft int | ||
139 | .Fo EC_GROUP_get_pentanomial_basis | ||
140 | .Fa "const EC_GROUP *" | ||
141 | .Fa "unsigned int *k1" | ||
142 | .Fa "unsigned int *k2" | ||
143 | .Fa "unsigned int *k3" | ||
144 | .Fc | ||
145 | .Sh DESCRIPTION | ||
146 | .Fn EC_GROUP_copy | ||
147 | copies the curve | ||
148 | .Fa src | ||
149 | into | ||
150 | .Fa dst . | ||
151 | Both | ||
152 | .Fa src | ||
153 | and | ||
154 | .Fa dst | ||
155 | must use the same | ||
156 | .Vt EC_METHOD . | ||
157 | .Pp | ||
158 | .Fn EC_GROUP_dup | ||
159 | creates a new | ||
160 | .Vt EC_GROUP | ||
161 | object and copies the content from | ||
162 | .Fa src | ||
163 | to the newly created | ||
164 | .Vt EC_GROUP | ||
165 | object. | ||
166 | .Pp | ||
167 | .Fn EC_GROUP_method_of | ||
168 | obtains the | ||
169 | .Vt EC_METHOD | ||
170 | of | ||
171 | .Fa group . | ||
172 | .Pp | ||
173 | .Fn EC_GROUP_set_generator | ||
174 | sets curve paramaters that must be agreed by all participants using | ||
175 | the curve. | ||
176 | These paramaters include the | ||
177 | .Fa generator , | ||
178 | the | ||
179 | .Fa order | ||
180 | and the | ||
181 | .Fa cofactor . | ||
182 | The | ||
183 | .Fa generator | ||
184 | is a well defined point on the curve chosen for cryptographic | ||
185 | operations. | ||
186 | Integers used for point multiplications will be between 0 and | ||
187 | .Fa order No - 1 . | ||
188 | The | ||
189 | .Fa order | ||
190 | multipied by the | ||
191 | .Fa cofactor | ||
192 | gives the number of points on the curve. | ||
193 | .Pp | ||
194 | .Fn EC_GROUP_get0_generator | ||
195 | returns the generator for the identified | ||
196 | .Fa group . | ||
197 | .Pp | ||
198 | The functions | ||
199 | .Fn EC_GROUP_get_order | ||
200 | and | ||
201 | .Fn EC_GROUP_get_cofactor | ||
202 | populate the provided | ||
203 | .Fa order | ||
204 | and | ||
205 | .Fa cofactor | ||
206 | parameters with the respective order and cofactors for the | ||
207 | .Fa group . | ||
208 | .Pp | ||
209 | The functions | ||
210 | .Fn EC_GROUP_set_curve_name | ||
211 | and | ||
212 | .Fn EC_GROUP_get_curve_name | ||
213 | set and get the NID for the curve, respectively (see | ||
214 | .Xr EC_GROUP_new 3 ) . | ||
215 | If a curve does not have a NID associated with it, then | ||
216 | .Fn EC_GROUP_get_curve_name | ||
217 | will return 0. | ||
218 | .Pp | ||
219 | The asn1_flag value on a curve is used to determine whether there is a | ||
220 | specific ASN1 OID to describe the curve or not. | ||
221 | If the asn1_flag is 1 then this is a named curve with an associated ASN1 OID. | ||
222 | If not then asn1_flag is 0. | ||
223 | The functions | ||
224 | .Fn EC_GROUP_get_asn1_flag | ||
225 | and | ||
226 | .Fn EC_GROUP_set_asn1_flag | ||
227 | get and set the status of the asn1_flag for the curve. | ||
228 | If set, then the curve_name must also be set. | ||
229 | .Pp | ||
230 | The point_conversion_form for a curve controls how | ||
231 | .Vt EC_POINT | ||
232 | data is encoded as ASN1 as defined in X9.62 (ECDSA). | ||
233 | .Vt point_conversion_form_t | ||
234 | is an enum defined as follows: | ||
235 | .Bd -literal | ||
236 | typedef enum { | ||
237 | /** the point is encoded as z||x, where the octet z specifies | ||
238 | * which solution of the quadratic equation y is */ | ||
239 | POINT_CONVERSION_COMPRESSED = 2, | ||
240 | /** the point is encoded as z||x||y, where z is the octet 0x02 */ | ||
241 | POINT_CONVERSION_UNCOMPRESSED = 4, | ||
242 | /** the point is encoded as z||x||y, where the octet z specifies | ||
243 | * which solution of the quadratic equation y is */ | ||
244 | POINT_CONVERSION_HYBRID = 6 | ||
245 | } point_conversion_form_t; | ||
246 | .Ed | ||
247 | .Pp | ||
248 | For | ||
249 | .Dv POINT_CONVERSION_UNCOMPRESSED | ||
250 | the point is encoded as an octet signifying the UNCOMPRESSED form | ||
251 | has been used followed by the octets for x, followed by the octets | ||
252 | for y. | ||
253 | .Pp | ||
254 | For any given x co-ordinate for a point on a curve it is possible to | ||
255 | derive two possible y values. | ||
256 | For | ||
257 | .Dv POINT_CONVERSION_COMPRESSED | ||
258 | the point is encoded as an octet signifying that the COMPRESSED | ||
259 | form has been used AND which of the two possible solutions for y | ||
260 | has been used, followed by the octets for x. | ||
261 | .Pp | ||
262 | For | ||
263 | .Dv POINT_CONVERSION_HYBRID | ||
264 | the point is encoded as an octet signifying the HYBRID form has | ||
265 | been used AND which of the two possible solutions for y has been | ||
266 | used, followed by the octets for x, followed by the octets for y. | ||
267 | .Pp | ||
268 | The functions | ||
269 | .Fn EC_GROUP_set_point_conversion_form | ||
270 | and | ||
271 | .Fn EC_GROUP_get_point_conversion_form | ||
272 | set and get the point_conversion_form for the curve, respectively. | ||
273 | .Pp | ||
274 | ANSI X9.62 (ECDSA standard) defines a method of generating the curve | ||
275 | parameter b from a random number. | ||
276 | This provides advantages in that a parameter obtained in this way is | ||
277 | highly unlikely to be susceptible to special purpose attacks, or have | ||
278 | any trapdoors in it. | ||
279 | If the seed is present for a curve then the b parameter was generated in | ||
280 | a verifiable fashion using that seed. | ||
281 | The OpenSSL EC library does not use this seed value but does enable you | ||
282 | to inspect it using | ||
283 | .Fn EC_GROUP_get0_seed . | ||
284 | This returns a pointer to a memory block containing the seed that was | ||
285 | used. | ||
286 | The length of the memory block can be obtained using | ||
287 | .Fn EC_GROUP_get_seed_len . | ||
288 | A number of the builtin curves within the library provide seed values | ||
289 | that can be obtained. | ||
290 | It is also possible to set a custom seed using | ||
291 | .Fn EC_GROUP_set_seed | ||
292 | and passing a pointer to a memory block, along with the length of | ||
293 | the seed. | ||
294 | Again, the EC library will not use this seed value, although it will be | ||
295 | preserved in any ASN1 based communications. | ||
296 | .Pp | ||
297 | .Fn EC_GROUP_get_degree | ||
298 | gets the degree of the field. | ||
299 | For Fp fields this will be the number of bits in p. | ||
300 | For F2^m fields this will be the value m. | ||
301 | .Pp | ||
302 | The function | ||
303 | .Fn EC_GROUP_check_discriminant | ||
304 | calculates the discriminant for the curve and verifies that it is | ||
305 | valid. | ||
306 | For a curve defined over Fp the discriminant is given by the formula | ||
307 | 4*a^3 + 27*b^2 whilst for F2^m curves the discriminant is simply b. | ||
308 | In either case for the curve to be valid the discriminant must be | ||
309 | non-zero. | ||
310 | .Pp | ||
311 | The function | ||
312 | .Fn EC_GROUP_check | ||
313 | performs a number of checks on a curve to verify that it is valid. | ||
314 | Checks performed include verifying that the discriminant is non zero; | ||
315 | that a generator has been defined; that the generator is on the curve | ||
316 | and has the correct order. | ||
317 | .Pp | ||
318 | .Fn EC_GROUP_cmp | ||
319 | compares | ||
320 | .Fa a | ||
321 | and | ||
322 | .Fa b | ||
323 | to determine whether they represent the same curve or not. | ||
324 | .Pp | ||
325 | The functions | ||
326 | .Fn EC_GROUP_get_basis_type , | ||
327 | .Fn EC_GROUP_get_trinomial_basis , | ||
328 | and | ||
329 | .Fn EC_GROUP_get_pentanomial_basis | ||
330 | should only be called for curves defined over an F2^m field. | ||
331 | Addition and multiplication operations within an F2^m field are | ||
332 | performed using an irreducible polynomial function f(x). | ||
333 | This function is either a trinomial of the form: | ||
334 | .Pp | ||
335 | .Dl f(x) = x^m + x^k + 1 with m > k >= 1 | ||
336 | .Pp | ||
337 | or a pentanomial of the form: | ||
338 | .Pp | ||
339 | .Dl f(x) = x^m + x^k3 + x^k2 + x^k1 + 1 with m > k3 > k2 > k1 >= 1 | ||
340 | .Pp | ||
341 | The function | ||
342 | .Fn EC_GROUP_get_basis_type | ||
343 | returns a NID identifying whether a trinomial or pentanomial is in | ||
344 | use for the field. | ||
345 | The function | ||
346 | .Fn EC_GROUP_get_trinomial_basis | ||
347 | must only be called where f(x) is of the trinomial form, and returns | ||
348 | the value of | ||
349 | .Fa k . | ||
350 | Similarly, the function | ||
351 | .Fn EC_GROUP_get_pentanomial_basis | ||
352 | must only be called where f(x) is of the pentanomial form, and | ||
353 | returns the values of | ||
354 | .Fa k1 , | ||
355 | .Fa k2 , | ||
356 | and | ||
357 | .Fa k3 . | ||
358 | .Sh RETURN VALUES | ||
359 | The following functions return 1 on success or 0 on error: | ||
360 | .Fn EC_GROUP_copy , | ||
361 | .Fn EC_GROUP_set_generator , | ||
362 | .Fn EC_GROUP_check , | ||
363 | .Fn EC_GROUP_check_discriminant , | ||
364 | .Fn EC_GROUP_get_trinomial_basis , | ||
365 | and | ||
366 | .Fn EC_GROUP_get_pentanomial_basis . | ||
367 | .Pp | ||
368 | .Fn EC_GROUP_dup | ||
369 | returns a pointer to the duplicated curve or | ||
370 | .Dv NULL | ||
371 | on error. | ||
372 | .Pp | ||
373 | .Fn EC_GROUP_method_of | ||
374 | returns the | ||
375 | .Vt EC_METHOD | ||
376 | implementation in use for the given curve or | ||
377 | .Dv NULL | ||
378 | on error. | ||
379 | .Pp | ||
380 | .Fn EC_GROUP_get0_generator | ||
381 | returns the generator for the given curve or | ||
382 | .Dv NULL | ||
383 | on error. | ||
384 | .Pp | ||
385 | .Fn EC_GROUP_get_order , | ||
386 | .Fn EC_GROUP_get_cofactor , | ||
387 | .Fn EC_GROUP_get_curve_name , | ||
388 | .Fn EC_GROUP_get_asn1_flag , | ||
389 | .Fn EC_GROUP_get_point_conversion_form , | ||
390 | and | ||
391 | .Fn EC_GROUP_get_degree | ||
392 | return the order, cofactor, curve name (NID), ASN1 flag, | ||
393 | point_conversion_form and degree for the specified curve, respectively. | ||
394 | If there is no curve name associated with a curve then | ||
395 | .Fn EC_GROUP_get_curve_name | ||
396 | returns 0. | ||
397 | .Pp | ||
398 | .Fn EC_GROUP_get0_seed | ||
399 | returns a pointer to the seed that was used to generate the parameter | ||
400 | b, or | ||
401 | .Dv NULL | ||
402 | if the seed is not specified. | ||
403 | .Fn EC_GROUP_get_seed_len | ||
404 | returns the length of the seed or 0 if the seed is not specified. | ||
405 | .Pp | ||
406 | .Fn EC_GROUP_set_seed | ||
407 | returns the length of the seed that has been set. | ||
408 | If the supplied seed is | ||
409 | .Dv NULL | ||
410 | or the supplied seed length is 0, the return value will be 1. | ||
411 | On error 0 is returned. | ||
412 | .Pp | ||
413 | .Fn EC_GROUP_cmp | ||
414 | returns 0 if the curves are equal, 1 if they are not equal, | ||
415 | or -1 on error. | ||
416 | .Pp | ||
417 | .Fn EC_GROUP_get_basis_type | ||
418 | returns the values | ||
419 | .Dv NID_X9_62_tpBasis | ||
420 | or | ||
421 | .Dv NID_X9_62_ppBasis | ||
422 | as defined in | ||
423 | .In openssl/obj_mac.h | ||
424 | for a trinomial or pentanomial, respectively. | ||
425 | Alternatively in the event of an error a 0 is returned. | ||
426 | .Sh SEE ALSO | ||
427 | .Xr crypto 3 , | ||
428 | .Xr d2i_ECPKParameters 3 , | ||
429 | .Xr ec 3 , | ||
430 | .Xr EC_GFp_simple_method 3 , | ||
431 | .Xr EC_GROUP_new 3 , | ||
432 | .Xr EC_KEY_new 3 , | ||
433 | .Xr EC_POINT_add 3 , | ||
434 | .Xr EC_POINT_new 3 | ||
diff --git a/src/lib/libcrypto/man/EC_GROUP_new.3 b/src/lib/libcrypto/man/EC_GROUP_new.3 new file mode 100644 index 0000000000..00690dfc07 --- /dev/null +++ b/src/lib/libcrypto/man/EC_GROUP_new.3 | |||
@@ -0,0 +1,240 @@ | |||
1 | .Dd $Mdocdate: November 2 2016 $ | ||
2 | .Dt EC_GROUP_NEW 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm EC_GROUP_new , | ||
6 | .Nm EC_GROUP_free , | ||
7 | .Nm EC_GROUP_clear_free , | ||
8 | .Nm EC_GROUP_new_curve_GFp , | ||
9 | .Nm EC_GROUP_new_curve_GF2m , | ||
10 | .Nm EC_GROUP_new_by_curve_name , | ||
11 | .Nm EC_GROUP_set_curve_GFp , | ||
12 | .Nm EC_GROUP_get_curve_GFp , | ||
13 | .Nm EC_GROUP_set_curve_GF2m , | ||
14 | .Nm EC_GROUP_get_curve_GF2m , | ||
15 | .Nm EC_get_builtin_curves | ||
16 | .Nd create and destroy EC_GROUP objects | ||
17 | .Sh SYNOPSIS | ||
18 | .In openssl/ec.h | ||
19 | .In openssl/bn.h | ||
20 | .Ft EC_GROUP * | ||
21 | .Fo EC_GROUP_new | ||
22 | .Fa "const EC_METHOD *meth" | ||
23 | .Fc | ||
24 | .Ft void | ||
25 | .Fo EC_GROUP_free | ||
26 | .Fa "EC_GROUP *group" | ||
27 | .Fc | ||
28 | .Ft void | ||
29 | .Fo EC_GROUP_clear_free | ||
30 | .Fa "EC_GROUP *group" | ||
31 | .Fc | ||
32 | .Ft EC_GROUP * | ||
33 | .Fo EC_GROUP_new_curve_GFp | ||
34 | .Fa "const BIGNUM *p" | ||
35 | .Fa "const BIGNUM *a" | ||
36 | .Fa "const BIGNUM *b" | ||
37 | .Fa "BN_CTX *ctx" | ||
38 | .Fc | ||
39 | .Ft EC_GROUP * | ||
40 | .Fo EC_GROUP_new_curve_GF2m | ||
41 | .Fa "const BIGNUM *p" | ||
42 | .Fa "const BIGNUM *a" | ||
43 | .Fa "const BIGNUM *b" | ||
44 | .Fa "BN_CTX *ctx" | ||
45 | .Fc | ||
46 | .Ft EC_GROUP * | ||
47 | .Fo EC_GROUP_new_by_curve_name | ||
48 | .Fa "int nid" | ||
49 | .Fc | ||
50 | .Ft int | ||
51 | .Fo EC_GROUP_set_curve_GFp | ||
52 | .Fa "EC_GROUP *group" | ||
53 | .Fa "const BIGNUM *p" | ||
54 | .Fa "const BIGNUM *a" | ||
55 | .Fa "const BIGNUM *b" | ||
56 | .Fa "BN_CTX *ctx" | ||
57 | .Fc | ||
58 | .Ft int | ||
59 | .Fo EC_GROUP_get_curve_GFp | ||
60 | .Fa "const EC_GROUP *group" | ||
61 | .Fa "BIGNUM *p" | ||
62 | .Fa "BIGNUM *a" | ||
63 | .Fa "BIGNUM *b" | ||
64 | .Fa "BN_CTX *ctx" | ||
65 | .Fc | ||
66 | .Ft int | ||
67 | .Fo EC_GROUP_set_curve_GF2m | ||
68 | .Fa "EC_GROUP *group" | ||
69 | .Fa "const BIGNUM *p" | ||
70 | .Fa "const BIGNUM *a" | ||
71 | .Fa "const BIGNUM *b" | ||
72 | .Fa "BN_CTX *ctx" | ||
73 | .Fc | ||
74 | .Ft int | ||
75 | .Fo EC_GROUP_get_curve_GF2m | ||
76 | .Fa "const EC_GROUP *group" | ||
77 | .Fa "BIGNUM *p" | ||
78 | .Fa "BIGNUM *a" | ||
79 | .Fa "BIGNUM *b" | ||
80 | .Fa "BN_CTX *ctx" | ||
81 | .Fc | ||
82 | .Ft size_t | ||
83 | .Fo EC_get_builtin_curves | ||
84 | .Fa "EC_builtin_curve *r" | ||
85 | .Fa "size_t nitems" | ||
86 | .Fc | ||
87 | .Sh DESCRIPTION | ||
88 | Within the library there are two forms of elliptic curves that are of | ||
89 | interest. | ||
90 | The first form is those defined over the prime field Fp. | ||
91 | The elements of Fp are the integers 0 to p-1, where | ||
92 | .Fa p | ||
93 | is a prime number. | ||
94 | This gives us a revised elliptic curve equation as follows: | ||
95 | .Pp | ||
96 | .Dl y^2 mod p = x^3 +ax + b mod p | ||
97 | .Pp | ||
98 | The second form is those defined over a binary field F2^m where the | ||
99 | elements of the field are integers of length at most m bits. | ||
100 | For this form the elliptic curve equation is modified to: | ||
101 | .Pp | ||
102 | .Dl y^2 + xy = x^3 + ax^2 + b (where b != 0) | ||
103 | .Pp | ||
104 | Operations in a binary field are performed relative to an irreducible | ||
105 | polynomial. | ||
106 | All such curves with OpenSSL use a trinomial or a pentanomial for this | ||
107 | parameter. | ||
108 | .Pp | ||
109 | A new curve can be constructed by calling | ||
110 | .Fn EC_GROUP_new , | ||
111 | using the implementation provided by | ||
112 | .Fa meth | ||
113 | (see | ||
114 | .Xr EC_GFp_simple_method 3 ) . | ||
115 | It is then necessary to call either | ||
116 | .Fn EC_GROUP_set_curve_GFp | ||
117 | or | ||
118 | .Fn EC_GROUP_set_curve_GF2m | ||
119 | as appropriate to create a curve defined over Fp or over F2^m, respectively. | ||
120 | .Pp | ||
121 | .Fn EC_GROUP_set_curve_GFp | ||
122 | sets the curve parameters | ||
123 | .Fa p , | ||
124 | .Fa a , | ||
125 | and | ||
126 | .Fa b | ||
127 | for a curve over Fp stored in | ||
128 | .Fa group . | ||
129 | .Fn EC_group_get_curve_GFp | ||
130 | obtains the previously set curve parameters. | ||
131 | .Pp | ||
132 | .Fn EC_GROUP_set_curve_GF2m | ||
133 | sets the equivalent curve parameters for a curve over F2^m. | ||
134 | In this case | ||
135 | .Fa p | ||
136 | represents the irreducible polynomial - each bit represents a term in | ||
137 | the polynomial. | ||
138 | Therefore there will either be three or five bits set dependent on | ||
139 | whether the polynomial is a trinomial or a pentanomial. | ||
140 | .Fn EC_group_get_curve_GF2m | ||
141 | obtains the previously set curve parameters. | ||
142 | .Pp | ||
143 | The functions | ||
144 | .Fn EC_GROUP_new_curve_GFp | ||
145 | and | ||
146 | .Fn EC_GROUP_new_curve_GF2m | ||
147 | are shortcuts for calling | ||
148 | .Fn EC_GROUP_new | ||
149 | and the appropriate | ||
150 | .Fn EC_GROUP_set_curve_* | ||
151 | function. | ||
152 | An appropriate default implementation method will be used. | ||
153 | .Pp | ||
154 | Whilst the library can be used to create any curve using the functions | ||
155 | described above, there are also a number of predefined curves that are | ||
156 | available. | ||
157 | In order to obtain a list of all of the predefined curves, call the | ||
158 | function | ||
159 | .Fn EC_get_builtin_curves . | ||
160 | The parameter | ||
161 | .Fa r | ||
162 | should be an array of | ||
163 | .Vt EC_builtin_cure | ||
164 | structures of size | ||
165 | .Fa nitems . | ||
166 | The function will populate the | ||
167 | .Fa r | ||
168 | array with information about the builtin curves. | ||
169 | If | ||
170 | .Fa nitems | ||
171 | is less than the total number of curves available, then the first | ||
172 | .Fa nitems | ||
173 | curves will be returned. | ||
174 | Otherwise the total number of curves will be provided. | ||
175 | The return value is the total number of curves available (whether that | ||
176 | number has been populated in | ||
177 | .Fa r | ||
178 | or not). | ||
179 | Passing a | ||
180 | .Dv NULL | ||
181 | .Fa r , | ||
182 | or setting | ||
183 | .Fa nitems | ||
184 | to 0, will do nothing other than return the total number of curves | ||
185 | available. | ||
186 | The | ||
187 | .Vt EC_builtin_curve | ||
188 | structure is defined as follows: | ||
189 | .Bd -literal | ||
190 | typedef struct { | ||
191 | int nid; | ||
192 | const char *comment; | ||
193 | } EC_builtin_curve; | ||
194 | .Ed | ||
195 | .Pp | ||
196 | Each | ||
197 | .Vt EC_builtin_curve | ||
198 | item has a unique integer id | ||
199 | .Pq Fa nid | ||
200 | and a human readable comment string describing the curve. | ||
201 | .Pp | ||
202 | In order to construct a builtin curve use the function | ||
203 | .Fn EC_GROUP_new_by_curve_name | ||
204 | and provide the | ||
205 | .Fa nid | ||
206 | of the curve to be constructed. | ||
207 | .Pp | ||
208 | .Fn EC_GROUP_free | ||
209 | frees the memory associated with the | ||
210 | .Vt EC_GROUP . | ||
211 | .Pp | ||
212 | .Fn EC_GROUP_clear_free | ||
213 | destroys any sensitive data held within the | ||
214 | .Vt EC_GROUP | ||
215 | and then frees its memory. | ||
216 | .Sh RETURN VALUES | ||
217 | All | ||
218 | .Fn EC_GROUP_new* | ||
219 | functions return a pointer to the newly constructed group or | ||
220 | .Dv NULL | ||
221 | on error. | ||
222 | .Pp | ||
223 | .Fn EC_get_builtin_curves | ||
224 | returns the number of builtin curves that are available. | ||
225 | .Pp | ||
226 | .Fn EC_GROUP_set_curve_GFp , | ||
227 | .Fn EC_GROUP_get_curve_GFp , | ||
228 | .Fn EC_GROUP_set_curve_GF2m , | ||
229 | and | ||
230 | .Fn EC_GROUP_get_curve_GF2m | ||
231 | return 1 on success or 0 on error. | ||
232 | .Sh SEE ALSO | ||
233 | .Xr crypto 3 , | ||
234 | .Xr d2i_ECPKParameters 3 , | ||
235 | .Xr ec 3 , | ||
236 | .Xr EC_GFp_simple_method 3 , | ||
237 | .Xr EC_GROUP_copy 3 , | ||
238 | .Xr EC_KEY_new 3 , | ||
239 | .Xr EC_POINT_add 3 , | ||
240 | .Xr EC_POINT_new 3 | ||
diff --git a/src/lib/libcrypto/man/EC_KEY_new.3 b/src/lib/libcrypto/man/EC_KEY_new.3 new file mode 100644 index 0000000000..dcc55fa973 --- /dev/null +++ b/src/lib/libcrypto/man/EC_KEY_new.3 | |||
@@ -0,0 +1,411 @@ | |||
1 | .Dd $Mdocdate: November 2 2016 $ | ||
2 | .Dt EC_KEY_NEW 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm EC_KEY_new , | ||
6 | .Nm EC_KEY_get_flags , | ||
7 | .Nm EC_KEY_set_flags , | ||
8 | .Nm EC_KEY_clear_flags , | ||
9 | .Nm EC_KEY_new_by_curve_name , | ||
10 | .Nm EC_KEY_free , | ||
11 | .Nm EC_KEY_copy , | ||
12 | .Nm EC_KEY_dup , | ||
13 | .Nm EC_KEY_up_ref , | ||
14 | .Nm EC_KEY_get0_group , | ||
15 | .Nm EC_KEY_set_group , | ||
16 | .Nm EC_KEY_get0_private_key , | ||
17 | .Nm EC_KEY_set_private_key , | ||
18 | .Nm EC_KEY_get0_public_key , | ||
19 | .Nm EC_KEY_set_public_key , | ||
20 | .Nm EC_KEY_get_enc_flags , | ||
21 | .Nm EC_KEY_set_enc_flags , | ||
22 | .Nm EC_KEY_get_conv_form , | ||
23 | .Nm EC_KEY_set_conv_form , | ||
24 | .Nm EC_KEY_get_key_method_data , | ||
25 | .Nm EC_KEY_insert_key_method_data , | ||
26 | .Nm EC_KEY_set_asn1_flag , | ||
27 | .Nm EC_KEY_precompute_mult , | ||
28 | .Nm EC_KEY_generate_key , | ||
29 | .Nm EC_KEY_check_key , | ||
30 | .Nm EC_KEY_set_public_key_affine_coordinates | ||
31 | .Nd create, destroy and manipulate EC_KEY objects | ||
32 | .Sh SYNOPSIS | ||
33 | .In openssl/ec.h | ||
34 | .In openssl/bn.h | ||
35 | .Ft EC_KEY * | ||
36 | .Fn EC_KEY_new void | ||
37 | .Ft int | ||
38 | .Fo EC_KEY_get_flags | ||
39 | .Fa "const EC_KEY *key" | ||
40 | .Fc | ||
41 | .Ft void | ||
42 | .Fo EC_KEY_set_flags | ||
43 | .Fa "EC_KEY *key" | ||
44 | .Fa "int flags" | ||
45 | .Fc | ||
46 | .Ft void | ||
47 | .Fo EC_KEY_clear_flags | ||
48 | .Fa "EC_KEY *key" | ||
49 | .Fa "int flags" | ||
50 | .Fc | ||
51 | .Ft EC_KEY * | ||
52 | .Fo EC_KEY_new_by_curve_name | ||
53 | .Fa "int nid" | ||
54 | .Fc | ||
55 | .Ft void | ||
56 | .Fo EC_KEY_free | ||
57 | .Fa "EC_KEY *key" | ||
58 | .Fc | ||
59 | .Ft EC_KEY * | ||
60 | .Fo EC_KEY_copy | ||
61 | .Fa "EC_KEY *dst" | ||
62 | .Fa "const EC_KEY *src" | ||
63 | .Fc | ||
64 | .Ft EC_KEY * | ||
65 | .Fo EC_KEY_dup | ||
66 | .Fa "const EC_KEY *src" | ||
67 | .Fc | ||
68 | .Ft int | ||
69 | .Fo EC_KEY_up_ref | ||
70 | .Fa "EC_KEY *key" | ||
71 | .Fc | ||
72 | .Ft const EC_GROUP * | ||
73 | .Fo EC_KEY_get0_group | ||
74 | .Fa "const EC_KEY *key" | ||
75 | .Fc | ||
76 | .Ft int | ||
77 | .Fo EC_KEY_set_group | ||
78 | .Fa "EC_KEY *key" | ||
79 | .Fa "const EC_GROUP *group" | ||
80 | .Fc | ||
81 | .Ft const BIGNUM * | ||
82 | .Fo EC_KEY_get0_private_key | ||
83 | .Fa "const EC_KEY *key" | ||
84 | .Fc | ||
85 | .Ft int | ||
86 | .Fo EC_KEY_set_private_key | ||
87 | .Fa "EC_KEY *key" | ||
88 | .Fa "const BIGNUM *prv" | ||
89 | .Fc | ||
90 | .Ft const EC_POINT * | ||
91 | .Fo EC_KEY_get0_public_key | ||
92 | .Fa "const EC_KEY *key" | ||
93 | .Fc | ||
94 | .Ft int | ||
95 | .Fo EC_KEY_set_public_key | ||
96 | .Fa "EC_KEY *key" | ||
97 | .Fa "const EC_POINT *pub" | ||
98 | .Fc | ||
99 | .Ft unsigned int | ||
100 | .Fo EC_KEY_get_enc_flags | ||
101 | .Fa "const EC_KEY *key" | ||
102 | .Fc | ||
103 | .Ft void | ||
104 | .Fo EC_KEY_set_enc_flags | ||
105 | .Fa "EC_KEY *key" | ||
106 | .Fa "unsigned int flags" | ||
107 | .Fc | ||
108 | .Ft point_conversion_form_t | ||
109 | .Fo EC_KEY_get_conv_form | ||
110 | .Fa "const EC_KEY *key" | ||
111 | .Fc | ||
112 | .Ft void | ||
113 | .Fo EC_KEY_set_conv_form | ||
114 | .Fa "EC_KEY *key" | ||
115 | .Fa "point_conversion_form_t cform" | ||
116 | .Fc | ||
117 | .Ft void * | ||
118 | .Fo EC_KEY_get_key_method_data | ||
119 | .Fa "EC_KEY *key" | ||
120 | .Fa "void *(*dup_func)(void *)" | ||
121 | .Fa "void (*free_func)(void *)" | ||
122 | .Fa "void (*clear_free_func)(void *)" | ||
123 | .Fc | ||
124 | .Ft void | ||
125 | .Fo EC_KEY_insert_key_method_data | ||
126 | .Fa "EC_KEY *key" | ||
127 | .Fa "void *data" | ||
128 | .Fa "void *(*dup_func)(void *)" | ||
129 | .Fa "void (*free_func)(void *)" | ||
130 | .Fa "void (*clear_free_func)(void *)" | ||
131 | .Fc | ||
132 | .Ft void | ||
133 | .Fo EC_KEY_set_asn1_flag | ||
134 | .Fa "EC_KEY *key" | ||
135 | .Fa "int asn1_flag" | ||
136 | .Fc | ||
137 | .Ft int | ||
138 | .Fo EC_KEY_precompute_mult | ||
139 | .Fa "EC_KEY *key" | ||
140 | .Fa "BN_CTX *ctx" | ||
141 | .Fc | ||
142 | .Ft int | ||
143 | .Fo EC_KEY_generate_key | ||
144 | .Fa "EC_KEY *key" | ||
145 | .Fc | ||
146 | .Ft int | ||
147 | .Fo EC_KEY_check_key | ||
148 | .Fa "const EC_KEY *key" | ||
149 | .Fc | ||
150 | .Ft int | ||
151 | .Fo EC_KEY_set_public_key_affine_coordinates | ||
152 | .Fa "EC_KEY *key" | ||
153 | .Fa "BIGNUM *x" | ||
154 | .Fa "BIGNUM *y" | ||
155 | .Fc | ||
156 | .Sh DESCRIPTION | ||
157 | An | ||
158 | .Vt EC_KEY | ||
159 | represents a public key and (optionally) an associated private key. | ||
160 | A new | ||
161 | .Vt EC_KEY | ||
162 | (with no associated curve) can be constructed by calling | ||
163 | .Fn EC_KEY_new . | ||
164 | The reference count for the newly created | ||
165 | .Vt EC_KEY | ||
166 | is initially set to 1. | ||
167 | A curve can be associated with the | ||
168 | .Vt EC_KEY | ||
169 | by calling | ||
170 | .Fn EC_KEY_set_group . | ||
171 | .Pp | ||
172 | Alternatively a new | ||
173 | .Vt EC_KEY | ||
174 | can be constructed by calling | ||
175 | .Fn EC_KEY_new_by_curve_name | ||
176 | and supplying the | ||
177 | .Fa nid | ||
178 | of the associated curve. | ||
179 | Refer to | ||
180 | .Xr EC_GROUP_new 3 | ||
181 | for a description of curve names. | ||
182 | This function simply wraps calls to | ||
183 | .Fn EC_KEY_new | ||
184 | and | ||
185 | .Fn EC_GROUP_new_by_curve_name . | ||
186 | .Pp | ||
187 | Calling | ||
188 | .Fn EC_KEY_free | ||
189 | decrements the reference count for the | ||
190 | .Vt EC_KEY | ||
191 | object, and if it has dropped to zero, then frees the memory associated | ||
192 | with it. | ||
193 | .Pp | ||
194 | .Fn EC_KEY_copy | ||
195 | copies the contents of the | ||
196 | .Vt EC_KEY | ||
197 | in | ||
198 | .Fa src | ||
199 | into | ||
200 | .Fa dst . | ||
201 | .Pp | ||
202 | .Fn EC_KEY_dup | ||
203 | creates a new | ||
204 | .Vt EC_KEY | ||
205 | object and copies | ||
206 | .Fa src | ||
207 | into it. | ||
208 | .Pp | ||
209 | .Fn EC_KEY_up_ref | ||
210 | increments the reference count associated with the | ||
211 | .Vt EC_KEY | ||
212 | object. | ||
213 | .Pp | ||
214 | .Fn EC_KEY_generate_key | ||
215 | generates a new public and private key for the supplied | ||
216 | .Fa key | ||
217 | object. | ||
218 | .Fa key | ||
219 | must have an | ||
220 | .Vt EC_GROUP | ||
221 | object associated with it before calling this function. | ||
222 | The private key is a random integer (0 < priv_key < order, where order | ||
223 | is the order of the | ||
224 | .Vt EC_GROUP | ||
225 | object). | ||
226 | The public key is an | ||
227 | .Vt EC_POINT | ||
228 | on the curve calculated by multiplying the generator for the curve | ||
229 | by the private key. | ||
230 | .Pp | ||
231 | .Fn EC_KEY_check_key | ||
232 | performs various sanity checks on the | ||
233 | .Vt EC_KEY | ||
234 | object to confirm that it is valid. | ||
235 | .Pp | ||
236 | .Fn EC_KEY_set_public_key_affine_coordinates | ||
237 | sets the public key for | ||
238 | .Fa key | ||
239 | based on its affine coordinates, i.e. it constructs an | ||
240 | .Vt EC_POINT | ||
241 | object based on the supplied | ||
242 | .Fa x | ||
243 | and | ||
244 | .Fa y | ||
245 | values and sets the public key to be this | ||
246 | .Vt EC_POINT . | ||
247 | It also performs certain sanity checks on the key to confirm that | ||
248 | it is valid. | ||
249 | .Pp | ||
250 | The functions | ||
251 | .Fn EC_KEY_get0_group , | ||
252 | .Fn EC_KEY_set_group , | ||
253 | .Fn EC_KEY_get0_private_key , | ||
254 | .Fn EC_KEY_set_private_key , | ||
255 | .Fn EC_KEY_get0_public_key , | ||
256 | and | ||
257 | .Fn EC_KEY_set_public_key | ||
258 | get and set the | ||
259 | .Vt EC_GROUP | ||
260 | object, the private key and the | ||
261 | .Vt EC_POINT | ||
262 | public key for the | ||
263 | .Fa key , | ||
264 | respectively. | ||
265 | .Pp | ||
266 | The functions | ||
267 | .Fn EC_KEY_get_enc_flags | ||
268 | and | ||
269 | .Fn EC_KEY_set_enc_flags | ||
270 | get and set the value of the encoding flags for the | ||
271 | .Fa key . | ||
272 | There are two encoding flags currently defined: | ||
273 | .Dv EC_PKEY_NO_PARAMETERS | ||
274 | and | ||
275 | .Dv EC_PKEY_NO_PUBKEY . | ||
276 | These flags define the behaviour of how the | ||
277 | .Fa key | ||
278 | is converted into ASN1 in a call to | ||
279 | .Fn i2d_ECPrivateKey . | ||
280 | If | ||
281 | .Dv EC_PKEY_NO_PARAMETERS | ||
282 | is set then the public parameters for the curve | ||
283 | are not encoded along with the private key. | ||
284 | If | ||
285 | .Dv EC_PKEY_NO_PUBKEY | ||
286 | is set then the public key is not encoded along with the private | ||
287 | key. | ||
288 | .Pp | ||
289 | The functions | ||
290 | .Fn EC_KEY_get_conv_form | ||
291 | and | ||
292 | .Fn EC_KEY_set_conv_form | ||
293 | get and set the point_conversion_form for the | ||
294 | .Fa key . | ||
295 | For a description of point_conversion_forms please refer to | ||
296 | .Xr EC_POINT_new 3 . | ||
297 | .Pp | ||
298 | .Fn EC_KEY_insert_key_method_data | ||
299 | and | ||
300 | .Fn EC_KEY_get_key_method_data | ||
301 | enable the caller to associate arbitrary additional data specific | ||
302 | to the elliptic curve scheme being used with the | ||
303 | .Vt EC_KEY | ||
304 | object. | ||
305 | This data is treated as a "black box" by the ec library. | ||
306 | The data to be stored by | ||
307 | .Fn EC_KEY_insert_key_method_data | ||
308 | is provided in the | ||
309 | .Fa data | ||
310 | parameter, which must have associated functions for duplicating, freeing | ||
311 | and "clear_freeing" the data item. | ||
312 | If a subsequent | ||
313 | .Fn EC_KEY_get_key_method_data | ||
314 | call is issued, the functions for duplicating, freeing and | ||
315 | "clear_freeing" the data item must be provided again, and they must | ||
316 | be the same as they were when the data item was inserted. | ||
317 | .Pp | ||
318 | .Fn EC_KEY_set_flags | ||
319 | sets the flags in the | ||
320 | .Fa flags | ||
321 | parameter on the | ||
322 | .Vt EC_KEY | ||
323 | object. | ||
324 | Any flags that are already set are left set. | ||
325 | The currently defined standard flags are | ||
326 | .Dv EC_FLAG_NON_FIPS_ALLOW | ||
327 | and | ||
328 | .Dv EC_FLAG_FIPS_CHECKED . | ||
329 | In addition there is the flag | ||
330 | .Dv EC_FLAG_COFACTOR_ECDH | ||
331 | which is specific to ECDH and is defined in | ||
332 | .In openssl/ecdh.h . | ||
333 | .Fn EC_KEY_get_flags | ||
334 | returns the current flags that are set for this | ||
335 | .Vt EC_KEY . | ||
336 | .Fn EC_KEY_clear_flags | ||
337 | clears the flags indicated by the | ||
338 | .Fa flags | ||
339 | parameter. | ||
340 | All other flags are left in their existing state. | ||
341 | .Pp | ||
342 | .Fn EC_KEY_set_asn1_flag | ||
343 | sets the asn1_flag on the underlying | ||
344 | .Vt EC_GROUP | ||
345 | object (if set). | ||
346 | Refer to | ||
347 | .Xr EC_GROUP_copy 3 | ||
348 | for further information on the asn1_flag. | ||
349 | .Pp | ||
350 | .Fn EC_KEY_precompute_mult | ||
351 | stores multiples of the underlying | ||
352 | .Vt EC_GROUP | ||
353 | generator for faster point multiplication. | ||
354 | See also | ||
355 | .Xr EC_POINT_add 3 . | ||
356 | .Sh RETURN VALUES | ||
357 | .Fn EC_KEY_new , | ||
358 | .Fn EC_KEY_new_by_curve_name , | ||
359 | and | ||
360 | .Fn EC_KEY_dup | ||
361 | return a pointer to the newly created | ||
362 | .Vt EC_KEY object or | ||
363 | .Dv NULL | ||
364 | on error. | ||
365 | .Pp | ||
366 | .Fn EC_KEY_get_flags | ||
367 | returns the flags associated with the | ||
368 | .Vt EC_KEY object. | ||
369 | .Pp | ||
370 | .Fn EC_KEY_copy | ||
371 | returns a pointer to the destination key or | ||
372 | .Dv NULL | ||
373 | on error. | ||
374 | .Pp | ||
375 | .Fn EC_KEY_up_ref , | ||
376 | .Fn EC_KEY_set_group , | ||
377 | .Fn EC_KEY_set_private_key , | ||
378 | .Fn EC_KEY_set_public_key , | ||
379 | .Fn EC_KEY_precompute_mult , | ||
380 | .Fn EC_KEY_generate_key , | ||
381 | .Fn EC_KEY_check_key , | ||
382 | and | ||
383 | .Fn EC_KEY_set_public_key_affine_coordinates | ||
384 | return 1 on success or 0 on error. | ||
385 | .Pp | ||
386 | .Fn EC_KEY_get0_group | ||
387 | returns the | ||
388 | .Vt EC_GROUP | ||
389 | associated with the | ||
390 | .Vt EC_KEY . | ||
391 | .Pp | ||
392 | .Fn EC_KEY_get0_private_key | ||
393 | returns the private key associated with the | ||
394 | .Vt EC_KEY . | ||
395 | .Pp | ||
396 | .Fn EC_KEY_get_enc_flags | ||
397 | returns the value of the current encoding flags for the | ||
398 | .Vt EC_KEY . | ||
399 | .Pp | ||
400 | .Fn EC_KEY_get_conv_form | ||
401 | returns the point_conversion_form for the | ||
402 | .Vt EC_KEY . | ||
403 | .Sh SEE ALSO | ||
404 | .Xr crypto 3 , | ||
405 | .Xr d2i_ECPKParameters 3 , | ||
406 | .Xr ec 3 , | ||
407 | .Xr EC_GFp_simple_method 3 , | ||
408 | .Xr EC_GROUP_copy 3 , | ||
409 | .Xr EC_GROUP_new 3 , | ||
410 | .Xr EC_POINT_add 3 , | ||
411 | .Xr EC_POINT_new 3 | ||
diff --git a/src/lib/libcrypto/man/EC_POINT_add.3 b/src/lib/libcrypto/man/EC_POINT_add.3 new file mode 100644 index 0000000000..b8e3290952 --- /dev/null +++ b/src/lib/libcrypto/man/EC_POINT_add.3 | |||
@@ -0,0 +1,220 @@ | |||
1 | .Dd $Mdocdate: November 2 2016 $ | ||
2 | .Dt EC_POINT_ADD 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm EC_POINT_add , | ||
6 | .Nm EC_POINT_dbl , | ||
7 | .Nm EC_POINT_invert , | ||
8 | .Nm EC_POINT_is_at_infinity , | ||
9 | .Nm EC_POINT_is_on_curve , | ||
10 | .Nm EC_POINT_cmp , | ||
11 | .Nm EC_POINT_make_affine , | ||
12 | .Nm EC_POINTs_make_affine , | ||
13 | .Nm EC_POINTs_mul , | ||
14 | .Nm EC_POINT_mul , | ||
15 | .Nm EC_GROUP_precompute_mult , | ||
16 | .Nm EC_GROUP_have_precompute_mult | ||
17 | .Nd perform mathematical operations and tests on EC_POINT objects | ||
18 | .Sh SYNOPSIS | ||
19 | .In openssl/ec.h | ||
20 | .In openssl/bn.h | ||
21 | .Ft int | ||
22 | .Fo EC_POINT_add | ||
23 | .Fa "const EC_GROUP *group" | ||
24 | .Fa "EC_POINT *r" | ||
25 | .Fa "const EC_POINT *a" | ||
26 | .Fa "const EC_POINT *b" | ||
27 | .Fa "BN_CTX *ctx" | ||
28 | .Fc | ||
29 | .Ft int | ||
30 | .Fo EC_POINT_dbl | ||
31 | .Fa "const EC_GROUP *group" | ||
32 | .Fa "EC_POINT *r" | ||
33 | .Fa "const EC_POINT *a" | ||
34 | .Fa "BN_CTX *ctx" | ||
35 | .Fc | ||
36 | .Ft int | ||
37 | .Fo EC_POINT_invert | ||
38 | .Fa "const EC_GROUP *group" | ||
39 | .Fa "EC_POINT *a" | ||
40 | .Fa "BN_CTX *ctx" | ||
41 | .Fc | ||
42 | .Ft int | ||
43 | .Fo EC_POINT_is_at_infinity | ||
44 | .Fa "const EC_GROUP *group" | ||
45 | .Fa "const EC_POINT *p" | ||
46 | .Fc | ||
47 | .Ft int | ||
48 | .Fo EC_POINT_is_on_curve | ||
49 | .Fa "const EC_GROUP *group" | ||
50 | .Fa "const EC_POINT *point" | ||
51 | .Fa "BN_CTX *ctx" | ||
52 | .Fc | ||
53 | .Ft int | ||
54 | .Fo EC_POINT_cmp | ||
55 | .Fa "const EC_GROUP *group" | ||
56 | .Fa "const EC_POINT *a" | ||
57 | .Fa "const EC_POINT *b" | ||
58 | .Fa "BN_CTX *ctx" | ||
59 | .Fc | ||
60 | .Ft int | ||
61 | .Fo EC_POINT_make_affine | ||
62 | .Fa "const EC_GROUP *group" | ||
63 | .Fa "EC_POINT *point" | ||
64 | .Fa "BN_CTX *ctx" | ||
65 | .Fc | ||
66 | .Ft int | ||
67 | .Fo EC_POINTs_make_affine | ||
68 | .Fa "const EC_GROUP *group" | ||
69 | .Fa "size_t num" | ||
70 | .Fa "EC_POINT *points[]" | ||
71 | .Fa "BN_CTX *ctx" | ||
72 | .Fc | ||
73 | .Ft int | ||
74 | .Fo EC_POINTs_mul | ||
75 | .Fa "const EC_GROUP *group" | ||
76 | .Fa "EC_POINT *r" | ||
77 | .Fa "const BIGNUM *n" | ||
78 | .Fa "size_t num" | ||
79 | .Fa "const EC_POINT *p[]" | ||
80 | .Fa "const BIGNUM *m[]" | ||
81 | .Fa "BN_CTX *ctx" | ||
82 | .Fc | ||
83 | .Ft int | ||
84 | .Fo EC_POINT_mul | ||
85 | .Fa "const EC_GROUP *group" | ||
86 | .Fa "EC_POINT *r" | ||
87 | .Fa "const BIGNUM *n" | ||
88 | .Fa "const EC_POINT *q" | ||
89 | .Fa "const BIGNUM *m" | ||
90 | .Fa "BN_CTX *ctx" | ||
91 | .Fc | ||
92 | .Ft int | ||
93 | .Fo EC_GROUP_precompute_mult | ||
94 | .Fa "EC_GROUP *group" | ||
95 | .Fa "BN_CTX *ctx" | ||
96 | .Fc | ||
97 | .Ft int | ||
98 | .Fo EC_GROUP_have_precompute_mult | ||
99 | .Fa "const EC_GROUP *group" | ||
100 | .Fc | ||
101 | .Sh DESCRIPTION | ||
102 | .Fn EC_POINT_add | ||
103 | adds the two points | ||
104 | .Fa a | ||
105 | and | ||
106 | .Fa b | ||
107 | and places the result in | ||
108 | .Fa r . | ||
109 | Similarly | ||
110 | .Fn EC_POINT_dbl | ||
111 | doubles the point | ||
112 | .Fa a | ||
113 | and places the result in | ||
114 | .Fa r . | ||
115 | In both cases it is valid for | ||
116 | .Fa r | ||
117 | to be one of | ||
118 | .Fa a | ||
119 | or | ||
120 | .Fa b . | ||
121 | .Pp | ||
122 | .Fn EC_POINT_invert | ||
123 | calculates the inverse of the supplied point | ||
124 | .Fa a . | ||
125 | The result is placed back in | ||
126 | .Fa a . | ||
127 | .Pp | ||
128 | The function | ||
129 | .Fn EC_POINT_is_at_infinity | ||
130 | tests whether the supplied point is at infinity or not. | ||
131 | .Pp | ||
132 | .Fn EC_POINT_is_on_curve | ||
133 | tests whether the supplied point is on the curve or not. | ||
134 | .Pp | ||
135 | .Fn EC_POINT_cmp | ||
136 | compares the two supplied points and tests whether or not they are | ||
137 | equal. | ||
138 | .Pp | ||
139 | The functions | ||
140 | .Fn EC_POINT_make_affine | ||
141 | and | ||
142 | .Fn EC_POINTs_make_affine | ||
143 | force the internal representation of the | ||
144 | .Vt EC_POINT Ns (s) | ||
145 | into the affine coordinate system. | ||
146 | In the case of | ||
147 | .Fn EC_POINTs_make_affine , | ||
148 | the value | ||
149 | .Fa num | ||
150 | provides the number of points in the array | ||
151 | .Fa points | ||
152 | to be forced. | ||
153 | .Pp | ||
154 | .Fn EC_POINT_mul | ||
155 | calculates the value | ||
156 | .Pp | ||
157 | .D1 generator * n + q * m | ||
158 | .Pp | ||
159 | and stores the result in | ||
160 | .Fa r . | ||
161 | The value | ||
162 | .Fa n | ||
163 | may be | ||
164 | .Dv NULL , | ||
165 | in which case the result is just q * m. | ||
166 | .Pp | ||
167 | .Fn EC_POINTs_mul | ||
168 | calculates the value | ||
169 | .Pp | ||
170 | .Dl generator * n + q[0] * m[0] + ... + q[num-1] * m[num-1] | ||
171 | .Pp | ||
172 | As for | ||
173 | .Fn EC_POINT_mul , | ||
174 | the value | ||
175 | .Fa n | ||
176 | may be | ||
177 | .Dv NULL . | ||
178 | .Pp | ||
179 | The function | ||
180 | .Fn EC_GROUP_precompute_mult | ||
181 | stores multiples of the generator for faster point multiplication, | ||
182 | whilst | ||
183 | .Fn EC_GROUP_have_precompute_mult | ||
184 | tests whether precomputation has already been done. | ||
185 | See | ||
186 | .Xr EC_GROUP_copy 3 | ||
187 | for information about the generator. | ||
188 | .Sh RETURN VALUES | ||
189 | The following functions return 1 on success or 0 on error: | ||
190 | .Fn EC_POINT_add , | ||
191 | .Fn EC_POINT_dbl , | ||
192 | .Fn EC_POINT_invert , | ||
193 | .Fn EC_POINT_make_affine , | ||
194 | .Fn EC_POINTs_make_affine , | ||
195 | .Fn EC_POINTs_make_affine , | ||
196 | .Fn EC_POINT_mul , | ||
197 | .Fn EC_POINTs_mul , | ||
198 | and | ||
199 | .Fn EC_GROUP_precompute_mult . | ||
200 | .Pp | ||
201 | .Fn EC_POINT_is_at_infinity | ||
202 | returns 1 if the point is at infinity or 0 otherwise. | ||
203 | .Pp | ||
204 | .Fn EC_POINT_is_on_curve | ||
205 | returns 1 if the point is on the curve, 0 if not, or -1 on error. | ||
206 | .Pp | ||
207 | .Fn EC_POINT_cmp | ||
208 | returns 1 if the points are not equal, 0 if they are, or -1 on error. | ||
209 | .Pp | ||
210 | .Fn EC_GROUP_have_precompute_mult | ||
211 | returns 1 if a precomputation has been done or 0 if not. | ||
212 | .Sh SEE ALSO | ||
213 | .Xr crypto 3 , | ||
214 | .Xr d2i_ECPKParameters 3 , | ||
215 | .Xr ec 3 , | ||
216 | .Xr EC_GFp_simple_method 3 , | ||
217 | .Xr EC_GROUP_copy 3 , | ||
218 | .Xr EC_GROUP_new 3 , | ||
219 | .Xr EC_KEY_new 3 , | ||
220 | .Xr EC_POINT_new 3 | ||
diff --git a/src/lib/libcrypto/man/EC_POINT_new.3 b/src/lib/libcrypto/man/EC_POINT_new.3 new file mode 100644 index 0000000000..cd0dcaf986 --- /dev/null +++ b/src/lib/libcrypto/man/EC_POINT_new.3 | |||
@@ -0,0 +1,409 @@ | |||
1 | .Dd $Mdocdate: November 2 2016 $ | ||
2 | .Dt EC_POINT_NEW 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm EC_POINT_new , | ||
6 | .Nm EC_POINT_free , | ||
7 | .Nm EC_POINT_clear_free , | ||
8 | .Nm EC_POINT_copy , | ||
9 | .Nm EC_POINT_dup , | ||
10 | .Nm EC_POINT_method_of , | ||
11 | .Nm EC_POINT_set_to_infinity , | ||
12 | .Nm EC_POINT_set_Jprojective_coordinates , | ||
13 | .Nm EC_POINT_get_Jprojective_coordinates_GFp , | ||
14 | .Nm EC_POINT_set_affine_coordinates_GFp , | ||
15 | .Nm EC_POINT_get_affine_coordinates_GFp , | ||
16 | .Nm EC_POINT_set_compressed_coordinates_GFp , | ||
17 | .Nm EC_POINT_set_affine_coordinates_GF2m , | ||
18 | .Nm EC_POINT_get_affine_coordinates_GF2m , | ||
19 | .Nm EC_POINT_set_compressed_coordinates_GF2m , | ||
20 | .Nm EC_POINT_point2oct , | ||
21 | .Nm EC_POINT_oct2point , | ||
22 | .Nm EC_POINT_point2bn , | ||
23 | .Nm EC_POINT_bn2point , | ||
24 | .Nm EC_POINT_point2hex , | ||
25 | .Nm EC_POINT_hex2point | ||
26 | .Nd create, destroy, and manipulate EC_POINT objects | ||
27 | .Sh SYNOPSIS | ||
28 | .In openssl/ec.h | ||
29 | .In openssl/bn.h | ||
30 | .Ft EC_POINT * | ||
31 | .Fo EC_POINT_new | ||
32 | .Fa "const EC_GROUP *group" | ||
33 | .Fc | ||
34 | .Ft void | ||
35 | .Fo EC_POINT_free | ||
36 | .Fa "EC_POINT *point" | ||
37 | .Fc | ||
38 | .Ft void | ||
39 | .Fo EC_POINT_clear_free | ||
40 | .Fa "EC_POINT *point" | ||
41 | .Fc | ||
42 | .Ft int | ||
43 | .Fo EC_POINT_copy | ||
44 | .Fa "EC_POINT *dst" | ||
45 | .Fa "const EC_POINT *src" | ||
46 | .Fc | ||
47 | .Ft EC_POINT * | ||
48 | .Fo EC_POINT_dup | ||
49 | .Fa "const EC_POINT *src" | ||
50 | .Fa "const EC_GROUP *group" | ||
51 | .Fc | ||
52 | .Ft const EC_METHOD * | ||
53 | .Fo EC_POINT_method_of | ||
54 | .Fa "const EC_POINT *point" | ||
55 | .Fc | ||
56 | .Ft int | ||
57 | .Fo EC_POINT_set_to_infinity | ||
58 | .Fa "const EC_GROUP *group" | ||
59 | .Fa "EC_POINT *point" | ||
60 | .Fc | ||
61 | .Ft int | ||
62 | .Fo EC_POINT_set_Jprojective_coordinates_GFp | ||
63 | .Fa "const EC_GROUP *group" | ||
64 | .Fa "EC_POINT *p" | ||
65 | .Fa "const BIGNUM *x" | ||
66 | .Fa "const BIGNUM *y" | ||
67 | .Fa "const BIGNUM *z" | ||
68 | .Fa "BN_CTX *ctx" | ||
69 | .Fc | ||
70 | .Ft int | ||
71 | .Fo EC_POINT_get_Jprojective_coordinates_GFp | ||
72 | .Fa "const EC_GROUP *group" | ||
73 | .Fa "const EC_POINT *p" | ||
74 | .Fa "BIGNUM *x" | ||
75 | .Fa "BIGNUM *y" | ||
76 | .Fa "BIGNUM *z" | ||
77 | .Fa "BN_CTX *ctx" | ||
78 | .Fc | ||
79 | .Ft int | ||
80 | .Fo EC_POINT_set_affine_coordinates_GFp | ||
81 | .Fa "const EC_GROUP *group" | ||
82 | .Fa "EC_POINT *p" | ||
83 | .Fa "const BIGNUM *x" | ||
84 | .Fa "const BIGNUM *y" | ||
85 | .Fa "BN_CTX *ctx" | ||
86 | .Fc | ||
87 | .Ft int | ||
88 | .Fo EC_POINT_get_affine_coordinates_GFp | ||
89 | .Fa "const EC_GROUP *group" | ||
90 | .Fa "const EC_POINT *p" | ||
91 | .Fa "BIGNUM *x" | ||
92 | .Fa "BIGNUM *y" | ||
93 | .Fa "BN_CTX *ctx" | ||
94 | .Fc | ||
95 | .Ft int | ||
96 | .Fo EC_POINT_set_compressed_coordinates_GFp | ||
97 | .Fa "const EC_GROUP *group" | ||
98 | .Fa "EC_POINT *p" | ||
99 | .Fa "const BIGNUM *x" | ||
100 | .Fa "int y_bit" | ||
101 | .Fa "BN_CTX *ctx" | ||
102 | .Fc | ||
103 | .Ft int | ||
104 | .Fo EC_POINT_set_affine_coordinates_GF2m | ||
105 | .Fa "const EC_GROUP *group" | ||
106 | .Fa "EC_POINT *p" | ||
107 | .Fa "const BIGNUM *x" | ||
108 | .Fa "const BIGNUM *y" | ||
109 | .Fa "BN_CTX *ctx" | ||
110 | .Fc | ||
111 | .Ft int | ||
112 | .Fo EC_POINT_get_affine_coordinates_GF2m | ||
113 | .Fa "const EC_GROUP *group" | ||
114 | .Fa "const EC_POINT *p" | ||
115 | .Fa "BIGNUM *x" | ||
116 | .Fa "BIGNUM *y" | ||
117 | .Fa "BN_CTX *ctx" | ||
118 | .Fc | ||
119 | .Ft int | ||
120 | .Fo EC_POINT_set_compressed_coordinates_GF2m | ||
121 | .Fa "const EC_GROUP *group" | ||
122 | .Fa "EC_POINT *p" | ||
123 | .Fa "const BIGNUM *x" | ||
124 | .Fa "int y_bit" | ||
125 | .Fa "BN_CTX *ctx" | ||
126 | .Fc | ||
127 | .Ft size_t | ||
128 | .Fo EC_POINT_point2oct | ||
129 | .Fa "const EC_GROUP *group" | ||
130 | .Fa "const EC_POINT *p" | ||
131 | .Fa "point_conversion_form_t form" | ||
132 | .Fa "unsigned char *buf" | ||
133 | .Fa "size_t len" | ||
134 | .Fa "BN_CTX *ctx" | ||
135 | .Fc | ||
136 | .Ft int | ||
137 | .Fo EC_POINT_oct2point | ||
138 | .Fa "const EC_GROUP *group" | ||
139 | .Fa "EC_POINT *p" | ||
140 | .Fa "const unsigned char *buf" | ||
141 | .Fa "size_t len" | ||
142 | .Fa "BN_CTX *ctx" | ||
143 | .Fc | ||
144 | .Ft BIGNUM * | ||
145 | .Fo EC_POINT_point2bn | ||
146 | .Fa "const EC_GROUP *" | ||
147 | .Fa "const EC_POINT *" | ||
148 | .Fa "point_conversion_form_t form" | ||
149 | .Fa "BIGNUM *" | ||
150 | .Fa "BN_CTX *" | ||
151 | .Fc | ||
152 | .Ft EC_POINT * | ||
153 | .Fo EC_POINT_bn2point | ||
154 | .Fa "const EC_GROUP *" | ||
155 | .Fa "const BIGNUM *" | ||
156 | .Fa "EC_POINT *" | ||
157 | .Fa "BN_CTX *" | ||
158 | .Fc | ||
159 | .Ft char * | ||
160 | .Fo EC_POINT_point2hex | ||
161 | .Fa "const EC_GROUP *" | ||
162 | .Fa "const EC_POINT *" | ||
163 | .Fa "point_conversion_form_t form" | ||
164 | .Fa "BN_CTX *" | ||
165 | .Fc | ||
166 | .Ft EC_POINT * | ||
167 | .Fo EC_POINT_hex2point | ||
168 | .Fa "const EC_GROUP *" | ||
169 | .Fa "const char *" | ||
170 | .Fa "EC_POINT *" | ||
171 | .Fa "BN_CTX *" | ||
172 | .Fc | ||
173 | .Sh DESCRIPTION | ||
174 | An | ||
175 | .Vt EC_POINT | ||
176 | represents a point on a curve. | ||
177 | A new point is constructed by calling the function | ||
178 | .Fn EC_POINT_new | ||
179 | and providing the | ||
180 | .Fa group | ||
181 | object that the point relates to. | ||
182 | .Pp | ||
183 | .Fn EC_POINT_free | ||
184 | frees the memory associated with the | ||
185 | .Vt EC_POINT . | ||
186 | .Pp | ||
187 | .Fn EC_POINT_clear_free | ||
188 | destroys any sensitive data held within the | ||
189 | .Vt EC_POINT | ||
190 | and then frees its memory. | ||
191 | .Pp | ||
192 | .Fn EC_POINT_copy | ||
193 | copies the point | ||
194 | .Fa src | ||
195 | into | ||
196 | .Fa dst . | ||
197 | Both | ||
198 | .Fa src | ||
199 | and | ||
200 | .Fa dst | ||
201 | must use the same | ||
202 | .Vt EC_METHOD . | ||
203 | .Pp | ||
204 | .Fn EC_POINT_dup | ||
205 | creates a new | ||
206 | .Vt EC_POINT | ||
207 | object and copies the content from | ||
208 | .Fa src | ||
209 | to the newly created | ||
210 | .Vt EC_POINT | ||
211 | object. | ||
212 | .Pp | ||
213 | .Fn EC_POINT_method_of | ||
214 | obtains the | ||
215 | .Vt EC_METHOD | ||
216 | associated with | ||
217 | .Fa point . | ||
218 | .Pp | ||
219 | A valid point on a curve is the special point at infinity. | ||
220 | A point is set to be at infinity by calling | ||
221 | .Fn EC_POINT_set_to_infinity . | ||
222 | .Pp | ||
223 | The affine coordinates for a point describe a point in terms of its | ||
224 | .Fa x | ||
225 | and | ||
226 | .Fa y | ||
227 | position. | ||
228 | The functions | ||
229 | .Fn EC_POINT_set_affine_coordinates_GFp | ||
230 | and | ||
231 | .Fn EC_POINT_set_affine_coordinates_GF2m | ||
232 | set the | ||
233 | .Fa x | ||
234 | and | ||
235 | .Fa y | ||
236 | coordinates for the point | ||
237 | .Fa p | ||
238 | defined over the curve given in | ||
239 | .Fa group . | ||
240 | .Pp | ||
241 | As well as the affine coordinates, a point can alternatively be | ||
242 | described in terms of its Jacobian projective coordinates (for Fp | ||
243 | curves only). | ||
244 | Jacobian projective coordinates are expressed as three values | ||
245 | .Fa x , | ||
246 | .Fa y , | ||
247 | and | ||
248 | .Fa z . | ||
249 | Working in this coordinate system provides more efficient point | ||
250 | multiplication operations. | ||
251 | A mapping exists between Jacobian projective coordinates and affine | ||
252 | coordinates. | ||
253 | A Jacobian projective coordinate | ||
254 | .Pq Fa x , y , z | ||
255 | can be written as an affine coordinate as | ||
256 | .Pp | ||
257 | .Dl (x/(z^2), y/(z^3)) . | ||
258 | .Pp | ||
259 | Conversion to Jacobian projective to affine coordinates is simple. | ||
260 | The coordinate | ||
261 | .Pq Fa x , y | ||
262 | is mapped to | ||
263 | .Pq Fa x , y , No 1 . | ||
264 | To set or get the projective coordinates use | ||
265 | .Fn EC_POINT_set_Jprojective_coordinates_GFp | ||
266 | and | ||
267 | .Fn EC_POINT_get_Jprojective_coordinates_GFp , | ||
268 | respectively. | ||
269 | .Pp | ||
270 | Points can also be described in terms of their compressed coordinates. | ||
271 | For a point | ||
272 | .Pq Fa x , y , | ||
273 | for any given value for | ||
274 | .Fa x | ||
275 | such that the point is on the curve, there will only ever be two | ||
276 | possible values for | ||
277 | .Fa y . | ||
278 | Therefore a point can be set using the | ||
279 | .Fn EC_POINT_set_compressed_coordinates_GFp | ||
280 | and | ||
281 | .Fn EC_POINT_set_compressed_coordinates_GF2m | ||
282 | functions where | ||
283 | .Fa x | ||
284 | is the x coordinate and | ||
285 | .Fa y_bit | ||
286 | is a value 0 or 1 to identify which of the two possible values for y | ||
287 | should be used. | ||
288 | .Pp | ||
289 | In addition | ||
290 | .Vt EC_POINT Ns s | ||
291 | can be converted to and from various external representations. | ||
292 | Supported representations are octet strings, | ||
293 | .Vt BIGNUM Ns s , | ||
294 | and hexadecimal. | ||
295 | The format of the external representation is described by the | ||
296 | point_conversion_form. | ||
297 | See | ||
298 | .Xr EC_GROUP_copy 3 | ||
299 | for a description of point_conversion_form. | ||
300 | Octet strings are stored in a buffer along with an associated buffer | ||
301 | length. | ||
302 | A point held in a | ||
303 | .Vt BIGNUM | ||
304 | is calculated by converting the point to an octet string and then | ||
305 | converting that octet string into a | ||
306 | .Vt BIGNUM | ||
307 | integer. | ||
308 | Points in hexadecimal format are stored in a NUL terminated character | ||
309 | string where each character is one of the printable values 0-9 or A-F | ||
310 | (or a-f). | ||
311 | .Pp | ||
312 | The functions | ||
313 | .Fn EC_POINT_point2oct , | ||
314 | .Fn EC_POINT_oct2point , | ||
315 | .Fn EC_POINT_point2bn , | ||
316 | .Fn EC_POINT_bn2point , | ||
317 | .Fn EC_POINT_point2hex , | ||
318 | and | ||
319 | .Fn EC_POINT_hex2point | ||
320 | convert from and to | ||
321 | .Vt EC_POINT Ns s | ||
322 | for the formats octet string, | ||
323 | .Vt BIGNUM , | ||
324 | and hexadecimal, respectively. | ||
325 | .Pp | ||
326 | The function | ||
327 | .Fn EC_POINT_point2oct | ||
328 | must be supplied with a | ||
329 | .Fa buf | ||
330 | long enough to store the octet string. | ||
331 | The return value provides the number of octets stored. | ||
332 | Calling the function with a | ||
333 | .Dv NULL | ||
334 | .Fa buf | ||
335 | will not perform the conversion but will still return the required | ||
336 | buffer length. | ||
337 | .Pp | ||
338 | The function | ||
339 | .Fn EC_POINT_point2hex | ||
340 | will allocate sufficient memory to store the hexadecimal string. | ||
341 | It is the caller's responsibility to free this memory with a subsequent | ||
342 | call to | ||
343 | .Xr free 3 . | ||
344 | .Sh RETURN VALUES | ||
345 | .Fn EC_POINT_new | ||
346 | and | ||
347 | .Fn EC_POINT_dup | ||
348 | return the newly allocated | ||
349 | .Vt EC_POINT | ||
350 | or | ||
351 | .Dv NULL | ||
352 | on error. | ||
353 | .Pp | ||
354 | The following functions return 1 on success or 0 on error: | ||
355 | .Fn EC_POINT_copy , | ||
356 | .Fn EC_POINT_set_to_infinity , | ||
357 | .Fn EC_POINT_set_Jprojective_coordinates_GFp , | ||
358 | .Fn EC_POINT_get_Jprojective_coordinates_GFp , | ||
359 | .Fn EC_POINT_set_affine_coordinates_GFp , | ||
360 | .Fn EC_POINT_get_affine_coordinates_GFp , | ||
361 | .Fn EC_POINT_set_compressed_coordinates_GFp , | ||
362 | .Fn EC_POINT_set_affine_coordinates_GF2m , | ||
363 | .Fn EC_POINT_get_affine_coordinates_GF2m , | ||
364 | .Fn EC_POINT_set_compressed_coordinates_GF2m , | ||
365 | and | ||
366 | .Fn EC_POINT_oct2point . | ||
367 | .Pp | ||
368 | .Fn EC_POINT_method_of | ||
369 | returns the | ||
370 | .Vt EC_METHOD | ||
371 | associated with the supplied | ||
372 | .Vt EC_POINT . | ||
373 | .Pp | ||
374 | .Fn EC_POINT_point2oct | ||
375 | returns the length of the required buffer, or 0 on error. | ||
376 | .Pp | ||
377 | .Fn EC_POINT_point2bn | ||
378 | returns the pointer to the | ||
379 | .Vt BIGNUM | ||
380 | supplied or | ||
381 | .Vt NULL | ||
382 | on error. | ||
383 | .Pp | ||
384 | .Fn EC_POINT_bn2point | ||
385 | returns the pointer to the | ||
386 | .Vt EC_POINT | ||
387 | supplied or | ||
388 | .Dv NULL | ||
389 | on error. | ||
390 | .Pp | ||
391 | .Fn EC_POINT_point2hex | ||
392 | returns a pointer to the hex string or | ||
393 | .Dv NULL | ||
394 | on error. | ||
395 | .Pp | ||
396 | .Fn EC_POINT_hex2point | ||
397 | returns the pointer to the | ||
398 | .Vt EC_POINT supplied or | ||
399 | .Dv NULL | ||
400 | on error. | ||
401 | .Sh SEE ALSO | ||
402 | .Xr crypto 3 , | ||
403 | .Xr d2i_ECPKParameters 3 , | ||
404 | .Xr ec 3 , | ||
405 | .Xr EC_GFp_simple_method 3 , | ||
406 | .Xr EC_GROUP_copy 3 , | ||
407 | .Xr EC_GROUP_new 3 , | ||
408 | .Xr EC_KEY_new 3 , | ||
409 | .Xr EC_POINT_add 3 | ||
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index a40bb39167..f676472ff6 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.35 2016/11/02 09:11:53 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.36 2016/11/02 11:57:56 schwarze Exp $ |
2 | 2 | ||
3 | .include <bsd.own.mk> # for NOMAN | 3 | .include <bsd.own.mk> # for NOMAN |
4 | 4 | ||
@@ -63,16 +63,6 @@ MAN= \ | |||
63 | DH_new.3 \ | 63 | DH_new.3 \ |
64 | DH_set_method.3 \ | 64 | DH_set_method.3 \ |
65 | DH_size.3 \ | 65 | DH_size.3 \ |
66 | ECDSA_SIG_new.3 \ | ||
67 | EVP_AEAD_CTX_init.3 \ | ||
68 | UI_new.3 \ | ||
69 | bn_dump.3 \ | ||
70 | crypto.3 \ | ||
71 | d2i_PKCS8PrivateKey_bio.3 \ | ||
72 | des_read_pw.3 \ | ||
73 | lh_new.3 \ | ||
74 | |||
75 | GENMAN= \ | ||
76 | DSA_SIG_new.3 \ | 66 | DSA_SIG_new.3 \ |
77 | DSA_do_sign.3 \ | 67 | DSA_do_sign.3 \ |
78 | DSA_dup_DH.3 \ | 68 | DSA_dup_DH.3 \ |
@@ -89,6 +79,16 @@ GENMAN= \ | |||
89 | EC_KEY_new.3 \ | 79 | EC_KEY_new.3 \ |
90 | EC_POINT_add.3 \ | 80 | EC_POINT_add.3 \ |
91 | EC_POINT_new.3 \ | 81 | EC_POINT_new.3 \ |
82 | ECDSA_SIG_new.3 \ | ||
83 | EVP_AEAD_CTX_init.3 \ | ||
84 | UI_new.3 \ | ||
85 | bn_dump.3 \ | ||
86 | crypto.3 \ | ||
87 | d2i_PKCS8PrivateKey_bio.3 \ | ||
88 | des_read_pw.3 \ | ||
89 | lh_new.3 \ | ||
90 | |||
91 | GENMAN= \ | ||
92 | ERR.3 \ | 92 | ERR.3 \ |
93 | ERR_GET_LIB.3 \ | 93 | ERR_GET_LIB.3 \ |
94 | ERR_clear_error.3 \ | 94 | ERR_clear_error.3 \ |