diff -u cryptohash_openssl.c.orig cryptohash_openssl.c
--- cryptohash_openssl.c.orig	2022-01-06 11:15:59.268256281 -0500
+++ cryptohash_openssl.c	2022-01-06 11:22:28.602734304 -0500
@@ -21,6 +21,7 @@
 #include "postgres_fe.h"
 #endif
 
+#include <openssl/err.h>
 #include <openssl/evp.h>
 
 #include "common/cryptohash.h"
@@ -309,7 +310,14 @@
 		case PG_CRYPTOHASH_ERROR_DEST_LEN:
 			return _("destination buffer too small");
 		case PG_CRYPTOHASH_ERROR_OPENSSL:
-			return _("OpenSSL failure");
+			{
+				unsigned long ecode = ERR_get_error();
+				const char *errreason = ERR_reason_error_string(ecode);
+
+				if (errreason)
+					return errreason;
+				return _("OpenSSL failure");
+			}
 	}
 
 	/* assume that the default is out-of-memory, anyway */
