Mistake on this page?
Report an issue in GitHub or email us
sha1.h
1 /**
2  * /@code
3  *
4  * \file sha1.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 #include "ppp_opts.h"
41 #if PPP_INCLUDED_POLARSSL_SHA1
42 
43 #ifndef PPP_INCLUDED_POLARSSL_SHA1_H
44 #define PPP_INCLUDED_POLARSSL_SHA1_H
45 
46 /**
47  * \brief SHA-1 context structure
48  */
49 typedef struct
50 {
51  unsigned long total[2]; /*!< number of bytes processed */
52  unsigned long state[5]; /*!< intermediate digest state */
53  unsigned char buffer[64]; /*!< data block being processed */
54 }
55 sha1_context;
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 /**
62  * \brief SHA-1 context setup
63  *
64  * \param ctx context to be initialized
65  */
66 void sha1_starts( sha1_context *ctx );
67 
68 /**
69  * \brief SHA-1 process buffer
70  *
71  * \param ctx SHA-1 context
72  * \param input buffer holding the data
73  * \param ilen length of the input data
74  */
75 void sha1_update( sha1_context *ctx, const unsigned char *input, int ilen );
76 
77 /**
78  * \brief SHA-1 final digest
79  *
80  * \param ctx SHA-1 context
81  * \param output SHA-1 checksum result
82  */
83 void sha1_finish( sha1_context *ctx, unsigned char output[20] );
84 
85 /**
86  * \brief Output = SHA-1( input buffer )
87  *
88  * \param input buffer holding the data
89  * \param ilen length of the input data
90  * \param output SHA-1 checksum result
91  */
92 void sha1( unsigned char *input, int ilen, unsigned char output[20] );
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif /* PPP_INCLUDED_POLARSSL_SHA1_H */
99 
100 #endif /* PPP_INCLUDED_POLARSSL_SHA1 */
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.