Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 75981
b: refs/heads/master
c: 743edf5
h: refs/heads/master
i:
  75979: 00faefd
v: v3
  • Loading branch information
Herbert Xu committed Jan 10, 2008
1 parent 0a267b8 commit fc08763
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 03bf712fb4defc7831c727d1e32d0269f7f96de0
refs/heads/master: 743edf57272fd420348e148bf94f9e48ed6abb70
7 changes: 7 additions & 0 deletions trunk/crypto/aead.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ static unsigned int crypto_aead_ctxsize(struct crypto_alg *alg, u32 type,
return alg->cra_ctxsize;
}

static int no_givdecrypt(struct aead_givcrypt_request *req)
{
return -ENOSYS;
}

static int crypto_init_aead_ops(struct crypto_tfm *tfm, u32 type, u32 mask)
{
struct aead_alg *alg = &tfm->__crt_alg->cra_aead;
Expand All @@ -88,6 +93,8 @@ static int crypto_init_aead_ops(struct crypto_tfm *tfm, u32 type, u32 mask)
crt->setkey = setkey;
crt->encrypt = alg->encrypt;
crt->decrypt = alg->decrypt;
crt->givencrypt = alg->givencrypt;
crt->givdecrypt = alg->givdecrypt ?: no_givdecrypt;
crt->ivsize = alg->ivsize;
crt->authsize = alg->maxauthsize;

Expand Down
38 changes: 38 additions & 0 deletions trunk/include/crypto/aead.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* AEAD: Authenticated Encryption with Associated Data
*
* Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
*/

#ifndef _CRYPTO_AEAD_H
#define _CRYPTO_AEAD_H

#include <linux/crypto.h>
#include <linux/kernel.h>

/**
* struct aead_givcrypt_request - AEAD request with IV generation
* @seq: Sequence number for IV generation
* @giv: Space for generated IV
* @areq: The AEAD request itself
*/
struct aead_givcrypt_request {
u64 seq;
u8 *giv;

struct aead_request areq;
};

static inline struct crypto_aead *aead_givcrypt_reqtfm(
struct aead_givcrypt_request *req)
{
return crypto_aead_reqtfm(&req->areq);
}

#endif /* _CRYPTO_AEAD_H */
5 changes: 5 additions & 0 deletions trunk/include/linux/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ struct crypto_blkcipher;
struct crypto_hash;
struct crypto_tfm;
struct crypto_type;
struct aead_givcrypt_request;
struct skcipher_givcrypt_request;

typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err);
Expand Down Expand Up @@ -202,6 +203,8 @@ struct aead_alg {
int (*setauthsize)(struct crypto_aead *tfm, unsigned int authsize);
int (*encrypt)(struct aead_request *req);
int (*decrypt)(struct aead_request *req);
int (*givencrypt)(struct aead_givcrypt_request *req);
int (*givdecrypt)(struct aead_givcrypt_request *req);

unsigned int ivsize;
unsigned int maxauthsize;
Expand Down Expand Up @@ -348,6 +351,8 @@ struct aead_tfm {
unsigned int keylen);
int (*encrypt)(struct aead_request *req);
int (*decrypt)(struct aead_request *req);
int (*givencrypt)(struct aead_givcrypt_request *req);
int (*givdecrypt)(struct aead_givcrypt_request *req);
unsigned int ivsize;
unsigned int authsize;
unsigned int reqsize;
Expand Down

0 comments on commit fc08763

Please sign in to comment.