Hans Leidekker (@hans) commented about dlls/secur32/schannel.c:
+static void reverse_bytes(BYTE *buf, ULONG len) +{ + BYTE tmp; + ULONG i; + for (i = 0; i < len / 2; i++) + { + tmp = buf[i]; + buf[i] = buf[len - i - 1]; + buf[len - i - 1] = tmp; + } +} + +/* Convert BCRYPT_RSAKEY_BLOB (big-endian) to CAPI PRIVATEKEYBLOB (little-endian) */ +static BYTE *convert_bcrypt_to_capi(const BYTE *bcrypt_blob, DWORD bcrypt_size, DWORD *out_size) +{
CAPI is the old API. It would be better to change the Unix side to accept a BCrypt key blob and then convert from CAPI to BCrypt on the PE side. That also avoids conversion from big-endian to little-endian and back. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10561#note_135026