apps: instead of varying implementation, make setup_engine a function always
[oweals/openssl.git] / apps / passwd.c
index 3ae8f9647140ddcc2fe87737568aa69181de1efa..a45245cd7ffb8f78cd1f37f13c371359676c012c 100644 (file)
@@ -302,7 +302,7 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt)
     OPENSSL_strlcat(out_buf, "$", sizeof out_buf);
     OPENSSL_strlcat(out_buf, salt, sizeof out_buf);
 
-    if (strlen(out_buf) > 6 + 8); /* assert "$apr1$..salt.." */
+    if (strlen(out_buf) > 6 + 8) /* assert "$apr1$..salt.." */
         return NULL;
 
     salt_out = out_buf + 2 + magic_len;
@@ -319,6 +319,7 @@ static char *md5crypt(const char *passwd, const char *magic, const char *salt)
         || !EVP_DigestUpdate(md, magic, magic_len)
         || !EVP_DigestUpdate(md, "$", 1)
         || !EVP_DigestUpdate(md, salt_out, salt_len))
+        goto err;
 
     md2 = EVP_MD_CTX_new();
     if (md2 == NULL
@@ -496,10 +497,10 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
         BIO_printf(out, "%s\t%s\n", hash, passwd);
     else
         BIO_printf(out, "%s\n", hash);
-    return 0;
+    return 1;
 
  end:
-    return 1;
+    return 0;
 }
 #else