Skip to content

Commit

Permalink
signalmeow/attachments: remove Msgf
Browse files Browse the repository at this point in the history
Signed-off-by: Sumner Evans <[email protected]>
  • Loading branch information
sumnerevans committed Dec 27, 2023
1 parent bf493b5 commit 19f5033
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/signalmeow/attachments.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ func encryptAndUploadAttachment(device *Device, body []byte, mimeType, filename
// Padded length uses exponential bracketing
paddedLen := int(math.Max(541, math.Floor(math.Pow(1.05, math.Ceil(math.Log(float64(len(body)))/math.Log(1.05))))))
if paddedLen < len(body) {
log.Debug().Msgf("encryptAndUploadAttachment paddedLen %v < len %v. Continuing with a privacy risk.", paddedLen, len(body))
log.Debug().
Int("padded_len", paddedLen).
Int("len", len(body)).
Msg("encryptAndUploadAttachment paddedLen less than body length. Continuing with a privacy risk.")
} else {
body = append(body, bytes.Repeat([]byte{0}, int(paddedLen)-len(body))...)
}
Expand Down Expand Up @@ -205,8 +208,9 @@ func aesDecrypt(key, ciphertext []byte) ([]byte, error) {
}

if len(ciphertext)%aes.BlockSize != 0 {
length := len(ciphertext) % aes.BlockSize
log.Debug().Msgf("aesDecrypt ciphertext not multiple of AES blocksize: %v", length)
log.Debug().
Int("length", len(ciphertext)%aes.BlockSize).
Msg("aesDecrypt ciphertext not multiple of AES blocksize")
return nil, errors.New("ciphertext not multiple of AES blocksize")
}

Expand Down

0 comments on commit 19f5033

Please sign in to comment.