Enforce proper memory alignment on APDU buffer for response status words
@@ -28,7 +28,9 @@ void handle_eip712_return_code(bool success) {
} else if (apdu_response_code == APDU_RESPONSE_OK) { // somehow not set
apdu_response_code = APDU_RESPONSE_ERROR_NO_INFO;
}
- *(uint16_t *) G_io_apdu_buffer = __builtin_bswap16(apdu_response_code);
+
+ G_io_apdu_buffer[0] = (apdu_response_code >> 8) & 0xff;
+ G_io_apdu_buffer[1] = apdu_response_code & 0xff;
// Send back the response, do not restart the event loop
io_exchange(CHANNEL_APDU | IO_RETURN_AFTER_TX, 2);
