Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Browse files Browse the repository at this point in the history
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
  [CRYPTO] geode: Fix in-place operations and set key
  • Loading branch information
Linus Torvalds committed May 24, 2007
2 parents 5270f29 + 761e784 commit 900f1d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 9 additions & 3 deletions drivers/crypto/geode-aes.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,15 @@ geode_aes_crypt(struct geode_aes_op *op)
u32 flags = 0;
unsigned long iflags;

if (op->len == 0 || op->src == op->dst)
if (op->len == 0)
return 0;

if (op->flags & AES_FLAGS_COHERENT)
/* If the source and destination is the same, then
* we need to turn on the coherent flags, otherwise
* we don't need to worry
*/

if (op->src == op->dst)
flags |= (AES_CTRL_DCA | AES_CTRL_SCA);

if (op->dir == AES_DIR_ENCRYPT)
Expand All @@ -120,7 +125,7 @@ geode_aes_crypt(struct geode_aes_op *op)
_writefield(AES_WRITEIV0_REG, op->iv);
}

if (op->flags & AES_FLAGS_USRKEY) {
if (!(op->flags & AES_FLAGS_HIDDENKEY)) {
flags |= AES_CTRL_WRKEY;
_writefield(AES_WRITEKEY0_REG, op->key);
}
Expand Down Expand Up @@ -289,6 +294,7 @@ static struct crypto_alg geode_cbc_alg = {
.setkey = geode_setkey,
.encrypt = geode_cbc_encrypt,
.decrypt = geode_cbc_decrypt,
.ivsize = AES_IV_LENGTH,
}
}
};
Expand Down
3 changes: 1 addition & 2 deletions drivers/crypto/geode-aes.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
#define AES_DIR_DECRYPT 0
#define AES_DIR_ENCRYPT 1

#define AES_FLAGS_USRKEY (1 << 0)
#define AES_FLAGS_COHERENT (1 << 1)
#define AES_FLAGS_HIDDENKEY (1 << 0)

struct geode_aes_op {

Expand Down

0 comments on commit 900f1d2

Please sign in to comment.