-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from emartech/openssl-1.0-fix-proposal
Fix openssl 1.1.0 compatibility
- Loading branch information
Showing
11 changed files
with
109 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,8 @@ jobs: | |
runs-on: ubuntu-18.04 | ||
strategy: | ||
matrix: | ||
luaVersion: ["5.1.5", "5.2.4", "luajit"] | ||
luaVersion: ["luajit"] | ||
|
||
steps: | ||
- uses: actions/checkout@master | ||
- uses: leafo/[email protected] | ||
|
@@ -22,12 +22,20 @@ jobs: | |
- uses: leafo/[email protected] | ||
- name: Install | ||
run: | | ||
sudo apt-get install libssl1.0-dev | ||
luarocks install --server=http://luarocks.org/dev openssl | ||
luarocks install luasec OPENSSL_LIBDIR=/usr/lib/x86_64-linux-gnu | ||
luarocks install busted | ||
luarocks install rapidjson 0.7.1 | ||
luarocks install luacrypto 0.3.2-2 | ||
sudo apt update && \ | ||
sudo apt install -y build-essential libreadline-dev zip unzip cmake wget luajit libluajit-5.1-dev && \ | ||
wget https://luarocks.org/releases/luarocks-3.8.0.tar.gz && \ | ||
tar zxpf luarocks-3.8.0.tar.gz && \ | ||
cd luarocks-3.8.0 && \ | ||
./configure && \ | ||
make && sudo make install && \ | ||
cd .. && \ | ||
rm -rf luarocks-3.8.0 && \ | ||
rm luarocks-3.8.0.tar.gz && \ | ||
luarocks install busted && \ | ||
luarocks install rapidjson 0.7.1 && \ | ||
luarocks install luasocket && \ | ||
luarocks install lua-resty-openssl 0.8.8-1 && \ | ||
luarocks install date 2.1.2-1 | ||
- name: Test | ||
run: busted spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
FROM ubuntu:18.04 | ||
|
||
RUN apt update && \ | ||
apt install -y build-essential libreadline-dev zip unzip cmake wget luajit libluajit-5.1-dev && \ | ||
wget https://luarocks.org/releases/luarocks-3.8.0.tar.gz && \ | ||
tar zxpf luarocks-3.8.0.tar.gz && \ | ||
cd luarocks-3.8.0 && \ | ||
./configure && \ | ||
make && make install && \ | ||
cd .. && \ | ||
rm -rf luarocks-3.8.0 && \ | ||
rm luarocks-3.8.0.tar.gz | ||
|
||
RUN luarocks install busted && \ | ||
luarocks install rapidjson 0.7.1 && \ | ||
luarocks install luasocket && \ | ||
luarocks install lua-resty-openssl 0.8.8-1 && \ | ||
luarocks install date 2.1.2-1 | ||
|
||
WORKDIR /my-workspace | ||
|
||
COPY . . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.PHONY: build test | ||
|
||
build: | ||
docker-compose build | ||
|
||
test: | ||
docker-compose run --rm app busted spec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: '3' | ||
services: | ||
app: | ||
build: . | ||
working_dir: /my-workspace | ||
volumes: | ||
- .:/my-workspace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
local digest = require("resty.openssl.digest") | ||
local hmac = require("resty.openssl.hmac") | ||
|
||
local function binaryToHex(char) | ||
return string.format("%.2x", string.byte(char)) | ||
end | ||
|
||
local crypto = {} | ||
|
||
function crypto.digest(algorithm, inputString) | ||
local binary = digest.new(algorithm):final(inputString) | ||
|
||
local binaryAsHex = string.gsub(binary, ".", binaryToHex) | ||
|
||
return binaryAsHex | ||
end | ||
|
||
crypto.hmac = {} | ||
|
||
function crypto.hmac.digest(algorithm, inputString, key, shouldReturnBinaryString) | ||
local binary = hmac.new(key, algorithm):final(inputString) | ||
|
||
if shouldReturnBinaryString then | ||
return binary | ||
end | ||
|
||
local binaryAsHex = string.gsub(binary, ".", binaryToHex) | ||
|
||
return binaryAsHex | ||
end | ||
|
||
return crypto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters