scalar: refactor: use secp256k1_{read,write}_be32 helpers #1339

pull theStack wants to merge 2 commits into bitcoin-core:master from theStack:scalar_use_read_write_be32_helpers changing 2 files +24 −24
  1. theStack commented at 6:45 pm on June 10, 2023: contributor

    This refactoring PR takes use of the secp256k1_{read,write}_be32 helpers (introduced in PR #1093, commit 8d89b9e6e562000cdb91a70a85fae5e4817cec8a) in the scalar <-> byte array conversion functions, for both the 8x32 and 4x64 implementations. (An alternative for the latter would be to introduce special helpers for reading/writing uint64_t in big endian secp256k1_{read,write}_be64).

    Verified via objdump -D libsecp256k1.a that secp256k1_scalar_set_b32 for 4x64 compiles to the same code on master and the PR (secp256k1_scalar_get_b32 is apparently always inlined) on amd64 with clang 13.0.0.

  2. scalar: use `secp256k1_{read,write}_be32` helpers (8x32 impl.) 52b84238de
  3. scalar: use `secp256k1_{read,write}_be32` helpers (4x64 impl.)
    An alternative would be to introduce special helpers for reading/writing
    uint64_t in big endian `secp256k1_{read,write}_be64`.
    887183e7de
  4. real-or-random approved
  5. real-or-random commented at 10:47 am on June 11, 2023: contributor
    utACK 52b84238de27889f2517c845757bf5c2c65ed1d6
  6. real-or-random added the label refactor on Jun 11, 2023
  7. sipa commented at 2:53 pm on June 12, 2023: contributor

    utACK 887183e7de4d1941792d78471a3adb004fd4ec8e

    As a follow-up, it may make sense to consider adding secp256k1_{read,write}_be64 functions too.

  8. real-or-random merged this on Jun 12, 2023
  9. real-or-random closed this on Jun 12, 2023

  10. theStack deleted the branch on Jun 12, 2023
  11. theStack cross-referenced this on Jun 17, 2023 from issue scalar: introduce and use `secp256k1_{read,write}_be64` helpers by theStack
  12. real-or-random referenced this in commit 45c5ca7675 on Jun 18, 2023
  13. sipa referenced this in commit 901336eee7 on Jun 21, 2023
  14. vmta referenced this in commit 8f03457eed on Jul 1, 2023
  15. hebasto referenced this in commit 270d2b37b8 on Jul 21, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/secp256k1. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-30 09:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me