Home
last modified time | relevance | path

Searched refs:ctx (Results 1 – 25 of 77) sorted by relevance

1234

/base/startup/init_lite/services/init/standard/
Dinit_cmds.c92 static void DoIfup(const struct CmdArgs *ctx) in DoIfup() argument
95 …INIT_ERROR_CHECK(strncpy_s(interface.ifr_name, IFNAMSIZ - 1, ctx->argv[0], strlen(ctx->argv[0])) =… in DoIfup()
112 static void DoInsmod(const struct CmdArgs *ctx) in DoInsmod() argument
117 if (ctx->argc > index) { in DoInsmod()
118 fileName = ctx->argv[index]; in DoInsmod()
121 … INIT_ERROR_CHECK(fileName != NULL, return, "Can not find file name from param %s", ctx->argv[0]); in DoInsmod()
124 …INIT_ERROR_CHECK(realPath != NULL, return, "Can not get real file name from param %s", ctx->argv[0… in DoInsmod()
125 if (ctx->argc > 1 && ctx->argv[1] != NULL && strcmp(ctx->argv[1], "-f") == 0) { // [-f] in DoInsmod()
129 char *options = BuildStringFromCmdArg(ctx, index); // [options] in DoInsmod()
147 static void DoSetParam(const struct CmdArgs *ctx) in DoSetParam() argument
[all …]
/base/startup/init_lite/services/init/
Dinit_common_cmds.c63 char *BuildStringFromCmdArg(const struct CmdArgs *ctx, int startIndex) in BuildStringFromCmdArg() argument
65 INIT_ERROR_CHECK(ctx != NULL, return NULL, "Failed to get cmd args "); in BuildStringFromCmdArg()
70 for (int i = startIndex; i < ctx->argc; i++) { // save opt in BuildStringFromCmdArg()
71 if (ctx->argv[i] == NULL) { in BuildStringFromCmdArg()
74 …en = snprintf_s(options + curr, OPTIONS_SIZE - curr, OPTIONS_SIZE - 1 - curr, "%s ", ctx->argv[i]); in BuildStringFromCmdArg()
93 …struct CmdArgs *ctx = (struct CmdArgs *)calloc(1, sizeof(struct CmdArgs) + sizeof(char *) * (argsC… in GetCmdArg() local
94 INIT_ERROR_CHECK(ctx != NULL, return NULL, "Failed to malloc memory for arg"); in GetCmdArg()
95 ctx->argc = 0; in GetCmdArg()
106 ctx->argv[ctx->argc] = AddOneArg(p, end - p); in GetCmdArg()
107 INIT_CHECK(ctx->argv[ctx->argc] != NULL, FreeCmdArg(ctx); in GetCmdArg()
[all …]
/base/security/huks/interfaces/innerkits/huks_standard/test/moduletest/src/
Dopenssl_aes_helper.c102 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()
140 EVP_CIPHER_CTX_free(ctx); in AesEncrypt()
144 if (EVP_EncryptInit_ex(ctx, ciper, NULL, NULL, NULL) != 1) { in AesEncrypt()
145 EVP_CIPHER_CTX_free(ctx); in AesEncrypt()
149 if (EVP_EncryptInit_ex(ctx, NULL, NULL, randomKey->data, iv->blob.data) != 1) { in AesEncrypt()
150 EVP_CIPHER_CTX_free(ctx); in AesEncrypt()
[all …]
Dopenssl_ecc_helper.c299 EVP_MD_CTX *ctx = EVP_MD_CTX_new(); in InitEccMdCtx() local
300 if (ctx == NULL) { in InitEccMdCtx()
306 int32_t ret = EVP_DigestSignInit(ctx, NULL, md, NULL, key); in InitEccMdCtx()
309 EVP_MD_CTX_free(ctx); in InitEccMdCtx()
313 int ret = EVP_DigestVerifyInit(ctx, NULL, md, NULL, key); in InitEccMdCtx()
316 EVP_MD_CTX_free(ctx); in InitEccMdCtx()
320 return ctx; in InitEccMdCtx()
325 EVP_MD_CTX *ctx = InitEccMdCtx(key, digest, true); in EcdsaSign() local
326 if (ctx == NULL) { in EcdsaSign()
330 if (EVP_DigestSignUpdate(ctx, message->data, message->size) != 1) { in EcdsaSign()
[all …]
/base/security/huks/frameworks/crypto_lite/cipher/src/
Dcipher_aes.c111 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/
Dhks_openssl_aes.c145 …st struct HksBlob *key, const struct HksUsageSpec *usageSpec, bool isEncrypt, EVP_CIPHER_CTX **ctx) in OpensslAesAeadInit() argument
153 *ctx = EVP_CIPHER_CTX_new(); in OpensslAesAeadInit()
154 if (*ctx == NULL) { in OpensslAesAeadInit()
160 … ret = EVP_EncryptInit_ex(*ctx, GetAeadCipherType(key->size, usageSpec->mode), NULL, NULL, NULL); in OpensslAesAeadInit()
162 … ret = EVP_DecryptInit_ex(*ctx, GetAeadCipherType(key->size, usageSpec->mode), NULL, NULL, NULL); in OpensslAesAeadInit()
166 EVP_CIPHER_CTX_free(*ctx); in OpensslAesAeadInit()
170 ret = EVP_CIPHER_CTX_ctrl(*ctx, EVP_CTRL_AEAD_SET_IVLEN, aeadParam->nonce.size, NULL); in OpensslAesAeadInit()
173 EVP_CIPHER_CTX_free(*ctx); in OpensslAesAeadInit()
178 ret = EVP_EncryptInit_ex(*ctx, NULL, NULL, key->data, aeadParam->nonce.data); in OpensslAesAeadInit()
180 ret = EVP_DecryptInit_ex(*ctx, NULL, NULL, key->data, aeadParam->nonce.data); in OpensslAesAeadInit()
[all …]
Dhks_openssl_engine.c239 int32_t HksCryptoHalHmacInit(const struct HksBlob *key, uint32_t digestAlg, void **ctx) in HksCryptoHalHmacInit() argument
241 if (CheckBlob(key) != HKS_SUCCESS || ctx == NULL) { in HksCryptoHalHmacInit()
252 return func(ctx, key, digestAlg); in HksCryptoHalHmacInit()
255 int32_t HksCryptoHalHmacUpdate(const struct HksBlob *chunk, void *ctx) in HksCryptoHalHmacUpdate() argument
257 if (CheckBlob(chunk) != HKS_SUCCESS || ctx == NULL) { in HksCryptoHalHmacUpdate()
268 return func(ctx, chunk); in HksCryptoHalHmacUpdate()
271 int32_t HksCryptoHalHmacFinal(const struct HksBlob *msg, void **ctx, struct HksBlob *mac) in HksCryptoHalHmacFinal() argument
273 if (msg == NULL || ctx == NULL || CheckBlob(mac) != HKS_SUCCESS) { in HksCryptoHalHmacFinal()
284 return func(ctx, msg, mac); in HksCryptoHalHmacFinal()
287 void HksCryptoHalHmacFreeCtx(void **ctx) in HksCryptoHalHmacFreeCtx() argument
[all …]
Dhks_openssl_rsa.c305 EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(pkey, NULL); in InitEvpPkeyCtx() local
306 if (ctx == NULL) { in InitEvpPkeyCtx()
313 ret = EVP_PKEY_encrypt_init(ctx); in InitEvpPkeyCtx()
315 ret = EVP_PKEY_decrypt_init(ctx); in InitEvpPkeyCtx()
320 EVP_PKEY_CTX_free(ctx); in InitEvpPkeyCtx()
325 return ctx; in InitEvpPkeyCtx()
328 static int32_t HksOpensslRsaCryptInit(EVP_PKEY_CTX *ctx, const struct HksUsageSpec *usageSpec) in HksOpensslRsaCryptInit() argument
337 ret = EVP_PKEY_CTX_set_rsa_padding(ctx, padding); in HksOpensslRsaCryptInit()
345 …if (md == NULL || EVP_PKEY_CTX_set_rsa_oaep_md(ctx, md) <= 0 || EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, … in HksOpensslRsaCryptInit()
357 EVP_PKEY_CTX *ctx = InitEvpPkeyCtx(key, encrypt); in HksOpensslRsaCrypt() local
[all …]
Dhks_openssl_ecc.c370 static int32_t EcdhDerive(EVP_PKEY_CTX *ctx, EVP_PKEY *peerKey, struct HksBlob *sharedKey) in EcdhDerive() argument
373 if (EVP_PKEY_derive_init(ctx) != 1) { in EcdhDerive()
377 if (EVP_PKEY_derive_set_peer(ctx, peerKey) != 1) { in EcdhDerive()
381 if (EVP_PKEY_derive(ctx, NULL, &tmpSharedKeySize) != 1) { in EcdhDerive()
390 if (EVP_PKEY_derive(ctx, sharedKey->data, &tmpSharedKeySize) != 1) { in EcdhDerive()
404 EVP_PKEY_CTX *ctx = NULL; in AgreeKeyEcdh() local
423 ctx = EVP_PKEY_CTX_new(pKey, NULL); in AgreeKeyEcdh()
424 if (ctx == NULL) { in AgreeKeyEcdh()
429 ret = EcdhDerive(ctx, peerKey, sharedKey); in AgreeKeyEcdh()
438 EVP_PKEY_CTX_free(ctx); in AgreeKeyEcdh()
[all …]
/base/security/huks/frameworks/huks_standard/main/crypto_engine/mbedtls/src/
Dhks_mbedtls_ecdh.c42 const struct HksBlob *pubKey, mbedtls_ecdh_context *ctx) in EccKeyMaterialToCtx() argument
44 int32_t ret = HksEccKeyMaterialToPub(pubKey, &(ctx->Qp)); in EccKeyMaterialToCtx()
50 ret = HksEccKeyMaterialToPri(nativeKey, &(ctx->d)); in EccKeyMaterialToCtx()
79 mbedtls_ecdh_context ctx; in HksMbedtlsEcdh() local
80 mbedtls_ecdh_init(&ctx); in HksMbedtlsEcdh()
83 ret = mbedtls_ecp_group_load(&(ctx.grp), mbedtlsCurveNist); in HksMbedtlsEcdh()
89 ret = EccKeyMaterialToCtx(nativeKey, pubKey, &ctx); in HksMbedtlsEcdh()
94 …ret = mbedtls_ecdh_compute_shared(&(ctx.grp), &(ctx.z), &(ctx.Qp), &(ctx.d), mbedtls_ctr_drbg_rand… in HksMbedtlsEcdh()
101 ret = mbedtls_mpi_write_binary(&(ctx.z), sharedKey->data, keyByteLen); in HksMbedtlsEcdh()
110 mbedtls_ecdh_free(&ctx); in HksMbedtlsEcdh()
Dhks_mbedtls_engine.c64 int32_t HksCryptoHalHmacInit(const struct HksBlob *key, uint32_t digestAlg, void **ctx) in HksCryptoHalHmacInit() argument
66 if (CheckBlob(key) != HKS_SUCCESS || ctx == NULL) { in HksCryptoHalHmacInit()
70 if (ctx == NULL) { in HksCryptoHalHmacInit()
80 return func(ctx, key, digestAlg); in HksCryptoHalHmacInit()
83 int32_t HksCryptoHalHmacUpdate(const struct HksBlob *chunk, void *ctx) in HksCryptoHalHmacUpdate() argument
85 if (CheckBlob(chunk) != HKS_SUCCESS || ctx == NULL) { in HksCryptoHalHmacUpdate()
95 return func(ctx, chunk); in HksCryptoHalHmacUpdate()
98 int32_t HksCryptoHalHmacFinal(const struct HksBlob *msg, void **ctx, struct HksBlob *mac) in HksCryptoHalHmacFinal() argument
100 if (msg == NULL || ctx == NULL || CheckBlob(mac) != HKS_SUCCESS) { in HksCryptoHalHmacFinal()
110 return func(ctx, msg, mac); in HksCryptoHalHmacFinal()
[all …]
Dhks_mbedtls_dh.c70 static int32_t DhSaveKeyMaterial(const mbedtls_dhm_context *ctx, const uint32_t keySize, struct Hks… in DhSaveKeyMaterial() argument
83 keyMaterial->pubKeySize = mbedtls_mpi_size(&ctx->GX); in DhSaveKeyMaterial()
84 keyMaterial->priKeySize = mbedtls_mpi_size(&ctx->X); in DhSaveKeyMaterial()
89 ret = mbedtls_mpi_write_binary(&(ctx->GX), rawMaterial + offset, keyMaterial->pubKeySize); in DhSaveKeyMaterial()
98 ret = mbedtls_mpi_write_binary(&(ctx->X), rawMaterial + offset, keyMaterial->priKeySize); in DhSaveKeyMaterial()
115 mbedtls_dhm_context ctx; in HksMbedtlsDhGenerateKey() local
116 mbedtls_dhm_init(&ctx); in HksMbedtlsDhGenerateKey()
122 mbedtls_dhm_free(&ctx); in HksMbedtlsDhGenerateKey()
135 if (mbedtls_mpi_read_binary(&ctx.P, paramP.data, paramP.size) != HKS_MBEDTLS_SUCCESS || in HksMbedtlsDhGenerateKey()
136 mbedtls_mpi_read_binary(&ctx.G, paramG.data, paramG.size) != HKS_MBEDTLS_SUCCESS) { in HksMbedtlsDhGenerateKey()
[all …]
Dhks_mbedtls_ecdsa.c62 mbedtls_ecdsa_context ctx; in HksMbedtlsEcdsaSign() local
63 mbedtls_ecdsa_init(&ctx); in HksMbedtlsEcdsaSign()
66 ret = mbedtls_ecp_group_load(&(ctx.grp), curveNist); in HksMbedtlsEcdsaSign()
72 ret = HksEccKeyMaterialToPri(key, &(ctx.d)); in HksMbedtlsEcdsaSign()
84 ret = mbedtls_ecdsa_write_signature(&ctx, mbedtlsAlg, message->data, (size_t)message->size, in HksMbedtlsEcdsaSign()
95 mbedtls_ecdsa_free(&ctx); in HksMbedtlsEcdsaSign()
116 mbedtls_ecdsa_context ctx; in HksMbedtlsEcdsaVerify() local
117 mbedtls_ecdsa_init(&ctx); in HksMbedtlsEcdsaVerify()
120 ret = mbedtls_ecp_group_load(&(ctx.grp), curveNist); in HksMbedtlsEcdsaVerify()
126 ret = HksEccKeyMaterialToPub(key, &(ctx.Q)); in HksMbedtlsEcdsaVerify()
[all …]
Dhks_mbedtls_hash.c45 int32_t HksMbedtlsHashMd5Init(void **ctx, uint32_t alg);
47 int32_t HksMbedtlsHashMd5Update(struct HksMbedtlsHashCtx *ctx, const unsigned char *input, size_t i…
50 int32_t HksMbedtlsHashMd5Final(struct HksMbedtlsHashCtx *ctx, const struct HksBlob *msg, unsigned c…
52 int32_t HksMbedtlsHashSha1Init(void **ctx, uint32_t alg);
54 int32_t HksMbedtlsHashSha1Update(struct HksMbedtlsHashCtx *ctx, const unsigned char *input, size_t …
57 int32_t HksMbedtlsHashSha1Final(struct HksMbedtlsHashCtx *ctx, const struct HksBlob *msg, unsigned …
59 int32_t HksMbedtlsHashSha256Init(void **ctx, int is224, uint32_t alg);
61 int32_t HksMbedtlsHashSha256Update(struct HksMbedtlsHashCtx *ctx, const unsigned char *input, size_…
64 int32_t HksMbedtlsHashSha256Final(struct HksMbedtlsHashCtx *ctx, const struct HksBlob *msg, unsigne…
66 int32_t HksMbedtlsHashSha512Init(void **ctx, int is384, uint32_t alg);
[all …]
Dhks_mbedtls_rsa.c98 static int32_t RsaSaveKeyMaterial(const mbedtls_rsa_context *ctx, const uint32_t keySize, struct Hk… in RsaSaveKeyMaterial() argument
119 ret = mbedtls_mpi_write_binary(&(ctx->N), rawMaterial + offset, keyMaterial->nSize); in RsaSaveKeyMaterial()
126 ret = mbedtls_mpi_write_binary(&(ctx->E), rawMaterial + offset, keyMaterial->eSize); in RsaSaveKeyMaterial()
133 ret = mbedtls_mpi_write_binary(&(ctx->D), rawMaterial + offset, keyMaterial->dSize); in RsaSaveKeyMaterial()
154 mbedtls_rsa_context ctx; in HksMbedtlsRsaGenerateKey() local
155 mbedtls_rsa_init(&ctx, MBEDTLS_RSA_PKCS_V21, MBEDTLS_MD_SHA256); in HksMbedtlsRsaGenerateKey()
156 ctx.padding = 0; in HksMbedtlsRsaGenerateKey()
157 ctx.hash_id = 0; in HksMbedtlsRsaGenerateKey()
163 mbedtls_rsa_free(&ctx); in HksMbedtlsRsaGenerateKey()
168 …ret = mbedtls_rsa_gen_key(&ctx, mbedtls_ctr_drbg_random, &ctrDrbg, spec->keyLen, HKS_RSA_PUBLIC_EX… in HksMbedtlsRsaGenerateKey()
[all …]
/base/startup/init_lite/services/init/lite/
Dinit_cmds.c31 static void DoExec(const struct CmdArgs *ctx) in DoExec() argument
36 INIT_LOGE("DoExec: failed to fork child process to exec \"%s\"", ctx->argv[0]); in DoExec()
40 if (ctx == NULL || ctx->argv[0] == NULL) { 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
78 if (!CheckValidCfg(ctx->argv[0])) { in DoLoadCfg()
79 INIT_LOGE("CheckCfg file %s Failed", ctx->argv[0]); in DoLoadCfg()
82 char *realPath = GetRealPath(ctx->argv[0]); in DoLoadCfg()
83 INIT_ERROR_CHECK(realPath != NULL, return, "Failed to get realpath %s", ctx->argv[0]); in DoLoadCfg()
[all …]
/base/security/deviceauth/deps_adapter/key_management_adapter/impl/src/standard/
Dcrypto_hash_to_point.c112 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/
Dhks_crypto_hal.h121 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/user_iam/face_auth/services/ca_mock/src/
Dadaptor_algorithm.cpp91 EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_ED25519, nullptr); in GenerateEd25519KeyPair() local
92 if (ctx == nullptr) { in GenerateEd25519KeyPair()
98 if (EVP_PKEY_keygen_init(ctx) != OPENSSL_SUCCESS) { in GenerateEd25519KeyPair()
104 if (EVP_PKEY_keygen(ctx, &key) != OPENSSL_SUCCESS) { in GenerateEd25519KeyPair()
129 if (ctx != nullptr) { in GenerateEd25519KeyPair()
130 EVP_PKEY_CTX_free(ctx); in GenerateEd25519KeyPair()
148 EVP_MD_CTX *ctx = EVP_MD_CTX_new(); in Ed25519Sign() local
149 if (ctx == nullptr) { in Ed25519Sign()
154 if (EVP_DigestSignInit(ctx, nullptr, nullptr, nullptr, key) != OPENSSL_SUCCESS) { in Ed25519Sign()
157 EVP_MD_CTX_free(ctx); in Ed25519Sign()
[all …]
/base/user_iam/auth_executor_mgr/common/adaptor/src/
Dadaptor_algorithm.c96 EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_ED25519, NULL); in GenerateEd25519KeyPair() local
97 if (ctx == NULL) { in GenerateEd25519KeyPair()
101 if (EVP_PKEY_keygen_init(ctx) != OPENSSL_SUCCESS) { in GenerateEd25519KeyPair()
105 if (EVP_PKEY_keygen(ctx, &key) != OPENSSL_SUCCESS) { in GenerateEd25519KeyPair()
130 if (ctx != NULL) { in GenerateEd25519KeyPair()
131 EVP_PKEY_CTX_free(ctx); in GenerateEd25519KeyPair()
149 EVP_MD_CTX *ctx = EVP_MD_CTX_new(); in Ed25519Sign() local
150 if (ctx == NULL) { in Ed25519Sign()
155 if (EVP_DigestSignInit(ctx, NULL, NULL, NULL, key) != OPENSSL_SUCCESS) { in Ed25519Sign()
165 …if (EVP_DigestSign(ctx, (*sign)->buf, &signSize, data->buf, data->contentSize) != OPENSSL_SUCCESS)… in Ed25519Sign()
[all …]
/base/security/huks/frameworks/huks_standard/main/common/include/
Dhks_crypto_hal.h197 int32_t HksCryptoHalHmacInit(const struct HksBlob *key, uint32_t digestAlg, void **ctx);
199 int32_t HksCryptoHalHmacUpdate(const struct HksBlob *chunk, void *ctx);
201 int32_t HksCryptoHalHmacFinal(const struct HksBlob *msg, void **ctx, struct HksBlob *mac);
203 void HksCryptoHalHmacFreeCtx(void **ctx);
208 int32_t HksCryptoHalHashInit(uint32_t alg, void **ctx);
210 int32_t HksCryptoHalHashUpdate(const struct HksBlob *msg, void *ctx);
212 int32_t HksCryptoHalHashFinal(const struct HksBlob *msg, void **ctx, struct HksBlob *hash);
214 void HksCryptoHalHashFreeCtx(void **ctx);
218 …sCryptoHalEncryptInit(const struct HksBlob *key, const struct HksUsageSpec *usageSpec, void **ctx);
220 int32_t HksCryptoHalEncryptUpdate(const struct HksBlob *message, void *ctx, struct HksBlob *out,
[all …]
/base/user_iam/pin_auth/hdi/adaptor/src/
Dadaptor_algorithm.c96 EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_ED25519, NULL); in GenerateEd25519KeyPair() local
97 if (ctx == NULL) { in GenerateEd25519KeyPair()
101 if (EVP_PKEY_keygen_init(ctx) != OPENSSL_SUCCESS) { in GenerateEd25519KeyPair()
105 if (EVP_PKEY_keygen(ctx, &key) != OPENSSL_SUCCESS) { in GenerateEd25519KeyPair()
130 if (ctx != NULL) { in GenerateEd25519KeyPair()
131 EVP_PKEY_CTX_free(ctx); in GenerateEd25519KeyPair()
149 EVP_MD_CTX *ctx = EVP_MD_CTX_new(); in Ed25519Sign() local
150 if (ctx == NULL) { in Ed25519Sign()
155 if (EVP_DigestSignInit(ctx, NULL, NULL, NULL, key) != OPENSSL_SUCCESS) { in Ed25519Sign()
165 …if (EVP_DigestSign(ctx, (*sign)->buf, &signSize, data->buf, data->contentSize) != OPENSSL_SUCCESS)… in Ed25519Sign()
[all …]
/base/update/updater/services/package/pkg_algorithm/
Dpkg_algo_lz4.cpp161 int32_t PkgAlgorithmLz4::GetPackParam(LZ4F_compressionContext_t &ctx, LZ4F_preferences_t &preferenc… in GetPackParam() argument
165 errorCode = LZ4F_createCompressionContext(&ctx, LZ4F_VERSION); in GetPackParam()
194 LZ4F_compressionContext_t ctx; in Pack() local
198 int32_t ret = GetPackParam(ctx, preferences, inLength, outLength); in Pack()
204 (void)LZ4F_freeCompressionContext(ctx); return PKG_NONE_MEMORY, "Fail to alloc buffer "); in Pack()
210 size_t dataLen = LZ4F_compressBegin(ctx, outBuffer.buffer, outBuffer.length, &preferences); in Pack()
211 PKG_CHECK(!LZ4F_isError(dataLen), (void)LZ4F_freeCompressionContext(ctx); in Pack()
214 …PKG_CHECK(ret == PKG_SUCCESS, (void)LZ4F_freeCompressionContext(ctx); return ret, "Fail write data… in Pack()
221 size_t outSize = LZ4F_compressUpdate(ctx, in Pack()
233 size_t headerSize = LZ4F_compressEnd(ctx, outBuffer.buffer, outBuffer.length, nullptr); in Pack()
[all …]
/base/security/huks/utils/crypto_adapter/
Dhks_client_service_adapter_lite.c44 static int32_t PkCtxToX509(mbedtls_pk_context *ctx, struct HksBlob *x509Key) in PkCtxToX509() argument
53 int32_t x509Size = mbedtls_pk_write_pubkey_der(ctx, tmpBuf, MAX_KEY_SIZE); in PkCtxToX509()
84 …c int32_t InitRsaPkCtx(const struct HksBlob *mod, const struct HksBlob *e, mbedtls_pk_context *ctx) in InitRsaPkCtx() argument
86 int32_t ret = mbedtls_pk_setup(ctx, mbedtls_pk_info_from_type(MBEDTLS_PK_RSA)); in InitRsaPkCtx()
111 mbedtls_rsa_context *rsaCtx = mbedtls_pk_rsa(*ctx); in InitRsaPkCtx()
131 mbedtls_pk_context ctx; in RsaToX509PublicKey() local
132 mbedtls_pk_init(&ctx); in RsaToX509PublicKey()
136 ret = InitRsaPkCtx(mod, e, &ctx); in RsaToX509PublicKey()
141 ret = PkCtxToX509(&ctx, x509Key); in RsaToX509PublicKey()
147 mbedtls_pk_free(&ctx); in RsaToX509PublicKey()
[all …]
/base/security/device_security_level/services/common/
Ddslm_crypto.c56 EVP_MD_CTX *ctx = EVP_MD_CTX_new(); in EcdsaVerify() local
57 if (ctx == NULL) { in EcdsaVerify()
63 ret = EVP_DigestVerifyInit(ctx, NULL, type, NULL, pkey); in EcdsaVerify()
70 ret = EVP_DigestUpdate(ctx, srcData->data, srcData->length); in EcdsaVerify()
74 if (EVP_DigestVerifyFinal(ctx, sigData->data, sigData->length) <= 0) { in EcdsaVerify()
81 EVP_MD_CTX_free(ctx); in EcdsaVerify()

1234