mirror of
https://github.com/ruby/ruby.git
synced 2026-08-05 11:19:10 +08:00
With the introduction of OpenSSL 3 providers, newly implemented algorithms do not necessarily have a corresponding NID assigned. To use such an algorithm, it has to be "fetched" from providers using the new EVP_*_fetch() functions. For digest algorithms, we have to use EVP_MD_fetch() instead of the existing EVP_get_digestbyname(). However, it is not a drop-in replacement because: - EVP_MD_fetch() does not support all algorithm name aliases recognized by EVP_get_digestbyname(). - Both return an EVP_MD, but the one returned by EVP_MD_fetch() is sometimes reference counted and the user has to explicitly release it with EVP_MD_free(). So, keep using EVP_get_digestbyname() for all OpenSSL versions for now, and fall back to EVP_MD_fetch() if it fails. In the latter case, prepare a T_DATA object to manage the fetched EVP_MD's lifetime. https://github.com/ruby/openssl/commit/9fc2179403
26 lines
720 B
C
26 lines
720 B
C
/*
|
|
* 'OpenSSL for Ruby' project
|
|
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
|
|
* All rights reserved.
|
|
*/
|
|
/*
|
|
* This program is licensed under the same licence as Ruby.
|
|
* (See the file 'COPYING'.)
|
|
*/
|
|
#if !defined(_OSSL_DIGEST_H_)
|
|
#define _OSSL_DIGEST_H_
|
|
|
|
/*
|
|
* Gets EVP_MD from a String or an OpenSSL::Digest instance (discouraged, but
|
|
* still supported for compatibility). A holder object is created if the EVP_MD
|
|
* is a "fetched" algorithm.
|
|
*/
|
|
const EVP_MD *ossl_evp_md_fetch(VALUE obj, volatile VALUE *holder);
|
|
/*
|
|
* This is meant for OpenSSL::Engine#digest. EVP_MD must not be a fetched one.
|
|
*/
|
|
VALUE ossl_digest_new(const EVP_MD *);
|
|
void Init_ossl_digest(void);
|
|
|
|
#endif /* _OSSL_DIGEST_H_ */
|