diff options
Diffstat (limited to 'doc/crypto')
48 files changed, 1573 insertions, 162 deletions
diff --git a/doc/crypto/ASN1_STRING_length.pod b/doc/crypto/ASN1_STRING_length.pod index a08e9a0fa4..f651e4f2ae 100644 --- a/doc/crypto/ASN1_STRING_length.pod +++ b/doc/crypto/ASN1_STRING_length.pod @@ -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 diff --git a/doc/crypto/ASN1_STRING_print_ex.pod b/doc/crypto/ASN1_STRING_print_ex.pod index 3891b88791..19c82ff1e4 100644 --- a/doc/crypto/ASN1_STRING_print_ex.pod +++ b/doc/crypto/ASN1_STRING_print_ex.pod @@ -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 diff --git a/doc/crypto/ASN1_generate_nconf.pod b/doc/crypto/ASN1_generate_nconf.pod index 542fd1579a..f21f189a38 100644 --- a/doc/crypto/ASN1_generate_nconf.pod +++ b/doc/crypto/ASN1_generate_nconf.pod @@ -61,7 +61,7 @@ Encode the B<NULL> type, the B<value> string must not be present. =item B<INTEGER>, B<INT> Encodes an ASN1 B<INTEGER> type. The B<value> string represents -the value of the integer, it can be preceeded by a minus sign and +the value of the integer, it can be preceded by a minus sign and is normally interpreted as a decimal value unless the prefix B<0x> is included. diff --git a/doc/crypto/BIO_find_type.pod b/doc/crypto/BIO_find_type.pod index bd3b256196..2595200327 100644 --- a/doc/crypto/BIO_find_type.pod +++ b/doc/crypto/BIO_find_type.pod @@ -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 diff --git a/doc/crypto/BIO_s_accept.pod b/doc/crypto/BIO_s_accept.pod index 7b63e4621b..34af1d229a 100644 --- a/doc/crypto/BIO_s_accept.pod +++ b/doc/crypto/BIO_s_accept.pod @@ -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 diff --git a/doc/crypto/BIO_s_connect.pod b/doc/crypto/BIO_s_connect.pod index bcf7d8dcac..18ece4c91f 100644 --- a/doc/crypto/BIO_s_connect.pod +++ b/doc/crypto/BIO_s_connect.pod @@ -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 diff --git a/doc/crypto/BN_BLINDING_new.pod b/doc/crypto/BN_BLINDING_new.pod index da06e44461..06d7ea20a3 100644 --- a/doc/crypto/BN_BLINDING_new.pod +++ b/doc/crypto/BN_BLINDING_new.pod @@ -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. @@ -84,7 +84,7 @@ or NULL in case of an error. BN_BLINDING_update(), BN_BLINDING_convert(), BN_BLINDING_invert(), BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() return 1 on -success and 0 if an error occured. +success and 0 if an error occurred. BN_BLINDING_thread_id() returns a pointer to the thread id object within a B<BN_BLINDING> object. diff --git a/doc/crypto/BN_CTX_new.pod b/doc/crypto/BN_CTX_new.pod index ad8d07db89..bbedbb1778 100644 --- a/doc/crypto/BN_CTX_new.pod +++ b/doc/crypto/BN_CTX_new.pod @@ -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 @@ -22,8 +25,7 @@ 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. @@ -31,6 +33,8 @@ 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 diff --git a/doc/crypto/BN_generate_prime.pod b/doc/crypto/BN_generate_prime.pod index 7dccacbc1e..bf1b5308ad 100644 --- a/doc/crypto/BN_generate_prime.pod +++ b/doc/crypto/BN_generate_prime.pod @@ -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); @@ -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 @@ -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 diff --git a/doc/crypto/BN_rand.pod b/doc/crypto/BN_rand.pod index 81f93c2eb3..d6b975ccf6 100644 --- a/doc/crypto/BN_rand.pod +++ b/doc/crypto/BN_rand.pod @@ -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 diff --git a/doc/crypto/CMS_add0_cert.pod b/doc/crypto/CMS_add0_cert.pod index 9c13f488f6..8678ca18a5 100644 --- a/doc/crypto/CMS_add0_cert.pod +++ b/doc/crypto/CMS_add0_cert.pod @@ -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 diff --git a/doc/crypto/CMS_get0_RecipientInfos.pod b/doc/crypto/CMS_get0_RecipientInfos.pod index fa6bb169d1..fe49772a86 100644 --- a/doc/crypto/CMS_get0_RecipientInfos.pod +++ b/doc/crypto/CMS_get0_RecipientInfos.pod @@ -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 diff --git a/doc/crypto/CMS_verify.pod b/doc/crypto/CMS_verify.pod index 8f26fdab09..7a2c1ee251 100644 --- a/doc/crypto/CMS_verify.pod +++ b/doc/crypto/CMS_verify.pod @@ -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 diff --git a/doc/crypto/DH_generate_parameters.pod b/doc/crypto/DH_generate_parameters.pod index 9081e9ea7c..7f81a04d91 100644 --- a/doc/crypto/DH_generate_parameters.pod +++ b/doc/crypto/DH_generate_parameters.pod @@ -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 @@ -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 diff --git a/doc/crypto/DSA_generate_parameters.pod b/doc/crypto/DSA_generate_parameters.pod index be7c924ff8..16a67f22b0 100644 --- a/doc/crypto/DSA_generate_parameters.pod +++ b/doc/crypto/DSA_generate_parameters.pod @@ -2,20 +2,26 @@ =head1 NAME -DSA_generate_parameters - generate DSA parameters +DSA_generate_parameters_ex, DSA_generate_parameters - generate DSA parameters =head1 SYNOPSIS #include <openssl/dsa.h> + int DSA_generate_parameters_ex(DSA *dsa, int bits, + const unsigned char *seed,int seed_len, + int *counter_ret, unsigned long *h_ret, BN_GENCB *cb); + +Deprecated: + DSA *DSA_generate_parameters(int bits, unsigned char *seed, int seed_len, int *counter_ret, unsigned long *h_ret, void (*callback)(int, int, void *), void *cb_arg); =head1 DESCRIPTION -DSA_generate_parameters() generates primes p and q and a generator g -for use in the DSA. +DSA_generate_parameters_ex() generates primes p and q and a generator g +for use in the DSA and stores the result in B<dsa>. B<bits> is the length of the prime to be generated; the DSS allows a maximum of 1024 bits. @@ -25,64 +31,74 @@ generated at random. Otherwise, the seed is used to generate them. If the given seed does not yield a prime q, a new random seed is chosen and placed at B<seed>. -DSA_generate_parameters() places the iteration count in +DSA_generate_parameters_ex() places the iteration count in *B<counter_ret> and a counter used for finding a generator in *B<h_ret>, unless these are B<NULL>. 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 -called as follows: +of the key generation. If B<cb> is not B<NULL>, it will be +called as shown below. For information on the BN_GENCB structure and the +BN_GENCB_call function discussed below, refer to +L<BN_generate_prime(3)|BN_generate_prime(3)>. =over 4 =item * -When a candidate for q is generated, B<callback(0, m++, cb_arg)> is called +When a candidate for q is generated, B<BN_GENCB_call(cb, 0, m++)> is called (m is 0 for the first candidate). =item * When a candidate for q has passed a test by trial division, -B<callback(1, -1, cb_arg)> is called. +B<BN_GENCB_call(cb, 1, -1)> is called. While a candidate for q is tested by Miller-Rabin primality tests, -B<callback(1, i, cb_arg)> is called in the outer loop +B<BN_GENCB_call(cb, 1, i)> is called in the outer loop (once for each witness that confirms that the candidate may be prime); i is the loop counter (starting at 0). =item * -When a prime q has been found, B<callback(2, 0, cb_arg)> and -B<callback(3, 0, cb_arg)> are called. +When a prime q has been found, B<BN_GENCB_call(cb, 2, 0)> and +B<BN_GENCB_call(cb, 3, 0)> are called. =item * Before a candidate for p (other than the first) is generated and tested, -B<callback(0, counter, cb_arg)> is called. +B<BN_GENCB_call(cb, 0, counter)> is called. =item * When a candidate for p has passed the test by trial division, -B<callback(1, -1, cb_arg)> is called. +B<BN_GENCB_call(cb, 1, -1)> is called. While it is tested by the Miller-Rabin primality test, -B<callback(1, i, cb_arg)> is called in the outer loop +B<BN_GENCB_call(cb, 1, i)> is called in the outer loop (once for each witness that confirms that the candidate may be prime). i is the loop counter (starting at 0). =item * -When p has been found, B<callback(2, 1, cb_arg)> is called. +When p has been found, B<BN_GENCB_call(cb, 2, 1)> is called. =item * -When the generator has been found, B<callback(3, 1, cb_arg)> is called. +When the generator has been found, B<BN_GENCB_call(cb, 3, 1)> is called. =back +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 +instead a newly allocated B<DSA> structure is returned. Additionally "old +style" callbacks are used instead of the newer BN_GENCB based approach. +Refer to L<BN_generate_prime(3)|BN_generate_prime(3)> for further information. + =head1 RETURN VALUE +DSA_generate_parameters_ex() returns a 1 on success, or 0 otherwise. + DSA_generate_parameters() returns a pointer to the DSA structure, or -B<NULL> if the parameter generation fails. The error codes can be -obtained by L<ERR_get_error(3)|ERR_get_error(3)>. +B<NULL> if the parameter generation fails. + +The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. =head1 BUGS @@ -91,7 +107,7 @@ Seed lengths E<gt> 20 are not supported. =head1 SEE ALSO L<dsa(3)|dsa(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, -L<DSA_free(3)|DSA_free(3)> +L<DSA_free(3)|DSA_free(3)>, L<BN_generate_prime(3)|BN_generate_prime(3)> =head1 HISTORY |