Module Name:    src
Committed By:   joerg
Date:           Tue Nov  2 15:35:38 UTC 2010

Modified Files:
        src/external/public-domain/xz/dist/src/liblzma/check: check.h

Log Message:
Use libc version of SHA256 on NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
    src/external/public-domain/xz/dist/src/liblzma/check/check.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/public-domain/xz/dist/src/liblzma/check/check.h
diff -u src/external/public-domain/xz/dist/src/liblzma/check/check.h:1.1.1.1 src/external/public-domain/xz/dist/src/liblzma/check/check.h:1.2
--- src/external/public-domain/xz/dist/src/liblzma/check/check.h:1.1.1.1	Tue Nov  2 15:20:52 2010
+++ src/external/public-domain/xz/dist/src/liblzma/check/check.h	Tue Nov  2 15:35:38 2010
@@ -15,6 +15,9 @@
 
 #include "common.h"
 
+#ifdef NETBSD_NATIVE_SHA256
+#include <sha2.h>
+#endif
 
 // Index hashing needs the best possible hash function (preferably
 // a cryptographic hash) for maximum reliability.
@@ -43,7 +46,9 @@
 	union {
 		uint32_t crc32;
 		uint64_t crc64;
-
+#ifdef NETBSD_NATIVE_SHA256
+		SHA256_CTX sha256;
+#else
 		struct {
 			/// Internal state
 			uint32_t state[8];
@@ -51,6 +56,7 @@
 			/// Size of the message excluding padding
 			uint64_t size;
 		} sha256;
+#endif
 	} state;
 
 } lzma_check_state;
@@ -81,7 +87,14 @@
 /// Finish the check calculation and store the result to check->buffer.u8.
 extern void lzma_check_finish(lzma_check_state *check, lzma_check type);
 
-
+#ifdef NETBSD_NATIVE_SHA256
+#define lzma_sha256_init(check)	\
+	SHA256_Init(&(check)->state.sha256)
+#define lzma_sha256_update(buf,size,check) \
+	SHA256_Update(&(check)->state.sha256, buf, size)
+#define lzma_sha256_finish(check) \
+	SHA256_Final((check)->buffer.u8, &(check)->state.sha256)
+#else
 /// Prepare SHA-256 state for new input.
 extern void lzma_sha256_init(lzma_check_state *check);
 
@@ -91,5 +104,6 @@
 
 /// Finish the SHA-256 calculation and store the result to check->buffer.u8.
 extern void lzma_sha256_finish(lzma_check_state *check);
+#endif
 
 #endif

Reply via email to