Latest update

This commit is contained in:
2019-07-13 19:13:22 +09:00
parent 9a23f88dc2
commit 2e57f602ae
542 changed files with 17287 additions and 6184 deletions
+53 -3
View File
@@ -14,6 +14,7 @@
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <openssl/err.h>
#include <openssl/provider.h>
#include <openssl/x509v3.h>
#include <openssl/pkcs12.h>
#include <openssl/kdf.h>
@@ -75,6 +76,9 @@ static int find_key(EVP_PKEY **ppk, const char *name, KEY_LIST *lst);
static int parse_bin(const char *value, unsigned char **buf, size_t *buflen);
static OSSL_PROVIDER *defltprov = NULL;
static OSSL_PROVIDER *legacyprov = NULL;
/*
* Compare two memory regions for equality, returning zero if they differ.
* However, if there is expected to be an error and the actual error
@@ -370,6 +374,11 @@ static int digest_test_parse(EVP_TEST *t,
return evp_test_buffer_set_count(value, mdata->input);
if (strcmp(keyword, "Ncopy") == 0)
return evp_test_buffer_ncopy(value, mdata->input);
if (strcmp(keyword, "Legacy") == 0) {
if (legacyprov == NULL)
t->skip = 1;
return 1;
}
return 0;
}
@@ -652,6 +661,14 @@ static int cipher_test_enc(EVP_TEST *t, int enc,
t->err = "KEY_SET_ERROR";
goto err;
}
/* Check that we get the same IV back */
if (expected->iv != NULL
&& (EVP_CIPHER_flags(expected->cipher) & EVP_CIPH_CUSTOM_IV) == 0
&& !TEST_mem_eq(expected->iv, expected->iv_len,
EVP_CIPHER_CTX_iv(ctx), expected->iv_len)) {
t->err = "INVALID_IV";
goto err;
}
if (expected->aead == EVP_CIPH_CCM_MODE) {
if (!EVP_CipherUpdate(ctx, NULL, &tmplen, NULL, out_len)) {
@@ -1956,7 +1973,14 @@ static int kdf_test_init(EVP_TEST *t, const char *name)
t->skip = 1;
return 1;
}
#endif
#endif /* OPENSSL_NO_SCRYPT */
#ifdef OPENSSL_NO_CMS
if (strcmp(name, "X942KDF") == 0) {
t->skip = 1;
return 1;
}
#endif /* OPENSSL_NO_CMS */
kdf = EVP_get_kdfbyname(name);
if (kdf == NULL)
@@ -2088,7 +2112,14 @@ static int pkey_kdf_test_init(EVP_TEST *t, const char *name)
t->skip = 1;
return 1;
}
#endif
#endif /* OPENSSL_NO_SCRYPT */
#ifdef OPENSSL_NO_CMS
if (strcmp(name, "X942KDF") == 0) {
t->skip = 1;
return 1;
}
#endif /* OPENSSL_NO_CMS */
if (kdf_nid == NID_undef)
kdf_nid = OBJ_ln2nid(name);
@@ -3053,8 +3084,10 @@ static int run_file_tests(int i)
while (!BIO_eof(t->s.fp)) {
c = parse(t);
if (t->skip)
if (t->skip) {
t->s.numskip++;
continue;
}
if (c == 0 || !run_test(t)) {
t->s.errors++;
break;
@@ -3080,6 +3113,23 @@ int setup_tests(void)
if (n == 0)
return 0;
defltprov = OSSL_PROVIDER_load(NULL, "default");
if (!TEST_ptr(defltprov))
return 0;
#ifndef NO_LEGACY_MODULE
legacyprov = OSSL_PROVIDER_load(NULL, "legacy");
if (!TEST_ptr(legacyprov)) {
OSSL_PROVIDER_unload(defltprov);
return 0;
}
#endif /* NO_LEGACY_MODULE */
ADD_ALL_TESTS(run_file_tests, n);
return 1;
}
void cleanup_tests(void)
{
OSSL_PROVIDER_unload(legacyprov);
OSSL_PROVIDER_unload(defltprov);
}