npm

Nihal's Password Manager (WIP)
git clone git://git.nihaljere.xyz/npm
Log | Files | Refs | LICENSE

commit 919df0de6dfdeacbacbc0beb9475bc87f6971155
parent be5768c10555d88d2fe96a3c185fea3b91307b2c
Author: Nihal Jere <nihal@nihaljere.xyz>
Date:   Mon,  4 Oct 2021 18:35:44 -0500

fix warnings

Diffstat:
Mnpm-agent.c | 12+++++-------
Mnpm-core.c | 15+++++++--------
2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/npm-agent.c b/npm-agent.c @@ -45,8 +45,6 @@ char *inptr = inbuf; size_t inlen; struct pollfd fds[3]; -int cstdin, cstdout; // stdin, out from the core - int xwrite(int fd, char *buf, size_t count) { @@ -190,7 +188,7 @@ set_timer() } } -int +void agent() { int status; @@ -201,21 +199,21 @@ agent() } // if the password is wrong, we don't cache it - if (status = run_core()) { - clear_encryptor(); + if ((status = run_core()) != 0) { + clear_master(); } } bool running = true; void -handler(int sig) +handler() { running = false; } int -main(int argc, char *argv[]) +main() { struct sockaddr_un sockaddr = { .sun_family = AF_UNIX, diff --git a/npm-core.c b/npm-core.c @@ -14,10 +14,10 @@ char *argv0; -char plain[PASSWORD_MAX_LEN + 1]; -char cipher[PASSWORD_MAX_LEN + 1]; -char master[PASSWORD_MAX_LEN + 1]; -char key[KEY_LEN]; +uint8_t plain[PASSWORD_MAX_LEN + 1]; +uint8_t cipher[PASSWORD_MAX_LEN + 1]; +uint8_t master[PASSWORD_MAX_LEN + 1]; +uint8_t key[KEY_LEN]; uint8_t mac[MAC_LEN]; uint8_t data[SALT_LEN + NONCE_LEN]; uint8_t *salt = data; @@ -37,10 +37,10 @@ clear() } ssize_t -get_password(char *buf) +get_password(uint8_t *buf) { int ret; - char *ptr = buf; + uint8_t *ptr = buf; while (ptr - buf < PASSWORD_MAX_LEN) { ret = fgetc(stdin); if (ret == EOF) { @@ -70,7 +70,6 @@ usage() } int main(int argc, char *argv[]) { - char *c; size_t len; FILE *file = NULL; @@ -209,7 +208,7 @@ int main(int argc, char *argv[]) { goto fail; } - puts(plain); + puts((char *)plain); fclose(file); }