/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/alg_module_test/src/ |
D | openssl_rsa_helper.c | 29 int32_t SaveRsaKeyToHksBlob(EVP_PKEY *pkey, const uint32_t keySize, struct HksBlob *key) in SaveRsaKeyToHksBlob() argument 44 if (BN_bn2binpad(RSA_get0_n(EVP_PKEY_get0_RSA(pkey)), tmpBuff, keyByteLen) > 0) { in SaveRsaKeyToHksBlob() 51 if (BN_bn2binpad(RSA_get0_e(EVP_PKEY_get0_RSA(pkey)), tmpBuff, keyByteLen) > 0) { in SaveRsaKeyToHksBlob() 58 if (BN_bn2binpad(RSA_get0_d(EVP_PKEY_get0_RSA(pkey)), tmpBuff, keyByteLen) > 0) { in SaveRsaKeyToHksBlob() 88 EVP_PKEY *pkey = EVP_PKEY_new(); in GenerateRsaKey() local 89 if (pkey == NULL) { in GenerateRsaKey() 94 if (EVP_PKEY_assign_RSA(pkey, rsa) != 1) { in GenerateRsaKey() 95 EVP_PKEY_free(pkey); in GenerateRsaKey() 100 return pkey; in GenerateRsaKey() 103 bool OpensslGetx509PubKey(EVP_PKEY *pkey, struct HksBlob *x509Key) in OpensslGetx509PubKey() argument [all …]
|
D | openssl_dsa_helper.c | 46 EVP_PKEY *pkey = EVP_PKEY_new(); in GenerateDsaKey() local 47 if (pkey == NULL) { in GenerateDsaKey() 52 if (EVP_PKEY_assign_DSA(pkey, dsa) != 1) { in GenerateDsaKey() 53 EVP_PKEY_free(pkey); in GenerateDsaKey() 58 return pkey; in GenerateDsaKey() 163 EVP_PKEY *pkey = EVP_PKEY_new(); in OpensslSignDsa() local 164 if (pkey == NULL) { in OpensslSignDsa() 169 if (EVP_PKEY_assign_DSA(pkey, dsa) != 1) { in OpensslSignDsa() 170 EVP_PKEY_free(pkey); in OpensslSignDsa() 177 EVP_PKEY_free(pkey); in OpensslSignDsa() [all …]
|
D | openssl_dh_helper.c | 225 EVP_PKEY *pkey = d2i_PUBKEY(NULL, (const unsigned char **)&data, x509Key->size); in DhX509ToHksBlob() local 226 if (pkey == NULL) { in DhX509ToHksBlob() 230 const DH *dh = EVP_PKEY_get0_DH(pkey); in DhX509ToHksBlob() 232 EVP_PKEY_free(pkey); in DhX509ToHksBlob() 241 EVP_PKEY_free(pkey); in DhX509ToHksBlob() 255 EVP_PKEY_free(pkey); in DhX509ToHksBlob() 261 EVP_PKEY_free(pkey); in DhX509ToHksBlob() 275 EVP_PKEY *pkey = EVP_PKEY_new(); in DhHksBlobToX509() local 276 if (pkey == NULL) { in DhHksBlobToX509() 281 if (EVP_PKEY_assign_DH(pkey, dh) != 1) { in DhHksBlobToX509() [all …]
|
D | openssl_ecc_helper.c | 515 EVP_PKEY *pkey = d2i_PUBKEY(NULL, (const unsigned char **)&data, x509Key->size); in X509ToHksBlob() local 516 if (pkey == NULL) { in X509ToHksBlob() 520 const EC_KEY *ecKey = EVP_PKEY_get0_EC_KEY(pkey); in X509ToHksBlob() 522 EVP_PKEY_free(pkey); in X509ToHksBlob() 527 EVP_PKEY_free(pkey); in X509ToHksBlob() 531 EVP_PKEY_free(pkey); in X509ToHksBlob() 562 EVP_PKEY *pkey = EVP_PKEY_new(); in HksBlobToX509() local 563 if (pkey == NULL) { in HksBlobToX509() 568 if (EVP_PKEY_assign_EC_KEY(pkey, eccKey) <= 0) { in HksBlobToX509() 570 EVP_PKEY_free(pkey); in HksBlobToX509() [all …]
|
D | hks_rsa_common_mt.cpp | 197 EVP_PKEY *pkey = GenerateRsaKey(testCaseParams.keySize); in EncryptServiceTestCase() local 198 ASSERT_NE(pkey, nullptr); in EncryptServiceTestCase() 200 OpensslGetx509PubKey(pkey, &x509Key); in EncryptServiceTestCase() 204 SaveRsaKeyToHksBlob(pkey, testCaseParams.keySize, &opensslRsaKeyInfo); in EncryptServiceTestCase() 222 EVP_PKEY_free(pkey); in EncryptServiceTestCase() 571 EVP_PKEY *pkey = GenerateRsaKey(testCaseParams.keySize); in VerifyServiceTestCase() local 572 ASSERT_NE(pkey, nullptr); in VerifyServiceTestCase() 574 OpensslGetx509PubKey(pkey, &x509Key); in VerifyServiceTestCase() 578 SaveRsaKeyToHksBlob(pkey, testCaseParams.keySize, &opensslRsaKeyInfo); in VerifyServiceTestCase() 593 EVP_PKEY_free(pkey); in VerifyServiceTestCase()
|
/base/startup/hvb/libhvb/src/crypto/ |
D | hvb_rsa_verify.c | 288 static int hvb_rsa_verify_pss_param_check(const struct hvb_rsa_pubkey *pkey, const uint8_t *pdigest, in hvb_rsa_verify_pss_param_check() argument 293 if (!pkey || !pdigest || !psign) { in hvb_rsa_verify_pss_param_check() 296 if (!pkey->pn || !pkey->p_rr || pkey->n_n0_i == 0) { in hvb_rsa_verify_pss_param_check() 299 klen = bit2byte(pkey->width); in hvb_rsa_verify_pss_param_check() 303 if (pkey->nlen != klen || pkey->rlen > pkey->nlen) { in hvb_rsa_verify_pss_param_check() 313 static int hvb_rsa_verify_pss_param_convert(const struct hvb_rsa_pubkey *pkey, uint8_t *psign, in hvb_rsa_verify_pss_param_convert() argument 317 invert_copy((uint8_t *)p_n->p_uint, pkey->pn, pkey->nlen); in hvb_rsa_verify_pss_param_convert() 318 p_n->valid_word_len = byte2dword(pkey->nlen); in hvb_rsa_verify_pss_param_convert() 325 p_m->valid_word_len = byte2dword(pkey->nlen); in hvb_rsa_verify_pss_param_convert() 331 invert_copy((uint8_t *)p_rr->p_uint, pkey->p_rr, pkey->rlen); in hvb_rsa_verify_pss_param_convert() [all …]
|
/base/security/huks/utils/crypto_adapter/ |
D | hks_client_service_adapter.c | 54 static int32_t EvpKeyToX509Format(EVP_PKEY *pkey, struct HksBlob *x509Key) in EvpKeyToX509Format() argument 56 int32_t length = i2d_PUBKEY(pkey, NULL); in EvpKeyToX509Format() 68 if ((uint32_t)i2d_PUBKEY(pkey, &tmp) != keyLength) { in EvpKeyToX509Format() 85 EVP_PKEY *pkey = NULL; in RsaToX509PublicKey() local 104 pkey = EVP_PKEY_new(); in RsaToX509PublicKey() 105 HKS_IF_NULL_LOGE_BREAK(pkey, "pkey is null") in RsaToX509PublicKey() 106 if (EVP_PKEY_set1_RSA(pkey, rsa) == 0) { in RsaToX509PublicKey() 110 result = EvpKeyToX509Format(pkey, x509Key); in RsaToX509PublicKey() 116 SELF_FREE_PTR(pkey, EVP_PKEY_free) in RsaToX509PublicKey() 158 EVP_PKEY *pkey = NULL; in EccToX509PublicKey() local [all …]
|
/base/security/certificate_manager/test/unittest/module_test/src/ |
D | cm_cert_parse_test.cpp | 423 EVP_PKEY *pkey = nullptr; variable 427 &pkey, &appCert); 430 EVP_PKEY_free(pkey); 443 EVP_PKEY *pkey = nullptr; variable 446 &pkey, &appCert); 449 EVP_PKEY_free(pkey); 462 EVP_PKEY *pkey = nullptr; variable 466 &pkey, &appCert); 469 EVP_PKEY_free(pkey); 482 EVP_PKEY *pkey = nullptr; variable [all …]
|
/base/security/huks/frameworks/huks_standard/main/crypto_engine/openssl/src/ |
D | hks_openssl_rsa.c | 291 EVP_PKEY *pkey = EVP_PKEY_new(); in InitEvpPkeyCtx() 292 if (pkey == NULL) { in InitEvpPkeyCtx() 298 ret = EVP_PKEY_assign_RSA(pkey, rsa); in InitEvpPkeyCtx() 302 EVP_PKEY_free(pkey); in InitEvpPkeyCtx() 306 EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(pkey, NULL); in InitEvpPkeyCtx() 309 EVP_PKEY_free(pkey); in InitEvpPkeyCtx() 320 EVP_PKEY_free(pkey); in InitEvpPkeyCtx() 325 EVP_PKEY_free(pkey); in InitEvpPkeyCtx() 458 EVP_PKEY *pkey = EVP_PKEY_new(); in InitRsaEvpKey() 459 if (pkey == NULL) { in InitRsaEvpKey() [all …]
|
D | hks_openssl_curve25519.c | 78 EVP_PKEY *pkey = NULL; in HksOpensslCurve25519GenerateKey() local 94 if (EVP_PKEY_keygen(pctx, &pkey) != HKS_OPENSSL_SUCCESS) { in HksOpensslCurve25519GenerateKey() 100 ret = SaveCurve25519KeyMaterial(spec->algType, pkey, key); in HksOpensslCurve25519GenerateKey() 107 if (pkey != NULL) { in HksOpensslCurve25519GenerateKey() 108 EVP_PKEY_free(pkey); in HksOpensslCurve25519GenerateKey()
|
D | hks_openssl_sm2.c | 53 static int32_t EvpPkeyToKeyMaterialEc(const struct HksKeySpec *spec, const EVP_PKEY *pkey, struct H… in EvpPkeyToKeyMaterialEc() argument 61 int pubXRet = GetBnBinpadFromPkey(pkey, OSSL_PKEY_PARAM_EC_PUB_X, &pubXBlob); in EvpPkeyToKeyMaterialEc() 62 int pubYRet = GetBnBinpadFromPkey(pkey, OSSL_PKEY_PARAM_EC_PUB_Y, &pubYBlob); in EvpPkeyToKeyMaterialEc() 63 int priRet = GetBnBinpadFromPkey(pkey, OSSL_PKEY_PARAM_PRIV_KEY, &privBlob); in EvpPkeyToKeyMaterialEc() 127 EVP_PKEY *pkey = NULL; in HksOpensslSm2GenerateKey() local 134 osRet = EVP_PKEY_keygen(ctx, &pkey); in HksOpensslSm2GenerateKey() 139 ret = EvpPkeyToKeyMaterialEc(spec, pkey, key); in HksOpensslSm2GenerateKey() 145 SELF_FREE_PTR(pkey, EVP_PKEY_free) in HksOpensslSm2GenerateKey()
|
D | hks_openssl_dsa.c | 350 EVP_PKEY *pkey = EVP_PKEY_new(); in InitDSACtx() 351 if (pkey == NULL) { in InitDSACtx() 357 if (EVP_PKEY_assign_DSA(pkey, dsa) != HKS_OPENSSL_SUCCESS) { in InitDSACtx() 360 EVP_PKEY_free(pkey); in InitDSACtx() 364 EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(pkey, NULL); in InitDSACtx() 367 EVP_PKEY_free(pkey); in InitDSACtx() 377 EVP_PKEY_free(pkey); in InitDSACtx()
|
/base/security/crypto_framework/plugin/openssl_plugin/common/src/ |
D | openssl_adapter.c | 300 …DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey) in Openssl_EVP_DigestSignInit() argument 302 return EVP_DigestSignInit(ctx, pctx, type, e, pkey); in Openssl_EVP_DigestSignInit() 315 …gestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey) in Openssl_EVP_DigestVerifyInit() argument 317 return EVP_DigestVerifyInit(ctx, pctx, type, e, pkey); in Openssl_EVP_DigestVerifyInit() 357 int Openssl_EVP_PKEY_assign_EC_KEY(EVP_PKEY *pkey, EC_KEY *key) in Openssl_EVP_PKEY_assign_EC_KEY() argument 359 return EVP_PKEY_assign_EC_KEY(pkey, key); in Openssl_EVP_PKEY_assign_EC_KEY() 362 void Openssl_EVP_PKEY_free(EVP_PKEY *pkey) in Openssl_EVP_PKEY_free() argument 364 EVP_PKEY_free(pkey); in Openssl_EVP_PKEY_free() 367 EVP_PKEY_CTX *Openssl_EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e) in Openssl_EVP_PKEY_CTX_new() argument 369 return EVP_PKEY_CTX_new(pkey, e); in Openssl_EVP_PKEY_CTX_new() [all …]
|
/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/alg_module_test/include/ |
D | openssl_dsa_helper.h | 33 bool DsaGetx509PubKey(EVP_PKEY *pkey, struct HksBlob *x509Key); 43 int32_t SaveDsaKeyToHksBlob(EVP_PKEY *pkey, const uint32_t keySize, struct HksBlob *key);
|
D | openssl_rsa_helper.h | 31 int32_t SaveRsaKeyToHksBlob(EVP_PKEY *pkey, const uint32_t keySize, struct HksBlob *key); 35 bool OpensslGetx509PubKey(EVP_PKEY *pkey, struct HksBlob *x509Key);
|
/base/security/crypto_framework/test/unittest/src/ |
D | openssl_adapter_mock.c | 474 …DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey) in Openssl_EVP_DigestSignInit() argument 479 return EVP_DigestSignInit(ctx, pctx, type, e, pkey); in Openssl_EVP_DigestSignInit() 514 …gestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey) in Openssl_EVP_DigestVerifyInit() argument 519 return EVP_DigestVerifyInit(ctx, pctx, type, e, pkey); in Openssl_EVP_DigestVerifyInit() 580 int Openssl_EVP_PKEY_assign_EC_KEY(EVP_PKEY *pkey, EC_KEY *key) in Openssl_EVP_PKEY_assign_EC_KEY() argument 585 return EVP_PKEY_assign_EC_KEY(pkey, key); in Openssl_EVP_PKEY_assign_EC_KEY() 588 void Openssl_EVP_PKEY_free(EVP_PKEY *pkey) in Openssl_EVP_PKEY_free() argument 590 EVP_PKEY_free(pkey); in Openssl_EVP_PKEY_free() 593 EVP_PKEY_CTX *Openssl_EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e) in Openssl_EVP_PKEY_CTX_new() argument 598 return EVP_PKEY_CTX_new(pkey, e); in Openssl_EVP_PKEY_CTX_new() [all …]
|
/base/security/crypto_framework/plugin/openssl_plugin/common/inc/ |
D | openssl_adapter.h | 94 …igestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); 97 …estVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey); 108 int Openssl_EVP_PKEY_assign_EC_KEY(EVP_PKEY *pkey, EC_KEY *key); 109 void Openssl_EVP_PKEY_free(EVP_PKEY *pkey); 111 EVP_PKEY_CTX *Openssl_EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e); 132 int Openssl_EVP_PKEY_set1_DSA(EVP_PKEY *pkey, DSA *key); 133 DSA *Openssl_EVP_PKEY_get1_DSA(EVP_PKEY *pkey); 174 struct rsa_st *Openssl_EVP_PKEY_get1_RSA(EVP_PKEY *pkey); 175 int Openssl_EVP_PKEY_set1_RSA(EVP_PKEY *pkey, struct rsa_st *key); 176 int Openssl_EVP_PKEY_assign_RSA(EVP_PKEY *pkey, struct rsa_st *key);
|
/base/security/certificate_manager/frameworks/cert_manager_standard/main/common/include/ |
D | cm_pfx.h | 27 int32_t CmParsePkcs12Cert(const struct CmBlob *p12Cert, char *passWd, EVP_PKEY **pkey, struct AppCe…
|
/base/security/huks/frameworks/huks_standard/main/crypto_engine/openssl/include/ |
D | hks_openssl_engine.h | 47 int32_t GetBnBinpadFromPkey(const EVP_PKEY *pkey, const char *keyName, struct HksBlob *out);
|
/base/security/certificate_manager/frameworks/cert_manager_standard/main/common/src/ |
D | cm_pfx.c | 84 int32_t CmParsePkcs12Cert(const struct CmBlob *p12Cert, char *passWd, EVP_PKEY **pkey, struct AppCe… in CmParsePkcs12Cert() argument 111 if (PKCS12_parse(p12, passWd, pkey, &cert, &caCert) != 1) { in CmParsePkcs12Cert()
|
/base/security/appverify/interfaces/innerkits/appverify/include/util/ |
D | hap_verify_openssl_utils.h | 73 …static bool VerifyShaWithRsaPss(const PKCS7_SIGNER_INFO* signInfo, BIO* p7Bio, EVP_PKEY* pkey, boo… 74 …DLL_EXPORT static bool VerifyShaWithRsaPss(const PKCS7_SIGNER_INFO* signInfo, EVP_PKEY* pkey, bool…
|
/base/security/crypto_framework/plugin/openssl_plugin/key/asy_key_generator/src/ |
D | dsa_asy_key_generator_openssl.c | 470 static HcfResult GeneratePubKeyByPkey(EVP_PKEY *pkey, HcfOpensslDsaPubKey **returnPubKey) in GeneratePubKeyByPkey() argument 472 DSA *pk = Openssl_EVP_PKEY_get1_DSA(pkey); in GeneratePubKeyByPkey() 486 static HcfResult GeneratePriKeyByPkey(EVP_PKEY *pkey, HcfOpensslDsaPriKey **returnPriKey) in GeneratePriKeyByPkey() argument 488 DSA *sk = Openssl_EVP_PKEY_get1_DSA(pkey); in GeneratePriKeyByPkey() 505 EVP_PKEY *pkey = NULL; in GenerateDsaPubAndPriKey() local 506 HcfResult ret = GenerateDsaEvpKey(keyLen, &pkey); in GenerateDsaPubAndPriKey() 512 ret = GeneratePubKeyByPkey(pkey, returnPubKey); in GenerateDsaPubAndPriKey() 514 Openssl_EVP_PKEY_free(pkey); in GenerateDsaPubAndPriKey() 518 ret = GeneratePriKeyByPkey(pkey, returnPriKey); in GenerateDsaPubAndPriKey() 522 Openssl_EVP_PKEY_free(pkey); in GenerateDsaPubAndPriKey() [all …]
|
/base/security/appverify/interfaces/innerkits/appverify/src/util/ |
D | hap_verify_openssl_utils.cpp | 215 EVP_PKEY* pkey = X509_get0_pubkey(cert); in VerifySignInfo() local 216 if (pkey == nullptr) { in VerifySignInfo() 221 if (!VerifyShaWithRsaPss(signInfo, p7Bio, pkey, isShaWithRsaPss)) { in VerifySignInfo() 251 BIO* p7Bio, EVP_PKEY* pkey, bool isPss) in VerifyShaWithRsaPss() argument 285 if (!VerifyShaWithRsaPss(signInfo, pkey, isPss, digest, digestLen)) { in VerifyShaWithRsaPss() 380 bool HapVerifyOpensslUtils::VerifyShaWithRsaPss(const PKCS7_SIGNER_INFO* signInfo, EVP_PKEY* pkey, … in VerifyShaWithRsaPss() argument 383 EVP_PKEY_CTX* pkeyCtx = EVP_PKEY_CTX_new(pkey, nullptr); in VerifyShaWithRsaPss()
|
/base/security/crypto_framework/plugin/openssl_plugin/crypto_operation/cipher/src/ |
D | cipher_rsa_openssl.c | 124 EVP_PKEY *pkey = NewEvpPkeyByRsa(rsa, false); in InitEvpPkeyCtx() local 125 if (pkey == NULL) { in InitEvpPkeyCtx() 131 impl->ctx = EVP_PKEY_CTX_new(pkey, NULL); in InitEvpPkeyCtx() 135 Openssl_EVP_PKEY_free(pkey); in InitEvpPkeyCtx() 147 Openssl_EVP_PKEY_free(pkey); in InitEvpPkeyCtx() 151 Openssl_EVP_PKEY_free(pkey); in InitEvpPkeyCtx()
|
/base/startup/hvb/libhvb/include/ |
D | hvb_crypto.h | 76 int hvb_rsa_verify_pss(const struct hvb_rsa_pubkey *pkey, const uint8_t *pdigest,
|