Make some more API types opaquely available from ossl_typ.h, meaning the
authorGeoff Thorpe <geoff@openssl.org>
Sat, 15 May 2004 18:32:08 +0000 (18:32 +0000)
committerGeoff Thorpe <geoff@openssl.org>
Sat, 15 May 2004 18:32:08 +0000 (18:32 +0000)
corresponding headers are only required for API functions or structure
details. This now includes the bignum types and BUF_MEM. Subsequent commits
will remove various dependencies on bn.h and buffer.h and update the
makefile dependencies.

crypto/bn/bn.h
crypto/buffer/buffer.h
crypto/ossl_typ.h

index dac794b600b78cfc66c48df5aab6eb745cf6b674..0f6373aea9d33e69c21921768dda9940c3203799 100644 (file)
@@ -76,6 +76,7 @@
 #ifndef OPENSSL_NO_FP_API
 #include <stdio.h> /* FILE */
 #endif
+#include <openssl/ossl_typ.h>
 
 #ifdef  __cplusplus
 extern "C" {
@@ -248,10 +249,6 @@ extern "C" {
 
 #define BN_DEFAULT_BITS        1280
 
-#ifdef BIGNUM
-#undef BIGNUM
-#endif
-
 #define BN_FLG_MALLOCED                0x01
 #define BN_FLG_STATIC_DATA     0x02
 #ifndef OPENSSL_NO_DEPRECATED
@@ -260,7 +257,18 @@ extern "C" {
 #define BN_set_flags(b,n)      ((b)->flags|=(n))
 #define BN_get_flags(b,n)      ((b)->flags&(n))
 
-typedef struct bignum_st
+/* Already declared in ossl_typ.h */
+#if 0
+typedef struct bignum_st BIGNUM;
+/* Used for temp variables (declaration hidden in bn_lcl.h) */
+typedef struct bignum_ctx BN_CTX;
+typedef struct bn_blinding_st BN_BLINDING;
+typedef struct bn_mont_ctx_st BN_MONT_CTX;
+typedef struct bn_recp_ctx_st BN_RECP_CTX;
+typedef struct bn_gencb_st BN_GENCB;
+#endif
+
+struct bignum_st
        {
        BN_ULONG *d;    /* Pointer to an array of 'BN_BITS2' bit chunks. */
        int top;        /* Index of last used d +1. */
@@ -268,12 +276,9 @@ typedef struct bignum_st
        int dmax;       /* Size of the d array. */
        int neg;        /* one if the number is negative */
        int flags;
-       } BIGNUM;
-
-/* Used for temp variables (declaration hidden in bn_lcl.h) */
-typedef struct bignum_ctx BN_CTX;
+       };
 
-typedef struct bn_blinding_st
+struct bn_blinding_st
        {
        int init;
        BIGNUM *A;
@@ -281,10 +286,10 @@ typedef struct bn_blinding_st
        BIGNUM *mod; /* just a reference */
        unsigned long thread_id; /* added in OpenSSL 0.9.6j and 0.9.7b;
                                  * used only by crypto/rsa/rsa_eay.c, rsa_lib.c */
-       } BN_BLINDING;
+       };
 
 /* Used for montgomery multiplication */
-typedef struct bn_mont_ctx_st
+struct bn_mont_ctx_st
        {
        int ri;        /* number of bits in R */
        BIGNUM RR;     /* used to convert to montgomery form */
@@ -293,22 +298,21 @@ typedef struct bn_mont_ctx_st
                        * (Ni is only stored for bignum algorithm) */
        BN_ULONG n0;   /* least significant word of Ni */
        int flags;
-       } BN_MONT_CTX;
+       };
 
 /* Used for reciprocal division/mod functions
  * It cannot be shared between threads
  */
-typedef struct bn_recp_ctx_st
+struct bn_recp_ctx_st
        {
        BIGNUM N;       /* the divisor */
        BIGNUM Nr;      /* the reciprocal */
        int num_bits;
        int shift;
        int flags;
-       } BN_RECP_CTX;
+       };
 
 /* Used for slow "generation" functions. */
-typedef struct bn_gencb_st BN_GENCB;
 struct bn_gencb_st
        {
        unsigned int ver;       /* To handle binary (in)compatibility */
index 7f557c21c335511e9935a9d1e9da972529dac370..4b8eb7119d4565ce40a2dbf26e9d39c619c9fc8c 100644 (file)
@@ -59,6 +59,8 @@
 #ifndef HEADER_BUFFER_H
 #define HEADER_BUFFER_H
 
+#include <openssl/ossl_typ.h>
+
 #ifdef  __cplusplus
 extern "C" {
 #endif
@@ -69,12 +71,15 @@ extern "C" {
 #include <sys/types.h>
 #endif
 
-typedef struct buf_mem_st
+/* Already declared in ossl_typ.h */
+/* typedef struct buf_mem_st BUF_MEM; */
+
+struct buf_mem_st
        {
        int length;     /* current number of bytes */
        char *data;
        int max;        /* size of buffer */
-       } BUF_MEM;
+       };
 
 BUF_MEM *BUF_MEM_new(void);
 void   BUF_MEM_free(BUF_MEM *a);
index 41a055861746962b8297a50b07b580c7235834f8..86399c4ec0f1892ccd6b3409af7ca666a35faf6d 100644 (file)
@@ -101,6 +101,18 @@ typedef int ASN1_NULL;
 #undef PKCS7_ISSUER_AND_SERIAL
 #endif
 
+#ifdef BIGNUM
+#undef BIGNUM
+#endif
+typedef struct bignum_st BIGNUM;
+typedef struct bignum_ctx BN_CTX;
+typedef struct bn_blinding_st BN_BLINDING;
+typedef struct bn_mont_ctx_st BN_MONT_CTX;
+typedef struct bn_recp_ctx_st BN_RECP_CTX;
+typedef struct bn_gencb_st BN_GENCB;
+
+typedef struct buf_mem_st BUF_MEM;
+
 typedef struct evp_cipher_st EVP_CIPHER;
 typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
 typedef struct env_md_st EVP_MD;