evp_test.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/* Written by Ben Laurie, 2001 */
/*
* Copyright (c) 2001 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core@openssl.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <string.h>
#include "../e_os.h"
#ifndef OPENSSL_NO_ENGINE
#endif
{
int n=0;
for( ; n < l ; ++n)
{
if((n%16) == 0)
fprintf(f,"\n%04x",n);
fprintf(f," %02x",s[n]);
}
fprintf(f,"\n");
}
static int convert(unsigned char *s)
{
unsigned char *d;
for(d=s ; *s ; s+=2,++d)
{
unsigned int n;
if(!s[1])
{
EXIT(4);
}
sscanf((char *)s,"%2x",&n);
*d=(unsigned char)n;
}
return s-d;
}
{
char isdelim[256];
if (**string == 0)
return NULL;
isdelim[0] = 1;
while (*delim)
{
delim++;
}
{
(*string)++;
}
if (**string)
{
**string = 0;
(*string)++;
}
return token;
}
static int test1_exit(int ec)
{
return(0); /* To keep some compilers quiet */
}
const unsigned char *ciphertext,int cn,
int encdec)
{
unsigned char out[4096];
if(in)
{
c->key_len);
test1_exit(5);
}
if (encdec != 0)
{
{
test1_exit(10);
}
{
test1_exit(6);
}
{
test1_exit(7);
}
{
test1_exit(8);
}
{
test1_exit(9);
}
}
if (encdec <= 0)
{
{
test1_exit(11);
}
{
test1_exit(6);
}
{
test1_exit(7);
}
{
test1_exit(8);
}
{
test1_exit(9);
}
}
printf("\n");
}
const unsigned char *ciphertext,int cn,
int encdec)
{
const EVP_CIPHER *c;
if(!c)
return 0;
return 1;
}
static int test_digest(const char *digest,
const unsigned char *ciphertext, unsigned int cn)
{
const EVP_MD *d;
unsigned char md[EVP_MAX_MD_SIZE];
unsigned int mdn;
if(!d)
return 0;
{
EXIT(100);
}
{
EXIT(101);
}
{
EXIT(101);
}
{
EXIT(102);
}
{
EXIT(103);
}
printf("\n");
return 1;
}
{
const char *szTestFile;
FILE *f;
if(argc != 2)
{
EXIT(1);
}
if(!f)
{
EXIT(2);
}
/* Load up the software EVP_CIPHER and EVP_MD definitions */
#ifndef OPENSSL_NO_ENGINE
/* Load all compiled-in ENGINEs */
#endif
#if 0
#endif
#ifndef OPENSSL_NO_ENGINE
/* Register all available ENGINE implementations of ciphers and digests.
* This could perhaps be changed to "ENGINE_register_all_complete()"? */
/* If we add command-line options, this statement should be switchable.
* they weren't already initialised. */
/* ENGINE_set_cipher_flags(ENGINE_CIPHER_FLAG_NOINIT); */
#endif
for( ; ; )
{
char line[4096];
char *p;
char *cipher;
int encdec;
break;
continue;
p=line;
if (p[-1] == '\n') {
p[-1] = '\0';
encdec = -1;
} else {
}
{
EXIT(3);
}
}
#ifndef OPENSSL_NO_ENGINE
#endif
EVP_cleanup();
ERR_remove_state(0);
return 0;
}