mirror of
https://boringssl.googlesource.com/boringssl
synced 2026-07-21 14:43:51 +00:00
Documentation: Change |...| to ... for code references in comments 4/N
This CL includes the result of running util/update_comment_style.py over all public header files in include/openssl whose filenames begin with s-z, except for ssl.h, and fixing omissions manually if necessary. Bug: 42290410 Change-Id: Id1eba48c218a61bf367640d7bfa59d7a6a6a6964 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/96147 Reviewed-by: David Benjamin <davidben@google.com> Commit-Queue: Lily Chen <chlily@google.com>
This commit is contained in:
committed by
boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com
parent
006b4d9f35
commit
34db38bf39
+13
-13
@@ -38,26 +38,26 @@ extern "C" {
|
||||
// SHA_DIGEST_LENGTH is the length of a SHA-1 digest.
|
||||
#define SHA_DIGEST_LENGTH 20
|
||||
|
||||
// SHA1_Init initialises |sha| and returns one.
|
||||
// SHA1_Init initialises `sha` and returns one.
|
||||
OPENSSL_EXPORT int SHA1_Init(SHA_CTX *sha);
|
||||
|
||||
// SHA1_Update adds |len| bytes from |data| to |sha| and returns one.
|
||||
// SHA1_Update adds `len` bytes from `data` to `sha` and returns one.
|
||||
OPENSSL_EXPORT int SHA1_Update(SHA_CTX *sha, const void *data, size_t len);
|
||||
|
||||
// SHA1_Final adds the final padding to |sha| and writes the resulting digest to
|
||||
// |out|, which must have at least |SHA_DIGEST_LENGTH| bytes of space. It
|
||||
// SHA1_Final adds the final padding to `sha` and writes the resulting digest to
|
||||
// `out`, which must have at least `SHA_DIGEST_LENGTH` bytes of space. It
|
||||
// returns one.
|
||||
OPENSSL_EXPORT int SHA1_Final(uint8_t out[SHA_DIGEST_LENGTH], SHA_CTX *sha);
|
||||
|
||||
// SHA1 writes the digest of |len| bytes from |data| to |out| and returns
|
||||
// |out|. There must be at least |SHA_DIGEST_LENGTH| bytes of space in
|
||||
// |out|.
|
||||
// SHA1 writes the digest of `len` bytes from `data` to `out` and returns
|
||||
// `out`. There must be at least `SHA_DIGEST_LENGTH` bytes of space in
|
||||
// `out`.
|
||||
OPENSSL_EXPORT uint8_t *SHA1(const uint8_t *data, size_t len,
|
||||
uint8_t out[SHA_DIGEST_LENGTH]);
|
||||
|
||||
// SHA1_Transform is a low-level function that performs a single, SHA-1 block
|
||||
// transformation using the state from |sha| and |SHA_CBLOCK| bytes from
|
||||
// |block|.
|
||||
// transformation using the state from `sha` and `SHA_CBLOCK` bytes from
|
||||
// `block`.
|
||||
OPENSSL_EXPORT void SHA1_Transform(SHA_CTX *sha,
|
||||
const uint8_t block[SHA_CBLOCK]);
|
||||
|
||||
@@ -65,7 +65,7 @@ struct sha_state_st {
|
||||
#if defined(__cplusplus) || defined(OPENSSL_WINDOWS)
|
||||
uint32_t h[5];
|
||||
#else
|
||||
// wpa_supplicant accesses |h0|..|h4| so we must support those names for
|
||||
// wpa_supplicant accesses `h0`..`h4` so we must support those names for
|
||||
// compatibility with it until it can be updated. Anonymous unions are only
|
||||
// standard in C11, so disable this workaround in C++.
|
||||
union {
|
||||
@@ -84,14 +84,14 @@ struct sha_state_st {
|
||||
unsigned num;
|
||||
} /* SHA_CTX */;
|
||||
|
||||
// CRYPTO_fips_186_2_prf derives |out_len| bytes from |xkey| using the PRF
|
||||
// CRYPTO_fips_186_2_prf derives `out_len` bytes from `xkey` using the PRF
|
||||
// defined in FIPS 186-2, Appendix 3.1, with change notice 1 applied. The b
|
||||
// parameter is 160 and seed, XKEY, is also 160 bits. The optional XSEED user
|
||||
// input is all zeros.
|
||||
//
|
||||
// The PRF generates a sequence of 320-bit numbers. Each number is encoded as a
|
||||
// 40-byte string in big-endian and then concatenated to form |out|. If
|
||||
// |out_len| is not a multiple of 40, the result is truncated. This matches the
|
||||
// 40-byte string in big-endian and then concatenated to form `out`. If
|
||||
// `out_len` is not a multiple of 40, the result is truncated. This matches the
|
||||
// construction used in Section 7 of RFC 4186 and Section 7 of RFC 4187.
|
||||
//
|
||||
// This PRF is based on SHA-1, a weak hash function, and should not be used
|
||||
|
||||
+42
-42
@@ -33,21 +33,21 @@ extern "C" {
|
||||
// SHA224_DIGEST_LENGTH is the length of a SHA-224 digest.
|
||||
#define SHA224_DIGEST_LENGTH 28
|
||||
|
||||
// SHA224_Init initialises |sha| and returns 1.
|
||||
// SHA224_Init initialises `sha` and returns 1.
|
||||
OPENSSL_EXPORT int SHA224_Init(SHA256_CTX *sha);
|
||||
|
||||
// SHA224_Update adds |len| bytes from |data| to |sha| and returns 1.
|
||||
// SHA224_Update adds `len` bytes from `data` to `sha` and returns 1.
|
||||
OPENSSL_EXPORT int SHA224_Update(SHA256_CTX *sha, const void *data, size_t len);
|
||||
|
||||
// SHA224_Final adds the final padding to |sha| and writes the resulting digest
|
||||
// to |out|, which must have at least |SHA224_DIGEST_LENGTH| bytes of space. It
|
||||
// SHA224_Final adds the final padding to `sha` and writes the resulting digest
|
||||
// to `out`, which must have at least `SHA224_DIGEST_LENGTH` bytes of space. It
|
||||
// returns 1.
|
||||
OPENSSL_EXPORT int SHA224_Final(uint8_t out[SHA224_DIGEST_LENGTH],
|
||||
SHA256_CTX *sha);
|
||||
|
||||
// SHA224 writes the digest of |len| bytes from |data| to |out| and returns
|
||||
// |out|. There must be at least |SHA224_DIGEST_LENGTH| bytes of space in
|
||||
// |out|.
|
||||
// SHA224 writes the digest of `len` bytes from `data` to `out` and returns
|
||||
// `out`. There must be at least `SHA224_DIGEST_LENGTH` bytes of space in
|
||||
// `out`.
|
||||
OPENSSL_EXPORT uint8_t *SHA224(const uint8_t *data, size_t len,
|
||||
uint8_t out[SHA224_DIGEST_LENGTH]);
|
||||
|
||||
@@ -60,33 +60,33 @@ OPENSSL_EXPORT uint8_t *SHA224(const uint8_t *data, size_t len,
|
||||
// SHA256_DIGEST_LENGTH is the length of a SHA-256 digest.
|
||||
#define SHA256_DIGEST_LENGTH 32
|
||||
|
||||
// SHA256_Init initialises |sha| and returns 1.
|
||||
// SHA256_Init initialises `sha` and returns 1.
|
||||
OPENSSL_EXPORT int SHA256_Init(SHA256_CTX *sha);
|
||||
|
||||
// SHA256_Update adds |len| bytes from |data| to |sha| and returns 1.
|
||||
// SHA256_Update adds `len` bytes from `data` to `sha` and returns 1.
|
||||
OPENSSL_EXPORT int SHA256_Update(SHA256_CTX *sha, const void *data, size_t len);
|
||||
|
||||
// SHA256_Final adds the final padding to |sha| and writes the resulting digest
|
||||
// to |out|, which must have at least |SHA256_DIGEST_LENGTH| bytes of space. It
|
||||
// SHA256_Final adds the final padding to `sha` and writes the resulting digest
|
||||
// to `out`, which must have at least `SHA256_DIGEST_LENGTH` bytes of space. It
|
||||
// returns one on success and zero on programmer error.
|
||||
OPENSSL_EXPORT int SHA256_Final(uint8_t out[SHA256_DIGEST_LENGTH],
|
||||
SHA256_CTX *sha);
|
||||
|
||||
// SHA256 writes the digest of |len| bytes from |data| to |out| and returns
|
||||
// |out|. There must be at least |SHA256_DIGEST_LENGTH| bytes of space in
|
||||
// |out|.
|
||||
// SHA256 writes the digest of `len` bytes from `data` to `out` and returns
|
||||
// `out`. There must be at least `SHA256_DIGEST_LENGTH` bytes of space in
|
||||
// `out`.
|
||||
OPENSSL_EXPORT uint8_t *SHA256(const uint8_t *data, size_t len,
|
||||
uint8_t out[SHA256_DIGEST_LENGTH]);
|
||||
|
||||
// SHA256_Transform is a low-level function that performs a single, SHA-256
|
||||
// block transformation using the state from |sha| and |SHA256_CBLOCK| bytes
|
||||
// from |block|.
|
||||
// block transformation using the state from `sha` and `SHA256_CBLOCK` bytes
|
||||
// from `block`.
|
||||
OPENSSL_EXPORT void SHA256_Transform(SHA256_CTX *sha,
|
||||
const uint8_t block[SHA256_CBLOCK]);
|
||||
|
||||
// SHA256_TransformBlocks is a low-level function that takes |num_blocks| *
|
||||
// |SHA256_CBLOCK| bytes of data and performs SHA-256 transforms on it to update
|
||||
// |state|. You should not use this function unless you are implementing a
|
||||
// SHA256_TransformBlocks is a low-level function that takes `num_blocks` *
|
||||
// `SHA256_CBLOCK` bytes of data and performs SHA-256 transforms on it to update
|
||||
// `state`. You should not use this function unless you are implementing a
|
||||
// derivative of SHA-256.
|
||||
OPENSSL_EXPORT void SHA256_TransformBlocks(uint32_t state[8],
|
||||
const uint8_t *data,
|
||||
@@ -108,21 +108,21 @@ struct sha256_state_st {
|
||||
// SHA384_DIGEST_LENGTH is the length of a SHA-384 digest.
|
||||
#define SHA384_DIGEST_LENGTH 48
|
||||
|
||||
// SHA384_Init initialises |sha| and returns 1.
|
||||
// SHA384_Init initialises `sha` and returns 1.
|
||||
OPENSSL_EXPORT int SHA384_Init(SHA512_CTX *sha);
|
||||
|
||||
// SHA384_Update adds |len| bytes from |data| to |sha| and returns 1.
|
||||
// SHA384_Update adds `len` bytes from `data` to `sha` and returns 1.
|
||||
OPENSSL_EXPORT int SHA384_Update(SHA512_CTX *sha, const void *data, size_t len);
|
||||
|
||||
// SHA384_Final adds the final padding to |sha| and writes the resulting digest
|
||||
// to |out|, which must have at least |SHA384_DIGEST_LENGTH| bytes of space. It
|
||||
// SHA384_Final adds the final padding to `sha` and writes the resulting digest
|
||||
// to `out`, which must have at least `SHA384_DIGEST_LENGTH` bytes of space. It
|
||||
// returns one on success and zero on programmer error.
|
||||
OPENSSL_EXPORT int SHA384_Final(uint8_t out[SHA384_DIGEST_LENGTH],
|
||||
SHA512_CTX *sha);
|
||||
|
||||
// SHA384 writes the digest of |len| bytes from |data| to |out| and returns
|
||||
// |out|. There must be at least |SHA384_DIGEST_LENGTH| bytes of space in
|
||||
// |out|.
|
||||
// SHA384 writes the digest of `len` bytes from `data` to `out` and returns
|
||||
// `out`. There must be at least `SHA384_DIGEST_LENGTH` bytes of space in
|
||||
// `out`.
|
||||
OPENSSL_EXPORT uint8_t *SHA384(const uint8_t *data, size_t len,
|
||||
uint8_t out[SHA384_DIGEST_LENGTH]);
|
||||
|
||||
@@ -135,27 +135,27 @@ OPENSSL_EXPORT uint8_t *SHA384(const uint8_t *data, size_t len,
|
||||
// SHA512_DIGEST_LENGTH is the length of a SHA-512 digest.
|
||||
#define SHA512_DIGEST_LENGTH 64
|
||||
|
||||
// SHA512_Init initialises |sha| and returns 1.
|
||||
// SHA512_Init initialises `sha` and returns 1.
|
||||
OPENSSL_EXPORT int SHA512_Init(SHA512_CTX *sha);
|
||||
|
||||
// SHA512_Update adds |len| bytes from |data| to |sha| and returns 1.
|
||||
// SHA512_Update adds `len` bytes from `data` to `sha` and returns 1.
|
||||
OPENSSL_EXPORT int SHA512_Update(SHA512_CTX *sha, const void *data, size_t len);
|
||||
|
||||
// SHA512_Final adds the final padding to |sha| and writes the resulting digest
|
||||
// to |out|, which must have at least |SHA512_DIGEST_LENGTH| bytes of space. It
|
||||
// SHA512_Final adds the final padding to `sha` and writes the resulting digest
|
||||
// to `out`, which must have at least `SHA512_DIGEST_LENGTH` bytes of space. It
|
||||
// returns one on success and zero on programmer error.
|
||||
OPENSSL_EXPORT int SHA512_Final(uint8_t out[SHA512_DIGEST_LENGTH],
|
||||
SHA512_CTX *sha);
|
||||
|
||||
// SHA512 writes the digest of |len| bytes from |data| to |out| and returns
|
||||
// |out|. There must be at least |SHA512_DIGEST_LENGTH| bytes of space in
|
||||
// |out|.
|
||||
// SHA512 writes the digest of `len` bytes from `data` to `out` and returns
|
||||
// `out`. There must be at least `SHA512_DIGEST_LENGTH` bytes of space in
|
||||
// `out`.
|
||||
OPENSSL_EXPORT uint8_t *SHA512(const uint8_t *data, size_t len,
|
||||
uint8_t out[SHA512_DIGEST_LENGTH]);
|
||||
|
||||
// SHA512_Transform is a low-level function that performs a single, SHA-512
|
||||
// block transformation using the state from |sha| and |SHA512_CBLOCK| bytes
|
||||
// from |block|.
|
||||
// block transformation using the state from `sha` and `SHA512_CBLOCK` bytes
|
||||
// from `block`.
|
||||
OPENSSL_EXPORT void SHA512_Transform(SHA512_CTX *sha,
|
||||
const uint8_t block[SHA512_CBLOCK]);
|
||||
|
||||
@@ -174,22 +174,22 @@ struct sha512_state_st {
|
||||
|
||||
#define SHA512_256_DIGEST_LENGTH 32
|
||||
|
||||
// SHA512_256_Init initialises |sha| and returns 1.
|
||||
// SHA512_256_Init initialises `sha` and returns 1.
|
||||
OPENSSL_EXPORT int SHA512_256_Init(SHA512_CTX *sha);
|
||||
|
||||
// SHA512_256_Update adds |len| bytes from |data| to |sha| and returns 1.
|
||||
// SHA512_256_Update adds `len` bytes from `data` to `sha` and returns 1.
|
||||
OPENSSL_EXPORT int SHA512_256_Update(SHA512_CTX *sha, const void *data,
|
||||
size_t len);
|
||||
|
||||
// SHA512_256_Final adds the final padding to |sha| and writes the resulting
|
||||
// digest to |out|, which must have at least |SHA512_256_DIGEST_LENGTH| bytes of
|
||||
// SHA512_256_Final adds the final padding to `sha` and writes the resulting
|
||||
// digest to `out`, which must have at least `SHA512_256_DIGEST_LENGTH` bytes of
|
||||
// space. It returns one on success and zero on programmer error.
|
||||
OPENSSL_EXPORT int SHA512_256_Final(uint8_t out[SHA512_256_DIGEST_LENGTH],
|
||||
SHA512_CTX *sha);
|
||||
|
||||
// SHA512_256 writes the digest of |len| bytes from |data| to |out| and returns
|
||||
// |out|. There must be at least |SHA512_256_DIGEST_LENGTH| bytes of space in
|
||||
// |out|.
|
||||
// SHA512_256 writes the digest of `len` bytes from `data` to `out` and returns
|
||||
// `out`. There must be at least `SHA512_256_DIGEST_LENGTH` bytes of space in
|
||||
// `out`.
|
||||
OPENSSL_EXPORT uint8_t *SHA512_256(const uint8_t *data, size_t len,
|
||||
uint8_t out[SHA512_256_DIGEST_LENGTH]);
|
||||
|
||||
|
||||
+55
-55
@@ -50,37 +50,37 @@ extern "C" {
|
||||
#define SLHDSA_SHAKE_256F_SIGNATURE_BYTES 49856
|
||||
|
||||
// SLHDSA_SHA2_128S_generate_key generates a SLH-DSA-SHA2-128s key pair and
|
||||
// writes the result to |out_public_key| and |out_private_key|.
|
||||
// writes the result to `out_public_key` and `out_private_key`.
|
||||
OPENSSL_EXPORT void SLHDSA_SHA2_128S_generate_key(
|
||||
uint8_t out_public_key[SLHDSA_SHA2_128S_PUBLIC_KEY_BYTES],
|
||||
uint8_t out_private_key[SLHDSA_SHA2_128S_PRIVATE_KEY_BYTES]);
|
||||
|
||||
// SLHDSA_SHAKE_256F_generate_key generates a SLH-DSA-SHAKE-256f key pair and
|
||||
// writes the result to |out_public_key| and |out_private_key|.
|
||||
// writes the result to `out_public_key` and `out_private_key`.
|
||||
OPENSSL_EXPORT void SLHDSA_SHAKE_256F_generate_key(
|
||||
uint8_t out_public_key[SLHDSA_SHAKE_256F_PUBLIC_KEY_BYTES],
|
||||
uint8_t out_private_key[SLHDSA_SHAKE_256F_PRIVATE_KEY_BYTES]);
|
||||
|
||||
// SLHDSA_SHA2_128S_public_from_private writes the public key corresponding to
|
||||
// |private_key| to |out_public_key|.
|
||||
// `private_key` to `out_public_key`.
|
||||
OPENSSL_EXPORT void SLHDSA_SHA2_128S_public_from_private(
|
||||
uint8_t out_public_key[SLHDSA_SHA2_128S_PUBLIC_KEY_BYTES],
|
||||
const uint8_t private_key[SLHDSA_SHA2_128S_PRIVATE_KEY_BYTES]);
|
||||
|
||||
// SLHDSA_SHAKE_256F_public_from_private writes the public key corresponding to
|
||||
// |private_key| to |out_public_key|.
|
||||
// `private_key` to `out_public_key`.
|
||||
OPENSSL_EXPORT void SLHDSA_SHAKE_256F_public_from_private(
|
||||
uint8_t out_public_key[SLHDSA_SHAKE_256F_PUBLIC_KEY_BYTES],
|
||||
const uint8_t private_key[SLHDSA_SHAKE_256F_PRIVATE_KEY_BYTES]);
|
||||
|
||||
// SLHDSA_SHA2_128S_sign slowly generates a SLH-DSA-SHA2-128s signature of |msg|
|
||||
// using |private_key| and writes it to |out_signature|. The |context| argument
|
||||
// SLHDSA_SHA2_128S_sign slowly generates a SLH-DSA-SHA2-128s signature of `msg`
|
||||
// using `private_key` and writes it to `out_signature`. The `context` argument
|
||||
// is also signed over and can be used to include implicit contextual
|
||||
// information that isn't included in |msg|. The same value of |context| must be
|
||||
// presented to |SLHDSA_SHA2_128S_verify| in order for the generated signature
|
||||
// to be considered valid. |context| and |context_len| may be |NULL| and 0 to
|
||||
// information that isn't included in `msg`. The same value of `context` must be
|
||||
// presented to `SLHDSA_SHA2_128S_verify` in order for the generated signature
|
||||
// to be considered valid. `context` and `context_len` may be `NULL` and 0 to
|
||||
// use an empty context (this is common). It returns 1 on success and 0 if
|
||||
// |context_len| is larger than 255.
|
||||
// `context_len` is larger than 255.
|
||||
OPENSSL_EXPORT int SLHDSA_SHA2_128S_sign(
|
||||
uint8_t out_signature[SLHDSA_SHA2_128S_SIGNATURE_BYTES],
|
||||
const uint8_t private_key[SLHDSA_SHA2_128S_PRIVATE_KEY_BYTES],
|
||||
@@ -88,22 +88,22 @@ OPENSSL_EXPORT int SLHDSA_SHA2_128S_sign(
|
||||
size_t context_len);
|
||||
|
||||
// SLHDSA_SHAKE_256F_sign slowly generates a SLH-DSA-SHAKE-256f signature of
|
||||
// |msg| using |private_key| and writes it to |out_signature|. The |context|
|
||||
// `msg` using `private_key` and writes it to `out_signature`. The `context`
|
||||
// argument is also signed over and can be used to include implicit contextual
|
||||
// information that isn't included in |msg|. The same value of |context| must be
|
||||
// presented to |SLHDSA_SHAKE_256F_verify| in order for the generated signature
|
||||
// to be considered valid. |context| and |context_len| may be |NULL| and 0 to
|
||||
// information that isn't included in `msg`. The same value of `context` must be
|
||||
// presented to `SLHDSA_SHAKE_256F_verify` in order for the generated signature
|
||||
// to be considered valid. `context` and `context_len` may be `NULL` and 0 to
|
||||
// use an empty context (this is common). It returns 1 on success and 0 if
|
||||
// |context_len| is larger than 255.
|
||||
// `context_len` is larger than 255.
|
||||
OPENSSL_EXPORT int SLHDSA_SHAKE_256F_sign(
|
||||
uint8_t out_signature[SLHDSA_SHAKE_256F_SIGNATURE_BYTES],
|
||||
const uint8_t private_key[SLHDSA_SHAKE_256F_PRIVATE_KEY_BYTES],
|
||||
const uint8_t *msg, size_t msg_len, const uint8_t *context,
|
||||
size_t context_len);
|
||||
|
||||
// SLHDSA_SHA2_128S_verify verifies that |signature| is a valid
|
||||
// SLH-DSA-SHA2-128s signature of |msg| by |public_key|. The value of |context|
|
||||
// must equal the value that was passed to |SLHDSA_SHA2_128S_sign| when the
|
||||
// SLHDSA_SHA2_128S_verify verifies that `signature` is a valid
|
||||
// SLH-DSA-SHA2-128s signature of `msg` by `public_key`. The value of `context`
|
||||
// must equal the value that was passed to `SLHDSA_SHA2_128S_sign` when the
|
||||
// signature was generated. It returns 1 if the signature is valid and 0
|
||||
// otherwise.
|
||||
OPENSSL_EXPORT int SLHDSA_SHA2_128S_verify(
|
||||
@@ -112,9 +112,9 @@ OPENSSL_EXPORT int SLHDSA_SHA2_128S_verify(
|
||||
const uint8_t *msg, size_t msg_len, const uint8_t *context,
|
||||
size_t context_len);
|
||||
|
||||
// SLHDSA_SHAKE_256F_verify verifies that |signature| is a valid
|
||||
// SLH-DSA-SHAKE-256f signature of |msg| by |public_key|. The value of |context|
|
||||
// must equal the value that was passed to |SLHDSA_SHAKE_256F_sign| when the
|
||||
// SLHDSA_SHAKE_256F_verify verifies that `signature` is a valid
|
||||
// SLH-DSA-SHAKE-256f signature of `msg` by `public_key`. The value of `context`
|
||||
// must equal the value that was passed to `SLHDSA_SHAKE_256F_sign` when the
|
||||
// signature was generated. It returns 1 if the signature is valid and 0
|
||||
// otherwise.
|
||||
OPENSSL_EXPORT int SLHDSA_SHAKE_256F_verify(
|
||||
@@ -137,20 +137,20 @@ OPENSSL_EXPORT int SLHDSA_SHAKE_256F_verify(
|
||||
// and there's no other way to prevent ambiguity.
|
||||
|
||||
// SLHDSA_SHA2_128S_prehash_sign slowly generates a SLH-DSA-SHA2-128s signature
|
||||
// of the prehashed |hashed_msg| using |private_key| and writes it to
|
||||
// |out_signature|. The |context| argument is also signed over and can be used
|
||||
// of the prehashed `hashed_msg` using `private_key` and writes it to
|
||||
// `out_signature`. The `context` argument is also signed over and can be used
|
||||
// to include implicit contextual information that isn't included in
|
||||
// |hashed_msg|. The same value of |context| must be presented to
|
||||
// |SLHDSA_SHA2_128S_prehash_verify| in order for the generated signature to be
|
||||
// considered valid. |context| and |context_len| may be |NULL| and 0 to use an
|
||||
// `hashed_msg`. The same value of `context` must be presented to
|
||||
// `SLHDSA_SHA2_128S_prehash_verify` in order for the generated signature to be
|
||||
// considered valid. `context` and `context_len` may be `NULL` and 0 to use an
|
||||
// empty context (this is common).
|
||||
//
|
||||
// The |hash_nid| argument must specify the hash function that was used to
|
||||
// generate |hashed_msg|. This function only accepts hash functions listed in
|
||||
// The `hash_nid` argument must specify the hash function that was used to
|
||||
// generate `hashed_msg`. This function only accepts hash functions listed in
|
||||
// FIPS 205.
|
||||
//
|
||||
// This function returns 1 on success and 0 if |context_len| is larger than 255,
|
||||
// if the hash function is not supported, or if |hashed_msg| is the wrong
|
||||
// This function returns 1 on success and 0 if `context_len` is larger than 255,
|
||||
// if the hash function is not supported, or if `hashed_msg` is the wrong
|
||||
// length.
|
||||
OPENSSL_EXPORT int SLHDSA_SHA2_128S_prehash_sign(
|
||||
uint8_t out_signature[SLHDSA_SHA2_128S_SIGNATURE_BYTES],
|
||||
@@ -158,18 +158,18 @@ OPENSSL_EXPORT int SLHDSA_SHA2_128S_prehash_sign(
|
||||
const uint8_t *hashed_msg, size_t hashed_msg_len, int hash_nid,
|
||||
const uint8_t *context, size_t context_len);
|
||||
|
||||
// SLHDSA_SHA2_128S_prehash_verify verifies that |signature| is a valid
|
||||
// SLH-DSA-SHA2-128s signature of the prehashed |hashed_msg| by |public_key|,
|
||||
// using the hash algorithm identified by |hash_nid|. The value of |context|
|
||||
// must equal the value that was passed to |SLHDSA_SHA2_128S_prehash_sign| when
|
||||
// SLHDSA_SHA2_128S_prehash_verify verifies that `signature` is a valid
|
||||
// SLH-DSA-SHA2-128s signature of the prehashed `hashed_msg` by `public_key`,
|
||||
// using the hash algorithm identified by `hash_nid`. The value of `context`
|
||||
// must equal the value that was passed to `SLHDSA_SHA2_128S_prehash_sign` when
|
||||
// the signature was generated.
|
||||
//
|
||||
// The |hash_nid| argument must specify the hash function that was used to
|
||||
// generate |hashed_msg|. This function only accepts hash functions that are
|
||||
// The `hash_nid` argument must specify the hash function that was used to
|
||||
// generate `hashed_msg`. This function only accepts hash functions that are
|
||||
// listed in FIPS 205.
|
||||
//
|
||||
// This function returns 1 if the signature is valid and 0 if the signature is
|
||||
// invalid, the hash function is not supported, or if |hashed_msg| is the wrong
|
||||
// invalid, the hash function is not supported, or if `hashed_msg` is the wrong
|
||||
// length.
|
||||
OPENSSL_EXPORT int SLHDSA_SHA2_128S_prehash_verify(
|
||||
const uint8_t *signature, size_t signature_len,
|
||||
@@ -178,20 +178,20 @@ OPENSSL_EXPORT int SLHDSA_SHA2_128S_prehash_verify(
|
||||
const uint8_t *context, size_t context_len);
|
||||
|
||||
// SLHDSA_SHA2_128S_prehash_warning_nonstandard_sign slowly generates a
|
||||
// SLH-DSA-SHA2-128s signature of the prehashed |hashed_msg| using |private_key|
|
||||
// and writes it to |out_signature|. The |context| argument is also signed over
|
||||
// SLH-DSA-SHA2-128s signature of the prehashed `hashed_msg` using `private_key`
|
||||
// and writes it to `out_signature`. The `context` argument is also signed over
|
||||
// and can be used to include implicit contextual information that isn't
|
||||
// included in |hashed_msg|. The same value of |context| must be presented to
|
||||
// |SLHDSA_SHA2_128S_prehash_warning_nonstandard_verify| in order for the
|
||||
// generated signature to be considered valid. |context| and |context_len| may
|
||||
// be |NULL| and 0 to use an empty context (this is common).
|
||||
// included in `hashed_msg`. The same value of `context` must be presented to
|
||||
// `SLHDSA_SHA2_128S_prehash_warning_nonstandard_verify` in order for the
|
||||
// generated signature to be considered valid. `context` and `context_len` may
|
||||
// be `NULL` and 0 to use an empty context (this is common).
|
||||
//
|
||||
// The |hash_nid| argument must specify the hash function that was used to
|
||||
// generate |hashed_msg|. This function only accepts non-standard hash functions
|
||||
// The `hash_nid` argument must specify the hash function that was used to
|
||||
// generate `hashed_msg`. This function only accepts non-standard hash functions
|
||||
// that are not compliant with FIPS 205.
|
||||
//
|
||||
// This function returns 1 on success and 0 if |context_len| is larger than 255,
|
||||
// if the hash function is not supported, or if |hashed_msg| is the wrong
|
||||
// This function returns 1 on success and 0 if `context_len` is larger than 255,
|
||||
// if the hash function is not supported, or if `hashed_msg` is the wrong
|
||||
// length.
|
||||
OPENSSL_EXPORT int SLHDSA_SHA2_128S_prehash_warning_nonstandard_sign(
|
||||
uint8_t out_signature[SLHDSA_SHA2_128S_SIGNATURE_BYTES],
|
||||
@@ -199,18 +199,18 @@ OPENSSL_EXPORT int SLHDSA_SHA2_128S_prehash_warning_nonstandard_sign(
|
||||
const uint8_t *hashed_msg, size_t hashed_msg_len, int hash_nid,
|
||||
const uint8_t *context, size_t context_len);
|
||||
|
||||
// SLHDSA_SHA2_128S_prehash_warning_nonstandard_verify verifies that |signature|
|
||||
// is a valid SLH-DSA-SHA2-128s signature of the prehashed |hashed_msg| by
|
||||
// |public_key|, using the hash algorithm identified by |hash_nid|. The value of
|
||||
// |context| must equal the value that was passed to
|
||||
// |SLHDSA_SHA2_128S_prehash_sign| when the signature was generated.
|
||||
// SLHDSA_SHA2_128S_prehash_warning_nonstandard_verify verifies that `signature`
|
||||
// is a valid SLH-DSA-SHA2-128s signature of the prehashed `hashed_msg` by
|
||||
// `public_key`, using the hash algorithm identified by `hash_nid`. The value of
|
||||
// `context` must equal the value that was passed to
|
||||
// `SLHDSA_SHA2_128S_prehash_sign` when the signature was generated.
|
||||
//
|
||||
// The |hash_nid| argument must specify the hash function that was used to
|
||||
// generate |hashed_msg|. This function only accepts non-standard hash functions
|
||||
// The `hash_nid` argument must specify the hash function that was used to
|
||||
// generate `hashed_msg`. This function only accepts non-standard hash functions
|
||||
// that are not compliant with FIPS 205.
|
||||
//
|
||||
// This function returns 1 if the signature is valid and 0 if the signature is
|
||||
// invalid, the hash function is not supported, or if |hashed_msg| is the wrong
|
||||
// invalid, the hash function is not supported, or if `hashed_msg` is the wrong
|
||||
// length.
|
||||
OPENSSL_EXPORT int SLHDSA_SHA2_128S_prehash_warning_nonstandard_verify(
|
||||
const uint8_t *signature, size_t signature_len,
|
||||
|
||||
@@ -113,12 +113,12 @@ struct AllowRedeclaringConstructor {};
|
||||
} // namespace internal
|
||||
|
||||
// A Span<T> is a non-owning reference to a contiguous array of objects of type
|
||||
// |T|. Conceptually, a Span is a simple a pointer to |T| and a count of
|
||||
// `T`. Conceptually, a Span is a simple a pointer to `T` and a count of
|
||||
// elements accessible via that pointer. The elements referenced by the Span can
|
||||
// be mutated if |T| is mutable.
|
||||
// be mutated if `T` is mutable.
|
||||
//
|
||||
// A Span can be constructed from container types implementing |data()| and
|
||||
// |size()| methods. If |T| is constant, construction from a container type is
|
||||
// A Span can be constructed from container types implementing `data()` and
|
||||
// `size()` methods. If `T` is constant, construction from a container type is
|
||||
// implicit. This allows writing methods that accept data from some unspecified
|
||||
// container type:
|
||||
//
|
||||
@@ -255,7 +255,7 @@ class Span : public internal::SpanStorage<T, N> {
|
||||
|
||||
public:
|
||||
// NOTE: This method may abort() at runtime if pos or len are out of range.
|
||||
// NOTE: As opposed to std::span, the |dynamic_extent| value of |len| is not
|
||||
// NOTE: As opposed to std::span, the `dynamic_extent` value of `len` is not
|
||||
// magical here. This gets rid of a lot of runtime checks.
|
||||
constexpr Span<T> subspan(size_t pos, size_t len) const {
|
||||
// absl::Span throws an exception here. Note std::span and Chromium
|
||||
|
||||
@@ -31,7 +31,7 @@ extern "C" {
|
||||
// The following constants are equal to TLS cipher suite values, OR-d with
|
||||
// 0x03000000. This is part of OpenSSL's SSL 2.0 legacy. SSL 2.0 has long since
|
||||
// been removed from BoringSSL.
|
||||
// TODO(davidben): Define these in terms of |SSL_CIPHER_*| constants. The
|
||||
// TODO(davidben): Define these in terms of `SSL_CIPHER_*` constants. The
|
||||
// challenge is that existing code expects them to be defined in ssl3.h, so we
|
||||
// must first merge ssl3.h into ssl.h.
|
||||
#define SSL3_CK_RSA_DES_192_CBC3_SHA 0x0300000A
|
||||
@@ -84,7 +84,7 @@ extern "C" {
|
||||
// bytes (256) plus the mac size.
|
||||
//
|
||||
// TODO(davidben): This derivation doesn't take AEADs into account, or TLS 1.1
|
||||
// explicit nonces. It happens to work because |SSL3_RT_MAX_MD_SIZE| is larger
|
||||
// explicit nonces. It happens to work because `SSL3_RT_MAX_MD_SIZE` is larger
|
||||
// than necessary and no true AEAD has variable overhead in TLS 1.2.
|
||||
#define SSL3_RT_MAX_ENCRYPTED_OVERHEAD (256 + SSL3_RT_MAX_MD_SIZE)
|
||||
|
||||
@@ -95,7 +95,7 @@ extern "C" {
|
||||
(EVP_AEAD_MAX_OVERHEAD + EVP_AEAD_MAX_NONCE_LENGTH)
|
||||
|
||||
// SSL3_RT_MAX_COMPRESSED_LENGTH is an alias for
|
||||
// |SSL3_RT_MAX_PLAIN_LENGTH|. Compression is gone, so don't include the
|
||||
// `SSL3_RT_MAX_PLAIN_LENGTH`. Compression is gone, so don't include the
|
||||
// compression overhead.
|
||||
#define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH
|
||||
|
||||
@@ -156,7 +156,7 @@ extern "C" {
|
||||
#define DTLS1_MT_HELLO_VERIFY_REQUEST 3
|
||||
|
||||
// The following are legacy aliases for consumers which use
|
||||
// |SSL_CTX_set_msg_callback|.
|
||||
// `SSL_CTX_set_msg_callback`.
|
||||
#define SSL3_MT_SERVER_DONE SSL3_MT_SERVER_HELLO_DONE
|
||||
#define SSL3_MT_NEWSESSION_TICKET SSL3_MT_NEW_SESSION_TICKET
|
||||
|
||||
|
||||
+81
-81
@@ -26,56 +26,56 @@ extern "C" {
|
||||
// used collection object.
|
||||
//
|
||||
// This file defines macros for type-safe use of the stack functions. A stack
|
||||
// type is named like |STACK_OF(FOO)| and is accessed with functions named
|
||||
// like |sk_FOO_*|. Note the stack will typically contain /pointers/ to |FOO|.
|
||||
// type is named like `STACK_OF(FOO)` and is accessed with functions named
|
||||
// like `sk_FOO_*`. Note the stack will typically contain /pointers/ to `FOO`.
|
||||
//
|
||||
// The |DECLARE_STACK_OF| macro makes |STACK_OF(FOO)| available, and
|
||||
// |DEFINE_STACK_OF| makes the corresponding functions available.
|
||||
// The `DECLARE_STACK_OF` macro makes `STACK_OF(FOO)` available, and
|
||||
// `DEFINE_STACK_OF` makes the corresponding functions available.
|
||||
|
||||
|
||||
// Defining stacks.
|
||||
|
||||
// STACK_OF expands to the stack type for |type|.
|
||||
// STACK_OF expands to the stack type for `type`.
|
||||
#define STACK_OF(type) struct stack_st_##type
|
||||
|
||||
// DECLARE_STACK_OF declares the |STACK_OF(type)| type. It does not make the
|
||||
// corresponding |sk_type_*| functions available. This macro should be used in
|
||||
// DECLARE_STACK_OF declares the `STACK_OF(type)` type. It does not make the
|
||||
// corresponding `sk_type_*` functions available. This macro should be used in
|
||||
// files which only need the type.
|
||||
#define DECLARE_STACK_OF(type) STACK_OF(type);
|
||||
|
||||
// DEFINE_NAMED_STACK_OF defines |STACK_OF(name)| to be a stack whose elements
|
||||
// are |type| *. This macro makes the |sk_name_*| functions available.
|
||||
// DEFINE_NAMED_STACK_OF defines `STACK_OF(name)` to be a stack whose elements
|
||||
// are `type` *. This macro makes the `sk_name_*` functions available.
|
||||
//
|
||||
// It is not necessary to use |DECLARE_STACK_OF| in files which use this macro.
|
||||
// It is not necessary to use `DECLARE_STACK_OF` in files which use this macro.
|
||||
//
|
||||
// Must be used from the global namespace.
|
||||
#define DEFINE_NAMED_STACK_OF(name, type) \
|
||||
BORINGSSL_DEFINE_STACK_OF_IMPL(name, type *, const type *) \
|
||||
BORINGSSL_DEFINE_STACK_TRAITS(name, type, false)
|
||||
|
||||
// DEFINE_STACK_OF defines |STACK_OF(type)| to be a stack whose elements are
|
||||
// |type| *. This macro makes the |sk_type_*| functions available.
|
||||
// DEFINE_STACK_OF defines `STACK_OF(type)` to be a stack whose elements are
|
||||
// `type` *. This macro makes the `sk_type_*` functions available.
|
||||
//
|
||||
// It is not necessary to use |DECLARE_STACK_OF| in files which use this macro.
|
||||
// It is not necessary to use `DECLARE_STACK_OF` in files which use this macro.
|
||||
//
|
||||
// Must be used from the global namespace.
|
||||
#define DEFINE_STACK_OF(type) DEFINE_NAMED_STACK_OF(type, type)
|
||||
|
||||
// DEFINE_CONST_STACK_OF defines |STACK_OF(type)| to be a stack whose elements
|
||||
// are const |type| *. This macro makes the |sk_type_*| functions available.
|
||||
// DEFINE_CONST_STACK_OF defines `STACK_OF(type)` to be a stack whose elements
|
||||
// are const `type` *. This macro makes the `sk_type_*` functions available.
|
||||
//
|
||||
// It is not necessary to use |DECLARE_STACK_OF| in files which use this macro.
|
||||
// It is not necessary to use `DECLARE_STACK_OF` in files which use this macro.
|
||||
//
|
||||
// Must be used from the global namespace.
|
||||
#define DEFINE_CONST_STACK_OF(type) \
|
||||
BORINGSSL_DEFINE_STACK_OF_IMPL(type, const type *, const type *) \
|
||||
BORINGSSL_DEFINE_STACK_TRAITS(type, const type, true)
|
||||
|
||||
// DEFINE_NAMESPACED_STACK_OF is same as |DEFINE_STACK_OF| but to be used for
|
||||
// DEFINE_NAMESPACED_STACK_OF is same as `DEFINE_STACK_OF` but to be used for
|
||||
// internal stacks from within the bssl namespace.
|
||||
//
|
||||
// Such stacks then can only be accessed using |STACK_OF| if in the |bssl|
|
||||
// namespace or if the |bssl| namespace has been imported with a
|
||||
// Such stacks then can only be accessed using `STACK_OF` if in the `bssl`
|
||||
// namespace or if the `bssl` namespace has been imported with a
|
||||
// using-directive.
|
||||
#define DEFINE_NAMESPACED_STACK_OF(type) \
|
||||
BORINGSSL_DEFINE_STACK_OF_IMPL(type, type *, const type *) \
|
||||
@@ -86,7 +86,7 @@ extern "C" {
|
||||
|
||||
// Using stacks.
|
||||
//
|
||||
// After the |DEFINE_STACK_OF| macro is used, the following functions are
|
||||
// After the `DEFINE_STACK_OF` macro is used, the following functions are
|
||||
// available.
|
||||
|
||||
#if 0 // Sample
|
||||
@@ -98,11 +98,11 @@ typedef void (*sk_SAMPLE_free_func)(SAMPLE *);
|
||||
// return the copy or NULL on error.
|
||||
typedef SAMPLE *(*sk_SAMPLE_copy_func)(const SAMPLE *);
|
||||
|
||||
// sk_SAMPLE_cmp_func is a callback to compare |*a| to |*b|. It should return a
|
||||
// value < 0, 0, or > 0 if |*a| is less than, equal to, or greater than |*b|,
|
||||
// sk_SAMPLE_cmp_func is a callback to compare `*a` to `*b`. It should return a
|
||||
// value < 0, 0, or > 0 if `*a` is less than, equal to, or greater than `*b`,
|
||||
// respectively. Note the extra indirection - the function is given a pointer
|
||||
// to a pointer to the element. This is the |qsort|/|bsearch| comparison
|
||||
// function applied to an array of |SAMPLE*|.
|
||||
// to a pointer to the element. This is the `qsort`/`bsearch` comparison
|
||||
// function applied to an array of `SAMPLE*`.
|
||||
typedef int (*sk_SAMPLE_cmp_func)(const SAMPLE *const *a,
|
||||
const SAMPLE *const *b);
|
||||
|
||||
@@ -114,113 +114,113 @@ STACK_OF(SAMPLE) *sk_SAMPLE_new(sk_SAMPLE_cmp_func comp);
|
||||
// NULL on allocation failure.
|
||||
STACK_OF(SAMPLE) *sk_SAMPLE_new_null(void);
|
||||
|
||||
// sk_SAMPLE_num returns the number of elements in |sk|. It is safe to cast this
|
||||
// value to |int|. |sk| is guaranteed to have at most |INT_MAX| elements. If
|
||||
// |sk| is NULL, it is treated as the empty list and this function returns zero.
|
||||
// sk_SAMPLE_num returns the number of elements in `sk`. It is safe to cast this
|
||||
// value to `int`. `sk` is guaranteed to have at most `INT_MAX` elements. If
|
||||
// `sk` is NULL, it is treated as the empty list and this function returns zero.
|
||||
size_t sk_SAMPLE_num(const STACK_OF(SAMPLE) *sk);
|
||||
|
||||
// sk_SAMPLE_zero resets |sk| to the empty state but does nothing to free the
|
||||
// sk_SAMPLE_zero resets `sk` to the empty state but does nothing to free the
|
||||
// individual elements themselves.
|
||||
void sk_SAMPLE_zero(STACK_OF(SAMPLE) *sk);
|
||||
|
||||
// sk_SAMPLE_value returns the |i|th pointer in |sk|, or NULL if |i| is out of
|
||||
// range. If |sk| is NULL, it is treated as an empty list and the function
|
||||
// sk_SAMPLE_value returns the `i`th pointer in `sk`, or NULL if `i` is out of
|
||||
// range. If `sk` is NULL, it is treated as an empty list and the function
|
||||
// returns NULL.
|
||||
SAMPLE *sk_SAMPLE_value(const STACK_OF(SAMPLE) *sk, size_t i);
|
||||
|
||||
// sk_SAMPLE_set sets the |i|th pointer in |sk| to |p| and returns |p|. If |i|
|
||||
// sk_SAMPLE_set sets the `i`th pointer in `sk` to `p` and returns `p`. If `i`
|
||||
// is out of range, it returns NULL.
|
||||
SAMPLE *sk_SAMPLE_set(STACK_OF(SAMPLE) *sk, size_t i, SAMPLE *p);
|
||||
|
||||
// sk_SAMPLE_free frees |sk|, but does nothing to free the individual elements.
|
||||
// Use |sk_SAMPLE_pop_free| to also free the elements.
|
||||
// sk_SAMPLE_free frees `sk`, but does nothing to free the individual elements.
|
||||
// Use `sk_SAMPLE_pop_free` to also free the elements.
|
||||
void sk_SAMPLE_free(STACK_OF(SAMPLE) *sk);
|
||||
|
||||
// sk_SAMPLE_pop_free calls |free_func| on each element in |sk| and then
|
||||
// sk_SAMPLE_pop_free calls `free_func` on each element in `sk` and then
|
||||
// frees the stack itself.
|
||||
void sk_SAMPLE_pop_free(STACK_OF(SAMPLE) *sk, sk_SAMPLE_free_func free_func);
|
||||
|
||||
// sk_SAMPLE_insert inserts |p| into the stack at index |where|, moving existing
|
||||
// sk_SAMPLE_insert inserts `p` into the stack at index `where`, moving existing
|
||||
// elements if needed. It returns the length of the new stack, or zero on
|
||||
// error.
|
||||
size_t sk_SAMPLE_insert(STACK_OF(SAMPLE) *sk, SAMPLE *p, size_t where);
|
||||
|
||||
// sk_SAMPLE_delete removes the pointer at index |where|, moving other elements
|
||||
// down if needed. It returns the removed pointer, or NULL if |where| is out of
|
||||
// sk_SAMPLE_delete removes the pointer at index `where`, moving other elements
|
||||
// down if needed. It returns the removed pointer, or NULL if `where` is out of
|
||||
// range.
|
||||
SAMPLE *sk_SAMPLE_delete(STACK_OF(SAMPLE) *sk, size_t where);
|
||||
|
||||
// sk_SAMPLE_delete_ptr removes, at most, one instance of |p| from |sk| based on
|
||||
// pointer equality. If an instance of |p| is found then |p| is returned,
|
||||
// sk_SAMPLE_delete_ptr removes, at most, one instance of `p` from `sk` based on
|
||||
// pointer equality. If an instance of `p` is found then `p` is returned,
|
||||
// otherwise it returns NULL.
|
||||
SAMPLE *sk_SAMPLE_delete_ptr(STACK_OF(SAMPLE) *sk, const SAMPLE *p);
|
||||
|
||||
// sk_SAMPLE_delete_if_func is the callback function for |sk_SAMPLE_delete_if|.
|
||||
// It should return one to remove |p| and zero to keep it.
|
||||
// sk_SAMPLE_delete_if_func is the callback function for `sk_SAMPLE_delete_if`.
|
||||
// It should return one to remove `p` and zero to keep it.
|
||||
typedef int (*sk_SAMPLE_delete_if_func)(SAMPLE *p, void *data);
|
||||
|
||||
// sk_SAMPLE_delete_if calls |func| with each element of |sk| and removes the
|
||||
// entries where |func| returned one. This function does not free or return
|
||||
// removed pointers so, if |sk| owns its contents, |func| should release the
|
||||
// sk_SAMPLE_delete_if calls `func` with each element of `sk` and removes the
|
||||
// entries where `func` returned one. This function does not free or return
|
||||
// removed pointers so, if `sk` owns its contents, `func` should release the
|
||||
// pointers prior to returning one.
|
||||
void sk_SAMPLE_delete_if(STACK_OF(SAMPLE) *sk, sk_SAMPLE_delete_if_func func,
|
||||
void *data);
|
||||
|
||||
// sk_SAMPLE_find find the first value in |sk| equal to |p|. |sk|'s comparison
|
||||
// function determines equality, or pointer equality if |sk| has no comparison
|
||||
// sk_SAMPLE_find find the first value in `sk` equal to `p`. `sk`'s comparison
|
||||
// function determines equality, or pointer equality if `sk` has no comparison
|
||||
// function.
|
||||
//
|
||||
// If the stack is sorted (see |sk_SAMPLE_sort|), this function uses a binary
|
||||
// If the stack is sorted (see `sk_SAMPLE_sort`), this function uses a binary
|
||||
// search. Otherwise it performs a linear search. If it finds a matching
|
||||
// element, it writes the index to |*out_index| (if |out_index| is not NULL) and
|
||||
// returns one. Otherwise, it returns zero. If |sk| is NULL, it is treated as
|
||||
// element, it writes the index to `*out_index` (if `out_index` is not NULL) and
|
||||
// returns one. Otherwise, it returns zero. If `sk` is NULL, it is treated as
|
||||
// the empty list and the function returns zero.
|
||||
//
|
||||
// Note this differs from OpenSSL. The type signature is slightly different, and
|
||||
// OpenSSL's version will implicitly sort |sk| if it has a comparison function
|
||||
// OpenSSL's version will implicitly sort `sk` if it has a comparison function
|
||||
// defined.
|
||||
int sk_SAMPLE_find(const STACK_OF(SAMPLE) *sk, size_t *out_index,
|
||||
const SAMPLE *p);
|
||||
|
||||
// sk_SAMPLE_shift removes and returns the first element in |sk|, or NULL if
|
||||
// |sk| is empty.
|
||||
// sk_SAMPLE_shift removes and returns the first element in `sk`, or NULL if
|
||||
// `sk` is empty.
|
||||
SAMPLE *sk_SAMPLE_shift(STACK_OF(SAMPLE) *sk);
|
||||
|
||||
// sk_SAMPLE_push appends |p| to |sk| and returns the length of the new stack,
|
||||
// sk_SAMPLE_push appends `p` to `sk` and returns the length of the new stack,
|
||||
// or 0 on allocation failure.
|
||||
size_t sk_SAMPLE_push(STACK_OF(SAMPLE) *sk, SAMPLE *p);
|
||||
|
||||
// sk_SAMPLE_pop removes and returns the last element of |sk|, or NULL if |sk|
|
||||
// sk_SAMPLE_pop removes and returns the last element of `sk`, or NULL if `sk`
|
||||
// is empty.
|
||||
SAMPLE *sk_SAMPLE_pop(STACK_OF(SAMPLE) *sk);
|
||||
|
||||
// sk_SAMPLE_dup performs a shallow copy of a stack and returns the new stack,
|
||||
// or NULL on error. Use |sk_SAMPLE_deep_copy| to also copy the elements.
|
||||
// or NULL on error. Use `sk_SAMPLE_deep_copy` to also copy the elements.
|
||||
STACK_OF(SAMPLE) *sk_SAMPLE_dup(const STACK_OF(SAMPLE) *sk);
|
||||
|
||||
// sk_SAMPLE_sort sorts the elements of |sk| into ascending order based on the
|
||||
// sk_SAMPLE_sort sorts the elements of `sk` into ascending order based on the
|
||||
// comparison function. The stack maintains a "sorted" flag and sorting an
|
||||
// already sorted stack is a no-op.
|
||||
void sk_SAMPLE_sort(STACK_OF(SAMPLE) *sk);
|
||||
|
||||
// sk_SAMPLE_sort_and_dedup sorts the elements of |sk| based on the comparison
|
||||
// function and removes duplicates. If |free_func| is not NULL, it is called on
|
||||
// sk_SAMPLE_sort_and_dedup sorts the elements of `sk` based on the comparison
|
||||
// function and removes duplicates. If `free_func` is not NULL, it is called on
|
||||
// every removed element.
|
||||
void sk_SAMPLE_sort_and_dedup(STACK_OF(SAMPLE) *sk,
|
||||
sk_SAMPLE_free_func free_func);
|
||||
|
||||
// sk_SAMPLE_is_sorted returns one if |sk| is known to be sorted and zero
|
||||
// sk_SAMPLE_is_sorted returns one if `sk` is known to be sorted and zero
|
||||
// otherwise.
|
||||
int sk_SAMPLE_is_sorted(const STACK_OF(SAMPLE) *sk);
|
||||
|
||||
// sk_SAMPLE_set_cmp_func sets the comparison function to be used by |sk| and
|
||||
// sk_SAMPLE_set_cmp_func sets the comparison function to be used by `sk` and
|
||||
// returns the previous one.
|
||||
sk_SAMPLE_cmp_func sk_SAMPLE_set_cmp_func(STACK_OF(SAMPLE) *sk,
|
||||
sk_SAMPLE_cmp_func comp);
|
||||
|
||||
// sk_SAMPLE_deep_copy performs a copy of |sk| and of each of the non-NULL
|
||||
// elements in |sk| by using |copy_func|. If an error occurs, it calls
|
||||
// |free_func| to free any copies already made and returns NULL.
|
||||
// sk_SAMPLE_deep_copy performs a copy of `sk` and of each of the non-NULL
|
||||
// elements in `sk` by using `copy_func`. If an error occurs, it calls
|
||||
// `free_func` to free any copies already made and returns NULL.
|
||||
STACK_OF(SAMPLE) *sk_SAMPLE_deep_copy(const STACK_OF(SAMPLE) *sk,
|
||||
sk_SAMPLE_copy_func copy_func,
|
||||
sk_SAMPLE_free_func free_func);
|
||||
@@ -230,34 +230,34 @@ STACK_OF(SAMPLE) *sk_SAMPLE_deep_copy(const STACK_OF(SAMPLE) *sk,
|
||||
|
||||
// Private functions.
|
||||
//
|
||||
// The |sk_*| functions generated above are implemented internally using the
|
||||
// The `sk_*` functions generated above are implemented internally using the
|
||||
// type-erased functions below. Callers should use the typed wrappers instead.
|
||||
// When using the type-erased functions, callers are responsible for ensuring
|
||||
// the underlying types are correct. Casting pointers to the wrong types will
|
||||
// result in memory errors.
|
||||
|
||||
// OPENSSL_sk_free_func is a function that frees an element in a stack. Note its
|
||||
// actual type is void (*)(T *) for some T. Low-level |sk_*| functions will be
|
||||
// actual type is void (*)(T *) for some T. Low-level `sk_*` functions will be
|
||||
// passed a type-specific wrapper to call it correctly.
|
||||
typedef void (*OPENSSL_sk_free_func)(void *ptr);
|
||||
|
||||
// OPENSSL_sk_copy_func is a function that copies an element in a stack. Note
|
||||
// its actual type is T *(*)(const T *) for some T. Low-level |sk_*| functions
|
||||
// its actual type is T *(*)(const T *) for some T. Low-level `sk_*` functions
|
||||
// will be passed a type-specific wrapper to call it correctly.
|
||||
typedef void *(*OPENSSL_sk_copy_func)(const void *ptr);
|
||||
|
||||
// OPENSSL_sk_cmp_func is a comparison function that returns a value < 0, 0 or >
|
||||
// 0 if |*a| is less than, equal to or greater than |*b|, respectively. Note
|
||||
// 0 if `*a` is less than, equal to or greater than `*b`, respectively. Note
|
||||
// the extra indirection - the function is given a pointer to a pointer to the
|
||||
// element. This differs from the usual qsort/bsearch comparison function.
|
||||
//
|
||||
// Note its actual type is |int (*)(const T *const *a, const T *const *b)|.
|
||||
// Low-level |sk_*| functions will be passed a type-specific wrapper to call it
|
||||
// Note its actual type is `int (*)(const T *const *a, const T *const *b)`.
|
||||
// Low-level `sk_*` functions will be passed a type-specific wrapper to call it
|
||||
// correctly.
|
||||
typedef int (*OPENSSL_sk_cmp_func)(const void *const *a, const void *const *b);
|
||||
|
||||
// OPENSSL_sk_delete_if_func is the generic version of
|
||||
// |sk_SAMPLE_delete_if_func|.
|
||||
// `sk_SAMPLE_delete_if_func`.
|
||||
typedef int (*OPENSSL_sk_delete_if_func)(void *obj, void *data);
|
||||
|
||||
// The following function types call the above type-erased signatures with the
|
||||
@@ -274,7 +274,7 @@ typedef int (*OPENSSL_sk_call_delete_if_func)(OPENSSL_sk_delete_if_func, void *,
|
||||
typedef struct stack_st OPENSSL_STACK;
|
||||
|
||||
// The following are raw stack functions. They implement the corresponding typed
|
||||
// |sk_SAMPLE_*| functions generated by |DEFINE_STACK_OF|. Callers shouldn't be
|
||||
// `sk_SAMPLE_*` functions generated by `DEFINE_STACK_OF`. Callers shouldn't be
|
||||
// using them. Rather, callers should use the typed functions.
|
||||
OPENSSL_EXPORT OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_cmp_func comp);
|
||||
OPENSSL_EXPORT OPENSSL_STACK *OPENSSL_sk_new_null(void);
|
||||
@@ -324,7 +324,7 @@ OPENSSL_EXPORT OPENSSL_STACK *OPENSSL_sk_deep_copy(
|
||||
|
||||
typedef OPENSSL_STACK _STACK;
|
||||
|
||||
// The following functions call the corresponding |OPENSSL_sk_*| function.
|
||||
// The following functions call the corresponding `OPENSSL_sk_*` function.
|
||||
OPENSSL_EXPORT OPENSSL_DEPRECATED OPENSSL_STACK *sk_new_null(void);
|
||||
OPENSSL_EXPORT OPENSSL_DEPRECATED size_t sk_num(const OPENSSL_STACK *sk);
|
||||
OPENSSL_EXPORT OPENSSL_DEPRECATED void *sk_value(const OPENSSL_STACK *sk,
|
||||
@@ -333,16 +333,16 @@ OPENSSL_EXPORT OPENSSL_DEPRECATED void sk_free(OPENSSL_STACK *sk);
|
||||
OPENSSL_EXPORT OPENSSL_DEPRECATED size_t sk_push(OPENSSL_STACK *sk, void *p);
|
||||
OPENSSL_EXPORT OPENSSL_DEPRECATED void *sk_pop(OPENSSL_STACK *sk);
|
||||
|
||||
// sk_pop_free_ex calls |OPENSSL_sk_pop_free_ex|.
|
||||
// sk_pop_free_ex calls `OPENSSL_sk_pop_free_ex`.
|
||||
//
|
||||
// TODO(b/291994116): Remove this.
|
||||
OPENSSL_EXPORT OPENSSL_DEPRECATED void sk_pop_free_ex(
|
||||
OPENSSL_STACK *sk, OPENSSL_sk_call_free_func call_free_func,
|
||||
OPENSSL_sk_free_func free_func);
|
||||
|
||||
// sk_pop_free behaves like |OPENSSL_sk_pop_free_ex| but performs an invalid
|
||||
// sk_pop_free behaves like `OPENSSL_sk_pop_free_ex` but performs an invalid
|
||||
// function pointer cast. It exists because some existing callers called
|
||||
// |sk_pop_free| directly.
|
||||
// `sk_pop_free` directly.
|
||||
//
|
||||
// TODO(davidben): Migrate callers to bssl::UniquePtr and remove this.
|
||||
OPENSSL_EXPORT OPENSSL_DEPRECATED void sk_pop_free(
|
||||
@@ -381,9 +381,9 @@ BSSL_NAMESPACE_END
|
||||
/* We disable MSVC C4191 in this macro, which warns when pointers are cast \
|
||||
* to the wrong type. While the cast itself is valid, it is often a bug \
|
||||
* because calling it through the cast is UB. However, we never actually \
|
||||
* call functions as |OPENSSL_sk_cmp_func|. The type is just a type-erased \
|
||||
* call functions as `OPENSSL_sk_cmp_func`. The type is just a type-erased \
|
||||
* function pointer. (C does not guarantee function pointers fit in \
|
||||
* |void*|, and GCC will warn on this.) Thus we just disable the false \
|
||||
* `void*`, and GCC will warn on this.) Thus we just disable the false \
|
||||
* positive warning. */ \
|
||||
OPENSSL_MSVC_PRAGMA(warning(push)) \
|
||||
OPENSSL_MSVC_PRAGMA(warning(disable : 4191)) \
|
||||
@@ -419,7 +419,7 @@ BSSL_NAMESPACE_END
|
||||
const void *a, const void *b) { \
|
||||
constptrtype a_ptr = (constptrtype)a; \
|
||||
constptrtype b_ptr = (constptrtype)b; \
|
||||
/* |cmp_func| expects an extra layer of pointers to match qsort. */ \
|
||||
/* `cmp_func` expects an extra layer of pointers to match qsort. */ \
|
||||
return ((sk_##name##_cmp_func)cmp_func)(&a_ptr, &b_ptr); \
|
||||
} \
|
||||
\
|
||||
@@ -564,7 +564,7 @@ BSSL_NAMESPACE_BEGIN
|
||||
|
||||
namespace internal {
|
||||
|
||||
// Stacks defined with |DEFINE_CONST_STACK_OF| are freed with |sk_free|.
|
||||
// Stacks defined with `DEFINE_CONST_STACK_OF` are freed with `sk_free`.
|
||||
template <typename Stack>
|
||||
struct DeleterImpl<Stack, std::enable_if_t<StackTraits<Stack>::kIsConst>> {
|
||||
static void Free(Stack *sk) {
|
||||
@@ -572,7 +572,7 @@ struct DeleterImpl<Stack, std::enable_if_t<StackTraits<Stack>::kIsConst>> {
|
||||
}
|
||||
};
|
||||
|
||||
// Stacks defined with |DEFINE_STACK_OF| are freed with |sk_pop_free| and the
|
||||
// Stacks defined with `DEFINE_STACK_OF` are freed with `sk_pop_free` and the
|
||||
// corresponding type's deleter.
|
||||
template <typename Stack>
|
||||
struct DeleterImpl<Stack, std::enable_if_t<!StackTraits<Stack>::kIsConst>> {
|
||||
@@ -631,7 +631,7 @@ using StackIterator =
|
||||
|
||||
} // namespace internal
|
||||
|
||||
// PushToStack pushes |elem| to |sk|. It returns true on success and false on
|
||||
// PushToStack pushes `elem` to `sk`. It returns true on success and false on
|
||||
// allocation failure.
|
||||
template <typename Stack>
|
||||
inline std::enable_if_t<!internal::StackTraits<Stack>::kIsConst, bool>
|
||||
|
||||
@@ -85,8 +85,8 @@ extern "C" {
|
||||
#define TLSEXT_TYPE_quic_transport_parameters 57
|
||||
|
||||
// TLSEXT_TYPE_quic_transport_parameters_standard is an alias for
|
||||
// |TLSEXT_TYPE_quic_transport_parameters|. Use
|
||||
// |TLSEXT_TYPE_quic_transport_parameters| instead.
|
||||
// `TLSEXT_TYPE_quic_transport_parameters`. Use
|
||||
// `TLSEXT_TYPE_quic_transport_parameters` instead.
|
||||
#define TLSEXT_TYPE_quic_transport_parameters_standard \
|
||||
TLSEXT_TYPE_quic_transport_parameters
|
||||
|
||||
@@ -180,7 +180,7 @@ extern "C" {
|
||||
// The following constants are equal to TLS cipher suite values, OR-d with
|
||||
// 0x03000000. This is part of OpenSSL's SSL 2.0 legacy. SSL 2.0 has long since
|
||||
// been removed from BoringSSL.
|
||||
// TODO(davidben): Define these in terms of |SSL_CIPHER_*| constants. The
|
||||
// TODO(davidben): Define these in terms of `SSL_CIPHER_*` constants. The
|
||||
// challenge is that existing code expects them to be defined in tls1.h, so we
|
||||
// must first merge tls1.h into ssl.h.
|
||||
#define TLS1_CK_PSK_WITH_AES_128_CBC_SHA 0x0300008C
|
||||
@@ -208,15 +208,15 @@ extern "C" {
|
||||
#define TLS1_3_CK_AES_256_GCM_SHA384 0x03001302
|
||||
#define TLS1_3_CK_CHACHA20_POLY1305_SHA256 0x03001303
|
||||
|
||||
// The following constants are legacy aliases of |TLS1_3_CK_*|.
|
||||
// The following constants are legacy aliases of `TLS1_3_CK_*`.
|
||||
// TODO(davidben): Migrate callers to the new name and remove these.
|
||||
#define TLS1_CK_AES_128_GCM_SHA256 TLS1_3_CK_AES_128_GCM_SHA256
|
||||
#define TLS1_CK_AES_256_GCM_SHA384 TLS1_3_CK_AES_256_GCM_SHA384
|
||||
#define TLS1_CK_CHACHA20_POLY1305_SHA256 TLS1_3_CK_CHACHA20_POLY1305_SHA256
|
||||
|
||||
// The following constants are the OpenSSL names (see |SSL_CIPHER_get_name|) for
|
||||
// The following constants are the OpenSSL names (see `SSL_CIPHER_get_name`) for
|
||||
// various TLS ciphers. Prefer the standard name, returned from
|
||||
// |SSL_CIPHER_standard_name| and supported by |SSL_CTX_set_cipher_list|.
|
||||
// `SSL_CIPHER_standard_name` and supported by `SSL_CTX_set_cipher_list`.
|
||||
#define TLS1_TXT_PSK_WITH_AES_128_CBC_SHA "PSK-AES128-CBC-SHA"
|
||||
#define TLS1_TXT_PSK_WITH_AES_256_CBC_SHA "PSK-AES256-CBC-SHA"
|
||||
#define TLS1_TXT_ECDHE_PSK_WITH_AES_128_CBC_SHA "ECDHE-PSK-AES128-CBC-SHA"
|
||||
|
||||
@@ -27,10 +27,10 @@ extern "C" {
|
||||
// The TLS PRF is defined in Section 5 of RFC 5246.
|
||||
|
||||
|
||||
// CRYPTO_tls1_prf calculates |out_len| bytes of the TLS PRF, using |digest|,
|
||||
// and writes them to |out|. It is defined in Section 5 of RFC 5246, acting on
|
||||
// |secret_len| bytes of shared |secret|, |label_len| bytes of |label|,
|
||||
// |seed1_len| bytes of |seed1| and |seed2_len| bytes of |seed2|. It returns one
|
||||
// CRYPTO_tls1_prf calculates `out_len` bytes of the TLS PRF, using `digest`,
|
||||
// and writes them to `out`. It is defined in Section 5 of RFC 5246, acting on
|
||||
// `secret_len` bytes of shared `secret`, `label_len` bytes of `label`,
|
||||
// `seed1_len` bytes of `seed1` and `seed2_len` bytes of `seed2`. It returns one
|
||||
// on success and zero on error.
|
||||
OPENSSL_EXPORT int CRYPTO_tls1_prf(const EVP_MD *digest, uint8_t *out,
|
||||
size_t out_len, const uint8_t *secret,
|
||||
|
||||
@@ -67,25 +67,25 @@ struct trust_token_st {
|
||||
|
||||
DEFINE_STACK_OF(TRUST_TOKEN)
|
||||
|
||||
// TRUST_TOKEN_new creates a newly-allocated |TRUST_TOKEN| with value |data| or
|
||||
// TRUST_TOKEN_new creates a newly-allocated `TRUST_TOKEN` with value `data` or
|
||||
// NULL on allocation failure.
|
||||
OPENSSL_EXPORT TRUST_TOKEN *TRUST_TOKEN_new(const uint8_t *data, size_t len);
|
||||
|
||||
// TRUST_TOKEN_free releases memory associated with |token|.
|
||||
// TRUST_TOKEN_free releases memory associated with `token`.
|
||||
OPENSSL_EXPORT void TRUST_TOKEN_free(TRUST_TOKEN *token);
|
||||
|
||||
#define TRUST_TOKEN_MAX_PRIVATE_KEY_SIZE 512
|
||||
#define TRUST_TOKEN_MAX_PUBLIC_KEY_SIZE 512
|
||||
|
||||
// TRUST_TOKEN_generate_key creates a new Trust Token keypair labeled with |id|
|
||||
// TRUST_TOKEN_generate_key creates a new Trust Token keypair labeled with `id`
|
||||
// and serializes the private and public keys, writing the private key to
|
||||
// |out_priv_key| and setting |*out_priv_key_len| to the number of bytes
|
||||
// written, and writing the public key to |out_pub_key| and setting
|
||||
// |*out_pub_key_len| to the number of bytes written.
|
||||
// `out_priv_key` and setting `*out_priv_key_len` to the number of bytes
|
||||
// written, and writing the public key to `out_pub_key` and setting
|
||||
// `*out_pub_key_len` to the number of bytes written.
|
||||
//
|
||||
// At most |max_priv_key_len| and |max_pub_key_len| bytes are written. In order
|
||||
// At most `max_priv_key_len` and `max_pub_key_len` bytes are written. In order
|
||||
// to ensure success, these should be at least
|
||||
// |TRUST_TOKEN_MAX_PRIVATE_KEY_SIZE| and |TRUST_TOKEN_MAX_PUBLIC_KEY_SIZE|.
|
||||
// `TRUST_TOKEN_MAX_PRIVATE_KEY_SIZE` and `TRUST_TOKEN_MAX_PUBLIC_KEY_SIZE`.
|
||||
//
|
||||
// This function returns one on success or zero on error.
|
||||
OPENSSL_EXPORT int TRUST_TOKEN_generate_key(
|
||||
@@ -94,15 +94,15 @@ OPENSSL_EXPORT int TRUST_TOKEN_generate_key(
|
||||
size_t *out_pub_key_len, size_t max_pub_key_len, uint32_t id);
|
||||
|
||||
// TRUST_TOKEN_derive_key_from_secret deterministically derives a new Trust
|
||||
// Token keypair labeled with |id| from an input |secret| and serializes the
|
||||
// private and public keys, writing the private key to |out_priv_key| and
|
||||
// setting |*out_priv_key_len| to the number of bytes written, and writing the
|
||||
// public key to |out_pub_key| and setting |*out_pub_key_len| to the number of
|
||||
// Token keypair labeled with `id` from an input `secret` and serializes the
|
||||
// private and public keys, writing the private key to `out_priv_key` and
|
||||
// setting `*out_priv_key_len` to the number of bytes written, and writing the
|
||||
// public key to `out_pub_key` and setting `*out_pub_key_len` to the number of
|
||||
// bytes written.
|
||||
//
|
||||
// At most |max_priv_key_len| and |max_pub_key_len| bytes are written. In order
|
||||
// At most `max_priv_key_len` and `max_pub_key_len` bytes are written. In order
|
||||
// to ensure success, these should be at least
|
||||
// |TRUST_TOKEN_MAX_PRIVATE_KEY_SIZE| and |TRUST_TOKEN_MAX_PUBLIC_KEY_SIZE|.
|
||||
// `TRUST_TOKEN_MAX_PRIVATE_KEY_SIZE` and `TRUST_TOKEN_MAX_PUBLIC_KEY_SIZE`.
|
||||
//
|
||||
// This function returns one on success or zero on error.
|
||||
OPENSSL_EXPORT int TRUST_TOKEN_derive_key_from_secret(
|
||||
@@ -115,34 +115,34 @@ OPENSSL_EXPORT int TRUST_TOKEN_derive_key_from_secret(
|
||||
// Trust Token client implementation.
|
||||
//
|
||||
// These functions implements the client half of the Trust Token protocol. A
|
||||
// single |TRUST_TOKEN_CLIENT| can perform a single protocol operation.
|
||||
// single `TRUST_TOKEN_CLIENT` can perform a single protocol operation.
|
||||
|
||||
// TRUST_TOKEN_CLIENT_new returns a newly-allocated |TRUST_TOKEN_CLIENT|
|
||||
// configured to use a max batchsize of |max_batchsize| or NULL on error.
|
||||
// Issuance requests must be made in batches smaller than |max_batchsize|. This
|
||||
// function will return an error if |max_batchsize| is too large for Trust
|
||||
// TRUST_TOKEN_CLIENT_new returns a newly-allocated `TRUST_TOKEN_CLIENT`
|
||||
// configured to use a max batchsize of `max_batchsize` or NULL on error.
|
||||
// Issuance requests must be made in batches smaller than `max_batchsize`. This
|
||||
// function will return an error if `max_batchsize` is too large for Trust
|
||||
// Tokens.
|
||||
OPENSSL_EXPORT TRUST_TOKEN_CLIENT *TRUST_TOKEN_CLIENT_new(
|
||||
const TRUST_TOKEN_METHOD *method, size_t max_batchsize);
|
||||
|
||||
// TRUST_TOKEN_CLIENT_free releases memory associated with |ctx|.
|
||||
// TRUST_TOKEN_CLIENT_free releases memory associated with `ctx`.
|
||||
OPENSSL_EXPORT void TRUST_TOKEN_CLIENT_free(TRUST_TOKEN_CLIENT *ctx);
|
||||
|
||||
// TRUST_TOKEN_CLIENT_dup_for_testing returns a newly-allocated copy of |ctx|,
|
||||
// TRUST_TOKEN_CLIENT_dup_for_testing returns a newly-allocated copy of `ctx`,
|
||||
// or NULL on error. This may be useful for testing the library, e.g. to
|
||||
// benchmark an individual operation.
|
||||
//
|
||||
// WARNING: This function should never be used in production. A
|
||||
// |TRUST_TOKEN_CLIENT| maintains single-use state between
|
||||
// |TRUST_TOKEN_CLIENT_begin_issuance| and |TRUST_TOKEN_CLIENT_finish_issuance|
|
||||
// `TRUST_TOKEN_CLIENT` maintains single-use state between
|
||||
// `TRUST_TOKEN_CLIENT_begin_issuance` and `TRUST_TOKEN_CLIENT_finish_issuance`
|
||||
// operations. Cloning this state will cause tokens to be linkable and no longer
|
||||
// anonymized.
|
||||
OPENSSL_EXPORT TRUST_TOKEN_CLIENT *TRUST_TOKEN_CLIENT_dup_for_testing(
|
||||
const TRUST_TOKEN_CLIENT *ctx);
|
||||
|
||||
// TRUST_TOKEN_CLIENT_add_key configures the |ctx| to support the public key
|
||||
// |key|. It sets |*out_key_index| to the index this key has been configured to.
|
||||
// It returns one on success or zero on error if the |key| can't be parsed or
|
||||
// TRUST_TOKEN_CLIENT_add_key configures the `ctx` to support the public key
|
||||
// `key`. It sets `*out_key_index` to the index this key has been configured to.
|
||||
// It returns one on success or zero on error if the `key` can't be parsed or
|
||||
// too many keys have been configured.
|
||||
OPENSSL_EXPORT int TRUST_TOKEN_CLIENT_add_key(TRUST_TOKEN_CLIENT *ctx,
|
||||
size_t *out_key_index,
|
||||
@@ -154,10 +154,10 @@ OPENSSL_EXPORT int TRUST_TOKEN_CLIENT_add_key(TRUST_TOKEN_CLIENT *ctx,
|
||||
OPENSSL_EXPORT int TRUST_TOKEN_CLIENT_set_srr_key(TRUST_TOKEN_CLIENT *ctx,
|
||||
EVP_PKEY *key);
|
||||
|
||||
// TRUST_TOKEN_CLIENT_begin_issuance produces a request for |count| trust tokens
|
||||
// and serializes the request into a newly-allocated buffer, setting |*out| to
|
||||
// that buffer and |*out_len| to its length. The caller takes ownership of the
|
||||
// buffer and must call |OPENSSL_free| when done. It returns one on success and
|
||||
// TRUST_TOKEN_CLIENT_begin_issuance produces a request for `count` trust tokens
|
||||
// and serializes the request into a newly-allocated buffer, setting `*out` to
|
||||
// that buffer and `*out_len` to its length. The caller takes ownership of the
|
||||
// buffer and must call `OPENSSL_free` when done. It returns one on success and
|
||||
// zero on error.
|
||||
OPENSSL_EXPORT int TRUST_TOKEN_CLIENT_begin_issuance(TRUST_TOKEN_CLIENT *ctx,
|
||||
uint8_t **out,
|
||||
@@ -165,20 +165,20 @@ OPENSSL_EXPORT int TRUST_TOKEN_CLIENT_begin_issuance(TRUST_TOKEN_CLIENT *ctx,
|
||||
size_t count);
|
||||
|
||||
// TRUST_TOKEN_CLIENT_begin_issuance_over_message produces a request for a trust
|
||||
// token derived from |msg| and serializes the request into a newly-allocated
|
||||
// buffer, setting |*out| to that buffer and |*out_len| to its length. The
|
||||
// caller takes ownership of the buffer and must call |OPENSSL_free| when done.
|
||||
// token derived from `msg` and serializes the request into a newly-allocated
|
||||
// buffer, setting `*out` to that buffer and `*out_len` to its length. The
|
||||
// caller takes ownership of the buffer and must call `OPENSSL_free` when done.
|
||||
// It returns one on success and zero on error.
|
||||
OPENSSL_EXPORT int TRUST_TOKEN_CLIENT_begin_issuance_over_message(
|
||||
TRUST_TOKEN_CLIENT *ctx, uint8_t **out, size_t *out_len, size_t count,
|
||||
const uint8_t *msg, size_t msg_len);
|
||||
|
||||
// TRUST_TOKEN_CLIENT_finish_issuance consumes |response| from the issuer and
|
||||
// TRUST_TOKEN_CLIENT_finish_issuance consumes `response` from the issuer and
|
||||
// extracts the tokens, returning a list of tokens and the index of the key used
|
||||
// to sign the tokens in |*out_key_index|. The caller can use this to determine
|
||||
// to sign the tokens in `*out_key_index`. The caller can use this to determine
|
||||
// what key was used in an issuance and to drop tokens if a new key commitment
|
||||
// arrives without the specified key present. The caller takes ownership of the
|
||||
// list and must call |sk_TRUST_TOKEN_pop_free| when done. The list is empty if
|
||||
// list and must call `sk_TRUST_TOKEN_pop_free` when done. The list is empty if
|
||||
// issuance fails.
|
||||
OPENSSL_EXPORT STACK_OF(TRUST_TOKEN) *
|
||||
TRUST_TOKEN_CLIENT_finish_issuance(TRUST_TOKEN_CLIENT *ctx,
|
||||
@@ -188,23 +188,23 @@ OPENSSL_EXPORT STACK_OF(TRUST_TOKEN) *
|
||||
|
||||
|
||||
// TRUST_TOKEN_CLIENT_begin_redemption produces a request to redeem a token
|
||||
// |token| and receive a signature over |data| and serializes the request into
|
||||
// a newly-allocated buffer, setting |*out| to that buffer and |*out_len| to
|
||||
// its length. |time| is the number of seconds since the UNIX epoch and used to
|
||||
// `token` and receive a signature over `data` and serializes the request into
|
||||
// a newly-allocated buffer, setting `*out` to that buffer and `*out_len` to
|
||||
// its length. `time` is the number of seconds since the UNIX epoch and used to
|
||||
// verify the validity of the issuer's response in TrustTokenV1 and ignored in
|
||||
// other versions. The caller takes ownership of the buffer and must call
|
||||
// |OPENSSL_free| when done. It returns one on success or zero on error.
|
||||
// `OPENSSL_free` when done. It returns one on success or zero on error.
|
||||
OPENSSL_EXPORT int TRUST_TOKEN_CLIENT_begin_redemption(
|
||||
TRUST_TOKEN_CLIENT *ctx, uint8_t **out, size_t *out_len,
|
||||
const TRUST_TOKEN *token, const uint8_t *data, size_t data_len,
|
||||
uint64_t time);
|
||||
|
||||
// TRUST_TOKEN_CLIENT_finish_redemption consumes |response| from the issuer. In
|
||||
// |TRUST_TOKEN_experiment_v1|, it then verifies the SRR and if valid sets
|
||||
// |*out_rr| and |*out_rr_len| (respectively, |*out_sig| and |*out_sig_len|)
|
||||
// TRUST_TOKEN_CLIENT_finish_redemption consumes `response` from the issuer. In
|
||||
// `TRUST_TOKEN_experiment_v1`, it then verifies the SRR and if valid sets
|
||||
// `*out_rr` and `*out_rr_len` (respectively, `*out_sig` and `*out_sig_len`)
|
||||
// to a newly-allocated buffer containing the SRR (respectively, the SRR
|
||||
// signature). In other versions, it sets |*out_rr| and |*out_rr_len|
|
||||
// to a newly-allocated buffer containing |response| and leaves all validation
|
||||
// signature). In other versions, it sets `*out_rr` and `*out_rr_len`
|
||||
// to a newly-allocated buffer containing `response` and leaves all validation
|
||||
// to the caller. It returns one on success or zero on failure.
|
||||
OPENSSL_EXPORT int TRUST_TOKEN_CLIENT_finish_redemption(
|
||||
TRUST_TOKEN_CLIENT *ctx, uint8_t **out_rr, size_t *out_rr_len,
|
||||
@@ -215,26 +215,26 @@ OPENSSL_EXPORT int TRUST_TOKEN_CLIENT_finish_redemption(
|
||||
// Trust Token issuer implementation.
|
||||
//
|
||||
// These functions implement the issuer half of the Trust Token protocol. A
|
||||
// |TRUST_TOKEN_ISSUER| can be reused across multiple protocol operations. It
|
||||
// `TRUST_TOKEN_ISSUER` can be reused across multiple protocol operations. It
|
||||
// may be used concurrently on multiple threads by non-mutating functions,
|
||||
// provided no other thread is concurrently calling a mutating function.
|
||||
// Functions which take a |const| pointer are non-mutating and functions which
|
||||
// take a non-|const| pointer are mutating.
|
||||
// Functions which take a `const` pointer are non-mutating and functions which
|
||||
// take a non-`const` pointer are mutating.
|
||||
|
||||
// TRUST_TOKEN_ISSUER_new returns a newly-allocated |TRUST_TOKEN_ISSUER|
|
||||
// configured to use a max batchsize of |max_batchsize| or NULL on error.
|
||||
// Issuance requests must be made in batches smaller than |max_batchsize|. This
|
||||
// function will return an error if |max_batchsize| is too large for Trust
|
||||
// TRUST_TOKEN_ISSUER_new returns a newly-allocated `TRUST_TOKEN_ISSUER`
|
||||
// configured to use a max batchsize of `max_batchsize` or NULL on error.
|
||||
// Issuance requests must be made in batches smaller than `max_batchsize`. This
|
||||
// function will return an error if `max_batchsize` is too large for Trust
|
||||
// Tokens.
|
||||
OPENSSL_EXPORT TRUST_TOKEN_ISSUER *TRUST_TOKEN_ISSUER_new(
|
||||
const TRUST_TOKEN_METHOD *method, size_t max_batchsize);
|
||||
|
||||
// TRUST_TOKEN_ISSUER_free releases memory associated with |ctx|.
|
||||
// TRUST_TOKEN_ISSUER_free releases memory associated with `ctx`.
|
||||
OPENSSL_EXPORT void TRUST_TOKEN_ISSUER_free(TRUST_TOKEN_ISSUER *ctx);
|
||||
|
||||
// TRUST_TOKEN_ISSUER_add_key configures the |ctx| to support the private key
|
||||
// |key|. It must be a private key returned by |TRUST_TOKEN_generate_key|. It
|
||||
// returns one on success or zero on error. This function may fail if the |key|
|
||||
// TRUST_TOKEN_ISSUER_add_key configures the `ctx` to support the private key
|
||||
// `key`. It must be a private key returned by `TRUST_TOKEN_generate_key`. It
|
||||
// returns one on success or zero on error. This function may fail if the `key`
|
||||
// can't be parsed or too many keys have been configured.
|
||||
OPENSSL_EXPORT int TRUST_TOKEN_ISSUER_add_key(TRUST_TOKEN_ISSUER *ctx,
|
||||
const uint8_t *key,
|
||||
@@ -245,31 +245,31 @@ OPENSSL_EXPORT int TRUST_TOKEN_ISSUER_add_key(TRUST_TOKEN_ISSUER *ctx,
|
||||
OPENSSL_EXPORT int TRUST_TOKEN_ISSUER_set_srr_key(TRUST_TOKEN_ISSUER *ctx,
|
||||
EVP_PKEY *key);
|
||||
|
||||
// TRUST_TOKEN_ISSUER_issue ingests |request| for token issuance
|
||||
// and generates up to |max_issuance| valid tokens, producing a list of blinded
|
||||
// TRUST_TOKEN_ISSUER_issue ingests `request` for token issuance
|
||||
// and generates up to `max_issuance` valid tokens, producing a list of blinded
|
||||
// tokens and storing the response into a newly-allocated buffer and setting
|
||||
// |*out| to that buffer, |*out_len| to its length, and |*out_tokens_issued| to
|
||||
// `*out` to that buffer, `*out_len` to its length, and `*out_tokens_issued` to
|
||||
// the number of tokens issued. The tokens are issued with public metadata of
|
||||
// |public_metadata| and a private metadata value of |private_metadata|.
|
||||
// |public_metadata| must be one of the previously configured key IDs.
|
||||
// |private_metadata| must be 0 or 1. The caller takes ownership of the buffer
|
||||
// and must call |OPENSSL_free| when done. It returns one on success or zero on
|
||||
// `public_metadata` and a private metadata value of `private_metadata`.
|
||||
// `public_metadata` must be one of the previously configured key IDs.
|
||||
// `private_metadata` must be 0 or 1. The caller takes ownership of the buffer
|
||||
// and must call `OPENSSL_free` when done. It returns one on success or zero on
|
||||
// error.
|
||||
OPENSSL_EXPORT int TRUST_TOKEN_ISSUER_issue(
|
||||
const TRUST_TOKEN_ISSUER *ctx, uint8_t **out, size_t *out_len,
|
||||
size_t *out_tokens_issued, const uint8_t *request, size_t request_len,
|
||||
uint32_t public_metadata, uint8_t private_metadata, size_t max_issuance);
|
||||
|
||||
// TRUST_TOKEN_ISSUER_redeem ingests a |request| for token redemption and
|
||||
// verifies the token. The public metadata is stored in |*out_public|. The
|
||||
// private metadata (if any) is stored in |*out_private|. The extracted
|
||||
// |TRUST_TOKEN| is stored into a newly-allocated buffer and stored in
|
||||
// |*out_token|. The extracted client data is stored into a newly-allocated
|
||||
// buffer and stored in |*out_client_data|. The caller takes ownership of each
|
||||
// output buffer and must call |OPENSSL_free| when done. It returns one on
|
||||
// TRUST_TOKEN_ISSUER_redeem ingests a `request` for token redemption and
|
||||
// verifies the token. The public metadata is stored in `*out_public`. The
|
||||
// private metadata (if any) is stored in `*out_private`. The extracted
|
||||
// `TRUST_TOKEN` is stored into a newly-allocated buffer and stored in
|
||||
// `*out_token`. The extracted client data is stored into a newly-allocated
|
||||
// buffer and stored in `*out_client_data`. The caller takes ownership of each
|
||||
// output buffer and must call `OPENSSL_free` when done. It returns one on
|
||||
// success or zero on error.
|
||||
//
|
||||
// The caller must keep track of all values of |*out_token| seen globally before
|
||||
// The caller must keep track of all values of `*out_token` seen globally before
|
||||
// returning a response to the client. If the value has been reused, the caller
|
||||
// must report an error to the client. Returning a response with replayed values
|
||||
// allows an attacker to double-spend tokens.
|
||||
@@ -279,20 +279,20 @@ OPENSSL_EXPORT int TRUST_TOKEN_ISSUER_redeem(
|
||||
size_t *out_client_data_len, const uint8_t *request, size_t request_len);
|
||||
|
||||
// TRUST_TOKEN_ISSUER_redeem_raw is a legacy alias for
|
||||
// |TRUST_TOKEN_ISSUER_redeem|.
|
||||
// `TRUST_TOKEN_ISSUER_redeem`.
|
||||
#define TRUST_TOKEN_ISSUER_redeem_raw TRUST_TOKEN_ISSUER_redeem
|
||||
|
||||
// TRUST_TOKEN_ISSUER_redeem_over_message ingests a |request| for token
|
||||
// TRUST_TOKEN_ISSUER_redeem_over_message ingests a `request` for token
|
||||
// redemption and a message and verifies the token and that it is derived from
|
||||
// the provided |msg|. The public metadata is stored in
|
||||
// |*out_public|. The private metadata (if any) is stored in |*out_private|. The
|
||||
// extracted |TRUST_TOKEN| is stored into a newly-allocated buffer and stored in
|
||||
// |*out_token|. The extracted client data is stored into a newly-allocated
|
||||
// buffer and stored in |*out_client_data|. The caller takes ownership of each
|
||||
// output buffer and must call |OPENSSL_free| when done. It returns one on
|
||||
// the provided `msg`. The public metadata is stored in
|
||||
// `*out_public`. The private metadata (if any) is stored in `*out_private`. The
|
||||
// extracted `TRUST_TOKEN` is stored into a newly-allocated buffer and stored in
|
||||
// `*out_token`. The extracted client data is stored into a newly-allocated
|
||||
// buffer and stored in `*out_client_data`. The caller takes ownership of each
|
||||
// output buffer and must call `OPENSSL_free` when done. It returns one on
|
||||
// success or zero on error.
|
||||
//
|
||||
// The caller must keep track of all values of |*out_token| seen globally before
|
||||
// The caller must keep track of all values of `*out_token` seen globally before
|
||||
// returning a response to the client. If the value has been reused, the caller
|
||||
// must report an error to the client. Returning a response with replayed values
|
||||
// allows an attacker to double-spend tokens.
|
||||
@@ -302,10 +302,10 @@ OPENSSL_EXPORT int TRUST_TOKEN_ISSUER_redeem_over_message(
|
||||
size_t *out_client_data_len, const uint8_t *request, size_t request_len,
|
||||
const uint8_t *msg, size_t msg_len);
|
||||
|
||||
// TRUST_TOKEN_decode_private_metadata decodes |encrypted_bit| using the
|
||||
// private metadata key specified by a |key| buffer of length |key_len| and the
|
||||
// nonce by a |nonce| buffer of length |nonce_len|. The nonce in
|
||||
// |TRUST_TOKEN_experiment_v1| is the token-hash field of the SRR. |*out_value|
|
||||
// TRUST_TOKEN_decode_private_metadata decodes `encrypted_bit` using the
|
||||
// private metadata key specified by a `key` buffer of length `key_len` and the
|
||||
// nonce by a `nonce` buffer of length `nonce_len`. The nonce in
|
||||
// `TRUST_TOKEN_experiment_v1` is the token-hash field of the SRR. `*out_value`
|
||||
// is set to the decrypted value, either zero or one. It returns one on success
|
||||
// and zero on error.
|
||||
OPENSSL_EXPORT int TRUST_TOKEN_decode_private_metadata(
|
||||
|
||||
@@ -22,7 +22,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
// CHECKED_CAST casts |p| from type |from| to type |to|.
|
||||
// CHECKED_CAST casts `p` from type `from` to type `to`.
|
||||
//
|
||||
// TODO(davidben): Although this macro is not public API and is unused in
|
||||
// BoringSSL, wpa_supplicant uses it to define its own stacks. Remove this once
|
||||
|
||||
+1671
-1671
File diff suppressed because it is too large
Load Diff
@@ -46,7 +46,7 @@
|
||||
|
||||
// Deprecated constants.
|
||||
|
||||
// The following constants are legacy aliases for |X509v3_KU_*|. They are
|
||||
// The following constants are legacy aliases for `X509v3_KU_*`. They are
|
||||
// defined here instead of in <openssl/x509.h> because NSS's public headers use
|
||||
// the same symbols. Some callers have inadvertently relied on the conflicts
|
||||
// only being defined in this header.
|
||||
|
||||
+14
-14
@@ -54,29 +54,29 @@ struct XWING_private_key {
|
||||
|
||||
|
||||
// XWING_generate_key generates a random public/private key pair, writes the
|
||||
// encoded public key to |out_encoded_public_key| and the private key to
|
||||
// |out_private_key|. Returns one on success and zero on error.
|
||||
// encoded public key to `out_encoded_public_key` and the private key to
|
||||
// `out_private_key`. Returns one on success and zero on error.
|
||||
OPENSSL_EXPORT int XWING_generate_key(
|
||||
uint8_t out_encoded_public_key[XWING_PUBLIC_KEY_BYTES],
|
||||
struct XWING_private_key *out_private_key);
|
||||
|
||||
// XWING_public_from_private sets |out_encoded_public_key| to the public key
|
||||
// that corresponds to |private_key|. Returns one on success and zero on error.
|
||||
// XWING_public_from_private sets `out_encoded_public_key` to the public key
|
||||
// that corresponds to `private_key`. Returns one on success and zero on error.
|
||||
OPENSSL_EXPORT int XWING_public_from_private(
|
||||
uint8_t out_encoded_public_key[XWING_PUBLIC_KEY_BYTES],
|
||||
const struct XWING_private_key *private_key);
|
||||
|
||||
// XWING_encap encapsulates a random shared secret for |encoded_public_key|,
|
||||
// writes the ciphertext to |out_ciphertext|, and writes the random shared
|
||||
// secret to |out_shared_secret|. Returns one on success and zero on error.
|
||||
// XWING_encap encapsulates a random shared secret for `encoded_public_key`,
|
||||
// writes the ciphertext to `out_ciphertext`, and writes the random shared
|
||||
// secret to `out_shared_secret`. Returns one on success and zero on error.
|
||||
OPENSSL_EXPORT int XWING_encap(
|
||||
uint8_t out_ciphertext[XWING_CIPHERTEXT_BYTES],
|
||||
uint8_t out_shared_secret[XWING_SHARED_SECRET_BYTES],
|
||||
const uint8_t encoded_public_key[XWING_PUBLIC_KEY_BYTES]);
|
||||
|
||||
// XWING_encap_external_entropy encapsulates the shared secret for the given
|
||||
// |eseed| entropy using |encoded_public_key|, writes the ciphertext to
|
||||
// |out_ciphertext|, and writes the random shared secret to |out_shared_secret|.
|
||||
// `eseed` entropy using `encoded_public_key`, writes the ciphertext to
|
||||
// `out_ciphertext`, and writes the random shared secret to `out_shared_secret`.
|
||||
// Returns one on success and zero on error.
|
||||
OPENSSL_EXPORT int XWING_encap_external_entropy(
|
||||
uint8_t out_ciphertext[XWING_CIPHERTEXT_BYTES],
|
||||
@@ -84,8 +84,8 @@ OPENSSL_EXPORT int XWING_encap_external_entropy(
|
||||
const uint8_t encoded_public_key[XWING_PUBLIC_KEY_BYTES],
|
||||
const uint8_t eseed[64]);
|
||||
|
||||
// XWING_decap decapsulates a shared secret from |ciphertext| using
|
||||
// |private_key| and writes it to |out_shared_secret|. Returns one on success
|
||||
// XWING_decap decapsulates a shared secret from `ciphertext` using
|
||||
// `private_key` and writes it to `out_shared_secret`. Returns one on success
|
||||
// and zero on error.
|
||||
OPENSSL_EXPORT int XWING_decap(
|
||||
uint8_t out_shared_secret[XWING_SHARED_SECRET_BYTES],
|
||||
@@ -94,16 +94,16 @@ OPENSSL_EXPORT int XWING_decap(
|
||||
|
||||
// Serialisation of keys.
|
||||
|
||||
// XWING_marshal_private_key serializes |private_key| to |out| in the standard
|
||||
// XWING_marshal_private_key serializes `private_key` to `out` in the standard
|
||||
// format for X-Wing private keys. It returns one on success or zero on
|
||||
// allocation error.
|
||||
OPENSSL_EXPORT int XWING_marshal_private_key(
|
||||
CBB *out, const struct XWING_private_key *private_key);
|
||||
|
||||
// XWING_parse_private_key parses a private key in the standard format for
|
||||
// X-Wing private keys from |in| and writes the result to |out_public_key|. It
|
||||
// X-Wing private keys from `in` and writes the result to `out_public_key`. It
|
||||
// returns one on success or zero on parse error or if there are trailing bytes
|
||||
// in |in|.
|
||||
// in `in`.
|
||||
OPENSSL_EXPORT int XWING_parse_private_key(
|
||||
struct XWING_private_key *out_private_key, CBS *in);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user