mirror of https://github.com/openssl/openssl.git
Add documentation and test for EVP_PBE_alg_add
Fixes openssl#18687 Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19157)
This commit is contained in:
parent
65080a3e1e
commit
181167b6d0
|
@ -3,7 +3,8 @@
|
||||||
=head1 NAME
|
=head1 NAME
|
||||||
|
|
||||||
EVP_PBE_CipherInit, EVP_PBE_CipherInit_ex,
|
EVP_PBE_CipherInit, EVP_PBE_CipherInit_ex,
|
||||||
EVP_PBE_find, EVP_PBE_find_ex - Password based encryption routines
|
EVP_PBE_find, EVP_PBE_find_ex,
|
||||||
|
EVP_PBE_alg_add_type, EVP_PBE_alg_add - Password based encryption routines
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
|
@ -20,6 +21,11 @@ EVP_PBE_find, EVP_PBE_find_ex - Password based encryption routines
|
||||||
int EVP_PBE_find_ex(int type, int pbe_nid, int *pcnid, int *pmnid,
|
int EVP_PBE_find_ex(int type, int pbe_nid, int *pcnid, int *pmnid,
|
||||||
EVP_PBE_KEYGEN **pkeygen, EVP_PBE_KEYGEN_EX **keygen_ex);
|
EVP_PBE_KEYGEN **pkeygen, EVP_PBE_KEYGEN_EX **keygen_ex);
|
||||||
|
|
||||||
|
int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid,
|
||||||
|
int md_nid, EVP_PBE_KEYGEN *keygen);
|
||||||
|
int EVP_PBE_alg_add(int nid, const EVP_CIPHER *cipher, const EVP_MD *md,
|
||||||
|
EVP_PBE_KEYGEN *keygen);
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
=head2 PBE operations
|
=head2 PBE operations
|
||||||
|
@ -66,6 +72,12 @@ context and property query.
|
||||||
If a NULL is supplied for any of I<pcnid>, I<pmnid>, I<pkeygen> or I<pkeygen_ex>
|
If a NULL is supplied for any of I<pcnid>, I<pmnid>, I<pkeygen> or I<pkeygen_ex>
|
||||||
then this parameter is not returned.
|
then this parameter is not returned.
|
||||||
|
|
||||||
|
=head2 PBE algorithm add
|
||||||
|
|
||||||
|
EVP_PBE_alg_add_type() and EVP_PBE_alg_add() add an algorithm to the list
|
||||||
|
of known algorithms. Their parameters have the same meaning as for
|
||||||
|
EVP_PBE_find() and EVP_PBE_find_ex() functions.
|
||||||
|
|
||||||
=head1 NOTES
|
=head1 NOTES
|
||||||
|
|
||||||
The arguments I<pbe_obj> and I<param> to EVP_PBE_CipherInit() and EVP_PBE_CipherInit_ex()
|
The arguments I<pbe_obj> and I<param> to EVP_PBE_CipherInit() and EVP_PBE_CipherInit_ex()
|
||||||
|
|
|
@ -1073,6 +1073,34 @@ static int test_evp_md_ctx_copy(void)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined OPENSSL_NO_DES && !defined OPENSSL_NO_MD5
|
||||||
|
static int test_evp_pbe_alg_add(void)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
int cipher_nid = 0, md_nid = 0;
|
||||||
|
EVP_PBE_KEYGEN_EX *keygen_ex = NULL;
|
||||||
|
EVP_PBE_KEYGEN *keygen = NULL;
|
||||||
|
|
||||||
|
if (!TEST_true(EVP_PBE_alg_add(NID_pbeWithMD5AndDES_CBC, EVP_des_cbc(), EVP_md5(),
|
||||||
|
PKCS5_PBE_keyivgen)))
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
if (!TEST_true(EVP_PBE_find_ex(EVP_PBE_TYPE_OUTER, NID_pbeWithMD5AndDES_CBC,
|
||||||
|
&cipher_nid, &md_nid, &keygen, &keygen_ex)))
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
if (!TEST_true(keygen != NULL))
|
||||||
|
goto err;
|
||||||
|
if (!TEST_true(keygen_ex == NULL))
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
ret = 1;
|
||||||
|
|
||||||
|
err:
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int setup_tests(void)
|
int setup_tests(void)
|
||||||
{
|
{
|
||||||
if (!test_get_libctx(&mainctx, &nullprov, NULL, NULL, NULL)) {
|
if (!test_get_libctx(&mainctx, &nullprov, NULL, NULL, NULL)) {
|
||||||
|
@ -1110,6 +1138,9 @@ int setup_tests(void)
|
||||||
ADD_TEST(test_evp_md_ctx_dup);
|
ADD_TEST(test_evp_md_ctx_dup);
|
||||||
ADD_TEST(test_evp_md_ctx_copy);
|
ADD_TEST(test_evp_md_ctx_copy);
|
||||||
ADD_ALL_TESTS(test_provider_unload_effective, 2);
|
ADD_ALL_TESTS(test_provider_unload_effective, 2);
|
||||||
|
#if !defined OPENSSL_NO_DES && !defined OPENSSL_NO_MD5
|
||||||
|
ADD_TEST(test_evp_pbe_alg_add);
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -634,8 +634,6 @@ EVP_CIPHER_impl_ctx_size(3)
|
||||||
EVP_CIPHER_set_asn1_iv(3)
|
EVP_CIPHER_set_asn1_iv(3)
|
||||||
EVP_MD_do_all(3)
|
EVP_MD_do_all(3)
|
||||||
EVP_MD_do_all_sorted(3)
|
EVP_MD_do_all_sorted(3)
|
||||||
EVP_PBE_alg_add(3)
|
|
||||||
EVP_PBE_alg_add_type(3)
|
|
||||||
EVP_PBE_cleanup(3)
|
EVP_PBE_cleanup(3)
|
||||||
EVP_PBE_get(3)
|
EVP_PBE_get(3)
|
||||||
EVP_PKEY_CTX_get0_peerkey(3)
|
EVP_PKEY_CTX_get0_peerkey(3)
|
||||||
|
|
Loading…
Reference in New Issue