/base/security/huks/frameworks/huks_standard/main/crypto_engine/openssl/src/ |
H A D | hks_openssl_sm3.c | 33 if ((spec->keyLen == 0) || (spec->keyLen % BIT_NUM_OF_UINT8 != 0)) {
in Sm3GenKeyCheckParam() 34 HKS_LOG_E("keyLen is wrong, len = %" LOG_PUBLIC "u", spec->keyLen);
in Sm3GenKeyCheckParam() 44 return HksOpensslGenerateRandomKey(spec->keyLen, key);
in HksOpensslSm3GenerateKey()
|
H A D | hks_openssl_dsa.c | 154 uint32_t keyLen, uint32_t *xlen, uint32_t *ylen, uint32_t *plen, uint32_t *qlen, uint32_t *glen) in DsaGetKeyParamLen() 156 *xlen = (keyLen >= OPENSSL_DSA_KEY_LEN_DIVID) ? HKS_DIGEST_SHA256_LEN : HKS_DIGEST_SHA1_LEN; in DsaGetKeyParamLen() 157 *ylen = keyLen; in DsaGetKeyParamLen() 158 *plen = keyLen; in DsaGetKeyParamLen() 159 *qlen = (keyLen >= OPENSSL_DSA_KEY_LEN_DIVID) ? HKS_DIGEST_SHA256_LEN : HKS_DIGEST_SHA1_LEN; in DsaGetKeyParamLen() 160 *glen = keyLen; in DsaGetKeyParamLen() 186 static int32_t DsaKeyMaterialParam(uint8_t *rawMaterial, const DSA *dsa, uint32_t keyLen) in DsaKeyMaterialParam() argument 190 keyMaterial->keySize = keyLen * HKS_BITS_PER_BYTE; in DsaKeyMaterialParam() 191 DsaGetKeyParamLen(keyLen, in DsaKeyMaterialParam() 245 uint32_t keyLen; in DsaSaveKeyMaterial() local 153 DsaGetKeyParamLen( uint32_t keyLen, uint32_t *xlen, uint32_t *ylen, uint32_t *plen, uint32_t *qlen, uint32_t *glen) DsaGetKeyParamLen() argument [all...] |
/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/alg_module_test/src/ |
H A D | openssl_aes_helper.c | 31 int32_t GenerateAesKey(const int keyLen, struct HksBlob *randomKey) in GenerateAesKey() argument 33 uint32_t keySize = keyLen / BIT_NUM_OF_UINT8; in GenerateAesKey() 54 static const EVP_CIPHER *AesCbcCrypt(uint32_t keyLen) in AesCbcCrypt() argument 56 if (keyLen == HKS_AES_KEY_SIZE_128) { in AesCbcCrypt() 58 } else if (keyLen == HKS_AES_KEY_SIZE_192) { in AesCbcCrypt() 60 } else if (keyLen == HKS_AES_KEY_SIZE_256) { in AesCbcCrypt() 66 static const EVP_CIPHER *AesEcbCrypt(uint32_t keyLen) in AesEcbCrypt() argument 68 if (keyLen == HKS_AES_KEY_SIZE_128) { in AesEcbCrypt() 70 } else if (keyLen == HKS_AES_KEY_SIZE_192) { in AesEcbCrypt() 72 } else if (keyLen in AesEcbCrypt() 78 AesCtrCrypt(uint32_t keyLen) AesCtrCrypt() argument 90 AesGcmCrypt(uint32_t keyLen) AesGcmCrypt() argument 106 struct HksParam *keyLen = NULL; AesInit() local [all...] |
H A D | openssl_ecc_helper.c | 31 static int32_t GetCurveId(uint32_t keyLen, int *nid) in GetCurveId() argument 33 switch (keyLen) { in GetCurveId() 73 static int32_t EccSaveKeyMaterial(const EC_KEY *eccKey, const uint32_t keyLen, uint8_t **output, uint32_t *outputSize) in EccSaveKeyMaterial() argument 75 uint32_t rawMaterialLen = sizeof(struct KeyMaterialEcc) + HKS_KEY_BYTES(keyLen) * ECC_KEYPAIR_CNT; in EccSaveKeyMaterial() 82 keyMaterial->keySize = keyLen; 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() 132 int32_t EccGenerateKey(const int keyLen, struct HksBlob *key) in EccGenerateKey() argument 135 if (GetCurveId(keyLen, in EccGenerateKey() 469 uint32_t keyLen = (uint32_t)EC_GROUP_order_bits(EC_KEY_get0_group(ecKey)); EcKeyToPublicKey() local 630 size_t keyLen = 0; EcdhDerive() local 651 EcdhAgreeKey( const int keyLen, const struct HksBlob *nativeKey, const struct HksBlob *pubKey, struct HksBlob *sharedKey) EcdhAgreeKey() argument [all...] |
/base/security/huks/test/unittest/huks_standard_test/crypto_engine_test/src/ |
H A D | hks_crypto_hal_rsa_cipher.cpp | 46 .keyLen = HKS_RSA_KEY_SIZE_512, 73 .keyLen = HKS_RSA_KEY_SIZE_768, 101 .keyLen = HKS_RSA_KEY_SIZE_1024, 130 .keyLen = HKS_RSA_KEY_SIZE_2048, 161 .keyLen = HKS_RSA_KEY_SIZE_3072, 194 .keyLen = HKS_RSA_KEY_SIZE_4096, 231 .keyLen = HKS_RSA_KEY_SIZE_512, 252 .keyLen = HKS_RSA_KEY_SIZE_768, 273 .keyLen = HKS_RSA_KEY_SIZE_1024, 295 .keyLen [all...] |
H A D | hks_crypto_hal_ecdh_agree.cpp | 46 .keyLen = HKS_ECC_KEY_SIZE_224, 51 .keyLen = HKS_ECC_KEY_SIZE_224, 62 .keyLen = HKS_ECC_KEY_SIZE_256, 67 .keyLen = HKS_ECC_KEY_SIZE_256, 77 .keyLen = HKS_ECC_KEY_SIZE_384, 82 .keyLen = HKS_ECC_KEY_SIZE_384, 92 .keyLen = HKS_ECC_KEY_SIZE_521, 97 .keyLen = HKS_ECC_KEY_SIZE_521,
|
H A D | hks_crypto_hal_ecdsa_sign.cpp | 50 .keyLen = HKS_ECC_KEY_SIZE_224, 70 .keyLen = HKS_ECC_KEY_SIZE_256, 89 .keyLen = HKS_ECC_KEY_SIZE_384, 108 .keyLen = HKS_ECC_KEY_SIZE_521, 128 .keyLen = HKS_ECC_KEY_SIZE_224, 147 .keyLen = HKS_ECC_KEY_SIZE_256, 166 .keyLen = HKS_ECC_KEY_SIZE_384, 185 .keyLen = HKS_ECC_KEY_SIZE_521, 204 .keyLen = HKS_ECC_KEY_SIZE_224, 223 .keyLen [all...] |
H A D | hks_crypto_hal_rsa_sign.cpp | 49 .keyLen = HKS_RSA_KEY_SIZE_512, 69 .keyLen = HKS_RSA_KEY_SIZE_768, 89 .keyLen = HKS_RSA_KEY_SIZE_1024, 109 .keyLen = HKS_RSA_KEY_SIZE_2048, 129 .keyLen = HKS_RSA_KEY_SIZE_3072, 149 .keyLen = HKS_RSA_KEY_SIZE_4096, 169 .keyLen = HKS_RSA_KEY_SIZE_512, 189 .keyLen = HKS_RSA_KEY_SIZE_768, 209 .keyLen = HKS_RSA_KEY_SIZE_1024, 230 .keyLen [all...] |
H A D | hks_crypto_hal_rsa_key.cpp | 42 .keyLen = HKS_RSA_KEY_SIZE_512, 55 .keyLen = HKS_RSA_KEY_SIZE_768, 68 .keyLen = HKS_RSA_KEY_SIZE_1024, 82 .keyLen = HKS_RSA_KEY_SIZE_2048, 95 .keyLen = HKS_RSA_KEY_SIZE_3072, 108 .keyLen = HKS_RSA_KEY_SIZE_4096, 228 .keyLen = HKS_RSA_KEY_SIZE_2048, in HWTEST_F()
|
H A D | hks_crypto_hal_dh.cpp | 41 .spec = { .algType = HKS_ALG_DH, .keyLen = HKS_DH_KEY_SIZE_2048, }, 46 .spec = { .algType = HKS_ALG_DH, .keyLen = HKS_DH_KEY_SIZE_3072, }, 51 .spec = { .algType = HKS_ALG_DH, .keyLen = HKS_DH_KEY_SIZE_4096, },
|
H A D | hks_crypto_hal_ecc_key.cpp | 42 .keyLen = HKS_ECC_KEY_SIZE_224, 56 .keyLen = HKS_ECC_KEY_SIZE_256, 69 .keyLen = HKS_ECC_KEY_SIZE_384, 82 .keyLen = HKS_ECC_KEY_SIZE_521, 182 .keyLen = HKS_ECC_KEY_SIZE_384, in HWTEST_F()
|
H A D | hks_crypto_hal_api_mbedtls.cpp | 69 .keyLen = HKS_AES_KEY_SIZE_128, in HWTEST_F() 88 .keyLen = 0, in HWTEST_F() 101 * @tc.desc : Using HksCryptoHalGenerateKey Generate key -- algType is AES keyLen is invalid. 109 .keyLen = 0, in HWTEST_F() 298 uint32_t keyLen = sizeof(KeyMaterialRsa) + HKS_KEY_BYTES(HKS_RSA_KEY_SIZE_4096) + in HWTEST_F() local 301 key = { .size = keyLen, .data = (uint8_t *)HksMalloc(keyLen) }; in HWTEST_F() 337 .keyLen = HKS_RSA_KEY_SIZE_2048, in HWTEST_F() 372 .keyLen = HKS_ECC_KEY_SIZE_256, in HWTEST_F() 376 spec.keyLen in HWTEST_F() [all...] |
H A D | hks_crypto_hal_hmac_hmac.cpp | 48 .keyLen = HMAC_KEY_SIZE, 60 .keyLen = HMAC_KEY_SIZE, 73 .keyLen = HMAC_KEY_SIZE, 85 .keyLen = HMAC_KEY_SIZE, 97 .keyLen = HMAC_KEY_SIZE,
|
H A D | hks_crypto_hal_aes_key.cpp | 41 .keyLen = HKS_AES_KEY_SIZE_128, 54 .keyLen = HKS_AES_KEY_SIZE_192, 67 .keyLen = HKS_AES_KEY_SIZE_256,
|
/base/startup/init/services/param/base/ |
H A D | param_trie.c | 29 static uint32_t AllocateParamTrieNode(WorkSpace *workSpace, const char *key, uint32_t keyLen);
70 static uint32_t AllocateParamTrieNode(WorkSpace *workSpace, const char *key, uint32_t keyLen)
in AllocateParamTrieNode() argument 72 uint32_t len = keyLen + sizeof(ParamTrieNode) + 1;
in AllocateParamTrieNode() 78 node->length = keyLen;
in AllocateParamTrieNode() 79 int ret = PARAM_MEMCPY(node->key, keyLen, key, keyLen);
in AllocateParamTrieNode() 81 node->key[keyLen] = '\0';
in AllocateParamTrieNode() 130 static int CompareParamTrieNode(const ParamTrieNode *node, const char *key, uint32_t keyLen)
in CompareParamTrieNode() argument 132 if (node->length > keyLen) {
in CompareParamTrieNode() 134 } else if (node->length < keyLen) {
in CompareParamTrieNode() 140 AddToSubTrie(WorkSpace *workSpace, ParamTrieNode *current, const char *key, uint32_t keyLen) AddToSubTrie() argument 172 AddTrieNode(WorkSpace *workSpace, const char *key, uint32_t keyLen) AddTrieNode() argument 271 AddParamNode(WorkSpace *workSpace, uint8_t type, const char *key, uint32_t keyLen, const char *value, uint32_t valueLen, int mode) AddParamNode() argument 313 FindTrieNode(WorkSpace *workSpace, const char *key, uint32_t keyLen, uint32_t *matchLabel) FindTrieNode() argument [all...] |
H A D | param_include.h | 39 ParamTrieNode *current, const char *key, uint32_t keyLen, uint32_t *matchLabel)
in FindSubTrie() 44 if (subTrie->length > keyLen) {
in FindSubTrie() 46 } else if (subTrie->length < keyLen) {
in FindSubTrie() 49 ret = memcmp(subTrie->key, key, keyLen);
in FindSubTrie() 72 const WorkSpace *workSpace, const char *key, uint32_t keyLen, uint32_t *matchLabel)
in FindTrieNode_() 78 const char *end = key + keyLen;
in FindTrieNode_() 38 FindSubTrie(const WorkSpace *workSpace, ParamTrieNode *current, const char *key, uint32_t keyLen, uint32_t *matchLabel) FindSubTrie() argument 71 FindTrieNode_( const WorkSpace *workSpace, const char *key, uint32_t keyLen, uint32_t *matchLabel) FindTrieNode_() argument
|
/base/security/huks/frameworks/crypto_lite/cipher/src/ |
H A D | cipher_rsa.c | 38 static char *RsaMallocPrivateKey(const unsigned char *key, size_t *keyLen) in RsaMallocPrivateKey() argument 45 size_t keyFinalLen = *keyLen + startLen + endLen + 1; in RsaMallocPrivateKey() 60 ret = memcpy_s(privateKey + startLen, keyFinalLen - startLen, key, *keyLen); in RsaMallocPrivateKey() 67 ret = memcpy_s(privateKey + startLen + *keyLen, keyFinalLen - startLen - *keyLen, end, endLen); in RsaMallocPrivateKey() 75 *keyLen = keyFinalLen; in RsaMallocPrivateKey() 79 static char *RsaMallocPublicKey(const unsigned char *key, size_t *keyLen) in RsaMallocPublicKey() argument 86 size_t keyFinalLen = *keyLen + startLen + endLen + 1; in RsaMallocPublicKey() 101 ret = memcpy_s(pubKey + startLen, keyFinalLen - startLen, key, *keyLen); in RsaMallocPublicKey() 108 ret = memcpy_s(pubKey + startLen + *keyLen, keyFinalLe in RsaMallocPublicKey() 127 RsaLoadPrivateKey(mbedtls_pk_context *pk, const unsigned char *key, size_t keyLen) RsaLoadPrivateKey() argument 177 RsaLoadPublicKey(mbedtls_pk_context *pk, const unsigned char *key, size_t keyLen) RsaLoadPublicKey() argument [all...] |
/base/security/dlp_permission_service/frameworks/common/src/ |
H A D | permission_policy.cpp | 177 static void SetKey(const uint8_t* originalKey, uint32_t originalKeyLen, uint8_t** key, uint32_t& keyLen) in SetKey() argument 185 FreeUint8Buffer(key, keyLen); in SetKey() 189 DLP_LOG_ERROR(LABEL, "Key len invalid, len=%{public}u", keyLen); in SetKey() 192 FreeUint8Buffer(key, keyLen); in SetKey() 195 DLP_LOG_ERROR(LABEL, "Alloc %{public}u buff for key fail", keyLen); in SetKey() 198 keyLen = originalKeyLen; in SetKey() 199 if (memcpy_s(*key, keyLen, originalKey, originalKeyLen) != EOK) { in SetKey() 201 FreeUint8Buffer(key, keyLen); in SetKey() 206 void PermissionPolicy::SetAeskey(const uint8_t* key, uint32_t keyLen) in SetAeskey() argument 209 SetKey(key, keyLen, in SetAeskey() 238 SetHmacKey(const uint8_t* key, uint32_t keyLen) SetHmacKey() argument [all...] |
/base/security/huks/frameworks/huks_standard/main/crypto_engine/mbedtls/src/ |
H A D | hks_mbedtls_dh.c | 131 ret = GetDhParam(spec->keyLen, ¶mP, ¶mG); in HksMbedtlsDhGenerateKey() 133 uint32_t keyLen = HKS_KEY_BYTES(spec->keyLen); in HksMbedtlsDhGenerateKey() 140 ctx.len = keyLen; in HksMbedtlsDhGenerateKey() 142 uint8_t *output = (uint8_t *)HksMalloc(keyLen); in HksMbedtlsDhGenerateKey() 144 ret = mbedtls_dhm_make_public(&ctx, keyLen, output, keyLen, mbedtls_ctr_drbg_random, &ctrDrbg); in HksMbedtlsDhGenerateKey() 148 ret = DhSaveKeyMaterial(&ctx, spec->keyLen, key); in HksMbedtlsDhGenerateKey() 230 if (HKS_KEY_BYTES(spec->keyLen) > sharedKey->size) { in HksMbedtlsDhAgreeKey() 261 size_t keyLen; in HksMbedtlsDhAgreeKey() local [all...] |
H A D | hks_mbedtls_ecdsa.c | 77 size_t keyLen = (size_t)(signature->size); in HksMbedtlsEcdsaSign() 79 signature->data, keyLen, &keyLen, mbedtls_ctr_drbg_random, &ctrDrbg); in HksMbedtlsEcdsaSign() 80 signature->size = (uint32_t)keyLen; in HksMbedtlsEcdsaSign() 81 if (ret != HKS_MBEDTLS_SUCCESS || keyLen != (size_t)(signature->size)) { in HksMbedtlsEcdsaSign()
|
/base/startup/init/services/param/include/ |
H A D | param_trie.h | 46 INIT_LOCAL_API ParamTrieNode *AddTrieNode(WorkSpace *workSpace, const char *key, uint32_t keyLen);
48 WorkSpace *workSpace, const char *key, uint32_t keyLen, uint32_t *matchLabel);
56 const char *key, uint32_t keyLen, const char *value, uint32_t valueLen, int mode);
64 const WorkSpace *workSpace, const char *key, uint32_t keyLen, uint32_t *matchLabel);
|
/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/alg_module_test/include/ |
H A D | openssl_dh_helper.h | 28 int32_t DhGenerateKey(const int keyLen, struct HksBlob *key); 31 const int keyLen, const struct HksBlob *nativeKey, const struct HksBlob *pubKey, struct HksBlob *sharedKey);
|
/base/security/device_auth/services/legacy/group_auth/src/group_auth_manager/account_unrelated_group_auth/ |
H A D | account_unrelated_group_auth.c | 51 uint32_t keyLen = (HcStrlen(returnSessionKeyStr) / BYTE_TO_HEX_OPER_LENGTH); in ReturnSessionKey() local 52 uint8_t *sessionKey = (uint8_t *)HcMalloc(keyLen, 0); in ReturnSessionKey() 60 if (GetByteFromJson(out, FIELD_SESSION_KEY, sessionKey, keyLen) != HC_SUCCESS) { in ReturnSessionKey() 72 callback->onSessionKeyReturned(requestId, sessionKey, keyLen); in ReturnSessionKey() 75 (void)memset_s(sessionKey, keyLen, 0, keyLen); in ReturnSessionKey() 154 int32_t keyLen = DEFAULT_RETURN_KEY_LENGTH; in AddSessionKeyToSelfData() local 155 (void)GetIntFromJson(authParam, FIELD_KEY_LENGTH, &keyLen); in AddSessionKeyToSelfData() 156 uint8_t *sessionKey = (uint8_t *)HcMalloc(keyLen, 0); in AddSessionKeyToSelfData() 163 if (GetByteFromJson(sendToSelf, FIELD_SESSION_KEY, sessionKey, keyLen) ! in AddSessionKeyToSelfData() 305 int32_t keyLen = DEFAULT_RETURN_KEY_LENGTH; AddNonAccountAuthInfo() local [all...] |
/base/security/huks/test/unittest/huks_standard_test/module_test/framework_test/crypto_engine_test/src/ |
H A D | hks_openssl_rsa_test.cpp | 73 .keyLen = HKS_RSA_KEY_SIZE_768, in HWTEST_F() 79 spec.keyLen = HKS_RSA_KEY_SIZE_1024; in HWTEST_F() 83 spec.keyLen = HKS_RSA_KEY_SIZE_2048; in HWTEST_F() 87 spec.keyLen = HKS_RSA_KEY_SIZE_3072; in HWTEST_F() 91 spec.keyLen = HKS_RSA_KEY_SIZE_4096; in HWTEST_F()
|
/base/security/huks/frameworks/crypto_lite/cipher/include/ |
H A D | cipher.h | 48 int32_t keyLen;
member 73 size_t keyLen;
member
|