Created
June 21, 2018 09:22
-
-
Save robUx4/7a772f00d3d01582d358d147bcd7e1f8 to your computer and use it in GitHub Desktop.
line 146
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Make sure that the opaque MPI VALUE is in compact EdDSA format. | |
This function updates MPI if needed. */ | |
gpg_err_code_t | |
_gcry_ecc_eddsa_ensure_compact (gcry_mpi_t value, unsigned int nbits) | |
{ | |
gpg_err_code_t rc; | |
const unsigned char *buf; | |
unsigned int rawmpilen; | |
gcry_mpi_t x, y; | |
unsigned char *enc; | |
unsigned int enclen; | |
if (!mpi_is_opaque (value)) | |
return GPG_ERR_INV_OBJ; | |
buf = mpi_get_opaque (value, &rawmpilen); | |
if (!buf) | |
return GPG_ERR_INV_OBJ; | |
rawmpilen = (rawmpilen + 7)/8; | |
if (rawmpilen > 1 && (rawmpilen%2)) | |
{ | |
if (buf[0] == 0x04) | |
{ | |
/* Buffer is in SEC1 uncompressed format. Extract y and | |
compress. */ | |
rc = _gcry_mpi_scan (&x, GCRYMPI_FMT_STD, | |
buf+1, (rawmpilen-1)/2, NULL); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment