78 lines
2.7 KiB
Makefile
78 lines
2.7 KiB
Makefile
# CertGen Examples Makefile
|
|
#if you installed wolfssl to an alternate location use CFLAGS and LIBS to
|
|
#control your build:
|
|
|
|
#EXAMPLE: set WOLFSSL_INSTALL_DIR to point to your install location like so:
|
|
|
|
# WOLFSSL_INSTALL_DIR=/Users/kalebhimes/work/testDir/wolf-install-dir-for-testing
|
|
|
|
#END EXAMPLE
|
|
|
|
WOLFSSL_INSTALL_DIR=/usr/local
|
|
|
|
# ECC Examples Makefile
|
|
CC = gcc
|
|
WOLFSSL_INSTALL_DIR = /usr/local
|
|
CFLAGS = -Wall -I$(WOLFSSL_INSTALL_DIR)/include
|
|
LIBS = -L$(WOLFSSL_INSTALL_DIR)/lib -lm
|
|
|
|
# option variables
|
|
DYN_LIB = -lwolfssl
|
|
STATIC_LIB = $(WOLFSSL_INSTALL_DIR)/lib/libwolfssl.a
|
|
DEBUG_FLAGS = -g -DDEBUG
|
|
DEBUG_INC_PATHS = -MD
|
|
OPTIMIZE = -Os
|
|
|
|
# Options
|
|
#CFLAGS+=$(DEBUG_FLAGS)
|
|
CFLAGS+=$(OPTIMIZE)
|
|
#LIBS+=$(STATIC_LIB)
|
|
LIBS+=$(DYN_LIB)
|
|
|
|
all:certgen_example certgen_ca_example csr_example csr_w_ed25519_example csr_sign csr_cryptocb csr_ecc_rawpub custom_ext custom_ext_callback
|
|
|
|
certgen_example:certgen_example.o
|
|
$(CC) -o $@ $^ $(CFLAGS) $(CPPFLAGS) $(LIBS)
|
|
|
|
certgen_ca_example:certgen_ca_example.o
|
|
$(CC) -o $@ $^ $(CFLAGS) $(CPPFLAGS) $(LIBS)
|
|
|
|
csr_example:csr_example.o
|
|
$(CC) -o $@ $^ $(CFLAGS) $(CPPFLAGS) $(LIBS)
|
|
|
|
csr_w_ed25519_example:csr_w_ed25519_example.o
|
|
$(CC) -o $@ $^ $(CFLAGS) $(CPPFLAGS) $(LIBS)
|
|
|
|
csr_sign:csr_sign.o
|
|
$(CC) -o $@ $^ $(CFLAGS) $(CPPFLAGS) $(LIBS)
|
|
|
|
csr_cryptocb:csr_cryptocb.o
|
|
$(CC) -o $@ $^ $(CFLAGS) $(CPPFLAGS) $(LIBS)
|
|
|
|
csr_ecc_rawpub:csr_ecc_rawpub.o
|
|
$(CC) -o $@ $^ $(CFLAGS) $(CPPFLAGS) $(LIBS)
|
|
|
|
custom_ext:custom_ext.o
|
|
$(CC) -o $@ $^ $(CFLAGS) $(CPPFLAGS) $(LIBS)
|
|
|
|
custom_ext_callback:custom_ext_callback.o
|
|
$(CC) -o $@ $^ $(CFLAGS) $(CPPFLAGS) $(LIBS)
|
|
|
|
.PHONY: clean all check
|
|
|
|
clean:
|
|
rm -f *.o certgen_example certgen_ca_example csr_example csr_w_ed25519_example csr_sign csr_cryptocb csr_ecc_rawpub custom_ext custom_ext_callback
|
|
rm -f newCert.*
|
|
|
|
check: certgen_example certgen_ca_example csr_w_ed25519_example csr_example csr_sign csr_cryptocb csr_ecc_rawpub custom_ext custom_ext_callback
|
|
out=$$(./certgen_example) && printf '%s' "$$out" | grep -q 'Tests passed'
|
|
out=$$(./certgen_ca_example) && printf '%s' "$$out" | grep -q 'Tests passed'
|
|
out=$$(./csr_w_ed25519_example 2>&1) && printf '%s' "$$out" | grep -q -- '-----END CERTIFICATE REQUEST-----'
|
|
out=$$(./csr_example ecc) && printf '%s' "$$out" | grep -q 'Saved PEM to "ecc-csr.pem"'
|
|
out=$$(./csr_sign ecc-csr.pem ca-ecc-cert.der ca-ecc-key.der) && printf '%s' "$$out" | grep -q 'Tests passed'
|
|
out=$$(./csr_cryptocb ecc) && printf '%s' "$$out" | grep -q 'Saved CSR PEM to "ecc-csr.pem"'
|
|
out=$$(./csr_ecc_rawpub) && printf '%s' "$$out" | grep -q 'Tests passed'
|
|
out=$$(./custom_ext) && printf '%s' "$$out" | grep -q 'Tests passed'
|
|
out=$$(./custom_ext_callback newCert.der) && printf '%s' "$$out" | grep -q 'Success'
|
|
@echo "PASS: certgen checks"
|