Tue, 13 Aug 2019 20:23:23 +0200
fix build on Solaris 10
libidav/crypto.c | file | annotate | diff | comparison | revisions | |
libidav/utils.c | file | annotate | diff | comparison | revisions | |
libidav/versioning.c | file | annotate | diff | comparison | revisions |
--- a/libidav/crypto.c Sun Aug 11 18:41:06 2019 +0200 +++ b/libidav/crypto.c Tue Aug 13 20:23:23 2019 +0200 @@ -355,7 +355,10 @@ char* dav_create_hash(const char *data, size_t len) { unsigned char hash[DAV_SHA256_DIGEST_LENGTH]; - SHA256((const unsigned char*)data, len, hash); + DAV_SHA_CTX ctx; + SHA256_Init(&ctx); + SHA256_Update(&ctx, data, len); + SHA256_Final(hash, &ctx); return util_hexstr(hash, DAV_SHA256_DIGEST_LENGTH); } @@ -374,6 +377,17 @@ free(ctx); } +#if OPENSSL_VERSION_NUMBER < 0x10100000L +static int crypto_pw2key_error = 0; +DavKey* dav_pw2key(const char *password, const unsigned char *salt, int saltlen, int pwfunc, int enc) { + if(!crypto_pw2key_error) { + fprintf(stderr, "Error: password key derivation not supported on this platform: openssl to old\n"); + crypto_pw2key_error = 1; + } + return 0; +} + +#else DavKey* dav_pw2key(const char *password, const unsigned char *salt, int saltlen, int pwfunc, int enc) { if(!password) { return NULL; @@ -430,6 +444,7 @@ memcpy(key->data, keydata, keylen); return key; } +#endif #endif