unified dec_pass array, update readme
This commit is contained in:
1 parent
90399dc61b
commit
aaa6f71708
2 files changed
+19
-27
No files matched your search
@@ -14,8 +14,9 @@ Supports cryptographic algorithms:
|
|||||||
- [x] add read all ASCII-printable symbols for key
|
- [x] add read all ASCII-printable symbols for key
|
||||||
- [x] add Kuznechik lib for non 128 bit MCU
|
- [x] add Kuznechik lib for non 128 bit MCU
|
||||||
- [x] use SHA256 for hashing key to set key length to 32 bytes
|
- [x] use SHA256 for hashing key to set key length to 32 bytes
|
||||||
- [ ] expand stored passwords length from 16 byte to 64
|
- [x] expand stored passwords length from 16 byte to 64
|
||||||
- [ ] expand number of stored passwords, may be with auto-adding new keycodes
|
- [x] expand number of stored passwords (manual adding new keys)
|
||||||
|
- [ ] write new passwords to EEPROM without flashing firmware
|
||||||
- [ ] add CBC mode for Kuznechik, it will increase security
|
- [ ] add CBC mode for Kuznechik, it will increase security
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
@@ -86,9 +87,6 @@ const uint8_t encrypted_passwords[STORAGE_SIZE][STORAGE_PASS_LEN] = {
|
|||||||
If you want more passwords in storage, you should:
|
If you want more passwords in storage, you should:
|
||||||
- add keys `RED_PASSX` into `enum red_crypto_keys` in `red_crypto.h`
|
- add keys `RED_PASSX` into `enum red_crypto_keys` in `red_crypto.h`
|
||||||
- add into `crypto_proccess_record_user` handling new keys
|
- add into `crypto_proccess_record_user` handling new keys
|
||||||
- add into `uint8_t dec_pass[STORAGE_SIZE][STORAGE_PASS_LEN]` additional data. There are must be same size as `encrypted_passwords`.
|
|
||||||
|
|
||||||
> I know, that's inconvenient. I'm sorry, trying to do something with it.
|
|
||||||
|
|
||||||
7. Add new layer or set new keyes everywhere you want.
|
7. Add new layer or set new keyes everywhere you want.
|
||||||
|
|
||||||
|
|||||||
+16
-22
@@ -2,27 +2,15 @@
|
|||||||
|
|
||||||
#include "red_crypto.h"
|
#include "red_crypto.h"
|
||||||
|
|
||||||
uint8_t dec_pass[STORAGE_SIZE][STORAGE_PASS_LEN] = {
|
uint8_t dec_pass[STORAGE_SIZE][STORAGE_PASS_LEN];
|
||||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
|
||||||
|
|
||||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
void init_dec_pass() {
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
for (uint8_t i = 0; i < STORAGE_SIZE; i++) {
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
for (uint8_t j = 0; j < STORAGE_PASS_LEN; j++) {
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
dec_pass[i][j] = 0x00;
|
||||||
|
}
|
||||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
}
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
}
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
|
||||||
|
|
||||||
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
||||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
|
|
||||||
};
|
|
||||||
|
|
||||||
// you can use key any length with SHA256, kuznechik use only 32byte
|
// you can use key any length with SHA256, kuznechik use only 32byte
|
||||||
#ifdef USE_SHA256_KEY
|
#ifdef USE_SHA256_KEY
|
||||||
@@ -32,8 +20,6 @@ uint8_t readed_key[128] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|||||||
uint8_t readed_key[32] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
uint8_t readed_key[32] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const uint8_t test_pass_block[16] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
|
||||||
|
|
||||||
uint8_t count_char_key = 0;
|
uint8_t count_char_key = 0;
|
||||||
|
|
||||||
uint8_t crypto_mode = 0;
|
uint8_t crypto_mode = 0;
|
||||||
@@ -79,6 +65,8 @@ void decrypt_pass_kuzn(const uint8_t encrypted_passwords[STORAGE_SIZE][STORAGE_P
|
|||||||
kuz_key_t key;
|
kuz_key_t key;
|
||||||
w128_t x;
|
w128_t x;
|
||||||
|
|
||||||
|
init_dec_pass();
|
||||||
|
|
||||||
#ifdef USE_SHA256_KEY
|
#ifdef USE_SHA256_KEY
|
||||||
SHA256_CTX ctx;
|
SHA256_CTX ctx;
|
||||||
sha256_init(&ctx);
|
sha256_init(&ctx);
|
||||||
@@ -182,6 +170,12 @@ uint8_t crypto_process_record_user(uint16_t keycode, keyrecord_t *record, const
|
|||||||
send_chars_pass(dec_pass[3]);
|
send_chars_pass(dec_pass[3]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
// if you want to add more keys for passwords, copy this `case`
|
||||||
|
// case RED_PASSX: //change X here
|
||||||
|
// if (record->event.pressed) {
|
||||||
|
// send_chars_pass(dec_pass[X]); //change X here
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
case RED_RNG:
|
case RED_RNG:
|
||||||
if (record->event.pressed) {
|
if (record->event.pressed) {
|
||||||
// TODO: change seed
|
// TODO: change seed
|
||||||
|
|||||||
Reference in new issue
Block a user