From cc3711077d44584403d951757efe3577913e832c Mon Sep 17 00:00:00 2001 From: Tomas Mlcoch Date: Wed, 14 Aug 2013 10:27:02 +0200 Subject: [PATCH] checksum: Set SHA to be the same as SHA1 (For compatibility with original Createrepo) --- README.md | 5 +++++ src/checksum.c | 4 ++-- src/checksum.h | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 48fc715..3fbf47b 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,11 @@ Note: The C tests have to be builded by ``make tests``)! [Bugzilla](https://bugzilla.redhat.com/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&bug_status=MODIFIED&bug_status=VERIFIED&component=createrepo_c&query_format=advanced) +### Important notes + +In original createrepo ``sha`` is a nickname for the ``sha1`` checksum. +Createrepo_c mimics this behaviour. + --------------------------------------------------- # Differences in behavior between createrepo_c and createrepo diff --git a/src/checksum.c b/src/checksum.c index 1bfe1b2..77bc4ce 100644 --- a/src/checksum.c +++ b/src/checksum.c @@ -123,7 +123,7 @@ cr_checksum_file(const char *filename, switch (type) { //case CR_CHECKSUM_MD2: ctx_type = EVP_md2(); break; case CR_CHECKSUM_MD5: ctx_type = EVP_md5(); break; - case CR_CHECKSUM_SHA: ctx_type = EVP_sha(); break; + case CR_CHECKSUM_SHA: ctx_type = EVP_sha1(); break; case CR_CHECKSUM_SHA1: ctx_type = EVP_sha1(); break; case CR_CHECKSUM_SHA224: ctx_type = EVP_sha224(); break; case CR_CHECKSUM_SHA256: ctx_type = EVP_sha256(); break; @@ -189,7 +189,7 @@ cr_checksum_new(cr_ChecksumType type, GError **err) switch (type) { //case CR_CHECKSUM_MD2: ctx_type = EVP_md2(); break; case CR_CHECKSUM_MD5: ctx_type = EVP_md5(); break; - case CR_CHECKSUM_SHA: ctx_type = EVP_sha(); break; + case CR_CHECKSUM_SHA: ctx_type = EVP_sha1(); break; case CR_CHECKSUM_SHA1: ctx_type = EVP_sha1(); break; case CR_CHECKSUM_SHA224: ctx_type = EVP_sha224(); break; case CR_CHECKSUM_SHA256: ctx_type = EVP_sha256(); break; diff --git a/src/checksum.h b/src/checksum.h index a7962f5..d96c734 100644 --- a/src/checksum.h +++ b/src/checksum.h @@ -35,6 +35,8 @@ typedef struct _cr_ChecksumCtx cr_ChecksumCtx; /** * Enum of supported checksum types. + * Note: SHA is just a "nickname" for the SHA1. This + * is for the compatibility with original createrepo. */ typedef enum { CR_CHECKSUM_UNKNOWN, /*!< Unknown checksum */ -- 2.7.4