summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSam Hartman <hartmans@mit.edu>2001-10-23 22:00:23 +0000
committerSam Hartman <hartmans@mit.edu>2001-10-23 22:00:23 +0000
commit518947ed8a5149fc3312a99ae75767fab8dce483 (patch)
tree4dd37a74a6b9f5725698dc06528395100d460151 /src
parent733ae6a80ed99cb98d1bceed546725fb6ebe3dfc (diff)
downloadkrb5-518947ed8a5149fc3312a99ae75767fab8dce483.tar.gz
krb5-518947ed8a5149fc3312a99ae75767fab8dce483.tar.xz
krb5-518947ed8a5149fc3312a99ae75767fab8dce483.zip
Handle inlines in ansi-compatible manner
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13835 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/lib/crypto/enc_provider/ChangeLog2
-rw-r--r--src/lib/crypto/enc_provider/arcfour.c27
2 files changed, 21 insertions, 8 deletions
diff --git a/src/lib/crypto/enc_provider/ChangeLog b/src/lib/crypto/enc_provider/ChangeLog
index 035d41b9d..4fe632c86 100644
--- a/src/lib/crypto/enc_provider/ChangeLog
+++ b/src/lib/crypto/enc_provider/ChangeLog
@@ -1,5 +1,7 @@
2001-10-23 Sam Hartman <hartmans@mit.edu>
+ * arcfour.c (endif /* gcc inlines*/): handle inlines in an ansi-compatible manner
+
* enc_provider.h: New encryption provider: rc4
2001-10-19 Sam Hartman <hartmans@mit.edu>
diff --git a/src/lib/crypto/enc_provider/arcfour.c b/src/lib/crypto/enc_provider/arcfour.c
index 956b75e8c..43c71f179 100644
--- a/src/lib/crypto/enc_provider/arcfour.c
+++ b/src/lib/crypto/enc_provider/arcfour.c
@@ -10,7 +10,11 @@
#include "arcfour-int.h"
#include "enc_provider.h"
/* gets the next byte from the PRNG */
-static inline unsigned int k5_arcfour_byte(ArcfourContext *);
+#if ((__GNUC__ >= 2) )
+static __inline__ unsigned int k5_arcfour_byte(ArcfourContext *);
+#else
+static unsigned int k5_arcfour_byte(ArcfourContext *);
+#endif /* gcc inlines*/
/* Initializes the context and sets the key. */
static krb5_error_code k5_arcfour_init(ArcfourContext *ctx, const unsigned char *key,
@@ -36,16 +40,22 @@ static void k5_arcfour_keysize(size_t *, size_t *);
static krb5_error_code
k5_arcfour_make_key(krb5_const krb5_data *, krb5_keyblock *);
-static char arcfour_weakkey1[] = {0x00, 0x00, 0xfd};
-static char arcfour_weakkey2[] = {0x03, 0xfd, 0xfc};
+static unsigned char arcfour_weakkey1[] = {0x00, 0x00, 0xfd};
+static unsigned char arcfour_weakkey2[] = {0x03, 0xfd, 0xfc};
static krb5_data arcfour_weakkeys[] = { {KV5M_DATA, sizeof (arcfour_weakkey1),
- arcfour_weakkey1},
+ (char * ) arcfour_weakkey1},
{KV5M_DATA, sizeof (arcfour_weakkey2),
- arcfour_weakkey2},
+ (char * ) arcfour_weakkey2},
{KV5M_DATA, 0, 0}
};
-static inline unsigned int k5_arcfour_byte(ArcfourContext *ctx)
+/*xxx we really should check for c9x here and use inline on
+ * more than just gcc. */
+#if ((__GNUC__ >= 2) )
+static __inline__ unsigned int k5_arcfour_byte(ArcfourContext * ctx)
+#else
+static unsigned int k5_arcfour_byte(ArcfourContext * ctx)
+#endif /* gcc inlines*/
{
unsigned int x;
unsigned int y;
@@ -147,7 +157,7 @@ k5_arcfour_docrypt(krb5_const krb5_keyblock *key, krb5_const krb5_data *state,
if (state) {
arcfour_ctx=(ArcfourContext *)state->data;
- k5_arcfour_crypt(arcfour_ctx, output->data, input->data, input->length);
+ k5_arcfour_crypt(arcfour_ctx, (unsigned char *) output->data, (const unsigned char *) input->data, input->length);
}
else {
arcfour_ctx=malloc(sizeof (ArcfourContext));
@@ -157,7 +167,8 @@ k5_arcfour_docrypt(krb5_const krb5_keyblock *key, krb5_const krb5_data *state,
free(arcfour_ctx);
return (ret);
}
- k5_arcfour_crypt(arcfour_ctx, output->data, input->data, input->length);
+ k5_arcfour_crypt(arcfour_ctx, (unsigned char * ) output->data,
+ (const unsigned char * ) input->data, input->length);
memset(arcfour_ctx, 0, sizeof (ArcfourContext));
free(arcfour_ctx);
}