/base/startup/init/services/init/standard/ |
D | init_cmds.c | 116 static void DoIfup(const struct CmdArgs *ctx) in DoIfup() argument 119 …INIT_ERROR_CHECK(strncpy_s(interface.ifr_name, IFNAMSIZ - 1, ctx->argv[0], strlen(ctx->argv[0])) =… in DoIfup() 136 static void DoInsmod(const struct CmdArgs *ctx) in DoInsmod() argument 141 if (ctx->argc > index) { in DoInsmod() 142 fileName = ctx->argv[index]; in DoInsmod() 145 … INIT_ERROR_CHECK(fileName != NULL, return, "Can not find file name from param %s", ctx->argv[0]); in DoInsmod() 148 …INIT_ERROR_CHECK(realPath != NULL, return, "Can not get real file name from param %s", ctx->argv[0… in DoInsmod() 149 if (ctx->argc > 1 && ctx->argv[1] != NULL && strcmp(ctx->argv[1], "-f") == 0) { // [-f] in DoInsmod() 153 char *options = BuildStringFromCmdArg(ctx, index); // [options] in DoInsmod() 171 static void DoSetParam(const struct CmdArgs *ctx) in DoSetParam() argument [all …]
|
/base/security/crypto_framework/frameworks/js/napi/crypto/src/ |
D | napi_verify.cpp | 79 static void FreeVerifyInitCtx(napi_env env, VerifyInitCtx *ctx) in FreeVerifyInitCtx() argument 81 if (ctx == nullptr) { in FreeVerifyInitCtx() 85 if (ctx->asyncWork != nullptr) { in FreeVerifyInitCtx() 86 napi_delete_async_work(env, ctx->asyncWork); in FreeVerifyInitCtx() 87 ctx->asyncWork = nullptr; in FreeVerifyInitCtx() 90 if (ctx->callback != nullptr) { in FreeVerifyInitCtx() 91 napi_delete_reference(env, ctx->callback); in FreeVerifyInitCtx() 92 ctx->callback = nullptr; in FreeVerifyInitCtx() 95 HcfFree(ctx); in FreeVerifyInitCtx() 98 static void FreeVerifyUpdateCtx(napi_env env, VerifyUpdateCtx *ctx) in FreeVerifyUpdateCtx() argument [all …]
|
D | napi_sign.cpp | 78 static void FreeSignInitCtx(napi_env env, SignInitCtx *ctx) in FreeSignInitCtx() argument 80 if (ctx == nullptr) { in FreeSignInitCtx() 84 if (ctx->asyncWork != nullptr) { in FreeSignInitCtx() 85 napi_delete_async_work(env, ctx->asyncWork); in FreeSignInitCtx() 88 if (ctx->callback != nullptr) { in FreeSignInitCtx() 89 napi_delete_reference(env, ctx->callback); in FreeSignInitCtx() 92 HcfFree(ctx); in FreeSignInitCtx() 95 static void FreeSignUpdateCtx(napi_env env, SignUpdateCtx *ctx) in FreeSignUpdateCtx() argument 97 if (ctx == nullptr) { in FreeSignUpdateCtx() 101 if (ctx->asyncWork != nullptr) { in FreeSignUpdateCtx() [all …]
|
D | napi_asy_key_generator.cpp | 66 static void FreeGenKeyPairCtx(napi_env env, GenKeyPairCtx *ctx) in FreeGenKeyPairCtx() argument 68 if (ctx == nullptr) { in FreeGenKeyPairCtx() 72 if (ctx->asyncWork != nullptr) { in FreeGenKeyPairCtx() 73 napi_delete_async_work(env, ctx->asyncWork); in FreeGenKeyPairCtx() 74 ctx->asyncWork = nullptr; in FreeGenKeyPairCtx() 77 if (ctx->callback != nullptr) { in FreeGenKeyPairCtx() 78 napi_delete_reference(env, ctx->callback); in FreeGenKeyPairCtx() 79 ctx->callback = nullptr; in FreeGenKeyPairCtx() 82 HcfFree(ctx); in FreeGenKeyPairCtx() 85 static void FreeConvertKeyCtx(napi_env env, ConvertKeyCtx *ctx) in FreeConvertKeyCtx() argument [all …]
|
D | napi_key_agreement.cpp | 48 static void FreeKeyAgreementCtx(napi_env env, KeyAgreementCtx *ctx) in FreeKeyAgreementCtx() argument 50 if (ctx == nullptr) { in FreeKeyAgreementCtx() 54 if (ctx->asyncWork != nullptr) { in FreeKeyAgreementCtx() 55 napi_delete_async_work(env, ctx->asyncWork); in FreeKeyAgreementCtx() 56 ctx->asyncWork = nullptr; in FreeKeyAgreementCtx() 59 if (ctx->callback != nullptr) { in FreeKeyAgreementCtx() 60 napi_delete_reference(env, ctx->callback); in FreeKeyAgreementCtx() 61 ctx->callback = nullptr; in FreeKeyAgreementCtx() 64 if (ctx->returnSecret.data != nullptr) { in FreeKeyAgreementCtx() 65 HcfFree(ctx->returnSecret.data); in FreeKeyAgreementCtx() [all …]
|
/base/startup/init/services/init/ |
D | init_common_cmds.c | 77 char *BuildStringFromCmdArg(const struct CmdArgs *ctx, int startIndex) in BuildStringFromCmdArg() argument 79 INIT_ERROR_CHECK(ctx != NULL, return NULL, "Failed to get cmd args "); in BuildStringFromCmdArg() 84 for (int i = startIndex; i < ctx->argc; i++) { // save opt in BuildStringFromCmdArg() 85 if (ctx->argv[i] == NULL) { in BuildStringFromCmdArg() 88 …en = snprintf_s(options + curr, OPTIONS_SIZE - curr, OPTIONS_SIZE - 1 - curr, "%s ", ctx->argv[i]); in BuildStringFromCmdArg() 107 …struct CmdArgs *ctx = (struct CmdArgs *)calloc(1, sizeof(struct CmdArgs) + sizeof(char *) * (argsC… in GetCmdArg() local 108 INIT_ERROR_CHECK(ctx != NULL, return NULL, "Failed to malloc memory for arg"); in GetCmdArg() 109 ctx->argc = 0; in GetCmdArg() 120 ctx->argv[ctx->argc] = AddOneArg(p, end - p); in GetCmdArg() 121 INIT_CHECK(ctx->argv[ctx->argc] != NULL, FreeCmdArg(ctx); in GetCmdArg() [all …]
|
/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/alg_module_test/src/ |
D | openssl_aes_helper.c | 102 static uint32_t AesInit(EVP_CIPHER_CTX **ctx, const EVP_CIPHER **ciper, const struct HksParamSet *p… in AesInit() argument 118 *ctx = EVP_CIPHER_CTX_new(); in AesInit() 119 if (*ctx == NULL) { in AesInit() 138 EVP_CIPHER_CTX *ctx = NULL; in AesEncrypt() local 139 if (AesInit(&ctx, &ciper, paramSetIn) != HKS_SUCCESS) { in AesEncrypt() 143 if (EVP_EncryptInit_ex(ctx, ciper, NULL, NULL, NULL) != 1) { in AesEncrypt() 144 EVP_CIPHER_CTX_free(ctx); in AesEncrypt() 148 if (EVP_EncryptInit_ex(ctx, NULL, NULL, randomKey->data, iv->blob.data) != 1) { in AesEncrypt() 149 EVP_CIPHER_CTX_free(ctx); in AesEncrypt() 155 ret = EVP_CIPHER_CTX_set_padding(ctx, OPENSSL_CTX_PADDING_ENABLE); in AesEncrypt() [all …]
|
D | openssl_ecc_helper.c | 301 EVP_MD_CTX *ctx = EVP_MD_CTX_new(); in InitEccMdCtx() local 302 if (ctx == NULL) { in InitEccMdCtx() 308 int32_t ret = EVP_DigestSignInit(ctx, NULL, md, NULL, key); in InitEccMdCtx() 311 EVP_MD_CTX_free(ctx); in InitEccMdCtx() 315 int ret = EVP_DigestVerifyInit(ctx, NULL, md, NULL, key); in InitEccMdCtx() 318 EVP_MD_CTX_free(ctx); in InitEccMdCtx() 322 return ctx; in InitEccMdCtx() 327 EVP_MD_CTX *ctx = InitEccMdCtx(key, digest, true); in EcdsaSign() local 328 if (ctx == NULL) { in EcdsaSign() 332 if (EVP_DigestSignUpdate(ctx, message->data, message->size) != 1) { in EcdsaSign() [all …]
|
/base/security/huks/frameworks/crypto_lite/cipher/src/ |
D | cipher_aes.c | 111 static int32_t SetIv(const char *ivBuf, int32_t ivBufLen, AesCryptContext *ctx) in SetIv() argument 113 if ((ivBuf == NULL) || (ctx == NULL)) { in SetIv() 117 …if ((ivBufLen < (ctx->iv.ivOffset + ctx->iv.ivLen)) || (ctx->iv.ivOffset < 0) || (ctx->iv.ivLen <=… in SetIv() 121 ctx->iv.ivBuf = malloc(ctx->iv.ivLen); in SetIv() 122 if (ctx->iv.ivBuf == NULL) { in SetIv() 127 int32_t ret = memcpy_s(ctx->iv.ivBuf, ctx->iv.ivLen, ivBuf + ctx->iv.ivOffset, ctx->iv.ivLen); in SetIv() 130 free(ctx->iv.ivBuf); in SetIv() 131 ctx->iv.ivBuf = NULL; in SetIv() 138 static int32_t InitAesCryptContext(const char *key, const AesIvMode *iv, AesCryptContext *ctx) in InitAesCryptContext() argument 142 if (iv == NULL || ctx == NULL || key == NULL) { in InitAesCryptContext() [all …]
|
/base/security/huks/frameworks/huks_standard/main/crypto_engine/openssl/src/ |
D | hks_openssl_aes.c | 56 static int32_t OpensslBlockCipherCryptInitParams(const struct HksBlob *key, EVP_CIPHER_CTX *ctx, in OpensslBlockCipherCryptInitParams() argument 61 …ret = EVP_EncryptInit_ex(ctx, NULL, NULL, key->data, (cipherParam == NULL) ? NULL : cipherParam->i… in OpensslBlockCipherCryptInitParams() 63 …ret = EVP_DecryptInit_ex(ctx, NULL, NULL, key->data, (cipherParam == NULL) ? NULL : cipherParam->i… in OpensslBlockCipherCryptInitParams() 72 ret = EVP_CIPHER_CTX_set_padding(ctx, OPENSSL_CTX_PADDING_ENABLE); in OpensslBlockCipherCryptInitParams() 75 ret = EVP_CIPHER_CTX_set_padding(ctx, OPENSSL_CTX_PADDING_NONE); in OpensslBlockCipherCryptInitParams() 91 EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new(); in OpensslBlockCipherCryptInit() local 92 if (ctx == NULL) { in OpensslBlockCipherCryptInit() 99 EVP_CIPHER_CTX_free(ctx); in OpensslBlockCipherCryptInit() 104 ret = EVP_EncryptInit_ex(ctx, cipher, NULL, NULL, NULL); in OpensslBlockCipherCryptInit() 106 ret = EVP_DecryptInit_ex(ctx, cipher, NULL, NULL, NULL); in OpensslBlockCipherCryptInit() [all …]
|
D | hks_openssl_sm2.c | 160 EVP_PKEY_CTX *ctx = NULL; in InitSm2Ctx() local 172 ctx = EVP_PKEY_CTX_new(key, NULL); in InitSm2Ctx() 173 HKS_IF_NULL_LOGE_BREAK(ctx, "new ctx failed") in InitSm2Ctx() 176 if (EVP_PKEY_sign_init(ctx) != HKS_OPENSSL_SUCCESS) { in InitSm2Ctx() 181 if (EVP_PKEY_verify_init(ctx) != HKS_OPENSSL_SUCCESS) { in InitSm2Ctx() 193 SELF_FREE_PTR(ctx, EVP_PKEY_CTX_free); in InitSm2Ctx() 197 return ctx; in InitSm2Ctx() 203 EVP_PKEY_CTX *ctx = InitSm2Ctx(key, usageSpec->digest, false); in HksOpensslSm2Verify() local 204 HKS_IF_NULL_LOGE_RETURN(ctx, HKS_ERROR_INVALID_KEY_INFO, "initialize sm2 context failed") in HksOpensslSm2Verify() 206 …if (EVP_PKEY_verify(ctx, signature->data, signature->size, message->data, message->size) != HKS_OP… in HksOpensslSm2Verify() [all …]
|
D | hks_openssl_rsa.c | 293 EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(pkey, NULL); in InitEvpPkeyCtx() local 294 if (ctx == NULL) { in InitEvpPkeyCtx() 301 ret = EVP_PKEY_encrypt_init(ctx); in InitEvpPkeyCtx() 303 ret = EVP_PKEY_decrypt_init(ctx); in InitEvpPkeyCtx() 308 EVP_PKEY_CTX_free(ctx); in InitEvpPkeyCtx() 313 return ctx; in InitEvpPkeyCtx() 316 static int32_t HksOpensslRsaCryptInit(EVP_PKEY_CTX *ctx, const struct HksUsageSpec *usageSpec) in HksOpensslRsaCryptInit() argument 323 ret = EVP_PKEY_CTX_set_rsa_padding(ctx, padding); in HksOpensslRsaCryptInit() 331 if ((md == NULL) || (EVP_PKEY_CTX_set_rsa_oaep_md(ctx, md) <= 0) || in HksOpensslRsaCryptInit() 332 (EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, md) <= 0)) { in HksOpensslRsaCryptInit() [all …]
|
D | hks_openssl_engine.c | 227 int32_t HksCryptoHalHmacInit(const struct HksBlob *key, uint32_t digestAlg, void **ctx) in HksCryptoHalHmacInit() argument 229 if (CheckBlob(key) != HKS_SUCCESS || ctx == NULL) { in HksCryptoHalHmacInit() 237 return func(ctx, key, digestAlg); in HksCryptoHalHmacInit() 240 int32_t HksCryptoHalHmacUpdate(const struct HksBlob *chunk, void *ctx) in HksCryptoHalHmacUpdate() argument 242 if (CheckBlob(chunk) != HKS_SUCCESS || ctx == NULL) { in HksCryptoHalHmacUpdate() 250 return func(ctx, chunk); in HksCryptoHalHmacUpdate() 253 int32_t HksCryptoHalHmacFinal(const struct HksBlob *msg, void **ctx, struct HksBlob *mac) in HksCryptoHalHmacFinal() argument 255 if (msg == NULL || ctx == NULL || CheckBlob(mac) != HKS_SUCCESS) { in HksCryptoHalHmacFinal() 263 return func(ctx, msg, mac); in HksCryptoHalHmacFinal() 266 void HksCryptoHalHmacFreeCtx(void **ctx) in HksCryptoHalHmacFreeCtx() argument [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() 48 ret = HksEccKeyMaterialToPri(nativeKey, &(ctx->d)); in EccKeyMaterialToCtx() 71 mbedtls_ecdh_context ctx; in HksMbedtlsEcdh() 72 (void)memset_s(&ctx, sizeof(mbedtls_ecdh_context), 0, sizeof(mbedtls_ecdh_context)); in HksMbedtlsEcdh() 73 mbedtls_ecdh_init(&ctx); in HksMbedtlsEcdh() 76 ret = mbedtls_ecp_group_load(&(ctx.grp), mbedtlsCurveNist); in HksMbedtlsEcdh() 82 ret = EccKeyMaterialToCtx(nativeKey, pubKey, &ctx); in HksMbedtlsEcdh() 85 …ret = mbedtls_ecdh_compute_shared(&(ctx.grp), &(ctx.z), &(ctx.Qp), &(ctx.d), mbedtls_ctr_drbg_rand… in HksMbedtlsEcdh() 92 ret = mbedtls_mpi_write_binary(&(ctx.z), sharedKey->data, keyByteLen); in HksMbedtlsEcdh() [all …]
|
D | hks_mbedtls_engine.c | 52 int32_t HksCryptoHalHmacInit(const struct HksBlob *key, uint32_t digestAlg, void **ctx) in HksCryptoHalHmacInit() argument 54 if (CheckBlob(key) != HKS_SUCCESS || ctx == NULL) { in HksCryptoHalHmacInit() 62 return func(ctx, key, digestAlg); in HksCryptoHalHmacInit() 65 int32_t HksCryptoHalHmacUpdate(const struct HksBlob *chunk, void *ctx) in HksCryptoHalHmacUpdate() argument 67 if (CheckBlob(chunk) != HKS_SUCCESS || ctx == NULL) { in HksCryptoHalHmacUpdate() 75 return func(ctx, chunk); in HksCryptoHalHmacUpdate() 78 int32_t HksCryptoHalHmacFinal(const struct HksBlob *msg, void **ctx, struct HksBlob *mac) in HksCryptoHalHmacFinal() argument 80 if (msg == NULL || ctx == NULL || *ctx == NULL || CheckBlob(mac) != HKS_SUCCESS) { in HksCryptoHalHmacFinal() 88 return func(ctx, msg, mac); in HksCryptoHalHmacFinal() 91 void HksCryptoHalHmacFreeCtx(void **ctx) in HksCryptoHalHmacFreeCtx() argument [all …]
|
D | hks_mbedtls_dh.c | 71 static int32_t DhSaveKeyMaterial(const mbedtls_dhm_context *ctx, const uint32_t keySize, struct Hks… in DhSaveKeyMaterial() argument 82 keyMaterial->pubKeySize = mbedtls_mpi_size(&ctx->GX); in DhSaveKeyMaterial() 83 keyMaterial->priKeySize = mbedtls_mpi_size(&ctx->X); in DhSaveKeyMaterial() 88 ret = mbedtls_mpi_write_binary(&(ctx->GX), rawMaterial + offset, keyMaterial->pubKeySize); in DhSaveKeyMaterial() 97 ret = mbedtls_mpi_write_binary(&(ctx->X), rawMaterial + offset, keyMaterial->priKeySize); in DhSaveKeyMaterial() 114 mbedtls_dhm_context ctx; in HksMbedtlsDhGenerateKey() local 115 (void)memset_s(&ctx, sizeof(mbedtls_dhm_context), 0, sizeof(mbedtls_dhm_context)); in HksMbedtlsDhGenerateKey() 116 mbedtls_dhm_init(&ctx); in HksMbedtlsDhGenerateKey() 124 mbedtls_dhm_free(&ctx); in HksMbedtlsDhGenerateKey() 135 if (mbedtls_mpi_read_binary(&ctx.P, paramP.data, paramP.size) != HKS_MBEDTLS_SUCCESS || in HksMbedtlsDhGenerateKey() [all …]
|
D | hks_mbedtls_ecdsa.c | 59 mbedtls_ecdsa_context ctx; in HksMbedtlsEcdsaSign() 60 (void)memset_s(&ctx, sizeof(mbedtls_ecdsa_context), 0, sizeof(mbedtls_ecdsa_context)); in HksMbedtlsEcdsaSign() 61 mbedtls_ecdsa_init(&ctx); in HksMbedtlsEcdsaSign() 64 ret = mbedtls_ecp_group_load(&(ctx.grp), curveNist); in HksMbedtlsEcdsaSign() 70 ret = HksEccKeyMaterialToPri(key, &(ctx.d)); in HksMbedtlsEcdsaSign() 78 …ret = mbedtls_ecdsa_write_signature(&ctx, (mbedtls_md_type_t)mbedtlsAlg, message->data, (size_t)me… in HksMbedtlsEcdsaSign() 90 mbedtls_ecdsa_free(&ctx); in HksMbedtlsEcdsaSign() 106 mbedtls_ecdsa_context ctx; in HksMbedtlsEcdsaVerify() 107 (void)memset_s(&ctx, sizeof(mbedtls_ecdsa_context), 0, sizeof(mbedtls_ecdsa_context)); in HksMbedtlsEcdsaVerify() 108 mbedtls_ecdsa_init(&ctx); in HksMbedtlsEcdsaVerify() [all …]
|
D | hks_mbedtls_rsa.c | 98 static int32_t RsaSaveKeyMaterial(const mbedtls_rsa_context *ctx, const uint32_t keySize, struct Hk… in RsaSaveKeyMaterial() argument 117 …ret = mbedtls_mpi_write_binary(&(ctx->MBEDTLS_PRIVATE(N)), rawMaterial + offset, keyMaterial->nSiz… in RsaSaveKeyMaterial() 124 …ret = mbedtls_mpi_write_binary(&(ctx->MBEDTLS_PRIVATE(E)), rawMaterial + offset, keyMaterial->eSiz… in RsaSaveKeyMaterial() 131 …ret = mbedtls_mpi_write_binary(&(ctx->MBEDTLS_PRIVATE(D)), rawMaterial + offset, keyMaterial->dSiz… in RsaSaveKeyMaterial() 152 mbedtls_rsa_context ctx; in HksMbedtlsRsaGenerateKey() local 153 (void)memset_s(&ctx, sizeof(mbedtls_rsa_context), 0, sizeof(mbedtls_rsa_context)); in HksMbedtlsRsaGenerateKey() 154 mbedtls_rsa_init(&ctx); in HksMbedtlsRsaGenerateKey() 155 ctx.MBEDTLS_PRIVATE(padding) = 0; in HksMbedtlsRsaGenerateKey() 156 ctx.MBEDTLS_PRIVATE(hash_id) = 0; in HksMbedtlsRsaGenerateKey() 164 mbedtls_rsa_free(&ctx); in HksMbedtlsRsaGenerateKey() [all …]
|
/base/startup/init/services/init/lite/ |
D | init_cmds.c | 31 static void DoExec(const struct CmdArgs *ctx) in DoExec() argument 34 if (ctx == NULL || ctx->argv[0] == NULL) { in DoExec() 40 INIT_LOGE("DoExec: failed to fork child process to exec \"%s\"", ctx->argv[0]); in DoExec() 44 int ret = execve(ctx->argv[0], ctx->argv, NULL); in DoExec() 46 INIT_LOGE("DoExec: execute \"%s\" failed: %d.", ctx->argv[0], errno); in DoExec() 73 static void DoLoadCfg(const struct CmdArgs *ctx) in DoLoadCfg() argument 77 if (!CheckValidCfg(ctx->argv[0])) { in DoLoadCfg() 78 INIT_LOGE("CheckCfg file %s Failed", ctx->argv[0]); in DoLoadCfg() 81 char *realPath = GetRealPath(ctx->argv[0]); in DoLoadCfg() 82 INIT_ERROR_CHECK(realPath != NULL, return, "Failed to get realpath %s", ctx->argv[0]); in DoLoadCfg() [all …]
|
/base/security/device_auth/deps_adapter/key_management_adapter/impl/src/standard/ |
D | crypto_hash_to_point.c | 112 const struct CurveConstPara *curvePara, BIGNUM *b, BN_CTX *ctx) in CurveHashToPointCalcB() argument 120 if (BN_mul(b, swap, swap, ctx) <= 0) { in CurveHashToPointCalcB() 123 if (BN_mod(b, b, curvePara->p, ctx) <= 0) { in CurveHashToPointCalcB() 126 if (BN_mul(swap, b, curvePara->u, ctx) <= 0) { in CurveHashToPointCalcB() 129 if (BN_mod(swap, swap, curvePara->p, ctx) <= 0) { in CurveHashToPointCalcB() 135 if (BN_mod(b, b, curvePara->p, ctx) <= 0) { in CurveHashToPointCalcB() 138 if (BN_mod_inverse(swap, b, curvePara->p, ctx) <= 0) { in CurveHashToPointCalcB() 141 if (BN_mul(b, swap, curvePara->minusA, ctx) <= 0) { in CurveHashToPointCalcB() 144 if (BN_mod(b, b, curvePara->p, ctx) <= 0) { in CurveHashToPointCalcB() 154 const struct CurveConstPara *curvePara, BIGNUM *a, BN_CTX *ctx) in CurveHashToPointCalcA() argument [all …]
|
/base/security/huks/services/huks_standard/huks_engine/main/core/include/ |
D | hks_crypto_hal.h | 121 int32_t HksCryptoHalHmacInit(const struct HksBlob *key, uint32_t digestAlg, void **ctx); 123 int32_t HksCryptoHalHmacUpdate(const struct HksBlob *chunk, void *ctx); 125 int32_t HksCryptoHalHmacFinal(const struct HksBlob *msg, void **ctx, struct HksBlob *mac); 127 void HksCryptoHalHmacFreeCtx(void **ctx); 132 int32_t HksCryptoHalHashInit(uint32_t alg, void **ctx); 134 int32_t HksCryptoHalHashUpdate(const struct HksBlob *msg, void *ctx); 136 int32_t HksCryptoHalHashFinal(const struct HksBlob *msg, void **ctx, struct HksBlob *hash); 140 void HksCryptoHalHashFreeCtx(void **ctx); 142 …sCryptoHalEncryptInit(const struct HksBlob *key, const struct HksUsageSpec *usageSpec, void **ctx); 144 int32_t HksCryptoHalEncryptUpdate(const struct HksBlob *message, void *ctx, struct HksBlob *out, [all …]
|
/base/startup/init/test/unittest/innerkits/ |
D | hookmgr_unittest.cpp | 39 struct HookExecCtx *ctx; in OhosHookTestCommon() local 45 ctx = (struct HookExecCtx *)executionContext; in OhosHookTestCommon() 46 ctx->result = result; in OhosHookTestCommon() 47 if (ctx->retErr) { in OhosHookTestCommon() 254 struct HookExecCtx ctx; variable 257 ctx.result = 0; 258 ctx.retErr = 0; 266 ret = HookMgrExecute(NULL, STAGE_TEST_ONE, (void *)&ctx, NULL); 268 EXPECT_EQ(ctx.result, 1); 271 ctx.retErr = 1; [all …]
|
/base/security/crypto_framework/plugin/openssl_plugin/crypto_operation/key_agreement/src/ |
D | ecdh_openssl.c | 90 EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(priPKey, NULL); in EcdhDerive() local 91 if (ctx == NULL) { in EcdhDerive() 95 if (EVP_PKEY_derive_init(ctx) != HCF_OPENSSL_SUCCESS) { in EcdhDerive() 97 EVP_PKEY_CTX_free(ctx); in EcdhDerive() 100 if (EVP_PKEY_derive_set_peer(ctx, pubPKey) != HCF_OPENSSL_SUCCESS) { in EcdhDerive() 102 EVP_PKEY_CTX_free(ctx); in EcdhDerive() 106 if (EVP_PKEY_derive(ctx, NULL, &maxLen) != HCF_OPENSSL_SUCCESS) { in EcdhDerive() 108 EVP_PKEY_CTX_free(ctx); in EcdhDerive() 114 EVP_PKEY_CTX_free(ctx); in EcdhDerive() 118 if (EVP_PKEY_derive(ctx, secretData, &actualLen) != HCF_OPENSSL_SUCCESS) { in EcdhDerive() [all …]
|
/base/security/huks/utils/crypto_adapter/ |
D | hks_client_service_adapter_lite.c | 45 static int32_t PkCtxToX509(mbedtls_pk_context *ctx, struct HksBlob *x509Key) in PkCtxToX509() argument 52 int32_t x509Size = mbedtls_pk_write_pubkey_der(ctx, tmpBuf, MAX_KEY_SIZE); in PkCtxToX509() 83 …c int32_t InitRsaPkCtx(const struct HksBlob *mod, const struct HksBlob *e, mbedtls_pk_context *ctx) in InitRsaPkCtx() argument 85 int32_t ret = mbedtls_pk_setup(ctx, mbedtls_pk_info_from_type(MBEDTLS_PK_RSA)); in InitRsaPkCtx() 110 mbedtls_rsa_context *rsaCtx = mbedtls_pk_rsa(*ctx); in InitRsaPkCtx() 130 mbedtls_pk_context ctx; in RsaToX509PublicKey() local 131 mbedtls_pk_init(&ctx); in RsaToX509PublicKey() 135 ret = InitRsaPkCtx(mod, e, &ctx); in RsaToX509PublicKey() 138 ret = PkCtxToX509(&ctx, x509Key); in RsaToX509PublicKey() 142 mbedtls_pk_free(&ctx); in RsaToX509PublicKey() [all …]
|
/base/security/huks/frameworks/huks_standard/main/common/include/ |
D | hks_crypto_hal.h | 199 int32_t HksCryptoHalHmacInit(const struct HksBlob *key, uint32_t digestAlg, void **ctx); 201 int32_t HksCryptoHalHmacUpdate(const struct HksBlob *chunk, void *ctx); 203 int32_t HksCryptoHalHmacFinal(const struct HksBlob *msg, void **ctx, struct HksBlob *mac); 205 void HksCryptoHalHmacFreeCtx(void **ctx); 210 int32_t HksCryptoHalHashInit(uint32_t alg, void **ctx); 212 int32_t HksCryptoHalHashUpdate(const struct HksBlob *msg, void *ctx); 214 int32_t HksCryptoHalHashFinal(const struct HksBlob *msg, void **ctx, struct HksBlob *hash); 216 void HksCryptoHalHashFreeCtx(void **ctx); 220 …sCryptoHalEncryptInit(const struct HksBlob *key, const struct HksUsageSpec *usageSpec, void **ctx); 222 int32_t HksCryptoHalEncryptUpdate(const struct HksBlob *message, void *ctx, struct HksBlob *out, [all …]
|