doc:Add doc/headers.png

This commit is contained in:
Tommaso Gagliardoni 2023-07-24 00:36:55 +02:00
parent 10d99c68fa
commit 860d259bd8
6 changed files with 1257 additions and 5 deletions

View file

@ -14,11 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Global constants fully shared among components through `sflc_constants.h`.
## [0.4.0] - 2023-07-23
## [0.4.0] - 2023-07-24
### Added
- Benchmark suite with tools for Shufflecake, LUKS, and VeraCrypt.
- Improved documentation in `README.md` on using `init` non-interactively.
- `doc` section which for now includes figure of Shufflecake header structure.
### Refactored
@ -31,7 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- BREAKING CHANGE: slightly modified header field format, removing redundant data and making it adherent to documentation.
- BREAKING CHANGE: slightly modified header field format, removing redundant MAC field and making it adherent to documentation.
- Action `init` now reads password from secure interface (not showing characters, etc).

BIN
doc/headers.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

1232
doc/headers.svg Normal file

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 63 KiB

View file

@ -40,5 +40,7 @@
/* Reads a line (discarding the newline) from stdin. No buffer overflow */
int sflc_safeReadLine(char *buf, size_t bufsize);
/* Reads a password or passphrase (discarding the newline) from stdin in a secure way (no echo) */
int sflc_safeReadPassphrase(char *buf, size_t bufsize);
#endif /* _UTILS_FILE_H_ */

View file

@ -72,7 +72,7 @@ int sflc_cli_open(char *block_device)
/* Gather password */
printf("Enter the password for the most secret volume you want to open: ");
err = sflc_safeReadLine(pwd, SFLC_BIGBUFSIZE); // TODO TOMGAG: replace with sflc_safeReadPassword
err = sflc_safeReadPassphrase(pwd, SFLC_BIGBUFSIZE);
if (err) {
sflc_log_error("Could not read password; error %d", err);
return err;

View file

@ -58,7 +58,24 @@ int sflc_safeReadLine(char *buf, size_t bufsize)
}
// TODO TOMGAG: add sflc_safeReadPassword() to read passwords in a secure way, and add declaration in header .h if needed
// TODO TOMGAG: placeholder for sflc_safeReadPassphrase() to read passwords in a secure way, and add declaration in header .h if needed
int sflc_safeReadPassphrase(char *buf, size_t bufsize)
{
size_t len;
/* Read from stdin */
if (fgets(buf, bufsize, stdin) == NULL) {
sflc_log_error("Could not read from stdin");
return EBADFD;
}
/* Discard newline */
len = strlen(buf);
if (buf[len - 1] == '\n') {
buf[len - 1] = '\0';
}
return 0;
}