Commit fe4a9b00 authored by Cedric Roux's avatar Cedric Roux

nr: add some comments to pdcp nia2 integrity

parent 63b7ff98
...@@ -59,12 +59,18 @@ void nr_pdcp_integrity_nia2_integrity(void *integrity_context, ...@@ -59,12 +59,18 @@ void nr_pdcp_integrity_nia2_integrity(void *integrity_context,
unsigned char mac[16]; unsigned char mac[16];
size_t maclen; size_t maclen;
/* see 33.401 B.2.3 for the input to 128-EIA2
* (which is identical to 128-NIA2, see 33.501 D.3.1.3) */
compute_t(t, count, bearer, direction); compute_t(t, count, bearer, direction);
CMAC_Update(ctx, t, 8); CMAC_Update(ctx, t, 8);
CMAC_Update(ctx, buffer, length); CMAC_Update(ctx, buffer, length);
CMAC_Final(ctx, mac, &maclen); CMAC_Final(ctx, mac, &maclen);
/* AES CMAC (RFC 4493) outputs 128 bits but NR PDCP PDUs have a MAC-I of
* 32 bits (see 38.323 6.2). RFC 4493 2.1 says to truncate most significant
* bit first (so seems to say 33.401 B.2.3)
*/
memcpy(out, mac, 4); memcpy(out, mac, 4);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment