patch-tls_openssl_gtlsbio_c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. $OpenBSD: patch-tls_openssl_gtlsbio_c,v 1.4 2017/04/30 11:55:52 ajacoutot Exp $
  2. From c7eb9a88a2c3d89140d772c7891955a4db2749a8 Mon Sep 17 00:00:00 2001
  3. From: Antoine Jacoutot <ajacoutot@gnome.org>
  4. Date: Sun, 30 Apr 2017 12:52:00 +0200
  5. Subject: Fix the build with libressl.
  6. --- tls/openssl/gtlsbio.c.orig
  7. +++ tls/openssl/gtlsbio.c
  8. @@ -48,7 +48,7 @@ free_gbio (gpointer user_data)
  9. static int
  10. gtls_bio_create (BIO *bio)
  11. {
  12. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  13. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
  14. bio->init = 0;
  15. bio->num = 0;
  16. bio->ptr = NULL;
  17. @@ -67,7 +67,7 @@ gtls_bio_destroy (BIO *bio)
  18. if (bio == NULL)
  19. return 0;
  20. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  21. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
  22. if (bio->shutdown)
  23. {
  24. if (bio->ptr != NULL)
  25. @@ -105,14 +105,14 @@ gtls_bio_ctrl (BIO *b,
  26. switch (cmd)
  27. {
  28. case BIO_CTRL_GET_CLOSE:
  29. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  30. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
  31. ret = b->shutdown;
  32. #else
  33. ret = BIO_get_shutdown (b);
  34. #endif
  35. break;
  36. case BIO_CTRL_SET_CLOSE:
  37. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  38. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
  39. b->shutdown = (int)num;
  40. #else
  41. BIO_set_shutdown (b, (int)num);
  42. @@ -145,7 +145,7 @@ gtls_bio_write (BIO *bio,
  43. GError *error = NULL;
  44. if (
  45. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  46. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
  47. !bio->init ||
  48. #else
  49. !BIO_get_init (bio) ||
  50. @@ -153,7 +153,7 @@ gtls_bio_write (BIO *bio,
  51. in == NULL || inl == 0)
  52. return 0;
  53. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  54. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
  55. gbio = (GTlsBio *)bio->ptr;
  56. #else
  57. gbio = BIO_get_data (bio);
  58. @@ -187,7 +187,7 @@ gtls_bio_read (BIO *bio,
  59. GError *error = NULL;
  60. if (
  61. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  62. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
  63. !bio->init ||
  64. #else
  65. !BIO_get_init (bio) ||
  66. @@ -195,7 +195,7 @@ gtls_bio_read (BIO *bio,
  67. out == NULL || outl == 0)
  68. return 0;
  69. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  70. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
  71. gbio = (GTlsBio *)bio->ptr;
  72. #else
  73. gbio = BIO_get_data (bio);
  74. @@ -234,7 +234,7 @@ gtls_bio_gets(BIO *bio,
  75. return -1;
  76. }
  77. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  78. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
  79. static BIO_METHOD methods_gtls = {
  80. BIO_TYPE_SOURCE_SINK,
  81. "gtls",
  82. @@ -250,7 +250,7 @@ static BIO_METHOD methods_gtls = {
  83. static BIO_METHOD *methods_gtls = NULL;
  84. #endif
  85. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  86. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
  87. static BIO_METHOD *
  88. BIO_s_gtls (void)
  89. {
  90. @@ -290,7 +290,7 @@ g_tls_bio_new (GIOStream *io_stream)
  91. gbio = g_new0 (GTlsBio, 1);
  92. gbio->io_stream = g_object_ref (io_stream);
  93. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  94. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
  95. ret->ptr = gbio;
  96. ret->init = 1;
  97. #else
  98. @@ -309,7 +309,7 @@ g_tls_bio_set_read_cancellable (BIO *bio,
  99. g_return_if_fail (bio != NULL);
  100. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  101. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
  102. gbio = (GTlsBio *)bio->ptr;
  103. #else
  104. gbio = BIO_get_data (bio);
  105. @@ -325,7 +325,7 @@ g_tls_bio_set_read_blocking (BIO *bio,
  106. g_return_if_fail (bio != NULL);
  107. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  108. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
  109. gbio = (GTlsBio *)bio->ptr;
  110. #else
  111. gbio = BIO_get_data (bio);
  112. @@ -341,7 +341,7 @@ g_tls_bio_set_read_error (BIO *bio,
  113. g_return_if_fail (bio != NULL);
  114. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  115. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
  116. gbio = (GTlsBio *)bio->ptr;
  117. #else
  118. gbio = BIO_get_data (bio);
  119. @@ -357,7 +357,7 @@ g_tls_bio_set_write_cancellable (BIO *bio,
  120. g_return_if_fail (bio != NULL);
  121. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  122. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
  123. gbio = (GTlsBio *)bio->ptr;
  124. #else
  125. gbio = BIO_get_data (bio);
  126. @@ -373,7 +373,7 @@ g_tls_bio_set_write_blocking (BIO *bio,
  127. g_return_if_fail (bio != NULL);
  128. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  129. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
  130. gbio = (GTlsBio *)bio->ptr;
  131. #else
  132. gbio = BIO_get_data (bio);
  133. @@ -389,7 +389,7 @@ g_tls_bio_set_write_error (BIO *bio,
  134. g_return_if_fail (bio != NULL);
  135. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  136. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER)
  137. gbio = (GTlsBio *)bio->ptr;
  138. #else
  139. gbio = BIO_get_data (bio);