Skip to content

Commit

Permalink
b64_decode_cacerts: accept non-wrapped input
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
frasertweedale committed Jun 14, 2022
1 parent f8a6e5b commit da64fef
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/est/est_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,18 @@ static EST_ERROR b64_decode_cacerts (unsigned char *cacerts, int *cacerts_len,
EST_LOG_ERR("BIO_new failed");
ossl_dump_ssl_errors();
return (EST_ERR_MALLOC);
}
}

/*
* Ensure we can read data of any 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.
*
* See BIO_F_BASE64(3ossl) for more details.
*/
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);

/*
* Decoding will always take up less than the original buffer.
*/
Expand Down

0 comments on commit da64fef

Please sign in to comment.