1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-12 19:38:26 -06:00

Windows: Add support for Streebog (hash) and kuznyechik (encryption)

This commit is contained in:
Mounir IDRASSI
2016-08-09 14:25:52 +02:00
parent 0b2c8b09c6
commit e90e24b30b
28 changed files with 5597 additions and 14 deletions

View File

@@ -219,9 +219,11 @@
<ClCompile Include="Camellia.c" />
<ClCompile Include="cpu.c" />
<ClCompile Include="GostCipher.c" />
<ClCompile Include="kuznyechik.c" />
<ClCompile Include="Rmd160.c" />
<ClCompile Include="Serpent.c" />
<ClCompile Include="Sha2.c" />
<ClCompile Include="Streebog.c" />
<ClCompile Include="Twofish.c" />
<ClCompile Include="Whirlpool.c" />
</ItemGroup>
@@ -234,10 +236,12 @@
<ClInclude Include="config.h" />
<ClInclude Include="cpu.h" />
<ClInclude Include="GostCipher.h" />
<ClInclude Include="kuznyechik.h" />
<ClInclude Include="misc.h" />
<ClInclude Include="Rmd160.h" />
<ClInclude Include="Serpent.h" />
<ClInclude Include="Sha2.h" />
<ClInclude Include="Streebog.h" />
<ClInclude Include="Twofish.h" />
<ClInclude Include="Whirlpool.h" />
</ItemGroup>

View File

@@ -45,6 +45,12 @@
<ClCompile Include="GostCipher.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="kuznyechik.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Streebog.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Aes.h">
@@ -89,6 +95,12 @@
<ClInclude Include="GostCipher.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="kuznyechik.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Streebog.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="Aes_hw_cpu.asm">

View File

@@ -20,5 +20,7 @@ SOURCES = \
Sha2.c \
Twofish.c \
GostCipher.c \
Streebog.c \
kuznyechik.c \
Whirlpool.c \
Camellia.c

2393
src/Crypto/Streebog.c Normal file

File diff suppressed because it is too large Load Diff

33
src/Crypto/Streebog.h Normal file
View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2013, Alexey Degtyarev.
* All rights reserved.
*/
/* Adapted to VeraCrypt */
#ifndef STREEBOG_H
#define STREEBOG_H
#include "Common/Tcdefs.h"
#include "config.h"
#define ALIGN(a) CRYPTOPP_ALIGN_DATA(a)
typedef ALIGN(16) struct _STREEBOG_CTX
{
ALIGN(16) unsigned char buffer[64];
ALIGN(16) unsigned long long hash[8];
ALIGN(16) unsigned long long h[8];
ALIGN(16) unsigned long long N[8];
ALIGN(16) unsigned long long Sigma[8];
size_t bufsize;
unsigned int digest_size;
} STREEBOG_CTX;
void STREEBOG_init(STREEBOG_CTX *ctx);
void STREEBOG_init256(STREEBOG_CTX *ctx);
void STREEBOG_add(STREEBOG_CTX *ctx, byte *msg, size_t len);
void STREEBOG_finalize(STREEBOG_CTX *ctx, byte *out);
#endif

2453
src/Crypto/kuznyechik.c Normal file

File diff suppressed because it is too large Load Diff

26
src/Crypto/kuznyechik.h Normal file
View File

@@ -0,0 +1,26 @@
/*
This code is written by kerukuro for cppcrypto library (http://cppcrypto.sourceforge.net/)
and released into public domain.
*/
/* Adapted to VeraCrypt */
#ifndef CPPCRYPTO_KUZNYECHIK_H
#define CPPCRYPTO_KUZNYECHIK_H
#include "Common/Tcdefs.h"
typedef struct _kuznyechik_kds
{
uint64 rke[10][2];
uint64 rkd[10][2];
} kuznyechik_kds;
#define KUZNYECHIK_KS (sizeof(kuznyechik_kds))
void kuznyechik_encrypt_block(byte* out, const byte* in, kuznyechik_kds* kds);
void kuznyechik_decrypt_block(byte* out, const byte* in, kuznyechik_kds* kds);
void kuznyechik_set_key(const byte* key, kuznyechik_kds *kds);
#endif