SQL Client with VodafoneUSBModem

Fork of MySQLClient by Donatien Garnier

Committer:
donatien
Date:
Thu Aug 05 15:16:36 2010 +0000
Revision:
5:91c24a06d12c
Parent:
0:403b85869e53

        

Who changed what in which revision?

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