lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


thanks. there was a patch for this(r66), may be it has missed this.

From: Valerio Schiavoni <valerio.schiavoni@gmail.com>
To: Lua list <lua@bazar2.conectiva.com.br>
Sent: Tue, June 8, 2010 12:22:12 PM
Subject: Re: lxyssl (AES binding), CFB en

Hello Gary,

finally, the problem is solved!

The problem is in the binding code, and its use of int types.
Using size_t resolves the bug.

I've opened an issue and attached a patch that fixes this problem.

http://code.google.com/p/luaxyssl/issues/detail?id=3

Maybe this can be used for the next release of the binding.

Best regards
Valerio

On Tue, Jun 8, 2010 at 3:47 PM, gary ng <garyng2000@yahoo.com> wrote:
I would suggest isolate the problem to see if it is the underlying xyssl or the interface. Just put some simple printf in the c wrapper after the encryption.

Another option is to check if the block mode works. I remeber I have implemented the cfb mode in pure lua using the more primitive block mode.

Unfortunately, I don't have a 64 bit machine to work with and cannot offer much help.


----- Original Message ----
> From: Valerio Schiavoni <valerio.schiavoni@gmail.com>
> To: Lua list <lua@bazar2.conectiva.com.br>
> Sent: Tue, June 8, 2010 6:34:31 AM
> Subject: Re: lxyssl (AES binding), CFB en
>
> I finally have an explanation of what it's going on here.

I've tested the
> code on several architectures:

Ubuntu 10.4 32bit
Ubuntu 10.4
> 64bit
Debian Lenny 32bit
Mac OSX 10.6.3 64bit

And the result is
> always the same: it works fine on 32bit machines, it
doesn't work (encryption
> returns empty string) on 64bit machines.

I guess to solve this problem
> some C hacking on the xyssl lib must be done?

On Tue, Jun 8, 2010 at
> 11:54 AM, Valerio Schiavoni
<> ymailto="mailto:valerio.schiavoni@gmail.com"
> href=""mailto:valerio.schiavoni@gmail.com" rel=nofollow target=_blank ymailto="mailto:valerio.schiavoni@gmail.com">valerio.schiavoni@gmail.com">valerio.schiavoni@gmail.com>
> wrote:
> Hello Gary,
> I reproduced your environment via a virtual
> machine. Installed lenny,
> lua 5.1.3, xyssl, lxyssl,and run.. and indeed,
> in this context, it
> works.
>
> What can be possibly be?
> Which are the differences between lua 5.1.3
> and 5.1.4 ??
>
>
> lua -llxyssl
> Lua 5.1.3  Copyright (C) 1994-2008 > href="">Lua.org, PUC-Rio
>>
> require"lxyssl"
>> key="abcdabcdabcdabcd"
>>
> iv=lxyssl.hash('md5'):digest(key)
>> print(iv)
>
> )%�,���������F
>> data="">>>
> e=lxyssl.aes(key):cfb_encrypt(data,iv)
>> print(#e)
>
> 8193
>> print(e)
> $�#Z_ ��Wj{V���y6���� ��:�j�
> d��L�������Y<�Hw�w���� ��)Mi]�ׯAA�7�+A ��
> ���{�W��(QP
>
>
>
> On Tue, Jun 8, 2010 at 12:34 AM,
> gary ng <> href=""mailto:garyng2000@yahoo.com" rel=nofollow target=_blank ymailto="mailto:garyng2000@yahoo.com">garyng2000@yahoo.com">garyng2000@yahoo.com>
> wrote:
>>
>> Which is why I said, I have no idea. The
> following were done under linux using lua 5.1.3 and the library has been in used
> for quite a while. I don't have 5.1.4 on this machine(it is a debian lenny) and
> don't have the time to redo it(compile lua then lxyssl etc.) from
> scratch.
>>
>> > require'security'
>> >
> data="">>> >
> k=security.hash.engine('md5'):digest('abcd')
>> > aes_cfb =
> security.crypto.engine('aes_cfb',k,k)
>> >
> e=aes_cfb:encrypt(data..'a')
>> > print(#e)
>>
> 8193
>>
>>
>>
>>
>>
>>
> From: Valerio Schiavoni <> href=""mailto:valerio.schiavoni@gmail.com" rel=nofollow target=_blank ymailto="mailto:valerio.schiavoni@gmail.com">valerio.schiavoni@gmail.com">valerio.schiavoni@gmail.com>
>>
> To: Lua list <> href=""mailto:lua@bazar2.conectiva.com.br" rel=nofollow target=_blank ymailto="mailto:lua@bazar2.conectiva.com.br">lua@bazar2.conectiva.com.br">lua@bazar2.conectiva.com.br>
>>
> Sent: Mon, June 7, 2010 3:24:25 PM
>> Subject: Re: lxyssl (AES
> binding), CFB en
>>
>> Well:
>> Lua 5.1.4  Copyright
> (C) 1994-2008 Lua.org, PUC-Rio
>> > require"security"
>>
> > data="">>> > k =
> security.hash.engine('md5'):digest('abcd')
>> > print(k)
>>
> ??qLG'?$?.3
>> > aes_cfb = security.crypto.engine('aes_cfb', k,
> k)
>> > e=aes_cfb:encrypt(data.."a")
>> >
> print(e)
>> > print(#e)
>> 0
>> I don't
> understand..
>>
>