~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to src/pkg/crypto/aes/block.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
package aes
38
38
 
39
39
// Encrypt one block from src into dst, using the expanded key xk.
40
 
func encryptBlock(xk []uint32, dst, src []byte) {
 
40
func encryptBlockGo(xk []uint32, dst, src []byte) {
41
41
        var s0, s1, s2, s3, t0, t1, t2, t3 uint32
42
42
 
43
43
        s0 = uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3])
82
82
}
83
83
 
84
84
// Decrypt one block from src into dst, using the expanded key xk.
85
 
func decryptBlock(xk []uint32, dst, src []byte) {
 
85
func decryptBlockGo(xk []uint32, dst, src []byte) {
86
86
        var s0, s1, s2, s3, t0, t1, t2, t3 uint32
87
87
 
88
88
        s0 = uint32(src[0])<<24 | uint32(src[1])<<16 | uint32(src[2])<<8 | uint32(src[3])
139
139
 
140
140
// Key expansion algorithm.  See FIPS-197, Figure 11.
141
141
// Their rcon[i] is our powx[i-1] << 24.
142
 
func expandKey(key []byte, enc, dec []uint32) {
 
142
func expandKeyGo(key []byte, enc, dec []uint32) {
143
143
        // Encryption key setup.
144
144
        var i int
145
145
        nk := len(key) / 4