Commit 0e360199 authored by Ben Laurie's avatar Ben Laurie
Browse files

Add EVP test program.

parent 354c3ace
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -12,6 +12,9 @@
         *) applies to 0.9.6a/0.9.6b/0.9.6c and 0.9.7
         +) applies to 0.9.7 only

  +) Add EVP test program.
     [Ben Laurie]

  +) Add symmetric cipher support to ENGINE. Expect the API to change!
     [Ben Laurie]

+4 −0
Original line number Diff line number Diff line
@@ -483,6 +483,10 @@ int ENGINE_clear_defaults(void);
/* Instruct an engine to load any EVP ciphers it knows of */
/* XXX make this work via defaults? */
void ENGINE_load_engine_ciphers(ENGINE *e);
/* Get a particular cipher from a particular engine - NULL if the engine
 * doesn't have it */
const EVP_CIPHER *ENGINE_get_cipher_by_name(ENGINE *e,const char *name);


/* Obligatory error function. */
void ERR_load_ENGINE_strings(void);
+14 −0
Original line number Diff line number Diff line
@@ -96,3 +96,17 @@ void ENGINE_load_engine_ciphers(ENGINE *e)
    for(n=0 ; n < sk_ENGINE_EVP_CIPHER_num(e->ciphers) ; ++n)
	EVP_add_cipher(sk_ENGINE_EVP_CIPHER_value(e->ciphers,n)->cipher);
    }

const EVP_CIPHER *ENGINE_get_cipher_by_name(ENGINE *e,const char *name)
    {
    int n;

    for(n=0 ; n < ENGINE_cipher_num(e) ; ++n)
	{
	const EVP_CIPHER *c=ENGINE_get_cipher(e,n);

	if(!strcmp(EVP_CIPHER_name(c),name))
	    return c;
	}
    return NULL;
    }
+1 −1
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ AR= ar r
CFLAGS= $(INCLUDES) $(CFLAG)

GENERAL=Makefile
TEST=
TEST=evp_test.c evptests.txt
APPS=

LIB=$(TOP)/libcrypto.a
+8 −7
Original line number Diff line number Diff line
@@ -387,6 +387,7 @@ typedef int (EVP_PBE_KEYGEN)(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
#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)
@@ -435,7 +436,6 @@ void BIO_set_md(BIO *,const EVP_MD *md);
#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);
@@ -457,21 +457,22 @@ int EVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md,
		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,
Loading