Skip to content

Commit

Permalink
v0.13.2
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrenkoAnton authored Mar 30, 2020
2 parents 6944bf1 + 9c8b2eb commit 31300b6
Show file tree
Hide file tree
Showing 64 changed files with 86 additions and 84 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ This package is available for PHP versions **7.2**, **7.3** and **7.4**.

- **Step #2.** Add the crypto extensions into your server with the following code and follow the instructions below:
```bash
sh vendor/virgil/crypto-wrapper/_extensions/setup.sh -all
sh vendor/virgil/crypto-wrapper/_extensions/setup.sh -all -vendor
```

## Additional information
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.3.10
v0.13.2
6 changes: 3 additions & 3 deletions _extensions/bin/lin/php7.2/virgil_crypto.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
extension=vscf_foundation_php7.2_v0.3.10
extension=vsce_phe_php7.2_v0.3.10
extension=vscp_pythia_php7.2_v0.3.10
extension=vscf_foundation_php7.2_v0.13.2
extension=vsce_phe_php7.2_v0.13.2
extension=vscp_pythia_php7.2_v0.13.2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions _extensions/bin/lin/php7.3/virgil_crypto.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
extension=vscf_foundation_php7.3_v0.3.10
extension=vsce_phe_php7.3_v0.3.10
extension=vscp_pythia_php7.3_v0.3.10
extension=vscf_foundation_php7.3_v0.13.2
extension=vsce_phe_php7.3_v0.13.2
extension=vscp_pythia_php7.3_v0.13.2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions _extensions/bin/lin/php7.4/virgil_crypto.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
extension=vscf_foundation_php7.4_v0.3.10
extension=vsce_phe_php7.4_v0.3.10
extension=vscp_pythia_php7.4_v0.3.10
extension=vscf_foundation_php7.4_v0.13.2
extension=vsce_phe_php7.4_v0.13.2
extension=vscp_pythia_php7.4_v0.13.2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions _extensions/bin/mac/php7.2/virgil_crypto.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
extension=vscf_foundation_php7.2_v0.3.10
extension=vsce_phe_php7.2_v0.3.10
extension=vscp_pythia_php7.2_v0.3.10
extension=vscf_foundation_php7.2_v0.13.2
extension=vsce_phe_php7.2_v0.13.2
extension=vscp_pythia_php7.2_v0.13.2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions _extensions/bin/mac/php7.3/virgil_crypto.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
extension=vscf_foundation_php7.3_v0.3.10
extension=vsce_phe_php7.3_v0.3.10
extension=vscp_pythia_php7.3_v0.3.10
extension=vscf_foundation_php7.3_v0.13.2
extension=vsce_phe_php7.3_v0.13.2
extension=vscp_pythia_php7.3_v0.13.2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions _extensions/bin/mac/php7.4/virgil_crypto.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
extension=vscf_foundation_php7.4_v0.3.10
extension=vsce_phe_php7.4_v0.3.10
extension=vscp_pythia_php7.4_v0.3.10
extension=vscf_foundation_php7.4_v0.13.2
extension=vsce_phe_php7.4_v0.13.2
extension=vscp_pythia_php7.4_v0.13.2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions _extensions/bin/win/php7.2/virgil_crypto.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
extension=vscf_foundation_php7.2_v0.3.10
extension=vsce_phe_php7.2_v0.3.10
extension=vscf_foundation_php7.2_v0.13.2
extension=vsce_phe_php7.2_v0.13.2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions _extensions/bin/win/php7.3/virgil_crypto.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
extension=vscf_foundation_php7.3_v0.3.10
extension=vsce_phe_php7.3_v0.3.10
extension=vscf_foundation_php7.3_v0.13.2
extension=vsce_phe_php7.3_v0.13.2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions _extensions/bin/win/php7.4/virgil_crypto.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
extension=vscf_foundation_php7.4_v0.3.10
extension=vsce_phe_php7.4_v0.3.10
extension=vscf_foundation_php7.4_v0.13.2
extension=vsce_phe_php7.4_v0.13.2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
72 changes: 37 additions & 35 deletions _extensions/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LOG_DELIMETR="----------"
init() {
ERR_LEVEL=0
INI_FILE_NAME="virgil_crypto.ini"
PATH_TO_BINS="_extensions/bin"
PATH_TO_BINS="bin"

ERR_LEVEL=0
IS_DEV=0
Expand All @@ -20,26 +20,26 @@ check_input() {
get_err "input_null"
fi

LIST_EXT=""

case "$1" in
"-all")
LIST_EXT="vscf_foundation_php vsce_phe_php vscp_pythia_php"
;;
*)
get_err "input_invalid" "$1"
;;
esac

case "$2" in
"vendor")
IS_DEP="vendor"
"-vendor")
IS_DEP="$(dirname $0)"
;;
*)
"")
IS_DEP=""
;;
*)
get_err "input_vendor" "$2"
;;
esac
s

get_success
}

Expand All @@ -53,7 +53,7 @@ get_err() {
ERR_MSG="Invalid OS: $2"
;;
package-v)
ERR_MSG="VERSION file not found or empty"
ERR_MSG="VERSION_CRYPTO file not found or empty"
;;
ext-input-path)
ERR_MSG="Invalid path to bin: $2"
Expand All @@ -68,10 +68,13 @@ get_err() {
ERR_MSG="Cannot copy $2 to the $3"
;;
input_null)
ERR_MSG="Project not specified"
ERR_MSG="Projects not specified. Add flag \"-all\""
;;
input_vendor)
ERR_MSG="Invalid flag: '$2'. Add flag \"-vendor\""
;;
input_invalid)
ERR_MSG="Invalid project: $2"
ERR_MSG="Invalid flag: '$2'. Add flag \"-all\""
;;
*)
ERR_MSG="Internal error: $1"
Expand All @@ -90,10 +93,16 @@ get_success() {
}

get_package_v() {
printf "Checking Package version... "
printf "Checking package version... "

if [ -f VERSION ] && [ -s VERSION ]; then
CRYPTO_VERSION=$(cat VERSION)
if ! [ -z "$IS_DEP" ]; then
VERSION_FILE_PATH="$IS_DEP/../VERSION"
else
VERSION_FILE_PATH="VERSION"
fi

if [ -f $VERSION_FILE_PATH ] && [ -s $VERSION_FILE_PATH ]; then
VERSION=$(cat $VERSION_FILE_PATH)
get_success
else
get_err "package-v" "No VERSION file"
Expand Down Expand Up @@ -191,39 +200,32 @@ get_config() {
}

cp_ext() {
for EXT in $LIST_EXT
do
EXT_FULL_NAME="${EXT}${PHP_VERSION_SHORT}_${CRYPTO_VERSION}.so"

if ! [ -z "$IS_DEP" ]; then
PATH_TO_BINS_="$IS_DEP/$PATH_TO_BINS"
else
PATH_TO_BINS_="$PATH_TO_BINS"
fi

PATH_TO_BIN="${PATH_TO_BINS_}/${OS_}/php${PHP_VERSION_SHORT}"
FULL_PATH_TO_BIN="${PATH_TO_BIN}/${EXT_FULL_NAME}"

if ! [ -f ${FULL_PATH_TO_BIN} ]; then
get_err "ext-input-path" $FULL_PATH_TO_BIN
fi
if ! [ -z "$IS_DEP" ]; then
PATH_TO_BINS_="$IS_DEP/$PATH_TO_BINS"
else
PATH_TO_BINS_="_extensions/$PATH_TO_BINS"
fi

printf "Copying ${FULL_PATH_TO_BIN} to the ${EXTENSION_DIR}/${EXT_FULL_NAME}... "
PATH_TO_BINS="${PATH_TO_BINS_}/${OS_}/php${PHP_VERSION_SHORT}"

for BIN in "$PATH_TO_BINS"/*.so
do
printf "Copying ${BIN} to the ${EXTENSION_DIR}/... "

if sudo cp "$FULL_PATH_TO_BIN" "${EXTENSION_DIR}/${EXT_FULL_NAME}"; then
if sudo cp "$BIN" "${EXTENSION_DIR}"; then
get_success
else
get_err "cp-ext" "$EXT_FULL_NAME" "$EXTENSION_DIR"
get_err "cp-ext" "$BIN" "${EXTENSION_DIR}"
fi
done
}

cp_ini() {
for PID in $PHP_INI_DIR
do
printf "Copying ${PATH_TO_BIN}/${INI_FILE_NAME} file to the $PID/${INI_FILE_NAME}... "
printf "Copying ${PATH_TO_BINS}/${INI_FILE_NAME} file to the $PID/${INI_FILE_NAME}... "

if sudo cp "${PATH_TO_BIN}/${INI_FILE_NAME}" "$PID/${INI_FILE_NAME}"; then
if sudo cp "${PATH_TO_BINS}/${INI_FILE_NAME}" "$PID/${INI_FILE_NAME}"; then
get_success
else
get_err "cp-ini" "${INI_FILE_NAME}" "$PID"
Expand Down
2 changes: 1 addition & 1 deletion _extensions/virgil-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function getPHPVersion(): string

function getCryptoVersion(): string
{
return file_get_contents(__DIR__ . DIRECTORY_SEPARATOR."..".DIRECTORY_SEPARATOR."VERSION");
return file_get_contents(__DIR__ . DIRECTORY_SEPARATOR."..". DIRECTORY_SEPARATOR."VERSION");
}

function getExtensionsNamesAsArray(): array
Expand Down
4 changes: 2 additions & 2 deletions src/Phe/PheCipher.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ public function __destructor()
}

/**
* @param Virgil\CryptoWrapper\Foundation\Random $random
* @param \Virgil\CryptoWrapper\Foundation\Random $random
* @return void
*/
public function useRandom(Virgil\CryptoWrapper\Foundation\Random $random): void
public function useRandom(\Virgil\CryptoWrapper\Foundation\Random $random): void
{
vsce_phe_cipher_use_random_php($this->ctx, $random->getCtx());
}
Expand Down
8 changes: 4 additions & 4 deletions src/Phe/PheClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,19 @@ public function __destructor()
}

/**
* @param Virgil\CryptoWrapper\Foundation\Random $random
* @param \Virgil\CryptoWrapper\Foundation\Random $random
* @return void
*/
public function useRandom(Virgil\CryptoWrapper\Foundation\Random $random): void
public function useRandom(\Virgil\CryptoWrapper\Foundation\Random $random): void
{
vsce_phe_client_use_random_php($this->ctx, $random->getCtx());
}

/**
* @param Virgil\CryptoWrapper\Foundation\Random $operationRandom
* @param \Virgil\CryptoWrapper\Foundation\Random $operationRandom
* @return void
*/
public function useOperationRandom(Virgil\CryptoWrapper\Foundation\Random $operationRandom): void
public function useOperationRandom(\Virgil\CryptoWrapper\Foundation\Random $operationRandom): void
{
vsce_phe_client_use_operation_random_php($this->ctx, $operationRandom->getCtx());
}
Expand Down
10 changes: 5 additions & 5 deletions src/Phe/PheServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,19 @@ public function __destructor()
}

/**
* @param Virgil\CryptoWrapper\Foundation\Random $random
* @param \Virgil\CryptoWrapper\Foundation\Random $random
* @return void
*/
public function useRandom(Virgil\CryptoWrapper\Foundation\Random $random): void
public function useRandom(\Virgil\CryptoWrapper\Foundation\Random $random): void
{
vsce_phe_server_use_random_php($this->ctx, $random->getCtx());
}

/**
* @param Virgil\CryptoWrapper\Foundation\Random $operationRandom
* @param \Virgil\CryptoWrapper\Foundation\Random $operationRandom
* @return void
*/
public function useOperationRandom(Virgil\CryptoWrapper\Foundation\Random $operationRandom): void
public function useOperationRandom(\Virgil\CryptoWrapper\Foundation\Random $operationRandom): void
{
vsce_phe_server_use_operation_random_php($this->ctx, $operationRandom->getCtx());
}
Expand All @@ -98,7 +98,7 @@ public function setupDefaults(): void
}

/**
* Generates new NIST Pythia-256 server key pair for some client
* Generates new NIST P-256 server key pair for some client
*
* @return array
* @throws \Exception
Expand Down
8 changes: 4 additions & 4 deletions src/Phe/UokmsClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,19 @@ public function __destructor()
}

/**
* @param Virgil\CryptoWrapper\Foundation\Random $random
* @param \Virgil\CryptoWrapper\Foundation\Random $random
* @return void
*/
public function useRandom(Virgil\CryptoWrapper\Foundation\Random $random): void
public function useRandom(\Virgil\CryptoWrapper\Foundation\Random $random): void
{
vsce_uokms_client_use_random_php($this->ctx, $random->getCtx());
}

/**
* @param Virgil\CryptoWrapper\Foundation\Random $operationRandom
* @param \Virgil\CryptoWrapper\Foundation\Random $operationRandom
* @return void
*/
public function useOperationRandom(Virgil\CryptoWrapper\Foundation\Random $operationRandom): void
public function useOperationRandom(\Virgil\CryptoWrapper\Foundation\Random $operationRandom): void
{
vsce_uokms_client_use_operation_random_php($this->ctx, $operationRandom->getCtx());
}
Expand Down
10 changes: 5 additions & 5 deletions src/Phe/UokmsServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,19 @@ public function __destructor()
}

/**
* @param Virgil\CryptoWrapper\Foundation\Random $random
* @param \Virgil\CryptoWrapper\Foundation\Random $random
* @return void
*/
public function useRandom(Virgil\CryptoWrapper\Foundation\Random $random): void
public function useRandom(\Virgil\CryptoWrapper\Foundation\Random $random): void
{
vsce_uokms_server_use_random_php($this->ctx, $random->getCtx());
}

/**
* @param Virgil\CryptoWrapper\Foundation\Random $operationRandom
* @param \Virgil\CryptoWrapper\Foundation\Random $operationRandom
* @return void
*/
public function useOperationRandom(Virgil\CryptoWrapper\Foundation\Random $operationRandom): void
public function useOperationRandom(\Virgil\CryptoWrapper\Foundation\Random $operationRandom): void
{
vsce_uokms_server_use_operation_random_php($this->ctx, $operationRandom->getCtx());
}
Expand All @@ -97,7 +97,7 @@ public function setupDefaults(): void
}

/**
* Generates new NIST Pythia-256 server key pair for some client
* Generates new NIST P-256 server key pair for some client
*
* @return array
* @throws \Exception
Expand Down
4 changes: 2 additions & 2 deletions src/Phe/UokmsWrapRotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ public function __destructor()
}

/**
* @param Virgil\CryptoWrapper\Foundation\Random $operationRandom
* @param \Virgil\CryptoWrapper\Foundation\Random $operationRandom
* @return void
*/
public function useOperationRandom(Virgil\CryptoWrapper\Foundation\Random $operationRandom): void
public function useOperationRandom(\Virgil\CryptoWrapper\Foundation\Random $operationRandom): void
{
vsce_uokms_wrap_rotation_use_operation_random_php($this->ctx, $operationRandom->getCtx());
}
Expand Down

0 comments on commit 31300b6

Please sign in to comment.