sbsigntools-0.9.1-openssl-1.1.0-compat.patch 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. diff --git a/src/fileio.c b/src/fileio.c
  2. index 032eb1e..09bc3aa 100644
  3. --- a/src/fileio.c
  4. +++ b/src/fileio.c
  5. @@ -40,6 +40,7 @@
  6. #include <openssl/pem.h>
  7. #include <openssl/err.h>
  8. #include <openssl/engine.h>
  9. +#include <openssl/ui.h>
  10. #include <ccan/talloc/talloc.h>
  11. #include <ccan/read_write_all/read_write_all.h>
  12. diff --git a/src/idc.c b/src/idc.c
  13. index 236cefd..6d87bd4 100644
  14. --- a/src/idc.c
  15. +++ b/src/idc.c
  16. @@ -238,7 +238,11 @@ struct idc *IDC_get(PKCS7 *p7, BIO *bio)
  17. /* extract the idc from the signed PKCS7 'other' data */
  18. str = p7->d.sign->contents->d.other->value.asn1_string;
  19. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  20. idcbuf = buf = ASN1_STRING_data(str);
  21. +#else
  22. + idcbuf = buf = ASN1_STRING_get0_data(str);
  23. +#endif
  24. idc = d2i_IDC(NULL, &buf, ASN1_STRING_length(str));
  25. /* If we were passed a BIO, write the idc data, minus type and length,
  26. @@ -289,7 +293,11 @@ int IDC_check_hash(struct idc *idc, struct image *image)
  27. }
  28. /* check hash against the one we calculated from the image */
  29. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  30. buf = ASN1_STRING_data(str);
  31. +#else
  32. + buf = ASN1_STRING_get0_data(str);
  33. +#endif
  34. if (memcmp(buf, sha, sizeof(sha))) {
  35. fprintf(stderr, "Hash doesn't match image\n");
  36. fprintf(stderr, " got: %s\n", sha256_str(buf));
  37. diff --git a/src/sbattach.c b/src/sbattach.c
  38. index a0c01b8..e89a23e 100644
  39. --- a/src/sbattach.c
  40. +++ b/src/sbattach.c
  41. @@ -231,6 +231,7 @@ int main(int argc, char **argv)
  42. return EXIT_FAILURE;
  43. }
  44. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  45. ERR_load_crypto_strings();
  46. OpenSSL_add_all_digests();
  47. OPENSSL_config(NULL);
  48. @@ -239,6 +240,7 @@ int main(int argc, char **argv)
  49. * module isn't present). In either case ignore the errors
  50. * (malloc will cause other failures out lower down */
  51. ERR_clear_error();
  52. +#endif
  53. image = image_load(image_filename);
  54. if (!image) {
  55. diff --git a/src/sbkeysync.c b/src/sbkeysync.c
  56. index 7b17f40..419b1e7 100644
  57. --- a/src/sbkeysync.c
  58. +++ b/src/sbkeysync.c
  59. @@ -208,7 +208,11 @@ static int x509_key_parse(struct key *key, uint8_t *data, size_t len)
  60. goto out;
  61. key->id_len = ASN1_STRING_length(serial);
  62. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  63. key->id = talloc_memdup(key, ASN1_STRING_data(serial), key->id_len);
  64. +#else
  65. + key->id = talloc_memdup(key, ASN1_STRING_get0_data(serial), key->id_len);
  66. +#endif
  67. key->description = talloc_array(key, char, description_len);
  68. X509_NAME_oneline(X509_get_subject_name(x509),
  69. @@ -927,6 +931,7 @@ int main(int argc, char **argv)
  70. return EXIT_FAILURE;
  71. }
  72. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  73. ERR_load_crypto_strings();
  74. OpenSSL_add_all_digests();
  75. OpenSSL_add_all_ciphers();
  76. @@ -936,6 +941,7 @@ int main(int argc, char **argv)
  77. * module isn't present). In either case ignore the errors
  78. * (malloc will cause other failures out lower down */
  79. ERR_clear_error();
  80. +#endif
  81. ctx->filesystem_keys = init_keyset(ctx);
  82. ctx->firmware_keys = init_keyset(ctx);
  83. diff --git a/src/sbsign.c b/src/sbsign.c
  84. index ff1fdfd..78d8d64 100644
  85. --- a/src/sbsign.c
  86. +++ b/src/sbsign.c
  87. @@ -188,6 +188,7 @@ int main(int argc, char **argv)
  88. talloc_steal(ctx, ctx->image);
  89. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  90. ERR_load_crypto_strings();
  91. OpenSSL_add_all_digests();
  92. OpenSSL_add_all_ciphers();
  93. @@ -197,6 +198,7 @@ int main(int argc, char **argv)
  94. * module isn't present). In either case ignore the errors
  95. * (malloc will cause other failures out lower down */
  96. ERR_clear_error();
  97. +#endif
  98. if (engine)
  99. pkey = fileio_read_engine_key(engine, keyfilename);
  100. else
  101. diff --git a/src/sbvarsign.c b/src/sbvarsign.c
  102. index 7dcbe51..9319c8b 100644
  103. --- a/src/sbvarsign.c
  104. +++ b/src/sbvarsign.c
  105. @@ -509,6 +509,7 @@ int main(int argc, char **argv)
  106. return EXIT_FAILURE;
  107. }
  108. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  109. /* initialise openssl */
  110. OpenSSL_add_all_digests();
  111. OpenSSL_add_all_ciphers();
  112. @@ -519,6 +520,7 @@ int main(int argc, char **argv)
  113. * module isn't present). In either case ignore the errors
  114. * (malloc will cause other failures out lower down */
  115. ERR_clear_error();
  116. +#endif
  117. /* set up the variable signing context */
  118. varname = argv[optind];
  119. diff --git a/src/sbverify.c b/src/sbverify.c
  120. index 3920d91..d0b203a 100644
  121. --- a/src/sbverify.c
  122. +++ b/src/sbverify.c
  123. @@ -250,6 +250,7 @@ int main(int argc, char **argv)
  124. verbose = false;
  125. detached_sig_filename = NULL;
  126. +#if OPENSSL_VERSION_NUMBER < 0x10100000L
  127. OpenSSL_add_all_digests();
  128. ERR_load_crypto_strings();
  129. OPENSSL_config(NULL);
  130. @@ -258,6 +259,7 @@ int main(int argc, char **argv)
  131. * module isn't present). In either case ignore the errors
  132. * (malloc will cause other failures out lower down */
  133. ERR_clear_error();
  134. +#endif
  135. for (;;) {
  136. int idx;