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/opencrypto/xform.c

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 /*      $NetBSD: xform.c,v 1.15 2005/11/25 16:16:46 thorpej Exp $ */
    2 /*      $FreeBSD: src/sys/opencrypto/xform.c,v 1.1.2.1 2002/11/21 23:34:23 sam Exp $    */
    3 /*      $OpenBSD: xform.c,v 1.19 2002/08/16 22:47:25 dhartmei Exp $     */
    4 
    5 /*
    6  * The authors of this code are John Ioannidis (ji@tla.org),
    7  * Angelos D. Keromytis (kermit@csd.uch.gr) and
    8  * Niels Provos (provos@physnet.uni-hamburg.de).
    9  *
   10  * This code was written by John Ioannidis for BSD/OS in Athens, Greece,
   11  * in November 1995.
   12  *
   13  * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,
   14  * by Angelos D. Keromytis.
   15  *
   16  * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis
   17  * and Niels Provos.
   18  *
   19  * Additional features in 1999 by Angelos D. Keromytis.
   20  *
   21  * Copyright (C) 1995, 1996, 1997, 1998, 1999 by John Ioannidis,
   22  * Angelos D. Keromytis and Niels Provos.
   23  *
   24  * Copyright (C) 2001, Angelos D. Keromytis.
   25  *
   26  * Permission to use, copy, and modify this software with or without fee
   27  * is hereby granted, provided that this entire notice is included in
   28  * all copies of any software which is or includes a copy or
   29  * modification of this software.
   30  * You may use this code under the GNU public license if you so wish. Please
   31  * contribute changes back to the authors under this freer than GPL license
   32  * so that we may further the use of strong encryption without limitations to
   33  * all.
   34  *
   35  * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR
   36  * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY
   37  * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE
   38  * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR
   39  * PURPOSE.
   40  */
   41 
   42 #include <sys/cdefs.h>
   43 __KERNEL_RCSID(0, "$NetBSD: xform.c,v 1.15 2005/11/25 16:16:46 thorpej Exp $");
   44 
   45 #include <sys/param.h>
   46 #include <sys/malloc.h>
   47 
   48 #include <opencrypto/cryptodev.h>
   49 #include <opencrypto/xform.h>
   50 
   51 MALLOC_DEFINE(M_XDATA, "xform", "xform data buffers");
   52 
   53 const u_int8_t hmac_ipad_buffer[64] = {
   54         0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
   55         0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
   56         0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
   57         0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
   58         0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
   59         0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
   60         0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
   61         0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36
   62 };
   63 
   64 const u_int8_t hmac_opad_buffer[64] = {
   65         0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
   66         0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
   67         0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
   68         0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
   69         0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
   70         0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
   71         0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C,
   72         0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C
   73 };
   74 
   75 /* Encryption instances */
   76 struct enc_xform enc_xform_null = {
   77         CRYPTO_NULL_CBC, "NULL",
   78         /* NB: blocksize of 4 is to generate a properly aligned ESP header */
   79         4, 0, 256 /* 2048 bits, max key */
   80 };
   81 
   82 struct enc_xform enc_xform_des = {
   83         CRYPTO_DES_CBC, "DES",
   84         8, 8, 8
   85 };
   86 
   87 struct enc_xform enc_xform_3des = {
   88         CRYPTO_3DES_CBC, "3DES",
   89         8, 24, 24
   90 };
   91 
   92 struct enc_xform enc_xform_blf = {
   93         CRYPTO_BLF_CBC, "Blowfish",
   94         8, 5, 56 /* 448 bits, max key */
   95 };
   96 
   97 struct enc_xform enc_xform_cast5 = {
   98         CRYPTO_CAST_CBC, "CAST-128",
   99         8, 5, 16
  100 };
  101 
  102 struct enc_xform enc_xform_skipjack = {
  103         CRYPTO_SKIPJACK_CBC, "Skipjack",
  104         8, 10, 10
  105 };
  106 
  107 struct enc_xform enc_xform_rijndael128 = {
  108         CRYPTO_RIJNDAEL128_CBC, "Rijndael-128/AES",
  109         16, 8, 32
  110 };
  111 
  112 struct enc_xform enc_xform_arc4 = {
  113         CRYPTO_ARC4, "ARC4",
  114         1, 1, 32
  115 };
  116 
  117 /* Authentication instances */
  118 struct auth_hash auth_hash_null = {
  119         CRYPTO_NULL_HMAC, "NULL-HMAC",
  120         0, 0, 12, sizeof(int)                   /* NB: context isn't used */
  121 };
  122 
  123 struct auth_hash auth_hash_hmac_md5_96 = {
  124         CRYPTO_MD5_HMAC, "HMAC-MD5",
  125         16, 16, 12, sizeof(MD5_CTX)
  126 };
  127 
  128 struct auth_hash auth_hash_hmac_sha1_96 = {
  129         CRYPTO_SHA1_HMAC, "HMAC-SHA1",
  130         20, 20, 12, sizeof(SHA1_CTX)
  131 };
  132 
  133 struct auth_hash auth_hash_hmac_ripemd_160_96 = {
  134         CRYPTO_RIPEMD160_HMAC, "HMAC-RIPEMD-160",
  135         20, 20, 12, sizeof(RMD160_CTX)
  136 };
  137 
  138 struct auth_hash auth_hash_key_md5 = {
  139         CRYPTO_MD5_KPDK, "Keyed MD5",
  140         0, 16, 16, sizeof(MD5_CTX)
  141 };
  142 
  143 struct auth_hash auth_hash_key_sha1 = {
  144         CRYPTO_SHA1_KPDK, "Keyed SHA1",
  145         0, 20, 20, sizeof(SHA1_CTX)
  146 };
  147 
  148 struct auth_hash auth_hash_md5 = {
  149         CRYPTO_MD5, "MD5",
  150         0, 16, 16, sizeof(MD5_CTX)
  151 };
  152 
  153 struct auth_hash auth_hash_sha1 = {
  154         CRYPTO_SHA1, "SHA1",
  155         0, 20, 20, sizeof(SHA1_CTX)
  156 };
  157 
  158 struct auth_hash auth_hash_hmac_sha2_256 = {
  159         CRYPTO_SHA2_HMAC, "HMAC-SHA2",
  160         32, 32, 12, sizeof(SHA256_CTX)
  161 };
  162 
  163 struct auth_hash auth_hash_hmac_sha2_384 = {
  164         CRYPTO_SHA2_HMAC, "HMAC-SHA2-384",
  165         48, 48, 12, sizeof(SHA384_CTX)
  166 };
  167 
  168 struct auth_hash auth_hash_hmac_sha2_512 = {
  169         CRYPTO_SHA2_HMAC, "HMAC-SHA2-512",
  170         64, 64, 12, sizeof(SHA512_CTX)
  171 };
  172 
  173 /* Compression instance */
  174 struct comp_algo comp_algo_deflate = {
  175         CRYPTO_DEFLATE_COMP, "Deflate",
  176         90
  177 };

Cache object: 79e650a7159088fe0e967c21f13024e3


[ 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.