You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
curve25519.c does not conform to the coding standards #7698
While developing the fix in #7697 I noticed that the curve25519.c file does not conform to the coding standards - most obviously the indentation is wrong and functions have { on the end of the line instead of the next line.
FWIW: I tried openssl-format-source and it should be used with care. The tool might be helpful a little with the indentation of the function bodies, but many of the other whitespace changes are more harmful than helpful. For example, it destroys this artful (and helpful) matrix structure in fe_mul() and turns it into a mess:
Sure, one could do that. But apart from that I'm not sure whether the script still reflects our current coding standards. Just running it on crypto/ec yields a lot of diffs...
I just ran the script on crypto/ec, and the result is not only messy, but wrong in some places. When I see this kind of crap, it's definitely time to look at hand editing...
I can give it a try with emacs‘ indent-region, whitespace-cleanup, and a little manual editing, if you give me one or two days. Of course you can do it yourself, if you prefer.
Activity
kaduk commentedon Dec 1, 2018
From the history it looks like an import from Boring, and never got a full restyling.
I could see arguments both for and against keeping it that way.
mattcaswell commentedon Dec 1, 2018
We used to have a different style in every file and it was a nightmare. I think it should be fixed.
t-j-h commentedon Dec 1, 2018
It must be fixed. We have a coding style for a reason. Run it through the script to fix up.
mspncp commentedon Dec 2, 2018
FWIW: I tried
openssl-format-sourceand it should be used with care. The tool might be helpful a little with the indentation of the function bodies, but many of the other whitespace changes are more harmful than helpful. For example, it destroys this artful (and helpful) matrix structure infe_mul()and turns it into a mess:openssl/crypto/ec/curve25519.c
Lines 1140 to 1149 in 9b1c0e0
So most of the changes it introduces must be carefully reviewed. Many of them need to be reverted and redone manually.
levitte commentedon Dec 2, 2018
It's always possible to wrap "artful" sections with
/**INDENT-OFF**/and/**INDENT-ON**/I suggest doing so.
mspncp commentedon Dec 2, 2018
Sure, one could do that. But apart from that I'm not sure whether the script still reflects our current coding standards. Just running it on
crypto/ecyields a lot of diffs...levitte commentedon Dec 2, 2018
BTW, it's recommended to run the script with
-c, which is kinder to commentslevitte commentedon Dec 2, 2018
... also, i've been pondering for a while if we shouldn't use something other than
indent... there are better indenters these days...levitte commentedon Dec 2, 2018
I just ran the script on
crypto/ec, and the result is not only messy, but wrong in some places. When I see this kind of crap, it's definitely time to look at hand editing...mspncp commentedon Dec 2, 2018
That‘s what I meant.
mspncp commentedon Dec 2, 2018
I can give it a try with emacs‘ indent-region, whitespace-cleanup, and a little manual editing, if you give me one or two days. Of course you can do it yourself, if you prefer.
levitte commentedon Dec 2, 2018
I have a gazillion things on my plate, so if you're willing, I'll take it!
mspncp commentedon Dec 3, 2018
Please take a look at #7750.
mspncp commentedon Dec 6, 2018
Note: The cherry-pick to 1.1.1 had a conflict which still needs to be resolved. I was interrupted in the middle of doing it.
curve25519.c: reformat code to follow coding guidelines