ota_signature.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /******************************************************************************
  2. Filename: ota_signature.h
  3. Revised: $Date: 2011-07-15 18:31:00 -0700 (Fri, 15 Jul 2011) $
  4. Revision: $Revision: 26808 $
  5. Description: This file contains code to calculate and verify OTA
  6. signatures based on teh MMO AES Hash function.
  7. Copyright 2010-2011 Texas Instruments Incorporated. All rights reserved.
  8. IMPORTANT: Your use of this Software is limited to those specific rights
  9. granted under the terms of a software license agreement between the user
  10. who downloaded the software, his/her employer (which must be your employer)
  11. and Texas Instruments Incorporated (the "License"). You may not use this
  12. Software unless you agree to abide by the terms of the License. The License
  13. limits your use, and you acknowledge, that the Software may not be modified,
  14. copied or distributed unless embedded on a Texas Instruments microcontroller
  15. or used solely and exclusively in conjunction with a Texas Instruments radio
  16. frequency transceiver, which is integrated into your product. Other than for
  17. the foregoing purpose, you may not use, reproduce, copy, prepare derivative
  18. works of, modify, distribute, perform, display or sell this Software and/or
  19. its documentation for any purpose.
  20. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
  21. PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
  22. INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
  23. NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
  24. TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
  25. NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
  26. LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
  27. INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
  28. OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
  29. OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
  30. (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
  31. Should you have any questions regarding your right to use this Software,
  32. contact Texas Instruments Incorporated at www.TI.com.
  33. ******************************************************************************/
  34. #ifndef OTA_SIGNATURE_H
  35. #define OTA_SIGNATURE_H
  36. #include "hal_types.h"
  37. #define OTA_MMO_ROUNDS 1
  38. #define OTA_MMO_BLOCKSIZE 32
  39. #define OTA_MMO_HASH_SIZE 16
  40. #define OTA_MMO_IN_PROCESS 0
  41. #define OTA_MMO_ERROR 1
  42. #define OTA_MMO_COMPLETE 2
  43. #define OTA_SIGNATURE_LEN 42
  44. #define OTA_SIGNATURE_ELEM_LEN (OTA_SIGNATURE_LEN + Z_EXTADDR_LEN)
  45. #define OTA_CERTIFICATE_LEN 48
  46. typedef struct
  47. {
  48. uint8 hash[OTA_MMO_HASH_SIZE];
  49. uint32 length;
  50. } OTA_MmoCtrl_t;
  51. #ifdef __cplusplus
  52. extern "C"
  53. {
  54. #endif
  55. // Entry functions
  56. extern void OTA_CalculateMmoR3(OTA_MmoCtrl_t *pCtrl, uint8 *pData, uint8 len, uint8 lastBlock);
  57. extern uint8 OTA_ValidateSignature(uint8 *pHash, uint8* pCert, uint8 *pSig, uint8 *pIEEE);
  58. void sspMMOHash2 (uint8 *Pb, uint8 prefix, uint8 *Mb, uint16 bitlen, uint8 *Cstate);
  59. #ifdef __cplusplus
  60. }
  61. #endif
  62. #endif // OTA_SIGNATURE_H