Download raw body.
got_object_id-ify painted commits
Stefan Sperling <stsp@stsp.name> wrote:
> On Tue, Jul 09, 2024 at 11:23:14PM +0200, Omar Polo wrote:
> > Just to recap, my plan is to change very soon(tm) the struct
> > got_object_id to this:
> >
> > #define GOT_OBJECT_ID_MAXLEN SHA256_DIGEST_LENGTH
> > struct got_object_id {
> > u_int_8 hash[GOT_OBJECT_ID_MAXLEN];
> > enum got_hash_algorithm algo;
> > };
>
> Perhaps we should define enum got_hash_algorithm in a way that
> makes zero an invalid value? This way we could catch cases where
> we initialized with memset but did not set the algo explicitly.
> Currently, enum value zero means SHA1.
That's an interesting option I haven't considered. I'm currently making
sure everything it at least zeroed (which hopefully means I won't break
too horribly gotd because it'll take quite some time to reach the network
code for sha256), but doing this should be a huge aid in debugging to
spot all the places where we're doing wrong things.
got_object_id-ify painted commits