cloudflare / circl

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

cipher/ascon: go routine safe? #415

Closed enj closed 1 year ago

enj commented 1 year ago

A quick peak at the ascon implementation suggests that the cipher is unsafe to use across go routines:

https://github.com/cloudflare/circl/blob/278354d01755a901d6629247e464265218d9d120/cipher/ascon/ascon.go#L178

I believe the general intent is for a cipher.AEAD to be safely reusable across go routines to avoid the setup cost.

Either way, it would be good to at least document.

bwesterb commented 1 year ago

In general AEADs don't have to be thread safe, cf https://github.com/golang/go/issues/41689