Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ssh/Serializer: CommitBignum2() strips leading null bytes
OpenSSL's EVP_PKEY_derive() function sometimes inserts leading null bytes: in ossl_ecdh_simple_compute_key(), the difference between EC_GROUP_get_degree() and BN_num_bytes() is padded with null bytes. But the SSH2 protocol mandates that leading null bytes must be stripped. Without this, the hash used to generate the ECDH reply is wrong, resulting in OpenSSH error "incorrect signature". This problem occurs rarely only, which is why I never noticed it during development. To reproduce it, the "test_lukko.py" script needs to be run in a loop for 10 minutes or so.
- Loading branch information