VirtualBox

source: vbox/trunk/src/libs/openssl-3.0.7/test/pbelutest.c@ 97673

最後變更 在這個檔案從97673是 94320,由 vboxsync 提交於 3 年 前

libs/openssl-3.0.1: Export to OSE and fix copyright headers in Makefiles, bugref:10128

檔案大小: 1.4 KB
 
1/*
2 * Copyright 2015-2017 The OpenSSL Project Authors. All Rights Reserved.
3 *
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
8 */
9
10#include <openssl/evp.h>
11#include "testutil.h"
12
13/*
14 * Password based encryption (PBE) table ordering test.
15 * Attempt to look up all supported algorithms.
16 */
17
18static int test_pbelu(void)
19{
20 int i, failed = 0;
21 int pbe_type, pbe_nid, last_type = -1, last_nid = -1;
22
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_note("i=%d, pbe_type=%d, pbe_nid=%d", i, pbe_type, pbe_nid);
26 failed = 1;
27 break;
28 }
29 }
30
31 if (!failed)
32 return 1;
33
34 /* Error: print out whole table */
35 for (i = 0; EVP_PBE_get(&pbe_type, &pbe_nid, i) != 0; i++) {
36 failed = pbe_type < last_type
37 || (pbe_type == last_type && pbe_nid < last_nid);
38 TEST_note("PBE type=%d %d (%s): %s\n", pbe_type, pbe_nid,
39 OBJ_nid2sn(pbe_nid), failed ? "ERROR" : "OK");
40 last_type = pbe_type;
41 last_nid = pbe_nid;
42 }
43 return 0;
44}
45
46int setup_tests(void)
47{
48 ADD_TEST(test_pbelu);
49 return 1;
50}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette