Skip to content

Commit 2126403

Browse files
authored
Merge pull request #201 from anhu/update_for_102
2 parents cca600e + d47a68a commit 2126403

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

examples/conf_example.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,19 @@
2020
*/
2121

2222
#include <stdio.h>
23-
23+
#include <openssl/conf.h>
2424
#include <openssl/engine.h>
2525

26+
/* From https://www.openssl.org/docs/man3.0/man3/EVP_MD_CTX_new.html:
27+
*
28+
* The EVP_MD_CTX_create() and EVP_MD_CTX_destroy() functions were renamed to
29+
* EVP_MD_CTX_new() and EVP_MD_CTX_free() in OpenSSL 1.1.0, respectively.
30+
*/
31+
#if OPENSSL_VERSION_NUMBER < 0x10100000L
32+
#define EVP_MD_CTX_new EVP_MD_CTX_create
33+
#define EVP_MD_CTX_free EVP_MD_CTX_destroy
34+
#endif
35+
2636
int main()
2737
{
2838
unsigned char someData[] = {0xDE, 0xAD, 0xBE, 0xEF};
@@ -37,9 +47,13 @@ int main()
3747
* OPENSSL_CONF). This will load wolfEngine and make it the default engine
3848
* for all the algorithms it provides. See wolfEngine.conf for more.
3949
*/
50+
#if OPENSSL_VERSION_NUMBER < 0x10100000
51+
OPENSSL_config(NULL);
52+
#else
4053
OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS |
4154
OPENSSL_INIT_ADD_ALL_DIGESTS |
4255
OPENSSL_INIT_LOAD_CONFIG, NULL);
56+
#endif
4357

4458
/*
4559
* Compute a digest/hash over the data in the "someData" buffer. wolfEngine
@@ -96,4 +110,3 @@ int main()
96110

97111
return 0;
98112
}
99-

examples/engine_by_id_example.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@
2323

2424
#include <openssl/engine.h>
2525

26+
/* From https://www.openssl.org/docs/man3.0/man3/EVP_MD_CTX_new.html:
27+
*
28+
* The EVP_MD_CTX_create() and EVP_MD_CTX_destroy() functions were renamed to
29+
* EVP_MD_CTX_new() and EVP_MD_CTX_free() in OpenSSL 1.1.0, respectively.
30+
*/
31+
#if OPENSSL_VERSION_NUMBER < 0x10100000L
32+
#define EVP_MD_CTX_new EVP_MD_CTX_create
33+
#define EVP_MD_CTX_free EVP_MD_CTX_destroy
34+
#endif
35+
2636
int main()
2737
{
2838
ENGINE* wolfEngine = NULL;

0 commit comments

Comments
 (0)