MAGIC - add license

This commit is contained in:
Emman 2021-03-31 12:01:22 +08:00
parent 85b3ecb129
commit 513b786694
5 changed files with 16 additions and 3 deletions

View File

@ -127,8 +127,8 @@ func (c *ccm) auth(nonce, plaintext, additionalData []byte, tagMask *[ccmBlockSi
if len(additionalData) > 0 {
out[0] = 1 << 6 // 64*Adata
}
out[0] |= byte(c.tagSize-2) << 2
out[0] |= byte(14 - c.nonceSize)
out[0] |= byte(c.tagSize-2) << 2 // M' = ((tagSize - 2) / 2)*8
out[0] |= byte(14 - c.nonceSize) // L'
binary.BigEndian.PutUint64(out[ccmBlockSize-8:], uint64(len(plaintext)))
copy(out[1:], nonce)
c.cipher.Encrypt(out[:], out[:])

View File

@ -6,6 +6,7 @@ import (
"testing"
)
// https://tools.ietf.org/html/rfc3610, 8. Test Vectors
var aesCCMTests = []struct {
key, nonce, plaintext, ad, result string
tagSize int

View File

@ -1,3 +1,7 @@
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package cipher
// XorBytes xors the bytes in a and b. The destination should have enough

View File

@ -1,3 +1,7 @@
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "textflag.h"
// func xorBytesSSE2(dst, a, b *byte, n int)

View File

@ -1,3 +1,7 @@
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build !amd64
package cipher