MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ccp_set_session_parameters

Function ccp_set_session_parameters

dpdk/drivers/crypto/ccp/ccp_crypto.c:1168–1228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1166}
1167
1168int
1169ccp_set_session_parameters(struct ccp_session *sess,
1170 const struct rte_crypto_sym_xform *xform,
1171 struct ccp_private *internals)
1172{
1173 const struct rte_crypto_sym_xform *cipher_xform = NULL;
1174 const struct rte_crypto_sym_xform *auth_xform = NULL;
1175 const struct rte_crypto_sym_xform *aead_xform = NULL;
1176 int ret = 0;
1177
1178 sess->auth_opt = internals->auth_opt;
1179 sess->cmd_id = ccp_get_cmd_id(xform);
1180
1181 switch (sess->cmd_id) {
1182 case CCP_CMD_CIPHER:
1183 cipher_xform = xform;
1184 break;
1185 case CCP_CMD_AUTH:
1186 auth_xform = xform;
1187 break;
1188 case CCP_CMD_CIPHER_HASH:
1189 cipher_xform = xform;
1190 auth_xform = xform->next;
1191 break;
1192 case CCP_CMD_HASH_CIPHER:
1193 auth_xform = xform;
1194 cipher_xform = xform->next;
1195 break;
1196 case CCP_CMD_COMBINED:
1197 aead_xform = xform;
1198 break;
1199 default:
1200 CCP_LOG_ERR("Unsupported cmd_id");
1201 return -1;
1202 }
1203
1204 /* Default IV length = 0 */
1205 sess->iv.length = 0;
1206 if (cipher_xform) {
1207 ret = ccp_configure_session_cipher(sess, cipher_xform);
1208 if (ret != 0) {
1209 CCP_LOG_ERR("Invalid/unsupported cipher parameters");
1210 return ret;
1211 }
1212 }
1213 if (auth_xform) {
1214 ret = ccp_configure_session_auth(sess, auth_xform);
1215 if (ret != 0) {
1216 CCP_LOG_ERR("Invalid/unsupported auth parameters");
1217 return ret;
1218 }
1219 }
1220 if (aead_xform) {
1221 ret = ccp_configure_session_aead(sess, aead_xform);
1222 if (ret != 0) {
1223 CCP_LOG_ERR("Invalid/unsupported aead parameters");
1224 return ret;
1225 }

Callers 2

get_ccp_sessionFunction · 0.85

Calls 4

ccp_get_cmd_idFunction · 0.85

Tested by

no test coverage detected