Bug 3094 - Signature verification fails on windows
Summary: Signature verification fails on windows
Status: NEW
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh-keygen (show other bugs)
Version: 8.1p1
Hardware: Other Windows 10
: P3 major
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-14 11:34 AEDT by balu
Modified: 2020-01-23 21:49 AEDT (History)
3 users (show)

See Also:


Attachments
accept \r\n at end of signature banner (2.03 KB, patch)
2020-01-23 21:49 AEDT, Damien Miller
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description balu 2019-11-14 11:34:10 AEDT
On windows, I tried to sign a file. The created signature file ends with \r\n as it's windows. Then I tried to verify the signature. It fails with the error message "Couldn't parse signature: missing header".

===================
Relevant Code
===================
sshsig_dearmor() -> calls timingsafe_bcmp()
timingsafe_bcmp() -> This function fails as "\r\n" != "\n"
#define BEGIN_SIGNATURE		"-----BEGIN SSH SIGNATURE-----\n"

===================
Steps:
===================
PS E:\code\openssh-portable> get-content -raw .\version.h | .\bin\x64\Debug\ssh-keygen.exe -vvv -Y sign -f .\id_rsa -n "abc" | out-file .\id_rsa.sig


PS E:\code\openssh-portable> get-content -raw ./version.h | .\bin\x64\Debug\ssh-keygen.exe -vvv -Y verify -s E:\code\openssh-portable\id_rsa.sig -n "abc"  -f E:\code\openssh-portable\id_rsa.pub -I test
Couldn't parse signature: missing header
verify: sshsig_armor: invalid format
Comment 1 Darren Tucker 2019-11-18 10:47:36 AEDT
Native Windows is not a configuration supported by the OpenSSH team.  Are you running the Microsoft fork?  If so you should report problems directly to them.
Comment 2 Damien Miller 2019-11-18 11:17:14 AEDT
That being said, I think we should be insensitive to whitespace at EOL in the header.
Comment 3 Damien Miller 2020-01-23 21:49:10 AEDT
Created attachment 3348 [details]
accept \r\n at end of signature banner

Please try this patch