Add Kuznyechik support for VeraCrypt kernels

Adds support for the Russian cipher specified in GOST R 34.12-2015, also
known as Kuznyechik (Grasshopper).

 - Add Kuznyechik header decryption checks to all VeraCrypt kernels
 - Add test containers for available Kuznyechik cipher combinations
This commit is contained in:
R. Yushaev
2018-11-22 16:07:45 +01:00
parent c15f741dca
commit 8b04be0e93
31 changed files with 819 additions and 15 deletions
+1
View File
@@ -0,0 +1 @@
*.tc binary
+24 -15
View File
@@ -2253,10 +2253,10 @@ function truecrypt_test()
# Compose and execute hashcat command on a VeraCrypt test container
# Must not be called for hash types other than 137XY
# $1: primary (first layer) cipher id, must be 0-2
# $1: cipher variation, can be 0-4
function veracrypt_test()
{
primary_cipher=$1
cipher_variation=$1
hash_function=""
@@ -2274,25 +2274,32 @@ function veracrypt_test()
cipher_digit="${hash_type:4:1}"
case $cipher_digit in
1)
[ $primary_cipher -eq "0" ] && cipher_cascade="aes"
[ $primary_cipher -eq "1" ] && cipher_cascade="serpent"
[ $primary_cipher -eq "2" ] && cipher_cascade="twofish"
[ $cipher_variation -eq "0" ] && cipher_cascade="aes"
[ $cipher_variation -eq "1" ] && cipher_cascade="serpent"
[ $cipher_variation -eq "2" ] && cipher_cascade="twofish"
[ $cipher_variation -eq "3" ] && cipher_cascade="kuznyechik"
;;
2)
[ $primary_cipher -eq "0" ] && cipher_cascade="aes-twofish"
[ $primary_cipher -eq "1" ] && cipher_cascade="serpent-aes"
[ $primary_cipher -eq "2" ] && cipher_cascade="twofish-serpent"
[ $cipher_variation -eq "0" ] && cipher_cascade="aes-twofish"
[ $cipher_variation -eq "1" ] && cipher_cascade="serpent-aes"
[ $cipher_variation -eq "2" ] && cipher_cascade="twofish-serpent"
[ $cipher_variation -eq "3" ] && cipher_cascade="kuznyechik-aes"
[ $cipher_variation -eq "4" ] && cipher_cascade="kuznyechik-twofish"
;;
3)
[ $primary_cipher -eq "0" ] && cipher_cascade="aes-twofish-serpent"
[ $primary_cipher -eq "1" ] && cipher_cascade="serpent-twofish-aes"
[ $primary_cipher -eq "2" ] && cipher_cascade=""
[ $cipher_variation -eq "0" ] && cipher_cascade="aes-twofish-serpent"
[ $cipher_variation -eq "1" ] && cipher_cascade="serpent-twofish-aes"
;;
esac
[ -n "$cipher_cascade" ] || return
CMD="./${BIN} ${OPTS} -a 3 -m ${hash_type} ${TDIR}/vc_tests/hashcat_${hash_function}_${cipher_cascade}.vc hashca?l"
filename="${TDIR}/vc_tests/hashcat_${hash_function}_${cipher_cascade}.vc"
# The hash-cipher combination might be invalid (e.g. RIPEMD-160 + Kuznyechik)
[ -f "${filename}" ] || return
CMD="./${BIN} ${OPTS} -a 3 -m ${hash_type} ${filename} hashca?l"
echo "> Testing hash type ${hash_type} with attack mode 3, markov ${MARKOV}, single hash, Device-Type ${TYPE}, vector-width ${VECTOR}, cipher ${cipher_cascade}" &>> ${OUTD}/logfull.txt
@@ -2767,9 +2774,11 @@ if [ "${PACKAGE}" -eq 0 -o -z "${PACKAGE_FOLDER}" ]; then
# Look up if this is one of supported VeraCrypt modes
if is_in_array ${hash_type} ${VC_MODES}; then
veracrypt_test 0
veracrypt_test 1
veracrypt_test 2
veracrypt_test 0 # aes
veracrypt_test 1 # serpent
veracrypt_test 2 # twofish
veracrypt_test 3 # kuznyechik
veracrypt_test 4 # kuznyechik (2nd cascade)
elif [[ ${hash_type} -ge 6211 ]] && [[ ${hash_type} -le 6243 ]]; then
# run truecrypt tests
+1
View File
@@ -0,0 +1 @@
*.vc binary
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
Йфргщц╬P~gd│║Р╓
 ЦH)╧╙Ж╪й╩a8(╜⌡Т┌f]rЩчЫз╥Ц]╪∙╘Й.≤÷╡щп
4aYВ╤=И@z╜D┘dч┴С"│б┴МV╪▓т·┼`В┼Т═sп!в╚,xxАя╛╛qqДFл+{├+║!'Ib░÷иlЗI┤i ╢ЙО©к2t~1нK┐▐╧├▒
NДВ│Ъ▀│\┴пЭzf фЯл╞6>ЕZц
╬Щ▓╩k▓RHА)'$D╢Ъ·МHеeЩтИК│J ы╙·─OaW1┴Ю5▌В╨╛H<Пt├uе└ ┬9BЛ╛╤x*oK╗сUУ╓Рё─P╖Bqx% _ЗW^╚Ир▄╚I╜╧x÷А0Ж=GYzBF╬hАШ╛ ("mкТ/й╫Eо▐╛°В.Ч!р╢≤d$╥п!ЮTК≥╚# ]б∙Td╛═t≥^l3Фя%HY┬[GJ■йИ;UB ЕУ%МуHs^Ър╚lzЁXQ▄╫[w`.ч═TФо═HVlукТ мCe╢<B╜▀фъydЛ4ТO┴n5Мяй]└K1wщУ F┤8n╓ьt~lЬ⌡ЩwEd&╗"Grf─√Л~цVж SЪo?гПЭ┘ЪG@V│ьДuЛИ2┌а!6=|╙hK8МОq╨c▀WЖПoqМИ<Чoс
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
θY«T1:Ά^`f―Ρμ`©ΣL8'N± Xι “xΧΕγμeι s‚Qtψ§ιΑ)ά$#«φγ›ώ½£RΊ.8Q²>Α;cƒCwψ<z¬NΤ¶A—ƒfΏRx/[¬³eΗ;ό„ά―&¦­s~ξΡX€ΓCΡΣeΙζηOςµ5Βί¤8½ψΤ‘΄ μ­3Fΰ¦LόrκΕ1ϋΜΡL$%΄Έ–μ–°;Η5¦Oϋ'«OG‘υΟ ΔγΣ!&ώ™„=JU4gκ"τ“ϋρέ*“ώ;Q@ΐά°Ν“ Iσ†΄λ~2 ¶ΙI$2Ηl1Ζ@ca+[ό½ητΆ§pέ³>…ΟΠΟΛ
OΒψ‡Ϊ fƒlΆ&qβΆά·ΒΗv1’Ο^νσ0@Ϊs¶»†Ϋύ<$―a”N–*ΒόKαΝύ剔JΥΓ«¶–β@‰ώε@²xφεΉ’K‡jμΊΌ¨±ΟΉ|Ί’Ρ#>bΊ"‹Ξ­η#­ ώ|e°Vη‚&\6φ»Ή1•:M3µΥk }ΏF—R 3ΜiƒΌΠΈΜ²έ/Ψµο WGD‚Ώ’σ™-ƒZfο:$©05;*σd 9cξr£]u υέγ ί.Π ΌΧ$ocBΥ\~ΫeR†kφµ
Binary file not shown.