sha1c.c (84211) | sha1c.c (92913) |
---|---|
1/* crypto/sha/sha1dgst.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 43 unchanged lines hidden (view full) --- 52 * 53 * The licence and distribution terms for any publically available version or 54 * derivative of this code cannot be changed. i.e. this code cannot simply be 55 * copied and put under another distribution licence 56 * [including the GNU Public Licence.] 57 */ 58 59#include <sys/cdefs.h> | 1/* crypto/sha/sha1dgst.c */ 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 3 * All rights reserved. 4 * 5 * This package is an SSL implementation written 6 * by Eric Young (eay@cryptsoft.com). 7 * The implementation was written so as to conform with Netscapes SSL. 8 * --- 43 unchanged lines hidden (view full) --- 52 * 53 * The licence and distribution terms for any publically available version or 54 * derivative of this code cannot be changed. i.e. this code cannot simply be 55 * copied and put under another distribution licence 56 * [including the GNU Public Licence.] 57 */ 58 59#include <sys/cdefs.h> |
60__FBSDID("$FreeBSD: head/lib/libmd/sha1c.c 84211 2001-09-30 21:56:22Z dillon $"); | 60__FBSDID("$FreeBSD: head/lib/libmd/sha1c.c 92913 2002-03-21 23:39:28Z obrien $"); |
61 62#include <sys/types.h> 63 64#include <stdio.h> 65#include <string.h> 66 67#if 0 68#include <machine/ansi.h> /* we use the __ variants of bit-sized types */ --- 74 unchanged lines hidden (view full) --- 143 } 144 145void 146SHA1_Update(c, data, len) 147 SHA_CTX *c; 148 const unsigned char *data; 149 size_t len; 150{ | 61 62#include <sys/types.h> 63 64#include <stdio.h> 65#include <string.h> 66 67#if 0 68#include <machine/ansi.h> /* we use the __ variants of bit-sized types */ --- 74 unchanged lines hidden (view full) --- 143 } 144 145void 146SHA1_Update(c, data, len) 147 SHA_CTX *c; 148 const unsigned char *data; 149 size_t len; 150{ |
151 register u_int32_t *p; | 151 u_int32_t *p; |
152 int ew,ec,sw,sc; 153 u_int32_t l; 154 155 if (len == 0) return; 156 157 l=(c->Nl+(len<<3))&0xffffffffL; 158 if (l < c->Nl) /* overflow */ 159 c->Nh++; --- 156 unchanged lines hidden (view full) --- 316#ifndef SHA1_ASM 317 318void 319sha1_block(c, W, num) 320 SHA_CTX *c; 321 const u_int32_t *W; 322 int num; 323{ | 152 int ew,ec,sw,sc; 153 u_int32_t l; 154 155 if (len == 0) return; 156 157 l=(c->Nl+(len<<3))&0xffffffffL; 158 if (l < c->Nl) /* overflow */ 159 c->Nh++; --- 156 unchanged lines hidden (view full) --- 316#ifndef SHA1_ASM 317 318void 319sha1_block(c, W, num) 320 SHA_CTX *c; 321 const u_int32_t *W; 322 int num; 323{ |
324 register u_int32_t A,B,C,D,E,T; | 324 u_int32_t A,B,C,D,E,T; |
325 u_int32_t X[16]; 326 327 A=c->h0; 328 B=c->h1; 329 C=c->h2; 330 D=c->h3; 331 E=c->h4; 332 --- 102 unchanged lines hidden (view full) --- 435 } 436 } 437#endif 438 439void SHA1_Final(md, c) 440unsigned char *md; 441SHA_CTX *c; 442 { | 325 u_int32_t X[16]; 326 327 A=c->h0; 328 B=c->h1; 329 C=c->h2; 330 D=c->h3; 331 E=c->h4; 332 --- 102 unchanged lines hidden (view full) --- 435 } 436 } 437#endif 438 439void SHA1_Final(md, c) 440unsigned char *md; 441SHA_CTX *c; 442 { |
443 register int i,j; 444 register u_int32_t l; 445 register u_int32_t *p; | 443 int i,j; 444 u_int32_t l; 445 u_int32_t *p; |
446 static unsigned char end[4]={0x80,0x00,0x00,0x00}; 447 unsigned char *cp=end; 448 449 /* c->num should definitly have room for at least one more byte. */ 450 p=c->data; 451 j=c->num; 452 i=j>>2; 453#ifdef PURIFY --- 36 unchanged lines hidden --- | 446 static unsigned char end[4]={0x80,0x00,0x00,0x00}; 447 unsigned char *cp=end; 448 449 /* c->num should definitly have room for at least one more byte. */ 450 p=c->data; 451 j=c->num; 452 i=j>>2; 453#ifdef PURIFY --- 36 unchanged lines hidden --- |