From ea10e1ad824f299198dddea313417004d8d1efad Mon Sep 17 00:00:00 2001 From: Dmitry Belyavskiy Date: Fri, 9 Oct 2015 20:47:06 +0300 Subject: [PATCH] Let's search the default paramset and not hardcode its position --- gost_crypt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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) { -- 2.39.2