Skip to content

Commit

Permalink
MAGIC - add license
Browse files Browse the repository at this point in the history
  • Loading branch information
Emman committed Mar 31, 2021
1 parent 85b3ecb commit 513b786
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cipher/ccm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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[:])
Expand Down
1 change: 1 addition & 0 deletions cipher/ccm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions cipher/xor_amd64.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions cipher/xor_amd64.s
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
6 changes: 5 additions & 1 deletion cipher/xor_generic.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -84,4 +88,4 @@ func XorWords(dst, a, b []byte) {
} else {
safeXORBytes(dst, a, b, len(b))
}
}
}

0 comments on commit 513b786

Please sign in to comment.