60 #define MD5BUSY_TIMEOUT ((uint32_t) 0x00010000)
93 ErrorStatus
HASH_MD5(uint8_t *Input, uint32_t Ilen, uint8_t Output[16])
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;
107 nbvalidbitsdata = 8 * (Ilen % 4);
122 for(i=0; i<Ilen; i+=4)
136 }
while ((counter != MD5BUSY_TIMEOUT) && (busystatus != RESET));
138 if (busystatus != RESET)
146 *(uint32_t*)(outputaddr) = __REV(MD5_MessageDigest.
Data[0]);
148 *(uint32_t*)(outputaddr) = __REV(MD5_MessageDigest.
Data[1]);
150 *(uint32_t*)(outputaddr) = __REV(MD5_MessageDigest.
Data[2]);
152 *(uint32_t*)(outputaddr) = __REV(MD5_MessageDigest.
Data[3]);
168 ErrorStatus
HMAC_MD5(uint8_t *Key, uint32_t Keylen, uint8_t *Input,
169 uint32_t Ilen, uint8_t Output[16])
173 __IO uint16_t nbvalidbitsdata = 0;
174 __IO uint16_t nbvalidbitskey = 0;
176 __IO uint32_t counter = 0;
177 uint32_t busystatus = 0;
178 ErrorStatus status = SUCCESS;
179 uint32_t keyaddr = (uint32_t)Key;
180 uint32_t inputaddr = (uint32_t)Input;
181 uint32_t outputaddr = (uint32_t)Output;
184 nbvalidbitsdata = 8 * (Ilen % 4);
187 nbvalidbitskey = 8 * (Keylen % 4);
212 for(i=0; i<Keylen; i+=4)
226 }
while ((counter != MD5BUSY_TIMEOUT) && (busystatus != RESET));
228 if (busystatus != RESET)
238 for(i=0; i<Ilen; i+=4)
253 }
while ((counter != MD5BUSY_TIMEOUT) && (busystatus != RESET));
255 if (busystatus != RESET)
265 keyaddr = (uint32_t)Key;
266 for(i=0; i<Keylen; i+=4)
281 }
while ((counter != MD5BUSY_TIMEOUT) && (busystatus != RESET));
283 if (busystatus != RESET)
291 *(uint32_t*)(outputaddr) = __REV(MD5_MessageDigest.
Data[0]);
293 *(uint32_t*)(outputaddr) = __REV(MD5_MessageDigest.
Data[1]);
295 *(uint32_t*)(outputaddr) = __REV(MD5_MessageDigest.
Data[2]);
297 *(uint32_t*)(outputaddr) = __REV(MD5_MessageDigest.
Data[3]);
FlagStatus HASH_GetFlagStatus(uint32_t HASH_FLAG)
Checks whether the specified HASH flag is set or not.
ErrorStatus HMAC_MD5(uint8_t *Key, uint32_t Keylen, uint8_t *Input, uint32_t Ilen, uint8_t Output[16])
Compute the HMAC MD5 digest.
#define HASH_AlgoSelection_MD5
#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.
void HASH_GetDigest(HASH_MsgDigest *HASH_MessageDigest)
Provides the message digest result.
HASH Init structure definition.
ErrorStatus HASH_MD5(uint8_t *Input, uint32_t Ilen, uint8_t Output[16])
Compute the HASH MD5 digest.
void HASH_SetLastWordValidBitsNbr(uint16_t ValidNumber)
Configure the Number of valid bits in last word of the message.
uint32_t HASH_HMACKeyType