From 3c0eba16a91b41b7a16d5775af1c76e82599dd2d Mon Sep 17 00:00:00 2001 From: rkfg Date: Thu, 8 Nov 2018 11:09:12 +0300 Subject: [PATCH] Fix mod_inverse in managed openssl --- openssl-net-0.5/ManagedOpenSsl/Core/BigNumber.cs | 4 ++-- openssl-net-0.5/ManagedOpenSsl/Core/Native.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openssl-net-0.5/ManagedOpenSsl/Core/BigNumber.cs b/openssl-net-0.5/ManagedOpenSsl/Core/BigNumber.cs index a58076e..53c3ce2 100644 --- a/openssl-net-0.5/ManagedOpenSsl/Core/BigNumber.cs +++ b/openssl-net-0.5/ManagedOpenSsl/Core/BigNumber.cs @@ -268,7 +268,7 @@ public static BigNumber mod_inverse(BigNumber lhs, BigNumber rhs) BigNumber ret = new BigNumber(); Context ctx = new Context(); ctx.Start(); - Native.ExpectSuccess(Native.BN_mod_inverse(ret.Handle, lhs.Handle, rhs.Handle, ctx.Handle)); + Native.ExpectNonNull(Native.BN_mod_inverse(ret.Handle, lhs.Handle, rhs.Handle, ctx.Handle)); ctx.End(); return ret; } @@ -495,4 +495,4 @@ protected override void OnDispose() { } #endregion } -} \ No newline at end of file +} diff --git a/openssl-net-0.5/ManagedOpenSsl/Core/Native.cs b/openssl-net-0.5/ManagedOpenSsl/Core/Native.cs index d4b5f0c..86692c1 100644 --- a/openssl-net-0.5/ManagedOpenSsl/Core/Native.cs +++ b/openssl-net-0.5/ManagedOpenSsl/Core/Native.cs @@ -1104,7 +1104,7 @@ int DSA_generate_parameters_ex(IntPtr dsa, //[DllImport(DLLNAME, CallingConvention=CallingConvention.Cdecl)] //public extern static int BN_div(IntPtr rv, IntPtr rem, IntPtr m, IntPtr d, IntPtr ctx); [DllImport(DLLNAME, CallingConvention=CallingConvention.Cdecl)] - public extern static int BN_mod_inverse(IntPtr ret, IntPtr a, IntPtr c, IntPtr ctx); + public extern static IntPtr BN_mod_inverse(IntPtr ret, IntPtr a, IntPtr c, IntPtr ctx); [DllImport(DLLNAME, CallingConvention=CallingConvention.Cdecl)] public extern static int BN_gcd(IntPtr r, IntPtr a, IntPtr b, IntPtr ctx);