Skip to content

Commit 8b184a3

Browse files
authored
Merge pull request #940 from rhenium/ky/pkey-read-fix-repeated-prompts-follow-up
pkey: fix loading public keys with early OpenSSL 3.0.x releases
2 parents 402cd56 + 5347880 commit 8b184a3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/openssl/ossl_pkey.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ ossl_pkey_read(BIO *bio, const char *input_type, int selection, VALUE pass,
103103
while (1) {
104104
if (OSSL_DECODER_from_bio(dctx, bio) == 1)
105105
break;
106-
if (ERR_GET_REASON(ERR_peek_error()) != ERR_R_UNSUPPORTED)
106+
// Error queue may not be populated in OpenSSL < 3.0.11 and < 3.1.3
107+
// https://github.com/openssl/openssl/pull/21603
108+
unsigned long err = ERR_peek_error();
109+
if (err && ERR_GET_REASON(err) != ERR_R_UNSUPPORTED)
107110
break;
108111
if (BIO_eof(bio) == 1) {
109112
*retryable = 1;

0 commit comments

Comments
 (0)