]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix warnings found by clang in CI
authorNeil Horman <nhorman@openssl.org>
Sat, 6 Apr 2024 14:16:50 +0000 (10:16 -0400)
committerNeil Horman <nhorman@openssl.org>
Fri, 12 Apr 2024 12:02:19 +0000 (08:02 -0400)
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/24047)

demos/cipher/aesccm.c
demos/cipher/aesgcm.c
demos/cipher/aeskeywrap.c
demos/cipher/ariacbc.c
demos/digest/EVP_MD_demo.c
demos/digest/EVP_MD_xof.c
demos/guide/quic-client-non-block.c
demos/guide/tls-client-non-block.c
demos/pkey/EVP_PKEY_DSA_paramvalidate.c

index 49a054f9d3fb5dacf29a19b950254d891c4b30b9..e8fdbee7c819841a5998f60990752049c8c6da43 100644 (file)
@@ -64,8 +64,8 @@ static const unsigned char ccm_tag[] = {
  * algorithm implementations. If they are NULL then the default library
  * context and properties are used.
  */
-OSSL_LIB_CTX *libctx = NULL;
-const char *propq = NULL;
+static OSSL_LIB_CTX *libctx = NULL;
+static const char *propq = NULL;
 
 
 static int aes_ccm_encrypt(void)
index 40465b269c128b2bd7d079ede17dd9b87a58320c..f5011b81369d4df5e689f113ca84d2d1eeb03121 100644 (file)
@@ -64,8 +64,8 @@ static const unsigned char gcm_tag[] = {
  * algorithm implementations. If they are NULL then the default library
  * context and properties are used.
  */
-OSSL_LIB_CTX *libctx = NULL;
-const char *propq = NULL;
+static OSSL_LIB_CTX *libctx = NULL;
+static const char *propq = NULL;
 
 static int aes_gcm_encrypt(void)
 {
index 4d5df4cd981f3d52bcade2815f68c88df826dd51..e1fe9307b452ac7e22b6bfb5b121bf7b9682f5c1 100644 (file)
@@ -50,8 +50,8 @@ static const unsigned char wrap_ct[] = {
  * algorithm implementations. If they are NULL then the default library
  * context and properties are used.
  */
-OSSL_LIB_CTX *libctx = NULL;
-const char *propq = NULL;
+static OSSL_LIB_CTX *libctx = NULL;
+static const char *propq = NULL;
 
 static int aes_wrap_encrypt(void)
 {
index 73605d2d6c09418318681f184f62e7d189647cad..4492c464665267a64130678e78752a616cacd880 100644 (file)
@@ -49,8 +49,8 @@ static const unsigned char cbc_ct[] = {
  * algorithm implementations. If they are NULL then the default library
  * context and properties are used.
  */
-OSSL_LIB_CTX *libctx = NULL;
-const char *propq = NULL;
+static OSSL_LIB_CTX *libctx = NULL;
+static const char *propq = NULL;
 
 static int aria_cbc_encrypt(void)
 {
index 3a1f0c7ba0bd7191b7db68e63d5d01f250cdd95a..64d0ec4ef8c51d1618f4def13f61fb15a4887215 100644 (file)
@@ -24,7 +24,7 @@
  * more than once.
  */
 
-const char *hamlet_1 =
+static const char *hamlet_1 =
     "To be, or not to be, that is the question,\n"
     "Whether tis nobler in the minde to suffer\n"
     "The ſlings and arrowes of outragious fortune,\n"
@@ -43,7 +43,7 @@ const char *hamlet_1 =
     "The oppressor's wrong, the proud man's Contumely,\n"
     "The pangs of dispised love, the Law's delay,\n"
 ;
-const char *hamlet_2 =
+static const char *hamlet_2 =
     "The insolence of Office, and the spurns\n"
     "That patient merit of the'unworthy takes,\n"
     "When he himself might his Quietas make\n"
@@ -65,7 +65,7 @@ const char *hamlet_2 =
 ;
 
 /* The known value of the SHA3-512 digest of the above soliloqy */
-const unsigned char known_answer[] = {
+static const unsigned char known_answer[] = {
     0xbb, 0x69, 0xf8, 0x09, 0x9c, 0x2e, 0x00, 0x3d,
     0xa4, 0x29, 0x5f, 0x59, 0x4b, 0x89, 0xe4, 0xd9,
     0xdb, 0xa2, 0xe5, 0xaf, 0xa5, 0x87, 0x73, 0x9d,
index 9635e4539fc52aa4cce476f2ad9f4c0d8fd14524..6fe8afd65f6660d04455eb0086f8f71b28b73b47 100644 (file)
@@ -27,7 +27,7 @@
  */
 
 /* Our input to the XOF hash function. */
-const char message[] = "This is a test message.";
+static const char message[] = "This is a test message.";
 
 /* Expected output when an output length of 20 bytes is used. */
 static const unsigned char known_answer[] = {
index a6c1802fcd68abe3b58d5f345f73264a6aec6bb4..bf79b7fef1a1f415740e7eba782e4e18ae5ae5fc 100644 (file)
@@ -231,7 +231,7 @@ int main(int argc, char *argv[])
     unsigned char alpn[] = { 8, 'h', 't', 't', 'p', '/', '1', '.', '0' };
     const char *request_start = "GET / HTTP/1.0\r\nConnection: close\r\nHost: ";
     const char *request_end = "\r\n\r\n";
-    size_t written, readbytes;
+    size_t written, readbytes = 0;
     char buf[160];
     BIO_ADDR *peer_addr = NULL;
     int eof = 0;
index 0b19d67762674e192fee28a6621b9b37233620cf..05f1a11eb7fc73554cadf5b6f9ae5dec00a51e16 100644 (file)
@@ -183,7 +183,7 @@ int main(int argc, char *argv[])
     int ret;
     const char *request_start = "GET / HTTP/1.0\r\nConnection: close\r\nHost: ";
     const char *request_end = "\r\n\r\n";
-    size_t written, readbytes;
+    size_t written, readbytes = 0;
     char buf[160];
     int eof = 0;
     char *hostname, *port;
index a56c1478692c12d6a4bb666acc6238d5dc73d45a..c909045f2a99d1b01661771641008f71778535ac 100644 (file)
@@ -47,8 +47,8 @@ static const char hexseed[] =
     "cba30ccd905aa7675a0b81769704bf3c"
     "ccf2ca1892b2eaf6b9e2b38d9bf6affc"
     "42ada55986d8a1772b442770954d0b65";
-const int gindex = 42;
-const int pcounter = 363;
+static const int gindex = 42;
+static const int pcounter = 363;
 static const char digest[] = "SHA384";
 
 /*