2019-01-20 20:23:30 +08:00
|
|
|
=pod
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
openssl/core.h - OpenSSL Core types
|
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
#include <openssl/core.h>
|
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
2019-08-22 13:21:25 +08:00
|
|
|
The F<< <openssl/core.h> >> header defines a number of public types that
|
2019-01-20 20:23:30 +08:00
|
|
|
are used to communicate between the OpenSSL libraries and
|
|
|
|
implementation providers.
|
|
|
|
These types are designed to minimise the need for intimate knowledge
|
|
|
|
of internal structures between the OpenSSL libraries and the providers.
|
|
|
|
|
|
|
|
The types are:
|
|
|
|
|
|
|
|
=over 4
|
|
|
|
|
2019-09-27 19:26:22 +08:00
|
|
|
=item B<OSSL_DISPATCH>
|
2019-01-20 20:23:30 +08:00
|
|
|
|
|
|
|
This type is a tuple of function identity and function pointer.
|
|
|
|
Arrays of this type are passed between the OpenSSL libraries and the
|
|
|
|
providers to describe what functionality one side provides to the
|
|
|
|
other.
|
|
|
|
Arrays of this type must be terminated with a tuple having function
|
2019-09-27 19:26:22 +08:00
|
|
|
identity zero and function pointer NULL.
|
2019-01-20 20:23:30 +08:00
|
|
|
|
|
|
|
The available function identities and corresponding function
|
2020-06-21 07:21:19 +08:00
|
|
|
signatures are defined in L<openssl-core_dispatch.h(7)>.
|
2019-01-20 20:23:30 +08:00
|
|
|
|
|
|
|
Any function identity not recognised by the recipient of this type
|
|
|
|
will be ignored.
|
|
|
|
This ensures that providers built with one OpenSSL version in mind
|
|
|
|
will work together with any other OpenSSL version that supports this
|
|
|
|
mechanism.
|
|
|
|
|
2019-09-27 19:26:22 +08:00
|
|
|
=item B<OSSL_ITEM>
|
2019-01-20 20:23:30 +08:00
|
|
|
|
|
|
|
This type is a tuple of integer and pointer.
|
|
|
|
It's a generic type used as a generic descriptor, its exact meaning
|
|
|
|
being defined by how it's used.
|
|
|
|
Arrays of this type are passed between the OpenSSL libraries and the
|
|
|
|
providers, and must be terminated with a tuple where the integer is
|
2019-09-27 19:26:22 +08:00
|
|
|
zero and the pointer NULL.
|
2019-01-20 20:23:30 +08:00
|
|
|
|
2019-09-27 19:26:22 +08:00
|
|
|
=item B<OSSL_ALGORITHM>
|
2019-01-20 20:23:30 +08:00
|
|
|
|
|
|
|
This type is a tuple of an algorithm name (string), a property
|
2019-09-27 19:26:22 +08:00
|
|
|
definition (string) and a dispatch table (array of B<OSSL_DISPATCH>).
|
2019-01-20 20:23:30 +08:00
|
|
|
Arrays of this type are passed on demand from the providers to the
|
|
|
|
OpenSSL libraries to describe what algorithms the providers provide
|
|
|
|
implementations of, and with what properties.
|
|
|
|
Arrays of this type must be terminated with a tuple having function
|
2019-09-27 19:26:22 +08:00
|
|
|
identity zero and function pointer NULL.
|
2019-01-20 20:23:30 +08:00
|
|
|
|
|
|
|
The algorithm names and property definitions are defined by the
|
|
|
|
providers.
|
|
|
|
|
2021-04-16 22:22:03 +08:00
|
|
|
The OpenSSL libraries use the first of the algorithm names as the main
|
|
|
|
or canonical name, on a per algorithm implementation basis.
|
|
|
|
|
2019-09-27 19:26:22 +08:00
|
|
|
=item B<OSSL_PARAM>
|
2019-01-20 20:23:30 +08:00
|
|
|
|
|
|
|
This type is a structure that allows passing arbitrary object data
|
|
|
|
between two parties that have no or very little shared knowledge about
|
|
|
|
their respective internal structures for that object.
|
|
|
|
It's normally passed in arrays, where the array is terminated with an
|
2019-09-27 19:26:22 +08:00
|
|
|
element where all fields are zero (for non-pointers) or NULL (for
|
2019-01-20 20:23:30 +08:00
|
|
|
pointers).
|
|
|
|
|
2019-07-11 18:18:42 +08:00
|
|
|
These arrays can be used to set parameters for some object, to request
|
|
|
|
parameters, and to describe parameters.
|
2019-01-20 20:23:30 +08:00
|
|
|
|
2019-09-27 19:26:22 +08:00
|
|
|
B<OSSL_PARAM> is further described in L<OSSL_PARAM(3)>
|
2019-01-20 20:23:30 +08:00
|
|
|
|
2019-11-12 01:38:57 +08:00
|
|
|
=item B<OSSL_CALLBACK>
|
|
|
|
|
SERIALIZER: New API for serialization of objects through providers
Serialization is needed to be able to take a provider object (such as
the provider side key data) and output it in PEM form, DER form, text
form (for display), and possibly other future forms (XML? JSON? JWK?)
The idea is that a serializer should be able to handle objects it has
intimate knowledge of, as well as object data in OSSL_PARAM form. The
latter will allow libcrypto to serialize some object with a different
provider than the one holding the data, if exporting of that data is
allowed and there is a serializer that can handle it.
We will provide serializers for the types of objects we know about,
which should be useful together with any other provider that provides
implementations of the same type of object.
Serializers are selected by method name and a couple of additional
properties:
- format used to tell what format the output should be in.
Possibilities could include "format=text",
"format=pem", "format=der", "format=pem-pkcs1"
(traditional), "format=der-pkcs1" (traditional)
- type used to tell exactly what type of data should be
output, for example "type=public" (the public part of
a key), "type=private" (the private part of a key),
"type=domainparams" (domain parameters).
This also adds a passphrase callback function type,
OSSL_PASSPHRASE_CALLBACK, which is a bit like OSSL_CALLBACK, but it
takes a few extra arguments to place the result in.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10394)
2019-11-18 08:29:06 +08:00
|
|
|
This is a function type for a generic feedback callback function:
|
2019-11-12 01:38:57 +08:00
|
|
|
|
|
|
|
typedef int (OSSL_CALLBACK)(const OSSL_PARAM params[], void *arg);
|
|
|
|
|
|
|
|
A function that takes a pointer of this type should also take a
|
|
|
|
pointer to caller data. When calling this callback, the function is
|
|
|
|
expected to build an B<OSSL_PARAM> array of data it wants or is
|
|
|
|
expected to pass back, and pass that as I<params>, as well as
|
|
|
|
the caller data pointer it received, as I<arg>.
|
|
|
|
|
SERIALIZER: New API for serialization of objects through providers
Serialization is needed to be able to take a provider object (such as
the provider side key data) and output it in PEM form, DER form, text
form (for display), and possibly other future forms (XML? JSON? JWK?)
The idea is that a serializer should be able to handle objects it has
intimate knowledge of, as well as object data in OSSL_PARAM form. The
latter will allow libcrypto to serialize some object with a different
provider than the one holding the data, if exporting of that data is
allowed and there is a serializer that can handle it.
We will provide serializers for the types of objects we know about,
which should be useful together with any other provider that provides
implementations of the same type of object.
Serializers are selected by method name and a couple of additional
properties:
- format used to tell what format the output should be in.
Possibilities could include "format=text",
"format=pem", "format=der", "format=pem-pkcs1"
(traditional), "format=der-pkcs1" (traditional)
- type used to tell exactly what type of data should be
output, for example "type=public" (the public part of
a key), "type=private" (the private part of a key),
"type=domainparams" (domain parameters).
This also adds a passphrase callback function type,
OSSL_PASSPHRASE_CALLBACK, which is a bit like OSSL_CALLBACK, but it
takes a few extra arguments to place the result in.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10394)
2019-11-18 08:29:06 +08:00
|
|
|
=item B<OSSL_PASSPHRASE_CALLBACK>
|
|
|
|
|
|
|
|
This is a function type for a generic pass phrase callback function:
|
|
|
|
|
|
|
|
typedef int (OSSL_PASSPHRASE_CALLBACK)(char *pass, size_t pass_size,
|
|
|
|
size_t *pass_len,
|
|
|
|
const OSSL_PARAM params[],
|
|
|
|
void *arg);
|
|
|
|
|
|
|
|
This callback can be used to prompt the user for a passphrase. When
|
|
|
|
calling it, a buffer to store the pass phrase needs to be given with
|
|
|
|
I<pass>, and its size with I<pass_size>. The length of the prompted
|
|
|
|
pass phrase will be given back in I<*pass_len>.
|
|
|
|
|
|
|
|
Additional parameters can be passed with the B<OSSL_PARAM> array
|
|
|
|
I<params>.
|
|
|
|
|
|
|
|
A function that takes a pointer of this type should also take a
|
|
|
|
pointer to caller data, which should be passed as I<arg> to this
|
|
|
|
callback.
|
|
|
|
|
2019-01-20 20:23:30 +08:00
|
|
|
=back
|
|
|
|
|
|
|
|
=head1 SEE ALSO
|
|
|
|
|
2020-06-21 07:21:19 +08:00
|
|
|
L<openssl-core_dispatch.h(7)>
|
2019-01-20 20:23:30 +08:00
|
|
|
|
|
|
|
=head1 HISTORY
|
|
|
|
|
|
|
|
The types described here were added in OpenSSL 3.0.
|
|
|
|
|
|
|
|
=head1 COPYRIGHT
|
|
|
|
|
2021-05-06 20:03:23 +08:00
|
|
|
Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
|
2019-01-20 20:23:30 +08:00
|
|
|
|
|
|
|
Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
|
|
this file except in compliance with the License. You can obtain a copy
|
|
|
|
in the file LICENSE in the source distribution or at
|
|
|
|
L<https://www.openssl.org/source/license.html>.
|
|
|
|
|
|
|
|
=cut
|