diff options
author | Daniel Fiala <daniel@openssl.org> | 2022-06-20 18:40:30 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-06-27 10:58:40 +0200 |
commit | 59196250cb45ecd128d2f8bbc47de612167606d3 (patch) | |
tree | 87629f973c88b5f3da5fe0651549bad9d30c45af | |
parent | 48320997b49b07b5abadec89c7fbe5d5f3d41da4 (diff) |
der_writer: Use uint32_t instead of long.
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18615)
-rw-r--r-- | crypto/der_writer.c | 12 | ||||
-rw-r--r-- | doc/internal/man3/ossl_DER_w_bn.pod | 6 | ||||
-rw-r--r-- | doc/internal/man7/DERlib.pod | 2 | ||||
-rw-r--r-- | include/internal/der.h | 2 | ||||
-rw-r--r-- | providers/common/der/der_rsa_key.c | 4 |
5 files changed, 13 insertions, 13 deletions
diff --git a/crypto/der_writer.c b/crypto/der_writer.c index c6fd4c4298..bd330785f9 100644 --- a/crypto/der_writer.c +++ b/crypto/der_writer.c @@ -106,11 +106,11 @@ static int int_der_w_integer(WPACKET *pkt, int tag, && int_end_context(pkt, tag); } -static int int_put_bytes_ulong(WPACKET *pkt, const void *v, +static int int_put_bytes_uint32(WPACKET *pkt, const void *v, unsigned int *top_byte) { - const unsigned long *value = v; - unsigned long tmp = *value; + const uint32_t *value = v; + uint32_t tmp = *value; size_t n = 0; while (tmp != 0) { @@ -125,9 +125,9 @@ static int int_put_bytes_ulong(WPACKET *pkt, const void *v, } /* For integers, we only support unsigned values for now */ -int ossl_DER_w_ulong(WPACKET *pkt, int tag, unsigned long v) +int ossl_DER_w_uint32(WPACKET *pkt, int tag, uint32_t v) { - return int_der_w_integer(pkt, tag, int_put_bytes_ulong, &v); + return int_der_w_integer(pkt, tag, int_put_bytes_uint32, &v); } static int int_put_bytes_bn(WPACKET *pkt, const void *v, @@ -153,7 +153,7 @@ int ossl_DER_w_bn(WPACKET *pkt, int tag, const BIGNUM *v) if (v == NULL || BN_is_negative(v)) return 0; if (BN_is_zero(v)) - return ossl_DER_w_ulong(pkt, tag, 0); + return ossl_DER_w_uint32(pkt, tag, 0); return int_der_w_integer(pkt, tag, int_put_bytes_bn, v); } diff --git a/doc/internal/man3/ossl_DER_w_bn.pod b/doc/internal/man3/ossl_DER_w_bn.pod index a5bdd848bf..3d67067a9e 100644 --- a/doc/internal/man3/ossl_DER_w_bn.pod +++ b/doc/internal/man3/ossl_DER_w_bn.pod @@ -2,7 +2,7 @@ =head1 NAME -ossl_DER_w_boolean, ossl_DER_w_ulong, ossl_DER_w_bn, ossl_DER_w_null, +ossl_DER_w_boolean, ossl_DER_w_uint32, ossl_DER_w_bn, ossl_DER_w_null, ossl_DER_w_octet_string, ossl_DER_w_octet_string_uint32 - internal DER writers for DER primitives @@ -11,7 +11,7 @@ ossl_DER_w_octet_string, ossl_DER_w_octet_string_uint32 #include "internal/der.h" int ossl_DER_w_boolean(WPACKET *pkt, int tag, int b); - int ossl_DER_w_ulong(WPACKET *pkt, int tag, unsigned long v); + int ossl_DER_w_uint32(WPACKET *pkt, int tag, uint32_t v); int ossl_DER_w_bn(WPACKET *pkt, int tag, const BIGNUM *v); int ossl_DER_w_null(WPACKET *pkt, int tag); int ossl_DER_w_octet_string(WPACKET *pkt, int tag, @@ -29,7 +29,7 @@ ossl_DER_w_boolean() writes the primitive BOOLEAN using the value I<b>. Any value that evaluates as true will render a B<true> BOOLEAN, otherwise a B<false> BOOLEAN. -ossl_DER_w_ulong() and ossl_DER_w_bn() both write the primitive INTEGER using +ossl_DER_w_uint32() and ossl_DER_w_bn() both write the primitive INTEGER using the value I<v>. =for comment Other similar functions for diverse C integers should be diff --git a/doc/internal/man7/DERlib.pod b/doc/internal/man7/DERlib.pod index 3129a9b74d..f4f3abab51 100644 --- a/doc/internal/man7/DERlib.pod +++ b/doc/internal/man7/DERlib.pod @@ -118,7 +118,7 @@ value: { return ossl_DER_w_begin_sequence(pkt, tag) && (ossl_DER_w_begin_sequence(pkt, DER_NO_CONTEXT) - && ossl_DER_w_ulong(pkt, 2, 20) + && ossl_DER_w_uint32(pkt, 2, 20) && ossl_DER_w_precompiled(pkt, 1, der_mgf1SHA256Identifier, sizeof(der_mgf1SHA256Identifier)) diff --git a/include/internal/der.h b/include/internal/der.h index 86b0d936e0..8d6db8f066 100644 --- a/include/internal/der.h +++ b/include/internal/der.h @@ -78,7 +78,7 @@ int ossl_DER_w_precompiled(WPACKET *pkt, int tag, size_t precompiled_n); int ossl_DER_w_boolean(WPACKET *pkt, int tag, int b); -int ossl_DER_w_ulong(WPACKET *pkt, int tag, unsigned long v); +int ossl_DER_w_uint32(WPACKET *pkt, int tag, uint32_t v); int ossl_DER_w_bn(WPACKET *pkt, int tag, const BIGNUM *v); int ossl_DER_w_null(WPACKET *pkt, int tag); int ossl_DER_w_octet_string(WPACKET *pkt, int tag, diff --git a/providers/common/der/der_rsa_key.c b/providers/common/der/der_rsa_key.c index e1c078b906..4bad32ee6d 100644 --- a/providers/common/der/der_rsa_key.c +++ b/providers/common/der/der_rsa_key.c @@ -347,8 +347,8 @@ int ossl_DER_w_RSASSA_PSS_params(WPACKET *pkt, int tag, return ossl_DER_w_begin_sequence(pkt, tag) && (trailerfield == default_trailerfield - || ossl_DER_w_ulong(pkt, 3, trailerfield)) - && (saltlen == default_saltlen || ossl_DER_w_ulong(pkt, 2, saltlen)) + || ossl_DER_w_uint32(pkt, 3, trailerfield)) + && (saltlen == default_saltlen || ossl_DER_w_uint32(pkt, 2, saltlen)) && DER_w_MaskGenAlgorithm(pkt, 1, pss) && (hashalg_nid == default_hashalg_nid || ossl_DER_w_precompiled(pkt, 0, hashalg, hashalg_sz)) |