common/dpaax/caamflib: fix IV for short MAC-I in SNOW3G
authorGagandeep Singh <g.singh@nxp.com>
Wed, 8 Sep 2021 06:59:51 +0000 (12:29 +0530)
committerAkhil Goyal <gakhil@marvell.com>
Wed, 8 Sep 2021 10:10:43 +0000 (12:10 +0200)
The logic was incorrectly doing conditional swap. It need to
be bit swap always.

Fixes: 73a24060cd70 ("crypto/dpaa2_sec: add sample PDCP descriptor APIs")
Cc: stable@dpdk.org
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
drivers/common/dpaax/caamflib/desc/pdcp.h

index 5b3d846..8e8daf5 100644 (file)
@@ -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__
@@ -3715,9 +3715,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));