wc_SHE_ImportM1M2M3: fix guard from || to && so it gates on WOLF_CRYPTO_CB

This commit is contained in:
night1rider
2026-04-15 18:03:39 -06:00
parent 9775795470
commit 64a1ac8dd2
4 changed files with 12 additions and 12 deletions
+1 -1
View File
@@ -146,7 +146,7 @@ int test_wc_SHE_ImportM1M2M3(void)
{
EXPECT_DECLS;
#if defined(WOLFSSL_SHE) && !defined(NO_AES) && \
(defined(WOLF_CRYPTO_CB) || !defined(NO_WC_SHE_IMPORT_M123))
(defined(WOLF_CRYPTO_CB) && !defined(NO_WC_SHE_IMPORT_M123))
wc_SHE she;
byte m1[WC_SHE_M1_SZ] = {0};
byte m2[WC_SHE_M2_SZ] = {0};
+4 -4
View File
@@ -359,7 +359,7 @@ int wc_SHE_SetKdfConstants(wc_SHE* she,
#endif /* WOLFSSL_SHE_EXTENDED */
#if defined(WOLF_CRYPTO_CB) || !defined(NO_WC_SHE_IMPORT_M123)
#if defined(WOLF_CRYPTO_CB) && !defined(NO_WC_SHE_IMPORT_M123)
/* -------------------------------------------------------------------------- */
/* Import M1/M2/M3 */
/* */
@@ -384,7 +384,7 @@ int wc_SHE_ImportM1M2M3(wc_SHE* she,
she->generated = 1;
return 0;
}
#endif /* WOLF_CRYPTO_CB || !NO_WC_SHE_IMPORT_M123 */
#endif /* WOLF_CRYPTO_CB && !NO_WC_SHE_IMPORT_M123 */
/* -------------------------------------------------------------------------- */
/* Portable big-endian 32-bit store */
@@ -776,7 +776,7 @@ int wc_SHE_GenerateM4M5(wc_SHE* she,
/* and frees the context. */
/* -------------------------------------------------------------------------- */
#ifndef NO_WC_SHE_LOADKEY
#if defined(WOLF_CRYPTO_CB) || !defined(NO_WC_SHE_IMPORT_M123)
#if defined(WOLF_CRYPTO_CB) && !defined(NO_WC_SHE_IMPORT_M123)
static int wc_SHE_LoadKey_Internal(wc_SHE* she,
const byte* m1, word32 m1Sz,
const byte* m2, word32 m2Sz,
@@ -1080,7 +1080,7 @@ int wc_SHE_LoadKey_Verify_Label(
}
#endif /* WOLF_PRIVATE_KEY_ID */
#endif /* WOLF_CRYPTO_CB || !NO_WC_SHE_IMPORT_M123 */
#endif /* WOLF_CRYPTO_CB && !NO_WC_SHE_IMPORT_M123 */
#endif /* !NO_WC_SHE_LOADKEY */
/* -------------------------------------------------------------------------- */
+3 -3
View File
@@ -56909,7 +56909,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t she_test(void)
goto exit_SHE_Test;
}
#if defined(WOLF_CRYPTO_CB) || !defined(NO_WC_SHE_IMPORT_M123)
#if defined(WOLF_CRYPTO_CB) && !defined(NO_WC_SHE_IMPORT_M123)
/* ---- Import M1/M2/M3 and generate M4/M5 (only NewKey needed) ---- */
wc_SHE_Free(she);
ret = wc_SHE_Init(she, HEAP_HINT, devId);
@@ -56944,7 +56944,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t she_test(void)
ret = WC_TEST_RET_ENC_NC;
goto exit_SHE_Test;
}
#endif /* WOLF_CRYPTO_CB || !NO_WC_SHE_IMPORT_M123 */
#endif /* WOLF_CRYPTO_CB && !NO_WC_SHE_IMPORT_M123 */
/* ---- One-shot M1/M2/M3 ---- */
wc_SHE_Free(she);
@@ -57062,7 +57062,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t she_test(void)
}
#if !defined(NO_WC_SHE_LOADKEY) && !defined(NO_WC_SHE_LOADKEY_TEST) && \
(defined(WOLF_CRYPTO_CB) || !defined(NO_WC_SHE_IMPORT_M123))
(defined(WOLF_CRYPTO_CB) && !defined(NO_WC_SHE_IMPORT_M123))
/* ---- LoadKey_Verify ---- */
/* Override WC_TEST_SHE_LOADKEY_VERIFY to use a platform-specific variant.
* Platforms with hardware SHE (HSM/HSE) cannot use static test vectors
+4 -4
View File
@@ -108,7 +108,7 @@ typedef struct wc_SHE {
byte m4pOverride;
#endif
#if defined(WOLF_CRYPTO_CB) || !defined(NO_WC_SHE_IMPORT_M123)
#if defined(WOLF_CRYPTO_CB) && !defined(NO_WC_SHE_IMPORT_M123)
byte m1[WC_SHE_M1_SZ];
byte m2[WC_SHE_M2_SZ];
byte m3[WC_SHE_M3_SZ];
@@ -227,7 +227,7 @@ WOLFSSL_API int wc_SHE_SetM4Header(wc_SHE* she,
* m2Sz - must be WC_SHE_M2_SZ (32)
* m3 - 16-byte M3 message (CMAC over M1|M2)
* m3Sz - must be WC_SHE_M3_SZ (16) */
#if defined(WOLF_CRYPTO_CB) || !defined(NO_WC_SHE_IMPORT_M123)
#if defined(WOLF_CRYPTO_CB) && !defined(NO_WC_SHE_IMPORT_M123)
WOLFSSL_API int wc_SHE_ImportM1M2M3(wc_SHE* she,
const byte* m1, word32 m1Sz,
const byte* m2, word32 m2Sz,
@@ -301,7 +301,7 @@ WOLFSSL_API int wc_SHE_GenerateM4M5(wc_SHE* she,
* m1-m3 - input: externally-provided SHE key update messages
* m4,m5 - output: verification messages returned by the HSM */
#ifndef NO_WC_SHE_LOADKEY
#if defined(WOLF_CRYPTO_CB) || !defined(NO_WC_SHE_IMPORT_M123)
#if defined(WOLF_CRYPTO_CB) && !defined(NO_WC_SHE_IMPORT_M123)
WOLFSSL_API int wc_SHE_LoadKey(
void* heap, int devId,
const byte* m1, word32 m1Sz,
@@ -371,7 +371,7 @@ WOLFSSL_API int wc_SHE_LoadKey_Verify_Label(
const byte* m5Expected, word32 m5ExpectedSz);
#endif /* WOLF_PRIVATE_KEY_ID */
#endif /* WOLF_CRYPTO_CB || !NO_WC_SHE_IMPORT_M123 */
#endif /* WOLF_CRYPTO_CB && !NO_WC_SHE_IMPORT_M123 */
#endif /* !NO_WC_SHE_LOADKEY */
/* Export a key from hardware in SHE loadable format (M1-M5).