69 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			69 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
|  | /****************************************************************************
 | ||
|  | 
 | ||
|  | Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED. | ||
|  | 
 | ||
|  | This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT | ||
|  | be copied by any method or incorporated into another program without | ||
|  | the express written consent of Aerospace C.Power. This Information or any portion | ||
|  | thereof remains the property of Aerospace C.Power. The Information contained herein | ||
|  | is believed to be accurate and Aerospace C.Power assumes no responsibility or | ||
|  | liability for its use in any way and conveys no license or title under | ||
|  | any patent or copyright and makes no representation or warranty that this | ||
|  | Information is free from patent or copyright infringement. | ||
|  | 
 | ||
|  | ****************************************************************************/ | ||
|  | #ifndef AES_PATCH_ALT_H
 | ||
|  | #define AES_PATCH_ALT_H
 | ||
|  | 
 | ||
|  | #if !defined(MBEDTLS_CONFIG_FILE)
 | ||
|  | #include "mbedtls/config.h"
 | ||
|  | #else
 | ||
|  | #include MBEDTLS_CONFIG_FILE
 | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #if defined(MBEDTLS_AES_C)
 | ||
|  | 
 | ||
|  | #include "os_types.h"
 | ||
|  | 
 | ||
|  | #include "mbedtls/aes.h"
 | ||
|  | 
 | ||
|  | #if defined(MBEDTLS_AES_ALT)
 | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | extern "C" { | ||
|  | #endif
 | ||
|  | 
 | ||
|  | void patch_aes_init(mbedtls_aes_context *ctx); | ||
|  | 
 | ||
|  | void patch_aes_free(mbedtls_aes_context *ctx); | ||
|  | 
 | ||
|  | int patch_aes_setkey_enc(mbedtls_aes_context *ctx, | ||
|  |     const unsigned char *key, unsigned int keybits); | ||
|  | 
 | ||
|  | int patch_aes_setkey_dec(mbedtls_aes_context *ctx, | ||
|  |     const unsigned char *key, unsigned int keybits); | ||
|  | 
 | ||
|  | int patch_aes_crypt_ecb(mbedtls_aes_context *ctx, | ||
|  |     int mode, const unsigned char input[16], | ||
|  |     unsigned char output[16]); | ||
|  | 
 | ||
|  | int patch_aes_crypt_cbc(mbedtls_aes_context *ctx, | ||
|  |     int mode, size_t length, unsigned char iv[16], | ||
|  |     const unsigned char *input, unsigned char *output); | ||
|  | 
 | ||
|  | int patch_aes_crypt_ctr(mbedtls_aes_context *ctx, | ||
|  |     size_t length, size_t *nc_off, unsigned char nonce_counter[16], | ||
|  |     unsigned char stream_block[16], const unsigned char *input, | ||
|  |     unsigned char *output); | ||
|  | 
 | ||
|  | #ifdef __cplusplus
 | ||
|  | } | ||
|  | #endif
 | ||
|  | 
 | ||
|  | #endif /* MBEDTLS_AES_ALT */
 | ||
|  | 
 | ||
|  | #endif /* MBEDTLS_AES_C */
 | ||
|  | 
 | ||
|  | #endif /* AES_PATCH_ALT_H */
 | ||
|  | 
 |