mirror of
https://gitee.com/openharmony/security_crypto_framework
synced 2024-11-23 15:00:04 +00:00
修改codecheck
Signed-off-by: hhhFun <fanghaojie@huawei.com>
This commit is contained in:
parent
1b2102c04b
commit
796f05717f
@ -215,12 +215,6 @@ EVP_PKEY *OpensslD2iAutoPrivateKey(EVP_PKEY **a, const unsigned char **pp, long
|
||||
struct rsa_st *OpensslEvpPkeyGet1Rsa(EVP_PKEY *pkey);
|
||||
int OpensslEvpPkeySet1Rsa(EVP_PKEY *pkey, struct rsa_st *key);
|
||||
int OpensslEvpPkeyAssignRsa(EVP_PKEY *pkey, struct rsa_st *key);
|
||||
int OpensslI2dPkcs8PrivateKeyBio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
|
||||
char *kstr, int klen, pem_password_cb *cb, void *u);
|
||||
int OpensslPemWriteBioRsaPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc,
|
||||
unsigned char *kstr, int klen, pem_password_cb *cb, void *u);
|
||||
int OpensslPemWriteBioPkcs8PrivateKey(BIO *bp, const EVP_PKEY *x, const EVP_CIPHER *enc,
|
||||
const char *kstr, int klen, pem_password_cb *cb, void *u);
|
||||
int OpensslPemWriteBioRsaPublicKey(BIO *bp, RSA *x);
|
||||
int OpensslPemWriteBioRsaPubKey(BIO *bp, RSA *x);
|
||||
// BIO
|
||||
@ -365,8 +359,6 @@ int OpensslI2dSm2CipherText(struct Sm2CipherTextSt *sm2Text, unsigned char **ret
|
||||
int OpensslAsn1StringLength(ASN1_OCTET_STRING *p);
|
||||
const unsigned char *OpensslAsn1StringGet0Data(ASN1_OCTET_STRING *p);
|
||||
|
||||
size_t OpensslEcPoint2Oct(const EC_GROUP *group, const EC_POINT *p, point_conversion_form_t form,
|
||||
unsigned char *buf, size_t len, BN_CTX *ctx);
|
||||
OSSL_PARAM_BLD *OpensslOsslParamBldNew(void);
|
||||
void OpensslOsslParamBldFree(OSSL_PARAM_BLD *bld);
|
||||
OSSL_PARAM *OpensslOsslParamBldToParam(OSSL_PARAM_BLD *bld);
|
||||
|
@ -809,24 +809,6 @@ int OpensslEvpPkeyAssignRsa(EVP_PKEY *pkey, struct rsa_st *key)
|
||||
return EVP_PKEY_assign_RSA(pkey, key);
|
||||
}
|
||||
|
||||
int OpensslI2dPkcs8PrivateKeyBio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
|
||||
char *kstr, int klen, pem_password_cb *cb, void *u)
|
||||
{
|
||||
return i2d_PKCS8PrivateKey_bio(bp, x, enc, kstr, klen, cb, u);
|
||||
}
|
||||
|
||||
int OpensslPemWriteBioPkcs8PrivateKey(BIO *bp, const EVP_PKEY *x, const EVP_CIPHER *enc,
|
||||
const char *kstr, int klen, pem_password_cb *cb, void *u)
|
||||
{
|
||||
return PEM_write_bio_PKCS8PrivateKey(bp, x, enc, kstr, klen, cb, u);
|
||||
}
|
||||
|
||||
int OpensslPemWriteBioRsaPrivateKey(BIO *bp, RSA *x, const EVP_CIPHER *enc,
|
||||
unsigned char *kstr, int klen, pem_password_cb *cb, void *u)
|
||||
{
|
||||
return PEM_write_bio_RSAPrivateKey(bp, x, enc, kstr, klen, cb, u);
|
||||
}
|
||||
|
||||
int OpensslPemWriteBioRsaPublicKey(BIO *bp, RSA *x)
|
||||
{
|
||||
return PEM_write_bio_RSAPublicKey(bp, x);
|
||||
@ -1371,12 +1353,6 @@ const unsigned char *OpensslAsn1StringGet0Data(ASN1_OCTET_STRING *p)
|
||||
return ASN1_STRING_get0_data(p);
|
||||
}
|
||||
|
||||
size_t OpensslEcPoint2Oct(const EC_GROUP *group, const EC_POINT *p, point_conversion_form_t form,
|
||||
unsigned char *buf, size_t len, BN_CTX *ctx)
|
||||
{
|
||||
return EC_POINT_point2oct(group, p, form, buf, len, ctx);
|
||||
}
|
||||
|
||||
OSSL_PARAM_BLD *OpensslOsslParamBldNew(void)
|
||||
{
|
||||
return OSSL_PARAM_BLD_new();
|
||||
|
@ -620,6 +620,7 @@ HcfResult HcfVerifySpiDsaCreate(HcfSignatureParams *params, HcfVerifySpi **retur
|
||||
} else {
|
||||
HcfResult ret = GetOpensslDigestAlg(params->md, &digestAlg);
|
||||
if (ret != HCF_SUCCESS) {
|
||||
HcfFree(impl);
|
||||
return HCF_INVALID_PARAMS;
|
||||
}
|
||||
impl->base.engineInit = EngineDsaVerifyInit;
|
||||
|
@ -1143,7 +1143,7 @@ static HcfResult GetCompressedEccPointEncoded(HcfOpensslEccPubKey *impl, HcfBlob
|
||||
LOGE("Failed to get point.");
|
||||
return HCF_ERR_CRYPTO_OPERATION;
|
||||
}
|
||||
size_t returnDataLen = OpensslEcPoint2Oct(group, point, POINT_CONVERSION_COMPRESSED, NULL, 0, NULL);
|
||||
size_t returnDataLen = EC_POINT_point2oct(group, point, POINT_CONVERSION_COMPRESSED, NULL, 0, NULL);
|
||||
if (returnDataLen == 0) {
|
||||
LOGE("Failed to get compressed key length.");
|
||||
HcfPrintOpensslError();
|
||||
@ -1154,7 +1154,7 @@ static HcfResult GetCompressedEccPointEncoded(HcfOpensslEccPubKey *impl, HcfBlob
|
||||
LOGE("Failed to allocate memory for returnBlob data.");
|
||||
return HCF_ERR_MALLOC;
|
||||
}
|
||||
size_t result = OpensslEcPoint2Oct(group, point, POINT_CONVERSION_COMPRESSED,
|
||||
size_t result = EC_POINT_point2oct(group, point, POINT_CONVERSION_COMPRESSED,
|
||||
returnData, returnDataLen, NULL);
|
||||
if (result != returnDataLen) {
|
||||
LOGE("Failed to convert public key to compressed format.");
|
||||
@ -1385,7 +1385,7 @@ static HcfResult GetECPriKeyEncodedDer(const HcfPriKey *self, const char *format
|
||||
ret = HCF_ERR_CRYPTO_OPERATION;
|
||||
goto ERR2;
|
||||
}
|
||||
if (OpensslI2dPkcs8PrivateKeyBio(bio, pkey, NULL, NULL, 0, NULL, NULL) != HCF_OPENSSL_SUCCESS) {
|
||||
if (i2d_PKCS8PrivateKey_bio(bio, pkey, NULL, NULL, 0, NULL, NULL) != HCF_OPENSSL_SUCCESS) {
|
||||
LOGE("i2d privateKey bio fail.");
|
||||
HcfPrintOpensslError();
|
||||
ret = HCF_ERR_CRYPTO_OPERATION;
|
||||
|
@ -354,7 +354,7 @@ static HcfResult GetECCPointEncoded(const int32_t formatValue, EC_GROUP *ecGroup
|
||||
return HCF_INVALID_PARAMS;
|
||||
}
|
||||
|
||||
size_t returnDataLen = OpensslEcPoint2Oct(ecGroup, ecPoint, formatType, NULL, 0, NULL);
|
||||
size_t returnDataLen = EC_POINT_point2oct(ecGroup, ecPoint, formatType, NULL, 0, NULL);
|
||||
if (returnDataLen == 0) {
|
||||
LOGE("Failed to get encoded point length.");
|
||||
HcfPrintOpensslError();
|
||||
@ -366,7 +366,7 @@ static HcfResult GetECCPointEncoded(const int32_t formatValue, EC_GROUP *ecGroup
|
||||
LOGE("Failed to allocate memory for encoded point data.");
|
||||
return HCF_ERR_MALLOC;
|
||||
}
|
||||
size_t result = OpensslEcPoint2Oct(ecGroup, ecPoint, formatType, returnData, returnDataLen, NULL);
|
||||
size_t result = EC_POINT_point2oct(ecGroup, ecPoint, formatType, returnData, returnDataLen, NULL);
|
||||
if (result != returnDataLen) {
|
||||
LOGE("Failed to get ECC point encoding.");
|
||||
HcfPrintOpensslError();
|
||||
|
@ -420,7 +420,7 @@ static HcfResult EncodePriKeyToPKCS8(RSA *rsa, HcfBlob *returnBlob)
|
||||
ret = HCF_ERR_CRYPTO_OPERATION;
|
||||
goto ERR2;
|
||||
}
|
||||
if (OpensslI2dPkcs8PrivateKeyBio(bio, pKey, NULL, NULL, 0, NULL, NULL) != HCF_OPENSSL_SUCCESS) {
|
||||
if (i2d_PKCS8PrivateKey_bio(bio, pKey, NULL, NULL, 0, NULL, NULL) != HCF_OPENSSL_SUCCESS) {
|
||||
LOGD("[error] i2b_PrivateKey_bio fail.");
|
||||
HcfPrintOpensslError();
|
||||
ret = HCF_ERR_CRYPTO_OPERATION;
|
||||
@ -585,7 +585,7 @@ static HcfResult GetPrikeyPkcs8Pem(EVP_PKEY *pkey, char **returnString)
|
||||
HcfPrintOpensslError();
|
||||
return HCF_ERR_CRYPTO_OPERATION;
|
||||
}
|
||||
int ret = OpensslPemWriteBioPkcs8PrivateKey(bio, pkey, NULL, NULL, 0, NULL, NULL);
|
||||
int ret = PEM_write_bio_PKCS8PrivateKey(bio, pkey, NULL, NULL, 0, NULL, NULL);
|
||||
if (ret != HCF_OPENSSL_SUCCESS) {
|
||||
LOGE("OpensslPemWriteBioPkcs8PrivateKey fail.");
|
||||
HcfPrintOpensslError();
|
||||
@ -609,7 +609,7 @@ static HcfResult GetPrikeyPkcs1Pem(RSA *sk, char **returnString)
|
||||
HcfPrintOpensslError();
|
||||
return HCF_ERR_CRYPTO_OPERATION;
|
||||
}
|
||||
int ret = OpensslPemWriteBioRsaPrivateKey(bio, sk, NULL, NULL, 0, NULL, NULL);
|
||||
int ret = PEM_write_bio_RSAPrivateKey(bio, sk, NULL, NULL, 0, NULL, NULL);
|
||||
if (ret != HCF_OPENSSL_SUCCESS) {
|
||||
LOGE("OpensslPemWriteBioRsaPrivateKey fail.");
|
||||
HcfPrintOpensslError();
|
||||
|
@ -1212,12 +1212,6 @@ int OpensslEvpPkeyAssignRsa(EVP_PKEY *pkey, struct rsa_st *key)
|
||||
return EVP_PKEY_assign_RSA(pkey, key);
|
||||
}
|
||||
|
||||
int OpensslI2dPkcs8PrivateKeyBio(BIO *bp, EVP_PKEY *x, const EVP_CIPHER *enc,
|
||||
char *kstr, int klen, pem_password_cb *cb, void *u)
|
||||
{
|
||||
return i2d_PKCS8PrivateKey_bio(bp, x, enc, kstr, klen, cb, u);
|
||||
}
|
||||
|
||||
BIO *OpensslBioNew(const BIO_METHOD *type)
|
||||
{
|
||||
return BIO_new(type);
|
||||
@ -1868,15 +1862,6 @@ int OpensslDhSet0Key(DH *dh, BIGNUM *pubKey, BIGNUM *privKey)
|
||||
return DH_set0_key(dh, pubKey, privKey);
|
||||
}
|
||||
|
||||
size_t OpensslEcPoint2Oct(const EC_GROUP *group, const EC_POINT *p, point_conversion_form_t form,
|
||||
unsigned char *buf, size_t len, BN_CTX *ctx)
|
||||
{
|
||||
if (IsNeedMock()) {
|
||||
return -1;
|
||||
}
|
||||
return EC_POINT_point2oct(group, p, form, buf, len, ctx);
|
||||
}
|
||||
|
||||
OSSL_PARAM_BLD *OpensslOsslParamBldNew(void)
|
||||
{
|
||||
if (IsNeedMock()) {
|
||||
|
Loading…
Reference in New Issue
Block a user