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

« back to all changes in this revision

Viewing changes to macros.h

  • Committer: Package Import Robot
  • Author(s): Magnus Holmgren
  • Date: 2013-03-24 11:38:21 UTC
  • mfrom: (1.5.2)
  • mto: (8.1.7 sid)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: package-import@ubuntu.com-20130324113821-47kc1q7ojsxmuevv
Tags: 2.6-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 * 
19
19
 * You should have received a copy of the GNU Lesser General Public License
20
20
 * along with the nettle library; see the file COPYING.LIB.  If not, write to
21
 
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
22
 
 * MA 02111-1307, USA.
 
21
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
22
 * MA 02111-1301, USA.
23
23
 */
24
24
 
25
25
#ifndef NETTLE_MACROS_H_INCLUDED
87
87
} while(0)
88
88
 
89
89
/* And the other, little-endian, byteorder */
 
90
#define LE_READ_UINT64(p)                       \
 
91
(  (((uint64_t) (p)[7]) << 56)                  \
 
92
 | (((uint64_t) (p)[6]) << 48)                  \
 
93
 | (((uint64_t) (p)[5]) << 40)                  \
 
94
 | (((uint64_t) (p)[4]) << 32)                  \
 
95
 | (((uint64_t) (p)[3]) << 24)                  \
 
96
 | (((uint64_t) (p)[2]) << 16)                  \
 
97
 | (((uint64_t) (p)[1]) << 8)                   \
 
98
 |  ((uint64_t) (p)[0]))
 
99
 
 
100
#define LE_WRITE_UINT64(p, i)                   \
 
101
do {                                            \
 
102
  (p)[7] = ((i) >> 56) & 0xff;                  \
 
103
  (p)[6] = ((i) >> 48) & 0xff;                  \
 
104
  (p)[5] = ((i) >> 40) & 0xff;                  \
 
105
  (p)[4] = ((i) >> 32) & 0xff;                  \
 
106
  (p)[3] = ((i) >> 24) & 0xff;                  \
 
107
  (p)[2] = ((i) >> 16) & 0xff;                  \
 
108
  (p)[1] = ((i) >> 8) & 0xff;                   \
 
109
  (p)[0] = (i) & 0xff;                          \
 
110
} while (0)
 
111
    
90
112
#define LE_READ_UINT32(p)                       \
91
113
(  (((uint32_t) (p)[3]) << 24)                  \
92
114
 | (((uint32_t) (p)[2]) << 16)                  \
119
141
                  (dst) += (blocksize),         \
120
142
                  (src) += (blocksize)) )
121
143
 
122
 
#define ROTL32(n,x) ((((x))<<(n)) | (((x))>>(32-(n))))
 
144
#define ROTL32(n,x) (((x)<<(n)) | ((x)>>(32-(n))))
 
145
 
 
146
#define ROTL64(n,x) (((x)<<(n)) | ((x)>>(64-(n))))
123
147
 
124
148
/* Requires that size >= 2 */
125
149
#define INCREMENT(size, ctr)                    \