]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
SHA1: Remove original libucw unit tests
authorPavel Tvrdík <pawel.tvrdik@gmail.cz>
Thu, 23 Apr 2015 10:52:36 +0000 (12:52 +0200)
committerPavel Tvrdík <pawel.tvrdik@gmail.cz>
Thu, 23 Apr 2015 13:19:26 +0000 (15:19 +0200)
lib/sha1.c
lib/sha1_hmac.c

index 2e2211199c6035922c819fac056377dc2b426c1c..19c8d8ff0671c86faea2ca0ac5bc154dc07a8b0d 100644 (file)
@@ -285,28 +285,3 @@ sha1_hash_buffer(byte *outbuf, const byte *buffer, uint length)
   sha1_update(&hd, buffer, length);
   memcpy(outbuf, sha1_final(&hd), SHA1_SIZE);
 }
-
-#ifdef TEST
-
-#include <stdio.h>
-#include <unistd.h>
-#include <ucw/string.h>
-
-int main(void)
-{
-  sha1_context hd;
-  byte buf[3];
-  int cnt;
-
-  sha1_init(&hd);
-  while ((cnt = read(0, buf, sizeof(buf))) > 0)
-    sha1_update(&hd, buf, cnt);
-
-  char text[SHA1_HEX_SIZE];
-  mem_to_hex(text, sha1_final(&hd), SHA1_SIZE, 0);
-  puts(text);
-
-  return 0;
-}
-
-#endif
index 58f0ca202e493b1bbf5a4b44c4d407f23457cdb9..f183bcc2451adadcf5b9db7109db3bc155a854c7 100644 (file)
@@ -74,41 +74,3 @@ sha1_hmac(byte *outbuf, const byte *key, uint keylen, const byte *data, uint dat
   byte *osha = sha1_hmac_final(&hd);
   memcpy(outbuf, osha, SHA1_SIZE);
 }
-
-#ifdef TEST
-
-#include <stdio.h>
-#include <ucw/string.h>
-
-static uint rd(char *dest)
-{
-  char buf[1024];
-  if (!fgets(buf, sizeof(buf), stdin))
-    die("fgets()");
-  *strchr(buf, '\n') = 0;
-  if (buf[0] == '0' && buf[1] == 'x')
-  {
-    const char *e = hex_to_mem(dest, buf+2, 1024, 0);
-    ASSERT(!*e);
-    return (e-buf-2)/2;
-  }
-  else
-  {
-    strcpy(dest, buf);
-    return strlen(dest);
-  }
-}
-
-int main(void)
-{
-  char key[1024], data[1024];
-  byte hmac[SHA1_SIZE];
-  uint kl = rd(key);
-  uint dl = rd(data);
-  sha1_hmac(hmac, key, kl, data, dl);
-  mem_to_hex(data, hmac, SHA1_SIZE, 0);
-  puts(data);
-  return 0;
-}
-
-#endif