summaryrefslogtreecommitdiffstats
path: root/test/evp_test.c
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2015-09-04 13:07:10 -0400
committerRich Salz <rsalz@openssl.org>2015-09-04 14:09:14 -0400
commitb0809bc8ffb34bf89de9e68d8caeb4d8c2aa08f9 (patch)
tree3e1362aa59ccad836c959914db7cbb2fe8e09514 /test/evp_test.c
parenta939b0aab5deb3678308df804d25a340240deee5 (diff)
RT3998: Allow scrypt to be disabled
This does 64-bit division and multiplication, and on 32-bit platforms pulls in libgcc symbols (and MSVC does similar) which may not be available. Mostly done by David Woodhouse. Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
Diffstat (limited to 'test/evp_test.c')
-rw-r--r--test/evp_test.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/test/evp_test.c b/test/evp_test.c
index 90441f36fa..c5c6e07323 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -1311,6 +1311,7 @@ struct pbe_data {
size_t key_len;
};
+#ifndef OPENSSL_NO_SCRYPT
static int scrypt_test_parse(struct evp_test *t,
const char *keyword, const char *value)
{
@@ -1326,6 +1327,7 @@ static int scrypt_test_parse(struct evp_test *t,
return test_uint64(value, &pdata->maxmem);
return 0;
}
+#endif
static int pbkdf2_test_parse(struct evp_test *t,
const char *keyword, const char *value)
@@ -1366,8 +1368,10 @@ static int pbe_test_init(struct evp_test *t, const char *alg)
struct pbe_data *pdat;
int pbe_type = 0;
+#ifndef OPENSSL_NO_SCRYPT
if (strcmp(alg, "scrypt") == 0)
pbe_type = PBE_TYPE_SCRYPT;
+#endif
else if (strcmp(alg, "pbkdf2") == 0)
pbe_type = PBE_TYPE_PBKDF2;
else if (strcmp(alg, "pkcs12") == 0)
@@ -1408,12 +1412,14 @@ static int pbe_test_parse(struct evp_test *t,
return test_bin(value, &pdata->salt, &pdata->salt_len);
if (strcmp(keyword, "Key") == 0)
return test_bin(value, &pdata->key, &pdata->key_len);
- if (pdata->pbe_type == PBE_TYPE_SCRYPT)
- return scrypt_test_parse(t, keyword, value);
- else if (pdata->pbe_type == PBE_TYPE_PBKDF2)
+ if (pdata->pbe_type == PBE_TYPE_PBKDF2)
return pbkdf2_test_parse(t, keyword, value);
else if (pdata->pbe_type == PBE_TYPE_PKCS12)
return pkcs12_test_parse(t, keyword, value);
+#ifndef OPENSSL_NO_SCRYPT
+ else if (pdata->pbe_type == PBE_TYPE_SCRYPT)
+ return scrypt_test_parse(t, keyword, value);
+#endif
return 0;
}
@@ -1433,6 +1439,7 @@ static int pbe_test_run(struct evp_test *t)
pdata->iter, pdata->md,
pdata->key_len, key) == 0)
goto err;
+#ifndef OPENSSL_NO_SCRYPT
} else if (pdata->pbe_type == PBE_TYPE_SCRYPT) {
err = "SCRYPT_ERROR";
if (EVP_PBE_scrypt((const char *)pdata->pass, pdata->pass_len,
@@ -1440,6 +1447,7 @@ static int pbe_test_run(struct evp_test *t)
pdata->N, pdata->r, pdata->p, pdata->maxmem,
key, pdata->key_len) == 0)
goto err;
+#endif
} else if (pdata->pbe_type == PBE_TYPE_PKCS12) {
err = "PKCS12_ERROR";
if (PKCS12_key_gen_uni(pdata->pass, pdata->pass_len,