HomePhabricator

Make poly1305 support incremental computation + modernize

Description

Make poly1305 support incremental computation + modernize

Summary:

crypto: switch poly1305 to incremental implementation

This code is taken from poly1305-donna-32.h, poly1305-donna.h, poly1305-donna.c
from https://github.com/floodyberry/poly1305-donna, commit
e6ad6e091d30d7f4ec2d4f978be1fcfcbce72781, with the following modifications:

  • Coding style (braces around one-line indented if/for loops).
  • Rename unsigned long (long) to uint32_t and uint64_t.
  • Rename poly1305_block_size to POLY1305_BLOCK_SIZE.
  • Adding noexcept to functions.
  • Merging poly1305_state_internal_t and poly1305_context types.
  • Merging code from multiple files.
  • Place all imported code in the poly1305_donna namespace.

crypto: add Poly1305 class with std::byte Span interface

tests: add more Poly1305 test vectors

This is a partial backport of core#27993
https://github.com/bitcoin/bitcoin/pull/27993/commits/50269b391fa18556bad72dc8c2fb4e2493a6a054
https://github.com/bitcoin/bitcoin/pull/27993/commits/40e6c5b9fce92ffe64e91c2aba38bb2ed57bfbfb
https://github.com/bitcoin/bitcoin/pull/27993/commits/8871f7d1ae096839abcbf25a548319185acc01a2

Test Plan: ninja all check-all bench-bitcoin bitcoin-fuzzers

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D19015

Details

Provenance
Pieter Wuille <pieter@wuille.net>Authored on Jul 10 2023, 18:02
PiRKCommitted on Wed, Dec 3, 12:20
PiRKPushed on Wed, Dec 3, 12:20
Reviewer
Restricted Project
Differential Revision
D19015: Make poly1305 support incremental computation + modernize
Parents
rABC6d2396b14b92: Allow std::byte serialization
Branches
Unknown
Tags
Unknown