tests: Fix build without CONFIG_ERP=y

hmac_sha256_kdf() got pulled in only if CONFIG_ERP=y is set. Fix
test_sha256() by making the test case conditional on the function being
present.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-10-26 00:42:14 +02:00
parent 1248e58492
commit 8f3ea3175f
3 changed files with 4 additions and 0 deletions

View file

@ -1576,6 +1576,7 @@ static int test_sha256(void)
key = os_malloc(8161); key = os_malloc(8161);
if (key) { if (key) {
#ifdef CONFIG_HMAC_SHA256_KDF
int res; int res;
res = hmac_sha256_kdf((u8 *) "secret", 6, "label", res = hmac_sha256_kdf((u8 *) "secret", 6, "label",
@ -1593,6 +1594,7 @@ static int test_sha256(void)
"Unexpected hmac_sha256_kdf(outlen=8161) success"); "Unexpected hmac_sha256_kdf(outlen=8161) success");
errors++; errors++;
} }
#endif /* CONFIG_HMAC_SHA256_KDF */
os_free(key); os_free(key);
} }

View file

@ -1277,6 +1277,7 @@ ifdef NEED_TLS_PRF_SHA256
SHA256OBJS += src/crypto/sha256-tlsprf.c SHA256OBJS += src/crypto/sha256-tlsprf.c
endif endif
ifdef NEED_HMAC_SHA256_KDF ifdef NEED_HMAC_SHA256_KDF
L_CFLAGS += -DCONFIG_HMAC_SHA256_KDF
SHA256OBJS += src/crypto/sha256-kdf.c SHA256OBJS += src/crypto/sha256-kdf.c
endif endif
OBJS += $(SHA256OBJS) OBJS += $(SHA256OBJS)

View file

@ -1301,6 +1301,7 @@ ifdef NEED_TLS_PRF_SHA256
SHA256OBJS += ../src/crypto/sha256-tlsprf.o SHA256OBJS += ../src/crypto/sha256-tlsprf.o
endif endif
ifdef NEED_HMAC_SHA256_KDF ifdef NEED_HMAC_SHA256_KDF
CFLAGS += -DCONFIG_HMAC_SHA256_KDF
OBJS += ../src/crypto/sha256-kdf.o OBJS += ../src/crypto/sha256-kdf.o
endif endif
OBJS += $(SHA256OBJS) OBJS += $(SHA256OBJS)