~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/sha1.c

Moved my_sys/my_pthread/my_nosys and mysys_err to mysys.

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
*/
82
82
 
83
83
 
84
 
const uint32 sha_const_key[5]=
 
84
const uint32_t sha_const_key[5]=
85
85
{
86
86
  0x67452301,
87
87
  0xEFCDAB89,
127
127
*/
128
128
 
129
129
int mysql_sha1_result(SHA1_CONTEXT *context,
130
 
                      uint8 Message_Digest[SHA1_HASH_SIZE])
 
130
                      uint8_t Message_Digest[SHA1_HASH_SIZE])
131
131
{
132
132
  int i;
133
133
 
141
141
  }
142
142
 
143
143
  for (i = 0; i < SHA1_HASH_SIZE; i++)
144
 
    Message_Digest[i] = (int8)((context->Intermediate_Hash[i>>2] >> 8
 
144
    Message_Digest[i] = (int8_t)((context->Intermediate_Hash[i>>2] >> 8
145
145
                         * ( 3 - ( i & 0x03 ) )));
146
146
  return SHA_SUCCESS;
147
147
}
162
162
   != SHA_SUCCESS       sha Error Code.
163
163
*/
164
164
 
165
 
int mysql_sha1_input(SHA1_CONTEXT *context, const uint8 *message_array,
 
165
int mysql_sha1_input(SHA1_CONTEXT *context, const uint8_t *message_array,
166
166
                     unsigned length)
167
167
{
168
168
  if (!length)
197
197
*/
198
198
 
199
199
/* Constants defined in SHA-1   */
200
 
static const uint32  K[]=
 
200
static const uint32_t  K[]=
201
201
{
202
202
  0x5A827999,
203
203
  0x6ED9EBA1,
209
209
static void SHA1ProcessMessageBlock(SHA1_CONTEXT *context)
210
210
{
211
211
  int           t;                 /* Loop counter                */
212
 
  uint32        temp;              /* Temporary word value        */
213
 
  uint32        W[80];             /* Word sequence               */
214
 
  uint32        A, B, C, D, E;     /* Word buffers                */
 
212
  uint32_t      temp;              /* Temporary word value        */
 
213
  uint32_t      W[80];             /* Word sequence               */
 
214
  uint32_t      A, B, C, D, E;     /* Word buffers                */
215
215
  int idx;
216
216
 
217
217
  /*
346
346
    Store the message length as the last 8 octets
347
347
  */
348
348
 
349
 
  context->Message_Block[56] = (int8) (context->Length >> 56);
350
 
  context->Message_Block[57] = (int8) (context->Length >> 48);
351
 
  context->Message_Block[58] = (int8) (context->Length >> 40);
352
 
  context->Message_Block[59] = (int8) (context->Length >> 32);
353
 
  context->Message_Block[60] = (int8) (context->Length >> 24);
354
 
  context->Message_Block[61] = (int8) (context->Length >> 16);
355
 
  context->Message_Block[62] = (int8) (context->Length >> 8);
356
 
  context->Message_Block[63] = (int8) (context->Length);
 
349
  context->Message_Block[56] = (int8_t) (context->Length >> 56);
 
350
  context->Message_Block[57] = (int8_t) (context->Length >> 48);
 
351
  context->Message_Block[58] = (int8_t) (context->Length >> 40);
 
352
  context->Message_Block[59] = (int8_t) (context->Length >> 32);
 
353
  context->Message_Block[60] = (int8_t) (context->Length >> 24);
 
354
  context->Message_Block[61] = (int8_t) (context->Length >> 16);
 
355
  context->Message_Block[62] = (int8_t) (context->Length >> 8);
 
356
  context->Message_Block[63] = (int8_t) (context->Length);
357
357
 
358
358
  SHA1ProcessMessageBlock(context);
359
359
}