1 /* 2 * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef __DRV_CIPHER_DEFINE_H__ 20 #define __DRV_CIPHER_DEFINE_H__ 21 22 #ifdef __cplusplus 23 #if __cplusplus 24 extern "C"{ 25 #endif 26 #endif /* __cplusplus */ 27 28 /* word index number. */ 29 #define WORD_IDX_0 0 30 #define WORD_IDX_1 1 31 #define WORD_IDX_2 2 32 #define WORD_IDX_3 3 33 #define WORD_IDX_4 4 34 #define WORD_IDX_5 5 35 #define WORD_IDX_6 6 36 #define WORD_IDX_7 7 37 38 /* Boundary value 1. */ 39 #define BOUND_VAL_1 1 40 41 /* multiple value */ 42 #define MUL_VAL_1 1 43 #define MUL_VAL_2 2 44 #define MUL_VAL_3 3 45 #define MUL_VAL_4 4 46 47 #define SHIFT_1BITS 1 48 #define SHIFT_2BITS 2 49 #define SHIFT_3BITS 3 50 #define SHIFT_4BITS 4 51 #define SHIFT_5BITS 5 52 #define SHIFT_6BITS 6 53 #define SHIFT_8BITS 8 54 #define SHIFT_9BITS 9 55 #define SHIFT_13BITS 13 56 #define SHIFT_15BITS 15 57 #define SHIFT_16BITS 16 58 #define SHIFT_17BITS 17 59 #define SHIFT_21BITS 21 60 #define SHIFT_23BITS 23 61 #define SHIFT_24BITS 24 62 #define SHIFT_29BITS 29 63 #define SHIFT_32BITS 32 64 65 #define MAX_LOW_2BITS 3 66 #define MAX_LOW_3BITS 7 67 #define MAX_LOW_4BITS 0xF 68 #define MAX_LOW_8BITS 0xFF 69 70 #define WORD_WIDTH 4 71 72 /* width of word. */ 73 #define WORD_BIT_WIDTH 32 74 #define U32_MAX_SIZE 0xFFFFFFFF 75 76 /* width of double word. */ 77 #define DOUBLE_WORD_WIDTH 8 78 79 #define BYTE_BITS 8 80 /* The offset in one byte. */ 81 #define BYTE_2BIT 2 82 #define BYTE_4BIT 4 83 #define BYTE_6BIT 6 84 85 #define CRYPTO_NUM_1 1 86 #define CRYPTO_NUM_2 2 87 #define CRYPTO_NUM_3 3 88 89 #ifdef __cplusplus 90 #if __cplusplus 91 } 92 #endif 93 #endif /* __cplusplus */ 94 95 #endif /* __DRV_CIPHER_DEFINE_H__ */ 96 97