modernuo / Argon2.Bindings

Argon2 Bindings for .NET 7
5 stars 0 forks source link

Unable to find an entrypoint for decode_string in libargon2.dll #9

Open sombraguerrero opened 3 months ago

sombraguerrero commented 3 months ago

The following method fails because there seems to be a mismatch between the entry point names in Argon2.cs and the content of libargon2.dll in the 1.16.1 package.

[MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static unsafe Argon2Error Decode(Argon2Context ctx, ReadOnlySpan<byte> str, int type)
    {
        fixed (byte* p_str = str)
        {
            return decode_string(ctx, p_str, type);
        }
    }

%USERPROFILE%\.nuget\packages\argon2.bindings\1.16.1\runtimes\win-x64\native>dumpbin /exports libargon2.dll
Microsoft (R) COFF/PE Dumper Version 14.39.33523.0
Copyright (C) Microsoft Corporation.  All rights reserved.

Dump of file libargon2.dll

File Type: DLL

  Section contains the following exports for libargon2.dll

    00000000 characteristics
    FFFFFFFF time date stamp
        0.00 version
           1 ordinal base
          22 number of functions
          22 number of names

    ordinal hint RVA      name

          1    0 00001050 argon2_ctx
          2    1 00001D10 argon2_encodedlen
          3    2 00001B30 argon2_error_message
          4    3 00001370 argon2_hash
          5    4 00001000 argon2_type2string
          6    5 00001860 argon2_verify
          7    6 000019F0 argon2_verify_ctx
          8    7 000019C0 argon2d_ctx
          9    8 00001690 argon2d_hash_encoded
         10    9 00001700 argon2d_hash_raw
         11    A 000019A0 argon2d_verify
         12    B 00001B00 argon2d_verify_ctx
         13    C 000019D0 argon2i_ctx
         14    D 000015A0 argon2i_hash_encoded
         15    E 00001620 argon2i_hash_raw
         16    F 00001990 argon2i_verify
         17   10 00001B10 argon2i_verify_ctx
         18   11 000019E0 argon2id_ctx
         19   12 00001770 argon2id_hash_encoded
         20   13 000017F0 argon2id_hash_raw
         21   14 000019B0 argon2id_verify
         22   15 00001B20 argon2id_verify_ctx

  Summary

        2000 .data
        2000 .pdata
        B000 .rdata
        1000 .reloc
        1000 .rsrc
       14000 .text
        1000 _RDATA
kamronbatman commented 3 months ago

Thanks I'll look into this. We should be using that entry point in ModernUO, and it isn't failing at the moment, so this is very curious.

CORRECTION: We don't use it. Damn. Ok, I'll try to fix it. Others are also welcome to make a PR, thank you!

sombraguerrero commented 3 months ago

I should mention too that I am using Net 8 as opposed to 7, in case this is a versioning issue.

kamronbatman commented 3 months ago

Yeah, I'll update it soon..should work on 6+ with no issues.

sombraguerrero commented 3 months ago

Not urgent or anything. I created my own class to handle the metadata parsing in the meantime anyway, because other than this, everything else seems to still work perfectly. I appreciate your efforts in creating and maintaining these bindings!