howto do a hash

Sergi Blanch i Torné sergi at
Fri Jan 2 01:21:27 CET 2009

On Thursday 01 January 2009 20:44:01 Moritz Schulte wrote:
> > What I don't know now is how to correctly create this 'context'?
> > Everywhere this is a 'pointer to void', and I cannot read the how.
> Why are you trying to fiddle around with Libgcrypt internals instead of
> using the exported programing interface as it is documented in the manual?

Yes, probably I am try from the wrong way. I'm writting in the libgcrypt the 
elliptic curve encrypt algorithm from the 'ECC in OpenPGP' internet draft. By 
the way this code is in, also I can write the methods from module to module 
as an external view.

> Have a look at the manual and the included test programs.
> To answer your specific question about the origin of the hash context:
> the gcry_md_spec_t structure contains the info about the required size
> for the context buffer.  This is allocated in md.c and then initialized
> with the algorithm-specific initialization function (also contained in
> that struct).

I found this, are you talking about the 'gcry_md_context' struct? You answer 
more than you think because I was declaring the buffer as a byte array, and 
it must be a gcry_md_hd_t? I'm checking it.

> Hope that helps,
> moritz

To avoid future questions and wrong way coding I like to explain what I did by 
now. In the cipher/ecc.c, the interface methods ecc_encrypt and ecc_decrypt 
are add also with the 'gcry_pk_spec_t', 'pk_extra_spec_t' and the aliases. 
Internally also exists the encrypt and decrypt methods but some auxiliaries 
are need.

From the standard I said a 'key derivation function' has to be implemented. 
Also in the document is explained, it comes from the Nist SP800-56A. Next 
step will be the AESkeyWrap (and the unwrap) from the rfc3394. But this will 
be further discussion.

Using this moment, I like to prepare a patch that disturbs yous work at the 
minimum. Not like it was on ecdsa, when hundreds of things needs to be 
rewritten (not by me). Which communication can be the best?

Really thanks!


More information about the Gcrypt-devel mailing list