libsodium on LiveCode?

Monte Goulding monte at appisle.net
Mon Feb 19 17:09:11 EST 2018


It probably depends on how these are used as to what you want here, however, if all of these are data coming from LCS then I’d suggest you want your LCB handlers to take in Data and then use something like:

__safe foreign handler MCDataGetBytePtr(in pData as Data) returns Pointer binds to "<builtin>”
__safe foreign handler MCDataGetLength(in pData as Data) returns LCUIndex binds to "<builtin>"

public handler DoSomething(in pPK as Data)
    if MCDataGetLength(pPK) is not 32 then
       throw “PK not 32 bytes"
    end if 

    variable tPK as Pointer
    put MCDataGetBytePtr(pPK) into tPK
    libsodiumfunction(tPK)

Cheers

Monte

> On 19 Feb 2018, at 5:11 pm, Brian Milby via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Looks like most of the functions use OpenSSL.
> 
> 
> Started looking at the headers and there are over 650 function calls in
> libsodium. Got bogged down pretty fast though.
> 
> Trying to look at some type mappings and am a little confused on how to do
> the following:
> 
> unsigned char *pk
> const unsigned char *seed
> unsigned char pk[32]
> const unsigned char seed[32]
> 
> I know that the const means that it will be in only and the others are
> either inout or out. I’m really hoping that we don’t need to use
> “MCAggregateTypeInfo” followed by 32 “c” characters. (They don’t use
> numbers in the headers but rather #define values).
> On Sun, Feb 18, 2018 at 11:02 AM Mark Wieder via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> 
>> On 02/17/2018 10:53 AM, Brian Milby via use-livecode wrote:
>>> I found a thread from a year ago that mentions libsodium:
>>> 
>> http://runtime-revolution.278305.n4.nabble.com/SHA1-cracked-What-are-the-chances-this-will-be-addressed-in-LC-td4712554i20.html
>>> 
>>> I was wondering if anyone had taken a look at what it would take to build
>>> something usable within LiveCode?  My guess is that this is something
>> that
>>> could be addressed as a LCB library to hook into native compiled code for
>>> each platform.  The project itself looks to have make files for all of
>> the
>>> platforms of interest in this community.
>> 
>> Interesting - I thought we were already linked into libsodium, but I see
>> it's not in the thirdparty directory in the source code. At least not in
>> the foss version.
>> 
>> --
>>  Mark Wieder
>>  ahsoftware at gmail.com
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list