Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

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
Next Next commit
add mbedtls stream initialization
  • Loading branch information
wildart committed Jul 29, 2016
commit 4f8968b682d782704aec913e3e97f1a2579c46d1
8 changes: 8 additions & 0 deletions src/global.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
#include "sysdir.h"
#include "filter.h"
#include "merge_driver.h"
#ifdef GIT_OPENSSL
#include "openssl_stream.h"
#elif GIT_MBEDTLS
#include "mbedtls_stream.h"
#endif
#include "thread-utils.h"
#include "git2/global.h"
#include "transports/ssh.h"
Expand Down Expand Up @@ -62,7 +66,11 @@ static int init_common(void)
(ret = git_filter_global_init()) == 0 &&
(ret = git_merge_driver_global_init()) == 0 &&
(ret = git_transport_ssh_global_init()) == 0)
#ifdef GIT_OPENSSL
ret = git_openssl_stream_global_init();
#elif GIT_MBEDTLS
ret = git_mbedtls_stream_global_init();
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We didn't need to ifdef-away the OpenSSL stream init, and we definitely shouldn't need it now. If there is no mbedtls, its init function should no-op. We define an interface and program against it.


GIT_MEMORY_BARRIER;

Expand Down
2 changes: 2 additions & 0 deletions src/mbedtls_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

#include "git2/sys/stream.h"

extern int git_mbedtls_stream_global_init(void);

extern int git_mbedtls_stream_new(git_stream **out, const char *host, const char *port);

#endif