Skip to content

Commit d933765

Browse files
committed
Add secret file to print out
This is useful for testing decryption with large files
1 parent ad9842a commit d933765

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

encrypted/hello_encrypted/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
# Example encrypted binard
22
add_executable(hello_encrypted
33
hello_encrypted.c
4+
secret.S
45
)
56

7+
# include secret.txt
8+
target_include_directories(hello_encrypted PRIVATE ${CMAKE_CURRENT_LIST_DIR})
9+
10+
# add dependency on secret.txt
11+
set_property(SOURCE secret.S APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_CURRENT_LIST_DIR}/secret.txt)
12+
613
# pull in common dependencies
714
target_link_libraries(hello_encrypted pico_stdlib)
815

encrypted/hello_encrypted/hello_encrypted.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ int main() {
2020
rom_explicit_buy(buffer, 4096);
2121
free(buffer);
2222
#endif
23+
extern char secret_data[];
2324

2425
while (true) {
2526
printf("Hello, world!\n");
2627
printf("I'm a self-decrypting binary\n");
2728
printf("My secret is...\n");
2829
sleep_ms(1000);
30+
printf(secret_data);
31+
sleep_ms(10000);
2932
}
3033
}

encrypted/hello_encrypted/secret.S

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.section .rodata
2+
.global secret_data
3+
secret_data:
4+
.incbin "secret.txt"
5+
.byte 0

encrypted/hello_encrypted/secret.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO: Put a funny secret here

0 commit comments

Comments
 (0)