Browse Source

Sync : asynchronously inject KeyGen and CannotDecrypt to fsm

doc_update_sequoia
Edouard Tisserant 6 years ago
parent
commit
ee8eccb069
4 changed files with 20 additions and 3 deletions
  1. +3
    -2
      src/keymanagement.c
  2. +3
    -1
      src/message_api.c
  3. +8
    -0
      src/sync_fsm.h
  4. +6
    -0
      src/sync_impl.h

+ 3
- 2
src/keymanagement.c View File

@ -9,6 +9,8 @@
#include "pEp_internal.h"
#include "keymanagement.h"
#include "sync_fsm.h"
#ifndef EMPTYSTR
#define EMPTYSTR(STR) ((STR) == NULL || (STR)[0] == '\0')
#endif
@ -513,8 +515,7 @@ DYNAMIC_API PEP_STATUS myself(PEP_SESSION session, pEp_identity * identity)
if(new_key_generated)
{
// if a state machine for keysync is in place, inject notify
if (session->sync_state != DeviceState_state_NONE)
status = fsm_DeviceState_inject(session, KeyGen, NULL, NULL);
status = inject_DeviceState_event(session, KeyGen, NULL, NULL);
if (status != PEP_STATUS_OK)
return status;
}


+ 3
- 1
src/message_api.c View File

@ -1434,8 +1434,10 @@ DYNAMIC_API PEP_STATUS _decrypt_message(
}
status = cryptotech[crypto].decrypt_and_verify(session, ctext,
csize, &ptext, &psize, &_keylist);
if (status > PEP_CANNOT_DECRYPT_UNKNOWN)
if (status > PEP_CANNOT_DECRYPT_UNKNOWN){
status = inject_DeviceState_event(session, CannotDecrypt, NULL, NULL);
goto pep_error;
}
decrypt_status = status;


+ 8
- 0
src/sync_fsm.h View File

@ -86,6 +86,14 @@ PEP_STATUS receive_DeviceState_msg(
stringlist_t *keylist
);
// event injector
PEP_STATUS inject_DeviceState_event(
PEP_SESSION session,
DeviceState_event event,
Identity partner,
void *extra);
// state machine
DeviceState_state fsm_DeviceState(


+ 6
- 0
src/sync_impl.h View File

@ -13,6 +13,12 @@ PEP_STATUS receive_sync_msg(
sync_msg_t *sync_msg
);
PEP_STATUS inject_DeviceState_event(
PEP_SESSION session,
DeviceState_event event,
Identity partner,
void *extra);
PEP_STATUS receive_DeviceState_msg(
PEP_SESSION session,
message *src,


Loading…
Cancel
Save