]> granicus.if.org Git - postgresql/commitdiff
Re-defines SHA2 symbols so that they would not conflict with certain
authorBruce Momjian <bruce@momjian.us>
Tue, 30 May 2006 12:56:45 +0000 (12:56 +0000)
committerBruce Momjian <bruce@momjian.us>
Tue, 30 May 2006 12:56:45 +0000 (12:56 +0000)
versions of OpenSSL.  If your OpenSSL does not contain SHA2, then there
should be no conflict.  But ofcourse, if someone upgrades OpenSSL,
server starts crashing.

Backpatched to 8.1.X.

Marko Kreen

contrib/pgcrypto/sha2.c
contrib/pgcrypto/sha2.h

index 46f44679bd53f17ef88271bcbfd1af44656a4d22..19febaa1199c21b2465aed87780962c9ab915545 100644 (file)
@@ -33,7 +33,7 @@
  *
  * $From: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $
  *
- * $PostgreSQL: pgsql/contrib/pgcrypto/sha2.c,v 1.5 2005/10/15 02:49:06 momjian Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/sha2.c,v 1.6 2006/05/30 12:56:45 momjian Exp $
  */
 
 #include "postgres.h"
  * library -- they are intended for private internal visibility/use
  * only.
  */
-void           SHA512_Last(SHA512_CTX *);
-void           SHA256_Transform(SHA256_CTX *, const uint8 *);
-void           SHA512_Transform(SHA512_CTX *, const uint8 *);
+static void SHA512_Last(SHA512_CTX *);
+static void SHA256_Transform(SHA256_CTX *, const uint8 *);
+static void SHA512_Transform(SHA512_CTX *, const uint8 *);
 
 
 /*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/
@@ -307,7 +307,7 @@ SHA256_Init(SHA256_CTX * context)
        j++;                                                                    \
 } while(0)
 
-void
+static void
 SHA256_Transform(SHA256_CTX * context, const uint8 *data)
 {
        uint32          a,
@@ -378,7 +378,7 @@ SHA256_Transform(SHA256_CTX * context, const uint8 *data)
 }
 #else                                                  /* SHA2_UNROLL_TRANSFORM */
 
-void
+static void
 SHA256_Transform(SHA256_CTX * context, const uint8 *data)
 {
        uint32          a,
@@ -631,7 +631,7 @@ SHA512_Init(SHA512_CTX * context)
        j++;                                                                    \
 } while(0)
 
-void
+static void
 SHA512_Transform(SHA512_CTX * context, const uint8 *data)
 {
        uint64          a,
@@ -699,7 +699,7 @@ SHA512_Transform(SHA512_CTX * context, const uint8 *data)
 }
 #else                                                  /* SHA2_UNROLL_TRANSFORM */
 
-void
+static void
 SHA512_Transform(SHA512_CTX * context, const uint8 *data)
 {
        uint64          a,
@@ -842,7 +842,7 @@ SHA512_Update(SHA512_CTX * context, const uint8 *data, size_t len)
        usedspace = freespace = 0;
 }
 
-void
+static void
 SHA512_Last(SHA512_CTX * context)
 {
        unsigned int usedspace;
index 824bcefd29b3860047d60bfc743ccccabd5533bf..95f8a2400d7545124513bbd87159103835937db4 100644 (file)
@@ -1,4 +1,4 @@
-/*     $PostgreSQL: pgsql/contrib/pgcrypto/sha2.h,v 1.2 2005/10/15 02:49:06 momjian Exp $ */
+/*     $PostgreSQL: pgsql/contrib/pgcrypto/sha2.h,v 1.3 2006/05/30 12:56:45 momjian Exp $ */
 /*     $OpenBSD: sha2.h,v 1.2 2004/04/28 23:11:57 millert Exp $        */
 
 /*
 #ifndef _SHA2_H
 #define _SHA2_H
 
+/* avoid conflict with OpenSSL */
+#define SHA256_Init pg_SHA256_Init
+#define SHA256_Update pg_SHA256_Update
+#define SHA256_Final pg_SHA256_Final
+#define SHA384_Init pg_SHA384_Init
+#define SHA384_Update pg_SHA384_Update
+#define SHA384_Final pg_SHA384_Final
+#define SHA512_Init pg_SHA512_Init
+#define SHA512_Update pg_SHA512_Update
+#define SHA512_Final pg_SHA512_Final
 
 /*** SHA-256/384/512 Various Length Definitions ***********************/
 #define SHA256_BLOCK_LENGTH            64