/*
* Copyright (C) 2011-2012 Free Software Foundation, Inc.
* Copyright (C) 2018 Red Hat, Inc.
*
* Author: Nikos Mavrogiannopoulos
*
* This file is part of GnuTLS.
*
* The GnuTLS is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see
*
*/
/*
* The following code is an implementation of the AES-128-GCM cipher
*/
#include "errors.h"
#include "gnutls_int.h"
#ifdef HAVE_LIBNETTLE
#include
#include "errors.h"
#include
#include
#include
#include
#include
#include
/* GCM mode
* It is used when the CPU doesn't include the PCLMUL instructions.
*/
struct gcm_x86_aes_ctx GCM_CTX(AES_KEY);
static void x86_aes_encrypt(const void *_ctx,
size_t length, uint8_t * dst,
const uint8_t * src)
{
AES_KEY *ctx = (void*)_ctx;
unsigned i;
unsigned blocks = (length+15) / 16;
assert(blocks*16 == length);
for (i=0;i