merge "default" into "ENGINE-199"

doc_update_sequoia
Roker 6 years ago
commit 07ce93a741

@ -292,7 +292,7 @@
646C414C1D510D8800C63EFF /* baseprotocol.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = baseprotocol.c; path = ../src/baseprotocol.c; sourceTree = "<group>"; };
646C414D1D510D8800C63EFF /* baseprotocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = baseprotocol.h; path = ../src/baseprotocol.h; sourceTree = "<group>"; };
64796A3F1B455AA5004B1C24 /* libpEpEngine.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libpEpEngine.a; sourceTree = BUILT_PRODUCTS_DIR; };
64951A1B1BE0FCD800B10E71 /* system.db */ = {isa = PBXFileReference; lastKnownFileType = file; name = system.db; path = ../db/system.db; sourceTree = "<group>"; };
64951A1B1BE0FCD800B10E71 /* system.db */ = {isa = PBXFileReference; lastKnownFileType = text; name = system.db; path = ../db/system.db; sourceTree = "<group>"; };
649DE08A1B45C19100912F72 /* libcurl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libcurl.a; sourceTree = "<group>"; };
64A8264C1B455D0800EECAF0 /* bloblist.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bloblist.c; path = ../src/bloblist.c; sourceTree = "<group>"; };
64A8264D1B455D0800EECAF0 /* bloblist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = bloblist.h; path = ../src/bloblist.h; sourceTree = "<group>"; };
@ -947,7 +947,7 @@
"$(SRCROOT)",
"$(SRCROOT)/../../netpgp-et/include/",
"$(SRCROOT)/../../netpgp-et/src/",
"$(SRCROOT)/../../netpgp-et/netpgp-xcode/openssl/include/",
"$(SRCROOT)/../../OpenSSL-for-iPhone/include",
"$(SRCROOT)/../asn.1/",
);
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
@ -994,7 +994,7 @@
"$(SRCROOT)",
"$(SRCROOT)/../../netpgp-et/include/",
"$(SRCROOT)/../../netpgp-et/src/",
"$(SRCROOT)/../../netpgp-et/netpgp-xcode/openssl/include/",
"$(SRCROOT)/../../OpenSSL-for-iPhone/include",
"$(SRCROOT)/../asn.1/",
);
IPHONEOS_DEPLOYMENT_TARGET = 9.0;

@ -179,10 +179,11 @@ DYNAMIC_API PEP_STATUS update_identity(
downgrade eventually trusted comm_type */
temp_id->comm_type = _comm_type_key;
} else {
/* otherwise take stored comm_type as-is */
/* otherwise take stored comm_type as-is except if
is unknown or is expired (but key not expired anymore) */
temp_id->comm_type = stored_identity->comm_type;
if (temp_id->comm_type == PEP_ct_unknown) {
/* except if unknown */
if (temp_id->comm_type == PEP_ct_unknown ||
temp_id->comm_type == PEP_ct_key_expired) {
temp_id->comm_type = _comm_type_key;
}
}

@ -794,6 +794,7 @@ static PEP_rating decrypt_rating(PEP_STATUS status)
return PEP_rating_unencrypted;
case PEP_DECRYPTED:
case PEP_DECRYPT_SIGNATURE_DOES_NOT_MATCH:
return PEP_rating_unreliable;
case PEP_DECRYPTED_AND_VERIFIED:
@ -2251,88 +2252,6 @@ DYNAMIC_API PEP_color color_from_rating(PEP_rating rating)
return PEP_color_no_color;
}
static bool _is_valid_hex(const char* hexstr) {
if (!hexstr)
return false;
const char* curr = hexstr;
char currchar;
for (currchar = *curr; currchar != '\0'; currchar = *(++curr)) {
if ((currchar >= '0' && currchar <= '9') ||
(currchar >= 'a' && currchar <= 'f') ||
(currchar >= 'A' && currchar <= 'F'))
{
continue;
}
return false;
}
return true;
}
// Returns, in comparison: 1 if fpr1 > fpr2, 0 if equal, -1 if fpr1 < fpr2
static PEP_STATUS _compare_fprs(const char* fpr1, const char* fpr2, int* comparison) {
const int _FULL_FINGERPRINT_LENGTH = 40;
const int _ASCII_LOWERCASE_OFFSET = 32;
size_t fpr1_len = strlen(fpr1);
size_t fpr2_len = strlen(fpr2);
if (fpr1_len != _FULL_FINGERPRINT_LENGTH || fpr2_len != _FULL_FINGERPRINT_LENGTH)
return PEP_TRUSTWORDS_FPR_WRONG_LENGTH;
if (!_is_valid_hex(fpr1) || !_is_valid_hex(fpr2))
return PEP_ILLEGAL_VALUE;
const char* fpr1_curr = fpr1;
const char* fpr2_curr = fpr2;
char current;
// Advance past leading zeros.
for (current = *fpr1_curr; current != '0' && current != '\0'; current = *(++fpr1_curr), fpr1_len--);
for (current = *fpr2_curr; current != '0' && current != '\0'; current = *(++fpr2_curr), fpr2_len--);
if (fpr1_len == fpr2_len) {
char digit1;
char digit2;
while (fpr1_curr && *fpr1_curr != '\0') {
digit1 = *fpr1_curr++;
digit2 = *fpr2_curr++;
// Adjust for case-insensitive compare
if (digit1 >= 'a' && digit1 <= 'f')
digit1 -= _ASCII_LOWERCASE_OFFSET;
if (digit2 >= 'a' && digit2 <= 'f')
digit2 -= _ASCII_LOWERCASE_OFFSET;
// We take advantage of the fact that 'a'-'f' are larger
// integer values in the ASCII table than '0'-'9'.
// This allows us to compare digits directly.
if (digit1 > digit2) {
*comparison = 1;
return PEP_STATUS_OK;
} else if (digit1 < digit2) {
*comparison = -1;
return PEP_STATUS_OK;
}
// pointers already advanced above. Keep going.
}
*comparison = 0;
return PEP_STATUS_OK;
}
else if (fpr1_len > fpr2_len) {
*comparison = 1;
return PEP_STATUS_OK;
}
// Otherwise, fpr1_len < fpr2_len
*comparison = -1;
return PEP_STATUS_OK;
}
DYNAMIC_API PEP_STATUS get_trustwords(
PEP_SESSION session, const pEp_identity* id1, const pEp_identity* id2,
const char* lang, char **words, size_t *wsize, bool full
@ -2368,7 +2287,7 @@ DYNAMIC_API PEP_STATUS get_trustwords(
size_t second_wsize = 0;
int fpr_comparison = -255;
PEP_STATUS status = _compare_fprs(source1, source2, &fpr_comparison);
PEP_STATUS status = _compare_fprs(source1, strlen(source1), source2, strlen(source2), &fpr_comparison);
if (status != PEP_STATUS_OK)
return status;
@ -2556,6 +2475,12 @@ DYNAMIC_API PEP_STATUS MIME_decrypt_message(
PEP_decrypt_flags_t *flags
)
{
assert(mimetext);
assert(mime_plaintext);
assert(keylist);
assert(rating);
assert(flags);
PEP_STATUS status = PEP_STATUS_OK;
message* tmp_msg = NULL;
message* dec_msg = NULL;
@ -2570,12 +2495,24 @@ DYNAMIC_API PEP_STATUS MIME_decrypt_message(
keylist,
rating,
flags);
if (!dec_msg && (decrypt_status == PEP_UNENCRYPTED || decrypt_status == PEP_VERIFIED)) {
dec_msg = message_dup(tmp_msg);
}
if (decrypt_status > PEP_CANNOT_DECRYPT_UNKNOWN)
{
status = decrypt_status;
goto pep_error;
}
assert(dec_msg);
if (!dec_msg) {
status = PEP_UNKNOWN_ERROR;
goto pep_error;
}
status = mime_encode_message(dec_msg, false, mime_plaintext);
if (status == PEP_STATUS_OK)
@ -2621,6 +2558,12 @@ DYNAMIC_API PEP_STATUS MIME_encrypt_message(
if (status != PEP_STATUS_OK)
GOTO(pep_error);
if (!enc_msg) {
status = PEP_UNKNOWN_ERROR;
goto pep_error;
}
status = mime_encode_message(enc_msg, false, mime_ciphertext);
pep_error:
@ -2659,6 +2602,11 @@ DYNAMIC_API PEP_STATUS MIME_encrypt_message_for_self(
flags);
if (status != PEP_STATUS_OK)
goto pep_error;
if (!enc_msg) {
status = PEP_UNKNOWN_ERROR;
goto pep_error;
}
status = mime_encode_message(enc_msg, false, mime_ciphertext);

@ -193,45 +193,122 @@ PEP_STATUS encrypt_only(
}
#endif
typedef enum _normalize_hex_rest_t {
accept_hex,
ignore_hex,
reject_hex
} normalize_hex_res_t;
static inline normalize_hex_res_t _normalize_hex(char *hex)
{
if (*hex >= '0' && *hex <= '9')
return accept_hex;
if (*hex >= 'A' && *hex <= 'F') {
*hex += 'a' - 'A';
return accept_hex;
}
if (*hex >= 'a' && *hex <= 'f')
return accept_hex;
if (*hex == ' ')
return ignore_hex;
return reject_hex;
}
// Space tolerant and case insensitive fingerprint string compare
static inline int _same_fpr(
static inline PEP_STATUS _compare_fprs(
const char* fpra,
size_t fpras,
const char* fprb,
size_t fprbs
)
size_t fprbs,
int* comparison)
{
size_t ai = 0;
size_t bi = 0;
do
size_t significant = 0;
int _comparison = 0;
const int _FULL_FINGERPRINT_LENGTH = 40;
// First compare every non-ignored chars until an end is reached
while(ai < fpras && bi < fprbs)
{
if(fpra[ai] == 0 || fprb[bi] == 0)
{
return 0;
}
else if(fpra[ai] == ' ')
char fprac = fpra[ai];
char fprbc = fprb[bi];
normalize_hex_res_t fprah = _normalize_hex(&fprac);
normalize_hex_res_t fprbh = _normalize_hex(&fprbc);
if(fprah == reject_hex || fprbh == reject_hex)
return PEP_ILLEGAL_VALUE;
if ( fprah == ignore_hex )
{
ai++;
}
else if(fprb[bi] == ' ')
else if ( fprbh == ignore_hex )
{
bi++;
}
else if(toupper(fpra[ai]) == toupper(fprb[bi]))
else
{
if(fprac != fprbc && _comparison == 0 )
{
_comparison = fprac > fprbc ? 1 : -1;
}
significant++;
ai++;
bi++;
}
else
{
return 0;
}
}
}
while(ai < fpras && bi < fprbs);
return ai == fpras && bi == fprbs;
// Bail out if we didn't got enough significnt chars
if (significant != _FULL_FINGERPRINT_LENGTH )
return PEP_TRUSTWORDS_FPR_WRONG_LENGTH;
// Then purge remaining chars, all must be ignored chars
while ( ai < fpras )
{
char fprac = fpra[ai];
normalize_hex_res_t fprah = _normalize_hex(&fprac);
if( fprah == reject_hex )
return PEP_ILLEGAL_VALUE;
if ( fprah != ignore_hex )
return PEP_TRUSTWORDS_FPR_WRONG_LENGTH;
ai++;
}
while ( bi < fprbs )
{
char fprbc = fprb[bi];
normalize_hex_res_t fprbh = _normalize_hex(&fprbc);
if( fprbh == reject_hex )
return PEP_ILLEGAL_VALUE;
if ( fprbh != ignore_hex )
return PEP_TRUSTWORDS_FPR_WRONG_LENGTH;
bi++;
}
*comparison = _comparison;
return PEP_STATUS_OK;
}
static inline int _same_fpr(
const char* fpra,
size_t fpras,
const char* fprb,
size_t fprbs
)
{
// illegal values are ignored, and considered not same.
int comparison = 1;
_compare_fprs(fpra, fpras, fprb, fprbs, &comparison);
return comparison == 0;
}

@ -727,7 +727,7 @@ void free_DeviceGroup_Protocol_msg(DeviceGroup_Protocol_t *msg)
}
#ifndef NDEBUG
#ifdef DEBUG_SYNC_XER_IN_MESSAGE_BODY
static int _append(const void *buffer, size_t size, void *appkey)
{
char **dest_ptr = (char **)appkey;
@ -823,7 +823,7 @@ PEP_STATUS unicast_msg(
free_identity(me);
me = NULL;
#ifndef NDEBUG
#ifdef DEBUG_SYNC_XER_IN_MESSAGE_BODY
asn_enc_rval_t er;
er = xer_encode(&asn_DEF_DeviceGroup_Protocol, msg,
XER_F_BASIC, _append, &_message->longmsg);

@ -32,10 +32,14 @@ protocol DeviceGroup {
}
state Sole end=1 {
on KeyGen
on KeyGen {
do sendBeacon;
on CannotDecrypt
go SoleWaiting;
}
on CannotDecrypt {
do sendBeacon;
go SoleWaiting;
}
on Beacon(Identity partner){
do sendHandshakeRequest(partner);
go SoleBeaconed(partner);
@ -46,6 +50,26 @@ protocol DeviceGroup {
}
}
// copy of sole state with a timeout to enable fast polling for a second
// TODO use more YSLT power here (substates ?)
state SoleWaiting timeout=60 {
on KeyGen {
do sendBeacon;
}
on CannotDecrypt {
do sendBeacon;
}
on Beacon(Identity partner){
do sendHandshakeRequest(partner);
go SoleBeaconed(partner);
}
on HandshakeRequest(Identity partner) {
do sendHandshakeRequest(partner);
go HandshakingSole(partner);
}
on Timeout go Sole;
}
state SoleBeaconed timeout=600 (Identity expected) {
on KeyGen{
do sendBeacon;
@ -161,6 +185,7 @@ protocol DeviceGroup {
on CannotDecrypt {
do sendUpdateRequest;
do sendBeacon;
go GroupWaiting;
}
on UpdateRequest
do sendGroupUpdate;
@ -176,6 +201,29 @@ protocol DeviceGroup {
do storeGroupUpdate(partner, keys);
}
// copy of grouped state, with a timeout to enable fast poling for a minut
state GroupWaiting timeout=60 {
on KeyGen
do sendGroupUpdate;
on CannotDecrypt {
do sendUpdateRequest;
do sendBeacon;
}
on UpdateRequest
do sendGroupUpdate;
on Beacon(Identity partner){
do sendHandshakeRequest(partner);
go GroupedBeaconed(partner);
}
on HandshakeRequest(Identity partner) {
do sendHandshakeRequest(partner);
go HandshakingGrouped(partner);
}
on GroupUpdate(Identity partner, IdentityList keys)
do storeGroupUpdate(partner, keys);
on Timeout go Grouped;
}
state GroupedBeaconed timeout=600 (Identity expected){
on KeyGen
do sendGroupUpdate;

@ -100,7 +100,8 @@ DeviceState_state fsm_DeviceState(
return (int) invalid_out_of_memory;
if (status != PEP_STATUS_OK)
return (int) invalid_action;
break;
DEBUG_LOG("FSM transition", "sync_fsm.c, state=Sole, event=KeyGen", "target=SoleWaiting")
return SoleWaiting;
}
case CannotDecrypt:
{
@ -111,7 +112,8 @@ DeviceState_state fsm_DeviceState(
return (int) invalid_out_of_memory;
if (status != PEP_STATUS_OK)
return (int) invalid_action;
break;
DEBUG_LOG("FSM transition", "sync_fsm.c, state=Sole, event=CannotDecrypt", "target=SoleWaiting")
return SoleWaiting;
}
case Beacon:
{
@ -152,6 +154,81 @@ DeviceState_state fsm_DeviceState(
}
break;
}
case SoleWaiting:
{
DEBUG_LOG("Entering FSM state", "sync_fsm.c", "state=SoleWaiting")
switch (event) {
case Init:
DEBUG_LOG("FSM event", "sync_fsm.c, state=SoleWaiting", "event=Init")
*timeout = 60;
break;
case KeyGen:
{
DEBUG_LOG("FSM event", "sync_fsm.c, state=SoleWaiting", "event=KeyGen")
DEBUG_LOG("FSM action", "sync_fsm.c, state=SoleWaiting, event=KeyGen", "action=sendBeacon")
status = sendBeacon(session, state, NULL, NULL);
if (status == PEP_OUT_OF_MEMORY)
return (int) invalid_out_of_memory;
if (status != PEP_STATUS_OK)
return (int) invalid_action;
break;
}
case CannotDecrypt:
{
DEBUG_LOG("FSM event", "sync_fsm.c, state=SoleWaiting", "event=CannotDecrypt")
DEBUG_LOG("FSM action", "sync_fsm.c, state=SoleWaiting, event=CannotDecrypt", "action=sendBeacon")
status = sendBeacon(session, state, NULL, NULL);
if (status == PEP_OUT_OF_MEMORY)
return (int) invalid_out_of_memory;
if (status != PEP_STATUS_OK)
return (int) invalid_action;
break;
}
case Beacon:
{
DEBUG_LOG("FSM event", "sync_fsm.c, state=SoleWaiting", "event=Beacon")
DEBUG_LOG("FSM action", "sync_fsm.c, state=SoleWaiting, event=Beacon", "action=sendHandshakeRequest")
status = sendHandshakeRequest(session, state, partner, NULL);
if (status == PEP_OUT_OF_MEMORY)
return (int) invalid_out_of_memory;
if (status != PEP_STATUS_OK)
return (int) invalid_action;
session->sync_state_payload = malloc(sizeof(SoleBeaconed_state_payload_t));
assert(session->sync_state_payload);
if(!session->sync_state_payload) return (DeviceState_state) invalid_out_of_memory;
((SoleBeaconed_state_payload_t*)session->sync_state_payload)->expected =
identity_dup(partner);
DEBUG_LOG("FSM transition", "sync_fsm.c, state=SoleWaiting, event=Beacon", "target=SoleBeaconed")
return SoleBeaconed;
}
case HandshakeRequest:
{
DEBUG_LOG("FSM event", "sync_fsm.c, state=SoleWaiting", "event=HandshakeRequest")
DEBUG_LOG("FSM action", "sync_fsm.c, state=SoleWaiting, event=HandshakeRequest", "action=sendHandshakeRequest")
status = sendHandshakeRequest(session, state, partner, NULL);
if (status == PEP_OUT_OF_MEMORY)
return (int) invalid_out_of_memory;
if (status != PEP_STATUS_OK)
return (int) invalid_action;
session->sync_state_payload = malloc(sizeof(HandshakingSole_state_payload_t));
assert(session->sync_state_payload);
if(!session->sync_state_payload) return (DeviceState_state) invalid_out_of_memory;
((HandshakingSole_state_payload_t*)session->sync_state_payload)->expected =
identity_dup(partner);
DEBUG_LOG("FSM transition", "sync_fsm.c, state=SoleWaiting, event=HandshakeRequest", "target=HandshakingSole")
return HandshakingSole;
}
case Timeout:
{
DEBUG_LOG("FSM event", "sync_fsm.c, state=SoleWaiting", "event=Timeout")
DEBUG_LOG("FSM transition", "sync_fsm.c, state=SoleWaiting, event=Timeout", "target=Sole")
return Sole;
}
default:
return (DeviceState_state) invalid_event;
}
break;
}
case SoleBeaconed:
{
DEBUG_LOG("Entering FSM state", "sync_fsm.c", "state=SoleBeaconed")
@ -739,7 +816,8 @@ DeviceState_state fsm_DeviceState(
return (int) invalid_out_of_memory;
if (status != PEP_STATUS_OK)
return (int) invalid_action;
break;
DEBUG_LOG("FSM transition", "sync_fsm.c, state=Grouped, event=CannotDecrypt", "target=GroupWaiting")
return GroupWaiting;
}
case UpdateRequest:
{
@ -803,6 +881,110 @@ DeviceState_state fsm_DeviceState(
}
break;
}
case GroupWaiting:
{
DEBUG_LOG("Entering FSM state", "sync_fsm.c", "state=GroupWaiting")
switch (event) {
case Init:
DEBUG_LOG("FSM event", "sync_fsm.c, state=GroupWaiting", "event=Init")
*timeout = 60;
break;
case KeyGen:
{
DEBUG_LOG("FSM event", "sync_fsm.c, state=GroupWaiting", "event=KeyGen")
DEBUG_LOG("FSM action", "sync_fsm.c, state=GroupWaiting, event=KeyGen", "action=sendGroupUpdate")
status = sendGroupUpdate(session, state, NULL, NULL);
if (status == PEP_OUT_OF_MEMORY)
return (int) invalid_out_of_memory;
if (status != PEP_STATUS_OK)
return (int) invalid_action;
break;
}
case CannotDecrypt:
{
DEBUG_LOG("FSM event", "sync_fsm.c, state=GroupWaiting", "event=CannotDecrypt")
DEBUG_LOG("FSM action", "sync_fsm.c, state=GroupWaiting, event=CannotDecrypt", "action=sendUpdateRequest")
status = sendUpdateRequest(session, state, NULL, NULL);
if (status == PEP_OUT_OF_MEMORY)
return (int) invalid_out_of_memory;
if (status != PEP_STATUS_OK)
return (int) invalid_action;
DEBUG_LOG("FSM action", "sync_fsm.c, state=GroupWaiting, event=CannotDecrypt", "action=sendBeacon")
status = sendBeacon(session, state, NULL, NULL);
if (status == PEP_OUT_OF_MEMORY)
return (int) invalid_out_of_memory;
if (status != PEP_STATUS_OK)
return (int) invalid_action;
break;
}
case UpdateRequest:
{
DEBUG_LOG("FSM event", "sync_fsm.c, state=GroupWaiting", "event=UpdateRequest")
DEBUG_LOG("FSM action", "sync_fsm.c, state=GroupWaiting, event=UpdateRequest", "action=sendGroupUpdate")
status = sendGroupUpdate(session, state, NULL, NULL);
if (status == PEP_OUT_OF_MEMORY)
return (int) invalid_out_of_memory;
if (status != PEP_STATUS_OK)
return (int) invalid_action;
break;
}
case Beacon:
{
DEBUG_LOG("FSM event", "sync_fsm.c, state=GroupWaiting", "event=Beacon")
DEBUG_LOG("FSM action", "sync_fsm.c, state=GroupWaiting, event=Beacon", "action=sendHandshakeRequest")
status = sendHandshakeRequest(session, state, partner, NULL);
if (status == PEP_OUT_OF_MEMORY)
return (int) invalid_out_of_memory;
if (status != PEP_STATUS_OK)
return (int) invalid_action;
session->sync_state_payload = malloc(sizeof(GroupedBeaconed_state_payload_t));
assert(session->sync_state_payload);
if(!session->sync_state_payload) return (DeviceState_state) invalid_out_of_memory;
((GroupedBeaconed_state_payload_t*)session->sync_state_payload)->expected =
identity_dup(partner);
DEBUG_LOG("FSM transition", "sync_fsm.c, state=GroupWaiting, event=Beacon", "target=GroupedBeaconed")
return GroupedBeaconed;
}
case HandshakeRequest:
{
DEBUG_LOG("FSM event", "sync_fsm.c, state=GroupWaiting", "event=HandshakeRequest")
DEBUG_LOG("FSM action", "sync_fsm.c, state=GroupWaiting, event=HandshakeRequest", "action=sendHandshakeRequest")
status = sendHandshakeRequest(session, state, partner, NULL);
if (status == PEP_OUT_OF_MEMORY)
return (int) invalid_out_of_memory;
if (status != PEP_STATUS_OK)
return (int) invalid_action;
session->sync_state_payload = malloc(sizeof(HandshakingGrouped_state_payload_t));
assert(session->sync_state_payload);
if(!session->sync_state_payload) return (DeviceState_state) invalid_out_of_memory;
((HandshakingGrouped_state_payload_t*)session->sync_state_payload)->expected =
identity_dup(partner);
DEBUG_LOG("FSM transition", "sync_fsm.c, state=GroupWaiting, event=HandshakeRequest", "target=HandshakingGrouped")
return HandshakingGrouped;
}
case GroupUpdate:
{
DEBUG_LOG("FSM event", "sync_fsm.c, state=GroupWaiting", "event=GroupUpdate")
identity_list* keys = (identity_list*)extra;
DEBUG_LOG("FSM action", "sync_fsm.c, state=GroupWaiting, event=GroupUpdate", "action=storeGroupUpdate")
status = storeGroupUpdate(session, state, partner, keys);
if (status == PEP_OUT_OF_MEMORY)
return (int) invalid_out_of_memory;
if (status != PEP_STATUS_OK)
return (int) invalid_action;
break;
}
case Timeout:
{
DEBUG_LOG("FSM event", "sync_fsm.c, state=GroupWaiting", "event=Timeout")
DEBUG_LOG("FSM transition", "sync_fsm.c, state=GroupWaiting, event=Timeout", "target=Grouped")
return Grouped;
}
default:
return (DeviceState_state) invalid_event;
}
break;
}
case GroupedBeaconed:
{
DEBUG_LOG("Entering FSM state", "sync_fsm.c", "state=GroupedBeaconed")

@ -47,11 +47,13 @@ typedef enum _DeviceState_state {
DeviceState_state_NONE = 0,
InitState,
Sole,
SoleWaiting,
SoleBeaconed,
HandshakingSole,
WaitForGroupKeysSole,
WaitForAcceptSole,
Grouped,
GroupWaiting,
GroupedBeaconed,
HandshakingGrouped,
WaitForGroupKeysGrouped,

@ -33,6 +33,12 @@ int main() {
"blargh",
"Krista Grothoff");
pEp_identity* identity2_with_spaces = new_identity(
"krista@kgrothoff.org",
" 62D4932086185C159 17B72D30571A FBCA 5493553 ",
"blargh",
"Krista Grothoff");
string fingerprint1 = identity1->fpr;
string fingerprint2 = identity2->fpr;
char* words1 = nullptr;
@ -58,6 +64,11 @@ int main() {
get_trustwords(session, identity1, identity2, "de", &full_wordlist, &wsize_full, false);
assert(full_wordlist);
cout << full_wordlist << "\n";
cout << "\nfinding Englis trustwords for " << identity1->address << " and " << identity2->address << "... with spaces\n";
get_trustwords(session, identity1, identity2_with_spaces, "en", &full_wordlist, &wsize_full, false);
assert(full_wordlist);
cout << full_wordlist << "\n";
pEp_free(words1);
@ -79,6 +90,11 @@ int main() {
assert(full_wordlist);
cout << full_wordlist << "\n";
cout << "\nfinding English trustwords for " << identity2->address << " and " << identity2->address << "... with spaces\n";
get_trustwords(session, identity2, identity2_with_spaces, "en", &full_wordlist, &wsize_full, false);
assert(full_wordlist);
cout << full_wordlist << "\n";
pEp_free(words1);
words1 = nullptr;
pEp_free(full_wordlist);
@ -101,6 +117,11 @@ int main() {
assert(full_wordlist);
cout << full_wordlist << "\n";
cout << "\nfinding English trustwords for " << identity2->address << " and " << identity2->address << "... with spaces\n";
get_trustwords(session, identity2_with_spaces, identity1, "en", &full_wordlist, &wsize_full, false);
assert(full_wordlist);
cout << full_wordlist << "\n";
pEp_free(words1);
words1 = nullptr;
pEp_free(words2);

Loading…
Cancel
Save