The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netinet/sctp_sha1.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $KAME: sctp_sha1.h,v 1.4 2002/10/09 18:01:22 itojun Exp $       */
    2 /*      $DragonFly: src/sys/netinet/sctp_sha1.h,v 1.2 2006/05/20 02:42:12 dillon Exp $  */
    3 
    4 #ifndef _NETINET_SCTP_SHA1_H_
    5 #define _NETINET_SCTP_SHA1_H_
    6 
    7 /*
    8  * Copyright (c) 2001, 2002, 2004 Cisco Systems, Inc.
    9  * All rights reserved.
   10  *
   11  * Redistribution and use in source and binary forms, with or without
   12  * modification, are permitted provided that the following conditions
   13  * are met:
   14  * 1. Redistributions of source code must retain the above copyright
   15  *    notice, this list of conditions and the following disclaimer.
   16  * 2. Redistributions in binary form must reproduce the above copyright
   17  *    notice, this list of conditions and the following disclaimer in the
   18  *    documentation and/or other materials provided with the distribution.
   19  * 3. All advertising materials mentioning features or use of this software
   20  *    must display the following acknowledgement:
   21  *      This product includes software developed by Cisco Systems, Inc.
   22  * 4. Neither the name of the project nor the names of its contributors
   23  *    may be used to endorse or promote products derived from this software
   24  *    without specific prior written permission.
   25  *
   26  * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
   27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   29  * ARE DISCLAIMED.  IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE
   30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   36  * SUCH DAMAGE.
   37  */
   38 #include <sys/types.h>
   39 
   40 struct sha1_context {
   41         unsigned int A;
   42         unsigned int B;
   43         unsigned int C;
   44         unsigned int D;
   45         unsigned int E;
   46         unsigned int H0;
   47         unsigned int H1;
   48         unsigned int H2;
   49         unsigned int H3;
   50         unsigned int H4;
   51         unsigned int words[80];
   52         unsigned int TEMP;
   53         /* block I am collecting to process */
   54         char sha_block[64];
   55         /* collected so far */
   56         int how_many_in_block;
   57         unsigned int running_total;
   58 };
   59 
   60 
   61 #define F1(B,C,D) (((B & C) | ((~B) & D)))      /*  0  <= t <= 19 */
   62 #define F2(B,C,D) (B ^ C ^ D)                   /*  20 <= t <= 39 */
   63 #define F3(B,C,D) ((B & C) | (B & D) | (C & D)) /*  40 <= t <= 59 */
   64 #define F4(B,C,D) (B ^ C ^ D)                   /* 600 <= t <= 79 */
   65 
   66 /* circular shift */
   67 #define CSHIFT(A,B) ((B << A) | (B >> (32-A)))
   68 
   69 #define K1 0x5a827999       /* 0  <= t <= 19 */
   70 #define K2 0x6ed9eba1       /* 20 <= t <= 39 */
   71 #define K3 0x8f1bbcdc       /* 40 <= t <= 59 */
   72 #define K4 0xca62c1d6       /* 60 <= t <= 79 */
   73 
   74 #define H0INIT 0x67452301
   75 #define H1INIT 0xefcdab89
   76 #define H2INIT 0x98badcfe
   77 #define H3INIT 0x10325476
   78 #define H4INIT 0xc3d2e1f0
   79 
   80 #if defined(_KERNEL) || (defined(__APPLE__) && defined(KERNEL))
   81 
   82 void SHA1_Init(struct sha1_context *);
   83 void SHA1_Process(struct sha1_context *, unsigned char *, int);
   84 void SHA1_Final(struct sha1_context *, unsigned char *);
   85 
   86 #endif /* _KERNEL */
   87 #endif

Cache object: 2c96a3ef808e49a4d014f400c722aa65


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.