summaryrefslogtreecommitdiffstats
path: root/lib/aes.go
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2021-02-11 23:00:49 -0500
committerrsiddharth <s@ricketyspace.net>2021-02-11 23:00:49 -0500
commitaaabeb704f200023aa544d70eaca9f363e8da975 (patch)
tree005886d6c8dc5b04160e5eec7fd561ad0d7bdd86 /lib/aes.go
parent99a4f2f4e29e7963977ba16bf3aba3463a1c61d1 (diff)
lib: update Pkcs7PaddingUndo, AESDecryptCBC
Add error as the second return value to Pkcs7PaddingUndo and AESDecryptCBC.
Diffstat (limited to 'lib/aes.go')
-rw-r--r--lib/aes.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/aes.go b/lib/aes.go
index 396ee5c..8c4dd26 100644
--- a/lib/aes.go
+++ b/lib/aes.go
@@ -23,7 +23,7 @@ func AESEncryptCBC(plain, key, iv []byte) []byte {
return output
}
-func AESDecryptCBC(cipher, key, iv []byte) []byte {
+func AESDecryptCBC(cipher, key, iv []byte) ([]byte, error) {
iter := len(cipher) / 16
lc := iv
@@ -38,9 +38,9 @@ func AESDecryptCBC(cipher, key, iv []byte) []byte {
}
// Undo padding
- output = Pkcs7PaddingUndo(output)
+ output, err := Pkcs7PaddingUndo(output)
- return output
+ return output, err
}
func AESEncryptECB(plain, key []byte) []byte {
@@ -72,7 +72,7 @@ func AESDecryptECB(cipher, key []byte) []byte {
}
// Undo padding
- output = Pkcs7PaddingUndo(output)
+ output, _ = Pkcs7PaddingUndo(output)
return output
}