| 1103 | } |
| 1104 | |
| 1105 | static int |
| 1106 | pdcp_entity_priv_populate(struct entity_priv *en_priv, const struct rte_pdcp_entity_conf *conf) |
| 1107 | { |
| 1108 | struct rte_crypto_sym_xform *c_xfrm, *a_xfrm; |
| 1109 | int ret; |
| 1110 | |
| 1111 | ret = pdcp_crypto_xfrm_get(conf, &c_xfrm, &a_xfrm); |
| 1112 | if (ret) |
| 1113 | return ret; |
| 1114 | |
| 1115 | /** |
| 1116 | * flags.is_authenticated |
| 1117 | * |
| 1118 | * MAC-I would be added in case of control plane packets and when authentication |
| 1119 | * transform is not NULL. |
| 1120 | */ |
| 1121 | |
| 1122 | if ((conf->pdcp_xfrm.domain == RTE_SECURITY_PDCP_MODE_CONTROL) && (a_xfrm == NULL)) |
| 1123 | return -EINVAL; |
| 1124 | |
| 1125 | if (a_xfrm != NULL) |
| 1126 | en_priv->flags.is_authenticated = 1; |
| 1127 | |
| 1128 | /** |
| 1129 | * flags.is_cipher_in_bits |
| 1130 | * |
| 1131 | * For ZUC & SNOW3G cipher algos, offset & length need to be provided in bits. |
| 1132 | */ |
| 1133 | |
| 1134 | if ((c_xfrm->cipher.algo == RTE_CRYPTO_CIPHER_SNOW3G_UEA2) || |
| 1135 | (c_xfrm->cipher.algo == RTE_CRYPTO_CIPHER_ZUC_EEA3)) |
| 1136 | en_priv->flags.is_cipher_in_bits = 1; |
| 1137 | |
| 1138 | /** |
| 1139 | * flags.is_auth_in_bits |
| 1140 | * |
| 1141 | * For ZUC & SNOW3G authentication algos, offset & length need to be provided in bits. |
| 1142 | */ |
| 1143 | |
| 1144 | if (a_xfrm != NULL) { |
| 1145 | if ((a_xfrm->auth.algo == RTE_CRYPTO_AUTH_SNOW3G_UIA2) || |
| 1146 | (a_xfrm->auth.algo == RTE_CRYPTO_AUTH_ZUC_EIA3)) |
| 1147 | en_priv->flags.is_auth_in_bits = 1; |
| 1148 | } |
| 1149 | |
| 1150 | /** |
| 1151 | * flags.is_ul_entity |
| 1152 | * |
| 1153 | * Indicate whether the entity is UL/transmitting PDCP entity. |
| 1154 | */ |
| 1155 | if (conf->pdcp_xfrm.pkt_dir == RTE_SECURITY_PDCP_UPLINK) |
| 1156 | en_priv->flags.is_ul_entity = 1; |
| 1157 | |
| 1158 | /** |
| 1159 | * flags.is_null_auth |
| 1160 | * |
| 1161 | * For NULL auth, 4B zeros need to be added by lib PDCP. Indicate that |
| 1162 | * algo is NULL auth to perform the same. |
no test coverage detected