diff --git a/sqlite/sqlite/sqlite3.c b/sqlite/sqlite/sqlite3.c index 85c45ac0d..59ea97bee 100644 --- a/sqlite/sqlite/sqlite3.c +++ b/sqlite/sqlite/sqlite3.c @@ -24745,6 +24745,22 @@ int sqlcipher_nss_setup(sqlcipher_provider *p) { #include #include +#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x10000000L +// the function was missed in the header before 777c47acbeecf9602cc465864c9f5f2c609c989d +int PKCS5_PBKDF2_HMAC(const char *pass, int passlen, + const unsigned char *salt, int saltlen, int iter, + const EVP_MD *digest, int keylen, unsigned char *out); + +// HMAC_* functions returned void before 87d52468aa600e02326e13f01331e1f3b8602ed0 +#define HMAC_Init_ex_(...) (HMAC_Init_ex(__VA_ARGS__), 1) +#define HMAC_Update_(...) (HMAC_Update(__VA_ARGS__), 1) +#define HMAC_Final_(...) (HMAC_Final(__VA_ARGS__), 1) +#else +#define HMAC_Init_ex_(...) HMAC_Init_ex(__VA_ARGS__) +#define HMAC_Update_(...) HMAC_Update(__VA_ARGS__) +#define HMAC_Final_(...) HMAC_Final(__VA_ARGS__) +#endif + typedef struct { EVP_CIPHER *evp_cipher; } openssl_ctx; @@ -24918,23 +24934,23 @@ static int sqlcipher_openssl_hmac(void *ctx, int algorithm, unsigned char *hmac_ switch(algorithm) { case SQLCIPHER_HMAC_SHA1: - if(!HMAC_Init_ex(hctx, hmac_key, key_sz, EVP_sha1(), NULL)) goto error; + if(!HMAC_Init_ex_(hctx, hmac_key, key_sz, EVP_sha1(), NULL)) goto error; break; case SQLCIPHER_HMAC_SHA256: - if(!HMAC_Init_ex(hctx, hmac_key, key_sz, EVP_sha256(), NULL)) goto error; + if(!HMAC_Init_ex_(hctx, hmac_key, key_sz, EVP_sha256(), NULL)) goto error; break; case SQLCIPHER_HMAC_SHA512: - if(!HMAC_Init_ex(hctx, hmac_key, key_sz, EVP_sha512(), NULL)) goto error; + if(!HMAC_Init_ex_(hctx, hmac_key, key_sz, EVP_sha512(), NULL)) goto error; break; default: goto error; } - if(!HMAC_Update(hctx, in, in_sz)) goto error; + if(!HMAC_Update_(hctx, in, in_sz)) goto error; if(in2 != NULL) { - if(!HMAC_Update(hctx, in2, in2_sz)) goto error; + if(!HMAC_Update_(hctx, in2, in2_sz)) goto error; } - if(!HMAC_Final(hctx, out, &outlen)) goto error; + if(!HMAC_Final_(hctx, out, &outlen)) goto error; goto cleanup; error: