From 6095fdcf15afb6c9da4fd123ad558a7abb9e2524 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Sun, 7 Dec 2014 16:33:51 +0000 Subject: Make GOST compile with a strict C compiler - in this case incrementing a void pointer is undefined and initialising an array with {} is a syntax error. Based on a diff from kinichiro inoguchi. --- src/lib/libcrypto/gost/gost2814789.c | 6 +++--- src/lib/libcrypto/gost/gostr341194.c | 5 +++-- src/lib/libcrypto/gost/streebog.c | 11 ++++++----- src/lib/libssl/src/crypto/gost/gost2814789.c | 6 +++--- src/lib/libssl/src/crypto/gost/gostr341194.c | 5 +++-- src/lib/libssl/src/crypto/gost/streebog.c | 11 ++++++----- 6 files changed, 24 insertions(+), 20 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/gost/gost2814789.c b/src/lib/libcrypto/gost/gost2814789.c index 1c11ddd93e..e1084cb4ac 100644 --- a/src/lib/libcrypto/gost/gost2814789.c +++ b/src/lib/libcrypto/gost/gost2814789.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gost2814789.c,v 1.2 2014/11/09 23:06:52 miod Exp $ */ +/* $OpenBSD: gost2814789.c,v 1.3 2014/12/07 16:33:51 jsing Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD @@ -416,8 +416,8 @@ GOST2814789IMIT_Init(GOST2814789IMIT_CTX *c, int nid) } static void -GOST2814789IMIT_block_data_order(GOST2814789IMIT_CTX *ctx, const void *p, - size_t num) +GOST2814789IMIT_block_data_order(GOST2814789IMIT_CTX *ctx, + const unsigned char *p, size_t num) { int i; diff --git a/src/lib/libcrypto/gost/gostr341194.c b/src/lib/libcrypto/gost/gostr341194.c index 3151d9fe12..34ca504bb2 100644 --- a/src/lib/libcrypto/gost/gostr341194.c +++ b/src/lib/libcrypto/gost/gostr341194.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gostr341194.c,v 1.2 2014/11/09 23:06:52 miod Exp $ */ +/* $OpenBSD: gostr341194.c,v 1.3 2014/12/07 16:33:51 jsing Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD @@ -207,7 +207,8 @@ GOSTR341194_Init(GOSTR341194_CTX *c, int nid) } static void -GOSTR341194_block_data_order(GOSTR341194_CTX *ctx, const void *p, size_t num) +GOSTR341194_block_data_order(GOSTR341194_CTX *ctx, const unsigned char *p, + size_t num) { int i; diff --git a/src/lib/libcrypto/gost/streebog.c b/src/lib/libcrypto/gost/streebog.c index 4e49201c2d..8060161d11 100644 --- a/src/lib/libcrypto/gost/streebog.c +++ b/src/lib/libcrypto/gost/streebog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: streebog.c,v 1.3 2014/12/07 16:07:56 miod Exp $ */ +/* $OpenBSD: streebog.c,v 1.4 2014/12/07 16:33:51 jsing Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD @@ -1269,7 +1269,8 @@ streebog_single_block(STREEBOG_CTX *ctx, const unsigned char *in, size_t num) static void -streebog_block_data_order(STREEBOG_CTX *ctx, const void *in, size_t num) +streebog_block_data_order(STREEBOG_CTX *ctx, const unsigned char *in, + size_t num) { int i; @@ -1280,12 +1281,12 @@ streebog_block_data_order(STREEBOG_CTX *ctx, const void *in, size_t num) int STREEBOG512_Final(unsigned char *md, STREEBOG_CTX *c) { - int n; unsigned char *p = (unsigned char *)c->data; - STREEBOG_LONG64 Z[STREEBOG_LBLOCK] = {}; + STREEBOG_LONG64 Z[STREEBOG_LBLOCK] = {0}; + int n; if (c->num == STREEBOG_CBLOCK) { - streebog_block_data_order(c, c->data, 1); + streebog_block_data_order(c, p, 1); c->num -= STREEBOG_CBLOCK; } diff --git a/src/lib/libssl/src/crypto/gost/gost2814789.c b/src/lib/libssl/src/crypto/gost/gost2814789.c index 1c11ddd93e..e1084cb4ac 100644 --- a/src/lib/libssl/src/crypto/gost/gost2814789.c +++ b/src/lib/libssl/src/crypto/gost/gost2814789.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gost2814789.c,v 1.2 2014/11/09 23:06:52 miod Exp $ */ +/* $OpenBSD: gost2814789.c,v 1.3 2014/12/07 16:33:51 jsing Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD @@ -416,8 +416,8 @@ GOST2814789IMIT_Init(GOST2814789IMIT_CTX *c, int nid) } static void -GOST2814789IMIT_block_data_order(GOST2814789IMIT_CTX *ctx, const void *p, - size_t num) +GOST2814789IMIT_block_data_order(GOST2814789IMIT_CTX *ctx, + const unsigned char *p, size_t num) { int i; diff --git a/src/lib/libssl/src/crypto/gost/gostr341194.c b/src/lib/libssl/src/crypto/gost/gostr341194.c index 3151d9fe12..34ca504bb2 100644 --- a/src/lib/libssl/src/crypto/gost/gostr341194.c +++ b/src/lib/libssl/src/crypto/gost/gostr341194.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gostr341194.c,v 1.2 2014/11/09 23:06:52 miod Exp $ */ +/* $OpenBSD: gostr341194.c,v 1.3 2014/12/07 16:33:51 jsing Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD @@ -207,7 +207,8 @@ GOSTR341194_Init(GOSTR341194_CTX *c, int nid) } static void -GOSTR341194_block_data_order(GOSTR341194_CTX *ctx, const void *p, size_t num) +GOSTR341194_block_data_order(GOSTR341194_CTX *ctx, const unsigned char *p, + size_t num) { int i; diff --git a/src/lib/libssl/src/crypto/gost/streebog.c b/src/lib/libssl/src/crypto/gost/streebog.c index 4e49201c2d..8060161d11 100644 --- a/src/lib/libssl/src/crypto/gost/streebog.c +++ b/src/lib/libssl/src/crypto/gost/streebog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: streebog.c,v 1.3 2014/12/07 16:07:56 miod Exp $ */ +/* $OpenBSD: streebog.c,v 1.4 2014/12/07 16:33:51 jsing Exp $ */ /* * Copyright (c) 2014 Dmitry Eremin-Solenikov * Copyright (c) 2005-2006 Cryptocom LTD @@ -1269,7 +1269,8 @@ streebog_single_block(STREEBOG_CTX *ctx, const unsigned char *in, size_t num) static void -streebog_block_data_order(STREEBOG_CTX *ctx, const void *in, size_t num) +streebog_block_data_order(STREEBOG_CTX *ctx, const unsigned char *in, + size_t num) { int i; @@ -1280,12 +1281,12 @@ streebog_block_data_order(STREEBOG_CTX *ctx, const void *in, size_t num) int STREEBOG512_Final(unsigned char *md, STREEBOG_CTX *c) { - int n; unsigned char *p = (unsigned char *)c->data; - STREEBOG_LONG64 Z[STREEBOG_LBLOCK] = {}; + STREEBOG_LONG64 Z[STREEBOG_LBLOCK] = {0}; + int n; if (c->num == STREEBOG_CBLOCK) { - streebog_block_data_order(c, c->data, 1); + streebog_block_data_order(c, p, 1); c->num -= STREEBOG_CBLOCK; } -- cgit v1.2.3-55-g6feb