Netservices modded to read fragmented HTTP respsonse/payload from special purpose server - 180 bytes only

Committer:
RodColeman
Date:
Thu Sep 08 10:41:36 2011 +0000
Revision:
0:8f5825f330b0
setDataLen hacked to 180bytes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RodColeman 0:8f5825f330b0 1 /*
RodColeman 0:8f5825f330b0 2 * \file sha1.h
RodColeman 0:8f5825f330b0 3 *
RodColeman 0:8f5825f330b0 4 * Copyright (C) 2006-2010, Paul Bakker <polarssl_maintainer at polarssl.org>
RodColeman 0:8f5825f330b0 5 * All rights reserved.
RodColeman 0:8f5825f330b0 6 *
RodColeman 0:8f5825f330b0 7 * This program is free software; you can redistribute it and/or modify
RodColeman 0:8f5825f330b0 8 * it under the terms of the GNU General Public License as published by
RodColeman 0:8f5825f330b0 9 * the Free Software Foundation; either version 2 of the License, or
RodColeman 0:8f5825f330b0 10 * (at your option) any later version.
RodColeman 0:8f5825f330b0 11 *
RodColeman 0:8f5825f330b0 12 * This program is distributed in the hope that it will be useful,
RodColeman 0:8f5825f330b0 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
RodColeman 0:8f5825f330b0 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
RodColeman 0:8f5825f330b0 15 * GNU General Public License for more details.
RodColeman 0:8f5825f330b0 16 *
RodColeman 0:8f5825f330b0 17 * You should have received a copy of the GNU General Public License along
RodColeman 0:8f5825f330b0 18 * with this program; if not, write to the Free Software Foundation, Inc.,
RodColeman 0:8f5825f330b0 19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
RodColeman 0:8f5825f330b0 20 */
RodColeman 0:8f5825f330b0 21 #ifndef POLARSSL_SHA1_H
RodColeman 0:8f5825f330b0 22 #define POLARSSL_SHA1_H
RodColeman 0:8f5825f330b0 23
RodColeman 0:8f5825f330b0 24 /*
RodColeman 0:8f5825f330b0 25 * \brief SHA-1 context structure
RodColeman 0:8f5825f330b0 26 */
RodColeman 0:8f5825f330b0 27 typedef struct
RodColeman 0:8f5825f330b0 28 {
RodColeman 0:8f5825f330b0 29 unsigned long total[2]; /*!< number of bytes processed */
RodColeman 0:8f5825f330b0 30 unsigned long state[5]; /*!< intermediate digest state */
RodColeman 0:8f5825f330b0 31 unsigned char buffer[64]; /*!< data block being processed */
RodColeman 0:8f5825f330b0 32
RodColeman 0:8f5825f330b0 33 unsigned char ipad[64]; /*!< HMAC: inner padding */
RodColeman 0:8f5825f330b0 34 unsigned char opad[64]; /*!< HMAC: outer padding */
RodColeman 0:8f5825f330b0 35 }
RodColeman 0:8f5825f330b0 36 sha1_context;
RodColeman 0:8f5825f330b0 37
RodColeman 0:8f5825f330b0 38 #ifdef __cplusplus
RodColeman 0:8f5825f330b0 39 extern "C" {
RodColeman 0:8f5825f330b0 40 #endif
RodColeman 0:8f5825f330b0 41
RodColeman 0:8f5825f330b0 42 /*
RodColeman 0:8f5825f330b0 43 * \brief SHA-1 context setup
RodColeman 0:8f5825f330b0 44 *
RodColeman 0:8f5825f330b0 45 * \param ctx context to be initialized
RodColeman 0:8f5825f330b0 46 */
RodColeman 0:8f5825f330b0 47 void sha1_starts( sha1_context *ctx );
RodColeman 0:8f5825f330b0 48
RodColeman 0:8f5825f330b0 49 /*
RodColeman 0:8f5825f330b0 50 * \brief SHA-1 process buffer
RodColeman 0:8f5825f330b0 51 *
RodColeman 0:8f5825f330b0 52 * \param ctx SHA-1 context
RodColeman 0:8f5825f330b0 53 * \param input buffer holding the data
RodColeman 0:8f5825f330b0 54 * \param ilen length of the input data
RodColeman 0:8f5825f330b0 55 */
RodColeman 0:8f5825f330b0 56 void sha1_update( sha1_context *ctx, const unsigned char *input, int ilen );
RodColeman 0:8f5825f330b0 57
RodColeman 0:8f5825f330b0 58 /*
RodColeman 0:8f5825f330b0 59 * \brief SHA-1 final digest
RodColeman 0:8f5825f330b0 60 *
RodColeman 0:8f5825f330b0 61 * \param ctx SHA-1 context
RodColeman 0:8f5825f330b0 62 * \param output SHA-1 checksum result
RodColeman 0:8f5825f330b0 63 */
RodColeman 0:8f5825f330b0 64 void sha1_finish( sha1_context *ctx, unsigned char output[20] );
RodColeman 0:8f5825f330b0 65
RodColeman 0:8f5825f330b0 66 /*
RodColeman 0:8f5825f330b0 67 * \brief Output = SHA-1( input buffer )
RodColeman 0:8f5825f330b0 68 *
RodColeman 0:8f5825f330b0 69 * \param input buffer holding the data
RodColeman 0:8f5825f330b0 70 * \param ilen length of the input data
RodColeman 0:8f5825f330b0 71 * \param output SHA-1 checksum result
RodColeman 0:8f5825f330b0 72 */
RodColeman 0:8f5825f330b0 73 void sha1( const unsigned char *input, int ilen, unsigned char output[20] );
RodColeman 0:8f5825f330b0 74
RodColeman 0:8f5825f330b0 75 #if 0 //No need for that
RodColeman 0:8f5825f330b0 76 /*
RodColeman 0:8f5825f330b0 77 * \brief Output = SHA-1( file contents )
RodColeman 0:8f5825f330b0 78 *
RodColeman 0:8f5825f330b0 79 * \param path input file name
RodColeman 0:8f5825f330b0 80 * \param output SHA-1 checksum result
RodColeman 0:8f5825f330b0 81 *
RodColeman 0:8f5825f330b0 82 * \return 0 if successful, 1 if fopen failed,
RodColeman 0:8f5825f330b0 83 * or 2 if fread failed
RodColeman 0:8f5825f330b0 84 */
RodColeman 0:8f5825f330b0 85 int sha1_file( const char *path, unsigned char output[20] );
RodColeman 0:8f5825f330b0 86 #endif
RodColeman 0:8f5825f330b0 87
RodColeman 0:8f5825f330b0 88 /*
RodColeman 0:8f5825f330b0 89 * \brief SHA-1 HMAC context setup
RodColeman 0:8f5825f330b0 90 *
RodColeman 0:8f5825f330b0 91 * \param ctx HMAC context to be initialized
RodColeman 0:8f5825f330b0 92 * \param key HMAC secret key
RodColeman 0:8f5825f330b0 93 * \param keylen length of the HMAC key
RodColeman 0:8f5825f330b0 94 */
RodColeman 0:8f5825f330b0 95 void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key, int keylen );
RodColeman 0:8f5825f330b0 96
RodColeman 0:8f5825f330b0 97 /*
RodColeman 0:8f5825f330b0 98 * \brief SHA-1 HMAC process buffer
RodColeman 0:8f5825f330b0 99 *
RodColeman 0:8f5825f330b0 100 * \param ctx HMAC context
RodColeman 0:8f5825f330b0 101 * \param input buffer holding the data
RodColeman 0:8f5825f330b0 102 * \param ilen length of the input data
RodColeman 0:8f5825f330b0 103 */
RodColeman 0:8f5825f330b0 104 void sha1_hmac_update( sha1_context *ctx, const unsigned char *input, int ilen );
RodColeman 0:8f5825f330b0 105
RodColeman 0:8f5825f330b0 106 /*
RodColeman 0:8f5825f330b0 107 * \brief SHA-1 HMAC final digest
RodColeman 0:8f5825f330b0 108 *
RodColeman 0:8f5825f330b0 109 * \param ctx HMAC context
RodColeman 0:8f5825f330b0 110 * \param output SHA-1 HMAC checksum result
RodColeman 0:8f5825f330b0 111 */
RodColeman 0:8f5825f330b0 112 void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] );
RodColeman 0:8f5825f330b0 113
RodColeman 0:8f5825f330b0 114 /*
RodColeman 0:8f5825f330b0 115 * \brief SHA-1 HMAC context reset
RodColeman 0:8f5825f330b0 116 *
RodColeman 0:8f5825f330b0 117 * \param ctx HMAC context to be reset
RodColeman 0:8f5825f330b0 118 */
RodColeman 0:8f5825f330b0 119 void sha1_hmac_reset( sha1_context *ctx );
RodColeman 0:8f5825f330b0 120
RodColeman 0:8f5825f330b0 121 /*
RodColeman 0:8f5825f330b0 122 * \brief Output = HMAC-SHA-1( hmac key, input buffer )
RodColeman 0:8f5825f330b0 123 *
RodColeman 0:8f5825f330b0 124 * \param key HMAC secret key
RodColeman 0:8f5825f330b0 125 * \param keylen length of the HMAC key
RodColeman 0:8f5825f330b0 126 * \param input buffer holding the data
RodColeman 0:8f5825f330b0 127 * \param ilen length of the input data
RodColeman 0:8f5825f330b0 128 * \param output HMAC-SHA-1 result
RodColeman 0:8f5825f330b0 129 */
RodColeman 0:8f5825f330b0 130 void sha1_hmac( const unsigned char *key, int keylen,
RodColeman 0:8f5825f330b0 131 const unsigned char *input, int ilen,
RodColeman 0:8f5825f330b0 132 unsigned char output[20] );
RodColeman 0:8f5825f330b0 133
RodColeman 0:8f5825f330b0 134 /*
RodColeman 0:8f5825f330b0 135 * \brief Checkup routine
RodColeman 0:8f5825f330b0 136 *
RodColeman 0:8f5825f330b0 137 * \return 0 if successful, or 1 if the test failed
RodColeman 0:8f5825f330b0 138 */
RodColeman 0:8f5825f330b0 139 int sha1_self_test( int verbose );
RodColeman 0:8f5825f330b0 140
RodColeman 0:8f5825f330b0 141 #ifdef __cplusplus
RodColeman 0:8f5825f330b0 142 }
RodColeman 0:8f5825f330b0 143 #endif
RodColeman 0:8f5825f330b0 144
RodColeman 0:8f5825f330b0 145 #endif /* sha1.h */