help-gnunet
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with hashing and signatures


From: Schanzenbach, Martin
Subject: Re: Help with hashing and signatures
Date: Tue, 4 Aug 2020 18:15:25 +0200

Is your struct packed as specified in the comment?

> On 4. Aug 2020, at 18:00, Alessio Vanni <vannilla@firemail.cc> wrote:
> 
> TheJackiMonster <thejackimonster@gmail.com> writes:
> 
>> Does the `sd` variable contain the the same data in the verify function
>> as in the sign function? You wrote you would hash again but the
>> documentation mentions also:
>> 
>> "The size field in ps->purpose must correctly indicate the number of
>> bytes of the data structure, including its header."
>> 
>> and
>> 
>> "purpose of the signature, must match 'ps->purpose.purpose' (except in
>> host byte order)"
>> 
>> So maybe these points are the root of your problem.
> 
> The verify function doesn't have the same informations as the signing
> function, only the container that is passed to it.  It hashes the data
> because it doesn't have the hash used by the signing function.  Because
> this signature's purpose is to catch corruptions or unwanted changes in
> the data, even if I include the hash in the container I'd still have to
> generate a new hash to make sure the embedded hash is correct...
> 
> The problem of the documentation is that it also says this:
> 
> * @param purp purpose of the signature, must match 'ps->purpose.purpose'
> *              (except in host byte order)
> * @param priv private key to use for the signing
> * @param ps packed struct with what to sign, MUST begin with a purpose
> * @param sig where to write the signature
> 
> which wouldn't be an issue if the macro's signature wasn't
> 
> #define GNUNET_CRYPTO_ecdsa_verify(purp,ps,sig,pub)
> 
> i.e. there are differences in what's being documented.
> 
> The host byte order might or might not be relevant.  I'll try it and
> report back.
> 
>> Do you have memory limitations?
> 
> Yes.
> 
> Thanks,
> A.V.
> 

Attachment: signature.asc
Description: Message signed with OpenPGP


reply via email to

[Prev in Thread] Current Thread [Next in Thread]