feat:新增TFTP IAP升级功能
修改事项: 1、新增TFTP IAP升级功能,只是代码移植完毕,没有测试使用 2、代码空间编译优化,零等待区域空间已满,而应用层代码已全部挪移到非零等待区域中,但还是会增加零等待区的空间占用。 待优化
This commit is contained in:
@@ -55,7 +55,7 @@ static unsigned char PADDING[64] = {
|
||||
#define HH(a, b, c, d, x, s, ac) { (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
|
||||
#define II(a, b, c, d, x, s, ac) { (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
|
||||
|
||||
void Encode(unsigned char *output, UINT4 *input, unsigned int len)
|
||||
__attribute__((section(".non_0_wait"))) void Encode(unsigned char *output, UINT4 *input, unsigned int len)
|
||||
{
|
||||
unsigned int i, j;
|
||||
|
||||
@@ -67,7 +67,7 @@ void Encode(unsigned char *output, UINT4 *input, unsigned int le
|
||||
}
|
||||
}
|
||||
|
||||
void MD5Init(MD5_CTX *context)
|
||||
__attribute__((section(".non_0_wait"))) void MD5Init(MD5_CTX *context)
|
||||
{
|
||||
context->count[0] = context->count[1] = 0;
|
||||
context->state[0] = 0x67452301;
|
||||
@@ -76,7 +76,7 @@ void MD5Init(MD5_CTX *context)
|
||||
context->state[3] = 0x10325476;
|
||||
}
|
||||
|
||||
void Decode(UINT4 *output, unsigned char *input, unsigned int len)
|
||||
__attribute__((section(".non_0_wait"))) void Decode(UINT4 *output, unsigned char *input, unsigned int len)
|
||||
{
|
||||
unsigned int i, j;
|
||||
|
||||
@@ -86,7 +86,7 @@ void Decode(UINT4 *output, unsigned char *input, unsigned int le
|
||||
|
||||
}
|
||||
|
||||
void MD5Transform (UINT4 state[4], unsigned char block[64])
|
||||
__attribute__((section(".non_0_wait"))) void MD5Transform (UINT4 state[4], unsigned char block[64])
|
||||
{
|
||||
UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
|
||||
Decode (x, block, 64);
|
||||
@@ -161,7 +161,7 @@ void MD5Transform (UINT4 state[4], unsigned char block[64])
|
||||
memset ((POINTER)x, 0, sizeof (x));
|
||||
}
|
||||
|
||||
void MD5Update(MD5_CTX *context, unsigned char *input, unsigned int inputLen)
|
||||
__attribute__((section(".non_0_wait"))) void MD5Update(MD5_CTX *context, unsigned char *input, unsigned int inputLen)
|
||||
{
|
||||
unsigned int i, index, partLen;
|
||||
|
||||
@@ -183,7 +183,7 @@ void MD5Update(MD5_CTX *context, unsigned char *input, unsigned in
|
||||
memcpy((POINTER)&context->buffer[index], (POINTER)&input[i], inputLen-i);
|
||||
}
|
||||
|
||||
void MD5_SRAM_Update(MD5_CTX *context, uint32_t add, unsigned int inputLen)
|
||||
__attribute__((section(".non_0_wait"))) void MD5_SRAM_Update(MD5_CTX *context, uint32_t add, unsigned int inputLen)
|
||||
{
|
||||
unsigned int i, index, partLen;
|
||||
uint32_t addr = add;
|
||||
@@ -215,7 +215,7 @@ void MD5_SRAM_Update(MD5_CTX *context, uint32_t add, unsigned int in
|
||||
SRAM_DMA_Read_Buff((POINTER)&context->buffer[index], inputLen-i, addr);
|
||||
}
|
||||
|
||||
void MD5_FLASH_Update(MD5_CTX *context, uint32_t add, unsigned int inputLen)
|
||||
__attribute__((section(".non_0_wait"))) void MD5_FLASH_Update(MD5_CTX *context, uint32_t add, unsigned int inputLen)
|
||||
{
|
||||
unsigned int i, index, partLen;
|
||||
uint32_t addr = add;
|
||||
@@ -246,7 +246,7 @@ void MD5_FLASH_Update(MD5_CTX *context, uint32_t add, unsigned int inp
|
||||
Flash_Read((POINTER)&context->buffer[index], inputLen-i, addr);
|
||||
}
|
||||
|
||||
void MD5Final(unsigned char digest[16], MD5_CTX *context)
|
||||
__attribute__((section(".non_0_wait"))) void MD5Final(unsigned char digest[16], MD5_CTX *context)
|
||||
{
|
||||
unsigned char bits[8];
|
||||
unsigned int index, padLen;
|
||||
@@ -260,7 +260,7 @@ void MD5Final(unsigned char digest[16], MD5_CTX *context)
|
||||
memset ((POINTER)context, 0, sizeof (*context));
|
||||
}
|
||||
|
||||
void MD5Digest(char *pszInput, unsigned int nInputSize, char *pszOutPut)
|
||||
__attribute__((section(".non_0_wait"))) void MD5Digest(char *pszInput, unsigned int nInputSize, char *pszOutPut)
|
||||
{
|
||||
MD5_CTX context;
|
||||
//unsigned int len = strlen (pszInput);
|
||||
@@ -271,7 +271,7 @@ void MD5Digest(char *pszInput, unsigned int nInputSize, char *pszO
|
||||
MD5Final ((unsigned char *)pszOutPut, &context);
|
||||
}
|
||||
|
||||
void MD5Digest_SRAM(uint32_t add, unsigned int nInputSize, char *pszOutPut)
|
||||
__attribute__((section(".non_0_wait"))) void MD5Digest_SRAM(uint32_t add, unsigned int nInputSize, char *pszOutPut)
|
||||
{
|
||||
MD5_CTX context;
|
||||
//unsigned int len = strlen (pszInput);
|
||||
@@ -282,7 +282,7 @@ void MD5Digest_SRAM(uint32_t add, unsigned int nInputSize, char *psz
|
||||
MD5Final((unsigned char *)pszOutPut, &context);
|
||||
}
|
||||
|
||||
void MD5Digest_FLASH(uint32_t add, unsigned int nInputSize, char *pszOutPut)
|
||||
__attribute__((section(".non_0_wait"))) void MD5Digest_FLASH(uint32_t add, unsigned int nInputSize, char *pszOutPut)
|
||||
{
|
||||
MD5_CTX context;
|
||||
unsigned int len = nInputSize;
|
||||
|
||||
Reference in New Issue
Block a user