openssl/test/gost2814789test.c
Ben Laurie df2ee0e27d Enable -Wmissing-variable-declarations and
-Wincompatible-pointer-types-discards-qualifiers (the latter did not require
any code changes).

Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-09-11 04:51:55 +01:00

1442 lines
60 KiB
C

/* vim: set fileencoding=ascii : Charset: ASCII */
/* test/gostr2814789t.c */
/* ====================================================================
* Copyright (c) 2012 Crypto-Pro, Ltd., Serguei E. Leontiev,
* lse@cryptopro.ru
*
* This file is distributed under the same license as OpenSSL
* ====================================================================
*/
#include <stdio.h>
#include <openssl/e_os2.h>
#if defined(OPENSSL_NO_ENGINE) || defined(OPENSSL_NO_GOST)
int main(int argc, char *argv[])
{
printf("No GOST 28147-89 support\n");
return 0;
}
#else
# include <stdlib.h>
# include <string.h>
# include <openssl/conf.h>
# include <openssl/crypto.h>
# include <openssl/engine.h>
# include <openssl/err.h>
# include <openssl/evp.h>
# include <openssl/hmac.h>
# include <openssl/obj_mac.h>
# include "e_os.h"
# define CCGOST_ID "gost"
# include "../engines/ccgost/gost89.h"
# define G89_MAX_TC_LEN (2048)
# define G89_BLOCK_LEN (8)
# if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
typedef unsigned __int64 u64;
# define U64(C) C##UI64
# define FMT64 "%I64u"
# elif defined(__arch64__)
typedef unsigned long u64;
# define U64(C) C##UL
# define FMT64 "%lu"
# else
typedef unsigned long long u64;
# define U64(C) C##ULL
# define FMT64 "%llu"
# endif
# if defined(__MINGW32__)
# undef FMT64
# define FMT64 "%I64u"
# endif
typedef enum g89_mode_ {
G89_ECB,
G89_CFB,
G89_CNT,
G89_IMIT
} g89_mode;
typedef struct g89_tc_ {
u64 ullLen; /* ullLen > G89_MAX_TC_LEN */
/* Clear text ullLen */
/* of zero bytes */
const byte bIn[G89_MAX_TC_LEN]; /* Clear text, when */
/* ullLen <= G89_MAX_TC_LEN */
const char *szParamSet; /* S-Box ID */
const char *szDerive; /* String for derive bRawKey */
const byte bRawKey[EVP_MAX_KEY_LENGTH];
g89_mode gMode; /* Mode of encryption or MAC */
const byte bIV[EVP_MAX_IV_LENGTH]; /* IV for CFB or CNT mode */
const byte bOut[G89_MAX_TC_LEN]; /* Cipher text for ECB/CFB/CNT */
/*
* mode, when ullLen <= G89_MAX_TC_LEN; Last 16 byte of cipher text for
* ECB/CFB/CNT, when ullLen > G89_MAX_TC_LEN; 4 byte MAC for imitovstavka
*/
} g89_tc;
static const g89_tc tcs[] = {
/*
* GOST R 34.11-94 Test cases
*/
{ /* see p. A.3.1 [GOSTR341194], p. 7.3.1
* [ENG-GOSTR341194] */
/* <http://tools.ietf.org/html/rfc5831#section-7.3.1> */
/* Iteration 1, K[1], see Errata for RFC 5831 */
8,
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
"id-GostR3410-94-TestParamSet",
NULL,
{
0x54, 0x6d, 0x20, 0x33, 0x68, 0x65, 0x6c, 0x32,
0x69, 0x73, 0x65, 0x20, 0x73, 0x73, 0x6e, 0x62,
0x20, 0x61, 0x67, 0x79, 0x69, 0x67, 0x74, 0x74,
0x73, 0x65, 0x68, 0x65, 0x20, 0x2c, 0x3d, 0x73},
G89_ECB,
{0},
{
0x1b, 0x0b, 0xbc, 0x32, 0xce, 0xbc, 0xab, 0x42}
},
{ /* see p. A.3.1 [GOSTR341194], p. 7.3.1
* [ENG-GOSTR341194] */
/* <http://tools.ietf.org/html/rfc5831#section-7.3.1> */
/* Iteration 1, K[4] */
8,
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
"id-GostR3410-94-TestParamSet",
NULL,
{
0xec, 0x0a, 0x8b, 0xa1, 0x5e, 0xc0, 0x04, 0xa8,
0xba, 0xc5, 0x0c, 0xac, 0x0c, 0x62, 0x1d, 0xee,
0xe1, 0xc7, 0xb8, 0xe7, 0x00, 0x7a, 0xe2, 0xec,
0xf2, 0x73, 0x1b, 0xff, 0x4e, 0x80, 0xe2, 0xa0},
G89_ECB,
{0},
{
0x2d, 0x56, 0x2a, 0x0d, 0x19, 0x04, 0x86, 0xe7}
},
{ /* see p. A.3.1 [GOSTR341194], p. 7.3.1
* [ENG-GOSTR341194] */
/* <http://tools.ietf.org/html/rfc5831#section-7.3.1> */
/* Iteration 2, K[1] */
8,
{
0x34, 0xc0, 0x15, 0x33, 0xe3, 0x7d, 0x1c, 0x56},
"id-GostR3410-94-TestParamSet",
NULL,
{
0x34, 0x87, 0x24, 0xa4, 0xc1, 0xa6, 0x76, 0x67,
0x15, 0x3d, 0xde, 0x59, 0x33, 0x88, 0x42, 0x50,
0xe3, 0x24, 0x8c, 0x65, 0x7d, 0x41, 0x3b, 0x8c,
0x1c, 0x9c, 0xa0, 0x9a, 0x56, 0xd9, 0x68, 0xcf},
G89_ECB,
{0},
{
0x86, 0x3e, 0x78, 0xdd, 0x2d, 0x60, 0xd1, 0x3c}
},
/*
* id-Gost28147-89-CryptoPro-A-ParamSet (1.2.643.2.2.31.1)
* Test cases
*/
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
16,
{
0x74, 0x3d, 0x76, 0xf9, 0x1b, 0xee, 0x35, 0x3c,
0xa2, 0x5c, 0x3b, 0x10, 0xeb, 0x64, 0xcf, 0xf5},
"id-Gost28147-89-CryptoPro-A-ParamSet",
"testecb1",
{
0xbb, 0xf1, 0xed, 0xd3, 0x20, 0xaf, 0x8a, 0x62,
0x8e, 0x11, 0xc8, 0xa9, 0x51, 0xcc, 0xbe, 0x81,
0x47, 0x7b, 0x41, 0xa1, 0x6a, 0xf6, 0x7f, 0x05,
0xe8, 0x51, 0x2f, 0x9e, 0x01, 0xf8, 0xcf, 0x49},
G89_ECB,
{0},
{
0xc3, 0x73, 0x90, 0x95, 0x35, 0x58, 0x08, 0x63,
0xcb, 0x68, 0x85, 0x96, 0x77, 0xe8, 0xfb, 0xa9}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
16,
{
0xd2, 0xfd, 0xf8, 0x3a, 0xc1, 0xb4, 0x39, 0x23,
0x2e, 0xaa, 0xcc, 0x98, 0x0a, 0x02, 0xda, 0x33},
"id-Gost28147-89-CryptoPro-A-ParamSet",
"testcfb1",
{
0x8d, 0x5a, 0x2c, 0x83, 0xa7, 0xc7, 0x0a, 0x61,
0xd6, 0x1b, 0x34, 0xb5, 0x1f, 0xdf, 0x42, 0x68,
0x66, 0x71, 0xa3, 0x5d, 0x87, 0x4c, 0xfd, 0x84,
0x99, 0x36, 0x63, 0xb6, 0x1e, 0xd6, 0x0d, 0xad},
G89_CFB,
{
0x46, 0x60, 0x6f, 0x0d, 0x88, 0x34, 0x23, 0x5a},
{
0x88, 0xb7, 0x75, 0x16, 0x74, 0xa5, 0xee, 0x2d,
0x14, 0xfe, 0x91, 0x67, 0xd0, 0x5c, 0xcc, 0x40}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
16,
{
0x90, 0xa2, 0x39, 0x66, 0xae, 0x01, 0xb9, 0xa3,
0x52, 0x4e, 0xc8, 0xed, 0x6c, 0xdd, 0x88, 0x30},
"id-Gost28147-89-CryptoPro-A-ParamSet",
"testcnt1",
{
0x59, 0x9f, 0x84, 0xba, 0xc3, 0xf3, 0xd2, 0xf1,
0x60, 0xe1, 0xe3, 0xf2, 0x6a, 0x96, 0x1a, 0xf9,
0x9c, 0x48, 0xb2, 0x4e, 0xbc, 0xbb, 0xbf, 0x7c,
0xd8, 0xf3, 0xac, 0xcd, 0x96, 0x8d, 0x28, 0x6a},
G89_CNT,
{
0x8d, 0xaf, 0xa8, 0xd1, 0x58, 0xed, 0x05, 0x8d},
{
0x6e, 0x72, 0x62, 0xcc, 0xe3, 0x59, 0x36, 0x90,
0x83, 0x3a, 0xfe, 0xa9, 0x1b, 0xc9, 0xbe, 0xce}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
16,
{
0xb5, 0xa1, 0xf0, 0xe3, 0xce, 0x2f, 0x02, 0x1d,
0x67, 0x61, 0x94, 0x34, 0x5c, 0x41, 0xe3, 0x6e},
"id-Gost28147-89-CryptoPro-A-ParamSet",
"testimit1",
{
0x9d, 0x05, 0xb7, 0x9e, 0x90, 0xca, 0xd0, 0x0a,
0x2c, 0xda, 0xd2, 0x2e, 0xf4, 0xe8, 0x6f, 0x5c,
0xf5, 0xdc, 0x37, 0x68, 0x19, 0x85, 0xb3, 0xbf,
0xaa, 0x18, 0xc1, 0xc3, 0x05, 0x0a, 0x91, 0xa2},
G89_IMIT,
{0},
{
0xf8, 0x1f, 0x08, 0xa3}
},
/*
* Other paramsets and key meshing test cases.
*/
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
1039,
{
0x8c, 0x9c, 0x44, 0x35, 0xfb, 0xe9, 0xa5, 0xa3,
0xa0, 0xae, 0x28, 0x56, 0x91, 0x10, 0x8e, 0x1e,
0xd2, 0xbb, 0x18, 0x53, 0x81, 0x27, 0x0d, 0xa6,
0x68, 0x59, 0x36, 0xc5, 0x81, 0x62, 0x9a, 0x8e,
0x7d, 0x50, 0xf1, 0x6f, 0x97, 0x62, 0x29, 0xec,
0x80, 0x51, 0xe3, 0x7d, 0x6c, 0xc4, 0x07, 0x95,
0x28, 0x63, 0xdc, 0xb4, 0xb9, 0x2d, 0xb8, 0x13,
0xb1, 0x05, 0xb5, 0xf9, 0xeb, 0x75, 0x37, 0x4e,
0xf7, 0xbf, 0x51, 0xf1, 0x98, 0x86, 0x43, 0xc4,
0xe4, 0x3d, 0x3e, 0xa7, 0x62, 0xec, 0x41, 0x59,
0xe0, 0xbd, 0xfb, 0xb6, 0xfd, 0xec, 0xe0, 0x77,
0x13, 0xd2, 0x59, 0x90, 0xa1, 0xb8, 0x97, 0x6b,
0x3d, 0x8b, 0x7d, 0xfc, 0x9d, 0xca, 0x82, 0x73,
0x32, 0x70, 0x0a, 0x74, 0x03, 0xc6, 0x0c, 0x26,
0x7f, 0x56, 0xf0, 0x9d, 0xb2, 0xeb, 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0xdb, 0xb1, 0x8c, 0x6d, 0x05, 0xe8,
0xc9, 0x99, 0xc7, 0x08, 0xf9, 0x14, 0x8f, 0x78,
0xa9, 0x8f, 0xc2, 0x5a, 0x7a, 0x65, 0xc5, 0xd8,
0x86, 0xbb, 0x72, 0x69, 0x6b, 0x6b, 0x45, 0x83,
0x5b, 0xb1, 0xf7, 0xcd, 0x16, 0x73, 0xee, 0xe9,
0x80, 0x85, 0xfe, 0x8e, 0xe1, 0xae, 0x53, 0x8f,
0xde, 0xbe, 0x48, 0x8b, 0x59, 0xef, 0xf6, 0x7e,
0xd8, 0xb5, 0xa8, 0x47, 0xc0, 0x4e, 0x15, 0x58,
0xca, 0xd3, 0x2f, 0xf8, 0x6c, 0xa6, 0x3d, 0x78,
0x4d, 0x7a, 0x54, 0xd6, 0x10, 0xe5, 0xcc, 0x05,
0xe2, 0x29, 0xb5, 0x86, 0x07, 0x39, 0x7d, 0x78,
0x8e, 0x5a, 0x8f, 0x83, 0x4c, 0xe7, 0x3d, 0x68,
0x3e, 0xe5, 0x02, 0xe6, 0x64, 0x4f, 0x5e, 0xb4,
0x49, 0x77, 0xf0, 0xc0, 0xfa, 0x6f, 0xc8, 0xfb,
0x9f, 0x84, 0x6f, 0x55, 0xfb, 0x30, 0x5e, 0x89,
0x93, 0xa9, 0xf3, 0xa6, 0xa3, 0xd7, 0x26, 0xbb,
0xd8, 0xa8, 0xd9, 0x95, 0x1d, 0xfe, 0xfc, 0xd7,
0xa8, 0x93, 0x66, 0x2f, 0x04, 0x53, 0x06, 0x64,
0x7f, 0x31, 0x29, 0xae, 0xb7, 0x9f, 0xba, 0xc4,
0x6d, 0x68, 0xd1, 0x24, 0x32, 0xf4, 0x11}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
4,
{
0x07, 0x9c, 0x91, 0xbe},
"id-Gost28147-89-CryptoPro-C-ParamSet",
"testcfb3",
{
0x77, 0xc3, 0x45, 0x8e, 0xf6, 0x42, 0xe7, 0x04,
0x8e, 0xfc, 0x08, 0xe4, 0x70, 0x96, 0xd6, 0x05,
0x93, 0x59, 0x02, 0x6d, 0x6f, 0x97, 0xca, 0xe9,
0xcf, 0x89, 0x44, 0x4b, 0xde, 0x6c, 0x22, 0x1d},
G89_CFB,
{
0x43, 0x7c, 0x3e, 0x8e, 0x2f, 0x2a, 0x00, 0x98},
{
0x19, 0x35, 0x81, 0x34}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
9,
{
0x2f, 0x31, 0xd8, 0x83, 0xb4, 0x20, 0xe8, 0x6e,
0xda},
"id-Gost28147-89-CryptoPro-D-ParamSet",
"testcfb4",
{
0x38, 0x9f, 0xe8, 0x37, 0xff, 0x9c, 0x5d, 0x29,
0xfc, 0x48, 0x55, 0xa0, 0x87, 0xea, 0xe8, 0x40,
0x20, 0x87, 0x5b, 0xb2, 0x01, 0x15, 0x55, 0xa7,
0xe3, 0x2d, 0xcb, 0x3d, 0xd6, 0x59, 0x04, 0x73},
G89_CFB,
{
0xc5, 0xa2, 0xd2, 0x1f, 0x2f, 0xdf, 0xb8, 0xeb},
{
0x6d, 0xa4, 0xed, 0x40, 0x08, 0x88, 0x71, 0xad,
0x16}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
5242880 + 8,
{0},
"id-Gost28147-89-CryptoPro-A-ParamSet",
"test5Mcfb",
{
0x61, 0x58, 0x44, 0x5a, 0x41, 0xf6, 0xc7, 0x0f,
0x6b, 0xdb, 0x51, 0x91, 0x6a, 0xf6, 0x81, 0x30,
0x8c, 0xa7, 0x98, 0xdd, 0x38, 0x35, 0x8a, 0x60,
0x85, 0xb4, 0xf0, 0xf9, 0x43, 0xa2, 0x7d, 0x9a},
G89_CFB,
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{
0x1c, 0x16, 0xa0, 0xe9, 0x63, 0x94, 0xfe, 0x38,
0x37, 0xa7, 0x9b, 0x70, 0x25, 0x2e, 0xd6, 0x00}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
U64(4294967296) + 16,
{0},
"id-Gost28147-89-CryptoPro-A-ParamSet",
"test4Gcfb",
{
0xae, 0x57, 0xa2, 0xdd, 0xa4, 0xef, 0x4f, 0x96,
0xb8, 0x94, 0xa5, 0xd1, 0x1b, 0xc8, 0x9b, 0x42,
0xa5, 0x24, 0xcc, 0x89, 0x5c, 0xb8, 0x92, 0x52,
0xc1, 0x12, 0x6a, 0xb0, 0x9a, 0x26, 0xe8, 0x06},
G89_CFB,
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{
0x2e, 0x62, 0xb0, 0x2e, 0xc7, 0x87, 0x4b, 0x29,
0x33, 0x16, 0x6b, 0xb4, 0xd6, 0x61, 0x66, 0xd9}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
1037,
{
0x3d, 0x0b, 0x69, 0xf7, 0xa8, 0xe4, 0xfc, 0x99,
0x22, 0x2e, 0xee, 0xd1, 0x63, 0x12, 0xfe, 0xa8,
0x9d, 0xcb, 0x6c, 0x4d, 0x48, 0x8c, 0xe8, 0xbd,
0x8b, 0x60, 0xf1, 0xbf, 0x7b, 0xe3, 0x79, 0xd5,
0x2b, 0x25, 0x97, 0x13, 0xef, 0x35, 0xda, 0xf4,
0xbc, 0x77, 0xce, 0xea, 0xe9, 0x3f, 0xa4, 0xb6,
0x01, 0xd5, 0x73, 0x29, 0x58, 0xda, 0xd7, 0x67,
0x17, 0xac, 0xe4, 0x75, 0x2f, 0x57, 0x23, 0xac,
0x96, 0x21, 0xc7, 0x62, 0x2d, 0xf7, 0x32, 0xb5,
0x44, 0x5f, 0x72, 0xb1, 0x5f, 0xba, 0x1b, 0x1e,
0xdb, 0x4a, 0x09, 0x8c, 0x92, 0x61, 0xa2, 0xb0,
0x49, 0x68, 0xe5, 0xb3, 0xa2, 0x8f, 0x13, 0x4b,
0x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1e, 0x23, 0x2e}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
5242880 + 8,
{0},
"id-Gost28147-89-CryptoPro-A-ParamSet",
"test5Mcnt",
{
0x07, 0x52, 0x65, 0xe7, 0xca, 0xa3, 0xca, 0x45,
0xcf, 0x3a, 0x05, 0x1d, 0x38, 0x03, 0x53, 0x0c,
0x22, 0x31, 0xba, 0x99, 0x4f, 0x9b, 0x6a, 0x1b,
0x7e, 0x09, 0x9d, 0x4e, 0xb5, 0xc9, 0x84, 0x2e},
G89_CNT,
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{
0x3d, 0x05, 0x07, 0x57, 0xc0, 0x75, 0x89, 0x97,
0xd6, 0x94, 0x49, 0x11, 0x1d, 0xd0, 0x91, 0xee}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
U64(4294967296) + 16,
{0},
"id-Gost28147-89-CryptoPro-A-ParamSet",
"test4Gcnt",
{
0x75, 0xa3, 0x3c, 0xae, 0x03, 0x6b, 0x10, 0xdb,
0xc1, 0x56, 0x50, 0x89, 0x03, 0xd2, 0x9f, 0x91,
0xee, 0xe8, 0x64, 0x1d, 0x43, 0xf2, 0x4e, 0xf8,
0xf2, 0x6c, 0xed, 0xda, 0x8f, 0xe4, 0x88, 0xe9},
G89_CNT,
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{
0xfa, 0x6c, 0x96, 0x78, 0xe2, 0xf8, 0xdd, 0xaa,
0x67, 0x5a, 0xc9, 0x5d, 0x57, 0xf1, 0xbd, 0x99}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
1035,
{
0xd6, 0xcf, 0x31, 0x96, 0x9c, 0xa1, 0xfb, 0xd6,
0x8d, 0xa3, 0xdd, 0x01, 0xd9, 0x88, 0xc0, 0x2f,
0xbc, 0x46, 0xc7, 0x3a, 0xe4, 0x21, 0x86, 0x96,
0x8d, 0xe2, 0xca, 0xb6, 0x37, 0xa2, 0xe1, 0xa8,
0x7e, 0xa7, 0x79, 0x2e, 0xa4, 0x56, 0x75, 0x7f,
0x3e, 0x55, 0x8b, 0x43, 0xae, 0x65, 0xdf, 0xaa,
0x42, 0xb6, 0x00, 0xa6, 0x61, 0x03, 0x0d, 0xd3,
0x41, 0x02, 0x27, 0x23, 0x95, 0x79, 0x9b, 0x34,
0x81, 0xa9, 0x86, 0xb5, 0xa7, 0x90, 0xe2, 0xae,
0xc4, 0x2f, 0xc3, 0x8e, 0x32, 0x56, 0x13, 0xfa,
0x4d, 0x4e, 0x9f, 0x15, 0x75, 0x7e, 0x74, 0xdc,
0x32, 0x2d, 0xee, 0x4d, 0x67, 0x70, 0x9f, 0x62,
0xb9, 0xc4, 0xdb, 0x24, 0x84, 0xcc, 0x16, 0x7b,
0xda, 0x22, 0xf7, 0xc5, 0xf3, 0x93, 0x35, 0x73,
0xc6, 0x03, 0x1c, 0x77, 0xa5, 0xf2, 0x76, 0x56,
0xb4, 0x95, 0xd4, 0x7e, 0x0d, 0x20, 0xc6, 0x6e,
0xee, 0x8f, 0x25, 0x48, 0xff, 0x7e, 0x01, 0x3a,
0xb4, 0x1f, 0xaa, 0x35, 0xc0, 0x33, 0x58, 0x9c,
0xb5, 0xba, 0x65, 0x4b, 0xd3, 0x51, 0x14, 0xec,
0x61, 0xce, 0xe4, 0xba, 0x49, 0xba, 0x39, 0x32,
0xab, 0xce, 0x81, 0x72, 0xce, 0xab, 0xed, 0xd4,
0xd2, 0x19, 0x87, 0x85, 0x92, 0xfa, 0x64, 0x34,
0xd8, 0x86, 0xf4, 0x8a, 0x08, 0x3c, 0xde, 0xee,
0x97, 0x92, 0x92, 0x69, 0xba, 0x9b, 0x5f, 0x7a,
0x03, 0xc1, 0x5d, 0x43, 0x02, 0x8c, 0xbe, 0xd2,
0x46, 0x72, 0x81, 0x40, 0x7d, 0x68, 0x98, 0x45,
0x0b, 0x54, 0x27, 0x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, 0xae, 0x43, 0xca,
0xe1, 0x3f, 0x81, 0x74, 0x7e, 0x1c, 0x47, 0x17,
0x95, 0xc6, 0x60, 0xda, 0x74, 0x77, 0xd9, 0x9f,
0xfa, 0x92, 0xb4, 0xbe, 0xe1, 0x23, 0x98, 0x18,
0x95, 0x63, 0x03, 0x13, 0x4c, 0x1a, 0x2d, 0x41,
0xcd, 0xe4, 0x84, 0xf7, 0xe6, 0x38, 0xef, 0xff,
0x95, 0xb2, 0xe8, 0x7c, 0x8f, 0x58, 0xb5, 0xb5,
0xed, 0x27, 0x7f, 0x3c, 0x18, 0xab, 0xbe, 0x7f,
0x4f, 0xe2, 0x35, 0x15, 0x71, 0xb7, 0x6f, 0x85,
0x38, 0x9b, 0x88, 0xf6, 0x9c, 0x8d, 0x43, 0xb5,
0x58, 0x9e, 0xf2, 0xd1, 0x96, 0xbe, 0xb7, 0xad,
0x1a, 0xa0, 0x98},
"id-Gost28147-89-CryptoPro-A-ParamSet",
"testimit2",
{
0x80, 0xd9, 0xa0, 0xdc, 0x21, 0xf9, 0x30, 0x40,
0x75, 0xfe, 0x49, 0x1b, 0x9e, 0x71, 0x90, 0x91,
0x78, 0x88, 0x21, 0x60, 0x39, 0xe7, 0xc9, 0x2b,
0xfb, 0x55, 0x1d, 0xf4, 0xdd, 0x2b, 0x0a, 0x01},
G89_IMIT,
{0},
{
0x90, 0xf2, 0x11, 0x9a}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
10,
{
0x1d, 0xeb, 0xe6, 0x79, 0x0a, 0x59, 0x00, 0xe6,
0x8e, 0x5c},
"id-Gost28147-89-CryptoPro-A-ParamSet",
"testimit3",
{
0xa9, 0xb6, 0x37, 0xcc, 0x6d, 0x9b, 0x2f, 0x25,
0xb0, 0xdf, 0x47, 0x04, 0x50, 0x68, 0xb0, 0x27,
0x41, 0x27, 0x58, 0x6a, 0xbd, 0x0a, 0x6e, 0x50,
0x2f, 0xc6, 0xfc, 0xc0, 0x3e, 0x29, 0x42, 0xa5},
G89_IMIT,
{0},
{
0x31, 0x7c, 0x16, 0xe4}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
6,
{
0xef, 0x06, 0x8f, 0x14, 0xc9, 0x04},
"id-Gost28147-89-CryptoPro-A-ParamSet",
"testimit4",
{
0xb0, 0x6c, 0x48, 0x23, 0x0a, 0x6e, 0xf4, 0xec,
0x27, 0x98, 0x01, 0x23, 0xa7, 0xd8, 0xbf, 0x60,
0x89, 0xef, 0xad, 0xe8, 0x8f, 0x79, 0x14, 0x8c,
0x18, 0x5c, 0x9a, 0xda, 0xef, 0x0b, 0xdd, 0xa0},
G89_IMIT,
{0},
{
0xe9, 0x72, 0xae, 0xbf}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
16,
{
0x02, 0xf8, 0xec, 0x2b, 0x4d, 0x1f, 0xbc, 0x7c,
0x6e, 0x47, 0xe3, 0x87, 0x22, 0x75, 0x41, 0xa7},
"id-Gost28147-89-CryptoPro-B-ParamSet",
"testimit5",
{
0x33, 0xd3, 0xef, 0x01, 0x19, 0x95, 0x0e, 0x15,
0xa1, 0x69, 0x75, 0xae, 0x56, 0x27, 0x17, 0x79,
0x63, 0x47, 0xab, 0x62, 0x9d, 0x4a, 0xf0, 0x34,
0xd3, 0x1e, 0x69, 0x74, 0xec, 0x31, 0x48, 0xfc},
G89_IMIT,
{0},
{
0xf5, 0x55, 0x1f, 0x28}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
8,
{
0xf3, 0xb2, 0x29, 0xd2, 0x7a, 0x37, 0x03, 0x12},
"id-Gost28147-89-CryptoPro-A-ParamSet",
"testimit6",
{
0x42, 0x35, 0x81, 0x91, 0x0b, 0xa9, 0x99, 0xff,
0xd9, 0x43, 0xf8, 0xc6, 0x19, 0x55, 0x1f, 0x2f,
0x2d, 0x45, 0x40, 0x20, 0x1e, 0x1d, 0x32, 0x7a,
0xb1, 0x07, 0x6b, 0x4f, 0x45, 0x90, 0xd9, 0x80},
G89_IMIT,
{0},
{
0x6e, 0x15, 0xfa, 0xe8}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
0,
{
0},
"id-Gost28147-89-CryptoPro-A-ParamSet",
"testimit7",
{
0x26, 0xcb, 0xb9, 0xf0, 0x0c, 0x62, 0x9f, 0xaa,
0x4a, 0x1d, 0xb6, 0x30, 0x09, 0x01, 0x56, 0x89,
0x66, 0xd4, 0xe4, 0x0e, 0xfe, 0xf6, 0x10, 0x6b,
0x6c, 0xe8, 0x04, 0x3a, 0xe3, 0x61, 0x4b, 0x19},
G89_IMIT,
{0},
{
0x00, 0x00, 0x00, 0x00}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
5242880,
{0},
"id-Gost28147-89-CryptoPro-A-ParamSet",
"test5Mimit",
{
0xaa, 0x85, 0x84, 0xcd, 0x65, 0x28, 0xe1, 0xdb,
0xb8, 0x20, 0x19, 0x43, 0xe0, 0x36, 0x35, 0x10,
0x19, 0xc3, 0x70, 0x5b, 0x27, 0xc1, 0x9d, 0x84,
0x75, 0xa3, 0xc6, 0x49, 0x46, 0x8f, 0x7c, 0x4e},
G89_IMIT,
{0},
{
0x2a, 0xe6, 0x23, 0xc6}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
3221225472U + 16,
{0},
"id-Gost28147-89-CryptoPro-A-ParamSet",
"test3Gimit1",
{
0xd5, 0xda, 0xfe, 0x06, 0x60, 0xdc, 0xf0, 0xb3,
0x49, 0x5a, 0x02, 0x59, 0xc8, 0x2e, 0x4a, 0x2b,
0xcc, 0x9b, 0x98, 0x04, 0xb7, 0xf2, 0x78, 0xb7,
0xce, 0xa3, 0xf2, 0xdb, 0x9e, 0xa8, 0x49, 0x1d},
G89_IMIT,
{0},
{
0xcc, 0x46, 0x67, 0xe4}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
U64(4) * 1024 * 1024 * 1024,
{0},
"id-Gost28147-89-CryptoPro-A-ParamSet",
"test4Gimit3",
{
0x0d, 0xf1, 0xa8, 0x7f, 0x57, 0x03, 0x44, 0xcc,
0xdb, 0x20, 0xde, 0xed, 0x85, 0x50, 0x38, 0xda,
0xc9, 0x44, 0xec, 0x2c, 0x0d, 0x66, 0xb7, 0xdc,
0x17, 0x14, 0x55, 0x95, 0x33, 0x6e, 0x43, 0x3e},
G89_IMIT,
{0},
{
0xb7, 0x21, 0x2e, 0x48}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
U64(4) * 1024 * 1024 * 1024 + 4,
{0},
"id-Gost28147-89-CryptoPro-A-ParamSet",
"test4Gimit1",
{
0x0c, 0xf3, 0xe9, 0xb0, 0x28, 0x3b, 0x9f, 0x8b,
0xe3, 0x82, 0xb9, 0xa2, 0xa6, 0xbd, 0x80, 0xd2,
0xcd, 0xfa, 0x3f, 0xf7, 0x90, 0xa7, 0x55, 0x06,
0x9b, 0x7a, 0x58, 0xee, 0xe7, 0xf1, 0x9d, 0xbe},
G89_IMIT,
{0},
{
0xda, 0x15, 0x10, 0x73}
},
{ /* Calculated by libcapi10, CryptoPro CSP
* 3.6R2, Mac OSX */
U64(4) * 1024 * 1024 * 1024 + 10,
{0},
"id-Gost28147-89-CryptoPro-A-ParamSet",
"test4Gimit2",
{
0x97, 0x1a, 0x42, 0x22, 0xfa, 0x07, 0xb2, 0xca,
0xf9, 0xd2, 0x34, 0x5a, 0x92, 0xb1, 0x1f, 0x6b,
0x53, 0xf8, 0xaf, 0xed, 0x9a, 0x73, 0xc4, 0x38,
0xd7, 0x7d, 0x25, 0x81, 0x00, 0x0d, 0xd4, 0x29},
G89_IMIT,
{0},
{
0x52, 0xaa, 0x22, 0xb4}
}
};
int main(int argc, char *argv[])
{
unsigned int t;
u64 ullMaxLen = 6 * 1000 * 1000;
int ignore = 0;
ENGINE *impl = NULL;
EVP_MD_CTX mctx;
EVP_CIPHER_CTX ectx;
EVP_PKEY *mac_key;
byte bDerive[EVP_MAX_KEY_LENGTH];
byte bTest[G89_MAX_TC_LEN];
byte bTest1[G89_MAX_TC_LEN];
u64 ullLeft;
static const byte bZB[40 * 1024 * 1024] = { 0 };
static byte bTS[40 * 1024 * 1024] = { 0 };
unsigned int mdl = 0;
int enlu = 0;
int enlf = 0;
size_t siglen;
size_t l = 0;
const EVP_MD *md_gost94 = NULL;
const EVP_CIPHER *cp_g89cfb = NULL;
const EVP_CIPHER *cp_g89cnt = NULL;
const EVP_CIPHER *ctype = NULL;
const EVP_MD *md_g89imit = NULL;
long lErrLine;
CONF *pConfig = NCONF_new(NULL);
BIO *bpConf;
char sConf[] =
"openssl_conf = openssl_def\n"
"\n"
"[openssl_def]\n"
"engines = engine_section\n"
"\n"
"[engine_section]\n"
"gost = gost_section\n"
"\n" "[gost_section]\n" "default_algorithms = ALL\n" "\n";
printf("Testing GOST 28147-89 ");
if (1 < argc) {
if (1 != sscanf(argv[1], FMT64, &ullMaxLen) ||
(2 < argc ? 1 != sscanf(argv[2], "%d", &ignore) : 0)) {
fflush(NULL);
fprintf(stderr, "Usage: %s [maxlen [ignore-error]]\n", argv[0]);
return 1;
}
}
/*
* ccgost engine test on GostR3411_94_CryptoProParamSet
*/
ERR_load_crypto_strings();
ENGINE_load_builtin_engines();
OPENSSL_load_builtin_modules();
bpConf = BIO_new_mem_buf(sConf, -1);
if (!NCONF_load_bio(pConfig, bpConf, &lErrLine)) {
fflush(NULL);
fprintf(stderr, "NCONF_load_bio: ErrLine=%ld: %s\n",
lErrLine, ERR_error_string(ERR_get_error(), NULL));
return 4;
}
BIO_free(bpConf);
if (!CONF_modules_load(pConfig, NULL, 0)) {
fflush(NULL);
fprintf(stderr, "CONF_modules_load: %s\n",
ERR_error_string(ERR_get_error(), NULL));
return 5;
}
/* Test load engine */
if (NULL == (impl = ENGINE_by_id(CCGOST_ID))) {
fflush(NULL);
fprintf(stderr, "Can't load engine id \"" CCGOST_ID "\"\n");
if (!ignore) {
return 6;
}
}
if (NULL == (md_gost94 = EVP_get_digestbyname(SN_id_GostR3411_94))) {
fflush(NULL);
fprintf(stderr, "\"" SN_id_GostR3411_94 "\" - not found\n");
if (!ignore) {
return 7;
}
}
if (NULL == (cp_g89cfb = EVP_get_cipherbyname(SN_id_Gost28147_89))) {
fflush(NULL);
fprintf(stderr, "\"" SN_id_Gost28147_89 "\" - not found\n");
if (!ignore) {
return 8;
}
}
if (NULL == (cp_g89cnt = EVP_get_cipherbyname(SN_gost89_cnt))) {
fflush(NULL);
fprintf(stderr, "\"" SN_gost89_cnt "\" - not found\n");
if (!ignore) {
return 9;
}
}
if (NULL == (md_g89imit = EVP_get_digestbyname(SN_id_Gost28147_89_MAC))) {
fflush(NULL);
fprintf(stderr, "\"" SN_id_Gost28147_89_MAC "\" - not found\n");
if (!ignore) {
return 10;
}
}
/* Test cases */
for (t = 0; t < OSSL_NELEM(tcs); t++) {
if (NULL == tcs[t].szDerive) {
continue;
}
memset(bDerive, 0x3c, sizeof(bDerive));
mdl = sizeof(bDerive);
EVP_Digest(tcs[t].szDerive, strlen(tcs[t].szDerive),
bDerive, &mdl, md_gost94, impl);
if (0 != memcmp(tcs[t].bRawKey, bDerive, mdl)) {
fflush(NULL);
fprintf(stderr, "Engine test t=%d " "derive key error.\n", t);
if (!ignore) {
return 12;
}
}
if (ullMaxLen < tcs[t].ullLen) {
continue;
}
memset(bTest, 0xa5, sizeof(bTest));
memset(bTest1, 0x5a, sizeof(bTest1));
if (!ENGINE_ctrl_cmd_string(impl,
"CRYPT_PARAMS", tcs[t].szParamSet, 0)) {
fflush(NULL);
fprintf(stderr, "ENGINE_ctrl_cmd_string: %s\n",
ERR_error_string(ERR_get_error(), NULL));
return 11;
}
switch (tcs[t].gMode) {
case G89_ECB:
/* OpenSSL/ccgost not implemented GOST 28147-89 ECB */
continue;
case G89_CFB:
ctype = cp_g89cfb;
goto engine_cipher_check;
case G89_CNT:
if (0 != strcmp("id-Gost28147-89-CryptoPro-A-ParamSet",
tcs[t].szParamSet)) {
/*
* ccgost engine can't change S-Box for gost-cnt
*/
continue;
}
ctype = cp_g89cnt;
engine_cipher_check:
EVP_CIPHER_CTX_init(&ectx);
EVP_EncryptInit_ex(&ectx, ctype, impl, bDerive, tcs[t].bIV);
if (G89_MAX_TC_LEN >= tcs[t].ullLen) {
enlu = sizeof(bTest);
EVP_EncryptUpdate(&ectx, bTest, &enlu,
tcs[t].bIn, (int)tcs[t].ullLen);
l = (size_t)tcs[t].ullLen;
} else {
for (ullLeft = tcs[t].ullLen;
ullLeft >= sizeof(bZB); ullLeft -= sizeof(bZB)) {
printf("B");
fflush(NULL);
enlu = sizeof(bTS);
EVP_EncryptUpdate(&ectx, bTS, &enlu, bZB, sizeof(bZB));
}
printf("b" FMT64 "/" FMT64, ullLeft, tcs[t].ullLen);
fflush(NULL);
EVP_EncryptUpdate(&ectx, bTS, &enlu, bZB, (int)ullLeft);
memcpy(bTest, &bTS[enlu - 16], 16);
enlu = (int)tcs[t].ullLen;
l = 16;
}
enlf = sizeof(bTest1);
EVP_EncryptFinal_ex(&ectx, bTest1, &enlf);
EVP_CIPHER_CTX_cleanup(&ectx);
break;
case G89_IMIT:
if (0 != strcmp("id-Gost28147-89-CryptoPro-A-ParamSet",
tcs[t].szParamSet)) {
/*
* ccgost engine can't change S-Box for gost-mac
*/
continue;
}
EVP_MD_CTX_init(&mctx);
mac_key = EVP_PKEY_new_mac_key(NID_id_Gost28147_89_MAC, NULL,
bDerive, mdl);
EVP_DigestSignInit(&mctx, NULL, md_g89imit, impl, mac_key);
if (G89_MAX_TC_LEN >= tcs[t].ullLen) {
EVP_DigestSignUpdate(&mctx, tcs[t].bIn,
(unsigned int)tcs[t].ullLen);
} else {
for (ullLeft = tcs[t].ullLen;
ullLeft >= sizeof(bZB); ullLeft -= sizeof(bZB)) {
printf("B");
fflush(NULL);
EVP_DigestSignUpdate(&mctx, bZB, sizeof(bZB));
}
printf("b" FMT64 "/" FMT64, ullLeft, tcs[t].ullLen);
fflush(NULL);
EVP_DigestSignUpdate(&mctx, bZB, (unsigned int)ullLeft);
}
siglen = 4;
OPENSSL_assert(EVP_DigestSignFinal(&mctx, bTest, &siglen));
EVP_PKEY_free(mac_key);
EVP_MD_CTX_cleanup(&mctx);
enlu = (int)tcs[t].ullLen;
enlf = 0;
l = siglen;
break;
}
if ((int)tcs[t].ullLen != enlu || 0 != enlf ||
0 != memcmp(tcs[t].bOut, bTest, l)) {
fflush(NULL);
fprintf(stderr, "\nEngine test t=%d len=" FMT64
" failed.\n", t, tcs[t].ullLen);
if (!ignore) {
return 13;
}
} else {
printf(".");
fflush(NULL);
}
}
printf(" passed\n");
fflush(NULL);
NCONF_free(pConfig);
return EXIT_SUCCESS;
}
#endif