├── .gitignore ├── AUTHORS ├── CMakeLists.txt ├── COPYING ├── ChangeLog ├── INSTALL ├── Makefile.am ├── Makefile.in ├── NEWS ├── README ├── aclocal.m4 ├── config.guess ├── config.h.in ├── config.sub ├── configure ├── configure.ac ├── depcomp ├── dist.cmake ├── doc ├── Makefile.am ├── Makefile.in └── us │ ├── examples.html │ ├── index.html │ ├── license.html │ ├── luacrypto-128.png │ └── manual.html ├── install-sh ├── ltmain.sh ├── luacrypto.pc.in ├── luacrypto.sln ├── luacrypto.vcproj ├── m4 ├── libtool.m4 ├── ltoptions.m4 ├── ltsugar.m4 ├── ltversion.m4 └── lt~obsolete.m4 ├── missing ├── rockspecs └── luacrypto-git-1.rockspec ├── src ├── Makefile.am ├── Makefile.in ├── lcrypto.c └── lcrypto.h └── tests ├── Makefile.am ├── Makefile.in ├── ca ├── README ├── ca.crt ├── ca.key ├── server.crt ├── server.csr ├── server.key └── server.key.insecure ├── encrypt.lua ├── message ├── open_seal.lua ├── pkeytest.lua ├── rand.lua ├── run-tests ├── test.lua ├── tmp.rnd └── x509_ca.lua /.gitignore: -------------------------------------------------------------------------------- 1 | *.ncb 2 | *.user 3 | *.suo 4 | Debug 5 | Release -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkottman/luacrypto/8c3f7f0caf023fe327f9e60391fc80df2d08a169/AUTHORS -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2007-2011 LuaDist. 2 | # Created by Peter Kapec 3 | # Redistribution and use of this file is allowed according to the terms of the MIT license. 4 | # For details see the COPYRIGHT file distributed with LuaDist. 5 | # Please note that the package source code is licensed under its own license. 6 | 7 | project ( luacrypto C ) 8 | cmake_minimum_required ( VERSION 2.6 ) 9 | include ( dist.cmake ) 10 | 11 | # Find libraries 12 | find_path ( OPENSSL_INCLUDE_DIR NAMES openssl/err.h ) 13 | include_directories ( ${OPENSSL_INCLUDE_DIR} ) 14 | find_library ( CRYPTO_LIBRARY NAMES crypto ) 15 | find_library ( SSL_LIBRARY NAMES ssl ) 16 | if ( WIN32 ) 17 | set ( LIBS gdi32 ) 18 | endif () 19 | include_directories ( src ) 20 | 21 | if ( WIN32 ) 22 | add_definitions ( "-DLUACRYPTO_API=__declspec(dllexport)" ) 23 | endif ( WIN32 ) 24 | 25 | option( DONT_USE_OPENSSL_DEPRECATED_FUNCTIONS 26 | "Prevent the use of deprecated public/private key generation functions" ON) 27 | if ( DONT_USE_OPENSSL_DEPRECATED_FUNCTIONS ) 28 | add_definitions ( -DDONT_USE_OPENSSL_DEPRECATED_FUNCTIONS ) 29 | endif ( DONT_USE_OPENSSL_DEPRECATED_FUNCTIONS ) 30 | 31 | install_lua_module ( crypto src/lcrypto.c ) 32 | target_link_libraries ( crypto ${CRYPTO_LIBRARY} ${SSL_LIBRARY} ${LIBS}) 33 | 34 | install_data ( README ) 35 | install_doc ( doc/ ) 36 | install_test ( tests/ ) 37 | 38 | add_lua_test ( tests/test.lua ) #FIX: arg[1] 39 | add_lua_test ( tests/rand.lua ) 40 | add_lua_test ( tests/encrypt.lua ) 41 | add_lua_test ( tests/pkeytest.lua ) 42 | add_lua_test ( tests/open_seal.lua ) 43 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | Copyright © 2006 Keith Howe 2 | © 2012 Michal Kottman 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 0.3.2 [25/Apr/2013] 2 | Updated for Lua 5.2 3 | 0.3.1 [6/Mar/2012] 4 | Added a compile-time option to initialize OpenSSL outside of LuaCrypto 5 | 0.3.0 [1/Mar/2012] 6 | Added encryption, decryption, signing, verifying, sealing and opening functionality. 7 | 0.2.0 [24/Aug/2006] 8 | Added random support. 9 | Removed Lua stub files and collapsed modules. 10 | Changed all supporting materials (documentation, build, etc.) to Kepler standards. 11 | 0.1.1 [22/Jan/2006] 12 | Added Lua 5.0/Compat-5.1 support. 13 | 0.1.0 [13/Jan/2006] 14 | Initial release. 15 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Installation Instructions 2 | ************************* 3 | 4 | Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, 5 | 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 6 | 7 | Copying and distribution of this file, with or without modification, 8 | are permitted in any medium without royalty provided the copyright 9 | notice and this notice are preserved. This file is offered as-is, 10 | without warranty of any kind. 11 | 12 | Basic Installation 13 | ================== 14 | 15 | Briefly, the shell commands `./configure; make; make install' should 16 | configure, build, and install this package. The following 17 | more-detailed instructions are generic; see the `README' file for 18 | instructions specific to this package. Some packages provide this 19 | `INSTALL' file but do not implement all of the features documented 20 | below. The lack of an optional feature in a given package is not 21 | necessarily a bug. More recommendations for GNU packages can be found 22 | in *note Makefile Conventions: (standards)Makefile Conventions. 23 | 24 | The `configure' shell script attempts to guess correct values for 25 | various system-dependent variables used during compilation. It uses 26 | those values to create a `Makefile' in each directory of the package. 27 | It may also create one or more `.h' files containing system-dependent 28 | definitions. Finally, it creates a shell script `config.status' that 29 | you can run in the future to recreate the current configuration, and a 30 | file `config.log' containing compiler output (useful mainly for 31 | debugging `configure'). 32 | 33 | It can also use an optional file (typically called `config.cache' 34 | and enabled with `--cache-file=config.cache' or simply `-C') that saves 35 | the results of its tests to speed up reconfiguring. Caching is 36 | disabled by default to prevent problems with accidental use of stale 37 | cache files. 38 | 39 | If you need to do unusual things to compile the package, please try 40 | to figure out how `configure' could check whether to do them, and mail 41 | diffs or instructions to the address given in the `README' so they can 42 | be considered for the next release. If you are using the cache, and at 43 | some point `config.cache' contains results you don't want to keep, you 44 | may remove or edit it. 45 | 46 | The file `configure.ac' (or `configure.in') is used to create 47 | `configure' by a program called `autoconf'. You need `configure.ac' if 48 | you want to change it or regenerate `configure' using a newer version 49 | of `autoconf'. 50 | 51 | The simplest way to compile this package is: 52 | 53 | 1. `cd' to the directory containing the package's source code and type 54 | `./configure' to configure the package for your system. 55 | 56 | Running `configure' might take a while. While running, it prints 57 | some messages telling which features it is checking for. 58 | 59 | 2. Type `make' to compile the package. 60 | 61 | 3. Optionally, type `make check' to run any self-tests that come with 62 | the package, generally using the just-built uninstalled binaries. 63 | 64 | 4. Type `make install' to install the programs and any data files and 65 | documentation. When installing into a prefix owned by root, it is 66 | recommended that the package be configured and built as a regular 67 | user, and only the `make install' phase executed with root 68 | privileges. 69 | 70 | 5. Optionally, type `make installcheck' to repeat any self-tests, but 71 | this time using the binaries in their final installed location. 72 | This target does not install anything. Running this target as a 73 | regular user, particularly if the prior `make install' required 74 | root privileges, verifies that the installation completed 75 | correctly. 76 | 77 | 6. You can remove the program binaries and object files from the 78 | source code directory by typing `make clean'. To also remove the 79 | files that `configure' created (so you can compile the package for 80 | a different kind of computer), type `make distclean'. There is 81 | also a `make maintainer-clean' target, but that is intended mainly 82 | for the package's developers. If you use it, you may have to get 83 | all sorts of other programs in order to regenerate files that came 84 | with the distribution. 85 | 86 | 7. Often, you can also type `make uninstall' to remove the installed 87 | files again. In practice, not all packages have tested that 88 | uninstallation works correctly, even though it is required by the 89 | GNU Coding Standards. 90 | 91 | 8. Some packages, particularly those that use Automake, provide `make 92 | distcheck', which can by used by developers to test that all other 93 | targets like `make install' and `make uninstall' work correctly. 94 | This target is generally not run by end users. 95 | 96 | Compilers and Options 97 | ===================== 98 | 99 | Some systems require unusual options for compilation or linking that 100 | the `configure' script does not know about. Run `./configure --help' 101 | for details on some of the pertinent environment variables. 102 | 103 | You can give `configure' initial values for configuration parameters 104 | by setting variables in the command line or in the environment. Here 105 | is an example: 106 | 107 | ./configure CC=c99 CFLAGS=-g LIBS=-lposix 108 | 109 | *Note Defining Variables::, for more details. 110 | 111 | Compiling For Multiple Architectures 112 | ==================================== 113 | 114 | You can compile the package for more than one kind of computer at the 115 | same time, by placing the object files for each architecture in their 116 | own directory. To do this, you can use GNU `make'. `cd' to the 117 | directory where you want the object files and executables to go and run 118 | the `configure' script. `configure' automatically checks for the 119 | source code in the directory that `configure' is in and in `..'. This 120 | is known as a "VPATH" build. 121 | 122 | With a non-GNU `make', it is safer to compile the package for one 123 | architecture at a time in the source code directory. After you have 124 | installed the package for one architecture, use `make distclean' before 125 | reconfiguring for another architecture. 126 | 127 | On MacOS X 10.5 and later systems, you can create libraries and 128 | executables that work on multiple system types--known as "fat" or 129 | "universal" binaries--by specifying multiple `-arch' options to the 130 | compiler but only a single `-arch' option to the preprocessor. Like 131 | this: 132 | 133 | ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ 134 | CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ 135 | CPP="gcc -E" CXXCPP="g++ -E" 136 | 137 | This is not guaranteed to produce working output in all cases, you 138 | may have to build one architecture at a time and combine the results 139 | using the `lipo' tool if you have problems. 140 | 141 | Installation Names 142 | ================== 143 | 144 | By default, `make install' installs the package's commands under 145 | `/usr/local/bin', include files under `/usr/local/include', etc. You 146 | can specify an installation prefix other than `/usr/local' by giving 147 | `configure' the option `--prefix=PREFIX', where PREFIX must be an 148 | absolute file name. 149 | 150 | You can specify separate installation prefixes for 151 | architecture-specific files and architecture-independent files. If you 152 | pass the option `--exec-prefix=PREFIX' to `configure', the package uses 153 | PREFIX as the prefix for installing programs and libraries. 154 | Documentation and other data files still use the regular prefix. 155 | 156 | In addition, if you use an unusual directory layout you can give 157 | options like `--bindir=DIR' to specify different values for particular 158 | kinds of files. Run `configure --help' for a list of the directories 159 | you can set and what kinds of files go in them. In general, the 160 | default for these options is expressed in terms of `${prefix}', so that 161 | specifying just `--prefix' will affect all of the other directory 162 | specifications that were not explicitly provided. 163 | 164 | The most portable way to affect installation locations is to pass the 165 | correct locations to `configure'; however, many packages provide one or 166 | both of the following shortcuts of passing variable assignments to the 167 | `make install' command line to change installation locations without 168 | having to reconfigure or recompile. 169 | 170 | The first method involves providing an override variable for each 171 | affected directory. For example, `make install 172 | prefix=/alternate/directory' will choose an alternate location for all 173 | directory configuration variables that were expressed in terms of 174 | `${prefix}'. Any directories that were specified during `configure', 175 | but not in terms of `${prefix}', must each be overridden at install 176 | time for the entire installation to be relocated. The approach of 177 | makefile variable overrides for each directory variable is required by 178 | the GNU Coding Standards, and ideally causes no recompilation. 179 | However, some platforms have known limitations with the semantics of 180 | shared libraries that end up requiring recompilation when using this 181 | method, particularly noticeable in packages that use GNU Libtool. 182 | 183 | The second method involves providing the `DESTDIR' variable. For 184 | example, `make install DESTDIR=/alternate/directory' will prepend 185 | `/alternate/directory' before all installation names. The approach of 186 | `DESTDIR' overrides is not required by the GNU Coding Standards, and 187 | does not work on platforms that have drive letters. On the other hand, 188 | it does better at avoiding recompilation issues, and works well even 189 | when some directory options were not specified in terms of `${prefix}' 190 | at `configure' time. 191 | 192 | Optional Features 193 | ================= 194 | 195 | If the package supports it, you can cause programs to be installed 196 | with an extra prefix or suffix on their names by giving `configure' the 197 | option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. 198 | 199 | Some packages pay attention to `--enable-FEATURE' options to 200 | `configure', where FEATURE indicates an optional part of the package. 201 | They may also pay attention to `--with-PACKAGE' options, where PACKAGE 202 | is something like `gnu-as' or `x' (for the X Window System). The 203 | `README' should mention any `--enable-' and `--with-' options that the 204 | package recognizes. 205 | 206 | For packages that use the X Window System, `configure' can usually 207 | find the X include and library files automatically, but if it doesn't, 208 | you can use the `configure' options `--x-includes=DIR' and 209 | `--x-libraries=DIR' to specify their locations. 210 | 211 | Some packages offer the ability to configure how verbose the 212 | execution of `make' will be. For these packages, running `./configure 213 | --enable-silent-rules' sets the default to minimal output, which can be 214 | overridden with `make V=1'; while running `./configure 215 | --disable-silent-rules' sets the default to verbose, which can be 216 | overridden with `make V=0'. 217 | 218 | Particular systems 219 | ================== 220 | 221 | On HP-UX, the default C compiler is not ANSI C compatible. If GNU 222 | CC is not installed, it is recommended to use the following options in 223 | order to use an ANSI C compiler: 224 | 225 | ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" 226 | 227 | and if that doesn't work, install pre-built binaries of GCC for HP-UX. 228 | 229 | On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot 230 | parse its `' header file. The option `-nodtk' can be used as 231 | a workaround. If GNU CC is not installed, it is therefore recommended 232 | to try 233 | 234 | ./configure CC="cc" 235 | 236 | and if that doesn't work, try 237 | 238 | ./configure CC="cc -nodtk" 239 | 240 | On Solaris, don't put `/usr/ucb' early in your `PATH'. This 241 | directory contains several dysfunctional programs; working variants of 242 | these programs are available in `/usr/bin'. So, if you need `/usr/ucb' 243 | in your `PATH', put it _after_ `/usr/bin'. 244 | 245 | On Haiku, software installed for all users goes in `/boot/common', 246 | not `/usr/local'. It is recommended to use the following options: 247 | 248 | ./configure --prefix=/boot/common 249 | 250 | Specifying the System Type 251 | ========================== 252 | 253 | There may be some features `configure' cannot figure out 254 | automatically, but needs to determine by the type of machine the package 255 | will run on. Usually, assuming the package is built to be run on the 256 | _same_ architectures, `configure' can figure that out, but if it prints 257 | a message saying it cannot guess the machine type, give it the 258 | `--build=TYPE' option. TYPE can either be a short name for the system 259 | type, such as `sun4', or a canonical name which has the form: 260 | 261 | CPU-COMPANY-SYSTEM 262 | 263 | where SYSTEM can have one of these forms: 264 | 265 | OS 266 | KERNEL-OS 267 | 268 | See the file `config.sub' for the possible values of each field. If 269 | `config.sub' isn't included in this package, then this package doesn't 270 | need to know the machine type. 271 | 272 | If you are _building_ compiler tools for cross-compiling, you should 273 | use the option `--target=TYPE' to select the type of system they will 274 | produce code for. 275 | 276 | If you want to _use_ a cross compiler, that generates code for a 277 | platform different from the build platform, you should specify the 278 | "host" platform (i.e., that on which the generated programs will 279 | eventually be run) with `--host=TYPE'. 280 | 281 | Sharing Defaults 282 | ================ 283 | 284 | If you want to set default values for `configure' scripts to share, 285 | you can create a site shell script called `config.site' that gives 286 | default values for variables like `CC', `cache_file', and `prefix'. 287 | `configure' looks for `PREFIX/share/config.site' if it exists, then 288 | `PREFIX/etc/config.site' if it exists. Or, you can set the 289 | `CONFIG_SITE' environment variable to the location of the site script. 290 | A warning: not all `configure' scripts look for a site script. 291 | 292 | Defining Variables 293 | ================== 294 | 295 | Variables not defined in a site shell script can be set in the 296 | environment passed to `configure'. However, some packages may run 297 | configure again during the build, and the customized values of these 298 | variables may be lost. In order to avoid this problem, you should set 299 | them in the `configure' command line, using `VAR=value'. For example: 300 | 301 | ./configure CC=/usr/local2/bin/gcc 302 | 303 | causes the specified `gcc' to be used as the C compiler (unless it is 304 | overridden in the site shell script). 305 | 306 | Unfortunately, this technique does not work for `CONFIG_SHELL' due to 307 | an Autoconf bug. Until the bug is fixed you can use this workaround: 308 | 309 | CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash 310 | 311 | `configure' Invocation 312 | ====================== 313 | 314 | `configure' recognizes the following options to control how it 315 | operates. 316 | 317 | `--help' 318 | `-h' 319 | Print a summary of all of the options to `configure', and exit. 320 | 321 | `--help=short' 322 | `--help=recursive' 323 | Print a summary of the options unique to this package's 324 | `configure', and exit. The `short' variant lists options used 325 | only in the top level, while the `recursive' variant lists options 326 | also present in any nested packages. 327 | 328 | `--version' 329 | `-V' 330 | Print the version of Autoconf used to generate the `configure' 331 | script, and exit. 332 | 333 | `--cache-file=FILE' 334 | Enable the cache: use and save the results of the tests in FILE, 335 | traditionally `config.cache'. FILE defaults to `/dev/null' to 336 | disable caching. 337 | 338 | `--config-cache' 339 | `-C' 340 | Alias for `--cache-file=config.cache'. 341 | 342 | `--quiet' 343 | `--silent' 344 | `-q' 345 | Do not print messages saying which checks are being made. To 346 | suppress all normal output, redirect it to `/dev/null' (any error 347 | messages will still be shown). 348 | 349 | `--srcdir=DIR' 350 | Look for the package's source code in directory DIR. Usually 351 | `configure' can determine that directory automatically. 352 | 353 | `--prefix=DIR' 354 | Use DIR as the installation prefix. *note Installation Names:: 355 | for more details, including other options available for fine-tuning 356 | the installation locations. 357 | 358 | `--no-create' 359 | `-n' 360 | Run the configure checks, but stop before creating any output 361 | files. 362 | 363 | `configure' also accepts some other, not widely useful, options. Run 364 | `configure --help' for more details. 365 | 366 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS = -I m4 2 | 3 | SUBDIRS = src \ 4 | doc 5 | 6 | pkgconfigdir = $(libdir)/pkgconfig 7 | pkgconfig_DATA = luacrypto.pc 8 | 9 | test: all 10 | $(MAKE) -C tests 11 | 12 | clean-local: 13 | $(MAKE) -C tests clean 14 | 15 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkottman/luacrypto/8c3f7f0caf023fe327f9e60391fc80df2d08a169/NEWS -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | LuaCrypto provides a Lua frontend to the OpenSSL cryptographic library. 2 | The OpenSSL features that are currently exposed are digests (MD5, SHA-1, 3 | HMAC, and more) and crypto-grade random number generators. 4 | 5 | LuaCrypto also supports encryption and decryption, signing and verifying, sealing and opening using the OpenSSL EVP API. 6 | 7 | Please see docs at doc/us/index.html or http://mkottman.github.io/luacrypto/. 8 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | /* config.h.in. Generated from configure.ac by autoheader. */ 2 | 3 | /* Define to 1 if you have the header file. */ 4 | #undef HAVE_DLFCN_H 5 | 6 | /* Define to 1 if you have the header file. */ 7 | #undef HAVE_INTTYPES_H 8 | 9 | /* Define to 1 if your system has a GNU libc compatible `malloc' function, and 10 | to 0 otherwise. */ 11 | #undef HAVE_MALLOC 12 | 13 | /* Define to 1 if you have the header file. */ 14 | #undef HAVE_MEMORY_H 15 | 16 | /* Define to 1 if you have the `memset' function. */ 17 | #undef HAVE_MEMSET 18 | 19 | /* Define to 1 if you have the header file. */ 20 | #undef HAVE_STDDEF_H 21 | 22 | /* Define to 1 if you have the header file. */ 23 | #undef HAVE_STDINT_H 24 | 25 | /* Define to 1 if you have the header file. */ 26 | #undef HAVE_STDLIB_H 27 | 28 | /* Define to 1 if you have the header file. */ 29 | #undef HAVE_STRINGS_H 30 | 31 | /* Define to 1 if you have the header file. */ 32 | #undef HAVE_STRING_H 33 | 34 | /* Define to 1 if you have the header file. */ 35 | #undef HAVE_SYS_STAT_H 36 | 37 | /* Define to 1 if you have the header file. */ 38 | #undef HAVE_SYS_TYPES_H 39 | 40 | /* Define to 1 if you have the header file. */ 41 | #undef HAVE_UNISTD_H 42 | 43 | /* Define to the sub-directory in which libtool stores uninstalled libraries. 44 | */ 45 | #undef LT_OBJDIR 46 | 47 | /* Name of package */ 48 | #undef PACKAGE 49 | 50 | /* Define to the address where bug reports for this package should be sent. */ 51 | #undef PACKAGE_BUGREPORT 52 | 53 | /* Define to the full name of this package. */ 54 | #undef PACKAGE_NAME 55 | 56 | /* Define to the full name and version of this package. */ 57 | #undef PACKAGE_STRING 58 | 59 | /* Define to the one symbol short name of this package. */ 60 | #undef PACKAGE_TARNAME 61 | 62 | /* Define to the home page for this package. */ 63 | #undef PACKAGE_URL 64 | 65 | /* Define to the version of this package. */ 66 | #undef PACKAGE_VERSION 67 | 68 | /* Define to 1 if you have the ANSI C header files. */ 69 | #undef STDC_HEADERS 70 | 71 | /* Version number of package */ 72 | #undef VERSION 73 | 74 | /* Define to rpl_malloc if the replacement function should be used. */ 75 | #undef malloc 76 | 77 | /* Define to `unsigned int' if does not define. */ 78 | #undef size_t 79 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | AC_PREREQ([2.68]) 2 | AC_INIT([luacrypto], [0.3.1], [https://github.com/mkottman/luacrypto/issues]) 3 | AC_CONFIG_SRCDIR([src/lcrypto.c]) 4 | AC_CONFIG_HEADERS([config.h]) 5 | AC_CONFIG_MACRO_DIR([m4]) 6 | AM_INIT_AUTOMAKE([-Wall]) 7 | LT_INIT([disable-static]) 8 | 9 | # Checks for programs. 10 | AC_PROG_CC 11 | AC_PROG_INSTALL 12 | AC_PROG_LIBTOOL 13 | AC_PATH_PROG([PKGCONFIG], [pkg-config]) 14 | AS_IF([test "x$PKGCONFIG" = "xno"], 15 | [AC_MSG_ERROR([pkg-config not found!])]) 16 | 17 | # Checks for libraries. 18 | 19 | # Checks for header files. 20 | AC_CHECK_HEADERS([stddef.h string.h]) 21 | 22 | # Checks for typedefs, structures, and compiler characteristics. 23 | AC_TYPE_SIZE_T 24 | 25 | # Checks for library functions. 26 | AC_FUNC_MALLOC 27 | AC_CHECK_FUNCS([memset]) 28 | 29 | # pkgconfig 30 | PKG_CHECK_MODULES([OPENSSL], [openssl]) 31 | PKG_CHECK_MODULES([LUA], [lua]) 32 | 33 | # lua libdir 34 | LUALIBDIR="`$PKGCONFIG --variable=libdir lua`" 35 | 36 | # dest of headers 37 | CRYPTOINC="${includedir}/${PACKAGE_NAME}" 38 | 39 | # substitute variables 40 | AC_SUBST([AM_CPPFLAGS], ["$OPENSSL_CFLAGS $LUA_CFLAGS"]) 41 | AC_SUBST([OPENSSL_LIBS]) 42 | AC_SUBST([LUA_LIBS]) 43 | AC_SUBST([LUALIBDIR]) 44 | AC_SUBST([CRYPTOINC]) 45 | 46 | AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile tests/Makefile luacrypto.pc]) 47 | AC_OUTPUT 48 | 49 | echo 50 | echo luacrypto.................................... : Version $VERSION 51 | echo Prefix....................................... : $prefix 52 | echo Lua libdir \(installdest\)..................... : $LUALIBDIR 53 | echo htmldir...................................... : $htmldir 54 | echo docdir....................................... : $docdir 55 | echo 56 | 57 | -------------------------------------------------------------------------------- /dist.cmake: -------------------------------------------------------------------------------- 1 | # LuaDist CMake utility library. 2 | # Provides variables and utility functions common to LuaDist CMake builds. 3 | # 4 | # Copyright (C) 2007-2011 LuaDist. 5 | # by David Manura, Peter Drahos 6 | # Redistribution and use of this file is allowed according to the terms of the MIT license. 7 | # For details see the COPYRIGHT file distributed with LuaDist. 8 | # Please note that the package source code is licensed under its own license. 9 | 10 | ## INSTALL DEFAULTS (Relative to CMAKE_INSTALL_PREFIX) 11 | # Primary paths 12 | set ( INSTALL_BIN bin CACHE PATH "Where to install binaries to." ) 13 | set ( INSTALL_LIB lib CACHE PATH "Where to install libraries to." ) 14 | set ( INSTALL_INC include CACHE PATH "Where to install headers to." ) 15 | set ( INSTALL_ETC etc CACHE PATH "Where to store configuration files" ) 16 | set ( INSTALL_LMOD ${INSTALL_LIB}/lua CACHE PATH "Directory to install Lua modules." ) 17 | set ( INSTALL_CMOD ${INSTALL_LIB}/lua CACHE PATH "Directory to install Lua binary modules." ) 18 | set ( INSTALL_SHARE share CACHE PATH "Directory for shared data." ) 19 | 20 | # Secondary paths 21 | set ( INSTALL_DATA ${INSTALL_SHARE}/${PROJECT_NAME} CACHE PATH "Directory the package can store documentation, tests or other data in.") 22 | set ( INSTALL_DOC ${INSTALL_DATA}/doc CACHE PATH "Recommended directory to install documentation into.") 23 | set ( INSTALL_EXAMPLE ${INSTALL_DATA}/example CACHE PATH "Recommended directory to install examples into.") 24 | set ( INSTALL_TEST ${INSTALL_DATA}/test CACHE PATH "Recommended directory to install tests into.") 25 | set ( INSTALL_FOO ${INSTALL_DATA}/etc CACHE PATH "Where to install additional files") 26 | 27 | # Skipable content, headers, binaries and libraries are always required 28 | option ( SKIP_TESTING "Do not add tests." OFF) 29 | option ( SKIP_LUA_WRAPPER "Do not build and install Lua executable wrappers." OFF) 30 | option ( SKIP_INSTALL_DATA "Skip installing all data." OFF ) 31 | if ( NOT SKIP_INSTALL_DATA ) 32 | option ( SKIP_INSTALL_DOC "Skip installation of documentation." OFF ) 33 | option ( SKIP_INSTALL_EXAMPLE "Skip installation of documentation." OFF ) 34 | option ( SKIP_INSTALL_TEST "Skip installation of tests." OFF) 35 | option ( SKIP_INSTALL_FOO "Skip installation of optional package content." OFF) 36 | endif () 37 | 38 | # TWEAKS 39 | # Setting CMAKE to use loose block and search for find modules in source directory 40 | set ( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true ) 41 | set ( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH} ) 42 | 43 | # In MSVC, prevent warnings that can occur when using standard libraries. 44 | if ( MSVC ) 45 | add_definitions ( -D_CRT_SECURE_NO_WARNINGS ) 46 | endif () 47 | 48 | ## MACROS 49 | # Parser macro 50 | macro ( parse_arguments prefix arg_names option_names) 51 | set ( DEFAULT_ARGS ) 52 | foreach ( arg_name ${arg_names} ) 53 | set ( ${prefix}_${arg_name} ) 54 | endforeach () 55 | foreach ( option ${option_names} ) 56 | set ( ${prefix}_${option} FALSE ) 57 | endforeach () 58 | 59 | set ( current_arg_name DEFAULT_ARGS ) 60 | set ( current_arg_list ) 61 | foreach ( arg ${ARGN} ) 62 | set ( larg_names ${arg_names} ) 63 | list ( FIND larg_names "${arg}" is_arg_name ) 64 | if ( is_arg_name GREATER -1 ) 65 | set ( ${prefix}_${current_arg_name} ${current_arg_list} ) 66 | set ( current_arg_name ${arg} ) 67 | set ( current_arg_list ) 68 | else () 69 | set ( loption_names ${option_names} ) 70 | list ( FIND loption_names "${arg}" is_option ) 71 | if ( is_option GREATER -1 ) 72 | set ( ${prefix}_${arg} TRUE ) 73 | else () 74 | set ( current_arg_list ${current_arg_list} ${arg} ) 75 | endif () 76 | endif () 77 | endforeach () 78 | set ( ${prefix}_${current_arg_name} ${current_arg_list} ) 79 | endmacro () 80 | 81 | # INSTALL_LUA_EXECUTABLE ( target source ) 82 | # Automatically generate a binary wrapper for lua application and install it 83 | # The wrapper and the source of the application will be placed into /bin 84 | # If the application source did not have .lua suffix then it will be added 85 | # USE: lua_executable ( sputnik src/sputnik.lua ) 86 | macro ( install_lua_executable _name _source ) 87 | get_filename_component ( _source_name ${_source} NAME_WE ) 88 | if ( NOT SKIP_LUA_WRAPPER ) 89 | enable_language ( C ) 90 | 91 | find_package ( Lua51 REQUIRED ) 92 | include_directories ( ${LUA_INCLUDE_DIR} ) 93 | 94 | set ( _wrapper ${CMAKE_CURRENT_BINARY_DIR}/${_name}.c ) 95 | set ( _code 96 | "// Not so simple executable wrapper for Lua apps 97 | #include 98 | #include 99 | #include 100 | #include 101 | #include 102 | 103 | lua_State *L\; 104 | 105 | static int getargs (lua_State *L, char **argv, int n) { 106 | int narg\; 107 | int i\; 108 | int argc = 0\; 109 | while (argv[argc]) argc++\; 110 | narg = argc - (n + 1)\; 111 | luaL_checkstack(L, narg + 3, \"too many arguments to script\")\; 112 | for (i=n+1\; i < argc\; i++) 113 | lua_pushstring(L, argv[i])\; 114 | lua_createtable(L, narg, n + 1)\; 115 | for (i=0\; i < argc\; i++) { 116 | lua_pushstring(L, argv[i])\; 117 | lua_rawseti(L, -2, i - n)\; 118 | } 119 | return narg\; 120 | } 121 | 122 | static void lstop (lua_State *L, lua_Debug *ar) { 123 | (void)ar\; 124 | lua_sethook(L, NULL, 0, 0)\; 125 | luaL_error(L, \"interrupted!\")\; 126 | } 127 | 128 | static void laction (int i) { 129 | signal(i, SIG_DFL)\; 130 | lua_sethook(L, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1)\; 131 | } 132 | 133 | static void l_message (const char *pname, const char *msg) { 134 | if (pname) fprintf(stderr, \"%s: \", pname)\; 135 | fprintf(stderr, \"%s\\n\", msg)\; 136 | fflush(stderr)\; 137 | } 138 | 139 | static int report (lua_State *L, int status) { 140 | if (status && !lua_isnil(L, -1)) { 141 | const char *msg = lua_tostring(L, -1)\; 142 | if (msg == NULL) msg = \"(error object is not a string)\"\; 143 | l_message(\"${_source_name}\", msg)\; 144 | lua_pop(L, 1)\; 145 | } 146 | return status\; 147 | } 148 | 149 | static int traceback (lua_State *L) { 150 | if (!lua_isstring(L, 1)) 151 | return 1\; 152 | lua_getfield(L, LUA_GLOBALSINDEX, \"debug\")\; 153 | if (!lua_istable(L, -1)) { 154 | lua_pop(L, 1)\; 155 | return 1\; 156 | } 157 | lua_getfield(L, -1, \"traceback\")\; 158 | if (!lua_isfunction(L, -1)) { 159 | lua_pop(L, 2)\; 160 | return 1\; 161 | } 162 | lua_pushvalue(L, 1)\; 163 | lua_pushinteger(L, 2)\; 164 | lua_call(L, 2, 1)\; 165 | return 1\; 166 | } 167 | 168 | static int docall (lua_State *L, int narg, int clear) { 169 | int status\; 170 | int base = lua_gettop(L) - narg\; 171 | lua_pushcfunction(L, traceback)\; 172 | lua_insert(L, base)\; 173 | signal(SIGINT, laction)\; 174 | status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base)\; 175 | signal(SIGINT, SIG_DFL)\; 176 | lua_remove(L, base)\; 177 | if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0)\; 178 | return status\; 179 | } 180 | 181 | int main (int argc, char **argv) { 182 | L=lua_open()\; 183 | lua_gc(L, LUA_GCSTOP, 0)\; 184 | luaL_openlibs(L)\; 185 | lua_gc(L, LUA_GCRESTART, 0)\; 186 | int narg = getargs(L, argv, 0)\; 187 | lua_setglobal(L, \"arg\")\; 188 | 189 | // Script 190 | char script[500] = \"./${_source_name}.lua\"\; 191 | lua_getglobal(L, \"_PROGDIR\")\; 192 | if (lua_isstring(L, -1)) { 193 | sprintf( script, \"%s/${_source_name}.lua\", lua_tostring(L, -1))\; 194 | } 195 | lua_pop(L, 1)\; 196 | 197 | // Run 198 | int status = luaL_loadfile(L, script)\; 199 | lua_insert(L, -(narg+1))\; 200 | if (status == 0) 201 | status = docall(L, narg, 0)\; 202 | else 203 | lua_pop(L, narg)\; 204 | 205 | report(L, status)\; 206 | lua_close(L)\; 207 | return status\; 208 | }; 209 | ") 210 | file ( WRITE ${_wrapper} ${_code} ) 211 | add_executable ( ${_name} ${_wrapper} ) 212 | target_link_libraries ( ${_name} ${LUA_LIBRARY} ) 213 | install ( TARGETS ${_name} DESTINATION ${INSTALL_BIN} ) 214 | endif() 215 | install ( PROGRAMS ${_source} DESTINATION ${INSTALL_BIN} RENAME ${_source_name}.lua ) 216 | endmacro () 217 | 218 | # INSTALL_LIBRARY 219 | # Installs any libraries generated using "add_library" into apropriate places. 220 | # USE: install_library ( libexpat ) 221 | macro ( install_library ) 222 | foreach ( _file ${ARGN} ) 223 | install ( TARGETS ${_file} RUNTIME DESTINATION ${INSTALL_BIN} LIBRARY DESTINATION ${INSTALL_LIB} ARCHIVE DESTINATION ${INSTALL_LIB} ) 224 | 225 | endforeach() 226 | endmacro () 227 | 228 | # INSTALL_EXECUTABLE 229 | # Installs any executables generated using "add_executable". 230 | # USE: install_executable ( lua ) 231 | macro ( install_executable ) 232 | foreach ( _file ${ARGN} ) 233 | install ( TARGETS ${_file} RUNTIME DESTINATION ${INSTALL_BIN} ) 234 | endforeach() 235 | endmacro () 236 | 237 | # INSTALL_HEADER 238 | # Install a directories or files into header destination. 239 | # USE: install_header ( lua.h luaconf.h ) or install_header ( GL ) 240 | # NOTE: If headers need to be installed into subdirectories use the INSTALL command directly 241 | macro ( install_header ) 242 | parse_arguments ( _ARG "INTO" "" ${ARGN} ) 243 | foreach ( _file ${_ARG_DEFAULT_ARGS} ) 244 | if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" ) 245 | install ( DIRECTORY ${_file} DESTINATION ${INSTALL_INC}/${_ARG_INTO} PATTERN "Makefile*" EXCLUDE ) 246 | else () 247 | install ( FILES ${_file} DESTINATION ${INSTALL_INC}/${_ARG_INTO} ) 248 | endif () 249 | endforeach() 250 | endmacro () 251 | 252 | # INSTALL_DATA ( files/directories ) 253 | # This installs additional data files or directories. 254 | # USE: install_data ( extra data.dat ) 255 | macro ( install_data ) 256 | if ( NOT SKIP_INSTALL_DATA ) 257 | parse_arguments ( _ARG "INTO" "" ${ARGN} ) 258 | foreach ( _file ${_ARG_DEFAULT_ARGS} ) 259 | if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" ) 260 | install ( DIRECTORY ${_file} DESTINATION ${INSTALL_DATA}/${_ARG_INTO} PATTERN "Makefile*" EXCLUDE ) 261 | else () 262 | install ( FILES ${_file} DESTINATION ${INSTALL_DATA}/${_ARG_INTO} ) 263 | endif () 264 | endforeach() 265 | endif() 266 | endmacro () 267 | 268 | # INSTALL_DOC ( files/directories ) 269 | # This installs documentation content 270 | # USE: install_doc ( doc/ ) 271 | macro ( install_doc ) 272 | if ( NOT SKIP_INSTALL_DATA AND NOT SKIP_INSTALL_DOC ) 273 | parse_arguments ( _ARG "INTO" "" ${ARGN} ) 274 | foreach ( _file ${_ARG_DEFAULT_ARGS} ) 275 | if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" ) 276 | install ( DIRECTORY ${_file} DESTINATION ${INSTALL_DOC}/${_ARG_INTO} PATTERN "Makefile*" EXCLUDE ) 277 | else () 278 | install ( FILES ${_file} DESTINATION ${INSTALL_DOC}/${_ARG_INTO} ) 279 | endif () 280 | endforeach() 281 | endif() 282 | endmacro () 283 | 284 | # INSTALL_EXAMPLE ( files/directories ) 285 | # This installs additional data 286 | # USE: install_example ( examples/ exampleA.lua ) 287 | macro ( install_example ) 288 | if ( NOT SKIP_INSTALL_DATA AND NOT SKIP_INSTALL_EXAMPLE ) 289 | parse_arguments ( _ARG "INTO" "" ${ARGN} ) 290 | foreach ( _file ${_ARG_DEFAULT_ARGS} ) 291 | if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" ) 292 | install ( DIRECTORY ${_file} DESTINATION ${INSTALL_EXAMPLE}/${_ARG_INTO} PATTERN "Makefile*" EXCLUDE ) 293 | else () 294 | install ( FILES ${_file} DESTINATION ${INSTALL_EXAMPLE}/${_ARG_INTO} ) 295 | endif () 296 | endforeach() 297 | endif() 298 | endmacro () 299 | 300 | # INSTALL_TEST ( files/directories ) 301 | # This installs tests 302 | # USE: install_example ( examples/ exampleA.lua ) 303 | macro ( install_test ) 304 | if ( NOT SKIP_INSTALL_DATA AND NOT SKIP_INSTALL_TEST ) 305 | parse_arguments ( _ARG "INTO" "" ${ARGN} ) 306 | foreach ( _file ${_ARG_DEFAULT_ARGS} ) 307 | if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" ) 308 | install ( DIRECTORY ${_file} DESTINATION ${INSTALL_TEST}/${_ARG_INTO} PATTERN "Makefile*" EXCLUDE ) 309 | else () 310 | install ( FILES ${_file} DESTINATION ${INSTALL_TEST}/${_ARG_INTO} ) 311 | endif () 312 | endforeach() 313 | endif() 314 | endmacro () 315 | 316 | # INSTALL_FOO ( files/directories ) 317 | # This installs optional content 318 | # USE: install_foo ( examples/ exampleA.lua ) 319 | macro ( install_foo ) 320 | if ( NOT SKIP_INSTALL_DATA AND NOT SKIP_INSTALL_FOO ) 321 | parse_arguments ( _ARG "INTO" "" ${ARGN} ) 322 | foreach ( _file ${_ARG_DEFAULT_ARGS} ) 323 | if ( IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${_file}" ) 324 | install ( DIRECTORY ${_file} DESTINATION ${INSTALL_FOO}/${_ARG_INTO} PATTERN "Makefile*" EXCLUDE ) 325 | else () 326 | install ( FILES ${_file} DESTINATION ${INSTALL_FOO}/${_ARG_INTO} ) 327 | endif () 328 | endforeach() 329 | endif() 330 | endmacro () 331 | 332 | # INSTALL_LUA_MODULE 333 | # This macro installs a lua source module into destination given by lua require syntax. 334 | # Binary modules are also supported where this funcion takes sources and libraries to compile separated by LINK keyword 335 | # USE: install_lua_module ( socket.http src/http.lua ) 336 | # USE2: install_lua_module ( mime.core src/mime.c ) 337 | # USE3: install_lua_module ( socket.core ${SRC_SOCKET} LINK ${LIB_SOCKET} ) 338 | macro (install_lua_module _name ) 339 | string ( REPLACE "." "/" _module "${_name}" ) 340 | string ( REPLACE "." "_" _target "${_name}" ) 341 | 342 | set ( _lua_module "${_module}.lua" ) 343 | set ( _bin_module "${_module}${CMAKE_SHARED_MODULE_SUFFIX}" ) 344 | 345 | parse_arguments ( _MODULE "LINK" "" ${ARGN} ) 346 | get_filename_component ( _ext ${ARGV1} EXT ) 347 | if ( _ext STREQUAL ".lua" ) 348 | get_filename_component ( _path ${_lua_module} PATH ) 349 | get_filename_component ( _filename ${_lua_module} NAME ) 350 | install ( FILES ${ARGV1} DESTINATION ${INSTALL_LMOD}/${_path} RENAME ${_filename} ) 351 | else () 352 | enable_language ( C ) 353 | get_filename_component ( _module_name ${_bin_module} NAME_WE ) 354 | get_filename_component ( _module_path ${_bin_module} PATH ) 355 | 356 | find_package ( Lua51 REQUIRED ) 357 | include_directories ( ${LUA_INCLUDE_DIR} ) 358 | 359 | add_library( ${_target} MODULE ${_MODULE_DEFAULT_ARGS}) 360 | target_link_libraries ( ${_target} ${LUA_LIBRARY} ${_MODULE_LINK} ) 361 | set_target_properties ( ${_target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${_module_path}" PREFIX "" OUTPUT_NAME "${_module_name}" ) 362 | 363 | install ( TARGETS ${_target} DESTINATION ${INSTALL_CMOD}/${_module_path} ) 364 | endif () 365 | endmacro () 366 | 367 | # ADD_LUA_TEST 368 | # Runs Lua script `_testfile` under CTest tester. 369 | # Optional argument `_testcurrentdir` is current working directory to run test under 370 | # (defaults to ${CMAKE_CURRENT_BINARY_DIR}). 371 | # Both paths, if relative, are relative to ${CMAKE_CURRENT_SOURCE_DIR}. 372 | # Under LuaDist, set test=true in config.lua to enable testing. 373 | # USE: add_lua_test ( test/test1.lua ) 374 | macro ( add_lua_test _testfile ) 375 | if ( NOT SKIP_TESTING ) 376 | include ( CTest ) 377 | find_program ( LUA NAMES lua lua.bat ) 378 | get_filename_component ( TESTFILEABS ${_testfile} ABSOLUTE ) 379 | get_filename_component ( TESTFILENAME ${_testfile} NAME ) 380 | get_filename_component ( TESTFILEBASE ${_testfile} NAME_WE ) 381 | 382 | # Write wrapper script. 383 | set ( TESTWRAPPER ${CMAKE_CURRENT_BINARY_DIR}/${TESTFILENAME} ) 384 | set ( TESTWRAPPERSOURCE 385 | "local configuration = ... 386 | local sodir = '${CMAKE_CURRENT_BINARY_DIR}' .. (configuration == '' and '' or '/' .. configuration) 387 | package.path = sodir .. '/?.lua\;' .. sodir .. '/?.lua\;' .. package.path 388 | package.cpath = sodir .. '/?.so\;' .. sodir .. '/?.dll\;' .. package.cpath 389 | arg[0] = '${TESTFILEABS}' 390 | return dofile '${TESTFILEABS}' 391 | " ) 392 | if ( ${ARGC} GREATER 1 ) 393 | set ( _testcurrentdir ${ARGV1} ) 394 | get_filename_component ( TESTCURRENTDIRABS ${_testcurrentdir} ABSOLUTE ) 395 | # note: CMake 2.6 (unlike 2.8) lacks WORKING_DIRECTORY parameter. 396 | #old: 397 | # set ( TESTWRAPPERSOURCE 398 | #"require 'lfs'; lfs.chdir('${TESTCURRENTDIRABS}' ) 399 | #${TESTWRAPPERSOURCE}" ) 400 | set ( _pre ${CMAKE_COMMAND} -E chdir "${TESTCURRENTDIRABS}" ) 401 | endif () 402 | file ( WRITE ${TESTWRAPPER} ${TESTWRAPPERSOURCE}) 403 | add_test ( NAME ${TESTFILEBASE} COMMAND ${_pre} ${LUA} ${TESTWRAPPER} $ ) 404 | endif () 405 | # see also http://gdcm.svn.sourceforge.net/viewvc/gdcm/Sandbox/CMakeModules/UsePythonTest.cmake 406 | endmacro () 407 | 408 | # Converts Lua source file `_source` to binary string embedded in C source 409 | # file `_target`. Optionally compiles Lua source to byte code (not available 410 | # under LuaJIT2, which doesn't have a bytecode loader). Additionally, Lua 411 | # versions of bin2c [1] and luac [2] may be passed respectively as additional 412 | # arguments. 413 | # 414 | # [1] http://lua-users.org/wiki/BinToCee 415 | # [2] http://lua-users.org/wiki/LuaCompilerInLua 416 | function ( add_lua_bin2c _target _source ) 417 | find_program ( LUA NAMES lua lua.bat ) 418 | execute_process ( COMMAND ${LUA} -e "string.dump(function()end)" RESULT_VARIABLE _LUA_DUMP_RESULT ERROR_QUIET ) 419 | if ( NOT ${_LUA_DUMP_RESULT} ) 420 | SET ( HAVE_LUA_DUMP true ) 421 | endif () 422 | message ( "-- string.dump=${HAVE_LUA_DUMP}" ) 423 | 424 | if ( ARGV2 ) 425 | get_filename_component ( BIN2C ${ARGV2} ABSOLUTE ) 426 | set ( BIN2C ${LUA} ${BIN2C} ) 427 | else () 428 | find_program ( BIN2C NAMES bin2c bin2c.bat ) 429 | endif () 430 | if ( HAVE_LUA_DUMP ) 431 | if ( ARGV3 ) 432 | get_filename_component ( LUAC ${ARGV3} ABSOLUTE ) 433 | set ( LUAC ${LUA} ${LUAC} ) 434 | else () 435 | find_program ( LUAC NAMES luac luac.bat ) 436 | endif () 437 | endif ( HAVE_LUA_DUMP ) 438 | message ( "-- bin2c=${BIN2C}" ) 439 | message ( "-- luac=${LUAC}" ) 440 | 441 | get_filename_component ( SOURCEABS ${_source} ABSOLUTE ) 442 | if ( HAVE_LUA_DUMP ) 443 | get_filename_component ( SOURCEBASE ${_source} NAME_WE ) 444 | add_custom_command ( 445 | OUTPUT ${_target} DEPENDS ${_source} 446 | COMMAND ${LUAC} -o ${CMAKE_CURRENT_BINARY_DIR}/${SOURCEBASE}.lo ${SOURCEABS} 447 | COMMAND ${BIN2C} ${CMAKE_CURRENT_BINARY_DIR}/${SOURCEBASE}.lo ">${_target}" ) 448 | else () 449 | add_custom_command ( 450 | OUTPUT ${_target} DEPENDS ${SOURCEABS} 451 | COMMAND ${BIN2C} ${_source} ">${_target}" ) 452 | endif () 453 | endfunction() 454 | -------------------------------------------------------------------------------- /doc/Makefile.am: -------------------------------------------------------------------------------- 1 | html_DATA = \ 2 | us/examples.html \ 3 | us/index.html \ 4 | us/license.html \ 5 | us/luacrypto-128.png \ 6 | us/manual.html 7 | -------------------------------------------------------------------------------- /doc/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.11.1 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 5 | # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, 6 | # Inc. 7 | # This Makefile.in is free software; the Free Software Foundation 8 | # gives unlimited permission to copy and/or distribute it, 9 | # with or without modifications, as long as this notice is preserved. 10 | 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 13 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 | # PARTICULAR PURPOSE. 15 | 16 | @SET_MAKE@ 17 | 18 | VPATH = @srcdir@ 19 | pkgdatadir = $(datadir)/@PACKAGE@ 20 | pkgincludedir = $(includedir)/@PACKAGE@ 21 | pkglibdir = $(libdir)/@PACKAGE@ 22 | pkglibexecdir = $(libexecdir)/@PACKAGE@ 23 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 24 | install_sh_DATA = $(install_sh) -c -m 644 25 | install_sh_PROGRAM = $(install_sh) -c 26 | install_sh_SCRIPT = $(install_sh) -c 27 | INSTALL_HEADER = $(INSTALL_DATA) 28 | transform = $(program_transform_name) 29 | NORMAL_INSTALL = : 30 | PRE_INSTALL = : 31 | POST_INSTALL = : 32 | NORMAL_UNINSTALL = : 33 | PRE_UNINSTALL = : 34 | POST_UNINSTALL = : 35 | build_triplet = @build@ 36 | host_triplet = @host@ 37 | subdir = doc 38 | DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 39 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 40 | am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ 41 | $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ 42 | $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ 43 | $(top_srcdir)/configure.ac 44 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 45 | $(ACLOCAL_M4) 46 | mkinstalldirs = $(install_sh) -d 47 | CONFIG_HEADER = $(top_builddir)/config.h 48 | CONFIG_CLEAN_FILES = 49 | CONFIG_CLEAN_VPATH_FILES = 50 | SOURCES = 51 | DIST_SOURCES = 52 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; 53 | am__vpath_adj = case $$p in \ 54 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ 55 | *) f=$$p;; \ 56 | esac; 57 | am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; 58 | am__install_max = 40 59 | am__nobase_strip_setup = \ 60 | srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` 61 | am__nobase_strip = \ 62 | for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" 63 | am__nobase_list = $(am__nobase_strip_setup); \ 64 | for p in $$list; do echo "$$p $$p"; done | \ 65 | sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ 66 | $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ 67 | if (++n[$$2] == $(am__install_max)) \ 68 | { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ 69 | END { for (dir in files) print dir, files[dir] }' 70 | am__base_list = \ 71 | sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ 72 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' 73 | am__installdirs = "$(DESTDIR)$(htmldir)" 74 | DATA = $(html_DATA) 75 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 76 | ACLOCAL = @ACLOCAL@ 77 | AMTAR = @AMTAR@ 78 | AM_CPPFLAGS = @AM_CPPFLAGS@ 79 | AR = @AR@ 80 | AUTOCONF = @AUTOCONF@ 81 | AUTOHEADER = @AUTOHEADER@ 82 | AUTOMAKE = @AUTOMAKE@ 83 | AWK = @AWK@ 84 | CC = @CC@ 85 | CCDEPMODE = @CCDEPMODE@ 86 | CFLAGS = @CFLAGS@ 87 | CPP = @CPP@ 88 | CPPFLAGS = @CPPFLAGS@ 89 | CRYPTOINC = @CRYPTOINC@ 90 | CYGPATH_W = @CYGPATH_W@ 91 | DEFS = @DEFS@ 92 | DEPDIR = @DEPDIR@ 93 | DLLTOOL = @DLLTOOL@ 94 | DSYMUTIL = @DSYMUTIL@ 95 | DUMPBIN = @DUMPBIN@ 96 | ECHO_C = @ECHO_C@ 97 | ECHO_N = @ECHO_N@ 98 | ECHO_T = @ECHO_T@ 99 | EGREP = @EGREP@ 100 | EXEEXT = @EXEEXT@ 101 | FGREP = @FGREP@ 102 | GREP = @GREP@ 103 | INSTALL = @INSTALL@ 104 | INSTALL_DATA = @INSTALL_DATA@ 105 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 106 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 107 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 108 | LD = @LD@ 109 | LDFLAGS = @LDFLAGS@ 110 | LIBOBJS = @LIBOBJS@ 111 | LIBS = @LIBS@ 112 | LIBTOOL = @LIBTOOL@ 113 | LIPO = @LIPO@ 114 | LN_S = @LN_S@ 115 | LTLIBOBJS = @LTLIBOBJS@ 116 | LUALIBDIR = @LUALIBDIR@ 117 | LUA_CFLAGS = @LUA_CFLAGS@ 118 | LUA_LIBS = @LUA_LIBS@ 119 | MAKEINFO = @MAKEINFO@ 120 | MANIFEST_TOOL = @MANIFEST_TOOL@ 121 | MKDIR_P = @MKDIR_P@ 122 | NM = @NM@ 123 | NMEDIT = @NMEDIT@ 124 | OBJDUMP = @OBJDUMP@ 125 | OBJEXT = @OBJEXT@ 126 | OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ 127 | OPENSSL_LIBS = @OPENSSL_LIBS@ 128 | OTOOL = @OTOOL@ 129 | OTOOL64 = @OTOOL64@ 130 | PACKAGE = @PACKAGE@ 131 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 132 | PACKAGE_NAME = @PACKAGE_NAME@ 133 | PACKAGE_STRING = @PACKAGE_STRING@ 134 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 135 | PACKAGE_URL = @PACKAGE_URL@ 136 | PACKAGE_VERSION = @PACKAGE_VERSION@ 137 | PATH_SEPARATOR = @PATH_SEPARATOR@ 138 | PKGCONFIG = @PKGCONFIG@ 139 | PKG_CONFIG = @PKG_CONFIG@ 140 | PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ 141 | PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ 142 | RANLIB = @RANLIB@ 143 | SED = @SED@ 144 | SET_MAKE = @SET_MAKE@ 145 | SHELL = @SHELL@ 146 | STRIP = @STRIP@ 147 | VERSION = @VERSION@ 148 | abs_builddir = @abs_builddir@ 149 | abs_srcdir = @abs_srcdir@ 150 | abs_top_builddir = @abs_top_builddir@ 151 | abs_top_srcdir = @abs_top_srcdir@ 152 | ac_ct_AR = @ac_ct_AR@ 153 | ac_ct_CC = @ac_ct_CC@ 154 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ 155 | am__include = @am__include@ 156 | am__leading_dot = @am__leading_dot@ 157 | am__quote = @am__quote@ 158 | am__tar = @am__tar@ 159 | am__untar = @am__untar@ 160 | bindir = @bindir@ 161 | build = @build@ 162 | build_alias = @build_alias@ 163 | build_cpu = @build_cpu@ 164 | build_os = @build_os@ 165 | build_vendor = @build_vendor@ 166 | builddir = @builddir@ 167 | datadir = @datadir@ 168 | datarootdir = @datarootdir@ 169 | docdir = @docdir@ 170 | dvidir = @dvidir@ 171 | exec_prefix = @exec_prefix@ 172 | host = @host@ 173 | host_alias = @host_alias@ 174 | host_cpu = @host_cpu@ 175 | host_os = @host_os@ 176 | host_vendor = @host_vendor@ 177 | htmldir = @htmldir@ 178 | includedir = @includedir@ 179 | infodir = @infodir@ 180 | install_sh = @install_sh@ 181 | libdir = @libdir@ 182 | libexecdir = @libexecdir@ 183 | localedir = @localedir@ 184 | localstatedir = @localstatedir@ 185 | mandir = @mandir@ 186 | mkdir_p = @mkdir_p@ 187 | oldincludedir = @oldincludedir@ 188 | pdfdir = @pdfdir@ 189 | prefix = @prefix@ 190 | program_transform_name = @program_transform_name@ 191 | psdir = @psdir@ 192 | sbindir = @sbindir@ 193 | sharedstatedir = @sharedstatedir@ 194 | srcdir = @srcdir@ 195 | sysconfdir = @sysconfdir@ 196 | target_alias = @target_alias@ 197 | top_build_prefix = @top_build_prefix@ 198 | top_builddir = @top_builddir@ 199 | top_srcdir = @top_srcdir@ 200 | html_DATA = \ 201 | us/examples.html \ 202 | us/index.html \ 203 | us/license.html \ 204 | us/luacrypto-128.png \ 205 | us/manual.html 206 | 207 | all: all-am 208 | 209 | .SUFFIXES: 210 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) 211 | @for dep in $?; do \ 212 | case '$(am__configure_deps)' in \ 213 | *$$dep*) \ 214 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ 215 | && { if test -f $@; then exit 0; else break; fi; }; \ 216 | exit 1;; \ 217 | esac; \ 218 | done; \ 219 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ 220 | $(am__cd) $(top_srcdir) && \ 221 | $(AUTOMAKE) --gnu doc/Makefile 222 | .PRECIOUS: Makefile 223 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 224 | @case '$?' in \ 225 | *config.status*) \ 226 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 227 | *) \ 228 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 229 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 230 | esac; 231 | 232 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 233 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 234 | 235 | $(top_srcdir)/configure: $(am__configure_deps) 236 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 237 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) 238 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 239 | $(am__aclocal_m4_deps): 240 | 241 | mostlyclean-libtool: 242 | -rm -f *.lo 243 | 244 | clean-libtool: 245 | -rm -rf .libs _libs 246 | install-htmlDATA: $(html_DATA) 247 | @$(NORMAL_INSTALL) 248 | test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)" 249 | @list='$(html_DATA)'; test -n "$(htmldir)" || list=; \ 250 | for p in $$list; do \ 251 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ 252 | echo "$$d$$p"; \ 253 | done | $(am__base_list) | \ 254 | while read files; do \ 255 | echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \ 256 | $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \ 257 | done 258 | 259 | uninstall-htmlDATA: 260 | @$(NORMAL_UNINSTALL) 261 | @list='$(html_DATA)'; test -n "$(htmldir)" || list=; \ 262 | files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ 263 | test -n "$$files" || exit 0; \ 264 | echo " ( cd '$(DESTDIR)$(htmldir)' && rm -f" $$files ")"; \ 265 | cd "$(DESTDIR)$(htmldir)" && rm -f $$files 266 | tags: TAGS 267 | TAGS: 268 | 269 | ctags: CTAGS 270 | CTAGS: 271 | 272 | 273 | distdir: $(DISTFILES) 274 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 275 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 276 | list='$(DISTFILES)'; \ 277 | dist_files=`for file in $$list; do echo $$file; done | \ 278 | sed -e "s|^$$srcdirstrip/||;t" \ 279 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ 280 | case $$dist_files in \ 281 | */*) $(MKDIR_P) `echo "$$dist_files" | \ 282 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ 283 | sort -u` ;; \ 284 | esac; \ 285 | for file in $$dist_files; do \ 286 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 287 | if test -d $$d/$$file; then \ 288 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ 289 | if test -d "$(distdir)/$$file"; then \ 290 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 291 | fi; \ 292 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 293 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ 294 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 295 | fi; \ 296 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ 297 | else \ 298 | test -f "$(distdir)/$$file" \ 299 | || cp -p $$d/$$file "$(distdir)/$$file" \ 300 | || exit 1; \ 301 | fi; \ 302 | done 303 | check-am: all-am 304 | check: check-am 305 | all-am: Makefile $(DATA) 306 | installdirs: 307 | for dir in "$(DESTDIR)$(htmldir)"; do \ 308 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ 309 | done 310 | install: install-am 311 | install-exec: install-exec-am 312 | install-data: install-data-am 313 | uninstall: uninstall-am 314 | 315 | install-am: all-am 316 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 317 | 318 | installcheck: installcheck-am 319 | install-strip: 320 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 321 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 322 | `test -z '$(STRIP)' || \ 323 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 324 | mostlyclean-generic: 325 | 326 | clean-generic: 327 | 328 | distclean-generic: 329 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) 330 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) 331 | 332 | maintainer-clean-generic: 333 | @echo "This command is intended for maintainers to use" 334 | @echo "it deletes files that may require special tools to rebuild." 335 | clean: clean-am 336 | 337 | clean-am: clean-generic clean-libtool mostlyclean-am 338 | 339 | distclean: distclean-am 340 | -rm -f Makefile 341 | distclean-am: clean-am distclean-generic 342 | 343 | dvi: dvi-am 344 | 345 | dvi-am: 346 | 347 | html: html-am 348 | 349 | html-am: 350 | 351 | info: info-am 352 | 353 | info-am: 354 | 355 | install-data-am: install-htmlDATA 356 | 357 | install-dvi: install-dvi-am 358 | 359 | install-dvi-am: 360 | 361 | install-exec-am: 362 | 363 | install-html: install-html-am 364 | 365 | install-html-am: 366 | 367 | install-info: install-info-am 368 | 369 | install-info-am: 370 | 371 | install-man: 372 | 373 | install-pdf: install-pdf-am 374 | 375 | install-pdf-am: 376 | 377 | install-ps: install-ps-am 378 | 379 | install-ps-am: 380 | 381 | installcheck-am: 382 | 383 | maintainer-clean: maintainer-clean-am 384 | -rm -f Makefile 385 | maintainer-clean-am: distclean-am maintainer-clean-generic 386 | 387 | mostlyclean: mostlyclean-am 388 | 389 | mostlyclean-am: mostlyclean-generic mostlyclean-libtool 390 | 391 | pdf: pdf-am 392 | 393 | pdf-am: 394 | 395 | ps: ps-am 396 | 397 | ps-am: 398 | 399 | uninstall-am: uninstall-htmlDATA 400 | 401 | .MAKE: install-am install-strip 402 | 403 | .PHONY: all all-am check check-am clean clean-generic clean-libtool \ 404 | distclean distclean-generic distclean-libtool distdir dvi \ 405 | dvi-am html html-am info info-am install install-am \ 406 | install-data install-data-am install-dvi install-dvi-am \ 407 | install-exec install-exec-am install-html install-html-am \ 408 | install-htmlDATA install-info install-info-am install-man \ 409 | install-pdf install-pdf-am install-ps install-ps-am \ 410 | install-strip installcheck installcheck-am installdirs \ 411 | maintainer-clean maintainer-clean-generic mostlyclean \ 412 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ 413 | uninstall uninstall-am uninstall-htmlDATA 414 | 415 | 416 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 417 | # Otherwise a system limit (for SysV at least) may be exceeded. 418 | .NOEXPORT: 419 | -------------------------------------------------------------------------------- /doc/us/examples.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | LuaCrypto: A Lua frontend to OpenSSL 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 |
14 | 17 |
LuaCrypto
18 |
A Lua frontend to OpenSSL
19 |
20 | 21 |
22 | 23 | 55 | 56 |
57 | 58 | 59 |

Example

60 | 61 | Below is a sample displaying the basic use of the library. 62 | 63 |
 64 | local crypto = require("crypto")
 65 | 
 66 | assert(io.input(some_file))
 67 | local md5_of_some_file = crypto.digest("md5", io.read("*all"))
 68 |    
 69 | assert(io.input(some_file))
 70 | local hmac_of_some_file = crypto.hmac("sha1", io.read("*all"), "hmackey")
 71 | 
72 | 73 | And here is a sample of the object interface to the code. 74 | 75 |
 76 | require("crypto")
 77 | 
 78 | local evp = crypto.digest.new("md5")
 79 | for line in io.lines(some_file) do 
 80 |     evp:update(line)
 81 | end
 82 | local md5_of_some_file = evp:final()
 83 | 
84 | 85 | A quick encryption/decryption example. Uses the Blowfish algorithm. You pass the key and source file from command line, following the operation. If no file is given, uses standard input. 86 | 87 |
 88 | require("crypto")
 89 | assert(#arg >= 2, "Usage: lua crypt.lua <encrypt/decrypt> <key> [file]")
 90 | cmd = arg[1]
 91 | key = arg[2]
 92 | file = #arg>2 and assert(io.open(arg[3], "rb")) or io.stdin
 93 | content = file:read("*a")
 94 | if cmd == "encrypt" then
 95 |   result = crypto.encrypt("blowfish", content, key)
 96 | else
 97 |   result = crypto.decrypt("blowfish", content, key)
 98 | end
 99 | io.write(result)
100 | 
101 | 102 | 103 |
104 | 105 |
106 | 107 |
108 |

Valid XHTML 1.0!

109 |
110 | 111 |
112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /doc/us/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | LuaCrypto: A Lua frontend to OpenSSL 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 |
14 | 17 |
LuaCrypto
18 |
A Lua frontend to OpenSSL
19 |
20 | 21 |
22 | 23 | 55 | 56 |
57 |

Overview

58 | 59 |

LuaCrypto provides a Lua frontend to the OpenSSL cryptographic library. The OpenSSL features that are currently exposed are digests (MD5, SHA-1, HMAC, and more) and crypto-grade random number generators.

60 | 61 |

62 | LuaCrypto is free software and uses the same license as Lua 5.0. It is currently a stand-alone component with the goal of eventually becoming part of the Kepler Project.

63 | 64 |

Status

65 | 66 |

Current version is 0.3.2. It is compatible with Lua 5.2 but also runs fine on 5.1.

67 | 68 |

Download

69 | 70 |

LuaCrypto can be downloaded from GitHub project page.

71 | 72 |

Dependencies

73 | 74 | 78 | 79 |

History

80 | 81 |
82 |
0.3.2 [25/Apr/2013]
83 |
Updated for Lua 5.2
84 | 85 |
0.3.1 [6/Mar/2012]
86 |
Added a compile-time option to initialize OpenSSL outside of LuaCrypto.
87 | 88 |
0.3.0 [1/Mar/2012]
89 |
Added encryption, decryption, signing, verifying, sealing and opening functionality.
90 | 91 |
0.2.0 [24/Aug/2006]
92 |
Added random support.
93 |
Removed Lua stub files and collapsed modules.
94 |
Changed all supporting materials (documentation, build, etc.) to Kepler standards.
95 | 96 |
0.1.1 [22/Jan/2006]
97 |
Added Lua 5.0/Compat-5.1 support.
98 | 99 |
0.1.0 [13/Jan/2006]
100 |
Initial release.
101 |
102 | 103 |

Credits

104 | 105 |

Much of the original release was based on the lmd5 project, written by Luiz Henrique de Figueiredo. More recent versions were based on existing Kepler components and also incorporate changes contributed by Mark Edgar. Encryption and decryption support was added by Michal Kottman, additional functionality and fixes were contributed by Ignacio Burgueño, Aleksandr Novitskiy and Brandon Philips. Lua 5.2 compatibility was added by moteus.

106 | 107 |

Contact

108 | 109 | The project is currently maintained by Michal Kottman on GitHub, where you can file bug reports, feature requests and contribute modifications. 110 | 111 |
112 | 113 |
114 | 115 |
116 |

117 | Valid XHTML 1.0!

118 |
119 | 120 |
121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /doc/us/license.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | LuaCrypto: A Lua frontend to OpenSSL 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 |
14 | 17 |
LuaCrypto
18 |
A Lua frontend to OpenSSL
19 |
20 | 21 |
22 | 23 | 55 | 56 |
57 | 58 |

License

59 | 60 |

LuaCrypto is free software: it can be used for both academic and 61 | commercial purposes at absolutely no cost. There are no royalties 62 | or GNU-like "copyleft" restrictions. LuaCrypto qualifies as Open 64 | Source software. Its licenses are compatible with GPL. LuaCrypto is not 66 | in the public domain and Keith Howe keeps its copyright. The 67 | legal details are below.

68 | 69 |

The spirit of the license is that you are free to use LuaCrypto 70 | for any purpose at no cost without having to ask us. The only 71 | requirement is that if you do use LuaCrypto, then you should give 72 | us credit by including the appropriate copyright notice somewhere 73 | in your product or its documentation.

74 | 75 |

The LuaCrypto library is designed and implemented by Keith Howe. The implementation is not derived from licensed software.

76 | 77 |
78 |

Copyright © 2006 Keith Howe.

79 | 80 |

Permission is hereby granted, free of charge, to any person 81 | obtaining a copy of this software and associated documentation 82 | files (the "Software"), to deal in the Software without 83 | restriction, including without limitation the rights to use, copy, 84 | modify, merge, publish, distribute, sublicense, and/or sell copies 85 | of the Software, and to permit persons to whom the Software is 86 | furnished to do so, subject to the following conditions:

87 | 88 |

The above copyright notice and this permission notice shall be 89 | included in all copies or substantial portions of the Software.

90 | 91 |

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 92 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 93 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 94 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 95 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 96 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 97 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 98 | SOFTWARE.

99 | 100 |

 

101 |

 

102 | 103 |
104 | 105 |
106 | 107 |
108 |

109 | Valid XHTML 1.0!

110 |
111 | 112 |
113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /doc/us/luacrypto-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkottman/luacrypto/8c3f7f0caf023fe327f9e60391fc80df2d08a169/doc/us/luacrypto-128.png -------------------------------------------------------------------------------- /doc/us/manual.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | LuaCrypto: A Lua frontend to OpenSSL 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 |
14 | 17 |
LuaCrypto
18 |
A Lua frontend to OpenSSL
19 |
20 | 21 |
22 | 23 | 55 | 56 |
57 |

Introduction

58 | 59 |

LuaCrypto is a Lua frontend to the OpenSSL cryptographic library. The OpenSSL features that are currently exposed are digests (MD5, SHA-1, HMAC, and more) and crypto-grade random number generators.

60 | 61 |

The API tries to hide the OpenSSL setup and teardown, so in most cases it is not simply a pass-through to the existing OpenSSL API. Since this is still a very early version of the software, the API may undergo significant future changes! You have been warned.

62 | 63 |

Building

64 | 65 |

LuaCrypto could be built to Lua 5.0 or to Lua 5.1. In both cases, the language library and headers files for the target version must be installed properly.

66 | 67 |

LuaCrypto offers a Makefile and a separate configuration file, 68 | config, which should be edited to suit your installation before runnig make. The file has some definitions like paths to the external libraries, compiler options and the like. In particular, you must set the correct path to your installed OpenSSL libraries. Another important setting is the version of Lua language, which is not obtained from the installed software.

69 | 70 |

Installation

71 | 72 |

The LuaCrypto compiled binary should be copied to a directory in your C path. Lua 5.0 users should install Compat-5.1 also.

73 | 74 |

Reference

75 | 76 |

Parameters

77 |
78 |
dtype
79 |
This parameter is a string naming the hashing algorithm to use for a digest operation. The list of supported algorithms may change with each version of the OpenSSL library. Refer to the OpenSSL documentation for a complete and up to date list. As of 0.9.7, the supported types are: 80 |
    81 |
  • md5
  • 82 |
  • md4
  • 83 |
  • md2
  • 84 |
  • sha1
  • 85 |
  • sha
  • 86 |
  • mdc2
  • 87 |
  • ripemd160
  • 88 |
89 | The list of supported hashing algorithms can also be retrieved by using the crypto.list("digests"). 90 |
91 |
ktype
92 |
A string representing public/private key type. Can be "rsa" or "dsa".
93 |
cipher
94 |
This parameter is a string naming the cipher algorithm used by encryption and decryption. The list of supported hashing algorithms can also be retrieved by using the crypto.list("ciphers"). 95 |
96 |
key
97 |
The string key/password used for encryption/decryption.
98 | 99 |
iv
100 |
An optional string initialization vector for encryption/decryption. It has to be of correct size (usually block size), otherwise the functions return an error.
101 | 102 |
pad
103 |
An optional boolean flag whether padding should be used. The default is true, which means that input of any size can be provided. Returned date may be larger than input string due to the padding. If explicitly set to false, the padding is turned off and the input data size has to be multiple of block length.
104 | 105 |
pem
106 |
A string containing a PEM formatted certificate.
107 |
108 | 109 |

Error handling

110 | 111 | The functions throw an error when known invalid parameters are passed, such as nonexistent digest/cipher and too large key or initialization vector. Otherwise, the functions return nil, error in case of runtime errors, such as incorrect input size when padding is enabled. 112 | 113 | 114 | 115 |

Message Digest - crypto.digest

116 |

Functions used to calculate cryptographic hashes of strings. Supported digest algorithms are returned by crypto.list("digests").

117 |
118 |
crypto.digest(dtype, string [, raw])
119 |
This function generates the message digest of the input string and returns it. The hashing algorithm to use is specified by dtype. The optional raw flag, defaulted to false, is a boolean indicating whether the output should be a direct binary equivalent of the message digest, or formatted as a hexadecimal string (the default).
120 | 121 |
crypto.digest.new(dtype)
122 |
Creates a new message digest object using the algorithm specified by dtype.
123 | 124 |
digest:reset()
125 |
Resets the EVP message digest object to a clean slate.
126 | 127 |
digest:clone()
128 |
Returns a new message digest object which is a clone of the object and its current state, including any data loaded to this point.
129 | 130 |
digest:update(string)
131 |
Appends the data in string to the current internal data set to be hashed. Returns the object so that it can be reused in nested calls.
132 | 133 |
digest:final([string] [, raw])
134 |
Generates the message digest for the loaded data, optionally appending on new data provided by string prior to hashing. The optional raw flag, defaulted to false, is a boolean indicating whether the output should be a direct binary equivalent of the message digest, or formatted as a hexadecimal string (the default).
135 |
136 | 137 | 138 | 139 |

Encryption, decryption - crypto.encrypt, crypto.decrypt

140 |

A high-level API to encryption and decryption using ciphers. Supported ciphers can be detected by calling crypto.list("ciphers").

141 |
142 |
crypto.encrypt(cipher, input, key [, iv[, pad]])
143 |
This function encrypts the the input string and returns the result. The encryption algorithm to use is specified by cipher. Encryption key is specified by the key parameter and is required. The optional iv parameter specifies an optional initialization vector. If boolean pad is specified after iv, it determines whether padding will be used (on by default).
144 | 145 |
crypto.decrypt(cipher, input, key [, iv[, pad]])
146 |
This function decrypts the the input string and returns the result. The decryption algorithm to use is specified by cipher. Decryption key is specified by the key parameter and is required. The optional iv parameter specifies an optional initialization vector. If boolean pad is specified after iv, it determines whether padding will be used (on by default).
147 | 148 |
crypto.encrypt.new(cipher, key [, iv[, pad]])
149 |
Creates a new encryption object using the algorithm specified by cipher and encryption key key. Optionally, initialization vector iv may be specified, followed by pad argument.
150 | 151 |
encrypt:update(string)
152 |
Appends the data in string to the current internal data. Returns a string with encrypted data, which may be of zero length if less than a message block size of data is provided.
153 | 154 |
encrypt:final()
155 |
Finishes the encryption, and returns any leftover encrypted data as string if necessary (due to padding).
156 | 157 |
crypto.decrypt.new(cipher, key [, iv[, pad]])
158 |
Creates a new decryption object using the algorithm specified by cipher and decryption key key. Initialization vector iv may optionally be specified, followed by pad argument.
159 | 160 |
decrypt:update(string)
161 |
Appends the data in string to the current internal data. Returns a string with decrypted data, which may be of zero length if less than a message block size of data is provided.
162 | 163 |
decrypt:final()
164 |
Finishes the decryption, and returns a string with any leftover decrypted data.
165 |
166 | 167 | 168 | 169 |

Public keys - crypto.pkey

170 |

Functions to work with public and private keys.

171 |
172 |
crypto.pkey.generate(ktype, len)
173 |
Generates a new ktype ("rsa", "dsa") public/private key pair object of length len bits.
174 | 175 |
crypto.pkey.read(filename [, private])
176 |
Reads a public key from PEM file filename. If private is set, reads a private key instead.
177 | 178 |
crypto.pkey.from_pem(key [, private])
179 |
Reads a public key from PEM string key. If private is set, reads it as a private key instead.
180 | 181 |
pkey:write(publicfile, privatefile)
182 |
If publicfile is a string, writes the public key into PEM file publicfile. If privatefile is a string, writes the private key into PEM file privatefile.
183 | 184 |
pkey:to_pem([private])
185 |
Generates a PEM string representation of the public key. If private is set, generates a PEM string for the private key.
186 |
187 | 188 | 189 |

Signing, verifying - crypto.sign, crypto.verify

190 |

A high-level interface to digital signatures. A digest algorithm is used to calculate a hash of the data, which is then signed using a private key into a signature. The signature can be used to verify a message using a public key.

191 | 192 |
193 |
crypto.sign(dtype, string, privkey)
194 |
This function generates the message digest of the input string, signs it using the private key privkey and returns it as a raw binary string. The hashing algorithm to use is specified by dtype.
195 | 196 |
crypto.verify(dtype, string, sig, pubkey)
197 |
This function generates the message digest of the input string using digest dtype, and verifies it against signature sig using public key pubkey. Returns true if the message was verified correctly.
198 | 199 |
crypto.sign.new(dtype)
200 |
Creates a new signing object using the digest algorithm specified by dtype.
201 | 202 |
sign:update(string)
203 |
Appends the data in string to the current internal data set to be signed.
204 | 205 |
sign:final(privkey)
206 |
Generates the message digest for the loaded data and signs it using the private key privkey. The resulting signed hash is returned as a raw binary string.
207 | 208 |
crypto.verify.new(dtype)
209 |
Creates a new verifying object using the digest algorithm specified by dtype.
210 | 211 |
verify:update(string)
212 |
Appends the data in string to the current internal data set to be verified.
213 | 214 |
verify:final(sign, pubkey)
215 |
Generates the message digest for the loaded data and verifies it agains sig using the public key pubkey. Returns true if the message was verified correctly.
216 |
217 | 218 | 219 | 220 |

Sealing and opening - crypto.seal, crypto.open

221 |

A high-level interface to digital envelopes. They generate a random key and IV, and then envelope it by using public key encryption. Data can then be encrypted using this key. 222 |

223 |
envelope, ek, iv = crypto.seal(cipher, message, pubkey)
224 |
Seals a string message using cipher cipher and public key pubkey. Returns 3 string values: sealed message, the generated encryption key signed with public key and the initialization vector.
225 | 226 |
crypto.open(cipher, envelope, privkey, ek, iv)
227 |
Opens a sealed envelope using private key privkey, key ek and initialization vector iv. Returns the sealed message.
228 | 229 |
crypto.seal.new(cipher, pubkey)
230 |
Creates a new sealing object using the algorithm specified by cipher and a public key pubkey.
231 | 232 |
seal:update(string)
233 |
Appends the data in string to the current internal data. Returns a string with encrypted data, which may be of zero length if less than a message block size of data is provided.
234 | 235 |
seal:final()
236 |
Finishes the sealing and returns 3 values: any leftover encrypted data as string, followed by the encryption key and initialization vector.
237 | 238 |
crypto.open.new(cipher, privkey, ek, iv)
239 |
Creates a new opening object using the algorithm specified by cipher, private key privkey, encryption key ek and initialization vector iv.
240 | 241 |
open:update(string)
242 |
Appends the data in string to the current internal data. Returns a string with decrypted data, which may be of zero length if less than a message block size of data is provided.
243 | 244 |
open:final()
245 |
Finishes the opening, and returns leftover decrypted data as string.
246 |
247 | 248 | 249 |

HMAC - crypto.hmac

250 |
251 |
crypto.hmac.digest(dtype, string, key [, raw])
252 |
This function returns the HMAC of the string. The hashing algorithm to use is specified by dtype. The value provided in key will be used as the seed for the HMAC generation. The optional raw flag, defaulted to false, is a boolean indicating whether the output should be a direct binary equivalent of the HMAC or formatted as a hexadecimal string (the default).
253 | 254 |
crypto.hmac.new(dtype, key)
255 |
Creates a new HMAC object using the algorithm specified by type. The HMAC seed key to use is provided by key.
256 | 257 |
hmac:reset()
258 |
Resets the HMAC object to a clean slate.
259 | 260 |
hmac:clone()
261 |
Returns a new HMAC object which is a clone of the object and its current state, including data loaded to this point. DOES NOT WORK YET. Just returns a new pointer to the same object.
262 | 263 |
hmac:update(string)
264 |
Appends the data in string to the current internal data set to be hashed.
265 | 266 |
hmac:final([string] [, raw])
267 |
Generates the HMAC for the loaded data, optionally appending on new data provided by string prior to hashing. The optional raw flag, defaulted to false, is a boolean indicating whether the output should be a direct binary equivalent of the message digest or formatted as a hexadecimal string (the default). Note that you can only run this method once on an object; running it a second time will product a bogus HMAC because the internal state is irrecoverably destroyed after the first call.
268 |
269 | 270 |

X509 Certificate - crypto.x509_cert

271 |
272 |
crypto.x509_cert()
273 |
Return an empty x509 certificate object.
274 | 275 |
x509_cert:pubkey()
276 |
Get a crypto.pkey object that represents the raw key of the x509_cert.
277 | 278 |
279 | 280 |

X509 Certificate Authority - crypto.x509_ca

281 |
282 |
crypto.x509()
283 |
Return an empty x509 certificate authority.
284 | 285 |
x509_ca:add_pem(pem)
286 |
Add a x509 CA certificate as a trusted cert.
287 | 288 |
x509_ca:verify_pem(pem)
289 |
Verify that the pem is signed by one of the x509 CA's added via x509_ca:add_pem
290 | 291 |
292 | 293 |

Misc functions - crypto

294 |
295 |
crypto.list(type)
296 |
Returns a Lua table array of supported digests and ciphers (strings), depending on then type argument: 297 |
    298 |
  • "ciphers" - returns list of ciphers supported by crypto.encrypt and crypto.decrypt
  • 299 |
  • "digests" - returns list of digests supported by crypto.digest
  • 300 |
301 |
302 | 303 |
crypto.hex(s)
304 |
Expects a string s and returns it encoded as hex string (lowercase).
305 |
306 | 307 |
308 | 309 |
310 | 311 |
312 |

Valid XHTML 1.0!

313 |
314 | 315 |
316 | 317 | 318 | 319 | -------------------------------------------------------------------------------- /install-sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # install - install a program, script, or datafile 3 | 4 | scriptversion=2010-02-06.18; # UTC 5 | 6 | # This originates from X11R5 (mit/util/scripts/install.sh), which was 7 | # later released in X11R6 (xc/config/util/install.sh) with the 8 | # following copyright and license. 9 | # 10 | # Copyright (C) 1994 X Consortium 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documentation files (the "Software"), to 14 | # deal in the Software without restriction, including without limitation the 15 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 16 | # sell copies of the Software, and to permit persons to whom the Software is 17 | # furnished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 26 | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- 27 | # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | # 29 | # Except as contained in this notice, the name of the X Consortium shall not 30 | # be used in advertising or otherwise to promote the sale, use or other deal- 31 | # ings in this Software without prior written authorization from the X Consor- 32 | # tium. 33 | # 34 | # 35 | # FSF changes to this file are in the public domain. 36 | # 37 | # Calling this script install-sh is preferred over install.sh, to prevent 38 | # `make' implicit rules from creating a file called install from it 39 | # when there is no Makefile. 40 | # 41 | # This script is compatible with the BSD install script, but was written 42 | # from scratch. 43 | 44 | nl=' 45 | ' 46 | IFS=" "" $nl" 47 | 48 | # set DOITPROG to echo to test this script 49 | 50 | # Don't use :- since 4.3BSD and earlier shells don't like it. 51 | doit=${DOITPROG-} 52 | if test -z "$doit"; then 53 | doit_exec=exec 54 | else 55 | doit_exec=$doit 56 | fi 57 | 58 | # Put in absolute file names if you don't have them in your path; 59 | # or use environment vars. 60 | 61 | chgrpprog=${CHGRPPROG-chgrp} 62 | chmodprog=${CHMODPROG-chmod} 63 | chownprog=${CHOWNPROG-chown} 64 | cmpprog=${CMPPROG-cmp} 65 | cpprog=${CPPROG-cp} 66 | mkdirprog=${MKDIRPROG-mkdir} 67 | mvprog=${MVPROG-mv} 68 | rmprog=${RMPROG-rm} 69 | stripprog=${STRIPPROG-strip} 70 | 71 | posix_glob='?' 72 | initialize_posix_glob=' 73 | test "$posix_glob" != "?" || { 74 | if (set -f) 2>/dev/null; then 75 | posix_glob= 76 | else 77 | posix_glob=: 78 | fi 79 | } 80 | ' 81 | 82 | posix_mkdir= 83 | 84 | # Desired mode of installed file. 85 | mode=0755 86 | 87 | chgrpcmd= 88 | chmodcmd=$chmodprog 89 | chowncmd= 90 | mvcmd=$mvprog 91 | rmcmd="$rmprog -f" 92 | stripcmd= 93 | 94 | src= 95 | dst= 96 | dir_arg= 97 | dst_arg= 98 | 99 | copy_on_change=false 100 | no_target_directory= 101 | 102 | usage="\ 103 | Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE 104 | or: $0 [OPTION]... SRCFILES... DIRECTORY 105 | or: $0 [OPTION]... -t DIRECTORY SRCFILES... 106 | or: $0 [OPTION]... -d DIRECTORIES... 107 | 108 | In the 1st form, copy SRCFILE to DSTFILE. 109 | In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. 110 | In the 4th, create DIRECTORIES. 111 | 112 | Options: 113 | --help display this help and exit. 114 | --version display version info and exit. 115 | 116 | -c (ignored) 117 | -C install only if different (preserve the last data modification time) 118 | -d create directories instead of installing files. 119 | -g GROUP $chgrpprog installed files to GROUP. 120 | -m MODE $chmodprog installed files to MODE. 121 | -o USER $chownprog installed files to USER. 122 | -s $stripprog installed files. 123 | -t DIRECTORY install into DIRECTORY. 124 | -T report an error if DSTFILE is a directory. 125 | 126 | Environment variables override the default commands: 127 | CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG 128 | RMPROG STRIPPROG 129 | " 130 | 131 | while test $# -ne 0; do 132 | case $1 in 133 | -c) ;; 134 | 135 | -C) copy_on_change=true;; 136 | 137 | -d) dir_arg=true;; 138 | 139 | -g) chgrpcmd="$chgrpprog $2" 140 | shift;; 141 | 142 | --help) echo "$usage"; exit $?;; 143 | 144 | -m) mode=$2 145 | case $mode in 146 | *' '* | *' '* | *' 147 | '* | *'*'* | *'?'* | *'['*) 148 | echo "$0: invalid mode: $mode" >&2 149 | exit 1;; 150 | esac 151 | shift;; 152 | 153 | -o) chowncmd="$chownprog $2" 154 | shift;; 155 | 156 | -s) stripcmd=$stripprog;; 157 | 158 | -t) dst_arg=$2 159 | shift;; 160 | 161 | -T) no_target_directory=true;; 162 | 163 | --version) echo "$0 $scriptversion"; exit $?;; 164 | 165 | --) shift 166 | break;; 167 | 168 | -*) echo "$0: invalid option: $1" >&2 169 | exit 1;; 170 | 171 | *) break;; 172 | esac 173 | shift 174 | done 175 | 176 | if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then 177 | # When -d is used, all remaining arguments are directories to create. 178 | # When -t is used, the destination is already specified. 179 | # Otherwise, the last argument is the destination. Remove it from $@. 180 | for arg 181 | do 182 | if test -n "$dst_arg"; then 183 | # $@ is not empty: it contains at least $arg. 184 | set fnord "$@" "$dst_arg" 185 | shift # fnord 186 | fi 187 | shift # arg 188 | dst_arg=$arg 189 | done 190 | fi 191 | 192 | if test $# -eq 0; then 193 | if test -z "$dir_arg"; then 194 | echo "$0: no input file specified." >&2 195 | exit 1 196 | fi 197 | # It's OK to call `install-sh -d' without argument. 198 | # This can happen when creating conditional directories. 199 | exit 0 200 | fi 201 | 202 | if test -z "$dir_arg"; then 203 | do_exit='(exit $ret); exit $ret' 204 | trap "ret=129; $do_exit" 1 205 | trap "ret=130; $do_exit" 2 206 | trap "ret=141; $do_exit" 13 207 | trap "ret=143; $do_exit" 15 208 | 209 | # Set umask so as not to create temps with too-generous modes. 210 | # However, 'strip' requires both read and write access to temps. 211 | case $mode in 212 | # Optimize common cases. 213 | *644) cp_umask=133;; 214 | *755) cp_umask=22;; 215 | 216 | *[0-7]) 217 | if test -z "$stripcmd"; then 218 | u_plus_rw= 219 | else 220 | u_plus_rw='% 200' 221 | fi 222 | cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; 223 | *) 224 | if test -z "$stripcmd"; then 225 | u_plus_rw= 226 | else 227 | u_plus_rw=,u+rw 228 | fi 229 | cp_umask=$mode$u_plus_rw;; 230 | esac 231 | fi 232 | 233 | for src 234 | do 235 | # Protect names starting with `-'. 236 | case $src in 237 | -*) src=./$src;; 238 | esac 239 | 240 | if test -n "$dir_arg"; then 241 | dst=$src 242 | dstdir=$dst 243 | test -d "$dstdir" 244 | dstdir_status=$? 245 | else 246 | 247 | # Waiting for this to be detected by the "$cpprog $src $dsttmp" command 248 | # might cause directories to be created, which would be especially bad 249 | # if $src (and thus $dsttmp) contains '*'. 250 | if test ! -f "$src" && test ! -d "$src"; then 251 | echo "$0: $src does not exist." >&2 252 | exit 1 253 | fi 254 | 255 | if test -z "$dst_arg"; then 256 | echo "$0: no destination specified." >&2 257 | exit 1 258 | fi 259 | 260 | dst=$dst_arg 261 | # Protect names starting with `-'. 262 | case $dst in 263 | -*) dst=./$dst;; 264 | esac 265 | 266 | # If destination is a directory, append the input filename; won't work 267 | # if double slashes aren't ignored. 268 | if test -d "$dst"; then 269 | if test -n "$no_target_directory"; then 270 | echo "$0: $dst_arg: Is a directory" >&2 271 | exit 1 272 | fi 273 | dstdir=$dst 274 | dst=$dstdir/`basename "$src"` 275 | dstdir_status=0 276 | else 277 | # Prefer dirname, but fall back on a substitute if dirname fails. 278 | dstdir=` 279 | (dirname "$dst") 2>/dev/null || 280 | expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ 281 | X"$dst" : 'X\(//\)[^/]' \| \ 282 | X"$dst" : 'X\(//\)$' \| \ 283 | X"$dst" : 'X\(/\)' \| . 2>/dev/null || 284 | echo X"$dst" | 285 | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ 286 | s//\1/ 287 | q 288 | } 289 | /^X\(\/\/\)[^/].*/{ 290 | s//\1/ 291 | q 292 | } 293 | /^X\(\/\/\)$/{ 294 | s//\1/ 295 | q 296 | } 297 | /^X\(\/\).*/{ 298 | s//\1/ 299 | q 300 | } 301 | s/.*/./; q' 302 | ` 303 | 304 | test -d "$dstdir" 305 | dstdir_status=$? 306 | fi 307 | fi 308 | 309 | obsolete_mkdir_used=false 310 | 311 | if test $dstdir_status != 0; then 312 | case $posix_mkdir in 313 | '') 314 | # Create intermediate dirs using mode 755 as modified by the umask. 315 | # This is like FreeBSD 'install' as of 1997-10-28. 316 | umask=`umask` 317 | case $stripcmd.$umask in 318 | # Optimize common cases. 319 | *[2367][2367]) mkdir_umask=$umask;; 320 | .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; 321 | 322 | *[0-7]) 323 | mkdir_umask=`expr $umask + 22 \ 324 | - $umask % 100 % 40 + $umask % 20 \ 325 | - $umask % 10 % 4 + $umask % 2 326 | `;; 327 | *) mkdir_umask=$umask,go-w;; 328 | esac 329 | 330 | # With -d, create the new directory with the user-specified mode. 331 | # Otherwise, rely on $mkdir_umask. 332 | if test -n "$dir_arg"; then 333 | mkdir_mode=-m$mode 334 | else 335 | mkdir_mode= 336 | fi 337 | 338 | posix_mkdir=false 339 | case $umask in 340 | *[123567][0-7][0-7]) 341 | # POSIX mkdir -p sets u+wx bits regardless of umask, which 342 | # is incompatible with FreeBSD 'install' when (umask & 300) != 0. 343 | ;; 344 | *) 345 | tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ 346 | trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 347 | 348 | if (umask $mkdir_umask && 349 | exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 350 | then 351 | if test -z "$dir_arg" || { 352 | # Check for POSIX incompatibilities with -m. 353 | # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or 354 | # other-writeable bit of parent directory when it shouldn't. 355 | # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. 356 | ls_ld_tmpdir=`ls -ld "$tmpdir"` 357 | case $ls_ld_tmpdir in 358 | d????-?r-*) different_mode=700;; 359 | d????-?--*) different_mode=755;; 360 | *) false;; 361 | esac && 362 | $mkdirprog -m$different_mode -p -- "$tmpdir" && { 363 | ls_ld_tmpdir_1=`ls -ld "$tmpdir"` 364 | test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" 365 | } 366 | } 367 | then posix_mkdir=: 368 | fi 369 | rmdir "$tmpdir/d" "$tmpdir" 370 | else 371 | # Remove any dirs left behind by ancient mkdir implementations. 372 | rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null 373 | fi 374 | trap '' 0;; 375 | esac;; 376 | esac 377 | 378 | if 379 | $posix_mkdir && ( 380 | umask $mkdir_umask && 381 | $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" 382 | ) 383 | then : 384 | else 385 | 386 | # The umask is ridiculous, or mkdir does not conform to POSIX, 387 | # or it failed possibly due to a race condition. Create the 388 | # directory the slow way, step by step, checking for races as we go. 389 | 390 | case $dstdir in 391 | /*) prefix='/';; 392 | -*) prefix='./';; 393 | *) prefix='';; 394 | esac 395 | 396 | eval "$initialize_posix_glob" 397 | 398 | oIFS=$IFS 399 | IFS=/ 400 | $posix_glob set -f 401 | set fnord $dstdir 402 | shift 403 | $posix_glob set +f 404 | IFS=$oIFS 405 | 406 | prefixes= 407 | 408 | for d 409 | do 410 | test -z "$d" && continue 411 | 412 | prefix=$prefix$d 413 | if test -d "$prefix"; then 414 | prefixes= 415 | else 416 | if $posix_mkdir; then 417 | (umask=$mkdir_umask && 418 | $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break 419 | # Don't fail if two instances are running concurrently. 420 | test -d "$prefix" || exit 1 421 | else 422 | case $prefix in 423 | *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; 424 | *) qprefix=$prefix;; 425 | esac 426 | prefixes="$prefixes '$qprefix'" 427 | fi 428 | fi 429 | prefix=$prefix/ 430 | done 431 | 432 | if test -n "$prefixes"; then 433 | # Don't fail if two instances are running concurrently. 434 | (umask $mkdir_umask && 435 | eval "\$doit_exec \$mkdirprog $prefixes") || 436 | test -d "$dstdir" || exit 1 437 | obsolete_mkdir_used=true 438 | fi 439 | fi 440 | fi 441 | 442 | if test -n "$dir_arg"; then 443 | { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && 444 | { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && 445 | { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || 446 | test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 447 | else 448 | 449 | # Make a couple of temp file names in the proper directory. 450 | dsttmp=$dstdir/_inst.$$_ 451 | rmtmp=$dstdir/_rm.$$_ 452 | 453 | # Trap to clean up those temp files at exit. 454 | trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 455 | 456 | # Copy the file name to the temp name. 457 | (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && 458 | 459 | # and set any options; do chmod last to preserve setuid bits. 460 | # 461 | # If any of these fail, we abort the whole thing. If we want to 462 | # ignore errors from any of these, just make sure not to ignore 463 | # errors from the above "$doit $cpprog $src $dsttmp" command. 464 | # 465 | { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && 466 | { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && 467 | { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && 468 | { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && 469 | 470 | # If -C, don't bother to copy if it wouldn't change the file. 471 | if $copy_on_change && 472 | old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && 473 | new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && 474 | 475 | eval "$initialize_posix_glob" && 476 | $posix_glob set -f && 477 | set X $old && old=:$2:$4:$5:$6 && 478 | set X $new && new=:$2:$4:$5:$6 && 479 | $posix_glob set +f && 480 | 481 | test "$old" = "$new" && 482 | $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 483 | then 484 | rm -f "$dsttmp" 485 | else 486 | # Rename the file to the real destination. 487 | $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || 488 | 489 | # The rename failed, perhaps because mv can't rename something else 490 | # to itself, or perhaps because mv is so ancient that it does not 491 | # support -f. 492 | { 493 | # Now remove or move aside any old file at destination location. 494 | # We try this two ways since rm can't unlink itself on some 495 | # systems and the destination file might be busy for other 496 | # reasons. In this case, the final cleanup might fail but the new 497 | # file should still install successfully. 498 | { 499 | test ! -f "$dst" || 500 | $doit $rmcmd -f "$dst" 2>/dev/null || 501 | { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && 502 | { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } 503 | } || 504 | { echo "$0: cannot unlink or rename $dst" >&2 505 | (exit 1); exit 1 506 | } 507 | } && 508 | 509 | # Now rename the file to the real destination. 510 | $doit $mvcmd "$dsttmp" "$dst" 511 | } 512 | fi || exit 1 513 | 514 | trap '' 0 515 | fi 516 | done 517 | 518 | # Local variables: 519 | # eval: (add-hook 'write-file-hooks 'time-stamp) 520 | # time-stamp-start: "scriptversion=" 521 | # time-stamp-format: "%:y-%02m-%02d.%02H" 522 | # time-stamp-time-zone: "UTC" 523 | # time-stamp-end: "; # UTC" 524 | # End: 525 | -------------------------------------------------------------------------------- /luacrypto.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@LUALIBDIR@ 4 | includedir=@CRYPTOINC@ 5 | 6 | Name: luacrypto 7 | Description: Lua Crypto Library 8 | Requires: openssl lua 9 | Version: @PACKAGE_VERSION@ 10 | Libs: ${libdir}/crypto.so 11 | Cflags: -I${includedir} 12 | -------------------------------------------------------------------------------- /luacrypto.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 10.00 3 | # Visual Studio 2008 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "luacrypto", "luacrypto.vcproj", "{E94B62FA-62E0-4C25-B56A-AEF719B05F5E}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {E94B62FA-62E0-4C25-B56A-AEF719B05F5E}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {E94B62FA-62E0-4C25-B56A-AEF719B05F5E}.Debug|Win32.Build.0 = Debug|Win32 14 | {E94B62FA-62E0-4C25-B56A-AEF719B05F5E}.Release|Win32.ActiveCfg = Release|Win32 15 | {E94B62FA-62E0-4C25-B56A-AEF719B05F5E}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /luacrypto.vcproj: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 26 | 29 | 32 | 35 | 38 | 41 | 53 | 56 | 59 | 62 | 71 | 74 | 77 | 80 | 83 | 86 | 89 | 92 | 93 | 101 | 104 | 107 | 110 | 113 | 116 | 128 | 131 | 134 | 137 | 149 | 152 | 155 | 158 | 161 | 164 | 167 | 170 | 171 | 172 | 173 | 174 | 175 | 180 | 183 | 186 | 191 | 192 | 195 | 201 | 202 | 203 | 204 | 209 | 212 | 213 | 214 | 219 | 220 | 223 | 224 | 225 | 226 | 227 | 228 | -------------------------------------------------------------------------------- /m4/ltoptions.m4: -------------------------------------------------------------------------------- 1 | # Helper functions for option handling. -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, 4 | # Inc. 5 | # Written by Gary V. Vaughan, 2004 6 | # 7 | # This file is free software; the Free Software Foundation gives 8 | # unlimited permission to copy and/or distribute it, with or without 9 | # modifications, as long as this notice is preserved. 10 | 11 | # serial 7 ltoptions.m4 12 | 13 | # This is to help aclocal find these macros, as it can't see m4_define. 14 | AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) 15 | 16 | 17 | # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) 18 | # ------------------------------------------ 19 | m4_define([_LT_MANGLE_OPTION], 20 | [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) 21 | 22 | 23 | # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) 24 | # --------------------------------------- 25 | # Set option OPTION-NAME for macro MACRO-NAME, and if there is a 26 | # matching handler defined, dispatch to it. Other OPTION-NAMEs are 27 | # saved as a flag. 28 | m4_define([_LT_SET_OPTION], 29 | [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl 30 | m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), 31 | _LT_MANGLE_DEFUN([$1], [$2]), 32 | [m4_warning([Unknown $1 option `$2'])])[]dnl 33 | ]) 34 | 35 | 36 | # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) 37 | # ------------------------------------------------------------ 38 | # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. 39 | m4_define([_LT_IF_OPTION], 40 | [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) 41 | 42 | 43 | # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) 44 | # ------------------------------------------------------- 45 | # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME 46 | # are set. 47 | m4_define([_LT_UNLESS_OPTIONS], 48 | [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), 49 | [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), 50 | [m4_define([$0_found])])])[]dnl 51 | m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 52 | ])[]dnl 53 | ]) 54 | 55 | 56 | # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) 57 | # ---------------------------------------- 58 | # OPTION-LIST is a space-separated list of Libtool options associated 59 | # with MACRO-NAME. If any OPTION has a matching handler declared with 60 | # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about 61 | # the unknown option and exit. 62 | m4_defun([_LT_SET_OPTIONS], 63 | [# Set options 64 | m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), 65 | [_LT_SET_OPTION([$1], _LT_Option)]) 66 | 67 | m4_if([$1],[LT_INIT],[ 68 | dnl 69 | dnl Simply set some default values (i.e off) if boolean options were not 70 | dnl specified: 71 | _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no 72 | ]) 73 | _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no 74 | ]) 75 | dnl 76 | dnl If no reference was made to various pairs of opposing options, then 77 | dnl we run the default mode handler for the pair. For example, if neither 78 | dnl `shared' nor `disable-shared' was passed, we enable building of shared 79 | dnl archives by default: 80 | _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) 81 | _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) 82 | _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) 83 | _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], 84 | [_LT_ENABLE_FAST_INSTALL]) 85 | ]) 86 | ])# _LT_SET_OPTIONS 87 | 88 | 89 | ## --------------------------------- ## 90 | ## Macros to handle LT_INIT options. ## 91 | ## --------------------------------- ## 92 | 93 | # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) 94 | # ----------------------------------------- 95 | m4_define([_LT_MANGLE_DEFUN], 96 | [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) 97 | 98 | 99 | # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) 100 | # ----------------------------------------------- 101 | m4_define([LT_OPTION_DEFINE], 102 | [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl 103 | ])# LT_OPTION_DEFINE 104 | 105 | 106 | # dlopen 107 | # ------ 108 | LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes 109 | ]) 110 | 111 | AU_DEFUN([AC_LIBTOOL_DLOPEN], 112 | [_LT_SET_OPTION([LT_INIT], [dlopen]) 113 | AC_DIAGNOSE([obsolete], 114 | [$0: Remove this warning and the call to _LT_SET_OPTION when you 115 | put the `dlopen' option into LT_INIT's first parameter.]) 116 | ]) 117 | 118 | dnl aclocal-1.4 backwards compatibility: 119 | dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) 120 | 121 | 122 | # win32-dll 123 | # --------- 124 | # Declare package support for building win32 dll's. 125 | LT_OPTION_DEFINE([LT_INIT], [win32-dll], 126 | [enable_win32_dll=yes 127 | 128 | case $host in 129 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) 130 | AC_CHECK_TOOL(AS, as, false) 131 | AC_CHECK_TOOL(DLLTOOL, dlltool, false) 132 | AC_CHECK_TOOL(OBJDUMP, objdump, false) 133 | ;; 134 | esac 135 | 136 | test -z "$AS" && AS=as 137 | _LT_DECL([], [AS], [1], [Assembler program])dnl 138 | 139 | test -z "$DLLTOOL" && DLLTOOL=dlltool 140 | _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl 141 | 142 | test -z "$OBJDUMP" && OBJDUMP=objdump 143 | _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl 144 | ])# win32-dll 145 | 146 | AU_DEFUN([AC_LIBTOOL_WIN32_DLL], 147 | [AC_REQUIRE([AC_CANONICAL_HOST])dnl 148 | _LT_SET_OPTION([LT_INIT], [win32-dll]) 149 | AC_DIAGNOSE([obsolete], 150 | [$0: Remove this warning and the call to _LT_SET_OPTION when you 151 | put the `win32-dll' option into LT_INIT's first parameter.]) 152 | ]) 153 | 154 | dnl aclocal-1.4 backwards compatibility: 155 | dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) 156 | 157 | 158 | # _LT_ENABLE_SHARED([DEFAULT]) 159 | # ---------------------------- 160 | # implement the --enable-shared flag, and supports the `shared' and 161 | # `disable-shared' LT_INIT options. 162 | # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 163 | m4_define([_LT_ENABLE_SHARED], 164 | [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl 165 | AC_ARG_ENABLE([shared], 166 | [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], 167 | [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], 168 | [p=${PACKAGE-default} 169 | case $enableval in 170 | yes) enable_shared=yes ;; 171 | no) enable_shared=no ;; 172 | *) 173 | enable_shared=no 174 | # Look at the argument we got. We use all the common list separators. 175 | lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 176 | for pkg in $enableval; do 177 | IFS="$lt_save_ifs" 178 | if test "X$pkg" = "X$p"; then 179 | enable_shared=yes 180 | fi 181 | done 182 | IFS="$lt_save_ifs" 183 | ;; 184 | esac], 185 | [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) 186 | 187 | _LT_DECL([build_libtool_libs], [enable_shared], [0], 188 | [Whether or not to build shared libraries]) 189 | ])# _LT_ENABLE_SHARED 190 | 191 | LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) 192 | LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) 193 | 194 | # Old names: 195 | AC_DEFUN([AC_ENABLE_SHARED], 196 | [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) 197 | ]) 198 | 199 | AC_DEFUN([AC_DISABLE_SHARED], 200 | [_LT_SET_OPTION([LT_INIT], [disable-shared]) 201 | ]) 202 | 203 | AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) 204 | AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) 205 | 206 | dnl aclocal-1.4 backwards compatibility: 207 | dnl AC_DEFUN([AM_ENABLE_SHARED], []) 208 | dnl AC_DEFUN([AM_DISABLE_SHARED], []) 209 | 210 | 211 | 212 | # _LT_ENABLE_STATIC([DEFAULT]) 213 | # ---------------------------- 214 | # implement the --enable-static flag, and support the `static' and 215 | # `disable-static' LT_INIT options. 216 | # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 217 | m4_define([_LT_ENABLE_STATIC], 218 | [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl 219 | AC_ARG_ENABLE([static], 220 | [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], 221 | [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], 222 | [p=${PACKAGE-default} 223 | case $enableval in 224 | yes) enable_static=yes ;; 225 | no) enable_static=no ;; 226 | *) 227 | enable_static=no 228 | # Look at the argument we got. We use all the common list separators. 229 | lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 230 | for pkg in $enableval; do 231 | IFS="$lt_save_ifs" 232 | if test "X$pkg" = "X$p"; then 233 | enable_static=yes 234 | fi 235 | done 236 | IFS="$lt_save_ifs" 237 | ;; 238 | esac], 239 | [enable_static=]_LT_ENABLE_STATIC_DEFAULT) 240 | 241 | _LT_DECL([build_old_libs], [enable_static], [0], 242 | [Whether or not to build static libraries]) 243 | ])# _LT_ENABLE_STATIC 244 | 245 | LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) 246 | LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) 247 | 248 | # Old names: 249 | AC_DEFUN([AC_ENABLE_STATIC], 250 | [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) 251 | ]) 252 | 253 | AC_DEFUN([AC_DISABLE_STATIC], 254 | [_LT_SET_OPTION([LT_INIT], [disable-static]) 255 | ]) 256 | 257 | AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) 258 | AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) 259 | 260 | dnl aclocal-1.4 backwards compatibility: 261 | dnl AC_DEFUN([AM_ENABLE_STATIC], []) 262 | dnl AC_DEFUN([AM_DISABLE_STATIC], []) 263 | 264 | 265 | 266 | # _LT_ENABLE_FAST_INSTALL([DEFAULT]) 267 | # ---------------------------------- 268 | # implement the --enable-fast-install flag, and support the `fast-install' 269 | # and `disable-fast-install' LT_INIT options. 270 | # DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. 271 | m4_define([_LT_ENABLE_FAST_INSTALL], 272 | [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl 273 | AC_ARG_ENABLE([fast-install], 274 | [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], 275 | [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], 276 | [p=${PACKAGE-default} 277 | case $enableval in 278 | yes) enable_fast_install=yes ;; 279 | no) enable_fast_install=no ;; 280 | *) 281 | enable_fast_install=no 282 | # Look at the argument we got. We use all the common list separators. 283 | lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," 284 | for pkg in $enableval; do 285 | IFS="$lt_save_ifs" 286 | if test "X$pkg" = "X$p"; then 287 | enable_fast_install=yes 288 | fi 289 | done 290 | IFS="$lt_save_ifs" 291 | ;; 292 | esac], 293 | [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) 294 | 295 | _LT_DECL([fast_install], [enable_fast_install], [0], 296 | [Whether or not to optimize for fast installation])dnl 297 | ])# _LT_ENABLE_FAST_INSTALL 298 | 299 | LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) 300 | LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) 301 | 302 | # Old names: 303 | AU_DEFUN([AC_ENABLE_FAST_INSTALL], 304 | [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) 305 | AC_DIAGNOSE([obsolete], 306 | [$0: Remove this warning and the call to _LT_SET_OPTION when you put 307 | the `fast-install' option into LT_INIT's first parameter.]) 308 | ]) 309 | 310 | AU_DEFUN([AC_DISABLE_FAST_INSTALL], 311 | [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) 312 | AC_DIAGNOSE([obsolete], 313 | [$0: Remove this warning and the call to _LT_SET_OPTION when you put 314 | the `disable-fast-install' option into LT_INIT's first parameter.]) 315 | ]) 316 | 317 | dnl aclocal-1.4 backwards compatibility: 318 | dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) 319 | dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) 320 | 321 | 322 | # _LT_WITH_PIC([MODE]) 323 | # -------------------- 324 | # implement the --with-pic flag, and support the `pic-only' and `no-pic' 325 | # LT_INIT options. 326 | # MODE is either `yes' or `no'. If omitted, it defaults to `both'. 327 | m4_define([_LT_WITH_PIC], 328 | [AC_ARG_WITH([pic], 329 | [AS_HELP_STRING([--with-pic], 330 | [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], 331 | [pic_mode="$withval"], 332 | [pic_mode=default]) 333 | 334 | test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) 335 | 336 | _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl 337 | ])# _LT_WITH_PIC 338 | 339 | LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) 340 | LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) 341 | 342 | # Old name: 343 | AU_DEFUN([AC_LIBTOOL_PICMODE], 344 | [_LT_SET_OPTION([LT_INIT], [pic-only]) 345 | AC_DIAGNOSE([obsolete], 346 | [$0: Remove this warning and the call to _LT_SET_OPTION when you 347 | put the `pic-only' option into LT_INIT's first parameter.]) 348 | ]) 349 | 350 | dnl aclocal-1.4 backwards compatibility: 351 | dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) 352 | 353 | ## ----------------- ## 354 | ## LTDL_INIT Options ## 355 | ## ----------------- ## 356 | 357 | m4_define([_LTDL_MODE], []) 358 | LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], 359 | [m4_define([_LTDL_MODE], [nonrecursive])]) 360 | LT_OPTION_DEFINE([LTDL_INIT], [recursive], 361 | [m4_define([_LTDL_MODE], [recursive])]) 362 | LT_OPTION_DEFINE([LTDL_INIT], [subproject], 363 | [m4_define([_LTDL_MODE], [subproject])]) 364 | 365 | m4_define([_LTDL_TYPE], []) 366 | LT_OPTION_DEFINE([LTDL_INIT], [installable], 367 | [m4_define([_LTDL_TYPE], [installable])]) 368 | LT_OPTION_DEFINE([LTDL_INIT], [convenience], 369 | [m4_define([_LTDL_TYPE], [convenience])]) 370 | -------------------------------------------------------------------------------- /m4/ltsugar.m4: -------------------------------------------------------------------------------- 1 | # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- 2 | # 3 | # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. 4 | # Written by Gary V. Vaughan, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # serial 6 ltsugar.m4 11 | 12 | # This is to help aclocal find these macros, as it can't see m4_define. 13 | AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) 14 | 15 | 16 | # lt_join(SEP, ARG1, [ARG2...]) 17 | # ----------------------------- 18 | # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their 19 | # associated separator. 20 | # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier 21 | # versions in m4sugar had bugs. 22 | m4_define([lt_join], 23 | [m4_if([$#], [1], [], 24 | [$#], [2], [[$2]], 25 | [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) 26 | m4_define([_lt_join], 27 | [m4_if([$#$2], [2], [], 28 | [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) 29 | 30 | 31 | # lt_car(LIST) 32 | # lt_cdr(LIST) 33 | # ------------ 34 | # Manipulate m4 lists. 35 | # These macros are necessary as long as will still need to support 36 | # Autoconf-2.59 which quotes differently. 37 | m4_define([lt_car], [[$1]]) 38 | m4_define([lt_cdr], 39 | [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], 40 | [$#], 1, [], 41 | [m4_dquote(m4_shift($@))])]) 42 | m4_define([lt_unquote], $1) 43 | 44 | 45 | # lt_append(MACRO-NAME, STRING, [SEPARATOR]) 46 | # ------------------------------------------ 47 | # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. 48 | # Note that neither SEPARATOR nor STRING are expanded; they are appended 49 | # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). 50 | # No SEPARATOR is output if MACRO-NAME was previously undefined (different 51 | # than defined and empty). 52 | # 53 | # This macro is needed until we can rely on Autoconf 2.62, since earlier 54 | # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. 55 | m4_define([lt_append], 56 | [m4_define([$1], 57 | m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) 58 | 59 | 60 | 61 | # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) 62 | # ---------------------------------------------------------- 63 | # Produce a SEP delimited list of all paired combinations of elements of 64 | # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list 65 | # has the form PREFIXmINFIXSUFFIXn. 66 | # Needed until we can rely on m4_combine added in Autoconf 2.62. 67 | m4_define([lt_combine], 68 | [m4_if(m4_eval([$# > 3]), [1], 69 | [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl 70 | [[m4_foreach([_Lt_prefix], [$2], 71 | [m4_foreach([_Lt_suffix], 72 | ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, 73 | [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) 74 | 75 | 76 | # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) 77 | # ----------------------------------------------------------------------- 78 | # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited 79 | # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. 80 | m4_define([lt_if_append_uniq], 81 | [m4_ifdef([$1], 82 | [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], 83 | [lt_append([$1], [$2], [$3])$4], 84 | [$5])], 85 | [lt_append([$1], [$2], [$3])$4])]) 86 | 87 | 88 | # lt_dict_add(DICT, KEY, VALUE) 89 | # ----------------------------- 90 | m4_define([lt_dict_add], 91 | [m4_define([$1($2)], [$3])]) 92 | 93 | 94 | # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) 95 | # -------------------------------------------- 96 | m4_define([lt_dict_add_subkey], 97 | [m4_define([$1($2:$3)], [$4])]) 98 | 99 | 100 | # lt_dict_fetch(DICT, KEY, [SUBKEY]) 101 | # ---------------------------------- 102 | m4_define([lt_dict_fetch], 103 | [m4_ifval([$3], 104 | m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), 105 | m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) 106 | 107 | 108 | # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) 109 | # ----------------------------------------------------------------- 110 | m4_define([lt_if_dict_fetch], 111 | [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], 112 | [$5], 113 | [$6])]) 114 | 115 | 116 | # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) 117 | # -------------------------------------------------------------- 118 | m4_define([lt_dict_filter], 119 | [m4_if([$5], [], [], 120 | [lt_join(m4_quote(m4_default([$4], [[, ]])), 121 | lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), 122 | [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl 123 | ]) 124 | -------------------------------------------------------------------------------- /m4/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3293 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3293]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4' 20 | macro_revision='1.3293' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /m4/lt~obsolete.m4: -------------------------------------------------------------------------------- 1 | # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- 2 | # 3 | # Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004. 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # serial 5 lt~obsolete.m4 11 | 12 | # These exist entirely to fool aclocal when bootstrapping libtool. 13 | # 14 | # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) 15 | # which have later been changed to m4_define as they aren't part of the 16 | # exported API, or moved to Autoconf or Automake where they belong. 17 | # 18 | # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN 19 | # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us 20 | # using a macro with the same name in our local m4/libtool.m4 it'll 21 | # pull the old libtool.m4 in (it doesn't see our shiny new m4_define 22 | # and doesn't know about Autoconf macros at all.) 23 | # 24 | # So we provide this file, which has a silly filename so it's always 25 | # included after everything else. This provides aclocal with the 26 | # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything 27 | # because those macros already exist, or will be overwritten later. 28 | # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 29 | # 30 | # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. 31 | # Yes, that means every name once taken will need to remain here until 32 | # we give up compatibility with versions before 1.7, at which point 33 | # we need to keep only those names which we still refer to. 34 | 35 | # This is to help aclocal find these macros, as it can't see m4_define. 36 | AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) 37 | 38 | m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) 39 | m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) 40 | m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) 41 | m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) 42 | m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) 43 | m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) 44 | m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) 45 | m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) 46 | m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) 47 | m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) 48 | m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) 49 | m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) 50 | m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) 51 | m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) 52 | m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) 53 | m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) 54 | m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) 55 | m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) 56 | m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) 57 | m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) 58 | m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) 59 | m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) 60 | m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) 61 | m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) 62 | m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) 63 | m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) 64 | m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) 65 | m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) 66 | m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) 67 | m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) 68 | m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) 69 | m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) 70 | m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) 71 | m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) 72 | m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) 73 | m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) 74 | m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) 75 | m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) 76 | m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) 77 | m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) 78 | m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) 79 | m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) 80 | m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) 81 | m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) 82 | m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) 83 | m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) 84 | m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) 85 | m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) 86 | m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) 87 | m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) 88 | m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) 89 | m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) 90 | m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) 91 | m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) 92 | m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) 93 | m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) 94 | m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) 95 | m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) 96 | m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) 97 | m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) 98 | m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) 99 | -------------------------------------------------------------------------------- /missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common stub for a few missing GNU programs while installing. 3 | 4 | scriptversion=2009-04-28.21; # UTC 5 | 6 | # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7 | # 2008, 2009 Free Software Foundation, Inc. 8 | # Originally by Fran,cois Pinard , 1996. 9 | 10 | # This program is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation; either version 2, or (at your option) 13 | # any later version. 14 | 15 | # This program is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | 20 | # You should have received a copy of the GNU General Public License 21 | # along with this program. If not, see . 22 | 23 | # As a special exception to the GNU General Public License, if you 24 | # distribute this file as part of a program that contains a 25 | # configuration script generated by Autoconf, you may include it under 26 | # the same distribution terms that you use for the rest of that program. 27 | 28 | if test $# -eq 0; then 29 | echo 1>&2 "Try \`$0 --help' for more information" 30 | exit 1 31 | fi 32 | 33 | run=: 34 | sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35 | sed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36 | 37 | # In the cases where this matters, `missing' is being run in the 38 | # srcdir already. 39 | if test -f configure.ac; then 40 | configure_ac=configure.ac 41 | else 42 | configure_ac=configure.in 43 | fi 44 | 45 | msg="missing on your system" 46 | 47 | case $1 in 48 | --run) 49 | # Try to run requested program, and just exit if it succeeds. 50 | run= 51 | shift 52 | "$@" && exit 0 53 | # Exit code 63 means version mismatch. This often happens 54 | # when the user try to use an ancient version of a tool on 55 | # a file that requires a minimum version. In this case we 56 | # we should proceed has if the program had been absent, or 57 | # if --run hadn't been passed. 58 | if test $? = 63; then 59 | run=: 60 | msg="probably too old" 61 | fi 62 | ;; 63 | 64 | -h|--h|--he|--hel|--help) 65 | echo "\ 66 | $0 [OPTION]... PROGRAM [ARGUMENT]... 67 | 68 | Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69 | error status if there is no known handling for PROGRAM. 70 | 71 | Options: 72 | -h, --help display this help and exit 73 | -v, --version output version information and exit 74 | --run try to run the given command, and emulate it if it fails 75 | 76 | Supported PROGRAM values: 77 | aclocal touch file \`aclocal.m4' 78 | autoconf touch file \`configure' 79 | autoheader touch file \`config.h.in' 80 | autom4te touch the output file, or create a stub one 81 | automake touch all \`Makefile.in' files 82 | bison create \`y.tab.[ch]', if possible, from existing .[ch] 83 | flex create \`lex.yy.c', if possible, from existing .c 84 | help2man touch the output file 85 | lex create \`lex.yy.c', if possible, from existing .c 86 | makeinfo touch the output file 87 | tar try tar, gnutar, gtar, then tar without non-portable flags 88 | yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89 | 90 | Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91 | \`g' are ignored when checking the name. 92 | 93 | Send bug reports to ." 94 | exit $? 95 | ;; 96 | 97 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98 | echo "missing $scriptversion (GNU Automake)" 99 | exit $? 100 | ;; 101 | 102 | -*) 103 | echo 1>&2 "$0: Unknown \`$1' option" 104 | echo 1>&2 "Try \`$0 --help' for more information" 105 | exit 1 106 | ;; 107 | 108 | esac 109 | 110 | # normalize program name to check for. 111 | program=`echo "$1" | sed ' 112 | s/^gnu-//; t 113 | s/^gnu//; t 114 | s/^g//; t'` 115 | 116 | # Now exit if we have it, but it failed. Also exit now if we 117 | # don't have it and --version was passed (most likely to detect 118 | # the program). This is about non-GNU programs, so use $1 not 119 | # $program. 120 | case $1 in 121 | lex*|yacc*) 122 | # Not GNU programs, they don't have --version. 123 | ;; 124 | 125 | tar*) 126 | if test -n "$run"; then 127 | echo 1>&2 "ERROR: \`tar' requires --run" 128 | exit 1 129 | elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130 | exit 1 131 | fi 132 | ;; 133 | 134 | *) 135 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 136 | # We have it, but it failed. 137 | exit 1 138 | elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139 | # Could not run --version or --help. This is probably someone 140 | # running `$TOOL --version' or `$TOOL --help' to check whether 141 | # $TOOL exists and not knowing $TOOL uses missing. 142 | exit 1 143 | fi 144 | ;; 145 | esac 146 | 147 | # If it does not exist, or fails to run (possibly an outdated version), 148 | # try to emulate it. 149 | case $program in 150 | aclocal*) 151 | echo 1>&2 "\ 152 | WARNING: \`$1' is $msg. You should only need it if 153 | you modified \`acinclude.m4' or \`${configure_ac}'. You might want 154 | to install the \`Automake' and \`Perl' packages. Grab them from 155 | any GNU archive site." 156 | touch aclocal.m4 157 | ;; 158 | 159 | autoconf*) 160 | echo 1>&2 "\ 161 | WARNING: \`$1' is $msg. You should only need it if 162 | you modified \`${configure_ac}'. You might want to install the 163 | \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 164 | archive site." 165 | touch configure 166 | ;; 167 | 168 | autoheader*) 169 | echo 1>&2 "\ 170 | WARNING: \`$1' is $msg. You should only need it if 171 | you modified \`acconfig.h' or \`${configure_ac}'. You might want 172 | to install the \`Autoconf' and \`GNU m4' packages. Grab them 173 | from any GNU archive site." 174 | files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 175 | test -z "$files" && files="config.h" 176 | touch_files= 177 | for f in $files; do 178 | case $f in 179 | *:*) touch_files="$touch_files "`echo "$f" | 180 | sed -e 's/^[^:]*://' -e 's/:.*//'`;; 181 | *) touch_files="$touch_files $f.in";; 182 | esac 183 | done 184 | touch $touch_files 185 | ;; 186 | 187 | automake*) 188 | echo 1>&2 "\ 189 | WARNING: \`$1' is $msg. You should only need it if 190 | you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 191 | You might want to install the \`Automake' and \`Perl' packages. 192 | Grab them from any GNU archive site." 193 | find . -type f -name Makefile.am -print | 194 | sed 's/\.am$/.in/' | 195 | while read f; do touch "$f"; done 196 | ;; 197 | 198 | autom4te*) 199 | echo 1>&2 "\ 200 | WARNING: \`$1' is needed, but is $msg. 201 | You might have modified some files without having the 202 | proper tools for further handling them. 203 | You can get \`$1' as part of \`Autoconf' from any GNU 204 | archive site." 205 | 206 | file=`echo "$*" | sed -n "$sed_output"` 207 | test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 208 | if test -f "$file"; then 209 | touch $file 210 | else 211 | test -z "$file" || exec >$file 212 | echo "#! /bin/sh" 213 | echo "# Created by GNU Automake missing as a replacement of" 214 | echo "# $ $@" 215 | echo "exit 0" 216 | chmod +x $file 217 | exit 1 218 | fi 219 | ;; 220 | 221 | bison*|yacc*) 222 | echo 1>&2 "\ 223 | WARNING: \`$1' $msg. You should only need it if 224 | you modified a \`.y' file. You may need the \`Bison' package 225 | in order for those modifications to take effect. You can get 226 | \`Bison' from any GNU archive site." 227 | rm -f y.tab.c y.tab.h 228 | if test $# -ne 1; then 229 | eval LASTARG="\${$#}" 230 | case $LASTARG in 231 | *.y) 232 | SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233 | if test -f "$SRCFILE"; then 234 | cp "$SRCFILE" y.tab.c 235 | fi 236 | SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237 | if test -f "$SRCFILE"; then 238 | cp "$SRCFILE" y.tab.h 239 | fi 240 | ;; 241 | esac 242 | fi 243 | if test ! -f y.tab.h; then 244 | echo >y.tab.h 245 | fi 246 | if test ! -f y.tab.c; then 247 | echo 'main() { return 0; }' >y.tab.c 248 | fi 249 | ;; 250 | 251 | lex*|flex*) 252 | echo 1>&2 "\ 253 | WARNING: \`$1' is $msg. You should only need it if 254 | you modified a \`.l' file. You may need the \`Flex' package 255 | in order for those modifications to take effect. You can get 256 | \`Flex' from any GNU archive site." 257 | rm -f lex.yy.c 258 | if test $# -ne 1; then 259 | eval LASTARG="\${$#}" 260 | case $LASTARG in 261 | *.l) 262 | SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263 | if test -f "$SRCFILE"; then 264 | cp "$SRCFILE" lex.yy.c 265 | fi 266 | ;; 267 | esac 268 | fi 269 | if test ! -f lex.yy.c; then 270 | echo 'main() { return 0; }' >lex.yy.c 271 | fi 272 | ;; 273 | 274 | help2man*) 275 | echo 1>&2 "\ 276 | WARNING: \`$1' is $msg. You should only need it if 277 | you modified a dependency of a manual page. You may need the 278 | \`Help2man' package in order for those modifications to take 279 | effect. You can get \`Help2man' from any GNU archive site." 280 | 281 | file=`echo "$*" | sed -n "$sed_output"` 282 | test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283 | if test -f "$file"; then 284 | touch $file 285 | else 286 | test -z "$file" || exec >$file 287 | echo ".ab help2man is required to generate this page" 288 | exit $? 289 | fi 290 | ;; 291 | 292 | makeinfo*) 293 | echo 1>&2 "\ 294 | WARNING: \`$1' is $msg. You should only need it if 295 | you modified a \`.texi' or \`.texinfo' file, or any other file 296 | indirectly affecting the aspect of the manual. The spurious 297 | call might also be the consequence of using a buggy \`make' (AIX, 298 | DU, IRIX). You might want to install the \`Texinfo' package or 299 | the \`GNU make' package. Grab either from any GNU archive site." 300 | # The file to touch is that specified with -o ... 301 | file=`echo "$*" | sed -n "$sed_output"` 302 | test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 303 | if test -z "$file"; then 304 | # ... or it is the one specified with @setfilename ... 305 | infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306 | file=`sed -n ' 307 | /^@setfilename/{ 308 | s/.* \([^ ]*\) *$/\1/ 309 | p 310 | q 311 | }' $infile` 312 | # ... or it is derived from the source name (dir/f.texi becomes f.info) 313 | test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 314 | fi 315 | # If the file does not exist, the user really needs makeinfo; 316 | # let's fail without touching anything. 317 | test -f $file || exit 1 318 | touch $file 319 | ;; 320 | 321 | tar*) 322 | shift 323 | 324 | # We have already tried tar in the generic part. 325 | # Look for gnutar/gtar before invocation to avoid ugly error 326 | # messages. 327 | if (gnutar --version > /dev/null 2>&1); then 328 | gnutar "$@" && exit 0 329 | fi 330 | if (gtar --version > /dev/null 2>&1); then 331 | gtar "$@" && exit 0 332 | fi 333 | firstarg="$1" 334 | if shift; then 335 | case $firstarg in 336 | *o*) 337 | firstarg=`echo "$firstarg" | sed s/o//` 338 | tar "$firstarg" "$@" && exit 0 339 | ;; 340 | esac 341 | case $firstarg in 342 | *h*) 343 | firstarg=`echo "$firstarg" | sed s/h//` 344 | tar "$firstarg" "$@" && exit 0 345 | ;; 346 | esac 347 | fi 348 | 349 | echo 1>&2 "\ 350 | WARNING: I can't seem to be able to run \`tar' with the given arguments. 351 | You may want to install GNU tar or Free paxutils, or check the 352 | command line arguments." 353 | exit 1 354 | ;; 355 | 356 | *) 357 | echo 1>&2 "\ 358 | WARNING: \`$1' is needed, and is $msg. 359 | You might have modified some files without having the 360 | proper tools for further handling them. Check the \`README' file, 361 | it often tells you about the needed prerequisites for installing 362 | this package. You may also peek at any GNU archive site, in case 363 | some other package would contain this missing \`$1' program." 364 | exit 1 365 | ;; 366 | esac 367 | 368 | exit 0 369 | 370 | # Local variables: 371 | # eval: (add-hook 'write-file-hooks 'time-stamp) 372 | # time-stamp-start: "scriptversion=" 373 | # time-stamp-format: "%:y-%02m-%02d.%02H" 374 | # time-stamp-time-zone: "UTC" 375 | # time-stamp-end: "; # UTC" 376 | # End: 377 | -------------------------------------------------------------------------------- /rockspecs/luacrypto-git-1.rockspec: -------------------------------------------------------------------------------- 1 | package = "LuaCrypto" 2 | version = "git-1" 3 | description = { 4 | summary = "A Lua frontend to OpenSSL", 5 | detailed = [[LuaCrypto is a Lua frontend to the OpenSSL cryptographic library. The OpenSSL features that are currently exposed are: 6 | digests (MD5, SHA-1, HMAC, and more), encryption, decryption and crypto-grade random number generators.]], 7 | homepage = "http://mkottman.github.com/luacrypto/", 8 | license = "MIT", 9 | } 10 | dependencies = { 11 | "lua >= 5.1", 12 | } 13 | source = { 14 | url = [[git://github.com/mkottman/luacrypto.git]], 15 | dir = "luacrypto" 16 | } 17 | build = { 18 | platforms = { 19 | windows = { 20 | type = "command", 21 | build_command = [[vcbuild ./luacrypto.vcproj Release /useenv /rebuild]], 22 | install_command = [[copy ".\Release\crypto.dll" "$(LIBDIR)\crypto.dll" /y ]] 23 | }, 24 | unix = { 25 | type = "make", 26 | variables = { 27 | INCONCERT_DEVEL = "$(INCONCERT_DEVEL)", 28 | LUA_LUADIR = "$(LUADIR)", 29 | LUA_LIBDIR = "$(LIBDIR)", 30 | LUA_PREFIX = "$(PREFIX)" 31 | } 32 | } 33 | }, 34 | copy_directories = { "doc" } 35 | } 36 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | cryptodir = @LUALIBDIR@ 2 | crypto_la_LIBADD = @OPENSSL_LIBS@ 3 | crypto_LTLIBRARIES = crypto.la 4 | crypto_la_SOURCES = lcrypto.c lcrypto.h 5 | crypto_la_LDFLAGS = -module -avoid-version 6 | 7 | crypto_includedir = @CRYPTOINC@ 8 | crypto_include_HEADERS = lcrypto.h 9 | -------------------------------------------------------------------------------- /src/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.11.1 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 5 | # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, 6 | # Inc. 7 | # This Makefile.in is free software; the Free Software Foundation 8 | # gives unlimited permission to copy and/or distribute it, 9 | # with or without modifications, as long as this notice is preserved. 10 | 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 13 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 | # PARTICULAR PURPOSE. 15 | 16 | @SET_MAKE@ 17 | 18 | 19 | VPATH = @srcdir@ 20 | pkgdatadir = $(datadir)/@PACKAGE@ 21 | pkgincludedir = $(includedir)/@PACKAGE@ 22 | pkglibdir = $(libdir)/@PACKAGE@ 23 | pkglibexecdir = $(libexecdir)/@PACKAGE@ 24 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 25 | install_sh_DATA = $(install_sh) -c -m 644 26 | install_sh_PROGRAM = $(install_sh) -c 27 | install_sh_SCRIPT = $(install_sh) -c 28 | INSTALL_HEADER = $(INSTALL_DATA) 29 | transform = $(program_transform_name) 30 | NORMAL_INSTALL = : 31 | PRE_INSTALL = : 32 | POST_INSTALL = : 33 | NORMAL_UNINSTALL = : 34 | PRE_UNINSTALL = : 35 | POST_UNINSTALL = : 36 | build_triplet = @build@ 37 | host_triplet = @host@ 38 | subdir = src 39 | DIST_COMMON = $(crypto_include_HEADERS) $(srcdir)/Makefile.am \ 40 | $(srcdir)/Makefile.in 41 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 42 | am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ 43 | $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ 44 | $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ 45 | $(top_srcdir)/configure.ac 46 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 47 | $(ACLOCAL_M4) 48 | mkinstalldirs = $(install_sh) -d 49 | CONFIG_HEADER = $(top_builddir)/config.h 50 | CONFIG_CLEAN_FILES = 51 | CONFIG_CLEAN_VPATH_FILES = 52 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; 53 | am__vpath_adj = case $$p in \ 54 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ 55 | *) f=$$p;; \ 56 | esac; 57 | am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; 58 | am__install_max = 40 59 | am__nobase_strip_setup = \ 60 | srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` 61 | am__nobase_strip = \ 62 | for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" 63 | am__nobase_list = $(am__nobase_strip_setup); \ 64 | for p in $$list; do echo "$$p $$p"; done | \ 65 | sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ 66 | $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ 67 | if (++n[$$2] == $(am__install_max)) \ 68 | { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ 69 | END { for (dir in files) print dir, files[dir] }' 70 | am__base_list = \ 71 | sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ 72 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' 73 | am__installdirs = "$(DESTDIR)$(cryptodir)" \ 74 | "$(DESTDIR)$(crypto_includedir)" 75 | LTLIBRARIES = $(crypto_LTLIBRARIES) 76 | crypto_la_DEPENDENCIES = 77 | am_crypto_la_OBJECTS = lcrypto.lo 78 | crypto_la_OBJECTS = $(am_crypto_la_OBJECTS) 79 | crypto_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ 80 | $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ 81 | $(crypto_la_LDFLAGS) $(LDFLAGS) -o $@ 82 | DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) 83 | depcomp = $(SHELL) $(top_srcdir)/depcomp 84 | am__depfiles_maybe = depfiles 85 | am__mv = mv -f 86 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ 87 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 88 | LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ 89 | --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ 90 | $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 91 | CCLD = $(CC) 92 | LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ 93 | --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ 94 | $(LDFLAGS) -o $@ 95 | SOURCES = $(crypto_la_SOURCES) 96 | DIST_SOURCES = $(crypto_la_SOURCES) 97 | HEADERS = $(crypto_include_HEADERS) 98 | ETAGS = etags 99 | CTAGS = ctags 100 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 101 | ACLOCAL = @ACLOCAL@ 102 | AMTAR = @AMTAR@ 103 | AM_CPPFLAGS = @AM_CPPFLAGS@ 104 | AR = @AR@ 105 | AUTOCONF = @AUTOCONF@ 106 | AUTOHEADER = @AUTOHEADER@ 107 | AUTOMAKE = @AUTOMAKE@ 108 | AWK = @AWK@ 109 | CC = @CC@ 110 | CCDEPMODE = @CCDEPMODE@ 111 | CFLAGS = @CFLAGS@ 112 | CPP = @CPP@ 113 | CPPFLAGS = @CPPFLAGS@ 114 | CRYPTOINC = @CRYPTOINC@ 115 | CYGPATH_W = @CYGPATH_W@ 116 | DEFS = @DEFS@ 117 | DEPDIR = @DEPDIR@ 118 | DLLTOOL = @DLLTOOL@ 119 | DSYMUTIL = @DSYMUTIL@ 120 | DUMPBIN = @DUMPBIN@ 121 | ECHO_C = @ECHO_C@ 122 | ECHO_N = @ECHO_N@ 123 | ECHO_T = @ECHO_T@ 124 | EGREP = @EGREP@ 125 | EXEEXT = @EXEEXT@ 126 | FGREP = @FGREP@ 127 | GREP = @GREP@ 128 | INSTALL = @INSTALL@ 129 | INSTALL_DATA = @INSTALL_DATA@ 130 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 131 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 132 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 133 | LD = @LD@ 134 | LDFLAGS = @LDFLAGS@ 135 | LIBOBJS = @LIBOBJS@ 136 | LIBS = @LIBS@ 137 | LIBTOOL = @LIBTOOL@ 138 | LIPO = @LIPO@ 139 | LN_S = @LN_S@ 140 | LTLIBOBJS = @LTLIBOBJS@ 141 | LUALIBDIR = @LUALIBDIR@ 142 | LUA_CFLAGS = @LUA_CFLAGS@ 143 | LUA_LIBS = @LUA_LIBS@ 144 | MAKEINFO = @MAKEINFO@ 145 | MANIFEST_TOOL = @MANIFEST_TOOL@ 146 | MKDIR_P = @MKDIR_P@ 147 | NM = @NM@ 148 | NMEDIT = @NMEDIT@ 149 | OBJDUMP = @OBJDUMP@ 150 | OBJEXT = @OBJEXT@ 151 | OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ 152 | OPENSSL_LIBS = @OPENSSL_LIBS@ 153 | OTOOL = @OTOOL@ 154 | OTOOL64 = @OTOOL64@ 155 | PACKAGE = @PACKAGE@ 156 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 157 | PACKAGE_NAME = @PACKAGE_NAME@ 158 | PACKAGE_STRING = @PACKAGE_STRING@ 159 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 160 | PACKAGE_URL = @PACKAGE_URL@ 161 | PACKAGE_VERSION = @PACKAGE_VERSION@ 162 | PATH_SEPARATOR = @PATH_SEPARATOR@ 163 | PKGCONFIG = @PKGCONFIG@ 164 | PKG_CONFIG = @PKG_CONFIG@ 165 | PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ 166 | PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ 167 | RANLIB = @RANLIB@ 168 | SED = @SED@ 169 | SET_MAKE = @SET_MAKE@ 170 | SHELL = @SHELL@ 171 | STRIP = @STRIP@ 172 | VERSION = @VERSION@ 173 | abs_builddir = @abs_builddir@ 174 | abs_srcdir = @abs_srcdir@ 175 | abs_top_builddir = @abs_top_builddir@ 176 | abs_top_srcdir = @abs_top_srcdir@ 177 | ac_ct_AR = @ac_ct_AR@ 178 | ac_ct_CC = @ac_ct_CC@ 179 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ 180 | am__include = @am__include@ 181 | am__leading_dot = @am__leading_dot@ 182 | am__quote = @am__quote@ 183 | am__tar = @am__tar@ 184 | am__untar = @am__untar@ 185 | bindir = @bindir@ 186 | build = @build@ 187 | build_alias = @build_alias@ 188 | build_cpu = @build_cpu@ 189 | build_os = @build_os@ 190 | build_vendor = @build_vendor@ 191 | builddir = @builddir@ 192 | datadir = @datadir@ 193 | datarootdir = @datarootdir@ 194 | docdir = @docdir@ 195 | dvidir = @dvidir@ 196 | exec_prefix = @exec_prefix@ 197 | host = @host@ 198 | host_alias = @host_alias@ 199 | host_cpu = @host_cpu@ 200 | host_os = @host_os@ 201 | host_vendor = @host_vendor@ 202 | htmldir = @htmldir@ 203 | includedir = @includedir@ 204 | infodir = @infodir@ 205 | install_sh = @install_sh@ 206 | libdir = @libdir@ 207 | libexecdir = @libexecdir@ 208 | localedir = @localedir@ 209 | localstatedir = @localstatedir@ 210 | mandir = @mandir@ 211 | mkdir_p = @mkdir_p@ 212 | oldincludedir = @oldincludedir@ 213 | pdfdir = @pdfdir@ 214 | prefix = @prefix@ 215 | program_transform_name = @program_transform_name@ 216 | psdir = @psdir@ 217 | sbindir = @sbindir@ 218 | sharedstatedir = @sharedstatedir@ 219 | srcdir = @srcdir@ 220 | sysconfdir = @sysconfdir@ 221 | target_alias = @target_alias@ 222 | top_build_prefix = @top_build_prefix@ 223 | top_builddir = @top_builddir@ 224 | top_srcdir = @top_srcdir@ 225 | cryptodir = @LUALIBDIR@ 226 | crypto_la_LIBADD = @OPENSSL_LIBS@ 227 | crypto_LTLIBRARIES = crypto.la 228 | crypto_la_SOURCES = lcrypto.c lcrypto.h 229 | crypto_la_LDFLAGS = -module -avoid-version 230 | crypto_includedir = @CRYPTOINC@ 231 | crypto_include_HEADERS = lcrypto.h 232 | all: all-am 233 | 234 | .SUFFIXES: 235 | .SUFFIXES: .c .lo .o .obj 236 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) 237 | @for dep in $?; do \ 238 | case '$(am__configure_deps)' in \ 239 | *$$dep*) \ 240 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ 241 | && { if test -f $@; then exit 0; else break; fi; }; \ 242 | exit 1;; \ 243 | esac; \ 244 | done; \ 245 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ 246 | $(am__cd) $(top_srcdir) && \ 247 | $(AUTOMAKE) --gnu src/Makefile 248 | .PRECIOUS: Makefile 249 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 250 | @case '$?' in \ 251 | *config.status*) \ 252 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 253 | *) \ 254 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 255 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 256 | esac; 257 | 258 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 259 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 260 | 261 | $(top_srcdir)/configure: $(am__configure_deps) 262 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 263 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) 264 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 265 | $(am__aclocal_m4_deps): 266 | install-cryptoLTLIBRARIES: $(crypto_LTLIBRARIES) 267 | @$(NORMAL_INSTALL) 268 | test -z "$(cryptodir)" || $(MKDIR_P) "$(DESTDIR)$(cryptodir)" 269 | @list='$(crypto_LTLIBRARIES)'; test -n "$(cryptodir)" || list=; \ 270 | list2=; for p in $$list; do \ 271 | if test -f $$p; then \ 272 | list2="$$list2 $$p"; \ 273 | else :; fi; \ 274 | done; \ 275 | test -z "$$list2" || { \ 276 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(cryptodir)'"; \ 277 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(cryptodir)"; \ 278 | } 279 | 280 | uninstall-cryptoLTLIBRARIES: 281 | @$(NORMAL_UNINSTALL) 282 | @list='$(crypto_LTLIBRARIES)'; test -n "$(cryptodir)" || list=; \ 283 | for p in $$list; do \ 284 | $(am__strip_dir) \ 285 | echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(cryptodir)/$$f'"; \ 286 | $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(cryptodir)/$$f"; \ 287 | done 288 | 289 | clean-cryptoLTLIBRARIES: 290 | -test -z "$(crypto_LTLIBRARIES)" || rm -f $(crypto_LTLIBRARIES) 291 | @list='$(crypto_LTLIBRARIES)'; for p in $$list; do \ 292 | dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ 293 | test "$$dir" != "$$p" || dir=.; \ 294 | echo "rm -f \"$${dir}/so_locations\""; \ 295 | rm -f "$${dir}/so_locations"; \ 296 | done 297 | crypto.la: $(crypto_la_OBJECTS) $(crypto_la_DEPENDENCIES) 298 | $(crypto_la_LINK) -rpath $(cryptodir) $(crypto_la_OBJECTS) $(crypto_la_LIBADD) $(LIBS) 299 | 300 | mostlyclean-compile: 301 | -rm -f *.$(OBJEXT) 302 | 303 | distclean-compile: 304 | -rm -f *.tab.c 305 | 306 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lcrypto.Plo@am__quote@ 307 | 308 | .c.o: 309 | @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< 310 | @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po 311 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 312 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 313 | @am__fastdepCC_FALSE@ $(COMPILE) -c $< 314 | 315 | .c.obj: 316 | @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` 317 | @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po 318 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 319 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 320 | @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` 321 | 322 | .c.lo: 323 | @am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< 324 | @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo 325 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ 326 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 327 | @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< 328 | 329 | mostlyclean-libtool: 330 | -rm -f *.lo 331 | 332 | clean-libtool: 333 | -rm -rf .libs _libs 334 | install-crypto_includeHEADERS: $(crypto_include_HEADERS) 335 | @$(NORMAL_INSTALL) 336 | test -z "$(crypto_includedir)" || $(MKDIR_P) "$(DESTDIR)$(crypto_includedir)" 337 | @list='$(crypto_include_HEADERS)'; test -n "$(crypto_includedir)" || list=; \ 338 | for p in $$list; do \ 339 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ 340 | echo "$$d$$p"; \ 341 | done | $(am__base_list) | \ 342 | while read files; do \ 343 | echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(crypto_includedir)'"; \ 344 | $(INSTALL_HEADER) $$files "$(DESTDIR)$(crypto_includedir)" || exit $$?; \ 345 | done 346 | 347 | uninstall-crypto_includeHEADERS: 348 | @$(NORMAL_UNINSTALL) 349 | @list='$(crypto_include_HEADERS)'; test -n "$(crypto_includedir)" || list=; \ 350 | files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ 351 | test -n "$$files" || exit 0; \ 352 | echo " ( cd '$(DESTDIR)$(crypto_includedir)' && rm -f" $$files ")"; \ 353 | cd "$(DESTDIR)$(crypto_includedir)" && rm -f $$files 354 | 355 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) 356 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 357 | unique=`for i in $$list; do \ 358 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 359 | done | \ 360 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ 361 | END { if (nonempty) { for (i in files) print i; }; }'`; \ 362 | mkid -fID $$unique 363 | tags: TAGS 364 | 365 | TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 366 | $(TAGS_FILES) $(LISP) 367 | set x; \ 368 | here=`pwd`; \ 369 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 370 | unique=`for i in $$list; do \ 371 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 372 | done | \ 373 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ 374 | END { if (nonempty) { for (i in files) print i; }; }'`; \ 375 | shift; \ 376 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ 377 | test -n "$$unique" || unique=$$empty_fix; \ 378 | if test $$# -gt 0; then \ 379 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 380 | "$$@" $$unique; \ 381 | else \ 382 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 383 | $$unique; \ 384 | fi; \ 385 | fi 386 | ctags: CTAGS 387 | CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ 388 | $(TAGS_FILES) $(LISP) 389 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 390 | unique=`for i in $$list; do \ 391 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 392 | done | \ 393 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ 394 | END { if (nonempty) { for (i in files) print i; }; }'`; \ 395 | test -z "$(CTAGS_ARGS)$$unique" \ 396 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ 397 | $$unique 398 | 399 | GTAGS: 400 | here=`$(am__cd) $(top_builddir) && pwd` \ 401 | && $(am__cd) $(top_srcdir) \ 402 | && gtags -i $(GTAGS_ARGS) "$$here" 403 | 404 | distclean-tags: 405 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags 406 | 407 | distdir: $(DISTFILES) 408 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 409 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 410 | list='$(DISTFILES)'; \ 411 | dist_files=`for file in $$list; do echo $$file; done | \ 412 | sed -e "s|^$$srcdirstrip/||;t" \ 413 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ 414 | case $$dist_files in \ 415 | */*) $(MKDIR_P) `echo "$$dist_files" | \ 416 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ 417 | sort -u` ;; \ 418 | esac; \ 419 | for file in $$dist_files; do \ 420 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 421 | if test -d $$d/$$file; then \ 422 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ 423 | if test -d "$(distdir)/$$file"; then \ 424 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 425 | fi; \ 426 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 427 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ 428 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 429 | fi; \ 430 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ 431 | else \ 432 | test -f "$(distdir)/$$file" \ 433 | || cp -p $$d/$$file "$(distdir)/$$file" \ 434 | || exit 1; \ 435 | fi; \ 436 | done 437 | check-am: all-am 438 | check: check-am 439 | all-am: Makefile $(LTLIBRARIES) $(HEADERS) 440 | installdirs: 441 | for dir in "$(DESTDIR)$(cryptodir)" "$(DESTDIR)$(crypto_includedir)"; do \ 442 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ 443 | done 444 | install: install-am 445 | install-exec: install-exec-am 446 | install-data: install-data-am 447 | uninstall: uninstall-am 448 | 449 | install-am: all-am 450 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 451 | 452 | installcheck: installcheck-am 453 | install-strip: 454 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 455 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 456 | `test -z '$(STRIP)' || \ 457 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 458 | mostlyclean-generic: 459 | 460 | clean-generic: 461 | 462 | distclean-generic: 463 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) 464 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) 465 | 466 | maintainer-clean-generic: 467 | @echo "This command is intended for maintainers to use" 468 | @echo "it deletes files that may require special tools to rebuild." 469 | clean: clean-am 470 | 471 | clean-am: clean-cryptoLTLIBRARIES clean-generic clean-libtool \ 472 | mostlyclean-am 473 | 474 | distclean: distclean-am 475 | -rm -rf ./$(DEPDIR) 476 | -rm -f Makefile 477 | distclean-am: clean-am distclean-compile distclean-generic \ 478 | distclean-tags 479 | 480 | dvi: dvi-am 481 | 482 | dvi-am: 483 | 484 | html: html-am 485 | 486 | html-am: 487 | 488 | info: info-am 489 | 490 | info-am: 491 | 492 | install-data-am: install-cryptoLTLIBRARIES \ 493 | install-crypto_includeHEADERS 494 | 495 | install-dvi: install-dvi-am 496 | 497 | install-dvi-am: 498 | 499 | install-exec-am: 500 | 501 | install-html: install-html-am 502 | 503 | install-html-am: 504 | 505 | install-info: install-info-am 506 | 507 | install-info-am: 508 | 509 | install-man: 510 | 511 | install-pdf: install-pdf-am 512 | 513 | install-pdf-am: 514 | 515 | install-ps: install-ps-am 516 | 517 | install-ps-am: 518 | 519 | installcheck-am: 520 | 521 | maintainer-clean: maintainer-clean-am 522 | -rm -rf ./$(DEPDIR) 523 | -rm -f Makefile 524 | maintainer-clean-am: distclean-am maintainer-clean-generic 525 | 526 | mostlyclean: mostlyclean-am 527 | 528 | mostlyclean-am: mostlyclean-compile mostlyclean-generic \ 529 | mostlyclean-libtool 530 | 531 | pdf: pdf-am 532 | 533 | pdf-am: 534 | 535 | ps: ps-am 536 | 537 | ps-am: 538 | 539 | uninstall-am: uninstall-cryptoLTLIBRARIES \ 540 | uninstall-crypto_includeHEADERS 541 | 542 | .MAKE: install-am install-strip 543 | 544 | .PHONY: CTAGS GTAGS all all-am check check-am clean \ 545 | clean-cryptoLTLIBRARIES clean-generic clean-libtool ctags \ 546 | distclean distclean-compile distclean-generic \ 547 | distclean-libtool distclean-tags distdir dvi dvi-am html \ 548 | html-am info info-am install install-am \ 549 | install-cryptoLTLIBRARIES install-crypto_includeHEADERS \ 550 | install-data install-data-am install-dvi install-dvi-am \ 551 | install-exec install-exec-am install-html install-html-am \ 552 | install-info install-info-am install-man install-pdf \ 553 | install-pdf-am install-ps install-ps-am install-strip \ 554 | installcheck installcheck-am installdirs maintainer-clean \ 555 | maintainer-clean-generic mostlyclean mostlyclean-compile \ 556 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ 557 | tags uninstall uninstall-am uninstall-cryptoLTLIBRARIES \ 558 | uninstall-crypto_includeHEADERS 559 | 560 | 561 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 562 | # Otherwise a system limit (for SysV at least) may be exceeded. 563 | .NOEXPORT: 564 | -------------------------------------------------------------------------------- /src/lcrypto.h: -------------------------------------------------------------------------------- 1 | /* 2 | ** $Id: lcrypto.h,v 1.2 2006/08/25 03:28:32 nezroy Exp $ 3 | ** See Copyright Notice in license.html 4 | */ 5 | 6 | #ifndef _LUACRYPTO_ 7 | #define _LUACRYPTO_ 8 | 9 | #ifndef LUACRYPTO_API 10 | #define LUACRYPTO_API LUA_API 11 | #endif 12 | 13 | #define LUACRYPTO_PREFIX "LuaCrypto: " 14 | #define LUACRYPTO_CORENAME "crypto" 15 | #define LUACRYPTO_DIGESTNAME "crypto.digest" 16 | #define LUACRYPTO_ENCRYPTNAME "crypto.encrypt" 17 | #define LUACRYPTO_DECRYPTNAME "crypto.decrypt" 18 | #define LUACRYPTO_SIGNNAME "crypto.sign" 19 | #define LUACRYPTO_VERIFYNAME "crypto.verify" 20 | 21 | #define LUACRYPTO_SEALNAME "crypto.seal" 22 | #define LUACRYPTO_OPENNAME "crypto.open" 23 | 24 | #define LUACRYPTO_HMACNAME "crypto.hmac" 25 | #define LUACRYPTO_RANDNAME "crypto.rand" 26 | #define LUACRYPTO_PKEYNAME "crypto.pkey" 27 | #define LUACRYPTO_X509_CERT_NAME "crypto.x509" 28 | #define LUACRYPTO_X509_CA_NAME "crypto.x509_ca" 29 | 30 | LUACRYPTO_API int luacrypto_createmeta (lua_State *L, const char *name, const luaL_Reg *methods); 31 | LUACRYPTO_API void luacrypto_setmeta (lua_State *L, const char *name); 32 | LUACRYPTO_API void luacrypto_set_info (lua_State *L); 33 | LUACRYPTO_API int luaopen_crypto(lua_State *L); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /tests/Makefile.am: -------------------------------------------------------------------------------- 1 | all: *.lua 2 | cp ../src/.libs/crypto.so crypto.so 3 | ./run-tests 4 | 5 | clean-local: 6 | rm -f crypto.so 7 | rm -f *.pem 8 | -------------------------------------------------------------------------------- /tests/Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.11.1 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 5 | # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, 6 | # Inc. 7 | # This Makefile.in is free software; the Free Software Foundation 8 | # gives unlimited permission to copy and/or distribute it, 9 | # with or without modifications, as long as this notice is preserved. 10 | 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 13 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 | # PARTICULAR PURPOSE. 15 | 16 | @SET_MAKE@ 17 | VPATH = @srcdir@ 18 | pkgdatadir = $(datadir)/@PACKAGE@ 19 | pkgincludedir = $(includedir)/@PACKAGE@ 20 | pkglibdir = $(libdir)/@PACKAGE@ 21 | pkglibexecdir = $(libexecdir)/@PACKAGE@ 22 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 23 | install_sh_DATA = $(install_sh) -c -m 644 24 | install_sh_PROGRAM = $(install_sh) -c 25 | install_sh_SCRIPT = $(install_sh) -c 26 | INSTALL_HEADER = $(INSTALL_DATA) 27 | transform = $(program_transform_name) 28 | NORMAL_INSTALL = : 29 | PRE_INSTALL = : 30 | POST_INSTALL = : 31 | NORMAL_UNINSTALL = : 32 | PRE_UNINSTALL = : 33 | POST_UNINSTALL = : 34 | build_triplet = @build@ 35 | host_triplet = @host@ 36 | subdir = tests 37 | DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in 38 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 39 | am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ 40 | $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ 41 | $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ 42 | $(top_srcdir)/configure.ac 43 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 44 | $(ACLOCAL_M4) 45 | mkinstalldirs = $(install_sh) -d 46 | CONFIG_HEADER = $(top_builddir)/config.h 47 | CONFIG_CLEAN_FILES = 48 | CONFIG_CLEAN_VPATH_FILES = 49 | SOURCES = 50 | DIST_SOURCES = 51 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 52 | ACLOCAL = @ACLOCAL@ 53 | AMTAR = @AMTAR@ 54 | AM_CPPFLAGS = @AM_CPPFLAGS@ 55 | AR = @AR@ 56 | AUTOCONF = @AUTOCONF@ 57 | AUTOHEADER = @AUTOHEADER@ 58 | AUTOMAKE = @AUTOMAKE@ 59 | AWK = @AWK@ 60 | CC = @CC@ 61 | CCDEPMODE = @CCDEPMODE@ 62 | CFLAGS = @CFLAGS@ 63 | CPP = @CPP@ 64 | CPPFLAGS = @CPPFLAGS@ 65 | CRYPTOINC = @CRYPTOINC@ 66 | CYGPATH_W = @CYGPATH_W@ 67 | DEFS = @DEFS@ 68 | DEPDIR = @DEPDIR@ 69 | DLLTOOL = @DLLTOOL@ 70 | DSYMUTIL = @DSYMUTIL@ 71 | DUMPBIN = @DUMPBIN@ 72 | ECHO_C = @ECHO_C@ 73 | ECHO_N = @ECHO_N@ 74 | ECHO_T = @ECHO_T@ 75 | EGREP = @EGREP@ 76 | EXEEXT = @EXEEXT@ 77 | FGREP = @FGREP@ 78 | GREP = @GREP@ 79 | INSTALL = @INSTALL@ 80 | INSTALL_DATA = @INSTALL_DATA@ 81 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 82 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 83 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 84 | LD = @LD@ 85 | LDFLAGS = @LDFLAGS@ 86 | LIBOBJS = @LIBOBJS@ 87 | LIBS = @LIBS@ 88 | LIBTOOL = @LIBTOOL@ 89 | LIPO = @LIPO@ 90 | LN_S = @LN_S@ 91 | LTLIBOBJS = @LTLIBOBJS@ 92 | LUALIBDIR = @LUALIBDIR@ 93 | LUA_CFLAGS = @LUA_CFLAGS@ 94 | LUA_LIBS = @LUA_LIBS@ 95 | MAKEINFO = @MAKEINFO@ 96 | MANIFEST_TOOL = @MANIFEST_TOOL@ 97 | MKDIR_P = @MKDIR_P@ 98 | NM = @NM@ 99 | NMEDIT = @NMEDIT@ 100 | OBJDUMP = @OBJDUMP@ 101 | OBJEXT = @OBJEXT@ 102 | OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ 103 | OPENSSL_LIBS = @OPENSSL_LIBS@ 104 | OTOOL = @OTOOL@ 105 | OTOOL64 = @OTOOL64@ 106 | PACKAGE = @PACKAGE@ 107 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 108 | PACKAGE_NAME = @PACKAGE_NAME@ 109 | PACKAGE_STRING = @PACKAGE_STRING@ 110 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 111 | PACKAGE_URL = @PACKAGE_URL@ 112 | PACKAGE_VERSION = @PACKAGE_VERSION@ 113 | PATH_SEPARATOR = @PATH_SEPARATOR@ 114 | PKGCONFIG = @PKGCONFIG@ 115 | PKG_CONFIG = @PKG_CONFIG@ 116 | PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ 117 | PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ 118 | RANLIB = @RANLIB@ 119 | SED = @SED@ 120 | SET_MAKE = @SET_MAKE@ 121 | SHELL = @SHELL@ 122 | STRIP = @STRIP@ 123 | VERSION = @VERSION@ 124 | abs_builddir = @abs_builddir@ 125 | abs_srcdir = @abs_srcdir@ 126 | abs_top_builddir = @abs_top_builddir@ 127 | abs_top_srcdir = @abs_top_srcdir@ 128 | ac_ct_AR = @ac_ct_AR@ 129 | ac_ct_CC = @ac_ct_CC@ 130 | ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ 131 | am__include = @am__include@ 132 | am__leading_dot = @am__leading_dot@ 133 | am__quote = @am__quote@ 134 | am__tar = @am__tar@ 135 | am__untar = @am__untar@ 136 | bindir = @bindir@ 137 | build = @build@ 138 | build_alias = @build_alias@ 139 | build_cpu = @build_cpu@ 140 | build_os = @build_os@ 141 | build_vendor = @build_vendor@ 142 | builddir = @builddir@ 143 | datadir = @datadir@ 144 | datarootdir = @datarootdir@ 145 | docdir = @docdir@ 146 | dvidir = @dvidir@ 147 | exec_prefix = @exec_prefix@ 148 | host = @host@ 149 | host_alias = @host_alias@ 150 | host_cpu = @host_cpu@ 151 | host_os = @host_os@ 152 | host_vendor = @host_vendor@ 153 | htmldir = @htmldir@ 154 | includedir = @includedir@ 155 | infodir = @infodir@ 156 | install_sh = @install_sh@ 157 | libdir = @libdir@ 158 | libexecdir = @libexecdir@ 159 | localedir = @localedir@ 160 | localstatedir = @localstatedir@ 161 | mandir = @mandir@ 162 | mkdir_p = @mkdir_p@ 163 | oldincludedir = @oldincludedir@ 164 | pdfdir = @pdfdir@ 165 | prefix = @prefix@ 166 | program_transform_name = @program_transform_name@ 167 | psdir = @psdir@ 168 | sbindir = @sbindir@ 169 | sharedstatedir = @sharedstatedir@ 170 | srcdir = @srcdir@ 171 | sysconfdir = @sysconfdir@ 172 | target_alias = @target_alias@ 173 | top_build_prefix = @top_build_prefix@ 174 | top_builddir = @top_builddir@ 175 | top_srcdir = @top_srcdir@ 176 | all: all-am 177 | 178 | .SUFFIXES: 179 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) 180 | @for dep in $?; do \ 181 | case '$(am__configure_deps)' in \ 182 | *$$dep*) \ 183 | ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ 184 | && { if test -f $@; then exit 0; else break; fi; }; \ 185 | exit 1;; \ 186 | esac; \ 187 | done; \ 188 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ 189 | $(am__cd) $(top_srcdir) && \ 190 | $(AUTOMAKE) --gnu tests/Makefile 191 | .PRECIOUS: Makefile 192 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 193 | @case '$?' in \ 194 | *config.status*) \ 195 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ 196 | *) \ 197 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ 198 | cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ 199 | esac; 200 | 201 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 202 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 203 | 204 | $(top_srcdir)/configure: $(am__configure_deps) 205 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 206 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) 207 | cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh 208 | $(am__aclocal_m4_deps): 209 | 210 | mostlyclean-libtool: 211 | -rm -f *.lo 212 | 213 | clean-libtool: 214 | -rm -rf .libs _libs 215 | tags: TAGS 216 | TAGS: 217 | 218 | ctags: CTAGS 219 | CTAGS: 220 | 221 | 222 | distdir: $(DISTFILES) 223 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 224 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 225 | list='$(DISTFILES)'; \ 226 | dist_files=`for file in $$list; do echo $$file; done | \ 227 | sed -e "s|^$$srcdirstrip/||;t" \ 228 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ 229 | case $$dist_files in \ 230 | */*) $(MKDIR_P) `echo "$$dist_files" | \ 231 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ 232 | sort -u` ;; \ 233 | esac; \ 234 | for file in $$dist_files; do \ 235 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 236 | if test -d $$d/$$file; then \ 237 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ 238 | if test -d "$(distdir)/$$file"; then \ 239 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 240 | fi; \ 241 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 242 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ 243 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 244 | fi; \ 245 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ 246 | else \ 247 | test -f "$(distdir)/$$file" \ 248 | || cp -p $$d/$$file "$(distdir)/$$file" \ 249 | || exit 1; \ 250 | fi; \ 251 | done 252 | check-am: all-am 253 | check: check-am 254 | all-am: Makefile 255 | installdirs: 256 | install: install-am 257 | install-exec: install-exec-am 258 | install-data: install-data-am 259 | uninstall: uninstall-am 260 | 261 | install-am: all-am 262 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 263 | 264 | installcheck: installcheck-am 265 | install-strip: 266 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 267 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 268 | `test -z '$(STRIP)' || \ 269 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 270 | mostlyclean-generic: 271 | 272 | clean-generic: 273 | 274 | distclean-generic: 275 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) 276 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) 277 | 278 | maintainer-clean-generic: 279 | @echo "This command is intended for maintainers to use" 280 | @echo "it deletes files that may require special tools to rebuild." 281 | clean: clean-am 282 | 283 | clean-am: clean-generic clean-libtool clean-local mostlyclean-am 284 | 285 | distclean: distclean-am 286 | -rm -f Makefile 287 | distclean-am: clean-am distclean-generic 288 | 289 | dvi: dvi-am 290 | 291 | dvi-am: 292 | 293 | html: html-am 294 | 295 | html-am: 296 | 297 | info: info-am 298 | 299 | info-am: 300 | 301 | install-data-am: 302 | 303 | install-dvi: install-dvi-am 304 | 305 | install-dvi-am: 306 | 307 | install-exec-am: 308 | 309 | install-html: install-html-am 310 | 311 | install-html-am: 312 | 313 | install-info: install-info-am 314 | 315 | install-info-am: 316 | 317 | install-man: 318 | 319 | install-pdf: install-pdf-am 320 | 321 | install-pdf-am: 322 | 323 | install-ps: install-ps-am 324 | 325 | install-ps-am: 326 | 327 | installcheck-am: 328 | 329 | maintainer-clean: maintainer-clean-am 330 | -rm -f Makefile 331 | maintainer-clean-am: distclean-am maintainer-clean-generic 332 | 333 | mostlyclean: mostlyclean-am 334 | 335 | mostlyclean-am: mostlyclean-generic mostlyclean-libtool 336 | 337 | pdf: pdf-am 338 | 339 | pdf-am: 340 | 341 | ps: ps-am 342 | 343 | ps-am: 344 | 345 | uninstall-am: 346 | 347 | .MAKE: install-am install-strip 348 | 349 | .PHONY: all all-am check check-am clean clean-generic clean-libtool \ 350 | clean-local distclean distclean-generic distclean-libtool \ 351 | distdir dvi dvi-am html html-am info info-am install \ 352 | install-am install-data install-data-am install-dvi \ 353 | install-dvi-am install-exec install-exec-am install-html \ 354 | install-html-am install-info install-info-am install-man \ 355 | install-pdf install-pdf-am install-ps install-ps-am \ 356 | install-strip installcheck installcheck-am installdirs \ 357 | maintainer-clean maintainer-clean-generic mostlyclean \ 358 | mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ 359 | uninstall uninstall-am 360 | 361 | all: *.lua 362 | cp ../src/.libs/crypto.so crypto.so 363 | ./run-tests 364 | 365 | clean-local: 366 | rm -f crypto.so 367 | rm -f *.pem 368 | 369 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 370 | # Otherwise a system limit (for SysV at least) may be exceeded. 371 | .NOEXPORT: 372 | -------------------------------------------------------------------------------- /tests/ca/README: -------------------------------------------------------------------------------- 1 | Testing x509 certs for luacrypto 2 | 3 | # Make the CA cert 4 | openssl genrsa -des3 -out ca.key 4096 5 | openssl req -new -x509 -days 365 -key ca.key -out ca.crt 6 | 7 | # Make server cert and signing request 8 | openssl genrsa -des3 -out server.key 4096 9 | openssl req -new -key server.key -out server.csr 10 | 11 | # Sign the server csr and generate a crt 12 | openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt 13 | 14 | # Output unencrypted server key 15 | openssl rsa -in server.key -out server.key.insecure 16 | 17 | 18 | -------------------------------------------------------------------------------- /tests/ca/ca.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIG1jCCBL6gAwIBAgIJALZOkAY0D6wQMA0GCSqGSIb3DQEBBQUAMIGiMQswCQYD 3 | VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZyYW5j 4 | aXNjbzEOMAwGA1UEChMFVmlyZ28xEDAOBgNVBAsTB0hhY2tlcnMxGDAWBgNVBAMT 5 | D0JyYW5kb24gUGhpbGlwczEqMCgGCSqGSIb3DQEJARYbYnJhbmRvbi5waGlsaXBz 6 | QGV4YW1wbGUuY29tMB4XDTEyMDEyNjIyMDAxOFoXDTIyMDEyMzIyMDAxOFowgaIx 7 | CzA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8jwyOo/ugwFMMpNmLvM= 39 | -----END CERTIFICATE----- 40 | -------------------------------------------------------------------------------- /tests/ca/ca.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | Proc-Type: 4,ENCRYPTED 3 | DEK-Info: DES-EDE3-CBC,CD751BE331A58811 4 | 5 | cYFqagXMuR8nMeCazsSLMwA6kIeV4SuVCBEB8Ilid2s2HncBMcuxsMR4cvHmQnoL 6 | QyV48hmat8/PQ8sWWRIZWnP7xgUw+MySWolT8NyShfNa6pCKl5HIbH3WhhQjaiOa 7 | arRvY3M1hKqoY7jXjZArBNDCveipqzzG3tXl+70NrYvpqKUQedcHV94BwOg/bDkq 8 | DJN4ZR5VCsvVjFNwpiLRI0vG4KA4ffCRXeTGOcK4J72rLPfcOxKvuGjmAT9R9JnC 9 | UOLcJYNYYrYBmtTi4FpkDDdnN0sovd3sjPAmf20LH+VevGqRqGvUwzDZqNGLz7A9 10 | 1inVOXUAdhVhNaVE7vzP1D2K9Rs2sPfebZXeour5U6/b07HV3ZgbaUZM9YZOxaGi 11 | zbV8frdwEHiFnN7f8Jb+BiD8QVVdKBNv2M4BXvJIoSTebp/JXfpQl0qNmnrUQ5NR 12 | DVeRQCqk4giXh13/BXYcyTUU1+ieTS+eelVOOmWefYccQkocpoTkxP8D6DBVqmZP 13 | BbD6BVNm3EnnV4MDFzHPgu/kiDBsMuXA+gCXC7wlbnH+CCJj9ADbSuNw7nc25TG5 14 | DZEhhyJWnL96Qr+jRXCHOGH46gWMu0RTDugle2lS7I9nGIk5nh9Xz0OrJoCKJDXr 15 | rXJ8CQ11enWBjyJk8WUfDDsc40NSG/7Wa38Gsf9r0KpTN9+HhqhAvdLWJyUKfz6I 16 | w1tfsOg20m3dg17h97YIrsmNexGdszJF4cHBKJJ3V7neF18pR31pblKUt0/EeTJv 17 | iX17KFkOrE6FEkDWSIs/DHEIQUC/nmPuUkmBYGwdupUNIkU/tjvqP0JTwMyc+OMW 18 | rFjk0JCH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+2wPDFGPKER62NWMB 50 | /3c/EuJ4QFiAQbRSyb0edR+vnd4GVECtgzjpSDGpLzQubiybPe/9Wl7f2QjNQNR4 51 | QiyYbFCji3KcA8GsfLjzutEHD1Ew69HImfH7ChXM52z0YVeq4svCvlyoMUeQeB8F 52 | gGr3BvO4G7KrJGlI4p1ob3z06HPgwcAE1Rnr69B+x9DiIhAUvPxvsfvfsX8TZDap 53 | GBnkzYAwzPTIk+59KcRK5kTT8AuWqV/nk5gr/okIBGKc/GX4l8kxK9jFKlC4GPPh 54 | -----END RSA PRIVATE KEY----- 55 | -------------------------------------------------------------------------------- /tests/ca/server.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIFxTCCA60CAQEwDQYJKoZIhvcNAQEFBQAwgaIxCzAJBgNVBAYTAlVTMRMwEQYD 3 | VQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMQ4wDAYDVQQK 4 | EwVWaXJnbzEQMA4GA1UECxMHSGFja2VyczEYMBYGA1UEAxMPQnJhbmRvbiBQaGls 5 | aXBzMSowKAYJKoZIhvcNAQkBFhticmFuZG9uLnBoaWxpcHNAZXhhbXBsZS5jb20w 6 | HhcNMTIwMTI2MjIwMjI0WhcNMjIwMTIzMjIwMjI0WjCBrTELMAkGA1UEBhMCVVMx 7 | EzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xGjAY 8 | BgNVBAoTEVZpcmdvIFRlc3QgU2lnbmVyMQ8wDQYDVQQLEwZIYWNrZXIxGDAWBgNV 9 | BAMTD0JyYW5kb24gUGhpbGlwczEqMCgGCSqGSIb3DQEJARYbYnJhbmRvbi5waGls 10 | aXBzQGV4YW1wbGUuY29tMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA 11 | 0Py2Gaq9lsxS7gN4UoF17iV9fI/NW+tgtfgjLqDrNpyvFqlBchhKVeoA2wdaRWpH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ylF/ 28 | mGHQcR4AmVYsr26UkDYXcwb7BDxH0eb3w5s7X0hwtFzd8jwx3Vagdf4fafm4Vahz 29 | XDiDXVMTZqyncIBu4/8PFfgqgLra/MhHODbLamndPMeHAn0zNXk5HEkiNRhHymSe 30 | oTKkB4Ol10/kEWvOswU/LS69w7HDFgJAnnEi2+XCTHMim8kDcbhoGr2rlL1cT7yL 31 | B3P11S3lepH+PFTFfU19IlrDGfXDxlKNWR9XNVqtQw/qnN+T7XZFW2tuDiMecCYj 32 | 64Qm7mwOJZDp1eFU0GiTuF7r7ZMBWTDDe98eOFOOiUZ3m+m43SGVb+U= 33 | -----END CERTIFICATE----- 34 | -------------------------------------------------------------------------------- /tests/ca/server.csr: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE REQUEST----- 2 | MIIE8zCCAtsCAQAwga0xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlh 3 | MRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMRowGAYDVQQKExFWaXJnbyBUZXN0IFNp 4 | Z25lcjEPMA0GA1UECxMGSGFja2VyMRgwFgYDVQQDEw9CcmFuZG9uIFBoaWxpcHMx 5 | KjAoBgkqhkiG9w0BCQEWG2JyYW5kb24ucGhpbGlwc0BleGFtcGxlLmNvbTCCAiIw 6 | DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAND8thmqvZbMUu4DeFKBde4lfXyP 7 | zVvrYLX4Iy6g6zacrxapQXIYSlXqANsHWkVqR7gz1i58FEDUWLuGFS7gLf99qBvQ 8 | GM4ARIzTCxnQGqhhkpfBwnZ10IdoSQ9uFkWtTnXI/qNZCKFCouQZJQWXfh80xI24 9 | py1GYAgGMaIWiAvMi7GRsuhM9+aQLuF6JD/RzMVTPbWTeh8ByP/4Ir2JCr+0emvY 10 | mNHyyB8JhKHOMlcO8zbQasyy1B0ToywqqryKImZJ+2eJN9PNFgg9UNIULdEirH/g 11 | wgxkt82hORHslb3wVXpas9r+JBczX/tJRAONdVJzxDJH2bfsdhsK9lADm2oPetae 12 | OgWvkIIn0KclzUN2wmqajIIX0s+jx3hmHhTzVkCs1SzUEo5zwXNItIfgHJABSUc2 13 | F1mbIdSatkwr04sPtSK5tZvS7br/lvOYb4S7gdQGN67pzC0DdHkNIL425HCgiraa 14 | CsuKx7VU4svvIcy9c2lmLtwZ8uwYD4inIojG6O05A81lV9ISH43ICQM1aICwtf01 15 | REJKCJqJgL8zxl0KWy5V/ON47lXgQksHZAQI45TKCchnL+sHzvdbZBvD1sVIz0EH 16 | CQq/P1UqCtdI3VI60KHG97vrndu5/+nkGTqb8LG5+at5q9vs1CKJ//ZPA24DxIZO 17 | p6wquazegO3gnHcDAgMBAAGgADANBgkqhkiG9w0BAQUFAAOCAgEAuVh+WHyD0ED+ 18 | a5K+fyIXOjAPoYM/IyiCyGREkn5+6LENGEu5EhXVgyph6uxgJTn4UpUypJrMMFRq 19 | ESNe0nuAd6NgXBU0aF5973lGpLP8kVtSlESEmXHHlMf8y5eOGTO4L+QKgCkMedzP 20 | rrFb6GweerdxRZMiFcReF6A93cupApdKVMZZ2/p4vo5mgjq/54KZR8/5pnbjNZhW 21 | ZgVxQvpKvzbDCMYlraK6O7yX0ftE0076TQqK0v91ceue1evZE/BaYZsM+mVF9PiL 22 | SrrkhwCMfusp1N2pS5K24z29a/MvBbKpTB0jFVgijbfKKD+0/e3OlSJJxGhflTBU 23 | 93xHXuYK5/FbgDEYURGwsbsUqOTIpsekzqS3Q0FgcpolB3phDb5D8HaUfvnScEup 24 | fplMZDU5rZl3281z3+abV4oArD+X9mnIiKWSt5AKoYoiQtynPPEGQoWcQSi02kfz 25 | ny88TPQpaiJ4g03JoxLCkH2R12uETazKqPYJIqhZ0pfYnEDVoE1luIfa5b47fAWd 26 | v7gmanoJn6NziDmJD0rVu131y4+bbRgd/2aPsVBhpP8qrbvc6GbLp4JvmwSfYEg9 27 | EcO9hYCe1CVUTVwvH0mNhYSQtknvnOWOj8nGPcScBJVXl7Dt74WgmWGzuWya8fzs 28 | DvfNYR414sCH+SNdMRv1tFsdFTguqSE= 29 | -----END CERTIFICATE REQUEST----- 30 | -------------------------------------------------------------------------------- /tests/ca/server.key: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | Proc-Type: 4,ENCRYPTED 3 | DEK-Info: DES-EDE3-CBC,6EBAB18EB50B0A06 4 | 5 | AvgdAHuOBXl/miVfDitR8kmmMEervaHr+8kAUO/fGnd1QVAFfI1dGrB3wx0XWoFs 6 | RePw3ydehMq56PLCUOZOdVYeMVVJf8dXqfdwRGj+40mlYtJ0Y+6pef/WlYUDT2kq 7 | VWsH6IU3J0K5cLu3lg4kRAraQGHXjPn+4m1cTZNKHT2V39E2JO8L5IfGQxOvfd2i 8 | ueZJb8h3zH9PgHPoETsy9iO3ndyeYVhcxNbG31vPDulL8XXyG0yCmbjji4Yh5mN4 9 | faqClQ0/rc9T1PMBN8HsQk+fQ61/qHS3rJV28ZZCUueUdJJzsNIOWfZ2W53aXxAP 10 | fvdGG6uOJAXuVDeBc/JGFyDsperC95YRplo83v4tk1TTVOy5nwqWCj4q2Hm+BRXE 11 | w8csH4lE4YfdmI9h/WqwjzQ4KdFyS8SKrPsUOWbG11pSAoLk2LaEkKw2n2p/Akbj 12 | cST/Jux9uw3Vpnqo/5TI+3TUx/tQ+AIwwCkDhHHAFoPbs1J+l6dvVfJfKAwB8ad8 13 | teMEnsjT+HWsTPdFY2LPddCimM+E7aP/btQS7jeTtIYfPlEOrK+pao0cx/DXgC8d 14 | J/yIw6UXbYKopyf16bB+3H6n1Q7Bv33GfK8DXKUctIPqXWll8VNjSmpsaylmBu56 15 | 6KkpjOXSgH2TW4C/78CfWhYflxuHM72w+PU3jyPrr49Ot0nf91kpoW0oastRCm4o 16 | YRejX6DpyrUcLMxswh4epAOGUfJk/3lE/9qoODhf42AAbglzCZz/nV2NMQ4znpb3 17 | XGgjZJTR3Ti4xFDkjl5y2RVksZSyoWrdYchKzWO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4h3C 49 | oaY+vK92xw8ZvL7pQnMIVVJ3rXaZm7dMwLkjGfu3UeoJrcwvA7OD3RcP8jLJ8yMO 50 | 6l9TfChzZ3YfwXA9N/yw5NhjtFkySkMsOyl5T6CM0NsXssj0OcArriFHiXybESnN 51 | uw0+3EEl4mtNlX8qAjTiyp+Su7pVyUfcMJajlR5wW2MfbA7v6CIY6fmxaa8IUYWB 52 | bEUNVjEQVgP6WHVudjj5n3x/dQUd0/GEB2y+fPLLDsC4WSPbY+LBs5ROeZz3BzDY 53 | EDeef3K2uB8SDLlm4AOj5U2uEEX5YItip4fiKhu018kSohqPH7bGbwb+yqS9OamH 54 | -----END RSA PRIVATE KEY----- 55 | -------------------------------------------------------------------------------- /tests/ca/server.key.insecure: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIIJKgIBAAKCAgEA0Py2Gaq9lsxS7gN4UoF17iV9fI/NW+tgtfgjLqDrNpyvFqlB 3 | chhKVeoA2wdaRWpHuDPWLnwUQNRYu4YVLuAt/32oG9AYzgBEjNMLGdAaqGGSl8HC 4 | dnXQh2hJD24WRa1Odcj+o1kIoUKi5BklBZd+HzTEjbinLUZgCAYxohaIC8yLsZGy 5 | 6Ez35pAu4XokP9HMxVM9tZN6HwHI//givYkKv7R6a9iY0fLIHwmEoc4yVw7zNtBq 6 | zLLUHROjLCqqvIoiZkn7Z4k3080WCD1Q0hQt0SKsf+DCDGS3zaE5EeyVvfBVelqz 7 | 2v4kFzNf+0lEA411UnPEMkfZt+x2Gwr2UAObag961p46Ba+QgifQpyXNQ3bCapqM 8 | ghfSz6PHeGYeFPNWQKzVLNQSjnPBc0i0h+AckAFJRzYXWZsh1Jq2TCvTiw+1Irm1 9 | m9Ltuv+W85hvhLuB1AY3runMLQN0eQ0gvjbkcKCKtpoKy4rHtVTiy+8hzL1zaWYu 10 | 3Bny7BgPiKciiMbo7TkDzWVX0hIfjcgJAzVogLC1/TVEQkoImomAvzPGXQpbLlX8 11 | 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dPtxx8SpLaONHvN5bGP4Bm3zqgYrKHvngjk 43 | pb9lkzYWg3oaq0d8SOjUFxmK2oBxk69F8s6A5tbAdb3cub0nAsR83htItR1eGrEE 44 | T4pTzTwVvd9SGt/15iIeMSzozzr7RzM3ZtYZ44vVbpix1jag+oscpfQytLonNOD9 45 | unPkCKhaAjqT0GO7BDOiW0SuHqhKtjzn0QKCAQEAzLosOEP19mROR18AYHoNJgKB 46 | Y53B+k04A/9Jq3YeUi2P0i+Wmb0zq3H1rh36Tichmsb3wl5KyWl8simPmNKGNqTO 47 | 1NpbC5cWlXiKTkEwUg2FWgrmaxn+T/OZ4LLQSAgxhcHD6DvFJW2s2BhsGg8ZecEN 48 | 1vqhp3GOFlDIyPC18RYOGn5HGn2wgeHz9cBSeLXnKKT9sZYZE/E5h8bsGgS+FYo7 49 | LmZsWupNr4nPjQZL/83EV2SwElYhgp5cBUdTfs96GY7BNXQTTU6a+2zym+yjiPlH 50 | 0DQ1pdnwDEyNPLz+keu0smAfeCFsCk4x5sCthwlAV6ussxoWvbXscr0qJGDT5w== 51 | -----END RSA PRIVATE KEY----- 52 | -------------------------------------------------------------------------------- /tests/encrypt.lua: -------------------------------------------------------------------------------- 1 | function tohex(s) 2 | return (s:gsub('.', function (c) return string.format("%02x", string.byte(c)) end)) 3 | end 4 | function hexprint(s) 5 | print(crypto.hex(s)) 6 | end 7 | 8 | crypto = require 'crypto' 9 | 10 | -- TESTING HEX 11 | 12 | local tst = 'abcd' 13 | assert(crypto.hex, "missing crypto.hex") 14 | local actual = crypto.hex(tst) 15 | local expected = tohex(tst) 16 | assert(actual == expected, "different hex results") 17 | 18 | -- TESTING ENCRYPT 19 | 20 | assert(crypto.encrypt, "missing crypto.encrypt") 21 | 22 | local cipher = 'aes128' 23 | local text = 'Hello world!' 24 | local key = 'abcd' 25 | local iv = '1234' 26 | 27 | local res = assert(crypto.encrypt(cipher, text, key, iv)) 28 | assert(type(res) == "string", "wrong result type, expecting string") 29 | assert(#res % 16 == 0, "unexpected result size") -- aes128 block size is 16bytes 30 | assert(crypto.hex(res) == "9bac9a71dd600824706096852e7282df", "unexpected result") 31 | 32 | local res2 = crypto.encrypt(cipher, text, key, iv) 33 | assert(res == res2, "the results are different!") 34 | 35 | assert(crypto.encrypt.new, "missing crypto.encrypt.new") 36 | local ctx = crypto.encrypt.new(cipher, key, iv) 37 | local p1 = ctx:update(text) 38 | local p2 = ctx:final() 39 | local res3 = p1 .. p2 40 | assert(res == res3, "constructed result is different from direct") 41 | 42 | -- TESTING DECRYPT 43 | 44 | assert(crypto.decrypt, "missing crypto.decrypt") 45 | 46 | local dec = crypto.decrypt(cipher, res, key, iv) 47 | assert(dec == text, "different direct result") 48 | 49 | print(dec) 50 | 51 | assert(crypto.decrypt.new, "missing crypto.decrypt.new") 52 | 53 | local ctx = crypto.decrypt.new(cipher, key, iv) 54 | local p1 = ctx:update(res) 55 | local p2 = ctx:final() 56 | local dec2 = p1 .. p2 57 | 58 | assert(dec2 == text, "different partial result") 59 | 60 | -- Testing errors when decrypting 61 | local ctx, err = crypto.decrypt("aes128", res, key.."improper key", iv) 62 | assert(not ctx and err, "should have failed") 63 | 64 | -- wrong iv, will result in garbage 65 | local ctx, err = crypto.decrypt("aes128", res, key, iv .. "foo") 66 | assert(ctx ~= text, "should have failed") 67 | 68 | local ctx, err = crypto.decrypt("aes128", res .. "foo", key, iv) 69 | assert(not ctx and err, "should have failed") 70 | 71 | -- don't crash on an invalid iv 72 | local ok, ctx, err = pcall(crypto.decrypt, "aes128", res, key, iv .. "123456123456123456") 73 | assert(not ok and ctx, "should have failed") 74 | local ok, ctx = pcall(crypto.decrypt.new, "aes128", key, iv .. "123456123456123456") 75 | assert(not ok and ctx, "should have failed") 76 | 77 | -- don't crash on an invalid key 78 | local ok, ctx, err = pcall(crypto.decrypt, "aes128", res, string.rep(key, 100), iv) 79 | assert(not ok and ctx, "should have failed") 80 | local ok, ctx = pcall(crypto.decrypt.new, "aes128", string.rep(key, 100), iv) 81 | assert(not ok and ctx, "should have failed") 82 | 83 | 84 | -- Testing errors when encrypting 85 | 86 | -- don't crash on an invalid iv 87 | local ok, res, err = pcall(crypto.encrypt, "aes128", text, key, iv .. "123456123456123456") 88 | assert(not ok and res) 89 | local ok, res, err = pcall(crypto.encrypt.new, "aes128", key, iv .. "123456123456123456") 90 | assert(not ok and res) 91 | 92 | -- don't crash on an invalid key 93 | local ok, res, err = pcall(crypto.encrypt, "aes128", text, string.rep(key, 100), iv) 94 | assert(not ok and res) 95 | local ok, res, err = pcall(crypto.encrypt.new, "aes128", string.rep(key, 100), iv) 96 | assert(not ok and res) 97 | 98 | local res = crypto.decrypt("aes128", crypto.encrypt("aes128", "", key, iv), key, iv) 99 | assert(res == "") -------------------------------------------------------------------------------- /tests/message: -------------------------------------------------------------------------------- 1 | This is a sample message to use for hashing tests. 2 | -------------------------------------------------------------------------------- /tests/open_seal.lua: -------------------------------------------------------------------------------- 1 | crypto = require 'crypto' 2 | 3 | assert(crypto.pkey, "crypto.pkey is unavaliable") 4 | 5 | k = crypto.pkey.generate('rsa', 1024) 6 | assert(k, "no key generated") 7 | 8 | k:write('pub.pem', 'priv.pem') 9 | 10 | kpub = assert(crypto.pkey.read('pub.pem')) 11 | kpriv = assert(crypto.pkey.read('priv.pem', true)) 12 | 13 | assert(crypto.open, "crypto.open is unavaliable") 14 | assert(crypto.seal, "crypto.seal is unavaliable") 15 | 16 | message = string.rep('This message will be signed', 122) 17 | 18 | data, ek, iv = assert(crypto.seal("aes128", message, kpub)) 19 | 20 | assert(crypto.open("aes128", data, kpriv, ek, iv) == message) 21 | 22 | local ctx = crypto.seal.new("aes128", kpub) 23 | local p1 = ctx:update(message) 24 | local p2, ek_2, iv_2 = ctx:final() 25 | assert(crypto.open("aes128", p1..p2, kpriv, ek_2, iv_2) == message) 26 | 27 | local ctx = crypto.open.new("aes128", kpriv, ek_2, iv_2) 28 | p3 = ctx:update(p1..p2) 29 | p4 = ctx:final() 30 | assert(message == (p3 .. p4)) 31 | 32 | print("OK") 33 | -------------------------------------------------------------------------------- /tests/pkeytest.lua: -------------------------------------------------------------------------------- 1 | crypto = require 'crypto' 2 | 3 | assert(crypto.pkey, "crypto.pkey is unavaliable") 4 | 5 | local RSA_PUBLIC_KEY = [[ 6 | -----BEGIN PUBLIC KEY----- 7 | MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDAIy7sjJXo3ePWF1PZ81DelW1E 8 | 4VphWD+VPBzT8oCYY9dViJ4lszW/t5LX0IYAm+veuJyF5ffkAeeOWvI7vCg+5s3b 9 | l9QqXgU8izuiXD0W6Wfm0YUU9VLGiFWnyTHpvZwqhnqmSEFCqPh+bWshCn/J5pZa 10 | g8GOfgG42UgCrxnNWwIDAQAB 11 | -----END PUBLIC KEY----- 12 | ]] 13 | 14 | local RSA_PRIV_KEY = [[ 15 | -----BEGIN RSA PRIVATE KEY----- 16 | MIICWwIBAAKBgQDAIy7sjJXo3ePWF1PZ81DelW1E4VphWD+VPBzT8oCYY9dViJ4l 17 | szW/t5LX0IYAm+veuJyF5ffkAeeOWvI7vCg+5s3bl9QqXgU8izuiXD0W6Wfm0YUU 18 | 9VLGiFWnyTHpvZwqhnqmSEFCqPh+bWshCn/J5pZag8GOfgG42UgCrxnNWwIDAQAB 19 | AoGAa2R++trNg75adbTOOnlEj1ToIWLwWI6x42EZH+JgvEy59GYLNzlG5qTd3+D+ 20 | tWJxYSjA3BqhBwGFgs0UrgzKVPwKbj1nbX0w91PmfdyGEutN84xRtZWkdMBiFacV 21 | Hy8Y0rvw/xmlf39xkv1n8whtb7sKxZjxRwVWpSU2i5ovQ5kCQQD98agvwLRoJQ3e 22 | AkuIpSNHfk9lRkr2A0ZHJjRRYOWN+xl/bShxMKCSrlzHqmIEd8wIkgXkWFSCDO4M 23 | WcE3G2y3AkEAwbFr6SFQHqh48hO8Lq040S8y+wVZrH7DIwYM3Ckc7JnurFQP9B6U 24 | 2BOPsLuCNoWeMJOwyJiIXwd4KT7XvzAIfQJAbNAJ0zxtkVqfUIwHNawdK9tRxgGS 25 | yUup537VWDF+65G24UUy2R2PEIsqMlwt1+BFSz7Wy3uV6owDzMMA6c4UjQJAJC/V 26 | jVSf91paXj+5pK7QMqSyzZsOSd/U7TIwLOGxebK4mJGL+XvNKyFccxRVG4KTL1go 27 | axG0SKzIkkwfWqTKsQJAf58QgbmGIwDwQgk2StWuulY9HhGpd73JySPyTKR2Lmpe 28 | wDJiqtOCnY3hEss2co97U/vzL+Cic4hXT3gGAQiDwQ== 29 | -----END RSA PRIVATE KEY----- 30 | ]] 31 | 32 | function test_verify(kpub, kpriv) 33 | assert(crypto.sign, "crypto.sign is unavaliable") 34 | assert(crypto.verify, "crypto.verify is unavaliable") 35 | 36 | message = 'This message will be signed' 37 | 38 | sig = assert(crypto.sign('md5', message, kpriv)) 39 | verified = crypto.verify('md5', message, sig, kpub) 40 | assert(verified, "message not verified") 41 | 42 | nverified = crypto.verify('md5', message..'x', sig, kpub) 43 | assert(not nverified, "message verified, when it shouldn't be") 44 | 45 | print("OK") 46 | end 47 | 48 | kpub = assert(crypto.pkey.from_pem(RSA_PUBLIC_KEY)) 49 | kpriv = assert(crypto.pkey.from_pem(RSA_PRIV_KEY, true)) 50 | 51 | assert(kpub:to_pem() == RSA_PUBLIC_KEY) 52 | assert(kpriv:to_pem(true) == RSA_PRIV_KEY) 53 | 54 | test_verify(kpub, kpriv) 55 | 56 | k = crypto.pkey.generate('rsa', 1024) 57 | assert(k, "no key generated") 58 | 59 | k:write('pub.pem', 'priv.pem') 60 | 61 | kpub = assert(crypto.pkey.read('pub.pem')) 62 | kpriv = assert(crypto.pkey.read('priv.pem', true)) 63 | 64 | test_verify(kpub, kpriv) 65 | -------------------------------------------------------------------------------- /tests/rand.lua: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/lua50 2 | 3 | --[[ 4 | -- $Id: rand.lua,v 1.1 2006/08/25 03:24:17 nezroy Exp $ 5 | -- See Copyright Notice in license.html 6 | --]] 7 | 8 | crypto = require "crypto" 9 | local rand = crypto.rand 10 | 11 | print("RAND version: " .. crypto._VERSION) 12 | print("") 13 | 14 | local SEEDFILE = "tmp.rnd" 15 | 16 | if rand.load(SEEDFILE) then 17 | print("loaded previous random seed") 18 | end 19 | 20 | if rand.status() then 21 | print("ready to generate") 22 | print("") 23 | else 24 | print("The PRNG does not yet have enough data.") 25 | local prompt = "Please type some random characters and press ENTER: " 26 | repeat 27 | io.write(prompt); io.flush() 28 | local line = io.read("*l") 29 | -- entropy of English is 1.1 bits per character 30 | rand.add(line, string.len(line) * 1.1 / 8) 31 | prompt = "More: " 32 | until rand.status() 33 | end 34 | 35 | local N = 20 36 | local S = 5 37 | 38 | print(string.format("generating %d sets of %d random bytes using pseudo_bytes()", S, N)) 39 | for i = 1, S do 40 | local data = assert(rand.pseudo_bytes(N)) 41 | print(table.concat({string.byte(data, 1, N)}, ",")) 42 | end 43 | print("") 44 | 45 | print(string.format("generating %d sets of %d random bytes using bytes()", S, N)) 46 | for i = 1, S do 47 | local data = assert(rand.bytes(N)) 48 | print(table.concat({string.byte(data, 1, N)}, ",")) 49 | end 50 | print("") 51 | 52 | print("saving seed in " .. SEEDFILE) 53 | print("") 54 | rand.write(SEEDFILE) 55 | 56 | -- don't leave any sensitive data lying around in memory 57 | print("cleaning up state") 58 | print("") 59 | rand.cleanup() 60 | -------------------------------------------------------------------------------- /tests/run-tests: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | DIR=`dirname $0` 4 | 5 | for i in $DIR/*.lua; do 6 | echo "Running: $i" 7 | lua $i 8 | if [ $? -ne 0 ]; then 9 | echo "ERROR: $i failed" 10 | exit 1 11 | fi 12 | done 13 | -------------------------------------------------------------------------------- /tests/test.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | -- $Id: test.lua,v 1.3 2006/08/25 03:24:17 nezroy Exp $ 3 | -- See Copyright Notice in license.html 4 | --]] 5 | 6 | crypto = require("crypto") 7 | 8 | local digest = crypto.digest 9 | local hmac = crypto.hmac 10 | 11 | md5_KNOWN = "09920f6f666f8e7b09a8d00bd4d06873" 12 | sha1_KNOWN = "d6ed6e26ebeb37ba0792ec75a3d0b4dcec279d25" 13 | hmac_KNOWN = "70a7ea81a287d094c534cdd67be82e85066e13be" 14 | 15 | print("LuaCrypto version: " .. crypto._VERSION) 16 | print("") 17 | 18 | function report(w, s, F, t) 19 | print(w, s .. " " .. F) 20 | assert(s == _G[t .. "_KNOWN"]) 21 | end 22 | 23 | F = arg[1] or 'message' 24 | for i, t in ipairs({"sha1", "md5", "sha1", "hmac"}) do 25 | print("testing " .. t) 26 | local d 27 | if (t == "hmac") then 28 | d = hmac.new("sha1", "luacrypto") 29 | else 30 | d = digest.new(t) 31 | end 32 | 33 | assert(io.input(F)) 34 | report("all", d:final(io.read("*all")), F, t) 35 | 36 | d:reset(d) 37 | 38 | assert(io.input(F)) 39 | while true do 40 | local c = io.read(1) 41 | if c == nil then break end 42 | d:update(c) 43 | end 44 | report("loop", d:final(), F, t) 45 | if (t ~= "hmac") then 46 | report("again", d:final(), F, t) 47 | assert(io.input(F)) 48 | report("alone", digest(t, io.read("*all")), F, t) 49 | else 50 | assert(io.input(F)) 51 | report("alone", hmac.digest("sha1", io.read("*all"), "luacrypto"), F, t); 52 | end 53 | 54 | assert(io.input(F)) 55 | d:reset() 56 | while true do 57 | local c = io.read(math.random(1, 16)) 58 | if c == nil then break end 59 | d:update(c) 60 | end 61 | report("reset", d:final(d), F, t) 62 | report("known", _G[t .. "_KNOWN"], F, t) 63 | print("") 64 | end 65 | 66 | print("all tests passed") 67 | -------------------------------------------------------------------------------- /tests/tmp.rnd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkottman/luacrypto/8c3f7f0caf023fe327f9e60391fc80df2d08a169/tests/tmp.rnd -------------------------------------------------------------------------------- /tests/x509_ca.lua: -------------------------------------------------------------------------------- 1 | crypto = require 'crypto' 2 | 3 | assert(crypto.x509_ca, "crypto.x509_ca is unavaliable") 4 | 5 | local ca_cert = [[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qR+47+3UKZ56H7cJufSQ 37 | wNAAWu3CagAXCmQaIKX2C8PS5FxnKymXSZTUVQ55NBcNRrYEfF0+ba6xW9ehSD5N 38 | G2C5FjA7z8eV+FjTDJPBVLZrwutDpyciGT4mpH6ul8rMFTxJuNjzCMT278CEgy5l 39 | IYrjS9B16k/wDfSxtDWyy6laaRnvf7vI+mTTUxZJZVd7ADeW9+Fxx/fddBsFuONw 40 | d81hvMemWe0uz/9SZyb0bmq+ox4zvzS2N05us3vIcZNaIrsG6baVFiTA6js503K5 41 | KjXgcfC980pnPG37oH41aaAHZEpTGgkpVp92dsHlwkrOjtZO2Tt+c4IUiflkPEvt 42 | QKI92udYACbXW5hT8jwyOo/ugwFMMpNmLvM= 43 | -----END CERTIFICATE-----]] 44 | 45 | local cert_to_verify = [[-----BEGIN CERTIFICATE----- 46 | MIIFxTCCA60CAQEwDQYJKoZIhvcNAQEFBQAwgaIxCzAJBgNVBAYTAlVTMRMwEQYD 47 | VQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMQ4wDAYDVQQK 48 | EwVWaXJnbzEQMA4GA1UECxMHSGFja2VyczEYMBYGA1UEAxMPQnJhbmRvbiBQaGls 49 | aXBzMSowKAYJKoZIhvcNAQkBFhticmFuZG9uLnBoaWxpcHNAZXhhbXBsZS5jb20w 50 | HhcNMTIwMTI2MjIwMjI0WhcNMjIwMTIzMjIwMjI0WjCBrTELMAkGA1UEBhMCVVMx 51 | EzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xGjAY 52 | BgNVBAoTEVZpcmdvIFRlc3QgU2lnbmVyMQ8wDQYDVQQLEwZIYWNrZXIxGDAWBgNV 53 | BAMTD0JyYW5kb24gUGhpbGlwczEqMCgGCSqGSIb3DQEJARYbYnJhbmRvbi5waGls 54 | aXBzQGV4YW1wbGUuY29tMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA 55 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ql67DQj 71 | 7epQTQ5wVty1ED5PyfHYOlC0LNlUNmoADegUwyYcQ4246ayfqcnJxacQXIpWylF/ 72 | mGHQcR4AmVYsr26UkDYXcwb7BDxH0eb3w5s7X0hwtFzd8jwx3Vagdf4fafm4Vahz 73 | XDiDXVMTZqyncIBu4/8PFfgqgLra/MhHODbLamndPMeHAn0zNXk5HEkiNRhHymSe 74 | oTKkB4Ol10/kEWvOswU/LS69w7HDFgJAnnEi2+XCTHMim8kDcbhoGr2rlL1cT7yL 75 | B3P11S3lepH+PFTFfU19IlrDGfXDxlKNWR9XNVqtQw/qnN+T7XZFW2tuDiMecCYj 76 | 64Qm7mwOJZDp1eFU0GiTuF7r7ZMBWTDDe98eOFOOiUZ3m+m43SGVb+U= 77 | -----END CERTIFICATE-----]] 78 | 79 | local bad_cert = [[-----BEGIN CERTIFICATE----- 80 | MIIFxTCCA60CAQEwDQYJKoZIhvcNAQEFBQAwgaIxCzAJBgNVBAYTAlVTMRMwEQYD 81 | VQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNpc2NvMQ4wDAYDVQQK 82 | EwVWaXJnbzEQMA4GA1UECxMHSGFja2VyczEYMBYGA1UEAxMPQnJhbmRvbiBQaGls 83 | aXBzMSowKAYJKoZIhvcNAQkBFhticmFuZG9uLnBoaWxpcHNAZXhhbXBsZS5jb20w 84 | HhcNMTIwMTI2MjIwMjI0WhcNMjIwMTIzMjIwMjI0WjCBrTELMAkGA1UEBhMCVVMx 85 | EzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lzY28xGjAY 86 | BgNVBAoTEVZpcmdvIFRlc3QgU2lnbmVyMQ8wDQYDVQQLEwZIYWNrZXIxGDAWBgNV 87 | BAMTD0JyYW5kb24gUGhpbGlwczEqMCgGCSqGSIb3DQEJARYbYnJhbmRvbi5waGls 88 | aXBzQGV4YW1wbGUuY29tMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC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3PJavNQCW+8ql67DQj 105 | 7epQTQ5wVty1ED5PyfHYOlC0LNlUNmoADegUwyYcQ4246ayfqcnJxacQXIpWylF/ 106 | mGHQcR4AmVYsr26UkDYXcwb7BDxH0eb3w5s7X0hwtFzd8jwx3Vagdf4fafm4Vahz 107 | XDiDXVMTZqyncIBu4/8PFfgqgLra/MhHODbLamndPMeHAn0zNXk5HEkiNRhHymSe 108 | oTKkB4Ol10/kEWvOswU/LS69w7HDFgJAnnEi2+XCTHMim8kDcbhoGr3rlL1cT7yL 109 | B3P11S3lepH+PFTFfU19IlrDGfXDxlKNWR9XNVqtQw/qnN+T7XZFW2tuDiMecCYj 110 | 64Qm7mwOJZDp1eFU0GiTuF7r7ZMBWTDDe98eOFOOiUZ3m+m43SGVb+U= 111 | -----END CERTIFICATE-----]] 112 | 113 | 114 | ca = assert(crypto.x509_ca()) 115 | 116 | ca:add_pem(ca_cert) 117 | assert(ca:add_pem("FOBAR") == nil, "bad cert succeeded") 118 | 119 | assert(ca:verify_pem(cert_to_verify) == true, "failed to verify good cert") 120 | assert(ca:verify_pem(bad_cert) == false, "verified bad cert, noooooo") 121 | print("OK x509_ca") 122 | --------------------------------------------------------------------------------