Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
camellia_generic.c File Reference
#include <linux/crypto.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/bitops.h>
#include <asm/unaligned.h>

Go to the source code of this file.

Data Structures

struct  camellia_ctx
 

Macros

#define CAMELLIA_MIN_KEY_SIZE   16
 
#define CAMELLIA_MAX_KEY_SIZE   32
 
#define CAMELLIA_BLOCK_SIZE   16
 
#define CAMELLIA_TABLE_BYTE_LEN   272
 
#define CAMELLIA_SIGMA1L   (0xA09E667FL)
 
#define CAMELLIA_SIGMA1R   (0x3BCC908BL)
 
#define CAMELLIA_SIGMA2L   (0xB67AE858L)
 
#define CAMELLIA_SIGMA2R   (0x4CAA73B2L)
 
#define CAMELLIA_SIGMA3L   (0xC6EF372FL)
 
#define CAMELLIA_SIGMA3R   (0xE94F82BEL)
 
#define CAMELLIA_SIGMA4L   (0x54FF53A5L)
 
#define CAMELLIA_SIGMA4R   (0xF1D36F1CL)
 
#define CAMELLIA_SIGMA5L   (0x10E527FAL)
 
#define CAMELLIA_SIGMA5R   (0xDE682D1DL)
 
#define CAMELLIA_SIGMA6L   (0xB05688C2L)
 
#define CAMELLIA_SIGMA6R   (0xB3E6C1FDL)
 
#define ROLDQ(ll, lr, rl, rr, w0, w1, bits)
 
#define ROLDQo32(ll, lr, rl, rr, w0, w1, bits)
 
#define CAMELLIA_F(xl, xr, kl, kr, yl, yr, il, ir, t0, t1)
 
#define SUBKEY_L(INDEX)   (subkey[(INDEX)*2])
 
#define SUBKEY_R(INDEX)   (subkey[(INDEX)*2 + 1])
 
#define CAMELLIA_FLS(ll, lr, rl, rr, kll, klr, krl, krr, t0, t1, t2, t3)
 
#define CAMELLIA_ROUNDSM(xl, xr, kl, kr, yl, yr, il, ir)
 
#define ROUNDS(i)
 
#define FLS(i)
 
#define ROUNDS(i)
 
#define FLS(i)
 

Functions

 module_init (camellia_init)
 
 module_exit (camellia_fini)
 
 MODULE_DESCRIPTION ("Camellia Cipher Algorithm")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_ALIAS ("camellia")
 

Macro Definition Documentation

#define CAMELLIA_BLOCK_SIZE   16

Definition at line 312 of file camellia_generic.c.

#define CAMELLIA_F (   xl,
  xr,
  kl,
  kr,
  yl,
  yr,
  il,
  ir,
  t0,
  t1 
)
Value:
({ \
il = xl ^ kl; \
ir = xr ^ kr; \
t0 = il >> 16; \
t1 = ir >> 16; \
yl = camellia_sp1110[(u8)(ir)] \
^ camellia_sp0222[(u8)(t1 >> 8)] \
^ camellia_sp3033[(u8)(t1)] \
^ camellia_sp4404[(u8)(ir >> 8)]; \
yr = camellia_sp1110[(u8)(t0 >> 8)] \
^ camellia_sp0222[(u8)(t0)] \
^ camellia_sp3033[(u8)(il >> 8)] \
^ camellia_sp4404[(u8)(il)]; \
yl ^= yr; \
yr = ror32(yr, 8); \
yr ^= yl; \
})

Definition at line 357 of file camellia_generic.c.

#define CAMELLIA_FLS (   ll,
  lr,
  rl,
  rr,
  kll,
  klr,
  krl,
  krr,
  t0,
  t1,
  t2,
  t3 
)
Value:
({ \
t0 = kll; \
t2 = krr; \
t0 &= ll; \
t2 |= rr; \
rl ^= t2; \
lr ^= rol32(t0, 1); \
t3 = krl; \
t1 = klr; \
t3 &= rl; \
t1 |= lr; \
ll ^= t1; \
rr ^= rol32(t3, 1); \
})

Definition at line 832 of file camellia_generic.c.

#define CAMELLIA_MAX_KEY_SIZE   32

Definition at line 311 of file camellia_generic.c.

#define CAMELLIA_MIN_KEY_SIZE   16

Definition at line 310 of file camellia_generic.c.

#define CAMELLIA_ROUNDSM (   xl,
  xr,
  kl,
  kr,
  yl,
  yr,
  il,
  ir 
)
Value:
({ \
yl ^= kl; \
yr ^= kr; \
ir = camellia_sp1110[(u8)xr]; \
il = camellia_sp1110[(u8)(xl >> 24)]; \
ir ^= camellia_sp0222[(u8)(xr >> 24)]; \
il ^= camellia_sp0222[(u8)(xl >> 16)]; \
ir ^= camellia_sp3033[(u8)(xr >> 16)]; \
il ^= camellia_sp3033[(u8)(xl >> 8)]; \
ir ^= camellia_sp4404[(u8)(xr >> 8)]; \
il ^= camellia_sp4404[(u8)xl]; \
ir ^= il; \
yl ^= ir; \
yr ^= ror32(il, 8) ^ ir; \
})

Definition at line 847 of file camellia_generic.c.

#define CAMELLIA_SIGMA1L   (0xA09E667FL)

Definition at line 324 of file camellia_generic.c.

#define CAMELLIA_SIGMA1R   (0x3BCC908BL)

Definition at line 325 of file camellia_generic.c.

#define CAMELLIA_SIGMA2L   (0xB67AE858L)

Definition at line 326 of file camellia_generic.c.

#define CAMELLIA_SIGMA2R   (0x4CAA73B2L)

Definition at line 327 of file camellia_generic.c.

#define CAMELLIA_SIGMA3L   (0xC6EF372FL)

Definition at line 328 of file camellia_generic.c.

#define CAMELLIA_SIGMA3R   (0xE94F82BEL)

Definition at line 329 of file camellia_generic.c.

#define CAMELLIA_SIGMA4L   (0x54FF53A5L)

Definition at line 330 of file camellia_generic.c.

#define CAMELLIA_SIGMA4R   (0xF1D36F1CL)

Definition at line 331 of file camellia_generic.c.

#define CAMELLIA_SIGMA5L   (0x10E527FAL)

Definition at line 332 of file camellia_generic.c.

#define CAMELLIA_SIGMA5R   (0xDE682D1DL)

Definition at line 333 of file camellia_generic.c.

#define CAMELLIA_SIGMA6L   (0xB05688C2L)

Definition at line 334 of file camellia_generic.c.

#define CAMELLIA_SIGMA6R   (0xB3E6C1FDL)

Definition at line 335 of file camellia_generic.c.

#define CAMELLIA_TABLE_BYTE_LEN   272

Definition at line 313 of file camellia_generic.c.

#define FLS (   i)
Value:
({ \
CAMELLIA_FLS(io[0], io[1], io[2], io[3], \
SUBKEY_L(i + 0), SUBKEY_R(i + 0), \
SUBKEY_L(i + 1), SUBKEY_R(i + 1), \
t0, t1, il, ir); \
})
#define FLS (   i)
Value:
({ \
CAMELLIA_FLS(io[0], io[1], io[2], io[3], \
SUBKEY_L(i + 1), SUBKEY_R(i + 1), \
SUBKEY_L(i + 0), SUBKEY_R(i + 0), \
t0, t1, il, ir); \
})
#define ROLDQ (   ll,
  lr,
  rl,
  rr,
  w0,
  w1,
  bits 
)
Value:
({ \
w0 = ll; \
ll = (ll << bits) + (lr >> (32 - bits)); \
lr = (lr << bits) + (rl >> (32 - bits)); \
rl = (rl << bits) + (rr >> (32 - bits)); \
rr = (rr << bits) + (w0 >> (32 - bits)); \
})

Definition at line 340 of file camellia_generic.c.

#define ROLDQo32 (   ll,
  lr,
  rl,
  rr,
  w0,
  w1,
  bits 
)
Value:
({ \
w0 = ll; \
w1 = lr; \
ll = (lr << (bits - 32)) + (rl >> (64 - bits)); \
lr = (rl << (bits - 32)) + (rr >> (64 - bits)); \
rl = (rr << (bits - 32)) + (w0 >> (64 - bits)); \
rr = (w0 << (bits - 32)) + (w1 >> (64 - bits)); \
})

Definition at line 348 of file camellia_generic.c.

#define ROUNDS (   i)
Value:
({ \
CAMELLIA_ROUNDSM(io[0], io[1], \
SUBKEY_L(i + 2), SUBKEY_R(i + 2), \
io[2], io[3], il, ir); \
CAMELLIA_ROUNDSM(io[2], io[3], \
SUBKEY_L(i + 3), SUBKEY_R(i + 3), \
io[0], io[1], il, ir); \
CAMELLIA_ROUNDSM(io[0], io[1], \
SUBKEY_L(i + 4), SUBKEY_R(i + 4), \
io[2], io[3], il, ir); \
CAMELLIA_ROUNDSM(io[2], io[3], \
SUBKEY_L(i + 5), SUBKEY_R(i + 5), \
io[0], io[1], il, ir); \
CAMELLIA_ROUNDSM(io[0], io[1], \
SUBKEY_L(i + 6), SUBKEY_R(i + 6), \
io[2], io[3], il, ir); \
CAMELLIA_ROUNDSM(io[2], io[3], \
SUBKEY_L(i + 7), SUBKEY_R(i + 7), \
io[0], io[1], il, ir); \
})
#define ROUNDS (   i)
Value:
({ \
CAMELLIA_ROUNDSM(io[0], io[1], \
SUBKEY_L(i + 7), SUBKEY_R(i + 7), \
io[2], io[3], il, ir); \
CAMELLIA_ROUNDSM(io[2], io[3], \
SUBKEY_L(i + 6), SUBKEY_R(i + 6), \
io[0], io[1], il, ir); \
CAMELLIA_ROUNDSM(io[0], io[1], \
SUBKEY_L(i + 5), SUBKEY_R(i + 5), \
io[2], io[3], il, ir); \
CAMELLIA_ROUNDSM(io[2], io[3], \
SUBKEY_L(i + 4), SUBKEY_R(i + 4), \
io[0], io[1], il, ir); \
CAMELLIA_ROUNDSM(io[0], io[1], \
SUBKEY_L(i + 3), SUBKEY_R(i + 3), \
io[2], io[3], il, ir); \
CAMELLIA_ROUNDSM(io[2], io[3], \
SUBKEY_L(i + 2), SUBKEY_R(i + 2), \
io[0], io[1], il, ir); \
})
#define SUBKEY_L (   INDEX)    (subkey[(INDEX)*2])

Definition at line 375 of file camellia_generic.c.

#define SUBKEY_R (   INDEX)    (subkey[(INDEX)*2 + 1])

Definition at line 376 of file camellia_generic.c.

Function Documentation

MODULE_ALIAS ( "camellia"  )
MODULE_DESCRIPTION ( "Camellia Cipher Algorithm"  )
module_exit ( camellia_fini  )
module_init ( camellia_init  )
MODULE_LICENSE ( "GPL"  )