Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://github.com/mupq/pqm4
10 May 2025, 10:33:09 UTC
  • Code
  • Branches (22)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/aimer
    • refs/heads/benchmarkupdate
    • refs/heads/biscuit
    • refs/heads/dependabot/submodules/libopencm3-201f5bc
    • refs/heads/efm32gg11b
    • refs/heads/faster-ml-dsa
    • refs/heads/gcc14.2
    • refs/heads/github-actions-test
    • refs/heads/haetae-fix
    • refs/heads/master
    • refs/heads/meds
    • refs/heads/mirith
    • refs/heads/mkannwischer-patch-1
    • refs/heads/openocdtcp
    • refs/heads/outoftree
    • refs/heads/remove-broken-symlinks
    • refs/heads/tuov
    • refs/remotes/amin/kyberintt
    • refs/tags/Round1
    • refs/tags/Round2
    • refs/tags/Round3
    • refs/tags/SignatureRound1
    No releases to show
  • 33ab8e5
  • /
  • interface.py
Raw File Download
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge Iframe embedding
swh:1:cnt:2b386caf512f8c2b8cc390c29203cfc0edb861c0
origin badgedirectory badge Iframe embedding
swh:1:dir:33ab8e503e3635e6bfeb1002a64c532663ddb798
origin badgerevision badge
swh:1:rev:1ccd61fa77f685dd28eec12e57c5ae4d39be8135
origin badgesnapshot badge
swh:1:snp:c3779d97ae012ee873130885d83d6a9b0a887640
Citations

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Tip revision: 1ccd61fa77f685dd28eec12e57c5ae4d39be8135 authored by Richard Petri on 19 January 2024, 13:42:57 UTC
Exclude tuov from builds
Tip revision: 1ccd61f
interface.py
import argparse

from mupq import mupq
from mupq import platforms


def parse_arguments():
    parser = argparse.ArgumentParser(description="PQM4 Specific Settings")
    parser.add_argument(
        "-p",
        "--platform",
        help="The PQM4 platform",
        choices=["stm32f4discovery", "nucleo-l476rg", "nucleo-l4r5zi", "cw308t-stm32f3", "cw308t-stm32f415", "mps2-an386"],
        default="stm32f4discovery",
    )
    parser.add_argument(
        "-o",
        "--opt",
        help="Optimization flags",
        choices=["speed", "size", "debug"],
        default="speed",
    )
    parser.add_argument(
        "-l", "--lto", help="Enable LTO flags", default=False, action="store_true"
    )
    parser.add_argument(
        "--no-aio", help="Disable all-in-one compilation", default=False, action="store_true"
    )
    parser.add_argument("-u", "--uart", default="/dev/ttyUSB0", help="Path to UART output")
    parser.add_argument("-i", "--iterations", type=int, default=1, help="Number of iterations for benchmarks")
    return parser.parse_known_args()


def get_platform(args):
    platform = None
    bin_type = 'bin'
    if args.platform in ['stm32f4discovery', 'nucleo-l476rg']:
        platform = platforms.StLink(args.uart)
    elif args.platform == "nucleo-l4r5zi":
        bin_type = 'hex'
        platform = platforms.OpenOCD("st_nucleo_l4r5.cfg", args.uart)
    elif args.platform in ["cw308t-stm32f3", "cw308t-stm32f415"]:
        bin_type = 'hex'
        platform = platforms.ChipWhisperer()
    elif args.platform == 'mps2-an386':
        bin_type = 'bin'
        platform = platforms.Qemu('qemu-system-arm', 'mps2-an386')
    else:
        raise NotImplementedError("Unsupported Platform")
    settings = M4Settings(args.platform, args.opt, args.lto, not args.no_aio, args.iterations, bin_type)
    return platform, settings


class M4Settings(mupq.PlatformSettings):
    #: Specify folders to include
    scheme_folders = [  # mupq.PlatformSettings.scheme_folders + [
        ("pqm4", "crypto_kem", ""),
        ("pqm4", "crypto_sign", ""),
        ("mupq", "mupq/crypto_kem", ""),
        ("mupq", "mupq/crypto_sign", ""),
        ("pqclean", "mupq/pqclean/crypto_kem", "PQCLEAN"),
        ("pqclean", "mupq/pqclean/crypto_sign", "PQCLEAN"),
    ]

    platform_memory = {
        'stm32f4discovery': 128*1024,
        'nucleo-l476rg': 128*1024,
        'cw308t-stm32f3': 64*1024,
        'cw308t-stm32f415': 192*1024,
        'mps2-an386': 4096*1024,
        'nucleo-l4r5zi': 640*1024
    }

    def __init__(self, platform, opt="speed", lto=False, aio=False, iterations=1, binary_type='bin'):
        """Initialize with a specific platform"""
        import skiplist
        self.skip_list = []
        for impl in skiplist.skip_list:
            if impl['estmemory'] > self.platform_memory[platform]:
                impl = impl.copy()
                del impl['estmemory']
                self.skip_list.append(impl)
        self.skip_list.append({'implementation': 'vec'})
        self.binary_type = binary_type
        optflags = {"speed": [], "size": ["OPT_SIZE=1"], "debug": ["DEBUG=1"]}
        if opt not in optflags:
            raise ValueError(f"Optimization flag should be in {list(optflags.keys())}")
        super(M4Settings, self).__init__()
        self.makeflags = [f"PLATFORM={platform}"]
        self.makeflags += [f"MUPQ_ITERATIONS={iterations}"]
        self.makeflags += optflags[opt]
        self.iterations = iterations
        if lto:
            self.makeflags += ["LTO=1"]
        else:
            self.makeflags += ["LTO="]
        if aio:
            self.makeflags += ["AIO=1"]
        else:
            self.makeflags += ["AIO="]

Software Heritage — Copyright (C) 2015–2025, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Contact— JavaScript license information— Web API

back to top