GithubHelp home page GithubHelp logo

NIST P256 Point Encode/Decode about kyber HOT 5 CLOSED

dedis avatar dedis commented on August 18, 2024
NIST P256 Point Encode/Decode

from kyber.

Comments (5)

bford avatar bford commented on August 18, 2024

Uh oh! Not good, thanks for finding; obviously that's another test we should have had in test.testGroup() - can you add one, verify that the problem only crops up with the NIST suite, and (obviously) verify whether it's Go's fault or ours? (My quick look at the code seems to confirm what you're seeing; I don't see how that would be happening in our code.)

from kyber.

jackowitz avatar jackowitz commented on August 18, 2024

I only found it after adding test cases to test.testGroup. NIST is the only suite that has failed. Can confirm that it's in Go - elliptic.Marshall uses big.Int.SetBytes which interprets the slice as an unsigned value (see https://golang.org/pkg/math/big/#Int.SetBytes). Whether that's the proper behavior or a bug in Go...

from kyber.

bford avatar bford commented on August 18, 2024

Ah, wait - I'm guessing it's probably our (my) fault. Go's elliptic routines probably assume that coordinates are never "negative" at least as seen by the big.Int package, and that's probably a reasonable assumption given that the arithmetic is all supposed to be modulo a big prime. What might be going on is that we're mistakenly causing a y-coordinate to be "negative" as a big.Int for some reason. I don't offhand see what would do that, as for example the Neg() function uses a pretty brain-damaged method of getting the inverse of a point but even that brain-damaged method shouldn't produce a literally negative big.Int y-coordinate as far as I can see.

from kyber.

bford avatar bford commented on August 18, 2024

Aha - oops, looks like genPoint might. Does the y.Neg(y) need to be changed to y.Neg(y).Mod(y, p.c.p.P)?

B

from kyber.

bford avatar bford commented on August 18, 2024

Or more efficiently, perhaps y.Sub(p.c.p.P, y)?

from kyber.

Related Issues (20)

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.