diff options
author | Andrew Fyfe <andrew@neptune-one.net> | 2007-07-25 22:49:32 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-08-16 13:17:33 -0400 |
commit | 1cb6d80631359306d70bbe5fbcbbca1474594ada (patch) | |
tree | 61348cf98beac7febbe0558a353f2cec46930315 /lib/libalpm/add.c | |
parent | ba67fdae63122b40d8fb4abf9c1c7695999f143d (diff) | |
download | pacman-1cb6d80631359306d70bbe5fbcbbca1474594ada.tar.xz |
Clean up MD5 code.
* Move alpm md5 functions to lib/libalpm/util.c
* Remove unneeded includes for md5.h
* Replace md5 implementation with one from http://www.xyssl.org
Dan: clean up XySSL code by removing parts we don't use, and add a note
saying what changed.
Dan: fix alpm_get_md5sum, off by one error on the malloc call and other
small things.
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/add.c')
-rw-r--r-- | lib/libalpm/add.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 5c8f944b..d2b0c582 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -41,7 +41,6 @@ #include "util.h" #include "error.h" #include "cache.h" -#include "md5.h" #include "log.h" #include "backup.h" #include "package.h" @@ -510,8 +509,8 @@ static int extract_single_file(struct archive *archive, return(1); } - hash_local = _alpm_MDFile(filename); - hash_pkg = _alpm_MDFile(tempfile); + hash_local = alpm_get_md5sum(filename); + hash_pkg = alpm_get_md5sum(tempfile); /* append the new md5 hash to it's respective entry * in newpkg's backup (it will be the new orginal) */ @@ -523,7 +522,8 @@ static int extract_single_file(struct archive *archive, return(0); } char *backup = NULL; - int backup_len = strlen(oldbackup) + 34; /* tab char, null byte and MD5 (32 char) */ + /* length is tab char, null byte and MD5 (32 char) */ + int backup_len = strlen(oldbackup) + 34; backup = malloc(backup_len); if(!backup) { RET_ERR(PM_ERR_MEMORY, -1); @@ -655,14 +655,15 @@ static int extract_single_file(struct archive *archive, for(b = alpm_pkg_get_backup(newpkg); b; b = b->next) { char *backup = NULL, *hash = NULL; char *oldbackup = alpm_list_getdata(b); - int backup_len = strlen(oldbackup) + 34; /* tab char, null byte and MD5 (32 char) */ + /* length is tab char, null byte and MD5 (32 char) */ + int backup_len = strlen(oldbackup) + 34; if(!oldbackup || strcmp(oldbackup, entryname) != 0) { return(0); } _alpm_log(PM_LOG_DEBUG, "appending backup entry for %s", filename); - hash = _alpm_MDFile(filename); + hash = alpm_get_md5sum(filename); backup = malloc(backup_len); if(!backup) { RET_ERR(PM_ERR_MEMORY, -1); |