[Bug 276960] /usr/include/*_asn1.h have unexpected target-dependent differences

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 24 Apr 2024 21:29:58 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=276960

--- Comment #5 from commit-hook@FreeBSD.org ---
A commit in branch stable/13 references this bug:

URL:
https://cgit.FreeBSD.org/src/commit/?id=2efe30782cd92ef975eb4d05c53bac1d8a7e9f46

commit 2efe30782cd92ef975eb4d05c53bac1d8a7e9f46
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-04-16 18:56:37 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-04-24 21:26:47 +0000

    heimdal: Add 64-bit integer support to ASN.1 compiler

    Import upstream 19d378f44:

      ASN.1 INTEGERs will now compile to C int64_t or uint64_t, depending
      on whether the constraint ranges include numbers that cannot be
      represented in 32-bit ints and whether they include negative
      numbers.

      Template backend support included.  check-template is now built with
      --template, so we know we're testing it.

      Tests included.

    Also adjusts the generated files:
    * asn1parse.c, asn1parse.h (not strictly necessary, but nice to have)
    * der-protos.h, which needs a bunch of new prototypes. I copied these
      from a der-protos.h generated by the upstream build system, which
      uses a perl script for this.
    * adjust printf format strings for int64_t. Upstream uses %lld for this,
      but that is not portable, and leads to lots of -Werror warnings.

    This should fix target-dependent differences between headers generated
    by asn1_compile. For example, when cross compiling world from amd64 to
    i386, the generated cms_asn1.h header has:

      CMSRC2CBCParameter ::= SEQUENCE {
        rc2ParameterVersion   INTEGER (0..-1),
        iv                    OCTET STRING,
      }

    while a native build on i386 has:

      CMSRC2CBCParameter ::= SEQUENCE {
        rc2ParameterVersion   INTEGER (0..2147483647),
        iv                    OCTET STRING,
      }

    These are _both_ wrong, since the source file, cms.asn1, has:

      CMSRC2CBCParameter ::= SEQUENCE {
              rc2ParameterVersion   INTEGER (0..4294967295),
              iv                    OCTET STRING -- exactly 8 octets
      }

    PR:             276960
    Reviewed by:    cy, emaste
    MFC after:      1 week
    Differential Revision: https://reviews.freebsd.org/D44814
    Differential Revision: https://reviews.freebsd.org/D44815

    (cherry picked from commit 1b7487592987c91020063a311a14dc15b6e58075)

 crypto/heimdal/lib/asn1/Makefile.am     |  12 +++-
 crypto/heimdal/lib/asn1/asn1-template.h |   2 +
 crypto/heimdal/lib/asn1/asn1parse.c     |   6 +-
 crypto/heimdal/lib/asn1/asn1parse.h     |   2 +-
 crypto/heimdal/lib/asn1/asn1parse.y     |   6 +-
 crypto/heimdal/lib/asn1/check-gen.c     | 120 ++++++++++++++++++++++++++++++++
 crypto/heimdal/lib/asn1/der-protos.h    |  50 +++++++++++++
 crypto/heimdal/lib/asn1/der_copy.c      |  14 ++++
 crypto/heimdal/lib/asn1/der_free.c      |  12 ++++
 crypto/heimdal/lib/asn1/der_get.c       |  45 +++++++++++-
 crypto/heimdal/lib/asn1/der_length.c    |  57 +++++++++++++++
 crypto/heimdal/lib/asn1/der_put.c       |  72 +++++++++++++++++++
 crypto/heimdal/lib/asn1/gen.c           |  20 +++---
 crypto/heimdal/lib/asn1/gen_decode.c    |  18 ++---
 crypto/heimdal/lib/asn1/gen_encode.c    |  12 ++--
 crypto/heimdal/lib/asn1/gen_length.c    |  12 ++--
 crypto/heimdal/lib/asn1/gen_template.c  |  22 +++---
 crypto/heimdal/lib/asn1/lex.l           |   2 +-
 crypto/heimdal/lib/asn1/symbol.h        |  10 ++-
 crypto/heimdal/lib/asn1/template.c      |   2 +
 crypto/heimdal/lib/asn1/test.asn1       |   2 +
 21 files changed, 446 insertions(+), 52 deletions(-)

-- 
You are receiving this mail because:
You are the assignee for the bug.