/base/update/sys_installer_lite/frameworks/source/verify/ |
H A D | app_rsa.c | 22 void AppRsaInit(AppRsaContext *rsa)
in AppRsaInit() argument 24 if (rsa == NULL) {
in AppRsaInit() 27 mbedtls_pk_init(&rsa->context);
in AppRsaInit() 31 int32 AppRsaDecodePublicKey(AppRsaContext *rsa, const uint8 *publicKey, uint32 length)
in AppRsaDecodePublicKey() argument 33 if ((rsa == NULL) || (publicKey == NULL)) {
in AppRsaDecodePublicKey() 37 int32 parseRet = mbedtls_pk_parse_public_key(&rsa->context, publicKey, length);
in AppRsaDecodePublicKey() 45 int32 AppVerifyData(AppRsaContext *rsa, const uint8 *plainBuf, uint32 plainBufLen, const uint8 *cipherBuf,
in AppVerifyData() argument 50 if ((rsa == NULL) || (plainBuf == NULL) || (cipherBuf == NULL) || (plainBufLen == 0) || (cipherBufLen == 0)) {
in AppVerifyData() 55 if (!mbedtls_pk_can_do(&(rsa->context), MBEDTLS_PK_RSA)) {
in AppVerifyData() 60 mbedtls_rsa_set_padding(mbedtls_pk_rsa(rsa in AppVerifyData() 71 AppRsaFree(AppRsaContext *rsa) AppRsaFree() argument [all...] |
H A D | app_rsa.h | 37 void AppRsaInit(AppRsaContext *rsa);
42 int32 AppRsaDecodePublicKey(AppRsaContext *rsa, const uint8 *publicKey, uint32 length);
47 int32 AppVerifyData(AppRsaContext *rsa, const uint8 *plainBuf, uint32 plainBufLen, const uint8 *cipherBuf,
53 void AppRsaFree(AppRsaContext *rsa);
|
H A D | hota_verify.c | 105 AppRsaContext rsa;
in HotaSignVerifyByHash() local 111 AppRsaInit(&rsa);
in HotaSignVerifyByHash() 117 int ret = AppRsaDecodePublicKey(&rsa, keyBuf, length);
in HotaSignVerifyByHash() 122 ret = AppVerifyData(&rsa, hash, hashLen, imageSign, signLen);
in HotaSignVerifyByHash() 123 AppRsaFree(&rsa);
in HotaSignVerifyByHash()
|
/base/security/crypto_framework/plugin/openssl_plugin/common/src/ |
H A D | rsa_openssl_common.c | 20 static RSA *DuplicateRsaPriKeyForSpec(const RSA *rsa) in DuplicateRsaPriKeyForSpec() argument 24 LOGE("malloc rsa failed"); in DuplicateRsaPriKeyForSpec() 30 OpensslRsaGet0Key(rsa, &n, &e, &d); in DuplicateRsaPriKeyForSpec() 58 HcfResult DuplicateRsa(RSA *rsa, bool needPrivate, RSA **dupRsa) in DuplicateRsa() argument 61 if (rsa == NULL || dupRsa == NULL) { in DuplicateRsa() 66 retRSA = OpensslRsaPrivateKeyDup(rsa); in DuplicateRsa() 69 retRSA = DuplicateRsaPriKeyForSpec(rsa); in DuplicateRsa() 72 retRSA = OpensslRsaPublicKeyDup(rsa); in DuplicateRsa() 83 EVP_PKEY *NewEvpPkeyByRsa(RSA *rsa, bool withDuplicate) in NewEvpPkeyByRsa() argument 85 if (rsa in NewEvpPkeyByRsa() [all...] |
/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/alg_module_test/src/ |
H A D | openssl_rsa_helper.c | 20 #include <openssl/rsa.h> 75 RSA *rsa = RSA_new(); in GenerateRsaKey() local 76 if (rsa == NULL) { in GenerateRsaKey() 81 if (RSA_generate_key_ex(rsa, keySize, bne, NULL) != 1) { in GenerateRsaKey() 82 RSA_free(rsa); in GenerateRsaKey() 90 RSA_free(rsa); in GenerateRsaKey() 94 if (EVP_PKEY_assign_RSA(pkey, rsa) != 1) { in GenerateRsaKey() 96 RSA_free(rsa); in GenerateRsaKey() 133 const RSA *rsa = EVP_PKEY_get0_RSA(pkey); in X509ToRsaPublicKey() local 134 if (rsa in X509ToRsaPublicKey() 192 RSA *rsa = RSA_new(); InitRsa() local 239 RSA *rsa = InitRsa(key, false); EncryptRsa() local 287 RSA *rsa = InitRsa(key, true); DecryptRsa() local 342 RSA *rsa = InitRsa(key, true); InitRsaCtx() local 425 RSA *rsa = InitRsa(key, true); OpensslSignRsa() local 488 RSA *rsa = InitRsa(key, false); OpensslVerifyRsa() local [all...] |
/base/security/huks/frameworks/huks_standard/main/crypto_engine/openssl/src/ |
H A D | hks_openssl_rsa.c | 29 #include <openssl/rsa.h> 50 HKS_LOG_E("Invlid rsa key len %" LOG_PUBLIC "x!", spec->keyLen); in RsaGenKeyCheckParam() 63 HKS_LOG_E("Invalid rsa salt len type %" LOG_PUBLIC "x!", usageSpec->pssSaltLenType); in GetRsaPssSaltLen() 125 RSA *rsa = NULL; in InitRsaStruct() local 130 rsa = RSA_new(); in InitRsaStruct() 131 if (rsa != NULL) { in InitRsaStruct() 132 ret = RSA_set0_key(rsa, n, e, d); in InitRsaStruct() 134 RSA_free(rsa); in InitRsaStruct() 135 rsa = NULL; in InitRsaStruct() 140 if (rsa in InitRsaStruct() 180 RsaSaveKeyMaterial(const RSA *rsa, const uint32_t keySize, struct HksBlob *key) RsaSaveKeyMaterial() argument 231 RSA *rsa = RSA_new(); HksOpensslRsaGenerateKey() local 315 RSA *rsa = InitRsaStruct(key, !encrypt); InitEvpPkeyCtx() local 487 RSA *rsa = InitRsaStruct(key, signing); InitRsaEvpKey() local [all...] |
/base/security/huks/frameworks/crypto_lite/cipher/src/ |
H A D | cipher_rsa.c | 29 #include "rsa.h" 131 mbedtls_rsa_context *rsa = NULL; in RsaLoadPrivateKey() local 150 rsa = mbedtls_pk_rsa(*pk); in RsaLoadPrivateKey() 151 if (rsa == NULL) { in RsaLoadPrivateKey() 152 CIPHER_LOG_E("rsa error"); in RsaLoadPrivateKey() 156 if (mbedtls_rsa_check_privkey(rsa) != 0) { in RsaLoadPrivateKey() 162 mbedtls_rsa_set_padding(rsa, MBEDTLS_RSA_PKCS_V21, MBEDTLS_MD_SHA256); in RsaLoadPrivateKey() 181 mbedtls_rsa_context *rsa = NULL; in RsaLoadPublicKey() local 195 rsa = mbedtls_pk_rsa(*pk); in RsaLoadPublicKey() 196 if (rsa in RsaLoadPublicKey() 262 RsaEncryptMultipleBlock(mbedtls_rsa_context *rsa, const char *plainText, char *cipherText, int32_t cipherTextLen) RsaEncryptMultipleBlock() argument 335 mbedtls_rsa_context *rsa = mbedtls_pk_rsa(pk); RsaEncrypt() local 385 RsaPkcs1Decrypt(mbedtls_rsa_context *rsa, size_t rsaLen, RsaData *cipher, RsaData *plain) RsaPkcs1Decrypt() argument 458 mbedtls_rsa_context *rsa = mbedtls_pk_rsa(pk); RsaDecrypt() local [all...] |
/base/security/crypto_framework/plugin/openssl_plugin/key/asy_key_generator/src/ |
H A D | rsa_asy_key_generator_openssl.c | 366 static HcfResult ConvertPubKeyFromX509(HcfBlob *x509Blob, RSA **rsa) in ConvertPubKeyFromX509() argument 374 *rsa = tempRsa; in ConvertPubKeyFromX509() 378 static HcfResult ConvertPriKeyFromPKCS8(HcfBlob *pkcs8Blob, RSA **rsa) in ConvertPriKeyFromPKCS8() argument 394 *rsa = tmpRsa; in ConvertPriKeyFromPKCS8() 399 static HcfResult EncodePubKeyToX509(RSA *rsa, HcfBlob *returnBlob) in EncodePubKeyToX509() argument 402 int len = OpensslI2dRsaPubKey(rsa, &tempData); in EncodePubKeyToX509() 413 static HcfResult EncodePriKeyToPKCS8(RSA *rsa, HcfBlob *returnBlob) in EncodePriKeyToPKCS8() argument 415 EVP_PKEY *pKey = NewEvpPkeyByRsa(rsa, true); in EncodePriKeyToPKCS8() 816 static HcfResult DuplicatePkAndSkFromRSA(RSA *rsa, RSA **pubKey, RSA **priKey) in DuplicatePkAndSkFromRSA() argument 818 if (rsa in DuplicatePkAndSkFromRSA() 835 PackKeyPair(RSA *rsa, uint32_t realBits, HcfOpensslRsaKeyPair **retKeyPair) PackKeyPair() argument 908 RSA *rsa = OpensslRsaNew(); GenerateKeyPair() local 1004 ConvertPemKeyToKey(const char *keyStr, int selection, RSA **rsa) ConvertPemKeyToKey() argument 1231 RSA *rsa = NULL; InitRsaStructByBin() local 1263 RSA *rsa = InitRsaStructByBin(paramsSpec); GenerateKeyPairBySpec() local 1315 RSA *rsa = InitRsaStructByBin(paramsSpec); GeneratePubKeyBySpec() local 1342 RSA *rsa = InitRsaStructByBin(paramsSpec); GeneratePriKeyBySpec() local [all...] |
/base/security/crypto_framework/plugin/openssl_plugin/common/inc/ |
H A D | rsa_openssl_common.h | 20 #include "openssl/rsa.h" 30 HcfResult DuplicateRsa(RSA *rsa, bool needPrivate, RSA **dupRsa); 32 EVP_PKEY *NewEvpPkeyByRsa(RSA *rsa, bool withDuplicate);
|
H A D | openssl_class.h | 27 #include <openssl/rsa.h>
|
H A D | openssl_common.h | 24 #include <openssl/rsa.h>
|
H A D | openssl_adapter.h | 194 void OpensslRsaFree(RSA *rsa); 195 int OpensslRsaGenerateMultiPrimeKey(RSA *rsa, int bits, int primes, 197 int OpensslRsaGenerateKeyEx(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); 198 int OpensslRsaBits(const RSA *rsa); 205 RSA *OpensslRsaPublicKeyDup(RSA *rsa); 206 RSA *OpensslRsaPrivateKeyDup(RSA *rsa);
|
/base/update/updater/services/package/pkg_algorithm/ |
H A D | pkg_algo_sign.cpp | 23 #include <openssl/rsa.h> 54 RSA *rsa = PEM_read_bio_RSAPrivateKey(in, nullptr, nullptr, nullptr); in SignBuffer() local 56 if (rsa == nullptr) { in SignBuffer() 62 uint32_t size = static_cast<uint32_t>(RSA_size(rsa)); in SignBuffer() 66 ret = RSA_sign(NID_sha256, buffer.buffer, buffer.length, sign.data(), &size, rsa); in SignBuffer() 68 ret = RSA_sign(NID_sha384, buffer.buffer, buffer.length, sign.data(), &size, rsa); in SignBuffer() 71 RSA_free(rsa); in SignBuffer()
|
H A D | pkg_algo_sign.h | 25 #include <openssl/rsa.h>
39 RSA *rsa;
member
|
/base/hiviewdfx/hiview/core/param_update/include/ |
H A D | log_sign_tools.h | 27 #include <openssl/rsa.h> 46 static bool VerifyRsa(RSA *rsa, const std::string &digest, const std::string &sign);
|
/base/security/certificate_manager/services/cert_manager_standard/cert_manager_engine/main/core/src/ |
H A D | cert_manager_app_cert_process.c | 23 #include <openssl/rsa.h> 138 static int32_t SaveKeyMaterialRsa(const RSA *rsa, const uint32_t keySize, struct CmBlob *keyOut) in SaveKeyMaterialRsa() argument 156 keyMaterial->nSize = (uint32_t)BN_bn2bin(RSA_get0_n(rsa), tmpBuff); in SaveKeyMaterialRsa() 158 CM_LOG_E("copy rsa n failed"); in SaveKeyMaterialRsa() 163 keyMaterial->eSize = (uint32_t)BN_bn2bin(RSA_get0_e(rsa), tmpBuff); in SaveKeyMaterialRsa() 165 CM_LOG_E("copy rsa e failed"); in SaveKeyMaterialRsa() 170 keyMaterial->dSize = (uint32_t)BN_bn2bin(RSA_get0_d(rsa), tmpBuff); in SaveKeyMaterialRsa() 172 CM_LOG_E("copy rsa d failed"); in SaveKeyMaterialRsa() 237 const RSA *rsa = EVP_PKEY_get0_RSA((EVP_PKEY *)priKey); in ImportRsaKey() local 238 if (rsa in ImportRsaKey() [all...] |
/base/security/huks/utils/crypto_adapter/ |
H A D | hks_client_service_adapter.c | 35 #include <openssl/rsa.h>
82 RSA *rsa = NULL;
in RsaToX509PublicKey() local 90 rsa = RSA_new();
in RsaToX509PublicKey() 91 HKS_IF_NULL_LOGE_BREAK(rsa, "rsa is null")
in RsaToX509PublicKey() 98 if (RSA_set0_key(rsa, rsaN, rsaE, NULL) == 0) {
in RsaToX509PublicKey() 106 if (EVP_PKEY_set1_RSA(pkey, rsa) == 0) {
in RsaToX509PublicKey() 113 SELF_FREE_PTR(rsa, RSA_free)
in RsaToX509PublicKey() 453 const RSA *rsa = EVP_PKEY_get0_RSA(pkey);
in X509PublicKeyToRsa() local 454 HKS_IF_NULL_LOGE_RETURN(rsa, HKS_ERROR_NULL_POINTE in X509PublicKeyToRsa() [all...] |
/base/security/certificate_framework/frameworks/adapter/v1.0/inc/ |
H A D | certificate_openssl_class.h | 29 #include <openssl/rsa.h>
|
/base/security/crypto_framework/test/unittest/src/ |
H A D | openssl_adapter_mock.c | 1087 void OpensslRsaFree(RSA *rsa) in OpensslRsaFree() argument 1089 if (rsa != NULL) { in OpensslRsaFree() 1090 RSA_free(rsa); in OpensslRsaFree() 1094 int OpensslRsaGenerateMultiPrimeKey(RSA *rsa, int bits, int primes, in OpensslRsaGenerateMultiPrimeKey() argument 1097 return RSA_generate_multi_prime_key(rsa, bits, primes, e, cb); in OpensslRsaGenerateMultiPrimeKey() 1100 int OpensslRsaGenerateKeyEx(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb) in OpensslRsaGenerateKeyEx() argument 1102 return RSA_generate_key_ex(rsa, bits, e, cb); in OpensslRsaGenerateKeyEx() 1105 int OpensslRsaBits(const RSA *rsa) in OpensslRsaBits() argument 1107 return RSA_bits(rsa); in OpensslRsaBits() 1140 RSA *OpensslRsaPublicKeyDup(RSA *rsa) in OpensslRsaPublicKeyDup() argument 1145 OpensslRsaPrivateKeyDup(RSA *rsa) OpensslRsaPrivateKeyDup() argument [all...] |
H A D | crypto_common_cov_test.cpp | 209 RSA *rsa = OpensslRsaNew(); in HWTEST_F() local 210 HcfResult ret = DuplicateRsa(rsa, true, nullptr); in HWTEST_F() 212 OpensslRsaFree(rsa); in HWTEST_F()
|
/base/global/i18n/frameworks/intl/include/ |
H A D | signature_verifier.h | 18 #include <openssl/rsa.h>
|
/base/security/huks/frameworks/huks_standard/main/crypto_engine/mbedtls/include/ |
H A D | hks_mbedtls_rsa.h | 25 #include <mbedtls/rsa.h>
|
/base/security/crypto_framework/plugin/openssl_plugin/crypto_operation/cipher/src/ |
H A D | cipher_rsa_openssl.c | 18 #include "openssl/rsa.h" 76 // dup will check if rsa is NULL in DuplicateRsaFromKey() 91 RSA *rsa = NULL; in InitEvpPkeyCtx() local 93 ret = DuplicateRsaFromKey(key, opMode, &rsa); in InitEvpPkeyCtx() 98 EVP_PKEY *pkey = NewEvpPkeyByRsa(rsa, false); in InitEvpPkeyCtx() 102 OpensslRsaFree(rsa); in InitEvpPkeyCtx() 496 LOGE("Malloc rsa cipher fail."); in HcfCipherRsaCipherSpiCreate()
|
/base/update/sys_installer_lite/frameworks/test/unittest/common/src/ |
H A D | ota_test.cpp | 415 AppRsaContext rsa;
in HWTEST_F() local 418 AppRsaInit(&rsa);
in HWTEST_F() 423 int ret = AppRsaDecodePublicKey(&rsa, keyBuf, length);
in HWTEST_F() 424 AppRsaFree(&rsa);
in HWTEST_F() 432 AppRsaContext rsa;
in HWTEST_F() local 434 AppRsaInit(&rsa);
in HWTEST_F() 439 int ret = AppRsaDecodePublicKey(&rsa, keyBuf, length);
in HWTEST_F() 446 ret = AppVerifyData(&rsa, imageHashLocal, HASH_LENGTH,
in HWTEST_F() 448 AppRsaFree(&rsa);
in HWTEST_F()
|
/base/security/crypto_framework/plugin/openssl_plugin/crypto_operation/signature/src/ |
H A D | signature_rsa_openssl.c | 147 RSA *rsa = NULL; in InitRsaEvpKey() local 149 // dup will check if rsa is NULL in InitRsaEvpKey() 150 if (DuplicateRsa(((HcfOpensslRsaPriKey *)key)->sk, signing, &rsa) != HCF_SUCCESS) { in InitRsaEvpKey() 155 if (DuplicateRsa(((HcfOpensslRsaPubKey *)key)->pk, signing, &rsa) != HCF_SUCCESS) { in InitRsaEvpKey() 160 if (rsa == NULL) { in InitRsaEvpKey() 164 EVP_PKEY *pkey = NewEvpPkeyByRsa(rsa, false); in InitRsaEvpKey() 168 OpensslRsaFree(rsa); in InitRsaEvpKey()
|