master
1#include <assert.h>
2#include <string.h>
3#include <stdint.h>
4
5// TODO we would like to #include "base64.h" here but this feature has been disabled in
6// the stage1 compiler. Users will have to wait until self-hosted is available for
7// the "generate .h file" feature.
8size_t decode_base_64(uint8_t *dest_ptr, size_t dest_len, const uint8_t *source_ptr, size_t source_len);
9
10extern int *x_ptr;
11
12int main(int argc, char **argv) {
13 const char *encoded = "YWxsIHlvdXIgYmFzZSBhcmUgYmVsb25nIHRvIHVz";
14 char buf[200];
15
16 size_t len = decode_base_64((uint8_t *)buf, 200, (uint8_t *)encoded, strlen(encoded));
17 buf[len] = 0;
18 assert(strcmp(buf, "all your base are belong to us") == 0);
19
20 assert(*x_ptr == 1234);
21
22 return 0;
23}