Skip to content

Commit

Permalink
Updated crypto library (#47)
Browse files Browse the repository at this point in the history
* Updated build scripts and instructions
* updated legacy libs
* updated Linux libs
* Updated Windows & MacOS libs
* Added import key test
* bump version [ci skip]
  • Loading branch information
Scratch-net authored May 13, 2020
1 parent afcba3f commit a43a855
Show file tree
Hide file tree
Showing 106 changed files with 220 additions and 6,306 deletions.
8 changes: 4 additions & 4 deletions crypto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This README describes how to manage a new version of Virgil crypto.

- The current folder contains adopted cryptography functions for common cases.
- The wrapper folder contains the C wrapper, pre-build libraries and build scripts.
- `foundation`, `phe`, `ratchet` are auto generated libraries from [Virgil crypto C](https://github.com/VirgilSecurity/virgil-crypto-c).
- `foundation`, `phe` are auto generated libraries from [Virgil crypto C](https://github.com/VirgilSecurity/virgil-crypto-c).
- `build` folder contains docker files and scripts for build pre-build C libs.
- `pkg` folder contains pre-build C libs for different platforms.

Expand Down Expand Up @@ -53,7 +53,7 @@ To support older version amd64 gcc < 5 and clang < 7 with 2.14 Linux kernel, ex
- navigate to `./crypto/wrapper/build`
- build `docker build -t ccrypto -f Dockerfile_legacy .` image
- Build pre-build libraries
- run docker from the root project `docker run -it --rm -v $PWD:/app ccrypto bash`
- run docker from the project root `docker run -it --rm -v $PWD:/app ccrypto bash`
- run `pip install protobuf` command inside a docker container
- run `BRANCH={VIRGIL_CRYPTO_C_BRANCH} /app/crypto/wrapper/build/build_c_crypto.sh` script inside a docker container

Expand All @@ -72,12 +72,12 @@ Execute the following script from the root of the project
- Go to `./crypto/wrapper/build`
- build image `docker build -t ccrypto .`
- Build pre-build libraries
- run docker from root project `docker run -it --rm -v $PWD:/app ccrypto bash`
- run docker from the project root `docker run -it --rm -v $PWD:/app ccrypto bash`
- inside docker container `BRANCH={VIRGIL_CRYPTO_C_BRANCH} /app/crypto/wrapper/build/build_c_crypto.sh`

### Windows

Execute the following script from the root of the project
Execute the following script from the project root, make sure mingw-w64 is installed without spaces in its path

```bash
> ./crypto/wrapper/build/build_c_crypto.ps1 -branch={VIRGIL_CRYPTO_C_BRANCH}
Expand Down
186 changes: 186 additions & 0 deletions crypto/crypto_test.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion crypto/wrapper/build/Dockerfile_legacy
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ RUN cd && \
RUN yum install -y rh-python35

# ---------------------------------------------------------------------------
# GoLang 1.12
# GoLang 1.14
# ---------------------------------------------------------------------------
ENV GOLANG_VERSION 1.14.2
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
Expand Down
1 change: 1 addition & 0 deletions crypto/wrapper/build/build_c_crypto.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ $result=$(git clone -b $branch https://github.com/VirgilSecurity/virgil-crypto-c
-G "MinGW Makefiles" `
-DVIRGIL_WRAP_GO=OFF `
-DVIRGIL_LIB_PYTHIA=OFF `
-DVIRGIL_LIB_RATCHET=OFF `
-DVIRGIL_INSTALL_HDRS=ON `
-DVIRGIL_INSTALL_LIBS=ON `
-DVIRGIL_INSTALL_CMAKE=OFF `
Expand Down
6 changes: 3 additions & 3 deletions crypto/wrapper/build/update_codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ git clone -b $BRANCH https://github.com/VirgilSecurity/virgil-crypto-c.git $TEMP
RETRES=$?
echo $RETRES
if [ "$RETRES" == "0" ]; then
rm -rf $SCRIPT_FOLDER/../{ratchet,foundation,phe};
cp -R $TEMPDIR/wrappers/go/{ratchet,foundation,phe} $SCRIPT_FOLDER/../;
for i in $(grep -R "virgil/foundation" $SCRIPT_FOLDER/../{ratchet,foundation,phe} | cut -d ":" -f 1)
rm -rf $SCRIPT_FOLDER/../{foundation,phe};
cp -R $TEMPDIR/wrappers/go/{foundation,phe} $SCRIPT_FOLDER/../;
for i in $(grep -R "virgil/foundation" $SCRIPT_FOLDER/../{foundation,phe} | cut -d ":" -f 1)
do
echo $i
sed -i '' 's/virgil\/foundation/github.com\/VirgilSecurity\/virgil-sdk-go\/v6\/crypto\/wrapper\/foundation/g' $i
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ extern "C" {

#define VSC_VERSION_MINOR 15

#define VSC_VERSION_PATCH 0
#define VSC_VERSION_PATCH 2

#define VSC_VERSION_MAKE(major, minor, patch) ((major) * 10000 + (minor) * 100 + (patch))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.3.9.4 at Wed May 6 05:39:23 2020. */
/* Generated by nanopb-0.3.9.4 at Wed May 13 03:05:36 2020. */

#ifndef PB_VSCF_GROUPMESSAGE_PB_H_INCLUDED
#define PB_VSCF_GROUPMESSAGE_PB_H_INCLUDED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ extern "C" {

#define VSCF_VERSION_MINOR 15

#define VSCF_VERSION_PATCH 0
#define VSCF_VERSION_PATCH 2

#define VSCF_VERSION_MAKE(major, minor, patch) ((major) * 10000 + (minor) * 100 + (patch))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.3.9.4 at Wed May 6 05:39:23 2020. */
/* Generated by nanopb-0.3.9.4 at Wed May 13 03:05:36 2020. */

#ifndef PB_PHEMODELS_PB_H_INCLUDED
#define PB_PHEMODELS_PB_H_INCLUDED
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated nanopb header */
/* Generated by nanopb-0.3.9.4 at Wed May 6 05:39:23 2020. */
/* Generated by nanopb-0.3.9.4 at Wed May 13 03:05:36 2020. */

#ifndef PB_UOKMSMODELS_PB_H_INCLUDED
#define PB_UOKMSMODELS_PB_H_INCLUDED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ extern "C" {

#define VSCE_VERSION_MINOR 15

#define VSCE_VERSION_PATCH 0
#define VSCE_VERSION_PATCH 2

#define VSCE_VERSION_MAKE(major, minor, patch) ((major) * 10000 + (minor) * 100 + (patch))

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit a43a855

Please sign in to comment.