]> git.ipfire.org Git - thirdparty/openssl.git/blame - test/pkey_meth_test.c
Remove bsd_cryptodev engine
[thirdparty/openssl.git] / test / pkey_meth_test.c
CommitLineData
52fe14e6
DSH
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 EVP_PKEY method ordering */
11
12#include <stdio.h>
13#include <string.h>
14
15#include <openssl/evp.h>
16#include "testutil.h"
52fe14e6
DSH
17
18/**********************************************************************
19 *
20 * Test of EVP_PKEY_ASN1 method ordering
21 *
22 ***/
23
24static int test_asn1_meths()
25{
26 int i;
27 int prev = -1;
28 int good = 1;
29 int pkey_id;
30 const EVP_PKEY_ASN1_METHOD *ameth;
31
32 for (i = 0; i < EVP_PKEY_asn1_get_count(); i++) {
33 ameth = EVP_PKEY_asn1_get0(i);
34 EVP_PKEY_asn1_get0_info(&pkey_id, NULL, NULL, NULL, NULL, ameth);
35 if (pkey_id < prev)
36 good = 0;
37 prev = pkey_id;
38
39 }
40 if (!good) {
2fae041d 41 TEST_error("EVP_PKEY_ASN1_METHOD table out of order");
52fe14e6
DSH
42 for (i = 0; i < EVP_PKEY_asn1_get_count(); i++) {
43 const char *info;
44
45 ameth = EVP_PKEY_asn1_get0(i);
46 EVP_PKEY_asn1_get0_info(&pkey_id, NULL, NULL, &info, NULL, ameth);
47 if (info == NULL)
48 info = "<NO NAME>";
49 fprintf(stderr, "%d : %s : %s\n", pkey_id, OBJ_nid2ln(pkey_id),
50 info);
51 }
52 } else {
53 fprintf(stderr, "Order OK\n");
54 }
55
56 return good;
57}
58
59void register_tests()
60{
61 ADD_TEST(test_asn1_meths);
62}