diff -r 64ded9f6a6c6 -r 6606616eca9f libidav/crypto.h --- a/libidav/crypto.h Tue Feb 25 21:11:00 2025 +0100 +++ b/libidav/crypto.h Sat Apr 05 16:46:11 2025 +0200 @@ -74,14 +74,20 @@ #else /* unix/linux */ +#include +#include + #define DAV_USE_OPENSSL #define DAV_AES_CTX EVP_CIPHER_CTX* + +#if OPENSSL_VERSION_NUMBER < 0x30000000L #define DAV_SHA_CTX SHA256_CTX +#else +#define DAV_SHA_CTX EVP_MD_CTX* +#endif #define DAV_SHA256_DIGEST_LENGTH 32 -#include -#include #if defined(__sun) && defined(__SunOS_5_10) #include @@ -149,9 +155,10 @@ char* dav_create_hash(const char *data, size_t len); -DAV_SHA_CTX* dav_hash_init(void); -void dav_hash_update(DAV_SHA_CTX *ctx, const char *data, size_t len); -void dav_hash_final(DAV_SHA_CTX *ctx, unsigned char *buf); +void dav_sha256_init(DAV_SHA_CTX *ctx); +DAV_SHA_CTX* dav_sha256_create(void); +void dav_sha256_update(DAV_SHA_CTX *ctx, const char *data, size_t len); +void dav_sha256_final(DAV_SHA_CTX *ctx, unsigned char *buf); DavKey* dav_pw2key(const char *password, const unsigned char *salt, int saltlen, int pwfunc, int enc);