Skip to content

Commit

Permalink
Document updates from wiki.
Browse files Browse the repository at this point in the history
PR#3071

The primary changes made are:
- Updates to the "NAME" section of many pages to correctly reflect the
functions defined on those pages. This section is automatically parsed
by the util/extract-names.pl script, so if it is not correct then
running "man" will not correctly locate the right manual pages.
- Updates to take account of where functions are now deprecated
- Full documentation of the ec sub-library
- A number of other typo corrections and other minor tweaks
  • Loading branch information
mattcaswell authored and snhenson committed Jun 12, 2013
1 parent 271fef0 commit aafbe1c
Show file tree
Hide file tree
Showing 48 changed files with 1,227 additions and 133 deletions.
2 changes: 1 addition & 1 deletion doc/crypto/ASN1_STRING_length.pod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
=head1 NAME

ASN1_STRING_dup, ASN1_STRING_cmp, ASN1_STRING_set, ASN1_STRING_length,
ASN1_STRING_length_set, ASN1_STRING_type, ASN1_STRING_data -
ASN1_STRING_length_set, ASN1_STRING_type, ASN1_STRING_data, ASN1_STRING_to_UTF8 -
ASN1_STRING utility functions

=head1 SYNOPSIS
Expand Down
2 changes: 1 addition & 1 deletion doc/crypto/ASN1_STRING_print_ex.pod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

=head1 NAME

ASN1_STRING_print_ex, ASN1_STRING_print_ex_fp - ASN1_STRING output routines.
ASN1_STRING_print_ex, ASN1_STRING_print_ex_fp, ASN1_STRING_print - ASN1_STRING output routines.

=head1 SYNOPSIS

Expand Down
2 changes: 1 addition & 1 deletion doc/crypto/BIO_find_type.pod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

=head1 NAME

BIO_find_type, BIO_next - BIO chain traversal
BIO_find_type, BIO_next, BIO_method_type - BIO chain traversal

=head1 SYNOPSIS

Expand Down
2 changes: 1 addition & 1 deletion doc/crypto/BIO_s_accept.pod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

=head1 NAME

BIO_s_accept, BIO_set_accept_port, BIO_get_accept_port,
BIO_s_accept, BIO_set_accept_port, BIO_get_accept_port, BIO_new_accept,
BIO_set_nbio_accept, BIO_set_accept_bios, BIO_set_bind_mode,
BIO_get_bind_mode, BIO_do_accept - accept BIO

Expand Down
2 changes: 1 addition & 1 deletion doc/crypto/BIO_s_connect.pod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

=head1 NAME

BIO_s_connect, BIO_set_conn_hostname, BIO_set_conn_port,
BIO_s_connect, BIO_new_connect, BIO_set_conn_hostname, BIO_set_conn_port,
BIO_set_conn_ip, BIO_set_conn_int_port, BIO_get_conn_hostname,
BIO_get_conn_port, BIO_get_conn_ip, BIO_get_conn_int_port,
BIO_set_nbio, BIO_do_connect - connect BIO
Expand Down
2 changes: 1 addition & 1 deletion doc/crypto/BN_BLINDING_new.pod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

BN_BLINDING_new, BN_BLINDING_free, BN_BLINDING_update, BN_BLINDING_convert,
BN_BLINDING_invert, BN_BLINDING_convert_ex, BN_BLINDING_invert_ex,
BN_BLINDING_get_thread_id, BN_BLINDING_set_thread_id, BN_BLINDING_get_flags,
BN_BLINDING_get_thread_id, BN_BLINDING_set_thread_id, BN_BLINDING_thread_id, BN_BLINDING_get_flags,
BN_BLINDING_set_flags, BN_BLINDING_create_param - blinding related BIGNUM
functions.

Expand Down
10 changes: 7 additions & 3 deletions doc/crypto/BN_CTX_new.pod
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ BN_CTX_new, BN_CTX_init, BN_CTX_free - allocate and free BN_CTX structures

BN_CTX *BN_CTX_new(void);

void BN_CTX_free(BN_CTX *c);

Deprecated:

void BN_CTX_init(BN_CTX *c);

void BN_CTX_free(BN_CTX *c);

=head1 DESCRIPTION

Expand All @@ -22,15 +25,16 @@ is rather expensive when used in conjunction with repeated subroutine
calls, the B<BN_CTX> structure is used.

BN_CTX_new() allocates and initializes a B<BN_CTX>
structure. BN_CTX_init() initializes an existing uninitialized
B<BN_CTX>.
structure.

BN_CTX_free() frees the components of the B<BN_CTX>, and if it was
created by BN_CTX_new(), also the structure itself.
If L<BN_CTX_start(3)|BN_CTX_start(3)> has been used on the B<BN_CTX>,
L<BN_CTX_end(3)|BN_CTX_end(3)> must be called before the B<BN_CTX>
may be freed by BN_CTX_free().

BN_CTX_init() (deprecated) initializes an existing uninitialized B<BN_CTX>.
This should not be used for new programs. Use BN_CTX_new() instead.

=head1 RETURN VALUES

Expand Down
90 changes: 69 additions & 21 deletions doc/crypto/BN_generate_prime.pod
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,31 @@

=head1 NAME

BN_generate_prime, BN_is_prime, BN_is_prime_fasttest - generate primes and test for primality
BN_generate_prime_ex, BN_is_prime_ex, BN_is_prime_fasttest_ex, BN_GENCB_call,
BN_GENCB_set_old, BN_GENCB_set, BN_generate_prime, BN_is_prime,
BN_is_prime_fasttest - generate primes and test for primality

=head1 SYNOPSIS

#include <openssl/bn.h>

int BN_generate_prime_ex(BIGNUM *ret,int bits,int safe, const BIGNUM *add,
const BIGNUM *rem, BN_GENCB *cb);

int BN_is_prime_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, BN_GENCB *cb);

int BN_is_prime_fasttest_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx,
int do_trial_division, BN_GENCB *cb);

int BN_GENCB_call(BN_GENCB *cb, int a, int b);

#define BN_GENCB_set_old(gencb, callback, cb_arg) ...

#define BN_GENCB_set(gencb, callback, cb_arg) ...


Deprecated:

BIGNUM *BN_generate_prime(BIGNUM *ret, int num, int safe, BIGNUM *add,
BIGNUM *rem, void (*callback)(int, int, void *), void *cb_arg);

Expand All @@ -20,27 +39,27 @@ BN_generate_prime, BN_is_prime, BN_is_prime_fasttest - generate primes and test

=head1 DESCRIPTION

BN_generate_prime() generates a pseudo-random prime number of B<num>
bits.
BN_generate_prime_ex() generates a pseudo-random prime number of
bit length B<bits>.
If B<ret> is not B<NULL>, it will be used to store the number.

If B<callback> is not B<NULL>, it is called as follows:
If B<cb> is not B<NULL>, it is used as follows:

=over 4

=item *

B<callback(0, i, cb_arg)> is called after generating the i-th
B<BN_GENCB_call(cb, 0, i)> is called after generating the i-th
potential prime number.

=item *

While the number is being tested for primality, B<callback(1, j,
cb_arg)> is called as described below.
While the number is being tested for primality,
B<BN_GENCB_call(cb, 1, j)> is called as described below.

=item *

When a prime has been found, B<callback(2, i, cb_arg)> is called.
When a prime has been found, B<BN_GENCB_call(cb, 2, i)> is called.

=back

Expand All @@ -54,38 +73,67 @@ generator.
If B<safe> is true, it will be a safe prime (i.e. a prime p so
that (p-1)/2 is also prime).

The PRNG must be seeded prior to calling BN_generate_prime().
The PRNG must be seeded prior to calling BN_generate_prime_ex().
The prime number generation has a negligible error probability.

BN_is_prime() and BN_is_prime_fasttest() test if the number B<a> is
BN_is_prime_ex() and BN_is_prime_fasttest_ex() test if the number B<p> is
prime. The following tests are performed until one of them shows that
B<a> is composite; if B<a> passes all these tests, it is considered
B<p> is composite; if B<p> passes all these tests, it is considered
prime.

BN_is_prime_fasttest(), when called with B<do_trial_division == 1>,
BN_is_prime_fasttest_ex(), when called with B<do_trial_division == 1>,
first attempts trial division by a number of small primes;
if no divisors are found by this test and B<callback> is not B<NULL>,
B<callback(1, -1, cb_arg)> is called.
if no divisors are found by this test and B<cb> is not B<NULL>,
B<BN_GENCB_call(cb, 1, -1)> is called.
If B<do_trial_division == 0>, this test is skipped.

Both BN_is_prime() and BN_is_prime_fasttest() perform a Miller-Rabin
probabilistic primality test with B<checks> iterations. If
B<checks == BN_prime_checks>, a number of iterations is used that
Both BN_is_prime_ex() and BN_is_prime_fasttest_ex() perform a Miller-Rabin
probabilistic primality test with B<nchecks> iterations. If
B<nchecks == BN_prime_checks>, a number of iterations is used that
yields a false positive rate of at most 2^-80 for random input.

If B<callback> is not B<NULL>, B<callback(1, j, cb_arg)> is called
If B<cb> is not B<NULL>, B<BN_GENCB_call(cb, 1, j)> is called
after the j-th iteration (j = 0, 1, ...). B<ctx> is a
pre-allocated B<BN_CTX> (to save the overhead of allocating and
freeing the structure in a loop), or B<NULL>.

BN_GENCB_call calls the callback function held in the B<BN_GENCB> structure
and passes the ints B<a> and B<b> as arguments. There are two types of
B<BN_GENCB> structure that are supported: "new" style and "old" style. New
programs should prefer the "new" style, whilst the "old" style is provided
for backwards compatibility purposes.

For "new" style callbacks a BN_GENCB structure should be initialised with a
call to BN_GENCB_set, where B<gencb> is a B<BN_GENCB *>, B<callback> is of
type B<int (*callback)(int, int, BN_GENCB *)> and B<cb_arg> is a B<void *>.
"Old" style callbacks are the same except they are initialised with a call
to BN_GENCB_set_old and B<callback> is of type
B<void (*callback)(int, int, void *)>.

A callback is invoked through a call to B<BN_GENCB_call>. This will check
the type of the callback and will invoke B<callback(a, b, gencb)> for new
style callbacks or B<callback(a, b, cb_arg)> for old style.

BN_generate_prime (deprecated) works in the same way as
BN_generate_prime_ex but expects an old style callback function
directly in the B<callback> parameter, and an argument to pass to it in
the B<cb_arg>. Similarly BN_is_prime and BN_is_prime_fasttest are
deprecated and can be compared to BN_is_prime_ex and
BN_is_prime_fasttest_ex respectively.

=head1 RETURN VALUES

BN_generate_prime() returns the prime number on success, B<NULL> otherwise.
BN_generate_prime_ex() return 1 on success or 0 on error.

BN_is_prime() returns 0 if the number is composite, 1 if it is
prime with an error probability of less than 0.25^B<checks>, and
BN_is_prime_ex(), BN_is_prime_fasttest_ex(), BN_is_prime() and
BN_is_prime_fasttest() return 0 if the number is composite, 1 if it is
prime with an error probability of less than 0.25^B<nchecks>, and
-1 on error.

BN_generate_prime() returns the prime number on success, B<NULL> otherwise.

Callback functions should return 1 on success or 0 on error.

The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.

=head1 SEE ALSO
Expand Down
2 changes: 1 addition & 1 deletion doc/crypto/BN_rand.pod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

=head1 NAME

BN_rand, BN_pseudo_rand - generate pseudo-random number
BN_rand, BN_pseudo_rand, BN_rand_range, BN_pseudo_rand_range - generate pseudo-random number

=head1 SYNOPSIS

Expand Down
2 changes: 1 addition & 1 deletion doc/crypto/CMS_add0_cert.pod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

=head1 NAME

CMS_add0_cert, CMS_add1_cert, CMS_get1_certs, CMS_add0_crl, CMS_get1_crls, - CMS certificate and CRL utility functions
CMS_add0_cert, CMS_add1_cert, CMS_get1_certs, CMS_add0_crl, CMS_add1_crl, CMS_get1_crls, - CMS certificate and CRL utility functions

=head1 SYNOPSIS

Expand Down
2 changes: 1 addition & 1 deletion doc/crypto/CMS_get0_RecipientInfos.pod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

=head1 NAME

CMS_get0_RecipientInfos, CMS_RecipientInfo_type, CMS_RecipientInfo_ktri_get0_signer_id,CMS_RecipientInfo_ktri_cert_cmp, CMS_RecipientInfo_set0_pkey, CMS_RecipientInfo_kekri_get0_id, CMS_RecipientInfo_kekri_id_cmp, CMS_RecipientInfo_set0_key, CMS_RecipientInfo_decrypt - CMS envelopedData RecipientInfo routines
CMS_get0_RecipientInfos, CMS_RecipientInfo_type, CMS_RecipientInfo_ktri_get0_signer_id,CMS_RecipientInfo_ktri_cert_cmp, CMS_RecipientInfo_set0_pkey, CMS_RecipientInfo_kekri_get0_id, CMS_RecipientInfo_kekri_id_cmp, CMS_RecipientInfo_set0_key, CMS_RecipientInfo_decrypt, CMS_RecipientInfo_encrypt - CMS envelopedData RecipientInfo routines

=head1 SYNOPSIS

Expand Down
2 changes: 1 addition & 1 deletion doc/crypto/CMS_get0_SignerInfos.pod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

=head1 NAME

CMS_get0_SignerInfos, CMS_SignerInfo_get0_signer_id, CMS_SignerInfo_cert_cmp, CMS_set1_signer_certs - CMS signedData signer functions.
CMS_get0_SignerInfos, CMS_SignerInfo_get0_signer_id, CMS_SignerInfo_cert_cmp, CMS_set1_signer_cert - CMS signedData signer functions.

=head1 SYNOPSIS

Expand Down
2 changes: 1 addition & 1 deletion doc/crypto/CMS_verify.pod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

=head1 NAME

CMS_verify - verify a CMS SignedData structure
CMS_verify, CMS_get0_signers - verify a CMS SignedData structure

=head1 SYNOPSIS

Expand Down
43 changes: 26 additions & 17 deletions doc/crypto/DH_generate_parameters.pod
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,39 @@

=head1 NAME

DH_generate_parameters, DH_check - generate and check Diffie-Hellman parameters

DH_generate_parameters_ex, DH_generate_parameters,
DH_check - generate and check Diffie-Hellman parameters

=head1 SYNOPSIS

#include <openssl/dh.h>

DH *DH_generate_parameters(int prime_len, int generator,
void (*callback)(int, int, void *), void *cb_arg);
int DH_generate_parameters_ex(DH *dh, int prime_len,int generator, BN_GENCB *cb);

int DH_check(DH *dh, int *codes);

Deprecated:

DH *DH_generate_parameters(int prime_len, int generator,
void (*callback)(int, int, void *), void *cb_arg);

=head1 DESCRIPTION

DH_generate_parameters() generates Diffie-Hellman parameters that can
be shared among a group of users, and returns them in a newly
allocated B<DH> structure. The pseudo-random number generator must be
DH_generate_parameters_ex() generates Diffie-Hellman parameters that can
be shared among a group of users, and stores them in the provided B<DH>
structure. The pseudo-random number generator must be
seeded prior to calling DH_generate_parameters().

B<prime_len> is the length in bits of the safe prime to be generated.
B<generator> is a small number E<gt> 1, typically 2 or 5.

A callback function may be used to provide feedback about the progress
of the key generation. If B<callback> is not B<NULL>, it will be
of the key generation. If B<cb> is not B<NULL>, it will be
called as described in L<BN_generate_prime(3)|BN_generate_prime(3)> while a random prime
number is generated, and when a prime has been found, B<callback(3,
0, cb_arg)> is called.
number is generated, and when a prime has been found, B<BN_GENCB_call(cb, 3, 0)>
is called. See L<BN_generate_prime(3)|BN_generate_prime(3)> for information on
the BN_GENCB_call() function.

DH_check() validates Diffie-Hellman parameters. It checks that B<p> is
a safe prime, and that B<g> is a suitable generator. In the case of an
Expand All @@ -38,19 +45,21 @@ checked, i.e. it does not equal 2 or 5.

=head1 RETURN VALUES

DH_generate_parameters() returns a pointer to the DH structure, or
NULL if the parameter generation fails. The error codes can be
obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
DH_generate_parameters_ex() and DH_check() return 1 if the check could be
performed, 0 otherwise.

DH_generate_parameters() (deprecated) returns a pointer to the DH structure, or
NULL if the parameter generation fails.

DH_check() returns 1 if the check could be performed, 0 otherwise.
The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.

=head1 NOTES

DH_generate_parameters() may run for several hours before finding a
suitable prime.
DH_generate_parameters_ex() and DH_generate_parameters() may run for several
hours before finding a suitable prime.

The parameters generated by DH_generate_parameters() are not to be
used in signature schemes.
The parameters generated by DH_generate_parameters_ex() and DH_generate_parameters()
are not to be used in signature schemes.

=head1 BUGS

Expand Down

0 comments on commit aafbe1c

Please sign in to comment.