From 3dc7237a875d6d004a9a20546b26e1e42c58bba6 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Wed, 18 Dec 2024 16:24:57 -0500 Subject: [PATCH] Add a few more anonymous namespaces around struts Later we'll probably want to square our preferred styles against this stricter requirement. (Maybe we should just prefer to put everything file-local in anonymous namespaces rather than mark things static? Not sure. I don't like that it's hard to see whether something is static, but if we have to use this for types anyway...) Bug: 384186552 Change-Id: Ie86a56b1c7358a32262f0b9c4edb3e503aa3d08a Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/74547 Reviewed-by: Adam Langley Commit-Queue: David Benjamin Auto-Submit: David Benjamin Commit-Queue: Adam Langley --- crypto/hrss/hrss.cc | 4 ++++ crypto/kyber/kyber.cc | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/crypto/hrss/hrss.cc b/crypto/hrss/hrss.cc index 217c3fb10f..5e5b207b9a 100644 --- a/crypto/hrss/hrss.cc +++ b/crypto/hrss/hrss.cc @@ -1835,6 +1835,8 @@ static void poly_lift(struct poly *out, const struct poly *a) { poly_normalize(out); } +namespace { + struct public_key { struct poly ph; }; @@ -1845,6 +1847,8 @@ struct private_key { uint8_t hmac_key[32]; }; +} // namespace + // public_key_from_external converts an external public key pointer into an // internal one. Externally the alignment is only specified to be eight bytes // but we need 16-byte alignment. We could annotate the external struct with diff --git a/crypto/kyber/kyber.cc b/crypto/kyber/kyber.cc index 77531040a7..f21dc2f739 100644 --- a/crypto/kyber/kyber.cc +++ b/crypto/kyber/kyber.cc @@ -575,6 +575,8 @@ static void vector_decompress(vector *a, int bits) { } } +namespace { + struct public_key { vector t; uint8_t rho[32]; @@ -607,6 +609,8 @@ static struct private_key *private_key_from_external( return (struct private_key *)external; } +} // namespace + // Calls |KYBER_generate_key_external_entropy| with random bytes from // |RAND_bytes|. void KYBER_generate_key(uint8_t out_encoded_public_key[KYBER_PUBLIC_KEY_BYTES],