Giter VIP home page Giter VIP logo

xsig's People

Stargazers

 avatar  avatar

Watchers

 avatar

xsig's Issues

feat: consider switching signature format from ASN.1 to raw

Today we are encoding ECDSA signatures in ASN.1 DER format. This is pretty much the standard. However, signature size in this format isn't constant. Although signature max size is 72 bytes for P-256, there are valid signatures that encode to shorter byte sequence.

The price we pay for convenience (using a standardized format) is complexity: PopSignature needs to do some minimal ASN.1 parsing. While this seems fine today in the current implementation, in other languages might get trickier. We might want to revisit this and move to a "raw" format: concatenate (r,s) and encode each integer as fixed-size, 0-padded, big-endian byte sequence.

There's also not a strong binding between signature scheme (ECDSA over P-256 w/SHA-256) and public keys; this binding is implicit via MachineType so any change to signature scheme / representation needs a bump in MachineType.

minimal model checking for small scripts

we can do poor man's "model checking" by plugging a fuzzer under the following constraints:

  • fix a small, concretexpublickey
  • stub out all the crypto

and let the fuzzer try to find a bad input that shouldn't make verification pass.

add prefix for `xpublickey` scripts

We probably want a crude mechanism to assert the xpublickey script is well formed (or at least, it hasn't been blatantly corrupted). Potential ideas:

  • add a short prefix to every xpublickey
  • add a short integrity check value (CRC or truncated hash) to make sure the xpublickey is valid.

I'm a bit torn to include this kind of code and wondering if it should live elsewhere, but the failure mode is so catastrophic that I'm inclined for xsig to do some minimal sanity check on xpublickey.

opcode: implement some read/write state ops

related to #21, probably would be good to introduce some operations to read/write some state to store:

  • anti-replay counters
  • generation/epoch counters
  • (maybe) hash of some state

We should have a clear, concrete use case before implementing a generic interface (that might be overkill). Priority should be to get it as simple as possible to make analysis easy.

Some primitive to provide access to NVRAM in some HSMs.

write a C interpreter

Once machine001 is stable and we collect enough test vectors, write an embedded C interpreter.

opcode: implement per-device serial number

something that allows for example per-device signing. We should probably settle on "long" device ID (say, 128 bits) and then allow for specific implementations to choose the numbering scheme (sequential, random, structured)

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.