Put the cipher info back into the "openssl engine" command.
[openssl.git] / apps / engine.c
index 537aefd131b5b3a886e8e4d2c0f174231f18a46b..e64ed53e95c231563d4dfcaed97d37bb72f06972 100644 (file)
@@ -94,7 +94,7 @@ static void identity(void *ptr)
        return;
        }
 
-static int append_buf(char **buf, char *s, int *size, int step)
+static int append_buf(char **buf, const char *s, int *size, int step)
        {
        int l = strlen(s);
 
@@ -430,6 +430,9 @@ skip_arg_loop:
                                {
                                int cap_size = 256;
                                char *cap_buf = NULL;
+                               int k,n;
+                               const int *nids;
+                               ENGINE_CIPHERS_PTR fn;
 
                                if (ENGINE_get_RSA(e) != NULL
                                        && !append_buf(&cap_buf, "RSA",
@@ -448,6 +451,16 @@ skip_arg_loop:
                                                &cap_size, 256))
                                        goto end;
 
+                               fn = ENGINE_get_ciphers(e);
+                               if(!fn) goto skip_ciphers;
+                               n = fn(e, NULL, &nids, 0);
+                               for(k=0 ; k < n ; ++k)
+                                       if(!append_buf(&cap_buf,
+                                                      OBJ_nid2sn(nids[k]),
+                                                      &cap_size, 256))
+                                               goto end;
+
+skip_ciphers:
                                if (cap_buf && (*cap_buf != '\0'))
                                        BIO_printf(bio_out, " [%s]", cap_buf);
 
@@ -486,5 +499,6 @@ end:
        sk_pop_free(pre_cmds, identity);
        sk_pop_free(post_cmds, identity);
        if (bio_out != NULL) BIO_free_all(bio_out);
+       apps_shutdown();
        EXIT(ret);
        }