⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ltc_eax.h

📁 加密认证联合模式的VS2005工程文件
💻 H
字号:
/*
 ---------------------------------------------------------------------------
 Copyright (c) 1998-2006, Brian Gladman, Worcester, UK. All rights reserved.

 LICENSE TERMS

 The free distribution and use of this software in both source and binary
 form is allowed (with or without changes) provided that:

   1. distributions of this source code include the above copyright
      notice, this list of conditions and the following disclaimer;

   2. distributions in binary form include the above copyright
      notice, this list of conditions and the following disclaimer
      in the documentation and/or other associated materials;

   3. the copyright holder's name is not used to endorse products
      built using this software without specific written permission.

 ALTERNATIVELY, provided that this notice is retained in full, this product
 may be distributed under the terms of the GNU General Public License (GPL),
 in which case the provisions of the GPL apply INSTEAD OF those given above.

 DISCLAIMER

 This software is provided 'as is' with no explicit or implied warranties
 in respect of its properties, including, but not limited to, correctness
 and/or fitness for purpose.
 ---------------------------------------------------------------------------
 Issue Date: 13/10/2006

 This code has been derived from LibTomCrypt, the cryptographic library
 authored by Tom St Denis.  His contribution is hence acknowledged. This
 code has been developed to obtain two independent implementations of the
 combined AES encryption/authentication modes (CCM, GCM and EAX) in order
 to be able to check test vectors before their publication.
*/

#ifndef LTC_EAX_H
#define LTC_EAX_H

#include "aes.h"
#include "ltc_ctr.h"
#include "ltc_omac.h"

#define EAX_ENCRYPT 0
#define EAX_DECRYPT 1

typedef struct
{
    uint_8t     nv[AES_BLOCK_SIZE];
    ctr_ctx     ctr[1];
    omac_state  hdr_omac[1];
    omac_state  ctx_omac[1];
} eax_state;

int eax_init( const unsigned char key[], unsigned long key_len,
              const unsigned char nonce[], unsigned long nonce_len,
              const unsigned char hdr[], unsigned long header_len,
              eax_state eax[1] );

int eax_addheader( const unsigned char hdr[], unsigned long length, eax_state eax[1] );

int eax_encryptx( const unsigned char pt[], unsigned char ct[], unsigned long length, eax_state eax[1] );

int eax_decryptx( const unsigned char ct[], unsigned char pt[], unsigned long length, eax_state eax[1] );

int eax_done( unsigned char tag[], unsigned long tag_len, eax_state eax[1] );

int eax_memory( const unsigned char key[], unsigned long key_len,
                const unsigned char nonce[], unsigned long nonce_len,
                const unsigned char hdr[], unsigned long header_len,
                unsigned char pt[], unsigned long pt_len,
                unsigned char ct[],
                unsigned char tag[], unsigned long tag_len,
                int dir, int *stat);

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -