Add a compatibility EVP_DigestFinalXOF function.

This is to ease compiling against cryptography.io. (It expects anything
which has EVP_DigestSign to also have this function.)

Change-Id: I2bb4f4f01770d789e68fe84beed3393b1f004081
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/35805
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/fipsmodule/digest/digest.c b/crypto/fipsmodule/digest/digest.c
index 6705867..68e81c4 100644
--- a/crypto/fipsmodule/digest/digest.c
+++ b/crypto/fipsmodule/digest/digest.c
@@ -115,6 +115,11 @@
 
 void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx) { EVP_MD_CTX_free(ctx); }
 
+int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, uint8_t *out, size_t len) {
+  OPENSSL_PUT_ERROR(DIGEST, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
+  return 0;
+}
+
 int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in) {
   // |in->digest| may be NULL if this is a signing |EVP_MD_CTX| for, e.g.,
   // Ed25519 which does not hash with |EVP_MD_CTX|.
diff --git a/include/openssl/digest.h b/include/openssl/digest.h
index 1a1ca29..c7c6797 100644
--- a/include/openssl/digest.h
+++ b/include/openssl/digest.h
@@ -269,6 +269,11 @@
 // EVP_MD_CTX_destroy calls |EVP_MD_CTX_free|.
 OPENSSL_EXPORT void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
 
+// EVP_DigestFinalXOF returns zero and adds an error to the error queue.
+// BoringSSL does not support any XOF digests.
+OPENSSL_EXPORT int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, uint8_t *out,
+                                      size_t len);
+
 
 struct evp_md_pctx_ops;