Microchip® Advanced Software Framework

crypto_types.h File Reference

Interface Internal Types.

Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "common/include/nm_common.h"
#include "driver/include/m2m_types.h"

Data Structures

struct  tstrBuffer
 

Macros

#define BIT0   0x00000001
 
#define BIT1   0x00000002
 
#define BIT10   0x00000400
 
#define BIT11   0x00000800
 
#define BIT12   0x00001000
 
#define BIT13   0x00002000
 
#define BIT14   0x00004000
 
#define BIT15   0x00008000
 
#define BIT16   0x00010000
 
#define BIT17   0x00020000
 
#define BIT18   0x00040000
 
#define BIT19   0x00080000
 
#define BIT2   0x00000004
 
#define BIT20   0x00100000
 
#define BIT21   0x00200000
 
#define BIT22   0x00400000
 
#define BIT23   0x00800000
 
#define BIT24   0x01000000
 
#define BIT25   0x02000000
 
#define BIT26   0x04000000
 
#define BIT27   0x08000000
 
#define BIT28   0x10000000
 
#define BIT29   0x20000000
 
#define BIT3   0x00000008
 
#define BIT30   0x40000000
 
#define BIT31   0x80000000
 
#define BIT4   0x00000010
 
#define BIT5   0x00000020
 
#define BIT6   0x00000040
 
#define BIT7   0x00000080
 
#define BIT8   0x00000100
 
#define BIT9   0x00000200
 
#define GETU32(BUF, OFFSET)
 
#define HMAC_MD5   hmac_md5
 
#define HMAC_SHA1   hmac_sha1
 
#define HMAC_SHA256   Hmac_SHA256
 
#define HMAC_VECTOR   HMAC_Vector
 
#define M2M_DUMP_BUF(name, Buffer, size)
 
#define M2M_FREE(p)   free(p)
 
#define M2M_MALLOC_S(s)   malloc(s)
 
#define M2M_MEMCMP   memcmp
 
#define M2M_MEMCPY   memcpy
 
#define M2M_MEMSET   memset
 
#define MAX(A, B)   (((A) > (B))? (A) : (B))
 
#define MD4_HASH   MD4_Hash
 
#define MD5_HASH   MD5_Hash
 
#define MD5_HASH_SW(pCxt, flags, data, dataSz, out)   MD5_HashSW(&(pCxt)->strSha512, flags, data, dataSz, out)
 
#define MIN(A, B)   (((A) < (B))? (A) : (B))
 
#define OVERLAY_SEC1_API
 
#define PUTU32(VAL32, BUF, OFFSET)
 
#define SHA1_HASH   SHA1_Hash
 
#define SHA1_HASH_SW(pCxt, flags, data, dataSz, out)   SHA1_HashSW(&(pCxt)->strSha512, flags, data, dataSz, out)
 
#define SHA224_HASH_SW(pCxt, flags, data, dataSz, out)   SHA224_HashSW(&(pCxt)->strSha512, flags, data, dataSz, out)
 
#define SHA256_HASH   SHA256_Hash
 
#define SHA256_HASH_SW(pCxt, flags, data, dataSz, out)   SHA256_HashSW(&(pCxt)->strSha512, flags, data, dataSz, out)
 
#define SHA384_HASH_SW(pCxt, flags, data, dataSz, out)   SHA512_HashSW(&(pCxt)->strSha512, flags, data, dataSz, out, 1)
 
#define SHA512_HASH_SW(pCxt, flags, data, dataSz, out)   SHA512_HashSW(&(pCxt)->strSha512, flags, data, dataSz, out, 0)
 
#define SIZE_1024_BITS   (128)
 
#define SIZE_128_BITS   (16)
 
#define SIZE_1536_BITS   (192)
 
#define SIZE_2048_BITS   (256)
 
#define SIZE_256_BITS   (32)
 
#define SIZE_512_BITS   (64)
 
#define TLS_API
 
#define TLS_CLIENT_API
 
#define TLS_ERR   TLS_LOG
 
#define TLS_INFO   TLS_LOG
 
#define TLS_LOG(...)   do{printf(__VA_ARGS__);printf("\r");}while(0)
 
#define X509_GET_SYS_TIME(x)   -1
 

Typedefs

typedef uint64_t uint64
 

Enumerations

enum  BOOL_T {
  BFALSE = 0,
  BTRUE = 1
}
 

#define BIT0   0x00000001
#define BIT1   0x00000002
#define BIT10   0x00000400
#define BIT11   0x00000800
#define BIT12   0x00001000
#define BIT13   0x00002000
#define BIT14   0x00004000
#define BIT15   0x00008000
#define BIT16   0x00010000
#define BIT17   0x00020000
#define BIT18   0x00040000
#define BIT19   0x00080000
#define BIT2   0x00000004
#define BIT20   0x00100000
#define BIT21   0x00200000
#define BIT22   0x00400000
#define BIT23   0x00800000
#define BIT24   0x01000000
#define BIT25   0x02000000
#define BIT26   0x04000000
#define BIT27   0x08000000
#define BIT28   0x10000000
#define BIT29   0x20000000
#define BIT3   0x00000008
#define BIT30   0x40000000
#define BIT31   0x80000000
#define BIT4   0x00000010
#define BIT5   0x00000020
#define BIT6   0x00000040
#define BIT7   0x00000080
#define BIT8   0x00000100
#define BIT9   0x00000200
#define GETU32 (   BUF,
  OFFSET 
)
Value:
((((uint32)((BUF)[OFFSET]) << 24)) | (((uint32)((BUF)[OFFSET + 1]) << 16)) | \
(((uint32)((BUF)[OFFSET + 2]) << 8)) | ((uint32)((BUF)[OFFSET + 3])))
unsigned long uint32
Range of values between 0 to 4294967295.
Definition: nm_bsp.h:107

Referenced by SHA1ProcessBlock().

#define HMAC_MD5   hmac_md5
#define HMAC_SHA1   hmac_sha1
#define HMAC_SHA256   Hmac_SHA256
#define HMAC_VECTOR   HMAC_Vector
#define M2M_DUMP_BUF (   name,
  Buffer,
  size 
)
Value:
do \
{ \
int k; \
uint8 *buf = Buffer; \
printf("%s(%08X)(%u)",name,(uint32)buf, size); \
for (k = 0; k < size; k++) \
{ \
if (!(k % 16)) \
printf("\r\n\t"); \
printf("%02X ", buf[k]); \
} \
printf("\r\n"); \
}while(0)
if((SERIAL_RX_BUF_SIZE_HOST-1)==serial_rx_buf_tail)
Definition: sio2host.c:258
unsigned long uint32
Range of values between 0 to 4294967295.
Definition: nm_bsp.h:107
unsigned char uint8
Range of values between 0 to 255.
Definition: nm_bsp.h:93

Referenced by X509Cert_Dump().

#define M2M_FREE (   p)    free(p)
#define M2M_MALLOC_S (   s)    malloc(s)
#define M2M_MEMCMP   memcmp
#define MAX (   A,
 
)    (((A) > (B))? (A) : (B))
#define MD4_HASH   MD4_Hash
#define MD5_HASH   MD5_Hash
#define MD5_HASH_SW (   pCxt,
  flags,
  data,
  dataSz,
  out 
)    MD5_HashSW(&(pCxt)->strSha512, flags, data, dataSz, out)

Referenced by MD5_Hash().

#define MIN (   A,
 
)    (((A) < (B))? (A) : (B))
#define OVERLAY_SEC1_API
#define PUTU32 (   VAL32,
  BUF,
  OFFSET 
)
Value:
do \
{ \
(BUF)[OFFSET ] = BYTE_3((VAL32)); \
(BUF)[OFFSET +1 ] = BYTE_2((VAL32)); \
(BUF)[OFFSET +2 ] = BYTE_1((VAL32)); \
(BUF)[OFFSET +3 ] = BYTE_0((VAL32)); \
}while(0)
#define BYTE_2(word)
Definition: nm_common.h:132
#define BYTE_3(word)
Definition: nm_common.h:134
#define BYTE_1(word)
Definition: nm_common.h:130
#define BYTE_0(word)
Definition: nm_common.h:128

Referenced by SHA1_HashSW(), SHA224_HashSW(), SHA256_HashSW(), and SHA512_HashSW().

#define SHA1_HASH   SHA1_Hash
#define SHA1_HASH_SW (   pCxt,
  flags,
  data,
  dataSz,
  out 
)    SHA1_HashSW(&(pCxt)->strSha512, flags, data, dataSz, out)

Referenced by SHA1_Hash().

#define SHA224_HASH_SW (   pCxt,
  flags,
  data,
  dataSz,
  out 
)    SHA224_HashSW(&(pCxt)->strSha512, flags, data, dataSz, out)

Referenced by SHA224_Hash().

#define SHA256_HASH   SHA256_Hash
#define SHA256_HASH_SW (   pCxt,
  flags,
  data,
  dataSz,
  out 
)    SHA256_HashSW(&(pCxt)->strSha512, flags, data, dataSz, out)

Referenced by SHA256_Hash().

#define SHA384_HASH_SW (   pCxt,
  flags,
  data,
  dataSz,
  out 
)    SHA512_HashSW(&(pCxt)->strSha512, flags, data, dataSz, out, 1)

Referenced by SHA384_Hash().

#define SHA512_HASH_SW (   pCxt,
  flags,
  data,
  dataSz,
  out 
)    SHA512_HashSW(&(pCxt)->strSha512, flags, data, dataSz, out, 0)

Referenced by SHA512_Hash().

#define SIZE_1024_BITS   (128)
#define SIZE_128_BITS   (16)
#define SIZE_1536_BITS   (192)
#define SIZE_2048_BITS   (256)
#define SIZE_256_BITS   (32)
#define SIZE_512_BITS   (64)
#define TLS_API
#define TLS_CLIENT_API
#define TLS_ERR   TLS_LOG

Referenced by Cert_DecodeECCPubKey().

#define TLS_INFO   TLS_LOG

Referenced by X509Cert_Dump().

#define TLS_LOG (   ...)    do{printf(__VA_ARGS__);printf("\r");}while(0)

Referenced by X509Cert_Dump().

#define X509_GET_SYS_TIME (   x)    -1

Referenced by Cert_DecodeValidity().

typedef uint64_t uint64

enum BOOL_T
Enumerator
BFALSE 
BTRUE