When OpenSSL 1.0.2 is built on Linux with "no-psk" config option, the 
following warnings are emitted by the compiler:

ssl_asn1.c: In function ‘i2d_SSL_SESSION’:
ssl_asn1.c:124:57: warning: unused variable ‘v8’ [-Wunused-variable]
      int v1 = 0, v2 = 0, v3 = 0, v4 = 0, v5 = 0, v7 = 0, v8 = 0;
                                                          ^
ssl_asn1.c:124:49: warning: unused variable ‘v7’ [-Wunused-variable]
      int v1 = 0, v2 = 0, v3 = 0, v4 = 0, v5 = 0, v7 = 0, v8 = 0;
                                                  ^
This is because variables v7 and v8 are defined unconditionally, 
regardless whether OPENSSL_NO_PSK is defined or not.
Similar to existing constructs with OPENSSL_NO_TLSEXT, OPENSSL_NO_COMP
and OPENSSL_NO_SRP, also OPENSSL_NO_PSK needs the following:

+#ifndef OPENSSL_NO_PSK
+    int v7 = 0, v8 = 0;
+#endif

See the attached patch.

Tested by building with and without "no-psk". Builds are clean
and successful.

Kind regards,
Ivo Raisr

--- ssl/ssl_asn1.c.orig	2015-09-10 22:49:28.670825241 +0200
+++ ssl/ssl_asn1.c	2015-09-10 22:53:14.715705520 +0200
@@ -121,13 +121,16 @@
 int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp)
 {
 #define LSIZE2 (sizeof(long)*2)
-    int v1 = 0, v2 = 0, v3 = 0, v4 = 0, v5 = 0, v7 = 0, v8 = 0;
+    int v1 = 0, v2 = 0, v3 = 0, v4 = 0, v5 = 0;
     unsigned char buf[4], ibuf1[LSIZE2], ibuf2[LSIZE2];
     unsigned char ibuf3[LSIZE2], ibuf4[LSIZE2], ibuf5[LSIZE2];
 #ifndef OPENSSL_NO_TLSEXT
     int v6 = 0, v9 = 0, v10 = 0;
     unsigned char ibuf6[LSIZE2];
 #endif
+#ifndef OPENSSL_NO_PSK
+    int v7 = 0, v8 = 0;
+#endif
 #ifndef OPENSSL_NO_COMP
     unsigned char cbuf;
     int v11 = 0;
_______________________________________________
openssl-bugs-mod mailing list
[email protected]
https://mta.openssl.org/mailman/listinfo/openssl-bugs-mod
_______________________________________________
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev

Reply via email to