openssl / openssl/openssl

Simplify bn_mont.c

Open
#21,351 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triaged: feature triaged: performance
Dominant language
C
Stars
30.8k
Forks
11.5k
Avg merge
10m
Merged PRs (30d)
1

Description

Grepping seems to suggest we never undefine MONT_WORD in the Configuration system. In that case not only do we have ample amounts of dead code to remove, but can shrink the montgomery context structure by storing merely mu, N, and RR. (I'm not quite sure if ri is what it is claimed to be in the comment: it doesn't look it)

More generally I think the arithmetic might need to be reevaluated for a 2020's range of used architectures and compilers: quite a bit of implementation complexity could be removed, but I've only taken a cursory look so far.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in bn_mont.c and inspect the Configuration system for any paths that undefine MONT_WORD, then trace the Montgomery context fields and the comments about ri. Done is not yet narrowly defined: the issue suggests removing dead code and simplifying the context, while the broader arithmetic reevaluation needs a concrete scope before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cryptography
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.