I have a problem getting this to work. Server only recieves half of the data being sent. Whats wrong

Dependencies:   mbed

Committer:
tax
Date:
Tue Mar 29 13:20:15 2011 +0000
Revision:
0:66300c77c6e9

        

Who changed what in which revision?

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