softhsm-2.2.0-libressl.patch 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. From 13ed52e65f6f07f2c0c2aa70604298c9f983693d Mon Sep 17 00:00:00 2001
  2. From: Alon Bar-Lev <alon.barlev@gmail.com>
  3. Date: Sat, 28 Jan 2017 21:09:05 +0200
  4. Subject: [PATCH] crypto: openssl: libressl support
  5. Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
  6. ---
  7. m4/acx_openssl_gost.m4 | 2 +-
  8. src/lib/crypto/OSSLComp.cpp | 2 +-
  9. src/lib/crypto/OSSLComp.h | 2 +-
  10. src/lib/crypto/OSSLCryptoFactory.cpp | 2 +-
  11. src/lib/crypto/OSSLDHPrivateKey.cpp | 2 +-
  12. src/lib/crypto/OSSLDHPublicKey.cpp | 2 +-
  13. src/lib/crypto/OSSLDSAPrivateKey.cpp | 2 +-
  14. src/lib/crypto/OSSLDSAPublicKey.cpp | 2 +-
  15. src/lib/crypto/OSSLECDH.cpp | 2 +-
  16. src/lib/crypto/OSSLECDSA.cpp | 4 ++--
  17. src/lib/crypto/OSSLRSAPrivateKey.cpp | 2 +-
  18. src/lib/crypto/OSSLRSAPublicKey.cpp | 2 +-
  19. win32/Configure.py | 2 +-
  20. 13 files changed, 14 insertions(+), 14 deletions(-)
  21. diff --git a/m4/acx_openssl_gost.m4 b/m4/acx_openssl_gost.m4
  22. index 2a949f2..dca489b 100644
  23. --- a/m4/acx_openssl_gost.m4
  24. +++ b/m4/acx_openssl_gost.m4
  25. @@ -22,7 +22,7 @@ AC_DEFUN([ACX_OPENSSL_GOST],[
  26. OpenSSL_add_all_algorithms();
  27. /* Load engines */
  28. - #if OPENSSL_VERSION_NUMBER < 0x10100000L
  29. + #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  30. ENGINE_load_builtin_engines();
  31. #else
  32. OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_ALL_BUILTIN | OPENSSL_INIT_LOAD_CONFIG, NULL);
  33. diff --git a/src/lib/crypto/OSSLComp.cpp b/src/lib/crypto/OSSLComp.cpp
  34. index 31333f6..ede710b 100644
  35. --- a/src/lib/crypto/OSSLComp.cpp
  36. +++ b/src/lib/crypto/OSSLComp.cpp
  37. @@ -34,7 +34,7 @@
  38. #include "OSSLComp.h"
  39. #include <openssl/opensslv.h>
  40. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  41. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  42. /*
  43. * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
  44. diff --git a/src/lib/crypto/OSSLComp.h b/src/lib/crypto/OSSLComp.h
  45. index 71d6c21..4bced32 100644
  46. --- a/src/lib/crypto/OSSLComp.h
  47. +++ b/src/lib/crypto/OSSLComp.h
  48. @@ -36,7 +36,7 @@
  49. #include "config.h"
  50. #include <openssl/opensslv.h>
  51. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  52. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  53. #include <openssl/evp.h>
  54. #include <openssl/hmac.h>
  55. diff --git a/src/lib/crypto/OSSLCryptoFactory.cpp b/src/lib/crypto/OSSLCryptoFactory.cpp
  56. index cd7f9d3..41134df 100644
  57. --- a/src/lib/crypto/OSSLCryptoFactory.cpp
  58. +++ b/src/lib/crypto/OSSLCryptoFactory.cpp
  59. @@ -134,7 +134,7 @@ OSSLCryptoFactory::OSSLCryptoFactory()
  60. #ifdef WITH_GOST
  61. // Load engines
  62. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  63. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  64. ENGINE_load_builtin_engines();
  65. #else
  66. OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_ALL_BUILTIN |
  67. diff --git a/src/lib/crypto/OSSLDHPrivateKey.cpp b/src/lib/crypto/OSSLDHPrivateKey.cpp
  68. index 4c1b9c3..5571a88 100644
  69. --- a/src/lib/crypto/OSSLDHPrivateKey.cpp
  70. +++ b/src/lib/crypto/OSSLDHPrivateKey.cpp
  71. @@ -210,7 +210,7 @@ void OSSLDHPrivateKey::createOSSLKey()
  72. }
  73. // Use the OpenSSL implementation and not any engine
  74. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  75. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  76. #ifdef WITH_FIPS
  77. if (FIPS_mode())
  78. diff --git a/src/lib/crypto/OSSLDHPublicKey.cpp b/src/lib/crypto/OSSLDHPublicKey.cpp
  79. index 78820e1..e261726 100644
  80. --- a/src/lib/crypto/OSSLDHPublicKey.cpp
  81. +++ b/src/lib/crypto/OSSLDHPublicKey.cpp
  82. @@ -151,7 +151,7 @@ void OSSLDHPublicKey::createOSSLKey()
  83. }
  84. // Use the OpenSSL implementation and not any engine
  85. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  86. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  87. #ifdef WITH_FIPS
  88. if (FIPS_mode())
  89. diff --git a/src/lib/crypto/OSSLDSAPrivateKey.cpp b/src/lib/crypto/OSSLDSAPrivateKey.cpp
  90. index 2192fad..527e041 100644
  91. --- a/src/lib/crypto/OSSLDSAPrivateKey.cpp
  92. +++ b/src/lib/crypto/OSSLDSAPrivateKey.cpp
  93. @@ -227,7 +227,7 @@ void OSSLDSAPrivateKey::createOSSLKey()
  94. }
  95. // Use the OpenSSL implementation and not any engine
  96. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  97. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  98. #ifdef WITH_FIPS
  99. if (FIPS_mode())
  100. diff --git a/src/lib/crypto/OSSLDSAPublicKey.cpp b/src/lib/crypto/OSSLDSAPublicKey.cpp
  101. index 71ec3bf..38ecc79 100644
  102. --- a/src/lib/crypto/OSSLDSAPublicKey.cpp
  103. +++ b/src/lib/crypto/OSSLDSAPublicKey.cpp
  104. @@ -168,7 +168,7 @@ void OSSLDSAPublicKey::createOSSLKey()
  105. }
  106. // Use the OpenSSL implementation and not any engine
  107. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  108. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  109. #ifdef WITH_FIPS
  110. if (FIPS_mode())
  111. diff --git a/src/lib/crypto/OSSLECDH.cpp b/src/lib/crypto/OSSLECDH.cpp
  112. index 9afbf38..e2abaeb 100644
  113. --- a/src/lib/crypto/OSSLECDH.cpp
  114. +++ b/src/lib/crypto/OSSLECDH.cpp
  115. @@ -187,7 +187,7 @@ bool OSSLECDH::deriveKey(SymmetricKey **ppSymmetricKey, PublicKey* publicKey, Pr
  116. }
  117. // Use the OpenSSL implementation and not any engine
  118. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  119. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  120. #ifdef WITH_FIPS
  121. if (FIPS_mode())
  122. diff --git a/src/lib/crypto/OSSLECDSA.cpp b/src/lib/crypto/OSSLECDSA.cpp
  123. index 80d2386..7387367 100644
  124. --- a/src/lib/crypto/OSSLECDSA.cpp
  125. +++ b/src/lib/crypto/OSSLECDSA.cpp
  126. @@ -78,7 +78,7 @@ bool OSSLECDSA::sign(PrivateKey* privateKey, const ByteString& dataToSign,
  127. }
  128. // Use the OpenSSL implementation and not any engine
  129. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  130. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  131. #ifdef WITH_FIPS
  132. if (FIPS_mode())
  133. @@ -170,7 +170,7 @@ bool OSSLECDSA::verify(PublicKey* publicKey, const ByteString& originalData,
  134. }
  135. // Use the OpenSSL implementation and not any engine
  136. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  137. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  138. #ifdef WITH_FIPS
  139. if (FIPS_mode())
  140. diff --git a/src/lib/crypto/OSSLRSAPrivateKey.cpp b/src/lib/crypto/OSSLRSAPrivateKey.cpp
  141. index 94ec432..26065cf 100644
  142. --- a/src/lib/crypto/OSSLRSAPrivateKey.cpp
  143. +++ b/src/lib/crypto/OSSLRSAPrivateKey.cpp
  144. @@ -289,7 +289,7 @@ void OSSLRSAPrivateKey::createOSSLKey()
  145. }
  146. // Use the OpenSSL implementation and not any engine
  147. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  148. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  149. #ifdef WITH_FIPS
  150. if (FIPS_mode())
  151. diff --git a/src/lib/crypto/OSSLRSAPublicKey.cpp b/src/lib/crypto/OSSLRSAPublicKey.cpp
  152. index 71b1b92..2a6893b 100644
  153. --- a/src/lib/crypto/OSSLRSAPublicKey.cpp
  154. +++ b/src/lib/crypto/OSSLRSAPublicKey.cpp
  155. @@ -133,7 +133,7 @@ void OSSLRSAPublicKey::createOSSLKey()
  156. }
  157. // Use the OpenSSL implementation and not any engine
  158. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  159. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  160. #ifdef WITH_FIPS
  161. if (FIPS_mode())
  162. diff --git a/win32/Configure.py b/win32/Configure.py
  163. index 0a01e0c..2ad652d 100644
  164. --- a/win32/Configure.py
  165. +++ b/win32/Configure.py
  166. @@ -789,7 +789,7 @@ int main() {\n\
  167. ENGINE *eg;\n\
  168. const EVP_MD* EVP_GOST_34_11;\n\
  169. OpenSSL_add_all_algorithms();\n\
  170. -#if OPENSSL_VERSION_NUMBER < 0x10100000L\n\
  171. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)\n\
  172. ENGINE_load_builtin_engines();\n\
  173. #else\n\
  174. OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_ALL_BUILTIN | OPENSSL_INIT_LOAD_CONFIG, NULL);\n\
  175. --
  176. 2.10.2