fast AES implementation ?

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

fast AES implementation ?

Valerio
Hello,
i'm looking for a fast AES implementation which provides Lua bindings. 

Suggestions ?


thanks,
valerio
Reply | Threaded
Open this post in threaded view
|

Re: fast AES implementation ?

Luiz Henrique de Figueiredo
> i'm looking for a fast AES implementation which provides Lua bindings.

OpenSSL seems to have one in openssl/aes.h, but I could not find any docs
on that. Binding to Lua should be simple.  Ask for help if you need.
Reply | Threaded
Open this post in threaded view
|

Re: fast AES implementation ?

Valerio
Hello,
i've tried the lxyssl bindings for xyssl which already provides AES, and I was able to compile and run them in Linux. 
Anyone has a working makefile of it for mac osx ?

Luiz, I think I will try at some point a native bindings to OpenSSL's AES.

On Sun, Apr 11, 2010 at 9:42 PM, Luiz Henrique de Figueiredo <[hidden email]> wrote:
> i'm looking for a fast AES implementation which provides Lua bindings.

OpenSSL seems to have one in openssl/aes.h, but I could not find any docs
on that. Binding to Lua should be simple.  Ask for help if you need.

Reply | Threaded
Open this post in threaded view
|

Re: fast AES implementation ?

Jerome Vuarand
2010/4/12 Valerio Schiavoni <[hidden email]>:
> Hello,
> i've tried the lxyssl bindings for xyssl which already provides AES, and I
> was able to compile and run them in Linux.
> Anyone has a working makefile of it for mac osx ?
> Luiz, I think I will try at some point a native bindings to OpenSSL's AES.

OpenSSL even has support for hardware-accelerated AES on some
platforms with such hardware (for example Via x86 CPUs).
Reply | Threaded
Open this post in threaded view
|

Re: fast AES implementation ?

dcharno
In reply to this post by Valerio
Valerio Schiavoni wrote:
> i'm looking for a fast AES implementation which provides Lua bindings.

I've used Luacrypto which provides a front-end for OpenSSL.

http://luacrypto.luaforge.net/

Reply | Threaded
Open this post in threaded view
|

Re: fast AES implementation ?

Valerio


On Mon, Apr 12, 2010 at 1:14 AM, dcharno <[hidden email]> wrote:
Valerio Schiavoni wrote:
i'm looking for a fast AES implementation which provides Lua bindings.

I've used Luacrypto which provides a front-end for OpenSSL.

http://luacrypto.luaforge.net/


I know it does, but not for AES:
Reply | Threaded
Open this post in threaded view
|

Re: fast AES implementation ?

gary ng
In reply to this post by Jerome Vuarand


--- On Mon, 4/12/10, Jerome Vuarand <[hidden email]> wrote:
> OpenSSL even has support for hardware-accelerated AES on
> some
> platforms with such hardware (for example Via x86 CPUs).
>

As far as I can remember, xyssl has special code for Via Padlock meaning it was using the hardware for these common function on Via platform.

Too bad the original author for some reasons all of a sudden disappeared. The continuation for that is polarssl.

To the OP: given that xyssl library is self-contained and requires nothing but standard C and is built with gcc, making it to work on Mac shouldn't be a difficult task.


     
Reply | Threaded
Open this post in threaded view
|

Re: fast AES implementation ?

dcharno
In reply to this post by Valerio
Valerio Schiavoni wrote:

>
>
> On Mon, Apr 12, 2010 at 1:14 AM, dcharno <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Valerio Schiavoni wrote:
>
>         i'm looking for a fast AES implementation which provides Lua
>         bindings.
>
>
>     I've used Luacrypto which provides a front-end for OpenSSL.
>
>     http://luacrypto.luaforge.net/
>
>
> I know it does, but not for AES:
> http://luacrypto.luaforge.net/manual.html#reference

That's right, Luacrypto only provides the hashes, not the ciphers.
Maybe that's an area for it to be enhanced.
Reply | Threaded
Open this post in threaded view
|

Re: fast AES implementation ?

Sam Roberts
In reply to this post by Valerio
On Sun, Apr 11, 2010 at 4:19 PM, Valerio Schiavoni
<[hidden email]> wrote:
>> I've used Luacrypto which provides a front-end for OpenSSL.
>> http://luacrypto.luaforge.net/
>
> I know it does, but not for AES:
> http://luacrypto.luaforge.net/manual.html#reference

Probably easy to add it. If you asked, the author might even do it for
you quickly.

Seems odd that neither it or luasec support the ciphers.

Sam
Reply | Threaded
Open this post in threaded view
|

Re: fast AES implementation ?

Valerio
Hi,

it's not very clear to me why LuaSec and LuaCrypto are 2 distinct projects infact.
A merge provide a richer library and a wider audience i believe.

Anyway, I sent an email to the author of luacrypto to ask for that.

Let's see.

On Mon, Apr 12, 2010 at 7:38 AM, Sam Roberts <[hidden email]> wrote:
On Sun, Apr 11, 2010 at 4:19 PM, Valerio Schiavoni
<[hidden email]> wrote:
>> I've used Luacrypto which provides a front-end for OpenSSL.
>> http://luacrypto.luaforge.net/
>
> I know it does, but not for AES:
> http://luacrypto.luaforge.net/manual.html#reference

Probably easy to add it. If you asked, the author might even do it for
you quickly.

Seems odd that neither it or luasec support the ciphers.

Sam

Reply | Threaded
Open this post in threaded view
|

Re: fast AES implementation ?

Jerome Vuarand
2010/4/12 Valerio Schiavoni <[hidden email]>:
> it's not very clear to me why LuaSec and LuaCrypto are 2 distinct projects
> infact.
> A merge provide a richer library and a wider audience i believe.

OpenSSL itself is split into two distinct libraries, libcrypto and
libssl, with different purposes. Apart from coordinating effort to use
the same data formats (for certificates and such things), I don't see
any reason to merge the bindings.
Reply | Threaded
Open this post in threaded view
|

Re: fast AES implementation ?

Michal Kottman
In reply to this post by Valerio
On Po, 2010-04-12 at 01:19 +0200, Valerio Schiavoni wrote:
> On Mon, Apr 12, 2010 at 1:14 AM, dcharno <[hidden email]> wrote:
>         Valerio Schiavoni wrote:
>                 i'm looking for a fast AES implementation which
>                 provides Lua bindings.

>         I've used Luacrypto which provides a front-end for OpenSSL.
>        
>         http://luacrypto.luaforge.net/
>        
> I know it does, but not for AES:
> http://luacrypto.luaforge.net/manual.html#reference

Hi,

I took the risk of duplicating someone's work and implemented the
encryption and decryption in LuaCrypto. The work-in-progress code can be
found at http://github.com/mkottman/luacrypto 

Please consider it beta quality, I've done a lot of copypasting within
the code, although the included test shows that it is capable of
encrypting "Hello world!" using AES and then decrypting it successfully.

I have partly updated the docs/reference, it is available at
http://mkottman.github.com/luacrypto/manual.html

I hope this will be useful to someone.

Michal

Reply | Threaded
Open this post in threaded view
|

Re: fast AES implementation ?

Luiz Henrique de Figueiredo
> I took the risk of duplicating someone's work and implemented the
> encryption and decryption in LuaCrypto.

Nice, thanks. I was hoping for a thiner binding of openssl/aes.h, even
if the OpenSSL documentation says one should use the EVP interface (like
you have).

Just one comment: it seems the original code was for Lua 5.0 because code like
this

 if (luaL_checkudata(L, i, LUACRYPTO_DIGESTNAME) == NULL) luaL_typerror(L, i, LUACRYPTO_DIGESTNAME);
 return lua_touserdata(L, i);

can be simplified in Lua 5.1 to

 return luaL_checkudata(L, i, LUACRYPTO_DIGESTNAME);

There are a few such instances in the code.
--lhf
Reply | Threaded
Open this post in threaded view
|

Re: fast AES implementation ?

Joshua Jensen
----- Original Message -----
From: Luiz Henrique de Figueiredo
Date: 4/15/2010 4:44 PM
> Nice, thanks. I was hoping for a thiner binding of openssl/aes.h, even
> if the OpenSSL documentation says one should use the EVP interface (like
> you have).
>    
I use this AES implementation... nice and small:
http://gladman.plushost.co.uk/oldsite/AES/index.php

Josh
Reply | Threaded
Open this post in threaded view
|

Re: fast AES implementation ?

Valerio
In reply to this post by Michal Kottman
Hello Michal,
thanks for the effort.

Trying to compile it on mac osx:

make
export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc -shared -O2 -Wall -fPIC -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -I/usr/include/openssl -I/Users/veleno/workspace/lua-5.1.4/  -llua5.1 -bundle -undefined dynamic_lookup  -o src/crypto.so src/lcrypto.o  -lcrypto -lssl
i686-apple-darwin10-gcc-4.2.1: -bundle not allowed with -dynamiclib
make: *** [src/crypto.so] Error 1


best regards,
valerio

On Fri, Apr 16, 2010 at 12:27 AM, Michal Kottman <[hidden email]> wrote:
On Po, 2010-04-12 at 01:19 +0200, Valerio Schiavoni wrote:
> On Mon, Apr 12, 2010 at 1:14 AM, dcharno <[hidden email]> wrote:
>         Valerio Schiavoni wrote:
>                 i'm looking for a fast AES implementation which
>                 provides Lua bindings.

>         I've used Luacrypto which provides a front-end for OpenSSL.
>
>         http://luacrypto.luaforge.net/
>
> I know it does, but not for AES:
> http://luacrypto.luaforge.net/manual.html#reference

Hi,

I took the risk of duplicating someone's work and implemented the
encryption and decryption in LuaCrypto. The work-in-progress code can be
found at http://github.com/mkottman/luacrypto

Please consider it beta quality, I've done a lot of copypasting within
the code, although the included test shows that it is capable of
encrypting "Hello world!" using AES and then decrypting it successfully.

I have partly updated the docs/reference, it is available at
http://mkottman.github.com/luacrypto/manual.html

I hope this will be useful to someone.

Michal


Reply | Threaded
Open this post in threaded view
|

Re: fast AES implementation ?

Luiz Henrique de Figueiredo
> export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc -shared -O2 -Wall -fPIC -W

Remove -shared.
Reply | Threaded
Open this post in threaded view
|

Re: fast AES implementation ?

Valerio
Hi,


On Fri, Apr 16, 2010 at 8:10 PM, Luiz Henrique de Figueiredo <[hidden email]> wrote:
> export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc -shared -O2 -Wall -fPIC -W
Remove -shared.

That didn't help, unfortunately:

make
gcc -O2 -Wall -fPIC -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -I/usr/include/openssl -I/Users/veleno/workspace/lua-5.1.4/  -llua5.1   -c -o src/lcrypto.o src/lcrypto.c
src/lcrypto.c: In function ‘rand_cleanup’:
src/lcrypto.c:659: warning: unused parameter ‘L’
i686-apple-darwin10-gcc-4.2.1: -llua5.1: linker input file unused because linking not done
export MACOSX_DEPLOYMENT_TARGET="10.3"; gcc -O2 -Wall -fPIC -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -I/usr/include/openssl -I/Users/veleno/workspace/lua-5.1.4/  -llua5.1 -bundle -undefined dynamic_lookup  -o src/crypto.so src/lcrypto.o  -lcrypto -lssl
ld: library not found for -llua5.1
collect2: ld returned 1 exit status
make: *** [src/crypto.so] Error 1

Reply | Threaded
Open this post in threaded view
|

Re: fast AES implementation ?

Luiz Henrique de Figueiredo
> -I/Users/veleno/workspace/lua-5.1.4/  -llua5.1 -bundle -undefined

remove -llua5.1