Re: libcrypto: explicitly initialize constant

2016-07-12 Thread Brent Cook
On Tue, Jul 12, 2016 at 6:41 AM, Miod Vallat  wrote:

> >> Noted by VS2013, const values should be initialized (though I think
> >> the 'static' should also implicitly zero).
> >
> > this sounds like the compiler doesn't know C?
>
> He is talking about Visual Studio. The C part of that piece of shit
> pretending to be a compiler only supports a subset of C89.
>
>
​Well, it's more of a C++ compiler pretending to be a C compiler :)

This is the only const in the LibreSSL tree that's not explicitly
initialized though, right or wrong.​ There are plenty more things it
complains about, if we wanted to mull over the full list. Possibly a few
bits of gold amongst the slag.


Re: libcrypto: explicitly initialize constant

2016-07-12 Thread Miod Vallat
>> Noted by VS2013, const values should be initialized (though I think
>> the 'static' should also implicitly zero).
>
> this sounds like the compiler doesn't know C?

He is talking about Visual Studio. The C part of that piece of shit
pretending to be a compiler only supports a subset of C89.



Re: libcrypto: explicitly initialize constant

2016-07-11 Thread Ted Unangst
Brent Cook wrote:
> Noted by VS2013, const values should be initialized (though I think
> the 'static' should also implicitly zero).

this sounds like the compiler doesn't know C?

> This also removes some unused code that also contained uninitialized
> static consts.

that part looks fine.



libcrypto: explicitly initialize constant

2016-07-11 Thread Brent Cook
Noted by VS2013, const values should be initialized (though I think
the 'static' should also implicitly zero).

This also removes some unused code that also contained uninitialized
static consts.

ok?

Index: evp/e_chacha20poly1305.c
===
RCS file: /cvs/src/lib/libssl/src/crypto/evp/e_chacha20poly1305.c,v
retrieving revision 1.14
diff -u -p -u -p -r1.14 e_chacha20poly1305.c
--- evp/e_chacha20poly1305.c28 Apr 2016 16:06:53 -  1.14
+++ evp/e_chacha20poly1305.c11 Jul 2016 13:10:31 -
@@ -109,7 +109,7 @@ static void
 poly1305_update_with_pad16(poly1305_state *poly1305,
 const unsigned char *data, size_t data_len)
 {
-   static const unsigned char zero_pad16[16];
+   static const unsigned char zero_pad16[16] = {0};
size_t pad_len;
 
CRYPTO_poly1305_update(poly1305, data, data_len);
Index: objects/obj_dat.c
===
RCS file: /cvs/src/lib/libssl/src/crypto/objects/obj_dat.c,v
retrieving revision 1.35
diff -u -p -u -p -r1.35 obj_dat.c
--- objects/obj_dat.c   14 Oct 2015 21:54:10 -  1.35
+++ objects/obj_dat.c   11 Jul 2016 13:10:31 -
@@ -70,20 +70,7 @@
 #include 
 
 /* obj_dat.h is generated from objects.h by obj_dat.pl */
-#ifndef OPENSSL_NO_OBJECT
 #include "obj_dat.h"
-#else
-/* You will have to load all the objects needed manually in the application */
-#define NUM_NID 0
-#define NUM_SN 0
-#define NUM_LN 0
-#define NUM_OBJ 0
-static const unsigned char lvalues[1];
-static const ASN1_OBJECT nid_objs[1];
-static const unsigned int sn_objs[1];
-static const unsigned int ln_objs[1];
-static const unsigned int obj_objs[1];
-#endif
 
 DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, sn);
 DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, ln);