mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-28 05:06:18 +08:00
MAGIC - add license
This commit is contained in:
parent
85b3ecb129
commit
513b786694
@ -127,8 +127,8 @@ func (c *ccm) auth(nonce, plaintext, additionalData []byte, tagMask *[ccmBlockSi
|
|||||||
if len(additionalData) > 0 {
|
if len(additionalData) > 0 {
|
||||||
out[0] = 1 << 6 // 64*Adata
|
out[0] = 1 << 6 // 64*Adata
|
||||||
}
|
}
|
||||||
out[0] |= byte(c.tagSize-2) << 2
|
out[0] |= byte(c.tagSize-2) << 2 // M' = ((tagSize - 2) / 2)*8
|
||||||
out[0] |= byte(14 - c.nonceSize)
|
out[0] |= byte(14 - c.nonceSize) // L'
|
||||||
binary.BigEndian.PutUint64(out[ccmBlockSize-8:], uint64(len(plaintext)))
|
binary.BigEndian.PutUint64(out[ccmBlockSize-8:], uint64(len(plaintext)))
|
||||||
copy(out[1:], nonce)
|
copy(out[1:], nonce)
|
||||||
c.cipher.Encrypt(out[:], out[:])
|
c.cipher.Encrypt(out[:], out[:])
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// https://tools.ietf.org/html/rfc3610, 8. Test Vectors
|
||||||
var aesCCMTests = []struct {
|
var aesCCMTests = []struct {
|
||||||
key, nonce, plaintext, ad, result string
|
key, nonce, plaintext, ad, result string
|
||||||
tagSize int
|
tagSize int
|
||||||
|
@ -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
|
package cipher
|
||||||
|
|
||||||
// XorBytes xors the bytes in a and b. The destination should have enough
|
// XorBytes xors the bytes in a and b. The destination should have enough
|
||||||
|
@ -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"
|
#include "textflag.h"
|
||||||
|
|
||||||
// func xorBytesSSE2(dst, a, b *byte, n int)
|
// func xorBytesSSE2(dst, a, b *byte, n int)
|
||||||
|
@ -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
|
// +build !amd64
|
||||||
|
|
||||||
package cipher
|
package cipher
|
||||||
|
Loading…
x
Reference in New Issue
Block a user