• Eric Biggers's avatar
    fsverity: rework fsverity_get_digest() again · 74836ecb
    Eric Biggers authored
    Address several issues with the calling convention and documentation of
    fsverity_get_digest():
    
    - Make it provide the hash algorithm as either a FS_VERITY_HASH_ALG_*
      value or HASH_ALGO_* value, at the caller's choice, rather than only a
      HASH_ALGO_* value as it did before.  This allows callers to work with
      the fsverity native algorithm numbers if they want to.  HASH_ALGO_* is
      what IMA uses, but other users (e.g. overlayfs) should use
      FS_VERITY_HASH_ALG_* to match fsverity-utils and the fsverity UAPI.
    
    - Make it return the digest size so that it doesn't need to be looked up
      separately.  Use the return value for this, since 0 works nicely for
      the "file doesn't have fsverity enabled" case.  This also makes it
      clear that no other errors are possible.
    
    - Rename the 'digest' parameter to 'raw_digest' and clearly document
      that it is only useful in combination with the algorithm ID.  This
      hopefully clears up a point of confusion.
    
    - Export it to modu...
    74836ecb
measure.c 3.22 KB