heimdal: asn1: Use unsigned bitfields for named bitsets

Import upstream 6747e1628:

  asn1: Use unsigned bitfields for named bitsets

  Signed 1-bit bitfields are undefined in C.

This should fix the following warnings, which for unknown reasons are
errors in CI:

  /usr/src/crypto/heimdal/lib/hx509/ca.c:1020:22: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
   1020 |         ku.digitalSignature = 1;
        |                             ^ ~
  /usr/src/crypto/heimdal/lib/hx509/ca.c:1021:21: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
   1021 |         ku.keyEncipherment = 1;
        |                            ^ ~
  /usr/src/crypto/heimdal/lib/hx509/ca.c:1028:17: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
   1028 |         ku.keyCertSign = 1;
        |                        ^ ~
  /usr/src/crypto/heimdal/lib/hx509/ca.c:1029:13: warning: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
   1029 |         ku.cRLSign = 1;
        |                    ^ ~

PR:		276960
Fixes:		1b74875929
MFC after:	1 week
This commit is contained in:
Dimitry Andric 2024-04-17 19:49:30 +02:00
parent 1b74875929
commit 219b6e4423

View file

@ -727,10 +727,10 @@ define_type (int level, const char *name, const char *basename, Type *t, int typ
fprintf (headerfile, "int64_t %s;\n", name);
} else if (t->range->min >= 0 && t->range->max > UINT_MAX) {
fprintf (headerfile, "uint64_t %s;\n", name);
} else if (t->range->min >= INT_MIN && t->range->max <= INT_MAX) {
fprintf (headerfile, "int %s;\n", name);
} else if (t->range->min >= 0 && t->range->max <= UINT_MAX) {
fprintf (headerfile, "unsigned int %s;\n", name);
} else if (t->range->min >= INT_MIN && t->range->max <= INT_MAX) {
fprintf (headerfile, "int %s;\n", name);
} else
errx(1, "%s: unsupported range %" PRId64 " -> %" PRId64 "",
name, t->range->min, t->range->max);