]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix the parameter type of gf_serialize
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Sun, 22 Aug 2021 19:28:51 +0000 (21:28 +0200)
committerTomas Mraz <tomas@openssl.org>
Fri, 17 Sep 2021 12:44:41 +0000 (14:44 +0200)
It is better to use array bounds for improved
gcc warning checks.

While "uint8_t*" allows arbitrary pointer arithmetic
using "uint8_t[SER_BYTES]" limits the pointer arithmetic
to the range 0..SER_BYTES.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16376)

crypto/ec/curve448/f_generic.c
crypto/ec/curve448/field.h

index 4c571810d3afcf71a554cfbf115b3c8c579e00b7..7bb7df6b6015151c2bcdf1ca31c53dc1fdcec3d5 100644 (file)
@@ -18,7 +18,7 @@ static const gf MODULUS = {
 };
 
 /* Serialize to wire format. */
-void gf_serialize(uint8_t *serial, const gf x, int with_hibit)
+void gf_serialize(uint8_t serial[SER_BYTES], const gf x, int with_hibit)
 {
     unsigned int j = 0, fill = 0;
     dword_t buffer = 0;
index e1c633378950db1ea5064c00b4cd34f917fcdd80..0350322553b7471c75a7e35a31b8ac4e1bcfcc28 100644 (file)
@@ -62,7 +62,7 @@ mask_t gf_eq(const gf x, const gf y);
 mask_t gf_lobit(const gf x);
 mask_t gf_hibit(const gf x);
 
-void gf_serialize(uint8_t *serial, const gf x, int with_highbit);
+void gf_serialize(uint8_t serial[SER_BYTES], const gf x, int with_highbit);
 mask_t gf_deserialize(gf x, const uint8_t serial[SER_BYTES], int with_hibit,
                       uint8_t hi_nmask);