Date: Sun, 13 Sep 2009 02:23:05 +0200 From: Ivan Voras <ivoras@freebsd.org> To: freebsd-geom@freebsd.org Subject: g_eli ivgen Message-ID: <h8he20$s6o$1@ger.gmane.org>
next in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig0367ACFB651763C964207A31 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I'm looking at doing something in GELI and I've come across the following code in g_eli.c: 381 void 382 g_eli_crypto_ivgen(struct g_eli_softc *sc, off_t offset, u_char *iv,= 383 size_t size) 384 { 385 u_char off[8], hash[SHA256_DIGEST_LENGTH]; 386 SHA256_CTX ctx; 387 388 if (!(sc->sc_flags & G_ELI_FLAG_NATIVE_BYTE_ORDER)) 389 le64enc(off, (uint64_t)offset); 390 /* Copy precalculated SHA256 context for IV-Key. */ 391 bcopy(&sc->sc_ivctx, &ctx, sizeof(ctx)); 392 SHA256_Update(&ctx, (uint8_t *)&offset, sizeof(offset)); 393 SHA256_Final(hash, &ctx); 394 bcopy(hash, iv, size); 395 } I don't get the purpose of the off variable - specifically, it looks unused. It looks to me like the idea was to convert offset to off if G_ELI_FLAG_NATIVE_BYTE_ORDER is not set but then it never got used and there's an "else" clause missing. Is this correct or am I missing somethi= ng? --------------enig0367ACFB651763C964207A31 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkqsO28ACgkQldnAQVacBchVlwCeOCeFnQhtxk8Af1JYzeRjREUf 8CsAoLcn8WV3bbAOl4YzaI8XDzMAOVNk =0CZM -----END PGP SIGNATURE----- --------------enig0367ACFB651763C964207A31--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?h8he20$s6o$1>