60 #define SHA1BUSY_TIMEOUT ((uint32_t) 0x00010000)
93 ErrorStatus
HASH_SHA1(uint8_t *Input, uint32_t Ilen, uint8_t Output[20])
97 __IO uint16_t nbvalidbitsdata = 0;
99 __IO uint32_t counter = 0;
100 uint32_t busystatus = 0;
101 ErrorStatus status = SUCCESS;
102 uint32_t inputaddr = (uint32_t)Input;
103 uint32_t outputaddr = (uint32_t)Output;
106 nbvalidbitsdata = 8 * (Ilen % 4);
121 for(i=0; i<Ilen; i+=4)
135 }
while ((counter != SHA1BUSY_TIMEOUT) && (busystatus != RESET));
137 if (busystatus != RESET)
145 *(uint32_t*)(outputaddr) = __REV(SHA1_MessageDigest.
Data[0]);
147 *(uint32_t*)(outputaddr) = __REV(SHA1_MessageDigest.
Data[1]);
149 *(uint32_t*)(outputaddr) = __REV(SHA1_MessageDigest.
Data[2]);
151 *(uint32_t*)(outputaddr) = __REV(SHA1_MessageDigest.
Data[3]);
153 *(uint32_t*)(outputaddr) = __REV(SHA1_MessageDigest.
Data[4]);
169 ErrorStatus
HMAC_SHA1(uint8_t *Key, uint32_t Keylen, uint8_t *Input,
170 uint32_t Ilen, uint8_t Output[20])
174 __IO uint16_t nbvalidbitsdata = 0;
175 __IO uint16_t nbvalidbitskey = 0;
177 __IO uint32_t counter = 0;
178 uint32_t busystatus = 0;
179 ErrorStatus status = SUCCESS;
180 uint32_t keyaddr = (uint32_t)Key;
181 uint32_t inputaddr = (uint32_t)Input;
182 uint32_t outputaddr = (uint32_t)Output;
185 nbvalidbitsdata = 8 * (Ilen % 4);
188 nbvalidbitskey = 8 * (Keylen % 4);
213 for(i=0; i<Keylen; i+=4)
227 }
while ((counter != SHA1BUSY_TIMEOUT) && (busystatus != RESET));
229 if (busystatus != RESET)
239 for(i=0; i<Ilen; i+=4)
255 }
while ((counter != SHA1BUSY_TIMEOUT) && (busystatus != RESET));
257 if (busystatus != RESET)
267 keyaddr = (uint32_t)Key;
268 for(i=0; i<Keylen; i+=4)
283 }
while ((counter != SHA1BUSY_TIMEOUT) && (busystatus != RESET));
285 if (busystatus != RESET)
293 *(uint32_t*)(outputaddr) = __REV(SHA1_MessageDigest.
Data[0]);
295 *(uint32_t*)(outputaddr) = __REV(SHA1_MessageDigest.
Data[1]);
297 *(uint32_t*)(outputaddr) = __REV(SHA1_MessageDigest.
Data[2]);
299 *(uint32_t*)(outputaddr) = __REV(SHA1_MessageDigest.
Data[3]);
301 *(uint32_t*)(outputaddr) = __REV(SHA1_MessageDigest.
Data[4]);
FlagStatus HASH_GetFlagStatus(uint32_t HASH_FLAG)
Checks whether the specified HASH flag is set or not.
ErrorStatus HMAC_SHA1(uint8_t *Key, uint32_t Keylen, uint8_t *Input, uint32_t Ilen, uint8_t Output[20])
Compute the HMAC SHA1 digest.
#define HASH_HMACKeyType_ShortKey
void HASH_DeInit(void)
De-initializes the HASH peripheral registers to their default reset values.
uint32_t HASH_AlgoSelection
#define HASH_AlgoMode_HMAC
#define HASH_HMACKeyType_LongKey
HASH message digest result structure definition.
This file contains all the functions prototypes for the HASH firmware library.
void HASH_Init(HASH_InitTypeDef *HASH_InitStruct)
Initializes the HASH peripheral according to the specified parameters in the HASH_InitStruct structur...
#define HASH_AlgoMode_HASH
void HASH_StartDigest(void)
Starts the message padding and calculation of the final message.
void HASH_DataIn(uint32_t Data)
Writes data in the Data Input FIFO.
#define HASH_AlgoSelection_SHA1
ErrorStatus HASH_SHA1(uint8_t *Input, uint32_t Ilen, uint8_t Output[20])
Compute the HASH SHA1 digest.
void HASH_GetDigest(HASH_MsgDigest *HASH_MessageDigest)
Provides the message digest result.
HASH Init structure definition.
void HASH_SetLastWordValidBitsNbr(uint16_t ValidNumber)
Configure the Number of valid bits in last word of the message.
uint32_t HASH_HMACKeyType