From fdbac5f0f7cf10f47800e08e91295872c99b81a3 Mon Sep 17 00:00:00 2001 From: lichaochen_huawei Date: Wed, 27 Aug 2025 15:37:08 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AE=97=E6=B3=95=E5=BA=93capi=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=9A=8F=E6=9C=BA=E6=95=B0=E5=BC=80=E5=90=AF=E7=A1=AC?= =?UTF-8?q?=E4=BB=B6=E7=86=B5=E6=BA=90=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lichaochen_huawei --- CryptoArchitectureKit/crypto_rand.h | 13 +++++++++++++ CryptoArchitectureKit/libcrypto.ndk.json | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/CryptoArchitectureKit/crypto_rand.h b/CryptoArchitectureKit/crypto_rand.h index 1e9a4f8e017..a3b261c830a 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 76e0508480c..81eb1be27b4 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" -- Gitee