Commits

Kelvin Wong committed 283405c Draft

Removed Py_ssize_t and replaced with old int style sizes due to segfaulting on 64-bit linuxes

Comments (0)

Files changed (3)

                      ('HAVE_SYS_SYSINFO_H', '1'),
                      ('_FILE_OFFSET_BITS', '64')]
     libraries = ['crypto', 'rt']
-    CFLAGS.append('-O0')
+    CFLAGS.append('-O2')
 elif sys.platform.startswith('win32'):
     define_macros = []
     library_dirs = ['c:\OpenSSL-Win32\lib\MinGW']
  * SUCH DAMAGE.
  */
 
-#ifdef PY_SSIZE_T_CLEAN
-#define PY_SSIZE_T_CLEAN
-#endif
 
 #include <Python.h>
 
 
 static PyObject *scrypt_hash(PyObject *self, PyObject *args, PyObject* kwargs) {
     PyStringObject *password,   *salt;
-    Py_ssize_t passwordlen, saltlen;
+    int passwordlen, saltlen;
     int paramerror, hasherror;
     unsigned PY_LONG_LONG N = 1 << 14;
     unsigned long int r = 8;
         hasherror = 0;
     } else {
         paramerror = 0;
-        hasherror = crypto_scrypt((const uint8_t *) PyString_AsString((PyObject *) password), (size_t) passwordlen,
-                                  (const uint8_t *) PyString_AsString((PyObject *) salt),     (size_t) saltlen,
+        hasherror = crypto_scrypt((uint8_t *) PyString_AsString((PyObject *) password), (size_t) passwordlen,
+                                  (uint8_t *) PyString_AsString((PyObject *) salt),     (size_t) saltlen,
                                   (uint64_t) N, (uint32_t) r, (uint32_t) p,
                                   (uint8_t *) outbuf, (size_t) outbuflen);
     }
  * SUCH DAMAGE.
  */
 
-#ifdef PY_SSIZE_T_CLEAN
-#define PY_SSIZE_T_CLEAN
-#endif
 
 #include <Python.h>
 
 }
 static PyObject *scrypt_hash(PyObject *self, PyObject *args, PyObject* kwargs) {
     const char *password, *salt;
-    Py_ssize_t passwordlen, saltlen;
+    int passwordlen, saltlen;
     int paramerror, hasherror;
     unsigned PY_LONG_LONG N = 1 << 14;
     unsigned long r = 8;
         hasherror = 0;
     } else {
         paramerror = 0;
-        hasherror = crypto_scrypt((const uint8_t *) password, (size_t) passwordlen,
-                                  (const uint8_t *) salt,     (size_t) saltlen,
+        hasherror = crypto_scrypt((uint8_t *) password, (size_t) passwordlen,
+                                  (uint8_t *) salt,     (size_t) saltlen,
                                   (uint64_t) N, (uint32_t) r, (uint32_t) p,
                                   (uint8_t *) outbuf, (size_t) outbuflen);
     }