counterpart of d968b81
diff --git a/lib/openssl.c b/lib/openssl.c
index 71d5b9a..fe3d0cc 100644
--- a/lib/openssl.c
+++ b/lib/openssl.c
@@ -701,7 +701,7 @@
             ret = PTLS_ERROR_LIBRARY;
             goto Exit;
         }
-        if (EVP_PKEY_CTX_set_rsa_mgf1_md(pkey_ctx, EVP_sha256()) != 1) {
+        if (EVP_PKEY_CTX_set_rsa_mgf1_md(pkey_ctx, md) != 1) {
             ret = PTLS_ERROR_LIBRARY;
             goto Exit;
         }