IOSAD-103 merge in sync IOSAD-103
authorDirk Zimmermann <dirk@pep-project.org>
Mon, 29 Oct 2018 11:16:46 +0100
branchIOSAD-103
changeset 311015c4e7f303dd
parent 3028 8ce59b8fe7e7
parent 3109 ebacf4a1cfd7
child 3116 51bd81c53007
IOSAD-103 merge in sync
     1.1 --- a/build-windows/generate_code.cmd	Sat Oct 06 08:57:27 2018 +0200
     1.2 +++ b/build-windows/generate_code.cmd	Mon Oct 29 11:16:46 2018 +0100
     1.3 @@ -1,11 +1,11 @@
     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 +python "%YML_PATH%\yml2proc" -E utf-8 -y gen_actions.ysl2 sync.fsm
    1.13 +python "%YML_PATH%\yml2proc" -E utf-8 -y gen_statemachine.ysl2 sync.fsm
    1.14 +python "%YML_PATH%\yml2proc" -E utf-8 -y gen_codec.ysl2 sync.fsm
    1.15 +python "%YML_PATH%\yml2proc" -E utf-8 -y gen_messages.ysl2 sync.fsm
    1.16 +python "%YML_PATH%\yml2proc" -E utf-8 -y gen_message_func.ysl2 sync.fsm
    1.17  
    1.18  xcopy /y generated\*.asn1 ..\asn.1\
    1.19  xcopy /y generated\*.c ..\src\
    1.20 @@ -20,4 +20,7 @@
    1.21  
    1.22  del *-sample.c
    1.23  
    1.24 +cd %1\..
    1.25 +if not exist pEp mklink /d pEp pEpEngine\src
    1.26 +
    1.27  popd
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/build-windows/libpEpasn1/ReadMe.txt	Mon Oct 29 11:16:46 2018 +0100
     2.3 @@ -0,0 +1,29 @@
     2.4 +========================================================================
     2.5 +    STATIC LIBRARY : libpEpasn1 Project Overview
     2.6 +========================================================================
     2.7 +
     2.8 +AppWizard has created this libpEpasn1 library project for you.
     2.9 +
    2.10 +No source files were created as part of your project.
    2.11 +
    2.12 +
    2.13 +libpEpasn1.vcxproj
    2.14 +    This is the main project file for VC++ projects generated using an Application Wizard.
    2.15 +    It contains information about the version of Visual C++ that generated the file, and
    2.16 +    information about the platforms, configurations, and project features selected with the
    2.17 +    Application Wizard.
    2.18 +
    2.19 +libpEpasn1.vcxproj.filters
    2.20 +    This is the filters file for VC++ projects generated using an Application Wizard. 
    2.21 +    It contains information about the association between the files in your project 
    2.22 +    and the filters. This association is used in the IDE to show grouping of files with
    2.23 +    similar extensions under a specific node (for e.g. ".cpp" files are associated with the
    2.24 +    "Source Files" filter).
    2.25 +
    2.26 +/////////////////////////////////////////////////////////////////////////////
    2.27 +Other notes:
    2.28 +
    2.29 +AppWizard uses "TODO:" comments to indicate parts of the source code you
    2.30 +should add to or customize.
    2.31 +
    2.32 +/////////////////////////////////////////////////////////////////////////////
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/build-windows/libpEpasn1/libpEpasn1.vcxproj	Mon Oct 29 11:16:46 2018 +0100
     3.3 @@ -0,0 +1,249 @@
     3.4 +<?xml version="1.0" encoding="utf-8"?>
     3.5 +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     3.6 +  <ItemGroup Label="ProjectConfigurations">
     3.7 +    <ProjectConfiguration Include="Debug|Win32">
     3.8 +      <Configuration>Debug</Configuration>
     3.9 +      <Platform>Win32</Platform>
    3.10 +    </ProjectConfiguration>
    3.11 +    <ProjectConfiguration Include="Release|Win32">
    3.12 +      <Configuration>Release</Configuration>
    3.13 +      <Platform>Win32</Platform>
    3.14 +    </ProjectConfiguration>
    3.15 +    <ProjectConfiguration Include="Debug|x64">
    3.16 +      <Configuration>Debug</Configuration>
    3.17 +      <Platform>x64</Platform>
    3.18 +    </ProjectConfiguration>
    3.19 +    <ProjectConfiguration Include="Release|x64">
    3.20 +      <Configuration>Release</Configuration>
    3.21 +      <Platform>x64</Platform>
    3.22 +    </ProjectConfiguration>
    3.23 +  </ItemGroup>
    3.24 +  <PropertyGroup Label="Globals">
    3.25 +    <ProjectGuid>{9A67164D-B8F8-4601-A24B-28AFE774D41C}</ProjectGuid>
    3.26 +    <Keyword>Win32Proj</Keyword>
    3.27 +    <RootNamespace>libpEpasn1</RootNamespace>
    3.28 +    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
    3.29 +  </PropertyGroup>
    3.30 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
    3.31 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    3.32 +    <ConfigurationType>StaticLibrary</ConfigurationType>
    3.33 +    <UseDebugLibraries>true</UseDebugLibraries>
    3.34 +    <PlatformToolset>v140</PlatformToolset>
    3.35 +    <CharacterSet>Unicode</CharacterSet>
    3.36 +  </PropertyGroup>
    3.37 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    3.38 +    <ConfigurationType>StaticLibrary</ConfigurationType>
    3.39 +    <UseDebugLibraries>false</UseDebugLibraries>
    3.40 +    <PlatformToolset>v140</PlatformToolset>
    3.41 +    <WholeProgramOptimization>true</WholeProgramOptimization>
    3.42 +    <CharacterSet>Unicode</CharacterSet>
    3.43 +  </PropertyGroup>
    3.44 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    3.45 +    <ConfigurationType>StaticLibrary</ConfigurationType>
    3.46 +    <UseDebugLibraries>true</UseDebugLibraries>
    3.47 +    <PlatformToolset>v140</PlatformToolset>
    3.48 +    <CharacterSet>Unicode</CharacterSet>
    3.49 +  </PropertyGroup>
    3.50 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    3.51 +    <ConfigurationType>StaticLibrary</ConfigurationType>
    3.52 +    <UseDebugLibraries>false</UseDebugLibraries>
    3.53 +    <PlatformToolset>v140</PlatformToolset>
    3.54 +    <WholeProgramOptimization>true</WholeProgramOptimization>
    3.55 +    <CharacterSet>Unicode</CharacterSet>
    3.56 +  </PropertyGroup>
    3.57 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
    3.58 +  <ImportGroup Label="ExtensionSettings">
    3.59 +  </ImportGroup>
    3.60 +  <ImportGroup Label="Shared">
    3.61 +  </ImportGroup>
    3.62 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    3.63 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
    3.64 +  </ImportGroup>
    3.65 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    3.66 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
    3.67 +  </ImportGroup>
    3.68 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    3.69 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
    3.70 +  </ImportGroup>
    3.71 +  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    3.72 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
    3.73 +  </ImportGroup>
    3.74 +  <PropertyGroup Label="UserMacros" />
    3.75 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    3.76 +    <IncludePath>$(ProjectDir)..\..\asn.1;$(IncludePath)</IncludePath>
    3.77 +  </PropertyGroup>
    3.78 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    3.79 +    <IncludePath>$(ProjectDir)..\..\asn.1;$(IncludePath)</IncludePath>
    3.80 +  </PropertyGroup>
    3.81 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    3.82 +    <ClCompile>
    3.83 +      <PrecompiledHeader>
    3.84 +      </PrecompiledHeader>
    3.85 +      <WarningLevel>Level3</WarningLevel>
    3.86 +      <Optimization>Disabled</Optimization>
    3.87 +      <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
    3.88 +    </ClCompile>
    3.89 +    <Link>
    3.90 +      <SubSystem>Windows</SubSystem>
    3.91 +    </Link>
    3.92 +    <PreBuildEvent>
    3.93 +      <Command>"$(ProjectDir)..\generate_code.cmd" "$(ProjectDir)..\.."</Command>
    3.94 +      <Message>Generating Code for pEp Sync</Message>
    3.95 +    </PreBuildEvent>
    3.96 +  </ItemDefinitionGroup>
    3.97 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    3.98 +    <ClCompile>
    3.99 +      <PrecompiledHeader>
   3.100 +      </PrecompiledHeader>
   3.101 +      <WarningLevel>Level3</WarningLevel>
   3.102 +      <Optimization>Disabled</Optimization>
   3.103 +      <PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   3.104 +    </ClCompile>
   3.105 +    <Link>
   3.106 +      <SubSystem>Windows</SubSystem>
   3.107 +    </Link>
   3.108 +  </ItemDefinitionGroup>
   3.109 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
   3.110 +    <ClCompile>
   3.111 +      <WarningLevel>Level3</WarningLevel>
   3.112 +      <PrecompiledHeader>
   3.113 +      </PrecompiledHeader>
   3.114 +      <Optimization>MaxSpeed</Optimization>
   3.115 +      <FunctionLevelLinking>true</FunctionLevelLinking>
   3.116 +      <IntrinsicFunctions>true</IntrinsicFunctions>
   3.117 +      <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   3.118 +    </ClCompile>
   3.119 +    <Link>
   3.120 +      <SubSystem>Windows</SubSystem>
   3.121 +      <EnableCOMDATFolding>true</EnableCOMDATFolding>
   3.122 +      <OptimizeReferences>true</OptimizeReferences>
   3.123 +    </Link>
   3.124 +    <PreBuildEvent>
   3.125 +      <Command>"$(ProjectDir)..\generate_code.cmd" "$(ProjectDir)..\.."</Command>
   3.126 +      <Message>Generating Code for pEp Sync</Message>
   3.127 +    </PreBuildEvent>
   3.128 +  </ItemDefinitionGroup>
   3.129 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
   3.130 +    <ClCompile>
   3.131 +      <WarningLevel>Level3</WarningLevel>
   3.132 +      <PrecompiledHeader>
   3.133 +      </PrecompiledHeader>
   3.134 +      <Optimization>MaxSpeed</Optimization>
   3.135 +      <FunctionLevelLinking>true</FunctionLevelLinking>
   3.136 +      <IntrinsicFunctions>true</IntrinsicFunctions>
   3.137 +      <PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   3.138 +    </ClCompile>
   3.139 +    <Link>
   3.140 +      <SubSystem>Windows</SubSystem>
   3.141 +      <EnableCOMDATFolding>true</EnableCOMDATFolding>
   3.142 +      <OptimizeReferences>true</OptimizeReferences>
   3.143 +    </Link>
   3.144 +  </ItemDefinitionGroup>
   3.145 +  <ItemGroup>
   3.146 +    <Text Include="ReadMe.txt" />
   3.147 +  </ItemGroup>
   3.148 +  <ItemGroup>
   3.149 +    <ClInclude Include="..\..\asn.1\asn_application.h" />
   3.150 +    <ClInclude Include="..\..\asn.1\asn_codecs.h" />
   3.151 +    <ClInclude Include="..\..\asn.1\asn_codecs_prim.h" />
   3.152 +    <ClInclude Include="..\..\asn.1\asn_internal.h" />
   3.153 +    <ClInclude Include="..\..\asn.1\asn_SEQUENCE_OF.h" />
   3.154 +    <ClInclude Include="..\..\asn.1\asn_SET_OF.h" />
   3.155 +    <ClInclude Include="..\..\asn.1\asn_system.h" />
   3.156 +    <ClInclude Include="..\..\asn.1\Beacon.h" />
   3.157 +    <ClInclude Include="..\..\asn.1\ber_decoder.h" />
   3.158 +    <ClInclude Include="..\..\asn.1\ber_tlv_length.h" />
   3.159 +    <ClInclude Include="..\..\asn.1\ber_tlv_tag.h" />
   3.160 +    <ClInclude Include="..\..\asn.1\BIT_STRING.h" />
   3.161 +    <ClInclude Include="..\..\asn.1\BOOLEAN.h" />
   3.162 +    <ClInclude Include="..\..\asn.1\CommitAccept.h" />
   3.163 +    <ClInclude Include="..\..\asn.1\CommitReject.h" />
   3.164 +    <ClInclude Include="..\..\asn.1\constraints.h" />
   3.165 +    <ClInclude Include="..\..\asn.1\constr_CHOICE.h" />
   3.166 +    <ClInclude Include="..\..\asn.1\constr_SEQUENCE.h" />
   3.167 +    <ClInclude Include="..\..\asn.1\constr_SEQUENCE_OF.h" />
   3.168 +    <ClInclude Include="..\..\asn.1\constr_SET_OF.h" />
   3.169 +    <ClInclude Include="..\..\asn.1\constr_TYPE.h" />
   3.170 +    <ClInclude Include="..\..\asn.1\der_encoder.h" />
   3.171 +    <ClInclude Include="..\..\asn.1\GroupKeys.h" />
   3.172 +    <ClInclude Include="..\..\asn.1\GroupKeysAndClose.h" />
   3.173 +    <ClInclude Include="..\..\asn.1\HandshakeAnswer.h" />
   3.174 +    <ClInclude Include="..\..\asn.1\HandshakeRequest.h" />
   3.175 +    <ClInclude Include="..\..\asn.1\Hash.h" />
   3.176 +    <ClInclude Include="..\..\asn.1\Hex.h" />
   3.177 +    <ClInclude Include="..\..\asn.1\Identity.h" />
   3.178 +    <ClInclude Include="..\..\asn.1\IdentityList.h" />
   3.179 +    <ClInclude Include="..\..\asn.1\INTEGER.h" />
   3.180 +    <ClInclude Include="..\..\asn.1\ISO639-1.h" />
   3.181 +    <ClInclude Include="..\..\asn.1\KeySync.h" />
   3.182 +    <ClInclude Include="..\..\asn.1\NativeEnumerated.h" />
   3.183 +    <ClInclude Include="..\..\asn.1\NativeInteger.h" />
   3.184 +    <ClInclude Include="..\..\asn.1\OCTET_STRING.h" />
   3.185 +    <ClInclude Include="..\..\asn.1\per_decoder.h" />
   3.186 +    <ClInclude Include="..\..\asn.1\per_encoder.h" />
   3.187 +    <ClInclude Include="..\..\asn.1\per_opentype.h" />
   3.188 +    <ClInclude Include="..\..\asn.1\per_support.h" />
   3.189 +    <ClInclude Include="..\..\asn.1\PrintableString.h" />
   3.190 +    <ClInclude Include="..\..\asn.1\PString.h" />
   3.191 +    <ClInclude Include="..\..\asn.1\Rollback.h" />
   3.192 +    <ClInclude Include="..\..\asn.1\Sync.h" />
   3.193 +    <ClInclude Include="..\..\asn.1\TID.h" />
   3.194 +    <ClInclude Include="..\..\asn.1\UTF8String.h" />
   3.195 +    <ClInclude Include="..\..\asn.1\Version.h" />
   3.196 +    <ClInclude Include="..\..\asn.1\xer_decoder.h" />
   3.197 +    <ClInclude Include="..\..\asn.1\xer_encoder.h" />
   3.198 +    <ClInclude Include="..\..\asn.1\xer_support.h" />
   3.199 +  </ItemGroup>
   3.200 +  <ItemGroup>
   3.201 +    <ClCompile Include="..\..\asn.1\asn_codecs_prim.c" />
   3.202 +    <ClCompile Include="..\..\asn.1\asn_SEQUENCE_OF.c" />
   3.203 +    <ClCompile Include="..\..\asn.1\asn_SET_OF.c" />
   3.204 +    <ClCompile Include="..\..\asn.1\Beacon.c" />
   3.205 +    <ClCompile Include="..\..\asn.1\ber_decoder.c" />
   3.206 +    <ClCompile Include="..\..\asn.1\ber_tlv_length.c" />
   3.207 +    <ClCompile Include="..\..\asn.1\ber_tlv_tag.c" />
   3.208 +    <ClCompile Include="..\..\asn.1\BIT_STRING.c" />
   3.209 +    <ClCompile Include="..\..\asn.1\BOOLEAN.c" />
   3.210 +    <ClCompile Include="..\..\asn.1\CommitAccept.c" />
   3.211 +    <ClCompile Include="..\..\asn.1\CommitReject.c" />
   3.212 +    <ClCompile Include="..\..\asn.1\constraints.c" />
   3.213 +    <ClCompile Include="..\..\asn.1\constr_CHOICE.c" />
   3.214 +    <ClCompile Include="..\..\asn.1\constr_SEQUENCE.c" />
   3.215 +    <ClCompile Include="..\..\asn.1\constr_SEQUENCE_OF.c" />
   3.216 +    <ClCompile Include="..\..\asn.1\constr_SET_OF.c" />
   3.217 +    <ClCompile Include="..\..\asn.1\constr_TYPE.c" />
   3.218 +    <ClCompile Include="..\..\asn.1\der_encoder.c" />
   3.219 +    <ClCompile Include="..\..\asn.1\GroupKeys.c" />
   3.220 +    <ClCompile Include="..\..\asn.1\GroupKeysAndClose.c" />
   3.221 +    <ClCompile Include="..\..\asn.1\HandshakeAnswer.c" />
   3.222 +    <ClCompile Include="..\..\asn.1\HandshakeRequest.c" />
   3.223 +    <ClCompile Include="..\..\asn.1\Hash.c" />
   3.224 +    <ClCompile Include="..\..\asn.1\Hex.c" />
   3.225 +    <ClCompile Include="..\..\asn.1\Identity.c" />
   3.226 +    <ClCompile Include="..\..\asn.1\IdentityList.c" />
   3.227 +    <ClCompile Include="..\..\asn.1\INTEGER.c" />
   3.228 +    <ClCompile Include="..\..\asn.1\ISO639-1.c" />
   3.229 +    <ClCompile Include="..\..\asn.1\KeySync.c" />
   3.230 +    <ClCompile Include="..\..\asn.1\NativeEnumerated.c" />
   3.231 +    <ClCompile Include="..\..\asn.1\NativeInteger.c" />
   3.232 +    <ClCompile Include="..\..\asn.1\OCTET_STRING.c" />
   3.233 +    <ClCompile Include="..\..\asn.1\pdu_collection.c" />
   3.234 +    <ClCompile Include="..\..\asn.1\per_decoder.c" />
   3.235 +    <ClCompile Include="..\..\asn.1\per_encoder.c" />
   3.236 +    <ClCompile Include="..\..\asn.1\per_opentype.c" />
   3.237 +    <ClCompile Include="..\..\asn.1\per_support.c" />
   3.238 +    <ClCompile Include="..\..\asn.1\PrintableString.c" />
   3.239 +    <ClCompile Include="..\..\asn.1\PString.c" />
   3.240 +    <ClCompile Include="..\..\asn.1\Rollback.c" />
   3.241 +    <ClCompile Include="..\..\asn.1\Sync.c" />
   3.242 +    <ClCompile Include="..\..\asn.1\TID.c" />
   3.243 +    <ClCompile Include="..\..\asn.1\UTF8String.c" />
   3.244 +    <ClCompile Include="..\..\asn.1\Version.c" />
   3.245 +    <ClCompile Include="..\..\asn.1\xer_decoder.c" />
   3.246 +    <ClCompile Include="..\..\asn.1\xer_encoder.c" />
   3.247 +    <ClCompile Include="..\..\asn.1\xer_support.c" />
   3.248 +  </ItemGroup>
   3.249 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   3.250 +  <ImportGroup Label="ExtensionTargets">
   3.251 +  </ImportGroup>
   3.252 +</Project>
   3.253 \ No newline at end of file
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/build-windows/libpEpasn1/libpEpasn1.vcxproj.filters	Mon Oct 29 11:16:46 2018 +0100
     4.3 @@ -0,0 +1,315 @@
     4.4 +<?xml version="1.0" encoding="utf-8"?>
     4.5 +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     4.6 +  <ItemGroup>
     4.7 +    <Filter Include="Source Files">
     4.8 +      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
     4.9 +      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
    4.10 +    </Filter>
    4.11 +    <Filter Include="Header Files">
    4.12 +      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
    4.13 +      <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
    4.14 +    </Filter>
    4.15 +    <Filter Include="Resource Files">
    4.16 +      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
    4.17 +      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
    4.18 +    </Filter>
    4.19 +  </ItemGroup>
    4.20 +  <ItemGroup>
    4.21 +    <Text Include="ReadMe.txt" />
    4.22 +  </ItemGroup>
    4.23 +  <ItemGroup>
    4.24 +    <ClInclude Include="..\..\asn.1\asn_application.h">
    4.25 +      <Filter>Header Files</Filter>
    4.26 +    </ClInclude>
    4.27 +    <ClInclude Include="..\..\asn.1\asn_codecs.h">
    4.28 +      <Filter>Header Files</Filter>
    4.29 +    </ClInclude>
    4.30 +    <ClInclude Include="..\..\asn.1\asn_codecs_prim.h">
    4.31 +      <Filter>Header Files</Filter>
    4.32 +    </ClInclude>
    4.33 +    <ClInclude Include="..\..\asn.1\asn_internal.h">
    4.34 +      <Filter>Header Files</Filter>
    4.35 +    </ClInclude>
    4.36 +    <ClInclude Include="..\..\asn.1\asn_SEQUENCE_OF.h">
    4.37 +      <Filter>Header Files</Filter>
    4.38 +    </ClInclude>
    4.39 +    <ClInclude Include="..\..\asn.1\asn_SET_OF.h">
    4.40 +      <Filter>Header Files</Filter>
    4.41 +    </ClInclude>
    4.42 +    <ClInclude Include="..\..\asn.1\asn_system.h">
    4.43 +      <Filter>Header Files</Filter>
    4.44 +    </ClInclude>
    4.45 +    <ClInclude Include="..\..\asn.1\Beacon.h">
    4.46 +      <Filter>Header Files</Filter>
    4.47 +    </ClInclude>
    4.48 +    <ClInclude Include="..\..\asn.1\ber_decoder.h">
    4.49 +      <Filter>Header Files</Filter>
    4.50 +    </ClInclude>
    4.51 +    <ClInclude Include="..\..\asn.1\ber_tlv_length.h">
    4.52 +      <Filter>Header Files</Filter>
    4.53 +    </ClInclude>
    4.54 +    <ClInclude Include="..\..\asn.1\ber_tlv_tag.h">
    4.55 +      <Filter>Header Files</Filter>
    4.56 +    </ClInclude>
    4.57 +    <ClInclude Include="..\..\asn.1\BIT_STRING.h">
    4.58 +      <Filter>Header Files</Filter>
    4.59 +    </ClInclude>
    4.60 +    <ClInclude Include="..\..\asn.1\BOOLEAN.h">
    4.61 +      <Filter>Header Files</Filter>
    4.62 +    </ClInclude>
    4.63 +    <ClInclude Include="..\..\asn.1\CommitAccept.h">
    4.64 +      <Filter>Header Files</Filter>
    4.65 +    </ClInclude>
    4.66 +    <ClInclude Include="..\..\asn.1\CommitReject.h">
    4.67 +      <Filter>Header Files</Filter>
    4.68 +    </ClInclude>
    4.69 +    <ClInclude Include="..\..\asn.1\constr_CHOICE.h">
    4.70 +      <Filter>Header Files</Filter>
    4.71 +    </ClInclude>
    4.72 +    <ClInclude Include="..\..\asn.1\constr_SEQUENCE.h">
    4.73 +      <Filter>Header Files</Filter>
    4.74 +    </ClInclude>
    4.75 +    <ClInclude Include="..\..\asn.1\constr_SEQUENCE_OF.h">
    4.76 +      <Filter>Header Files</Filter>
    4.77 +    </ClInclude>
    4.78 +    <ClInclude Include="..\..\asn.1\constr_SET_OF.h">
    4.79 +      <Filter>Header Files</Filter>
    4.80 +    </ClInclude>
    4.81 +    <ClInclude Include="..\..\asn.1\constr_TYPE.h">
    4.82 +      <Filter>Header Files</Filter>
    4.83 +    </ClInclude>
    4.84 +    <ClInclude Include="..\..\asn.1\constraints.h">
    4.85 +      <Filter>Header Files</Filter>
    4.86 +    </ClInclude>
    4.87 +    <ClInclude Include="..\..\asn.1\der_encoder.h">
    4.88 +      <Filter>Header Files</Filter>
    4.89 +    </ClInclude>
    4.90 +    <ClInclude Include="..\..\asn.1\GroupKeys.h">
    4.91 +      <Filter>Header Files</Filter>
    4.92 +    </ClInclude>
    4.93 +    <ClInclude Include="..\..\asn.1\GroupKeysAndClose.h">
    4.94 +      <Filter>Header Files</Filter>
    4.95 +    </ClInclude>
    4.96 +    <ClInclude Include="..\..\asn.1\HandshakeAnswer.h">
    4.97 +      <Filter>Header Files</Filter>
    4.98 +    </ClInclude>
    4.99 +    <ClInclude Include="..\..\asn.1\HandshakeRequest.h">
   4.100 +      <Filter>Header Files</Filter>
   4.101 +    </ClInclude>
   4.102 +    <ClInclude Include="..\..\asn.1\Hash.h">
   4.103 +      <Filter>Header Files</Filter>
   4.104 +    </ClInclude>
   4.105 +    <ClInclude Include="..\..\asn.1\Hex.h">
   4.106 +      <Filter>Header Files</Filter>
   4.107 +    </ClInclude>
   4.108 +    <ClInclude Include="..\..\asn.1\Identity.h">
   4.109 +      <Filter>Header Files</Filter>
   4.110 +    </ClInclude>
   4.111 +    <ClInclude Include="..\..\asn.1\IdentityList.h">
   4.112 +      <Filter>Header Files</Filter>
   4.113 +    </ClInclude>
   4.114 +    <ClInclude Include="..\..\asn.1\INTEGER.h">
   4.115 +      <Filter>Header Files</Filter>
   4.116 +    </ClInclude>
   4.117 +    <ClInclude Include="..\..\asn.1\ISO639-1.h">
   4.118 +      <Filter>Header Files</Filter>
   4.119 +    </ClInclude>
   4.120 +    <ClInclude Include="..\..\asn.1\KeySync.h">
   4.121 +      <Filter>Header Files</Filter>
   4.122 +    </ClInclude>
   4.123 +    <ClInclude Include="..\..\asn.1\NativeEnumerated.h">
   4.124 +      <Filter>Header Files</Filter>
   4.125 +    </ClInclude>
   4.126 +    <ClInclude Include="..\..\asn.1\NativeInteger.h">
   4.127 +      <Filter>Header Files</Filter>
   4.128 +    </ClInclude>
   4.129 +    <ClInclude Include="..\..\asn.1\OCTET_STRING.h">
   4.130 +      <Filter>Header Files</Filter>
   4.131 +    </ClInclude>
   4.132 +    <ClInclude Include="..\..\asn.1\per_decoder.h">
   4.133 +      <Filter>Header Files</Filter>
   4.134 +    </ClInclude>
   4.135 +    <ClInclude Include="..\..\asn.1\per_encoder.h">
   4.136 +      <Filter>Header Files</Filter>
   4.137 +    </ClInclude>
   4.138 +    <ClInclude Include="..\..\asn.1\per_opentype.h">
   4.139 +      <Filter>Header Files</Filter>
   4.140 +    </ClInclude>
   4.141 +    <ClInclude Include="..\..\asn.1\per_support.h">
   4.142 +      <Filter>Header Files</Filter>
   4.143 +    </ClInclude>
   4.144 +    <ClInclude Include="..\..\asn.1\PrintableString.h">
   4.145 +      <Filter>Header Files</Filter>
   4.146 +    </ClInclude>
   4.147 +    <ClInclude Include="..\..\asn.1\PString.h">
   4.148 +      <Filter>Header Files</Filter>
   4.149 +    </ClInclude>
   4.150 +    <ClInclude Include="..\..\asn.1\Rollback.h">
   4.151 +      <Filter>Header Files</Filter>
   4.152 +    </ClInclude>
   4.153 +    <ClInclude Include="..\..\asn.1\Sync.h">
   4.154 +      <Filter>Header Files</Filter>
   4.155 +    </ClInclude>
   4.156 +    <ClInclude Include="..\..\asn.1\TID.h">
   4.157 +      <Filter>Header Files</Filter>
   4.158 +    </ClInclude>
   4.159 +    <ClInclude Include="..\..\asn.1\UTF8String.h">
   4.160 +      <Filter>Header Files</Filter>
   4.161 +    </ClInclude>
   4.162 +    <ClInclude Include="..\..\asn.1\Version.h">
   4.163 +      <Filter>Header Files</Filter>
   4.164 +    </ClInclude>
   4.165 +    <ClInclude Include="..\..\asn.1\xer_decoder.h">
   4.166 +      <Filter>Header Files</Filter>
   4.167 +    </ClInclude>
   4.168 +    <ClInclude Include="..\..\asn.1\xer_encoder.h">
   4.169 +      <Filter>Header Files</Filter>
   4.170 +    </ClInclude>
   4.171 +    <ClInclude Include="..\..\asn.1\xer_support.h">
   4.172 +      <Filter>Header Files</Filter>
   4.173 +    </ClInclude>
   4.174 +  </ItemGroup>
   4.175 +  <ItemGroup>
   4.176 +    <ClCompile Include="..\..\asn.1\asn_codecs_prim.c">
   4.177 +      <Filter>Source Files</Filter>
   4.178 +    </ClCompile>
   4.179 +    <ClCompile Include="..\..\asn.1\asn_SEQUENCE_OF.c">
   4.180 +      <Filter>Source Files</Filter>
   4.181 +    </ClCompile>
   4.182 +    <ClCompile Include="..\..\asn.1\asn_SET_OF.c">
   4.183 +      <Filter>Source Files</Filter>
   4.184 +    </ClCompile>
   4.185 +    <ClCompile Include="..\..\asn.1\Beacon.c">
   4.186 +      <Filter>Source Files</Filter>
   4.187 +    </ClCompile>
   4.188 +    <ClCompile Include="..\..\asn.1\ber_decoder.c">
   4.189 +      <Filter>Source Files</Filter>
   4.190 +    </ClCompile>
   4.191 +    <ClCompile Include="..\..\asn.1\ber_tlv_length.c">
   4.192 +      <Filter>Source Files</Filter>
   4.193 +    </ClCompile>
   4.194 +    <ClCompile Include="..\..\asn.1\ber_tlv_tag.c">
   4.195 +      <Filter>Source Files</Filter>
   4.196 +    </ClCompile>
   4.197 +    <ClCompile Include="..\..\asn.1\BIT_STRING.c">
   4.198 +      <Filter>Source Files</Filter>
   4.199 +    </ClCompile>
   4.200 +    <ClCompile Include="..\..\asn.1\BOOLEAN.c">
   4.201 +      <Filter>Source Files</Filter>
   4.202 +    </ClCompile>
   4.203 +    <ClCompile Include="..\..\asn.1\CommitAccept.c">
   4.204 +      <Filter>Source Files</Filter>
   4.205 +    </ClCompile>
   4.206 +    <ClCompile Include="..\..\asn.1\CommitReject.c">
   4.207 +      <Filter>Source Files</Filter>
   4.208 +    </ClCompile>
   4.209 +    <ClCompile Include="..\..\asn.1\constr_CHOICE.c">
   4.210 +      <Filter>Source Files</Filter>
   4.211 +    </ClCompile>
   4.212 +    <ClCompile Include="..\..\asn.1\constr_SEQUENCE.c">
   4.213 +      <Filter>Source Files</Filter>
   4.214 +    </ClCompile>
   4.215 +    <ClCompile Include="..\..\asn.1\constr_SEQUENCE_OF.c">
   4.216 +      <Filter>Source Files</Filter>
   4.217 +    </ClCompile>
   4.218 +    <ClCompile Include="..\..\asn.1\constr_SET_OF.c">
   4.219 +      <Filter>Source Files</Filter>
   4.220 +    </ClCompile>
   4.221 +    <ClCompile Include="..\..\asn.1\constr_TYPE.c">
   4.222 +      <Filter>Source Files</Filter>
   4.223 +    </ClCompile>
   4.224 +    <ClCompile Include="..\..\asn.1\constraints.c">
   4.225 +      <Filter>Source Files</Filter>
   4.226 +    </ClCompile>
   4.227 +    <ClCompile Include="..\..\asn.1\der_encoder.c">
   4.228 +      <Filter>Source Files</Filter>
   4.229 +    </ClCompile>
   4.230 +    <ClCompile Include="..\..\asn.1\GroupKeys.c">
   4.231 +      <Filter>Source Files</Filter>
   4.232 +    </ClCompile>
   4.233 +    <ClCompile Include="..\..\asn.1\GroupKeysAndClose.c">
   4.234 +      <Filter>Source Files</Filter>
   4.235 +    </ClCompile>
   4.236 +    <ClCompile Include="..\..\asn.1\HandshakeAnswer.c">
   4.237 +      <Filter>Source Files</Filter>
   4.238 +    </ClCompile>
   4.239 +    <ClCompile Include="..\..\asn.1\HandshakeRequest.c">
   4.240 +      <Filter>Source Files</Filter>
   4.241 +    </ClCompile>
   4.242 +    <ClCompile Include="..\..\asn.1\Hash.c">
   4.243 +      <Filter>Source Files</Filter>
   4.244 +    </ClCompile>
   4.245 +    <ClCompile Include="..\..\asn.1\Hex.c">
   4.246 +      <Filter>Source Files</Filter>
   4.247 +    </ClCompile>
   4.248 +    <ClCompile Include="..\..\asn.1\Identity.c">
   4.249 +      <Filter>Source Files</Filter>
   4.250 +    </ClCompile>
   4.251 +    <ClCompile Include="..\..\asn.1\IdentityList.c">
   4.252 +      <Filter>Source Files</Filter>
   4.253 +    </ClCompile>
   4.254 +    <ClCompile Include="..\..\asn.1\INTEGER.c">
   4.255 +      <Filter>Source Files</Filter>
   4.256 +    </ClCompile>
   4.257 +    <ClCompile Include="..\..\asn.1\ISO639-1.c">
   4.258 +      <Filter>Source Files</Filter>
   4.259 +    </ClCompile>
   4.260 +    <ClCompile Include="..\..\asn.1\KeySync.c">
   4.261 +      <Filter>Source Files</Filter>
   4.262 +    </ClCompile>
   4.263 +    <ClCompile Include="..\..\asn.1\NativeEnumerated.c">
   4.264 +      <Filter>Source Files</Filter>
   4.265 +    </ClCompile>
   4.266 +    <ClCompile Include="..\..\asn.1\NativeInteger.c">
   4.267 +      <Filter>Source Files</Filter>
   4.268 +    </ClCompile>
   4.269 +    <ClCompile Include="..\..\asn.1\OCTET_STRING.c">
   4.270 +      <Filter>Source Files</Filter>
   4.271 +    </ClCompile>
   4.272 +    <ClCompile Include="..\..\asn.1\pdu_collection.c">
   4.273 +      <Filter>Source Files</Filter>
   4.274 +    </ClCompile>
   4.275 +    <ClCompile Include="..\..\asn.1\per_decoder.c">
   4.276 +      <Filter>Source Files</Filter>
   4.277 +    </ClCompile>
   4.278 +    <ClCompile Include="..\..\asn.1\per_encoder.c">
   4.279 +      <Filter>Source Files</Filter>
   4.280 +    </ClCompile>
   4.281 +    <ClCompile Include="..\..\asn.1\per_opentype.c">
   4.282 +      <Filter>Source Files</Filter>
   4.283 +    </ClCompile>
   4.284 +    <ClCompile Include="..\..\asn.1\per_support.c">
   4.285 +      <Filter>Source Files</Filter>
   4.286 +    </ClCompile>
   4.287 +    <ClCompile Include="..\..\asn.1\PrintableString.c">
   4.288 +      <Filter>Source Files</Filter>
   4.289 +    </ClCompile>
   4.290 +    <ClCompile Include="..\..\asn.1\PString.c">
   4.291 +      <Filter>Source Files</Filter>
   4.292 +    </ClCompile>
   4.293 +    <ClCompile Include="..\..\asn.1\Rollback.c">
   4.294 +      <Filter>Source Files</Filter>
   4.295 +    </ClCompile>
   4.296 +    <ClCompile Include="..\..\asn.1\Sync.c">
   4.297 +      <Filter>Source Files</Filter>
   4.298 +    </ClCompile>
   4.299 +    <ClCompile Include="..\..\asn.1\TID.c">
   4.300 +      <Filter>Source Files</Filter>
   4.301 +    </ClCompile>
   4.302 +    <ClCompile Include="..\..\asn.1\UTF8String.c">
   4.303 +      <Filter>Source Files</Filter>
   4.304 +    </ClCompile>
   4.305 +    <ClCompile Include="..\..\asn.1\Version.c">
   4.306 +      <Filter>Source Files</Filter>
   4.307 +    </ClCompile>
   4.308 +    <ClCompile Include="..\..\asn.1\xer_decoder.c">
   4.309 +      <Filter>Source Files</Filter>
   4.310 +    </ClCompile>
   4.311 +    <ClCompile Include="..\..\asn.1\xer_encoder.c">
   4.312 +      <Filter>Source Files</Filter>
   4.313 +    </ClCompile>
   4.314 +    <ClCompile Include="..\..\asn.1\xer_support.c">
   4.315 +      <Filter>Source Files</Filter>
   4.316 +    </ClCompile>
   4.317 +  </ItemGroup>
   4.318 +</Project>
   4.319 \ No newline at end of file
     5.1 --- a/build-windows/pEpEngine.vcxproj	Sat Oct 06 08:57:27 2018 +0200
     5.2 +++ b/build-windows/pEpEngine.vcxproj	Mon Oct 29 11:16:46 2018 +0100
     5.3 @@ -45,11 +45,20 @@
     5.4      <RunCodeAnalysis>false</RunCodeAnalysis>
     5.5      <IncludePath>$(ProjectDir)\..\..\libetpan\build-windows\include;C:\Program Files %28x86%29\GnuPG\include;$(IncludePath);$(ProjectDir)\asn.1;%ASN1C%\share\asn1c</IncludePath>
     5.6      <LibraryPath>$(ProjectDir)\..\..\libetpan\build-windows\Debug;$(LibraryPath)</LibraryPath>
     5.7 +    <PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
     5.8 +    <PreLinkEventUseInBuild>true</PreLinkEventUseInBuild>
     5.9 +    <PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
    5.10 +    <CodeAnalysisRuleSet>C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
    5.11    </PropertyGroup>
    5.12    <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    5.13      <LinkIncremental>false</LinkIncremental>
    5.14      <IncludePath>$(ProjectDir)\..\..\libetpan\build-windows\include;C:\Program Files %28x86%29\GnuPG\include;$(IncludePath);$(ProjectDir)\asn.1;%ASN1C%\share\asn1c</IncludePath>
    5.15      <LibraryPath>$(ProjectDir)\..\..\libetpan\build-windows\Release;$(LibraryPath)</LibraryPath>
    5.16 +    <PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
    5.17 +    <PreLinkEventUseInBuild>true</PreLinkEventUseInBuild>
    5.18 +    <PostBuildEventUseInBuild>true</PostBuildEventUseInBuild>
    5.19 +    <CodeAnalysisRuleSet>C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Static Analysis Tools\Rule Sets\NativeRecommendedRules.ruleset</CodeAnalysisRuleSet>
    5.20 +    <RunCodeAnalysis>false</RunCodeAnalysis>
    5.21    </PropertyGroup>
    5.22    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    5.23      <ClCompile>
    5.24 @@ -65,11 +74,14 @@
    5.25      <Link>
    5.26        <SubSystem>Windows</SubSystem>
    5.27        <GenerateDebugInformation>true</GenerateDebugInformation>
    5.28 -      <AdditionalDependencies>$(TargetDir)\pEpEngineASN1.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
    5.29 +      <AdditionalDependencies>Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
    5.30 +      <ShowProgress>NotSet</ShowProgress>
    5.31      </Link>
    5.32      <PreBuildEvent>
    5.33 -      <Command>"$(SysProjectDir)generate_code.cmd" "$(ProjectDir).."
    5.34 -</Command>
    5.35 +      <Command>
    5.36 +      </Command>
    5.37 +      <Message>
    5.38 +      </Message>
    5.39      </PreBuildEvent>
    5.40    </ItemDefinitionGroup>
    5.41    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    5.42 @@ -86,17 +98,20 @@
    5.43        <CompileAs>Default</CompileAs>
    5.44        <MultiProcessorCompilation>true</MultiProcessorCompilation>
    5.45        <ControlFlowGuard>Guard</ControlFlowGuard>
    5.46 +      <EnablePREfast>false</EnablePREfast>
    5.47      </ClCompile>
    5.48      <Link>
    5.49        <SubSystem>Windows</SubSystem>
    5.50        <GenerateDebugInformation>true</GenerateDebugInformation>
    5.51        <EnableCOMDATFolding>true</EnableCOMDATFolding>
    5.52        <OptimizeReferences>true</OptimizeReferences>
    5.53 -      <AdditionalDependencies>$(TargetDir)\pEpEngineASN1.lib;Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
    5.54 +      <AdditionalDependencies>Rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
    5.55      </Link>
    5.56      <PreBuildEvent>
    5.57 -      <Command>"$(SysProjectDir)generate_code.cmd" "$(ProjectDir).."
    5.58 -</Command>
    5.59 +      <Command>
    5.60 +      </Command>
    5.61 +      <Message>
    5.62 +      </Message>
    5.63      </PreBuildEvent>
    5.64    </ItemDefinitionGroup>
    5.65    <ItemGroup>
    5.66 @@ -184,6 +199,9 @@
    5.67      <ProjectReference Include="..\..\libetpan\build-windows\libetpan\libetpan.vcxproj">
    5.68        <Project>{ba4ded3c-e56f-4484-bfc3-9c13e461a1be}</Project>
    5.69      </ProjectReference>
    5.70 +    <ProjectReference Include="libpEpasn1\libpEpasn1.vcxproj">
    5.71 +      <Project>{9a67164d-b8f8-4601-a24b-28afe774d41c}</Project>
    5.72 +    </ProjectReference>
    5.73    </ItemGroup>
    5.74    <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
    5.75    <ImportGroup Label="ExtensionTargets">
     6.1 --- a/src/fsm_common.h	Sat Oct 06 08:57:27 2018 +0200
     6.2 +++ b/src/fsm_common.h	Mon Oct 29 11:16:46 2018 +0100
     6.3 @@ -3,7 +3,7 @@
     6.4  
     6.5  // generate state machine code
     6.6  
     6.7 -// Copyleft (c) 2017, p≡p foundation
     6.8 +// Copyleft (c) 2017-2018, pEp foundation
     6.9  
    6.10  // Written by Volker Birk
    6.11  
    6.12 @@ -23,9 +23,11 @@
    6.13      invalid_event = -3,
    6.14      invalid_condition = -4,
    6.15      invalid_action = -5,
    6.16 +    inhibited_event = -6,
    6.17 +    cannot_send = -7,
    6.18  
    6.19      // out of memory condition
    6.20 -    invalid_out_of_memory = -128,
    6.21 +    out_of_memory = -128,
    6.22  } fsm_error;
    6.23  
    6.24  // common
     7.1 --- a/src/keymanagement.c	Sat Oct 06 08:57:27 2018 +0200
     7.2 +++ b/src/keymanagement.c	Mon Oct 29 11:16:46 2018 +0100
     7.3 @@ -568,58 +568,61 @@
     7.4  
     7.5              if (id_list) {
     7.6                  identity_list* id_curr = id_list;
     7.7 -                bool input_is_TOFU = strstr(identity->user_id, "TOFU_") == identity->user_id;
     7.8 +                bool input_is_TOFU = (strstr(identity->user_id, "TOFU_") == identity->user_id);
     7.9                  while (id_curr) {
    7.10                      pEp_identity* this_id = id_curr->ident;
    7.11                      if (this_id) {
    7.12                          char* this_uid = this_id->user_id;
    7.13 -                        bool curr_is_TOFU = strstr(this_uid, "TOFU_") == this_uid;
    7.14 -                        if (this_uid) {
    7.15 -                            if (curr_is_TOFU && !input_is_TOFU) {
    7.16 -                                // FIXME: should we also be fixing pEp_own_userId in this
    7.17 -                                // function here?
    7.18 +                        bool curr_is_TOFU = false;
    7.19 +                        // this_uid should never be NULL, as this is half of the ident
    7.20 +                        // DB primary key
    7.21 +                        assert(!EMPTYSTR(this_uid));
    7.22 +
    7.23 +                        curr_is_TOFU = (strstr(this_uid, "TOFU_") == this_uid);
    7.24 +                        if (curr_is_TOFU && !input_is_TOFU) {
    7.25 +                            // FIXME: should we also be fixing pEp_own_userId in this
    7.26 +                            // function here?
    7.27 +                            
    7.28 +                            // if usernames match, we replace the userid. Or if the temp username
    7.29 +                            // is anonymous.
    7.30 +                            // FIXME: do we need to create an address match function which
    7.31 +                            // matches the whole dot-and-case rigamarole from 
    7.32 +                            if (EMPTYSTR(this_id->username) ||
    7.33 +                                strcasecmp(this_id->username, this_id->address) == 0 ||
    7.34 +                                (identity->username && 
    7.35 +                                 strcasecmp(identity->username, 
    7.36 +                                            this_id->username) == 0)) {
    7.37                                  
    7.38 -                                // if usernames match, we replace the userid. Or if the temp username
    7.39 -                                // is anonymous.
    7.40 -                                // FIXME: do we need to create an address match function which
    7.41 -                                // matches the whole dot-and-case rigamarole from 
    7.42 -                                if (EMPTYSTR(this_id->username) ||
    7.43 -                                    strcasecmp(this_id->username, this_id->address) == 0 ||
    7.44 -                                    (identity->username && 
    7.45 -                                     strcasecmp(identity->username, 
    7.46 -                                                this_id->username) == 0)) {
    7.47 +                                // Ok, we have a temp ID. We have to replace this
    7.48 +                                // with the real ID.
    7.49 +                                status = replace_userid(session, 
    7.50 +                                                        this_uid, 
    7.51 +                                                        identity->user_id);
    7.52 +                                if (status != PEP_STATUS_OK) {
    7.53 +                                    free_identity_list(id_list);
    7.54 +                                    free(default_own_id);
    7.55 +                                    return status;
    7.56 +                                }
    7.57                                      
    7.58 -                                    // Ok, we have a temp ID. We have to replace this
    7.59 -                                    // with the real ID.
    7.60 -                                    status = replace_userid(session, 
    7.61 -                                                            this_uid, 
    7.62 -                                                            identity->user_id);
    7.63 -                                    if (status != PEP_STATUS_OK) {
    7.64 -                                        free_identity_list(id_list);
    7.65 -                                        free(default_own_id);
    7.66 -                                        return status;
    7.67 -                                    }
    7.68 -                                        
    7.69 -                                    free(this_uid);
    7.70 -                                    this_uid = NULL;
    7.71 -                                    
    7.72 -                                    // Reflect the change we just made to the DB
    7.73 -                                    this_id->user_id = strdup(identity->user_id);
    7.74 -                                    stored_ident = this_id;
    7.75 -                                    // FIXME: free list.
    7.76 -                                    break;                                
    7.77 -                                }
    7.78 -                            }
    7.79 -                            else if (input_is_TOFU && !curr_is_TOFU) {
    7.80 -                                // Replace ruthlessly - this is NOT supposed to happen.
    7.81 -                                // BAD APP BEHAVIOUR.
    7.82 -                                free(identity->user_id);
    7.83 -                                identity->user_id = strdup(this_id->user_id);
    7.84 +                                free(this_uid);
    7.85 +                                this_uid = NULL;
    7.86 +                                
    7.87 +                                // Reflect the change we just made to the DB
    7.88 +                                this_id->user_id = strdup(identity->user_id);
    7.89                                  stored_ident = this_id;
    7.90                                  // FIXME: free list.
    7.91                                  break;                                
    7.92 -                            }                            
    7.93 -                        } 
    7.94 +                            }
    7.95 +                        }
    7.96 +                        else if (input_is_TOFU && !curr_is_TOFU) {
    7.97 +                            // Replace ruthlessly - this is NOT supposed to happen.
    7.98 +                            // BAD APP BEHAVIOUR.
    7.99 +                            free(identity->user_id);
   7.100 +                            identity->user_id = strdup(this_id->user_id);
   7.101 +                            stored_ident = this_id;
   7.102 +                            // FIXME: free list.
   7.103 +                            break;                                
   7.104 +                        }                            
   7.105                      }
   7.106                      id_curr = id_curr->next;
   7.107                  }
   7.108 @@ -655,19 +658,15 @@
   7.109              //    * create identity with user_id, address, username
   7.110              //      (this is the input id without the fpr + comm type!)
   7.111  
   7.112 -            if (status == PEP_STATUS_OK) {
   7.113 -                elect_pubkey(session, identity, false);
   7.114 -            }
   7.115 +            elect_pubkey(session, identity, false);
   7.116                          
   7.117              //    * We've already checked and retrieved
   7.118              //      any applicable temporary identities above. If we're 
   7.119              //      here, none of them fit.
   7.120              //    * call set_identity() to store
   7.121 -            if (status == PEP_STATUS_OK) {
   7.122 -                // FIXME: Do we set if we had to copy in the address?
   7.123 -                adjust_pEp_trust_status(session, identity);
   7.124 -                status = set_identity(session, identity);
   7.125 -            }
   7.126 +            // FIXME: Do we set if we had to copy in the address?
   7.127 +            adjust_pEp_trust_status(session, identity);
   7.128 +            status = set_identity(session, identity);
   7.129              //  * Return: created identity
   7.130          }        
   7.131      }
   7.132 @@ -700,7 +699,10 @@
   7.133                      pEp_identity* this_id = id_curr->ident;
   7.134                      if (this_id) {
   7.135                          char* this_uid = this_id->user_id;
   7.136 -                        if (this_uid && (strstr(this_uid, "TOFU_") != this_uid)) {
   7.137 +                        assert(!EMPTYSTR(this_uid));
   7.138 +                        // Should never be NULL - DB primary key
   7.139 +                        
   7.140 +                        if (strstr(this_uid, "TOFU_") != this_uid) {
   7.141                              // if usernames match, we replace the userid.
   7.142                              if (identity->username && 
   7.143                                  strcasecmp(identity->username, 
   7.144 @@ -1118,13 +1120,16 @@
   7.145  }
   7.146  
   7.147  DYNAMIC_API PEP_STATUS do_keymanagement(
   7.148 -        PEP_SESSION session,
   7.149          retrieve_next_identity_t retrieve_next_identity,
   7.150          void *management
   7.151      )
   7.152  {
   7.153 +    PEP_SESSION session;
   7.154      pEp_identity *identity;
   7.155 -    PEP_STATUS status;
   7.156 +    PEP_STATUS status = init(&session, NULL, NULL);
   7.157 +    assert(!status);
   7.158 +    if (status)
   7.159 +        return status;
   7.160  
   7.161      assert(session && retrieve_next_identity);
   7.162      if (!(session && retrieve_next_identity))
   7.163 @@ -1153,7 +1158,7 @@
   7.164      }
   7.165  
   7.166      log_event(session, "keymanagement thread shutdown", "pEp engine", NULL, NULL);
   7.167 -
   7.168 +    release(session);
   7.169      return PEP_STATUS_OK;
   7.170  }
   7.171  
   7.172 @@ -1840,8 +1845,10 @@
   7.173          switch (thing) {
   7.174              case _pgp_fpr:
   7.175                  identity = new_identity(NULL, NULL, PEP_OWN_USERID, NULL);
   7.176 -                if (!identity)
   7.177 +                if (!identity) {
   7.178                      status = PEP_OUT_OF_MEMORY;
   7.179 +                    break;
   7.180 +                }
   7.181                  identity->me = true;
   7.182                  fpr = strdup(_sl->value);
   7.183                  assert(fpr);
   7.184 @@ -1883,3 +1890,4 @@
   7.185      return status;
   7.186  }
   7.187  #endif // USE_GPG
   7.188 +
     8.1 --- a/src/keymanagement.h	Sat Oct 06 08:57:27 2018 +0200
     8.2 +++ b/src/keymanagement.h	Mon Oct 29 11:16:46 2018 +0100
     8.3 @@ -164,14 +164,9 @@
     8.4  // do_keymanagement() - function to be run on an extra thread
     8.5  //
     8.6  //  parameters:
     8.7 -//      session (in)                session to use
     8.8  //      retrieve_next_identity (in) pointer to retrieve_next_identity()
     8.9  //                                  callback which returns at least a valid
    8.10  //                                  address field in the identity struct
    8.11 -//      messageToSend (in)          callback for sending message by the
    8.12 -//                                  application
    8.13 -//      management (in)             management data to give to keymanagement
    8.14 -//                                  (implementation defined)
    8.15  //
    8.16  //  return value:
    8.17  //      PEP_STATUS_OK if thread has to terminate successfully or any other
    8.18 @@ -187,7 +182,6 @@
    8.19  //      if transport system is not used it must not be NULL
    8.20  
    8.21  DYNAMIC_API PEP_STATUS do_keymanagement(
    8.22 -        PEP_SESSION session,
    8.23          retrieve_next_identity_t retrieve_next_identity,
    8.24          void *management
    8.25      );
    8.26 @@ -213,25 +207,6 @@
    8.27          pEp_identity *ident
    8.28      );
    8.29  
    8.30 -// undo_last_mistrust() - reset identity and trust status for the last
    8.31 -//                        identity in this session marked as mistrusted
    8.32 -//                        to their cached values from the time of mistrust
    8.33 -//  parameters:
    8.34 -//      session (in)        session to use
    8.35 -//
    8.36 -//  return value:
    8.37 -//      PEP_STATUS_OK if identity and trust were successfully restored.
    8.38 -//      Otherwise, error status from attempts to set.
    8.39 -//
    8.40 -//  caveat:
    8.41 -//      only works for this session, and only once. cache is invalidated
    8.42 -//      upon use.
    8.43 -//
    8.44 -//      WILL NOT WORK ON MISTRUSTED OWN KEY
    8.45 -
    8.46 -DYNAMIC_API PEP_STATUS undo_last_mistrust(PEP_SESSION session);
    8.47 -
    8.48 -
    8.49  // trust_personal_key() - mark a key as trusted for a user
    8.50  //
    8.51  //  parameters:
     9.1 --- a/src/message_api.c	Sat Oct 06 08:57:27 2018 +0200
     9.2 +++ b/src/message_api.c	Mon Oct 29 11:16:46 2018 +0100
     9.3 @@ -433,9 +433,12 @@
     9.4      // based on
     9.5      // https://en.wikipedia.org/wiki/Base36#C_implementation
     9.6      // ok, we supposedly have a 64-bit kinda sorta random blob
     9.7 -    const char base_36_symbols[36] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
     9.8 +    const char base_36_symbols[37] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
     9.9  
    9.10      char* retbuf = calloc(bufsize, 1); 
    9.11 +    assert(retbuf);
    9.12 +    if (!retbuf)
    9.13 +        return NULL;
    9.14  
    9.15      int i = bufsize - 1; // (end index)
    9.16  
    9.17 @@ -468,9 +471,8 @@
    9.18      
    9.19      i = DESIRED_BITS;
    9.20      
    9.21 -    int bitshift = 0;
    9.22 -    
    9.23      while (i > 0) {
    9.24 +        int bitshift = 0;
    9.25          int randval = rand();
    9.26          unsigned long long temp_val = randval & bitmask;
    9.27  
    9.28 @@ -922,8 +924,11 @@
    9.29          attachment->longmsg = encapsulate_message_wrap_info(inner_type_string, attachment->longmsg);
    9.30          _envelope->longmsg = encapsulate_message_wrap_info("OUTER", _envelope->longmsg);
    9.31      }
    9.32 +    else if (_envelope) {
    9.33 +        _envelope->longmsg = encapsulate_message_wrap_info("TRANSPORT", _envelope->longmsg);
    9.34 +    }
    9.35      else {
    9.36 -        _envelope->longmsg = encapsulate_message_wrap_info("TRANSPORT", _envelope->longmsg);
    9.37 +        return NULL;
    9.38      }
    9.39      
    9.40      if (!attachment->id || attachment->id[0] == '\0') {
    9.41 @@ -1618,10 +1623,10 @@
    9.42      bool added_key_to_real_src = false;
    9.43      
    9.44      assert(session);
    9.45 -    assert(src);
    9.46 +    assert(src && src->from);
    9.47      assert(dst);
    9.48  
    9.49 -    if (!(session && src && dst))
    9.50 +    if (!(session && src && src->from && dst))
    9.51          return PEP_ILLEGAL_VALUE;
    9.52  
    9.53      if (src->dir == PEP_dir_incoming)
    9.54 @@ -1636,7 +1641,7 @@
    9.55      
    9.56      *dst = NULL;
    9.57  
    9.58 -    if (src->from && (!src->from->user_id || src->from->user_id[0] == '\0')) {
    9.59 +    if (!src->from->user_id || src->from->user_id[0] == '\0') {
    9.60          char* own_id = NULL;
    9.61          status = get_default_own_userid(session, &own_id);
    9.62          if (own_id) {
    9.63 @@ -2144,11 +2149,12 @@
    9.64      message* _src = src;
    9.65  
    9.66      assert(session);
    9.67 +    assert(target_id);
    9.68      assert(src);
    9.69      assert(dst);
    9.70      assert(enc_format != PEP_enc_none);
    9.71  
    9.72 -    if (!(session && src && dst && enc_format != PEP_enc_none))
    9.73 +    if (!(session && target_id && src && dst && enc_format != PEP_enc_none))
    9.74          return PEP_ILLEGAL_VALUE;
    9.75  
    9.76      // if (src->dir == PEP_dir_incoming)
    9.77 @@ -2157,8 +2163,8 @@
    9.78      determine_encryption_format(src);
    9.79      if (src->enc_format != PEP_enc_none)
    9.80          return PEP_ILLEGAL_VALUE;
    9.81 -    if (target_id && (!target_id->user_id || target_id->user_id[0] == '\0')) {
    9.82 -        
    9.83 +
    9.84 +    if (!target_id->user_id || target_id->user_id[0] == '\0') {
    9.85          char* own_id = NULL;
    9.86          status = get_default_own_userid(session, &own_id);
    9.87          if (own_id) {
    9.88 @@ -2166,14 +2172,18 @@
    9.89              target_id->user_id = own_id; // ownership transfer
    9.90          }
    9.91      }
    9.92 -    
    9.93 +
    9.94 +    if (!target_id->user_id || target_id->user_id[0] == '\0')
    9.95 +        return PEP_CANNOT_FIND_IDENTITY;
    9.96 +
    9.97      if (target_id->address) {
    9.98          status = myself(session, target_id);
    9.99          if (status != PEP_STATUS_OK)
   9.100              goto pEp_error;
   9.101      }
   9.102 -    else if (!target_id->fpr)
   9.103 +    else if (!target_id->fpr) {
   9.104          return PEP_ILLEGAL_VALUE;
   9.105 +    }
   9.106      
   9.107      *dst = NULL;
   9.108  
   9.109 @@ -2346,6 +2356,10 @@
   9.110      size_t boundary_strlen = (end_boundary - start_boundary) + 2;
   9.111  
   9.112      signed_boundary = calloc(boundary_strlen + 1, 1);
   9.113 +    assert(signed_boundary);
   9.114 +    if (!signed_boundary)
   9.115 +        return PEP_OUT_OF_MEMORY;
   9.116 +
   9.117      strlcpy(signed_boundary, "--", boundary_strlen + 1);
   9.118      strlcat(signed_boundary, start_boundary, boundary_strlen + 1);
   9.119  
   9.120 @@ -2424,32 +2438,34 @@
   9.121          verify_curr->next = orig_verify;
   9.122      }
   9.123  
   9.124 -    /* append keylist to signers */
   9.125 -    if (keylist_in_out && *keylist_in_out && (*keylist_in_out)->value) {
   9.126 -        stringlist_t** tail_pp = &verify_curr->next;
   9.127 -        
   9.128 -        while (*tail_pp) {
   9.129 -            tail_pp = &((*tail_pp)->next);
   9.130 +    if (keylist_in_out) {
   9.131 +        /* append keylist to signers */
   9.132 +        if (*keylist_in_out && (*keylist_in_out)->value) {
   9.133 +            stringlist_t** tail_pp = &verify_curr->next;
   9.134 +
   9.135 +            while (*tail_pp) {
   9.136 +                tail_pp = &((*tail_pp)->next);
   9.137 +            }
   9.138 +            stringlist_t* second_list = *keylist_in_out;
   9.139 +            if (second_list) {
   9.140 +                char* listhead_val = second_list->value;
   9.141 +                if (!listhead_val || listhead_val[0] == '\0') {
   9.142 +                    /* remove head, basically. This can happen when,
   9.143 +                       for example, the signature is detached and
   9.144 +                       verification is not seen directly after
   9.145 +                       decryption, so no signer is presumed in
   9.146 +                       the first construction of the keylist */
   9.147 +                    *keylist_in_out = (*keylist_in_out)->next;
   9.148 +                    second_list->next = NULL;
   9.149 +                    free_stringlist(second_list);
   9.150 +                }
   9.151 +            }
   9.152 +            *tail_pp = *keylist_in_out;
   9.153          }
   9.154 -        stringlist_t* second_list = *keylist_in_out;
   9.155 -        if (second_list) {
   9.156 -            char* listhead_val = second_list->value;
   9.157 -            if (!listhead_val || listhead_val[0] == '\0') {
   9.158 -                /* remove head, basically. This can happen when,
   9.159 -                   for example, the signature is detached and
   9.160 -                   verification is not seen directly after
   9.161 -                   decryption, so no signer is presumed in
   9.162 -                   the first construction of the keylist */
   9.163 -                *keylist_in_out = (*keylist_in_out)->next;
   9.164 -                second_list->next = NULL;
   9.165 -                free_stringlist(second_list);
   9.166 -            }
   9.167 -        }
   9.168 -        *tail_pp = *keylist_in_out;
   9.169 +
   9.170 +        *keylist_in_out = verify_curr;
   9.171      }
   9.172 -    
   9.173 -    *keylist_in_out = verify_curr;
   9.174 -    
   9.175 +
   9.176      status = PEP_STATUS_OK;
   9.177      
   9.178  free:
   9.179 @@ -2748,7 +2764,7 @@
   9.180      }
   9.181  
   9.182      bloblist_t *_s;
   9.183 -    for (_s = src->attachments; _s; _s = _s->next) {
   9.184 +    for (_s = src->attachments; _s && _s->value; _s = _s->next) {
   9.185          if (_s->value == NULL && _s->size == 0){
   9.186              _m = bloblist_add(_m, NULL, 0, _s->mime_type, _s->filename);
   9.187              if (_m == NULL)
   9.188 @@ -3576,50 +3592,52 @@
   9.189          goto pEp_error;
   9.190      }
   9.191      
   9.192 -    stringpair_list_t* curr_pair_node;
   9.193 -    stringpair_t* curr_pair;
   9.194 -    
   9.195 -    for (curr_pair_node = revoke_replace_pairs; curr_pair_node; curr_pair_node = curr_pair_node->next) {
   9.196 -        curr_pair = curr_pair_node->value;
   9.197 -        
   9.198 -        if (!curr_pair)
   9.199 -            continue; // Again, shouldn't occur
   9.200 -            
   9.201 -        if (curr_pair->key && curr_pair->value) {
   9.202 -            status = create_standalone_key_reset_message(session,
   9.203 -                                                         &reset_msg,
   9.204 -                                                         msg->from,
   9.205 -                                                         curr_pair->key,
   9.206 -                                                         curr_pair->value);
   9.207 -
   9.208 -            // If we can't find the identity, this is someone we've never mailed, so we just
   9.209 -            // go on letting them use the wrong key until we mail them ourselves. (Spammers, etc)
   9.210 -            if (status != PEP_CANNOT_FIND_IDENTITY) {
   9.211 -                if (status != PEP_STATUS_OK)
   9.212 -                    goto pEp_error;
   9.213 -                    
   9.214 -                if (!reset_msg) {
   9.215 -                    status = PEP_OUT_OF_MEMORY;
   9.216 -                    goto pEp_error;
   9.217 -                }
   9.218 -                // insert into queue
   9.219 -                if (session->messageToSend)
   9.220 -                    status = session->messageToSend(reset_msg);
   9.221 -                else
   9.222 -                    status = PEP_SYNC_NO_MESSAGE_SEND_CALLBACK;
   9.223 -            
   9.224 -
   9.225 -                if (status == PEP_STATUS_OK) {    
   9.226 -                    // Put into notified DB
   9.227 -                    status = set_reset_contact_notified(session, curr_pair->key, msg->from->user_id);
   9.228 -                    if (status != PEP_STATUS_OK) // It's ok to barf because it's a DB problem??
   9.229 +    if (msg) {
   9.230 +        stringpair_list_t* curr_pair_node;
   9.231 +        stringpair_t* curr_pair;
   9.232 +
   9.233 +        for (curr_pair_node = revoke_replace_pairs; curr_pair_node; curr_pair_node = curr_pair_node->next) {
   9.234 +            curr_pair = curr_pair_node->value;
   9.235 +
   9.236 +            if (!curr_pair)
   9.237 +                continue; // Again, shouldn't occur
   9.238 +
   9.239 +            if (curr_pair->key && curr_pair->value) {
   9.240 +                status = create_standalone_key_reset_message(session,
   9.241 +                    &reset_msg,
   9.242 +                    msg->from,
   9.243 +                    curr_pair->key,
   9.244 +                    curr_pair->value);
   9.245 +
   9.246 +                // If we can't find the identity, this is someone we've never mailed, so we just
   9.247 +                // go on letting them use the wrong key until we mail them ourselves. (Spammers, etc)
   9.248 +                if (status != PEP_CANNOT_FIND_IDENTITY) {
   9.249 +                    if (status != PEP_STATUS_OK)
   9.250                          goto pEp_error;
   9.251 -                }
   9.252 -                else {
   9.253 -                    // According to Volker, this would only be a fatal error, so...
   9.254 -                    free_message(reset_msg); // ??
   9.255 -                    reset_msg = NULL; // ??
   9.256 -                    goto pEp_error;
   9.257 +
   9.258 +                    if (!reset_msg) {
   9.259 +                        status = PEP_OUT_OF_MEMORY;
   9.260 +                        goto pEp_error;
   9.261 +                    }
   9.262 +                    // insert into queue
   9.263 +                    if (session->messageToSend)
   9.264 +                        status = session->messageToSend(reset_msg);
   9.265 +                    else
   9.266 +                        status = PEP_SYNC_NO_MESSAGE_SEND_CALLBACK;
   9.267 +
   9.268 +
   9.269 +                    if (status == PEP_STATUS_OK) {
   9.270 +                        // Put into notified DB
   9.271 +                        status = set_reset_contact_notified(session, curr_pair->key, msg->from->user_id);
   9.272 +                        if (status != PEP_STATUS_OK) // It's ok to barf because it's a DB problem??
   9.273 +                            goto pEp_error;
   9.274 +                    }
   9.275 +                    else {
   9.276 +                        // According to Volker, this would only be a fatal error, so...
   9.277 +                        free_message(reset_msg); // ??
   9.278 +                        reset_msg = NULL; // ??
   9.279 +                        goto pEp_error;
   9.280 +                    }
   9.281                  }
   9.282              }
   9.283          }
   9.284 @@ -3775,6 +3793,8 @@
   9.285                                                true);
   9.286                      if (status != PEP_STATUS_OK || il->ident->fpr == NULL) {
   9.287                          il->ident->comm_type = PEP_ct_key_not_found;
   9.288 +                        if (*max_comm_type > PEP_ct_no_encryption)
   9.289 +                            *max_comm_type = PEP_ct_no_encryption;
   9.290                      }
   9.291                  }    
   9.292              }
    10.1 --- a/src/mime.c	Sat Oct 06 08:57:27 2018 +0200
    10.2 +++ b/src/mime.c	Mon Oct 29 11:16:46 2018 +0100
    10.3 @@ -1360,8 +1360,6 @@
    10.4      char *_longmsg;
    10.5      size_t length;
    10.6      size_t _size;
    10.7 -    int code;
    10.8 -    int r;
    10.9      size_t index;
   10.10      char *type = NULL;
   10.11      char *charset = NULL;
   10.12 @@ -1383,9 +1381,9 @@
   10.13      length = part->mm_body->dt_data.dt_text.dt_length;
   10.14  
   10.15      if (part->mm_body->dt_encoded) {
   10.16 -        code = part->mm_body->dt_encoding;
   10.17 +        int code = part->mm_body->dt_encoding;
   10.18          index = 0;
   10.19 -        r = mailmime_part_parse(text, length, &index, code, &_longmsg, &_size);
   10.20 +        int r = mailmime_part_parse(text, length, &index, code, &_longmsg, &_size);
   10.21          switch (r) {
   10.22              case MAILIMF_NO_ERROR:
   10.23                  break;
   10.24 @@ -1449,9 +1447,9 @@
   10.25          headerblock = strstr(headerblock, header_string);
   10.26          if (headerblock) {
   10.27              const char* subj_start = "Subject: ";
   10.28 -            size_t subj_len = strlen(subj_start);
   10.29              headerblock = strstr(headerblock, subj_start);
   10.30              if (headerblock) {
   10.31 +                size_t subj_len = strlen(subj_start);
   10.32                  headerblock += subj_len;
   10.33                  char* end_pt = strstr(headerblock, "\n");
   10.34                  if (end_pt) {
    11.1 --- a/src/pEpEngine.c	Sat Oct 06 08:57:27 2018 +0200
    11.2 +++ b/src/pEpEngine.c	Mon Oct 29 11:16:46 2018 +0100
    11.3 @@ -20,17 +20,16 @@
    11.4  
    11.5  // sql overloaded functions - modified from sqlite3.c
    11.6  static void _sql_lower(sqlite3_context* ctx, int argc, sqlite3_value** argv) {
    11.7 -    char *z1;
    11.8      const char *z2;
    11.9 -    int i, n;
   11.10 +    int n;
   11.11      z2 = (char*)sqlite3_value_text(argv[0]);
   11.12      n = sqlite3_value_bytes(argv[0]);
   11.13      /* Verify that the call to _bytes() does not invalidate the _text() pointer */
   11.14      assert( z2==(char*)sqlite3_value_text(argv[0]) );
   11.15      if( z2 ){
   11.16 -        z1 = (char*)sqlite3_malloc(n+1);
   11.17 +        char *z1 = (char*)sqlite3_malloc(n+1);
   11.18          if( z1 ){
   11.19 -            for(i=0; i<n; i++){
   11.20 +            for(int i=0; i<n; i++){
   11.21                  char c = z2[i];
   11.22                  char c_mod = c | 0x20;
   11.23                  if (c_mod < 0x61 || c_mod > 0x7a)
   11.24 @@ -392,7 +391,7 @@
   11.25      ");";
   11.26  
   11.27  static const char *sql_own_identities_retrieve =  
   11.28 -    "select address, fpr, username, identity.user_id, "
   11.29 +    "select address, fpr, identity.user_id, username,"
   11.30      "   lang, identity.flags | pgp_keypair.flags"
   11.31      "   from identity"
   11.32      "   join person on id = identity.user_id"
   11.33 @@ -2002,7 +2001,6 @@
   11.34          default:
   11.35              // Technically true, given how we find it, but FIXME we need a more descriptive error
   11.36              status = PEP_CANNOT_FIND_IDENTITY;
   11.37 -            *userid = NULL;
   11.38      }
   11.39  
   11.40      *userid = retval;
   11.41 @@ -2375,8 +2373,6 @@
   11.42          identity_list** id_list
   11.43      )
   11.44  {
   11.45 -    pEp_identity* ident;
   11.46 -
   11.47      assert(session);
   11.48      assert(address);
   11.49      assert(address[0]);
   11.50 @@ -2395,7 +2391,7 @@
   11.51      while ((result = sqlite3_step(session->get_identities_by_address)) == SQLITE_ROW) {
   11.52          //"select user_id, main_key_id, username, comm_type, lang,"
   11.53          //"   identity.flags, is_own"
   11.54 -        ident = new_identity(
   11.55 +        pEp_identity *ident = new_identity(
   11.56                  address,
   11.57                  (const char *) sqlite3_column_text(session->get_identities_by_address, 1),
   11.58                  (const char *) sqlite3_column_text(session->get_identities_by_address, 0),
   11.59 @@ -4437,7 +4433,6 @@
   11.60      )
   11.61  {
   11.62      PEP_STATUS status = PEP_STATUS_OK;
   11.63 -    int result;
   11.64  
   11.65      assert(session);
   11.66      assert(name && value);
   11.67 @@ -4452,7 +4447,7 @@
   11.68          status = _get_sequence_value(session, name, value);
   11.69  
   11.70      if (status == PEP_STATUS_OK) {
   11.71 -        result = sqlite3_exec(session->db, "COMMIT ;", NULL, NULL, NULL);
   11.72 +        int result = sqlite3_exec(session->db, "COMMIT ;", NULL, NULL, NULL);
   11.73          if (result == SQLITE_OK){
   11.74              assert(*value < INT32_MAX);
   11.75              if (*value == INT32_MAX){
   11.76 @@ -4640,8 +4635,6 @@
   11.77          identity_list** id_list
   11.78      )
   11.79  {
   11.80 -    pEp_identity* ident;
   11.81 -
   11.82      assert(session);
   11.83      assert(id_list);
   11.84  
   11.85 @@ -4655,7 +4648,7 @@
   11.86      int result;
   11.87  
   11.88      while ((result = sqlite3_step(session->get_last_contacted)) == SQLITE_ROW) {
   11.89 -        ident = new_identity(
   11.90 +        pEp_identity *ident = new_identity(
   11.91                  (const char *) sqlite3_column_text(session->get_last_contacted, 1),
   11.92                  NULL,
   11.93                  (const char *) sqlite3_column_text(session->get_last_contacted, 0),
    12.1 --- a/src/pEpEngine.h	Sat Oct 06 08:57:27 2018 +0200
    12.2 +++ b/src/pEpEngine.h	Mon Oct 29 11:16:46 2018 +0100
    12.3 @@ -108,6 +108,7 @@
    12.4      PEP_STATEMACHINE_INVALID_CONDITION              = 0x0984,
    12.5      PEP_STATEMACHINE_INVALID_ACTION                 = 0x0985,
    12.6      PEP_STATEMACHINE_INHIBITED_EVENT                = 0x0986,
    12.7 +    PEP_STATEMACHINE_CANNOT_SEND                    = 0x0987,
    12.8  
    12.9      PEP_COMMIT_FAILED                               = 0xff01,
   12.10      PEP_MESSAGE_CONSUME                             = 0xff02,
    13.1 --- a/src/pgp_gpg.c	Sat Oct 06 08:57:27 2018 +0200
    13.2 +++ b/src/pgp_gpg.c	Mon Oct 29 11:16:46 2018 +0100
    13.3 @@ -16,16 +16,13 @@
    13.4  
    13.5  static bool ensure_config_values(stringlist_t *keys, stringlist_t *values, const char* config_file_path)
    13.6  {
    13.7 -    static char buf[MAX_LINELENGTH];
    13.8      int r;
    13.9      stringlist_t *_k;
   13.10      stringlist_t *_v;
   13.11      unsigned int i;
   13.12      unsigned int found = 0;
   13.13      bool eof_nl = 0;
   13.14 -    char * rest;
   13.15 -    char * token;
   13.16 -    char * s;
   13.17 +    char * rest = NULL;
   13.18      const char* line_end;
   13.19  
   13.20  #ifdef WIN32
   13.21 @@ -39,7 +36,9 @@
   13.22          return false;
   13.23  
   13.24      if (f != NULL) {
   13.25 +        static char buf[MAX_LINELENGTH];
   13.26          int length = stringlist_length(keys);
   13.27 +        char * s;
   13.28  
   13.29          // make sure we 1) have the same number of keys and values
   13.30          // and 2) we don't have more key/value pairs than
   13.31 @@ -55,7 +54,7 @@
   13.32          }
   13.33  
   13.34          while ((s = Fgets(buf, MAX_LINELENGTH, f))) {
   13.35 -            token = strtok_r(s, " \t\r\n", &rest);
   13.36 +            char *token = strtok_r(s, " \t\r\n", &rest);
   13.37              for (_k = keys, _v = values, i = 1;
   13.38                   _k != NULL;
   13.39                   _k = _k->next, _v = _v->next, i <<= 1) {
   13.40 @@ -116,6 +115,9 @@
   13.41          at = address + addr_len;
   13.42          
   13.43      char* retval = calloc(1, addr_len + 1);
   13.44 +    assert(retval);
   13.45 +    if (!retval)
   13.46 +        return NULL;
   13.47  
   13.48      const char* addr_curr = address;
   13.49      char* retval_curr = retval;
    14.1 --- a/src/pgp_netpgp.c	Sat Oct 06 08:57:27 2018 +0200
    14.2 +++ b/src/pgp_netpgp.c	Mon Oct 29 11:16:46 2018 +0100
    14.3 @@ -1424,10 +1424,8 @@
    14.4          request[HKP_REQ_PREFIX_LEN + encoded_key_len] = '\0';
    14.5  
    14.6          if(!stringlist_add(encoded_keys, request)){
    14.7 -            free(request);
    14.8              result = PEP_OUT_OF_MEMORY;
    14.9          }
   14.10 -
   14.11          free(request);
   14.12  
   14.13  free_encoded_key:
   14.14 @@ -1953,7 +1951,7 @@
   14.15          *has_private = true;
   14.16      }
   14.17      else {
   14.18 -        has_private = false;
   14.19 +        *has_private = false;
   14.20      }
   14.21      return status;
   14.22  }
    15.1 --- a/src/platform_windows.cpp	Sat Oct 06 08:57:27 2018 +0200
    15.2 +++ b/src/platform_windows.cpp	Mon Oct 29 11:16:46 2018 +0100
    15.3 @@ -287,7 +287,7 @@
    15.4  int mkstemp(char *templ)
    15.5  {
    15.6      char *pathname = _mktemp(templ);
    15.7 -    if (errno)
    15.8 +    if (!pathname)
    15.9          return -1;
   15.10      return _open(pathname, _O_RDWR | _O_CREAT | _O_EXCL, _S_IREAD | _S_IWRITE);
   15.11  }
    16.1 --- a/src/resource_id.c	Sat Oct 06 08:57:27 2018 +0200
    16.2 +++ b/src/resource_id.c	Mon Oct 29 11:16:46 2018 +0100
    16.3 @@ -5,9 +5,22 @@
    16.4  #include "resource_id.h"
    16.5  
    16.6  pEp_rid_list_t* new_rid_node(pEp_resource_id_type type, const char* resource) {
    16.7 +    assert(resource);
    16.8 +    if (!resource)
    16.9 +        return NULL;
   16.10 +
   16.11      pEp_rid_list_t* retval = (pEp_rid_list_t*)calloc(1, sizeof(pEp_rid_list_t));
   16.12 +    assert(retval);
   16.13 +    if (!retval)
   16.14 +        return NULL;
   16.15 +
   16.16      retval->rid_type = type;
   16.17      retval->rid = strdup(resource);
   16.18 +    assert(retval->rid);
   16.19 +    if (!retval->rid) {
   16.20 +        free(retval);
   16.21 +        return NULL;
   16.22 +    }
   16.23      return retval;
   16.24  }
   16.25  
    17.1 --- a/src/sync_api.h	Sat Oct 06 08:57:27 2018 +0200
    17.2 +++ b/src/sync_api.h	Mon Oct 29 11:16:46 2018 +0100
    17.3 @@ -49,7 +49,6 @@
    17.4  //      ownership of self and partner go to the callee
    17.5  
    17.6  typedef PEP_STATUS (*notifyHandshake_t)(
    17.7 -        void *obj,
    17.8          pEp_identity *me,
    17.9          pEp_identity *partner,
   17.10          sync_handshake_signal signal
   17.11 @@ -88,7 +87,7 @@
   17.12  //      new_sync_timeout_event() in case of timeout
   17.13  
   17.14  typedef SYNC_EVENT (*retrieve_next_sync_event_t)(void *management,
   17.15 -        time_t threshold);
   17.16 +        unsigned threshold);
   17.17  
   17.18  
   17.19  // register_sync_callbacks() - register adapter's callbacks
    18.1 --- a/sync/cond_act_sync.yml2	Sat Oct 06 08:57:27 2018 +0200
    18.2 +++ b/sync/cond_act_sync.yml2	Mon Oct 29 11:16:46 2018 +0100
    18.3 @@ -14,7 +14,7 @@
    18.4  
    18.5  condition deviceGrouped {
    18.6      call "exec_sql_int" with "sql"
    18.7 -        > "select count(*) from identity where is_own = true and (flags & 4) = 4;"
    18.8 +        > "select count(*) from identity where is_own = 1 and (flags & 4) = 4;"
    18.9      |> *result = _result > 0;
   18.10  }
   18.11  
   18.12 @@ -136,8 +136,7 @@
   18.13              return PEP_OUT_OF_MEMORY;
   18.14          }
   18.15  
   18.16 -        status = session->notifyHandshake(session->sync_management, me,
   18.17 -                partner, «$type»);
   18.18 +        status = session->notifyHandshake(me, partner, «$type»);
   18.19          if (status)
   18.20              return status;
   18.21      ||
    19.1 --- a/sync/gen_codec.ysl2	Sat Oct 06 08:57:27 2018 +0200
    19.2 +++ b/sync/gen_codec.ysl2	Mon Oct 29 11:16:46 2018 +0100
    19.3 @@ -103,12 +103,14 @@
    19.4          // This file is under GNU General Public License 3.0
    19.5          // see LICENSE.txt
    19.6  
    19.7 +        #include "platform.h"
    19.8 +
    19.9          #include "«yml:lcase(@name)»_codec.h"
   19.10          #include "../asn.1/«@name».h"
   19.11          #include "pEp_internal.h"
   19.12          #include "growing_buf.h"
   19.13  
   19.14 -        PEP_STATUS decode_«@name»_message(
   19.15 +        DYNAMIC_API PEP_STATUS decode_«@name»_message(
   19.16                  const char *data,
   19.17                  size_t size,
   19.18                  «@name»_t **msg
    20.1 --- a/sync/gen_statemachine.ysl2	Sat Oct 06 08:57:27 2018 +0200
    20.2 +++ b/sync/gen_statemachine.ysl2	Mon Oct 29 11:16:46 2018 +0100
    20.3 @@ -75,6 +75,8 @@
    20.4          // This file is under GNU General Public License 3.0
    20.5          // see LICENSE.txt
    20.6  
    20.7 +        #include "platform.h"
    20.8 +
    20.9          #include "pEp_internal.h"
   20.10          #include "«@name»_event.h"
   20.11          #include "«@name»_func.h"
   20.12 @@ -918,6 +920,12 @@
   20.13  
   20.14          «$fsm/@name»_SERVICE_LOG("send message", "«@name»");
   20.15          status = send_«$protocol/@name»_message(session, «$fsm/@id», «$fsm/@name»__payload_PR_«yml:mixedCase(@name)»);
   20.16 +        if (status == PEP_OUT_OF_MEMORY)
   20.17 +            return out_of_memory;
   20.18 +        if (status) {
   20.19 +            «$fsm/@name»_ERR_LOG_HEX("sending «@name» failed", status);
   20.20 +            return cannot_send;
   20.21 +        }
   20.22          ||
   20.23      }
   20.24  
   20.25 @@ -927,6 +935,8 @@
   20.26  
   20.27          «$fsm/@name»_SERVICE_LOG("do action", "«@name»");
   20.28          status = «@name»(session);
   20.29 +        if (status == PEP_OUT_OF_MEMORY)
   20.30 +            return out_of_memory;
   20.31          if (status) {
   20.32              «$fsm/@name»_ERR_LOG_HEX("executing action «@name»() failed", status);
   20.33              return invalid_action;
   20.34 @@ -939,6 +949,8 @@
   20.35          ||
   20.36  
   20.37          status = «@name»(session, &result);
   20.38 +        if (status == PEP_OUT_OF_MEMORY)
   20.39 +            return out_of_memory;
   20.40          if (status) {
   20.41              «$fsm/@name»_ERR_LOG_HEX("computing condition «@name» failed", status);
   20.42              return invalid_condition;
    21.1 --- a/sync/sql_func.yml2	Sat Oct 06 08:57:27 2018 +0200
    21.2 +++ b/sync/sql_func.yml2	Mon Oct 29 11:16:46 2018 +0100
    21.3 @@ -11,10 +11,12 @@
    21.4  function "init_sql" {
    21.5      param "sql";
    21.6      ||
    21.7 -        static const char *sql = `copy '$sql'`;
    21.8 -        static const size_t len = sizeof(`copy '$sql'`);
    21.9          sqlite3_stmt *_sql;
   21.10 -        int int_result = sqlite3_prepare_v2(session->db, sql, (int) len, &_sql, NULL);
   21.11 +        int int_result = sqlite3_prepare_v2(session->db,
   21.12 +    ||
   21.13 +    indent(2); copy '$sql';
   21.14 +    ||
   21.15 +            , -1, &_sql, NULL);
   21.16          assert(int_result == SQLITE_OK);
   21.17          if (!(int_result == SQLITE_OK))
   21.18              return PEP_UNKNOWN_ERROR;
    22.1 --- a/test/include/SyncTests.h	Sat Oct 06 08:57:27 2018 +0200
    22.2 +++ b/test/include/SyncTests.h	Mon Oct 29 11:16:46 2018 +0100
    22.3 @@ -20,7 +20,6 @@
    22.4      void processing();
    22.5  
    22.6      static PEP_STATUS notifyHandshake(
    22.7 -            void *obj,
    22.8              pEp_identity *me,
    22.9              pEp_identity *partner,
   22.10              sync_handshake_signal signal
    23.1 --- a/test/src/SuiteMaker.cc	Sat Oct 06 08:57:27 2018 +0200
    23.2 +++ b/test/src/SuiteMaker.cc	Mon Oct 29 11:16:46 2018 +0100
    23.3 @@ -12,175 +12,175 @@
    23.4  #include "SuiteMaker.h"
    23.5  
    23.6  // Begin where we generate stuff
    23.7 +#include "MimeTests.h"
    23.8 +#include "UserIdCollisionTests.h"
    23.9 +#include "Engine463Tests.h"
   23.10 +#include "BloblistTests.h"
   23.11 +#include "NewUpdateIdAndMyselfTests.h"
   23.12 +#include "I18nTests.h"
   23.13 +#include "IdentityListTests.h"
   23.14 +#include "PgpBinaryTests.h"
   23.15 +#include "MessageNullFromTests.h"
   23.16 +#include "LeastCommonDenomColorTests.h"
   23.17 +#include "StringlistTests.h"
   23.18 +#include "PgpListKeysTests.h"
   23.19 +#include "MessageApiTests.h"
   23.20 +#include "EncryptMissingPrivateKeyTests.h"
   23.21 +#include "CaseAndDotAddressTests.h"
   23.22 +#include "UserIDAliasTests.h"
   23.23 +#include "BCCTests.h"
   23.24 +#include "BlacklistAcceptNewKeyTests.h"
   23.25 +#include "DecryptAttachPrivateKeyUntrustedTests.h"
   23.26 +#include "BlacklistTests.h"
   23.27 +#include "RevokeRegenAttachTests.h"
   23.28 +#include "PepSubjectReceivedTests.h"
   23.29 +#include "SequenceTests.h"
   23.30 +#include "EncryptAttachPrivateKeyTests.h"
   23.31 +#include "ExternalRevokeTests.h"
   23.32 +#include "KeyeditTests.h"
   23.33 +#include "LeastColorGroupTests.h"
   23.34 +#include "DecryptAttachPrivateKeyTrustedTests.h"
   23.35 +#include "TrustwordsTests.h"
   23.36 +#include "ReencryptPlusExtraKeysTests.h"
   23.37 +#include "MapAsn1Tests.h"
   23.38  #include "DecorateTests.h"
   23.39 -#include "UserIdCollisionTests.h"
   23.40 -#include "ReencryptPlusExtraKeysTests.h"
   23.41 -#include "BlacklistTests.h"
   23.42 -#include "AppleMailTests.h"
   23.43  #include "MessageTwoPointOhTests.h"
   23.44 -#include "IdentityListTests.h"
   23.45 -#include "I18nTests.h"
   23.46 -#include "Engine463Tests.h"
   23.47 -#include "DecryptAttachPrivateKeyUntrustedTests.h"
   23.48 -#include "BCCTests.h"
   23.49 -#include "LeastColorGroupTests.h"
   23.50 -#include "BlacklistAcceptNewKeyTests.h"
   23.51 -#include "MessageApiTests.h"
   23.52 -#include "StringlistTests.h"
   23.53 +#include "CrashdumpTests.h"
   23.54  #include "StringpairListTests.h"
   23.55 +#include "EncryptForIdentityTests.h"
   23.56 +#include "KeyResetMessageTests.h"
   23.57  #include "TrustManipulationTests.h"
   23.58  #include "SyncTests.h"
   23.59 -#include "EncryptAttachPrivateKeyTests.h"
   23.60 -#include "BloblistTests.h"
   23.61 -#include "KeyResetMessageTests.h"
   23.62 -#include "SequenceTests.h"
   23.63 -#include "TrustwordsTests.h"
   23.64 -#include "RevokeRegenAttachTests.h"
   23.65 -#include "EncryptMissingPrivateKeyTests.h"
   23.66 -#include "PepSubjectReceivedTests.h"
   23.67 -#include "KeyeditTests.h"
   23.68 -#include "MapAsn1Tests.h"
   23.69 -#include "PgpBinaryTests.h"
   23.70 -#include "DecryptAttachPrivateKeyTrustedTests.h"
   23.71 -#include "MessageNullFromTests.h"
   23.72 -#include "MimeTests.h"
   23.73 -#include "PgpListKeysTests.h"
   23.74 -#include "NewUpdateIdAndMyselfTests.h"
   23.75 -#include "EncryptForIdentityTests.h"
   23.76 -#include "CrashdumpTests.h"
   23.77 -#include "CaseAndDotAddressTests.h"
   23.78 -#include "LeastCommonDenomColorTests.h"
   23.79 -#include "ExternalRevokeTests.h"
   23.80 -#include "UserIDAliasTests.h"
   23.81 +#include "AppleMailTests.h"
   23.82  
   23.83  
   23.84  const char* SuiteMaker::all_suites[] = {
   23.85 +    "MimeTests",
   23.86 +    "UserIdCollisionTests",
   23.87 +    "Engine463Tests",
   23.88 +    "BloblistTests",
   23.89 +    "NewUpdateIdAndMyselfTests",
   23.90 +    "I18nTests",
   23.91 +    "IdentityListTests",
   23.92 +    "PgpBinaryTests",
   23.93 +    "MessageNullFromTests",
   23.94 +    "LeastCommonDenomColorTests",
   23.95 +    "StringlistTests",
   23.96 +    "PgpListKeysTests",
   23.97 +    "MessageApiTests",
   23.98 +    "EncryptMissingPrivateKeyTests",
   23.99 +    "CaseAndDotAddressTests",
  23.100 +    "UserIDAliasTests",
  23.101 +    "BCCTests",
  23.102 +    "BlacklistAcceptNewKeyTests",
  23.103 +    "DecryptAttachPrivateKeyUntrustedTests",
  23.104 +    "BlacklistTests",
  23.105 +    "RevokeRegenAttachTests",
  23.106 +    "PepSubjectReceivedTests",
  23.107 +    "SequenceTests",
  23.108 +    "EncryptAttachPrivateKeyTests",
  23.109 +    "ExternalRevokeTests",
  23.110 +    "KeyeditTests",
  23.111 +    "LeastColorGroupTests",
  23.112 +    "DecryptAttachPrivateKeyTrustedTests",
  23.113 +    "TrustwordsTests",
  23.114 +    "ReencryptPlusExtraKeysTests",
  23.115 +    "MapAsn1Tests",
  23.116      "DecorateTests",
  23.117 -    "UserIdCollisionTests",
  23.118 -    "ReencryptPlusExtraKeysTests",
  23.119 -    "BlacklistTests",
  23.120 -    "AppleMailTests",
  23.121      "MessageTwoPointOhTests",
  23.122 -    "IdentityListTests",
  23.123 -    "I18nTests",
  23.124 -    "Engine463Tests",
  23.125 -    "DecryptAttachPrivateKeyUntrustedTests",
  23.126 -    "BCCTests",
  23.127 -    "LeastColorGroupTests",
  23.128 -    "BlacklistAcceptNewKeyTests",
  23.129 -    "MessageApiTests",
  23.130 -    "StringlistTests",
  23.131 +    "CrashdumpTests",
  23.132      "StringpairListTests",
  23.133 +    "EncryptForIdentityTests",
  23.134 +    "KeyResetMessageTests",
  23.135      "TrustManipulationTests",
  23.136      "SyncTests",
  23.137 -    "EncryptAttachPrivateKeyTests",
  23.138 -    "BloblistTests",
  23.139 -    "KeyResetMessageTests",
  23.140 -    "SequenceTests",
  23.141 -    "TrustwordsTests",
  23.142 -    "RevokeRegenAttachTests",
  23.143 -    "EncryptMissingPrivateKeyTests",
  23.144 -    "PepSubjectReceivedTests",
  23.145 -    "KeyeditTests",
  23.146 -    "MapAsn1Tests",
  23.147 -    "PgpBinaryTests",
  23.148 -    "DecryptAttachPrivateKeyTrustedTests",
  23.149 -    "MessageNullFromTests",
  23.150 -    "MimeTests",
  23.151 -    "PgpListKeysTests",
  23.152 -    "NewUpdateIdAndMyselfTests",
  23.153 -    "EncryptForIdentityTests",
  23.154 -    "CrashdumpTests",
  23.155 -    "CaseAndDotAddressTests",
  23.156 -    "LeastCommonDenomColorTests",
  23.157 -    "ExternalRevokeTests",
  23.158 -    "UserIDAliasTests",
  23.159 +    "AppleMailTests",
  23.160  };
  23.161  
  23.162  // This file is generated, so magic constants are ok.
  23.163  int SuiteMaker::num_suites = 40;
  23.164  
  23.165  void SuiteMaker::suitemaker_build(const char* test_class_name, const char* test_home, Test::Suite** test_suite) {
  23.166 -    if (strcmp(test_class_name, "DecorateTests") == 0)
  23.167 -        *test_suite = new DecorateTests(test_class_name, test_home);
  23.168 +    if (strcmp(test_class_name, "MimeTests") == 0)
  23.169 +        *test_suite = new MimeTests(test_class_name, test_home);
  23.170      else if (strcmp(test_class_name, "UserIdCollisionTests") == 0)
  23.171          *test_suite = new UserIdCollisionTests(test_class_name, test_home);
  23.172 +    else if (strcmp(test_class_name, "Engine463Tests") == 0)
  23.173 +        *test_suite = new Engine463Tests(test_class_name, test_home);
  23.174 +    else if (strcmp(test_class_name, "BloblistTests") == 0)
  23.175 +        *test_suite = new BloblistTests(test_class_name, test_home);
  23.176 +    else if (strcmp(test_class_name, "NewUpdateIdAndMyselfTests") == 0)
  23.177 +        *test_suite = new NewUpdateIdAndMyselfTests(test_class_name, test_home);
  23.178 +    else if (strcmp(test_class_name, "I18nTests") == 0)
  23.179 +        *test_suite = new I18nTests(test_class_name, test_home);
  23.180 +    else if (strcmp(test_class_name, "IdentityListTests") == 0)
  23.181 +        *test_suite = new IdentityListTests(test_class_name, test_home);
  23.182 +    else if (strcmp(test_class_name, "PgpBinaryTests") == 0)
  23.183 +        *test_suite = new PgpBinaryTests(test_class_name, test_home);
  23.184 +    else if (strcmp(test_class_name, "MessageNullFromTests") == 0)
  23.185 +        *test_suite = new MessageNullFromTests(test_class_name, test_home);
  23.186 +    else if (strcmp(test_class_name, "LeastCommonDenomColorTests") == 0)
  23.187 +        *test_suite = new LeastCommonDenomColorTests(test_class_name, test_home);
  23.188 +    else if (strcmp(test_class_name, "StringlistTests") == 0)
  23.189 +        *test_suite = new StringlistTests(test_class_name, test_home);
  23.190 +    else if (strcmp(test_class_name, "PgpListKeysTests") == 0)
  23.191 +        *test_suite = new PgpListKeysTests(test_class_name, test_home);
  23.192 +    else if (strcmp(test_class_name, "MessageApiTests") == 0)
  23.193 +        *test_suite = new MessageApiTests(test_class_name, test_home);
  23.194 +    else if (strcmp(test_class_name, "EncryptMissingPrivateKeyTests") == 0)
  23.195 +        *test_suite = new EncryptMissingPrivateKeyTests(test_class_name, test_home);
  23.196 +    else if (strcmp(test_class_name, "CaseAndDotAddressTests") == 0)
  23.197 +        *test_suite = new CaseAndDotAddressTests(test_class_name, test_home);
  23.198 +    else if (strcmp(test_class_name, "UserIDAliasTests") == 0)
  23.199 +        *test_suite = new UserIDAliasTests(test_class_name, test_home);
  23.200 +    else if (strcmp(test_class_name, "BCCTests") == 0)
  23.201 +        *test_suite = new BCCTests(test_class_name, test_home);
  23.202 +    else if (strcmp(test_class_name, "BlacklistAcceptNewKeyTests") == 0)
  23.203 +        *test_suite = new BlacklistAcceptNewKeyTests(test_class_name, test_home);
  23.204 +    else if (strcmp(test_class_name, "DecryptAttachPrivateKeyUntrustedTests") == 0)
  23.205 +        *test_suite = new DecryptAttachPrivateKeyUntrustedTests(test_class_name, test_home);
  23.206 +    else if (strcmp(test_class_name, "BlacklistTests") == 0)
  23.207 +        *test_suite = new BlacklistTests(test_class_name, test_home);
  23.208 +    else if (strcmp(test_class_name, "RevokeRegenAttachTests") == 0)
  23.209 +        *test_suite = new RevokeRegenAttachTests(test_class_name, test_home);
  23.210 +    else if (strcmp(test_class_name, "PepSubjectReceivedTests") == 0)
  23.211 +        *test_suite = new PepSubjectReceivedTests(test_class_name, test_home);
  23.212 +    else if (strcmp(test_class_name, "SequenceTests") == 0)
  23.213 +        *test_suite = new SequenceTests(test_class_name, test_home);
  23.214 +    else if (strcmp(test_class_name, "EncryptAttachPrivateKeyTests") == 0)
  23.215 +        *test_suite = new EncryptAttachPrivateKeyTests(test_class_name, test_home);
  23.216 +    else if (strcmp(test_class_name, "ExternalRevokeTests") == 0)
  23.217 +        *test_suite = new ExternalRevokeTests(test_class_name, test_home);
  23.218 +    else if (strcmp(test_class_name, "KeyeditTests") == 0)
  23.219 +        *test_suite = new KeyeditTests(test_class_name, test_home);
  23.220 +    else if (strcmp(test_class_name, "LeastColorGroupTests") == 0)
  23.221 +        *test_suite = new LeastColorGroupTests(test_class_name, test_home);
  23.222 +    else if (strcmp(test_class_name, "DecryptAttachPrivateKeyTrustedTests") == 0)
  23.223 +        *test_suite = new DecryptAttachPrivateKeyTrustedTests(test_class_name, test_home);
  23.224 +    else if (strcmp(test_class_name, "TrustwordsTests") == 0)
  23.225 +        *test_suite = new TrustwordsTests(test_class_name, test_home);
  23.226      else if (strcmp(test_class_name, "ReencryptPlusExtraKeysTests") == 0)
  23.227          *test_suite = new ReencryptPlusExtraKeysTests(test_class_name, test_home);
  23.228 -    else if (strcmp(test_class_name, "BlacklistTests") == 0)
  23.229 -        *test_suite = new BlacklistTests(test_class_name, test_home);
  23.230 -    else if (strcmp(test_class_name, "AppleMailTests") == 0)
  23.231 -        *test_suite = new AppleMailTests(test_class_name, test_home);
  23.232 +    else if (strcmp(test_class_name, "MapAsn1Tests") == 0)
  23.233 +        *test_suite = new MapAsn1Tests(test_class_name, test_home);
  23.234 +    else if (strcmp(test_class_name, "DecorateTests") == 0)
  23.235 +        *test_suite = new DecorateTests(test_class_name, test_home);
  23.236      else if (strcmp(test_class_name, "MessageTwoPointOhTests") == 0)
  23.237          *test_suite = new MessageTwoPointOhTests(test_class_name, test_home);
  23.238 -    else if (strcmp(test_class_name, "IdentityListTests") == 0)
  23.239 -        *test_suite = new IdentityListTests(test_class_name, test_home);
  23.240 -    else if (strcmp(test_class_name, "I18nTests") == 0)
  23.241 -        *test_suite = new I18nTests(test_class_name, test_home);
  23.242 -    else if (strcmp(test_class_name, "Engine463Tests") == 0)
  23.243 -        *test_suite = new Engine463Tests(test_class_name, test_home);
  23.244 -    else if (strcmp(test_class_name, "DecryptAttachPrivateKeyUntrustedTests") == 0)
  23.245 -        *test_suite = new DecryptAttachPrivateKeyUntrustedTests(test_class_name, test_home);
  23.246 -    else if (strcmp(test_class_name, "BCCTests") == 0)
  23.247 -        *test_suite = new BCCTests(test_class_name, test_home);
  23.248 -    else if (strcmp(test_class_name, "LeastColorGroupTests") == 0)
  23.249 -        *test_suite = new LeastColorGroupTests(test_class_name, test_home);
  23.250 -    else if (strcmp(test_class_name, "BlacklistAcceptNewKeyTests") == 0)
  23.251 -        *test_suite = new BlacklistAcceptNewKeyTests(test_class_name, test_home);
  23.252 -    else if (strcmp(test_class_name, "MessageApiTests") == 0)
  23.253 -        *test_suite = new MessageApiTests(test_class_name, test_home);
  23.254 -    else if (strcmp(test_class_name, "StringlistTests") == 0)
  23.255 -        *test_suite = new StringlistTests(test_class_name, test_home);
  23.256 +    else if (strcmp(test_class_name, "CrashdumpTests") == 0)
  23.257 +        *test_suite = new CrashdumpTests(test_class_name, test_home);
  23.258      else if (strcmp(test_class_name, "StringpairListTests") == 0)
  23.259          *test_suite = new StringpairListTests(test_class_name, test_home);
  23.260 +    else if (strcmp(test_class_name, "EncryptForIdentityTests") == 0)
  23.261 +        *test_suite = new EncryptForIdentityTests(test_class_name, test_home);
  23.262 +    else if (strcmp(test_class_name, "KeyResetMessageTests") == 0)
  23.263 +        *test_suite = new KeyResetMessageTests(test_class_name, test_home);
  23.264      else if (strcmp(test_class_name, "TrustManipulationTests") == 0)
  23.265          *test_suite = new TrustManipulationTests(test_class_name, test_home);
  23.266      else if (strcmp(test_class_name, "SyncTests") == 0)
  23.267          *test_suite = new SyncTests(test_class_name, test_home);
  23.268 -    else if (strcmp(test_class_name, "EncryptAttachPrivateKeyTests") == 0)
  23.269 -        *test_suite = new EncryptAttachPrivateKeyTests(test_class_name, test_home);
  23.270 -    else if (strcmp(test_class_name, "BloblistTests") == 0)
  23.271 -        *test_suite = new BloblistTests(test_class_name, test_home);
  23.272 -    else if (strcmp(test_class_name, "KeyResetMessageTests") == 0)
  23.273 -        *test_suite = new KeyResetMessageTests(test_class_name, test_home);
  23.274 -    else if (strcmp(test_class_name, "SequenceTests") == 0)
  23.275 -        *test_suite = new SequenceTests(test_class_name, test_home);
  23.276 -    else if (strcmp(test_class_name, "TrustwordsTests") == 0)
  23.277 -        *test_suite = new TrustwordsTests(test_class_name, test_home);
  23.278 -    else if (strcmp(test_class_name, "RevokeRegenAttachTests") == 0)
  23.279 -        *test_suite = new RevokeRegenAttachTests(test_class_name, test_home);
  23.280 -    else if (strcmp(test_class_name, "EncryptMissingPrivateKeyTests") == 0)
  23.281 -        *test_suite = new EncryptMissingPrivateKeyTests(test_class_name, test_home);
  23.282 -    else if (strcmp(test_class_name, "PepSubjectReceivedTests") == 0)
  23.283 -        *test_suite = new PepSubjectReceivedTests(test_class_name, test_home);
  23.284 -    else if (strcmp(test_class_name, "KeyeditTests") == 0)
  23.285 -        *test_suite = new KeyeditTests(test_class_name, test_home);
  23.286 -    else if (strcmp(test_class_name, "MapAsn1Tests") == 0)
  23.287 -        *test_suite = new MapAsn1Tests(test_class_name, test_home);
  23.288 -    else if (strcmp(test_class_name, "PgpBinaryTests") == 0)
  23.289 -        *test_suite = new PgpBinaryTests(test_class_name, test_home);
  23.290 -    else if (strcmp(test_class_name, "DecryptAttachPrivateKeyTrustedTests") == 0)
  23.291 -        *test_suite = new DecryptAttachPrivateKeyTrustedTests(test_class_name, test_home);
  23.292 -    else if (strcmp(test_class_name, "MessageNullFromTests") == 0)
  23.293 -        *test_suite = new MessageNullFromTests(test_class_name, test_home);
  23.294 -    else if (strcmp(test_class_name, "MimeTests") == 0)
  23.295 -        *test_suite = new MimeTests(test_class_name, test_home);
  23.296 -    else if (strcmp(test_class_name, "PgpListKeysTests") == 0)
  23.297 -        *test_suite = new PgpListKeysTests(test_class_name, test_home);
  23.298 -    else if (strcmp(test_class_name, "NewUpdateIdAndMyselfTests") == 0)
  23.299 -        *test_suite = new NewUpdateIdAndMyselfTests(test_class_name, test_home);
  23.300 -    else if (strcmp(test_class_name, "EncryptForIdentityTests") == 0)
  23.301 -        *test_suite = new EncryptForIdentityTests(test_class_name, test_home);
  23.302 -    else if (strcmp(test_class_name, "CrashdumpTests") == 0)
  23.303 -        *test_suite = new CrashdumpTests(test_class_name, test_home);
  23.304 -    else if (strcmp(test_class_name, "CaseAndDotAddressTests") == 0)
  23.305 -        *test_suite = new CaseAndDotAddressTests(test_class_name, test_home);
  23.306 -    else if (strcmp(test_class_name, "LeastCommonDenomColorTests") == 0)
  23.307 -        *test_suite = new LeastCommonDenomColorTests(test_class_name, test_home);
  23.308 -    else if (strcmp(test_class_name, "ExternalRevokeTests") == 0)
  23.309 -        *test_suite = new ExternalRevokeTests(test_class_name, test_home);
  23.310 -    else if (strcmp(test_class_name, "UserIDAliasTests") == 0)
  23.311 -        *test_suite = new UserIDAliasTests(test_class_name, test_home);
  23.312 +    else if (strcmp(test_class_name, "AppleMailTests") == 0)
  23.313 +        *test_suite = new AppleMailTests(test_class_name, test_home);
  23.314  }
  23.315  
  23.316  void SuiteMaker::suitemaker_buildlist(const char** test_class_names, int num_to_run, const char* test_home, std::vector<Test::Suite*>& test_suites) {
    24.1 --- a/test/src/engine_tests/BlacklistTests.cc	Sat Oct 06 08:57:27 2018 +0200
    24.2 +++ b/test/src/engine_tests/BlacklistTests.cc	Mon Oct 29 11:16:46 2018 +0100
    24.3 @@ -143,6 +143,25 @@
    24.4               << "Expected it to be empty or (possibly) " << bl_fpr_2 << endl;
    24.5      TEST_ASSERT_MSG((!(blacklisted_identity->fpr) || blacklisted_identity->fpr[0] == '\0'|| (strcmp(blacklisted_identity->fpr, bl_fpr_2) == 0)), "!(blacklisted_identity->fpr) || blacklisted_identity->fpr[0] == '\0'|| (strcmp(blacklisted_identity->fpr, bl_fpr_2) == 0)");
    24.6  
    24.7 +    pEp_identity *me = new_identity("alice@peptest.ch", NULL, "423", "Alice Miller");
    24.8 +    TEST_ASSERT(me);
    24.9 +    PEP_STATUS status24 = myself(session, me);
   24.10 +    TEST_ASSERT_MSG((status24 == PEP_STATUS_OK), "myself: status24 == PEP_STATUS_OK");
   24.11 +
   24.12 +    message *msg23 = new_message(PEP_dir_outgoing);
   24.13 +    TEST_ASSERT(msg23);
   24.14 +    msg23->from = me;
   24.15 +    msg23->to = new_identity_list(identity_dup(blacklisted_identity));
   24.16 +    TEST_ASSERT(msg23->to && msg23->to->ident);
   24.17 +    PEP_rating rating23;
   24.18 +
   24.19 +    cout << "testing outgoing_message_rating() with blacklisted key in to\n";
   24.20 +    PEP_STATUS status23 = outgoing_message_rating(session, msg23, &rating23);
   24.21 +    TEST_ASSERT_MSG((status23 == PEP_STATUS_OK), "outgoing_message_rating: status must be PEP_STATUS_OK");
   24.22 +    TEST_ASSERT_MSG((rating23 == PEP_rating_unencrypted), "outgoing_message_rating: rating must be PEP_rating_unencrypted");
   24.23 +
   24.24 +    free_message(msg23);
   24.25 +
   24.26      const string keytext2 = slurp("blacklisted_pub2.asc");
   24.27      PEP_STATUS status14 = import_key(session, keytext2.c_str(), keytext2.length(), NULL);
   24.28      
    25.1 --- a/test/src/engine_tests/SyncTests.cc	Sat Oct 06 08:57:27 2018 +0200
    25.2 +++ b/test/src/engine_tests/SyncTests.cc	Mon Oct 29 11:16:46 2018 +0100
    25.3 @@ -24,7 +24,6 @@
    25.4  }
    25.5  
    25.6  PEP_STATUS Sync_Adapter::notifyHandshake(
    25.7 -        void *obj,
    25.8          pEp_identity *me,
    25.9          pEp_identity *partner,
   25.10          sync_handshake_signal signal
   25.11 @@ -97,6 +96,8 @@
   25.12  
   25.13      for (bloblist_t *b = msg->attachments; b && b->value; b = b->next) {
   25.14          if (b->mime_type && strcasecmp(b->mime_type, "application/pEp.sync") == 0) {
   25.15 +            assert(msg->from && msg->from->address && msg->from->username);
   25.16 +            cout << "<!-- " << msg->from->username << " <" << msg->from->address << "> -->\n";
   25.17              char *text = NULL;
   25.18              PEP_STATUS status = PER_to_XER_Sync_msg(msg->attachments->value, msg->attachments->size, &text);
   25.19              assert(status == PEP_STATUS_OK);
   25.20 @@ -141,7 +142,7 @@
   25.21      cout << "initialize sync and start first state machine\n";
   25.22      status = register_sync_callbacks(
   25.23              sync,
   25.24 -            &adapter.q,
   25.25 +            (void *) &adapter.q,
   25.26              Sync_Adapter::notifyHandshake,
   25.27              Sync_Adapter::retrieve_next_sync_event
   25.28          );