2015-12-04 20:04:54 +08:00
|
|
|
=pod
|
|
|
|
|
|
|
|
=head1 NAME
|
|
|
|
|
2019-09-03 23:47:13 +08:00
|
|
|
EVP_MD_meth_new, EVP_MD_meth_dup, EVP_MD_meth_free,
|
|
|
|
EVP_MD_meth_set_input_blocksize,
|
2015-12-04 20:04:54 +08:00
|
|
|
EVP_MD_meth_set_result_size, EVP_MD_meth_set_app_datasize,
|
|
|
|
EVP_MD_meth_set_flags, EVP_MD_meth_set_init, EVP_MD_meth_set_update,
|
|
|
|
EVP_MD_meth_set_final, EVP_MD_meth_set_copy, EVP_MD_meth_set_cleanup,
|
|
|
|
EVP_MD_meth_set_ctrl, EVP_MD_meth_get_input_blocksize,
|
|
|
|
EVP_MD_meth_get_result_size, EVP_MD_meth_get_app_datasize,
|
|
|
|
EVP_MD_meth_get_flags, EVP_MD_meth_get_init, EVP_MD_meth_get_update,
|
|
|
|
EVP_MD_meth_get_final, EVP_MD_meth_get_copy, EVP_MD_meth_get_cleanup,
|
2019-09-03 23:47:13 +08:00
|
|
|
EVP_MD_meth_get_ctrl
|
|
|
|
- Routines to build up legacy EVP_MD methods
|
2015-12-04 20:04:54 +08:00
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
|
|
|
|
#include <openssl/evp.h>
|
|
|
|
|
2021-12-02 19:33:49 +08:00
|
|
|
The following functions have been deprecated since OpenSSL 3.0, and can be
|
|
|
|
hidden entirely by defining B<OPENSSL_API_COMPAT> with a suitable version value,
|
|
|
|
see L<openssl_user_macros(7)>:
|
2020-02-13 09:00:57 +08:00
|
|
|
|
2016-06-11 04:10:51 +08:00
|
|
|
EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type);
|
|
|
|
void EVP_MD_meth_free(EVP_MD *md);
|
2016-06-21 19:03:34 +08:00
|
|
|
EVP_MD *EVP_MD_meth_dup(const EVP_MD *md);
|
2015-12-04 20:04:54 +08:00
|
|
|
|
|
|
|
int EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize);
|
|
|
|
int EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize);
|
|
|
|
int EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize);
|
|
|
|
int EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags);
|
|
|
|
int EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx));
|
|
|
|
int EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx,
|
|
|
|
const void *data,
|
|
|
|
size_t count));
|
|
|
|
int EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx,
|
|
|
|
unsigned char *md));
|
|
|
|
int EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to,
|
|
|
|
const EVP_MD_CTX *from));
|
|
|
|
int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx));
|
|
|
|
int EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd,
|
|
|
|
int p1, void *p2));
|
|
|
|
|
|
|
|
int EVP_MD_meth_get_input_blocksize(const EVP_MD *md);
|
|
|
|
int EVP_MD_meth_get_result_size(const EVP_MD *md);
|
|
|
|
int EVP_MD_meth_get_app_datasize(const EVP_MD *md);
|
|
|
|
unsigned long EVP_MD_meth_get_flags(const EVP_MD *md);
|
|
|
|
int (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx);
|
|
|
|
int (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx,
|
|
|
|
const void *data,
|
|
|
|
size_t count);
|
|
|
|
int (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx,
|
|
|
|
unsigned char *md);
|
|
|
|
int (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to,
|
|
|
|
const EVP_MD_CTX *from);
|
|
|
|
int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx);
|
|
|
|
int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd,
|
|
|
|
int p1, void *p2);
|
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
2020-02-13 09:00:57 +08:00
|
|
|
All of the functions described on this page are deprecated.
|
|
|
|
Applications should instead use the OSSL_PROVIDER APIs.
|
|
|
|
|
2015-12-04 20:04:54 +08:00
|
|
|
The B<EVP_MD> type is a structure for digest method implementation.
|
|
|
|
It can also have associated public/private key signing and verifying
|
|
|
|
routines.
|
|
|
|
|
2019-09-03 23:47:13 +08:00
|
|
|
EVP_MD_meth_new() creates a new B<EVP_MD> structure.
|
|
|
|
These B<EVP_MD> structures are reference counted.
|
2015-12-04 20:04:54 +08:00
|
|
|
|
|
|
|
EVP_MD_meth_dup() creates a copy of B<md>.
|
|
|
|
|
2019-03-19 00:15:58 +08:00
|
|
|
EVP_MD_meth_free() decrements the reference count for the B<EVP_MD> structure.
|
|
|
|
If the reference count drops to 0 then the structure is freed.
|
2015-12-04 20:04:54 +08:00
|
|
|
|
|
|
|
EVP_MD_meth_set_input_blocksize() sets the internal input block size
|
|
|
|
for the method B<md> to B<blocksize> bytes.
|
|
|
|
|
|
|
|
EVP_MD_meth_set_result_size() sets the size of the result that the
|
|
|
|
digest method in B<md> is expected to produce to B<resultsize> bytes.
|
|
|
|
|
|
|
|
The digest method may have its own private data, which OpenSSL will
|
|
|
|
allocate for it. EVP_MD_meth_set_app_datasize() should be used to
|
|
|
|
set the size for it to B<datasize>.
|
|
|
|
|
|
|
|
EVP_MD_meth_set_flags() sets the flags to describe optional
|
|
|
|
behaviours in the particular B<md>. Several flags can be or'd
|
|
|
|
together. The available flags are:
|
|
|
|
|
|
|
|
=over 4
|
|
|
|
|
|
|
|
=item EVP_MD_FLAG_ONESHOT
|
|
|
|
|
2018-12-15 04:47:07 +08:00
|
|
|
This digest method can only handle one block of input.
|
|
|
|
|
|
|
|
=item EVP_MD_FLAG_XOF
|
|
|
|
|
|
|
|
This digest method is an extensible-output function (XOF) and supports
|
|
|
|
the B<EVP_MD_CTRL_XOF_LEN> control.
|
2015-12-04 20:04:54 +08:00
|
|
|
|
|
|
|
=item 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 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
|
2016-03-20 23:51:06 +08:00
|
|
|
EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden.>
|
2015-12-04 20:04:54 +08:00
|
|
|
|
|
|
|
=item EVP_MD_FLAG_DIGALGID_CUSTOM
|
|
|
|
|
|
|
|
Custom DigestAlgorithmIdentifier handling via ctrl, with
|
|
|
|
B<EVP_MD_FLAG_DIGALGID_ABSENT> as default. I<Note: if combined with
|
2016-03-20 23:51:06 +08:00
|
|
|
EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden.>
|
2015-12-04 20:04:54 +08:00
|
|
|
Currently unused.
|
|
|
|
|
2018-12-15 04:47:07 +08:00
|
|
|
=item EVP_MD_FLAG_FIPS
|
|
|
|
|
|
|
|
This digest method is suitable for use in FIPS mode.
|
|
|
|
Currently unused.
|
|
|
|
|
2015-12-04 20:04:54 +08:00
|
|
|
=back
|
|
|
|
|
|
|
|
EVP_MD_meth_set_init() sets the digest init function for B<md>.
|
2018-12-15 04:47:07 +08:00
|
|
|
The digest init function is called by EVP_Digest(), EVP_DigestInit(),
|
2015-12-04 20:04:54 +08:00
|
|
|
EVP_DigestInit_ex(), EVP_SignInit, EVP_SignInit_ex(), EVP_VerifyInit()
|
|
|
|
and EVP_VerifyInit_ex().
|
|
|
|
|
|
|
|
EVP_MD_meth_set_update() sets the digest update function for B<md>.
|
2018-12-15 04:47:07 +08:00
|
|
|
The digest update function is called by EVP_Digest(), EVP_DigestUpdate() and
|
2015-12-04 20:04:54 +08:00
|
|
|
EVP_SignUpdate().
|
|
|
|
|
|
|
|
EVP_MD_meth_set_final() sets the digest final function for B<md>.
|
2018-12-15 04:47:07 +08:00
|
|
|
The digest final function is called by EVP_Digest(), EVP_DigestFinal(),
|
2015-12-04 20:04:54 +08:00
|
|
|
EVP_DigestFinal_ex(), EVP_SignFinal() and EVP_VerifyFinal().
|
|
|
|
|
|
|
|
EVP_MD_meth_set_copy() sets the function for B<md> to do extra
|
|
|
|
computations after the method's private data structure has been copied
|
|
|
|
from one B<EVP_MD_CTX> to another. If all that's needed is to copy
|
|
|
|
the data, there is no need for this copy function.
|
|
|
|
Note that the copy function is passed two B<EVP_MD_CTX *>, the private
|
Rename all getters to use get/get0 in name
For functions that exist in 1.1.1 provide a simple aliases via #define.
Fixes #15236
Functions with OSSL_DECODER_, OSSL_ENCODER_, OSSL_STORE_LOADER_,
EVP_KEYEXCH_, EVP_KEM_, EVP_ASYM_CIPHER_, EVP_SIGNATURE_,
EVP_KEYMGMT_, EVP_RAND_, EVP_MAC_, EVP_KDF_, EVP_PKEY_,
EVP_MD_, and EVP_CIPHER_ prefixes are renamed.
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15405)
2021-05-21 22:58:08 +08:00
|
|
|
data structure is then available with EVP_MD_CTX_get0_md_data().
|
2015-12-04 20:04:54 +08:00
|
|
|
This copy function is called by EVP_MD_CTX_copy() and
|
|
|
|
EVP_MD_CTX_copy_ex().
|
|
|
|
|
|
|
|
EVP_MD_meth_set_cleanup() sets the function for B<md> to do extra
|
2016-06-29 04:39:55 +08:00
|
|
|
cleanup before the method's private data structure is cleaned out and
|
2015-12-04 20:04:54 +08:00
|
|
|
freed.
|
|
|
|
Note that the cleanup function is passed a B<EVP_MD_CTX *>, the
|
Rename all getters to use get/get0 in name
For functions that exist in 1.1.1 provide a simple aliases via #define.
Fixes #15236
Functions with OSSL_DECODER_, OSSL_ENCODER_, OSSL_STORE_LOADER_,
EVP_KEYEXCH_, EVP_KEM_, EVP_ASYM_CIPHER_, EVP_SIGNATURE_,
EVP_KEYMGMT_, EVP_RAND_, EVP_MAC_, EVP_KDF_, EVP_PKEY_,
EVP_MD_, and EVP_CIPHER_ prefixes are renamed.
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15405)
2021-05-21 22:58:08 +08:00
|
|
|
private data structure is then available with EVP_MD_CTX_get0_md_data().
|
2015-12-04 20:04:54 +08:00
|
|
|
This cleanup function is called by EVP_MD_CTX_reset() and
|
|
|
|
EVP_MD_CTX_free().
|
|
|
|
|
|
|
|
EVP_MD_meth_set_ctrl() sets the control function for B<md>.
|
2018-12-15 04:47:07 +08:00
|
|
|
See L<EVP_MD_CTX_ctrl(3)> for the available controls.
|
2015-12-04 20:04:54 +08:00
|
|
|
|
|
|
|
EVP_MD_meth_get_input_blocksize(), EVP_MD_meth_get_result_size(),
|
|
|
|
EVP_MD_meth_get_app_datasize(), EVP_MD_meth_get_flags(),
|
|
|
|
EVP_MD_meth_get_init(), EVP_MD_meth_get_update(),
|
|
|
|
EVP_MD_meth_get_final(), EVP_MD_meth_get_copy(),
|
|
|
|
EVP_MD_meth_get_cleanup() and EVP_MD_meth_get_ctrl() are all used
|
|
|
|
to retrieve the method data given with the EVP_MD_meth_set_*()
|
|
|
|
functions above.
|
|
|
|
|
2017-11-24 22:14:42 +08:00
|
|
|
=head1 RETURN VALUES
|
|
|
|
|
|
|
|
EVP_MD_meth_new() and EVP_MD_meth_dup() return a pointer to a newly
|
|
|
|
created B<EVP_MD>, or NULL on failure.
|
|
|
|
All EVP_MD_meth_set_*() functions return 1.
|
|
|
|
EVP_MD_get_input_blocksize(), EVP_MD_meth_get_result_size(),
|
|
|
|
EVP_MD_meth_get_app_datasize() and EVP_MD_meth_get_flags() return the
|
|
|
|
indicated sizes or flags.
|
|
|
|
All other EVP_CIPHER_meth_get_*() functions return pointers to their
|
|
|
|
respective B<md> function.
|
|
|
|
|
2015-12-04 20:04:54 +08:00
|
|
|
=head1 SEE ALSO
|
|
|
|
|
|
|
|
L<EVP_DigestInit(3)>, L<EVP_SignInit(3)>, L<EVP_VerifyInit(3)>
|
|
|
|
|
|
|
|
=head1 HISTORY
|
|
|
|
|
2020-02-13 09:00:57 +08:00
|
|
|
All of these functions were deprecated in OpenSSL 3.0.
|
|
|
|
|
2015-12-04 20:04:54 +08:00
|
|
|
The B<EVP_MD> structure was openly available in OpenSSL before version
|
2019-09-03 23:47:13 +08:00
|
|
|
1.1.
|
|
|
|
The functions described here were added in OpenSSL 1.1.
|
|
|
|
The B<EVP_MD> structure created with these functions became reference
|
|
|
|
counted in OpenSSL 3.0.
|
2015-12-04 20:04:54 +08:00
|
|
|
|
2016-05-18 23:44:05 +08:00
|
|
|
=head1 COPYRIGHT
|
|
|
|
|
2021-06-17 20:24:59 +08:00
|
|
|
Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.
|
2016-05-18 23:44:05 +08:00
|
|
|
|
2018-12-06 21:04:44 +08:00
|
|
|
Licensed under the Apache License 2.0 (the "License"). You may not use
|
2016-05-18 23:44:05 +08:00
|
|
|
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
|