diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-11-09 08:07:21 +0100 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2013-11-10 20:28:20 +0100 |
commit | 04d29c83c9d11b3b4d804c973824a831ca338729 (patch) | |
tree | 63459361791b5bb37c6839a2019772145ac8242f /poly1305-aes.c | |
parent | a7eb86b40fb8f50310a26fba83426e4f11534d3e (diff) | |
download | nettle-04d29c83c9d11b3b4d804c973824a831ca338729.tar.gz |
First implementation of poly1305.
Diffstat (limited to 'poly1305-aes.c')
-rw-r--r-- | poly1305-aes.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/poly1305-aes.c b/poly1305-aes.c new file mode 100644 index 00000000..d3846a4f --- /dev/null +++ b/poly1305-aes.c @@ -0,0 +1,55 @@ +/* nettle, low-level cryptographics library + * + * Copyright (C) 2013 Nikos Mavrogiannopoulos + * + * 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 <string.h> +#include "macros.h" +#include "nettle-types.h" +#include "poly1305-aes.h" + +void +poly1305_aes_set_key (struct poly1305_aes_ctx *ctx, const uint8_t * key) +{ + POLY1305_SET_KEY(ctx, aes_set_encrypt_key, key); +} + +void +poly1305_aes_set_nonce (struct poly1305_aes_ctx *ctx, + const uint8_t * nonce) +{ + POLY1305_SET_NONCE(ctx, nonce); +} + +void +poly1305_aes_update (struct poly1305_aes_ctx *ctx, + size_t length, const uint8_t * data) +{ + POLY1305_UPDATE(ctx, length, data); +} + +void +poly1305_aes_digest (struct poly1305_aes_ctx *ctx, + size_t length, uint8_t * digest) +{ + POLY1305_DIGEST(ctx, aes_encrypt, length, digest); +} |