In libgcrypt 1.10, there are no AEAD available when FIPS mode.
It's good if we can improve this situation.
In SP 800-38D, there is a chapter "8 Uniqueness Requirement on IVs and Keys ".
It says:
The probability that the authenticated encryption function ever will be invoked with the same IV and the same key on two (or more) distinct sets of input data shall be no greater than 2^-32.
To conform this, I think that we need a set of API for encryption which does:
- accepts an argument (or more) to specify salt/seed/additional data to open
- generates key and iv internally, on each invocation of encrypt, updating and returning a counter, key, iv, encrypted result, and tag
- or offers routines
- feeds a part of chunk to the encryption engine, possibly, per chunk additional data
- accesses counter, key and iv
- finishes one chunk
- accesses encrypted data, and tag
- or offers routines
- close and get the final tag
This makes auditor happy, because the library can ensure the condition of (key, iv).
Users will be happy, too, if the set of API is good enough for their use cases, because they can rely on the library for correctness (despite giving up more detailed control).
Questions here are:
- there are multiple practices for methods
- to generate initial key and iv
- HKDF (TLS 1.3)
- HASH (SSH)
- hash algo should be selected for key size or not
- to update following iv-s
- RFC5116: random part + counter (start from zero)
- TLS 1.3: random part XORed counter (start from zero)
- SSH: random, incrementing lower octets only (not whole iv)
- to generate initial key and iv
- Is it OK for library users to have no flexibility but only selecting from existing methods?