summaryrefslogtreecommitdiffstats
path: root/3rd_party/libsrp6a-sha512/t_sha.h
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2023-07-04 17:14:27 +0200
committerGravatar Nikias Bassen2023-07-04 17:14:27 +0200
commit474fd9284b76d8ddd3a3aec41cbca3cc48271cc1 (patch)
tree58fcb909dff8cee2d2121d17bf0643fad6a8e766 /3rd_party/libsrp6a-sha512/t_sha.h
parent52ab7b76f76ee0464fd150ec881ce50fbf2dc001 (diff)
downloadlibimobiledevice-474fd9284b76d8ddd3a3aec41cbca3cc48271cc1.tar.gz
libimobiledevice-474fd9284b76d8ddd3a3aec41cbca3cc48271cc1.tar.bz2
3rd_party/libsrp6a-sha512: Updated to work with OpenSSL 3.0+ API
Diffstat (limited to '3rd_party/libsrp6a-sha512/t_sha.h')
-rw-r--r--3rd_party/libsrp6a-sha512/t_sha.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/3rd_party/libsrp6a-sha512/t_sha.h b/3rd_party/libsrp6a-sha512/t_sha.h
index 18deec5..2e38067 100644
--- a/3rd_party/libsrp6a-sha512/t_sha.h
+++ b/3rd_party/libsrp6a-sha512/t_sha.h
@@ -38,6 +38,28 @@
#endif
#ifdef OPENSSL_SHA
+#include <openssl/err.h>
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+#include <openssl/evp.h>
+
+typedef EVP_MD_CTX* SHA1_CTX;
+#define SHA1Init SHA1Init_openssl
+#define SHA1Update SHA1Update_openssl
+#define SHA1Final SHA1Final_openssl
+
+typedef EVP_MD_CTX* SHA512_CTX;
+#define SHA512Init SHA512Init_openssl
+#define SHA512Update SHA512Update_openssl
+#define SHA512Final SHA512Final_openssl
+
+void SHA1Init_openssl(SHA1_CTX *ctx);
+void SHA1Update_openssl(SHA1_CTX *ctx, const void *data, unsigned int len);
+void SHA1Final_openssl(unsigned char digest[20], SHA1_CTX *ctx);
+
+void SHA512Init_openssl(SHA512_CTX *ctx);
+void SHA512Update_openssl(SHA512_CTX *ctx, const void *data, unsigned int len);
+void SHA512Final_openssl(unsigned char digest[64], SHA1_CTX *ctx);
+#else /* for OpenSSL < 3.0 */
#include <openssl/sha.h>
typedef SHA_CTX SHA1_CTX;
@@ -48,7 +70,7 @@ typedef SHA_CTX SHA1_CTX;
#define SHA512Init SHA512_Init
#define SHA512Update SHA512_Update
#define SHA512Final SHA512_Final
-
+#endif /* for OpenSSL < 3.0 */
#elif defined(TOMCRYPT_SHA)
/* mycrypt.h already included above */