blob: 4ce1c4f21c22a0a93f1935f04579e2bf9ab84292 [file] [log] [blame]
chuangcheng peng021cfea2023-09-12 18:37:42 +08001/* SPDX-License-Identifier: LGPL-2.1+ WITH Linux-syscall-note */
2/*
3 * include/linux/amlogic/aml_key.h
4 *
5 * Copyright (C) 2017 Amlogic, Inc. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 */
18
19#ifndef _AML_KEY_H_
20#define _AML_KEY_H_
21
22enum user_id {
23 DSC_LOC_DEC,
24 DSC_NETWORK,
25 DSC_LOC_ENC,
26
27 CRYPTO_T0 = 0x100,
28 CRYPTO_T1 = 0x101,
29 CRYPTO_T2 = 0x102,
30 CRYPTO_T3 = 0x103,
31 CRYPTO_T4 = 0x104,
32 CRYPTO_T5 = 0x105,
33 CRYPTO_ANY = 0x106,
34};
35
36enum key_algo {
37 KEY_ALGO_AES,
38 KEY_ALGO_TDES,
39 KEY_ALGO_DES,
40 KEY_ALGO_CSA2,
41 KEY_ALGO_CSA3,
42 KEY_ALGO_NDL,
43 KEY_ALGO_ND,
44 KEY_ALGO_S17,
45 KEY_ALGO_SM4
46};
47
48struct key_descr {
49 unsigned int key_index;
50 unsigned int key_len;
51 unsigned char key[32];
52};
53
54struct key_config {
55 unsigned int key_index;
56 int key_userid;
57 int key_algo;
58 //cur just for s17 algo
59 unsigned int ext_value;
60};
61
62struct key_alloc {
63 int is_iv;
64 unsigned int key_index;
65};
66
67#define KEY_ALLOC _IOWR('o', 64, struct key_alloc)
68#define KEY_FREE _IO('o', 65)
69#define KEY_SET _IOR('o', 66, struct key_descr)
70#define KEY_CONFIG _IOR('o', 67, struct key_config)
71#define KEY_GET_FLAG _IOWR('o', 68, struct key_descr)
72
73//int dmx_key_init(void);
74//void dmx_key_exit(void);
75
76#endif
77