X509_ALGOR_set_md function

  1. @RecordUse.new()
  2. @Native<Int Function(Pointer<X509_ALGOR>, Pointer<EVP_MD>)>(ffi.Pointer<X509_ALGOR>, ffi.Pointer<EVP_MD>)>(symbol: 'bssl_dart_X509_ALGOR_set_md')
int X509_ALGOR_set_md(
  1. Pointer<X509_ALGOR> alg,
  2. Pointer<EVP_MD> md
)

X509_ALGOR_set_md sets |alg| to the hash function |md|. Note this AlgorithmIdentifier represents the hash function itself, not a signature algorithm that uses |md|. It returns one on success and zero on error.

Due to historical specification mistakes (see Section 2.1 of RFC 4055), the parameters field is sometimes omitted and sometimes a NULL value. When used in RSASSA-PSS and RSAES-OAEP, it should be a NULL value. In other contexts, the parameters should be omitted. This function assumes the caller is constructing a RSASSA-PSS or RSAES-OAEP AlgorithmIdentifier and includes a NULL parameter. This differs from OpenSSL's behavior.

TODO(davidben): Rename this function, or perhaps just add a bespoke API for constructing PSS and move on.

Implementation

@meta.RecordUse()
@ffi.Native<ffi.Int Function(ffi.Pointer<X509_ALGOR>, ffi.Pointer<EVP_MD>)>(
  symbol: 'bssl_dart_X509_ALGOR_set_md',
)
external int X509_ALGOR_set_md(
  ffi.Pointer<X509_ALGOR> alg,
  ffi.Pointer<EVP_MD> md,
);