chiark / gitweb /
Import release 0.1.15
[secnet.git] / transform.c
index 4c55b454c317defe095bfd01bd3e6b20882fd3c2..53ff448b3f58383670bb0c60108dd05bf288eb8e 100644 (file)
@@ -8,6 +8,7 @@
    the packets sent over the wire. */
 
 #include <stdio.h>
    the packets sent over the wire. */
 
 #include <stdio.h>
+#include <string.h>
 #include "secnet.h"
 #include "util.h"
 #include "serpent.h"
 #include "secnet.h"
 #include "util.h"
 #include "serpent.h"
@@ -53,7 +54,7 @@ static bool_t transform_setkey(void *sst, uint8_t *key, uint32_t keylen)
     struct transform_inst *ti=sst;
 
     if (keylen<REQUIRED_KEYLEN) {
     struct transform_inst *ti=sst;
 
     if (keylen<REQUIRED_KEYLEN) {
-       Message(M_ERROR,"transform_create: insufficient key material supplied "
+       Message(M_ERR,"transform_create: insufficient key material supplied "
                "(need %d bytes, got %d)\n",REQUIRED_KEYLEN,keylen);
        return False;
     }
                "(need %d bytes, got %d)\n",REQUIRED_KEYLEN,keylen);
        return False;
     }
@@ -89,7 +90,7 @@ static void transform_delkey(void *sst)
 }
 
 static uint32_t transform_forward(void *sst, struct buffer_if *buf,
 }
 
 static uint32_t transform_forward(void *sst, struct buffer_if *buf,
-                                 char **errmsg)
+                                 const char **errmsg)
 {
     struct transform_inst *ti=sst;
     uint8_t *padp;
 {
     struct transform_inst *ti=sst;
     uint8_t *padp;
@@ -200,7 +201,7 @@ static uint32_t transform_forward(void *sst, struct buffer_if *buf,
 }
 
 static uint32_t transform_reverse(void *sst, struct buffer_if *buf,
 }
 
 static uint32_t transform_reverse(void *sst, struct buffer_if *buf,
-                                 char **errmsg)
+                                 const char **errmsg)
 {
     struct transform_inst *ti=sst;
     uint8_t *padp;
 {
     struct transform_inst *ti=sst;
     uint8_t *padp;
@@ -404,14 +405,14 @@ void transform_module(dict_t *dict)
        ciphertext[2]!=0x83C31E69 ||
        ciphertext[1]!=0xec52bd82 ||
        ciphertext[0]!=0x27a46120) {
        ciphertext[2]!=0x83C31E69 ||
        ciphertext[1]!=0xec52bd82 ||
        ciphertext[0]!=0x27a46120) {
-       fatal("transform_module: serpent failed self-test (encrypt)\n");
+       fatal("transform_module: serpent failed self-test (encrypt)");
     }
     serpent_decrypt(&k,ciphertext,plaintext);
     if (plaintext[0]!=0 ||
        plaintext[1]!=1 ||
        plaintext[2]!=2 ||
        plaintext[3]!=3) {
     }
     serpent_decrypt(&k,ciphertext,plaintext);
     if (plaintext[0]!=0 ||
        plaintext[1]!=1 ||
        plaintext[2]!=2 ||
        plaintext[3]!=3) {
-       fatal("transform_module: serpent failed self-test (decrypt)\n");
+       fatal("transform_module: serpent failed self-test (decrypt)");
     }
 
     add_closure(dict,"serpent256-cbc",transform_apply);
     }
 
     add_closure(dict,"serpent256-cbc",transform_apply);