Project

General

Profile

Bug #9659 ยป 002-builtin-indicate-digest-failure.patch

View differences:

ext/digest/md5/md5.c
350 350
    pms->state[3] += d;
351 351
}
352 352

  
353
void
353
int
354 354
MD5_Init(MD5_CTX *pms)
355 355
{
356 356
    pms->count[0] = pms->count[1] = 0;
......
358 358
    pms->state[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476;
359 359
    pms->state[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301;
360 360
    pms->state[3] = 0x10325476;
361
    return 1;
361 362
}
362 363

  
363 364
void
......
398 399
	memcpy(pms->buffer, p, left);
399 400
}
400 401

  
401
void
402
int
402 403
MD5_Finish(MD5_CTX *pms, uint8_t *digest)
403 404
{
404 405
    static const uint8_t pad[64] = {
......
419 420
    MD5_Update(pms, data, 8);
420 421
    for (i = 0; i < 16; ++i)
421 422
	digest[i] = (uint8_t)(pms->state[i >> 2] >> ((i & 3) << 3));
423
    return 1;
422 424
}
ext/digest/md5/md5.h
69 69
#define MD5_Finish	rb_Digest_MD5_Finish
70 70
#endif
71 71

  
72
void	MD5_Init _((MD5_CTX *pms));
72
int	MD5_Init _((MD5_CTX *pms));
73 73
void	MD5_Update _((MD5_CTX *pms, const uint8_t *data, size_t nbytes));
74
void	MD5_Finish _((MD5_CTX *pms, uint8_t *digest));
74
int	MD5_Finish _((MD5_CTX *pms, uint8_t *digest));
75 75

  
76 76
#define MD5_BLOCK_LENGTH		64
77 77
#define MD5_DIGEST_LENGTH		16
ext/digest/rmd160/rmd160.c
124 124

  
125 125
/********************************************************************/
126 126

  
127
void
127
int
128 128
RMD160_Init(RMD160_CTX *context)
129 129
{
130 130

  
......
138 138
	context->state[4] = 0xc3d2e1f0U;
139 139
	context->length[0] = context->length[1] = 0;
140 140
	context->buflen = 0;
141
	return 1;
141 142
}
142 143

  
143 144
/********************************************************************/
......
412 413

  
413 414
/********************************************************************/
414 415

  
415
void
416
int
416 417
RMD160_Finish(RMD160_CTX *context, uint8_t digest[20])
417 418
{
418 419
	uint32_t i;
......
456 457
			digest[i + 3] = (context->state[i>>2] >> 24);
457 458
		}
458 459
	}
460
	return 1;
459 461
}
460 462

  
461 463
/************************ end of file rmd160.c **********************/
ext/digest/rmd160/rmd160.h
43 43
#endif
44 44

  
45 45
__BEGIN_DECLS
46
void	RMD160_Init _((RMD160_CTX *));
46
int	RMD160_Init _((RMD160_CTX *));
47 47
void	RMD160_Transform _((uint32_t[5], const uint32_t[16]));
48 48
void	RMD160_Update _((RMD160_CTX *, const uint8_t *, size_t));
49
void	RMD160_Finish _((RMD160_CTX *, uint8_t[20]));
49
int	RMD160_Finish _((RMD160_CTX *, uint8_t[20]));
50 50
__END_DECLS
51 51

  
52 52
#define RMD160_BLOCK_LENGTH             64
ext/digest/sha1/sha1.c
199 199
/*
200 200
 * SHA1_Init - Initialize new context
201 201
 */
202
void SHA1_Init(SHA1_CTX *context)
202
int SHA1_Init(SHA1_CTX *context)
203 203
{
204 204

  
205 205
    _DIAGASSERT(context != 0);
......
211 211
    context->state[3] = 0x10325476;
212 212
    context->state[4] = 0xC3D2E1F0;
213 213
    context->count[0] = context->count[1] = 0;
214
    return 1;
214 215
}
215 216

  
216 217

  
......
244 245
/*
245 246
 * Add padding and return the message digest.
246 247
 */
247
void SHA1_Finish(SHA1_CTX* context, uint8_t digest[20])
248
int SHA1_Finish(SHA1_CTX* context, uint8_t digest[20])
248 249
{
249 250
    size_t i;
250 251
    uint8_t finalcount[8];
......
266 267
	    digest[i] = (uint8_t)
267 268
		((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
268 269
    }
270
    return 1;
269 271
}
ext/digest/sha1/sha1.h
28 28
#endif
29 29

  
30 30
void	SHA1_Transform _((uint32_t state[5], const uint8_t buffer[64]));
31
void	SHA1_Init _((SHA1_CTX *context));
31
int	SHA1_Init _((SHA1_CTX *context));
32 32
void	SHA1_Update _((SHA1_CTX *context, const uint8_t *data, size_t len));
33
void	SHA1_Finish _((SHA1_CTX *context, uint8_t digest[20]));
33
int	SHA1_Finish _((SHA1_CTX *context, uint8_t digest[20]));
34 34

  
35 35
#define SHA1_BLOCK_LENGTH		64
36 36
#define SHA1_DIGEST_LENGTH		20
ext/digest/sha2/sha2.c
341 341

  
342 342

  
343 343
/*** SHA-256: *********************************************************/
344
void SHA256_Init(SHA256_CTX* context) {
344
int SHA256_Init(SHA256_CTX* context) {
345 345
	if (context == (SHA256_CTX*)0) {
346
		return;
346
	  return 0;
347 347
	}
348 348
	MEMCPY_BCOPY(context->state, sha256_initial_hash_value, SHA256_DIGEST_LENGTH);
349 349
	MEMSET_BZERO(context->buffer, SHA256_BLOCK_LENGTH);
350 350
	context->bitcount = 0;
351
	return 1;
351 352
}
352 353

  
353 354
#ifdef SHA2_UNROLL_TRANSFORM
......
574 575
	usedspace = freespace = 0;
575 576
}
576 577

  
577
void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
578
int SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
578 579
	sha2_word32	*d = (sha2_word32*)digest;
579 580
	unsigned int	usedspace;
580 581

  
......
636 637
	/* Clean up state data: */
637 638
	MEMSET_BZERO(context, sizeof(*context));
638 639
	usedspace = 0;
640
	return 1;
639 641
}
640 642

  
641 643
char *SHA256_End(SHA256_CTX* context, char buffer[]) {
......
670 672

  
671 673

  
672 674
/*** SHA-512: *********************************************************/
673
void SHA512_Init(SHA512_CTX* context) {
675
int SHA512_Init(SHA512_CTX* context) {
674 676
	if (context == (SHA512_CTX*)0) {
675
		return;
677
	  return 0;
676 678
	}
677 679
	MEMCPY_BCOPY(context->state, sha512_initial_hash_value, SHA512_DIGEST_LENGTH);
678 680
	MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH);
679 681
	context->bitcount[0] = context->bitcount[1] =  0;
682
	return 1;
680 683
}
681 684

  
682 685
#ifdef SHA2_UNROLL_TRANSFORM
......
940 943
	SHA512_Transform(context, (sha2_word64*)context->buffer);
941 944
}
942 945

  
943
void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
946
int SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
944 947
	sha2_word64	*d = (sha2_word64*)digest;
945 948

  
946 949
	/* Sanity check: */
......
967 970

  
968 971
	/* Zero out state data */
969 972
	MEMSET_BZERO(context, sizeof(*context));
973
	return 1;
970 974
}
971 975

  
972 976
char *SHA512_End(SHA512_CTX* context, char buffer[]) {
......
1001 1005

  
1002 1006

  
1003 1007
/*** SHA-384: *********************************************************/
1004
void SHA384_Init(SHA384_CTX* context) {
1008
int SHA384_Init(SHA384_CTX* context) {
1005 1009
	if (context == (SHA384_CTX*)0) {
1006
		return;
1010
	  return 0;
1007 1011
	}
1008 1012
	MEMCPY_BCOPY(context->state, sha384_initial_hash_value, SHA512_DIGEST_LENGTH);
1009 1013
	MEMSET_BZERO(context->buffer, SHA384_BLOCK_LENGTH);
1010 1014
	context->bitcount[0] = context->bitcount[1] = 0;
1015
	return 1;
1011 1016
}
1012 1017

  
1013 1018
void SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) {
1014 1019
	SHA512_Update((SHA512_CTX*)context, data, len);
1015 1020
}
1016 1021

  
1017
void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
1022
int SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
1018 1023
	sha2_word64	*d = (sha2_word64*)digest;
1019 1024

  
1020 1025
	/* Sanity check: */
......
1041 1046

  
1042 1047
	/* Zero out state data */
1043 1048
	MEMSET_BZERO(context, sizeof(*context));
1049
	return 1;
1044 1050
}
1045 1051

  
1046 1052
char *SHA384_End(SHA384_CTX* context, char buffer[]) {
ext/digest/sha2/sha2.h
165 165

  
166 166
#ifndef NOPROTO
167 167

  
168
void SHA256_Init(SHA256_CTX *);
168
int SHA256_Init(SHA256_CTX *);
169 169
void SHA256_Update(SHA256_CTX*, const uint8_t*, size_t);
170
void SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*);
170
int SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*);
171 171
char* SHA256_End(SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]);
172 172
char* SHA256_Data(const uint8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]);
173 173

  
174
void SHA384_Init(SHA384_CTX*);
174
int SHA384_Init(SHA384_CTX*);
175 175
void SHA384_Update(SHA384_CTX*, const uint8_t*, size_t);
176
void SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*);
176
int SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*);
177 177
char* SHA384_End(SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]);
178 178
char* SHA384_Data(const uint8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]);
179 179

  
180
void SHA512_Init(SHA512_CTX*);
180
int SHA512_Init(SHA512_CTX*);
181 181
void SHA512_Update(SHA512_CTX*, const uint8_t*, size_t);
182
void SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
182
int SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*);
183 183
char* SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]);
184 184
char* SHA512_Data(const uint8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]);
185 185

  
186 186
#else /* NOPROTO */
187 187

  
188
void SHA256_Init();
188
int SHA256_Init();
189 189
void SHA256_Update();
190 190
#ifdef RUBY
191
void SHA256_Finish();
191
int SHA256_Finish();
192 192
#else
193
void SHA256_Final();
193
int SHA256_Final();
194 194
#endif /* RUBY */
195 195
char* SHA256_End();
196 196
char* SHA256_Data();
197 197

  
198
void SHA384_Init();
198
int SHA384_Init();
199 199
void SHA384_Update();
200 200
#ifdef RUBY
201
void SHA384_Finish();
201
int SHA384_Finish();
202 202
#else
203
void SHA384_Final();
203
int SHA384_Final();
204 204
#endif /* RUBY */
205 205
char* SHA384_End();
206 206
char* SHA384_Data();
207 207

  
208
void SHA512_Init();
208
int SHA512_Init();
209 209
void SHA512_Update();
210 210
#ifdef RUBY
211
void SHA512_Finish();
211
int SHA512_Finish();
212 212
#else
213
void SHA512_Final();
213
int SHA512_Final();
214 214
#endif /* RUBY */
215 215
char* SHA512_End();
216 216
char* SHA512_Data();