From d89c219173aeaea174deb8dd7477e1ea7ea71510 Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Sat, 19 Jun 2021 16:09:30 +0300 Subject: reduce misuse of error codes from errno.h --- src/apk_crypto.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/apk_crypto.h') diff --git a/src/apk_crypto.h b/src/apk_crypto.h index 6f6e801..d3ce24b 100644 --- a/src/apk_crypto.h +++ b/src/apk_crypto.h @@ -10,9 +10,9 @@ #define APK_CRYPTO_H #include -#include #include #include +#include "apk_defines.h" #include "apk_openssl.h" // Digest @@ -75,7 +75,7 @@ static inline int apk_digest_calc(struct apk_digest *d, uint8_t alg, const void { unsigned int md_sz = sizeof d->data; if (EVP_Digest(ptr, sz, d->data, &md_sz, apk_digest_alg_to_evp(alg), 0) != 1) - return -EIO; + return -APKE_CRYPTO_ERROR; d->alg = alg; d->len = md_sz; return 0; @@ -98,14 +98,14 @@ static inline void apk_digest_ctx_free(struct apk_digest_ctx *dctx) { } static inline int apk_digest_ctx_update(struct apk_digest_ctx *dctx, const void *ptr, size_t sz) { - return EVP_DigestUpdate(dctx->mdctx, ptr, sz) == 1 ? 0 : -EIO; + return EVP_DigestUpdate(dctx->mdctx, ptr, sz) == 1 ? 0 : -APKE_CRYPTO_ERROR; } static inline int apk_digest_ctx_final(struct apk_digest_ctx *dctx, struct apk_digest *d) { unsigned int mdlen = sizeof d->data; if (EVP_DigestFinal_ex(dctx->mdctx, d->data, &mdlen) != 1) { apk_digest_reset(d); - return -EIO; + return -APKE_CRYPTO_ERROR; } d->alg = dctx->alg; d->len = mdlen; -- cgit v1.2.3-70-g09d2