Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers md4.h Source File

md4.h

00001 /**
00002  * /@code
00003  *
00004  * \file md4.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 #include "ppp_opts.h"
00041 #if PPP_INCLUDED_POLARSSL_MD4
00042 
00043 #ifndef PPP_INCLUDED_POLARSSL_MD4_H
00044 #define PPP_INCLUDED_POLARSSL_MD4_H
00045 
00046 /**
00047  * \brief          MD4 context structure
00048  */
00049 typedef struct
00050 {
00051     unsigned long total[2];     /*!< number of bytes processed  */
00052     unsigned long state[4];     /*!< intermediate digest state  */
00053     unsigned char buffer[64];   /*!< data block being processed */
00054 }
00055 md4_context;
00056 
00057 #ifdef __cplusplus
00058 extern "C" {
00059 #endif
00060 
00061 /**
00062  * \brief          MD4 context setup
00063  *
00064  * \param ctx      context to be initialized
00065  */
00066 void md4_starts( md4_context *ctx );
00067 
00068 /**
00069  * \brief          MD4 process buffer
00070  *
00071  * \param ctx      MD4 context
00072  * \param input    buffer holding the  data
00073  * \param ilen     length of the input data
00074  */
00075 void md4_update( md4_context *ctx, const unsigned char *input, int ilen );
00076 
00077 /**
00078  * \brief          MD4 final digest
00079  *
00080  * \param ctx      MD4 context
00081  * \param output   MD4 checksum result
00082  */
00083 void md4_finish( md4_context *ctx, unsigned char output[16] );
00084 
00085 /**
00086  * \brief          Output = MD4( input buffer )
00087  *
00088  * \param input    buffer holding the  data
00089  * \param ilen     length of the input data
00090  * \param output   MD4 checksum result
00091  */
00092 void md4( unsigned char *input, int ilen, unsigned char output[16] );
00093 
00094 
00095 #ifdef __cplusplus
00096 }
00097 #endif
00098 
00099 #endif /* PPP_INCLUDED_POLARSSL_MD4_H */
00100 
00101 #endif /* PPP_INCLUDED_POLARSSL_MD4 */