Skip to content

Commit fdcadd9

Browse files
committed
Dropbear SSH - file structure reorg
Separating source and binaries. * Dropbear source files (.c, .h) were moved under a new ./src folder. * Object binaries get generated into the ./obj folder. This helps to keep less cluttered project. tjk :)
1 parent 9defeb4 commit fdcadd9

File tree

146 files changed

+49
-36
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+49
-36
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*.bbg
77
*.prof
88
.*.swp
9+
/obj
910
/autom4te.cache
1011
/config.log
1112
/config.status
@@ -27,3 +28,4 @@ tags
2728
.pytest*
2829
*.pyc
2930
/test/venv
31+
.vscode/

Makefile.in

Lines changed: 43 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,30 @@ ifndef PROGRAMS
1212
PROGRAMS=dropbear dbclient dropbearkey dropbearconvert
1313
endif
1414

15+
srcdir=./src
16+
VPATH=$(srcdir)
17+
1518
STATIC_LTC=libtomcrypt/libtomcrypt.a
1619
STATIC_LTM=libtommath/libtommath.a
1720

1821
LIBTOM_LIBS=@LIBTOM_LIBS@
1922

2023
ifeq (@BUNDLED_LIBTOM@, 1)
21-
LIBTOM_DEPS=$(STATIC_LTC) $(STATIC_LTM)
22-
LIBTOM_CLEAN=ltc-clean ltm-clean
23-
CPPFLAGS+=-I$(srcdir)/libtomcrypt/src/headers/
24-
LIBTOM_LIBS=$(STATIC_LTC) $(STATIC_LTM)
24+
LIBTOM_DEPS=$(STATIC_LTC) $(STATIC_LTM)
25+
LIBTOM_CLEAN=ltc-clean ltm-clean
26+
CPPFLAGS+=-I./libtomcrypt/src/headers/ -I./libtommath
27+
LIBTOM_LIBS=$(STATIC_LTC) $(STATIC_LTM)
2528
endif
2629

27-
OPTION_HEADERS = default_options_guard.h sysoptions.h
28-
ifneq ($(wildcard localoptions.h),)
29-
CPPFLAGS+=-DLOCALOPTIONS_H_EXISTS
30-
OPTION_HEADERS += localoptions.h
30+
OPTION_HEADERS = $(srcdir)/default_options_guard.h $(srcdir)/sysoptions.h
31+
ifneq ($(wildcard $(srcdir)/localoptions.h),)
32+
CPPFLAGS+=-DLOCALOPTIONS_H_EXISTS
33+
OPTION_HEADERS += $(srcdir)/localoptions.h
3134
endif
3235

33-
COMMONOBJS=dbutil.o buffer.o dbhelpers.o \
36+
OBJ_DIR=./obj
37+
38+
_COMMONOBJS=dbutil.o buffer.o dbhelpers.o \
3439
dss.o bignum.o \
3540
signkey.o rsa.o dbrandom.o \
3641
queue.o \
@@ -39,27 +44,34 @@ COMMONOBJS=dbutil.o buffer.o dbhelpers.o \
3944
curve25519.o ed25519.o sk-ed25519.o \
4045
dbmalloc.o \
4146
gensignkey.o gendss.o genrsa.o gened25519.o
47+
COMMONOBJS = $(patsubst %,$(OBJ_DIR)/%,$(_COMMONOBJS))
4248

43-
SVROBJS=svr-kex.o svr-auth.o sshpty.o \
49+
_SVROBJS=svr-kex.o svr-auth.o sshpty.o \
4450
svr-authpasswd.o svr-authpubkey.o svr-authpubkeyoptions.o svr-session.o svr-service.o \
4551
svr-chansession.o svr-runopts.o svr-agentfwd.o svr-main.o svr-x11fwd.o\
4652
svr-tcpfwd.o svr-authpam.o
53+
SVROBJS = $(patsubst %,$(OBJ_DIR)/%,$(_SVROBJS))
4754

48-
CLIOBJS=cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \
55+
_CLIOBJS=cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o \
4956
cli-session.o cli-runopts.o cli-chansession.o \
5057
cli-authpubkey.o cli-tcpfwd.o cli-channel.o cli-authinteract.o \
5158
cli-agentfwd.o
59+
CLIOBJS = $(patsubst %,$(OBJ_DIR)/%,$(_CLIOBJS))
5260

53-
CLISVROBJS=common-session.o packet.o common-algo.o common-kex.o \
54-
common-channel.o common-chansession.o termcodes.o loginrec.o \
55-
tcp-accept.o listener.o process-packet.o dh_groups.o \
56-
common-runopts.o circbuffer.o list.o netio.o chachapoly.o gcm.o
61+
_CLISVROBJS=common-session.o packet.o common-algo.o common-kex.o \
62+
common-channel.o common-chansession.o termcodes.o loginrec.o \
63+
tcp-accept.o listener.o process-packet.o dh_groups.o \
64+
common-runopts.o circbuffer.o list.o netio.o chachapoly.o gcm.o
65+
CLISVROBJS = $(patsubst %,$(OBJ_DIR)/%,$(_CLISVROBJS))
5766

58-
KEYOBJS=dropbearkey.o
67+
_KEYOBJS=dropbearkey.o
68+
KEYOBJS = $(patsubst %,$(OBJ_DIR)/%,$(_KEYOBJS))
5969

60-
CONVERTOBJS=dropbearconvert.o keyimport.o signkey_ossh.o
70+
_CONVERTOBJS=dropbearconvert.o keyimport.o signkey_ossh.o
71+
CONVERTOBJS = $(patsubst %,$(OBJ_DIR)/%,$(_CONVERTOBJS))
6172

62-
SCPOBJS=scp.o progressmeter.o atomicio.o scpmisc.o compat.o
73+
_SCPOBJS=scp.o progressmeter.o atomicio.o scpmisc.o compat.o
74+
SCPOBJS = $(patsubst %,$(OBJ_DIR)/%,$(_SCPOBJS))
6375

6476
ifeq (@DROPBEAR_FUZZ@, 1)
6577
allobjs = $(COMMONOBJS) fuzz/fuzz-common.o fuzz/fuzz-wrapfd.o $(CLISVROBJS) $(CLIOBJS) $(SVROBJS) @CRYPTLIB@
@@ -82,17 +94,14 @@ else
8294
endif
8395

8496
ifeq (@DROPBEAR_PLUGIN@, 1)
85-
# rdynamic makes all the global symbols of dropbear available to all the loaded shared libraries
86-
# this allow a plugin to reuse existing crypto/utilities like base64_decode/base64_encode without
87-
# the need to rewrite them.
88-
PLUGIN_LIBS=-ldl -rdynamic
97+
# rdynamic makes all the global symbols of dropbear available to all the loaded shared libraries
98+
# this allow a plugin to reuse existing crypto/utilities like base64_decode/base64_encode without
99+
# the need to rewrite them.
100+
PLUGIN_LIBS=-ldl -rdynamic
89101
else
90-
PLUGIN_LIBS=
102+
PLUGIN_LIBS=
91103
endif
92104

93-
VPATH=@srcdir@
94-
srcdir=@srcdir@
95-
96105
prefix=@prefix@
97106
exec_prefix=@exec_prefix@
98107
datarootdir = @datarootdir@
@@ -107,7 +116,7 @@ AR=@AR@
107116
RANLIB=@RANLIB@
108117
STRIP=@STRIP@
109118
INSTALL=@INSTALL@
110-
CPPFLAGS+=@CPPFLAGS@ -I. -I$(srcdir)
119+
CPPFLAGS+=@CPPFLAGS@ -I$(srcdir)
111120
CFLAGS+=@CFLAGS@
112121
LIBS+=@LIBS@
113122
LDFLAGS=@LDFLAGS@
@@ -150,7 +159,11 @@ all: $(TARGETS)
150159

151160
# for simplicity assume all source depends on all headers
152161
HEADERS=$(wildcard $(srcdir)/*.h *.h) $(OPTION_HEADERS)
153-
%.o : %.c $(HEADERS)
162+
163+
$(OBJ_DIR):
164+
mkdir -p $@
165+
166+
$(OBJ_DIR)/%.o: $(srcdir)/%.c $(HEADERS) | $(OBJ_DIR)
154167
$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
155168

156169
default_options_guard.h: default_options.h
@@ -253,7 +266,8 @@ clean: $(LIBTOM_CLEAN) $(FUZZ_CLEAN) thisclean
253266
thisclean:
254267
-rm -f dropbear$(EXEEXT) dbclient$(EXEEXT) dropbearkey$(EXEEXT) \
255268
dropbearconvert$(EXEEXT) scp$(EXEEXT) scp-progress$(EXEEXT) \
256-
dropbearmulti$(EXEEXT) *.o *.da *.bb *.bbg *.prof
269+
dropbearmulti$(EXEEXT) *.o *.da *.bb *.bbg *.prof \
270+
$(OBJ_DIR)/*
257271

258272
distclean: clean tidy
259273
-rm -f config.h

configure

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,6 @@ PACKAGE_STRING=''
613613
PACKAGE_BUGREPORT=''
614614
PACKAGE_URL=''
615615

616-
ac_unique_file="buffer.c"
617616
# Factoring default headers for most tests.
618617
ac_includes_default="\
619618
#include <stddef.h>
@@ -2974,7 +2973,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
29742973

29752974

29762975

2977-
29782976
# Record which revision is being built
29792977
if test -s "`which hg`" && test -d "$srcdir/.hg"; then
29802978
hgrev=`hg id -i -R "$srcdir"`

configure.ac

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
AC_PREREQ([2.59])
99
AC_INIT
10-
AC_CONFIG_SRCDIR(buffer.c)
1110

1211
# Record which revision is being built
1312
if test -s "`which hg`" && test -d "$srcdir/.hg"; then

libtomcrypt/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ ARFLAGS = r
4242
EXTRALIBS = ../libtommath/libtommath.a
4343

4444
#Compilation flags
45-
LTC_CFLAGS = -Isrc/headers/ -I$(srcdir)/src/headers/ -I../ -I$(srcdir)/../ -DLTC_SOURCE -I../libtommath/ -I$(srcdir)/../libtommath/ $(CFLAGS) $(CPPFLAGS)
45+
LTC_CFLAGS = -Isrc/headers/ -I$(srcdir)/src/headers/ -I$(srcdir)/../src -DLTC_SOURCE -I../libtommath/ -I$(srcdir)/../libtommath/ $(CFLAGS) $(CPPFLAGS)
4646
LTC_LDFLAGS = $(LDFLAGS) $(EXTRALIBS)
4747
VERSION=1.18.1
4848

libtommath/Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ VPATH=@srcdir@
66
srcdir=@srcdir@
77

88
# So that libtommath can include Dropbear headers for options and m_burn()
9-
CFLAGS += -I$(srcdir) -I../libtomcrypt/src/headers/ -I$(srcdir)/../libtomcrypt/src/headers/ -I../ -I$(srcdir)/../
9+
CFLAGS += -I$(srcdir) -I../libtomcrypt/src/headers/ -I$(srcdir)/../libtomcrypt/src/headers/ -I$(srcdir)/../src
1010
CFLAGS += -Wno-deprecated
1111
CFLAGS += $(CPPFLAGS)
1212

File renamed without changes.

algo.h renamed to src/algo.h

File renamed without changes.
File renamed without changes.
File renamed without changes.

auth.h renamed to src/auth.h

File renamed without changes.

bignum.c renamed to src/bignum.c

File renamed without changes.

bignum.h renamed to src/bignum.h

File renamed without changes.

buffer.c renamed to src/buffer.c

File renamed without changes.

buffer.h renamed to src/buffer.h

File renamed without changes.
File renamed without changes.
File renamed without changes.

channel.h renamed to src/channel.h

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

cli-kex.c renamed to src/cli-kex.c

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

compat.c renamed to src/compat.c

File renamed without changes.

compat.h renamed to src/compat.h

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

dbmulti.c renamed to src/dbmulti.c

File renamed without changes.
File renamed without changes.
File renamed without changes.

dbutil.c renamed to src/dbutil.c

File renamed without changes.

dbutil.h renamed to src/dbutil.h

File renamed without changes.

debug.h renamed to src/debug.h

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

dss.c renamed to src/dss.c

File renamed without changes.

dss.h renamed to src/dss.h

File renamed without changes.

ecc.c renamed to src/ecc.c

File renamed without changes.

ecc.h renamed to src/ecc.h

File renamed without changes.

ecdsa.c renamed to src/ecdsa.c

File renamed without changes.

ecdsa.h renamed to src/ecdsa.h

File renamed without changes.

ed25519.c renamed to src/ed25519.c

File renamed without changes.

ed25519.h renamed to src/ed25519.h

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

fuzz.h renamed to src/fuzz.h

File renamed without changes.

gcm.c renamed to src/gcm.c

File renamed without changes.

gcm.h renamed to src/gcm.h

File renamed without changes.

gendss.c renamed to src/gendss.c

File renamed without changes.

gendss.h renamed to src/gendss.h

File renamed without changes.
File renamed without changes.
File renamed without changes.

genrsa.c renamed to src/genrsa.c

File renamed without changes.

genrsa.h renamed to src/genrsa.h

File renamed without changes.
File renamed without changes.
File renamed without changes.

includes.h renamed to src/includes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@
132132
#endif
133133

134134
#ifdef BUNDLED_LIBTOM
135-
#include "libtomcrypt/src/headers/tomcrypt.h"
136-
#include "libtommath/tommath.h"
135+
#include "../libtomcrypt/src/headers/tomcrypt.h"
136+
#include "../libtommath/tommath.h"
137137
#else
138138
#include <tomcrypt.h>
139139
#include <tommath.h>

kex.h renamed to src/kex.h

File renamed without changes.
File renamed without changes.
File renamed without changes.

list.c renamed to src/list.c

File renamed without changes.

list.h renamed to src/list.h

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

netio.c renamed to src/netio.c

File renamed without changes.

netio.h renamed to src/netio.h

File renamed without changes.

options.h renamed to src/options.h

File renamed without changes.

packet.c renamed to src/packet.c

File renamed without changes.

packet.h renamed to src/packet.h

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

queue.c renamed to src/queue.c

File renamed without changes.

queue.h renamed to src/queue.h

File renamed without changes.

rsa.c renamed to src/rsa.c

File renamed without changes.

rsa.h renamed to src/rsa.h

File renamed without changes.

runopts.h renamed to src/runopts.h

File renamed without changes.

scp.c renamed to src/scp.c

File renamed without changes.

scpmisc.c renamed to src/scpmisc.c

File renamed without changes.

scpmisc.h renamed to src/scpmisc.h

File renamed without changes.

service.h renamed to src/service.h

File renamed without changes.

session.h renamed to src/session.h

File renamed without changes.

signkey.c renamed to src/signkey.c

File renamed without changes.

signkey.h renamed to src/signkey.h

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

ssh.h renamed to src/ssh.h

File renamed without changes.

sshpty.c renamed to src/sshpty.c

File renamed without changes.

sshpty.h renamed to src/sshpty.h

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

svr-kex.c renamed to src/svr-kex.c

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tcpfwd.h renamed to src/tcpfwd.h

File renamed without changes.
File renamed without changes.
File renamed without changes.

x11fwd.h renamed to src/x11fwd.h

File renamed without changes.

0 commit comments

Comments
 (0)