Skip to content
This repository has been archived by the owner on May 5, 2021. It is now read-only.

ultra tiny nit: avoid using globals for testing #26

Open
bennetyee opened this issue Nov 3, 2020 · 0 comments
Open

ultra tiny nit: avoid using globals for testing #26

bennetyee opened this issue Nov 3, 2020 · 0 comments

Comments

@bennetyee
Copy link

communicating through a global for testing is a little ugly. consider something like:

func isNeutralVartime(p *ge25519.Ge25519) bool {
  return isNeutralVartimeTestInterface(p, nil)
}
func isNeutralVartimeTestInterface(p *ge25519.Ge25519, saveBatchY []byte) bool {
  if saveBatchY != nil {
    curve25519.Contract(saveBatchY, p.Y())
  }
  ...
}

which should, if go compilers ever get that level of optimization, allow generation of an if saveBatchY-free version of the code for callsites where the isNeutralVartime is used. also, if golang testing ever changes to allow running tests concurrently (seems unlikely), this eliminates the potential debt.

if testBatchSaveY {

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant