MT7687 API Reference  LinkIt SDK v4
DES

This section introduces the DES driver APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, DES function groups, enums, structures and functions. More...

Overview

This section introduces the DES driver APIs including terms and acronyms, supported features, software architecture, details on how to use this driver, DES function groups, enums, structures and functions.

Terms and acronyms

Terms Details
DES The Data Encryption Standard. For more information, please refer to introduction to the DES in wikipedia .
CBC The Cipher Block Chaining. For more information, please refer to introduction to the CBC in wikipedia .
ECB The Electronic Codebook. For more information, please refer to introduction to the ECB in wikipedia .

Supported features

MT7687 has two encryption modes in DES, CBC mode and ECB mode. In the CBC mode, each block of encryption mode is XOR'ed with the previous cipher block before being encrypted, Each cipher text block depends on all plain text blocks processed up to that point. In ECB mode, the message is divided into blocks, and each block is encrypted separately.

How to use this driver

Functions

hal_des_status_t hal_des_cbc_encrypt (hal_des_buffer_t *encrypted_text, hal_des_buffer_t *plain_text, hal_des_buffer_t *key, uint8_t init_vector[HAL_DES_CBC_IV_LENGTH])
 DES encryption in the CBC mode. More...
 
hal_des_status_t hal_des_cbc_decrypt (hal_des_buffer_t *plain_text, hal_des_buffer_t *encrypted_text, hal_des_buffer_t *key, uint8_t init_vector[HAL_DES_CBC_IV_LENGTH])
 DES decryption in the CBC mode. More...
 
hal_des_status_t hal_des_ecb_encrypt (hal_des_buffer_t *encrypted_text, hal_des_buffer_t *plain_text, hal_des_buffer_t *key)
 DES encryption in the ECB mode. More...
 
hal_des_status_t hal_des_ecb_decrypt (hal_des_buffer_t *plain_text, hal_des_buffer_t *encrypted_text, hal_des_buffer_t *key)
 DES decryption in the ECB mode. More...
 

Modules

 Define
 
 Enum
 
 Struct
 

Function Documentation

hal_des_status_t hal_des_cbc_decrypt ( hal_des_buffer_t plain_text,
hal_des_buffer_t encrypted_text,
hal_des_buffer_t key,
uint8_t  init_vector[HAL_DES_CBC_IV_LENGTH] 
)

DES decryption in the CBC mode.

Parameters
[out]plain_textis the target plain text.
[in]encrypted_textis the source encrypted text.
[in]keyis the DES key for encryption.
[in]init_vectoris the DES initialization vector for encryption.
Returns
if OK, returns HAL_DES_STATUS_OK
Example
Sample code, please refer to How to use this driver
hal_des_status_t hal_des_cbc_encrypt ( hal_des_buffer_t encrypted_text,
hal_des_buffer_t plain_text,
hal_des_buffer_t key,
uint8_t  init_vector[HAL_DES_CBC_IV_LENGTH] 
)

DES encryption in the CBC mode.

Parameters
[out]encrypted_textis the target encrypted text.
[in]plain_textis the source plain text.
[in]keyis the DES key for encryption.
[in]init_vectoris the DES initialization vector for encryption.
Returns
if OK, returns HAL_DES_STATUS_OK
Example
Sample code, please refer to How to use this driver
hal_des_status_t hal_des_ecb_decrypt ( hal_des_buffer_t plain_text,
hal_des_buffer_t encrypted_text,
hal_des_buffer_t key 
)

DES decryption in the ECB mode.

Parameters
[out]plain_textis the target plain text.
[in]encrypted_textis the source encrypted text.
[in]keyis the DES key for encryption.
Returns
if OK, returns HAL_DES_STATUS_OK
Example
Sample code, please refer to How to use this driver
hal_des_status_t hal_des_ecb_encrypt ( hal_des_buffer_t encrypted_text,
hal_des_buffer_t plain_text,
hal_des_buffer_t key 
)

DES encryption in the ECB mode.

Parameters
[out]encrypted_textis the target encrypted text.
[in]plain_textis the source plain text.
[in]keyis the DES key for encryption.
Returns
if OK, returns HAL_DES_STATUS_OK
Example
Sample code, please refer to How to use this driver