"Fossies" - the Fresh Open Source Software Archive

Member "src/Common/GfMul.h" (10 Oct 2018, 1967 Bytes) of package /windows/misc/VeraCrypt_1.23-Hotfix-2_Source.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "GfMul.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  ---------------------------------------------------------------------------
    3  Copyright (c) 2003, Dr Brian Gladman, Worcester, UK.   All rights reserved.
    4 
    5  LICENSE TERMS
    6 
    7  The free distribution and use of this software is allowed (with or without
    8  changes) provided that:
    9 
   10   1. source code distributions include the above copyright notice, this
   11      list of conditions and the following disclaimer;
   12 
   13   2. binary distributions include the above copyright notice, this list
   14      of conditions and the following disclaimer in their documentation;
   15 
   16   3. the name of the copyright holder is not used to endorse products
   17      built using this software without specific written permission.
   18 
   19  DISCLAIMER
   20 
   21  This software is provided 'as is' with no explicit or implied warranties
   22  in respect of its properties, including, but not limited to, correctness
   23  and/or fitness for purpose.
   24  ---------------------------------------------------------------------------
   25  Issue Date: 31/01/2004
   26 */
   27 
   28 /* Adapted for TrueCrypt */
   29 
   30 #ifndef _GCM_H
   31 #define _GCM_H
   32 
   33 #include "Tcdefs.h"
   34 
   35 #if defined(__cplusplus)
   36 extern "C"
   37 {
   38 #endif
   39 
   40 #define CBLK_LEN   16  /* encryption block length */
   41 #define CBLK_LEN8  8
   42 
   43 typedef struct
   44 {
   45     unsigned __int32 gf_t8k[CBLK_LEN * 2][16][CBLK_LEN / 4];
   46 } GfCtx8k;
   47 
   48 typedef struct
   49 {
   50         unsigned __int32 gf_t4k[CBLK_LEN8 * 2][16][CBLK_LEN / 4];
   51 } GfCtx4k64;
   52 
   53 typedef struct
   54 {
   55     /* union not used to support faster mounting */
   56     unsigned __int32 gf_t128[CBLK_LEN * 2 / 2][16][CBLK_LEN / 4];
   57     unsigned __int32 gf_t64[CBLK_LEN8 * 2][16][CBLK_LEN8 / 4];
   58 } GfCtx;
   59 
   60 typedef int  ret_type;
   61 
   62 void GfMul128 (void *a, const void* b);
   63 void GfMul128Tab(unsigned char a[16], GfCtx8k *ctx);
   64 int Gf128Tab64Init (unsigned __int8 *a, GfCtx *ctx);
   65 void Gf128MulBy64Tab (unsigned __int8 a[8], unsigned __int8 p[16], GfCtx *ctx);
   66 void MirrorBits128 (unsigned __int8 *a);
   67 void MirrorBits64 (unsigned __int8 *a);
   68 BOOL GfMulSelfTest ();
   69 
   70 #if defined(__cplusplus)
   71 }
   72 #endif
   73 
   74 #endif