aboutsummaryrefslogtreecommitdiff
path: root/test/pbetest.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/pbetest.c')
-rw-r--r--test/pbetest.c109
1 files changed, 93 insertions, 16 deletions
diff --git a/test/pbetest.c b/test/pbetest.c
index cfffc2b93233..399e3a58f60c 100644
--- a/test/pbetest.c
+++ b/test/pbetest.c
@@ -23,15 +23,43 @@
static const char pbe_password[] = "MyVoiceIsMyPassport";
static unsigned char pbe_salt[] = {
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x01,
+ 0x02,
+ 0x03,
+ 0x04,
+ 0x05,
+ 0x06,
+ 0x07,
+ 0x08,
};
static const int pbe_iter = 1000;
static unsigned char pbe_plaintext[] = {
- 0x57, 0x65, 0x20, 0x61, 0x72, 0x65, 0x20, 0x61,
- 0x6c, 0x6c, 0x20, 0x6d, 0x61, 0x64, 0x65, 0x20,
- 0x6f, 0x66, 0x20, 0x73, 0x74, 0x61, 0x72, 0x73,
+ 0x57,
+ 0x65,
+ 0x20,
+ 0x61,
+ 0x72,
+ 0x65,
+ 0x20,
+ 0x61,
+ 0x6c,
+ 0x6c,
+ 0x20,
+ 0x6d,
+ 0x61,
+ 0x64,
+ 0x65,
+ 0x20,
+ 0x6f,
+ 0x66,
+ 0x20,
+ 0x73,
+ 0x74,
+ 0x61,
+ 0x72,
+ 0x73,
};
#endif
@@ -39,25 +67,74 @@ static unsigned char pbe_plaintext[] = {
#if !defined OPENSSL_NO_RC4 && !defined OPENSSL_NO_MD5
static const unsigned char pbe_ciphertext_rc4_md5[] = {
- 0x21, 0x90, 0xfa, 0xee, 0x95, 0x66, 0x59, 0x45,
- 0xfa, 0x1e, 0x9f, 0xe2, 0x25, 0xd2, 0xf9, 0x71,
- 0x94, 0xe4, 0x3d, 0xc9, 0x7c, 0xb0, 0x07, 0x23,
+ 0x21,
+ 0x90,
+ 0xfa,
+ 0xee,
+ 0x95,
+ 0x66,
+ 0x59,
+ 0x45,
+ 0xfa,
+ 0x1e,
+ 0x9f,
+ 0xe2,
+ 0x25,
+ 0xd2,
+ 0xf9,
+ 0x71,
+ 0x94,
+ 0xe4,
+ 0x3d,
+ 0xc9,
+ 0x7c,
+ 0xb0,
+ 0x07,
+ 0x23,
};
#endif
#if !defined OPENSSL_NO_DES && !defined OPENSSL_NO_SHA1
static const unsigned char pbe_ciphertext_des_sha1[] = {
- 0xce, 0x4b, 0xb0, 0x0a, 0x7b, 0x48, 0xd7, 0xe3,
- 0x9a, 0x9f, 0x46, 0xd6, 0x41, 0x42, 0x4b, 0x44,
- 0x36, 0x45, 0x5f, 0x60, 0x8f, 0x3c, 0xd0, 0x55,
- 0xd0, 0x8d, 0xa9, 0xab, 0x78, 0x5b, 0x63, 0xaf,
+ 0xce,
+ 0x4b,
+ 0xb0,
+ 0x0a,
+ 0x7b,
+ 0x48,
+ 0xd7,
+ 0xe3,
+ 0x9a,
+ 0x9f,
+ 0x46,
+ 0xd6,
+ 0x41,
+ 0x42,
+ 0x4b,
+ 0x44,
+ 0x36,
+ 0x45,
+ 0x5f,
+ 0x60,
+ 0x8f,
+ 0x3c,
+ 0xd0,
+ 0x55,
+ 0xd0,
+ 0x8d,
+ 0xa9,
+ 0xab,
+ 0x78,
+ 0x5b,
+ 0x63,
+ 0xaf,
};
#endif
#if !defined OPENSSL_NO_RC4 && !defined OPENSSL_NO_MD5 \
|| !defined OPENSSL_NO_DES && !defined OPENSSL_NO_SHA1
static int test_pkcs5_pbe(const EVP_CIPHER *cipher, const EVP_MD *md,
- const unsigned char *exp, const int exp_len)
+ const unsigned char *exp, const int exp_len)
{
int ret = 0;
EVP_CIPHER_CTX *ctx;
@@ -74,11 +151,11 @@ static int test_pkcs5_pbe(const EVP_CIPHER *cipher, const EVP_MD *md,
goto err;
if (!TEST_true(PKCS5_pbe_set0_algor(algor, EVP_CIPHER_nid(cipher), pbe_iter,
- pbe_salt, sizeof(pbe_salt)))
+ pbe_salt, sizeof(pbe_salt)))
|| !TEST_true(PKCS5_PBE_keyivgen(ctx, pbe_password, strlen(pbe_password),
- algor->parameter, cipher, md, 1))
+ algor->parameter, cipher, md, 1))
|| !TEST_true(EVP_CipherUpdate(ctx, out, &i, pbe_plaintext,
- sizeof(pbe_plaintext))))
+ sizeof(pbe_plaintext))))
goto err;
outlen = i;
@@ -92,7 +169,7 @@ static int test_pkcs5_pbe(const EVP_CIPHER *cipher, const EVP_MD *md,
/* Decrypt */
if (!TEST_true(PKCS5_PBE_keyivgen(ctx, pbe_password, strlen(pbe_password),
- algor->parameter, cipher, md, 0))
+ algor->parameter, cipher, md, 0))
|| !TEST_true(EVP_CipherUpdate(ctx, out, &i, exp, exp_len)))
goto err;