2 * Copyright 2015-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 #include <openssl/evp.h>
14 * Password based encryption (PBE) table ordering test.
15 * Attempt to look up all supported algorithms.
18 static int test_pbelu(void)
20 int i, failed = 0, ok;
21 int pbe_type, pbe_nid, last_type = -1, last_nid = -1;
23 for (i = 0; EVP_PBE_get(&pbe_type, &pbe_nid, i) != 0; i++) {
24 if (!TEST_true(EVP_PBE_find(pbe_type, pbe_nid, NULL, NULL, 0))) {
25 TEST_info("i=%d, pbe_type=%d, pbe_nid=%d", i, pbe_type, pbe_nid);
34 /* Error: print out whole table */
35 for (i = 0; EVP_PBE_get(&pbe_type, &pbe_nid, i) != 0; i++) {
36 if (pbe_type > last_type)
38 else if (pbe_type < last_type || pbe_nid < last_nid)
44 TEST_info("PBE type=%d %d (%s): %s\n", pbe_type, pbe_nid,
45 OBJ_nid2sn(pbe_nid), ok ? "ERROR" : "OK");
49 return failed ? 0 : 1;
52 void register_tests(void)