xilsecure
Vitis Drivers API Documentation
xilsecure_versal_ecdsa_client_example.c File Reference

Overview

This example tests the Xilsecure client elliptic APIs.

NOTE: By default this example is created with data in LITTLE endian format, If user changes the XilSecure BSP xsecure_elliptic_endianness configuration to BIG endian, data buffers shall be created in BIG endian format. Also, this configuration is valid only over Server BSP, client side has no impact.

To build this application, xilmailbox library must be included in BSP and xilsecure must be in client mode This example is supported for Versal and Versal Net devices. Irrespective of endianness, outputs will result in Big Endian format.

Note

Procedure to link and compile the example for the default ddr less designs

The default linker settings places a software stack, heap and data in DDR memory. For this example to work, any data shared between client running on A72/R5/PL and server running on PMC, should be placed in area which is accessible to both client and server.

Following is the procedure to compile the example on OCM or any memory region which can be accessed by server

    1. Open example linker script(lscript.ld) in Vitis project and section to memory mapping should
            be updated to point all the required sections to shared memory(OCM or TCM)
            using a memory region drop down selection

                                    OR

    1. In linker script(lscript.ld) user can add new memory section in source tab as shown below
            .sharedmemory : {
                    . = ALIGN(4);
                    __sharedmemory_start = .;
                    *(.sharedmemory)
                    *(.sharedmemory.*)
                    *(.gnu.linkonce.d.*)
                    __sharedmemory_end = .;
                    } > versal_cips_0_pspmc_0_psv_ocm_ram_0_psv_ocm_ram_0

            2. In this example ".data" section elements that are passed by reference to the server-side should
               be stored in the above shared memory section. To make it happen in below example,
       replace ".data" in attribute section with ".sharedmemory". For example,
               static const u8 Hash_P384[] __attribute__ ((section (".data.Hash_P384")))
                                    should be changed to
               static const u8 Hash_P384[] __attribute__ ((section (".sharedmemory.Hash_P384")))

To keep things simple, by default the cache is disabled for this example Maximum supported Hash length for each curve is same as the curve size.

MODIFICATION HISTORY:
Ver   Who  Date        Changes
----- ---- ---------- -------------------------------------------------------
1.0   har  08/24/2020 Initial release
4.3   har  08/24/2020 Updated file version to sync with library version
4.5   kal  03/23/2021 Updated file for client support.
      har  06/02/2021 Fixed GCC warnings for R5 compiler
4.7   kpt  01/13/2022 Added support for PL microblaze
      kpt  03/16/2022 Removed IPI related code and added mailbox support
      kpt  04/11/2022 Added comment on usage of shared memory
5.2   am   05/03/2023 Added KAT before crypto usage
      yog  06/07/2023 Added support for P-256 Curve
      yog  07/28/2023 Added support to handle endianness
      am   08/18/2023 Updated Hash size to 48bytes for P521 curve
5.4   mb   04/13/2024 Added support for P-192 Curve
      mb   04/13/2024 Added support for P-224 Curve
      mb   07/05/2024 Ported all curves test API's into single generic API.
      pre  08/29/24 Added SSIT support
Note

Functions

int main ()
 Main function to call the XSecure_TestP384, XSecure_TestP521 and XSecure_TestP256. More...
 

Function Documentation

int main ( void  )

Main function to call the XSecure_TestP384, XSecure_TestP521 and XSecure_TestP256.

Parameters
None
Returns
  • XST_FAILURE if the ecdsa failed.

References XSecure_ClientInit(), XSECURE_ECC_NIST_P192, XSECURE_ECC_NIST_P224, XSECURE_ECC_NIST_P256, XSECURE_ECC_NIST_P384, XSECURE_ECC_NIST_P521, XSECURE_ECDSA_PRIME, XSecure_EllipticSignGenKat(), and XSecure_EllipticSignVerifyKat().