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. real-or-random referenced this in commit 45c5ca7675 on Jun 18, 2023
  12. sipa referenced this in commit 901336eee7 on Jun 21, 2023
  13. vmta referenced this in commit 8f03457eed on Jul 1, 2023
  14. hebasto referenced this in commit 270d2b37b8 on Jul 21, 2023
  15. delta1 referenced this in commit 3f32c20932 on Aug 8, 2023
  16. delta1 referenced this in commit 31ac0c1081 on Aug 31, 2023
  17. janus referenced this in commit c4348d88db on Sep 11, 2023
  18. div72 referenced this in commit af627d47c3 on Apr 12, 2025
  19. str4d referenced this in commit 5a6bf5f178 on Jun 4, 2025

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: 2026-05-19 06:52 UTC