Resolve TODOs in signature implementations.
authorTomas Mraz <tomas@openssl.org>
Fri, 26 Feb 2021 17:28:48 +0000 (18:28 +0100)
committerPauli <ppzgs1@gmail.com>
Wed, 3 Mar 2021 00:00:21 +0000 (10:00 +1000)
The DER writing errors can be ignored safely.

Document that the EVP_MAX_MD_SIZE is a hardcoded limit
for digest sizes.

Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14367)

doc/man7/provider-digest.pod
providers/implementations/signature/dsa.c
providers/implementations/signature/eddsa.c
providers/implementations/signature/sm2sig.c

index 4f90cf8b620db22fcef7e683ea799d8b7e96e1be..a0327a85df4d6a7a418f2264521ebd60a73c9414 100644 (file)
@@ -249,6 +249,12 @@ OSSL_FUNC_digest_size() should return the digest size.
 OSSL_FUNC_digest_block_size() should return the block size of the underlying digest
 algorithm.
 
+=head1 BUGS
+
+The EVP_Digest() and EVP_DigestFinal_ex() libcrypto API calls do not
+expect the digest size to be larger than EVP_MAX_MD_SIZE. Any algorithm which
+produces larger digests is unusable with those API calls.
+
 =head1 SEE ALSO
 
 L<provider(7)>, L<OSSL_PROVIDER-FIPS(7)>, L<OSSL_PROVIDER-default(7)>,
index 81e435c4198a5a8f09027a2297b9b5b7daa5fe89..eadf62361a8c83ae7b701a978666e420954a3ce4 100644 (file)
@@ -148,7 +148,7 @@ static int dsa_setup_md(PROV_DSA_CTX *ctx,
         EVP_MD_free(ctx->md);
 
         /*
-         * TODO(3.0) Should we care about DER writing errors?
+         * We do not care about DER writing errors.
          * All it really means is that for some reason, there's no
          * AlgorithmIdentifier to be had, but the operation itself is
          * still valid, just as long as it's not used to construct
@@ -313,7 +313,7 @@ int dsa_digest_sign_final(void *vpdsactx, unsigned char *sig, size_t *siglen,
      */
     if (sig != NULL) {
         /*
-         * TODO(3.0): There is the possibility that some externally provided
+         * There is the possibility that some externally provided
          * digests exceed EVP_MAX_MD_SIZE. We should probably handle that somehow -
          * but that problem is much larger than just in DSA.
          */
@@ -338,7 +338,7 @@ int dsa_digest_verify_final(void *vpdsactx, const unsigned char *sig,
         return 0;
 
     /*
-     * TODO(3.0): There is the possibility that some externally provided
+     * There is the possibility that some externally provided
      * digests exceed EVP_MAX_MD_SIZE. We should probably handle that somehow -
      * but that problem is much larger than just in DSA.
      */
index 71b57d70ea737784e6cf70beac5cd9efb9941759..93b98dbbbc321eaef8107f018ee0b216f29dea35 100644 (file)
@@ -105,7 +105,7 @@ static int eddsa_digest_signverify_init(void *vpeddsactx, const char *mdname,
     }
 
     /*
-     * TODO(3.0) Should we care about DER writing errors?
+     * We do not care about DER writing errors.
      * All it really means is that for some reason, there's no
      * AlgorithmIdentifier to be had, but the operation itself is
      * still valid, just as long as it's not used to construct
index d12c7191fb008e433741be900c15e60903acaeed..18fdf62487730c59450fe5443e8848a9124052ef 100644 (file)
@@ -192,7 +192,7 @@ static int sm2sig_digest_signverify_init(void *vpsm2ctx, const char *mdname,
         goto error;
 
     /*
-     * TODO(3.0) Should we care about DER writing errors?
+     * We do not care about DER writing errors.
      * All it really means is that for some reason, there's no
      * AlgorithmIdentifier to be had, but the operation itself is
      * still valid, just as long as it's not used to construct