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: Alessio Vanni
Subject: Re: Help with hashing and signatures
Date: Tue, 04 Aug 2020 18:00:40 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

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.



reply via email to

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