Latest update.
This commit is contained in:
+11
-7
@@ -32,9 +32,8 @@ IF[{- !$disabled{tests} -}]
|
||||
versions \
|
||||
aborttest test_test \
|
||||
sanitytest rsa_complex exdatatest bntest \
|
||||
ectest ecstresstest ecdsatest gmdifftest pbelutest ideatest \
|
||||
ectest ecstresstest ecdsatest gmdifftest pbelutest \
|
||||
hmactest \
|
||||
rc2test rc4test rc5test \
|
||||
destest mdc2test \
|
||||
dhtest enginetest \
|
||||
ssltest_old dsatest dsa_no_digest_size_test exptest rsa_test \
|
||||
@@ -111,10 +110,6 @@ IF[{- !$disabled{tests} -}]
|
||||
INCLUDE[pbelutest]=../include ../apps/include
|
||||
DEPEND[pbelutest]=../libcrypto libtestutil.a
|
||||
|
||||
SOURCE[ideatest]=ideatest.c
|
||||
INCLUDE[ideatest]=../include ../apps/include
|
||||
DEPEND[ideatest]=../libcrypto libtestutil.a
|
||||
|
||||
SOURCE[hmactest]=hmactest.c
|
||||
INCLUDE[hmactest]=../include ../apps/include
|
||||
DEPEND[hmactest]=../libcrypto libtestutil.a
|
||||
@@ -506,8 +501,9 @@ IF[{- !$disabled{tests} -}]
|
||||
IF[1]
|
||||
PROGRAMS{noinst}=asn1_internal_test modes_internal_test x509_internal_test \
|
||||
tls13encryptiontest wpackettest ctype_internal_test \
|
||||
rdrand_sanitytest property_test \
|
||||
rdrand_sanitytest property_test ideatest \
|
||||
rsa_sp800_56b_test bn_internal_test \
|
||||
rc2test rc4test rc5test \
|
||||
asn1_dsa_internal_test
|
||||
|
||||
IF[{- !$disabled{poly1305} -}]
|
||||
@@ -553,6 +549,10 @@ IF[{- !$disabled{tests} -}]
|
||||
INCLUDE[tls13encryptiontest]=.. ../include ../apps/include
|
||||
DEPEND[tls13encryptiontest]=../libcrypto ../libssl.a libtestutil.a
|
||||
|
||||
SOURCE[ideatest]=ideatest.c
|
||||
INCLUDE[ideatest]=../include ../apps/include
|
||||
DEPEND[ideatest]=../libcrypto.a libtestutil.a
|
||||
|
||||
SOURCE[wpackettest]=wpackettest.c
|
||||
INCLUDE[wpackettest]=../include ../apps/include
|
||||
DEPEND[wpackettest]=../libcrypto ../libssl.a libtestutil.a
|
||||
@@ -601,6 +601,10 @@ IF[{- !$disabled{tests} -}]
|
||||
INCLUDE[curve448_internal_test]=.. ../include ../apps/include ../crypto/ec/curve448
|
||||
DEPEND[curve448_internal_test]=../libcrypto.a libtestutil.a
|
||||
|
||||
SOURCE[rc4test]=rc4test.c
|
||||
INCLUDE[rc4test]=../include ../apps/include
|
||||
DEPEND[rc4test]=../libcrypto.a libtestutil.a
|
||||
|
||||
SOURCE[rdrand_sanitytest]=rdrand_sanitytest.c
|
||||
INCLUDE[rdrand_sanitytest]=../include ../apps/include
|
||||
DEPEND[rdrand_sanitytest]=../libcrypto.a libtestutil.a
|
||||
|
||||
@@ -582,10 +582,7 @@ static int test_EVP_DigestSignInit(int tst)
|
||||
|
||||
/* Determine the size of the signature. */
|
||||
if (!TEST_true(EVP_DigestSignFinal(md_ctx, NULL, &sig_len))
|
||||
|| !TEST_size_t_le(sig_len, (size_t)EVP_PKEY_size(pkey)))
|
||||
goto out;
|
||||
|
||||
if (!TEST_ptr(sig = OPENSSL_malloc(sig_len))
|
||||
|| !TEST_ptr(sig = OPENSSL_malloc(sig_len))
|
||||
|| !TEST_true(EVP_DigestSignFinal(md_ctx, sig, &sig_len)))
|
||||
goto out;
|
||||
|
||||
@@ -919,9 +916,6 @@ static int test_EVP_SM2(void)
|
||||
if (!TEST_true(EVP_DigestSignFinal(md_ctx, NULL, &sig_len)))
|
||||
goto done;
|
||||
|
||||
if (!TEST_size_t_eq(sig_len, (size_t)EVP_PKEY_size(pkey)))
|
||||
goto done;
|
||||
|
||||
if (!TEST_ptr(sig = OPENSSL_malloc(sig_len)))
|
||||
goto done;
|
||||
|
||||
|
||||
@@ -7,6 +7,13 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* SHA256 low level APIs are deprecated for public use, but still ok for
|
||||
* internal use. Note, that due to symbols not being exported, only the
|
||||
* #defines can be accessed. In this case SHA256_CBLOCK.
|
||||
*/
|
||||
#include "internal/deprecated.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/evp.h>
|
||||
|
||||
@@ -331,6 +331,8 @@ typedef struct digest_data_st {
|
||||
/* Expected output */
|
||||
unsigned char *output;
|
||||
size_t output_len;
|
||||
/* Padding type */
|
||||
int pad_type;
|
||||
} DIGEST_DATA;
|
||||
|
||||
static int digest_test_init(EVP_TEST *t, const char *alg)
|
||||
@@ -353,6 +355,7 @@ static int digest_test_init(EVP_TEST *t, const char *alg)
|
||||
t->data = mdat;
|
||||
mdat->digest = digest;
|
||||
mdat->fetched_digest = fetched_digest;
|
||||
mdat->pad_type = 0;
|
||||
if (fetched_digest != NULL)
|
||||
TEST_info("%s is fetched", alg);
|
||||
return 1;
|
||||
@@ -380,6 +383,8 @@ static int digest_test_parse(EVP_TEST *t,
|
||||
return evp_test_buffer_set_count(value, mdata->input);
|
||||
if (strcmp(keyword, "Ncopy") == 0)
|
||||
return evp_test_buffer_ncopy(value, mdata->input);
|
||||
if (strcmp(keyword, "Padding") == 0)
|
||||
return (mdata->pad_type = atoi(value)) > 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -394,6 +399,7 @@ static int digest_test_run(EVP_TEST *t)
|
||||
EVP_MD_CTX *mctx;
|
||||
unsigned char *got = NULL;
|
||||
unsigned int got_len;
|
||||
OSSL_PARAM params[2];
|
||||
|
||||
t->err = "TEST_FAILURE";
|
||||
if (!TEST_ptr(mctx = EVP_MD_CTX_new()))
|
||||
@@ -408,6 +414,15 @@ static int digest_test_run(EVP_TEST *t)
|
||||
t->err = "DIGESTINIT_ERROR";
|
||||
goto err;
|
||||
}
|
||||
if (expected->pad_type > 0) {
|
||||
params[0] = OSSL_PARAM_construct_int(OSSL_DIGEST_PARAM_PAD_TYPE,
|
||||
&expected->pad_type);
|
||||
params[1] = OSSL_PARAM_construct_end();
|
||||
if (!TEST_int_gt(EVP_MD_CTX_set_params(mctx, params), 0)) {
|
||||
t->err = "PARAMS_ERROR";
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
if (!evp_test_buffer_do(expected->input, digest_update_fn, mctx)) {
|
||||
t->err = "DIGESTUPDATE_ERROR";
|
||||
goto err;
|
||||
|
||||
@@ -7,6 +7,13 @@
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* IDEA low level APIs are deprecated for public use, but still ok for internal
|
||||
* use where we're using them to implement the higher level EVP interface, as is
|
||||
* the case here.
|
||||
*/
|
||||
#include "internal/deprecated.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "internal/nelem.h"
|
||||
|
||||
+17
-2
@@ -196,6 +196,8 @@ static int template_static_params_test(int n)
|
||||
OSSL_PARAM_BLD bld;
|
||||
OSSL_PARAM params[20], *p;
|
||||
BIGNUM *bn = NULL, *bn_r = NULL;
|
||||
BIGNUM *bn0 = NULL, *bn0_r = NULL;
|
||||
const size_t bn_bytes = 200;
|
||||
unsigned int i;
|
||||
char *utf = NULL;
|
||||
int res = 0;
|
||||
@@ -204,7 +206,11 @@ static int template_static_params_test(int n)
|
||||
if (!TEST_true(ossl_param_bld_push_uint(&bld, "i", 6))
|
||||
|| !TEST_ptr(bn = (n & 1) == 0 ? BN_new() : BN_secure_new())
|
||||
|| !TEST_true(BN_set_word(bn, 1337))
|
||||
|| !TEST_true(ossl_param_bld_push_BN(&bld, "bn", bn))
|
||||
|| !TEST_false(ossl_param_bld_push_BN_pad(&bld, "bn", bn, 0))
|
||||
|| !TEST_false(ossl_param_bld_push_BN_pad(&bld, "bn", bn, 1))
|
||||
|| !TEST_true(ossl_param_bld_push_BN_pad(&bld, "bn", bn, bn_bytes))
|
||||
|| !TEST_ptr(bn0 = BN_new())
|
||||
|| !TEST_true(ossl_param_bld_push_BN_pad(&bld, "bn0", bn0, 0))
|
||||
|| !TEST_true(ossl_param_bld_push_utf8_string(&bld, "utf8_s", "bar",
|
||||
0))
|
||||
|| !TEST_ptr(ossl_param_bld_to_param_ex(&bld, params,
|
||||
@@ -223,8 +229,15 @@ static int template_static_params_test(int n)
|
||||
|| !TEST_true(OSSL_PARAM_get_BN(p, &bn_r))
|
||||
|| !TEST_str_eq(p->key, "bn")
|
||||
|| !TEST_uint_eq(p->data_type, OSSL_PARAM_UNSIGNED_INTEGER)
|
||||
|| !TEST_size_t_le(p->data_size, sizeof(BN_ULONG))
|
||||
|| !TEST_size_t_eq(p->data_size, bn_bytes)
|
||||
|| !TEST_uint_eq((unsigned int)BN_get_word(bn_r), 1337)
|
||||
/* Check BIGNUM zero */
|
||||
|| !TEST_ptr(p = OSSL_PARAM_locate(params, "bn0"))
|
||||
|| !TEST_true(OSSL_PARAM_get_BN(p, &bn0_r))
|
||||
|| !TEST_str_eq(p->key, "bn0")
|
||||
|| !TEST_uint_eq(p->data_type, OSSL_PARAM_UNSIGNED_INTEGER)
|
||||
|| !TEST_size_t_eq(p->data_size, 0)
|
||||
|| !TEST_uint_eq((unsigned int)BN_get_word(bn0_r), 0)
|
||||
/* Check UTF8 string */
|
||||
|| !TEST_ptr(p = OSSL_PARAM_locate(params, "utf8_s"))
|
||||
|| !TEST_str_eq(p->data, "bar")
|
||||
@@ -236,6 +249,8 @@ err:
|
||||
OPENSSL_free(utf);
|
||||
BN_free(bn);
|
||||
BN_free(bn_r);
|
||||
BN_free(bn0);
|
||||
BN_free(bn0_r);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -8,8 +8,8 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* RC4 low level APIs are deprecated for public use, but still ok for internal
|
||||
* use.
|
||||
* RC4 and SHA-1 low level APIs are deprecated for public use, but still ok for
|
||||
* internal use.
|
||||
*/
|
||||
#include "internal/deprecated.h"
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#! /usr/bin/env perl
|
||||
# Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
# this file except in compliance with the License. You can obtain a copy
|
||||
# in the file LICENSE in the source distribution or at
|
||||
# https://www.openssl.org/source/license.html
|
||||
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use OpenSSL::Test qw/:DEFAULT bldtop_dir/;
|
||||
use OpenSSL::Test::Utils;
|
||||
|
||||
setup("test_mdc2");
|
||||
|
||||
if (disabled("mdc2") || disabled("legacy")) {
|
||||
plan skip_all => "mdc2 is not supported by this OpenSSL build";
|
||||
}
|
||||
|
||||
plan tests => 1;
|
||||
|
||||
ok(run(test(["mdc2test"])), "running mdc2test");
|
||||
@@ -70,6 +70,9 @@ push @defltfiles, @bffiles unless disabled("bf");
|
||||
my @bffiles = qw( evpmd_md2.txt );
|
||||
push @defltfiles, @bffiles unless disabled("md2");
|
||||
|
||||
my @bffiles = qw( evpmd_mdc2.txt );
|
||||
push @defltfiles, @bffiles unless disabled("mdc2");
|
||||
|
||||
plan tests =>
|
||||
($no_fips ? 0 : 1) # FIPS install test
|
||||
+ (scalar(@configs) * scalar(@files))
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#
|
||||
# Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License 2.0 (the "License"). You may not use
|
||||
# this file except in compliance with the License. You can obtain a copy
|
||||
# in the file LICENSE in the source distribution or at
|
||||
# https://www.openssl.org/source/license.html
|
||||
|
||||
|
||||
Title = MDC2 test vectors
|
||||
|
||||
Digest = MDC2
|
||||
Availablein = default
|
||||
Input = "Now is the time for all "
|
||||
Output = 42e50cd224baceba760bdd2bd409281a
|
||||
|
||||
Digest = MDC2
|
||||
Availablein = default
|
||||
Padding = 1
|
||||
Input = "Now is the time for all "
|
||||
Output = 42e50cd224baceba760bdd2bd409281a
|
||||
|
||||
Digest = MDC2
|
||||
Availablein = default
|
||||
Padding = 2
|
||||
Input = "Now is the time for all "
|
||||
Output = 2e4679b5add9ca7535d87afeab33bee2
|
||||
Reference in New Issue
Block a user