mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-25 15:27:03 +01:00
ecc-sos: Fix ECDH.
* g10/ecdh.c (pk_ecdh_encrypt_with_shared_point): Fix deallocation. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
0691234951
commit
cea6925fa4
10
g10/ecdh.c
10
g10/ecdh.c
@ -133,10 +133,7 @@ pk_ecdh_encrypt_with_shared_point (int is_encrypt, gcry_mpi_t shared_mpi,
|
|||||||
returns X with no prefix of 40, so, nbytes == secret_x_size
|
returns X with no prefix of 40, so, nbytes == secret_x_size
|
||||||
is allowed. */
|
is allowed. */
|
||||||
if (nbytes < secret_x_size)
|
if (nbytes < secret_x_size)
|
||||||
{
|
return gpg_error (GPG_ERR_BAD_DATA);
|
||||||
xfree (secret_x);
|
|
||||||
return gpg_error (GPG_ERR_BAD_DATA);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remove the prefix. */
|
/* Remove the prefix. */
|
||||||
if ((nbytes & 1))
|
if ((nbytes & 1))
|
||||||
@ -159,10 +156,7 @@ pk_ecdh_encrypt_with_shared_point (int is_encrypt, gcry_mpi_t shared_mpi,
|
|||||||
* a KEK.
|
* a KEK.
|
||||||
*/
|
*/
|
||||||
if (!gcry_mpi_get_flag (pkey[2], GCRYMPI_FLAG_OPAQUE))
|
if (!gcry_mpi_get_flag (pkey[2], GCRYMPI_FLAG_OPAQUE))
|
||||||
{
|
return gpg_error (GPG_ERR_BUG);
|
||||||
xfree (secret_x);
|
|
||||||
return gpg_error (GPG_ERR_BUG);
|
|
||||||
}
|
|
||||||
kek_params = gcry_mpi_get_opaque (pkey[2], &nbits);
|
kek_params = gcry_mpi_get_opaque (pkey[2], &nbits);
|
||||||
kek_params_size = (nbits+7)/8;
|
kek_params_size = (nbits+7)/8;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user