提交 6386b1b3 编写于 作者: D Dr. Stephen Henson

Compile ccm128.c, move some structures to modes_lcl.h add prototypes.

上级 3b4a8557
......@@ -21,9 +21,10 @@ TEST=
APPS=
LIB=$(TOP)/libcrypto.a
LIBSRC= cbc128.c ctr128.c cts128.c cfb128.c ofb128.c gcm128.c xts128.c
LIBSRC= cbc128.c ctr128.c cts128.c cfb128.c ofb128.c gcm128.c \
ccm128.c xts128.c
LIBOBJ= cbc128.o ctr128.o cts128.o cfb128.o ofb128.o gcm128.o \
xts128.o $(MODES_ASM_OBJ)
ccm128.o xts128.o $(MODES_ASM_OBJ)
SRC= $(LIBSRC)
......
......@@ -58,13 +58,6 @@
#endif
#include <assert.h>
typedef struct {
union { u64 u[2]; u8 c[16]; } nonce, cmac;
u64 blocks;
block128_f block;
void *key;
} CCM128_CONTEXT;
/* First you setup M and L parameters and pass the key schedule */
void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx,
unsigned int M,unsigned int L,void *key,block128_f block)
......@@ -251,7 +244,7 @@ int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx,
size_t n;
unsigned int i,L;
unsigned char flags0 = ctx->nonce.c[0];
block128_f block;
block128_f block = ctx->block;
union { u64 u[2]; u8 c[16]; } scratch;
if (!(flags0&0x40))
......
......@@ -105,6 +105,22 @@ int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx,const unsigned char *tag,
void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len);
void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx);
typedef struct ccm128_context CCM128_CONTEXT;
void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx,
unsigned int M,unsigned int L,void *key,block128_f block);
int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx,
const unsigned char *nonce,size_t nlen,size_t mlen);
void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx,
const unsigned char *aad,size_t alen);
int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx,
const unsigned char *inp, unsigned char *out,
size_t len);
int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx,
const unsigned char *inp, unsigned char *out,
size_t len);
size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx,unsigned char *tag,size_t len);
typedef struct xts128_context XTS128_CONTEXT;
int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx, const unsigned char *iv,
......
......@@ -122,3 +122,10 @@ struct xts128_context {
block128_f block1,block2;
};
struct ccm128_context {
union { u64 u[2]; u8 c[16]; } nonce, cmac;
u64 blocks;
block128_f block;
void *key;
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册