camellia128-meta.c 1.68 KB
Newer Older
Niels Möller's avatar
Niels Möller committed
1
/* camellia128-meta.c */
2 3 4

/* nettle, low-level cryptographics library
 *
Niels Möller's avatar
Niels Möller committed
5
 * Copyright (C) 2010, 2013 Niels Möller
6 7 8 9 10 11 12 13 14 15 16 17 18
 *  
 * 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
19 20
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02111-1301, USA.
21 22 23 24 25 26
 */

#if HAVE_CONFIG_H
# include "config.h"
#endif

Niels Möller's avatar
Niels Möller committed
27 28
#include <assert.h>

29 30 31 32
#include "nettle-meta.h"

#include "camellia.h"

Niels Möller's avatar
Niels Möller committed
33 34 35 36 37 38
static void
camellia128_set_encrypt_key_wrapper (void *ctx, size_t length, const uint8_t *key)
{
  assert (length == CAMELLIA128_KEY_SIZE);
  camellia128_set_encrypt_key (ctx, key);
}
39

Niels Möller's avatar
Niels Möller committed
40 41 42 43 44 45
static void
camellia128_set_decrypt_key_wrapper (void *ctx, size_t length, const uint8_t *key)
{
  assert (length == CAMELLIA128_KEY_SIZE);
  camellia128_set_decrypt_key (ctx, key);
}
46

Niels Möller's avatar
Niels Möller committed
47 48 49 50 51 52 53 54
const struct nettle_cipher nettle_camellia128 =
  { "camellia128", sizeof(struct camellia128_ctx),
    CAMELLIA_BLOCK_SIZE, CAMELLIA128_KEY_SIZE,
    camellia128_set_encrypt_key_wrapper,
    camellia128_set_decrypt_key_wrapper,
    (nettle_crypt_func *) camellia128_crypt,
    (nettle_crypt_func *) camellia128_crypt
  };