• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef _GPXE_BASE64_H
2 #define _GPXE_BASE64_H
3 
4 /** @file
5  *
6  * Base64 encoding
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER );
11 
12 #include <stdint.h>
13 
14 /**
15  * Calculate length of base64-encoded string
16  *
17  * @v raw_len		Raw string length (excluding NUL)
18  * @ret encoded_len	Encoded string length (excluding NUL)
19  */
base64_encoded_len(size_t raw_len)20 static inline size_t base64_encoded_len ( size_t raw_len ) {
21 	return ( ( ( raw_len + 3 - 1 ) / 3 ) * 4 );
22 }
23 
24 extern void base64_encode ( const char *raw, char *encoded );
25 
26 #endif /* _GPXE_BASE64_H */
27