Home
last modified time | relevance | path

Searched refs:sharedKey (Results 1 – 25 of 30) sorted by relevance

12

/ohos5.0/base/security/huks/frameworks/huks_standard/main/crypto_engine/mbedtls/src/
H A Dhks_mbedtls_ecdh.c55 const struct HksBlob *pubKey, const struct HksKeySpec *spec, struct HksBlob *sharedKey) in HksMbedtlsEcdh() argument
93 ret = mbedtls_mpi_write_binary(&(ctx.MBEDTLS_PRIVATE(z)), sharedKey->data, keyByteLen); in HksMbedtlsEcdh()
96 (void)memset_s(sharedKey->data, sharedKey->size, 0, sharedKey->size); in HksMbedtlsEcdh()
99 sharedKey->size = keyByteLen; in HksMbedtlsEcdh()
H A Dhks_mbedtls_dh.c228 const struct HksKeySpec *spec, struct HksBlob *sharedKey) in HksMbedtlsDhAgreeKey() argument
230 if (HKS_KEY_BYTES(spec->keyLen) > sharedKey->size) { in HksMbedtlsDhAgreeKey()
263 …mbedtls_dhm_calc_secret(&ctx, sharedKey->data, sharedKey->size, &keyLen, mbedtls_ctr_drbg_random, … in HksMbedtlsDhAgreeKey()
269 sharedKey->size = keyLen; in HksMbedtlsDhAgreeKey()
H A Dhks_mbedtls_x25519.c315 const struct HksBlob *pubKey, const struct HksKeySpec *spec, struct HksBlob *sharedKey) in HksMbedtlsX25519KeyAgreement() argument
355 … ret = mbedtls_mpi_write_binary(&(ctx.MBEDTLS_PRIVATE(z)), sharedKey->data, HKS_X25519_KEY_BYTES); in HksMbedtlsX25519KeyAgreement()
358 (void)memset_s(sharedKey->data, sharedKey->size, 0, sharedKey->size); in HksMbedtlsX25519KeyAgreement()
361 sharedKey->size = HKS_X25519_KEY_BYTES; in HksMbedtlsX25519KeyAgreement()
363 ret = EndianSwap(sharedKey->data, sharedKey->size); in HksMbedtlsX25519KeyAgreement()
796 const struct HksBlob *pubKey, const struct HksKeySpec *spec, struct HksBlob *sharedKey) in HksMbedtlsEd25519KeyAgreement() argument
821 …t = HksMbedtlsX25519KeyAgreement(&(key.kmX25519NativeKey), &(key.kmX25519PubKey), NULL, sharedKey); in HksMbedtlsEd25519KeyAgreement()
/ohos5.0/base/security/huks/services/huks_standard/huks_engine/main/core/src/
H A Dhks_chipset_platform_decrypt.c97 struct HksBlob *sharedKey) in DoGenEcdhSharedKey() argument
121 ret = HksChipsetPlatformDeriveKeyAndEcdh(&peerPkParam->blob, &saltPadding, sharedKey); in DoGenEcdhSharedKey()
128 const struct HksBlob *sharedKey, struct HksBlob *wrappedKey) in DoHmacSha256() argument
134 return HksCryptoHalHmac(sharedKey, HKS_DIGEST_SHA256, hmacMsg, wrappedKey); in DoHmacSha256()
223 struct HksBlob sharedKey = { .size = PLATFORM_KEY_SHARED_KEY_SIZE, in HuksCoreChipsetPlatformDecrypt() local
225 if (sharedKey.data == NULL) { in HuksCoreChipsetPlatformDecrypt()
232 HKS_MEMSET_FREE_BLOB(sharedKey); in HuksCoreChipsetPlatformDecrypt()
239 ret = DoGenEcdhSharedKey(paramSet, scene, &sharedKey); in HuksCoreChipsetPlatformDecrypt()
248 ret = DoHmacSha256(&customInfoParam->blob, &sharedKey, &wrappedKey); in HuksCoreChipsetPlatformDecrypt()
257 HKS_MEMSET_FREE_BLOB(sharedKey); in HuksCoreChipsetPlatformDecrypt()
/ohos5.0/base/security/huks/frameworks/huks_standard/main/crypto_engine/openssl/src/
H A Dhks_openssl_ecc.c364 static int32_t EcdhDerive(EVP_PKEY_CTX *ctx, EVP_PKEY *peerKey, struct HksBlob *sharedKey) in EcdhDerive() argument
366 size_t tmpSharedKeySize = (size_t)sharedKey->size; in EcdhDerive()
380 if (tmpSharedKeySize > sharedKey->size) { in EcdhDerive()
384 if (EVP_PKEY_derive(ctx, sharedKey->data, &tmpSharedKeySize) != 1) { in EcdhDerive()
388 sharedKey->size = tmpSharedKeySize; in EcdhDerive()
393 …eeKeyEcdh(const struct HksBlob *nativeKey, const struct HksBlob *pubKey, struct HksBlob *sharedKey) in AgreeKeyEcdh() argument
417 ret = EcdhDerive(ctx, peerKey, sharedKey); in AgreeKeyEcdh()
436 const struct HksKeySpec *spec, struct HksBlob *sharedKey) in HksOpensslEcdhAgreeKey() argument
440 int32_t ret = AgreeKeyEcdh(nativeKey, pubKey, sharedKey); in HksOpensslEcdhAgreeKey()
H A Dhks_openssl_curve25519.c142 const struct HksKeySpec *spec, struct HksBlob *sharedKey) in HksOpensslX25519AgreeKey() argument
148 size_t tmpSharedKeySize = (size_t)sharedKey->size; in HksOpensslX25519AgreeKey()
169 if (EVP_PKEY_derive(ctx, sharedKey->data, &tmpSharedKeySize) != HKS_OPENSSL_SUCCESS) { in HksOpensslX25519AgreeKey()
173 sharedKey->size = (uint32_t)tmpSharedKeySize; in HksOpensslX25519AgreeKey()
184 const struct HksKeySpec *spec, struct HksBlob *sharedKey) in HksOpensslEd25519AgreeKey() argument
210 … ret = HksOpensslX25519AgreeKey(&x25519PriKeyMaterial, &x25519PubKeyMaterial, spec, sharedKey); in HksOpensslEd25519AgreeKey()
H A Dhks_openssl_dh.c273 const struct HksKeySpec *spec, struct HksBlob *sharedKey) in HksOpensslDhAgreeKey() argument
276 if (HKS_KEY_BYTES(spec->keyLen) > sharedKey->size) { in HksOpensslDhAgreeKey()
309 … if (memcpy_s(sharedKey->data, sharedKey->size, computeKey, HKS_KEY_BYTES(spec->keyLen)) != EOK) { in HksOpensslDhAgreeKey()
313 sharedKey->size = HKS_KEY_BYTES(spec->keyLen); in HksOpensslDhAgreeKey()
H A Dhks_openssl_engine.c95 const struct HksKeySpec *spec, const struct HksBlob *sharedKey) in AgreeKeyCheckParam() argument
104 HKS_IF_NULL_LOGE_RETURN(sharedKey, HKS_ERROR_INVALID_ARGUMENT, "Invalid sharedKey params!") in AgreeKeyCheckParam()
336 const struct HksKeySpec *spec, struct HksBlob *sharedKey) in HksCryptoHalAgreeKey() argument
338 int32_t ret = AgreeKeyCheckParam(nativeKey, pubKey, spec, sharedKey); in HksCryptoHalAgreeKey()
343 return func(nativeKey, pubKey, spec, sharedKey); in HksCryptoHalAgreeKey()
/ohos5.0/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/alg_module_test/src/
H A Dopenssl_ecc_helper.c622 int32_t EcdhDerive(EVP_PKEY_CTX *ctx, EVP_PKEY *peerKey, struct HksBlob *sharedKey) in EcdhDerive() argument
634 sharedKey->size = keyLen; in EcdhDerive()
636 if (sharedKey->data == NULL) { in EcdhDerive()
637 sharedKey->data = (uint8_t *)HksMalloc(keyLen); in EcdhDerive()
638 if (sharedKey->data == NULL) { in EcdhDerive()
642 if (EVP_PKEY_derive(ctx, sharedKey->data, &keyLen) != 1) { in EcdhDerive()
643 HKS_FREE(sharedKey->data); in EcdhDerive()
646 sharedKey->size = keyLen; in EcdhDerive()
652 …t keyLen, const struct HksBlob *nativeKey, const struct HksBlob *pubKey, struct HksBlob *sharedKey) in EcdhAgreeKey() argument
676 if (EcdhDerive(ctx, peerKey, sharedKey) != ECC_SUCCESS) { in EcdhAgreeKey()
H A Dopenssl_dh_helper.c144 …t keyLen, const struct HksBlob *nativeKey, const struct HksBlob *pubKey, struct HksBlob *sharedKey) in DhAgreeKey() argument
148 if ((uint32_t)HKS_KEY_BYTES(keyLen) > sharedKey->size) { in DhAgreeKey()
181 if (memcpy_s(sharedKey->data, sharedKey->size, computeKey, HKS_KEY_BYTES(keyLen)) != 0) { in DhAgreeKey()
184 sharedKey->size = (uint32_t)DH_size(dh); in DhAgreeKey()
/ohos5.0/base/security/huks/frameworks/huks_standard/main/crypto_engine/mbedtls/include/
H A Dhks_mbedtls_x25519.h38 const struct HksBlob *pubKey, const struct HksKeySpec *spec, struct HksBlob *sharedKey);
47 const struct HksBlob *pubKey, const struct HksKeySpec *spec, struct HksBlob *sharedKey);
H A Dhks_mbedtls_ecdh.h33 const struct HksBlob *pubKey, const struct HksKeySpec *spec, struct HksBlob *sharedKey);
H A Dhks_mbedtls_dh.h43 const struct HksKeySpec *spec, struct HksBlob *sharedKey);
/ohos5.0/base/security/huks/frameworks/huks_standard/main/crypto_engine/openssl/include/
H A Dhks_openssl_curve25519.h34 const struct HksKeySpec *spec, struct HksBlob *sharedKey);
37 const struct HksKeySpec *spec, struct HksBlob *sharedKey);
H A Dhks_openssl_dh.h39 const struct HksKeySpec *spec, struct HksBlob *sharedKey);
H A Dhks_openssl_ecc.h39 const struct HksKeySpec *spec, struct HksBlob *sharedKey);
/ohos5.0/base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/
H A Dhks_chipset_platform_encrypt_test.cpp319 int32_t AgreeSharedKey(struct HksBlob &x509PubKey, struct HksBlob &sharedKey) in AgreeSharedKey() argument
337 ret = HksAgreeKeyForDe(agreeParamSet.s, &g_tmpKeyPairAlias, &x509PubKey, &sharedKey); in AgreeSharedKey()
343 int32_t HmacWrapKey(const struct HksBlob &sharedKey, const struct HksBlob &hmacMsg, struct HksBlob … in HmacWrapKey() argument
359 ret = HksImportKeyForDe(&sharedKeyAlias, importParamSet.s, &sharedKey); in HmacWrapKey()
458 …struct HksBlob sharedKey = { .size = PLATFORM_KEY_SHARED_KEY_SIZE, .data = sharedKeyBuffer.data() … in Encrypt() local
481 ret = AgreeSharedKey(x509PubKey, sharedKey); in Encrypt()
484 ret = HmacWrapKey(sharedKey, hmacMsg, wrapKey); in Encrypt()
/ohos5.0/base/security/huks/test/unittest/huks_standard_test/crypto_engine_test/src/
H A Dhks_crypto_hal_api_mbedtls.cpp501 HksBlob sharedKey = { .size = keyOutLen, .data = (uint8_t *)HksMalloc(keyOutLen) }; variable
502 ASSERT_NE(sharedKey.data, nullptr);
505 ret = HksCryptoHalAgreeKey(&key, &key, &spec, &sharedKey);
508 sharedKey.size -= 1;
509 ret = HksCryptoHalAgreeKey(&key, &key, &spec, &sharedKey);
511 HKS_FREE_BLOB(sharedKey);
/ohos5.0/base/security/device_auth/deps_adapter/key_management_adapter/impl/src/common/
H A Dmbedtls_ec_adapter.c536 int32_t MbedtlsAgreeSharedSecret(const KeyBuff *priKey, const KeyBuff *pubKey, Uint8Buff *sharedKey) in MbedtlsAgreeSharedSecret() argument
544 CHECK_PTR_RETURN_HAL_ERROR_CODE(sharedKey, "sharedKey"); in MbedtlsAgreeSharedSecret()
545 CHECK_PTR_RETURN_HAL_ERROR_CODE(sharedKey->val, "sharedKey->val"); in MbedtlsAgreeSharedSecret()
546 CHECK_LEN_ZERO_RETURN_ERROR_CODE(sharedKey->length, "sharedKey->length"); in MbedtlsAgreeSharedSecret()
557 .dataSize = sharedKey->length, in MbedtlsAgreeSharedSecret()
558 .data = sharedKey->val in MbedtlsAgreeSharedSecret()
/ohos5.0/base/security/huks/services/huks_standard/huks_engine/main/core_dependency/src/
H A Dhks_chipset_platform_key_hardcoded.c106 struct HksBlob *sharedKey) in HksChipsetPlatformDeriveKeyAndEcdh() argument
125 ret = HksCryptoHalAgreeKey(&platformPrivateKey, &peerHksPubKey, &ecdhSpec, sharedKey); in HksChipsetPlatformDeriveKeyAndEcdh()
/ohos5.0/base/security/huks/services/huks_standard/huks_engine/main/core_dependency/include/
H A Dhks_chipset_platform_key.h28 struct HksBlob *sharedKey);
/ohos5.0/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/alg_module_test/include/
H A Dopenssl_dh_helper.h31 … keyLen, const struct HksBlob *nativeKey, const struct HksBlob *pubKey, struct HksBlob *sharedKey);
H A Dopenssl_ecc_helper.h45 … keyLen, const struct HksBlob *nativeKey, const struct HksBlob *pubKey, struct HksBlob *sharedKey);
/ohos5.0/base/security/device_auth/deps_adapter/key_management_adapter/impl/inc/
H A Dmbedtls_ec_adapter.h32 int32_t MbedtlsAgreeSharedSecret(const KeyBuff *priKey, const KeyBuff *pubKey, Uint8Buff *sharedKey
/ohos5.0/base/security/device_auth/test/unittest/deviceauth/unit_test/source/
H A Dkey_management_test.cpp133 Uint8Buff sharedKey = { keyData, P256_PUBLIC_SIZE }; variable
137 &sharedKey);

12