* added sha256,sha384 and sha512

* updated docs

--HG--
extra : convert_revision : svn%3Aeebe1cee-a9af-4fe4-bd26-ad572b19c5ab/trunk%4039
This commit is contained in:
mathias 2005-12-25 09:30:25 +00:00
parent 5ea8c86f97
commit 569a19488c
11 changed files with 1212 additions and 47 deletions

View file

@ -1,4 +1,8 @@
Version 1.0 Version 1.0
2005-12-25:
* added -auth sha256
* added -auth sha384
* added -auth sha512
2005-08-12: 2005-08-12:

2
README
View file

@ -1,7 +1,7 @@
alock - README alock - README
============== ==============
Mathias Gumz <akira@fluxbox.org> Mathias Gumz <akira@fluxbox.org>
v1.0, 01 June 2005 v1.0, 25 December 2005
About About
----- -----

View file

@ -54,6 +54,7 @@ alock_options.AddOptions(
BoolOption('amd5', 'build a little md5-helper', 0), BoolOption('amd5', 'build a little md5-helper', 0),
BoolOption('asha1', 'build a little sha1-helper', 0), BoolOption('asha1', 'build a little sha1-helper', 0),
BoolOption('asha2', 'build a little sha2-helper', 0),
PathOption('PREFIX', 'install-path base', '/usr/local'), PathOption('PREFIX', 'install-path base', '/usr/local'),
PathOption('DESTDIR', 'install to $DESTDIR/$PREFIX', '/') PathOption('DESTDIR', 'install to $DESTDIR/$PREFIX', '/')
@ -192,6 +193,9 @@ if alock_env['amd5']:
if alock_env['asha1']: if alock_env['asha1']:
default_targets += [ 'src/asha1' ] default_targets += [ 'src/asha1' ]
if alock_env['asha2']:
default_targets += [ 'src/asha2' ]
Default(default_targets) Default(default_targets)
alock_options.Save('scons.opts', alock_env) alock_options.Save('scons.opts', alock_env)

View file

@ -1,7 +1,7 @@
ALOCK(1) ALOCK(1)
======== ========
Mathias Gumz <akira@fluxbox.org> Mathias Gumz <akira@fluxbox.org>
v1.0, ?? May 2005 v1.0, 25 December 2005
NAME NAME
---- ----
@ -42,6 +42,17 @@ OPTIONS
- sha1 - alock creates a sha1-hash from the entered unlockpassword and compares it with the hash provided - sha1 - alock creates a sha1-hash from the entered unlockpassword and compares it with the hash provided
* hash=<hash> - use <hash> as reference * hash=<hash> - use <hash> as reference
* file=<filename> - use <filename> as reference * file=<filename> - use <filename> as reference
- sha256 - alock creates a sha256-hash from the entered unlockpassword and compares it with the hash provided
* hash=<hash> - use <hash> as reference
* file=<filename> - use <filename> as reference
- sha384 - alock creates a sha384-hash from the entered unlockpassword and compares it with the hash provided
* hash=<hash> - use <hash> as reference
* file=<filename> - use <filename> as reference
- sha512 - alock creates a sha512-hash from the entered unlockpassword and compares it with the hash provided
* hash=<hash> - use <hash> as reference
* file=<filename> - use <filename> as reference
-bg type:options :: -bg type:options ::
Define the type of alock should handle the background: Define the type of alock should handle the background:

View file

@ -10,7 +10,7 @@ def createManPage(target, source, env):
def createHtml(target, source, env): def createHtml(target, source, env):
"""Creates a html-site via asciidoc.""" """Creates a html-site via asciidoc."""
os.system('asciidoc -d manpage -b xhtml -o ' + str(target[0]) + ' ' + os.system('asciidoc -d manpage -b xhtml11 -o ' + str(target[0]) + ' ' +
str(source[0])) str(source[0]))
def prefixCombiner(prefix, itemlist, glue=''): def prefixCombiner(prefix, itemlist, glue=''):

View file

@ -18,7 +18,7 @@ build = alock_env.Copy()
if build['passwd']: if build['passwd']:
auth_sources += [ 'auth_passwd.c' ] auth_sources += [ 'auth_passwd.c' ]
if build['hash']: if build['hash']:
auth_sources += [ 'auth_md5.c', 'auth_sha1.c' ] auth_sources += [ 'auth_md5.c', 'auth_sha1.c', 'auth_sha2.c' ]
if build['pam']: if build['pam']:
auth_sources += [ 'auth_pam.c' ] auth_sources += [ 'auth_pam.c' ]
@ -37,13 +37,18 @@ alock_sources += auth_sources + bg_sources + cursor_sources
alock = build.Program('alock', alock_sources) alock = build.Program('alock', alock_sources)
if build['amd5']: if build['amd5']:
md5 = alock_env.Copy() md5 = Environment()
md5.AppendUnique(CPPDEFINES = [ 'STAND_ALONE' ]) md5.AppendUnique(CPPDEFINES = [ 'STAND_ALONE' ])
md5.Program('amd5', md5.StaticObject(target = 'amd5.o', source = 'auth_md5.c')) md5.Program('amd5', md5.StaticObject(target = 'amd5.o', source = 'auth_md5.c'))
if build['asha1']: if build['asha1']:
sha1 = alock_env.Copy() sha1 = Environment()
sha1.AppendUnique(CPPDEFINES = [ 'STAND_ALONE' ]) sha1.AppendUnique(CPPDEFINES = [ 'STAND_ALONE' ])
sha1.Program('asha1', sha1.StaticObject(target = 'asha1', source = 'auth_sha1.c')) sha1.Program('asha1', sha1.StaticObject(target = 'asha1', source = 'auth_sha1.c'))
if build['asha2']:
sha1 = Environment()
sha1.AppendUnique(CPPDEFINES = [ 'STAND_ALONE' ])
sha1.Program('asha2', sha1.StaticObject(target = 'asha2', source = 'auth_sha2.c'))
# vim:ft=python # vim:ft=python

View file

@ -36,6 +36,9 @@ extern struct aAuth alock_auth_none;
#ifdef HASH_PWD #ifdef HASH_PWD
extern struct aAuth alock_auth_md5; extern struct aAuth alock_auth_md5;
extern struct aAuth alock_auth_sha1; extern struct aAuth alock_auth_sha1;
extern struct aAuth alock_auth_sha256;
extern struct aAuth alock_auth_sha384;
extern struct aAuth alock_auth_sha512;
#endif /* HASH_PWD */ #endif /* HASH_PWD */
#ifdef PASSWD_PWD #ifdef PASSWD_PWD
extern struct aAuth alock_auth_passwd; extern struct aAuth alock_auth_passwd;
@ -55,6 +58,9 @@ static struct aAuth* alock_authmodules[] = {
#ifdef HASH_PWD #ifdef HASH_PWD
&alock_auth_md5, &alock_auth_md5,
&alock_auth_sha1, &alock_auth_sha1,
&alock_auth_sha256,
&alock_auth_sha384,
&alock_auth_sha512,
#endif /* HASH_PWD */ #endif /* HASH_PWD */
NULL NULL
}; };

View file

@ -418,7 +418,6 @@ int main(int argc, char* argv[]) {
} }
md5_final(digest, &md5); md5_final(digest, &md5);
printf("\n");
for(i = 0; i < MD5_DIGEST_LENGTH; ++i) for(i = 0; i < MD5_DIGEST_LENGTH; ++i)
printf("%02x", digest[i]); printf("%02x", digest[i]);
printf("\n"); printf("\n");

View file

@ -264,7 +264,7 @@ static int alock_auth_sha1_init(const char* args) {
} }
fclose(hashfile); fclose(hashfile);
} else { } else {
printf("alock: error, couldnt read [%s] for [md5].\n", printf("alock: error, couldnt read [%s] for [sha1].\n",
&arg[5]); &arg[5]);
free(arguments); free(arguments);
return 0; return 0;
@ -354,7 +354,6 @@ int main(int argc, char* argv[]) {
} }
sha1_final(digest, &sha1); sha1_final(digest, &sha1);
printf("\n");
for(i = 0; i < SHA1_DIGEST_LENGTH; ++i) for(i = 0; i < SHA1_DIGEST_LENGTH; ++i)
printf("%02x", digest[i]); printf("%02x", digest[i]);
printf("\n"); printf("\n");

1137
src/auth_sha2.c Normal file

File diff suppressed because it is too large Load diff