summaryrefslogtreecommitdiffstats
path: root/packet.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* upstream: As defined in the RFC, the SSH protocol has negotiablederaadt@openbsd.org2024-08-271-4/+3
| | | | | | | | | | | | | | | | | | | | | | compression support (which is requested as the name "zlib"). Compression starts very early in the session. Relative early in OpenSSH lifetime, privsep was added to sshd, and this required a shared-memory hack so the two processes could see what was going on in the dataflow. This shared-memory hack was soon recognized as a tremendous complexity risk, because it put libz (which very much trusts it's memory) in a dangerous place, and a new option ("zlib@openssh.com") was added begins compression after authentication (aka delayed-compression). That change also permitted removal of the shared-memory hack. Despite removal from the server, the old "zlib" support remained in the client, to allow negotiation with non-OpenSSH daemons which lack the delayed-compression option. This commit deletes support for the older "zlib" option in the client. It reduces our featureset in a small way, and encourages other servers to move to a better design. The SSH protocol is different enough that compressed-key-material attacks like BEAST are unlikely, but who wants to take the chance? We encourage other ssh servers who care about optional compression support to add delayed-zlib support. (Some already do "zlib@openssh.com") ok djm markus OpenBSD-Commit-ID: 6df986f38e4ab389f795a6e39e7c6857a763ba72
* remove gratuitious difference from OpenBSDDamien Miller2024-08-151-6/+6
|
* upstream: Convert RSA and ECDSA key to the libcrypto EVP_PKEY API.djm@openbsd.org2024-08-151-2/+7
| | | | | | | | | | | | DSA remains unconverted as it will be removed within six months. Based on patches originally from Dmitry Belyavskiy, but significantly reworked based on feedback from Bob Beck, Joel Sing and especially Theo Buehler (apologies to anyone I've missed). ok tb@ OpenBSD-Commit-ID: d098744e89f1dc7e5952a6817bef234eced648b5
* upstream: typosdjm@openbsd.org2024-05-311-2/+2
| | | | OpenBSD-Commit-ID: edfa72eb06bfa65da30fabf7d2fe76d2d33f77bf
* upstream: Start the process of splitting sshd into separatedjm@openbsd.org2024-05-171-1/+93
| | | | | | | | | | | | | | | | | | | | binaries. This step splits sshd into a listener and a session binary. More splits are planned. After this changes, the listener binary will validate the configuration, load the hostkeys, listen on port 22 and manage MaxStartups only. All session handling will be performed by a new sshd-session binary that the listener fork+execs. This reduces the listener process to the minimum necessary and sets us up for future work on the sshd-session binary. feedback/ok markus@ deraadt@ NB. if you're updating via source, please restart sshd after installing, otherwise you run the risk of locking yourself out. OpenBSD-Commit-ID: 43c04a1ab96cdbdeb53d2df0125a6d42c5f19934
* upstream: implement "strict key exchange" in ssh and sshddjm@openbsd.org2023-12-181-44/+59
| | | | | | | | | | | | This adds a protocol extension to improve the integrity of the SSH transport protocol, particular in and around the initial key exchange (KEX) phase. Full details of the extension are in the PROTOCOL file. with markus@ OpenBSD-Commit-ID: 2a66ac962f0a630d7945fee54004ed9e9c439f14
* upstream: Add keystroke timing obfuscation to the client.djm@openbsd.org2023-08-281-1/+13
| | | | | | | | | | | | This attempts to hide inter-keystroke timings by sending interactive traffic at fixed intervals (default: every 20ms) when there is only a small amount of data being sent. It also sends fake "chaff" keystrokes for a random interval after the last real keystroke. These are controlled by a new ssh_config ObscureKeystrokeTiming keyword/ feedback/ok markus@ OpenBSD-Commit-ID: 02231ddd4f442212820976068c34a36e3c1b15be
* upstream: Introduce a transport-level ping facilitydjm@openbsd.org2023-08-281-2/+21
| | | | | | | | | | | This adds a pair of SSH transport protocol messages SSH2_MSG_PING/PONG to implement a ping capability. These messages use numbers in the "local extensions" number space and are advertised using a "ping@openssh.com" ext-info message with a string version number of "0". ok markus@ OpenBSD-Commit-ID: b6b3c4cb2084c62f85a8dc67cf74954015eb547f
* upstream: remove redundant ssh!=NULL check; we'd alreadydjm@openbsd.org2023-04-061-2/+2
| | | | | | dereferenced it OpenBSD-Commit-ID: 852bf12591ec5a9fb12dcbde9b1fd3945ad0df3c
* upstream: Ensure ms_remain is always initializeddtucker@openbsd.org2023-03-041-2/+2
| | | | | | | similar to what we do in ssh_packet_write_wait. bz#2687, from jjelen at redhat.com. OpenBSD-Commit-ID: a50e0541cf823f8d1c72f71ccde925d3dbe6dfac
* upstream: whitespacedjm@openbsd.org2022-08-311-2/+2
| | | | OpenBSD-Commit-ID: c2bcbf93610d3d62ed206cdf9bf9ff98c6aaf232
* upstream: add a ssh_packet_process_read() function that reads fromdjm@openbsd.org2022-01-251-1/+26
| | | | | | | | | | | | | | a fd directly into the transport input buffer. Use this in the client and server mainloops to avoid unnecessary copying. It also lets us use a more greedy read size without penalty. Yields a 2-3% performance gain on cipher-speed.sh (in a fairly unscientific test tbf) feedback dtucker@ ok markus@ OpenBSD-Commit-ID: df4112125bf79d8e38e79a77113e1b373078e632
* upstream: correct comment and use local variable instead of longdjm@openbsd.org2022-01-251-5/+4
| | | | | | indirection; spotted by dtucker@ OpenBSD-Commit-ID: 5f65f5f69db2b7d80a0a81b08f390a63f8845965
* upstream: when decompressing zlib compressed packets, usedjm@openbsd.org2022-01-181-2/+2
| | | | | | | | | | | Z_SYNC_FLUSH instead of Z_PARTIAL_FLUSH as the latter is not actually specified as a valid mode for inflate(). There should be no practical change in behaviour as the compression side ensures a flush that should make all data available to the receiver in all cases. repoted by lamm AT ibm.com via bz3372; ok markus OpenBSD-Commit-ID: 67cfc1fa8261feae6d2cc0c554711c97867cc81b
* upstream: spelling ok dtucker@jsg@openbsd.org2022-01-011-1/+1
| | | | OpenBSD-Commit-ID: bfc7ba74c22c928de2e257328b3f1274a3dfdf19
* upstream: debug("func: ...") -> debug_f("...")djm@openbsd.org2021-11-271-6/+6
| | | | OpenBSD-Commit-ID: d58494dc05c985326a895adfbe16fbd5bcc54347
* upstream: replace select() with ppoll(), including convertingderaadt@openbsd.org2021-11-171-39/+20
| | | | | | timeval's to timespec's to make things easier. back and forth and ok; djm OpenBSD-Commit-ID: 89d3b23c60875da919e7820f9de6213286ffbec9
* upstream: Explicitly check for and start time-based rekeying in thedjm@openbsd.org2021-07-161-7/+12
| | | | | | | | | | | | client and server mainloops. Previously the rekey timeout could expire but rekeying would not start until a packet was sent or received. This could cause us to spin in select() on the rekey timeout if the connection was quiet. ok markus@ OpenBSD-Commit-ID: 4356cf50d7900f3df0a8f2117d9e07c91b9ff987
* upstream: highly polished whitespace, mostly fixing spaces-for-tabdjm@openbsd.org2021-04-031-8/+8
| | | | | | and bad indentation on continuation lines. Prompted by GHPR#185 OpenBSD-Commit-ID: e5c81f0cbdcc6144df1ce468ec1bac366d8ad6e9
* upstream: make ssh->kex->session_id a sshbuf instead of u_char*/size_tdjm@openbsd.org2021-01-271-6/+5
| | | | | | | and use that instead of global variables containing copies of it. feedback/ok markus@ OpenBSD-Commit-ID: a4b1b1ca4afd2e37cb9f64f737b30a6a7f96af68
* upstream: Set the specified TOS/DSCP for interactive use prior todjm@openbsd.org2020-11-271-38/+4
| | | | | | | | | | | TCP connect. The connection phase of the SSH session is time-sensitive (due to server side login grace periods) and is frequently interactive (e.g. entering passwords). The ultimate interactive/bulk TOS/DSCP will be set after authentication completes. ok dtucker@ OpenBSD-Commit-ID: f31ab10d9233363a6d2c9996007083ba43a093f1
* upstream: use the new variant log macros instead of prependingdjm@openbsd.org2020-10-181-27/+24
| | | | | | __func__ and appending ssh_err(r) manually; ok markus@ OpenBSD-Commit-ID: 1f14b80bcfa85414b2a1a6ff714fb5362687ace8
* upstream: some language improvements; ok markusdjm@openbsd.org2020-07-151-2/+2
| | | | OpenBSD-Commit-ID: 939d787d571b4d5da50b3b721fd0b2ac236acaa8
* upstream: free kex in ssh_packet_close; ok djm semariemarkus@openbsd.org2020-07-031-1/+3
| | | | OpenBSD-Commit-ID: dbc181e90d3d32fd97b10d75e68e374270e070a2
* upstream: backout 1.293 fix kex mem-leak in ssh_packet_close at markussemarie@openbsd.org2020-06-271-3/+1
| | | | | | | | | request the change introduced a NULL deref in sshpkt_vfatal() (uses of ssh->kex after calling ssh_packet_clear_keys()) OpenBSD-Commit-ID: 9c9a6721411461b0b1c28dc00930d7251a798484
* upstream: fix kex mem-leak in ssh_packet_close; ok djmmarkus@openbsd.org2020-06-261-1/+3
| | | | OpenBSD-Commit-ID: e2e9533f393620383afd0b68ef435de8d5e8abe4
* upstream: fix ssh -O proxy w/mux which got broken by no longermarkus@openbsd.org2020-06-261-2/+5
| | | | | | making ssh->kex optional in packet.c revision 1.278 ok djm@ OpenBSD-Commit-ID: 2b65df04a064c2c6277359921d2320c90ab7d917
* upstream: consistently check packet_timeout_ms against 0; ok djmmarkus@openbsd.org2020-03-131-5/+5
| | | | OpenBSD-Commit-ID: e8fb8cb2c96c980f075069302534eaf830929928
* upstream: have sshpkt_fatal() save/restore errno before wedjm@openbsd.org2020-01-301-1/+4
| | | | | | potentially call strerror() (via ssh_err()); ok dtucker OpenBSD-Commit-ID: 5590df31d21405498c848245b85c24acb84ad787
* upstream: Fix typo in comment.dtucker@openbsd.org2020-01-231-2/+2
| | | | OpenBSD-Commit-ID: d1d7a6553208bf439378fd1cf686a828aceb353a
* upstream: Make zlib optional. This adds a "ZLIB" build time optiondtucker@openbsd.org2020-01-231-2/+36
| | | | | | | that allows building without zlib compression and associated options. With feedback from markus@, ok djm@ OpenBSD-Commit-ID: 44c6e1133a90fd15a3aa865bdedc53bab28b7910
* upstream: strdup may return NULL if memory allocation fails. Usetobhe@openbsd.org2019-12-201-3/+3
| | | | | | | | the safer xstrdup which fatals on allocation failures. ok markus@ OpenBSD-Commit-ID: 8b608d387120630753cbcb8110e0b019c0c9a0d0
* Wrap poll.h includes in HAVE_POLL_H.Darren Tucker2019-10-281-0/+2
|
* upstream: When system calls indicate an error they return -1, notderaadt@openbsd.org2019-07-051-7/+7
| | | | | | | | some arbitrary value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future. OpenBSD-Commit-ID: 48081f00db7518e3b712a49dca06efc2a5428075
* upstream: Typo and spelling fixes in comments and error messages.dtucker@openbsd.org2019-06-071-2/+2
| | | | | | Patch from knweiss at gmail.com via -portable. OpenBSD-Commit-ID: 2577465442f761a39703762c4f87a8dfcb918b4b
* upstream: Remove crc32.{c,h} which were only used by the now-gonedtucker@openbsd.org2019-05-081-2/+1
| | | | | | SSH1 protocol. Patch from yumkam at gmail.com, ok deraadt. OpenBSD-Commit-ID: cceda5876c5ba6b4d8abcd52335329198cee3240
* upstream: in ssh_set_newkeys(), mention the direction that we'redjm@openbsd.org2019-03-081-5/+7
| | | | | | | keying in debug messages. Previously it would be difficult to tell which direction it was talking about OpenBSD-Commit-ID: c2b71bfcceb2a7389b9d0b497fb2122a406a522d
* upstream: pass values used in KEX hash computation as sshbufdjm@openbsd.org2019-01-211-1/+7
| | | | | | | | rather than pointer+len suggested by me; implemented by markus@ ok me OpenBSD-Commit-ID: 994f33c464f4a9e0f1d21909fa3e379f5a0910f0
* upstream: Make sshpkt_get_bignum2() allocate the bignum it isdjm@openbsd.org2019-01-211-4/+3
| | | | | | | | parsing rather than make the caller do it. Saves a lot of boilerplate code. from markus@ ok djm@ OpenBSD-Commit-ID: 576bf784f9a240f5a1401f7005364e59aed3bce9
* upstream: allow sshpkt_fatal() to take a varargs format; we'lldjm@openbsd.org2019-01-191-6/+23
| | | | | | | use this to give packet-related fatal error messages more context (esp. the remote endpoint) ok markus@ OpenBSD-Commit-ID: de57211f9543426b515a8a10a4f481666b2b2a50
* upstream: fix memory leak of ciphercontext when rekeying; bz#2942djm@openbsd.org2019-01-041-3/+3
| | | | | | Patch from Markus Schmidt; ok markus@ OpenBSD-Commit-ID: 7877f1b82e249986f1ef98d0ae76ce987d332bdd
* upstream: move client/server SSH-* banners to buffers underdjm@openbsd.org2018-12-271-22/+20
| | | | | | | | | | | | | ssh->kex and factor out the banner exchange. This eliminates some common code from the client and server. Also be more strict about handling \r characters - these should only be accepted immediately before \n (pointed out by Jann Horn). Inspired by a patch from Markus Schmidt. (lots of) feedback and ok markus@ OpenBSD-Commit-ID: 1cc7885487a6754f63641d7d3279b0941890275b
* Explicitly include openssl before zlib.Darren Tucker2018-07-201-0/+12
| | | | | | Some versions of OpenSSL have "free_func" in their headers, which zlib typedefs. Including openssl after zlib (eg via sshkey.h) results in "syntax error before `free_func'", which this fixes.
* upstream: memleaks; found by valgrinddjm@openbsd.org2018-07-161-1/+3
| | | | OpenBSD-Commit-ID: 6c3ba22be53e753c899545f771e8399fc93cd844
* upstream: client: switch to sshbuf API; ok djm@markus@openbsd.org2018-07-101-4/+1
| | | | OpenBSD-Commit-ID: 60cb0356114acc7625ab85105f6f6a7cd44a8d05
* upstream: Revert previous two commitssf@openbsd.org2018-07-101-5/+6
| | | | | | | | | | | | | | | | | | | | | | It turns out we still support pre-auth compression on the client. Therefore revert the previous two commits: date: 2018/07/06 09:06:14; author: sf; commitid: yZVYKIRtUZWD9CmE; Rename COMP_DELAYED to COMP_ZLIB Only delayed compression is supported nowadays. ok markus@ date: 2018/07/06 09:05:01; author: sf; commitid: rEGuT5UgI9f6kddP; Remove leftovers from pre-authentication compression Support for this has been removed in 2016. COMP_DELAYED will be renamed in a later commit. ok markus@ OpenBSD-Commit-ID: cdfef526357e4e1483c86cf599491b2dafb77772
* upstream: Rename COMP_DELAYED to COMP_ZLIBsf@openbsd.org2018-07-101-4/+4
| | | | | | | | Only delayed compression is supported nowadays. ok markus@ OpenBSD-Commit-ID: 5b1dbaf3d9a4085aaa10fec0b7a4364396561821
* upstream: Remove leftovers from pre-authentication compressionsf@openbsd.org2018-07-101-4/+3
| | | | | | | | | Support for this has been removed in 2016. COMP_DELAYED will be renamed in a later commit. ok markus@ OpenBSD-Commit-ID: 6a99616c832627157113fcb0cf5a752daf2e6b58
* upstream: Remove unused ssh_packet_start_compression()sf@openbsd.org2018-07-101-22/+1
| | | | | | ok markus@ OpenBSD-Commit-ID: 9d34cf2f59aca5422021ae2857190578187dc2b4
* upstream: make ssh_remote_ipaddr() capable of being called afterdjm@openbsd.org2018-06-011-4/+8
| | | | | | the ssh->state has been torn down; bz#2773 OpenBSD-Commit-ID: 167f12523613ca3d16d7716a690e7afa307dc7eb