• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * \file md5.h
3  *
4  *  Based on XySSL: Copyright (C) 2006-2008  Christophe Devine
5  *
6  *  Copyright (C) 2009  Paul Bakker <polarssl_maintainer at polarssl dot org>
7  *
8  *  All rights reserved.
9  *
10  *  Redistribution and use in source and binary forms, with or without
11  *  modification, are permitted provided that the following conditions
12  *  are met:
13  *
14  *    * Redistributions of source code must retain the above copyright
15  *      notice, this list of conditions and the following disclaimer.
16  *    * Redistributions in binary form must reproduce the above copyright
17  *      notice, this list of conditions and the following disclaimer in the
18  *      documentation and/or other materials provided with the distribution.
19  *    * Neither the names of PolarSSL or XySSL nor the names of its contributors
20  *      may be used to endorse or promote products derived from this software
21  *      without specific prior written permission.
22  *
23  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29  *  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30  *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31  *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32  *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #include "netif/ppp/ppp_opts.h"
37 #if LWIP_INCLUDED_POLARSSL_MD5
38 
39 #ifndef LWIP_INCLUDED_POLARSSL_MD5_H
40 #define LWIP_INCLUDED_POLARSSL_MD5_H
41 
42 /**
43  * \brief          MD5 context structure
44  */
45 typedef struct
46 {
47     unsigned long total[2];     /*!< number of bytes processed  */
48     unsigned long state[4];     /*!< intermediate digest state  */
49     unsigned char buffer[64];   /*!< data block being processed */
50 }
51 md5_context;
52 
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56 
57 /**
58  * \brief          MD5 context setup
59  *
60  * \param ctx      context to be initialized
61  */
62 void md5_starts( md5_context *ctx );
63 
64 /**
65  * \brief          MD5 process buffer
66  *
67  * \param ctx      MD5 context
68  * \param input    buffer holding the  data
69  * \param ilen     length of the input data
70  */
71 void md5_update( md5_context *ctx, const unsigned char *input, int ilen );
72 
73 /**
74  * \brief          MD5 final digest
75  *
76  * \param ctx      MD5 context
77  * \param output   MD5 checksum result
78  */
79 void md5_finish( md5_context *ctx, unsigned char output[16] );
80 
81 /**
82  * \brief          Output = MD5( input buffer )
83  *
84  * \param input    buffer holding the  data
85  * \param ilen     length of the input data
86  * \param output   MD5 checksum result
87  */
88 void md5( unsigned char *input, int ilen, unsigned char output[16] );
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif /* LWIP_INCLUDED_POLARSSL_MD5_H */
95 
96 #endif /* LWIP_INCLUDED_POLARSSL_MD5 */
97