Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR #393 rebased #416

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,15 @@ add_test(NAME ciphers-with-provider COMMAND test_ciphers)
set_tests_properties(ciphers-with-provider
PROPERTIES ENVIRONMENT "${TEST_ENVIRONMENT_PROVIDER}")

# add_executable(test_mgm test_mgm.c)
# target_link_libraries(test_mgm OpenSSL::Crypto)
# add_test(NAME mgm-with-engine COMMAND test_mgm)
# set_tests_properties(mgm-with-engine
# PROPERTIES ENVIRONMENT "${TEST_ENVIRONMENT_ENGINE}")
# add_test(NAME mgm-with-provider COMMAND test_mgm)
# set_tests_properties(mgm-with-provider
# PROPERTIES ENVIRONMENT "${TEST_ENVIRONMENT_PROVIDER}")

# test_curves is an internals testing program, it doesn't need a test env
add_executable(test_curves test_curves.c)
target_link_libraries(test_curves gost_core gost_err)
Expand Down Expand Up @@ -328,6 +337,7 @@ set(BINARY_TESTS_TARGETS
test_keyexpimp
test_gost89
test_tls
# test_mgm
)
set_property(TARGET ${BINARY_TESTS_TARGETS} APPEND PROPERTY COMPILE_DEFINITIONS ENGINE_DIR="${OUTPUT_DIRECTORY}")

Expand Down
12 changes: 12 additions & 0 deletions e_gost_err.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ static ERR_STRING_DATA GOST_str_functs[] = {
"gost_grasshopper_cipher_ctl"},
{ERR_PACK(0, GOST_F_GOST_GRASSHOPPER_CIPHER_DO_CTRACPKM_OMAC, 0),
"gost_grasshopper_cipher_do_ctracpkm_omac"},
{ERR_PACK(0, GOST_F_GOST_GRASSHOPPER_CIPHER_DO_MGM, 0),
"gost_grasshopper_cipher_do_mgm"},
{ERR_PACK(0, GOST_F_GOST_GRASSHOPPER_CIPHER_INIT_CTRACPKM_OMAC, 0),
"gost_grasshopper_cipher_init_ctracpkm_omac"},
{ERR_PACK(0, GOST_F_GOST_GRASSHOPPER_MGM_CTRL, 0),
"gost_grasshopper_mgm_ctrl"},
{ERR_PACK(0, GOST_F_GOST_GRASSHOPPER_SET_ASN1_PARAMETERS, 0),
"gost_grasshopper_set_asn1_parameters"},
{ERR_PACK(0, GOST_F_GOST_IMIT_CTRL, 0), "gost_imit_ctrl"},
Expand All @@ -64,6 +68,12 @@ static ERR_STRING_DATA GOST_str_functs[] = {
{ERR_PACK(0, GOST_F_GOST_KDFTREE2012_256, 0), "gost_kdftree2012_256"},
{ERR_PACK(0, GOST_F_GOST_KEXP15, 0), "gost_kexp15"},
{ERR_PACK(0, GOST_F_GOST_KIMP15, 0), "gost_kimp15"},
{ERR_PACK(0, GOST_F_GOST_MAGMA_CIPHER_DO_MGM, 0),
"gost_magma_cipher_do_mgm"},
{ERR_PACK(0, GOST_F_GOST_MAGMA_MGM_CTRL, 0), "gost_magma_mgm_ctrl"},
{ERR_PACK(0, GOST_F_GOST_MGM128_AAD, 0), "gost_mgm128_aad"},
{ERR_PACK(0, GOST_F_GOST_MGM128_DECRYPT, 0), "gost_mgm128_decrypt"},
{ERR_PACK(0, GOST_F_GOST_MGM128_ENCRYPT, 0), "gost_mgm128_encrypt"},
{ERR_PACK(0, GOST_F_MAGMA_CIPHER_CTL, 0), "magma_cipher_ctl"},
{ERR_PACK(0, GOST_F_MAGMA_CIPHER_CTL_ACPKM_OMAC, 0),
"magma_cipher_ctl_acpkm_omac"},
Expand Down Expand Up @@ -129,6 +139,7 @@ static ERR_STRING_DATA GOST_str_reasons[] = {
"cannot unpack ephemeral key"},
{ERR_PACK(0, 0, GOST_R_CIPHER_NOT_FOUND), "cipher not found"},
{ERR_PACK(0, 0, GOST_R_CTRL_CALL_FAILED), "ctrl call failed"},
{ERR_PACK(0, 0, GOST_R_DATA_TOO_LARGE), "data too large"},
{ERR_PACK(0, 0, GOST_R_ERROR_COMPUTING_EXPORT_KEYS),
"error computing export keys"},
{ERR_PACK(0, 0, GOST_R_ERROR_COMPUTING_SHARED_KEY),
Expand All @@ -153,6 +164,7 @@ static ERR_STRING_DATA GOST_str_reasons[] = {
{ERR_PACK(0, 0, GOST_R_INVALID_MAC_PARAMS), "invalid mac params"},
{ERR_PACK(0, 0, GOST_R_INVALID_MAC_SIZE), "invalid mac size"},
{ERR_PACK(0, 0, GOST_R_INVALID_PARAMSET), "invalid paramset"},
{ERR_PACK(0, 0, GOST_R_INVALID_TAG_LENGTH), "invalid tag length"},
{ERR_PACK(0, 0, GOST_R_KEY_IS_NOT_INITIALIZED), "key is not initialized"},
{ERR_PACK(0, 0, GOST_R_KEY_PARAMETERS_MISSING), "key parameters missing"},
{ERR_PACK(0, 0, GOST_R_MAC_KEY_NOT_SET), "mac key not set"},
Expand Down
9 changes: 9 additions & 0 deletions e_gost_err.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,21 @@ void ERR_GOST_error(int function, int reason, char *file, int line);
# define GOST_F_GOST_ENCODE_CMS_PARAMS 161
# define GOST_F_GOST_GRASSHOPPER_CIPHER_CTL 111
# define GOST_F_GOST_GRASSHOPPER_CIPHER_DO_CTRACPKM_OMAC 160
# define GOST_F_GOST_GRASSHOPPER_CIPHER_DO_MGM 166
# define GOST_F_GOST_GRASSHOPPER_CIPHER_INIT_CTRACPKM_OMAC 162
# define GOST_F_GOST_GRASSHOPPER_MGM_CTRL 167
# define GOST_F_GOST_GRASSHOPPER_SET_ASN1_PARAMETERS 112
# define GOST_F_GOST_IMIT_CTRL 113
# define GOST_F_GOST_IMIT_FINAL 114
# define GOST_F_GOST_IMIT_UPDATE 115
# define GOST_F_GOST_KDFTREE2012_256 149
# define GOST_F_GOST_KEXP15 143
# define GOST_F_GOST_KIMP15 148
# define GOST_F_GOST_MAGMA_CIPHER_DO_MGM 168
# define GOST_F_GOST_MAGMA_MGM_CTRL 169
# define GOST_F_GOST_MGM128_AAD 170
# define GOST_F_GOST_MGM128_DECRYPT 171
# define GOST_F_GOST_MGM128_ENCRYPT 172
# define GOST_F_MAGMA_CIPHER_CTL 163
# define GOST_F_MAGMA_CIPHER_CTL_ACPKM_OMAC 164
# define GOST_F_MAGMA_CIPHER_INIT_CTR_ACPKM_OMAC 165
Expand Down Expand Up @@ -107,6 +114,7 @@ void ERR_GOST_error(int function, int reason, char *file, int line);
# define GOST_R_CANNOT_UNPACK_EPHEMERAL_KEY 136
# define GOST_R_CIPHER_NOT_FOUND 103
# define GOST_R_CTRL_CALL_FAILED 104
# define GOST_R_DATA_TOO_LARGE 141
# define GOST_R_ERROR_COMPUTING_EXPORT_KEYS 135
# define GOST_R_ERROR_COMPUTING_SHARED_KEY 105
# define GOST_R_ERROR_DECODING_PUBLIC_KEY 138
Expand All @@ -126,6 +134,7 @@ void ERR_GOST_error(int function, int reason, char *file, int line);
# define GOST_R_INVALID_MAC_PARAMS 116
# define GOST_R_INVALID_MAC_SIZE 117
# define GOST_R_INVALID_PARAMSET 118
# define GOST_R_INVALID_TAG_LENGTH 142
# define GOST_R_KEY_IS_NOT_INITIALIZED 119
# define GOST_R_KEY_PARAMETERS_MISSING 120
# define GOST_R_MAC_KEY_NOT_SET 121
Expand Down
16 changes: 16 additions & 0 deletions gost.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ GOST_F_GOST_EC_COMPUTE_PUBLIC:107:gost_ec_compute_public
GOST_F_GOST_EC_KEYGEN:108:gost_ec_keygen
GOST_F_GOST_EC_SIGN:109:gost_ec_sign
GOST_F_GOST_EC_VERIFY:110:gost_ec_verify
GOST_F_GOST_ENCODE_CMS_PARAMS:161:gost_encode_cms_params
GOST_F_GOST_GRASSHOPPER_CIPHER_CTL:111:gost_grasshopper_cipher_ctl
GOST_F_GOST_GRASSHOPPER_CIPHER_DO_CTRACPKM_OMAC:160:\
gost_grasshopper_cipher_do_ctracpkm_omac
GOST_F_GOST_GRASSHOPPER_CIPHER_DO_MGM:166:gost_grasshopper_cipher_do_mgm
GOST_F_GOST_GRASSHOPPER_CIPHER_INIT_CTRACPKM_OMAC:162:\
gost_grasshopper_cipher_init_ctracpkm_omac
GOST_F_GOST_GRASSHOPPER_MGM_CTRL:167:gost_grasshopper_mgm_ctrl
GOST_F_GOST_GRASSHOPPER_SET_ASN1_PARAMETERS:112:\
gost_grasshopper_set_asn1_parameters
GOST_F_GOST_IMIT_CTRL:113:gost_imit_ctrl
Expand All @@ -33,6 +38,14 @@ GOST_F_GOST_IMIT_UPDATE:115:gost_imit_update
GOST_F_GOST_KDFTREE2012_256:149:gost_kdftree2012_256
GOST_F_GOST_KEXP15:143:gost_kexp15
GOST_F_GOST_KIMP15:148:gost_kimp15
GOST_F_GOST_MAGMA_CIPHER_DO_MGM:168:gost_magma_cipher_do_mgm
GOST_F_GOST_MAGMA_MGM_CTRL:169:gost_magma_mgm_ctrl
GOST_F_GOST_MGM128_AAD:170:gost_mgm128_aad
GOST_F_GOST_MGM128_DECRYPT:171:gost_mgm128_decrypt
GOST_F_GOST_MGM128_ENCRYPT:172:gost_mgm128_encrypt
GOST_F_MAGMA_CIPHER_CTL:163:magma_cipher_ctl
GOST_F_MAGMA_CIPHER_CTL_ACPKM_OMAC:164:magma_cipher_ctl_acpkm_omac
GOST_F_MAGMA_CIPHER_INIT_CTR_ACPKM_OMAC:165:magma_cipher_init_ctr_acpkm_omac
GOST_F_OMAC_ACPKM_IMIT_CTRL:144:omac_acpkm_imit_ctrl
GOST_F_OMAC_ACPKM_IMIT_FINAL:145:omac_acpkm_imit_final
GOST_F_OMAC_ACPKM_IMIT_UPDATE:146:omac_acpkm_imit_update
Expand Down Expand Up @@ -80,6 +93,7 @@ GOST_R_CANNOT_PACK_EPHEMERAL_KEY:102:cannot pack ephemeral key
GOST_R_CANNOT_UNPACK_EPHEMERAL_KEY:136:cannot unpack ephemeral key
GOST_R_CIPHER_NOT_FOUND:103:cipher not found
GOST_R_CTRL_CALL_FAILED:104:ctrl call failed
GOST_R_DATA_TOO_LARGE:141:data too large
GOST_R_ERROR_COMPUTING_EXPORT_KEYS:135:error computing export keys
GOST_R_ERROR_COMPUTING_SHARED_KEY:105:error computing shared key
GOST_R_ERROR_DECODING_PUBLIC_KEY:138:error decoding public key
Expand All @@ -88,6 +102,7 @@ GOST_R_ERROR_POINT_MUL:107:error point mul
GOST_R_ERROR_SETTING_PEER_KEY:139:error setting peer key
GOST_R_INCOMPATIBLE_ALGORITHMS:108:incompatible algorithms
GOST_R_INCOMPATIBLE_PEER_KEY:109:incompatible peer key
GOST_R_INVALID_BUFFER_SIZE:140:invalid buffer size
GOST_R_INVALID_CIPHER:134:invalid cipher
GOST_R_INVALID_CIPHER_PARAMS:110:invalid cipher params
GOST_R_INVALID_CIPHER_PARAM_OID:111:invalid cipher param oid
Expand All @@ -98,6 +113,7 @@ GOST_R_INVALID_MAC_KEY_SIZE:115:invalid mac key size
GOST_R_INVALID_MAC_PARAMS:116:invalid mac params
GOST_R_INVALID_MAC_SIZE:117:invalid mac size
GOST_R_INVALID_PARAMSET:118:invalid paramset
GOST_R_INVALID_TAG_LENGTH:142:invalid tag length
GOST_R_KEY_IS_NOT_INITIALIZED:119:key is not initialized
GOST_R_KEY_PARAMETERS_MISSING:120:key parameters missing
GOST_R_MAC_KEY_NOT_SET:121:mac key not set
Expand Down
Loading