# HG changeset patch # User Adam Chlipala # Date 1295192283 18000 # Node ID a5bfed32d4f7220b925a36e76aaccfc8f18d9a23 # Parent 115d217bbfbc041c9d4ae41751650a0f2f9745af Patch from Vladimir Shabanov to support crypt under OS X diff -r 115d217bbfbc -r a5bfed32d4f7 src/c/urweb.c --- a/src/c/urweb.c Sat Jan 15 20:06:00 2011 -0500 +++ b/src/c/urweb.c Sun Jan 16 10:38:03 2011 -0500 @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include @@ -3697,15 +3697,8 @@ } uw_Basis_string uw_Basis_crypt(uw_context ctx, uw_Basis_string key, uw_Basis_string salt) { - struct crypt_data *data; - - if ((data = uw_get_global(ctx, "crypt")) == NULL) { - data = malloc(sizeof(struct crypt_data)); - data->initialized = 0; - uw_set_global(ctx, "crypt", data, free); - } - - return uw_strdup(ctx, crypt_r(key, salt, data)); + char buf[14]; + return uw_strdup(ctx, DES_fcrypt(key, salt, buf)); } uw_Basis_bool uw_Basis_eq_time(uw_context ctx, uw_Basis_time t1, uw_Basis_time t2) { diff -r 115d217bbfbc -r a5bfed32d4f7 src/compiler.sml --- a/src/compiler.sml Sat Jan 15 20:06:00 2011 -0500 +++ b/src/compiler.sml Sun Jan 16 10:38:03 2011 -0500 @@ -1295,7 +1295,7 @@ ^ " " ^ #compile proto ^ " -c " ^ cname ^ " -o " ^ oname - val link = "gcc -Werror -O3 -lm -lcrypt -pthread " ^ Config.gccArgs ^ " " ^ libs ^ " " ^ lib ^ " " ^ Config.openssl ^ " " ^ oname + val link = "gcc -Werror -O3 -lm -pthread " ^ Config.gccArgs ^ " " ^ libs ^ " " ^ lib ^ " " ^ Config.openssl ^ " " ^ oname ^ " -o " ^ ename val (compile, link) = diff -r 115d217bbfbc -r a5bfed32d4f7 tests/crypt.ur --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/crypt.ur Sun Jan 16 10:38:03 2011 -0500 @@ -0,0 +1,7 @@ +fun cryptIt r = return + {[crypt r.Pass "AB"]} + + +fun main () = return +
+
diff -r 115d217bbfbc -r a5bfed32d4f7 tests/crypt.urs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/crypt.urs Sun Jan 16 10:38:03 2011 -0500 @@ -0,0 +1,1 @@ +val main : unit -> transaction page