Home
last modified time | relevance | path

Searched refs:rsa (Results 1 – 21 of 21) sorted by relevance

/base/update/sys_installer_lite/frameworks/source/verify/
Dapp_rsa.c22 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 *cip… in AppVerifyData() argument
50 …if ((rsa == NULL) || (plainBuf == NULL) || (cipherBuf == NULL) || (plainBufLen == 0) || (cipherBuf… in AppVerifyData()
55 if (!mbedtls_pk_can_do(&(rsa->context), MBEDTLS_PK_RSA)) { in AppVerifyData()
60 mbedtls_rsa_set_padding(mbedtls_pk_rsa(rsa->context), MBEDTLS_RSA_PKCS_V21, MBEDTLS_MD_SHA256); in AppVerifyData()
[all …]
Dapp_rsa.h37 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 *cip…
53 void AppRsaFree(AppRsaContext *rsa);
Dhota_verify.c105 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/
Drsa_openssl_common.c20 HcfResult DuplicateRsa(RSA *rsa, bool needPrivate, RSA **dupRsa) in DuplicateRsa() argument
23 if (rsa == NULL || dupRsa == NULL) { in DuplicateRsa()
28 retRSA = Openssl_RSAPrivateKey_dup(rsa); in DuplicateRsa()
30 retRSA = Openssl_RSAPublicKey_dup(rsa); in DuplicateRsa()
41 EVP_PKEY *NewEvpPkeyByRsa(RSA *rsa, bool withDuplicate) in NewEvpPkeyByRsa() argument
43 if (rsa == NULL) { in NewEvpPkeyByRsa()
54 if (Openssl_EVP_PKEY_set1_RSA(pKey, rsa) != HCF_OPENSSL_SUCCESS) { in NewEvpPkeyByRsa()
61 if (Openssl_EVP_PKEY_assign_RSA(pKey, rsa) != HCF_OPENSSL_SUCCESS) { in NewEvpPkeyByRsa()
Dopenssl_adapter.c539 void Openssl_RSA_free(RSA *rsa) in Openssl_RSA_free() argument
541 RSA_free(rsa); in Openssl_RSA_free()
544 int Openssl_RSA_generate_multi_prime_key(RSA *rsa, int bits, int primes, in Openssl_RSA_generate_multi_prime_key() argument
547 return RSA_generate_multi_prime_key(rsa, bits, primes, e, cb); in Openssl_RSA_generate_multi_prime_key()
550 int Openssl_RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb) in Openssl_RSA_generate_key_ex() argument
552 return RSA_generate_key_ex(rsa, bits, e, cb); in Openssl_RSA_generate_key_ex()
555 int Openssl_RSA_bits(const RSA *rsa) in Openssl_RSA_bits() argument
557 return RSA_bits(rsa); in Openssl_RSA_bits()
590 RSA *Openssl_RSAPublicKey_dup(RSA *rsa) in Openssl_RSAPublicKey_dup() argument
592 return RSAPublicKey_dup(rsa); in Openssl_RSAPublicKey_dup()
[all …]
/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/alg_module_test/src/
Dopenssl_rsa_helper.c75 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 == NULL) { in X509ToRsaPublicKey()
139 int32_t nSizeTemp = BN_num_bytes(RSA_get0_n(rsa)); in X509ToRsaPublicKey()
[all …]
/base/security/huks/frameworks/huks_standard/main/crypto_engine/openssl/src/
Dhks_openssl_rsa.c127 RSA *rsa = NULL; in InitRsaStruct() local
133 rsa = RSA_new(); in InitRsaStruct()
134 if (rsa != NULL) { in InitRsaStruct()
135 ret = RSA_set0_key(rsa, n, e, d); in InitRsaStruct()
137 RSA_free(rsa); in InitRsaStruct()
138 rsa = NULL; in InitRsaStruct()
144 if (rsa == NULL) { in InitRsaStruct()
152 return rsa; in InitRsaStruct()
156 static int32_t RsaSaveKeyMaterial(const RSA *rsa, const uint32_t keySize, struct HksBlob *key) in RsaSaveKeyMaterial() argument
176 keyMaterial->nSize = (uint32_t)BN_bn2bin(RSA_get0_n(rsa), tmp_buff); in RsaSaveKeyMaterial()
[all …]
/base/security/crypto_framework/plugin/openssl_plugin/key/asy_key_generator/src/
Drsa_asy_key_generator_openssl.c325 static HcfResult ConvertPubKeyFromX509(HcfBlob *x509Blob, RSA **rsa) in ConvertPubKeyFromX509() argument
333 *rsa = tempRsa; in ConvertPubKeyFromX509()
337 static HcfResult ConvertPriKeyFromPKCS8(HcfBlob *pkcs8Blob, RSA **rsa) in ConvertPriKeyFromPKCS8() argument
353 *rsa = tmpRsa; in ConvertPriKeyFromPKCS8()
358 static HcfResult EncodePubKeyToX509(RSA *rsa, HcfBlob *returnBlob) in EncodePubKeyToX509() argument
361 int len = Openssl_i2d_RSA_PUBKEY(rsa, &tempData); in EncodePubKeyToX509()
372 static HcfResult EncodePriKeyToPKCS8(RSA *rsa, HcfBlob *returnBlob) in EncodePriKeyToPKCS8() argument
374 EVP_PKEY *pKey = NewEvpPkeyByRsa(rsa, true); in EncodePriKeyToPKCS8()
554 static HcfResult DuplicatePkAndSkFromRSA(RSA *rsa, RSA **pubKey, RSA **priKey) in DuplicatePkAndSkFromRSA() argument
556 if (rsa == NULL) { in DuplicatePkAndSkFromRSA()
[all …]
/base/security/huks/frameworks/crypto_lite/cipher/src/
Dcipher_rsa.c131 mbedtls_rsa_context *rsa = NULL; in RsaLoadPrivateKey() local
150 rsa = mbedtls_pk_rsa(*pk); in RsaLoadPrivateKey()
151 if (rsa == NULL) { 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()
179 mbedtls_rsa_context *rsa = NULL; in RsaLoadPublicKey() local
193 rsa = mbedtls_pk_rsa(*pk); in RsaLoadPublicKey()
194 if (rsa == NULL) { in RsaLoadPublicKey()
199 if (mbedtls_rsa_check_pubkey(rsa)) { in RsaLoadPublicKey()
204 mbedtls_rsa_set_padding(rsa, MBEDTLS_RSA_PKCS_V21, MBEDTLS_MD_SHA256); in RsaLoadPublicKey()
[all …]
/base/security/crypto_framework/plugin/openssl_plugin/common/inc/
Drsa_openssl_common.h30 HcfResult DuplicateRsa(RSA *rsa, bool needPrivate, RSA **dupRsa);
32 EVP_PKEY *NewEvpPkeyByRsa(RSA *rsa, bool withDuplicate);
Dopenssl_adapter.h151 void Openssl_RSA_free(RSA *rsa);
152 int Openssl_RSA_generate_multi_prime_key(RSA *rsa, int bits, int primes,
154 int Openssl_RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
155 int Openssl_RSA_bits(const RSA *rsa);
162 RSA *Openssl_RSAPublicKey_dup(RSA *rsa);
163 RSA *Openssl_RSAPrivateKey_dup(RSA *rsa);
/base/update/sys_installer_lite/frameworks/test/unittest/common/src/
Dota_test.cpp415 AppRsaContext rsa; variable
418 AppRsaInit(&rsa);
423 int ret = AppRsaDecodePublicKey(&rsa, keyBuf, length);
424 AppRsaFree(&rsa);
432 AppRsaContext rsa; variable
434 AppRsaInit(&rsa);
439 int ret = AppRsaDecodePublicKey(&rsa, keyBuf, length);
446 ret = AppVerifyData(&rsa, imageHashLocal, HASH_LENGTH,
448 AppRsaFree(&rsa);
/base/update/updater/services/package/pkg_algorithm/
Dpkg_algo_sign.cpp54 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()
Dpkg_algo_sign.h39 RSA *rsa; member
/base/security/certificate_manager/services/cert_manager_standard/cert_manager_engine/main/core/src/
Dcert_manager_app_cert_process.c134 static int32_t SaveKeyMaterialRsa(const RSA *rsa, const uint32_t keySize, struct CmBlob *keyOut) in SaveKeyMaterialRsa() argument
152 keyMaterial->nSize = (uint32_t)BN_bn2bin(RSA_get0_n(rsa), tmpBuff); in SaveKeyMaterialRsa()
159 keyMaterial->eSize = (uint32_t)BN_bn2bin(RSA_get0_e(rsa), tmpBuff); in SaveKeyMaterialRsa()
166 keyMaterial->dSize = (uint32_t)BN_bn2bin(RSA_get0_d(rsa), tmpBuff); in SaveKeyMaterialRsa()
233 const RSA *rsa = EVP_PKEY_get0_RSA((EVP_PKEY *)priKey); in ImportRsaKey() local
234 if (rsa == NULL) { in ImportRsaKey()
239 uint32_t keySize = ((uint32_t)RSA_size(rsa)) * CM_BITS_PER_BYTE; in ImportRsaKey()
241 ret = SaveKeyMaterialRsa(rsa, keySize, &keyPair); in ImportRsaKey()
/base/startup/hvb/tools/vb_pub_key/
DREADME.md5 openssl rsa -pubout -in test_priv.pem -out test_pub.pem
/base/security/huks/utils/crypto_adapter/
Dhks_client_service_adapter.c82 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()
564 const RSA *rsa = EVP_PKEY_get0_RSA(pkey); in X509PublicKeyToRsa() local
565 HKS_IF_NULL_LOGE_RETURN(rsa, HKS_ERROR_NULL_POINTER, in X509PublicKeyToRsa()
568 int nSize = BN_num_bytes(RSA_get0_n(rsa)); in X509PublicKeyToRsa()
569 int eSize = BN_num_bytes(RSA_get0_e(rsa)); in X509PublicKeyToRsa()
[all …]
/base/security/crypto_framework/test/unittest/src/
Dopenssl_adapter_mock.c854 void Openssl_RSA_free(RSA *rsa) in Openssl_RSA_free() argument
856 RSA_free(rsa); in Openssl_RSA_free()
859 int Openssl_RSA_generate_multi_prime_key(RSA *rsa, int bits, int primes, in Openssl_RSA_generate_multi_prime_key() argument
862 return RSA_generate_multi_prime_key(rsa, bits, primes, e, cb); in Openssl_RSA_generate_multi_prime_key()
865 int Openssl_RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb) in Openssl_RSA_generate_key_ex() argument
867 return RSA_generate_key_ex(rsa, bits, e, cb); in Openssl_RSA_generate_key_ex()
870 int Openssl_RSA_bits(const RSA *rsa) in Openssl_RSA_bits() argument
872 return RSA_bits(rsa); in Openssl_RSA_bits()
905 RSA *Openssl_RSAPublicKey_dup(RSA *rsa) in Openssl_RSAPublicKey_dup() argument
907 return RSAPublicKey_dup(rsa); in Openssl_RSAPublicKey_dup()
[all …]
Dcrypto_common_cov_test.cpp235 RSA *rsa = Openssl_RSA_new(); variable
236 HcfResult ret = DuplicateRsa(rsa, true, nullptr);
238 Openssl_RSA_free(rsa);
/base/security/crypto_framework/plugin/openssl_plugin/crypto_operation/signature/src/
Dsignature_rsa_openssl.c137 RSA *rsa = NULL; in InitRsaEvpKey() local
139 if (DuplicateRsa(((HcfOpensslRsaPriKey *)key)->sk, signing, &rsa) != HCF_SUCCESS) { in InitRsaEvpKey()
164 rsa = tmp; in InitRsaEvpKey()
167 if (DuplicateRsa(((HcfOpensslRsaPubKey *)key)->pk, signing, &rsa) != HCF_SUCCESS) { in InitRsaEvpKey()
172 if (rsa == NULL) { in InitRsaEvpKey()
176 EVP_PKEY *pkey = NewEvpPkeyByRsa(rsa, false); in InitRsaEvpKey()
180 Openssl_RSA_free(rsa); in InitRsaEvpKey()
/base/security/crypto_framework/plugin/openssl_plugin/crypto_operation/cipher/src/
Dcipher_rsa_openssl.c117 RSA *rsa = NULL; in InitEvpPkeyCtx() local
119 ret = DuplicateRsaFromKey(key, opMode, &rsa); in InitEvpPkeyCtx()
124 EVP_PKEY *pkey = NewEvpPkeyByRsa(rsa, false); in InitEvpPkeyCtx()
128 Openssl_RSA_free(rsa); in InitEvpPkeyCtx()