Update to OpenSSL 1.0.2.o
This commit is contained in:
@@ -66,8 +66,8 @@ utility functions should be used instead.
|
||||
In general it cannot be assumed that the data returned by ASN1_STRING_data()
|
||||
is null terminated or does not contain embedded nulls. The actual format
|
||||
of the data will depend on the actual string type itself: for example
|
||||
for and IA5String the data will be ASCII, for a BMPString two bytes per
|
||||
character in big endian format, UTF8String will be in UTF8 format.
|
||||
for an IA5String the data will be ASCII, for a BMPString two bytes per
|
||||
character in big endian format, and for an UTF8String it will be in UTF8 format.
|
||||
|
||||
Similar care should be take to ensure the data is in the correct format
|
||||
when calling ASN1_STRING_set().
|
||||
|
||||
@@ -50,14 +50,14 @@ zero then it will return B<v> when it is empty and it will set the read retry
|
||||
flag (that is BIO_read_retry(b) is true). To avoid ambiguity with a normal
|
||||
positive return value B<v> should be set to a negative value, typically -1.
|
||||
|
||||
BIO_get_mem_data() sets B<pp> to a pointer to the start of the memory BIOs data
|
||||
BIO_get_mem_data() sets *B<pp> to a pointer to the start of the memory BIOs data
|
||||
and returns the total amount of data available. It is implemented as a macro.
|
||||
|
||||
BIO_set_mem_buf() sets the internal BUF_MEM structure to B<bm> and sets the
|
||||
close flag to B<c>, that is B<c> should be either BIO_CLOSE or BIO_NOCLOSE.
|
||||
It is a macro.
|
||||
|
||||
BIO_get_mem_ptr() places the underlying BUF_MEM structure in B<pp>. It is
|
||||
BIO_get_mem_ptr() places the underlying BUF_MEM structure in *B<pp>. It is
|
||||
a macro.
|
||||
|
||||
BIO_new_mem_buf() creates a memory BIO using B<len> bytes of data at B<buf>,
|
||||
|
||||
@@ -70,8 +70,9 @@ BN_bn2bin() returns the length of the big-endian number placed at B<to>.
|
||||
BN_bin2bn() returns the B<BIGNUM>, NULL on error.
|
||||
|
||||
BN_bn2hex() and BN_bn2dec() return a null-terminated string, or NULL
|
||||
on error. BN_hex2bn() and BN_dec2bn() return the number's length in
|
||||
hexadecimal or decimal digits, and 0 on error.
|
||||
on error. BN_hex2bn() and BN_dec2bn() return the number of characters
|
||||
used in parsing, or 0 on error, in which
|
||||
case no new B<BIGNUM> will be created.
|
||||
|
||||
BN_print_fp() and BN_print() return 1 on success, 0 on write errors.
|
||||
|
||||
|
||||
@@ -30,10 +30,12 @@ to the value 0.
|
||||
BN_free() frees the components of the B<BIGNUM>, and if it was created
|
||||
by BN_new(), also the structure itself. BN_clear_free() additionally
|
||||
overwrites the data before the memory is returned to the system.
|
||||
If B<a> is NULL, nothing is done.
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
BN_new() returns a pointer to the B<BIGNUM>. If the allocation fails,
|
||||
BN_new() returns a pointer to the B<BIGNUM> initialised to the value 0.
|
||||
If the allocation fails,
|
||||
it returns B<NULL> and sets an error code that can be obtained
|
||||
by L<ERR_get_error(3)|ERR_get_error(3)>.
|
||||
|
||||
|
||||
@@ -14,34 +14,37 @@ operations
|
||||
|
||||
const BIGNUM *BN_value_one(void);
|
||||
|
||||
int BN_set_word(BIGNUM *a, unsigned long w);
|
||||
unsigned long BN_get_word(BIGNUM *a);
|
||||
int BN_set_word(BIGNUM *a, BN_ULONG w);
|
||||
BN_ULONG BN_get_word(BIGNUM *a);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<BN_ULONG> is a macro that will be an unsigned integral type optimied
|
||||
for the most efficient implementation on the local platform.
|
||||
|
||||
BN_zero(), BN_one() and BN_set_word() set B<a> to the values 0, 1 and
|
||||
B<w> respectively. BN_zero() and BN_one() are macros.
|
||||
|
||||
BN_value_one() returns a B<BIGNUM> constant of value 1. This constant
|
||||
is useful for use in comparisons and assignment.
|
||||
|
||||
BN_get_word() returns B<a>, if it can be represented as an unsigned
|
||||
long.
|
||||
BN_get_word() returns B<a>, if it can be represented as a B<BN_ULONG>.
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
BN_get_word() returns the value B<a>, and 0xffffffffL if B<a> cannot
|
||||
be represented as an unsigned long.
|
||||
BN_get_word() returns the value B<a>, or all-bits-set if B<a> cannot
|
||||
be represented as a B<BN_ULONG>.
|
||||
|
||||
BN_zero(), BN_one() and BN_set_word() return 1 on success, 0 otherwise.
|
||||
BN_value_one() returns the constant.
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
Someone might change the constant.
|
||||
If a B<BIGNUM> is equal to the value of all-bits-set, it will collide
|
||||
with the error condition returned by BN_get_word() which uses that
|
||||
as an error value.
|
||||
|
||||
If a B<BIGNUM> is equal to 0xffffffffL it can be represented as an
|
||||
unsigned long but this value is also returned on error.
|
||||
B<BN_ULONG> should probably be a typedef.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
|
||||
@@ -19,14 +19,17 @@ EVP_CIPHER_CTX_mode, EVP_CIPHER_param_to_asn1, EVP_CIPHER_asn1_to_param,
|
||||
EVP_CIPHER_CTX_set_padding, EVP_enc_null, EVP_des_cbc, EVP_des_ecb,
|
||||
EVP_des_cfb, EVP_des_ofb, EVP_des_ede_cbc, EVP_des_ede, EVP_des_ede_ofb,
|
||||
EVP_des_ede_cfb, EVP_des_ede3_cbc, EVP_des_ede3, EVP_des_ede3_ofb,
|
||||
EVP_des_ede3_cfb, EVP_desx_cbc, EVP_rc4, EVP_rc4_40, EVP_idea_cbc,
|
||||
EVP_idea_ecb, EVP_idea_cfb, EVP_idea_ofb, EVP_idea_cbc, EVP_rc2_cbc,
|
||||
EVP_des_ede3_cfb, EVP_desx_cbc, EVP_rc4, EVP_rc4_40, EVP_rc4_hmac_md5,
|
||||
EVP_idea_cbc, EVP_idea_ecb, EVP_idea_cfb, EVP_idea_ofb, EVP_rc2_cbc,
|
||||
EVP_rc2_ecb, EVP_rc2_cfb, EVP_rc2_ofb, EVP_rc2_40_cbc, EVP_rc2_64_cbc,
|
||||
EVP_bf_cbc, EVP_bf_ecb, EVP_bf_cfb, EVP_bf_ofb, EVP_cast5_cbc,
|
||||
EVP_cast5_ecb, EVP_cast5_cfb, EVP_cast5_ofb, EVP_rc5_32_12_16_cbc,
|
||||
EVP_rc5_32_12_16_ecb, EVP_rc5_32_12_16_cfb, EVP_rc5_32_12_16_ofb,
|
||||
EVP_aes_128_gcm, EVP_aes_192_gcm, EVP_aes_256_gcm, EVP_aes_128_ccm,
|
||||
EVP_aes_192_ccm, EVP_aes_256_ccm - EVP cipher routines
|
||||
EVP_aes_192_ccm, EVP_aes_256_ccm,
|
||||
EVP_aes_128_cbc_hmac_sha1, EVP_aes_256_cbc_hmac_sha1,
|
||||
EVP_aes_128_cbc_hmac_sha256, EVP_aes_256_cbc_hmac_sha256
|
||||
- EVP cipher routines
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
@@ -35,38 +38,38 @@ EVP_aes_192_ccm, EVP_aes_256_ccm - EVP cipher routines
|
||||
void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a);
|
||||
|
||||
int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
|
||||
ENGINE *impl, unsigned char *key, unsigned char *iv);
|
||||
ENGINE *impl, const unsigned char *key, const unsigned char *iv);
|
||||
int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
int *outl, unsigned char *in, int inl);
|
||||
int *outl, const unsigned char *in, int inl);
|
||||
int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
int *outl);
|
||||
|
||||
int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
|
||||
ENGINE *impl, unsigned char *key, unsigned char *iv);
|
||||
ENGINE *impl, const unsigned char *key, const unsigned char *iv);
|
||||
int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
int *outl, unsigned char *in, int inl);
|
||||
int *outl, const unsigned char *in, int inl);
|
||||
int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm,
|
||||
int *outl);
|
||||
|
||||
int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
|
||||
ENGINE *impl, unsigned char *key, unsigned char *iv, int enc);
|
||||
ENGINE *impl, const unsigned char *key, const unsigned char *iv, int enc);
|
||||
int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
int *outl, unsigned char *in, int inl);
|
||||
int *outl, const unsigned char *in, int inl);
|
||||
int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm,
|
||||
int *outl);
|
||||
|
||||
int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
|
||||
unsigned char *key, unsigned char *iv);
|
||||
const unsigned char *key, const unsigned char *iv);
|
||||
int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
int *outl);
|
||||
|
||||
int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
|
||||
unsigned char *key, unsigned char *iv);
|
||||
const unsigned char *key, const unsigned char *iv);
|
||||
int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm,
|
||||
int *outl);
|
||||
|
||||
int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
|
||||
unsigned char *key, unsigned char *iv, int enc);
|
||||
const unsigned char *key, const unsigned char *iv, int enc);
|
||||
int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm,
|
||||
int *outl);
|
||||
|
||||
@@ -392,10 +395,7 @@ processed (e.g. after an EVP_EncryptFinal() call).
|
||||
EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_GCM_SET_TAG, taglen, tag);
|
||||
|
||||
Sets the expected tag to B<taglen> bytes from B<tag>. This call is only legal
|
||||
when decrypting data and must be made B<before> any data is processed (e.g.
|
||||
before any EVP_DecryptUpdate() call).
|
||||
|
||||
See L<EXAMPLES> below for an example of the use of GCM mode.
|
||||
when decrypting data.
|
||||
|
||||
=head1 CCM Mode
|
||||
|
||||
|
||||
376
doc/crypto/EVP_PKEY_meth_new.pod
Normal file
376
doc/crypto/EVP_PKEY_meth_new.pod
Normal file
@@ -0,0 +1,376 @@
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
EVP_PKEY_meth_new, EVP_PKEY_meth_free, EVP_PKEY_meth_copy, EVP_PKEY_meth_find,
|
||||
EVP_PKEY_meth_add0, EVP_PKEY_METHOD,
|
||||
EVP_PKEY_meth_set_init, EVP_PKEY_meth_set_copy, EVP_PKEY_meth_set_cleanup,
|
||||
EVP_PKEY_meth_set_paramgen, EVP_PKEY_meth_set_keygen, EVP_PKEY_meth_set_sign,
|
||||
EVP_PKEY_meth_set_verify, EVP_PKEY_meth_set_verify_recover, EVP_PKEY_meth_set_signctx,
|
||||
EVP_PKEY_meth_set_verifyctx, EVP_PKEY_meth_set_encrypt, EVP_PKEY_meth_set_decrypt,
|
||||
EVP_PKEY_meth_set_derive, EVP_PKEY_meth_set_ctrl,
|
||||
EVP_PKEY_meth_get_init, EVP_PKEY_meth_get_copy, EVP_PKEY_meth_get_cleanup,
|
||||
EVP_PKEY_meth_get_paramgen, EVP_PKEY_meth_get_keygen, EVP_PKEY_meth_get_sign,
|
||||
EVP_PKEY_meth_get_verify, EVP_PKEY_meth_get_verify_recover, EVP_PKEY_meth_get_signctx,
|
||||
EVP_PKEY_meth_get_verifyctx, EVP_PKEY_meth_get_encrypt, EVP_PKEY_meth_get_decrypt,
|
||||
EVP_PKEY_meth_get_derive, EVP_PKEY_meth_get_ctrl
|
||||
- manipulating EVP_PKEY_METHOD structure
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#include <openssl/evp.h>
|
||||
|
||||
typedef struct evp_pkey_method_st EVP_PKEY_METHOD;
|
||||
|
||||
EVP_PKEY_METHOD *EVP_PKEY_meth_new(int id, int flags);
|
||||
void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth);
|
||||
void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src);
|
||||
const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type);
|
||||
int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth);
|
||||
|
||||
void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth,
|
||||
int (*init) (EVP_PKEY_CTX *ctx));
|
||||
void EVP_PKEY_meth_set_copy(EVP_PKEY_METHOD *pmeth,
|
||||
int (*copy) (EVP_PKEY_CTX *dst,
|
||||
EVP_PKEY_CTX *src));
|
||||
void EVP_PKEY_meth_set_cleanup(EVP_PKEY_METHOD *pmeth,
|
||||
void (*cleanup) (EVP_PKEY_CTX *ctx));
|
||||
void EVP_PKEY_meth_set_paramgen(EVP_PKEY_METHOD *pmeth,
|
||||
int (*paramgen_init) (EVP_PKEY_CTX *ctx),
|
||||
int (*paramgen) (EVP_PKEY_CTX *ctx,
|
||||
EVP_PKEY *pkey));
|
||||
void EVP_PKEY_meth_set_keygen(EVP_PKEY_METHOD *pmeth,
|
||||
int (*keygen_init) (EVP_PKEY_CTX *ctx),
|
||||
int (*keygen) (EVP_PKEY_CTX *ctx,
|
||||
EVP_PKEY *pkey));
|
||||
void EVP_PKEY_meth_set_sign(EVP_PKEY_METHOD *pmeth,
|
||||
int (*sign_init) (EVP_PKEY_CTX *ctx),
|
||||
int (*sign) (EVP_PKEY_CTX *ctx,
|
||||
unsigned char *sig, size_t *siglen,
|
||||
const unsigned char *tbs,
|
||||
size_t tbslen));
|
||||
void EVP_PKEY_meth_set_verify(EVP_PKEY_METHOD *pmeth,
|
||||
int (*verify_init) (EVP_PKEY_CTX *ctx),
|
||||
int (*verify) (EVP_PKEY_CTX *ctx,
|
||||
const unsigned char *sig,
|
||||
size_t siglen,
|
||||
const unsigned char *tbs,
|
||||
size_t tbslen));
|
||||
void EVP_PKEY_meth_set_verify_recover(EVP_PKEY_METHOD *pmeth,
|
||||
int (*verify_recover_init) (EVP_PKEY_CTX
|
||||
*ctx),
|
||||
int (*verify_recover) (EVP_PKEY_CTX
|
||||
*ctx,
|
||||
unsigned char
|
||||
*sig,
|
||||
size_t *siglen,
|
||||
const unsigned
|
||||
char *tbs,
|
||||
size_t tbslen));
|
||||
void EVP_PKEY_meth_set_signctx(EVP_PKEY_METHOD *pmeth,
|
||||
int (*signctx_init) (EVP_PKEY_CTX *ctx,
|
||||
EVP_MD_CTX *mctx),
|
||||
int (*signctx) (EVP_PKEY_CTX *ctx,
|
||||
unsigned char *sig,
|
||||
size_t *siglen,
|
||||
EVP_MD_CTX *mctx));
|
||||
void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth,
|
||||
int (*verifyctx_init) (EVP_PKEY_CTX *ctx,
|
||||
EVP_MD_CTX *mctx),
|
||||
int (*verifyctx) (EVP_PKEY_CTX *ctx,
|
||||
const unsigned char *sig,
|
||||
int siglen,
|
||||
EVP_MD_CTX *mctx));
|
||||
void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth,
|
||||
int (*encrypt_init) (EVP_PKEY_CTX *ctx),
|
||||
int (*encryptfn) (EVP_PKEY_CTX *ctx,
|
||||
unsigned char *out,
|
||||
size_t *outlen,
|
||||
const unsigned char *in,
|
||||
size_t inlen));
|
||||
void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth,
|
||||
int (*decrypt_init) (EVP_PKEY_CTX *ctx),
|
||||
int (*decrypt) (EVP_PKEY_CTX *ctx,
|
||||
unsigned char *out,
|
||||
size_t *outlen,
|
||||
const unsigned char *in,
|
||||
size_t inlen));
|
||||
void EVP_PKEY_meth_set_derive(EVP_PKEY_METHOD *pmeth,
|
||||
int (*derive_init) (EVP_PKEY_CTX *ctx),
|
||||
int (*derive) (EVP_PKEY_CTX *ctx,
|
||||
unsigned char *key,
|
||||
size_t *keylen));
|
||||
void EVP_PKEY_meth_set_ctrl(EVP_PKEY_METHOD *pmeth,
|
||||
int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1,
|
||||
void *p2),
|
||||
int (*ctrl_str) (EVP_PKEY_CTX *ctx,
|
||||
const char *type,
|
||||
const char *value));
|
||||
|
||||
void EVP_PKEY_meth_get_init(EVP_PKEY_METHOD *pmeth,
|
||||
int (**pinit) (EVP_PKEY_CTX *ctx));
|
||||
void EVP_PKEY_meth_get_copy(EVP_PKEY_METHOD *pmeth,
|
||||
int (**pcopy) (EVP_PKEY_CTX *dst,
|
||||
EVP_PKEY_CTX *src));
|
||||
void EVP_PKEY_meth_get_cleanup(EVP_PKEY_METHOD *pmeth,
|
||||
void (**pcleanup) (EVP_PKEY_CTX *ctx));
|
||||
void EVP_PKEY_meth_get_paramgen(EVP_PKEY_METHOD *pmeth,
|
||||
int (**pparamgen_init) (EVP_PKEY_CTX *ctx),
|
||||
int (**pparamgen) (EVP_PKEY_CTX *ctx,
|
||||
EVP_PKEY *pkey));
|
||||
void EVP_PKEY_meth_get_keygen(EVP_PKEY_METHOD *pmeth,
|
||||
int (**pkeygen_init) (EVP_PKEY_CTX *ctx),
|
||||
int (**pkeygen) (EVP_PKEY_CTX *ctx,
|
||||
EVP_PKEY *pkey));
|
||||
void EVP_PKEY_meth_get_sign(EVP_PKEY_METHOD *pmeth,
|
||||
int (**psign_init) (EVP_PKEY_CTX *ctx),
|
||||
int (**psign) (EVP_PKEY_CTX *ctx,
|
||||
unsigned char *sig, size_t *siglen,
|
||||
const unsigned char *tbs,
|
||||
size_t tbslen));
|
||||
void EVP_PKEY_meth_get_verify(EVP_PKEY_METHOD *pmeth,
|
||||
int (**pverify_init) (EVP_PKEY_CTX *ctx),
|
||||
int (**pverify) (EVP_PKEY_CTX *ctx,
|
||||
const unsigned char *sig,
|
||||
size_t siglen,
|
||||
const unsigned char *tbs,
|
||||
size_t tbslen));
|
||||
void EVP_PKEY_meth_get_verify_recover(EVP_PKEY_METHOD *pmeth,
|
||||
int (**pverify_recover_init) (EVP_PKEY_CTX
|
||||
*ctx),
|
||||
int (**pverify_recover) (EVP_PKEY_CTX
|
||||
*ctx,
|
||||
unsigned char
|
||||
*sig,
|
||||
size_t *siglen,
|
||||
const unsigned
|
||||
char *tbs,
|
||||
size_t tbslen));
|
||||
void EVP_PKEY_meth_get_signctx(EVP_PKEY_METHOD *pmeth,
|
||||
int (**psignctx_init) (EVP_PKEY_CTX *ctx,
|
||||
EVP_MD_CTX *mctx),
|
||||
int (**psignctx) (EVP_PKEY_CTX *ctx,
|
||||
unsigned char *sig,
|
||||
size_t *siglen,
|
||||
EVP_MD_CTX *mctx));
|
||||
void EVP_PKEY_meth_get_verifyctx(EVP_PKEY_METHOD *pmeth,
|
||||
int (**pverifyctx_init) (EVP_PKEY_CTX *ctx,
|
||||
EVP_MD_CTX *mctx),
|
||||
int (**pverifyctx) (EVP_PKEY_CTX *ctx,
|
||||
const unsigned char *sig,
|
||||
int siglen,
|
||||
EVP_MD_CTX *mctx));
|
||||
void EVP_PKEY_meth_get_encrypt(EVP_PKEY_METHOD *pmeth,
|
||||
int (**pencrypt_init) (EVP_PKEY_CTX *ctx),
|
||||
int (**pencryptfn) (EVP_PKEY_CTX *ctx,
|
||||
unsigned char *out,
|
||||
size_t *outlen,
|
||||
const unsigned char *in,
|
||||
size_t inlen));
|
||||
void EVP_PKEY_meth_get_decrypt(EVP_PKEY_METHOD *pmeth,
|
||||
int (**pdecrypt_init) (EVP_PKEY_CTX *ctx),
|
||||
int (**pdecrypt) (EVP_PKEY_CTX *ctx,
|
||||
unsigned char *out,
|
||||
size_t *outlen,
|
||||
const unsigned char *in,
|
||||
size_t inlen));
|
||||
void EVP_PKEY_meth_get_derive(EVP_PKEY_METHOD *pmeth,
|
||||
int (**pderive_init) (EVP_PKEY_CTX *ctx),
|
||||
int (**pderive) (EVP_PKEY_CTX *ctx,
|
||||
unsigned char *key,
|
||||
size_t *keylen));
|
||||
void EVP_PKEY_meth_get_ctrl(EVP_PKEY_METHOD *pmeth,
|
||||
int (**pctrl) (EVP_PKEY_CTX *ctx, int type, int p1,
|
||||
void *p2),
|
||||
int (**pctrl_str) (EVP_PKEY_CTX *ctx,
|
||||
const char *type,
|
||||
const char *value));
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
B<EVP_PKEY_METHOD> is a structure which holds a set of methods for a
|
||||
specific public key cryptographic algorithm. Those methods are usually
|
||||
used to perform different jobs, such as generating a key, signing or
|
||||
verifying, encrypting or decrypting, etc.
|
||||
|
||||
There are two places where the B<EVP_PKEY_METHOD> objects are stored: one
|
||||
is a built-in static array representing the standard methods for different
|
||||
algorithms, and the other one is a stack of user-defined application-specific
|
||||
methods, which can be manipulated by using L<EVP_PKEY_meth_add0(3)>.
|
||||
|
||||
The B<EVP_PKEY_METHOD> objects are usually referenced by B<EVP_PKEY_CTX>
|
||||
objects.
|
||||
|
||||
=head2 Methods
|
||||
|
||||
The methods are the underlying implementations of a particular public key
|
||||
algorithm present by the B<EVP_PKEY_CTX> object.
|
||||
|
||||
int (*init) (EVP_PKEY_CTX *ctx);
|
||||
int (*copy) (EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src);
|
||||
void (*cleanup) (EVP_PKEY_CTX *ctx);
|
||||
|
||||
The init() method is called to initialize algorithm-specific data when a new
|
||||
B<EVP_PKEY_CTX> is created. As opposed to init(), the cleanup() method is called
|
||||
when an B<EVP_PKEY_CTX> is freed. The copy() method is called when an B<EVP_PKEY_CTX>
|
||||
is being duplicated. Refer to L<EVP_PKEY_CTX_new(3)>, L<EVP_PKEY_CTX_new_id(3)>,
|
||||
L<EVP_PKEY_CTX_free(3)> and L<EVP_PKEY_CTX_dup(3)>.
|
||||
|
||||
int (*paramgen_init) (EVP_PKEY_CTX *ctx);
|
||||
int (*paramgen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
|
||||
|
||||
The paramgen_init() and paramgen() methods deal with key parameter generation.
|
||||
They are called by L<EVP_PKEY_paramgen_init(3)> and L<EVP_PKEY_paramgen(3)> to
|
||||
handle the parameter generation process.
|
||||
|
||||
int (*keygen_init) (EVP_PKEY_CTX *ctx);
|
||||
int (*keygen) (EVP_PKEY_CTX *ctx, EVP_PKEY *pkey);
|
||||
|
||||
The keygen_init() and keygen() methods are used to generate the actual key for
|
||||
the specified algorithm. They are called by L<EVP_PKEY_keygen_init(3)> and
|
||||
L<EVP_PKEY_keygen(3)>.
|
||||
|
||||
int (*sign_init) (EVP_PKEY_CTX *ctx);
|
||||
int (*sign) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
|
||||
const unsigned char *tbs, size_t tbslen);
|
||||
|
||||
The sign_init() and sign() methods are used to generate the signature of a
|
||||
piece of data using a private key. They are called by L<EVP_PKEY_sign_init(3)>
|
||||
and L<EVP_PKEY_sign(3)>.
|
||||
|
||||
int (*verify_init) (EVP_PKEY_CTX *ctx);
|
||||
int (*verify) (EVP_PKEY_CTX *ctx,
|
||||
const unsigned char *sig, size_t siglen,
|
||||
const unsigned char *tbs, size_t tbslen);
|
||||
|
||||
The verify_init() and verify() methods are used to verify whether a signature is
|
||||
valid. They are called by L<EVP_PKEY_verify_init(3)> and L<EVP_PKEY_verify(3)>.
|
||||
|
||||
int (*verify_recover_init) (EVP_PKEY_CTX *ctx);
|
||||
int (*verify_recover) (EVP_PKEY_CTX *ctx,
|
||||
unsigned char *rout, size_t *routlen,
|
||||
const unsigned char *sig, size_t siglen);
|
||||
|
||||
The verify_recover_init() and verify_recover() methods are used to verify a
|
||||
signature and then recover the digest from the signature (for instance, a
|
||||
signature that was generated by RSA signing algorithm). They are called by
|
||||
L<EVP_PKEY_verify_recover_init(3)> and L<EVP_PKEY_verify_recover(3)>.
|
||||
|
||||
int (*signctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
|
||||
int (*signctx) (EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen,
|
||||
EVP_MD_CTX *mctx);
|
||||
|
||||
The signctx_init() and signctx() methods are used to sign a digest present by
|
||||
a B<EVP_MD_CTX> object. They are called by the EVP_DigestSign functions. See
|
||||
L<EVP_DigestSignInit(3)> for detail.
|
||||
|
||||
int (*verifyctx_init) (EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx);
|
||||
int (*verifyctx) (EVP_PKEY_CTX *ctx, const unsigned char *sig, int siglen,
|
||||
EVP_MD_CTX *mctx);
|
||||
|
||||
The verifyctx_init() and verifyctx() methods are used to verify a signature
|
||||
against the data in a B<EVP_MD_CTX> object. They are called by the various
|
||||
EVP_DigestVerify functions. See L<EVP_DigestVerifyInit(3)> for detail.
|
||||
|
||||
int (*encrypt_init) (EVP_PKEY_CTX *ctx);
|
||||
int (*encrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
|
||||
const unsigned char *in, size_t inlen);
|
||||
|
||||
The encrypt_init() and encrypt() methods are used to encrypt a piece of data.
|
||||
They are called by L<EVP_PKEY_encrypt_init(3)> and L<EVP_PKEY_encrypt(3)>.
|
||||
|
||||
int (*decrypt_init) (EVP_PKEY_CTX *ctx);
|
||||
int (*decrypt) (EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
|
||||
const unsigned char *in, size_t inlen);
|
||||
|
||||
The decrypt_init() and decrypt() methods are used to decrypt a piece of data.
|
||||
They are called by L<EVP_PKEY_decrypt_init(3)> and L<EVP_PKEY_decrypt(3)>.
|
||||
|
||||
int (*derive_init) (EVP_PKEY_CTX *ctx);
|
||||
int (*derive) (EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen);
|
||||
|
||||
The derive_init() and derive() methods are used to derive the shared secret
|
||||
from a public key algorithm (for instance, the DH algorithm). They are called by
|
||||
L<EVP_PKEY_derive_init(3)> and L<EVP_PKEY_derive(3)>.
|
||||
|
||||
int (*ctrl) (EVP_PKEY_CTX *ctx, int type, int p1, void *p2);
|
||||
int (*ctrl_str) (EVP_PKEY_CTX *ctx, const char *type, const char *value);
|
||||
|
||||
The ctrl() and ctrl_str() methods are used to adjust algorithm-specific
|
||||
settings. See L<EVP_PKEY_CTX_ctrl(3)> and related functions for detail.
|
||||
|
||||
int (*digestsign) (EVP_MD_CTX *ctx, unsigned char *sig, size_t *siglen,
|
||||
const unsigned char *tbs, size_t tbslen);
|
||||
int (*digestverify) (EVP_MD_CTX *ctx, const unsigned char *sig,
|
||||
size_t siglen, const unsigned char *tbs,
|
||||
size_t tbslen);
|
||||
|
||||
The digestsign() and digestverify() methods are used to generate or verify
|
||||
a signature in a one-shot mode. They could be called by L<EVP_DigetSign(3)>
|
||||
and L<EVP_DigestVerify(3)>.
|
||||
|
||||
=head2 Functions
|
||||
|
||||
EVP_PKEY_meth_new() creates and returns a new B<EVP_PKEY_METHOD> object,
|
||||
and associates the given B<id> and B<flags>. The following flags are
|
||||
supported:
|
||||
|
||||
EVP_PKEY_FLAG_AUTOARGLEN
|
||||
EVP_PKEY_FLAG_SIGCTX_CUSTOM
|
||||
|
||||
If an B<EVP_PKEY_METHOD> is set with the B<EVP_PKEY_FLAG_AUTOARGLEN> flag, the
|
||||
maximum size of the output buffer will be automatically calculated or checked
|
||||
in corresponding EVP methods by the EVP framework. Thus the implementations of
|
||||
these methods don't need to care about handling the case of returning output
|
||||
buffer size by themselves. For details on the output buffer size, refer to
|
||||
L<EVP_PKEY_sign(3)>.
|
||||
|
||||
The B<EVP_PKEY_FLAG_SIGCTX_CUSTOM> is used to indicate the signctx() method
|
||||
of an B<EVP_PKEY_METHOD> is always called by the EVP framework while doing a
|
||||
digest signing operation by calling L<EVP_DigestSignFinal(3)>.
|
||||
|
||||
EVP_PKEY_meth_free() frees an existing B<EVP_PKEY_METHOD> pointed by
|
||||
B<pmeth>.
|
||||
|
||||
EVP_PKEY_meth_copy() copies an B<EVP_PKEY_METHOD> object from B<src>
|
||||
to B<dst>.
|
||||
|
||||
EVP_PKEY_meth_find() finds an B<EVP_PKEY_METHOD> object with the B<id>.
|
||||
This function first searches through the user-defined method objects and
|
||||
then the built-in objects.
|
||||
|
||||
EVP_PKEY_meth_add0() adds B<pmeth> to the user defined stack of methods.
|
||||
|
||||
The EVP_PKEY_meth_set functions set the corresponding fields of
|
||||
B<EVP_PKEY_METHOD> structure with the arguments passed.
|
||||
|
||||
The EVP_PKEY_meth_get functions get the corresponding fields of
|
||||
B<EVP_PKEY_METHOD> structure to the arguments provided.
|
||||
|
||||
=head1 RETURN VALUES
|
||||
|
||||
EVP_PKEY_meth_new() returns a pointer to a new B<EVP_PKEY_METHOD>
|
||||
object or returns NULL on error.
|
||||
|
||||
EVP_PKEY_meth_free() and EVP_PKEY_meth_copy() do not return values.
|
||||
|
||||
EVP_PKEY_meth_find() returns a pointer to the found B<EVP_PKEY_METHOD>
|
||||
object or returns NULL if not found.
|
||||
|
||||
EVP_PKEY_meth_add0() returns 1 if method is added successfully or 0
|
||||
if an error occurred.
|
||||
|
||||
All EVP_PKEY_meth_set and EVP_PKEY_meth_get functions have no return
|
||||
values. For the 'get' functions, function pointers are returned by
|
||||
arguments.
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the OpenSSL license (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
in the file LICENSE in the source distribution or at
|
||||
L<https://www.openssl.org/source/license.html>.
|
||||
|
||||
=cut
|
||||
@@ -104,6 +104,13 @@ The RSA_padding_check_xxx() functions return the length of the
|
||||
recovered data, -1 on error. Error codes can be obtained by calling
|
||||
L<ERR_get_error(3)|ERR_get_error(3)>.
|
||||
|
||||
=head1 WARNING
|
||||
|
||||
The RSA_padding_check_PKCS1_type_2() padding check leaks timing
|
||||
information which can potentially be used to mount a Bleichenbacher
|
||||
padding oracle attack. This is an inherent weakness in the PKCS #1
|
||||
v1.5 padding design. Prefer PKCS1_OAEP padding.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<RSA_public_encrypt(3)|RSA_public_encrypt(3)>,
|
||||
|
||||
@@ -8,10 +8,10 @@ RSA_private_encrypt, RSA_public_decrypt - low level signature operations
|
||||
|
||||
#include <openssl/rsa.h>
|
||||
|
||||
int RSA_private_encrypt(int flen, unsigned char *from,
|
||||
int RSA_private_encrypt(int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa, int padding);
|
||||
|
||||
int RSA_public_decrypt(int flen, unsigned char *from,
|
||||
int RSA_public_decrypt(int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa, int padding);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
@@ -8,10 +8,10 @@ RSA_public_encrypt, RSA_private_decrypt - RSA public key cryptography
|
||||
|
||||
#include <openssl/rsa.h>
|
||||
|
||||
int RSA_public_encrypt(int flen, unsigned char *from,
|
||||
int RSA_public_encrypt(int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa, int padding);
|
||||
|
||||
int RSA_private_decrypt(int flen, unsigned char *from,
|
||||
int RSA_private_decrypt(int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa, int padding);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
@@ -67,6 +67,13 @@ recovered plaintext.
|
||||
On error, -1 is returned; the error codes can be
|
||||
obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
|
||||
|
||||
=head1 WARNING
|
||||
|
||||
Decryption failures in the RSA_PKCS1_PADDING mode leak information
|
||||
which can potentially be used to mount a Bleichenbacher padding oracle
|
||||
attack. This is an inherent weakness in the PKCS #1 v1.5 padding
|
||||
design. Prefer RSA_PKCS1_OAEP_PADDING.
|
||||
|
||||
=head1 CONFORMING TO
|
||||
|
||||
SSL, PKCS #1 v2.0
|
||||
|
||||
@@ -41,7 +41,7 @@ is no longer valid.
|
||||
X509_STORE_CTX_init() sets up B<ctx> for a subsequent verification operation.
|
||||
It must be called before each call to X509_verify_cert(), i.e. a B<ctx> is only
|
||||
good for one call to X509_verify_cert(); if you want to verify a second
|
||||
certificate with the same B<ctx> then you must call X509_XTORE_CTX_cleanup()
|
||||
certificate with the same B<ctx> then you must call X509_STORE_CTX_cleanup()
|
||||
and then X509_STORE_CTX_init() again before the second call to
|
||||
X509_verify_cert(). The trusted certificate store is set to B<store>, the end
|
||||
entity certificate to be verified is set to B<x509> and a set of additional
|
||||
|
||||
@@ -203,6 +203,27 @@ chain found is not trusted, then OpenSSL will continue to check to see if an
|
||||
alternative chain can be found that is trusted. With this flag set the behaviour
|
||||
will match that of OpenSSL versions prior to 1.0.2b.
|
||||
|
||||
The B<X509_V_FLAG_TRUSTED_FIRST> flag causes chain construction to look for
|
||||
issuers in the trust store before looking at the untrusted certificates
|
||||
provided as part of the the peer chain.
|
||||
Though it is not on by default in OpenSSL 1.0.2, applications should generally
|
||||
set this flag.
|
||||
Local issuer certificates are often more likely to satisfy local security
|
||||
requirements and lead to a locally trusted root.
|
||||
This is especially important When some certificates in the trust store have
|
||||
explicit trust settings (see "TRUST SETTINGS" in L<x509(1)>).
|
||||
|
||||
The B<X509_V_FLAG_PARTIAL_CHAIN> flag causes intermediate certificates in the
|
||||
trust store to be treated as trust-anchors, in the same way as the self-signed
|
||||
root CA certificates.
|
||||
This makes it possible to trust certificates issued by an intermediate CA
|
||||
without having to trust its ancestor root CA.
|
||||
With OpenSSL 1.0.2, chain construction continues as long as there are
|
||||
additional trusted issuers in the trust store, and the last trusted issuer
|
||||
becomes the trust-anchor.
|
||||
Thus, even when an intermediate certificate is found in the trust store, the
|
||||
verified chain passed to callbacks may still be anchored by a root CA.
|
||||
|
||||
=head1 NOTES
|
||||
|
||||
The above functions should be used to manipulate verification parameters
|
||||
@@ -235,7 +256,8 @@ connections associated with an B<SSL_CTX> structure B<ctx>:
|
||||
L<X509_verify_cert(3)|X509_verify_cert(3)>,
|
||||
L<X509_check_host(3)|X509_check_host(3)>,
|
||||
L<X509_check_email(3)|X509_check_email(3)>,
|
||||
L<X509_check_ip(3)|X509_check_ip(3)>
|
||||
L<X509_check_ip(3)|X509_check_ip(3)>,
|
||||
L<x509(1)|x509(1)>
|
||||
|
||||
=head1 HISTORY
|
||||
|
||||
|
||||
54
doc/crypto/X509_check_private_key.pod
Normal file
54
doc/crypto/X509_check_private_key.pod
Normal file
@@ -0,0 +1,54 @@
|
||||
=pod
|
||||
|
||||
=head1 NAME
|
||||
|
||||
X509_check_private_key, X509_REQ_check_private_key - check the consistency
|
||||
of a private key with the public key in an X509 certificate or certificate
|
||||
request
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
#include <openssl/x509.h>
|
||||
|
||||
int X509_check_private_key(X509 *x, EVP_PKEY *k);
|
||||
|
||||
int X509_REQ_check_private_key(X509_REQ *x, EVP_PKEY *k);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
X509_check_private_key() function checks the consistency of private
|
||||
key B<k> with the public key in B<x>.
|
||||
|
||||
X509_REQ_check_private_key() is equivalent to X509_check_private_key()
|
||||
except that B<x> represents a certificate request of structure B<X509_REQ>.
|
||||
|
||||
=head1 RETURN VALUE
|
||||
|
||||
X509_check_private_key() and X509_REQ_check_private_key() return 1 if
|
||||
the keys match each other, and 0 if not.
|
||||
|
||||
If the key is invalid or an error occurred, the reason code can be
|
||||
obtained using L<ERR_get_error(3)>.
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
The B<check_private_key> functions don't check if B<k> itself is indeed
|
||||
a private key or not. It merely compares the public materials (e.g. exponent
|
||||
and modulus of an RSA key) and/or key parameters (e.g. EC params of an EC key)
|
||||
of a key pair. So if you pass a public key to these functions in B<k>, it will
|
||||
return success.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<ERR_get_error(3)>
|
||||
|
||||
=head1 COPYRIGHT
|
||||
|
||||
Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the OpenSSL license (the "License"). You may not use
|
||||
this file except in compliance with the License. You can obtain a copy
|
||||
in the file LICENSE in the source distribution or at
|
||||
L<https://www.openssl.org/source/license.html>.
|
||||
|
||||
=cut
|
||||
@@ -123,7 +123,7 @@ architecture dependent I<DES_key_schedule> via the
|
||||
DES_set_key_checked() or DES_set_key_unchecked() function.
|
||||
|
||||
DES_set_key_checked() will check that the key passed is of odd parity
|
||||
and is not a week or semi-weak key. If the parity is wrong, then -1
|
||||
and is not a weak or semi-weak key. If the parity is wrong, then -1
|
||||
is returned. If the key is a weak key, then -2 is returned. If an
|
||||
error is returned, the key schedule is not generated.
|
||||
|
||||
|
||||
@@ -38,7 +38,8 @@ B<key_len> bytes long.
|
||||
It places the result in B<md> (which must have space for the output of
|
||||
the hash function, which is no more than B<EVP_MAX_MD_SIZE> bytes).
|
||||
If B<md> is NULL, the digest is placed in a static array. The size of
|
||||
the output is placed in B<md_len>, unless it is B<NULL>.
|
||||
the output is placed in B<md_len>, unless it is B<NULL>. Note: passing a NULL
|
||||
value for B<md> to use the static array is not thread safe.
|
||||
|
||||
B<evp_md> can be EVP_sha1(), EVP_ripemd160() etc.
|
||||
|
||||
|
||||
@@ -63,9 +63,13 @@ CRYPTO_destroy_dynlockid, CRYPTO_lock - OpenSSL thread support
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
OpenSSL can safely be used in multi-threaded applications provided
|
||||
that at least two callback functions are set, locking_function and
|
||||
OpenSSL can generally be used safely in multi-threaded applications provided
|
||||
that at least two callback functions are set, the locking_function and
|
||||
threadid_func.
|
||||
Note that OpenSSL is not completely thread-safe, and unfortunately not all
|
||||
global resources have the necessary locks.
|
||||
Further, the thread-safety does not extend to things like multiple threads
|
||||
using the same B<SSL> object at the same time.
|
||||
|
||||
locking_function(int mode, int n, const char *file, int line) is
|
||||
needed to perform locking on shared data structures.
|
||||
|
||||
Reference in New Issue
Block a user