merged in default import_key_2.1
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Thu, 28 May 2020 20:17:46 +0200
branchimport_key_2.1
changeset 4718a6c15bc68c47
parent 4717 333a32f6f7b3
parent 4713 6a2d68d3e7db
child 4726 c3a9837c15e6
merged in default
     1.1 --- a/build-windows/pEpEngine.vcxproj	Thu May 28 20:17:10 2020 +0200
     1.2 +++ b/build-windows/pEpEngine.vcxproj	Thu May 28 20:17:46 2020 +0200
     1.3 @@ -139,6 +139,7 @@
     1.4      <ClCompile Include="..\src\etpan_mime.c" />
     1.5      <ClCompile Include="..\src\growing_buf.c" />
     1.6      <ClCompile Include="..\src\identity_list.c" />
     1.7 +    <ClCompile Include="..\src\internal_format.c" />
     1.8      <ClCompile Include="..\src\keymanagement.c" />
     1.9      <ClCompile Include="..\src\keyreset_command.c" />
    1.10      <ClCompile Include="..\src\KeySync_fsm.c" />
    1.11 @@ -180,6 +181,7 @@
    1.12      <ClInclude Include="..\src\fsm_common.h" />
    1.13      <ClInclude Include="..\src\growing_buf.h" />
    1.14      <ClInclude Include="..\src\identity_list.h" />
    1.15 +    <ClInclude Include="..\src\internal_format.h" />
    1.16      <ClInclude Include="..\src\keymanagement.h" />
    1.17      <ClInclude Include="..\src\KeySync_fsm.h" />
    1.18      <ClInclude Include="..\src\key_reset.h" />
     2.1 --- a/build-windows/pEpEngine.vcxproj.filters	Thu May 28 20:17:10 2020 +0200
     2.2 +++ b/build-windows/pEpEngine.vcxproj.filters	Thu May 28 20:17:46 2020 +0200
     2.3 @@ -126,6 +126,9 @@
     2.4      <ClCompile Include="..\src\distribution_codec.c">
     2.5        <Filter>Quelldateien</Filter>
     2.6      </ClCompile>
     2.7 +    <ClCompile Include="..\src\internal_format.c">
     2.8 +      <Filter>Quelldateien</Filter>
     2.9 +    </ClCompile>
    2.10    </ItemGroup>
    2.11    <ItemGroup>
    2.12      <ClInclude Include="..\src\keymanagement.h">
    2.13 @@ -266,6 +269,9 @@
    2.14      <ClInclude Include="..\src\sync_codec.h">
    2.15        <Filter>Headerdateien</Filter>
    2.16      </ClInclude>
    2.17 +    <ClInclude Include="..\src\internal_format.h">
    2.18 +      <Filter>Headerdateien</Filter>
    2.19 +    </ClInclude>
    2.20    </ItemGroup>
    2.21    <ItemGroup>
    2.22      <Text Include="..\LICENSE.txt" />
     3.1 --- a/doc/build-fedora.md	Thu May 28 20:17:10 2020 +0200
     3.2 +++ b/doc/build-fedora.md	Thu May 28 20:17:46 2020 +0200
     3.3 @@ -48,7 +48,6 @@
     3.4  mkdir -p ~/code/pep-engine
     3.5  hg clone https://pep.foundation/dev/repos/pEpEngine/ ~/code/pep-engine
     3.6  cd ~/code/pep-engine
     3.7 -hg update sync
     3.8  mkdir ~/code/pep-engine/build
     3.9  ~~~
    3.10  
     4.1 --- a/doc/build-macos.md	Thu May 28 20:17:10 2020 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,161 +0,0 @@
     4.4 -<!-- Copyright 2015-2017, pEp foundation, Switzerland
     4.5 -This file is part of the pEp Engine
     4.6 -This file may be used under the terms of the Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) License
     4.7 -See CC_BY-SA.txt -->
     4.8 -
     4.9 -# Build instructions for macOS Sierra
    4.10 -
    4.11 -# Installing packaged dependencies
    4.12 -You will find instructions for using either Macports or Homebrew below to install the compile-time dependencies.
    4.13 -
    4.14 -## MacPorts
    4.15 -Install MacPorts according to the instructions found [here](https://www.macports.org/install.php).
    4.16 -Ensure that Macports' binary paths (`/opt/local/bin` and `/opt/local/sbin`) are in your `PATH` environment variable.
    4.17 -
    4.18 -~~~
    4.19 -# general
    4.20 -sudo port install mercurial
    4.21 -# YML2
    4.22 -sudo port install py27-lxml
    4.23 -# libetpan
    4.24 -sudo port install git autoconf automake libtool
    4.25 -# asn1c
    4.26 -sudo port install asn1c
    4.27 -# engine
    4.28 -sudo port install gpgme
    4.29 -~~~
    4.30 -
    4.31 -Ensure that `python` is Python 2.7:
    4.32 -
    4.33 -~~~
    4.34 -sudo port select python python27
    4.35 -~~~
    4.36 -
    4.37 -## Homebrew
    4.38 -Install Homebrew according to the instructions found [here](https://docs.brew.sh/Installation.html).
    4.39 -Ensure that Homebrew's binary path (`/usr/local/bin`) is in your `PATH` environment variable.
    4.40 -
    4.41 -~~~
    4.42 -# general
    4.43 -brew install mercurial
    4.44 -# YML2
    4.45 -# If you don't have pip with your Python 2 distribution, you can install it with brew
    4.46 -brew install python
    4.47 -pip2 install --user lxml
    4.48 -# libetpan
    4.49 -brew install git autoconf automake libtool
    4.50 -# asn1c
    4.51 -brew install asn1c
    4.52 -# engine
    4.53 -brew install gpgme
    4.54 -~~~
    4.55 -
    4.56 -# Installing unpackaged dependencies
    4.57 -## YML2
    4.58 -To check if lxml is properly installed, you can use this lxml "hello world" command:
    4.59 -
    4.60 -~~~
    4.61 -python2 -c 'from lxml import etree; root = etree.Element("root"); print(root.tag)'
    4.62 -~~~
    4.63 -
    4.64 -It should generate the following output:
    4.65 -
    4.66 -~~~
    4.67 -root
    4.68 -~~~
    4.69 -
    4.70 -~~~
    4.71 -mkdir -p ~/code/yml2
    4.72 -hg clone https://pep.foundation/dev/repos/yml2/ ~/code/yml2
    4.73 -~~~
    4.74 -
    4.75 -## libetpan
    4.76 -pEp Engine requires libetpan with a set of patches that have not been upstreamed yet.
    4.77 -
    4.78 -~~~
    4.79 -mkdir -p ~/code/libetpan
    4.80 -git clone https://github.com/fdik/libetpan ~/code/libetpan
    4.81 -cd ~/code/libetpan
    4.82 -mkdir ~/code/libetpan/build
    4.83 -./autogen.sh --prefix="$HOME/code/libetpan/build"
    4.84 -make
    4.85 -make install
    4.86 -~~~
    4.87 -
    4.88 -## GPGME
    4.89 -The MacPorts-packaged GPGME links to a version of GNU libiconv that has files in the same include/library paths as GPGME. This version of libiconv must not be visible to the linker when the pEp Engine is build or run.
    4.90 -
    4.91 -Thus the files of the GPGME distribution will have to be manually copied to separate include/library folders, so that no include or library paths used for building the pEp Engine contains files of MacPorts' libiconv distribution.
    4.92 -
    4.93 -~~~
    4.94 -mkdir -p ~/code/gpgme/build/include
    4.95 -cp /opt/local/include/gpg*.h ~/code/gpgme/build/include
    4.96 -mkdir -p ~/code/gpgme/build/lib
    4.97 -cp -r /opt/local/lib/libgpg* ~/code/gpgme/build/lib
    4.98 -~~~
    4.99 -
   4.100 -It's of course possible to skip MacPort's version, and use a self-compiled GPGME/GPG. The default build configuration assumes this case, and assumes you have installed your GPGME with `$(HOME)` as your prefix.
   4.101 -
   4.102 -# pEp Engine
   4.103 -
   4.104 -~~~
   4.105 -mkdir -p ~/code/pep-engine
   4.106 -hg clone https://pep.foundation/dev/repos/pEpEngine/ ~/code/pep-engine
   4.107 -cd ~/code/pep-engine
   4.108 -mkdir ~/code/pep-engine/build
   4.109 -~~~
   4.110 -
   4.111 -Edit the build configuration to your needs in `Makefile.conf`, or create a `local.conf` that sets any of the make variables documented in `Makefile.conf`. All the default values for the build configuration variables on each platform are documented in `Makefile.conf`.
   4.112 -
   4.113 -If a dependency is not found in your system's default include or library paths, you will have to specify the according paths in a make variable. Typically, this has to be done at least for YML2, and libetpan.
   4.114 -
   4.115 -For a more detailed explanation of the mechanics of these build configuration files, and overriding defaults, see the comments in `Makefile.conf`.
   4.116 -
   4.117 -Below is a sample `./local.conf` file, for orientation.
   4.118 -
   4.119 -~~~
   4.120 -PREFIX=$(HOME)/code/engine/build
   4.121 -PER_MACHINE_DIRECTORY=$(PREFIX)/share/pEp
   4.122 -
   4.123 -YML2_PATH=$(HOME)/code/yml2
   4.124 -
   4.125 -ETPAN_LIB=-L$(HOME)/code/libetpan/build/lib
   4.126 -ETPAN_INC=-I$(HOME)/code/libetpan/build/include
   4.127 -
   4.128 -GPGME_LIB=-L$(HOME)/lib
   4.129 -GPGME_INC=-I$(HOME)/include
   4.130 -~~~
   4.131 -
   4.132 -The engine is built as follows:
   4.133 -
   4.134 -~~~
   4.135 -make all
   4.136 -make db
   4.137 -~~~
   4.138 -
   4.139 -If your build fails with an error message similar to the following:
   4.140 -
   4.141 -~~~
   4.142 -  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 477, in _parse_localename
   4.143 -    raise ValueError, 'unknown locale: %s' % localename
   4.144 -ValueError: unknown locale: UTF-8
   4.145 -~~~
   4.146 -
   4.147 -or any other locale-related Python error, make sure Python does not have any locale-related environment variables set.
   4.148 -Usually, `unset LC_CTYPE` is sufficient to take care of the problem, but it depends on your macOS's regional and language settings and which terminal emulator you use.
   4.149 -This is a bug in Python, see [https://bugs.python.org/issue18378#msg215215](https://bugs.python.org/issue18378#msg215215).
   4.150 -
   4.151 -The unit tests can be run without the engine library being installed, however `system.db` must be installed:
   4.152 -
   4.153 -~~~
   4.154 -make -C db install
   4.155 -~~~
   4.156 -
   4.157 -Since `system.db` rarely changes, its installation is not needed for every build.
   4.158 -
   4.159 -Tests can be compiled and executed with the following commands:
   4.160 -
   4.161 -~~~
   4.162 -make -C test compile
   4.163 -make test
   4.164 -~~~
     5.1 --- a/doc/build-netpgp.md	Thu May 28 20:17:10 2020 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,43 +0,0 @@
     5.4 -# Using NetPGP instead of GnuPG
     5.5 -## Prepare
     5.6 -
     5.7 -Get OpenSSL:
     5.8 -curl -O https://www.openssl.org/source/openssl-1.1.0f.tar.gz
     5.9 -
    5.10 -Build it using the openssl-for-ios build script:
    5.11 -git clone https://github.com/sinofool/build-openssl-ios/ .
    5.12 -
    5.13 -
    5.14 -
    5.15 - and build/install it as shared library.
    5.16 -
    5.17 -```
    5.18 -wget https://www.openssl.org/source/old/1.0.1/openssl-1.0.1u.tar.gz
    5.19 -tar xvfz openssl-1.0.1u.tar.gz
    5.20 -cd openssl-1.0.1u
    5.21 -./Configure darwin64-x86_64-cc --prefix=$HOME shared
    5.22 -make install
    5.23 -```
    5.24 -
    5.25 -Get and autoconf NetPGP
    5.26 -
    5.27 -```
    5.28 -cd $SRC
    5.29 -hg clone https://pep.foundation/dev/repos/netpgp-et/
    5.30 -cd netpgp-et
    5.31 -autoreconf -i
    5.32 -```
    5.33 -
    5.34 -## Build
    5.35 -
    5.36 -Important : LDFLAGS is set to help finding OpenSSL shared lib. If not set,
    5.37 -system's default libcrypto may silently be used instead, causing memory
    5.38 -corruption or crash at runtime.
    5.39 -
    5.40 -```
    5.41 -mkdir netpgp_debug
    5.42 -cd netpgp_debug
    5.43 -$SRC/netpgp-et/configure --with-openssl=$HOME --prefix=$HOME CPPFLAGS=-DDEBUG CXXFLAGS="-g -O0" LDFLAGS="-L${HOME}/lib"
    5.44 -make
    5.45 -make install
    5.46 -```
     6.1 --- a/doc/readme.md	Thu May 28 20:17:10 2020 +0200
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,58 +0,0 @@
     6.4 -<!-- Copyright 2015-2017, pEp foundation, Switzerland
     6.5 -This file is part of the pEp Engine
     6.6 -This file may be used under the terms of the Creative Commons Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) License
     6.7 -See CC_BY-SA.txt -->
     6.8 -
     6.9 -# Information about the pEp Engine
    6.10 -
    6.11 -# Dependencies
    6.12 -The p≡p Engine depends on the following projects:
    6.13 -
    6.14 -- run-time dependencies
    6.15 -  - One of the following OpenPGP implementations:
    6.16 -    - GnuPG version 2.1.17 or later with GPGME (at least version 1.7.0) [https://gnupg.org/](https://gnupg.org/)
    6.17 -    - For platforms not supporting pinentry (e.g. Android) - GnuPG version 2.0.30 with GPGME version 1.6.0 (or later) [https://gnupg.org/](https://gnupg.org/)
    6.18 -    - a fork of NetPGP, [https://pep.foundation/dev/repos/netpgp-et/](https://pep.foundation/dev/repos/netpgp-et/)
    6.19 -    - Sequoia, which in turn requires:
    6.20 -      - Rust
    6.21 -      - libnettle
    6.22 -  - One of the following MIME libraries:
    6.23 -    - a fork of libetpan, [https://github.com/fdik/libetpan](https://github.com/fdik/libetpan)
    6.24 -    - pEpMIME
    6.25 -  - zlib, [http://zlib.net/](http://zlib.net/)
    6.26 -  - libcurl (Only with NetPGP), [https://curl.haxx.se/libcurl/](https://curl.haxx.se/libcurl/)
    6.27 -  - libuuid, [https://www.kernel.org/pub/linux/utils/util-linux/](https://www.kernel.org/pub/linux/utils/util-linux/)
    6.28 -  - SQLite, [https://sqlite.org](https://sqlite.org)
    6.29 -  - OpenSSL (Only with NetPGP), [https://www.openssl.org](https://www.openssl.org)
    6.30 -- compile-time dependencies
    6.31 -  - asn1c (version v0.9.28), [http://lionet.info/asn1c/blog/](http://lionet.info/asn1c/blog/)
    6.32 -  - yml2, [https://fdik.org/yml//toolchain](https://fdik.org/yml//toolchain)
    6.33 -    - Python 3
    6.34 -    - LXML
    6.35 -  - One of the following build systems:
    6.36 -    - GNU make (on Linux and macOS)
    6.37 -    - MSBuild distributed with Microsoft Visual Studio 2015 (on Windows)
    6.38 -  - One of the following compilers for C and C++:
    6.39 -    - GNU GCC (on Linux)
    6.40 -    - Apple "clang" LLVM (on MacOS)
    6.41 -    - Microsoft MSVC/MSVC++ distributed with Microsoft Visual Studio 2015 (on Windows)
    6.42 -  - A script for compiling OpenSSL for iOS, [https://github.com/sinofool/build-openssl-ios/](https://github.com/sinofool/build-openssl-ios/)
    6.43 -  - binutils
    6.44 -
    6.45 -# The pEp Engine's databases
    6.46 -The p≡p Engine uses two databases:
    6.47 -
    6.48 -- the management database
    6.49 -  - `~/.pEp_management` on \*NIX
    6.50 -  - `%LOCALAPPDATA%\pEp\management.db` on Windows
    6.51 -- the Trustword database
    6.52 -  - `/usr/local/share/system.db` on \*NIX
    6.53 -  - `%ALLUSERSPROFILE%\pEp\system.db` on Windows
    6.54 -
    6.55 -The management db is created by the first call of `init()` of p≡p Engine.
    6.56 -It does not need to be created manually.
    6.57 -`system.db` is created by using the DDL in `db/create_system_db.sql`; the database content is created by `db/dic2csv.py` out of hunspell's dictionary packages (or something similar) and then imported using `sqlite3`'s `.import` command.
    6.58 -Dictionary files for different languages are part of the p≡p Engine source distribution.
    6.59 -
    6.60 -You can test the Trustwords in `system.db` using `db/trustwords.py`.
    6.61 -Both Python tools have a `--help` switch.
     7.1 --- a/doc/testing.md	Thu May 28 20:17:10 2020 +0200
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,2 +0,0 @@
     7.4 -# Testing
     7.5 -For the documentation of the tests, see `test/README.md`
     8.1 --- a/sync/sync.fsm	Thu May 28 20:17:10 2020 +0200
     8.2 +++ b/sync/sync.fsm	Thu May 28 20:17:46 2020 +0200
     8.3 @@ -423,12 +423,15 @@
     8.4  
     8.5          state HandshakingToJoinPhase1 {
     8.6              on Rollback {
     8.7 -                if sameNegotiation
     8.8 +                if sameNegotiation {
     8.9 +                    do untrustThisKey;
    8.10                      go Sole;
    8.11 +                }
    8.12              }
    8.13  
    8.14              on CommitReject {
    8.15                  if sameNegotiation {
    8.16 +                    do untrustThisKey;
    8.17                      do disable;
    8.18                      go End;
    8.19                  }
    8.20 @@ -533,13 +536,17 @@
    8.21              }
    8.22  
    8.23              on Rollback {
    8.24 -                if sameNegotiation
    8.25 +                if sameNegotiation {
    8.26 +                    do untrustThisKey;
    8.27                      go Grouped;
    8.28 +                }
    8.29              }
    8.30  
    8.31              on CommitReject {
    8.32 -                if sameNegotiation
    8.33 +                if sameNegotiation {
    8.34 +                    do untrustThisKey;
    8.35                      go Grouped;
    8.36 +                }
    8.37              }
    8.38  
    8.39              on CommitAccept {