ck_aes.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /******************************************************************************
  17. * @file ck_aes.h
  18. * @brief header file for aes driver
  19. * @version V1.0
  20. * @date 02. June 2017
  21. ******************************************************************************/
  22. #ifndef _CK_AES_H_
  23. #define _CK_AES_H_
  24. #include <stdio.h>
  25. #include "drv_aes.h"
  26. #include "soc.h"
  27. #define AES_LITTLE_ENDIAN 0x00000100
  28. #define AES_MAX_KEY_LENGTH 32
  29. #define AES_IT_DATAINT 0x4
  30. #define AES_IT_KEYINT 0x2
  31. #define AES_IT_BUSY 0x1
  32. #define AES_IT_ALL 0x7
  33. #define AES_CRYPTO_KEYEXP 0x2
  34. #define AES_WORK_ENABLE_OFFSET 0
  35. #define AES_INT_ENABLE_OFFSET 2
  36. #define AES_MODE_OFFSET 3
  37. #define AES_KEY_LEN_OFFSET 4
  38. #define AES_OPCODE_OFFSET 6
  39. typedef struct {
  40. __IOM uint32_t datain[4]; /* Offset: 0x000 (R/W) Data input 0~127 */
  41. __IOM uint32_t key[8]; /* Offset: 0x010 (R/W) Key 0~255 */
  42. __IOM uint32_t iv[4]; /* Offset: 0x030 (R/W) Initial Vector: 0~127 */
  43. __IOM uint32_t ctrl; /* Offset: 0x040 (R/W) AES Control Register */
  44. __IOM uint32_t state; /* Offset: 0x044 (R/W) AES State Register */
  45. __IOM uint32_t dataout[4]; /* Offset: 0x048 (R/W) Data Output 0~31 */
  46. } ck_aes_reg_t;
  47. #endif