/base/security/crypto_framework/test/fuzztest/key/asykeygenerator_fuzzer/ |
D | asykeygenerator_fuzzer.cpp | 84 (void)keyPair->pubKey->base.getEncoded(&(keyPair->pubKey->base), &pubKeyBlob); in TestRsaKey() 89 HcfPubKey *pubKey = dupKeyPair->pubKey; in TestRsaKey() local 90 (void)pubKey->base.getAlgorithm(&(pubKey->base)); in TestRsaKey() 91 (void)pubKey->base.getFormat(&(pubKey->base)); in TestRsaKey() 92 (void)pubKey->base.base.getClass(); in TestRsaKey()
|
/base/security/crypto_framework/plugin/openssl_plugin/key/asy_key_generator/src/ |
D | ecc_asy_key_generator_openssl.c | 57 const EC_POINT *pubKey = EC_KEY_get0_public_key(ecKey); in NewEcKeyPairByOpenssl() local 60 if ((pubKey == NULL) || (priKey == NULL) || (group == NULL)) { in NewEcKeyPairByOpenssl() 65 EC_POINT *newPubKey = EC_POINT_dup(pubKey, group); in NewEcKeyPairByOpenssl() 154 if (impl->base.pubKey != NULL) { in DestroyEccKeyPair() 155 DestroyEccPubKey((HcfObjectBase *)impl->base.pubKey); in DestroyEccKeyPair() 156 impl->base.pubKey = NULL; in DestroyEccKeyPair() 317 static HcfResult CreateEccPubKey(int32_t curveId, EC_POINT *pubKey, HcfOpensslEccPubKey **returnObj) in CreateEccPubKey() argument 330 returnPubKey->pk = pubKey; in CreateEccPubKey() 356 static HcfResult CreateEccKeyPair(HcfOpensslEccPubKey *pubKey, HcfOpensslEccPriKey *priKey, in CreateEccKeyPair() argument 366 returnKeyPair->base.pubKey = (HcfPubKey *)pubKey; in CreateEccKeyPair() [all …]
|
D | rsa_asy_key_generator_openssl.c | 163 DestroyPubKey((HcfObjectBase *)impl->base.pubKey); in DestroyKeyPair() 164 impl->base.pubKey = NULL; in DestroyKeyPair() 411 static HcfResult DuplicatePkAndSkFromRSA(RSA *rsa, RSA **pubKey, RSA **priKey) in DuplicatePkAndSkFromRSA() argument 417 if (DuplicateRsa(rsa, false, pubKey) != HCF_SUCCESS) { in DuplicatePkAndSkFromRSA() 423 RSA_free(*pubKey); in DuplicatePkAndSkFromRSA() 424 *pubKey = NULL; in DuplicatePkAndSkFromRSA() 436 RSA *pubKey = NULL, *priKey = NULL; in PackKeyPair() local 437 if (DuplicatePkAndSkFromRSA(rsa, &pubKey, &priKey) != HCF_SUCCESS) { in PackKeyPair() 445 RSA_free(pubKey); in PackKeyPair() 451 ret = PackPubKey(pubKey, &pubKeyImpl); in PackKeyPair() [all …]
|
/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/alg_module_test/src/ |
D | openssl_dh_helper.c | 48 const BIGNUM *pubKey = NULL; in DhSaveKeyMaterial() local 50 DH_get0_key(dh, &pubKey, &privKey); in DhSaveKeyMaterial() 51 const uint32_t rawMaterialLen = sizeof(struct KeyMaterialDh) + (uint32_t)BN_num_bytes(pubKey) + in DhSaveKeyMaterial() 61 keyMaterial->pubKeySize = BN_num_bytes(pubKey); in DhSaveKeyMaterial() 66 BN_bn2bin(pubKey, rawMaterial + offset); in DhSaveKeyMaterial() 125 BIGNUM *pubKey = BN_bin2bn(key->data + offset, keyMaterial->pubKeySize, NULL); in InitDhStruct() local 129 if (DH_set0_key(dh, pubKey, privKey) != 1) { in InitDhStruct() 130 if (pubKey != NULL) { in InitDhStruct() 131 BN_free(pubKey); in InitDhStruct() 144 …const int keyLen, const struct HksBlob *nativeKey, const struct HksBlob *pubKey, struct HksBlob *s… in DhAgreeKey() argument [all …]
|
/base/security/huks/frameworks/huks_standard/main/crypto_engine/openssl/src/ |
D | hks_openssl_dh.c | 75 BIGNUM *pubKey = BN_bin2bn(key->data + offset, keyMaterial->pubKeySize, NULL); in InitDhStruct() local 79 if (DH_set0_key(dh, pubKey, privKey) != HKS_OPENSSL_SUCCESS) { in InitDhStruct() 91 const BIGNUM *pubKey = NULL; in DhSaveKeyMaterial() local 93 DH_get0_key(dh, &pubKey, &privKey); in DhSaveKeyMaterial() 94 const uint32_t rawMaterialLen = sizeof(struct KeyMaterialDh) + (uint32_t)BN_num_bytes(pubKey) in DhSaveKeyMaterial() 104 keyMaterial->pubKeySize = (uint32_t)BN_num_bytes(pubKey); in DhSaveKeyMaterial() 109 BN_bn2bin(pubKey, rawMaterial + offset); in DhSaveKeyMaterial() 166 int32_t HksOpensslDhAgreeKey(const struct HksBlob *nativeKey, const struct HksBlob *pubKey, in HksOpensslDhAgreeKey() argument 174 struct KeyMaterialDh *pubKeyMaterial = (struct KeyMaterialDh *)pubKey->data; in HksOpensslDhAgreeKey() 175 …BIGNUM *pub = BN_bin2bn(pubKey->data + sizeof(struct KeyMaterialDh), pubKeyMaterial->pubKeySize, N… in HksOpensslDhAgreeKey()
|
D | hks_openssl_ed25519tox25519.c | 156 uint8_t pubKey[P_BYTES] = {0}; in Curve25519Initialize() local 157 (void)memcpy_s(pubKey, P_BYTES - 1, source, sourceLen - 1); // the 0-30 bit assignment in Curve25519Initialize() 158 pubKey[P_BYTES - 1] = source[P_BYTES - 1] & 0x7f; // the last bit assignment in Curve25519Initialize() 159 SwapEndianThirtyTwoByte(pubKey, sizeof(pubKey), isBigEndian); in Curve25519Initialize() 162 ret = CovertData(curve25519, pubKey, sizeof(pubKey)); in Curve25519Initialize() 280 static int32_t FillPubKeyByZero(uint8_t *pubKey, uint32_t *pubKeySize) in FillPubKeyByZero() argument 285 (void)memcpy_s(tmpKey + baseAddr, P_BYTES - baseAddr, pubKey, *pubKeySize); in FillPubKeyByZero() 286 (void)memcpy_s(pubKey, P_BYTES, tmpKey, P_BYTES); in FillPubKeyByZero()
|
/base/security/crypto_framework/frameworks/js/napi/crypto/src/ |
D | napi_key_pair.cpp | 59 if (this->keyPair_->pubKey != nullptr) { in ConvertToJsKeyPair() 60 NapiPubKey *napiPubKey = new NapiPubKey(this->keyPair_->pubKey); in ConvertToJsKeyPair() 61 napi_value pubKey = napiPubKey->ConvertToJsPubKey(env); in ConvertToJsKeyPair() local 63 env, pubKey, napiPubKey, in ConvertToJsKeyPair() 70 napi_set_named_property(env, instance, CRYPTO_TAG_PUB_KEY.c_str(), pubKey); in ConvertToJsKeyPair()
|
D | napi_pub_key.cpp | 27 NapiPubKey::NapiPubKey(HcfPubKey *pubKey) : NapiKey(reinterpret_cast<HcfKey *>(pubKey)) {} in NapiPubKey() argument 78 HcfPubKey *pubKey = napiPubKey->GetPubKey(); in JsGetEncoded() local 80 HcfResult res = pubKey->base.getEncoded(&pubKey->base, &returnBlob); in JsGetEncoded()
|
D | napi_asy_key_generator.cpp | 57 HcfBlob *pubKey; member 101 HcfBlobDataFree(ctx->pubKey); in FreeConvertKeyCtx() 102 HcfFree(ctx->pubKey); in FreeConvertKeyCtx() 146 HcfBlob *pubKey = nullptr; in GetPkAndSkBlobFromNapiValueIfInput() local 148 pubKey = GetBlobFromNapiValue(env, pkValue); in GetPkAndSkBlobFromNapiValueIfInput() 149 if (pubKey == nullptr) { in GetPkAndSkBlobFromNapiValueIfInput() 169 *returnPubKey = pubKey; in GetPkAndSkBlobFromNapiValueIfInput() 196 HcfBlob *pubKey = nullptr; in BuildConvertKeyCtx() local 198 if (!GetPkAndSkBlobFromNapiValueIfInput(env, argv[PARAM0], argv[PARAM1], &pubKey, &priKey)) { in BuildConvertKeyCtx() 204 ctx->pubKey = pubKey; in BuildConvertKeyCtx() [all …]
|
/base/security/huks/frameworks/huks_standard/main/crypto_engine/mbedtls/src/ |
D | hks_mbedtls_ecdh.c | 43 const struct HksBlob *pubKey, mbedtls_ecdh_context *ctx) in EccKeyMaterialToCtx() argument 45 int32_t ret = HksEccKeyMaterialToPub(pubKey, &(ctx->Qp)); in EccKeyMaterialToCtx() 55 const struct HksBlob *pubKey, const struct HksKeySpec *spec, struct HksBlob *sharedKey) in HksMbedtlsEcdh() argument 57 int32_t ret = EccKeyCheck(pubKey); in HksMbedtlsEcdh() 82 ret = EccKeyMaterialToCtx(nativeKey, pubKey, &ctx); in HksMbedtlsEcdh()
|
D | hks_crypto_ed25519.c | 42 static int32_t SaveEd25519KeyMaterial(const struct HksBlob *pubKey, const struct HksBlob *priKey, in SaveEd25519KeyMaterial() argument 45 uint32_t totalSize = sizeof(struct KeyMaterial25519) + pubKey->size + priKey->size; in SaveEd25519KeyMaterial() 52 keyMaterial->pubKeySize = pubKey->size; in SaveEd25519KeyMaterial() 57 if (memcpy_s(buffer + offset, totalSize - offset, pubKey->data, pubKey->size) != EOK) { in SaveEd25519KeyMaterial() 64 offset += pubKey->size; in SaveEd25519KeyMaterial() 90 uint8_t pubKey[ED25519_PUBLIC_KEY_LEN] = {0}; in HksEd25519GenerateKey() local 92 struct HksBlob pubKeyBlob = { ED25519_PUBLIC_KEY_LEN, pubKey }; in HksEd25519GenerateKey()
|
/base/security/huks/frameworks/huks_standard/main/crypto_engine/mbedtls/include/ |
D | hks_mbedtls_x25519.h | 38 const struct HksBlob *pubKey, const struct HksKeySpec *spec, struct HksBlob *sharedKey); 47 const struct HksBlob *pubKey, const struct HksKeySpec *spec, struct HksBlob *sharedKey);
|
/base/security/huks/utils/crypto_adapter/ |
D | hks_client_service_adapter_lite.c | 161 mbedtls_ecp_keypair *pubKey = mbedtls_pk_ec(*ctx); in InitEccPkCtx() 162 ret = mbedtls_ecp_group_load(&(pubKey->MBEDTLS_PRIVATE(grp)), grp_id); in InitEccPkCtx() 168 … ret = mbedtls_mpi_read_binary(&(pubKey->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(X)), x->data, x->size); in InitEccPkCtx() 174 … ret = mbedtls_mpi_read_binary(&(pubKey->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Y)), y->data, y->size); in InitEccPkCtx() 181 ret = mbedtls_mpi_lset(&(pubKey->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Z)), 1); in InitEccPkCtx() 357 static int32_t X509PublicKeyToEcc(mbedtls_ecp_keypair *pubKey, struct HksBlob *eccPublicKey) in X509PublicKeyToEcc() argument 360 uint32_t xSize = mbedtls_mpi_size(&(pubKey->MBEDTLS_PRIVATE(grp).P)); in X509PublicKeyToEcc() 361 uint32_t ySize = mbedtls_mpi_size(&(pubKey->MBEDTLS_PRIVATE(grp).P)); in X509PublicKeyToEcc() 371 if (mbedtls_mpi_size(&(pubKey->MBEDTLS_PRIVATE(grp).P)) > UINT32_MAX / HKS_BITS_PER_BYTE) { in X509PublicKeyToEcc() 373 …HKS_LOG_E("invalid param, the size is :%" LOG_PUBLIC "u", mbedtls_mpi_size(&(pubKey->MBEDTLS_PRIVA… in X509PublicKeyToEcc() [all …]
|
/base/security/crypto_framework/test/unittest/src/ |
D | crypto_rsa_asy_key_generator_test.cpp | 363 EXPECT_NE(keyPair->pubKey, nullptr); 367 HcfPubKey *pubkey = keyPair->pubKey; 395 EXPECT_NE(keyPair->pubKey, nullptr); 399 HcfPubKey *pubkey = keyPair->pubKey; 426 HcfPubKey *pubKey = keyPair->pubKey; variable 429 res = pubKey->base.getEncoded((HcfKey *)priKey, &pubKeyBlob); 431 res = priKey->base.getEncoded((HcfKey *)pubKey, &priKeyBlob); 447 HcfPubKey *pubKey = keyPair->pubKey; variable 450 res = pubKey->base.getEncoded((HcfKey *)priKey, NULL); 452 res = priKey->base.getEncoded((HcfKey *)pubKey, NULL); [all …]
|
D | crypto_ecc_verify_test.cpp | 520 res = verify->init(verify, NULL, ecc224KeyPair_->pubKey); 535 res = verify->init(verify, NULL, ecc224KeyPair_->pubKey); 550 res = verify->init(verify, NULL, ecc224KeyPair_->pubKey); 565 res = verify->init(verify, NULL, ecc224KeyPair_->pubKey); 580 res = verify->init(verify, NULL, ecc224KeyPair_->pubKey); 595 res = verify->init(verify, NULL, ecc256KeyPair_->pubKey); 610 res = verify->init(verify, NULL, ecc256KeyPair_->pubKey); 625 res = verify->init(verify, NULL, ecc256KeyPair_->pubKey); 640 res = verify->init(verify, NULL, ecc256KeyPair_->pubKey); 655 res = verify->init(verify, NULL, ecc256KeyPair_->pubKey); [all …]
|
D | crypto_ecc_asy_key_generator_test.cpp | 524 const char *className = keyPair->pubKey->base.base.getClass(); 542 keyPair->pubKey->base.base.destroy((HcfObjectBase *)(&(keyPair->pubKey->base.base))); 543 keyPair->pubKey = NULL; 560 keyPair->pubKey->base.base.destroy(NULL); 577 keyPair->pubKey->base.base.destroy(&obj); 594 const char *format = keyPair->pubKey->base.getFormat(&(keyPair->pubKey->base)); 613 const char *format = keyPair->pubKey->base.getFormat(NULL); 632 const char *format = keyPair->pubKey->base.getFormat((HcfKey *)&obj); 651 const char *algName = keyPair->pubKey->base.getAlgorithm(&(keyPair->pubKey->base)); 670 const char *algName = keyPair->pubKey->base.getAlgorithm(NULL); [all …]
|
/base/security/huks/test/unittest/huks_standard_test/crypto_engine_test/src/ |
D | hks_crypto_hal_dsa_sign.cpp | 118 … struct HksBlob pubKey = { .size = PUB_KEY_SIZE, .data = (uint8_t *)HksMalloc(PUB_KEY_SIZE) }; in RunTestCase() local 119 ASSERT_NE(pubKey.data, nullptr); in RunTestCase() 121 EXPECT_EQ(HksCryptoHalGetPubKey(&key, &pubKey), HKS_SUCCESS); in RunTestCase() 123 EXPECT_EQ(HksCryptoHalVerify(&pubKey, &hksUsageSpec, &hash, &signature), HKS_SUCCESS); in RunTestCase() 128 HksFree(pubKey.data); in RunTestCase()
|
/base/security/huks/frameworks/huks_standard/main/crypto_engine/openssl/include/ |
D | hks_openssl_curve25519.h | 33 int32_t HksOpensslX25519AgreeKey(const struct HksBlob *nativeKey, const struct HksBlob *pubKey, 36 int32_t HksOpensslEd25519AgreeKey(const struct HksBlob *nativeKey, const struct HksBlob *pubKey,
|
/base/security/huks/test/fuzz_test/hksimportkey_fuzzer/ |
D | hksimportkey_fuzzer.cpp | 42 struct HksBlob pubKey = { BLOB_SIZE, static_cast<uint8_t *>(myData + BLOB_SIZE) }; in DoSomethingInterestingWithMyAPI() local 47 (void)HksImportKey(&keyAlias, paramSet, &pubKey); in DoSomethingInterestingWithMyAPI()
|
/base/security/huks/test/fuzz_test/hksexportpublickey_fuzzer/ |
D | hksexportpublickey_fuzzer.cpp | 42 struct HksBlob pubKey = { BLOB_SIZE, static_cast<uint8_t *>(myData + BLOB_SIZE) }; in DoSomethingInterestingWithMyAPI() local 47 (void)HksExportPublicKey(&keyAlias, paramSet, &pubKey); in DoSomethingInterestingWithMyAPI()
|
/base/update/updater/services/package/pkg_verify/ |
D | openssl_util.cpp | 141 EVP_PKEY *pubKey = X509_get_pubkey(issuerCert); in VerifyX509CertByIssuerCert() local 142 if (pubKey == nullptr) { in VerifyX509CertByIssuerCert() 147 return (X509_verify(cert, pubKey) == 1); in VerifyX509CertByIssuerCert() 150 int32_t VerifyDigestByPubKey(EVP_PKEY *pubKey, const int nid, const std::vector<uint8_t> &digestDat… in VerifyDigestByPubKey() argument 153 if (pubKey == nullptr) { in VerifyDigestByPubKey() 164 if (EVP_DigestVerifyInit(mdCtx, &pkeyCtx, EVP_get_digestbynid(nid), nullptr, pubKey) != 1) { in VerifyDigestByPubKey()
|
/base/security/huks/frameworks/crypto_lite/cipher/src/ |
D | cipher_rsa.c | 88 char *pubKey = malloc(keyFinalLen); in RsaMallocPublicKey() local 89 if (pubKey == NULL) { in RsaMallocPublicKey() 93 (void)memset_s(pubKey, keyFinalLen, 0, keyFinalLen); in RsaMallocPublicKey() 94 ret = memcpy_s(pubKey, keyFinalLen, start, startLen); in RsaMallocPublicKey() 97 free(pubKey); in RsaMallocPublicKey() 101 ret = memcpy_s(pubKey + startLen, keyFinalLen - startLen, key, *keyLen); in RsaMallocPublicKey() 104 free(pubKey); in RsaMallocPublicKey() 108 ret = memcpy_s(pubKey + startLen + *keyLen, keyFinalLen - startLen - *keyLen, end, endLen); in RsaMallocPublicKey() 111 (void)memset_s(pubKey, keyFinalLen, 0, keyFinalLen); in RsaMallocPublicKey() 112 free(pubKey); in RsaMallocPublicKey() [all …]
|
/base/security/huks/services/huks_standard/huks_engine/main/core/src/ |
D | hks_upgrade_key_info.c | 288 static int32_t ConvertEd25519ToNewFormat(uint8_t flag, const struct HksBlob *pubKey, const struct H… in ConvertEd25519ToNewFormat() argument 291 uint32_t totalSize = sizeof(struct KeyMaterial25519) + pubKey->size + priKey->size; in ConvertEd25519ToNewFormat() 298 keyMaterial->pubKeySize = pubKey->size; in ConvertEd25519ToNewFormat() 303 if (memcpy_s(buffer + offset, pubKey->size, pubKey->data, pubKey->size) != EOK) { in ConvertEd25519ToNewFormat() 311 offset += pubKey->size; in ConvertEd25519ToNewFormat() 329 struct HksBlob pubKey = { 0, NULL }; in ConvertToNewFormat() local 336 pubKey.size = rawKey->size; in ConvertToNewFormat() 337 pubKey.data = rawKey->data; in ConvertToNewFormat() 339 return ConvertEd25519ToNewFormat(flag, &pubKey, &priKey, key); in ConvertToNewFormat() 348 pubKey.size = HKS_KEY_BYTES(HKS_CURVE25519_KEY_SIZE_256); in ConvertToNewFormat() [all …]
|
/base/security/device_auth/deps_adapter/key_management_adapter/impl/src/small/ |
D | mbedtls_ec_adapter.c | 76 static void SwapEndian(uint8_t *pubKey, int len) in SwapEndian() argument 78 if ((pubKey == NULL) || (len <= 0)) { in SwapEndian() 82 uint8_t tmp = pubKey[i]; in SwapEndian() 83 pubKey[i] = pubKey[len - i - 1]; in SwapEndian() 84 pubKey[len - i - 1] = tmp; in SwapEndian() 284 int32_t MbedtlsAgreeSharedSecret(const KeyBuff *priKey, const KeyBuff *pubKey, Uint8Buff *sharedKey) in MbedtlsAgreeSharedSecret() argument
|
D | huks_adapter.c | 435 const KeyBuff *priKey, const KeyBuff *pubKey) in ConstructAgreeWithStorageParams() argument 438 struct HksBlob pubKeyBlob = { pubKey->keyLen, pubKey->key }; in ConstructAgreeWithStorageParams() 466 .boolParam = pubKey->isAlias in ConstructAgreeWithStorageParams() 478 static int32_t AgreeSharedSecretWithStorage(const KeyBuff *priKey, const KeyBuff *pubKey, Algorithm… in AgreeSharedSecretWithStorage() argument 484 CHECK_PTR_RETURN_HAL_ERROR_CODE(pubKey, "pubKey"); in AgreeSharedSecretWithStorage() 485 CHECK_PTR_RETURN_HAL_ERROR_CODE(pubKey->key, "pubKey->key"); in AgreeSharedSecretWithStorage() 486 CHECK_LEN_ZERO_RETURN_ERROR_CODE(pubKey->keyLen, "pubKey->keyLen"); in AgreeSharedSecretWithStorage() 494 int32_t ret = ConstructAgreeWithStorageParams(¶mSet, sharedKeyLen, algo, priKey, pubKey); in AgreeSharedSecretWithStorage() 510 static int32_t AgreeSharedSecret(const KeyBuff *priKey, const KeyBuff *pubKey, Algorithm algo, Uint… in AgreeSharedSecret() argument 515 CHECK_PTR_RETURN_HAL_ERROR_CODE(pubKey, "pubKey"); in AgreeSharedSecret() [all …]
|