summaryrefslogtreecommitdiff
path: root/gcm-aes192.c
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2014-01-26 21:35:40 +0100
committerNiels Möller <nisse@lysator.liu.se>2014-01-26 21:35:40 +0100
commite57d2fe2e0385f219e1e4f7adc051ad6b98905c1 (patch)
treebe39f15d6a3132030e6c873315c25657c3fb1859 /gcm-aes192.c
parent187631fa9c0b08e1bcb22e5580b11e6be909dd4b (diff)
downloadnettle-e57d2fe2e0385f219e1e4f7adc051ad6b98905c1.tar.gz
New gcm-aes interface.
Diffstat (limited to 'gcm-aes192.c')
-rw-r--r--gcm-aes192.c74
1 files changed, 74 insertions, 0 deletions
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 <assert.h>
+
+#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);
+}