Browse Source

Merge pull request #389 from libtom/pr/avoid-exit

avoid calling exit() in sosemanuk_setup
karel-m 7 years ago
parent
commit
b0c098e9c0
1 changed files with 1 additions and 5 deletions
  1. 1 5
      src/stream/sosemanuk/sosemanuk.c

+ 1 - 5
src/stream/sosemanuk/sosemanuk.c

@@ -257,16 +257,12 @@ int sosemanuk_setup(sosemanuk_state *ss, const unsigned char *key, unsigned long
 
    LTC_ARGCHK(ss  != NULL);
    LTC_ARGCHK(key != NULL);
+   LTC_ARGCHK(keylen > 0 && keylen <= 32);
 
     /*
      * The key is copied into the wbuf[] buffer and padded to 256 bits
      * as described in the Serpent specification.
      */
-    if (keylen == 0 || keylen > 32) {
-        fprintf(stderr, "invalid key size: %lu\n",
-            (unsigned long)keylen);
-        exit(EXIT_FAILURE);
-    }
     XMEMCPY(wbuf, key, keylen);
     if (keylen < 32) {
         wbuf[keylen] = 0x01;