/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2017-2018 NXP
+ * Copyright 2017-2019 NXP
*/
#include <fcntl.h>
shared_desc_len = cnstr_shdsc_blkcipher(
cdb->sh_desc, true,
- swap, &alginfo_c,
+ swap, SHR_NEVER, &alginfo_c,
NULL,
ses->iv.length,
ses->dir);
alginfo_a.key_type = RTA_DATA_IMM;
shared_desc_len = cnstr_shdsc_hmac(cdb->sh_desc, true,
- swap, &alginfo_a,
+ swap, SHR_NEVER, &alginfo_a,
!ses->dir,
ses->digest_length);
} else if (is_aead(ses)) {
if (ses->dir == DIR_ENC)
shared_desc_len = cnstr_shdsc_gcm_encap(
cdb->sh_desc, true, swap,
- &alginfo,
+ SHR_NEVER, &alginfo,
ses->iv.length,
ses->digest_length);
else
shared_desc_len = cnstr_shdsc_gcm_decap(
cdb->sh_desc, true, swap,
- &alginfo,
+ SHR_NEVER, &alginfo,
ses->iv.length,
ses->digest_length);
} else {
* overwritten in fd for each packet.
*/
shared_desc_len = cnstr_shdsc_authenc(cdb->sh_desc,
- true, swap, &alginfo_c, &alginfo_a,
+ true, swap, SHR_SERIAL,
+ &alginfo_c, &alginfo_a,
ses->iv.length, 0,
ses->digest_length, ses->dir);
}
session->dir = (xform->cipher.op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) ?
DIR_ENC : DIR_DEC;
- bufsize = cnstr_shdsc_blkcipher(priv->flc_desc[0].desc, 1, 0,
+ bufsize = cnstr_shdsc_blkcipher(priv->flc_desc[0].desc, 1, 0, SHR_NEVER,
&cipherdata, NULL, session->iv.length,
session->dir);
if (bufsize < 0) {
DIR_ENC : DIR_DEC;
bufsize = cnstr_shdsc_hmac(priv->flc_desc[DESC_INITFINAL].desc,
- 1, 0, &authdata, !session->dir,
+ 1, 0, SHR_NEVER, &authdata, !session->dir,
session->digest_length);
if (bufsize < 0) {
DPAA2_SEC_ERR("Crypto: Invalid buffer length");
if (session->dir == DIR_ENC)
bufsize = cnstr_shdsc_gcm_encap(
- priv->flc_desc[0].desc, 1, 0,
+ priv->flc_desc[0].desc, 1, 0, SHR_NEVER,
&aeaddata, session->iv.length,
session->digest_length);
else
bufsize = cnstr_shdsc_gcm_decap(
- priv->flc_desc[0].desc, 1, 0,
+ priv->flc_desc[0].desc, 1, 0, SHR_NEVER,
&aeaddata, session->iv.length,
session->digest_length);
if (bufsize < 0) {
if (session->ctxt_type == DPAA2_SEC_CIPHER_HASH) {
bufsize = cnstr_shdsc_authenc(priv->flc_desc[0].desc, 1,
- 0, &cipherdata, &authdata,
+ 0, SHR_SERIAL,
+ &cipherdata, &authdata,
session->iv.length,
ctxt->auth_only_len,
session->digest_length,
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2016 NXP
+ * Copyright 2016,2019 NXP
*
*/
* @descbuf: pointer to descriptor-under-construction buffer
* @ps: if 36/40bit addressing is desired, this parameter must be true
* @swap: must be true when core endianness doesn't match SEC endianness
+ * @share: sharing type of shared descriptor
* @cipherdata: pointer to block cipher transform definitions
* Valid algorithm values one of OP_ALG_ALGSEL_* {DES, 3DES, AES}
* Valid modes for:
*/
static inline int
cnstr_shdsc_blkcipher(uint32_t *descbuf, bool ps, bool swap,
+ enum rta_share_type share,
struct alginfo *cipherdata, uint8_t *iv,
uint32_t ivlen, uint8_t dir)
{
PROGRAM_SET_BSWAP(p);
if (ps)
PROGRAM_SET_36BIT_ADDR(p);
- SHR_HDR(p, SHR_SERIAL, 1, SC);
+ SHR_HDR(p, share, 1, SC);
pkeyjmp = JUMP(p, keyjmp, LOCAL_JUMP, ALL_TRUE, SHRD);
/* Insert Key */
* @descbuf: pointer to descriptor-under-construction buffer
* @ps: if 36/40bit addressing is desired, this parameter must be true
* @swap: must be true when core endianness doesn't match SEC endianness
+ * @share: sharing type of shared descriptor
* @authdata: pointer to authentication transform definitions;
* message digest algorithm: OP_ALG_ALGSEL_MD5/ SHA1-512.
* @do_icv: 0 if ICV checking is not desired, any other value if ICV checking
*/
static inline int
cnstr_shdsc_hmac(uint32_t *descbuf, bool ps, bool swap,
+ enum rta_share_type share,
struct alginfo *authdata, uint8_t do_icv,
uint8_t trunc_len)
{
PROGRAM_SET_BSWAP(p);
if (ps)
PROGRAM_SET_36BIT_ADDR(p);
- SHR_HDR(p, SHR_SERIAL, 1, SC);
+ SHR_HDR(p, share, 1, SC);
pkeyjmp = JUMP(p, keyjmp, LOCAL_JUMP, ALL_TRUE, SHRD);
KEY(p, KEY2, authdata->key_enc_flags, authdata->key, authdata->keylen,
* @descbuf: pointer to descriptor-under-construction buffer
* @ps: if 36/40bit addressing is desired, this parameter must be true
* @swap: must be true when core endianness doesn't match SEC endianness
+ * @share: sharing type of shared descriptor
* @cipherdata: pointer to block cipher transform definitions
* Valid algorithm values - OP_ALG_ALGSEL_AES ANDed with
* OP_ALG_AAI_GCM.
*/
static inline int
cnstr_shdsc_gcm_encap(uint32_t *descbuf, bool ps, bool swap,
+ enum rta_share_type share,
struct alginfo *cipherdata,
uint32_t ivlen, uint32_t icvsize)
{
if (ps)
PROGRAM_SET_36BIT_ADDR(p);
- SHR_HDR(p, SHR_SERIAL, 1, SC);
+ SHR_HDR(p, share, 1, SC);
pkeyjmp = JUMP(p, keyjmp, LOCAL_JUMP, ALL_TRUE, SELF | SHRD);
/* Insert Key */
* @descbuf: pointer to descriptor-under-construction buffer
* @ps: if 36/40bit addressing is desired, this parameter must be true
* @swap: must be true when core endianness doesn't match SEC endianness
+ * @share: sharing type of shared descriptor
* @cipherdata: pointer to block cipher transform definitions
* Valid algorithm values - OP_ALG_ALGSEL_AES ANDed with
* OP_ALG_AAI_GCM.
*/
static inline int
cnstr_shdsc_gcm_decap(uint32_t *descbuf, bool ps, bool swap,
+ enum rta_share_type share,
struct alginfo *cipherdata,
uint32_t ivlen, uint32_t icvsize)
{
if (ps)
PROGRAM_SET_36BIT_ADDR(p);
- SHR_HDR(p, SHR_SERIAL, 1, SC);
+ SHR_HDR(p, share, 1, SC);
pkeyjmp = JUMP(p, keyjmp, LOCAL_JUMP, ALL_TRUE, SELF | SHRD);
/* Insert Key */
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2016 NXP
+ * Copyright 2016,2019 NXP
*
*/
static inline int
cnstr_shdsc_ipsec_new_encap(uint32_t *descbuf, bool ps,
bool swap,
- enum rta_share_type share,
+ enum rta_share_type share,
struct ipsec_encap_pdb *pdb,
uint8_t *opt_ip_hdr,
struct alginfo *cipherdata,
static inline int
cnstr_shdsc_ipsec_new_decap(uint32_t *descbuf, bool ps,
bool swap,
- enum rta_share_type share,
+ enum rta_share_type share,
struct ipsec_decap_pdb *pdb,
struct alginfo *cipherdata,
struct alginfo *authdata)
* @descbuf: pointer to buffer used for descriptor construction
* @ps: if 36/40bit addressing is desired, this parameter must be true
* @swap: if true, perform descriptor byte swapping on a 4-byte boundary
+ * @share: sharing type of shared descriptor
* @cipherdata: pointer to block cipher transform definitions.
* Valid algorithm values one of OP_ALG_ALGSEL_* {DES, 3DES, AES}
* Valid modes for:
*/
static inline int
cnstr_shdsc_authenc(uint32_t *descbuf, bool ps, bool swap,
+ enum rta_share_type share,
struct alginfo *cipherdata,
struct alginfo *authdata,
uint16_t ivlen, uint16_t auth_only_len,
trunc_len = trunc_len && (trunc_len < authdata->keylen) ?
trunc_len : (uint8_t)authdata->keylen;
- SHR_HDR(p, SHR_SERIAL, 1, SC);
+ SHR_HDR(p, share, 1, SC);
/*
* M0 will contain the value provided by the user when creating
shared_desc_len = cnstr_shdsc_blkcipher(
cdb->sh_desc, true,
- swap, &alginfo_c,
+ swap, SHR_NEVER, &alginfo_c,
NULL,
ses->iv.length,
ses->dir);
alginfo_a.key_type = RTA_DATA_IMM;
shared_desc_len = cnstr_shdsc_hmac(cdb->sh_desc, true,
- swap, &alginfo_a,
+ swap, SHR_NEVER, &alginfo_a,
!ses->dir,
ses->digest_length);
} else if (is_aead(ses)) {
if (ses->dir == DIR_ENC)
shared_desc_len = cnstr_shdsc_gcm_encap(
- cdb->sh_desc, true, swap,
+ cdb->sh_desc, true, swap, SHR_NEVER,
&alginfo,
ses->iv.length,
ses->digest_length);
else
shared_desc_len = cnstr_shdsc_gcm_decap(
- cdb->sh_desc, true, swap,
+ cdb->sh_desc, true, swap, SHR_NEVER,
&alginfo,
ses->iv.length,
ses->digest_length);
* overwritten in fd for each packet.
*/
shared_desc_len = cnstr_shdsc_authenc(cdb->sh_desc,
- true, swap, &alginfo_c, &alginfo_a,
+ true, swap, SHR_SERIAL, &alginfo_c, &alginfo_a,
ses->iv.length, 0,
ses->digest_length, ses->dir);
}