mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
555aa9820d | ||
|
|
1c685edde5 |
+7
-2
@@ -9,9 +9,13 @@ void chacha_count(void);
|
|||||||
|
|
||||||
|
|
||||||
__xdata struct chacha20_t __at(0xbf00) chacha20;
|
__xdata struct chacha20_t __at(0xbf00) chacha20;
|
||||||
|
|
||||||
|
#ifdef CHACHA20_TEST
|
||||||
__xdata uint8_t plaintext[256];
|
__xdata uint8_t plaintext[256];
|
||||||
__xdata uint8_t cyphertext[256];
|
__xdata uint8_t cyphertext[256];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
void chacha20_print_block(void)
|
void chacha20_print_block(void)
|
||||||
{
|
{
|
||||||
for (uint8_t i=0; i < 64; i++) {
|
for (uint8_t i=0; i < 64; i++) {
|
||||||
@@ -20,7 +24,7 @@ void chacha20_print_block(void)
|
|||||||
write_char(' ');
|
write_char(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void chacha20_encrypt(void)
|
void chacha20_encrypt(void)
|
||||||
{
|
{
|
||||||
@@ -47,7 +51,7 @@ void chacha20_encrypt(void)
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CHACHA20_TEST
|
||||||
// Test the example of RFC 7539 Section 2.4.2
|
// Test the example of RFC 7539 Section 2.4.2
|
||||||
void chacha20_test(void)
|
void chacha20_test(void)
|
||||||
{
|
{
|
||||||
@@ -96,3 +100,4 @@ void chacha20_test(void)
|
|||||||
print_byte(cyphertext[i]); write_char(' ');
|
print_byte(cyphertext[i]); write_char(' ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
Reference in new issue
Block a user