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