mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-12 11:28:26 -06:00
Windows: Fix various issues detected by static analysis.
This commit is contained in:
@@ -75,19 +75,19 @@ static void xor_s_box(byte s_box[8][16], byte *seed)
|
||||
int i;
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
s_box[1][i] ^= (seed[ (i * 4) + 0 ] ) & 0xF;
|
||||
s_box[2][i] ^= (seed[ (i * 4) + 0 ]>>4) & 0xF;
|
||||
s_box[3][i] ^= (seed[ (i * 4) + 1 ] ) & 0xF;
|
||||
s_box[4][i] ^= (seed[ (i * 4) + 1 ]>>4) & 0xF;
|
||||
s_box[5][i] ^= (seed[ (i * 4) + 2 ] ) & 0xF;
|
||||
s_box[6][i] ^= (seed[ (i * 4) + 2 ]>>4) & 0xF;
|
||||
s_box[7][i] ^= (seed[ (i * 4) + 3 ] ) & 0xF;
|
||||
s_box[8][i] ^= (seed[ (i * 4) + 3 ]>>4) & 0xF;
|
||||
s_box[0][i] ^= (seed[ (i * 4) + 0 ] ) & 0xF;
|
||||
s_box[1][i] ^= (seed[ (i * 4) + 0 ]>>4) & 0xF;
|
||||
s_box[2][i] ^= (seed[ (i * 4) + 1 ] ) & 0xF;
|
||||
s_box[3][i] ^= (seed[ (i * 4) + 1 ]>>4) & 0xF;
|
||||
s_box[4][i] ^= (seed[ (i * 4) + 2 ] ) & 0xF;
|
||||
s_box[5][i] ^= (seed[ (i * 4) + 2 ]>>4) & 0xF;
|
||||
s_box[6][i] ^= (seed[ (i * 4) + 3 ] ) & 0xF;
|
||||
s_box[7][i] ^= (seed[ (i * 4) + 3 ]>>4) & 0xF;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void gost_set_key(byte *key, gost_kds *ks)
|
||||
void gost_set_key(const byte *key, gost_kds *ks)
|
||||
{
|
||||
#ifdef GOST_DYNAMIC_SBOXES
|
||||
STREEBOG_CTX sctx;
|
||||
@@ -228,11 +228,11 @@ void gost_decrypt_block(uint64 in_, uint64* out_, gost_kds* kds) {
|
||||
}
|
||||
|
||||
#if defined(_M_AMD64)
|
||||
void gost_encrypt_128_CBC_asm(byte *in, byte *out, gost_kds *ks, uint64 count);
|
||||
void gost_decrypt_128_CBC_asm(byte *in, byte *out, gost_kds *ks, uint64 count);
|
||||
void gost_encrypt_128_CBC_asm(const byte *in, byte *out, gost_kds *ks, uint64 count);
|
||||
void gost_decrypt_128_CBC_asm(const byte *in, byte *out, gost_kds *ks, uint64 count);
|
||||
#endif
|
||||
|
||||
void gost_encrypt(byte *in, byte *out, gost_kds *ks, int count) {
|
||||
void gost_encrypt(const byte *in, byte *out, gost_kds *ks, int count) {
|
||||
#if defined(_M_AMD64)
|
||||
gost_encrypt_128_CBC_asm(in, out, ks, (uint64)count);
|
||||
#else
|
||||
@@ -249,7 +249,7 @@ void gost_encrypt(byte *in, byte *out, gost_kds *ks, int count) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void gost_decrypt(byte *in, byte *out, gost_kds *ks, int count) {
|
||||
void gost_decrypt(const byte *in, byte *out, gost_kds *ks, int count) {
|
||||
#if defined(_M_AMD64)
|
||||
gost_decrypt_128_CBC_asm(in, out, ks, (uint64)count);
|
||||
#else
|
||||
|
||||
@@ -49,9 +49,9 @@ typedef struct gost_kds
|
||||
|
||||
#define GOST_KS (sizeof(gost_kds))
|
||||
|
||||
void gost_encrypt(byte *in, byte *out, gost_kds *ks, int count);
|
||||
void gost_decrypt(byte *in, byte *out, gost_kds *ks, int count);
|
||||
void gost_set_key(byte *key, gost_kds *ks);
|
||||
void gost_encrypt(const byte *in, byte *out, gost_kds *ks, int count);
|
||||
void gost_decrypt(const byte *in, byte *out, gost_kds *ks, int count);
|
||||
void gost_set_key(const byte *key, gost_kds *ks);
|
||||
|
||||
#else
|
||||
#define GOST_KS (0)
|
||||
|
||||
@@ -2328,9 +2328,9 @@ stage3(STREEBOG_CTX *CTX)
|
||||
|
||||
memset(buf, 0x00, sizeof buf);
|
||||
#ifndef __GOST3411_BIG_ENDIAN__
|
||||
buf[0] = CTX->bufsize << 3;
|
||||
buf[0] = ((unsigned long long) CTX->bufsize) << 3;
|
||||
#else
|
||||
buf[0] = BSWAP64(CTX->bufsize << 3);
|
||||
buf[0] = BSWAP64(((unsigned long long) CTX->bufsize) << 3);
|
||||
#endif
|
||||
|
||||
pad(CTX);
|
||||
|
||||
@@ -279,7 +279,7 @@ static int Detect_MS_HyperV_AES ()
|
||||
|
||||
void DetectX86Features()
|
||||
{
|
||||
uint32 cpuid[4], cpuid1[4];
|
||||
uint32 cpuid[4] = {0}, cpuid1[4] = {0};
|
||||
if (!CpuId(0, cpuid))
|
||||
return;
|
||||
if (!CpuId(1, cpuid1))
|
||||
|
||||
Reference in New Issue
Block a user