summaryrefslogtreecommitdiff
path: root/deps/openssl/openssl/test/x509_dup_cert_test.c
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2018-11-22 10:39:20 -0800
committerSam Roberts <vieuxtech@gmail.com>2019-01-22 13:32:34 -0800
commit4231ad04f0b2aee5bda6be94715d4b70badaac8b (patch)
tree19f189fae6828708ebd37e466ce4a7716494b96a /deps/openssl/openssl/test/x509_dup_cert_test.c
parent5d80f9ea6091847176fa47fb1395fdffc4af9164 (diff)
downloadandroid-node-v8-4231ad04f0b2aee5bda6be94715d4b70badaac8b.tar.gz
android-node-v8-4231ad04f0b2aee5bda6be94715d4b70badaac8b.tar.bz2
android-node-v8-4231ad04f0b2aee5bda6be94715d4b70badaac8b.zip
deps: upgrade openssl sources to 1.1.1a
This updates all sources in deps/openssl/openssl with openssl-1.1.1a. PR-URL: https://github.com/nodejs/node/pull/25381 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Shigeki Ohtsu <ohtsu@ohtsu.org>
Diffstat (limited to 'deps/openssl/openssl/test/x509_dup_cert_test.c')
-rw-r--r--deps/openssl/openssl/test/x509_dup_cert_test.c59
1 files changed, 18 insertions, 41 deletions
diff --git a/deps/openssl/openssl/test/x509_dup_cert_test.c b/deps/openssl/openssl/test/x509_dup_cert_test.c
index 7f7adebbb0..e639c01945 100644
--- a/deps/openssl/openssl/test/x509_dup_cert_test.c
+++ b/deps/openssl/openssl/test/x509_dup_cert_test.c
@@ -1,5 +1,6 @@
/*
- * Copyright 2017-2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -7,64 +8,40 @@
* https://www.openssl.org/source/license.html
*/
-/* ====================================================================
- * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
- */
-
#include <stdio.h>
#include <openssl/err.h>
#include <openssl/x509_vfy.h>
-static int test_509_dup_cert(const char *cert_f)
+#include "testutil.h"
+
+static int test_509_dup_cert(int n)
{
int ret = 0;
X509_STORE_CTX *sctx = NULL;
X509_STORE *store = NULL;
X509_LOOKUP *lookup = NULL;
+ const char *cert_f = test_get_argument(n);
- store = X509_STORE_new();
- if (store == NULL)
- goto err;
-
- lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file());
- if (lookup == NULL)
- goto err;
-
- if (!X509_load_cert_file(lookup, cert_f, X509_FILETYPE_PEM))
- goto err;
- if (!X509_load_cert_file(lookup, cert_f, X509_FILETYPE_PEM))
- goto err;
+ if (TEST_ptr(store = X509_STORE_new())
+ && TEST_ptr(lookup = X509_STORE_add_lookup(store, X509_LOOKUP_file()))
+ && TEST_true(X509_load_cert_file(lookup, cert_f, X509_FILETYPE_PEM))
+ && TEST_true(X509_load_cert_file(lookup, cert_f, X509_FILETYPE_PEM)))
+ ret = 1;
- ret = 1;
-
- err:
X509_STORE_CTX_free(sctx);
X509_STORE_free(store);
- if (ret != 1)
- ERR_print_errors_fp(stderr);
return ret;
}
-int main(int argc, char **argv)
+int setup_tests(void)
{
- CRYPTO_set_mem_debug(1);
- CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
-
- if (argc != 2) {
- fprintf(stderr, "usage: x509_dup_cert_test cert.pem\n");
- return 1;
- }
+ size_t n = test_get_argument_count();
- if (!test_509_dup_cert(argv[1])) {
- fprintf(stderr, "Test X509 duplicate cert failed\n");
- return 1;
+ if (!TEST_int_gt(n, 0)) {
+ TEST_note("usage: x509_dup_cert_test cert.pem...");
+ return 0;
}
-#ifndef OPENSSL_NO_CRYPTO_MDEBUG
- if (CRYPTO_mem_leaks_fp(stderr) <= 0)
- return 1;
-#endif
-
- printf("PASS\n");
- return 0;
+ ADD_ALL_TESTS(test_509_dup_cert, n);
+ return 1;
}