Skip to content

Commit

Permalink
ssh-agent: promote sk_provider == NULL to "internal"
Browse files Browse the repository at this point in the history
a sk_provider is required by ssh-sk-helper. as such, treat ssh-sk
keys without a provider as belonging to the "internal" provider.
  • Loading branch information
martelletto committed Dec 9, 2021
1 parent 7393b48 commit b31d77e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions contrib/win32/win32compat/ssh-agent/keyagent-request.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ static int sign_blob(const struct sshkey *pubkey, u_char ** sig, size_t *siglen,
DWORD regdatalen = 0, keyblob_len = 0;
struct sshbuf* tmpbuf = NULL;
char *keyblob = NULL;
const char *sk_provider = NULL;

*sig = NULL;
*siglen = 0;
Expand All @@ -230,8 +231,14 @@ static int sign_blob(const struct sshkey *pubkey, u_char ** sig, size_t *siglen,
else if (flags & SSH_AGENT_RSA_SHA2_512)
algo = "rsa-sha2-512";

if (sshkey_private_deserialize(tmpbuf, &prikey) != 0 ||
sshkey_sign(prikey, sig, siglen, blob, blen, algo, NULL, NULL, 0) != 0) {
if (sshkey_private_deserialize(tmpbuf, &prikey) != 0) {
debug("cannot deserialize key");
goto done;
}
if (sshkey_is_sk(prikey))
sk_provider = "internal";
if (sshkey_sign(prikey, sig, siglen, blob, blen, algo, sk_provider,
NULL, 0) != 0) {
debug("cannot sign using retrieved key");
goto done;
}
Expand Down Expand Up @@ -472,4 +479,4 @@ int process_keyagent_request(struct sshbuf* request, struct sshbuf* response, st
}
}

#pragma warning(pop)
#pragma warning(pop)

0 comments on commit b31d77e

Please sign in to comment.