tea.c (5800571960234f9d1f1011bf135799b2014d4268) tea.c (d6ebf5286f8f94a254a8c90d4b9f2a8b076a8634)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * Cryptographic API.
4 *
5 * TEA, XTEA, and XETA crypto alogrithms
6 *
7 * The TEA and Xtended TEA algorithms were developed by David Wheeler
8 * and Roger Needham at the Computer Laboratory of Cambridge University.
9 *
10 * Due to the order of evaluation in XTEA many people have incorrectly
11 * implemented it. XETA (XTEA in the wrong order), exists for
12 * compatibility with these implementations.
13 *
14 * Copyright (c) 2004 Aaron Grothe ajgrothe@yahoo.com
1/*
2 * Cryptographic API.
3 *
4 * TEA, XTEA, and XETA crypto alogrithms
5 *
6 * The TEA and Xtended TEA algorithms were developed by David Wheeler
7 * and Roger Needham at the Computer Laboratory of Cambridge University.
8 *
9 * Due to the order of evaluation in XTEA many people have incorrectly
10 * implemented it. XETA (XTEA in the wrong order), exists for
11 * compatibility with these implementations.
12 *
13 * Copyright (c) 2004 Aaron Grothe ajgrothe@yahoo.com
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
15 */
16
17#include <linux/init.h>
18#include <linux/module.h>
19#include <linux/mm.h>
20#include <asm/byteorder.h>
21#include <linux/crypto.h>
22#include <linux/types.h>

--- 188 unchanged lines hidden (view full) ---

211 }
212
213 out[0] = cpu_to_le32(y);
214 out[1] = cpu_to_le32(z);
215}
216
217static struct crypto_alg tea_algs[3] = { {
218 .cra_name = "tea",
20 */
21
22#include <linux/init.h>
23#include <linux/module.h>
24#include <linux/mm.h>
25#include <asm/byteorder.h>
26#include <linux/crypto.h>
27#include <linux/types.h>

--- 188 unchanged lines hidden (view full) ---

216 }
217
218 out[0] = cpu_to_le32(y);
219 out[1] = cpu_to_le32(z);
220}
221
222static struct crypto_alg tea_algs[3] = { {
223 .cra_name = "tea",
224 .cra_driver_name = "tea-generic",
219 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
220 .cra_blocksize = TEA_BLOCK_SIZE,
221 .cra_ctxsize = sizeof (struct tea_ctx),
222 .cra_alignmask = 3,
223 .cra_module = THIS_MODULE,
224 .cra_u = { .cipher = {
225 .cia_min_keysize = TEA_KEY_SIZE,
226 .cia_max_keysize = TEA_KEY_SIZE,
227 .cia_setkey = tea_setkey,
228 .cia_encrypt = tea_encrypt,
229 .cia_decrypt = tea_decrypt } }
230}, {
231 .cra_name = "xtea",
225 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
226 .cra_blocksize = TEA_BLOCK_SIZE,
227 .cra_ctxsize = sizeof (struct tea_ctx),
228 .cra_alignmask = 3,
229 .cra_module = THIS_MODULE,
230 .cra_u = { .cipher = {
231 .cia_min_keysize = TEA_KEY_SIZE,
232 .cia_max_keysize = TEA_KEY_SIZE,
233 .cia_setkey = tea_setkey,
234 .cia_encrypt = tea_encrypt,
235 .cia_decrypt = tea_decrypt } }
236}, {
237 .cra_name = "xtea",
238 .cra_driver_name = "xtea-generic",
232 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
233 .cra_blocksize = XTEA_BLOCK_SIZE,
234 .cra_ctxsize = sizeof (struct xtea_ctx),
235 .cra_alignmask = 3,
236 .cra_module = THIS_MODULE,
237 .cra_u = { .cipher = {
238 .cia_min_keysize = XTEA_KEY_SIZE,
239 .cia_max_keysize = XTEA_KEY_SIZE,
240 .cia_setkey = xtea_setkey,
241 .cia_encrypt = xtea_encrypt,
242 .cia_decrypt = xtea_decrypt } }
243}, {
244 .cra_name = "xeta",
239 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
240 .cra_blocksize = XTEA_BLOCK_SIZE,
241 .cra_ctxsize = sizeof (struct xtea_ctx),
242 .cra_alignmask = 3,
243 .cra_module = THIS_MODULE,
244 .cra_u = { .cipher = {
245 .cia_min_keysize = XTEA_KEY_SIZE,
246 .cia_max_keysize = XTEA_KEY_SIZE,
247 .cia_setkey = xtea_setkey,
248 .cia_encrypt = xtea_encrypt,
249 .cia_decrypt = xtea_decrypt } }
250}, {
251 .cra_name = "xeta",
252 .cra_driver_name = "xeta-generic",
245 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
246 .cra_blocksize = XTEA_BLOCK_SIZE,
247 .cra_ctxsize = sizeof (struct xtea_ctx),
248 .cra_alignmask = 3,
249 .cra_module = THIS_MODULE,
250 .cra_u = { .cipher = {
251 .cia_min_keysize = XTEA_KEY_SIZE,
252 .cia_max_keysize = XTEA_KEY_SIZE,

--- 24 unchanged lines hidden ---
253 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
254 .cra_blocksize = XTEA_BLOCK_SIZE,
255 .cra_ctxsize = sizeof (struct xtea_ctx),
256 .cra_alignmask = 3,
257 .cra_module = THIS_MODULE,
258 .cra_u = { .cipher = {
259 .cia_min_keysize = XTEA_KEY_SIZE,
260 .cia_max_keysize = XTEA_KEY_SIZE,

--- 24 unchanged lines hidden ---