Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

acert: fix holder entityName parsing. #8166

Merged
merged 2 commits into from
Nov 15, 2024

Conversation

philljj
Copy link
Contributor

@philljj philljj commented Nov 8, 2024

Description

  • Fix holder entityName parsing.
  • Add better testing on holder fields.
  • Some light cleanup, more comments, and better debug logging.
  • Add X509_ACERT_new, wolfSSL_X509_ACERT_new_ex, and wolfSSL_X509_ACERT_sign (stub) test.

Fixes zd#18889.

Testing

Printing before:

$./test/test_acert -f certs/acert_ietf.pem -p
...
        Holder:
            Issuer: CN=CA
            Serial Number: 2 (0x2)
        Issuer: CN=Attribute Certificate Issuer
...

Printing after:

$./test/test_acert -f certs/acert_ietf.pem -p
...
        Holder:
            Name: CN=server.example
            Issuer: CN=CA
            Serial Number: 2 (0x2)
        Issuer: CN=Attribute Certificate Issuer
...

@philljj philljj self-assigned this Nov 8, 2024
@philljj
Copy link
Contributor Author

philljj commented Nov 9, 2024

Retest this please.

@SparkiDev
Copy link
Contributor

Can you please add test cases for:
wolfSSL_X509_ACERT_new and
wolfSSL_X509_ACERT_sign.

Thanks!

@philljj philljj assigned wolfSSL-Bot and unassigned philljj Nov 13, 2024
dgarske
dgarske previously approved these changes Nov 15, 2024
@dgarske
Copy link
Contributor

dgarske commented Nov 15, 2024

@philljj Please resolve merge conflicts.

Copy link
Contributor

@dgarske dgarske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few minor things.

};

enum {
HOLDER_IDX_SEQ = 0,
HOLDER_IDX_ISSUERSERIAL_SEQ,
HOLDER_IDX_GN_SEQ,
HOLDER_IDX_SERIAL_INT,
HOLDER_IDX_GN_SEQ_OPT1
HOLDER_IDX_GN_SEQ_OPT1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a rebase artifact. Please remove the last trailing ,. Thanks.

wolfcrypt/src/asn.c Show resolved Hide resolved

ret = DecodeAcertGeneralNames(gn_input, gn_len, cert,
if (gn_len >= ASN_LONG_LENGTH) { gn_len += 3; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please expand these lines...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

i_issuer = (dataASN[ACERT_IDX_ACINFO_ISSUER_V2].tag != 0) ?
ACERT_IDX_ACINFO_ISSUER_V2 : ACERT_IDX_ACINFO_ISSUER_V1;

#ifdef WOLFSSL_DEBUG_ASN_TEMPLATE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you intend to leave these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to keep these if ok, because some of the example acerts have non-standard holder or issuer fields.

@philljj philljj requested a review from dgarske November 15, 2024 22:20
@philljj philljj removed their assignment Nov 15, 2024
@dgarske dgarske merged commit ada922b into wolfSSL:master Nov 15, 2024
143 checks passed
@philljj philljj deleted the fix_holder_entityname branch November 18, 2024 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants