-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
WIP: LibGit2 - mbedTLS stream support #17246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
9c63d77
added libhttp_parser build script
wildart 5d0de3e
added libmbedtls build script
wildart a3b10ea
added patch for libssh2 backend
wildart 5512fed
removed distclean option
wildart c23c731
added libssh2 build script
wildart 55f1380
enable ssh in libgit2
wildart 55bd933
added RPATH parameters to cmake builds, switched libssh2 and libgit2 …
wildart 08262d8
fixed incorrect libgit2 sha1
wildart aa5bed7
update: build script to generate debug info, branch info
wildart 265db4a
updated libgit2 reference
wildart 5003e03
windows config fixed
wildart 1341d48
Put back accidentally deleted `endif`
Keno 620373e
apply libgit2 patch for windows only
wildart 4ae5893
mbedtls build configuration without git-external
wildart 3f20759
fix libgit2-ssh patch
wildart 71e7be1
add updated cmake ppa to travis config
wildart 508bbf1
fixed incorrect mbedtls patch location
wildart 858666f
restore http_parser
wildart ab4f674
added mbedtls TLS stream support for libgit2
wildart 3ea97ef
use original libgit2 0.24.1 version with tls stream patch
wildart 51a7c2e
update deps makefile
wildart 5528588
initialize TLS stream after libgit2 is loaded
wildart 90af61a
disable CA certificate loading on windows
wildart 36a6d53
fix travis config for x86
wildart 13cc976
update build config
wildart e0839ab
reordering dependencies
wildart de6ba4e
correct http_parser build config
wildart d101dab
correct initialization of TLS steam backend (linux only)
wildart 288a7b2
win: patch http_parser and disable mbedtls stream builder
wildart 3856181
fixing CI scripts
wildart e689366
setting correct dependencies, fixed patches (temporaty disable parall…
wildart File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
setting correct dependencies, fixed patches (temporaty disable parall…
…el build)
- Loading branch information
commit e689366c32d2c3d7859502b8c8e67ce7a925c265
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,112 @@ | ||
diff --git a/Makefile b/Makefile | ||
index 5f4eb22..983f669 100644 | ||
--- a/Makefile | ||
+++ b/Makefile | ||
@@ -18,18 +18,30 @@ | ||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
--- a/Makefile 2016-04-19 10:41:48.000000000 -0400 | ||
+++ b/Makefile 2016-07-06 21:40:44.000000000 -0400 | ||
@@ -19,11 +19,24 @@ | ||
# IN THE SOFTWARE. | ||
|
||
+VERSION = 2.7.0 | ||
PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"') | ||
+ifeq ($(findstring cygwin,$(PLATFORM)), cygwin) | ||
+PLATFORM = winnt | ||
+endif | ||
+ifeq ($(findstring mingw,$(PLATFORM)), mingw) | ||
+PLATFORM = winnt | ||
+endif | ||
+ifeq ($(findstring msys,$(PLATFORM)), msys) | ||
+PLATFORM = winnt | ||
+endif | ||
+ | ||
HELPER ?= | ||
BINEXT ?= | ||
ifeq (darwin,$(PLATFORM)) | ||
-SONAME ?= libhttp_parser.2.7.0.dylib | ||
+SONAME ?= libhttp_parser.$(VERSION).dylib | ||
SONAME ?= libhttp_parser.2.7.0.dylib | ||
SOEXT ?= dylib | ||
+else ifeq (winnt, $(PLATFORM)) | ||
+CC = gcc | ||
+SONAME ?= libhttp_parser.$(VERSION).dll | ||
+else ifeq (winnt,$(PLATFORM)) | ||
+SONAME ?= libhttp_parser-2.7.dll | ||
+SOEXT ?= dll | ||
else ifeq (wine,$(PLATFORM)) | ||
CC = winegcc | ||
BINEXT = .exe.so | ||
HELPER = wine | ||
else | ||
-SONAME ?= libhttp_parser.so.2.7.0 | ||
+SONAME ?= libhttp_parser.so.$(VERSION) | ||
SOEXT ?= so | ||
endif | ||
|
||
@@ -50,7 +62,12 @@ CFLAGS += -Wall -Wextra -Werror | ||
@@ -50,11 +61,18 @@ | ||
CFLAGS_DEBUG = $(CFLAGS) -O0 -g $(CFLAGS_DEBUG_EXTRA) | ||
CFLAGS_FAST = $(CFLAGS) -O3 $(CFLAGS_FAST_EXTRA) | ||
CFLAGS_BENCH = $(CFLAGS_FAST) -Wno-unused-parameter | ||
+ | ||
+ifeq (winnt, $(PLATFORM)) | ||
+ifeq (winnt,$(PLATFORM)) | ||
+CFLAGS_LIB = $(CFLAGS_FAST) | ||
+else | ||
CFLAGS_LIB = $(CFLAGS_FAST) -fPIC | ||
+endif | ||
|
||
LDFLAGS_LIB = $(LDFLAGS) -shared | ||
|
||
@@ -141,7 +158,7 @@ clean: | ||
INSTALL ?= install | ||
+STRIP ?= strip | ||
+ | ||
PREFIX ?= $(DESTDIR)/usr/local | ||
LIBDIR = $(PREFIX)/lib | ||
INCLUDEDIR = $(PREFIX)/include | ||
@@ -64,6 +82,8 @@ | ||
LDFLAGS_LIB += -Wl,-soname=$(SONAME) | ||
endif | ||
|
||
+all: library package | ||
+ | ||
test: test_g test_fast | ||
$(HELPER) ./test_g$(BINEXT) | ||
$(HELPER) ./test_fast$(BINEXT) | ||
@@ -101,10 +121,12 @@ | ||
libhttp_parser.o: http_parser.c http_parser.h Makefile | ||
$(CC) $(CPPFLAGS_FAST) $(CFLAGS_LIB) -c http_parser.c -o libhttp_parser.o | ||
|
||
-library: libhttp_parser.o | ||
+library: $(SONAME) | ||
+$(SONAME): libhttp_parser.o | ||
$(CC) $(LDFLAGS_LIB) -o $(SONAME) $< | ||
|
||
-package: http_parser.o | ||
+package: libhttp_parser.a | ||
+libhttp_parser.a: http_parser.o | ||
$(AR) rcs libhttp_parser.a http_parser.o | ||
|
||
url_parser: http_parser.o contrib/url_parser.c | ||
@@ -122,26 +144,28 @@ | ||
tags: http_parser.c http_parser.h test.c | ||
ctags $^ | ||
|
||
-install: library | ||
- $(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h | ||
- $(INSTALL) -D $(SONAME) $(LIBDIR)/$(SONAME) | ||
- ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.$(SOEXT) | ||
- | ||
-install-strip: library | ||
- $(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h | ||
- $(INSTALL) -D -s $(SONAME) $(LIBDIR)/$(SONAME) | ||
- ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.$(SOEXT) | ||
+install: library package | ||
+ $(INSTALL) -d $(DESTDIR)$(INCLUDEDIR) | ||
+ $(INSTALL) -m 0644 http_parser.h $(DESTDIR)$(INCLUDEDIR)/http_parser.h | ||
+ $(INSTALL) -d $(DESTDIR)$(LIBDIR) | ||
+ $(INSTALL) -m 0644 $(SONAME) $(DESTDIR)$(LIBDIR)/$(SONAME) | ||
+ ln -sf $(SONAME) $(DESTDIR)$(LIBDIR)/libhttp_parser.$(SOEXT) | ||
+ $(INSTALL) -m 0644 libhttp_parser.a $(DESTDIR)$(LIBDIR)/libhttp_parser.a | ||
+ | ||
+install-strip: install | ||
+ $(STRIP) $(DESTDIR)$(LIBDIR)/$(SONAME) | ||
|
||
uninstall: | ||
- rm $(INCLUDEDIR)/http_parser.h | ||
- rm $(LIBDIR)/$(SONAME) | ||
- rm $(LIBDIR)/libhttp_parser.so | ||
+ rm $(DESTDIR)$(INCLUDEDIR)/http_parser.h | ||
+ rm $(DESTDIR)$(LIBDIR)/$(SONAME) | ||
+ rm $(DEstdiR)$(LIBDIR)/libhttp_parser.$(SOEXT) | ||
+ rm $(DEstdiR)$(LIBDIR)/libhttp_parser.a | ||
|
||
clean: | ||
rm -f *.o *.a tags test test_fast test_g \ | ||
http_parser.tar libhttp_parser.so.* \ | ||
url_parser url_parser_g parsertrace parsertrace_g \ | ||
- *.exe *.exe.so | ||
+ *.exe *.exe.so *.dll | ||
+ *.exe.so *.dll | ||
|
||
contrib/url_parser.c: http_parser.h | ||
contrib/parsertrace.c: http_parser.h |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,65 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 93a9e47..75fe5ef 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -542,6 +542,9 @@ IF (OPENSSL_FOUND) | ||
SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES}) | ||
ENDIF() | ||
|
||
+IF (USE_CUSTOM_TLS) | ||
+ ADD_DEFINITIONS(-DGIT_CUSTOM_TLS) | ||
+ENDIF() | ||
|
||
|
||
IF (THREADSAFE) | ||
diff --git a/src/settings.c b/src/settings.c | ||
index 00a3ef0..61e0199 100644 | ||
index 00a3ef0..21430bc 100644 | ||
--- a/src/settings.c | ||
+++ b/src/settings.c | ||
@@ -29,7 +29,7 @@ int git_libgit2_features(void) | ||
@@ -29,9 +29,7 @@ int git_libgit2_features(void) | ||
#ifdef GIT_THREADS | ||
| GIT_FEATURE_THREADS | ||
#endif | ||
-#if defined(GIT_OPENSSL) || defined(GIT_WINHTTP) || defined(GIT_SECURE_TRANSPORT) | ||
+#if defined(GIT_OPENSSL) || defined(GIT_WINHTTP) || defined(GIT_SECURE_TRANSPORT) || defined(GIT_CUSTOM_TLS) | ||
| GIT_FEATURE_HTTPS | ||
#endif | ||
-#endif | ||
#if defined(GIT_SSH) | ||
| GIT_FEATURE_SSH | ||
#endif | ||
diff --git a/src/transport.c b/src/transport.c | ||
index 327052f..c4f3254 100644 | ||
index 327052f..32f8464 100644 | ||
--- a/src/transport.c | ||
+++ b/src/transport.c | ||
@@ -29,7 +29,7 @@ static transport_definition local_transport_definition = { "file://", git_transp | ||
@@ -29,9 +29,7 @@ static transport_definition local_transport_definition = { "file://", git_transp | ||
static transport_definition transports[] = { | ||
{ "git://", git_transport_smart, &git_subtransport_definition }, | ||
{ "http://", git_transport_smart, &http_subtransport_definition }, | ||
-#if defined(GIT_OPENSSL) || defined(GIT_WINHTTP) || defined(GIT_SECURE_TRANSPORT) | ||
+#if defined(GIT_OPENSSL) || defined(GIT_WINHTTP) || defined(GIT_SECURE_TRANSPORT) || defined(GIT_CUSTOM_TLS) | ||
{ "https://", git_transport_smart, &http_subtransport_definition }, | ||
#endif | ||
-#endif | ||
{ "file://", git_transport_local, NULL }, | ||
#ifdef GIT_SSH | ||
{ "ssh://", git_transport_smart, &ssh_subtransport_definition }, | ||
diff --git a/src/transports/http.c b/src/transports/http.c | ||
index 4fbbfbb..9ef05c6 100644 | ||
index 4fbbfbb..30520a0 100644 | ||
--- a/src/transports/http.c | ||
+++ b/src/transports/http.c | ||
@@ -620,7 +620,7 @@ static int http_connect(http_subtransport *t) | ||
@@ -620,7 +620,6 @@ static int http_connect(http_subtransport *t) | ||
|
||
error = git_stream_connect(t->io); | ||
|
||
-#if defined(GIT_OPENSSL) || defined(GIT_SECURE_TRANSPORT) || defined(GIT_CURL) | ||
+#if defined(GIT_OPENSSL) || defined(GIT_SECURE_TRANSPORT) || defined(GIT_CURL) || defined(GIT_CUSTOM_TLS) | ||
if ((!error || error == GIT_ECERTIFICATE) && t->owner->certificate_check_cb != NULL && | ||
git_stream_is_encrypted(t->io)) { | ||
git_cert *cert; | ||
@@ -640,7 +639,7 @@ static int http_connect(http_subtransport *t) | ||
return error; | ||
} | ||
} | ||
-#endif | ||
+ | ||
if (error < 0) | ||
return error; | ||
|
||
diff --git a/tests/core/features.c b/tests/core/features.c | ||
index 85cddfe..cf5e190 100644 | ||
--- a/tests/core/features.c | ||
+++ b/tests/core/features.c | ||
@@ -17,11 +17,7 @@ void test_core_features__0(void) | ||
cl_assert((caps & GIT_FEATURE_THREADS) == 0); | ||
#endif | ||
|
||
-#if defined(GIT_OPENSSL) || defined(GIT_WINHTTP) || defined(GIT_SECURE_TRANSPORT) | ||
cl_assert((caps & GIT_FEATURE_HTTPS) != 0); | ||
-#else | ||
- cl_assert((caps & GIT_FEATURE_HTTPS) == 0); | ||
-#endif | ||
|
||
#if defined(GIT_SSH) | ||
cl_assert((caps & GIT_FEATURE_SSH) != 0); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs to be reverted