Code Monkey home page Code Monkey logo

ed25519's People

Contributors

kostko avatar ryscheng-bot[bot] avatar yawning avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ed25519's Issues

Fold in more planned upstream changes

In keeping with the "drop-in replacement" design goal, there are additional forthcoming upstream changes that need to be folded in.

32670 includes the RFC 8422 check for contributory behavior. There's some dissenting opinions about how useful this is (See section 12 of the Noise protocol spec for one).

The second issue, despite it's title at the time of this writing, applies to doing the appropriate checks in the ed25519 code.

These should wait till the relevant changes are merged upstream, support for ed25519ctx/ph was merged early because we were thinking about using it.

ultra tiny nit: avoid using globals for testing

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 {

Add batch verification support for the RFC 8032 variants

Currently the batch verification only supports Ed25519pure. It would be good to support Ed25519ctx and Ed25519ph there as well. The code for doing so is trivial, writing test cases probably will take longer than implementing the variant support.

performance: Provide a fast `subtle.ConstantTimeCopy` alternative for more platforms

As the scalar basepoint multiply implementation is based around using a table that stores pre-computed results, a fast constant time copy is required for optimal performance.

The amd64 target has an optimized implementation written in assembly language.
All other platforms will use unsafe (falling back to subtle.ConstantTimeCopy) once #19 is merged, but could be improved further.

  • Merge #19.
  • Figure out which architectures are sufficiently indifferent to alignment such that the runtime library fallback never needs to be used.
  • Add assembly implementations for commonly used targets.

Build tags failing for Raspberry Pi.

Build tags do not seem to take into account for the Raspberry Pi. It runs on an ARM Cortex-A72 chip. Is this intended?

github.com/oasislabs/ed25519/internal/curve25519
../../go/pkg/mod/github.com/oasislabs/[email protected]/internal/curve25519/helpers.go:35:32: undefined: Bignum25519
../../go/pkg/mod/github.com/oasislabs/[email protected]/internal/curve25519/helpers.go:37:12: undefined: Bignum25519
../../go/pkg/mod/github.com/oasislabs/[email protected]/internal/curve25519/helpers.go:40:2: undefined: SquareTimes
../../go/pkg/mod/github.com/oasislabs/[email protected]/internal/curve25519/helpers.go:41:2: undefined: Mul
../../go/pkg/mod/github.com/oasislabs/[email protected]/internal/curve25519/helpers.go:42:2: undefined: SquareTimes
../../go/pkg/mod/github.com/oasislabs/[email protected]/internal/curve25519/helpers.go:43:2: undefined: Mul
../../go/pkg/mod/github.com/oasislabs/[email protected]/internal/curve25519/helpers.go:44:2: undefined: SquareTimes
../../go/pkg/mod/github.com/oasislabs/[email protected]/internal/curve25519/helpers.go:45:2: undefined: Mul
../../go/pkg/mod/github.com/oasislabs/[email protected]/internal/curve25519/helpers.go:57:20: undefined: Bignum25519
../../go/pkg/mod/github.com/oasislabs/[email protected]/internal/curve25519/helpers.go:73:31: undefined: Bignum25519
../../go/pkg/mod/github.com/oasislabs/[email protected]/internal/curve25519/helpers.go:45:2: too many errors

Change the code when the `math/bits` dust settles

Note: Low priority since the one architecture that actually matters to the vast majority of people, has appropriate intrinsics, so the unsafe behavior of the fallback code never comes into play.

When the Go math/bits issues get resolved (one way or another, though I'm of the opinion that the functions should be constant time, with explicitly vartime alternatives provided separately), change the implementation to enable the 64 bit code path on more architectures.

See:

Possibility of an infinite loop with small scalar value in function `multiScalarmultVartimeFinal`

Description of the bug
Possibility of an infinite loop with small scalar value in function multiScalarmultVartimeFinal. It seems we should be skipping zero values and not non-zero values. At https://github.com/oasislabs/ed25519/blob/a426dcc8ad5f012f981f4acce812b0c7c1b7b625/batch_verify.go#L185

The topbit finding algorithm at L189 loops infinitely as a consequence.

Additional information
This was found on a deployed testnet in our testing environment.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.