/** Configure the session from a crypto xform chain (PMD ops callback).
*
* @param dev Pointer to the device structure.
- * @param xform Pointer to the crytpo configuration structure.
+ * @param xform Pointer to the crypto configuration structure.
* @param sess Pointer to the empty session structure.
* @returns 0 upon success, negative value otherwise.
*/
return -ENOMEM;
}
+ memset(sess_private_data, 0, sizeof(struct mrvl_crypto_session));
+
ret = mrvl_crypto_set_session_parameters(sess_private_data, xform);
if (ret != 0) {
MRVL_LOG(ERR, "Failed to configure session parameters!");
return -EIO;
}
+ /* free the keys memory allocated for session creation */
+ if (mrvl_sess->sam_sess_params.cipher_key != NULL)
+ free(mrvl_sess->sam_sess_params.cipher_key);
+ if (mrvl_sess->sam_sess_params.auth_key != NULL)
+ free(mrvl_sess->sam_sess_params.auth_key);
+
return 0;
}