mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
crypto: use OPENSSL_SIZE_T instead of hard coding int
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: https://github.com/nodejs/node/pull/66752 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Tim Perry <pimterry@gmail.com>
This commit is contained in:
4 files changed
+7
-6
No files matched your search
@@ -90,7 +90,7 @@ StackOfX509 CloneSSLCerts(X509Pointer&& cert,
|
||||
if (!peer_certs) return StackOfX509();
|
||||
if (cert && !sk_X509_push(peer_certs.get(), cert.release()))
|
||||
return StackOfX509();
|
||||
for (int i = 0; i < sk_X509_num(ssl_certs); i++) {
|
||||
for (OPENSSL_SIZE_T i = 0; i < sk_X509_num(ssl_certs); i++) {
|
||||
X509Pointer cert(X509_dup(sk_X509_value(ssl_certs, i)));
|
||||
if (!cert || !sk_X509_push(peer_certs.get(), cert.get()))
|
||||
return StackOfX509();
|
||||
@@ -106,7 +106,7 @@ MaybeLocal<Object> AddIssuerChainToObject(X509Pointer* cert,
|
||||
Environment* const env) {
|
||||
cert->reset(sk_X509_delete(peer_certs.get(), 0));
|
||||
for (;;) {
|
||||
int i;
|
||||
OPENSSL_SIZE_T i;
|
||||
for (i = 0; i < sk_X509_num(peer_certs.get()); i++) {
|
||||
X509View ca(sk_X509_value(peer_certs.get(), i));
|
||||
if (!cert->view().isIssuedBy(ca)) continue;
|
||||
|
||||
@@ -157,7 +157,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX* ctx,
|
||||
// the CA certificates.
|
||||
SSL_CTX_clear_extra_chain_certs(ctx);
|
||||
|
||||
for (int i = 0; i < sk_X509_num(extra_certs); i++) {
|
||||
for (OPENSSL_SIZE_T i = 0; i < sk_X509_num(extra_certs); i++) {
|
||||
X509* ca = sk_X509_value(extra_certs, i);
|
||||
|
||||
// NOTE: Increments reference count on `ca`
|
||||
@@ -2531,7 +2531,7 @@ void SecureContext::LoadPKCS12(const FunctionCallbackInfo<Value>& args) {
|
||||
}
|
||||
|
||||
// Add CA certs too
|
||||
for (int i = 0; i < sk_X509_num(extra_certs.get()); i++) {
|
||||
for (OPENSSL_SIZE_T i = 0; i < sk_X509_num(extra_certs.get()); i++) {
|
||||
X509* ca = sk_X509_value(extra_certs.get(), i);
|
||||
|
||||
X509_STORE_add_cert(sc->GetCertStoreOwnedByThisSecureContext(), ca);
|
||||
|
||||
@@ -374,7 +374,7 @@ void OneShotDigestWithMD(Environment* env,
|
||||
enum encoding output_enc = ParseEncoding(isolate, args[4], args[5], HEX);
|
||||
|
||||
bool is_xof = (EVP_MD_flags(md) & EVP_MD_FLAG_XOF) != 0;
|
||||
int output_length = EVP_MD_size(md);
|
||||
OPENSSL_SIZE_T output_length = EVP_MD_size(md);
|
||||
|
||||
// This is to cause hash() to fail when an incorrect
|
||||
// outputLength option was passed for a non-XOF hash function.
|
||||
|
||||
@@ -1028,7 +1028,8 @@ MaybeLocal<Object> X509Certificate::NewWithIssuers(
|
||||
}
|
||||
|
||||
Local<Object> issuer;
|
||||
if (issuer_chain != nullptr && start < sk_X509_num(issuer_chain)) {
|
||||
if (issuer_chain != nullptr &&
|
||||
static_cast<OPENSSL_SIZE_T>(start) < sk_X509_num(issuer_chain)) {
|
||||
X509Pointer issuer_cert =
|
||||
X509View(sk_X509_value(issuer_chain, start)).clone();
|
||||
if (!issuer_cert) [[unlikely]] {
|
||||
|
||||
Reference in new issue
Block a user