diff --git a/scada-common/crypto.lua b/scada-common/crypto.lua index ed75f94..6424bcb 100644 --- a/scada-common/crypto.lua +++ b/scada-common/crypto.lua @@ -3,13 +3,13 @@ -- local aes128 = require("lockbox.cipher.aes128") -local ctr_mode = require("lockbox.cipher.mode.ctr"); -local sha1 = require("lockbox.digest.sha1"); -local sha2_224 = require("lockbox.digest.sha2_224"); -local sha2_256 = require("lockbox.digest.sha2_256"); +local ctr_mode = require("lockbox.cipher.mode.ctr") +local sha1 = require("lockbox.digest.sha1") +local sha2_224 = require("lockbox.digest.sha2_224") +local sha2_256 = require("lockbox.digest.sha2_256") local pbkdf2 = require("lockbox.kdf.pbkdf2") local hmac = require("lockbox.mac.hmac") -local zero_pad = require("lockbox.padding.zero"); +local zero_pad = require("lockbox.padding.zero") local stream = require("lockbox.util.stream") local array = require("lockbox.util.array") @@ -52,13 +52,13 @@ function crypto.init(password, server_port) c_eng.cipher = ctr_mode.Cipher() c_eng.cipher.setKey(c_eng.key) c_eng.cipher.setBlockCipher(aes128) - c_eng.cipher.setPadding(zero_pad); + c_eng.cipher.setPadding(zero_pad) -- initialize decipher c_eng.decipher = ctr_mode.Decipher() c_eng.decipher.setKey(c_eng.key) c_eng.decipher.setBlockCipher(aes128) - c_eng.decipher.setPadding(zero_pad); + c_eng.decipher.setPadding(zero_pad) -- initialize HMAC c_eng.hmac = hmac() @@ -222,7 +222,7 @@ function crypto.secure_modem(modem) if hmac == computed_hmac then -- message intact local plaintext = crypto.decrypt(iv, ciphertext) - body = textutils.deserialize(plaintext) + body = textutils.unserialize(plaintext) if body == nil then -- failed decryption diff --git a/scada-common/rsio.lua b/scada-common/rsio.lua index 04ab23c..8598e85 100644 --- a/scada-common/rsio.lua +++ b/scada-common/rsio.lua @@ -222,7 +222,7 @@ end ---@param color integer ---@return boolean valid function rsio.is_color(color) - return util.is_int(color) and (color > 0) and (_B_AND(color, (color - 1)) == 0); + return util.is_int(color) and (color > 0) and (_B_AND(color, (color - 1)) == 0) end ----------------- diff --git a/test/lockbox-benchmark.lua b/test/lockbox-benchmark.lua index f6f1ec2..0191c2a 100644 --- a/test/lockbox-benchmark.lua +++ b/test/lockbox-benchmark.lua @@ -3,18 +3,18 @@ require("/initenv").init_env() local pbkdf2 = require("lockbox.kdf.pbkdf2") local AES128Cipher = require("lockbox.cipher.aes128") local HMAC = require("lockbox.mac.hmac") -local SHA1 = require("lockbox.digest.sha1"); -local SHA2_224 = require("lockbox.digest.sha2_224"); -local SHA2_256 = require("lockbox.digest.sha2_256"); +local SHA1 = require("lockbox.digest.sha1") +local SHA2_224 = require("lockbox.digest.sha2_224") +local SHA2_256 = require("lockbox.digest.sha2_256") local Stream = require("lockbox.util.stream") local Array = require("lockbox.util.array") -local CBCMode = require("lockbox.cipher.mode.cbc"); -local CFBMode = require("lockbox.cipher.mode.cfb"); -local OFBMode = require("lockbox.cipher.mode.ofb"); -local CTRMode = require("lockbox.cipher.mode.ctr"); +local CBCMode = require("lockbox.cipher.mode.cbc") +local CFBMode = require("lockbox.cipher.mode.cfb") +local OFBMode = require("lockbox.cipher.mode.ofb") +local CTRMode = require("lockbox.cipher.mode.ctr") -local ZeroPadding = require("lockbox.padding.zero"); +local ZeroPadding = require("lockbox.padding.zero") local comms = require("scada-common.comms") local util = require("scada-common.util")