diff --git a/ChangeLog b/ChangeLog
index 14602736fea25c221294cdc6d2946e4216b763f1..5cc4e407032f9cbc42e6ad7267c2c7bf3ec23a5e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2010-07-07  Niels M�ller  <nisse@lysator.liu.se>
 
+	* aes.h (aes_encrypt, aes_decrypt): Declare ctx argument as const.
+	Also updated implementation.
+	* blowfish.h (blowfish_encrypt, blowfish_decrypt): Likewise.
+	* cast128.h (cast128_encrypt, cast128_decrypt): Likewise.
+	* serpent.h (serpent_encrypt, serpent_decrypt): Likewise.
+	* twofish.h (twofish_encrypt, twofish_decrypt): Likewise.
+
 	* testsuite/Makefile.in (TS_NETTLE_SOURCES): Added
 	camellia-test.c.
 
diff --git a/aes-decrypt.c b/aes-decrypt.c
index afbf827b430f6c450d2872b42abc3cd9c13c400b..39b79c690ec238c389b54189b61eebe10e54735f 100644
--- a/aes-decrypt.c
+++ b/aes-decrypt.c
@@ -337,7 +337,7 @@ _aes_decrypt_table =
   };
 
 void
-aes_decrypt(struct aes_ctx *ctx,
+aes_decrypt(const struct aes_ctx *ctx,
 	    unsigned length, uint8_t *dst,
 	    const uint8_t *src)
 {
diff --git a/aes-encrypt.c b/aes-encrypt.c
index 5112e171d689f83d1dfec739224e4d1de2685986..19fe07170cae788eeebda1dda628827902bd1027 100644
--- a/aes-encrypt.c
+++ b/aes-encrypt.c
@@ -35,7 +35,7 @@
    implementations of _nettle_aes_encrypt to get the table pointer.
    For PIC code, the details can be complex and system dependent. */
 void
-aes_encrypt(struct aes_ctx *ctx,
+aes_encrypt(const struct aes_ctx *ctx,
 	    unsigned length, uint8_t *dst,
 	    const uint8_t *src)
 {
diff --git a/aes.h b/aes.h
index 10c567f3676552d19f07bff913f88e1bda978308..e5155ed8de8a3aa9fe8385fc786bff2a87b15d72 100644
--- a/aes.h
+++ b/aes.h
@@ -61,11 +61,11 @@ aes_set_decrypt_key(struct aes_ctx *ctx,
 		   unsigned length, const uint8_t *key);
 
 void
-aes_encrypt(struct aes_ctx *ctx,
+aes_encrypt(const struct aes_ctx *ctx,
 	    unsigned length, uint8_t *dst,
 	    const uint8_t *src);
 void
-aes_decrypt(struct aes_ctx *ctx,
+aes_decrypt(const struct aes_ctx *ctx,
 	    unsigned length, uint8_t *dst,
 	    const uint8_t *src);
 
diff --git a/blowfish.c b/blowfish.c
index b8f7ca5815ac0edd1f9b52193ffe3b5f942aab89..25c99c29a0ff0550bfbf794f3b7ebe5582773c43 100644
--- a/blowfish.c
+++ b/blowfish.c
@@ -245,7 +245,7 @@ initial_ctx =
 #define R(c, l, r, i)  do { l ^= c->p[i]; r ^= F(c, l); } while(0)
 
 static void
-encrypt(struct blowfish_ctx *bc, uint32_t *ret_xl, uint32_t *ret_xr)
+encrypt(const struct blowfish_ctx *bc, uint32_t *ret_xl, uint32_t *ret_xr)
 {
   uint32_t xl, xr;
 
@@ -276,7 +276,7 @@ encrypt(struct blowfish_ctx *bc, uint32_t *ret_xl, uint32_t *ret_xr)
 }
 
 static void
-decrypt(struct blowfish_ctx *bc, uint32_t *ret_xl, uint32_t *ret_xr )
+decrypt(const struct blowfish_ctx *bc, uint32_t *ret_xl, uint32_t *ret_xr )
 {
   uint32_t xl, xr;
 
@@ -311,7 +311,7 @@ decrypt(struct blowfish_ctx *bc, uint32_t *ret_xl, uint32_t *ret_xr )
 #undef R
 
 void
-blowfish_encrypt(struct blowfish_ctx *bc, unsigned length,
+blowfish_encrypt(const struct blowfish_ctx *bc, unsigned length,
                  uint8_t *outbuf, const uint8_t *inbuf)
 {
     uint32_t d1, d2;
@@ -330,7 +330,7 @@ blowfish_encrypt(struct blowfish_ctx *bc, unsigned length,
 
 
 void
-blowfish_decrypt(struct blowfish_ctx *bc, unsigned length,
+blowfish_decrypt(const struct blowfish_ctx *bc, unsigned length,
                  uint8_t *outbuf, const uint8_t *inbuf )
 {
     uint32_t d1, d2;
diff --git a/blowfish.h b/blowfish.h
index 768e15efcefb9c6cc0e9ef5f7253f4d82aeda89e..3775b4bba48d45b61de1a897de712a2de0a86f4a 100644
--- a/blowfish.h
+++ b/blowfish.h
@@ -61,11 +61,11 @@ blowfish_set_key(struct blowfish_ctx *ctx,
                  unsigned length, const uint8_t *key);
 
 void
-blowfish_encrypt(struct blowfish_ctx *ctx,
+blowfish_encrypt(const struct blowfish_ctx *ctx,
                  unsigned length, uint8_t *dst,
                  const uint8_t *src);
 void
-blowfish_decrypt(struct blowfish_ctx *ctx,
+blowfish_decrypt(const struct blowfish_ctx *ctx,
                  unsigned length, uint8_t *dst,
                  const uint8_t *src);
 
diff --git a/cast128.c b/cast128.c
index 4abbafb358bba5ca85ac1e469dc077962ea451c6..e4ca0cbb4eb602ee639f02189d09230e04f93605 100644
--- a/cast128.c
+++ b/cast128.c
@@ -71,7 +71,7 @@
 /***** Encryption Function *****/
 
 void
-cast128_encrypt(struct cast128_ctx *ctx,
+cast128_encrypt(const struct cast128_ctx *ctx,
 		unsigned length, uint8_t *dst,
 		const uint8_t *src)
 {
@@ -115,7 +115,7 @@ cast128_encrypt(struct cast128_ctx *ctx,
 /***** Decryption Function *****/
 
 void
-cast128_decrypt(struct cast128_ctx *ctx,
+cast128_decrypt(const struct cast128_ctx *ctx,
 		unsigned length, uint8_t *dst,
 		const uint8_t *src)
 {
diff --git a/cast128.h b/cast128.h
index 421a18e17c61aea9ba61e705a7873955a13c7ad9..a1af0b035b125f8b7f162faae7a42aa1b66122b7 100644
--- a/cast128.h
+++ b/cast128.h
@@ -62,11 +62,11 @@ cast128_set_key(struct cast128_ctx *ctx,
 		unsigned length, const uint8_t *key);
 
 void
-cast128_encrypt(struct cast128_ctx *ctx,
+cast128_encrypt(const struct cast128_ctx *ctx,
 		unsigned length, uint8_t *dst,
 		const uint8_t *src);
 void
-cast128_decrypt(struct cast128_ctx *ctx,
+cast128_decrypt(const struct cast128_ctx *ctx,
 		unsigned length, uint8_t *dst,
 		const uint8_t *src);
 
diff --git a/serpent.c b/serpent.c
index db41b820eac15aa472a0aed78b80db5c2facb797..65344b078b5169be186b75daf0f196d825d14d0d 100644
--- a/serpent.c
+++ b/serpent.c
@@ -124,7 +124,7 @@ serpent_set_key(struct serpent_ctx *ctx,
 }
 
 void
-serpent_encrypt(struct serpent_ctx *ctx,
+serpent_encrypt(const struct serpent_ctx *ctx,
                 unsigned length, uint8_t *dst,
                 const uint8_t *plain)
 {
@@ -249,7 +249,7 @@ serpent_encrypt(struct serpent_ctx *ctx,
 }
 
 void
-serpent_decrypt(struct serpent_ctx *ctx,
+serpent_decrypt(const struct serpent_ctx *ctx,
                 unsigned length, uint8_t *dst,
                 const uint8_t *cipher)
 {
diff --git a/serpent.h b/serpent.h
index 2238f45b7453cf9d95fd3421f04259c3dcd0c4e7..2ae1da7d3e224196fc2bfe5cf9bf88fad2e7c678 100644
--- a/serpent.h
+++ b/serpent.h
@@ -66,11 +66,11 @@ serpent_set_key(struct serpent_ctx *ctx,
                 unsigned length, const uint8_t *key);
 
 void
-serpent_encrypt(struct serpent_ctx *ctx,
+serpent_encrypt(const struct serpent_ctx *ctx,
                 unsigned length, uint8_t *dst,
                 const uint8_t *src);
 void
-serpent_decrypt(struct serpent_ctx *ctx,
+serpent_decrypt(const struct serpent_ctx *ctx,
                 unsigned length, uint8_t *dst,
                 const uint8_t *src);
 
diff --git a/twofish.c b/twofish.c
index c7d05a13e079c7021e2e2a2f4b62baa01f377969..0e519eabcecf6beda4d4bc772c021305b319b6c4 100644
--- a/twofish.c
+++ b/twofish.c
@@ -333,13 +333,13 @@ twofish_set_key(struct twofish_ctx *context,
  */
 
 void
-twofish_encrypt(struct twofish_ctx *context,
+twofish_encrypt(const struct twofish_ctx *context,
 		unsigned length,
 		uint8_t *ciphertext,
 		const uint8_t *plaintext)
 {
-  uint32_t * keys        = context->keys;
-  uint32_t (*s_box)[256] = context->s_box;
+  const uint32_t * keys        = context->keys;
+  const uint32_t (*s_box)[256] = context->s_box;
 
   assert( !(length % TWOFISH_BLOCK_SIZE) );
   for ( ; length; length -= TWOFISH_BLOCK_SIZE)
@@ -403,14 +403,14 @@ twofish_encrypt(struct twofish_ctx *context,
  */
 
 void
-twofish_decrypt(struct twofish_ctx *context,
+twofish_decrypt(const struct twofish_ctx *context,
 		unsigned length,
 		uint8_t *plaintext,
 		const uint8_t *ciphertext)
 
 {
-  uint32_t *keys  = context->keys;
-  uint32_t (*s_box)[256] = context->s_box;
+  const uint32_t *keys  = context->keys;
+  const uint32_t (*s_box)[256] = context->s_box;
 
   assert( !(length % TWOFISH_BLOCK_SIZE) );
   for ( ; length; length -= TWOFISH_BLOCK_SIZE)
diff --git a/twofish.h b/twofish.h
index a21d0ec571e4cfc0da0bc366413a80140684a4a6..de5dc3cb8b89342ce7276b34cef1a1366835bd81 100644
--- a/twofish.h
+++ b/twofish.h
@@ -63,11 +63,11 @@ twofish_set_key(struct twofish_ctx *ctx,
 		unsigned length, const uint8_t *key);
 
 void
-twofish_encrypt(struct twofish_ctx *ctx,
+twofish_encrypt(const struct twofish_ctx *ctx,
 		unsigned length, uint8_t *dst,
 		const uint8_t *src);
 void
-twofish_decrypt(struct twofish_ctx *ctx,
+twofish_decrypt(const struct twofish_ctx *ctx,
 		unsigned length, uint8_t *dst,
 		const uint8_t *src);