OpenSSL 1.1.1-pre2
This commit is contained in:
+21
-16
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
* Copyright 2016-2017 The OpenSSL Project Authors. 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
|
||||
@@ -13,30 +13,35 @@
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
int main(int ac, char **av)
|
||||
#include "testutil.h"
|
||||
|
||||
static const char *infile;
|
||||
|
||||
static int test_pathlen(void)
|
||||
{
|
||||
X509 *x = NULL;
|
||||
BIO *b = NULL;
|
||||
long pathlen;
|
||||
int ret = 1;
|
||||
int ret = 0;
|
||||
|
||||
if (ac != 2) {
|
||||
fprintf(stderr, "Usage error\n");
|
||||
if (!TEST_ptr(b = BIO_new_file(infile, "r"))
|
||||
|| !TEST_ptr(x = PEM_read_bio_X509(b, NULL, NULL, NULL))
|
||||
|| !TEST_int_eq(pathlen = X509_get_pathlen(x), 6))
|
||||
goto end;
|
||||
}
|
||||
b = BIO_new_file(av[1], "r");
|
||||
if (b == NULL)
|
||||
goto end;
|
||||
x = PEM_read_bio_X509(b, NULL, NULL, NULL);
|
||||
if (x == NULL)
|
||||
goto end;
|
||||
pathlen = X509_get_pathlen(x);
|
||||
if (pathlen == 6)
|
||||
ret = 0;
|
||||
|
||||
ret = 1;
|
||||
|
||||
end:
|
||||
ERR_print_errors_fp(stderr);
|
||||
BIO_free(b);
|
||||
X509_free(x);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int setup_tests(void)
|
||||
{
|
||||
if (!TEST_ptr(infile = test_get_argument(0)))
|
||||
return 0;
|
||||
|
||||
ADD_TEST(test_pathlen);
|
||||
return 1;
|
||||
}
|
||||
Reference in New Issue
Block a user