Home
last modified time | relevance | path

Searched refs:keyMaterial (Results 1 – 25 of 39) sorted by relevance

12

/base/security/huks/frameworks/huks_standard/main/crypto_engine/mbedtls/src/
Dhks_mbedtls_ecc.c75 static int32_t EccKeyMaterialXyzSizeCheck(const struct KeyMaterialEcc *keyMaterial) in EccKeyMaterialXyzSizeCheck() argument
78 if ((keyMaterial->xSize > maxKeyByteLen) || in EccKeyMaterialXyzSizeCheck()
79 (keyMaterial->ySize > maxKeyByteLen) || (keyMaterial->zSize > maxKeyByteLen)) { in EccKeyMaterialXyzSizeCheck()
81 … "zSize = 0x%" LOG_PUBLIC "X", keyMaterial->xSize, keyMaterial->ySize, keyMaterial->zSize); in EccKeyMaterialXyzSizeCheck()
90 const struct KeyMaterialEcc *keyMaterial = (struct KeyMaterialEcc *)(key->data); in EccKeyCheck() local
91 int32_t ret = HksMbedtlsEccCheckKeySize(keyMaterial->keySize); in EccKeyCheck()
94 ret = EccKeyMaterialXyzSizeCheck(keyMaterial); in EccKeyCheck()
97 …if (key->size < (sizeof(struct KeyMaterialEcc) + keyMaterial->xSize + keyMaterial->ySize + keyMate… in EccKeyCheck()
106 int32_t HksMbedtlsEccGetKeyCurveNist(const struct KeyMaterialEcc *keyMaterial, mbedtls_ecp_group_id… in HksMbedtlsEccGetKeyCurveNist() argument
108 if ((keyMaterial->keyAlg != HKS_ALG_ECC) && (keyMaterial->keyAlg != HKS_ALG_ECDH)) { in HksMbedtlsEccGetKeyCurveNist()
[all …]
Dhks_mbedtls_rsa.c63 static int32_t RsaKeyMaterialNedSizeCheck(const struct KeyMaterialRsa *keyMaterial) in RsaKeyMaterialNedSizeCheck() argument
66 if ((keyMaterial->nSize > maxKeyByteLen) || (keyMaterial->eSize > maxKeyByteLen) || in RsaKeyMaterialNedSizeCheck()
67 (keyMaterial->dSize > maxKeyByteLen)) { in RsaKeyMaterialNedSizeCheck()
70 keyMaterial->nSize, in RsaKeyMaterialNedSizeCheck()
71 keyMaterial->eSize, in RsaKeyMaterialNedSizeCheck()
72 keyMaterial->dSize); in RsaKeyMaterialNedSizeCheck()
81 const struct KeyMaterialRsa *keyMaterial = (struct KeyMaterialRsa *)(key->data); in RsaKeyCheck() local
83 int32_t ret = RsaCheckKeySize(keyMaterial->keySize); in RsaKeyCheck()
86 ret = RsaKeyMaterialNedSizeCheck(keyMaterial); in RsaKeyCheck()
89 …if (key->size < (sizeof(struct KeyMaterialRsa) + keyMaterial->nSize + keyMaterial->eSize + keyMate… in RsaKeyCheck()
[all …]
Dhks_mbedtls_dh.c79 struct KeyMaterialDh *keyMaterial = (struct KeyMaterialDh *)rawMaterial; in DhSaveKeyMaterial() local
80 keyMaterial->keyAlg = HKS_ALG_DH; in DhSaveKeyMaterial()
81 keyMaterial->keySize = keySize; in DhSaveKeyMaterial()
82 keyMaterial->pubKeySize = mbedtls_mpi_size(&ctx->GX); in DhSaveKeyMaterial()
83 keyMaterial->priKeySize = mbedtls_mpi_size(&ctx->X); in DhSaveKeyMaterial()
87 uint32_t offset = sizeof(*keyMaterial); in DhSaveKeyMaterial()
88 ret = mbedtls_mpi_write_binary(&(ctx->GX), rawMaterial + offset, keyMaterial->pubKeySize); in DhSaveKeyMaterial()
96 offset = offset + keyMaterial->pubKeySize; in DhSaveKeyMaterial()
97 ret = mbedtls_mpi_write_binary(&(ctx->X), rawMaterial + offset, keyMaterial->priKeySize); in DhSaveKeyMaterial()
164 struct KeyMaterialDh *keyMaterial = (struct KeyMaterialDh *)input->data; in HksMbedtlsGetDhPubKey() local
[all …]
Dhks_mbedtls_x25519.c110 static int32_t X25519CheckKeyMaterialPubPriSize(const struct KeyMaterial25519 *keyMaterial) in X25519CheckKeyMaterialPubPriSize() argument
112 if ((keyMaterial->pubKeySize > HKS_X25519_KEY_BYTES) || in X25519CheckKeyMaterialPubPriSize()
113 (keyMaterial->priKeySize > HKS_X25519_KEY_BYTES)) { in X25519CheckKeyMaterialPubPriSize()
115 keyMaterial->pubKeySize, keyMaterial->priKeySize); in X25519CheckKeyMaterialPubPriSize()
141 …9CheckKeySize(const struct HksBlob *key, const struct KeyMaterial25519 *keyMaterial, bool isPubKey) in X25519CheckKeySize() argument
143 if (key->size < (sizeof(struct KeyMaterial25519) + keyMaterial->pubKeySize + in X25519CheckKeySize()
144 (isPubKey ? 0 : keyMaterial->priKeySize))) { in X25519CheckKeySize()
179 struct KeyMaterial25519 *keyMaterial = (struct KeyMaterial25519 *)rawMaterial; in X25519SaveKeyMaterial() local
180 keyMaterial->keyAlg = HKS_ALG_X25519; in X25519SaveKeyMaterial()
181 keyMaterial->keySize = HKS_X25519_KEY_BITS; in X25519SaveKeyMaterial()
[all …]
/base/security/huks/frameworks/huks_standard/main/crypto_engine/openssl/src/
Dhks_openssl_dsa.c52 const struct KeyMaterialDsa *keyMaterial = (struct KeyMaterialDsa *)(key->data); in InitDsaStructKey() local
53 uint8_t *buff = (uint8_t *)HksMalloc(HKS_KEY_BYTES(keyMaterial->keySize)); in InitDsaStructKey()
58 if (keyMaterial->xSize == 0) { in InitDsaStructKey()
62 …if (memcpy_s(buff, HKS_KEY_BYTES(keyMaterial->keySize), key->data + *offset, keyMaterial->xSize) !… in InitDsaStructKey()
66 x = BN_bin2bn(buff, keyMaterial->xSize, NULL); in InitDsaStructKey()
69 *offset += keyMaterial->xSize; in InitDsaStructKey()
70 …if (memcpy_s(buff, HKS_KEY_BYTES(keyMaterial->keySize), key->data + *offset, keyMaterial->ySize) !… in InitDsaStructKey()
75 BIGNUM *y = BN_bin2bn(buff, keyMaterial->ySize, NULL); in InitDsaStructKey()
76 *offset += keyMaterial->ySize; in InitDsaStructKey()
85 … (void)memset_s(buff, HKS_KEY_BYTES(keyMaterial->keySize), 0, HKS_KEY_BYTES(keyMaterial->keySize)); in InitDsaStructKey()
[all …]
Dhks_openssl_rsa.c70 const struct KeyMaterialRsa *keyMaterial = (struct KeyMaterialRsa *)(key->data); in RsaCheckKeyMaterial() local
71 if (keyMaterial->keyAlg != HKS_ALG_RSA) { in RsaCheckKeyMaterial()
74 …if (key->size != sizeof(struct KeyMaterialRsa) + keyMaterial->nSize + keyMaterial->eSize + keyMate… in RsaCheckKeyMaterial()
80 int32_t InitRsaKeyBuf(const struct KeyMaterialRsa *keyMaterial, struct HksBlob *bufBlob) in InitRsaKeyBuf() argument
83 if (keyMaterial->nSize >= keyMaterial->eSize) { in InitRsaKeyBuf()
84 maxSize = keyMaterial->nSize; in InitRsaKeyBuf()
86 maxSize = keyMaterial->eSize; in InitRsaKeyBuf()
89 if (maxSize < keyMaterial->dSize) { in InitRsaKeyBuf()
90 maxSize = keyMaterial->dSize; in InitRsaKeyBuf()
102 const struct KeyMaterialRsa *keyMaterial = (struct KeyMaterialRsa *)(key->data); in InitRsaStruct() local
[all …]
Dhks_openssl_dh.c59 const struct KeyMaterialDh *keyMaterial = (struct KeyMaterialDh *)(key->data); in InitDhStruct() local
60 …if (key->size != sizeof(struct KeyMaterialDh) + keyMaterial->pubKeySize + keyMaterial->priKeySize)… in InitDhStruct()
65 int32_t ret = HksOpensslGetNid(keyMaterial->keySize, &nid); in InitDhStruct()
75 BIGNUM *pubKey = BN_bin2bn(key->data + offset, keyMaterial->pubKeySize, NULL); in InitDhStruct()
76 offset += keyMaterial->pubKeySize; in InitDhStruct()
77 BIGNUM *privKey = BN_bin2bn(key->data + offset, keyMaterial->priKeySize, NULL); in InitDhStruct()
101 struct KeyMaterialDh *keyMaterial = (struct KeyMaterialDh *)rawMaterial; in DhSaveKeyMaterial() local
102 keyMaterial->keyAlg = HKS_ALG_DH; in DhSaveKeyMaterial()
103 keyMaterial->keySize = keySize; in DhSaveKeyMaterial()
104 keyMaterial->pubKeySize = (uint32_t)BN_num_bytes(pubKey); in DhSaveKeyMaterial()
[all …]
Dhks_openssl_ecc.c74 …const EC_KEY *eccKey, const struct KeyMaterialEcc *keyMaterial, BIGNUM *pubX, BIGNUM *pubY, uint8_… in TransEccKeyToKeyBlob() argument
86 retCode = BN_bn2binpad(pubX, rawMaterial + offset, keyMaterial->xSize); in TransEccKeyToKeyBlob()
91 offset += keyMaterial->xSize; in TransEccKeyToKeyBlob()
93 retCode = BN_bn2binpad(pubY, rawMaterial + offset, keyMaterial->ySize); in TransEccKeyToKeyBlob()
98 offset += keyMaterial->ySize; in TransEccKeyToKeyBlob()
100 retCode = BN_bn2binpad(priv, rawMaterial + offset, keyMaterial->zSize); in TransEccKeyToKeyBlob()
124 struct KeyMaterialEcc *keyMaterial = (struct KeyMaterialEcc *)rawMaterial; in EccSaveKeyMaterial() local
125 keyMaterial->keyAlg = (enum HksKeyAlg)spec->algType; in EccSaveKeyMaterial()
126 keyMaterial->keySize = keySize; in EccSaveKeyMaterial()
127 keyMaterial->xSize = HKS_KEY_BYTES(keySize); in EccSaveKeyMaterial()
[all …]
Dhks_openssl_sm2.c81 struct KeyMaterialEcc *keyMaterial = (struct KeyMaterialEcc *)rawMaterial; in EvpPkeyToKeyMaterialEc() local
82 keyMaterial->keyAlg = (enum HksKeyAlg)spec->algType; in EvpPkeyToKeyMaterialEc()
83 keyMaterial->keySize = spec->keyLen; in EvpPkeyToKeyMaterialEc()
84 keyMaterial->xSize = pubXBlob.size; in EvpPkeyToKeyMaterialEc()
85 keyMaterial->ySize = pubYBlob.size; in EvpPkeyToKeyMaterialEc()
86 keyMaterial->zSize = privBlob.size; in EvpPkeyToKeyMaterialEc()
153 struct KeyMaterialEcc *keyMaterial = (struct KeyMaterialEcc *)keyBlob->data; in GetSm2Modules() local
155 "u", keyMaterial->keySize, keyMaterial->xSize, keyMaterial->ySize, keyMaterial->zSize); in GetSm2Modules()
158 if ((keyMaterial->keySize != HKS_SM2_KEY_SIZE_256) || in GetSm2Modules()
159 (keyMaterial->xSize > HKS_KEY_BYTES(keyMaterial->keySize)) || in GetSm2Modules()
[all …]
/base/security/crypto_framework/plugin/openssl_plugin/key/sym_key_generator/src/
Dsym_key_openssl.c48 if ((impl->keyMaterial.data == NULL) || (impl->keyMaterial.len == 0)) { in GetEncoded()
52 key->data = (uint8_t *)HcfMalloc(impl->keyMaterial.len, 0); in GetEncoded()
57 (void)memcpy_s(key->data, impl->keyMaterial.len, impl->keyMaterial.data, impl->keyMaterial.len); in GetEncoded()
58 key->len = impl->keyMaterial.len; in GetEncoded()
73 if ((impl->keyMaterial.data != NULL) && (impl->keyMaterial.len > 0)) { in ClearMem()
74 (void)memset_s(impl->keyMaterial.data, impl->keyMaterial.len, 0, impl->keyMaterial.len); in ClearMem()
118 uint8_t *keyMaterial = (uint8_t *)HcfMalloc(keyLen, 0); in RandomSymmKey() local
119 if (keyMaterial == NULL) { in RandomSymmKey()
123 int ret = Openssl_RAND_priv_bytes(keyMaterial, keyLen); in RandomSymmKey()
127 HcfFree(keyMaterial); in RandomSymmKey()
[all …]
/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/alg_module_test/src/
Dopenssl_dsa_helper.c79 const struct KeyMaterialDsa *keyMaterial = (struct KeyMaterialDsa *)(key->data); in InitDsa() local
89 x = BinToBN(key->data + offset, keyMaterial->xSize); in InitDsa()
90 offset += keyMaterial->xSize; in InitDsa()
93 y = BinToBN(key->data + offset, keyMaterial->ySize); in InitDsa()
94 offset += keyMaterial->ySize; in InitDsa()
96 p = BinToBN(key->data + offset, keyMaterial->pSize); in InitDsa()
97 offset += keyMaterial->pSize; in InitDsa()
99 q = BinToBN(key->data + offset, keyMaterial->qSize); in InitDsa()
100 offset += keyMaterial->qSize; in InitDsa()
102 g = BinToBN(key->data + offset, keyMaterial->gSize); in InitDsa()
[all …]
Dopenssl_dh_helper.c58 struct KeyMaterialDh *keyMaterial = (struct KeyMaterialDh *)rawMaterial; in DhSaveKeyMaterial() local
59 keyMaterial->keyAlg = HKS_ALG_DH; in DhSaveKeyMaterial()
60 keyMaterial->keySize = keySize; in DhSaveKeyMaterial()
61 keyMaterial->pubKeySize = BN_num_bytes(pubKey); in DhSaveKeyMaterial()
62 keyMaterial->priKeySize = BN_num_bytes(privKey); in DhSaveKeyMaterial()
63 keyMaterial->reserved = 0; in DhSaveKeyMaterial()
67 offset += keyMaterial->pubKeySize; in DhSaveKeyMaterial()
108 const struct KeyMaterialDh *keyMaterial = (struct KeyMaterialDh *)(key->data); in InitDhStruct() local
109 …if (key->size != sizeof(struct KeyMaterialDh) + keyMaterial->pubKeySize + keyMaterial->priKeySize)… in InitDhStruct()
114 ret = DhGetNid(keyMaterial->keySize, &nid); in InitDhStruct()
[all …]
Dopenssl_rsa_helper.c33 struct KeyMaterialRsa *keyMaterial = (struct KeyMaterialRsa *)key->data; in SaveRsaKeyToHksBlob() local
34 keyMaterial->keyAlg = HKS_ALG_RSA; in SaveRsaKeyToHksBlob()
35 keyMaterial->keySize = keySize; in SaveRsaKeyToHksBlob()
36 keyMaterial->nSize = keyByteLen; in SaveRsaKeyToHksBlob()
37 keyMaterial->eSize = keyByteLen; in SaveRsaKeyToHksBlob()
38 keyMaterial->dSize = keyByteLen; in SaveRsaKeyToHksBlob()
43 uint32_t offset = sizeof(*keyMaterial); in SaveRsaKeyToHksBlob()
45 if (memcpy_s(key->data + offset, keyMaterial->nSize, tmpBuff, keyMaterial->nSize) != 0) { in SaveRsaKeyToHksBlob()
50 offset += keyMaterial->nSize; in SaveRsaKeyToHksBlob()
52 if (memcpy_s(key->data + offset, keyMaterial->eSize, tmpBuff, keyMaterial->eSize) != 0) { in SaveRsaKeyToHksBlob()
[all …]
Dopenssl_ecc_helper.c54 …const struct KeyMaterialEcc *keyMaterial, BIGNUM *pubX, BIGNUM *pubY, const BIGNUM *priv, uint8_t … in TransEccKeyToKeyBlob() argument
57 if (BN_bn2binpad(pubX, rawMaterial + offset, keyMaterial->xSize) <= 0) { in TransEccKeyToKeyBlob()
60 offset += keyMaterial->xSize; in TransEccKeyToKeyBlob()
62 if (BN_bn2binpad(pubY, rawMaterial + offset, keyMaterial->ySize) <= 0) { in TransEccKeyToKeyBlob()
65 offset += keyMaterial->ySize; in TransEccKeyToKeyBlob()
67 if (BN_bn2binpad(priv, rawMaterial + offset, keyMaterial->zSize) <= 0) { in TransEccKeyToKeyBlob()
80 struct KeyMaterialEcc *keyMaterial = (struct KeyMaterialEcc *)rawMaterial; in EccSaveKeyMaterial() local
81 keyMaterial->keyAlg = HKS_ALG_ECC; in EccSaveKeyMaterial()
82 keyMaterial->keySize = keyLen; in EccSaveKeyMaterial()
83 keyMaterial->xSize = HKS_KEY_BYTES(keyLen); in EccSaveKeyMaterial()
[all …]
/base/security/huks/frameworks/huks_standard/main/common/src/
Dhks_crypto_adapter.c316 struct KeyMaterial25519 *keyMaterial = (struct KeyMaterial25519 *)keyIn->data; in CheckCurve25519KeySize() local
319 …if (keyIn->size < (sizeof(struct KeyMaterial25519) + keyMaterial->pubKeySize + keyMaterial->priKey… in CheckCurve25519KeySize()
332 struct KeyMaterial25519 *keyMaterial = (struct KeyMaterial25519 *)keyIn->data; in CheckFormatCurve25519Key() local
334 if (keyMaterial->pubKeySize > MAX_KEY_SIZE || keyMaterial->priKeySize > MAX_KEY_SIZE) { in CheckFormatCurve25519Key()
338 if (paramSetOut->paramSetSize < (offset + keyMaterial->pubKeySize + keyMaterial->priKeySize)) { in CheckFormatCurve25519Key()
351 struct KeyMaterial25519 *keyMaterial = (struct KeyMaterial25519 *)keyIn->data; in FormatCurve25519Key() local
355 .blob = { keyMaterial->pubKeySize, keyIn->data + sizeof(struct KeyMaterial25519) }, in FormatCurve25519Key()
359 .blob = { keyMaterial->priKeySize, in FormatCurve25519Key()
360 keyIn->data + sizeof(struct KeyMaterial25519) + keyMaterial->pubKeySize }, in FormatCurve25519Key()
367 int32_t GetCurve25519FromKeyMaterial(const bool isPubKey, const struct HksBlob *keyMaterial, in GetCurve25519FromKeyMaterial() argument
[all …]
Dhks_check_paramset.c369 struct HksPubKeyInfo *keyMaterial = (struct HksPubKeyInfo *)(key->data); in CheckImportKeySize() local
370 if ((keyMaterial->keyAlg != alg) || (keyMaterial->keySize != params->keyLen.value)) { in CheckImportKeySize()
472 struct HksKeyMaterialRsa *keyMaterial = (struct HksKeyMaterialRsa *)(key->data); in CheckRsaKeyLen() local
473 if ((keyMaterial->keyAlg != alg) || (keyMaterial->keySize != params->keyLen.value)) { in CheckRsaKeyLen()
478 if ((keyMaterial->nSize > HKS_RSA_KEY_SIZE_4096) || (keyMaterial->nSize == 0) || in CheckRsaKeyLen()
479 (keyMaterial->dSize > HKS_RSA_KEY_SIZE_4096) || (keyMaterial->dSize == 0) || in CheckRsaKeyLen()
480 (keyMaterial->eSize > HKS_RSA_KEY_SIZE_4096) || (keyMaterial->eSize == 0)) { in CheckRsaKeyLen()
485 …32_t keySize = sizeof(struct HksKeyMaterialRsa) + keyMaterial->nSize + keyMaterial->dSize + keyMat… in CheckRsaKeyLen()
502 struct HksKeyMaterialEcc *keyMaterial = (struct HksKeyMaterialEcc *)(key->data); in CheckEccKeyLen() local
503 if ((keyMaterial->keyAlg != alg) || (keyMaterial->keySize != params->keyLen.value)) { in CheckEccKeyLen()
[all …]
/base/security/certificate_manager/services/cert_manager_standard/cert_manager_engine/main/core/src/
Dcert_manager_app_cert_process.c45 …tic int32_t TransEccKeyToKeyBlob(const EC_KEY *eccKey, const struct HksKeyMaterialEcc *keyMaterial, in TransEccKeyToKeyBlob() argument
66 retCode = BN_bn2binpad(pubX, rawMaterial->data + offset, keyMaterial->xSize); in TransEccKeyToKeyBlob()
71 offset += keyMaterial->xSize; in TransEccKeyToKeyBlob()
73 retCode = BN_bn2binpad(pubY, rawMaterial->data + offset, keyMaterial->ySize); in TransEccKeyToKeyBlob()
78 offset += keyMaterial->ySize; in TransEccKeyToKeyBlob()
81 retCode = BN_bn2binpad(priv, rawMaterial->data + offset, keyMaterial->zSize); in TransEccKeyToKeyBlob()
114 struct HksKeyMaterialEcc *keyMaterial = (struct HksKeyMaterialEcc *)rawMaterial.data; in SaveKeyMaterialEcc() local
115 keyMaterial->keyAlg = HKS_ALG_ECC; in SaveKeyMaterialEcc()
116 keyMaterial->keySize = keySize; in SaveKeyMaterialEcc()
117 keyMaterial->xSize = CM_KEY_BYTES(keySize); in SaveKeyMaterialEcc()
[all …]
/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/
Dhks_inner_test.cpp273 HksBlob keyMaterial = {.size = 0, .data = nullptr}; variable
274 ret = HksFormatKeyFromMaterial(HKS_ALG_AES, &keyMaterial, nullptr);
275 ret = HksFormatKeyFromMaterial(HKS_ALG_RSA, &keyMaterial, nullptr);
276 ret = HksFormatKeyFromMaterial(HKS_ALG_HMAC, &keyMaterial, nullptr);
277 ret = HksFormatKeyFromMaterial(HKS_ALG_DSA, &keyMaterial, nullptr);
278 ret = HksFormatKeyFromMaterial(HKS_ALG_ECC, &keyMaterial, nullptr);
291 HksBlob keyMaterial = {.size = 0, .data = nullptr}; variable
292 ret = HksFormatKeyFromMaterial(HKS_ALG_AES, &keyMaterial, nullptr);
293 ret = HksFormatKeyFromMaterial(HKS_ALG_RSA, &keyMaterial, nullptr);
294 ret = HksFormatKeyFromMaterial(HKS_ALG_HMAC, &keyMaterial, nullptr);
[all …]
/base/security/huks/test/unittest/huks_standard_test/crypto_engine_test/src/
Dhks_crypto_hal_dsa_key.cpp118 KeyMaterialDsa *keyMaterial = (KeyMaterialDsa *)key.data; variable
119 ASSERT_NE(keyMaterial, nullptr);
122 …sizeof(KeyMaterialDsa) + keyMaterial->ySize + keyMaterial->pSize + keyMaterial->qSize + keyMateria…
Dhks_crypto_hal_api_mbedtls.cpp305 KeyMaterialRsa *keyMaterial = (KeyMaterialRsa *)key.data; variable
306 keyMaterial->keyAlg = HKS_ALG_RSA;
307 keyMaterial->keySize = 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);
310keyMaterial->dSize = HKS_KEY_BYTES(HKS_RSA_KEY_SIZE_4096) + HKS_KEY_BYTES(HKS_RSA_KEY_SIZE_4096);
316 keyMaterial->dSize = HKS_KEY_BYTES(HKS_RSA_KEY_SIZE_4096);
317 keyMaterial->keySize = ERROR_KEY_SIZE;
322 keyMaterial->keySize = HKS_RSA_KEY_SIZE_4096;
346 KeyMaterialRsa *keyMaterial = (KeyMaterialRsa *)key.data; variable
[all …]
/base/security/huks/frameworks/huks_standard/main/core/src/
Dhks_local_engine.c185 const struct KeyMaterialRsa *keyMaterial = (struct KeyMaterialRsa *)key->data; in CheckLocalCipherParams() local
186 keySize = keyMaterial->keySize; in CheckLocalCipherParams()
325 struct HksBlob keyMaterial = { 0, NULL }; in HksLocalSign() local
327 ret = HksSetKeyToMaterial(usageSpec.algType, false, key, &keyMaterial); in HksLocalSign()
333 ret = HksCryptoHalSign(&keyMaterial, &usageSpec, &message, signature); in HksLocalSign()
337 if (keyMaterial.data != NULL) { in HksLocalSign()
338 (void)memset_s(keyMaterial.data, keyMaterial.size, 0, keyMaterial.size); in HksLocalSign()
339 HKS_FREE_PTR(keyMaterial.data); in HksLocalSign()
358 struct HksBlob keyMaterial = { 0, NULL }; in HksLocalVerify() local
360 ret = HksSetKeyToMaterial(usageSpec.algType, true, key, &keyMaterial); in HksLocalVerify()
[all …]
/base/security/huks/utils/crypto_adapter/
Dhks_client_service_adapter.c326 struct KeyMaterialDsa *keyMaterial = (struct KeyMaterialDsa *)publicKey->data; in GetDsaPubKeyParam() local
327 …uint32_t keyMaterialSize = sizeof(struct KeyMaterialDsa) + keyMaterial->xSize + keyMaterial->ySize… in GetDsaPubKeyParam()
328 keyMaterial->pSize + keyMaterial->qSize + keyMaterial->gSize; in GetDsaPubKeyParam()
333 uint32_t offset = sizeof(struct KeyMaterialDsa) + keyMaterial->xSize; in GetDsaPubKeyParam()
334 y->size = keyMaterial->ySize; in GetDsaPubKeyParam()
336 offset += keyMaterial->ySize; in GetDsaPubKeyParam()
337 p->size = keyMaterial->pSize; in GetDsaPubKeyParam()
339 offset += keyMaterial->pSize; in GetDsaPubKeyParam()
340 q->size = keyMaterial->qSize; in GetDsaPubKeyParam()
342 offset += keyMaterial->qSize; in GetDsaPubKeyParam()
[all …]
/base/security/crypto_framework/test/unittest/src/
Dcrypto_sm4_generator_test.cpp286 uint8_t keyMaterial[] = { variable
290 HcfBlob keyTmpBlob = { .data = keyMaterial, .len = KEY_MATERIAL_LEN };
325 uint8_t keyMaterial[] = { variable
329 HcfBlob keyTmpBlob = { .data = keyMaterial, .len = KEY_MATERIAL_LEN };
364 uint8_t keyMaterial[] = { variable
368 HcfBlob keyTmpBlob = { .data = keyMaterial, .len = KEY_MATERIAL_LEN };
383 tmpLen = impl->keyMaterial.len;
384 impl->keyMaterial.len = 0;
388 impl->keyMaterial.len = tmpLen;
409 uint8_t keyMaterial[] = { variable
[all …]
/base/security/huks/frameworks/huks_standard/main/common/include/
Dhks_crypto_adapter.h48 …KeyToMaterial(uint32_t alg, bool isPubKey, const struct HksBlob *key, struct HksBlob *keyMaterial);
50 int32_t HksGetKeyFromMaterial(uint32_t alg, bool isPubKey, const struct HksBlob *keyMaterial, struc…
52 int32_t HksFormatKeyFromMaterial(uint32_t alg, const struct HksBlob *keyMaterial, struct HksParamSe…
/base/security/huks/services/huks_standard/huks_engine/main/core/src/
Dhks_keyblob_lite.c218 struct KeyMaterial25519 *keyMaterial = (struct KeyMaterial25519 *)adjustedKey->data; in Ed25519BlobToKeyMaterial() local
219 keyMaterial->keyAlg = HKS_ALG_ED25519; in Ed25519BlobToKeyMaterial()
220 keyMaterial->keySize = HKS_CURVE25519_KEY_SIZE_256; in Ed25519BlobToKeyMaterial()
221 keyMaterial->pubKeySize = HKS_KEY_BYTES(HKS_CURVE25519_KEY_SIZE_256); in Ed25519BlobToKeyMaterial()
222 keyMaterial->priKeySize = HKS_KEY_BYTES(HKS_CURVE25519_KEY_SIZE_256); in Ed25519BlobToKeyMaterial()
224 uint32_t offset = sizeof(*keyMaterial); in Ed25519BlobToKeyMaterial()
243 struct KeyMaterial25519 *keyMaterial = (struct KeyMaterial25519 *)key->data; in Ed25519KeyMaterialToBlob() local
244 if ((keyMaterial->pubKeySize != HKS_KEY_BYTES(HKS_CURVE25519_KEY_SIZE_256)) || in Ed25519KeyMaterialToBlob()
245 (keyMaterial->priKeySize != HKS_KEY_BYTES(HKS_CURVE25519_KEY_SIZE_256)) || in Ed25519KeyMaterialToBlob()
246 (key->size < (sizeof(*keyMaterial) + keyMaterial->pubKeySize + keyMaterial->priKeySize))) { in Ed25519KeyMaterialToBlob()
[all …]

12