1aec3694bSRik Snel /* b128ops.h - common 128-bit block operations
2aec3694bSRik Snel *
3aec3694bSRik Snel * Copyright (c) 2003, Dr Brian Gladman, Worcester, UK.
4aec3694bSRik Snel * Copyright (c) 2006, Rik Snel <rsnel@cube.dyndns.org>
5aec3694bSRik Snel *
6aec3694bSRik Snel * Based on Dr Brian Gladman's (GPL'd) work published at
7aec3694bSRik Snel * http://fp.gladman.plus.com/cryptography_technology/index.htm
8aec3694bSRik Snel * See the original copyright notice below.
9aec3694bSRik Snel *
10aec3694bSRik Snel * This program is free software; you can redistribute it and/or modify it
11aec3694bSRik Snel * under the terms of the GNU General Public License as published by the Free
12aec3694bSRik Snel * Software Foundation; either version 2 of the License, or (at your option)
13aec3694bSRik Snel * any later version.
14aec3694bSRik Snel */
15aec3694bSRik Snel /*
16aec3694bSRik Snel ---------------------------------------------------------------------------
17aec3694bSRik Snel Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved.
18aec3694bSRik Snel
19aec3694bSRik Snel LICENSE TERMS
20aec3694bSRik Snel
21aec3694bSRik Snel The free distribution and use of this software in both source and binary
22aec3694bSRik Snel form is allowed (with or without changes) provided that:
23aec3694bSRik Snel
24aec3694bSRik Snel 1. distributions of this source code include the above copyright
25aec3694bSRik Snel notice, this list of conditions and the following disclaimer;
26aec3694bSRik Snel
27aec3694bSRik Snel 2. distributions in binary form include the above copyright
28aec3694bSRik Snel notice, this list of conditions and the following disclaimer
29aec3694bSRik Snel in the documentation and/or other associated materials;
30aec3694bSRik Snel
31aec3694bSRik Snel 3. the copyright holder's name is not used to endorse products
32aec3694bSRik Snel built using this software without specific written permission.
33aec3694bSRik Snel
34aec3694bSRik Snel ALTERNATIVELY, provided that this notice is retained in full, this product
35aec3694bSRik Snel may be distributed under the terms of the GNU General Public License (GPL),
36aec3694bSRik Snel in which case the provisions of the GPL apply INSTEAD OF those given above.
37aec3694bSRik Snel
38aec3694bSRik Snel DISCLAIMER
39aec3694bSRik Snel
40aec3694bSRik Snel This software is provided 'as is' with no explicit or implied warranties
41aec3694bSRik Snel in respect of its properties, including, but not limited to, correctness
42aec3694bSRik Snel and/or fitness for purpose.
43aec3694bSRik Snel ---------------------------------------------------------------------------
44aec3694bSRik Snel Issue Date: 13/06/2006
45aec3694bSRik Snel */
46aec3694bSRik Snel
47aec3694bSRik Snel #ifndef _CRYPTO_B128OPS_H
48aec3694bSRik Snel #define _CRYPTO_B128OPS_H
49aec3694bSRik Snel
50aec3694bSRik Snel #include <linux/types.h>
51aec3694bSRik Snel
52aec3694bSRik Snel typedef struct {
53aec3694bSRik Snel __be64 a, b;
54aec3694bSRik Snel } be128;
55aec3694bSRik Snel
56aec3694bSRik Snel typedef struct {
57aec3694bSRik Snel __le64 b, a;
58aec3694bSRik Snel } le128;
59aec3694bSRik Snel
be128_xor(be128 * r,const be128 * p,const be128 * q)60*f413e724SPeter Zijlstra static inline void be128_xor(be128 *r, const be128 *p, const be128 *q)
61aec3694bSRik Snel {
62aec3694bSRik Snel r->a = p->a ^ q->a;
63aec3694bSRik Snel r->b = p->b ^ q->b;
64aec3694bSRik Snel }
65aec3694bSRik Snel
le128_xor(le128 * r,const le128 * p,const le128 * q)66aec3694bSRik Snel static inline void le128_xor(le128 *r, const le128 *p, const le128 *q)
67aec3694bSRik Snel {
68*f413e724SPeter Zijlstra r->a = p->a ^ q->a;
69*f413e724SPeter Zijlstra r->b = p->b ^ q->b;
70aec3694bSRik Snel }
71aec3694bSRik Snel
72aec3694bSRik Snel #endif /* _CRYPTO_B128OPS_H */
73