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/crypto/rijndael/rijndael-api-fst.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 /*      $FreeBSD: releng/9.0/sys/crypto/rijndael/rijndael-api-fst.h 143420 2005-03-11 16:26:10Z ume $   */
    2 /*      $KAME: rijndael-api-fst.h,v 1.6 2001/05/27 00:23:23 itojun Exp $        */
    3 
    4 /*
    5  * rijndael-api-fst.h   v2.3   April '2000
    6  *
    7  * Optimised ANSI C code
    8  *
    9  */
   10 
   11 #ifndef __RIJNDAEL_API_FST_H
   12 #define __RIJNDAEL_API_FST_H
   13 
   14 #include <crypto/rijndael/rijndael.h>
   15 
   16 /*  Generic Defines  */
   17 #define     DIR_ENCRYPT           0 /*  Are we encrpyting?  */
   18 #define     DIR_DECRYPT           1 /*  Are we decrpyting?  */
   19 #define     MODE_ECB              1 /*  Are we ciphering in ECB mode?   */
   20 #define     MODE_CBC              2 /*  Are we ciphering in CBC mode?   */
   21 #define     MODE_CFB1             3 /*  Are we ciphering in 1-bit CFB mode? */
   22 #define     BITSPERBLOCK        128 /* Default number of bits in a cipher block */
   23 
   24 /*  Error Codes  */
   25 #define     BAD_KEY_DIR          -1 /*  Key direction is invalid, e.g., unknown value */
   26 #define     BAD_KEY_MAT          -2 /*  Key material not of correct length */
   27 #define     BAD_KEY_INSTANCE     -3 /*  Key passed is not valid */
   28 #define     BAD_CIPHER_MODE      -4 /*  Params struct passed to cipherInit invalid */
   29 #define     BAD_CIPHER_STATE     -5 /*  Cipher in wrong state (e.g., not initialized) */
   30 #define     BAD_BLOCK_LENGTH     -6
   31 #define     BAD_CIPHER_INSTANCE  -7
   32 #define     BAD_DATA             -8 /*  Data contents are invalid, e.g., invalid padding */
   33 #define     BAD_OTHER            -9 /*  Unknown error */
   34 
   35 /*  Algorithm-specific Defines  */
   36 #define     RIJNDAEL_MAX_KEY_SIZE         64 /* # of ASCII char's needed to represent a key */
   37 #define     RIJNDAEL_MAX_IV_SIZE          16 /* # bytes needed to represent an IV  */
   38 
   39 /*  Typedefs  */
   40 
   41 /*  The structure for key information */
   42 typedef struct {
   43     u_int8_t  direction;            /* Key used for encrypting or decrypting? */
   44     int   keyLen;                   /* Length of the key  */
   45     char  keyMaterial[RIJNDAEL_MAX_KEY_SIZE+1];  /* Raw key data in ASCII, e.g., user input or KAT values */
   46         int   Nr;                       /* key-length-dependent number of rounds */
   47         u_int32_t   rk[4*(RIJNDAEL_MAXNR + 1)];        /* key schedule */
   48         u_int32_t   ek[4*(RIJNDAEL_MAXNR + 1)];        /* CFB1 key schedule (encryption only) */
   49 } keyInstance;
   50 
   51 /*  The structure for cipher information */
   52 typedef struct {                    /* changed order of the components */
   53     u_int8_t mode;                  /* MODE_ECB, MODE_CBC, or MODE_CFB1 */
   54     u_int8_t IV[RIJNDAEL_MAX_IV_SIZE]; /* A possible Initialization Vector for ciphering */
   55 } cipherInstance;
   56 
   57 /*  Function prototypes  */
   58 
   59 int rijndael_makeKey(keyInstance *, u_int8_t, int, char *);
   60 
   61 int rijndael_cipherInit(cipherInstance *, u_int8_t, char *);
   62 
   63 int rijndael_blockEncrypt(cipherInstance *, keyInstance *, u_int8_t *, int,
   64         u_int8_t *);
   65 int rijndael_padEncrypt(cipherInstance *, keyInstance *, u_int8_t *, int,
   66         u_int8_t *);
   67 
   68 int rijndael_blockDecrypt(cipherInstance *, keyInstance *, u_int8_t *, int,
   69         u_int8_t *);
   70 int rijndael_padDecrypt(cipherInstance *, keyInstance *, u_int8_t *, int,
   71         u_int8_t *);
   72 
   73 #endif /*  __RIJNDAEL_API_FST_H */

Cache object: 0eaea051a0d701069951fbb62b06e7c6


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