diff options
author | TJ Kolev <tjkolev@gmail.com> | 2023-02-03 11:19:26 -0600 |
---|---|---|
committer | TJ Kolev <tjkolev@gmail.com> | 2023-02-03 11:19:26 -0600 |
commit | 82c3ffe7019e1db4727d7e292bf9ab88b56de278 (patch) | |
tree | 39e3176f1c5dc00a8c897bceb783ff7671e7a22f | |
parent | e4ee42ea2063e1b97fc2939140da30b589975773 (diff) | |
download | dropbear-82c3ffe7019e1db4727d7e292bf9ab88b56de278.tar.gz |
Dropbear SSH File Reorg
The GitHub pipeline is based on the build.yml setup, which previously escaped me. That
script relies on default_options.h to be at top of the repo, as it uses it to
generate its own localoptions.h for various test sceanrios.
* default_options.h moved back to the top.
* config.h is also generated in the top folder.
* localoptions.h also stays at the top folder.
* Readjusted (reverted) the affected Makefile.in-s.
* Added notes about the generated file dependencies.
* Adjusted references to above files in the .md docs.
tjk :)
-rw-r--r-- | DEVELOPING.md | 19 | ||||
-rw-r--r-- | INSTALL.md | 4 | ||||
-rw-r--r-- | Makefile.in | 8 | ||||
-rw-r--r-- | default_options.h (renamed from src/default_options.h) | 0 | ||||
-rw-r--r-- | libtomcrypt/Makefile.in | 2 | ||||
-rw-r--r-- | libtommath/Makefile.in | 2 |
6 files changed, 24 insertions, 11 deletions
diff --git a/DEVELOPING.md b/DEVELOPING.md index 65ae9ae..3c7f866 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -3,16 +3,29 @@ #### Building See [INSTALL.md](INSTALL.md) for build instructions. -[SMALL.md](SMALL.md) has hints for building smaller binaries, also see comments in [default_options.h](./src/default_options.h). +[SMALL.md](SMALL.md) has hints for building smaller binaries, also see comments in [default_options.h](./default_options.h). To be able to debug add `-g` compiler option to the `CFLAGS` environment variable. This will generate debug symbols. ``` export CFLAGS="$CFLAGS -g" ``` +#### File dependencies +The GitHub [test build script](./github/workflows/build.yml) requires the [default_options.h](./default_options.h) be at the top of the repository tree. The script uses the file to generate localoptions.h with various features enabled/disabled. + +Following are generated files in the format \<target\>: \<generator\>(\<source\>) +``` +- configure: autoconf(configure.ac) +- config.h.in: autoheader(configure.ac) +- config.h: configure(config.h.in) +- Makefile: configure(Makefile.in) +- default_options_guard.h: make(default_options.h) +``` +Although generated, the first two files are checked in as they change very infrequently. + #### Debug printing -Set `#define DEBUG_TRACE 1` in [localoptions.h](./src/localoptions.h) to enable a `-v` option for dropbear and dbclient. That prints various details of the session. For development running `dropbear -F -E` is useful to run in the foreground. You can set `#define DEBUG_NOFORK 1` to make dropbear a one-shot server, easy to run under a debugger. +Set `#define DEBUG_TRACE 1` in [localoptions.h](./localoptions.h) to enable a `-v` option for dropbear and dbclient. That prints various details of the session. For development running `dropbear -F -E` is useful to run in the foreground. You can set `#define DEBUG_NOFORK 1` to make dropbear a one-shot server, easy to run under a debugger. #### Random sources @@ -22,7 +35,7 @@ Most cryptography requires a good random entropy source, both to generate secret Default algorithm lists are specified in [common-algo.c](./src/common-algo.c). They are in priority order, the client's first matching choice is used (see [rfc4253](https://www.rfc-editor.org/rfc/rfc4253.html)). Dropbear client has `-c` and `-m` arguments to choose which are enabled at runtime (doesn't work for server as of June 2020). -Enabling/disabling algorithms is done in [localoptions.h](./src/localoptions.h), see [default_options.h](./src/default_options.h). +Enabling/disabling algorithms is done in [localoptions.h](./localoptions.h), see [default_options.h](./default_options.h). #### Style @@ -1,6 +1,6 @@ ## Basic Dropbear Build Instructions -Edit [localoptions.h](./src/localoptions.h) to set which features you want. Available options are described in default_options.h, these will be overridden by anything set in [localoptions.h](./src/localoptions.h) should be located in the build directory if you are building out of tree. +Edit [localoptions.h](./localoptions.h) to set which features you want. Available options are described in default_options.h, these will be overridden by anything set in [localoptions.h](./localoptions.h) should be located in the build directory if you are building out of tree. Note that the file is not tracked ([*.gitignore*](.gitignore)-d) and you may need to create it. #### Configure for your system @@ -53,7 +53,7 @@ Binaries can be stripped with `make strip`. Firstly, make sure you have at least uclibc 0.9.17, as `getusershell()` in prior versions is broken. Also note that you may get strange issues if your uClibc headers don't match the library you are running with, ie the headers might say that shadow password support exists, but the libraries don't have it. -Compiling for uClibc should be the same as normal, just set CC to the magic uClibc toolchain compiler (ie `export CC=i386-uclibc-gcc` or whatever). You can use `make STATIC=1` to make statically linked binaries, and it is advisable to strip the binaries too. If you're looking to make a small binary, you should remove unneeded ciphers and algorithms, by editing [localoptions.h](./src/localoptions.h). +Compiling for uClibc should be the same as normal, just set CC to the magic uClibc toolchain compiler (ie `export CC=i386-uclibc-gcc` or whatever). You can use `make STATIC=1` to make statically linked binaries, and it is advisable to strip the binaries too. If you're looking to make a small binary, you should remove unneeded ciphers and algorithms, by editing [localoptions.h](./localoptions.h). It is possible to compile zlib in, by copying zlib.h and zconf.h into a subdirectory (ie zlibincludes), and diff --git a/Makefile.in b/Makefile.in index 80699c4..4a9dada 100644 --- a/Makefile.in +++ b/Makefile.in @@ -27,7 +27,7 @@ ifeq (@BUNDLED_LIBTOM@, 1) LIBTOM_LIBS=$(STATIC_LTC) $(STATIC_LTM) endif -OPTION_HEADERS = $(srcdir)/default_options_guard.h $(srcdir)/sysoptions.h +OPTION_HEADERS = default_options_guard.h $(srcdir)/sysoptions.h ifneq ($(wildcard $(srcdir)/localoptions.h),) CPPFLAGS+=-DLOCALOPTIONS_H_EXISTS OPTION_HEADERS += $(srcdir)/localoptions.h @@ -116,7 +116,7 @@ AR=@AR@ RANLIB=@RANLIB@ STRIP=@STRIP@ INSTALL=@INSTALL@ -CPPFLAGS+=@CPPFLAGS@ -I$(srcdir) +CPPFLAGS+=@CPPFLAGS@ -I. -I$(srcdir) CFLAGS+=@CFLAGS@ LIBS+=@LIBS@ LDFLAGS=@LDFLAGS@ @@ -166,7 +166,7 @@ $(OBJ_DIR): $(OBJ_DIR)/%.o: $(srcdir)/%.c $(HEADERS) | $(OBJ_DIR) $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ -$(srcdir)/default_options_guard.h: $(srcdir)/default_options.h +default_options_guard.h: default_options.h @echo Creating $@ @printf "/*\n > > > Do not edit this file (default_options_guard.h) < < <\nGenerated from "$^"\nLocal customisation goes in localoptions.h\n*/\n\n" > $@.tmp @./ifndef_wrapper.sh < $^ >> $@.tmp @@ -272,7 +272,7 @@ thisclean: distclean: clean tidy -rm -f config.h -rm -f Makefile - -rm -f $(srcdir)/default_options_guard.h + -rm -f default_options_guard.h tidy: -rm -f *~ *.gcov */*~ diff --git a/src/default_options.h b/default_options.h index 5132775..5132775 100644 --- a/src/default_options.h +++ b/default_options.h diff --git a/libtomcrypt/Makefile.in b/libtomcrypt/Makefile.in index c863dfe..15777d2 100644 --- a/libtomcrypt/Makefile.in +++ b/libtomcrypt/Makefile.in @@ -42,7 +42,7 @@ ARFLAGS = r EXTRALIBS = ../libtommath/libtommath.a #Compilation flags -LTC_CFLAGS = -Isrc/headers/ -I$(srcdir)/src/headers/ -I$(srcdir)/../src -DLTC_SOURCE -I../libtommath/ -I$(srcdir)/../libtommath/ $(CFLAGS) $(CPPFLAGS) +LTC_CFLAGS = -Isrc/headers/ -I$(srcdir)/src/headers/ -I$(srcdir)/.. -I$(srcdir)/../src -DLTC_SOURCE -I../libtommath/ -I$(srcdir)/../libtommath/ $(CFLAGS) $(CPPFLAGS) LTC_LDFLAGS = $(LDFLAGS) $(EXTRALIBS) VERSION=1.18.1 diff --git a/libtommath/Makefile.in b/libtommath/Makefile.in index 1f17c57..d44fc38 100644 --- a/libtommath/Makefile.in +++ b/libtommath/Makefile.in @@ -6,7 +6,7 @@ VPATH=@srcdir@ srcdir=@srcdir@ # So that libtommath can include Dropbear headers for options and m_burn() -CFLAGS += -I$(srcdir) -I../libtomcrypt/src/headers/ -I$(srcdir)/../libtomcrypt/src/headers/ -I$(srcdir)/../src +CFLAGS += -I$(srcdir) -I../libtomcrypt/src/headers/ -I$(srcdir)/../libtomcrypt/src/headers/ -I$(srcdir)/.. -I$(srcdir)/../src CFLAGS += -Wno-deprecated CFLAGS += $(CPPFLAGS) |