Netservices modded to read fragmented HTTP respsonse/payload from special purpose server - 180 bytes only
Embed:
(wiki syntax)
Show/hide line numbers
sha1.h
00001 /* 00002 * \file sha1.h 00003 * 00004 * Copyright (C) 2006-2010, Paul Bakker <polarssl_maintainer at polarssl.org> 00005 * All rights reserved. 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License along 00018 * with this program; if not, write to the Free Software Foundation, Inc., 00019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00020 */ 00021 #ifndef POLARSSL_SHA1_H 00022 #define POLARSSL_SHA1_H 00023 00024 /* 00025 * \brief SHA-1 context structure 00026 */ 00027 typedef struct 00028 { 00029 unsigned long total[2]; /*!< number of bytes processed */ 00030 unsigned long state[5]; /*!< intermediate digest state */ 00031 unsigned char buffer[64]; /*!< data block being processed */ 00032 00033 unsigned char ipad[64]; /*!< HMAC: inner padding */ 00034 unsigned char opad[64]; /*!< HMAC: outer padding */ 00035 } 00036 sha1_context; 00037 00038 #ifdef __cplusplus 00039 extern "C" { 00040 #endif 00041 00042 /* 00043 * \brief SHA-1 context setup 00044 * 00045 * \param ctx context to be initialized 00046 */ 00047 void sha1_starts( sha1_context *ctx ); 00048 00049 /* 00050 * \brief SHA-1 process buffer 00051 * 00052 * \param ctx SHA-1 context 00053 * \param input buffer holding the data 00054 * \param ilen length of the input data 00055 */ 00056 void sha1_update( sha1_context *ctx, const unsigned char *input, int ilen ); 00057 00058 /* 00059 * \brief SHA-1 final digest 00060 * 00061 * \param ctx SHA-1 context 00062 * \param output SHA-1 checksum result 00063 */ 00064 void sha1_finish( sha1_context *ctx, unsigned char output[20] ); 00065 00066 /* 00067 * \brief Output = SHA-1( input buffer ) 00068 * 00069 * \param input buffer holding the data 00070 * \param ilen length of the input data 00071 * \param output SHA-1 checksum result 00072 */ 00073 void sha1( const unsigned char *input, int ilen, unsigned char output[20] ); 00074 00075 #if 0 //No need for that 00076 /* 00077 * \brief Output = SHA-1( file contents ) 00078 * 00079 * \param path input file name 00080 * \param output SHA-1 checksum result 00081 * 00082 * \return 0 if successful, 1 if fopen failed, 00083 * or 2 if fread failed 00084 */ 00085 int sha1_file( const char *path, unsigned char output[20] ); 00086 #endif 00087 00088 /* 00089 * \brief SHA-1 HMAC context setup 00090 * 00091 * \param ctx HMAC context to be initialized 00092 * \param key HMAC secret key 00093 * \param keylen length of the HMAC key 00094 */ 00095 void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key, int keylen ); 00096 00097 /* 00098 * \brief SHA-1 HMAC process buffer 00099 * 00100 * \param ctx HMAC context 00101 * \param input buffer holding the data 00102 * \param ilen length of the input data 00103 */ 00104 void sha1_hmac_update( sha1_context *ctx, const unsigned char *input, int ilen ); 00105 00106 /* 00107 * \brief SHA-1 HMAC final digest 00108 * 00109 * \param ctx HMAC context 00110 * \param output SHA-1 HMAC checksum result 00111 */ 00112 void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] ); 00113 00114 /* 00115 * \brief SHA-1 HMAC context reset 00116 * 00117 * \param ctx HMAC context to be reset 00118 */ 00119 void sha1_hmac_reset( sha1_context *ctx ); 00120 00121 /* 00122 * \brief Output = HMAC-SHA-1( hmac key, input buffer ) 00123 * 00124 * \param key HMAC secret key 00125 * \param keylen length of the HMAC key 00126 * \param input buffer holding the data 00127 * \param ilen length of the input data 00128 * \param output HMAC-SHA-1 result 00129 */ 00130 void sha1_hmac( const unsigned char *key, int keylen, 00131 const unsigned char *input, int ilen, 00132 unsigned char output[20] ); 00133 00134 /* 00135 * \brief Checkup routine 00136 * 00137 * \return 0 if successful, or 1 if the test failed 00138 */ 00139 int sha1_self_test( int verbose ); 00140 00141 #ifdef __cplusplus 00142 } 00143 #endif 00144 00145 #endif /* sha1.h */
Generated on Tue Jul 12 2022 19:20:50 by 1.7.2