~mcf/libtls-bearssl

4 2

[PATCH 1/3] Split code into include/ and src/

Details
Message ID
<20200819185441.24226-1-issam.e.maghni@mailbox.org>
DKIM signature
missing
Download raw message
Patch: +19 -19
Signed-off-by: Issam E. Maghni <issam.e.maghni@mailbox.org>
---
 Makefile                                   | 38 +++++++++++-----------
 compat.h => include/compat.h               |  0
 tls.h => include/tls.h                     |  0
 tls_internal.h => include/tls_internal.h   |  0
 bearssl.c => src/bearssl.c                 |  0
 {compat => src/compat}/freezero.c          |  0
 {compat => src/compat}/reallocarray.c      |  0
 {compat => src/compat}/timingsafe_memcmp.c |  0
 tls.c => src/tls.c                         |  0
 tls_bio_cb.c => src/tls_bio_cb.c           |  0
 tls_client.c => src/tls_client.c           |  0
 tls_config.c => src/tls_config.c           |  0
 tls_conninfo.c => src/tls_conninfo.c       |  0
 tls_keypair.c => src/tls_keypair.c         |  0
 tls_ocsp.c => src/tls_ocsp.c               |  0
 tls_peer.c => src/tls_peer.c               |  0
 tls_server.c => src/tls_server.c           |  0
 tls_util.c => src/tls_util.c               |  0
 tls_verify.c => src/tls_verify.c           |  0
 19 files changed, 19 insertions(+), 19 deletions(-)
 rename compat.h => include/compat.h (100%)
 rename tls.h => include/tls.h (100%)
 rename tls_internal.h => include/tls_internal.h (100%)
 rename bearssl.c => src/bearssl.c (100%)
 rename {compat => src/compat}/freezero.c (100%)
 rename {compat => src/compat}/reallocarray.c (100%)
 rename {compat => src/compat}/timingsafe_memcmp.c (100%)
 rename tls.c => src/tls.c (100%)
 rename tls_bio_cb.c => src/tls_bio_cb.c (100%)
 rename tls_client.c => src/tls_client.c (100%)
 rename tls_config.c => src/tls_config.c (100%)
 rename tls_conninfo.c => src/tls_conninfo.c (100%)
 rename tls_keypair.c => src/tls_keypair.c (100%)
 rename tls_ocsp.c => src/tls_ocsp.c (100%)
 rename tls_peer.c => src/tls_peer.c (100%)
 rename tls_server.c => src/tls_server.c (100%)
 rename tls_util.c => src/tls_util.c (100%)
 rename tls_verify.c => src/tls_verify.c (100%)

diff --git a/Makefile b/Makefile
index 6903d2c..8b0f7fd 100644
--- a/Makefile
+++ b/Makefile
@@ -8,24 +8,24 @@ PREFIX?=/usr/local
INCDIR?=$(PREFIX)/include
LIBDIR?=$(PREFIX)/lib
MANDIR?=$(PREFIX)/share/man
CFLAGS+=-Wall -Wpedantic -D _DEFAULT_SOURCE -I .
CFLAGS+=-Wall -Wpedantic -D _DEFAULT_SOURCE -I include

OBJ=\
	tls.o\
	tls_bio_cb.o\
	tls_client.o\
	tls_config.o\
	tls_conninfo.o\
	tls_keypair.o\
	tls_ocsp.o\
	tls_peer.o\
	tls_server.o\
	tls_util.o\
	tls_verify.o\
	bearssl.o\
	compat/freezero.o\
	compat/reallocarray.o\
	compat/timingsafe_memcmp.o
	src/tls.o\
	src/tls_bio_cb.o\
	src/tls_client.o\
	src/tls_config.o\
	src/tls_conninfo.o\
	src/tls_keypair.o\
	src/tls_ocsp.o\
	src/tls_peer.o\
	src/tls_server.o\
	src/tls_util.o\
	src/tls_verify.o\
	src/bearssl.o\
	src/compat/freezero.o\
	src/compat/reallocarray.o\
	src/compat/timingsafe_memcmp.o

MAN=\
	man/tls_accept_socket.3\
@@ -43,7 +43,7 @@ MAN=\

all: libtls.a

$(OBJ): tls.h tls_internal.h compat.h
$(OBJ): include/tls.h include/tls_internal.h include/compat.h

.c.o:
	$(CC) $(CFLAGS) -c -o $@ $<
@@ -57,9 +57,9 @@ libtls.pc: libtls.pc.in
	    -e "s,@includedir@,$(INCDIR),"\
	    libtls.pc.in >$@.tmp && mv $@.tmp $@

install: tls.h libtls.a libtls.pc $(MAN)
install: include/tls.h libtls.a libtls.pc $(MAN)
	mkdir -p $(DESTDIR)$(INCDIR)
	cp tls.h $(DESTDIR)$(INCDIR)/
	cp include/tls.h $(DESTDIR)$(INCDIR)/
	mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig/
	cp libtls.a $(DESTDIR)$(LIBDIR)/
	cp libtls.pc $(DESTDIR)$(LIBDIR)/pkgconfig/
diff --git a/compat.h b/include/compat.h
similarity index 100%
rename from compat.h
rename to include/compat.h
diff --git a/tls.h b/include/tls.h
similarity index 100%
rename from tls.h
rename to include/tls.h
diff --git a/tls_internal.h b/include/tls_internal.h
similarity index 100%
rename from tls_internal.h
rename to include/tls_internal.h
diff --git a/bearssl.c b/src/bearssl.c
similarity index 100%
rename from bearssl.c
rename to src/bearssl.c
diff --git a/compat/freezero.c b/src/compat/freezero.c
similarity index 100%
rename from compat/freezero.c
rename to src/compat/freezero.c
diff --git a/compat/reallocarray.c b/src/compat/reallocarray.c
similarity index 100%
rename from compat/reallocarray.c
rename to src/compat/reallocarray.c
diff --git a/compat/timingsafe_memcmp.c b/src/compat/timingsafe_memcmp.c
similarity index 100%
rename from compat/timingsafe_memcmp.c
rename to src/compat/timingsafe_memcmp.c
diff --git a/tls.c b/src/tls.c
similarity index 100%
rename from tls.c
rename to src/tls.c
diff --git a/tls_bio_cb.c b/src/tls_bio_cb.c
similarity index 100%
rename from tls_bio_cb.c
rename to src/tls_bio_cb.c
diff --git a/tls_client.c b/src/tls_client.c
similarity index 100%
rename from tls_client.c
rename to src/tls_client.c
diff --git a/tls_config.c b/src/tls_config.c
similarity index 100%
rename from tls_config.c
rename to src/tls_config.c
diff --git a/tls_conninfo.c b/src/tls_conninfo.c
similarity index 100%
rename from tls_conninfo.c
rename to src/tls_conninfo.c
diff --git a/tls_keypair.c b/src/tls_keypair.c
similarity index 100%
rename from tls_keypair.c
rename to src/tls_keypair.c
diff --git a/tls_ocsp.c b/src/tls_ocsp.c
similarity index 100%
rename from tls_ocsp.c
rename to src/tls_ocsp.c
diff --git a/tls_peer.c b/src/tls_peer.c
similarity index 100%
rename from tls_peer.c
rename to src/tls_peer.c
diff --git a/tls_server.c b/src/tls_server.c
similarity index 100%
rename from tls_server.c
rename to src/tls_server.c
diff --git a/tls_util.c b/src/tls_util.c
similarity index 100%
rename from tls_util.c
rename to src/tls_util.c
diff --git a/tls_verify.c b/src/tls_verify.c
similarity index 100%
rename from tls_verify.c
rename to src/tls_verify.c
-- 
2.28.0

[PATCH 3/3] Add _GNU_SOURCE in src/tls.c for [v]asprintf

Details
Message ID
<20200819185441.24226-3-issam.e.maghni@mailbox.org>
In-Reply-To
<20200819185441.24226-1-issam.e.maghni@mailbox.org> (view parent)
DKIM signature
missing
Download raw message
Patch: +2 -0
_GNU_SOURCE is also used by musl.
https://git.musl-libc.org/cgit/musl/tree/include/stdio.h?h=v1.2.1#n166

Signed-off-by: Issam E. Maghni <issam.e.maghni@mailbox.org>
---
 src/tls.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/tls.c b/src/tls.c
index 8595ecd..a81c3b2 100644
--- a/src/tls.c
+++ b/src/tls.c
@@ -15,6 +15,8 @@
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#define _GNU_SOURCE

#include <sys/socket.h>

#include <errno.h>
-- 
2.28.0
Details
Message ID
<CAGw6cBts9BQg6pOSvEh1P2eFZjYQvpV5V9_w4ew=a_BUZBeX4A@mail.gmail.com>
In-Reply-To
<20200819185441.24226-1-issam.e.maghni@mailbox.org> (view parent)
DKIM signature
missing
Download raw message
Sorry for the huge delay. I hadn't set up mailing list filters, so
these slipped passed me.

I don't quite understand the motivation for this change. Could you
explain what problem this solves?
Details
Message ID
<C6EJ7Q041FZN.WMXS0WQPXMJQ@v01d>
In-Reply-To
<CAGw6cBts9BQg6pOSvEh1P2eFZjYQvpV5V9_w4ew=a_BUZBeX4A@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
On Thu Oct 15, 2020 at 7:09 PM Michael Forney wrote:
> Sorry for the huge delay.

Don’t worry, I don’t mind.

> I don't quite understand the motivation for this change. Could you
> explain what problem this solves?

Well, it cleans the repository by having a clear cut between source
code, headers, documentation, build systems, etc.

I maintain a forked version where I added Meson build system to ease the
development (e.g. auto generation of compile_commands.json) and fixed
some defines. See https://git.sr.ht/~iemaghni/libtls-bearssl. Feel free
to upstream my changes if you want :)

I also maintain a forked version of BearSSL with Meson build system here
https://git.sr.ht/~iemaghni/libbearssl. I moved all the bearssl_*.h into
bearssl/*.h. Naturally, I proposed to upstream my changes to Thomas
Pornin but I have not heard a responce since.

Issam E.
Details
Message ID
<CAGw6cBu6kW2sVR0vmsBtWomhveeSUwqzCRXwBTiXnRgK=u=9wA@mail.gmail.com>
In-Reply-To
<C6EJ7Q041FZN.WMXS0WQPXMJQ@v01d> (view parent)
DKIM signature
missing
Download raw message
On 2020-10-16, Issam E. Maghni <issam.e.maghni@mailbox.org> wrote:
> Well, it cleans the repository by having a clear cut between source
> code, headers, documentation, build systems, etc.

I actually find that the source is easier to work with a flat
hierarchy. Occasionally I am fine with an "include" directory, but I
think it should only contain headers meant to be installed into
$PREFIX/include, not internal headers like tls_internal.h.

> I maintain a forked version where I added Meson build system to ease the
> development (e.g. auto generation of compile_commands.json) and fixed
> some defines. See https://git.sr.ht/~iemaghni/libtls-bearssl. Feel free
> to upstream my changes if you want :)

I am not interested in meson. In my experience it is more difficult to
use as an end-user than autotools, adds more build time dependencies
(python, meson, ninja), and is less configurable. It is difficult to
control precisely how dependencies are detected (as opposed to being
able to set foo_{CFLAGS,LIBS,LDFLAGS}), and it only works with a
specific set of hardcoded compilers (i.e. I can't use my own compiler
cproc, despite it following the POSIX c99(1) interface). make(1) is a
POSIX standard tool and is available everywhere.

Regarding the other changes, I prefer to just not enable warnings with
questionable value (-Wextra) in the first place rather than adding a
bunch of non-standard annotations to disable the warning.

Anyway, I apologize if this comes across as a bit harsh. Of course you
are free to maintain your forks with meson if that works better for
you, and I am happy you are interested in libtls-bearssl. It's just
not the first time I've received pull-requests/patches for projects
that reorganize source files and/or port to meson. I hope you can
understand my position here.

-Michael
Reply to thread Export thread (mbox)