The current API for Base16 (and Base64) encoding requires the caller to always provide sufficient buffer space. This prevents the use of the generic encoding/decoding functionality in some situations, such as in formatting the hex setting types. Implement a generic hex_encode() (based on the existing format_hex_setting()), implement base16_encode() and base16_decode() in terms of the more generic hex_encode() and hex_decode(), and update all callers to provide the additional buffer length parameter. Signed-off-by: Michael Brown <mcb30@ipxe.org>tags/v1.20.1
|
||
28 | 28 |
|
29 | 29 |
|
30 | 30 |
|
31 |
|
|
31 | 32 |
|
32 | 33 |
|
33 | 34 |
|
|
||
37 | 38 |
|
38 | 39 |
|
39 | 40 |
|
40 |
|
|
41 |
|
|
41 | 42 |
|
43 |
|
|
42 | 44 |
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
53 | 49 |
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|
62 | 63 |
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
64 |
|
|
70 | 65 |
|
71 | 66 |
|
72 | 67 |
|
73 |
|
|
68 |
|
|
74 | 69 |
|
75 |
|
|
76 | 70 |
|
71 |
|
|
77 | 72 |
|
78 | 73 |
|
79 | 74 |
|
80 | 75 |
|
81 |
|
|
76 |
|
|
82 | 77 |
|
83 | 78 |
|
84 | 79 |
|
|
||
110 | 105 |
|
111 | 106 |
|
112 | 107 |
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
|
122 |
|
|
123 |
|
|
124 |
|
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
|
140 |
|
|
||
2005 | 2005 |
|
2006 | 2006 |
|
2007 | 2007 |
|
2008 |
|
|
2009 |
|
|
2010 |
|
|
2011 |
|
|
2012 |
|
|
2013 |
|
|
2014 |
|
|
2015 |
|
|
2016 |
|
|
2017 |
|
|
2018 |
|
|
2019 |
|
|
2020 |
|
|
2021 |
|
|
2022 |
|
|
2023 |
|
|
2024 |
|
|
2025 |
|
|
2026 |
|
|
2027 |
|
|
2028 |
|
|
2029 |
|
|
2030 |
|
|
2031 |
|
|
2032 |
|
|
2033 |
|
|
2034 | 2008 |
|
2035 | 2009 |
|
2036 | 2010 |
|
|
||
2043 | 2017 |
|
2044 | 2018 |
|
2045 | 2019 |
|
2046 |
|
|
2020 |
|
|
2047 | 2021 |
|
2048 | 2022 |
|
2049 | 2023 |
|
|
||
2059 | 2033 |
|
2060 | 2034 |
|
2061 | 2035 |
|
2062 |
|
|
2036 |
|
|
2063 | 2037 |
|
2064 | 2038 |
|
2065 | 2039 |
|
|
||
2075 | 2049 |
|
2076 | 2050 |
|
2077 | 2051 |
|
2078 |
|
|
2052 |
|
|
2079 | 2053 |
|
2080 | 2054 |
|
2081 | 2055 |
|
|
||
2091 | 2065 |
|
2092 | 2066 |
|
2093 | 2067 |
|
2094 |
|
|
2068 |
|
|
2095 | 2069 |
|
2096 | 2070 |
|
2097 | 2071 |
|
|
||
2106 | 2080 |
|
2107 | 2081 |
|
2108 | 2082 |
|
2109 |
|
|
2083 |
|
|
2110 | 2084 |
|
2111 | 2085 |
|
2112 | 2086 |
|
|
||
2122 | 2096 |
|
2123 | 2097 |
|
2124 | 2098 |
|
2125 |
|
|
2099 |
|
|
2126 | 2100 |
|
2127 | 2101 |
|
2128 | 2102 |
|
|
||
143 | 143 |
|
144 | 144 |
|
145 | 145 |
|
146 |
|
|
146 |
|
|
147 |
|
|
147 | 148 |
|
148 | 149 |
|
149 | 150 |
|
|
||
105 | 105 |
|
106 | 106 |
|
107 | 107 |
|
108 |
|
|
108 |
|
|
109 | 109 |
|
110 | 110 |
|
111 | 111 |
|
|
||
139 | 139 |
|
140 | 140 |
|
141 | 141 |
|
142 |
|
|
142 |
|
|
143 | 143 |
|
144 | 144 |
|
145 | 145 |
|
|
||
32 | 32 |
|
33 | 33 |
|
34 | 34 |
|
35 |
|
|
36 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
37 | 38 |
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
39 | 66 |
|
40 | 67 |
|
|
||
330 | 330 |
|
331 | 331 |
|
332 | 332 |
|
333 |
|
|
333 |
|
|
334 | 334 |
|
335 | 335 |
|
336 | 336 |
|
|
||
291 | 291 |
|
292 | 292 |
|
293 | 293 |
|
294 |
|
|
294 |
|
|
295 | 295 |
|
296 | 296 |
|
297 | 297 |
|
|
||
63 | 63 |
|
64 | 64 |
|
65 | 65 |
|
66 |
|
|
66 |
|
|
67 | 67 |
|
68 | 68 |
|
69 | 69 |
|
|
||
1122 | 1122 |
|
1123 | 1123 |
|
1124 | 1124 |
|
1125 |
|
|
1125 | 1126 |
|
1126 |
|
|
1127 |
|
|
1128 |
|
|
1127 | 1129 |
|
1128 | 1130 |
|
1129 | 1131 |
|
1130 |
|
|
1132 |
|
|
1131 | 1133 |
|
1132 | 1134 |
|
1133 | 1135 |
|
|
||
1172 | 1174 |
|
1173 | 1175 |
|
1174 | 1176 |
|
1175 |
|
|
1177 |
|
|
1176 | 1178 |
|
1177 | 1179 |
|
1178 | 1180 |
|
1179 | 1181 |
|
1180 | 1182 |
|
1181 |
|
|
1183 |
|
|
1182 | 1184 |
|
1183 | 1185 |
|
1184 | 1186 |
|
1185 | 1187 |
|
1186 | 1188 |
|
1187 | 1189 |
|
1188 |
|
|
1190 |
|
|
1189 | 1191 |
|
1190 | 1192 |
|
1191 | 1193 |
|
|
||
1197 | 1199 |
|
1198 | 1200 |
|
1199 | 1201 |
|
1200 |
|
|
1202 |
|
|
1201 | 1203 |
|
1202 | 1204 |
|
1203 | 1205 |
|
|
||
709 | 709 |
|
710 | 710 |
|
711 | 711 |
|
712 |
|
|
712 |
|
|
713 | 713 |
|
714 | 714 |
|
715 | 715 |
|
|
||
719 | 719 |
|
720 | 720 |
|
721 | 721 |
|
722 |
|
|
722 |
|
|
723 | 723 |
|
724 | 724 |
|
725 | 725 |
|
|
||
833 | 833 |
|
834 | 834 |
|
835 | 835 |
|
836 |
|
|
836 | 837 |
|
837 | 838 |
|
838 |
|
|
839 |
|
|
840 |
|
|
839 | 841 |
|
840 | 842 |
|
841 | 843 |
|
842 | 844 |
|
843 | 845 |
|
844 |
|
|
846 |
|
|
845 | 847 |
|
846 | 848 |
|
847 | 849 |
|
|
||
980 | 982 |
|
981 | 983 |
|
982 | 984 |
|
983 |
|
|
985 |
|
|
984 | 986 |
|
985 | 987 |
|
986 | 988 |
|
|
||
1065 | 1067 |
|
1066 | 1068 |
|
1067 | 1069 |
|
1068 |
|
|
1070 |
|
|
1069 | 1071 |
|
1070 | 1072 |
|
1071 | 1073 |
|
|
||
77 | 77 |
|
78 | 78 |
|
79 | 79 |
|
80 |
|
|
81 |
|
|
80 | 82 |
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
88 | 95 |
|
89 | 96 |
|
90 | 97 |
|
91 | 98 |
|
92 | 99 |
|
100 |
|
|
101 |
|
|
93 | 102 |
|
94 |
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
|
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
104 | 116 |
|
105 | 117 |
|
106 | 118 |
|