ecc: Fix keygrip computation for compressed points.
* cipher/ecc-misc.c (_gcry_ecc_ec2os): Factor most code out to ... (_gcry_ecc_ec2os_buf): new. * cipher/ecc.c (compute_keygrip): Handle compressed keys. * tests/keygrip.c: Add new tests.
It is important to get the keygrips right even if we do not have full
support for compressed points. Case in point is that I god a
smartcard which returns the key in compressed format. We need to
early compute the keygrip and use it before doing any computation.
The code has been lifted from _gcry_ecc_sec_decodepoint. We should
factors parts of the code out to a new function.
- GnuPG-bug-id: T4961
- Signed-off-by: Werner Koch <wk@gnupg.org>