chiark / gitweb /
Abolish serpent-l. Use PKCS#1 v1.5 RSA padding but without hash OID for secnet.
authorian <ian>
Tue, 17 Sep 2002 17:25:29 +0000 (17:25 +0000)
committerian <ian>
Tue, 17 Sep 2002 17:25:29 +0000 (17:25 +0000)
base/chiark-tcl.h
crypto/algtables.c
hbytes/hbytes.h

index f482cc57f0e99ee63593eb271f5eca266aed0ea1..ce00dd9537128a56d8227adc73c6d3eaa125328d 100644 (file)
@@ -220,15 +220,15 @@ typedef struct {
   const char *name;
   int hashsize, blocksize, statesize;
   void (*init)(void *state);
-  void (*update)(void *state, const Byte *data, int len);
-  void (*final)(void *state, Byte *digest);
-  void (*oneshot)(Byte *digest, const Byte *data, int len);
+  void (*update)(void *state, const void *data, int len);
+  void (*final)(void *state, void *digest);
+  void (*oneshot)(void *digest, const void *data, int len);
 } HashAlgInfo;
 
 extern const HashAlgInfo hashalginfos[];
 
 typedef struct {
-  void (*make_schedule)(void *schedule, const Byte *key, int keylen);
+  void (*make_schedule)(void *schedule, const void *key, int keylen);
   void (*crypt)(const void *schedule, const void *in, void *out);
      /* in and out may be the same, but if they aren't they may not overlap */
      /* in and out for crypt will have been through block_byteswap */
@@ -237,7 +237,7 @@ typedef struct {
 typedef struct {
   const char *name;
   int blocksize, schedule_size, key_min, key_max;
-  void (*byteswap)(Byte *block);
+  void (*byteswap)(void *block);
   BlockCipherDirectionInfo encrypt, decrypt;
 } BlockCipherAlgInfo;
 
index 7a651f06aa66e0a9d90529dea2ea7dd564fbd413..8fa24e4d626742c22fe92be35b9949f35ad5ba2d 100644 (file)
@@ -9,35 +9,7 @@
 #include "sha1.h"
 #include "md5.h"
 
-static void alg_serpent_b_byteswap_block(Byte *b) {
-  uint32_t t, *a= (void*)b;
-
-  t=    htonl(a[0]);
-  a[0]= htonl(a[3]);
-  a[3]= t;
-
-  t=    htonl(a[1]);
-  a[1]= htonl(a[2]);
-  a[2]= t;
-}
-
-static void alg_serpent_l_byteswap_block(Byte *b) {
-  uint32_t t, *a= (void*)b;
-  int i;
-
-  if (htonl(0x01020304UL) == 0x04030201UL) /* little endian */
-    return;
-  
-  for (i=0; i<4; i++) {
-    t= htonl(a[i]);
-    a[i]= ((t & 0x000000ffUL) << 24 |
-          (t & 0x0000ff00UL) << 8 |
-          (t & 0x00ff0000UL) >> 8 |
-          (t & 0xff000000UL) >> 24);
-  }
-}
-
-static void alg_serpent_makekey(void *schedule, const Byte *key, int keylen) {
+static void alg_serpent_makekey(void *schedule, const void *key, int keylen) {
   serpent_makekey(schedule, key, keylen);
 }
 
@@ -50,36 +22,32 @@ static void alg_serpent_decrypt(const void *sch, const void *in, void *out) {
 }
 
 const BlockCipherAlgInfo blockcipheralginfos[]= {
-  { "serpent-l", 16, sizeof(SerpentKeySchedule), 16,32,
-    alg_serpent_l_byteswap_block,
-    { alg_serpent_makekey, alg_serpent_encrypt },
-    { alg_serpent_makekey, alg_serpent_decrypt } },
-  { "serpent-b", 16, sizeof(SerpentKeySchedule), 16,32,
-    alg_serpent_b_byteswap_block,
+  { "serpent", 16, sizeof(SerpentKeySchedule), 16,32,
+    serpent_byteswap_block,
     { alg_serpent_makekey, alg_serpent_encrypt },
     { alg_serpent_makekey, alg_serpent_decrypt } },
   { 0 }
 };
 
 static void alg_sha1_init(void *state) { sha1_init(state); }
-static void alg_sha1_update(void *state, const Byte *data, int len) {
+static void alg_sha1_update(void *state, const void *data, int len) {
   sha1_update(state, data, len);
 }
-static void alg_sha1_final(void *state, Byte *digest) {
+static void alg_sha1_final(void *state, void *digest) {
   sha1_final(state, digest);
 }
-static void alg_sha1_oneshot(Byte *digest, const Byte *data, int len) {
+static void alg_sha1_oneshot(void *digest, const void *data, int len) {
   sha1(data,len,digest);
 }
 
 static void alg_md5_init(void *state) { MD5Init(state); }
-static void alg_md5_update(void *state, const Byte *data, int len) {
+static void alg_md5_update(void *state, const void *data, int len) {
   MD5Update(state, data, len);
 }
-static void alg_md5_final(void *state, Byte *digest) {
+static void alg_md5_final(void *state, void *digest) {
   MD5Final(digest, state);
 }
-static void alg_md5_oneshot(Byte *digest, const Byte *data, int len) {
+static void alg_md5_oneshot(void *digest, const void *data, int len) {
   struct MD5Context ctx;
   MD5Init(&ctx);
   MD5Update(&ctx,data,len);
index f482cc57f0e99ee63593eb271f5eca266aed0ea1..ce00dd9537128a56d8227adc73c6d3eaa125328d 100644 (file)
@@ -220,15 +220,15 @@ typedef struct {
   const char *name;
   int hashsize, blocksize, statesize;
   void (*init)(void *state);
-  void (*update)(void *state, const Byte *data, int len);
-  void (*final)(void *state, Byte *digest);
-  void (*oneshot)(Byte *digest, const Byte *data, int len);
+  void (*update)(void *state, const void *data, int len);
+  void (*final)(void *state, void *digest);
+  void (*oneshot)(void *digest, const void *data, int len);
 } HashAlgInfo;
 
 extern const HashAlgInfo hashalginfos[];
 
 typedef struct {
-  void (*make_schedule)(void *schedule, const Byte *key, int keylen);
+  void (*make_schedule)(void *schedule, const void *key, int keylen);
   void (*crypt)(const void *schedule, const void *in, void *out);
      /* in and out may be the same, but if they aren't they may not overlap */
      /* in and out for crypt will have been through block_byteswap */
@@ -237,7 +237,7 @@ typedef struct {
 typedef struct {
   const char *name;
   int blocksize, schedule_size, key_min, key_max;
-  void (*byteswap)(Byte *block);
+  void (*byteswap)(void *block);
   BlockCipherDirectionInfo encrypt, decrypt;
 } BlockCipherAlgInfo;