public EvpHashProvider(IntPtr algorithmEvp) { _algorithmEvp = algorithmEvp; Debug.Assert(algorithmEvp != IntPtr.Zero); _hashSize = Interop.Crypto.EvpMdSize(_algorithmEvp); if (_hashSize <= 0 || _hashSize > Interop.Crypto.EVP_MAX_MD_SIZE) { throw new CryptographicException(); } _ctx = Interop.Crypto.EvpMdCtxCreate(_algorithmEvp); Interop.libcrypto.CheckValidOpenSslHandle(_ctx); }
public EvpHashProvider(IntPtr algorithmEvp) { _algorithmEvp = algorithmEvp; Debug.Assert(algorithmEvp != IntPtr.Zero); _hashSize = Interop.libcrypto.EVP_MD_size(algorithmEvp); if (_hashSize <= 0 || _hashSize > Interop.libcrypto.EVP_MAX_MD_SIZE) { throw new CryptographicException(); } _ctx = Interop.libcrypto.EVP_MD_CTX_create(); Interop.libcrypto.CheckValidOpenSslHandle(_ctx); Check(Interop.libcrypto.EVP_DigestInit_ex(_ctx, algorithmEvp, IntPtr.Zero)); }
internal extern static unsafe int EvpDigestFinalEx(SafeEvpMdCtxHandle ctx, byte* md, ref uint s);
internal extern static unsafe int EvpDigestUpdate(SafeEvpMdCtxHandle ctx, byte* d, int cnt);
internal extern static int EvpDigestReset(SafeEvpMdCtxHandle ctx, IntPtr type);
internal extern static unsafe int EVP_DigestUpdate(SafeEvpMdCtxHandle ctx, byte* d, size_t cnt);
internal extern static int EVP_DigestInit_ex(SafeEvpMdCtxHandle ctx, IntPtr type, IntPtr impl);