Giter VIP home page Giter VIP logo

p256's People

Contributors

0adb avatar oreparaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

p256's Issues

port test vectors from tests/nist_tests.txt into test_nist.cc

@0adb kindly added test/nist_tests.txt and test_nist.cc. We could add all tests from test/nist_tests.txt into test_nist.cc. I think today test_nist.cc runs 5 test vectors out of the 15 in test/nist_tests.txt.

This shouldn't be too hard and can be a good first issue to get started.

add support for windows

@0adb reported in #3 that p256 doesn't compile cleanly in Windows 10 using MinGW. I don't have access right now to a Windows box so maybe we can debug with them. @0adb: could you please check if setting this environment variable in powershell helps compiling in windows?

$Env:CC="gcc"

Also: since I essentially ripped off the project structure from @charlesnicholson 's embedded libraries, and they compile in Windows, maybe we can just use their make recipe (it is using MSVC instaead of MinGW, tho): https://github.com/charlesnicholson/nanocobs/blob/main/make-win.bat

add known answer tests

Coverage today is pretty minimal. We'd benefit from adding more known answer tests. Can steal the test vectors from other libraries or wycheproof.

The testing framework is already in place so this shouldn't take too long.

add support for signing operation

We could explore adding support for signing in a separate file like p256-sign.c if there's interest. Signature verification is usually more relevant than signing in embedded land, so I think this has low priority, but it could be handy to have in certain contexts.

I imagine that would require pulling ecdsa_i31_sign_raw.c and dependencies, such as DRBG + HMAC since BearSSL uses deterministic ECDSA as per RFC 6979. Validation for this operation is non-trivial.

rename symbols to a different namespace

This library today does zero work to have an exclusive namespace for C identifiers. This means that this lib exports a bunch of functions that could (in theory) collide with existing symbols (also taken from BearSSL). This isn't really a problem for the current use cases, but documenting it here nevertheless.

To fix that, we could:

  • static-ify stuff to restrict the scope to the translation unit
  • (crude) replace every occurrence of br_ into br_p256_ (and BR_ as well). Since BearSSL is very well written and has consistent naming, this can do the trick.

expose verification for ASN.1 signatures

BearSSL has br_ecdsa_i31_vrfy_asn1 so we should bubble this up in the future.

Useful comments from BearSSL:

  * The signature format is either "raw" or "asn1", depending on the
  * implementation; maximum length is predictable from the implemented
  * curve:
  *
  * | curve      | raw | asn1 |
  * | :--------- | --: | ---: |
  * | NIST P-256 |  64 |   72 |
  * | NIST P-384 |  96 |  104 |
  * | NIST P-521 | 132 |  139 |

add support for NIST P-384 and NIST P-521

We could easily add support for ECDSA over NIST P-384 (akan secp384r1) and the enormous curve NIST P-521 (secp521) since BearSSL supports them and we're already including the corresponding files in amalgamate.sh.

P-384 may be worth it since it seems supported by the yubikey's PIV applet.

We would need to write new functions similar to p256_verify, and think hard about a change to the projects name ๐Ÿค”. Probably worth distributing different files (e.g. p384.c and p521.c)?

measure stack usage

Would be nice to provide some specific memory usage figures (for example using some cortex)

add documentation for p256.h

Documentation is pretty minimal as of now.

  • The header file p256.h deserves some love
  • Documentation in the README.md on public key format can be improved

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.