COPY_DATA(p, pdb->ip_hdr, pdb->ip_hdr_len);
SET_LABEL(p, hdr);
pkeyjmp = JUMP(p, keyjmp, LOCAL_JUMP, ALL_TRUE, BOTH|SHRD);
- if (authdata->keylen) {
- if (rta_sec_era < RTA_SEC_ERA_6)
- KEY(p, MDHA_SPLIT_KEY, authdata->key_enc_flags,
- authdata->key, authdata->keylen,
- INLINE_KEY(authdata));
- else
- __gen_auth_key(p, authdata);
- }
+ if (authdata->keylen)
+ __gen_auth_key(p, authdata);
+
if (cipherdata->keylen)
KEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,
cipherdata->keylen, INLINE_KEY(cipherdata));
__rta_copy_ipsec_decap_pdb(p, pdb, cipherdata->algtype);
SET_LABEL(p, hdr);
pkeyjmp = JUMP(p, keyjmp, LOCAL_JUMP, ALL_TRUE, BOTH|SHRD);
- if (authdata->keylen) {
- if (rta_sec_era < RTA_SEC_ERA_6)
- KEY(p, MDHA_SPLIT_KEY, authdata->key_enc_flags,
- authdata->key, authdata->keylen,
- INLINE_KEY(authdata));
- else
- __gen_auth_key(p, authdata);
- }
+ if (authdata->keylen)
+ __gen_auth_key(p, authdata);
+
if (cipherdata->keylen)
KEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,
cipherdata->keylen, INLINE_KEY(cipherdata));
LABEL(l2copy);
REFERENCE(pl2copy);
- if (rta_sec_era < RTA_SEC_ERA_8) {
- pr_err("IPsec new mode encap: available only for Era %d or above\n",
- USER_SEC_ERA(RTA_SEC_ERA_8));
- return -ENOTSUP;
- }
-
PROGRAM_CNTXT_INIT(p, descbuf, 0);
if (swap)
PROGRAM_SET_BSWAP(p);
LABEL(hdr);
REFERENCE(phdr);
- if (rta_sec_era < RTA_SEC_ERA_8) {
- pr_err("IPsec new mode decap: available only for Era %d or above\n",
- USER_SEC_ERA(RTA_SEC_ERA_8));
- return -ENOTSUP;
- }
-
PROGRAM_CNTXT_INIT(p, descbuf, 0);
if (swap)
PROGRAM_SET_BSWAP(p);
pr_err("SEQ FIFO LOAD: Invalid command\n");
goto err;
}
- if ((rta_sec_era <= RTA_SEC_ERA_5) && (flags & AIDF)) {
- pr_err("SEQ FIFO LOAD: Flag(s) not supported by SEC Era %d\n",
- USER_SEC_ERA(rta_sec_era));
- goto err;
- }
if ((flags & VLF) && ((flags & EXT) || (length >> 16))) {
pr_err("SEQ FIFO LOAD: Invalid usage of VLF\n");
goto err;
goto err;
}
}
- if ((rta_sec_era == RTA_SEC_ERA_7) && (src == AFHA_SBOX)) {
- pr_err("FIFO STORE: AFHA S-box not supported by SEC Era %d\n",
- USER_SEC_ERA(rta_sec_era));
- goto err;
- }
/* write output data type field */
ret = __rta_map_opcode(src, fifo_store_table,
if (encrypt_flags & TK)
opcode |= (0x1 << FIFOST_TYPE_SHIFT);
if (encrypt_flags & EKT) {
- if (rta_sec_era == RTA_SEC_ERA_1) {
- pr_err("FIFO STORE: AES-CCM source types not supported\n");
- ret = -EINVAL;
- goto err;
- }
opcode |= (0x10 << FIFOST_TYPE_SHIFT);
opcode &= (uint32_t)~(0x20 << FIFOST_TYPE_SHIFT);
}
goto err;
}
- if ((rta_sec_era < RTA_SEC_ERA_7) && (flags & MTD) && !(flags & TD)) {
- pr_err("JOB_DESC: Trying to MTD a descriptor that is not a TD. SEC Program Line: %d\n",
- program->current_pc);
- goto err;
- }
-
if ((flags & EXT) && !(flags & SHR) && (start_idx < 2)) {
pr_err("JOB_DESC: Start index must be >= 2 in case of no SHR and EXT. SEC Program Line: %d\n",
program->current_pc);
hdr_ext |= ext_flags & DSEL_MASK;
}
- if (ext_flags & FTD) {
- if (rta_sec_era <= RTA_SEC_ERA_5) {
- pr_err("JOB_DESC: Fake trusted descriptor not supported by SEC Era %d\n",
- USER_SEC_ERA(rta_sec_era));
- goto err;
- }
-
+ if (ext_flags & FTD)
hdr_ext |= HDR_EXT_FTD;
- }
}
if (flags & RSMS)
opcode |= HDR_RSLS;
#ifndef __RTA_JUMP_CMD_H__
#define __RTA_JUMP_CMD_H__
-extern enum rta_sec_era rta_sec_era;
-
static const uint32_t jump_test_cond[][2] = {
{ NIFP, JUMP_COND_NIFP },
{ NIP, JUMP_COND_NIP },
unsigned int start_pc = program->current_pc;
int ret = -EINVAL;
- if (((jump_type == GOSUB) || (jump_type == RETURN)) &&
- (rta_sec_era < RTA_SEC_ERA_4)) {
- pr_err("JUMP: Jump type not supported by SEC Era %d\n",
- USER_SEC_ERA(rta_sec_era));
- goto err;
- }
-
- if (((jump_type == LOCAL_JUMP_INC) || (jump_type == LOCAL_JUMP_DEC)) &&
- (rta_sec_era <= RTA_SEC_ERA_5)) {
- pr_err("JUMP_INCDEC: Jump type not supported by SEC Era %d\n",
- USER_SEC_ERA(rta_sec_era));
- goto err;
- }
-
switch (jump_type) {
case (LOCAL_JUMP):
/*
program->current_instruction);
goto err;
}
- if ((rta_sec_era <= RTA_SEC_ERA_5) &&
- ((flags & VLF) || (flags & AIDF))) {
- pr_err("SEQKEY: Flag(s) not supported by SEC Era %d\n",
- USER_SEC_ERA(rta_sec_era));
- goto err;
- }
} else {
if ((flags & AIDF) || (flags & VLF)) {
pr_err("KEY: Invalid flag. SEC PC: %d; Instr: %d\n",
}
if (key_dst == AFHA_SBOX) {
- if (rta_sec_era == RTA_SEC_ERA_7) {
- pr_err("KEY: AFHA S-box not supported by SEC Era %d\n",
- USER_SEC_ERA(rta_sec_era));
- goto err;
- }
-
if (flags & IMMED) {
pr_err("KEY: Invalid flag. SEC PC: %d; Instr: %d\n",
program->current_pc,
int ret = -EINVAL;
unsigned int start_pc = program->current_pc;
- if (((op == MATH_FUN_BSWAP) && (rta_sec_era < RTA_SEC_ERA_4)) ||
- ((op == MATH_FUN_ZBYT) && (rta_sec_era < RTA_SEC_ERA_2))) {
- pr_err("MATH: operation not supported by SEC Era %d. SEC PC: %d; Instr: %d\n",
- USER_SEC_ERA(rta_sec_era), program->current_pc,
- program->current_instruction);
- goto err;
- }
-
if (options & SWP) {
- if (rta_sec_era < RTA_SEC_ERA_7) {
- pr_err("MATH: operation not supported by SEC Era %d. SEC PC: %d; Instr: %d\n",
- USER_SEC_ERA(rta_sec_era), program->current_pc,
- program->current_instruction);
- goto err;
- }
-
if ((options & IFB) ||
(!(options & IMMED) && !(options & IMMED2)) ||
((options & IMMED) && (options & IMMED2))) {
int ret = -EINVAL;
unsigned int start_pc = program->current_pc;
- if (rta_sec_era < RTA_SEC_ERA_6) {
- pr_err("MATHI: Command not supported by SEC Era %d. SEC PC: %d; Instr: %d\n",
- USER_SEC_ERA(rta_sec_era), program->current_pc,
- program->current_instruction);
- goto err;
- }
-
if (((op == MATH_FUN_FBYT) && (options & SSEL))) {
pr_err("MATHI: Illegal combination - FBYT and SSEL. SEC PC: %d; Instr: %d\n",
program->current_pc, program->current_instruction);
goto err;
}
- if ((options & SWP) && (rta_sec_era < RTA_SEC_ERA_7)) {
- pr_err("MATHI: SWP not supported by SEC Era %d. SEC PC: %d; Instr: %d\n",
- USER_SEC_ERA(rta_sec_era), program->current_pc,
- program->current_instruction);
- goto err;
- }
-
/* Write first operand field */
if (!(options & SSEL))
ret = __rta_map_opcode((uint32_t)operand, math_op1,
bool is_move_len_cmd = false;
unsigned int start_pc = program->current_pc;
- if ((rta_sec_era < RTA_SEC_ERA_7) && (cmd_type != __MOVE)) {
- pr_err("MOVE: MOVEB / MOVEDW not supported by SEC Era %d. SEC PC: %d; Instr: %d\n",
- USER_SEC_ERA(rta_sec_era), program->current_pc,
- program->current_instruction);
- goto err;
- }
-
/* write command type */
if (cmd_type == __MOVEB) {
opcode = CMD_MOVEB;
} else if (cmd_type == __MOVEDW) {
opcode = CMD_MOVEDW;
} else if (!(flags & IMMED)) {
- if (rta_sec_era < RTA_SEC_ERA_3) {
- pr_err("MOVE: MOVE_LEN not supported by SEC Era %d. SEC PC: %d; Instr: %d\n",
- USER_SEC_ERA(rta_sec_era), program->current_pc,
- program->current_instruction);
- goto err;
- }
-
if ((length != MATH0) && (length != MATH1) &&
(length != MATH2) && (length != MATH3)) {
pr_err("MOVE: MOVE_LEN length must be MATH[0-3]. SEC PC: %d; Instr: %d\n",
else
offset = dst_offset;
- if (rta_sec_era < RTA_SEC_ERA_6) {
- if (offset)
- pr_debug("MOVE: Offset not supported by SEC Era %d. SEC PC: %d; Instr: %d\n",
- USER_SEC_ERA(rta_sec_era),
- program->current_pc,
- program->current_instruction);
- /* nothing to do for offset = 0 */
- } else {
- ret = math_offset(offset);
- if (ret < 0) {
- pr_err("MOVE: Invalid offset in MATH register. SEC PC: %d; Instr: %d\n",
- program->current_pc,
- program->current_instruction);
- goto err;
- }
-
- opcode |= (uint32_t)ret;
+ ret = math_offset(offset);
+ if (ret < 0) {
+ pr_err("MOVE: Invalid offset in MATH register. SEC PC: %d; Instr: %d\n",
+ program->current_pc,
+ program->current_instruction);
+ goto err;
}
+
+ opcode |= (uint32_t)ret;
}
/* write source field */
LDST_SRCDST_WORD_INFO_FIFO;
unsigned int start_pc = program->current_pc;
- if ((data == AFHA_SBOX) && (rta_sec_era == RTA_SEC_ERA_7)) {
- pr_err("NFIFO: AFHA S-box not supported by SEC Era %d\n",
- USER_SEC_ERA(rta_sec_era));
- goto err;
- }
-
/* write source field */
ret = __rta_map_opcode(src, nfifo_src, nfifo_src_sz[rta_sec_era], &val);
if (ret < 0) {
uint16_t aes_mode = aai & OP_ALG_AESA_MODE_MASK;
if (aai & OP_ALG_AAI_C2K) {
- if (rta_sec_era < RTA_SEC_ERA_5)
- return -1;
if ((aes_mode != OP_ALG_AAI_CCM) &&
(aes_mode != OP_ALG_AAI_GCM))
return -EINVAL;
case OP_ALG_AAI_CBC_CMAC:
case OP_ALG_AAI_CTR_CMAC_LTE:
case OP_ALG_AAI_CTR_CMAC:
- if (rta_sec_era < RTA_SEC_ERA_2)
- return -EINVAL;
- /* no break */
case OP_ALG_AAI_CTR:
case OP_ALG_AAI_CBC:
case OP_ALG_AAI_ECB:
{
switch (aai) {
case OP_ALG_AAI_HMAC:
- if (rta_sec_era < RTA_SEC_ERA_2)
- return -EINVAL;
- /* no break */
case OP_ALG_AAI_SMAC:
case OP_ALG_AAI_HASH:
case OP_ALG_AAI_HMAC_PRECOMP:
{
switch (aai) {
case OP_ALG_AAI_HMAC:
- if (rta_sec_era < RTA_SEC_ERA_2)
- return -EINVAL;
- /* no break */
case OP_ALG_AAI_HASH:
case OP_ALG_AAI_HMAC_PRECOMP:
return 0;
return -EINVAL;
}
- /* State Handle bits are valid only for SEC Era >= 5 */
- if ((rta_sec_era < RTA_SEC_ERA_5) && rng_sh)
- return -EINVAL;
-
- /* PS, AI, SK bits are also valid only for SEC Era >= 5 */
- if ((rta_sec_era < RTA_SEC_ERA_5) && (aai &
- (OP_ALG_AAI_RNG4_PS | OP_ALG_AAI_RNG4_AI | OP_ALG_AAI_RNG4_SK)))
- return -EINVAL;
-
switch (rng_sh) {
case OP_ALG_AAI_RNG4_SH_0:
case OP_ALG_AAI_RNG4_SH_1:
case OP_PCL_TLS_ECDHE_RSA_WITH_RC4_128_SHA:
case OP_PCL_TLS_ECDH_anon_WITH_RC4_128_SHA:
case OP_PCL_TLS_ECDHE_PSK_WITH_RC4_128_SHA:
- if (rta_sec_era == RTA_SEC_ERA_7)
- return -EINVAL;
- /* fall through if not Era 7 */
case OP_PCL_TLS_RSA_EXPORT_WITH_DES40_CBC_SHA:
case OP_PCL_TLS_RSA_WITH_DES_CBC_SHA:
case OP_PCL_TLS_RSA_WITH_3DES_EDE_CBC_SHA:
switch (proto_cls1) {
case OP_PCL_IPSEC_AES_NULL_WITH_GMAC:
- if (rta_sec_era < RTA_SEC_ERA_2)
- return -EINVAL;
- /* no break */
case OP_PCL_IPSEC_AES_CCM8:
case OP_PCL_IPSEC_AES_CCM12:
case OP_PCL_IPSEC_AES_CCM16:
return 0;
return -EINVAL;
case OP_PCL_IPSEC_NULL:
- if (rta_sec_era < RTA_SEC_ERA_2)
- return -EINVAL;
- /* no break */
case OP_PCL_IPSEC_DES_IV64:
case OP_PCL_IPSEC_DES:
case OP_PCL_IPSEC_3DES:
switch (protoinfo & OP_PCL_BLOB_REG_MASK) {
case OP_PCL_BLOB_AFHA_SBOX:
- if (rta_sec_era < RTA_SEC_ERA_3)
- return -EINVAL;
- /* no break */
case OP_PCL_BLOB_REG_MEMORY:
case OP_PCL_BLOB_REG_KEY1:
case OP_PCL_BLOB_REG_KEY2:
static inline int
__rta_dlc_proto(uint16_t protoinfo)
{
- if ((rta_sec_era < RTA_SEC_ERA_2) &&
- (protoinfo & (OP_PCL_PKPROT_DSA_MSG | OP_PCL_PKPROT_HASH_MASK |
- OP_PCL_PKPROT_EKT_Z | OP_PCL_PKPROT_DECRYPT_Z |
- OP_PCL_PKPROT_DECRYPT_PRI)))
- return -EINVAL;
-
switch (protoinfo & OP_PCL_PKPROT_HASH_MASK) {
case OP_PCL_PKPROT_HASH_MD5:
case OP_PCL_PKPROT_HASH_SHA1:
static inline int
__rta_3g_dcrc_proto(uint16_t protoinfo)
{
- if (rta_sec_era == RTA_SEC_ERA_7)
- return -EINVAL;
-
switch (protoinfo) {
case OP_PCL_3G_DCRC_CRC7:
case OP_PCL_3G_DCRC_CRC11:
static inline int
__rta_3g_rlc_proto(uint16_t protoinfo)
{
- if (rta_sec_era == RTA_SEC_ERA_7)
- return -EINVAL;
-
switch (protoinfo) {
case OP_PCL_3G_RLC_NULL:
case OP_PCL_3G_RLC_KASUMI:
static inline int
__rta_lte_pdcp_proto(uint16_t protoinfo)
{
- if (rta_sec_era == RTA_SEC_ERA_7)
- return -EINVAL;
-
switch (protoinfo) {
case OP_PCL_LTE_ZUC:
- if (rta_sec_era < RTA_SEC_ERA_5)
- break;
case OP_PCL_LTE_NULL:
case OP_PCL_LTE_SNOW:
case OP_PCL_LTE_AES: