MCUX CLNS
MCUX Crypto Library Normal Secure
 
Loading...
Searching...
No Matches
mcuxClRsa_Cipher_Crypt_RSAES_OAEP_example.c

Example for the mcuxCRsa component realize RSA OAEP encrypt/decrypt operation using mcuxClCipher_crypt.

Example for the mcuxCRsa component realize RSA OAEP encrypt/decrypt operation using mcuxClCipher_crypt. Example for the mcuxCRsa component realize encrypt/decrypt operation using mcuxClCipher_crypt for:

/*--------------------------------------------------------------------------*/
/* Copyright 2020-2024 NXP */
/* */
/* NXP Proprietary. This software is owned or controlled by NXP and may */
/* only be used strictly in accordance with the applicable license terms. */
/* By expressly accepting such terms or by downloading, installing, */
/* activating and/or otherwise using the software, you are agreeing that */
/* you have read, and that you agree to comply with and are bound by, such */
/* license terms. If you do not agree to be bound by the applicable */
/* license terms, then you may not retain, install, activate or otherwise */
/* use the software. */
/*--------------------------------------------------------------------------*/
#include <mcuxClSession.h>
#include <mcuxClKey.h>
#include <mcuxClRandom.h>
#include <mcuxClRsa.h>
#include <mcuxClHash.h>
#include <mcuxClHashModes.h>
#include <mcuxClCipher.h>
#include <mcuxClBuffer.h>
#include <mcuxClCore_Examples.h>
#include <mcuxClExample_Session_Helper.h>
#include <mcuxClEls.h> // Interface to the entire mcuxClEls component
#include <mcuxClExample_ELS_Helper.h>
/**********************************************************/
/* Example test vectors */
/**********************************************************/
#define RSA_KEY_BIT_LENGTH (MCUXCLKEY_SIZE_2048)
#define RSA_KEY_BYTE_LENGTH (RSA_KEY_BIT_LENGTH / 8u)
#define RSA_PUBLIC_EXP_BYTE_LENGTH (3u)
#define RSA_OAEP_LABEL_LENGTH (0u)
#define INPUT_MESSAGE_LENGTH (64u)
static const uint8_t modulus[RSA_KEY_BYTE_LENGTH] __attribute__ ((aligned (4))) = {
0xd3u, 0x24u, 0x96u, 0xe6u, 0x2du, 0x16u, 0x34u, 0x6eu, 0x06u, 0xe7u, 0xa3u, 0x1cu, 0x12u, 0x0au, 0x21u, 0xb5u,
0x45u, 0x32u, 0x32u, 0x35u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, 0x1fu, 0x1du, 0xa5u, 0x00u, 0xb8u, 0xf5u, 0x7bu, 0xb8u, 0xc3u, 0x7cu, 0xa5u, 0xeau, 0x17u, 0x7cu,
0x4eu, 0x8au, 0x39u, 0x06u, 0xb7u, 0xc1u, 0x42u, 0xf7u, 0x78u, 0x8cu, 0x45u, 0xeau, 0xd0u, 0xc9u, 0xbcu, 0x36u,
0x92u, 0x48u, 0x3au, 0xd8u, 0x13u, 0x61u, 0x11u, 0x45u, 0xb4u, 0x1fu, 0x9cu, 0x01u, 0x2eu, 0xf2u, 0x87u, 0xbeu,
0x8bu, 0xbfu, 0x93u, 0x19u, 0xcfu, 0x4bu, 0x91u, 0x84u, 0xdcu, 0x8eu, 0xffu, 0x83u, 0x58u, 0x9bu, 0xe9u, 0x0cu,
0x54u, 0x81u, 0x14u, 0xacu, 0xfau, 0x5au, 0xbfu, 0x79u, 0x54u, 0xbfu, 0x9fu, 0x7au, 0xe5u, 0xb4u, 0x38u, 0xb5u
};
static const uint8_t privExp[RSA_KEY_BYTE_LENGTH] __attribute__ ((aligned (4))) = {
0x15u, 0x5fu, 0xe6u, 0x60u, 0xcdu, 0xdeu, 0xaau, 0x17u, 0x1bu, 0x5eu, 0xd6u, 0xbdu, 0xd0u, 0x3bu, 0xb3u, 0x56u,
0xe0u, 0xf6u, 0xe8u, 0x6bu, 0x5au, 0x3cu, 0x26u, 0xf3u, 0xceu, 0x7du, 0xaeu, 0x00u, 0x8cu, 0x4eu, 0x38u, 0xa9u,
0xa9u, 0x7fu, 0xa5u, 0x97u, 0xb2u, 0xb9u, 0x0au, 0x45u, 0x10u, 0xd2u, 0x23u, 0x8du, 0x3fu, 0x15u, 0x8au, 0xb8u,
0x91u, 0x97u, 0xfbu, 0x08u, 0xa5u, 0xb7u, 0x4cu, 0xfeu, 0x5cu, 0xc8u, 0xf1u, 0x3du, 0x47u, 0x09u, 0x62u, 0x91u,
0xd0u, 0x05u, 0x38u, 0xaau, 0x58u, 0x93u, 0xd8u, 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 0x7fu, 0x72u, 0xbfu, 0x52u, 0xb3u, 0x31u, 0x37u, 0xd1u, 0x49u, 0xb6u, 0xf6u,
0x06u, 0xe4u, 0x59u, 0x61u, 0x7du, 0xaau, 0x8eu, 0x10u, 0x18u, 0xa8u, 0x14u, 0x1du, 0x89u, 0x4eu, 0xcau, 0xffu
};
static const uint8_t pubExp[RSA_PUBLIC_EXP_BYTE_LENGTH] __attribute__ ((aligned (4))) = {
0x01u, 0x00u, 0x01u
};
static const uint8_t plainData[INPUT_MESSAGE_LENGTH] = {
0x61u, 0x62u, 0x63u, 0x64u, 0x65u, 0x66u, 0x67u, 0x68u, 0x69u, 0x6Au, 0x6Bu, 0x6Cu, 0x6Du, 0x6Eu, 0x6Fu, 0x70u,
0x62u, 0x63u, 0x64u, 0x65u, 0x66u, 0x67u, 0x68u, 0x69u, 0x6Au, 0x6Bu, 0x6Cu, 0x6Du, 0x6Eu, 0x6Fu, 0x70u, 0x71u,
0x63u, 0x64u, 0x65u, 0x66u, 0x67u, 0x68u, 0x69u, 0x6Au, 0x6Bu, 0x6Cu, 0x6Du, 0x6Eu, 0x6Fu, 0x70u, 0x71u, 0x72u,
0x64u, 0x65u, 0x66u, 0x67u, 0x68u, 0x69u, 0x6Au, 0x6Bu, 0x6Cu, 0x6Du, 0x6Eu, 0x6Fu, 0x70u, 0x71u, 0x72u, 0x73u
};
MCUXCLEXAMPLE_FUNCTION(mcuxClRsa_Cipher_Crypt_RSAES_OAEP_example)
{
/**************************************************************************/
/* Preparation: setup session */
/**************************************************************************/
if(!mcuxClExample_Els_Init(MCUXCLELS_RESET_DO_NOT_CANCEL))
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
#define CPU_WA_BUFFER_SIZE MCUXCLCORE_MAX(MCUXCLCORE_MAX(\
MCUXCLRANDOMMODES_NCINIT_WACPU_SIZE,\
MCUXCLRSA_ENCRYPT_WACPU_SIZE(RSA_KEY_BIT_LENGTH)),\
MCUXCLRSA_DECRYPT_WACPU_SIZE(RSA_KEY_BIT_LENGTH))
#define PKC_WA_BUFFER_SIZE MCUXCLCORE_MAX(MCUXCLRSA_ENCRYPT_WAPKC_SIZE(RSA_KEY_BIT_LENGTH),\
MCUXCLRSA_DECRYPT_WAPKC_SIZE(RSA_KEY_BIT_LENGTH))
mcuxClSession_Handle_t session = &sessionDesc;
//Allocate and initialize session
MCUXCLEXAMPLE_ALLOCATE_AND_INITIALIZE_SESSION(session,
CPU_WA_BUFFER_SIZE,
PKC_WA_BUFFER_SIZE);
/**************************************************************************/
/* Initialize the PRNG */
/**************************************************************************/
MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(prngInit_result, prngInit_token, mcuxClRandom_ncInit(session));
if((MCUX_CSSL_FP_FUNCTION_CALLED(mcuxClRandom_ncInit) != prngInit_token) || (MCUXCLRANDOM_STATUS_OK != prngInit_result))
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
/**************************************************************************/
/* Preparation: setup RSA key */
/**************************************************************************/
/* Allocation of key data buffers, which contain RSA key parameters */
MCUX_CSSL_ANALYSIS_START_SUPPRESS_DISCARD_CONST("Required by API, elements are not modified in executed scenario")
mcuxClRsa_KeyData_Plain_t privKeyStruct = {
.modulus.keyEntryLength = RSA_KEY_BYTE_LENGTH,
.exponent.pKeyEntryData = (uint8_t*)privExp,
.exponent.keyEntryLength = sizeof(privExp)
};
MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_DISCARD_CONST()
MCUX_CSSL_ANALYSIS_START_SUPPRESS_DISCARD_CONST("Required by API, elements are not modified in executed scenario")
mcuxClRsa_KeyData_Plain_t pubKeyStruct = {
.modulus.keyEntryLength = RSA_KEY_BYTE_LENGTH,
.exponent.pKeyEntryData = (uint8_t*)pubExp,
.exponent.keyEntryLength = sizeof(pubExp)
};
MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_DISCARD_CONST()
/* Initialize RSA private key */
uint32_t privKeyDesc[MCUXCLKEY_DESCRIPTOR_SIZE_IN_WORDS];
MCUX_CSSL_ANALYSIS_START_PATTERN_REINTERPRET_MEMORY_OF_OPAQUE_TYPES()
mcuxClKey_Handle_t privKey = (mcuxClKey_Handle_t) privKeyDesc;
MCUX_CSSL_ANALYSIS_STOP_PATTERN_REINTERPRET_MEMORY_OF_OPAQUE_TYPES()
uint32_t sizeOfPrivKey = (uint32_t)sizeof(privKeyStruct);
MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(keyInitPriv_result, keyInitPriv_token, mcuxClKey_init(
/* mcuxClSession_Handle_t session */ session,
MCUX_CSSL_ANALYSIS_START_SUPPRESS_POINTER_INCOMPATIBLE("The pointer privKey points to an object of the right type, the cast was valid.")
/* mcuxClKey_Handle_t key */ privKey,
MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_POINTER_INCOMPATIBLE()
/* mcuxClKey_Type_t type */ mcuxClKey_Type_Rsa_PrivatePlain_2048,
/* uint8_t * pKeyData */ (uint8_t *) &privKeyStruct,
/* uint32_t keyDataLength */ sizeOfPrivKey
));
if((MCUX_CSSL_FP_FUNCTION_CALLED(mcuxClKey_init) != keyInitPriv_token) || (MCUXCLKEY_STATUS_OK != keyInitPriv_result))
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
/* Initialize RSA public key */
uint32_t pubKeyDesc[MCUXCLKEY_DESCRIPTOR_SIZE_IN_WORDS];
MCUX_CSSL_ANALYSIS_START_PATTERN_REINTERPRET_MEMORY_OF_OPAQUE_TYPES()
mcuxClKey_Handle_t pubKey = (mcuxClKey_Handle_t) pubKeyDesc;
MCUX_CSSL_ANALYSIS_STOP_PATTERN_REINTERPRET_MEMORY_OF_OPAQUE_TYPES()
uint32_t sizeOfPubKey = (uint32_t)sizeof(pubKeyStruct);
MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(keyInitPub_result, keyInitPub_token, mcuxClKey_init(
/* mcuxClSession_Handle_t session */ session,
MCUX_CSSL_ANALYSIS_START_SUPPRESS_POINTER_INCOMPATIBLE("The pointer pubKey is of the right type (mcuxClKey_Handle_t)")
/* mcuxClKey_Handle_t key */ pubKey,
MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_POINTER_INCOMPATIBLE()
/* mcuxClKey_Type_t type */ mcuxClKey_Type_Rsa_Public_2048,
/* uint8_t * pKeyData */ (uint8_t *) &pubKeyStruct,
/* uint32_t keyDataLength */ sizeOfPubKey
));
if((MCUX_CSSL_FP_FUNCTION_CALLED(mcuxClKey_init) != keyInitPub_token) || (MCUXCLKEY_STATUS_OK != keyInitPub_result))
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
/**************************************************************************/
/* Preparation: setup RSA OAEP encrypt mode with SHA-256 */
/**************************************************************************/
/* Fill mode descriptor with the relevant data for the selected padding and hash algorithms */
uint32_t cipherModeBytes[MCUXCLRSA_CIPHER_MODE_SIZE_IN_WORD];
MCUX_CSSL_ANALYSIS_START_PATTERN_REINTERPRET_MEMORY_OF_OPAQUE_TYPES()
MCUX_CSSL_ANALYSIS_STOP_PATTERN_REINTERPRET_MEMORY_OF_OPAQUE_TYPES()
mcuxClRsa_CipherModeConstructor_RSAES_OAEP_Encrypt(
MCUX_CSSL_ANALYSIS_START_SUPPRESS_POINTER_INCOMPATIBLE("The pointer pCipherMode points to an object of the right type, the cast was valid.")
/* mcuxClCipher_ModeDescriptor_t * pCipherMode: */ pCipherMode,
MCUX_CSSL_ANALYSIS_STOP_SUPPRESS_POINTER_INCOMPATIBLE()
/* mcuxClHash_Algo_t hashAlgorithm: */ mcuxClHash_Algorithm_Sha256
);
/**************************************************************************/
/* Encryption */
/**************************************************************************/
uint8_t encryptedData[RSA_KEY_BYTE_LENGTH];
uint32_t encryptedSize = 0u;
MCUXCLBUFFER_INIT(encryptedDataBuf, session, encryptedData, RSA_KEY_BYTE_LENGTH);
uint32_t sizeOfPlainData = (uint32_t)sizeof(plainData);
MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(encrypt_result, encrypt_token, mcuxClCipher_crypt(
/* mcuxClSession_Handle_t session */ session,
/* const mcuxClKey_Handle_t key */ pubKey,
/* mcuxClCipher_Mode_t mode */ pCipherMode,
MCUX_CSSL_ANALYSIS_START_PATTERN_NULL_POINTER_CONSTANT()
/* mcuxCl_InputBuffer_t pIv */ NULL, /* label for OAEP decoding, set to NULL if no label is provided */
MCUX_CSSL_ANALYSIS_STOP_PATTERN_NULL_POINTER_CONSTANT()
/* uint32_t ivLength */ RSA_OAEP_LABEL_LENGTH, /* label length */
/* mcuxCl_InputBuffer_t pIn */ plainDataBuf,
/* uint32_t inLength */ sizeOfPlainData,
/* mcuxCl_Buffer_t pOut */ encryptedDataBuf,
/* uint32_t * const pOutLength */ &encryptedSize
));
if((MCUX_CSSL_FP_FUNCTION_CALLED(mcuxClCipher_crypt) != encrypt_token) || (MCUXCLCIPHER_STATUS_OK != encrypt_result))
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
if(encryptedSize != sizeof(encryptedData))
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
/**************************************************************************/
/* Preparation: setup RSA OAEP decrypt mode with SHA-256 */
/**************************************************************************/
mcuxClRsa_CipherModeConstructor_RSAES_OAEP_Decrypt(
/* mcuxClCipher_ModeDescriptor_t * pCipherMode: */ pCipherMode,
/* mcuxClHash_Algo_t hashAlgorithm: */ mcuxClHash_Algorithm_Sha256
);
/**************************************************************************/
/* Decryption */
/**************************************************************************/
uint32_t decryptedSize = 0u;
uint8_t decryptedData[INPUT_MESSAGE_LENGTH];
MCUXCLBUFFER_INIT(decryptedDataBuf, session, decryptedData, INPUT_MESSAGE_LENGTH);
MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(decrypt_result, decrypt_token, mcuxClCipher_crypt(
/* mcuxClSession_Handle_t session */ session,
/* const mcuxClKey_Handle_t key */ privKey,
/* mcuxClCipher_Mode_t mode */ pCipherMode,
MCUX_CSSL_ANALYSIS_START_PATTERN_NULL_POINTER_CONSTANT()
/* mcuxCl_InputBuffer_t pIv */ NULL, /* label for OAEP decoding, set to NULL if no label is provided */
MCUX_CSSL_ANALYSIS_STOP_PATTERN_NULL_POINTER_CONSTANT()
/* uint32_t ivLength */ RSA_OAEP_LABEL_LENGTH, /* label length */
/* mcuxCl_InputBuffer_t pIn */ (mcuxCl_InputBuffer_t)encryptedDataBuf,
/* uint32_t inLength */ encryptedSize,
/* mcuxCl_Buffer_t pOut */ decryptedDataBuf,
/* uint32_t * const pOutLength */ &decryptedSize
));
if((MCUX_CSSL_FP_FUNCTION_CALLED(mcuxClCipher_crypt) != decrypt_token) || (MCUXCLCIPHER_STATUS_OK != decrypt_result))
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
if(decryptedSize != sizeof(decryptedData))
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
/**************************************************************************/
/* Destroy the current session */
/**************************************************************************/
if(!mcuxClExample_Session_Clean(session))
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
if(!mcuxClExample_Els_Disable())
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
/**************************************************************************/
/* Verification */
/**************************************************************************/
if(!mcuxClCore_assertEqual(plainData, decryptedData, sizeof(plainData)))
{
return MCUXCLEXAMPLE_STATUS_ERROR;
}
return MCUXCLEXAMPLE_STATUS_OK;
}
#define RSA_PUBLIC_EXP_BYTE_LENGTH
The public exponent has a length of three bytes.
Definition mcuxClRsa_verify_pssverify_sha2_256_example.c:44
#define RSA_KEY_BYTE_LENGTH
Converting the key-bitlength to bytelength.
Definition mcuxClRsa_verify_pssverify_sha2_256_example.c:43
static const ALIGNED uint8_t modulus[RSA_KEY_BYTE_LENGTH]
Example value for public RSA modulus N.
Definition mcuxClRsa_verify_pssverify_sha2_256_example.c:51
static const uint8_t plainData[INPUT_MESSAGE_LENGTH]
Example plaintext to be encrypted.
Definition mcuxClRsa_Cipher_Crypt_RSAES_OAEP_example.c:107
#define RSA_OAEP_LABEL_LENGTH
The label length is set to 0 in this example.
Definition mcuxClRsa_Cipher_Crypt_RSAES_OAEP_example.c:50
#define INPUT_MESSAGE_LENGTH
Arbitrary size of the message to be encrypted/decrypted.
Definition mcuxClRsa_Cipher_Crypt_RSAES_OAEP_example.c:51
Provides the API for the CL buffer types.
Top-level include file for the mcuxClCipher component.
mcuxClCipher_Status_t mcuxClCipher_crypt(mcuxClSession_Handle_t session, mcuxClKey_Handle_t key, mcuxClCipher_Mode_t mode, mcuxCl_InputBuffer_t pIv, uint32_t ivLength, mcuxCl_InputBuffer_t pIn, uint32_t inLength, mcuxCl_Buffer_t pOut, uint32_t *const pOutLength)
One-shot encryption/decryption function.
Definition of macros.
Top-level include file for the ELS driver.
Top-level include file for the mcuxClHash component.
Top-level include file for the mcuxClKey component.
Top level header of mcuxClRandom component.
Top level header of mcuxClRandomModes component.
Top-level include file for the mcuxClRsa component.
Top-level include file for the mcuxClSession component.
#define MCUXCLBUFFER_INIT(name, info, ptr, size)
Initialize an input/output buffer (mcuxCl_Buffer_t).
Definition mcuxClBuffer.h:71
#define MCUXCLBUFFER_INIT_RO(name, info, ptr, size)
Initialize an input buffer (mcuxCl_InputBuffer_t) with plain CPU handling.
Definition mcuxClBuffer.h:88
const uint8_t * mcuxCl_InputBuffer_t
Input buffer type.
Definition mcuxClBuffer_Pointer.h:46
struct mcuxClCipher_ModeDescriptor mcuxClCipher_ModeDescriptor_t
Cipher mode/algorithm descriptor type.
Definition mcuxClCipher_Types.h:54
#define MCUXCLELS_RESET_DO_NOT_CANCEL
Set this option at mcuxClEls_ResetOption_t to abort the requested command if another ELS operation is...
Definition mcuxClEls_Common.h:119
static mcuxClHash_Algo_t mcuxClHash_Algorithm_Sha256
Sha-256 algorithm Sha-256 hash calculation using the Hash functionality of ELS, it supports RTF.
Definition mcuxClHashModes_Algorithms.h:121
#define MCUXCLKEY_STATUS_OK
Key operation successful.
Definition mcuxClKey_Constants.h:39
mcuxClKey_Status_t mcuxClKey_init(mcuxClSession_Handle_t pSession, mcuxClKey_Handle_t key, mcuxClKey_Type_t type, const uint8_t *pKeyData, uint32_t keyDataLength)
Initializes a key handle.
mcuxClKey_Descriptor_t *const mcuxClKey_Handle_t
Key handle type.
Definition mcuxClKey_Types.h:88
mcuxClRandom_Status_t mcuxClRandom_ncInit(mcuxClSession_Handle_t pSession)
Non-cryptographic PRNG initialization function.
mcuxClSession_Descriptor_t *const mcuxClSession_Handle_t
Type for mcuxClSession Handle.
Definition mcuxClSession_Types.h:113
#define MCUX_CSSL_FP_FUNCTION_CALL_BEGIN(...)
Call a flow protected function and check the protection token.
Definition mcuxCsslFlowProtection.h:581
#define MCUX_CSSL_FP_FUNCTION_CALLED(...)
Expectation of a called function.
Definition mcuxCsslFlowProtection.h:735
#define MCUX_CSSL_FP_FUNCTION_CALL_END(...)
End a function call section started by MCUX_CSSL_FP_FUNCTION_CALL_BEGIN.
Definition mcuxCsslFlowProtection.h:616
#define MCUXCLRANDOM_STATUS_OK
Random function returned successfully.
Definition mcuxClRandom_Constants.h:46
Structure type for Rsa plain key data.
Definition mcuxClRsa_KeyTypes.h:185
mcuxClRsa_KeyEntry_t modulus
Key entry for the modulus.
Definition mcuxClRsa_KeyTypes.h:186
uint8_t * pKeyEntryData
Pointer to buffer containing the key entry data in big-endian byte order.
Definition mcuxClRsa_Types.h:131
Structure for mcuxClSession Descriptor.
Definition mcuxClSession_Types.h:121