[PATCH] rsaenh: Fix length of some algorithm names in aProvEnumAlgsEx array.

Michael Stefaniuc mstefani at winehq.org
Thu Oct 5 12:24:51 CDT 2017


Hello Alex,

On 10/05/2017 09:15 AM, Alex Henrie wrote:
> From: Louis Lenders <xerox.xerox2000x at gmail.com>
> 
> Patch from Wine Staging.
> 
> Signed-off-by: Louis Lenders <xerox.xerox2000x at gmail.com>
> Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
> ---
>  dlls/rsaenh/rsaenh.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/dlls/rsaenh/rsaenh.c b/dlls/rsaenh/rsaenh.c
> index 3db828638b..97eb474374 100644
> --- a/dlls/rsaenh/rsaenh.c
> +++ b/dlls/rsaenh/rsaenh.c
> @@ -246,9 +246,9 @@ static const PROV_ENUMALGS_EX aProvEnumAlgsEx[5][RSAENH_MAX_ENUMALGS+1] =
> -  {CALG_SHA_256,  256,256,  256,CRYPT_FLAG_SIGNING,   6,"SHA-256", 30,"Secure Hash Algorithm (SHA-256)"},
> -  {CALG_SHA_384,  384,384,  384,CRYPT_FLAG_SIGNING,   6,"SHA-384", 30,"Secure Hash Algorithm (SHA-384)"},
> -  {CALG_SHA_512,  512,512,  512,CRYPT_FLAG_SIGNING,   6,"SHA-512", 30,"Secure Hash Algorithm (SHA-512)"},
> +  {CALG_SHA_256,  256,256,  256,CRYPT_FLAG_SIGNING,   8,"SHA-256", 32,"Secure Hash Algorithm (SHA-256)"},
> +  {CALG_SHA_384,  384,384,  384,CRYPT_FLAG_SIGNING,   8,"SHA-384", 32,"Secure Hash Algorithm (SHA-384)"},
> +  {CALG_SHA_512,  512,512,  512,CRYPT_FLAG_SIGNING,   8,"SHA-512", 32,"Secure Hash Algorithm (SHA-512)"},

why don't you switch the whole big structure to automatically calculate
the string sizes? Something like:

#define X(str) sizeof(str), str
...

{CALG_SHA_256,  256,256,  256,CRYPT_FLAG_SIGNING,   X("SHA-256"),
X("Secure Hash Algorithm (SHA-256)")},
...
#undef X

The less the programmer can fat finger the merrier, especially in
security related code.

bye
        michael



More information about the wine-devel mailing list