~ubuntu-branches/ubuntu/vivid/nettle/vivid-proposed

« back to all changes in this revision

Viewing changes to aes-internal.h

  • Committer: Package Import Robot
  • Author(s): Magnus Holmgren
  • Date: 2013-05-04 19:50:28 UTC
  • mfrom: (1.4.6) (3.1.11 experimental)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: package-import@ubuntu.com-20130504195028-fp6c9fw1tsm5scwa
Tags: 2.7-1
* New upstream release (Closes: #706081).
* Include watch file improvements from Bart Martens <bartm@debian.org>
  via the QA system.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
 
6
6
/* nettle, low-level cryptographics library
7
7
 *
8
 
 * Copyright (C) 2001 Niels M�ller
 
8
 * Copyright (C) 2001 Niels Möller
9
9
 *  
10
10
 * The nettle library is free software; you can redistribute it and/or modify
11
11
 * it under the terms of the GNU Lesser General Public License as published by
19
19
 * 
20
20
 * You should have received a copy of the GNU Lesser General Public License
21
21
 * along with the nettle library; see the file COPYING.LIB.  If not, write to
22
 
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
23
 
 * MA 02111-1307, USA.
 
22
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
23
 * MA 02111-1301, USA.
24
24
 */
25
25
 
26
26
#ifndef NETTLE_AES_INTERNAL_H_INCLUDED
63
63
             const uint8_t *src);
64
64
 
65
65
/* Macros */
66
 
#define ROTBYTE(x) (((x) >> 8) | (((x) & 0xff) << 24))
67
 
#define ROTRBYTE(x) (((x) << 8) | (((x) >> 24) & 0xff))
68
 
#define SUBBYTE(x, box) (((box)[((x) & 0xff)]) | \
69
 
                        ((box)[(((x) >> 8) & 0xff)] << 8) | \
70
 
                        ((box)[(((x) >> 16) & 0xff)] << 16) | \
71
 
                        ((box)[(((x) >> 24) & 0xff)] << 24))
72
 
 
73
66
/* Get the byte with index 0, 1, 2 and 3 */
74
67
#define B0(x) ((x) & 0xff)
75
68
#define B1(x) (((x) >> 8) & 0xff)
76
69
#define B2(x) (((x) >> 16) & 0xff)
77
70
#define B3(x) (((x) >> 24) & 0xff)
78
71
 
 
72
#define SUBBYTE(x, box) ((uint32_t)(box)[B0(x)]         \
 
73
                      | ((uint32_t)(box)[B1(x)] << 8)   \
 
74
                      | ((uint32_t)(box)[B2(x)] << 16)  \
 
75
                      | ((uint32_t)(box)[B3(x)] << 24))
 
76
 
79
77
#define AES_ROUND(T, w0, w1, w2, w3, k)         \
80
78
((  T->table[0][ B0(w0) ]                       \
81
79
  ^ T->table[1][ B1(w1) ]                       \