summaryrefslogtreecommitdiffstats
path: root/src/include/ipxe/base64.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/ipxe/base64.h')
-rw-r--r--src/include/ipxe/base64.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/include/ipxe/base64.h b/src/include/ipxe/base64.h
new file mode 100644
index 00000000..12959415
--- /dev/null
+++ b/src/include/ipxe/base64.h
@@ -0,0 +1,26 @@
+#ifndef _IPXE_BASE64_H
+#define _IPXE_BASE64_H
+
+/** @file
+ *
+ * Base64 encoding
+ *
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER );
+
+#include <stdint.h>
+
+/**
+ * Calculate length of base64-encoded string
+ *
+ * @v raw_len Raw string length (excluding NUL)
+ * @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 );
+
+#endif /* _IPXE_BASE64_H */