embedded IPsec source code documentation


md5.h

Go to the documentation of this file.
00001 /*
00002  * embedded IPsec
00003  * Copyright (c) 2003 Niklaus Schild and Christian Scheurer, HTI Biel/Bienne
00004  * All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without modification,
00007  * are permitted provided that the following conditions are met:
00008  *
00009  * 1. Redistributions of source code must retain the above copyright notice,
00010  *    this list of conditions and the following disclaimer.
00011  * 2. Redistributions in binary form must reproduce the above copyright notice,
00012  *    this list of conditions and the following disclaimer in the documentation
00013  *    and/or other materials provided with the distribution.
00014  * 3. The name of the author may not be used to endorse or promote products
00015  *    derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00018  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00019  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00020  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00021  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
00022  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00023  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00024  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00025  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
00026  * OF SUCH DAMAGE.
00027  *
00028  */
00029 
00043 #ifndef __MD5_H__
00044 #define __MD5_H__
00045 
00046 #include "ipsec/types.h"
00047 
00055 #define MD5_LONG __u32
00056 
00057 
00058 #define MD5_CBLOCK      64
00059 #define MD5_LBLOCK      (MD5_CBLOCK/4)
00060 #define MD5_DIGEST_LENGTH 16
00061 
00062 /* @type MD5_CTX MD5 context, used to calculate MD5 digests */
00063 typedef struct MD5state_st
00064         {
00065                 MD5_LONG A,B,C,D;
00066                 MD5_LONG Nl,Nh;
00067                 MD5_LONG data[MD5_LBLOCK];
00068                 int num;
00069         } MD5_CTX;
00070 
00071 extern void MD5_Init(MD5_CTX *c);
00072 extern void MD5_Update(MD5_CTX *c, const void *data, unsigned long len);
00073 extern void MD5_Final(unsigned char *md, MD5_CTX *c);
00074 extern unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md);
00075 extern void MD5_Transform(MD5_CTX *c, const unsigned char *b);
00076 
00077 void hmac_md5(unsigned char*, int, unsigned char*, int, unsigned char*);
00078 
00079 #endif

Copyright 2003 by Christian Scheurer and Niklaus Schild