Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/public-domain/xz/dist/src/liblzma/check Use libc ve...



details:   https://anonhg.NetBSD.org/src/rev/6dc90a7b3df7
branches:  trunk
changeset: 758328:6dc90a7b3df7
user:      joerg <joerg%NetBSD.org@localhost>
date:      Tue Nov 02 15:35:38 2010 +0000

description:
Use libc version of SHA256 on NetBSD.

diffstat:

 external/public-domain/xz/dist/src/liblzma/check/check.h |  18 ++++++++++++++-
 1 files changed, 16 insertions(+), 2 deletions(-)

diffs (55 lines):

diff -r 42160eb4f876 -r 6dc90a7b3df7 external/public-domain/xz/dist/src/liblzma/check/check.h
--- a/external/public-domain/xz/dist/src/liblzma/check/check.h  Tue Nov 02 15:20:20 2010 +0000
+++ b/external/public-domain/xz/dist/src/liblzma/check/check.h  Tue Nov 02 15:35:38 2010 +0000
@@ -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



Home | Main Index | Thread Index | Old Index