|
@@ -39,6 +39,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
39
|
39
|
#include <ipxe/uuid.h>
|
40
|
40
|
#include <ipxe/uri.h>
|
41
|
41
|
#include <ipxe/base16.h>
|
|
42
|
+#include <ipxe/base64.h>
|
42
|
43
|
#include <ipxe/pci.h>
|
43
|
44
|
#include <ipxe/init.h>
|
44
|
45
|
#include <ipxe/version.h>
|
|
@@ -2120,6 +2121,46 @@ const struct setting_type setting_type_hexraw __setting_type = {
|
2120
|
2121
|
.format = format_hex_raw_setting,
|
2121
|
2122
|
};
|
2122
|
2123
|
|
|
2124
|
+/**
|
|
2125
|
+ * Parse Base64-encoded setting value
|
|
2126
|
+ *
|
|
2127
|
+ * @v type Setting type
|
|
2128
|
+ * @v value Formatted setting value
|
|
2129
|
+ * @v buf Buffer to contain raw value
|
|
2130
|
+ * @v len Length of buffer
|
|
2131
|
+ * @v size Integer size, in bytes
|
|
2132
|
+ * @ret len Length of raw value, or negative error
|
|
2133
|
+ */
|
|
2134
|
+static int parse_base64_setting ( const struct setting_type *type __unused,
|
|
2135
|
+ const char *value, void *buf, size_t len ) {
|
|
2136
|
+
|
|
2137
|
+ return base64_decode ( value, buf, len );
|
|
2138
|
+}
|
|
2139
|
+
|
|
2140
|
+/**
|
|
2141
|
+ * Format Base64-encoded setting value
|
|
2142
|
+ *
|
|
2143
|
+ * @v type Setting type
|
|
2144
|
+ * @v raw Raw setting value
|
|
2145
|
+ * @v raw_len Length of raw setting value
|
|
2146
|
+ * @v buf Buffer to contain formatted value
|
|
2147
|
+ * @v len Length of buffer
|
|
2148
|
+ * @ret len Length of formatted value, or negative error
|
|
2149
|
+ */
|
|
2150
|
+static int format_base64_setting ( const struct setting_type *type __unused,
|
|
2151
|
+ const void *raw, size_t raw_len,
|
|
2152
|
+ char *buf, size_t len ) {
|
|
2153
|
+
|
|
2154
|
+ return base64_encode ( raw, raw_len, buf, len );
|
|
2155
|
+}
|
|
2156
|
+
|
|
2157
|
+/** A Base64-encoded setting */
|
|
2158
|
+const struct setting_type setting_type_base64 __setting_type = {
|
|
2159
|
+ .name = "base64",
|
|
2160
|
+ .parse = parse_base64_setting,
|
|
2161
|
+ .format = format_base64_setting,
|
|
2162
|
+};
|
|
2163
|
+
|
2123
|
2164
|
/**
|
2124
|
2165
|
* Format UUID setting value
|
2125
|
2166
|
*
|