2
0

openssl_bio_compat.h 886 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef OPENSSL_BIO_COMPAT_H
  2. #define OPENSSL_BIO_COMPAT_H
  3. #include <openssl/opensslv.h>
  4. #if OPENSSL_VERSION_NUMBER < 0x10100000L
  5. #include <openssl/bio.h>
  6. #include <string.h>
  7. #define BIO_get_data(b) (b->ptr)
  8. #define BIO_set_data(b, v) (b->ptr = v)
  9. #define BIO_set_init(b, v) (b->init = v)
  10. #define BIO_meth_set_write(m, f) (m->bwrite = f)
  11. #define BIO_meth_set_read(m, f) (m->bread = f)
  12. #define BIO_meth_set_puts(m, f) (m->bputs = f)
  13. #define BIO_meth_set_gets(m, f) (m->bgets = f)
  14. #define BIO_meth_set_ctrl(m, f) (m->ctrl = f)
  15. #define BIO_meth_set_create(m, f) (m->create = f)
  16. #define BIO_meth_set_destroy(m, f) (m->destroy = f)
  17. static inline BIO_METHOD *BIO_meth_new(int type, const char *name)
  18. {
  19. BIO_METHOD *bm = calloc(1, sizeof(BIO_METHOD));
  20. if (bm) {
  21. bm->type = type;
  22. bm->name = name;
  23. }
  24. return bm;
  25. }
  26. #endif /* OPENSSL_VERSION_NUMBER */
  27. #endif /* OPENSSL_BIO_COMPAT_H */