From: Dmitry Belyavskiy Date: Sat, 26 Mar 2016 14:03:38 +0000 (+0300) Subject: Sources formatting X-Git-Tag: v1.1.0.2~22^2~8 X-Git-Url: http://www.wagner.pp.ru/gitweb/?a=commitdiff_plain;h=286a33984c698f2efa98dd06995c7d734569409c;p=openssl-gost%2Fengine.git Sources formatting --- diff --git a/e_gost_err.h b/e_gost_err.h index e8a5f28..d0f7d89 100644 --- a/e_gost_err.h +++ b/e_gost_err.h @@ -64,9 +64,9 @@ extern "C" { * The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. */ -void ERR_load_GOST_strings(void); -void ERR_unload_GOST_strings(void); -void ERR_GOST_error(int function, int reason, char *file, int line); + void ERR_load_GOST_strings(void); + void ERR_unload_GOST_strings(void); + void ERR_GOST_error(int function, int reason, char *file, int line); # define GOSTerr(f,r) ERR_GOST_error((f),(r),__FILE__,__LINE__) /* Error codes for the GOST functions. */ @@ -139,7 +139,7 @@ void ERR_GOST_error(int function, int reason, char *file, int line); # define GOST_R_UNSUPPORTED_CIPHER_CTL_COMMAND 126 # define GOST_R_UNSUPPORTED_PARAMETER_SET 127 -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif #endif diff --git a/gost_asn1.c b/gost_asn1.c index fb9792a..3a106c2 100644 --- a/gost_asn1.c +++ b/gost_asn1.c @@ -26,29 +26,29 @@ ASN1_NDEF_SEQUENCE_END(GOST_KEY_TRANSPORT) ASN1_SIMPLE(GOST_KEY_INFO, encrypted_key, ASN1_OCTET_STRING), ASN1_SIMPLE(GOST_KEY_INFO, imit, ASN1_OCTET_STRING) } ASN1_NDEF_SEQUENCE_END(GOST_KEY_INFO) - IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_INFO) - ASN1_NDEF_SEQUENCE(GOST_KEY_AGREEMENT_INFO) = +IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_INFO) +ASN1_NDEF_SEQUENCE(GOST_KEY_AGREEMENT_INFO) = { ASN1_SIMPLE(GOST_KEY_AGREEMENT_INFO, cipher, ASN1_OBJECT), ASN1_IMP_OPT(GOST_KEY_AGREEMENT_INFO, ephem_key, X509_PUBKEY, 0), ASN1_SIMPLE(GOST_KEY_AGREEMENT_INFO, eph_iv, ASN1_OCTET_STRING) } ASN1_NDEF_SEQUENCE_END(GOST_KEY_AGREEMENT_INFO) - IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_AGREEMENT_INFO) - ASN1_NDEF_SEQUENCE(GOST_KEY_PARAMS) = +IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_AGREEMENT_INFO) +ASN1_NDEF_SEQUENCE(GOST_KEY_PARAMS) = { ASN1_SIMPLE(GOST_KEY_PARAMS, key_params, ASN1_OBJECT), ASN1_SIMPLE(GOST_KEY_PARAMS, hash_params, ASN1_OBJECT), ASN1_OPT(GOST_KEY_PARAMS, cipher_params, ASN1_OBJECT),} ASN1_NDEF_SEQUENCE_END(GOST_KEY_PARAMS) - IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_PARAMS) - ASN1_NDEF_SEQUENCE(GOST_CIPHER_PARAMS) = +IMPLEMENT_ASN1_FUNCTIONS(GOST_KEY_PARAMS) +ASN1_NDEF_SEQUENCE(GOST_CIPHER_PARAMS) = { ASN1_SIMPLE(GOST_CIPHER_PARAMS, iv, ASN1_OCTET_STRING), ASN1_SIMPLE(GOST_CIPHER_PARAMS, enc_param_set, ASN1_OBJECT),} ASN1_NDEF_SEQUENCE_END(GOST_CIPHER_PARAMS) - IMPLEMENT_ASN1_FUNCTIONS(GOST_CIPHER_PARAMS) - ASN1_NDEF_SEQUENCE(GOST_CLIENT_KEY_EXCHANGE_PARAMS) = +IMPLEMENT_ASN1_FUNCTIONS(GOST_CIPHER_PARAMS) +ASN1_NDEF_SEQUENCE(GOST_CLIENT_KEY_EXCHANGE_PARAMS) = { /* FIXME incomplete */ ASN1_SIMPLE(GOST_CLIENT_KEY_EXCHANGE_PARAMS, gkt, GOST_KEY_TRANSPORT) } ASN1_NDEF_SEQUENCE_END(GOST_CLIENT_KEY_EXCHANGE_PARAMS) @@ -60,4 +60,4 @@ ASN1_NDEF_SEQUENCE_END(GOST_CIPHER_PARAMS) ASN1_SIMPLE(MASKED_GOST_KEY, masked_priv_key, ASN1_OCTET_STRING), ASN1_SIMPLE(MASKED_GOST_KEY, public_key, ASN1_OCTET_STRING) } ASN1_NDEF_SEQUENCE_END(MASKED_GOST_KEY) - IMPLEMENT_ASN1_FUNCTIONS(MASKED_GOST_KEY) +IMPLEMENT_ASN1_FUNCTIONS(MASKED_GOST_KEY) diff --git a/gost_lcl.h b/gost_lcl.h index a82362f..9dac7d4 100644 --- a/gost_lcl.h +++ b/gost_lcl.h @@ -205,10 +205,10 @@ extern struct gost_cipher_info gost_cipher_list[]; /* Find encryption params from ASN1_OBJECT */ const struct gost_cipher_info *get_encryption_params(ASN1_OBJECT *obj); /* Implementation of GOST 28147-89 cipher in CFB and CNT modes */ -const EVP_CIPHER* cipher_gost(); -const EVP_CIPHER* cipher_gost_cbc(); -const EVP_CIPHER* cipher_gost_cpacnt(); -const EVP_CIPHER* cipher_gost_cpcnt_12(); +const EVP_CIPHER *cipher_gost(); +const EVP_CIPHER *cipher_gost_cbc(); +const EVP_CIPHER *cipher_gost_cpacnt(); +const EVP_CIPHER *cipher_gost_cpcnt_12(); void cipher_gost_destroy(); # define EVP_MD_CTRL_KEY_LEN (EVP_MD_CTRL_ALG_CTRL+3) # define EVP_MD_CTRL_SET_KEY (EVP_MD_CTRL_ALG_CTRL+4) diff --git a/gost_md.c b/gost_md.c index 54a2fe5..5d2c537 100644 --- a/gost_md.c +++ b/gost_md.c @@ -30,7 +30,8 @@ EVP_MD *digest_gost(void) || !EVP_MD_meth_set_result_size(md, 32) || !EVP_MD_meth_set_input_blocksize(md, 32) || !EVP_MD_meth_set_app_datasize(md, - sizeof(struct ossl_gost_digest_ctx)) + sizeof(struct + ossl_gost_digest_ctx)) || !EVP_MD_meth_set_init(md, gost_digest_init) || !EVP_MD_meth_set_update(md, gost_digest_update) || !EVP_MD_meth_set_final(md, gost_digest_final) @@ -84,6 +85,7 @@ int gost_digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) int gost_digest_cleanup(EVP_MD_CTX *ctx) { if (EVP_MD_CTX_md_data(ctx)) - memset(EVP_MD_CTX_md_data(ctx), 0, sizeof(struct ossl_gost_digest_ctx)); + memset(EVP_MD_CTX_md_data(ctx), 0, + sizeof(struct ossl_gost_digest_ctx)); return 1; } diff --git a/gost_md2012.c b/gost_md2012.c index 52522ee..712e0ac 100644 --- a/gost_md2012.c +++ b/gost_md2012.c @@ -35,7 +35,8 @@ EVP_MD *digest_gost2012_256(void) if (_hidden_GostR3411_2012_256_md == NULL) { EVP_MD *md; - if ((md = EVP_MD_meth_new(NID_id_GostR3411_2012_256, NID_undef)) == NULL + if ((md = + EVP_MD_meth_new(NID_id_GostR3411_2012_256, NID_undef)) == NULL || !EVP_MD_meth_set_result_size(md, 32) || !EVP_MD_meth_set_input_blocksize(md, 64) || !EVP_MD_meth_set_app_datasize(md, sizeof(gost2012_hash_ctx)) @@ -64,7 +65,8 @@ EVP_MD *digest_gost2012_512(void) if (_hidden_GostR3411_2012_512_md == NULL) { EVP_MD *md; - if ((md = EVP_MD_meth_new(NID_id_GostR3411_2012_512, NID_undef)) == NULL + if ((md = + EVP_MD_meth_new(NID_id_GostR3411_2012_512, NID_undef)) == NULL || !EVP_MD_meth_set_result_size(md, 64) || !EVP_MD_meth_set_input_blocksize(md, 64) || !EVP_MD_meth_set_app_datasize(md, sizeof(gost2012_hash_ctx)) @@ -90,19 +92,22 @@ void digest_gost2012_512_destroy(void) static int gost_digest_init512(EVP_MD_CTX *ctx) { - init_gost2012_hash_ctx((gost2012_hash_ctx *) EVP_MD_CTX_md_data(ctx), 512); + init_gost2012_hash_ctx((gost2012_hash_ctx *) EVP_MD_CTX_md_data(ctx), + 512); return 1; } static int gost_digest_init256(EVP_MD_CTX *ctx) { - init_gost2012_hash_ctx((gost2012_hash_ctx *) EVP_MD_CTX_md_data(ctx), 256); + init_gost2012_hash_ctx((gost2012_hash_ctx *) EVP_MD_CTX_md_data(ctx), + 256); return 1; } static int gost_digest_update(EVP_MD_CTX *ctx, const void *data, size_t count) { - gost2012_hash_block((gost2012_hash_ctx *) EVP_MD_CTX_md_data(ctx), data, count); + gost2012_hash_block((gost2012_hash_ctx *) EVP_MD_CTX_md_data(ctx), data, + count); return 1; } @@ -115,7 +120,8 @@ static int gost_digest_final(EVP_MD_CTX *ctx, unsigned char *md) static int gost_digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) { if (EVP_MD_CTX_md_data(to) && EVP_MD_CTX_md_data(from)) - memcpy(EVP_MD_CTX_md_data(to), EVP_MD_CTX_md_data(from), sizeof(gost2012_hash_ctx)); + memcpy(EVP_MD_CTX_md_data(to), EVP_MD_CTX_md_data(from), + sizeof(gost2012_hash_ctx)); return 1; }