Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <711592c4-a552-4ced-904f-72205805de03@gmail.com>
Date: Sat, 14 Nov 2026 22:58:25 +0100
From: Ayadi <ayadix64@...il.com>
To: dalias@...c.org
Cc: musl@...ts.openwall.com
Subject: [PATCH] making crypt return a defined value defaulted to "*0"



to make easy to redefine, the crypt err value (curuntly "*")
will be defined as CRYPT_ERORR_RETURN_VALUE defaulted to "*0",
undifing it will automatcly returns NULL

the defined lives in crypt.h, wich is crypt_des.h renamed,
becuse the file will be included by all the crypt files, i thogh that
naming it a generic name will be nice

Have a nice day
         -Ayadi
***
 From 8034e73aa9cbc7b9c8090329e8d15d8898d02bdb Mon Sep 17 00:00:00 2001
From: Ayadi <ayadix64@...il.com>
Date: Sat, 14 Nov 2026 20:44:48 +0100
Subject: [PATCH 1/1] making crypt returns a optoinel defined value 
defulted to
  0* in erorrs
---
  src/crypt/{crypt_des.h => crypt.h} |  5 +++++
  src/crypt/crypt_blowfish.c         |  9 +++++++--
  src/crypt/crypt_des.c              | 10 ++++++++--
  src/crypt/crypt_md5.c              |  8 ++++++--
  src/crypt/crypt_sha256.c           |  8 ++++++--
  src/crypt/crypt_sha512.c           |  9 ++++++++-
  src/crypt/encrypt.c                |  2 +-
  7 files changed, 41 insertions(+), 10 deletions(-)
  rename src/crypt/{crypt_des.h => crypt.h} (71%)

diff --git a/src/crypt/crypt_des.h b/src/crypt/crypt.h
similarity index 71%
rename from src/crypt/crypt_des.h
rename to src/crypt/crypt.h
index 96748b56..b5c28239 100644
--- a/src/crypt/crypt_des.h
+++ b/src/crypt/crypt.h
@@ -3,6 +3,11 @@

  #include <stdint.h>

+#define CRYPT_ERORR_RETURN_VALUE "*0" //undifing this will make crypt 
return NULL at erorrs
+                      //this shold be a string
+
+
+
  struct expanded_key {
      uint32_t l[16], r[16];
  };
diff --git a/src/crypt/crypt_blowfish.c b/src/crypt/crypt_blowfish.c
index d722607b..d31e5ce7 100644
--- a/src/crypt/crypt_blowfish.c
+++ b/src/crypt/crypt_blowfish.c
@@ -49,7 +49,7 @@

  #include <string.h>
  #include <stdint.h>
-
+#include "crypt.h"
  typedef uint32_t BF_word;
  typedef int32_t BF_word_signed;

@@ -802,5 +802,10 @@ char *__crypt_blowfish(const char *key, const char 
*setting, char *output)
      if (ok && retval)
          return retval;

-    return "*";
+#ifdef CRYPT_ERORR_RETURN_VALUE
+    return CRYPT_ERORR_RETURN_VALUE;
+
+#else
+    return NULL;
+#endif
  }
diff --git a/src/crypt/crypt_des.c b/src/crypt/crypt_des.c
index 338a8f37..4ce0ca1b 100644
--- a/src/crypt/crypt_des.c
+++ b/src/crypt/crypt_des.c
@@ -56,7 +56,7 @@
  #include <stdint.h>
  #include <string.h>

-#include "crypt_des.h"
+#include "crypt.h"

  #define _PASSWORD_EFMT1 '_'

@@ -1012,5 +1012,11 @@ char *__crypt_des(const char *key, const char 
*setting, char *output)
      if (p && !strcmp(p, test_hash) && retval)
          return retval;

-    return (setting[0]=='*') ? "x" : "*";
+
+#ifdef CRYPT_ERORR_RETURN_VALUE
+    return !memcmp(setting, CRYPT_ERORR_RETURN_VALUE, sizeof 
CRYPT_ERORR_RETURN_VALUE) ? "x" : CRYPT_ERORR_RETURN_VALUE;
+#else
+    return NULL;
+#endif
+
  }
diff --git a/src/crypt/crypt_md5.c b/src/crypt/crypt_md5.c
index 6e75b36c..40f57f7c 100644
--- a/src/crypt/crypt_md5.c
+++ b/src/crypt/crypt_md5.c
@@ -8,7 +8,7 @@
   */
  #include <string.h>
  #include <stdint.h>
-
+#include "crypt.h"
  /* public domain md5 implementation based on rfc1321 and libtomcrypt */

  struct md5 {
@@ -280,6 +280,10 @@ char *__crypt_md5(const char *key, const char 
*setting, char *output)
      /* self test and stack cleanup */
      q = md5crypt(testkey, testsetting, testbuf);
      if (!p || q != testbuf || memcmp(testbuf, testhash, sizeof testhash))
-        return "*";
+#ifdef CRYPT_ERORR_RETURN_VALUE
+        return CRYPT_ERORR_RETURN_VALUE;
+#else
+        return NULL;
+#endif
      return p;
  }
diff --git a/src/crypt/crypt_sha256.c b/src/crypt/crypt_sha256.c
index e885dc68..b69858b0 100644
--- a/src/crypt/crypt_sha256.c
+++ b/src/crypt/crypt_sha256.c
@@ -12,7 +12,7 @@
  #include <stdio.h>
  #include <string.h>
  #include <stdint.h>
-
+#include "crypt.h"
  /* public domain sha256 implementation based on fips180-3 */

  struct sha256 {
@@ -317,6 +317,10 @@ char *__crypt_sha256(const char *key, const char 
*setting, char *output)
      /* self test and stack cleanup */
      q = sha256crypt(testkey, testsetting, testbuf);
      if (!p || q != testbuf || memcmp(testbuf, testhash, sizeof testhash))
-        return "*";
+#ifdef CRYPT_ERORR_RETURN_VALUE
+        return CRYPT_ERORR_RETURN_VALUE;
+#else
+        return NULL;
+#endif
      return p;
  }
diff --git a/src/crypt/crypt_sha512.c b/src/crypt/crypt_sha512.c
index 39970caf..9fd2f8f5 100644
--- a/src/crypt/crypt_sha512.c
+++ b/src/crypt/crypt_sha512.c
@@ -13,6 +13,9 @@
  #include <string.h>
  #include <stdint.h>

+#include "crypt.h"
+
+
  /* public domain sha512 implementation based on fips180-3 */
  /* >=2^64 bits messages are not supported (about 2000 peta bytes) */

@@ -366,6 +369,10 @@ char *__crypt_sha512(const char *key, const char 
*setting, char *output)
      /* self test and stack cleanup */
      q = sha512crypt(testkey, testsetting, testbuf);
      if (!p || q != testbuf || memcmp(testbuf, testhash, sizeof testhash))
-        return "*";
+#ifdef CRYPT_ERORR_RETURN_VALUE
+        return CRYPT_ERORR_RETURN_VALUE;
+#else
+        return NULL;
+#endif
      return p;
  }
diff --git a/src/crypt/encrypt.c b/src/crypt/encrypt.c
index 216abc91..b48bfcb3 100644
--- a/src/crypt/encrypt.c
+++ b/src/crypt/encrypt.c
@@ -2,7 +2,7 @@
  #include <stdlib.h>
  #include <unistd.h>

-#include "crypt_des.h"
+#include "crypt.h"

  static struct expanded_key __encrypt_key;

-- 
2.56.1

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.