cloudflare / circl

CIRCL: Cloudflare Interoperable Reusable Cryptographic Library
http://blog.cloudflare.com/introducing-circl
Other
1.22k stars 136 forks source link

Export HPKE ciphersuite algorithms #422

Closed chris-wood closed 1 year ago

chris-wood commented 1 year ago

Callers construct a Suite from a (KEM, AEAD, KDF) tuple and use it for things like creating senders and receivers, but then they must still keep the tuple elements around if they want to get access to things like the KEM Scheme or the AEAD key size. It would be simpler if the caller could just hang onto a Suite value and then access the KEM, AEAD, and KDF values internally. So this change exports things to make that happen.

chris-wood commented 1 year ago

An alternative design would be to expose getters that return the internal values. That way they can't be modified with a reference to the struct itself. Would that work?

armfazh commented 1 year ago

An alternative design would be to expose getters that return the internal values. That way they can't be modified with a reference to the struct itself. Would that work?

Yes, a function similar to https://github.com/cloudflare/circl/blob/main/hpke/util.go#L71 ~but that returns the objects rather than the identifiers.~

Actually, that function already gives access to the KEM and KeySizes, right?

chris-wood commented 1 year ago

Indeed it does! I didn't know that function existed. Closing.