Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
vmac.c File Reference
#include <linux/init.h>
#include <linux/types.h>
#include <linux/crypto.h>
#include <linux/module.h>
#include <linux/scatterlist.h>
#include <asm/byteorder.h>
#include <crypto/scatterwalk.h>
#include <crypto/vmac.h>
#include <crypto/internal/hash.h>

Go to the source code of this file.

Macros

#define UINT64_C(x)   x##ULL
 
#define pe64_to_cpup   le64_to_cpup /* Prefer little endian */
 
#define INDEX_HIGH   0
 
#define INDEX_LOW   1
 
#define ADD128(rh, rl, ih, il)
 
#define MUL32(i1, i2)   ((u64)(u32)(i1)*(u32)(i2))
 
#define PMUL64(rh, rl, i1, i2)
 
#define MUL64(rh, rl, i1, i2)
 
#define nh_16(mp, kp, nw, rh, rl)
 
#define a0   (*(((u32 *)alo)+INDEX_LOW))
 
#define a1   (*(((u32 *)alo)+INDEX_HIGH))
 
#define a2   (*(((u32 *)ahi)+INDEX_LOW))
 
#define a3   (*(((u32 *)ahi)+INDEX_HIGH))
 
#define k0   (*(((u32 *)kl)+INDEX_LOW))
 
#define k1   (*(((u32 *)kl)+INDEX_HIGH))
 
#define k2   (*(((u32 *)kh)+INDEX_LOW))
 
#define k3   (*(((u32 *)kh)+INDEX_HIGH))
 
#define poly_step(ah, al, kh, kl, mh, ml)   poly_step_func(&(ah), &(al), &(kh), &(kl), &(mh), &(ml))
 
#define nh_16_2(mp, kp, nw, rh, rl, rh2, rl2)
 
#define nh_vmac_nhbytes(mp, kp, nw, rh, rl)   nh_16(mp, kp, nw, rh, rl)
 
#define nh_vmac_nhbytes_2(mp, kp, nw, rh, rl, rh2, rl2)
 

Functions

 module_init (vmac_module_init)
 
 module_exit (vmac_module_exit)
 
 MODULE_LICENSE ("GPL")
 
 MODULE_DESCRIPTION ("VMAC hash algorithm")
 

Macro Definition Documentation

#define a0   (*(((u32 *)alo)+INDEX_LOW))
#define a1   (*(((u32 *)alo)+INDEX_HIGH))
#define a2   (*(((u32 *)ahi)+INDEX_LOW))
#define a3   (*(((u32 *)ahi)+INDEX_HIGH))
#define ADD128 (   rh,
  rl,
  ih,
  il 
)
Value:
do { \
u64 _il = (il); \
(rl) += (_il); \
if ((rl) < (_il)) \
(rh)++; \
(rh) += (ih); \
} while (0)

Definition at line 66 of file vmac.c.

#define INDEX_HIGH   0

Definition at line 53 of file vmac.c.

#define INDEX_LOW   1

Definition at line 54 of file vmac.c.

#define k0   (*(((u32 *)kl)+INDEX_LOW))
#define k1   (*(((u32 *)kl)+INDEX_HIGH))
#define k2   (*(((u32 *)kh)+INDEX_LOW))
#define k3   (*(((u32 *)kh)+INDEX_HIGH))
#define MUL32 (   i1,
  i2 
)    ((u64)(u32)(i1)*(u32)(i2))

Definition at line 75 of file vmac.c.

#define MUL64 (   rh,
  rl,
  i1,
  i2 
)
Value:
do { \
u64 _i1 = (i1), _i2 = (i2); \
u64 m1 = MUL32(_i1, _i2>>32); \
u64 m2 = MUL32(_i1>>32, _i2); \
rh = MUL32(_i1>>32, _i2>>32); \
rl = MUL32(_i1, _i2); \
ADD128(rh, rl, (m1 >> 32), (m1 << 32)); \
ADD128(rh, rl, (m2 >> 32), (m2 << 32)); \
} while (0)

Definition at line 86 of file vmac.c.

#define nh_16 (   mp,
  kp,
  nw,
  rh,
  rl 
)
Value:
do { \
u64 t1, t2, m1, m2, t; \
int i; \
rh = rl = t = 0; \
for (i = 0; i < nw; i += 2) { \
t1 = pe64_to_cpup(mp+i) + kp[i]; \
t2 = pe64_to_cpup(mp+i+1) + kp[i+1]; \
m2 = MUL32(t1 >> 32, t2); \
m1 = MUL32(t1, t2 >> 32); \
ADD128(rh, rl, MUL32(t1 >> 32, t2 >> 32), \
MUL32(t1, t2)); \
rh += (u64)(u32)(m1 >> 32) \
+ (u32)(m2 >> 32); \
t += (u64)(u32)m1 + (u32)m2; \
} \
ADD128(rh, rl, (t >> 32), (t << 32)); \
} while (0)

Definition at line 216 of file vmac.c.

#define nh_16_2 (   mp,
  kp,
  nw,
  rh,
  rl,
  rh2,
  rl2 
)
Value:
do { \
nh_16(mp, kp, nw, rh, rl); \
nh_16(mp, ((kp)+2), nw, rh2, rl2); \
} while (0)

Definition at line 303 of file vmac.c.

#define nh_vmac_nhbytes (   mp,
  kp,
  nw,
  rh,
  rl 
)    nh_16(mp, kp, nw, rh, rl)

Definition at line 310 of file vmac.c.

#define nh_vmac_nhbytes_2 (   mp,
  kp,
  nw,
  rh,
  rl,
  rh2,
  rl2 
)
Value:
do { \
nh_vmac_nhbytes(mp, kp, nw, rh, rl); \
nh_vmac_nhbytes(mp, ((kp)+2), nw, rh2, rl2); \
} while (0)

Definition at line 314 of file vmac.c.

#define pe64_to_cpup   le64_to_cpup /* Prefer little endian */

Definition at line 47 of file vmac.c.

#define PMUL64 (   rh,
  rl,
  i1,
  i2 
)
Value:
/* Assumes m doesn't overflow */ \
do { \
u64 _i1 = (i1), _i2 = (i2); \
u64 m = MUL32(_i1, _i2>>32) + MUL32(_i1>>32, _i2); \
rh = MUL32(_i1>>32, _i2>>32); \
rl = MUL32(_i1, _i2); \
ADD128(rh, rl, (m >> 32), (m << 32)); \
} while (0)

Definition at line 77 of file vmac.c.

#define poly_step (   ah,
  al,
  kh,
  kl,
  mh,
  ml 
)    poly_step_func(&(ah), &(al), &(kh), &(kl), &(mh), &(ml))

Definition at line 296 of file vmac.c.

#define UINT64_C (   x)    x##ULL

Definition at line 40 of file vmac.c.

Function Documentation

MODULE_DESCRIPTION ( "VMAC hash algorithm )
module_exit ( vmac_module_exit  )
module_init ( vmac_module_init  )
MODULE_LICENSE ( "GPL"  )