{"id":16358201,"url":"https://github.com/newam/p256-cm4","last_synced_at":"2025-12-23T22:30:17.555Z","repository":{"id":50594488,"uuid":"519338367","full_name":"newAM/p256-cm4","owner":"newAM","description":"A rust re-implementation of Emill/P256-Cortex-M4","archived":false,"fork":false,"pushed_at":"2025-11-23T22:55:18.000Z","size":120,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-24T00:09:42.778Z","etag":null,"topics":["cryptography","embedded","p256","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/newAM.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-07-29T20:11:59.000Z","updated_at":"2025-11-23T22:55:20.000Z","dependencies_parsed_at":"2024-11-07T20:47:57.742Z","dependency_job_id":"0cf075dc-a0f0-4eb8-9f3d-8a682d749e9c","html_url":"https://github.com/newAM/p256-cm4","commit_stats":{"total_commits":17,"total_committers":2,"mean_commits":8.5,"dds":"0.17647058823529416","last_synced_commit":"9623b152893ccde9606fa9e4cbf7d4b37f1d0f69"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/newAM/p256-cm4","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newAM%2Fp256-cm4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newAM%2Fp256-cm4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newAM%2Fp256-cm4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newAM%2Fp256-cm4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/newAM","download_url":"https://codeload.github.com/newAM/p256-cm4/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newAM%2Fp256-cm4/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27987891,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-23T02:00:07.087Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptography","embedded","p256","rust"],"created_at":"2024-10-11T02:05:03.972Z","updated_at":"2025-12-23T22:30:17.549Z","avatar_url":"https://github.com/newAM.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# P256-CM4\n\n[![CI](https://github.com/newAM/p256-cm4/workflows/CI/badge.svg)](https://github.com/newAM/p256-cm4/actions)\n[![crates.io](https://img.shields.io/crates/v/p256-cm4.svg)](https://crates.io/crates/p256-cm4)\n[![docs](https://docs.rs/p256-cm4/badge.svg)](https://docs.rs/p256-cm4)\n\nA (mostly) rust re-implementation of [Emill/P256-Cortex-M4].\n\nRust 1.88.0 stabilized the [naked_asm] macro which allows for this to be compiled without any additional tooling.  No `build.rs` script or external assembler required.\n\n## Limitations\n\nThis is not yet complete, it lacks interoperability with other targets (via RustCrypto traits or compile-time switches).  See [ycrypto/p256-cortex-m4] for an interoperable solution.\n\nThis lacks the configurability of the original source because rust features are less powerful than C pre-processor macros.  Use [ycrypto/p256-cortex-m4-sys] if you require configurability.\n\n## Comparisons\n\nAs measured on a STM32WLE5.\n\n| Implementation | Signing Cycles (appx) | Verify Cycles (appx) | Flash Size (appx) |\n|----------------|-----------------------|----------------------|-------------------|\n| Hardware PKA   |             5,211,859 |           10,516,860 |           1,582 B |\n| [RustCrypto]   |             7,856,436 |           14,303,277 |            49 kiB |\n| `p256-cm4`     |               442,754 |            1,225,746 |            10 kiB |\n\n## Maintainers Notes\n\n### Using VSCode with `rust-analyzer` in a multi-target workspace\n\nSince `qemu-decode` requires `std`, compiling it for `thumbv7em-none-eabi` spits out a lot of errors which massively slows down `rust-analyzer` if you\ntry to change the compilation target for `p256-cm4` and `testsuite`.\n\nBy default, VSCode configures `rust-analyzer` to run `cargo` on the entire workspace. However, to prevent `rust-analyzer` from trying to compile packages\nfor targets they are not intended to compile for, you can open an individual project (e.g. `code p256-cm4/` or `code testsuite/`) and set\nthe following settings in your `.vscode/config.json`:\n\n```json\n{\n    \"rust-analyzer.check.workspace\": false,\n    \"rust-analyzer.cargo.target\": \"thumbv7em-none-eabi\"\n}\n```\n\n### Testing\n\nInstall [qemu-system-arm] (tested to work with `qemu-system-arm 8.2.2`).\n\n```bash\nDEFMT_LOG=trace cargo test -p testsuite --target thumbv7em-none-eabi\n```\n\n### Testing on real hardware\n\n1. Install a debugger (we recommend [probe-rs-tools])\n2. Update `memory.x` to match your target device\n3. Update the runner in `.cargo/config.toml`\n4. Run the command from the [Testing](#testing) section.\n\nUsually, you'll want rtt logs instead of semihosting logs when running on real hardware. To get those, you can enable the `rtt` feature.\n\nAn example change, when running on an `STM32H723ZGTx`:\n\n`.cargo/config.toml`:\n```diff\n[target.thumbv7em-none-eabi]\n-runner = \"cargo run -p qemu-decode --\"\n+runner = \"probe-rs run --chip STM32H723ZGTx\"\n```\n\n`memory.x`:\n```diff\n-/* Memory for the LM3S6965EVB */\n+/* Memory for STM32H723ZGTx (running from RAM) */\nMEMORY\n{\n-  FLASH : ORIGIN = 0x00000000, LENGTH = 256k\n-  RAM : ORIGIN = 0x20000000, LENGTH = 64k\n+  DTCM    : ORIGIN = 0x20000000, LENGTH = 128K\n+  AXISRAM : ORIGIN = 0x24000000, LENGTH = 128K + 192K\n}\n+# Region alias to run from RAM\n+REGION_ALIAS(FLASH, AXISRAM);\n+REGION_ALIAS(RAM,   DTCM);\n```\n\nCommand:\n```bash\nDEFMT_LOG=trace cargo test -p testsuite --target thumbv7em-none-eabi --features rtt\n```\n\n[probe-rs-tools]: https://probe.rs/docs/getting-started/installation/\n[Emill/P256-Cortex-M4]: https://github.com/Emill/P256-Cortex-M4\n[naked_asm]: https://doc.rust-lang.org/core/arch/macro.naked_asm.html\n[ycrypto/p256-cortex-m4]: https://github.com/ycrypto/p256-cortex-m4\n[ycrypto/p256-cortex-m4-sys]: https://github.com/ycrypto/p256-cortex-m4-sys\n[RustCrypto]: https://github.com/RustCrypto/elliptic-curves\n[qemu-system-arm]: https://www.qemu.org/docs/master/system/target-arm.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnewam%2Fp256-cm4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnewam%2Fp256-cm4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnewam%2Fp256-cm4/lists"}