Commit e1631f51 authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Add list -public-key-methods

parent 48ed9c23
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@
static LHASH_OF(FUNCTION) *prog_init(void);
static int do_cmd(LHASH_OF(FUNCTION) *prog, int argc, char *argv[]);
static void list_pkey(void);
static void list_pkey_meth(void);
static void list_type(FUNC_TYPE ft);
static void list_disabled(void);
char *default_config_file = NULL;
@@ -308,7 +309,7 @@ typedef enum HELPLIST_CHOICE {
    OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
    OPT_COMMANDS, OPT_DIGEST_COMMANDS,
    OPT_DIGEST_ALGORITHMS, OPT_CIPHER_COMMANDS, OPT_CIPHER_ALGORITHMS,
    OPT_PK_ALGORITHMS, OPT_DISABLED, OPT_MISSING_HELP
    OPT_PK_ALGORITHMS, OPT_PK_METHOD, OPT_DISABLED, OPT_MISSING_HELP
} HELPLIST_CHOICE;

const OPTIONS list_options[] = {
@@ -323,6 +324,8 @@ const OPTIONS list_options[] = {
     "List of cipher algorithms"},
    {"public-key-algorithms", OPT_PK_ALGORITHMS, '-',
     "List of public key algorithms"},
    {"public-key-methods", OPT_PK_METHOD, '-',
     "List of public key methods"},
    {"disabled", OPT_DISABLED, '-',
     "List of disabled features"},
    {"missing-help", OPT_MISSING_HELP, '-',
@@ -364,6 +367,9 @@ int list_main(int argc, char **argv)
        case OPT_PK_ALGORITHMS:
            list_pkey();
            break;
        case OPT_PK_METHOD:
            list_pkey_meth();
            break;
        case OPT_DISABLED:
            list_disabled();
            break;
@@ -540,6 +546,22 @@ static void list_pkey(void)
    }
}

static void list_pkey_meth(void)
{
    size_t i;
    size_t meth_count = EVP_PKEY_meth_get_count();

    for (i = 0; i < meth_count; i++) {
        const EVP_PKEY_METHOD *pmeth = EVP_PKEY_meth_get0(i);
        int pkey_id, pkey_flags;

        EVP_PKEY_meth_get0_info(&pkey_id, &pkey_flags, pmeth);
        BIO_printf(bio_out, "%s\n", OBJ_nid2ln(pkey_id));
        BIO_printf(bio_out, "\tType: %s Algorithm\n",
                   pkey_flags & ASN1_PKEY_DYNAMIC ?  "External" : "Builtin");
    }
}

static int function_cmp(const FUNCTION * a, const FUNCTION * b)
{
    return strncmp(a->name, b->name, 8);
+6 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ B<openssl list>
[B<-cipher-commands>]
[B<-cipher-algorithms>]
[B<-public-key-algorithms>]
[B<-public-key-methods>]
[B<-disabled>]

=head1 DESCRIPTION
@@ -62,6 +63,11 @@ then B<foo> is an alias for the official algorithm name, B<bar>.
Display a list of public key algorithms, with each algorithm as
a block of multiple lines, all but the first are indented.

=item B<-public-key-methods>

Display a list of public key method OIDs: this also includes public key methods
without an associated ASN.1 method, for example, KDF algorithms.

=item B<-disabled>

Display a list of disabled features, those that were compiled out