Home
last modified time | relevance | path

Searched refs:HKS_KEY_BYTES (Results 1 – 25 of 35) sorted by relevance

12

/base/security/huks/frameworks/huks_standard/main/crypto_engine/openssl/src/
Dhks_openssl_dsa.c53 uint8_t *buff = (uint8_t *)HksMalloc(HKS_KEY_BYTES(keyMaterial->keySize)); in InitDsaStructKey()
62 …if (memcpy_s(buff, HKS_KEY_BYTES(keyMaterial->keySize), key->data + *offset, keyMaterial->xSize) !… in InitDsaStructKey()
70 …if (memcpy_s(buff, HKS_KEY_BYTES(keyMaterial->keySize), key->data + *offset, keyMaterial->ySize) !… in InitDsaStructKey()
85 … (void)memset_s(buff, HKS_KEY_BYTES(keyMaterial->keySize), 0, HKS_KEY_BYTES(keyMaterial->keySize)); in InitDsaStructKey()
94 uint8_t *buff = HksMalloc(HKS_KEY_BYTES(keyMaterial->keySize)); in InitDsaStructParameter()
97 …if (memcpy_s(buff, HKS_KEY_BYTES(keyMaterial->keySize), key->data + *offset, keyMaterial->pSize) !… in InitDsaStructParameter()
103 …if (memcpy_s(buff, HKS_KEY_BYTES(keyMaterial->keySize), key->data + *offset, keyMaterial->qSize) !… in InitDsaStructParameter()
110 …if (memcpy_s(buff, HKS_KEY_BYTES(keyMaterial->keySize), key->data + *offset, keyMaterial->gSize) !… in InitDsaStructParameter()
111 … (void)memset_s(buff, HKS_KEY_BYTES(keyMaterial->keySize), 0, HKS_KEY_BYTES(keyMaterial->keySize)); in InitDsaStructParameter()
128 … (void)memset_s(buff, HKS_KEY_BYTES(keyMaterial->keySize), 0, HKS_KEY_BYTES(keyMaterial->keySize)); in InitDsaStructParameter()
[all …]
Dhks_openssl_dh.c170 if (HKS_KEY_BYTES(spec->keyLen) > sharedKey->size) { in HksOpensslDhAgreeKey()
199 if (HKS_KEY_BYTES(spec->keyLen) > (uint32_t)DH_size(dh)) { in HksOpensslDhAgreeKey()
202 … if (memcpy_s(sharedKey->data, sharedKey->size, computeKey, HKS_KEY_BYTES(spec->keyLen)) != EOK) { in HksOpensslDhAgreeKey()
Dhks_openssl_sm2.c159 (keyMaterial->xSize > HKS_KEY_BYTES(keyMaterial->keySize)) || in GetSm2Modules()
160 (keyMaterial->ySize > HKS_KEY_BYTES(keyMaterial->keySize)) || in GetSm2Modules()
161 (keyMaterial->zSize > HKS_KEY_BYTES(keyMaterial->keySize)) || in GetSm2Modules()
184 …errno_t memRet = memcpy_s(uncompressedPublicKey + 1 + HKS_KEY_BYTES(size->keySize) - size->xSize, … in PushPubKeyToParam()
228 uint32_t fullSize = 1 + HKS_KEY_BYTES(size->keySize) + HKS_KEY_BYTES(size->keySize); in ConstructSm2ParamsFromRawKey()
Dhks_openssl_sm4.c59 case HKS_KEY_BYTES(HKS_AES_KEY_SIZE_128): in GetSm4CbcCipherType()
69 case HKS_KEY_BYTES(HKS_AES_KEY_SIZE_128): in GetSm4CtrCipherType()
79 case HKS_KEY_BYTES(HKS_AES_KEY_SIZE_128): in GetSm4EcbCipherType()
Dhks_openssl_aes.c260 case HKS_KEY_BYTES(HKS_AES_KEY_SIZE_128): in GetAesCbcCipherType()
262 case HKS_KEY_BYTES(HKS_AES_KEY_SIZE_192): in GetAesCbcCipherType()
264 case HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256): in GetAesCbcCipherType()
274 case HKS_KEY_BYTES(HKS_AES_KEY_SIZE_128): in GetAesCtrCipherType()
276 case HKS_KEY_BYTES(HKS_AES_KEY_SIZE_192): in GetAesCtrCipherType()
278 case HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256): in GetAesCtrCipherType()
288 case HKS_KEY_BYTES(HKS_AES_KEY_SIZE_128): in GetAesEcbCipherType()
290 case HKS_KEY_BYTES(HKS_AES_KEY_SIZE_192): in GetAesEcbCipherType()
292 case HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256): in GetAesEcbCipherType()
Dhks_openssl_ecc.c114 …uint32_t rawMaterialLen = sizeof(struct KeyMaterialEcc) + HKS_KEY_BYTES(keySize) * ECC_KEYPAIR_CNT; in EccSaveKeyMaterial()
127 keyMaterial->xSize = HKS_KEY_BYTES(keySize); in EccSaveKeyMaterial()
128 keyMaterial->ySize = HKS_KEY_BYTES(keySize); in EccSaveKeyMaterial()
129 keyMaterial->zSize = HKS_KEY_BYTES(keySize); in EccSaveKeyMaterial()
/base/security/huks/utils/crypto_adapter/
Dhks_client_service_adapter_common.c54 if (key->size != HKS_KEY_BYTES(HKS_CURVE25519_KEY_SIZE_256)) { in TranslateToInnerCurve25519Format()
93 if ((key->size != HKS_KEY_BYTES(HKS_AES_KEY_SIZE_128)) && in GetHksPubKeyInnerFormat()
94 (key->size != HKS_KEY_BYTES(HKS_AES_KEY_SIZE_192)) && in GetHksPubKeyInnerFormat()
95 (key->size != HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256))) { in GetHksPubKeyInnerFormat()
Dhks_client_service_adapter.c211 …int memRet = memcpy_s(uncompressed->data + 1 + HKS_KEY_BYTES(keySize) - x->size, x->size, x->data,… in ConstructSm2ParamsPushPubKey()
233 …if (keySize != HKS_SM2_KEY_SIZE_256 || x->size > HKS_KEY_BYTES(keySize) || y->size > HKS_KEY_BYTES in ConstructSm2ParamsFromRawPubKey()
240 …struct HksBlob uncompressedPublicKey = { 1 + HKS_KEY_BYTES(keySize) + HKS_KEY_BYTES(keySize), NULL… in ConstructSm2ParamsFromRawPubKey()
477 if (publicKey->size != HKS_KEY_BYTES(HKS_CURVE25519_KEY_SIZE_256)) { in Curve25519ToX509PublicKey()
620 uint32_t xSize = HKS_KEY_BYTES(keyLen); in EcKeyToPublicKey()
621 uint32_t ySize = HKS_KEY_BYTES(keyLen); in EcKeyToPublicKey()
/base/security/huks/services/huks_standard/huks_engine/main/core/src/
Dhks_keyblob_lite.c69 uint8_t keyBuf[HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256)] = {0}; in GetDeriveMaterial()
70 struct HksBlob mk = { HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256), keyBuf }; in GetDeriveMaterial()
88 …struct HksKeySpec derivationSpec = { HKS_ALG_PBKDF2, HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256), &derPara… in GetDeriveMaterial()
152 uint8_t kekBuf[HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256)] = {0}; in EncryptAndDecryptKeyBlob()
153 struct HksBlob kek = { HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256), kekBuf }; in EncryptAndDecryptKeyBlob()
162 …(void)memset_s(kekBuf, HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256), 0, HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256)… in EncryptAndDecryptKeyBlob()
178 …(void)memset_s(kekBuf, HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256), 0, HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256)… in EncryptAndDecryptKeyBlob()
207 if (key->size != (HKS_KEY_BYTES(HKS_CURVE25519_KEY_SIZE_256) << 1)) { in Ed25519BlobToKeyMaterial()
213 (HKS_KEY_BYTES(HKS_CURVE25519_KEY_SIZE_256) << 1)); in Ed25519BlobToKeyMaterial()
221 keyMaterial->pubKeySize = HKS_KEY_BYTES(HKS_CURVE25519_KEY_SIZE_256); in Ed25519BlobToKeyMaterial()
[all …]
Dhks_core_service.c58 #define CURVE25519_KEY_BYTE_SIZE HKS_KEY_BYTES(HKS_CURVE25519_KEY_SIZE_256)
224 agreedKey->size = HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256); in GenAgreeKey()
665 sharedSecret.size = HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256); in AgreeSharedSecretWithPeerPublicKey()
734 kek.size = HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256); in DecryptKekWithAgreeSharedSecret()
987 if (key->size != HKS_KEY_BYTES(HKS_CURVE25519_KEY_SIZE_256)) { in GetCurve25519PrivateOrPairInnerFormat()
1234 uint8_t keyBuf[HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256)] = {0}; in GetMacKey()
1235 struct HksBlob mk = { HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256), keyBuf }; in GetMacKey()
1245 …struct HksKeySpec derivationSpec = { HKS_ALG_PBKDF2, HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256), &derPara… in GetMacKey()
1257 uint8_t keyBuf[HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256)] = {0}; in HksCoreCalcMacHeader()
1258 struct HksBlob macKey = { HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256), keyBuf }; in HksCoreCalcMacHeader()
Dhks_sm_import_wrap_key.c321 deriveBlob.size = HKS_KEY_BYTES(HKS_SM4_KEY_SIZE_128); in DeriveKeyBySm3()
329 …struct HksKeySpec derivationSpec = { HKS_ALG_GMKDF, HKS_KEY_BYTES(HKS_SM4_KEY_SIZE_128), &derParam… in DeriveKeyBySm3()
Dhks_keyblob.c136 …struct HksKeySpec derivationSpec = { HKS_ALG_HKDF, HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256), &derParam … in GetDeriveKey()
148 derivedKey->size = HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256); in GetDeriveKey()
/base/security/huks/test/unittest/huks_standard_test/crypto_engine_test/src/
Dhks_crypto_hal_api_mbedtls.cpp199 uint8_t buff[HKS_KEY_BYTES(HKS_AES_KEY_SIZE_128)] = {0};
223 uint8_t buff[HKS_KEY_BYTES(HKS_AES_KEY_SIZE_128)] = {0};
246 uint8_t buff[HKS_KEY_BYTES(HKS_AES_KEY_SIZE_128)] = {0};
269 uint8_t buff[HKS_KEY_BYTES(HKS_AES_KEY_SIZE_128)] = {0};
291 uint8_t buff[HKS_KEY_BYTES(HKS_AES_KEY_SIZE_128)] = {0};
300 uint32_t keyLen = sizeof(KeyMaterialRsa) + HKS_KEY_BYTES(HKS_RSA_KEY_SIZE_4096) +
301 HKS_KEY_BYTES(HKS_RSA_KEY_SIZE_4096) +
302 (HKS_KEY_BYTES(HKS_RSA_KEY_SIZE_4096) + HKS_KEY_BYTES(HKS_RSA_KEY_SIZE_4096));
308 keyMaterial->nSize = HKS_KEY_BYTES(HKS_RSA_KEY_SIZE_4096);
309 keyMaterial->eSize = HKS_KEY_BYTES(HKS_RSA_KEY_SIZE_4096);
[all …]
Dhks_crypto_hal_api_openssl.cpp219 uint8_t buff[HKS_KEY_BYTES(HKS_AES_KEY_SIZE_128)] = {0};
255 uint8_t buff[HKS_KEY_BYTES(HKS_AES_KEY_SIZE_128)] = {0};
283 uint8_t buff[HKS_KEY_BYTES(HKS_AES_KEY_SIZE_128)] = {0};
367 uint8_t buff[HKS_KEY_BYTES(HKS_RSA_KEY_SIZE_512)] = {0};
390 uint8_t buff[HKS_KEY_BYTES(HKS_RSA_KEY_SIZE_512)] = {0};
414 uint8_t buff[HKS_KEY_BYTES(DSA_KEY_LEN_512)] = {0};
434 uint8_t buff[HKS_KEY_BYTES(DSA_KEY_LEN_512)] = {0};
451 uint8_t buff[HKS_KEY_BYTES(HKS_ECC_KEY_SIZE_256)] = {0};
473 uint8_t buff[HKS_KEY_BYTES(KEY_LEN_256)] = {0};
525 uint8_t buff[HKS_KEY_BYTES(HKS_RSA_KEY_SIZE_512)] = {0};
[all …]
Dhks_crypto_hal_sm3_cipher.cpp55 …struct HksKeySpec derivationSpec = { HKS_ALG_GMKDF, HKS_KEY_BYTES(HKS_SM4_KEY_SIZE_128), &derParam… in RunTestCase()
Dhks_crypto_hal_rsa_encrypt.cpp477 outLen = HKS_KEY_BYTES(testCaseParams.keySize); in RunTestCase()
/base/security/huks/frameworks/huks_standard/main/crypto_engine/mbedtls/src/
Dhks_mbedtls_dh.c73 const uint32_t keyByteLen = HKS_KEY_BYTES(keySize); in DhSaveKeyMaterial()
133 uint32_t keyLen = HKS_KEY_BYTES(spec->keyLen); in HksMbedtlsDhGenerateKey()
201 ctx->len = HKS_KEY_BYTES(keyMaterial->keySize); in DhKeyMaterialToCtx()
230 if (HKS_KEY_BYTES(spec->keyLen) > sharedKey->size) { in HksMbedtlsDhAgreeKey()
Dhks_mbedtls_ecdh.c91 const uint32_t keyByteLen = HKS_KEY_BYTES(spec->keyLen); in HksMbedtlsEcdh()
Dhks_mbedtls_ecc.c77 const uint32_t maxKeyByteLen = HKS_KEY_BYTES(HKS_ECC_KEY_SIZE_521); in EccKeyMaterialXyzSizeCheck()
164 const uint32_t keyByteLen = HKS_KEY_BYTES(keySize); in EccSaveKeyMaterial()
/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/alg_module_test/src/
Dopenssl_ecc_helper.c75 … uint32_t rawMaterialLen = sizeof(struct KeyMaterialEcc) + HKS_KEY_BYTES(keyLen) * ECC_KEYPAIR_CNT; in EccSaveKeyMaterial()
83 keyMaterial->xSize = HKS_KEY_BYTES(keyLen); in EccSaveKeyMaterial()
84 keyMaterial->ySize = HKS_KEY_BYTES(keyLen); in EccSaveKeyMaterial()
85 keyMaterial->zSize = HKS_KEY_BYTES(keyLen); in EccSaveKeyMaterial()
470 uint32_t xSize = HKS_KEY_BYTES(keyLen); in EcKeyToPublicKey()
471 uint32_t ySize = HKS_KEY_BYTES(keyLen); in EcKeyToPublicKey()
Dopenssl_dh_helper.c148 if ((uint32_t)HKS_KEY_BYTES(keyLen) > sharedKey->size) { in DhAgreeKey()
178 if (HKS_KEY_BYTES(keyLen) > DH_size(dh)) { in DhAgreeKey()
181 if (memcpy_s(sharedKey->data, sharedKey->size, computeKey, HKS_KEY_BYTES(keyLen)) != 0) { in DhAgreeKey()
Dopenssl_rsa_helper.c166 uint8_t *buff = (uint8_t *)HksMalloc(HKS_KEY_BYTES(keyMaterial->keySize)); in InitRsa()
176 …if (memcpy_s(buff, HKS_KEY_BYTES(keyMaterial->keySize), key->data + offset, keyMaterial->nSize) ==… in InitRsa()
181 …if (memcpy_s(buff, HKS_KEY_BYTES(keyMaterial->keySize), key->data + offset, keyMaterial->eSize) ==… in InitRsa()
187 …if (memcpy_s(buff, HKS_KEY_BYTES(keyMaterial->keySize), key->data + offset, keyMaterial->dSize) ==… in InitRsa()
/base/security/huks/interfaces/inner_api/huks_standard/main/include/
Dhks_type.h62 #define HKS_KEY_BYTES(keySize) (((keySize) + HKS_BITS_PER_BYTE - 1) / HKS_BITS_PER_BYTE) macro
822 #define HKS_MAX_KEY_LEN (HKS_KEY_BYTES(HKS_RSA_KEY_SIZE_4096) * HKS_KEY_MATERIAL_NUM)
/base/security/huks/frameworks/huks_standard/main/common/src/
Dhks_check_paramset.c722 if (key->size != HKS_KEY_BYTES(params->keyLen.value)) { in CheckImportSymmetricKeySize()
876 if ((privateKey->size != HKS_KEY_BYTES(HKS_CURVE25519_KEY_SIZE_256)) || in HksCoreCheckAgreeKeyParams()
877 (peerPublicKey->size != HKS_KEY_BYTES(HKS_CURVE25519_KEY_SIZE_256))) { in HksCoreCheckAgreeKeyParams()
/base/security/huks/test/unittest/huks_standard_test/three_stage_test/src/
Dhks_import_wrapped_test_common.cpp238 … struct HksBlob outSharedKey = { .size = HKS_KEY_BYTES(HKS_AES_KEY_SIZE_256), .data = nullptr }; in HksImportWrappedKeyTestCommonCase()

12