/**
******************************************************************************
* @file stm32f7xx_hal_cryp.c
* @author MCD Application Team
* @brief CRYP HAL module driver.
* This file provides firmware functions to manage the following
* functionalities of the Cryptography (CRYP) peripheral:
* + Initialization, de-initialization, set config and get config functions
* + DES/TDES, AES processing functions
* + DMA callback functions
* + CRYP IRQ handler management
* + Peripheral State functions
*
@verbatim
==============================================================================
##### How to use this driver #####
==============================================================================
[..]
The CRYP HAL driver can be used in CRYP or TinyAES IP as follows:
(#)Initialize the CRYP low level resources by implementing the HAL_CRYP_MspInit():
(##) Enable the CRYP interface clock using __HAL_RCC_CRYP_CLK_ENABLE()or __HAL_RCC_AES_CLK_ENABLE for TinyAES IP
(##) In case of using interrupts (e.g. HAL_CRYP_Encrypt_IT())
(+++) Configure the CRYP interrupt priority using HAL_NVIC_SetPriority()
(+++) Enable the CRYP IRQ handler using HAL_NVIC_EnableIRQ()
(+++) In CRYP IRQ handler, call HAL_CRYP_IRQHandler()
(##) In case of using DMA to control data transfer (e.g. HAL_CRYP_Encrypt_DMA())
(+++) Enable the DMAx interface clock using __RCC_DMAx_CLK_ENABLE()
(+++) Configure and enable two DMA streams one for managing data transfer from
memory to peripheral (input stream) and another stream for managing data
transfer from peripheral to memory (output stream)
(+++) Associate the initialized DMA handle to the CRYP DMA handle
using __HAL_LINKDMA()
(+++) Configure the priority and enable the NVIC for the transfer complete
interrupt on the two DMA Streams. The output stream should have higher
priority than the input stream HAL_NVIC_SetPriority() and HAL_NVIC_EnableIRQ()
(#)Initialize the CRYP according to the specified parameters :
(##) The data type: 1-bit, 8-bit, 16-bit or 32-bit.
(##) The key size: 128, 192 or 256.
(##) The AlgoMode DES/ TDES Algorithm ECB/CBC or AES Algorithm ECB/CBC/CTR/GCM or CCM.
(##) The initialization vector (counter). It is not used in ECB mode.
(##) The key buffer used for encryption/decryption.
(##) The Header used only in AES GCM and CCM Algorithm for authentication.
(##) The HeaderSize The size of header buffer in word.
(##) The B0 block is the first authentication block used only in AES CCM mode.
(#)Three processing (encryption/decryption) functions are available:
(##) Polling mode: encryption and decryption APIs are blocking functions
i.e. they process the data and wait till the processing is finished,
e.g. HAL_CRYP_Encrypt & HAL_CRYP_Decrypt
(##) Interrupt mode: encryption and decryption APIs are not blocking functions
i.e. they process the data under interrupt,
e.g. HAL_CRYP_Encrypt_IT & HAL_CRYP_Decrypt_IT
(##) DMA mode: encryption and decryption APIs are not blocking functions
i.e. the data transfer is ensured by DMA,
e.g. HAL_CRYP_Encrypt_DMA & HAL_CRYP_Decrypt_DMA
(#)When the processing function is called at first time after HAL_CRYP_Init()
the CRYP peripheral is configured and processes the buffer in input.
At second call, no need to Initialize the CRYP, user have to get current configuration via
HAL_CRYP_GetConfig() API, then only HAL_CRYP_SetConfig() is requested to set
new parametres, finally user can start encryption/decryption.
(#)Call HAL_CRYP_DeInit() to deinitialize the CRYP peripheral.
(#)To process a single message with consecutive calls to HAL_CRYP_Encrypt() or HAL_CRYP_Decrypt()
without having to configure again the Key or the Initialization Vector between each API call,
the field KeyIVConfigSkip of the initialization structure must be set to CRYP_KEYIVCONFIG_ONCE.
Same is true for consecutive calls of HAL_CRYP_Encrypt_IT(), HAL_CRYP_Decrypt_IT(), HAL_CRYP_Encrypt_DMA()
or HAL_CRYP_Decrypt_DMA().
[..]
The cryptographic processor supports following standards:
(#) The data encryption standard (DES) and Triple-DES (TDES) supported only by CRYP1 IP:
(##)64-bit data block processing
(##) chaining modes supported :
(+++) Electronic Code Book(ECB)
(+++) Cipher Block Chaining (CBC)
(##) keys length supported :64-bit, 128-bit and 192-bit.
(#) The advanced encryption standard (AES) supported by CRYP1 & TinyAES IP:
(##)128-bit data block processing
(##) chaining modes supported :
(+++) Electronic Code Book(ECB)
(+++) Cipher Block Chaining (CBC)
(+++) Counter mode (CTR)
(+++) Galois/counter mode (GCM/GMAC)
(+++) Counter with Cipher Block Chaining-Message(CCM)
(##) keys length Supported :
(+++) for CRYP1 IP: 128-bit, 192-bit and 256-bit.
(+++) for TinyAES IP: 128-bit and 256-bit
[..] This section describes the AES Galois/counter mode (GCM) supported by both CRYP1 IP:
(#) Algorithm supported :
(##) Galois/counter mode (GCM)
(##) Galois message authentication code (GMAC) :is exactly the same as
GCM algorithm composed only by an header.
(#) Four phases are performed in GCM :
(##) Init phase: IP prepares the GCM hash subkey (H) and do the IV processing
(##) Header phase: IP processes the Additional Authenticated Data (AAD), with hash
computation only.
(##) Payload phase: IP processes the plaintext (P) with hash computation + keystream
encryption + data XORing. It works in a similar way for ciphertext (C).
(##) Final phase: IP generates the authenticated tag (T) using the last block of data.
(#) structure of message construction in GCM is defined as below :
(##) 16 bytes Initial Counter Block (ICB)composed of IV and counter
(##) The authenticated header A (also knows as Additional Authentication Data AAD)
this part of the message is only authenticated, not encrypted.
(##) The plaintext message P is both authenticated and encrypted as ciphertext.
GCM standard specifies that ciphertext has same bit length as the plaintext.
(##) The last block is composed of the length of A (on 64 bits) and the length of ciphertext
(on 64 bits)
[..] This section describe The AES Counter with Cipher Block Chaining-Message
Authentication Code (CCM) supported by both CRYP1 IP:
(#) Specific parameters for CCM :
(##) B0 block : According to NIST Special Publication 800-38C,
The first block B0 is formatted as follows, where l(m) is encoded in
most-significant-byte first order(see below table 3)
(+++) Q: a bit string representation of the octet length of P (plaintext)
(+++) q The octet length of the binary representation of the octet length of the payload
(+++) A nonce (N), n The octet length of the where n+q=15.
(+++) Flags: most significant octet containing four flags for control information,
(+++) t The octet length of the MAC.
(##) B1 block (header) : associated data length(a)
没有合适的资源?快使用搜索试试~ 我知道了~
STM32F767驱动GM196模组,实现UDP网络通信【支持STM32F7系列单片机】.zip
共234个文件
h:123个
c:107个
uvoptx:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 146 浏览量
2023-06-02
18:48:14
上传
评论
收藏 1.65MB ZIP 举报
温馨提示
STM32驱动GM196模组,实现UDP网络通信。 项目代码可直接编译运行~
资源推荐
资源详情
资源评论
收起资源包目录
STM32F767驱动GM196模组,实现UDP网络通信【支持STM32F7系列单片机】.zip (234个子文件)
stm32f7xx_hal_cryp.c 229KB
stm32f7xx_hal_tim.c 221KB
stm32f7xx_hal_i2c.c 216KB
stm32f7xx_hal_jpeg.c 141KB
stm32f7xx_hal_spi.c 137KB
stm32f7xx_hal_hash.c 129KB
stm32f7xx_hal_dfsdm.c 126KB
stm32f7xx_hal_uart.c 120KB
stm32f7xx_hal_smartcard.c 110KB
stm32f7xx_hal_usart.c 103KB
stm32f7xx_hal_irda.c 101KB
stm32f7xx_hal_sd.c 101KB
stm32f7xx_hal_smbus.c 95KB
stm32f7xx_hal_qspi.c 92KB
stm32f7xx_hal_mmc.c 91KB
stm32f7xx_hal_dsi.c 87KB
stm32f7xx_hal_can.c 82KB
stm32f7xx_hal_sai.c 81KB
stm32f7xx_hal_eth.c 80KB
stm32f7xx_hal_adc.c 76KB
stm32f7xx_hal_lptim.c 76KB
stm32f7xx_hal_rcc_ex.c 75KB
stm32f7xx_hal_tim_ex.c 72KB
stm32f7xx_hal_ltdc.c 71KB
stm32f7xx_hal_dma2d.c 69KB
stm32f7xx_hal_nand.c 68KB
stm32f7xx_hal_rtc.c 64KB
stm32f7xx_hal_i2s.c 62KB
stm32f7xx_ll_usb.c 60KB
stm32f7xx_hal_rtc_ex.c 59KB
stm32f7xx_hal_pcd.c 57KB
stm32f7xx_hal_can.c 55KB
stm32f7xx_ll_tim.c 54KB
stm32f7xx_hal_spdifrx.c 53KB
stm32f7xx_ll_sdmmc.c 50KB
stm32f7xx_ll_rcc.c 48KB
stm32f7xx_hal_hash_ex.c 48KB
stm32f7xx_hal_hcd.c 47KB
stm32f7xx_hal_rcc.c 45KB
stm32f7xx_hal_dac.c 44KB
stm32f7xx_ll_adc.c 42KB
lcd.c 42KB
stm32f7xx_hal_flash_ex.c 41KB
stm32f7xx_hal_dma.c 40KB
stm32f7xx_ll_fmc.c 39KB
stm32f7xx_hal_dcmi.c 39KB
stm32f7xx_hal_adc_ex.c 38KB
stm32f7xx_hal_nor.c 38KB
lcd_ex.c 37KB
atk_mw196.c 35KB
stm32f7xx_hal_sdram.c 35KB
stm32f7xx_ll_utils.c 33KB
stm32f7xx_hal_cec.c 32KB
stm32f7xx_ll_rtc.c 32KB
stm32f7xx_hal_sram.c 29KB
stm32f7xx_hal_mdios.c 28KB
stm32f7xx_hal_rng.c 27KB
stm32f7xx_ll_dma2d.c 26KB
ltdc.c 26KB
stm32f7xx_hal_flash.c 25KB
stm32f7xx_ll_spi.c 22KB
stm32f7xx_hal_cryp_ex.c 22KB
stm32f7xx_hal_pwr.c 21KB
stm32f7xx_ll_dma.c 20KB
stm32f7xx_hal_pwr_ex.c 19KB
stm32f7xx_hal_cortex.c 19KB
stm32f7xx_hal.c 19KB
stm32f7xx_hal_gpio.c 19KB
stm32f7xx_ll_usart.c 18KB
stm32f7xx_hal_crc.c 17KB
stm32f7xx_hal_uart_ex.c 17KB
stm32f7xx_hal_exti.c 15KB
stm32f7xx_hal_wwdg.c 15KB
stm32f7xx_hal_dac_ex.c 15KB
stm32f7xx_hal_timebase_rtc_alarm_template.c 11KB
stm32f7xx_ll_gpio.c 11KB
stm32f7xx_hal_timebase_rtc_wakeup_template.c 11KB
stm32f7xx_hal_dma_ex.c 10KB
stm32f7xx_ll_dac.c 10KB
usart.c 10KB
stm32f7xx_hal_iwdg.c 9KB
stm32f7xx_ll_lptim.c 9KB
stm32f7xx_hal_i2c_ex.c 9KB
sdram.c 9KB
delay.c 9KB
stm32f7xx_ll_i2c.c 8KB
system_stm32f7xx.c 8KB
stm32f7xx_hal_crc_ex.c 8KB
stm32f7xx_ll_exti.c 7KB
stm32f7xx_hal_smartcard_ex.c 7KB
sys.c 6KB
stm32f7xx_hal_pcd_ex.c 6KB
stm32f7xx_hal_ltdc_ex.c 6KB
atk_mw196_uart.c 6KB
stm32f7xx_hal_timebase_tim_template.c 5KB
key.c 4KB
stm32f7xx_it.c 4KB
demo.c 4KB
stm32f7xx_hal_spi_ex.c 3KB
stm32f7xx_ll_crc.c 3KB
共 234 条
- 1
- 2
- 3
资源评论
不脱发的程序猿
- 粉丝: 26w+
- 资源: 5816
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功