]> git.ipfire.org Git - thirdparty/openssl.git/blob - test/x509_internal_test.c
Test infrastructure additions.
[thirdparty/openssl.git] / test / x509_internal_test.c
1 /*
2 * Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10 /* Internal tests for the x509 and x509v3 modules */
11
12 #include <stdio.h>
13 #include <string.h>
14
15 #include <openssl/x509.h>
16 #include <openssl/x509v3.h>
17 #include "testutil.h"
18 #include "test_main.h"
19 #include "e_os.h"
20
21 /**********************************************************************
22 *
23 * Test of x509v3
24 *
25 ***/
26
27 #include "../crypto/x509v3/ext_dat.h"
28 #include "../crypto/x509v3/standard_exts.h"
29
30 static int test_standard_exts()
31 {
32 size_t i;
33 int prev = -1, good = 1;
34 const X509V3_EXT_METHOD **tmp;
35
36 tmp = standard_exts;
37 for (i = 0; i < OSSL_NELEM(standard_exts); i++, tmp++) {
38 if ((*tmp)->ext_nid < prev)
39 good = 0;
40 prev = (*tmp)->ext_nid;
41
42 }
43 if (!good) {
44 tmp = standard_exts;
45 TEST_error("Extensions out of order!");
46 for (i = 0; i < STANDARD_EXTENSION_COUNT; i++, tmp++)
47 fprintf(stderr, "%d : %s\n", (*tmp)->ext_nid,
48 OBJ_nid2sn((*tmp)->ext_nid));
49 } else {
50 fprintf(stderr, "Order OK\n");
51 }
52
53 return good;
54 }
55
56 void register_tests()
57 {
58 ADD_TEST(test_standard_exts);
59 }