IOSAD-103 merge in sync IOSAD-103
authorDirk Zimmermann <dirk@pep-project.org>
Sat, 06 Oct 2018 08:57:27 +0200
branchIOSAD-103
changeset 30288ce59b8fe7e7
parent 3015 ff8ca007ef19
parent 3027 4c44c1ed06ba
child 3110 15c4e7f303dd
IOSAD-103 merge in sync
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build-windows/generate_code.cmd	Sat Oct 06 08:57:27 2018 +0200
     1.3 @@ -0,0 +1,23 @@
     1.4 +pushd .
     1.5 +cd %1\sync
     1.6 +
     1.7 +python %YML_PATH%\yml2proc -E utf-8 -y gen_actions.ysl2 sync.fsm
     1.8 +python %YML_PATH%\yml2proc -E utf-8 -y gen_statemachine.ysl2 sync.fsm
     1.9 +python %YML_PATH%\yml2proc -E utf-8 -y gen_codec.ysl2 sync.fsm
    1.10 +python %YML_PATH%\yml2proc -E utf-8 -y gen_messages.ysl2 sync.fsm
    1.11 +python %YML_PATH%\yml2proc -E utf-8 -y gen_message_func.ysl2 sync.fsm
    1.12 +
    1.13 +xcopy /y generated\*.asn1 ..\asn.1\
    1.14 +xcopy /y generated\*.c ..\src\
    1.15 +xcopy /y generated\*.h ..\src\
    1.16 +
    1.17 +cd %1\asn.1
    1.18 +
    1.19 +del *.h*
    1.20 +del *.c*
    1.21 +
    1.22 +..\..\Tools\asn1c\bin\asn1c -S ../../Tools/asn1c/share/asn1c -gen-PER -fincludes-quoted -fcompound-names -pdu=auto pEp.asn1 keysync.asn1 sync.asn1
    1.23 +
    1.24 +del *-sample.c
    1.25 +
    1.26 +popd
     2.1 --- a/build-windows/pEpEngine.vcxproj	Fri Oct 05 13:46:49 2018 +0200
     2.2 +++ b/build-windows/pEpEngine.vcxproj	Sat Oct 06 08:57:27 2018 +0200
     2.3 @@ -43,12 +43,12 @@
     2.4    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     2.5      <LinkIncremental>true</LinkIncremental>
     2.6      <RunCodeAnalysis>false</RunCodeAnalysis>
     2.7 -	<IncludePath>$(ProjectDir)\..\..\libetpan\build-windows\include;C:\Program Files %28x86%29\GnuPG\include;$(IncludePath);$(ProjectDir)\asn.1;%ASN1C%\share\asn1c</IncludePath>
     2.8 +    <IncludePath>$(ProjectDir)\..\..\libetpan\build-windows\include;C:\Program Files %28x86%29\GnuPG\include;$(IncludePath);$(ProjectDir)\asn.1;%ASN1C%\share\asn1c</IncludePath>
     2.9      <LibraryPath>$(ProjectDir)\..\..\libetpan\build-windows\Debug;$(LibraryPath)</LibraryPath>
    2.10    </PropertyGroup>
    2.11    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    2.12      <LinkIncremental>false</LinkIncremental>
    2.13 -	<IncludePath>$(ProjectDir)\..\..\libetpan\build-windows\include;C:\Program Files %28x86%29\GnuPG\include;$(IncludePath);$(ProjectDir)\asn.1;%ASN1C%\share\asn1c</IncludePath>
    2.14 +    <IncludePath>$(ProjectDir)\..\..\libetpan\build-windows\include;C:\Program Files %28x86%29\GnuPG\include;$(IncludePath);$(ProjectDir)\asn.1;%ASN1C%\share\asn1c</IncludePath>
    2.15      <LibraryPath>$(ProjectDir)\..\..\libetpan\build-windows\Release;$(LibraryPath)</LibraryPath>
    2.16    </PropertyGroup>
    2.17    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    2.18 @@ -68,10 +68,7 @@
    2.19        <AdditionalDependencies>$(TargetDir)\pEpEngineASN1.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
    2.20      </Link>
    2.21      <PreBuildEvent>
    2.22 -      <Command>cd "$(ProjectDir)..\sync" &amp;&amp; python "%YML_PATH%\yml2proc" -E utf-8 -y gen_statemachine.ysl2 devicegroup.fsm -o .statemachines
    2.23 -cd "$(ProjectDir)..\sync" &amp;&amp; python "%YML_PATH%\yml2proc" -E utf-8 -ygen_actions.ysl2 devicegroup.fsm -o .skeletons
    2.24 -cd "$(ProjectDir)..\sync" &amp;&amp; xcopy generated\*.c ..\src\ /y
    2.25 -cd "$(ProjectDir)..\sync" &amp;&amp; xcopy generated\*.h ..\src\ /y
    2.26 +      <Command>"$(SysProjectDir)generate_code.cmd" "$(ProjectDir).."
    2.27  </Command>
    2.28      </PreBuildEvent>
    2.29    </ItemDefinitionGroup>
    2.30 @@ -98,23 +95,22 @@
    2.31        <AdditionalDependencies>$(TargetDir)\pEpEngineASN1.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
    2.32      </Link>
    2.33      <PreBuildEvent>
    2.34 -      <Command>cd "$(ProjectDir)..\sync" &amp;&amp; python "%YML_PATH%\yml2proc" -E utf-8 -y gen_statemachine.ysl2 devicegroup.fsm -o .statemachines
    2.35 -cd "$(ProjectDir)..\sync" &amp;&amp; python "%YML_PATH%\yml2proc" -E utf-8 -ygen_actions.ysl2 devicegroup.fsm -o .skeletons
    2.36 -cd "$(ProjectDir)..\sync" &amp;&amp; xcopy generated\*.c ..\src\ /y
    2.37 -cd "$(ProjectDir)..\sync" &amp;&amp; xcopy generated\*.h ..\src\ /y
    2.38 +      <Command>"$(SysProjectDir)generate_code.cmd" "$(ProjectDir).."
    2.39  </Command>
    2.40      </PreBuildEvent>
    2.41    </ItemDefinitionGroup>
    2.42    <ItemGroup>
    2.43 -    <ClCompile Include="..\src\asn1_helper.c" />
    2.44      <ClCompile Include="..\src\baseprotocol.c" />
    2.45      <ClCompile Include="..\src\blacklist.c" />
    2.46      <ClCompile Include="..\src\bloblist.c" />
    2.47      <ClCompile Include="..\src\cryptotech.c" />
    2.48      <ClCompile Include="..\src\email.c" />
    2.49      <ClCompile Include="..\src\etpan_mime.c" />
    2.50 +    <ClCompile Include="..\src\growing_buf.c" />
    2.51      <ClCompile Include="..\src\identity_list.c" />
    2.52      <ClCompile Include="..\src\keymanagement.c" />
    2.53 +    <ClCompile Include="..\src\KeySync_fsm.c" />
    2.54 +    <ClCompile Include="..\src\key_reset.c" />
    2.55      <ClCompile Include="..\src\labeled_int_list.c" />
    2.56      <ClCompile Include="..\src\map_asn1.c" />
    2.57      <ClCompile Include="..\src\message.c" />
    2.58 @@ -129,12 +125,12 @@
    2.59      <ClCompile Include="..\src\sqlite3.c" />
    2.60      <ClCompile Include="..\src\stringlist.c" />
    2.61      <ClCompile Include="..\src\stringpair.c" />
    2.62 -    <ClCompile Include="..\src\sync.c" />
    2.63 -    <ClCompile Include="..\src\sync_actions.c" />
    2.64 -    <ClCompile Include="..\src\sync_driver.c" />
    2.65 -    <ClCompile Include="..\src\sync_fsm.c" />
    2.66 -    <ClCompile Include="..\src\sync_impl.c" />
    2.67 -    <ClCompile Include="..\src\sync_send_actions.c" />
    2.68 +    <ClCompile Include="..\src\Sync_actions.c" />
    2.69 +    <ClCompile Include="..\src\sync_api.c" />
    2.70 +    <ClCompile Include="..\src\sync_codec.c" />
    2.71 +    <ClCompile Include="..\src\Sync_event.c" />
    2.72 +    <ClCompile Include="..\src\Sync_func.c" />
    2.73 +    <ClCompile Include="..\src\Sync_impl.c" />
    2.74      <ClCompile Include="..\src\timestamp.c" />
    2.75      <ClCompile Include="..\src\transport.c" />
    2.76      <ClCompile Include="..\src\trans_auto.c" />
    2.77 @@ -148,8 +144,11 @@
    2.78      <ClInclude Include="..\src\dynamic_api.h" />
    2.79      <ClInclude Include="..\src\email.h" />
    2.80      <ClInclude Include="..\src\etpan_mime.h" />
    2.81 +    <ClInclude Include="..\src\growing_buf.h" />
    2.82      <ClInclude Include="..\src\identity_list.h" />
    2.83      <ClInclude Include="..\src\keymanagement.h" />
    2.84 +    <ClInclude Include="..\src\KeySync_fsm.h" />
    2.85 +    <ClInclude Include="..\src\key_reset.h" />
    2.86      <ClInclude Include="..\src\labeled_int_list.h" />
    2.87      <ClInclude Include="..\src\map_asn1.h" />
    2.88      <ClInclude Include="..\src\message.h" />
    2.89 @@ -168,9 +167,11 @@
    2.90      <ClInclude Include="..\src\sqlite3.h" />
    2.91      <ClInclude Include="..\src\stringlist.h" />
    2.92      <ClInclude Include="..\src\stringpair.h" />
    2.93 -    <ClInclude Include="..\src\sync.h" />
    2.94 -    <ClInclude Include="..\src\sync_fsm.h" />
    2.95 -    <ClInclude Include="..\src\sync_impl.h" />
    2.96 +    <ClInclude Include="..\src\sync_api.h" />
    2.97 +    <ClInclude Include="..\src\sync_codec.h" />
    2.98 +    <ClInclude Include="..\src\Sync_event.h" />
    2.99 +    <ClInclude Include="..\src\Sync_func.h" />
   2.100 +    <ClInclude Include="..\src\Sync_impl.h" />
   2.101      <ClInclude Include="..\src\timestamp.h" />
   2.102      <ClInclude Include="..\src\transport.h" />
   2.103      <ClInclude Include="..\src\trans_auto.h" />
     3.1 --- a/build-windows/pEpEngine.vcxproj.filters	Fri Oct 05 13:46:49 2018 +0200
     3.2 +++ b/build-windows/pEpEngine.vcxproj.filters	Sat Oct 06 08:57:27 2018 +0200
     3.3 @@ -72,36 +72,15 @@
     3.4      <ClCompile Include="..\src\blacklist.c">
     3.5        <Filter>Quelldateien</Filter>
     3.6      </ClCompile>
     3.7 -    <ClCompile Include="..\src\sync.c">
     3.8 -      <Filter>Quelldateien</Filter>
     3.9 -    </ClCompile>
    3.10 -    <ClCompile Include="..\src\sync_actions.c">
    3.11 -      <Filter>Quelldateien</Filter>
    3.12 -    </ClCompile>
    3.13 -    <ClCompile Include="..\src\sync_driver.c">
    3.14 -      <Filter>Quelldateien</Filter>
    3.15 -    </ClCompile>
    3.16 -    <ClCompile Include="..\src\sync_fsm.c">
    3.17 -      <Filter>Quelldateien</Filter>
    3.18 -    </ClCompile>
    3.19      <ClCompile Include="..\src\map_asn1.c">
    3.20        <Filter>Quelldateien</Filter>
    3.21      </ClCompile>
    3.22      <ClCompile Include="..\src\baseprotocol.c">
    3.23        <Filter>Quelldateien</Filter>
    3.24      </ClCompile>
    3.25 -    <ClCompile Include="..\src\sync_send_actions.c">
    3.26 -      <Filter>Quelldateien</Filter>
    3.27 -    </ClCompile>
    3.28      <ClCompile Include="..\src\openpgp_compat.c">
    3.29        <Filter>Quelldateien</Filter>
    3.30      </ClCompile>
    3.31 -    <ClCompile Include="..\src\asn1_helper.c">
    3.32 -      <Filter>Quelldateien</Filter>
    3.33 -    </ClCompile>
    3.34 -    <ClCompile Include="..\src\sync_impl.c">
    3.35 -      <Filter>Quelldateien</Filter>
    3.36 -    </ClCompile>
    3.37      <ClCompile Include="..\src\resource_id.c">
    3.38        <Filter>Quelldateien</Filter>
    3.39      </ClCompile>
    3.40 @@ -111,6 +90,33 @@
    3.41      <ClCompile Include="..\src\labeled_int_list.c">
    3.42        <Filter>Quelldateien</Filter>
    3.43      </ClCompile>
    3.44 +    <ClCompile Include="..\src\key_reset.c">
    3.45 +      <Filter>Quelldateien</Filter>
    3.46 +    </ClCompile>
    3.47 +    <ClCompile Include="..\src\KeySync_fsm.c">
    3.48 +      <Filter>Quelldateien</Filter>
    3.49 +    </ClCompile>
    3.50 +    <ClCompile Include="..\src\Sync_actions.c">
    3.51 +      <Filter>Quelldateien</Filter>
    3.52 +    </ClCompile>
    3.53 +    <ClCompile Include="..\src\sync_api.c">
    3.54 +      <Filter>Quelldateien</Filter>
    3.55 +    </ClCompile>
    3.56 +    <ClCompile Include="..\src\sync_codec.c">
    3.57 +      <Filter>Quelldateien</Filter>
    3.58 +    </ClCompile>
    3.59 +    <ClCompile Include="..\src\Sync_event.c">
    3.60 +      <Filter>Quelldateien</Filter>
    3.61 +    </ClCompile>
    3.62 +    <ClCompile Include="..\src\Sync_func.c">
    3.63 +      <Filter>Quelldateien</Filter>
    3.64 +    </ClCompile>
    3.65 +    <ClCompile Include="..\src\Sync_impl.c">
    3.66 +      <Filter>Quelldateien</Filter>
    3.67 +    </ClCompile>
    3.68 +    <ClCompile Include="..\src\growing_buf.c">
    3.69 +      <Filter>Quelldateien</Filter>
    3.70 +    </ClCompile>
    3.71    </ItemGroup>
    3.72    <ItemGroup>
    3.73      <ClInclude Include="..\src\keymanagement.h">
    3.74 @@ -188,12 +194,6 @@
    3.75      <ClInclude Include="..\src\blacklist.h">
    3.76        <Filter>Headerdateien</Filter>
    3.77      </ClInclude>
    3.78 -    <ClInclude Include="..\src\sync.h">
    3.79 -      <Filter>Headerdateien</Filter>
    3.80 -    </ClInclude>
    3.81 -    <ClInclude Include="..\src\sync_fsm.h">
    3.82 -      <Filter>Headerdateien</Filter>
    3.83 -    </ClInclude>
    3.84      <ClInclude Include="..\src\map_asn1.h">
    3.85        <Filter>Headerdateien</Filter>
    3.86      </ClInclude>
    3.87 @@ -206,9 +206,6 @@
    3.88      <ClInclude Include="..\src\asn1_helper.h">
    3.89        <Filter>Headerdateien</Filter>
    3.90      </ClInclude>
    3.91 -    <ClInclude Include="..\src\sync_impl.h">
    3.92 -      <Filter>Headerdateien</Filter>
    3.93 -    </ClInclude>
    3.94      <ClInclude Include="..\src\resource_id.h">
    3.95        <Filter>Headerdateien</Filter>
    3.96      </ClInclude>
    3.97 @@ -218,6 +215,42 @@
    3.98      <ClInclude Include="..\src\labeled_int_list.h">
    3.99        <Filter>Headerdateien</Filter>
   3.100      </ClInclude>
   3.101 +    <ClInclude Include="..\src\key_reset.h">
   3.102 +      <Filter>Headerdateien</Filter>
   3.103 +    </ClInclude>
   3.104 +    <ClInclude Include="..\src\KeySync_fsm.h">
   3.105 +      <Filter>Headerdateien</Filter>
   3.106 +    </ClInclude>
   3.107 +    <ClInclude Include="..\src\sync_api.h">
   3.108 +      <Filter>Headerdateien</Filter>
   3.109 +    </ClInclude>
   3.110 +    <ClInclude Include="..\src\sync_codec.h">
   3.111 +      <Filter>Headerdateien</Filter>
   3.112 +    </ClInclude>
   3.113 +    <ClInclude Include="..\src\Sync_event.h">
   3.114 +      <Filter>Headerdateien</Filter>
   3.115 +    </ClInclude>
   3.116 +    <ClInclude Include="..\src\Sync_func.h">
   3.117 +      <Filter>Headerdateien</Filter>
   3.118 +    </ClInclude>
   3.119 +    <ClInclude Include="..\src\Sync_impl.h">
   3.120 +      <Filter>Headerdateien</Filter>
   3.121 +    </ClInclude>
   3.122 +    <ClInclude Include="..\src\growing_buf.h">
   3.123 +      <Filter>Headerdateien</Filter>
   3.124 +    </ClInclude>
   3.125 +    <ClInclude Include="..\src\sync_api.h">
   3.126 +      <Filter>Quelldateien</Filter>
   3.127 +    </ClInclude>
   3.128 +    <ClInclude Include="..\src\sync_codec.h">
   3.129 +      <Filter>Quelldateien</Filter>
   3.130 +    </ClInclude>
   3.131 +    <ClInclude Include="..\src\Sync_event.h">
   3.132 +      <Filter>Quelldateien</Filter>
   3.133 +    </ClInclude>
   3.134 +    <ClInclude Include="..\src\KeySync_fsm.h">
   3.135 +      <Filter>Quelldateien</Filter>
   3.136 +    </ClInclude>
   3.137    </ItemGroup>
   3.138    <ItemGroup>
   3.139      <Text Include="..\LICENSE.txt" />
     4.1 --- a/src/Makefile	Fri Oct 05 13:46:49 2018 +0200
     4.2 +++ b/src/Makefile	Sat Oct 06 08:57:27 2018 +0200
     4.3 @@ -90,6 +90,7 @@
     4.4  	cp -v pEpEngine.h keymanagement.h message_api.h dynamic_api.h stringlist.h \
     4.5  	      timestamp.h identity_list.h bloblist.h stringpair.h message.h mime.h \
     4.6  	      cryptotech.h sync_api.h blacklist.h pEp_string.h openpgp_compat.h \
     4.7 +	      labeled_int_list.h key_reset.h \
     4.8  		  ../asn.1/*.h sync_codec.h $(PREFIX)/include/pEp/
     4.9  
    4.10  .PHONY: uninstall
     5.1 --- a/src/keymanagement.c	Fri Oct 05 13:46:49 2018 +0200
     5.2 +++ b/src/keymanagement.c	Sat Oct 06 08:57:27 2018 +0200
     5.3 @@ -1171,6 +1171,12 @@
     5.4      if (!(session && ident && ident->fpr))
     5.5          return PEP_ILLEGAL_VALUE;
     5.6              
     5.7 +        // See if key is revoked already
     5.8 +        bool revoked = false;
     5.9 +        status = key_revoked(session, ident->fpr, &revoked);
    5.10 +        if (!revoked)
    5.11 +            revoke_key(session, ident->fpr, NULL);
    5.12 +            
    5.13      // double-check to be sure key is even in the DB
    5.14      if (ident->fpr)
    5.15          status = set_pgp_keypair(session, ident->fpr);
     6.1 --- a/src/labeled_int_list.c	Fri Oct 05 13:46:49 2018 +0200
     6.2 +++ b/src/labeled_int_list.c	Sat Oct 06 08:57:27 2018 +0200
     6.3 @@ -118,4 +118,5 @@
     6.4          len++;
     6.5  
     6.6      return len;
     6.7 -}
     6.8 \ No newline at end of file
     6.9 +}
    6.10 +
     7.1 --- a/sync/gen_codec.ysl2	Fri Oct 05 13:46:49 2018 +0200
     7.2 +++ b/sync/gen_codec.ysl2	Sat Oct 06 08:57:27 2018 +0200
     7.3 @@ -108,7 +108,7 @@
     7.4          #include "pEp_internal.h"
     7.5          #include "growing_buf.h"
     7.6  
     7.7 -        DYNAMIC_API PEP_STATUS decode_«@name»_message(
     7.8 +        PEP_STATUS decode_«@name»_message(
     7.9                  const char *data,
    7.10                  size_t size,
    7.11                  «@name»_t **msg
    7.12 @@ -128,7 +128,7 @@
    7.13              return PEP_STATUS_OK;
    7.14          }
    7.15  
    7.16 -        DYNAMIC_API PEP_STATUS encode_«@name»_message(
    7.17 +        PEP_STATUS encode_«@name»_message(
    7.18                  «@name»_t *msg,
    7.19                  char **data,
    7.20                  size_t *size
    7.21 @@ -153,7 +153,7 @@
    7.22              return PEP_STATUS_OK;
    7.23          }
    7.24  
    7.25 -        DYNAMIC_API PEP_STATUS PER_to_XER_«@name»_msg(
    7.26 +        PEP_STATUS PER_to_XER_«@name»_msg(
    7.27                  const char *data,
    7.28                  size_t size,
    7.29                  char **text
    7.30 @@ -195,7 +195,7 @@
    7.31              return status;
    7.32          }
    7.33  
    7.34 -        DYNAMIC_API PEP_STATUS XER_to_PER_«@name»_msg(
    7.35 +        PEP_STATUS XER_to_PER_«@name»_msg(
    7.36                  const char *text,
    7.37                  char **data,
    7.38                  size_t *size
     8.1 --- a/sync/gen_statemachine.ysl2	Fri Oct 05 13:46:49 2018 +0200
     8.2 +++ b/sync/gen_statemachine.ysl2	Sat Oct 06 08:57:27 2018 +0200
     8.3 @@ -27,13 +27,13 @@
     8.4          extern "C" {
     8.5          #endif
     8.6  
     8.7 -        #include "«@name».h"
     8.8 -
     8.9 +        typedef struct «@name» «yml:ucase(@name)»;
    8.10 +        typedef int «yml:ucase(@name)»_PR;
    8.11  
    8.12          typedef struct «@name»_event {
    8.13 -            «@name»_PR fsm;
    8.14 +            «yml:ucase(@name)»_PR fsm;
    8.15              int event;
    8.16 -            «@name»_t *msg;
    8.17 +            «yml:ucase(@name)» *msg;
    8.18          } «@name»_event_t;
    8.19  
    8.20   
    8.21 @@ -51,7 +51,7 @@
    8.22          //      event must be valid for fsm or None
    8.23          //      in case msg is given event will be calculated out of message
    8.24  
    8.25 -        «@name»_event_t *new_«@name»_event(«@name»_PR fsm, int event, «@name»_t *msg);
    8.26 +        «@name»_event_t *new_«@name»_event(«yml:ucase(@name)»_PR fsm, int event, «yml:ucase(@name)» *msg);
    8.27  
    8.28          #define «yml:ucase(@name)»_TIMEOUT_EVENT new_«@name»_event(«@name»_PR_NOTHING, 0, NULL);
    8.29  
    8.30 @@ -80,7 +80,7 @@
    8.31          #include "«@name»_func.h"
    8.32          `` for "fsm" | #include "«@name»_fsm.h"
    8.33  
    8.34 -        «@name»_event_t *new_«@name»_event(«@name»_PR fsm, int event, «@name»_t *msg)
    8.35 +        «@name»_event_t *new_«@name»_event(«yml:ucase(@name)»_PR fsm, int event, «@name»_t *msg)
    8.36          {
    8.37              «@name»_event_t *ev = («@name»_event_t *) calloc(1, sizeof(«@name»_event_t));
    8.38              assert(ev);
    8.39 @@ -124,6 +124,7 @@
    8.40              #include "fsm_common.h"
    8.41              #include "«@name»_event.h"
    8.42              #include "message_api.h"
    8.43 +            #include "../asn.1/«@name».h"
    8.44              
    8.45              #define «yml:ucase(@name)»_THRESHOLD «@threshold»
    8.46              `` for "fsm" | #define «yml:ucase(@name)»_THRESHOLD «@threshold»