AM64x MCU+ SDK  08.01.00
SA2UL

Ultra lite Security Accelerator(SA2_UL) subsystem is designed to provide low-cost hardware cryptographic acceleration for the Encryption and authentication.

Features Supported

  • Encryption and authentication
  • Encryption and authentication of content in applications requiring DRM (digital rights management) and content/asset protection.
  • Crypto function library for software acceleration
    • AES - 128, 256 operations
    • SHA2 - 256, 512 operations
  • supports Randam number generator(RNG)
    • Keys and initialization values (IVs) for encryption
    • Keys for keyed MAC algorithms
    • Private keys for digital signature algorithms
    • Values to be used in entity authentication mechanisms
    • PIN and password generation

SysConfig Features

Features NOT Supported

Usage Overview

API Sequence

To use the sa2ul module,following APIs are needed:

Initializing the SA2UL Module

  • SA2UL_init() must be called before any other SA2UL APIs. This function iterates through the elements of the gSa2ulConfig[] array, calling the element's device implementation SA2UL initialization function. Please note that initializing SA2UL driver is taken care by the SysConfig generated code.

Opening the SA2UL Driver

  • After initializing the SA2UL driver by calling SA2UL_init(), the application can open a SA2UL instance by calling SA2UL_open(). Please note that opening SA2UL driver is taken care by the SysConfig generated code. This function takes an index into the gSa2ulConfig[] array, and the SA2UL parameters data structure. The SA2UL instance is specified by the index of the SA2UL in gSa2ulConfig[]. Calling SA2UL_open() second time with the same index previously passed to SA2UL_open() will result in an error.
    Re-use the index if the instance is closed via SA2UL_close().

If no SA2UL_init structure is passed to SA2UL_open(), default values are used. If the open call is successful, it returns a non-NULL value.

Ultra lite Security Accelerator

RNG (Random number generation)

Example Usage

Include the below file to access the APIs

#include<stdio.h>
#include <security/sa2ul.h>
Crypto_ShaContext gCryptoSha512Context;
static uint8_t gCryptoSha512TestBuf[9] = {"abcdefpra"};

sa2ul_sha Example

int32_t status;
uint8_t sha512sum[64];
Crypto_ShaHandle shaHandle;
/* Init SA */
/* Open SHA instance */
params.type = CRYPTO_TYPE_HW;
shaHandle = Crypto_shaOpen(&gCryptoSha512Context, &params);
/* Configure secure context */
ctxParams.opType = SA2UL_OP_AUTH;
ctxParams.inputLen = sizeof(gCryptoSha512TestBuf);
gCtxObj.totalLengthInByes = sizeof(gCryptoSha512TestBuf);
status = SA2UL_contextAlloc(gCryptoSha512Context.drvHandle,&gCtxObj,&ctxParams);
/* Perform SHA operation */
status = SA2UL_contextProcess(&gCtxObj,&gCryptoSha512TestBuf[0], sizeof(gCryptoSha512TestBuf), sha512sum);
/* Close SHA instance */
status = Crypto_shaClose(shaHandle);
SA2UL_contextFree(&gCtxObj);
/*deinit SA */

API

APIs for SA2UL

SA2UL_ContextParams::hashAlg
uint8_t hashAlg
Definition: sa2ul.h:194
SA2UL_ContextParams
Parameters passed to SA2UL_contextAlloc()
Definition: sa2ul.h:191
SA2UL_ContextObject
Definition: sa2ul.h:420
SA2UL_ContextParams::opType
uint8_t opType
Definition: sa2ul.h:192
SA2UL_contextFree
int32_t SA2UL_contextFree(SA2UL_ContextObject *pCtxObj)
Function to free secure context configuration.
Crypto_ShaParams::authMode
uint32_t authMode
Definition: crypto_sha.h:112
SA2UL_contextAlloc
int32_t SA2UL_contextAlloc(SA2UL_Handle handle, SA2UL_ContextObject *ctxObj, const SA2UL_ContextParams *ctxPrms)
Function to configure secure context.
crypto_sha.h
SA2UL_contextProcess
int32_t SA2UL_contextProcess(SA2UL_ContextObject *ctxObj, const uint8_t *input, uint32_t ilen, uint8_t *output)
Function to transfer and recieve data buffer.
SA2UL_init
void SA2UL_init(void)
This function initializes the SA2UL module.
Crypto_ShaParams
Parameters passed during Crypto_shaOpen()
Definition: crypto_sha.h:111
SA2UL_OP_AUTH
#define SA2UL_OP_AUTH
SA2UL operations authentication.
Definition: sa2ul.h:114
sa2ul.h
This file contains the prototype of SA2UL driver APIs.
SA2UL_ContextParams::inputLen
uint32_t inputLen
Definition: sa2ul.h:206
SA2UL_ContextObject::totalLengthInByes
uint32_t totalLengthInByes
Definition: sa2ul.h:427
SA2UL_HASH_ALG_SHA2_512
#define SA2UL_HASH_ALG_SHA2_512
Hash Algo SHA-512.
Definition: sa2ul.h:103
Crypto_ShaHandle
void * Crypto_ShaHandle
Handle to the Crypto SHA driver returned by Crypto_shaOpen()
Definition: crypto_sha.h:98
CRYPTO_SHA_AUTHMODE_SHA2_512
#define CRYPTO_SHA_AUTHMODE_SHA2_512
512-bit SHA2 mode. Note: This mode is used at Data Mode only for SA2_UL
Definition: crypto_sha.h:75
Crypto_ShaParams::type
uint32_t type
Definition: crypto_sha.h:114
Crypto_shaOpen
Crypto_ShaHandle Crypto_shaOpen(Crypto_ShaContext *ctx, const Crypto_ShaParams *params)
This function gives the configuration based on type.
Crypto_shaClose
int32_t Crypto_shaClose(Crypto_ShaHandle handle)
This function clears a Secure Hash Algorithm (SHA ) context.
SA2UL_deinit
void SA2UL_deinit(void)
This function de-initializes the SA2UL module.
Crypto_ShaParams_init
void Crypto_ShaParams_init(Crypto_ShaParams *params)
Set default parameters in the Crypto_ShaParams structure.