Skip to content

Commit

Permalink
common/dpaax/caamflib: fix IV for short MAC-I in SNOW3G
Browse files Browse the repository at this point in the history
[ upstream commit c0182d6 ]

The logic was incorrectly doing conditional swap. It need to
be bit swap always.

Fixes: 73a2406 ("crypto/dpaa2_sec: add sample PDCP descriptor APIs")

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
  • Loading branch information
Gagandeep Singh authored and cpaelzer committed Nov 29, 2021
1 parent b7bcb4e commit abd1775
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/common/dpaax/caamflib/desc/pdcp.h
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: BSD-3-Clause or GPL-2.0+
* Copyright 2008-2013 Freescale Semiconductor, Inc.
* Copyright 2019-2020 NXP
* Copyright 2019-2021 NXP
*/

#ifndef __DESC_PDCP_H__
Expand Down Expand Up @@ -3691,9 +3691,10 @@ cnstr_shdsc_pdcp_short_mac(uint32_t *descbuf,
break;

case PDCP_AUTH_TYPE_SNOW:
/* IV calculation based on 3GPP specs. 36331, section:5.3.7.4 */
iv[0] = 0xFFFFFFFF;
iv[1] = swap ? swab32(0x04000000) : 0x04000000;
iv[2] = swap ? swab32(0xF8000000) : 0xF8000000;
iv[1] = swab32(0x04000000);
iv[2] = swab32(0xF8000000);

KEY(p, KEY2, authdata->key_enc_flags, authdata->key,
authdata->keylen, INLINE_KEY(authdata));
Expand Down

0 comments on commit abd1775

Please sign in to comment.