]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
crypto/{cmp,crmf}/: clean up unneeded #include directives
authorDr. David von Oheimb <dev@ddvo.net>
Wed, 26 Feb 2025 17:56:21 +0000 (18:56 +0100)
committerTomas Mraz <tomas@openssl.org>
Mon, 11 Aug 2025 14:33:59 +0000 (16:33 +0200)
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/28035)

15 files changed:
crypto/cmp/cmp_asn.c
crypto/cmp/cmp_client.c
crypto/cmp/cmp_ctx.c
crypto/cmp/cmp_hdr.c
crypto/cmp/cmp_http.c
crypto/cmp/cmp_local.h
crypto/cmp/cmp_msg.c
crypto/cmp/cmp_protect.c
crypto/cmp/cmp_server.c
crypto/cmp/cmp_status.c
crypto/cmp/cmp_vfy.c
crypto/crmf/crmf_asn.c
crypto/crmf/crmf_lib.c
crypto/crmf/crmf_local.h
crypto/crmf/crmf_pbm.c

index a326320267438bcee0ac5c10632c833b2471ccb7..a2d3d3a8493b099f2c82d4fbcfb97581ce9630a4 100644 (file)
 #include "cmp_local.h"
 #include "internal/crmf.h"
 
-/* explicit #includes not strictly needed since implied by the above: */
-#include <openssl/cmp.h>
-#include <openssl/crmf.h>
-
 /* ASN.1 declarations from RFC4210 */
 ASN1_SEQUENCE(OSSL_CMP_REVANNCONTENT) = {
     /* OSSL_CMP_PKISTATUS is effectively ASN1_INTEGER so it is used directly */
index e129705e0e638acb0d48a541e79426f0ad1d515e..2001414241c186ea8b39cf54819a75772e721541 100644 (file)
  */
 
 #include "cmp_local.h"
-#include "internal/cryptlib.h"
-
-/* explicit #includes not strictly needed since implied by the above: */
-#include <openssl/bio.h>
-#include <openssl/cmp.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <openssl/x509v3.h>
-#include <openssl/cmp_util.h>
 
 #define IS_CREP(t) ((t) == OSSL_CMP_PKIBODY_IP || (t) == OSSL_CMP_PKIBODY_CP \
                         || (t) == OSSL_CMP_PKIBODY_KUP)
index 7b78ab16036bcd761ddb625d23d0bfb75dbf9ccb..c61969872729ab4316a1c5ed627a16e1afc131e6 100644 (file)
@@ -9,16 +9,8 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <openssl/trace.h>
-#include <openssl/bio.h>
-#include <openssl/ocsp.h> /* for OCSP_REVOKED_STATUS_* */
-
 #include "cmp_local.h"
-
-/* explicit #includes not strictly needed since implied by the above: */
-#include <openssl/cmp.h>
-#include <openssl/crmf.h>
-#include <openssl/err.h>
+#include <openssl/ocsp.h> /* for OCSP_REVOKED_STATUS_* */
 
 #define DEFINE_OSSL_CMP_CTX_get0(FIELD, TYPE) \
     DEFINE_OSSL_CMP_CTX_get0_NAME(FIELD, FIELD, TYPE)
index 74e97afe0f20678c00f71f85ca81684a1058edb4..51ce908f38929be1ccc67fb8d942a1a94ff2bf1a 100644 (file)
 /* CMP functions for PKIHeader handling */
 
 #include "cmp_local.h"
-
-#include <openssl/rand.h>
-
-/* explicit #includes not strictly needed since implied by the above: */
-#include <openssl/asn1t.h>
-#include <openssl/cmp.h>
-#include <openssl/err.h>
+#include <openssl/rand.h> /* for RAND_bytes_ex() */
 
 int ossl_cmp_hdr_set_pvno(OSSL_CMP_PKIHEADER *hdr, int pvno)
 {
index d20ea618d84f6e2b8999ff7dcdf6bfc682a0514c..809763e84613b052edb7d4dc05fdaed1f3eed32a 100644 (file)
@@ -9,23 +9,8 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <string.h>
-#include <stdio.h>
-
-#include <openssl/asn1t.h>
-#include <openssl/http.h>
-
-#include <openssl/cmp.h>
 #include "cmp_local.h"
 
-/* explicit #includes not strictly needed since implied by the above: */
-#include <ctype.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <openssl/bio.h>
-#include <openssl/buffer.h>
-#include <openssl/err.h>
-
 static int keep_alive(int keep_alive, int body_type, BIO **bios)
 {
     if (keep_alive != 0 && bios == NULL
index bbca4e0ac56568d08878ecc6d2624281aaf97b35..e4185834b5c14f89ea39466b9d50e4e22d801944 100644 (file)
 #ifndef OSSL_CRYPTO_CMP_LOCAL_H
 # define OSSL_CRYPTO_CMP_LOCAL_H
 
-# include "internal/cryptlib.h"
-
 # include <openssl/cmp.h>
-# include <openssl/err.h>
-
-/* explicit #includes not strictly needed since implied by the above: */
-# include <openssl/crmf.h>
-# include <openssl/types.h>
-# include <openssl/safestack.h>
-# include <openssl/x509.h>
-# include <openssl/x509v3.h>
 # include "crypto/x509.h"
+# include "internal/cryptlib.h"
 
 # define IS_NULL_DN(name) (X509_NAME_get_entry(name, 0) == NULL)
 
index 055f14c8f861a0e8687cba33f9bac755955bf3bc..a3b6258f526ed851d8964f7a2118a007ae49c1cb 100644 (file)
 
 #include "cmp_local.h"
 
-/* explicit #includes not strictly needed since implied by the above: */
-#include <openssl/asn1t.h>
-#include <openssl/cmp.h>
-#include <openssl/crmf.h>
-#include <openssl/err.h>
-#include <openssl/x509.h>
-#include <openssl/pem.h>
-#include <openssl/bio.h>
-#include <internal/cms.h>
+#include <internal/cms.h> /* for ossl_cms_sign_encrypt() */
 
 OSSL_CMP_MSG *OSSL_CMP_MSG_new(OSSL_LIB_CTX *libctx, const char *propq)
 {
index f325c4505f543b3e2c4e25eefdce7e63fa9a81ee..173b9ac55a03736bbe52389ab76ba6fc3ae3a04e 100644 (file)
  */
 
 #include "cmp_local.h"
-#include "crypto/asn1.h"
-
-/* explicit #includes not strictly needed since implied by the above: */
-#include <openssl/asn1t.h>
-#include <openssl/cmp.h>
-#include <openssl/crmf.h>
-#include <openssl/err.h>
-#include <openssl/x509.h>
+#include "crypto/asn1.h" /* for ossl_X509_ALGOR_from_nid() */
 
 /*
  * This function is also used by the internal verify_PBMAC() in cmp_vfy.c.
index 6a833f83c5385bf150a05ce7f06fcc03bf48fee1..f4fed6743fa8f6691b4e6bde4498340f0ecc7b51 100644 (file)
 
 /* general CMP server functions */
 
-#include <openssl/asn1t.h>
-
 #include "cmp_local.h"
 
-/* explicit #includes not strictly needed since implied by the above: */
-#include <openssl/cmp.h>
-#include <openssl/err.h>
-
 /* the context for the generic CMP server */
 struct ossl_cmp_srv_ctx_st {
     OSSL_CMP_CTX *ctx; /* CMP client context reused for transactionID etc. */
index b9086d84f8462d806bf3d7084ea828fa6ba582d1..80849983089c02f9e76dbed13c7664f8ec80c37b 100644 (file)
 
 /* CMP functions for PKIStatusInfo handling and PKIMessage decomposition */
 
-#include <string.h>
-
 #include "cmp_local.h"
 
-/* explicit #includes not strictly needed since implied by the above: */
-#include <time.h>
-#include <openssl/cmp.h>
-#include <openssl/crmf.h>
-#include <openssl/err.h> /* needed in case config no-deprecated */
-#include <openssl/engine.h>
-#include <openssl/evp.h>
-#include <openssl/objects.h>
-#include <openssl/x509.h>
-#include <openssl/asn1err.h> /* for ASN1_R_TOO_SMALL and ASN1_R_TOO_LARGE */
-
 /* CMP functions related to PKIStatus */
 
 int ossl_cmp_pkisi_get_status(const OSSL_CMP_PKISI *si)
index 47bf38b2af5dab9cbae70f71569476373dc663fc..fa1d9668b1ea9361bbecc81ca3bc25a66008f481 100644 (file)
 /* CMP functions for PKIMessage checking */
 
 #include "cmp_local.h"
-#include <openssl/cmp_util.h>
-
-/* explicit #includes not strictly needed since implied by the above: */
-#include <openssl/asn1t.h>
-#include <openssl/cmp.h>
-#include <openssl/crmf.h>
-#include <openssl/err.h>
-#include <openssl/x509.h>
 
 /* Verify a message protected by signature according to RFC section 5.1.3.3 */
 static int verify_signature(const OSSL_CMP_CTX *cmp_ctx,
index a4a0ff1b172d4432420967638b4ffdd05e7ab409..fb3f85a653bce2b4006f5e39c1348bdd84c8b538 100644 (file)
  */
 
 #include <openssl/asn1t.h>
-
 #include "crmf_local.h"
 
-/* explicit #includes not strictly needed since implied by the above: */
-#include <openssl/crmf.h>
-
 ASN1_SEQUENCE(OSSL_CRMF_PRIVATEKEYINFO) = {
     ASN1_SIMPLE(OSSL_CRMF_PRIVATEKEYINFO, version, ASN1_INTEGER),
     ASN1_SIMPLE(OSSL_CRMF_PRIVATEKEYINFO, privateKeyAlgorithm, X509_ALGOR),
index 8238496e73803bbb0636434b788fb720552d695b..68432e530060e70e25e9d8d7537ffda837d4eb01 100644 (file)
  * cases increases its link count) in the parent and so both should be freed up.
  */
 
-#include <openssl/asn1t.h>
-
 #include "crmf_local.h"
+#include <openssl/asn1t.h>
 #include "internal/constant_time.h"
-#include "internal/sizes.h"
-#include "crypto/evp.h"
-#include "crypto/x509.h"
-
-/* explicit #includes not strictly needed since implied by the above: */
-#include <openssl/crmf.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <openssl/cms.h>
+#include "internal/sizes.h" /* for OSSL_MAX_NAME_SIZE */
+#include "crypto/x509.h" /* for ossl_x509_check_private_key() */
 
 /*-
  * atyp = Attribute Type
index 1cda2cb39eb508c7e41ef64f6d0f50746217a9b3..d193368bd383a20389e212b37cd927e8f90bf324 100644 (file)
 #ifndef OSSL_CRYPTO_CRMF_LOCAL_H
 # define OSSL_CRYPTO_CRMF_LOCAL_H
 
-# include <openssl/crmf.h>
-# include <openssl/cms.h> /* for CMS_EnvelopedData and CMS_SignedData */
-# include <openssl/err.h>
-# include "internal/crmf.h" /* for ossl_crmf_attributetypeandvalue_st */
-
-/* explicit #includes not strictly needed since implied by the above: */
-# include <openssl/types.h>
-# include <openssl/safestack.h>
-# include <openssl/x509.h>
-# include <openssl/x509v3.h>
+# include "internal/crmf.h"
 
 /*-
  * EncryptedValue ::= SEQUENCE {
index e65a3886f7232c90bf788b90e3f9ba081cf833c0..83f2c3163ec645fa5a83ed6466d4a8775e9e8f45 100644 (file)
  * CRMF implementation by Martin Peylo, Miikka Viljanen, and David von Oheimb.
  */
 
-#include <string.h>
-
-#include <openssl/rand.h>
-#include <openssl/evp.h>
-#include <openssl/hmac.h>
-
-/* explicit #includes not strictly needed since implied by the above: */
-#include <openssl/asn1t.h>
-#include <openssl/crmf.h>
-#include <openssl/err.h>
-#include <openssl/params.h>
-#include <openssl/core_names.h>
-
-#include "internal/sizes.h"
-
 #include "crmf_local.h"
+#include <openssl/rand.h> /* for RAND_bytes_ex() */
+#include "internal/sizes.h" /* for OSSL_MAX_NAME_SIZE */
+#include <openssl/err.h>
 
 /*-
  * creates and initializes OSSL_CRMF_PBMPARAMETER (section 4.4)