HTTPClient using static IP

Dependencies:   mbed

Committer:
mr_q
Date:
Mon May 30 11:53:37 2011 +0000
Revision:
0:d8f2f7d5f31b
v0.01 Draft

Who changed what in which revision?

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