diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2021-08-10 21:41:05 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2021-08-24 14:09:10 -0400 |
commit | 150eddd9425c060d617915d1989bde8532aeb5a2 (patch) | |
tree | 827d33b1b3d8d08da8f94c4418970b72ca475401 /src/streams/openssl_legacy.h | |
parent | a09d4367495fb8a1300aeea5fd6ee22f26745ec8 (diff) | |
download | libgit2-150eddd9425c060d617915d1989bde8532aeb5a2.tar.gz |
openssl: separate legacy api
Refactor the OpenSSL stream implementation so that the legacy code is better
abstracted. This will enable future development.
Diffstat (limited to 'src/streams/openssl_legacy.h')
-rw-r--r-- | src/streams/openssl_legacy.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/streams/openssl_legacy.h b/src/streams/openssl_legacy.h new file mode 100644 index 000000000..7ccc13838 --- /dev/null +++ b/src/streams/openssl_legacy.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) the libgit2 contributors. All rights reserved. + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ +#ifndef INCLUDE_streams_openssl_legacy_h__ +#define INCLUDE_streams_openssl_legacy_h__ + +#ifdef GIT_OPENSSL +# include <openssl/ssl.h> +# include <openssl/err.h> +# include <openssl/x509v3.h> +# include <openssl/bio.h> + +# if (defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x10100000L) || \ + (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L) +# define GIT_OPENSSL_LEGACY +# endif +#endif + +#ifdef GIT_OPENSSL_LEGACY + +extern int OPENSSL_init_ssl(int opts, void *settings); +extern BIO_METHOD* BIO_meth_new(int type, const char *name); +extern void BIO_meth_free(BIO_METHOD *biom); +extern int BIO_meth_set_write(BIO_METHOD *biom, int (*write) (BIO *, const char *, int)); +extern int BIO_meth_set_read(BIO_METHOD *biom, int (*read) (BIO *, char *, int)); +extern int BIO_meth_set_puts(BIO_METHOD *biom, int (*puts) (BIO *, const char *)); +extern int BIO_meth_set_gets(BIO_METHOD *biom, int (*gets) (BIO *, char *, int)); +extern int BIO_meth_set_ctrl(BIO_METHOD *biom, long (*ctrl) (BIO *, int, long, void *)); +extern int BIO_meth_set_create(BIO_METHOD *biom, int (*create) (BIO *)); +extern int BIO_meth_set_destroy(BIO_METHOD *biom, int (*destroy) (BIO *)); +extern int BIO_get_new_index(void); +extern void BIO_set_data(BIO *a, void *ptr); +extern void BIO_set_init(BIO *b, int init); +extern void *BIO_get_data(BIO *a); +extern const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x); + +#endif + +#endif |