diff options
| author | Bruce Momjian <bruce@momjian.us> | 2001-09-23 04:12:44 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2001-09-23 04:12:44 +0000 |
| commit | ab560228643cca4a3640db82f61dc0e2cabf2acd (patch) | |
| tree | d905cd6ae2e9119f635ecc5679c321de2a667f81 /contrib/pgcrypto/crypt-blowfish.c | |
| parent | b75814aee320ef2b67ad01ba72c266dbbf94db45 (diff) | |
| download | postgresql-ab560228643cca4a3640db82f61dc0e2cabf2acd.tar.gz | |
Big thanks to Solar Designer who pointed out a bug in bcrypt
salt generation code. He also urged using better random source
and making possible to choose using bcrypt and xdes rounds more
easily. So, here's patch:
* For all salt generation, use Solar Designer's own code. This
is mostly due fact that his code is more fit for get_random_bytes()
style interface.
* New function: gen_salt(type, rounds). This lets specify iteration
count for algorithm.
* random.c: px_get_random_bytes() function.
Supported randomness soure: /dev/urandom, OpenSSL PRNG, libc random()
Default: /dev/urandom.
* Draft description of C API for pgcrypto functions.
New files: API, crypt-gensalt.c, random.c
Marko Kreen
Diffstat (limited to 'contrib/pgcrypto/crypt-blowfish.c')
| -rw-r--r-- | contrib/pgcrypto/crypt-blowfish.c | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/contrib/pgcrypto/crypt-blowfish.c b/contrib/pgcrypto/crypt-blowfish.c index 2979a71250..82056a806b 100644 --- a/contrib/pgcrypto/crypt-blowfish.c +++ b/contrib/pgcrypto/crypt-blowfish.c @@ -705,28 +705,3 @@ char *_crypt_blowfish_rn(__CONST char *key, __CONST char *setting, return output; } -char *_crypt_gensalt_blowfish_rn(unsigned long count, - __CONST char *input, int size, char *output, int output_size) -{ - if (size < 16 || output_size < 7 + 22 + 1 || - (count && (count < 4 || count > 31))) { - if (output_size > 0) output[0] = '\0'; - __set_errno((output_size < 7 + 22 + 1) ? ERANGE : EINVAL); - return NULL; - } - - if (!count) count = 5; - - output[0] = '$'; - output[1] = '2'; - output[2] = 'a'; - output[3] = '$'; - output[4] = '0' + count / 10; - output[5] = '0' + count % 10; - output[6] = '$'; - - BF_encode(&output[7], (BF_word *)input, 16); - output[7 + 22] = '\0'; - - return output; -} |
