summaryrefslogtreecommitdiff
path: root/contrib/pgcrypto/sha2.h
diff options
context:
space:
mode:
authorNeil Conway2006-07-13 04:15:25 +0000
committerNeil Conway2006-07-13 04:15:25 +0000
commit1abf76e82cbb5c09f5517d155ea404727f67a507 (patch)
tree8d286cfb4963dc8e13bbb322569e36d8a008e797 /contrib/pgcrypto/sha2.h
parent99ac1e69ba750c40cc83e344a1eb65aaa325a296 (diff)
"Annual" pgcrypto update from Marko Kreen:
Few cleanups and couple of new things: - add SHA2 algorithm to older OpenSSL - add BIGNUM math to have public-key cryptography work on non-OpenSSL build. - gen_random_bytes() function The status of SHA2 algoritms and public-key encryption can now be changed to 'always available.' That makes pgcrypto functionally complete and unless there will be new editions of AES, SHA2 or OpenPGP standards, there is no major changes planned.
Diffstat (limited to 'contrib/pgcrypto/sha2.h')
-rw-r--r--contrib/pgcrypto/sha2.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/contrib/pgcrypto/sha2.h b/contrib/pgcrypto/sha2.h
index 95f8a2400d7..f6fde39c5b4 100644
--- a/contrib/pgcrypto/sha2.h
+++ b/contrib/pgcrypto/sha2.h
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/contrib/pgcrypto/sha2.h,v 1.3 2006/05/30 12:56:45 momjian Exp $ */
+/* $PostgreSQL: pgsql/contrib/pgcrypto/sha2.h,v 1.4 2006/07/13 04:15:25 neilc Exp $ */
/* $OpenBSD: sha2.h,v 1.2 2004/04/28 23:11:57 millert Exp $ */
/*
@@ -49,7 +49,10 @@
#define SHA512_Update pg_SHA512_Update
#define SHA512_Final pg_SHA512_Final
-/*** SHA-256/384/512 Various Length Definitions ***********************/
+/*** SHA-224/256/384/512 Various Length Definitions ***********************/
+#define SHA224_BLOCK_LENGTH 64
+#define SHA224_DIGEST_LENGTH 28
+#define SHA224_DIGEST_STRING_LENGTH (SHA224_DIGEST_LENGTH * 2 + 1)
#define SHA256_BLOCK_LENGTH 64
#define SHA256_DIGEST_LENGTH 32
#define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1)
@@ -75,8 +78,13 @@ typedef struct _SHA512_CTX
uint8 buffer[SHA512_BLOCK_LENGTH];
} SHA512_CTX;
+typedef SHA256_CTX SHA224_CTX;
typedef SHA512_CTX SHA384_CTX;
+void SHA224_Init(SHA224_CTX *);
+void SHA224_Update(SHA224_CTX *, const uint8 *, size_t);
+void SHA224_Final(uint8[SHA224_DIGEST_LENGTH], SHA224_CTX *);
+
void SHA256_Init(SHA256_CTX *);
void SHA256_Update(SHA256_CTX *, const uint8 *, size_t);
void SHA256_Final(uint8[SHA256_DIGEST_LENGTH], SHA256_CTX *);