From a67eaf1b9293ea999888d1632947e4b947edf355 Mon Sep 17 00:00:00 2001
From: Sebastião Guerra <sebastiao.luiz.guerra@gmail.com>
Date: Fri, 2 Oct 2026 09:05:57 -0300
Subject: Replace NULL pointer constants with nullptr
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Sebastião Guerra <sebastiao.luiz.guerra@gmail.com>
---
 src/tls/tqca-tls.cpp | 56 ++++++++++++++++++++++++++--------------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/src/tls/tqca-tls.cpp b/src/tls/tqca-tls.cpp
index e17f649..4a71273 100644
--- a/src/tls/tqca-tls.cpp
+++ b/src/tls/tqca-tls.cpp
@@ -45,7 +45,7 @@
 static TQByteArray lib_randomArray(int size)
 {
 	if(RAND_status() == 0) {
-		srand(time(NULL));
+		srand(time(nullptr));
 		char buf[128];
 		for(int n = 0; n < 128; ++n)
 			buf[n] = rand();
@@ -246,19 +246,19 @@ public:
 #endif
 
 		if(dir == TQCA::Encrypt) {
-			if(!EVP_EncryptInit(c, type, NULL, NULL))
+			if(!EVP_EncryptInit(c, type, nullptr, nullptr))
 				return false;
 			if(keysize != EVP_CIPHER_key_length(type))
 				EVP_CIPHER_CTX_set_key_length(c, keysize);
-			if(!EVP_EncryptInit(c, NULL, (unsigned char *)key, (unsigned char *)iv))
+			if(!EVP_EncryptInit(c, nullptr, (unsigned char *)key, (unsigned char *)iv))
 				return false;
 		}
 		else {
-			if(!EVP_DecryptInit(c, type, NULL, NULL))
+			if(!EVP_DecryptInit(c, type, nullptr, nullptr))
 				return false;
 			if(keysize != EVP_CIPHER_key_length(type))
 				EVP_CIPHER_CTX_set_key_length(c, keysize);
-			if(!EVP_DecryptInit(c, NULL, (unsigned char *)key, (unsigned char *)iv))
+			if(!EVP_DecryptInit(c, nullptr, (unsigned char *)key, (unsigned char *)iv))
 				return false;
 		}
 		return true;
@@ -402,30 +402,30 @@ public:
 	{
 		// public
 		unsigned char *buf, *p;
-		int len = i2d_RSAPublicKey(r, NULL);
+		int len = i2d_RSAPublicKey(r, nullptr);
 		if(len > 0) {
 			buf = (unsigned char *)malloc(len);
 			p = buf;
 			i2d_RSAPublicKey(r, &p);
 			p = buf;
 #ifdef OSSL_097
-			*_pub = d2i_RSAPublicKey(NULL, (const unsigned char **)&p, len);
+			*_pub = d2i_RSAPublicKey(nullptr, (const unsigned char **)&p, len);
 #else
-			*_pub = d2i_RSAPublicKey(NULL, (unsigned char **)&p, len);
+			*_pub = d2i_RSAPublicKey(nullptr, (unsigned char **)&p, len);
 #endif
 			free(buf);
 		}
 
-		len = i2d_RSAPrivateKey(r, NULL);
+		len = i2d_RSAPrivateKey(r, nullptr);
 		if(len > 0) {
 			buf = (unsigned char *)malloc(len);
 			p = buf;
 			i2d_RSAPrivateKey(r, &p);
 			p = buf;
 #ifdef OSSL_097
-			*_sec = d2i_RSAPrivateKey(NULL, (const unsigned char **)&p, len);
+			*_sec = d2i_RSAPrivateKey(nullptr, (const unsigned char **)&p, len);
 #else
-			*_sec = d2i_RSAPrivateKey(NULL, (unsigned char **)&p, len);
+			*_sec = d2i_RSAPrivateKey(nullptr, (unsigned char **)&p, len);
 #endif
 			free(buf);
 		}
@@ -456,9 +456,9 @@ public:
 		// private?
 		p = (void *)in;
 #ifdef OSSL_097
-		r = d2i_RSAPrivateKey(NULL, (const unsigned char **)&p, len);
+		r = d2i_RSAPrivateKey(nullptr, (const unsigned char **)&p, len);
 #else
-		r = d2i_RSAPrivateKey(NULL, (unsigned char **)&p, len);
+		r = d2i_RSAPrivateKey(nullptr, (unsigned char **)&p, len);
 #endif
 		if(r) {
 			reset();
@@ -471,14 +471,14 @@ public:
 			// public?
 			p = (void *)in;
 #ifdef OSSL_097
-			r = d2i_RSAPublicKey(NULL, (const unsigned char **)&p, len);
+			r = d2i_RSAPublicKey(nullptr, (const unsigned char **)&p, len);
 #else
-			r = d2i_RSAPublicKey(NULL, (unsigned char **)&p, len);
+			r = d2i_RSAPublicKey(nullptr, (unsigned char **)&p, len);
 #endif
 			if(!r) {
 				// try this other public function, for whatever reason
 				p = (void *)in;
-				r = d2i_RSA_PUBKEY(NULL, (const unsigned char **)&p, len);
+				r = d2i_RSA_PUBKEY(nullptr, (const unsigned char **)&p, len);
 			}
 			if(r) {
 				if(pub) {
@@ -499,7 +499,7 @@ public:
 		// private?
 		bi = BIO_new(BIO_s_mem());
 		BIO_write(bi, in, len);
-		RSA *r = PEM_read_bio_RSAPrivateKey(bi, NULL, NULL, NULL);
+		RSA *r = PEM_read_bio_RSAPrivateKey(bi, nullptr, nullptr, nullptr);
 		BIO_free(bi);
 		if(r) {
 			reset();
@@ -510,7 +510,7 @@ public:
 			// public?
 			bi = BIO_new(BIO_s_mem());
 			BIO_write(bi, in, len);
-			r = PEM_read_bio_RSAPublicKey(bi, NULL, NULL, NULL);
+			r = PEM_read_bio_RSAPublicKey(bi, nullptr, nullptr, nullptr);
 			BIO_free(bi);
 			if(r) {
 				if(pub) {
@@ -545,7 +545,7 @@ public:
 			BN_free(bign);
 			return false;
 		}
-		RSA_generate_key_ex(r, bits, bign, NULL);
+		RSA_generate_key_ex(r, bits, bign, nullptr);
 		separate(r, &pub, &sec);
 		RSA_free(r);
 		BN_free(bign);
@@ -568,7 +568,7 @@ public:
 	bool toDER(TQByteArray *out, bool publicOnly)
 	{
 		if(sec && !publicOnly) {
-			int len = i2d_RSAPrivateKey(sec, NULL);
+			int len = i2d_RSAPrivateKey(sec, nullptr);
 			TQByteArray buf(len);
 			unsigned char *p;
 			p = (unsigned char *)buf.data();
@@ -577,7 +577,7 @@ public:
 			return true;
 		}
 		else if(pub) {
-			int len = i2d_RSAPublicKey(pub, NULL);
+			int len = i2d_RSAPublicKey(pub, nullptr);
 			TQByteArray buf(len);
 			unsigned char *p;
 			p = (unsigned char *)buf.data();
@@ -593,7 +593,7 @@ public:
 	{
 		if(sec && !publicOnly) {
 			BIO *bo = BIO_new(BIO_s_mem());
-			PEM_write_bio_RSAPrivateKey(bo, sec, NULL, NULL, 0, NULL, NULL);
+			PEM_write_bio_RSAPrivateKey(bo, sec, nullptr, nullptr, 0, nullptr, nullptr);
 			*out = bio2buf(bo);
 			return true;
 		}
@@ -831,7 +831,7 @@ public:
 	bool createFromDER(const char *in, unsigned int len)
 	{
 		const unsigned char *p = (const unsigned char *)in;
-		X509 *t = d2i_X509(NULL, &p, len);
+		X509 *t = d2i_X509(nullptr, &p, len);
 		if(!t)
 			return false;
 		fromX509(t);
@@ -843,7 +843,7 @@ public:
 	{
 		BIO *bi = BIO_new(BIO_s_mem());
 		BIO_write(bi, in, len);
-		X509 *t = PEM_read_bio_X509(bi, NULL, NULL, NULL);
+		X509 *t = PEM_read_bio_X509(bi, nullptr, nullptr, nullptr);
 		BIO_free(bi);
 		if(!t)
 			return false;
@@ -854,7 +854,7 @@ public:
 
 	bool toDER(TQByteArray *out)
 	{
-		int len = i2d_X509(x, NULL);
+		int len = i2d_X509(x, nullptr);
 		TQByteArray buf(len);
 		unsigned char *p = (unsigned char *)buf.data();
 		i2d_X509(x, &p);
@@ -878,14 +878,14 @@ public:
 		// serial number
 		ASN1_INTEGER *ai = X509_get_serialNumber(x);
 		if(ai) {
-			char *rep = i2s_ASN1_INTEGER(NULL, ai);
+			char *rep = i2s_ASN1_INTEGER(nullptr, ai);
 			serial = rep;
 			OPENSSL_free(rep);
 		}
 
 		// validity dates
-		nb = ASN1_UTCTIME_TQDateTime(X509_get_notBefore(x), NULL);
-		na = ASN1_UTCTIME_TQDateTime(X509_get_notAfter(x), NULL);
+		nb = ASN1_UTCTIME_TQDateTime(X509_get_notBefore(x), nullptr);
+		na = ASN1_UTCTIME_TQDateTime(X509_get_notAfter(x), nullptr);
 
 		// extract the subject/issuer strings
 		struct X509_name_st *sn = X509_get_subject_name(x);
-- 
cgit v1.2.3

