mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-09-20 21:06:22 +02:00
Windows Driver: fix "__chkstk" link error in debug build caused by some crypto functions using too much stack space for local variables.
This commit is contained in:
parent
e484d0caae
commit
7c78c4f4ac
@ -80,7 +80,7 @@ void serpent_encrypt_blocks(const unsigned __int8* in, unsigned __int8* out, siz
|
|||||||
unsigned __int32 B0, B1, B2, B3;
|
unsigned __int32 B0, B1, B2, B3;
|
||||||
unsigned __int32* round_key = ((unsigned __int32*) ks) + 8;
|
unsigned __int32* round_key = ((unsigned __int32*) ks) + 8;
|
||||||
size_t i;
|
size_t i;
|
||||||
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE
|
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && (!defined (DEBUG) || !defined (TC_WINDOWS_DRIVER))
|
||||||
if(HasSSE2() && (blocks >= 4))
|
if(HasSSE2() && (blocks >= 4))
|
||||||
{
|
{
|
||||||
while(blocks >= 4)
|
while(blocks >= 4)
|
||||||
@ -159,7 +159,7 @@ void serpent_decrypt_blocks(const unsigned __int8* in, unsigned __int8* out, siz
|
|||||||
unsigned __int32 B0, B1, B2, B3;
|
unsigned __int32 B0, B1, B2, B3;
|
||||||
unsigned __int32* round_key = ((unsigned __int32*) ks) + 8;
|
unsigned __int32* round_key = ((unsigned __int32*) ks) + 8;
|
||||||
size_t i;
|
size_t i;
|
||||||
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE
|
#if CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE && (!defined (DEBUG) || !defined (TC_WINDOWS_DRIVER))
|
||||||
if(HasSSE2() && (blocks >= 4))
|
if(HasSSE2() && (blocks >= 4))
|
||||||
{
|
{
|
||||||
while(blocks >= 4)
|
while(blocks >= 4)
|
||||||
|
@ -218,7 +218,7 @@ typedef SIMD_4x32 SIMD_32;
|
|||||||
} while(0);
|
} while(0);
|
||||||
|
|
||||||
|
|
||||||
|
#if (!defined (DEBUG) || !defined (TC_WINDOWS_DRIVER))
|
||||||
/*
|
/*
|
||||||
* SIMD Serpent Encryption of 4 blocks in parallel
|
* SIMD Serpent Encryption of 4 blocks in parallel
|
||||||
*/
|
*/
|
||||||
@ -330,7 +330,7 @@ extern "C" void serpent_simd_decrypt_blocks_4(const unsigned __int8 in[], unsign
|
|||||||
B2.store_le(out + 32);
|
B2.store_le(out + 32);
|
||||||
B3.store_le(out + 48);
|
B3.store_le(out + 48);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#undef key_xor
|
#undef key_xor
|
||||||
#undef transform
|
#undef transform
|
||||||
#undef i_transform
|
#undef i_transform
|
||||||
|
@ -498,11 +498,20 @@ const uint_64t k512[80] =
|
|||||||
VOID_RETURN sha512_compile(sha512_ctx ctx[1])
|
VOID_RETURN sha512_compile(sha512_ctx ctx[1])
|
||||||
{ uint_64t v[8], *p = ctx->wbuf;
|
{ uint_64t v[8], *p = ctx->wbuf;
|
||||||
uint_32t j;
|
uint_32t j;
|
||||||
|
#if defined (TC_WINDOWS_DRIVER) && defined (DEBUG)
|
||||||
|
uint_32t i;
|
||||||
|
#endif
|
||||||
|
|
||||||
memcpy(v, ctx->hash, 8 * sizeof(uint_64t));
|
memcpy(v, ctx->hash, 8 * sizeof(uint_64t));
|
||||||
|
|
||||||
for(j = 0; j < 80; j += 16)
|
for(j = 0; j < 80; j += 16)
|
||||||
{
|
{
|
||||||
|
#if defined (TC_WINDOWS_DRIVER) && defined (DEBUG)
|
||||||
|
for (i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
v_cycle( i, j);
|
||||||
|
}
|
||||||
|
#else
|
||||||
v_cycle( 0, j); v_cycle( 1, j);
|
v_cycle( 0, j); v_cycle( 1, j);
|
||||||
v_cycle( 2, j); v_cycle( 3, j);
|
v_cycle( 2, j); v_cycle( 3, j);
|
||||||
v_cycle( 4, j); v_cycle( 5, j);
|
v_cycle( 4, j); v_cycle( 5, j);
|
||||||
@ -511,6 +520,7 @@ VOID_RETURN sha512_compile(sha512_ctx ctx[1])
|
|||||||
v_cycle(10, j); v_cycle(11, j);
|
v_cycle(10, j); v_cycle(11, j);
|
||||||
v_cycle(12, j); v_cycle(13, j);
|
v_cycle(12, j); v_cycle(13, j);
|
||||||
v_cycle(14, j); v_cycle(15, j);
|
v_cycle(14, j); v_cycle(15, j);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->hash[0] += v[0]; ctx->hash[1] += v[1];
|
ctx->hash[0] += v[0]; ctx->hash[1] += v[1];
|
||||||
|
Loading…
Reference in New Issue
Block a user