summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2007-05-02 10:18:46 +0000
committerWerner Koch <wk@gnupg.org>2007-05-02 10:18:46 +0000
commite87b11838720a714db2d4933c64dbf6f57bdafe3 (patch)
treedd0d8ff5420c60e4dc0e5ecc8a7a9ed852340d16
parent074dd6d81470a16795bc571c066aa32ef2a0a588 (diff)
downloadlibgcrypt-e87b11838720a714db2d4933c64dbf6f57bdafe3.tar.gz
Changed amount of stack to burn
-rw-r--r--cipher/ChangeLog3
-rw-r--r--cipher/camellia-glue.c25
2 files changed, 21 insertions, 7 deletions
diff --git a/cipher/ChangeLog b/cipher/ChangeLog
index 2ee25cf5..d4eb19b1 100644
--- a/cipher/ChangeLog
+++ b/cipher/ChangeLog
@@ -1,5 +1,8 @@
2007-05-02 Werner Koch <wk@g10code.com>
+ * camellia-glue.c (camellia_setkey, camellia_encrypt)
+ (camellia_decrypt): Recalculated used stack size in called
+ functions.
* camellia.h: Redefine external symbols.
2007-05-02 David Shaw <dshaw@jabberwocky.com>
diff --git a/cipher/camellia-glue.c b/cipher/camellia-glue.c
index d50f9ccb..29552cec 100644
--- a/cipher/camellia-glue.c
+++ b/cipher/camellia-glue.c
@@ -79,7 +79,12 @@ camellia_setkey(void *c, const byte *key, unsigned keylen)
ctx->keybitlength=keylen*8;
Camellia_Ekeygen(ctx->keybitlength,key,ctx->keytable);
- _gcry_burn_stack(4+4+6+34+34+sizeof(unsigned char *)+sizeof(u32 *));
+ _gcry_burn_stack
+ ((19+34+34)*sizeof(u32)+2*sizeof(void*) /* camellia_setup256 */
+ +(4+32)*sizeof(u32)+2*sizeof(void*) /* camellia_setup192 */
+ +0+sizeof(int)+2*sizeof(void*) /* Camellia_Ekeygen */
+ +3*2*sizeof(void*) /* Function calls. */
+ );
return 0;
}
@@ -90,9 +95,12 @@ camellia_encrypt(void *c, byte *outbuf, const byte *inbuf)
CAMELLIA_context *ctx=c;
Camellia_EncryptBlock(ctx->keybitlength,inbuf,ctx->keytable,outbuf);
- _gcry_burn_stack(sizeof(int)+sizeof(unsigned char *)+sizeof(KEY_TABLE_TYPE)
- +sizeof(unsigned char *)+16+4+4+4+4+sizeof(u32 *)
- +sizeof(u32 *));
+ _gcry_burn_stack
+ (sizeof(int)+2*sizeof(unsigned char *)+sizeof(KEY_TABLE_TYPE)
+ +4*sizeof(u32)
+ +2*sizeof(u32*)+4*sizeof(u32)
+ +2*2*sizeof(void*) /* Function calls. */
+ );
}
static void
@@ -101,9 +109,12 @@ camellia_decrypt(void *c, byte *outbuf, const byte *inbuf)
CAMELLIA_context *ctx=c;
Camellia_DecryptBlock(ctx->keybitlength,inbuf,ctx->keytable,outbuf);
- _gcry_burn_stack(sizeof(int)+sizeof(unsigned char *)+sizeof(KEY_TABLE_TYPE)
- +sizeof(unsigned char *)+16+4+4+4+4+sizeof(u32 *)
- +sizeof(u32 *));
+ _gcry_burn_stack
+ (sizeof(int)+2*sizeof(unsigned char *)+sizeof(KEY_TABLE_TYPE)
+ +4*sizeof(u32)
+ +2*sizeof(u32*)+4*sizeof(u32)
+ +2*2*sizeof(void*) /* Function calls. */
+ );
}
static const char *