summaryrefslogtreecommitdiff
path: root/lib/des.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/des.c')
-rw-r--r--lib/des.c21
1 files changed, 10 insertions, 11 deletions
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 );
}