Skip to content

Commit 80b775b

Browse files
author
NIIBE Yutaka
committed
agent: Support SSH signature flags.
* agent/command-ssh.c (SSH_AGENT_RSA_SHA2_256): New. (SSH_AGENT_RSA_SHA2_512): New. (ssh_handler_sign_request): Override SPEC when FLAGS is specified. -- GnuPG-bug-id: 3880 Reported-by: Daniel Kahn Gillmor <[email protected]> Signed-off-by: NIIBE Yutaka <[email protected]>
1 parent d27417d commit 80b775b

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

agent/command-ssh.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@
8383
/* Other constants. */
8484
#define SSH_DSA_SIGNATURE_PADDING 20
8585
#define SSH_DSA_SIGNATURE_ELEMS 2
86+
#define SSH_AGENT_RSA_SHA2_256 0x02
87+
#define SSH_AGENT_RSA_SHA2_512 0x04
8688
#define SPEC_FLAG_USE_PKCS1V2 (1 << 0)
8789
#define SPEC_FLAG_IS_ECDSA (1 << 1)
8890
#define SPEC_FLAG_IS_EdDSA (1 << 2) /*(lowercase 'd' on purpose.)*/
@@ -2880,11 +2882,24 @@ ssh_handler_sign_request (ctrl_t ctrl, estream_t request, estream_t response)
28802882
if (err)
28812883
goto out;
28822884

2883-
/* FIXME? */
28842885
err = stream_read_uint32 (request, &flags);
28852886
if (err)
28862887
goto out;
28872888

2889+
if (spec.algo == GCRY_PK_RSA)
2890+
{
2891+
if ((flags & SSH_AGENT_RSA_SHA2_256))
2892+
{
2893+
spec.ssh_identifier = "rsa-sha2-256";
2894+
spec.hash_algo = GCRY_MD_SHA256;
2895+
}
2896+
else if ((flags & SSH_AGENT_RSA_SHA2_512))
2897+
{
2898+
spec.ssh_identifier = "rsa-sha2-512";
2899+
spec.hash_algo = GCRY_MD_SHA512;
2900+
}
2901+
}
2902+
28882903
hash_algo = spec.hash_algo;
28892904
if (!hash_algo)
28902905
hash_algo = GCRY_MD_SHA1; /* Use the default. */

0 commit comments

Comments
 (0)