Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers md5.h Source File

md5.h

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