Code Monkey home page Code Monkey logo

Comments (7)

mheyman avatar mheyman commented on June 14, 2024

from isopoh.cryptography.argon2.

paulhickman avatar paulhickman commented on June 14, 2024

How about making it injectable:

  1. Declare an interface ISecureArray with the public methods of SecureArray
  2. Add a constructor for the Argon2 class that takes an Func<int,ISecureArray> factory function as an argument.
  3. Have the default constructor pass BestSecuryArray as the factory function.

That way, uses can replace SecureArray with their own implementation if there are issues on a particular platform, and you can inject a mock array in test functions if that helps.

from isopoh.cryptography.argon2.

mheyman avatar mheyman commented on June 14, 2024

from isopoh.cryptography.argon2.

mheyman avatar mheyman commented on June 14, 2024

I have added a SecureArrayCall class that holds the methods used by SecureArray to actually secure the array.

There is a SecureArray.DefaultCall property that will get populated with the basic calls for Windows/Linux/OSx. In a unit test, I create a SecureArrayCall that wraps calls in SecureArray.DefaultCall to track locks (and I found a situation where I didn't free a lock - fixed in 1.0.5).

The Argon2 calls (should) now all have an optional parameter so they can use a non-default SecureArrayCall to get non-default behavior.

from isopoh.cryptography.argon2.

thomasd3 avatar thomasd3 commented on June 14, 2024

Same message here:

Managed Debugging Assistant 'PInvokeStackImbalance' : 'A call to PInvoke function 'Isopoh.Cryptography.SecureArray!Isopoh.Cryptography.SecureArray.SecureArray::SetProcessWorkingSetSizeEx64' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.'

That's with .NET 4.7 "AnyCpu" on Windows Server 2016

from isopoh.cryptography.argon2.

mheyman avatar mheyman commented on June 14, 2024

I think I can get access to a WinServer 2016 VM. I'll see if I can reproduce this as soon as I can.

from isopoh.cryptography.argon2.

mheyman avatar mheyman commented on June 14, 2024

It was a bug! I had flipped 32/64-bit P/Invokes and I never hit it until I added a .Net Framework test (which I had removed a long time ago as painful to maintain). The testing here is woefully incomplete because of the multitude of platforms and configurations it theoretically runs on...

1.0.6 version at https://www.nuget.org/packages/Isopoh.Cryptography.Argon2/ has the fix.

from isopoh.cryptography.argon2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.