Skip to content

Commit

Permalink
[coco][fuji] base64_encode_compute
Browse files Browse the repository at this point in the history
  • Loading branch information
tschak909 committed May 1, 2024
1 parent 3c95e65 commit 33f8e43
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/device/drivewire/fuji.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,25 @@ void drivewireFuji::base64_encode_input()
errorCode = 1;
}

void drivewireFuji::base64_encode_compute()
{
size_t out_len;

std::unique_ptr<char[]> p = Base64::encode(base64.base64_buffer.c_str(), base64.base64_buffer.size(), &out_len);

if (!p)
{
Debug_printf("base64_encode_compute() failed.\n");
errorCode = 144;
return;
}

base64.base64_buffer.clear();
base64.base64_buffer = std::string(p.get(), out_len);

errorCode = 1;
}

// Initializes base settings and adds our devices to the DRIVEWIRE bus
void drivewireFuji::setup(systemBus *drivewirebus)
{
Expand Down
1 change: 1 addition & 0 deletions lib/device/drivewire/fuji.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class drivewireFuji : public virtualDevice
void set_boot_mode(); // 0xD6
void random(); // 0xD3
void base64_encode_input(); // 0xD0
void base64_encode_compute(); // 0xCF
void send_error();
void send_response(); // 0x01
void ready(); // 0x00
Expand Down

0 comments on commit 33f8e43

Please sign in to comment.