1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-18 19:41:01 -05:00

New marshalling function put_datapl().

Just like put_data(), but takes a ptrlen rather than separate ptr and
len arguments, so it saves a bit of repetition at call sites. I
probably should have written this ages ago, but better late than
never; I've also converted every call site I can find that needed it.
This commit is contained in:
Simon Tatham
2019-01-01 19:00:19 +00:00
parent 4397016a51
commit c02031ffd6
10 changed files with 24 additions and 17 deletions

View File

@ -773,8 +773,8 @@ static void eddsa_openssh_blob(ssh_key *key, BinarySink *bs)
/* Encode the private key as the concatenation of the
* little-endian key integer and the public key again */
put_uint32(bs, priv.len + pub.len);
put_data(bs, priv.ptr, priv.len);
put_data(bs, pub.ptr, pub.len);
put_datapl(bs, priv);
put_datapl(bs, pub);
strbuf_free(pub_sb);
strbuf_free(priv_sb);
@ -828,7 +828,7 @@ static mp_int *ecdsa_signing_exponent_from_data(
/* Hash the data being signed. */
unsigned char hash[MAX_HASH_LEN];
ssh_hash *h = ssh_hash_new(extra->hash);
put_data(h, data.ptr, data.len);
put_datapl(h, data);
ssh_hash_final(h, hash);
/*
@ -921,9 +921,9 @@ static mp_int *eddsa_signing_exponent_from_data(
/* Hash (r || public key || message) */
unsigned char hash[MAX_HASH_LEN];
ssh_hash *h = ssh_hash_new(extra->hash);
put_data(h, r_encoded.ptr, r_encoded.len);
put_datapl(h, r_encoded);
put_epoint(h, ek->publicKey, ek->curve, true); /* omit string header */
put_data(h, data.ptr, data.len);
put_datapl(h, data);
ssh_hash_final(h, hash);
/* Convert to an integer */