# undef OPENSSL_ALGORITHM_DEFINES
#endif
+#include <openssl/types.h>
+
#ifndef OPENSSL_NO_BIO
#include <openssl/bio.h>
#endif
-#if 0
-#ifndef OPENSSL_NO_MD2
-#include <openssl/md2.h>
-#endif
-#ifndef OPENSSL_NO_MD4
-#include <openssl/md4.h>
-#endif
-#ifndef OPENSSL_NO_MD5
-#include <openssl/md5.h>
-#endif
-#ifndef OPENSSL_NO_SHA
-#include <openssl/sha.h>
-#endif
-#ifndef OPENSSL_NO_RIPEMD
-#include <openssl/ripemd.h>
-#endif
-#ifndef OPENSSL_NO_DES
-#include <openssl/des.h>
-#endif
-#ifndef OPENSSL_NO_RC4
-#include <openssl/rc4.h>
-#endif
-#ifndef OPENSSL_NO_RC2
-#include <openssl/rc2.h>
-#endif
-#ifndef OPENSSL_NO_RC5
-#include <openssl/rc5.h>
-#endif
-#ifndef OPENSSL_NO_BF
-#include <openssl/blowfish.h>
-#endif
-#ifndef OPENSSL_NO_CAST
-#include <openssl/cast.h>
-#endif
-#ifndef OPENSSL_NO_IDEA
-#include <openssl/idea.h>
-#endif
-#ifndef OPENSSL_NO_MDC2
-#include <openssl/mdc2.h>
-#endif
-#ifndef OPENSSL_NO_AES
-#include <openssl/rijndael.h>
-#endif
-#endif // 0
/*
#define EVP_RC2_KEY_SIZE 16
/* Default PKCS#5 iteration count */
#define PKCS5_DEFAULT_ITER 2048
-#ifndef OPENSSL_NO_RSA
-#include <openssl/rsa.h>
-#endif
-
-#ifndef OPENSSL_NO_DSA
-#include <openssl/dsa.h>
-#endif
-
-#ifndef OPENSSL_NO_DH
-#include <openssl/dh.h>
-#endif
-
#include <openssl/objects.h>
#define EVP_PK_RSA 0x0001
/* Type needs to be a bit field
* Sub-type needs to be for variations on the method, as in, can it do
* arbitrary encryption.... */
-typedef struct evp_pkey_st
+struct evp_pkey_st
{
int type;
int save_type;
} pkey;
int save_parameters;
STACK_OF(X509_ATTRIBUTE) *attributes; /* [ 0 ] */
- } EVP_PKEY;
+ } /* EVP_PKEY */;
#define EVP_PKEY_MO_SIGN 0x0001
#define EVP_PKEY_MO_VERIFY 0x0002
#endif
#ifndef EVP_MD
-typedef struct env_md_st
+struct env_md_st
{
int type;
int pkey_type;
int required_pkey_type[5]; /*EVP_PKEY_xxx */
int block_size;
int ctx_size; /* how big does the ctx->md_data need to be */
- } EVP_MD;
+ } /* EVP_MD */;
typedef struct env_md_ctx_st
{
const EVP_MD *digest;
-#if 0
- union {
- unsigned char base[4];
-#ifndef OPENSSL_NO_MD2
- MD2_CTX md2;
-#endif
-#ifndef OPENSSL_NO_MD5
- MD5_CTX md5;
-#endif
-#ifndef OPENSSL_NO_MD4
- MD4_CTX md4;
-#endif
-#ifndef OPENSSL_NO_RIPEMD
- RIPEMD160_CTX ripemd160;
-#endif
-#ifndef OPENSSL_NO_SHA
- SHA_CTX sha;
-#endif
-#ifndef OPENSSL_NO_MDC2
- MDC2_CTX mdc2;
-#endif
- } md;
-#endif
void *md_data;
} EVP_MD_CTX;
-typedef struct evp_cipher_st EVP_CIPHER;
-typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
-
struct evp_cipher_st
{
int nid;
int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */
int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */
void *app_data; /* Application data */
- };
+ } /* EVP_CIPHER */;
/* Values for cipher flags */
void *app_data; /* application stuff */
int key_len; /* May change for variable length cipher */
unsigned long flags; /* Various flags */
-#if 0
- union
- {
-#ifndef OPENSSL_NO_RC4
- struct
- {
- unsigned char key[EVP_RC4_KEY_SIZE];
- RC4_KEY ks; /* working key */
- } rc4;
-#endif
-#ifndef OPENSSL_NO_DES
- des_key_schedule des_ks;/* key schedule */
- struct
- {
- des_key_schedule ks;/* key schedule */
- des_cblock inw;
- des_cblock outw;
- } desx_cbc;
- struct
- {
- des_key_schedule ks1;/* key schedule */
- des_key_schedule ks2;/* key schedule (for ede) */
- des_key_schedule ks3;/* key schedule (for ede3) */
- } des_ede;
-#endif
-#ifndef OPENSSL_NO_IDEA
- IDEA_KEY_SCHEDULE idea_ks;/* key schedule */
-#endif
-#ifndef OPENSSL_NO_RC2
- struct
- {
- int key_bits; /* effective key bits */
- RC2_KEY ks;/* key schedule */
- } rc2;
-#endif
-#ifndef OPENSSL_NO_RC5
- struct
- {
- int rounds; /* number of rounds */
- RC5_32_KEY ks;/* key schedule */
- } rc5;
-#endif
-#ifndef OPENSSL_NO_BF
- BF_KEY bf_ks;/* key schedule */
-#endif
-#ifndef OPENSSL_NO_CAST
- CAST_KEY cast_ks;/* key schedule */
-#endif
-#ifndef OPENSSL_NO_AES
- RIJNDAEL_KEY rijndael;
-#endif
-#ifdef OPENSSL_OPENBSD_DEV_CRYPTO
- struct session_op *dev_crypto;
-#endif
- } c;
-#endif // 0
void *cipher_data; /* per EVP data */
int final_used;
int block_mask;
unsigned char final[EVP_MAX_BLOCK_LENGTH];/* possible final block */
- };
+ } /* EVP_CIPHER_CTX */;
typedef struct evp_Encode_Ctx_st
{
#define EVP_MD_CTX_type(e) EVP_MD_type((e)->digest)
#define EVP_CIPHER_nid(e) ((e)->nid)
+#define EVP_CIPHER_name(e) OBJ_nid2sn(EVP_CIPHER_nid(e))
#define EVP_CIPHER_block_size(e) ((e)->block_size)
#define EVP_CIPHER_key_length(e) ((e)->key_len)
#define EVP_CIPHER_iv_length(e) ((e)->iv_len)
#define EVP_delete_digest_alias(alias) \
OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS);
-
void EVP_MD_CTX_init(EVP_MD_CTX *ctx);
int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);
EVP_MD_CTX *EVP_MD_CTX_create(void);
int datal, int count, unsigned char *key,unsigned char *iv);
int EVP_EncryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type,
- unsigned char *key, unsigned char *iv);
+ const unsigned char *key, const unsigned char *iv);
int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
- int *outl, unsigned char *in, int inl);
+ int *outl, const unsigned char *in, int inl);
int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);
int EVP_DecryptInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type,
- unsigned char *key, unsigned char *iv);
+ const unsigned char *key, const unsigned char *iv);
int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
- int *outl, unsigned char *in, int inl);
+ int *outl, const unsigned char *in, int inl);
int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
int EVP_CipherInit(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *type,
- unsigned char *key,unsigned char *iv,int enc);
+ const unsigned char *key,const unsigned char *iv,
+ int enc);
int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
- int *outl, unsigned char *in, int inl);
+ int *outl, const unsigned char *in, int inl);
int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);
int EVP_SignFinal(EVP_MD_CTX *ctx,unsigned char *md,unsigned int *s,
int EVP_PKEY_bits(EVP_PKEY *pkey);
int EVP_PKEY_size(EVP_PKEY *pkey);
int EVP_PKEY_assign(EVP_PKEY *pkey,int type,char *key);
+
#ifndef OPENSSL_NO_RSA
-int EVP_PKEY_set1_RSA(EVP_PKEY *pkey,RSA *key);
-RSA * EVP_PKEY_get1_RSA(EVP_PKEY *pkey);
+struct rsa_st;
+int EVP_PKEY_set1_RSA(EVP_PKEY *pkey,struct rsa_st *key);
+struct rsa_st *EVP_PKEY_get1_RSA(EVP_PKEY *pkey);
#endif
#ifndef OPENSSL_NO_DSA
-int EVP_PKEY_set1_DSA(EVP_PKEY *pkey,DSA *key);
-DSA * EVP_PKEY_get1_DSA(EVP_PKEY *pkey);
+struct dsa_st;
+int EVP_PKEY_set1_DSA(EVP_PKEY *pkey,struct dsa_st *key);
+struct dsa_st *EVP_PKEY_get1_DSA(EVP_PKEY *pkey);
#endif
#ifndef OPENSSL_NO_DH
-int EVP_PKEY_set1_DH(EVP_PKEY *pkey,DH *key);
-DH * EVP_PKEY_get1_DH(EVP_PKEY *pkey);
+struct dh_st;
+int EVP_PKEY_set1_DH(EVP_PKEY *pkey,struct dh_st *key);
+struct dh_st *EVP_PKEY_get1_DH(EVP_PKEY *pkey);
#endif
+
+
EVP_PKEY * EVP_PKEY_new(void);
void EVP_PKEY_free(EVP_PKEY *pkey);
EVP_PKEY * d2i_PublicKey(int type,EVP_PKEY **a, unsigned char **pp,