Darren J Moffat wrote:
> I've been hoping to use elements of the blkptr_t as the initalisation 
> vector (IV) for the AES crypto algorithms - specifically the offset and 
> blk_birth.  When do these get filled in ?

This happens during the allocate phase of the pipeline (either 
zio_dva_allocate or zio_write_allocate_gang_members). The value will be 
set to whatever zio->io_txg holds.

> 
> I was expecting them to be filled in by the time we reached the 
> ZIO_WRITE_ENCRYPT_STAGE (after compression but before checksum), but it 
> appears that only blk_props is filled in at this point.
> 
> So maybe I should be looking at io_txg instead.

Should work.

> 
> I need an IV that is guaranteed unique over the life time of the pool 
> that is also unique per encryption key (which for phase 1 of zfs-crypto 
> means unique per dataset).   Since there could be multiple blocks being 
> encrypted for the same dataset in a given transaction group (highly 
> likely in fact) the txg alone is not enough.
> 

Reply via email to