]> wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
Let's search the default paramset and not hardcode its position
authorDmitry Belyavskiy <beldmit@gmail.com>
Fri, 9 Oct 2015 17:47:06 +0000 (20:47 +0300)
committerDmitry Belyavskiy <beldmit@gmail.com>
Fri, 9 Oct 2015 17:47:06 +0000 (20:47 +0300)
gost_crypt.c

index 52aad0a2a59d08eecd2190dc2811e530779374c9..3523b3873fa796d95854d98c6e8f8a19645a0e37 100644 (file)
@@ -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) {