File: cryptokit-1.7-sks.patch

package info (click to toggle)
sks 1.1.6-14
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 2,296 kB
  • sloc: ml: 15,228; ansic: 1,069; sh: 358; makefile: 347
file content (145 lines) | stat: -rw-r--r-- 4,258 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
diff -urN cryptokit-1.7-orig/README.sks cryptokit-1.7/README.sks
--- cryptokit-1.7-orig/README.sks	1969-12-31 18:00:00.000000000 -0600
+++ cryptokit-1.7/README.sks	2013-06-19 00:30:29.097877008 -0500
@@ -0,0 +1,15 @@
+5his is the cryptokit-1.7 source with small changes to allow building without
+the OASIS build system, findlib, and their dependencies.
+
+The Makefile from cryptokit-1.3 was copied to cryptokit-1.5/src and patched to
+build the blowfish code.
+
+For 1.7, the Makefile was edited to build keccak and stubs-sha3
+
+Also fixed
+    File "cryptokit.ml", line 1930[*], characters 19-21:
+    Warning 3: deprecated feature: operator (or); you should use (||) instead
+    [*] 1900 in cryptokit-1.5
+Which may cause issues with later Ocaml compilers
+
+The main SKS Makefile was changed to support the build.
diff -urN cryptokit-1.7-orig/src/Makefile cryptokit-1.7/src/Makefile
--- cryptokit-1.7-orig/src/Makefile	1969-12-31 18:00:00.000000000 -0600
+++ cryptokit-1.7/src/Makefile	2013-06-19 00:24:06.276997446 -0500
@@ -0,0 +1,110 @@
+### Configuration section
+
+# Comment next line if the Zlib library is not available
+ZLIB=-DHAVE_ZLIB
+
+# The name of the Zlib library.  Usually -lz.  
+# Leave blank if you don't have Zlib.
+ZLIB_LIB=-lz
+
+# The directory containing the Zlib library (libz.a or libz.so)
+# Leave blank if you don't have Zlib.
+ZLIB_LIBDIR=/usr/lib
+#ZLIB_LIBDIR=/usr/lib64    # for x86-64 Linux
+
+# The directory containing the Zlib header file (zlib.h)
+ZLIB_INCLUDE=/usr/include
+
+# Where to install the library. By default: OCaml's standard library directory.
+INSTALLDIR=`$(OCAMLC) -where`
+
+# Flags for the C compiler.
+CFLAGS=-O -I$(ZLIB_INCLUDE) $(ZLIB)
+
+### End of configuration section
+
+OCAMLRUN=ocamlrun
+OCAMLC=ocamlc -g
+OCAMLOPT=ocamlopt
+OCAMLDEP=ocamldep
+MKLIB=ocamlmklib
+OCAMLDOC=ocamldoc
+
+C_OBJS=\
+  rijndael-alg-fst.o stubs-aes.o \
+  d3des.o stubs-des.o \
+  arcfour.o stubs-arcfour.o \
+  sha1.o stubs-sha1.o \
+  sha256.o stubs-sha256.o \
+  ripemd160.o stubs-ripemd160.o \
+  blowfish.o stubs-blowfish.o \
+  keccak.o stubs-sha3.o \
+  stubs-md5.o \
+  stubs-zlib.o \
+  stubs-misc.o \
+  stubs-rng.o
+
+CAML_OBJS=cryptokit.cmo
+
+all: libcryptokit.a cryptokit.cmi cryptokit.cma 
+
+allopt: libcryptokit.a cryptokit.cmi cryptokit.cmxa 
+
+libcryptokit.a: $(C_OBJS)
+	$(MKLIB) -o cryptokit $(C_OBJS) -L$(ZLIB_LIBDIR) $(ZLIB_LIB)
+
+cryptokit.cma: $(CAML_OBJS)
+	$(MKLIB) -o cryptokit $(CAML_OBJS) -L$(ZLIB_LIBDIR) $(ZLIB_LIB)
+
+cryptokit.cmxa: $(CAML_OBJS:.cmo=.cmx)
+	$(MKLIB) -o cryptokit $(CAML_OBJS:.cmo=.cmx) -L$(ZLIB_LIBDIR) $(ZLIB_LIB)
+
+test: test.byt
+	$(OCAMLRUN) -I . ./test.byt
+
+test.byt: libcryptokit.a cryptokit.cma test.ml
+	$(OCAMLC) -o test.byt unix.cma nums.cma cryptokit.cma test.ml
+
+clean::
+	rm -f test.byt
+
+speedtest: libcryptokit.a cryptokit.cmxa speedtest.ml
+	$(OCAMLOPT) -o speedtest -ccopt -L. \
+                unix.cmxa nums.cmxa cryptokit.cmxa speedtest.ml
+
+clean::
+	rm -f speedtest
+
+install:
+	cp cryptokit.cmi cryptokit.cma cryptokit.mli $(INSTALLDIR)
+	cp libcryptokit.a $(INSTALLDIR)
+	if test -f dllcryptokit.so; then cp dllcryptokit.so $(INSTALLDIR)/stublibs; fi
+	if test -f cryptokit.cmxa; then cp cryptokit.cmxa cryptokit.cmx cryptokit.a $(INSTALLDIR); fi
+
+doc: FORCE
+	cd doc; $(OCAMLDOC) -html -I .. ../cryptokit.mli
+
+FORCE:
+
+.SUFFIXES: .ml .mli .cmo .cmi .cmx
+
+.mli.cmi:
+	$(OCAMLC) -c $(COMPFLAGS) $<
+
+.ml.cmo:
+	$(OCAMLC) -c $(COMPFLAGS) $<
+
+.ml.cmx:
+	$(OCAMLOPT) -c $(COMPFLAGS) $<
+
+.c.o:
+	$(OCAMLC) -c -ccopt "$(CFLAGS)" $<
+
+clean::
+	rm -f *.cm* *.o *.a *.so
+
+depend:
+	gcc -MM -I `$(OCAMLC) -where` -isystem `$(OCAMLC) -where ` *.c > .depend
+	$(OCAMLDEP) *.mli *.ml >> .depend
+
+include .depend
diff -urN cryptokit-1.7-orig/src/cryptokit.ml cryptokit-1.7/src/cryptokit.ml
--- cryptokit-1.7-orig/src/cryptokit.ml	2013-04-23 12:41:40.000000000 -0500
+++ cryptokit-1.7/src/cryptokit.ml	2013-06-19 00:16:15.492252397 -0500
@@ -1927,7 +1927,7 @@
           oend <- oend + 3
       | _ -> ()
       end;
-      if multiline or padding then begin
+      if multiline || padding then begin
         let num_equals =
           match ipos with 1 -> 2 | 2 -> 1 | _ -> 0 in
         self#ensure_capacity num_equals;