Deleted Added
sdiff udiff text old ( 59107 ) new ( 62587 )
full compact
1/*
2 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: head/sys/crypto/sha1.c 59107 2000-04-09 20:10:55Z archie $
30 */
31/*
32 * FIPS pub 180-1: Secure Hash Algorithm (SHA-1)
33 * based on: http://csrc.nist.gov/fips/fip180-1.txt
34 * implemented by Jun-ichiro itojun Itoh <itojun@itojun.org>
35 */
36
37#include <sys/types.h>

--- 175 unchanged lines hidden (view full) ---

213 PUTPAD(ctxt->c.b8[7]); PUTPAD(ctxt->c.b8[6]);
214 PUTPAD(ctxt->c.b8[5]); PUTPAD(ctxt->c.b8[4]);
215 PUTPAD(ctxt->c.b8[3]); PUTPAD(ctxt->c.b8[2]);
216 PUTPAD(ctxt->c.b8[1]); PUTPAD(ctxt->c.b8[0]);
217#endif
218}
219
220void
221sha1_loop(ctxt, input, len)
222 struct sha1_ctxt *ctxt;
223 const u_char *input;
224 size_t len;
225{
226 size_t gaplen;
227 size_t gapstart;
228 size_t off;
229 size_t copysiz;
230
231 off = 0;
232
233 while (off < len) {
234 gapstart = COUNT % 64;
235 gaplen = 64 - gapstart;
236
237 copysiz = (gaplen < len - off) ? gaplen : len - off;
238 bcopy(&input[off], &ctxt->m.b8[gapstart], copysiz);

--- 35 unchanged lines hidden ---