circl icon indicating copy to clipboard operation
circl copied to clipboard

Implement MAYO

Open ilway25 opened this issue 1 year ago • 6 comments

We chose to implement the newer version of MAYO proposed by the authors instead of the one submitted to NIST.

The authors proposed the change to the spec here: "Nibbling MAYO: Optimized Implementations for AVX2 and Cortex-M4" by Ward Beullens, Fabio Campos, Sofía Celi, Basil Hess, Matthias J. Kannwischer.

This pure Go code is written based on the tricks described in that paper and in their reference C code, specifically the nibbling-mayo branch.

It also passes the KAT tests.

Closes https://github.com/cloudflare/circl/issues/482

ilway25 avatar Feb 29 '24 07:02 ilway25

Thank you for this. I will review over the coming days.

bwesterb avatar Feb 29 '24 08:02 bwesterb

This is only a partial review. There is a lot to like in here, but it still needs work to be easier to review: you need to explain how things are encoded, computed, etc.

Also, did you implement this from scratch or did you translate an existing implementation?

Thanks for pointing out things to consider. No, it is not written not from scratch. The code basically follows the thought process of the reference code.

ilway25 avatar Mar 05 '24 06:03 ilway25

Thanks for pointing out things to consider. No, it is not written not from scratch. The code basically follows the thought process of the reference code.

You should add a comment acknowledging on which code you've based yours, and mention its license (and make sure it's compatible with Circl's license.)

bwesterb avatar Mar 11 '24 07:03 bwesterb

Thanks for pointing out things to consider. No, it is not written not from scratch. The code basically follows the thought process of the reference code.

You should add a comment acknowledging on which code you've based yours, and mention its license (and make sure it's compatible with Circl's license.)

about the licensing, I think it suffices to add a line in the gen.go file something such as:

This implementation is a port from the C implementation of MAYO [link} distributed under <LICENSE>.

and there is no need to include the NOTICE and LICENSE files.

armfazh avatar Mar 15 '24 02:03 armfazh

@ilway25 Thank you so much for the quick changes on our preliminary review. I'll be travelling for another week. After that I'll sit down and continue the review. Thanks again.

bwesterb avatar Mar 24 '24 18:03 bwesterb

The code improved a lot. Still it needs better documentation on the actual arithmetic to make review easier.

bwesterb avatar Apr 15 '24 15:04 bwesterb