mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
some sneaky semicolons
This commit is contained in:
parent
788fae44aa
commit
93286174d4
@ -3,13 +3,13 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
local aes128 = require("lockbox.cipher.aes128")
|
local aes128 = require("lockbox.cipher.aes128")
|
||||||
local ctr_mode = require("lockbox.cipher.mode.ctr");
|
local ctr_mode = require("lockbox.cipher.mode.ctr")
|
||||||
local sha1 = require("lockbox.digest.sha1");
|
local sha1 = require("lockbox.digest.sha1")
|
||||||
local sha2_224 = require("lockbox.digest.sha2_224");
|
local sha2_224 = require("lockbox.digest.sha2_224")
|
||||||
local sha2_256 = require("lockbox.digest.sha2_256");
|
local sha2_256 = require("lockbox.digest.sha2_256")
|
||||||
local pbkdf2 = require("lockbox.kdf.pbkdf2")
|
local pbkdf2 = require("lockbox.kdf.pbkdf2")
|
||||||
local hmac = require("lockbox.mac.hmac")
|
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 stream = require("lockbox.util.stream")
|
||||||
local array = require("lockbox.util.array")
|
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 = ctr_mode.Cipher()
|
||||||
c_eng.cipher.setKey(c_eng.key)
|
c_eng.cipher.setKey(c_eng.key)
|
||||||
c_eng.cipher.setBlockCipher(aes128)
|
c_eng.cipher.setBlockCipher(aes128)
|
||||||
c_eng.cipher.setPadding(zero_pad);
|
c_eng.cipher.setPadding(zero_pad)
|
||||||
|
|
||||||
-- initialize decipher
|
-- initialize decipher
|
||||||
c_eng.decipher = ctr_mode.Decipher()
|
c_eng.decipher = ctr_mode.Decipher()
|
||||||
c_eng.decipher.setKey(c_eng.key)
|
c_eng.decipher.setKey(c_eng.key)
|
||||||
c_eng.decipher.setBlockCipher(aes128)
|
c_eng.decipher.setBlockCipher(aes128)
|
||||||
c_eng.decipher.setPadding(zero_pad);
|
c_eng.decipher.setPadding(zero_pad)
|
||||||
|
|
||||||
-- initialize HMAC
|
-- initialize HMAC
|
||||||
c_eng.hmac = hmac()
|
c_eng.hmac = hmac()
|
||||||
@ -222,7 +222,7 @@ function crypto.secure_modem(modem)
|
|||||||
if hmac == computed_hmac then
|
if hmac == computed_hmac then
|
||||||
-- message intact
|
-- message intact
|
||||||
local plaintext = crypto.decrypt(iv, ciphertext)
|
local plaintext = crypto.decrypt(iv, ciphertext)
|
||||||
body = textutils.deserialize(plaintext)
|
body = textutils.unserialize(plaintext)
|
||||||
|
|
||||||
if body == nil then
|
if body == nil then
|
||||||
-- failed decryption
|
-- failed decryption
|
||||||
|
@ -222,7 +222,7 @@ end
|
|||||||
---@param color integer
|
---@param color integer
|
||||||
---@return boolean valid
|
---@return boolean valid
|
||||||
function rsio.is_color(color)
|
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
|
end
|
||||||
|
|
||||||
-----------------
|
-----------------
|
||||||
|
@ -3,18 +3,18 @@ require("/initenv").init_env()
|
|||||||
local pbkdf2 = require("lockbox.kdf.pbkdf2")
|
local pbkdf2 = require("lockbox.kdf.pbkdf2")
|
||||||
local AES128Cipher = require("lockbox.cipher.aes128")
|
local AES128Cipher = require("lockbox.cipher.aes128")
|
||||||
local HMAC = require("lockbox.mac.hmac")
|
local HMAC = require("lockbox.mac.hmac")
|
||||||
local SHA1 = require("lockbox.digest.sha1");
|
local SHA1 = require("lockbox.digest.sha1")
|
||||||
local SHA2_224 = require("lockbox.digest.sha2_224");
|
local SHA2_224 = require("lockbox.digest.sha2_224")
|
||||||
local SHA2_256 = require("lockbox.digest.sha2_256");
|
local SHA2_256 = require("lockbox.digest.sha2_256")
|
||||||
local Stream = require("lockbox.util.stream")
|
local Stream = require("lockbox.util.stream")
|
||||||
local Array = require("lockbox.util.array")
|
local Array = require("lockbox.util.array")
|
||||||
|
|
||||||
local CBCMode = require("lockbox.cipher.mode.cbc");
|
local CBCMode = require("lockbox.cipher.mode.cbc")
|
||||||
local CFBMode = require("lockbox.cipher.mode.cfb");
|
local CFBMode = require("lockbox.cipher.mode.cfb")
|
||||||
local OFBMode = require("lockbox.cipher.mode.ofb");
|
local OFBMode = require("lockbox.cipher.mode.ofb")
|
||||||
local CTRMode = require("lockbox.cipher.mode.ctr");
|
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 comms = require("scada-common.comms")
|
||||||
local util = require("scada-common.util")
|
local util = require("scada-common.util")
|
||||||
|
Loading…
Reference in New Issue
Block a user