Experimental HTTPClient with proxy support

Committer:
igorsk
Date:
Wed Jun 29 16:01:58 2011 +0000
Revision:
0:b56b6a05cad4

        

Who changed what in which revision?

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