Skip to content

Commit

Permalink
python: rebase to add chris commit. python-no-zero-keys
Browse files Browse the repository at this point in the history
  • Loading branch information
ElsaLopez133 committed Nov 5, 2024
1 parent d46cd51 commit 160e3b2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions lakers-python/src/initiator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub struct PyEdhocInitiator {
wait_m2: Option<WaitM2>,
processing_m2: Option<ProcessingM2>,
processed_m2: Option<ProcessedM2>,
wait_m4: Option<WaitM4>,
completed: Option<Completed>,
}

Expand All @@ -39,6 +40,7 @@ impl PyEdhocInitiator {
wait_m2: None,
processing_m2: None,
processed_m2: None,
wait_m4: None,
completed: None,
}
}
Expand Down Expand Up @@ -131,7 +133,7 @@ impl PyEdhocInitiator {
&ead_3,
) {
Ok((state, message_3, prk_out)) => {
self.completed = Some(state);
self.wait_m4 = Some(state);
Ok((
PyBytes::new_bound(py, message_3.as_slice()),
PyBytes::new_bound(py, prk_out.as_slice()),
Expand All @@ -144,7 +146,7 @@ impl PyEdhocInitiator {
pub fn completed_without_message_4<'a>(&mut self, py: Python<'a>) -> PyResult<()> {
match i_complete_without_message_4(&self.wait_m4) {
Ok(state) => {
self.completed = state;
self.completed = Some(state);
Ok(())
}
Err(error) => Err(error.into()),
Expand All @@ -160,7 +162,7 @@ impl PyEdhocInitiator {

match i_process_message_4(&mut self.wait_m4, &mut default_crypto(), &message_4) {
Ok((state, ead_4)) => {
self.completed = state;
self.completed = Some(state);
Ok(ead_4)
}
Err(error) => Err(error.into()),
Expand Down
8 changes: 5 additions & 3 deletions lakers-python/src/responder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub struct PyEdhocResponder {
processing_m1: Option<ProcessingM1>,
wait_m3: Option<WaitM3>,
processing_m3: Option<ProcessingM3>,
processed_m3: Option<ProcessedM3>,
completed: Option<Completed>,
}

Expand All @@ -36,6 +37,7 @@ impl PyEdhocResponder {
processing_m1: None,
wait_m3: None,
processing_m3: None,
processed_m3: None,
completed: None,
})
}
Expand Down Expand Up @@ -125,7 +127,7 @@ impl PyEdhocResponder {
valid_cred_i,
) {
Ok((state, prk_out)) => {
self.completed = Some(state);
self.processed_m3 = Some(state);
Ok(PyBytes::new_bound(py, prk_out.as_slice()))
}
Err(error) => Err(error.into()),
Expand All @@ -140,7 +142,7 @@ impl PyEdhocResponder {
) -> PyResult<Bound<'a, PyBytes>> {
match r_prepare_message_4(&self.processed_m3, &mut default_crypto(), &ead_4) {
Ok((state, message_4)) => {
self.completed = state;
self.completed = Some(state);
Ok(PyBytes::new_bound(py, message_4.as_slice()))
}
Err(error) => Err(error.into()),
Expand All @@ -150,7 +152,7 @@ impl PyEdhocResponder {
pub fn completed_without_message_4<'a>(&mut self, py: Python<'a>) -> PyResult<()> {
match r_complete_without_message_4(&self.processed_m3) {
Ok(state) => {
self.completed = state;
self.completed = Some(state);
Ok(())
}
Err(error) => Err(error.into()),
Expand Down

0 comments on commit 160e3b2

Please sign in to comment.