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

Committer:
RodColeman
Date:
Thu Sep 08 10:48:09 2011 +0000
Revision:
0:850eacf3e945
revised fixed length to 178 bytes

Who changed what in which revision?

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