Home | History | Annotate | Line # | Download | only in man3
      1  1.1  christos =pod
      2  1.1  christos 
      3  1.1  christos =head1 NAME
      4  1.1  christos 
      5  1.1  christos OSSL_ALGORITHM - OpenSSL Core type to define a fetchable algorithm
      6  1.1  christos 
      7  1.1  christos =head1 SYNOPSIS
      8  1.1  christos 
      9  1.1  christos  #include <openssl/core.h>
     10  1.1  christos 
     11  1.1  christos  typedef struct ossl_algorithm_st OSSL_ALGORITHM;
     12  1.1  christos  struct ossl_algorithm_st {
     13  1.1  christos      const char *algorithm_names;     /* key */
     14  1.1  christos      const char *property_definition; /* key */
     15  1.1  christos      const OSSL_DISPATCH *implementation;
     16  1.1  christos      const char *algorithm_description;
     17  1.1  christos  };
     18  1.1  christos 
     19  1.1  christos =head1 DESCRIPTION
     20  1.1  christos 
     21  1.1  christos The B<OSSL_ALGORITHM> type is a I<public structure> that describes an
     22  1.1  christos algorithm that a L<provider(7)> provides.  Arrays of this type are returned
     23  1.1  christos by providers on demand from the OpenSSL libraries to describe what
     24  1.1  christos algorithms the providers provide implementations of, and with what
     25  1.1  christos properties.
     26  1.1  christos 
     27  1.1  christos Arrays of this type must be terminated with a tuple where I<algorithm_names>
     28  1.1  christos is NULL.
     29  1.1  christos 
     30  1.1  christos This type of array is typically returned by the provider's operation querying
     31  1.1  christos function, further described in L<provider-base(7)/Provider Functions>.
     32  1.1  christos 
     33  1.1  christos =head2 B<OSSL_ALGORITHM> fields
     34  1.1  christos 
     35  1.1  christos =over 4
     36  1.1  christos 
     37  1.1  christos =item I<algorithm_names>
     38  1.1  christos 
     39  1.1  christos This string is a colon separated set of names / identities, and is used by
     40  1.1  christos the appropriate fetching functionality (such as L<EVP_CIPHER_fetch(3)>,
     41  1.1  christos L<EVP_MD_fetch(3)>, etc) to find the desired algorithm.
     42  1.1  christos 
     43  1.1  christos Multiple names / identities allow a specific algorithm implementation to be
     44  1.1  christos fetched multiple ways.  For example, the RSA algorithm has the following
     45  1.1  christos known identities:
     46  1.1  christos 
     47  1.1  christos =over 4
     48  1.1  christos 
     49  1.1  christos =item *
     50  1.1  christos 
     51  1.1  christos C<RSA>
     52  1.1  christos 
     53  1.1  christos =item *
     54  1.1  christos 
     55  1.1  christos C<rsaEncryption>
     56  1.1  christos 
     57  1.1  christos This is the name of the algorithm's OBJECT IDENTIFIER (OID), as given by the
     58  1.1  christos L<PKCS#1 RFC's ASN.1 module|https://www.rfc-editor.org/rfc/rfc8017#appendix-C>
     59  1.1  christos 
     60  1.1  christos =item *
     61  1.1  christos 
     62  1.1  christos C<1.2.840.113549.1.1.1>
     63  1.1  christos 
     64  1.1  christos This is the OID itself for C<rsaEncryption>, in canonical decimal text form.
     65  1.1  christos 
     66  1.1  christos =back
     67  1.1  christos 
     68  1.1  christos The resulting I<algorithm_names> string would look like this:
     69  1.1  christos 
     70  1.1  christos  "RSA:rsaEncryption:1.2.840.113549.1.1.1"
     71  1.1  christos 
     72  1.1  christos The OpenSSL libraries use the first of the algorithm names as the main
     73  1.1  christos or canonical name, on a per algorithm implementation basis.
     74  1.1  christos 
     75  1.1  christos See the notes L</On the subject of algorithm names> below for a more in
     76  1.1  christos depth discussion on I<algorithm_names> and how that may interact with
     77  1.1  christos applications and libraries, including OpenSSL's.
     78  1.1  christos 
     79  1.1  christos =item I<property_definition>
     80  1.1  christos 
     81  1.1  christos This string defines a set of properties associated with a particular
     82  1.1  christos algorithm implementation, and is used by the appropriate fetching
     83  1.1  christos functionality (such as L<EVP_CIPHER_fetch(3)>, L<EVP_MD_fetch(3)>, etc) for
     84  1.1  christos a finer grained lookup of an algorithm implementation, which is useful in
     85  1.1  christos case multiple implementations of the same algorithm are available.
     86  1.1  christos 
     87  1.1  christos See L<property(7)> for a further description of the contents of this
     88  1.1  christos string.
     89  1.1  christos 
     90  1.1  christos =item I<implementation>
     91  1.1  christos 
     92  1.1  christos Pointer to an L<OSSL_DISPATCH(3)> array, containing pointers to the
     93  1.1  christos functions of a particular algorithm implementation.
     94  1.1  christos 
     95  1.1  christos =item I<algorithm_description>
     96  1.1  christos 
     97  1.1  christos A string with a short human-readable description of the algorithm.
     98  1.1  christos 
     99  1.1  christos =back
    100  1.1  christos 
    101  1.1  christos =head1 NOTES
    102  1.1  christos 
    103  1.1  christos =head2 On the subject of algorithm names
    104  1.1  christos 
    105  1.1  christos Providers may find the need to register ASN.1 OIDs for algorithms using
    106  1.1  christos L<OBJ_create(3)> (via the B<core_obj_create> upcall described in
    107  1.1  christos L<provider-base(7)>, because some application or library -- possibly still
    108  1.1  christos the OpenSSL libraries, even -- use NIDs to look up algorithms.
    109  1.1  christos 
    110  1.1  christos In that scenario, you must make sure that the corresponding B<OSSL_ALGORITHM>'s
    111  1.1  christos I<algorithm_names> includes both the short and the long name.
    112  1.1  christos 
    113  1.1  christos Most of the time, registering ASN.1 OIDs like this shouldn't be necessary,
    114  1.1  christos and applications and libraries are encouraged to use L<OBJ_obj2txt(3)> to
    115  1.1  christos get a text representation of the OID, which may be a long or short name for
    116  1.1  christos OIDs that are registered, or the OID itself in canonical decimal text form
    117  1.1  christos if not (or if L<OBJ_obj2txt(3)> is called with I<no_name> = 1).
    118  1.1  christos 
    119  1.1  christos It's recommended to make sure that the corresponding B<OSSL_ALGORITHM>'s
    120  1.1  christos I<algorithm_names> include known names as well as the OID itself in
    121  1.1  christos canonical decimal text form.  That should cover all scenarios.
    122  1.1  christos 
    123  1.1  christos =begin comment RETURN VALUES doesn't make sense for a manual that only
    124  1.1  christos describes a type, but document checkers still want that section, and
    125  1.1  christos to have more than just the section title.
    126  1.1  christos 
    127  1.1  christos =head1 RETURN VALUES
    128  1.1  christos 
    129  1.1  christos txt
    130  1.1  christos 
    131  1.1  christos =end comment
    132  1.1  christos 
    133  1.1  christos =head1 SEE ALSO
    134  1.1  christos 
    135  1.1  christos L<crypto(7)>, L<provider-base(7)>, L<openssl-core.h(7)>,
    136  1.1  christos L<openssl-core_dispatch.h(7)>, L<OSSL_DISPATCH(3)>
    137  1.1  christos 
    138  1.1  christos =head1 HISTORY
    139  1.1  christos 
    140  1.1  christos B<OSSL_ALGORITHM> was added in OpenSSL 3.0
    141  1.1  christos 
    142  1.1  christos =head1 COPYRIGHT
    143  1.1  christos 
    144  1.1  christos Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.
    145  1.1  christos 
    146  1.1  christos Licensed under the Apache License 2.0 (the "License").  You may not use
    147  1.1  christos this file except in compliance with the License.  You can obtain a copy
    148  1.1  christos in the file LICENSE in the source distribution or at
    149  1.1  christos L<https://www.openssl.org/source/license.html>.
    150  1.1  christos 
    151  1.1  christos =cut
    152