Commit Graph

130 Commits

Author SHA1 Message Date
allegroai
b63e8d8694 sync github July 2024 2024-07-24 03:31:27 +03:00
Matt Johnston
81425365de Support RSA OpenSSH new format in dropbearconvert
Added support for reading and writing. PEM writing support
has been removed.

OpenSSH file format routines have been moved to signkey_ossh.c
2022-03-29 22:27:55 +08:00
Matt Johnston
f030618543 Split CPPFLAGS and CFLAGS more carefully
This has no change to the build, but makes it easier to try
other build tools that only want CPPFLAGS
2022-03-22 16:17:05 +08:00
egor-duda
5edd2ce32e
Implement server-side support for sk-ecdsa U2F-backed keys (#142)
* Implement server-side support for sk-ecdsa U2F-backed keys

* Fix out-of-bounds read on normal ecdsa-sha2-[identifier] keys

* Fix one more potential out-of-bounds read

* Check if nistp256 curve is used in sk-ecdsa-sha2- key

It's the only allowed curve per PROTOCOL.u2f specification

* Implement server-side support for sk-ed25519 FIDO2-backed keys

* Keys with type sk-* make no sense as host keys, so they should be
disabled

* fix typo

* Make sk-ecdsa call buf_ecdsa_verify

This reduces code duplication, the SK code just handles the
different message format.

* Reduce sk specific code

The application id can be stored in signkey, then we don't need
to call sk-specific functions from svr-authpubkey

* Remove debugging output, which causes compilation errors with DEBUG_TRACE disabled

* Proper cleanup of sk_app

Co-authored-by: Matt Johnston <matt@codeconstruct.com.au>
2022-01-22 21:53:04 +08:00
Matt Johnston
ae25761c7c Rename "make test" to "make check". Also run lint 2021-10-18 15:17:14 +08:00
Matt Johnston
8b0d31ab20 Add "make test" target to run pytest
This will create a virtualenv if required.

There is a bit of churn here reverting to autoconf 2.59 in generated
config.h.in and configure
2021-10-18 14:24:32 +08:00
Matt Johnston
f9ff3fa23d fuzz: skip custom mutators with -fsanitize=memory 2020-12-05 11:54:53 +08:00
Matt Johnston
8ec9016585 Add server postauth fuzzer, wrap connect_remote() 2020-11-13 23:18:05 +08:00
Matt Johnston
24cfda9e3c fuzzing - fix some wrong types and -lcrypt on macos 2020-11-02 20:33:48 +08:00
Matt Johnston
6aa065b1b4 Use SSH packet mutator for preauth too
Get rid of separate client mutator.
Have 0.1% chance of llvm random mutation
Add comments
2020-10-29 22:41:37 +08:00
Matt Johnston
bf4058d1df Preallocate memory for sshpacketmutator. Add fuzzer-client_mutator_nomaths 2020-10-26 23:31:24 +08:00
Matt Johnston
1260fbc5cd Fix fuzz-sshpacketmutator to work 2020-10-26 22:52:07 +08:00
Matt Johnston
4e8a1da551 Add first try at fuzzing custom mutator 2020-10-25 22:52:36 +08:00
Matt Johnston
f37def57b0 Move fuzzing code to fuzz/ subdirectory, improve Makefile.in 2020-10-23 23:10:20 +08:00
Matt Johnston
3b400bd64e Don't sort objects, it breaks -lcrypt ordering 2020-10-20 23:33:45 +08:00
Matt Johnston
33eba22966 Add fuzzer-client_nomaths, fix client fuzzer
--HG--
branch : fuzz
2020-10-18 15:08:54 +08:00
Matt Johnston
282fc81981 Get client fuzzer building and starting (fails straight away)
--HG--
branch : fuzz
2020-10-18 12:17:39 +08:00
Gabor Z. Papp
ab9cfce00d Fix "make install" for manpages in out-of-tree builds 2020-06-15 23:17:27 +08:00
Matt Johnston
d277f140ba merge rsa-sha256 2020-05-26 00:24:02 +08:00
Vladislav Grishenko
d3d0d60076
Add Chacha20-Poly1305, AES128-GCM and AES256-GCM support (#93)
* Add Chacha20-Poly1305 authenticated encryption

* Add general AEAD approach.
* Add chacha20-poly1305@openssh.com algo using LibTomCrypt chacha and
  poly1305 routines.

Chacha20-Poly1305 is generally faster than AES256 on CPU w/o dedicated
AES instructions, having the same key size.
Compiling in will add ~5,5kB to binary size on x86-64.

function                                             old     new   delta
chacha_crypt                                           -    1397   +1397
_poly1305_block                                        -     608    +608
poly1305_done                                          -     595    +595
dropbear_chachapoly_crypt                              -     457    +457
.rodata                                            26976   27392    +416
poly1305_process                                       -     290    +290
poly1305_init                                          -     221    +221
chacha_setup                                           -     218    +218
encrypt_packet                                      1068    1270    +202
dropbear_chachapoly_getlength                          -     147    +147
decrypt_packet                                       756     897    +141
chacha_ivctr64                                         -     137    +137
read_packet                                          543     637     +94
dropbear_chachapoly_start                              -      94     +94
read_kex_algos                                       792     880     +88
chacha_keystream                                       -      69     +69
dropbear_mode_chachapoly                               -      48     +48
sshciphers                                           280     320     +40
dropbear_mode_none                                    24      48     +24
dropbear_mode_ctr                                     24      48     +24
dropbear_mode_cbc                                     24      48     +24
dropbear_chachapoly_mac                                -      24     +24
dropbear_chachapoly                                    -      24     +24
gen_new_keys                                         848     854      +6
------------------------------------------------------------------------------
(add/remove: 14/0 grow/shrink: 10/0 up/down: 5388/0)         Total: 5388 bytes

* Add AES128-GCM and AES256-GCM authenticated encryption

* Add general AES-GCM mode.
* Add aes128-gcm@openssh.com and aes256-gcm@openssh.com algo using
  LibTomCrypt gcm routines.

AES-GCM is combination of AES CTR mode and GHASH, slower than AES-CTR on
CPU w/o dedicated AES/GHASH instructions therefore disabled by default.
Compiling in will add ~6kB to binary size on x86-64.

function                                             old     new   delta
gcm_process                                            -    1060   +1060
.rodata                                            26976   27808    +832
gcm_gf_mult                                            -     820    +820
gcm_add_aad                                            -     660    +660
gcm_shift_table                                        -     512    +512
gcm_done                                               -     471    +471
gcm_add_iv                                             -     384    +384
gcm_init                                               -     347    +347
dropbear_gcm_crypt                                     -     309    +309
encrypt_packet                                      1068    1270    +202
decrypt_packet                                       756     897    +141
gcm_reset                                              -     118    +118
read_packet                                          543     637     +94
read_kex_algos                                       792     880     +88
sshciphers                                           280     360     +80
gcm_mult_h                                             -      80     +80
dropbear_gcm_start                                     -      62     +62
dropbear_mode_gcm                                      -      48     +48
dropbear_mode_none                                    24      48     +24
dropbear_mode_ctr                                     24      48     +24
dropbear_mode_cbc                                     24      48     +24
dropbear_ghash                                         -      24     +24
dropbear_gcm_getlength                                 -      24     +24
gen_new_keys                                         848     854      +6
------------------------------------------------------------------------------
(add/remove: 14/0 grow/shrink: 10/0 up/down: 6434/0)         Total: 6434 bytes
2020-05-25 23:50:25 +08:00
Matt Johnston
545cc62671 Add linter for #ifdef 2020-05-24 13:15:24 +08:00
Vladislav Grishenko
3d12521735
Add Ed25519 support (#91)
* Add support for Ed25519 as a public key type

Ed25519 is a elliptic curve signature scheme that offers
better security than ECDSA and DSA and good performance. It may be
used for both user and host keys.

OpenSSH key import and fuzzer are not supported yet.

Initially inspired by Peter Szabo.

* Add curve25519 and ed25519 fuzzers

* Add import and export of Ed25519 keys
2020-03-12 00:09:45 +08:00
Steffen Jaeckel
615ed4e46a update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
* make key-generation compliant to FIPS 186.4

* fix includes in tommath_class.h

* update fuzzcorpus instead of error-out

* fixup fuzzing make-targets

* update Makefile.in

* apply necessary patches to ltm sources

* clean-up not required ltm files

* update to vanilla ltm 1.1.0

this already only contains the required files

* remove set/get double
2019-09-16 21:50:38 +08:00
Matt Johnston
fa116e983b Rename EPKA -> Plugin 2019-05-15 21:59:45 +08:00
fabriziobertocci
8c6aaf8d36 External Public-Key Authentication API (#72)
* Implemented dynamic loading of an external plug-in shared library to delegate public key authentication

* Moved conditional compilation of the plugin infrastructure into the configure.ac script to be able to add -ldl to dropbear build only when the flag is enabled

* Added tags file to the ignore list

* Updated API to have the constructor to return function pointers in the pliugin instance. Added support for passing user name to the checkpubkey function. Added options to the session returned by the plugin and have dropbear to parse and process them

* Added -rdynamic to the linker flags when EPKA is enabled

* Changed the API to pass a previously created session to the checkPubKey function (created during preauth)

* Added documentation to the API

* Added parameter addrstring to plugin creation function

* Modified the API to retrieve the auth options. Instead of having them as field of the EPKASession struct, they are stored internally (plugin-dependent) in the plugin/session and retrieved through a pointer to a function (in the session)

* Changed option string to be a simple char * instead of unsigned char *
2019-05-15 21:43:57 +08:00
Matt Johnston
6b05aa4275 fix some links 2018-03-05 14:14:26 +08:00
Matt Johnston
35f479bd87 Add kexdh and kexecdh fuzzers 2018-03-05 11:50:31 +08:00
Matt Johnston
1e1e477d85 set up CXX for fuzzing build 2018-03-04 17:08:21 +08:00
Matt Johnston
b9edf939f4 add cryptlib for all targets in fuzz build 2018-03-03 11:08:26 +08:00
Matt Johnston
5f2447edbb Fix to be able to compile normal(ish) binaries with --enable-fuzz
--HG--
branch : fuzz
2018-02-28 22:02:12 +08:00
Matt Johnston
9bbce01e1b merge from main
--HG--
branch : fuzz
2018-02-28 21:28:59 +08:00
Matt Johnston
e0c86670e2 only clean libtom when using bundled libraries 2018-02-26 23:13:54 +08:00
Matt Johnston
5df73215f8 merge from main
--HG--
branch : fuzz
2018-02-26 22:44:48 +08:00
Matt Johnston
3f3f399231 - Fix dependencies and remove old default_options.h from version control
- Rename default_options.h.in -> default_options.h, and
  default_options.h -> default_options_guard.h
- Fix newlines in default_options.h
2018-02-19 22:16:50 +08:00
Matt Johnston
7e8094d53a merge from main
--HG--
branch : fuzz
2018-02-17 19:29:51 +08:00
Michael Witten
3ee685ad1c options: Complete the transition to numeric toggles (`#if')
For the sake of review, this commit alters only the code; the affiliated
comments within the source files also need to be updated, but doing so
now would obscure the operational changes that have been made here.

* All on/off options have been switched to the numeric `#if' variant;
  that is the only way to make this `default_options.h.in' thing work
  in a reasonable manner.

* There is now some very minor compile-time checking of the user's
  choice of options.

* NO_FAST_EXPTMOD doesn't seem to be used, so it has been removed.

* ENABLE_USER_ALGO_LIST was supposed to be renamed DROPBEAR_USER_ALGO_LIST,
  and this commit completes that work.

* DROPBEAR_FUZZ seems to be a relatively new, as-yet undocumented option,
  which was added by the following commit:

    commit 6e0b539e9c
    Author: Matt Johnston <matt@ucc.asn.au>
    Date:   Tue May 23 22:29:21 2017 +0800

        split out checkpubkey_line() separately

  It has now been added to `sysoptions.h' and defined as `0' by default.

* The configuration option `DROPBEAR_PASSWORD_ENV' is no longer listed in
  `default_options.h.in'; it is no longer meant to be set by the user, and
  is instead left to be defined in `sysoptions.h' (where it was already being
  defined) as merely the name of the environment variable in question:

    DROPBEAR_PASSWORD

  To enable or disable use of that environment variable, the user must now
  toggle `DROPBEAR_USE_DROPBEAR_PASSWORD'.

* The sFTP support is now toggled by setting `DROPBEAR_SFTPSERVER', and the
  path of the sFTP server program is set independently through the usual
  SFTPSERVER_PATH.
2018-02-16 23:13:47 +08:00
Matt Johnston
93632660bb update some dependencies 2018-02-14 00:17:30 +08:00
Michael Witten
ad9db51434 build: Remove unused constructs: space' and AC_PROG_MAKE_SET'
The makefile variable `space' is never used.

The autoconf output variable `SET_MAKE' is never used, so the
autoconf macro `AC_PROG_MAKE_SET' has been removed.
2018-02-11 23:43:19 +08:00
Matt Johnston
22eb197d6c Fix building default_options.h 2018-02-11 10:53:59 +08:00
Matt Johnston
89bdf3b0b9 add fuzzer-preauth_nomaths
--HG--
branch : fuzz
2018-01-23 23:05:47 +08:00
Matt Johnston
597f7eb5e9 merge up to date
--HG--
branch : fuzz
2018-01-23 22:46:07 +08:00
Matt Johnston
a5ec3aca7d EXEEXT for a few more targets, dropbearmulti in particular for Cygwin
From William K. Foster.
2017-06-27 23:02:05 +08:00
Matt Johnston
785459d31b document --enable-static in place of STATIC=1 2017-06-27 22:42:32 +08:00
Matt Johnston
a9a3746d09 add --enable-static configure argument. disable conflicting harden flags 2017-06-27 22:37:46 +08:00
Matt Johnston
cbd5be1b82 add fuzzer-verify
--HG--
branch : fuzz
2017-05-26 00:20:01 +08:00
Matt Johnston
3a8517b06f create fuzzer .options files
--HG--
branch : fuzz
2017-05-23 22:43:52 +08:00
Matt Johnston
0363d3c32e fuzzer-pubkey
--HG--
branch : fuzz
2017-05-23 22:43:34 +08:00
Matt Johnston
fb8fb7fed0 add dbmalloc epoch cleanup
--HG--
branch : fuzz
2017-05-21 10:54:11 +08:00
Matt Johnston
e7cdb2ebe5 add wrapfd. improve fuzzer in makefile
--HG--
branch : fuzz
2017-05-19 00:48:46 +08:00
Matt Johnston
4dae8edb76 merge main to fuzz
--HG--
branch : fuzz
2017-05-18 23:45:10 +08:00