Make the verify_extra test location agnostic
Depending on platform, verify_extra_test may fail because it relies on test/ being the current working directory. Make it get all the required files on the command line instead to solve that issue. Reviewed-by: Tim Hudson <tjh@openssl.org>
This commit is contained in:
parent
551a2f26aa
commit
e9daa8150a
@ -432,7 +432,8 @@ test_constant_time: $(CONSTTIMETEST)$(EXE_EXT)
|
|||||||
|
|
||||||
test_verify_extra: $(VERIFYEXTRATEST)$(EXE_EXT)
|
test_verify_extra: $(VERIFYEXTRATEST)$(EXE_EXT)
|
||||||
@echo $(START) $@
|
@echo $(START) $@
|
||||||
../util/shlib_wrap.sh ./$(VERIFYEXTRATEST)
|
../util/shlib_wrap.sh ./$(VERIFYEXTRATEST) \
|
||||||
|
certs/roots.pem certs/untrusted.pem certs/bad.pem
|
||||||
|
|
||||||
test_clienthello: $(CLIENTHELLOTEST)$(EXE_EXT)
|
test_clienthello: $(CLIENTHELLOTEST)$(EXE_EXT)
|
||||||
@echo $(START) $@
|
@echo $(START) $@
|
||||||
|
@ -130,7 +130,9 @@ static STACK_OF(X509) *load_certs_from_file(const char *filename)
|
|||||||
* CA=FALSE, and will therefore incorrectly verify bad
|
* CA=FALSE, and will therefore incorrectly verify bad
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int test_alt_chains_cert_forgery(void)
|
static int test_alt_chains_cert_forgery(const char *roots_f,
|
||||||
|
const char *untrusted_f,
|
||||||
|
const char *bad_f)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int i;
|
int i;
|
||||||
@ -148,12 +150,12 @@ static int test_alt_chains_cert_forgery(void)
|
|||||||
lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
|
lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
|
||||||
if (lookup == NULL)
|
if (lookup == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
if(!X509_LOOKUP_load_file(lookup, "certs/roots.pem", X509_FILETYPE_PEM))
|
if(!X509_LOOKUP_load_file(lookup, roots_f, X509_FILETYPE_PEM))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
untrusted = load_certs_from_file("certs/untrusted.pem");
|
untrusted = load_certs_from_file(untrusted_f);
|
||||||
|
|
||||||
if ((bio = BIO_new_file("certs/bad.pem", "r")) == NULL)
|
if ((bio = BIO_new_file(bad_f, "r")) == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if((x = PEM_read_bio_X509(bio, NULL, 0, NULL)) == NULL)
|
if((x = PEM_read_bio_X509(bio, NULL, 0, NULL)) == NULL)
|
||||||
@ -183,7 +185,7 @@ static int test_alt_chains_cert_forgery(void)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
CRYPTO_malloc_debug_init();
|
CRYPTO_malloc_debug_init();
|
||||||
CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
|
CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
|
||||||
@ -192,7 +194,12 @@ int main(void)
|
|||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
OpenSSL_add_all_digests();
|
OpenSSL_add_all_digests();
|
||||||
|
|
||||||
if (!test_alt_chains_cert_forgery()) {
|
if (argc != 4) {
|
||||||
|
fprintf(stderr, "usage: verify_extra_test roots.pem untrusted.pem bad.pem\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!test_alt_chains_cert_forgery(argv[1], argv[2], argv[3])) {
|
||||||
fprintf(stderr, "Test alt chains cert forgery failed\n");
|
fprintf(stderr, "Test alt chains cert forgery failed\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user