rugged 1.0.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -0
- data/README.md +1 -1
- data/ext/rugged/rugged.c +7 -4
- data/ext/rugged/rugged_commit.c +1 -1
- data/ext/rugged/rugged_object.c +1 -1
- data/ext/rugged/rugged_repo.c +3 -3
- data/lib/rugged/commit.rb +16 -2
- data/lib/rugged/repository.rb +2 -2
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +41 -74
- data/vendor/libgit2/COPYING +109 -1
- data/vendor/libgit2/cmake/{Modules/AddCFlagIfSupported.cmake → AddCFlagIfSupported.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/EnableWarnings.cmake → EnableWarnings.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindCoreFoundation.cmake → FindCoreFoundation.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindGSSAPI.cmake → FindGSSAPI.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindGSSFramework.cmake → FindGSSFramework.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindHTTP_Parser.cmake → FindHTTP_Parser.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindIconv.cmake → FindIconv.cmake} +0 -0
- data/vendor/libgit2/cmake/FindLibSSH2.cmake +13 -0
- data/vendor/libgit2/cmake/{Modules/FindPCRE.cmake → FindPCRE.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPCRE2.cmake → FindPCRE2.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPkgLibraries.cmake → FindPkgLibraries.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindSecurity.cmake → FindSecurity.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindStatNsec.cmake → FindStatNsec.cmake} +0 -0
- data/vendor/libgit2/cmake/Findfutimens.cmake +14 -0
- data/vendor/libgit2/cmake/{Modules/FindmbedTLS.cmake → FindmbedTLS.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/IdeSplitSources.cmake → IdeSplitSources.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/PkgBuildConfig.cmake → PkgBuildConfig.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/SanitizeBool.cmake → SanitizeBool.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/SelectGSSAPI.cmake → SelectGSSAPI.cmake} +18 -26
- data/vendor/libgit2/cmake/{Modules/SelectHTTPSBackend.cmake → SelectHTTPSBackend.cmake} +29 -32
- data/vendor/libgit2/cmake/{Modules/SelectHashes.cmake → SelectHashes.cmake} +21 -28
- data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +101 -0
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +4 -3
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +24 -10
- data/vendor/libgit2/deps/ntlmclient/compat.h +0 -27
- data/vendor/libgit2/deps/ntlmclient/crypt.h +14 -9
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +20 -20
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +3 -3
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +37 -36
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +4 -3
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +178 -51
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +74 -5
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +164 -135
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +13 -9
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +16 -3
- data/vendor/libgit2/deps/ntlmclient/unicode.h +10 -4
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +16 -27
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.h +20 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +28 -52
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.h +22 -0
- data/vendor/libgit2/deps/ntlmclient/util.c +15 -1
- data/vendor/libgit2/deps/ntlmclient/util.h +2 -1
- data/vendor/libgit2/deps/pcre/LICENCE +93 -0
- data/vendor/libgit2/deps/pcre/pcre.h +2 -2
- data/vendor/libgit2/deps/pcre/pcre_compile.c +29 -17
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +4 -4
- data/vendor/libgit2/deps/pcre/pcreposix.c +2 -3
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -5
- data/vendor/libgit2/deps/zlib/deflate.c +1 -0
- data/vendor/libgit2/include/git2/annotated_commit.h +1 -1
- data/vendor/libgit2/include/git2/apply.h +2 -0
- data/vendor/libgit2/include/git2/attr.h +95 -0
- data/vendor/libgit2/include/git2/blame.h +95 -42
- data/vendor/libgit2/include/git2/blob.h +37 -3
- data/vendor/libgit2/include/git2/branch.h +25 -0
- data/vendor/libgit2/include/git2/cert.h +42 -5
- data/vendor/libgit2/include/git2/checkout.h +28 -12
- data/vendor/libgit2/include/git2/clone.h +1 -1
- data/vendor/libgit2/include/git2/commit.h +35 -19
- data/vendor/libgit2/include/git2/common.h +51 -6
- data/vendor/libgit2/include/git2/config.h +1 -1
- data/vendor/libgit2/include/git2/deprecated.h +368 -8
- data/vendor/libgit2/include/git2/diff.h +34 -113
- data/vendor/libgit2/include/git2/email.h +127 -0
- data/vendor/libgit2/include/git2/errors.h +8 -7
- data/vendor/libgit2/include/git2/filter.h +63 -17
- data/vendor/libgit2/include/git2/graph.h +20 -2
- data/vendor/libgit2/include/git2/index.h +4 -5
- data/vendor/libgit2/include/git2/indexer.h +2 -1
- data/vendor/libgit2/include/git2/notes.h +2 -2
- data/vendor/libgit2/include/git2/odb.h +44 -20
- data/vendor/libgit2/include/git2/oidarray.h +5 -8
- data/vendor/libgit2/include/git2/pack.h +1 -1
- data/vendor/libgit2/include/git2/patch.h +8 -0
- data/vendor/libgit2/include/git2/rebase.h +25 -1
- data/vendor/libgit2/include/git2/refs.h +9 -5
- data/vendor/libgit2/include/git2/remote.h +62 -9
- data/vendor/libgit2/include/git2/repository.h +107 -62
- data/vendor/libgit2/include/git2/revparse.h +5 -5
- data/vendor/libgit2/include/git2/stash.h +1 -1
- data/vendor/libgit2/include/git2/status.h +115 -59
- data/vendor/libgit2/include/git2/stdint.h +3 -3
- data/vendor/libgit2/include/git2/strarray.h +6 -10
- data/vendor/libgit2/include/git2/submodule.h +9 -0
- data/vendor/libgit2/include/git2/sys/commit_graph.h +174 -0
- data/vendor/libgit2/include/git2/sys/email.h +45 -0
- data/vendor/libgit2/include/git2/sys/filter.h +49 -28
- data/vendor/libgit2/include/git2/sys/midx.h +74 -0
- data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -0
- data/vendor/libgit2/include/git2/sys/transport.h +1 -0
- data/vendor/libgit2/include/git2/tag.h +12 -0
- data/vendor/libgit2/include/git2/transport.h +1 -1
- data/vendor/libgit2/include/git2/tree.h +2 -14
- data/vendor/libgit2/include/git2/types.h +9 -0
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +1 -0
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +84 -44
- data/vendor/libgit2/src/alloc.c +21 -8
- data/vendor/libgit2/src/allocators/failalloc.c +92 -0
- data/vendor/libgit2/src/allocators/failalloc.h +23 -0
- data/vendor/libgit2/src/allocators/stdalloc.c +41 -10
- data/vendor/libgit2/src/allocators/win32_leakcheck.c +118 -0
- data/vendor/libgit2/src/allocators/{win32_crtdbg.h → win32_leakcheck.h} +3 -3
- data/vendor/libgit2/src/annotated_commit.c +21 -9
- data/vendor/libgit2/src/apply.c +21 -8
- data/vendor/libgit2/src/array.h +11 -11
- data/vendor/libgit2/src/assert_safe.h +58 -0
- data/vendor/libgit2/src/attr.c +192 -70
- data/vendor/libgit2/src/attr_file.c +99 -41
- data/vendor/libgit2/src/attr_file.h +32 -11
- data/vendor/libgit2/src/attrcache.c +44 -40
- data/vendor/libgit2/src/attrcache.h +4 -5
- data/vendor/libgit2/src/blame.c +32 -19
- data/vendor/libgit2/src/blame_git.c +7 -4
- data/vendor/libgit2/src/blob.c +60 -32
- data/vendor/libgit2/src/branch.c +87 -37
- data/vendor/libgit2/src/buffer.c +349 -29
- data/vendor/libgit2/src/buffer.h +154 -2
- data/vendor/libgit2/src/cache.c +3 -24
- data/vendor/libgit2/src/cache.h +7 -7
- data/vendor/libgit2/src/cc-compat.h +10 -8
- data/vendor/libgit2/src/checkout.c +103 -105
- data/vendor/libgit2/src/cherrypick.c +8 -2
- data/vendor/libgit2/src/clone.c +105 -30
- data/vendor/libgit2/src/commit.c +41 -28
- data/vendor/libgit2/src/commit_graph.c +1209 -0
- data/vendor/libgit2/src/commit_graph.h +162 -0
- data/vendor/libgit2/src/commit_list.c +46 -0
- data/vendor/libgit2/src/commit_list.h +2 -0
- data/vendor/libgit2/src/common.h +26 -2
- data/vendor/libgit2/src/config.c +41 -23
- data/vendor/libgit2/src/config_cache.c +9 -4
- data/vendor/libgit2/src/config_entries.c +35 -27
- data/vendor/libgit2/src/config_file.c +17 -9
- data/vendor/libgit2/src/config_parse.c +6 -8
- data/vendor/libgit2/src/config_snapshot.c +2 -1
- data/vendor/libgit2/src/crlf.c +16 -6
- data/vendor/libgit2/src/date.c +4 -3
- data/vendor/libgit2/src/delta.c +1 -1
- data/vendor/libgit2/src/describe.c +12 -5
- data/vendor/libgit2/src/diff.c +55 -183
- data/vendor/libgit2/src/diff_driver.c +21 -17
- data/vendor/libgit2/src/diff_file.c +5 -7
- data/vendor/libgit2/src/diff_generate.c +56 -28
- data/vendor/libgit2/src/diff_parse.c +2 -3
- data/vendor/libgit2/src/diff_print.c +81 -65
- data/vendor/libgit2/src/diff_stats.c +19 -16
- data/vendor/libgit2/src/diff_tform.c +13 -13
- data/vendor/libgit2/src/diff_xdiff.c +4 -2
- data/vendor/libgit2/src/diff_xdiff.h +1 -1
- data/vendor/libgit2/src/email.c +299 -0
- data/vendor/libgit2/src/email.h +25 -0
- data/vendor/libgit2/src/errors.c +26 -19
- data/vendor/libgit2/src/features.h.in +5 -1
- data/vendor/libgit2/src/fetch.c +7 -2
- data/vendor/libgit2/src/fetchhead.c +8 -4
- data/vendor/libgit2/src/filebuf.c +9 -7
- data/vendor/libgit2/src/filter.c +215 -113
- data/vendor/libgit2/src/filter.h +24 -5
- data/vendor/libgit2/src/futils.c +8 -8
- data/vendor/libgit2/src/futils.h +4 -4
- data/vendor/libgit2/src/graph.c +64 -9
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +3 -3
- data/vendor/libgit2/src/hash/sha1/common_crypto.c +3 -3
- data/vendor/libgit2/src/hash/sha1/generic.h +1 -1
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +12 -12
- data/vendor/libgit2/src/hash/sha1/openssl.c +3 -3
- data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +8 -10
- data/vendor/libgit2/src/hash/sha1/win32.c +15 -11
- data/vendor/libgit2/src/hash.c +16 -13
- data/vendor/libgit2/src/hash.h +1 -1
- data/vendor/libgit2/src/hashsig.c +23 -10
- data/vendor/libgit2/src/ident.c +13 -3
- data/vendor/libgit2/src/idxmap.c +0 -22
- data/vendor/libgit2/src/ignore.c +33 -17
- data/vendor/libgit2/src/index.c +124 -82
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +95 -37
- data/vendor/libgit2/src/integer.h +79 -2
- data/vendor/libgit2/src/iterator.c +40 -28
- data/vendor/libgit2/src/iterator.h +1 -1
- data/vendor/libgit2/src/khash.h +2 -11
- data/vendor/libgit2/src/{settings.c → libgit2.c} +148 -49
- data/vendor/libgit2/src/libgit2.h +15 -0
- data/vendor/libgit2/src/mailmap.c +23 -10
- data/vendor/libgit2/src/map.h +3 -3
- data/vendor/libgit2/src/merge.c +95 -43
- data/vendor/libgit2/src/merge.h +2 -1
- data/vendor/libgit2/src/merge_driver.c +19 -13
- data/vendor/libgit2/src/merge_file.c +15 -9
- data/vendor/libgit2/src/message.c +3 -1
- data/vendor/libgit2/src/midx.c +879 -0
- data/vendor/libgit2/src/midx.h +110 -0
- data/vendor/libgit2/src/mwindow.c +214 -95
- data/vendor/libgit2/src/mwindow.h +3 -3
- data/vendor/libgit2/src/net.c +133 -4
- data/vendor/libgit2/src/net.h +16 -2
- data/vendor/libgit2/src/netops.c +6 -4
- data/vendor/libgit2/src/netops.h +2 -2
- data/vendor/libgit2/src/notes.c +40 -40
- data/vendor/libgit2/src/object.c +24 -15
- data/vendor/libgit2/src/odb.c +298 -57
- data/vendor/libgit2/src/odb.h +16 -2
- data/vendor/libgit2/src/odb_loose.c +31 -21
- data/vendor/libgit2/src/odb_mempack.c +3 -1
- data/vendor/libgit2/src/odb_pack.c +391 -114
- data/vendor/libgit2/src/oid.c +7 -4
- data/vendor/libgit2/src/oidarray.c +10 -1
- data/vendor/libgit2/src/pack-objects.c +83 -69
- data/vendor/libgit2/src/pack.c +383 -150
- data/vendor/libgit2/src/pack.h +44 -9
- data/vendor/libgit2/src/patch.c +14 -7
- data/vendor/libgit2/src/patch_generate.c +3 -5
- data/vendor/libgit2/src/patch_parse.c +6 -3
- data/vendor/libgit2/src/path.c +103 -58
- data/vendor/libgit2/src/path.h +80 -7
- data/vendor/libgit2/src/pathspec.c +12 -11
- data/vendor/libgit2/src/pool.c +34 -22
- data/vendor/libgit2/src/pool.h +9 -1
- data/vendor/libgit2/src/posix.c +43 -12
- data/vendor/libgit2/src/posix.h +9 -0
- data/vendor/libgit2/src/proxy.c +2 -0
- data/vendor/libgit2/src/push.c +2 -0
- data/vendor/libgit2/src/reader.c +10 -6
- data/vendor/libgit2/src/rebase.c +95 -49
- data/vendor/libgit2/src/refdb.c +165 -13
- data/vendor/libgit2/src/refdb.h +69 -0
- data/vendor/libgit2/src/refdb_fs.c +145 -153
- data/vendor/libgit2/src/reflog.c +21 -20
- data/vendor/libgit2/src/refs.c +153 -233
- data/vendor/libgit2/src/refs.h +2 -20
- data/vendor/libgit2/src/refspec.c +81 -45
- data/vendor/libgit2/src/regexp.c +2 -2
- data/vendor/libgit2/src/remote.c +320 -122
- data/vendor/libgit2/src/remote.h +2 -1
- data/vendor/libgit2/src/repository.c +476 -203
- data/vendor/libgit2/src/repository.h +27 -29
- data/vendor/libgit2/src/reset.c +8 -7
- data/vendor/libgit2/src/revert.c +8 -2
- data/vendor/libgit2/src/revparse.c +23 -17
- data/vendor/libgit2/src/revwalk.c +35 -20
- data/vendor/libgit2/src/runtime.c +162 -0
- data/vendor/libgit2/src/runtime.h +62 -0
- data/vendor/libgit2/src/{refdb_fs.h → settings.h} +3 -11
- data/vendor/libgit2/src/signature.c +6 -5
- data/vendor/libgit2/src/sortedcache.c +2 -3
- data/vendor/libgit2/src/sortedcache.h +10 -8
- data/vendor/libgit2/src/stash.c +6 -2
- data/vendor/libgit2/src/status.c +9 -4
- data/vendor/libgit2/src/strarray.c +64 -0
- data/vendor/libgit2/src/streams/mbedtls.c +14 -17
- data/vendor/libgit2/src/streams/mbedtls.h +1 -1
- data/vendor/libgit2/src/streams/openssl.c +113 -207
- data/vendor/libgit2/src/streams/openssl.h +9 -1
- data/vendor/libgit2/src/streams/openssl_dynamic.c +309 -0
- data/vendor/libgit2/src/streams/openssl_dynamic.h +348 -0
- data/vendor/libgit2/src/streams/openssl_legacy.c +203 -0
- data/vendor/libgit2/src/streams/openssl_legacy.h +63 -0
- data/vendor/libgit2/src/streams/registry.c +10 -9
- data/vendor/libgit2/src/streams/socket.c +6 -2
- data/vendor/libgit2/src/streams/stransport.c +6 -3
- data/vendor/libgit2/src/streams/tls.c +5 -3
- data/vendor/libgit2/src/submodule.c +134 -66
- data/vendor/libgit2/src/submodule.h +9 -9
- data/vendor/libgit2/src/sysdir.c +8 -26
- data/vendor/libgit2/src/sysdir.h +0 -11
- data/vendor/libgit2/src/tag.c +49 -11
- data/vendor/libgit2/src/thread.c +140 -0
- data/vendor/libgit2/src/thread.h +479 -0
- data/vendor/libgit2/src/threadstate.c +84 -0
- data/vendor/libgit2/src/threadstate.h +24 -0
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +17 -13
- data/vendor/libgit2/src/trailer.c +1 -1
- data/vendor/libgit2/src/transaction.c +21 -9
- data/vendor/libgit2/src/transport.c +3 -3
- data/vendor/libgit2/src/transports/auth.c +1 -1
- data/vendor/libgit2/src/transports/auth_negotiate.c +11 -4
- data/vendor/libgit2/src/transports/auth_ntlm.c +10 -6
- data/vendor/libgit2/src/transports/credential.c +17 -7
- data/vendor/libgit2/src/transports/credential_helpers.c +2 -0
- data/vendor/libgit2/src/transports/git.c +1 -3
- data/vendor/libgit2/src/transports/http.c +19 -17
- data/vendor/libgit2/src/transports/http.h +1 -0
- data/vendor/libgit2/src/transports/httpclient.c +68 -38
- data/vendor/libgit2/src/transports/httpclient.h +1 -1
- data/vendor/libgit2/src/transports/local.c +5 -5
- data/vendor/libgit2/src/transports/smart.c +14 -9
- data/vendor/libgit2/src/transports/smart.h +1 -1
- data/vendor/libgit2/src/transports/smart_protocol.c +11 -5
- data/vendor/libgit2/src/transports/ssh.c +55 -21
- data/vendor/libgit2/src/transports/winhttp.c +157 -89
- data/vendor/libgit2/src/tree.c +100 -77
- data/vendor/libgit2/src/tree.h +1 -0
- data/vendor/libgit2/src/tsort.c +0 -2
- data/vendor/libgit2/src/unix/map.c +3 -1
- data/vendor/libgit2/src/unix/posix.h +16 -1
- data/vendor/libgit2/src/unix/pthread.h +2 -1
- data/vendor/libgit2/src/utf8.c +150 -0
- data/vendor/libgit2/src/utf8.h +52 -0
- data/vendor/libgit2/src/util.c +75 -184
- data/vendor/libgit2/src/util.h +34 -40
- data/vendor/libgit2/src/vector.c +23 -19
- data/vendor/libgit2/src/vector.h +4 -2
- data/vendor/libgit2/src/win32/findfile.c +5 -3
- data/vendor/libgit2/src/win32/git2.rc +18 -3
- data/vendor/libgit2/src/win32/map.c +1 -1
- data/vendor/libgit2/src/win32/msvc-compat.h +9 -1
- data/vendor/libgit2/src/win32/path_w32.c +23 -25
- data/vendor/libgit2/src/win32/path_w32.h +0 -1
- data/vendor/libgit2/src/win32/posix.h +6 -6
- data/vendor/libgit2/src/win32/posix_w32.c +86 -7
- data/vendor/libgit2/src/win32/precompiled.h +0 -1
- data/vendor/libgit2/src/win32/reparse.h +4 -4
- data/vendor/libgit2/src/win32/thread.c +24 -15
- data/vendor/libgit2/src/win32/thread.h +1 -1
- data/vendor/libgit2/src/win32/w32_buffer.c +3 -3
- data/vendor/libgit2/src/win32/w32_common.h +18 -9
- data/vendor/libgit2/src/win32/{w32_crtdbg_stacktrace.c → w32_leakcheck.c} +269 -33
- data/vendor/libgit2/src/win32/w32_leakcheck.h +222 -0
- data/vendor/libgit2/src/win32/w32_util.h +6 -6
- data/vendor/libgit2/src/worktree.c +36 -14
- data/vendor/libgit2/src/zstream.c +1 -1
- metadata +65 -42
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +0 -29
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +0 -96
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
- data/vendor/libgit2/src/buf_text.c +0 -316
- data/vendor/libgit2/src/buf_text.h +0 -122
- data/vendor/libgit2/src/global.c +0 -361
- data/vendor/libgit2/src/global.h +0 -41
- data/vendor/libgit2/src/thread-utils.c +0 -58
- data/vendor/libgit2/src/thread-utils.h +0 -246
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -127
- data/vendor/libgit2/src/win32/w32_stack.c +0 -188
- data/vendor/libgit2/src/win32/w32_stack.h +0 -140
@@ -0,0 +1,203 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
+
*/
|
7
|
+
|
8
|
+
#include "streams/openssl.h"
|
9
|
+
#include "streams/openssl_legacy.h"
|
10
|
+
|
11
|
+
#include "runtime.h"
|
12
|
+
#include "git2/sys/openssl.h"
|
13
|
+
|
14
|
+
#if defined(GIT_OPENSSL) && !defined(GIT_OPENSSL_DYNAMIC)
|
15
|
+
# include <openssl/ssl.h>
|
16
|
+
# include <openssl/err.h>
|
17
|
+
# include <openssl/x509v3.h>
|
18
|
+
# include <openssl/bio.h>
|
19
|
+
#endif
|
20
|
+
|
21
|
+
#if defined(GIT_OPENSSL_LEGACY) || defined(GIT_OPENSSL_DYNAMIC)
|
22
|
+
|
23
|
+
/*
|
24
|
+
* OpenSSL 1.1 made BIO opaque so we have to use functions to interact with it
|
25
|
+
* which do not exist in previous versions. We define these inline functions so
|
26
|
+
* we can program against the interface instead of littering the implementation
|
27
|
+
* with ifdefs. We do the same for OPENSSL_init_ssl.
|
28
|
+
*/
|
29
|
+
|
30
|
+
int OPENSSL_init_ssl__legacy(uint64_t opts, const void *settings)
|
31
|
+
{
|
32
|
+
GIT_UNUSED(opts);
|
33
|
+
GIT_UNUSED(settings);
|
34
|
+
SSL_load_error_strings();
|
35
|
+
SSL_library_init();
|
36
|
+
return 0;
|
37
|
+
}
|
38
|
+
|
39
|
+
BIO_METHOD *BIO_meth_new__legacy(int type, const char *name)
|
40
|
+
{
|
41
|
+
BIO_METHOD *meth = git__calloc(1, sizeof(BIO_METHOD));
|
42
|
+
if (!meth) {
|
43
|
+
return NULL;
|
44
|
+
}
|
45
|
+
|
46
|
+
meth->type = type;
|
47
|
+
meth->name = name;
|
48
|
+
|
49
|
+
return meth;
|
50
|
+
}
|
51
|
+
|
52
|
+
void BIO_meth_free__legacy(BIO_METHOD *biom)
|
53
|
+
{
|
54
|
+
git__free(biom);
|
55
|
+
}
|
56
|
+
|
57
|
+
int BIO_meth_set_write__legacy(BIO_METHOD *biom, int (*write) (BIO *, const char *, int))
|
58
|
+
{
|
59
|
+
biom->bwrite = write;
|
60
|
+
return 1;
|
61
|
+
}
|
62
|
+
|
63
|
+
int BIO_meth_set_read__legacy(BIO_METHOD *biom, int (*read) (BIO *, char *, int))
|
64
|
+
{
|
65
|
+
biom->bread = read;
|
66
|
+
return 1;
|
67
|
+
}
|
68
|
+
|
69
|
+
int BIO_meth_set_puts__legacy(BIO_METHOD *biom, int (*puts) (BIO *, const char *))
|
70
|
+
{
|
71
|
+
biom->bputs = puts;
|
72
|
+
return 1;
|
73
|
+
}
|
74
|
+
|
75
|
+
int BIO_meth_set_gets__legacy(BIO_METHOD *biom, int (*gets) (BIO *, char *, int))
|
76
|
+
|
77
|
+
{
|
78
|
+
biom->bgets = gets;
|
79
|
+
return 1;
|
80
|
+
}
|
81
|
+
|
82
|
+
int BIO_meth_set_ctrl__legacy(BIO_METHOD *biom, long (*ctrl) (BIO *, int, long, void *))
|
83
|
+
{
|
84
|
+
biom->ctrl = ctrl;
|
85
|
+
return 1;
|
86
|
+
}
|
87
|
+
|
88
|
+
int BIO_meth_set_create__legacy(BIO_METHOD *biom, int (*create) (BIO *))
|
89
|
+
{
|
90
|
+
biom->create = create;
|
91
|
+
return 1;
|
92
|
+
}
|
93
|
+
|
94
|
+
int BIO_meth_set_destroy__legacy(BIO_METHOD *biom, int (*destroy) (BIO *))
|
95
|
+
{
|
96
|
+
biom->destroy = destroy;
|
97
|
+
return 1;
|
98
|
+
}
|
99
|
+
|
100
|
+
int BIO_get_new_index__legacy(void)
|
101
|
+
{
|
102
|
+
/* This exists as of 1.1 so before we'd just have 0 */
|
103
|
+
return 0;
|
104
|
+
}
|
105
|
+
|
106
|
+
void BIO_set_init__legacy(BIO *b, int init)
|
107
|
+
{
|
108
|
+
b->init = init;
|
109
|
+
}
|
110
|
+
|
111
|
+
void BIO_set_data__legacy(BIO *a, void *ptr)
|
112
|
+
{
|
113
|
+
a->ptr = ptr;
|
114
|
+
}
|
115
|
+
|
116
|
+
void *BIO_get_data__legacy(BIO *a)
|
117
|
+
{
|
118
|
+
return a->ptr;
|
119
|
+
}
|
120
|
+
|
121
|
+
const unsigned char *ASN1_STRING_get0_data__legacy(const ASN1_STRING *x)
|
122
|
+
{
|
123
|
+
return ASN1_STRING_data((ASN1_STRING *)x);
|
124
|
+
}
|
125
|
+
|
126
|
+
long SSL_CTX_set_options__legacy(SSL_CTX *ctx, long op)
|
127
|
+
{
|
128
|
+
return SSL_CTX_ctrl(ctx, SSL_CTRL_OPTIONS, op, NULL);
|
129
|
+
}
|
130
|
+
|
131
|
+
# if defined(GIT_THREADS)
|
132
|
+
static git_mutex *openssl_locks;
|
133
|
+
|
134
|
+
static void openssl_locking_function(int mode, int n, const char *file, int line)
|
135
|
+
{
|
136
|
+
int lock;
|
137
|
+
|
138
|
+
GIT_UNUSED(file);
|
139
|
+
GIT_UNUSED(line);
|
140
|
+
|
141
|
+
lock = mode & CRYPTO_LOCK;
|
142
|
+
|
143
|
+
if (lock)
|
144
|
+
(void)git_mutex_lock(&openssl_locks[n]);
|
145
|
+
else
|
146
|
+
git_mutex_unlock(&openssl_locks[n]);
|
147
|
+
}
|
148
|
+
|
149
|
+
static void shutdown_ssl_locking(void)
|
150
|
+
{
|
151
|
+
int num_locks, i;
|
152
|
+
|
153
|
+
num_locks = CRYPTO_num_locks();
|
154
|
+
CRYPTO_set_locking_callback(NULL);
|
155
|
+
|
156
|
+
for (i = 0; i < num_locks; ++i)
|
157
|
+
git_mutex_free(&openssl_locks[i]);
|
158
|
+
git__free(openssl_locks);
|
159
|
+
}
|
160
|
+
|
161
|
+
static void threadid_cb(CRYPTO_THREADID *threadid)
|
162
|
+
{
|
163
|
+
GIT_UNUSED(threadid);
|
164
|
+
CRYPTO_THREADID_set_numeric(threadid, git_thread_currentid());
|
165
|
+
}
|
166
|
+
|
167
|
+
int git_openssl_set_locking(void)
|
168
|
+
{
|
169
|
+
int num_locks, i;
|
170
|
+
|
171
|
+
#ifndef GIT_THREADS
|
172
|
+
git_error_set(GIT_ERROR_THREAD, "libgit2 was not built with threads");
|
173
|
+
return -1;
|
174
|
+
#endif
|
175
|
+
|
176
|
+
#ifdef GIT_OPENSSL_DYNAMIC
|
177
|
+
/*
|
178
|
+
* This function is required on legacy versions of OpenSSL; when building
|
179
|
+
* with dynamically-loaded OpenSSL, we detect whether we loaded it or not.
|
180
|
+
*/
|
181
|
+
if (!CRYPTO_set_locking_callback)
|
182
|
+
return 0;
|
183
|
+
#endif
|
184
|
+
|
185
|
+
CRYPTO_THREADID_set_callback(threadid_cb);
|
186
|
+
|
187
|
+
num_locks = CRYPTO_num_locks();
|
188
|
+
openssl_locks = git__calloc(num_locks, sizeof(git_mutex));
|
189
|
+
GIT_ERROR_CHECK_ALLOC(openssl_locks);
|
190
|
+
|
191
|
+
for (i = 0; i < num_locks; i++) {
|
192
|
+
if (git_mutex_init(&openssl_locks[i]) != 0) {
|
193
|
+
git_error_set(GIT_ERROR_SSL, "failed to initialize openssl locks");
|
194
|
+
return -1;
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
198
|
+
CRYPTO_set_locking_callback(openssl_locking_function);
|
199
|
+
return git_runtime_shutdown_register(shutdown_ssl_locking);
|
200
|
+
}
|
201
|
+
#endif /* GIT_THREADS */
|
202
|
+
|
203
|
+
#endif /* GIT_OPENSSL_LEGACY || GIT_OPENSSL_DYNAMIC */
|
@@ -0,0 +1,63 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
+
*/
|
7
|
+
#ifndef INCLUDE_streams_openssl_legacy_h__
|
8
|
+
#define INCLUDE_streams_openssl_legacy_h__
|
9
|
+
|
10
|
+
#include "streams/openssl_dynamic.h"
|
11
|
+
|
12
|
+
#if defined(GIT_OPENSSL) && !defined(GIT_OPENSSL_DYNAMIC)
|
13
|
+
# include <openssl/ssl.h>
|
14
|
+
# include <openssl/err.h>
|
15
|
+
# include <openssl/x509v3.h>
|
16
|
+
# include <openssl/bio.h>
|
17
|
+
|
18
|
+
# if (defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x10100000L) || \
|
19
|
+
(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x20700000L)
|
20
|
+
# define GIT_OPENSSL_LEGACY
|
21
|
+
# endif
|
22
|
+
#endif
|
23
|
+
|
24
|
+
#if defined(GIT_OPENSSL_LEGACY) && !defined(GIT_OPENSSL_DYNAMIC)
|
25
|
+
# define OPENSSL_init_ssl OPENSSL_init_ssl__legacy
|
26
|
+
# define BIO_meth_new BIO_meth_new__legacy
|
27
|
+
# define BIO_meth_free BIO_meth_free__legacy
|
28
|
+
# define BIO_meth_set_write BIO_meth_set_write__legacy
|
29
|
+
# define BIO_meth_set_read BIO_meth_set_read__legacy
|
30
|
+
# define BIO_meth_set_puts BIO_meth_set_puts__legacy
|
31
|
+
# define BIO_meth_set_gets BIO_meth_set_gets__legacy
|
32
|
+
# define BIO_meth_set_ctrl BIO_meth_set_ctrl__legacy
|
33
|
+
# define BIO_meth_set_create BIO_meth_set_create__legacy
|
34
|
+
# define BIO_meth_set_destroy BIO_meth_set_destroy__legacy
|
35
|
+
# define BIO_get_new_index BIO_get_new_index__legacy
|
36
|
+
# define BIO_set_data BIO_set_data__legacy
|
37
|
+
# define BIO_set_init BIO_set_init__legacy
|
38
|
+
# define BIO_get_data BIO_get_data__legacy
|
39
|
+
# define ASN1_STRING_get0_data ASN1_STRING_get0_data__legacy
|
40
|
+
#endif
|
41
|
+
|
42
|
+
#if defined(GIT_OPENSSL_LEGACY) || defined(GIT_OPENSSL_DYNAMIC)
|
43
|
+
|
44
|
+
extern int OPENSSL_init_ssl__legacy(uint64_t opts, const void *settings);
|
45
|
+
extern BIO_METHOD *BIO_meth_new__legacy(int type, const char *name);
|
46
|
+
extern void BIO_meth_free__legacy(BIO_METHOD *biom);
|
47
|
+
extern int BIO_meth_set_write__legacy(BIO_METHOD *biom, int (*write) (BIO *, const char *, int));
|
48
|
+
extern int BIO_meth_set_read__legacy(BIO_METHOD *biom, int (*read) (BIO *, char *, int));
|
49
|
+
extern int BIO_meth_set_puts__legacy(BIO_METHOD *biom, int (*puts) (BIO *, const char *));
|
50
|
+
extern int BIO_meth_set_gets__legacy(BIO_METHOD *biom, int (*gets) (BIO *, char *, int));
|
51
|
+
extern int BIO_meth_set_ctrl__legacy(BIO_METHOD *biom, long (*ctrl) (BIO *, int, long, void *));
|
52
|
+
extern int BIO_meth_set_create__legacy(BIO_METHOD *biom, int (*create) (BIO *));
|
53
|
+
extern int BIO_meth_set_destroy__legacy(BIO_METHOD *biom, int (*destroy) (BIO *));
|
54
|
+
extern int BIO_get_new_index__legacy(void);
|
55
|
+
extern void BIO_set_data__legacy(BIO *a, void *ptr);
|
56
|
+
extern void BIO_set_init__legacy(BIO *b, int init);
|
57
|
+
extern void *BIO_get_data__legacy(BIO *a);
|
58
|
+
extern const unsigned char *ASN1_STRING_get0_data__legacy(const ASN1_STRING *x);
|
59
|
+
extern long SSL_CTX_set_options__legacy(SSL_CTX *ctx, long op);
|
60
|
+
|
61
|
+
#endif
|
62
|
+
|
63
|
+
#endif
|
@@ -5,10 +5,11 @@
|
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
6
6
|
*/
|
7
7
|
|
8
|
-
#include "git2/errors.h"
|
9
|
-
|
10
8
|
#include "common.h"
|
11
|
-
|
9
|
+
|
10
|
+
#include "streams/registry.h"
|
11
|
+
|
12
|
+
#include "runtime.h"
|
12
13
|
#include "streams/tls.h"
|
13
14
|
#include "streams/mbedtls.h"
|
14
15
|
#include "streams/openssl.h"
|
@@ -32,8 +33,7 @@ int git_stream_registry_global_init(void)
|
|
32
33
|
if (git_rwlock_init(&stream_registry.lock) < 0)
|
33
34
|
return -1;
|
34
35
|
|
35
|
-
|
36
|
-
return 0;
|
36
|
+
return git_runtime_shutdown_register(shutdown_stream_registry);
|
37
37
|
}
|
38
38
|
|
39
39
|
GIT_INLINE(void) stream_registration_cpy(
|
@@ -51,7 +51,7 @@ int git_stream_registry_lookup(git_stream_registration *out, git_stream_t type)
|
|
51
51
|
git_stream_registration *target;
|
52
52
|
int error = GIT_ENOTFOUND;
|
53
53
|
|
54
|
-
|
54
|
+
GIT_ASSERT_ARG(out);
|
55
55
|
|
56
56
|
switch(type) {
|
57
57
|
case GIT_STREAM_STANDARD:
|
@@ -61,7 +61,7 @@ int git_stream_registry_lookup(git_stream_registration *out, git_stream_t type)
|
|
61
61
|
target = &stream_registry.tls_callbacks;
|
62
62
|
break;
|
63
63
|
default:
|
64
|
-
|
64
|
+
git_error_set(GIT_ERROR_INVALID, "invalid stream type");
|
65
65
|
return -1;
|
66
66
|
}
|
67
67
|
|
@@ -81,7 +81,7 @@ int git_stream_registry_lookup(git_stream_registration *out, git_stream_t type)
|
|
81
81
|
|
82
82
|
int git_stream_register(git_stream_t type, git_stream_registration *registration)
|
83
83
|
{
|
84
|
-
|
84
|
+
GIT_ASSERT(!registration || registration->init);
|
85
85
|
|
86
86
|
GIT_ERROR_CHECK_VERSION(registration, GIT_STREAM_VERSION, "stream_registration");
|
87
87
|
|
@@ -100,7 +100,7 @@ int git_stream_register(git_stream_t type, git_stream_registration *registration
|
|
100
100
|
return 0;
|
101
101
|
}
|
102
102
|
|
103
|
-
|
103
|
+
#ifndef GIT_DEPRECATE_HARD
|
104
104
|
int git_stream_register_tls(
|
105
105
|
int GIT_CALLBACK(ctor)(git_stream **out, const char *host, const char *port))
|
106
106
|
{
|
@@ -116,3 +116,4 @@ int git_stream_register_tls(
|
|
116
116
|
return git_stream_register(GIT_STREAM_TLS, NULL);
|
117
117
|
}
|
118
118
|
}
|
119
|
+
#endif
|
@@ -183,7 +183,9 @@ static int default_socket_stream_new(
|
|
183
183
|
{
|
184
184
|
git_socket_stream *st;
|
185
185
|
|
186
|
-
|
186
|
+
GIT_ASSERT_ARG(out);
|
187
|
+
GIT_ASSERT_ARG(host);
|
188
|
+
GIT_ASSERT_ARG(port);
|
187
189
|
|
188
190
|
st = git__calloc(1, sizeof(git_socket_stream));
|
189
191
|
GIT_ERROR_CHECK_ALLOC(st);
|
@@ -217,7 +219,9 @@ int git_socket_stream_new(
|
|
217
219
|
git_stream_registration custom = {0};
|
218
220
|
int error;
|
219
221
|
|
220
|
-
|
222
|
+
GIT_ASSERT_ARG(out);
|
223
|
+
GIT_ASSERT_ARG(host);
|
224
|
+
GIT_ASSERT_ARG(port);
|
221
225
|
|
222
226
|
if ((error = git_stream_registry_lookup(&custom, GIT_STREAM_STANDARD)) == 0)
|
223
227
|
init = custom.init;
|
@@ -167,7 +167,7 @@ static ssize_t stransport_write(git_stream *stream, const char *data, size_t len
|
|
167
167
|
if ((ret = SSLWrite(st->ctx, data, data_len, &processed)) != noErr)
|
168
168
|
return stransport_error(ret);
|
169
169
|
|
170
|
-
|
170
|
+
GIT_ASSERT(processed < SSIZE_MAX);
|
171
171
|
return (ssize_t)processed;
|
172
172
|
}
|
173
173
|
|
@@ -251,7 +251,9 @@ static int stransport_wrap(
|
|
251
251
|
stransport_stream *st;
|
252
252
|
OSStatus ret;
|
253
253
|
|
254
|
-
|
254
|
+
GIT_ASSERT_ARG(out);
|
255
|
+
GIT_ASSERT_ARG(in);
|
256
|
+
GIT_ASSERT_ARG(host);
|
255
257
|
|
256
258
|
st = git__calloc(1, sizeof(stransport_stream));
|
257
259
|
GIT_ERROR_CHECK_ALLOC(st);
|
@@ -305,7 +307,8 @@ int git_stransport_stream_new(git_stream **out, const char *host, const char *po
|
|
305
307
|
git_stream *stream = NULL;
|
306
308
|
int error;
|
307
309
|
|
308
|
-
|
310
|
+
GIT_ASSERT_ARG(out);
|
311
|
+
GIT_ASSERT_ARG(host);
|
309
312
|
|
310
313
|
error = git_socket_stream_new(&stream, host, port);
|
311
314
|
|
@@ -8,7 +8,6 @@
|
|
8
8
|
#include "git2/errors.h"
|
9
9
|
|
10
10
|
#include "common.h"
|
11
|
-
#include "global.h"
|
12
11
|
#include "streams/registry.h"
|
13
12
|
#include "streams/tls.h"
|
14
13
|
#include "streams/mbedtls.h"
|
@@ -21,7 +20,9 @@ int git_tls_stream_new(git_stream **out, const char *host, const char *port)
|
|
21
20
|
git_stream_registration custom = {0};
|
22
21
|
int error;
|
23
22
|
|
24
|
-
|
23
|
+
GIT_ASSERT_ARG(out);
|
24
|
+
GIT_ASSERT_ARG(host);
|
25
|
+
GIT_ASSERT_ARG(port);
|
25
26
|
|
26
27
|
if ((error = git_stream_registry_lookup(&custom, GIT_STREAM_TLS)) == 0) {
|
27
28
|
init = custom.init;
|
@@ -50,7 +51,8 @@ int git_tls_stream_wrap(git_stream **out, git_stream *in, const char *host)
|
|
50
51
|
int (*wrap)(git_stream **, git_stream *, const char *) = NULL;
|
51
52
|
git_stream_registration custom = {0};
|
52
53
|
|
53
|
-
|
54
|
+
GIT_ASSERT_ARG(out);
|
55
|
+
GIT_ASSERT_ARG(in);
|
54
56
|
|
55
57
|
if (git_stream_registry_lookup(&custom, GIT_STREAM_TLS) == 0) {
|
56
58
|
wrap = custom.wrap;
|