Make some more API types opaquely available from ossl_typ.h, meaning the

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.
This commit is contained in:
Geoff Thorpe 2004-05-15 18:32:08 +00:00
parent 7771b6c5b5
commit d6dda126b7
3 changed files with 39 additions and 18 deletions

View 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 */

View 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);

View 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;