Update CMakeLists.txt

both CMakeLists.txt and source use ENABLE_XXX
This commit is contained in:
Zhi Guan
2023-12-17 16:33:51 +08:00
parent 2c988b008b
commit 04cbd81651
15 changed files with 85 additions and 91 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
* Copyright 2014-2023 The GmSSL Project. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the License); you may
* not use this file except in compliance with the License.
@@ -15,17 +15,18 @@
#include <gmssl/digest.h>
const char *digests[] = {
#ifdef ENABLE_BROKEN_CRYPTO
"md5",
"sm3",
#ifdef ENABLE_SHA1
"sha1",
#endif
"sm3",
#ifdef ENABLE_SHA2
"sha224",
"sha256",
"sha384",
"sha512",
"sha512-224",
"sha512-256",
#endif
};
int main(void)

View File

@@ -37,7 +37,7 @@
int main(void)
{
// currently we only has SHA-1 test suites
#ifdef ENABLE_BROKEN_CRYPTO
#ifdef ENABLE_SHA1
HASH_DRBG drbg;
uint8_t entropy[sizeof(EntropyInput)/2];
@@ -89,6 +89,6 @@ int main(void)
printf("%02x", out[i]);
}
printf("\n");
#endif
#endif // ENABLE_SHA1
return 0;
}

View File

@@ -24,6 +24,7 @@ static struct {
char *prk;
char *okm;
} hkdf_tests[] = {
#ifdef ENABLE_SHA2 // FIXME: add SM3 test suites, if neither SHA1, SHA2 enabled, build failure
{
// test 1
"sha256",
@@ -78,7 +79,9 @@ static struct {
"b8a11f5c5ee1879ec3454e5f3c738d2d"
"9d201395faa4b61a96c8",
},
#ifdef ENABLE_BROKEN_CRYPTO
#endif // ENABLE_SHA2
#ifdef ENABLE_SHA1
{
// test 4
"sha1",
@@ -142,7 +145,7 @@ static struct {
"b3bae548aa53d423b0d1f27ebba6f5e5"
"673a081d70cce7acfc48",
},
#endif
#endif // ENABLE_SHA1
};
int test_hkdf(void)

View File

@@ -102,7 +102,7 @@ void test(void)
static int test_pbkdf2_genkey(void)
{
// FIXME: currently we only has SHA-1 tests, replace with SHA-256
#ifdef ENABLE_BROKEN_CRYPTO
#ifdef ENABLE_SHA1
int i;
uint8_t key[64];
uint8_t buf[64];