Stuff caught by dgarske

pull/271/head
Anthony Hu 2021-11-01 19:06:33 -04:00
parent 858c0c1744
commit 02662f720d
4 changed files with 13 additions and 46 deletions

View File

@ -1,4 +1,4 @@
# TLS Examples Makefile # PQ Examples Makefile
CC = gcc CC = gcc
LIB_PATH = /usr/local LIB_PATH = /usr/local
CFLAGS = -Wall -I$(LIB_PATH)/include CFLAGS = -Wall -I$(LIB_PATH)/include
@ -21,41 +21,6 @@ LIBS+=$(DYN_LIB)
SRC=$(wildcard *.c) SRC=$(wildcard *.c)
TARGETS=$(patsubst %.c, %, $(SRC)) TARGETS=$(patsubst %.c, %, $(SRC))
# OS / CPU Detection
OS_DET=UNKNOWN
CPU_DET=UNKNOWN
ifeq ($(OS),Windows_NT)
OS_DET=WIN32
ifeq ($(PROCESSOR_ARCHITEW6432),AMD64)
CPU_DET=AMD64
else
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
CPU_DET=AMD64
endif
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
CPU_DET=IA32
endif
endif
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OS_DET=LINUX
endif
ifeq ($(UNAME_S),Darwin)
OS_DET=OSX
endif
UNAME_P := $(shell uname -p)
ifeq ($(UNAME_P),x86_64)
CPU_DET=AMD64
endif
ifneq ($(filter %86,$(UNAME_P)),)
CPU_DET=IA32
endif
ifneq ($(filter arm%,$(UNAME_P)),)
CPU_DET=ARM
endif
endif
.PHONY: clean all .PHONY: clean all
all: $(TARGETS) all: $(TARGETS)

View File

@ -1,6 +1,6 @@
/* client-tls13.c /* client-pq-tls13.c
* *
* Copyright (C) 2006-2020 wolfSSL Inc. * Copyright (C) 2021 wolfSSL Inc.
* *
* This file is part of wolfSSL. (formerly known as CyaSSL) * This file is part of wolfSSL. (formerly known as CyaSSL)
* *
@ -112,7 +112,7 @@ static int Tls13SecretCallback(WOLFSSL* ssl, int id, const unsigned char* secret
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
int ret = 0; int ret = 0;
#ifdef WOLFSSL_TLS13 #if defined(WOLFSSL_TLS13) && defined(HAVE_LIBOQS)
int sockfd = SOCKET_INVALID; int sockfd = SOCKET_INVALID;
struct sockaddr_in servAddr; struct sockaddr_in servAddr;
char buff[256]; char buff[256];
@ -256,7 +256,8 @@ exit:
wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */ wolfSSL_CTX_free(ctx); /* Free the wolfSSL context object */
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */ wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */
#else #else
printf("Example requires TLS v1.3\n"); printf("Example requires TLS v1.3 and liboqs.\n");
printf("Configure wolfssl like this: ./configure --with-liboqs\n");
#endif #endif
(void)argc; (void)argc;
(void)argv; (void)argv;

View File

@ -8,7 +8,7 @@
# Execute this script in the openssl directory after building OQS's fork of # Execute this script in the openssl directory after building OQS's fork of
# OpenSSL. Please see the README.md file for more details. # OpenSSL. Please see the README.md file for more details.
if [[ ! -v OPENSSL ]]; then if [ "$OPENSSL" = "" ]; then
OPENSSL=./apps/openssl OPENSSL=./apps/openssl
fi fi

View File

@ -1,6 +1,6 @@
/* server-tls13.c /* server-pq-tls13.c
* *
* Copyright (C) 2006-2020 wolfSSL Inc. * Copyright (C) 2021 wolfSSL Inc.
* *
* This file is part of wolfSSL. (formerly known as CyaSSL) * This file is part of wolfSSL. (formerly known as CyaSSL)
* *
@ -140,7 +140,7 @@ static void sig_handler(const int sig)
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
int ret = 0; int ret = 0;
#ifdef WOLFSSL_TLS13 #if defined(WOLFSSL_TLS13) && defined(HAVE_LIBOQS)
struct sockaddr_in servAddr; struct sockaddr_in servAddr;
struct sockaddr_in clientAddr; struct sockaddr_in clientAddr;
socklen_t size = sizeof(clientAddr); socklen_t size = sizeof(clientAddr);
@ -319,7 +319,8 @@ exit:
wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */ wolfSSL_Cleanup(); /* Cleanup the wolfSSL environment */
#else #else
printf("Example requires TLS v1.3\n"); printf("Example requires TLS v1.3 and liboqs.\n");
printf("Configure wolfssl like this: ./configure --with-liboqs\n");
#endif /* WOLFSSL_TLS13 */ #endif /* WOLFSSL_TLS13 */
(void)argc; (void)argc;