Commit 0c751942 authored by Anders Jensen Løvig's avatar Anders Jensen Løvig
Browse files

Ignore some return values

parent d634dc8d
Pipeline #21317 passed with stages
in 52 seconds
......@@ -138,7 +138,7 @@ type SignedBallot struct {
func SignBallot(b *Ballot, key *rsa.PrivateKey) (*SignedBallot, error) {
digest := new(bytes.Buffer)
json.NewEncoder(digest).Encode(b)
_ = json.NewEncoder(digest).Encode(b)
hashed := sha256.Sum256(digest.Bytes())
sig, err := rsa.SignPKCS1v15(
rand.Reader,
......@@ -160,7 +160,7 @@ func (b *SignedBallot) Verify() error {
sig := b.Signature
b.Signature = nil
digest := new(bytes.Buffer)
json.NewEncoder(digest).Encode(b)
_ = json.NewEncoder(digest).Encode(b)
hashed := sha256.Sum256(digest.Bytes())
b.Signature = sig
return rsa.VerifyPKCS1v15(b.PubKey, crypto.SHA256, hashed[:], sig)
......@@ -173,13 +173,13 @@ type EncryptedBallot struct {
func EncryptBallot(b *SignedBallot, pubkey *rsa.PublicKey) (*EncryptedBallot, error) {
msg := new(bytes.Buffer)
json.NewEncoder(msg).Encode(b)
_ = json.NewEncoder(msg).Encode(b)
seckey := make([]byte, 32)
rand.Read(seckey) // generate random key
_, _ = rand.Read(seckey) // generate random key
block, _ := aes.NewCipher(seckey)
ciphertext := make([]byte, aes.BlockSize+len(msg.Bytes()))
iv := ciphertext[:aes.BlockSize]
rand.Read(iv)
_, _ = rand.Read(iv)
mode := cipher.NewCBCEncrypter(block, iv)
mode.CryptBlocks(ciphertext[aes.BlockSize:], msg.Bytes())
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment