winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
March 2017
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
717 discussions
Start a n
N
ew thread
Matteo Bruni : ddraw: Keep a ddraw object reference in d3d7 vertex buffers.
by Alexandre Julliard
09 Mar '17
09 Mar '17
Module: wine Branch: master Commit: 2568fd2e0091d7f74d4ab4765b4bd229f4969fbd URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2568fd2e0091d7f74d4ab4765…
Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Wed Mar 8 20:45:44 2017 +0100 ddraw: Keep a ddraw object reference in d3d7 vertex buffers. Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ddraw/vertexbuffer.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/dlls/ddraw/vertexbuffer.c b/dlls/ddraw/vertexbuffer.c index 515c86e..07f1257 100644 --- a/dlls/ddraw/vertexbuffer.c +++ b/dlls/ddraw/vertexbuffer.c @@ -81,25 +81,27 @@ static ULONG WINAPI d3d_vertex_buffer7_Release(IDirect3DVertexBuffer7 *iface) TRACE("%p decreasing refcount to %u.\n", buffer, ref); - if (ref == 0) + if (!ref) { - struct wined3d_buffer *curVB = NULL; + struct wined3d_buffer *vb = NULL; UINT offset, stride; - /* D3D7 Vertex buffers don't stay bound in the device, they are passed - * as a parameter to drawPrimitiveVB. DrawPrimitiveVB sets them as the - * stream source in wined3d, and they should get unset there before + /* D3D7 vertex buffers don't stay bound in the device, they are passed + * as a parameter to DrawPrimitiveVB. DrawPrimitiveVB sets them as the + * stream source in wined3d and they should get unset there before * they are destroyed. */ wined3d_mutex_lock(); - wined3d_device_get_stream_source(buffer->ddraw->wined3d_device, - 0, &curVB, &offset, &stride); - if (curVB == buffer->wined3d_buffer) + wined3d_device_get_stream_source(buffer->ddraw->wined3d_device, 0, &vb, &offset, &stride); + if (vb == buffer->wined3d_buffer) wined3d_device_set_stream_source(buffer->ddraw->wined3d_device, 0, NULL, 0, 0); wined3d_vertex_declaration_decref(buffer->wined3d_declaration); wined3d_buffer_decref(buffer->wined3d_buffer); wined3d_mutex_unlock(); + if (buffer->version == 7) + IDirectDraw7_Release(&buffer->ddraw->IDirectDraw7_iface); + HeapFree(GetProcessHeap(), 0, buffer); } @@ -451,7 +453,8 @@ HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **vertex_buf, buffer->IDirect3DVertexBuffer7_iface.lpVtbl = &d3d_vertex_buffer7_vtbl; buffer->ref = 1; buffer->version = ddraw->d3dversion; - + if (buffer->version == 7) + IDirectDraw7_AddRef(&ddraw->IDirectDraw7_iface); buffer->ddraw = ddraw; buffer->Caps = desc->dwCaps; buffer->fvf = desc->dwFVF;
1
0
0
0
Stefan Dösinger : ddraw/tests: Rewrite SrcColorKey32BlitTest.
by Alexandre Julliard
09 Mar '17
09 Mar '17
Module: wine Branch: master Commit: c3521cd6739924c645f0ca7e954b97a4702091e9 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=c3521cd6739924c645f0ca7e9…
Author: Stefan Dösinger <stefandoesinger(a)gmx.at> Date: Wed Mar 8 19:29:00 2017 +0000 ddraw/tests: Rewrite SrcColorKey32BlitTest. Signed-off-by: Stefan Dösinger <stefandoesinger(a)gmx.at> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ddraw/surface.c | 6 + dlls/ddraw/tests/ddraw1.c | 482 +++++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw2.c | 496 ++++++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw4.c | 468 ++++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/ddraw7.c | 468 ++++++++++++++++++++++++++++++++++++++++ dlls/ddraw/tests/dsurface.c | 510 -------------------------------------------- 6 files changed, 1920 insertions(+), 510 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=c3521cd6739924c645f0c…
1
0
0
0
Alexandre Julliard : gdi32/tests: Remove workarounds for old Windows versions in the DIB tests.
by Alexandre Julliard
09 Mar '17
09 Mar '17
Module: wine Branch: master Commit: 57aa60689d87c57467e856d0ca628611797ffb24 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=57aa60689d87c57467e856d0c…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 9 13:28:32 2017 +0100 gdi32/tests: Remove workarounds for old Windows versions in the DIB tests. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/tests/dib.c | 302 +++++++------------------------------------------ 1 file changed, 43 insertions(+), 259 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=57aa60689d87c57467e85…
1
0
0
0
Alexandre Julliard : gdi32: Map the black and white entries to the DIB color table after dithering.
by Alexandre Julliard
09 Mar '17
09 Mar '17
Module: wine Branch: master Commit: 059170208af8c822e812dc1e58d60c3c5f1c7ebb URL:
http://source.winehq.org/git/wine.git/?a=commit;h=059170208af8c822e812dc1e5…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Thu Mar 9 12:30:20 2017 +0100 gdi32: Map the black and white entries to the DIB color table after dithering. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdi32/dibdrv/primitives.c | 14 +++++++++----- dlls/gdi32/tests/dib.c | 4 ++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/dlls/gdi32/dibdrv/primitives.c b/dlls/gdi32/dibdrv/primitives.c index e740ef8..a99fcab 100644 --- a/dlls/gdi32/dibdrv/primitives.c +++ b/dlls/gdi32/dibdrv/primitives.c @@ -2141,12 +2141,16 @@ static DWORD rgb_to_pixel_mono(const dib_info *dib, BOOL dither, int x, int y, { DWORD ret; - if (dither) - ret = ((30 * r + 59 * g + 11 * b) / 100 + bayer_16x16[y % 16][x % 16]) > 255; - else if (dib->color_table_size == 1) - ret = (src_pixel == bg_pixel); - else + if (dib->color_table_size != 1) + { + if (dither) + { + if (((30 * r + 59 * g + 11 * b) / 100 + bayer_16x16[y % 16][x % 16]) > 255) r = g = b = 255; + else r = g = b = 0; + } ret = rgb_to_pixel_colortable( dib, r, g, b ); + } + else ret = (src_pixel == bg_pixel); /* only match raw pixel value */ return ret ? 0xff : 0; } diff --git a/dlls/gdi32/tests/dib.c b/dlls/gdi32/tests/dib.c index 188001e..4bf64aa 100644 --- a/dlls/gdi32/tests/dib.c +++ b/dlls/gdi32/tests/dib.c @@ -1880,7 +1880,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits) if (bmi->bmiHeader.biBitCount == 8 && bmi->bmiHeader.biClrUsed == 256) /* 8-bpp grayscale broken on NT4 */ compare_hash_broken_todo(hdc, bmi, bits, "bottom-up 8888 dib brush patblt", 1, FALSE); else - compare_hash_broken_todo(hdc, bmi, bits, "bottom-up 8888 dib brush patblt", dib_is_1bpp ? 2 : 0, dib_is_1bpp); + compare_hash_broken_todo(hdc, bmi, bits, "bottom-up 8888 dib brush patblt", dib_is_1bpp ? 2 : 0, FALSE); SelectObject(hdc, orig_brush); DeleteObject(dib_brush); @@ -1910,7 +1910,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits) if (bmi->bmiHeader.biBitCount == 8 && bmi->bmiHeader.biClrUsed == 256) /* 8-bpp grayscale broken on NT4 */ compare_hash_broken_todo(hdc, bmi, bits, "top-down 24 bpp brush patblt", 1, FALSE); else - compare_hash_broken_todo(hdc, bmi, bits, "top-down 24 bpp brush patblt", dib_is_1bpp ? 2 : 0, dib_is_1bpp); + compare_hash_broken_todo(hdc, bmi, bits, "top-down 24 bpp brush patblt", dib_is_1bpp ? 2 : 0, FALSE); SelectObject(hdc, orig_brush); DeleteObject(dib_brush);
1
0
0
0
Henri Verbeet : wined3d: Don't read modifiers for opcodes with " read_opcode_func" set (AFL).
by Alexandre Julliard
09 Mar '17
09 Mar '17
Module: wine Branch: master Commit: 11fb78d9bde296fbd1731ab2e0c857c3874583e1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=11fb78d9bde296fbd1731ab2e…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Mar 9 10:37:05 2017 +0100 wined3d: Don't read modifiers for opcodes with "read_opcode_func" set (AFL). Otherwise "len" would be inconsistent with "p". This assumes opcodes with "read_opcode_func" either don't have modifiers or handle them themselves. Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/shader_sm4.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c index 8986d35..ef68754 100644 --- a/dlls/wined3d/shader_sm4.c +++ b/dlls/wined3d/shader_sm4.c @@ -1570,10 +1570,6 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi p = *ptr; *ptr += len; - previous_token = opcode_token; - while (previous_token & WINED3D_SM4_INSTRUCTION_MODIFIER) - shader_sm4_read_instruction_modifier(previous_token = *p++, ins); - if (opcode_info->read_opcode_func) { opcode_info->read_opcode_func(ins, opcode, opcode_token, p, len, priv); @@ -1582,6 +1578,10 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi { enum wined3d_shader_dst_modifier instruction_dst_modifier = WINED3DSPDM_NONE; + previous_token = opcode_token; + while (previous_token & WINED3D_SM4_INSTRUCTION_MODIFIER && p != *ptr) + shader_sm4_read_instruction_modifier(previous_token = *p++, ins); + ins->flags = (opcode_token & WINED3D_SM4_INSTRUCTION_FLAGS_MASK) >> WINED3D_SM4_INSTRUCTION_FLAGS_SHIFT; if (ins->flags & WINED3D_SM4_INSTRUCTION_FLAG_SATURATE)
1
0
0
0
Henri Verbeet : wined3d: Validate instruction lengths in shader_sm4_read_instruction() (AFL).
by Alexandre Julliard
09 Mar '17
09 Mar '17
Module: wine Branch: master Commit: a9e5a02a20a2b11edf0949c5bb1c4dd6c5297644 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a9e5a02a20a2b11edf0949c5b…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Mar 9 10:37:04 2017 +0100 wined3d: Validate instruction lengths in shader_sm4_read_instruction() (AFL). Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/shader_sm4.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/dlls/wined3d/shader_sm4.c b/dlls/wined3d/shader_sm4.c index bd974a2..8986d35 100644 --- a/dlls/wined3d/shader_sm4.c +++ b/dlls/wined3d/shader_sm4.c @@ -1507,16 +1507,36 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi DWORD opcode_token, opcode, previous_token; struct wined3d_sm4_data *priv = data; unsigned int i, len; + SIZE_T remaining; const DWORD *p; list_move_head(&priv->src_free, &priv->src); + if (*ptr >= priv->end) + { + WARN("End of byte-code, failed to read opcode.\n"); + goto fail; + } + remaining = priv->end - *ptr; + opcode_token = *(*ptr)++; opcode = opcode_token & WINED3D_SM4_OPCODE_MASK; len = ((opcode_token & WINED3D_SM4_INSTRUCTION_LENGTH_MASK) >> WINED3D_SM4_INSTRUCTION_LENGTH_SHIFT); if (!len) + { + if (remaining < 2) + { + WARN("End of byte-code, failed to read length token.\n"); + goto fail; + } len = **ptr; + } + if (!len || remaining < len) + { + WARN("Read invalid length %u (remaining %lu).\n", len, remaining); + goto fail; + } --len; if (TRACE_ON(d3d_bytecode)) @@ -1589,6 +1609,13 @@ static void shader_sm4_read_instruction(void *data, const DWORD **ptr, struct wi } } } + + return; + +fail: + *ptr = priv->end; + ins->handler_idx = WINED3DSIH_TABLE_SIZE; + return; } static BOOL shader_sm4_is_end(void *data, const DWORD **ptr)
1
0
0
0
Michael Müller : bcrypt: Always use builtin hash implementation.
by Alexandre Julliard
09 Mar '17
09 Mar '17
Module: wine Branch: master Commit: fd05297f0033034fd203e441e958614b6d3f3011 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=fd05297f0033034fd203e441e…
Author: Michael Müller <michael(a)fds-team.de> Date: Tue Mar 7 23:17:10 2017 +0100 bcrypt: Always use builtin hash implementation. Signed-off-by: Michael Müller <michael(a)fds-team.de> Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/bcrypt/bcrypt_main.c | 172 ---------------------------------------------- 1 file changed, 172 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c index 7caac2f..cf4e3c6 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -55,9 +55,6 @@ MAKE_FUNCPTR(gnutls_global_deinit); MAKE_FUNCPTR(gnutls_global_init); MAKE_FUNCPTR(gnutls_global_set_log_function); MAKE_FUNCPTR(gnutls_global_set_log_level); -MAKE_FUNCPTR(gnutls_hash); -MAKE_FUNCPTR(gnutls_hash_deinit); -MAKE_FUNCPTR(gnutls_hash_init); MAKE_FUNCPTR(gnutls_perror); #undef MAKE_FUNCPTR @@ -87,9 +84,6 @@ static BOOL gnutls_initialize(void) LOAD_FUNCPTR(gnutls_global_init) LOAD_FUNCPTR(gnutls_global_set_log_function) LOAD_FUNCPTR(gnutls_global_set_log_level) - LOAD_FUNCPTR(gnutls_hash); - LOAD_FUNCPTR(gnutls_hash_deinit); - LOAD_FUNCPTR(gnutls_hash_init); LOAD_FUNCPTR(gnutls_perror) #undef LOAD_FUNCPTR @@ -277,171 +271,6 @@ NTSTATUS WINAPI BCryptGetFipsAlgorithmMode(BOOLEAN *enabled) return STATUS_SUCCESS; } -#ifdef HAVE_COMMONCRYPTO_COMMONDIGEST_H -struct hash_impl -{ - union - { - CC_MD5_CTX md5_ctx; - CC_SHA1_CTX sha1_ctx; - CC_SHA256_CTX sha256_ctx; - CC_SHA512_CTX sha512_ctx; - } u; -}; - -static NTSTATUS hash_init( struct hash_impl *hash, enum alg_id alg_id ) -{ - switch (alg_id) - { - case ALG_ID_MD5: - CC_MD5_Init( &hash->u.md5_ctx ); - break; - - case ALG_ID_SHA1: - CC_SHA1_Init( &hash->u.sha1_ctx ); - break; - - case ALG_ID_SHA256: - CC_SHA256_Init( &hash->u.sha256_ctx ); - break; - - case ALG_ID_SHA384: - CC_SHA384_Init( &hash->u.sha512_ctx ); - break; - - case ALG_ID_SHA512: - CC_SHA512_Init( &hash->u.sha512_ctx ); - break; - - default: - ERR( "unhandled id %u\n", alg_id ); - return STATUS_NOT_IMPLEMENTED; - } - return STATUS_SUCCESS; -} - -static NTSTATUS hash_update( struct hash_impl *hash, enum alg_id alg_id, - UCHAR *input, ULONG size ) -{ - switch (alg_id) - { - case ALG_ID_MD5: - CC_MD5_Update( &hash->u.md5_ctx, input, size ); - break; - - case ALG_ID_SHA1: - CC_SHA1_Update( &hash->u.sha1_ctx, input, size ); - break; - - case ALG_ID_SHA256: - CC_SHA256_Update( &hash->u.sha256_ctx, input, size ); - break; - - case ALG_ID_SHA384: - CC_SHA384_Update( &hash->u.sha512_ctx, input, size ); - break; - - case ALG_ID_SHA512: - CC_SHA512_Update( &hash->u.sha512_ctx, input, size ); - break; - - default: - ERR( "unhandled id %u\n", alg_id ); - return STATUS_NOT_IMPLEMENTED; - } - return STATUS_SUCCESS; -} - -static NTSTATUS hash_finish( struct hash_impl *hash, enum alg_id alg_id, - UCHAR *output, ULONG size ) -{ - switch (alg_id) - { - case ALG_ID_MD5: - CC_MD5_Final( output, &hash->u.md5_ctx ); - break; - - case ALG_ID_SHA1: - CC_SHA1_Final( output, &hash->u.sha1_ctx ); - break; - - case ALG_ID_SHA256: - CC_SHA256_Final( output, &hash->u.sha256_ctx ); - break; - - case ALG_ID_SHA384: - CC_SHA384_Final( output, &hash->u.sha512_ctx ); - break; - - case ALG_ID_SHA512: - CC_SHA512_Final( output, &hash->u.sha512_ctx ); - break; - - default: - ERR( "unhandled id %u\n", alg_id ); - break; - } - return STATUS_SUCCESS; -} - -#elif defined(HAVE_GNUTLS_HASH) -struct hash_impl -{ - gnutls_hash_hd_t hash_handle; -}; - -static NTSTATUS hash_init( struct hash_impl *hash, enum alg_id alg_id ) -{ - gnutls_digest_algorithm_t alg; - - if (!libgnutls_handle) return STATUS_INTERNAL_ERROR; - - switch (alg_id) - { - case ALG_ID_MD5: - alg = GNUTLS_DIG_MD5; - break; - - case ALG_ID_SHA1: - alg = GNUTLS_DIG_SHA1; - break; - - case ALG_ID_SHA256: - alg = GNUTLS_DIG_SHA256; - break; - - case ALG_ID_SHA384: - alg = GNUTLS_DIG_SHA384; - break; - - case ALG_ID_SHA512: - alg = GNUTLS_DIG_SHA512; - break; - - default: - ERR( "unhandled id %u\n", alg_id ); - return STATUS_NOT_IMPLEMENTED; - } - - if (pgnutls_hash_init( &hash->hash_handle, alg )) return STATUS_INTERNAL_ERROR; - return STATUS_SUCCESS; -} - -static NTSTATUS hash_update( struct hash_impl *hash, enum alg_id alg_id, - UCHAR *input, ULONG size ) -{ - if (pgnutls_hash( hash->hash_handle, input, size )) return STATUS_INTERNAL_ERROR; - return STATUS_SUCCESS; -} - -static NTSTATUS hash_finish( struct hash_impl *hash, enum alg_id alg_id, - UCHAR *output, ULONG size ) -{ - pgnutls_hash_deinit( hash->hash_handle, output ); - return STATUS_SUCCESS; -} - -#else struct hash_impl { union @@ -548,7 +377,6 @@ static NTSTATUS hash_finish( struct hash_impl *hash, enum alg_id alg_id, } return STATUS_SUCCESS; } -#endif struct hash {
1
0
0
0
Michael Müller : bcrypt: Add a builtin sha384/ sha512 implementation.
by Alexandre Julliard
09 Mar '17
09 Mar '17
Module: wine Branch: master Commit: b56ddad8b00f7a406dc072250d5774b9562c47f8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b56ddad8b00f7a406dc072250…
Author: Michael Müller <michael(a)fds-team.de> Date: Wed Mar 8 13:09:04 2017 +0100 bcrypt: Add a builtin sha384/sha512 implementation. Signed-off-by: Michael Müller <michael(a)fds-team.de> Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/bcrypt/Makefile.in | 3 +- dlls/bcrypt/bcrypt_internal.h | 15 +++ dlls/bcrypt/bcrypt_main.c | 25 +++++ dlls/bcrypt/sha512.c | 212 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 254 insertions(+), 1 deletion(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=b56ddad8b00f7a406dc07…
1
0
0
0
Michael Müller : bcrypt: Add a builtin sha256 implementation.
by Alexandre Julliard
09 Mar '17
09 Mar '17
Module: wine Branch: master Commit: f34bd5b174b01c23dd556beb462aa25a3d1fb93e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f34bd5b174b01c23dd556beb4…
Author: Michael Müller <michael(a)fds-team.de> Date: Tue Mar 7 23:15:08 2017 +0100 bcrypt: Add a builtin sha256 implementation. Signed-off-by: Michael Müller <michael(a)fds-team.de> Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/bcrypt/Makefile.in | 3 +- dlls/bcrypt/bcrypt_internal.h | 11 +++ dlls/bcrypt/bcrypt_main.c | 13 ++++ dlls/bcrypt/sha256.c | 169 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 195 insertions(+), 1 deletion(-) diff --git a/dlls/bcrypt/Makefile.in b/dlls/bcrypt/Makefile.in index ef9d7ea..c2322c8 100644 --- a/dlls/bcrypt/Makefile.in +++ b/dlls/bcrypt/Makefile.in @@ -4,6 +4,7 @@ IMPORTLIB = bcrypt EXTRAINCL = $(GNUTLS_CFLAGS) C_SRCS = \ - bcrypt_main.c + bcrypt_main.c \ + sha256.c RC_SRCS = version.rc diff --git a/dlls/bcrypt/bcrypt_internal.h b/dlls/bcrypt/bcrypt_internal.h index de6a37e..ef137e9 100644 --- a/dlls/bcrypt/bcrypt_internal.h +++ b/dlls/bcrypt/bcrypt_internal.h @@ -25,6 +25,17 @@ #include "windef.h" #include "winbase.h" +typedef struct +{ + ULONG64 len; + DWORD h[8]; + UCHAR buf[64]; +} SHA256_CTX; + +void sha256_init(SHA256_CTX *ctx) DECLSPEC_HIDDEN; +void sha256_update(SHA256_CTX *ctx, const UCHAR *buffer, ULONG len) DECLSPEC_HIDDEN; +void sha256_finalize(SHA256_CTX *ctx, UCHAR *buffer) DECLSPEC_HIDDEN; + /* Definitions from advapi32 */ typedef struct { diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c index cef2b1b..301f454 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -448,6 +448,7 @@ struct hash_impl { MD5_CTX md5; SHA_CTX sha1; + SHA256_CTX sha256; } u; }; @@ -463,6 +464,10 @@ static NTSTATUS hash_init( struct hash_impl *hash, enum alg_id alg_id ) A_SHAInit( &hash->u.sha1 ); break; + case ALG_ID_SHA256: + sha256_init( &hash->u.sha256 ); + break; + default: ERR( "unhandled id %u\n", alg_id ); return STATUS_NOT_IMPLEMENTED; @@ -483,6 +488,10 @@ static NTSTATUS hash_update( struct hash_impl *hash, enum alg_id alg_id, A_SHAUpdate( &hash->u.sha1, input, size ); break; + case ALG_ID_SHA256: + sha256_update( &hash->u.sha256, input, size ); + break; + default: ERR( "unhandled id %u\n", alg_id ); return STATUS_NOT_IMPLEMENTED; @@ -504,6 +513,10 @@ static NTSTATUS hash_finish( struct hash_impl *hash, enum alg_id alg_id, A_SHAFinal( &hash->u.sha1, (ULONG *)output ); break; + case ALG_ID_SHA256: + sha256_finalize( &hash->u.sha256, output ); + break; + default: ERR( "unhandled id %u\n", alg_id ); return STATUS_NOT_IMPLEMENTED; diff --git a/dlls/bcrypt/sha256.c b/dlls/bcrypt/sha256.c new file mode 100644 index 0000000..48c4a48 --- /dev/null +++ b/dlls/bcrypt/sha256.c @@ -0,0 +1,169 @@ +/* + * Copyright 2016 Michael Müller + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + * + */ + +/* Based on public domain implementation from +
https://git.musl-libc.org/cgit/musl/tree/src/crypt/crypt_sha256.c
*/ + +#include "bcrypt_internal.h" + +static DWORD ror(DWORD n, int k) { return (n >> k) | (n << (32-k)); } +#define Ch(x,y,z) (z ^ (x & (y ^ z))) +#define Maj(x,y,z) ((x & y) | (z & (x | y))) +#define S0(x) (ror(x,2) ^ ror(x,13) ^ ror(x,22)) +#define S1(x) (ror(x,6) ^ ror(x,11) ^ ror(x,25)) +#define R0(x) (ror(x,7) ^ ror(x,18) ^ (x>>3)) +#define R1(x) (ror(x,17) ^ ror(x,19) ^ (x>>10)) + +static const DWORD K[64] = +{ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +}; + +static void processblock(SHA256_CTX *ctx, const UCHAR *buffer) +{ + DWORD W[64], t1, t2, a, b, c, d, e, f, g, h; + int i; + + for (i = 0; i < 16; i++) + { + W[i] = (DWORD)buffer[4*i]<<24; + W[i] |= (DWORD)buffer[4*i+1]<<16; + W[i] |= (DWORD)buffer[4*i+2]<<8; + W[i] |= buffer[4*i+3]; + } + + for (; i < 64; i++) + W[i] = R1(W[i-2]) + W[i-7] + R0(W[i-15]) + W[i-16]; + + a = ctx->h[0]; + b = ctx->h[1]; + c = ctx->h[2]; + d = ctx->h[3]; + e = ctx->h[4]; + f = ctx->h[5]; + g = ctx->h[6]; + h = ctx->h[7]; + + for (i = 0; i < 64; i++) + { + t1 = h + S1(e) + Ch(e,f,g) + K[i] + W[i]; + t2 = S0(a) + Maj(a,b,c); + h = g; + g = f; + f = e; + e = d + t1; + d = c; + c = b; + b = a; + a = t1 + t2; + } + + ctx->h[0] += a; + ctx->h[1] += b; + ctx->h[2] += c; + ctx->h[3] += d; + ctx->h[4] += e; + ctx->h[5] += f; + ctx->h[6] += g; + ctx->h[7] += h; +} + +static void pad(SHA256_CTX *ctx) +{ + ULONG64 r = ctx->len % 64; + + ctx->buf[r++] = 0x80; + + if (r > 56) + { + memset(ctx->buf + r, 0, 64 - r); + r = 0; + processblock(ctx, ctx->buf); + } + + memset(ctx->buf + r, 0, 56 - r); + ctx->len *= 8; + ctx->buf[56] = ctx->len >> 56; + ctx->buf[57] = ctx->len >> 48; + ctx->buf[58] = ctx->len >> 40; + ctx->buf[59] = ctx->len >> 32; + ctx->buf[60] = ctx->len >> 24; + ctx->buf[61] = ctx->len >> 16; + ctx->buf[62] = ctx->len >> 8; + ctx->buf[63] = ctx->len; + + processblock(ctx, ctx->buf); +} + +void sha256_init(SHA256_CTX *ctx) +{ + ctx->len = 0; + ctx->h[0] = 0x6a09e667; + ctx->h[1] = 0xbb67ae85; + ctx->h[2] = 0x3c6ef372; + ctx->h[3] = 0xa54ff53a; + ctx->h[4] = 0x510e527f; + ctx->h[5] = 0x9b05688c; + ctx->h[6] = 0x1f83d9ab; + ctx->h[7] = 0x5be0cd19; +} + +void sha256_update(SHA256_CTX *ctx, const UCHAR *buffer, ULONG len) +{ + const UCHAR *p = buffer; + ULONG64 r = ctx->len % 64; + + ctx->len += len; + if (r) + { + if (len < 64 - r) + { + memcpy(ctx->buf + r, p, len); + return; + } + memcpy(ctx->buf + r, p, 64 - r); + len -= 64 - r; + p += 64 - r; + processblock(ctx, ctx->buf); + } + for (; len >= 64; len -= 64, p += 64) + processblock(ctx, p); + memcpy(ctx->buf, p, len); +} + +void sha256_finalize(SHA256_CTX *ctx, UCHAR *buffer) +{ + int i; + + pad(ctx); + for (i = 0; i < 8; i++) + { + buffer[4*i] = ctx->h[i] >> 24; + buffer[4*i+1] = ctx->h[i] >> 16; + buffer[4*i+2] = ctx->h[i] >> 8; + buffer[4*i+3] = ctx->h[i]; + } +}
1
0
0
0
Michael Müller : bcrypt: Use builtin MD5/ SHA1 implementation.
by Alexandre Julliard
09 Mar '17
09 Mar '17
Module: wine Branch: master Commit: 03630a42f4db194ca70192769fbf3ea3c3dccca5 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=03630a42f4db194ca70192769…
Author: Michael Müller <michael(a)fds-team.de> Date: Tue Mar 7 23:14:36 2017 +0100 bcrypt: Use builtin MD5/SHA1 implementation. Signed-off-by: Michael Müller <michael(a)fds-team.de> Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/bcrypt/bcrypt_internal.h | 53 ++++++++++++++++++++++++++++++++++++++ dlls/bcrypt/bcrypt_main.c | 60 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 106 insertions(+), 7 deletions(-) diff --git a/dlls/bcrypt/bcrypt_internal.h b/dlls/bcrypt/bcrypt_internal.h new file mode 100644 index 0000000..de6a37e --- /dev/null +++ b/dlls/bcrypt/bcrypt_internal.h @@ -0,0 +1,53 @@ +/* + * Copyright 2016 Michael Müller + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + * + */ + +#ifndef __BCRYPT_INTERNAL_H +#define __BCRYPT_INTERNAL_H + +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" + +/* Definitions from advapi32 */ +typedef struct +{ + unsigned int i[2]; + unsigned int buf[4]; + unsigned char in[64]; + unsigned char digest[16]; +} MD5_CTX; + +VOID WINAPI MD5Init(MD5_CTX *ctx); +VOID WINAPI MD5Update(MD5_CTX *ctx, const unsigned char *buf, unsigned int len); +VOID WINAPI MD5Final(MD5_CTX *ctx); + +typedef struct +{ + ULONG Unknown[6]; + ULONG State[5]; + ULONG Count[2]; + UCHAR Buffer[64]; +} SHA_CTX; + +VOID WINAPI A_SHAInit(SHA_CTX *ctx); +VOID WINAPI A_SHAUpdate(SHA_CTX *ctx, const UCHAR *buffer, UINT size); +VOID WINAPI A_SHAFinal(SHA_CTX *ctx, PULONG result); + +#endif /* __BCRYPT_INTERNAL_H */ diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c index 849dc3e..cef2b1b 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -36,6 +36,8 @@ #include "ntsecapi.h" #include "bcrypt.h" +#include "bcrypt_internal.h" + #include "wine/debug.h" #include "wine/library.h" #include "wine/unicode.h" @@ -442,27 +444,71 @@ static NTSTATUS hash_finish( struct hash_impl *hash, enum alg_id alg_id, #else struct hash_impl { - + union + { + MD5_CTX md5; + SHA_CTX sha1; + } u; }; static NTSTATUS hash_init( struct hash_impl *hash, enum alg_id alg_id ) { - ERR( "support for hashes not available at build time\n" ); - return STATUS_NOT_IMPLEMENTED; + switch (alg_id) + { + case ALG_ID_MD5: + MD5Init( &hash->u.md5 ); + break; + + case ALG_ID_SHA1: + A_SHAInit( &hash->u.sha1 ); + break; + + default: + ERR( "unhandled id %u\n", alg_id ); + return STATUS_NOT_IMPLEMENTED; + } + return STATUS_SUCCESS; } static NTSTATUS hash_update( struct hash_impl *hash, enum alg_id alg_id, UCHAR *input, ULONG size ) { - ERR( "support for hashes not available at build time\n" ); - return STATUS_NOT_IMPLEMENTED; + switch (alg_id) + { + case ALG_ID_MD5: + MD5Update( &hash->u.md5, input, size ); + break; + + case ALG_ID_SHA1: + A_SHAUpdate( &hash->u.sha1, input, size ); + break; + + default: + ERR( "unhandled id %u\n", alg_id ); + return STATUS_NOT_IMPLEMENTED; + } + return STATUS_SUCCESS; } static NTSTATUS hash_finish( struct hash_impl *hash, enum alg_id alg_id, UCHAR *output, ULONG size ) { - ERR( "support for hashes not available at build time\n" ); - return STATUS_NOT_IMPLEMENTED; + switch (alg_id) + { + case ALG_ID_MD5: + MD5Final( &hash->u.md5 ); + memcpy( output, hash->u.md5.digest, 16 ); + break; + + case ALG_ID_SHA1: + A_SHAFinal( &hash->u.sha1, (ULONG *)output ); + break; + + default: + ERR( "unhandled id %u\n", alg_id ); + return STATUS_NOT_IMPLEMENTED; + } + return STATUS_SUCCESS; } #endif
1
0
0
0
← Newer
1
...
49
50
51
52
53
54
55
...
72
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Results per page:
10
25
50
100
200