]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
RSA-PSS: When printing parameters, always print the trailerfield ASN.1 value
authorRichard Levitte <levitte@openssl.org>
Wed, 24 Mar 2021 18:51:01 +0000 (19:51 +0100)
committerRichard Levitte <levitte@openssl.org>
Fri, 26 Mar 2021 10:25:48 +0000 (11:25 +0100)
The legacy implementation would print the ASN.1 value of the trailerfield,
except when it wasn't set (i.e. is default).

For better consistency, we now always print the ASN.1 value, both in the
legacy and the provided implementation.

Fixes #14363

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14676)

crypto/rsa/rsa_ameth.c
providers/implementations/encode_decode/encode_key2text.c

index 067b7db12dda6c36191ff47a761f8da6f3eef6fe..7a747a33efab3c00b2e54f844c02a10742a34746 100644 (file)
@@ -280,7 +280,7 @@ static int rsa_pss_param_print(BIO *bp, int pss_key, RSA_PSS_PARAMS *pss,
     if (pss->trailerField) {
         if (i2a_ASN1_INTEGER(bp, pss->trailerField) <= 0)
             goto err;
-    } else if (BIO_puts(bp, "BC (default)") <= 0) {
+    } else if (BIO_puts(bp, "01 (default)") <= 0) {
         goto err;
     }
     BIO_puts(bp, "\n");
index f913a9bb149411e730c80758f2e807882966676a..9bdbe526569cce26aaf2e70415e941465169e487 100644 (file)
@@ -764,13 +764,6 @@ static int rsa_to_text(BIO *out, const void *key, int selection)
                                saltlen,
                                (saltlen == 20 ? " (default)" : "")) <= 0)
                     goto err;
-                /*
-                 * TODO(3.0) Should we show the ASN.1 trailerField value, or
-                 * the actual trailerfield byte (i.e. 0xBC for 1)?
-                 * crypto/rsa/rsa_ameth.c isn't very clear on that, as it
-                 * does display 0xBC when the default applies, but the ASN.1
-                 * trailerField value otherwise...
-                 */
                 if (BIO_printf(out, "  Trailer Field: 0x%x%s\n",
                                trailerfield,
                                (trailerfield == 1 ? " (default)" : "")) <= 0)