]> Cypherpunks.ru repositories - gogost.git/blobdiff - mgm/mode.go
Raise copyright years
[gogost.git] / mgm / mode.go
index fdbfa4277fad5577b2fc1af15a2857e547a4099c..e874dd372f0bc07343dacc496701ddf3a78a0118 100644 (file)
@@ -1,5 +1,5 @@
 // GoGOST -- Pure Go GOST cryptographic functions library
-// Copyright (C) 2015-2019 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2015-2020 Sergey Matveev <stargrave@stargrave.org>
 //
 // This program is free software: you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -61,10 +61,10 @@ type MGM struct {
 func NewMGM(cipher cipher.Block, tagSize int) (cipher.AEAD, error) {
        blockSize := cipher.BlockSize()
        if !(blockSize == 8 || blockSize == 16) {
-               return nil, errors.New("MGM supports only 64/128 blocksizes")
+               return nil, errors.New("gogost/mgm: only 64/128 blocksizes allowed")
        }
        if tagSize < 4 || tagSize > blockSize {
-               return nil, errors.New("invalid tag size")
+               return nil, errors.New("gogost/mgm: invalid tag size")
        }
        mgm := MGM{
                maxSize:   uint64(1<<uint(blockSize*8/2) - 1),
@@ -242,7 +242,7 @@ func (mgm *MGM) Open(dst, nonce, ciphertext, additionalData []byte) ([]byte, err
        copy(mgm.icn, nonce)
        mgm.auth(mgm.sum, ct, additionalData)
        if !hmac.Equal(mgm.sum[:mgm.tagSize], ciphertext[len(ciphertext)-mgm.tagSize:]) {
-               return nil, errors.New("invalid authentication tag")
+               return nil, errors.New("gogost/mgm: invalid authentication tag")
        }
        mgm.crypt(out, ct)
        return ret, nil