Exemplo n.º 1
0
Arquivo: aes.go Projeto: runcom/gossl
func (self *aesKey) Decrypt(dst, src []byte) {
	if goCompatible {
		// this something the golang crypto/aes does, that does not happen for OpenSSL.
		if len(src) < BlockSize {
			panic("crypto/aes: input not full block")
		}
		if len(dst) < BlockSize {
			panic("crypto/aes: output not full block")
		}
	}

	dst_p := pointerFromBytes(dst)
	src_p := pointerFromBytes(src)
	C.AES_ecb_encrypt(src_p, dst_p, &self._aes_decrypt_key, C.AES_DECRYPT)

	// for safe measure
	err := sslerr.Error()
	if err != nil {
		panic(err.Error())
	}
}
Exemplo n.º 2
0
func (self *AESKey) Decrypt(dst, src []byte) {
	dst_p := pointerFromBytes(dst)
	src_p := pointerFromBytes(src)
	C.AES_ecb_encrypt(src_p, dst_p, &self._aes_decrypt_key, C.AES_DECRYPT)
}