mheyman / Isopoh.Cryptography.Argon2

Fully managed .Net Core implementation of Argon2
Other
196 stars 9 forks source link

Cannot load kernel32.dll #5

Closed vpham0 closed 6 years ago

vpham0 commented 7 years ago

Is there a way to convert SecureArray to be more linux friendly? Currently getting runtime exceptions when creating a new Argon2 object.

Specific function is VirtualLock within https://github.com/mheyman/Isopoh.Cryptography.Argon2/blob/master/Isopoh.Cryptography.SecureArray/SecureArray.cs as it is decorated with [DllImport("kernel32.dll")]. Suspecting the other two will give issue as well.

mheyman commented 7 years ago

Good idea. When I get time, I'll implement it. The calls will have to go to memset_s(), mlock(), and munlock(). I think these are all in libc. A quick try and I couldn't actually call memset_s() on Ubuntu Zesty - it doesn't seem to be available there using gcc-6.2 even though it has been standard since C11 came out. Hmm.

As an aside, I'm not actually convinced that calls like RtlZeroMemory() and memset_s() are required when P/Invoking - I don't think the CLR will optimize away a call to memset() but it may and that is why I used the secure option.