@@ -222,15 +222,34 @@ stse_ReturnCode_t stse_platform_nist_kw_encrypt(PLAT_UI8 *pPayload, PLAT_UI32 pa
222222
223223#if defined(STSE_CONF_USE_HOST_KEY_ESTABLISHMENT ) || defined(STSE_CONF_USE_SYMMETRIC_KEY_ESTABLISHMENT ) || defined(STSE_CONF_USE_HOST_SESSION )
224224
225+ /*!
226+ * \brief Store session key in platform secure storage
227+ * \param[in] pCypherKey Pointer to the cypher key
228+ * \param[out] pCypherKeyIdx Pointer to receive the index of the stored cypher key
229+ * \param[in] pMACKey Pointer to the MAC key
230+ * \param[out] pMACKeyIdx Pointer to receive the index of the stored MAC key
231+ * \param[in] key_length Length of the keys in bytes
232+ * \return \ref STSE_OK on success; \ref stse_ReturnCode_t error code otherwise
233+ */
234+ stse_ReturnCode_t stse_platform_store_session_key (PLAT_UI8 * pCypherKey , PLAT_UI32 * pCypherKeyIdx ,
235+ PLAT_UI8 * pMACKey , PLAT_UI32 * pMACKeyIdx ,
236+ PLAT_UI16 key_length );
237+
238+ /*!
239+ * \brief Delete session key from platform secure storage
240+ * \param[in] CypherKeyIdx Index of the cypher key to delete
241+ * \param[in] MACKeyIdx Index of the MAC key to delete
242+ * \return \ref STSE_OK on success; \ref stse_ReturnCode_t error code otherwise
243+ */
244+ stse_ReturnCode_t stse_platform_delete_key (PLAT_UI32 CypherKeyIdx , PLAT_UI32 MACKeyIdx );
245+
225246/*!
226247 * \brief Initialize AES CMAC computation
227- * \param[in] pKey Pointer to the key
228- * \param[in] key_length Length of the key
248+ * \param[in] key_idx Index of the key in secure storage
229249 * \param[in] exp_tag_size Expected tag size
230250 * \return \ref STSE_OK on success; \ref stse_ReturnCode_t error code otherwise
231251 */
232- stse_ReturnCode_t stse_platform_aes_cmac_init (const PLAT_UI8 * pKey ,
233- PLAT_UI16 key_length ,
252+ stse_ReturnCode_t stse_platform_aes_cmac_init (const PLAT_UI32 key_idx ,
234253 PLAT_UI16 exp_tag_size );
235254
236255/*!
@@ -260,76 +279,71 @@ stse_ReturnCode_t stse_platform_aes_cmac_verify_finish(PLAT_UI8 *pTag);
260279 * \brief Perform an AES CMAC encryption
261280 * \param[in] pPayload Pointer to Payload
262281 * \param[in] payload_length Length of the payload in bytes
263- * \param[in] pKey Pointer to key
264- * \param[in] key_length Length of the key in bytes
282+ * \param[in] key_idx Index of the key in secure storage
265283 * \param[in] exp_tag_size Expected tag size in bytes
266284 * \param[out] pTag Pointer to Tag
267285 * \param[out] pTag_length Pointer to Tag length value output
268286 * \return \ref STSE_OK on success; \ref stse_ReturnCode_t error code otherwise
269287 */
270288stse_ReturnCode_t stse_platform_aes_cmac_compute (const PLAT_UI8 * pPayload , PLAT_UI16 payload_length ,
271- const PLAT_UI8 * pKey , PLAT_UI16 key_length ,
289+ const PLAT_UI32 key_idx ,
272290 PLAT_UI16 exp_tag_size ,
273291 PLAT_UI8 * pTag , PLAT_UI16 * pTag_length );
274292
275293/*!
276294 * \brief Perform an AES CMAC decryption
277295 * \param[in] pPayload Pointer to Payload
278296 * \param[in] payload_length Length of the payload in bytes
279- * \param[in] pKey Pointer to key
280- * \param[in] key_length Length of the key in bytes
297+ * \param[in] key_idx Index of the key in secure storage
281298 * \param[in] pTag Pointer to Tag
282299 * \param[in] tag_length Pointer to Tag length value output
283300 * \return \ref STSE_OK on success; \ref stse_ReturnCode_t error code otherwise
284301 */
285302stse_ReturnCode_t stse_platform_aes_cmac_verify (const PLAT_UI8 * pPayload , PLAT_UI16 payload_length ,
286- const PLAT_UI8 * pKey , PLAT_UI16 key_length ,
303+ const PLAT_UI32 key_idx ,
287304 const PLAT_UI8 * pTag , PLAT_UI16 tag_length );
288305
289306/*!
290307 * \brief Perform an AES CBC encryption
291308 * \param[in] pPlaintext Pointer to the plaintext data
292309 * \param[in] plaintext_length Length of the plaintext data
293310 * \param[in] pInitial_value Pointer to encryption IV
294- * \param[in] pKey Pointer to the key
295- * \param[in] key_length Length of the key
311+ * \param[in] key_idx Index of the key in secure storage
296312 * \param[out] pEncryptedtext Pointer to the encrypted payload
297313 * \param[out] pEncryptedtext_length Length of encrypted payload
298314 * \return \ref STSE_OK on success; \ref stse_ReturnCode_t error code otherwise
299315 */
300316stse_ReturnCode_t stse_platform_aes_cbc_enc (const PLAT_UI8 * pPlaintext , PLAT_UI16 plaintext_length ,
301- PLAT_UI8 * pInitial_value , const PLAT_UI8 * pKey ,
302- PLAT_UI16 key_length , PLAT_UI8 * pEncryptedtext ,
317+ PLAT_UI8 * pInitial_value , const PLAT_UI32 key_idx ,
318+ PLAT_UI8 * pEncryptedtext ,
303319 PLAT_UI16 * pEncryptedtext_length );
304320
305321/*!
306322 * \brief Perform an AES CBC decryption
307323 * \param[in] pEncryptedtext Pointer to the encrypted payload
308324 * \param[in] encryptedtext_length Length of encrypted payload
309325 * \param[in] pInitial_value Pointer to decryption IV
310- * \param[in] pKey Pointer to the key
311- * \param[in] key_length Length of the key
326+ * \param[in] key_idx Index of the key in secure storage
312327 * \param[out] pPlaintext Pointer to PlainText payload
313328 * \param[out] pPlaintext_length Length of the PlainText payload
314329 * \return \ref STSE_OK on success; \ref stse_ReturnCode_t error code otherwise
315330 */
316331stse_ReturnCode_t stse_platform_aes_cbc_dec (const PLAT_UI8 * pEncryptedtext , PLAT_UI16 encryptedtext_length ,
317- PLAT_UI8 * pInitial_value , const PLAT_UI8 * pKey ,
318- PLAT_UI16 key_length , PLAT_UI8 * pPlaintext ,
332+ PLAT_UI8 * pInitial_value , const PLAT_UI32 key_idx ,
333+ PLAT_UI8 * pPlaintext ,
319334 PLAT_UI16 * pPlaintext_length );
320335
321336/*!
322337 * \brief Perform an AES ECB encryption
323338 * \param[in] pPlaintext Pointer to the plaintext data
324339 * \param[in] plaintext_length Length of the plaintext data
325- * \param[in] pKey Pointer to the key
326- * \param[in] key_length Length of the key
340+ * \param[in] key_idx Index of the key in secure storage
327341 * \param[out] pEncryptedtext Pointer to the encrypted payload
328342 * \param[out] pEncryptedtext_length Length of encrypted payload
329343 * \return \ref STSE_OK on success; \ref stse_ReturnCode_t error code otherwise
330344 */
331345stse_ReturnCode_t stse_platform_aes_ecb_enc (const PLAT_UI8 * pPlaintext , PLAT_UI16 plaintext_length ,
332- const PLAT_UI8 * pKey , PLAT_UI16 key_length ,
346+ const PLAT_UI32 key_idx ,
333347 PLAT_UI8 * pEncryptedtext , PLAT_UI16 * pEncryptedtext_length );
334348
335349#endif /* defined(STSE_CONF_USE_HOST_KEY_ESTABLISHMENT) || defined(STSE_CONF_USE_SYMMETRIC_KEY_ESTABLISHMENT) || defined(STSE_CONF_USE_HOST_SESSION) */
0 commit comments