Index: head/lib/libmd/md4.h =================================================================== --- head/lib/libmd/md4.h (revision 307520) +++ head/lib/libmd/md4.h (revision 307521) @@ -1,76 +1,84 @@ /* MD4.H - header file for MD4C.C * $FreeBSD$ */ /* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD4 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD4 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ #ifndef _MD4_H_ #define _MD4_H_ /* MD4 context. */ typedef struct MD4Context { u_int32_t state[4]; /* state (ABCD) */ u_int32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ unsigned char buffer[64]; /* input buffer */ } MD4_CTX; #include __BEGIN_DECLS /* Ensure libmd symbols do not clash with libcrypto */ #ifndef MD4Init #define MD4Init _libmd_MD4Init #endif #ifndef MD4Update #define MD4Update _libmd_MD4Update #endif #ifndef MD4Pad #define MD4Pad _libmd_MD4Pad #endif #ifndef MD4Final #define MD4Final _libmd_MD4Final #endif #ifndef MD4End #define MD4End _libmd_MD4End #endif +#ifndef MD4Fd +#define MD4Fd _libmd_MD4Fd +#endif +#ifndef MD4FdChunk +#define MD4FdChunk _libmd_MD4FdChunk +#endif #ifndef MD4File #define MD4File _libmd_MD4File #endif #ifndef MD4FileChunk #define MD4FileChunk _libmd_MD4FileChunk #endif #ifndef MD4Data #define MD4Data _libmd_MD4Data #endif void MD4Init(MD4_CTX *); void MD4Update(MD4_CTX *, const void *, unsigned int); void MD4Pad(MD4_CTX *); void MD4Final(unsigned char [16], MD4_CTX *); char * MD4End(MD4_CTX *, char *); +char * MD4Fd(int, char *); +char * MD4FdChunk(int, char *, off_t, off_t); char * MD4File(const char *, char *); char * MD4FileChunk(const char *, char *, off_t, off_t); char * MD4Data(const void *, unsigned int, char *); __END_DECLS #endif /* _MD4_H_ */ Index: head/lib/libmd/md5.h =================================================================== --- head/lib/libmd/md5.h (revision 307520) +++ head/lib/libmd/md5.h (revision 307521) @@ -1,49 +1,55 @@ /* $FreeBSD$ */ #ifndef _MD5_H_ #define _MD5_H_ #ifndef _KERNEL /* Ensure libmd symbols do not clash with libcrypto */ #ifndef MD5Init #define MD5Init _libmd_MD5Init #endif #ifndef MD5Update #define MD5Update _libmd_MD5Update #endif #ifndef MD5Pad #define MD5Pad _libmd_MD5Pad #endif #ifndef MD5Final #define MD5Final _libmd_MD5Final #endif #ifndef MD5Transform #define MD5Transform _libmd_MD5Transform #endif #ifndef MD5End #define MD5End _libmd_MD5End #endif +#ifndef MD5Fd +#define MD5Fd _libmd_MD5Fd +#endif +#ifndef MD5FdChunk +#define MD5FdChunk _libmd_MD5FdChunk +#endif #ifndef MD5File #define MD5File _libmd_MD5File #endif #ifndef MD5FileChunk #define MD5FileChunk _libmd_MD5FileChunk #endif #ifndef MD5Data #define MD5Data _libmd_MD5Data #endif #endif #ifdef __cplusplus #define static #endif #include #ifdef __cplusplus #undef static #endif #endif /* _MD5_H_ */ Index: head/lib/libmd/mdXhl.c =================================================================== --- head/lib/libmd/mdXhl.c (revision 307520) +++ head/lib/libmd/mdXhl.c (revision 307521) @@ -1,120 +1,136 @@ /* mdXhl.c * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): * wrote this file. As long as you retain this notice you * can do whatever you want with this stuff. If we meet some day, and you think * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include "mdX.h" char * MDXEnd(MDX_CTX *ctx, char *buf) { int i; unsigned char digest[LENGTH]; static const char hex[]="0123456789abcdef"; if (!buf) buf = malloc(2*LENGTH + 1); if (!buf) return 0; MDXFinal(digest, ctx); for (i = 0; i < LENGTH; i++) { buf[i+i] = hex[digest[i] >> 4]; buf[i+i+1] = hex[digest[i] & 0x0f]; } buf[i+i] = '\0'; return buf; } char * -MDXFile(const char *filename, char *buf) +MDXFd(int fd, char *buf) { - return (MDXFileChunk(filename, buf, 0, 0)); + return MDXFdChunk(fd, buf, 0, 0); } char * -MDXFileChunk(const char *filename, char *buf, off_t ofs, off_t len) +MDXFdChunk(int fd, char *buf, off_t ofs, off_t len) { unsigned char buffer[16*1024]; MDX_CTX ctx; struct stat stbuf; - int fd, readrv, e; + int readrv, e; off_t remain; if (len < 0) { errno = EINVAL; return NULL; } MDXInit(&ctx); - fd = open(filename, O_RDONLY); - if (fd < 0) - return NULL; if (ofs != 0) { errno = 0; if (lseek(fd, ofs, SEEK_SET) != ofs || (ofs == -1 && errno != 0)) { readrv = -1; goto error; } } remain = len; readrv = 0; while (len == 0 || remain > 0) { if (len == 0 || remain > sizeof(buffer)) readrv = read(fd, buffer, sizeof(buffer)); else readrv = read(fd, buffer, remain); if (readrv <= 0) break; MDXUpdate(&ctx, buffer, readrv); remain -= readrv; } error: - e = errno; - close(fd); - errno = e; if (readrv < 0) return NULL; return (MDXEnd(&ctx, buf)); +} + +char * +MDXFile(const char *filename, char *buf) +{ + return (MDXFileChunk(filename, buf, 0, 0)); +} + +char * +MDXFileChunk(const char *filename, char *buf, off_t ofs, off_t len) +{ + char *ret; + int e, fd; + + fd = open(filename, O_RDONLY); + if (fd < 0) + return NULL; + ret = MDXFdChunk(fd, buf, ofs, len); + e = errno; + close (fd); + errno = e; + return ret; } char * MDXData (const void *data, unsigned int len, char *buf) { MDX_CTX ctx; MDXInit(&ctx); MDXUpdate(&ctx,data,len); return (MDXEnd(&ctx, buf)); } #ifdef WEAK_REFS /* When building libmd, provide weak references. Note: this is not activated in the context of compiling these sources for internal use in libcrypt. */ #undef MDXEnd __weak_reference(_libmd_MDXEnd, MDXEnd); #undef MDXFile __weak_reference(_libmd_MDXFile, MDXFile); #undef MDXFileChunk __weak_reference(_libmd_MDXFileChunk, MDXFileChunk); #undef MDXData __weak_reference(_libmd_MDXData, MDXData); #endif Index: head/lib/libmd/ripemd.h =================================================================== --- head/lib/libmd/ripemd.h (revision 307520) +++ head/lib/libmd/ripemd.h (revision 307521) @@ -1,129 +1,137 @@ /* crypto/ripemd/ripemd.h */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] */ /* * $FreeBSD$ */ #ifndef HEADER_RIPEMD_H #define HEADER_RIPEMD_H #include #include /* XXX switch to machine/ansi.h and __ types */ #define RIPEMD160_CBLOCK 64 #define RIPEMD160_LBLOCK 16 #define RIPEMD160_BLOCK 16 #define RIPEMD160_LAST_BLOCK 56 #define RIPEMD160_LENGTH_BLOCK 8 #define RIPEMD160_DIGEST_LENGTH 20 typedef struct RIPEMD160state_st { u_int32_t A,B,C,D,E; u_int32_t Nl,Nh; u_int32_t data[RIPEMD160_LBLOCK]; int num; } RIPEMD160_CTX; __BEGIN_DECLS /* Ensure libmd symbols do not clash with libcrypto */ #ifndef RIPEMD160_Init #define RIPEMD160_Init _libmd_RIPEMD160_Init #endif #ifndef RIPEMD160_Update #define RIPEMD160_Update _libmd_RIPEMD160_Update #endif #ifndef RIPEMD160_Final #define RIPEMD160_Final _libmd_RIPEMD160_Final #endif #ifndef RIPEMD160_End #define RIPEMD160_End _libmd_RIPEMD160_End #endif +#ifndef RIPEMD160_Fd +#define RIPEMD160_Fd _libmd_RIPEMD160_Fd +#endif +#ifndef RIPEMD160_FdChunk +#define RIPEMD160_FdChunk _libmd_RIPEMD160_FdChunk +#endif #ifndef RIPEMD160_File #define RIPEMD160_File _libmd_RIPEMD160_File #endif #ifndef RIPEMD160_FileChunk #define RIPEMD160_FileChunk _libmd_RIPEMD160_FileChunk #endif #ifndef RIPEMD160_Data #define RIPEMD160_Data _libmd_RIPEMD160_Data #endif #ifndef RIPEMD160_Transform #define RIPEMD160_Transform _libmd_RIPEMD160_Transform #endif #ifndef RMD160_version #define RMD160_version _libmd_RMD160_version #endif #ifndef ripemd160_block #define ripemd160_block _libmd_ripemd160_block #endif void RIPEMD160_Init(RIPEMD160_CTX *c); void RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len); void RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c); char *RIPEMD160_End(RIPEMD160_CTX *, char *); +char *RIPEMD160_Fd(int, char *); +char *RIPEMD160_FdChunk(int, char *, off_t, off_t); char *RIPEMD160_File(const char *, char *); char *RIPEMD160_FileChunk(const char *, char *, off_t, off_t); char *RIPEMD160_Data(const void *, unsigned int, char *); __END_DECLS #endif Index: head/lib/libmd/sha.h =================================================================== --- head/lib/libmd/sha.h (revision 307520) +++ head/lib/libmd/sha.h (revision 307521) @@ -1,166 +1,182 @@ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * * This package is an SSL implementation written * by Eric Young (eay@cryptsoft.com). * The implementation was written so as to conform with Netscapes SSL. * * This library is free for commercial and non-commercial use as long as * the following conditions are aheared to. The following conditions * apply to all code found in this distribution, be it the RC4, RSA, * lhash, DES, etc., code; not just the SSL code. The SSL documentation * included with this distribution is covered by the same copyright terms * except that the holder is Tim Hudson (tjh@cryptsoft.com). * * Copyright remains Eric Young's, and as such any Copyright notices in * the code are not to be removed. * If this package is used in a product, Eric Young should be given attribution * as the author of the parts of the library used. * This can be in the form of a textual message at program startup or * in documentation (online or textual) provided with the package. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * "This product includes cryptographic software written by * Eric Young (eay@cryptsoft.com)" * The word 'cryptographic' can be left out if the rouines from the library * being used are not cryptographic related :-). * 4. If you include any Windows specific code (or a derivative thereof) from * the apps directory (application code) you must include an acknowledgement: * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" * * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * The licence and distribution terms for any publically available version or * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] * * $FreeBSD$ */ #ifndef _SHA_H_ #define _SHA_H_ 1 #include #include /* XXX switch to machine/ansi.h and __ types */ #define SHA_CBLOCK 64 #define SHA_LBLOCK 16 #define SHA_BLOCK 16 #define SHA_LAST_BLOCK 56 #define SHA_LENGTH_BLOCK 8 #define SHA_DIGEST_LENGTH 20 typedef struct SHAstate_st { u_int32_t h0, h1, h2, h3, h4; u_int32_t Nl, Nh; u_int32_t data[SHA_LBLOCK]; int num; } SHA_CTX; #define SHA1_CTX SHA_CTX __BEGIN_DECLS /* Ensure libmd symbols do not clash with libcrypto */ #ifndef SHA_Init #define SHA_Init _libmd_SHA_Init #endif #ifndef SHA_Update #define SHA_Update _libmd_SHA_Update #endif #ifndef SHA_Final #define SHA_Final _libmd_SHA_Final #endif #ifndef SHA_End #define SHA_End _libmd_SHA_End #endif +#ifndef SHA_Fd +#define SHA_Fd _libmd_SHA_Fd +#endif +#ifndef SHA_FdChunk +#define SHA_FdChunk _libmd_SHA_FdChunk +#endif #ifndef SHA_File #define SHA_File _libmd_SHA_File #endif #ifndef SHA_FileChunk #define SHA_FileChunk _libmd_SHA_FileChunk #endif #ifndef SHA_Data #define SHA_Data _libmd_SHA_Data #endif #ifndef SHA_Transform #define SHA_Transform _libmd_SHA_Transform #endif #ifndef SHA_version #define SHA_version _libmd_SHA_version #endif #ifndef sha_block #define sha_block _libmd_sha_block #endif #ifndef SHA1_Init #define SHA1_Init _libmd_SHA1_Init #endif #ifndef SHA1_Update #define SHA1_Update _libmd_SHA1_Update #endif #ifndef SHA1_Final #define SHA1_Final _libmd_SHA1_Final #endif #ifndef SHA1_End #define SHA1_End _libmd_SHA1_End #endif +#ifndef SHA1_Fd +#define SHA1_Fd _libmd_SHA1_Fd +#endif +#ifndef SHA1_FdChunk +#define SHA1_FdChunk _libmd_SHA1_FdChunk +#endif #ifndef SHA1_File #define SHA1_File _libmd_SHA1_File #endif #ifndef SHA1_FileChunk #define SHA1_FileChunk _libmd_SHA1_FileChunk #endif #ifndef SHA1_Data #define SHA1_Data _libmd_SHA1_Data #endif #ifndef SHA1_Transform #define SHA1_Transform _libmd_SHA1_Transform #endif #ifndef SHA1_version #define SHA1_version _libmd_SHA1_version #endif #ifndef sha1_block #define sha1_block _libmd_sha1_block #endif void SHA_Init(SHA_CTX *c); void SHA_Update(SHA_CTX *c, const void *data, size_t len); void SHA_Final(unsigned char *md, SHA_CTX *c); char *SHA_End(SHA_CTX *, char *); +char *SHA_Fd(int, char *); +char *SHA_FdChunk(int, char *, off_t, off_t); char *SHA_File(const char *, char *); char *SHA_FileChunk(const char *, char *, off_t, off_t); char *SHA_Data(const void *, unsigned int, char *); void SHA1_Init(SHA_CTX *c); void SHA1_Update(SHA_CTX *c, const void *data, size_t len); void SHA1_Final(unsigned char *md, SHA_CTX *c); char *SHA1_End(SHA_CTX *, char *); +char *SHA1_Fd(int, char *); +char *SHA1_FdChunk(int, char *, off_t, off_t); char *SHA1_File(const char *, char *); char *SHA1_FileChunk(const char *, char *, off_t, off_t); char *SHA1_Data(const void *, unsigned int, char *); __END_DECLS #endif /* !_SHA_H_ */ Index: head/sys/crypto/sha2/sha256.h =================================================================== --- head/sys/crypto/sha2/sha256.h (revision 307520) +++ head/sys/crypto/sha2/sha256.h (revision 307521) @@ -1,90 +1,98 @@ /*- * Copyright 2005 Colin Percival * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SHA256_H_ #define _SHA256_H_ #ifndef _KERNEL #include #endif #define SHA256_BLOCK_LENGTH 64 #define SHA256_DIGEST_LENGTH 32 #define SHA256_DIGEST_STRING_LENGTH (SHA256_DIGEST_LENGTH * 2 + 1) typedef struct SHA256Context { uint32_t state[8]; uint64_t count; uint8_t buf[SHA256_BLOCK_LENGTH]; } SHA256_CTX; __BEGIN_DECLS /* Ensure libmd symbols do not clash with libcrypto */ #ifndef SHA256_Init #define SHA256_Init _libmd_SHA256_Init #endif #ifndef SHA256_Update #define SHA256_Update _libmd_SHA256_Update #endif #ifndef SHA256_Final #define SHA256_Final _libmd_SHA256_Final #endif #ifndef SHA256_End #define SHA256_End _libmd_SHA256_End #endif +#ifndef SHA256_Fd +#define SHA256_Fd _libmd_SHA256_Fd +#endif +#ifndef SHA256_FdChunk +#define SHA256_FdChunk _libmd_SHA256_FdChunk +#endif #ifndef SHA256_File #define SHA256_File _libmd_SHA256_File #endif #ifndef SHA256_FileChunk #define SHA256_FileChunk _libmd_SHA256_FileChunk #endif #ifndef SHA256_Data #define SHA256_Data _libmd_SHA256_Data #endif #ifndef SHA256_Transform #define SHA256_Transform _libmd_SHA256_Transform #endif #ifndef SHA256_version #define SHA256_version _libmd_SHA256_version #endif void SHA256_Init(SHA256_CTX *); void SHA256_Update(SHA256_CTX *, const void *, size_t); void SHA256_Final(unsigned char [static SHA256_DIGEST_LENGTH], SHA256_CTX *); #ifndef _KERNEL char *SHA256_End(SHA256_CTX *, char *); char *SHA256_Data(const void *, unsigned int, char *); +char *SHA256_Fd(int, char *); +char *SHA256_FdChunk(int, char *, off_t, off_t); char *SHA256_File(const char *, char *); char *SHA256_FileChunk(const char *, char *, off_t, off_t); #endif __END_DECLS #endif /* !_SHA256_H_ */ Index: head/sys/crypto/sha2/sha384.h =================================================================== --- head/sys/crypto/sha2/sha384.h (revision 307520) +++ head/sys/crypto/sha2/sha384.h (revision 307521) @@ -1,87 +1,95 @@ /*- * Copyright 2005 Colin Percival * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SHA384_H_ #define _SHA384_H_ #ifndef _KERNEL #include #endif #define SHA384_BLOCK_LENGTH 128 #define SHA384_DIGEST_LENGTH 48 #define SHA384_DIGEST_STRING_LENGTH (SHA384_DIGEST_LENGTH * 2 + 1) typedef struct SHA384Context { uint64_t state[8]; uint64_t count[2]; uint8_t buf[SHA384_BLOCK_LENGTH]; } SHA384_CTX; __BEGIN_DECLS /* Ensure libmd symbols do not clash with libcrypto */ #ifndef SHA384_Init #define SHA384_Init _libmd_SHA384_Init #endif #ifndef SHA384_Update #define SHA384_Update _libmd_SHA384_Update #endif #ifndef SHA384_Final #define SHA384_Final _libmd_SHA384_Final #endif #ifndef SHA384_End #define SHA384_End _libmd_SHA384_End #endif +#ifndef SHA384_Fd +#define SHA384_Fd _libmd_SHA384_Fd +#endif +#ifndef SHA384_FdChunk +#define SHA384_FdChunk _libmd_SHA384_FdChunk +#endif #ifndef SHA384_File #define SHA384_File _libmd_SHA384_File #endif #ifndef SHA384_FileChunk #define SHA384_FileChunk _libmd_SHA384_FileChunk #endif #ifndef SHA384_Data #define SHA384_Data _libmd_SHA384_Data #endif #ifndef SHA384_version #define SHA384_version _libmd_SHA384_version #endif void SHA384_Init(SHA384_CTX *); void SHA384_Update(SHA384_CTX *, const void *, size_t); void SHA384_Final(unsigned char [static SHA384_DIGEST_LENGTH], SHA384_CTX *); #ifndef _KERNEL char *SHA384_End(SHA384_CTX *, char *); char *SHA384_Data(const void *, unsigned int, char *); +char *SHA384_Fd(int, char *); +char *SHA384_FdChunk(int, char *, off_t, off_t); char *SHA384_File(const char *, char *); char *SHA384_FileChunk(const char *, char *, off_t, off_t); #endif __END_DECLS #endif /* !_SHA384_H_ */ Index: head/sys/crypto/sha2/sha512.h =================================================================== --- head/sys/crypto/sha2/sha512.h (revision 307520) +++ head/sys/crypto/sha2/sha512.h (revision 307521) @@ -1,90 +1,98 @@ /*- * Copyright 2005 Colin Percival * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SHA512_H_ #define _SHA512_H_ #ifndef _KERNEL #include #endif #define SHA512_BLOCK_LENGTH 128 #define SHA512_DIGEST_LENGTH 64 #define SHA512_DIGEST_STRING_LENGTH (SHA512_DIGEST_LENGTH * 2 + 1) typedef struct SHA512Context { uint64_t state[8]; uint64_t count[2]; uint8_t buf[SHA512_BLOCK_LENGTH]; } SHA512_CTX; __BEGIN_DECLS /* Ensure libmd symbols do not clash with libcrypto */ #ifndef SHA512_Init #define SHA512_Init _libmd_SHA512_Init #endif #ifndef SHA512_Update #define SHA512_Update _libmd_SHA512_Update #endif #ifndef SHA512_Final #define SHA512_Final _libmd_SHA512_Final #endif #ifndef SHA512_End #define SHA512_End _libmd_SHA512_End #endif +#ifndef SHA512_Fd +#define SHA512_Fd _libmd_SHA512_Fd +#endif +#ifndef SHA512_FdChunk +#define SHA512_FdChunk _libmd_SHA512_FdChunk +#endif #ifndef SHA512_File #define SHA512_File _libmd_SHA512_File #endif #ifndef SHA512_FileChunk #define SHA512_FileChunk _libmd_SHA512_FileChunk #endif #ifndef SHA512_Data #define SHA512_Data _libmd_SHA512_Data #endif #ifndef SHA512_Transform #define SHA512_Transform _libmd_SHA512_Transform #endif #ifndef SHA512_version #define SHA512_version _libmd_SHA512_version #endif void SHA512_Init(SHA512_CTX *); void SHA512_Update(SHA512_CTX *, const void *, size_t); void SHA512_Final(unsigned char [static SHA512_DIGEST_LENGTH], SHA512_CTX *); #ifndef _KERNEL char *SHA512_End(SHA512_CTX *, char *); char *SHA512_Data(const void *, unsigned int, char *); +char *SHA512_Fd(int, char *); +char *SHA512_FdChunk(int, char *, off_t, off_t); char *SHA512_File(const char *, char *); char *SHA512_FileChunk(const char *, char *, off_t, off_t); #endif __END_DECLS #endif /* !_SHA512_H_ */ Index: head/sys/crypto/sha2/sha512t.h =================================================================== --- head/sys/crypto/sha2/sha512t.h (revision 307520) +++ head/sys/crypto/sha2/sha512t.h (revision 307521) @@ -1,125 +1,141 @@ /*- * Copyright (c) 2015 Allan Jude * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SHA512T_H_ #define _SHA512T_H_ #include "sha512.h" #ifndef _KERNEL #include #endif #define SHA512_224_DIGEST_LENGTH 28 #define SHA512_224_DIGEST_STRING_LENGTH (SHA512_224_DIGEST_LENGTH * 2 + 1) #define SHA512_256_DIGEST_LENGTH 32 #define SHA512_256_DIGEST_STRING_LENGTH (SHA512_256_DIGEST_LENGTH * 2 + 1) __BEGIN_DECLS /* Ensure libmd symbols do not clash with libcrypto */ #ifndef SHA512_224_Init #define SHA512_224_Init _libmd_SHA512_224_Init #endif #ifndef SHA512_224_Update #define SHA512_224_Update _libmd_SHA512_224_Update #endif #ifndef SHA512_224_Final #define SHA512_224_Final _libmd_SHA512_224_Final #endif #ifndef SHA512_224_End #define SHA512_224_End _libmd_SHA512_224_End #endif +#ifndef SHA512_224_Fd +#define SHA512_224_Fd _libmd_SHA512_224_Fd +#endif +#ifndef SHA512_224_FdChunk +#define SHA512_224_FdChunk _libmd_SHA512_224_FdChunk +#endif #ifndef SHA512_224_File #define SHA512_224_File _libmd_SHA512_224_File #endif #ifndef SHA512_224_FileChunk #define SHA512_224_FileChunk _libmd_SHA512_224_FileChunk #endif #ifndef SHA512_224_Data #define SHA512_224_Data _libmd_SHA512_224_Data #endif #ifndef SHA512_224_Transform #define SHA512_224_Transform _libmd_SHA512_224_Transform #endif #ifndef SHA512_224_version #define SHA512_224_version _libmd_SHA512_224_version #endif #ifndef SHA512_256_Init #define SHA512_256_Init _libmd_SHA512_256_Init #endif #ifndef SHA512_256_Update #define SHA512_256_Update _libmd_SHA512_256_Update #endif #ifndef SHA512_256_Final #define SHA512_256_Final _libmd_SHA512_256_Final #endif #ifndef SHA512_256_End #define SHA512_256_End _libmd_SHA512_256_End #endif +#ifndef SHA512_256_Fd +#define SHA512_256_Fd _libmd_SHA512_256_Fd +#endif +#ifndef SHA512_256_FdChunk +#define SHA512_256_FdChunk _libmd_SHA512_256_FdChunk +#endif #ifndef SHA512_256_File #define SHA512_256_File _libmd_SHA512_256_File #endif #ifndef SHA512_256_FileChunk #define SHA512_256_FileChunk _libmd_SHA512_256_FileChunk #endif #ifndef SHA512_256_Data #define SHA512_256_Data _libmd_SHA512_256_Data #endif #ifndef SHA512_256_Transform #define SHA512_256_Transform _libmd_SHA512_256_Transform #endif #ifndef SHA512_256_version #define SHA512_256_version _libmd_SHA512_256_version #endif void SHA512_224_Init(SHA512_CTX *); void SHA512_224_Update(SHA512_CTX *, const void *, size_t); void SHA512_224_Final(unsigned char [static SHA512_224_DIGEST_LENGTH], SHA512_CTX *); #ifndef _KERNEL char *SHA512_224_End(SHA512_CTX *, char *); char *SHA512_224_Data(const void *, unsigned int, char *); +char *SHA512_224_Fd(int, char *); +char *SHA512_224_FdChunk(int, char *, off_t, off_t); char *SHA512_224_File(const char *, char *); char *SHA512_224_FileChunk(const char *, char *, off_t, off_t); #endif void SHA512_256_Init(SHA512_CTX *); void SHA512_256_Update(SHA512_CTX *, const void *, size_t); void SHA512_256_Final(unsigned char [static SHA512_256_DIGEST_LENGTH], SHA512_CTX *); #ifndef _KERNEL char *SHA512_256_End(SHA512_CTX *, char *); char *SHA512_256_Data(const void *, unsigned int, char *); +char *SHA512_256_Fd(int, char *); +char *SHA512_256_FdChunk(int, char *, off_t, off_t); char *SHA512_256_File(const char *, char *); char *SHA512_256_FileChunk(const char *, char *, off_t, off_t); #endif __END_DECLS #endif /* !_SHA512T_H_ */ Index: head/sys/crypto/skein/skein_freebsd.h =================================================================== --- head/sys/crypto/skein/skein_freebsd.h (revision 307520) +++ head/sys/crypto/skein/skein_freebsd.h (revision 307521) @@ -1,79 +1,85 @@ /*- * Copyright 2016 Allan Jude * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SKEIN_FREEBSD_H_ #define _SKEIN_FREEBSD_H_ #define SKEIN_256_BLOCK_BYTES ( 8*SKEIN_256_STATE_WORDS) #define SKEIN_512_BLOCK_BYTES ( 8*SKEIN_512_STATE_WORDS) #define SKEIN1024_BLOCK_BYTES ( 8*SKEIN1024_STATE_WORDS) #define SKEIN256_BLOCK_LENGTH SKEIN_256_BLOCK_BYTES #define SKEIN256_DIGEST_LENGTH 32 #define SKEIN256_DIGEST_STRING_LENGTH (SKEIN256_DIGEST_LENGTH * 2 + 1) #define SKEIN512_BLOCK_LENGTH SKEIN_512_BLOCK_BYTES #define SKEIN512_DIGEST_LENGTH 64 #define SKEIN512_DIGEST_STRING_LENGTH (SKEIN512_DIGEST_LENGTH * 2 + 1) #define SKEIN1024_BLOCK_LENGTH SKEIN1024_BLOCK_BYTES #define SKEIN1024_DIGEST_LENGTH 128 #define SKEIN1024_DIGEST_STRING_LENGTH (SKEIN1024_DIGEST_LENGTH * 2 + 1) /* Make the context types look like the other hashes on FreeBSD */ typedef Skein_256_Ctxt_t SKEIN256_CTX; typedef Skein_512_Ctxt_t SKEIN512_CTX; typedef Skein1024_Ctxt_t SKEIN1024_CTX; /* Make the prototypes look like the other hashes */ void SKEIN256_Init (SKEIN256_CTX *ctx); void SKEIN512_Init (SKEIN512_CTX *ctx); void SKEIN1024_Init (SKEIN1024_CTX *ctx); void SKEIN256_Update(SKEIN256_CTX *ctx, const void *in, size_t len); void SKEIN512_Update(SKEIN512_CTX *ctx, const void *in, size_t len); void SKEIN1024_Update(SKEIN1024_CTX *ctx, const void *in, size_t len); void SKEIN256_Final(unsigned char digest[static SKEIN256_DIGEST_LENGTH], SKEIN256_CTX *ctx); void SKEIN512_Final(unsigned char digest[static SKEIN512_DIGEST_LENGTH], SKEIN512_CTX *ctx); void SKEIN1024_Final(unsigned char digest[static SKEIN1024_DIGEST_LENGTH], SKEIN1024_CTX *ctx); #ifndef _KERNEL char *SKEIN256_End(SKEIN256_CTX *, char *); char *SKEIN512_End(SKEIN512_CTX *, char *); char *SKEIN1024_End(SKEIN1024_CTX *, char *); char *SKEIN256_Data(const void *, unsigned int, char *); char *SKEIN512_Data(const void *, unsigned int, char *); char *SKEIN1024_Data(const void *, unsigned int, char *); +char *SKEIN256_Fd(int, char *); +char *SKEIN512_Fd(int, char *); +char *SKEIN1024_Fd(int, char *); +char *SKEIN256_FdChunk(int, char *, off_t, off_t); +char *SKEIN512_FdChunk(int, char *, off_t, off_t); +char *SKEIN1024_FdChunk(int, char *, off_t, off_t); char *SKEIN256_File(const char *, char *); char *SKEIN512_File(const char *, char *); char *SKEIN1024_File(const char *, char *); char *SKEIN256_FileChunk(const char *, char *, off_t, off_t); char *SKEIN512_FileChunk(const char *, char *, off_t, off_t); char *SKEIN1024_FileChunk(const char *, char *, off_t, off_t); #endif #endif /* ifndef _SKEIN_FREEBSD_H_ */ Index: head/sys/crypto/skein/skein_port.h =================================================================== --- head/sys/crypto/skein/skein_port.h (revision 307520) +++ head/sys/crypto/skein/skein_port.h (revision 307521) @@ -1,158 +1,168 @@ /* $FreeBSD$ */ #ifndef _SKEIN_PORT_H_ #define _SKEIN_PORT_H_ /******************************************************************* ** ** Platform-specific definitions for Skein hash function. ** ** Source code author: Doug Whiting, 2008. ** ** This algorithm and source code is released to the public domain. ** ** Many thanks to Brian Gladman for his portable header files. ** ** To port Skein to an "unsupported" platform, change the definitions ** in this file appropriately. ** ********************************************************************/ #include #include #ifndef _OPENSOLARIS_SYS_TYPES_H_ /* Avoid redefining this typedef */ typedef unsigned int uint_t; /* native unsigned integer */ #endif typedef u_int8_t u08b_t; /* 8-bit unsigned integer */ typedef u_int32_t uint_32t; /* 32-bit unsigned integer */ typedef u_int64_t u64b_t; /* 64-bit unsigned integer */ #ifndef RotL_64 #define RotL_64(x,N) (((x) << (N)) | ((x) >> (64-(N)))) #endif __BEGIN_DECLS /* * Skein is "natively" little-endian (unlike SHA-xxx), for optimal * performance on x86 CPUs. The Skein code requires the following * definitions for dealing with endianness: * * SKEIN_NEED_SWAP: 0 for little-endian, 1 for big-endian * Skein_Put64_LSB_First * Skein_Get64_LSB_First * Skein_Swap64 * * If SKEIN_NEED_SWAP is defined at compile time, it is used here * along with the portable versions of Put64/Get64/Swap64, which * are slow in general. * * Otherwise, an "auto-detect" of endianness is attempted below. * If the default handling doesn't work well, the user may insert * platform-specific code instead (e.g., for big-endian CPUs). * */ #ifndef SKEIN_NEED_SWAP /* compile-time "override" for endianness? */ #if BYTE_ORDER == BIG_ENDIAN /* here for big-endian CPUs */ #define SKEIN_NEED_SWAP (1) #ifdef SKEIN_PORT_CODE void Skein_Put64_LSB_First(u08b_t *dst,const u64b_t *src,size_t bCnt); void Skein_Get64_LSB_First(u64b_t *dst,const u08b_t *src,size_t wCnt); #endif /* ifdef SKEIN_PORT_CODE */ #elif BYTE_ORDER == LITTLE_ENDIAN /* here for x86 and x86-64 CPUs (and other detected little-endian CPUs) */ #define SKEIN_NEED_SWAP (0) #define Skein_Put64_LSB_First(dst08,src64,bCnt) memcpy(dst08,src64,bCnt) #define Skein_Get64_LSB_First(dst64,src08,wCnt) memcpy(dst64,src08,8*(wCnt)) #else #error "Skein needs endianness setting!" #endif #endif /* ifndef SKEIN_NEED_SWAP */ /* ****************************************************************** * Provide any definitions still needed. ****************************************************************** */ #ifndef Skein_Swap64 /* swap for big-endian, nop for little-endian */ #if SKEIN_NEED_SWAP #define Skein_Swap64(w64) bswap64(w64) #else #define Skein_Swap64(w64) (w64) #endif #endif /* ifndef Skein_Swap64 */ #ifndef Skein_Put64_LSB_First void Skein_Put64_LSB_First(u08b_t *dst,const u64b_t *src,size_t bCnt) #ifdef SKEIN_PORT_CODE /* instantiate the function code here? */ { size_t n; for (n = 0; n < bCnt / 8; n++) le64enc(dst + n * 8, src[n]); } #else ; /* output only the function prototype */ #endif #endif /* ifndef Skein_Put64_LSB_First */ #ifndef Skein_Get64_LSB_First void Skein_Get64_LSB_First(u64b_t *dst,const u08b_t *src,size_t wCnt) #ifdef SKEIN_PORT_CODE /* instantiate the function code here? */ { size_t n; for (n = 0; n < wCnt; n++) dst[n] = le64dec(src + n * 8); } #else ; /* output only the function prototype */ #endif #endif /* ifndef Skein_Get64_LSB_First */ /* Start FreeBSD libmd shims */ /* Ensure libmd symbols do not clash with libcrypto */ #ifndef SKEIN256_Init #define SKEIN256_Init _libmd_SKEIN256_Init #define SKEIN512_Init _libmd_SKEIN512_Init #define SKEIN1024_Init _libmd_SKEIN1024_Init #endif #ifndef SKEIN256_Update #define SKEIN256_Update _libmd_SKEIN256_Update #define SKEIN512_Update _libmd_SKEIN512_Update #define SKEIN1024_Update _libmd_SKEIN1024_Update #endif #ifndef SKEIN256_Final #define SKEIN256_Final _libmd_SKEIN256_Final #define SKEIN512_Final _libmd_SKEIN512_Final #define SKEIN1024_Final _libmd_SKEIN1024_Final #endif #ifndef SKEIN256_End #define SKEIN256_End _libmd_SKEIN256_End #define SKEIN512_End _libmd_SKEIN512_End #define SKEIN1024_End _libmd_SKEIN1024_End #endif +#ifndef SKEIN256_Fd +#define SKEIN256_Fd _libmd_SKEIN256_Fd +#define SKEIN512_Fd _libmd_SKEIN512_Fd +#define SKEIN1024_Fd _libmd_SKEIN1024_Fd +#endif +#ifndef SKEIN256_FdChunk +#define SKEIN256_FdChunk _libmd_SKEIN256_FdChunk +#define SKEIN512_FdChunk _libmd_SKEIN512_FdChunk +#define SKEIN1024_FdChunk _libmd_SKEIN1024_FdChunk +#endif #ifndef SKEIN256_File #define SKEIN256_File _libmd_SKEIN256_File #define SKEIN512_File _libmd_SKEIN512_File #define SKEIN1024_File _libmd_SKEIN1024_File #endif #ifndef SKEIN256_FileChunk #define SKEIN256_FileChunk _libmd_SKEIN256_FileChunk #define SKEIN512_FileChunk _libmd_SKEIN512_FileChunk #define SKEIN1024_FileChunk _libmd_SKEIN1024_FileChunk #endif #ifndef SKEIN256_Data #define SKEIN256_Data _libmd_SKEIN256_Data #define SKEIN512_Data _libmd_SKEIN512_Data #define SKEIN1024_Data _libmd_SKEIN1024_Data #endif __END_DECLS #endif /* ifndef _SKEIN_PORT_H_ */ Index: head/sys/sys/md5.h =================================================================== --- head/sys/sys/md5.h (revision 307520) +++ head/sys/sys/md5.h (revision 307521) @@ -1,55 +1,57 @@ /* MD5.H - header file for MD5C.C * $FreeBSD$ */ /*- Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights reserved. License to copy and use this software is granted provided that it is identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing this software or this function. License is also granted to make and use derivative works provided that such works are identified as "derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm" in all material mentioning or referencing the derived work. RSA Data Security, Inc. makes no representations concerning either the merchantability of this software or the suitability of this software for any particular purpose. It is provided "as is" without express or implied warranty of any kind. These notices must be retained in any copies of any part of this documentation and/or software. */ #ifndef _SYS_MD5_H_ #define _SYS_MD5_H_ #define MD5_BLOCK_LENGTH 64 #define MD5_DIGEST_LENGTH 16 #define MD5_DIGEST_STRING_LENGTH (MD5_DIGEST_LENGTH * 2 + 1) /* MD5 context. */ typedef struct MD5Context { u_int32_t state[4]; /* state (ABCD) */ u_int32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ unsigned char buffer[64]; /* input buffer */ } MD5_CTX; #include __BEGIN_DECLS void MD5Init (MD5_CTX *); void MD5Update (MD5_CTX *, const void *, unsigned int); void MD5Final (unsigned char[static MD5_DIGEST_LENGTH], MD5_CTX *); #ifndef _KERNEL char * MD5End(MD5_CTX *, char *); +char * MD5Fd(int, char *); +char * MD5FdChunk(int, char *, off_t, off_t); char * MD5File(const char *, char *); char * MD5FileChunk(const char *, char *, off_t, off_t); char * MD5Data(const void *, unsigned int, char *); #endif __END_DECLS #endif /* _SYS_MD5_H_ */