aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/tegra-cryptodev.h
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
commitfcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch)
treea57612d1888735a2ec7972891b68c1ac5ec8faea /drivers/misc/tegra-cryptodev.h
parent8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff)
Added missing tegra files.HEADmaster
Diffstat (limited to 'drivers/misc/tegra-cryptodev.h')
-rw-r--r--drivers/misc/tegra-cryptodev.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/drivers/misc/tegra-cryptodev.h b/drivers/misc/tegra-cryptodev.h
new file mode 100644
index 00000000000..ed62a52eca0
--- /dev/null
+++ b/drivers/misc/tegra-cryptodev.h
@@ -0,0 +1,70 @@
1/*
2 * Copyright (c) 2010, NVIDIA Corporation.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 */
18
19#ifndef __TEGRA_CRYPTODEV_H
20#define __TEGRA_CRYPTODEV_H
21
22#include <crypto/aes.h>
23
24#include <asm-generic/ioctl.h>
25
26/* ioctl arg = 1 if you want to use ssk. arg = 0 to use normal key */
27#define TEGRA_CRYPTO_IOCTL_NEED_SSK _IOWR(0x98, 100, int)
28#define TEGRA_CRYPTO_IOCTL_PROCESS_REQ _IOWR(0x98, 101, int*)
29#define TEGRA_CRYPTO_IOCTL_SET_SEED _IOWR(0x98, 102, int*)
30#define TEGRA_CRYPTO_IOCTL_GET_RANDOM _IOWR(0x98, 103, int*)
31
32#define TEGRA_CRYPTO_MAX_KEY_SIZE AES_MAX_KEY_SIZE
33#define TEGRA_CRYPTO_IV_SIZE AES_BLOCK_SIZE
34#define DEFAULT_RNG_BLK_SZ 16
35
36/* the seed consists of 16 bytes of key + 16 bytes of init vector */
37#define TEGRA_CRYPTO_RNG_SEED_SIZE AES_KEYSIZE_128 + DEFAULT_RNG_BLK_SZ
38#define TEGRA_CRYPTO_RNG_SIZE SZ_16
39
40/* encrypt/decrypt operations */
41#define TEGRA_CRYPTO_ECB BIT(0)
42#define TEGRA_CRYPTO_CBC BIT(1)
43#define TEGRA_CRYPTO_RNG BIT(2)
44
45/* a pointer to this struct needs to be passed to:
46 * TEGRA_CRYPTO_IOCTL_PROCESS_REQ
47 */
48struct tegra_crypt_req {
49 int op; /* e.g. TEGRA_CRYPTO_ECB */
50 bool encrypt;
51 char key[TEGRA_CRYPTO_MAX_KEY_SIZE];
52 int keylen;
53 char iv[TEGRA_CRYPTO_IV_SIZE];
54 int ivlen;
55 u8 *plaintext;
56 int plaintext_sz;
57 u8 *result;
58};
59
60/* pointer to this struct should be passed to:
61 * TEGRA_CRYPTO_IOCTL_SET_SEED
62 * TEGRA_CRYPTO_IOCTL_GET_RANDOM
63 */
64struct tegra_rng_req {
65 u8 seed[TEGRA_CRYPTO_RNG_SEED_SIZE];
66 u8 *rdata; /* random generated data */
67 int nbytes; /* random data length */
68};
69
70#endif