2016-10-27 19:42:45 +00:00
|
|
|
/*
|
2018-05-29 12:07:08 +00:00
|
|
|
* Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
|
2016-10-27 19:42:45 +00:00
|
|
|
*
|
2018-12-06 12:05:25 +00:00
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
2016-10-27 19:42:45 +00:00
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Internal tests for the x509 and x509v3 modules */
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <openssl/x509.h>
|
|
|
|
#include <openssl/x509v3.h>
|
|
|
|
#include "testutil.h"
|
2017-08-22 12:35:43 +00:00
|
|
|
#include "internal/nelem.h"
|
2016-10-27 19:42:45 +00:00
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
*
|
|
|
|
* Test of x509v3
|
|
|
|
*
|
|
|
|
***/
|
|
|
|
|
|
|
|
#include "../crypto/x509v3/ext_dat.h"
|
|
|
|
#include "../crypto/x509v3/standard_exts.h"
|
|
|
|
|
2017-11-16 21:45:05 +00:00
|
|
|
static int test_standard_exts(void)
|
2016-10-27 19:42:45 +00:00
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
int prev = -1, good = 1;
|
|
|
|
const X509V3_EXT_METHOD **tmp;
|
|
|
|
|
|
|
|
tmp = standard_exts;
|
|
|
|
for (i = 0; i < OSSL_NELEM(standard_exts); i++, tmp++) {
|
|
|
|
if ((*tmp)->ext_nid < prev)
|
|
|
|
good = 0;
|
|
|
|
prev = (*tmp)->ext_nid;
|
|
|
|
|
|
|
|
}
|
|
|
|
if (!good) {
|
|
|
|
tmp = standard_exts;
|
2017-03-22 04:27:55 +00:00
|
|
|
TEST_error("Extensions out of order!");
|
2016-10-27 19:42:45 +00:00
|
|
|
for (i = 0; i < STANDARD_EXTENSION_COUNT; i++, tmp++)
|
2017-06-19 01:21:22 +00:00
|
|
|
TEST_note("%d : %s", (*tmp)->ext_nid, OBJ_nid2sn((*tmp)->ext_nid));
|
2016-10-27 19:42:45 +00:00
|
|
|
}
|
|
|
|
return good;
|
|
|
|
}
|
|
|
|
|
2018-05-09 15:09:50 +00:00
|
|
|
int setup_tests(void)
|
2016-10-27 19:42:45 +00:00
|
|
|
{
|
2016-11-03 16:15:41 +00:00
|
|
|
ADD_TEST(test_standard_exts);
|
2017-07-18 01:48:27 +00:00
|
|
|
return 1;
|
2016-10-27 19:42:45 +00:00
|
|
|
}
|