/ohos5.0/base/security/huks/services/huks_standard/huks_engine/main/core_dependency/src/ |
H A D | hks_chipset_platform_key_hardcoded.c | 76 static int32_t MallocFullPlatformPrivateKey(struct HksBlob *privateKey) in MallocFullPlatformPrivateKey() argument 85 privateKey->data = (uint8_t *)HksMalloc(FULL_PLATFORM_PRIVATE_KEY_SIZE); in MallocFullPlatformPrivateKey() 86 HKS_IF_NULL_LOGE_RETURN(privateKey->data, HKS_ERROR_MALLOC_FAIL, "malloc private key failed") in MallocFullPlatformPrivateKey() 87 privateKey->size = FULL_PLATFORM_PRIVATE_KEY_SIZE; in MallocFullPlatformPrivateKey() 89 …int32_t ret = memcpy_s(privateKey->data, privateKey->size, &privateKeyMaterial, sizeof(privateKeyM… in MallocFullPlatformPrivateKey() 91 …ret = memcpy_s(privateKey->data + sizeof(privateKeyMaterial), privateKey->size - sizeof(privateKey… in MallocFullPlatformPrivateKey() 94 … ret = memcpy_s(privateKey->data + sizeof(privateKeyMaterial) + PLATFORM_KEY_PLATFORM_PUB_KEY_SIZE, in MallocFullPlatformPrivateKey() 95 privateKey->size - sizeof(privateKeyMaterial) - PLATFORM_KEY_PLATFORM_PUB_KEY_SIZE, in MallocFullPlatformPrivateKey() 100 …(void)(memset_s(privateKey->data, FULL_PLATFORM_PRIVATE_KEY_SIZE, 0, FULL_PLATFORM_PRIVATE_KEY_SIZ… in MallocFullPlatformPrivateKey() 101 HKS_FREE_BLOB(*privateKey); in MallocFullPlatformPrivateKey()
|
/ohos5.0/base/security/huks/test/unittest/huks_lite_test/liteos_a_adapter/ |
H A D | hks_agreement_test.cpp | 79 …nt32_t AgreeKey(const struct HksTestAgreeParamSet *agreeParamSetParams, struct HksBlob *privateKey, in AgreeKey() argument 93 ret = HksAgreeKeyRun(agreeParamSetTest, privateKey, peerPublicKey, agreedKey, 1); in AgreeKey() 106 struct HksBlob *privateKey = NULL; variable 113 …ret = GenerateLocalX25519Key(&privateKey, NULL, &g_testAgreeParams[0].localPrivateKeyParams, NULL); 127 ret = AgreeKey(&g_testAgreeParams[0].agreeParamSetParams, privateKey, peerPublicKey, agreeKey); 135 ret = HksDeleteKeyForDe(privateKey, NULL); 140 TestFreeBlob(&privateKey); 155 struct HksBlob *privateKey = NULL; variable 184 ret = AgreeKey(&g_testAgreeParams[0].agreeParamSetParams, privateKey, peerPublicKey2, agreeKey); 196 ASSERT_TRUE(HksDeleteKeyForDe(privateKey, NULL) == 0); [all …]
|
/ohos5.0/base/security/huks/test/unittest/huks_lite_test/liteos_m_adapter/ |
H A D | hks_agreement_test.c | 81 …nt32_t AgreeKey(const struct HksTestAgreeParamSet *agreeParamSetParams, struct HksBlob *privateKey, in AgreeKey() argument 95 ret = HksAgreeKeyRun(agreeParamSet, privateKey, peerPublicKey, agreedKey, 1); in AgreeKey() 108 struct HksBlob *privateKey = NULL; in LITE_TEST_CASE() local 115 …ret = GenerateLocalX25519Key(&privateKey, NULL, &g_testAgreeParams[0].localPrivateKeyParams, NULL); in LITE_TEST_CASE() 129 ret = AgreeKey(&g_testAgreeParams[0].agreeParamSetParams, privateKey, peerPublicKey, agreeKey); in LITE_TEST_CASE() 137 ret = HksDeleteKeyForDe(privateKey, NULL); in LITE_TEST_CASE() 142 TestFreeBlob(&privateKey); in LITE_TEST_CASE() 158 struct HksBlob *privateKey = NULL; in LITE_TEST_CASE() local 182 ret = AgreeKey(&g_testAgreeParams[0].agreeParamSetParams, privateKey, peerPublicKey1, agreeKey); in LITE_TEST_CASE() 200 TEST_ASSERT_TRUE(HksDeleteKeyForDe(privateKey, NULL) == 0); in LITE_TEST_CASE() [all …]
|
/ohos5.0/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/ |
H A D | hks_agreement_test.cpp | 79 …nt32_t AgreeKey(const struct HksTestAgreeParamSet *agreeParamSetParams, struct HksBlob *privateKey, in AgreeKey() argument 93 ret = HksAgreeKeyRun(agreeParamSetTest, privateKey, peerPublicKey, agreedKey, 1); in AgreeKey() 106 struct HksBlob *privateKey = NULL; variable 113 …ret = GenerateLocalX25519Key(&privateKey, NULL, &g_testAgreeParams[0].localPrivateKeyParams, NULL); 127 …ret = AgreeKey(&g_testAgreeParams[0].agreeParamSetParams, privateKey, peerPublicKeyTest, agreeKey); 135 ret = HksDeleteKeyForDe(privateKey, NULL); 140 TestFreeBlob(&privateKey);
|
/ohos5.0/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/alg_module_test/src/ |
H A D | hks_rsa_common_mt.cpp | 62 ASSERT_NE(privateKey.data, nullptr); in GenerateKeyTestCase() 92 HKS_FREE(privateKey.data); in GenerateKeyTestCase() 126 HksBlob privateKey = { .size = priKeyExport->blob.size, in EncryptLocalTestCase() local 128 ASSERT_NE(privateKey.data, nullptr); in EncryptLocalTestCase() 159 HKS_FREE(privateKey.data); in EncryptLocalTestCase() 259 ASSERT_NE(privateKey.data, nullptr); in DecryptLocalTestCase() 287 HKS_FREE(privateKey.data); in DecryptLocalTestCase() 375 ASSERT_NE(privateKey.data, nullptr); in SignLocalTestCase() 413 HKS_FREE(privateKey.data); in SignLocalTestCase() 502 ASSERT_NE(privateKey.data, nullptr); in VerifyLocalTestCase() [all …]
|
H A D | hks_dsa_mt.cpp | 674 HksBlob privateKey = { in GenerateKeyTestCase() local 678 ASSERT_NE(privateKey.data, nullptr); in GenerateKeyTestCase() 679 (void)memcpy_s(privateKey.data, priKeyExport01->blob.size, in GenerateKeyTestCase() 689 EXPECT_EQ(OpensslSignDsa(&plainText, &signData, &privateKey, testCaseParams.keyDigest), in GenerateKeyTestCase() 696 HKS_FREE(privateKey.data); in GenerateKeyTestCase() 738 HksBlob privateKey = { in SignLocalTestCase() local 742 ASSERT_NE(privateKey.data, nullptr); in SignLocalTestCase() 758 HKS_FREE(privateKey.data); in SignLocalTestCase() 862 HksBlob privateKey = { in VerifyLocalTestCase() local 866 ASSERT_NE(privateKey.data, nullptr); in VerifyLocalTestCase() [all …]
|
/ohos5.0/base/security/huks/frameworks/crypto_lite/cipher/src/ |
H A D | cipher_rsa.c | 47 char *privateKey = malloc(keyFinalLen); in RsaMallocPrivateKey() local 48 if (privateKey == NULL) { in RsaMallocPrivateKey() 52 (void)memset_s(privateKey, keyFinalLen, 0, keyFinalLen); in RsaMallocPrivateKey() 53 ret = memcpy_s(privateKey, keyFinalLen, start, startLen); in RsaMallocPrivateKey() 56 free(privateKey); in RsaMallocPrivateKey() 60 ret = memcpy_s(privateKey + startLen, keyFinalLen - startLen, key, *keyLen); in RsaMallocPrivateKey() 63 free(privateKey); in RsaMallocPrivateKey() 67 ret = memcpy_s(privateKey + startLen + *keyLen, keyFinalLen - startLen - *keyLen, end, endLen); in RsaMallocPrivateKey() 70 (void)memset_s(privateKey, keyFinalLen, 0, keyFinalLen); in RsaMallocPrivateKey() 71 free(privateKey); in RsaMallocPrivateKey() [all …]
|
/ohos5.0/base/security/crypto_framework/plugin/openssl_plugin/crypto_operation/signature/src/ |
H A D | dsa_openssl.c | 64 static bool IsSignInitInputValid(HcfSignSpi *self, HcfPriKey *privateKey) in IsSignInitInputValid() argument 66 if ((self == NULL) || (privateKey == NULL)) { in IsSignInitInputValid() 71 (!HcfIsClassMatch((HcfObjectBase *)privateKey, OPENSSL_DSA_PRIKEY_CLASS))) { in IsSignInitInputValid() 188 static HcfResult EngineDsaSignInit(HcfSignSpi *self, HcfParamsSpec *params, HcfPriKey *privateKey) in EngineDsaSignInit() argument 191 if (!IsSignInitInputValid(self, privateKey)) { in EngineDsaSignInit() 194 EVP_PKEY *pKey = CreateDsaEvpKeyByDsa((HcfKey *)privateKey, true); in EngineDsaSignInit() 211 …sult EngineDsaSignWithoutDigestInit(HcfSignSpi *self, HcfParamsSpec *params, HcfPriKey *privateKey) in EngineDsaSignWithoutDigestInit() argument 214 if (!IsSignInitInputValid(self, privateKey)) { in EngineDsaSignWithoutDigestInit() 217 EVP_PKEY *pKey = CreateDsaEvpKeyByDsa((HcfKey *)privateKey, true); in EngineDsaSignWithoutDigestInit()
|
H A D | ed25519_openssl.c | 96 static HcfResult EngineSignInit(HcfSignSpi *self, HcfParamsSpec *params, HcfPriKey *privateKey) in EngineSignInit() argument 99 if ((self == NULL) || (privateKey == NULL)) { in EngineSignInit() 104 (!HcfIsClassMatch((HcfObjectBase *)privateKey, OPENSSL_ALG25519_PRIKEY_CLASS))) { in EngineSignInit() 116 ((HcfOpensslAlg25519PriKey *)privateKey)->pkey) != HCF_OPENSSL_SUCCESS) { in EngineSignInit()
|
H A D | signature_rsa_openssl.c | 197 static HcfResult SetOnlySignParams(HcfSignSpiRsaOpensslImpl *impl, HcfPriKey *privateKey) in SetOnlySignParams() argument 199 EVP_PKEY *dupKey = InitRsaEvpKey((HcfKey *)privateKey, true); in SetOnlySignParams() 236 static HcfResult SetSignParams(HcfSignSpiRsaOpensslImpl *impl, HcfPriKey *privateKey) in SetSignParams() argument 239 return SetOnlySignParams(impl, privateKey); in SetSignParams() 241 EVP_PKEY *dupKey = InitRsaEvpKey((HcfKey *)privateKey, true); in SetSignParams() 274 static HcfResult EngineSignInit(HcfSignSpi *self, HcfParamsSpec *params, HcfPriKey *privateKey) in EngineSignInit() argument 277 if (self == NULL || privateKey == NULL) { in EngineSignInit() 290 if (CheckInitKeyType((HcfKey *)privateKey, true) != HCF_SUCCESS) { in EngineSignInit() 295 HcfResult ret = SetSignParams(impl, privateKey); in EngineSignInit()
|
H A D | sm2_openssl.c | 169 static bool IsSm2SignInitInputValid(HcfSignSpi *self, HcfPriKey *privateKey) in IsSm2SignInitInputValid() argument 171 if ((self == NULL) || (privateKey == NULL)) { in IsSm2SignInitInputValid() 176 (!HcfIsClassMatch((HcfObjectBase *)privateKey, HCF_OPENSSL_SM2_PRI_KEY_CLASS))) { in IsSm2SignInitInputValid() 188 static HcfResult EngineSignInit(HcfSignSpi *self, HcfParamsSpec *params, HcfPriKey *privateKey) in EngineSignInit() argument 191 if (!IsSm2SignInitInputValid(self, privateKey)) { in EngineSignInit() 195 EC_KEY *ecKey = OpensslEcKeyDup(((HcfOpensslSm2PriKey *)privateKey)->ecKey); in EngineSignInit()
|
H A D | ecdsa_openssl.c | 119 static HcfResult EngineSignInit(HcfSignSpi *self, HcfParamsSpec *params, HcfPriKey *privateKey) in EngineSignInit() argument 122 if ((self == NULL) || (privateKey == NULL)) { in EngineSignInit() 127 (!HcfIsClassMatch((HcfObjectBase *)privateKey, HCF_OPENSSL_ECC_PRI_KEY_CLASS))) { in EngineSignInit() 138 EC_KEY *ecKey = OpensslEcKeyDup(((HcfOpensslEccPriKey *)privateKey)->ecKey); in EngineSignInit()
|
/ohos5.0/base/security/huks/frameworks/huks_standard/main/os_dependency/ipc/src/ |
H A D | hks_ipc_check.c | 150 int32_t HksCheckIpcAgreeKey(const struct HksParamSet *paramSet, const struct HksBlob *privateKey, in HksCheckIpcAgreeKey() argument 153 int32_t ret = HksCheckBlob3AndParamSet(privateKey, peerPublicKey, agreedKey, paramSet); in HksCheckIpcAgreeKey() 156 if ((privateKey->size > MAX_PROCESS_SIZE) || (peerPublicKey->size > MAX_PROCESS_SIZE)) { in HksCheckIpcAgreeKey() 159 …if ((ALIGN_SIZE(paramSet->paramSetSize) + sizeof(privateKey->size) + ALIGN_SIZE(privateKey->size) + in HksCheckIpcAgreeKey()
|
/ohos5.0/docs/zh-cn/application-dev/security/CryptoArchitectureKit/ |
H A D | crypto-rsa-asym-encrypt-decrypt-pkcs1.md | 49 …async function decryptMessagePromise(privateKey: cryptoFramework.PriKey, cipherText: cryptoFramewo… 51 await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, privateKey, null); 99 …function decryptMessage(privateKey: cryptoFramework.PriKey, cipherText: cryptoFramework.DataBlob) { 101 decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, privateKey, null);
|
H A D | crypto-sm2-asym-encrypt-decrypt.md | 50 …async function decryptMessagePromise(privateKey: cryptoFramework.PriKey, cipherText: cryptoFramewo… 52 await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, privateKey, null); 101 …function decryptMessage(privateKey: cryptoFramework.PriKey, cipherText: cryptoFramework.DataBlob) { 103 decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, privateKey, null);
|
/ohos5.0/base/security/huks/interfaces/inner_api/huks_standard/source/ |
H A D | hks_api_adapter.c | 69 int32_t HksAgreeKeyAdapter(const struct HksParamSet *paramSet, const struct HksBlob *privateKey, in HksAgreeKeyAdapter() argument 79 ret = HksClientAgreeKey(paramSet, privateKey, &publicKey, agreedKey); in HksAgreeKeyAdapter()
|
/ohos5.0/base/security/crypto_framework/plugin/openssl_plugin/crypto_operation/key_agreement/src/ |
H A D | ecdh_openssl.c | 61 static EVP_PKEY *NewPKeyByEccPriKey(HcfOpensslEccPriKey *privateKey) in NewPKeyByEccPriKey() argument 63 EC_KEY *ecKey = OpensslEcKeyDup(privateKey->ecKey); in NewPKeyByEccPriKey()
|
/ohos5.0/base/security/huks/services/huks_standard/huks_service/main/os_dependency/ca/ |
H A D | hks_ca_access.c | 83 int32_t HksAccessAgreeKey(const struct HksParamSet *paramSet, const struct HksBlob *privateKey, in HksAccessAgreeKey() argument 86 return HksTeeAgreeKey(paramSet, privateKey, peerPublicKey, agreedKey); in HksAccessAgreeKey()
|
/ohos5.0/base/security/huks/test/unittest/huks_common_test/src/ |
H A D | hks_test_common_func.cpp | 620 int32_t GenerateLocalX25519Key(struct HksBlob **privateKey, struct HksBlob **publicKey, in GenerateLocalX25519Key() argument 624 if ((privateKey != NULL) && (localPrivateKeyParams != NULL)) { in GenerateLocalX25519Key() 625 ret = TestConstuctBlob(privateKey, in GenerateLocalX25519Key() 666 if ((privateKey != NULL) && ((*privateKey) != NULL) && (localPrivateKeyParams != NULL) && in GenerateLocalX25519Key() 669 ret = memcpy_s((*privateKey)->data, (*privateKey)->size, in GenerateLocalX25519Key()
|
/ohos5.0/foundation/communication/netstack/frameworks/native/tls_socket/src/ |
H A D | tls_key.cpp | 263 char privateKey[FILE_READ_KEY_LEN] = {0}; in DecodePem() local 264 if (!fread(privateKey, 1, FILE_READ_KEY_LEN, fp)) { in DecodePem() 270 const char *privateKeyData = static_cast<const char *>(privateKey); in DecodePem()
|
/ohos5.0/docs/en/application-dev/security/CryptoArchitectureKit/ |
H A D | crypto-rsa-asym-encrypt-decrypt-pkcs1.md | 49 …async function decryptMessagePromise(privateKey: cryptoFramework.PriKey, cipherText: cryptoFramewo… 51 await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, privateKey, null); 99 …function decryptMessage(privateKey: cryptoFramework.PriKey, cipherText: cryptoFramework.DataBlob) { 101 decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, privateKey, null);
|
H A D | crypto-sm2-asym-encrypt-decrypt.md | 50 …async function decryptMessagePromise(privateKey: cryptoFramework.PriKey, cipherText: cryptoFramewo… 52 await decoder.init(cryptoFramework.CryptoMode.DECRYPT_MODE, privateKey, null); 101 …function decryptMessage(privateKey: cryptoFramework.PriKey, cipherText: cryptoFramework.DataBlob) { 103 decoder.initSync(cryptoFramework.CryptoMode.DECRYPT_MODE, privateKey, null);
|
/ohos5.0/base/security/huks/frameworks/huks_standard/main/core/src/ |
H A D | hks_local_engine.c | 121 int32_t HksLocalAgreeKey(const struct HksParamSet *paramSet, const struct HksBlob *privateKey, in HksLocalAgreeKey() argument 124 HKS_IF_NOT_SUCC_RETURN(HksCheckBlob3AndParamSet(privateKey, peerPublicKey, agreedKey, paramSet), in HksLocalAgreeKey() 127 int32_t ret = HksCoreCheckAgreeKeyParams(paramSet, privateKey, peerPublicKey, agreedKey, true); in HksLocalAgreeKey() 134 ret = HksSetKeyToMaterial(spec.algType, false, privateKey, &privateKeyMaterial); in HksLocalAgreeKey()
|
/ohos5.0/foundation/communication/wifi/wifi/test/fuzztest/wifi_sta/wifidevicestub_fuzzer/ |
H A D | wifidevicestub_fuzzer.cpp | 791 config.wifiEapConfig.privateKey = std::string(reinterpret_cast<const char*>(data), size); in WifiDeviceServiceImplTest() 819 config.wifiEapConfig.privateKey = std::string(reinterpret_cast<const char*>(data), size); in CheckConfigEapTest() 843 config.wifiEapConfig.privateKey = std::string(reinterpret_cast<const char*>(data), size); in CheckConfigWapiTest() 865 config.wifiEapConfig.privateKey = std::string(reinterpret_cast<const char*>(data), size); in CheckConfigPwdTest() 881 config.wifiEapConfig.privateKey = std::string(reinterpret_cast<const char*>(data), size); in InitWifiBrokerProcessInfoTest() 904 config.wifiEapConfig.privateKey = std::string(reinterpret_cast<const char*>(data), size); in RemoveCandidateConfigFuzzTest() 930 config.wifiEapConfig.privateKey = std::string(reinterpret_cast<const char*>(data), size); in AddDeviceConfigTest() 955 config.wifiEapConfig.privateKey = std::string(reinterpret_cast<const char*>(data), size); in ConnectToDeviceTest() 1005 config.wifiEapConfig.privateKey = std::string(reinterpret_cast<const char*>(data), size); in HilinkGetMacAddressTest() 1022 config.wifiEapConfig.privateKey = std::string(reinterpret_cast<const char*>(data), size); in EnableHiLinkHandshakeTest()
|
/ohos5.0/base/security/huks/test/unittest/huks_standard_test/module_test/mock/idl/src/ |
H A D | huks_access_mock.c | 139 …FI(int32_t HuksAccessAgreeKey(const struct HksParamSet *paramSet, const struct HksBlob *privateKey, in ENABLE_CFI() argument 142 return HksCoreAgreeKey(paramSet, privateKey, peerPublicKey, agreedKey); in ENABLE_CFI()
|