OpenSSL 1.1.1-pre2

This commit is contained in:
Hakase
2018-04-07 17:29:40 +09:00
parent 82a44d2483
commit bbac8ca55d
17755 changed files with 221242 additions and 98415 deletions
+23 -20
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
* Copyright 2015-2017 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -8,40 +8,43 @@
*/
#include <openssl/evp.h>
#include <stdio.h>
#include <string.h>
#include "testutil.h"
/*
* Password based encryption (PBE) table ordering test.
* Attempt to look up all supported algorithms.
*/
int main(int argc, char **argv)
static int test_pbelu(void)
{
size_t i;
int rv = 0;
int pbe_type, pbe_nid;
int last_type = -1, last_nid = -1;
int i, failed = 0;
int pbe_type, pbe_nid, last_type = -1, last_nid = -1;
for (i = 0; EVP_PBE_get(&pbe_type, &pbe_nid, i) != 0; i++) {
if (EVP_PBE_find(pbe_type, pbe_nid, NULL, NULL, 0) == 0) {
rv = 1;
if (!TEST_true(EVP_PBE_find(pbe_type, pbe_nid, NULL, NULL, 0))) {
TEST_note("i=%d, pbe_type=%d, pbe_nid=%d", i, pbe_type, pbe_nid);
failed = 1;
break;
}
}
if (rv == 0)
return 0;
if (!failed)
return 1;
/* Error: print out whole table */
for (i = 0; EVP_PBE_get(&pbe_type, &pbe_nid, i) != 0; i++) {
if (pbe_type > last_type)
rv = 0;
else if (pbe_type < last_type || pbe_nid < last_nid)
rv = 1;
else
rv = 0;
fprintf(stderr, "PBE type=%d %d (%s): %s\n", pbe_type, pbe_nid,
OBJ_nid2sn(pbe_nid), rv ? "ERROR" : "OK");
failed = pbe_type < last_type
|| (pbe_type == last_type && pbe_nid < last_nid);
TEST_note("PBE type=%d %d (%s): %s\n", pbe_type, pbe_nid,
OBJ_nid2sn(pbe_nid), failed ? "ERROR" : "OK");
last_type = pbe_type;
last_nid = pbe_nid;
}
return 0;
}
int setup_tests(void)
{
ADD_TEST(test_pbelu);
return 1;
}