pyecsca.codegen.client module¶
- class pyecsca.codegen.client.DeviceTarget(model, coords, platform, **kwargs)[source]¶
Bases:
ImplTarget
,ChipWhispererTarget
A ChipWhisperer-based device target.
- connect()¶
Connect to the target device.
- debug()¶
- Return type:
Tuple
[str
,str
]
- disconnect()¶
Disconnect from the target device.
- ecdh(other_pubkey)¶
- Return type:
bytes
- ecdsa_sign(data)¶
- Return type:
bytes
- ecdsa_verify(data, signature)¶
- Return type:
bool
- flash(fw_path)¶
Flash the firmware at fw_path to the target.
- Parameters:
fw_path¶ (
str
) – The path to the firmware blob.- Return type:
bool
- Returns:
Whether the flashing was successful.
- init_prng(seed)¶
- Return type:
None
- quit()¶
- read(num=0, timeout=0)¶
Read upto
num
bytes or untiltimeout
milliseconds from the target’s serial output.
- recv_msgs(timeout)¶
Receive
SimpleSerialMessage
messages, while waiting uptotimeout
seconds.- Parameters:
timeout¶ (
int
) – How long to wait.- Return type:
Mapping
[str
,SimpleSerialMessage
]- Returns:
The received messages with their char.
- reset()¶
- send_cmd(cmd, timeout)¶
Send a
SimpleSerialMessage
and receive the response messages that the command produces, within atimeout
.- Parameters:
cmd¶ (
SimpleSerialMessage
) – The command message to send.timeout¶ (
int
) – The timeout value to wait for the responses.
- Return type:
Mapping
[str
,SimpleSerialMessage
]- Returns:
A mapping of the starting character of the message to the message.
- set_params(params)¶
- Return type:
None
- set_privkey(privkey)¶
- Return type:
None
- set_pubkey(pubkey)¶
- Return type:
None
- set_trigger(actions)¶
- Return type:
None
- write(data)¶
Write the
data
bytes to the target’s serial input.- Parameters:
data¶ (
bytes
) – The data to write.- Return type:
None
-
model:
CurveModel
¶
-
coords:
CoordinateModel
¶
-
seed:
Optional
[bytes
]¶
-
params:
Optional
[DomainParameters
]¶
-
privkey:
Optional
[int
]¶
-
trigger:
Optional
[Triggers
]¶
-
timeout:
int
¶
- class pyecsca.codegen.client.HostTarget(model, coords, **kwargs)[source]¶
Bases:
ImplTarget
,BinaryTarget
A host-based target, will just run the binary on your machine and communicate with it via stdin/stdout.
- connect()¶
Connect to the target device.
- debug()¶
- Return type:
Tuple
[str
,str
]
- disconnect()¶
Disconnect from the target device.
- ecdh(other_pubkey)¶
- Return type:
bytes
- ecdsa_sign(data)¶
- Return type:
bytes
- ecdsa_verify(data, signature)¶
- Return type:
bool
- init_prng(seed)¶
- Return type:
None
- process: Optional[Popen] = None¶
- quit()¶
- read(num=0, timeout=0)¶
Read upto
num
bytes or untiltimeout
milliseconds from the target’s serial output.
- recv_msgs(timeout)¶
Receive
SimpleSerialMessage
messages, while waiting uptotimeout
seconds.- Parameters:
timeout¶ (
int
) – How long to wait.- Return type:
Mapping
[str
,SimpleSerialMessage
]- Returns:
The received messages with their char.
- send_cmd(cmd, timeout)¶
Send a
SimpleSerialMessage
and receive the response messages that the command produces, within atimeout
.- Parameters:
cmd¶ (
SimpleSerialMessage
) – The command message to send.timeout¶ (
int
) – The timeout value to wait for the responses.
- Return type:
Mapping
[str
,SimpleSerialMessage
]- Returns:
A mapping of the starting character of the message to the message.
- set_params(params)¶
- Return type:
None
- set_privkey(privkey)¶
- Return type:
None
- set_pubkey(pubkey)¶
- Return type:
None
- set_trigger(actions)¶
- Return type:
None
- write(data)¶
Write the
data
bytes to the target’s serial input.- Parameters:
data¶ (
bytes
) – The data to write.- Return type:
None
- model: CurveModel¶
- coords: CoordinateModel¶
- seed: Optional[bytes]¶
- params: Optional[DomainParameters]¶
- privkey: Optional[int]¶
- pubkey: Optional[Point]¶
- trigger: Optional[Triggers]¶
- timeout: int¶
- binary: List[str]¶
- debug_output: bool¶