forked from teserakt-io/libe4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tidy up a number of uglies in the code, remove some magic consts, make++
This code: * Adds NULL guard checks. * Detects mlen overflow in encrypt. * Allows you to specify CSTD=c89, CSTD=c99, CSTD=c11 for the library. * Supports E4_OUTPUT_DIR for building code anywhere.
- Loading branch information
Showing
14 changed files
with
142 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,25 @@ | ||
|
||
VERSION=1.0.0 | ||
|
||
CC ?= clang | ||
AR ?= ar | ||
LD ?= clang | ||
ARFLAGS = rcs | ||
CFLAGS = -Wall -Werror -fPIC -std=$(CSTD) $(E4_CFLAGS) | ||
LDFLAGS = -L. $(E4_LDFLAGS) | ||
|
||
O = o | ||
|
||
TESTCFLAGS = -Wall -Werror -g -std=c11 $(E4_CFLAGS) | ||
TESTLDFLAGS= $(E4_LDFLAGS) | ||
|
||
GITCOMMIT=$(shell git rev-list -1 HEAD) | ||
NOW=$(shell date "+%Y%m%d%H%M") | ||
|
||
INCDIR = include | ||
SRCDIR = src | ||
DOCDIR = doc | ||
|
||
LIBNAME = libe4 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,19 @@ | ||
|
||
CC ?= clang | ||
AR ?= ar | ||
LD ?= clang | ||
ARFLAGS = rcs | ||
CFLAGS = -Wall -Werror -fPIC -std=c89 $(E4_CFLAGS) | ||
LDFLAGS = -L. $(E4_CFLAGS) | ||
LDSOFLAGS = -shared -fPIC -Wl,-soname,libe4p.so.1 | ||
INCLUDES = -Iinclude/ -Ibuild/pubkey/include/ | ||
E4_OUTPUT_DIR ?= build/pubkey | ||
|
||
# BUILD environment | ||
GITCOMMIT=$(shell git rev-list -1 HEAD) | ||
NOW=$(shell date "+%Y%m%d%H%M") | ||
LDSOFLAGS = -shared -fPIC -Wl,-soname,libe4p.so.1 | ||
INCLUDES = -Iinclude/ -I$(E4_OUTPUT_DIR)/include/ | ||
|
||
# OBJ paths match their src folder equivalents | ||
INCDIR = include | ||
OBJDIR = tmp/pubkey/build | ||
TESTOBJDIR = tmp/pubkey/test | ||
SRCDIR = src | ||
DOCDIR = doc | ||
BUILDDIR = build/pubkey | ||
LIBDIR = build/pubkey/lib | ||
OUTINCDIR = build/pubkey/include | ||
LIBNAME = libe4 | ||
LIB = $(LIBDIR)/$(LIBNAME).a | ||
LIBSO = $(LIBDIR)/$(LIBNAME)p.so.$(VERSION) | ||
|
||
BUILDDIR = $(E4_OUTPUT_DIR) | ||
LIBDIR = $(BUILDDIR)/lib | ||
OUTINCDIR = $(BUILDDIR)/include | ||
DISTDIR = dist/pubkey/ | ||
TESTDIR = build/pubkey/test | ||
TESTDIR = $(BUILDDIR)/test | ||
|
||
O = o | ||
LIB = $(LIBDIR)/$(LIBNAME).a | ||
LIBSO = $(LIBDIR)/$(LIBNAME)p.so.$(VERSION) | ||
|
||
# test specific parts: | ||
TESTCFLAGS = -Wall -Werror -g -std=c11 -Wno-unused-variable $(E4_CFLAGS) | ||
TESTLDFLAGS = $(LDFLAGS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,20 @@ | ||
|
||
CC ?= clang | ||
AR ?= ar | ||
ARFLAGS = rcs | ||
CFLAGS = -Wall -fPIC -Werror -std=c89 $(E4_CFLAGS) | ||
LDFLAGS = -L. $(E4_CFLAGS) | ||
LDSOFLAGS = -shared -fPIC -Wl,-soname,libe4s.so.1 | ||
INCLUDES = -Iinclude/ -Ibuild/symkey/include/ | ||
E4_OUTPUT_DIR ?= build/symkey | ||
|
||
# BUILD environment | ||
GITCOMMIT=$(shell git rev-list -1 HEAD) | ||
NOW=$(shell date "+%Y%m%d%H%M") | ||
LDSOFLAGS = -shared -fPIC -Wl,-soname,libe4s.so.1 | ||
INCLUDES = -Iinclude/ -I$(E4_OUTPUT_DIR)/include/ | ||
|
||
# OBJ paths match their src folder equivalents | ||
INCDIR = include | ||
OBJDIR = tmp/symkey/build | ||
TESTOBJDIR = tmp/symkey/test | ||
SRCDIR = src | ||
DOCDIR = doc | ||
BUILDDIR = build/symkey | ||
LIBDIR = build/symkey/lib | ||
OUTINCDIR = build/symkey/include | ||
LIBNAME = libe4 | ||
LIB = $(LIBDIR)/$(LIBNAME).a | ||
LIBSO = $(LIBDIR)/$(LIBNAME).so.$(VERSION) | ||
|
||
BUILDDIR = $(E4_OUTPUT_DIR) | ||
LIBDIR = $(BUILDDIR)/lib | ||
OUTINCDIR = $(BUILDDIR)/include | ||
DISTDIR = dist/symkey/ | ||
TESTDIR = build/symkey/test | ||
TESTDIR = $(BUILDDIR)/test | ||
|
||
LIB = $(LIBDIR)/$(LIBNAME).a | ||
LIBSO = $(LIBDIR)/$(LIBNAME)s.so.$(VERSION) | ||
|
||
O = o | ||
|
||
# test specific parts: | ||
TESTCFLAGS = -Wall -Werror -g -std=c11 $(E4_CFLAGS) | ||
TESTLDFLAGS = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.