symbolicsoft / kyber-k2so Goto Github PK
View Code? Open in Web Editor NEWGo implementation of the Kyber (version 3) post-quantum IND-CCA2 KEM.
Home Page: https://pq-crystals.org/kyber/
License: MIT License
Go implementation of the Kyber (version 3) post-quantum IND-CCA2 KEM.
Home Page: https://pq-crystals.org/kyber/
License: MIT License
Hey. I'm noticing some behaviour that might not be intended, or at least it is undocumented.
In the code at: https://github.com/symbolicsoft/kyber-k2so/blob/master/indcpa.go#L165
publicSeed, noiseSeed := buf[:paramsSymBytes], buf[paramsSymBytes:]
a, err := indcpaGenMatrix(publicSeed, false, paramsK)
After running indcpaGenMatrix
, noiseSeed
changes its first two bytes.
Is this the intended behaviour?
I replicate this deterministically by disabling any random sampling in the code.
This bit of code is used in compressing a polynomial ring element into a (secret) message:
Line 127 in ffaf2ee
To do so, it performs a division by Q that might not necessarily compile to a multiplication instruction: looking at the output of some C compilers using https://godbolt.org/z/sKn3TKKGq and https://godbolt.org/z/8GqKoTfYh for example, a division instruction is emitted even when -O3 is specified. Should a division instruction be emitted, its execution time would likely be variable and leak information about its secret input.
We reported a similar issue in the CRYSTALS-Kyber reference implementation; you may want to use their fix: pq-crystals/kyber@dda29cc
func KemEncrypt(publicKey [paramsPublicKeyBytes]byte) ([paramsIndcpaBytes]byte, [paramsSymBytes]byte, error) {
There's no way for anyone to use this API for real, because the array sizes cannot be referenced outside this package.
Try to move your tests from package kyberk2so
to package kyberk2so_test
to feel the pain yourself.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.