]>
git.ipfire.org Git - thirdparty/openssl.git/blob - test/pkey_meth_test.c
2 * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (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 EVP_PKEY method ordering */
15 #include <openssl/evp.h>
18 /* Test of EVP_PKEY_ASN1_METHOD ordering */
19 static int test_asn1_meths(void)
25 const EVP_PKEY_ASN1_METHOD
*ameth
;
27 for (i
= 0; i
< EVP_PKEY_asn1_get_count(); i
++) {
28 ameth
= EVP_PKEY_asn1_get0(i
);
29 EVP_PKEY_asn1_get0_info(&pkey_id
, NULL
, NULL
, NULL
, NULL
, ameth
);
36 TEST_error("EVP_PKEY_ASN1_METHOD table out of order");
37 for (i
= 0; i
< EVP_PKEY_asn1_get_count(); i
++) {
40 ameth
= EVP_PKEY_asn1_get0(i
);
41 EVP_PKEY_asn1_get0_info(&pkey_id
, NULL
, NULL
, &info
, NULL
, ameth
);
44 TEST_note("%d : %s : %s", pkey_id
, OBJ_nid2ln(pkey_id
), info
);
50 /* Test of EVP_PKEY_METHOD ordering */
51 static int test_pkey_meths(void)
57 const EVP_PKEY_METHOD
*pmeth
;
59 for (i
= 0; i
< EVP_PKEY_meth_get_count(); i
++) {
60 pmeth
= EVP_PKEY_meth_get0(i
);
61 EVP_PKEY_meth_get0_info(&pkey_id
, NULL
, pmeth
);
68 TEST_error("EVP_PKEY_METHOD table out of order");
69 for (i
= 0; i
< EVP_PKEY_meth_get_count(); i
++) {
70 pmeth
= EVP_PKEY_meth_get0(i
);
71 EVP_PKEY_meth_get0_info(&pkey_id
, NULL
, pmeth
);
72 TEST_note("%d : %s", pkey_id
, OBJ_nid2ln(pkey_id
));
80 ADD_TEST(test_asn1_meths
);
81 ADD_TEST(test_pkey_meths
);