diff --git a/src/headers/tomcrypt_custom.h b/src/headers/tomcrypt_custom.h index 31440b45..685a57bf 100644 --- a/src/headers/tomcrypt_custom.h +++ b/src/headers/tomcrypt_custom.h @@ -91,6 +91,8 @@ #define LTC_SHA1 #define LTC_SHA3 #define LTC_SHA512 + #define LTC_SHA512_256 + #define LTC_SHA512_224 #define LTC_SHA384 #define LTC_SHA256 #define LTC_SHA224 diff --git a/src/misc/pbes/pbes2.c b/src/misc/pbes/pbes2.c index 75d17d31..a8db5bd4 100644 --- a/src/misc/pbes/pbes2.c +++ b/src/misc/pbes/pbes2.c @@ -20,6 +20,10 @@ static const oid_id_st s_hmac_oid_names[] = { { "1.2.840.113549.2.11", "sha512" }, { "1.2.840.113549.2.12", "sha512-224" }, { "1.2.840.113549.2.13", "sha512-256" }, + { "2.16.840.1.101.3.4.2.13", "sha3-224" }, + { "2.16.840.1.101.3.4.2.14", "sha3-256" }, + { "2.16.840.1.101.3.4.2.15", "sha3-384" }, + { "2.16.840.1.101.3.4.2.16", "sha3-512" }, }; static int s_pkcs_5_alg2_wrap(const struct password *pwd, diff --git a/tests/rsa-pkcs8/README.txt b/tests/rsa-pkcs8/README.txt index 5051775a..b70cc161 100644 --- a/tests/rsa-pkcs8/README.txt +++ b/tests/rsa-pkcs8/README.txt @@ -27,3 +27,7 @@ openssl pkcs8 -topk8 -inform PEM -outform DER -passout pass:secret -in ../test.k openssl pkcs8 -topk8 -inform PEM -outform DER -passout pass:secret -in ../test.key -v2 rc2-40 -v2prf hmacWithSHA512-256 -out key_pkcs8_pbkdf2_sha512_256_rc2_40_cbc.der openssl pkcs8 -topk8 -inform PEM -outform DER -passout pass:secret -in ../test.key -v2 rc2-64 -v2prf hmacWithSHA512 -out key_pkcs8_pbkdf2_sha512_rc2_64_cbc.der openssl pkcs8 -topk8 -inform PEM -outform DER -passout pass:secret -in ../test.key -v2 rc2-64 -v2prf hmacWithSHA512-256 -out key_pkcs8_pbkdf2_sha512_256_rc2_64_cbc.der +openssl pkcs8 -topk8 -inform PEM -outform DER -passout pass:secret -in ../test.key -v2 aes256 -v2prf id-hmacWithSHA3-224 -out key_pkcs8_pbkdf2_sha3_224_aes256_cbc.der +openssl pkcs8 -topk8 -inform PEM -outform DER -passout pass:secret -in ../test.key -v2 aes256 -v2prf id-hmacWithSHA3-256 -out key_pkcs8_pbkdf2_sha3_256_aes256_cbc.der +openssl pkcs8 -topk8 -inform PEM -outform DER -passout pass:secret -in ../test.key -v2 aes256 -v2prf id-hmacWithSHA3-384 -out key_pkcs8_pbkdf2_sha3_384_aes256_cbc.der +openssl pkcs8 -topk8 -inform PEM -outform DER -passout pass:secret -in ../test.key -v2 aes256 -v2prf id-hmacWithSHA3-512 -out key_pkcs8_pbkdf2_sha3_512_aes256_cbc.der diff --git a/tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha3_224_aes256_cbc.der b/tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha3_224_aes256_cbc.der new file mode 100644 index 00000000..d5d5b45f Binary files /dev/null and b/tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha3_224_aes256_cbc.der differ diff --git a/tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha3_256_aes256_cbc.der b/tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha3_256_aes256_cbc.der new file mode 100644 index 00000000..c518e733 Binary files /dev/null and b/tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha3_256_aes256_cbc.der differ diff --git a/tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha3_384_aes256_cbc.der b/tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha3_384_aes256_cbc.der new file mode 100644 index 00000000..d5866743 Binary files /dev/null and b/tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha3_384_aes256_cbc.der differ diff --git a/tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha3_512_aes256_cbc.der b/tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha3_512_aes256_cbc.der new file mode 100644 index 00000000..1aec2c97 Binary files /dev/null and b/tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha3_512_aes256_cbc.der differ diff --git a/tests/rsa-pkcs8/key_pkcs8_pbe_md2_des.der b/tests/rsa-pkcs8/old/key_pkcs8_pbe_md2_des.der similarity index 100% rename from tests/rsa-pkcs8/key_pkcs8_pbe_md2_des.der rename to tests/rsa-pkcs8/old/key_pkcs8_pbe_md2_des.der diff --git a/tests/rsa-pkcs8/key_pkcs8_pbe_md2_rc2_64.der b/tests/rsa-pkcs8/old/key_pkcs8_pbe_md2_rc2_64.der similarity index 100% rename from tests/rsa-pkcs8/key_pkcs8_pbe_md2_rc2_64.der rename to tests/rsa-pkcs8/old/key_pkcs8_pbe_md2_rc2_64.der diff --git a/tests/rsa-pkcs8/key_pkcs8_pbe_md5_des.der b/tests/rsa-pkcs8/old/key_pkcs8_pbe_md5_des.der similarity index 100% rename from tests/rsa-pkcs8/key_pkcs8_pbe_md5_des.der rename to tests/rsa-pkcs8/old/key_pkcs8_pbe_md5_des.der diff --git a/tests/rsa-pkcs8/key_pkcs8_pbe_md5_rc2_64.der b/tests/rsa-pkcs8/old/key_pkcs8_pbe_md5_rc2_64.der similarity index 100% rename from tests/rsa-pkcs8/key_pkcs8_pbe_md5_rc2_64.der rename to tests/rsa-pkcs8/old/key_pkcs8_pbe_md5_rc2_64.der diff --git a/tests/rsa-pkcs8/key_pkcs8_pbe_sha1_rc2_64.der b/tests/rsa-pkcs8/old/key_pkcs8_pbe_sha1_rc2_64.der similarity index 100% rename from tests/rsa-pkcs8/key_pkcs8_pbe_sha1_rc2_64.der rename to tests/rsa-pkcs8/old/key_pkcs8_pbe_sha1_rc2_64.der diff --git a/tests/rsa-pkcs8/key_pkcs8_pbkdf2_rc2_cbc.der b/tests/rsa-pkcs8/old/key_pkcs8_pbkdf2_rc2_cbc.der similarity index 100% rename from tests/rsa-pkcs8/key_pkcs8_pbkdf2_rc2_cbc.der rename to tests/rsa-pkcs8/old/key_pkcs8_pbkdf2_rc2_cbc.der diff --git a/tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha512_256_rc2_40_cbc.der b/tests/rsa-pkcs8/old/key_pkcs8_pbkdf2_sha512_256_rc2_40_cbc.der similarity index 100% rename from tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha512_256_rc2_40_cbc.der rename to tests/rsa-pkcs8/old/key_pkcs8_pbkdf2_sha512_256_rc2_40_cbc.der diff --git a/tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha512_256_rc2_64_cbc.der b/tests/rsa-pkcs8/old/key_pkcs8_pbkdf2_sha512_256_rc2_64_cbc.der similarity index 100% rename from tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha512_256_rc2_64_cbc.der rename to tests/rsa-pkcs8/old/key_pkcs8_pbkdf2_sha512_256_rc2_64_cbc.der diff --git a/tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha512_rc2_40_cbc.der b/tests/rsa-pkcs8/old/key_pkcs8_pbkdf2_sha512_rc2_40_cbc.der similarity index 100% rename from tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha512_rc2_40_cbc.der rename to tests/rsa-pkcs8/old/key_pkcs8_pbkdf2_sha512_rc2_40_cbc.der diff --git a/tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha512_rc2_64_cbc.der b/tests/rsa-pkcs8/old/key_pkcs8_pbkdf2_sha512_rc2_64_cbc.der similarity index 100% rename from tests/rsa-pkcs8/key_pkcs8_pbkdf2_sha512_rc2_64_cbc.der rename to tests/rsa-pkcs8/old/key_pkcs8_pbkdf2_sha512_rc2_64_cbc.der diff --git a/tests/rsa_test.c b/tests/rsa_test.c index 568e70fc..c1cfbb2b 100644 --- a/tests/rsa_test.c +++ b/tests/rsa_test.c @@ -431,7 +431,7 @@ static int s_rsa_import_x509(const void *in, unsigned long inlen, void *key) return rsa_import_x509(in, inlen, key); } -#if defined(LTC_MD2) && defined(LTC_MD5) && defined(LTC_RC2) +#if defined(LTC_TEST_READDIR) static int password_get(void **p, unsigned long *l, void *u) { LTC_UNUSED_PARAM(u); @@ -476,8 +476,9 @@ int rsa_test(void) #ifdef LTC_TEST_READDIR DO(test_process_dir("tests/rsa", &key, s_rsa_import_x509, NULL, (dir_cleanup_cb)rsa_free, "rsa_test")); #if defined(LTC_MD2) && defined(LTC_MD5) && defined(LTC_RC2) - DO(test_process_dir("tests/rsa-pkcs8", &key, s_rsa_import_pkcs8, NULL, (dir_cleanup_cb)rsa_free, "rsa_pkcs8_test")); + DO(test_process_dir("tests/rsa-pkcs8/old", &key, s_rsa_import_pkcs8, NULL, (dir_cleanup_cb)rsa_free, "rsa_pkcs8_test")); #endif + DO(test_process_dir("tests/rsa-pkcs8", &key, s_rsa_import_pkcs8, NULL, (dir_cleanup_cb)rsa_free, "rsa_pkcs8_test")); #endif DO(s_rsa_cryptx_issue_69());