a33a63a79584e3698bfc98735435216e37f49d56
[openssl.git] / crypto / x509v3 / tabtest.c
1 /*
2  * Copyright 1999-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 /*
11  * Simple program to check the ext_dat.h is correct and print out problems if
12  * it is not.
13  */
14
15 #include <stdio.h>
16
17 #include <openssl/x509v3.h>
18
19 #include "ext_dat.h"
20
21 main()
22 {
23     int i, prev = -1, bad = 0;
24     X509V3_EXT_METHOD **tmp;
25     i = OSSL_NELEM(standard_exts);
26     if (i != STANDARD_EXTENSION_COUNT)
27         fprintf(stderr, "Extension number invalid expecting %d\n", i);
28     tmp = standard_exts;
29     for (i = 0; i < STANDARD_EXTENSION_COUNT; i++, tmp++) {
30         if ((*tmp)->ext_nid < prev)
31             bad = 1;
32         prev = (*tmp)->ext_nid;
33
34     }
35     if (bad) {
36         tmp = standard_exts;
37         fprintf(stderr, "Extensions out of order!\n");
38         for (i = 0; i < STANDARD_EXTENSION_COUNT; i++, tmp++)
39             printf("%d : %s\n", (*tmp)->ext_nid, OBJ_nid2sn((*tmp)->ext_nid));
40     } else
41         fprintf(stderr, "Order OK\n");
42 }