diff options
author | NIIBE Yutaka <[email protected]> | 2020-06-09 01:32:47 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2020-06-09 01:32:47 +0000 |
commit | f5bc94555458123f93d8b07816a68fb7485421e1 (patch) | |
tree | d2e27f1eb0c027721847acc498affb536981e1e1 /g10/keyid.c | |
parent | gpg: If possible TRUST values now depend on signer's UID or --sender. (diff) | |
download | gnupg-f5bc94555458123f93d8b07816a68fb7485421e1.tar.gz gnupg-f5bc94555458123f93d8b07816a68fb7485421e1.zip |
gpg,ecc: Handle external representation as SOS with opaque MPI.
* g10/pkglue.h (sexp_extract_param_sos): New.
* g10/build-packet.c (sos_write): New.
(do_key, do_pubkey_enc, do_signature): Use sos_write for ECC.
* g10/export.c (cleartext_secret_key_to_openpgp): Use
sexp_extract_param_sos.
(transfer_format_to_openpgp): Use opaque MPI for ECC.
* g10/keygen.c (ecckey_from_sexp): Use sexp_extract_param_sos.
* g10/keyid.c (hash_public_key): Handle opaque MPI for SOS.
* g10/parse-packet.c (sos_read): New.
(parse_pubkeyenc,parse_signature,parse_key): Use sos_read for ECC.
* g10/pkglue.c (sexp_extract_param_sos): New.
(pk_verify): Handle opaque MPI for SOS.
(pk_encrypt): Use sexp_extract_param_sos.
* g10/seskey.c (encode_session_key): Use opaque MPI.
* g10/sign.c (do_sign): Use sexp_extract_param_sos.
Signed-off-by: NIIBE Yutaka <[email protected]>
Diffstat (limited to 'g10/keyid.c')
-rw-r--r-- | g10/keyid.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/g10/keyid.c b/g10/keyid.c index 0fdb18d88..d3fc29a98 100644 --- a/g10/keyid.c +++ b/g10/keyid.c @@ -181,14 +181,23 @@ hash_public_key (gcry_md_hd_t md, PKT_public_key *pk) else if (gcry_mpi_get_flag (pk->pkey[i], GCRYMPI_FLAG_OPAQUE)) { const void *p; + int is_sos = 0; + + if (gcry_mpi_get_flag (pk->pkey[i], GCRYMPI_FLAG_USER2)) + is_sos = 2; p = gcry_mpi_get_opaque (pk->pkey[i], &nbits); - pp[i] = xmalloc ((nbits+7)/8); + pp[i] = xmalloc ((nbits+7)/8 + is_sos); if (p) - memcpy (pp[i], p, (nbits+7)/8); + memcpy (pp[i] + is_sos, p, (nbits+7)/8); else pp[i] = NULL; - nn[i] = (nbits+7)/8; + if (is_sos) + { + pp[i][0] = (nbits >> 8); + pp[i][1] = nbits; + } + nn[i] = (nbits+7)/8 + is_sos; n += nn[i]; } else |