1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
5 #ifndef MARVIN32_INCLUDED
6 #define MARVIN32_INCLUDED
13 // Pointer-const typedefs:
15 // These definitions are missing from the standard Windows declarations.
16 // Should probably be moved to a central typedef file.
18 typedef const BYTE * PCBYTE;
19 typedef const USHORT * PCUSHORT;
20 typedef const ULONG * PCULONG;
21 typedef const ULONGLONG * PCULONGLONG;
22 typedef const VOID * PCVOID;
30 #define SYMCRYPT_MARVIN32_RESULT_SIZE (8)
31 #define SYMCRYPT_MARVIN32_SEED_SIZE (8)
32 #define SYMCRYPT_MARVIN32_INPUT_BLOCK_SIZE (4)
34 // These macros only support little-endian machines with unaligned access
35 #define LOAD_LSBFIRST16( p ) ( *(USHORT *)(p))
36 #define LOAD_LSBFIRST32( p ) ( *(ULONG *)(p))
37 #define STORE_LSBFIRST32( p, x ) ( *(ULONG *)(p) = (x) )
39 // Disable the warning about padding the struct on amd64
41 #pragma warning(disable:4324)
43 typedef struct _SYMCRYPT_MARVIN32_EXPANDED_SEED
46 } SYMCRYPT_MARVIN32_EXPANDED_SEED, *PSYMCRYPT_MARVIN32_EXPANDED_SEED;
48 typedef SYMCRYPT_MARVIN32_EXPANDED_SEED SYMCRYPT_MARVIN32_CHAINING_STATE, *PSYMCRYPT_MARVIN32_CHAINING_STATE;
49 typedef const SYMCRYPT_MARVIN32_EXPANDED_SEED * PCSYMCRYPT_MARVIN32_EXPANDED_SEED;
51 typedef struct _SYMCRYPT_MARVIN32_STATE
53 BYTE buffer[8]; // 4 bytes of data, 4 more bytes for final padding
54 SYMCRYPT_MARVIN32_CHAINING_STATE chain; // chaining state
55 PCSYMCRYPT_MARVIN32_EXPANDED_SEED pSeed; //
56 ULONG dataLength; // length of the data processed so far, mod 2^32
57 } SYMCRYPT_MARVIN32_STATE, *PSYMCRYPT_MARVIN32_STATE;
58 typedef const SYMCRYPT_MARVIN32_STATE *PCSYMCRYPT_MARVIN32_STATE;
62 // Function declarations
64 HRESULT SymCryptMarvin32ExpandSeed(
65 __out PSYMCRYPT_MARVIN32_EXPANDED_SEED pExpandedSeed,
66 __in_ecount(cbSeed) PCBYTE pbSeed,
69 VOID SymCryptMarvin32Init(_Out_ PSYMCRYPT_MARVIN32_STATE pState,
70 _In_ PCSYMCRYPT_MARVIN32_EXPANDED_SEED pExpandedSeed);
72 VOID SymCryptMarvin32Result(
73 _Inout_ PSYMCRYPT_MARVIN32_STATE pState,
74 _Out_ PBYTE pbResult);
76 VOID SymCryptMarvin32Append(_Inout_ SYMCRYPT_MARVIN32_STATE * state,
77 _In_reads_bytes_(cbData) PCBYTE pbData,
80 VOID SymCryptMarvin32(
81 __in PCSYMCRYPT_MARVIN32_EXPANDED_SEED pExpandedSeed,
82 __in_ecount(cbData) PCBYTE pbData,
84 __out_ecount(SYMCRYPT_MARVIN32_RESULT_SIZE) PBYTE pbResult);
85 #endif // MARVIN32_INCLUDED