Deleted Added
full compact
sha1.c (59107) sha1.c (62587)
1/* $FreeBSD: head/sys/crypto/sha1.c 62587 2000-07-04 16:35:15Z itojun $ */
2/* $KAME: sha1.c,v 1.4 2000/03/27 04:36:23 sumikawa Exp $ */
3
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.
4/*
5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright

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

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

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

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

--- 35 unchanged lines hidden ---