mirror of
https://gitee.com/openharmony/security_certificate_framework
synced 2024-11-23 14:39:44 +00:00
commit
72a5b2838a
@ -719,7 +719,7 @@ static CfResult GetNotBeforeX509Openssl(HcfX509CertificateSpi *self, CfBlob *out
|
||||
LOGE("Failed to get notBeforeDate data!");
|
||||
return CF_ERR_CRYPTO_OPERATION;
|
||||
}
|
||||
uint32_t length = strlen(date);
|
||||
uint32_t length = strlen(date) + 1;
|
||||
return DeepCopyDataToOut(date, length, outDate);
|
||||
}
|
||||
|
||||
@ -751,7 +751,7 @@ static CfResult GetNotAfterX509Openssl(HcfX509CertificateSpi *self, CfBlob *outD
|
||||
LOGE("Failed to get notAfterDate data!");
|
||||
return CF_ERR_CRYPTO_OPERATION;
|
||||
}
|
||||
uint32_t length = strlen(date);
|
||||
uint32_t length = strlen(date) + 1;
|
||||
return DeepCopyDataToOut(date, length, outDate);
|
||||
}
|
||||
|
||||
@ -811,7 +811,7 @@ static CfResult GetSigAlgNameX509Openssl(HcfX509CertificateSpi *self, CfBlob *ou
|
||||
if (algName == NULL) {
|
||||
return CF_ERR_CRYPTO_OPERATION;
|
||||
}
|
||||
uint32_t len = strlen(algName);
|
||||
uint32_t len = strlen(algName) + 1;
|
||||
return DeepCopyDataToOut(algName, len, outName);
|
||||
}
|
||||
|
||||
@ -838,7 +838,7 @@ static CfResult GetSigAlgOidX509Openssl(HcfX509CertificateSpi *self, CfBlob *out
|
||||
CfPrintOpensslError();
|
||||
return CF_ERR_CRYPTO_OPERATION;
|
||||
}
|
||||
uint32_t len = strlen(algOid);
|
||||
uint32_t len = strlen(algOid) + 1;
|
||||
return DeepCopyDataToOut(algOid, len, out);
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ static CfResult GetRevocationDate(HcfX509CrlEntry *self, CfBlob *out)
|
||||
LOGE("Get revocation date from ASN1_TIME fail!");
|
||||
return CF_ERR_CRYPTO_OPERATION;
|
||||
}
|
||||
uint32_t length = strlen(revTime);
|
||||
uint32_t length = strlen(revTime) + 1;
|
||||
out->data = (uint8_t *)CfMalloc(length, 0);
|
||||
if (out->data == NULL) {
|
||||
LOGE("Failed to malloc for revTime!");
|
||||
|
@ -296,7 +296,7 @@ static CfResult GetLastUpdate(HcfX509CrlSpi *self, CfBlob *out)
|
||||
LOGE("ThisUpdate convert String fail, or thisUpdate is too long!");
|
||||
return CF_ERR_CRYPTO_OPERATION;
|
||||
}
|
||||
uint32_t length = strlen(thisUpdate);
|
||||
uint32_t length = strlen(thisUpdate) + 1;
|
||||
out->data = (uint8_t *)CfMalloc(length, 0);
|
||||
if (out->data == NULL) {
|
||||
LOGE("Failed to malloc for thisUpdate!");
|
||||
@ -329,7 +329,7 @@ static CfResult GetNextUpdate(HcfX509CrlSpi *self, CfBlob *out)
|
||||
LOGE("Get next update time is null, or nextUpdate is too long!");
|
||||
return CF_ERR_CRYPTO_OPERATION;
|
||||
}
|
||||
uint32_t length = strlen(nextUpdate);
|
||||
uint32_t length = strlen(nextUpdate) + 1;
|
||||
out->data = (uint8_t *)CfMalloc(length, 0);
|
||||
if (out->data == NULL) {
|
||||
LOGE("Failed to malloc for nextUpdate!");
|
||||
@ -596,7 +596,7 @@ static CfResult GetSignatureAlgOidInner(X509_CRL *crl, CfBlob *oidOut)
|
||||
CfFree(output);
|
||||
return CF_ERR_CRYPTO_OPERATION;
|
||||
}
|
||||
uint32_t length = strlen(output);
|
||||
uint32_t length = strlen(output) + 1;
|
||||
oidOut->data = (uint8_t *)CfMalloc(length, 0);
|
||||
if (oidOut->data == NULL) {
|
||||
LOGE("Failed to malloc for oidOut!");
|
||||
@ -647,7 +647,7 @@ static CfResult GetSignatureAlgName(HcfX509CrlSpi *self, CfBlob *algNameOut)
|
||||
LOGE("Can not find algorithmName!");
|
||||
return CF_ERR_CRYPTO_OPERATION;
|
||||
}
|
||||
uint32_t length = strlen(algName);
|
||||
uint32_t length = strlen(algName) + 1;
|
||||
algNameOut->data = (uint8_t *)CfMalloc(length, 0);
|
||||
if (algNameOut->data == NULL) {
|
||||
LOGE("Failed to malloc for algName!");
|
||||
|
@ -463,7 +463,8 @@ napi_value NapiX509Certificate::GetNotBeforeTime(napi_env env, napi_callback_inf
|
||||
return nullptr;
|
||||
}
|
||||
napi_value result = nullptr;
|
||||
napi_create_string_utf8(env, reinterpret_cast<char *>(blob->data), blob->size, &result);
|
||||
uint32_t size = blob->data[blob->size - 1] == '\0' ? blob->size - 1 : blob->size;
|
||||
napi_create_string_utf8(env, reinterpret_cast<char *>(blob->data), size, &result);
|
||||
CfBlobDataFree(blob);
|
||||
CfFree(blob);
|
||||
blob = nullptr;
|
||||
@ -487,7 +488,8 @@ napi_value NapiX509Certificate::GetNotAfterTime(napi_env env, napi_callback_info
|
||||
return nullptr;
|
||||
}
|
||||
napi_value result = nullptr;
|
||||
napi_create_string_utf8(env, reinterpret_cast<char *>(blob->data), blob->size, &result);
|
||||
uint32_t size = blob->data[blob->size - 1] == '\0' ? blob->size - 1 : blob->size;
|
||||
napi_create_string_utf8(env, reinterpret_cast<char *>(blob->data), size, &result);
|
||||
CfBlobDataFree(blob);
|
||||
CfFree(blob);
|
||||
blob = nullptr;
|
||||
@ -534,7 +536,8 @@ napi_value NapiX509Certificate::GetSigAlgName(napi_env env, napi_callback_info i
|
||||
return nullptr;
|
||||
}
|
||||
napi_value result = nullptr;
|
||||
napi_create_string_utf8(env, reinterpret_cast<char *>(blob->data), blob->size, &result);
|
||||
uint32_t size = blob->data[blob->size - 1] == '\0' ? blob->size - 1 : blob->size;
|
||||
napi_create_string_utf8(env, reinterpret_cast<char *>(blob->data), size, &result);
|
||||
CfBlobDataFree(blob);
|
||||
CfFree(blob);
|
||||
blob = nullptr;
|
||||
@ -558,7 +561,8 @@ napi_value NapiX509Certificate::GetSigAlgOID(napi_env env, napi_callback_info in
|
||||
return nullptr;
|
||||
}
|
||||
napi_value result = nullptr;
|
||||
napi_create_string_utf8(env, reinterpret_cast<char *>(blob->data), blob->size, &result);
|
||||
uint32_t size = blob->data[blob->size - 1] == '\0' ? blob->size - 1 : blob->size;
|
||||
napi_create_string_utf8(env, reinterpret_cast<char *>(blob->data), size, &result);
|
||||
CfBlobDataFree(blob);
|
||||
CfFree(blob);
|
||||
blob = nullptr;
|
||||
|
@ -468,7 +468,8 @@ napi_value NapiX509Crl::GetThisUpdate(napi_env env, napi_callback_info info)
|
||||
return nullptr;
|
||||
}
|
||||
napi_value result = nullptr;
|
||||
napi_create_string_utf8(env, reinterpret_cast<char *>(blob->data), blob->size, &result);
|
||||
uint32_t size = blob->data[blob->size - 1] == '\0' ? blob->size - 1 : blob->size;
|
||||
napi_create_string_utf8(env, reinterpret_cast<char *>(blob->data), size, &result);
|
||||
CfBlobDataFree(blob);
|
||||
CfFree(blob);
|
||||
blob = nullptr;
|
||||
@ -492,7 +493,8 @@ napi_value NapiX509Crl::GetNextUpdate(napi_env env, napi_callback_info info)
|
||||
return nullptr;
|
||||
}
|
||||
napi_value result = nullptr;
|
||||
napi_create_string_utf8(env, reinterpret_cast<char *>(blob->data), blob->size, &result);
|
||||
uint32_t size = blob->data[blob->size - 1] == '\0' ? blob->size - 1 : blob->size;
|
||||
napi_create_string_utf8(env, reinterpret_cast<char *>(blob->data), size, &result);
|
||||
CfBlobDataFree(blob);
|
||||
CfFree(blob);
|
||||
blob = nullptr;
|
||||
@ -889,7 +891,8 @@ napi_value NapiX509Crl::GetSigAlgName(napi_env env, napi_callback_info info)
|
||||
return nullptr;
|
||||
}
|
||||
napi_value result = nullptr;
|
||||
napi_create_string_utf8(env, reinterpret_cast<char *>(blob->data), blob->size, &result);
|
||||
uint32_t size = blob->data[blob->size - 1] == '\0' ? blob->size - 1 : blob->size;
|
||||
napi_create_string_utf8(env, reinterpret_cast<char *>(blob->data), size, &result);
|
||||
CfBlobDataFree(blob);
|
||||
CfFree(blob);
|
||||
blob = nullptr;
|
||||
@ -913,7 +916,8 @@ napi_value NapiX509Crl::GetSigAlgOID(napi_env env, napi_callback_info info)
|
||||
return nullptr;
|
||||
}
|
||||
napi_value result = nullptr;
|
||||
napi_create_string_utf8(env, reinterpret_cast<char *>(blob->data), blob->size, &result);
|
||||
uint32_t size = blob->data[blob->size - 1] == '\0' ? blob->size - 1 : blob->size;
|
||||
napi_create_string_utf8(env, reinterpret_cast<char *>(blob->data), size, &result);
|
||||
CfBlobDataFree(blob);
|
||||
CfFree(blob);
|
||||
blob = nullptr;
|
||||
|
@ -284,7 +284,8 @@ napi_value NapiX509CrlEntry::GetRevocationDate(napi_env env, napi_callback_info
|
||||
return nullptr;
|
||||
}
|
||||
napi_value returnDate = nullptr;
|
||||
napi_create_string_utf8(env, reinterpret_cast<char *>(blob->data), blob->size, &returnDate);
|
||||
uint32_t size = blob->data[blob->size - 1] == '\0' ? blob->size - 1 : blob->size;
|
||||
napi_create_string_utf8(env, reinterpret_cast<char *>(blob->data), size, &returnDate);
|
||||
CfBlobDataFree(blob);
|
||||
CfFree(blob);
|
||||
blob = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user