secure_types.h

来自「是一个手机功能的模拟程序」· C头文件 代码 · 共 507 行 · 第 1/2 页

H
507
字号
/*                @(#) nom : secure_types.h SID: 1.1 date : 11/12/02                           */
/* Filename:      secure_types.h                                                         */
/* Version:       1.1                                                         */
/******************************************************************************
 *                   WIRELESS COMMUNICATION SYSTEM DEVELOPMENT
 *
 *             (C) 2002 Texas Instruments France. All rights reserved
 *
 *                          Author : Constantin HAIDAMOUS
 *
 *
 *  Important Note
 *  --------------
 *
 *  This S/W is a preliminary version. It contains information on a product 
 *  under development and is issued for evaluation purposes only. Features 
 *  characteristics, data and other information are subject to change.
 *
 *  The S/W is furnished under Non Disclosure Agreement and may be used or
 *  copied only in accordance with the terms of the agreement. It is an offence
 *  to copy the software in any way except as specifically set out in the 
 *  agreement. No part of this document may be reproduced or transmitted in any
 *  form or by any means, electronic or mechanical, including photocopying and
 *  recording, for any purpose without the express written permission of Texas
 *  Instruments Inc.
 *
 ******************************************************************************
 *
 *  FILE NAME: secure_types.h
 *
 *
 *  PURPOSE:
 *            
 *
 *  FILE REFERENCES:
 *
 *  Name                  IO      Description
 *  -------------         --      ---------------------------------------------
 *  
 *
 *
 *  EXTERNAL VARIABLES:
 *
 *  Source: none
 *
 *  Name                    Type              IO   Description
 *  -------------------     ---------------   --   ----------------------------
 *
 *
 *
 *  ABNORMAL TERMINATION CONDITIONS, ERROR AND WARNING MESSAGES:
 *  
 *
 *
 *  ASSUMPTION, CONSTRAINTS, RESTRICTIONS:
 *  
 *
 *
 *  NOTES:
 *  
 *
 *
 *  REQUIREMENTS/FUNCTIONAL SPECIFICATION REFERENCES:
 *
 *
 *
 *
 *  DEVELOPMENT HISTORY:
 *
 *  Date        Name(s)               Version  Description
 *  ----------  --------------------  -------  ---------------------------------
 *  04/12/2002  Constantin HAIDAMOUS  V1.0.0   First release
 *  22-Apr-02   Francois AMAND        V1.0.1   Update of secure status to
 *                                             facilitate integration in final
 *                                             ROM code.
 *                                             Data alignment in struture to
 *                                             optimize memory requirement.
 *                                             Management of global secure data.
 *  28-Apr-02   Francois AMAND        V1.0.2   Update some constants to be
 *                                             compliant with certificate
 *                                             definition.
 *                                             Add CALYPSO PLUS specific
 *                                             parameters structure.
 *                                             Differentiate Manufacturer and
 *                                             Platform certificate.
 *                                             Add debug request field in Manu-
 *                                             facturer certificate.
 *                                             Optimize certificate field size.
 *                                             Change commentary wrapper to be
 *                                             ANSI compliant.
 *  29-Apr-02   Francois AMAND        V1.0.3   Remove unused constant.
 *                                             Set under compilation flag the
 *                                             secure services.
 *  14-May-02   Francois AMAND        V1.0.4   Add CONF_CSI field in T_CONF_PARAM
 *                                             structure definition.
 *                                             Change name of CS_MODE to EX_CTRL
 *                                             Change size of DCCTRL_CSx to 8
 *                                             bits to optimize size and alignment.
 *  17-May-02   Francois AMAND        V1.0.5   Modification of hashing size for
 *                                             binding/unbinding.
 *  17-May-02   Constantin HAIDAMOUS  V1.0.6   Integration of data structure for
 *                                             binding/unbinding services API .
 *  17-May-02   Francois AMAND        V1.0.7   Integration of RSA S/W and Check 
 *                                             ROM in Secure Services.
 *                                             Update of Secure Services manage-
 *                                             ment.
 *  22-May-02   Constantin HAIDAMOUS  V1.0.8   Changing RSA modulus length , Max
 *                                             RSA length =2048 bits. Adding initial
 *                                             vectore for Binding structure.
 *  27-May-02   Francois AMAND        V1.0.9   Changing SAMSON to CALYPSO.
 *                                             Addition of Secure Services for
 *                                             RUN Time checker.
 *  28-May-02   Constantin HAIDAMOUS  V1.0.10  Changing C_PLAT_SIG_SIZE to 4.
 *
 *  06-June-02  Constantin HAIDAMOUS  V1.0.11  Changing Secure service API.
 * 
 *  12-Jun-02   Francois AMAND        V1.0.12  Update of T_CONF_PARAM according
 *                                             to last memory interface spec.
 *  13-Jun-02   Constantin HAIDAMOUS  V1.0.13  Update of T_UNBINDCTX for segmented
 *                                             unbind operation optimization.
 *  14-Jun-02   Constantin HAIDAMOUS  V1.0.14  Update of T_BINDCTX for segmented
 *                                             bind operation .
 *  14-Jun-02   Francois AMAND        V1.0.15  Force d_temp in Secure RAM.
 *                                             Remove other definitions.
 *  25-Jun-02   Francois AMAND        V1.0.16  Addition of Platform unbinding
 *                                             during boot concept under compi-
 *                                             lation flag C_PLATFORM_UNBIND_BOOT.
 *  27-Jun-02   Constantin HAIDAMOUS  V1.0.17  Adding C_SECURE_RNG_ALARM to E_SECURE_STATUS
 *                                             C_SECURE_RNG_ALARM = C_RNG_ALARM from Safenet 
 *  09-Jul-02   Constantin HAIDAMOUS  V1.0.18  Adding Application ID and Timeout for Bind function
 *  16-Jul-02   Francois AMAND        V1.0.19  Add S/W pseudo-random generator.
 *  19-Jul-02   Francois AMAND        V1.0.20  Remove S/W pseudo-random.
 *  01-Aug-02   Constantin HAIDAMOUS  V1.0.21  Removing boolean b_HashDone in Bind and Unbind Context 
 *                                             
 *  ALGORITHM:
 *
 *
 *******************************************************************************/



#ifndef _SECURE_TYPES_H
  #define _SECURE_TYPES_H

  #ifndef C_SECURE_SERVICES
    #define C_SECURE_SERVICES 1
  #endif
  
  #ifndef C_PLATFORM_UNBIND_BOOT
    #define C_PLATFORM_UNBIND_BOOT 0
  #endif
  
  #ifndef C_CHIPSET
    #define C_CHIPSET_CALYPSO        4
    #define C_CHIPSET_CALYPSOPLUS   12
    #define C_CHIPSET               CHIPSET
  #endif

  

  /****************************************************************************
   * Constants
   ****************************************************************************/

  #define C_WORD32LGB     4
     
  #ifndef NULL  /* To avoid conflict with other compilers */
    #define NULL (UWORD32 *) 0x00000000L
  #endif

  /*Certificate block*/ 

  /*Length in long word (32 bits)*/

  #define C_SHA1HASHLG          5
  #define C_MD5HASHLG           4
  
  #define C_RSAKEYLG            64 /* Max Modulus size : 2048 bits */
  #define C_RSASIGLG            C_RSAKEYLG
  
  #if C_SECURE_SERVICES == 1
    #define C_IVLG              2
    #define C_TDESKEYLG         4
    #define C_TDESKEYLGB        C_TDESKEYLG * C_WORD32LGB
    #define C_PLAT_SIG_SIZE     4 /* Must be a multiple of 64 bits */
  #endif

  #define C_MANUF_SIG_SIZE      C_RSASIGLG


  /*Certificate Type*/ 

  #define C_CERTTYPE_MAN          0x00
  #define C_CERTTYPE_PLAT         0x01
  #if C_PLATFORM_UNBIND_BOOT == 1
    #define C_CERTTYPE_PLAT_BOOT  0x02
  #endif

  #if C_SECURE_SERVICES == 1
    /*Confidentiality request*/ 

    #define C_CRYPTVOID       0x00
    #define C_CRYPTNOREQUEST  0x00
    #define C_CRYPTREQUEST    0x01
  #endif


  /*Debug request*/ 

  #define C_DEBUGNOREQUEST  0x00
  #define C_DEBUGREQUEST    0x01


  /*CS image check request*/ 

  #define C_CSIMGNOREQUEST  0x00
  #define C_CSIMGREQUEST    0x01


  /*Temporary block*/

  #define C_TEMPDATALG        32
  #define C_TEMPDATALGB       C_TEMPDATALG * C_WORD32LGB

  #define C_CERT_TEMP_SWKEY   0
  #define C_CERT_TEMP_DATA    C_CERT_TEMP_SWKEY + C_TDESKEYLG


  /****************************************************************************
   * Structures
   ****************************************************************************/

  /* CALYPSO PLUS Parameters */
  typedef struct {
    /* External Memory Interface configuration */
    UWORD16 d_conf_cs5;
    UWORD16 d_exws_cs5;
    UWORD16 d_ex_ctrl;
  
    /* Authentication configuration */
    UWORD16 d_cs_img_req;
    UWORD32 d_flash_size;
    UWORD32 d_granularity;
  } T_CONF_PARAM;


  /* RSA Public key */

  typedef struct
  {
  
    UWORD32  a_Modulus[C_RSAKEYLG];  /*Public Modulus*/
    UWORD32  d_ModulusLength;        /*Public Modulus length in bytes*/
    UWORD32  d_Exponent;             /*Public Exponent*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?