Skip to content

Commit da64fef

Browse files
b64_decode_cacerts: accept non-wrapped input
Ensure base64 decoding accepts data of any line length. RFC 8951 (an update to RFC 7030) clarifies that senders are not required to insert white space (such as LF) in base64-encoded payloads. Therefore libest must handle lines of any length. Set the BIO_FLAGS_BASE64_NO_NL flag to activate this behaviour. See BIO_F_BASE64(3ossl) for more details. Signed-off-by: Fraser Tweedale <frase@frase.id.au>
1 parent f8a6e5b commit da64fef

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/est/est_client.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,18 @@ static EST_ERROR b64_decode_cacerts (unsigned char *cacerts, int *cacerts_len,
383383
EST_LOG_ERR("BIO_new failed");
384384
ossl_dump_ssl_errors();
385385
return (EST_ERR_MALLOC);
386-
}
386+
}
387+
388+
/*
389+
* Ensure we can read data of any length. RFC 8951 (an update to
390+
* RFC 7030) clarifies that senders are not required to insert
391+
* white space (such as LF) in base64-encoded payloads. Therefore
392+
* libest must handle lines of any length.
393+
*
394+
* See BIO_F_BASE64(3ossl) for more details.
395+
*/
396+
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
397+
387398
/*
388399
* Decoding will always take up less than the original buffer.
389400
*/

0 commit comments

Comments
 (0)