Add XOF compilation compatibility flags
This CL adds compatibility flags for XOF digests in service of easing
compatibility between OpenSSL and BoringSSL. See this logic in Node:
https://github.com/nodejs/node/blob/master/src/node_crypto.cc#L4599-L4611
Change-Id: I7f12bed8fb1ea2d9e49dba14ed0c4c819596c70d
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/37564
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/include/openssl/digest.h b/include/openssl/digest.h
index c7c6797..c3ceb7f 100644
--- a/include/openssl/digest.h
+++ b/include/openssl/digest.h
@@ -195,7 +195,7 @@
// EVP_MD_block_size returns the native block-size of |md|, in bytes.
OPENSSL_EXPORT size_t EVP_MD_block_size(const EVP_MD *md);
-// EVP_MD_FLAG_PKEY_DIGEST indicates the the digest function is used with a
+// EVP_MD_FLAG_PKEY_DIGEST indicates that the digest function is used with a
// specific public key in order to verify signatures. (For example,
// EVP_dss1.)
#define EVP_MD_FLAG_PKEY_DIGEST 1
@@ -205,6 +205,11 @@
// undefined rather than NULL.
#define EVP_MD_FLAG_DIGALGID_ABSENT 2
+// EVP_MD_FLAG_XOF indicates that the digest is an extensible-output function
+// (XOF). This flag is defined for compatibility and will never be set in any
+// |EVP_MD| in BoringSSL.
+#define EVP_MD_FLAG_XOF 4
+
// Digest operation accessors.
@@ -274,6 +279,9 @@
OPENSSL_EXPORT int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, uint8_t *out,
size_t len);
+// EVP_MD_meth_get_flags calls |EVP_MD_flags|.
+OPENSSL_EXPORT uint32_t EVP_MD_meth_get_flags(const EVP_MD *md);
+
struct evp_md_pctx_ops;