Hi Rémi, On 18/02/2021 10:39, Rémi Bernon wrote:
+/* SHA1 algorithm + * + * Based on public domain SHA code by Steve Reid<steve(a)edmweb.com> + */
A bit more adaptation of the code would be nice, bellow are a few suggestions.
+ +/****************************************************************************** + * A_SHAInit (ntdll.@)
It looks like a copy&paste typo. There are a few more 'ntdll's in the patch. (And as a side note, the whole comment does not feel more informative to me than the function name itself, especially if you renamed it to something like sha1_init).
+ * + * Initialize a SHA context structure. + * + * PARAMS + * Context [O] SHA context + * + * RETURNS + * Nothing + */
(...)
+} + +/****************************************************************************** + * A_SHAUpdate (ntdll.@) + * + * Update a SHA context with a hashed data from supplied buffer. + * + * PARAMS + * Context [O] SHA context + * Buffer [I] hashed data + * BufferSize [I] hashed data size + * + * RETURNS + * Nothing + */ +void A_SHAUpdate(SHA_CTX *Context, const unsigned char *Buffer, UINT BufferSize) +{ + ULONG BufferContentSize; + + BufferContentSize = Context->Count[1] & 63; + Context->Count[1] += BufferSize; + if (Context->Count[1] < BufferSize) + Context->Count[0]++; + Context->Count[0] += (BufferSize >> 29); + + if (BufferContentSize + BufferSize < 64) + { + RtlCopyMemory(&Context->Buffer[BufferContentSize], Buffer, + BufferSize);
memcpy() would be more consistent with the rest of widl. Thanks, Jacek