1
1
#![ no_std]
2
- #! [ cfg_attr ( rustfmt , rustfmt_skip ) ]
2
+
3
3
use magma;
4
4
5
5
use block_cipher:: generic_array:: GenericArray ;
6
6
use block_cipher:: { BlockCipher , NewBlockCipher } ;
7
7
8
8
/// Example vectors from GOST 34.12-2018
9
9
#[ test]
10
+ #[ rustfmt:: skip]
10
11
fn magma_test ( ) {
11
12
let key = [
12
13
0xFF , 0xEE , 0xDD , 0xCC , 0xBB , 0xAA , 0x99 , 0x88 ,
@@ -30,30 +31,3 @@ fn magma_test() {
30
31
state. decrypt_block ( & mut block) ;
31
32
assert_eq ! ( & plaintext, block. as_slice( ) ) ;
32
33
}
33
-
34
- /*
35
- // an attempt to test with vectors from
36
- // https://github.com/gost-engine/engine/blob/master/test/03-encrypt.t
37
- #[test]
38
- fn engine_test() {
39
- use block_modes::{BlockMode, Cbc, block_padding::Pkcs7};
40
-
41
- type Cipher = Cbc<magma::Gost89CryptoProA, Pkcs7>;
42
-
43
- let key: [u8; 32] = [
44
- 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
45
- 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
46
- 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
47
- 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF,
48
- ];
49
- let iv: [u8; 8] = [0; 8];
50
- let plaintext = b"The quick brown fox jumps over the lazy dog\n";
51
-
52
- let c = Cipher::new_var(&key, &iv).unwrap();
53
- let ct = c.encrypt_vec(plaintext);
54
- for b in ct {
55
- print!("0x{:02X}, ", b);
56
- }
57
- println!();
58
- }
59
- */
0 commit comments