Freescale Semiconductor SEC2SWUG User Manual

Reference device driver

Advertisement

Quick Links

Freescale Semiconductor
SEC 2.0 Reference Device Driver
User's Guide

1 Overview

The SEC2 device driver manages the operation of the SEC 2.0
commonly instantiated into PowerQUICC processors. It is a fully
functional component, meant to serve as an example of application
interaction with the SEC2 core.
The driver is coded in ANSI C. In it's design, an attempt has been
made to write a device driver that is as operating system agnostic
as practical. Where necessary, operating system dependencies are
identified and
Section 8, "Porting"
Testing has been accomplished on VxWorks 5.5 and LinuxPPC
using kernel version 2.4.27.
Application interfaces to this driver are implemented through the
function call. Requests made through this interface can
ioctl()
be broken down into specific components, including
miscellaneous requests and process requests. The miscellaneous
requests are any requests not related to the direct processing of
data by the SEC2 core.
Process requests comprise the majority of the requests and all are
executed using the same
to compose these requests are described in detail in
"Process Request Structures."
Throughout the document, the acronyms CHA (crypto hardware
accelerator) and EU (execution unit) are used interchangeably.
This document contains information on a new product. Specifications and information herein
are subject to change without notice.
© Freescale Semiconductor, Inc., 2005. All rights reserved.
PRELIMINARY-SUBJECT TO CHANGE WITHOUT NOTICE
addresses them.
access point. Structures needed
ioctl()
1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2. Device Driver Components . . . . . . . . . . . . . . . . . . . . 3
3. User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
5. Sample Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6. Linux Environment . . . . . . . . . . . . . . . . . . . . . . . . . . 39
7. VxWorks Environment . . . . . . . . . . . . . . . . . . . . . . . 40
8. Porting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Section 3.3.6,
SEC2SWUG
Rev. 0, 02/2005
Contents

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the SEC2SWUG and is the answer not in the manual?

Questions and answers

Summary of Contents for Freescale Semiconductor SEC2SWUG

  • Page 1: Table Of Contents

    EU (execution unit) are used interchangeably. This document contains information on a new product. Specifications and information herein are subject to change without notice. © Freescale Semiconductor, Inc., 2005. All rights reserved. PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE addresses them.
  • Page 2 PKHA Public key hardware accelerator—This term is synonymous with PKEU in the MPC18x User’s Manual and other documentation. SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE Table 1. Acronyms and Abbreviations Meaning Freescale Semiconductor...
  • Page 3: Device Driver Components

    Sleeps on Queue Completes the User Request Execute Callback Function If no callback function is defined, no callback takes place. SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE Meaning Driver Invoked •...
  • Page 4: Device Driver Components

    IsrMsgQId interface to the device driver. It uses the callers request code to ioctl() IsrMsgQId IOBaseAddress which serves as the interface between function returns to the ioctl() queue for deferred processing by the Freescale Semiconductor...
  • Page 5: User Interface

    It is the application's choice to use a notifier function or to poll the status member. SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE queue and processes messages written to the queue by IsrMsgQId Section 4, “Individual Request Type Descriptions,”...
  • Page 6: User Interface

    If the notify_on_error = DPD_AESA_CBC_ENCRYPT_CRYPT; = 0; = (void *) notifAes; = 0; = 16; = iv_in; = 32; = AesKey; = packet_length; = aesData; = aesResult; = 16; = iv_out; = 0; member of the user request argument. Freescale Semiconductor...
  • Page 7 NUM_CHANNELS specified, it will be set to a value of 4 as a default. SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE function. Definitions of these control codes are defined ioctl and has a value of 0x0800.
  • Page 8: Return Codes

    Requested opID is out of range for this request type 0xE004FFFC Requested channel was not available. This error exists for legacy compatibility reasons, and has no relevance for SEC2 and is simply SEC2 Value 0xFF00 0x00FF Value 0xE004FFFF 0xE004FFFE 0xE004FFFD 0xE004FFFB Freescale Semiconductor...
  • Page 9 SEC2_IO_VXWORKS_DRIVER_TABLE_ ADD_ERROR SEC2_IO_INTERRUPT_ALLOCATE_ER SEC2_VXWORKS_CANNOT_CREATE_QU SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE Description Requested CHA was not available at the time the request was being processed Length of requested data item is incompatible with...
  • Page 10 Returned SEC2 driver. This structure is also known as SEC2 callback routine that was setup in the initial process request. This // Error that the request generated // Pointer to original request Value -1010 -1011 Sec2Notify.h Freescale Semiconductor...
  • Page 11 SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE // Detailed information as to the state of the // hardware and the driver at the time of an error opId;...
  • Page 12 NULL pointer to contiguous data fragment. size of this fragment in bytes. element was added as a modification to the scatterBufs if at end of list. terminate the end NULL Freescale Semiconductor...
  • Page 13 DPD is built for the hardware. SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE , is therefore made available by the driver to make the bit/pointer...
  • Page 14: Individual Request Type Descriptions

    SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE DPD_RNG_GROUP Table 6. RNG_REQ Valid Descriptor (opId) Value Function Description 0x1000 Generate a series of random values that use this request. that use this DPD_DES_CBC_CTX_GROUP Freescale Semiconductor...
  • Page 15: Individual Request Type Descriptions

    4.3 ARC4 Requests 4.3.1 ARC4_LOADCTX_CRYPT_REQ COMMON_REQ_PREAMBLE unsigned long inCtxBytes; SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE Value Function Description 0x2500 Load encrypted context from a dynamic channel to encrypt in single DES using CBC mode...
  • Page 16 /* output length = input length */ defines the number of descriptors within the that use this request. (0x3500) defines the group for all descriptors within this request. Value Function Description 0x3500 Load the cipher key, encrypt using RC4 then save the resulting context Freescale Semiconductor...
  • Page 17 NUM_MDHA_PAD_DESC DPD_HASH_LDCTX_HASH_PAD_ULCTX_GROUP DPD_HASH_LDCTX_HASH_PAD_ULCTX_GROUP SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE DPD_HASH_LDCTX_HASH_ULCTX_GROUP (0x4400) defines the group for all descriptors within this request. Value Function Description...
  • Page 18 IDGS hash algorithm then store the resulting padded context 0x4505 Compute digest with pre-padded data using an SHA-1 IDGS hash algorithm then store the resulting padded context DPD_HASH_LDCTX_HMAC_ULCTX_GROUP (0x4A00) defines the group for all descriptors within this request. that Freescale Semiconductor...
  • Page 19 NUM_AESA_CRYPT_DESC request. (0x6000) defines the group for all descriptors within this request. DPD_AESA_CRYPT_GROUP SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE Value Function Description 0x4A00 Load context, then use an SHA-256 hash algorithm,...
  • Page 20 Perform CTR in AESA 0x6007 Perform AES CTR-mode cipher operation with integrated authentication as part of the operation DPD_MM_LDCTX_EXP_ULCTX_GROUP (0x5100) defines the group for all descriptors within this request. Value Function Description 0x5100 Perform a modular exponentiation operation that use Freescale Semiconductor...
  • Page 21 DPD_MM_LDCTX_R2MODN_ULCTX_GROUP Table 17. MOD_R2MODN_REQ Valid Descriptor (opId) Descriptor DPD_MM_LDCTX_R2MODN_ULCTX SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE DPD_MM_SS_EXP_GROUP Value Function Description 0x5B00 Perform a single-stage RSA exponentiation operation DPD_MM_LDCTX_R2MODN_ULCTX_GROUP (0x5200) defines the group for all descriptors within this request.
  • Page 22 PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE DPD_MM_LDCTX_RRMODP_ULCTX_GROUP (0x5300) defines the group for all descriptors within this request. Value Function Description 0x5300 Compute the result of an RRMODP operation DPD_MM_LDCTX_2OP_ULCTX_GROUP (0x5400) defines the group for all descriptors within this request. that use Freescale Semiconductor...
  • Page 23 DPD_POLY_LDCTX_A3_B1_MUL1_ULCTX DPD_POLY_LDCTX_A3_B1_MUL2_ULCTX DPD_POLY_LDCTX_A3_B1_ADD_ULCTX DPD_POLY_LDCTX_A0_B2_MUL1_ULCTX DPD_POLY_LDCTX_A0_B2_MUL2_ULCTX DPD_POLY_LDCTX_A0_B2_ADD_ULCTX DPD_POLY_LDCTX_A1_B2_MUL1_ULCTX SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE Individual Request Type Descriptions Value Function Description 0x5400 Perform a modular MUL1 operation 0x5401 Perform a modular MUL2 operation...
  • Page 24 Perform a modular A2-to-B3 MUL1 operation 0x542F Perform a modular A2-to-B3 MUL2 operation 0x5430 Perform a modular A2-to-B3 ADD operation 0x5431 Perform a modular A3-to-B3 MUL1 operation 0x5432 Perform a modular A3-to-B3 MUL2 operation 0x5433 Perform a modular A3-to-B3 ADD operation Freescale Semiconductor...
  • Page 25 *outData; defines the number of descriptors within the NUM_EC_2OP_DESC SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE DPD_EC_LDCTX_kP_ULCTX_GROUP (0x5800) defines the group for all descriptors within this request. Value...
  • Page 26 Function Description 0x5A00 Using separate values for a0-a3 and b0-b1, build a uniform data block that can be used to condense data to a point that allow it to be used with ECC operational requests. that use this Freescale Semiconductor...
  • Page 27 *hashKeyData; unsigned long cryptKeyBytes; unsigned char *cryptKeyData; unsigned long cryptCtxInBytes; SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE Individual Request Type Descriptions Value Function Description 0x5d00 Perform an FP add operation...
  • Page 28 CBC mode with MD5 padding 0x700A Perform the IPSec process of decrypting in triple DES using CBC mode with SHA-1 padding 0x700B Perform the IPSec process of decrypting in triple DES using CBC mode with SHA-256 padding that use this Freescale Semiconductor...
  • Page 29 DPD_IPSEC_ECB_SDES_ENCRYPT_SHA_PAD DPD_IPSEC_ECB_SDES_ENCRYPT_SHA256_PAD DPD_IPSEC_ECB_SDES_DECRYPT_MD5_PAD DPD_IPSEC_ECB_SDES_DECRYPT_SHA_PAD DPD_IPSEC_ECB_SDES_DECRYPT_SHA256_PAD DPD_IPSEC_ECB_TDES_ENCRYPT_MD5_PAD DPD_IPSEC_ECB_TDES_ENCRYPT_SHA_PAD SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE Individual Request Type Descriptions DPD_IPSEC_ECB_GROUP Value Function Description 0x7100 Perform the IPSec process of encrypting in single...
  • Page 30 CBC mode with MD5 auto padding 0x8001 Perform the IPSec process of encrypting in AES using CBC mode with SHA-1 auto padding 0x8002 Perform the IPSec process of encrypting in AES using CBC mode with SHA-256 auto padding that use Freescale Semiconductor...
  • Page 31 NUM_IPSEC_AES_ECB_DESC this request. (0x8100) defines the group for all descriptors within this request. DPD_IPSEC_AES_ECB_GROUP SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE Individual Request Type Descriptions Value Function Description 0x8003...
  • Page 32 Perform the IPSec process of decrypting in AES using ECB mode with MD5 0x810A Perform the IPSec process of decrypting in AES using ECB mode with SHA-1 0x810B Perform the IPSec process of decrypting in AES using ECB mode with SHA-256 Freescale Semiconductor...
  • Page 33 DPD_IPSEC_ESP_IN_SDES_ECB_DCRPT_MD5_PAD DPD_IPSEC_ESP_IN_SDES_ECB_DCRPT_SHA_PAD DPD_IPSEC_ESP_IN_SDES_ECB_DCRPT_SHA256_ DPD_IPSEC_ESP_OUT_SDES_CBC_CRPT_MD5_PAD DPD_IPSEC_ESP_OUT_SDES_CBC_CRPT_SHA_PAD DPD_IPSEC_ESP_OUT_SDES_CBC_CRPT_SHA256_ DPD_IPSEC_ESP_IN_SDES_CBC_DCRPT_MD5_PAD SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE Individual Request Type Descriptions DPD_IPSEC_ESP_GROUP Value Function Description 0x7500 Process an outbound IPSec encapsulated system payload packet using single DES in ECB mode and...
  • Page 34 Process an inbound IPSec encapsulated system payload packet using triple DES in ECB mode, and SHA1 with auto padding 0x7517 Process an inbound IPSec encapsulated system payload packet using triple DES in ECB mode, and SHA256 with auto padding Freescale Semiconductor...
  • Page 35 *hashKeyData; unsigned long keyBytes; unsigned char *keyData; SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE Individual Request Type Descriptions that use this request. DPD_CCMP_GROUP Value Function Description...
  • Page 36: Sample Code

    SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE DPD_SRTP_GROUP Table 30. SRTP_REQ Valid Descriptors (opId) Value Function Description 0x8500 Process an outbound SRTP packet 0x8501 Process an inbound SRTP packet that use this request. Freescale Semiconductor...
  • Page 37 /* Ipsec dynamic descriptor triple DES with SHA-1 authentication */ ipsecReq.opId = DPD_IPSEC_CBC_TDES_ENCRYPT_SHA_PAD; ipsecReq.channel = 0; ipsecReq.notify = (void *) notifyFunc; ipsecReq.notify_on_error = (void *) notifyFunc; ipsecReq.status = 0; SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE...
  • Page 38 /* First Level Error Checking */ if (status != 0) { void notifyFunc (void) /* Second Level Error Checking */ if (ipsecReq.status != 0) { SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE Freescale Semiconductor...
  • Page 39: Linux Environment

    Logical to physical memory space translation is handled internal to the driver. SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE [kernelroot]/drivers/sec2. sec2drv.o...
  • Page 40: Vxworks Environment

    (building a kernel mode test) shows the __KERNEL__ turned on shows the installation of signal handlers and their proper SEC2_MALLOC Section 3.3.1, “I/O Control Codes” SIGUSR1 Freescale Semiconductor...
  • Page 41: Porting

    SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE Definition...
  • Page 42: Header Files

    SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE for later reference. IOBaseAddress IOInitSemaphores IOInitQs IOConnectInterrupt IsrMsgQId IORegisterDriver queue. ProcessingComplete() Freescale Semiconductor...
  • Page 43: Conditional Compilation

    SEC 2.0 Reference Device Driver User’s Guide, Rev. 0 Freescale Semiconductor PRELIMINARY—SUBJECT TO CHANGE WITHOUT NOTICE Description Primary public header file for all users of the driver Driver/Hardware interfaces, private to the driver itself DPD type definitions...
  • Page 44 Freescale Semiconductor product could create a situation where personal injury or death may occur. Should Buyer...

This manual is also suitable for:

Sec 2.0

Table of Contents

Save PDF