Skip to content

mka: add WOLFMKA_ICV_L2_ADDR to include L2 addresses in the MKA ICV for wpa_supplicant interop - #2

Open
dgarske wants to merge 1 commit into
wolfSSL:mainfrom
dgarske:macsec-mka-icv-l2-interop
Open

mka: add WOLFMKA_ICV_L2_ADDR to include L2 addresses in the MKA ICV for wpa_supplicant interop#2
dgarske wants to merge 1 commit into
wolfSSL:mainfrom
dgarske:macsec-mka-icv-l2-interop

Conversation

@dgarske

Copy link
Copy Markdown
Member

No description provided.

CopilotAI review requested due to automatic review settings July 10, 2026 20:54

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an optional build-time mode (WOLFMKA_ICV_L2_ADDR) that computes/verifies the MKPDU ICV over an IEEE 802.1X L2 prefix (DA || SA || EtherType) plus the EAPOL-MKA PDU, to improve interoperability with wpa_supplicant’s ICV input rules.

Changes:

  • Add L2-prefix construction in the MKPDU encode/verify path when WOLFMKA_ICV_L2_ADDR is enabled.
  • Introduce new crypto APIs (wm_Crypto_IcvComputeL2 / wm_Crypto_IcvVerifyL2) that stream CMAC over (L2 prefix + data) without a scratch buffer.
  • Export the new L2 ICV APIs in the public crypto header under the same build-time flag.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

FileDescription
mka/wolfMKA/src/mka_pdu.cConditionally builds an L2 prefix and uses L2-aware ICV compute/verify during encode/decode.
mka/wolfMKA/src/mka_crypto.cAdds streaming CMAC helpers and public L2-inclusive ICV compute/verify functions.
mka/wolfMKA/include/wolfmka/mka_crypto.hDeclares the new L2-inclusive ICV APIs behind WOLFMKA_ICV_L2_ADDR.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadmka/wolfMKA/src/mka_crypto.c Outdated
Comment on lines +817 to +818
wm_Crypto_ForceZero(computed, sizeof computed);
return (diff == 0U) ? MKA_OK : MKA_ERR_ICV;
Comment on lines +766 to +776
ret = wc_InitCmac_ex(&ctx->cmac, key, (word32)key_len, WC_CMAC_AES, NULL,
WOLFMKA_HEAP_HINT, INVALID_DEVID);
if (ret == 0) {
ret = wc_CmacUpdate(&ctx->cmac, l2, (word32)l2_len);
}
if ((ret == 0) && (data_len > 0U)) {
ret = wc_CmacUpdate(&ctx->cmac, data, (word32)data_len);
}
if (ret == 0) {
ret = wc_CmacFinal(&ctx->cmac, mac, &out_sz);
}
Comment on lines +784 to +789
if ((cmac == NULL) || (l2 == NULL) || (data == NULL) || (icv == NULL)) {
return MKA_ERR_BAD_ARG;
}
if (!mka_key_valid(ick, ick_len)) {
return MKA_ERR_BAD_ARG;
}
Comment threadmka/wolfMKA/src/mka_pdu.c Outdated
Comment on lines +35 to +39
static const uint8_t pae_group[6] = { 0x01, 0x80, 0xC2, 0x00, 0x00, 0x03 };
(void)WOLFMKA_MEMCPY(&l2[0], pae_group, 6);
(void)WOLFMKA_MEMCPY(&l2[6], &eapol_pdu[8], 6);
l2[12] = 0x88;
l2[13] = 0x8E;
Comment on lines +780 to +783
MkaStatus wm_Crypto_IcvComputeL2(MkaCmacCtx* cmac, const uint8_t* ick,
size_t ick_len, const uint8_t* l2, size_t l2_len, const uint8_t* data,
size_t data_len, uint8_t icv[MKA_DEFAULT_ICV_LEN])
{
@dgarske
dgarskeforce-pushed the macsec-mka-icv-l2-interop branch from 588ff43 to 5a1e251CompareJuly 11, 2026 00:22
@SparkiDevSparkiDev assigned dgarske and unassigned SparkiDevJul 29, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@dgarske@SparkiDev