summaryrefslogtreecommitdiff
path: root/src/crypto_openssl.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2021-10-25 17:14:00 +0300
committerTimo Teräs <timo.teras@iki.fi>2021-11-03 15:37:10 +0200
commit6941aac4c6379bebe7ee0a759f4a4b6df03c3984 (patch)
tree433547a797a841c6ac23bc442c21306bdd1405cb /src/crypto_openssl.c
parent40f08663679246edaa578d87e9f153adaad62a87 (diff)
downloadapk-tools-6941aac4c6379bebe7ee0a759f4a4b6df03c3984.tar.gz
apk-tools-6941aac4c6379bebe7ee0a759f4a4b6df03c3984.tar.bz2
apk-tools-6941aac4c6379bebe7ee0a759f4a4b6df03c3984.tar.xz
apk-tools-6941aac4c6379bebe7ee0a759f4a4b6df03c3984.zip
db, audit: support sha256-160 hashes for v3 pkg compat
Diffstat (limited to 'src/crypto_openssl.c')
-rw-r--r--src/crypto_openssl.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/crypto_openssl.c b/src/crypto_openssl.c
index 73f1879..a9eda6f 100644
--- a/src/crypto_openssl.c
+++ b/src/crypto_openssl.c
@@ -11,6 +11,7 @@ static const char *apk_digest_str[] = {
[APK_DIGEST_NONE] = "none",
[APK_DIGEST_MD5] = "md5",
[APK_DIGEST_SHA1] = "sha1",
+ [APK_DIGEST_SHA256_160] = "sha256-160",
[APK_DIGEST_SHA256] = "sha256",
[APK_DIGEST_SHA512] = "sha512",
};
@@ -26,11 +27,12 @@ const char *apk_digest_alg_str(uint8_t alg)
int apk_digest_alg_len(uint8_t alg)
{
switch (alg) {
- case APK_DIGEST_MD5: return 16;
- case APK_DIGEST_SHA1: return 20;
- case APK_DIGEST_SHA256: return 32;
- case APK_DIGEST_SHA512: return 64;
- default: return 0;
+ case APK_DIGEST_MD5: return 16;
+ case APK_DIGEST_SHA1: return 20;
+ case APK_DIGEST_SHA256_160: return 20;
+ case APK_DIGEST_SHA256: return 32;
+ case APK_DIGEST_SHA512: return 64;
+ default: return 0;
}
}