]>
Commit | Line | Data |
---|---|---|
f12d6273 | 1 | /* |
83cf7abf | 2 | * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved. |
f12d6273 | 3 | * |
909f1a2e | 4 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
f12d6273 RL |
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" | |
176db6dc | 18 | #include "internal/nelem.h" |
f12d6273 | 19 | |
f12d6273 RL |
20 | /********************************************************************** |
21 | * | |
22 | * Test of x509v3 | |
23 | * | |
24 | ***/ | |
25 | ||
878dc8dd RL |
26 | #include "../crypto/x509/ext_dat.h" |
27 | #include "../crypto/x509/standard_exts.h" | |
f12d6273 | 28 | |
5d99881e | 29 | static int test_standard_exts(void) |
f12d6273 RL |
30 | { |
31 | size_t i; | |
32 | int prev = -1, good = 1; | |
33 | const X509V3_EXT_METHOD **tmp; | |
34 | ||
35 | tmp = standard_exts; | |
36 | for (i = 0; i < OSSL_NELEM(standard_exts); i++, tmp++) { | |
37 | if ((*tmp)->ext_nid < prev) | |
38 | good = 0; | |
39 | prev = (*tmp)->ext_nid; | |
40 | ||
41 | } | |
42 | if (!good) { | |
43 | tmp = standard_exts; | |
2fae041d | 44 | TEST_error("Extensions out of order!"); |
f12d6273 | 45 | for (i = 0; i < STANDARD_EXTENSION_COUNT; i++, tmp++) |
8fe3127c | 46 | TEST_note("%d : %s", (*tmp)->ext_nid, OBJ_nid2sn((*tmp)->ext_nid)); |
f12d6273 | 47 | } |
f12d6273 RL |
48 | return good; |
49 | } | |
50 | ||
3cb7c5cf | 51 | int setup_tests(void) |
f12d6273 | 52 | { |
308b876d | 53 | ADD_TEST(test_standard_exts); |
ad887416 | 54 | return 1; |
f12d6273 | 55 | } |