Skip to content

Commit b31d77e

Browse files
committed
ssh-agent: promote sk_provider == NULL to "internal"
a sk_provider is required by ssh-sk-helper. as such, treat ssh-sk keys without a provider as belonging to the "internal" provider.
1 parent 7393b48 commit b31d77e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

contrib/win32/win32compat/ssh-agent/keyagent-request.c

+10-3
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ static int sign_blob(const struct sshkey *pubkey, u_char ** sig, size_t *siglen,
208208
DWORD regdatalen = 0, keyblob_len = 0;
209209
struct sshbuf* tmpbuf = NULL;
210210
char *keyblob = NULL;
211+
const char *sk_provider = NULL;
211212

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

233-
if (sshkey_private_deserialize(tmpbuf, &prikey) != 0 ||
234-
sshkey_sign(prikey, sig, siglen, blob, blen, algo, NULL, NULL, 0) != 0) {
234+
if (sshkey_private_deserialize(tmpbuf, &prikey) != 0) {
235+
debug("cannot deserialize key");
236+
goto done;
237+
}
238+
if (sshkey_is_sk(prikey))
239+
sk_provider = "internal";
240+
if (sshkey_sign(prikey, sig, siglen, blob, blen, algo, sk_provider,
241+
NULL, 0) != 0) {
235242
debug("cannot sign using retrieved key");
236243
goto done;
237244
}
@@ -472,4 +479,4 @@ int process_keyagent_request(struct sshbuf* request, struct sshbuf* response, st
472479
}
473480
}
474481

475-
#pragma warning(pop)
482+
#pragma warning(pop)

0 commit comments

Comments
 (0)