git ssb

0+

dangerousbeans / %aPBe2k3ugtjBr4rrsU1…



Commit 98fea0551802cc58ded84f8be26a7d7ddafe845a

rename copied functions with ruby prefix so they don't conflict with

native versions where available.

Signed-off-by: Aman Gupta <aman@tmm1.net>
Ted Unangst authored on 12/16/2010, 6:33:59 AM
Aman Gupta committed on 12/20/2010, 6:58:43 PM
Parent: 32a206ce672a8af55442c22e030e147da01ddde3

Files changed

ext/mri/bcrypt.cchanged
ext/mri/bcrypt.hchanged
ext/mri/bcrypt_ext.cchanged
ext/mri/bcrypt.cView
@@ -149,9 +149,9 @@
149149 seems sensible.
150150 */
151151
152152 char *
153-bcrypt_gensalt(char *output, uint8_t log_rounds, uint8_t *rseed)
153+ruby_bcrypt_gensalt(char *output, uint8_t log_rounds, uint8_t *rseed)
154154 {
155155 if (log_rounds < 4)
156156 log_rounds = 4;
157157 else if (log_rounds > 31)
@@ -163,9 +163,9 @@
163163 /* We handle $Vers$log2(NumRounds)$salt+passwd$
164164 i.e. $2$04$iwouldntknowwhattosayetKdJ6iFtacBqJdKe6aW7ou */
165165
166166 char *
167-bcrypt(char *output, const char *key, const char *salt)
167+ruby_bcrypt(char *output, const char *key, const char *salt)
168168 {
169169 blf_ctx state;
170170 uint32_t rounds, i, k;
171171 uint16_t j;
ext/mri/bcrypt.hView
@@ -50,9 +50,9 @@
5050 * rseed: a seed of BCRYPT_MAXSALT bytes. Should be obtained from a
5151 * cryptographically secure random source.
5252 * Returns: output
5353 */
54-char *bcrypt_gensalt(char *output, uint8_t log_rounds, uint8_t *rseed);
54+char *ruby_bcrypt_gensalt(char *output, uint8_t log_rounds, uint8_t *rseed);
5555
5656 /*
5757 * Given a secret and a salt, generates a salted hash (which you can then store safely).
5858 *
@@ -61,7 +61,7 @@
6161 * key: A null-terminated secret.
6262 * salt: The salt, as generated by bcrypt_gensalt().
6363 * Returns: output on success, NULL on error.
6464 */
65-char *bcrypt(char *output, const char *key, const char *salt);
65+char *ruby_bcrypt(char *output, const char *key, const char *salt);
6666
6767 #endif /* _BCRYPT_H_ */
ext/mri/bcrypt_ext.cView
@@ -29,9 +29,9 @@
2929 } BCryptArguments;
3030
3131 static VALUE bcrypt_wrapper(void *_args) {
3232 BCryptArguments *args = (BCryptArguments *)_args;
33- return (VALUE)bcrypt(args->output, args->key, args->salt);
33+ return (VALUE)ruby_bcrypt(args->output, args->key, args->salt);
3434 }
3535
3636 #endif /* RUBY_1_9 */
3737
@@ -40,9 +40,9 @@
4040 static VALUE bc_salt(VALUE self, VALUE cost, VALUE seed) {
4141 int icost = NUM2INT(cost);
4242 char salt[BCRYPT_SALT_OUTPUT_SIZE];
4343
44- bcrypt_gensalt(salt, icost, (uint8_t *)RSTRING_PTR(seed));
44+ ruby_bcrypt_gensalt(salt, icost, (uint8_t *)RSTRING_PTR(seed));
4545 return rb_str_new2(salt);
4646 }
4747
4848 /* Given a secret and a salt, generates a salted hash (which you can then store safely).
@@ -69,9 +69,9 @@
6969 }
7070 /* otherwise, fallback to the non-GIL-unlocking code, just like on Ruby 1.8 */
7171 #endif
7272
73- if (bcrypt(output, safeguarded, (char *)RSTRING_PTR(salt)) != NULL) {
73+ if (ruby_bcrypt(output, safeguarded, (char *)RSTRING_PTR(salt)) != NULL) {
7474 return rb_str_new2(output);
7575 } else {
7676 return Qnil;
7777 }

Built with git-ssb-web