{"id":23451426,"url":"https://github.com/coloquinte/moosic-yosys-plugin","last_synced_at":"2025-04-13T20:36:01.913Z","repository":{"id":180407177,"uuid":"663065366","full_name":"Coloquinte/moosic-yosys-plugin","owner":"Coloquinte","description":"Yosys plugin for logic locking and supply-chain security","archived":false,"fork":false,"pushed_at":"2024-07-16T14:51:15.000Z","size":322,"stargazers_count":21,"open_issues_count":3,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-12-20T23:14:19.161Z","etag":null,"topics":["hardware","hardware-security","logic-locking","security","supply-chain-security"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Coloquinte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-06T13:29:44.000Z","updated_at":"2024-11-12T18:12:19.000Z","dependencies_parsed_at":"2023-11-22T22:28:56.718Z","dependency_job_id":"7feea68b-7702-4417-b96d-f4f3ff6782ff","html_url":"https://github.com/Coloquinte/moosic-yosys-plugin","commit_stats":null,"previous_names":["coloquinte/moosic-yosys-plugin"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coloquinte%2Fmoosic-yosys-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coloquinte%2Fmoosic-yosys-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coloquinte%2Fmoosic-yosys-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Coloquinte%2Fmoosic-yosys-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Coloquinte","download_url":"https://codeload.github.com/Coloquinte/moosic-yosys-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231033465,"owners_count":18317982,"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","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":["hardware","hardware-security","logic-locking","security","supply-chain-security"],"created_at":"2024-12-24T00:25:59.838Z","updated_at":"2024-12-24T00:26:00.307Z","avatar_url":"https://github.com/Coloquinte.png","language":"C++","readme":"[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10391922.svg)](https://doi.org/10.5281/zenodo.10391922)\n![Tests](https://github.com/Coloquinte/moosic-yosys-plugin/actions/workflows/build.yml/badge.svg)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/d3249b89df3247dbbf7b6066c0c66a2f)](https://app.codacy.com/gh/Coloquinte/moosic-yosys-plugin/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade)\n[![GitHub](https://img.shields.io/github/license/coloquinte/moosic-yosys-plugin?color=blue)](https://opensource.org/licenses/gpl-2.0)\n\n# Logic Locking for Yosys\n\n\n## Description\n\nWhen creating an electronic circuit, manufacturing steps are usually performed by third-party actors. In order to build confidence that the circuit built is not tempered with and is not used by third-parties, a variety of methods have been devised. A common approach, *logic locking*, is to introduce additional logic that requires the correct key to function as designed.\n\nThis mangling makes it more difficult to reverse-engineer the circuit, to add trojans, or simply to reuse without the correct key.\n\nThis repository provides a Yosys plugin to add logic locking functionality to a circuit and perform security analysis.\n\n[Slides](https://wiki.f-si.org/images/5/5c/Gabriel_Gouvine_MOOSIC_FSiC_2023.pdf) and [Video](https://peertube.f-si.org/videos/watch/7f250190-6d8f-4a67-8ed6-d07deda7fba0) from [Free Silicon Conference 2023](https://wiki.f-si.org/index.php/FSiC2023)\n\n\n## Logic locking in a nutshell\n\n![My Image](doc/XOR_NXOR_insertion.svg)\n\nThe most common technique for logic locking is to insert XOR/NXOR gates on some wires of the design, such that an extra input with the correct value is required for them to act as a (buffered) wire again.\nThis value is 1 for NXOR and 0 for XOR.\nThe key needs to be supplied as an input to unlock the circuit.\nThis is the method used by the plugin.\n\n![My Image](doc/MUX_insertion.svg)\n\nAny gate that keeps the previous functionality could be inserted.\nFor example, we can mix signals using multiplexers. A MUX is inserted on a wire with an irrelevant signal connected to the other input of the MUX. In this case, the key value selects between the correct signal and the irrelevant one.\nAnother possibility is to replace gates with lookup-tables, which will have to be programmed correctly.\n\nSeveral attacks have been designed against logic locking.\nThis plugin provides countermeasures against common attacks based on Sat solvers.\n\nKey handling (getting the key onto the chip) is highly application-specific and is left to the user.\n\n## Using the plugin\n\nThe plugin defines a new `logic_locking` command. To run Yosys with the plugin:\n\n```sh\nyosys -m moosic\n```\n\nAnd in Yosys:\n\n```sh\n# First synthetize and flatten our design; hierarchical designs are not supported\nsynth; flatten\n\n# Look at the command documentation\nhelp logic_locking\n\n# Add logic locking with a 16b key, with hexadecimal key 048c\nlogic_locking -nb-locked 16 -key 048c\n\n# Add logic locking up to 5% of the module size, maximizing output corruption, with an auto-generated key\nlogic_locking -nb-locked 5% -target corruption\n\n# Check if the key can be recovered by a Sat attack after locking\nll_sat_attack -key 048c\n```\n\nA new port is created on the selected module, named `moosic_key` by default.\nThe module will work as designed only when the correct key is provided as an input.\n\n## Installation instructions\n\nTo install this plugin\n-   Install [Yosys](https://github.com/YosysHQ/yosys) from source or from [oss-cad-suite](https://github.com/YosysHQ/oss-cad-suite-build) (a recent version is required).\n-   Build and install:\n\n```sh\nmake\nsudo make install\n```\n\n\n## Design space exploration\n\nMoosic allows you to explore the tradeoffs between performance and security.\nThis will suggest many possible solutions with different tradeoffs (a Pareto front).\nIt is up to you to pick one that works best for your usecase.\n\n```sh\n# Run design space exploration on area, delay and corruption\n# Export solution identifiers and results to explore.csv\nll_explore -area -delay -corruption -output explore.csv\n\n# Show the gates that will be locked by a solution\nll_show -locking 38b0e\n\n# Compute more information (area, delay, security, ...) on a solution\nll_analyze -locking 38b0e\n\n# Apply a locking solution returned by design space exploration\n# Modify the design, adding a key input port and key gates\nll_apply -locking 38b0e -key 048\n```\n\n\n## Questions\n\nYou can ask any question you have on the [Matrix channel](https://app.element.io/#/room/#moosic-yosys-plugin:matrix.org). Don't hesitate to file an issue if you find a bug.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoloquinte%2Fmoosic-yosys-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoloquinte%2Fmoosic-yosys-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoloquinte%2Fmoosic-yosys-plugin/lists"}