diff options
| author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2016-06-27 11:53:42 -0500 |
|---|---|---|
| committer | lvh <_@lvh.io> | 2016-06-27 11:53:42 -0500 |
| commit | 394882d070390f25caeebb5fa27b73bc7666c7e4 (patch) | |
| tree | 714e21bbbd9c8e26887b99dd3b0d5ca4d340838d /src/build_bcrypt.py | |
| parent | 2cc711262fc0353efcbe6f7b4d855fe3bd404c10 (diff) | |
| download | py-bcrypt-git-394882d070390f25caeebb5fa27b73bc7666c7e4.tar.gz | |
Convert bcrypt to use OpenBSD code (#68)
* swap to using openbsd bcrypt
* we should probably call this 3.0
* update tests to handle slight change in behavior, test better
* strip out code we're not using
* define this for linux
* py3 fix
* add a changelog to the readme
* maybe work with windows
* portable endian header, replace swaps, other windows fixes
* handle older windows compilers properly, handle glibc < 2.9, retab
* remove a todo, that's definitely the limit
* make these definitions conditional since some BSDs may already have them
* add $2a$ tests from crypt_blowfish-1.3
* update readme to note supported prefixes
* almost pointless commit
* add support for $2y$
test vectors from openwall crypt-blowfish1.3
Diffstat (limited to 'src/build_bcrypt.py')
| -rw-r--r-- | src/build_bcrypt.py | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/src/build_bcrypt.py b/src/build_bcrypt.py index b468c08..aba9fd6 100644 --- a/src/build_bcrypt.py +++ b/src/build_bcrypt.py @@ -15,33 +15,26 @@ import os.path from cffi import FFI -BLOWFISH_DIR = os.path.join(os.path.dirname(__file__), "crypt_blowfish-1.3") +BLOWFISH_DIR = os.path.join(os.path.dirname(__file__), "_csrc") ffi = FFI() -ffi.cdef( - """ - char *crypt_gensalt_rn(const char *prefix, unsigned long count, - const char *input, int size, char *output, int output_size); - - char *crypt_rn(const char *key, const char *setting, void *data, int size); - """ -) +ffi.cdef(""" +int bcrypt_hashpass(const char *, const char *, char *, size_t); +int encode_base64(char *, const uint8_t *, size_t); +""") ffi.set_source( "_bcrypt", """ - #include "ow-crypt.h" + #include "pycabcrypt.h" """, sources=[ - os.path.join(BLOWFISH_DIR, "crypt_blowfish.c"), - os.path.join(BLOWFISH_DIR, "crypt_gensalt.c"), - os.path.join(BLOWFISH_DIR, "wrapper.c"), - # How can we get distutils to work with a .S file? - # Set bcrypt/crypt_blowfish-1.3/crypt_blowfish.c#57 back to 1 if we - # get ASM loaded. - # os.path.join(BLOWFISH_DIR, "x86.S"), + os.path.join(BLOWFISH_DIR, "blf.c"), + os.path.join(BLOWFISH_DIR, "bcrypt.c"), + os.path.join(BLOWFISH_DIR, "sha2.c"), + os.path.join(BLOWFISH_DIR, "timingsafe_bcmp.c"), ], include_dirs=[BLOWFISH_DIR], ) |
