Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,15 @@ android/wolfssljni-ndk-sample/proguard-project.txt
/psk/server-psk
/psk/server-tcp

/tls/client-async
/tls/client-tcp
/tls/client-tls
/tls/client-tls13
/tls/client-tls13-resume
/tls/client-tls-bio
/tls/client-tls-cacb
/tls/client-tls-callback
/tls/client-tls-cryptocb
/tls/client-tls-ecdhe
/tls/client-tls-nonblocking
/tls/client-tls-perf
Expand All @@ -89,10 +91,12 @@ android/wolfssljni-ndk-sample/proguard-project.txt

/tls/memory-tls

/tls/server-async
/tls/server-tcp
/tls/server-tls
/tls/server-tls13
/tls/server-tls-callback
/tls/server-tls-cryptocb
/tls/server-tls-ecdhe
/tls/server-tls-epoll-perf
/tls/server-tls-epoll-threaded
Expand Down
12 changes: 10 additions & 2 deletions tls/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ STATIC_LIB = $(LIB_PATH)/lib/libwolfssl.a
DEBUG_FLAGS = -g -DDEBUG
DEBUG_INC_PATHS = -MD
OPTIMIZE = -Os
DEPS =

# Options
#CFLAGS+=$(DEBUG_FLAGS)
Expand All @@ -19,9 +20,14 @@ CFLAGS+=$(OPTIMIZE)
#LIBS+=$(STATIC_LIB)
LIBS+=$(DYN_LIB)

# Openssl Option
#CFLAGS+=-DUSE_OPENSSL
#LIBS+=-lcrypto

# build targets
SRC=$(wildcard *.c)
TARGETS=$(patsubst %.c, %, $(SRC))
IGNORE_FILES=cryptocb-common
TARGETS=$(filter-out $(IGNORE_FILES), $(patsubst %.c, %, $(SRC)))
LINUX_SPECIFIC=client-tls-perf \
server-tls-poll-perf \
server-tls-epoll-perf \
Expand Down Expand Up @@ -97,9 +103,11 @@ memory-tls: CFLAGS+=-pthread
# compile tcp examples without the LIBS variable
%-tcp: LIBS=

%-cryptocb: DEPS+=cryptocb-common.c

# build template
%: %.c
$(CC) -o $@ $< $(CFLAGS) $(LIBS)
$(CC) -o $@ $(DEPS) $< $(CFLAGS) $(LIBS)

clean:
rm -f $(TARGETS)
12 changes: 6 additions & 6 deletions tls/client-tls-cacb.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static void CaCb(unsigned char* der, int sz, int type)
}

ret = wolfSSL_X509_get_serial_number(x509, serial, &sz);
if (ret == SSL_SUCCESS) {
if (ret == WOLFSSL_SUCCESS) {
int i;
int strLen;
char serialMsg[80];
Expand Down Expand Up @@ -134,28 +134,28 @@ int Security(int sock)
/* create and initialize WOLFSSL_CTX structure */
if ((ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method())) == NULL) {
printf("SSL_CTX_new error.\n");
ret = EXIT_FAILURE;
ret = EXIT_FAILURE;
goto exit;
}

/* set callback for action when CA's are added */
wolfSSL_CTX_SetCACb(ctx, CaCb);

/* load CA certificates into wolfSSL_CTX. which will verify the server */
if ((ret = wolfSSL_CTX_load_verify_locations(ctx, cert, 0))
if ((ret = wolfSSL_CTX_load_verify_locations(ctx, cert, 0))
!= WOLFSSL_SUCCESS) {
printf("Error loading %s. Please check the file.\n", cert);
goto exit;
}
if ((ssl = wolfSSL_new(ctx)) == NULL) {
printf("wolfSSL_new error.\n");
ret = EXIT_FAILURE;
ret = EXIT_FAILURE;
goto exit;
}
wolfSSL_set_fd(ssl, sock);

ret = wolfSSL_connect(ssl);
if (ret == SSL_SUCCESS) {
if (ret == WOLFSSL_SUCCESS) {
ret = ClientGreet(sock, ssl);
}

Expand Down Expand Up @@ -190,7 +190,7 @@ int main(int argc, char** argv)

if (sockfd < 0) {
printf("Failed to create socket. Error: %i\n", errno);
ret = EXIT_FAILURE;
ret = EXIT_FAILURE;
goto exit;
}

Expand Down
Loading