summaryrefslogtreecommitdiff
path: root/rpmio
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2012-11-30 12:20:05 +0200
committerPanu Matilainen <pmatilai@redhat.com>2012-12-04 12:36:10 +0200
commit95c8cc94e2b69193388d49aa2e96c9bc7914b880 (patch)
tree06c604b59fb5cdd76f441de3fb80c0abf87659f1 /rpmio
parent942c4587fe2c8c12138042fb855fd9e7e0a05314 (diff)
downloadlibrpm-tizen-95c8cc94e2b69193388d49aa2e96c9bc7914b880.tar.gz
librpm-tizen-95c8cc94e2b69193388d49aa2e96c9bc7914b880.tar.bz2
librpm-tizen-95c8cc94e2b69193388d49aa2e96c9bc7914b880.zip
Condence NSS getHashType() a bit, handle SHA224 too
- Not much point in enumurating unsupported cases, or with switch-breaks after returns. - Recognize SHA224 too (cherry picked from commit 466a6b554e7f7ded9f1c59646e6b64243ce16812)
Diffstat (limited to 'rpmio')
-rw-r--r--rpmio/digest_nss.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/rpmio/digest_nss.c b/rpmio/digest_nss.c
index f3ab57f2d..d94d5e733 100644
--- a/rpmio/digest_nss.c
+++ b/rpmio/digest_nss.c
@@ -110,31 +110,15 @@ RPM_GNUC_PURE
static HASH_HashType getHashType(int hashalgo)
{
switch (hashalgo) {
- case PGPHASHALGO_MD5:
- return HASH_AlgMD5;
- break;
- case PGPHASHALGO_MD2:
- return HASH_AlgMD2;
- break;
- case PGPHASHALGO_SHA1:
- return HASH_AlgSHA1;
- break;
- case PGPHASHALGO_SHA256:
- return HASH_AlgSHA256;
- break;
- case PGPHASHALGO_SHA384:
- return HASH_AlgSHA384;
- break;
- case PGPHASHALGO_SHA512:
- return HASH_AlgSHA512;
- break;
- case PGPHASHALGO_RIPEMD160:
- case PGPHASHALGO_TIGER192:
- case PGPHASHALGO_HAVAL_5_160:
- default:
- return HASH_AlgNULL;
- break;
+ case PGPHASHALGO_MD5: return HASH_AlgMD5;
+ case PGPHASHALGO_MD2: return HASH_AlgMD2;
+ case PGPHASHALGO_SHA1: return HASH_AlgSHA1;
+ case PGPHASHALGO_SHA224: return HASH_AlgSHA224;
+ case PGPHASHALGO_SHA256: return HASH_AlgSHA256;
+ case PGPHASHALGO_SHA384: return HASH_AlgSHA384;
+ case PGPHASHALGO_SHA512: return HASH_AlgSHA512;
}
+ return HASH_AlgNULL;
}
size_t rpmDigestLength(int hashalgo)