Skip to content

Commit

Permalink
To squash new metadata: firmware_url, licence, ...
Browse files Browse the repository at this point in the history
  • Loading branch information
kralka committed Jan 6, 2022
1 parent c473069 commit d17c4a8
Showing 1 changed file with 39 additions and 22 deletions.
61 changes: 39 additions & 22 deletions scaaml/capture/aes/aes_capture.py
Expand Up @@ -11,27 +11,31 @@
from scaaml.capture.aes.scope import SScope


def capture_aes_dataset(firmware_sha256: str,
architecture: str,
implementation: str,
shortname: str,
description: str,
capture_info: Dict,
crypto_implementation=AESSBOX,
algorithm: str = 'simpleserial-aes',
version: int = 1,
root_path: str = '/mnt/storage/chipwhisperer',
url: str = '',
examples_per_shard: int = 64,
measurements_info=None,
repetitions: int = 1,
chip_id: int = 164019,
test_keys: int = 1024,
test_plaintexts: int = 256,
train_keys: int = 3 * 1024,
train_plaintexts: int = 256,
holdout_keys: int = 0 * 1024,
holdout_plaintexts: int = 1):
def capture_aes_dataset(
firmware_sha256: str,
architecture: str,
implementation: str,
shortname: str,
description: str,
capture_info: Dict,
crypto_implementation=AESSBOX,
algorithm: str = 'simpleserial-aes',
version: int = 1,
root_path: str = '/mnt/storage/chipwhisperer',
url: str = '',
firmware_url: str = '',
paper_url: str = '',
licence: str = "https://creativecommons.org/licenses/by/4.0/",
examples_per_shard: int = 64,
measurements_info=None,
repetitions: int = 1,
chip_id: int = 164019,
test_keys: int = 1024,
test_plaintexts: int = 256,
train_keys: int = 3 * 1024,
train_plaintexts: int = 256,
holdout_keys: int = 0 * 1024,
holdout_plaintexts: int = 1) -> None:
"""Capture or continue capturing the dataset.
Args:
Expand All @@ -54,7 +58,10 @@ def capture_aes_dataset(firmware_sha256: str,
algorithm: Algorithm name.
version: Version of this dataset.
root_path: Folder in which the dataset will be stored.
url: URL containing this dataset.
url: Where to download this dataset.
firmware_url: Where to dowload the firmware used while capture.
paper_url: Where to find the published paper.
licence: URL or the whole licence the dataset is published under.
examples_per_shard: Size of a single part (for ML training purposes).
measurements_info: Measurements info for scaaml.io.Dataset (what is
measured, how many points are taken).
Expand Down Expand Up @@ -95,13 +102,17 @@ def capture_aes_dataset(firmware_sha256: str,
firmware_sha256=firmware_sha256,
description=description,
url=url,
firmware_url=firmware_url,
paper_url=paper_url,
licence=licence,
examples_per_shard=examples_per_shard,
measurements_info=measurements_info,
attack_points_info=crypto_implementation.ATTACK_POINTS_INFO,
capture_info=capture_info)

# Generators of key-plaintext pairs for different splits.
crypto_algorithms = []

def add_crypto_alg(split: Literal['test', 'train', 'holdout'], keys: int,
plaintexts: int, repetitions: int):
"""Does not overwrite, safe to call multiple times.
Expand Down Expand Up @@ -173,6 +184,9 @@ def capture_aes_scald_stm32f4_mbedtls(
version: int = 1,
root_path: str = '/mnt/storage/chipwhisperer',
url: str = '',
firmware_url: str = '',
paper_url: str = '',
licence: str = "https://creativecommons.org/licenses/by/4.0/",
examples_per_shard: int = 64,
measurements_info=None,
repetitions: int = 1,
Expand Down Expand Up @@ -213,6 +227,9 @@ def capture_aes_scald_stm32f4_mbedtls(
version=version,
root_path=root_path,
url=url,
firmware_url=firmware_url,
paper_url=paper_url,
licence=licence,
examples_per_shard=examples_per_shard,
measurements_info=measurements_info,
capture_info=capture_info,
Expand Down

0 comments on commit d17c4a8

Please sign in to comment.