JUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);
MATHB(p, MATH0, AND, sn_mask, MATH1, 8, IFB | IMMED2);
MATHB(p, MATH1, SHLD, MATH1, MATH1, 8, 0);
- MOVE(p, DESCBUF, 4, MATH2, 0, 0x08, WAITCOMP | IMMED);
+ MOVEB(p, DESCBUF, 4, MATH2, 0, 0x08, WAITCOMP | IMMED);
MATHB(p, MATH1, OR, MATH2, MATH2, 8, 0);
SEQSTORE(p, MATH0, offset, length, 0);
if (dir == OP_TYPE_ENCAP_PROTOCOL) {
if (rta_sec_era > RTA_SEC_ERA_2 ||
(rta_sec_era == RTA_SEC_ERA_2 &&
era_2_sw_hfn_ovrd == 0)) {
- SEQINPTR(p, 0, 1, RTO);
+ SEQINPTR(p, 0, length, RTO);
} else {
SEQINPTR(p, 0, 5, RTO);
SEQFIFOLOAD(p, SKIP, 4, 0);
}
KEY(p, KEY1, authdata->key_enc_flags, authdata->key,
authdata->keylen, INLINE_KEY(authdata));
- MOVE(p, MATH2, 0, IFIFOAB1, 0, 0x08, IMMED);
+ MOVEB(p, MATH2, 0, IFIFOAB1, 0, 0x08, IMMED);
if (rta_sec_era > RTA_SEC_ERA_2) {
MATHB(p, SEQINSZ, SUB, ZERO, VSEQINSZ, 4, 0);
ICV_CHECK_DISABLE,
DIR_DEC);
SEQFIFOLOAD(p, MSG1, 0, VLF | LAST1 | FLUSH1);
- MOVE(p, CONTEXT1, 0, MATH3, 0, 4, WAITCOMP | IMMED);
+ MOVEB(p, CONTEXT1, 0, MATH3, 0, 4, WAITCOMP | IMMED);
if (rta_sec_era <= RTA_SEC_ERA_3)
LOAD(p, CLRW_CLR_C1KEY |
CLRW_CLR_C1CTX |
KEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,
cipherdata->keylen, INLINE_KEY(cipherdata));
SET_LABEL(p, local_offset);
- MOVE(p, MATH2, 0, CONTEXT1, 0, 8, IMMED);
+ MOVEB(p, MATH2, 0, CONTEXT1, 0, 8, IMMED);
SEQINPTR(p, 0, 0, RTO);
if (rta_sec_era == RTA_SEC_ERA_2 && era_2_sw_hfn_ovrd) {
MATHB(p, SEQINSZ, ADD, ONE, SEQINSZ, 4, 0);
}
- MATHB(p, SEQINSZ, SUB, ONE, VSEQINSZ, 4, 0);
+ MATHB(p, SEQINSZ, SUB, length, VSEQINSZ, 4, IMMED2);
ALG_OPERATION(p, OP_ALG_ALGSEL_SNOW_F8,
OP_ALG_AAI_F8,
OP_ALG_AS_INITFINAL,
if (rta_sec_era > RTA_SEC_ERA_2 ||
(rta_sec_era == RTA_SEC_ERA_2 &&
era_2_sw_hfn_ovrd == 0))
- SEQFIFOLOAD(p, SKIP, 1, 0);
+ SEQFIFOLOAD(p, SKIP, length, 0);
SEQFIFOLOAD(p, MSG1, 0, VLF);
- MOVE(p, MATH3, 0, IFIFOAB1, 0, 4, LAST1 | FLUSH1 | IMMED);
+ MOVEB(p, MATH3, 0, IFIFOAB1, 0, 4, LAST1 | FLUSH1 | IMMED);
PATCH_MOVE(p, seqin_ptr_read, local_offset);
PATCH_MOVE(p, seqin_ptr_write, local_offset);
} else {
- MOVE(p, MATH2, 0, CONTEXT1, 0, 8, IMMED);
+ MOVEB(p, MATH2, 0, CONTEXT1, 0, 8, IMMED);
if (rta_sec_era >= RTA_SEC_ERA_5)
MOVE(p, CONTEXT1, 0, CONTEXT2, 0, 8, IMMED);
else
MATHB(p, SEQINSZ, SUB, MATH3, VSEQINSZ, 4, 0);
- MATHB(p, SEQINSZ, SUB, PDCP_MAC_I_LEN, VSEQOUTSZ, 4, IMMED2);
+ MATHI(p, SEQINSZ, SUB, PDCP_MAC_I_LEN, VSEQOUTSZ, 4, IMMED2);
/*
* TODO: To be changed when proper support is added in RTA (can't load a
* command that is also written by RTA (or patch it for that matter).
DIR_DEC);
/* Read the # of bytes written in the output buffer + 1 (HDR) */
- MATHB(p, VSEQOUTSZ, ADD, ONE, VSEQINSZ, 4, 0);
+ MATHI(p, VSEQOUTSZ, ADD, length, VSEQINSZ, 4, IMMED2);
if (rta_sec_era <= RTA_SEC_ERA_3)
MOVE(p, MATH3, 0, IFIFOAB1, 0, 8, IMMED);
}
if (dir == OP_TYPE_ENCAP_PROTOCOL)
- MATHB(p, SEQINSZ, SUB, ONE, VSEQINSZ, 4, 0);
+ MATHB(p, SEQINSZ, SUB, length, VSEQINSZ, 4, IMMED2);
SEQLOAD(p, MATH0, offset, length, 0);
JUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);
- MOVE(p, MATH0, 7, IFIFOAB2, 0, 1, IMMED);
+ MOVEB(p, MATH0, offset, IFIFOAB2, 0, length, IMMED);
MATHB(p, MATH0, AND, sn_mask, MATH1, 8, IFB | IMMED2);
SEQSTORE(p, MATH0, offset, length, 0);
MATHB(p, MATH1, SHLD, MATH1, MATH1, 8, 0);
- MOVE(p, DESCBUF, 4, MATH2, 0, 8, WAITCOMP | IMMED);
+ MOVEB(p, DESCBUF, 4, MATH2, 0, 8, WAITCOMP | IMMED);
MATHB(p, MATH1, OR, MATH2, MATH1, 8, 0);
- MOVE(p, MATH1, 0, CONTEXT1, 16, 8, IMMED);
- MOVE(p, MATH1, 0, CONTEXT2, 0, 4, IMMED);
+ MOVEB(p, MATH1, 0, CONTEXT1, 16, 8, IMMED);
+ MOVEB(p, MATH1, 0, CONTEXT2, 0, 4, IMMED);
if (swap == false) {
- MATHB(p, MATH1, AND, lower_32_bits(PDCP_BEARER_MASK), MATH2, 4,
- IMMED2);
- MATHB(p, MATH1, AND, upper_32_bits(PDCP_DIR_MASK), MATH3, 4,
- IMMED2);
+ MATHB(p, MATH1, AND, upper_32_bits(PDCP_BEARER_MASK), MATH2, 4,
+ IMMED2);
+ MATHB(p, MATH1, AND, lower_32_bits(PDCP_DIR_MASK), MATH3, 4,
+ IMMED2);
} else {
MATHB(p, MATH1, AND, lower_32_bits(PDCP_BEARER_MASK_BE), MATH2,
4, IMMED2);
4, IMMED2);
}
MATHB(p, MATH3, SHLD, MATH3, MATH3, 8, 0);
- MOVE(p, MATH2, 4, OFIFO, 0, 12, IMMED);
+ MOVEB(p, MATH2, 4, OFIFO, 0, 12, IMMED);
MOVE(p, OFIFO, 0, CONTEXT2, 4, 12, IMMED);
if (dir == OP_TYPE_ENCAP_PROTOCOL) {
MATHB(p, SEQINSZ, ADD, PDCP_MAC_I_LEN, VSEQOUTSZ, 4, IMMED2);
SEQLOAD(p, MATH0, offset, length, 0);
JUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);
- MOVE(p, MATH0, 7, IFIFOAB2, 0, 1, IMMED);
+ MOVEB(p, MATH0, offset, IFIFOAB2, 0, length, IMMED);
MATHB(p, MATH0, AND, sn_mask, MATH1, 8, IFB | IMMED2);
MATHB(p, MATH1, SHLD, MATH1, MATH1, 8, 0);
- MOVE(p, DESCBUF, 4, MATH2, 0, 8, WAITCOMP | IMMED);
+ MOVEB(p, DESCBUF, 4, MATH2, 0, 8, WAITCOMP | IMMED);
MATHB(p, MATH1, OR, MATH2, MATH2, 8, 0);
- MOVE(p, MATH2, 0, CONTEXT1, 0, 8, IMMED);
- MOVE(p, MATH2, 0, CONTEXT2, 0, 8, WAITCOMP | IMMED);
+ MOVEB(p, MATH2, 0, CONTEXT1, 0, 8, IMMED);
+ MOVEB(p, MATH2, 0, CONTEXT2, 0, 8, WAITCOMP | IMMED);
if (dir == OP_TYPE_ENCAP_PROTOCOL)
MATHB(p, SEQINSZ, ADD, PDCP_MAC_I_LEN, VSEQOUTSZ, 4, IMMED2);
SET_LABEL(p, keyjump);
SEQLOAD(p, MATH0, offset, length, 0);
JUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);
- MOVE(p, MATH0, 7, IFIFOAB2, 0, 1, IMMED);
+ MOVEB(p, MATH0, offset, IFIFOAB2, 0, length, IMMED);
MATHB(p, MATH0, AND, sn_mask, MATH1, 8, IFB | IMMED2);
MATHB(p, MATH1, SHLD, MATH1, MATH1, 8, 0);
- MOVE(p, DESCBUF, 4, MATH2, 0, 8, WAITCOMP | IMMED);
+ MOVEB(p, DESCBUF, 4, MATH2, 0, 8, WAITCOMP | IMMED);
MATHB(p, MATH1, OR, MATH2, MATH2, 8, 0);
- MOVE(p, MATH2, 0, CONTEXT1, 16, 8, IMMED);
- MOVE(p, MATH2, 0, CONTEXT2, 0, 8, WAITCOMP | IMMED);
+ MOVEB(p, MATH2, 0, CONTEXT1, 16, 8, IMMED);
+ MOVEB(p, MATH2, 0, CONTEXT2, 0, 8, WAITCOMP | IMMED);
if (dir == OP_TYPE_ENCAP_PROTOCOL)
MATHB(p, SEQINSZ, ADD, PDCP_MAC_I_LEN, VSEQOUTSZ, 4, IMMED2);
SET_LABEL(p, keyjump);
SEQLOAD(p, MATH0, offset, length, 0);
JUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);
- MOVE(p, MATH0, 7, IFIFOAB2, 0, 1, IMMED);
+ MOVEB(p, MATH0, offset, IFIFOAB2, 0, length, IMMED);
MATHB(p, MATH0, AND, sn_mask, MATH1, 8, IFB | IMMED2);
MATHB(p, MATH1, SHLD, MATH1, MATH1, 8, 0);
- MOVE(p, DESCBUF, 4, MATH2, 0, 8, WAITCOMP | IMMED);
+ MOVEB(p, DESCBUF, 4, MATH2, 0, 8, WAITCOMP | IMMED);
MATHB(p, MATH1, OR, MATH2, MATH1, 8, 0);
- MOVE(p, MATH1, 0, CONTEXT1, 0, 8, IMMED);
- MOVE(p, MATH1, 0, CONTEXT2, 0, 4, IMMED);
+ MOVEB(p, MATH1, 0, CONTEXT1, 0, 8, IMMED);
+ MOVEB(p, MATH1, 0, CONTEXT2, 0, 4, IMMED);
if (swap == false) {
- MATHB(p, MATH1, AND, lower_32_bits(PDCP_BEARER_MASK), MATH2,
- 4, IMMED2);
- MATHB(p, MATH1, AND, upper_32_bits(PDCP_DIR_MASK), MATH3,
- 4, IMMED2);
+ MATHB(p, MATH1, AND, upper_32_bits(PDCP_BEARER_MASK), MATH2,
+ 4, IMMED2);
+ MATHB(p, MATH1, AND, lower_32_bits(PDCP_DIR_MASK), MATH3,
+ 4, IMMED2);
} else {
MATHB(p, MATH1, AND, lower_32_bits(PDCP_BEARER_MASK_BE), MATH2,
4, IMMED2);
4, IMMED2);
}
MATHB(p, MATH3, SHLD, MATH3, MATH3, 8, 0);
- MOVE(p, MATH2, 4, OFIFO, 0, 12, IMMED);
+ MOVEB(p, MATH2, 4, OFIFO, 0, 12, IMMED);
MOVE(p, OFIFO, 0, CONTEXT2, 4, 12, IMMED);
if (dir == OP_TYPE_ENCAP_PROTOCOL) {
LOAD(p, 0, DCTRL, 0, LDLEN_RST_CHA_OFIFO_PTR, IMMED);
/* Put ICV to M0 before sending it to C2 for comparison. */
- MOVE(p, OFIFO, 0, MATH0, 0, 4, WAITCOMP | IMMED);
+ MOVEB(p, OFIFO, 0, MATH0, 0, 4, WAITCOMP | IMMED);
LOAD(p, NFIFOENTRY_STYPE_ALTSOURCE |
NFIFOENTRY_DEST_CLASS2 |
NFIFOENTRY_DTYPE_ICV |
NFIFOENTRY_LC2 | 4, NFIFO_SZL, 0, 4, IMMED);
- MOVE(p, MATH0, 0, ALTSOURCE, 0, 4, IMMED);
+ MOVEB(p, MATH0, 0, ALTSOURCE, 0, 4, IMMED);
}
PATCH_JUMP(p, pkeyjump, keyjump);
MATHB(p, MATH0, AND, sn_mask, MATH1, 8, IFB | IMMED2);
MATHB(p, MATH1, SHLD, MATH1, MATH1, 8, 0);
- MOVE(p, DESCBUF, 4, MATH2, 0, 0x08, WAITCOMP | IMMED);
+ MOVEB(p, DESCBUF, 4, MATH2, 0, 0x08, WAITCOMP | IMMED);
MATHB(p, MATH1, OR, MATH2, MATH2, 8, 0);
SEQSTORE(p, MATH0, offset, length, 0);
if (dir == OP_TYPE_ENCAP_PROTOCOL) {
KEY(p, KEY1, authdata->key_enc_flags, authdata->key,
authdata->keylen, INLINE_KEY(authdata));
- MOVE(p, MATH2, 0, IFIFOAB1, 0, 0x08, IMMED);
- MOVE(p, MATH0, 7, IFIFOAB1, 0, 1, IMMED);
+ MOVEB(p, MATH2, 0, IFIFOAB1, 0, 0x08, IMMED);
+ MOVEB(p, MATH0, offset, IFIFOAB1, 0, length, IMMED);
MATHB(p, SEQINSZ, SUB, ZERO, VSEQINSZ, 4, 0);
MATHB(p, VSEQINSZ, ADD, PDCP_MAC_I_LEN, VSEQOUTSZ, 4, IMMED2);
ICV_CHECK_DISABLE,
DIR_DEC);
SEQFIFOLOAD(p, MSG1, 0, VLF | LAST1 | FLUSH1);
- MOVE(p, CONTEXT1, 0, MATH3, 0, 4, WAITCOMP | IMMED);
+ MOVEB(p, CONTEXT1, 0, MATH3, 0, 4, WAITCOMP | IMMED);
LOAD(p, CLRW_RESET_CLS1_CHA |
CLRW_CLR_C1KEY |
CLRW_CLR_C1CTX |
KEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,
cipherdata->keylen, INLINE_KEY(cipherdata));
- MOVE(p, MATH2, 0, CONTEXT1, 0, 8, IMMED);
+ MOVEB(p, MATH2, 0, CONTEXT1, 0, 8, IMMED);
SEQINPTR(p, 0, PDCP_NULL_MAX_FRAME_LEN, RTO);
ALG_OPERATION(p, OP_ALG_ALGSEL_ZUCE,
DIR_ENC);
SEQFIFOSTORE(p, MSG, 0, 0, VLF);
- SEQFIFOLOAD(p, SKIP, 1, 0);
+ SEQFIFOLOAD(p, SKIP, length, 0);
SEQFIFOLOAD(p, MSG1, 0, VLF);
- MOVE(p, MATH3, 0, IFIFOAB1, 0, 4, LAST1 | FLUSH1 | IMMED);
+ MOVEB(p, MATH3, 0, IFIFOAB1, 0, 4, LAST1 | FLUSH1 | IMMED);
} else {
- MOVE(p, MATH2, 0, CONTEXT1, 0, 8, IMMED);
+ MOVEB(p, MATH2, 0, CONTEXT1, 0, 8, IMMED);
MOVE(p, CONTEXT1, 0, CONTEXT2, 0, 8, IMMED);
SEQFIFOSTORE(p, MSG, 0, 0, VLF | CONT);
SEQFIFOLOAD(p, MSG1, 0, VLF | LAST1 | FLUSH1);
- MOVE(p, OFIFO, 0, MATH3, 0, 4, IMMED);
+ MOVEB(p, OFIFO, 0, MATH3, 0, 4, IMMED);
LOAD(p, CLRW_RESET_CLS1_CHA |
CLRW_CLR_C1KEY |
NFIFOENTRY_DTYPE_ICV |
NFIFOENTRY_LC1 |
NFIFOENTRY_FC1 | 4, NFIFO_SZL, 0, 4, IMMED);
- MOVE(p, MATH3, 0, ALTSOURCE, 0, 4, IMMED);
+ MOVEB(p, MATH3, 0, ALTSOURCE, 0, 4, IMMED);
}
return 0;
{
uint32_t imm = PDCP_DPOVRD_HFN_OV_EN;
uint16_t hfn_pdb_offset;
+ LABEL(keyjump);
+ REFERENCE(pkeyjump);
if (rta_sec_era == RTA_SEC_ERA_2 && !era_2_sw_hfn_ovrd)
return 0;
SEQSTORE(p, MATH0, 4, 4, 0);
}
- if (rta_sec_era >= RTA_SEC_ERA_8)
- JUMP(p, 6, LOCAL_JUMP, ALL_TRUE, MATH_Z);
- else
- JUMP(p, 5, LOCAL_JUMP, ALL_TRUE, MATH_Z);
+ pkeyjump = JUMP(p, keyjump, LOCAL_JUMP, ALL_TRUE, MATH_Z);
if (rta_sec_era > RTA_SEC_ERA_2)
- MATHB(p, DPOVRD, LSHIFT, shift, MATH0, 4, IMMED2);
+ MATHI(p, DPOVRD, LSHIFT, shift, MATH0, 4, IMMED2);
else
MATHB(p, MATH0, LSHIFT, shift, MATH0, 4, IMMED2);
*/
MATHB(p, DPOVRD, AND, ZERO, DPOVRD, 4, STL);
+ SET_LABEL(p, keyjump);
+ PATCH_JUMP(p, pkeyjump, keyjump);
return 0;
}
/*
* PDCP UPlane PDB creation function
*/
-static inline int
+static inline enum pdb_type_e
cnstr_pdcp_u_plane_pdb(struct program *p,
enum pdcp_sn_size sn_size,
uint32_t hfn, unsigned short bearer,
unsigned short direction,
- uint32_t hfn_threshold)
+ uint32_t hfn_threshold,
+ struct alginfo *cipherdata,
+ struct alginfo *authdata)
{
struct pdcp_pdb pdb;
+ enum pdb_type_e pdb_type = PDCP_PDB_TYPE_FULL_PDB;
+ enum pdb_type_e
+ pdb_mask[PDCP_CIPHER_TYPE_INVALID][PDCP_AUTH_TYPE_INVALID] = {
+ { /* NULL */
+ PDCP_PDB_TYPE_NO_PDB, /* NULL */
+ PDCP_PDB_TYPE_FULL_PDB, /* SNOW f9 */
+ PDCP_PDB_TYPE_FULL_PDB, /* AES CMAC */
+ PDCP_PDB_TYPE_FULL_PDB /* ZUC-I */
+ },
+ { /* SNOW f8 */
+ PDCP_PDB_TYPE_FULL_PDB, /* NULL */
+ PDCP_PDB_TYPE_FULL_PDB, /* SNOW f9 */
+ PDCP_PDB_TYPE_REDUCED_PDB, /* AES CMAC */
+ PDCP_PDB_TYPE_REDUCED_PDB /* ZUC-I */
+ },
+ { /* AES CTR */
+ PDCP_PDB_TYPE_FULL_PDB, /* NULL */
+ PDCP_PDB_TYPE_REDUCED_PDB, /* SNOW f9 */
+ PDCP_PDB_TYPE_FULL_PDB, /* AES CMAC */
+ PDCP_PDB_TYPE_REDUCED_PDB /* ZUC-I */
+ },
+ { /* ZUC-E */
+ PDCP_PDB_TYPE_FULL_PDB, /* NULL */
+ PDCP_PDB_TYPE_REDUCED_PDB, /* SNOW f9 */
+ PDCP_PDB_TYPE_REDUCED_PDB, /* AES CMAC */
+ PDCP_PDB_TYPE_FULL_PDB /* ZUC-I */
+ },
+ };
+
/* Read options from user */
/* Depending on sequence number length, the HFN and HFN threshold
* have different lengths.
pdb.hfn_res = hfn << PDCP_U_PLANE_PDB_18BIT_SN_HFN_SHIFT;
pdb.hfn_thr_res =
hfn_threshold<<PDCP_U_PLANE_PDB_18BIT_SN_HFN_THR_SHIFT;
+
+ if (rta_sec_era <= RTA_SEC_ERA_8) {
+ if (cipherdata && authdata)
+ pdb_type = pdb_mask[cipherdata->algtype]
+ [authdata->algtype];
+ }
break;
default:
((bearer << PDCP_U_PLANE_PDB_BEARER_SHIFT) |
(direction << PDCP_U_PLANE_PDB_DIR_SHIFT));
- /* copy PDB in descriptor*/
- __rta_out32(p, pdb.opt_res.opt);
- __rta_out32(p, pdb.hfn_res);
- __rta_out32(p, pdb.bearer_dir_res);
- __rta_out32(p, pdb.hfn_thr_res);
+ switch (pdb_type) {
+ case PDCP_PDB_TYPE_NO_PDB:
+ break;
+
+ case PDCP_PDB_TYPE_REDUCED_PDB:
+ __rta_out32(p, pdb.hfn_res);
+ __rta_out32(p, pdb.bearer_dir_res);
+ break;
- return 0;
+ case PDCP_PDB_TYPE_FULL_PDB:
+ /* copy PDB in descriptor*/
+ __rta_out32(p, pdb.opt_res.opt);
+ __rta_out32(p, pdb.hfn_res);
+ __rta_out32(p, pdb.bearer_dir_res);
+ __rta_out32(p, pdb.hfn_thr_res);
+
+ break;
+
+ default:
+ return PDCP_PDB_TYPE_INVALID;
+ }
+
+ return pdb_type;
}
/**
* cnstr_shdsc_pdcp_c_plane_encap - Function for creating a PDCP Control Plane
struct program prg;
struct program *p = &prg;
int err;
+ enum pdb_type_e pdb_type;
static enum rta_share_type
desc_share[PDCP_CIPHER_TYPE_INVALID][PDCP_AUTH_TYPE_INVALID] = {
{ /* NULL */
SHR_HDR(p, desc_share[cipherdata->algtype][authdata->algtype], 0, 0);
else
SHR_HDR(p, SHR_ALWAYS, 0, 0);
- if (cnstr_pdcp_u_plane_pdb(p, sn_size, hfn, bearer, direction,
- hfn_threshold)) {
+ pdb_type = cnstr_pdcp_u_plane_pdb(p, sn_size, hfn,
+ bearer, direction, hfn_threshold,
+ cipherdata, authdata);
+ if (pdb_type == PDCP_PDB_TYPE_INVALID) {
pr_err("Error creating PDCP UPlane PDB\n");
return -EINVAL;
}
SET_LABEL(p, pdb_end);
- err = insert_hfn_ov_op(p, sn_size, PDCP_PDB_TYPE_FULL_PDB,
- era_2_sw_hfn_ovrd);
+ err = insert_hfn_ov_op(p, sn_size, pdb_type, era_2_sw_hfn_ovrd);
if (err)
return err;
return err;
break;
}
+
+ if (pdb_type != PDCP_PDB_TYPE_FULL_PDB) {
+ pr_err("PDB type must be FULL for PROTO desc\n");
+ return -EINVAL;
+ }
+
/* Insert auth key if requested */
if (authdata && authdata->algtype) {
KEY(p, KEY2, authdata->key_enc_flags,
struct program prg;
struct program *p = &prg;
int err;
+ enum pdb_type_e pdb_type;
static enum rta_share_type
desc_share[PDCP_CIPHER_TYPE_INVALID][PDCP_AUTH_TYPE_INVALID] = {
{ /* NULL */
else
SHR_HDR(p, SHR_ALWAYS, 0, 0);
- if (cnstr_pdcp_u_plane_pdb(p, sn_size, hfn, bearer, direction,
- hfn_threshold)) {
+ pdb_type = cnstr_pdcp_u_plane_pdb(p, sn_size, hfn, bearer,
+ direction, hfn_threshold,
+ cipherdata, authdata);
+ if (pdb_type == PDCP_PDB_TYPE_INVALID) {
pr_err("Error creating PDCP UPlane PDB\n");
return -EINVAL;
}
SET_LABEL(p, pdb_end);
- err = insert_hfn_ov_op(p, sn_size, PDCP_PDB_TYPE_FULL_PDB,
- era_2_sw_hfn_ovrd);
+ err = insert_hfn_ov_op(p, sn_size, pdb_type, era_2_sw_hfn_ovrd);
if (err)
return err;
case PDCP_CIPHER_TYPE_AES:
case PDCP_CIPHER_TYPE_SNOW:
case PDCP_CIPHER_TYPE_NULL:
+ if (pdb_type != PDCP_PDB_TYPE_FULL_PDB) {
+ pr_err("PDB type must be FULL for PROTO desc\n");
+ return -EINVAL;
+ }
+
/* Insert auth key if requested */
if (authdata && authdata->algtype)
KEY(p, KEY2, authdata->key_enc_flags,