mirror of
https://github.com/ipxe/ipxe
synced 2025-12-23 13:30:57 +03:00
[base64] Allow base64_encode() to handle arbitrary data
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -12,15 +12,15 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* Calculate length of base64-encoded string
|
||||
* Calculate length of base64-encoded data
|
||||
*
|
||||
* @v raw_len Raw string length (excluding NUL)
|
||||
* @v raw_len Raw data length
|
||||
* @ret encoded_len Encoded string length (excluding NUL)
|
||||
*/
|
||||
static inline size_t base64_encoded_len ( size_t raw_len ) {
|
||||
return ( ( ( raw_len + 3 - 1 ) / 3 ) * 4 );
|
||||
}
|
||||
|
||||
extern void base64_encode ( const char *raw, char *encoded );
|
||||
extern void base64_encode ( const uint8_t *raw, size_t len, char *encoded );
|
||||
|
||||
#endif /* _IPXE_BASE64_H */
|
||||
|
||||
Reference in New Issue
Block a user