2019-07-24 22:24:01 +08:00
|
|
|
=pod
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
|
|
|
provider-digest - The digest library E<lt>-E<gt> provider functions
|
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
2019-09-29 23:10:59 +08:00
|
|
|
=for openssl multiple includes
|
2019-07-24 22:24:01 +08:00
|
|
|
|
2020-06-21 07:21:19 +08:00
|
|
|
#include <openssl/core_dispatch.h>
|
2019-07-24 22:24:01 +08:00
|
|
|
#include <openssl/core_names.h>
|
|
|
|
|
|
|
|
/*
|
2019-08-20 07:07:12 +08:00
|
|
|
* Digests support the following function signatures in OSSL_DISPATCH arrays.
|
|
|
|
* (The function signatures are not actual functions).
|
2019-07-24 22:24:01 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* Context management */
|
2020-06-21 07:19:16 +08:00
|
|
|
void *OSSL_FUNC_digest_newctx(void *provctx);
|
|
|
|
void OSSL_FUNC_digest_freectx(void *dctx);
|
|
|
|
void *OSSL_FUNC_digest_dupctx(void *dctx);
|
2024-10-26 17:10:38 +08:00
|
|
|
void OSSL_FUNC_digest_copyctx(void *voutctx, void *vinctx);
|
2019-07-24 22:24:01 +08:00
|
|
|
|
|
|
|
/* Digest generation */
|
2021-03-03 09:26:51 +08:00
|
|
|
int OSSL_FUNC_digest_init(void *dctx, const OSSL_PARAM params[]);
|
2020-06-21 07:19:16 +08:00
|
|
|
int OSSL_FUNC_digest_update(void *dctx, const unsigned char *in, size_t inl);
|
|
|
|
int OSSL_FUNC_digest_final(void *dctx, unsigned char *out, size_t *outl,
|
|
|
|
size_t outsz);
|
|
|
|
int OSSL_FUNC_digest_digest(void *provctx, const unsigned char *in, size_t inl,
|
|
|
|
unsigned char *out, size_t *outl, size_t outsz);
|
2019-07-24 22:24:01 +08:00
|
|
|
|
Add missing EVP param utility functions
These functions were missing for a completes API:
EVP_MD_get_params(), EVP_CIPHER_get_params(), EVP_CIPHER_CTX_set_params(),
and EVP_CIPHER_CTX_get_params
Additionally, we also add all the corresponding parameter descriptor
returning functions, along the correspoding provider dispatches:
EVP_MD_gettable_params(), EVP_MD_CTX_settable_params(),
EVP_MD_CTX_gettable_params(), EVP_CIPHER_gettable_params(),
EVP_CIPHER_CTX_settable_params(), and EVP_CIPHER_CTX_gettable_params()
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9576)
2019-08-12 20:56:18 +08:00
|
|
|
/* Digest parameter descriptors */
|
2020-08-05 11:24:04 +08:00
|
|
|
const OSSL_PARAM *OSSL_FUNC_digest_gettable_params(void *provctx);
|
Add missing EVP param utility functions
These functions were missing for a completes API:
EVP_MD_get_params(), EVP_CIPHER_get_params(), EVP_CIPHER_CTX_set_params(),
and EVP_CIPHER_CTX_get_params
Additionally, we also add all the corresponding parameter descriptor
returning functions, along the correspoding provider dispatches:
EVP_MD_gettable_params(), EVP_MD_CTX_settable_params(),
EVP_MD_CTX_gettable_params(), EVP_CIPHER_gettable_params(),
EVP_CIPHER_CTX_settable_params(), and EVP_CIPHER_CTX_gettable_params()
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9576)
2019-08-12 20:56:18 +08:00
|
|
|
|
|
|
|
/* Digest operation parameter descriptors */
|
2021-02-22 10:07:15 +08:00
|
|
|
const OSSL_PARAM *OSSL_FUNC_digest_gettable_ctx_params(void *dctx,
|
|
|
|
void *provctx);
|
|
|
|
const OSSL_PARAM *OSSL_FUNC_digest_settable_ctx_params(void *dctx,
|
|
|
|
void *provctx);
|
Add missing EVP param utility functions
These functions were missing for a completes API:
EVP_MD_get_params(), EVP_CIPHER_get_params(), EVP_CIPHER_CTX_set_params(),
and EVP_CIPHER_CTX_get_params
Additionally, we also add all the corresponding parameter descriptor
returning functions, along the correspoding provider dispatches:
EVP_MD_gettable_params(), EVP_MD_CTX_settable_params(),
EVP_MD_CTX_gettable_params(), EVP_CIPHER_gettable_params(),
EVP_CIPHER_CTX_settable_params(), and EVP_CIPHER_CTX_gettable_params()
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9576)
2019-08-12 20:56:18 +08:00
|
|
|
|
2019-07-24 22:24:01 +08:00
|
|
|
/* Digest parameters */
|
2020-06-21 07:19:16 +08:00
|
|
|
int OSSL_FUNC_digest_get_params(OSSL_PARAM params[]);
|
2019-07-16 11:59:50 +08:00
|
|
|
|
Add missing EVP param utility functions
These functions were missing for a completes API:
EVP_MD_get_params(), EVP_CIPHER_get_params(), EVP_CIPHER_CTX_set_params(),
and EVP_CIPHER_CTX_get_params
Additionally, we also add all the corresponding parameter descriptor
returning functions, along the correspoding provider dispatches:
EVP_MD_gettable_params(), EVP_MD_CTX_settable_params(),
EVP_MD_CTX_gettable_params(), EVP_CIPHER_gettable_params(),
EVP_CIPHER_CTX_settable_params(), and EVP_CIPHER_CTX_gettable_params()
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9576)
2019-08-12 20:56:18 +08:00
|
|
|
/* Digest operation parameters */
|
2020-06-21 07:19:16 +08:00
|
|
|
int OSSL_FUNC_digest_set_ctx_params(void *dctx, const OSSL_PARAM params[]);
|
|
|
|
int OSSL_FUNC_digest_get_ctx_params(void *dctx, OSSL_PARAM params[]);
|
2019-07-24 22:24:01 +08:00
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
|
|
|
This documentation is primarily aimed at provider authors. See L<provider(7)>
|
|
|
|
for further information.
|
|
|
|
|
|
|
|
The DIGEST operation enables providers to implement digest algorithms and make
|
|
|
|
them available to applications via the API functions L<EVP_DigestInit_ex(3)>,
|
|
|
|
L<EVP_DigestUpdate(3)> and L<EVP_DigestFinal(3)> (and other related functions).
|
|
|
|
|
|
|
|
All "functions" mentioned here are passed as function pointers between
|
2022-12-05 23:59:06 +08:00
|
|
|
F<libcrypto> and the provider in L<OSSL_DISPATCH(3)> arrays via
|
|
|
|
L<OSSL_ALGORITHM(3)> arrays that are returned by the provider's
|
2019-07-24 22:24:01 +08:00
|
|
|
provider_query_operation() function
|
|
|
|
(see L<provider-base(7)/Provider Functions>).
|
|
|
|
|
|
|
|
All these "functions" have a corresponding function type definition
|
2021-03-31 19:22:25 +08:00
|
|
|
named B<OSSL_FUNC_{name}_fn>, and a helper function to retrieve the
|
2022-12-05 23:59:06 +08:00
|
|
|
function pointer from an L<OSSL_DISPATCH(3)> element named
|
2020-06-21 07:19:16 +08:00
|
|
|
B<OSSL_FUNC_{name}>.
|
|
|
|
For example, the "function" OSSL_FUNC_digest_newctx() has these:
|
2019-07-24 22:24:01 +08:00
|
|
|
|
2022-04-06 22:20:47 +08:00
|
|
|
typedef void *(OSSL_FUNC_digest_newctx_fn)(void *provctx);
|
|
|
|
static ossl_inline OSSL_FUNC_digest_newctx_fn
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_newctx(const OSSL_DISPATCH *opf);
|
2019-07-24 22:24:01 +08:00
|
|
|
|
2022-12-05 23:59:06 +08:00
|
|
|
L<OSSL_DISPATCH(3)> arrays are indexed by numbers that are provided as
|
2020-06-21 07:21:19 +08:00
|
|
|
macros in L<openssl-core_dispatch.h(7)>, as follows:
|
2019-07-24 22:24:01 +08:00
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_newctx OSSL_FUNC_DIGEST_NEWCTX
|
|
|
|
OSSL_FUNC_digest_freectx OSSL_FUNC_DIGEST_FREECTX
|
|
|
|
OSSL_FUNC_digest_dupctx OSSL_FUNC_DIGEST_DUPCTX
|
2024-10-26 17:10:38 +08:00
|
|
|
OSSL_FUNC_digest_copyctx OSSL_FUNC_DIGEST_COPYCTX
|
2019-07-24 22:24:01 +08:00
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_init OSSL_FUNC_DIGEST_INIT
|
|
|
|
OSSL_FUNC_digest_update OSSL_FUNC_DIGEST_UPDATE
|
|
|
|
OSSL_FUNC_digest_final OSSL_FUNC_DIGEST_FINAL
|
|
|
|
OSSL_FUNC_digest_digest OSSL_FUNC_DIGEST_DIGEST
|
2019-07-24 22:24:01 +08:00
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_get_params OSSL_FUNC_DIGEST_GET_PARAMS
|
|
|
|
OSSL_FUNC_digest_get_ctx_params OSSL_FUNC_DIGEST_GET_CTX_PARAMS
|
|
|
|
OSSL_FUNC_digest_set_ctx_params OSSL_FUNC_DIGEST_SET_CTX_PARAMS
|
Add missing EVP param utility functions
These functions were missing for a completes API:
EVP_MD_get_params(), EVP_CIPHER_get_params(), EVP_CIPHER_CTX_set_params(),
and EVP_CIPHER_CTX_get_params
Additionally, we also add all the corresponding parameter descriptor
returning functions, along the correspoding provider dispatches:
EVP_MD_gettable_params(), EVP_MD_CTX_settable_params(),
EVP_MD_CTX_gettable_params(), EVP_CIPHER_gettable_params(),
EVP_CIPHER_CTX_settable_params(), and EVP_CIPHER_CTX_gettable_params()
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9576)
2019-08-12 20:56:18 +08:00
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_gettable_params OSSL_FUNC_DIGEST_GETTABLE_PARAMS
|
|
|
|
OSSL_FUNC_digest_gettable_ctx_params OSSL_FUNC_DIGEST_GETTABLE_CTX_PARAMS
|
|
|
|
OSSL_FUNC_digest_settable_ctx_params OSSL_FUNC_DIGEST_SETTABLE_CTX_PARAMS
|
2019-07-24 22:24:01 +08:00
|
|
|
|
|
|
|
A digest algorithm implementation may not implement all of these functions.
|
2020-06-21 07:19:16 +08:00
|
|
|
In order to be usable all or none of OSSL_FUNC_digest_newctx, OSSL_FUNC_digest_freectx,
|
|
|
|
OSSL_FUNC_digest_init, OSSL_FUNC_digest_update and OSSL_FUNC_digest_final should be implemented.
|
2019-07-24 22:24:01 +08:00
|
|
|
All other functions are optional.
|
|
|
|
|
|
|
|
=head2 Context Management Functions
|
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_newctx() should create and return a pointer to a provider side
|
2019-07-24 22:24:01 +08:00
|
|
|
structure for holding context information during a digest operation.
|
|
|
|
A pointer to this context will be passed back in a number of the other digest
|
|
|
|
operation function calls.
|
2019-09-27 19:26:22 +08:00
|
|
|
The parameter I<provctx> is the provider context generated during provider
|
2019-08-22 13:21:25 +08:00
|
|
|
initialisation (see L<provider(7)>).
|
2019-07-24 22:24:01 +08:00
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_freectx() is passed a pointer to the provider side digest context in
|
2019-09-27 19:26:22 +08:00
|
|
|
the I<dctx> parameter.
|
2019-07-24 22:24:01 +08:00
|
|
|
This function should free any resources associated with that context.
|
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_dupctx() should duplicate the provider side digest context in the
|
2019-09-27 19:26:22 +08:00
|
|
|
I<dctx> parameter and return the duplicate copy.
|
2019-07-24 22:24:01 +08:00
|
|
|
|
2024-10-26 17:10:38 +08:00
|
|
|
OSSL_FUNC_digest_copyctx() should copy the provider side digest context in the
|
|
|
|
I<vinctx> parameter to the I<voutctx> parameter which is the another provider side
|
|
|
|
context.
|
|
|
|
The OSSL_FUNC_digest_copyctx function is used in the EVP_MD_CTX_copy_ex function to
|
|
|
|
speed up HMAC operations in the PBKDF2.
|
|
|
|
This function is optional, and dupctx will be used if there is no EVP_MD_CTX_copy_ex
|
|
|
|
function.
|
|
|
|
|
2019-07-24 22:24:01 +08:00
|
|
|
=head2 Digest Generation Functions
|
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_init() initialises a digest operation given a newly created
|
2019-09-27 19:26:22 +08:00
|
|
|
provider side digest context in the I<dctx> parameter.
|
2021-03-03 09:26:51 +08:00
|
|
|
The I<params>, if not NULL, should be set on the context in a manner similar to
|
|
|
|
using OSSL_FUNC_digest_set_ctx_params().
|
2019-07-24 22:24:01 +08:00
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_update() is called to supply data to be digested as part of a
|
2019-07-24 22:24:01 +08:00
|
|
|
previously initialised digest operation.
|
2019-09-27 19:26:22 +08:00
|
|
|
The I<dctx> parameter contains a pointer to a previously initialised provider
|
2019-07-24 22:24:01 +08:00
|
|
|
side context.
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_update() should digest I<inl> bytes of data at the location pointed to
|
2019-09-27 19:26:22 +08:00
|
|
|
by I<in>.
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_update() may be called multiple times for a single digest operation.
|
2019-07-24 22:24:01 +08:00
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_final() generates a digest started through previous OSSL_FUNC_digest_init()
|
|
|
|
and OSSL_FUNC_digest_update() calls.
|
2019-09-27 19:26:22 +08:00
|
|
|
The I<dctx> parameter contains a pointer to the provider side context.
|
|
|
|
The digest should be written to I<*out> and the length of the digest to
|
|
|
|
I<*outl>.
|
|
|
|
The digest should not exceed I<outsz> bytes.
|
2019-07-24 22:24:01 +08:00
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_digest() is a "oneshot" digest function.
|
2019-07-24 22:24:01 +08:00
|
|
|
No provider side digest context is used.
|
|
|
|
Instead the provider context that was created during provider initialisation is
|
2019-08-22 13:21:25 +08:00
|
|
|
passed in the I<provctx> parameter (see L<provider(7)>).
|
2019-09-27 19:26:22 +08:00
|
|
|
I<inl> bytes at I<in> should be digested and the result should be stored at
|
|
|
|
I<out>. The length of the digest should be stored in I<*outl> which should not
|
|
|
|
exceed I<outsz> bytes.
|
2019-07-24 22:24:01 +08:00
|
|
|
|
|
|
|
=head2 Digest Parameters
|
|
|
|
|
Add missing EVP param utility functions
These functions were missing for a completes API:
EVP_MD_get_params(), EVP_CIPHER_get_params(), EVP_CIPHER_CTX_set_params(),
and EVP_CIPHER_CTX_get_params
Additionally, we also add all the corresponding parameter descriptor
returning functions, along the correspoding provider dispatches:
EVP_MD_gettable_params(), EVP_MD_CTX_settable_params(),
EVP_MD_CTX_gettable_params(), EVP_CIPHER_gettable_params(),
EVP_CIPHER_CTX_settable_params(), and EVP_CIPHER_CTX_gettable_params()
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9576)
2019-08-12 20:56:18 +08:00
|
|
|
See L<OSSL_PARAM(3)> for further details on the parameters structure used by
|
|
|
|
these functions.
|
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_get_params() gets details of the algorithm implementation
|
2019-09-27 19:26:22 +08:00
|
|
|
and stores them in I<params>.
|
Add missing EVP param utility functions
These functions were missing for a completes API:
EVP_MD_get_params(), EVP_CIPHER_get_params(), EVP_CIPHER_CTX_set_params(),
and EVP_CIPHER_CTX_get_params
Additionally, we also add all the corresponding parameter descriptor
returning functions, along the correspoding provider dispatches:
EVP_MD_gettable_params(), EVP_MD_CTX_settable_params(),
EVP_MD_CTX_gettable_params(), EVP_CIPHER_gettable_params(),
EVP_CIPHER_CTX_settable_params(), and EVP_CIPHER_CTX_gettable_params()
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9576)
2019-08-12 20:56:18 +08:00
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_set_ctx_params() sets digest operation parameters for the
|
2019-09-27 19:26:22 +08:00
|
|
|
provider side digest context I<dctx> to I<params>.
|
Add missing EVP param utility functions
These functions were missing for a completes API:
EVP_MD_get_params(), EVP_CIPHER_get_params(), EVP_CIPHER_CTX_set_params(),
and EVP_CIPHER_CTX_get_params
Additionally, we also add all the corresponding parameter descriptor
returning functions, along the correspoding provider dispatches:
EVP_MD_gettable_params(), EVP_MD_CTX_settable_params(),
EVP_MD_CTX_gettable_params(), EVP_CIPHER_gettable_params(),
EVP_CIPHER_CTX_settable_params(), and EVP_CIPHER_CTX_gettable_params()
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9576)
2019-08-12 20:56:18 +08:00
|
|
|
Any parameter settings are additional to any that were previously set.
|
2021-03-03 09:32:39 +08:00
|
|
|
Passing NULL for I<params> should return true.
|
Add missing EVP param utility functions
These functions were missing for a completes API:
EVP_MD_get_params(), EVP_CIPHER_get_params(), EVP_CIPHER_CTX_set_params(),
and EVP_CIPHER_CTX_get_params
Additionally, we also add all the corresponding parameter descriptor
returning functions, along the correspoding provider dispatches:
EVP_MD_gettable_params(), EVP_MD_CTX_settable_params(),
EVP_MD_CTX_gettable_params(), EVP_CIPHER_gettable_params(),
EVP_CIPHER_CTX_settable_params(), and EVP_CIPHER_CTX_gettable_params()
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9576)
2019-08-12 20:56:18 +08:00
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_get_ctx_params() gets digest operation details details from
|
2019-09-27 19:26:22 +08:00
|
|
|
the given provider side digest context I<dctx> and stores them in I<params>.
|
2021-03-03 09:32:39 +08:00
|
|
|
Passing NULL for I<params> should return true.
|
Add missing EVP param utility functions
These functions were missing for a completes API:
EVP_MD_get_params(), EVP_CIPHER_get_params(), EVP_CIPHER_CTX_set_params(),
and EVP_CIPHER_CTX_get_params
Additionally, we also add all the corresponding parameter descriptor
returning functions, along the correspoding provider dispatches:
EVP_MD_gettable_params(), EVP_MD_CTX_settable_params(),
EVP_MD_CTX_gettable_params(), EVP_CIPHER_gettable_params(),
EVP_CIPHER_CTX_settable_params(), and EVP_CIPHER_CTX_gettable_params()
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9576)
2019-08-12 20:56:18 +08:00
|
|
|
|
2022-12-05 23:59:06 +08:00
|
|
|
OSSL_FUNC_digest_gettable_params() returns a constant L<OSSL_PARAM(3)> array
|
2021-02-22 10:07:15 +08:00
|
|
|
containing descriptors of the parameters that OSSL_FUNC_digest_get_params()
|
|
|
|
can handle.
|
|
|
|
|
|
|
|
OSSL_FUNC_digest_gettable_ctx_params() and
|
|
|
|
OSSL_FUNC_digest_settable_ctx_params() both return constant
|
2022-12-05 23:59:06 +08:00
|
|
|
L<OSSL_PARAM(3)> arrays as descriptors of the parameters that
|
2021-02-22 10:07:15 +08:00
|
|
|
OSSL_FUNC_digest_get_ctx_params() and OSSL_FUNC_digest_set_ctx_params()
|
|
|
|
can handle, respectively. The array is based on the current state of
|
|
|
|
the provider side context if I<dctx> is not NULL and on the provider
|
|
|
|
side algorithm I<provctx> otherwise.
|
2019-07-16 11:59:50 +08:00
|
|
|
|
|
|
|
Parameters currently recognised by built-in digests with this function
|
2019-08-20 07:07:12 +08:00
|
|
|
are as follows. Not all parameters are relevant to, or are understood
|
2019-07-16 11:59:50 +08:00
|
|
|
by all digests:
|
|
|
|
|
|
|
|
=over 4
|
|
|
|
|
2019-09-10 16:05:57 +08:00
|
|
|
=item "blocksize" (B<OSSL_DIGEST_PARAM_BLOCK_SIZE>) <unsigned integer>
|
2019-07-16 11:59:50 +08:00
|
|
|
|
|
|
|
The digest block size.
|
2019-09-26 10:14:00 +08:00
|
|
|
The length of the "blocksize" parameter should not exceed that of a B<size_t>.
|
2019-07-16 11:59:50 +08:00
|
|
|
|
2019-09-10 16:05:57 +08:00
|
|
|
=item "size" (B<OSSL_DIGEST_PARAM_SIZE>) <unsigned integer>
|
2019-07-16 11:59:50 +08:00
|
|
|
|
|
|
|
The digest output size.
|
2019-09-26 10:14:00 +08:00
|
|
|
The length of the "size" parameter should not exceed that of a B<size_t>.
|
2019-07-16 11:59:50 +08:00
|
|
|
|
2019-09-10 16:05:57 +08:00
|
|
|
=item "flags" (B<OSSL_DIGEST_PARAM_FLAGS>) <unsigned integer>
|
2019-07-16 11:59:50 +08:00
|
|
|
|
|
|
|
Diverse flags that describe exceptional behaviour for the digest:
|
|
|
|
|
|
|
|
=over 4
|
|
|
|
|
|
|
|
=item B<EVP_MD_FLAG_ONESHOT>
|
|
|
|
|
|
|
|
This digest method can only handle one block of input.
|
|
|
|
|
|
|
|
=item B<EVP_MD_FLAG_XOF>
|
|
|
|
|
2023-07-21 13:05:38 +08:00
|
|
|
This digest method is an extensible-output function (XOF).
|
2019-07-16 11:59:50 +08:00
|
|
|
|
|
|
|
=item B<EVP_MD_FLAG_DIGALGID_NULL>
|
|
|
|
|
|
|
|
When setting up a DigestAlgorithmIdentifier, this flag will have the
|
|
|
|
parameter set to NULL by default. Use this for PKCS#1. I<Note: if
|
|
|
|
combined with EVP_MD_FLAG_DIGALGID_ABSENT, the latter will override.>
|
|
|
|
|
|
|
|
=item B<EVP_MD_FLAG_DIGALGID_ABSENT>
|
|
|
|
|
|
|
|
When setting up a DigestAlgorithmIdentifier, this flag will have the
|
|
|
|
parameter be left absent by default. I<Note: if combined with
|
|
|
|
EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden.>
|
|
|
|
|
|
|
|
=item B<EVP_MD_FLAG_DIGALGID_CUSTOM>
|
|
|
|
|
|
|
|
Custom DigestAlgorithmIdentifier handling via ctrl, with
|
|
|
|
B<EVP_MD_FLAG_DIGALGID_ABSENT> as default. I<Note: if combined with
|
|
|
|
EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden.>
|
|
|
|
Currently unused.
|
|
|
|
|
|
|
|
=back
|
|
|
|
|
2019-09-26 10:14:00 +08:00
|
|
|
The length of the "flags" parameter should equal that of an
|
|
|
|
B<unsigned long int>.
|
|
|
|
|
2019-07-16 11:59:50 +08:00
|
|
|
=back
|
2019-07-24 22:24:01 +08:00
|
|
|
|
2019-07-16 11:59:50 +08:00
|
|
|
=head2 Digest Context Parameters
|
2019-07-24 22:24:01 +08:00
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_set_ctx_params() sets digest parameters associated with the
|
2019-09-27 19:26:22 +08:00
|
|
|
given provider side digest context I<dctx> to I<params>.
|
2019-07-24 22:24:01 +08:00
|
|
|
Any parameter settings are additional to any that were previously set.
|
|
|
|
See L<OSSL_PARAM(3)> for further details on the parameters structure.
|
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_get_ctx_params() gets details of currently set parameters
|
2019-09-27 19:26:22 +08:00
|
|
|
values associated with the give provider side digest context I<dctx>
|
|
|
|
and stores them in I<params>.
|
2019-07-24 22:24:01 +08:00
|
|
|
See L<OSSL_PARAM(3)> for further details on the parameters structure.
|
|
|
|
|
|
|
|
=head1 RETURN VALUES
|
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_newctx() and OSSL_FUNC_digest_dupctx() should return the newly created
|
2019-07-24 22:24:01 +08:00
|
|
|
provider side digest context, or NULL on failure.
|
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_init(), OSSL_FUNC_digest_update(), OSSL_FUNC_digest_final(), OSSL_FUNC_digest_digest(),
|
|
|
|
OSSL_FUNC_digest_set_params() and OSSL_FUNC_digest_get_params() should return 1 for success or
|
2019-07-24 22:24:01 +08:00
|
|
|
0 on error.
|
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_size() should return the digest size.
|
2019-07-24 22:24:01 +08:00
|
|
|
|
2020-06-21 07:19:16 +08:00
|
|
|
OSSL_FUNC_digest_block_size() should return the block size of the underlying digest
|
2019-07-24 22:24:01 +08:00
|
|
|
algorithm.
|
|
|
|
|
2021-02-27 01:28:48 +08:00
|
|
|
=head1 BUGS
|
|
|
|
|
2021-03-30 01:32:48 +08:00
|
|
|
The EVP_Q_digest(), EVP_Digest() and EVP_DigestFinal_ex() API calls do not
|
2021-02-27 01:28:48 +08:00
|
|
|
expect the digest size to be larger than EVP_MAX_MD_SIZE. Any algorithm which
|
|
|
|
produces larger digests is unusable with those API calls.
|
|
|
|
|
2019-07-24 22:24:01 +08:00
|
|
|
=head1 SEE ALSO
|
|
|
|
|
2020-03-06 21:29:00 +08:00
|
|
|
L<provider(7)>, L<OSSL_PROVIDER-FIPS(7)>, L<OSSL_PROVIDER-default(7)>,
|
2021-06-07 10:28:29 +08:00
|
|
|
L<OSSL_PROVIDER-legacy(7)>,
|
|
|
|
L<EVP_MD-common(7)>, L<EVP_MD-BLAKE2(7)>, L<EVP_MD-MD2(7)>,
|
|
|
|
L<EVP_MD-MD4(7)>, L<EVP_MD-MD5(7)>, L<EVP_MD-MD5-SHA1(7)>,
|
|
|
|
L<EVP_MD-MDC2(7)>, L<EVP_MD-RIPEMD160(7)>, L<EVP_MD-SHA1(7)>,
|
2021-09-13 18:59:42 +08:00
|
|
|
L<EVP_MD-SHA2(7)>, L<EVP_MD-SHA3(7)>, L<EVP_MD-KECCAK(7)>
|
|
|
|
L<EVP_MD-SHAKE(7)>, L<EVP_MD-SM3(7)>, L<EVP_MD-WHIRLPOOL(7)>,
|
2023-02-22 10:15:47 +08:00
|
|
|
L<EVP_MD-NULL(7)>,
|
2021-06-07 10:28:29 +08:00
|
|
|
L<life_cycle-digest(7)>, L<EVP_DigestInit(3)>
|
2019-07-24 22:24:01 +08:00
|
|
|
|
|
|
|
=head1 HISTORY
|
|
|
|
|
|
|
|
The provider DIGEST interface was introduced in OpenSSL 3.0.
|
2024-10-26 17:10:38 +08:00
|
|
|
OSSL_FUNC_digest_copyctx() was added in 3.5 version.
|
2019-07-24 22:24:01 +08:00
|
|
|
|
|
|
|
=head1 COPYRIGHT
|
|
|
|
|
2023-09-07 16:59:15 +08:00
|
|
|
Copyright 2019-2023 The OpenSSL Project Authors. All Rights Reserved.
|
2019-07-24 22:24:01 +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
|