mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
2005-05-05 Moritz Schulte <moritz@g10code.com>
* command-ssh.c: Use ssh_key_grip(), where gcry_pk_get_keygrip() has been used before. (ssh_handler_sign_request): Removed unusued variable P.
This commit is contained in:
parent
e22f6db544
commit
2fb1abb849
@ -3,6 +3,9 @@
|
|||||||
* command-ssh.c (ssh_key_to_buffer): Rename to ...
|
* command-ssh.c (ssh_key_to_buffer): Rename to ...
|
||||||
(ssh_key_to_protected_buffer): ... this; change callers.
|
(ssh_key_to_protected_buffer): ... this; change callers.
|
||||||
Improved documentation.
|
Improved documentation.
|
||||||
|
Use ssh_key_grip(), where gcry_pk_get_keygrip() has been used
|
||||||
|
before.
|
||||||
|
(ssh_handler_sign_request): Removed unusued variable P.
|
||||||
|
|
||||||
2005-04-20 Moritz Schulte <moritz@g10code.com>
|
2005-04-20 Moritz Schulte <moritz@g10code.com>
|
||||||
|
|
||||||
|
@ -1531,6 +1531,26 @@ ssh_read_key_public_from_blob (unsigned char *blob, size_t blob_size,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* This function calculates the key grip for the key contained in the
|
||||||
|
S-Expression KEY and writes it to BUFFER, which must be large
|
||||||
|
enough to hold it. Returns usual error code. */
|
||||||
|
static gpg_error_t
|
||||||
|
ssh_key_grip (gcry_sexp_t key, char *buffer)
|
||||||
|
{
|
||||||
|
gpg_error_t err;
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
/* FIXME: unsigned vs. signed. */
|
||||||
|
|
||||||
|
p = gcry_pk_get_keygrip (key, buffer);
|
||||||
|
if (! p)
|
||||||
|
err = gpg_error (GPG_ERR_INTERNAL); /* FIXME? */
|
||||||
|
else
|
||||||
|
err = 0;
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
/* Converts the secret key KEY_SECRET into a public key, storing it in
|
/* Converts the secret key KEY_SECRET into a public key, storing it in
|
||||||
KEY_PUBLIC. SPEC is the according key specification. Returns zero
|
KEY_PUBLIC. SPEC is the according key specification. Returns zero
|
||||||
on success or an error code. */
|
on success or an error code. */
|
||||||
@ -1643,14 +1663,16 @@ card_key_available (ctrl_t ctrl, gcry_sexp_t *r_pk, char **cardsn)
|
|||||||
xfree (serialno);
|
xfree (serialno);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !gcry_pk_get_keygrip (s_pk, grip) )
|
err = ssh_key_grip (s_pk, grip);
|
||||||
|
if (err)
|
||||||
{
|
{
|
||||||
log_debug ("error computing keygrip from received card key\n");
|
log_debug ("error computing keygrip from received card key: %s\n",
|
||||||
|
gcry_strerror (err));
|
||||||
xfree (pkbuf);
|
xfree (pkbuf);
|
||||||
gcry_sexp_release (s_pk);
|
gcry_sexp_release (s_pk);
|
||||||
xfree (serialno);
|
xfree (serialno);
|
||||||
return gpg_error (GPG_ERR_INTERNAL);
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( agent_key_available (grip) )
|
if ( agent_key_available (grip) )
|
||||||
@ -1941,26 +1963,6 @@ ssh_handler_request_identities (ctrl_t ctrl,
|
|||||||
return ret_err;
|
return ret_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function calculates the key grip for the key contained in the
|
|
||||||
S-Expression KEY and writes it to BUFFER, which must be large
|
|
||||||
enough to hold it. Returns usual error code. */
|
|
||||||
static gpg_error_t
|
|
||||||
ssh_key_grip (gcry_sexp_t key, char *buffer)
|
|
||||||
{
|
|
||||||
gpg_error_t err;
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
/* FIXME: unsigned vs. signed. */
|
|
||||||
|
|
||||||
p = gcry_pk_get_keygrip (key, buffer);
|
|
||||||
if (! p)
|
|
||||||
err = gpg_error (GPG_ERR_INTERNAL); /* FIXME? */
|
|
||||||
else
|
|
||||||
err = 0;
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This function hashes the data contained in DATA of size DATA_N
|
/* This function hashes the data contained in DATA of size DATA_N
|
||||||
according to the message digest algorithm specified by MD_ALGORITHM
|
according to the message digest algorithm specified by MD_ALGORITHM
|
||||||
and writes the message digest to HASH, which needs to large enough
|
and writes the message digest to HASH, which needs to large enough
|
||||||
@ -2151,7 +2153,6 @@ ssh_handler_sign_request (ctrl_t ctrl, estream_t request, estream_t response)
|
|||||||
size_t sig_n;
|
size_t sig_n;
|
||||||
u32 data_size;
|
u32 data_size;
|
||||||
u32 flags;
|
u32 flags;
|
||||||
void *p;
|
|
||||||
gpg_error_t err;
|
gpg_error_t err;
|
||||||
gpg_error_t ret_err;
|
gpg_error_t ret_err;
|
||||||
|
|
||||||
@ -2192,12 +2193,9 @@ ssh_handler_sign_request (ctrl_t ctrl, estream_t request, estream_t response)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* Calculate key grip. */
|
/* Calculate key grip. */
|
||||||
p = gcry_pk_get_keygrip (key, key_grip);
|
err = ssh_key_grip (key, key_grip);
|
||||||
if (! p)
|
if (err)
|
||||||
{
|
goto out;
|
||||||
err = gpg_error (GPG_ERR_INTERNAL); /* FIXME? */
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sign data. */
|
/* Sign data. */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user