/* Generated from "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod" by precompile.pike running Pike v8.0 release 1737
 *
 * Do NOT edit this file.
 */

#undef PRECOMPILE_API_VERSION
#define PRECOMPILE_API_VERSION 6

#undef PRECOMPILE_SUB_PIKEVARS
#define PRECOMPILE_SUB_PIKEVARS 1

#undef PRECOMPILE_DYNAMIC_TYPES
#define PRECOMPILE_DYNAMIC_TYPES 1



#undef cmod___CMOD__
#define cmod___CMOD__ 1
#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#line 3003 "/home/hww3/pike-git/lib/modules/Tools.pmod/Standalone.pmod/precompile.pike"







#line 3010 "/home/hww3/pike-git/lib/modules/Tools.pmod/Standalone.pmod/precompile.pike"
#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
/* -*- c -*-
|| This file is part of Pike. For copyright information see COPYRIGHT.
|| Pike is distributed under GPL, LGPL and MPL. See the file COPYING
|| for more information.
*/

#include "global.h"
#include "interpret.h"
#include "svalue.h"
#include "array.h"
#include "operators.h"
#include "threads.h"

/* For this_object() */
#include "object.h"
#include "module_support.h"

#include "nettle_config.h"

#ifdef HAVE_LIBNETTLE



#ifndef PIKE_UNUSED_ATTRIBUTE
#define PIKE_UNUSED_ATTRIBUTE
#endif
#define CMOD_MAP_PROGRAM_IDS_DEFINED 1
static int ___cmod_map_program_ids(int id) PIKE_UNUSED_ATTRIBUTE;
#ifndef TYPEOF
/* Compat with older Pikes. */
#define TYPEOF(SVAL)	((SVAL).type)
#define SUBTYPEOF(SVAL)	((SVAL).subtype)
#define SET_SVAL_TYPE(SVAL, TYPE)	(TYPEOF(SVAL) = TYPE)
#define SET_SVAL_SUBTYPE(SVAL, TYPE)	(SUBTYPEOF(SVAL) = TYPE)
#define SET_SVAL(SVAL, TYPE, SUBTYPE, FIELD, EXPR) do {	\
    /* Set the type afterwards to avoid a clobbered	\
     * svalue in case EXPR throws. */			\
    (SVAL).u.FIELD = (EXPR);				\
    SET_SVAL_TYPE((SVAL), (TYPE));			\
    SET_SVAL_SUBTYPE((SVAL), (SUBTYPE));		\
  } while(0)
#endif /* !TYPEOF */
#ifndef PIKE_UNUSED
/* Compat with Pike 7.8 and earlier. */
/* NB: Not strictly correct; PIKE_UNUSED was added the
 *     day after set_program_id_to_id(), but good enough.
 */
#ifndef UNUSED
#define UNUSED(X)	X
#endif
#ifndef set_program_id_to_id
/* NB: Recent Pike 7.8 has a #define that conflicts with
 *     the following declaration.
 */
static void set_program_id_to_id(void*UNUSED(id)){}
#endif
#else /* */
PMOD_EXPORT void set_program_id_to_id( int (*to)(int) );
#endif /* !PIKE_UNUSED */


#ifndef DEFAULT_CMOD_STORAGE
#define CMOD_COND_USED
#define DEFAULT_CMOD_STORAGE static
#endif
#define module_strings_declared
static struct pike_string *module_strings[7] = {
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
};
static struct { INT32 from;INT32 to; } ___cmod_ext_used[2];
#ifndef CMOD_COND_USED
# define f_Nettle_Cipher_name_fun_num_used 1
#else
#define f_Nettle_Cipher_name_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_DES_fix_parity_fun_num_used 1
#else
#define f_Nettle_DES_fix_parity_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define Nettle_Cipher_program_fun_num_used 1
#else
#undef Nettle_Cipher_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_AES_program_fun_num_used 1
#else
#undef Nettle_AES_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_ARCTWO_program_fun_num_used 1
#else
#undef Nettle_ARCTWO_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_ARCFOUR_program_fun_num_used 1
#else
#undef Nettle_ARCFOUR_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_BLOWFISH_program_fun_num_used 1
#else
#undef Nettle_BLOWFISH_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_CAMELLIA_program_fun_num_used 1
#else
#undef Nettle_CAMELLIA_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_CAST128_program_fun_num_used 1
#else
#undef Nettle_CAST128_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_CHACHA_program_fun_num_used 1
#else
#undef Nettle_CHACHA_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_DES_program_fun_num_used 1
#else
#undef Nettle_DES_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_DES3_program_fun_num_used 1
#else
#undef Nettle_DES3_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_SALSA20_program_fun_num_used 1
#else
#undef Nettle_SALSA20_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_SERPENT_program_fun_num_used 1
#else
#undef Nettle_SERPENT_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_Twofish_program_fun_num_used 1
#else
#undef Nettle_Twofish_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_IDEA_program_fun_num_used 1
#else
#undef Nettle_IDEA_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CBC_State_crypt_fun_num_used 1
#else
#define f_Nettle_BlockCipher_cq__CBC_State_crypt_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher_cq__CBC_State_program_fun_num_used 1
#else
#define Nettle_BlockCipher_cq__CBC_State_program_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CBC_State_substate_factory_fun_num_used 1
#else
#define f_Nettle_BlockCipher_cq__CBC_State_substate_factory_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define Nettle_BufferedCipher_cq__Buffer_program_fun_num_used 1
#else
#define Nettle_BufferedCipher_cq__Buffer_program_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define Nettle_BufferedCipher_cq__Buffer_State_program_fun_num_used 1
#else
#define Nettle_BufferedCipher_cq__Buffer_State_program_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BufferedCipher_cq__Buffer_State_substate_factory_fun_num_used 1
#else
#define f_Nettle_BufferedCipher_cq__Buffer_State_substate_factory_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher_cq__OFB_program_fun_num_used 1
#else
#define Nettle_BlockCipher_cq__OFB_program_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher_cq__CTR_program_fun_num_used 1
#else
#define Nettle_BlockCipher_cq__CTR_program_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher_cq__CFB_program_fun_num_used 1
#else
#define Nettle_BlockCipher_cq__CFB_program_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher_cq__PCBC_program_fun_num_used 1
#else
#define Nettle_BlockCipher_cq__PCBC_program_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher_cq__CBC_program_fun_num_used 1
#else
#define Nettle_BlockCipher_cq__CBC_program_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define Nettle_Cipher_State_program_fun_num_used 1
#else
#define Nettle_Cipher_State_program_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_Cipher_key_size_fun_num_used 1
#else
#define f_Nettle_Cipher_key_size_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_Cipher_block_size_fun_num_used 1
#else
#define f_Nettle_Cipher_block_size_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_Cipher_State_set_encrypt_key_fun_num_used 1
#else
#define f_Nettle_Cipher_State_set_encrypt_key_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__GCM_State_substate_factory_fun_num_used 1
#else
#define f_Nettle_BlockCipher16_cq__GCM_State_substate_factory_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__EAX_State_digest_size_fun_num_used 1
#else
#define f_Nettle_BlockCipher16_cq__EAX_State_digest_size_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__EAX_digest_size_fun_num_used 1
#else
#define f_Nettle_BlockCipher16_cq__EAX_digest_size_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__EAX_State_substate_factory_fun_num_used 1
#else
#define f_Nettle_BlockCipher16_cq__EAX_State_substate_factory_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__CCM_State_digest_size_fun_num_used 1
#else
#define f_Nettle_BlockCipher16_cq__CCM_State_digest_size_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__CCM_digest_size_fun_num_used 1
#else
#define f_Nettle_BlockCipher16_cq__CCM_digest_size_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CTR_State_set_decrypt_key_fun_num_used 1
#else
#define f_Nettle_BlockCipher_cq__CTR_State_set_decrypt_key_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CTR_State_set_encrypt_key_fun_num_used 1
#else
#define f_Nettle_BlockCipher_cq__CTR_State_set_encrypt_key_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CTR_State_crypt_fun_num_used 1
#else
#define f_Nettle_BlockCipher_cq__CTR_State_crypt_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CTR_State_create_fun_num_used 1
#else
#define f_Nettle_BlockCipher_cq__CTR_State_create_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher_cq__OFB_State_program_fun_num_used 1
#else
#define Nettle_BlockCipher_cq__OFB_State_program_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__OFB_State_substate_factory_fun_num_used 1
#else
#define f_Nettle_BlockCipher_cq__OFB_State_substate_factory_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher_cq__CTR_State_program_fun_num_used 1
#else
#define Nettle_BlockCipher_cq__CTR_State_program_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CTR_State_substate_factory_fun_num_used 1
#else
#define f_Nettle_BlockCipher_cq__CTR_State_substate_factory_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher_cq__CFB_State_program_fun_num_used 1
#else
#define Nettle_BlockCipher_cq__CFB_State_program_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CFB_State_substate_factory_fun_num_used 1
#else
#define f_Nettle_BlockCipher_cq__CFB_State_substate_factory_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_Cipher_State_set_decrypt_key_fun_num_used 1
#else
#define f_Nettle_Cipher_State_set_decrypt_key_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher16_cq__GCM_program_fun_num_used 1
#else
#define Nettle_BlockCipher16_cq__GCM_program_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher16_cq__EAX_program_fun_num_used 1
#else
#define Nettle_BlockCipher16_cq__EAX_program_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher16_cq__CCM8_program_fun_num_used 1
#else
#define Nettle_BlockCipher16_cq__CCM8_program_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher16_cq__CCM_program_fun_num_used 1
#else
#define Nettle_BlockCipher16_cq__CCM_program_fun_num_used 1
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_Cipher_State_block_size_fun_num_used 1
#else
#undef f_Nettle_Cipher_State_block_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CBC_State_iv_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CBC_State_iv_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CBC_State_set_encrypt_key_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CBC_State_set_encrypt_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CBC_State_set_decrypt_key_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CBC_State_set_decrypt_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CBC_State_set_iv_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CBC_State_set_iv_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BufferedCipher_cq__Buffer_State_set_encrypt_key_fun_num_used 1
#else
#undef f_Nettle_BufferedCipher_cq__Buffer_State_set_encrypt_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BufferedCipher_cq__Buffer_State_set_decrypt_key_fun_num_used 1
#else
#undef f_Nettle_BufferedCipher_cq__Buffer_State_set_decrypt_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CBC_State_create_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CBC_State_create_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CBC_State_block_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CBC_State_block_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CBC_State_key_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CBC_State_key_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_Cipher_State_make_key_fun_num_used 1
#else
#undef f_Nettle_Cipher_State_make_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_Cipher_State_name_fun_num_used 1
#else
#undef f_Nettle_Cipher_State_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_Cipher_State_crypt_fun_num_used 1
#else
#undef f_Nettle_Cipher_State_crypt_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_Cipher_State_key_size_fun_num_used 1
#else
#undef f_Nettle_Cipher_State_key_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BufferedCipher_cq__Buffer_iv_size_fun_num_used 1
#else
#undef f_Nettle_BufferedCipher_cq__Buffer_iv_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BufferedCipher_cq__Buffer_cq__backtick_28_29_fun_num_used 1
#else
#undef f_Nettle_BufferedCipher_cq__Buffer_cq__backtick_28_29_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BufferedCipher_cq__Buffer_State_set_iv_fun_num_used 1
#else
#undef f_Nettle_BufferedCipher_cq__Buffer_State_set_iv_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BufferedCipher_cq__Buffer_block_size_fun_num_used 1
#else
#undef f_Nettle_BufferedCipher_cq__Buffer_block_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BufferedCipher_cq__Buffer_key_size_fun_num_used 1
#else
#undef f_Nettle_BufferedCipher_cq__Buffer_key_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BufferedCipher_cq__Buffer_State_name_fun_num_used 1
#else
#undef f_Nettle_BufferedCipher_cq__Buffer_State_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BufferedCipher_cq__Buffer_State_block_size_fun_num_used 1
#else
#undef f_Nettle_BufferedCipher_cq__Buffer_State_block_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BufferedCipher_cq__Buffer_State_key_size_fun_num_used 1
#else
#undef f_Nettle_BufferedCipher_cq__Buffer_State_key_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BufferedCipher_cq__Buffer_State_iv_size_fun_num_used 1
#else
#undef f_Nettle_BufferedCipher_cq__Buffer_State_iv_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BufferedCipher_cq__Buffer_State_crypt_fun_num_used 1
#else
#undef f_Nettle_BufferedCipher_cq__Buffer_State_crypt_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BufferedCipher_cq__Buffer_State_pad_fun_num_used 1
#else
#undef f_Nettle_BufferedCipher_cq__Buffer_State_pad_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BufferedCipher_cq__Buffer_State_unpad_fun_num_used 1
#else
#undef f_Nettle_BufferedCipher_cq__Buffer_State_unpad_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CBC_block_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CBC_block_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BufferedCipher_cq__Buffer_State_create_fun_num_used 1
#else
#undef f_Nettle_BufferedCipher_cq__Buffer_State_create_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CBC_State_name_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CBC_State_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CFB_State_set_iv_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CFB_State_set_iv_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CFB_State_crypt_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CFB_State_crypt_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CFB_State_create_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CFB_State_create_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CFB_State_block_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CFB_State_block_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CFB_State_iv_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CFB_State_iv_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CFB_State_key_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CFB_State_key_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CFB_State_set_encrypt_key_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CFB_State_set_encrypt_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CFB_State_set_decrypt_key_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CFB_State_set_decrypt_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CFB_State_cq__backtickobj_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CFB_State_cq__backtickobj_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__PCBC_State_name_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__PCBC_State_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__PCBC_State_crypt_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__PCBC_State_crypt_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher_cq__PCBC_State_program_fun_num_used 1
#else
#undef Nettle_BlockCipher_cq__PCBC_State_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CTR_State_cq__backtickobj_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CTR_State_cq__backtickobj_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CTR_State_block_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CTR_State_block_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CTR_State_set_iv_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CTR_State_set_iv_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CTR_State_key_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CTR_State_key_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CTR_State_iv_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CTR_State_iv_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CBC_name_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CBC_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CFB_cq__backtick_28_29_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CFB_cq__backtick_28_29_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BufferedCipher_cq__Buffer_name_fun_num_used 1
#else
#undef f_Nettle_BufferedCipher_cq__Buffer_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_BufferedCipher_program_fun_num_used 1
#else
#undef Nettle_BufferedCipher_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__PCBC_name_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__PCBC_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CBC_iv_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CBC_iv_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CBC_key_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CBC_key_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CFB_iv_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CFB_iv_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CFB_block_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CFB_block_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CFB_name_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CFB_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CFB_State_name_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CFB_State_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CFB_key_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CFB_key_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CTR_iv_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CTR_iv_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CTR_key_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CTR_key_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CTR_block_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CTR_block_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CTR_name_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CTR_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CTR_State_name_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CTR_State_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__CTR_cq__backtick_28_29_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__CTR_cq__backtick_28_29_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__OFB_iv_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__OFB_iv_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__OFB_key_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__OFB_key_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__OFB_block_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__OFB_block_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__OFB_name_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__OFB_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__OFB_State_name_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__OFB_State_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__OFB_State_block_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__OFB_State_block_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__OFB_State_create_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__OFB_State_create_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__OFB_State_cq__backtickobj_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__OFB_State_cq__backtickobj_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__OFB_State_crypt_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__OFB_State_crypt_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__OFB_State_set_iv_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__OFB_State_set_iv_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__OFB_State_set_decrypt_key_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__OFB_State_set_decrypt_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__OFB_State_set_encrypt_key_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__OFB_State_set_encrypt_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__OFB_State_key_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__OFB_State_key_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__OFB_State_iv_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__OFB_State_iv_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher_cq__OFB_cq__backtick_28_29_fun_num_used 1
#else
#undef f_Nettle_BlockCipher_cq__OFB_cq__backtick_28_29_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher_program_fun_num_used 1
#else
#undef Nettle_BlockCipher_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__CCM8_name_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__CCM8_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__CCM_key_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__CCM_key_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__CCM_iv_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__CCM_iv_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__CCM_name_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__CCM_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__CCM_State_digest_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__CCM_State_digest_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__CCM_State_crypt_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__CCM_State_crypt_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__CCM_State_update_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__CCM_State_update_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__CCM_State_set_iv_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__CCM_State_set_iv_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__CCM_State_set_decrypt_key_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__CCM_State_set_decrypt_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__CCM_State_set_encrypt_key_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__CCM_State_set_encrypt_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__CCM_State_name_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__CCM_State_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__CCM_State_create_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__CCM_State_create_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher16_cq__CCM_State_program_fun_num_used 1
#else
#undef Nettle_BlockCipher16_cq__CCM_State_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__CCM_block_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__CCM_block_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__CCM8_digest_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__CCM8_digest_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__GCM_name_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__GCM_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__GCM_key_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__GCM_key_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__EAX_iv_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__EAX_iv_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__EAX_name_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__EAX_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__EAX_key_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__EAX_key_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__EAX_State_name_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__EAX_State_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__EAX_State_create_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__EAX_State_create_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__EAX_State_crypt_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__EAX_State_crypt_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__EAX_State_update_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__EAX_State_update_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__EAX_State_set_iv_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__EAX_State_set_iv_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__EAX_State_set_decrypt_key_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__EAX_State_set_decrypt_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__EAX_State_set_encrypt_key_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__EAX_State_set_encrypt_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__EAX_State_key_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__EAX_State_key_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__EAX_State_iv_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__EAX_State_iv_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__EAX_State_block_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__EAX_State_block_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__GCM_digest_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__GCM_digest_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__GCM_block_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__GCM_block_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_AES_State_program_fun_num_used 1
#else
#undef Nettle_AES_State_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_ARCTWO_State_program_fun_num_used 1
#else
#undef Nettle_ARCTWO_State_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_ARCTWO_State_set_decrypt_key_fun_num_used 1
#else
#undef f_Nettle_ARCTWO_State_set_decrypt_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_ARCTWO_State_set_encrypt_key_fun_num_used 1
#else
#undef f_Nettle_ARCTWO_State_set_encrypt_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_ARCFOUR_State_program_fun_num_used 1
#else
#undef Nettle_ARCFOUR_State_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_BLOWFISH_State_program_fun_num_used 1
#else
#undef Nettle_BLOWFISH_State_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_CAMELLIA_State_program_fun_num_used 1
#else
#undef Nettle_CAMELLIA_State_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_CAST128_State_program_fun_num_used 1
#else
#undef Nettle_CAST128_State_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_CHACHA_State_program_fun_num_used 1
#else
#undef Nettle_CHACHA_State_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_CHACHA_State_set_iv_fun_num_used 1
#else
#undef f_Nettle_CHACHA_State_set_iv_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_CHACHA_State_crypt_fun_num_used 1
#else
#undef f_Nettle_CHACHA_State_crypt_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_DES_State_program_fun_num_used 1
#else
#undef Nettle_DES_State_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_DES_State_make_key_fun_num_used 1
#else
#undef f_Nettle_DES_State_make_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_DES_State_fix_parity_fun_num_used 1
#else
#undef f_Nettle_DES_State_fix_parity_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_DES3_State_program_fun_num_used 1
#else
#undef Nettle_DES3_State_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_DES3_State_make_key_fun_num_used 1
#else
#undef f_Nettle_DES3_State_make_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_SALSA20_State_set_iv_fun_num_used 1
#else
#undef f_Nettle_SALSA20_State_set_iv_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_DES3_fix_parity_fun_num_used 1
#else
#undef f_Nettle_DES3_fix_parity_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_SALSA20_State_program_fun_num_used 1
#else
#undef Nettle_SALSA20_State_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_SALSA20R12_program_fun_num_used 1
#else
#undef Nettle_SALSA20R12_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_SERPENT_State_program_fun_num_used 1
#else
#undef Nettle_SERPENT_State_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_Twofish_State_program_fun_num_used 1
#else
#undef Nettle_Twofish_State_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_IDEA_State_program_fun_num_used 1
#else
#undef Nettle_IDEA_State_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__EAX_block_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__EAX_block_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher16_cq__EAX_State_program_fun_num_used 1
#else
#undef Nettle_BlockCipher16_cq__EAX_State_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__EAX_State_digest_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__EAX_State_digest_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__GCM_State_create_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__GCM_State_create_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__GCM_State_update_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__GCM_State_update_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__GCM_State_set_iv_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__GCM_State_set_iv_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__GCM_State_set_decrypt_key_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__GCM_State_set_decrypt_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__GCM_State_set_encrypt_key_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__GCM_State_set_encrypt_key_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__GCM_State_key_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__GCM_State_key_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__GCM_State_iv_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__GCM_State_iv_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__GCM_State_digest_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__GCM_State_digest_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__GCM_State_block_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__GCM_State_block_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__GCM_State_name_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__GCM_State_name_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher16_program_fun_num_used 1
#else
#undef Nettle_BlockCipher16_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__GCM_iv_size_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__GCM_iv_size_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define Nettle_BlockCipher16_cq__GCM_State_program_fun_num_used 1
#else
#undef Nettle_BlockCipher16_cq__GCM_State_program_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__GCM_State_digest_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__GCM_State_digest_fun_num_used
#endif
#ifndef CMOD_COND_USED
# define f_Nettle_BlockCipher16_cq__GCM_State_crypt_fun_num_used 1
#else
#undef f_Nettle_BlockCipher16_cq__GCM_State_crypt_fun_num_used
#endif
#line 24 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#include "nettle.h"

#include <nettle/memxor.h>
#include <nettle/aes.h>
#ifdef HAVE_NETTLE_ARCTWO_H
#include <nettle/arctwo.h>
#endif
#include <nettle/arcfour.h>
#ifdef HAVE_NETTLE_BLOWFISH_DECRYPT
#include <nettle/blowfish.h>
#endif
#ifdef HAVE_NETTLE_CAMELLIA_H
#include <nettle/camellia.h>
#endif
#include <nettle/cast128.h>
#ifdef HAVE_NETTLE_CHACHA_H
#include <nettle/chacha.h>
#endif
#include <nettle/des.h>
#ifdef HAVE_NETTLE_SALSA20_CRYPT
#include <nettle/salsa20.h>
#endif
#ifdef HAVE_NETTLE_SERPENT_DECRYPT
#include <nettle/serpent.h>
#endif
#include <nettle/twofish.h>
#include "idea.h"
#include <nettle/nettle-meta.h>

#include <nettle/cbc.h>

#include <stdio.h>
#include <stdarg.h>

/*! @module Nettle
 */

static struct pike_string *nul13_string = NULL;
static struct pike_string *nul16_string = NULL;

/* Generic callback function for Nettle in case the crypt()
 * function in the object isn't a Nettle function.
 */
#ifdef dsa_params_init
/* Nettle 3.0 */
static void pike_crypt_func(const void *object, pike_nettle_size_t length,
uint8_t *dst, const uint8_t *src)
#else
static void pike_crypt_func(void *object, pike_nettle_size_t length,
uint8_t *dst, const uint8_t *src)
#endif
{
struct pike_string *str;
push_string(make_shared_binary_string((const char *)src, length));
apply(object, "crypt", 1);
get_all_args("crypt", 1, "%n", &str);
if (str->len != (ptrdiff_t)length) {
Pike_error("Bad string length %ld returned from crypt()\n",
DO_NOT_WARN((long)str->len));
}
memcpy(dst, str->str, length);
pop_stack();
}

#if !defined(HAVE_MEMXOR3) && !defined(memxor3)
/* Really old versions of nettle don't have memxor3().
 *
 * Note that prior to Nettle 3.1 memxor3() didn't have a namespace prefix.
 */
static unsigned char *pike_memxor3(unsigned char *dst, const unsigned char *a,
const unsigned char *b, size_t n)
{
size_t i;
for(i = 0; i < n; i++) {
dst[i] = a[i]^b[i];
}
return dst;
}

#define memxor3(D, A, B, N)	pike_memxor3((D), (A), (B), (N))
#endif

/* Calls Pike_error on errors */ 
typedef void (*pike_nettle_set_key_func)(void *ctx,
ptrdiff_t length, const char *key,
/* Force means to use key even if it is weak */
int force);

struct pike_cipher
{
const char *name;

unsigned context_size;

unsigned block_size;

/* Suggested key size; other sizes are sometimes possible. */
unsigned key_size;

pike_nettle_set_key_func set_encrypt_key;
pike_nettle_set_key_func set_decrypt_key;

pike_nettle_crypt_func encrypt;
pike_nettle_crypt_func decrypt;
};

#define _PIKE_CIPHER(name, NAME) {		\
  #name,					\
  sizeof(struct name##_ctx),			\
  NAME##_BLOCK_SIZE,				\
  NAME##_KEY_SIZE,				\
  pike_##name##_set_encrypt_key,		\
  pike_##name##_set_decrypt_key,		\
  (pike_nettle_crypt_func) name##_encrypt,	\
  (pike_nettle_crypt_func) name##_decrypt,	\
}





/*! @class Cipher
 *!
 *! Represents information about a cipher algorithm, such as
 *! name, key size, and block size.
 */

#undef class_Nettle_Cipher_defined
#define class_Nettle_Cipher_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_Cipher_program=NULL;

#ifdef Nettle_Cipher_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_Cipher_program_fun_num=-1;
#endif /* Nettle_Cipher_program_fun_num_used */
/*! @decl inherit __builtin.Nettle.Cipher
   */

#undef inherit_cq__22__builtin_2ENettle_2ECipher_22_Nettle_Cipher_defined
#define inherit_cq__22__builtin_2ENettle_2ECipher_22_Nettle_Cipher_defined
#line 154 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_Cipher_cq__22__builtin_2ENettle_2ECipher_22_inh_num = -1;
#line 154 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_Cipher_cq__22__builtin_2ENettle_2ECipher_22_inh_offset = -1;

#undef var_meta_Nettle_Cipher_defined
#define var_meta_Nettle_Cipher_defined

#undef THIS
#define THIS ((struct Nettle_Cipher_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_CIPHER
#define THIS_NETTLE_CIPHER ((struct Nettle_Cipher_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_CIPHER
#define OBJ2_NETTLE_CIPHER(o) ((struct Nettle_Cipher_struct *)(o->storage+Nettle_Cipher_storage_offset))

#undef GET_NETTLE_CIPHER_STORAGE
#define GET_NETTLE_CIPHER_STORAGE(o) ((struct Nettle_Cipher_struct *)(o->storage+Nettle_Cipher_storage_offset)
static ptrdiff_t Nettle_Cipher_storage_offset;
struct Nettle_Cipher_struct {

#ifdef var_meta_Nettle_Cipher_defined
#line 156 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
const struct pike_cipher *meta;
#endif /* var_meta_Nettle_Cipher_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_Cipher_struct *Nettle_Cipher_gdb_dummy_ptr;
#endif
#line 158 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
;


#undef internal_init_Nettle_Cipher_defined
#define internal_init_Nettle_Cipher_defined

#undef Nettle_Cipher_event_handler_defined
#define Nettle_Cipher_event_handler_defined
static void init_Nettle_Cipher_struct(void)
#line 161 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
THIS->meta = NULL;
}

/*! @decl string(0..255) name()
   *!
   *! @returns
   *!   A human readable name for the algorithm.
   */
#define f_Nettle_Cipher_name_defined

#ifdef f_Nettle_Cipher_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_Cipher_name_fun_num = 0;

#endif /* f_Nettle_Cipher_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_Cipher_name(INT32 args) {
#line 170 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
#line 172 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
if (!THIS->meta)
Pike_error("Cipher not properly initialized.\n");

push_text(THIS->meta->name);
}

}
/*! @decl int(1..) key_size()
   *!
   *! @returns
   *!   The recommended key size for the cipher.
   */
#define f_Nettle_Cipher_key_size_defined

#ifdef f_Nettle_Cipher_key_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_Cipher_key_size_fun_num = 0;

#endif /* f_Nettle_Cipher_key_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_Cipher_key_size(INT32 args) {
#line 184 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("key_size",args,0);
#line 186 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
if (!THIS->meta)
Pike_error("Cipher not properly initialized.\n");

push_int(THIS->meta->key_size);
}

}
/*! @decl int(1..) block_size()
   *!
   *! @returns
   *!   The block size of the cipher (1 for stream ciphers).
   */
#define f_Nettle_Cipher_block_size_defined

#ifdef f_Nettle_Cipher_block_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_Cipher_block_size_fun_num = 0;

#endif /* f_Nettle_Cipher_block_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_Cipher_block_size(INT32 args) {
#line 198 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("block_size",args,0);
#line 200 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
if (!THIS->meta)
Pike_error("Cipher not properly initialized.\n");

push_int(THIS->meta->block_size);
}

}
/*! @class State
   *!
   *! Base class for cipher contexts.
   */

#undef class_Nettle_Cipher_State_defined
#define class_Nettle_Cipher_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_Cipher_State_program=NULL;

#ifdef Nettle_Cipher_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_Cipher_State_program_fun_num=-1;
#endif /* Nettle_Cipher_State_program_fun_num_used */
/*! @decl inherit Cipher::State
*/


#undef extra_Nettle_Cipher_State_defined
#define extra_Nettle_Cipher_State_defined

#undef var_crypt_Nettle_Cipher_State_defined
#define var_crypt_Nettle_Cipher_State_defined

#undef var_ctx_Nettle_Cipher_State_defined
#define var_ctx_Nettle_Cipher_State_defined

#undef var_key_size_Nettle_Cipher_State_defined
#define var_key_size_Nettle_Cipher_State_defined

#undef THIS
#define THIS ((struct Nettle_Cipher_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_CIPHER_STATE
#define THIS_NETTLE_CIPHER_STATE ((struct Nettle_Cipher_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_CIPHER_STATE
#define OBJ2_NETTLE_CIPHER_STATE(o) ((struct Nettle_Cipher_State_struct *)(o->storage+Nettle_Cipher_State_storage_offset))

#undef GET_NETTLE_CIPHER_STATE_STORAGE
#define GET_NETTLE_CIPHER_STATE_STORAGE(o) ((struct Nettle_Cipher_State_struct *)(o->storage+Nettle_Cipher_State_storage_offset)
static ptrdiff_t Nettle_Cipher_State_storage_offset;
struct Nettle_Cipher_State_struct {

#ifdef var_crypt_Nettle_Cipher_State_defined
#line 242 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
pike_nettle_crypt_func crypt;
#endif /* var_crypt_Nettle_Cipher_State_defined */

#ifdef var_ctx_Nettle_Cipher_State_defined
#line 243 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
void *ctx;
#endif /* var_ctx_Nettle_Cipher_State_defined */

#ifdef var_key_size_Nettle_Cipher_State_defined
#line 244 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
int key_size;
#endif /* var_key_size_Nettle_Cipher_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_Cipher_State_struct *Nettle_Cipher_State_gdb_dummy_ptr;
#endif
#line 246 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
/* FIXME: Create should copy state from the other object, if
     * provided. */

#define GET_INFO()	((struct Nettle_Cipher_struct *)parent_storage(1, Nettle_Cipher_program))

/* Generate a random string of length @[size] on top of the stack. */
static void low_make_key(INT32 size)
{
push_text("Crypto.Random");
APPLY_MASTER("resolv",1);
if(TYPEOF(Pike_sp[-1]) != T_OBJECT)
Pike_error("Failed to resolv Crypto.Random.\n");
push_int(size);
apply(Pike_sp[-2].u.object, "random_string", 1);
stack_swap();
pop_stack();
}

/*! @decl State set_encrypt_key(string(0..255) key, void|int flags)
     *!
     *! Initializes the object for encryption. The @[key] memory will be
     *! cleared before released.
     *!
     *! @seealso
     *!   @[set_decrypt_key], @[crypt]
     */
#define f_Nettle_Cipher_State_set_encrypt_key_defined

#ifdef f_Nettle_Cipher_State_set_encrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_Cipher_State_set_encrypt_key_fun_num = 0;

#endif /* f_Nettle_Cipher_State_set_encrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_Cipher_State_set_encrypt_key(INT32 args) {
#line 272 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 272 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * flags;
#line 272 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_encrypt_key",args,1);
#line 272 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_encrypt_key",args,2);
#line 272 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",1,"string(0..255)");
#line 272 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
#line 272 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 272 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",2,"void|int");
#line 272 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
flags=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 272 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else flags = NULL;
#line 275 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct Nettle_Cipher_struct *info = GET_INFO();
assert(info);

if (!THIS->ctx || !info->meta)
Pike_error("CipherState not properly initialized.\n");

NO_WIDE_STRING(key);
key->flags |= STRING_CLEAR_ON_EXIT;
info->meta->set_encrypt_key(THIS->ctx, key->len, key->str,
flags ? flags->u.integer : 0);

THIS->crypt = info->meta->encrypt;
THIS->key_size = key->len;

do { struct object * ret_=(this_object()); pop_n_elems(args); push_object(ret_); return; }while(0);
#line 291 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl State set_decrypt_key(string(0..255) key, void|int flags)
     *!
     *! Initializes the object for decryption. The @[key] memory will be
     *! cleared before released.
     *!
     *! @seealso
     *!   @[set_encrypt_key], @[crypt]
     */
#define f_Nettle_Cipher_State_set_decrypt_key_defined

#ifdef f_Nettle_Cipher_State_set_decrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_Cipher_State_set_decrypt_key_fun_num = 0;

#endif /* f_Nettle_Cipher_State_set_decrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_Cipher_State_set_decrypt_key(INT32 args) {
#line 301 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 301 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * flags;
#line 301 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_decrypt_key",args,1);
#line 301 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_decrypt_key",args,2);
#line 301 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",1,"string(0..255)");
#line 301 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
#line 301 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 301 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",2,"void|int");
#line 301 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
flags=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 301 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else flags = NULL;
#line 304 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct Nettle_Cipher_struct *info = GET_INFO();
assert(info);

if (!THIS->ctx || !info->meta)
Pike_error("CipherState not properly initialized.\n");

NO_WIDE_STRING(key);
key->flags |= STRING_CLEAR_ON_EXIT;
info->meta->set_decrypt_key(THIS->ctx, key->len, key->str,
flags ? flags->u.integer : 0);
THIS->crypt = info->meta->decrypt;
THIS->key_size = key->len;

do { struct object * ret_=(this_object()); pop_n_elems(args); push_object(ret_); return; }while(0);
#line 319 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl string(0..255) make_key()
     *!
     *! Generate a key by calling @[Crypto.Random.random_string] and
     *! initialize this object for encryption with that key.
     *!
     *! @returns
     *!   The generated key. The key memory will be cleared before
     *!   released.
     *!
     *! @seealso
     *!   @[set_encrypt_key]
     */
#define f_Nettle_Cipher_State_make_key_defined

#ifdef f_Nettle_Cipher_State_make_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_Cipher_State_make_key_fun_num = 0;

#endif /* f_Nettle_Cipher_State_make_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_Cipher_State_make_key(INT32 args) {
#line 333 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("make_key",args,0);
#line 335 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct Nettle_Cipher_struct *info = GET_INFO();
assert(info);

low_make_key(info->meta->key_size);

stack_dup();
Pike_sp[-1].u.string->flags |= STRING_CLEAR_ON_EXIT;
apply_current(f_Nettle_Cipher_State_set_encrypt_key_fun_num, 1);
pop_stack();
}

}
/*! @decl string(0..255) crypt(string(0..255) data)
     *!
     *! Encrypts or decrypts data, using the current key. Neither the
     *! input nor output data is automatically memory scrubbed,
     *! unless @[String.secure] has been called on them.
     *!
     *! @param data
     *!   For block ciphers, data must be an integral number of blocks.
     *!
     *! @returns
     *!   The encrypted or decrypted data.
     */
#define f_Nettle_Cipher_State_crypt_defined

#ifdef f_Nettle_Cipher_State_crypt_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_Cipher_State_crypt_fun_num = 0;

#endif /* f_Nettle_Cipher_State_crypt_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_Cipher_State_crypt(INT32 args) {
#line 359 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * data;
#line 359 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("crypt",args,1);
#line 359 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("crypt",1,"string(0..255)");
#line 359 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(data=Pike_sp[0-1].u.string);
#line 361 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct Nettle_Cipher_struct *info = GET_INFO();
struct pike_string *s;
pike_nettle_crypt_func crypt;
void *ctx;
assert(info);

if (!(ctx = THIS->ctx) || !(crypt = THIS->crypt) || !info->meta)
Pike_error("CipherState not properly initialized.\n");

NO_WIDE_STRING(data);

if (data->len % info->meta->block_size)
Pike_error("Data must be an integral number of blocks.\n");

s = begin_shared_string(data->len);
if (data->len >= CIPHER_THREADS_ALLOW_THRESHOLD) {
THREADS_ALLOW();
crypt(ctx, data->len, STR0(s), STR0(data));
THREADS_DISALLOW();
} else {
crypt(ctx, data->len, STR0(s), STR0(data));
}
s = end_shared_string(s);
push_string(s);
}

}
/*! @decl string(0..255) name(void)
     *!
     *! @returns
     *!   A human readable name for the algorithm.
     *!
     *! @note
     *!   The default implementation just calls @[Cipher::name()]
     *!   in the parent.
     */
#define f_Nettle_Cipher_State_name_defined

#ifdef f_Nettle_Cipher_State_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_Cipher_State_name_fun_num = 0;

#endif /* f_Nettle_Cipher_State_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_Cipher_State_name(INT32 args) {
#line 397 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
#line 399 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(1, f_Nettle_Cipher_name_fun_num, args);
}

}
/*! @decl int(1..) key_size(void)
     *!
     *! @returns
     *!   The actual key size for this cipher.
     */
#define f_Nettle_Cipher_State_key_size_defined

#ifdef f_Nettle_Cipher_State_key_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_Cipher_State_key_size_fun_num = 0;

#endif /* f_Nettle_Cipher_State_key_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_Cipher_State_key_size(INT32 args) {
#line 408 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("key_size",args,0);
#line 410 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
do { INT_TYPE ret_=(THIS->key_size);  push_int(ret_); return; }while(0);
#line 412 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl int(1..) block_size(void)
     *!
     *! @returns
     *!   The block size for this cipher.
     *!
     *! @note
     *!   The default implementation just calls @[Cipher::block_size()]
     *!   in the parent.
     */
#define f_Nettle_Cipher_State_block_size_defined

#ifdef f_Nettle_Cipher_State_block_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_Cipher_State_block_size_fun_num = 0;

#endif /* f_Nettle_Cipher_State_block_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_Cipher_State_block_size(INT32 args) {
#line 423 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("block_size",args,0);
#line 425 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(1, f_Nettle_Cipher_block_size_fun_num, args);
}

}

#undef internal_init_Nettle_Cipher_State_defined
#define internal_init_Nettle_Cipher_State_defined

#undef Nettle_Cipher_State_event_handler_defined
#define Nettle_Cipher_State_event_handler_defined
static void init_Nettle_Cipher_State_struct(void)
#line 430 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
THIS->ctx = NULL;
THIS->crypt = NULL;
THIS->key_size = 0;
}


#undef Nettle_Cipher_State_gc_live_obj
#define Nettle_Cipher_State_gc_live_obj

#undef internal_exit_Nettle_Cipher_State_defined
#define internal_exit_Nettle_Cipher_State_defined

#undef Nettle_Cipher_State_event_handler_defined
#define Nettle_Cipher_State_event_handler_defined
static void exit_Nettle_Cipher_State_struct(void)
#line 437 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
if (THIS->ctx && Pike_fp->current_object->prog)
{
struct Nettle_Cipher_struct *info = GET_INFO();
assert(info);
assert(info->meta);
memset(THIS->ctx, 0, info->meta->context_size);
}
}

#ifdef Nettle_Cipher_State_event_handler_defined
static void Nettle_Cipher_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_Cipher_State_defined
  case PROG_EVENT_INIT: init_Nettle_Cipher_State_struct(); break;

#endif /* internal_init_Nettle_Cipher_State_defined */

#ifdef internal_exit_Nettle_Cipher_State_defined
  case PROG_EVENT_EXIT: exit_Nettle_Cipher_State_struct(); break;

#endif /* internal_exit_Nettle_Cipher_State_defined */
  default: break; 
  }
}

#endif /* Nettle_Cipher_State_event_handler_defined */
/*! @endclass State
   */

#ifdef Nettle_Cipher_event_handler_defined
static void Nettle_Cipher_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_Cipher_defined
  case PROG_EVENT_INIT: init_Nettle_Cipher_struct(); break;

#endif /* internal_init_Nettle_Cipher_defined */
  default: break; 
  }
}

#endif /* Nettle_Cipher_event_handler_defined */
/*! @endclass Cipher
 */

/*! @class BufferedCipher
 *!
 *! Extends the @[Cipher] class with the @[Buffer]
 *! meta cipher. This is in turn inherited by the
 *! @[BlockCipher] class, which is the base class
 *! for all block ciphers.
 */

#undef class_Nettle_BufferedCipher_defined
#define class_Nettle_BufferedCipher_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BufferedCipher_program=NULL;

#ifdef Nettle_BufferedCipher_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BufferedCipher_program_fun_num=-1;
#endif /* Nettle_BufferedCipher_program_fun_num_used */
#line 463 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
/* NOTE: MUST be first in the class to simplify access to symbols
   *       in Cipher!
   */
/*! @decl inherit Cipher
   */

#undef inherit_Nettle_Cipher_Nettle_BufferedCipher_defined
#define inherit_Nettle_Cipher_Nettle_BufferedCipher_defined
#line 468 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BufferedCipher_Nettle_Cipher_inh_num = -1;
#line 468 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BufferedCipher_Nettle_Cipher_inh_offset = -1;
#line 470 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#define PAD_SSL        0
#define PAD_ISO_10126  1
#define PAD_ANSI_X923  2
#define PAD_PKCS7      3
#define PAD_ZERO       4
#define PAD_TLS        5

/*! @module Buffer
   *! Acts as a buffer so that data can be fed to the cipher in blocks
   *! that don't correspond to cipher block sizes.
   *!
   *! @example
   *!   class Encrypter
   *!   {
   *!     protected Crypto.Cipher buffer;
   *!
   *!     void create(string key)
   *!     {
   *!       buffer = Crypto.AES.CBC.Buffer();
   *!       buffer->set_encrypt_key(key);
   *!     }
   *!
   *!     string feed(string data)
   *!     {
   *!       return buffer->crypt(data);
   *!     }
   *!
   *!     string drain()
   *!     {
   *!       return buffer->pad(Crypto.PAD_PKCS7);
   *!     }
   *!   }
   *!
   *! @seealso
   *!   @[BlockCipher.CBC], @[BlockCipher16.GCM]
   */

#undef var_Buffer_Nettle_BufferedCipher_defined
#define var_Buffer_Nettle_BufferedCipher_defined

#undef THIS
#define THIS ((struct Nettle_BufferedCipher_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_BUFFEREDCIPHER
#define THIS_NETTLE_BUFFEREDCIPHER ((struct Nettle_BufferedCipher_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_BUFFEREDCIPHER
#define OBJ2_NETTLE_BUFFEREDCIPHER(o) ((struct Nettle_BufferedCipher_struct *)(o->storage+Nettle_BufferedCipher_storage_offset))

#undef GET_NETTLE_BUFFEREDCIPHER_STORAGE
#define GET_NETTLE_BUFFEREDCIPHER_STORAGE(o) ((struct Nettle_BufferedCipher_struct *)(o->storage+Nettle_BufferedCipher_storage_offset)
static ptrdiff_t Nettle_BufferedCipher_storage_offset;
struct Nettle_BufferedCipher_struct {

#ifdef var_Buffer_Nettle_BufferedCipher_defined
  struct object * Buffer;

#endif /* var_Buffer_Nettle_BufferedCipher_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_BufferedCipher_struct *Nettle_BufferedCipher_gdb_dummy_ptr;
#endif

#undef class_Nettle_BufferedCipher_cq__Buffer_defined
#define class_Nettle_BufferedCipher_cq__Buffer_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BufferedCipher_cq__Buffer_program=NULL;

#ifdef Nettle_BufferedCipher_cq__Buffer_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BufferedCipher_cq__Buffer_program_fun_num=-1;
#endif /* Nettle_BufferedCipher_cq__Buffer_program_fun_num_used */
/*! @decl inherit __builtin.Nettle.Cipher
     */

#undef inherit_cq__22__builtin_2ENettle_2ECipher_22_Nettle_BufferedCipher_cq__Buffer_defined
#define inherit_cq__22__builtin_2ENettle_2ECipher_22_Nettle_BufferedCipher_cq__Buffer_defined
#line 513 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BufferedCipher_cq__Buffer_cq__22__builtin_2ENettle_2ECipher_22_inh_num = -1;
#line 513 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BufferedCipher_cq__Buffer_cq__22__builtin_2ENettle_2ECipher_22_inh_offset = -1;
#define f_Nettle_BufferedCipher_cq__Buffer_name_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BufferedCipher_cq__Buffer_name_fun_num = 0;

#endif /* f_Nettle_BufferedCipher_cq__Buffer_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BufferedCipher_cq__Buffer_name(INT32 args) {
#line 515 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
#line 517 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(1, f_Nettle_Cipher_name_fun_num, args);
push_constant_text(".Buffer");
f_add(2);
}

}
#define f_Nettle_BufferedCipher_cq__Buffer_block_size_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_block_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BufferedCipher_cq__Buffer_block_size_fun_num = 0;

#endif /* f_Nettle_BufferedCipher_cq__Buffer_block_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BufferedCipher_cq__Buffer_block_size(INT32 args) {
#line 523 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("block_size",args,0);
{
apply_external(1, f_Nettle_Cipher_block_size_fun_num, args);
}

}
#define f_Nettle_BufferedCipher_cq__Buffer_key_size_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_key_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BufferedCipher_cq__Buffer_key_size_fun_num = 0;

#endif /* f_Nettle_BufferedCipher_cq__Buffer_key_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BufferedCipher_cq__Buffer_key_size(INT32 args) {
#line 528 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("key_size",args,0);
{
apply_external(1, f_Nettle_Cipher_key_size_fun_num, args);
}

}
#define f_Nettle_BufferedCipher_cq__Buffer_iv_size_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_iv_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BufferedCipher_cq__Buffer_iv_size_fun_num = 0;

#endif /* f_Nettle_BufferedCipher_cq__Buffer_iv_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BufferedCipher_cq__Buffer_iv_size(INT32 args) {
#line 533 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("iv_size",args,0);
{
apply_external(1, f_Nettle_Cipher_block_size_fun_num, args);
}

}
/*! @class State
     *! Acts as a buffer so that data can be fed to the cipher in blocks
     *! that don't correspond to cipher block sizes.
     *!
     *! @example
     *!   class Encrypter
     *!   {
     *!     protected Crypto.Cipher buffer;
     *!
     *!     void create(string key)
     *!     {
     *!       buffer = Crypto.AES.CBC.Buffer();
     *!       buffer->set_encrypt_key(key);
     *!     }
     *!
     *!     string feed(string data)
     *!     {
     *!       return buffer->crypt(data);
     *!     }
     *!
     *!     string drain()
     *!     {
     *!       return buffer->pad(Crypto.PAD_PKCS7);
     *!     }
     *!   }
     *!
     *! @seealso
     *!   @[BlockCipher.CBC], @[BlockCipher16.GCM]
     */

#undef class_Nettle_BufferedCipher_cq__Buffer_State_defined
#define class_Nettle_BufferedCipher_cq__Buffer_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BufferedCipher_cq__Buffer_State_program=NULL;

#ifdef Nettle_BufferedCipher_cq__Buffer_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BufferedCipher_cq__Buffer_State_program_fun_num=-1;
#endif /* Nettle_BufferedCipher_cq__Buffer_State_program_fun_num_used */

#undef var_object_Nettle_BufferedCipher_cq__Buffer_State_defined
#define var_object_Nettle_BufferedCipher_cq__Buffer_State_defined

#undef var_block_size_Nettle_BufferedCipher_cq__Buffer_State_defined
#define var_block_size_Nettle_BufferedCipher_cq__Buffer_State_defined

#undef var_backlog_Nettle_BufferedCipher_cq__Buffer_State_defined
#define var_backlog_Nettle_BufferedCipher_cq__Buffer_State_defined

#undef var_backlog_len_Nettle_BufferedCipher_cq__Buffer_State_defined
#define var_backlog_len_Nettle_BufferedCipher_cq__Buffer_State_defined

#undef THIS
#define THIS ((struct Nettle_BufferedCipher_cq__Buffer_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_STATE
#define THIS_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_STATE ((struct Nettle_BufferedCipher_cq__Buffer_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_STATE
#define OBJ2_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_STATE(o) ((struct Nettle_BufferedCipher_cq__Buffer_State_struct *)(o->storage+Nettle_BufferedCipher_cq__Buffer_State_storage_offset))

#undef GET_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_STATE_STORAGE
#define GET_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_STATE_STORAGE(o) ((struct Nettle_BufferedCipher_cq__Buffer_State_struct *)(o->storage+Nettle_BufferedCipher_cq__Buffer_State_storage_offset)
static ptrdiff_t Nettle_BufferedCipher_cq__Buffer_State_storage_offset;
struct Nettle_BufferedCipher_cq__Buffer_State_struct {

#ifdef var_object_Nettle_BufferedCipher_cq__Buffer_State_defined
#line 570 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct object *object;
#endif /* var_object_Nettle_BufferedCipher_cq__Buffer_State_defined */

#ifdef var_block_size_Nettle_BufferedCipher_cq__Buffer_State_defined
#line 571 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
int block_size;
#endif /* var_block_size_Nettle_BufferedCipher_cq__Buffer_State_defined */

#ifdef var_backlog_Nettle_BufferedCipher_cq__Buffer_State_defined
#line 572 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
unsigned char *backlog;
#endif /* var_backlog_Nettle_BufferedCipher_cq__Buffer_State_defined */

#ifdef var_backlog_len_Nettle_BufferedCipher_cq__Buffer_State_defined
#line 573 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
int backlog_len;
#endif /* var_backlog_len_Nettle_BufferedCipher_cq__Buffer_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_BufferedCipher_cq__Buffer_State_struct *Nettle_BufferedCipher_cq__Buffer_State_gdb_dummy_ptr;
#endif

#undef internal_init_Nettle_BufferedCipher_cq__Buffer_State_defined
#define internal_init_Nettle_BufferedCipher_cq__Buffer_State_defined

#undef Nettle_BufferedCipher_cq__Buffer_State_event_handler_defined
#define Nettle_BufferedCipher_cq__Buffer_State_event_handler_defined
static void init_Nettle_BufferedCipher_cq__Buffer_State_struct(void)
#line 575 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
THIS->object = NULL;
THIS->block_size = 0;
THIS->backlog = NULL;
THIS->backlog_len = 0;
}


#undef internal_exit_Nettle_BufferedCipher_cq__Buffer_State_defined
#define internal_exit_Nettle_BufferedCipher_cq__Buffer_State_defined

#undef Nettle_BufferedCipher_cq__Buffer_State_event_handler_defined
#define Nettle_BufferedCipher_cq__Buffer_State_event_handler_defined
static void exit_Nettle_BufferedCipher_cq__Buffer_State_struct(void)
#line 584 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
if(THIS->backlog) {
guaranteed_memset(THIS->backlog, 0, THIS->block_size);
free(THIS->backlog);
THIS->backlog = NULL;
}
if(THIS->object) {
free_object(THIS->object);
THIS->object = NULL;
}
}

/*! @decl Cipher::State substate_factory()
       *!
       *! Returns the @[Cipher::State] object that this object
       *! is to operate on.
       *!
       *! Defaults to creating the State for the cipher implemented
       *! in the parent module.
       */
#define f_Nettle_BufferedCipher_cq__Buffer_State_substate_factory_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_substate_factory_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BufferedCipher_cq__Buffer_State_substate_factory_fun_num = 0;

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_substate_factory_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BufferedCipher_cq__Buffer_State_substate_factory(INT32 args) {
#line 604 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("substate_factory",args,0);
#line 606 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(2, Nettle_Cipher_State_program_fun_num, 0);
}

}
/*! @decl void create()
       *!
       *! Initialize the buffer with the @[Cipher::State] object
       *! returned by @[substate_factory()]. This is usually
       *! the State for the cipher implemented in the parent module.
       */
#define f_Nettle_BufferedCipher_cq__Buffer_State_create_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_create_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BufferedCipher_cq__Buffer_State_create_fun_num = 0;

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_create_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BufferedCipher_cq__Buffer_State_create(INT32 args) {
#line 616 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("create",args,0);
#line 618 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct object *o;
int block_size;
int f;

exit_Nettle_BufferedCipher_cq__Buffer_State_struct();

apply_current(f_Nettle_BufferedCipher_cq__Buffer_State_substate_factory_fun_num,
0);

if (TYPEOF(Pike_sp[-1]) != T_OBJECT) {
Pike_error("Unsupported return value from Cipher::State().\n");
}
o = Pike_sp[-1].u.object;
if (!o->prog) {
Pike_error("Cipher::State() returned destructed object.\n");
}

f = find_identifier("crypt", o->prog);
if (f < 0) {
Pike_error("State object has no crypt() function.\n");
}

apply(o, "block_size", 0);

if(TYPEOF(Pike_sp[-1]) != T_INT)
Pike_error("block_size() didn't return an int.\n");

block_size = Pike_sp[-1].u.integer;

if ((!block_size) || (block_size > 4096))
Pike_error("Bad block size %d.\n", block_size);

THIS->block_size = block_size;
THIS->backlog = xcalloc(1, block_size);
THIS->backlog_len = 0;

add_ref(THIS->object = o);

pop_n_elems(2);
}

}
/*! @decl string(0..255) name()
       *! Returns the name of the wrapped cipher with @expr{".Buffer"@}
       *! appended.
       */
#define f_Nettle_BufferedCipher_cq__Buffer_State_name_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BufferedCipher_cq__Buffer_State_name_fun_num = 0;

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BufferedCipher_cq__Buffer_State_name(INT32 args) {
#line 664 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
#line 666 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply(THIS->object, "name", 0);
push_constant_text(".Buffer");
f_add(2);
}

}
/*! @decl int(1..) block_size()
       *!
       *! Get the block size of the contained block crypto.
       */
#define f_Nettle_BufferedCipher_cq__Buffer_State_block_size_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_block_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BufferedCipher_cq__Buffer_State_block_size_fun_num = 0;

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_block_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BufferedCipher_cq__Buffer_State_block_size(INT32 args) {
#line 676 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("block_size",args,0);
#line 678 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
do { INT_TYPE ret_=(THIS->block_size);  push_int(ret_); return; }while(0);
#line 680 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl int(1..) key_size()
       *!
       *! Get the key size of the contained block crypto.
       */
#define f_Nettle_BufferedCipher_cq__Buffer_State_key_size_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_key_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BufferedCipher_cq__Buffer_State_key_size_fun_num = 0;

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_key_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BufferedCipher_cq__Buffer_State_key_size(INT32 args) {
#line 686 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("key_size",args,0);
#line 688 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply(THIS->object, "key_size", args);
}

}
/*! @decl int(0..) iv_size()
       *!
       *! Get the iv size of the contained block crypto.
       */
#define f_Nettle_BufferedCipher_cq__Buffer_State_iv_size_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_iv_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BufferedCipher_cq__Buffer_State_iv_size_fun_num = 0;

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_iv_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BufferedCipher_cq__Buffer_State_iv_size(INT32 args) {
#line 696 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("iv_size",args,0);
#line 698 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply(THIS->object, "iv_size", args);
}

}
/*! @decl this_program set_encrypt_key(string(0..255) key, @
       *!                                    void|int flags)
       *!
       *! Set the encryption key. The @[key] memory will be cleared before
       *! released.
       *!
       *! @note
       *!   As a side-effect any buffered data will be cleared.
       */
#define f_Nettle_BufferedCipher_cq__Buffer_State_set_encrypt_key_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_set_encrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BufferedCipher_cq__Buffer_State_set_encrypt_key_fun_num = 0;

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_set_encrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BufferedCipher_cq__Buffer_State_set_encrypt_key(INT32 args) {
#line 711 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 711 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * flags;
#line 711 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_encrypt_key",args,1);
#line 711 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_encrypt_key",args,2);
#line 711 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",1,"string(0..255)");
#line 711 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
#line 711 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 711 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",2,"void|int");
#line 711 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
flags=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 711 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else flags = NULL;
#line 713 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
THIS->backlog_len = 0;
key->flags |= STRING_CLEAR_ON_EXIT;
apply(THIS->object, "set_encrypt_key", args);
pop_stack();
push_object(this_object());
}

}
/*! @decl this_program set_decrypt_key(string(0..255) key, @
       *!                                    void|int flags)
       *!
       *! Set the decryption key. The @[key] memory will be cleared before
       *! released.
       *!
       *! @note
       *!   As a side-effect any buffered data will be cleared.
       */
#define f_Nettle_BufferedCipher_cq__Buffer_State_set_decrypt_key_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_set_decrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BufferedCipher_cq__Buffer_State_set_decrypt_key_fun_num = 0;

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_set_decrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BufferedCipher_cq__Buffer_State_set_decrypt_key(INT32 args) {
#line 730 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 730 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * flags;
#line 730 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_decrypt_key",args,1);
#line 730 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_decrypt_key",args,2);
#line 730 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",1,"string(0..255)");
#line 730 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
#line 730 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 730 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",2,"void|int");
#line 730 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
flags=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 730 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else flags = NULL;
#line 732 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
THIS->backlog_len = 0;
key->flags |= STRING_CLEAR_ON_EXIT;
apply(THIS->object, "set_decrypt_key", args);
pop_stack();
push_object(this_object());
}

}
/*! @decl string(0..255) crypt(string(0..255) data)
       *!
       *! Encrypt or decrypt some data.
       *!
       *! Adds data to be en/decrypted to the buffer. If there's enough
       *! data to en/decrypt a block, that will be done, and the result
       *! returned. Any unprocessed data will be left in the buffer.
       *!
       *! Neither the input or output data is not automatically memory
       *! scrubbed, unless @[String.secure] has been called on the data.
       */
#define f_Nettle_BufferedCipher_cq__Buffer_State_crypt_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_crypt_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BufferedCipher_cq__Buffer_State_crypt_fun_num = 0;

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_crypt_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BufferedCipher_cq__Buffer_State_crypt(INT32 args) {
#line 751 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * data;
#line 751 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("crypt",args,1);
#line 751 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("crypt",1,"string(0..255)");
#line 751 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(data=Pike_sp[0-1].u.string);
#line 751 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
ptrdiff_t strings = 0;
ptrdiff_t soffset = 0;
ptrdiff_t len;

if (THIS->backlog_len) {
if (data->len >= (THIS->block_size - THIS->backlog_len)) {
memcpy(THIS->backlog + THIS->backlog_len, data->str,
(THIS->block_size - THIS->backlog_len));
soffset += (THIS->block_size - THIS->backlog_len);
THIS->backlog_len = 0;
push_string(make_shared_binary_string((char *)THIS->backlog,
THIS->block_size));
apply(THIS->object, "crypt", 1);
if (TYPEOF(Pike_sp[-1]) != T_STRING)
Pike_error("crypt() did not return string\n");
if (Pike_sp[-1].u.string->len != THIS->block_size)
Pike_error("Unexpected string length %ld\n",
DO_NOT_WARN((long)Pike_sp[-1].u.string->len));
strings++;
} else {
memcpy(THIS->backlog + THIS->backlog_len,
data->str, data->len);
THIS->backlog_len += data->len;
pop_n_elems(args);
push_empty_string();
return;
}
}

len = (data->len - soffset);
len -= len % THIS->block_size;

if (len) {
push_string( string_slice( data, soffset, len ) );
soffset += len;

apply(THIS->object, "crypt", 1);

if (TYPEOF(Pike_sp[-1]) != T_STRING)
Pike_error("crypt() did not return string.\n");
if (Pike_sp[-1].u.string->len != len)
Pike_error("crypt() Unexpected string length %ld.\n",
DO_NOT_WARN((long)Pike_sp[-1].u.string->len));

strings++;
}

if (soffset < data->len) {
memcpy(THIS->backlog, data->str + soffset, data->len - soffset);
THIS->backlog_len = data->len - soffset;
}

if( !strings )
push_empty_string();
else if( strings > 1 )
f_add( strings );

stack_pop_n_elems_keep_top(args);
}

}
/*! @decl string(0..255) pad(void|int method)
       *!
       *! Pad and encrypt any data left in the buffer. The output data is
       *! not automatically memory scrubbed, unless @[String.secure] is
       *! called on the data.
       *!
       *! @param method
       *! The type of padding to apply to the buffer.
       *! @int
       *!   @value Crypto.PAD_ISO_10126
       *!     Pads according to ISO 10126, which means filling all extra
       *!     space with random data and putting the size of the
       *!     non-payload data last.
       *!   @value Crypto.PAD_TLS
       *!   @value Crypto.PAD_SSL
       *!     Pads according to RFC 5246 section 6.2.3.2, meaning that all
       *!     extra space is filled with the size of the padding. Note
       *!     that this size has an off by one difference to the other
       *!     schemas, so 0 means 1 byte of padding.
       *!   @value Crypto.PAD_ANSI_X923
       *!     Pads according to ANSI X.923, which means filling all extra
       *!     space with zero and putting the size of the non-payload data
       *!     last.
       *!   @value Crypto.PAD_PKCS7
       *!     Pads according to PKCS7 / RFC 3852, which means filling all
       *!     extra space with the size of the extra space.
       *!   @value Crypto.PAD_ZERO
       *!     Fills the extra space with null bytes. To correctly remove
       *!     the padding the clear text data must not end with a null
       *!     byte. In that case the data would have to be manually
       *!     padded/unpadded before/after calling @[crypt()].
       *! @endint
       *! Defaults to Crypto.PAD_SSL for compatibility reasons.
       *!
       *! @seealso
       *!   @[unpad()]
       */
#define f_Nettle_BufferedCipher_cq__Buffer_State_pad_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_pad_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BufferedCipher_cq__Buffer_State_pad_fun_num = 0;

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_pad_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BufferedCipher_cq__Buffer_State_pad(INT32 args) {
#line 849 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * method;
#line 849 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 1) wrong_number_of_args_error("pad",args,1);
#line 849 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 0) &&
    ((TYPEOF(Pike_sp[0-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[0-args]) != NUMBER_UNDEFINED))) {
#line 849 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("pad",1,"void|int");
#line 849 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
method=Pike_sp+0-args; dmalloc_touch_svalue(Pike_sp+0-args);
#line 849 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else method = NULL;
#line 849 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
ptrdiff_t i;
int m = 0;
int size = THIS->block_size - THIS->backlog_len;

if(method)
{
if(TYPEOF(*method) != PIKE_T_INT)
Pike_error("Bad argument type.\n");
m = method->u.integer;
}

switch(m)
{
case PAD_SSL:
case PAD_TLS:
size--;
break;
case PAD_ZERO:
if( THIS->backlog_len>0 &&
THIS->backlog[THIS->backlog_len-1] == 0 )
Pike_error("Using zero padding on a zero terminated string.\n");
size = 0;
break;
}

for (i = THIS->backlog_len; i < THIS->block_size - 1; i++)
switch(m)
{
default:
Pike_error("Unknown method.\n");
case PAD_SSL:
case PAD_TLS:
/* TLS 1.1 and forward */
THIS->backlog[i] = size;
break;
case PAD_ISO_10126:
/* ISO 10126 */
THIS->backlog[i] = DO_NOT_WARN((unsigned char)(my_rand() & 0xff));
break;
case PAD_ANSI_X923:
/* ANSI X.923 */
THIS->backlog[i] = 0;
break;
case PAD_PKCS7:
/* PKCS7 / RFC 3852 */
THIS->backlog[i] = DO_NOT_WARN((unsigned char)size);
break;
case PAD_ZERO:
/* Null only */
THIS->backlog[i] = 0;
break;
}

THIS->backlog[THIS->block_size - 1] = DO_NOT_WARN((unsigned char)size);
push_string(make_shared_binary_string((const char *)THIS->backlog, THIS->block_size));

THIS->backlog_len = 0;

apply(THIS->object, "crypt", 1);
}

}
/*! @decl string(0..255) unpad(string(0..255) data, void|int method)
       *!
       *! Decrypt and unpad a block of data. Neither the input or output
       *! data is not automatically memory scrubbed, unless
       *! @[String.secure] has been called on the data.
       *!
       *! This performs the reverse operation of @[pad()]. The padding
       *! will be verified to be correct, if possible. If not, zero is
       *! returned.
       *!
       *! @param method
       *! The type of padding that was applied to the original buffer.
       *! @int
       *!   @value Crypto.PAD_SSL
       *!   @value Crypto.PAD_TLS
       *!   @value Crypto.PAD_ISO_10126
       *!   @value Crypto.PAD_ANSI_X923
       *!   @value Crypto.PAD_PKCS7
       *!   @value Crypto.PAD_ZERO
       *! @endint
       *! Defaults to Crypto.PAD_SSL for compatibility reasons.
       *!
       *! @seealso
       *!   @[pad()]
       */
#define f_Nettle_BufferedCipher_cq__Buffer_State_unpad_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_unpad_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BufferedCipher_cq__Buffer_State_unpad_fun_num = 0;

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_unpad_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BufferedCipher_cq__Buffer_State_unpad(INT32 args) {
#line 936 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * str;
#line 936 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * method;
#line 936 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("unpad",args,1);
#line 936 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("unpad",args,2);
#line 936 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("unpad",1,"string(0..255)");
#line 936 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(str=Pike_sp[0-args].u.string);
#line 936 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 936 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("unpad",2,"void|int");
#line 936 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
method=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 936 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else method = NULL;
#line 936 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
ptrdiff_t len, bytes;
int m = 0, i, invalid = 0, padding=0;

len = str->len + THIS->backlog_len;
if( len % THIS->block_size)
Pike_error("Total data size must be integral numbers of blocks.\n");

if( method!=NULL )
{
m = method->u.integer;
pop_stack();
args--;
}

f_Nettle_BufferedCipher_cq__Buffer_State_crypt(1);
if (TYPEOF(Pike_sp[-1]) != T_STRING)
Pike_error("crypt() did not return string.\n");
if (Pike_sp[-1].u.string->len != len)
Pike_error("crypt() Unexpected string length %ld.\n",
DO_NOT_WARN((long)Pike_sp[-1].u.string->len));
str = Pike_sp[-1].u.string;

bytes = STR0(str)[len - 1];
if( m==PAD_SSL || m==PAD_TLS ) bytes++;

/* FIXME: Shouldn't this be supported? */
if (bytes > str->len)
Pike_error("Invalid padding (%d > %d)\n", bytes, str->len);

switch( m )
{
default:
Pike_error("Unknown method.\n");
case PAD_ISO_10126:
case PAD_ZERO:
case PAD_SSL:
break;
case PAD_ANSI_X923:
padding = 0;
goto do_check;
case PAD_TLS:
padding = bytes-1;
goto do_check;
case PAD_PKCS7:
padding = bytes;
do_check:
/* Try to be constant time here. */
invalid = 1;
for(i=len-256; i<len-1; i++) {
if (i < 0) i = 0;
if (i == len-bytes) invalid = 0;
invalid |= (STR0(str)[i] ^ padding);
}
/* NB: If bytes <= 1 the loop will terminate before the
	   *     case where invalid is reset to zero is reached.
	   */
if (bytes <= 1) invalid = 0;
break;
}

if( m == PAD_ZERO )
{
int c=THIS->block_size;
while( str->str[len-1]==0 && c>0 )
{
c--;
len--;
}
}
else
len -= bytes;

if (len < 0)
Pike_error("String too short to unpad\n");

add_ref(str);
pop_stack();
push_string(make_shared_binary_string(str->str, len));
free_string(str);
if( invalid )
{
pop_stack();
push_int(0);
}
}

}
/*! @decl this_program set_iv(string(0..255) iv)
       *! Set the initialization vector to @[iv].
       */
#define f_Nettle_BufferedCipher_cq__Buffer_State_set_iv_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_set_iv_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BufferedCipher_cq__Buffer_State_set_iv_fun_num = 0;

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_set_iv_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BufferedCipher_cq__Buffer_State_set_iv(INT32 args) {
#line 1026 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * iv;
#line 1026 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("set_iv",args,1);
#line 1026 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_iv",1,"string(0..255)");
#line 1026 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(iv=Pike_sp[0-1].u.string);
#line 1028 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply(THIS->object, "set_iv", args);
args = 1;
do { struct object * ret_=(this_object()); pop_stack(); push_object(ret_); return; }while(0);
#line 1032 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}
}

#ifdef Nettle_BufferedCipher_cq__Buffer_State_event_handler_defined
static void Nettle_BufferedCipher_cq__Buffer_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_BufferedCipher_cq__Buffer_State_defined
  case PROG_EVENT_INIT: init_Nettle_BufferedCipher_cq__Buffer_State_struct(); break;

#endif /* internal_init_Nettle_BufferedCipher_cq__Buffer_State_defined */

#ifdef internal_exit_Nettle_BufferedCipher_cq__Buffer_State_defined
  case PROG_EVENT_EXIT: exit_Nettle_BufferedCipher_cq__Buffer_State_struct(); break;

#endif /* internal_exit_Nettle_BufferedCipher_cq__Buffer_State_defined */
  default: break; 
  }
}

#endif /* Nettle_BufferedCipher_cq__Buffer_State_event_handler_defined */
/*! @endclass State
     */

/*! @decl State `()()
     *!
     *! @returns
     *!   Returns a new @[State] object.
     */
#define f_Nettle_BufferedCipher_cq__Buffer_cq__backtick_28_29_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_cq__backtick_28_29_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BufferedCipher_cq__Buffer_cq__backtick_28_29_fun_num = 0;

#endif /* f_Nettle_BufferedCipher_cq__Buffer_cq__backtick_28_29_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BufferedCipher_cq__Buffer_cq__backtick_28_29(INT32 args) {
#line 1042 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("`()",args,0);
{
apply_current(Nettle_BufferedCipher_cq__Buffer_State_program_fun_num,
args);
}

}
/*! @endmodule Buffer
   */


#undef internal_init_Nettle_BufferedCipher_defined
#define internal_init_Nettle_BufferedCipher_defined

#undef Nettle_BufferedCipher_event_handler_defined
#define Nettle_BufferedCipher_event_handler_defined
static void init_Nettle_BufferedCipher_struct(void)
#line 1053 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_current(Nettle_BufferedCipher_cq__Buffer_program_fun_num, 0);
if (TYPEOF(Pike_sp[-1]) == T_OBJECT) {
add_ref(THIS_NETTLE_BUFFEREDCIPHER->Buffer = Pike_sp[-1].u.object);
}
pop_stack();
}

#ifdef Nettle_BufferedCipher_event_handler_defined
static void Nettle_BufferedCipher_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_BufferedCipher_defined
  case PROG_EVENT_INIT: init_Nettle_BufferedCipher_struct(); break;

#endif /* internal_init_Nettle_BufferedCipher_defined */
  default: break; 
  }
}

#endif /* Nettle_BufferedCipher_event_handler_defined */
/*! @endclass BufferedCipher */

#line 1063 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#define BUFFEREDCIPHER_CIPHER_INHERIT	1

/*! @class BlockCipher
 *!
 *! Base class for all block ciphers.
 *!
 *! Extends the @[BufferedCipher] class with various operating modes.
 */

#undef class_Nettle_BlockCipher_defined
#define class_Nettle_BlockCipher_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher_program=NULL;

#ifdef Nettle_BlockCipher_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher_program_fun_num=-1;
#endif /* Nettle_BlockCipher_program_fun_num_used */
/*! @decl inherit __builtin.Nettle.BlockCipher
   */

#undef inherit_cq__22__builtin_2ENettle_2EBlockCipher_22_Nettle_BlockCipher_defined
#define inherit_cq__22__builtin_2ENettle_2EBlockCipher_22_Nettle_BlockCipher_defined
#line 1075 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher_cq__22__builtin_2ENettle_2EBlockCipher_22_inh_num = -1;
#line 1075 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher_cq__22__builtin_2ENettle_2EBlockCipher_22_inh_offset = -1;
/*! @decl inherit BufferedCipher
   */

#undef inherit_Nettle_BufferedCipher_Nettle_BlockCipher_defined
#define inherit_Nettle_BufferedCipher_Nettle_BlockCipher_defined
#line 1079 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher_Nettle_BufferedCipher_inh_num = -1;
#line 1079 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset = -1;
/*! @module CBC
   *! Implementation of the cipher block chaining mode (CBC).
   *!
   *! Works as a wrapper for the cipher implemented by overloading
   *! the parent class (@[Cipher]).
   *!
   *! @seealso
   *!   @[Crypto.CBC], @[GCM]
   */

#undef var_CBC_Nettle_BlockCipher_defined
#define var_CBC_Nettle_BlockCipher_defined

#undef class_Nettle_BlockCipher_cq__CBC_defined
#define class_Nettle_BlockCipher_cq__CBC_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher_cq__CBC_program=NULL;

#ifdef Nettle_BlockCipher_cq__CBC_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher_cq__CBC_program_fun_num=-1;
#endif /* Nettle_BlockCipher_cq__CBC_program_fun_num_used */
/*! @decl inherit BufferedCipher
     */

#undef inherit_Nettle_BufferedCipher_Nettle_BlockCipher_cq__CBC_defined
#define inherit_Nettle_BufferedCipher_Nettle_BlockCipher_cq__CBC_defined
#line 1097 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher_cq__CBC_Nettle_BufferedCipher_inh_num = -1;
#line 1097 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher_cq__CBC_Nettle_BufferedCipher_inh_offset = -1;
#define f_Nettle_BlockCipher_cq__CBC_name_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CBC_name_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CBC_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CBC_name(INT32 args) {
#line 1099 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
#line 1101 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(1, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
f_Nettle_Cipher_name_fun_num, args);
push_constant_text(".CBC");
f_add(2);
}

}
#define f_Nettle_BlockCipher_cq__CBC_block_size_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_block_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CBC_block_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CBC_block_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CBC_block_size(INT32 args) {
#line 1108 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("block_size",args,0);
{
apply_external(1, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
f_Nettle_Cipher_block_size_fun_num, args);
}

}
#define f_Nettle_BlockCipher_cq__CBC_key_size_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_key_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CBC_key_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CBC_key_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CBC_key_size(INT32 args) {
#line 1114 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("key_size",args,0);
{
apply_external(1, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
f_Nettle_Cipher_key_size_fun_num, args);
}

}
#define f_Nettle_BlockCipher_cq__CBC_iv_size_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_iv_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CBC_iv_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CBC_iv_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CBC_iv_size(INT32 args) {
#line 1120 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("iv_size",args,0);
{
apply_external(1, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
f_Nettle_Cipher_block_size_fun_num, args);
}

}
/*! @class State
     */

#undef class_Nettle_BlockCipher_cq__CBC_State_defined
#define class_Nettle_BlockCipher_cq__CBC_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher_cq__CBC_State_program=NULL;

#ifdef Nettle_BlockCipher_cq__CBC_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher_cq__CBC_State_program_fun_num=-1;
#endif /* Nettle_BlockCipher_cq__CBC_State_program_fun_num_used */
/*! @decl inherit Cipher::State
*/


#undef extra_Nettle_BlockCipher_cq__CBC_State_defined
#define extra_Nettle_BlockCipher_cq__CBC_State_defined

#undef var_object_Nettle_BlockCipher_cq__CBC_State_defined
#define var_object_Nettle_BlockCipher_cq__CBC_State_defined

#undef var_crypt_state_Nettle_BlockCipher_cq__CBC_State_defined
#define var_crypt_state_Nettle_BlockCipher_cq__CBC_State_defined

#undef var_iv_Nettle_BlockCipher_cq__CBC_State_defined
#define var_iv_Nettle_BlockCipher_cq__CBC_State_defined
#line 1162 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
/* NB: Not finished. */

#undef var_block_size_Nettle_BlockCipher_cq__CBC_State_defined
#define var_block_size_Nettle_BlockCipher_cq__CBC_State_defined

#undef var_mode_Nettle_BlockCipher_cq__CBC_State_defined
#define var_mode_Nettle_BlockCipher_cq__CBC_State_defined

#undef THIS
#define THIS ((struct Nettle_BlockCipher_cq__CBC_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_BLOCKCIPHER_CQ__CBC_STATE
#define THIS_NETTLE_BLOCKCIPHER_CQ__CBC_STATE ((struct Nettle_BlockCipher_cq__CBC_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_BLOCKCIPHER_CQ__CBC_STATE
#define OBJ2_NETTLE_BLOCKCIPHER_CQ__CBC_STATE(o) ((struct Nettle_BlockCipher_cq__CBC_State_struct *)(o->storage+Nettle_BlockCipher_cq__CBC_State_storage_offset))

#undef GET_NETTLE_BLOCKCIPHER_CQ__CBC_STATE_STORAGE
#define GET_NETTLE_BLOCKCIPHER_CQ__CBC_STATE_STORAGE(o) ((struct Nettle_BlockCipher_cq__CBC_State_struct *)(o->storage+Nettle_BlockCipher_cq__CBC_State_storage_offset)
static ptrdiff_t Nettle_BlockCipher_cq__CBC_State_storage_offset;
struct Nettle_BlockCipher_cq__CBC_State_struct {

#ifdef var_object_Nettle_BlockCipher_cq__CBC_State_defined
  struct object * object;

#endif /* var_object_Nettle_BlockCipher_cq__CBC_State_defined */

#ifdef var_crypt_state_Nettle_BlockCipher_cq__CBC_State_defined
#line 1161 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct Nettle_Cipher_State_struct *crypt_state;
#endif /* var_crypt_state_Nettle_BlockCipher_cq__CBC_State_defined */

#ifdef var_iv_Nettle_BlockCipher_cq__CBC_State_defined
#line 1162 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string *iv;
#endif /* var_iv_Nettle_BlockCipher_cq__CBC_State_defined */

#ifdef var_block_size_Nettle_BlockCipher_cq__CBC_State_defined
#line 1163 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
INT32 block_size;
#endif /* var_block_size_Nettle_BlockCipher_cq__CBC_State_defined */

#ifdef var_mode_Nettle_BlockCipher_cq__CBC_State_defined
#line 1164 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
INT32 mode;
#endif /* var_mode_Nettle_BlockCipher_cq__CBC_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_BlockCipher_cq__CBC_State_struct *Nettle_BlockCipher_cq__CBC_State_gdb_dummy_ptr;
#endif

#undef internal_exit_Nettle_BlockCipher_cq__CBC_State_defined
#define internal_exit_Nettle_BlockCipher_cq__CBC_State_defined

#undef Nettle_BlockCipher_cq__CBC_State_event_handler_defined
#define Nettle_BlockCipher_cq__CBC_State_event_handler_defined
static void exit_Nettle_BlockCipher_cq__CBC_State_struct(void)
#line 1168 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
if(THIS->object) {
free_object(THIS->object);
THIS->object = NULL;
}
if(THIS->iv) {
free_string(THIS->iv);
THIS->iv = NULL;
}
}

/*! @decl Cipher::State substate_factory()
       *!
       *! Returns the @[Cipher::State] object that this object
       *! is to operate on.
       *!
       *! Defaults to creating the State for the cipher implemented
       *! in the parent module.
       */
#define f_Nettle_BlockCipher_cq__CBC_State_substate_factory_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_substate_factory_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CBC_State_substate_factory_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CBC_State_substate_factory_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CBC_State_substate_factory(INT32 args) {
#line 1187 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("substate_factory",args,0);
#line 1189 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(2, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
Nettle_Cipher_State_program_fun_num, 0);
}

}
/*! @decl void create()
       *!
       *! Initialize the CBC state with the @[Cipher::State] object
       *! returned by @[substate_factory()]. This is usually
       *! the State for the cipher implemented in the parent module.
       */
#define f_Nettle_BlockCipher_cq__CBC_State_create_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_create_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CBC_State_create_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CBC_State_create_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CBC_State_create(INT32 args) {
#line 1200 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("create",args,0);
#line 1202 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct object *o;
struct inherit *inh;
unsigned old_block_size = THIS->block_size;
unsigned block_size;
int f;

apply_current(f_Nettle_BlockCipher_cq__CBC_State_substate_factory_fun_num,
0);

if (TYPEOF(Pike_sp[-1]) != T_OBJECT) {
Pike_error("Unsupported return value from Cipher::State().\n");
}
o = Pike_sp[-1].u.object;
if (!o->prog) {
Pike_error("Cipher::State() returned destructed object.\n");
}

f = find_identifier("crypt", o->prog);
if (f < 0) {
Pike_error("State object has no crypt() function.\n");
}

apply(o, "block_size", 0);

if(TYPEOF(Pike_sp[-1]) != T_INT)
Pike_error("block_size() didn't return an int.\n");

block_size = Pike_sp[-1].u.integer;

if ((!block_size) || (block_size > 4096))
Pike_error("Bad block size %d.\n", block_size);

if(THIS->iv) {
free_string(THIS->iv);
THIS->iv = NULL;
}

THIS->block_size = block_size;

THIS->iv = begin_shared_string(block_size);
memset(STR0(THIS->iv), 0, block_size);
THIS->iv->flags |= STRING_CLEAR_ON_EXIT;

if (THIS->object) free_object(THIS->object);
add_ref(THIS->object = o);

inh = INHERIT_FROM_INT(o->prog, f);
if (inh->prog == Nettle_Cipher_State_program) {
/* crypt() is from Nettle.Cipher.State.
	   * Check if the context and crypt function are valid.
	   */
THIS->crypt_state = (struct Nettle_Cipher_State_struct *)
get_inherit_storage(o, inh - o->prog->inherits);
} else {
THIS->crypt_state = NULL;
}

pop_n_elems(2);
}

}
/*! @decl string(0..255) name()
       *! Returns the string @expr{"CBC(x)"@} where x is the
       *! encapsulated algorithm.
       */
#define f_Nettle_BlockCipher_cq__CBC_State_name_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CBC_State_name_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CBC_State_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CBC_State_name(INT32 args) {
#line 1267 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
#line 1269 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
push_text("CBC(");
apply(THIS->object, "name", 0);
push_text(")");
f_add(3);
}

}
/*! @decl int(1..) block_size()
       *! Returns the block size of the encapsulated cipher.
       */
#define f_Nettle_BlockCipher_cq__CBC_State_block_size_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_block_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CBC_State_block_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CBC_State_block_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CBC_State_block_size(INT32 args) {
#line 1279 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("block_size",args,0);
#line 1281 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
do { INT_TYPE ret_=(THIS->block_size);  push_int(ret_); return; }while(0);
#line 1283 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl int(1..) key_size()
       *! Returns the key size of the encapsulated cipher.
       */
#define f_Nettle_BlockCipher_cq__CBC_State_key_size_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_key_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CBC_State_key_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CBC_State_key_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CBC_State_key_size(INT32 args) {
#line 1288 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("key_size",args,0);
#line 1290 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply(THIS->object, "key_size", args);
}

}
/*! @decl int(1..) iv_size()
       *! Returns the size for the initialization vector
       */
#define f_Nettle_BlockCipher_cq__CBC_State_iv_size_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_iv_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CBC_State_iv_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CBC_State_iv_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CBC_State_iv_size(INT32 args) {
#line 1297 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("iv_size",args,0);
#line 1299 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
do { INT_TYPE ret_=(THIS->block_size);  push_int(ret_); return; }while(0);
#line 1301 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl this_program set_encrypt_key(string(0..255) key, int|void flags)
       *!
       *! Prepare the cipher and the wrapper for encrypting with the given
       *! @[key]. The @[key] memory will be cleared before released.
       */
#define f_Nettle_BlockCipher_cq__CBC_State_set_encrypt_key_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_set_encrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CBC_State_set_encrypt_key_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CBC_State_set_encrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CBC_State_set_encrypt_key(INT32 args) {
#line 1308 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 1308 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * flags;
#line 1308 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_encrypt_key",args,1);
#line 1308 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_encrypt_key",args,2);
#line 1308 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",1,"string(0..255)");
#line 1308 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
#line 1308 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 1308 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",2,"int|void");
#line 1308 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
flags=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 1308 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else flags = NULL;
#line 1310 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
assert(THIS->block_size);
THIS->mode = 0;
key->flags |= STRING_CLEAR_ON_EXIT;
apply(THIS->object, "set_encrypt_key", args);
pop_stack();
push_object(this_object());
}

}
/*! @decl this_program set_decrypt_key(string(0..255) key, int|void flags)
       *!
       *! Prepare the cipher and the wrapper for decrypting with the given
       *! @[key]. The @[key] memory will be cleared before released.
       */
#define f_Nettle_BlockCipher_cq__CBC_State_set_decrypt_key_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_set_decrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CBC_State_set_decrypt_key_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CBC_State_set_decrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CBC_State_set_decrypt_key(INT32 args) {
#line 1324 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 1324 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * flags;
#line 1324 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_decrypt_key",args,1);
#line 1324 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_decrypt_key",args,2);
#line 1324 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",1,"string(0..255)");
#line 1324 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
#line 1324 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 1324 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",2,"int|void");
#line 1324 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
flags=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 1324 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else flags = NULL;
#line 1326 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
assert(THIS->block_size);
THIS->mode = 1;
key->flags |= STRING_CLEAR_ON_EXIT;
apply(THIS->object, "set_decrypt_key", args);
pop_stack();
push_object(this_object());
}

}
/*! @decl this_program set_iv(string(0..255) iv)
       *!
       *! Set the initialization vector to @[iv]. The @[iv] memory will be
       *! cleared before released.
       */
#define f_Nettle_BlockCipher_cq__CBC_State_set_iv_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_set_iv_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CBC_State_set_iv_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CBC_State_set_iv_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CBC_State_set_iv(INT32 args) {
#line 1340 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * iv;
#line 1340 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("set_iv",args,1);
#line 1340 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_iv",1,"string(0..255)");
#line 1340 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(iv=Pike_sp[0-1].u.string);
#line 1342 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
assert(THIS->iv);
iv->flags |= STRING_CLEAR_ON_EXIT;
NO_WIDE_STRING(iv);
if(iv->len != THIS->block_size)
Pike_error("Argument incompatible with cipher block size.\n");
memcpy(STR0(THIS->iv), STR0(iv), THIS->block_size);
do { struct object * ret_=(this_object()); pop_stack(); push_object(ret_); return; }while(0);
#line 1350 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl string(0..255) crypt(string(0..255) data)
       *!
       *! Encrypt/decrypt @[data] and return the result. @[data] must
       *! be an integral number of blocks.
       *!
       *! Neither the input or output data is not automatically memory
       *! scrubbed, unless @[String.secure] has been called on the data.
       */
#define f_Nettle_BlockCipher_cq__CBC_State_crypt_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_crypt_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CBC_State_crypt_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CBC_State_crypt_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CBC_State_crypt(INT32 args) {
#line 1360 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * data;
#line 1360 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("crypt",args,1);
#line 1360 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("crypt",1,"string(0..255)");
#line 1360 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(data=Pike_sp[0-1].u.string);
{
struct pike_string *result;
ONERROR uwp;
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;
struct pike_string *iv = THIS->iv;
int block_size = THIS->block_size;

NO_WIDE_STRING(data);

if(data->len % block_size)
Pike_error("Data length not multiple of block size.\n");

if (!THIS->object || !THIS->object->prog) {
Pike_error("Lookup in destructed object.\n");
}

result = begin_shared_string(data->len);
SET_ONERROR (uwp, do_free_string, result);

if (THIS->crypt_state && THIS->crypt_state->crypt) {
func = THIS->crypt_state->crypt;
ctx = THIS->crypt_state->ctx;
}

if(THIS->mode == 0) {
if ((data->len >= CIPHER_THREADS_ALLOW_THRESHOLD) &&
(func != pike_crypt_func)) {
/* Protect the iv from being freed by a different thread. */
add_ref(iv);
THREADS_ALLOW();
cbc_encrypt(ctx, func, block_size, STR0(iv),
data->len, STR0(result), STR0(data));
THREADS_DISALLOW();
free_string(iv);
} else {
cbc_encrypt(ctx, func, block_size, STR0(iv),
data->len, STR0(result), STR0(data));
}
}
else {
if ((data->len >= CIPHER_THREADS_ALLOW_THRESHOLD) &&
(func != pike_crypt_func)) {
/* Protect the iv from being freed by a different thread. */
add_ref(iv);
THREADS_ALLOW();
cbc_decrypt(ctx, func, block_size, STR0(iv),
data->len, STR0(result), STR0(data));
THREADS_DISALLOW();
free_string(iv);
} else {
cbc_decrypt(ctx, func, block_size, STR0(iv),
data->len, STR0(result), STR0(data));
}
}

pop_n_elems(args);
push_string(end_shared_string(result));
UNSET_ONERROR(uwp);
}
}

#ifdef Nettle_BlockCipher_cq__CBC_State_event_handler_defined
static void Nettle_BlockCipher_cq__CBC_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_exit_Nettle_BlockCipher_cq__CBC_State_defined
  case PROG_EVENT_EXIT: exit_Nettle_BlockCipher_cq__CBC_State_struct(); break;

#endif /* internal_exit_Nettle_BlockCipher_cq__CBC_State_defined */
  default: break; 
  }
}

#endif /* Nettle_BlockCipher_cq__CBC_State_event_handler_defined */
/*! @endclass State
     */
/*! @endmodule CBC
   */

/*! @module PCBC
   *! Implementation of the propagating cipher block chaining mode (PCBC).
   *!
   *! This mode is also known as plaintext cipher block chaining (from
   *! Kerberos v4).
   *!
   *! Works as a wrapper for the cipher implemented by overloading
   *! the parent class (@[Cipher]).
   *!
   *! @seealso
   *!   @[CBC], @[GCM]
   */

#undef var_PCBC_Nettle_BlockCipher_defined
#define var_PCBC_Nettle_BlockCipher_defined

#undef class_Nettle_BlockCipher_cq__PCBC_defined
#define class_Nettle_BlockCipher_cq__PCBC_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher_cq__PCBC_program=NULL;

#ifdef Nettle_BlockCipher_cq__PCBC_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher_cq__PCBC_program_fun_num=-1;
#endif /* Nettle_BlockCipher_cq__PCBC_program_fun_num_used */
/*! @decl inherit _CBC
     */
#line 1447 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int f_pcbc_inh_cbc_state_program_fun_num = -1;


#undef extra_Nettle_BlockCipher_cq__PCBC_defined
#define extra_Nettle_BlockCipher_cq__PCBC_defined
#define f_Nettle_BlockCipher_cq__PCBC_name_defined

#ifdef f_Nettle_BlockCipher_cq__PCBC_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__PCBC_name_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__PCBC_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__PCBC_name(INT32 args) {
#line 1460 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
#line 1462 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(1, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
f_Nettle_Cipher_name_fun_num, args);
push_constant_text(".PCBC");
f_add(2);
}

}
/*! @class State
     */

#undef class_Nettle_BlockCipher_cq__PCBC_State_defined
#define class_Nettle_BlockCipher_cq__PCBC_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher_cq__PCBC_State_program=NULL;

#ifdef Nettle_BlockCipher_cq__PCBC_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher_cq__PCBC_State_program_fun_num=-1;
#endif /* Nettle_BlockCipher_cq__PCBC_State_program_fun_num_used */
/*! @decl inherit _CBC::State
*/

#line 1477 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int f_pcbc_state_inh_cbc_state_crypt_fun_num = -1;


#undef extra_Nettle_BlockCipher_cq__PCBC_State_defined
#define extra_Nettle_BlockCipher_cq__PCBC_State_defined
/*! @decl string(0..255) name()
       *! Returns the string @expr{"PCBC(x)"@} where x is the
       *! encapsulated algorithm.
       */
#define f_Nettle_BlockCipher_cq__PCBC_State_name_defined

#ifdef f_Nettle_BlockCipher_cq__PCBC_State_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__PCBC_State_name_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__PCBC_State_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__PCBC_State_name(INT32 args) {
#line 1496 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
#line 1498 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct Nettle_BlockCipher_cq__CBC_State_struct *cbc_state =
get_inherited_storage(1, Nettle_BlockCipher_cq__CBC_State_program);

push_constant_text("PCBC(");
apply(cbc_state->object, "name", 0);
push_constant_text(")");
f_add(3);
}

}
/*! @decl string(0..255) crypt(string(0..255) data)
       *!
       *! Encrypt/decrypt @[data] and return the result. @[data] must
       *! be an integral number of blocks.
       *!
       *! Neither the input or output data is not automatically memory
       *! scrubbed, unless @[String.secure] has been called on the data.
       */
#define f_Nettle_BlockCipher_cq__PCBC_State_crypt_defined

#ifdef f_Nettle_BlockCipher_cq__PCBC_State_crypt_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__PCBC_State_crypt_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__PCBC_State_crypt_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__PCBC_State_crypt(INT32 args) {
#line 1516 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * data;
#line 1516 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("crypt",args,1);
#line 1516 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("crypt",1,"string(0..255)");
#line 1516 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(data=Pike_sp[0-1].u.string);
{
struct Nettle_BlockCipher_cq__CBC_State_struct *cbc_state =
get_inherited_storage(1, Nettle_BlockCipher_cq__CBC_State_program);

struct pike_string *propagated;
ONERROR uwp;
int block_size = cbc_state->block_size;

NO_WIDE_STRING(data);

if(data->len % block_size) {
Pike_error("Data length not multiple of block size.\n");
}

if (!cbc_state->object || !cbc_state->object->prog) {
Pike_error("Lookup in destructed object.\n");
}

if (!data->len) {
return;
}

if (cbc_state->mode == 0) {
propagated = begin_shared_string(data->len);
memcpy(STR0(propagated), STR0(data), block_size);
if (data->len > block_size) {
memxor3(STR0(propagated) + block_size, STR0(data) + block_size,
STR0(data), data->len - block_size);
}

pop_stack();
push_string(propagated); /* NB: Not shared! */

apply_current(f_pcbc_state_inh_cbc_state_crypt_fun_num, 1);

/* Update the iv with the last block of the plaintext. */
memxor(STR0(cbc_state->iv), STR0(data) + data->len - block_size,
block_size);
} else {
ptrdiff_t offset;

apply_current(f_pcbc_state_inh_cbc_state_crypt_fun_num, 1);

data = Pike_sp[-1].u.string;

if (data->len == block_size) {
memxor(STR0(cbc_state->iv), STR0(data), block_size);
return;
}

propagated = begin_shared_string(data->len);
memcpy(STR0(propagated), STR0(data), block_size);

for(offset = block_size; offset < data->len; offset += block_size) {
memxor3(STR0(propagated) + offset, STR0(data) + offset,
STR0(propagated) + offset - block_size, block_size);
}
memxor(STR0(cbc_state->iv),
STR0(propagated) + offset - block_size, block_size);

pop_stack();
push_string(end_shared_string(propagated));
}
}
}
/*! @endclass State
     */
/*! @endmodule PCBC
   */

/*! @module CFB
   *! Implementation of Cipher Feed-Back mode (CFB).
   *!
   *! @seealso
   *!   @[CBC], @[GCM]
   */

#undef var_CFB_Nettle_BlockCipher_defined
#define var_CFB_Nettle_BlockCipher_defined

#undef class_Nettle_BlockCipher_cq__CFB_defined
#define class_Nettle_BlockCipher_cq__CFB_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher_cq__CFB_program=NULL;

#ifdef Nettle_BlockCipher_cq__CFB_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher_cq__CFB_program_fun_num=-1;
#endif /* Nettle_BlockCipher_cq__CFB_program_fun_num_used */
/*! @decl inherit BufferedCipher
     */

#undef inherit_Nettle_BufferedCipher_Nettle_BlockCipher_cq__CFB_defined
#define inherit_Nettle_BufferedCipher_Nettle_BlockCipher_cq__CFB_defined
#line 1601 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher_cq__CFB_Nettle_BufferedCipher_inh_num = -1;
#line 1601 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher_cq__CFB_Nettle_BufferedCipher_inh_offset = -1;
/*! @decl string(0..255) name()
     *! Returns the base cipher name appended with the string @expr{".CFB"@}.
     */
#define f_Nettle_BlockCipher_cq__CFB_name_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CFB_name_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CFB_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CFB_name(INT32 args) {
#line 1606 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
#line 1608 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(1, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
f_Nettle_Cipher_name_fun_num, args);
push_text(".CFB");
f_add(2);
}

}
#define f_Nettle_BlockCipher_cq__CFB_block_size_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_block_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CFB_block_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CFB_block_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CFB_block_size(INT32 args) {
#line 1615 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("block_size",args,0);
{
apply_external(1, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
f_Nettle_Cipher_block_size_fun_num, args);
}

}
#define f_Nettle_BlockCipher_cq__CFB_key_size_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_key_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CFB_key_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CFB_key_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CFB_key_size(INT32 args) {
#line 1621 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("key_size",args,0);
{
apply_external(1, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
f_Nettle_Cipher_key_size_fun_num, args);
}

}
#define f_Nettle_BlockCipher_cq__CFB_iv_size_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_iv_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CFB_iv_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CFB_iv_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CFB_iv_size(INT32 args) {
#line 1627 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("iv_size",args,0);
{
apply_external(1, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
f_Nettle_Cipher_block_size_fun_num, args);
}

}
/*! @class State
     *!
     *! The state for a CFB instance.
     */

#undef class_Nettle_BlockCipher_cq__CFB_State_defined
#define class_Nettle_BlockCipher_cq__CFB_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher_cq__CFB_State_program=NULL;

#ifdef Nettle_BlockCipher_cq__CFB_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher_cq__CFB_State_program_fun_num=-1;
#endif /* Nettle_BlockCipher_cq__CFB_State_program_fun_num_used */
/*! @decl inherit BufferedCipher::State
*/


#undef extra_Nettle_BlockCipher_cq__CFB_State_defined
#define extra_Nettle_BlockCipher_cq__CFB_State_defined

#undef var_object_Nettle_BlockCipher_cq__CFB_State_defined
#define var_object_Nettle_BlockCipher_cq__CFB_State_defined

#undef var_crypt_state_Nettle_BlockCipher_cq__CFB_State_defined
#define var_crypt_state_Nettle_BlockCipher_cq__CFB_State_defined

#undef var_iv_Nettle_BlockCipher_cq__CFB_State_defined
#define var_iv_Nettle_BlockCipher_cq__CFB_State_defined
#line 1671 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
/* NB: Not finished. */

#undef var_block_size_Nettle_BlockCipher_cq__CFB_State_defined
#define var_block_size_Nettle_BlockCipher_cq__CFB_State_defined

#undef var_mode_Nettle_BlockCipher_cq__CFB_State_defined
#define var_mode_Nettle_BlockCipher_cq__CFB_State_defined

#undef THIS
#define THIS ((struct Nettle_BlockCipher_cq__CFB_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_BLOCKCIPHER_CQ__CFB_STATE
#define THIS_NETTLE_BLOCKCIPHER_CQ__CFB_STATE ((struct Nettle_BlockCipher_cq__CFB_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_BLOCKCIPHER_CQ__CFB_STATE
#define OBJ2_NETTLE_BLOCKCIPHER_CQ__CFB_STATE(o) ((struct Nettle_BlockCipher_cq__CFB_State_struct *)(o->storage+Nettle_BlockCipher_cq__CFB_State_storage_offset))

#undef GET_NETTLE_BLOCKCIPHER_CQ__CFB_STATE_STORAGE
#define GET_NETTLE_BLOCKCIPHER_CQ__CFB_STATE_STORAGE(o) ((struct Nettle_BlockCipher_cq__CFB_State_struct *)(o->storage+Nettle_BlockCipher_cq__CFB_State_storage_offset)
static ptrdiff_t Nettle_BlockCipher_cq__CFB_State_storage_offset;
struct Nettle_BlockCipher_cq__CFB_State_struct {

#ifdef var_object_Nettle_BlockCipher_cq__CFB_State_defined
  struct object * object;

#endif /* var_object_Nettle_BlockCipher_cq__CFB_State_defined */

#ifdef var_crypt_state_Nettle_BlockCipher_cq__CFB_State_defined
#line 1670 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct Nettle_Cipher_State_struct *crypt_state;
#endif /* var_crypt_state_Nettle_BlockCipher_cq__CFB_State_defined */

#ifdef var_iv_Nettle_BlockCipher_cq__CFB_State_defined
#line 1671 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string *iv;
#endif /* var_iv_Nettle_BlockCipher_cq__CFB_State_defined */

#ifdef var_block_size_Nettle_BlockCipher_cq__CFB_State_defined
#line 1672 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
INT32 block_size;
#endif /* var_block_size_Nettle_BlockCipher_cq__CFB_State_defined */

#ifdef var_mode_Nettle_BlockCipher_cq__CFB_State_defined
#line 1673 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
INT32 mode;
#endif /* var_mode_Nettle_BlockCipher_cq__CFB_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_BlockCipher_cq__CFB_State_struct *Nettle_BlockCipher_cq__CFB_State_gdb_dummy_ptr;
#endif

#undef internal_exit_Nettle_BlockCipher_cq__CFB_State_defined
#define internal_exit_Nettle_BlockCipher_cq__CFB_State_defined

#undef Nettle_BlockCipher_cq__CFB_State_event_handler_defined
#define Nettle_BlockCipher_cq__CFB_State_event_handler_defined
static void exit_Nettle_BlockCipher_cq__CFB_State_struct(void)
#line 1677 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
if (THIS->object) {
free_object(THIS->object);
THIS->object = NULL;
}
if (THIS->iv) {
free_string(THIS->iv);
THIS->iv = NULL;
}
}

/*! @decl object `obj()
       *!
       *! Getter for the wrapped cipher algorithm.
       */
#define f_Nettle_BlockCipher_cq__CFB_State_cq__backtickobj_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_cq__backtickobj_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CFB_State_cq__backtickobj_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CFB_State_cq__backtickobj_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CFB_State_cq__backtickobj(INT32 args) {
#line 1692 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("`obj",args,0);
{
if (THIS->object) {
ref_push_object(THIS->object);
} else {
push_int(0);
}
}

}
/*! @decl Cipher::State substate_factory()
       *!
       *! Returns the @[Cipher::State] object that this object
       *! is to operate on.
       *!
       *! Defaults to creating the State for the cipher implemented
       *! in the parent module.
       */
#define f_Nettle_BlockCipher_cq__CFB_State_substate_factory_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_substate_factory_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CFB_State_substate_factory_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CFB_State_substate_factory_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CFB_State_substate_factory(INT32 args) {
#line 1709 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("substate_factory",args,0);
#line 1711 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(2, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
Nettle_Cipher_State_program_fun_num, 0);
}

}
/*! @decl void create()
       *!
       *! Initialize the CFB state with the @[Cipher::State] object
       *! returned by @[substate_factory()]. This is usually
       *! the State for the cipher implemented in the parent module.
       */
#define f_Nettle_BlockCipher_cq__CFB_State_create_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_create_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CFB_State_create_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CFB_State_create_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CFB_State_create(INT32 args) {
#line 1722 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("create",args,0);
#line 1724 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct object *o;
struct inherit *inh;
int old_block_size = THIS->block_size;
int block_size;
int f;

if (THIS->object) free_object(THIS->object);
THIS->object = NULL;
THIS->crypt_state = NULL;

apply_current(f_Nettle_BlockCipher_cq__CFB_State_substate_factory_fun_num,
0);

if (TYPEOF(Pike_sp[-1]) != T_OBJECT) {
Pike_error("Unsupported return value from Cipher::State().\n");
}
o = Pike_sp[-1].u.object;
if (!o->prog) {
Pike_error("Cipher::State() returned destructed object.\n");
}

f = find_identifier("crypt", o->prog);
if (f < 0) {
Pike_error("State object has no crypt() function.\n");
}

apply(o, "block_size", 0);

if(TYPEOF(Pike_sp[-1]) != T_INT)
Pike_error("block_size() didn't return an int.\n");

block_size = Pike_sp[-1].u.integer;

if ((block_size <= 0) || (block_size > 4096))
Pike_error("Bad block size %d.\n", block_size);

inh = INHERIT_FROM_INT(o->prog, f);
if (inh->prog == Nettle_Cipher_State_program) {
/* crypt() is from Nettle.Cipher.State.
	   * Check if the context and crypt function are valid.
	   */
THIS->crypt_state = (struct Nettle_Cipher_State_struct *)
get_inherit_storage(o, inh - o->prog->inherits);
}

if(THIS->iv) {
free_string(THIS->iv);
THIS->iv = NULL;
}

THIS->iv = begin_shared_string(block_size);
memset(STR0(THIS->iv), 0, block_size);
THIS->iv->flags |= STRING_CLEAR_ON_EXIT;

THIS->block_size = block_size;
THIS->mode = 0;

add_ref(THIS->object = o);

pop_n_elems(2);
}

}
/*! @decl string(0..255) name()
       *! Returns the string @expr{"CFB(x)"@} where x is the
       *! encapsulated algorithm.
       */
#define f_Nettle_BlockCipher_cq__CFB_State_name_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CFB_State_name_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CFB_State_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CFB_State_name(INT32 args) {
#line 1791 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
#line 1793 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
push_text("CFB(");
apply(THIS->object, "name", 0);
push_text(")");
f_add(3);
}

}
/*! @decl int(1..) block_size()
       *! Returns the block size of the encapsulated cipher.
       */
#define f_Nettle_BlockCipher_cq__CFB_State_block_size_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_block_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CFB_State_block_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CFB_State_block_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CFB_State_block_size(INT32 args) {
#line 1803 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("block_size",args,0);
#line 1805 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
do { INT_TYPE ret_=(THIS->block_size);  push_int(ret_); return; }while(0);
#line 1807 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl int(1..) iv_size()
       *! Returns the size for the initialization vector
       */
#define f_Nettle_BlockCipher_cq__CFB_State_iv_size_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_iv_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CFB_State_iv_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CFB_State_iv_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CFB_State_iv_size(INT32 args) {
#line 1812 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("iv_size",args,0);
#line 1814 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
do { INT_TYPE ret_=(THIS->block_size);  push_int(ret_); return; }while(0);
#line 1816 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl int(1..) key_size()
       *! Returns the key size of the encapsulated cipher.
       */
#define f_Nettle_BlockCipher_cq__CFB_State_key_size_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_key_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CFB_State_key_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CFB_State_key_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CFB_State_key_size(INT32 args) {
#line 1821 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("key_size",args,0);
#line 1823 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply(THIS->object, "key_size", args);
}

}
/*! @decl this_program set_encrypt_key(string(0..255) key, int|void flags)
       *!
       *! Prepare the cipher and the wrapper for encrypting with the given
       *! @[key]. The @[key] memory will be cleared before released.
       *!
       *! @note
       *!   Note that this operation does not by itself reset the
       *!   context sufficiently to start a new message; @[set_iv()]
       *!   needs to be called too.
       *!
       *! @seealso
       *!   @[set_decrypt_key()], @[set_iv()]
       */
#define f_Nettle_BlockCipher_cq__CFB_State_set_encrypt_key_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_set_encrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CFB_State_set_encrypt_key_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CFB_State_set_encrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CFB_State_set_encrypt_key(INT32 args) {
#line 1840 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 1840 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * flags;
#line 1840 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_encrypt_key",args,1);
#line 1840 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_encrypt_key",args,2);
#line 1840 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",1,"string(0..255)");
#line 1840 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
#line 1840 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 1840 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",2,"int|void");
#line 1840 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
flags=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 1840 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else flags = NULL;
#line 1842 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;
key->flags |= STRING_CLEAR_ON_EXIT;
apply(THIS->object, "set_encrypt_key", args);
pop_stack();
THIS->mode = 0;

push_object(this_object());
}

}
/*! @decl this_program set_decrypt_key(string(0..255) key, int|void flags)
       *!
       *! Prepare the cipher and the wrapper for decrypting with the given
       *! @[key]. The @[key] memory will be cleared before released.
       *!
       *! @note
       *!   Note that this operation does not by itself reset the
       *!   context sufficiently to start a new message; @[set_iv()]
       *!   needs to be called too.
       *!
       *! @seealso
       *!   @[set_encrypt_key()], @[set_iv()]
       */
#define f_Nettle_BlockCipher_cq__CFB_State_set_decrypt_key_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_set_decrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CFB_State_set_decrypt_key_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CFB_State_set_decrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CFB_State_set_decrypt_key(INT32 args) {
#line 1866 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 1866 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * flags;
#line 1866 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_decrypt_key",args,1);
#line 1866 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_decrypt_key",args,2);
#line 1866 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",1,"string(0..255)");
#line 1866 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
#line 1866 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 1866 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",2,"int|void");
#line 1866 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
flags=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 1866 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else flags = NULL;
#line 1868 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;
key->flags |= STRING_CLEAR_ON_EXIT;
/* NOTE: CFB always uses the encryption function
	 *       of the underlying cipher!
	 */
apply(THIS->object, "set_encrypt_key", args);
pop_stack();
THIS->mode = 1;

push_object(this_object());
}

}
/*! @decl this_program set_iv(string(0..255) iv)
       *!
       *! Set the initialization vector to @[iv]. The @[iv] memory will be
       *! cleared before released.
       *!
       *! @note
       *!   @[iv] must have the length reported by @[iv_size()].
       *!
       *! @seealso
       *!   @[set_encrypt_key()], @[set_decrypt_key()].
       */
#define f_Nettle_BlockCipher_cq__CFB_State_set_iv_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_set_iv_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CFB_State_set_iv_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CFB_State_set_iv_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CFB_State_set_iv(INT32 args) {
#line 1893 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * iv;
#line 1893 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("set_iv",args,1);
#line 1893 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_iv",1,"string(0..255)");
#line 1893 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(iv=Pike_sp[0-1].u.string);
#line 1895 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
iv->flags |= STRING_CLEAR_ON_EXIT;
NO_WIDE_STRING(iv);
if(iv->len != THIS->block_size)
Pike_error("Argument incompatible with cipher block size.\n");
memcpy(STR0(THIS->iv), STR0(iv), THIS->block_size);
do { struct object * ret_=(this_object()); pop_stack(); push_object(ret_); return; }while(0);
#line 1902 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl string(0..255) crypt(string(0..255) data)
       *!
       *! Encrypt/decrypt @[data] and return the result. @[data] must
       *! be an integral number of blocks.
       *!
       *! The length of @[data] MUST be a multiple of the block size
       *! for all calls except the last.
       *!
       *! Neither the input or output data is not automatically memory
       *! scrubbed, unless @[String.secure] has been called on the data.
       *!
       *! @seealso
       *!   @[update()], @[digest()]
       */
#define f_Nettle_BlockCipher_cq__CFB_State_crypt_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_crypt_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CFB_State_crypt_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CFB_State_crypt_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CFB_State_crypt(INT32 args) {
#line 1918 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * data;
#line 1918 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("crypt",args,1);
#line 1918 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("crypt",1,"string(0..255)");
#line 1918 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(data=Pike_sp[0-1].u.string);
{
struct pike_string *result;
ONERROR uwp;
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;
struct pike_string *iv = THIS->iv;
unsigned block_size = (unsigned)THIS->block_size;

NO_WIDE_STRING(data);

if (!THIS->object || !THIS->object->prog) {
Pike_error("Lookup in destructed object.\n");
}

if (!data->len) return;

result = begin_shared_string(data->len);
SET_ONERROR (uwp, do_free_string, result);

if (THIS->crypt_state && THIS->crypt_state->crypt) {
func = THIS->crypt_state->crypt;
ctx = THIS->crypt_state->ctx;
}

if (!THIS->mode) {
/* Encryption. */
const uint8_t *prev = STR0(iv);
uint8_t *src = STR0(data);
uint8_t *dst = STR0(result);
pike_nettle_size_t bytes = data->len;

if ((data->len >= CIPHER_THREADS_ALLOW_THRESHOLD) &&
(func != pike_crypt_func)) {
/* Protect the iv from being freed by a different thread. */
add_ref(iv);
THREADS_ALLOW();
while (bytes >= block_size) {
func(ctx, block_size, STR0(iv), prev);
memxor3(dst, STR0(iv), src, block_size);
prev = dst;
dst += block_size;
src += block_size;
bytes -= block_size;
}
if (!bytes) {
memcpy(STR0(iv), dst - block_size, block_size);
} else {
/* Trailer partial block. */
func(ctx, block_size, STR0(iv), prev);
memxor3(dst, STR0(iv), src, bytes);
memcpy(STR0(iv), dst, bytes);
}
THREADS_DISALLOW();
free_string(iv);
} else {
while (bytes >= block_size) {
func(ctx, block_size, STR0(iv), prev);
memxor3(dst, STR0(iv), src, block_size);
prev = dst;
dst += block_size;
src += block_size;
bytes -= block_size;
}
if (!bytes) {
memcpy(STR0(iv), dst - block_size, block_size);
} else {
/* Trailer partial block. */
func(ctx, block_size, STR0(iv), prev);
memxor3(dst, STR0(iv), src, bytes);
memcpy(STR0(iv), dst, bytes);
}
}
} else {
/* Decryption. */
unsigned trailer_len = data->len % block_size;
unsigned blocked_len = data->len - trailer_len;
if ((data->len >= CIPHER_THREADS_ALLOW_THRESHOLD) &&
(func != pike_crypt_func)) {
/* Protect the iv from being freed by a different thread. */
add_ref(iv);
THREADS_ALLOW();
if (blocked_len) {
memcpy(STR0(result), STR0(iv), block_size);
if (blocked_len > block_size) {
memcpy(STR0(result) + block_size, STR0(data),
blocked_len - block_size);
}
func(ctx, blocked_len, STR0(result), STR0(result));
memxor(STR0(result), STR0(data), blocked_len);
memcpy(STR0(iv), STR0(data) + blocked_len - block_size,
block_size);
}
if (trailer_len) {
func(ctx, block_size, STR0(iv), STR0(iv));
memxor3(STR0(result) + blocked_len, STR0(data) + blocked_len,
STR0(iv), trailer_len);
memcpy(STR0(iv), STR0(data) + blocked_len, trailer_len);
}
THREADS_DISALLOW();
free_string(iv);
} else {
if (blocked_len) {
memcpy(STR0(result), STR0(iv), block_size);
if (blocked_len > block_size) {
memcpy(STR0(result) + block_size, STR0(data),
blocked_len - block_size);
}
func(ctx, blocked_len, STR0(result), STR0(result));
memxor(STR0(result), STR0(data), blocked_len);
memcpy(STR0(iv), STR0(data) + blocked_len - block_size,
block_size);
}
if (trailer_len) {
func(ctx, block_size, STR0(iv), STR0(iv));
memxor3(STR0(result) + blocked_len, STR0(data) + blocked_len,
STR0(iv), trailer_len);
memcpy(STR0(iv), STR0(data) + blocked_len, trailer_len);
}
}
}

pop_n_elems(args);
push_string(end_shared_string(result));
UNSET_ONERROR(uwp);
}
}

#ifdef Nettle_BlockCipher_cq__CFB_State_event_handler_defined
static void Nettle_BlockCipher_cq__CFB_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_exit_Nettle_BlockCipher_cq__CFB_State_defined
  case PROG_EVENT_EXIT: exit_Nettle_BlockCipher_cq__CFB_State_struct(); break;

#endif /* internal_exit_Nettle_BlockCipher_cq__CFB_State_defined */
  default: break; 
  }
}

#endif /* Nettle_BlockCipher_cq__CFB_State_event_handler_defined */
/*! @endclass
     */

/*! @decl State `()()
     *!
     *! @returns
     *!   Returns a new @[State] object.
     */
#define f_Nettle_BlockCipher_cq__CFB_cq__backtick_28_29_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_cq__backtick_28_29_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CFB_cq__backtick_28_29_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CFB_cq__backtick_28_29_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CFB_cq__backtick_28_29(INT32 args) {
#line 2053 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("`()",args,0);
{
apply_current(Nettle_BlockCipher_cq__CFB_State_program_fun_num, args);
}
}
/*! @endmodule CFB
   */

/*! @module CTR
   *! Implementation of Counter Mode (CTR).
   *!
   *! This cipher mode works like a stream cipher with
   *! a block size >= 1. This means that the same key
   *! and initialization vector (aka counter) should
   *! never be reused, since a simple xor would reveal
   *! information about the plain text. It also means
   *! that it should never be used without a suiteable
   *! Message Authentication Code (MAC).
   *!
   *! @seealso
   *!   @[CBC], @[GCM], @[Buffer]
   */

#undef var_CTR_Nettle_BlockCipher_defined
#define var_CTR_Nettle_BlockCipher_defined
#ifdef HAVE_NETTLE_CTR_H
#include <nettle/ctr.h>
#else
 /* Fallback implementation. */
void ctr_crypt(void *ctx, pike_nettle_crypt_func f,
pike_nettle_size_t block_size, uint8_t *ctr,
pike_nettle_size_t length, uint8_t *dst,
const uint8_t *src)
{
while (length >= block_size) {
int c = 1;
int i;
f(ctx, block_size, dst, ctr);
memxor(dst, src, block_size);
dst += block_size;
src += block_size;
length -= block_size;
for (i = block_size; i--;) {
ctr[i] += c;
c &= !ctr[i];
}
}
if (length) {
/* Truncated block. */
int c = 1;
int i;
f(ctx, block_size, dst, ctr);
memxor(dst, src, length);
for (i = block_size; i--;) {
ctr[i] += c;
c &= !ctr[i];
}
}
}
#endif


#undef class_Nettle_BlockCipher_cq__CTR_defined
#define class_Nettle_BlockCipher_cq__CTR_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher_cq__CTR_program=NULL;

#ifdef Nettle_BlockCipher_cq__CTR_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher_cq__CTR_program_fun_num=-1;
#endif /* Nettle_BlockCipher_cq__CTR_program_fun_num_used */
/*! @decl inherit __builtin.Nettle.Cipher
     */

#undef inherit_cq__22__builtin_2ENettle_2ECipher_22_Nettle_BlockCipher_cq__CTR_defined
#define inherit_cq__22__builtin_2ENettle_2ECipher_22_Nettle_BlockCipher_cq__CTR_defined
#line 2119 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher_cq__CTR_cq__22__builtin_2ENettle_2ECipher_22_inh_num = -1;
#line 2119 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher_cq__CTR_cq__22__builtin_2ENettle_2ECipher_22_inh_offset = -1;
/*! @decl string(0..255) name()
     *! Returns the base cipher name appended with the string @expr{".CTR"@}.
     */
#define f_Nettle_BlockCipher_cq__CTR_name_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CTR_name_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CTR_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CTR_name(INT32 args) {
#line 2124 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
#line 2126 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(1, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
f_Nettle_Cipher_name_fun_num, args);
push_text(".CTR");
f_add(2);
}

}
#define f_Nettle_BlockCipher_cq__CTR_block_size_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_block_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CTR_block_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CTR_block_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CTR_block_size(INT32 args) {
#line 2133 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("block_size",args,0);
{
apply_external(1, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
f_Nettle_Cipher_block_size_fun_num, args);
}

}
#define f_Nettle_BlockCipher_cq__CTR_key_size_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_key_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CTR_key_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CTR_key_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CTR_key_size(INT32 args) {
#line 2139 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("key_size",args,0);
{
apply_external(1, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
f_Nettle_Cipher_key_size_fun_num, args);
}

}
#define f_Nettle_BlockCipher_cq__CTR_iv_size_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_iv_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CTR_iv_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CTR_iv_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CTR_iv_size(INT32 args) {
#line 2145 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("iv_size",args,0);
{
apply_external(1, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
f_Nettle_Cipher_block_size_fun_num, args);
}

}
/*! @class State
     *!
     *! The state for a CTR instance.
     */

#undef class_Nettle_BlockCipher_cq__CTR_State_defined
#define class_Nettle_BlockCipher_cq__CTR_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher_cq__CTR_State_program=NULL;

#ifdef Nettle_BlockCipher_cq__CTR_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher_cq__CTR_State_program_fun_num=-1;
#endif /* Nettle_BlockCipher_cq__CTR_State_program_fun_num_used */
/*! @decl inherit Cipher::State
*/


#undef extra_Nettle_BlockCipher_cq__CTR_State_defined
#define extra_Nettle_BlockCipher_cq__CTR_State_defined

#undef var_object_Nettle_BlockCipher_cq__CTR_State_defined
#define var_object_Nettle_BlockCipher_cq__CTR_State_defined

#undef var_crypt_state_Nettle_BlockCipher_cq__CTR_State_defined
#define var_crypt_state_Nettle_BlockCipher_cq__CTR_State_defined

#undef var_iv_Nettle_BlockCipher_cq__CTR_State_defined
#define var_iv_Nettle_BlockCipher_cq__CTR_State_defined
#line 2189 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
/* NB: Not finished. */

#undef var_block_size_Nettle_BlockCipher_cq__CTR_State_defined
#define var_block_size_Nettle_BlockCipher_cq__CTR_State_defined

#undef THIS
#define THIS ((struct Nettle_BlockCipher_cq__CTR_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_BLOCKCIPHER_CQ__CTR_STATE
#define THIS_NETTLE_BLOCKCIPHER_CQ__CTR_STATE ((struct Nettle_BlockCipher_cq__CTR_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_BLOCKCIPHER_CQ__CTR_STATE
#define OBJ2_NETTLE_BLOCKCIPHER_CQ__CTR_STATE(o) ((struct Nettle_BlockCipher_cq__CTR_State_struct *)(o->storage+Nettle_BlockCipher_cq__CTR_State_storage_offset))

#undef GET_NETTLE_BLOCKCIPHER_CQ__CTR_STATE_STORAGE
#define GET_NETTLE_BLOCKCIPHER_CQ__CTR_STATE_STORAGE(o) ((struct Nettle_BlockCipher_cq__CTR_State_struct *)(o->storage+Nettle_BlockCipher_cq__CTR_State_storage_offset)
static ptrdiff_t Nettle_BlockCipher_cq__CTR_State_storage_offset;
struct Nettle_BlockCipher_cq__CTR_State_struct {

#ifdef var_object_Nettle_BlockCipher_cq__CTR_State_defined
  struct object * object;

#endif /* var_object_Nettle_BlockCipher_cq__CTR_State_defined */

#ifdef var_crypt_state_Nettle_BlockCipher_cq__CTR_State_defined
#line 2188 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct Nettle_Cipher_State_struct *crypt_state;
#endif /* var_crypt_state_Nettle_BlockCipher_cq__CTR_State_defined */

#ifdef var_iv_Nettle_BlockCipher_cq__CTR_State_defined
#line 2189 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string *iv;
#endif /* var_iv_Nettle_BlockCipher_cq__CTR_State_defined */

#ifdef var_block_size_Nettle_BlockCipher_cq__CTR_State_defined
#line 2190 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
INT32 block_size;
#endif /* var_block_size_Nettle_BlockCipher_cq__CTR_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_BlockCipher_cq__CTR_State_struct *Nettle_BlockCipher_cq__CTR_State_gdb_dummy_ptr;
#endif

#undef internal_exit_Nettle_BlockCipher_cq__CTR_State_defined
#define internal_exit_Nettle_BlockCipher_cq__CTR_State_defined

#undef Nettle_BlockCipher_cq__CTR_State_event_handler_defined
#define Nettle_BlockCipher_cq__CTR_State_event_handler_defined
static void exit_Nettle_BlockCipher_cq__CTR_State_struct(void)
#line 2194 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
if (THIS->object) {
free_object(THIS->object);
THIS->object = NULL;
}
if (THIS->iv) {
free_string(THIS->iv);
THIS->iv = NULL;
}
}

/*! @decl object `obj()
       *!
       *! Getter for the wrapped cipher algorithm.
       */
#define f_Nettle_BlockCipher_cq__CTR_State_cq__backtickobj_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_cq__backtickobj_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CTR_State_cq__backtickobj_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CTR_State_cq__backtickobj_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CTR_State_cq__backtickobj(INT32 args) {
#line 2209 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("`obj",args,0);
{
if (THIS->object) {
ref_push_object(THIS->object);
} else {
push_int(0);
}
}

}
/*! @decl Cipher::State substate_factory()
       *!
       *! Returns the @[Cipher::State] object that this object
       *! is to operate on.
       *!
       *! Defaults to creating the State for the cipher implemented
       *! in the parent module.
       */
#define f_Nettle_BlockCipher_cq__CTR_State_substate_factory_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_substate_factory_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CTR_State_substate_factory_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CTR_State_substate_factory_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CTR_State_substate_factory(INT32 args) {
#line 2226 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("substate_factory",args,0);
#line 2228 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(2, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
Nettle_Cipher_State_program_fun_num, 0);
}

}
/*! @decl void create()
       *!
       *! Initialize the CTR state with the @[Cipher::State] object
       *! returned by @[substate_factory()]. This is usually
       *! the State for the cipher implemented in the parent module.
       */
#define f_Nettle_BlockCipher_cq__CTR_State_create_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_create_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CTR_State_create_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CTR_State_create_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CTR_State_create(INT32 args) {
#line 2239 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("create",args,0);
#line 2241 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct object *o;
struct inherit *inh;
int old_block_size = THIS->block_size;
int block_size;
int f;

if (THIS->object) free_object(THIS->object);
THIS->object = NULL;
THIS->crypt_state = NULL;

apply_current(f_Nettle_BlockCipher_cq__CTR_State_substate_factory_fun_num,
0);

if (TYPEOF(Pike_sp[-1]) != T_OBJECT) {
Pike_error("Unsupported return value from Cipher::State().\n");
}
o = Pike_sp[-1].u.object;
if (!o->prog) {
Pike_error("Cipher::State() returned destructed object.\n");
}

f = find_identifier("crypt", o->prog);
if (f < 0) {
Pike_error("State object has no crypt() function.\n");
}

apply(o, "block_size", 0);

if(TYPEOF(Pike_sp[-1]) != T_INT)
Pike_error("block_size() didn't return an int.\n");

block_size = Pike_sp[-1].u.integer;

if ((!block_size) || (block_size > 4096))
Pike_error("Bad block size %d.\n", block_size);

inh = INHERIT_FROM_INT(o->prog, f);
if (inh->prog == Nettle_Cipher_State_program) {
/* crypt() is from Nettle.Cipher.State.
	   * Check if the context and crypt function are valid.
	   */
THIS->crypt_state = (struct Nettle_Cipher_State_struct *)
get_inherit_storage(o, inh - o->prog->inherits);
}

if(THIS->iv) {
free_string(THIS->iv);
THIS->iv = NULL;
}

THIS->iv = begin_shared_string(block_size);
memset(STR0(THIS->iv), 0, block_size);
THIS->iv->flags |= STRING_CLEAR_ON_EXIT;

THIS->block_size = block_size;

add_ref(THIS->object = o);

pop_n_elems(2);
}

}
/*! @decl string(0..255) name()
       *! Returns the string @expr{"CTR(x)"@} where x is the
       *! encapsulated algorithm.
       */
#define f_Nettle_BlockCipher_cq__CTR_State_name_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CTR_State_name_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CTR_State_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CTR_State_name(INT32 args) {
#line 2307 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
#line 2309 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
push_text("CTR(");
apply(THIS->object, "name", 0);
push_text(")");
f_add(3);
}

}
/*! @decl int(1..) block_size()
       *! Returns the block size of the encapsulated cipher.
       */
#define f_Nettle_BlockCipher_cq__CTR_State_block_size_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_block_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CTR_State_block_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CTR_State_block_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CTR_State_block_size(INT32 args) {
#line 2319 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("block_size",args,0);
#line 2321 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
do { INT_TYPE ret_=(THIS->block_size);  push_int(ret_); return; }while(0);
#line 2323 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl int(1..) iv_size()
       *! Returns the size for the initialization vector
       */
#define f_Nettle_BlockCipher_cq__CTR_State_iv_size_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_iv_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CTR_State_iv_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CTR_State_iv_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CTR_State_iv_size(INT32 args) {
#line 2328 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("iv_size",args,0);
#line 2330 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
do { INT_TYPE ret_=(THIS->block_size);  push_int(ret_); return; }while(0);
#line 2332 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl int(1..) key_size()
       *! Returns the key size of the encapsulated cipher.
       */
#define f_Nettle_BlockCipher_cq__CTR_State_key_size_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_key_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CTR_State_key_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CTR_State_key_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CTR_State_key_size(INT32 args) {
#line 2337 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("key_size",args,0);
#line 2339 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply(THIS->object, "key_size", args);
}

}
/*! @decl this_program set_encrypt_key(string(0..255) key, int|void flags)
       *!
       *! Prepare the cipher and the wrapper for encrypting with the given
       *! @[key]. The @[key] memory will be cleared before released.
       *!
       *! @note
       *!   Note that this operation does not by itself reset the
       *!   context sufficiently to start a new message; @[set_iv()]
       *!   needs to be called too.
       *!
       *! @seealso
       *!   @[set_decrypt_key()], @[set_iv()]
       */
#define f_Nettle_BlockCipher_cq__CTR_State_set_encrypt_key_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_set_encrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CTR_State_set_encrypt_key_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CTR_State_set_encrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CTR_State_set_encrypt_key(INT32 args) {
#line 2356 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 2356 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * flags;
#line 2356 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_encrypt_key",args,1);
#line 2356 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_encrypt_key",args,2);
#line 2356 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",1,"string(0..255)");
#line 2356 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
#line 2356 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 2356 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",2,"int|void");
#line 2356 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
flags=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 2356 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else flags = NULL;
#line 2358 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;
key->flags |= STRING_CLEAR_ON_EXIT;
apply(THIS->object, "set_encrypt_key", args);
pop_stack();

push_object(this_object());
}

}
/*! @decl this_program set_decrypt_key(string(0..255) key, int|void flags)
       *!
       *! Prepare the cipher and the wrapper for decrypting with the given
       *! @[key]. The @[key] memory will be cleared before released.
       *!
       *! @note
       *!   Note that this operation does not by itself reset the
       *!   context sufficiently to start a new message; @[set_iv()]
       *!   needs to be called too.
       *!
       *! @seealso
       *!   @[set_encrypt_key()], @[set_iv()]
       */
#define f_Nettle_BlockCipher_cq__CTR_State_set_decrypt_key_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_set_decrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CTR_State_set_decrypt_key_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CTR_State_set_decrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CTR_State_set_decrypt_key(INT32 args) {
#line 2381 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 2381 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * flags;
#line 2381 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_decrypt_key",args,1);
#line 2381 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_decrypt_key",args,2);
#line 2381 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",1,"string(0..255)");
#line 2381 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
#line 2381 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 2381 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",2,"int|void");
#line 2381 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
flags=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 2381 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else flags = NULL;
#line 2383 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;
key->flags |= STRING_CLEAR_ON_EXIT;
/* NOTE: CTR always uses the encryption function
	 *       of the underlying cipher!
	 */
apply(THIS->object, "set_encrypt_key", args);
pop_stack();

push_object(this_object());
}

}
/*! @decl this_program set_iv(string(0..255) iv)
       *!
       *! Set the initialization vector to @[iv]. The @[iv] memory will be
       *! cleared before released.
       *!
       *! @note
       *!   @[iv] must have the length reported by @[iv_size()].
       *!
       *! @seealso
       *!   @[set_encrypt_key()], @[set_decrypt_key()].
       */
#define f_Nettle_BlockCipher_cq__CTR_State_set_iv_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_set_iv_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CTR_State_set_iv_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CTR_State_set_iv_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CTR_State_set_iv(INT32 args) {
#line 2407 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * iv;
#line 2407 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("set_iv",args,1);
#line 2407 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_iv",1,"string(0..255)");
#line 2407 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(iv=Pike_sp[0-1].u.string);
#line 2409 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
iv->flags |= STRING_CLEAR_ON_EXIT;
NO_WIDE_STRING(iv);
if(iv->len != THIS->block_size)
Pike_error("Argument incompatible with cipher block size.\n");
memcpy(STR0(THIS->iv), STR0(iv), THIS->block_size);
do { struct object * ret_=(this_object()); pop_stack(); push_object(ret_); return; }while(0);
#line 2416 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl string(0..255) crypt(string(0..255) data)
       *!
       *! Encrypt/decrypt @[data] and return the result. @[data] must
       *! be an integral number of blocks.
       *!
       *! The length of @[data] MUST be a multiple of the block size
       *! for all calls except the last.
       *!
       *! Neither the input or output data is not automatically memory
       *! scrubbed, unless @[String.secure] has been called on the data.
       *!
       *! @seealso
       *!   @[update()], @[digest()]
       */
#define f_Nettle_BlockCipher_cq__CTR_State_crypt_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_crypt_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CTR_State_crypt_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CTR_State_crypt_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CTR_State_crypt(INT32 args) {
#line 2432 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * data;
#line 2432 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("crypt",args,1);
#line 2432 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("crypt",1,"string(0..255)");
#line 2432 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(data=Pike_sp[0-1].u.string);
{
struct pike_string *result;
ONERROR uwp;
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;
struct pike_string *iv = THIS->iv;
int block_size = THIS->block_size;

NO_WIDE_STRING(data);

if (!THIS->object || !THIS->object->prog) {
Pike_error("Lookup in destructed object.\n");
}

result = begin_shared_string(data->len);
SET_ONERROR (uwp, do_free_string, result);

if (THIS->crypt_state && THIS->crypt_state->crypt) {
func = THIS->crypt_state->crypt;
ctx = THIS->crypt_state->ctx;
}

if ((data->len >= CIPHER_THREADS_ALLOW_THRESHOLD) &&
(func != pike_crypt_func)) {
/* Protect the iv from being freed by a different thread. */
add_ref(iv);
THREADS_ALLOW();
ctr_crypt(ctx, func, block_size, STR0(iv),
data->len, STR0(result), STR0(data));
THREADS_DISALLOW();
free_string(iv);
} else {
ctr_crypt(ctx, func, block_size, STR0(iv),
data->len, STR0(result), STR0(data));
}

pop_n_elems(args);
push_string(end_shared_string(result));
UNSET_ONERROR(uwp);
}

}

#ifdef Nettle_BlockCipher_cq__CTR_State_event_handler_defined
static void Nettle_BlockCipher_cq__CTR_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_exit_Nettle_BlockCipher_cq__CTR_State_defined
  case PROG_EVENT_EXIT: exit_Nettle_BlockCipher_cq__CTR_State_struct(); break;

#endif /* internal_exit_Nettle_BlockCipher_cq__CTR_State_defined */
  default: break; 
  }
}

#endif /* Nettle_BlockCipher_cq__CTR_State_event_handler_defined */
/*! @endclass
     */

/*! @decl State `()()
     *!
     *! @returns
     *!   Returns a new @[State] object.
     */
#define f_Nettle_BlockCipher_cq__CTR_cq__backtick_28_29_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_cq__backtick_28_29_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__CTR_cq__backtick_28_29_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__CTR_cq__backtick_28_29_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__CTR_cq__backtick_28_29(INT32 args) {
#line 2483 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("`()",args,0);
{
apply_current(Nettle_BlockCipher_cq__CTR_State_program_fun_num, args);
}

}
/*! @endmodule CTR
   */

/*! @module OFB
   *! Implementation of Output Feed-Back mode (OFB).
   *!
   *! This cipher mode works like a stream cipher with
   *! a block size >= 1. This means that the same key
   *! and initialization vector (aka counter) should
   *! never be reused, since a simple xor would reveal
   *! information about the plain text. It also means
   *! that it should never be used without a suiteable
   *! Message Authentication Code (MAC).
   *!
   *! @seealso
   *!   @[CFB], @[CBC], @[CTR], @[GCM]
   */

#undef var_OFB_Nettle_BlockCipher_defined
#define var_OFB_Nettle_BlockCipher_defined

#undef class_Nettle_BlockCipher_cq__OFB_defined
#define class_Nettle_BlockCipher_cq__OFB_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher_cq__OFB_program=NULL;

#ifdef Nettle_BlockCipher_cq__OFB_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher_cq__OFB_program_fun_num=-1;
#endif /* Nettle_BlockCipher_cq__OFB_program_fun_num_used */
/*! @decl inherit BufferedCipher
     */

#undef inherit_Nettle_BufferedCipher_Nettle_BlockCipher_cq__OFB_defined
#define inherit_Nettle_BufferedCipher_Nettle_BlockCipher_cq__OFB_defined
#line 2514 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher_cq__OFB_Nettle_BufferedCipher_inh_num = -1;
#line 2514 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher_cq__OFB_Nettle_BufferedCipher_inh_offset = -1;
/*! @decl string(0..255) name()
     *! Returns the base cipher name appended with the string @expr{".OFB"@}.
     */
#define f_Nettle_BlockCipher_cq__OFB_name_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__OFB_name_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__OFB_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__OFB_name(INT32 args) {
#line 2519 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
#line 2521 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(1, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
f_Nettle_Cipher_name_fun_num, args);
push_text(".OFB");
f_add(2);
}

}
#define f_Nettle_BlockCipher_cq__OFB_block_size_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_block_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__OFB_block_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__OFB_block_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__OFB_block_size(INT32 args) {
#line 2528 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("block_size",args,0);
{
apply_external(1, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
f_Nettle_Cipher_block_size_fun_num, args);
}

}
#define f_Nettle_BlockCipher_cq__OFB_key_size_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_key_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__OFB_key_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__OFB_key_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__OFB_key_size(INT32 args) {
#line 2534 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("key_size",args,0);
{
apply_external(1, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
f_Nettle_Cipher_key_size_fun_num, args);
}

}
#define f_Nettle_BlockCipher_cq__OFB_iv_size_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_iv_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__OFB_iv_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__OFB_iv_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__OFB_iv_size(INT32 args) {
#line 2540 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("iv_size",args,0);
{
apply_external(1, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
f_Nettle_Cipher_block_size_fun_num, args);
}

}
/*! @class State
     *!
     *! The state for a OFB instance.
     */

#undef class_Nettle_BlockCipher_cq__OFB_State_defined
#define class_Nettle_BlockCipher_cq__OFB_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher_cq__OFB_State_program=NULL;

#ifdef Nettle_BlockCipher_cq__OFB_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher_cq__OFB_State_program_fun_num=-1;
#endif /* Nettle_BlockCipher_cq__OFB_State_program_fun_num_used */
/*! @decl inherit BufferedCipher::State
*/


#undef extra_Nettle_BlockCipher_cq__OFB_State_defined
#define extra_Nettle_BlockCipher_cq__OFB_State_defined

#undef var_object_Nettle_BlockCipher_cq__OFB_State_defined
#define var_object_Nettle_BlockCipher_cq__OFB_State_defined

#undef var_crypt_state_Nettle_BlockCipher_cq__OFB_State_defined
#define var_crypt_state_Nettle_BlockCipher_cq__OFB_State_defined

#undef var_iv_Nettle_BlockCipher_cq__OFB_State_defined
#define var_iv_Nettle_BlockCipher_cq__OFB_State_defined
#line 2584 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
/* NB: Not finished. */

#undef var_block_size_Nettle_BlockCipher_cq__OFB_State_defined
#define var_block_size_Nettle_BlockCipher_cq__OFB_State_defined

#undef THIS
#define THIS ((struct Nettle_BlockCipher_cq__OFB_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_BLOCKCIPHER_CQ__OFB_STATE
#define THIS_NETTLE_BLOCKCIPHER_CQ__OFB_STATE ((struct Nettle_BlockCipher_cq__OFB_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_BLOCKCIPHER_CQ__OFB_STATE
#define OBJ2_NETTLE_BLOCKCIPHER_CQ__OFB_STATE(o) ((struct Nettle_BlockCipher_cq__OFB_State_struct *)(o->storage+Nettle_BlockCipher_cq__OFB_State_storage_offset))

#undef GET_NETTLE_BLOCKCIPHER_CQ__OFB_STATE_STORAGE
#define GET_NETTLE_BLOCKCIPHER_CQ__OFB_STATE_STORAGE(o) ((struct Nettle_BlockCipher_cq__OFB_State_struct *)(o->storage+Nettle_BlockCipher_cq__OFB_State_storage_offset)
static ptrdiff_t Nettle_BlockCipher_cq__OFB_State_storage_offset;
struct Nettle_BlockCipher_cq__OFB_State_struct {

#ifdef var_object_Nettle_BlockCipher_cq__OFB_State_defined
  struct object * object;

#endif /* var_object_Nettle_BlockCipher_cq__OFB_State_defined */

#ifdef var_crypt_state_Nettle_BlockCipher_cq__OFB_State_defined
#line 2583 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct Nettle_Cipher_State_struct *crypt_state;
#endif /* var_crypt_state_Nettle_BlockCipher_cq__OFB_State_defined */

#ifdef var_iv_Nettle_BlockCipher_cq__OFB_State_defined
#line 2584 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string *iv;
#endif /* var_iv_Nettle_BlockCipher_cq__OFB_State_defined */

#ifdef var_block_size_Nettle_BlockCipher_cq__OFB_State_defined
#line 2585 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
INT32 block_size;
#endif /* var_block_size_Nettle_BlockCipher_cq__OFB_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_BlockCipher_cq__OFB_State_struct *Nettle_BlockCipher_cq__OFB_State_gdb_dummy_ptr;
#endif

#undef internal_exit_Nettle_BlockCipher_cq__OFB_State_defined
#define internal_exit_Nettle_BlockCipher_cq__OFB_State_defined

#undef Nettle_BlockCipher_cq__OFB_State_event_handler_defined
#define Nettle_BlockCipher_cq__OFB_State_event_handler_defined
static void exit_Nettle_BlockCipher_cq__OFB_State_struct(void)
#line 2589 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
if (THIS->object) {
free_object(THIS->object);
THIS->object = NULL;
}
if (THIS->iv) {
free_string(THIS->iv);
THIS->iv = NULL;
}
}

/*! @decl object `obj()
       *!
       *! Getter for the wrapped cipher algorithm.
       */
#define f_Nettle_BlockCipher_cq__OFB_State_cq__backtickobj_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_cq__backtickobj_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__OFB_State_cq__backtickobj_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__OFB_State_cq__backtickobj_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__OFB_State_cq__backtickobj(INT32 args) {
#line 2604 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("`obj",args,0);
{
if (THIS->object) {
ref_push_object(THIS->object);
} else {
push_int(0);
}
}

}
/*! @decl Cipher::State substate_factory()
       *!
       *! Returns the @[Cipher::State] object that this object
       *! is to operate on.
       *!
       *! Defaults to creating the State for the cipher implemented
       *! in the parent module.
       */
#define f_Nettle_BlockCipher_cq__OFB_State_substate_factory_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_substate_factory_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__OFB_State_substate_factory_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__OFB_State_substate_factory_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__OFB_State_substate_factory(INT32 args) {
#line 2621 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("substate_factory",args,0);
#line 2623 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(2, Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset +
Nettle_Cipher_State_program_fun_num, 0);
}

}
/*! @decl void create()
       *!
       *! Initialize the OFB state with the @[Cipher::State] object
       *! returned by @[substate_factory()]. This is usually
       *! the State for the cipher implemented in the parent module.
       */
#define f_Nettle_BlockCipher_cq__OFB_State_create_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_create_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__OFB_State_create_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__OFB_State_create_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__OFB_State_create(INT32 args) {
#line 2634 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("create",args,0);
#line 2636 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct object *o;
struct inherit *inh;
int old_block_size = THIS->block_size;
int block_size;
int f;

if (THIS->object) free_object(THIS->object);
THIS->object = NULL;
THIS->crypt_state = NULL;

apply_current(f_Nettle_BlockCipher_cq__OFB_State_substate_factory_fun_num,
0);

if (TYPEOF(Pike_sp[-1]) != T_OBJECT) {
Pike_error("Unsupported return value from Cipher::State().\n");
}
o = Pike_sp[-1].u.object;
if (!o->prog) {
Pike_error("Cipher::State() returned destructed object.\n");
}

f = find_identifier("crypt", o->prog);
if (f < 0) {
Pike_error("State object has no crypt() function.\n");
}

apply(o, "block_size", 0);

if(TYPEOF(Pike_sp[-1]) != T_INT)
Pike_error("block_size() didn't return an int.\n");

block_size = Pike_sp[-1].u.integer;

if ((!block_size) || (block_size > 4096))
Pike_error("Bad block size %d.\n", block_size);

inh = INHERIT_FROM_INT(o->prog, f);
if (inh->prog == Nettle_Cipher_State_program) {
/* crypt() is from Nettle.Cipher.State.
	   * Check if the context and crypt function are valid.
	   */
THIS->crypt_state = (struct Nettle_Cipher_State_struct *)
get_inherit_storage(o, inh - o->prog->inherits);
}

if(THIS->iv) {
free_string(THIS->iv);
THIS->iv = NULL;
}

THIS->iv = begin_shared_string(block_size);
memset(STR0(THIS->iv), 0, block_size);
THIS->iv->flags |= STRING_CLEAR_ON_EXIT;

THIS->block_size = block_size;

add_ref(THIS->object = o);

pop_n_elems(2);
}

}
/*! @decl string(0..255) name()
       *! Returns the string @expr{"OFB(x)"@} where x is the
       *! encapsulated algorithm.
       */
#define f_Nettle_BlockCipher_cq__OFB_State_name_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__OFB_State_name_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__OFB_State_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__OFB_State_name(INT32 args) {
#line 2702 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
#line 2704 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
push_text("OFB(");
apply(THIS->object, "name", 0);
push_text(")");
f_add(3);
}

}
/*! @decl int(1..) block_size()
       *! Returns the block size of the encapsulated cipher.
       */
#define f_Nettle_BlockCipher_cq__OFB_State_block_size_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_block_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__OFB_State_block_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__OFB_State_block_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__OFB_State_block_size(INT32 args) {
#line 2714 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("block_size",args,0);
#line 2716 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
do { INT_TYPE ret_=(THIS->block_size);  push_int(ret_); return; }while(0);
#line 2718 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl int(1..) iv_size()
       *! Returns the size for the initialization vector
       */
#define f_Nettle_BlockCipher_cq__OFB_State_iv_size_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_iv_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__OFB_State_iv_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__OFB_State_iv_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__OFB_State_iv_size(INT32 args) {
#line 2723 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("iv_size",args,0);
#line 2725 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
do { INT_TYPE ret_=(THIS->block_size);  push_int(ret_); return; }while(0);
#line 2727 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl int(1..) key_size()
       *! Returns the key size of the encapsulated cipher.
       */
#define f_Nettle_BlockCipher_cq__OFB_State_key_size_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_key_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__OFB_State_key_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__OFB_State_key_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__OFB_State_key_size(INT32 args) {
#line 2732 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("key_size",args,0);
#line 2734 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply(THIS->object, "key_size", args);
}

}
/*! @decl this_program set_encrypt_key(string(0..255) key, int|void flags)
       *!
       *! Prepare the cipher and the wrapper for encrypting with the given
       *! @[key]. The @[key] memory will be cleared before released.
       *!
       *! @note
       *!   Note that this operation does not by itself reset the
       *!   context sufficiently to start a new message; @[set_iv()]
       *!   needs to be called too.
       *!
       *! @seealso
       *!   @[set_decrypt_key()], @[set_iv()]
       */
#define f_Nettle_BlockCipher_cq__OFB_State_set_encrypt_key_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_set_encrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__OFB_State_set_encrypt_key_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__OFB_State_set_encrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__OFB_State_set_encrypt_key(INT32 args) {
#line 2751 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 2751 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * flags;
#line 2751 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_encrypt_key",args,1);
#line 2751 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_encrypt_key",args,2);
#line 2751 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",1,"string(0..255)");
#line 2751 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
#line 2751 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 2751 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",2,"int|void");
#line 2751 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
flags=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 2751 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else flags = NULL;
#line 2753 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;
key->flags |= STRING_CLEAR_ON_EXIT;
apply(THIS->object, "set_encrypt_key", args);
pop_stack();
push_object(this_object());
}

}
/*! @decl this_program set_decrypt_key(string(0..255) key, int|void flags)
       *!
       *! Prepare the cipher and the wrapper for decrypting with the given
       *! @[key]. The @[key] memory will be cleared before released.
       *!
       *! @note
       *!   Note that this operation does not by itself reset the
       *!   context sufficiently to start a new message; @[set_iv()]
       *!   needs to be called too.
       *!
       *! @seealso
       *!   @[set_encrypt_key()], @[set_iv()]
       */
#define f_Nettle_BlockCipher_cq__OFB_State_set_decrypt_key_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_set_decrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__OFB_State_set_decrypt_key_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__OFB_State_set_decrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__OFB_State_set_decrypt_key(INT32 args) {
#line 2775 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 2775 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * flags;
#line 2775 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_decrypt_key",args,1);
#line 2775 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_decrypt_key",args,2);
#line 2775 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",1,"string(0..255)");
#line 2775 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
#line 2775 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 2775 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",2,"int|void");
#line 2775 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
flags=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 2775 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else flags = NULL;
#line 2777 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;
key->flags |= STRING_CLEAR_ON_EXIT;
/* NOTE: OFB always uses the encryption function
	 *       of the underlying cipher!
	 */
apply(THIS->object, "set_encrypt_key", args);
pop_stack();
push_object(this_object());
}

}
/*! @decl this_program set_iv(string(0..255) iv)
       *!
       *! Set the initialization vector to @[iv]. The @[iv] memory will be
       *! cleared before released.
       *!
       *! @note
       *!   @[iv] must have the length reported by @[iv_size()].
       *!
       *! @seealso
       *!   @[set_encrypt_key()], @[set_decrypt_key()].
       */
#define f_Nettle_BlockCipher_cq__OFB_State_set_iv_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_set_iv_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__OFB_State_set_iv_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__OFB_State_set_iv_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__OFB_State_set_iv(INT32 args) {
#line 2800 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * iv;
#line 2800 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("set_iv",args,1);
#line 2800 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_iv",1,"string(0..255)");
#line 2800 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(iv=Pike_sp[0-1].u.string);
#line 2802 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
iv->flags |= STRING_CLEAR_ON_EXIT;
NO_WIDE_STRING(iv);
if(iv->len != THIS->block_size)
Pike_error("Argument incompatible with cipher block size.\n");
memcpy(STR0(THIS->iv), STR0(iv), THIS->block_size);
do { struct object * ret_=(this_object()); pop_stack(); push_object(ret_); return; }while(0);
#line 2809 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl string(0..255) crypt(string(0..255) data)
       *!
       *! Encrypt/decrypt @[data] and return the result. @[data] must
       *! be an integral number of blocks.
       *!
       *! The length of @[data] MUST be a multiple of the block size
       *! for all calls except the last.
       *!
       *! Neither the input or output data is not automatically memory
       *! scrubbed, unless @[String.secure] has been called on the data.
       *!
       *! @seealso
       *!   @[update()], @[digest()]
       */
#define f_Nettle_BlockCipher_cq__OFB_State_crypt_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_crypt_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__OFB_State_crypt_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__OFB_State_crypt_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__OFB_State_crypt(INT32 args) {
#line 2825 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * data;
#line 2825 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("crypt",args,1);
#line 2825 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("crypt",1,"string(0..255)");
#line 2825 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(data=Pike_sp[0-1].u.string);
{
struct pike_string *result;
ONERROR uwp;
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;
struct pike_string *iv = THIS->iv;
unsigned block_size = (unsigned)THIS->block_size;
uint8_t *src;
uint8_t *dst;
pike_nettle_size_t bytes;

NO_WIDE_STRING(data);

if (!THIS->object || !THIS->object->prog) {
Pike_error("Lookup in destructed object.\n");
}

if (!(bytes = data->len)) return;

result = begin_shared_string(data->len);
SET_ONERROR (uwp, do_free_string, result);

if (THIS->crypt_state && THIS->crypt_state->crypt) {
func = THIS->crypt_state->crypt;
ctx = THIS->crypt_state->ctx;
}

src = STR0(data);
dst = STR0(result);

if ((bytes >= CIPHER_THREADS_ALLOW_THRESHOLD) &&
(func != pike_crypt_func)) {
/* Protect the iv from being freed by a different thread. */
add_ref(iv);
THREADS_ALLOW();
while (bytes >= block_size) {
func(ctx, block_size, STR0(iv), STR0(iv));
memxor3(dst, STR0(iv), src, block_size);
dst += block_size;
src += block_size;
bytes -= block_size;
}
if (bytes) {
func(ctx, block_size, STR0(iv), STR0(iv));
memxor3(dst, STR0(iv), src, bytes);
}
THREADS_DISALLOW();
free_string(iv);
} else {
while (bytes >= block_size) {
func(ctx, block_size, STR0(iv), STR0(iv));
memxor3(dst, STR0(iv), src, block_size);
dst += block_size;
src += block_size;
bytes -= block_size;
}
if (bytes) {
func(ctx, block_size, STR0(iv), STR0(iv));
memxor3(dst, STR0(iv), src, bytes);
}
}

pop_n_elems(args);
push_string(end_shared_string(result));
UNSET_ONERROR(uwp);
}
}

#ifdef Nettle_BlockCipher_cq__OFB_State_event_handler_defined
static void Nettle_BlockCipher_cq__OFB_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_exit_Nettle_BlockCipher_cq__OFB_State_defined
  case PROG_EVENT_EXIT: exit_Nettle_BlockCipher_cq__OFB_State_struct(); break;

#endif /* internal_exit_Nettle_BlockCipher_cq__OFB_State_defined */
  default: break; 
  }
}

#endif /* Nettle_BlockCipher_cq__OFB_State_event_handler_defined */
/*! @endclass
     */

/*! @decl State `()()
     *!
     *! @returns
     *!   Returns a new @[State] object.
     */
#define f_Nettle_BlockCipher_cq__OFB_cq__backtick_28_29_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_cq__backtick_28_29_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher_cq__OFB_cq__backtick_28_29_fun_num = 0;

#endif /* f_Nettle_BlockCipher_cq__OFB_cq__backtick_28_29_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher_cq__OFB_cq__backtick_28_29(INT32 args) {
#line 2901 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("`()",args,0);
{
apply_current(Nettle_BlockCipher_cq__OFB_State_program_fun_num, args);
}
}
/*! @endmodule OFB
   */

#line 2910 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
/* NB: Declare the storage explicitly to avoid having it declared
   *     inside the #ifdef above.
   */

#undef THIS
#define THIS ((struct Nettle_BlockCipher_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_BLOCKCIPHER
#define THIS_NETTLE_BLOCKCIPHER ((struct Nettle_BlockCipher_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_BLOCKCIPHER
#define OBJ2_NETTLE_BLOCKCIPHER(o) ((struct Nettle_BlockCipher_struct *)(o->storage+Nettle_BlockCipher_storage_offset))

#undef GET_NETTLE_BLOCKCIPHER_STORAGE
#define GET_NETTLE_BLOCKCIPHER_STORAGE(o) ((struct Nettle_BlockCipher_struct *)(o->storage+Nettle_BlockCipher_storage_offset)
static ptrdiff_t Nettle_BlockCipher_storage_offset;
struct Nettle_BlockCipher_struct {

#ifdef var_CBC_Nettle_BlockCipher_defined
  struct object * CBC;

#endif /* var_CBC_Nettle_BlockCipher_defined */

#ifdef var_PCBC_Nettle_BlockCipher_defined
  struct object * PCBC;

#endif /* var_PCBC_Nettle_BlockCipher_defined */

#ifdef var_CFB_Nettle_BlockCipher_defined
  struct object * CFB;

#endif /* var_CFB_Nettle_BlockCipher_defined */

#ifdef var_CTR_Nettle_BlockCipher_defined
  struct object * CTR;

#endif /* var_CTR_Nettle_BlockCipher_defined */

#ifdef var_OFB_Nettle_BlockCipher_defined
  struct object * OFB;

#endif /* var_OFB_Nettle_BlockCipher_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_BlockCipher_struct *Nettle_BlockCipher_gdb_dummy_ptr;
#endif
#line 2913 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
;


#undef internal_init_Nettle_BlockCipher_defined
#define internal_init_Nettle_BlockCipher_defined

#undef Nettle_BlockCipher_event_handler_defined
#define Nettle_BlockCipher_event_handler_defined
static void init_Nettle_BlockCipher_struct(void)
#line 2916 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_current(Nettle_BlockCipher_cq__CBC_program_fun_num, 0);
if (TYPEOF(Pike_sp[-1]) == T_OBJECT) {
add_ref(THIS_NETTLE_BLOCKCIPHER->CBC = Pike_sp[-1].u.object);
}
pop_stack();
apply_current(Nettle_BlockCipher_cq__PCBC_program_fun_num, 0);
if (TYPEOF(Pike_sp[-1]) == T_OBJECT) {
add_ref(THIS_NETTLE_BLOCKCIPHER->PCBC = Pike_sp[-1].u.object);
}
pop_stack();
apply_current(Nettle_BlockCipher_cq__CFB_program_fun_num, 0);
if (TYPEOF(Pike_sp[-1]) == T_OBJECT) {
add_ref(THIS_NETTLE_BLOCKCIPHER->CFB = Pike_sp[-1].u.object);
}
pop_stack();
apply_current(Nettle_BlockCipher_cq__CTR_program_fun_num, 0);
if (TYPEOF(Pike_sp[-1]) == T_OBJECT) {
add_ref(THIS_NETTLE_BLOCKCIPHER->CTR = Pike_sp[-1].u.object);
}
pop_stack();
apply_current(Nettle_BlockCipher_cq__OFB_program_fun_num, 0);
if (TYPEOF(Pike_sp[-1]) == T_OBJECT) {
add_ref(THIS_NETTLE_BLOCKCIPHER->OFB = Pike_sp[-1].u.object);
}
pop_stack();
}

#ifdef Nettle_BlockCipher_event_handler_defined
static void Nettle_BlockCipher_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_BlockCipher_defined
  case PROG_EVENT_INIT: init_Nettle_BlockCipher_struct(); break;

#endif /* internal_init_Nettle_BlockCipher_defined */
  default: break; 
  }
}

#endif /* Nettle_BlockCipher_event_handler_defined */
/*! @endclass BlockCipher
 */

#line 2947 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#define BLOCKCIPHER_CIPHER_INHERIT	(BUFFEREDCIPHER_CIPHER_INHERIT + \
					 Nettle_BlockCipher_Nettle_BufferedCipher_inh_num)

/*! @class BlockCipher16
 *!
 *! This is the @[BlockCipher] class extended with algorithms
 *! that require a block size of @expr{16@} bytes.
 *!
 *! @seealso
 *!   @[Cipher], @[BlockCipher], @[BufferedCipher], @[GCM]
 */

#undef class_Nettle_BlockCipher16_defined
#define class_Nettle_BlockCipher16_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher16_program=NULL;

#ifdef Nettle_BlockCipher16_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher16_program_fun_num=-1;
#endif /* Nettle_BlockCipher16_program_fun_num_used */
#line 2960 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
/* NOTE: MUST be first in the class to simplify access to symbols
   *       in Cipher!
   */
/*! @decl inherit BlockCipher
   */

#undef inherit_Nettle_BlockCipher_Nettle_BlockCipher16_defined
#define inherit_Nettle_BlockCipher_Nettle_BlockCipher16_defined
#line 2965 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher16_Nettle_BlockCipher_inh_num = -1;
#line 2965 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher16_Nettle_BlockCipher_inh_offset = -1;
#line 2967 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef HAVE_NETTLE_GCM_H
 
#undef var_GCM_Nettle_BlockCipher16_defined
#define var_GCM_Nettle_BlockCipher16_defined
#line 2969 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#endif

/*! @module CCM
   *!
   *! Implementation of the Counter with Cipher Block Chaining
   *! Message Authentication Code mode (CCM).
   *!
   *! Works as a wrapper for the cipher implemented by overloading
   *! the parent class (@[BlockCipher16]).
   *!
   *! This is a so-called authenticated encryption with associated data
   *! (AEAD) algorithm, and in addition to encryption also provides
   *! message digests.
   *!
   *! The operation of CCM is specified in
   *! NIST Special Publication 800-38C.
   *!
   *! @note
   *!   This mode of operation is not suited for streaming operation,
   *!   as the sizes of the associated data and payload data need to
   *!   be known for the CBC-MAC operation to start. Currently this
   *!   means that the associated data and payload data are buffered
   *!   until @[State()->digest()] is called.
   *!
   *! @seealso
   *!   @[CCM8], @[CBC], @[GCM], @[CTR]
   */

#undef var_CCM_Nettle_BlockCipher16_defined
#define var_CCM_Nettle_BlockCipher16_defined

#undef class_Nettle_BlockCipher16_cq__CCM_defined
#define class_Nettle_BlockCipher16_cq__CCM_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher16_cq__CCM_program=NULL;

#ifdef Nettle_BlockCipher16_cq__CCM_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher16_cq__CCM_program_fun_num=-1;
#endif /* Nettle_BlockCipher16_cq__CCM_program_fun_num_used */
/*! @decl inherit __builtin.Nettle.AEAD
     */

#undef inherit_cq__22__builtin_2ENettle_2EAEAD_22_Nettle_BlockCipher16_cq__CCM_defined
#define inherit_cq__22__builtin_2ENettle_2EAEAD_22_Nettle_BlockCipher16_cq__CCM_defined
#line 3003 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher16_cq__CCM_cq__22__builtin_2ENettle_2EAEAD_22_inh_num = -1;
#line 3003 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher16_cq__CCM_cq__22__builtin_2ENettle_2EAEAD_22_inh_offset = -1;
/*! @decl inherit BlockCipher::CTR
     */

#undef extra_Nettle_BlockCipher16_cq__CCM_defined
#define extra_Nettle_BlockCipher16_cq__CCM_defined
/*! @decl string(8bit) name()
     *! Returns the name of the base cipher with @expr{".CCM"@} appended.
     */
#define f_Nettle_BlockCipher16_cq__CCM_name_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__CCM_name_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__CCM_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__CCM_name(INT32 args) {
#line 3035 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
#line 3037 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(1, f_Nettle_Cipher_name_fun_num, args);
push_text(".CCM");
f_add(2);
}

}
/*! @decl int(4..16) digest_size()
     *! Default digest size.
     *!
     *! @returns
     *!   Returns @expr{16@}, but overloading via inherit is supported,
     *!   and may return any even number in the range @expr{[4..16]@}.
     *!
     *! @note
     *!   Note that the digest length is folded into the digest, so
     *!   it doesn't simply imply a truncation.
     */
#define f_Nettle_BlockCipher16_cq__CCM_digest_size_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_digest_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__CCM_digest_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__CCM_digest_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__CCM_digest_size(INT32 args) {
#line 3054 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("digest_size",args,0);
{
push_int(16);
}

}
#define f_Nettle_BlockCipher16_cq__CCM_block_size_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_block_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__CCM_block_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__CCM_block_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__CCM_block_size(INT32 args) {
#line 3059 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("block_size",args,0);
{
apply_external(1, f_Nettle_Cipher_block_size_fun_num, args);
}

}
#define f_Nettle_BlockCipher16_cq__CCM_key_size_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_key_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__CCM_key_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__CCM_key_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__CCM_key_size(INT32 args) {
#line 3064 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("key_size",args,0);
{
apply_external(1, f_Nettle_Cipher_key_size_fun_num, args);
}

}
#define f_Nettle_BlockCipher16_cq__CCM_iv_size_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_iv_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__CCM_iv_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__CCM_iv_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__CCM_iv_size(INT32 args) {
#line 3069 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("iv_size",args,0);
{
apply_external(1, f_Nettle_Cipher_block_size_fun_num, args);
}

}
/*! @class State
     */

#undef class_Nettle_BlockCipher16_cq__CCM_State_defined
#define class_Nettle_BlockCipher16_cq__CCM_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher16_cq__CCM_State_program=NULL;

#ifdef Nettle_BlockCipher16_cq__CCM_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher16_cq__CCM_State_program_fun_num=-1;
#endif /* Nettle_BlockCipher16_cq__CCM_State_program_fun_num_used */
/*! @decl inherit CTR::State
       */

#line 3082 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int ccm_state_inh_ctr_state_create_fun_num = -1;
static int ccm_state_inh_ctr_state_crypt_fun_num = -1;
static int ccm_state_inh_ctr_state_set_encrypt_key_fun_num = -1;
static int ccm_state_inh_ctr_state_set_decrypt_key_fun_num = -1;


#undef extra_Nettle_BlockCipher16_cq__CCM_State_defined
#define extra_Nettle_BlockCipher16_cq__CCM_State_defined

#undef var_decrypt_mode_Nettle_BlockCipher16_cq__CCM_State_defined
#define var_decrypt_mode_Nettle_BlockCipher16_cq__CCM_State_defined

#undef var_mac_mask_Nettle_BlockCipher16_cq__CCM_State_defined
#define var_mac_mask_Nettle_BlockCipher16_cq__CCM_State_defined

#undef var_nonce_Nettle_BlockCipher16_cq__CCM_State_defined
#define var_nonce_Nettle_BlockCipher16_cq__CCM_State_defined

#undef var_abuf_Nettle_BlockCipher16_cq__CCM_State_defined
#define var_abuf_Nettle_BlockCipher16_cq__CCM_State_defined

#undef var_pbuf_Nettle_BlockCipher16_cq__CCM_State_defined
#define var_pbuf_Nettle_BlockCipher16_cq__CCM_State_defined

#undef var_ctr_Nettle_BlockCipher16_cq__CCM_State_defined
#define var_ctr_Nettle_BlockCipher16_cq__CCM_State_defined

#undef THIS
#define THIS ((struct Nettle_BlockCipher16_cq__CCM_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_BLOCKCIPHER16_CQ__CCM_STATE
#define THIS_NETTLE_BLOCKCIPHER16_CQ__CCM_STATE ((struct Nettle_BlockCipher16_cq__CCM_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_BLOCKCIPHER16_CQ__CCM_STATE
#define OBJ2_NETTLE_BLOCKCIPHER16_CQ__CCM_STATE(o) ((struct Nettle_BlockCipher16_cq__CCM_State_struct *)(o->storage+Nettle_BlockCipher16_cq__CCM_State_storage_offset))

#undef GET_NETTLE_BLOCKCIPHER16_CQ__CCM_STATE_STORAGE
#define GET_NETTLE_BLOCKCIPHER16_CQ__CCM_STATE_STORAGE(o) ((struct Nettle_BlockCipher16_cq__CCM_State_struct *)(o->storage+Nettle_BlockCipher16_cq__CCM_State_storage_offset)
static ptrdiff_t Nettle_BlockCipher16_cq__CCM_State_storage_offset;
struct Nettle_BlockCipher16_cq__CCM_State_struct {

#ifdef var_decrypt_mode_Nettle_BlockCipher16_cq__CCM_State_defined
#line 3126 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
int decrypt_mode;
#endif /* var_decrypt_mode_Nettle_BlockCipher16_cq__CCM_State_defined */

#ifdef var_mac_mask_Nettle_BlockCipher16_cq__CCM_State_defined
  struct pike_string * mac_mask;

#endif /* var_mac_mask_Nettle_BlockCipher16_cq__CCM_State_defined */

#ifdef var_nonce_Nettle_BlockCipher16_cq__CCM_State_defined
  struct pike_string * nonce;

#endif /* var_nonce_Nettle_BlockCipher16_cq__CCM_State_defined */

#ifdef var_abuf_Nettle_BlockCipher16_cq__CCM_State_defined
#line 3132 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct string_builder abuf;
#endif /* var_abuf_Nettle_BlockCipher16_cq__CCM_State_defined */

#ifdef var_pbuf_Nettle_BlockCipher16_cq__CCM_State_defined
#line 3133 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct string_builder pbuf;
#endif /* var_pbuf_Nettle_BlockCipher16_cq__CCM_State_defined */

#ifdef var_ctr_Nettle_BlockCipher16_cq__CCM_State_defined
#line 3135 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct Nettle_BlockCipher_cq__CTR_State_struct *ctr;
#endif /* var_ctr_Nettle_BlockCipher16_cq__CCM_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_BlockCipher16_cq__CCM_State_struct *Nettle_BlockCipher16_cq__CCM_State_gdb_dummy_ptr;
#endif

#undef internal_init_Nettle_BlockCipher16_cq__CCM_State_defined
#define internal_init_Nettle_BlockCipher16_cq__CCM_State_defined

#undef Nettle_BlockCipher16_cq__CCM_State_event_handler_defined
#define Nettle_BlockCipher16_cq__CCM_State_event_handler_defined
static void init_Nettle_BlockCipher16_cq__CCM_State_struct(void)
#line 3138 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
init_string_builder(&THIS->abuf, 0);
init_string_builder(&THIS->pbuf, 0);

ASSIGN_CURRENT_STORAGE(THIS->ctr,
struct Nettle_BlockCipher_cq__CTR_State_struct,
1, Nettle_BlockCipher_cq__CTR_State_program);
}


#undef Nettle_BlockCipher16_cq__CCM_State_gc_live_obj
#define Nettle_BlockCipher16_cq__CCM_State_gc_live_obj

#undef internal_exit_Nettle_BlockCipher16_cq__CCM_State_defined
#define internal_exit_Nettle_BlockCipher16_cq__CCM_State_defined

#undef Nettle_BlockCipher16_cq__CCM_State_event_handler_defined
#define Nettle_BlockCipher16_cq__CCM_State_event_handler_defined
static void exit_Nettle_BlockCipher16_cq__CCM_State_struct(void)
#line 3148 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
THIS->ctr = NULL;
free_string_builder(&THIS->abuf);
free_string_builder(&THIS->pbuf);
}

/*! @decl void create()
       */
#define f_Nettle_BlockCipher16_cq__CCM_State_create_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_create_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__CCM_State_create_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__CCM_State_create_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__CCM_State_create(INT32 args) {
#line 3156 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("create",args,0);
#line 3158 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_current(ccm_state_inh_ctr_state_create_fun_num, args);
pop_stack();
if (THIS->ctr->block_size != 16) {
Pike_error("Invalid block cipher for CCM: %d.\n",
THIS->ctr->block_size);
}
reset_string_builder(&THIS->abuf);
reset_string_builder(&THIS->pbuf);

if (THIS->nonce) free_string(THIS->nonce);
THIS->nonce = NULL;
}

}
#define f_Nettle_BlockCipher16_cq__CCM_State_name_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__CCM_State_name_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__CCM_State_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__CCM_State_name(INT32 args) {
#line 3172 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
{
apply(THIS->ctr->object, "name", args);
push_text(".CCM");
f_add(2);
}

}
#define f_Nettle_BlockCipher16_cq__CCM_State_set_encrypt_key_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_set_encrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__CCM_State_set_encrypt_key_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__CCM_State_set_encrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__CCM_State_set_encrypt_key(INT32 args) {
#line 3179 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
struct svalue * flags;
#line 3179 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_encrypt_key",args,1);
#line 3179 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_encrypt_key",args,2);
#line 3179 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",1,"string(0..255)");
#line 3179 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 3180 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",2,"int|void");
#line 3180 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
flags=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 3180 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else flags = NULL;
{
reset_string_builder(&THIS->abuf);
reset_string_builder(&THIS->pbuf);
THIS->decrypt_mode = 0;
apply_current(ccm_state_inh_ctr_state_set_encrypt_key_fun_num, args);
}

}
#define f_Nettle_BlockCipher16_cq__CCM_State_set_decrypt_key_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_set_decrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__CCM_State_set_decrypt_key_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__CCM_State_set_decrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__CCM_State_set_decrypt_key(INT32 args) {
#line 3188 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
struct svalue * flags;
#line 3188 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_decrypt_key",args,1);
#line 3188 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_decrypt_key",args,2);
#line 3188 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",1,"string(0..255)");
#line 3188 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 3189 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",2,"int|void");
#line 3189 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
flags=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 3189 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else flags = NULL;
{
reset_string_builder(&THIS->abuf);
reset_string_builder(&THIS->pbuf);
THIS->decrypt_mode = 1;
apply_current(ccm_state_inh_ctr_state_set_decrypt_key_fun_num, args);
}

}
#define f_Nettle_BlockCipher16_cq__CCM_State_set_iv_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_set_iv_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__CCM_State_set_iv_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__CCM_State_set_iv_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__CCM_State_set_iv(INT32 args) {
#line 3197 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * iv;
#line 3197 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("set_iv",args,1);
#line 3197 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_iv",1,"string(0..255)");
#line 3197 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(iv=Pike_sp[0-1].u.string);
{
int iv_len = iv->len;
uint8_t *ctr_iv;

iv->flags |= STRING_CLEAR_ON_EXIT;
NO_WIDE_STRING(iv);

reset_string_builder(&THIS->abuf);
reset_string_builder(&THIS->pbuf);
if (iv_len < 7) {
Pike_error("Too short nonce for CCM. Must be at least 7 bytes.\n");
}
if (THIS->nonce) {
free_string(THIS->nonce);
THIS->nonce = NULL;
}
if (iv_len > 13) {
THIS->nonce = string_slice(iv, 0, 12);
iv_len = 13;
} else {
add_ref(THIS->nonce = iv);
}

ctr_iv = STR0(THIS->ctr->iv);

*(ctr_iv++) = 14 - iv_len;

memcpy(ctr_iv, STR0(iv), iv_len);
memset(ctr_iv + iv_len, 0, 15 - iv_len);

do { struct object * ret_=(this_object()); pop_stack(); push_object(ret_); return; }while(0);
#line 3229 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
#define f_Nettle_BlockCipher16_cq__CCM_State_update_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_update_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__CCM_State_update_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__CCM_State_update_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__CCM_State_update(INT32 args) {
#line 3231 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * public_data;
#line 3231 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("update",args,1);
#line 3231 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("update",1,"string(0..255)");
#line 3231 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(public_data=Pike_sp[0-1].u.string);
{
if (!public_data->len) return;

NO_WIDE_STRING(public_data);

string_builder_shared_strcat(&THIS->abuf, public_data);

do { struct object * ret_=(this_object()); pop_stack(); push_object(ret_); return; }while(0);
#line 3240 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
#line 3242 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static void blockcipher16_ccm_init_mac_mask(const char *caller)
{
struct pike_string *mac_mask;

if (!THIS->nonce) {
/* NB: Default to nonce of 13 NULs. */
add_ref(THIS->nonce = nul13_string);
memcpy(STR0(THIS->ctr->iv), "\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16);
}

/* Save the first block from the CTR to encrypt the MAC. */
ref_push_string(nul16_string);

apply_current(ccm_state_inh_ctr_state_crypt_fun_num, 1);

get_all_args(caller, 1, "%n", &mac_mask);
NO_WIDE_STRING(mac_mask);
if (mac_mask->len != 16) {
Pike_error("Bad string length %ld returned from crypt()\n",
DO_NOT_WARN((long)mac_mask->len));
}
if (THIS->mac_mask) free_string(THIS->mac_mask);
add_ref(THIS->mac_mask = mac_mask);
pop_stack();
}

#define f_Nettle_BlockCipher16_cq__CCM_State_crypt_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_crypt_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__CCM_State_crypt_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__CCM_State_crypt_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__CCM_State_crypt(INT32 args) {
#line 3268 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * data;
#line 3268 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("crypt",args,1);
#line 3268 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("crypt",1,"string(0..255)");
#line 3268 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(data=Pike_sp[0-1].u.string);
{
if (!data->len) {
return;
}

NO_WIDE_STRING(data);

if (!THIS->pbuf.s->len) {
blockcipher16_ccm_init_mac_mask("crypt");
}

if (!THIS->decrypt_mode) {
string_builder_shared_strcat(&THIS->pbuf, data);
}

apply_current(ccm_state_inh_ctr_state_crypt_fun_num, args);

if (THIS->decrypt_mode) {
get_all_args("crypt", 1, "%n", &data);

NO_WIDE_STRING(data);

string_builder_shared_strcat(&THIS->pbuf, data);
}
}

}
/*! @decl int(4..16) digest_size()
       *!
       *! Default digest size.
       *!
       *! This function is used by @[digest()] to determine the digest
       *! size if no argument was given.
       *!
       *! @returns
       *!   The default implementation returns the result from calling
       *!   @[global::digest_size()], but overloading via inherit is supported,
       *!   and may return any even number in the range @expr{[4..16]@}.
       *!
       *! @note
       *!   Note that the digest length is folded into the digest, so
       *!   it doesn't simply imply a truncation.
       *!
       *! @seealso
       *!   @[digest()], @[CCM::digest_size()]
       */
#define f_Nettle_BlockCipher16_cq__CCM_State_digest_size_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_digest_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__CCM_State_digest_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__CCM_State_digest_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__CCM_State_digest_size(INT32 args) {
#line 3314 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("digest_size",args,0);
{
apply_external(1, f_Nettle_BlockCipher16_cq__CCM_digest_size_fun_num,
args);
}

}
#line 3320 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static void pike_low_ccm_digest(struct pike_string *res,
struct pike_string *nonce,
struct pike_string *mac_mask,
struct pike_string *astr,
struct pike_string *pstr,
pike_nettle_crypt_func func,
void *ctx)
{
uint8_t buf[2][16];
size_t bytes = res->len;
size_t psize = pstr->len;
int i;
int flags;
int bufno = 0;
uint8_t *ptr;

flags = ((bytes-2)<<2) | (14 - nonce->len);
if (astr->len) {
/* Set the a-bit. */
flags |= 0x40;
}

psize = pstr->len;

/* NB: The nonce has a minimum size of 7 bytes.
	 *     Thus we need at most 8 bytes for the psize.
	 */
/* |flags|nonce|psize| */
ptr = buf[0] + 8;
for (i = 8; i--; psize >>= 8) {
ptr[i] = psize & 0xff;
}
buf[0][0] = flags;
memcpy(buf[0]+1, STR0(nonce), nonce->len);

func(ctx, 16, buf[1], buf[0]);
bufno = 1;

if (astr->len) {
size_t asize = astr->len;
ptr = STR0(astr);
if (asize < 0xff00) {
buf[1][0] ^= (asize >> 8) & 0xff;
buf[1][1] ^= asize & 0xff;
if (asize < 14) {
memxor(buf[1]+2, ptr, asize);
asize = 0;
} else {
memxor(buf[1]+2, ptr, 14);
ptr += 14;
asize -= 14;
}
#if (SIZEOF_CHARP > 4)
 } else if (asize > 0xffffffffUL) {
buf[1][0] ^= 0xff;
buf[1][1] ^= 0xff;
buf[1][2] ^= (asize >> 56) & 0xff;
buf[1][3] ^= (asize >> 48) & 0xff;
buf[1][4] ^= (asize >> 40) & 0xff;
buf[1][5] ^= (asize >> 32) & 0xff;
buf[1][6] ^= (asize >> 24) & 0xff;
buf[1][7] ^= (asize >> 16) & 0xff;
buf[1][8] ^= (asize >> 8) & 0xff;
buf[1][9] ^= asize & 0xff;
memxor(buf[1]+10, ptr, 6);
ptr += 6;
asize -= 6;
#endif
 } else {
buf[1][0] ^= 0xff;
buf[1][1] ^= 0xfe;
buf[1][2] ^= (asize >> 24) & 0xff;
buf[1][3] ^= (asize >> 16) & 0xff;
buf[1][4] ^= (asize >> 8) & 0xff;
buf[1][5] ^= asize & 0xff;
memxor(buf[1]+6, ptr, 10);
ptr += 10;
asize -= 10;
}

func(ctx, 16, buf[0], buf[1]);
bufno = 0;

for (;asize >= 16; asize -= 16, ptr += 16) {
memxor(buf[bufno], ptr, 16);
func(ctx, 16, buf[!bufno], buf[bufno]);
bufno = !bufno;
}
if (asize) {
memxor(buf[bufno], ptr, asize);
func(ctx, 16, buf[!bufno], buf[bufno]);
bufno = !bufno;
}
}

ptr = STR0(pstr);
psize = pstr->len;

for (; psize >= 16; psize -= 16, ptr += 16) {
memxor(buf[bufno], ptr, 16);
func(ctx, 16, buf[!bufno], buf[bufno]);
bufno = !bufno;
}
if (psize) {
memxor(buf[bufno], ptr, psize);
func(ctx, 16, buf[!bufno], buf[bufno]);
bufno = !bufno;
}

memxor3(STR0(res), buf[bufno], STR0(mac_mask), bytes);
}

/*! @decl string(8bit) digest(int(4..16)|void bytes)
       *!
       *! Returns the CBC-MAC digest of the specified size.
       *!
       *! @param bytes
       *!   Size in bytes for the desired digest. Any even number in
       *!   the range @expr{[4..16]@}. If not specified the value from
       *!   calling @[digest_size()] will be used.
       *!
       *! @note
       *!   Note that the digest length is folded into the digest, so
       *!   it doesn't simply imply a truncation.
       *!
       *! @seealso
       *!   @[digest_size()], @[global::digest_size()]
       */
#define f_Nettle_BlockCipher16_cq__CCM_State_digest_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_digest_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__CCM_State_digest_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__CCM_State_digest_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__CCM_State_digest(INT32 args) {
#line 3448 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * bytes_p;
#line 3448 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 1) wrong_number_of_args_error("digest",args,1);
#line 3448 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 0) &&
    ((TYPEOF(Pike_sp[0-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[0-args]) != NUMBER_UNDEFINED))) {
#line 3448 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("digest",1,"int(4..16)|void");
#line 3448 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
bytes_p=Pike_sp+0-args; dmalloc_touch_svalue(Pike_sp+0-args);
#line 3448 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else bytes_p = NULL;
{
int bytes = 0;
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->ctr->object;
struct pike_string *res;
struct pike_string *nonce = THIS->nonce;
struct pike_string *mac_mask = THIS->mac_mask;
struct pike_string *astr = THIS->abuf.s;
struct pike_string *pstr = THIS->pbuf.s;

if (bytes_p) {
bytes = bytes_p->u.integer;
if (bytes & 1) {
bytes++;
}
}
if (!bytes) {
apply_current(f_Nettle_BlockCipher16_cq__CCM_State_digest_size_fun_num,
0);
get_all_args("digest", 1, "%d", &bytes);
}
if (bytes < 4) {
bytes = 4;
} else if (bytes > 16) {
bytes = 16;
}

res = begin_shared_string(bytes);

if (!pstr->len) {
/* Unlikely, but make sure that it is initialized. */
blockcipher16_ccm_init_mac_mask("digest");
mac_mask = THIS->mac_mask;
}

if (THIS->ctr->crypt_state && THIS->ctr->crypt_state->crypt) {
func = THIS->ctr->crypt_state->crypt;
ctx = THIS->ctr->crypt_state->ctx;
}

if (((THIS->abuf.s->len + THIS->pbuf.s->len) >=
CIPHER_THREADS_ALLOW_THRESHOLD) &&
(func != pike_crypt_func)) {
/* NB: This is a rather expensive MAC, as it is based
	   *     on encrypting with CBC. */
/* Protect stuff in the object from being freed
	   * by a different thread while we use them.
	   */
add_ref(nonce);
add_ref(mac_mask);
add_ref(astr);
add_ref(pstr);

THREADS_ALLOW();
pike_low_ccm_digest(res, nonce, mac_mask, astr, pstr, func, ctx);
THREADS_DISALLOW();

free_string(pstr);
free_string(astr);
free_string(mac_mask);
free_string(nonce);
} else {
pike_low_ccm_digest(res, nonce, mac_mask, astr, pstr, func, ctx);
}

reset_string_builder(&THIS->pbuf);
reset_string_builder(&THIS->abuf);

push_string(end_shared_string(res));
}
}

#ifdef Nettle_BlockCipher16_cq__CCM_State_event_handler_defined
static void Nettle_BlockCipher16_cq__CCM_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_BlockCipher16_cq__CCM_State_defined
  case PROG_EVENT_INIT: init_Nettle_BlockCipher16_cq__CCM_State_struct(); break;

#endif /* internal_init_Nettle_BlockCipher16_cq__CCM_State_defined */

#ifdef internal_exit_Nettle_BlockCipher16_cq__CCM_State_defined
  case PROG_EVENT_EXIT: exit_Nettle_BlockCipher16_cq__CCM_State_struct(); break;

#endif /* internal_exit_Nettle_BlockCipher16_cq__CCM_State_defined */
  default: break; 
  }
}

#endif /* Nettle_BlockCipher16_cq__CCM_State_event_handler_defined */
/*! @endclass State
     */
/*! @endmodule CCM
   */

/*! @module CCM8
   *!
   *! Special case of @[CCM] where the default digest size
   *! has been truncated to @expr{8@} bytes.
   *!
   *! @seealso
   *!   @[CCM], @[CBC], @[GCM], @[CTR]
   */

#undef var_CCM8_Nettle_BlockCipher16_defined
#define var_CCM8_Nettle_BlockCipher16_defined

#undef class_Nettle_BlockCipher16_cq__CCM8_defined
#define class_Nettle_BlockCipher16_cq__CCM8_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher16_cq__CCM8_program=NULL;

#ifdef Nettle_BlockCipher16_cq__CCM8_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher16_cq__CCM8_program_fun_num=-1;
#endif /* Nettle_BlockCipher16_cq__CCM8_program_fun_num_used */
/*! @decl inherit CCM
     */

#undef extra_Nettle_BlockCipher16_cq__CCM8_defined
#define extra_Nettle_BlockCipher16_cq__CCM8_defined
/*! @decl string(8bit) name()
     *! Returns the name of the base cipher with @expr{".CCM8"@} appended.
     */
#define f_Nettle_BlockCipher16_cq__CCM8_name_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM8_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__CCM8_name_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__CCM8_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__CCM8_name(INT32 args) {
#line 3554 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
{
apply_external(1, f_Nettle_Cipher_name_fun_num, args);
push_text(".CCM8");
f_add(2);
}

}
/*! @decl int(4..16) digest_size()
     *! Default digest size.
     *!
     *! @returns
     *!   Returns @expr{8@}, but overloading via inherit is supported,
     *!   and may return any even number in the range @expr{[4..16]@}.
     */
#define f_Nettle_BlockCipher16_cq__CCM8_digest_size_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM8_digest_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__CCM8_digest_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__CCM8_digest_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__CCM8_digest_size(INT32 args) {
#line 3568 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("digest_size",args,0);
{
push_int(8);
}
}
/*! @endmodule CCM8
   */

#ifdef HAVE_NETTLE_EAX_H

#include <nettle/eax.h>

/*! @module EAX
   *!
   *! Implementation of the EAX mode.
   *!
   *! Works as a wrapper for the cipher implemented by overloading
   *! the parent class (@[BlockCipher16]).
   *!
   *! This is a so-called authenticated encryption with associated data
   *! (AEAD) algorithm, and in addition to encryption also provides
   *! message digests.
   *!
   *! @note
   *!   This mode of operation was specified as a reaction to the
   *!   limitiations of the @[BlockCipher16.CCM] mode.
   *!
   *! @note
   *!   Note that this module is not available in all versions of Nettle.
   *!
   *! @seealso
   *!   @[CBC], @[CTR], @[BlockCipher16.CCM], @[BlockCipher16.GCM]
   */

#undef var_EAX_Nettle_BlockCipher16_defined
#define var_EAX_Nettle_BlockCipher16_defined

#undef class_Nettle_BlockCipher16_cq__EAX_defined
#define class_Nettle_BlockCipher16_cq__EAX_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher16_cq__EAX_program=NULL;

#ifdef Nettle_BlockCipher16_cq__EAX_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher16_cq__EAX_program_fun_num=-1;
#endif /* Nettle_BlockCipher16_cq__EAX_program_fun_num_used */
/*! @decl inherit __builtin.Nettle.AEAD
     */

#undef inherit_cq__22__builtin_2ENettle_2EAEAD_22_Nettle_BlockCipher16_cq__EAX_defined
#define inherit_cq__22__builtin_2ENettle_2EAEAD_22_Nettle_BlockCipher16_cq__EAX_defined
#line 3608 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher16_cq__EAX_cq__22__builtin_2ENettle_2EAEAD_22_inh_num = -1;
#line 3608 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher16_cq__EAX_cq__22__builtin_2ENettle_2EAEAD_22_inh_offset = -1;
/*! @decl string(8bit) name()
     *! Returns the name of the base cipher with @expr{".EAX"@} appended.
     */
#define f_Nettle_BlockCipher16_cq__EAX_name_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__EAX_name_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__EAX_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__EAX_name(INT32 args) {
#line 3613 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
#line 3615 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(1, f_Nettle_Cipher_name_fun_num, args);
push_text(".EAX");
f_add(2);
}

}
/*! @decl int(1..) digest_size()
     *! Default digest size.
     *!
     *! @returns
     *!   Returns @[BlockCipher::block_size()], but overloading via
     *!   inherit is supported, and may return any positive number
     *!   @expr{<= BlockCipher::block_size()@}.
     */
#define f_Nettle_BlockCipher16_cq__EAX_digest_size_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_digest_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__EAX_digest_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__EAX_digest_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__EAX_digest_size(INT32 args) {
#line 3629 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("digest_size",args,0);
{
apply_external(1, f_Nettle_Cipher_block_size_fun_num, args);
}

}
#define f_Nettle_BlockCipher16_cq__EAX_block_size_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_block_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__EAX_block_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__EAX_block_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__EAX_block_size(INT32 args) {
#line 3634 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("block_size",args,0);
{
apply_external(1, f_Nettle_Cipher_block_size_fun_num, args);
}

}
#define f_Nettle_BlockCipher16_cq__EAX_key_size_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_key_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__EAX_key_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__EAX_key_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__EAX_key_size(INT32 args) {
#line 3639 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("key_size",args,0);
{
apply_external(1, f_Nettle_Cipher_key_size_fun_num, args);
}

}
#define f_Nettle_BlockCipher16_cq__EAX_iv_size_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_iv_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__EAX_iv_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__EAX_iv_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__EAX_iv_size(INT32 args) {
#line 3644 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("iv_size",args,0);
{
apply_external(1, f_Nettle_Cipher_block_size_fun_num, args);
}

}
/*! @class State
     */

#undef class_Nettle_BlockCipher16_cq__EAX_State_defined
#define class_Nettle_BlockCipher16_cq__EAX_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher16_cq__EAX_State_program=NULL;

#ifdef Nettle_BlockCipher16_cq__EAX_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher16_cq__EAX_State_program_fun_num=-1;
#endif /* Nettle_BlockCipher16_cq__EAX_State_program_fun_num_used */

#undef var_object_Nettle_BlockCipher16_cq__EAX_State_defined
#define var_object_Nettle_BlockCipher16_cq__EAX_State_defined

#undef var_crypt_state_Nettle_BlockCipher16_cq__EAX_State_defined
#define var_crypt_state_Nettle_BlockCipher16_cq__EAX_State_defined

#undef var_block_size_Nettle_BlockCipher16_cq__EAX_State_defined
#define var_block_size_Nettle_BlockCipher16_cq__EAX_State_defined

#undef var_mode_Nettle_BlockCipher16_cq__EAX_State_defined
#define var_mode_Nettle_BlockCipher16_cq__EAX_State_defined

#undef var_eax_key_Nettle_BlockCipher16_cq__EAX_State_defined
#define var_eax_key_Nettle_BlockCipher16_cq__EAX_State_defined

#undef var_eax_ctx_Nettle_BlockCipher16_cq__EAX_State_defined
#define var_eax_ctx_Nettle_BlockCipher16_cq__EAX_State_defined

#undef THIS
#define THIS ((struct Nettle_BlockCipher16_cq__EAX_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_BLOCKCIPHER16_CQ__EAX_STATE
#define THIS_NETTLE_BLOCKCIPHER16_CQ__EAX_STATE ((struct Nettle_BlockCipher16_cq__EAX_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_BLOCKCIPHER16_CQ__EAX_STATE
#define OBJ2_NETTLE_BLOCKCIPHER16_CQ__EAX_STATE(o) ((struct Nettle_BlockCipher16_cq__EAX_State_struct *)(o->storage+Nettle_BlockCipher16_cq__EAX_State_storage_offset))

#undef GET_NETTLE_BLOCKCIPHER16_CQ__EAX_STATE_STORAGE
#define GET_NETTLE_BLOCKCIPHER16_CQ__EAX_STATE_STORAGE(o) ((struct Nettle_BlockCipher16_cq__EAX_State_struct *)(o->storage+Nettle_BlockCipher16_cq__EAX_State_storage_offset)
static ptrdiff_t Nettle_BlockCipher16_cq__EAX_State_storage_offset;
struct Nettle_BlockCipher16_cq__EAX_State_struct {

#ifdef var_object_Nettle_BlockCipher16_cq__EAX_State_defined
  struct object * object;

#endif /* var_object_Nettle_BlockCipher16_cq__EAX_State_defined */

#ifdef var_crypt_state_Nettle_BlockCipher16_cq__EAX_State_defined
#line 3656 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct Nettle_Cipher_State_struct *crypt_state;
#endif /* var_crypt_state_Nettle_BlockCipher16_cq__EAX_State_defined */

#ifdef var_block_size_Nettle_BlockCipher16_cq__EAX_State_defined
#line 3657 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
int block_size;
#endif /* var_block_size_Nettle_BlockCipher16_cq__EAX_State_defined */

#ifdef var_mode_Nettle_BlockCipher16_cq__EAX_State_defined
#line 3658 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
int mode;
#endif /* var_mode_Nettle_BlockCipher16_cq__EAX_State_defined */

#ifdef var_eax_key_Nettle_BlockCipher16_cq__EAX_State_defined
#line 3659 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct eax_key eax_key;
#endif /* var_eax_key_Nettle_BlockCipher16_cq__EAX_State_defined */

#ifdef var_eax_ctx_Nettle_BlockCipher16_cq__EAX_State_defined
#line 3660 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct eax_ctx eax_ctx;
#endif /* var_eax_ctx_Nettle_BlockCipher16_cq__EAX_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_BlockCipher16_cq__EAX_State_struct *Nettle_BlockCipher16_cq__EAX_State_gdb_dummy_ptr;
#endif
/*! @decl inherit AEAD::State
       */


#undef extra_Nettle_BlockCipher16_cq__EAX_State_defined
#define extra_Nettle_BlockCipher16_cq__EAX_State_defined

#undef internal_exit_Nettle_BlockCipher16_cq__EAX_State_defined
#define internal_exit_Nettle_BlockCipher16_cq__EAX_State_defined

#undef Nettle_BlockCipher16_cq__EAX_State_event_handler_defined
#define Nettle_BlockCipher16_cq__EAX_State_event_handler_defined
static void exit_Nettle_BlockCipher16_cq__EAX_State_struct(void)
#line 3692 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
if (THIS->object) {
free_object(THIS->object);
THIS->object = NULL;
}
}

/*! @decl Cipher::State substate_factory()
       *!
       *! Returns the @[Cipher::State] object that this object
       *! is to operate on.
       *!
       *! Defaults to creating the State for the cipher implemented
       *! in the parent module.
       */
#define f_Nettle_BlockCipher16_cq__EAX_State_substate_factory_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_substate_factory_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__EAX_State_substate_factory_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_substate_factory_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__EAX_State_substate_factory(INT32 args) {
#line 3707 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("substate_factory",args,0);
#line 3709 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(2, Nettle_Cipher_State_program_fun_num, 0);
}

}
/*! @decl void create()
       */
#define f_Nettle_BlockCipher16_cq__EAX_State_create_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_create_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__EAX_State_create_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_create_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__EAX_State_create(INT32 args) {
#line 3715 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("create",args,0);
#line 3717 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct object *o;
struct inherit *inh;
int block_size;
int f;

apply_current(f_Nettle_BlockCipher16_cq__EAX_State_substate_factory_fun_num,
args);
if (TYPEOF(Pike_sp[-1]) != T_OBJECT) {
Pike_error("Unsupported return value from Cipher::State().\n");
}
o = Pike_sp[-1].u.object;
if (!o->prog) {
Pike_error("Cipher::State() returned destructed object.\n");
}

f = find_identifier("crypt", o->prog);
if (f < 0) {
Pike_error("State object has no crypt() function.\n");
}

apply(o, "block_size", 0);

if(TYPEOF(Pike_sp[-1]) != T_INT)
Pike_error("block_size() didn't return an int.\n");

block_size = Pike_sp[-1].u.integer;

if (block_size != EAX_BLOCK_SIZE)
Pike_error("Bad block size for EAX: %d.\n", block_size);

THIS->block_size = block_size;

if (THIS->object) free_object(THIS->object);
add_ref(THIS->object = o);

inh = INHERIT_FROM_INT(o->prog, f);
if (inh->prog == Nettle_Cipher_State_program) {
/* crypt() is from Nettle.Cipher.State.
	   */
THIS->crypt_state = (struct Nettle_Cipher_State_struct *)
get_inherit_storage(o, inh - o->prog->inherits);
} else {
THIS->crypt_state = NULL;
}

pop_n_elems(2);

THIS->mode = 0;
}

}
/*! @decl string(0..255) name()
       *! Returns the string @expr{"x.EAX"@} where x is the
       *! encapsulated algorithm.
       */
#define f_Nettle_BlockCipher16_cq__EAX_State_name_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__EAX_State_name_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__EAX_State_name(INT32 args) {
#line 3772 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
{
apply(THIS->object, "name", args);
push_text(".EAX");
f_add(2);
}

}
/*! @decl int(16..16) block_size()
       *! Returns the block size of the encapsulated cipher,
       *! which is always @expr{16@} for EAX.
       */
#define f_Nettle_BlockCipher16_cq__EAX_State_block_size_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_block_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__EAX_State_block_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_block_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__EAX_State_block_size(INT32 args) {
#line 3783 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("block_size",args,0);
#line 3785 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
do { INT_TYPE ret_=(EAX_BLOCK_SIZE);  push_int(ret_); return; }while(0);
#line 3787 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl int(1..16) digest_size()
       *!
       *! Default digest size.
       *!
       *! This function is used by @[digest()] to determine the digest
       *! size if no argument was given.
       *!
       *! @returns
       *!   The default implementation returns the result from calling
       *!   @[EAX::digest_size()], but overloading via inherit is supported,
       *!   and may return any even number in the range @expr{[1..16]@}.
       *!
       *! @seealso
       *!   @[digest()], @[EAX::digest_size()]
       */
#define f_Nettle_BlockCipher16_cq__EAX_State_digest_size_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_digest_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__EAX_State_digest_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_digest_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__EAX_State_digest_size(INT32 args) {
#line 3804 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("digest_size",args,0);
#line 3806 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(1, f_Nettle_BlockCipher16_cq__EAX_digest_size_fun_num, args);
}

}
/*! @decl int(16..16) iv_size()
       *! Returns the recommended size for the initialization vector
       *! (ie @expr{16@}).
       *!
       *! Other sizes are allowed, but will be compressed or expanded
       *! to this size using the encapsulated cipher.
       */
#define f_Nettle_BlockCipher16_cq__EAX_State_iv_size_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_iv_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__EAX_State_iv_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_iv_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__EAX_State_iv_size(INT32 args) {
#line 3817 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("iv_size",args,0);
#line 3819 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
do { INT_TYPE ret_=(EAX_IV_SIZE);  push_int(ret_); return; }while(0);
#line 3821 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl int(1..) key_size()
       *! Returns the key size of the encapsulated cipher.
       */
#define f_Nettle_BlockCipher16_cq__EAX_State_key_size_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_key_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__EAX_State_key_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_key_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__EAX_State_key_size(INT32 args) {
#line 3826 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("key_size",args,0);
#line 3828 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply(THIS->object, "key_size", args);
}

}
/*! @decl this_program set_encrypt_key(string(0..255) key, int|void flags)
       *!
       *! Prepare the cipher and the wrapper for encrypting with the given
       *! @[key]. The @[key] memory will be cleared before released.
       *!
       *! @note
       *!   Note that this operation does not by itself reset the
       *!   context sufficiently to start a new message; @[set_iv()]
       *!   needs to be called too.
       *!
       *! @seealso
       *!   @[set_decrypt_key()], @[set_iv()]
       */
#define f_Nettle_BlockCipher16_cq__EAX_State_set_encrypt_key_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_set_encrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__EAX_State_set_encrypt_key_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_set_encrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__EAX_State_set_encrypt_key(INT32 args) {
#line 3845 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
struct svalue * flags;
#line 3845 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_encrypt_key",args,1);
#line 3845 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_encrypt_key",args,2);
#line 3845 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",1,"string(0..255)");
#line 3845 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 3846 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",2,"int|void");
#line 3846 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
flags=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 3846 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else flags = NULL;
#line 3848 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;
key->flags |= STRING_CLEAR_ON_EXIT;
apply(THIS->object, "set_encrypt_key", args);
pop_stack();

if (THIS->crypt_state && THIS->crypt_state->crypt) {
func = THIS->crypt_state->crypt;
ctx = THIS->crypt_state->ctx;
}
eax_set_key(&THIS->eax_key, ctx, func);
THIS->mode = 0;

push_object(this_object());
}

}
/*! @decl this_program set_decrypt_key(string(0..255) key, int|void flags)
       *!
       *! Prepare the cipher and the wrapper for decrypting with the given
       *! @[key]. The @[key] memory will be cleared before released.
       *!
       *! @note
       *!   Note that this operation does not by itself reset the
       *!   context sufficiently to start a new message; @[set_iv()]
       *!   needs to be called too.
       *!
       *! @seealso
       *!   @[set_encrypt_key()], @[set_iv()]
       */
#define f_Nettle_BlockCipher16_cq__EAX_State_set_decrypt_key_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_set_decrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__EAX_State_set_decrypt_key_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_set_decrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__EAX_State_set_decrypt_key(INT32 args) {
#line 3878 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
struct svalue * flags;
#line 3878 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_decrypt_key",args,1);
#line 3878 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_decrypt_key",args,2);
#line 3878 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",1,"string(0..255)");
#line 3878 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 3879 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",2,"int|void");
#line 3879 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
flags=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 3879 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else flags = NULL;
#line 3881 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;
key->flags |= STRING_CLEAR_ON_EXIT;
/* NOTE: EAX always uses the encryption function
	 *       of the underlying cipher!
	 */
apply(THIS->object, "set_encrypt_key", args);
pop_stack();

if (THIS->crypt_state && THIS->crypt_state->crypt) {
func = THIS->crypt_state->crypt;
ctx = THIS->crypt_state->ctx;
}
eax_set_key(&THIS->eax_key, ctx, func);
THIS->mode = 1;

push_object(this_object());
}

}
#define f_Nettle_BlockCipher16_cq__EAX_State_set_iv_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_set_iv_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__EAX_State_set_iv_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_set_iv_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__EAX_State_set_iv(INT32 args) {
#line 3901 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * iv;
#line 3901 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("set_iv",args,1);
#line 3901 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_iv",1,"string(0..255)");
#line 3901 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(iv=Pike_sp[0-1].u.string);
{
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;
int iv_len = iv->len;
uint8_t *ctr_iv;

iv->flags |= STRING_CLEAR_ON_EXIT;
NO_WIDE_STRING(iv);

if (THIS->crypt_state && THIS->crypt_state->crypt) {
func = THIS->crypt_state->crypt;
ctx = THIS->crypt_state->ctx;
}

eax_set_nonce(&THIS->eax_ctx, &THIS->eax_key,
ctx, func, iv->len, STR0(iv));

do { struct object * ret_=(this_object()); pop_stack(); push_object(ret_); return; }while(0);
#line 3920 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
#define f_Nettle_BlockCipher16_cq__EAX_State_update_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_update_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__EAX_State_update_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_update_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__EAX_State_update(INT32 args) {
#line 3922 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * public_data;
#line 3922 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("update",args,1);
#line 3922 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("update",1,"string(0..255)");
#line 3922 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(public_data=Pike_sp[0-1].u.string);
{
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;

if (!public_data->len) return;

NO_WIDE_STRING(public_data);

if (THIS->crypt_state && THIS->crypt_state->crypt) {
func = THIS->crypt_state->crypt;
ctx = THIS->crypt_state->ctx;
}

eax_update(&THIS->eax_ctx, &THIS->eax_key,
ctx, func, public_data->len, STR0(public_data));

do { struct object * ret_=(this_object()); pop_stack(); push_object(ret_); return; }while(0);
#line 3940 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
#define f_Nettle_BlockCipher16_cq__EAX_State_crypt_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_crypt_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__EAX_State_crypt_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_crypt_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__EAX_State_crypt(INT32 args) {
#line 3942 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * data;
#line 3942 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("crypt",args,1);
#line 3942 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("crypt",1,"string(0..255)");
#line 3942 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(data=Pike_sp[0-1].u.string);
{
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;
struct pike_string *res;

if (!data->len) {
return;
}

NO_WIDE_STRING(data);

if (THIS->crypt_state && THIS->crypt_state->crypt) {
func = THIS->crypt_state->crypt;
ctx = THIS->crypt_state->ctx;
}

res = begin_shared_string(data->len);

if (!THIS->mode) {
eax_encrypt(&THIS->eax_ctx, &THIS->eax_key,
ctx, func, data->len, STR0(res), STR0(data));
} else {
eax_decrypt(&THIS->eax_ctx, &THIS->eax_key,
ctx, func, data->len, STR0(res), STR0(data));
}

push_string(end_shared_string(res));
}

}
/*! @decl string(8bit) digest(int(1..16)|void bytes)
       *!
       *! Returns the OMAC digest of the specified size.
       *!
       *! @param bytes
       *!   Size in bytes for the desired digest. Any number in the
       *!   range @expr{[1..16]@}. If not specified the value from
       *!   calling @[digest_size()] will be used.
       *!
       *! @seealso
       *!   @[digest_size()], @[global::digest_size()]
       */
#define f_Nettle_BlockCipher16_cq__EAX_State_digest_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_digest_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__EAX_State_digest_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_digest_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__EAX_State_digest(INT32 args) {
#line 3984 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * bytes_p;
#line 3984 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 1) wrong_number_of_args_error("digest",args,1);
#line 3984 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 0) &&
    ((TYPEOF(Pike_sp[0-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[0-args]) != NUMBER_UNDEFINED))) {
#line 3984 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("digest",1,"int(1..16)|void");
#line 3984 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
bytes_p=Pike_sp+0-args; dmalloc_touch_svalue(Pike_sp+0-args);
#line 3984 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else bytes_p = NULL;
{
int bytes = 0;
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;
struct pike_string *res;

if (bytes_p) {
bytes = bytes_p->u.integer;
if (bytes & 1) {
bytes++;
}
}
if (!bytes) {
apply_current(f_Nettle_BlockCipher16_cq__EAX_State_digest_size_fun_num,
0);
get_all_args("digest", 1, "%d", &bytes);
}
if (bytes < 1) {
bytes = 1;
} else if (bytes > EAX_DIGEST_SIZE) {
bytes = EAX_DIGEST_SIZE;
}

res = begin_shared_string(bytes);

if (THIS->crypt_state && THIS->crypt_state->crypt) {
func = THIS->crypt_state->crypt;
ctx = THIS->crypt_state->ctx;
}

eax_digest(&THIS->eax_ctx, &THIS->eax_key,
ctx, func, bytes, STR0(res));

push_string(end_shared_string(res));
}
}

#ifdef Nettle_BlockCipher16_cq__EAX_State_event_handler_defined
static void Nettle_BlockCipher16_cq__EAX_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_exit_Nettle_BlockCipher16_cq__EAX_State_defined
  case PROG_EVENT_EXIT: exit_Nettle_BlockCipher16_cq__EAX_State_struct(); break;

#endif /* internal_exit_Nettle_BlockCipher16_cq__EAX_State_defined */
  default: break; 
  }
}

#endif /* Nettle_BlockCipher16_cq__EAX_State_event_handler_defined */
/*! @endclass State
     */
/*! @endmodule EAX
   */
#line 4026 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#endif /* HAVE_NETTLE_EAX_H */

#ifdef HAVE_NETTLE_GCM_H

#include <nettle/gcm.h>

/*! @module GCM
   *! Implementation of the Galois Counter Mode (GCM).
   *!
   *! Works as a wrapper for the cipher implemented by overloading
   *! the parent class (@[BlockCipher16]).
   *!
   *! This is a so-called authenticated encryption with associated data
   *! (AEAD) algorithm, which in addition to encryption also provides
   *! message digests.
   *!
   *! The operation of GCM is specified in
   *! NIST Special Publication 800-38D.
   *!
   *! Typically accessed as @expr{Crypto.AES.GCM@} or
   *! @expr{Crypto.Camellia.GCM@}
   *!
   *! @note
   *!   Note that this module is not available in all versions of Nettle.
   *!
   *! @seealso
   *!   @[CBC]
   */


#undef class_Nettle_BlockCipher16_cq__GCM_defined
#define class_Nettle_BlockCipher16_cq__GCM_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher16_cq__GCM_program=NULL;

#ifdef Nettle_BlockCipher16_cq__GCM_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher16_cq__GCM_program_fun_num=-1;
#endif /* Nettle_BlockCipher16_cq__GCM_program_fun_num_used */
/*! @decl inherit __builtin.Nettle.AEAD
     */

#undef inherit_cq__22__builtin_2ENettle_2EAEAD_22_Nettle_BlockCipher16_cq__GCM_defined
#define inherit_cq__22__builtin_2ENettle_2EAEAD_22_Nettle_BlockCipher16_cq__GCM_defined
#line 4060 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher16_cq__GCM_cq__22__builtin_2ENettle_2EAEAD_22_inh_num = -1;
#line 4060 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_BlockCipher16_cq__GCM_cq__22__builtin_2ENettle_2EAEAD_22_inh_offset = -1;
/*! @decl string(0..255) name()
     *! Returns the name of the base cipher with @expr{".GCM"@} appended.
     */
#define f_Nettle_BlockCipher16_cq__GCM_name_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__GCM_name_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__GCM_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__GCM_name(INT32 args) {
#line 4065 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
#line 4067 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(1, f_Nettle_Cipher_name_fun_num, args);
push_text(".GCM");
f_add(2);
}

}
#define f_Nettle_BlockCipher16_cq__GCM_key_size_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_key_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__GCM_key_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__GCM_key_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__GCM_key_size(INT32 args) {
#line 4073 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("key_size",args,0);
{
apply_external(1, f_Nettle_Cipher_key_size_fun_num, args);
}

}
/*! @decl int(16..16) block_size()
     *! Returns the block size of the encapsulated cipher,
     *! which is always @expr{16@} for GCM.
     */
#define f_Nettle_BlockCipher16_cq__GCM_block_size_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_block_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__GCM_block_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__GCM_block_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__GCM_block_size(INT32 args) {
#line 4082 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("block_size",args,0);
#line 4084 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
do { INT_TYPE ret_=(GCM_BLOCK_SIZE);  push_int(ret_); return; }while(0);
#line 4086 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl int(16..16) digest_size()
     *! Returns the size of the generated digest,
     *! which is always @expr{16@} for GCM.
     */
#define f_Nettle_BlockCipher16_cq__GCM_digest_size_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_digest_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__GCM_digest_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__GCM_digest_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__GCM_digest_size(INT32 args) {
#line 4092 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("digest_size",args,0);
#line 4094 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
do { INT_TYPE ret_=(GCM_BLOCK_SIZE);  push_int(ret_); return; }while(0);
#line 4096 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl int(12..12) iv_size()
     *! Returns the recommended size for the initialization vector
     *! (ie @expr{12@}).
     *!
     *! Other sizes are allowed, but will be compressed or expanded
     *! to this size using the encapsulated cipher.
     */
#define f_Nettle_BlockCipher16_cq__GCM_iv_size_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_iv_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__GCM_iv_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__GCM_iv_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__GCM_iv_size(INT32 args) {
#line 4105 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("iv_size",args,0);
#line 4107 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
do { INT_TYPE ret_=(GCM_IV_SIZE);  push_int(ret_); return; }while(0);
#line 4109 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @class State
     *!
     *! The state for a GCM instance.
     */

#undef class_Nettle_BlockCipher16_cq__GCM_State_defined
#define class_Nettle_BlockCipher16_cq__GCM_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BlockCipher16_cq__GCM_State_program=NULL;

#ifdef Nettle_BlockCipher16_cq__GCM_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BlockCipher16_cq__GCM_State_program_fun_num=-1;
#endif /* Nettle_BlockCipher16_cq__GCM_State_program_fun_num_used */
/*! @decl inherit AEAD::State
*/


#undef extra_Nettle_BlockCipher16_cq__GCM_State_defined
#define extra_Nettle_BlockCipher16_cq__GCM_State_defined

#undef var_object_Nettle_BlockCipher16_cq__GCM_State_defined
#define var_object_Nettle_BlockCipher16_cq__GCM_State_defined

#undef var_crypt_state_Nettle_BlockCipher16_cq__GCM_State_defined
#define var_crypt_state_Nettle_BlockCipher16_cq__GCM_State_defined

#undef var_mode_Nettle_BlockCipher16_cq__GCM_State_defined
#define var_mode_Nettle_BlockCipher16_cq__GCM_State_defined

#undef var_dmode_Nettle_BlockCipher16_cq__GCM_State_defined
#define var_dmode_Nettle_BlockCipher16_cq__GCM_State_defined

#undef var_gcm_key_Nettle_BlockCipher16_cq__GCM_State_defined
#define var_gcm_key_Nettle_BlockCipher16_cq__GCM_State_defined

#undef var_gcm_ctx_Nettle_BlockCipher16_cq__GCM_State_defined
#define var_gcm_ctx_Nettle_BlockCipher16_cq__GCM_State_defined

#undef THIS
#define THIS ((struct Nettle_BlockCipher16_cq__GCM_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_BLOCKCIPHER16_CQ__GCM_STATE
#define THIS_NETTLE_BLOCKCIPHER16_CQ__GCM_STATE ((struct Nettle_BlockCipher16_cq__GCM_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_BLOCKCIPHER16_CQ__GCM_STATE
#define OBJ2_NETTLE_BLOCKCIPHER16_CQ__GCM_STATE(o) ((struct Nettle_BlockCipher16_cq__GCM_State_struct *)(o->storage+Nettle_BlockCipher16_cq__GCM_State_storage_offset))

#undef GET_NETTLE_BLOCKCIPHER16_CQ__GCM_STATE_STORAGE
#define GET_NETTLE_BLOCKCIPHER16_CQ__GCM_STATE_STORAGE(o) ((struct Nettle_BlockCipher16_cq__GCM_State_struct *)(o->storage+Nettle_BlockCipher16_cq__GCM_State_storage_offset)
static ptrdiff_t Nettle_BlockCipher16_cq__GCM_State_storage_offset;
struct Nettle_BlockCipher16_cq__GCM_State_struct {

#ifdef var_object_Nettle_BlockCipher16_cq__GCM_State_defined
  struct object * object;

#endif /* var_object_Nettle_BlockCipher16_cq__GCM_State_defined */

#ifdef var_crypt_state_Nettle_BlockCipher16_cq__GCM_State_defined
#line 4148 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct Nettle_Cipher_State_struct *crypt_state;
#endif /* var_crypt_state_Nettle_BlockCipher16_cq__GCM_State_defined */

#ifdef var_mode_Nettle_BlockCipher16_cq__GCM_State_defined
#line 4149 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
INT32 mode;
#endif /* var_mode_Nettle_BlockCipher16_cq__GCM_State_defined */

#ifdef var_dmode_Nettle_BlockCipher16_cq__GCM_State_defined
#line 4150 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
INT32 dmode;
#endif /* var_dmode_Nettle_BlockCipher16_cq__GCM_State_defined */

#ifdef var_gcm_key_Nettle_BlockCipher16_cq__GCM_State_defined
#line 4151 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct gcm_key gcm_key;
#endif /* var_gcm_key_Nettle_BlockCipher16_cq__GCM_State_defined */

#ifdef var_gcm_ctx_Nettle_BlockCipher16_cq__GCM_State_defined
#line 4152 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct gcm_ctx gcm_ctx;
#endif /* var_gcm_ctx_Nettle_BlockCipher16_cq__GCM_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_BlockCipher16_cq__GCM_State_struct *Nettle_BlockCipher16_cq__GCM_State_gdb_dummy_ptr;
#endif
#line 4154 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
/* dmode flags */
#define NO_ADATA	1	/* Disallow associated data. */
#define NO_CDATA	2	/* Disallow crypted data. */


#undef internal_init_Nettle_BlockCipher16_cq__GCM_State_defined
#define internal_init_Nettle_BlockCipher16_cq__GCM_State_defined

#undef Nettle_BlockCipher16_cq__GCM_State_event_handler_defined
#define Nettle_BlockCipher16_cq__GCM_State_event_handler_defined
static void init_Nettle_BlockCipher16_cq__GCM_State_struct(void)
#line 4159 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
THIS->mode = -1;
}


#undef internal_exit_Nettle_BlockCipher16_cq__GCM_State_defined
#define internal_exit_Nettle_BlockCipher16_cq__GCM_State_defined

#undef Nettle_BlockCipher16_cq__GCM_State_event_handler_defined
#define Nettle_BlockCipher16_cq__GCM_State_event_handler_defined
static void exit_Nettle_BlockCipher16_cq__GCM_State_struct(void)
#line 4165 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
if (THIS->object) {
free_object(THIS->object);
THIS->object = NULL;
}
}

/*! @decl Cipher::State substate_factory()
       *!
       *! Returns the @[Cipher::State] object that this object
       *! is to operate on.
       *!
       *! Defaults to creating the State for the cipher implemented
       *! in the parent module.
       */
#define f_Nettle_BlockCipher16_cq__GCM_State_substate_factory_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_substate_factory_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__GCM_State_substate_factory_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_substate_factory_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__GCM_State_substate_factory(INT32 args) {
#line 4180 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("substate_factory",args,0);
#line 4182 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_external(2, Nettle_Cipher_State_program_fun_num, 0);
}

}
/*! @decl void create()
       *!
       *! Initialize the GCM state with the @[Cipher::State] object
       *! returned by @[substate_factory()]. This is usually
       *! the State for the cipher implemented in the parent module.
       */
#define f_Nettle_BlockCipher16_cq__GCM_State_create_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_create_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__GCM_State_create_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_create_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__GCM_State_create(INT32 args) {
#line 4192 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("create",args,0);
#line 4194 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct object *o;
struct inherit *inh;
int f;

apply_current(f_Nettle_BlockCipher16_cq__GCM_State_substate_factory_fun_num,
0);
if (TYPEOF(Pike_sp[-1]) != T_OBJECT) {
Pike_error("Unsupported return value from Cipher::State().\n");
}
o = Pike_sp[-1].u.object;
if (!o->prog) {
Pike_error("Cipher::State() returned destructed object.\n");
}

f = find_identifier("crypt", o->prog);
if (f < 0) {
Pike_error("State object has no crypt() function.\n");
}

apply(o, "block_size", 0);

if (TYPEOF(Pike_sp[-1]) != T_INT)
Pike_error("block_size() didn't return an int.\n");

if (Pike_sp[-1].u.integer != GCM_BLOCK_SIZE)
Pike_error("cipher has an invalid block size for GCM.\n");

if (THIS->object) free_object(THIS->object);
add_ref(THIS->object = o);

inh = INHERIT_FROM_INT(o->prog, f);
if (inh->prog == Nettle_Cipher_State_program) {
/* crypt() is from Nettle.Cipher.State.
	   */
THIS->crypt_state = (struct Nettle_Cipher_State_struct *)
get_inherit_storage(o, inh - o->prog->inherits);
} else {
THIS->crypt_state = NULL;
}

pop_n_elems(2);

THIS->mode = -1;
}

}
/*! @decl string(0..255) name()
       *! Returns the string @expr{"x.GCM"@} where x is the
       *! encapsulated algorithm.
       */
#define f_Nettle_BlockCipher16_cq__GCM_State_name_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_name_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__GCM_State_name_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_name_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__GCM_State_name(INT32 args) {
#line 4244 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("name",args,0);
#line 4246 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply(THIS->object, "name", 0);
push_text(".GCM");
f_add(2);
}

}
/*! @decl int(16..16) block_size()
       *! Returns the block size of the encapsulated cipher,
       *! which is always @expr{16@} for GCM.
       */
#define f_Nettle_BlockCipher16_cq__GCM_State_block_size_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_block_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__GCM_State_block_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_block_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__GCM_State_block_size(INT32 args) {
#line 4256 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("block_size",args,0);
#line 4258 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
do { INT_TYPE ret_=(GCM_BLOCK_SIZE);  push_int(ret_); return; }while(0);
#line 4260 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl int(16..16) digest_size()
       *! Returns the size of the generated digest,
       *! which is always @expr{16@} for GCM.
       */
#define f_Nettle_BlockCipher16_cq__GCM_State_digest_size_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_digest_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__GCM_State_digest_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_digest_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__GCM_State_digest_size(INT32 args) {
#line 4266 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("digest_size",args,0);
#line 4268 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
do { INT_TYPE ret_=(GCM_BLOCK_SIZE);  push_int(ret_); return; }while(0);
#line 4270 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl int(12..12) iv_size()
       *! Returns the recommended size for the initialization vector
       *! (ie @expr{12@}).
       *!
       *! Other sizes are allowed, but will be compressed or expanded
       *! to this size using the encapsulated cipher.
       */
#define f_Nettle_BlockCipher16_cq__GCM_State_iv_size_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_iv_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__GCM_State_iv_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_iv_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__GCM_State_iv_size(INT32 args) {
#line 4279 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("iv_size",args,0);
#line 4281 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
do { INT_TYPE ret_=(GCM_IV_SIZE);  push_int(ret_); return; }while(0);
#line 4283 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl int(1..) key_size()
       *! Returns the key size of the encapsulated cipher.
       */
#define f_Nettle_BlockCipher16_cq__GCM_State_key_size_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_key_size_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__GCM_State_key_size_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_key_size_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__GCM_State_key_size(INT32 args) {
#line 4288 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("key_size",args,0);
#line 4290 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply(THIS->object, "key_size", args);
}

}
/*! @decl this_program set_encrypt_key(string(0..255) key, int|void flags)
       *!
       *! Prepare the cipher and the wrapper for encrypting with the given
       *! @[key]. The @[key] memory will be cleared before released.
       *!
       *! @note
       *!   Note that this operation does not by itself reset the
       *!   context sufficiently to start a new message; @[set_iv()]
       *!   needs to be called too.
       *!
       *! @seealso
       *!   @[set_decrypt_key()], @[set_iv()]
       */
#define f_Nettle_BlockCipher16_cq__GCM_State_set_encrypt_key_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_set_encrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__GCM_State_set_encrypt_key_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_set_encrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__GCM_State_set_encrypt_key(INT32 args) {
#line 4307 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 4307 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * flags;
#line 4307 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_encrypt_key",args,1);
#line 4307 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_encrypt_key",args,2);
#line 4307 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",1,"string(0..255)");
#line 4307 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
#line 4307 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 4307 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",2,"int|void");
#line 4307 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
flags=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 4307 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else flags = NULL;
#line 4309 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;
key->flags |= STRING_CLEAR_ON_EXIT;
apply(THIS->object, "set_encrypt_key", args);
pop_stack();

if (THIS->crypt_state && THIS->crypt_state->crypt) {
func = THIS->crypt_state->crypt;
ctx = THIS->crypt_state->ctx;
}
gcm_set_key(&THIS->gcm_key, ctx, func);
THIS->mode = 0;

push_object(this_object());
}

}
/*! @decl this_program set_decrypt_key(string(0..255) key, int|void flags)
       *!
       *! Prepare the cipher and the wrapper for decrypting with the given
       *! @[key]. The @[key] memory will be cleared before released.
       *!
       *! @note
       *!   Note that this operation does not by itself reset the
       *!   context sufficiently to start a new message; @[set_iv()]
       *!   needs to be called too.
       *!
       *! @seealso
       *!   @[set_encrypt_key()], @[set_iv()]
       */
#define f_Nettle_BlockCipher16_cq__GCM_State_set_decrypt_key_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_set_decrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__GCM_State_set_decrypt_key_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_set_decrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__GCM_State_set_decrypt_key(INT32 args) {
#line 4339 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 4339 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * flags;
#line 4339 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_decrypt_key",args,1);
#line 4339 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_decrypt_key",args,2);
#line 4339 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",1,"string(0..255)");
#line 4339 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
#line 4339 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 4339 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",2,"int|void");
#line 4339 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
flags=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 4339 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else flags = NULL;
#line 4341 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;
key->flags |= STRING_CLEAR_ON_EXIT;
/* NOTE: GCM always uses the encryption function
	 *       of the underlying cipher!
	 */
apply(THIS->object, "set_encrypt_key", args);
pop_stack();

if (THIS->crypt_state && THIS->crypt_state->crypt) {
func = THIS->crypt_state->crypt;
ctx = THIS->crypt_state->ctx;
}
gcm_set_key(&THIS->gcm_key, ctx, func);
THIS->mode = 1;

push_object(this_object());
}

}
/*! @decl this_program set_iv(string(0..255) iv)
       *!
       *! Set the initialization vector to @[iv]. The @[iv] memory will be
       *! cleared before released.
       *!
       *! Also resets all state needed to start a new message.
       *!
       *! @note
       *!   For @[iv]s of length other than @expr{12@}, an encryption or
       *!   decryption key must have been set first.
       *!
       *! @seealso
       *!   @[set_encrypt_key()], @[set_decrypt_key()].
       */
#define f_Nettle_BlockCipher16_cq__GCM_State_set_iv_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_set_iv_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__GCM_State_set_iv_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_set_iv_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__GCM_State_set_iv(INT32 args) {
#line 4375 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * iv;
#line 4375 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("set_iv",args,1);
#line 4375 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_iv",1,"string(0..255)");
#line 4375 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(iv=Pike_sp[0-1].u.string);
#line 4377 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
iv->flags |= STRING_CLEAR_ON_EXIT;
NO_WIDE_STRING(iv);
if ((THIS->mode < 0) && (iv->len != GCM_IV_SIZE))
Pike_error("The key must be set to use an iv of length other than %d.\n",
GCM_IV_SIZE);
gcm_set_iv(&THIS->gcm_ctx, &THIS->gcm_key, iv->len, STR0(iv));
THIS->dmode = 0;
do { struct object * ret_=(this_object()); pop_stack(); push_object(ret_); return; }while(0);
#line 4386 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @decl void update(string(0..255) public_data)
       *!
       *! Add @[public_data] to be authenticated.
       *!
       *! The length of @[public_data] MUST be a multiple of the
       *! block size (ie @expr{16@}) for all calls except the last.
       *!
       *! All calls of @[update()] need to be performed before
       *! any calls of @[crypt()].
       */
#define f_Nettle_BlockCipher16_cq__GCM_State_update_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_update_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__GCM_State_update_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_update_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__GCM_State_update(INT32 args) {
#line 4398 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * data;
#line 4398 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("update",args,1);
#line 4398 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("update",1,"string(0..255)");
#line 4398 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(data=Pike_sp[0-1].u.string);
{
struct gcm_ctx *gcm_ctx = &THIS->gcm_ctx;
struct gcm_key *gcm_key = &THIS->gcm_key;

NO_WIDE_STRING(data);

if (!THIS->object || !THIS->object->prog) {
Pike_error("Lookup in destructed object.\n");
}

if (THIS->mode < 0)
Pike_error("Key schedule not initialized.\n");

if (THIS->dmode & NO_ADATA)
Pike_error("Public data not allowed now.\n");

if (data->len >= HASH_THREADS_ALLOW_THRESHOLD) {
THREADS_ALLOW();
gcm_update(gcm_ctx, gcm_key, data->len, STR0(data));
THREADS_DISALLOW();
} else {
gcm_update(gcm_ctx, gcm_key, data->len, STR0(data));
}

if (data->len & (GCM_BLOCK_SIZE - 1))
THIS->dmode |= NO_ADATA;

pop_n_elems(args);
}

}
/*! @decl string(0..255) crypt(string(0..255) data)
       *!
       *! Encrypt/decrypt @[data] and return the result. @[data] must
       *! be an integral number of blocks.
       *!
       *! The length of @[data] MUST be a multiple of the block size
       *! (ie @expr{16@}) for all calls except the last.
       *!
       *! Neither the input or output data is not automatically memory
       *! scrubbed, unless @[String.secure] has been called on the data.
       *!
       *! @seealso
       *!   @[update()], @[digest()]
       */
#define f_Nettle_BlockCipher16_cq__GCM_State_crypt_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_crypt_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__GCM_State_crypt_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_crypt_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__GCM_State_crypt(INT32 args) {
#line 4443 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * data;
#line 4443 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("crypt",args,1);
#line 4443 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("crypt",1,"string(0..255)");
#line 4443 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(data=Pike_sp[0-1].u.string);
{
struct pike_string *result;
ONERROR uwp;
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;
struct gcm_ctx *gcm_ctx = &THIS->gcm_ctx;
struct gcm_key *gcm_key = &THIS->gcm_key;

NO_WIDE_STRING(data);

if (!THIS->object || !THIS->object->prog) {
Pike_error("Lookup in destructed object.\n");
}

if (THIS->mode < 0)
Pike_error("Key schedule not initialized.\n");

if (THIS->dmode & NO_CDATA)
Pike_error("More data not allowed before the iv is reset.\n");

result = begin_shared_string(data->len);
SET_ONERROR (uwp, do_free_string, result);

if (THIS->crypt_state && THIS->crypt_state->crypt) {
func = THIS->crypt_state->crypt;
ctx = THIS->crypt_state->ctx;
}

if (!THIS->mode) {
if ((data->len >= CIPHER_THREADS_ALLOW_THRESHOLD) &&
(func != pike_crypt_func)) {
THREADS_ALLOW();
gcm_encrypt(gcm_ctx, gcm_key, ctx, func,
data->len, STR0(result), STR0(data));
THREADS_DISALLOW();
} else {
gcm_encrypt(gcm_ctx, gcm_key, ctx, func,
data->len, STR0(result), STR0(data));
}
} else {
if ((data->len >= CIPHER_THREADS_ALLOW_THRESHOLD) &&
(func != pike_crypt_func)) {
THREADS_ALLOW();
gcm_decrypt(gcm_ctx, gcm_key, ctx, func,
data->len, STR0(result), STR0(data));
THREADS_DISALLOW();
} else {
gcm_decrypt(gcm_ctx, gcm_key, ctx, func,
data->len, STR0(result), STR0(data));
}
}

THIS->dmode |= NO_ADATA;

if (data->len & (GCM_BLOCK_SIZE - 1))
THIS->dmode |= NO_CDATA;

pop_n_elems(args);
push_string(end_shared_string(result));
UNSET_ONERROR(uwp);
}

}
/*! @decl string(0..255) digest()
       *!
       *! Generate a message digest for the data accumulated so far.
       *!
       *! @note
       *!   @[set_iv()] needs to be called to start the next message.
       *!
       *! @seealso
       *!   @[update()], @[digest()]
       */
#define f_Nettle_BlockCipher16_cq__GCM_State_digest_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_digest_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_BlockCipher16_cq__GCM_State_digest_fun_num = 0;

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_digest_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_BlockCipher16_cq__GCM_State_digest(INT32 args) {
#line 4516 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("digest",args,0);
{
struct pike_string *result;
ONERROR uwp;
pike_nettle_crypt_func func = pike_crypt_func;
void *ctx = THIS->object;

if (!THIS->object || !THIS->object->prog) {
Pike_error("Lookup in destructed object.\n");
}

if (THIS->mode < 0)
Pike_error("Key schedule not initialized.\n");

result = begin_shared_string(GCM_BLOCK_SIZE);
SET_ONERROR (uwp, do_free_string, result);

if (THIS->crypt_state && THIS->crypt_state->crypt) {
func = THIS->crypt_state->crypt;
ctx = THIS->crypt_state->ctx;
}

gcm_digest(&THIS->gcm_ctx, &THIS->gcm_key, ctx, func,
GCM_BLOCK_SIZE, STR0(result));

THIS->dmode |= NO_ADATA | NO_CDATA;

pop_n_elems(args);
push_string(end_shared_string(result));
UNSET_ONERROR(uwp);
}
}

#ifdef Nettle_BlockCipher16_cq__GCM_State_event_handler_defined
static void Nettle_BlockCipher16_cq__GCM_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_BlockCipher16_cq__GCM_State_defined
  case PROG_EVENT_INIT: init_Nettle_BlockCipher16_cq__GCM_State_struct(); break;

#endif /* internal_init_Nettle_BlockCipher16_cq__GCM_State_defined */

#ifdef internal_exit_Nettle_BlockCipher16_cq__GCM_State_defined
  case PROG_EVENT_EXIT: exit_Nettle_BlockCipher16_cq__GCM_State_struct(); break;

#endif /* internal_exit_Nettle_BlockCipher16_cq__GCM_State_defined */
  default: break; 
  }
}

#endif /* Nettle_BlockCipher16_cq__GCM_State_event_handler_defined */
/*! @endclass State
     */
/*! @endmodule GCM
   */

#line 4555 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#endif /* HAVE_NETTLE_GCM_H */

/* NB: Declare the storage explicitly to avoid having it declared
   *     inside the #ifdef above.
   */

#undef THIS
#define THIS ((struct Nettle_BlockCipher16_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_BLOCKCIPHER16
#define THIS_NETTLE_BLOCKCIPHER16 ((struct Nettle_BlockCipher16_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_BLOCKCIPHER16
#define OBJ2_NETTLE_BLOCKCIPHER16(o) ((struct Nettle_BlockCipher16_struct *)(o->storage+Nettle_BlockCipher16_storage_offset))

#undef GET_NETTLE_BLOCKCIPHER16_STORAGE
#define GET_NETTLE_BLOCKCIPHER16_STORAGE(o) ((struct Nettle_BlockCipher16_struct *)(o->storage+Nettle_BlockCipher16_storage_offset)
static ptrdiff_t Nettle_BlockCipher16_storage_offset;
struct Nettle_BlockCipher16_struct {

#ifdef var_GCM_Nettle_BlockCipher16_defined
  struct object * GCM;

#endif /* var_GCM_Nettle_BlockCipher16_defined */

#ifdef var_CCM_Nettle_BlockCipher16_defined
  struct object * CCM;

#endif /* var_CCM_Nettle_BlockCipher16_defined */

#ifdef var_CCM8_Nettle_BlockCipher16_defined
  struct object * CCM8;

#endif /* var_CCM8_Nettle_BlockCipher16_defined */

#ifdef var_EAX_Nettle_BlockCipher16_defined
  struct object * EAX;

#endif /* var_EAX_Nettle_BlockCipher16_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_BlockCipher16_struct *Nettle_BlockCipher16_gdb_dummy_ptr;
#endif
#line 4560 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
;


#undef internal_init_Nettle_BlockCipher16_defined
#define internal_init_Nettle_BlockCipher16_defined

#undef Nettle_BlockCipher16_event_handler_defined
#define Nettle_BlockCipher16_event_handler_defined
static void init_Nettle_BlockCipher16_struct(void)
#line 4563 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
apply_current(Nettle_BlockCipher16_cq__CCM_program_fun_num, 0);
if (TYPEOF(Pike_sp[-1]) == T_OBJECT) {
add_ref(THIS_NETTLE_BLOCKCIPHER16->CCM = Pike_sp[-1].u.object);
}
pop_stack();
apply_current(Nettle_BlockCipher16_cq__CCM8_program_fun_num, 0);
if (TYPEOF(Pike_sp[-1]) == T_OBJECT) {
add_ref(THIS_NETTLE_BLOCKCIPHER16->CCM8 = Pike_sp[-1].u.object);
}
pop_stack();
#ifdef HAVE_NETTLE_EAX_H
 apply_current(Nettle_BlockCipher16_cq__EAX_program_fun_num, 0);
if (TYPEOF(Pike_sp[-1]) == T_OBJECT) {
add_ref(THIS_NETTLE_BLOCKCIPHER16->EAX = Pike_sp[-1].u.object);
}
pop_stack();
#endif
#ifdef HAVE_NETTLE_GCM_H
 apply_current(Nettle_BlockCipher16_cq__GCM_program_fun_num, 0);
if (TYPEOF(Pike_sp[-1]) == T_OBJECT) {
add_ref(THIS_NETTLE_BLOCKCIPHER16->GCM = Pike_sp[-1].u.object);
}
pop_stack();
#endif
 }

#ifdef Nettle_BlockCipher16_event_handler_defined
static void Nettle_BlockCipher16_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_BlockCipher16_defined
  case PROG_EVENT_INIT: init_Nettle_BlockCipher16_struct(); break;

#endif /* internal_init_Nettle_BlockCipher16_defined */
  default: break; 
  }
}

#endif /* Nettle_BlockCipher16_event_handler_defined */
/*! @endclass BlockCipher16
 */

#line 4593 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#define BLOCKCIPHER16_CIPHER_INHERIT	(BLOCKCIPHER_CIPHER_INHERIT + 1)

static void
pike_aes_set_encrypt_key(void *ctx,
ptrdiff_t length, const char *key,
int UNUSED(force))
{
if (length == 16 || length == 24 || length == 32)
aes_set_encrypt_key(ctx, length, (const uint8_t *)key);
else
Pike_error("AES: Bad keysize for AES.\n");
}

static void
pike_aes_set_decrypt_key(void *ctx,
ptrdiff_t length, const char *key,
int UNUSED(force))
{
if (length == 16 || length == 24 || length == 32)
aes_set_decrypt_key(ctx, length, (const uint8_t *)key);
else
Pike_error("AES: Bad keysize for AES.\n");
}




#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
/* -*- C -*-
 *
 * Cmod header-file acting as a template for the cipher classes.
 */






/* Stream cipher. */

/* Base name of inherited class. */

/* Number of inherits to get to the Nettle_Cipher inherit. */



/* Block cipher with a 16 byte block size. */





/* Block cipher with a block size other than 16 bytes. */






/*! @class AES
*!
*! Implementation of the AES cipher.
*!
*/

#undef class_Nettle_AES_defined
#define class_Nettle_AES_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_AES_program=NULL;

#ifdef Nettle_AES_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_AES_program_fun_num=-1;
#endif /* Nettle_AES_program_fun_num_used */
/*! @decl inherit BlockCipher16
*/

#undef inherit_Nettle_BlockCipher16_Nettle_AES_defined
#define inherit_Nettle_BlockCipher16_Nettle_AES_defined
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static int Nettle_AES_Nettle_BlockCipher16_inh_num = -1;
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static int Nettle_AES_Nettle_BlockCipher16_inh_offset = -1;
#line 43 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static const struct pike_cipher pike_aes =
_PIKE_CIPHER(aes, AES);


#undef internal_init_Nettle_AES_defined
#define internal_init_Nettle_AES_defined

#undef Nettle_AES_event_handler_defined
#define Nettle_AES_event_handler_defined
static void init_Nettle_AES_struct(void)
#line 47 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
struct Nettle_Cipher_struct *cipher;
ASSIGN_CURRENT_STORAGE(cipher, struct Nettle_Cipher_struct,
(BLOCKCIPHER16_CIPHER_INHERIT + 1), Nettle_Cipher_program);
cipher->meta = &pike_aes;
}

/*! @class State
*!
*! State for AES encyption.
*!
*/

#undef class_Nettle_AES_State_defined
#define class_Nettle_AES_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_AES_State_program=NULL;

#ifdef Nettle_AES_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_AES_State_program_fun_num=-1;
#endif /* Nettle_AES_State_program_fun_num_used */
/*! @decl inherit Cipher::State
*/


#undef extra_Nettle_AES_State_defined
#define extra_Nettle_AES_State_defined

#undef var_aes_Nettle_AES_State_defined
#define var_aes_Nettle_AES_State_defined

#undef THIS
#define THIS ((struct Nettle_AES_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_AES_STATE
#define THIS_NETTLE_AES_STATE ((struct Nettle_AES_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_AES_STATE
#define OBJ2_NETTLE_AES_STATE(o) ((struct Nettle_AES_State_struct *)(o->storage+Nettle_AES_State_storage_offset))

#undef GET_NETTLE_AES_STATE_STORAGE
#define GET_NETTLE_AES_STATE_STORAGE(o) ((struct Nettle_AES_State_struct *)(o->storage+Nettle_AES_State_storage_offset)
static ptrdiff_t Nettle_AES_State_storage_offset;
struct Nettle_AES_State_struct {

#ifdef var_aes_Nettle_AES_State_defined
#line 89 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
struct aes_ctx aes;
#endif /* var_aes_Nettle_AES_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_AES_State_struct *Nettle_AES_State_gdb_dummy_ptr;
#endif

#undef internal_init_Nettle_AES_State_defined
#define internal_init_Nettle_AES_State_defined

#undef Nettle_AES_State_event_handler_defined
#define Nettle_AES_State_event_handler_defined
static void init_Nettle_AES_State_struct(void)
#line 92 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
struct Nettle_Cipher_State_struct *state;
ASSIGN_CURRENT_STORAGE(state, struct Nettle_Cipher_State_struct, 1,
Nettle_Cipher_State_program);
state->ctx = &THIS->aes;
}

#ifdef Nettle_AES_State_event_handler_defined
static void Nettle_AES_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_AES_State_defined
  case PROG_EVENT_INIT: init_Nettle_AES_State_struct(); break;

#endif /* internal_init_Nettle_AES_State_defined */
  default: break; 
  }
}

#endif /* Nettle_AES_State_event_handler_defined */
/*! @endclass State
*/


#ifdef Nettle_AES_event_handler_defined
static void Nettle_AES_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_AES_defined
  case PROG_EVENT_INIT: init_Nettle_AES_struct(); break;

#endif /* internal_init_Nettle_AES_defined */
  default: break; 
  }
}

#endif /* Nettle_AES_event_handler_defined */
/*! @endclass AES
*/





#line 111 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#line 4620 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"




#line 4624 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef HAVE_NETTLE_ARCTWO_H

/* NB: Requires Nettle 1.11 or later, which should be fine by now. */
static void pike_arctwo_set_key(void *ctx,
ptrdiff_t length, const char *key,
int ekb)
{
if (!ekb) ekb = 128;

if (length < ARCTWO_MIN_KEY_SIZE || length > ARCTWO_MAX_KEY_SIZE)
Pike_error("ARCTWO: Bad keysize for ARCTWO.\n");

arctwo_set_key_ekb(ctx, length, (const uint8_t *)key, ekb);
}

#define pike_arctwo_set_encrypt_key pike_arctwo_set_key
#define pike_arctwo_set_decrypt_key pike_arctwo_set_key

/*! @class ARCTWO
 *!
 *! Implementation of the ARCTWO cipher.
 *!
 */

#undef class_Nettle_ARCTWO_defined
#define class_Nettle_ARCTWO_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_ARCTWO_program=NULL;

#ifdef Nettle_ARCTWO_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_ARCTWO_program_fun_num=-1;
#endif /* Nettle_ARCTWO_program_fun_num_used */
/*! @decl inherit BlockCipher
   */

#undef inherit_Nettle_BlockCipher_Nettle_ARCTWO_defined
#define inherit_Nettle_BlockCipher_Nettle_ARCTWO_defined
#line 4651 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_ARCTWO_Nettle_BlockCipher_inh_num = -1;
#line 4651 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_ARCTWO_Nettle_BlockCipher_inh_offset = -1;
#line 4653 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static const struct pike_cipher pike_arctwo =
_PIKE_CIPHER(arctwo, ARCTWO);


#undef internal_init_Nettle_ARCTWO_defined
#define internal_init_Nettle_ARCTWO_defined

#undef Nettle_ARCTWO_event_handler_defined
#define Nettle_ARCTWO_event_handler_defined
static void init_Nettle_ARCTWO_struct(void)
#line 4657 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct Nettle_Cipher_struct *cipher;
ASSIGN_CURRENT_STORAGE(cipher, struct Nettle_Cipher_struct,
BLOCKCIPHER_CIPHER_INHERIT + 1,
Nettle_Cipher_program);
cipher->meta = &pike_arctwo;
}

/*! @class State
   *!
   *! State for PIKE_NAME encyption.
   *!
   */

#undef class_Nettle_ARCTWO_State_defined
#define class_Nettle_ARCTWO_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_ARCTWO_State_program=NULL;

#ifdef Nettle_ARCTWO_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_ARCTWO_State_program_fun_num=-1;
#endif /* Nettle_ARCTWO_State_program_fun_num_used */
/*! @decl inherit Cipher::State
     */

#line 4676 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int f_ARCTWO_State_inherited_set_encrypt_key_fun_num = -1;
static int f_ARCTWO_State_inherited_set_decrypt_key_fun_num = -1;


#undef extra_Nettle_ARCTWO_State_defined
#define extra_Nettle_ARCTWO_State_defined

#undef var_arctwo_Nettle_ARCTWO_State_defined
#define var_arctwo_Nettle_ARCTWO_State_defined

#undef THIS
#define THIS ((struct Nettle_ARCTWO_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_ARCTWO_STATE
#define THIS_NETTLE_ARCTWO_STATE ((struct Nettle_ARCTWO_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_ARCTWO_STATE
#define OBJ2_NETTLE_ARCTWO_STATE(o) ((struct Nettle_ARCTWO_State_struct *)(o->storage+Nettle_ARCTWO_State_storage_offset))

#undef GET_NETTLE_ARCTWO_STATE_STORAGE
#define GET_NETTLE_ARCTWO_STATE_STORAGE(o) ((struct Nettle_ARCTWO_State_struct *)(o->storage+Nettle_ARCTWO_State_storage_offset)
static ptrdiff_t Nettle_ARCTWO_State_storage_offset;
struct Nettle_ARCTWO_State_struct {

#ifdef var_arctwo_Nettle_ARCTWO_State_defined
#line 4710 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct arctwo_ctx arctwo;
#endif /* var_arctwo_Nettle_ARCTWO_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_ARCTWO_State_struct *Nettle_ARCTWO_State_gdb_dummy_ptr;
#endif

#undef internal_init_Nettle_ARCTWO_State_defined
#define internal_init_Nettle_ARCTWO_State_defined

#undef Nettle_ARCTWO_State_event_handler_defined
#define Nettle_ARCTWO_State_event_handler_defined
static void init_Nettle_ARCTWO_State_struct(void)
#line 4713 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct Nettle_Cipher_State_struct *state;
ASSIGN_CURRENT_STORAGE(state, struct Nettle_Cipher_State_struct, 1,
Nettle_Cipher_State_program);
state->ctx = &THIS->arctwo;
}

/*! @decl State set_encrypt_key(string(0..255) key, int|void ekb)
     *!
     *! Initializes the object for encryption. The @[key] memory will be
     *! cleared before released.
     *!
     *! @param ekb
     *!   The effective number of bits in the key.
     *!   @int
     *!     @value UNDEFINED
     *!       Derive from the key size (ie @expr{8 * sizeof(key)@}).
     *!     @value 0
     *!       Convenience alias for max (ie @expr{1024@}).
     *!     @value 1..1024
     *!       Reduce the effective key size to the specified number of bits.
     *!   @endint
     *!
     *! @seealso
     *!   @[set_decrypt_key], @[crypt]
     */
#define f_Nettle_ARCTWO_State_set_encrypt_key_defined

#ifdef f_Nettle_ARCTWO_State_set_encrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_ARCTWO_State_set_encrypt_key_fun_num = 0;

#endif /* f_Nettle_ARCTWO_State_set_encrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_ARCTWO_State_set_encrypt_key(INT32 args) {
#line 4739 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 4739 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * ekb;
#line 4739 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_encrypt_key",args,1);
#line 4739 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_encrypt_key",args,2);
#line 4739 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",1,"string(0..255)");
#line 4739 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
#line 4739 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 4739 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_encrypt_key",2,"void|int(0..1024)");
#line 4739 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
ekb=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 4739 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else ekb = NULL;
#line 4742 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
NO_WIDE_STRING(key);
if (!ekb) {
if (args > 1) pop_n_elems(args - 1);
push_int(key->len * 8);
args = 2;
}
apply_current(f_ARCTWO_State_inherited_set_encrypt_key_fun_num, args);
}

}
/*! @decl State set_decrypt_key(string(0..255) key, void|int ekb)
     *!
     *! Initializes the object for decryption. The @[key] memory will be
     *! cleared before released.
     *!
     *! @param ekb
     *!   The effective number of bits in the key.
     *!   @int
     *!     @value UNDEFINED
     *!       Derive from the key size (ie @expr{8 * sizeof(key)@}).
     *!     @value 0
     *!       Convenience alias for max (ie @expr{1024@}).
     *!     @value 1..1024
     *!       Reduce the effective key size to the specified number of bits.
     *!   @endint
     *!
     *! @seealso
     *!   @[set_encrypt_key], @[crypt]
     */
#define f_Nettle_ARCTWO_State_set_decrypt_key_defined

#ifdef f_Nettle_ARCTWO_State_set_decrypt_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_ARCTWO_State_set_decrypt_key_fun_num = 0;

#endif /* f_Nettle_ARCTWO_State_set_decrypt_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_ARCTWO_State_set_decrypt_key(INT32 args) {
#line 4771 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 4771 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct svalue * ekb;
#line 4771 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args < 1) wrong_number_of_args_error("set_decrypt_key",args,1);
#line 4771 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args > 2) wrong_number_of_args_error("set_decrypt_key",args,2);
#line 4771 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-args]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",1,"string(0..255)");
#line 4771 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-args].u.string);
#line 4771 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if ((args > 1) &&
    ((TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) ||
     (SUBTYPEOF(Pike_sp[1-args]) != NUMBER_UNDEFINED))) {
#line 4771 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[1-args]) != PIKE_T_INT) SIMPLE_ARG_TYPE_ERROR("set_decrypt_key",2,"void|int");
#line 4771 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
ekb=Pike_sp+1-args; dmalloc_touch_svalue(Pike_sp+1-args);
#line 4771 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
} else ekb = NULL;
#line 4774 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
NO_WIDE_STRING(key);
if (!ekb) {
if (args > 1) pop_n_elems(args - 1);
push_int(key->len * 8);
args = 2;
}
apply_current(f_ARCTWO_State_inherited_set_decrypt_key_fun_num, args);
}
}

#ifdef Nettle_ARCTWO_State_event_handler_defined
static void Nettle_ARCTWO_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_ARCTWO_State_defined
  case PROG_EVENT_INIT: init_Nettle_ARCTWO_State_struct(); break;

#endif /* internal_init_Nettle_ARCTWO_State_defined */
  default: break; 
  }
}

#endif /* Nettle_ARCTWO_State_event_handler_defined */
/*! @endclass State
   */

#ifdef Nettle_ARCTWO_event_handler_defined
static void Nettle_ARCTWO_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_ARCTWO_defined
  case PROG_EVENT_INIT: init_Nettle_ARCTWO_struct(); break;

#endif /* internal_init_Nettle_ARCTWO_defined */
  default: break; 
  }
}

#endif /* Nettle_ARCTWO_event_handler_defined */
/*! @endclass ARCTWO
 */

#line 4791 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#endif /* HAVE_NETTLE_ARCTWO_H */

static void
pike_arcfour_set_key(void *ctx,
ptrdiff_t length, const char *key,
int UNUSED(force))
{
if (length < ARCFOUR_MIN_KEY_SIZE || length > ARCFOUR_MAX_KEY_SIZE)
Pike_error("ARCFOUR: Bad keysize for ARCFOUR.\n");

arcfour_set_key(ctx, length, (const uint8_t *)key);
}
#define pike_arcfour_set_encrypt_key pike_arcfour_set_key
#define pike_arcfour_set_decrypt_key pike_arcfour_set_key
#define arcfour_encrypt arcfour_crypt
#define arcfour_decrypt arcfour_crypt
#define ARCFOUR_BLOCK_SIZE 1




#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
/* -*- C -*-
 *
 * Cmod header-file acting as a template for the cipher classes.
 */






/* Stream cipher. */

/* Base name of inherited class. */

/* Number of inherits to get to the Nettle_Cipher inherit. */



/* Block cipher with a 16 byte block size. */





/* Block cipher with a block size other than 16 bytes. */






/*! @class ARCFOUR
*!
*! Implementation of the ARCFOUR cipher.
*!
*/

#undef class_Nettle_ARCFOUR_defined
#define class_Nettle_ARCFOUR_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_ARCFOUR_program=NULL;

#ifdef Nettle_ARCFOUR_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_ARCFOUR_program_fun_num=-1;
#endif /* Nettle_ARCFOUR_program_fun_num_used */
/*! @decl inherit Cipher
*/

#undef inherit_Nettle_Cipher_Nettle_ARCFOUR_defined
#define inherit_Nettle_Cipher_Nettle_ARCFOUR_defined
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static int Nettle_ARCFOUR_Nettle_Cipher_inh_num = -1;
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static int Nettle_ARCFOUR_Nettle_Cipher_inh_offset = -1;
#line 43 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static const struct pike_cipher pike_arcfour =
_PIKE_CIPHER(arcfour, ARCFOUR);


#undef internal_init_Nettle_ARCFOUR_defined
#define internal_init_Nettle_ARCFOUR_defined

#undef Nettle_ARCFOUR_event_handler_defined
#define Nettle_ARCFOUR_event_handler_defined
static void init_Nettle_ARCFOUR_struct(void)
#line 47 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
struct Nettle_Cipher_struct *cipher;
ASSIGN_CURRENT_STORAGE(cipher, struct Nettle_Cipher_struct,
1, Nettle_Cipher_program);
cipher->meta = &pike_arcfour;
}

/*! @class State
*!
*! State for ARCFOUR encyption.
*!
*/

#undef class_Nettle_ARCFOUR_State_defined
#define class_Nettle_ARCFOUR_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_ARCFOUR_State_program=NULL;

#ifdef Nettle_ARCFOUR_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_ARCFOUR_State_program_fun_num=-1;
#endif /* Nettle_ARCFOUR_State_program_fun_num_used */
/*! @decl inherit Cipher::State
*/


#undef extra_Nettle_ARCFOUR_State_defined
#define extra_Nettle_ARCFOUR_State_defined

#undef var_arcfour_Nettle_ARCFOUR_State_defined
#define var_arcfour_Nettle_ARCFOUR_State_defined

#undef THIS
#define THIS ((struct Nettle_ARCFOUR_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_ARCFOUR_STATE
#define THIS_NETTLE_ARCFOUR_STATE ((struct Nettle_ARCFOUR_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_ARCFOUR_STATE
#define OBJ2_NETTLE_ARCFOUR_STATE(o) ((struct Nettle_ARCFOUR_State_struct *)(o->storage+Nettle_ARCFOUR_State_storage_offset))

#undef GET_NETTLE_ARCFOUR_STATE_STORAGE
#define GET_NETTLE_ARCFOUR_STATE_STORAGE(o) ((struct Nettle_ARCFOUR_State_struct *)(o->storage+Nettle_ARCFOUR_State_storage_offset)
static ptrdiff_t Nettle_ARCFOUR_State_storage_offset;
struct Nettle_ARCFOUR_State_struct {

#ifdef var_arcfour_Nettle_ARCFOUR_State_defined
#line 89 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
struct arcfour_ctx arcfour;
#endif /* var_arcfour_Nettle_ARCFOUR_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_ARCFOUR_State_struct *Nettle_ARCFOUR_State_gdb_dummy_ptr;
#endif

#undef internal_init_Nettle_ARCFOUR_State_defined
#define internal_init_Nettle_ARCFOUR_State_defined

#undef Nettle_ARCFOUR_State_event_handler_defined
#define Nettle_ARCFOUR_State_event_handler_defined
static void init_Nettle_ARCFOUR_State_struct(void)
#line 92 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
struct Nettle_Cipher_State_struct *state;
ASSIGN_CURRENT_STORAGE(state, struct Nettle_Cipher_State_struct, 1,
Nettle_Cipher_State_program);
state->ctx = &THIS->arcfour;
}

#ifdef Nettle_ARCFOUR_State_event_handler_defined
static void Nettle_ARCFOUR_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_ARCFOUR_State_defined
  case PROG_EVENT_INIT: init_Nettle_ARCFOUR_State_struct(); break;

#endif /* internal_init_Nettle_ARCFOUR_State_defined */
  default: break; 
  }
}

#endif /* Nettle_ARCFOUR_State_event_handler_defined */
/*! @endclass State
*/


#ifdef Nettle_ARCFOUR_event_handler_defined
static void Nettle_ARCFOUR_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_ARCFOUR_defined
  case PROG_EVENT_INIT: init_Nettle_ARCFOUR_struct(); break;

#endif /* internal_init_Nettle_ARCFOUR_defined */
  default: break; 
  }
}

#endif /* Nettle_ARCFOUR_event_handler_defined */
/*! @endclass ARCFOUR
*/





#line 111 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#line 4812 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"




#line 4816 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef HAVE_NETTLE_BLOWFISH_DECRYPT

static void
pike_blowfish_set_key(void *ctx,
ptrdiff_t length, const char *key,
int UNUSED(force))
{
if (length < BLOWFISH_MIN_KEY_SIZE || length > BLOWFISH_MAX_KEY_SIZE)
Pike_error("BLOWFISH: Bad keysize for BLOWFISH.\n");
if (!blowfish_set_key(ctx, length, (const uint8_t *)key))
Pike_error("BLOWFISH: Key is weak (and force flag is currently ignored).\n");
}
#define pike_blowfish_set_encrypt_key pike_blowfish_set_key
#define pike_blowfish_set_decrypt_key pike_blowfish_set_key




#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
/* -*- C -*-
 *
 * Cmod header-file acting as a template for the cipher classes.
 */






/* Stream cipher. */

/* Base name of inherited class. */

/* Number of inherits to get to the Nettle_Cipher inherit. */



/* Block cipher with a 16 byte block size. */





/* Block cipher with a block size other than 16 bytes. */






/*! @class BLOWFISH
*!
*! Implementation of the BLOWFISH cipher.
*!
*/

#undef class_Nettle_BLOWFISH_defined
#define class_Nettle_BLOWFISH_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BLOWFISH_program=NULL;

#ifdef Nettle_BLOWFISH_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BLOWFISH_program_fun_num=-1;
#endif /* Nettle_BLOWFISH_program_fun_num_used */
/*! @decl inherit BlockCipher
*/

#undef inherit_Nettle_BlockCipher_Nettle_BLOWFISH_defined
#define inherit_Nettle_BlockCipher_Nettle_BLOWFISH_defined
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static int Nettle_BLOWFISH_Nettle_BlockCipher_inh_num = -1;
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static int Nettle_BLOWFISH_Nettle_BlockCipher_inh_offset = -1;
#line 43 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static const struct pike_cipher pike_blowfish =
_PIKE_CIPHER(blowfish, BLOWFISH);


#undef internal_init_Nettle_BLOWFISH_defined
#define internal_init_Nettle_BLOWFISH_defined

#undef Nettle_BLOWFISH_event_handler_defined
#define Nettle_BLOWFISH_event_handler_defined
static void init_Nettle_BLOWFISH_struct(void)
#line 47 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
struct Nettle_Cipher_struct *cipher;
ASSIGN_CURRENT_STORAGE(cipher, struct Nettle_Cipher_struct,
(BLOCKCIPHER_CIPHER_INHERIT + 1), Nettle_Cipher_program);
cipher->meta = &pike_blowfish;
}

/*! @class State
*!
*! State for BLOWFISH encyption.
*!
*/

#undef class_Nettle_BLOWFISH_State_defined
#define class_Nettle_BLOWFISH_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_BLOWFISH_State_program=NULL;

#ifdef Nettle_BLOWFISH_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_BLOWFISH_State_program_fun_num=-1;
#endif /* Nettle_BLOWFISH_State_program_fun_num_used */
/*! @decl inherit Cipher::State
*/


#undef extra_Nettle_BLOWFISH_State_defined
#define extra_Nettle_BLOWFISH_State_defined

#undef var_blowfish_Nettle_BLOWFISH_State_defined
#define var_blowfish_Nettle_BLOWFISH_State_defined

#undef THIS
#define THIS ((struct Nettle_BLOWFISH_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_BLOWFISH_STATE
#define THIS_NETTLE_BLOWFISH_STATE ((struct Nettle_BLOWFISH_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_BLOWFISH_STATE
#define OBJ2_NETTLE_BLOWFISH_STATE(o) ((struct Nettle_BLOWFISH_State_struct *)(o->storage+Nettle_BLOWFISH_State_storage_offset))

#undef GET_NETTLE_BLOWFISH_STATE_STORAGE
#define GET_NETTLE_BLOWFISH_STATE_STORAGE(o) ((struct Nettle_BLOWFISH_State_struct *)(o->storage+Nettle_BLOWFISH_State_storage_offset)
static ptrdiff_t Nettle_BLOWFISH_State_storage_offset;
struct Nettle_BLOWFISH_State_struct {

#ifdef var_blowfish_Nettle_BLOWFISH_State_defined
#line 89 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
struct blowfish_ctx blowfish;
#endif /* var_blowfish_Nettle_BLOWFISH_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_BLOWFISH_State_struct *Nettle_BLOWFISH_State_gdb_dummy_ptr;
#endif

#undef internal_init_Nettle_BLOWFISH_State_defined
#define internal_init_Nettle_BLOWFISH_State_defined

#undef Nettle_BLOWFISH_State_event_handler_defined
#define Nettle_BLOWFISH_State_event_handler_defined
static void init_Nettle_BLOWFISH_State_struct(void)
#line 92 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
struct Nettle_Cipher_State_struct *state;
ASSIGN_CURRENT_STORAGE(state, struct Nettle_Cipher_State_struct, 1,
Nettle_Cipher_State_program);
state->ctx = &THIS->blowfish;
}

#ifdef Nettle_BLOWFISH_State_event_handler_defined
static void Nettle_BLOWFISH_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_BLOWFISH_State_defined
  case PROG_EVENT_INIT: init_Nettle_BLOWFISH_State_struct(); break;

#endif /* internal_init_Nettle_BLOWFISH_State_defined */
  default: break; 
  }
}

#endif /* Nettle_BLOWFISH_State_event_handler_defined */
/*! @endclass State
*/


#ifdef Nettle_BLOWFISH_event_handler_defined
static void Nettle_BLOWFISH_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_BLOWFISH_defined
  case PROG_EVENT_INIT: init_Nettle_BLOWFISH_struct(); break;

#endif /* internal_init_Nettle_BLOWFISH_defined */
  default: break; 
  }
}

#endif /* Nettle_BLOWFISH_event_handler_defined */
/*! @endclass BLOWFISH
*/





#line 111 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#line 4834 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"




#line 4838 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#endif	/* HAVE_NETTLE_BLOWFISH_DECRYPT */

#if !defined(CAMELLIA_KEY_SIZE) && defined(CAMELLIA128_KEY_SIZE)
/* Nettle 3.0.
 *
 * Emulate the previous API where the Camellia variants were joined.
 */

#define CAMELLIA_KEY_SIZE	CAMELLIA256_KEY_SIZE

struct camellia_ctx
{
union {
struct camellia128_ctx ctx128;
struct camellia192_ctx ctx192;
struct camellia256_ctx ctx256;
} u;
unsigned keylen;
};

static void camellia_set_encrypt_key(void *ctx, unsigned len,
const uint8_t *key)
{
struct camellia_ctx *camellia_ctx = ctx;

switch(len) {
case CAMELLIA128_KEY_SIZE:
camellia128_set_encrypt_key(&camellia_ctx->u.ctx128, key);
break;
case CAMELLIA192_KEY_SIZE:
camellia192_set_encrypt_key(&camellia_ctx->u.ctx192, key);
break;
case CAMELLIA256_KEY_SIZE:
camellia256_set_encrypt_key(&camellia_ctx->u.ctx256, key);
break;
default:
Pike_fatal("Invalid keylength for Camellia: %d\n", len);
break;
}
camellia_ctx->keylen = len;
}

static void camellia_set_decrypt_key(void *ctx, unsigned len,
const uint8_t *key)
{
struct camellia_ctx *camellia_ctx = ctx;

switch(len) {
case CAMELLIA128_KEY_SIZE:
camellia128_set_decrypt_key(&camellia_ctx->u.ctx128, key);
break;
case CAMELLIA192_KEY_SIZE:
camellia192_set_decrypt_key(&camellia_ctx->u.ctx192, key);
break;
case CAMELLIA256_KEY_SIZE:
camellia256_set_decrypt_key(&camellia_ctx->u.ctx256, key);
break;
default:
Pike_fatal("Invalid keylength for Camellia: %d\n", len);
break;
}
camellia_ctx->keylen = len;
}

static void camellia_crypt(struct camellia_ctx *ctx, unsigned length,
uint8_t *dst, const uint8_t *src)
{
switch(ctx->keylen) {
case CAMELLIA128_KEY_SIZE:
camellia128_crypt(&ctx->u.ctx128, length, dst, src);
break;
case CAMELLIA192_KEY_SIZE:
camellia192_crypt(&ctx->u.ctx192, length, dst, src);
break;
case 0:
case CAMELLIA256_KEY_SIZE:
camellia256_crypt(&ctx->u.ctx256, length, dst, src);
break;
default:
Pike_fatal("Invalid keylength for Camellia: %d\n", ctx->keylen);
break;
}
}

#endif

#ifdef CAMELLIA_KEY_SIZE

#ifndef CAMELLIA128_KEY_SIZE
#define CAMELLIA128_KEY_SIZE	16
#endif
#ifndef CAMELLIA192_KEY_SIZE
#define CAMELLIA192_KEY_SIZE	24
#endif
#ifndef CAMELLIA256_KEY_SIZE
#define CAMELLIA256_KEY_SIZE	32
#endif

static void
pike_camellia_set_encrypt_key(void *ctx,
ptrdiff_t length, const char *key,
int UNUSED(force))
{
if (length != CAMELLIA128_KEY_SIZE &&
length != CAMELLIA256_KEY_SIZE &&
length != CAMELLIA192_KEY_SIZE)
Pike_error("CAMELLIA: Bad keysize for CAMELLIA.\n");
camellia_set_encrypt_key(ctx, length, (const uint8_t *)key);
}

static void
pike_camellia_set_decrypt_key(void *ctx,
ptrdiff_t length, const char *key,
int UNUSED(force))
{
if (length != CAMELLIA128_KEY_SIZE &&
length != CAMELLIA256_KEY_SIZE &&
length != CAMELLIA192_KEY_SIZE)
Pike_error("CAMELLIA: Bad keysize for CAMELLIA.\n");
camellia_set_decrypt_key(ctx, length, (const uint8_t *)key);
}

#define camellia_encrypt camellia_crypt
#define camellia_decrypt camellia_crypt




#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
/* -*- C -*-
 *
 * Cmod header-file acting as a template for the cipher classes.
 */






/* Stream cipher. */

/* Base name of inherited class. */

/* Number of inherits to get to the Nettle_Cipher inherit. */



/* Block cipher with a 16 byte block size. */





/* Block cipher with a block size other than 16 bytes. */






/*! @class CAMELLIA
*!
*! Implementation of the CAMELLIA cipher.
*!
*/

#undef class_Nettle_CAMELLIA_defined
#define class_Nettle_CAMELLIA_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_CAMELLIA_program=NULL;

#ifdef Nettle_CAMELLIA_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_CAMELLIA_program_fun_num=-1;
#endif /* Nettle_CAMELLIA_program_fun_num_used */
/*! @decl inherit BlockCipher16
*/

#undef inherit_Nettle_BlockCipher16_Nettle_CAMELLIA_defined
#define inherit_Nettle_BlockCipher16_Nettle_CAMELLIA_defined
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static int Nettle_CAMELLIA_Nettle_BlockCipher16_inh_num = -1;
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static int Nettle_CAMELLIA_Nettle_BlockCipher16_inh_offset = -1;
#line 43 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static const struct pike_cipher pike_camellia =
_PIKE_CIPHER(camellia, CAMELLIA);


#undef internal_init_Nettle_CAMELLIA_defined
#define internal_init_Nettle_CAMELLIA_defined

#undef Nettle_CAMELLIA_event_handler_defined
#define Nettle_CAMELLIA_event_handler_defined
static void init_Nettle_CAMELLIA_struct(void)
#line 47 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
struct Nettle_Cipher_struct *cipher;
ASSIGN_CURRENT_STORAGE(cipher, struct Nettle_Cipher_struct,
(BLOCKCIPHER16_CIPHER_INHERIT + 1), Nettle_Cipher_program);
cipher->meta = &pike_camellia;
}

/*! @class State
*!
*! State for CAMELLIA encyption.
*!
*/

#undef class_Nettle_CAMELLIA_State_defined
#define class_Nettle_CAMELLIA_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_CAMELLIA_State_program=NULL;

#ifdef Nettle_CAMELLIA_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_CAMELLIA_State_program_fun_num=-1;
#endif /* Nettle_CAMELLIA_State_program_fun_num_used */
/*! @decl inherit Cipher::State
*/


#undef extra_Nettle_CAMELLIA_State_defined
#define extra_Nettle_CAMELLIA_State_defined

#undef var_camellia_Nettle_CAMELLIA_State_defined
#define var_camellia_Nettle_CAMELLIA_State_defined

#undef THIS
#define THIS ((struct Nettle_CAMELLIA_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_CAMELLIA_STATE
#define THIS_NETTLE_CAMELLIA_STATE ((struct Nettle_CAMELLIA_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_CAMELLIA_STATE
#define OBJ2_NETTLE_CAMELLIA_STATE(o) ((struct Nettle_CAMELLIA_State_struct *)(o->storage+Nettle_CAMELLIA_State_storage_offset))

#undef GET_NETTLE_CAMELLIA_STATE_STORAGE
#define GET_NETTLE_CAMELLIA_STATE_STORAGE(o) ((struct Nettle_CAMELLIA_State_struct *)(o->storage+Nettle_CAMELLIA_State_storage_offset)
static ptrdiff_t Nettle_CAMELLIA_State_storage_offset;
struct Nettle_CAMELLIA_State_struct {

#ifdef var_camellia_Nettle_CAMELLIA_State_defined
#line 89 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
struct camellia_ctx camellia;
#endif /* var_camellia_Nettle_CAMELLIA_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_CAMELLIA_State_struct *Nettle_CAMELLIA_State_gdb_dummy_ptr;
#endif

#undef internal_init_Nettle_CAMELLIA_State_defined
#define internal_init_Nettle_CAMELLIA_State_defined

#undef Nettle_CAMELLIA_State_event_handler_defined
#define Nettle_CAMELLIA_State_event_handler_defined
static void init_Nettle_CAMELLIA_State_struct(void)
#line 92 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
struct Nettle_Cipher_State_struct *state;
ASSIGN_CURRENT_STORAGE(state, struct Nettle_Cipher_State_struct, 1,
Nettle_Cipher_State_program);
state->ctx = &THIS->camellia;
}

#ifdef Nettle_CAMELLIA_State_event_handler_defined
static void Nettle_CAMELLIA_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_CAMELLIA_State_defined
  case PROG_EVENT_INIT: init_Nettle_CAMELLIA_State_struct(); break;

#endif /* internal_init_Nettle_CAMELLIA_State_defined */
  default: break; 
  }
}

#endif /* Nettle_CAMELLIA_State_event_handler_defined */
/*! @endclass State
*/


#ifdef Nettle_CAMELLIA_event_handler_defined
static void Nettle_CAMELLIA_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_CAMELLIA_defined
  case PROG_EVENT_INIT: init_Nettle_CAMELLIA_struct(); break;

#endif /* internal_init_Nettle_CAMELLIA_defined */
  default: break; 
  }
}

#endif /* Nettle_CAMELLIA_event_handler_defined */
/*! @endclass CAMELLIA
*/





#line 111 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#line 4966 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"




#line 4970 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#endif	/* CAMELLIA_KEY_SIZE */

static void
pike_cast128_set_key(void *ctx,
ptrdiff_t length, const char *key,
int UNUSED(force))
{
#ifdef CAST5_MIN_KEY_SIZE
 if (length < CAST5_MIN_KEY_SIZE || length > CAST5_MAX_KEY_SIZE)
Pike_error("CAST128_info: Bad keysize for CAST128.\n");

cast5_set_key(ctx, length, (const uint8_t *)key);
#else
 if (length < CAST128_MIN_KEY_SIZE || length > CAST128_MAX_KEY_SIZE)
Pike_error("CAST128_info: Bad keysize for CAST128.\n");

cast128_set_key(ctx, length, (const uint8_t *)key);
#endif
}
#define pike_cast128_set_encrypt_key pike_cast128_set_key
#define pike_cast128_set_decrypt_key pike_cast128_set_key




#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
/* -*- C -*-
 *
 * Cmod header-file acting as a template for the cipher classes.
 */






/* Stream cipher. */

/* Base name of inherited class. */

/* Number of inherits to get to the Nettle_Cipher inherit. */



/* Block cipher with a 16 byte block size. */





/* Block cipher with a block size other than 16 bytes. */






/*! @class CAST128
*!
*! Implementation of the CAST128 cipher.
*!
*/

#undef class_Nettle_CAST128_defined
#define class_Nettle_CAST128_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_CAST128_program=NULL;

#ifdef Nettle_CAST128_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_CAST128_program_fun_num=-1;
#endif /* Nettle_CAST128_program_fun_num_used */
/*! @decl inherit BlockCipher
*/

#undef inherit_Nettle_BlockCipher_Nettle_CAST128_defined
#define inherit_Nettle_BlockCipher_Nettle_CAST128_defined
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static int Nettle_CAST128_Nettle_BlockCipher_inh_num = -1;
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static int Nettle_CAST128_Nettle_BlockCipher_inh_offset = -1;
#line 43 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static const struct pike_cipher pike_cast128 =
_PIKE_CIPHER(cast128, CAST128);


#undef internal_init_Nettle_CAST128_defined
#define internal_init_Nettle_CAST128_defined

#undef Nettle_CAST128_event_handler_defined
#define Nettle_CAST128_event_handler_defined
static void init_Nettle_CAST128_struct(void)
#line 47 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
struct Nettle_Cipher_struct *cipher;
ASSIGN_CURRENT_STORAGE(cipher, struct Nettle_Cipher_struct,
(BLOCKCIPHER_CIPHER_INHERIT + 1), Nettle_Cipher_program);
cipher->meta = &pike_cast128;
}

/*! @class State
*!
*! State for CAST128 encyption.
*!
*/

#undef class_Nettle_CAST128_State_defined
#define class_Nettle_CAST128_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_CAST128_State_program=NULL;

#ifdef Nettle_CAST128_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_CAST128_State_program_fun_num=-1;
#endif /* Nettle_CAST128_State_program_fun_num_used */
/*! @decl inherit Cipher::State
*/


#undef extra_Nettle_CAST128_State_defined
#define extra_Nettle_CAST128_State_defined

#undef var_cast128_Nettle_CAST128_State_defined
#define var_cast128_Nettle_CAST128_State_defined

#undef THIS
#define THIS ((struct Nettle_CAST128_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_CAST128_STATE
#define THIS_NETTLE_CAST128_STATE ((struct Nettle_CAST128_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_CAST128_STATE
#define OBJ2_NETTLE_CAST128_STATE(o) ((struct Nettle_CAST128_State_struct *)(o->storage+Nettle_CAST128_State_storage_offset))

#undef GET_NETTLE_CAST128_STATE_STORAGE
#define GET_NETTLE_CAST128_STATE_STORAGE(o) ((struct Nettle_CAST128_State_struct *)(o->storage+Nettle_CAST128_State_storage_offset)
static ptrdiff_t Nettle_CAST128_State_storage_offset;
struct Nettle_CAST128_State_struct {

#ifdef var_cast128_Nettle_CAST128_State_defined
#line 89 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
struct cast128_ctx cast128;
#endif /* var_cast128_Nettle_CAST128_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_CAST128_State_struct *Nettle_CAST128_State_gdb_dummy_ptr;
#endif

#undef internal_init_Nettle_CAST128_State_defined
#define internal_init_Nettle_CAST128_State_defined

#undef Nettle_CAST128_State_event_handler_defined
#define Nettle_CAST128_State_event_handler_defined
static void init_Nettle_CAST128_State_struct(void)
#line 92 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
struct Nettle_Cipher_State_struct *state;
ASSIGN_CURRENT_STORAGE(state, struct Nettle_Cipher_State_struct, 1,
Nettle_Cipher_State_program);
state->ctx = &THIS->cast128;
}

#ifdef Nettle_CAST128_State_event_handler_defined
static void Nettle_CAST128_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_CAST128_State_defined
  case PROG_EVENT_INIT: init_Nettle_CAST128_State_struct(); break;

#endif /* internal_init_Nettle_CAST128_State_defined */
  default: break; 
  }
}

#endif /* Nettle_CAST128_State_event_handler_defined */
/*! @endclass State
*/


#ifdef Nettle_CAST128_event_handler_defined
static void Nettle_CAST128_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_CAST128_defined
  case PROG_EVENT_INIT: init_Nettle_CAST128_struct(); break;

#endif /* internal_init_Nettle_CAST128_defined */
  default: break; 
  }
}

#endif /* Nettle_CAST128_event_handler_defined */
/*! @endclass CAST128
*/





#line 111 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#line 4995 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"




#line 4999 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef HAVE_NETTLE_CHACHA_H

static void
pike_chacha_set_key(void *ctx,
ptrdiff_t length, const char *key,
int UNUSED(force))
{
if (length != CHACHA_KEY_SIZE)
Pike_error("CHACHA: Bad keysize for CHACHA.\n");

chacha_set_key(ctx, (const uint8_t *)key);
}

#define pike_chacha_set_encrypt_key pike_chacha_set_key
#define pike_chacha_set_decrypt_key pike_chacha_set_key
#define chacha_encrypt chacha_crypt
#define chacha_decrypt chacha_crypt

/*! @class CHACHA
 *!
 *! Implementation of the CHACHA stream cipher.
 *!
 *! @note
 *!   Note that this class is not available in all versions of Nettle.
 *!
 */

#undef class_Nettle_CHACHA_defined
#define class_Nettle_CHACHA_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_CHACHA_program=NULL;

#ifdef Nettle_CHACHA_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_CHACHA_program_fun_num=-1;
#endif /* Nettle_CHACHA_program_fun_num_used */
/*! @decl inherit BlockCipher
   */

#undef inherit_Nettle_BlockCipher_Nettle_CHACHA_defined
#define inherit_Nettle_BlockCipher_Nettle_CHACHA_defined
#line 5029 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_CHACHA_Nettle_BlockCipher_inh_num = -1;
#line 5029 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_CHACHA_Nettle_BlockCipher_inh_offset = -1;
#line 5031 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static const struct pike_cipher pike_chacha =
_PIKE_CIPHER(chacha, CHACHA);


#undef internal_init_Nettle_CHACHA_defined
#define internal_init_Nettle_CHACHA_defined

#undef Nettle_CHACHA_event_handler_defined
#define Nettle_CHACHA_event_handler_defined
static void init_Nettle_CHACHA_struct(void)
#line 5035 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct Nettle_Cipher_struct *cipher;
ASSIGN_CURRENT_STORAGE(cipher, struct Nettle_Cipher_struct,
BLOCKCIPHER_CIPHER_INHERIT + 1,
Nettle_Cipher_program);
cipher->meta = &pike_chacha;
}

/*! @class State
   *!
   *! State for CHACHA encyption.
   *!
   */

#undef class_Nettle_CHACHA_State_defined
#define class_Nettle_CHACHA_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_CHACHA_State_program=NULL;

#ifdef Nettle_CHACHA_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_CHACHA_State_program_fun_num=-1;
#endif /* Nettle_CHACHA_State_program_fun_num_used */
/*! @decl inherit Cipher::State
     */


#undef extra_Nettle_CHACHA_State_defined
#define extra_Nettle_CHACHA_State_defined

#undef var_chacha_Nettle_CHACHA_State_defined
#define var_chacha_Nettle_CHACHA_State_defined

#undef THIS
#define THIS ((struct Nettle_CHACHA_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_CHACHA_STATE
#define THIS_NETTLE_CHACHA_STATE ((struct Nettle_CHACHA_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_CHACHA_STATE
#define OBJ2_NETTLE_CHACHA_STATE(o) ((struct Nettle_CHACHA_State_struct *)(o->storage+Nettle_CHACHA_State_storage_offset))

#undef GET_NETTLE_CHACHA_STATE_STORAGE
#define GET_NETTLE_CHACHA_STATE_STORAGE(o) ((struct Nettle_CHACHA_State_struct *)(o->storage+Nettle_CHACHA_State_storage_offset)
static ptrdiff_t Nettle_CHACHA_State_storage_offset;
struct Nettle_CHACHA_State_struct {

#ifdef var_chacha_Nettle_CHACHA_State_defined
#line 5079 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct chacha_ctx chacha;
#endif /* var_chacha_Nettle_CHACHA_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_CHACHA_State_struct *Nettle_CHACHA_State_gdb_dummy_ptr;
#endif
/*! @decl string(0..255) crypt(string(0..255) data)
     *!
     *! Encrypts or decrypts data, using the current key. Neither the
     *! input nor output data is automatically memory scrubbed,
     *! unless @[String.secure] has been called on them.
     *!
     *! @param data
     *!   Usually an integral number of blocks, except for the last
     *!   segement in a run. The decoder must get partial blocks
     *!   at the same places as the encoder, otherwise they will get
     *!   out of sync.
     *!
     *! @returns
     *!   The encrypted or decrypted data.
     */
#define f_Nettle_CHACHA_State_crypt_defined

#ifdef f_Nettle_CHACHA_State_crypt_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_CHACHA_State_crypt_fun_num = 0;

#endif /* f_Nettle_CHACHA_State_crypt_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_CHACHA_State_crypt(INT32 args) {
#line 5096 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * data;
#line 5096 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("crypt",args,1);
#line 5096 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("crypt",1,"string(0..255)");
#line 5096 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(data=Pike_sp[0-1].u.string);
#line 5098 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct pike_string *s;

NO_WIDE_STRING(data);

/* NB: Differs from default in that the block size
       *     isn't enforced.
       *
       * To simplify the code we also skip the indirection
       * via the Cipher class and its State.
       */

s = begin_shared_string(data->len);
chacha_crypt(&THIS->chacha, data->len, (uint8_t *)s->str,
(const uint8_t *)data->str);
s = end_shared_string(s);
push_string(s);
}

}
/*! @decl object set_iv(string(0..255) iv)
     *!
     *! Set the initialization vector (aka nonce) and reset
     *! the block counter to zero.
     *!
     *! @param iv
     *!   An 8-byte long string which is only to be used
     *!   once for every key.
     *!
     *! @note
     *!   This function MUST be called in addition to
     *!   @[set_encrypt_key()] or @[set_decrypt_key()].
     *!
     *! @note
     *!   The same @[iv] should NEVER be reused with the same key!
     */
#define f_Nettle_CHACHA_State_set_iv_defined

#ifdef f_Nettle_CHACHA_State_set_iv_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_CHACHA_State_set_iv_fun_num = 0;

#endif /* f_Nettle_CHACHA_State_set_iv_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_CHACHA_State_set_iv(INT32 args) {
#line 5133 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * iv;
#line 5133 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("set_iv",args,1);
#line 5133 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_iv",1,"string(0..255)");
#line 5133 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(iv=Pike_sp[0-1].u.string);
#line 5135 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
NO_WIDE_STRING(iv);
if (iv->len != CHACHA_NONCE_SIZE)
Pike_error("CHACHA IV needs to be %d bytes.\n", CHACHA_NONCE_SIZE);
iv->flags |= STRING_CLEAR_ON_EXIT;
chacha_set_nonce(&THIS->chacha, STR0(iv));
push_object(this_object());
}

}

#undef internal_init_Nettle_CHACHA_State_defined
#define internal_init_Nettle_CHACHA_State_defined

#undef Nettle_CHACHA_State_event_handler_defined
#define Nettle_CHACHA_State_event_handler_defined
static void init_Nettle_CHACHA_State_struct(void)
#line 5145 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct Nettle_Cipher_State_struct *state;
ASSIGN_CURRENT_STORAGE(state, struct Nettle_Cipher_State_struct, 1,
Nettle_Cipher_State_program);
state->ctx = &THIS->chacha;
}

#ifdef Nettle_CHACHA_State_event_handler_defined
static void Nettle_CHACHA_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_CHACHA_State_defined
  case PROG_EVENT_INIT: init_Nettle_CHACHA_State_struct(); break;

#endif /* internal_init_Nettle_CHACHA_State_defined */
  default: break; 
  }
}

#endif /* Nettle_CHACHA_State_event_handler_defined */
/*! @endclass State
   */


#ifdef Nettle_CHACHA_event_handler_defined
static void Nettle_CHACHA_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_CHACHA_defined
  case PROG_EVENT_INIT: init_Nettle_CHACHA_struct(); break;

#endif /* internal_init_Nettle_CHACHA_defined */
  default: break; 
  }
}

#endif /* Nettle_CHACHA_event_handler_defined */
/*! @endclass CHACHA
 */

#line 5160 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#endif /* HAVE_NETTLE_CHACHA_H */

static void
pike_des_set_key(void *c,
ptrdiff_t length, const char *key,
int force)
{
struct des_ctx *ctx = (struct des_ctx *) c;
if (length != 8)
Pike_error("DES_INFO: Bad keysize for DES.\n");

if (!des_set_key(ctx, (const uint8_t *)key))
{
#ifndef DES_WEAK_KEY
 /* Nettle 2.1 and later. */
if (!force)
Pike_error("DES_INFO: Key is weak.\n");
#else
 /* Nettle 2.0 and earlier. */
switch (ctx->status)
{
case DES_WEAK_KEY:
if (force)
/* Use key anyway */
ctx->status = DES_OK;
else
Pike_error("DES_INFO: Key is weak.\n");
break;

case DES_BAD_PARITY:
Pike_error("DES_INFO: Key has bad parity.\n");
default:
Pike_error("DES_INFO: Unexpected error, please send a bug report.\n");
}
#endif
 }
}

#define pike_des_set_encrypt_key pike_des_set_key
#define pike_des_set_decrypt_key pike_des_set_key

/*! @class DES
 *!
 *! Implementation of the Data Encryption Standard (DES) crypto algorithm.
 *!
 */

#undef class_Nettle_DES_defined
#define class_Nettle_DES_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_DES_program=NULL;

#ifdef Nettle_DES_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_DES_program_fun_num=-1;
#endif /* Nettle_DES_program_fun_num_used */
/*! @decl inherit BlockCipher
   */

#undef inherit_Nettle_BlockCipher_Nettle_DES_defined
#define inherit_Nettle_BlockCipher_Nettle_DES_defined
#line 5210 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_DES_Nettle_BlockCipher_inh_num = -1;
#line 5210 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_DES_Nettle_BlockCipher_inh_offset = -1;

#undef internal_init_Nettle_DES_defined
#define internal_init_Nettle_DES_defined

#undef Nettle_DES_event_handler_defined
#define Nettle_DES_event_handler_defined
static void init_Nettle_DES_struct(void)
#line 5213 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
static const struct pike_cipher pike_des = _PIKE_CIPHER(des, DES);
/* FIXME: Ought to traverse the inherit graph for
       *        the current program.
       */
struct Nettle_Cipher_struct *cipher;
ASSIGN_CURRENT_STORAGE(cipher, struct Nettle_Cipher_struct,
BLOCKCIPHER_CIPHER_INHERIT + 1,
Nettle_Cipher_program);
cipher->meta = &pike_des;
}

/*! @decl string(0..255) fix_parity(string(0..255) key)
   *! Sets the last bit in every byte in @[key] to reflect the parity.
   *! If a seven byte key is used, it will be expanded into eight
   *! bytes. If a key longer than eight characters is used, it will
   *! be truncated to eight characters.
   */
#define f_Nettle_DES_fix_parity_defined

#ifdef f_Nettle_DES_fix_parity_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_DES_fix_parity_fun_num = 0;

#endif /* f_Nettle_DES_fix_parity_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_DES_fix_parity(INT32 args) {
#line 5231 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 5231 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("fix_parity",args,1);
#line 5231 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("fix_parity",1,"string(0..255)");
#line 5231 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-1].u.string);
{
uint8_t buf[8];

NO_WIDE_STRING(key);

if(key->len < 7)
Pike_error("Key must be at least 7 characters.\n");

if(key->len == 7) {
buf[0] = key->str[0]&254;
buf[1] = (key->str[0]&1)<<7 | (key->str[1]>>1 & 126);
buf[2] = (key->str[1]&3)<<6 | (key->str[2]>>2 & 62);
buf[3] = (key->str[2]&7)<<5 | (key->str[3]>>3 & 30);
buf[4] = (key->str[3]&15)<<4 | (key->str[4]>>4 & 14);
buf[5] = (key->str[4]&31)<<3 | (key->str[5]>>5 & 6);
buf[6] = (key->str[5]&63)<<2 | (key->str[6]>>6 & 2);
buf[7] = (key->str[6]&127)<<1;
}
else
memcpy(buf, key->str, 8);

des_fix_parity(8, buf, buf);
do { struct pike_string * ret_=(make_shared_binary_string((char *)buf, 8)); pop_stack(); push_string(ret_); return; }while(0);
#line 5255 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
}

}
/*! @class State
   *!
   *! State for DES encyption
   */

#undef class_Nettle_DES_State_defined
#define class_Nettle_DES_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_DES_State_program=NULL;

#ifdef Nettle_DES_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_DES_State_program_fun_num=-1;
#endif /* Nettle_DES_State_program_fun_num_used */
/*! @decl inherit Cipher::State
*/


#undef extra_Nettle_DES_State_defined
#define extra_Nettle_DES_State_defined

#undef var_des_Nettle_DES_State_defined
#define var_des_Nettle_DES_State_defined

#undef THIS
#define THIS ((struct Nettle_DES_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_DES_STATE
#define THIS_NETTLE_DES_STATE ((struct Nettle_DES_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_DES_STATE
#define OBJ2_NETTLE_DES_STATE(o) ((struct Nettle_DES_State_struct *)(o->storage+Nettle_DES_State_storage_offset))

#undef GET_NETTLE_DES_STATE_STORAGE
#define GET_NETTLE_DES_STATE_STORAGE(o) ((struct Nettle_DES_State_struct *)(o->storage+Nettle_DES_State_storage_offset)
static ptrdiff_t Nettle_DES_State_storage_offset;
struct Nettle_DES_State_struct {

#ifdef var_des_Nettle_DES_State_defined
#line 5292 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct des_ctx des;
#endif /* var_des_Nettle_DES_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_DES_State_struct *Nettle_DES_State_gdb_dummy_ptr;
#endif

#undef internal_init_Nettle_DES_State_defined
#define internal_init_Nettle_DES_State_defined

#undef Nettle_DES_State_event_handler_defined
#define Nettle_DES_State_event_handler_defined
static void init_Nettle_DES_State_struct(void)
#line 5295 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct Nettle_Cipher_State_struct *state;
ASSIGN_CURRENT_STORAGE(state, struct Nettle_Cipher_State_struct, 1,
Nettle_Cipher_State_program);
state->ctx = &THIS->des;
}

#define f_Nettle_DES_State_make_key_defined

#ifdef f_Nettle_DES_State_make_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_DES_State_make_key_fun_num = 0;

#endif /* f_Nettle_DES_State_make_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_DES_State_make_key(INT32 args) {
#line 5302 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("make_key",args,0);
{
struct Nettle_Cipher_struct *info = GET_INFO();
struct Nettle_Cipher_State_struct *state;
ASSIGN_CURRENT_STORAGE(state, struct Nettle_Cipher_State_struct, 1,
Nettle_Cipher_State_program);
assert(info);

#ifndef DES_WEAK_KEY
 /* NB: This loop temporarily leaks strings on the stack,
       *     but we don't care, as it is a low probability,
       *     and they will be cleaned up on return.
       */
do {
low_make_key(info->meta->key_size);
f_Nettle_DES_fix_parity(1);
} while( !des_set_key(state->ctx,
(const uint8_t *)Pike_sp[-1].u.string->str) );
#else
 low_make_key(info->meta->key_size);
f_Nettle_DES_fix_parity(1);

info->meta->set_encrypt_key(state->ctx, Pike_sp[-1].u.string->len,
Pike_sp[-1].u.string->str, 0);
#endif

Pike_sp[-1].u.string->flags |= STRING_CLEAR_ON_EXIT;
state->crypt = info->meta->encrypt;
state->key_size = Pike_sp[-1].u.string->len;
}

}
/*! @decl string(0..255) fix_parity(string(0..255) key)
     *! Sets the last bit in every byte in @[key] to reflect the parity.
     *! If a seven byte key is used, it will be expanded into eight
     *! bytes. If a key longer than eight characters is used, it will
     *! be truncated to eight characters.
     */
#define f_Nettle_DES_State_fix_parity_defined

#ifdef f_Nettle_DES_State_fix_parity_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_DES_State_fix_parity_fun_num = 0;

#endif /* f_Nettle_DES_State_fix_parity_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_DES_State_fix_parity(INT32 args) {
#line 5339 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 5339 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("fix_parity",args,1);
#line 5339 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("fix_parity",1,"string(0..255)");
#line 5339 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-1].u.string);
{
apply_external(1, f_Nettle_DES_fix_parity_fun_num, args);
}
}

#ifdef Nettle_DES_State_event_handler_defined
static void Nettle_DES_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_DES_State_defined
  case PROG_EVENT_INIT: init_Nettle_DES_State_struct(); break;

#endif /* internal_init_Nettle_DES_State_defined */
  default: break; 
  }
}

#endif /* Nettle_DES_State_event_handler_defined */
/*! @endclass State */


#ifdef Nettle_DES_event_handler_defined
static void Nettle_DES_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_DES_defined
  case PROG_EVENT_INIT: init_Nettle_DES_struct(); break;

#endif /* internal_init_Nettle_DES_defined */
  default: break; 
  }
}

#endif /* Nettle_DES_event_handler_defined */
/*! @endclass DES */

#line 5349 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
DEFAULT_CMOD_STORAGE void f_Nettle_DES3_fix_parity(INT32);

static void
pike_des3_set_key(void *c,
ptrdiff_t length, const char *key,
int force)
{
struct des3_ctx *ctx = (struct des3_ctx *) c;
int i;
char nkotb[24];

switch( length ) {
case 7+7:
push_string(make_shared_binary_string(key, length));
push_text("1234567");
f_add(2);
f_Nettle_DES3_fix_parity(1);

memcpy(nkotb, Pike_sp[-1].u.string->str, 8+8);
pop_stack();

key = nkotb;
length = 8+8;
/* fallthrough */
case 8+8:
push_string(make_shared_binary_string(key, length));
push_string(make_shared_binary_string(key, length));
push_int(0);
push_int(7);
o_range();
f_add(2);

memcpy(nkotb, Pike_sp[-1].u.string->str, 8+8+8);
pop_stack();

key = nkotb;
length = 8+8+8;
break;

case 7+7+7:
push_string(make_shared_binary_string(key, length));
f_Nettle_DES3_fix_parity(1);
memcpy(nkotb, Pike_sp[-1].u.string->str, 8+8+8);
pop_stack();

key = nkotb;
length = 8+8+8;
break;

case 8+8+8:
break;

default:
Pike_error("DES3_INFO: Bad keysize for DES3.\n");
break;
}

#ifndef DES_WEAK_KEY
 if( !des3_set_key(ctx, (const uint8_t *)key) && !force )
Pike_error("DES3_INFO: Key is weak.\n");
#else
 /* The hack of resetting ctx->status to use a weak key doesn't
   * currently work with nettle's des3_set_key function. So we set the
   * individual keys by ourself. */
for (i = 0; i<3; i++, key += DES_KEY_SIZE)
if (!des_set_key(&ctx->des[i], (const uint8_t *)key))
{
/* Nettle 2.0 and earlier. */
switch (ctx->des[i].status)
{
case DES_WEAK_KEY:
if (force)
/* Use key anyway */
ctx->des[i].status = DES_OK;
else
Pike_error("DES3_INFO: Key is weak.\n");
break;

case DES_BAD_PARITY:
Pike_error("DES3_INFO: Key has bad parity.\n");
default:
Pike_error("DES3_INFO: Unexpected error, please send a bug report.\n");
}
}
#endif
}
#define pike_des3_set_encrypt_key pike_des3_set_key
#define pike_des3_set_decrypt_key pike_des3_set_key


/*! @class DES3
 *!
 *! Implementation of the DES3 cipher algorithm.
 *!
 */

#undef class_Nettle_DES3_defined
#define class_Nettle_DES3_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_DES3_program=NULL;

#ifdef Nettle_DES3_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_DES3_program_fun_num=-1;
#endif /* Nettle_DES3_program_fun_num_used */
/*! @decl inherit BlockCipher
   */

#undef inherit_Nettle_BlockCipher_Nettle_DES3_defined
#define inherit_Nettle_BlockCipher_Nettle_DES3_defined
#line 5448 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_DES3_Nettle_BlockCipher_inh_num = -1;
#line 5448 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_DES3_Nettle_BlockCipher_inh_offset = -1;

#undef internal_init_Nettle_DES3_defined
#define internal_init_Nettle_DES3_defined

#undef Nettle_DES3_event_handler_defined
#define Nettle_DES3_event_handler_defined
static void init_Nettle_DES3_struct(void)
#line 5451 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
static const struct pike_cipher pike_des3 = _PIKE_CIPHER(des3, DES3);
/* FIXME: Ought to traverse the inherit graph for
       *        the current program.
       */
struct Nettle_Cipher_struct *cipher;
ASSIGN_CURRENT_STORAGE(cipher, struct Nettle_Cipher_struct,
BLOCKCIPHER_CIPHER_INHERIT + 1,
Nettle_Cipher_program);
cipher->meta = &pike_des3;
}

/*! @decl string(0..255) fix_parity(string(0..255) key)
   *! Sets the last bit in every byte in @[key] to reflect the parity.
   *! If a 21 byte key is used, it will be expanded into 24
   *! bytes. If a key longer than 24 characters is used, it will
   *! be truncated to 24 characters.
   */
#define f_Nettle_DES3_fix_parity_defined

#ifdef f_Nettle_DES3_fix_parity_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_DES3_fix_parity_fun_num = 0;

#endif /* f_Nettle_DES3_fix_parity_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_DES3_fix_parity(INT32 args) {
#line 5469 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * key;
#line 5469 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("fix_parity",args,1);
#line 5469 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("fix_parity",1,"string(0..255)");
#line 5469 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(key=Pike_sp[0-1].u.string);
{
INT32 i;
struct array *arr;

NO_WIDE_STRING(key);

if(key->len < 24 && key->len != 21)
Pike_error("Key must be 21 or >=24 characters.\n");

/* Split the string */
if(key->len==21)
push_int(7);
else
push_int(8);
f_divide(2);
arr = Pike_sp[-1].u.array;
add_ref(arr);
pop_stack();

/* fix_parity for every subkey */
for(i=0; i<3; i++) {
push_int(0);
array_index(&Pike_sp[-1], arr, i);
f_Nettle_DES_fix_parity(1);
}
free_array(arr);

/* Join the subkeys */
f_add(3);
}

}
/*! @class State
   *!
   *! State for DES3 encyption
   */

#undef class_Nettle_DES3_State_defined
#define class_Nettle_DES3_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_DES3_State_program=NULL;

#ifdef Nettle_DES3_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_DES3_State_program_fun_num=-1;
#endif /* Nettle_DES3_State_program_fun_num_used */
/*! @decl inherit Cipher::State
*/


#undef extra_Nettle_DES3_State_defined
#define extra_Nettle_DES3_State_defined

#undef var_des3_Nettle_DES3_State_defined
#define var_des3_Nettle_DES3_State_defined

#undef THIS
#define THIS ((struct Nettle_DES3_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_DES3_STATE
#define THIS_NETTLE_DES3_STATE ((struct Nettle_DES3_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_DES3_STATE
#define OBJ2_NETTLE_DES3_STATE(o) ((struct Nettle_DES3_State_struct *)(o->storage+Nettle_DES3_State_storage_offset))

#undef GET_NETTLE_DES3_STATE_STORAGE
#define GET_NETTLE_DES3_STATE_STORAGE(o) ((struct Nettle_DES3_State_struct *)(o->storage+Nettle_DES3_State_storage_offset)
static ptrdiff_t Nettle_DES3_State_storage_offset;
struct Nettle_DES3_State_struct {

#ifdef var_des3_Nettle_DES3_State_defined
#line 5536 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct des3_ctx des3;
#endif /* var_des3_Nettle_DES3_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_DES3_State_struct *Nettle_DES3_State_gdb_dummy_ptr;
#endif

#undef internal_init_Nettle_DES3_State_defined
#define internal_init_Nettle_DES3_State_defined

#undef Nettle_DES3_State_event_handler_defined
#define Nettle_DES3_State_event_handler_defined
static void init_Nettle_DES3_State_struct(void)
#line 5539 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct Nettle_Cipher_State_struct *state;
ASSIGN_CURRENT_STORAGE(state, struct Nettle_Cipher_State_struct, 1,
Nettle_Cipher_State_program);
state->ctx = &THIS->des3;
}

#define f_Nettle_DES3_State_make_key_defined

#ifdef f_Nettle_DES3_State_make_key_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_DES3_State_make_key_fun_num = 0;

#endif /* f_Nettle_DES3_State_make_key_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_DES3_State_make_key(INT32 args) {
#line 5546 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 0) wrong_number_of_args_error("make_key",args,0);
{
struct Nettle_Cipher_struct *info = GET_INFO();
struct Nettle_Cipher_State_struct *state;
ASSIGN_CURRENT_STORAGE(state, struct Nettle_Cipher_State_struct, 1,
Nettle_Cipher_State_program);
assert(info);

#ifndef DES_WEAK_KEY
 /* NB: This loop temporarily leaks strings on the stack,
       *     but we don't care, as it is a low probability,
       *     and they will be cleaned up on return.
       */
do {
low_make_key(info->meta->key_size);
f_Nettle_DES3_fix_parity(1);
} while( !des3_set_key(state->ctx,
(const uint8_t *)Pike_sp[-1].u.string->str) );
#else
 low_make_key(info->meta->key_size);
f_Nettle_DES3_fix_parity(1);

info->meta->set_encrypt_key(state->ctx, Pike_sp[-1].u.string->len,
Pike_sp[-1].u.string->str, 0);
#endif

Pike_sp[-1].u.string->flags |= STRING_CLEAR_ON_EXIT;
state->crypt = info->meta->encrypt;
state->key_size = Pike_sp[-1].u.string->len;
}
}

#ifdef Nettle_DES3_State_event_handler_defined
static void Nettle_DES3_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_DES3_State_defined
  case PROG_EVENT_INIT: init_Nettle_DES3_State_struct(); break;

#endif /* internal_init_Nettle_DES3_State_defined */
  default: break; 
  }
}

#endif /* Nettle_DES3_State_event_handler_defined */
/*! @endclass State */


#ifdef Nettle_DES3_event_handler_defined
static void Nettle_DES3_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_DES3_defined
  case PROG_EVENT_INIT: init_Nettle_DES3_struct(); break;

#endif /* internal_init_Nettle_DES3_defined */
  default: break; 
  }
}

#endif /* Nettle_DES3_event_handler_defined */
/*! @endclass DES3 */

#line 5583 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef HAVE_NETTLE_SALSA20_CRYPT

static void
pike_salsa20_set_key(void *ctx,
ptrdiff_t length, const char *key,
int UNUSED(force))
{
if ((length != SALSA20_MIN_KEY_SIZE) && (length != SALSA20_MAX_KEY_SIZE))
Pike_error("SALSA20: Bad keysize for SALSA20.\n");

salsa20_set_key(ctx, length, (const uint8_t *)key);
}

#define pike_salsa20_set_encrypt_key pike_salsa20_set_key
#define pike_salsa20_set_decrypt_key pike_salsa20_set_key
#define salsa20_encrypt salsa20_crypt
#define salsa20_decrypt salsa20_crypt

/*! @class SALSA20
 *!
 *! Implementation of the SALSA20 cipher.
 *!
 */

#undef class_Nettle_SALSA20_defined
#define class_Nettle_SALSA20_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_SALSA20_program=NULL;

#ifdef Nettle_SALSA20_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_SALSA20_program_fun_num=-1;
#endif /* Nettle_SALSA20_program_fun_num_used */
/*! @decl inherit BlockCipher
   */

#undef inherit_Nettle_BlockCipher_Nettle_SALSA20_defined
#define inherit_Nettle_BlockCipher_Nettle_SALSA20_defined
#line 5610 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_SALSA20_Nettle_BlockCipher_inh_num = -1;
#line 5610 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_SALSA20_Nettle_BlockCipher_inh_offset = -1;
#line 5612 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static const struct pike_cipher pike_salsa20 =
_PIKE_CIPHER(salsa20, SALSA20);


#undef internal_init_Nettle_SALSA20_defined
#define internal_init_Nettle_SALSA20_defined

#undef Nettle_SALSA20_event_handler_defined
#define Nettle_SALSA20_event_handler_defined
static void init_Nettle_SALSA20_struct(void)
#line 5616 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct Nettle_Cipher_struct *cipher;
ASSIGN_CURRENT_STORAGE(cipher, struct Nettle_Cipher_struct,
BLOCKCIPHER_CIPHER_INHERIT + 1,
Nettle_Cipher_program);
cipher->meta = &pike_salsa20;
}

/*! @class State
   *!
   *! State for SALSA20 encyption.
   *!
   */

#undef class_Nettle_SALSA20_State_defined
#define class_Nettle_SALSA20_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_SALSA20_State_program=NULL;

#ifdef Nettle_SALSA20_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_SALSA20_State_program_fun_num=-1;
#endif /* Nettle_SALSA20_State_program_fun_num_used */
/*! @decl inherit Cipher::State
     */


#undef extra_Nettle_SALSA20_State_defined
#define extra_Nettle_SALSA20_State_defined

#undef var_salsa20_Nettle_SALSA20_State_defined
#define var_salsa20_Nettle_SALSA20_State_defined

#undef THIS
#define THIS ((struct Nettle_SALSA20_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_SALSA20_STATE
#define THIS_NETTLE_SALSA20_STATE ((struct Nettle_SALSA20_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_SALSA20_STATE
#define OBJ2_NETTLE_SALSA20_STATE(o) ((struct Nettle_SALSA20_State_struct *)(o->storage+Nettle_SALSA20_State_storage_offset))

#undef GET_NETTLE_SALSA20_STATE_STORAGE
#define GET_NETTLE_SALSA20_STATE_STORAGE(o) ((struct Nettle_SALSA20_State_struct *)(o->storage+Nettle_SALSA20_State_storage_offset)
static ptrdiff_t Nettle_SALSA20_State_storage_offset;
struct Nettle_SALSA20_State_struct {

#ifdef var_salsa20_Nettle_SALSA20_State_defined
#line 5660 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct salsa20_ctx salsa20;
#endif /* var_salsa20_Nettle_SALSA20_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_SALSA20_State_struct *Nettle_SALSA20_State_gdb_dummy_ptr;
#endif
/*! @decl object set_iv(string(0..255) iv)
     *!
     *! Set the initialization vector (aka nonce) and reset
     *! the block counter to zero.
     *!
     *! @param iv
     *!   An 8-byte long string which is only to be used
     *!   once for every key.
     *!
     *! @note
     *!   This function MUST be called in addition to
     *!   @[set_encrypt_key()] or @[set_decrypt_key()].
     *!
     *! @note
     *!   The same @[iv] should NEVER be reused with the same key!
     */
#define f_Nettle_SALSA20_State_set_iv_defined

#ifdef f_Nettle_SALSA20_State_set_iv_fun_num_used
DEFAULT_CMOD_STORAGE ptrdiff_t f_Nettle_SALSA20_State_set_iv_fun_num = 0;

#endif /* f_Nettle_SALSA20_State_set_iv_fun_num_used */
DEFAULT_CMOD_STORAGE void f_Nettle_SALSA20_State_set_iv(INT32 args) {
#line 5678 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
struct pike_string * iv;
#line 5678 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(args != 1) wrong_number_of_args_error("set_iv",args,1);
#line 5678 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
if(TYPEOF(Pike_sp[0-1]) != PIKE_T_STRING) SIMPLE_ARG_TYPE_ERROR("set_iv",1,"string(0..255)");
#line 5678 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
debug_malloc_pass(iv=Pike_sp[0-1].u.string);
#line 5680 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
NO_WIDE_STRING(iv);
if (iv->len != SALSA20_IV_SIZE)
Pike_error("SALSA20 IV needs to be %d bytes.\n", SALSA20_IV_SIZE);
iv->flags |= STRING_CLEAR_ON_EXIT;
salsa20_set_iv(&THIS->salsa20, STR0(iv));
push_object(this_object());
}

}

#undef internal_init_Nettle_SALSA20_State_defined
#define internal_init_Nettle_SALSA20_State_defined

#undef Nettle_SALSA20_State_event_handler_defined
#define Nettle_SALSA20_State_event_handler_defined
static void init_Nettle_SALSA20_State_struct(void)
#line 5690 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct Nettle_Cipher_State_struct *state;
ASSIGN_CURRENT_STORAGE(state, struct Nettle_Cipher_State_struct, 1,
Nettle_Cipher_State_program);
state->ctx = &THIS->salsa20;
}

#ifdef Nettle_SALSA20_State_event_handler_defined
static void Nettle_SALSA20_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_SALSA20_State_defined
  case PROG_EVENT_INIT: init_Nettle_SALSA20_State_struct(); break;

#endif /* internal_init_Nettle_SALSA20_State_defined */
  default: break; 
  }
}

#endif /* Nettle_SALSA20_State_event_handler_defined */
/*! @endclass State
   */


#ifdef Nettle_SALSA20_event_handler_defined
static void Nettle_SALSA20_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_SALSA20_defined
  case PROG_EVENT_INIT: init_Nettle_SALSA20_struct(); break;

#endif /* internal_init_Nettle_SALSA20_defined */
  default: break; 
  }
}

#endif /* Nettle_SALSA20_event_handler_defined */
/*! @endclass SALSA20
 */

#line 5705 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef salsa20r12_crypt

#define pike_salsa20r12_set_encrypt_key pike_salsa20_set_encrypt_key
#define pike_salsa20r12_set_decrypt_key pike_salsa20_set_decrypt_key
#define salsa20r12_encrypt salsa20r12_crypt
#define salsa20r12_decrypt salsa20r12_crypt
#define salsa20r12_ctx salsa20_ctx

#define SALSA20R12_BLOCK_SIZE	SALSA20_BLOCK_SIZE
#define SALSA20R12_KEY_SIZE	SALSA20_KEY_SIZE

/*! @class SALSA20R12
 *!
 *! Implementation of the @[SALSA20] cipher reduced to 12 rounds.
 *!
 */

#undef class_Nettle_SALSA20R12_defined
#define class_Nettle_SALSA20R12_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_SALSA20R12_program=NULL;

#ifdef Nettle_SALSA20R12_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_SALSA20R12_program_fun_num=-1;
#endif /* Nettle_SALSA20R12_program_fun_num_used */
/*! @decl inherit SALSA20
   */

#undef inherit_Nettle_SALSA20_Nettle_SALSA20R12_defined
#define inherit_Nettle_SALSA20_Nettle_SALSA20R12_defined
#line 5725 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_SALSA20R12_Nettle_SALSA20_inh_num = -1;
#line 5725 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static int Nettle_SALSA20R12_Nettle_SALSA20_inh_offset = -1;
#line 5727 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
static const struct pike_cipher pike_salsa20r12 =
_PIKE_CIPHER(salsa20r12, SALSA20R12);


#undef internal_init_Nettle_SALSA20R12_defined
#define internal_init_Nettle_SALSA20R12_defined

#undef Nettle_SALSA20R12_event_handler_defined
#define Nettle_SALSA20R12_event_handler_defined
static void init_Nettle_SALSA20R12_struct(void)
#line 5731 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
struct Nettle_Cipher_struct *cipher;
/* NB: We know that BlockCipher is the first inherit of SALSA20. */
ASSIGN_CURRENT_STORAGE(cipher, struct Nettle_Cipher_struct,
BLOCKCIPHER_CIPHER_INHERIT + 2,
Nettle_Cipher_program);
cipher->meta = &pike_salsa20r12;
}

#ifdef Nettle_SALSA20R12_event_handler_defined
static void Nettle_SALSA20R12_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_SALSA20R12_defined
  case PROG_EVENT_INIT: init_Nettle_SALSA20R12_struct(); break;

#endif /* internal_init_Nettle_SALSA20R12_defined */
  default: break; 
  }
}

#endif /* Nettle_SALSA20R12_event_handler_defined */
/*! @endclass SALSA20R12
 */

#line 5744 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#endif /* salsa20r12_crypt */

#endif	/* HAVE_NETTLE_SALSA20_CRYPT */

#ifdef HAVE_NETTLE_SERPENT_DECRYPT

static void
pike_serpent_set_key(void *ctx,
ptrdiff_t length, const char *key,
int UNUSED(force))
{
if (length < SERPENT_MIN_KEY_SIZE || length > SERPENT_MAX_KEY_SIZE)
Pike_error("SERPENT: Bad keysize for SERPENT.\n");

serpent_set_key(ctx, length, (const uint8_t *)key);
}
#define pike_serpent_set_encrypt_key pike_serpent_set_key
#define pike_serpent_set_decrypt_key pike_serpent_set_key




#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
/* -*- C -*-
 *
 * Cmod header-file acting as a template for the cipher classes.
 */






/* Stream cipher. */

/* Base name of inherited class. */

/* Number of inherits to get to the Nettle_Cipher inherit. */



/* Block cipher with a 16 byte block size. */





/* Block cipher with a block size other than 16 bytes. */






/*! @class SERPENT
*!
*! Implementation of the SERPENT cipher.
*!
*/

#undef class_Nettle_SERPENT_defined
#define class_Nettle_SERPENT_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_SERPENT_program=NULL;

#ifdef Nettle_SERPENT_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_SERPENT_program_fun_num=-1;
#endif /* Nettle_SERPENT_program_fun_num_used */
/*! @decl inherit BlockCipher16
*/

#undef inherit_Nettle_BlockCipher16_Nettle_SERPENT_defined
#define inherit_Nettle_BlockCipher16_Nettle_SERPENT_defined
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static int Nettle_SERPENT_Nettle_BlockCipher16_inh_num = -1;
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static int Nettle_SERPENT_Nettle_BlockCipher16_inh_offset = -1;
#line 43 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static const struct pike_cipher pike_serpent =
_PIKE_CIPHER(serpent, SERPENT);


#undef internal_init_Nettle_SERPENT_defined
#define internal_init_Nettle_SERPENT_defined

#undef Nettle_SERPENT_event_handler_defined
#define Nettle_SERPENT_event_handler_defined
static void init_Nettle_SERPENT_struct(void)
#line 47 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
struct Nettle_Cipher_struct *cipher;
ASSIGN_CURRENT_STORAGE(cipher, struct Nettle_Cipher_struct,
(BLOCKCIPHER16_CIPHER_INHERIT + 1), Nettle_Cipher_program);
cipher->meta = &pike_serpent;
}

/*! @class State
*!
*! State for SERPENT encyption.
*!
*/

#undef class_Nettle_SERPENT_State_defined
#define class_Nettle_SERPENT_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_SERPENT_State_program=NULL;

#ifdef Nettle_SERPENT_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_SERPENT_State_program_fun_num=-1;
#endif /* Nettle_SERPENT_State_program_fun_num_used */
/*! @decl inherit Cipher::State
*/


#undef extra_Nettle_SERPENT_State_defined
#define extra_Nettle_SERPENT_State_defined

#undef var_serpent_Nettle_SERPENT_State_defined
#define var_serpent_Nettle_SERPENT_State_defined

#undef THIS
#define THIS ((struct Nettle_SERPENT_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_SERPENT_STATE
#define THIS_NETTLE_SERPENT_STATE ((struct Nettle_SERPENT_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_SERPENT_STATE
#define OBJ2_NETTLE_SERPENT_STATE(o) ((struct Nettle_SERPENT_State_struct *)(o->storage+Nettle_SERPENT_State_storage_offset))

#undef GET_NETTLE_SERPENT_STATE_STORAGE
#define GET_NETTLE_SERPENT_STATE_STORAGE(o) ((struct Nettle_SERPENT_State_struct *)(o->storage+Nettle_SERPENT_State_storage_offset)
static ptrdiff_t Nettle_SERPENT_State_storage_offset;
struct Nettle_SERPENT_State_struct {

#ifdef var_serpent_Nettle_SERPENT_State_defined
#line 89 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
struct serpent_ctx serpent;
#endif /* var_serpent_Nettle_SERPENT_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_SERPENT_State_struct *Nettle_SERPENT_State_gdb_dummy_ptr;
#endif

#undef internal_init_Nettle_SERPENT_State_defined
#define internal_init_Nettle_SERPENT_State_defined

#undef Nettle_SERPENT_State_event_handler_defined
#define Nettle_SERPENT_State_event_handler_defined
static void init_Nettle_SERPENT_State_struct(void)
#line 92 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
struct Nettle_Cipher_State_struct *state;
ASSIGN_CURRENT_STORAGE(state, struct Nettle_Cipher_State_struct, 1,
Nettle_Cipher_State_program);
state->ctx = &THIS->serpent;
}

#ifdef Nettle_SERPENT_State_event_handler_defined
static void Nettle_SERPENT_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_SERPENT_State_defined
  case PROG_EVENT_INIT: init_Nettle_SERPENT_State_struct(); break;

#endif /* internal_init_Nettle_SERPENT_State_defined */
  default: break; 
  }
}

#endif /* Nettle_SERPENT_State_event_handler_defined */
/*! @endclass State
*/


#ifdef Nettle_SERPENT_event_handler_defined
static void Nettle_SERPENT_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_SERPENT_defined
  case PROG_EVENT_INIT: init_Nettle_SERPENT_struct(); break;

#endif /* internal_init_Nettle_SERPENT_defined */
  default: break; 
  }
}

#endif /* Nettle_SERPENT_event_handler_defined */
/*! @endclass SERPENT
*/





#line 111 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#line 5766 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"




#line 5770 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#endif	/* HAVE_NETTLE_SERPENT_DECRYPT */

static void
pike_twofish_set_key(void *ctx,
ptrdiff_t length, const char *key,
int UNUSED(force))
{
if (length < TWOFISH_MIN_KEY_SIZE || length > TWOFISH_MAX_KEY_SIZE)
Pike_error("TWOFISH: Bad keysize for TWOFISH.\n");

twofish_set_key(ctx, length, (const uint8_t *)key);
}
#define pike_twofish_set_encrypt_key pike_twofish_set_key
#define pike_twofish_set_decrypt_key pike_twofish_set_key

#define Twofish_BLOCK_SIZE	TWOFISH_BLOCK_SIZE
#define Twofish_KEY_SIZE 	TWOFISH_KEY_SIZE




#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
/* -*- C -*-
 *
 * Cmod header-file acting as a template for the cipher classes.
 */






/* Stream cipher. */

/* Base name of inherited class. */

/* Number of inherits to get to the Nettle_Cipher inherit. */



/* Block cipher with a 16 byte block size. */





/* Block cipher with a block size other than 16 bytes. */






/*! @class Twofish
*!
*! Implementation of the Twofish cipher.
*!
*/

#undef class_Nettle_Twofish_defined
#define class_Nettle_Twofish_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_Twofish_program=NULL;

#ifdef Nettle_Twofish_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_Twofish_program_fun_num=-1;
#endif /* Nettle_Twofish_program_fun_num_used */
/*! @decl inherit BlockCipher16
*/

#undef inherit_Nettle_BlockCipher16_Nettle_Twofish_defined
#define inherit_Nettle_BlockCipher16_Nettle_Twofish_defined
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static int Nettle_Twofish_Nettle_BlockCipher16_inh_num = -1;
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static int Nettle_Twofish_Nettle_BlockCipher16_inh_offset = -1;
#line 43 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static const struct pike_cipher pike_twofish =
_PIKE_CIPHER(twofish, Twofish);


#undef internal_init_Nettle_Twofish_defined
#define internal_init_Nettle_Twofish_defined

#undef Nettle_Twofish_event_handler_defined
#define Nettle_Twofish_event_handler_defined
static void init_Nettle_Twofish_struct(void)
#line 47 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
struct Nettle_Cipher_struct *cipher;
ASSIGN_CURRENT_STORAGE(cipher, struct Nettle_Cipher_struct,
(BLOCKCIPHER16_CIPHER_INHERIT + 1), Nettle_Cipher_program);
cipher->meta = &pike_twofish;
}

/*! @class State
*!
*! State for Twofish encyption.
*!
*/

#undef class_Nettle_Twofish_State_defined
#define class_Nettle_Twofish_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_Twofish_State_program=NULL;

#ifdef Nettle_Twofish_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_Twofish_State_program_fun_num=-1;
#endif /* Nettle_Twofish_State_program_fun_num_used */
/*! @decl inherit Cipher::State
*/


#undef extra_Nettle_Twofish_State_defined
#define extra_Nettle_Twofish_State_defined

#undef var_twofish_Nettle_Twofish_State_defined
#define var_twofish_Nettle_Twofish_State_defined

#undef THIS
#define THIS ((struct Nettle_Twofish_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_TWOFISH_STATE
#define THIS_NETTLE_TWOFISH_STATE ((struct Nettle_Twofish_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_TWOFISH_STATE
#define OBJ2_NETTLE_TWOFISH_STATE(o) ((struct Nettle_Twofish_State_struct *)(o->storage+Nettle_Twofish_State_storage_offset))

#undef GET_NETTLE_TWOFISH_STATE_STORAGE
#define GET_NETTLE_TWOFISH_STATE_STORAGE(o) ((struct Nettle_Twofish_State_struct *)(o->storage+Nettle_Twofish_State_storage_offset)
static ptrdiff_t Nettle_Twofish_State_storage_offset;
struct Nettle_Twofish_State_struct {

#ifdef var_twofish_Nettle_Twofish_State_defined
#line 89 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
struct twofish_ctx twofish;
#endif /* var_twofish_Nettle_Twofish_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_Twofish_State_struct *Nettle_Twofish_State_gdb_dummy_ptr;
#endif

#undef internal_init_Nettle_Twofish_State_defined
#define internal_init_Nettle_Twofish_State_defined

#undef Nettle_Twofish_State_event_handler_defined
#define Nettle_Twofish_State_event_handler_defined
static void init_Nettle_Twofish_State_struct(void)
#line 92 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
struct Nettle_Cipher_State_struct *state;
ASSIGN_CURRENT_STORAGE(state, struct Nettle_Cipher_State_struct, 1,
Nettle_Cipher_State_program);
state->ctx = &THIS->twofish;
}

#ifdef Nettle_Twofish_State_event_handler_defined
static void Nettle_Twofish_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_Twofish_State_defined
  case PROG_EVENT_INIT: init_Nettle_Twofish_State_struct(); break;

#endif /* internal_init_Nettle_Twofish_State_defined */
  default: break; 
  }
}

#endif /* Nettle_Twofish_State_event_handler_defined */
/*! @endclass State
*/


#ifdef Nettle_Twofish_event_handler_defined
static void Nettle_Twofish_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_Twofish_defined
  case PROG_EVENT_INIT: init_Nettle_Twofish_struct(); break;

#endif /* internal_init_Nettle_Twofish_defined */
  default: break; 
  }
}

#endif /* Nettle_Twofish_event_handler_defined */
/*! @endclass Twofish
*/





#line 111 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#line 5791 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"




#line 5795 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef WITH_IDEA

static void
pike_idea_set_encrypt_key(void *ctx_v,
ptrdiff_t length, const char *key,
int UNUSED(force))
{
struct idea_ctx *ctx = ctx_v;
if (length == IDEA_KEY_SIZE)
idea_expand((unsigned INT16 *)ctx->ctx, (unsigned INT8 *)key);
else
Pike_error("IDEA: Bad keysize for IDEA.\n");
}

static void
pike_idea_set_decrypt_key(void *ctx_v,
ptrdiff_t length, const char *key,
int UNUSED(force))
{
struct idea_ctx *ctx = ctx_v;
if (length == IDEA_KEY_SIZE) {
idea_expand((unsigned INT16 *)ctx->ctx, (unsigned INT8 *)key);
idea_invert((unsigned INT16 *)ctx->ctx, (unsigned INT16 *)ctx->ctx);
}
else
Pike_error("IDEA: Bad keysize for IDEA.\n");
}

#define idea_encrypt idea_crypt_blocks
#define idea_decrypt idea_crypt_blocks




#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#line 1 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
/* -*- C -*-
 *
 * Cmod header-file acting as a template for the cipher classes.
 */






/* Stream cipher. */

/* Base name of inherited class. */

/* Number of inherits to get to the Nettle_Cipher inherit. */



/* Block cipher with a 16 byte block size. */





/* Block cipher with a block size other than 16 bytes. */






/*! @class IDEA
*!
*! Implementation of the IDEA cipher.
*!
*/

#undef class_Nettle_IDEA_defined
#define class_Nettle_IDEA_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_IDEA_program=NULL;

#ifdef Nettle_IDEA_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_IDEA_program_fun_num=-1;
#endif /* Nettle_IDEA_program_fun_num_used */
/*! @decl inherit BlockCipher
*/

#undef inherit_Nettle_BlockCipher_Nettle_IDEA_defined
#define inherit_Nettle_BlockCipher_Nettle_IDEA_defined
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static int Nettle_IDEA_Nettle_BlockCipher_inh_num = -1;
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static int Nettle_IDEA_Nettle_BlockCipher_inh_offset = -1;
#line 43 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
static const struct pike_cipher pike_idea =
_PIKE_CIPHER(idea, IDEA);


#undef internal_init_Nettle_IDEA_defined
#define internal_init_Nettle_IDEA_defined

#undef Nettle_IDEA_event_handler_defined
#define Nettle_IDEA_event_handler_defined
static void init_Nettle_IDEA_struct(void)
#line 47 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
struct Nettle_Cipher_struct *cipher;
ASSIGN_CURRENT_STORAGE(cipher, struct Nettle_Cipher_struct,
(BLOCKCIPHER_CIPHER_INHERIT + 1), Nettle_Cipher_program);
cipher->meta = &pike_idea;
}

/*! @class State
*!
*! State for IDEA encyption.
*!
*/

#undef class_Nettle_IDEA_State_defined
#define class_Nettle_IDEA_State_defined
DEFAULT_CMOD_STORAGE struct program *Nettle_IDEA_State_program=NULL;

#ifdef Nettle_IDEA_State_program_fun_num_used
DEFAULT_CMOD_STORAGE int Nettle_IDEA_State_program_fun_num=-1;
#endif /* Nettle_IDEA_State_program_fun_num_used */
/*! @decl inherit Cipher::State
*/


#undef extra_Nettle_IDEA_State_defined
#define extra_Nettle_IDEA_State_defined

#undef var_idea_Nettle_IDEA_State_defined
#define var_idea_Nettle_IDEA_State_defined

#undef THIS
#define THIS ((struct Nettle_IDEA_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef THIS_NETTLE_IDEA_STATE
#define THIS_NETTLE_IDEA_STATE ((struct Nettle_IDEA_State_struct *)(Pike_interpreter.frame_pointer->current_storage))

#undef OBJ2_NETTLE_IDEA_STATE
#define OBJ2_NETTLE_IDEA_STATE(o) ((struct Nettle_IDEA_State_struct *)(o->storage+Nettle_IDEA_State_storage_offset))

#undef GET_NETTLE_IDEA_STATE_STORAGE
#define GET_NETTLE_IDEA_STATE_STORAGE(o) ((struct Nettle_IDEA_State_struct *)(o->storage+Nettle_IDEA_State_storage_offset)
static ptrdiff_t Nettle_IDEA_State_storage_offset;
struct Nettle_IDEA_State_struct {

#ifdef var_idea_Nettle_IDEA_State_defined
#line 89 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
struct idea_ctx idea;
#endif /* var_idea_Nettle_IDEA_State_defined */
};
#ifdef PIKE_DEBUG
/* Ensure the struct is used in a variable declaration, or else gdb might not see it. */
static struct Nettle_IDEA_State_struct *Nettle_IDEA_State_gdb_dummy_ptr;
#endif

#undef internal_init_Nettle_IDEA_State_defined
#define internal_init_Nettle_IDEA_State_defined

#undef Nettle_IDEA_State_event_handler_defined
#define Nettle_IDEA_State_event_handler_defined
static void init_Nettle_IDEA_State_struct(void)
#line 92 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
struct Nettle_Cipher_State_struct *state;
ASSIGN_CURRENT_STORAGE(state, struct Nettle_Cipher_State_struct, 1,
Nettle_Cipher_State_program);
state->ctx = &THIS->idea;
}

#ifdef Nettle_IDEA_State_event_handler_defined
static void Nettle_IDEA_State_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_IDEA_State_defined
  case PROG_EVENT_INIT: init_Nettle_IDEA_State_struct(); break;

#endif /* internal_init_Nettle_IDEA_State_defined */
  default: break; 
  }
}

#endif /* Nettle_IDEA_State_event_handler_defined */
/*! @endclass State
*/


#ifdef Nettle_IDEA_event_handler_defined
static void Nettle_IDEA_event_handler(int ev) {
  switch(ev) {

#ifdef internal_init_Nettle_IDEA_defined
  case PROG_EVENT_INIT: init_Nettle_IDEA_struct(); break;

#endif /* internal_init_Nettle_IDEA_defined */
  default: break; 
  }
}

#endif /* Nettle_IDEA_event_handler_defined */
/*! @endclass IDEA
*/





#line 111 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#line 5829 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"




#line 5833 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#endif /* WITH_IDEA */

/*! @endmodule Nettle */

void
cipher_init(void)
{
nul13_string = begin_shared_string(13);
memset(STR0(nul13_string), 0, 13);
nul13_string = end_shared_string(nul13_string);
nul16_string = begin_shared_string(16);
memset(STR0(nul16_string), 0, 16);
nul16_string = end_shared_string(nul16_string);


#ifdef module_strings_declared
module_strings[0] = 
  make_shared_binary_string("State",
                            CONSTANT_STRLEN("State"));
module_strings[1] = 
  make_shared_binary_string("_CTR",
                            CONSTANT_STRLEN("_CTR"));
module_strings[2] = 
  make_shared_binary_string("__builtin.Nettle.Cipher",
                            CONSTANT_STRLEN("__builtin.Nettle.Cipher"));
module_strings[3] = 
  make_shared_binary_string("__builtin.Nettle.BlockCipher",
                            CONSTANT_STRLEN("__builtin.Nettle.BlockCipher"));
module_strings[4] = 
  make_shared_binary_string("__builtin.Nettle.AEAD",
                            CONSTANT_STRLEN("__builtin.Nettle.AEAD"));
module_strings[5] = 
  make_shared_binary_string("Nettle_AEAD",
                            CONSTANT_STRLEN("Nettle_AEAD"));
module_strings[6] = 
  make_shared_binary_string("Nettle_AEAD_State",
                            CONSTANT_STRLEN("Nettle_AEAD_State"));
#endif

#ifdef CMOD_MAP_PROGRAM_IDS_DEFINED
{ int i=0;
#ifndef tObjImpl_NETTLE_AEAD
# define tObjImpl_NETTLE_AEAD "\3\0\177\0\0""5"
{
   struct program *tmp = resolve_program(module_strings[5] /* "Nettle_AEAD" */);
   if( tmp ) {
      ___cmod_ext_used[i].from = 53;
      ___cmod_ext_used[i].to = tmp->id;
      i++;
   }
}
#endif /* tObjImpl_NETTLE_AEAD */
#ifndef tObjImpl_NETTLE_AEAD_STATE
# define tObjImpl_NETTLE_AEAD_STATE "\3\0\177\0\0""6"
{
   struct program *tmp = resolve_program(module_strings[6] /* "Nettle_AEAD_State" */);
   if( tmp ) {
      ___cmod_ext_used[i].from = 54;
      ___cmod_ext_used[i].to = tmp->id;
      i++;
   }
}
#endif /* tObjImpl_NETTLE_AEAD_STATE */
}
set_program_id_to_id( ___cmod_map_program_ids );

#endif /* CMOD_MAP_PROGRAM_IDS_DEFINED */

#ifdef class_Nettle_Cipher_defined

#ifdef PROG_NETTLE_CIPHER_ID
#line 150 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_CIPHER);
#else
#line 150 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_CIPHER_ID */
#line 150 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_Cipher_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_CIPHER

#undef tObjIs_NETTLE_CIPHER
#define tObjIs_NETTLE_CIPHER "\3\1\177\0\0\2"

#undef tObjImpl_NETTLE_CIPHER
#define tObjImpl_NETTLE_CIPHER "\3\0\177\0\0\2"

#endif /* tObjImpl_NETTLE_CIPHER */

#ifdef THIS_NETTLE_CIPHER
  Nettle_Cipher_storage_offset = ADD_STORAGE(struct Nettle_Cipher_struct);
#endif /* THIS_NETTLE_CIPHER */

#ifdef inherit_cq__22__builtin_2ENettle_2ECipher_22_Nettle_Cipher_defined
#line 154 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_Cipher_cq__22__builtin_2ENettle_2ECipher_22_inh_num = Pike_compiler->new_program->num_inherits;
  do {
#line 154 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    struct program *p = resolve_program(module_strings[2] /* "__builtin.Nettle.Cipher" */);
    if (p) {
#line 154 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      low_inherit(p, NULL, -1, 0, 0, NULL);
#line 154 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      Nettle_Cipher_cq__22__builtin_2ENettle_2ECipher_22_inh_offset = Pike_compiler->new_program->inherits[Nettle_Cipher_cq__22__builtin_2ENettle_2ECipher_22_inh_num].identifier_level;
#line 154 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      free_program(p);
    } else {
#line 154 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      yyerror("Inherit failed.");
    }
  } while(0);
#endif /* inherit_cq__22__builtin_2ENettle_2ECipher_22_Nettle_Cipher_defined */

#ifdef class_Nettle_Cipher_State_defined

#ifdef PROG_NETTLE_CIPHER_STATE_ID
#line 211 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_CIPHER_STATE);
#else
#line 211 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_CIPHER_STATE_ID */
#line 211 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_Cipher_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_CIPHER_STATE

#undef tObjIs_NETTLE_CIPHER_STATE
#define tObjIs_NETTLE_CIPHER_STATE "\3\1\177\0\0\3"

#undef tObjImpl_NETTLE_CIPHER_STATE
#define tObjImpl_NETTLE_CIPHER_STATE "\3\0\177\0\0\3"

#endif /* tObjImpl_NETTLE_CIPHER_STATE */

#ifdef THIS_NETTLE_CIPHER_STATE
  Nettle_Cipher_State_storage_offset = ADD_STORAGE(struct Nettle_Cipher_State_struct);
#endif /* THIS_NETTLE_CIPHER_STATE */

#ifdef extra_Nettle_Cipher_State_defined
#line 218 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
/* Perform an inherit of the State class (if any) that our parent
       * may contain via its inherit of __builtin.Nettle.Hash.
       */
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0,
parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_Cipher_State_defined */

#ifdef Nettle_Cipher_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_Cipher_State_event_handler);

#ifndef Nettle_Cipher_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_Cipher_State_gc_live_obj */

#endif /* Nettle_Cipher_State_event_handler_defined */

#ifdef f_Nettle_Cipher_State_set_encrypt_key_defined

#ifdef f_Nettle_Cipher_State_set_encrypt_key_fun_num_used
  f_Nettle_Cipher_State_set_encrypt_key_fun_num =
#endif /* f_Nettle_Cipher_State_set_encrypt_key_fun_num_used */
#line 272 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_encrypt_key", f_Nettle_Cipher_State_set_encrypt_key, tFunc(tStr8 tOr(tInt, tVoid), tObjImpl_NETTLE_CIPHER_STATE), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_Cipher_State_set_encrypt_key_defined */

#ifdef f_Nettle_Cipher_State_set_decrypt_key_defined

#ifdef f_Nettle_Cipher_State_set_decrypt_key_fun_num_used
  f_Nettle_Cipher_State_set_decrypt_key_fun_num =
#endif /* f_Nettle_Cipher_State_set_decrypt_key_fun_num_used */
#line 301 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_decrypt_key", f_Nettle_Cipher_State_set_decrypt_key, tFunc(tStr8 tOr(tInt, tVoid), tObjImpl_NETTLE_CIPHER_STATE), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_Cipher_State_set_decrypt_key_defined */

#ifdef f_Nettle_Cipher_State_make_key_defined

#ifdef f_Nettle_Cipher_State_make_key_fun_num_used
  f_Nettle_Cipher_State_make_key_fun_num =
#endif /* f_Nettle_Cipher_State_make_key_fun_num_used */
#line 333 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("make_key", f_Nettle_Cipher_State_make_key, tFunc(tNone,tStr8), 0, OPT_EXTERNAL_DEPEND);

#endif /* f_Nettle_Cipher_State_make_key_defined */

#ifdef f_Nettle_Cipher_State_crypt_defined

#ifdef f_Nettle_Cipher_State_crypt_fun_num_used
  f_Nettle_Cipher_State_crypt_fun_num =
#endif /* f_Nettle_Cipher_State_crypt_fun_num_used */
#line 359 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("crypt", f_Nettle_Cipher_State_crypt, tFunc(tStr8,tStr8), 0, OPT_EXTERNAL_DEPEND | OPT_SIDE_EFFECT);

#endif /* f_Nettle_Cipher_State_crypt_defined */

#ifdef f_Nettle_Cipher_State_name_defined

#ifdef f_Nettle_Cipher_State_name_fun_num_used
  f_Nettle_Cipher_State_name_fun_num =
#endif /* f_Nettle_Cipher_State_name_fun_num_used */
#line 397 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_Cipher_State_name, tFunc(tNone,tStr8), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_Cipher_State_name_defined */

#ifdef f_Nettle_Cipher_State_key_size_defined

#ifdef f_Nettle_Cipher_State_key_size_fun_num_used
  f_Nettle_Cipher_State_key_size_fun_num =
#endif /* f_Nettle_Cipher_State_key_size_fun_num_used */
#line 408 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("key_size", f_Nettle_Cipher_State_key_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_Cipher_State_key_size_defined */

#ifdef f_Nettle_Cipher_State_block_size_defined

#ifdef f_Nettle_Cipher_State_block_size_fun_num_used
  f_Nettle_Cipher_State_block_size_fun_num =
#endif /* f_Nettle_Cipher_State_block_size_fun_num_used */
#line 423 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("block_size", f_Nettle_Cipher_State_block_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_Cipher_State_block_size_defined */
#line 212 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_USES_PARENT|PROGRAM_NEEDS_PARENT|PROGRAM_CLEAR_STORAGE;
#line 211 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_Cipher_State_program=end_program();
#line 211 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_Cipher_State_program_fun_num_used
Nettle_Cipher_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_Cipher_State_program,0);

#endif /* class_Nettle_Cipher_State_defined */

#ifdef Nettle_Cipher_event_handler_defined
  pike_set_prog_event_callback(Nettle_Cipher_event_handler);

#ifndef Nettle_Cipher_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_Cipher_gc_live_obj */

#endif /* Nettle_Cipher_event_handler_defined */

#ifdef f_Nettle_Cipher_name_defined

#ifdef f_Nettle_Cipher_name_fun_num_used
  f_Nettle_Cipher_name_fun_num =
#endif /* f_Nettle_Cipher_name_fun_num_used */
#line 170 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_Cipher_name, tFunc(tNone,tStr8), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_Cipher_name_defined */

#ifdef f_Nettle_Cipher_key_size_defined

#ifdef f_Nettle_Cipher_key_size_fun_num_used
  f_Nettle_Cipher_key_size_fun_num =
#endif /* f_Nettle_Cipher_key_size_fun_num_used */
#line 184 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("key_size", f_Nettle_Cipher_key_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_Cipher_key_size_defined */

#ifdef f_Nettle_Cipher_block_size_defined

#ifdef f_Nettle_Cipher_block_size_fun_num_used
  f_Nettle_Cipher_block_size_fun_num =
#endif /* f_Nettle_Cipher_block_size_fun_num_used */
#line 198 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("block_size", f_Nettle_Cipher_block_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_Cipher_block_size_defined */
#line 150 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_Cipher_program=end_program();
#line 150 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_Cipher_program_fun_num_used
Nettle_Cipher_program_fun_num=
#endif
 add_program_constant("Cipher",Nettle_Cipher_program,0);

#endif /* class_Nettle_Cipher_defined */

#ifdef class_Nettle_BufferedCipher_defined

#ifdef PROG_NETTLE_BUFFEREDCIPHER_ID
#line 461 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BUFFEREDCIPHER);
#else
#line 461 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BUFFEREDCIPHER_ID */
#line 461 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BufferedCipher_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BUFFEREDCIPHER

#undef tObjIs_NETTLE_BUFFEREDCIPHER
#define tObjIs_NETTLE_BUFFEREDCIPHER "\3\1\177\0\0\4"

#undef tObjImpl_NETTLE_BUFFEREDCIPHER
#define tObjImpl_NETTLE_BUFFEREDCIPHER "\3\0\177\0\0\4"

#endif /* tObjImpl_NETTLE_BUFFEREDCIPHER */

#ifdef THIS_NETTLE_BUFFEREDCIPHER
  Nettle_BufferedCipher_storage_offset = ADD_STORAGE(struct Nettle_BufferedCipher_struct);
#endif /* THIS_NETTLE_BUFFEREDCIPHER */

#ifdef inherit_Nettle_Cipher_Nettle_BufferedCipher_defined
#line 468 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BufferedCipher_Nettle_Cipher_inh_num = Pike_compiler->new_program->num_inherits;
#line 468 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  low_inherit(Nettle_Cipher_program, NULL, -1, 0, 0, NULL);
#line 468 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BufferedCipher_Nettle_Cipher_inh_offset = Pike_compiler->new_program->inherits[Nettle_BufferedCipher_Nettle_Cipher_inh_num].identifier_level;

#endif /* inherit_Nettle_Cipher_Nettle_BufferedCipher_defined */

#ifdef var_Buffer_Nettle_BufferedCipher_defined
  PIKE_MAP_VARIABLE("Buffer", Nettle_BufferedCipher_storage_offset + OFFSETOF(Nettle_BufferedCipher_struct, Buffer),
                    tName("Nettle_BufferedCipher_cq__Buffer", tObjImpl_NETTLE_BUFFEREDCIPHER_CQ__BUFFER), PIKE_T_OBJECT, 0);
#endif /* var_Buffer_Nettle_BufferedCipher_defined */

#ifdef class_Nettle_BufferedCipher_cq__Buffer_defined

#ifdef PROG_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_ID
#line 508 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BUFFEREDCIPHER_CQ__BUFFER);
#else
#line 508 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_ID */
#line 508 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BufferedCipher_cq__Buffer_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BUFFEREDCIPHER_CQ__BUFFER

#undef tObjIs_NETTLE_BUFFEREDCIPHER_CQ__BUFFER
#define tObjIs_NETTLE_BUFFEREDCIPHER_CQ__BUFFER "\3\1\177\0\0\5"

#undef tObjImpl_NETTLE_BUFFEREDCIPHER_CQ__BUFFER
#define tObjImpl_NETTLE_BUFFEREDCIPHER_CQ__BUFFER "\3\0\177\0\0\5"

#endif /* tObjImpl_NETTLE_BUFFEREDCIPHER_CQ__BUFFER */

#ifdef inherit_cq__22__builtin_2ENettle_2ECipher_22_Nettle_BufferedCipher_cq__Buffer_defined
#line 513 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BufferedCipher_cq__Buffer_cq__22__builtin_2ENettle_2ECipher_22_inh_num = Pike_compiler->new_program->num_inherits;
  do {
#line 513 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    struct program *p = resolve_program(module_strings[2] /* "__builtin.Nettle.Cipher" */);
    if (p) {
#line 513 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      low_inherit(p, NULL, -1, 0, 0, NULL);
#line 513 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      Nettle_BufferedCipher_cq__Buffer_cq__22__builtin_2ENettle_2ECipher_22_inh_offset = Pike_compiler->new_program->inherits[Nettle_BufferedCipher_cq__Buffer_cq__22__builtin_2ENettle_2ECipher_22_inh_num].identifier_level;
#line 513 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      free_program(p);
    } else {
#line 513 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      yyerror("Inherit failed.");
    }
  } while(0);
#endif /* inherit_cq__22__builtin_2ENettle_2ECipher_22_Nettle_BufferedCipher_cq__Buffer_defined */

#ifdef class_Nettle_BufferedCipher_cq__Buffer_State_defined

#ifdef PROG_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_STATE_ID
#line 567 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BUFFEREDCIPHER_CQ__BUFFER_STATE);
#else
#line 567 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_STATE_ID */
#line 567 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BufferedCipher_cq__Buffer_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_STATE

#undef tObjIs_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_STATE
#define tObjIs_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_STATE "\3\1\177\0\0\6"

#undef tObjImpl_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_STATE
#define tObjImpl_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_STATE "\3\0\177\0\0\6"

#endif /* tObjImpl_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_STATE */

#ifdef THIS_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_STATE
  Nettle_BufferedCipher_cq__Buffer_State_storage_offset = ADD_STORAGE(struct Nettle_BufferedCipher_cq__Buffer_State_struct);
#endif /* THIS_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_STATE */

#ifdef Nettle_BufferedCipher_cq__Buffer_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_BufferedCipher_cq__Buffer_State_event_handler);

#ifndef Nettle_BufferedCipher_cq__Buffer_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_BufferedCipher_cq__Buffer_State_gc_live_obj */

#endif /* Nettle_BufferedCipher_cq__Buffer_State_event_handler_defined */

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_substate_factory_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_substate_factory_fun_num_used
  f_Nettle_BufferedCipher_cq__Buffer_State_substate_factory_fun_num =
#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_substate_factory_fun_num_used */
#line 604 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("substate_factory", f_Nettle_BufferedCipher_cq__Buffer_State_substate_factory, tFunc(tNone,tName("Nettle_Cipher_State", tObjImpl_NETTLE_CIPHER_STATE)), ID_PROTECTED, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_substate_factory_defined */

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_create_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_create_fun_num_used
  f_Nettle_BufferedCipher_cq__Buffer_State_create_fun_num =
#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_create_fun_num_used */
#line 616 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("create", f_Nettle_BufferedCipher_cq__Buffer_State_create, tFunc(tNone,tVoid), ID_PROTECTED, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_create_defined */

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_name_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_name_fun_num_used
  f_Nettle_BufferedCipher_cq__Buffer_State_name_fun_num =
#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_name_fun_num_used */
#line 664 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BufferedCipher_cq__Buffer_State_name, tFunc(tNone,tStr8), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_name_defined */

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_block_size_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_block_size_fun_num_used
  f_Nettle_BufferedCipher_cq__Buffer_State_block_size_fun_num =
#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_block_size_fun_num_used */
#line 676 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("block_size", f_Nettle_BufferedCipher_cq__Buffer_State_block_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_block_size_defined */

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_key_size_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_key_size_fun_num_used
  f_Nettle_BufferedCipher_cq__Buffer_State_key_size_fun_num =
#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_key_size_fun_num_used */
#line 686 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("key_size", f_Nettle_BufferedCipher_cq__Buffer_State_key_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND);

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_key_size_defined */

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_iv_size_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_iv_size_fun_num_used
  f_Nettle_BufferedCipher_cq__Buffer_State_iv_size_fun_num =
#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_iv_size_fun_num_used */
#line 696 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("iv_size", f_Nettle_BufferedCipher_cq__Buffer_State_iv_size, tFunc(tNone,"\10\0\0\0\0\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND);

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_iv_size_defined */

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_set_encrypt_key_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_set_encrypt_key_fun_num_used
  f_Nettle_BufferedCipher_cq__Buffer_State_set_encrypt_key_fun_num =
#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_set_encrypt_key_fun_num_used */
#line 711 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_encrypt_key", f_Nettle_BufferedCipher_cq__Buffer_State_set_encrypt_key, tFunc(tStr8 tOr(tVoid,"\10\200\0\0\0\177\377\377\377"),tObj), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_set_encrypt_key_defined */

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_set_decrypt_key_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_set_decrypt_key_fun_num_used
  f_Nettle_BufferedCipher_cq__Buffer_State_set_decrypt_key_fun_num =
#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_set_decrypt_key_fun_num_used */
#line 730 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_decrypt_key", f_Nettle_BufferedCipher_cq__Buffer_State_set_decrypt_key, tFunc(tStr8 tOr(tVoid,"\10\200\0\0\0\177\377\377\377"),tObj), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_set_decrypt_key_defined */

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_crypt_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_crypt_fun_num_used
  f_Nettle_BufferedCipher_cq__Buffer_State_crypt_fun_num =
#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_crypt_fun_num_used */
#line 751 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("crypt", f_Nettle_BufferedCipher_cq__Buffer_State_crypt, tFunc(tStr8,tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_crypt_defined */

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_pad_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_pad_fun_num_used
  f_Nettle_BufferedCipher_cq__Buffer_State_pad_fun_num =
#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_pad_fun_num_used */
#line 849 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("pad", f_Nettle_BufferedCipher_cq__Buffer_State_pad, tFunc(tOr(tVoid,"\10\200\0\0\0\177\377\377\377"),tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_pad_defined */

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_unpad_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_unpad_fun_num_used
  f_Nettle_BufferedCipher_cq__Buffer_State_unpad_fun_num =
#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_unpad_fun_num_used */
#line 936 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("unpad", f_Nettle_BufferedCipher_cq__Buffer_State_unpad, tFunc(tStr8 tOr(tVoid,"\10\200\0\0\0\177\377\377\377"),tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_unpad_defined */

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_set_iv_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_State_set_iv_fun_num_used
  f_Nettle_BufferedCipher_cq__Buffer_State_set_iv_fun_num =
#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_set_iv_fun_num_used */
#line 1026 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_iv", f_Nettle_BufferedCipher_cq__Buffer_State_set_iv, tFunc(tStr8,tObj), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BufferedCipher_cq__Buffer_State_set_iv_defined */
#line 568 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT|PROGRAM_CLEAR_STORAGE;
#line 567 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BufferedCipher_cq__Buffer_State_program=end_program();
#line 567 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BufferedCipher_cq__Buffer_State_program_fun_num_used
Nettle_BufferedCipher_cq__Buffer_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_BufferedCipher_cq__Buffer_State_program,0);

#endif /* class_Nettle_BufferedCipher_cq__Buffer_State_defined */

#ifdef f_Nettle_BufferedCipher_cq__Buffer_name_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_name_fun_num_used
  f_Nettle_BufferedCipher_cq__Buffer_name_fun_num =
#endif /* f_Nettle_BufferedCipher_cq__Buffer_name_fun_num_used */
#line 515 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BufferedCipher_cq__Buffer_name, tFunc(tNone,tStr8), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BufferedCipher_cq__Buffer_name_defined */

#ifdef f_Nettle_BufferedCipher_cq__Buffer_block_size_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_block_size_fun_num_used
  f_Nettle_BufferedCipher_cq__Buffer_block_size_fun_num =
#endif /* f_Nettle_BufferedCipher_cq__Buffer_block_size_fun_num_used */
#line 523 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("block_size", f_Nettle_BufferedCipher_cq__Buffer_block_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BufferedCipher_cq__Buffer_block_size_defined */

#ifdef f_Nettle_BufferedCipher_cq__Buffer_key_size_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_key_size_fun_num_used
  f_Nettle_BufferedCipher_cq__Buffer_key_size_fun_num =
#endif /* f_Nettle_BufferedCipher_cq__Buffer_key_size_fun_num_used */
#line 528 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("key_size", f_Nettle_BufferedCipher_cq__Buffer_key_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BufferedCipher_cq__Buffer_key_size_defined */

#ifdef f_Nettle_BufferedCipher_cq__Buffer_iv_size_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_iv_size_fun_num_used
  f_Nettle_BufferedCipher_cq__Buffer_iv_size_fun_num =
#endif /* f_Nettle_BufferedCipher_cq__Buffer_iv_size_fun_num_used */
#line 533 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("iv_size", f_Nettle_BufferedCipher_cq__Buffer_iv_size, tFunc(tNone,"\10\0\0\0\0\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BufferedCipher_cq__Buffer_iv_size_defined */

#ifdef f_Nettle_BufferedCipher_cq__Buffer_cq__backtick_28_29_defined

#ifdef f_Nettle_BufferedCipher_cq__Buffer_cq__backtick_28_29_fun_num_used
  f_Nettle_BufferedCipher_cq__Buffer_cq__backtick_28_29_fun_num =
#endif /* f_Nettle_BufferedCipher_cq__Buffer_cq__backtick_28_29_fun_num_used */
#line 1042 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("`()", f_Nettle_BufferedCipher_cq__Buffer_cq__backtick_28_29, tFunc(tNone,tName("Nettle_BufferedCipher_cq__Buffer_State", tObjImpl_NETTLE_BUFFEREDCIPHER_CQ__BUFFER_STATE)), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BufferedCipher_cq__Buffer_cq__backtick_28_29_defined */
#line 509 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 508 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BufferedCipher_cq__Buffer_program=end_program();
#line 508 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BufferedCipher_cq__Buffer_program_fun_num_used
Nettle_BufferedCipher_cq__Buffer_program_fun_num=
#endif
 add_program_constant("_Buffer",Nettle_BufferedCipher_cq__Buffer_program,0);

#endif /* class_Nettle_BufferedCipher_cq__Buffer_defined */

#ifdef Nettle_BufferedCipher_event_handler_defined
  pike_set_prog_event_callback(Nettle_BufferedCipher_event_handler);

#ifndef Nettle_BufferedCipher_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_BufferedCipher_gc_live_obj */

#endif /* Nettle_BufferedCipher_event_handler_defined */
#line 461 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BufferedCipher_program=end_program();
#line 461 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BufferedCipher_program_fun_num_used
Nettle_BufferedCipher_program_fun_num=
#endif
 add_program_constant("BufferedCipher",Nettle_BufferedCipher_program,0);

#endif /* class_Nettle_BufferedCipher_defined */

#ifdef class_Nettle_BlockCipher_defined

#ifdef PROG_NETTLE_BLOCKCIPHER_ID
#line 1071 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER);
#else
#line 1071 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER_ID */
#line 1071 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER

#undef tObjIs_NETTLE_BLOCKCIPHER
#define tObjIs_NETTLE_BLOCKCIPHER "\3\1\177\0\0\a"

#undef tObjImpl_NETTLE_BLOCKCIPHER
#define tObjImpl_NETTLE_BLOCKCIPHER "\3\0\177\0\0\a"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER */

#ifdef THIS_NETTLE_BLOCKCIPHER
  Nettle_BlockCipher_storage_offset = ADD_STORAGE(struct Nettle_BlockCipher_struct);
#endif /* THIS_NETTLE_BLOCKCIPHER */

#ifdef inherit_cq__22__builtin_2ENettle_2EBlockCipher_22_Nettle_BlockCipher_defined
#line 1075 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__22__builtin_2ENettle_2EBlockCipher_22_inh_num = Pike_compiler->new_program->num_inherits;
  do {
#line 1075 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    struct program *p = resolve_program(module_strings[3] /* "__builtin.Nettle.BlockCipher" */);
    if (p) {
#line 1075 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      low_inherit(p, NULL, -1, 0, 0, NULL);
#line 1075 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      Nettle_BlockCipher_cq__22__builtin_2ENettle_2EBlockCipher_22_inh_offset = Pike_compiler->new_program->inherits[Nettle_BlockCipher_cq__22__builtin_2ENettle_2EBlockCipher_22_inh_num].identifier_level;
#line 1075 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      free_program(p);
    } else {
#line 1075 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      yyerror("Inherit failed.");
    }
  } while(0);
#endif /* inherit_cq__22__builtin_2ENettle_2EBlockCipher_22_Nettle_BlockCipher_defined */

#ifdef inherit_Nettle_BufferedCipher_Nettle_BlockCipher_defined
#line 1079 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_Nettle_BufferedCipher_inh_num = Pike_compiler->new_program->num_inherits;
#line 1079 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  low_inherit(Nettle_BufferedCipher_program, NULL, -1, 0, 0, NULL);
#line 1079 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_Nettle_BufferedCipher_inh_offset = Pike_compiler->new_program->inherits[Nettle_BlockCipher_Nettle_BufferedCipher_inh_num].identifier_level;

#endif /* inherit_Nettle_BufferedCipher_Nettle_BlockCipher_defined */

#ifdef var_CBC_Nettle_BlockCipher_defined
  PIKE_MAP_VARIABLE("CBC", Nettle_BlockCipher_storage_offset + OFFSETOF(Nettle_BlockCipher_struct, CBC),
                    tName("Nettle_BlockCipher_cq__CBC", tObjImpl_NETTLE_BLOCKCIPHER_CQ__CBC), PIKE_T_OBJECT, 0);
#endif /* var_CBC_Nettle_BlockCipher_defined */

#ifdef class_Nettle_BlockCipher_cq__CBC_defined

#ifdef PROG_NETTLE_BLOCKCIPHER_CQ__CBC_ID
#line 1092 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER_CQ__CBC);
#else
#line 1092 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER_CQ__CBC_ID */
#line 1092 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__CBC_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER_CQ__CBC

#undef tObjIs_NETTLE_BLOCKCIPHER_CQ__CBC
#define tObjIs_NETTLE_BLOCKCIPHER_CQ__CBC "\3\1\177\0\0\b"

#undef tObjImpl_NETTLE_BLOCKCIPHER_CQ__CBC
#define tObjImpl_NETTLE_BLOCKCIPHER_CQ__CBC "\3\0\177\0\0\b"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER_CQ__CBC */

#ifdef inherit_Nettle_BufferedCipher_Nettle_BlockCipher_cq__CBC_defined
#line 1097 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__CBC_Nettle_BufferedCipher_inh_num = Pike_compiler->new_program->num_inherits;
#line 1097 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  low_inherit(Nettle_BufferedCipher_program, NULL, -1, 0, 0, NULL);
#line 1097 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__CBC_Nettle_BufferedCipher_inh_offset = Pike_compiler->new_program->inherits[Nettle_BlockCipher_cq__CBC_Nettle_BufferedCipher_inh_num].identifier_level;

#endif /* inherit_Nettle_BufferedCipher_Nettle_BlockCipher_cq__CBC_defined */

#ifdef class_Nettle_BlockCipher_cq__CBC_State_defined

#ifdef PROG_NETTLE_BLOCKCIPHER_CQ__CBC_STATE_ID
#line 1128 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER_CQ__CBC_STATE);
#else
#line 1128 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER_CQ__CBC_STATE_ID */
#line 1128 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__CBC_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER_CQ__CBC_STATE

#undef tObjIs_NETTLE_BLOCKCIPHER_CQ__CBC_STATE
#define tObjIs_NETTLE_BLOCKCIPHER_CQ__CBC_STATE "\3\1\177\0\0\t"

#undef tObjImpl_NETTLE_BLOCKCIPHER_CQ__CBC_STATE
#define tObjImpl_NETTLE_BLOCKCIPHER_CQ__CBC_STATE "\3\0\177\0\0\t"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER_CQ__CBC_STATE */

#ifdef THIS_NETTLE_BLOCKCIPHER_CQ__CBC_STATE
  Nettle_BlockCipher_cq__CBC_State_storage_offset = ADD_STORAGE(struct Nettle_BlockCipher_cq__CBC_State_struct);
#endif /* THIS_NETTLE_BLOCKCIPHER_CQ__CBC_STATE */

#ifdef extra_Nettle_BlockCipher_cq__CBC_State_defined
#line 1135 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
/* Perform an inherit of the State class (if any) that our parent
	 * may contain via its inherit of __builtin.Nettle.Cipher.
	 */
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0,
parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_BlockCipher_cq__CBC_State_defined */

#ifdef var_object_Nettle_BlockCipher_cq__CBC_State_defined
  PIKE_MAP_VARIABLE("object", Nettle_BlockCipher_cq__CBC_State_storage_offset + OFFSETOF(Nettle_BlockCipher_cq__CBC_State_struct, object),
                    tObj, PIKE_T_OBJECT, ID_PRIVATE|ID_PROTECTED|ID_HIDDEN);
#endif /* var_object_Nettle_BlockCipher_cq__CBC_State_defined */

#ifdef Nettle_BlockCipher_cq__CBC_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_BlockCipher_cq__CBC_State_event_handler);

#ifndef Nettle_BlockCipher_cq__CBC_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_BlockCipher_cq__CBC_State_gc_live_obj */

#endif /* Nettle_BlockCipher_cq__CBC_State_event_handler_defined */

#ifdef f_Nettle_BlockCipher_cq__CBC_State_substate_factory_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_substate_factory_fun_num_used
  f_Nettle_BlockCipher_cq__CBC_State_substate_factory_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CBC_State_substate_factory_fun_num_used */
#line 1187 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("substate_factory", f_Nettle_BlockCipher_cq__CBC_State_substate_factory, tFunc(tNone,tName("Nettle_Cipher_State", tObjImpl_NETTLE_CIPHER_STATE)), ID_PROTECTED, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CBC_State_substate_factory_defined */

#ifdef f_Nettle_BlockCipher_cq__CBC_State_create_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_create_fun_num_used
  f_Nettle_BlockCipher_cq__CBC_State_create_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CBC_State_create_fun_num_used */
#line 1200 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("create", f_Nettle_BlockCipher_cq__CBC_State_create, tFunc(tNone,tVoid), ID_PROTECTED, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CBC_State_create_defined */

#ifdef f_Nettle_BlockCipher_cq__CBC_State_name_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_name_fun_num_used
  f_Nettle_BlockCipher_cq__CBC_State_name_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CBC_State_name_fun_num_used */
#line 1267 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BlockCipher_cq__CBC_State_name, tFunc(tNone,tStr8), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher_cq__CBC_State_name_defined */

#ifdef f_Nettle_BlockCipher_cq__CBC_State_block_size_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_block_size_fun_num_used
  f_Nettle_BlockCipher_cq__CBC_State_block_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CBC_State_block_size_fun_num_used */
#line 1279 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("block_size", f_Nettle_BlockCipher_cq__CBC_State_block_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher_cq__CBC_State_block_size_defined */

#ifdef f_Nettle_BlockCipher_cq__CBC_State_key_size_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_key_size_fun_num_used
  f_Nettle_BlockCipher_cq__CBC_State_key_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CBC_State_key_size_fun_num_used */
    ADD_FUNCTION2("key_size", f_Nettle_BlockCipher_cq__CBC_State_key_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND);

#endif /* f_Nettle_BlockCipher_cq__CBC_State_key_size_defined */

#ifdef f_Nettle_BlockCipher_cq__CBC_State_iv_size_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_iv_size_fun_num_used
  f_Nettle_BlockCipher_cq__CBC_State_iv_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CBC_State_iv_size_fun_num_used */
    ADD_FUNCTION2("iv_size", f_Nettle_BlockCipher_cq__CBC_State_iv_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher_cq__CBC_State_iv_size_defined */

#ifdef f_Nettle_BlockCipher_cq__CBC_State_set_encrypt_key_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_set_encrypt_key_fun_num_used
  f_Nettle_BlockCipher_cq__CBC_State_set_encrypt_key_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CBC_State_set_encrypt_key_fun_num_used */
#line 1308 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_encrypt_key", f_Nettle_BlockCipher_cq__CBC_State_set_encrypt_key, tFunc(tStr8 tOr("\10\200\0\0\0\177\377\377\377",tVoid),tObj), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CBC_State_set_encrypt_key_defined */

#ifdef f_Nettle_BlockCipher_cq__CBC_State_set_decrypt_key_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_set_decrypt_key_fun_num_used
  f_Nettle_BlockCipher_cq__CBC_State_set_decrypt_key_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CBC_State_set_decrypt_key_fun_num_used */
#line 1324 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_decrypt_key", f_Nettle_BlockCipher_cq__CBC_State_set_decrypt_key, tFunc(tStr8 tOr("\10\200\0\0\0\177\377\377\377",tVoid),tObj), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CBC_State_set_decrypt_key_defined */

#ifdef f_Nettle_BlockCipher_cq__CBC_State_set_iv_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_set_iv_fun_num_used
  f_Nettle_BlockCipher_cq__CBC_State_set_iv_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CBC_State_set_iv_fun_num_used */
#line 1340 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_iv", f_Nettle_BlockCipher_cq__CBC_State_set_iv, tFunc(tStr8,tObj), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CBC_State_set_iv_defined */

#ifdef f_Nettle_BlockCipher_cq__CBC_State_crypt_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_State_crypt_fun_num_used
  f_Nettle_BlockCipher_cq__CBC_State_crypt_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CBC_State_crypt_fun_num_used */
#line 1360 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("crypt", f_Nettle_BlockCipher_cq__CBC_State_crypt, tFunc(tStr8,tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CBC_State_crypt_defined */
#line 1129 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 1128 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__CBC_State_program=end_program();
#line 1128 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher_cq__CBC_State_program_fun_num_used
Nettle_BlockCipher_cq__CBC_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_BlockCipher_cq__CBC_State_program,0);

#endif /* class_Nettle_BlockCipher_cq__CBC_State_defined */

#ifdef f_Nettle_BlockCipher_cq__CBC_name_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_name_fun_num_used
  f_Nettle_BlockCipher_cq__CBC_name_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CBC_name_fun_num_used */
#line 1099 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BlockCipher_cq__CBC_name, tFunc(tNone,tStr8), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher_cq__CBC_name_defined */

#ifdef f_Nettle_BlockCipher_cq__CBC_block_size_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_block_size_fun_num_used
  f_Nettle_BlockCipher_cq__CBC_block_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CBC_block_size_fun_num_used */
    ADD_FUNCTION2("block_size", f_Nettle_BlockCipher_cq__CBC_block_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CBC_block_size_defined */

#ifdef f_Nettle_BlockCipher_cq__CBC_key_size_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_key_size_fun_num_used
  f_Nettle_BlockCipher_cq__CBC_key_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CBC_key_size_fun_num_used */
#line 1114 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("key_size", f_Nettle_BlockCipher_cq__CBC_key_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CBC_key_size_defined */

#ifdef f_Nettle_BlockCipher_cq__CBC_iv_size_defined

#ifdef f_Nettle_BlockCipher_cq__CBC_iv_size_fun_num_used
  f_Nettle_BlockCipher_cq__CBC_iv_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CBC_iv_size_fun_num_used */
#line 1120 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("iv_size", f_Nettle_BlockCipher_cq__CBC_iv_size, tFunc(tNone,"\10\0\0\0\0\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CBC_iv_size_defined */
#line 1093 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 1092 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__CBC_program=end_program();
#line 1092 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher_cq__CBC_program_fun_num_used
Nettle_BlockCipher_cq__CBC_program_fun_num=
#endif
 add_program_constant("_CBC",Nettle_BlockCipher_cq__CBC_program,0);

#endif /* class_Nettle_BlockCipher_cq__CBC_defined */

#ifdef var_PCBC_Nettle_BlockCipher_defined
  PIKE_MAP_VARIABLE("PCBC", Nettle_BlockCipher_storage_offset + OFFSETOF(Nettle_BlockCipher_struct, PCBC),
                    tName("Nettle_BlockCipher_cq__PCBC", tObjImpl_NETTLE_BLOCKCIPHER_CQ__PCBC), PIKE_T_OBJECT, 0);
#endif /* var_PCBC_Nettle_BlockCipher_defined */

#ifdef class_Nettle_BlockCipher_cq__PCBC_defined

#ifdef PROG_NETTLE_BLOCKCIPHER_CQ__PCBC_ID
#line 1442 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER_CQ__PCBC);
#else
#line 1442 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER_CQ__PCBC_ID */
#line 1442 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__PCBC_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER_CQ__PCBC

#undef tObjIs_NETTLE_BLOCKCIPHER_CQ__PCBC
#define tObjIs_NETTLE_BLOCKCIPHER_CQ__PCBC "\3\1\177\0\0\n"

#undef tObjImpl_NETTLE_BLOCKCIPHER_CQ__PCBC
#define tObjImpl_NETTLE_BLOCKCIPHER_CQ__PCBC "\3\0\177\0\0\n"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER_CQ__PCBC */

#ifdef extra_Nettle_BlockCipher_cq__PCBC_defined
#line 1450 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
low_inherit(Nettle_BlockCipher_cq__CBC_program, 0,
Nettle_BlockCipher_cq__CBC_program_fun_num,
42 + 1,
0, NULL);
f_pcbc_inh_cbc_state_program_fun_num =
really_low_reference_inherited_identifier(NULL, 1,
Nettle_BlockCipher_cq__CBC_State_program_fun_num);
}


#endif /* extra_Nettle_BlockCipher_cq__PCBC_defined */

#ifdef class_Nettle_BlockCipher_cq__PCBC_State_defined

#ifdef PROG_NETTLE_BLOCKCIPHER_CQ__PCBC_STATE_ID
#line 1471 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER_CQ__PCBC_STATE);
#else
#line 1471 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER_CQ__PCBC_STATE_ID */
#line 1471 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__PCBC_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER_CQ__PCBC_STATE

#undef tObjIs_NETTLE_BLOCKCIPHER_CQ__PCBC_STATE
#define tObjIs_NETTLE_BLOCKCIPHER_CQ__PCBC_STATE "\3\1\177\0\0\v"

#undef tObjImpl_NETTLE_BLOCKCIPHER_CQ__PCBC_STATE
#define tObjImpl_NETTLE_BLOCKCIPHER_CQ__PCBC_STATE "\3\0\177\0\0\v"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER_CQ__PCBC_STATE */

#ifdef extra_Nettle_BlockCipher_cq__PCBC_State_defined
#line 1480 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
low_inherit(Nettle_BlockCipher_cq__CBC_State_program, 0,
f_pcbc_inh_cbc_state_program_fun_num,
42 + 1,
0, NULL);

/* We want to call some of our inherited functions recursively... */
f_pcbc_state_inh_cbc_state_crypt_fun_num =
really_low_reference_inherited_identifier(NULL, 1,
f_Nettle_BlockCipher_cq__CBC_State_crypt_fun_num);
}


#endif /* extra_Nettle_BlockCipher_cq__PCBC_State_defined */

#ifdef f_Nettle_BlockCipher_cq__PCBC_State_name_defined

#ifdef f_Nettle_BlockCipher_cq__PCBC_State_name_fun_num_used
  f_Nettle_BlockCipher_cq__PCBC_State_name_fun_num =
#endif /* f_Nettle_BlockCipher_cq__PCBC_State_name_fun_num_used */
#line 1496 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BlockCipher_cq__PCBC_State_name, tFunc(tNone,tStr8), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher_cq__PCBC_State_name_defined */

#ifdef f_Nettle_BlockCipher_cq__PCBC_State_crypt_defined

#ifdef f_Nettle_BlockCipher_cq__PCBC_State_crypt_fun_num_used
  f_Nettle_BlockCipher_cq__PCBC_State_crypt_fun_num =
#endif /* f_Nettle_BlockCipher_cq__PCBC_State_crypt_fun_num_used */
#line 1516 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("crypt", f_Nettle_BlockCipher_cq__PCBC_State_crypt, tFunc(tStr8,tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__PCBC_State_crypt_defined */
#line 1472 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 1471 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__PCBC_State_program=end_program();
#line 1471 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher_cq__PCBC_State_program_fun_num_used
Nettle_BlockCipher_cq__PCBC_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_BlockCipher_cq__PCBC_State_program,0);

#endif /* class_Nettle_BlockCipher_cq__PCBC_State_defined */

#ifdef f_Nettle_BlockCipher_cq__PCBC_name_defined

#ifdef f_Nettle_BlockCipher_cq__PCBC_name_fun_num_used
  f_Nettle_BlockCipher_cq__PCBC_name_fun_num =
#endif /* f_Nettle_BlockCipher_cq__PCBC_name_fun_num_used */
#line 1460 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BlockCipher_cq__PCBC_name, tFunc(tNone,tStr8), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher_cq__PCBC_name_defined */
#line 1443 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 1442 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__PCBC_program=end_program();
#line 1442 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher_cq__PCBC_program_fun_num_used
Nettle_BlockCipher_cq__PCBC_program_fun_num=
#endif
 add_program_constant("_PCBC",Nettle_BlockCipher_cq__PCBC_program,0);

#endif /* class_Nettle_BlockCipher_cq__PCBC_defined */

#ifdef var_CFB_Nettle_BlockCipher_defined
  PIKE_MAP_VARIABLE("CFB", Nettle_BlockCipher_storage_offset + OFFSETOF(Nettle_BlockCipher_struct, CFB),
                    tName("Nettle_Cipher", tObjImpl_NETTLE_CIPHER), PIKE_T_OBJECT, 0);
#endif /* var_CFB_Nettle_BlockCipher_defined */

#ifdef class_Nettle_BlockCipher_cq__CFB_defined

#ifdef PROG_NETTLE_BLOCKCIPHER_CQ__CFB_ID
#line 1596 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER_CQ__CFB);
#else
#line 1596 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER_CQ__CFB_ID */
#line 1596 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__CFB_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER_CQ__CFB

#undef tObjIs_NETTLE_BLOCKCIPHER_CQ__CFB
#define tObjIs_NETTLE_BLOCKCIPHER_CQ__CFB "\3\1\177\0\0\f"

#undef tObjImpl_NETTLE_BLOCKCIPHER_CQ__CFB
#define tObjImpl_NETTLE_BLOCKCIPHER_CQ__CFB "\3\0\177\0\0\f"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER_CQ__CFB */

#ifdef inherit_Nettle_BufferedCipher_Nettle_BlockCipher_cq__CFB_defined
#line 1601 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__CFB_Nettle_BufferedCipher_inh_num = Pike_compiler->new_program->num_inherits;
#line 1601 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  low_inherit(Nettle_BufferedCipher_program, NULL, -1, 0, 0, NULL);
#line 1601 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__CFB_Nettle_BufferedCipher_inh_offset = Pike_compiler->new_program->inherits[Nettle_BlockCipher_cq__CFB_Nettle_BufferedCipher_inh_num].identifier_level;

#endif /* inherit_Nettle_BufferedCipher_Nettle_BlockCipher_cq__CFB_defined */

#ifdef class_Nettle_BlockCipher_cq__CFB_State_defined

#ifdef PROG_NETTLE_BLOCKCIPHER_CQ__CFB_STATE_ID
#line 1637 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER_CQ__CFB_STATE);
#else
#line 1637 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER_CQ__CFB_STATE_ID */
#line 1637 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__CFB_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER_CQ__CFB_STATE

#undef tObjIs_NETTLE_BLOCKCIPHER_CQ__CFB_STATE
#define tObjIs_NETTLE_BLOCKCIPHER_CQ__CFB_STATE "\3\1\177\0\0\r"

#undef tObjImpl_NETTLE_BLOCKCIPHER_CQ__CFB_STATE
#define tObjImpl_NETTLE_BLOCKCIPHER_CQ__CFB_STATE "\3\0\177\0\0\r"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER_CQ__CFB_STATE */

#ifdef THIS_NETTLE_BLOCKCIPHER_CQ__CFB_STATE
  Nettle_BlockCipher_cq__CFB_State_storage_offset = ADD_STORAGE(struct Nettle_BlockCipher_cq__CFB_State_struct);
#endif /* THIS_NETTLE_BLOCKCIPHER_CQ__CFB_STATE */

#ifdef extra_Nettle_BlockCipher_cq__CFB_State_defined
#line 1644 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
/* Perform an inherit of the State class (if any) that our parent
	 * may contain via its inherit of __builtin.Nettle.Cipher.
	 */
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0,
parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_BlockCipher_cq__CFB_State_defined */

#ifdef var_object_Nettle_BlockCipher_cq__CFB_State_defined
  PIKE_MAP_VARIABLE("object", Nettle_BlockCipher_cq__CFB_State_storage_offset + OFFSETOF(Nettle_BlockCipher_cq__CFB_State_struct, object),
                    tObj, PIKE_T_OBJECT, ID_PRIVATE|ID_PROTECTED|ID_HIDDEN);
#endif /* var_object_Nettle_BlockCipher_cq__CFB_State_defined */

#ifdef Nettle_BlockCipher_cq__CFB_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_BlockCipher_cq__CFB_State_event_handler);

#ifndef Nettle_BlockCipher_cq__CFB_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_BlockCipher_cq__CFB_State_gc_live_obj */

#endif /* Nettle_BlockCipher_cq__CFB_State_event_handler_defined */

#ifdef f_Nettle_BlockCipher_cq__CFB_State_cq__backtickobj_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_cq__backtickobj_fun_num_used
  f_Nettle_BlockCipher_cq__CFB_State_cq__backtickobj_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CFB_State_cq__backtickobj_fun_num_used */
#line 1692 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("`obj", f_Nettle_BlockCipher_cq__CFB_State_cq__backtickobj, tFunc(tNone,tObj), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CFB_State_cq__backtickobj_defined */

#ifdef f_Nettle_BlockCipher_cq__CFB_State_substate_factory_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_substate_factory_fun_num_used
  f_Nettle_BlockCipher_cq__CFB_State_substate_factory_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CFB_State_substate_factory_fun_num_used */
#line 1709 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("substate_factory", f_Nettle_BlockCipher_cq__CFB_State_substate_factory, tFunc(tNone,tName("Nettle_Cipher_State", tObjImpl_NETTLE_CIPHER_STATE)), ID_PROTECTED, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CFB_State_substate_factory_defined */

#ifdef f_Nettle_BlockCipher_cq__CFB_State_create_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_create_fun_num_used
  f_Nettle_BlockCipher_cq__CFB_State_create_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CFB_State_create_fun_num_used */
#line 1722 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("create", f_Nettle_BlockCipher_cq__CFB_State_create, tFunc(tNone,tVoid), ID_PROTECTED, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CFB_State_create_defined */

#ifdef f_Nettle_BlockCipher_cq__CFB_State_name_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_name_fun_num_used
  f_Nettle_BlockCipher_cq__CFB_State_name_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CFB_State_name_fun_num_used */
#line 1791 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BlockCipher_cq__CFB_State_name, tFunc(tNone,tStr8), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher_cq__CFB_State_name_defined */

#ifdef f_Nettle_BlockCipher_cq__CFB_State_block_size_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_block_size_fun_num_used
  f_Nettle_BlockCipher_cq__CFB_State_block_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CFB_State_block_size_fun_num_used */
#line 1803 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("block_size", f_Nettle_BlockCipher_cq__CFB_State_block_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher_cq__CFB_State_block_size_defined */

#ifdef f_Nettle_BlockCipher_cq__CFB_State_iv_size_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_iv_size_fun_num_used
  f_Nettle_BlockCipher_cq__CFB_State_iv_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CFB_State_iv_size_fun_num_used */
    ADD_FUNCTION2("iv_size", f_Nettle_BlockCipher_cq__CFB_State_iv_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher_cq__CFB_State_iv_size_defined */

#ifdef f_Nettle_BlockCipher_cq__CFB_State_key_size_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_key_size_fun_num_used
  f_Nettle_BlockCipher_cq__CFB_State_key_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CFB_State_key_size_fun_num_used */
    ADD_FUNCTION2("key_size", f_Nettle_BlockCipher_cq__CFB_State_key_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND);

#endif /* f_Nettle_BlockCipher_cq__CFB_State_key_size_defined */

#ifdef f_Nettle_BlockCipher_cq__CFB_State_set_encrypt_key_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_set_encrypt_key_fun_num_used
  f_Nettle_BlockCipher_cq__CFB_State_set_encrypt_key_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CFB_State_set_encrypt_key_fun_num_used */
#line 1840 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_encrypt_key", f_Nettle_BlockCipher_cq__CFB_State_set_encrypt_key, tFunc(tStr8 tOr("\10\200\0\0\0\177\377\377\377",tVoid),tObj), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CFB_State_set_encrypt_key_defined */

#ifdef f_Nettle_BlockCipher_cq__CFB_State_set_decrypt_key_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_set_decrypt_key_fun_num_used
  f_Nettle_BlockCipher_cq__CFB_State_set_decrypt_key_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CFB_State_set_decrypt_key_fun_num_used */
#line 1866 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_decrypt_key", f_Nettle_BlockCipher_cq__CFB_State_set_decrypt_key, tFunc(tStr8 tOr("\10\200\0\0\0\177\377\377\377",tVoid),tObj), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CFB_State_set_decrypt_key_defined */

#ifdef f_Nettle_BlockCipher_cq__CFB_State_set_iv_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_set_iv_fun_num_used
  f_Nettle_BlockCipher_cq__CFB_State_set_iv_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CFB_State_set_iv_fun_num_used */
#line 1893 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_iv", f_Nettle_BlockCipher_cq__CFB_State_set_iv, tFunc(tStr8,tObj), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CFB_State_set_iv_defined */

#ifdef f_Nettle_BlockCipher_cq__CFB_State_crypt_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_State_crypt_fun_num_used
  f_Nettle_BlockCipher_cq__CFB_State_crypt_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CFB_State_crypt_fun_num_used */
#line 1918 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("crypt", f_Nettle_BlockCipher_cq__CFB_State_crypt, tFunc(tStr8,tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CFB_State_crypt_defined */
#line 1638 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_USES_PARENT|PROGRAM_NEEDS_PARENT;
#line 1637 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__CFB_State_program=end_program();
#line 1637 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher_cq__CFB_State_program_fun_num_used
Nettle_BlockCipher_cq__CFB_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_BlockCipher_cq__CFB_State_program,0);

#endif /* class_Nettle_BlockCipher_cq__CFB_State_defined */

#ifdef f_Nettle_BlockCipher_cq__CFB_name_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_name_fun_num_used
  f_Nettle_BlockCipher_cq__CFB_name_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CFB_name_fun_num_used */
#line 1606 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BlockCipher_cq__CFB_name, tFunc(tNone,tStr8), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher_cq__CFB_name_defined */

#ifdef f_Nettle_BlockCipher_cq__CFB_block_size_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_block_size_fun_num_used
  f_Nettle_BlockCipher_cq__CFB_block_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CFB_block_size_fun_num_used */
    ADD_FUNCTION2("block_size", f_Nettle_BlockCipher_cq__CFB_block_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CFB_block_size_defined */

#ifdef f_Nettle_BlockCipher_cq__CFB_key_size_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_key_size_fun_num_used
  f_Nettle_BlockCipher_cq__CFB_key_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CFB_key_size_fun_num_used */
#line 1621 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("key_size", f_Nettle_BlockCipher_cq__CFB_key_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CFB_key_size_defined */

#ifdef f_Nettle_BlockCipher_cq__CFB_iv_size_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_iv_size_fun_num_used
  f_Nettle_BlockCipher_cq__CFB_iv_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CFB_iv_size_fun_num_used */
#line 1627 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("iv_size", f_Nettle_BlockCipher_cq__CFB_iv_size, tFunc(tNone,"\10\0\0\0\0\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CFB_iv_size_defined */

#ifdef f_Nettle_BlockCipher_cq__CFB_cq__backtick_28_29_defined

#ifdef f_Nettle_BlockCipher_cq__CFB_cq__backtick_28_29_fun_num_used
  f_Nettle_BlockCipher_cq__CFB_cq__backtick_28_29_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CFB_cq__backtick_28_29_fun_num_used */
#line 2053 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("`()", f_Nettle_BlockCipher_cq__CFB_cq__backtick_28_29, tFunc(tNone,tName("Nettle_Cipher_State", tObjImpl_NETTLE_CIPHER_STATE)), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CFB_cq__backtick_28_29_defined */
#line 1597 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 1596 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__CFB_program=end_program();
#line 1596 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher_cq__CFB_program_fun_num_used
Nettle_BlockCipher_cq__CFB_program_fun_num=
#endif
 add_program_constant("_CFB",Nettle_BlockCipher_cq__CFB_program,0);

#endif /* class_Nettle_BlockCipher_cq__CFB_defined */

#ifdef var_CTR_Nettle_BlockCipher_defined
  PIKE_MAP_VARIABLE("CTR", Nettle_BlockCipher_storage_offset + OFFSETOF(Nettle_BlockCipher_struct, CTR),
                    tName("Nettle_Cipher", tObjImpl_NETTLE_CIPHER), PIKE_T_OBJECT, 0);
#endif /* var_CTR_Nettle_BlockCipher_defined */

#ifdef class_Nettle_BlockCipher_cq__CTR_defined

#ifdef PROG_NETTLE_BLOCKCIPHER_CQ__CTR_ID
#line 2114 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER_CQ__CTR);
#else
#line 2114 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER_CQ__CTR_ID */
#line 2114 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__CTR_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER_CQ__CTR

#undef tObjIs_NETTLE_BLOCKCIPHER_CQ__CTR
#define tObjIs_NETTLE_BLOCKCIPHER_CQ__CTR "\3\1\177\0\0\16"

#undef tObjImpl_NETTLE_BLOCKCIPHER_CQ__CTR
#define tObjImpl_NETTLE_BLOCKCIPHER_CQ__CTR "\3\0\177\0\0\16"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER_CQ__CTR */

#ifdef inherit_cq__22__builtin_2ENettle_2ECipher_22_Nettle_BlockCipher_cq__CTR_defined
#line 2119 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__CTR_cq__22__builtin_2ENettle_2ECipher_22_inh_num = Pike_compiler->new_program->num_inherits;
  do {
#line 2119 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    struct program *p = resolve_program(module_strings[2] /* "__builtin.Nettle.Cipher" */);
    if (p) {
#line 2119 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      low_inherit(p, NULL, -1, 0, 0, NULL);
#line 2119 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      Nettle_BlockCipher_cq__CTR_cq__22__builtin_2ENettle_2ECipher_22_inh_offset = Pike_compiler->new_program->inherits[Nettle_BlockCipher_cq__CTR_cq__22__builtin_2ENettle_2ECipher_22_inh_num].identifier_level;
#line 2119 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      free_program(p);
    } else {
#line 2119 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      yyerror("Inherit failed.");
    }
  } while(0);
#endif /* inherit_cq__22__builtin_2ENettle_2ECipher_22_Nettle_BlockCipher_cq__CTR_defined */

#ifdef class_Nettle_BlockCipher_cq__CTR_State_defined

#ifdef PROG_NETTLE_BLOCKCIPHER_CQ__CTR_STATE_ID
#line 2155 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER_CQ__CTR_STATE);
#else
#line 2155 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER_CQ__CTR_STATE_ID */
#line 2155 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__CTR_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER_CQ__CTR_STATE

#undef tObjIs_NETTLE_BLOCKCIPHER_CQ__CTR_STATE
#define tObjIs_NETTLE_BLOCKCIPHER_CQ__CTR_STATE "\3\1\177\0\0\17"

#undef tObjImpl_NETTLE_BLOCKCIPHER_CQ__CTR_STATE
#define tObjImpl_NETTLE_BLOCKCIPHER_CQ__CTR_STATE "\3\0\177\0\0\17"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER_CQ__CTR_STATE */

#ifdef THIS_NETTLE_BLOCKCIPHER_CQ__CTR_STATE
  Nettle_BlockCipher_cq__CTR_State_storage_offset = ADD_STORAGE(struct Nettle_BlockCipher_cq__CTR_State_struct);
#endif /* THIS_NETTLE_BLOCKCIPHER_CQ__CTR_STATE */

#ifdef extra_Nettle_BlockCipher_cq__CTR_State_defined
#line 2162 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
/* Perform an inherit of the State class (if any) that our parent
	 * may contain via its inherit of __builtin.Nettle.Cipher.
	 */
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0,
parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_BlockCipher_cq__CTR_State_defined */

#ifdef var_object_Nettle_BlockCipher_cq__CTR_State_defined
  PIKE_MAP_VARIABLE("object", Nettle_BlockCipher_cq__CTR_State_storage_offset + OFFSETOF(Nettle_BlockCipher_cq__CTR_State_struct, object),
                    tObj, PIKE_T_OBJECT, ID_PRIVATE|ID_PROTECTED|ID_HIDDEN);
#endif /* var_object_Nettle_BlockCipher_cq__CTR_State_defined */

#ifdef Nettle_BlockCipher_cq__CTR_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_BlockCipher_cq__CTR_State_event_handler);

#ifndef Nettle_BlockCipher_cq__CTR_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_BlockCipher_cq__CTR_State_gc_live_obj */

#endif /* Nettle_BlockCipher_cq__CTR_State_event_handler_defined */

#ifdef f_Nettle_BlockCipher_cq__CTR_State_cq__backtickobj_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_cq__backtickobj_fun_num_used
  f_Nettle_BlockCipher_cq__CTR_State_cq__backtickobj_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CTR_State_cq__backtickobj_fun_num_used */
    ADD_FUNCTION2("`obj", f_Nettle_BlockCipher_cq__CTR_State_cq__backtickobj, tFunc(tNone,tObj), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CTR_State_cq__backtickobj_defined */

#ifdef f_Nettle_BlockCipher_cq__CTR_State_substate_factory_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_substate_factory_fun_num_used
  f_Nettle_BlockCipher_cq__CTR_State_substate_factory_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CTR_State_substate_factory_fun_num_used */
#line 2226 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("substate_factory", f_Nettle_BlockCipher_cq__CTR_State_substate_factory, tFunc(tNone,tName("Nettle_Cipher_State", tObjImpl_NETTLE_CIPHER_STATE)), ID_PROTECTED, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CTR_State_substate_factory_defined */

#ifdef f_Nettle_BlockCipher_cq__CTR_State_create_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_create_fun_num_used
  f_Nettle_BlockCipher_cq__CTR_State_create_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CTR_State_create_fun_num_used */
#line 2239 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("create", f_Nettle_BlockCipher_cq__CTR_State_create, tFunc(tNone,tVoid), ID_PROTECTED, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CTR_State_create_defined */

#ifdef f_Nettle_BlockCipher_cq__CTR_State_name_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_name_fun_num_used
  f_Nettle_BlockCipher_cq__CTR_State_name_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CTR_State_name_fun_num_used */
#line 2307 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BlockCipher_cq__CTR_State_name, tFunc(tNone,tStr8), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher_cq__CTR_State_name_defined */

#ifdef f_Nettle_BlockCipher_cq__CTR_State_block_size_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_block_size_fun_num_used
  f_Nettle_BlockCipher_cq__CTR_State_block_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CTR_State_block_size_fun_num_used */
#line 2319 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("block_size", f_Nettle_BlockCipher_cq__CTR_State_block_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher_cq__CTR_State_block_size_defined */

#ifdef f_Nettle_BlockCipher_cq__CTR_State_iv_size_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_iv_size_fun_num_used
  f_Nettle_BlockCipher_cq__CTR_State_iv_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CTR_State_iv_size_fun_num_used */
    ADD_FUNCTION2("iv_size", f_Nettle_BlockCipher_cq__CTR_State_iv_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher_cq__CTR_State_iv_size_defined */

#ifdef f_Nettle_BlockCipher_cq__CTR_State_key_size_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_key_size_fun_num_used
  f_Nettle_BlockCipher_cq__CTR_State_key_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CTR_State_key_size_fun_num_used */
    ADD_FUNCTION2("key_size", f_Nettle_BlockCipher_cq__CTR_State_key_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND);

#endif /* f_Nettle_BlockCipher_cq__CTR_State_key_size_defined */

#ifdef f_Nettle_BlockCipher_cq__CTR_State_set_encrypt_key_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_set_encrypt_key_fun_num_used
  f_Nettle_BlockCipher_cq__CTR_State_set_encrypt_key_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CTR_State_set_encrypt_key_fun_num_used */
#line 2356 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_encrypt_key", f_Nettle_BlockCipher_cq__CTR_State_set_encrypt_key, tFunc(tStr8 tOr("\10\200\0\0\0\177\377\377\377",tVoid),tObj), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CTR_State_set_encrypt_key_defined */

#ifdef f_Nettle_BlockCipher_cq__CTR_State_set_decrypt_key_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_set_decrypt_key_fun_num_used
  f_Nettle_BlockCipher_cq__CTR_State_set_decrypt_key_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CTR_State_set_decrypt_key_fun_num_used */
#line 2381 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_decrypt_key", f_Nettle_BlockCipher_cq__CTR_State_set_decrypt_key, tFunc(tStr8 tOr("\10\200\0\0\0\177\377\377\377",tVoid),tObj), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CTR_State_set_decrypt_key_defined */

#ifdef f_Nettle_BlockCipher_cq__CTR_State_set_iv_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_set_iv_fun_num_used
  f_Nettle_BlockCipher_cq__CTR_State_set_iv_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CTR_State_set_iv_fun_num_used */
#line 2407 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_iv", f_Nettle_BlockCipher_cq__CTR_State_set_iv, tFunc(tStr8,tObj), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CTR_State_set_iv_defined */

#ifdef f_Nettle_BlockCipher_cq__CTR_State_crypt_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_State_crypt_fun_num_used
  f_Nettle_BlockCipher_cq__CTR_State_crypt_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CTR_State_crypt_fun_num_used */
#line 2432 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("crypt", f_Nettle_BlockCipher_cq__CTR_State_crypt, tFunc(tStr8,tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CTR_State_crypt_defined */
#line 2156 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_USES_PARENT|PROGRAM_NEEDS_PARENT|PROGRAM_CLEAR_STORAGE;
#line 2155 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__CTR_State_program=end_program();
#line 2155 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher_cq__CTR_State_program_fun_num_used
Nettle_BlockCipher_cq__CTR_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_BlockCipher_cq__CTR_State_program,0);

#endif /* class_Nettle_BlockCipher_cq__CTR_State_defined */

#ifdef f_Nettle_BlockCipher_cq__CTR_name_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_name_fun_num_used
  f_Nettle_BlockCipher_cq__CTR_name_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CTR_name_fun_num_used */
#line 2124 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BlockCipher_cq__CTR_name, tFunc(tNone,tStr8), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher_cq__CTR_name_defined */

#ifdef f_Nettle_BlockCipher_cq__CTR_block_size_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_block_size_fun_num_used
  f_Nettle_BlockCipher_cq__CTR_block_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CTR_block_size_fun_num_used */
    ADD_FUNCTION2("block_size", f_Nettle_BlockCipher_cq__CTR_block_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CTR_block_size_defined */

#ifdef f_Nettle_BlockCipher_cq__CTR_key_size_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_key_size_fun_num_used
  f_Nettle_BlockCipher_cq__CTR_key_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CTR_key_size_fun_num_used */
#line 2139 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("key_size", f_Nettle_BlockCipher_cq__CTR_key_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CTR_key_size_defined */

#ifdef f_Nettle_BlockCipher_cq__CTR_iv_size_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_iv_size_fun_num_used
  f_Nettle_BlockCipher_cq__CTR_iv_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CTR_iv_size_fun_num_used */
#line 2145 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("iv_size", f_Nettle_BlockCipher_cq__CTR_iv_size, tFunc(tNone,"\10\0\0\0\0\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CTR_iv_size_defined */

#ifdef f_Nettle_BlockCipher_cq__CTR_cq__backtick_28_29_defined

#ifdef f_Nettle_BlockCipher_cq__CTR_cq__backtick_28_29_fun_num_used
  f_Nettle_BlockCipher_cq__CTR_cq__backtick_28_29_fun_num =
#endif /* f_Nettle_BlockCipher_cq__CTR_cq__backtick_28_29_fun_num_used */
#line 2483 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("`()", f_Nettle_BlockCipher_cq__CTR_cq__backtick_28_29, tFunc(tNone,tName("Nettle_Cipher_State", tObjImpl_NETTLE_CIPHER_STATE)), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__CTR_cq__backtick_28_29_defined */
#line 2115 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 2114 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__CTR_program=end_program();
#line 2114 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher_cq__CTR_program_fun_num_used
Nettle_BlockCipher_cq__CTR_program_fun_num=
#endif
 add_program_constant("_CTR",Nettle_BlockCipher_cq__CTR_program,0);

#endif /* class_Nettle_BlockCipher_cq__CTR_defined */

#ifdef var_OFB_Nettle_BlockCipher_defined
  PIKE_MAP_VARIABLE("OFB", Nettle_BlockCipher_storage_offset + OFFSETOF(Nettle_BlockCipher_struct, OFB),
                    tName("Nettle_Cipher", tObjImpl_NETTLE_CIPHER), PIKE_T_OBJECT, 0);
#endif /* var_OFB_Nettle_BlockCipher_defined */

#ifdef class_Nettle_BlockCipher_cq__OFB_defined

#ifdef PROG_NETTLE_BLOCKCIPHER_CQ__OFB_ID
#line 2509 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER_CQ__OFB);
#else
#line 2509 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER_CQ__OFB_ID */
#line 2509 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__OFB_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER_CQ__OFB

#undef tObjIs_NETTLE_BLOCKCIPHER_CQ__OFB
#define tObjIs_NETTLE_BLOCKCIPHER_CQ__OFB "\3\1\177\0\0\20"

#undef tObjImpl_NETTLE_BLOCKCIPHER_CQ__OFB
#define tObjImpl_NETTLE_BLOCKCIPHER_CQ__OFB "\3\0\177\0\0\20"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER_CQ__OFB */

#ifdef inherit_Nettle_BufferedCipher_Nettle_BlockCipher_cq__OFB_defined
#line 2514 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__OFB_Nettle_BufferedCipher_inh_num = Pike_compiler->new_program->num_inherits;
#line 2514 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  low_inherit(Nettle_BufferedCipher_program, NULL, -1, 0, 0, NULL);
#line 2514 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__OFB_Nettle_BufferedCipher_inh_offset = Pike_compiler->new_program->inherits[Nettle_BlockCipher_cq__OFB_Nettle_BufferedCipher_inh_num].identifier_level;

#endif /* inherit_Nettle_BufferedCipher_Nettle_BlockCipher_cq__OFB_defined */

#ifdef class_Nettle_BlockCipher_cq__OFB_State_defined

#ifdef PROG_NETTLE_BLOCKCIPHER_CQ__OFB_STATE_ID
#line 2550 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER_CQ__OFB_STATE);
#else
#line 2550 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER_CQ__OFB_STATE_ID */
#line 2550 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__OFB_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER_CQ__OFB_STATE

#undef tObjIs_NETTLE_BLOCKCIPHER_CQ__OFB_STATE
#define tObjIs_NETTLE_BLOCKCIPHER_CQ__OFB_STATE "\3\1\177\0\0\21"

#undef tObjImpl_NETTLE_BLOCKCIPHER_CQ__OFB_STATE
#define tObjImpl_NETTLE_BLOCKCIPHER_CQ__OFB_STATE "\3\0\177\0\0\21"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER_CQ__OFB_STATE */

#ifdef THIS_NETTLE_BLOCKCIPHER_CQ__OFB_STATE
  Nettle_BlockCipher_cq__OFB_State_storage_offset = ADD_STORAGE(struct Nettle_BlockCipher_cq__OFB_State_struct);
#endif /* THIS_NETTLE_BLOCKCIPHER_CQ__OFB_STATE */

#ifdef extra_Nettle_BlockCipher_cq__OFB_State_defined
#line 2557 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
/* Perform an inherit of the State class (if any) that our parent
	 * may contain via its inherit of __builtin.Nettle.Cipher.
	 */
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0,
parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_BlockCipher_cq__OFB_State_defined */

#ifdef var_object_Nettle_BlockCipher_cq__OFB_State_defined
  PIKE_MAP_VARIABLE("object", Nettle_BlockCipher_cq__OFB_State_storage_offset + OFFSETOF(Nettle_BlockCipher_cq__OFB_State_struct, object),
                    tObj, PIKE_T_OBJECT, ID_PRIVATE|ID_PROTECTED|ID_HIDDEN);
#endif /* var_object_Nettle_BlockCipher_cq__OFB_State_defined */

#ifdef Nettle_BlockCipher_cq__OFB_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_BlockCipher_cq__OFB_State_event_handler);

#ifndef Nettle_BlockCipher_cq__OFB_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_BlockCipher_cq__OFB_State_gc_live_obj */

#endif /* Nettle_BlockCipher_cq__OFB_State_event_handler_defined */

#ifdef f_Nettle_BlockCipher_cq__OFB_State_cq__backtickobj_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_cq__backtickobj_fun_num_used
  f_Nettle_BlockCipher_cq__OFB_State_cq__backtickobj_fun_num =
#endif /* f_Nettle_BlockCipher_cq__OFB_State_cq__backtickobj_fun_num_used */
    ADD_FUNCTION2("`obj", f_Nettle_BlockCipher_cq__OFB_State_cq__backtickobj, tFunc(tNone,tObj), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__OFB_State_cq__backtickobj_defined */

#ifdef f_Nettle_BlockCipher_cq__OFB_State_substate_factory_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_substate_factory_fun_num_used
  f_Nettle_BlockCipher_cq__OFB_State_substate_factory_fun_num =
#endif /* f_Nettle_BlockCipher_cq__OFB_State_substate_factory_fun_num_used */
#line 2621 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("substate_factory", f_Nettle_BlockCipher_cq__OFB_State_substate_factory, tFunc(tNone,tName("Nettle_Cipher_State", tObjImpl_NETTLE_CIPHER_STATE)), ID_PROTECTED, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__OFB_State_substate_factory_defined */

#ifdef f_Nettle_BlockCipher_cq__OFB_State_create_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_create_fun_num_used
  f_Nettle_BlockCipher_cq__OFB_State_create_fun_num =
#endif /* f_Nettle_BlockCipher_cq__OFB_State_create_fun_num_used */
#line 2634 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("create", f_Nettle_BlockCipher_cq__OFB_State_create, tFunc(tNone,tVoid), ID_PROTECTED, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__OFB_State_create_defined */

#ifdef f_Nettle_BlockCipher_cq__OFB_State_name_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_name_fun_num_used
  f_Nettle_BlockCipher_cq__OFB_State_name_fun_num =
#endif /* f_Nettle_BlockCipher_cq__OFB_State_name_fun_num_used */
#line 2702 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BlockCipher_cq__OFB_State_name, tFunc(tNone,tStr8), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher_cq__OFB_State_name_defined */

#ifdef f_Nettle_BlockCipher_cq__OFB_State_block_size_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_block_size_fun_num_used
  f_Nettle_BlockCipher_cq__OFB_State_block_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__OFB_State_block_size_fun_num_used */
#line 2714 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("block_size", f_Nettle_BlockCipher_cq__OFB_State_block_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher_cq__OFB_State_block_size_defined */

#ifdef f_Nettle_BlockCipher_cq__OFB_State_iv_size_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_iv_size_fun_num_used
  f_Nettle_BlockCipher_cq__OFB_State_iv_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__OFB_State_iv_size_fun_num_used */
    ADD_FUNCTION2("iv_size", f_Nettle_BlockCipher_cq__OFB_State_iv_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher_cq__OFB_State_iv_size_defined */

#ifdef f_Nettle_BlockCipher_cq__OFB_State_key_size_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_key_size_fun_num_used
  f_Nettle_BlockCipher_cq__OFB_State_key_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__OFB_State_key_size_fun_num_used */
    ADD_FUNCTION2("key_size", f_Nettle_BlockCipher_cq__OFB_State_key_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND);

#endif /* f_Nettle_BlockCipher_cq__OFB_State_key_size_defined */

#ifdef f_Nettle_BlockCipher_cq__OFB_State_set_encrypt_key_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_set_encrypt_key_fun_num_used
  f_Nettle_BlockCipher_cq__OFB_State_set_encrypt_key_fun_num =
#endif /* f_Nettle_BlockCipher_cq__OFB_State_set_encrypt_key_fun_num_used */
#line 2751 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_encrypt_key", f_Nettle_BlockCipher_cq__OFB_State_set_encrypt_key, tFunc(tStr8 tOr("\10\200\0\0\0\177\377\377\377",tVoid),tObj), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__OFB_State_set_encrypt_key_defined */

#ifdef f_Nettle_BlockCipher_cq__OFB_State_set_decrypt_key_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_set_decrypt_key_fun_num_used
  f_Nettle_BlockCipher_cq__OFB_State_set_decrypt_key_fun_num =
#endif /* f_Nettle_BlockCipher_cq__OFB_State_set_decrypt_key_fun_num_used */
#line 2775 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_decrypt_key", f_Nettle_BlockCipher_cq__OFB_State_set_decrypt_key, tFunc(tStr8 tOr("\10\200\0\0\0\177\377\377\377",tVoid),tObj), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__OFB_State_set_decrypt_key_defined */

#ifdef f_Nettle_BlockCipher_cq__OFB_State_set_iv_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_set_iv_fun_num_used
  f_Nettle_BlockCipher_cq__OFB_State_set_iv_fun_num =
#endif /* f_Nettle_BlockCipher_cq__OFB_State_set_iv_fun_num_used */
#line 2800 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_iv", f_Nettle_BlockCipher_cq__OFB_State_set_iv, tFunc(tStr8,tObj), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__OFB_State_set_iv_defined */

#ifdef f_Nettle_BlockCipher_cq__OFB_State_crypt_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_State_crypt_fun_num_used
  f_Nettle_BlockCipher_cq__OFB_State_crypt_fun_num =
#endif /* f_Nettle_BlockCipher_cq__OFB_State_crypt_fun_num_used */
#line 2825 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("crypt", f_Nettle_BlockCipher_cq__OFB_State_crypt, tFunc(tStr8,tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__OFB_State_crypt_defined */
#line 2551 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_USES_PARENT|PROGRAM_NEEDS_PARENT;
#line 2550 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__OFB_State_program=end_program();
#line 2550 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher_cq__OFB_State_program_fun_num_used
Nettle_BlockCipher_cq__OFB_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_BlockCipher_cq__OFB_State_program,0);

#endif /* class_Nettle_BlockCipher_cq__OFB_State_defined */

#ifdef f_Nettle_BlockCipher_cq__OFB_name_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_name_fun_num_used
  f_Nettle_BlockCipher_cq__OFB_name_fun_num =
#endif /* f_Nettle_BlockCipher_cq__OFB_name_fun_num_used */
#line 2519 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BlockCipher_cq__OFB_name, tFunc(tNone,tStr8), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher_cq__OFB_name_defined */

#ifdef f_Nettle_BlockCipher_cq__OFB_block_size_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_block_size_fun_num_used
  f_Nettle_BlockCipher_cq__OFB_block_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__OFB_block_size_fun_num_used */
    ADD_FUNCTION2("block_size", f_Nettle_BlockCipher_cq__OFB_block_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__OFB_block_size_defined */

#ifdef f_Nettle_BlockCipher_cq__OFB_key_size_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_key_size_fun_num_used
  f_Nettle_BlockCipher_cq__OFB_key_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__OFB_key_size_fun_num_used */
#line 2534 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("key_size", f_Nettle_BlockCipher_cq__OFB_key_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__OFB_key_size_defined */

#ifdef f_Nettle_BlockCipher_cq__OFB_iv_size_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_iv_size_fun_num_used
  f_Nettle_BlockCipher_cq__OFB_iv_size_fun_num =
#endif /* f_Nettle_BlockCipher_cq__OFB_iv_size_fun_num_used */
#line 2540 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("iv_size", f_Nettle_BlockCipher_cq__OFB_iv_size, tFunc(tNone,"\10\0\0\0\0\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__OFB_iv_size_defined */

#ifdef f_Nettle_BlockCipher_cq__OFB_cq__backtick_28_29_defined

#ifdef f_Nettle_BlockCipher_cq__OFB_cq__backtick_28_29_fun_num_used
  f_Nettle_BlockCipher_cq__OFB_cq__backtick_28_29_fun_num =
#endif /* f_Nettle_BlockCipher_cq__OFB_cq__backtick_28_29_fun_num_used */
#line 2901 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("`()", f_Nettle_BlockCipher_cq__OFB_cq__backtick_28_29, tFunc(tNone,tName("Nettle_Cipher_State", tObjImpl_NETTLE_CIPHER_STATE)), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher_cq__OFB_cq__backtick_28_29_defined */
#line 2510 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 2509 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_cq__OFB_program=end_program();
#line 2509 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher_cq__OFB_program_fun_num_used
Nettle_BlockCipher_cq__OFB_program_fun_num=
#endif
 add_program_constant("_OFB",Nettle_BlockCipher_cq__OFB_program,0);

#endif /* class_Nettle_BlockCipher_cq__OFB_defined */

#ifdef Nettle_BlockCipher_event_handler_defined
  pike_set_prog_event_callback(Nettle_BlockCipher_event_handler);

#ifndef Nettle_BlockCipher_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_BlockCipher_gc_live_obj */

#endif /* Nettle_BlockCipher_event_handler_defined */
#line 1071 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher_program=end_program();
#line 1071 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher_program_fun_num_used
Nettle_BlockCipher_program_fun_num=
#endif
 add_program_constant("BlockCipher",Nettle_BlockCipher_program,0);

#endif /* class_Nettle_BlockCipher_defined */

#ifdef class_Nettle_BlockCipher16_defined

#ifdef PROG_NETTLE_BLOCKCIPHER16_ID
#line 2958 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER16);
#else
#line 2958 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER16_ID */
#line 2958 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER16

#undef tObjIs_NETTLE_BLOCKCIPHER16
#define tObjIs_NETTLE_BLOCKCIPHER16 "\3\1\177\0\0\22"

#undef tObjImpl_NETTLE_BLOCKCIPHER16
#define tObjImpl_NETTLE_BLOCKCIPHER16 "\3\0\177\0\0\22"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER16 */

#ifdef THIS_NETTLE_BLOCKCIPHER16
  Nettle_BlockCipher16_storage_offset = ADD_STORAGE(struct Nettle_BlockCipher16_struct);
#endif /* THIS_NETTLE_BLOCKCIPHER16 */

#ifdef inherit_Nettle_BlockCipher_Nettle_BlockCipher16_defined
#line 2965 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_Nettle_BlockCipher_inh_num = Pike_compiler->new_program->num_inherits;
#line 2965 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  low_inherit(Nettle_BlockCipher_program, NULL, -1, 0, 0, NULL);
#line 2965 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_Nettle_BlockCipher_inh_offset = Pike_compiler->new_program->inherits[Nettle_BlockCipher16_Nettle_BlockCipher_inh_num].identifier_level;

#endif /* inherit_Nettle_BlockCipher_Nettle_BlockCipher16_defined */

#ifdef var_GCM_Nettle_BlockCipher16_defined
  PIKE_MAP_VARIABLE("GCM", Nettle_BlockCipher16_storage_offset + OFFSETOF(Nettle_BlockCipher16_struct, GCM),
                    tName("Nettle_AEAD", tObjImpl_NETTLE_AEAD), PIKE_T_OBJECT, 0);
#endif /* var_GCM_Nettle_BlockCipher16_defined */

#ifdef var_CCM_Nettle_BlockCipher16_defined
  PIKE_MAP_VARIABLE("CCM", Nettle_BlockCipher16_storage_offset + OFFSETOF(Nettle_BlockCipher16_struct, CCM),
                    tName("Nettle_AEAD", tObjImpl_NETTLE_AEAD), PIKE_T_OBJECT, 0);
#endif /* var_CCM_Nettle_BlockCipher16_defined */

#ifdef class_Nettle_BlockCipher16_cq__CCM_defined

#ifdef PROG_NETTLE_BLOCKCIPHER16_CQ__CCM_ID
#line 2998 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER16_CQ__CCM);
#else
#line 2998 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER16_CQ__CCM_ID */
#line 2998 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_cq__CCM_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER16_CQ__CCM

#undef tObjIs_NETTLE_BLOCKCIPHER16_CQ__CCM
#define tObjIs_NETTLE_BLOCKCIPHER16_CQ__CCM "\3\1\177\0\0\23"

#undef tObjImpl_NETTLE_BLOCKCIPHER16_CQ__CCM
#define tObjImpl_NETTLE_BLOCKCIPHER16_CQ__CCM "\3\0\177\0\0\23"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER16_CQ__CCM */

#ifdef inherit_cq__22__builtin_2ENettle_2EAEAD_22_Nettle_BlockCipher16_cq__CCM_defined
#line 3003 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_cq__CCM_cq__22__builtin_2ENettle_2EAEAD_22_inh_num = Pike_compiler->new_program->num_inherits;
  do {
#line 3003 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    struct program *p = resolve_program(module_strings[4] /* "__builtin.Nettle.AEAD" */);
    if (p) {
#line 3003 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      low_inherit(p, NULL, -1, 0, 0, NULL);
#line 3003 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      Nettle_BlockCipher16_cq__CCM_cq__22__builtin_2ENettle_2EAEAD_22_inh_offset = Pike_compiler->new_program->inherits[Nettle_BlockCipher16_cq__CCM_cq__22__builtin_2ENettle_2EAEAD_22_inh_num].identifier_level;
#line 3003 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      free_program(p);
    } else {
#line 3003 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      yyerror("Inherit failed.");
    }
  } while(0);
#endif /* inherit_cq__22__builtin_2ENettle_2EAEAD_22_Nettle_BlockCipher16_cq__CCM_defined */

#ifdef extra_Nettle_BlockCipher16_cq__CCM_defined
#line 3008 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
/* Perform an inherit if the _CTR class that our parent contains
       * via its inherit of BlockCipher.
       */
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent__CTR_fun_num =
really_low_find_shared_string_identifier(module_strings[1] /* "_CTR" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent__CTR_fun_num >= 0) {
struct program *parent__CTR_prog =
low_program_from_function(parent_obj, parent__CTR_fun_num);
if (parent__CTR_prog) {
parent__CTR_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent__CTR_fun_num);
low_inherit(parent__CTR_prog, 0,
parent__CTR_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_BlockCipher16_cq__CCM_defined */

#ifdef class_Nettle_BlockCipher16_cq__CCM_State_defined

#ifdef PROG_NETTLE_BLOCKCIPHER16_CQ__CCM_STATE_ID
#line 3076 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER16_CQ__CCM_STATE);
#else
#line 3076 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER16_CQ__CCM_STATE_ID */
#line 3076 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_cq__CCM_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER16_CQ__CCM_STATE

#undef tObjIs_NETTLE_BLOCKCIPHER16_CQ__CCM_STATE
#define tObjIs_NETTLE_BLOCKCIPHER16_CQ__CCM_STATE "\3\1\177\0\0\24"

#undef tObjImpl_NETTLE_BLOCKCIPHER16_CQ__CCM_STATE
#define tObjImpl_NETTLE_BLOCKCIPHER16_CQ__CCM_STATE "\3\0\177\0\0\24"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER16_CQ__CCM_STATE */

#ifdef THIS_NETTLE_BLOCKCIPHER16_CQ__CCM_STATE
  Nettle_BlockCipher16_cq__CCM_State_storage_offset = ADD_STORAGE(struct Nettle_BlockCipher16_cq__CCM_State_struct);
#endif /* THIS_NETTLE_BLOCKCIPHER16_CQ__CCM_STATE */

#ifdef extra_Nettle_BlockCipher16_cq__CCM_State_defined
#line 3088 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
/* Perform an inherit of the _CTR.State class that our parent
	 * contains via its inherit of _CTR.
	 */
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0,
parent_State_fun_num,
1 + 42, 0, NULL);
}
}

/* We want to call some of our inherited functions recursively... */
ccm_state_inh_ctr_state_create_fun_num =
really_low_reference_inherited_identifier(NULL, 1,
f_Nettle_BlockCipher_cq__CTR_State_create_fun_num);
ccm_state_inh_ctr_state_crypt_fun_num =
really_low_reference_inherited_identifier(NULL, 1,
f_Nettle_BlockCipher_cq__CTR_State_crypt_fun_num);
ccm_state_inh_ctr_state_set_encrypt_key_fun_num =
really_low_reference_inherited_identifier(NULL, 1,
f_Nettle_BlockCipher_cq__CTR_State_set_encrypt_key_fun_num);
ccm_state_inh_ctr_state_set_decrypt_key_fun_num =
really_low_reference_inherited_identifier(NULL, 1,
f_Nettle_BlockCipher_cq__CTR_State_set_decrypt_key_fun_num);
}


#endif /* extra_Nettle_BlockCipher16_cq__CCM_State_defined */

#ifdef var_mac_mask_Nettle_BlockCipher16_cq__CCM_State_defined
  PIKE_MAP_VARIABLE("mac_mask", Nettle_BlockCipher16_cq__CCM_State_storage_offset + OFFSETOF(Nettle_BlockCipher16_cq__CCM_State_struct, mac_mask),
                    tStr8, PIKE_T_STRING, ID_PRIVATE);
#endif /* var_mac_mask_Nettle_BlockCipher16_cq__CCM_State_defined */

#ifdef var_nonce_Nettle_BlockCipher16_cq__CCM_State_defined
  PIKE_MAP_VARIABLE("nonce", Nettle_BlockCipher16_cq__CCM_State_storage_offset + OFFSETOF(Nettle_BlockCipher16_cq__CCM_State_struct, nonce),
                    tStr8, PIKE_T_STRING, ID_PROTECTED);
#endif /* var_nonce_Nettle_BlockCipher16_cq__CCM_State_defined */

#ifdef Nettle_BlockCipher16_cq__CCM_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_BlockCipher16_cq__CCM_State_event_handler);

#ifndef Nettle_BlockCipher16_cq__CCM_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_BlockCipher16_cq__CCM_State_gc_live_obj */

#endif /* Nettle_BlockCipher16_cq__CCM_State_event_handler_defined */

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_create_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_create_fun_num_used
  f_Nettle_BlockCipher16_cq__CCM_State_create_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__CCM_State_create_fun_num_used */
#line 3156 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("create", f_Nettle_BlockCipher16_cq__CCM_State_create, tFunc(tNone,tVoid), ID_PROTECTED, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__CCM_State_create_defined */

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_name_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_name_fun_num_used
  f_Nettle_BlockCipher16_cq__CCM_State_name_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__CCM_State_name_fun_num_used */
#line 3172 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BlockCipher16_cq__CCM_State_name, tFunc(tNone,tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__CCM_State_name_defined */

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_set_encrypt_key_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_set_encrypt_key_fun_num_used
  f_Nettle_BlockCipher16_cq__CCM_State_set_encrypt_key_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__CCM_State_set_encrypt_key_fun_num_used */
#line 3179 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_encrypt_key", f_Nettle_BlockCipher16_cq__CCM_State_set_encrypt_key, tFunc(tStr8 tOr("\10\200\0\0\0\177\377\377\377",tVoid),tName("Nettle_AEAD_State", tObjImpl_NETTLE_AEAD_STATE)), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__CCM_State_set_encrypt_key_defined */

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_set_decrypt_key_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_set_decrypt_key_fun_num_used
  f_Nettle_BlockCipher16_cq__CCM_State_set_decrypt_key_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__CCM_State_set_decrypt_key_fun_num_used */
    ADD_FUNCTION2("set_decrypt_key", f_Nettle_BlockCipher16_cq__CCM_State_set_decrypt_key, tFunc(tStr8 tOr("\10\200\0\0\0\177\377\377\377",tVoid),tName("Nettle_AEAD_State", tObjImpl_NETTLE_AEAD_STATE)), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__CCM_State_set_decrypt_key_defined */

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_set_iv_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_set_iv_fun_num_used
  f_Nettle_BlockCipher16_cq__CCM_State_set_iv_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__CCM_State_set_iv_fun_num_used */
    ADD_FUNCTION2("set_iv", f_Nettle_BlockCipher16_cq__CCM_State_set_iv, tFunc(tStr8,tName("Nettle_AEAD_State", tObjImpl_NETTLE_AEAD_STATE)), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__CCM_State_set_iv_defined */

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_update_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_update_fun_num_used
  f_Nettle_BlockCipher16_cq__CCM_State_update_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__CCM_State_update_fun_num_used */
#line 3231 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("update", f_Nettle_BlockCipher16_cq__CCM_State_update, tFunc(tStr8,tName("Nettle_AEAD_State", tObjImpl_NETTLE_AEAD_STATE)), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__CCM_State_update_defined */

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_crypt_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_crypt_fun_num_used
  f_Nettle_BlockCipher16_cq__CCM_State_crypt_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__CCM_State_crypt_fun_num_used */
#line 3268 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("crypt", f_Nettle_BlockCipher16_cq__CCM_State_crypt, tFunc(tStr8,tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__CCM_State_crypt_defined */

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_digest_size_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_digest_size_fun_num_used
  f_Nettle_BlockCipher16_cq__CCM_State_digest_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__CCM_State_digest_size_fun_num_used */
#line 3314 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("digest_size", f_Nettle_BlockCipher16_cq__CCM_State_digest_size, tFunc(tNone,"\10\0\0\0\4\0\0\0\20"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__CCM_State_digest_size_defined */

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_digest_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_State_digest_fun_num_used
  f_Nettle_BlockCipher16_cq__CCM_State_digest_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__CCM_State_digest_fun_num_used */
#line 3448 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("digest", f_Nettle_BlockCipher16_cq__CCM_State_digest, tFunc(tOr("\10\0\0\0\4\0\0\0\20",tVoid),tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__CCM_State_digest_defined */
#line 3077 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 3076 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_cq__CCM_State_program=end_program();
#line 3076 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher16_cq__CCM_State_program_fun_num_used
Nettle_BlockCipher16_cq__CCM_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_BlockCipher16_cq__CCM_State_program,0);

#endif /* class_Nettle_BlockCipher16_cq__CCM_State_defined */

#ifdef f_Nettle_BlockCipher16_cq__CCM_name_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_name_fun_num_used
  f_Nettle_BlockCipher16_cq__CCM_name_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__CCM_name_fun_num_used */
#line 3035 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BlockCipher16_cq__CCM_name, tFunc(tNone,tStr8), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher16_cq__CCM_name_defined */

#ifdef f_Nettle_BlockCipher16_cq__CCM_digest_size_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_digest_size_fun_num_used
  f_Nettle_BlockCipher16_cq__CCM_digest_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__CCM_digest_size_fun_num_used */
#line 3054 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("digest_size", f_Nettle_BlockCipher16_cq__CCM_digest_size, tFunc(tNone,"\10\0\0\0\4\0\0\0\20"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__CCM_digest_size_defined */

#ifdef f_Nettle_BlockCipher16_cq__CCM_block_size_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_block_size_fun_num_used
  f_Nettle_BlockCipher16_cq__CCM_block_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__CCM_block_size_fun_num_used */
#line 3059 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("block_size", f_Nettle_BlockCipher16_cq__CCM_block_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__CCM_block_size_defined */

#ifdef f_Nettle_BlockCipher16_cq__CCM_key_size_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_key_size_fun_num_used
  f_Nettle_BlockCipher16_cq__CCM_key_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__CCM_key_size_fun_num_used */
#line 3064 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("key_size", f_Nettle_BlockCipher16_cq__CCM_key_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__CCM_key_size_defined */

#ifdef f_Nettle_BlockCipher16_cq__CCM_iv_size_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM_iv_size_fun_num_used
  f_Nettle_BlockCipher16_cq__CCM_iv_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__CCM_iv_size_fun_num_used */
#line 3069 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("iv_size", f_Nettle_BlockCipher16_cq__CCM_iv_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__CCM_iv_size_defined */
#line 2999 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 2998 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_cq__CCM_program=end_program();
#line 2998 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher16_cq__CCM_program_fun_num_used
Nettle_BlockCipher16_cq__CCM_program_fun_num=
#endif
 add_program_constant("_CCM",Nettle_BlockCipher16_cq__CCM_program,0);

#endif /* class_Nettle_BlockCipher16_cq__CCM_defined */

#ifdef var_CCM8_Nettle_BlockCipher16_defined
  PIKE_MAP_VARIABLE("CCM8", Nettle_BlockCipher16_storage_offset + OFFSETOF(Nettle_BlockCipher16_struct, CCM8),
                    tName("Nettle_AEAD", tObjImpl_NETTLE_AEAD), PIKE_T_OBJECT, 0);
#endif /* var_CCM8_Nettle_BlockCipher16_defined */

#ifdef class_Nettle_BlockCipher16_cq__CCM8_defined

#ifdef PROG_NETTLE_BLOCKCIPHER16_CQ__CCM8_ID
#line 3536 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER16_CQ__CCM8);
#else
#line 3536 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER16_CQ__CCM8_ID */
#line 3536 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_cq__CCM8_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER16_CQ__CCM8

#undef tObjIs_NETTLE_BLOCKCIPHER16_CQ__CCM8
#define tObjIs_NETTLE_BLOCKCIPHER16_CQ__CCM8 "\3\1\177\0\0\25"

#undef tObjImpl_NETTLE_BLOCKCIPHER16_CQ__CCM8
#define tObjImpl_NETTLE_BLOCKCIPHER16_CQ__CCM8 "\3\0\177\0\0\25"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER16_CQ__CCM8 */

#ifdef extra_Nettle_BlockCipher16_cq__CCM8_defined
#line 3542 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
/* Perform an inherit of the _CCM class that our parent contains.
       */
/* FIXME: */
low_inherit(Nettle_BlockCipher16_cq__CCM_program, 0,
Nettle_BlockCipher16_cq__CCM_program_fun_num,
1 + 42, 0, NULL);
}


#endif /* extra_Nettle_BlockCipher16_cq__CCM8_defined */

#ifdef f_Nettle_BlockCipher16_cq__CCM8_name_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM8_name_fun_num_used
  f_Nettle_BlockCipher16_cq__CCM8_name_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__CCM8_name_fun_num_used */
#line 3554 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BlockCipher16_cq__CCM8_name, tFunc(tNone,tStr7), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__CCM8_name_defined */

#ifdef f_Nettle_BlockCipher16_cq__CCM8_digest_size_defined

#ifdef f_Nettle_BlockCipher16_cq__CCM8_digest_size_fun_num_used
  f_Nettle_BlockCipher16_cq__CCM8_digest_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__CCM8_digest_size_fun_num_used */
#line 3568 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("digest_size", f_Nettle_BlockCipher16_cq__CCM8_digest_size, tFunc(tNone,"\10\0\0\0\4\0\0\0\20"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__CCM8_digest_size_defined */
#line 3537 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 3536 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_cq__CCM8_program=end_program();
#line 3536 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher16_cq__CCM8_program_fun_num_used
Nettle_BlockCipher16_cq__CCM8_program_fun_num=
#endif
 add_program_constant("_CCM8",Nettle_BlockCipher16_cq__CCM8_program,0);

#endif /* class_Nettle_BlockCipher16_cq__CCM8_defined */

#ifdef var_EAX_Nettle_BlockCipher16_defined
  PIKE_MAP_VARIABLE("EAX", Nettle_BlockCipher16_storage_offset + OFFSETOF(Nettle_BlockCipher16_struct, EAX),
                    tName("Nettle_AEAD", tObjImpl_NETTLE_AEAD), PIKE_T_OBJECT, 0);
#endif /* var_EAX_Nettle_BlockCipher16_defined */

#ifdef class_Nettle_BlockCipher16_cq__EAX_defined

#ifdef PROG_NETTLE_BLOCKCIPHER16_CQ__EAX_ID
#line 3603 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER16_CQ__EAX);
#else
#line 3603 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER16_CQ__EAX_ID */
#line 3603 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_cq__EAX_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER16_CQ__EAX

#undef tObjIs_NETTLE_BLOCKCIPHER16_CQ__EAX
#define tObjIs_NETTLE_BLOCKCIPHER16_CQ__EAX "\3\1\177\0\0\26"

#undef tObjImpl_NETTLE_BLOCKCIPHER16_CQ__EAX
#define tObjImpl_NETTLE_BLOCKCIPHER16_CQ__EAX "\3\0\177\0\0\26"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER16_CQ__EAX */

#ifdef inherit_cq__22__builtin_2ENettle_2EAEAD_22_Nettle_BlockCipher16_cq__EAX_defined
#line 3608 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_cq__EAX_cq__22__builtin_2ENettle_2EAEAD_22_inh_num = Pike_compiler->new_program->num_inherits;
  do {
#line 3608 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    struct program *p = resolve_program(module_strings[4] /* "__builtin.Nettle.AEAD" */);
    if (p) {
#line 3608 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      low_inherit(p, NULL, -1, 0, 0, NULL);
#line 3608 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      Nettle_BlockCipher16_cq__EAX_cq__22__builtin_2ENettle_2EAEAD_22_inh_offset = Pike_compiler->new_program->inherits[Nettle_BlockCipher16_cq__EAX_cq__22__builtin_2ENettle_2EAEAD_22_inh_num].identifier_level;
#line 3608 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      free_program(p);
    } else {
#line 3608 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      yyerror("Inherit failed.");
    }
  } while(0);
#endif /* inherit_cq__22__builtin_2ENettle_2EAEAD_22_Nettle_BlockCipher16_cq__EAX_defined */

#ifdef class_Nettle_BlockCipher16_cq__EAX_State_defined

#ifdef PROG_NETTLE_BLOCKCIPHER16_CQ__EAX_STATE_ID
#line 3651 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER16_CQ__EAX_STATE);
#else
#line 3651 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER16_CQ__EAX_STATE_ID */
#line 3651 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_cq__EAX_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER16_CQ__EAX_STATE

#undef tObjIs_NETTLE_BLOCKCIPHER16_CQ__EAX_STATE
#define tObjIs_NETTLE_BLOCKCIPHER16_CQ__EAX_STATE "\3\1\177\0\0\27"

#undef tObjImpl_NETTLE_BLOCKCIPHER16_CQ__EAX_STATE
#define tObjImpl_NETTLE_BLOCKCIPHER16_CQ__EAX_STATE "\3\0\177\0\0\27"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER16_CQ__EAX_STATE */

#ifdef THIS_NETTLE_BLOCKCIPHER16_CQ__EAX_STATE
  Nettle_BlockCipher16_cq__EAX_State_storage_offset = ADD_STORAGE(struct Nettle_BlockCipher16_cq__EAX_State_struct);
#endif /* THIS_NETTLE_BLOCKCIPHER16_CQ__EAX_STATE */

#ifdef var_object_Nettle_BlockCipher16_cq__EAX_State_defined
  PIKE_MAP_VARIABLE("object", Nettle_BlockCipher16_cq__EAX_State_storage_offset + OFFSETOF(Nettle_BlockCipher16_cq__EAX_State_struct, object),
                    tObj, PIKE_T_OBJECT, ID_PRIVATE|ID_PROTECTED|ID_HIDDEN);
#endif /* var_object_Nettle_BlockCipher16_cq__EAX_State_defined */

#ifdef extra_Nettle_BlockCipher16_cq__EAX_State_defined
#line 3666 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
/* Perform an inherit of the State class that our parent
	 * contains via its inherit of AEAD.
	 */
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0,
parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_BlockCipher16_cq__EAX_State_defined */

#ifdef Nettle_BlockCipher16_cq__EAX_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_BlockCipher16_cq__EAX_State_event_handler);

#ifndef Nettle_BlockCipher16_cq__EAX_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_BlockCipher16_cq__EAX_State_gc_live_obj */

#endif /* Nettle_BlockCipher16_cq__EAX_State_event_handler_defined */

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_substate_factory_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_substate_factory_fun_num_used
  f_Nettle_BlockCipher16_cq__EAX_State_substate_factory_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__EAX_State_substate_factory_fun_num_used */
#line 3707 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("substate_factory", f_Nettle_BlockCipher16_cq__EAX_State_substate_factory, tFunc(tNone,tName("Nettle_Cipher_State", tObjImpl_NETTLE_CIPHER_STATE)), ID_PROTECTED, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_substate_factory_defined */

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_create_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_create_fun_num_used
  f_Nettle_BlockCipher16_cq__EAX_State_create_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__EAX_State_create_fun_num_used */
#line 3715 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("create", f_Nettle_BlockCipher16_cq__EAX_State_create, tFunc(tNone,tVoid), ID_PROTECTED, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_create_defined */

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_name_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_name_fun_num_used
  f_Nettle_BlockCipher16_cq__EAX_State_name_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__EAX_State_name_fun_num_used */
#line 3772 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BlockCipher16_cq__EAX_State_name, tFunc(tNone,tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_name_defined */

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_block_size_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_block_size_fun_num_used
  f_Nettle_BlockCipher16_cq__EAX_State_block_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__EAX_State_block_size_fun_num_used */
#line 3783 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("block_size", f_Nettle_BlockCipher16_cq__EAX_State_block_size, tFunc(tNone,"\10\0\0\0\20\0\0\0\20"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_block_size_defined */

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_digest_size_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_digest_size_fun_num_used
  f_Nettle_BlockCipher16_cq__EAX_State_digest_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__EAX_State_digest_size_fun_num_used */
#line 3804 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("digest_size", f_Nettle_BlockCipher16_cq__EAX_State_digest_size, tFunc(tNone,"\10\0\0\0\1\0\0\0\20"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_digest_size_defined */

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_iv_size_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_iv_size_fun_num_used
  f_Nettle_BlockCipher16_cq__EAX_State_iv_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__EAX_State_iv_size_fun_num_used */
#line 3817 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("iv_size", f_Nettle_BlockCipher16_cq__EAX_State_iv_size, tFunc(tNone,"\10\0\0\0\20\0\0\0\20"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_iv_size_defined */

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_key_size_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_key_size_fun_num_used
  f_Nettle_BlockCipher16_cq__EAX_State_key_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__EAX_State_key_size_fun_num_used */
    ADD_FUNCTION2("key_size", f_Nettle_BlockCipher16_cq__EAX_State_key_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND);

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_key_size_defined */

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_set_encrypt_key_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_set_encrypt_key_fun_num_used
  f_Nettle_BlockCipher16_cq__EAX_State_set_encrypt_key_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__EAX_State_set_encrypt_key_fun_num_used */
#line 3845 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_encrypt_key", f_Nettle_BlockCipher16_cq__EAX_State_set_encrypt_key, tFunc(tStr8 tOr("\10\200\0\0\0\177\377\377\377",tVoid),tName("Nettle_AEAD_State", tObjImpl_NETTLE_AEAD_STATE)), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_set_encrypt_key_defined */

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_set_decrypt_key_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_set_decrypt_key_fun_num_used
  f_Nettle_BlockCipher16_cq__EAX_State_set_decrypt_key_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__EAX_State_set_decrypt_key_fun_num_used */
#line 3878 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_decrypt_key", f_Nettle_BlockCipher16_cq__EAX_State_set_decrypt_key, tFunc(tStr8 tOr("\10\200\0\0\0\177\377\377\377",tVoid),tName("Nettle_AEAD_State", tObjImpl_NETTLE_AEAD_STATE)), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_set_decrypt_key_defined */

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_set_iv_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_set_iv_fun_num_used
  f_Nettle_BlockCipher16_cq__EAX_State_set_iv_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__EAX_State_set_iv_fun_num_used */
#line 3901 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_iv", f_Nettle_BlockCipher16_cq__EAX_State_set_iv, tFunc(tStr8,tName("Nettle_AEAD_State", tObjImpl_NETTLE_AEAD_STATE)), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_set_iv_defined */

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_update_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_update_fun_num_used
  f_Nettle_BlockCipher16_cq__EAX_State_update_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__EAX_State_update_fun_num_used */
#line 3922 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("update", f_Nettle_BlockCipher16_cq__EAX_State_update, tFunc(tStr8,tName("Nettle_AEAD_State", tObjImpl_NETTLE_AEAD_STATE)), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_update_defined */

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_crypt_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_crypt_fun_num_used
  f_Nettle_BlockCipher16_cq__EAX_State_crypt_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__EAX_State_crypt_fun_num_used */
#line 3942 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("crypt", f_Nettle_BlockCipher16_cq__EAX_State_crypt, tFunc(tStr8,tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_crypt_defined */

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_digest_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_State_digest_fun_num_used
  f_Nettle_BlockCipher16_cq__EAX_State_digest_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__EAX_State_digest_fun_num_used */
#line 3984 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("digest", f_Nettle_BlockCipher16_cq__EAX_State_digest, tFunc(tOr("\10\0\0\0\1\0\0\0\20",tVoid),tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__EAX_State_digest_defined */
#line 3652 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT|PROGRAM_CLEAR_STORAGE;
#line 3651 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_cq__EAX_State_program=end_program();
#line 3651 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher16_cq__EAX_State_program_fun_num_used
Nettle_BlockCipher16_cq__EAX_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_BlockCipher16_cq__EAX_State_program,0);

#endif /* class_Nettle_BlockCipher16_cq__EAX_State_defined */

#ifdef f_Nettle_BlockCipher16_cq__EAX_name_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_name_fun_num_used
  f_Nettle_BlockCipher16_cq__EAX_name_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__EAX_name_fun_num_used */
#line 3613 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BlockCipher16_cq__EAX_name, tFunc(tNone,tStr8), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher16_cq__EAX_name_defined */

#ifdef f_Nettle_BlockCipher16_cq__EAX_digest_size_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_digest_size_fun_num_used
  f_Nettle_BlockCipher16_cq__EAX_digest_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__EAX_digest_size_fun_num_used */
#line 3629 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("digest_size", f_Nettle_BlockCipher16_cq__EAX_digest_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__EAX_digest_size_defined */

#ifdef f_Nettle_BlockCipher16_cq__EAX_block_size_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_block_size_fun_num_used
  f_Nettle_BlockCipher16_cq__EAX_block_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__EAX_block_size_fun_num_used */
#line 3634 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("block_size", f_Nettle_BlockCipher16_cq__EAX_block_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__EAX_block_size_defined */

#ifdef f_Nettle_BlockCipher16_cq__EAX_key_size_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_key_size_fun_num_used
  f_Nettle_BlockCipher16_cq__EAX_key_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__EAX_key_size_fun_num_used */
#line 3639 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("key_size", f_Nettle_BlockCipher16_cq__EAX_key_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__EAX_key_size_defined */

#ifdef f_Nettle_BlockCipher16_cq__EAX_iv_size_defined

#ifdef f_Nettle_BlockCipher16_cq__EAX_iv_size_fun_num_used
  f_Nettle_BlockCipher16_cq__EAX_iv_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__EAX_iv_size_fun_num_used */
#line 3644 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("iv_size", f_Nettle_BlockCipher16_cq__EAX_iv_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__EAX_iv_size_defined */
#line 3604 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 3603 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_cq__EAX_program=end_program();
#line 3603 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher16_cq__EAX_program_fun_num_used
Nettle_BlockCipher16_cq__EAX_program_fun_num=
#endif
 add_program_constant("_EAX",Nettle_BlockCipher16_cq__EAX_program,0);

#endif /* class_Nettle_BlockCipher16_cq__EAX_defined */

#ifdef class_Nettle_BlockCipher16_cq__GCM_defined

#ifdef PROG_NETTLE_BLOCKCIPHER16_CQ__GCM_ID
#line 4055 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER16_CQ__GCM);
#else
#line 4055 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER16_CQ__GCM_ID */
#line 4055 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_cq__GCM_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER16_CQ__GCM

#undef tObjIs_NETTLE_BLOCKCIPHER16_CQ__GCM
#define tObjIs_NETTLE_BLOCKCIPHER16_CQ__GCM "\3\1\177\0\0\30"

#undef tObjImpl_NETTLE_BLOCKCIPHER16_CQ__GCM
#define tObjImpl_NETTLE_BLOCKCIPHER16_CQ__GCM "\3\0\177\0\0\30"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER16_CQ__GCM */

#ifdef inherit_cq__22__builtin_2ENettle_2EAEAD_22_Nettle_BlockCipher16_cq__GCM_defined
#line 4060 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_cq__GCM_cq__22__builtin_2ENettle_2EAEAD_22_inh_num = Pike_compiler->new_program->num_inherits;
  do {
#line 4060 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    struct program *p = resolve_program(module_strings[4] /* "__builtin.Nettle.AEAD" */);
    if (p) {
#line 4060 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      low_inherit(p, NULL, -1, 0, 0, NULL);
#line 4060 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      Nettle_BlockCipher16_cq__GCM_cq__22__builtin_2ENettle_2EAEAD_22_inh_offset = Pike_compiler->new_program->inherits[Nettle_BlockCipher16_cq__GCM_cq__22__builtin_2ENettle_2EAEAD_22_inh_num].identifier_level;
#line 4060 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      free_program(p);
    } else {
#line 4060 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
      yyerror("Inherit failed.");
    }
  } while(0);
#endif /* inherit_cq__22__builtin_2ENettle_2EAEAD_22_Nettle_BlockCipher16_cq__GCM_defined */

#ifdef class_Nettle_BlockCipher16_cq__GCM_State_defined

#ifdef PROG_NETTLE_BLOCKCIPHER16_CQ__GCM_STATE_ID
#line 4115 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_BLOCKCIPHER16_CQ__GCM_STATE);
#else
#line 4115 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_BLOCKCIPHER16_CQ__GCM_STATE_ID */
#line 4115 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_cq__GCM_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOCKCIPHER16_CQ__GCM_STATE

#undef tObjIs_NETTLE_BLOCKCIPHER16_CQ__GCM_STATE
#define tObjIs_NETTLE_BLOCKCIPHER16_CQ__GCM_STATE "\3\1\177\0\0\31"

#undef tObjImpl_NETTLE_BLOCKCIPHER16_CQ__GCM_STATE
#define tObjImpl_NETTLE_BLOCKCIPHER16_CQ__GCM_STATE "\3\0\177\0\0\31"

#endif /* tObjImpl_NETTLE_BLOCKCIPHER16_CQ__GCM_STATE */

#ifdef THIS_NETTLE_BLOCKCIPHER16_CQ__GCM_STATE
  Nettle_BlockCipher16_cq__GCM_State_storage_offset = ADD_STORAGE(struct Nettle_BlockCipher16_cq__GCM_State_struct);
#endif /* THIS_NETTLE_BLOCKCIPHER16_CQ__GCM_STATE */

#ifdef extra_Nettle_BlockCipher16_cq__GCM_State_defined
#line 4122 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
/* Perform an inherit of the State class (if any) that our parent
	 * may contain via its inherit of __builtin.Nettle.AEAD.
	 */
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0,
parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_BlockCipher16_cq__GCM_State_defined */

#ifdef var_object_Nettle_BlockCipher16_cq__GCM_State_defined
  PIKE_MAP_VARIABLE("object", Nettle_BlockCipher16_cq__GCM_State_storage_offset + OFFSETOF(Nettle_BlockCipher16_cq__GCM_State_struct, object),
                    tObj, PIKE_T_OBJECT, ID_PRIVATE|ID_PROTECTED|ID_HIDDEN);
#endif /* var_object_Nettle_BlockCipher16_cq__GCM_State_defined */

#ifdef Nettle_BlockCipher16_cq__GCM_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_BlockCipher16_cq__GCM_State_event_handler);

#ifndef Nettle_BlockCipher16_cq__GCM_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_BlockCipher16_cq__GCM_State_gc_live_obj */

#endif /* Nettle_BlockCipher16_cq__GCM_State_event_handler_defined */

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_substate_factory_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_substate_factory_fun_num_used
  f_Nettle_BlockCipher16_cq__GCM_State_substate_factory_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__GCM_State_substate_factory_fun_num_used */
#line 4180 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("substate_factory", f_Nettle_BlockCipher16_cq__GCM_State_substate_factory, tFunc(tNone,tName("Nettle_Cipher_State", tObjImpl_NETTLE_CIPHER_STATE)), ID_PROTECTED, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_substate_factory_defined */

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_create_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_create_fun_num_used
  f_Nettle_BlockCipher16_cq__GCM_State_create_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__GCM_State_create_fun_num_used */
#line 4192 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("create", f_Nettle_BlockCipher16_cq__GCM_State_create, tFunc(tNone,tVoid), ID_PROTECTED, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_create_defined */

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_name_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_name_fun_num_used
  f_Nettle_BlockCipher16_cq__GCM_State_name_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__GCM_State_name_fun_num_used */
#line 4244 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BlockCipher16_cq__GCM_State_name, tFunc(tNone,tStr8), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_name_defined */

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_block_size_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_block_size_fun_num_used
  f_Nettle_BlockCipher16_cq__GCM_State_block_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__GCM_State_block_size_fun_num_used */
#line 4256 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("block_size", f_Nettle_BlockCipher16_cq__GCM_State_block_size, tFunc(tNone,"\10\0\0\0\20\0\0\0\20"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_block_size_defined */

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_digest_size_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_digest_size_fun_num_used
  f_Nettle_BlockCipher16_cq__GCM_State_digest_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__GCM_State_digest_size_fun_num_used */
#line 4266 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("digest_size", f_Nettle_BlockCipher16_cq__GCM_State_digest_size, tFunc(tNone,"\10\0\0\0\20\0\0\0\20"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_digest_size_defined */

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_iv_size_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_iv_size_fun_num_used
  f_Nettle_BlockCipher16_cq__GCM_State_iv_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__GCM_State_iv_size_fun_num_used */
#line 4279 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("iv_size", f_Nettle_BlockCipher16_cq__GCM_State_iv_size, tFunc(tNone,"\10\0\0\0\14\0\0\0\14"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_iv_size_defined */

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_key_size_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_key_size_fun_num_used
  f_Nettle_BlockCipher16_cq__GCM_State_key_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__GCM_State_key_size_fun_num_used */
    ADD_FUNCTION2("key_size", f_Nettle_BlockCipher16_cq__GCM_State_key_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND);

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_key_size_defined */

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_set_encrypt_key_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_set_encrypt_key_fun_num_used
  f_Nettle_BlockCipher16_cq__GCM_State_set_encrypt_key_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__GCM_State_set_encrypt_key_fun_num_used */
#line 4307 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_encrypt_key", f_Nettle_BlockCipher16_cq__GCM_State_set_encrypt_key, tFunc(tStr8 tOr("\10\200\0\0\0\177\377\377\377",tVoid),tObj), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_set_encrypt_key_defined */

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_set_decrypt_key_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_set_decrypt_key_fun_num_used
  f_Nettle_BlockCipher16_cq__GCM_State_set_decrypt_key_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__GCM_State_set_decrypt_key_fun_num_used */
#line 4339 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_decrypt_key", f_Nettle_BlockCipher16_cq__GCM_State_set_decrypt_key, tFunc(tStr8 tOr("\10\200\0\0\0\177\377\377\377",tVoid),tObj), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_set_decrypt_key_defined */

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_set_iv_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_set_iv_fun_num_used
  f_Nettle_BlockCipher16_cq__GCM_State_set_iv_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__GCM_State_set_iv_fun_num_used */
#line 4375 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_iv", f_Nettle_BlockCipher16_cq__GCM_State_set_iv, tFunc(tStr8,tObj), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_set_iv_defined */

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_update_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_update_fun_num_used
  f_Nettle_BlockCipher16_cq__GCM_State_update_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__GCM_State_update_fun_num_used */
#line 4398 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("update", f_Nettle_BlockCipher16_cq__GCM_State_update, tFunc(tStr8,tVoid), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_update_defined */

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_crypt_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_crypt_fun_num_used
  f_Nettle_BlockCipher16_cq__GCM_State_crypt_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__GCM_State_crypt_fun_num_used */
#line 4443 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("crypt", f_Nettle_BlockCipher16_cq__GCM_State_crypt, tFunc(tStr8,tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_crypt_defined */

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_digest_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_State_digest_fun_num_used
  f_Nettle_BlockCipher16_cq__GCM_State_digest_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__GCM_State_digest_fun_num_used */
#line 4516 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("digest", f_Nettle_BlockCipher16_cq__GCM_State_digest, tFunc(tNone,tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__GCM_State_digest_defined */
#line 4116 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_USES_PARENT|PROGRAM_NEEDS_PARENT|PROGRAM_CLEAR_STORAGE;
#line 4115 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_cq__GCM_State_program=end_program();
#line 4115 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher16_cq__GCM_State_program_fun_num_used
Nettle_BlockCipher16_cq__GCM_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_BlockCipher16_cq__GCM_State_program,0);

#endif /* class_Nettle_BlockCipher16_cq__GCM_State_defined */

#ifdef f_Nettle_BlockCipher16_cq__GCM_name_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_name_fun_num_used
  f_Nettle_BlockCipher16_cq__GCM_name_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__GCM_name_fun_num_used */
#line 4065 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("name", f_Nettle_BlockCipher16_cq__GCM_name, tFunc(tNone,tStr8), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher16_cq__GCM_name_defined */

#ifdef f_Nettle_BlockCipher16_cq__GCM_key_size_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_key_size_fun_num_used
  f_Nettle_BlockCipher16_cq__GCM_key_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__GCM_key_size_fun_num_used */
#line 4073 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("key_size", f_Nettle_BlockCipher16_cq__GCM_key_size, tFunc(tNone,"\10\0\0\0\1\177\377\377\377"), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_BlockCipher16_cq__GCM_key_size_defined */

#ifdef f_Nettle_BlockCipher16_cq__GCM_block_size_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_block_size_fun_num_used
  f_Nettle_BlockCipher16_cq__GCM_block_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__GCM_block_size_fun_num_used */
    ADD_FUNCTION2("block_size", f_Nettle_BlockCipher16_cq__GCM_block_size, tFunc(tNone,"\10\0\0\0\20\0\0\0\20"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher16_cq__GCM_block_size_defined */

#ifdef f_Nettle_BlockCipher16_cq__GCM_digest_size_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_digest_size_fun_num_used
  f_Nettle_BlockCipher16_cq__GCM_digest_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__GCM_digest_size_fun_num_used */
#line 4092 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("digest_size", f_Nettle_BlockCipher16_cq__GCM_digest_size, tFunc(tNone,"\10\0\0\0\20\0\0\0\20"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher16_cq__GCM_digest_size_defined */

#ifdef f_Nettle_BlockCipher16_cq__GCM_iv_size_defined

#ifdef f_Nettle_BlockCipher16_cq__GCM_iv_size_fun_num_used
  f_Nettle_BlockCipher16_cq__GCM_iv_size_fun_num =
#endif /* f_Nettle_BlockCipher16_cq__GCM_iv_size_fun_num_used */
#line 4105 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("iv_size", f_Nettle_BlockCipher16_cq__GCM_iv_size, tFunc(tNone,"\10\0\0\0\14\0\0\0\14"), 0, OPT_TRY_OPTIMIZE);

#endif /* f_Nettle_BlockCipher16_cq__GCM_iv_size_defined */
#line 4056 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 4055 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_cq__GCM_program=end_program();
#line 4055 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher16_cq__GCM_program_fun_num_used
Nettle_BlockCipher16_cq__GCM_program_fun_num=
#endif
 add_program_constant("_GCM",Nettle_BlockCipher16_cq__GCM_program,0);

#endif /* class_Nettle_BlockCipher16_cq__GCM_defined */

#ifdef Nettle_BlockCipher16_event_handler_defined
  pike_set_prog_event_callback(Nettle_BlockCipher16_event_handler);

#ifndef Nettle_BlockCipher16_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_BlockCipher16_gc_live_obj */

#endif /* Nettle_BlockCipher16_event_handler_defined */
#line 2958 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_BlockCipher16_program=end_program();
#line 2958 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_BlockCipher16_program_fun_num_used
Nettle_BlockCipher16_program_fun_num=
#endif
 add_program_constant("BlockCipher16",Nettle_BlockCipher16_program,0);

#endif /* class_Nettle_BlockCipher16_defined */

#ifdef class_Nettle_AES_defined

#ifdef PROG_NETTLE_AES_ID
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_AES);
#else
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_AES_ID */
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_AES_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_AES

#undef tObjIs_NETTLE_AES
#define tObjIs_NETTLE_AES "\3\1\177\0\0\32"

#undef tObjImpl_NETTLE_AES
#define tObjImpl_NETTLE_AES "\3\0\177\0\0\32"

#endif /* tObjImpl_NETTLE_AES */

#ifdef inherit_Nettle_BlockCipher16_Nettle_AES_defined
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_AES_Nettle_BlockCipher16_inh_num = Pike_compiler->new_program->num_inherits;
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  low_inherit(Nettle_BlockCipher16_program, NULL, -1, 0, 0, NULL);
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_AES_Nettle_BlockCipher16_inh_offset = Pike_compiler->new_program->inherits[Nettle_AES_Nettle_BlockCipher16_inh_num].identifier_level;

#endif /* inherit_Nettle_BlockCipher16_Nettle_AES_defined */

#ifdef class_Nettle_AES_State_defined

#ifdef PROG_NETTLE_AES_STATE_ID
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_AES_STATE);
#else
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_AES_STATE_ID */
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_AES_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_AES_STATE

#undef tObjIs_NETTLE_AES_STATE
#define tObjIs_NETTLE_AES_STATE "\3\1\177\0\0\33"

#undef tObjImpl_NETTLE_AES_STATE
#define tObjImpl_NETTLE_AES_STATE "\3\0\177\0\0\33"

#endif /* tObjImpl_NETTLE_AES_STATE */

#ifdef THIS_NETTLE_AES_STATE
  Nettle_AES_State_storage_offset = ADD_STORAGE(struct Nettle_AES_State_struct);
#endif /* THIS_NETTLE_AES_STATE */

#ifdef extra_Nettle_AES_State_defined
#line 66 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
/* Perform an inherit of the Cipher.State class that our parent
* contains via its inherit of BlockCipher16.
*/
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0, parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_AES_State_defined */

#ifdef Nettle_AES_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_AES_State_event_handler);

#ifndef Nettle_AES_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_AES_State_gc_live_obj */

#endif /* Nettle_AES_State_event_handler_defined */
#line 60 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_AES_State_program=end_program();
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#ifdef Nettle_AES_State_program_fun_num_used
Nettle_AES_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_AES_State_program,0);

#endif /* class_Nettle_AES_State_defined */

#ifdef Nettle_AES_event_handler_defined
  pike_set_prog_event_callback(Nettle_AES_event_handler);

#ifndef Nettle_AES_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_AES_gc_live_obj */

#endif /* Nettle_AES_event_handler_defined */
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_AES_program=end_program();
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#ifdef Nettle_AES_program_fun_num_used
Nettle_AES_program_fun_num=
#endif
 add_program_constant("AES",Nettle_AES_program,0);

#endif /* class_Nettle_AES_defined */

#ifdef class_Nettle_ARCTWO_defined

#ifdef PROG_NETTLE_ARCTWO_ID
#line 4647 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  START_NEW_PROGRAM_ID(NETTLE_ARCTWO);
#else
#line 4647 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  start_new_program();

#endif /* PROG_NETTLE_ARCTWO_ID */
#line 4647 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_ARCTWO_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_ARCTWO

#undef tObjIs_NETTLE_ARCTWO
#define tObjIs_NETTLE_ARCTWO "\3\1\177\0\0\34"

#undef tObjImpl_NETTLE_ARCTWO
#define tObjImpl_NETTLE_ARCTWO "\3\0\177\0\0\34"

#endif /* tObjImpl_NETTLE_ARCTWO */

#ifdef inherit_Nettle_BlockCipher_Nettle_ARCTWO_defined
#line 4651 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_ARCTWO_Nettle_BlockCipher_inh_num = Pike_compiler->new_program->num_inherits;
#line 4651 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  low_inherit(Nettle_BlockCipher_program, NULL, -1, 0, 0, NULL);
#line 4651 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_ARCTWO_Nettle_BlockCipher_inh_offset = Pike_compiler->new_program->inherits[Nettle_ARCTWO_Nettle_BlockCipher_inh_num].identifier_level;

#endif /* inherit_Nettle_BlockCipher_Nettle_ARCTWO_defined */

#ifdef class_Nettle_ARCTWO_State_defined

#ifdef PROG_NETTLE_ARCTWO_STATE_ID
#line 4670 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  START_NEW_PROGRAM_ID(NETTLE_ARCTWO_STATE);
#else
#line 4670 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  start_new_program();

#endif /* PROG_NETTLE_ARCTWO_STATE_ID */
#line 4670 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_ARCTWO_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_ARCTWO_STATE

#undef tObjIs_NETTLE_ARCTWO_STATE
#define tObjIs_NETTLE_ARCTWO_STATE "\3\1\177\0\0\35"

#undef tObjImpl_NETTLE_ARCTWO_STATE
#define tObjImpl_NETTLE_ARCTWO_STATE "\3\0\177\0\0\35"

#endif /* tObjImpl_NETTLE_ARCTWO_STATE */

#ifdef THIS_NETTLE_ARCTWO_STATE
  Nettle_ARCTWO_State_storage_offset = ADD_STORAGE(struct Nettle_ARCTWO_State_struct);
#endif /* THIS_NETTLE_ARCTWO_STATE */

#ifdef extra_Nettle_ARCTWO_State_defined
#line 4680 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
/* Perform an inherit of the Cipher.State class that our parent
       * contains via its inherit of Cipher.
       */
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0,
parent_State_fun_num,
1 + 42, 0, NULL);
f_ARCTWO_State_inherited_set_encrypt_key_fun_num =
really_low_reference_inherited_identifier(NULL, 1,
f_Nettle_Cipher_State_set_encrypt_key_fun_num);
f_ARCTWO_State_inherited_set_decrypt_key_fun_num =
really_low_reference_inherited_identifier(NULL, 1,
f_Nettle_Cipher_State_set_decrypt_key_fun_num);
}
}
}


#endif /* extra_Nettle_ARCTWO_State_defined */

#ifdef Nettle_ARCTWO_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_ARCTWO_State_event_handler);

#ifndef Nettle_ARCTWO_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_ARCTWO_State_gc_live_obj */

#endif /* Nettle_ARCTWO_State_event_handler_defined */

#ifdef f_Nettle_ARCTWO_State_set_encrypt_key_defined

#ifdef f_Nettle_ARCTWO_State_set_encrypt_key_fun_num_used
  f_Nettle_ARCTWO_State_set_encrypt_key_fun_num =
#endif /* f_Nettle_ARCTWO_State_set_encrypt_key_fun_num_used */
#line 4739 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_encrypt_key", f_Nettle_ARCTWO_State_set_encrypt_key, tFunc(tStr8 tOr(tInt, tVoid), tObjImpl_NETTLE_CIPHER_STATE), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_ARCTWO_State_set_encrypt_key_defined */

#ifdef f_Nettle_ARCTWO_State_set_decrypt_key_defined

#ifdef f_Nettle_ARCTWO_State_set_decrypt_key_fun_num_used
  f_Nettle_ARCTWO_State_set_decrypt_key_fun_num =
#endif /* f_Nettle_ARCTWO_State_set_decrypt_key_fun_num_used */
#line 4771 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_decrypt_key", f_Nettle_ARCTWO_State_set_decrypt_key, tFunc(tStr8 tOr(tInt, tVoid), tObjImpl_NETTLE_CIPHER_STATE), 0, OPT_SIDE_EFFECT);

#endif /* f_Nettle_ARCTWO_State_set_decrypt_key_defined */
#line 4671 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 4670 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_ARCTWO_State_program=end_program();
#line 4670 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_ARCTWO_State_program_fun_num_used
Nettle_ARCTWO_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_ARCTWO_State_program,0);

#endif /* class_Nettle_ARCTWO_State_defined */

#ifdef Nettle_ARCTWO_event_handler_defined
  pike_set_prog_event_callback(Nettle_ARCTWO_event_handler);

#ifndef Nettle_ARCTWO_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_ARCTWO_gc_live_obj */

#endif /* Nettle_ARCTWO_event_handler_defined */
#line 4647 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_ARCTWO_program=end_program();
#line 4647 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_ARCTWO_program_fun_num_used
Nettle_ARCTWO_program_fun_num=
#endif
 add_program_constant("ARCTWO",Nettle_ARCTWO_program,0);

#endif /* class_Nettle_ARCTWO_defined */

#ifdef class_Nettle_ARCFOUR_defined

#ifdef PROG_NETTLE_ARCFOUR_ID
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_ARCFOUR);
#else
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_ARCFOUR_ID */
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_ARCFOUR_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_ARCFOUR

#undef tObjIs_NETTLE_ARCFOUR
#define tObjIs_NETTLE_ARCFOUR "\3\1\177\0\0\36"

#undef tObjImpl_NETTLE_ARCFOUR
#define tObjImpl_NETTLE_ARCFOUR "\3\0\177\0\0\36"

#endif /* tObjImpl_NETTLE_ARCFOUR */

#ifdef inherit_Nettle_Cipher_Nettle_ARCFOUR_defined
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_ARCFOUR_Nettle_Cipher_inh_num = Pike_compiler->new_program->num_inherits;
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  low_inherit(Nettle_Cipher_program, NULL, -1, 0, 0, NULL);
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_ARCFOUR_Nettle_Cipher_inh_offset = Pike_compiler->new_program->inherits[Nettle_ARCFOUR_Nettle_Cipher_inh_num].identifier_level;

#endif /* inherit_Nettle_Cipher_Nettle_ARCFOUR_defined */

#ifdef class_Nettle_ARCFOUR_State_defined

#ifdef PROG_NETTLE_ARCFOUR_STATE_ID
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_ARCFOUR_STATE);
#else
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_ARCFOUR_STATE_ID */
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_ARCFOUR_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_ARCFOUR_STATE

#undef tObjIs_NETTLE_ARCFOUR_STATE
#define tObjIs_NETTLE_ARCFOUR_STATE "\3\1\177\0\0\37"

#undef tObjImpl_NETTLE_ARCFOUR_STATE
#define tObjImpl_NETTLE_ARCFOUR_STATE "\3\0\177\0\0\37"

#endif /* tObjImpl_NETTLE_ARCFOUR_STATE */

#ifdef THIS_NETTLE_ARCFOUR_STATE
  Nettle_ARCFOUR_State_storage_offset = ADD_STORAGE(struct Nettle_ARCFOUR_State_struct);
#endif /* THIS_NETTLE_ARCFOUR_STATE */

#ifdef extra_Nettle_ARCFOUR_State_defined
#line 66 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
/* Perform an inherit of the Cipher.State class that our parent
* contains via its inherit of Cipher.
*/
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0, parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_ARCFOUR_State_defined */

#ifdef Nettle_ARCFOUR_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_ARCFOUR_State_event_handler);

#ifndef Nettle_ARCFOUR_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_ARCFOUR_State_gc_live_obj */

#endif /* Nettle_ARCFOUR_State_event_handler_defined */
#line 60 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_ARCFOUR_State_program=end_program();
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#ifdef Nettle_ARCFOUR_State_program_fun_num_used
Nettle_ARCFOUR_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_ARCFOUR_State_program,0);

#endif /* class_Nettle_ARCFOUR_State_defined */

#ifdef Nettle_ARCFOUR_event_handler_defined
  pike_set_prog_event_callback(Nettle_ARCFOUR_event_handler);

#ifndef Nettle_ARCFOUR_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_ARCFOUR_gc_live_obj */

#endif /* Nettle_ARCFOUR_event_handler_defined */
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_ARCFOUR_program=end_program();
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#ifdef Nettle_ARCFOUR_program_fun_num_used
Nettle_ARCFOUR_program_fun_num=
#endif
 add_program_constant("ARCFOUR",Nettle_ARCFOUR_program,0);

#endif /* class_Nettle_ARCFOUR_defined */

#ifdef class_Nettle_BLOWFISH_defined

#ifdef PROG_NETTLE_BLOWFISH_ID
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  START_NEW_PROGRAM_ID(NETTLE_BLOWFISH);
#else
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  start_new_program();

#endif /* PROG_NETTLE_BLOWFISH_ID */
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_BLOWFISH_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOWFISH

#undef tObjIs_NETTLE_BLOWFISH
#define tObjIs_NETTLE_BLOWFISH "\3\1\177\0\0 "

#undef tObjImpl_NETTLE_BLOWFISH
#define tObjImpl_NETTLE_BLOWFISH "\3\0\177\0\0 "

#endif /* tObjImpl_NETTLE_BLOWFISH */

#ifdef inherit_Nettle_BlockCipher_Nettle_BLOWFISH_defined
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_BLOWFISH_Nettle_BlockCipher_inh_num = Pike_compiler->new_program->num_inherits;
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  low_inherit(Nettle_BlockCipher_program, NULL, -1, 0, 0, NULL);
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_BLOWFISH_Nettle_BlockCipher_inh_offset = Pike_compiler->new_program->inherits[Nettle_BLOWFISH_Nettle_BlockCipher_inh_num].identifier_level;

#endif /* inherit_Nettle_BlockCipher_Nettle_BLOWFISH_defined */

#ifdef class_Nettle_BLOWFISH_State_defined

#ifdef PROG_NETTLE_BLOWFISH_STATE_ID
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  START_NEW_PROGRAM_ID(NETTLE_BLOWFISH_STATE);
#else
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  start_new_program();

#endif /* PROG_NETTLE_BLOWFISH_STATE_ID */
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_BLOWFISH_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_BLOWFISH_STATE

#undef tObjIs_NETTLE_BLOWFISH_STATE
#define tObjIs_NETTLE_BLOWFISH_STATE "\3\1\177\0\0!"

#undef tObjImpl_NETTLE_BLOWFISH_STATE
#define tObjImpl_NETTLE_BLOWFISH_STATE "\3\0\177\0\0!"

#endif /* tObjImpl_NETTLE_BLOWFISH_STATE */

#ifdef THIS_NETTLE_BLOWFISH_STATE
  Nettle_BLOWFISH_State_storage_offset = ADD_STORAGE(struct Nettle_BLOWFISH_State_struct);
#endif /* THIS_NETTLE_BLOWFISH_STATE */

#ifdef extra_Nettle_BLOWFISH_State_defined
#line 66 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
/* Perform an inherit of the Cipher.State class that our parent
* contains via its inherit of BlockCipher.
*/
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0, parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_BLOWFISH_State_defined */

#ifdef Nettle_BLOWFISH_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_BLOWFISH_State_event_handler);

#ifndef Nettle_BLOWFISH_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_BLOWFISH_State_gc_live_obj */

#endif /* Nettle_BLOWFISH_State_event_handler_defined */
#line 60 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_BLOWFISH_State_program=end_program();
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#ifdef Nettle_BLOWFISH_State_program_fun_num_used
Nettle_BLOWFISH_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_BLOWFISH_State_program,0);

#endif /* class_Nettle_BLOWFISH_State_defined */

#ifdef Nettle_BLOWFISH_event_handler_defined
  pike_set_prog_event_callback(Nettle_BLOWFISH_event_handler);

#ifndef Nettle_BLOWFISH_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_BLOWFISH_gc_live_obj */

#endif /* Nettle_BLOWFISH_event_handler_defined */
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_BLOWFISH_program=end_program();
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#ifdef Nettle_BLOWFISH_program_fun_num_used
Nettle_BLOWFISH_program_fun_num=
#endif
 add_program_constant("BLOWFISH",Nettle_BLOWFISH_program,0);

#endif /* class_Nettle_BLOWFISH_defined */

#ifdef class_Nettle_CAMELLIA_defined

#ifdef PROG_NETTLE_CAMELLIA_ID
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  START_NEW_PROGRAM_ID(NETTLE_CAMELLIA);
#else
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  start_new_program();

#endif /* PROG_NETTLE_CAMELLIA_ID */
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_CAMELLIA_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_CAMELLIA

#undef tObjIs_NETTLE_CAMELLIA
#define tObjIs_NETTLE_CAMELLIA "\3\1\177\0\0\""

#undef tObjImpl_NETTLE_CAMELLIA
#define tObjImpl_NETTLE_CAMELLIA "\3\0\177\0\0\""

#endif /* tObjImpl_NETTLE_CAMELLIA */

#ifdef inherit_Nettle_BlockCipher16_Nettle_CAMELLIA_defined
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_CAMELLIA_Nettle_BlockCipher16_inh_num = Pike_compiler->new_program->num_inherits;
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  low_inherit(Nettle_BlockCipher16_program, NULL, -1, 0, 0, NULL);
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_CAMELLIA_Nettle_BlockCipher16_inh_offset = Pike_compiler->new_program->inherits[Nettle_CAMELLIA_Nettle_BlockCipher16_inh_num].identifier_level;

#endif /* inherit_Nettle_BlockCipher16_Nettle_CAMELLIA_defined */

#ifdef class_Nettle_CAMELLIA_State_defined

#ifdef PROG_NETTLE_CAMELLIA_STATE_ID
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  START_NEW_PROGRAM_ID(NETTLE_CAMELLIA_STATE);
#else
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  start_new_program();

#endif /* PROG_NETTLE_CAMELLIA_STATE_ID */
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_CAMELLIA_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_CAMELLIA_STATE

#undef tObjIs_NETTLE_CAMELLIA_STATE
#define tObjIs_NETTLE_CAMELLIA_STATE "\3\1\177\0\0#"

#undef tObjImpl_NETTLE_CAMELLIA_STATE
#define tObjImpl_NETTLE_CAMELLIA_STATE "\3\0\177\0\0#"

#endif /* tObjImpl_NETTLE_CAMELLIA_STATE */

#ifdef THIS_NETTLE_CAMELLIA_STATE
  Nettle_CAMELLIA_State_storage_offset = ADD_STORAGE(struct Nettle_CAMELLIA_State_struct);
#endif /* THIS_NETTLE_CAMELLIA_STATE */

#ifdef extra_Nettle_CAMELLIA_State_defined
#line 66 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
/* Perform an inherit of the Cipher.State class that our parent
* contains via its inherit of BlockCipher16.
*/
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0, parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_CAMELLIA_State_defined */

#ifdef Nettle_CAMELLIA_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_CAMELLIA_State_event_handler);

#ifndef Nettle_CAMELLIA_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_CAMELLIA_State_gc_live_obj */

#endif /* Nettle_CAMELLIA_State_event_handler_defined */
#line 60 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_CAMELLIA_State_program=end_program();
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#ifdef Nettle_CAMELLIA_State_program_fun_num_used
Nettle_CAMELLIA_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_CAMELLIA_State_program,0);

#endif /* class_Nettle_CAMELLIA_State_defined */

#ifdef Nettle_CAMELLIA_event_handler_defined
  pike_set_prog_event_callback(Nettle_CAMELLIA_event_handler);

#ifndef Nettle_CAMELLIA_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_CAMELLIA_gc_live_obj */

#endif /* Nettle_CAMELLIA_event_handler_defined */
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_CAMELLIA_program=end_program();
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#ifdef Nettle_CAMELLIA_program_fun_num_used
Nettle_CAMELLIA_program_fun_num=
#endif
 add_program_constant("CAMELLIA",Nettle_CAMELLIA_program,0);

#endif /* class_Nettle_CAMELLIA_defined */

#ifdef class_Nettle_CAST128_defined

#ifdef PROG_NETTLE_CAST128_ID
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  START_NEW_PROGRAM_ID(NETTLE_CAST128);
#else
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  start_new_program();

#endif /* PROG_NETTLE_CAST128_ID */
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_CAST128_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_CAST128

#undef tObjIs_NETTLE_CAST128
#define tObjIs_NETTLE_CAST128 "\3\1\177\0\0$"

#undef tObjImpl_NETTLE_CAST128
#define tObjImpl_NETTLE_CAST128 "\3\0\177\0\0$"

#endif /* tObjImpl_NETTLE_CAST128 */

#ifdef inherit_Nettle_BlockCipher_Nettle_CAST128_defined
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_CAST128_Nettle_BlockCipher_inh_num = Pike_compiler->new_program->num_inherits;
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  low_inherit(Nettle_BlockCipher_program, NULL, -1, 0, 0, NULL);
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_CAST128_Nettle_BlockCipher_inh_offset = Pike_compiler->new_program->inherits[Nettle_CAST128_Nettle_BlockCipher_inh_num].identifier_level;

#endif /* inherit_Nettle_BlockCipher_Nettle_CAST128_defined */

#ifdef class_Nettle_CAST128_State_defined

#ifdef PROG_NETTLE_CAST128_STATE_ID
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  START_NEW_PROGRAM_ID(NETTLE_CAST128_STATE);
#else
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  start_new_program();

#endif /* PROG_NETTLE_CAST128_STATE_ID */
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_CAST128_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_CAST128_STATE

#undef tObjIs_NETTLE_CAST128_STATE
#define tObjIs_NETTLE_CAST128_STATE "\3\1\177\0\0%"

#undef tObjImpl_NETTLE_CAST128_STATE
#define tObjImpl_NETTLE_CAST128_STATE "\3\0\177\0\0%"

#endif /* tObjImpl_NETTLE_CAST128_STATE */

#ifdef THIS_NETTLE_CAST128_STATE
  Nettle_CAST128_State_storage_offset = ADD_STORAGE(struct Nettle_CAST128_State_struct);
#endif /* THIS_NETTLE_CAST128_STATE */

#ifdef extra_Nettle_CAST128_State_defined
#line 66 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
/* Perform an inherit of the Cipher.State class that our parent
* contains via its inherit of BlockCipher.
*/
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0, parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_CAST128_State_defined */

#ifdef Nettle_CAST128_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_CAST128_State_event_handler);

#ifndef Nettle_CAST128_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_CAST128_State_gc_live_obj */

#endif /* Nettle_CAST128_State_event_handler_defined */
#line 60 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_CAST128_State_program=end_program();
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#ifdef Nettle_CAST128_State_program_fun_num_used
Nettle_CAST128_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_CAST128_State_program,0);

#endif /* class_Nettle_CAST128_State_defined */

#ifdef Nettle_CAST128_event_handler_defined
  pike_set_prog_event_callback(Nettle_CAST128_event_handler);

#ifndef Nettle_CAST128_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_CAST128_gc_live_obj */

#endif /* Nettle_CAST128_event_handler_defined */
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_CAST128_program=end_program();
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#ifdef Nettle_CAST128_program_fun_num_used
Nettle_CAST128_program_fun_num=
#endif
 add_program_constant("CAST128",Nettle_CAST128_program,0);

#endif /* class_Nettle_CAST128_defined */

#ifdef class_Nettle_CHACHA_defined

#ifdef PROG_NETTLE_CHACHA_ID
#line 5025 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  START_NEW_PROGRAM_ID(NETTLE_CHACHA);
#else
#line 5025 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  start_new_program();

#endif /* PROG_NETTLE_CHACHA_ID */
#line 5025 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_CHACHA_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_CHACHA

#undef tObjIs_NETTLE_CHACHA
#define tObjIs_NETTLE_CHACHA "\3\1\177\0\0&"

#undef tObjImpl_NETTLE_CHACHA
#define tObjImpl_NETTLE_CHACHA "\3\0\177\0\0&"

#endif /* tObjImpl_NETTLE_CHACHA */

#ifdef inherit_Nettle_BlockCipher_Nettle_CHACHA_defined
#line 5029 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_CHACHA_Nettle_BlockCipher_inh_num = Pike_compiler->new_program->num_inherits;
#line 5029 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  low_inherit(Nettle_BlockCipher_program, NULL, -1, 0, 0, NULL);
#line 5029 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_CHACHA_Nettle_BlockCipher_inh_offset = Pike_compiler->new_program->inherits[Nettle_CHACHA_Nettle_BlockCipher_inh_num].identifier_level;

#endif /* inherit_Nettle_BlockCipher_Nettle_CHACHA_defined */

#ifdef class_Nettle_CHACHA_State_defined

#ifdef PROG_NETTLE_CHACHA_STATE_ID
#line 5048 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  START_NEW_PROGRAM_ID(NETTLE_CHACHA_STATE);
#else
#line 5048 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  start_new_program();

#endif /* PROG_NETTLE_CHACHA_STATE_ID */
#line 5048 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_CHACHA_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_CHACHA_STATE

#undef tObjIs_NETTLE_CHACHA_STATE
#define tObjIs_NETTLE_CHACHA_STATE "\3\1\177\0\0'"

#undef tObjImpl_NETTLE_CHACHA_STATE
#define tObjImpl_NETTLE_CHACHA_STATE "\3\0\177\0\0'"

#endif /* tObjImpl_NETTLE_CHACHA_STATE */

#ifdef THIS_NETTLE_CHACHA_STATE
  Nettle_CHACHA_State_storage_offset = ADD_STORAGE(struct Nettle_CHACHA_State_struct);
#endif /* THIS_NETTLE_CHACHA_STATE */

#ifdef extra_Nettle_CHACHA_State_defined
#line 5055 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
/* Perform an inherit of the Cipher.State class that our parent
       * contains via its inherit of Cipher.
       */
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0,
parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_CHACHA_State_defined */

#ifdef Nettle_CHACHA_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_CHACHA_State_event_handler);

#ifndef Nettle_CHACHA_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_CHACHA_State_gc_live_obj */

#endif /* Nettle_CHACHA_State_event_handler_defined */

#ifdef f_Nettle_CHACHA_State_crypt_defined

#ifdef f_Nettle_CHACHA_State_crypt_fun_num_used
  f_Nettle_CHACHA_State_crypt_fun_num =
#endif /* f_Nettle_CHACHA_State_crypt_fun_num_used */
#line 5096 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("crypt", f_Nettle_CHACHA_State_crypt, tFunc(tStr8,tStr8), 0, OPT_EXTERNAL_DEPEND | OPT_SIDE_EFFECT);

#endif /* f_Nettle_CHACHA_State_crypt_defined */

#ifdef f_Nettle_CHACHA_State_set_iv_defined

#ifdef f_Nettle_CHACHA_State_set_iv_fun_num_used
  f_Nettle_CHACHA_State_set_iv_fun_num =
#endif /* f_Nettle_CHACHA_State_set_iv_fun_num_used */
#line 5133 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("set_iv", f_Nettle_CHACHA_State_set_iv, tFunc(tStr8, tObjImpl_NETTLE_CIPHER_STATE), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_CHACHA_State_set_iv_defined */
#line 5049 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 5048 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_CHACHA_State_program=end_program();
#line 5048 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_CHACHA_State_program_fun_num_used
Nettle_CHACHA_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_CHACHA_State_program,0);

#endif /* class_Nettle_CHACHA_State_defined */

#ifdef Nettle_CHACHA_event_handler_defined
  pike_set_prog_event_callback(Nettle_CHACHA_event_handler);

#ifndef Nettle_CHACHA_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_CHACHA_gc_live_obj */

#endif /* Nettle_CHACHA_event_handler_defined */
#line 5025 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_CHACHA_program=end_program();
#line 5025 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_CHACHA_program_fun_num_used
Nettle_CHACHA_program_fun_num=
#endif
 add_program_constant("CHACHA",Nettle_CHACHA_program,0);

#endif /* class_Nettle_CHACHA_defined */

#ifdef class_Nettle_DES_defined

#ifdef PROG_NETTLE_DES_ID
#line 5206 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_DES);
#else
#line 5206 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_DES_ID */
#line 5206 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_DES_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_DES

#undef tObjIs_NETTLE_DES
#define tObjIs_NETTLE_DES "\3\1\177\0\0("

#undef tObjImpl_NETTLE_DES
#define tObjImpl_NETTLE_DES "\3\0\177\0\0("

#endif /* tObjImpl_NETTLE_DES */

#ifdef inherit_Nettle_BlockCipher_Nettle_DES_defined
#line 5210 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_DES_Nettle_BlockCipher_inh_num = Pike_compiler->new_program->num_inherits;
#line 5210 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  low_inherit(Nettle_BlockCipher_program, NULL, -1, 0, 0, NULL);
#line 5210 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_DES_Nettle_BlockCipher_inh_offset = Pike_compiler->new_program->inherits[Nettle_DES_Nettle_BlockCipher_inh_num].identifier_level;

#endif /* inherit_Nettle_BlockCipher_Nettle_DES_defined */

#ifdef class_Nettle_DES_State_defined

#ifdef PROG_NETTLE_DES_STATE_ID
#line 5261 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_DES_STATE);
#else
#line 5261 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_DES_STATE_ID */
#line 5261 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_DES_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_DES_STATE

#undef tObjIs_NETTLE_DES_STATE
#define tObjIs_NETTLE_DES_STATE "\3\1\177\0\0)"

#undef tObjImpl_NETTLE_DES_STATE
#define tObjImpl_NETTLE_DES_STATE "\3\0\177\0\0)"

#endif /* tObjImpl_NETTLE_DES_STATE */

#ifdef THIS_NETTLE_DES_STATE
  Nettle_DES_State_storage_offset = ADD_STORAGE(struct Nettle_DES_State_struct);
#endif /* THIS_NETTLE_DES_STATE */

#ifdef extra_Nettle_DES_State_defined
#line 5268 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
/* Perform an inherit of the Cipher.State class that our parent
       * contains via its inherit of Cipher.
       */
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0,
parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_DES_State_defined */

#ifdef Nettle_DES_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_DES_State_event_handler);

#ifndef Nettle_DES_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_DES_State_gc_live_obj */

#endif /* Nettle_DES_State_event_handler_defined */

#ifdef f_Nettle_DES_State_make_key_defined

#ifdef f_Nettle_DES_State_make_key_fun_num_used
  f_Nettle_DES_State_make_key_fun_num =
#endif /* f_Nettle_DES_State_make_key_fun_num_used */
#line 5302 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("make_key", f_Nettle_DES_State_make_key, tFunc(tNone,tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_DES_State_make_key_defined */

#ifdef f_Nettle_DES_State_fix_parity_defined

#ifdef f_Nettle_DES_State_fix_parity_fun_num_used
  f_Nettle_DES_State_fix_parity_fun_num =
#endif /* f_Nettle_DES_State_fix_parity_fun_num_used */
#line 5339 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("fix_parity", f_Nettle_DES_State_fix_parity, tFunc(tStr8,tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_DES_State_fix_parity_defined */
#line 5262 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 5261 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_DES_State_program=end_program();
#line 5261 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_DES_State_program_fun_num_used
Nettle_DES_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_DES_State_program,0);

#endif /* class_Nettle_DES_State_defined */

#ifdef Nettle_DES_event_handler_defined
  pike_set_prog_event_callback(Nettle_DES_event_handler);

#ifndef Nettle_DES_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_DES_gc_live_obj */

#endif /* Nettle_DES_event_handler_defined */

#ifdef f_Nettle_DES_fix_parity_defined

#ifdef f_Nettle_DES_fix_parity_fun_num_used
  f_Nettle_DES_fix_parity_fun_num =
#endif /* f_Nettle_DES_fix_parity_fun_num_used */
#line 5231 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("fix_parity", f_Nettle_DES_fix_parity, tFunc(tStr8,tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_DES_fix_parity_defined */
#line 5206 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_DES_program=end_program();
#line 5206 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_DES_program_fun_num_used
Nettle_DES_program_fun_num=
#endif
 add_program_constant("DES",Nettle_DES_program,0);

#endif /* class_Nettle_DES_defined */

#ifdef class_Nettle_DES3_defined

#ifdef PROG_NETTLE_DES3_ID
#line 5444 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_DES3);
#else
#line 5444 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_DES3_ID */
#line 5444 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_DES3_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_DES3

#undef tObjIs_NETTLE_DES3
#define tObjIs_NETTLE_DES3 "\3\1\177\0\0*"

#undef tObjImpl_NETTLE_DES3
#define tObjImpl_NETTLE_DES3 "\3\0\177\0\0*"

#endif /* tObjImpl_NETTLE_DES3 */

#ifdef inherit_Nettle_BlockCipher_Nettle_DES3_defined
#line 5448 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_DES3_Nettle_BlockCipher_inh_num = Pike_compiler->new_program->num_inherits;
#line 5448 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  low_inherit(Nettle_BlockCipher_program, NULL, -1, 0, 0, NULL);
#line 5448 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_DES3_Nettle_BlockCipher_inh_offset = Pike_compiler->new_program->inherits[Nettle_DES3_Nettle_BlockCipher_inh_num].identifier_level;

#endif /* inherit_Nettle_BlockCipher_Nettle_DES3_defined */

#ifdef class_Nettle_DES3_State_defined

#ifdef PROG_NETTLE_DES3_STATE_ID
#line 5505 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_DES3_STATE);
#else
#line 5505 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_DES3_STATE_ID */
#line 5505 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_DES3_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_DES3_STATE

#undef tObjIs_NETTLE_DES3_STATE
#define tObjIs_NETTLE_DES3_STATE "\3\1\177\0\0+"

#undef tObjImpl_NETTLE_DES3_STATE
#define tObjImpl_NETTLE_DES3_STATE "\3\0\177\0\0+"

#endif /* tObjImpl_NETTLE_DES3_STATE */

#ifdef THIS_NETTLE_DES3_STATE
  Nettle_DES3_State_storage_offset = ADD_STORAGE(struct Nettle_DES3_State_struct);
#endif /* THIS_NETTLE_DES3_STATE */

#ifdef extra_Nettle_DES3_State_defined
#line 5512 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
/* Perform an inherit of the Cipher.State class that our parent
       * contains via its inherit of Cipher.
       */
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0,
parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_DES3_State_defined */

#ifdef Nettle_DES3_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_DES3_State_event_handler);

#ifndef Nettle_DES3_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_DES3_State_gc_live_obj */

#endif /* Nettle_DES3_State_event_handler_defined */

#ifdef f_Nettle_DES3_State_make_key_defined

#ifdef f_Nettle_DES3_State_make_key_fun_num_used
  f_Nettle_DES3_State_make_key_fun_num =
#endif /* f_Nettle_DES3_State_make_key_fun_num_used */
#line 5546 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("make_key", f_Nettle_DES3_State_make_key, tFunc(tNone,tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_DES3_State_make_key_defined */
#line 5506 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 5505 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_DES3_State_program=end_program();
#line 5505 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_DES3_State_program_fun_num_used
Nettle_DES3_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_DES3_State_program,0);

#endif /* class_Nettle_DES3_State_defined */

#ifdef Nettle_DES3_event_handler_defined
  pike_set_prog_event_callback(Nettle_DES3_event_handler);

#ifndef Nettle_DES3_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_DES3_gc_live_obj */

#endif /* Nettle_DES3_event_handler_defined */

#ifdef f_Nettle_DES3_fix_parity_defined

#ifdef f_Nettle_DES3_fix_parity_fun_num_used
  f_Nettle_DES3_fix_parity_fun_num =
#endif /* f_Nettle_DES3_fix_parity_fun_num_used */
#line 5469 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    ADD_FUNCTION2("fix_parity", f_Nettle_DES3_fix_parity, tFunc(tStr8,tStr8), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_DES3_fix_parity_defined */
#line 5444 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_DES3_program=end_program();
#line 5444 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_DES3_program_fun_num_used
Nettle_DES3_program_fun_num=
#endif
 add_program_constant("DES3",Nettle_DES3_program,0);

#endif /* class_Nettle_DES3_defined */

#ifdef class_Nettle_SALSA20_defined

#ifdef PROG_NETTLE_SALSA20_ID
#line 5606 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_SALSA20);
#else
#line 5606 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_SALSA20_ID */
#line 5606 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_SALSA20_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_SALSA20

#undef tObjIs_NETTLE_SALSA20
#define tObjIs_NETTLE_SALSA20 "\3\1\177\0\0,"

#undef tObjImpl_NETTLE_SALSA20
#define tObjImpl_NETTLE_SALSA20 "\3\0\177\0\0,"

#endif /* tObjImpl_NETTLE_SALSA20 */

#ifdef inherit_Nettle_BlockCipher_Nettle_SALSA20_defined
#line 5610 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_SALSA20_Nettle_BlockCipher_inh_num = Pike_compiler->new_program->num_inherits;
#line 5610 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  low_inherit(Nettle_BlockCipher_program, NULL, -1, 0, 0, NULL);
#line 5610 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_SALSA20_Nettle_BlockCipher_inh_offset = Pike_compiler->new_program->inherits[Nettle_SALSA20_Nettle_BlockCipher_inh_num].identifier_level;

#endif /* inherit_Nettle_BlockCipher_Nettle_SALSA20_defined */

#ifdef class_Nettle_SALSA20_State_defined

#ifdef PROG_NETTLE_SALSA20_STATE_ID
#line 5629 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_SALSA20_STATE);
#else
#line 5629 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_SALSA20_STATE_ID */
#line 5629 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_SALSA20_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_SALSA20_STATE

#undef tObjIs_NETTLE_SALSA20_STATE
#define tObjIs_NETTLE_SALSA20_STATE "\3\1\177\0\0-"

#undef tObjImpl_NETTLE_SALSA20_STATE
#define tObjImpl_NETTLE_SALSA20_STATE "\3\0\177\0\0-"

#endif /* tObjImpl_NETTLE_SALSA20_STATE */

#ifdef THIS_NETTLE_SALSA20_STATE
  Nettle_SALSA20_State_storage_offset = ADD_STORAGE(struct Nettle_SALSA20_State_struct);
#endif /* THIS_NETTLE_SALSA20_STATE */

#ifdef extra_Nettle_SALSA20_State_defined
#line 5636 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
{
/* Perform an inherit of the Cipher.State class that our parent
       * contains via its inherit of Cipher.
       */
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0,
parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_SALSA20_State_defined */

#ifdef Nettle_SALSA20_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_SALSA20_State_event_handler);

#ifndef Nettle_SALSA20_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_SALSA20_State_gc_live_obj */

#endif /* Nettle_SALSA20_State_event_handler_defined */

#ifdef f_Nettle_SALSA20_State_set_iv_defined

#ifdef f_Nettle_SALSA20_State_set_iv_fun_num_used
  f_Nettle_SALSA20_State_set_iv_fun_num =
#endif /* f_Nettle_SALSA20_State_set_iv_fun_num_used */
    ADD_FUNCTION2("set_iv", f_Nettle_SALSA20_State_set_iv, tFunc(tStr8, tObjImpl_NETTLE_CIPHER_STATE), 0, OPT_EXTERNAL_DEPEND|OPT_SIDE_EFFECT);

#endif /* f_Nettle_SALSA20_State_set_iv_defined */
#line 5630 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 5629 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_SALSA20_State_program=end_program();
#line 5629 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_SALSA20_State_program_fun_num_used
Nettle_SALSA20_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_SALSA20_State_program,0);

#endif /* class_Nettle_SALSA20_State_defined */

#ifdef Nettle_SALSA20_event_handler_defined
  pike_set_prog_event_callback(Nettle_SALSA20_event_handler);

#ifndef Nettle_SALSA20_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_SALSA20_gc_live_obj */

#endif /* Nettle_SALSA20_event_handler_defined */
#line 5606 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_SALSA20_program=end_program();
#line 5606 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_SALSA20_program_fun_num_used
Nettle_SALSA20_program_fun_num=
#endif
 add_program_constant("SALSA20",Nettle_SALSA20_program,0);

#endif /* class_Nettle_SALSA20_defined */

#ifdef class_Nettle_SALSA20R12_defined

#ifdef PROG_NETTLE_SALSA20R12_ID
#line 5721 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_SALSA20R12);
#else
#line 5721 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_SALSA20R12_ID */
#line 5721 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_SALSA20R12_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_SALSA20R12

#undef tObjIs_NETTLE_SALSA20R12
#define tObjIs_NETTLE_SALSA20R12 "\3\1\177\0\0."

#undef tObjImpl_NETTLE_SALSA20R12
#define tObjImpl_NETTLE_SALSA20R12 "\3\0\177\0\0."

#endif /* tObjImpl_NETTLE_SALSA20R12 */

#ifdef inherit_Nettle_SALSA20_Nettle_SALSA20R12_defined
#line 5725 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_SALSA20R12_Nettle_SALSA20_inh_num = Pike_compiler->new_program->num_inherits;
#line 5725 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  low_inherit(Nettle_SALSA20_program, NULL, -1, 0, 0, NULL);
#line 5725 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_SALSA20R12_Nettle_SALSA20_inh_offset = Pike_compiler->new_program->inherits[Nettle_SALSA20R12_Nettle_SALSA20_inh_num].identifier_level;

#endif /* inherit_Nettle_SALSA20_Nettle_SALSA20R12_defined */

#ifdef Nettle_SALSA20R12_event_handler_defined
  pike_set_prog_event_callback(Nettle_SALSA20R12_event_handler);

#ifndef Nettle_SALSA20R12_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_SALSA20R12_gc_live_obj */

#endif /* Nettle_SALSA20R12_event_handler_defined */
#line 5721 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_SALSA20R12_program=end_program();
#line 5721 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
#ifdef Nettle_SALSA20R12_program_fun_num_used
Nettle_SALSA20R12_program_fun_num=
#endif
 add_program_constant("SALSA20R12",Nettle_SALSA20R12_program,0);

#endif /* class_Nettle_SALSA20R12_defined */

#ifdef class_Nettle_SERPENT_defined

#ifdef PROG_NETTLE_SERPENT_ID
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_SERPENT);
#else
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_SERPENT_ID */
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_SERPENT_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_SERPENT

#undef tObjIs_NETTLE_SERPENT
#define tObjIs_NETTLE_SERPENT "\3\1\177\0\0/"

#undef tObjImpl_NETTLE_SERPENT
#define tObjImpl_NETTLE_SERPENT "\3\0\177\0\0/"

#endif /* tObjImpl_NETTLE_SERPENT */

#ifdef inherit_Nettle_BlockCipher16_Nettle_SERPENT_defined
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_SERPENT_Nettle_BlockCipher16_inh_num = Pike_compiler->new_program->num_inherits;
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  low_inherit(Nettle_BlockCipher16_program, NULL, -1, 0, 0, NULL);
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_SERPENT_Nettle_BlockCipher16_inh_offset = Pike_compiler->new_program->inherits[Nettle_SERPENT_Nettle_BlockCipher16_inh_num].identifier_level;

#endif /* inherit_Nettle_BlockCipher16_Nettle_SERPENT_defined */

#ifdef class_Nettle_SERPENT_State_defined

#ifdef PROG_NETTLE_SERPENT_STATE_ID
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  START_NEW_PROGRAM_ID(NETTLE_SERPENT_STATE);
#else
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  start_new_program();

#endif /* PROG_NETTLE_SERPENT_STATE_ID */
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
  Nettle_SERPENT_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_SERPENT_STATE

#undef tObjIs_NETTLE_SERPENT_STATE
#define tObjIs_NETTLE_SERPENT_STATE "\3\1\177\0\0""0"

#undef tObjImpl_NETTLE_SERPENT_STATE
#define tObjImpl_NETTLE_SERPENT_STATE "\3\0\177\0\0""0"

#endif /* tObjImpl_NETTLE_SERPENT_STATE */

#ifdef THIS_NETTLE_SERPENT_STATE
  Nettle_SERPENT_State_storage_offset = ADD_STORAGE(struct Nettle_SERPENT_State_struct);
#endif /* THIS_NETTLE_SERPENT_STATE */

#ifdef extra_Nettle_SERPENT_State_defined
#line 66 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
/* Perform an inherit of the Cipher.State class that our parent
* contains via its inherit of BlockCipher16.
*/
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0, parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_SERPENT_State_defined */

#ifdef Nettle_SERPENT_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_SERPENT_State_event_handler);

#ifndef Nettle_SERPENT_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_SERPENT_State_gc_live_obj */

#endif /* Nettle_SERPENT_State_event_handler_defined */
#line 60 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_SERPENT_State_program=end_program();
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#ifdef Nettle_SERPENT_State_program_fun_num_used
Nettle_SERPENT_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_SERPENT_State_program,0);

#endif /* class_Nettle_SERPENT_State_defined */

#ifdef Nettle_SERPENT_event_handler_defined
  pike_set_prog_event_callback(Nettle_SERPENT_event_handler);

#ifndef Nettle_SERPENT_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_SERPENT_gc_live_obj */

#endif /* Nettle_SERPENT_event_handler_defined */
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_SERPENT_program=end_program();
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#ifdef Nettle_SERPENT_program_fun_num_used
Nettle_SERPENT_program_fun_num=
#endif
 add_program_constant("SERPENT",Nettle_SERPENT_program,0);

#endif /* class_Nettle_SERPENT_defined */

#ifdef class_Nettle_Twofish_defined

#ifdef PROG_NETTLE_TWOFISH_ID
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  START_NEW_PROGRAM_ID(NETTLE_TWOFISH);
#else
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  start_new_program();

#endif /* PROG_NETTLE_TWOFISH_ID */
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_Twofish_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_TWOFISH

#undef tObjIs_NETTLE_TWOFISH
#define tObjIs_NETTLE_TWOFISH "\3\1\177\0\0""1"

#undef tObjImpl_NETTLE_TWOFISH
#define tObjImpl_NETTLE_TWOFISH "\3\0\177\0\0""1"

#endif /* tObjImpl_NETTLE_TWOFISH */

#ifdef inherit_Nettle_BlockCipher16_Nettle_Twofish_defined
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_Twofish_Nettle_BlockCipher16_inh_num = Pike_compiler->new_program->num_inherits;
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  low_inherit(Nettle_BlockCipher16_program, NULL, -1, 0, 0, NULL);
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_Twofish_Nettle_BlockCipher16_inh_offset = Pike_compiler->new_program->inherits[Nettle_Twofish_Nettle_BlockCipher16_inh_num].identifier_level;

#endif /* inherit_Nettle_BlockCipher16_Nettle_Twofish_defined */

#ifdef class_Nettle_Twofish_State_defined

#ifdef PROG_NETTLE_TWOFISH_STATE_ID
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  START_NEW_PROGRAM_ID(NETTLE_TWOFISH_STATE);
#else
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  start_new_program();

#endif /* PROG_NETTLE_TWOFISH_STATE_ID */
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_Twofish_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_TWOFISH_STATE

#undef tObjIs_NETTLE_TWOFISH_STATE
#define tObjIs_NETTLE_TWOFISH_STATE "\3\1\177\0\0""2"

#undef tObjImpl_NETTLE_TWOFISH_STATE
#define tObjImpl_NETTLE_TWOFISH_STATE "\3\0\177\0\0""2"

#endif /* tObjImpl_NETTLE_TWOFISH_STATE */

#ifdef THIS_NETTLE_TWOFISH_STATE
  Nettle_Twofish_State_storage_offset = ADD_STORAGE(struct Nettle_Twofish_State_struct);
#endif /* THIS_NETTLE_TWOFISH_STATE */

#ifdef extra_Nettle_Twofish_State_defined
#line 66 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
/* Perform an inherit of the Cipher.State class that our parent
* contains via its inherit of BlockCipher16.
*/
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0, parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_Twofish_State_defined */

#ifdef Nettle_Twofish_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_Twofish_State_event_handler);

#ifndef Nettle_Twofish_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_Twofish_State_gc_live_obj */

#endif /* Nettle_Twofish_State_event_handler_defined */
#line 60 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_Twofish_State_program=end_program();
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#ifdef Nettle_Twofish_State_program_fun_num_used
Nettle_Twofish_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_Twofish_State_program,0);

#endif /* class_Nettle_Twofish_State_defined */

#ifdef Nettle_Twofish_event_handler_defined
  pike_set_prog_event_callback(Nettle_Twofish_event_handler);

#ifndef Nettle_Twofish_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_Twofish_gc_live_obj */

#endif /* Nettle_Twofish_event_handler_defined */
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_Twofish_program=end_program();
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#ifdef Nettle_Twofish_program_fun_num_used
Nettle_Twofish_program_fun_num=
#endif
 add_program_constant("Twofish",Nettle_Twofish_program,0);

#endif /* class_Nettle_Twofish_defined */

#ifdef class_Nettle_IDEA_defined

#ifdef PROG_NETTLE_IDEA_ID
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  START_NEW_PROGRAM_ID(NETTLE_IDEA);
#else
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  start_new_program();

#endif /* PROG_NETTLE_IDEA_ID */
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_IDEA_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_IDEA

#undef tObjIs_NETTLE_IDEA
#define tObjIs_NETTLE_IDEA "\3\1\177\0\0""3"

#undef tObjImpl_NETTLE_IDEA
#define tObjImpl_NETTLE_IDEA "\3\0\177\0\0""3"

#endif /* tObjImpl_NETTLE_IDEA */

#ifdef inherit_Nettle_BlockCipher_Nettle_IDEA_defined
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_IDEA_Nettle_BlockCipher_inh_num = Pike_compiler->new_program->num_inherits;
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  low_inherit(Nettle_BlockCipher_program, NULL, -1, 0, 0, NULL);
#line 41 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_IDEA_Nettle_BlockCipher_inh_offset = Pike_compiler->new_program->inherits[Nettle_IDEA_Nettle_BlockCipher_inh_num].identifier_level;

#endif /* inherit_Nettle_BlockCipher_Nettle_IDEA_defined */

#ifdef class_Nettle_IDEA_State_defined

#ifdef PROG_NETTLE_IDEA_STATE_ID
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  START_NEW_PROGRAM_ID(NETTLE_IDEA_STATE);
#else
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  start_new_program();

#endif /* PROG_NETTLE_IDEA_STATE_ID */
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_IDEA_State_program = Pike_compiler->new_program;

#ifndef tObjImpl_NETTLE_IDEA_STATE

#undef tObjIs_NETTLE_IDEA_STATE
#define tObjIs_NETTLE_IDEA_STATE "\3\1\177\0\0""4"

#undef tObjImpl_NETTLE_IDEA_STATE
#define tObjImpl_NETTLE_IDEA_STATE "\3\0\177\0\0""4"

#endif /* tObjImpl_NETTLE_IDEA_STATE */

#ifdef THIS_NETTLE_IDEA_STATE
  Nettle_IDEA_State_storage_offset = ADD_STORAGE(struct Nettle_IDEA_State_struct);
#endif /* THIS_NETTLE_IDEA_STATE */

#ifdef extra_Nettle_IDEA_State_defined
#line 66 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
{
/* Perform an inherit of the Cipher.State class that our parent
* contains via its inherit of BlockCipher.
*/
struct program *parent_prog = Pike_compiler->previous->new_program;
struct object *parent_obj = Pike_compiler->previous->fake_object;
int parent_State_fun_num =
really_low_find_shared_string_identifier(module_strings[0] /* "State" */,
parent_prog,
SEE_PROTECTED|SEE_PRIVATE);
if (parent_State_fun_num >= 0) {
struct program *parent_State_prog =
low_program_from_function(parent_obj, parent_State_fun_num);
if (parent_State_prog) {
parent_State_fun_num =
really_low_reference_inherited_identifier(Pike_compiler->previous,
0, parent_State_fun_num);
low_inherit(parent_State_prog, 0, parent_State_fun_num,
1 + 42, 0, NULL);
}
}
}


#endif /* extra_Nettle_IDEA_State_defined */

#ifdef Nettle_IDEA_State_event_handler_defined
  pike_set_prog_event_callback(Nettle_IDEA_State_event_handler);

#ifndef Nettle_IDEA_State_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_IDEA_State_gc_live_obj */

#endif /* Nettle_IDEA_State_event_handler_defined */
#line 60 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Pike_compiler->new_program->flags |= PROGRAM_NEEDS_PARENT|PROGRAM_USES_PARENT;
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_IDEA_State_program=end_program();
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#ifdef Nettle_IDEA_State_program_fun_num_used
Nettle_IDEA_State_program_fun_num=
#endif
 add_program_constant("State",Nettle_IDEA_State_program,0);

#endif /* class_Nettle_IDEA_State_defined */

#ifdef Nettle_IDEA_event_handler_defined
  pike_set_prog_event_callback(Nettle_IDEA_event_handler);

#ifndef Nettle_IDEA_gc_live_obj
  Pike_compiler->new_program->flags &= ~PROGRAM_LIVE_OBJ;

#endif /* Nettle_IDEA_gc_live_obj */

#endif /* Nettle_IDEA_event_handler_defined */
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
  Nettle_IDEA_program=end_program();
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.H"
#ifdef Nettle_IDEA_program_fun_num_used
Nettle_IDEA_program_fun_num=
#endif
 add_program_constant("IDEA",Nettle_IDEA_program,0);

#endif /* class_Nettle_IDEA_defined */

#ifdef CMOD_MAP_PROGRAM_IDS_DEFINED
set_program_id_to_id( 0 );
#endif /* CMOD_MAP_PROGRAM_IDS_DEFINED */
#line 5847 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
;
ADD_INT_CONSTANT("PAD_SSL", PAD_SSL, 0);
ADD_INT_CONSTANT("PAD_ISO_10126", PAD_ISO_10126, 0);
ADD_INT_CONSTANT("PAD_ANSI_X923", PAD_ANSI_X923, 0);
ADD_INT_CONSTANT("PAD_PKCS7", PAD_PKCS7, 0);
ADD_INT_CONSTANT("PAD_ZERO", PAD_ZERO, 0);
ADD_INT_CONSTANT("PAD_TLS", PAD_TLS, 0);
}

void
cipher_exit(void)
{

#ifdef class_Nettle_Cipher_defined

#ifdef class_Nettle_Cipher_State_defined
  if(Nettle_Cipher_State_program) {
#line 211 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_Cipher_State_program);
    Nettle_Cipher_State_program=0;
  }

#endif /* class_Nettle_Cipher_State_defined */
  if(Nettle_Cipher_program) {
#line 150 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_Cipher_program);
    Nettle_Cipher_program=0;
  }

#endif /* class_Nettle_Cipher_defined */

#ifdef class_Nettle_BufferedCipher_defined

#ifdef class_Nettle_BufferedCipher_cq__Buffer_defined

#ifdef class_Nettle_BufferedCipher_cq__Buffer_State_defined
  if(Nettle_BufferedCipher_cq__Buffer_State_program) {
#line 567 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BufferedCipher_cq__Buffer_State_program);
    Nettle_BufferedCipher_cq__Buffer_State_program=0;
  }

#endif /* class_Nettle_BufferedCipher_cq__Buffer_State_defined */
  if(Nettle_BufferedCipher_cq__Buffer_program) {
#line 508 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BufferedCipher_cq__Buffer_program);
    Nettle_BufferedCipher_cq__Buffer_program=0;
  }

#endif /* class_Nettle_BufferedCipher_cq__Buffer_defined */
  if(Nettle_BufferedCipher_program) {
#line 461 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BufferedCipher_program);
    Nettle_BufferedCipher_program=0;
  }

#endif /* class_Nettle_BufferedCipher_defined */

#ifdef class_Nettle_BlockCipher_defined

#ifdef class_Nettle_BlockCipher_cq__CBC_defined

#ifdef class_Nettle_BlockCipher_cq__CBC_State_defined
  if(Nettle_BlockCipher_cq__CBC_State_program) {
#line 1128 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher_cq__CBC_State_program);
    Nettle_BlockCipher_cq__CBC_State_program=0;
  }

#endif /* class_Nettle_BlockCipher_cq__CBC_State_defined */
  if(Nettle_BlockCipher_cq__CBC_program) {
#line 1092 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher_cq__CBC_program);
    Nettle_BlockCipher_cq__CBC_program=0;
  }

#endif /* class_Nettle_BlockCipher_cq__CBC_defined */

#ifdef class_Nettle_BlockCipher_cq__PCBC_defined

#ifdef class_Nettle_BlockCipher_cq__PCBC_State_defined
  if(Nettle_BlockCipher_cq__PCBC_State_program) {
#line 1471 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher_cq__PCBC_State_program);
    Nettle_BlockCipher_cq__PCBC_State_program=0;
  }

#endif /* class_Nettle_BlockCipher_cq__PCBC_State_defined */
  if(Nettle_BlockCipher_cq__PCBC_program) {
#line 1442 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher_cq__PCBC_program);
    Nettle_BlockCipher_cq__PCBC_program=0;
  }

#endif /* class_Nettle_BlockCipher_cq__PCBC_defined */

#ifdef class_Nettle_BlockCipher_cq__CFB_defined

#ifdef class_Nettle_BlockCipher_cq__CFB_State_defined
  if(Nettle_BlockCipher_cq__CFB_State_program) {
#line 1637 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher_cq__CFB_State_program);
    Nettle_BlockCipher_cq__CFB_State_program=0;
  }

#endif /* class_Nettle_BlockCipher_cq__CFB_State_defined */
  if(Nettle_BlockCipher_cq__CFB_program) {
#line 1596 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher_cq__CFB_program);
    Nettle_BlockCipher_cq__CFB_program=0;
  }

#endif /* class_Nettle_BlockCipher_cq__CFB_defined */

#ifdef class_Nettle_BlockCipher_cq__CTR_defined

#ifdef class_Nettle_BlockCipher_cq__CTR_State_defined
  if(Nettle_BlockCipher_cq__CTR_State_program) {
#line 2155 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher_cq__CTR_State_program);
    Nettle_BlockCipher_cq__CTR_State_program=0;
  }

#endif /* class_Nettle_BlockCipher_cq__CTR_State_defined */
  if(Nettle_BlockCipher_cq__CTR_program) {
#line 2114 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher_cq__CTR_program);
    Nettle_BlockCipher_cq__CTR_program=0;
  }

#endif /* class_Nettle_BlockCipher_cq__CTR_defined */

#ifdef class_Nettle_BlockCipher_cq__OFB_defined

#ifdef class_Nettle_BlockCipher_cq__OFB_State_defined
  if(Nettle_BlockCipher_cq__OFB_State_program) {
#line 2550 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher_cq__OFB_State_program);
    Nettle_BlockCipher_cq__OFB_State_program=0;
  }

#endif /* class_Nettle_BlockCipher_cq__OFB_State_defined */
  if(Nettle_BlockCipher_cq__OFB_program) {
#line 2509 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher_cq__OFB_program);
    Nettle_BlockCipher_cq__OFB_program=0;
  }

#endif /* class_Nettle_BlockCipher_cq__OFB_defined */
  if(Nettle_BlockCipher_program) {
#line 1071 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher_program);
    Nettle_BlockCipher_program=0;
  }

#endif /* class_Nettle_BlockCipher_defined */

#ifdef class_Nettle_BlockCipher16_defined

#ifdef class_Nettle_BlockCipher16_cq__CCM_defined

#ifdef class_Nettle_BlockCipher16_cq__CCM_State_defined
  if(Nettle_BlockCipher16_cq__CCM_State_program) {
#line 3076 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher16_cq__CCM_State_program);
    Nettle_BlockCipher16_cq__CCM_State_program=0;
  }

#endif /* class_Nettle_BlockCipher16_cq__CCM_State_defined */
  if(Nettle_BlockCipher16_cq__CCM_program) {
#line 2998 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher16_cq__CCM_program);
    Nettle_BlockCipher16_cq__CCM_program=0;
  }

#endif /* class_Nettle_BlockCipher16_cq__CCM_defined */

#ifdef class_Nettle_BlockCipher16_cq__CCM8_defined
  if(Nettle_BlockCipher16_cq__CCM8_program) {
#line 3536 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher16_cq__CCM8_program);
    Nettle_BlockCipher16_cq__CCM8_program=0;
  }

#endif /* class_Nettle_BlockCipher16_cq__CCM8_defined */

#ifdef class_Nettle_BlockCipher16_cq__EAX_defined

#ifdef class_Nettle_BlockCipher16_cq__EAX_State_defined
  if(Nettle_BlockCipher16_cq__EAX_State_program) {
#line 3651 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher16_cq__EAX_State_program);
    Nettle_BlockCipher16_cq__EAX_State_program=0;
  }

#endif /* class_Nettle_BlockCipher16_cq__EAX_State_defined */
  if(Nettle_BlockCipher16_cq__EAX_program) {
#line 3603 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher16_cq__EAX_program);
    Nettle_BlockCipher16_cq__EAX_program=0;
  }

#endif /* class_Nettle_BlockCipher16_cq__EAX_defined */

#ifdef class_Nettle_BlockCipher16_cq__GCM_defined

#ifdef class_Nettle_BlockCipher16_cq__GCM_State_defined
  if(Nettle_BlockCipher16_cq__GCM_State_program) {
#line 4115 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher16_cq__GCM_State_program);
    Nettle_BlockCipher16_cq__GCM_State_program=0;
  }

#endif /* class_Nettle_BlockCipher16_cq__GCM_State_defined */
  if(Nettle_BlockCipher16_cq__GCM_program) {
#line 4055 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher16_cq__GCM_program);
    Nettle_BlockCipher16_cq__GCM_program=0;
  }

#endif /* class_Nettle_BlockCipher16_cq__GCM_defined */
  if(Nettle_BlockCipher16_program) {
#line 2958 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BlockCipher16_program);
    Nettle_BlockCipher16_program=0;
  }

#endif /* class_Nettle_BlockCipher16_defined */

#ifdef class_Nettle_AES_defined

#ifdef class_Nettle_AES_State_defined
  if(Nettle_AES_State_program) {
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_AES_State_program);
    Nettle_AES_State_program=0;
  }

#endif /* class_Nettle_AES_State_defined */
  if(Nettle_AES_program) {
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_AES_program);
    Nettle_AES_program=0;
  }

#endif /* class_Nettle_AES_defined */

#ifdef class_Nettle_ARCTWO_defined

#ifdef class_Nettle_ARCTWO_State_defined
  if(Nettle_ARCTWO_State_program) {
#line 4670 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_ARCTWO_State_program);
    Nettle_ARCTWO_State_program=0;
  }

#endif /* class_Nettle_ARCTWO_State_defined */
  if(Nettle_ARCTWO_program) {
#line 4647 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_ARCTWO_program);
    Nettle_ARCTWO_program=0;
  }

#endif /* class_Nettle_ARCTWO_defined */

#ifdef class_Nettle_ARCFOUR_defined

#ifdef class_Nettle_ARCFOUR_State_defined
  if(Nettle_ARCFOUR_State_program) {
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_ARCFOUR_State_program);
    Nettle_ARCFOUR_State_program=0;
  }

#endif /* class_Nettle_ARCFOUR_State_defined */
  if(Nettle_ARCFOUR_program) {
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_ARCFOUR_program);
    Nettle_ARCFOUR_program=0;
  }

#endif /* class_Nettle_ARCFOUR_defined */

#ifdef class_Nettle_BLOWFISH_defined

#ifdef class_Nettle_BLOWFISH_State_defined
  if(Nettle_BLOWFISH_State_program) {
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BLOWFISH_State_program);
    Nettle_BLOWFISH_State_program=0;
  }

#endif /* class_Nettle_BLOWFISH_State_defined */
  if(Nettle_BLOWFISH_program) {
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_BLOWFISH_program);
    Nettle_BLOWFISH_program=0;
  }

#endif /* class_Nettle_BLOWFISH_defined */

#ifdef class_Nettle_CAMELLIA_defined

#ifdef class_Nettle_CAMELLIA_State_defined
  if(Nettle_CAMELLIA_State_program) {
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_CAMELLIA_State_program);
    Nettle_CAMELLIA_State_program=0;
  }

#endif /* class_Nettle_CAMELLIA_State_defined */
  if(Nettle_CAMELLIA_program) {
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_CAMELLIA_program);
    Nettle_CAMELLIA_program=0;
  }

#endif /* class_Nettle_CAMELLIA_defined */

#ifdef class_Nettle_CAST128_defined

#ifdef class_Nettle_CAST128_State_defined
  if(Nettle_CAST128_State_program) {
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_CAST128_State_program);
    Nettle_CAST128_State_program=0;
  }

#endif /* class_Nettle_CAST128_State_defined */
  if(Nettle_CAST128_program) {
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_CAST128_program);
    Nettle_CAST128_program=0;
  }

#endif /* class_Nettle_CAST128_defined */

#ifdef class_Nettle_CHACHA_defined

#ifdef class_Nettle_CHACHA_State_defined
  if(Nettle_CHACHA_State_program) {
#line 5048 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_CHACHA_State_program);
    Nettle_CHACHA_State_program=0;
  }

#endif /* class_Nettle_CHACHA_State_defined */
  if(Nettle_CHACHA_program) {
#line 5025 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_CHACHA_program);
    Nettle_CHACHA_program=0;
  }

#endif /* class_Nettle_CHACHA_defined */

#ifdef class_Nettle_DES_defined

#ifdef class_Nettle_DES_State_defined
  if(Nettle_DES_State_program) {
#line 5261 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_DES_State_program);
    Nettle_DES_State_program=0;
  }

#endif /* class_Nettle_DES_State_defined */
  if(Nettle_DES_program) {
#line 5206 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_DES_program);
    Nettle_DES_program=0;
  }

#endif /* class_Nettle_DES_defined */

#ifdef class_Nettle_DES3_defined

#ifdef class_Nettle_DES3_State_defined
  if(Nettle_DES3_State_program) {
#line 5505 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_DES3_State_program);
    Nettle_DES3_State_program=0;
  }

#endif /* class_Nettle_DES3_State_defined */
  if(Nettle_DES3_program) {
#line 5444 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_DES3_program);
    Nettle_DES3_program=0;
  }

#endif /* class_Nettle_DES3_defined */

#ifdef class_Nettle_SALSA20_defined

#ifdef class_Nettle_SALSA20_State_defined
  if(Nettle_SALSA20_State_program) {
#line 5629 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_SALSA20_State_program);
    Nettle_SALSA20_State_program=0;
  }

#endif /* class_Nettle_SALSA20_State_defined */
  if(Nettle_SALSA20_program) {
#line 5606 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_SALSA20_program);
    Nettle_SALSA20_program=0;
  }

#endif /* class_Nettle_SALSA20_defined */

#ifdef class_Nettle_SALSA20R12_defined
  if(Nettle_SALSA20R12_program) {
#line 5721 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_SALSA20R12_program);
    Nettle_SALSA20R12_program=0;
  }

#endif /* class_Nettle_SALSA20R12_defined */

#ifdef class_Nettle_SERPENT_defined

#ifdef class_Nettle_SERPENT_State_defined
  if(Nettle_SERPENT_State_program) {
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_SERPENT_State_program);
    Nettle_SERPENT_State_program=0;
  }

#endif /* class_Nettle_SERPENT_State_defined */
  if(Nettle_SERPENT_program) {
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_SERPENT_program);
    Nettle_SERPENT_program=0;
  }

#endif /* class_Nettle_SERPENT_defined */

#ifdef class_Nettle_Twofish_defined

#ifdef class_Nettle_Twofish_State_defined
  if(Nettle_Twofish_State_program) {
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_Twofish_State_program);
    Nettle_Twofish_State_program=0;
  }

#endif /* class_Nettle_Twofish_State_defined */
  if(Nettle_Twofish_program) {
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_Twofish_program);
    Nettle_Twofish_program=0;
  }

#endif /* class_Nettle_Twofish_defined */

#ifdef class_Nettle_IDEA_defined

#ifdef class_Nettle_IDEA_State_defined
  if(Nettle_IDEA_State_program) {
#line 59 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_IDEA_State_program);
    Nettle_IDEA_State_program=0;
  }

#endif /* class_Nettle_IDEA_State_defined */
  if(Nettle_IDEA_program) {
#line 37 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
    free_program(Nettle_IDEA_program);
    Nettle_IDEA_program=0;
  }

#endif /* class_Nettle_IDEA_defined */

#ifdef module_strings_declared
{
  int i;
  for(i=0; i < 7; i++) {
    if (module_strings[i]) free_string(module_strings[i]);
    module_strings[i] = NULL;
  }
}
#endif
#line 5859 "/home/hww3/pike-git/src/post_modules/Nettle/cipher.cmod"
;
free_string(nul16_string);
free_string(nul13_string);
}

#endif /* HAVE_LIBNETTLE */


#ifdef CMOD_MAP_PROGRAM_IDS_DEFINED
static int ___cmod_map_program_ids(int id)
{
  int i = 0;
  if( (id&0x7f000000) != 0x7f000000 ) return id;
  id = id&0x00ffffff;
#ifdef class_Nettle_CAMELLIA_defined
if(id==34) return Nettle_CAMELLIA_program->id;
#endif
#ifdef class_Nettle_CAMELLIA_State_defined
if(id==35) return Nettle_CAMELLIA_State_program->id;
#endif
#ifdef class_Nettle_BLOWFISH_defined
if(id==32) return Nettle_BLOWFISH_program->id;
#endif
#ifdef class_Nettle_Cipher_defined
if(id==2) return Nettle_Cipher_program->id;
#endif
#ifdef class_Nettle_BLOWFISH_State_defined
if(id==33) return Nettle_BLOWFISH_State_program->id;
#endif
#ifdef class_Nettle_Cipher_State_defined
if(id==3) return Nettle_Cipher_State_program->id;
#endif
#ifdef class_Nettle_CHACHA_defined
if(id==38) return Nettle_CHACHA_program->id;
#endif
#ifdef class_Nettle_BufferedCipher_defined
if(id==4) return Nettle_BufferedCipher_program->id;
#endif
#ifdef class_Nettle_CHACHA_State_defined
if(id==39) return Nettle_CHACHA_State_program->id;
#endif
#ifdef class_Nettle_BufferedCipher_cq__Buffer_defined
if(id==5) return Nettle_BufferedCipher_cq__Buffer_program->id;
#endif
#ifdef class_Nettle_CAST128_defined
if(id==36) return Nettle_CAST128_program->id;
#endif
#ifdef class_Nettle_BufferedCipher_cq__Buffer_State_defined
if(id==6) return Nettle_BufferedCipher_cq__Buffer_State_program->id;
#endif
#ifdef class_Nettle_CAST128_State_defined
if(id==37) return Nettle_CAST128_State_program->id;
#endif
#ifdef class_Nettle_BlockCipher_defined
if(id==7) return Nettle_BlockCipher_program->id;
#endif
#ifdef class_Nettle_DES3_defined
if(id==42) return Nettle_DES3_program->id;
#endif
#ifdef class_Nettle_BlockCipher_cq__CBC_defined
if(id==8) return Nettle_BlockCipher_cq__CBC_program->id;
#endif
#ifdef class_Nettle_DES3_State_defined
if(id==43) return Nettle_DES3_State_program->id;
#endif
#ifdef class_Nettle_BlockCipher_cq__CBC_State_defined
if(id==9) return Nettle_BlockCipher_cq__CBC_State_program->id;
#endif
#ifdef class_Nettle_DES_defined
if(id==40) return Nettle_DES_program->id;
#endif
#ifdef class_Nettle_BlockCipher_cq__PCBC_defined
if(id==10) return Nettle_BlockCipher_cq__PCBC_program->id;
#endif
#ifdef class_Nettle_DES_State_defined
if(id==41) return Nettle_DES_State_program->id;
#endif
#ifdef class_Nettle_BlockCipher_cq__PCBC_State_defined
if(id==11) return Nettle_BlockCipher_cq__PCBC_State_program->id;
#endif
#ifdef class_Nettle_SALSA20R12_defined
if(id==46) return Nettle_SALSA20R12_program->id;
#endif
#ifdef class_Nettle_BlockCipher_cq__CFB_defined
if(id==12) return Nettle_BlockCipher_cq__CFB_program->id;
#endif
#ifdef class_Nettle_SERPENT_defined
if(id==47) return Nettle_SERPENT_program->id;
#endif
#ifdef class_Nettle_BlockCipher_cq__CFB_State_defined
if(id==13) return Nettle_BlockCipher_cq__CFB_State_program->id;
#endif
#ifdef class_Nettle_SALSA20_defined
if(id==44) return Nettle_SALSA20_program->id;
#endif
#ifdef class_Nettle_BlockCipher_cq__CTR_defined
if(id==14) return Nettle_BlockCipher_cq__CTR_program->id;
#endif
#ifdef class_Nettle_SALSA20_State_defined
if(id==45) return Nettle_SALSA20_State_program->id;
#endif
#ifdef class_Nettle_BlockCipher_cq__CTR_State_defined
if(id==15) return Nettle_BlockCipher_cq__CTR_State_program->id;
#endif
#ifdef class_Nettle_IDEA_defined
if(id==51) return Nettle_IDEA_program->id;
#endif
#ifdef class_Nettle_BlockCipher_cq__OFB_State_defined
if(id==17) return Nettle_BlockCipher_cq__OFB_State_program->id;
#endif
#ifdef class_Nettle_Twofish_State_defined
if(id==50) return Nettle_Twofish_State_program->id;
#endif
#ifdef class_Nettle_BlockCipher_cq__OFB_defined
if(id==16) return Nettle_BlockCipher_cq__OFB_program->id;
#endif
#ifdef class_Nettle_Twofish_defined
if(id==49) return Nettle_Twofish_program->id;
#endif
#ifdef class_Nettle_BlockCipher16_cq__CCM_defined
if(id==19) return Nettle_BlockCipher16_cq__CCM_program->id;
#endif
#ifdef class_Nettle_SERPENT_State_defined
if(id==48) return Nettle_SERPENT_State_program->id;
#endif
#ifdef class_Nettle_BlockCipher16_defined
if(id==18) return Nettle_BlockCipher16_program->id;
#endif
#ifdef class_Nettle_BlockCipher16_cq__CCM8_defined
if(id==21) return Nettle_BlockCipher16_cq__CCM8_program->id;
#endif
#ifdef class_Nettle_BlockCipher16_cq__CCM_State_defined
if(id==20) return Nettle_BlockCipher16_cq__CCM_State_program->id;
#endif
#ifdef class_Nettle_BlockCipher16_cq__EAX_State_defined
if(id==23) return Nettle_BlockCipher16_cq__EAX_State_program->id;
#endif
#ifdef class_Nettle_IDEA_State_defined
if(id==52) return Nettle_IDEA_State_program->id;
#endif
#ifdef class_Nettle_BlockCipher16_cq__EAX_defined
if(id==22) return Nettle_BlockCipher16_cq__EAX_program->id;
#endif
#ifdef class_Nettle_BlockCipher16_cq__GCM_State_defined
if(id==25) return Nettle_BlockCipher16_cq__GCM_State_program->id;
#endif
#ifdef class_Nettle_BlockCipher16_cq__GCM_defined
if(id==24) return Nettle_BlockCipher16_cq__GCM_program->id;
#endif
#ifdef class_Nettle_AES_State_defined
if(id==27) return Nettle_AES_State_program->id;
#endif
#ifdef class_Nettle_AES_defined
if(id==26) return Nettle_AES_program->id;
#endif
#ifdef class_Nettle_ARCTWO_State_defined
if(id==29) return Nettle_ARCTWO_State_program->id;
#endif
#ifdef class_Nettle_ARCTWO_defined
if(id==28) return Nettle_ARCTWO_program->id;
#endif
#ifdef class_Nettle_ARCFOUR_State_defined
if(id==31) return Nettle_ARCFOUR_State_program->id;
#endif
#ifdef class_Nettle_ARCFOUR_defined
if(id==30) return Nettle_ARCFOUR_program->id;
#endif
  while(___cmod_ext_used[i].from ) {
   if( ___cmod_ext_used[i].from == id ) return ___cmod_ext_used[i].to;
   i++;
  }
  return 0;
}
#endif /* CMOD_MAP_PROGRAM_IDS_DEFINED */
