openthread_sys

Function otPlatCryptoImportKey

Source
pub unsafe extern "C" fn otPlatCryptoImportKey(
    aKeyRef: *mut otCryptoKeyRef,
    aKeyType: otCryptoKeyType,
    aKeyAlgorithm: otCryptoKeyAlgorithm,
    aKeyUsage: c_int,
    aKeyPersistence: otCryptoKeyStorage,
    aKey: *const u8,
    aKeyLen: usize,
) -> otError
Expand description

Import a key into PSA ITS.

@param[in,out] aKeyRef Pointer to the key ref to be used for crypto operations. @param[in] aKeyType Key Type encoding for the key. @param[in] aKeyAlgorithm Key algorithm encoding for the key. @param[in] aKeyUsage Key Usage encoding for the key (combinations of OT_CRYPTO_KEY_USAGE_*). @param[in] aKeyPersistence Key Persistence for this key @param[in] aKey Actual key to be imported. @param[in] aKeyLen Length of the key to be imported.

@retval OT_ERROR_NONE Successfully imported the key. @retval OT_ERROR_FAILED Failed to import the key. @retval OT_ERROR_INVALID_ARGS @p aKey was set to NULL.

@note If OT_CRYPTO_KEY_STORAGE_PERSISTENT is passed for aKeyPersistence then @p aKeyRef is input and platform should use the given aKeyRef and MUST not change it.

  If OT_CRYPTO_KEY_STORAGE_VOLATILE is passed for aKeyPersistence then @p aKeyRef is output, the initial
  value does not matter and platform API MUST update it to return the new key ref.

  This API is only used by OT core when `OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is enabled.