Hannes Tschofenig
/
aes-gcm-test-program
Example program to test AES-GCM functionality. Used for a workshop
Embed:
(wiki syntax)
Show/hide line numbers
ripemd160.h
Go to the documentation of this file.
00001 /** 00002 * \file ripemd160.h 00003 * 00004 * \brief RIPE MD-160 message digest 00005 * 00006 * Copyright (C) 2014-2014, Brainspark B.V. 00007 * 00008 * This file is part of PolarSSL (http://www.polarssl.org) 00009 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> 00010 * 00011 * All rights reserved. 00012 * 00013 * This program is free software; you can redistribute it and/or modify 00014 * it under the terms of the GNU General Public License as published by 00015 * the Free Software Foundation; either version 2 of the License, or 00016 * (at your option) any later version. 00017 * 00018 * This program is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 * GNU General Public License for more details. 00022 * 00023 * You should have received a copy of the GNU General Public License along 00024 * with this program; if not, write to the Free Software Foundation, Inc., 00025 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00026 */ 00027 #ifndef POLARSSL_RIPEMD160_H 00028 #define POLARSSL_RIPEMD160_H 00029 00030 #if !defined(POLARSSL_CONFIG_FILE) 00031 #include "config.h" 00032 #else 00033 #include POLARSSL_CONFIG_FILE 00034 #endif 00035 00036 #include <string.h> 00037 00038 #if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32) 00039 #include <basetsd.h> 00040 typedef UINT32 uint32_t; 00041 #else 00042 #include <inttypes.h> 00043 #endif 00044 00045 #define POLARSSL_ERR_RIPEMD160_FILE_IO_ERROR -0x007E /**< Read/write error in file. */ 00046 00047 #if !defined(POLARSSL_RIPEMD160_ALT) 00048 // Regular implementation 00049 // 00050 00051 #ifdef __cplusplus 00052 extern "C" { 00053 #endif 00054 00055 /** 00056 * \brief RIPEMD-160 context structure 00057 */ 00058 typedef struct 00059 { 00060 uint32_t total[2]; /*!< number of bytes processed */ 00061 uint32_t state[5]; /*!< intermediate digest state */ 00062 unsigned char buffer[64]; /*!< data block being processed */ 00063 00064 unsigned char ipad[64]; /*!< HMAC: inner padding */ 00065 unsigned char opad[64]; /*!< HMAC: outer padding */ 00066 } 00067 ripemd160_context; 00068 00069 /** 00070 * \brief RIPEMD-160 context setup 00071 * 00072 * \param ctx context to be initialized 00073 */ 00074 void ripemd160_starts( ripemd160_context *ctx ); 00075 00076 /** 00077 * \brief RIPEMD-160 process buffer 00078 * 00079 * \param ctx RIPEMD-160 context 00080 * \param input buffer holding the data 00081 * \param ilen length of the input data 00082 */ 00083 void ripemd160_update( ripemd160_context *ctx, 00084 const unsigned char *input, size_t ilen ); 00085 00086 /** 00087 * \brief RIPEMD-160 final digest 00088 * 00089 * \param ctx RIPEMD-160 context 00090 * \param output RIPEMD-160 checksum result 00091 */ 00092 void ripemd160_finish( ripemd160_context *ctx, unsigned char output[20] ); 00093 00094 /* Internal use */ 00095 void ripemd160_process( ripemd160_context *ctx, const unsigned char data[64] ); 00096 00097 #ifdef __cplusplus 00098 } 00099 #endif 00100 00101 #else /* POLARSSL_RIPEMD160_ALT */ 00102 #include "ripemd160.h" 00103 #endif /* POLARSSL_RIPEMD160_ALT */ 00104 00105 #ifdef __cplusplus 00106 extern "C" { 00107 #endif 00108 00109 /** 00110 * \brief Output = RIPEMD-160( input buffer ) 00111 * 00112 * \param input buffer holding the data 00113 * \param ilen length of the input data 00114 * \param output RIPEMD-160 checksum result 00115 */ 00116 void ripemd160( const unsigned char *input, size_t ilen, 00117 unsigned char output[20] ); 00118 00119 #if defined(POLARSSL_FS_IO) 00120 /** 00121 * \brief Output = RIPEMD-160( file contents ) 00122 * 00123 * \param path input file name 00124 * \param output RIPEMD-160 checksum result 00125 * 00126 * \return 0 if successful, or POLARSSL_ERR_RIPEMD160_FILE_IO_ERROR 00127 */ 00128 int ripemd160_file( const char *path, unsigned char output[20] ); 00129 #endif /* POLARSSL_FS_IO */ 00130 00131 /** 00132 * \brief RIPEMD-160 HMAC context setup 00133 * 00134 * \param ctx HMAC context to be initialized 00135 * \param key HMAC secret key 00136 * \param keylen length of the HMAC key 00137 */ 00138 void ripemd160_hmac_starts( ripemd160_context *ctx, 00139 const unsigned char *key, size_t keylen ); 00140 00141 /** 00142 * \brief RIPEMD-160 HMAC process buffer 00143 * 00144 * \param ctx HMAC context 00145 * \param input buffer holding the data 00146 * \param ilen length of the input data 00147 */ 00148 void ripemd160_hmac_update( ripemd160_context *ctx, 00149 const unsigned char *input, size_t ilen ); 00150 00151 /** 00152 * \brief RIPEMD-160 HMAC final digest 00153 * 00154 * \param ctx HMAC context 00155 * \param output RIPEMD-160 HMAC checksum result 00156 */ 00157 void ripemd160_hmac_finish( ripemd160_context *ctx, unsigned char output[20] ); 00158 00159 /** 00160 * \brief RIPEMD-160 HMAC context reset 00161 * 00162 * \param ctx HMAC context to be reset 00163 */ 00164 void ripemd160_hmac_reset( ripemd160_context *ctx ); 00165 00166 /** 00167 * \brief Output = HMAC-RIPEMD-160( hmac key, input buffer ) 00168 * 00169 * \param key HMAC secret key 00170 * \param keylen length of the HMAC key 00171 * \param input buffer holding the data 00172 * \param ilen length of the input data 00173 * \param output HMAC-RIPEMD-160 result 00174 */ 00175 void ripemd160_hmac( const unsigned char *key, size_t keylen, 00176 const unsigned char *input, size_t ilen, 00177 unsigned char output[20] ); 00178 00179 /** 00180 * \brief Checkup routine 00181 * 00182 * \return 0 if successful, or 1 if the test failed 00183 */ 00184 int ripemd160_self_test( int verbose ); 00185 00186 #ifdef __cplusplus 00187 } 00188 #endif 00189 00190 #endif /* ripemd160.h */ 00191 00192
Generated on Tue Jul 12 2022 19:40:20 by 1.7.2