diff --git a/CryptoArchitectureKit/crypto_rand.h b/CryptoArchitectureKit/crypto_rand.h index 1e9a4f8e017aaaae3d68c722704b4ef00bfb1acd..a3b261c830acf65f095a5014c3f79836baeec26a 100644 --- a/CryptoArchitectureKit/crypto_rand.h +++ b/CryptoArchitectureKit/crypto_rand.h @@ -98,6 +98,19 @@ const char *OH_CryptoRand_GetAlgoName(OH_CryptoRand *ctx); */ OH_Crypto_ErrCode OH_CryptoRand_SetSeed(OH_CryptoRand *ctx, Crypto_DataBlob *seed); +/** + * @brief Enables the hardware entropy source. + * + * @param ctx Indicates the random number generator context. + * @return {@link OH_Crypto_ErrCode#CRYPTO_SUCCESS} 0 - If the operation is successful. + * {@link OH_Crypto_ErrCode#CRYPTO_NOT_SUPPORTED} 801 - If the operation is not supported. + * {@link OH_Crypto_ErrCode#CRYPTO_MEMORY_ERROR} 17620001 - If memory operation failed. + * {@link OH_Crypto_ErrCode#CRYPTO_PARAMETER_CHECK_FAILED} 17620003 - If parameter check failed. + * {@link OH_Crypto_ErrCode#CRYPTO_OPERTION_ERROR} 17630001 - If crypto operation failed. + * @since 21 + */ +OH_Crypto_ErrCode OH_CryptoRand_EnableHardwareEntropy(OH_CryptoRand *ctx); + /** * @brief Destroys the random number generator context. * diff --git a/CryptoArchitectureKit/libcrypto.ndk.json b/CryptoArchitectureKit/libcrypto.ndk.json index 76e0508480c6fc27ff9d2e82c7aa4d76033b36a4..81eb1be27b4f6cb6b840eb1f90550195ca84c7da 100644 --- a/CryptoArchitectureKit/libcrypto.ndk.json +++ b/CryptoArchitectureKit/libcrypto.ndk.json @@ -367,6 +367,10 @@ "first_introduced": "20", "name": "OH_CryptoRand_SetSeed" }, + { + "first_introduced": "21", + "name": "OH_CryptoRand_EnableHardwareEntropy" + }, { "first_introduced": "20", "name": "OH_CryptoRand_Destroy"