From: Dmitry Belyavskiy Date: Fri, 9 Oct 2015 17:47:06 +0000 (+0300) Subject: Let's search the default paramset and not hardcode its position X-Git-Tag: v1.1.0.2~40 X-Git-Url: http://www.wagner.pp.ru/gitweb/?p=openssl-gost%2Fengine.git;a=commitdiff_plain;h=ea10e1ad824f299198dddea313417004d8d1efad Let's search the default paramset and not hardcode its position --- diff --git a/gost_crypt.c b/gost_crypt.c index 52aad0a..3523b38 100644 --- a/gost_crypt.c +++ b/gost_crypt.c @@ -205,8 +205,13 @@ const struct gost_cipher_info *get_encryption_params(ASN1_OBJECT *obj) struct gost_cipher_info *param; if (!obj) { const char *params = get_gost_engine_param(GOST_PARAM_CRYPT_PARAMS); - if (!params || !strlen(params)) - return &gost_cipher_list[4]; + if (!params || !strlen(params)) { + int i; + for (i = 0; gost_cipher_list[i].nid != NID_undef; i++) + if (gost_cipher_list[i].nid == NID_id_tc26_gost_28147_param_Z) + return &gost_cipher_list[i]; + return &gost_cipher_list[0]; + } nid = OBJ_txt2nid(params); if (nid == NID_undef) {