STM32F7 Ethernet interface for nucleo STM32F767

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sha1.h Source File

sha1.h

00001 /**
00002  * \file sha1.h
00003  *
00004  *  Based on XySSL: Copyright (C) 2006-2008  Christophe Devine
00005  *
00006  *  Copyright (C) 2009  Paul Bakker <polarssl_maintainer at polarssl dot org>
00007  *
00008  *  All rights reserved.
00009  *
00010  *  Redistribution and use in source and binary forms, with or without
00011  *  modification, are permitted provided that the following conditions
00012  *  are met:
00013  *  
00014  *    * Redistributions of source code must retain the above copyright
00015  *      notice, this list of conditions and the following disclaimer.
00016  *    * Redistributions in binary form must reproduce the above copyright
00017  *      notice, this list of conditions and the following disclaimer in the
00018  *      documentation and/or other materials provided with the distribution.
00019  *    * Neither the names of PolarSSL or XySSL nor the names of its contributors
00020  *      may be used to endorse or promote products derived from this software
00021  *      without specific prior written permission.
00022  *  
00023  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00024  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00025  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00026  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00027  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00028  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
00029  *  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00030  *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00031  *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00032  *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00033  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00034  */
00035 
00036 #include "netif/ppp/ppp_opts.h"
00037 #if LWIP_INCLUDED_POLARSSL_SHA1
00038 
00039 #ifndef LWIP_INCLUDED_POLARSSL_SHA1_H
00040 #define LWIP_INCLUDED_POLARSSL_SHA1_H
00041 
00042 /**
00043  * \brief          SHA-1 context structure
00044  */
00045 typedef struct
00046 {
00047     unsigned long total[2];     /*!< number of bytes processed  */
00048     unsigned long state[5];     /*!< intermediate digest state  */
00049     unsigned char buffer[64];   /*!< data block being processed */
00050 }
00051 sha1_context;
00052 
00053 #ifdef __cplusplus
00054 extern "C" {
00055 #endif
00056 
00057 /**
00058  * \brief          SHA-1 context setup
00059  *
00060  * \param ctx      context to be initialized
00061  */
00062 void sha1_starts( sha1_context *ctx );
00063 
00064 /**
00065  * \brief          SHA-1 process buffer
00066  *
00067  * \param ctx      SHA-1 context
00068  * \param input    buffer holding the  data
00069  * \param ilen     length of the input data
00070  */
00071 void sha1_update( sha1_context *ctx, const unsigned char *input, int ilen );
00072 
00073 /**
00074  * \brief          SHA-1 final digest
00075  *
00076  * \param ctx      SHA-1 context
00077  * \param output   SHA-1 checksum result
00078  */
00079 void sha1_finish( sha1_context *ctx, unsigned char output[20] );
00080 
00081 /**
00082  * \brief          Output = SHA-1( input buffer )
00083  *
00084  * \param input    buffer holding the  data
00085  * \param ilen     length of the input data
00086  * \param output   SHA-1 checksum result
00087  */
00088 void sha1( unsigned char *input, int ilen, unsigned char output[20] );
00089 
00090 #ifdef __cplusplus
00091 }
00092 #endif
00093 
00094 #endif /* LWIP_INCLUDED_POLARSSL_SHA1_H */
00095 
00096 #endif /* LWIP_INCLUDED_POLARSSL_SHA1 */