// Copyright 2009 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 aes

import (
	
	
	
)

// The AES block size in bytes.
const BlockSize = 16

// A cipher is an instance of AES encryption using a particular key.
type aesCipher struct {
	enc []uint32
	dec []uint32
}

type KeySizeError int

func ( KeySizeError) () string {
	return "crypto/aes: invalid key size " + strconv.Itoa(int())
}

// NewCipher creates and returns a new cipher.Block.
// The key argument should be the AES key,
// either 16, 24, or 32 bytes to select
// AES-128, AES-192, or AES-256.
func ( []byte) (cipher.Block, error) {
	 := len()
	switch  {
	default:
		return nil, KeySizeError()
	case 16, 24, 32:
		break
	}
	return newCipher()
}

// newCipherGeneric creates and returns a new cipher.Block
// implemented in pure Go.
func newCipherGeneric( []byte) (cipher.Block, error) {
	 := len() + 28
	 := aesCipher{make([]uint32, ), make([]uint32, )}
	expandKeyGo(, .enc, .dec)
	return &, nil
}

func ( *aesCipher) () int { return BlockSize }

func ( *aesCipher) (,  []byte) {
	if len() < BlockSize {
		panic("crypto/aes: input not full block")
	}
	if len() < BlockSize {
		panic("crypto/aes: output not full block")
	}
	if subtle.InexactOverlap([:BlockSize], [:BlockSize]) {
		panic("crypto/aes: invalid buffer overlap")
	}
	encryptBlockGo(.enc, , )
}

func ( *aesCipher) (,  []byte) {
	if len() < BlockSize {
		panic("crypto/aes: input not full block")
	}
	if len() < BlockSize {
		panic("crypto/aes: output not full block")
	}
	if subtle.InexactOverlap([:BlockSize], [:BlockSize]) {
		panic("crypto/aes: invalid buffer overlap")
	}
	decryptBlockGo(.dec, , )
}