Skip to content

Commit

Permalink
Reorganize private crypto header files
Browse files Browse the repository at this point in the history
Currently, there are two different directories which contain internal
header files of libcrypto which are meant to be shared internally:

While header files in 'include/internal' are intended to be shared
between libcrypto and libssl, the files in 'crypto/include/internal'
are intended to be shared inside libcrypto only.

To make things complicated, the include search path is set up in such
a way that the directive #include "internal/file.h" could refer to
a file in either of these two directoroes. This makes it necessary
in some cases to add a '_int.h' suffix to some files to resolve this
ambiguity:

  #include "internal/file.h"      # located in 'include/internal'
  #include "internal/file_int.h"  # located in 'crypto/include/internal'

This commit moves the private crypto headers from

  'crypto/include/internal'  to  'include/crypto'

As a result, the include directives become unambiguous

  #include "internal/file.h"       # located in 'include/internal'
  #include "crypto/file.h"         # located in 'include/crypto'

hence the superfluous '_int.h' suffixes can be stripped.

The files 'store_int.h' and 'store.h' need to be treated specially;
they are joined into a single file.

Reviewed-by: Richard Levitte <[email protected]>
(Merged from openssl#9333)
  • Loading branch information
mspncp committed Sep 28, 2019
1 parent ea8e1fe commit 25f2138
Show file tree
Hide file tree
Showing 329 changed files with 398 additions and 406 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Makefile

# Auto generated headers
/crypto/buildinf.h
/crypto/include/internal/*_conf.h
/include/crypto/*_conf.h
/openssl/include/opensslconf.h
/util/domd

Expand Down
14 changes: 7 additions & 7 deletions build.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
SUBDIRS=crypto ssl apps test util tools fuzz engines providers

LIBS=libcrypto libssl
INCLUDE[libcrypto]=. crypto/include include
INCLUDE[libcrypto]=. include
INCLUDE[libssl]=. include
DEPEND[libssl]=libcrypto

# Empty DEPEND "indices" means the dependencies are expected to be built
# unconditionally before anything else.
DEPEND[]=include/openssl/opensslconf.h crypto/include/internal/bn_conf.h \
crypto/include/internal/dso_conf.h doc/man7/openssl_user_macros.pod
DEPEND[]=include/openssl/opensslconf.h include/crypto/bn_conf.h \
include/crypto/dso_conf.h doc/man7/openssl_user_macros.pod
DEPEND[include/openssl/opensslconf.h]=configdata.pm
GENERATE[include/openssl/opensslconf.h]=include/openssl/opensslconf.h.in
DEPEND[crypto/include/internal/bn_conf.h]=configdata.pm
GENERATE[crypto/include/internal/bn_conf.h]=crypto/include/internal/bn_conf.h.in
DEPEND[crypto/include/internal/dso_conf.h]=configdata.pm
GENERATE[crypto/include/internal/dso_conf.h]=crypto/include/internal/dso_conf.h.in
DEPEND[include/crypto/bn_conf.h]=configdata.pm
GENERATE[include/crypto/bn_conf.h]=include/crypto/bn_conf.h.in
DEPEND[include/crypto/dso_conf.h]=configdata.pm
GENERATE[include/crypto/dso_conf.h]=include/crypto/dso_conf.h.in
DEPEND[doc/man7/openssl_user_macros.pod]=configdata.pm
GENERATE[doc/man7/openssl_user_macros.pod]=doc/man7/openssl_user_macros.pod.in

Expand Down
2 changes: 1 addition & 1 deletion crypto/aria/aria.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/

#include <openssl/e_os2.h>
#include "internal/aria.h"
#include "crypto/aria.h"

#include <assert.h>
#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion crypto/asn1/a_d2i_fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "internal/numbers.h"
#include <openssl/buffer.h>
#include <openssl/asn1.h>
#include "internal/asn1_int.h"
#include "crypto/asn1.h"

#ifndef NO_OLD_ASN1
# ifndef OPENSSL_NO_STDIO
Expand Down
2 changes: 1 addition & 1 deletion crypto/asn1/a_mbstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

#include <stdio.h>
#include "internal/ctype.h"
#include "crypto/ctype.h"
#include "internal/cryptlib.h"
#include <openssl/asn1.h>

Expand Down
4 changes: 2 additions & 2 deletions crypto/asn1/a_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

#include <stdio.h>
#include <limits.h>
#include "internal/ctype.h"
#include "crypto/ctype.h"
#include "internal/cryptlib.h"
#include <openssl/buffer.h>
#include <openssl/asn1.h>
#include <openssl/objects.h>
#include <openssl/bn.h>
#include "internal/asn1_int.h"
#include "crypto/asn1.h"
#include "asn1_locl.h"

int i2d_ASN1_OBJECT(const ASN1_OBJECT *a, unsigned char **pp)
Expand Down
2 changes: 1 addition & 1 deletion crypto/asn1/a_print.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

#include <stdio.h>
#include "internal/ctype.h"
#include "crypto/ctype.h"
#include "internal/cryptlib.h"
#include <openssl/asn1.h>

Expand Down
4 changes: 2 additions & 2 deletions crypto/asn1/a_sign.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include <openssl/x509.h>
#include <openssl/objects.h>
#include <openssl/buffer.h>
#include "internal/asn1_int.h"
#include "internal/evp_int.h"
#include "crypto/asn1.h"
#include "crypto/evp.h"

#ifndef NO_ASN1_OLD

Expand Down
2 changes: 1 addition & 1 deletion crypto/asn1/a_strex.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <stdio.h>
#include <string.h>
#include "internal/cryptlib.h"
#include "internal/asn1_int.h"
#include "crypto/asn1.h"
#include <openssl/crypto.h>
#include <openssl/x509.h>
#include <openssl/asn1.h>
Expand Down
2 changes: 1 addition & 1 deletion crypto/asn1/a_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <stdio.h>
#include <time.h>
#include "internal/ctype.h"
#include "crypto/ctype.h"
#include "internal/cryptlib.h"
#include <openssl/asn1t.h>
#include "asn1_locl.h"
Expand Down
4 changes: 2 additions & 2 deletions crypto/asn1/a_verify.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include <openssl/objects.h>
#include <openssl/buffer.h>
#include <openssl/evp.h>
#include "internal/asn1_int.h"
#include "internal/evp_int.h"
#include "crypto/asn1.h"
#include "crypto/evp.h"

#ifndef NO_ASN1_OLD

Expand Down
4 changes: 2 additions & 2 deletions crypto/asn1/ameth_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include <openssl/asn1t.h>
#include <openssl/x509.h>
#include <openssl/engine.h>
#include "internal/asn1_int.h"
#include "internal/evp_int.h"
#include "crypto/asn1.h"
#include "crypto/evp.h"

#include "standard_methods.h"

Expand Down
4 changes: 2 additions & 2 deletions crypto/asn1/asn_mime.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
*/

#include <stdio.h>
#include "internal/ctype.h"
#include "crypto/ctype.h"
#include "internal/cryptlib.h"
#include <openssl/rand.h>
#include <openssl/x509.h>
#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include "internal/evp_int.h"
#include "crypto/evp.h"
#include "internal/bio.h"
#include "asn1_locl.h"

Expand Down
6 changes: 3 additions & 3 deletions crypto/asn1/asn_moid.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
*/

#include <stdio.h>
#include "internal/ctype.h"
#include "crypto/ctype.h"
#include <openssl/crypto.h>
#include "internal/cryptlib.h"
#include <openssl/conf.h>
#include <openssl/x509.h>
#include "internal/asn1_int.h"
#include "internal/objects.h"
#include "crypto/asn1.h"
#include "crypto/objects.h"

/* Simple ASN1 OID module: add all objects in a given section */

Expand Down
4 changes: 2 additions & 2 deletions crypto/asn1/d2i_param.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include "internal/cryptlib.h"
#include <openssl/evp.h>
#include <openssl/asn1.h>
#include "internal/evp_int.h"
#include "internal/asn1_int.h"
#include "crypto/evp.h"
#include "crypto/asn1.h"

EVP_PKEY *d2i_KeyParams(int type, EVP_PKEY **a, const unsigned char **pp,
long length)
Expand Down
4 changes: 2 additions & 2 deletions crypto/asn1/d2i_pr.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include <openssl/engine.h>
#include <openssl/x509.h>
#include <openssl/asn1.h>
#include "internal/asn1_int.h"
#include "internal/evp_int.h"
#include "crypto/asn1.h"
#include "crypto/evp.h"

EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
long length)
Expand Down
2 changes: 1 addition & 1 deletion crypto/asn1/d2i_pu.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <openssl/dsa.h>
#include <openssl/ec.h>

#include "internal/evp_int.h"
#include "crypto/evp.h"

EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, const unsigned char **pp,
long length)
Expand Down
2 changes: 1 addition & 1 deletion crypto/asn1/f_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

#include <stdio.h>
#include "internal/ctype.h"
#include "crypto/ctype.h"
#include "internal/cryptlib.h"
#include <openssl/buffer.h>
#include <openssl/asn1.h>
Expand Down
2 changes: 1 addition & 1 deletion crypto/asn1/f_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

#include <stdio.h>
#include "internal/ctype.h"
#include "crypto/ctype.h"
#include "internal/cryptlib.h"
#include <openssl/buffer.h>
#include <openssl/asn1.h>
Expand Down
4 changes: 2 additions & 2 deletions crypto/asn1/i2d_param.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/asn1.h>
#include "internal/asn1_int.h"
#include "internal/evp_int.h"
#include "crypto/asn1.h"
#include "crypto/evp.h"

int i2d_KeyParams(const EVP_PKEY *a, unsigned char **pp)
{
Expand Down
4 changes: 2 additions & 2 deletions crypto/asn1/i2d_pr.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#include "internal/cryptlib.h"
#include <openssl/evp.h>
#include <openssl/x509.h>
#include "internal/asn1_int.h"
#include "internal/evp_int.h"
#include "crypto/asn1.h"
#include "crypto/evp.h"

int i2d_PrivateKey(const EVP_PKEY *a, unsigned char **pp)
{
Expand Down
2 changes: 1 addition & 1 deletion crypto/asn1/p8_pkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "internal/cryptlib.h"
#include <openssl/asn1t.h>
#include <openssl/x509.h>
#include "internal/x509_int.h"
#include "crypto/x509.h"

/* Minor tweak to operation: zero private key data */
static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
Expand Down
2 changes: 1 addition & 1 deletion crypto/asn1/t_pkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "internal/cryptlib.h"
#include <openssl/objects.h>
#include <openssl/buffer.h>
#include "internal/bn_int.h"
#include "crypto/bn.h"

/* Number of octets per line */
#define ASN1_BUF_PRINT_WIDTH 15
Expand Down
2 changes: 1 addition & 1 deletion crypto/asn1/tasn_enc.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include <openssl/objects.h>
#include "internal/asn1_int.h"
#include "crypto/asn1.h"
#include "asn1_locl.h"

static int asn1_i2d_ex_primitive(const ASN1_VALUE **pval, unsigned char **out,
Expand Down
2 changes: 1 addition & 1 deletion crypto/asn1/tasn_prn.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <openssl/buffer.h>
#include <openssl/err.h>
#include <openssl/x509v3.h>
#include "internal/asn1_int.h"
#include "crypto/asn1.h"
#include "asn1_locl.h"

/*
Expand Down
2 changes: 1 addition & 1 deletion crypto/asn1/x_algor.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <openssl/x509.h>
#include <openssl/asn1.h>
#include <openssl/asn1t.h>
#include "internal/evp_int.h"
#include "crypto/evp.h"

ASN1_SEQUENCE(X509_ALGOR) = {
ASN1_SIMPLE(X509_ALGOR, algorithm, ASN1_OBJECT),
Expand Down
2 changes: 1 addition & 1 deletion crypto/asn1/x_sig.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "internal/cryptlib.h"
#include <openssl/asn1t.h>
#include <openssl/x509.h>
#include "internal/x509_int.h"
#include "crypto/x509.h"

ASN1_SEQUENCE(X509_SIG) = {
ASN1_SIMPLE(X509_SIG, algor, X509_ALGOR),
Expand Down
2 changes: 1 addition & 1 deletion crypto/asn1_dsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include <openssl/crypto.h>
#include <openssl/bn.h>
#include "internal/asn1_dsa.h"
#include "crypto/asn1_dsa.h"
#include "internal/packet.h"

#define ID_SEQUENCE 0x30
Expand Down
2 changes: 1 addition & 1 deletion crypto/async/async.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include "async_locl.h"

#include <openssl/err.h>
#include "internal/cryptlib_int.h"
#include "crypto/cryptlib.h"
#include <string.h>

#define ASYNC_JOB_RUNNING 0
Expand Down
2 changes: 1 addition & 1 deletion crypto/async/async_locl.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# include <windows.h>
#endif

#include "internal/async.h"
#include "crypto/async.h"
#include <openssl/crypto.h>

typedef struct async_ctx_st async_ctx;
Expand Down
2 changes: 1 addition & 1 deletion crypto/bio/b_print.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <stdio.h>
#include <string.h>
#include "internal/cryptlib.h"
#include "internal/ctype.h"
#include "crypto/ctype.h"
#include "internal/numbers.h"
#include <openssl/bio.h>

Expand Down
2 changes: 1 addition & 1 deletion crypto/blake2/m_blake2b.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# include <stddef.h>
# include <openssl/obj_mac.h>
# include "internal/evp_int.h"
# include "crypto/evp.h"
# include "internal/blake2.h"

static int init(EVP_MD_CTX *ctx)
Expand Down
2 changes: 1 addition & 1 deletion crypto/blake2/m_blake2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# include <stddef.h>
# include <openssl/obj_mac.h>
# include "internal/evp_int.h"
# include "crypto/evp.h"
# include "internal/blake2.h"

static int init(EVP_MD_CTX *ctx)
Expand Down
2 changes: 1 addition & 1 deletion crypto/bn/bn_conv.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

#include <openssl/err.h>
#include "internal/ctype.h"
#include "crypto/ctype.h"
#include "bn_lcl.h"

static const char Hex[] = "0123456789ABCDEF";
Expand Down
2 changes: 1 addition & 1 deletion crypto/bn/bn_dh.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#ifndef OPENSSL_NO_DH
#include <openssl/dh.h>
#include "internal/bn_dh.h"
#include "crypto/bn_dh.h"
/* DH parameters from RFC5114 */

# if BN_BITS2 == 64
Expand Down
4 changes: 2 additions & 2 deletions crypto/bn/bn_lcl.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
# include <openssl/opensslconf.h>

# if !defined(OPENSSL_SYS_UEFI)
# include "internal/bn_conf.h"
# include "crypto/bn_conf.h"
# endif

# include "internal/bn_int.h"
# include "crypto/bn.h"

/*
* These preprocessor symbols control various aspects of the bignum headers
Expand Down
2 changes: 1 addition & 1 deletion crypto/bn/bn_rand.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <stdio.h>
#include <time.h>
#include "internal/cryptlib.h"
#include "internal/rand_int.h"
#include "crypto/rand.h"
#include "bn_lcl.h"
#include <openssl/rand.h>
#include <openssl/sha.h>
Expand Down
Loading

0 comments on commit 25f2138

Please sign in to comment.