]>
git.ipfire.org Git - thirdparty/openssl.git/blob - test/asn1_internal_test.c
f9fdeefed9742c9f065f8be632005cc32cde8d3d
2 * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
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
10 /* Internal tests for the asn1 module */
15 #include <openssl/asn1.h>
16 #include <openssl/evp.h>
17 #include <openssl/objects.h>
21 /**********************************************************************
23 * Test of a_strnid's tbl_standard
27 #include "../crypto/asn1/tbl_standard.h"
29 static int test_tbl_standard()
31 const ASN1_STRING_TABLE
*tmp
;
35 for (tmp
= tbl_standard
, i
= 0; i
< OSSL_NELEM(tbl_standard
); i
++, tmp
++) {
36 if (tmp
->nid
< last_nid
) {
44 fprintf(stderr
, "asn1 tbl_standard: Table order OK\n");
48 for (tmp
= tbl_standard
, i
= 0; i
< OSSL_NELEM(tbl_standard
); i
++, tmp
++)
49 fprintf(stderr
, "asn1 tbl_standard: Index %" OSSLzu
", NID %d, Name=%s\n",
50 i
, tmp
->nid
, OBJ_nid2ln(tmp
->nid
));
55 /**********************************************************************
57 * Test of ameth_lib's standard_methods
61 #include "internal/asn1_int.h"
62 #include "../crypto/asn1/standard_methods.h"
64 static int test_standard_methods()
66 const EVP_PKEY_ASN1_METHOD
**tmp
;
67 int last_pkey_id
= -1;
70 for (tmp
= standard_methods
, i
= 0; i
< OSSL_NELEM(standard_methods
);
72 if ((*tmp
)->pkey_id
< last_pkey_id
) {
76 last_pkey_id
= (*tmp
)->pkey_id
;
79 if (last_pkey_id
!= 0) {
80 fprintf(stderr
, "asn1 standard methods: Table order OK\n");
84 TEST_error("asn1 standard methods out of order");
85 for (tmp
= standard_methods
, i
= 0; i
< OSSL_NELEM(standard_methods
);
87 fprintf(stderr
, "asn1 standard methods: Index %" OSSLzu
88 ", pkey ID %d, Name=%s\n", i
, (*tmp
)->pkey_id
,
89 OBJ_nid2sn((*tmp
)->pkey_id
));
94 void register_tests(void)
96 ADD_TEST(test_tbl_standard
);
97 ADD_TEST(test_standard_methods
);