diff options
author | Jeffrey Hutzelman <jhutz@cmu.edu> | 2008-01-14 22:34:08 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-01-14 22:34:08 -0500 |
commit | 8c14e42a71cb332361e83815028f92ac72550ef3 (patch) | |
tree | 9405cf9283e47bd6277f75487f8f11d90f49c48b | |
parent | aafc46f5fb1f7e9fc57e21089f708dc0eb3540cd (diff) | |
download | syslinux-8c14e42a71cb332361e83815028f92ac72550ef3.tar.gz |
SHA1 passwords: initialize the context before salting
Need to initialize the SHA-1 context before we add the salt.
-rw-r--r-- | com32/modules/menumain.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/com32/modules/menumain.c b/com32/modules/menumain.c index 8c8b91ed..fad49a28 100644 --- a/com32/modules/menumain.c +++ b/com32/modules/menumain.c @@ -299,6 +299,8 @@ static int passwd_compare_sha1(const char *passwd, const char *entry) SHA1_CTX ctx; unsigned char sha1[20], pwdsha1[20]; + SHA1Init(&ctx); + if ( (p = strchr(passwd+3, '$')) ) { SHA1Update(&ctx, (void *)passwd+3, p-(passwd+3)); p++; @@ -306,8 +308,6 @@ static int passwd_compare_sha1(const char *passwd, const char *entry) p = passwd+3; /* Assume no salt */ } - SHA1Init(&ctx); - SHA1Update(&ctx, (void *)entry, strlen(entry)); SHA1Final(sha1, &ctx); |