FreeBSD/sys/geom/eli/g_eli_integrity.c
/*
 * Here we generate key for HMAC. Every sector has its own HMAC key, so it is
 * not possible to copy sectors.
 * We cannot depend on fact, that every sector has its own IV, because different
 * IV doesn't change HMAC, when we use encrypt-then-authenticate method.
 */
Here we generate key for HMAC. Every sector has its own HMAC key, so it is
not possible to copy sectors.
We cannot depend on fact, that every sector has its own IV, because different
IV doesn't change HMAC, when we use encrypt-then-authenticate method.
Here we generate key for HMAC . Every sector has its own HMAC key so it is not possible to copy sectors . We cannot depend on fact that every sector has its own IV because different IV doesn ' t change HMAC when we use encrypt - then - authenticate method .
static void
g_eli_auth_keygen(struct g_eli_softc *sc, off_t offset, u_char *key)
{
	SHA256_CTX ctx;
	bcopy(&sc->sc_akeyctx, &ctx, sizeof(ctx));
	SHA256_Update(&ctx, (uint8_t *)&offset, sizeof(offset));
	SHA256_Final(key, &ctx);
}
static void g_eli_auth_keygen ( struct g_eli_softc * sc , off_t offset , u_char * key ) { SHA256_CTX ctx ; bcopy ( & sc -> sc_akeyctx , & ctx , sizeof ( ctx ) ) ; SHA256_Update ( & ctx , ( uint8_t * ) & offset , sizeof ( offset ) ) ; SHA256_Final ( key , & ctx ) ; }
Here we generate key for HMAC.
Here we generate key for HMAC .
/* Copy precalculated SHA256 context. */