]> git.codecow.com Git - Monocypher.git/commitdiff
Fewer SLOC cheats
authorLoup Vaillant <loup@loup-vaillant.fr>
Mon, 20 Feb 2023 08:57:22 +0000 (09:57 +0100)
committerLoup Vaillant <loup@loup-vaillant.fr>
Mon, 20 Feb 2023 08:57:22 +0000 (09:57 +0100)
src/monocypher.c

index 034da857db13c8e54b0f12dfda7dcbd701156c66..243c5e9f3867f87c6763edf4982593db3403c9cc 100644 (file)
@@ -967,7 +967,9 @@ static const fe ufactor = {
        -1917299, 15887451, -18755900, -7000830, -24778944,
        544946, -16816446, 4011309, -653372, 10741468,
 };
-static const fe A2      = {12721188, 3529, 0, 0, 0, 0, 0, 0, 0, 0,};
+static const fe A2      = {
+       12721188, 3529, 0, 0, 0, 0, 0, 0, 0, 0,
+};
 
 static void fe_0(fe h) {           ZERO(h  , 10); }
 static void fe_1(fe h) { h[0] = 1; ZERO(h+1,  9); }
@@ -2454,8 +2456,9 @@ void crypto_x25519_dirty_small(u8 public_key[32], const u8 secret_key[32])
        // The low order component of this base point  has been chosen
        // to yield the same results as crypto_x25519_dirty_fast().
        static const u8 dirty_base_point[32] = {
-               0xd8, 0x86, 0x1a, 0xa2, 0x78, 0x7a, 0xd9, 0x26, 0x8b, 0x74, 0x74, 0xb6,
-               0x82, 0xe3, 0xbe, 0xc3, 0xce, 0x36, 0x9a, 0x1e, 0x5e, 0x31, 0x47, 0xa2,
+               0xd8, 0x86, 0x1a, 0xa2, 0x78, 0x7a, 0xd9, 0x26,
+               0x8b, 0x74, 0x74, 0xb6, 0x82, 0xe3, 0xbe, 0xc3,
+               0xce, 0x36, 0x9a, 0x1e, 0x5e, 0x31, 0x47, 0xa2,
                0x6d, 0x37, 0x7c, 0xfd, 0x20, 0xb5, 0xdf, 0x75,
        };
        // separate the main factor & the cofactor of the scalar
@@ -2793,13 +2796,16 @@ void crypto_x25519_inverse(u8 blind_salt [32], const u8 private_key[32],
                            const u8 curve_point[32])
 {
        static const  u8 Lm2[32] = { // L - 2
-               0xeb, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2,
-               0xde, 0xf9, 0xde, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+               0xeb, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58,
+               0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14,
+               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
        };
        // 1 in Montgomery form
-       u32 m_inv [8] = {0x8d98951d, 0xd6ec3174, 0x737dcf70, 0xc6ef5bf4,
-               0xfffffffe, 0xffffffff, 0xffffffff, 0x0fffffff,};
+       u32 m_inv [8] = {
+               0x8d98951d, 0xd6ec3174, 0x737dcf70, 0xc6ef5bf4,
+               0xfffffffe, 0xffffffff, 0xffffffff, 0x0fffffff,
+       };
 
        u8 scalar[32];
        crypto_eddsa_trim_scalar(scalar, private_key);