summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorpixel <pixel>2007-07-23 09:51:53 +0000
committerpixel <pixel>2007-07-23 09:51:53 +0000
commitdfb3bbb04d94823319ed33948543d57305b48efb (patch)
treef7b9acbfdefff19c5a534f64606414a702a491ac /lib
parent9e8aec3df93a2c3ddbfa210c623ccd481d0fe4a6 (diff)
Having some consts in the code never hurts...
Diffstat (limited to 'lib')
-rw-r--r--lib/aes.c6
-rw-r--r--lib/des.c21
-rw-r--r--lib/md5.c4
-rw-r--r--lib/rc4.c2
-rw-r--r--lib/sha1.c4
-rw-r--r--lib/sha256.c4
6 files changed, 20 insertions, 21 deletions
diff --git a/lib/aes.c b/lib/aes.c
index edc8da7..ad24d05 100644
--- a/lib/aes.c
+++ b/lib/aes.c
@@ -434,7 +434,7 @@ uint32 KT3[256];
/* AES key scheduling routine */
-int aes_set_key( aes_context *ctx, uint8 *key, int nbits )
+int aes_set_key( aes_context *ctx, const uint8 *key, int nbits )
{
int i;
uint32 *RK, *SK;
@@ -585,7 +585,7 @@ int aes_set_key( aes_context *ctx, uint8 *key, int nbits )
/* AES 128-bit block encryption routine */
-void aes_encrypt( aes_context *ctx, uint8 input[16], uint8 output[16] )
+void aes_encrypt( aes_context *ctx, const uint8 input[16], uint8 output[16] )
{
uint32 *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3;
@@ -675,7 +675,7 @@ void aes_encrypt( aes_context *ctx, uint8 input[16], uint8 output[16] )
/* AES 128-bit block decryption routine */
-void aes_decrypt( aes_context *ctx, uint8 input[16], uint8 output[16] )
+void aes_decrypt( aes_context *ctx, const uint8 input[16], uint8 output[16] )
{
uint32 *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3;
diff --git a/lib/des.c b/lib/des.c
index eb22edc..f6b6e9e 100644
--- a/lib/des.c
+++ b/lib/des.c
@@ -263,7 +263,7 @@ static uint32 RHs[16] =
/* DES key schedule */
-int des_main_ks( uint32 SK[32], uint8 key[8] )
+int des_main_ks( uint32 SK[32], const uint8 key[8] )
{
int i;
uint32 X, Y, T;
@@ -332,7 +332,7 @@ int des_main_ks( uint32 SK[32], uint8 key[8] )
return( 0 );
}
-int des_set_key( des_context *ctx, uint8 key[8] )
+int des_set_key( des_context *ctx, const uint8 key[8] )
{
int i;
@@ -353,7 +353,7 @@ int des_set_key( des_context *ctx, uint8 key[8] )
/* DES 64-bit block encryption/decryption */
-void des_crypt( uint32 SK[32], uint8 input[8], uint8 output[8] )
+void des_crypt( uint32 SK[32], const uint8 input[8], uint8 output[8] )
{
uint32 X, Y, T;
@@ -377,19 +377,19 @@ void des_crypt( uint32 SK[32], uint8 input[8], uint8 output[8] )
PUT_UINT32( X, output, 4 );
}
-void des_encrypt( des_context *ctx, uint8 input[8], uint8 output[8] )
+void des_encrypt( des_context *ctx, const uint8 input[8], uint8 output[8] )
{
des_crypt( ctx->esk, input, output );
}
-void des_decrypt( des_context *ctx, uint8 input[8], uint8 output[8] )
+void des_decrypt( des_context *ctx, const uint8 input[8], uint8 output[8] )
{
des_crypt( ctx->dsk, input, output );
}
/* Triple-DES key schedule */
-int des3_set_2keys( des3_context *ctx, uint8 key1[8], uint8 key2[8] )
+int des3_set_2keys( des3_context *ctx, const uint8 key1[8], const uint8 key2[8] )
{
int i;
@@ -414,8 +414,7 @@ int des3_set_2keys( des3_context *ctx, uint8 key1[8], uint8 key2[8] )
return( 0 );
}
-int des3_set_3keys( des3_context *ctx, uint8 key1[8], uint8 key2[8],
- uint8 key3[8] )
+int des3_set_3keys( des3_context *ctx, const uint8 key1[8], const uint8 key2[8], const uint8 key3[8] )
{
int i;
@@ -440,7 +439,7 @@ int des3_set_3keys( des3_context *ctx, uint8 key1[8], uint8 key2[8],
/* Triple-DES 64-bit block encryption/decryption */
-void des3_crypt( uint32 SK[96], uint8 input[8], uint8 output[8] )
+void des3_crypt( uint32 SK[96], const uint8 input[8], uint8 output[8] )
{
uint32 X, Y, T;
@@ -482,12 +481,12 @@ void des3_crypt( uint32 SK[96], uint8 input[8], uint8 output[8] )
PUT_UINT32( X, output, 4 );
}
-void des3_encrypt( des3_context *ctx, uint8 input[8], uint8 output[8] )
+void des3_encrypt( des3_context *ctx, const uint8 input[8], uint8 output[8] )
{
des3_crypt( ctx->esk, input, output );
}
-void des3_decrypt( des3_context *ctx, uint8 input[8], uint8 output[8] )
+void des3_decrypt( des3_context *ctx, const uint8 input[8], uint8 output[8] )
{
des3_crypt( ctx->dsk, input, output );
}
diff --git a/lib/md5.c b/lib/md5.c
index 90d7566..762fdb7 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -49,7 +49,7 @@ void md5_starts( md5_context *ctx )
ctx->state[3] = 0x10325476;
}
-void md5_process( md5_context *ctx, uint8 data[64] )
+void md5_process( md5_context *ctx, const uint8 data[64] )
{
uint32 X[16], A, B, C, D;
@@ -172,7 +172,7 @@ void md5_process( md5_context *ctx, uint8 data[64] )
ctx->state[3] += D;
}
-void md5_update( md5_context *ctx, uint8 *input, uint32 length )
+void md5_update( md5_context *ctx, const uint8 *input, uint32 length )
{
uint32 left, fill;
diff --git a/lib/rc4.c b/lib/rc4.c
index cada3e1..565b3aa 100644
--- a/lib/rc4.c
+++ b/lib/rc4.c
@@ -20,7 +20,7 @@
#include "rc4.h"
-void rc4_setup( struct rc4_state *s, unsigned char *key, int length )
+void rc4_setup( struct rc4_state *s, const unsigned char *key, int length )
{
int i, j, k, *m, a;
diff --git a/lib/sha1.c b/lib/sha1.c
index 7064825..b761661 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -50,7 +50,7 @@ void sha1_starts( sha1_context *ctx )
ctx->state[4] = 0xC3D2E1F0;
}
-void sha1_process( sha1_context *ctx, uint8 data[64] )
+void sha1_process( sha1_context *ctx, const uint8 data[64] )
{
uint32 temp, W[16], A, B, C, D, E;
@@ -206,7 +206,7 @@ void sha1_process( sha1_context *ctx, uint8 data[64] )
ctx->state[4] += E;
}
-void sha1_update( sha1_context *ctx, uint8 *input, uint32 length )
+void sha1_update( sha1_context *ctx, const uint8 *input, uint32 length )
{
uint32 left, fill;
diff --git a/lib/sha256.c b/lib/sha256.c
index 0b94581..986f3e2 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -53,7 +53,7 @@ void sha256_starts( sha256_context *ctx )
ctx->state[7] = 0x5BE0CD19;
}
-void sha256_process( sha256_context *ctx, uint8 data[64] )
+void sha256_process( sha256_context *ctx, const uint8 data[64] )
{
uint32 temp1, temp2, W[64];
uint32 A, B, C, D, E, F, G, H;
@@ -184,7 +184,7 @@ void sha256_process( sha256_context *ctx, uint8 data[64] )
ctx->state[7] += H;
}
-void sha256_update( sha256_context *ctx, uint8 *input, uint32 length )
+void sha256_update( sha256_context *ctx, const uint8 *input, uint32 length )
{
uint32 left, fill;