Hi all,
(adding Daniel in CC.)

Compiling Postgres up to 13 with OpenSSL 3.0 leads to a couple of
compilation warnings with what OpenSSL considers as deprecated, like:
sha2_openssl.c: In function pg_sha384_init
sha2_openssl.c:70:9: warning: SHA384_Init is deprecated =
Since OpenSSL 3.0 [-Wdeprecated-declarations]
   70 |         SHA384_Init((SHA512_CTX *) ctx);
      |         ^~~~~~~~~~~
/usr/include/openssl/sha.h:119:27: note: declared here
  119 | OSSL_DEPRECATEDIN_3_0 int SHA384_Init(SHA512_CTX *c);

I was looking at the code of OpenSSL to see if there would be a way to
silenced these, and found about OPENSSL_SUPPRESS_DEPRECATED.

I have been annoyed by these in the past when doing backpatches, as
this creates some noise, and the only place where this counts is
sha2_openssl.c.  Thoughts about doing something like the attached for
~13?
--
Michael
diff --git a/src/common/sha2_openssl.c b/src/common/sha2_openssl.c
index 41673b3a88..75f95a9e1f 100644
--- a/src/common/sha2_openssl.c
+++ b/src/common/sha2_openssl.c
@@ -20,6 +20,12 @@
 #include "postgres_fe.h"
 #endif
 
+/*
+ * Suppress deprecation warnings for low-level SHA implementations not
+ * yet removed from OpenSSL.
+ */
+#define OPENSSL_SUPPRESS_DEPRECATED 1
+
 #include <openssl/sha.h>
 
 #include "common/sha2.h"

Attachment: signature.asc
Description: PGP signature

Reply via email to