From e57d2fe2e0385f219e1e4f7adc051ad6b98905c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20M=C3=B6ller?= Date: Sun, 26 Jan 2014 21:35:40 +0100 Subject: New gcm-aes interface. --- gcm-aes192.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 gcm-aes192.c (limited to 'gcm-aes192.c') diff --git a/gcm-aes192.c b/gcm-aes192.c new file mode 100644 index 00000000..3671829d --- /dev/null +++ b/gcm-aes192.c @@ -0,0 +1,74 @@ +/* gcm-aes192.c + * + * Galois counter mode using AES192 as the underlying cipher. + */ + +/* nettle, low-level cryptographics library + * + * Copyright (C) 2011, 2014 Niels Möller + * + * The nettle library 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. + * + * The nettle 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 the nettle library; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02111-1301, USA. + */ + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#include + +#include "gcm.h" + +void +gcm_aes192_set_key(struct gcm_aes192_ctx *ctx, size_t length, const uint8_t *key) +{ + assert (length == AES192_KEY_SIZE); + GCM_SET_KEY(ctx, aes192_set_encrypt_key, aes192_encrypt, key); +} + +void +gcm_aes192_set_iv (struct gcm_aes192_ctx *ctx, + size_t length, const uint8_t *iv) +{ + GCM_SET_IV (ctx, length, iv); +} + +void +gcm_aes192_update (struct gcm_aes192_ctx *ctx, + size_t length, const uint8_t *data) +{ + GCM_UPDATE (ctx, length, data); +} + +void +gcm_aes192_encrypt(struct gcm_aes192_ctx *ctx, + size_t length, uint8_t *dst, const uint8_t *src) +{ + GCM_ENCRYPT(ctx, aes192_encrypt, length, dst, src); +} + +void +gcm_aes192_decrypt(struct gcm_aes192_ctx *ctx, + size_t length, uint8_t *dst, const uint8_t *src) +{ + GCM_DECRYPT(ctx, aes192_encrypt, length, dst, src); +} + +void +gcm_aes192_digest(struct gcm_aes192_ctx *ctx, + size_t length, uint8_t *digest) +{ + GCM_DIGEST(ctx, aes192_encrypt, length, digest); +} -- cgit v1.2.1