mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-06-17 03:38:49 +08:00
Merge branch 'bugfix/fix_ap_set_config_too_long' into 'master'
Reduce cache missing and Remove unused function See merge request sdk/ESP8266_RTOS_SDK!558
This commit is contained in:
@ -127,6 +127,7 @@ A million repetitions of "a"
|
|||||||
34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
|
34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Disable the option, and reduce memory copying */
|
||||||
#define SHA1HANDSOFF
|
#define SHA1HANDSOFF
|
||||||
|
|
||||||
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
|
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
|
||||||
@ -186,8 +187,12 @@ SHA1Transform(u32 state[5], const unsigned char buffer[64])
|
|||||||
CHAR64LONG16* block;
|
CHAR64LONG16* block;
|
||||||
#ifdef SHA1HANDSOFF
|
#ifdef SHA1HANDSOFF
|
||||||
CHAR64LONG16 workspace;
|
CHAR64LONG16 workspace;
|
||||||
|
if ((size_t)buffer & 0x3) {
|
||||||
block = &workspace;
|
block = &workspace;
|
||||||
os_memcpy(block, buffer, 64);
|
os_memcpy(block, buffer, 64);
|
||||||
|
} else {
|
||||||
|
block = (CHAR64LONG16 *) buffer;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
block = (CHAR64LONG16 *) buffer;
|
block = (CHAR64LONG16 *) buffer;
|
||||||
#endif
|
#endif
|
||||||
@ -224,10 +229,12 @@ SHA1Transform(u32 state[5], const unsigned char buffer[64])
|
|||||||
state[2] += c;
|
state[2] += c;
|
||||||
state[3] += d;
|
state[3] += d;
|
||||||
state[4] += e;
|
state[4] += e;
|
||||||
|
|
||||||
/* Wipe variables */
|
/* Wipe variables */
|
||||||
a = b = c = d = e = 0;
|
/* Disable to reduce memory copying */
|
||||||
|
//a = b = c = d = e = 0;
|
||||||
#ifdef SHA1HANDSOFF
|
#ifdef SHA1HANDSOFF
|
||||||
os_memset(block, 0, 64);
|
//os_memset(block, 0, 64);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,6 +291,7 @@ void
|
|||||||
SHA1Final(unsigned char digest[20], SHA1_CTX* context)
|
SHA1Final(unsigned char digest[20], SHA1_CTX* context)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
|
unsigned long index;
|
||||||
unsigned char finalcount[8];
|
unsigned char finalcount[8];
|
||||||
|
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
@ -291,9 +299,13 @@ SHA1Final(unsigned char digest[20], SHA1_CTX* context)
|
|||||||
((context->count[(i >= 4 ? 0 : 1)] >>
|
((context->count[(i >= 4 ? 0 : 1)] >>
|
||||||
((3-(i & 3)) * 8) ) & 255); /* Endian independent */
|
((3-(i & 3)) * 8) ) & 255); /* Endian independent */
|
||||||
}
|
}
|
||||||
SHA1Update(context, (unsigned char *) "\200", 1);
|
|
||||||
|
index = 0x80;
|
||||||
|
SHA1Update(context, (unsigned char *)&index, 1);
|
||||||
|
|
||||||
while ((context->count[0] & 504) != 448) {
|
while ((context->count[0] & 504) != 448) {
|
||||||
SHA1Update(context, (unsigned char *) "\0", 1);
|
index = 0;
|
||||||
|
SHA1Update(context, (unsigned char *)&index, 1);
|
||||||
}
|
}
|
||||||
SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform()
|
SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform()
|
||||||
*/
|
*/
|
||||||
@ -303,11 +315,12 @@ SHA1Final(unsigned char digest[20], SHA1_CTX* context)
|
|||||||
255);
|
255);
|
||||||
}
|
}
|
||||||
/* Wipe variables */
|
/* Wipe variables */
|
||||||
i = 0;
|
/* Disable here to reduce memory copying */
|
||||||
os_memset(context->buffer, 0, 64);
|
// i = 0;
|
||||||
os_memset(context->state, 0, 20);
|
// os_memset(context->buffer, 0, 64);
|
||||||
os_memset(context->count, 0, 8);
|
// os_memset(context->state, 0, 20);
|
||||||
os_memset(finalcount, 0, 8);
|
// os_memset(context->count, 0, 8);
|
||||||
|
// os_memset(finalcount, 0, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===== end - public domain SHA1 implementation ===== */
|
/* ===== end - public domain SHA1 implementation ===== */
|
||||||
|
Reference in New Issue
Block a user