1*dd98b26dSagc /* $NetBSD: md5.h,v 1.2 2016/06/14 20:47:08 agc Exp $ */ 225f78d91Sagc 325f78d91Sagc /* 425f78d91Sagc * This file is derived from the RSA Data Security, Inc. MD5 Message-Digest 525f78d91Sagc * Algorithm and has been modified by Jason R. Thorpe <thorpej@NetBSD.org> 625f78d91Sagc * for portability and formatting. 725f78d91Sagc */ 825f78d91Sagc 925f78d91Sagc /* 1025f78d91Sagc * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All 1125f78d91Sagc * rights reserved. 1225f78d91Sagc * 1325f78d91Sagc * License to copy and use this software is granted provided that it 1425f78d91Sagc * is identified as the "RSA Data Security, Inc. MD5 Message-Digest 1525f78d91Sagc * Algorithm" in all material mentioning or referencing this software 1625f78d91Sagc * or this function. 1725f78d91Sagc * 1825f78d91Sagc * License is also granted to make and use derivative works provided 1925f78d91Sagc * that such works are identified as "derived from the RSA Data 2025f78d91Sagc * Security, Inc. MD5 Message-Digest Algorithm" in all material 2125f78d91Sagc * mentioning or referencing the derived work. 2225f78d91Sagc * 2325f78d91Sagc * RSA Data Security, Inc. makes no representations concerning either 2425f78d91Sagc * the merchantability of this software or the suitability of this 2525f78d91Sagc * software for any particular purpose. It is provided "as is" 2625f78d91Sagc * without express or implied warranty of any kind. 2725f78d91Sagc * 2825f78d91Sagc * These notices must be retained in any copies of any part of this 2925f78d91Sagc * documentation and/or software. 3025f78d91Sagc */ 3125f78d91Sagc 3225f78d91Sagc #ifndef _SYS_MD5_H_ 3325f78d91Sagc #define _SYS_MD5_H_ 3425f78d91Sagc 3525f78d91Sagc #include <sys/types.h> 3625f78d91Sagc 3725f78d91Sagc #include <inttypes.h> 3825f78d91Sagc 3925f78d91Sagc #define MD5_DIGEST_LENGTH 16 4025f78d91Sagc #define MD5_DIGEST_STRING_LENGTH 33 4125f78d91Sagc 42*dd98b26dSagc #ifndef __BEGIN_DECLS 43*dd98b26dSagc # if defined(__cplusplus) 44*dd98b26dSagc # define __BEGIN_DECLS extern "C" { 45*dd98b26dSagc # define __END_DECLS } 46*dd98b26dSagc # else 47*dd98b26dSagc # define __BEGIN_DECLS 48*dd98b26dSagc # define __END_DECLS 49*dd98b26dSagc # endif 50*dd98b26dSagc #endif 51*dd98b26dSagc 5225f78d91Sagc /* MD5 context. */ 5325f78d91Sagc typedef struct MD5Context { 5425f78d91Sagc uint32_t state[4]; /* state (ABCD) */ 5525f78d91Sagc uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */ 5625f78d91Sagc unsigned char buffer[64]; /* input buffer */ 57*dd98b26dSagc } NETPGPV_MD5_CTX; 5825f78d91Sagc 5925f78d91Sagc __BEGIN_DECLS 60*dd98b26dSagc void netpgpv_MD5Init(NETPGPV_MD5_CTX *); 61*dd98b26dSagc void netpgpv_MD5Update(NETPGPV_MD5_CTX *, const unsigned char *, unsigned int); 62*dd98b26dSagc void netpgpv_MD5Final(unsigned char[MD5_DIGEST_LENGTH], NETPGPV_MD5_CTX *); 6325f78d91Sagc #ifndef _KERNEL 64*dd98b26dSagc char *netpgpv_MD5End(NETPGPV_MD5_CTX *, char *); 65*dd98b26dSagc char *netpgpv_MD5File(const char *, char *); 66*dd98b26dSagc char *netpgpv_MD5Data(const unsigned char *, unsigned int, char *); 6725f78d91Sagc #endif /* _KERNEL */ 6825f78d91Sagc __END_DECLS 6925f78d91Sagc 7025f78d91Sagc #endif /* _SYS_MD5_H_ */ 71