I've looked into using __attribute__ ((deprecated)).
See branch attribute-deprecated. I define _NETTLE_ATTRIBUTE_DEPRECATED in nettle-types.h (and _NETTLE_ATTRIBUTE_PURE, needed in a few places). For a start, I've marked the old aes and gcm-aes interfaces as deprecated, as discussed earlier, and the obsolete _rsa_blind and _rsa_unblind functions.
Some more functions are candidates for deprecation:
1. Everything in des-compat.h and md5-compat.h. Unless we think it can be deleted without deprecation; I'm not aware of any usage, and they made more sense back in 2001 when Nettle-1.0 was brand new.
2. The "general" hmac functions: hmac_set_key, hmac_update, hmac_digest.
Regards, /Niels
Hi Niels,
#defines should not start with an underscore. C standards say this is reserved (for system headers !?) and some static analyzers complain about it.
7.1.3 Reserved Identifiers ... All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use. ...
Regards, Tim
On 08/09/2018 10:16 PM, Niels Möller wrote:
I've looked into using __attribute__ ((deprecated)).
See branch attribute-deprecated. I define _NETTLE_ATTRIBUTE_DEPRECATED in nettle-types.h (and _NETTLE_ATTRIBUTE_PURE, needed in a few places). For a start, I've marked the old aes and gcm-aes interfaces as deprecated, as discussed earlier, and the obsolete _rsa_blind and _rsa_unblind functions.
Some more functions are candidates for deprecation:
Everything in des-compat.h and md5-compat.h. Unless we think it can be deleted without deprecation; I'm not aware of any usage, and they made more sense back in 2001 when Nettle-1.0 was brand new.
The "general" hmac functions: hmac_set_key, hmac_update, hmac_digest.
Regards, /Niels
Tim Rühsen tim.ruehsen@gmx.de writes:
#defines should not start with an underscore. C standards say this is reserved (for system headers !?) and some static analyzers complain about it.
Note that Nettle has violated this rule since the very beginnings. E.g,
#define _MD5_DIGEST_LENGTH 4
has been in md5.h since the initial commit (back in April 2001, around midnight). I haven't seen any reports about this causing problems.
I agree it's not quite right, and maybe we should clean this up at some point, replacing the leading underscore by nettle_internal_ (or maybe trailing underscore or nettle__ (double underscore). But not now.
Which static analyzers complain?
Regards, /Niels
On 08/13/2018 11:30 AM, Niels Möller wrote:
Tim Rühsen tim.ruehsen@gmx.de writes:
#defines should not start with an underscore. C standards say this is reserved (for system headers !?) and some static analyzers complain about it.
Note that Nettle has violated this rule since the very beginnings. E.g,
#define _MD5_DIGEST_LENGTH 4
has been in md5.h since the initial commit (back in April 2001, around midnight). I haven't seen any reports about this causing problems.
I agree it's not quite right, and maybe we should clean this up at some point, replacing the leading underscore by nettle_internal_ (or maybe trailing underscore or nettle__ (double underscore). But not now.
Which static analyzers complain?
AFAIR it was lgtm.com complaining the header guards in libpsl (which I meanwhile changed to not use leading underscores).
And you are right, I also have never experienced any problems with such defines. Except that people keep complaining about not following the standards ;-)
Getting automated static analyzers to 0 issues has the nice side-effect that you can fail your CI / build when 1+ issue pops up. So any contributor is (automatically) forced to deliver clean code. That takes some burden from the maintainer and reduces iteration / discussions about certain kind of 'cleanups'.
So nothing serious that needs to be addressed immediately.
Regards, Tim
nettle-bugs@lists.lysator.liu.se