Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • Geofferey/dropbear
1 result
Show changes
Loading
@@ -714,7 +714,7 @@ void free_kexcurve25519_param(struct kex_curve25519_param *param)
Loading
@@ -714,7 +714,7 @@ void free_kexcurve25519_param(struct kex_curve25519_param *param)
m_free(param); m_free(param);
} }
   
void kexcurve25519_comb_key(struct kex_curve25519_param *param, buffer *buf_pub_them, void kexcurve25519_comb_key(const struct kex_curve25519_param *param, const buffer *buf_pub_them,
sign_key *hostkey) { sign_key *hostkey) {
unsigned char out[CURVE25519_LEN]; unsigned char out[CURVE25519_LEN];
const unsigned char* Q_C = NULL; const unsigned char* Q_C = NULL;
Loading
Loading
Loading
@@ -9,7 +9,6 @@ AC_PREREQ(2.59)
Loading
@@ -9,7 +9,6 @@ AC_PREREQ(2.59)
AC_INIT AC_INIT
AC_CONFIG_SRCDIR(buffer.c) AC_CONFIG_SRCDIR(buffer.c)
   
OLDCFLAGS="$CFLAGS"
# Checks for programs. # Checks for programs.
AC_PROG_CC AC_PROG_CC
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
Loading
@@ -19,19 +18,28 @@ if test -z "$LD" ; then
Loading
@@ -19,19 +18,28 @@ if test -z "$LD" ; then
fi fi
AC_SUBST(LD) AC_SUBST(LD)
   
AC_DEFUN(DB_TRYADDCFLAGS,
[{
OLDFLAGS="$CFLAGS"
TESTFLAGS="$1"
CFLAGS="$CFLAGS $TESTFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_NOTICE([Setting $TESTFLAGS])],
[AC_MSG_NOTICE([Not setting $TESTFLAGS]); CFLAGS="$OLDFLAGS" ]
)
}])
# set compile flags prior to other tests # set compile flags prior to other tests
if test -z "$OLDCFLAGS" && test "$GCC" = "yes"; then if test -z "$OLDCFLAGS" && test "$GCC" = "yes"; then
AC_MSG_NOTICE(No \$CFLAGS set... using "-Os -W -Wall" for GCC) AC_MSG_NOTICE(No \$CFLAGS set... using "-Os -W -Wall" for GCC)
CFLAGS="-Os -W -Wall -Wno-pointer-sign" CFLAGS="-Os -W -Wall"
fi fi
   
AC_MSG_CHECKING([if compiler '$CC' supports -fno-strict-overflow]) AC_MSG_NOTICE([Checking if compiler '$CC' supports -Wno-pointer-sign])
OLDCFLAGS="$CFLAGS" DB_TRYADDCFLAGS([-Wno-pointer-sign])
CFLAGS="$CFLAGS -fno-strict-overflow"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])], AC_MSG_NOTICE([Checking if compiler '$CC' supports -fno-strict-overflow])
[AC_MSG_RESULT(yes)], DB_TRYADDCFLAGS([-fno-strict-overflow])
[AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS" ]
)
   
STATIC=0 STATIC=0
AC_ARG_ENABLE(static, AC_ARG_ENABLE(static,
Loading
@@ -59,13 +67,8 @@ if test "$hardenbuild" -eq 1; then
Loading
@@ -59,13 +67,8 @@ if test "$hardenbuild" -eq 1; then
# relocation flags don't make sense for static builds # relocation flags don't make sense for static builds
if test "$STATIC" -ne 1; then if test "$STATIC" -ne 1; then
# pie # pie
OLDCFLAGS="$CFLAGS" DB_TRYADDCFLAGS([-fPIE])
TESTFLAGS="-fPIE"
CFLAGS="$CFLAGS $TESTFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_NOTICE([Setting $TESTFLAGS])],
[AC_MSG_NOTICE([Not setting $TESTFLAGS]); CFLAGS="$OLDCFLAGS" ]
)
OLDLDFLAGS="$LDFLAGS" OLDLDFLAGS="$LDFLAGS"
TESTFLAGS="-Wl,-pie" TESTFLAGS="-Wl,-pie"
LDFLAGS="$LDFLAGS $TESTFLAGS" LDFLAGS="$LDFLAGS $TESTFLAGS"
Loading
@@ -107,13 +110,7 @@ if test "$hardenbuild" -eq 1; then
Loading
@@ -107,13 +110,7 @@ if test "$hardenbuild" -eq 1; then
] ]
) )
# FORTIFY_SOURCE # FORTIFY_SOURCE
OLDCFLAGS="$CFLAGS" DB_TRYADDCFLAGS([-D_FORTIFY_SOURCE=2])
TESTFLAGS="-D_FORTIFY_SOURCE=2"
CFLAGS="$CFLAGS $TESTFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[AC_MSG_NOTICE([Setting $TESTFLAGS])],
[AC_MSG_NOTICE([Not setting $TESTFLAGS]); CFLAGS="$OLDCFLAGS" ]
)
fi fi
   
# large file support is useful for scp # large file support is useful for scp
Loading
@@ -269,15 +266,20 @@ AC_ARG_ENABLE(openpty,
Loading
@@ -269,15 +266,20 @@ AC_ARG_ENABLE(openpty,
AC_MSG_NOTICE(Not using openpty) AC_MSG_NOTICE(Not using openpty)
else else
AC_MSG_NOTICE(Using openpty if available) AC_MSG_NOTICE(Using openpty if available)
AC_SEARCH_LIBS(openpty, util, [AC_DEFINE(HAVE_OPENPTY,1,[Have openpty() function])]) AC_SEARCH_LIBS(openpty, util, [dropbear_cv_func_have_openpty=yes])
fi fi
], ],
[ [
AC_MSG_NOTICE(Using openpty if available) AC_MSG_NOTICE(Using openpty if available)
AC_SEARCH_LIBS(openpty, util, [AC_DEFINE(HAVE_OPENPTY)]) AC_SEARCH_LIBS(openpty, util, [dropbear_cv_func_have_openpty=yes])
] ]
) )
if test "x$dropbear_cv_func_have_openpty" = "xyes"; then
AC_DEFINE(HAVE_OPENPTY,,Have openpty() function)
no_ptc_check=yes
no_ptmx_check=yes
fi
   
AC_ARG_ENABLE(syslog, AC_ARG_ENABLE(syslog,
[ --disable-syslog Don't include syslog support], [ --disable-syslog Don't include syslog support],
Loading
@@ -796,61 +798,11 @@ fi
Loading
@@ -796,61 +798,11 @@ fi
   
AC_EXEEXT AC_EXEEXT
   
# XXX there must be a nicer way to do this
if test $BUNDLED_LIBTOM = 1 ; then if test $BUNDLED_LIBTOM = 1 ; then
AS_MKDIR_P(libtomcrypt/src/ciphers/aes) (cd $srcdir; find libtomcrypt -type d) | xargs mkdir -pv
AS_MKDIR_P(libtomcrypt/src/ciphers/safer)
AS_MKDIR_P(libtomcrypt/src/ciphers/twofish)
AS_MKDIR_P(libtomcrypt/src/encauth/ccm)
AS_MKDIR_P(libtomcrypt/src/encauth/eax)
AS_MKDIR_P(libtomcrypt/src/encauth/gcm)
AS_MKDIR_P(libtomcrypt/src/encauth/ocb)
AS_MKDIR_P(libtomcrypt/src/hashes)
AS_MKDIR_P(libtomcrypt/src/hashes/chc)
AS_MKDIR_P(libtomcrypt/src/hashes/helper)
AS_MKDIR_P(libtomcrypt/src/hashes/sha2)
AS_MKDIR_P(libtomcrypt/src/hashes/whirl)
AS_MKDIR_P(libtomcrypt/src/mac/hmac)
AS_MKDIR_P(libtomcrypt/src/mac/omac)
AS_MKDIR_P(libtomcrypt/src/mac/pelican)
AS_MKDIR_P(libtomcrypt/src/mac/pmac)
AS_MKDIR_P(libtomcrypt/src/mac/f9)
AS_MKDIR_P(libtomcrypt/src/mac/xcbc)
AS_MKDIR_P(libtomcrypt/src/math/fp)
AS_MKDIR_P(libtomcrypt/src/misc/base64)
AS_MKDIR_P(libtomcrypt/src/misc/crypt)
AS_MKDIR_P(libtomcrypt/src/misc/mpi)
AS_MKDIR_P(libtomcrypt/src/misc/pkcs5)
AS_MKDIR_P(libtomcrypt/src/modes/cbc)
AS_MKDIR_P(libtomcrypt/src/modes/cfb)
AS_MKDIR_P(libtomcrypt/src/modes/ctr)
AS_MKDIR_P(libtomcrypt/src/modes/ecb)
AS_MKDIR_P(libtomcrypt/src/modes/ofb)
AS_MKDIR_P(libtomcrypt/src/modes/f8)
AS_MKDIR_P(libtomcrypt/src/modes/lrw)
AS_MKDIR_P(libtomcrypt/src/modes/xts)
AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/bit)
AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/boolean)
AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/choice)
AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/ia5)
AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/integer)
AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/object_identifier)
AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/octet)
AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/printable_string)
AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/sequence)
AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/set)
AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/short_integer)
AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/utctime)
AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/utf8)
AS_MKDIR_P(libtomcrypt/src/pk/dh)
AS_MKDIR_P(libtomcrypt/src/pk/dsa)
AS_MKDIR_P(libtomcrypt/src/pk/ecc)
AS_MKDIR_P(libtomcrypt/src/pk/katja)
AS_MKDIR_P(libtomcrypt/src/pk/pkcs1)
AS_MKDIR_P(libtomcrypt/src/pk/rsa)
AS_MKDIR_P(libtomcrypt/src/prngs)
LIBTOM_FILES="libtomcrypt/Makefile libtommath/Makefile" LIBTOM_FILES="libtomcrypt/Makefile libtommath/Makefile"
fi fi
AC_CONFIG_HEADER(config.h) AC_CONFIG_HEADER(config.h)
AC_CONFIG_FILES(Makefile $LIBTOM_FILES) AC_CONFIG_FILES(Makefile $LIBTOM_FILES)
AC_OUTPUT AC_OUTPUT
Loading
Loading
Loading
@@ -133,8 +133,8 @@ Can be used to give options in the format used by OpenSSH config file. This is
Loading
@@ -133,8 +133,8 @@ Can be used to give options in the format used by OpenSSH config file. This is
useful for specifying options for which there is no separate command-line flag. useful for specifying options for which there is no separate command-line flag.
For full details of the options listed below, and their possible values, see For full details of the options listed below, and their possible values, see
ssh_config(5). ssh_config(5).
The following options have currently been implemented:
   
For now following options have been implemented:
.RS .RS
.TP .TP
.B ExitOnForwardFailure .B ExitOnForwardFailure
Loading
@@ -147,6 +147,10 @@ Send dbclient log messages to syslog in addition to stderr.
Loading
@@ -147,6 +147,10 @@ Send dbclient log messages to syslog in addition to stderr.
.B \-s .B \-s
The specified command will be requested as a subsystem, used for sftp. Dropbear doesn't implement sftp itself but the OpenSSH sftp client can be used eg \fIsftp -S dbclient user@host\fR The specified command will be requested as a subsystem, used for sftp. Dropbear doesn't implement sftp itself but the OpenSSH sftp client can be used eg \fIsftp -S dbclient user@host\fR
.TP .TP
.B \-b \fI[address][:port]
Bind to a specific local address when connecting to the remote host. This can be used to choose from
multiple outgoing interfaces. Either address or port (or both) can be given.
.TP
.B \-V .B \-V
Print the version Print the version
   
Loading
Loading
Loading
@@ -141,7 +141,7 @@ out:
Loading
@@ -141,7 +141,7 @@ out:
return ret; return ret;
} }
   
void addrandom(unsigned char * buf, unsigned int len) void addrandom(const unsigned char * buf, unsigned int len)
{ {
hash_state hs; hash_state hs;
   
Loading
Loading
Loading
@@ -29,7 +29,7 @@
Loading
@@ -29,7 +29,7 @@
   
void seedrandom(void); void seedrandom(void);
void genrandom(unsigned char* buf, unsigned int len); void genrandom(unsigned char* buf, unsigned int len);
void addrandom(unsigned char * buf, unsigned int len); void addrandom(const unsigned char * buf, unsigned int len);
void gen_random_mpint(mp_int *max, mp_int *rand); void gen_random_mpint(mp_int *max, mp_int *rand);
   
#endif /* DROPBEAR_RANDOM_H_ */ #endif /* DROPBEAR_RANDOM_H_ */
Loading
@@ -241,7 +241,7 @@ int connect_unix(const char* path) {
Loading
@@ -241,7 +241,7 @@ int connect_unix(const char* path) {
* it will be run after the child has fork()ed, and is passed exec_data. * it will be run after the child has fork()ed, and is passed exec_data.
* If ret_errfd == NULL then stderr will not be captured. * If ret_errfd == NULL then stderr will not be captured.
* ret_pid can be passed as NULL to discard the pid. */ * ret_pid can be passed as NULL to discard the pid. */
int spawn_command(void(*exec_fn)(void *user_data), void *exec_data, int spawn_command(void(*exec_fn)(const void *user_data), const void *exec_data,
int *ret_writefd, int *ret_readfd, int *ret_errfd, pid_t *ret_pid) { int *ret_writefd, int *ret_readfd, int *ret_errfd, pid_t *ret_pid) {
int infds[2]; int infds[2];
int outfds[2]; int outfds[2];
Loading
@@ -634,6 +634,10 @@ reach userspace include headers */
Loading
@@ -634,6 +634,10 @@ reach userspace include headers */
#ifndef CLOCK_MONOTONIC_COARSE #ifndef CLOCK_MONOTONIC_COARSE
#define CLOCK_MONOTONIC_COARSE 6 #define CLOCK_MONOTONIC_COARSE 6
#endif #endif
/* Some old toolchains know SYS_clock_gettime but not CLOCK_MONOTONIC */
#ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC 1
#endif
static clockid_t get_linux_clock_source() { static clockid_t get_linux_clock_source() {
struct timespec ts; struct timespec ts;
if (syscall(SYS_clock_gettime, CLOCK_MONOTONIC_COARSE, &ts) == 0) { if (syscall(SYS_clock_gettime, CLOCK_MONOTONIC_COARSE, &ts) == 0) {
Loading
Loading
Loading
@@ -56,7 +56,7 @@ extern int debug_trace;
Loading
@@ -56,7 +56,7 @@ extern int debug_trace;
   
char * stripcontrol(const char * text); char * stripcontrol(const char * text);
   
int spawn_command(void(*exec_fn)(void *user_data), void *exec_data, int spawn_command(void(*exec_fn)(const void *user_data), const void *exec_data,
int *writefd, int *readfd, int *errfd, pid_t *pid); int *writefd, int *readfd, int *errfd, pid_t *pid);
void run_shell_command(const char* cmd, unsigned int maxfd, char* usershell); void run_shell_command(const char* cmd, unsigned int maxfd, char* usershell);
#ifdef ENABLE_CONNECT_UNIX #ifdef ENABLE_CONNECT_UNIX
Loading
Loading
Loading
@@ -241,7 +241,7 @@ int main(int argc, char ** argv) {
Loading
@@ -241,7 +241,7 @@ int main(int argc, char ** argv) {
} }
   
genbits = signkey_generate_get_bits(keytype, bits); genbits = signkey_generate_get_bits(keytype, bits);
fprintf(stderr, "Generating %d bit %s key, this may take a while...\n", genbits, typetext); fprintf(stderr, "Generating %u bit %s key, this may take a while...\n", genbits, typetext);
if (signkey_generate(keytype, bits, filename, 0) == DROPBEAR_FAILURE) if (signkey_generate(keytype, bits, filename, 0) == DROPBEAR_FAILURE)
{ {
dropbear_exit("Failed to generate key.\n"); dropbear_exit("Failed to generate key.\n");
Loading
Loading
Loading
@@ -127,7 +127,7 @@ void dss_key_free(dropbear_dss_key *key) {
Loading
@@ -127,7 +127,7 @@ void dss_key_free(dropbear_dss_key *key) {
* mpint g * mpint g
* mpint y * mpint y
*/ */
void buf_put_dss_pub_key(buffer* buf, dropbear_dss_key *key) { void buf_put_dss_pub_key(buffer* buf, const dropbear_dss_key *key) {
   
dropbear_assert(key != NULL); dropbear_assert(key != NULL);
buf_putstring(buf, SSH_SIGNKEY_DSS, SSH_SIGNKEY_DSS_LEN); buf_putstring(buf, SSH_SIGNKEY_DSS, SSH_SIGNKEY_DSS_LEN);
Loading
@@ -139,7 +139,7 @@ void buf_put_dss_pub_key(buffer* buf, dropbear_dss_key *key) {
Loading
@@ -139,7 +139,7 @@ void buf_put_dss_pub_key(buffer* buf, dropbear_dss_key *key) {
} }
   
/* Same as buf_put_dss_pub_key, but with the private "x" key appended */ /* Same as buf_put_dss_pub_key, but with the private "x" key appended */
void buf_put_dss_priv_key(buffer* buf, dropbear_dss_key *key) { void buf_put_dss_priv_key(buffer* buf, const dropbear_dss_key *key) {
   
dropbear_assert(key != NULL); dropbear_assert(key != NULL);
buf_put_dss_pub_key(buf, key); buf_put_dss_pub_key(buf, key);
Loading
@@ -150,7 +150,7 @@ void buf_put_dss_priv_key(buffer* buf, dropbear_dss_key *key) {
Loading
@@ -150,7 +150,7 @@ void buf_put_dss_priv_key(buffer* buf, dropbear_dss_key *key) {
#if DROPBEAR_SIGNKEY_VERIFY #if DROPBEAR_SIGNKEY_VERIFY
/* Verify a DSS signature (in buf) made on data by the key given. /* Verify a DSS signature (in buf) made on data by the key given.
* returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ * returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */
int buf_dss_verify(buffer* buf, dropbear_dss_key *key, buffer *data_buf) { int buf_dss_verify(buffer* buf, const dropbear_dss_key *key, const buffer *data_buf) {
unsigned char msghash[SHA1_HASH_SIZE]; unsigned char msghash[SHA1_HASH_SIZE];
hash_state hs; hash_state hs;
int ret = DROPBEAR_FAILURE; int ret = DROPBEAR_FAILURE;
Loading
@@ -255,7 +255,7 @@ out:
Loading
@@ -255,7 +255,7 @@ out:
   
/* Sign the data presented with key, writing the signature contents /* Sign the data presented with key, writing the signature contents
* to the buffer */ * to the buffer */
void buf_put_dss_sign(buffer* buf, dropbear_dss_key *key, buffer *data_buf) { void buf_put_dss_sign(buffer* buf, const dropbear_dss_key *key, const buffer *data_buf) {
unsigned char msghash[SHA1_HASH_SIZE]; unsigned char msghash[SHA1_HASH_SIZE];
unsigned int writelen; unsigned int writelen;
unsigned int i; unsigned int i;
Loading
Loading
Loading
@@ -44,14 +44,14 @@ typedef struct {
Loading
@@ -44,14 +44,14 @@ typedef struct {
#define DSS_P_BITS 1024 #define DSS_P_BITS 1024
#define DSS_Q_BITS 160 #define DSS_Q_BITS 160
   
void buf_put_dss_sign(buffer* buf, dropbear_dss_key *key, buffer *data_buf); void buf_put_dss_sign(buffer* buf, const dropbear_dss_key *key, const buffer *data_buf);
#if DROPBEAR_SIGNKEY_VERIFY #if DROPBEAR_SIGNKEY_VERIFY
int buf_dss_verify(buffer* buf, dropbear_dss_key *key, buffer *data_buf); int buf_dss_verify(buffer* buf, const dropbear_dss_key *key, const buffer *data_buf);
#endif #endif
int buf_get_dss_pub_key(buffer* buf, dropbear_dss_key *key); int buf_get_dss_pub_key(buffer* buf, dropbear_dss_key *key);
int buf_get_dss_priv_key(buffer* buf, dropbear_dss_key *key); int buf_get_dss_priv_key(buffer* buf, dropbear_dss_key *key);
void buf_put_dss_pub_key(buffer* buf, dropbear_dss_key *key); void buf_put_dss_pub_key(buffer* buf, const dropbear_dss_key *key);
void buf_put_dss_priv_key(buffer* buf, dropbear_dss_key *key); void buf_put_dss_priv_key(buffer* buf, const dropbear_dss_key *key);
void dss_key_free(dropbear_dss_key *key); void dss_key_free(dropbear_dss_key *key);
   
#endif /* DROPBEAR_DSS */ #endif /* DROPBEAR_DSS */
Loading
Loading
Loading
@@ -82,7 +82,7 @@ ecc_key * new_ecc_key(void) {
Loading
@@ -82,7 +82,7 @@ ecc_key * new_ecc_key(void) {
   
/* Copied from libtomcrypt ecc_import.c (version there is static), modified /* Copied from libtomcrypt ecc_import.c (version there is static), modified
for different mp_int pointer without LTC_SOURCE */ for different mp_int pointer without LTC_SOURCE */
static int ecc_is_point(ecc_key *key) static int ecc_is_point(const ecc_key *key)
{ {
mp_int *prime, *b, *t1, *t2; mp_int *prime, *b, *t1, *t2;
int err; int err;
Loading
@@ -213,7 +213,7 @@ ecc_key * buf_get_ecc_raw_pubkey(buffer *buf, const struct dropbear_ecc_curve *c
Loading
@@ -213,7 +213,7 @@ ecc_key * buf_get_ecc_raw_pubkey(buffer *buf, const struct dropbear_ecc_curve *c
   
/* a modified version of libtomcrypt's "ecc_shared_secret" to output /* a modified version of libtomcrypt's "ecc_shared_secret" to output
a mp_int instead. */ a mp_int instead. */
mp_int * dropbear_ecc_shared_secret(ecc_key *public_key, ecc_key *private_key) mp_int * dropbear_ecc_shared_secret(ecc_key *public_key, const ecc_key *private_key)
{ {
ecc_point *result = NULL; ecc_point *result = NULL;
mp_int *prime = NULL, *shared_secret = NULL; mp_int *prime = NULL, *shared_secret = NULL;
Loading
Loading
Loading
@@ -29,7 +29,7 @@ void buf_put_ecc_raw_pubkey_string(buffer *buf, ecc_key *key);
Loading
@@ -29,7 +29,7 @@ void buf_put_ecc_raw_pubkey_string(buffer *buf, ecc_key *key);
ecc_key * buf_get_ecc_raw_pubkey(buffer *buf, const struct dropbear_ecc_curve *curve); ecc_key * buf_get_ecc_raw_pubkey(buffer *buf, const struct dropbear_ecc_curve *curve);
int buf_get_ecc_privkey_string(buffer *buf, ecc_key *key); int buf_get_ecc_privkey_string(buffer *buf, ecc_key *key);
   
mp_int * dropbear_ecc_shared_secret(ecc_key *pub_key, ecc_key *priv_key); mp_int * dropbear_ecc_shared_secret(ecc_key *pub_key, const ecc_key *priv_key);
   
#endif #endif
   
Loading
Loading
Loading
@@ -15,7 +15,7 @@ int signkey_is_ecdsa(enum signkey_type type)
Loading
@@ -15,7 +15,7 @@ int signkey_is_ecdsa(enum signkey_type type)
|| type == DROPBEAR_SIGNKEY_ECDSA_NISTP521; || type == DROPBEAR_SIGNKEY_ECDSA_NISTP521;
} }
   
enum signkey_type ecdsa_signkey_type(ecc_key * key) { enum signkey_type ecdsa_signkey_type(const ecc_key * key) {
#if DROPBEAR_ECC_256 #if DROPBEAR_ECC_256
if (key->dp == ecc_curve_nistp256.dp) { if (key->dp == ecc_curve_nistp256.dp) {
return DROPBEAR_SIGNKEY_ECDSA_NISTP256; return DROPBEAR_SIGNKEY_ECDSA_NISTP256;
Loading
@@ -154,7 +154,7 @@ void buf_put_ecdsa_priv_key(buffer *buf, ecc_key *key) {
Loading
@@ -154,7 +154,7 @@ void buf_put_ecdsa_priv_key(buffer *buf, ecc_key *key) {
buf_putmpint(buf, key->k); buf_putmpint(buf, key->k);
} }
   
void buf_put_ecdsa_sign(buffer *buf, ecc_key *key, buffer *data_buf) { void buf_put_ecdsa_sign(buffer *buf, const ecc_key *key, const buffer *data_buf) {
/* Based on libtomcrypt's ecc_sign_hash but without the asn1 */ /* Based on libtomcrypt's ecc_sign_hash but without the asn1 */
int err = DROPBEAR_FAILURE; int err = DROPBEAR_FAILURE;
struct dropbear_ecc_curve *curve = NULL; struct dropbear_ecc_curve *curve = NULL;
Loading
@@ -272,7 +272,7 @@ out:
Loading
@@ -272,7 +272,7 @@ out:
} }
   
   
int buf_ecdsa_verify(buffer *buf, ecc_key *key, buffer *data_buf) { int buf_ecdsa_verify(buffer *buf, const ecc_key *key, const buffer *data_buf) {
/* Based on libtomcrypt's ecc_verify_hash but without the asn1 */ /* Based on libtomcrypt's ecc_verify_hash but without the asn1 */
int ret = DROPBEAR_FAILURE; int ret = DROPBEAR_FAILURE;
hash_state hs; hash_state hs;
Loading
Loading
Loading
@@ -23,10 +23,10 @@ ecc_key *buf_get_ecdsa_pub_key(buffer* buf);
Loading
@@ -23,10 +23,10 @@ ecc_key *buf_get_ecdsa_pub_key(buffer* buf);
ecc_key *buf_get_ecdsa_priv_key(buffer *buf); ecc_key *buf_get_ecdsa_priv_key(buffer *buf);
void buf_put_ecdsa_pub_key(buffer *buf, ecc_key *key); void buf_put_ecdsa_pub_key(buffer *buf, ecc_key *key);
void buf_put_ecdsa_priv_key(buffer *buf, ecc_key *key); void buf_put_ecdsa_priv_key(buffer *buf, ecc_key *key);
enum signkey_type ecdsa_signkey_type(ecc_key * key); enum signkey_type ecdsa_signkey_type(const ecc_key * key);
   
void buf_put_ecdsa_sign(buffer *buf, ecc_key *key, buffer *data_buf); void buf_put_ecdsa_sign(buffer *buf, const ecc_key *key, const buffer *data_buf);
int buf_ecdsa_verify(buffer *buf, ecc_key *key, buffer *data_buf); int buf_ecdsa_verify(buffer *buf, const ecc_key *key, const buffer *data_buf);
/* Returns 1 on success */ /* Returns 1 on success */
int signkey_is_ecdsa(enum signkey_type type); int signkey_is_ecdsa(enum signkey_type type);
   
Loading
Loading
Loading
@@ -37,11 +37,11 @@
Loading
@@ -37,11 +37,11 @@
   
#if DROPBEAR_DSS #if DROPBEAR_DSS
   
static void getq(dropbear_dss_key *key); static void getq(const dropbear_dss_key *key);
static void getp(dropbear_dss_key *key, unsigned int size); static void getp(const dropbear_dss_key *key, unsigned int size);
static void getg(dropbear_dss_key *key); static void getg(const dropbear_dss_key *key);
static void getx(dropbear_dss_key *key); static void getx(const dropbear_dss_key *key);
static void gety(dropbear_dss_key *key); static void gety(const dropbear_dss_key *key);
   
dropbear_dss_key * gen_dss_priv_key(unsigned int size) { dropbear_dss_key * gen_dss_priv_key(unsigned int size) {
   
Loading
@@ -65,7 +65,7 @@ dropbear_dss_key * gen_dss_priv_key(unsigned int size) {
Loading
@@ -65,7 +65,7 @@ dropbear_dss_key * gen_dss_priv_key(unsigned int size) {
} }
   
static void getq(dropbear_dss_key *key) { static void getq(const dropbear_dss_key *key) {
   
unsigned char buf[QSIZE]; unsigned char buf[QSIZE];
   
Loading
@@ -83,7 +83,7 @@ static void getq(dropbear_dss_key *key) {
Loading
@@ -83,7 +83,7 @@ static void getq(dropbear_dss_key *key) {
} }
} }
   
static void getp(dropbear_dss_key *key, unsigned int size) { static void getp(const dropbear_dss_key *key, unsigned int size) {
   
DEF_MP_INT(tempX); DEF_MP_INT(tempX);
DEF_MP_INT(tempC); DEF_MP_INT(tempC);
Loading
@@ -142,7 +142,7 @@ static void getp(dropbear_dss_key *key, unsigned int size) {
Loading
@@ -142,7 +142,7 @@ static void getp(dropbear_dss_key *key, unsigned int size) {
m_free(buf); m_free(buf);
} }
   
static void getg(dropbear_dss_key * key) { static void getg(const dropbear_dss_key * key) {
   
DEF_MP_INT(div); DEF_MP_INT(div);
DEF_MP_INT(h); DEF_MP_INT(h);
Loading
@@ -179,12 +179,12 @@ static void getg(dropbear_dss_key * key) {
Loading
@@ -179,12 +179,12 @@ static void getg(dropbear_dss_key * key) {
mp_clear_multi(&div, &h, &val, NULL); mp_clear_multi(&div, &h, &val, NULL);
} }
   
static void getx(dropbear_dss_key *key) { static void getx(const dropbear_dss_key *key) {
   
gen_random_mpint(key->q, key->x); gen_random_mpint(key->q, key->x);
} }
   
static void gety(dropbear_dss_key *key) { static void gety(const dropbear_dss_key *key) {
   
if (mp_exptmod(key->g, key->x, key->p, key->y) != MP_OKAY) { if (mp_exptmod(key->g, key->x, key->p, key->y) != MP_OKAY) {
fprintf(stderr, "DSS key generation failed\n"); fprintf(stderr, "DSS key generation failed\n");
Loading
Loading
Loading
@@ -50,7 +50,7 @@ void kexecdh_comb_key(struct kex_ecdh_param *param, buffer *pub_them,
Loading
@@ -50,7 +50,7 @@ void kexecdh_comb_key(struct kex_ecdh_param *param, buffer *pub_them,
#if DROPBEAR_CURVE25519 #if DROPBEAR_CURVE25519
struct kex_curve25519_param *gen_kexcurve25519_param(void); struct kex_curve25519_param *gen_kexcurve25519_param(void);
void free_kexcurve25519_param(struct kex_curve25519_param *param); void free_kexcurve25519_param(struct kex_curve25519_param *param);
void kexcurve25519_comb_key(struct kex_curve25519_param *param, buffer *pub_them, void kexcurve25519_comb_key(const struct kex_curve25519_param *param, const buffer *pub_them,
sign_key *hostkey); sign_key *hostkey);
#endif #endif
   
Loading
Loading
Loading
@@ -55,9 +55,9 @@ static const unsigned char OID_SEC521R1_BLOB[] = {0x2b, 0x81, 0x04, 0x00, 0x23};
Loading
@@ -55,9 +55,9 @@ static const unsigned char OID_SEC521R1_BLOB[] = {0x2b, 0x81, 0x04, 0x00, 0x23};
((unsigned long)(unsigned char)(cp)[3])) ((unsigned long)(unsigned char)(cp)[3]))
   
static int openssh_encrypted(const char *filename); static int openssh_encrypted(const char *filename);
static sign_key *openssh_read(const char *filename, char *passphrase); static sign_key *openssh_read(const char *filename, const char *passphrase);
static int openssh_write(const char *filename, sign_key *key, static int openssh_write(const char *filename, sign_key *key,
char *passphrase); const char *passphrase);
   
static int dropbear_write(const char*filename, sign_key * key); static int dropbear_write(const char*filename, sign_key * key);
static sign_key *dropbear_read(const char* filename); static sign_key *dropbear_read(const char* filename);
Loading
@@ -83,7 +83,7 @@ int import_encrypted(const char* filename, int filetype) {
Loading
@@ -83,7 +83,7 @@ int import_encrypted(const char* filename, int filetype) {
return 0; return 0;
} }
   
sign_key *import_read(const char *filename, char *passphrase, int filetype) { sign_key *import_read(const char *filename, const char *passphrase, int filetype) {
   
if (filetype == KEYFILE_OPENSSH) { if (filetype == KEYFILE_OPENSSH) {
return openssh_read(filename, passphrase); return openssh_read(filename, passphrase);
Loading
@@ -97,7 +97,7 @@ sign_key *import_read(const char *filename, char *passphrase, int filetype) {
Loading
@@ -97,7 +97,7 @@ sign_key *import_read(const char *filename, char *passphrase, int filetype) {
return NULL; return NULL;
} }
   
int import_write(const char *filename, sign_key *key, char *passphrase, int import_write(const char *filename, sign_key *key, const char *passphrase,
int filetype) { int filetype) {
   
if (filetype == KEYFILE_OPENSSH) { if (filetype == KEYFILE_OPENSSH) {
Loading
@@ -194,7 +194,7 @@ out:
Loading
@@ -194,7 +194,7 @@ out:
) )
   
/* cpl has to be less than 100 */ /* cpl has to be less than 100 */
static void base64_encode_fp(FILE * fp, unsigned char *data, static void base64_encode_fp(FILE * fp, const unsigned char *data,
int datalen, int cpl) int datalen, int cpl)
{ {
unsigned char out[100]; unsigned char out[100];
Loading
@@ -509,7 +509,7 @@ static int openssh_encrypted(const char *filename)
Loading
@@ -509,7 +509,7 @@ static int openssh_encrypted(const char *filename)
return ret; return ret;
} }
   
static sign_key *openssh_read(const char *filename, char * UNUSED(passphrase)) static sign_key *openssh_read(const char *filename, const char * UNUSED(passphrase))
{ {
struct openssh_key *key; struct openssh_key *key;
unsigned char *p; unsigned char *p;
Loading
@@ -828,7 +828,7 @@ static sign_key *openssh_read(const char *filename, char * UNUSED(passphrase))
Loading
@@ -828,7 +828,7 @@ static sign_key *openssh_read(const char *filename, char * UNUSED(passphrase))
} }
   
static int openssh_write(const char *filename, sign_key *key, static int openssh_write(const char *filename, sign_key *key,
char *passphrase) const char *passphrase)
{ {
buffer * keyblob = NULL; buffer * keyblob = NULL;
buffer * extrablob = NULL; /* used for calculated values to write */ buffer * extrablob = NULL; /* used for calculated values to write */
Loading
Loading
Loading
@@ -34,9 +34,9 @@ enum {
Loading
@@ -34,9 +34,9 @@ enum {
KEYFILE_SSHCOM KEYFILE_SSHCOM
}; };
   
int import_write(const char *filename, sign_key *key, char *passphrase, int import_write(const char *filename, sign_key *key, const char *passphrase,
int filetype); int filetype);
sign_key *import_read(const char *filename, char *passphrase, int filetype); sign_key *import_read(const char *filename, const char *passphrase, int filetype);
int import_encrypted(const char* filename, int filetype); int import_encrypted(const char* filename, int filetype);
   
#endif /* DROPBEAR_KEYIMPORT_H_ */ #endif /* DROPBEAR_KEYIMPORT_H_ */
dist: trusty
sudo: required
language: c
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
packages:
- clang-3.8
install:
- sudo apt-get update -qq
- sudo apt-get install libtommath-dev
before_script:
- gem install coveralls-lcov
- curl http://ftp.de.debian.org/debian/pool/main/l/lcov/lcov_1.11.orig.tar.gz | tar xz
- export PATH=$PATH:`pwd`/lcov-1.11/bin
- curl -s https://packagecloud.io/install/repositories/libtom/packages/script.deb.sh | sudo bash
- sudo apt-get install libtfm-dev=0.13-5
matrix:
fast_finish: true
branches:
only:
- master
- develop
- /^release\/.*$/
compiler:
- gcc
- clang
script:
- bash "${BUILDSCRIPT}" "${BUILDNAME}" "${BUILDOPTIONS}" "makefile V=1" "-DUSE_LTM -DLTM_DESC" "-ltommath"
- bash "${BUILDSCRIPT}" "${BUILDNAME}" "${BUILDOPTIONS}" "makefile.shared V=1" "-DUSE_TFM -DTFM_DESC" "-ltfm"
env:
- |
BUILDSCRIPT="check_source.sh"
BUILDNAME="CHECK_SOURCES"
BUILDOPTIONS=" "
- |
BUILDSCRIPT="scan_build.sh"
BUILDNAME="SCAN_BUILD"
BUILDOPTIONS=" "
- |
BUILDSCRIPT="coverage.sh"
BUILDNAME="COVERAGE"
BUILDOPTIONS=" "
- |
BUILDSCRIPT="run.sh"
BUILDNAME="STOCK"
BUILDOPTIONS=" "
- |
BUILDSCRIPT="run.sh"
BUILDNAME="EASY"
BUILDOPTIONS="-DLTC_EASY"
- |
BUILDSCRIPT="run.sh"
BUILDNAME="SMALL"
BUILDOPTIONS="-DLTC_SMALL_CODE"
- |
BUILDSCRIPT="run.sh"
BUILDNAME="NOTABLES"
BUILDOPTIONS="-DLTC_NO_TABLES"
- |
BUILDSCRIPT="run.sh"
BUILDNAME="SMALL+NOTABLES"
BUILDOPTIONS="-DLTC_SMALL_CODE -DLTC_NO_TABLES"
- |
BUILDSCRIPT="run.sh"
BUILDNAME="CLEANSTACK"
BUILDOPTIONS="-DLTC_CLEAN_STACK"
- |
BUILDSCRIPT="run.sh"
BUILDNAME="CLEANSTACK+SMALL"
BUILDOPTIONS="-DLTC_SMALL_CODE -DLTC_CLEAN_STACK"
- |
BUILDSCRIPT="run.sh"
BUILDNAME="CLEANSTACK+NOTABLES"
BUILDOPTIONS="-DLTC_NO_TABLES -DLTC_CLEAN_STACK"
- |
BUILDSCRIPT="run.sh"
BUILDNAME="CLEANSTACK+NOTABLES+SMALL"
BUILDOPTIONS="-DLTC_NO_TABLES -DLTC_CLEAN_STACK -DLTC_SMALL_CODE"
- |
BUILDSCRIPT="run.sh"
BUILDNAME="NO_FAST"
BUILDOPTIONS="-DLTC_NO_FAST"
- |
BUILDSCRIPT="run.sh"
BUILDNAME="NO_FAST+NOTABLES"
BUILDOPTIONS="-DLTC_NO_FAST -DLTC_NO_TABLES"
- |
BUILDSCRIPT="run.sh"
BUILDNAME="NO_ASM"
BUILDOPTIONS="-DLTC_NO_ASM"
- |
BUILDSCRIPT="run.sh"
BUILDNAME="NO_TIMING_RESISTANCE"
BUILDOPTIONS="-DLTC_NO_ECC_TIMING_RESISTANT -DLTC_NO_RSA_BLINDING"
- |
BUILDSCRIPT="run.sh"
BUILDNAME="CLEANSTACK+NOTABLES+SMALL+NO_ASM+NO_TIMING_RESISTANCE"
BUILDOPTIONS="-DLTC_CLEAN_STACK -DLTC_NO_TABLES -DLTC_SMALL_CODE -DLTC_NO_ECC_TIMING_RESISTANT -DLTC_NO_RSA_BLINDING"
- |
BUILDSCRIPT="run.sh"
BUILDNAME="PTHREAD"
BUILDOPTIONS="-DLTC_PTHREAD"
- |
BUILDSCRIPT="run.sh"
BUILDNAME="CLEANSTACK+NOTABLES+SMALL+NO_ASM+NO_TIMING_RESISTANCE+PTHREAD"
BUILDOPTIONS="-DLTC_CLEAN_STACK -DLTC_NO_TABLES -DLTC_SMALL_CODE -DLTC_NO_ECC_TIMING_RESISTANT -DLTC_NO_RSA_BLINDING -DLTC_PTHREAD"
- |
BUILDSCRIPT="testbuild.sh"
BUILDNAME="NOTEST"
BUILDOPTIONS="-DLTC_NO_TEST"
- |
BUILDSCRIPT="testbuild.sh"
BUILDNAME="NOFILE"
BUILDOPTIONS="-DLTC_NO_FILE"
after_failure:
- cat test_std.txt
- cat test_err.txt
- cat tv.txt
after_script:
- cat gcc_1.txt
- cat gcc_2.txt
notifications:
irc: "chat.freenode.net#libtom-notifications"
LibTomCrypt is licensed under DUAL licensing terms.
Choose and use the license of your needs.
[LICENSE #1]
LibTomCrypt is public domain. As should all quality software be. LibTomCrypt is public domain. As should all quality software be.
   
Tom St Denis Tom St Denis
   
[/LICENSE #1]
[LICENSE #2]
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
   
[/LICENSE #2]