skb: remove test apps as they don't really test the SKB
authorReto Achermann <reto.achermann@inf.ethz.ch>
Mon, 19 Aug 2019 11:38:47 +0000 (13:38 +0200)
committerReto Achermann <reto.achermann@inf.ethz.ch>
Tue, 20 Aug 2019 17:43:07 +0000 (19:43 +0200)
Signed-off-by: Reto Achermann <reto.achermann@inf.ethz.ch>

12 files changed:
usr/skb/testapps/Hakefile [deleted file]
usr/skb/testapps/aesevpexample.c [deleted file]
usr/skb/testapps/apps.c [deleted file]
usr/skb/testapps/apps.h [deleted file]
usr/skb/testapps/cryptotest.c [deleted file]
usr/skb/testapps/map.c [deleted file]
usr/skb/testapps/matrix.c [deleted file]
usr/skb/testapps/speed.c [deleted file]
usr/skb/testapps/testdsa.h [deleted file]
usr/skb/testapps/testrsa.h [deleted file]
usr/skb/testapps/threadalloc.c [deleted file]
usr/skb/testapps/writemem.c [deleted file]

diff --git a/usr/skb/testapps/Hakefile b/usr/skb/testapps/Hakefile
deleted file mode 100644 (file)
index 0ca4fe3..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
---------------------------------------------------------------------------
--- Copyright (c) 2007-2009, ETH Zurich.
--- All rights reserved.
---
--- This file is distributed under the terms in the attached LICENSE file.
--- If you do not find this file, copies can be found by writing to:
--- ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
---
--- Hakefile for /usr/skb/testapps
---
---------------------------------------------------------------------------
-
-[ build application { target = "matrix", 
-                      cFiles = [ "matrix.c" ],
-                      addLibraries = [ "skb" ]
-                    },
-  build application { target = "map", 
-                      cFiles = [ "map.c" ],
-                      flounderDefs = [ "skb_map" ],
-                      addLibraries = [ "skb" ]
-                    },
-
-  build application { target = "threadalloc", 
-                      cFiles = [ "threadalloc.c" ],
-                      addLibraries = [ "skb", "posixcompat" ]
-                    },
-
-  build application { target = "writemem", 
-                      cFiles = [ "writemem.c" ]
-                    },
-
-  build application { target = "cryptotest", 
-                      cFiles = [ "cryptotest.c" ],
-                      addLibraries = [ "crypto", "posixcompat" ],
-                      addIncludes = [ "openssl-1.0.0d/include" ]
-                    },
-
-  build application { target = "speed", 
-                      cFiles = [ "speed.c", "apps.c" ],
-                  omitCFlags = [ "-Werror", "-Wshadow",
-                                 "-Wstrict-prototypes",
-                                 "-Wold-style-definition",
-                                 "-Wmissing-prototypes",
-                                 "-Wmissing-declarations",
-                                 "-Wmissing-field-initializers",
-                                 "-Wredundant-decls", "-std=c99" ],
-                      addLibraries = [ "crypto", "posixcompat",
-                                       "vfs", "nfs", "timer", "lwip" ],
-                      addIncludes = [ "openssl" ]
-                    }
-]
diff --git a/usr/skb/testapps/aesevpexample.c b/usr/skb/testapps/aesevpexample.c
deleted file mode 100644 (file)
index a7aa53c..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-
-#include <openssl/evp.h>
-
-int print_hex(unsigned char *buf, int len)
-{
-       int i;
-       int n;
-
-       for (i = 0, n = 0; i < len; i++) {
-               if (n > 7) {
-                       printf("\n");
-                       n = 0;
-               }
-               printf("0x%02x, ", buf[i]);
-               n++;
-       }
-       printf("\n");
-
-       return (0);
-}
-
-
-int main(int argc, char *argv[])
-{
-       char *pass = "password";
-       char *salt = "1234";
-       int ic = 1000;
-       unsigned char key_material[256];
-
-       unsigned char *key;
-       unsigned char *iv;
-
-       unsigned char inbuf[256];
-       unsigned char outbuf[256];
-       int outlen;
-       int n;
-
-       EVP_CIPHER_CTX ctx;
-
-       PKCS5_PBKDF2_HMAC_SHA1(pass, strlen(pass), salt, strlen(salt), ic, 128, key_material);
-       printf("PKCS5_PBKDF2_HMAC_SHA1(\"%s\", \"%s\", %d)=\n", pass, salt, ic);
-       print_hex(key_material, 32);
-
-       key = key_material;
-       //iv = key_material + 8;
-       //iv = key_material + 24;
-       //iv = key_material + 16;
-       //iv = key_material + 24;
-       iv = key_material + 32;
-
-       EVP_CIPHER_CTX_init(&ctx);
-       //EVP_EncryptInit_ex(&ctx, EVP_des_cbc(), NULL, key, iv);
-       //EVP_EncryptInit_ex(&ctx, EVP_des_ede3_cbc(), NULL, key, iv);
-       //EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL, key, iv);
-       //EVP_EncryptInit_ex(&ctx, EVP_aes_192_cbc(), NULL, key, iv);
-       EVP_EncryptInit_ex(&ctx, EVP_aes_256_cbc(), NULL, key, iv);
-
-       printf("\ncipher parameters:\n");
-       printf("    block size: %d\n", EVP_CIPHER_CTX_block_size(&ctx));
-       printf("    key length: %d\n", EVP_CIPHER_CTX_key_length(&ctx));
-       printf("     iv length: %d\n", EVP_CIPHER_CTX_iv_length(&ctx));
-
-       while (1) {
-               if ((n = fread(inbuf, 1, 128, stdin)) <= 0) {
-                       break;
-               }
-               if (!EVP_EncryptUpdate(&ctx, outbuf, &outlen, inbuf, n)) {
-                       return (0);
-               }
-               print_hex(outbuf, outlen);
-       }
-
-       if (!EVP_EncryptFinal_ex(&ctx, outbuf, &outlen)) {
-               return (0);
-       }
-       print_hex(outbuf, outlen);
-
-       EVP_CIPHER_CTX_cleanup(&ctx);
-
-       return (0);
-}
-
diff --git a/usr/skb/testapps/apps.c b/usr/skb/testapps/apps.c
deleted file mode 100644 (file)
index 567c658..0000000
+++ /dev/null
@@ -1,3033 +0,0 @@
-/* apps/apps.c */
-/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay@cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- * 
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to.  The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attribution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- * 
- * 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 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 the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *    "This product includes cryptographic software written by
- *     Eric Young (eay@cryptsoft.com)"
- *    The word 'cryptographic' can be left out if the rouines from the library
- *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
- *    the apps directory (application code) you must include an acknowledgement:
- *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS 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 AUTHOR OR 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.
- * 
- * The licence and distribution terms for any publically available version or
- * derivative of this code cannot be changed.  i.e. this code cannot simply be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-/* ====================================================================
- * Copyright (c) 1998-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
- *    the documentation and/or other materials provided with the
- *    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.
- * ====================================================================
- *
- * This product includes cryptographic software written by Eric Young
- * (eay@cryptsoft.com).  This product includes software written by Tim
- * Hudson (tjh@cryptsoft.com).
- *
- */
-
-#ifndef _POSIX_C_SOURCE
-#define _POSIX_C_SOURCE 2      /* On VMS, you need to define this to get
-                                  the declaration of fileno().  The value
-                                  2 is to make sure no function defined
-                                  in POSIX-2 is left undefined. */
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#if !defined(OPENSSL_SYSNAME_WIN32) && !defined(NETWARE_CLIB)
-#include <strings.h>
-#endif
-#include <sys/types.h>
-#include <ctype.h>
-#include <errno.h>
-#include <assert.h>
-#include <openssl/err.h>
-#include <openssl/x509.h>
-#include <openssl/x509v3.h>
-#include <openssl/pem.h>
-#include <openssl/pkcs12.h>
-#include <openssl/ui.h>
-#include <openssl/safestack.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-#ifndef OPENSSL_NO_RSA
-#include <openssl/rsa.h>
-#endif
-#include <openssl/bn.h>
-#ifndef OPENSSL_NO_JPAKE
-#include <openssl/jpake.h>
-#endif
-
-#define NON_MAIN
-#include "apps.h"
-#undef NON_MAIN
-
-#ifdef _WIN32
-static int WIN32_rename(const char *from, const char *to);
-#define rename(from,to) WIN32_rename((from),(to))
-#endif
-
-typedef struct {
-       const char *name;
-       unsigned long flag;
-       unsigned long mask;
-} NAME_EX_TBL;
-
-static UI_METHOD *ui_method = NULL;
-
-static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl);
-static int set_multi_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl);
-
-#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA)
-/* Looks like this stuff is worth moving into separate function */
-static EVP_PKEY *
-load_netscape_key(BIO *err, BIO *key, const char *file,
-               const char *key_descrip, int format);
-#endif
-
-int app_init(long mesgwin);
-#ifdef undef /* never finished - probably never will be :-) */
-int args_from_file(char *file, int *argc, char **argv[])
-       {
-       FILE *fp;
-       int num,i;
-       unsigned int len;
-       static char *buf=NULL;
-       static char **arg=NULL;
-       char *p;
-
-       fp=fopen(file,"r");
-       if (fp == NULL)
-               return(0);
-
-       if (fseek(fp,0,SEEK_END)==0)
-               len=ftell(fp), rewind(fp);
-       else    len=-1;
-       if (len<=0)
-               {
-               fclose(fp);
-               return(0);
-               }
-
-       *argc=0;
-       *argv=NULL;
-
-       if (buf != NULL) OPENSSL_free(buf);
-       buf=(char *)OPENSSL_malloc(len+1);
-       if (buf == NULL) return(0);
-
-       len=fread(buf,1,len,fp);
-       if (len <= 1) return(0);
-       buf[len]='\0';
-
-       i=0;
-       for (p=buf; *p; p++)
-               if (*p == '\n') i++;
-       if (arg != NULL) OPENSSL_free(arg);
-       arg=(char **)OPENSSL_malloc(sizeof(char *)*(i*2));
-
-       *argv=arg;
-       num=0;
-       p=buf;
-       for (;;)
-               {
-               if (!*p) break;
-               if (*p == '#') /* comment line */
-                       {
-                       while (*p && (*p != '\n')) p++;
-                       continue;
-                       }
-               /* else we have a line */
-               *(arg++)=p;
-               num++;
-               while (*p && ((*p != ' ') && (*p != '\t') && (*p != '\n')))
-                       p++;
-               if (!*p) break;
-               if (*p == '\n')
-                       {
-                       *(p++)='\0';
-                       continue;
-                       }
-               /* else it is a tab or space */
-               p++;
-               while (*p && ((*p == ' ') || (*p == '\t') || (*p == '\n')))
-                       p++;
-               if (!*p) break;
-               if (*p == '\n')
-                       {
-                       p++;
-                       continue;
-                       }
-               *(arg++)=p++;
-               num++;
-               while (*p && (*p != '\n')) p++;
-               if (!*p) break;
-               /* else *p == '\n' */
-               *(p++)='\0';
-               }
-       *argc=num;
-       return(1);
-       }
-#endif
-
-int str2fmt(char *s)
-       {
-       if (s == NULL)
-               return FORMAT_UNDEF;
-       if      ((*s == 'D') || (*s == 'd'))
-               return(FORMAT_ASN1);
-       else if ((*s == 'T') || (*s == 't'))
-               return(FORMAT_TEXT);
-       else if ((*s == 'N') || (*s == 'n'))
-               return(FORMAT_NETSCAPE);
-       else if ((*s == 'S') || (*s == 's'))
-               return(FORMAT_SMIME);
-       else if ((*s == 'M') || (*s == 'm'))
-               return(FORMAT_MSBLOB);
-       else if ((*s == '1')
-               || (strcmp(s,"PKCS12") == 0) || (strcmp(s,"pkcs12") == 0)
-               || (strcmp(s,"P12") == 0) || (strcmp(s,"p12") == 0))
-               return(FORMAT_PKCS12);
-       else if ((*s == 'E') || (*s == 'e'))
-               return(FORMAT_ENGINE);
-       else if ((*s == 'P') || (*s == 'p'))
-               {
-               if (s[1] == 'V' || s[1] == 'v')
-                       return FORMAT_PVK;
-               else
-                       return(FORMAT_PEM);
-               }
-       else
-               return(FORMAT_UNDEF);
-       }
-
-#if defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_NETWARE)
-void program_name(char *in, char *out, int size)
-       {
-       int i,n;
-       char *p=NULL;
-
-       n=strlen(in);
-       /* find the last '/', '\' or ':' */
-       for (i=n-1; i>0; i--)
-               {
-               if ((in[i] == '/') || (in[i] == '\\') || (in[i] == ':'))
-                       {
-                       p= &(in[i+1]);
-                       break;
-                       }
-               }
-       if (p == NULL)
-               p=in;
-       n=strlen(p);
-
-#if defined(OPENSSL_SYS_NETWARE)
-   /* strip off trailing .nlm if present. */
-   if ((n > 4) && (p[n-4] == '.') &&
-      ((p[n-3] == 'n') || (p[n-3] == 'N')) &&
-      ((p[n-2] == 'l') || (p[n-2] == 'L')) &&
-      ((p[n-1] == 'm') || (p[n-1] == 'M')))
-      n-=4;
-#else
-       /* strip off trailing .exe if present. */
-       if ((n > 4) && (p[n-4] == '.') &&
-               ((p[n-3] == 'e') || (p[n-3] == 'E')) &&
-               ((p[n-2] == 'x') || (p[n-2] == 'X')) &&
-               ((p[n-1] == 'e') || (p[n-1] == 'E')))
-               n-=4;
-#endif
-
-       if (n > size-1)
-               n=size-1;
-
-       for (i=0; i<n; i++)
-               {
-               if ((p[i] >= 'A') && (p[i] <= 'Z'))
-                       out[i]=p[i]-'A'+'a';
-               else
-                       out[i]=p[i];
-               }
-       out[n]='\0';
-       }
-#else
-#ifdef OPENSSL_SYS_VMS
-void program_name(char *in, char *out, int size)
-       {
-       char *p=in, *q;
-       char *chars=":]>";
-
-       while(*chars != '\0')
-               {
-               q=strrchr(p,*chars);
-               if (q > p)
-                       p = q + 1;
-               chars++;
-               }
-
-       q=strrchr(p,'.');
-       if (q == NULL)
-               q = p + strlen(p);
-       strncpy(out,p,size-1);
-       if (q-p >= size)
-               {
-               out[size-1]='\0';
-               }
-       else
-               {
-               out[q-p]='\0';
-               }
-       }
-#else
-void program_name(char *in, char *out, int size)
-       {
-       char *p;
-
-       p=strrchr(in,'/');
-       if (p != NULL)
-               p++;
-       else
-               p=in;
-       BUF_strlcpy(out,p,size);
-       }
-#endif
-#endif
-
-int chopup_args(ARGS *arg, char *buf, int *argc, char **argv[])
-       {
-       int num,i;
-       char *p;
-
-       *argc=0;
-       *argv=NULL;
-
-       i=0;
-       if (arg->count == 0)
-               {
-               arg->count=20;
-               arg->data=(char **)OPENSSL_malloc(sizeof(char *)*arg->count);
-               }
-       for (i=0; i<arg->count; i++)
-               arg->data[i]=NULL;
-
-       num=0;
-       p=buf;
-       for (;;)
-               {
-               /* first scan over white space */
-               if (!*p) break;
-               while (*p && ((*p == ' ') || (*p == '\t') || (*p == '\n')))
-                       p++;
-               if (!*p) break;
-
-               /* The start of something good :-) */
-               if (num >= arg->count)
-                       {
-                       char **tmp_p;
-                       int tlen = arg->count + 20;
-                       tmp_p = (char **)OPENSSL_realloc(arg->data,
-                               sizeof(char *)*tlen);
-                       if (tmp_p == NULL)
-                               return 0;
-                       arg->data  = tmp_p;
-                       arg->count = tlen;
-                       /* initialize newly allocated data */
-                       for (i = num; i < arg->count; i++)
-                               arg->data[i] = NULL;
-                       }
-               arg->data[num++]=p;
-
-               /* now look for the end of this */
-               if ((*p == '\'') || (*p == '\"')) /* scan for closing quote */
-                       {
-                       i= *(p++);
-                       arg->data[num-1]++; /* jump over quote */
-                       while (*p && (*p != i))
-                               p++;
-                       *p='\0';
-                       }
-               else
-                       {
-                       while (*p && ((*p != ' ') &&
-                               (*p != '\t') && (*p != '\n')))
-                               p++;
-
-                       if (*p == '\0')
-                               p--;
-                       else
-                               *p='\0';
-                       }
-               p++;
-               }
-       *argc=num;
-       *argv=arg->data;
-       return(1);
-       }
-
-#ifndef APP_INIT
-int app_init(long mesgwin)
-       {
-       return(1);
-       }
-#endif
-
-
-int dump_cert_text (BIO *out, X509 *x)
-{
-       char *p;
-
-       p=X509_NAME_oneline(X509_get_subject_name(x),NULL,0);
-       BIO_puts(out,"subject=");
-       BIO_puts(out,p);
-       OPENSSL_free(p);
-
-       p=X509_NAME_oneline(X509_get_issuer_name(x),NULL,0);
-       BIO_puts(out,"\nissuer=");
-       BIO_puts(out,p);
-       BIO_puts(out,"\n");
-       OPENSSL_free(p);
-
-       return 0;
-}
-
-static int ui_open(UI *ui)
-       {
-       return UI_method_get_opener(UI_OpenSSL())(ui);
-       }
-static int ui_read(UI *ui, UI_STRING *uis)
-       {
-       if (UI_get_input_flags(uis) & UI_INPUT_FLAG_DEFAULT_PWD
-               && UI_get0_user_data(ui))
-               {
-               switch(UI_get_string_type(uis))
-                       {
-               case UIT_PROMPT:
-               case UIT_VERIFY:
-                       {
-                       const char *password =
-                               ((PW_CB_DATA *)UI_get0_user_data(ui))->password;
-                       if (password && password[0] != '\0')
-                               {
-                               UI_set_result(ui, uis, password);
-                               return 1;
-                               }
-                       }
-               default:
-                       break;
-                       }
-               }
-       return UI_method_get_reader(UI_OpenSSL())(ui, uis);
-       }
-static int ui_write(UI *ui, UI_STRING *uis)
-       {
-       if (UI_get_input_flags(uis) & UI_INPUT_FLAG_DEFAULT_PWD
-               && UI_get0_user_data(ui))
-               {
-               switch(UI_get_string_type(uis))
-                       {
-               case UIT_PROMPT:
-               case UIT_VERIFY:
-                       {
-                       const char *password =
-                               ((PW_CB_DATA *)UI_get0_user_data(ui))->password;
-                       if (password && password[0] != '\0')
-                               return 1;
-                       }
-               default:
-                       break;
-                       }
-               }
-       return UI_method_get_writer(UI_OpenSSL())(ui, uis);
-       }
-static int ui_close(UI *ui)
-       {
-       return UI_method_get_closer(UI_OpenSSL())(ui);
-       }
-int setup_ui_method(void)
-       {
-       ui_method = UI_create_method("OpenSSL application user interface");
-       UI_method_set_opener(ui_method, ui_open);
-       UI_method_set_reader(ui_method, ui_read);
-       UI_method_set_writer(ui_method, ui_write);
-       UI_method_set_closer(ui_method, ui_close);
-       return 0;
-       }
-void destroy_ui_method(void)
-       {
-       if(ui_method)
-               {
-               UI_destroy_method(ui_method);
-               ui_method = NULL;
-               }
-       }
-int password_callback(char *buf, int bufsiz, int verify,
-       PW_CB_DATA *cb_tmp)
-       {
-       UI *ui = NULL;
-       int res = 0;
-       const char *prompt_info = NULL;
-       const char *password = NULL;
-       PW_CB_DATA *cb_data = (PW_CB_DATA *)cb_tmp;
-
-       if (cb_data)
-               {
-               if (cb_data->password)
-                       password = cb_data->password;
-               if (cb_data->prompt_info)
-                       prompt_info = cb_data->prompt_info;
-               }
-
-       if (password)
-               {
-               res = strlen(password);
-               if (res > bufsiz)
-                       res = bufsiz;
-               memcpy(buf, password, res);
-               return res;
-               }
-
-       ui = UI_new_method(ui_method);
-       if (ui)
-               {
-               int ok = 0;
-               char *buff = NULL;
-               int ui_flags = 0;
-               char *prompt = NULL;
-
-               prompt = UI_construct_prompt(ui, "pass phrase",
-                       prompt_info);
-
-               ui_flags |= UI_INPUT_FLAG_DEFAULT_PWD;
-               UI_ctrl(ui, UI_CTRL_PRINT_ERRORS, 1, 0, 0);
-
-               if (ok >= 0)
-                       ok = UI_add_input_string(ui,prompt,ui_flags,buf,
-                               PW_MIN_LENGTH,BUFSIZ-1);
-               if (ok >= 0 && verify)
-                       {
-                       buff = (char *)OPENSSL_malloc(bufsiz);
-                       ok = UI_add_verify_string(ui,prompt,ui_flags,buff,
-                               PW_MIN_LENGTH,BUFSIZ-1, buf);
-                       }
-               if (ok >= 0)
-                       do
-                               {
-                               ok = UI_process(ui);
-                               }
-                       while (ok < 0 && UI_ctrl(ui, UI_CTRL_IS_REDOABLE, 0, 0, 0));
-
-               if (buff)
-                       {
-                       OPENSSL_cleanse(buff,(unsigned int)bufsiz);
-                       OPENSSL_free(buff);
-                       }
-
-               if (ok >= 0)
-                       res = strlen(buf);
-               if (ok == -1)
-                       {
-                       BIO_printf(bio_err, "User interface error\n");
-                       ERR_print_errors(bio_err);
-                       OPENSSL_cleanse(buf,(unsigned int)bufsiz);
-                       res = 0;
-                       }
-               if (ok == -2)
-                       {
-                       BIO_printf(bio_err,"aborted!\n");
-                       OPENSSL_cleanse(buf,(unsigned int)bufsiz);
-                       res = 0;
-                       }
-               UI_free(ui);
-               OPENSSL_free(prompt);
-               }
-       return res;
-       }
-
-static char *app_get_pass(BIO *err, char *arg, int keepbio);
-
-int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2)
-{
-       int same;
-       if(!arg2 || !arg1 || strcmp(arg1, arg2)) same = 0;
-       else same = 1;
-       if(arg1) {
-               *pass1 = app_get_pass(err, arg1, same);
-               if(!*pass1) return 0;
-       } else if(pass1) *pass1 = NULL;
-       if(arg2) {
-               *pass2 = app_get_pass(err, arg2, same ? 2 : 0);
-               if(!*pass2) return 0;
-       } else if(pass2) *pass2 = NULL;
-       return 1;
-}
-
-static char *app_get_pass(BIO *err, char *arg, int keepbio)
-{
-       char *tmp, tpass[APP_PASS_LEN];
-       static BIO *pwdbio = NULL;
-       int i;
-       if(!strncmp(arg, "pass:", 5)) return BUF_strdup(arg + 5);
-       if(!strncmp(arg, "env:", 4)) {
-               tmp = getenv(arg + 4);
-               if(!tmp) {
-                       BIO_printf(err, "Can't read environment variable %s\n", arg + 4);
-                       return NULL;
-               }
-               return BUF_strdup(tmp);
-       }
-       if(!keepbio || !pwdbio) {
-               if(!strncmp(arg, "file:", 5)) {
-                       pwdbio = BIO_new_file(arg + 5, "r");
-                       if(!pwdbio) {
-                               BIO_printf(err, "Can't open file %s\n", arg + 5);
-                               return NULL;
-                       }
-#if !defined(_WIN32)
-               /*
-                * Under _WIN32, which covers even Win64 and CE, file
-                * descriptors referenced by BIO_s_fd are not inherited
-                * by child process and therefore below is not an option.
-                * It could have been an option if bss_fd.c was operating
-                * on real Windows descriptors, such as those obtained
-                * with CreateFile.
-                */
-               } else if(!strncmp(arg, "fd:", 3)) {
-                       BIO *btmp;
-                       i = atoi(arg + 3);
-                       if(i >= 0) pwdbio = BIO_new_fd(i, BIO_NOCLOSE);
-                       if((i < 0) || !pwdbio) {
-                               BIO_printf(err, "Can't access file descriptor %s\n", arg + 3);
-                               return NULL;
-                       }
-                       /* Can't do BIO_gets on an fd BIO so add a buffering BIO */
-                       btmp = BIO_new(BIO_f_buffer());
-                       pwdbio = BIO_push(btmp, pwdbio);
-#endif
-               } else if(!strcmp(arg, "stdin")) {
-                       pwdbio = BIO_new_fp(stdin, BIO_NOCLOSE);
-                       if(!pwdbio) {
-                               BIO_printf(err, "Can't open BIO for stdin\n");
-                               return NULL;
-                       }
-               } else {
-                       BIO_printf(err, "Invalid password argument \"%s\"\n", arg);
-                       return NULL;
-               }
-       }
-       i = BIO_gets(pwdbio, tpass, APP_PASS_LEN);
-       if(keepbio != 1) {
-               BIO_free_all(pwdbio);
-               pwdbio = NULL;
-       }
-       if(i <= 0) {
-               BIO_printf(err, "Error reading password from BIO\n");
-               return NULL;
-       }
-       tmp = strchr(tpass, '\n');
-       if(tmp) *tmp = 0;
-       return BUF_strdup(tpass);
-}
-
-int add_oid_section(BIO *err, CONF *conf)
-{      
-       char *p;
-       STACK_OF(CONF_VALUE) *sktmp;
-       CONF_VALUE *cnf;
-       int i;
-       if(!(p=NCONF_get_string(conf,NULL,"oid_section")))
-               {
-               ERR_clear_error();
-               return 1;
-               }
-       if(!(sktmp = NCONF_get_section(conf, p))) {
-               BIO_printf(err, "problem loading oid section %s\n", p);
-               return 0;
-       }
-       for(i = 0; i < sk_CONF_VALUE_num(sktmp); i++) {
-               cnf = sk_CONF_VALUE_value(sktmp, i);
-               if(OBJ_create(cnf->value, cnf->name, cnf->name) == NID_undef) {
-                       BIO_printf(err, "problem creating object %s=%s\n",
-                                                        cnf->name, cnf->value);
-                       return 0;
-               }
-       }
-       return 1;
-}
-
-static int load_pkcs12(BIO *err, BIO *in, const char *desc,
-               pem_password_cb *pem_cb,  void *cb_data,
-               EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca)
-       {
-       const char *pass;
-       char tpass[PEM_BUFSIZE];
-       int len, ret = 0;
-       PKCS12 *p12;
-       p12 = d2i_PKCS12_bio(in, NULL);
-       if (p12 == NULL)
-               {
-               BIO_printf(err, "Error loading PKCS12 file for %s\n", desc);    
-               goto die;
-               }
-       /* See if an empty password will do */
-       if (PKCS12_verify_mac(p12, "", 0) || PKCS12_verify_mac(p12, NULL, 0))
-               pass = "";
-       else
-               {
-               if (!pem_cb)
-                       pem_cb = (pem_password_cb *)password_callback;
-               len = pem_cb(tpass, PEM_BUFSIZE, 0, cb_data);
-               if (len < 0) 
-                       {
-                       BIO_printf(err, "Passpharse callback error for %s\n",
-                                       desc);
-                       goto die;
-                       }
-               if (len < PEM_BUFSIZE)
-                       tpass[len] = 0;
-               if (!PKCS12_verify_mac(p12, tpass, len))
-                       {
-                       BIO_printf(err,
-       "Mac verify error (wrong password?) in PKCS12 file for %s\n", desc);    
-                       goto die;
-                       }
-               pass = tpass;
-               }
-       ret = PKCS12_parse(p12, pass, pkey, cert, ca);
-       die:
-       if (p12)
-               PKCS12_free(p12);
-       return ret;
-       }
-
-X509 *load_cert(BIO *err, const char *file, int format,
-       const char *pass, ENGINE *e, const char *cert_descrip)
-       {
-       X509 *x=NULL;
-       BIO *cert;
-
-       if ((cert=BIO_new(BIO_s_file())) == NULL)
-               {
-               ERR_print_errors(err);
-               goto end;
-               }
-
-       if (file == NULL)
-               {
-#ifdef _IONBF
-               setvbuf(stdin, NULL, _IONBF, 0);
-#endif
-               BIO_set_fp(cert,stdin,BIO_NOCLOSE);
-               }
-       else
-               {
-               if (BIO_read_filename(cert,file) <= 0)
-                       {
-                       BIO_printf(err, "Error opening %s %s\n",
-                               cert_descrip, file);
-                       ERR_print_errors(err);
-                       goto end;
-                       }
-               }
-
-       if      (format == FORMAT_ASN1)
-               x=d2i_X509_bio(cert,NULL);
-       else if (format == FORMAT_NETSCAPE)
-               {
-               NETSCAPE_X509 *nx;
-               nx=ASN1_item_d2i_bio(ASN1_ITEM_rptr(NETSCAPE_X509),cert,NULL);
-               if (nx == NULL)
-                               goto end;
-
-               if ((strncmp(NETSCAPE_CERT_HDR,(char *)nx->header->data,
-                       nx->header->length) != 0))
-                       {
-                       NETSCAPE_X509_free(nx);
-                       BIO_printf(err,"Error reading header on certificate\n");
-                       goto end;
-                       }
-               x=nx->cert;
-               nx->cert = NULL;
-               NETSCAPE_X509_free(nx);
-               }
-       else if (format == FORMAT_PEM)
-               x=PEM_read_bio_X509_AUX(cert,NULL,
-                       (pem_password_cb *)password_callback, NULL);
-       else if (format == FORMAT_PKCS12)
-               {
-               if (!load_pkcs12(err, cert,cert_descrip, NULL, NULL,
-                                       NULL, &x, NULL))
-                       goto end;
-               }
-       else    {
-               BIO_printf(err,"bad input format specified for %s\n",
-                       cert_descrip);
-               goto end;
-               }
-end:
-       if (x == NULL)
-               {
-               BIO_printf(err,"unable to load certificate\n");
-               ERR_print_errors(err);
-               }
-       if (cert != NULL) BIO_free(cert);
-       return(x);
-       }
-
-EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin,
-       const char *pass, ENGINE *e, const char *key_descrip)
-       {
-       BIO *key=NULL;
-       EVP_PKEY *pkey=NULL;
-       PW_CB_DATA cb_data;
-
-       cb_data.password = pass;
-       cb_data.prompt_info = file;
-
-       if (file == NULL && (!maybe_stdin || format == FORMAT_ENGINE))
-               {
-               BIO_printf(err,"no keyfile specified\n");
-               goto end;
-               }
-#ifndef OPENSSL_NO_ENGINE
-       if (format == FORMAT_ENGINE)
-               {
-               if (!e)
-                       BIO_printf(err,"no engine specified\n");
-               else
-                       {
-                       pkey = ENGINE_load_private_key(e, file,
-                               ui_method, &cb_data);
-                       if (!pkey) 
-                               {
-                               BIO_printf(err,"cannot load %s from engine\n",key_descrip);
-                               ERR_print_errors(err);
-                               }       
-                       }
-               goto end;
-               }
-#endif
-       key=BIO_new(BIO_s_file());
-       if (key == NULL)
-               {
-               ERR_print_errors(err);
-               goto end;
-               }
-       if (file == NULL && maybe_stdin)
-               {
-#ifdef _IONBF
-               setvbuf(stdin, NULL, _IONBF, 0);
-#endif
-               BIO_set_fp(key,stdin,BIO_NOCLOSE);
-               }
-       else
-               if (BIO_read_filename(key,file) <= 0)
-                       {
-                       BIO_printf(err, "Error opening %s %s\n",
-                               key_descrip, file);
-                       ERR_print_errors(err);
-                       goto end;
-                       }
-       if (format == FORMAT_ASN1)
-               {
-               pkey=d2i_PrivateKey_bio(key, NULL);
-               }
-       else if (format == FORMAT_PEM)
-               {
-               pkey=PEM_read_bio_PrivateKey(key,NULL,
-                       (pem_password_cb *)password_callback, &cb_data);
-               }
-#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA)
-       else if (format == FORMAT_NETSCAPE || format == FORMAT_IISSGC)
-               pkey = load_netscape_key(err, key, file, key_descrip, format);
-#endif
-       else if (format == FORMAT_PKCS12)
-               {
-               if (!load_pkcs12(err, key, key_descrip,
-                               (pem_password_cb *)password_callback, &cb_data,
-                               &pkey, NULL, NULL))
-                       goto end;
-               }
-#if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_DSA) && !defined (OPENSSL_NO_RC4)
-       else if (format == FORMAT_MSBLOB)
-               pkey = b2i_PrivateKey_bio(key);
-       else if (format == FORMAT_PVK)
-               pkey = b2i_PVK_bio(key, (pem_password_cb *)password_callback,
-                                                               &cb_data);
-#endif
-       else
-               {
-               BIO_printf(err,"bad input format specified for key file\n");
-               goto end;
-               }
- end:
-       if (key != NULL) BIO_free(key);
-       if (pkey == NULL) 
-               {
-               BIO_printf(err,"unable to load %s\n", key_descrip);
-               ERR_print_errors(err);
-               }       
-       return(pkey);
-       }
-
-EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
-       const char *pass, ENGINE *e, const char *key_descrip)
-       {
-       BIO *key=NULL;
-       EVP_PKEY *pkey=NULL;
-       PW_CB_DATA cb_data;
-
-       cb_data.password = pass;
-       cb_data.prompt_info = file;
-
-       if (file == NULL && (!maybe_stdin || format == FORMAT_ENGINE))
-               {
-               BIO_printf(err,"no keyfile specified\n");
-               goto end;
-               }
-#ifndef OPENSSL_NO_ENGINE
-       if (format == FORMAT_ENGINE)
-               {
-               if (!e)
-                       BIO_printf(bio_err,"no engine specified\n");
-               else
-                       pkey = ENGINE_load_public_key(e, file,
-                               ui_method, &cb_data);
-               goto end;
-               }
-#endif
-       key=BIO_new(BIO_s_file());
-       if (key == NULL)
-               {
-               ERR_print_errors(err);
-               goto end;
-               }
-       if (file == NULL && maybe_stdin)
-               {
-#ifdef _IONBF
-               setvbuf(stdin, NULL, _IONBF, 0);
-#endif
-               BIO_set_fp(key,stdin,BIO_NOCLOSE);
-               }
-       else
-               if (BIO_read_filename(key,file) <= 0)
-                       {
-                       BIO_printf(err, "Error opening %s %s\n",
-                               key_descrip, file);
-                       ERR_print_errors(err);
-                       goto end;
-               }
-       if (format == FORMAT_ASN1)
-               {
-               pkey=d2i_PUBKEY_bio(key, NULL);
-               }
-#ifndef OPENSSL_NO_RSA
-       else if (format == FORMAT_ASN1RSA)
-               {
-               RSA *rsa;
-               rsa = d2i_RSAPublicKey_bio(key, NULL);
-               if (rsa)
-                       {
-                       pkey = EVP_PKEY_new();
-                       if (pkey)
-                               EVP_PKEY_set1_RSA(pkey, rsa);
-                       RSA_free(rsa);
-                       }
-               else
-                       pkey = NULL;
-               }
-       else if (format == FORMAT_PEMRSA)
-               {
-               RSA *rsa;
-               rsa = PEM_read_bio_RSAPublicKey(key, NULL, 
-                       (pem_password_cb *)password_callback, &cb_data);
-               if (rsa)
-                       {
-                       pkey = EVP_PKEY_new();
-                       if (pkey)
-                               EVP_PKEY_set1_RSA(pkey, rsa);
-                       RSA_free(rsa);
-                       }
-               else
-                       pkey = NULL;
-               }
-#endif
-       else if (format == FORMAT_PEM)
-               {
-               pkey=PEM_read_bio_PUBKEY(key,NULL,
-                       (pem_password_cb *)password_callback, &cb_data);
-               }
-#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA)
-       else if (format == FORMAT_NETSCAPE || format == FORMAT_IISSGC)
-               pkey = load_netscape_key(err, key, file, key_descrip, format);
-#endif
-#if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_NO_DSA)
-       else if (format == FORMAT_MSBLOB)
-               pkey = b2i_PublicKey_bio(key);
-#endif
-       else
-               {
-               BIO_printf(err,"bad input format specified for key file\n");
-               goto end;
-               }
- end:
-       if (key != NULL) BIO_free(key);
-       if (pkey == NULL)
-               BIO_printf(err,"unable to load %s\n", key_descrip);
-       return(pkey);
-       }
-
-#if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA)
-static EVP_PKEY *
-load_netscape_key(BIO *err, BIO *key, const char *file,
-               const char *key_descrip, int format)
-       {
-       EVP_PKEY *pkey;
-       BUF_MEM *buf;
-       RSA     *rsa;
-       const unsigned char *p;
-       int size, i;
-
-       buf=BUF_MEM_new();
-       pkey = EVP_PKEY_new();
-       size = 0;
-       if (buf == NULL || pkey == NULL)
-               goto error;
-       for (;;)
-               {
-               if (!BUF_MEM_grow_clean(buf,size+1024*10))
-                       goto error;
-               i = BIO_read(key, &(buf->data[size]), 1024*10);
-               size += i;
-               if (i == 0)
-                       break;
-               if (i < 0)
-                       {
-                               BIO_printf(err, "Error reading %s %s",
-                                       key_descrip, file);
-                               goto error;
-                       }
-               }
-       p=(unsigned char *)buf->data;
-       rsa = d2i_RSA_NET(NULL,&p,(long)size,NULL,
-               (format == FORMAT_IISSGC ? 1 : 0));
-       if (rsa == NULL)
-               goto error;
-       BUF_MEM_free(buf);
-       EVP_PKEY_set1_RSA(pkey, rsa);
-       return pkey;
-error:
-       BUF_MEM_free(buf);
-       EVP_PKEY_free(pkey);
-       return NULL;
-       }
-#endif /* ndef OPENSSL_NO_RC4 */
-
-static int load_certs_crls(BIO *err, const char *file, int format,
-       const char *pass, ENGINE *e, const char *desc,
-       STACK_OF(X509) **pcerts, STACK_OF(X509_CRL) **pcrls)
-       {
-       int i;
-       BIO *bio;
-       STACK_OF(X509_INFO) *xis = NULL;
-       X509_INFO *xi;
-       PW_CB_DATA cb_data;
-       int rv = 0;
-
-       cb_data.password = pass;
-       cb_data.prompt_info = file;
-
-       if (format != FORMAT_PEM)
-               {
-               BIO_printf(err,"bad input format specified for %s\n", desc);
-               return 0;
-               }
-
-       if (file == NULL)
-               bio = BIO_new_fp(stdin,BIO_NOCLOSE);
-       else
-               bio = BIO_new_file(file, "r");
-
-       if (bio == NULL)
-               {
-               BIO_printf(err, "Error opening %s %s\n",
-                               desc, file ? file : "stdin");
-               ERR_print_errors(err);
-               return 0;
-               }
-
-       xis = PEM_X509_INFO_read_bio(bio, NULL,
-                               (pem_password_cb *)password_callback, &cb_data);
-
-       BIO_free(bio);
-
-       if (pcerts)
-               {
-               *pcerts = sk_X509_new_null();
-               if (!*pcerts)
-                       goto end;
-               }
-
-       if (pcrls)
-               {
-               *pcrls = sk_X509_CRL_new_null();
-               if (!*pcrls)
-                       goto end;
-               }
-
-       for(i = 0; i < sk_X509_INFO_num(xis); i++)
-               {
-               xi = sk_X509_INFO_value (xis, i);
-               if (xi->x509 && pcerts)
-                       {
-                       if (!sk_X509_push(*pcerts, xi->x509))
-                               goto end;
-                       xi->x509 = NULL;
-                       }
-               if (xi->crl && pcrls)
-                       {
-                       if (!sk_X509_CRL_push(*pcrls, xi->crl))
-                               goto end;
-                       xi->crl = NULL;
-                       }
-               }
-
-       if (pcerts && sk_X509_num(*pcerts) > 0)
-               rv = 1;
-
-       if (pcrls && sk_X509_CRL_num(*pcrls) > 0)
-               rv = 1;
-
-       end:
-
-       if (xis)
-               sk_X509_INFO_pop_free(xis, X509_INFO_free);
-
-       if (rv == 0)
-               {
-               if (pcerts)
-                       {
-                       sk_X509_pop_free(*pcerts, X509_free);
-                       *pcerts = NULL;
-                       }
-               if (pcrls)
-                       {
-                       sk_X509_CRL_pop_free(*pcrls, X509_CRL_free);
-                       *pcrls = NULL;
-                       }
-               BIO_printf(err,"unable to load %s\n",
-                               pcerts ? "certificates" : "CRLs");
-               ERR_print_errors(err);
-               }
-       return rv;
-       }
-
-STACK_OF(X509) *load_certs(BIO *err, const char *file, int format,
-       const char *pass, ENGINE *e, const char *desc)
-       {
-       STACK_OF(X509) *certs;
-       load_certs_crls(err, file, format, pass, e, desc, &certs, NULL);
-       return certs;
-       }       
-
-STACK_OF(X509_CRL) *load_crls(BIO *err, const char *file, int format,
-       const char *pass, ENGINE *e, const char *desc)
-       {
-       STACK_OF(X509_CRL) *crls;
-       load_certs_crls(err, file, format, pass, e, desc, NULL, &crls);
-       return crls;
-       }       
-
-#define X509V3_EXT_UNKNOWN_MASK                (0xfL << 16)
-/* Return error for unknown extensions */
-#define X509V3_EXT_DEFAULT             0
-/* Print error for unknown extensions */
-#define X509V3_EXT_ERROR_UNKNOWN       (1L << 16)
-/* ASN1 parse unknown extensions */
-#define X509V3_EXT_PARSE_UNKNOWN       (2L << 16)
-/* BIO_dump unknown extensions */
-#define X509V3_EXT_DUMP_UNKNOWN                (3L << 16)
-
-#define X509_FLAG_CA (X509_FLAG_NO_ISSUER | X509_FLAG_NO_PUBKEY | \
-                        X509_FLAG_NO_HEADER | X509_FLAG_NO_VERSION)
-
-int set_cert_ex(unsigned long *flags, const char *arg)
-{
-       static const NAME_EX_TBL cert_tbl[] = {
-               { "compatible", X509_FLAG_COMPAT, 0xffffffffl},
-               { "ca_default", X509_FLAG_CA, 0xffffffffl},
-               { "no_header", X509_FLAG_NO_HEADER, 0},
-               { "no_version", X509_FLAG_NO_VERSION, 0},
-               { "no_serial", X509_FLAG_NO_SERIAL, 0},
-               { "no_signame", X509_FLAG_NO_SIGNAME, 0},
-               { "no_validity", X509_FLAG_NO_VALIDITY, 0},
-               { "no_subject", X509_FLAG_NO_SUBJECT, 0},
-               { "no_issuer", X509_FLAG_NO_ISSUER, 0},
-               { "no_pubkey", X509_FLAG_NO_PUBKEY, 0},
-               { "no_extensions", X509_FLAG_NO_EXTENSIONS, 0},
-               { "no_sigdump", X509_FLAG_NO_SIGDUMP, 0},
-               { "no_aux", X509_FLAG_NO_AUX, 0},
-               { "no_attributes", X509_FLAG_NO_ATTRIBUTES, 0},
-               { "ext_default", X509V3_EXT_DEFAULT, X509V3_EXT_UNKNOWN_MASK},
-               { "ext_error", X509V3_EXT_ERROR_UNKNOWN, X509V3_EXT_UNKNOWN_MASK},
-               { "ext_parse", X509V3_EXT_PARSE_UNKNOWN, X509V3_EXT_UNKNOWN_MASK},
-               { "ext_dump", X509V3_EXT_DUMP_UNKNOWN, X509V3_EXT_UNKNOWN_MASK},
-               { NULL, 0, 0}
-       };
-       return set_multi_opts(flags, arg, cert_tbl);
-}
-
-int set_name_ex(unsigned long *flags, const char *arg)
-{
-       static const NAME_EX_TBL ex_tbl[] = {
-               { "esc_2253", ASN1_STRFLGS_ESC_2253, 0},
-               { "esc_ctrl", ASN1_STRFLGS_ESC_CTRL, 0},
-               { "esc_msb", ASN1_STRFLGS_ESC_MSB, 0},
-               { "use_quote", ASN1_STRFLGS_ESC_QUOTE, 0},
-               { "utf8", ASN1_STRFLGS_UTF8_CONVERT, 0},
-               { "ignore_type", ASN1_STRFLGS_IGNORE_TYPE, 0},
-               { "show_type", ASN1_STRFLGS_SHOW_TYPE, 0},
-               { "dump_all", ASN1_STRFLGS_DUMP_ALL, 0},
-               { "dump_nostr", ASN1_STRFLGS_DUMP_UNKNOWN, 0},
-               { "dump_der", ASN1_STRFLGS_DUMP_DER, 0},
-               { "compat", XN_FLAG_COMPAT, 0xffffffffL},
-               { "sep_comma_plus", XN_FLAG_SEP_COMMA_PLUS, XN_FLAG_SEP_MASK},
-               { "sep_comma_plus_space", XN_FLAG_SEP_CPLUS_SPC, XN_FLAG_SEP_MASK},
-               { "sep_semi_plus_space", XN_FLAG_SEP_SPLUS_SPC, XN_FLAG_SEP_MASK},
-               { "sep_multiline", XN_FLAG_SEP_MULTILINE, XN_FLAG_SEP_MASK},
-               { "dn_rev", XN_FLAG_DN_REV, 0},
-               { "nofname", XN_FLAG_FN_NONE, XN_FLAG_FN_MASK},
-               { "sname", XN_FLAG_FN_SN, XN_FLAG_FN_MASK},
-               { "lname", XN_FLAG_FN_LN, XN_FLAG_FN_MASK},
-               { "align", XN_FLAG_FN_ALIGN, 0},
-               { "oid", XN_FLAG_FN_OID, XN_FLAG_FN_MASK},
-               { "space_eq", XN_FLAG_SPC_EQ, 0},
-               { "dump_unknown", XN_FLAG_DUMP_UNKNOWN_FIELDS, 0},
-               { "RFC2253", XN_FLAG_RFC2253, 0xffffffffL},
-               { "oneline", XN_FLAG_ONELINE, 0xffffffffL},
-               { "multiline", XN_FLAG_MULTILINE, 0xffffffffL},
-               { "ca_default", XN_FLAG_MULTILINE, 0xffffffffL},
-               { NULL, 0, 0}
-       };
-       return set_multi_opts(flags, arg, ex_tbl);
-}
-
-int set_ext_copy(int *copy_type, const char *arg)
-{
-       if (!strcasecmp(arg, "none"))
-               *copy_type = EXT_COPY_NONE;
-       else if (!strcasecmp(arg, "copy"))
-               *copy_type = EXT_COPY_ADD;
-       else if (!strcasecmp(arg, "copyall"))
-               *copy_type = EXT_COPY_ALL;
-       else
-               return 0;
-       return 1;
-}
-
-int copy_extensions(X509 *x, X509_REQ *req, int copy_type)
-{
-       STACK_OF(X509_EXTENSION) *exts = NULL;
-       X509_EXTENSION *ext, *tmpext;
-       ASN1_OBJECT *obj;
-       int i, idx, ret = 0;
-       if (!x || !req || (copy_type == EXT_COPY_NONE))
-               return 1;
-       exts = X509_REQ_get_extensions(req);
-
-       for(i = 0; i < sk_X509_EXTENSION_num(exts); i++) {
-               ext = sk_X509_EXTENSION_value(exts, i);
-               obj = X509_EXTENSION_get_object(ext);
-               idx = X509_get_ext_by_OBJ(x, obj, -1);
-               /* Does extension exist? */
-               if (idx != -1) {
-                       /* If normal copy don't override existing extension */
-                       if (copy_type == EXT_COPY_ADD)
-                               continue;
-                       /* Delete all extensions of same type */
-                       do {
-                               tmpext = X509_get_ext(x, idx);
-                               X509_delete_ext(x, idx);
-                               X509_EXTENSION_free(tmpext);
-                               idx = X509_get_ext_by_OBJ(x, obj, -1);
-                       } while (idx != -1);
-               }
-               if (!X509_add_ext(x, ext, -1))
-                       goto end;
-       }
-
-       ret = 1;
-
-       end:
-
-       sk_X509_EXTENSION_pop_free(exts, X509_EXTENSION_free);
-
-       return ret;
-}
-               
-               
-                       
-
-static int set_multi_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl)
-{
-       STACK_OF(CONF_VALUE) *vals;
-       CONF_VALUE *val;
-       int i, ret = 1;
-       if(!arg) return 0;
-       vals = X509V3_parse_list(arg);
-       for (i = 0; i < sk_CONF_VALUE_num(vals); i++) {
-               val = sk_CONF_VALUE_value(vals, i);
-               if (!set_table_opts(flags, val->name, in_tbl))
-                       ret = 0;
-       }
-       sk_CONF_VALUE_pop_free(vals, X509V3_conf_free);
-       return ret;
-}
-
-static int set_table_opts(unsigned long *flags, const char *arg, const NAME_EX_TBL *in_tbl)
-{
-       char c;
-       const NAME_EX_TBL *ptbl;
-       c = arg[0];
-
-       if(c == '-') {
-               c = 0;
-               arg++;
-       } else if (c == '+') {
-               c = 1;
-               arg++;
-       } else c = 1;
-
-       for(ptbl = in_tbl; ptbl->name; ptbl++) {
-               if(!strcasecmp(arg, ptbl->name)) {
-                       *flags &= ~ptbl->mask;
-                       if(c) *flags |= ptbl->flag;
-                       else *flags &= ~ptbl->flag;
-                       return 1;
-               }
-       }
-       return 0;
-}
-
-void print_name(BIO *out, const char *title, X509_NAME *nm, unsigned long lflags)
-{
-       char *buf;
-       char mline = 0;
-       int indent = 0;
-
-       if(title) BIO_puts(out, title);
-       if((lflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) {
-               mline = 1;
-               indent = 4;
-       }
-       if(lflags == XN_FLAG_COMPAT) {
-               buf = X509_NAME_oneline(nm, 0, 0);
-               BIO_puts(out, buf);
-               BIO_puts(out, "\n");
-               OPENSSL_free(buf);
-       } else {
-               if(mline) BIO_puts(out, "\n");
-               X509_NAME_print_ex(out, nm, indent, lflags);
-               BIO_puts(out, "\n");
-       }
-}
-
-X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath)
-{
-       X509_STORE *store;
-       X509_LOOKUP *lookup;
-       if(!(store = X509_STORE_new())) goto end;
-       lookup=X509_STORE_add_lookup(store,X509_LOOKUP_file());
-       if (lookup == NULL) goto end;
-       if (CAfile) {
-               if(!X509_LOOKUP_load_file(lookup,CAfile,X509_FILETYPE_PEM)) {
-                       BIO_printf(bp, "Error loading file %s\n", CAfile);
-                       goto end;
-               }
-       } else X509_LOOKUP_load_file(lookup,NULL,X509_FILETYPE_DEFAULT);
-               
-       lookup=X509_STORE_add_lookup(store,X509_LOOKUP_hash_dir());
-       if (lookup == NULL) goto end;
-       if (CApath) {
-               if(!X509_LOOKUP_add_dir(lookup,CApath,X509_FILETYPE_PEM)) {
-                       BIO_printf(bp, "Error loading directory %s\n", CApath);
-                       goto end;
-               }
-       } else X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT);
-
-       ERR_clear_error();
-       return store;
-       end:
-       X509_STORE_free(store);
-       return NULL;
-}
-
-#ifndef OPENSSL_NO_ENGINE
-/* Try to load an engine in a shareable library */
-static ENGINE *try_load_engine(BIO *err, const char *engine, int debug)
-       {
-       ENGINE *e = ENGINE_by_id("dynamic");
-       if (e)
-               {
-               if (!ENGINE_ctrl_cmd_string(e, "SO_PATH", engine, 0)
-                       || !ENGINE_ctrl_cmd_string(e, "LOAD", NULL, 0))
-                       {
-                       ENGINE_free(e);
-                       e = NULL;
-                       }
-               }
-       return e;
-       }
-
-ENGINE *setup_engine(BIO *err, const char *engine, int debug)
-        {
-        ENGINE *e = NULL;
-
-        if (engine)
-                {
-               if(strcmp(engine, "auto") == 0)
-                       {
-                       BIO_printf(err,"enabling auto ENGINE support\n");
-                       ENGINE_register_all_complete();
-                       return NULL;
-                       }
-               if((e = ENGINE_by_id(engine)) == NULL
-                       && (e = try_load_engine(err, engine, debug)) == NULL)
-                       {
-                       BIO_printf(err,"invalid engine \"%s\"\n", engine);
-                       ERR_print_errors(err);
-                       return NULL;
-                       }
-               if (debug)
-                       {
-                       ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM,
-                               0, err, 0);
-                       }
-                ENGINE_ctrl_cmd(e, "SET_USER_INTERFACE", 0, ui_method, 0, 1);
-               if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
-                       {
-                       BIO_printf(err,"can't use that engine\n");
-                       ERR_print_errors(err);
-                       ENGINE_free(e);
-                       return NULL;
-                       }
-
-               BIO_printf(err,"engine \"%s\" set.\n", ENGINE_get_id(e));
-
-               /* Free our "structural" reference. */
-               ENGINE_free(e);
-               }
-        return e;
-        }
-#endif
-
-int load_config(BIO *err, CONF *cnf)
-       {
-       static int load_config_called = 0;
-       if (load_config_called)
-               return 1;
-       load_config_called = 1;
-       if (!cnf)
-               cnf = config;
-       if (!cnf)
-               return 1;
-
-       OPENSSL_load_builtin_modules();
-
-       if (CONF_modules_load(cnf, NULL, 0) <= 0)
-               {
-               BIO_printf(err, "Error configuring OpenSSL\n");
-               ERR_print_errors(err);
-               return 0;
-               }
-       return 1;
-       }
-
-char *make_config_name()
-       {
-       const char *t=X509_get_default_cert_area();
-       size_t len;
-       char *p;
-
-       len=strlen(t)+strlen(OPENSSL_CONF)+2;
-       p=OPENSSL_malloc(len);
-       BUF_strlcpy(p,t,len);
-#ifndef OPENSSL_SYS_VMS
-       BUF_strlcat(p,"/",len);
-#endif
-       BUF_strlcat(p,OPENSSL_CONF,len);
-
-       return p;
-       }
-
-static unsigned long index_serial_hash(const OPENSSL_CSTRING *a)
-       {
-       const char *n;
-
-       n=a[DB_serial];
-       while (*n == '0') n++;
-       return(lh_strhash(n));
-       }
-
-static int index_serial_cmp(const OPENSSL_CSTRING *a, const OPENSSL_CSTRING *b)
-       {
-       const char *aa,*bb;
-
-       for (aa=a[DB_serial]; *aa == '0'; aa++);
-       for (bb=b[DB_serial]; *bb == '0'; bb++);
-       return(strcmp(aa,bb));
-       }
-
-static int index_name_qual(char **a)
-       { return(a[0][0] == 'V'); }
-
-static unsigned long index_name_hash(const OPENSSL_CSTRING *a)
-       { return(lh_strhash(a[DB_name])); }
-
-int index_name_cmp(const OPENSSL_CSTRING *a, const OPENSSL_CSTRING *b)
-       { return(strcmp(a[DB_name], b[DB_name])); }
-
-static IMPLEMENT_LHASH_HASH_FN(index_serial, OPENSSL_CSTRING)
-static IMPLEMENT_LHASH_COMP_FN(index_serial, OPENSSL_CSTRING)
-static IMPLEMENT_LHASH_HASH_FN(index_name, OPENSSL_CSTRING)
-static IMPLEMENT_LHASH_COMP_FN(index_name, OPENSSL_CSTRING)
-
-#undef BSIZE
-#define BSIZE 256
-
-BIGNUM *load_serial(char *serialfile, int create, ASN1_INTEGER **retai)
-       {
-       BIO *in=NULL;
-       BIGNUM *ret=NULL;
-       MS_STATIC char buf[1024];
-       ASN1_INTEGER *ai=NULL;
-
-       ai=ASN1_INTEGER_new();
-       if (ai == NULL) goto err;
-
-       if ((in=BIO_new(BIO_s_file())) == NULL)
-               {
-               ERR_print_errors(bio_err);
-               goto err;
-               }
-
-       if (BIO_read_filename(in,serialfile) <= 0)
-               {
-               if (!create)
-                       {
-                       perror(serialfile);
-                       goto err;
-                       }
-               else
-                       {
-                       ret=BN_new();
-                       if (ret == NULL || !rand_serial(ret, ai))
-                               BIO_printf(bio_err, "Out of memory\n");
-                       }
-               }
-       else
-               {
-               if (!a2i_ASN1_INTEGER(in,ai,buf,1024))
-                       {
-                       BIO_printf(bio_err,"unable to load number from %s\n",
-                               serialfile);
-                       goto err;
-                       }
-               ret=ASN1_INTEGER_to_BN(ai,NULL);
-               if (ret == NULL)
-                       {
-                       BIO_printf(bio_err,"error converting number from bin to BIGNUM\n");
-                       goto err;
-                       }
-               }
-
-       if (ret && retai)
-               {
-               *retai = ai;
-               ai = NULL;
-               }
- err:
-       if (in != NULL) BIO_free(in);
-       if (ai != NULL) ASN1_INTEGER_free(ai);
-       return(ret);
-       }
-
-int save_serial(char *serialfile, char *suffix, BIGNUM *serial, ASN1_INTEGER **retai)
-       {
-       char buf[1][BSIZE];
-       BIO *out = NULL;
-       int ret=0;
-       ASN1_INTEGER *ai=NULL;
-       int j;
-
-       if (suffix == NULL)
-               j = strlen(serialfile);
-       else
-               j = strlen(serialfile) + strlen(suffix) + 1;
-       if (j >= BSIZE)
-               {
-               BIO_printf(bio_err,"file name too long\n");
-               goto err;
-               }
-
-       if (suffix == NULL)
-               BUF_strlcpy(buf[0], serialfile, BSIZE);
-       else
-               {
-#ifndef OPENSSL_SYS_VMS
-               j = BIO_snprintf(buf[0], sizeof buf[0], "%s.%s", serialfile, suffix);
-#else
-               j = BIO_snprintf(buf[0], sizeof buf[0], "%s-%s", serialfile, suffix);
-#endif
-               }
-#ifdef RL_DEBUG
-       BIO_printf(bio_err, "DEBUG: writing \"%s\"\n", buf[0]);
-#endif
-       out=BIO_new(BIO_s_file());
-       if (out == NULL)
-               {
-               ERR_print_errors(bio_err);
-               goto err;
-               }
-       if (BIO_write_filename(out,buf[0]) <= 0)
-               {
-               perror(serialfile);
-               goto err;
-               }
-
-       if ((ai=BN_to_ASN1_INTEGER(serial,NULL)) == NULL)
-               {
-               BIO_printf(bio_err,"error converting serial to ASN.1 format\n");
-               goto err;
-               }
-       i2a_ASN1_INTEGER(out,ai);
-       BIO_puts(out,"\n");
-       ret=1;
-       if (retai)
-               {
-               *retai = ai;
-               ai = NULL;
-               }
-err:
-       if (out != NULL) BIO_free_all(out);
-       if (ai != NULL) ASN1_INTEGER_free(ai);
-       return(ret);
-       }
-
-int rotate_serial(char *serialfile, char *new_suffix, char *old_suffix)
-       {
-       char buf[5][BSIZE];
-       int i,j;
-
-       i = strlen(serialfile) + strlen(old_suffix);
-       j = strlen(serialfile) + strlen(new_suffix);
-       if (i > j) j = i;
-       if (j + 1 >= BSIZE)
-               {
-               BIO_printf(bio_err,"file name too long\n");
-               goto err;
-               }
-
-#ifndef OPENSSL_SYS_VMS
-       j = BIO_snprintf(buf[0], sizeof buf[0], "%s.%s",
-               serialfile, new_suffix);
-#else
-       j = BIO_snprintf(buf[0], sizeof buf[0], "%s-%s",
-               serialfile, new_suffix);
-#endif
-#ifndef OPENSSL_SYS_VMS
-       j = BIO_snprintf(buf[1], sizeof buf[1], "%s.%s",
-               serialfile, old_suffix);
-#else
-       j = BIO_snprintf(buf[1], sizeof buf[1], "%s-%s",
-               serialfile, old_suffix);
-#endif
-#ifdef RL_DEBUG
-       BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
-               serialfile, buf[1]);
-#endif
-       if (rename(serialfile,buf[1]) < 0 && errno != ENOENT
-#ifdef ENOTDIR
-                       && errno != ENOTDIR
-#endif
-          )            {
-                       BIO_printf(bio_err,
-                               "unable to rename %s to %s\n",
-                               serialfile, buf[1]);
-                       perror("reason");
-                       goto err;
-                       }
-#ifdef RL_DEBUG
-       BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
-               buf[0],serialfile);
-#endif
-       if (rename(buf[0],serialfile) < 0)
-               {
-               BIO_printf(bio_err,
-                       "unable to rename %s to %s\n",
-                       buf[0],serialfile);
-               perror("reason");
-               rename(buf[1],serialfile);
-               goto err;
-               }
-       return 1;
- err:
-       return 0;
-       }
-
-int rand_serial(BIGNUM *b, ASN1_INTEGER *ai)
-       {
-       BIGNUM *btmp;
-       int ret = 0;
-       if (b)
-               btmp = b;
-       else
-               btmp = BN_new();
-
-       if (!btmp)
-               return 0;
-
-       if (!BN_pseudo_rand(btmp, SERIAL_RAND_BITS, 0, 0))
-               goto error;
-       if (ai && !BN_to_ASN1_INTEGER(btmp, ai))
-               goto error;
-
-       ret = 1;
-       
-       error:
-
-       if (!b)
-               BN_free(btmp);
-       
-       return ret;
-       }
-
-CA_DB *load_index(char *dbfile, DB_ATTR *db_attr)
-       {
-       CA_DB *retdb = NULL;
-       TXT_DB *tmpdb = NULL;
-       BIO *in = BIO_new(BIO_s_file());
-       CONF *dbattr_conf = NULL;
-       char buf[1][BSIZE];
-       long errorline= -1;
-
-       if (in == NULL)
-               {
-               ERR_print_errors(bio_err);
-               goto err;
-               }
-       if (BIO_read_filename(in,dbfile) <= 0)
-               {
-               perror(dbfile);
-               BIO_printf(bio_err,"unable to open '%s'\n",dbfile);
-               goto err;
-               }
-       if ((tmpdb = TXT_DB_read(in,DB_NUMBER)) == NULL)
-               goto err;
-
-#ifndef OPENSSL_SYS_VMS
-       BIO_snprintf(buf[0], sizeof buf[0], "%s.attr", dbfile);
-#else
-       BIO_snprintf(buf[0], sizeof buf[0], "%s-attr", dbfile);
-#endif
-       dbattr_conf = NCONF_new(NULL);
-       if (NCONF_load(dbattr_conf,buf[0],&errorline) <= 0)
-               {
-               if (errorline > 0)
-                       {
-                       BIO_printf(bio_err,
-                               "error on line %ld of db attribute file '%s'\n"
-                               ,errorline,buf[0]);
-                       goto err;
-                       }
-               else
-                       {
-                       NCONF_free(dbattr_conf);
-                       dbattr_conf = NULL;
-                       }
-               }
-
-       if ((retdb = OPENSSL_malloc(sizeof(CA_DB))) == NULL)
-               {
-               fprintf(stderr, "Out of memory\n");
-               goto err;
-               }
-
-       retdb->db = tmpdb;
-       tmpdb = NULL;
-       if (db_attr)
-               retdb->attributes = *db_attr;
-       else
-               {
-               retdb->attributes.unique_subject = 1;
-               }
-
-       if (dbattr_conf)
-               {
-               char *p = NCONF_get_string(dbattr_conf,NULL,"unique_subject");
-               if (p)
-                       {
-#ifdef RL_DEBUG
-                       BIO_printf(bio_err, "DEBUG[load_index]: unique_subject = \"%s\"\n", p);
-#endif
-                       retdb->attributes.unique_subject = parse_yesno(p,1);
-                       }
-               }
-
- err:
-       if (dbattr_conf) NCONF_free(dbattr_conf);
-       if (tmpdb) TXT_DB_free(tmpdb);
-       if (in) BIO_free_all(in);
-       return retdb;
-       }
-
-int index_index(CA_DB *db)
-       {
-       if (!TXT_DB_create_index(db->db, DB_serial, NULL,
-                               LHASH_HASH_FN(index_serial),
-                               LHASH_COMP_FN(index_serial)))
-               {
-               BIO_printf(bio_err,
-                 "error creating serial number index:(%ld,%ld,%ld)\n",
-                                       db->db->error,db->db->arg1,db->db->arg2);
-                       return 0;
-               }
-
-       if (db->attributes.unique_subject
-               && !TXT_DB_create_index(db->db, DB_name, index_name_qual,
-                       LHASH_HASH_FN(index_name),
-                       LHASH_COMP_FN(index_name)))
-               {
-               BIO_printf(bio_err,"error creating name index:(%ld,%ld,%ld)\n",
-                       db->db->error,db->db->arg1,db->db->arg2);
-               return 0;
-               }
-       return 1;
-       }
-
-int save_index(const char *dbfile, const char *suffix, CA_DB *db)
-       {
-       char buf[3][BSIZE];
-       BIO *out = BIO_new(BIO_s_file());
-       int j;
-
-       if (out == NULL)
-               {
-               ERR_print_errors(bio_err);
-               goto err;
-               }
-
-       j = strlen(dbfile) + strlen(suffix);
-       if (j + 6 >= BSIZE)
-               {
-               BIO_printf(bio_err,"file name too long\n");
-               goto err;
-               }
-
-#ifndef OPENSSL_SYS_VMS
-       j = BIO_snprintf(buf[2], sizeof buf[2], "%s.attr", dbfile);
-#else
-       j = BIO_snprintf(buf[2], sizeof buf[2], "%s-attr", dbfile);
-#endif
-#ifndef OPENSSL_SYS_VMS
-       j = BIO_snprintf(buf[1], sizeof buf[1], "%s.attr.%s", dbfile, suffix);
-#else
-       j = BIO_snprintf(buf[1], sizeof buf[1], "%s-attr-%s", dbfile, suffix);
-#endif
-#ifndef OPENSSL_SYS_VMS
-       j = BIO_snprintf(buf[0], sizeof buf[0], "%s.%s", dbfile, suffix);
-#else
-       j = BIO_snprintf(buf[0], sizeof buf[0], "%s-%s", dbfile, suffix);
-#endif
-#ifdef RL_DEBUG
-       BIO_printf(bio_err, "DEBUG: writing \"%s\"\n", buf[0]);
-#endif
-       if (BIO_write_filename(out,buf[0]) <= 0)
-               {
-               perror(dbfile);
-               BIO_printf(bio_err,"unable to open '%s'\n", dbfile);
-               goto err;
-               }
-       j=TXT_DB_write(out,db->db);
-       if (j <= 0) goto err;
-                       
-       BIO_free(out);
-
-       out = BIO_new(BIO_s_file());
-#ifdef RL_DEBUG
-       BIO_printf(bio_err, "DEBUG: writing \"%s\"\n", buf[1]);
-#endif
-       if (BIO_write_filename(out,buf[1]) <= 0)
-               {
-               perror(buf[2]);
-               BIO_printf(bio_err,"unable to open '%s'\n", buf[2]);
-               goto err;
-               }
-       BIO_printf(out,"unique_subject = %s\n",
-               db->attributes.unique_subject ? "yes" : "no");
-       BIO_free(out);
-
-       return 1;
- err:
-       return 0;
-       }
-
-int rotate_index(const char *dbfile, const char *new_suffix, const char *old_suffix)
-       {
-       char buf[5][BSIZE];
-       int i,j;
-
-       i = strlen(dbfile) + strlen(old_suffix);
-       j = strlen(dbfile) + strlen(new_suffix);
-       if (i > j) j = i;
-       if (j + 6 >= BSIZE)
-               {
-               BIO_printf(bio_err,"file name too long\n");
-               goto err;
-               }
-
-#ifndef OPENSSL_SYS_VMS
-       j = BIO_snprintf(buf[4], sizeof buf[4], "%s.attr", dbfile);
-#else
-       j = BIO_snprintf(buf[4], sizeof buf[4], "%s-attr", dbfile);
-#endif
-#ifndef OPENSSL_SYS_VMS
-       j = BIO_snprintf(buf[2], sizeof buf[2], "%s.attr.%s",
-               dbfile, new_suffix);
-#else
-       j = BIO_snprintf(buf[2], sizeof buf[2], "%s-attr-%s",
-               dbfile, new_suffix);
-#endif
-#ifndef OPENSSL_SYS_VMS
-       j = BIO_snprintf(buf[0], sizeof buf[0], "%s.%s",
-               dbfile, new_suffix);
-#else
-       j = BIO_snprintf(buf[0], sizeof buf[0], "%s-%s",
-               dbfile, new_suffix);
-#endif
-#ifndef OPENSSL_SYS_VMS
-       j = BIO_snprintf(buf[1], sizeof buf[1], "%s.%s",
-               dbfile, old_suffix);
-#else
-       j = BIO_snprintf(buf[1], sizeof buf[1], "%s-%s",
-               dbfile, old_suffix);
-#endif
-#ifndef OPENSSL_SYS_VMS
-       j = BIO_snprintf(buf[3], sizeof buf[3], "%s.attr.%s",
-               dbfile, old_suffix);
-#else
-       j = BIO_snprintf(buf[3], sizeof buf[3], "%s-attr-%s",
-               dbfile, old_suffix);
-#endif
-#ifdef RL_DEBUG
-       BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
-               dbfile, buf[1]);
-#endif
-       if (rename(dbfile,buf[1]) < 0 && errno != ENOENT
-#ifdef ENOTDIR
-               && errno != ENOTDIR
-#endif
-          )            {
-                       BIO_printf(bio_err,
-                               "unable to rename %s to %s\n",
-                               dbfile, buf[1]);
-                       perror("reason");
-                       goto err;
-                       }
-#ifdef RL_DEBUG
-       BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
-               buf[0],dbfile);
-#endif
-       if (rename(buf[0],dbfile) < 0)
-               {
-               BIO_printf(bio_err,
-                       "unable to rename %s to %s\n",
-                       buf[0],dbfile);
-               perror("reason");
-               rename(buf[1],dbfile);
-               goto err;
-               }
-#ifdef RL_DEBUG
-       BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
-               buf[4],buf[3]);
-#endif
-       if (rename(buf[4],buf[3]) < 0 && errno != ENOENT
-#ifdef ENOTDIR
-               && errno != ENOTDIR
-#endif
-          )            {
-                       BIO_printf(bio_err,
-                               "unable to rename %s to %s\n",
-                               buf[4], buf[3]);
-                       perror("reason");
-                       rename(dbfile,buf[0]);
-                       rename(buf[1],dbfile);
-                       goto err;
-                       }
-#ifdef RL_DEBUG
-       BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",
-               buf[2],buf[4]);
-#endif
-       if (rename(buf[2],buf[4]) < 0)
-               {
-               BIO_printf(bio_err,
-                       "unable to rename %s to %s\n",
-                       buf[2],buf[4]);
-               perror("reason");
-               rename(buf[3],buf[4]);
-               rename(dbfile,buf[0]);
-               rename(buf[1],dbfile);
-               goto err;
-               }
-       return 1;
- err:
-       return 0;
-       }
-
-void free_index(CA_DB *db)
-       {
-       if (db)
-               {
-               if (db->db) TXT_DB_free(db->db);
-               OPENSSL_free(db);
-               }
-       }
-
-int parse_yesno(const char *str, int def)
-       {
-       int ret = def;
-       if (str)
-               {
-               switch (*str)
-                       {
-               case 'f': /* false */
-               case 'F': /* FALSE */
-               case 'n': /* no */
-               case 'N': /* NO */
-               case '0': /* 0 */
-                       ret = 0;
-                       break;
-               case 't': /* true */
-               case 'T': /* TRUE */
-               case 'y': /* yes */
-               case 'Y': /* YES */
-               case '1': /* 1 */
-                       ret = 1;
-                       break;
-               default:
-                       ret = def;
-                       break;
-                       }
-               }
-       return ret;
-       }
-
-/*
- * subject is expected to be in the format /type0=value0/type1=value1/type2=...
- * where characters may be escaped by \
- */
-X509_NAME *parse_name(char *subject, long chtype, int multirdn)
-       {
-       size_t buflen = strlen(subject)+1; /* to copy the types and values into. due to escaping, the copy can only become shorter */
-       char *buf = OPENSSL_malloc(buflen);
-       size_t max_ne = buflen / 2 + 1; /* maximum number of name elements */
-       char **ne_types = OPENSSL_malloc(max_ne * sizeof (char *));
-       char **ne_values = OPENSSL_malloc(max_ne * sizeof (char *));
-       int *mval = OPENSSL_malloc (max_ne * sizeof (int));
-
-       char *sp = subject, *bp = buf;
-       int i, ne_num = 0;
-
-       X509_NAME *n = NULL;
-       int nid;
-
-       if (!buf || !ne_types || !ne_values)
-               {
-               BIO_printf(bio_err, "malloc error\n");
-               goto error;
-               }       
-
-       if (*subject != '/')
-               {
-               BIO_printf(bio_err, "Subject does not start with '/'.\n");
-               goto error;
-               }
-       sp++; /* skip leading / */
-
-       /* no multivalued RDN by default */
-       mval[ne_num] = 0;
-
-       while (*sp)
-               {
-               /* collect type */
-               ne_types[ne_num] = bp;
-               while (*sp)
-                       {
-                       if (*sp == '\\') /* is there anything to escape in the type...? */
-                               {
-                               if (*++sp)
-                                       *bp++ = *sp++;
-                               else    
-                                       {
-                                       BIO_printf(bio_err, "escape character at end of string\n");
-                                       goto error;
-                                       }
-                               }       
-                       else if (*sp == '=')
-                               {
-                               sp++;
-                               *bp++ = '\0';
-                               break;
-                               }
-                       else
-                               *bp++ = *sp++;
-                       }
-               if (!*sp)
-                       {
-                       BIO_printf(bio_err, "end of string encountered while processing type of subject name element #%d\n", ne_num);
-                       goto error;
-                       }
-               ne_values[ne_num] = bp;
-               while (*sp)
-                       {
-                       if (*sp == '\\')
-                               {
-                               if (*++sp)
-                                       *bp++ = *sp++;
-                               else
-                                       {
-                                       BIO_printf(bio_err, "escape character at end of string\n");
-                                       goto error;
-                                       }
-                               }
-                       else if (*sp == '/')
-                               {
-                               sp++;
-                               /* no multivalued RDN by default */
-                               mval[ne_num+1] = 0;
-                               break;
-                               }
-                       else if (*sp == '+' && multirdn)
-                               {
-                               /* a not escaped + signals a mutlivalued RDN */
-                               sp++;
-                               mval[ne_num+1] = -1;
-                               break;
-                               }
-                       else
-                               *bp++ = *sp++;
-                       }
-               *bp++ = '\0';
-               ne_num++;
-               }       
-
-       if (!(n = X509_NAME_new()))
-               goto error;
-
-       for (i = 0; i < ne_num; i++)
-               {
-               if ((nid=OBJ_txt2nid(ne_types[i])) == NID_undef)
-                       {
-                       BIO_printf(bio_err, "Subject Attribute %s has no known NID, skipped\n", ne_types[i]);
-                       continue;
-                       }
-
-               if (!*ne_values[i])
-                       {
-                       BIO_printf(bio_err, "No value provided for Subject Attribute %s, skipped\n", ne_types[i]);
-                       continue;
-                       }
-
-               if (!X509_NAME_add_entry_by_NID(n, nid, chtype, (unsigned char*)ne_values[i], -1,-1,mval[i]))
-                       goto error;
-               }
-
-       OPENSSL_free(ne_values);
-       OPENSSL_free(ne_types);
-       OPENSSL_free(buf);
-       return n;
-
-error:
-       X509_NAME_free(n);
-       if (ne_values)
-               OPENSSL_free(ne_values);
-       if (ne_types)
-               OPENSSL_free(ne_types);
-       if (buf)
-               OPENSSL_free(buf);
-       return NULL;
-}
-
-int args_verify(char ***pargs, int *pargc,
-                       int *badarg, BIO *err, X509_VERIFY_PARAM **pm)
-       {
-       ASN1_OBJECT *otmp = NULL;
-       unsigned long flags = 0;
-       int i;
-       int purpose = 0, depth = -1;
-       char **oldargs = *pargs;
-       char *arg = **pargs, *argn = (*pargs)[1];
-       if (!strcmp(arg, "-policy"))
-               {
-               if (!argn)
-                       *badarg = 1;
-               else
-                       {
-                       otmp = OBJ_txt2obj(argn, 0);
-                       if (!otmp)
-                               {
-                               BIO_printf(err, "Invalid Policy \"%s\"\n",
-                                                                       argn);
-                               *badarg = 1;
-                               }
-                       }
-               (*pargs)++;
-               }
-       else if (strcmp(arg,"-purpose") == 0)
-               {
-               X509_PURPOSE *xptmp;
-               if (!argn)
-                       *badarg = 1;
-               else
-                       {
-                       i = X509_PURPOSE_get_by_sname(argn);
-                       if(i < 0)
-                               {
-                               BIO_printf(err, "unrecognized purpose\n");
-                               *badarg = 1;
-                               }
-                       else
-                               {
-                               xptmp = X509_PURPOSE_get0(i);
-                               purpose = X509_PURPOSE_get_id(xptmp);
-                               }
-                       }
-               (*pargs)++;
-               }
-       else if (strcmp(arg,"-verify_depth") == 0)
-               {
-               if (!argn)
-                       *badarg = 1;
-               else
-                       {
-                       depth = atoi(argn);
-                       if(depth < 0)
-                               {
-                               BIO_printf(err, "invalid depth\n");
-                               *badarg = 1;
-                               }
-                       }
-               (*pargs)++;
-               }
-       else if (!strcmp(arg, "-ignore_critical"))
-               flags |= X509_V_FLAG_IGNORE_CRITICAL;
-       else if (!strcmp(arg, "-issuer_checks"))
-               flags |= X509_V_FLAG_CB_ISSUER_CHECK;
-       else if (!strcmp(arg, "-crl_check"))
-               flags |=  X509_V_FLAG_CRL_CHECK;
-       else if (!strcmp(arg, "-crl_check_all"))
-               flags |= X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL;
-       else if (!strcmp(arg, "-policy_check"))
-               flags |= X509_V_FLAG_POLICY_CHECK;
-       else if (!strcmp(arg, "-explicit_policy"))
-               flags |= X509_V_FLAG_EXPLICIT_POLICY;
-       else if (!strcmp(arg, "-inhibit_any"))
-               flags |= X509_V_FLAG_INHIBIT_ANY;
-       else if (!strcmp(arg, "-inhibit_map"))
-               flags |= X509_V_FLAG_INHIBIT_MAP;
-       else if (!strcmp(arg, "-x509_strict"))
-               flags |= X509_V_FLAG_X509_STRICT;
-       else if (!strcmp(arg, "-extended_crl"))
-               flags |= X509_V_FLAG_EXTENDED_CRL_SUPPORT;
-       else if (!strcmp(arg, "-use_deltas"))
-               flags |= X509_V_FLAG_USE_DELTAS;
-       else if (!strcmp(arg, "-policy_print"))
-               flags |= X509_V_FLAG_NOTIFY_POLICY;
-       else if (!strcmp(arg, "-check_ss_sig"))
-               flags |= X509_V_FLAG_CHECK_SS_SIGNATURE;
-       else
-               return 0;
-
-       if (*badarg)
-               {
-               if (*pm)
-                       X509_VERIFY_PARAM_free(*pm);
-               *pm = NULL;
-               goto end;
-               }
-
-       if (!*pm && !(*pm = X509_VERIFY_PARAM_new()))
-               {
-               *badarg = 1;
-               goto end;
-               }
-
-       if (otmp)
-               X509_VERIFY_PARAM_add0_policy(*pm, otmp);
-       if (flags)
-               X509_VERIFY_PARAM_set_flags(*pm, flags);
-
-       if (purpose)
-               X509_VERIFY_PARAM_set_purpose(*pm, purpose);
-
-       if (depth >= 0)
-               X509_VERIFY_PARAM_set_depth(*pm, depth);
-
-       end:
-
-       (*pargs)++;
-
-       if (pargc)
-               *pargc -= *pargs - oldargs;
-
-       return 1;
-
-       }
-
-/* Read whole contents of a BIO into an allocated memory buffer and
- * return it.
- */
-
-int bio_to_mem(unsigned char **out, int maxlen, BIO *in)
-       {
-       BIO *mem;
-       int len, ret;
-       unsigned char tbuf[1024];
-       mem = BIO_new(BIO_s_mem());
-       if (!mem)
-               return -1;
-       for(;;)
-               {
-               if ((maxlen != -1) && maxlen < 1024)
-                       len = maxlen;
-               else
-                       len = 1024;
-               len = BIO_read(in, tbuf, len);
-               if (len <= 0)
-                       break;
-               if (BIO_write(mem, tbuf, len) != len)
-                       {
-                       BIO_free(mem);
-                       return -1;
-                       }
-               maxlen -= len;
-
-               if (maxlen == 0)
-                       break;
-               }
-       ret = BIO_get_mem_data(mem, (char **)out);
-       BIO_set_flags(mem, BIO_FLAGS_MEM_RDONLY);
-       BIO_free(mem);
-       return ret;
-       }
-
-int pkey_ctrl_string(EVP_PKEY_CTX *ctx, char *value)
-       {
-       int rv;
-       char *stmp, *vtmp = NULL;
-       stmp = BUF_strdup(value);
-       if (!stmp)
-               return -1;
-       vtmp = strchr(stmp, ':');
-       if (vtmp)
-               {
-               *vtmp = 0;
-               vtmp++;
-               }
-       rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp);
-       OPENSSL_free(stmp);
-       return rv;
-       }
-
-static void nodes_print(BIO *out, const char *name,
-       STACK_OF(X509_POLICY_NODE) *nodes)
-       {
-       X509_POLICY_NODE *node;
-       int i;
-       BIO_printf(out, "%s Policies:", name);
-       if (nodes)
-               {
-               BIO_puts(out, "\n");
-               for (i = 0; i < sk_X509_POLICY_NODE_num(nodes); i++)
-                       {
-                       node = sk_X509_POLICY_NODE_value(nodes, i);
-                       X509_POLICY_NODE_print(out, node, 2);
-                       }
-               }
-       else
-               BIO_puts(out, " <empty>\n");
-       }
-
-void policies_print(BIO *out, X509_STORE_CTX *ctx)
-       {
-       X509_POLICY_TREE *tree;
-       int explicit_policy;
-       int free_out = 0;
-       if (out == NULL)
-               {
-               out = BIO_new_fp(stderr, BIO_NOCLOSE);
-               free_out = 1;
-               }
-       tree = X509_STORE_CTX_get0_policy_tree(ctx);
-       explicit_policy = X509_STORE_CTX_get_explicit_policy(ctx);
-
-       BIO_printf(out, "Require explicit Policy: %s\n",
-                               explicit_policy ? "True" : "False");
-
-       nodes_print(out, "Authority", X509_policy_tree_get0_policies(tree));
-       nodes_print(out, "User", X509_policy_tree_get0_user_policies(tree));
-       if (free_out)
-               BIO_free(out);
-       }
-
-#if !defined(OPENSSL_NO_JPAKE) && !defined(OPENSSL_NO_PSK)
-
-static JPAKE_CTX *jpake_init(const char *us, const char *them,
-                                                        const char *secret)
-       {
-       BIGNUM *p = NULL;
-       BIGNUM *g = NULL;
-       BIGNUM *q = NULL;
-       BIGNUM *bnsecret = BN_new();
-       JPAKE_CTX *ctx;
-
-       /* Use a safe prime for p (that we found earlier) */
-       BN_hex2bn(&p, "F9E5B365665EA7A05A9C534502780FEE6F1AB5BD4F49947FD036DBD7E905269AF46EF28B0FC07487EE4F5D20FB3C0AF8E700F3A2FA3414970CBED44FEDFF80CE78D800F184BB82435D137AADA2C6C16523247930A63B85661D1FC817A51ACD96168E95898A1F83A79FFB529368AA7833ABD1B0C3AEDDB14D2E1A2F71D99F763F");
-       g = BN_new();
-       BN_set_word(g, 2);
-       q = BN_new();
-       BN_rshift1(q, p);
-
-       BN_bin2bn((const unsigned char *)secret, strlen(secret), bnsecret);
-
-       ctx = JPAKE_CTX_new(us, them, p, g, q, bnsecret);
-       BN_free(bnsecret);
-       BN_free(q);
-       BN_free(g);
-       BN_free(p);
-
-       return ctx;
-       }
-
-static void jpake_send_part(BIO *conn, const JPAKE_STEP_PART *p)
-       {
-       BN_print(conn, p->gx);
-       BIO_puts(conn, "\n");
-       BN_print(conn, p->zkpx.gr);
-       BIO_puts(conn, "\n");
-       BN_print(conn, p->zkpx.b);
-       BIO_puts(conn, "\n");
-       }
-
-static void jpake_send_step1(BIO *bconn, JPAKE_CTX *ctx)
-       {
-       JPAKE_STEP1 s1;
-
-       JPAKE_STEP1_init(&s1);
-       JPAKE_STEP1_generate(&s1, ctx);
-       jpake_send_part(bconn, &s1.p1);
-       jpake_send_part(bconn, &s1.p2);
-       (void)BIO_flush(bconn);
-       JPAKE_STEP1_release(&s1);
-       }
-
-static void jpake_send_step2(BIO *bconn, JPAKE_CTX *ctx)
-       {
-       JPAKE_STEP2 s2;
-
-       JPAKE_STEP2_init(&s2);
-       JPAKE_STEP2_generate(&s2, ctx);
-       jpake_send_part(bconn, &s2);
-       (void)BIO_flush(bconn);
-       JPAKE_STEP2_release(&s2);
-       }
-
-static void jpake_send_step3a(BIO *bconn, JPAKE_CTX *ctx)
-       {
-       JPAKE_STEP3A s3a;
-
-       JPAKE_STEP3A_init(&s3a);
-       JPAKE_STEP3A_generate(&s3a, ctx);
-       BIO_write(bconn, s3a.hhk, sizeof s3a.hhk);
-       (void)BIO_flush(bconn);
-       JPAKE_STEP3A_release(&s3a);
-       }
-
-static void jpake_send_step3b(BIO *bconn, JPAKE_CTX *ctx)
-       {
-       JPAKE_STEP3B s3b;
-
-       JPAKE_STEP3B_init(&s3b);
-       JPAKE_STEP3B_generate(&s3b, ctx);
-       BIO_write(bconn, s3b.hk, sizeof s3b.hk);
-       (void)BIO_flush(bconn);
-       JPAKE_STEP3B_release(&s3b);
-       }
-
-static void readbn(BIGNUM **bn, BIO *bconn)
-       {
-       char buf[10240];
-       int l;
-
-       l = BIO_gets(bconn, buf, sizeof buf);
-       assert(l > 0);
-       assert(buf[l-1] == '\n');
-       buf[l-1] = '\0';
-       BN_hex2bn(bn, buf);
-       }
-
-static void jpake_receive_part(JPAKE_STEP_PART *p, BIO *bconn)
-       {
-       readbn(&p->gx, bconn);
-       readbn(&p->zkpx.gr, bconn);
-       readbn(&p->zkpx.b, bconn);
-       }
-
-static void jpake_receive_step1(JPAKE_CTX *ctx, BIO *bconn)
-       {
-       JPAKE_STEP1 s1;
-
-       JPAKE_STEP1_init(&s1);
-       jpake_receive_part(&s1.p1, bconn);
-       jpake_receive_part(&s1.p2, bconn);
-       if(!JPAKE_STEP1_process(ctx, &s1))
-               {
-               ERR_print_errors(bio_err);
-               exit(1);
-               }
-       JPAKE_STEP1_release(&s1);
-       }
-
-static void jpake_receive_step2(JPAKE_CTX *ctx, BIO *bconn)
-       {
-       JPAKE_STEP2 s2;
-
-       JPAKE_STEP2_init(&s2);
-       jpake_receive_part(&s2, bconn);
-       if(!JPAKE_STEP2_process(ctx, &s2))
-               {
-               ERR_print_errors(bio_err);
-               exit(1);
-               }
-       JPAKE_STEP2_release(&s2);
-       }
-
-static void jpake_receive_step3a(JPAKE_CTX *ctx, BIO *bconn)
-       {
-       JPAKE_STEP3A s3a;
-       int l;
-
-       JPAKE_STEP3A_init(&s3a);
-       l = BIO_read(bconn, s3a.hhk, sizeof s3a.hhk);
-       assert(l == sizeof s3a.hhk);
-       if(!JPAKE_STEP3A_process(ctx, &s3a))
-               {
-               ERR_print_errors(bio_err);
-               exit(1);
-               }
-       JPAKE_STEP3A_release(&s3a);
-       }
-
-static void jpake_receive_step3b(JPAKE_CTX *ctx, BIO *bconn)
-       {
-       JPAKE_STEP3B s3b;
-       int l;
-
-       JPAKE_STEP3B_init(&s3b);
-       l = BIO_read(bconn, s3b.hk, sizeof s3b.hk);
-       assert(l == sizeof s3b.hk);
-       if(!JPAKE_STEP3B_process(ctx, &s3b))
-               {
-               ERR_print_errors(bio_err);
-               exit(1);
-               }
-       JPAKE_STEP3B_release(&s3b);
-       }
-
-void jpake_client_auth(BIO *out, BIO *conn, const char *secret)
-       {
-       JPAKE_CTX *ctx;
-       BIO *bconn;
-
-       BIO_puts(out, "Authenticating with JPAKE\n");
-
-       ctx = jpake_init("client", "server", secret);
-
-       bconn = BIO_new(BIO_f_buffer());
-       BIO_push(bconn, conn);
-
-       jpake_send_step1(bconn, ctx);
-       jpake_receive_step1(ctx, bconn);
-       jpake_send_step2(bconn, ctx);
-       jpake_receive_step2(ctx, bconn);
-       jpake_send_step3a(bconn, ctx);
-       jpake_receive_step3b(ctx, bconn);
-
-       BIO_puts(out, "JPAKE authentication succeeded, setting PSK\n");
-
-       psk_key = BN_bn2hex(JPAKE_get_shared_key(ctx));
-
-       BIO_pop(bconn);
-       BIO_free(bconn);
-
-       JPAKE_CTX_free(ctx);
-       }
-
-void jpake_server_auth(BIO *out, BIO *conn, const char *secret)
-       {
-       JPAKE_CTX *ctx;
-       BIO *bconn;
-
-       BIO_puts(out, "Authenticating with JPAKE\n");
-
-       ctx = jpake_init("server", "client", secret);
-
-       bconn = BIO_new(BIO_f_buffer());
-       BIO_push(bconn, conn);
-
-       jpake_receive_step1(ctx, bconn);
-       jpake_send_step1(bconn, ctx);
-       jpake_receive_step2(ctx, bconn);
-       jpake_send_step2(bconn, ctx);
-       jpake_receive_step3a(ctx, bconn);
-       jpake_send_step3b(bconn, ctx);
-
-       BIO_puts(out, "JPAKE authentication succeeded, setting PSK\n");
-
-       psk_key = BN_bn2hex(JPAKE_get_shared_key(ctx));
-
-       BIO_pop(bconn);
-       BIO_free(bconn);
-
-       JPAKE_CTX_free(ctx);
-       }
-
-#endif
-
-/*
- * Platform-specific sections
- */
-#if defined(_WIN32)
-# ifdef fileno
-#  undef fileno
-#  define fileno(a) (int)_fileno(a)
-# endif
-
-# include <windows.h>
-# include <tchar.h>
-
-static int WIN32_rename(const char *from, const char *to)
-       {
-       TCHAR  *tfrom=NULL,*tto;
-       DWORD   err;
-       int     ret=0;
-
-       if (sizeof(TCHAR) == 1)
-               {
-               tfrom = (TCHAR *)from;
-               tto   = (TCHAR *)to;
-               }
-       else    /* UNICODE path */
-               {
-               size_t i,flen=strlen(from)+1,tlen=strlen(to)+1;
-               tfrom = (TCHAR *)malloc(sizeof(TCHAR)*(flen+tlen));
-               if (tfrom==NULL) goto err;
-               tto=tfrom+flen;
-#if !defined(_WIN32_WCE) || _WIN32_WCE>=101
-               if (!MultiByteToWideChar(CP_ACP,0,from,flen,(WCHAR *)tfrom,flen))
-#endif
-                       for (i=0;i<flen;i++)    tfrom[i]=(TCHAR)from[i];
-#if !defined(_WIN32_WCE) || _WIN32_WCE>=101
-               if (!MultiByteToWideChar(CP_ACP,0,to,  tlen,(WCHAR *)tto,  tlen))
-#endif
-                       for (i=0;i<tlen;i++)    tto[i]  =(TCHAR)to[i];
-               }
-
-       if (MoveFile(tfrom,tto))        goto ok;
-       err=GetLastError();
-       if (err==ERROR_ALREADY_EXISTS || err==ERROR_FILE_EXISTS)
-               {
-               if (DeleteFile(tto) && MoveFile(tfrom,tto))
-                       goto ok;
-               err=GetLastError();
-               }
-       if (err==ERROR_FILE_NOT_FOUND || err==ERROR_PATH_NOT_FOUND)
-               errno = ENOENT;
-       else if (err==ERROR_ACCESS_DENIED)
-               errno = EACCES;
-       else
-               errno = EINVAL; /* we could map more codes... */
-err:
-       ret=-1;
-ok:
-       if (tfrom!=NULL && tfrom!=(TCHAR *)from)        free(tfrom);
-       return ret;
-       }
-#endif
-
-/* app_tminterval section */
-
-#include <barrelfish/barrelfish.h>
-extern uint64_t tscperms;
-double app_tminterval(int stop,int usertime)
-{
-    static uint64_t start_time = 0;
-
-    if (stop == TM_START) {
-        start_time = rdtsc();
-        return 0;
-    } else {
-        return ((double)((double)(rdtsc() - start_time) / (double)tscperms)
-                / (double)1000.0);
-    }
-}
-//asq: use own implementation in Barrelfish
-//#if defined(_WIN32)
-//double app_tminterval(int stop,int usertime)
-//     {
-//     FILETIME                now;
-//     double                  ret=0;
-//     static ULARGE_INTEGER   tmstart;
-//     static int              warning=1;
-//#ifdef _WIN32_WINNT
-//     static HANDLE           proc=NULL;
-//
-//     if (proc==NULL)
-//             {
-//             if (GetVersion() < 0x80000000)
-//                     proc = OpenProcess(PROCESS_QUERY_INFORMATION,FALSE,
-//                                             GetCurrentProcessId());
-//             if (proc==NULL) proc = (HANDLE)-1;
-//             }
-//
-//     if (usertime && proc!=(HANDLE)-1)
-//             {
-//             FILETIME junk;
-//             GetProcessTimes(proc,&junk,&junk,&junk,&now);
-//             }
-//     else
-//#endif
-//             {
-//             SYSTEMTIME systime;
-//
-//             if (usertime && warning)
-//                     {
-//                     BIO_printf(bio_err,"To get meaningful results, run "
-//                                        "this program on idle system.\n");
-//                     warning=0;
-//                     }
-//             GetSystemTime(&systime);
-//             SystemTimeToFileTime(&systime,&now);
-//             }
-//
-//     if (stop==TM_START)
-//             {
-//             tmstart.u.LowPart  = now.dwLowDateTime;
-//             tmstart.u.HighPart = now.dwHighDateTime;
-//             }
-//     else    {
-//             ULARGE_INTEGER tmstop;
-//
-//             tmstop.u.LowPart   = now.dwLowDateTime;
-//             tmstop.u.HighPart  = now.dwHighDateTime;
-//
-//             ret = (__int64)(tmstop.QuadPart - tmstart.QuadPart)*1e-7;
-//             }
-//
-//     return (ret);
-//     }
-//
-//#elif defined(OPENSSL_SYS_NETWARE)
-//#include <time.h>
-//
-//double app_tminterval(int stop,int usertime)
-//     {
-//     double          ret=0;
-//     static clock_t  tmstart;
-//     static int      warning=1;
-//
-//     if (usertime && warning)
-//             {
-//             BIO_printf(bio_err,"To get meaningful results, run "
-//                                "this program on idle system.\n");
-//             warning=0;
-//             }
-//
-//     if (stop==TM_START)     tmstart = clock();
-//     else                    ret     = (clock()-tmstart)/(double)CLOCKS_PER_SEC;
-//
-//     return (ret);
-//     }
-//
-//#elif defined(OPENSSL_SYSTEM_VXWORKS)
-//#include <time.h>
-//
-//double app_tminterval(int stop,int usertime)
-//     {
-//     double ret=0;
-//#ifdef CLOCK_REALTIME
-//     static struct timespec  tmstart;
-//     struct timespec         now;
-//#else
-//     static unsigned long    tmstart;
-//     unsigned long           now;
-//#endif
-//     static int warning=1;
-//
-//     if (usertime && warning)
-//             {
-//             BIO_printf(bio_err,"To get meaningful results, run "
-//                                "this program on idle system.\n");
-//             warning=0;
-//             }
-//
-//#ifdef CLOCK_REALTIME
-//     clock_gettime(CLOCK_REALTIME,&now);
-//     if (stop==TM_START)     tmstart = now;
-//     else    ret = ( (now.tv_sec+now.tv_nsec*1e-9)
-//                     - (tmstart.tv_sec+tmstart.tv_nsec*1e-9) );
-//#else
-//     now = tickGet();
-//     if (stop==TM_START)     tmstart = now;
-//     else                    ret = (now - tmstart)/(double)sysClkRateGet();
-//#endif
-//     return (ret);
-//     }
-//
-//#elif defined(OPENSSL_SYSTEM_VMS)
-//#include <time.h>
-//#include <times.h>
-//
-//double app_tminterval(int stop,int usertime)
-//     {
-//     static clock_t  tmstart;
-//     double          ret = 0;
-//     clock_t         now;
-//#ifdef __TMS
-//     struct tms      rus;
-//
-//     now = times(&rus);
-//     if (usertime)   now = rus.tms_utime;
-//#else
-//     if (usertime)
-//             now = clock(); /* sum of user and kernel times */
-//     else    {
-//             struct timeval tv;
-//             gettimeofday(&tv,NULL);
-//             now = (clock_t)(
-//                     (unsigned long long)tv.tv_sec*CLK_TCK +
-//                     (unsigned long long)tv.tv_usec*(1000000/CLK_TCK)
-//                     );
-//             }
-//#endif
-//     if (stop==TM_START)     tmstart = now;
-//     else                    ret = (now - tmstart)/(double)(CLK_TCK);
-//
-//     return (ret);
-//     }
-//
-//#elif defined(_SC_CLK_TCK)   /* by means of unistd.h */
-//#include <sys/times.h>
-//
-//double app_tminterval(int stop,int usertime)
-//     {
-//     double          ret = 0;
-//     struct tms      rus;
-//     clock_t         now = times(&rus);
-//     static clock_t  tmstart;
-//
-//     if (usertime)           now = rus.tms_utime;
-//
-//     if (stop==TM_START)     tmstart = now;
-//     else
-//             {
-//             long int tck = sysconf(_SC_CLK_TCK);
-//             ret = (now - tmstart)/(double)tck;
-//             }
-//
-//     return (ret);
-//     }
-//
-//#else
-//#include <sys/time.h>
-//#include <sys/resource.h>
-//
-//double app_tminterval(int stop,int usertime)
-//     {
-//     double          ret = 0;
-//     struct rusage   rus;
-//     struct timeval  now;
-//     static struct timeval tmstart;
-//
-//     if (usertime)           getrusage(RUSAGE_SELF,&rus), now = rus.ru_utime;
-//     else                    gettimeofday(&now,NULL);
-//
-//     if (stop==TM_START)     tmstart = now;
-//     else                    ret = ( (now.tv_sec+now.tv_usec*1e-6)
-//                                     - (tmstart.tv_sec+tmstart.tv_usec*1e-6) );
-//
-//     return ret;
-//     }
-//#endif
-//asq: end
-
-
-
-/* app_isdir section */
-#ifdef _WIN32
-int app_isdir(const char *name)
-       {
-       HANDLE          hList;
-       WIN32_FIND_DATA FileData;
-#if defined(UNICODE) || defined(_UNICODE)
-       size_t i, len_0 = strlen(name)+1;
-
-       if (len_0 > sizeof(FileData.cFileName)/sizeof(FileData.cFileName[0]))
-               return -1;
-
-#if !defined(_WIN32_WCE) || _WIN32_WCE>=101
-       if (!MultiByteToWideChar(CP_ACP,0,name,len_0,FileData.cFileName,len_0))
-#endif
-               for (i=0;i<len_0;i++)
-                       FileData.cFileName[i] = (WCHAR)name[i];
-
-       hList = FindFirstFile(FileData.cFileName,&FileData);
-#else
-       hList = FindFirstFile(name,&FileData);
-#endif
-       if (hList == INVALID_HANDLE_VALUE)      return -1;
-       FindClose(hList);
-       return ((FileData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)!=0);
-       }
-#else
-#include <sys/stat.h>
-#ifndef S_ISDIR
-# if defined(_S_IFMT) && defined(_S_IFDIR)
-#  define S_ISDIR(a)   (((a) & _S_IFMT) == _S_IFDIR)
-# else 
-#  define S_ISDIR(a)   (((a) & S_IFMT) == S_IFDIR)
-# endif 
-#endif 
-
-int app_isdir(const char *name)
-       {
-#if defined(S_ISDIR)
-       struct stat st;
-
-       if (stat(name,&st)==0)  return S_ISDIR(st.st_mode);
-       else                    return -1;
-#else
-       return -1;
-#endif
-       }
-#endif
-
-/* raw_read|write section */
-#if defined(_WIN32) && defined(STD_INPUT_HANDLE)
-int raw_read_stdin(void *buf,int siz)
-       {
-       DWORD n;
-       if (ReadFile(GetStdHandle(STD_INPUT_HANDLE),buf,siz,&n,NULL))
-               return (n);
-       else    return (-1);
-       }
-#else
-int raw_read_stdin(void *buf,int siz)
-       {       return read(fileno(stdin),buf,siz);     }
-#endif
-
-#if defined(_WIN32) && defined(STD_OUTPUT_HANDLE)
-int raw_write_stdout(const void *buf,int siz)
-       {
-       DWORD n;
-       if (WriteFile(GetStdHandle(STD_OUTPUT_HANDLE),buf,siz,&n,NULL))
-               return (n);
-       else    return (-1);
-       }
-#else
-int raw_write_stdout(const void *buf,int siz)
-       {       return write(fileno(stdout),buf,siz);   }
-#endif
diff --git a/usr/skb/testapps/apps.h b/usr/skb/testapps/apps.h
deleted file mode 100644 (file)
index 67d67ad..0000000
+++ /dev/null
@@ -1,360 +0,0 @@
-/* apps/apps.h */
-/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay@cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- * 
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to.  The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attribution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- * 
- * 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 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 the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *    "This product includes cryptographic software written by
- *     Eric Young (eay@cryptsoft.com)"
- *    The word 'cryptographic' can be left out if the rouines from the library
- *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
- *    the apps directory (application code) you must include an acknowledgement:
- *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS 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 AUTHOR OR 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.
- * 
- * The licence and distribution terms for any publically available version or
- * derivative of this code cannot be changed.  i.e. this code cannot simply be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-/* ====================================================================
- * Copyright (c) 1998-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
- *    the documentation and/or other materials provided with the
- *    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.
- * ====================================================================
- *
- * This product includes cryptographic software written by Eric Young
- * (eay@cryptsoft.com).  This product includes software written by Tim
- * Hudson (tjh@cryptsoft.com).
- *
- */
-
-#ifndef HEADER_APPS_H
-#define HEADER_APPS_H
-
-#include <openssl/local/e_os.h>
-
-#include <openssl/bio.h>
-#include <openssl/x509.h>
-#include <openssl/lhash.h>
-#include <openssl/conf.h>
-#include <openssl/txt_db.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-#ifndef OPENSSL_NO_OCSP
-#include <openssl/ocsp.h>
-#endif
-#include <openssl/ossl_typ.h>
-
-int app_RAND_load_file(const char *file, BIO *bio_e, int dont_warn);
-int app_RAND_write_file(const char *file, BIO *bio_e);
-/* When `file' is NULL, use defaults.
- * `bio_e' is for error messages. */
-void app_RAND_allow_write_file(void);
-long app_RAND_load_files(char *file); /* `file' is a list of files to read,
-                                       * separated by LIST_SEPARATOR_CHAR
-                                       * (see e_os.h).  The string is
-                                       * destroyed! */
-
-#ifndef MONOLITH
-
-#define MAIN(a,v)      main(a,v)
-
-#ifndef NON_MAIN
-CONF *config=NULL;
-BIO *bio_err=NULL;
-#else
-extern CONF *config;
-extern BIO *bio_err;
-#endif
-
-#else
-
-#define MAIN(a,v)      PROG(a,v)
-extern CONF *config;
-extern char *default_config_file;
-extern BIO *bio_err;
-
-#endif
-
-#ifndef OPENSSL_SYS_NETWARE
-#include <signal.h>
-#endif
-
-#ifdef SIGPIPE
-#define do_pipe_sig()  signal(SIGPIPE,SIG_IGN)
-#else
-#define do_pipe_sig()
-#endif
-
-#ifdef OPENSSL_NO_COMP
-#define zlib_cleanup() 
-#else
-#define zlib_cleanup() COMP_zlib_cleanup()
-#endif
-
-#if defined(MONOLITH) && !defined(OPENSSL_C)
-#  define apps_startup() \
-               do_pipe_sig()
-#  define apps_shutdown()
-#else
-#  ifndef OPENSSL_NO_ENGINE
-#    define apps_startup() \
-                       do { do_pipe_sig(); CRYPTO_malloc_init(); \
-                       ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
-                       ENGINE_load_builtin_engines(); setup_ui_method(); } while(0)
-#    define apps_shutdown() \
-                       do { CONF_modules_unload(1); destroy_ui_method(); \
-                       OBJ_cleanup(); EVP_cleanup(); ENGINE_cleanup(); \
-                       CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \
-                       ERR_free_strings(); zlib_cleanup();} while(0)
-#  else
-#    define apps_startup() \
-                       do { do_pipe_sig(); CRYPTO_malloc_init(); \
-                       ERR_load_crypto_strings(); OpenSSL_add_all_algorithms(); \
-                       setup_ui_method(); } while(0)
-#    define apps_shutdown() \
-                       do { CONF_modules_unload(1); destroy_ui_method(); \
-                       OBJ_cleanup(); EVP_cleanup(); \
-                       CRYPTO_cleanup_all_ex_data(); ERR_remove_thread_state(NULL); \
-                       ERR_free_strings(); zlib_cleanup(); } while(0)
-#  endif
-#endif
-
-#ifdef OPENSSL_SYSNAME_WIN32
-#  define openssl_fdset(a,b) FD_SET((unsigned int)a, b)
-#else
-#  define openssl_fdset(a,b) FD_SET(a, b)
-#endif
-
-
-typedef struct args_st
-       {
-       char **data;
-       int count;
-       } ARGS;
-
-#define PW_MIN_LENGTH 4
-typedef struct pw_cb_data
-       {
-       const void *password;
-       const char *prompt_info;
-       } PW_CB_DATA;
-
-int password_callback(char *buf, int bufsiz, int verify,
-       PW_CB_DATA *cb_data);
-
-int setup_ui_method(void);
-void destroy_ui_method(void);
-
-int should_retry(int i);
-int args_from_file(char *file, int *argc, char **argv[]);
-int str2fmt(char *s);
-void program_name(char *in,char *out,int size);
-int chopup_args(ARGS *arg,char *buf, int *argc, char **argv[]);
-#ifdef HEADER_X509_H
-int dump_cert_text(BIO *out, X509 *x);
-void print_name(BIO *out, const char *title, X509_NAME *nm, unsigned long lflags);
-#endif
-int set_cert_ex(unsigned long *flags, const char *arg);
-int set_name_ex(unsigned long *flags, const char *arg);
-int set_ext_copy(int *copy_type, const char *arg);
-int copy_extensions(X509 *x, X509_REQ *req, int copy_type);
-int app_passwd(BIO *err, char *arg1, char *arg2, char **pass1, char **pass2);
-int add_oid_section(BIO *err, CONF *conf);
-X509 *load_cert(BIO *err, const char *file, int format,
-       const char *pass, ENGINE *e, const char *cert_descrip);
-EVP_PKEY *load_key(BIO *err, const char *file, int format, int maybe_stdin,
-       const char *pass, ENGINE *e, const char *key_descrip);
-EVP_PKEY *load_pubkey(BIO *err, const char *file, int format, int maybe_stdin,
-       const char *pass, ENGINE *e, const char *key_descrip);
-STACK_OF(X509) *load_certs(BIO *err, const char *file, int format,
-       const char *pass, ENGINE *e, const char *cert_descrip);
-STACK_OF(X509_CRL) *load_crls(BIO *err, const char *file, int format,
-       const char *pass, ENGINE *e, const char *cert_descrip);
-X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath);
-#ifndef OPENSSL_NO_ENGINE
-ENGINE *setup_engine(BIO *err, const char *engine, int debug);
-#endif
-
-#ifndef OPENSSL_NO_OCSP
-OCSP_RESPONSE *process_responder(BIO *err, OCSP_REQUEST *req,
-                       char *host, char *path, char *port, int use_ssl,
-                       STACK_OF(CONF_VALUE) *headers,
-                       int req_timeout);
-#endif
-
-int load_config(BIO *err, CONF *cnf);
-char *make_config_name(void);
-
-/* Functions defined in ca.c and also used in ocsp.c */
-int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
-                       ASN1_GENERALIZEDTIME **pinvtm, const char *str);
-
-#define DB_type         0
-#define DB_exp_date     1
-#define DB_rev_date     2
-#define DB_serial       3       /* index - unique */
-#define DB_file         4       
-#define DB_name         5       /* index - unique when active and not disabled */
-#define DB_NUMBER       6
-
-#define DB_TYPE_REV    'R'
-#define DB_TYPE_EXP    'E'
-#define DB_TYPE_VAL    'V'
-
-typedef struct db_attr_st
-       {
-       int unique_subject;
-       } DB_ATTR;
-typedef struct ca_db_st
-       {
-       DB_ATTR attributes;
-       TXT_DB *db;
-       } CA_DB;
-
-BIGNUM *load_serial(char *serialfile, int create, ASN1_INTEGER **retai);
-int save_serial(char *serialfile, char *suffix, BIGNUM *serial, ASN1_INTEGER **retai);
-int rotate_serial(char *serialfile, char *new_suffix, char *old_suffix);
-int rand_serial(BIGNUM *b, ASN1_INTEGER *ai);
-CA_DB *load_index(char *dbfile, DB_ATTR *dbattr);
-int index_index(CA_DB *db);
-int save_index(const char *dbfile, const char *suffix, CA_DB *db);
-int rotate_index(const char *dbfile, const char *new_suffix, const char *old_suffix);
-void free_index(CA_DB *db);
-#define index_name_cmp_noconst(a, b) \
-       index_name_cmp((const OPENSSL_CSTRING *)CHECKED_PTR_OF(OPENSSL_STRING, a), \
-       (const OPENSSL_CSTRING *)CHECKED_PTR_OF(OPENSSL_STRING, b))
-int index_name_cmp(const OPENSSL_CSTRING *a, const OPENSSL_CSTRING *b);
-int parse_yesno(const char *str, int def);
-
-X509_NAME *parse_name(char *str, long chtype, int multirdn);
-int args_verify(char ***pargs, int *pargc,
-                       int *badarg, BIO *err, X509_VERIFY_PARAM **pm);
-void policies_print(BIO *out, X509_STORE_CTX *ctx);
-int bio_to_mem(unsigned char **out, int maxlen, BIO *in);
-int pkey_ctrl_string(EVP_PKEY_CTX *ctx, char *value);
-int init_gen_str(BIO *err, EVP_PKEY_CTX **pctx,
-                       const char *algname, ENGINE *e, int do_param);
-#ifndef OPENSSL_NO_PSK
-extern char *psk_key;
-#endif
-#ifndef OPENSSL_NO_JPAKE
-void jpake_client_auth(BIO *out, BIO *conn, const char *secret);
-void jpake_server_auth(BIO *out, BIO *conn, const char *secret);
-#endif
-
-#define FORMAT_UNDEF    0
-#define FORMAT_ASN1     1
-#define FORMAT_TEXT     2
-#define FORMAT_PEM      3
-#define FORMAT_NETSCAPE 4
-#define FORMAT_PKCS12   5
-#define FORMAT_SMIME    6
-#define FORMAT_ENGINE   7
-#define FORMAT_IISSGC  8       /* XXX this stupid macro helps us to avoid
-                                * adding yet another param to load_*key() */
-#define FORMAT_PEMRSA  9       /* PEM RSAPubicKey format */
-#define FORMAT_ASN1RSA 10      /* DER RSAPubicKey format */
-#define FORMAT_MSBLOB  11      /* MS Key blob format */
-#define FORMAT_PVK     12      /* MS PVK file format */
-
-#define EXT_COPY_NONE  0
-#define EXT_COPY_ADD   1
-#define EXT_COPY_ALL   2
-
-#define NETSCAPE_CERT_HDR      "certificate"
-
-#define APP_PASS_LEN   1024
-
-#define SERIAL_RAND_BITS       64
-
-int app_isdir(const char *);
-int raw_read_stdin(void *,int);
-int raw_write_stdout(const void *,int);
-
-#define TM_START       0
-#define TM_STOP                1
-double app_tminterval (int stop,int usertime);
-#endif
diff --git a/usr/skb/testapps/cryptotest.c b/usr/skb/testapps/cryptotest.c
deleted file mode 100644 (file)
index 6bf51de..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/**
-  AES encryption/decryption demo program using OpenSSL EVP apis
-  gcc -Wall openssl_aes.c -lcrypto
-
-  this is public domain code.
-
-  Saju Pillai (saju.pillai@gmail.com)
-**/
-
-#include <barrelfish/barrelfish.h>
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <openssl/evp.h>
-#include <openssl/aes.h>
-
-/**
- * Create an 256 bit key and IV using the supplied key_data. salt can be added for taste.
- * Fills in the encryption and decryption ctx objects and returns 0 on success
- **/
-static int aes_init(unsigned char *key_data, int key_data_len, unsigned char *salt, EVP_CIPHER_CTX *e_ctx,
-             EVP_CIPHER_CTX *d_ctx)
-{
-  int i, nrounds = 5;
-  unsigned char key[32], iv[32];
-
-  /*
-   * Gen key & IV for AES 256 CBC mode. A SHA1 digest is used to hash the supplied key material.
-   * nrounds is the number of times the we hash the material. More rounds are more secure but
-   * slower.
-   */
-  i = EVP_BytesToKey(EVP_aes_256_cbc(), EVP_sha1(), salt, key_data, key_data_len, nrounds, key, iv);
-  if (i != 32) {
-    printf("Key size is %d bits - should be 256 bits\n", i);
-    return -1;
-  }
-
-  EVP_CIPHER_CTX_init(e_ctx);
-  EVP_EncryptInit_ex(e_ctx, EVP_aes_256_cbc(), NULL, key, iv);
-  EVP_CIPHER_CTX_init(d_ctx);
-  EVP_DecryptInit_ex(d_ctx, EVP_aes_256_cbc(), NULL, key, iv);
-
-  return 0;
-}
-
-/*
- * Encrypt *len bytes of data
- * All data going in & out is considered binary (unsigned char[])
- */
-static unsigned char *aes_encrypt(EVP_CIPHER_CTX *e, unsigned char *plaintext, int *len)
-{
-  /* max ciphertext len for a n bytes of plaintext is n + AES_BLOCK_SIZE -1 bytes */
-  int c_len = *len + AES_BLOCK_SIZE, f_len = 0;
-  unsigned char *ciphertext = malloc(c_len);
-
-  /* allows reusing of 'e' for multiple encryption cycles */
-  EVP_EncryptInit_ex(e, NULL, NULL, NULL, NULL);
-
-  /* update ciphertext, c_len is filled with the length of ciphertext generated,
-    *len is the size of plaintext in bytes */
-  EVP_EncryptUpdate(e, ciphertext, &c_len, plaintext, *len);
-
-  /* update ciphertext with the final remaining bytes */
-  EVP_EncryptFinal_ex(e, ciphertext+c_len, &f_len);
-
-  *len = c_len + f_len;
-  return ciphertext;
-}
-
-static unsigned char *aes_encrypt_in_place(EVP_CIPHER_CTX *e, unsigned char *plain, int *len, bool final)
-{
-    int f_len = 0;
-    assert((*len % AES_BLOCK_SIZE) == 0);
-    unsigned char *cipher = plain;
-    int c_len = *len;
-
-    EVP_EncryptInit_ex(e, NULL, NULL, NULL, NULL);
-    EVP_EncryptUpdate(e, cipher, len, plain, *len);
-    if (final) {
-        EVP_EncryptFinal_ex(e, cipher+c_len, &f_len);
-    }
-    *len = *len + f_len;
-    return cipher;
-}
-
-/*
- * Decrypt *len bytes of ciphertext
- */
-static unsigned char *aes_decrypt(EVP_CIPHER_CTX *e, unsigned char *ciphertext, int *len)
-{
-  /* plaintext will always be equal to or lesser than length of ciphertext*/
-  int p_len = *len, f_len = 0;
-  unsigned char *plaintext = malloc(p_len);
-
-  EVP_DecryptInit_ex(e, NULL, NULL, NULL, NULL);
-  EVP_DecryptUpdate(e, plaintext, &p_len, ciphertext, *len);
-  EVP_DecryptFinal_ex(e, plaintext+p_len, &f_len);
-
-  *len = p_len + f_len;
-  return plaintext;
-}
-
-static unsigned char *aes_decrypt_in_place(EVP_CIPHER_CTX *e, unsigned char *cipher, unsigned char *plain, int *len, bool first, bool final)
-{
-    int p_len = *len, f_len = 0;
-
-    if (first) {
-        EVP_DecryptInit_ex(e, NULL, NULL, NULL, NULL);
-    }
-    EVP_DecryptUpdate(e, plain, len, cipher, *len);
-    if (final) {
-        EVP_DecryptFinal_ex(e, plain+p_len, &f_len);
-    }
-    *len = p_len + f_len;
-    return plain;
-}
-int main(int argc, char **argv)
-{
-  /* "opaque" encryption, decryption ctx structures that libcrypto uses to record
-     status of enc/dec operations */
-  EVP_CIPHER_CTX en, de;
-
-  /* 8 bytes to salt the key_data during key generation. This is an example of
-     compiled in salt. We just read the bit pattern created by these two 4 byte
-     integers on the stack as 64 bits of contigous salt material -
-     ofcourse this only works if sizeof(int) >= 4 */
-  unsigned int salt[] = {12345, 54321};
-  unsigned char *key_data;
-  int key_data_len, i;
-  char *input[] = {"a", "abcd", "this is a test", "this is a bigger test",
-                   "\nWho are you ?\nI am the 'Doctor'.\n'Doctor' who ?\nPrecisely!",
-                   NULL};
-
-  char *asqinput;
-  asqinput = (char*)malloc(AES_BLOCK_SIZE * 2);
-  strncpy(asqinput, "das isch an Test vum asq", AES_BLOCK_SIZE * 2);
-
-  /* the key_data is read from the argument list */
-  key_data = (unsigned char *)argv[1];
-  key_data_len = strlen(argv[1]);
-
-  /* gen key and iv. init the cipher ctx object */
-  if (aes_init(key_data, key_data_len, (unsigned char *)&salt, &en, &de)) {
-    printf("Couldn't initialize AES cipher\n");
-    return -1;
-  }
-
-  /* encrypt and decrypt each input string and compare with the original */
-  for (i = 0; input[i]; i++) {
-    char *plaintext;
-    unsigned char *ciphertext;
-    int olen, len;
-
-    /* The enc/dec functions deal with binary data and not C strings. strlen() will
-       return length of the string without counting the '\0' string marker. We always
-       pass in the marker byte to the encrypt/decrypt functions so that after decryption
-       we end up with a legal C string */
-    olen = len = strlen(input[i])+1;
-
-    ciphertext = aes_encrypt(&en, (unsigned char *)input[i], &len);
-    plaintext = (char *)aes_decrypt(&de, ciphertext, &len);
-
-    if (strncmp(plaintext, input[i], olen))
-      printf("FAIL: enc/dec failed for \"%s\"\n", input[i]);
-    else
-      printf("OK: enc/dec ok for \"%s\"\n", plaintext);
-
-    free(ciphertext);
-    free(plaintext);
-  }
-
-//  int asqlen = strlen(asqinput);
-  int asqlen = AES_BLOCK_SIZE;
-  int asqlen2 = 2 * AES_BLOCK_SIZE;
-  char *tmp = NULL;
-  tmp = tmp;
-  tmp = (char*)aes_encrypt_in_place(&en, (unsigned char *)asqinput, &asqlen2, true);
-//  tmp = (char*)aes_encrypt_in_place(&en, (unsigned char *)asqinput + asqlen, &asqlen, true);
-//  printf("\nasqinput nach verschluesseln: %s\n", asqinput);
-  printf("\nbla\n");
-
-//  asqlen *= 2;
-  char *plain = (char*)malloc(asqlen2);
-  tmp = (char*)aes_decrypt_in_place(&de, (unsigned char*)asqinput + asqlen, (unsigned char*)plain + asqlen, &asqlen, false, true);
-  tmp = (char*)aes_decrypt_in_place(&de, (unsigned char*)asqinput, (unsigned char*)plain, &asqlen, true, false);
-  printf("\nasqinput nach entschluesseln: %s\n", plain);
-
-  EVP_CIPHER_CTX_cleanup(&en);
-  EVP_CIPHER_CTX_cleanup(&de);
-
-  return 0;
-}
-
diff --git a/usr/skb/testapps/map.c b/usr/skb/testapps/map.c
deleted file mode 100644 (file)
index f6aad33..0000000
+++ /dev/null
@@ -1,541 +0,0 @@
-/**
- * \file
- * \brief Computes a matrix multiplication. Tries to do that in a cache-aware way.
- */
-
-/*
- * Copyright (c) 2007, 2008, 2009, ETH Zurich.
- * All rights reserved.
- *
- * This file is distributed under the terms in the attached LICENSE file.
- * If you do not find this file, copies can be found by writing to:
- * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
- */
-
-#include <string.h>
-#include <barrelfish/barrelfish.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <skb/skb.h>
-// #include <if/monitor_defs.h>
-#include <barrelfish/dispatch.h>
-#include <if/skb_map_defs.h>
-
-
-//define that if you want to use the cache aware list allocation
-#define CACHE_AWARE
-
-//how many cores does this application support?
-#define MAXCORES 32
-
-
-static struct skb_map_client_response *mycl;
-static struct skb_map_client_response * clients[32];
-static int available_cores[MAXCORES];
-static int available_valid = 0;
-
-//prototypes
-static void spawnmyself(bool bsp);
-static void map_init_server(void);
-static void map_init_client(uint64_t core_id);
-
-
-
-#ifdef CACHE_AWARE
-static int l1_line_size;
-
-static void get_l1_line_size(void)
-{
-    //because the information might not yet be added to the SKB...
-    for (int i = 0; i < 3; i++) {
-        skb_execute("cache(_,_,1,data,_,_,LineSize,_),write(output,LineSize).");
-        while (skb_read_error_code() == SKB_PROCESSING) messages_wait_and_handle_next();
-        if (skb_read_error_code() == 0) {
-            break;
-        }
-        thread_yield();
-    }
-    if (skb_read_error_code() == 0) {
-        l1_line_size = atoi(skb_get_output());
-    } else {
-        printf("\nerror code = %d\n", skb_read_error_code());
-        printf("\nerror output = %s\n", skb_get_error_output());
-        l1_line_size = 64;
-        printf("\nassuming %d bytes\n", l1_line_size);
-    }
-    printf("\ncache line size is %d bytes.\n", l1_line_size);
-}
-
-//************************* memory management **********************************
-struct memmmgt {
-    struct capref frame;
-    void *va;
-    uint64_t bitmap[];
-};
-
-static struct capref mmgtframe;
-static void *mmgtva;
-static uint64_t nrbitmapfields;
-static uint64_t structsize;
-static uint64_t nrstructs;
-
-//1 bit corresponds to a memory block of 1 L1 cache line
-static int init_mem(void)
-{
-    int r;
-
-    r = frame_alloc(&mmgtframe, BASE_PAGE_SIZE, NULL);
-    if (r != 0) {
-        return (r);
-    }
-    mmgtva = vspace_map(mmgtframe, 0, BASE_PAGE_SIZE, NULL, NULL);
-    if (mmgtva == 0) {
-        return (-1);
-    }
-    nrbitmapfields = (BASE_PAGE_SIZE / l1_line_size) / 64;
-    structsize = nrbitmapfields + sizeof(struct memmmgt);
-    int adjust = structsize % l1_line_size;
-    if (adjust != 0) {
-        structsize += (l1_line_size - adjust);
-    }
-    nrstructs = BASE_PAGE_SIZE / structsize;
-    memset(mmgtva, 0, BASE_PAGE_SIZE);
-    printf("\nstructsize = %lu, #structs = %lu\n", structsize, nrstructs);
-    return 0;
-}
-
-static void *alloc_mem(int size)
-{
-    int r;
-
-    int nr_blocks = size / l1_line_size + ((size % l1_line_size) != 0);
-    int mask = (1 << nr_blocks) - 1;
-
-    for (int i = 0; i < nrstructs; i++) {
-        struct memmmgt *tmp = (struct memmmgt*)(i * structsize + mmgtva);
-        if (tmp->va == 0) {
-            r = frame_alloc(&(tmp->frame), BASE_PAGE_SIZE, NULL);
-            if (r != 0) {
-                return (0);
-            }
-            tmp->va = vspace_map(tmp->frame, 0, BASE_PAGE_SIZE, NULL, NULL);
-            if (tmp->va == 0) {
-                return (0);
-            }
-        }
-        for (int j = 0; j < nrbitmapfields; j++) {
-            for (int k = 0; k < (64 - nr_blocks); k++) {
-                if ((tmp->bitmap[j] & (mask << k)) == 0) {
-                    tmp->bitmap[j] |= (mask << k);
-                    return (tmp->va + ((j * 64) + k) * l1_line_size);
-                }
-            }
-        }
-    }
-    return (0);
-}
-
-static uint64_t get_offset_from_page(void *va)
-{
-    for (int i = 0; i < nrstructs; i++) {
-        struct memmmgt *tmp = (struct memmmgt*)(i * structsize + mmgtva);
-        if ((va >= tmp->va) && (va <= tmp->va)) {
-            return (va - tmp->va);
-        }
-    }
-//page not found... (shouldn't happen...
-//does not matter, then the allocation strategy will not be optimal,
-//but will still work
-    return (0); 
-}
-
-static int *alloc_list(int size)
-{
-    int eff_size = sizeof(int) * (size + 1);
-    int adjust = eff_size % l1_line_size;
-    if (adjust != 0) {
-        eff_size += (l1_line_size - adjust);
-    }
-    assert((eff_size % l1_line_size) == 0);
-    int *tmp = (int*)alloc_mem(eff_size);
-    printf("\ntmp = %p\n", tmp);
-    assert(tmp != 0);
-    assert(((vaddr_t)tmp % l1_line_size) == 0);
-    tmp[0] = size;
-    return (tmp);
-}
-
-static void free_list(int *list)
-{
-    printf("\nXXX: free_list does nothing.\n");
-}
-#else
-static int *alloc_list(int size)
-{
-    int *tmp = (int*)malloc(size * sizeof(int));
-    assert(tmp != 0);
-    tmp[0] = size;
-    return (tmp);
-}
-static void free_list(int *list)
-{
-    free(list);
-}
-#endif
-
-//*********************************************
-
-//**************** thread allocation plan **************************************
-int nr_threads;
-struct threadalloc {
-    uint8_t core_id;
-    vaddr_t start, end;
-};
-
-struct threadalloc ta[MAXCORES];
-
-//**************** parsing the thread results from the SKB *********************
-static void threadplan(paddr_t startaddress, paddr_t endaddress)
-{
-    printf("\nmap: requesting threadplan...\n");
-    uint64_t nr_threads, start, end;
-    uint32_t core_id;
-    char query[128];
-
-    if (available_valid == 0) {
-        return;
-    }
-    char threadlist[128];
-    sprintf(threadlist, "%d", available_cores[0]);
-    for (int i = 1; i < available_valid; i++) {
-        sprintf(threadlist,"%s,%d", threadlist, available_cores[i]);
-    }
-    printf("\nthreadlist = %s\n", threadlist);
-    sprintf(query, "allocthread([%s], %lu, %lu, L), length(L,Len),"
-            "write(ouput,Len), write(output,L).",
-            threadlist, startaddress, endaddress);
-    skb_execute(query);
-    while (skb_read_error_code() == SKB_PROCESSING) messages_wait_and_handle_next();
-    printf("\nerror code = %d\n", skb_read_error_code());
-    printf("\noutput = %s\n", skb_get_output());
-    printf("\nerror output = %s\n", skb_get_error_output());
-
-    char *output = skb_get_output();
-//    sscanf(output,"%lu",&nr_threads);
-    nr_threads = atoi(output);
-    printf("\nshould allocate %lu threads.\n", nr_threads);
-    for (int i = 0; i < nr_threads; i++) {
-        while (!((output[0] >= '0') && (output[0] <= '9'))) output++;
-//        sscanf(output, "range(%u, %lu, %lu)", &core_id, &start, &end);
-        core_id = atoi(output);
-        while (!((output[0] >= '0') && (output[0] <= '9'))) output++;
-        start = atoi(output);
-        while (!((output[0] >= '0') && (output[0] <= '9'))) output++;
-        end = atoi(output);
-        printf("thread on core %u, range [%lu, %lu]\n", core_id, start, end);
-        output++;
-    }
-}
-
-
-//*********************************************
-
-static void map(int(*f)(int),int *list, int **newlist)
-{
-    int *tmp = alloc_list(list[0]);
-    *newlist = tmp;
-    for (int i = 0; i < list[0]; i++) {
-        tmp[i + 1] = f(list[i + 1]);
-    }
-}
-
-static void print_list(int *list)
-{
-    printf("[");
-    for (int i = 0; i < list[0]; i++) {
-        printf("%d,", list[i + 1]);
-    }
-    printf("]\n");
-}
-
-
-
-//********************************* user functions *****************************
-static int sqr_list(int in)
-{
-    return (in * in);
-}
-
-typedef int(*f)(int);
-static f functions[] = {sqr_list};
-
-static uint64_t core_id;
-
-int main(int argc, char **argv)
-{
-    printf("map: connecting to the SKB...\n");
-    skb_client_connect();
-    printf("map: connected.\n");
-
-    skb_create_buffer();
-
-    core_id = disp_get_core_id();
-    printf("\nmap: running one core %lu\n", core_id);
-    printf("\nmap %lu: argc = %d\n", core_id, argc);
-
-
-//get the L1 cache line size and initialize the memory management accordingly
-#ifdef CACHE_AWARE
-    get_l1_line_size();
-    init_mem();
-#endif
-    if (argc == 1) { //this is the bootstrap copy of the domain
-        map_init_server();
-        spawnmyself(true);
-    } else {
-        printf("\nmap %lu: waiting for requests from the main domain\n", core_id);
-        map_init_client(core_id);
-        mycl->f->initialized(mycl, core_id);
-        messages_handler_loop();
-    }
-
-    ////wait a bit for the cloned domains to come up...
-    //messages_wait_and_handle_next();
-    messages_handler_loop();
-
-    threadplan(0, 64);
-
-//allocate a list at cache line boundaries. Fill it with values and apply
-//a square function on every element using map. Print the newly allocated result
-//list.
-    int *list1 = alloc_list(17);
-    for (int i = 0; i < 17; i++) {
-        list1[1 + i] = i;
-    }
-    print_list(list1);
-    int *list2;
-    uint64_t offset = get_offset_from_page(list1);
-    offset = offset;
-    map(functions[0], list1, &list2);
-    print_list(list2);
-
-    free_list(list1);
-    free_list(list2);
-
-    messages_handler_loop();
-    return 0;
-}
-
-
-
-
-
-
-
-
-//*********** everything needed to spawn myself to all other cores *************
-
-/* Generic buffer set */
-static void set_generic_buf_reply(struct monitor_client_response *st, errval_t msgerr)
-{
-    assert(err_is_ok(msgerr));
-    errval_t err;
-    printf("\nmap %lu: set_generic_buf_reply\n", core_id);
-    /* Spawn self on all cores except the current */
-    err = st->call_vtbl->spawn_domain_request
-        (st, "map", "map spawned", 0, 2);
-    assert(err_is_ok(err));
-}
-
-/* All clients spawned */
-static void spawn_domain_reply(struct monitor_client_response *st, errval_t err){}
-
-static void spawnmyself(bool bsp)
-{
-    errval_t err;
-
-    printf("\nmap %lu: bsp = %d\n", core_id, bsp);
-    /* Set handlers */
-    get_monitor_closure()->f->spawn_domain_reply = spawn_domain_reply;
-    get_monitor_closure()->f->set_generic_buf_reply = set_generic_buf_reply;
-    if (bsp) { /* bsp */
-        /* Set generic buffer channel with the monitor
-           and spawn bcast on additional cores */
-        err = monitor_client_set_generic_buf();
-        assert(err_is_ok(err));
-    }
-}
-
-
-
-//***************** handlers ****************************************************
-
-static void skb_map_share_page_c(struct skb_map_client_response *cc,
-                               struct capref cap, uint64_t pagenumber)
-{
-
-}
-static void skb_map_share_page_s(struct skb_map_service_response *cc,
-                               struct capref cap, uint64_t pagenumber)
-{
-
-}
-
-static void skb_map_mapfunction_c(struct skb_map_client_response *cc, uint64_t functionnr,
-                                uint64_t startaddress, uint64_t endaddress)
-{
-}
-static void skb_map_mapfunction_s(struct skb_map_service_response *cc, uint64_t functionnr,
-                                uint64_t startaddress, uint64_t endaddress)
-{
-}
-
-static void skb_map_finished_c(struct skb_map_client_response *cc, uint64_t core_id)
-{}
-static void skb_map_finished_s(struct skb_map_service_response *cc, uint64_t core_id)
-{}
-
-static void skb_map_initialized_c(struct skb_map_client_response *cc, uint64_t coreid)
-{
-    printf("\nmap: got connection from %lu\n", coreid);
-    clients[coreid] = cc;
-    available_cores[available_valid++] = coreid;
-}
-
-static void skb_map_initialized_s(struct skb_map_service_response *cc, uint64_t coreid)
-{
-/*
-    printf("\nmap: got connection from %lu\n", coreid);
-    clients[coreid] = cc;
-    available_cores[available_valid++] = coreid;
-*/
-}
-
-
-
-
-
-//***** everything needed to connect as client to the server domain *******
-bool skb_map_connected = false;
-static void client_disconnect_handler(struct skb_map_client_response *st)
-{
-}
-
-
-static void client_connection_service_logic(struct skb_map_client_response *st)
-{
-    skb_map_connected = true;
-    mycl = st;
-}
-
-static void start_client(struct chips_context *context, uint64_t core_id)
-{
-    iref_t iref;
-
-    errval_t e = chips_blocking_lookup(context, "skb_map", &iref);
-    if (err_is_fail(e)) {
-        fprintf(stderr, "map %lu: could not connect to the main map domain.\n"
-                "Terminating.\n", core_id);
-        abort();
-    }
-
-    assert(iref != 0);
-
-
-    static struct skb_map_client_response_vtbl crv = {
-        .sharepage = skb_map_share_page_c,
-        .mapfunction = skb_map_mapfunction_c,
-        .mapfinished = skb_map_finished_c,
-        .initialized = skb_map_initialized_c,
-        ._disconnect = client_disconnect_handler,
-        ._connected = client_connection_service_logic
-    };
-
-    static struct skb_map_client_response cr = {
-        .f = &crv
-    };
-
-    skb_map_connect(iref, &cr, 0);
-}
-
-static void map_init_client(uint64_t core_id)
-{
-    struct chips_context *context = chips_get_context();
-    context->init();
-    start_client(context, core_id);
-    while (!skb_map_connected) {
-        messages_wait_and_handle_next();
-    }
-}
-
-
-
-//***** everything needed to create the server part on all other domains *******
-//connection prototypes
-static void listen_cb(struct skb_map_service *st, iref_t iref);
-static void skb_map_disconnect_handler(struct skb_map_service_response *cl);
-static errval_t connection_service_logic(struct skb_map_service_response *cl);
-
-
-struct client_closure {
-};
-
-struct listen_closure {
-} lc;
-
-struct skb_map_server_call_vtbl skb_map_call_vtbl =
-    {
-        .sharepage = skb_map_share_page_s,
-        .mapfunction = skb_map_mapfunction_s,
-        .mapfinished = skb_map_finished_s,
-        .initialized = skb_map_initialized_s,
-        ._listening = listen_cb,
-        ._disconnect = skb_map_disconnect_handler,
-        ._connected = connection_service_logic,
-    };
-struct skb_map_service skb_map_service = 
-    {
-        .f = &skb_map_call_vtbl,
-        .st = &lc
-    };
-
-static errval_t connection_service_logic(struct skb_map_service_response *cl)
-{
-    struct client_closure *cc = (struct client_closure*)
-        malloc(sizeof(struct client_closure));
-
-    cl->st = cc;
-
-    return 0;
-}
-
-static void skb_map_disconnect_handler(struct skb_map_service_response *cl)
-{
-/*
-    struct client_closure *cc = 
-        (struct client_closure *) cl->st;
-
-    free(cc);
-    cc = 0;
-    free(closure);
-    closure = 0;
-*/
-}
-
-//called when listen suceeds
-static void listen_cb(struct skb_map_service *st, iref_t iref)
-{
-    assert(iref != 0); //if iref == 0, listen failed.
-    struct chips_context *context = chips_get_context();
-    context->register_service("skb_map", iref, NULL, NULL);
-}
-
-static void map_init_server(void)
-{
-    int r;
-
-    struct chips_context *context = chips_get_context();
-    context->init();
-    r = skb_map_listen(&skb_map_service);
-    assert(r == 0);
-}
diff --git a/usr/skb/testapps/matrix.c b/usr/skb/testapps/matrix.c
deleted file mode 100644 (file)
index 47e8905..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * \file
- * \brief Computes a matrix multiplication. Tries to do that in a cache-aware way.
- */
-
-/*
- * Copyright (c) 2007, 2008, 2009, ETH Zurich.
- * All rights reserved.
- *
- * This file is distributed under the terms in the attached LICENSE file.
- * If you do not find this file, copies can be found by writing to:
- * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
- */
-
-#include <barrelfish/barrelfish.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <skb/skb.h>
-
-
-int A[5][5] = {{1,2,3,4},
-             {5,6,7,8},
-             {9,10,11,12},
-             {13,14,15,16}};
-
-int B[7][9] = {{1,2,3,4},
-             {1,2,3,4},
-             {1,2,3,4},
-             {1,2,3,4}};
-
-int C[4][4];
-
-int A2[5][2] = {{1,2}, //matrix size 4x2
-                {3,4},
-                {5,6},
-                {7,8}};
-int B2[3][4] = {{1,2,3,4}, //matrix size 2x4
-                {1,2,3,4}};
-int C2[9][9]; //the matrix size will be 4x4
-
-
-
-int A3[16 * 512][4];
-int B3[4][16 * 512];
-int C3[16 * 512][16 * 512];
-
-
-int A4[16 * 512][4];
-int B4[4][16 * 512 + 16];
-int C4[16 * 512][16 * 512];
-
-
-//r = #rows in A, c = #columns in A (the real rows and columns)
-//ar, ac && br, bc && cr, cc are the sizes of the respective arrays
-static inline void matrix_mul(int r, int c,
-                              int ar, int ac,
-                              int A[ar][ac],
-                              int br, int bc,
-                              int B[br][bc],
-                              int cr, int cc,
-                              int C[cr][cc])
-{
-    for (int i = 0; i < r; i++) {
-        for (int j = 0; j < r; j++) {
-            register int tmp = 0;
-            for (int k = 0; k < c; k++) {
-                tmp = tmp + A[i][k] * B[k][j];
-            }
-            C[i][j] = tmp;
-        }
-    }
-}
-
-static inline void matrix_print(int r, int c, int mr, int mc, int M[mr][mc])
-{
-    for (int i = 0; i < r; i++) {
-        printf("\n");
-        for (int j = 0; j < c; j++) {
-            printf("%02d ", M[i][j]);
-        }
-    }
-}
-
-
-
-int main(int argc, char **argv)
-{
-    printf("matrix mul: connecting to the SKB...\n");
-    skb_client_connect();
-    printf("matrix mul: connected.\n");
-
-    skb_create_buffer();
-
-    matrix_print(4, 4, 5, 5, A);
-    matrix_print(4, 4, 7, 9, B);
-    uint64_t start = rdtsc(); //rdtscp();
-    matrix_mul(4, 4, 5, 5 , A, 7, 9, B, 4, 4, C);
-    uint64_t end = rdtsc(); //rdtscp();
-    matrix_print(4, 4, 4, 4, C);
-    printf("\n%lu cycles for multiplying one matrix\n", end - start);
-
-
-    matrix_print(4, 2, 5, 2, A2);
-    matrix_print(2, 4, 3, 4, B2);
-    start = rdtsc(); //rdtscp();
-    matrix_mul(4, 2, 5, 2 , A2, 3, 4, B2, 9, 9, C2);
-    end = rdtsc(); //rdtscp();
-    matrix_print(4, 4, 9, 9, C2);
-    printf("\n%lu cycles for multiplying one matrix\n", end - start);
-
-
-    start = rdtsc(); //rdtscp();
-    matrix_mul(16 * 512, 4, 16 * 512, 4 , A3, 4, 16 * 512, B3, 16 * 512, 16 * 512, C3);
-    end = rdtsc(); //rdtscp();
-    printf("\n%lu cycles for multiplying one matrix\n", end - start);
-
-
-    start = rdtsc(); //rdtscp();
-    matrix_mul(16 * 512, 4, 16 * 512, 4 , A4, 4, 16 * 512 + 16, B4,
-               16 * 512, 16 * 512, C4);
-    end = rdtsc(); //rdtscp();
-    printf("\n%lu cycles for multiplying one matrix\n", end - start);
-
-
-    return 0;
-}
diff --git a/usr/skb/testapps/speed.c b/usr/skb/testapps/speed.c
deleted file mode 100644 (file)
index 42c7112..0000000
+++ /dev/null
@@ -1,2801 +0,0 @@
-/* apps/speed.c -*- mode:C; c-file-style: "eay" -*- */
-/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay@cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- * 
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to.  The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attribution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- * 
- * 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 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 the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *    "This product includes cryptographic software written by
- *     Eric Young (eay@cryptsoft.com)"
- *    The word 'cryptographic' can be left out if the rouines from the library
- *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
- *    the apps directory (application code) you must include an acknowledgement:
- *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS 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 AUTHOR OR 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.
- * 
- * The licence and distribution terms for any publically available version or
- * derivative of this code cannot be changed.  i.e. this code cannot simply be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-/* ====================================================================
- * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
- *
- * Portions of the attached software ("Contribution") are developed by 
- * SUN MICROSYSTEMS, INC., and are contributed to the OpenSSL project.
- *
- * The Contribution is licensed pursuant to the OpenSSL open source
- * license provided above.
- *
- * The ECDH and ECDSA speed test software is originally written by 
- * Sumit Gupta of Sun Microsystems Laboratories.
- *
- */
-
-/* most of this code has been pilfered from my libdes speed.c program */
-
-#ifndef OPENSSL_NO_SPEED
-
-#undef SECONDS
-#define SECONDS                3       
-#define RSA_SECONDS    10
-#define DSA_SECONDS    10
-#define ECDSA_SECONDS   10
-#define ECDH_SECONDS    10
-
-/* 11-Sep-92 Andrew Daviel   Support for Silicon Graphics IRIX added */
-/* 06-Apr-92 Luke Brennan    Support for VMS and add extra signal calls */
-
-#undef PROG
-#define PROG speed_main
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <string.h>
-#include <math.h>
-#include "apps.h"
-#ifdef OPENSSL_NO_STDIO
-#define APPS_WIN16
-#endif
-#include <openssl/crypto.h>
-#include <openssl/rand.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include <openssl/objects.h>
-#if !defined(OPENSSL_SYS_MSDOS)
-#include OPENSSL_UNISTD
-#endif
-
-#ifndef OPENSSL_SYS_NETWARE
-#include <signal.h>
-#endif
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-#include <openssl/bn.h>
-#ifndef OPENSSL_NO_DES
-#include <openssl/des.h>
-#endif
-#ifndef OPENSSL_NO_AES
-#include <openssl/aes.h>
-#endif
-#ifndef OPENSSL_NO_CAMELLIA
-#include <openssl/camellia.h>
-#endif
-#ifndef OPENSSL_NO_MD2
-#include <openssl/md2.h>
-#endif
-#ifndef OPENSSL_NO_MDC2
-#include <openssl/mdc2.h>
-#endif
-#ifndef OPENSSL_NO_MD4
-#include <openssl/md4.h>
-#endif
-#ifndef OPENSSL_NO_MD5
-#include <openssl/md5.h>
-#endif
-#ifndef OPENSSL_NO_HMAC
-#include <openssl/hmac.h>
-#endif
-#include <openssl/evp.h>
-#ifndef OPENSSL_NO_SHA
-#include <openssl/sha.h>
-#endif
-#ifndef OPENSSL_NO_RIPEMD
-#include <openssl/ripemd.h>
-#endif
-#ifndef OPENSSL_NO_WHIRLPOOL
-#include <openssl/whrlpool.h>
-#endif
-#ifndef OPENSSL_NO_RC4
-#include <openssl/rc4.h>
-#endif
-#ifndef OPENSSL_NO_RC5
-#include <openssl/rc5.h>
-#endif
-#ifndef OPENSSL_NO_RC2
-#include <openssl/rc2.h>
-#endif
-#ifndef OPENSSL_NO_IDEA
-#include <openssl/idea.h>
-#endif
-#ifndef OPENSSL_NO_SEED
-#include <openssl/seed.h>
-#endif
-#ifndef OPENSSL_NO_BF
-#include <openssl/blowfish.h>
-#endif
-#ifndef OPENSSL_NO_CAST
-#include <openssl/cast.h>
-#endif
-#ifndef OPENSSL_NO_RSA
-#include <openssl/rsa.h>
-#include "./testrsa.h"
-#endif
-#include <openssl/x509.h>
-#ifndef OPENSSL_NO_DSA
-#include <openssl/dsa.h>
-#include "./testdsa.h"
-#endif
-#ifndef OPENSSL_NO_ECDSA
-#include <openssl/ecdsa.h>
-#endif
-#ifndef OPENSSL_NO_ECDH
-#include <openssl/ecdh.h>
-#endif
-
-//asq:
-#undef HAVE_FORK
-
-#ifndef HAVE_FORK
-# if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_NETWARE)
-#  define HAVE_FORK 0
-# else
-#  define HAVE_FORK 1
-# endif
-#endif
-
-//asq:
-#undef HAVE_FORK
-
-#if HAVE_FORK
-#undef NO_FORK
-#else
-#define NO_FORK
-#endif
-
-#undef BUFSIZE
-#define BUFSIZE        ((long)1024*8+1)
-int run=0;
-
-static int mr=0;
-static int usertime=1;
-
-static double Time_F(int s);
-static void print_message(const char *s,long num,int length);
-static void pkey_print_message(const char *str, const char *str2,
-       long num, int bits, int sec);
-static void print_result(int alg,int run_no,int count,double time_used);
-#ifndef NO_FORK
-static int do_multi(int multi);
-#endif
-
-#define ALGOR_NUM      29
-#define SIZE_NUM       5
-#define RSA_NUM                4
-#define DSA_NUM                3
-
-#define EC_NUM       16
-#define MAX_ECDH_SIZE 256
-
-static const char *names[ALGOR_NUM]={
-  "md2","mdc2","md4","md5","hmac(md5)","sha1","rmd160","rc4",
-  "des cbc","des ede3","idea cbc","seed cbc",
-  "rc2 cbc","rc5-32/12 cbc","blowfish cbc","cast cbc",
-  "aes-128 cbc","aes-192 cbc","aes-256 cbc",
-  "camellia-128 cbc","camellia-192 cbc","camellia-256 cbc",
-  "evp","sha256","sha512","whirlpool",
-  "aes-128 ige","aes-192 ige","aes-256 ige"};
-static double results[ALGOR_NUM][SIZE_NUM];
-static int lengths[SIZE_NUM]={16,64,256,1024,8*1024};
-#ifndef OPENSSL_NO_RSA
-static double rsa_results[RSA_NUM][2];
-#endif
-#ifndef OPENSSL_NO_DSA
-static double dsa_results[DSA_NUM][2];
-#endif
-#ifndef OPENSSL_NO_ECDSA
-static double ecdsa_results[EC_NUM][2];
-#endif
-#ifndef OPENSSL_NO_ECDH
-static double ecdh_results[EC_NUM][1];
-#endif
-
-#if defined(OPENSSL_NO_DSA) && !(defined(OPENSSL_NO_ECDSA) && defined(OPENSSL_NO_ECDH))
-static const char rnd_seed[] = "string to make the random number generator think it has entropy";
-static int rnd_fake = 0;
-#endif
-
-#ifdef SIGALRM
-#if defined(__STDC__) || defined(sgi) || defined(_AIX)
-#define SIGRETTYPE void
-#else
-#define SIGRETTYPE int
-#endif 
-
-static SIGRETTYPE sig_done(int sig);
-static SIGRETTYPE sig_done(int sig)
-       {
-       signal(SIGALRM,sig_done);
-       run=0;
-#ifdef LINT
-       sig=sig;
-#endif
-       }
-#endif
-
-#define START  0
-#define STOP   1
-
-#if defined(_WIN32)
-
-#define SIGALRM
-static unsigned int lapse,schlock;
-static void alarm(unsigned int secs) { lapse = secs*1000; }
-
-static DWORD WINAPI sleepy(VOID *arg)
-       {
-       schlock = 1;
-       Sleep(lapse);
-       run = 0;
-       return 0;
-       }
-
-static double Time_F(int s)
-       {
-       if (s == START)
-               {
-               HANDLE  thr;
-               schlock = 0;
-               thr = CreateThread(NULL,4096,sleepy,NULL,0,NULL);
-               if (thr==NULL)
-                       {
-                       DWORD ret=GetLastError();
-                       BIO_printf(bio_err,"unable to CreateThread (%d)",ret);
-                       ExitProcess(ret);
-                       }
-               CloseHandle(thr);               /* detach the thread    */
-               while (!schlock) Sleep(0);      /* scheduler spinlock   */
-               }
-
-       return app_tminterval(s,usertime);
-       }
-#else
-
-static double Time_F(int s)
-       {
-       return app_tminterval(s,usertime);
-       }
-#endif
-
-
-#ifndef OPENSSL_NO_ECDH
-static const int KDF1_SHA1_len = 20;
-static void *KDF1_SHA1(const void *in, size_t inlen, void *out, size_t *outlen)
-       {
-#ifndef OPENSSL_NO_SHA
-       if (*outlen < SHA_DIGEST_LENGTH)
-               return NULL;
-       else
-               *outlen = SHA_DIGEST_LENGTH;
-       return SHA1(in, inlen, out);
-#else
-       return NULL;
-#endif /* OPENSSL_NO_SHA */
-       }
-#endif /* OPENSSL_NO_ECDH */
-
-
-
-//asq:
-#include <barrelfish/barrelfish.h>
-
-uint64_t tscperms = 0;
-
-int MAIN(int, char **);
-
-int MAIN(int argc, char **argv)
-       {
-    printf("\n\nspeed main starting up.\n\n");
-
-    errval_t err = sys_debug_get_tsc_per_ms(&tscperms);
-    assert(err_is_ok(err));
-    printf("TSC per ms: %lu\n", tscperms);
-
-    unsigned char *buf=NULL,*buf2=NULL;
-       int mret=1;
-       long count=0,save_count=0;
-       int i,j,k;
-#if !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_DSA)
-       long rsa_count;
-#endif
-#ifndef OPENSSL_NO_RSA
-       unsigned rsa_num;
-#endif
-       unsigned char md[EVP_MAX_MD_SIZE];
-#ifndef OPENSSL_NO_MD2
-       unsigned char md2[MD2_DIGEST_LENGTH];
-#endif
-#ifndef OPENSSL_NO_MDC2
-       unsigned char mdc2[MDC2_DIGEST_LENGTH];
-#endif
-#ifndef OPENSSL_NO_MD4
-       unsigned char md4[MD4_DIGEST_LENGTH];
-#endif
-#ifndef OPENSSL_NO_MD5
-       unsigned char md5[MD5_DIGEST_LENGTH];
-       unsigned char hmac[MD5_DIGEST_LENGTH];
-#endif
-#ifndef OPENSSL_NO_SHA
-       unsigned char sha[SHA_DIGEST_LENGTH];
-#ifndef OPENSSL_NO_SHA256
-       unsigned char sha256[SHA256_DIGEST_LENGTH];
-#endif
-#ifndef OPENSSL_NO_SHA512
-       unsigned char sha512[SHA512_DIGEST_LENGTH];
-#endif
-#endif
-#ifndef OPENSSL_NO_WHIRLPOOL
-       unsigned char whirlpool[WHIRLPOOL_DIGEST_LENGTH];
-#endif
-#ifndef OPENSSL_NO_RIPEMD
-       unsigned char rmd160[RIPEMD160_DIGEST_LENGTH];
-#endif
-#ifndef OPENSSL_NO_RC4
-       RC4_KEY rc4_ks;
-#endif
-#ifndef OPENSSL_NO_RC5
-       RC5_32_KEY rc5_ks;
-#endif
-#ifndef OPENSSL_NO_RC2
-       RC2_KEY rc2_ks;
-#endif
-#ifndef OPENSSL_NO_IDEA
-       IDEA_KEY_SCHEDULE idea_ks;
-#endif
-#ifndef OPENSSL_NO_SEED
-       SEED_KEY_SCHEDULE seed_ks;
-#endif
-#ifndef OPENSSL_NO_BF
-       BF_KEY bf_ks;
-#endif
-#ifndef OPENSSL_NO_CAST
-       CAST_KEY cast_ks;
-#endif
-       static const unsigned char key16[16]=
-               {0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
-                0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12};
-#ifndef OPENSSL_NO_AES
-       static const unsigned char key24[24]=
-               {0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
-                0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,
-                0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34};
-       static const unsigned char key32[32]=
-               {0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
-                0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,
-                0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34,
-                0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34,0x56};
-#endif
-#ifndef OPENSSL_NO_CAMELLIA
-       static const unsigned char ckey24[24]=
-               {0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
-                0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,
-                0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34};
-       static const unsigned char ckey32[32]=
-               {0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
-                0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,
-                0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34,
-                0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34,0x56};
-#endif
-#ifndef OPENSSL_NO_AES
-#define MAX_BLOCK_SIZE 128
-#else
-#define MAX_BLOCK_SIZE 64
-#endif
-       unsigned char DES_iv[8];
-       unsigned char iv[2*MAX_BLOCK_SIZE/8];
-#ifndef OPENSSL_NO_DES
-       static DES_cblock key ={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0};
-       static DES_cblock key2={0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12};
-       static DES_cblock key3={0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12,0x34};
-       DES_key_schedule sch;
-       DES_key_schedule sch2;
-       DES_key_schedule sch3;
-#endif
-#ifndef OPENSSL_NO_AES
-       AES_KEY aes_ks1, aes_ks2, aes_ks3;
-#endif
-#ifndef OPENSSL_NO_CAMELLIA
-       CAMELLIA_KEY camellia_ks1, camellia_ks2, camellia_ks3;
-#endif
-#define        D_MD2           0
-#define        D_MDC2          1
-#define        D_MD4           2
-#define        D_MD5           3
-#define        D_HMAC          4
-#define        D_SHA1          5
-#define D_RMD160       6
-#define        D_RC4           7
-#define        D_CBC_DES       8
-#define        D_EDE3_DES      9
-#define        D_CBC_IDEA      10
-#define        D_CBC_SEED      11
-#define        D_CBC_RC2       12
-#define        D_CBC_RC5       13
-#define        D_CBC_BF        14
-#define        D_CBC_CAST      15
-#define D_CBC_128_AES  16
-#define D_CBC_192_AES  17
-#define D_CBC_256_AES  18
-#define D_CBC_128_CML   19 
-#define D_CBC_192_CML   20
-#define D_CBC_256_CML   21 
-#define D_EVP          22
-#define D_SHA256       23      
-#define D_SHA512       24
-#define D_WHIRLPOOL    25
-#define D_IGE_128_AES   26
-#define D_IGE_192_AES   27
-#define D_IGE_256_AES   28
-       double d=0.0;
-       long c[ALGOR_NUM][SIZE_NUM];
-#define        R_DSA_512       0
-#define        R_DSA_1024      1
-#define        R_DSA_2048      2
-#define        R_RSA_512       0
-#define        R_RSA_1024      1
-#define        R_RSA_2048      2
-#define        R_RSA_4096      3
-
-#define R_EC_P160    0
-#define R_EC_P192    1 
-#define R_EC_P224    2
-#define R_EC_P256    3
-#define R_EC_P384    4
-#define R_EC_P521    5
-#define R_EC_K163    6
-#define R_EC_K233    7
-#define R_EC_K283    8
-#define R_EC_K409    9
-#define R_EC_K571    10
-#define R_EC_B163    11
-#define R_EC_B233    12
-#define R_EC_B283    13
-#define R_EC_B409    14
-#define R_EC_B571    15
-
-#ifndef OPENSSL_NO_RSA
-       RSA *rsa_key[RSA_NUM];
-       long rsa_c[RSA_NUM][2];
-       static unsigned int rsa_bits[RSA_NUM]={512,1024,2048,4096};
-       static unsigned char *rsa_data[RSA_NUM]=
-               {test512,test1024,test2048,test4096};
-       static int rsa_data_length[RSA_NUM]={
-               sizeof(test512),sizeof(test1024),
-               sizeof(test2048),sizeof(test4096)};
-#endif
-#ifndef OPENSSL_NO_DSA
-       DSA *dsa_key[DSA_NUM];
-       long dsa_c[DSA_NUM][2];
-       static unsigned int dsa_bits[DSA_NUM]={512,1024,2048};
-#endif
-#ifndef OPENSSL_NO_EC
-       /* We only test over the following curves as they are representative, 
-        * To add tests over more curves, simply add the curve NID
-        * and curve name to the following arrays and increase the 
-        * EC_NUM value accordingly. 
-        */
-       static unsigned int test_curves[EC_NUM] = 
-       {       
-       /* Prime Curves */
-       NID_secp160r1,
-       NID_X9_62_prime192v1,
-       NID_secp224r1,
-       NID_X9_62_prime256v1,
-       NID_secp384r1,
-       NID_secp521r1,
-       /* Binary Curves */
-       NID_sect163k1,
-       NID_sect233k1,
-       NID_sect283k1,
-       NID_sect409k1,
-       NID_sect571k1,
-       NID_sect163r2,
-       NID_sect233r1,
-       NID_sect283r1,
-       NID_sect409r1,
-       NID_sect571r1
-       }; 
-       static const char * test_curves_names[EC_NUM] = 
-       {
-       /* Prime Curves */
-       "secp160r1",
-       "nistp192",
-       "nistp224",
-       "nistp256",
-       "nistp384",
-       "nistp521",
-       /* Binary Curves */
-       "nistk163",
-       "nistk233",
-       "nistk283",
-       "nistk409",
-       "nistk571",
-       "nistb163",
-       "nistb233",
-       "nistb283",
-       "nistb409",
-       "nistb571"
-       };
-       static int test_curves_bits[EC_NUM] =
-        {
-        160, 192, 224, 256, 384, 521,
-        163, 233, 283, 409, 571,
-        163, 233, 283, 409, 571
-        };
-
-#endif
-
-#ifndef OPENSSL_NO_ECDSA
-       unsigned char ecdsasig[256];
-       unsigned int ecdsasiglen;
-       EC_KEY *ecdsa[EC_NUM];
-       long ecdsa_c[EC_NUM][2];
-#endif
-
-#ifndef OPENSSL_NO_ECDH
-       EC_KEY *ecdh_a[EC_NUM], *ecdh_b[EC_NUM];
-       unsigned char secret_a[MAX_ECDH_SIZE], secret_b[MAX_ECDH_SIZE];
-       int secret_size_a, secret_size_b;
-       int ecdh_checks = 0;
-       int secret_idx = 0;
-       long ecdh_c[EC_NUM][2];
-#endif
-
-       int rsa_doit[RSA_NUM];
-       int dsa_doit[DSA_NUM];
-#ifndef OPENSSL_NO_ECDSA
-       int ecdsa_doit[EC_NUM];
-#endif
-#ifndef OPENSSL_NO_ECDH
-        int ecdh_doit[EC_NUM];
-#endif
-       int doit[ALGOR_NUM];
-       int pr_header=0;
-       const EVP_CIPHER *evp_cipher=NULL;
-       const EVP_MD *evp_md=NULL;
-       int decrypt=0;
-#ifndef NO_FORK
-       int multi=0;
-#endif
-
-#ifndef TIMES
-       usertime=-1;
-#endif
-
-       apps_startup();
-       memset(results, 0, sizeof(results));
-#ifndef OPENSSL_NO_DSA
-       memset(dsa_key,0,sizeof(dsa_key));
-#endif
-#ifndef OPENSSL_NO_ECDSA
-       for (i=0; i<EC_NUM; i++) ecdsa[i] = NULL;
-#endif
-#ifndef OPENSSL_NO_ECDH
-       for (i=0; i<EC_NUM; i++)
-               {
-               ecdh_a[i] = NULL;
-               ecdh_b[i] = NULL;
-               }
-#endif
-
-
-       if (bio_err == NULL)
-               if ((bio_err=BIO_new(BIO_s_file())) != NULL)
-                       BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
-
-       if (!load_config(bio_err, NULL))
-               goto end;
-
-#ifndef OPENSSL_NO_RSA
-       memset(rsa_key,0,sizeof(rsa_key));
-       for (i=0; i<RSA_NUM; i++)
-               rsa_key[i]=NULL;
-#endif
-
-       if ((buf=(unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL)
-               {
-               BIO_printf(bio_err,"out of memory\n");
-               goto end;
-               }
-       if ((buf2=(unsigned char *)OPENSSL_malloc((int)BUFSIZE)) == NULL)
-               {
-               BIO_printf(bio_err,"out of memory\n");
-               goto end;
-               }
-
-       memset(c,0,sizeof(c));
-       memset(DES_iv,0,sizeof(DES_iv));
-       memset(iv,0,sizeof(iv));
-
-       for (i=0; i<ALGOR_NUM; i++)
-               doit[i]=0;
-       for (i=0; i<RSA_NUM; i++)
-               rsa_doit[i]=0;
-       for (i=0; i<DSA_NUM; i++)
-               dsa_doit[i]=0;
-#ifndef OPENSSL_NO_ECDSA
-       for (i=0; i<EC_NUM; i++)
-               ecdsa_doit[i]=0;
-#endif
-#ifndef OPENSSL_NO_ECDH
-       for (i=0; i<EC_NUM; i++)
-               ecdh_doit[i]=0;
-#endif
-
-       
-       j=0;
-       argc--;
-       argv++;
-       while (argc)
-               {
-               if      ((argc > 0) && (strcmp(*argv,"-elapsed") == 0))
-                       {
-                       usertime = 0;
-                       j--;    /* Otherwise, -elapsed gets confused with
-                                  an algorithm. */
-                       }
-               else if ((argc > 0) && (strcmp(*argv,"-evp") == 0))
-                       {
-                       argc--;
-                       argv++;
-                       if(argc == 0)
-                               {
-                               BIO_printf(bio_err,"no EVP given\n");
-                               goto end;
-                               }
-                       evp_cipher=EVP_get_cipherbyname(*argv);
-                       if(!evp_cipher)
-                               {
-                               evp_md=EVP_get_digestbyname(*argv);
-                               }
-                       if(!evp_cipher && !evp_md)
-                               {
-                               BIO_printf(bio_err,"%s is an unknown cipher or digest\n",*argv);
-                               goto end;
-                               }
-                       doit[D_EVP]=1;
-                       }
-               else if (argc > 0 && !strcmp(*argv,"-decrypt"))
-                       {
-                       decrypt=1;
-                       j--;    /* Otherwise, -elapsed gets confused with
-                                  an algorithm. */
-                       }
-#ifndef OPENSSL_NO_ENGINE
-               else if ((argc > 0) && (strcmp(*argv,"-engine") == 0))
-                       {
-                       argc--;
-                       argv++;
-                       if(argc == 0)
-                               {
-                               BIO_printf(bio_err,"no engine given\n");
-                               goto end;
-                               }
-                        setup_engine(bio_err, *argv, 0);
-                       /* j will be increased again further down.  We just
-                          don't want speed to confuse an engine with an
-                          algorithm, especially when none is given (which
-                          means all of them should be run) */
-                       j--;
-                       }
-#endif
-#ifndef NO_FORK
-               else if ((argc > 0) && (strcmp(*argv,"-multi") == 0))
-                       {
-                       argc--;
-                       argv++;
-                       if(argc == 0)
-                               {
-                               BIO_printf(bio_err,"no multi count given\n");
-                               goto end;
-                               }
-                       multi=atoi(argv[0]);
-                       if(multi <= 0)
-                           {
-                               BIO_printf(bio_err,"bad multi count\n");
-                               goto end;
-                               }                               
-                       j--;    /* Otherwise, -mr gets confused with
-                                  an algorithm. */
-                       }
-#endif
-               else if (argc > 0 && !strcmp(*argv,"-mr"))
-                       {
-                       mr=1;
-                       j--;    /* Otherwise, -mr gets confused with
-                                  an algorithm. */
-                       }
-               else
-#ifndef OPENSSL_NO_MD2
-               if      (strcmp(*argv,"md2") == 0) doit[D_MD2]=1;
-               else
-#endif
-#ifndef OPENSSL_NO_MDC2
-                       if (strcmp(*argv,"mdc2") == 0) doit[D_MDC2]=1;
-               else
-#endif
-#ifndef OPENSSL_NO_MD4
-                       if (strcmp(*argv,"md4") == 0) doit[D_MD4]=1;
-               else
-#endif
-#ifndef OPENSSL_NO_MD5
-                       if (strcmp(*argv,"md5") == 0) doit[D_MD5]=1;
-               else
-#endif
-#ifndef OPENSSL_NO_MD5
-                       if (strcmp(*argv,"hmac") == 0) doit[D_HMAC]=1;
-               else
-#endif
-#ifndef OPENSSL_NO_SHA
-                       if (strcmp(*argv,"sha1") == 0) doit[D_SHA1]=1;
-               else
-                       if (strcmp(*argv,"sha") == 0)   doit[D_SHA1]=1,
-                                                       doit[D_SHA256]=1,
-                                                       doit[D_SHA512]=1;
-               else
-#ifndef OPENSSL_NO_SHA256
-                       if (strcmp(*argv,"sha256") == 0) doit[D_SHA256]=1;
-               else
-#endif
-#ifndef OPENSSL_NO_SHA512
-                       if (strcmp(*argv,"sha512") == 0) doit[D_SHA512]=1;
-               else
-#endif
-#endif
-#ifndef OPENSSL_NO_WHIRLPOOL
-                       if (strcmp(*argv,"whirlpool") == 0) doit[D_WHIRLPOOL]=1;
-               else
-#endif
-#ifndef OPENSSL_NO_RIPEMD
-                       if (strcmp(*argv,"ripemd") == 0) doit[D_RMD160]=1;
-               else
-                       if (strcmp(*argv,"rmd160") == 0) doit[D_RMD160]=1;
-               else
-                       if (strcmp(*argv,"ripemd160") == 0) doit[D_RMD160]=1;
-               else
-#endif
-#ifndef OPENSSL_NO_RC4
-                       if (strcmp(*argv,"rc4") == 0) doit[D_RC4]=1;
-               else 
-#endif
-#ifndef OPENSSL_NO_DES
-                       if (strcmp(*argv,"des-cbc") == 0) doit[D_CBC_DES]=1;
-               else    if (strcmp(*argv,"des-ede3") == 0) doit[D_EDE3_DES]=1;
-               else
-#endif
-#ifndef OPENSSL_NO_AES
-                       if (strcmp(*argv,"aes-128-cbc") == 0) doit[D_CBC_128_AES]=1;
-               else    if (strcmp(*argv,"aes-192-cbc") == 0) doit[D_CBC_192_AES]=1;
-               else    if (strcmp(*argv,"aes-256-cbc") == 0) doit[D_CBC_256_AES]=1;
-               else    if (strcmp(*argv,"aes-128-ige") == 0) doit[D_IGE_128_AES]=1;
-               else    if (strcmp(*argv,"aes-192-ige") == 0) doit[D_IGE_192_AES]=1;
-               else    if (strcmp(*argv,"aes-256-ige") == 0) doit[D_IGE_256_AES]=1;
-                else
-#endif
-#ifndef OPENSSL_NO_CAMELLIA
-                       if (strcmp(*argv,"camellia-128-cbc") == 0) doit[D_CBC_128_CML]=1;
-               else    if (strcmp(*argv,"camellia-192-cbc") == 0) doit[D_CBC_192_CML]=1;
-               else    if (strcmp(*argv,"camellia-256-cbc") == 0) doit[D_CBC_256_CML]=1;
-               else
-#endif
-#ifndef OPENSSL_NO_RSA
-#if 0 /* was: #ifdef RSAref */
-                       if (strcmp(*argv,"rsaref") == 0) 
-                       {
-                       RSA_set_default_openssl_method(RSA_PKCS1_RSAref());
-                       j--;
-                       }
-               else
-#endif
-#ifndef RSA_NULL
-                       if (strcmp(*argv,"openssl") == 0) 
-                       {
-                       RSA_set_default_method(RSA_PKCS1_SSLeay());
-                       j--;
-                       }
-               else
-#endif
-#endif /* !OPENSSL_NO_RSA */
-                    if (strcmp(*argv,"dsa512") == 0) dsa_doit[R_DSA_512]=2;
-               else if (strcmp(*argv,"dsa1024") == 0) dsa_doit[R_DSA_1024]=2;
-               else if (strcmp(*argv,"dsa2048") == 0) dsa_doit[R_DSA_2048]=2;
-               else if (strcmp(*argv,"rsa512") == 0) rsa_doit[R_RSA_512]=2;
-               else if (strcmp(*argv,"rsa1024") == 0) rsa_doit[R_RSA_1024]=2;
-               else if (strcmp(*argv,"rsa2048") == 0) rsa_doit[R_RSA_2048]=2;
-               else if (strcmp(*argv,"rsa4096") == 0) rsa_doit[R_RSA_4096]=2;
-               else
-#ifndef OPENSSL_NO_RC2
-                    if (strcmp(*argv,"rc2-cbc") == 0) doit[D_CBC_RC2]=1;
-               else if (strcmp(*argv,"rc2") == 0) doit[D_CBC_RC2]=1;
-               else
-#endif
-#ifndef OPENSSL_NO_RC5
-                    if (strcmp(*argv,"rc5-cbc") == 0) doit[D_CBC_RC5]=1;
-               else if (strcmp(*argv,"rc5") == 0) doit[D_CBC_RC5]=1;
-               else
-#endif
-#ifndef OPENSSL_NO_IDEA
-                    if (strcmp(*argv,"idea-cbc") == 0) doit[D_CBC_IDEA]=1;
-               else if (strcmp(*argv,"idea") == 0) doit[D_CBC_IDEA]=1;
-               else
-#endif
-#ifndef OPENSSL_NO_SEED
-                    if (strcmp(*argv,"seed-cbc") == 0) doit[D_CBC_SEED]=1;
-               else if (strcmp(*argv,"seed") == 0) doit[D_CBC_SEED]=1;
-               else
-#endif
-#ifndef OPENSSL_NO_BF
-                    if (strcmp(*argv,"bf-cbc") == 0) doit[D_CBC_BF]=1;
-               else if (strcmp(*argv,"blowfish") == 0) doit[D_CBC_BF]=1;
-               else if (strcmp(*argv,"bf") == 0) doit[D_CBC_BF]=1;
-               else
-#endif
-#ifndef OPENSSL_NO_CAST
-                    if (strcmp(*argv,"cast-cbc") == 0) doit[D_CBC_CAST]=1;
-               else if (strcmp(*argv,"cast") == 0) doit[D_CBC_CAST]=1;
-               else if (strcmp(*argv,"cast5") == 0) doit[D_CBC_CAST]=1;
-               else
-#endif
-#ifndef OPENSSL_NO_DES
-                       if (strcmp(*argv,"des") == 0)
-                       {
-                       doit[D_CBC_DES]=1;
-                       doit[D_EDE3_DES]=1;
-                       }
-               else
-#endif
-#ifndef OPENSSL_NO_AES
-                       if (strcmp(*argv,"aes") == 0)
-                       {
-                       doit[D_CBC_128_AES]=1;
-                       doit[D_CBC_192_AES]=1;
-                       doit[D_CBC_256_AES]=1;
-                       }
-               else
-#endif
-#ifndef OPENSSL_NO_CAMELLIA
-                       if (strcmp(*argv,"camellia") == 0)
-                       {
-                       doit[D_CBC_128_CML]=1;
-                       doit[D_CBC_192_CML]=1;
-                       doit[D_CBC_256_CML]=1;
-                       }
-               else
-#endif
-#ifndef OPENSSL_NO_RSA
-                       if (strcmp(*argv,"rsa") == 0)
-                       {
-                       rsa_doit[R_RSA_512]=1;
-                       rsa_doit[R_RSA_1024]=1;
-                       rsa_doit[R_RSA_2048]=1;
-                       rsa_doit[R_RSA_4096]=1;
-                       }
-               else
-#endif
-#ifndef OPENSSL_NO_DSA
-                       if (strcmp(*argv,"dsa") == 0)
-                       {
-                       dsa_doit[R_DSA_512]=1;
-                       dsa_doit[R_DSA_1024]=1;
-                       dsa_doit[R_DSA_2048]=1;
-                       }
-               else
-#endif
-#ifndef OPENSSL_NO_ECDSA
-                    if (strcmp(*argv,"ecdsap160") == 0) ecdsa_doit[R_EC_P160]=2;
-               else if (strcmp(*argv,"ecdsap192") == 0) ecdsa_doit[R_EC_P192]=2;
-               else if (strcmp(*argv,"ecdsap224") == 0) ecdsa_doit[R_EC_P224]=2;
-               else if (strcmp(*argv,"ecdsap256") == 0) ecdsa_doit[R_EC_P256]=2;
-               else if (strcmp(*argv,"ecdsap384") == 0) ecdsa_doit[R_EC_P384]=2;
-               else if (strcmp(*argv,"ecdsap521") == 0) ecdsa_doit[R_EC_P521]=2;
-               else if (strcmp(*argv,"ecdsak163") == 0) ecdsa_doit[R_EC_K163]=2;
-               else if (strcmp(*argv,"ecdsak233") == 0) ecdsa_doit[R_EC_K233]=2;
-               else if (strcmp(*argv,"ecdsak283") == 0) ecdsa_doit[R_EC_K283]=2;
-               else if (strcmp(*argv,"ecdsak409") == 0) ecdsa_doit[R_EC_K409]=2;
-               else if (strcmp(*argv,"ecdsak571") == 0) ecdsa_doit[R_EC_K571]=2;
-               else if (strcmp(*argv,"ecdsab163") == 0) ecdsa_doit[R_EC_B163]=2;
-               else if (strcmp(*argv,"ecdsab233") == 0) ecdsa_doit[R_EC_B233]=2;
-               else if (strcmp(*argv,"ecdsab283") == 0) ecdsa_doit[R_EC_B283]=2;
-               else if (strcmp(*argv,"ecdsab409") == 0) ecdsa_doit[R_EC_B409]=2;
-               else if (strcmp(*argv,"ecdsab571") == 0) ecdsa_doit[R_EC_B571]=2;
-               else if (strcmp(*argv,"ecdsa") == 0)
-                       {
-                       for (i=0; i < EC_NUM; i++)
-                               ecdsa_doit[i]=1;
-                       }
-               else
-#endif
-#ifndef OPENSSL_NO_ECDH
-                    if (strcmp(*argv,"ecdhp160") == 0) ecdh_doit[R_EC_P160]=2;
-               else if (strcmp(*argv,"ecdhp192") == 0) ecdh_doit[R_EC_P192]=2;
-               else if (strcmp(*argv,"ecdhp224") == 0) ecdh_doit[R_EC_P224]=2;
-               else if (strcmp(*argv,"ecdhp256") == 0) ecdh_doit[R_EC_P256]=2;
-               else if (strcmp(*argv,"ecdhp384") == 0) ecdh_doit[R_EC_P384]=2;
-               else if (strcmp(*argv,"ecdhp521") == 0) ecdh_doit[R_EC_P521]=2;
-               else if (strcmp(*argv,"ecdhk163") == 0) ecdh_doit[R_EC_K163]=2;
-               else if (strcmp(*argv,"ecdhk233") == 0) ecdh_doit[R_EC_K233]=2;
-               else if (strcmp(*argv,"ecdhk283") == 0) ecdh_doit[R_EC_K283]=2;
-               else if (strcmp(*argv,"ecdhk409") == 0) ecdh_doit[R_EC_K409]=2;
-               else if (strcmp(*argv,"ecdhk571") == 0) ecdh_doit[R_EC_K571]=2;
-               else if (strcmp(*argv,"ecdhb163") == 0) ecdh_doit[R_EC_B163]=2;
-               else if (strcmp(*argv,"ecdhb233") == 0) ecdh_doit[R_EC_B233]=2;
-               else if (strcmp(*argv,"ecdhb283") == 0) ecdh_doit[R_EC_B283]=2;
-               else if (strcmp(*argv,"ecdhb409") == 0) ecdh_doit[R_EC_B409]=2;
-               else if (strcmp(*argv,"ecdhb571") == 0) ecdh_doit[R_EC_B571]=2;
-               else if (strcmp(*argv,"ecdh") == 0)
-                       {
-                       for (i=0; i < EC_NUM; i++)
-                               ecdh_doit[i]=1;
-                       }
-               else
-#endif
-                       {
-                       BIO_printf(bio_err,"Error: bad option or value\n");
-                       BIO_printf(bio_err,"\n");
-                       BIO_printf(bio_err,"Available values:\n");
-#ifndef OPENSSL_NO_MD2
-                       BIO_printf(bio_err,"md2      ");
-#endif
-#ifndef OPENSSL_NO_MDC2
-                       BIO_printf(bio_err,"mdc2     ");
-#endif
-#ifndef OPENSSL_NO_MD4
-                       BIO_printf(bio_err,"md4      ");
-#endif
-#ifndef OPENSSL_NO_MD5
-                       BIO_printf(bio_err,"md5      ");
-#ifndef OPENSSL_NO_HMAC
-                       BIO_printf(bio_err,"hmac     ");
-#endif
-#endif
-#ifndef OPENSSL_NO_SHA1
-                       BIO_printf(bio_err,"sha1     ");
-#endif
-#ifndef OPENSSL_NO_SHA256
-                       BIO_printf(bio_err,"sha256   ");
-#endif
-#ifndef OPENSSL_NO_SHA512
-                       BIO_printf(bio_err,"sha512   ");
-#endif
-#ifndef OPENSSL_NO_WHIRLPOOL
-                       BIO_printf(bio_err,"whirlpool");
-#endif
-#ifndef OPENSSL_NO_RIPEMD160
-                       BIO_printf(bio_err,"rmd160");
-#endif
-#if !defined(OPENSSL_NO_MD2) || !defined(OPENSSL_NO_MDC2) || \
-    !defined(OPENSSL_NO_MD4) || !defined(OPENSSL_NO_MD5) || \
-    !defined(OPENSSL_NO_SHA1) || !defined(OPENSSL_NO_RIPEMD160) || \
-    !defined(OPENSSL_NO_WHIRLPOOL)
-                       BIO_printf(bio_err,"\n");
-#endif
-
-#ifndef OPENSSL_NO_IDEA
-                       BIO_printf(bio_err,"idea-cbc ");
-#endif
-#ifndef OPENSSL_NO_SEED
-                       BIO_printf(bio_err,"seed-cbc ");
-#endif
-#ifndef OPENSSL_NO_RC2
-                       BIO_printf(bio_err,"rc2-cbc  ");
-#endif
-#ifndef OPENSSL_NO_RC5
-                       BIO_printf(bio_err,"rc5-cbc  ");
-#endif
-#ifndef OPENSSL_NO_BF
-                       BIO_printf(bio_err,"bf-cbc");
-#endif
-#if !defined(OPENSSL_NO_IDEA) || !defined(OPENSSL_NO_SEED) || !defined(OPENSSL_NO_RC2) || \
-    !defined(OPENSSL_NO_BF) || !defined(OPENSSL_NO_RC5)
-                       BIO_printf(bio_err,"\n");
-#endif
-#ifndef OPENSSL_NO_DES
-                       BIO_printf(bio_err,"des-cbc  des-ede3 ");
-#endif
-#ifndef OPENSSL_NO_AES
-                       BIO_printf(bio_err,"aes-128-cbc aes-192-cbc aes-256-cbc ");
-                       BIO_printf(bio_err,"aes-128-ige aes-192-ige aes-256-ige ");
-#endif
-#ifndef OPENSSL_NO_CAMELLIA
-                       BIO_printf(bio_err,"\n");
-                       BIO_printf(bio_err,"camellia-128-cbc camellia-192-cbc camellia-256-cbc ");
-#endif
-#ifndef OPENSSL_NO_RC4
-                       BIO_printf(bio_err,"rc4");
-#endif
-                       BIO_printf(bio_err,"\n");
-
-#ifndef OPENSSL_NO_RSA
-                       BIO_printf(bio_err,"rsa512   rsa1024  rsa2048  rsa4096\n");
-#endif
-
-#ifndef OPENSSL_NO_DSA
-                       BIO_printf(bio_err,"dsa512   dsa1024  dsa2048\n");
-#endif
-#ifndef OPENSSL_NO_ECDSA
-                       BIO_printf(bio_err,"ecdsap160 ecdsap192 ecdsap224 ecdsap256 ecdsap384 ecdsap521\n");
-                       BIO_printf(bio_err,"ecdsak163 ecdsak233 ecdsak283 ecdsak409 ecdsak571\n");
-                       BIO_printf(bio_err,"ecdsab163 ecdsab233 ecdsab283 ecdsab409 ecdsab571\n");
-                       BIO_printf(bio_err,"ecdsa\n");
-#endif
-#ifndef OPENSSL_NO_ECDH
-                       BIO_printf(bio_err,"ecdhp160  ecdhp192  ecdhp224  ecdhp256  ecdhp384  ecdhp521\n");
-                       BIO_printf(bio_err,"ecdhk163  ecdhk233  ecdhk283  ecdhk409  ecdhk571\n");
-                       BIO_printf(bio_err,"ecdhb163  ecdhb233  ecdhb283  ecdhb409  ecdhb571\n");
-                       BIO_printf(bio_err,"ecdh\n");
-#endif
-
-#ifndef OPENSSL_NO_IDEA
-                       BIO_printf(bio_err,"idea     ");
-#endif
-#ifndef OPENSSL_NO_SEED
-                       BIO_printf(bio_err,"seed     ");
-#endif
-#ifndef OPENSSL_NO_RC2
-                       BIO_printf(bio_err,"rc2      ");
-#endif
-#ifndef OPENSSL_NO_DES
-                       BIO_printf(bio_err,"des      ");
-#endif
-#ifndef OPENSSL_NO_AES
-                       BIO_printf(bio_err,"aes      ");
-#endif
-#ifndef OPENSSL_NO_CAMELLIA
-                       BIO_printf(bio_err,"camellia ");
-#endif
-#ifndef OPENSSL_NO_RSA
-                       BIO_printf(bio_err,"rsa      ");
-#endif
-#ifndef OPENSSL_NO_BF
-                       BIO_printf(bio_err,"blowfish");
-#endif
-#if !defined(OPENSSL_NO_IDEA) || !defined(OPENSSL_NO_SEED) || \
-    !defined(OPENSSL_NO_RC2) || !defined(OPENSSL_NO_DES) || \
-    !defined(OPENSSL_NO_RSA) || !defined(OPENSSL_NO_BF) || \
-    !defined(OPENSSL_NO_AES) || !defined(OPENSSL_NO_CAMELLIA)
-                       BIO_printf(bio_err,"\n");
-#endif
-
-                       BIO_printf(bio_err,"\n");
-                       BIO_printf(bio_err,"Available options:\n");
-#if defined(TIMES) || defined(USE_TOD)
-                       BIO_printf(bio_err,"-elapsed        measure time in real time instead of CPU user time.\n");
-#endif
-#ifndef OPENSSL_NO_ENGINE
-                       BIO_printf(bio_err,"-engine e       use engine e, possibly a hardware device.\n");
-#endif
-                       BIO_printf(bio_err,"-evp e          use EVP e.\n");
-                       BIO_printf(bio_err,"-decrypt        time decryption instead of encryption (only EVP).\n");
-                       BIO_printf(bio_err,"-mr             produce machine readable output.\n");
-#ifndef NO_FORK
-                       BIO_printf(bio_err,"-multi n        run n benchmarks in parallel.\n");
-#endif
-                       goto end;
-                       }
-               argc--;
-               argv++;
-               j++;
-               }
-
-#ifndef NO_FORK
-       if(multi && do_multi(multi))
-               goto show_res;
-#endif
-
-       if (j == 0)
-               {
-               for (i=0; i<ALGOR_NUM; i++)
-                       {
-                       if (i != D_EVP)
-                               doit[i]=1;
-                       }
-               for (i=0; i<RSA_NUM; i++)
-                       rsa_doit[i]=1;
-               for (i=0; i<DSA_NUM; i++)
-                       dsa_doit[i]=1;
-#ifndef OPENSSL_NO_ECDSA
-               for (i=0; i<EC_NUM; i++)
-                       ecdsa_doit[i]=1;
-#endif
-#ifndef OPENSSL_NO_ECDH
-               for (i=0; i<EC_NUM; i++)
-                       ecdh_doit[i]=1;
-#endif
-               }
-       for (i=0; i<ALGOR_NUM; i++)
-               if (doit[i]) pr_header++;
-
-       if (usertime == 0 && !mr)
-               BIO_printf(bio_err,"You have chosen to measure elapsed time instead of user CPU time.\n");
-
-#ifndef OPENSSL_NO_RSA
-       for (i=0; i<RSA_NUM; i++)
-               {
-               const unsigned char *p;
-
-               p=rsa_data[i];
-               rsa_key[i]=d2i_RSAPrivateKey(NULL,&p,rsa_data_length[i]);
-               if (rsa_key[i] == NULL)
-                       {
-                       BIO_printf(bio_err,"internal error loading RSA key number %d\n",i);
-                       goto end;
-                       }
-#if 0
-               else
-                       {
-                       BIO_printf(bio_err,mr ? "+RK:%d:"
-                                  : "Loaded RSA key, %d bit modulus and e= 0x",
-                                  BN_num_bits(rsa_key[i]->n));
-                       BN_print(bio_err,rsa_key[i]->e);
-                       BIO_printf(bio_err,"\n");
-                       }
-#endif
-               }
-#endif
-
-#ifndef OPENSSL_NO_DSA
-       dsa_key[0]=get_dsa512();
-       dsa_key[1]=get_dsa1024();
-       dsa_key[2]=get_dsa2048();
-#endif
-
-#ifndef OPENSSL_NO_DES
-       DES_set_key_unchecked(&key,&sch);
-       DES_set_key_unchecked(&key2,&sch2);
-       DES_set_key_unchecked(&key3,&sch3);
-#endif
-#ifndef OPENSSL_NO_AES
-       AES_set_encrypt_key(key16,128,&aes_ks1);
-       AES_set_encrypt_key(key24,192,&aes_ks2);
-       AES_set_encrypt_key(key32,256,&aes_ks3);
-#endif
-#ifndef OPENSSL_NO_CAMELLIA
-       Camellia_set_key(key16,128,&camellia_ks1);
-       Camellia_set_key(ckey24,192,&camellia_ks2);
-       Camellia_set_key(ckey32,256,&camellia_ks3);
-#endif
-#ifndef OPENSSL_NO_IDEA
-       idea_set_encrypt_key(key16,&idea_ks);
-#endif
-#ifndef OPENSSL_NO_SEED
-       SEED_set_key(key16,&seed_ks);
-#endif
-#ifndef OPENSSL_NO_RC4
-       RC4_set_key(&rc4_ks,16,key16);
-#endif
-#ifndef OPENSSL_NO_RC2
-       RC2_set_key(&rc2_ks,16,key16,128);
-#endif
-#ifndef OPENSSL_NO_RC5
-       RC5_32_set_key(&rc5_ks,16,key16,12);
-#endif
-#ifndef OPENSSL_NO_BF
-       BF_set_key(&bf_ks,16,key16);
-#endif
-#ifndef OPENSSL_NO_CAST
-       CAST_set_key(&cast_ks,16,key16);
-#endif
-#ifndef OPENSSL_NO_RSA
-       memset(rsa_c,0,sizeof(rsa_c));
-#endif
-#ifndef SIGALRM
-#ifndef OPENSSL_NO_DES
-       BIO_printf(bio_err,"First we calculate the approximate speed ...\n");
-       count=10;
-       do      {
-               long it;
-               count*=2;
-               Time_F(START);
-               for (it=count; it; it--)
-                       DES_ecb_encrypt((DES_cblock *)buf,
-                               (DES_cblock *)buf,
-                               &sch,DES_ENCRYPT);
-               d=Time_F(STOP);
-               } while (d <3);
-       save_count=count;
-       c[D_MD2][0]=count/10;
-       c[D_MDC2][0]=count/10;
-       c[D_MD4][0]=count;
-       c[D_MD5][0]=count;
-       c[D_HMAC][0]=count;
-       c[D_SHA1][0]=count;
-       c[D_RMD160][0]=count;
-       c[D_RC4][0]=count*5;
-       c[D_CBC_DES][0]=count;
-       c[D_EDE3_DES][0]=count/3;
-       c[D_CBC_IDEA][0]=count;
-       c[D_CBC_SEED][0]=count;
-       c[D_CBC_RC2][0]=count;
-       c[D_CBC_RC5][0]=count;
-       c[D_CBC_BF][0]=count;
-       c[D_CBC_CAST][0]=count;
-       c[D_CBC_128_AES][0]=count;
-       c[D_CBC_192_AES][0]=count;
-       c[D_CBC_256_AES][0]=count;
-       c[D_CBC_128_CML][0]=count;
-       c[D_CBC_192_CML][0]=count;
-       c[D_CBC_256_CML][0]=count;
-       c[D_SHA256][0]=count;
-       c[D_SHA512][0]=count;
-       c[D_WHIRLPOOL][0]=count;
-       c[D_IGE_128_AES][0]=count;
-       c[D_IGE_192_AES][0]=count;
-       c[D_IGE_256_AES][0]=count;
-
-       for (i=1; i<SIZE_NUM; i++)
-               {
-               c[D_MD2][i]=c[D_MD2][0]*4*lengths[0]/lengths[i];
-               c[D_MDC2][i]=c[D_MDC2][0]*4*lengths[0]/lengths[i];
-               c[D_MD4][i]=c[D_MD4][0]*4*lengths[0]/lengths[i];
-               c[D_MD5][i]=c[D_MD5][0]*4*lengths[0]/lengths[i];
-               c[D_HMAC][i]=c[D_HMAC][0]*4*lengths[0]/lengths[i];
-               c[D_SHA1][i]=c[D_SHA1][0]*4*lengths[0]/lengths[i];
-               c[D_RMD160][i]=c[D_RMD160][0]*4*lengths[0]/lengths[i];
-               c[D_SHA256][i]=c[D_SHA256][0]*4*lengths[0]/lengths[i];
-               c[D_SHA512][i]=c[D_SHA512][0]*4*lengths[0]/lengths[i];
-               c[D_WHIRLPOOL][i]=c[D_WHIRLPOOL][0]*4*lengths[0]/lengths[i];
-               }
-       for (i=1; i<SIZE_NUM; i++)
-               {
-               long l0,l1;
-
-               l0=(long)lengths[i-1];
-               l1=(long)lengths[i];
-               c[D_RC4][i]=c[D_RC4][i-1]*l0/l1;
-               c[D_CBC_DES][i]=c[D_CBC_DES][i-1]*l0/l1;
-               c[D_EDE3_DES][i]=c[D_EDE3_DES][i-1]*l0/l1;
-               c[D_CBC_IDEA][i]=c[D_CBC_IDEA][i-1]*l0/l1;
-               c[D_CBC_SEED][i]=c[D_CBC_SEED][i-1]*l0/l1;
-               c[D_CBC_RC2][i]=c[D_CBC_RC2][i-1]*l0/l1;
-               c[D_CBC_RC5][i]=c[D_CBC_RC5][i-1]*l0/l1;
-               c[D_CBC_BF][i]=c[D_CBC_BF][i-1]*l0/l1;
-               c[D_CBC_CAST][i]=c[D_CBC_CAST][i-1]*l0/l1;
-               c[D_CBC_128_AES][i]=c[D_CBC_128_AES][i-1]*l0/l1;
-               c[D_CBC_192_AES][i]=c[D_CBC_192_AES][i-1]*l0/l1;
-               c[D_CBC_256_AES][i]=c[D_CBC_256_AES][i-1]*l0/l1;
-               c[D_CBC_128_CML][i]=c[D_CBC_128_CML][i-1]*l0/l1;
-               c[D_CBC_192_CML][i]=c[D_CBC_192_CML][i-1]*l0/l1;
-               c[D_CBC_256_CML][i]=c[D_CBC_256_CML][i-1]*l0/l1;
-               c[D_IGE_128_AES][i]=c[D_IGE_128_AES][i-1]*l0/l1;
-               c[D_IGE_192_AES][i]=c[D_IGE_192_AES][i-1]*l0/l1;
-               c[D_IGE_256_AES][i]=c[D_IGE_256_AES][i-1]*l0/l1;
-               }
-#ifndef OPENSSL_NO_RSA
-       rsa_c[R_RSA_512][0]=count/2000;
-       rsa_c[R_RSA_512][1]=count/400;
-       for (i=1; i<RSA_NUM; i++)
-               {
-               rsa_c[i][0]=rsa_c[i-1][0]/8;
-               rsa_c[i][1]=rsa_c[i-1][1]/4;
-               if ((rsa_doit[i] <= 1) && (rsa_c[i][0] == 0))
-                       rsa_doit[i]=0;
-               else
-                       {
-                       if (rsa_c[i][0] == 0)
-                               {
-                               rsa_c[i][0]=1;
-                               rsa_c[i][1]=20;
-                               }
-                       }                               
-               }
-#endif
-
-#ifndef OPENSSL_NO_DSA
-       dsa_c[R_DSA_512][0]=count/1000;
-       dsa_c[R_DSA_512][1]=count/1000/2;
-       for (i=1; i<DSA_NUM; i++)
-               {
-               dsa_c[i][0]=dsa_c[i-1][0]/4;
-               dsa_c[i][1]=dsa_c[i-1][1]/4;
-               if ((dsa_doit[i] <= 1) && (dsa_c[i][0] == 0))
-                       dsa_doit[i]=0;
-               else
-                       {
-                       if (dsa_c[i] == 0)
-                               {
-                               dsa_c[i][0]=1;
-                               dsa_c[i][1]=1;
-                               }
-                       }                               
-               }
-#endif
-
-#ifndef OPENSSL_NO_ECDSA
-       ecdsa_c[R_EC_P160][0]=count/1000;
-       ecdsa_c[R_EC_P160][1]=count/1000/2;
-       for (i=R_EC_P192; i<=R_EC_P521; i++)
-               {
-               ecdsa_c[i][0]=ecdsa_c[i-1][0]/2;
-               ecdsa_c[i][1]=ecdsa_c[i-1][1]/2;
-               if ((ecdsa_doit[i] <= 1) && (ecdsa_c[i][0] == 0))
-                       ecdsa_doit[i]=0;
-               else
-                       {
-                       if (ecdsa_c[i] == 0)
-                               {
-                               ecdsa_c[i][0]=1;
-                               ecdsa_c[i][1]=1;
-                               }
-                       }
-               }
-       ecdsa_c[R_EC_K163][0]=count/1000;
-       ecdsa_c[R_EC_K163][1]=count/1000/2;
-       for (i=R_EC_K233; i<=R_EC_K571; i++)
-               {
-               ecdsa_c[i][0]=ecdsa_c[i-1][0]/2;
-               ecdsa_c[i][1]=ecdsa_c[i-1][1]/2;
-               if ((ecdsa_doit[i] <= 1) && (ecdsa_c[i][0] == 0))
-                       ecdsa_doit[i]=0;
-               else
-                       {
-                       if (ecdsa_c[i] == 0)
-                               {
-                               ecdsa_c[i][0]=1;
-                               ecdsa_c[i][1]=1;
-                               }
-                       }
-               }
-       ecdsa_c[R_EC_B163][0]=count/1000;
-       ecdsa_c[R_EC_B163][1]=count/1000/2;
-       for (i=R_EC_B233; i<=R_EC_B571; i++)
-               {
-               ecdsa_c[i][0]=ecdsa_c[i-1][0]/2;
-               ecdsa_c[i][1]=ecdsa_c[i-1][1]/2;
-               if ((ecdsa_doit[i] <= 1) && (ecdsa_c[i][0] == 0))
-                       ecdsa_doit[i]=0;
-               else
-                       {
-                       if (ecdsa_c[i] == 0)
-                               {
-                               ecdsa_c[i][0]=1;
-                               ecdsa_c[i][1]=1;
-                               }
-                       }
-               }
-#endif
-
-#ifndef OPENSSL_NO_ECDH
-       ecdh_c[R_EC_P160][0]=count/1000;
-       ecdh_c[R_EC_P160][1]=count/1000;
-       for (i=R_EC_P192; i<=R_EC_P521; i++)
-               {
-               ecdh_c[i][0]=ecdh_c[i-1][0]/2;
-               ecdh_c[i][1]=ecdh_c[i-1][1]/2;
-               if ((ecdh_doit[i] <= 1) && (ecdh_c[i][0] == 0))
-                       ecdh_doit[i]=0;
-               else
-                       {
-                       if (ecdh_c[i] == 0)
-                               {
-                               ecdh_c[i][0]=1;
-                               ecdh_c[i][1]=1;
-                               }
-                       }
-               }
-       ecdh_c[R_EC_K163][0]=count/1000;
-       ecdh_c[R_EC_K163][1]=count/1000;
-       for (i=R_EC_K233; i<=R_EC_K571; i++)
-               {
-               ecdh_c[i][0]=ecdh_c[i-1][0]/2;
-               ecdh_c[i][1]=ecdh_c[i-1][1]/2;
-               if ((ecdh_doit[i] <= 1) && (ecdh_c[i][0] == 0))
-                       ecdh_doit[i]=0;
-               else
-                       {
-                       if (ecdh_c[i] == 0)
-                               {
-                               ecdh_c[i][0]=1;
-                               ecdh_c[i][1]=1;
-                               }
-                       }
-               }
-       ecdh_c[R_EC_B163][0]=count/1000;
-       ecdh_c[R_EC_B163][1]=count/1000;
-       for (i=R_EC_B233; i<=R_EC_B571; i++)
-               {
-               ecdh_c[i][0]=ecdh_c[i-1][0]/2;
-               ecdh_c[i][1]=ecdh_c[i-1][1]/2;
-               if ((ecdh_doit[i] <= 1) && (ecdh_c[i][0] == 0))
-                       ecdh_doit[i]=0;
-               else
-                       {
-                       if (ecdh_c[i] == 0)
-                               {
-                               ecdh_c[i][0]=1;
-                               ecdh_c[i][1]=1;
-                               }
-                       }
-               }
-#endif
-
-#define COND(d)        (count < (d))
-#define COUNT(d) (d)
-#else
-/* not worth fixing */
-# error "You cannot disable DES on systems without SIGALRM."
-#endif /* OPENSSL_NO_DES */
-#else
-#define COND(c)        (run)
-#define COUNT(d) (count)
-#ifndef _WIN32
-       signal(SIGALRM,sig_done);
-#endif
-#endif /* SIGALRM */
-
-#ifndef OPENSSL_NO_MD2
-       if (doit[D_MD2])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_MD2],c[D_MD2][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_MD2][j]); count++)
-                               EVP_Digest(buf,(unsigned long)lengths[j],&(md2[0]),NULL,EVP_md2(),NULL);
-                       d=Time_F(STOP);
-                       print_result(D_MD2,j,count,d);
-                       }
-               }
-#endif
-#ifndef OPENSSL_NO_MDC2
-       if (doit[D_MDC2])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_MDC2],c[D_MDC2][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_MDC2][j]); count++)
-                               EVP_Digest(buf,(unsigned long)lengths[j],&(mdc2[0]),NULL,EVP_mdc2(),NULL);
-                       d=Time_F(STOP);
-                       print_result(D_MDC2,j,count,d);
-                       }
-               }
-#endif
-
-#ifndef OPENSSL_NO_MD4
-       if (doit[D_MD4])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_MD4],c[D_MD4][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_MD4][j]); count++)
-                               EVP_Digest(&(buf[0]),(unsigned long)lengths[j],&(md4[0]),NULL,EVP_md4(),NULL);
-                       d=Time_F(STOP);
-                       print_result(D_MD4,j,count,d);
-                       }
-               }
-#endif
-
-#ifndef OPENSSL_NO_MD5
-       if (doit[D_MD5])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_MD5],c[D_MD5][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_MD5][j]); count++)
-                               EVP_Digest(&(buf[0]),(unsigned long)lengths[j],&(md5[0]),NULL,EVP_get_digestbyname("md5"),NULL);
-                       d=Time_F(STOP);
-                       print_result(D_MD5,j,count,d);
-                       }
-               }
-#endif
-
-#if !defined(OPENSSL_NO_MD5) && !defined(OPENSSL_NO_HMAC)
-       if (doit[D_HMAC])
-               {
-               HMAC_CTX hctx;
-
-               HMAC_CTX_init(&hctx);
-               HMAC_Init_ex(&hctx,(unsigned char *)"This is a key...",
-                       16,EVP_md5(), NULL);
-
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_HMAC],c[D_HMAC][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_HMAC][j]); count++)
-                               {
-                               HMAC_Init_ex(&hctx,NULL,0,NULL,NULL);
-                               HMAC_Update(&hctx,buf,lengths[j]);
-                               HMAC_Final(&hctx,&(hmac[0]),NULL);
-                               }
-                       d=Time_F(STOP);
-                       print_result(D_HMAC,j,count,d);
-                       }
-               HMAC_CTX_cleanup(&hctx);
-               }
-#endif
-#ifndef OPENSSL_NO_SHA
-       if (doit[D_SHA1])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_SHA1],c[D_SHA1][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_SHA1][j]); count++)
-                               EVP_Digest(buf,(unsigned long)lengths[j],&(sha[0]),NULL,EVP_sha1(),NULL);
-                       d=Time_F(STOP);
-                       print_result(D_SHA1,j,count,d);
-                       }
-               }
-
-#ifndef OPENSSL_NO_SHA256
-       if (doit[D_SHA256])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_SHA256],c[D_SHA256][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_SHA256][j]); count++)
-                               SHA256(buf,lengths[j],sha256);
-                       d=Time_F(STOP);
-                       print_result(D_SHA256,j,count,d);
-                       }
-               }
-#endif
-
-#ifndef OPENSSL_NO_SHA512
-       if (doit[D_SHA512])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_SHA512],c[D_SHA512][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_SHA512][j]); count++)
-                               SHA512(buf,lengths[j],sha512);
-                       d=Time_F(STOP);
-                       print_result(D_SHA512,j,count,d);
-                       }
-               }
-#endif
-#endif
-
-#ifndef OPENSSL_NO_WHIRLPOOL
-       if (doit[D_WHIRLPOOL])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_WHIRLPOOL],c[D_WHIRLPOOL][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_WHIRLPOOL][j]); count++)
-                               WHIRLPOOL(buf,lengths[j],whirlpool);
-                       d=Time_F(STOP);
-                       print_result(D_WHIRLPOOL,j,count,d);
-                       }
-               }
-#endif
-
-#ifndef OPENSSL_NO_RIPEMD
-       if (doit[D_RMD160])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_RMD160],c[D_RMD160][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_RMD160][j]); count++)
-                               EVP_Digest(buf,(unsigned long)lengths[j],&(rmd160[0]),NULL,EVP_ripemd160(),NULL);
-                       d=Time_F(STOP);
-                       print_result(D_RMD160,j,count,d);
-                       }
-               }
-#endif
-#ifndef OPENSSL_NO_RC4
-       if (doit[D_RC4])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_RC4],c[D_RC4][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_RC4][j]); count++)
-                               RC4(&rc4_ks,(unsigned int)lengths[j],
-                                       buf,buf);
-                       d=Time_F(STOP);
-                       print_result(D_RC4,j,count,d);
-                       }
-               }
-#endif
-#ifndef OPENSSL_NO_DES
-       if (doit[D_CBC_DES])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_CBC_DES],c[D_CBC_DES][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_CBC_DES][j]); count++)
-                               DES_ncbc_encrypt(buf,buf,lengths[j],&sch,
-                                                &DES_iv,DES_ENCRYPT);
-                       d=Time_F(STOP);
-                       print_result(D_CBC_DES,j,count,d);
-                       }
-               }
-
-       if (doit[D_EDE3_DES])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_EDE3_DES],c[D_EDE3_DES][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_EDE3_DES][j]); count++)
-                               DES_ede3_cbc_encrypt(buf,buf,lengths[j],
-                                                    &sch,&sch2,&sch3,
-                                                    &DES_iv,DES_ENCRYPT);
-                       d=Time_F(STOP);
-                       print_result(D_EDE3_DES,j,count,d);
-                       }
-               }
-#endif
-#ifndef OPENSSL_NO_AES
-       if (doit[D_CBC_128_AES])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_CBC_128_AES],c[D_CBC_128_AES][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_CBC_128_AES][j]); count++)
-                               AES_cbc_encrypt(buf,buf,
-                                       (unsigned long)lengths[j],&aes_ks1,
-                                       iv,AES_ENCRYPT);
-                       d=Time_F(STOP);
-                       print_result(D_CBC_128_AES,j,count,d);
-                       }
-               }
-       if (doit[D_CBC_192_AES])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_CBC_192_AES],c[D_CBC_192_AES][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_CBC_192_AES][j]); count++)
-                               AES_cbc_encrypt(buf,buf,
-                                       (unsigned long)lengths[j],&aes_ks2,
-                                       iv,AES_ENCRYPT);
-                       d=Time_F(STOP);
-                       print_result(D_CBC_192_AES,j,count,d);
-                       }
-               }
-       if (doit[D_CBC_256_AES])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_CBC_256_AES],c[D_CBC_256_AES][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_CBC_256_AES][j]); count++)
-                               AES_cbc_encrypt(buf,buf,
-                                       (unsigned long)lengths[j],&aes_ks3,
-                                       iv,AES_ENCRYPT);
-                       d=Time_F(STOP);
-                       print_result(D_CBC_256_AES,j,count,d);
-                       }
-               }
-
-       if (doit[D_IGE_128_AES])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_IGE_128_AES],c[D_IGE_128_AES][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_IGE_128_AES][j]); count++)
-                               AES_ige_encrypt(buf,buf2,
-                                       (unsigned long)lengths[j],&aes_ks1,
-                                       iv,AES_ENCRYPT);
-                       d=Time_F(STOP);
-                       print_result(D_IGE_128_AES,j,count,d);
-                       }
-               }
-       if (doit[D_IGE_192_AES])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_IGE_192_AES],c[D_IGE_192_AES][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_IGE_192_AES][j]); count++)
-                               AES_ige_encrypt(buf,buf2,
-                                       (unsigned long)lengths[j],&aes_ks2,
-                                       iv,AES_ENCRYPT);
-                       d=Time_F(STOP);
-                       print_result(D_IGE_192_AES,j,count,d);
-                       }
-               }
-       if (doit[D_IGE_256_AES])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_IGE_256_AES],c[D_IGE_256_AES][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_IGE_256_AES][j]); count++)
-                               AES_ige_encrypt(buf,buf2,
-                                       (unsigned long)lengths[j],&aes_ks3,
-                                       iv,AES_ENCRYPT);
-                       d=Time_F(STOP);
-                       print_result(D_IGE_256_AES,j,count,d);
-                       }
-               }
-
-
-#endif
-#ifndef OPENSSL_NO_CAMELLIA
-       if (doit[D_CBC_128_CML])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_CBC_128_CML],c[D_CBC_128_CML][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_CBC_128_CML][j]); count++)
-                               Camellia_cbc_encrypt(buf,buf,
-                                       (unsigned long)lengths[j],&camellia_ks1,
-                                       iv,CAMELLIA_ENCRYPT);
-                       d=Time_F(STOP);
-                       print_result(D_CBC_128_CML,j,count,d);
-                       }
-               }
-       if (doit[D_CBC_192_CML])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_CBC_192_CML],c[D_CBC_192_CML][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_CBC_192_CML][j]); count++)
-                               Camellia_cbc_encrypt(buf,buf,
-                                       (unsigned long)lengths[j],&camellia_ks2,
-                                       iv,CAMELLIA_ENCRYPT);
-                       d=Time_F(STOP);
-                       print_result(D_CBC_192_CML,j,count,d);
-                       }
-               }
-       if (doit[D_CBC_256_CML])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_CBC_256_CML],c[D_CBC_256_CML][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_CBC_256_CML][j]); count++)
-                               Camellia_cbc_encrypt(buf,buf,
-                                       (unsigned long)lengths[j],&camellia_ks3,
-                                       iv,CAMELLIA_ENCRYPT);
-                       d=Time_F(STOP);
-                       print_result(D_CBC_256_CML,j,count,d);
-                       }
-               }
-
-#endif
-#ifndef OPENSSL_NO_IDEA
-       if (doit[D_CBC_IDEA])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_CBC_IDEA],c[D_CBC_IDEA][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_CBC_IDEA][j]); count++)
-                               idea_cbc_encrypt(buf,buf,
-                                       (unsigned long)lengths[j],&idea_ks,
-                                       iv,IDEA_ENCRYPT);
-                       d=Time_F(STOP);
-                       print_result(D_CBC_IDEA,j,count,d);
-                       }
-               }
-#endif
-#ifndef OPENSSL_NO_SEED
-       if (doit[D_CBC_SEED])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_CBC_SEED],c[D_CBC_SEED][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_CBC_SEED][j]); count++)
-                               SEED_cbc_encrypt(buf,buf,
-                                       (unsigned long)lengths[j],&seed_ks,iv,1);
-                       d=Time_F(STOP);
-                       print_result(D_CBC_SEED,j,count,d);
-                       }
-               }
-#endif
-#ifndef OPENSSL_NO_RC2
-       if (doit[D_CBC_RC2])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_CBC_RC2],c[D_CBC_RC2][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_CBC_RC2][j]); count++)
-                               RC2_cbc_encrypt(buf,buf,
-                                       (unsigned long)lengths[j],&rc2_ks,
-                                       iv,RC2_ENCRYPT);
-                       d=Time_F(STOP);
-                       print_result(D_CBC_RC2,j,count,d);
-                       }
-               }
-#endif
-#ifndef OPENSSL_NO_RC5
-       if (doit[D_CBC_RC5])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_CBC_RC5],c[D_CBC_RC5][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_CBC_RC5][j]); count++)
-                               RC5_32_cbc_encrypt(buf,buf,
-                                       (unsigned long)lengths[j],&rc5_ks,
-                                       iv,RC5_ENCRYPT);
-                       d=Time_F(STOP);
-                       print_result(D_CBC_RC5,j,count,d);
-                       }
-               }
-#endif
-#ifndef OPENSSL_NO_BF
-       if (doit[D_CBC_BF])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_CBC_BF],c[D_CBC_BF][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_CBC_BF][j]); count++)
-                               BF_cbc_encrypt(buf,buf,
-                                       (unsigned long)lengths[j],&bf_ks,
-                                       iv,BF_ENCRYPT);
-                       d=Time_F(STOP);
-                       print_result(D_CBC_BF,j,count,d);
-                       }
-               }
-#endif
-#ifndef OPENSSL_NO_CAST
-       if (doit[D_CBC_CAST])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       print_message(names[D_CBC_CAST],c[D_CBC_CAST][j],lengths[j]);
-                       Time_F(START);
-                       for (count=0,run=1; COND(c[D_CBC_CAST][j]); count++)
-                               CAST_cbc_encrypt(buf,buf,
-                                       (unsigned long)lengths[j],&cast_ks,
-                                       iv,CAST_ENCRYPT);
-                       d=Time_F(STOP);
-                       print_result(D_CBC_CAST,j,count,d);
-                       }
-               }
-#endif
-
-       if (doit[D_EVP])
-               {
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       if (evp_cipher)
-                               {
-                               EVP_CIPHER_CTX ctx;
-                               int outl;
-
-                               names[D_EVP]=OBJ_nid2ln(evp_cipher->nid);
-                               /* -O3 -fschedule-insns messes up an
-                                * optimization here!  names[D_EVP]
-                                * somehow becomes NULL */
-                               print_message(names[D_EVP],save_count,
-                                       lengths[j]);
-
-                               EVP_CIPHER_CTX_init(&ctx);
-                               if(decrypt)
-                                       EVP_DecryptInit_ex(&ctx,evp_cipher,NULL,key16,iv);
-                               else
-                                       EVP_EncryptInit_ex(&ctx,evp_cipher,NULL,key16,iv);
-                               EVP_CIPHER_CTX_set_padding(&ctx, 0);
-
-                               Time_F(START);
-                               if(decrypt)
-                                       for (count=0,run=1; COND(save_count*4*lengths[0]/lengths[j]); count++)
-                                               EVP_DecryptUpdate(&ctx,buf,&outl,buf,lengths[j]);
-                               else
-                                       for (count=0,run=1; COND(save_count*4*lengths[0]/lengths[j]); count++)
-                                               EVP_EncryptUpdate(&ctx,buf,&outl,buf,lengths[j]);
-                               if(decrypt)
-                                       EVP_DecryptFinal_ex(&ctx,buf,&outl);
-                               else
-                                       EVP_EncryptFinal_ex(&ctx,buf,&outl);
-                               d=Time_F(STOP);
-                               EVP_CIPHER_CTX_cleanup(&ctx);
-                               }
-                       if (evp_md)
-                               {
-                               names[D_EVP]=OBJ_nid2ln(evp_md->type);
-                               print_message(names[D_EVP],save_count,
-                                       lengths[j]);
-
-                               Time_F(START);
-                               for (count=0,run=1; COND(save_count*4*lengths[0]/lengths[j]); count++)
-                                       EVP_Digest(buf,lengths[j],&(md[0]),NULL,evp_md,NULL);
-
-                               d=Time_F(STOP);
-                               }
-                       print_result(D_EVP,j,count,d);
-                       }
-               }
-
-       RAND_pseudo_bytes(buf,36);
-#ifndef OPENSSL_NO_RSA
-       for (j=0; j<RSA_NUM; j++)
-               {
-               int ret;
-               if (!rsa_doit[j]) continue;
-               ret=RSA_sign(NID_md5_sha1, buf,36, buf2, &rsa_num, rsa_key[j]);
-               if (ret == 0)
-                       {
-                       BIO_printf(bio_err,"RSA sign failure.  No RSA sign will be done.\n");
-                       ERR_print_errors(bio_err);
-                       rsa_count=1;
-                       }
-               else
-                       {
-                       pkey_print_message("private","rsa",
-                               rsa_c[j][0],rsa_bits[j],
-                               RSA_SECONDS);
-/*                     RSA_blinding_on(rsa_key[j],NULL); */
-                       Time_F(START);
-                       for (count=0,run=1; COND(rsa_c[j][0]); count++)
-                               {
-                               ret=RSA_sign(NID_md5_sha1, buf,36, buf2,
-                                       &rsa_num, rsa_key[j]);
-                               if (ret == 0)
-                                       {
-                                       BIO_printf(bio_err,
-                                               "RSA sign failure\n");
-                                       ERR_print_errors(bio_err);
-                                       count=1;
-                                       break;
-                                       }
-                               }
-                       d=Time_F(STOP);
-                       BIO_printf(bio_err,mr ? "+R1:%ld:%d:%.2f\n"
-                                  : "%ld %d bit private RSA's in %.2fs\n",
-                                  count,rsa_bits[j],d);
-                       rsa_results[j][0]=d/(double)count;
-                       rsa_count=count;
-                       }
-
-#if 1
-               ret=RSA_verify(NID_md5_sha1, buf,36, buf2, rsa_num, rsa_key[j]);
-               if (ret <= 0)
-                       {
-                       BIO_printf(bio_err,"RSA verify failure.  No RSA verify will be done.\n");
-                       ERR_print_errors(bio_err);
-                       rsa_doit[j] = 0;
-                       }
-               else
-                       {
-                       pkey_print_message("public","rsa",
-                               rsa_c[j][1],rsa_bits[j],
-                               RSA_SECONDS);
-                       Time_F(START);
-                       for (count=0,run=1; COND(rsa_c[j][1]); count++)
-                               {
-                               ret=RSA_verify(NID_md5_sha1, buf,36, buf2,
-                                       rsa_num, rsa_key[j]);
-                               if (ret <= 0)
-                                       {
-                                       BIO_printf(bio_err,
-                                               "RSA verify failure\n");
-                                       ERR_print_errors(bio_err);
-                                       count=1;
-                                       break;
-                                       }
-                               }
-                       d=Time_F(STOP);
-                       BIO_printf(bio_err,mr ? "+R2:%ld:%d:%.2f\n"
-                                  : "%ld %d bit public RSA's in %.2fs\n",
-                                  count,rsa_bits[j],d);
-                       rsa_results[j][1]=d/(double)count;
-                       }
-#endif
-
-               if (rsa_count <= 1)
-                       {
-                       /* if longer than 10s, don't do any more */
-                       for (j++; j<RSA_NUM; j++)
-                               rsa_doit[j]=0;
-                       }
-               }
-#endif
-
-       RAND_pseudo_bytes(buf,20);
-#ifndef OPENSSL_NO_DSA
-       if (RAND_status() != 1)
-               {
-               RAND_seed(rnd_seed, sizeof rnd_seed);
-               rnd_fake = 1;
-               }
-       for (j=0; j<DSA_NUM; j++)
-               {
-               unsigned int kk;
-               int ret;
-
-               if (!dsa_doit[j]) continue;
-/*             DSA_generate_key(dsa_key[j]); */
-/*             DSA_sign_setup(dsa_key[j],NULL); */
-               ret=DSA_sign(EVP_PKEY_DSA,buf,20,buf2,
-                       &kk,dsa_key[j]);
-               if (ret == 0)
-                       {
-                       BIO_printf(bio_err,"DSA sign failure.  No DSA sign will be done.\n");
-                       ERR_print_errors(bio_err);
-                       rsa_count=1;
-                       }
-               else
-                       {
-                       pkey_print_message("sign","dsa",
-                               dsa_c[j][0],dsa_bits[j],
-                               DSA_SECONDS);
-                       Time_F(START);
-                       for (count=0,run=1; COND(dsa_c[j][0]); count++)
-                               {
-                               ret=DSA_sign(EVP_PKEY_DSA,buf,20,buf2,
-                                       &kk,dsa_key[j]);
-                               if (ret == 0)
-                                       {
-                                       BIO_printf(bio_err,
-                                               "DSA sign failure\n");
-                                       ERR_print_errors(bio_err);
-                                       count=1;
-                                       break;
-                                       }
-                               }
-                       d=Time_F(STOP);
-                       BIO_printf(bio_err,mr ? "+R3:%ld:%d:%.2f\n"
-                                  : "%ld %d bit DSA signs in %.2fs\n",
-                                  count,dsa_bits[j],d);
-                       dsa_results[j][0]=d/(double)count;
-                       rsa_count=count;
-                       }
-
-               ret=DSA_verify(EVP_PKEY_DSA,buf,20,buf2,
-                       kk,dsa_key[j]);
-               if (ret <= 0)
-                       {
-                       BIO_printf(bio_err,"DSA verify failure.  No DSA verify will be done.\n");
-                       ERR_print_errors(bio_err);
-                       dsa_doit[j] = 0;
-                       }
-               else
-                       {
-                       pkey_print_message("verify","dsa",
-                               dsa_c[j][1],dsa_bits[j],
-                               DSA_SECONDS);
-                       Time_F(START);
-                       for (count=0,run=1; COND(dsa_c[j][1]); count++)
-                               {
-                               ret=DSA_verify(EVP_PKEY_DSA,buf,20,buf2,
-                                       kk,dsa_key[j]);
-                               if (ret <= 0)
-                                       {
-                                       BIO_printf(bio_err,
-                                               "DSA verify failure\n");
-                                       ERR_print_errors(bio_err);
-                                       count=1;
-                                       break;
-                                       }
-                               }
-                       d=Time_F(STOP);
-                       BIO_printf(bio_err,mr ? "+R4:%ld:%d:%.2f\n"
-                                  : "%ld %d bit DSA verify in %.2fs\n",
-                                  count,dsa_bits[j],d);
-                       dsa_results[j][1]=d/(double)count;
-                       }
-
-               if (rsa_count <= 1)
-                       {
-                       /* if longer than 10s, don't do any more */
-                       for (j++; j<DSA_NUM; j++)
-                               dsa_doit[j]=0;
-                       }
-               }
-       if (rnd_fake) RAND_cleanup();
-#endif
-
-#ifndef OPENSSL_NO_ECDSA
-       if (RAND_status() != 1) 
-               {
-               RAND_seed(rnd_seed, sizeof rnd_seed);
-               rnd_fake = 1;
-               }
-       for (j=0; j<EC_NUM; j++) 
-               {
-               int ret;
-
-               if (!ecdsa_doit[j]) continue; /* Ignore Curve */ 
-               ecdsa[j] = EC_KEY_new_by_curve_name(test_curves[j]);
-               if (ecdsa[j] == NULL) 
-                       {
-                       BIO_printf(bio_err,"ECDSA failure.\n");
-                       ERR_print_errors(bio_err);
-                       rsa_count=1;
-                       } 
-               else 
-                       {
-#if 1
-                       EC_KEY_precompute_mult(ecdsa[j], NULL);
-#endif
-                       /* Perform ECDSA signature test */
-                       EC_KEY_generate_key(ecdsa[j]);
-                       ret = ECDSA_sign(0, buf, 20, ecdsasig, 
-                               &ecdsasiglen, ecdsa[j]);
-                       if (ret == 0) 
-                               {
-                               BIO_printf(bio_err,"ECDSA sign failure.  No ECDSA sign will be done.\n");
-                               ERR_print_errors(bio_err);
-                               rsa_count=1;
-                               } 
-                       else 
-                               {
-                               pkey_print_message("sign","ecdsa",
-                                       ecdsa_c[j][0], 
-                                       test_curves_bits[j],
-                                       ECDSA_SECONDS);
-
-                               Time_F(START);
-                               for (count=0,run=1; COND(ecdsa_c[j][0]);
-                                       count++) 
-                                       {
-                                       ret=ECDSA_sign(0, buf, 20, 
-                                               ecdsasig, &ecdsasiglen,
-                                               ecdsa[j]);
-                                       if (ret == 0) 
-                                               {
-                                               BIO_printf(bio_err, "ECDSA sign failure\n");
-                                               ERR_print_errors(bio_err);
-                                               count=1;
-                                               break;
-                                               }
-                                       }
-                               d=Time_F(STOP);
-
-                               BIO_printf(bio_err, mr ? "+R5:%ld:%d:%.2f\n" :
-                                       "%ld %d bit ECDSA signs in %.2fs \n", 
-                                       count, test_curves_bits[j], d);
-                               ecdsa_results[j][0]=d/(double)count;
-                               rsa_count=count;
-                               }
-
-                       /* Perform ECDSA verification test */
-                       ret=ECDSA_verify(0, buf, 20, ecdsasig, 
-                               ecdsasiglen, ecdsa[j]);
-                       if (ret != 1) 
-                               {
-                               BIO_printf(bio_err,"ECDSA verify failure.  No ECDSA verify will be done.\n");
-                               ERR_print_errors(bio_err);
-                               ecdsa_doit[j] = 0;
-                               } 
-                       else 
-                               {
-                               pkey_print_message("verify","ecdsa",
-                               ecdsa_c[j][1],
-                               test_curves_bits[j],
-                               ECDSA_SECONDS);
-                               Time_F(START);
-                               for (count=0,run=1; COND(ecdsa_c[j][1]); count++) 
-                                       {
-                                       ret=ECDSA_verify(0, buf, 20, ecdsasig, ecdsasiglen, ecdsa[j]);
-                                       if (ret != 1) 
-                                               {
-                                               BIO_printf(bio_err, "ECDSA verify failure\n");
-                                               ERR_print_errors(bio_err);
-                                               count=1;
-                                               break;
-                                               }
-                                       }
-                               d=Time_F(STOP);
-                               BIO_printf(bio_err, mr? "+R6:%ld:%d:%.2f\n"
-                                               : "%ld %d bit ECDSA verify in %.2fs\n",
-                               count, test_curves_bits[j], d);
-                               ecdsa_results[j][1]=d/(double)count;
-                               }
-
-                       if (rsa_count <= 1) 
-                               {
-                               /* if longer than 10s, don't do any more */
-                               for (j++; j<EC_NUM; j++)
-                               ecdsa_doit[j]=0;
-                               }
-                       }
-               }
-       if (rnd_fake) RAND_cleanup();
-#endif
-
-#ifndef OPENSSL_NO_ECDH
-       if (RAND_status() != 1)
-               {
-               RAND_seed(rnd_seed, sizeof rnd_seed);
-               rnd_fake = 1;
-               }
-       for (j=0; j<EC_NUM; j++)
-               {
-               if (!ecdh_doit[j]) continue;
-               ecdh_a[j] = EC_KEY_new_by_curve_name(test_curves[j]);
-               ecdh_b[j] = EC_KEY_new_by_curve_name(test_curves[j]);
-               if ((ecdh_a[j] == NULL) || (ecdh_b[j] == NULL))
-                       {
-                       BIO_printf(bio_err,"ECDH failure.\n");
-                       ERR_print_errors(bio_err);
-                       rsa_count=1;
-                       }
-               else
-                       {
-                       /* generate two ECDH key pairs */
-                       if (!EC_KEY_generate_key(ecdh_a[j]) ||
-                               !EC_KEY_generate_key(ecdh_b[j]))
-                               {
-                               BIO_printf(bio_err,"ECDH key generation failure.\n");
-                               ERR_print_errors(bio_err);
-                               rsa_count=1;            
-                               }
-                       else
-                               {
-                               /* If field size is not more than 24 octets, then use SHA-1 hash of result;
-                                * otherwise, use result (see section 4.8 of draft-ietf-tls-ecc-03.txt).
-                                */
-                               int field_size, outlen;
-                               void *(*kdf)(const void *in, size_t inlen, void *out, size_t *xoutlen);
-                               field_size = EC_GROUP_get_degree(EC_KEY_get0_group(ecdh_a[j]));
-                               if (field_size <= 24 * 8)
-                                       {
-                                       outlen = KDF1_SHA1_len;
-                                       kdf = KDF1_SHA1;
-                                       }
-                               else
-                                       {
-                                       outlen = (field_size+7)/8;
-                                       kdf = NULL;
-                                       }
-                               secret_size_a = ECDH_compute_key(secret_a, outlen,
-                                       EC_KEY_get0_public_key(ecdh_b[j]),
-                                       ecdh_a[j], kdf);
-                               secret_size_b = ECDH_compute_key(secret_b, outlen,
-                                       EC_KEY_get0_public_key(ecdh_a[j]),
-                                       ecdh_b[j], kdf);
-                               if (secret_size_a != secret_size_b) 
-                                       ecdh_checks = 0;
-                               else
-                                       ecdh_checks = 1;
-
-                               for (secret_idx = 0; 
-                                   (secret_idx < secret_size_a)
-                                       && (ecdh_checks == 1);
-                                   secret_idx++)
-                                       {
-                                       if (secret_a[secret_idx] != secret_b[secret_idx])
-                                       ecdh_checks = 0;
-                                       }
-
-                               if (ecdh_checks == 0)
-                                       {
-                                       BIO_printf(bio_err,"ECDH computations don't match.\n");
-                                       ERR_print_errors(bio_err);
-                                       rsa_count=1;            
-                                       }
-
-                               pkey_print_message("","ecdh",
-                               ecdh_c[j][0], 
-                               test_curves_bits[j],
-                               ECDH_SECONDS);
-                               Time_F(START);
-                               for (count=0,run=1; COND(ecdh_c[j][0]); count++)
-                                       {
-                                       ECDH_compute_key(secret_a, outlen,
-                                       EC_KEY_get0_public_key(ecdh_b[j]),
-                                       ecdh_a[j], kdf);
-                                       }
-                               d=Time_F(STOP);
-                               BIO_printf(bio_err, mr ? "+R7:%ld:%d:%.2f\n" :"%ld %d-bit ECDH ops in %.2fs\n",
-                               count, test_curves_bits[j], d);
-                               ecdh_results[j][0]=d/(double)count;
-                               rsa_count=count;
-                               }
-                       }
-
-
-               if (rsa_count <= 1)
-                       {
-                       /* if longer than 10s, don't do any more */
-                       for (j++; j<EC_NUM; j++)
-                       ecdh_doit[j]=0;
-                       }
-               }
-       if (rnd_fake) RAND_cleanup();
-#endif
-#ifndef NO_FORK
-show_res:
-#endif
-       if(!mr)
-               {
-               fprintf(stdout,"%s\n",SSLeay_version(SSLEAY_VERSION));
-        fprintf(stdout,"%s\n",SSLeay_version(SSLEAY_BUILT_ON));
-               printf("options:");
-               printf("%s ",BN_options());
-#ifndef OPENSSL_NO_MD2
-               printf("%s ",MD2_options());
-#endif
-#ifndef OPENSSL_NO_RC4
-               printf("%s ",RC4_options());
-#endif
-#ifndef OPENSSL_NO_DES
-               printf("%s ",DES_options());
-#endif
-#ifndef OPENSSL_NO_AES
-               printf("%s ",AES_options());
-#endif
-#ifndef OPENSSL_NO_IDEA
-               printf("%s ",idea_options());
-#endif
-#ifndef OPENSSL_NO_BF
-               printf("%s ",BF_options());
-#endif
-               fprintf(stdout,"\n%s\n",SSLeay_version(SSLEAY_CFLAGS));
-               }
-
-       if (pr_header)
-               {
-               if(mr)
-                       fprintf(stdout,"+H");
-               else
-                       {
-                       fprintf(stdout,"The 'numbers' are in 1000s of bytes per second processed.\n"); 
-                       fprintf(stdout,"type        ");
-                       }
-               for (j=0;  j<SIZE_NUM; j++)
-                       fprintf(stdout,mr ? ":%d" : "%7d bytes",lengths[j]);
-               fprintf(stdout,"\n");
-               }
-
-       for (k=0; k<ALGOR_NUM; k++)
-               {
-               if (!doit[k]) continue;
-               if(mr)
-                       fprintf(stdout,"+F:%d:%s",k,names[k]);
-               else
-                       fprintf(stdout,"%-13s",names[k]);
-               for (j=0; j<SIZE_NUM; j++)
-                       {
-                       if (results[k][j] > 10000 && !mr)
-                               fprintf(stdout," %11.2fk",results[k][j]/1e3);
-                       else
-                               fprintf(stdout,mr ? ":%.2f" : " %11.2f ",results[k][j]);
-                       }
-               fprintf(stdout,"\n");
-               }
-#ifndef OPENSSL_NO_RSA
-       j=1;
-       for (k=0; k<RSA_NUM; k++)
-               {
-               if (!rsa_doit[k]) continue;
-               if (j && !mr)
-                       {
-                       printf("%18ssign    verify    sign/s verify/s\n"," ");
-                       j=0;
-                       }
-               if(mr)
-                       fprintf(stdout,"+F2:%u:%u:%f:%f\n",
-                               k,rsa_bits[k],rsa_results[k][0],
-                               rsa_results[k][1]);
-               else
-                       fprintf(stdout,"rsa %4u bits %8.6fs %8.6fs %8.1f %8.1f\n",
-                               rsa_bits[k],rsa_results[k][0],rsa_results[k][1],
-                               1.0/rsa_results[k][0],1.0/rsa_results[k][1]);
-               }
-#endif
-#ifndef OPENSSL_NO_DSA
-       j=1;
-       for (k=0; k<DSA_NUM; k++)
-               {
-               if (!dsa_doit[k]) continue;
-               if (j && !mr)
-                       {
-                       printf("%18ssign    verify    sign/s verify/s\n"," ");
-                       j=0;
-                       }
-               if(mr)
-                       fprintf(stdout,"+F3:%u:%u:%f:%f\n",
-                               k,dsa_bits[k],dsa_results[k][0],dsa_results[k][1]);
-               else
-                       fprintf(stdout,"dsa %4u bits %8.6fs %8.6fs %8.1f %8.1f\n",
-                               dsa_bits[k],dsa_results[k][0],dsa_results[k][1],
-                               1.0/dsa_results[k][0],1.0/dsa_results[k][1]);
-               }
-#endif
-#ifndef OPENSSL_NO_ECDSA
-       j=1;
-       for (k=0; k<EC_NUM; k++)
-               {
-               if (!ecdsa_doit[k]) continue;
-               if (j && !mr)
-                       {
-                       printf("%30ssign    verify    sign/s verify/s\n"," ");
-                       j=0;
-                       }
-
-               if (mr)
-                       fprintf(stdout,"+F4:%u:%u:%f:%f\n", 
-                               k, test_curves_bits[k],
-                               ecdsa_results[k][0],ecdsa_results[k][1]);
-               else
-                       fprintf(stdout,
-                               "%4u bit ecdsa (%s) %8.4fs %8.4fs %8.1f %8.1f\n", 
-                               test_curves_bits[k],
-                               test_curves_names[k],
-                               ecdsa_results[k][0],ecdsa_results[k][1], 
-                               1.0/ecdsa_results[k][0],1.0/ecdsa_results[k][1]);
-               }
-#endif
-
-
-#ifndef OPENSSL_NO_ECDH
-       j=1;
-       for (k=0; k<EC_NUM; k++)
-               {
-               if (!ecdh_doit[k]) continue;
-               if (j && !mr)
-                       {
-                       printf("%30sop      op/s\n"," ");
-                       j=0;
-                       }
-               if (mr)
-                       fprintf(stdout,"+F5:%u:%u:%f:%f\n",
-                               k, test_curves_bits[k],
-                               ecdh_results[k][0], 1.0/ecdh_results[k][0]);
-
-               else
-                       fprintf(stdout,"%4u bit ecdh (%s) %8.4fs %8.1f\n",
-                               test_curves_bits[k],
-                               test_curves_names[k],
-                               ecdh_results[k][0], 1.0/ecdh_results[k][0]);
-               }
-#endif
-
-       mret=0;
-
-end:
-       ERR_print_errors(bio_err);
-       if (buf != NULL) OPENSSL_free(buf);
-       if (buf2 != NULL) OPENSSL_free(buf2);
-#ifndef OPENSSL_NO_RSA
-       for (i=0; i<RSA_NUM; i++)
-               if (rsa_key[i] != NULL)
-                       RSA_free(rsa_key[i]);
-#endif
-#ifndef OPENSSL_NO_DSA
-       for (i=0; i<DSA_NUM; i++)
-               if (dsa_key[i] != NULL)
-                       DSA_free(dsa_key[i]);
-#endif
-
-#ifndef OPENSSL_NO_ECDSA
-       for (i=0; i<EC_NUM; i++)
-               if (ecdsa[i] != NULL)
-                       EC_KEY_free(ecdsa[i]);
-#endif
-#ifndef OPENSSL_NO_ECDH
-       for (i=0; i<EC_NUM; i++)
-       {
-               if (ecdh_a[i] != NULL)
-                       EC_KEY_free(ecdh_a[i]);
-               if (ecdh_b[i] != NULL)
-                       EC_KEY_free(ecdh_b[i]);
-       }
-#endif
-
-       apps_shutdown();
-       OPENSSL_EXIT(mret);
-       }
-
-static void print_message(const char *s, long num, int length)
-       {
-#ifdef SIGALRM
-       BIO_printf(bio_err,mr ? "+DT:%s:%d:%d\n"
-                  : "Doing %s for %ds on %d size blocks: ",s,SECONDS,length);
-       (void)BIO_flush(bio_err);
-       alarm(SECONDS);
-#else
-       BIO_printf(bio_err,mr ? "+DN:%s:%ld:%d\n"
-                  : "Doing %s %ld times on %d size blocks: ",s,num,length);
-       (void)BIO_flush(bio_err);
-#endif
-#ifdef LINT
-       num=num;
-#endif
-       }
-
-static void pkey_print_message(const char *str, const char *str2, long num,
-       int bits, int tm)
-       {
-#ifdef SIGALRM
-       BIO_printf(bio_err,mr ? "+DTP:%d:%s:%s:%d\n"
-                          : "Doing %d bit %s %s's for %ds: ",bits,str,str2,tm);
-       (void)BIO_flush(bio_err);
-       alarm(RSA_SECONDS);
-#else
-       BIO_printf(bio_err,mr ? "+DNP:%ld:%d:%s:%s\n"
-                          : "Doing %ld %d bit %s %s's: ",num,bits,str,str2);
-       (void)BIO_flush(bio_err);
-#endif
-#ifdef LINT
-       num=num;
-#endif
-       }
-
-static void print_result(int alg,int run_no,int count,double time_used)
-       {
-       BIO_printf(bio_err,mr ? "+R:%d:%s:%f\n"
-                  : "%d %s's in %.2fs\n",count,names[alg],time_used);
-       results[alg][run_no]=((double)count)/time_used*lengths[run_no];
-       }
-
-#ifndef NO_FORK
-static char *sstrsep(char **string, const char *delim)
-    {
-    char isdelim[256];
-    char *token = *string;
-
-    if (**string == 0)
-        return NULL;
-
-    memset(isdelim, 0, sizeof isdelim);
-    isdelim[0] = 1;
-
-    while (*delim)
-        {
-        isdelim[(unsigned char)(*delim)] = 1;
-        delim++;
-        }
-
-    while (!isdelim[(unsigned char)(**string)])
-        {
-        (*string)++;
-        }
-
-    if (**string)
-        {
-        **string = 0;
-        (*string)++;
-        }
-
-    return token;
-    }
-
-static int do_multi(int multi)
-       {
-       int n;
-       int fd[2];
-       int *fds;
-       static char sep[]=":";
-
-       fds=malloc(multi*sizeof *fds);
-       for(n=0 ; n < multi ; ++n)
-               {
-               pipe(fd);
-               fflush(stdout);
-               fflush(stderr);
-               if(fork())
-                       {
-                       close(fd[1]);
-                       fds[n]=fd[0];
-                       }
-               else
-                       {
-                       close(fd[0]);
-                       close(1);
-                       dup(fd[1]);
-                       close(fd[1]);
-                       mr=1;
-                       usertime=0;
-                       free(fds);
-                       return 0;
-                       }
-               printf("Forked child %d\n",n);
-               }
-
-       /* for now, assume the pipe is long enough to take all the output */
-       for(n=0 ; n < multi ; ++n)
-               {
-               FILE *f;
-               char buf[1024];
-               char *p;
-
-               f=fdopen(fds[n],"r");
-               while(fgets(buf,sizeof buf,f))
-                       {
-                       p=strchr(buf,'\n');
-                       if(p)
-                               *p='\0';
-                       if(buf[0] != '+')
-                               {
-                               fprintf(stderr,"Don't understand line '%s' from child %d\n",
-                                               buf,n);
-                               continue;
-                               }
-                       printf("Got: %s from %d\n",buf,n);
-                       if(!strncmp(buf,"+F:",3))
-                               {
-                               int alg;
-                               int j;
-
-                               p=buf+3;
-                               alg=atoi(sstrsep(&p,sep));
-                               sstrsep(&p,sep);
-                               for(j=0 ; j < SIZE_NUM ; ++j)
-                                       results[alg][j]+=atof(sstrsep(&p,sep));
-                               }
-                       else if(!strncmp(buf,"+F2:",4))
-                               {
-                               int k;
-                               double d;
-                               
-                               p=buf+4;
-                               k=atoi(sstrsep(&p,sep));
-                               sstrsep(&p,sep);
-
-                               d=atof(sstrsep(&p,sep));
-                               if(n)
-                                       rsa_results[k][0]=1/(1/rsa_results[k][0]+1/d);
-                               else
-                                       rsa_results[k][0]=d;
-
-                               d=atof(sstrsep(&p,sep));
-                               if(n)
-                                       rsa_results[k][1]=1/(1/rsa_results[k][1]+1/d);
-                               else
-                                       rsa_results[k][1]=d;
-                               }
-                       else if(!strncmp(buf,"+F2:",4))
-                               {
-                               int k;
-                               double d;
-                               
-                               p=buf+4;
-                               k=atoi(sstrsep(&p,sep));
-                               sstrsep(&p,sep);
-
-                               d=atof(sstrsep(&p,sep));
-                               if(n)
-                                       rsa_results[k][0]=1/(1/rsa_results[k][0]+1/d);
-                               else
-                                       rsa_results[k][0]=d;
-
-                               d=atof(sstrsep(&p,sep));
-                               if(n)
-                                       rsa_results[k][1]=1/(1/rsa_results[k][1]+1/d);
-                               else
-                                       rsa_results[k][1]=d;
-                               }
-                       else if(!strncmp(buf,"+F3:",4))
-                               {
-                               int k;
-                               double d;
-                               
-                               p=buf+4;
-                               k=atoi(sstrsep(&p,sep));
-                               sstrsep(&p,sep);
-
-                               d=atof(sstrsep(&p,sep));
-                               if(n)
-                                       dsa_results[k][0]=1/(1/dsa_results[k][0]+1/d);
-                               else
-                                       dsa_results[k][0]=d;
-
-                               d=atof(sstrsep(&p,sep));
-                               if(n)
-                                       dsa_results[k][1]=1/(1/dsa_results[k][1]+1/d);
-                               else
-                                       dsa_results[k][1]=d;
-                               }
-#ifndef OPENSSL_NO_ECDSA
-                       else if(!strncmp(buf,"+F4:",4))
-                               {
-                               int k;
-                               double d;
-                               
-                               p=buf+4;
-                               k=atoi(sstrsep(&p,sep));
-                               sstrsep(&p,sep);
-
-                               d=atof(sstrsep(&p,sep));
-                               if(n)
-                                       ecdsa_results[k][0]=1/(1/ecdsa_results[k][0]+1/d);
-                               else
-                                       ecdsa_results[k][0]=d;
-
-                               d=atof(sstrsep(&p,sep));
-                               if(n)
-                                       ecdsa_results[k][1]=1/(1/ecdsa_results[k][1]+1/d);
-                               else
-                                       ecdsa_results[k][1]=d;
-                               }
-#endif 
-
-#ifndef OPENSSL_NO_ECDH
-                       else if(!strncmp(buf,"+F5:",4))
-                               {
-                               int k;
-                               double d;
-                               
-                               p=buf+4;
-                               k=atoi(sstrsep(&p,sep));
-                               sstrsep(&p,sep);
-
-                               d=atof(sstrsep(&p,sep));
-                               if(n)
-                                       ecdh_results[k][0]=1/(1/ecdh_results[k][0]+1/d);
-                               else
-                                       ecdh_results[k][0]=d;
-
-                               }
-#endif
-
-                       else if(!strncmp(buf,"+H:",3))
-                               {
-                               }
-                       else
-                               fprintf(stderr,"Unknown type '%s' from child %d\n",buf,n);
-                       }
-
-               fclose(f);
-               }
-       free(fds);
-       return 1;
-       }
-#endif
-#endif
diff --git a/usr/skb/testapps/testdsa.h b/usr/skb/testapps/testdsa.h
deleted file mode 100644 (file)
index 9e84e31..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-/* NOCW */
-/* used by apps/speed.c */
-DSA *get_dsa512(void );
-DSA *get_dsa1024(void );
-DSA *get_dsa2048(void );
-static unsigned char dsa512_priv[] = {
-       0x65,0xe5,0xc7,0x38,0x60,0x24,0xb5,0x89,0xd4,0x9c,0xeb,0x4c,
-       0x9c,0x1d,0x7a,0x22,0xbd,0xd1,0xc2,0xd2,
-       };
-static unsigned char dsa512_pub[] = {
-       0x00,0x95,0xa7,0x0d,0xec,0x93,0x68,0xba,0x5f,0xf7,0x5f,0x07,
-       0xf2,0x3b,0xad,0x6b,0x01,0xdc,0xbe,0xec,0xde,0x04,0x7a,0x3a,
-       0x27,0xb3,0xec,0x49,0xfd,0x08,0x43,0x3d,0x7e,0xa8,0x2c,0x5e,
-       0x7b,0xbb,0xfc,0xf4,0x6e,0xeb,0x6c,0xb0,0x6e,0xf8,0x02,0x12,
-       0x8c,0x38,0x5d,0x83,0x56,0x7d,0xee,0x53,0x05,0x3e,0x24,0x84,
-       0xbe,0xba,0x0a,0x6b,0xc8,
-       };
-static unsigned char dsa512_p[]={
-       0x9D,0x1B,0x69,0x8E,0x26,0xDB,0xF2,0x2B,0x11,0x70,0x19,0x86,
-       0xF6,0x19,0xC8,0xF8,0x19,0xF2,0x18,0x53,0x94,0x46,0x06,0xD0,
-       0x62,0x50,0x33,0x4B,0x02,0x3C,0x52,0x30,0x03,0x8B,0x3B,0xF9,
-       0x5F,0xD1,0x24,0x06,0x4F,0x7B,0x4C,0xBA,0xAA,0x40,0x9B,0xFD,
-       0x96,0xE4,0x37,0x33,0xBB,0x2D,0x5A,0xD7,0x5A,0x11,0x40,0x66,
-       0xA2,0x76,0x7D,0x31,
-       };
-static unsigned char dsa512_q[]={
-       0xFB,0x53,0xEF,0x50,0xB4,0x40,0x92,0x31,0x56,0x86,0x53,0x7A,
-       0xE8,0x8B,0x22,0x9A,0x49,0xFB,0x71,0x8F,
-       };
-static unsigned char dsa512_g[]={
-       0x83,0x3E,0x88,0xE5,0xC5,0x89,0x73,0xCE,0x3B,0x6C,0x01,0x49,
-       0xBF,0xB3,0xC7,0x9F,0x0A,0xEA,0x44,0x91,0xE5,0x30,0xAA,0xD9,
-       0xBE,0x5B,0x5F,0xB7,0x10,0xD7,0x89,0xB7,0x8E,0x74,0xFB,0xCF,
-       0x29,0x1E,0xEB,0xA8,0x2C,0x54,0x51,0xB8,0x10,0xDE,0xA0,0xCE,
-       0x2F,0xCC,0x24,0x6B,0x90,0x77,0xDE,0xA2,0x68,0xA6,0x52,0x12,
-       0xA2,0x03,0x9D,0x20,
-       };
-
-DSA *get_dsa512()
-       {
-       DSA *dsa;
-
-       if ((dsa=DSA_new()) == NULL) return(NULL);
-       dsa->priv_key=BN_bin2bn(dsa512_priv,sizeof(dsa512_priv),NULL);
-       dsa->pub_key=BN_bin2bn(dsa512_pub,sizeof(dsa512_pub),NULL);
-       dsa->p=BN_bin2bn(dsa512_p,sizeof(dsa512_p),NULL);
-       dsa->q=BN_bin2bn(dsa512_q,sizeof(dsa512_q),NULL);
-       dsa->g=BN_bin2bn(dsa512_g,sizeof(dsa512_g),NULL);
-       if ((dsa->priv_key == NULL) || (dsa->pub_key == NULL) || (dsa->p == NULL) ||
-                               (dsa->q == NULL) || (dsa->g == NULL))
-               return(NULL);
-       return(dsa);
-       }
-
-static unsigned char dsa1024_priv[]={
-       0x7d,0x21,0xda,0xbb,0x62,0x15,0x47,0x36,0x07,0x67,0x12,0xe8,
-       0x8c,0xaa,0x1c,0xcd,0x38,0x12,0x61,0x18,
-       };
-static unsigned char dsa1024_pub[]={
-       0x3c,0x4e,0x9c,0x2a,0x7f,0x16,0xc1,0x25,0xeb,0xac,0x78,0x63,
-       0x90,0x14,0x8c,0x8b,0xf4,0x68,0x43,0x3c,0x2d,0xee,0x65,0x50,
-       0x7d,0x9c,0x8f,0x8c,0x8a,0x51,0xd6,0x11,0x2b,0x99,0xaf,0x1e,
-       0x90,0x97,0xb5,0xd3,0xa6,0x20,0x25,0xd6,0xfe,0x43,0x02,0xd5,
-       0x91,0x7d,0xa7,0x8c,0xdb,0xc9,0x85,0xa3,0x36,0x48,0xf7,0x68,
-       0xaa,0x60,0xb1,0xf7,0x05,0x68,0x3a,0xa3,0x3f,0xd3,0x19,0x82,
-       0xd8,0x82,0x7a,0x77,0xfb,0xef,0xf4,0x15,0x0a,0xeb,0x06,0x04,
-       0x7f,0x53,0x07,0x0c,0xbc,0xcb,0x2d,0x83,0xdb,0x3e,0xd1,0x28,
-       0xa5,0xa1,0x31,0xe0,0x67,0xfa,0x50,0xde,0x9b,0x07,0x83,0x7e,
-       0x2c,0x0b,0xc3,0x13,0x50,0x61,0xe5,0xad,0xbd,0x36,0xb8,0x97,
-       0x4e,0x40,0x7d,0xe8,0x83,0x0d,0xbc,0x4b
-       };
-static unsigned char dsa1024_p[]={
-       0xA7,0x3F,0x6E,0x85,0xBF,0x41,0x6A,0x29,0x7D,0xF0,0x9F,0x47,
-       0x19,0x30,0x90,0x9A,0x09,0x1D,0xDA,0x6A,0x33,0x1E,0xC5,0x3D,
-       0x86,0x96,0xB3,0x15,0xE0,0x53,0x2E,0x8F,0xE0,0x59,0x82,0x73,
-       0x90,0x3E,0x75,0x31,0x99,0x47,0x7A,0x52,0xFB,0x85,0xE4,0xD9,
-       0xA6,0x7B,0x38,0x9B,0x68,0x8A,0x84,0x9B,0x87,0xC6,0x1E,0xB5,
-       0x7E,0x86,0x4B,0x53,0x5B,0x59,0xCF,0x71,0x65,0x19,0x88,0x6E,
-       0xCE,0x66,0xAE,0x6B,0x88,0x36,0xFB,0xEC,0x28,0xDC,0xC2,0xD7,
-       0xA5,0xBB,0xE5,0x2C,0x39,0x26,0x4B,0xDA,0x9A,0x70,0x18,0x95,
-       0x37,0x95,0x10,0x56,0x23,0xF6,0x15,0xED,0xBA,0x04,0x5E,0xDE,
-       0x39,0x4F,0xFD,0xB7,0x43,0x1F,0xB5,0xA4,0x65,0x6F,0xCD,0x80,
-       0x11,0xE4,0x70,0x95,0x5B,0x50,0xCD,0x49,
-       };
-static unsigned char dsa1024_q[]={
-       0xF7,0x07,0x31,0xED,0xFA,0x6C,0x06,0x03,0xD5,0x85,0x8A,0x1C,
-       0xAC,0x9C,0x65,0xE7,0x50,0x66,0x65,0x6F,
-       };
-static unsigned char dsa1024_g[]={
-       0x4D,0xDF,0x4C,0x03,0xA6,0x91,0x8A,0xF5,0x19,0x6F,0x50,0x46,
-       0x25,0x99,0xE5,0x68,0x6F,0x30,0xE3,0x69,0xE1,0xE5,0xB3,0x5D,
-       0x98,0xBB,0x28,0x86,0x48,0xFC,0xDE,0x99,0x04,0x3F,0x5F,0x88,
-       0x0C,0x9C,0x73,0x24,0x0D,0x20,0x5D,0xB9,0x2A,0x9A,0x3F,0x18,
-       0x96,0x27,0xE4,0x62,0x87,0xC1,0x7B,0x74,0x62,0x53,0xFC,0x61,
-       0x27,0xA8,0x7A,0x91,0x09,0x9D,0xB6,0xF1,0x4D,0x9C,0x54,0x0F,
-       0x58,0x06,0xEE,0x49,0x74,0x07,0xCE,0x55,0x7E,0x23,0xCE,0x16,
-       0xF6,0xCA,0xDC,0x5A,0x61,0x01,0x7E,0xC9,0x71,0xB5,0x4D,0xF6,
-       0xDC,0x34,0x29,0x87,0x68,0xF6,0x5E,0x20,0x93,0xB3,0xDB,0xF5,
-       0xE4,0x09,0x6C,0x41,0x17,0x95,0x92,0xEB,0x01,0xB5,0x73,0xA5,
-       0x6A,0x7E,0xD8,0x32,0xED,0x0E,0x02,0xB8,
-       };
-
-DSA *get_dsa1024()
-       {
-       DSA *dsa;
-
-       if ((dsa=DSA_new()) == NULL) return(NULL);
-       dsa->priv_key=BN_bin2bn(dsa1024_priv,sizeof(dsa1024_priv),NULL);
-       dsa->pub_key=BN_bin2bn(dsa1024_pub,sizeof(dsa1024_pub),NULL);
-       dsa->p=BN_bin2bn(dsa1024_p,sizeof(dsa1024_p),NULL);
-       dsa->q=BN_bin2bn(dsa1024_q,sizeof(dsa1024_q),NULL);
-       dsa->g=BN_bin2bn(dsa1024_g,sizeof(dsa1024_g),NULL);
-       if ((dsa->priv_key == NULL) || (dsa->pub_key == NULL) || (dsa->p == NULL) ||
-                               (dsa->q == NULL) || (dsa->g == NULL))
-               return(NULL);
-       return(dsa);
-       }
-
-static unsigned char dsa2048_priv[]={
-       0x32,0x67,0x92,0xf6,0xc4,0xe2,0xe2,0xe8,0xa0,0x8b,0x6b,0x45,
-       0x0c,0x8a,0x76,0xb0,0xee,0xcf,0x91,0xa7,
-       };
-static unsigned char dsa2048_pub[]={
-       0x17,0x8f,0xa8,0x11,0x84,0x92,0xec,0x83,0x47,0xc7,0x6a,0xb0,
-       0x92,0xaf,0x5a,0x20,0x37,0xa3,0x64,0x79,0xd2,0xd0,0x3d,0xcd,
-       0xe0,0x61,0x88,0x88,0x21,0xcc,0x74,0x5d,0xce,0x4c,0x51,0x47,
-       0xf0,0xc5,0x5c,0x4c,0x82,0x7a,0xaf,0x72,0xad,0xb9,0xe0,0x53,
-       0xf2,0x78,0xb7,0xf0,0xb5,0x48,0x7f,0x8a,0x3a,0x18,0xd1,0x9f,
-       0x8b,0x7d,0xa5,0x47,0xb7,0x95,0xab,0x98,0xf8,0x7b,0x74,0x50,
-       0x56,0x8e,0x57,0xf0,0xee,0xf5,0xb7,0xba,0xab,0x85,0x86,0xf9,
-       0x2b,0xef,0x41,0x56,0xa0,0xa4,0x9f,0xb7,0x38,0x00,0x46,0x0a,
-       0xa6,0xf1,0xfc,0x1f,0xd8,0x4e,0x85,0x44,0x92,0x43,0x21,0x5d,
-       0x6e,0xcc,0xc2,0xcb,0x26,0x31,0x0d,0x21,0xc4,0xbd,0x8d,0x24,
-       0xbc,0xd9,0x18,0x19,0xd7,0xdc,0xf1,0xe7,0x93,0x50,0x48,0x03,
-       0x2c,0xae,0x2e,0xe7,0x49,0x88,0x5f,0x93,0x57,0x27,0x99,0x36,
-       0xb4,0x20,0xab,0xfc,0xa7,0x2b,0xf2,0xd9,0x98,0xd7,0xd4,0x34,
-       0x9d,0x96,0x50,0x58,0x9a,0xea,0x54,0xf3,0xee,0xf5,0x63,0x14,
-       0xee,0x85,0x83,0x74,0x76,0xe1,0x52,0x95,0xc3,0xf7,0xeb,0x04,
-       0x04,0x7b,0xa7,0x28,0x1b,0xcc,0xea,0x4a,0x4e,0x84,0xda,0xd8,
-       0x9c,0x79,0xd8,0x9b,0x66,0x89,0x2f,0xcf,0xac,0xd7,0x79,0xf9,
-       0xa9,0xd8,0x45,0x13,0x78,0xb9,0x00,0x14,0xc9,0x7e,0x22,0x51,
-       0x86,0x67,0xb0,0x9f,0x26,0x11,0x23,0xc8,0x38,0xd7,0x70,0x1d,
-       0x15,0x8e,0x4d,0x4f,0x95,0x97,0x40,0xa1,0xc2,0x7e,0x01,0x18,
-       0x72,0xf4,0x10,0xe6,0x8d,0x52,0x16,0x7f,0xf2,0xc9,0xf8,0x33,
-       0x8b,0x33,0xb7,0xce,
-       };
-static unsigned char dsa2048_p[]={
-       0xA0,0x25,0xFA,0xAD,0xF4,0x8E,0xB9,0xE5,0x99,0xF3,0x5D,0x6F,
-       0x4F,0x83,0x34,0xE2,0x7E,0xCF,0x6F,0xBF,0x30,0xAF,0x6F,0x81,
-       0xEB,0xF8,0xC4,0x13,0xD9,0xA0,0x5D,0x8B,0x5C,0x8E,0xDC,0xC2,
-       0x1D,0x0B,0x41,0x32,0xB0,0x1F,0xFE,0xEF,0x0C,0xC2,0xA2,0x7E,
-       0x68,0x5C,0x28,0x21,0xE9,0xF5,0xB1,0x58,0x12,0x63,0x4C,0x19,
-       0x4E,0xFF,0x02,0x4B,0x92,0xED,0xD2,0x07,0x11,0x4D,0x8C,0x58,
-       0x16,0x5C,0x55,0x8E,0xAD,0xA3,0x67,0x7D,0xB9,0x86,0x6E,0x0B,
-       0xE6,0x54,0x6F,0x40,0xAE,0x0E,0x67,0x4C,0xF9,0x12,0x5B,0x3C,
-       0x08,0x7A,0xF7,0xFC,0x67,0x86,0x69,0xE7,0x0A,0x94,0x40,0xBF,
-       0x8B,0x76,0xFE,0x26,0xD1,0xF2,0xA1,0x1A,0x84,0xA1,0x43,0x56,
-       0x28,0xBC,0x9A,0x5F,0xD7,0x3B,0x69,0x89,0x8A,0x36,0x2C,0x51,
-       0xDF,0x12,0x77,0x2F,0x57,0x7B,0xA0,0xAA,0xDD,0x7F,0xA1,0x62,
-       0x3B,0x40,0x7B,0x68,0x1A,0x8F,0x0D,0x38,0xBB,0x21,0x5D,0x18,
-       0xFC,0x0F,0x46,0xF7,0xA3,0xB0,0x1D,0x23,0xC3,0xD2,0xC7,0x72,
-       0x51,0x18,0xDF,0x46,0x95,0x79,0xD9,0xBD,0xB5,0x19,0x02,0x2C,
-       0x87,0xDC,0xE7,0x57,0x82,0x7E,0xF1,0x8B,0x06,0x3D,0x00,0xA5,
-       0x7B,0x6B,0x26,0x27,0x91,0x0F,0x6A,0x77,0xE4,0xD5,0x04,0xE4,
-       0x12,0x2C,0x42,0xFF,0xD2,0x88,0xBB,0xD3,0x92,0xA0,0xF9,0xC8,
-       0x51,0x64,0x14,0x5C,0xD8,0xF9,0x6C,0x47,0x82,0xB4,0x1C,0x7F,
-       0x09,0xB8,0xF0,0x25,0x83,0x1D,0x3F,0x3F,0x05,0xB3,0x21,0x0A,
-       0x5D,0xA7,0xD8,0x54,0xC3,0x65,0x7D,0xC3,0xB0,0x1D,0xBF,0xAE,
-       0xF8,0x68,0xCF,0x9B,
-       };
-static unsigned char dsa2048_q[]={
-       0x97,0xE7,0x33,0x4D,0xD3,0x94,0x3E,0x0B,0xDB,0x62,0x74,0xC6,
-       0xA1,0x08,0xDD,0x19,0xA3,0x75,0x17,0x1B,
-       };
-static unsigned char dsa2048_g[]={
-       0x2C,0x78,0x16,0x59,0x34,0x63,0xF4,0xF3,0x92,0xFC,0xB5,0xA5,
-       0x4F,0x13,0xDE,0x2F,0x1C,0xA4,0x3C,0xAE,0xAD,0x38,0x3F,0x7E,
-       0x90,0xBF,0x96,0xA6,0xAE,0x25,0x90,0x72,0xF5,0x8E,0x80,0x0C,
-       0x39,0x1C,0xD9,0xEC,0xBA,0x90,0x5B,0x3A,0xE8,0x58,0x6C,0x9E,
-       0x30,0x42,0x37,0x02,0x31,0x82,0xBC,0x6A,0xDF,0x6A,0x09,0x29,
-       0xE3,0xC0,0x46,0xD1,0xCB,0x85,0xEC,0x0C,0x30,0x5E,0xEA,0xC8,
-       0x39,0x8E,0x22,0x9F,0x22,0x10,0xD2,0x34,0x61,0x68,0x37,0x3D,
-       0x2E,0x4A,0x5B,0x9A,0xF5,0xC1,0x48,0xC6,0xF6,0xDC,0x63,0x1A,
-       0xD3,0x96,0x64,0xBA,0x34,0xC9,0xD1,0xA0,0xD1,0xAE,0x6C,0x2F,
-       0x48,0x17,0x93,0x14,0x43,0xED,0xF0,0x21,0x30,0x19,0xC3,0x1B,
-       0x5F,0xDE,0xA3,0xF0,0x70,0x78,0x18,0xE1,0xA8,0xE4,0xEE,0x2E,
-       0x00,0xA5,0xE4,0xB3,0x17,0xC8,0x0C,0x7D,0x6E,0x42,0xDC,0xB7,
-       0x46,0x00,0x36,0x4D,0xD4,0x46,0xAA,0x3D,0x3C,0x46,0x89,0x40,
-       0xBF,0x1D,0x84,0x77,0x0A,0x75,0xF3,0x87,0x1D,0x08,0x4C,0xA6,
-       0xD1,0xA9,0x1C,0x1E,0x12,0x1E,0xE1,0xC7,0x30,0x28,0x76,0xA5,
-       0x7F,0x6C,0x85,0x96,0x2B,0x6F,0xDB,0x80,0x66,0x26,0xAE,0xF5,
-       0x93,0xC7,0x8E,0xAE,0x9A,0xED,0xE4,0xCA,0x04,0xEA,0x3B,0x72,
-       0xEF,0xDC,0x87,0xED,0x0D,0xA5,0x4C,0x4A,0xDD,0x71,0x22,0x64,
-       0x59,0x69,0x4E,0x8E,0xBF,0x43,0xDC,0xAB,0x8E,0x66,0xBB,0x01,
-       0xB6,0xF4,0xE7,0xFD,0xD2,0xAD,0x9F,0x36,0xC1,0xA0,0x29,0x99,
-       0xD1,0x96,0x70,0x59,0x06,0x78,0x35,0xBD,0x65,0x55,0x52,0x9E,
-       0xF8,0xB2,0xE5,0x38,
-       };
-DSA *get_dsa2048()
-       {
-       DSA *dsa;
-       if ((dsa=DSA_new()) == NULL) return(NULL);
-       dsa->priv_key=BN_bin2bn(dsa2048_priv,sizeof(dsa2048_priv),NULL);
-       dsa->pub_key=BN_bin2bn(dsa2048_pub,sizeof(dsa2048_pub),NULL);
-       dsa->p=BN_bin2bn(dsa2048_p,sizeof(dsa2048_p),NULL);
-       dsa->q=BN_bin2bn(dsa2048_q,sizeof(dsa2048_q),NULL);
-       dsa->g=BN_bin2bn(dsa2048_g,sizeof(dsa2048_g),NULL);
-       if ((dsa->priv_key == NULL) || (dsa->pub_key == NULL) || (dsa->p == NULL) ||
-                               (dsa->q == NULL) || (dsa->g == NULL))
-               return(NULL);
-       return(dsa);
-       }
-
-static const char rnd_seed[] = "string to make the random number generator think it has entropy";
-static int rnd_fake = 0;
diff --git a/usr/skb/testapps/testrsa.h b/usr/skb/testapps/testrsa.h
deleted file mode 100644 (file)
index 3007d79..0000000
+++ /dev/null
@@ -1,518 +0,0 @@
-/* apps/testrsa.h */
-/* used by apps/speed.c */
-/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay@cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- * 
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to.  The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attribution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- * 
- * 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 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 the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *    "This product includes cryptographic software written by
- *     Eric Young (eay@cryptsoft.com)"
- *    The word 'cryptographic' can be left out if the rouines from the library
- *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
- *    the apps directory (application code) you must include an acknowledgement:
- *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS 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 AUTHOR OR 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.
- * 
- * The licence and distribution terms for any publically available version or
- * derivative of this code cannot be changed.  i.e. this code cannot simply be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-static unsigned char test512[]={
-       0x30,0x82,0x01,0x3a,0x02,0x01,0x00,0x02,0x41,0x00,
-       0xd6,0x33,0xb9,0xc8,0xfb,0x4f,0x3c,0x7d,0xc0,0x01,
-       0x86,0xd0,0xe7,0xa0,0x55,0xf2,0x95,0x93,0xcc,0x4f,
-       0xb7,0x5b,0x67,0x5b,0x94,0x68,0xc9,0x34,0x15,0xde,
-       0xa5,0x2e,0x1c,0x33,0xc2,0x6e,0xfc,0x34,0x5e,0x71,
-       0x13,0xb7,0xd6,0xee,0xd8,0xa5,0x65,0x05,0x72,0x87,
-       0xa8,0xb0,0x77,0xfe,0x57,0xf5,0xfc,0x5f,0x55,0x83,
-       0x87,0xdd,0x57,0x49,0x02,0x03,0x01,0x00,0x01,0x02,
-       0x41,0x00,0xa7,0xf7,0x91,0xc5,0x0f,0x84,0x57,0xdc,
-       0x07,0xf7,0x6a,0x7f,0x60,0x52,0xb3,0x72,0xf1,0x66,
-       0x1f,0x7d,0x97,0x3b,0x9e,0xb6,0x0a,0x8f,0x8c,0xcf,
-       0x42,0x23,0x00,0x04,0xd4,0x28,0x0e,0x1c,0x90,0xc4,
-       0x11,0x25,0x25,0xa5,0x93,0xa5,0x2f,0x70,0x02,0xdf,
-       0x81,0x9c,0x49,0x03,0xa0,0xf8,0x6d,0x54,0x2e,0x26,
-       0xde,0xaa,0x85,0x59,0xa8,0x31,0x02,0x21,0x00,0xeb,
-       0x47,0xd7,0x3b,0xf6,0xc3,0xdd,0x5a,0x46,0xc5,0xb9,
-       0x2b,0x9a,0xa0,0x09,0x8f,0xa6,0xfb,0xf3,0x78,0x7a,
-       0x33,0x70,0x9d,0x0f,0x42,0x6b,0x13,0x68,0x24,0xd3,
-       0x15,0x02,0x21,0x00,0xe9,0x10,0xb0,0xb3,0x0d,0xe2,
-       0x82,0x68,0x77,0x8a,0x6e,0x7c,0xda,0xbc,0x3e,0x53,
-       0x83,0xfb,0xd6,0x22,0xe7,0xb5,0xae,0x6e,0x80,0xda,
-       0x00,0x55,0x97,0xc1,0xd0,0x65,0x02,0x20,0x4c,0xf8,
-       0x73,0xb1,0x6a,0x49,0x29,0x61,0x1f,0x46,0x10,0x0d,
-       0xf3,0xc7,0xe7,0x58,0xd7,0x88,0x15,0x5e,0x94,0x9b,
-       0xbf,0x7b,0xa2,0x42,0x58,0x45,0x41,0x0c,0xcb,0x01,
-       0x02,0x20,0x12,0x11,0xba,0x31,0x57,0x9d,0x3d,0x11,
-       0x0e,0x5b,0x8c,0x2f,0x5f,0xe2,0x02,0x4f,0x05,0x47,
-       0x8c,0x15,0x8e,0xb3,0x56,0x3f,0xb8,0xfb,0xad,0xd4,
-       0xf4,0xfc,0x10,0xc5,0x02,0x20,0x18,0xa1,0x29,0x99,
-       0x5b,0xd9,0xc8,0xd4,0xfc,0x49,0x7a,0x2a,0x21,0x2c,
-       0x49,0xe4,0x4f,0xeb,0xef,0x51,0xf1,0xab,0x6d,0xfb,
-       0x4b,0x14,0xe9,0x4b,0x52,0xb5,0x82,0x2c,
-       };
-
-static unsigned char test1024[]={
-       0x30,0x82,0x02,0x5c,0x02,0x01,0x00,0x02,0x81,0x81,
-       0x00,0xdc,0x98,0x43,0xe8,0x3d,0x43,0x5b,0xe4,0x05,
-       0xcd,0xd0,0xa9,0x3e,0xcb,0x83,0x75,0xf6,0xb5,0xa5,
-       0x9f,0x6b,0xe9,0x34,0x41,0x29,0x18,0xfa,0x6a,0x55,
-       0x4d,0x70,0xfc,0xec,0xae,0x87,0x38,0x0a,0x20,0xa9,
-       0xc0,0x45,0x77,0x6e,0x57,0x60,0x57,0xf4,0xed,0x96,
-       0x22,0xcb,0x8f,0xe1,0x33,0x3a,0x17,0x1f,0xed,0x37,
-       0xa5,0x6f,0xeb,0xa6,0xbc,0x12,0x80,0x1d,0x53,0xbd,
-       0x70,0xeb,0x21,0x76,0x3e,0xc9,0x2f,0x1a,0x45,0x24,
-       0x82,0xff,0xcd,0x59,0x32,0x06,0x2e,0x12,0x3b,0x23,
-       0x78,0xed,0x12,0x3d,0xe0,0x8d,0xf9,0x67,0x4f,0x37,
-       0x4e,0x47,0x02,0x4c,0x2d,0xc0,0x4f,0x1f,0xb3,0x94,
-       0xe1,0x41,0x2e,0x2d,0x90,0x10,0xfc,0x82,0x91,0x8b,
-       0x0f,0x22,0xd4,0xf2,0xfc,0x2c,0xab,0x53,0x55,0x02,
-       0x03,0x01,0x00,0x01,0x02,0x81,0x80,0x2b,0xcc,0x3f,
-       0x8f,0x58,0xba,0x8b,0x00,0x16,0xf6,0xea,0x3a,0xf0,
-       0x30,0xd0,0x05,0x17,0xda,0xb0,0xeb,0x9a,0x2d,0x4f,
-       0x26,0xb0,0xd6,0x38,0xc1,0xeb,0xf5,0xd8,0x3d,0x1f,
-       0x70,0xf7,0x7f,0xf4,0xe2,0xcf,0x51,0x51,0x79,0x88,
-       0xfa,0xe8,0x32,0x0e,0x7b,0x2d,0x97,0xf2,0xfa,0xba,
-       0x27,0xc5,0x9c,0xd9,0xc5,0xeb,0x8a,0x79,0x52,0x3c,
-       0x64,0x34,0x7d,0xc2,0xcf,0x28,0xc7,0x4e,0xd5,0x43,
-       0x0b,0xd1,0xa6,0xca,0x6d,0x03,0x2d,0x72,0x23,0xbc,
-       0x6d,0x05,0xfa,0x16,0x09,0x2f,0x2e,0x5c,0xb6,0xee,
-       0x74,0xdd,0xd2,0x48,0x8e,0x36,0x0c,0x06,0x3d,0x4d,
-       0xe5,0x10,0x82,0xeb,0x6a,0xf3,0x4b,0x9f,0xd6,0xed,
-       0x11,0xb1,0x6e,0xec,0xf4,0xfe,0x8e,0x75,0x94,0x20,
-       0x2f,0xcb,0xac,0x46,0xf1,0x02,0x41,0x00,0xf9,0x8c,
-       0xa3,0x85,0xb1,0xdd,0x29,0xaf,0x65,0xc1,0x33,0xf3,
-       0x95,0xc5,0x52,0x68,0x0b,0xd4,0xf1,0xe5,0x0e,0x02,
-       0x9f,0x4f,0xfa,0x77,0xdc,0x46,0x9e,0xc7,0xa6,0xe4,
-       0x16,0x29,0xda,0xb0,0x07,0xcf,0x5b,0xa9,0x12,0x8a,
-       0xdd,0x63,0x0a,0xde,0x2e,0x8c,0x66,0x8b,0x8c,0xdc,
-       0x19,0xa3,0x7e,0xf4,0x3b,0xd0,0x1a,0x8c,0xa4,0xc2,
-       0xe1,0xd3,0x02,0x41,0x00,0xe2,0x4c,0x05,0xf2,0x04,
-       0x86,0x4e,0x61,0x43,0xdb,0xb0,0xb9,0x96,0x86,0x52,
-       0x2c,0xca,0x8d,0x7b,0xab,0x0b,0x13,0x0d,0x7e,0x38,
-       0x5b,0xe2,0x2e,0x7b,0x0e,0xe7,0x19,0x99,0x38,0xe7,
-       0xf2,0x21,0xbd,0x85,0x85,0xe3,0xfd,0x28,0x77,0x20,
-       0x31,0x71,0x2c,0xd0,0xff,0xfb,0x2e,0xaf,0x85,0xb4,
-       0x86,0xca,0xf3,0xbb,0xca,0xaa,0x0f,0x95,0x37,0x02,
-       0x40,0x0e,0x41,0x9a,0x95,0xe8,0xb3,0x59,0xce,0x4b,
-       0x61,0xde,0x35,0xec,0x38,0x79,0x9c,0xb8,0x10,0x52,
-       0x41,0x63,0xab,0x82,0xae,0x6f,0x00,0xa9,0xf4,0xde,
-       0xdd,0x49,0x0b,0x7e,0xb8,0xa5,0x65,0xa9,0x0c,0x8f,
-       0x8f,0xf9,0x1f,0x35,0xc6,0x92,0xb8,0x5e,0xb0,0x66,
-       0xab,0x52,0x40,0xc0,0xb6,0x36,0x6a,0x7d,0x80,0x46,
-       0x04,0x02,0xe5,0x9f,0x41,0x02,0x41,0x00,0xc0,0xad,
-       0xcc,0x4e,0x21,0xee,0x1d,0x24,0x91,0xfb,0xa7,0x80,
-       0x8d,0x9a,0xb6,0xb3,0x2e,0x8f,0xc2,0xe1,0x82,0xdf,
-       0x69,0x18,0xb4,0x71,0xff,0xa6,0x65,0xde,0xed,0x84,
-       0x8d,0x42,0xb7,0xb3,0x21,0x69,0x56,0x1c,0x07,0x60,
-       0x51,0x29,0x04,0xff,0x34,0x06,0xdd,0xb9,0x67,0x2c,
-       0x7c,0x04,0x93,0x0e,0x46,0x15,0xbb,0x2a,0xb7,0x1b,
-       0xe7,0x87,0x02,0x40,0x78,0xda,0x5d,0x07,0x51,0x0c,
-       0x16,0x7a,0x9f,0x29,0x20,0x84,0x0d,0x42,0xfa,0xd7,
-       0x00,0xd8,0x77,0x7e,0xb0,0xb0,0x6b,0xd6,0x5b,0x53,
-       0xb8,0x9b,0x7a,0xcd,0xc7,0x2b,0xb8,0x6a,0x63,0xa9,
-       0xfb,0x6f,0xa4,0x72,0xbf,0x4c,0x5d,0x00,0x14,0xba,
-       0xfa,0x59,0x88,0xed,0xe4,0xe0,0x8c,0xa2,0xec,0x14,
-       0x7e,0x2d,0xe2,0xf0,0x46,0x49,0x95,0x45,
-       };
-
-static unsigned char test2048[]={
-       0x30,0x82,0x04,0xa3,0x02,0x01,0x00,0x02,0x82,0x01,
-       0x01,0x00,0xc0,0xc0,0xce,0x3e,0x3c,0x53,0x67,0x3f,
-       0x4f,0xc5,0x2f,0xa4,0xc2,0x5a,0x2f,0x58,0xfd,0x27,
-       0x52,0x6a,0xe8,0xcf,0x4a,0x73,0x47,0x8d,0x25,0x0f,
-       0x5f,0x03,0x26,0x78,0xef,0xf0,0x22,0x12,0xd3,0xde,
-       0x47,0xb2,0x1c,0x0b,0x38,0x63,0x1a,0x6c,0x85,0x7a,
-       0x80,0xc6,0x8f,0xa0,0x41,0xaf,0x62,0xc4,0x67,0x32,
-       0x88,0xf8,0xa6,0x9c,0xf5,0x23,0x1d,0xe4,0xac,0x3f,
-       0x29,0xf9,0xec,0xe1,0x8b,0x26,0x03,0x2c,0xb2,0xab,
-       0xf3,0x7d,0xb5,0xca,0x49,0xc0,0x8f,0x1c,0xdf,0x33,
-       0x3a,0x60,0xda,0x3c,0xb0,0x16,0xf8,0xa9,0x12,0x8f,
-       0x64,0xac,0x23,0x0c,0x69,0x64,0x97,0x5d,0x99,0xd4,
-       0x09,0x83,0x9b,0x61,0xd3,0xac,0xf0,0xde,0xdd,0x5e,
-       0x9f,0x44,0x94,0xdb,0x3a,0x4d,0x97,0xe8,0x52,0x29,
-       0xf7,0xdb,0x94,0x07,0x45,0x90,0x78,0x1e,0x31,0x0b,
-       0x80,0xf7,0x57,0xad,0x1c,0x79,0xc5,0xcb,0x32,0xb0,
-       0xce,0xcd,0x74,0xb3,0xe2,0x94,0xc5,0x78,0x2f,0x34,
-       0x1a,0x45,0xf7,0x8c,0x52,0xa5,0xbc,0x8d,0xec,0xd1,
-       0x2f,0x31,0x3b,0xf0,0x49,0x59,0x5e,0x88,0x9d,0x15,
-       0x92,0x35,0x32,0xc1,0xe7,0x61,0xec,0x50,0x48,0x7c,
-       0xba,0x05,0xf9,0xf8,0xf8,0xa7,0x8c,0x83,0xe8,0x66,
-       0x5b,0xeb,0xfe,0xd8,0x4f,0xdd,0x6d,0x36,0xc0,0xb2,
-       0x90,0x0f,0xb8,0x52,0xf9,0x04,0x9b,0x40,0x2c,0x27,
-       0xd6,0x36,0x8e,0xc2,0x1b,0x44,0xf3,0x92,0xd5,0x15,
-       0x9e,0x9a,0xbc,0xf3,0x7d,0x03,0xd7,0x02,0x14,0x20,
-       0xe9,0x10,0x92,0xfd,0xf9,0xfc,0x8f,0xe5,0x18,0xe1,
-       0x95,0xcc,0x9e,0x60,0xa6,0xfa,0x38,0x4d,0x02,0x03,
-       0x01,0x00,0x01,0x02,0x82,0x01,0x00,0x00,0xc3,0xc3,
-       0x0d,0xb4,0x27,0x90,0x8d,0x4b,0xbf,0xb8,0x84,0xaa,
-       0xd0,0xb8,0xc7,0x5d,0x99,0xbe,0x55,0xf6,0x3e,0x7c,
-       0x49,0x20,0xcb,0x8a,0x8e,0x19,0x0e,0x66,0x24,0xac,
-       0xaf,0x03,0x33,0x97,0xeb,0x95,0xd5,0x3b,0x0f,0x40,
-       0x56,0x04,0x50,0xd1,0xe6,0xbe,0x84,0x0b,0x25,0xd3,
-       0x9c,0xe2,0x83,0x6c,0xf5,0x62,0x5d,0xba,0x2b,0x7d,
-       0x3d,0x7a,0x6c,0xe1,0xd2,0x0e,0x54,0x93,0x80,0x01,
-       0x91,0x51,0x09,0xe8,0x5b,0x8e,0x47,0xbd,0x64,0xe4,
-       0x0e,0x03,0x83,0x55,0xcf,0x5a,0x37,0xf0,0x25,0xb5,
-       0x7d,0x21,0xd7,0x69,0xdf,0x6f,0xc2,0xcf,0x10,0xc9,
-       0x8a,0x40,0x9f,0x7a,0x70,0xc0,0xe8,0xe8,0xc0,0xe6,
-       0x9a,0x15,0x0a,0x8d,0x4e,0x46,0xcb,0x7a,0xdb,0xb3,
-       0xcb,0x83,0x02,0xc4,0xf0,0xab,0xeb,0x02,0x01,0x0e,
-       0x23,0xfc,0x1d,0xc4,0xbd,0xd4,0xaa,0x5d,0x31,0x46,
-       0x99,0xce,0x9e,0xf8,0x04,0x75,0x10,0x67,0xc4,0x53,
-       0x47,0x44,0xfa,0xc2,0x25,0x73,0x7e,0xd0,0x8e,0x59,
-       0xd1,0xb2,0x5a,0xf4,0xc7,0x18,0x92,0x2f,0x39,0xab,
-       0xcd,0xa3,0xb5,0xc2,0xb9,0xc7,0xb9,0x1b,0x9f,0x48,
-       0xfa,0x13,0xc6,0x98,0x4d,0xca,0x84,0x9c,0x06,0xca,
-       0xe7,0x89,0x01,0x04,0xc4,0x6c,0xfd,0x29,0x59,0x35,
-       0xe7,0xf3,0xdd,0xce,0x64,0x59,0xbf,0x21,0x13,0xa9,
-       0x9f,0x0e,0xc5,0xff,0xbd,0x33,0x00,0xec,0xac,0x6b,
-       0x11,0xef,0x51,0x5e,0xad,0x07,0x15,0xde,0xb8,0x5f,
-       0xc6,0xb9,0xa3,0x22,0x65,0x46,0x83,0x14,0xdf,0xd0,
-       0xf1,0x44,0x8a,0xe1,0x9c,0x23,0x33,0xb4,0x97,0x33,
-       0xe6,0x6b,0x81,0x02,0x81,0x81,0x00,0xec,0x12,0xa7,
-       0x59,0x74,0x6a,0xde,0x3e,0xad,0xd8,0x36,0x80,0x50,
-       0xa2,0xd5,0x21,0x81,0x07,0xf1,0xd0,0x91,0xf2,0x6c,
-       0x12,0x2f,0x9d,0x1a,0x26,0xf8,0x30,0x65,0xdf,0xe8,
-       0xc0,0x9b,0x6a,0x30,0x98,0x82,0x87,0xec,0xa2,0x56,
-       0x87,0x62,0x6f,0xe7,0x9f,0xf6,0x56,0xe6,0x71,0x8f,
-       0x49,0x86,0x93,0x5a,0x4d,0x34,0x58,0xfe,0xd9,0x04,
-       0x13,0xaf,0x79,0xb7,0xad,0x11,0xd1,0x30,0x9a,0x14,
-       0x06,0xa0,0xfa,0xb7,0x55,0xdc,0x6c,0x5a,0x4c,0x2c,
-       0x59,0x56,0xf6,0xe8,0x9d,0xaf,0x0a,0x78,0x99,0x06,
-       0x06,0x9e,0xe7,0x9c,0x51,0x55,0x43,0xfc,0x3b,0x6c,
-       0x0b,0xbf,0x2d,0x41,0xa7,0xaf,0xb7,0xe0,0xe8,0x28,
-       0x18,0xb4,0x13,0xd1,0xe6,0x97,0xd0,0x9f,0x6a,0x80,
-       0xca,0xdd,0x1a,0x7e,0x15,0x02,0x81,0x81,0x00,0xd1,
-       0x06,0x0c,0x1f,0xe3,0xd0,0xab,0xd6,0xca,0x7c,0xbc,
-       0x7d,0x13,0x35,0xce,0x27,0xcd,0xd8,0x49,0x51,0x63,
-       0x64,0x0f,0xca,0x06,0x12,0xfc,0x07,0x3e,0xaf,0x61,
-       0x6d,0xe2,0x53,0x39,0x27,0xae,0xc3,0x11,0x9e,0x94,
-       0x01,0x4f,0xe3,0xf3,0x67,0xf9,0x77,0xf9,0xe7,0x95,
-       0x3a,0x6f,0xe2,0x20,0x73,0x3e,0xa4,0x7a,0x28,0xd4,
-       0x61,0x97,0xf6,0x17,0xa0,0x23,0x10,0x2b,0xce,0x84,
-       0x57,0x7e,0x25,0x1f,0xf4,0xa8,0x54,0xd2,0x65,0x94,
-       0xcc,0x95,0x0a,0xab,0x30,0xc1,0x59,0x1f,0x61,0x8e,
-       0xb9,0x6b,0xd7,0x4e,0xb9,0x83,0x43,0x79,0x85,0x11,
-       0xbc,0x0f,0xae,0x25,0x20,0x05,0xbc,0xd2,0x48,0xa1,
-       0x68,0x09,0x84,0xf6,0x12,0x9a,0x66,0xb9,0x2b,0xbb,
-       0x76,0x03,0x17,0x46,0x4e,0x97,0x59,0x02,0x81,0x80,
-       0x09,0x4c,0xfa,0xd6,0xe5,0x65,0x48,0x78,0x43,0xb5,
-       0x1f,0x00,0x93,0x2c,0xb7,0x24,0xe8,0xc6,0x7d,0x5a,
-       0x70,0x45,0x92,0xc8,0x6c,0xa3,0xcd,0xe1,0xf7,0x29,
-       0x40,0xfa,0x3f,0x5b,0x47,0x44,0x39,0xc1,0xe8,0x72,
-       0x9e,0x7a,0x0e,0xda,0xaa,0xa0,0x2a,0x09,0xfd,0x54,
-       0x93,0x23,0xaa,0x37,0x85,0x5b,0xcc,0xd4,0xf9,0xd8,
-       0xff,0xc1,0x61,0x0d,0xbd,0x7e,0x18,0x24,0x73,0x6d,
-       0x40,0x72,0xf1,0x93,0x09,0x48,0x97,0x6c,0x84,0x90,
-       0xa8,0x46,0x14,0x01,0x39,0x11,0xe5,0x3c,0x41,0x27,
-       0x32,0x75,0x24,0xed,0xa1,0xd9,0x12,0x29,0x8a,0x28,
-       0x71,0x89,0x8d,0xca,0x30,0xb0,0x01,0xc4,0x2f,0x82,
-       0x19,0x14,0x4c,0x70,0x1c,0xb8,0x23,0x2e,0xe8,0x90,
-       0x49,0x97,0x92,0x97,0x6b,0x7a,0x9d,0xb9,0x02,0x81,
-       0x80,0x0f,0x0e,0xa1,0x76,0xf6,0xa1,0x44,0x8f,0xaf,
-       0x7c,0x76,0xd3,0x87,0xbb,0xbb,0x83,0x10,0x88,0x01,
-       0x18,0x14,0xd1,0xd3,0x75,0x59,0x24,0xaa,0xf5,0x16,
-       0xa5,0xe9,0x9d,0xd1,0xcc,0xee,0xf4,0x15,0xd9,0xc5,
-       0x7e,0x27,0xe9,0x44,0x49,0x06,0x72,0xb9,0xfc,0xd3,
-       0x8a,0xc4,0x2c,0x36,0x7d,0x12,0x9b,0x5a,0xaa,0xdc,
-       0x85,0xee,0x6e,0xad,0x54,0xb3,0xf4,0xfc,0x31,0xa1,
-       0x06,0x3a,0x70,0x57,0x0c,0xf3,0x95,0x5b,0x3e,0xe8,
-       0xfd,0x1a,0x4f,0xf6,0x78,0x93,0x46,0x6a,0xd7,0x31,
-       0xb4,0x84,0x64,0x85,0x09,0x38,0x89,0x92,0x94,0x1c,
-       0xbf,0xe2,0x3c,0x2a,0xe0,0xff,0x99,0xa3,0xf0,0x2b,
-       0x31,0xc2,0x36,0xcd,0x60,0xbf,0x9d,0x2d,0x74,0x32,
-       0xe8,0x9c,0x93,0x6e,0xbb,0x91,0x7b,0xfd,0xd9,0x02,
-       0x81,0x81,0x00,0xa2,0x71,0x25,0x38,0xeb,0x2a,0xe9,
-       0x37,0xcd,0xfe,0x44,0xce,0x90,0x3f,0x52,0x87,0x84,
-       0x52,0x1b,0xae,0x8d,0x22,0x94,0xce,0x38,0xe6,0x04,
-       0x88,0x76,0x85,0x9a,0xd3,0x14,0x09,0xe5,0x69,0x9a,
-       0xff,0x58,0x92,0x02,0x6a,0x7d,0x7c,0x1e,0x2c,0xfd,
-       0xa8,0xca,0x32,0x14,0x4f,0x0d,0x84,0x0d,0x37,0x43,
-       0xbf,0xe4,0x5d,0x12,0xc8,0x24,0x91,0x27,0x8d,0x46,
-       0xd9,0x54,0x53,0xe7,0x62,0x71,0xa8,0x2b,0x71,0x41,
-       0x8d,0x75,0xf8,0x3a,0xa0,0x61,0x29,0x46,0xa6,0xe5,
-       0x82,0xfa,0x3a,0xd9,0x08,0xfa,0xfc,0x63,0xfd,0x6b,
-       0x30,0xbc,0xf4,0x4e,0x9e,0x8c,0x25,0x0c,0xb6,0x55,
-       0xe7,0x3c,0xd4,0x4e,0x0b,0xfd,0x8b,0xc3,0x0e,0x1d,
-       0x9c,0x44,0x57,0x8f,0x1f,0x86,0xf7,0xd5,0x1b,0xe4,
-       0x95,
-       };
-
-static unsigned char test4096[]={
-       0x30,0x82,0x09,0x29,0x02,0x01,0x00,0x02,0x82,0x02,
-       0x01,0x00,0xc0,0x71,0xac,0x1a,0x13,0x88,0x82,0x43,
-       0x3b,0x51,0x57,0x71,0x8d,0xb6,0x2b,0x82,0x65,0x21,
-       0x53,0x5f,0x28,0x29,0x4f,0x8d,0x7c,0x8a,0xb9,0x44,
-       0xb3,0x28,0x41,0x4f,0xd3,0xfa,0x6a,0xf8,0xb9,0x28,
-       0x50,0x39,0x67,0x53,0x2c,0x3c,0xd7,0xcb,0x96,0x41,
-       0x40,0x32,0xbb,0xeb,0x70,0xae,0x1f,0xb0,0x65,0xf7,
-       0x3a,0xd9,0x22,0xfd,0x10,0xae,0xbd,0x02,0xe2,0xdd,
-       0xf3,0xc2,0x79,0x3c,0xc6,0xfc,0x75,0xbb,0xaf,0x4e,
-       0x3a,0x36,0xc2,0x4f,0xea,0x25,0xdf,0x13,0x16,0x4b,
-       0x20,0xfe,0x4b,0x69,0x16,0xc4,0x7f,0x1a,0x43,0xa6,
-       0x17,0x1b,0xb9,0x0a,0xf3,0x09,0x86,0x28,0x89,0xcf,
-       0x2c,0xd0,0xd4,0x81,0xaf,0xc6,0x6d,0xe6,0x21,0x8d,
-       0xee,0xef,0xea,0xdc,0xb7,0xc6,0x3b,0x63,0x9f,0x0e,
-       0xad,0x89,0x78,0x23,0x18,0xbf,0x70,0x7e,0x84,0xe0,
-       0x37,0xec,0xdb,0x8e,0x9c,0x3e,0x6a,0x19,0xcc,0x99,
-       0x72,0xe6,0xb5,0x7d,0x6d,0xfa,0xe5,0xd3,0xe4,0x90,
-       0xb5,0xb2,0xb2,0x12,0x70,0x4e,0xca,0xf8,0x10,0xf8,
-       0xa3,0x14,0xc2,0x48,0x19,0xeb,0x60,0x99,0xbb,0x2a,
-       0x1f,0xb1,0x7a,0xb1,0x3d,0x24,0xfb,0xa0,0x29,0xda,
-       0xbd,0x1b,0xd7,0xa4,0xbf,0xef,0x60,0x2d,0x22,0xca,
-       0x65,0x98,0xf1,0xc4,0xe1,0xc9,0x02,0x6b,0x16,0x28,
-       0x2f,0xa1,0xaa,0x79,0x00,0xda,0xdc,0x7c,0x43,0xf7,
-       0x42,0x3c,0xa0,0xef,0x68,0xf7,0xdf,0xb9,0x69,0xfb,
-       0x8e,0x01,0xed,0x01,0x42,0xb5,0x4e,0x57,0xa6,0x26,
-       0xb8,0xd0,0x7b,0x56,0x6d,0x03,0xc6,0x40,0x8c,0x8c,
-       0x2a,0x55,0xd7,0x9c,0x35,0x00,0x94,0x93,0xec,0x03,
-       0xeb,0x22,0xef,0x77,0xbb,0x79,0x13,0x3f,0x15,0xa1,
-       0x8f,0xca,0xdf,0xfd,0xd3,0xb8,0xe1,0xd4,0xcc,0x09,
-       0x3f,0x3c,0x2c,0xdb,0xd1,0x49,0x7f,0x38,0x07,0x83,
-       0x6d,0xeb,0x08,0x66,0xe9,0x06,0x44,0x12,0xac,0x95,
-       0x22,0x90,0x23,0x67,0xd4,0x08,0xcc,0xf4,0xb7,0xdc,
-       0xcc,0x87,0xd4,0xac,0x69,0x35,0x4c,0xb5,0x39,0x36,
-       0xcd,0xa4,0xd2,0x95,0xca,0x0d,0xc5,0xda,0xc2,0xc5,
-       0x22,0x32,0x28,0x08,0xe3,0xd2,0x8b,0x38,0x30,0xdc,
-       0x8c,0x75,0x4f,0x6a,0xec,0x7a,0xac,0x16,0x3e,0xa8,
-       0xd4,0x6a,0x45,0xe1,0xa8,0x4f,0x2e,0x80,0x34,0xaa,
-       0x54,0x1b,0x02,0x95,0x7d,0x8a,0x6d,0xcc,0x79,0xca,
-       0xf2,0xa4,0x2e,0x8d,0xfb,0xfe,0x15,0x51,0x10,0x0e,
-       0x4d,0x88,0xb1,0xc7,0xf4,0x79,0xdb,0xf0,0xb4,0x56,
-       0x44,0x37,0xca,0x5a,0xc1,0x8c,0x48,0xac,0xae,0x48,
-       0x80,0x83,0x01,0x3f,0xde,0xd9,0xd3,0x2c,0x51,0x46,
-       0xb1,0x41,0xb6,0xc6,0x91,0x72,0xf9,0x83,0x55,0x1b,
-       0x8c,0xba,0xf3,0x73,0xe5,0x2c,0x74,0x50,0x3a,0xbe,
-       0xc5,0x2f,0xa7,0xb2,0x6d,0x8c,0x9e,0x13,0x77,0xa3,
-       0x13,0xcd,0x6d,0x8c,0x45,0xe1,0xfc,0x0b,0xb7,0x69,
-       0xe9,0x27,0xbc,0x65,0xc3,0xfa,0x9b,0xd0,0xef,0xfe,
-       0xe8,0x1f,0xb3,0x5e,0x34,0xf4,0x8c,0xea,0xfc,0xd3,
-       0x81,0xbf,0x3d,0x30,0xb2,0xb4,0x01,0xe8,0x43,0x0f,
-       0xba,0x02,0x23,0x42,0x76,0x82,0x31,0x73,0x91,0xed,
-       0x07,0x46,0x61,0x0d,0x39,0x83,0x40,0xce,0x7a,0xd4,
-       0xdb,0x80,0x2c,0x1f,0x0d,0xd1,0x34,0xd4,0x92,0xe3,
-       0xd4,0xf1,0xc2,0x01,0x02,0x03,0x01,0x00,0x01,0x02,
-       0x82,0x02,0x01,0x00,0x97,0x6c,0xda,0x6e,0xea,0x4f,
-       0xcf,0xaf,0xf7,0x4c,0xd9,0xf1,0x90,0x00,0x77,0xdb,
-       0xf2,0x97,0x76,0x72,0xb9,0xb7,0x47,0xd1,0x9c,0xdd,
-       0xcb,0x4a,0x33,0x6e,0xc9,0x75,0x76,0xe6,0xe4,0xa5,
-       0x31,0x8c,0x77,0x13,0xb4,0x29,0xcd,0xf5,0x52,0x17,
-       0xef,0xf3,0x08,0x00,0xe3,0xbd,0x2e,0xbc,0xd4,0x52,
-       0x88,0xe9,0x30,0x75,0x0b,0x02,0xf5,0xcd,0x89,0x0c,
-       0x6c,0x57,0x19,0x27,0x3d,0x1e,0x85,0xb4,0xc1,0x2f,
-       0x1d,0x92,0x00,0x5c,0x76,0x29,0x4b,0xa4,0xe1,0x12,
-       0xb3,0xc8,0x09,0xfe,0x0e,0x78,0x72,0x61,0xcb,0x61,
-       0x6f,0x39,0x91,0x95,0x4e,0xd5,0x3e,0xc7,0x8f,0xb8,
-       0xf6,0x36,0xfe,0x9c,0x93,0x9a,0x38,0x25,0x7a,0xf4,
-       0x4a,0x12,0xd4,0xa0,0x13,0xbd,0xf9,0x1d,0x12,0x3e,
-       0x21,0x39,0xfb,0x72,0xe0,0x05,0x3d,0xc3,0xe5,0x50,
-       0xa8,0x5d,0x85,0xa3,0xea,0x5f,0x1c,0xb2,0x3f,0xea,
-       0x6d,0x03,0x91,0x55,0xd8,0x19,0x0a,0x21,0x12,0x16,
-       0xd9,0x12,0xc4,0xe6,0x07,0x18,0x5b,0x26,0xa4,0xae,
-       0xed,0x2b,0xb7,0xa6,0xed,0xf8,0xad,0xec,0x77,0xe6,
-       0x7f,0x4f,0x76,0x00,0xc0,0xfa,0x15,0x92,0xb4,0x2c,
-       0x22,0xc2,0xeb,0x6a,0xad,0x14,0x05,0xb2,0xe5,0x8a,
-       0x9e,0x85,0x83,0xcc,0x04,0xf1,0x56,0x78,0x44,0x5e,
-       0xde,0xe0,0x60,0x1a,0x65,0x79,0x31,0x23,0x05,0xbb,
-       0x01,0xff,0xdd,0x2e,0xb7,0xb3,0xaa,0x74,0xe0,0xa5,
-       0x94,0xaf,0x4b,0xde,0x58,0x0f,0x55,0xde,0x33,0xf6,
-       0xe3,0xd6,0x34,0x36,0x57,0xd6,0x79,0x91,0x2e,0xbe,
-       0x3b,0xd9,0x4e,0xb6,0x9d,0x21,0x5c,0xd3,0x48,0x14,
-       0x7f,0x4a,0xc4,0x60,0xa9,0x29,0xf8,0x53,0x7f,0x88,
-       0x11,0x2d,0xb5,0xc5,0x2d,0x6f,0xee,0x85,0x0b,0xf7,
-       0x8d,0x9a,0xbe,0xb0,0x42,0xf2,0x2e,0x71,0xaf,0x19,
-       0x31,0x6d,0xec,0xcd,0x6f,0x2b,0x23,0xdf,0xb4,0x40,
-       0xaf,0x2c,0x0a,0xc3,0x1b,0x7d,0x7d,0x03,0x1d,0x4b,
-       0xf3,0xb5,0xe0,0x85,0xd8,0xdf,0x91,0x6b,0x0a,0x69,
-       0xf7,0xf2,0x69,0x66,0x5b,0xf1,0xcf,0x46,0x7d,0xe9,
-       0x70,0xfa,0x6d,0x7e,0x75,0x4e,0xa9,0x77,0xe6,0x8c,
-       0x02,0xf7,0x14,0x4d,0xa5,0x41,0x8f,0x3f,0xc1,0x62,
-       0x1e,0x71,0x5e,0x38,0xb4,0xd6,0xe6,0xe1,0x4b,0xc2,
-       0x2c,0x30,0x83,0x81,0x6f,0x49,0x2e,0x96,0xe6,0xc9,
-       0x9a,0xf7,0x5d,0x09,0xa0,0x55,0x02,0xa5,0x3a,0x25,
-       0x23,0xd0,0x92,0xc3,0xa3,0xe3,0x0e,0x12,0x2f,0x4d,
-       0xef,0xf3,0x55,0x5a,0xbe,0xe6,0x19,0x86,0x31,0xab,
-       0x75,0x9a,0xd3,0xf0,0x2c,0xc5,0x41,0x92,0xd9,0x1f,
-       0x5f,0x11,0x8c,0x75,0x1c,0x63,0xd0,0x02,0x80,0x2c,
-       0x68,0xcb,0x93,0xfb,0x51,0x73,0x49,0xb4,0x60,0xda,
-       0xe2,0x26,0xaf,0xa9,0x46,0x12,0xb8,0xec,0x50,0xdd,
-       0x12,0x06,0x5f,0xce,0x59,0xe6,0xf6,0x1c,0xe0,0x54,
-       0x10,0xad,0xf6,0xcd,0x98,0xcc,0x0f,0xfb,0xcb,0x41,
-       0x14,0x9d,0xed,0xe4,0xb4,0x74,0x5f,0x09,0x60,0xc7,
-       0x12,0xf6,0x7b,0x3c,0x8f,0xa7,0x20,0xbc,0xe4,0xb1,
-       0xef,0xeb,0xa4,0x93,0xc5,0x06,0xca,0x9a,0x27,0x9d,
-       0x87,0xf3,0xde,0xca,0xe5,0xe7,0xf6,0x1c,0x01,0x65,
-       0x5b,0xfb,0x19,0x79,0x6e,0x08,0x26,0xc5,0xc8,0x28,
-       0x0e,0xb6,0x3b,0x07,0x08,0xc1,0x02,0x82,0x01,0x01,
-       0x00,0xe8,0x1c,0x73,0xa6,0xb8,0xe0,0x0e,0x6d,0x8d,
-       0x1b,0xb9,0x53,0xed,0x58,0x94,0xe6,0x1d,0x60,0x14,
-       0x5c,0x76,0x43,0xc4,0x58,0x19,0xc4,0x24,0xe8,0xbc,
-       0x1b,0x3b,0x0b,0x13,0x24,0x45,0x54,0x0e,0xcc,0x37,
-       0xf0,0xe0,0x63,0x7d,0xc3,0xf7,0xfb,0x81,0x74,0x81,
-       0xc4,0x0f,0x1a,0x21,0x48,0xaf,0xce,0xc1,0xc4,0x94,
-       0x18,0x06,0x44,0x8d,0xd3,0xd2,0x22,0x2d,0x2d,0x3e,
-       0x5a,0x31,0xdc,0x95,0x8e,0xf4,0x41,0xfc,0x58,0xc9,
-       0x40,0x92,0x17,0x5f,0xe3,0xda,0xac,0x9e,0x3f,0x1c,
-       0x2a,0x6b,0x58,0x5f,0x48,0x78,0x20,0xb1,0xaf,0x24,
-       0x9b,0x3c,0x20,0x8b,0x93,0x25,0x9e,0xe6,0x6b,0xbc,
-       0x13,0x42,0x14,0x6c,0x36,0x31,0xff,0x7a,0xd1,0xc1,
-       0x1a,0x26,0x14,0x7f,0xa9,0x76,0xa7,0x0c,0xf8,0xcc,
-       0xed,0x07,0x6a,0xd2,0xdf,0x62,0xee,0x0a,0x7c,0x84,
-       0xcb,0x49,0x90,0xb2,0x03,0x0d,0xa2,0x82,0x06,0x77,
-       0xf1,0xcd,0x67,0xf2,0x47,0x21,0x02,0x3f,0x43,0x21,
-       0xf0,0x46,0x30,0x62,0x51,0x72,0xb1,0xe7,0x48,0xc6,
-       0x67,0x12,0xcd,0x9e,0xd6,0x15,0xe5,0x21,0xed,0xfa,
-       0x8f,0x30,0xa6,0x41,0xfe,0xb6,0xfa,0x8f,0x34,0x14,
-       0x19,0xe8,0x11,0xf7,0xa5,0x77,0x3e,0xb7,0xf9,0x39,
-       0x07,0x8c,0x67,0x2a,0xab,0x7b,0x08,0xf8,0xb0,0x06,
-       0xa8,0xea,0x2f,0x8f,0xfa,0xcc,0xcc,0x40,0xce,0xf3,
-       0x70,0x4f,0x3f,0x7f,0xe2,0x0c,0xea,0x76,0x4a,0x35,
-       0x4e,0x47,0xad,0x2b,0xa7,0x97,0x5d,0x74,0x43,0x97,
-       0x90,0xd2,0xfb,0xd9,0xf9,0x96,0x01,0x33,0x05,0xed,
-       0x7b,0x03,0x05,0xad,0xf8,0x49,0x03,0x02,0x82,0x01,
-       0x01,0x00,0xd4,0x40,0x17,0x66,0x10,0x92,0x95,0xc8,
-       0xec,0x62,0xa9,0x7a,0xcb,0x93,0x8e,0xe6,0x53,0xd4,
-       0x80,0x48,0x27,0x4b,0x41,0xce,0x61,0xdf,0xbf,0x94,
-       0xa4,0x3d,0x71,0x03,0x0b,0xed,0x25,0x71,0x98,0xa4,
-       0xd6,0xd5,0x4a,0x57,0xf5,0x6c,0x1b,0xda,0x21,0x7d,
-       0x35,0x45,0xb3,0xf3,0x6a,0xd9,0xd3,0x43,0xe8,0x5c,
-       0x54,0x1c,0x83,0x1b,0xb4,0x5f,0xf2,0x97,0x24,0x2e,
-       0xdc,0x40,0xde,0x92,0x23,0x59,0x8e,0xbc,0xd2,0xa1,
-       0xf2,0xe0,0x4c,0xdd,0x0b,0xd1,0xe7,0xae,0x65,0xbc,
-       0xb5,0xf5,0x5b,0x98,0xe9,0xd7,0xc2,0xb7,0x0e,0x55,
-       0x71,0x0e,0x3c,0x0a,0x24,0x6b,0xa6,0xe6,0x14,0x61,
-       0x11,0xfd,0x33,0x42,0x99,0x2b,0x84,0x77,0x74,0x92,
-       0x91,0xf5,0x79,0x79,0xcf,0xad,0x8e,0x04,0xef,0x80,
-       0x1e,0x57,0xf4,0x14,0xf5,0x35,0x09,0x74,0xb2,0x13,
-       0x71,0x58,0x6b,0xea,0x32,0x5d,0xf3,0xd3,0x76,0x48,
-       0x39,0x10,0x23,0x84,0x9d,0xbe,0x92,0x77,0x4a,0xed,
-       0x70,0x3e,0x1a,0xa2,0x6c,0xb3,0x81,0x00,0xc3,0xc9,
-       0xe4,0x52,0xc8,0x24,0x88,0x0c,0x41,0xad,0x87,0x5a,
-       0xea,0xa3,0x7a,0x85,0x1c,0x5e,0x31,0x7f,0xc3,0x35,
-       0xc6,0xfa,0x10,0xc8,0x75,0x10,0xc4,0x96,0x99,0xe7,
-       0xfe,0x01,0xb4,0x74,0xdb,0xb4,0x11,0xc3,0xc8,0x8c,
-       0xf6,0xf7,0x3b,0x66,0x50,0xfc,0xdb,0xeb,0xca,0x47,
-       0x85,0x89,0xe1,0x65,0xd9,0x62,0x34,0x3c,0x70,0xd8,
-       0x2e,0xb4,0x2f,0x65,0x3c,0x4a,0xa6,0x2a,0xe7,0xc7,
-       0xd8,0x41,0x8f,0x8a,0x43,0xbf,0x42,0xf2,0x4d,0xbc,
-       0xfc,0x9e,0x27,0x95,0xfb,0x75,0xff,0xab,0x02,0x82,
-       0x01,0x00,0x41,0x2f,0x44,0x57,0x6d,0x12,0x17,0x5b,
-       0x32,0xc6,0xb7,0x6c,0x57,0x7a,0x8a,0x0e,0x79,0xef,
-       0x72,0xa8,0x68,0xda,0x2d,0x38,0xe4,0xbb,0x8d,0xf6,
-       0x02,0x65,0xcf,0x56,0x13,0xe1,0x1a,0xcb,0x39,0x80,
-       0xa6,0xb1,0x32,0x03,0x1e,0xdd,0xbb,0x35,0xd9,0xac,
-       0x43,0x89,0x31,0x08,0x90,0x92,0x5e,0x35,0x3d,0x7b,
-       0x9c,0x6f,0x86,0xcb,0x17,0xdd,0x85,0xe4,0xed,0x35,
-       0x08,0x8e,0xc1,0xf4,0x05,0xd8,0x68,0xc6,0x63,0x3c,
-       0xf7,0xff,0xf7,0x47,0x33,0x39,0xc5,0x3e,0xb7,0x0e,
-       0x58,0x35,0x9d,0x81,0xea,0xf8,0x6a,0x2c,0x1c,0x5a,
-       0x68,0x78,0x64,0x11,0x6b,0xc1,0x3e,0x4e,0x7a,0xbd,
-       0x84,0xcb,0x0f,0xc2,0xb6,0x85,0x1d,0xd3,0x76,0xc5,
-       0x93,0x6a,0x69,0x89,0x56,0x34,0xdc,0x4a,0x9b,0xbc,
-       0xff,0xa8,0x0d,0x6e,0x35,0x9c,0x60,0xa7,0x23,0x30,
-       0xc7,0x06,0x64,0x39,0x8b,0x94,0x89,0xee,0xba,0x7f,
-       0x60,0x8d,0xfa,0xb6,0x97,0x76,0xdc,0x51,0x4a,0x3c,
-       0xeb,0x3a,0x14,0x2c,0x20,0x60,0x69,0x4a,0x86,0xfe,
-       0x8c,0x21,0x84,0x49,0x54,0xb3,0x20,0xe1,0x01,0x7f,
-       0x58,0xdf,0x7f,0xb5,0x21,0x51,0x8c,0x47,0x9f,0x91,
-       0xeb,0x97,0x3e,0xf2,0x54,0xcf,0x16,0x46,0xf9,0xd9,
-       0xb6,0xe7,0x64,0xc9,0xd0,0x54,0xea,0x2f,0xa1,0xcf,
-       0xa5,0x7f,0x28,0x8d,0x84,0xec,0xd5,0x39,0x03,0x76,
-       0x5b,0x2d,0x8e,0x43,0xf2,0x01,0x24,0xc9,0x6f,0xc0,
-       0xf5,0x69,0x6f,0x7d,0xb5,0x85,0xd2,0x5f,0x7f,0x78,
-       0x40,0x07,0x7f,0x09,0x15,0xb5,0x1f,0x28,0x65,0x10,
-       0xe4,0x19,0xa8,0xc6,0x9e,0x8d,0xdc,0xcb,0x02,0x82,
-       0x01,0x00,0x13,0x01,0xee,0x56,0x80,0x93,0x70,0x00,
-       0x7f,0x52,0xd2,0x94,0xa1,0x98,0x84,0x4a,0x92,0x25,
-       0x4c,0x9b,0xa9,0x91,0x2e,0xc2,0x79,0xb7,0x5c,0xe3,
-       0xc5,0xd5,0x8e,0xc2,0x54,0x16,0x17,0xad,0x55,0x9b,
-       0x25,0x76,0x12,0x63,0x50,0x22,0x2f,0x58,0x58,0x79,
-       0x6b,0x04,0xe3,0xf9,0x9f,0x8f,0x04,0x41,0x67,0x94,
-       0xa5,0x1f,0xac,0x8a,0x15,0x9c,0x26,0x10,0x6c,0xf8,
-       0x19,0x57,0x61,0xd7,0x3a,0x7d,0x31,0xb0,0x2d,0x38,
-       0xbd,0x94,0x62,0xad,0xc4,0xfa,0x36,0x42,0x42,0xf0,
-       0x24,0x67,0x65,0x9d,0x8b,0x0b,0x7c,0x6f,0x82,0x44,
-       0x1a,0x8c,0xc8,0xc9,0xab,0xbb,0x4c,0x45,0xfc,0x7b,
-       0x38,0xee,0x30,0xe1,0xfc,0xef,0x8d,0xbc,0x58,0xdf,
-       0x2b,0x5d,0x0d,0x54,0xe0,0x49,0x4d,0x97,0x99,0x8f,
-       0x22,0xa8,0x83,0xbe,0x40,0xbb,0x50,0x2e,0x78,0x28,
-       0x0f,0x95,0x78,0x8c,0x8f,0x98,0x24,0x56,0xc2,0x97,
-       0xf3,0x2c,0x43,0xd2,0x03,0x82,0x66,0x81,0x72,0x5f,
-       0x53,0x16,0xec,0xb1,0xb1,0x04,0x5e,0x40,0x20,0x48,
-       0x7b,0x3f,0x02,0x97,0x6a,0xeb,0x96,0x12,0x21,0x35,
-       0xfe,0x1f,0x47,0xc0,0x95,0xea,0xc5,0x8a,0x08,0x84,
-       0x4f,0x5e,0x63,0x94,0x60,0x0f,0x71,0x5b,0x7f,0x4a,
-       0xec,0x4f,0x60,0xc6,0xba,0x4a,0x24,0xf1,0x20,0x8b,
-       0xa7,0x2e,0x3a,0xce,0x8d,0xe0,0x27,0x1d,0xb5,0x8e,
-       0xb4,0x21,0xc5,0xe2,0xa6,0x16,0x0a,0x51,0x83,0x55,
-       0x88,0xd1,0x30,0x11,0x63,0xd5,0xd7,0x8d,0xae,0x16,
-       0x12,0x82,0xc4,0x85,0x00,0x4e,0x27,0x83,0xa5,0x7c,
-       0x90,0x2e,0xe5,0xa2,0xa3,0xd3,0x4c,0x63,0x02,0x82,
-       0x01,0x01,0x00,0x86,0x08,0x98,0x98,0xa5,0x00,0x05,
-       0x39,0x77,0xd9,0x66,0xb3,0xcf,0xca,0xa0,0x71,0xb3,
-       0x50,0xce,0x3d,0xb1,0x93,0x95,0x35,0xc4,0xd4,0x2e,
-       0x90,0xdf,0x0f,0xfc,0x60,0xc1,0x94,0x68,0x61,0x43,
-       0xca,0x9a,0x23,0x4a,0x1e,0x45,0x72,0x99,0xb5,0x1e,
-       0x61,0x8d,0x77,0x0f,0xa0,0xbb,0xd7,0x77,0xb4,0x2a,
-       0x15,0x11,0x88,0x2d,0xb3,0x56,0x61,0x5e,0x6a,0xed,
-       0xa4,0x46,0x4a,0x3f,0x50,0x11,0xd6,0xba,0xb6,0xd7,
-       0x95,0x65,0x53,0xc3,0xa1,0x8f,0xe0,0xa3,0xf5,0x1c,
-       0xfd,0xaf,0x6e,0x43,0xd7,0x17,0xa7,0xd3,0x81,0x1b,
-       0xa4,0xdf,0xe0,0x97,0x8a,0x46,0x03,0xd3,0x46,0x0e,
-       0x83,0x48,0x4e,0xd2,0x02,0xcb,0xc0,0xad,0x79,0x95,
-       0x8c,0x96,0xba,0x40,0x34,0x11,0x71,0x5e,0xe9,0x11,
-       0xf9,0xc5,0x4a,0x5e,0x91,0x9d,0xf5,0x92,0x4f,0xeb,
-       0xc6,0x70,0x02,0x2d,0x3d,0x04,0xaa,0xe9,0x3a,0x8e,
-       0xd5,0xa8,0xad,0xf7,0xce,0x0d,0x16,0xb2,0xec,0x0a,
-       0x9c,0xf5,0x94,0x39,0xb9,0x8a,0xfc,0x1e,0xf9,0xcc,
-       0xf2,0x5f,0x21,0x31,0x74,0x72,0x6b,0x64,0xae,0x35,
-       0x61,0x8d,0x0d,0xcb,0xe7,0xda,0x39,0xca,0xf3,0x21,
-       0x66,0x0b,0x95,0xd7,0x0a,0x7c,0xca,0xa1,0xa9,0x5a,
-       0xe8,0xac,0xe0,0x71,0x54,0xaf,0x28,0xcf,0xd5,0x70,
-       0x89,0xe0,0xf3,0x9e,0x43,0x6c,0x8d,0x7b,0x99,0x01,
-       0x68,0x4d,0xa1,0x45,0x46,0x0c,0x43,0xbc,0xcc,0x2c,
-       0xdd,0xc5,0x46,0xc8,0x4e,0x0e,0xbe,0xed,0xb9,0x26,
-       0xab,0x2e,0xdb,0xeb,0x8f,0xff,0xdb,0xb0,0xc6,0x55,
-       0xaf,0xf8,0x2a,0x91,0x9d,0x50,0x44,0x21,0x17,
-       };
diff --git a/usr/skb/testapps/threadalloc.c b/usr/skb/testapps/threadalloc.c
deleted file mode 100644 (file)
index ed29bb7..0000000
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * threadalloc.c
- *
- *  Created on: Mar 21, 2011
- *      Author: scadrian
- */
-
-#include <stdio.h>
-#include <barrelfish/barrelfish.h>
-#include <barrelfish/nameservice_client.h>
-#include <barrelfish/waitset.h>
-#include <skb/skb.h>
-#include <unistd.h>
-
-#include <barrelfish/curdispatcher_arch.h>
-#include <arch/x86/barrelfish/perfmon.h>
-#include <arch/x86/barrelfish_kpi/perfmon_amd.h>
-
-#define GROESSI (128*1024*1024)
-
-static volatile int nr_available_cores = 1;
-static volatile int nr_spanned_cores = 0;
-
-static volatile int nr_active_threads = 0;
-static volatile int nr_finished_threads = 0;
-static volatile uint64_t end = 0;
-static volatile uint64_t start = 0;
-
-static struct thread_mutex m;
-static volatile spinlock_t s = 0;
-
-static volatile uint64_t tmp_increments = 0;
-static spinlock_t stmp = 0;
-static struct thread_mutex mtmp;
-
-static struct thread_cond all_done_condition;
-static struct thread_mutex all_done_mutex;
-
-struct addr {
-    uint8_t *startaddr;
-    int size;
-};
-
-#define NR_ALLOCATED_THREADS 22
-//#define BUFFER_SIZE (1024 * 1024 * 1024)
-#define BUFFER_SIZE (4 * 1024 * 1024)
-
-static struct addr as[NR_ALLOCATED_THREADS];
-
-static volatile int totalincrements = 0;
-static volatile int value_per_thread = 1000000;
-static int increment_tmp_var(void *arg)
-{
-    for (uint64_t i = 0; i < value_per_thread; i++) {
-//        acquire_spinlock(&stmp);
-        thread_mutex_lock(&mtmp);
-        tmp_increments++;
-//        if (tmp_increments % 10000 == 0) {
-//            printf("tmp_increments: %lu\n", tmp_increments);
-//        }
-        if (tmp_increments == totalincrements) {
-            thread_mutex_lock(&all_done_mutex);
-            thread_cond_signal(&all_done_condition);
-            thread_mutex_unlock(&all_done_mutex);
-        }
-        thread_mutex_unlock(&mtmp);
-//        release_spinlock(&stmp);
-    }
-    return 0;
-}
-static void thread_done(void)
-{
-//    thread_mutex_lock(&m);
-    acquire_spinlock(&s);
-    nr_finished_threads++;
-//    if (nr_finished_threads == nr_active_threads) {
-//        end = rdtsc();
-//    }
-//    thread_mutex_unlock(&m);
-    release_spinlock(&s);
-}
-static void spanned_cb(void *arg, errval_t reterr)
-{
-    assert(err_is_ok(reterr));
-    nr_spanned_cores++;
-    if (nr_spanned_cores == nr_available_cores - 1) {
-        thread_mutex_lock(&all_done_mutex);
-        thread_cond_signal(&all_done_condition);
-        thread_mutex_unlock(&all_done_mutex);
-    }
-//    printf("nr_spanned_cores = %d\n", nr_spanned_cores);
-}
-
-static int create_skb_channel(void *arg)
-{
-    errval_t err = skb_client_connect();
-    if (err_is_fail(err)) {
-        DEBUG_ERR(err, "connection to the SKB from thread failed. Terminating.\n");
-        return (1);
-    }
-    printf("SKB channel on core %"PRIuCOREID" created\n", disp_get_core_id());
-    thread_done();
-    return (0);
-}
-
-static int initialize_memory(void *arg)
-{
-    struct addr *ptr = (struct addr*)arg;
-    for (int i = 0; i < ptr->size; i++) {
-        ptr->startaddr[i] = 0;
-    }
-    thread_done();
-    return 0;
-}
-
-static int initialize_number(void *arg)
-{
-    struct addr *ptr = (struct addr*)arg;
-    for (int i = 0; i < ptr->size; i++) {
-        ptr->startaddr[i] = i;
-    }
-    thread_done();
-    return 0;
-}
-
-static int sqr(void *arg)
-{
-    struct addr *ptr = (struct addr*)arg;
-    for (int i = 0; i < ptr->size; i++) {
-        ptr->startaddr[i] = ptr->startaddr[i] * ptr->startaddr[i];
-    }
-    thread_done();
-    return 0;
-}
-
-//static int writemem(void *arg)
-//{
-//    printf("very first program:\n");
-//    unsigned char *intarray = (unsigned char *)arg;
-//
-//    for (int i = 0; i < GROESSI; i++) {
-//        intarray[i] = 0;
-//    }
-//    start = rdtsc();
-//    for (int i = 0; i < GROESSI; i++) {
-//        intarray[i] = 0;
-//    }
-//    end = rdtsc();
-//    printf("zykla: %lu\n", end - start);
-//    printf("done.\n");
-//    return 0;
-//}
-
-
-static int writemem(void *arg)
-{
-    printf("very first program:\n");
-    unsigned char *intarray = (unsigned char *)arg;
-    uint64_t *data = (uint64_t*)malloc(sizeof(uint64_t) * GROESSI);
-
-    for (int i = 0; i < GROESSI; i++) {
-        intarray[i] = 0;
-    }
-    for (int i = 0; i < GROESSI; i++) {
-        start = rdtsc();
-        intarray[i] = 0;
-        end = rdtsc();
-        data[i] = end - start;
-    }
-    printf("\n**************start***********\n\n");
-    for (int i = 0; i < GROESSI; i++) {
-        printf("###RES%d\t%lu\n",i, data[i]);
-    }
-    printf("\n**************stop***********\n\n");
-
-//    printf("zykla: %lu\n", end - start);
-    printf("done.\n");
-    return 0;
-}
-
-
-int main(int argc, char **argv)
-{
-    errval_t err;
-    
-    printf("%s starting up...\n", argv[0]);
-    
-    err = skb_client_connect();
-    if (err_is_fail(err)) {
-        DEBUG_ERR(err, "connection to the SKB failed. Terminating.\n");
-        return (0);
-    }
-
-    iref_t iref;
-    err = nameservice_blocking_lookup("datagatherer_done", &iref);
-    if (err_is_fail(err)) {
-        USER_PANIC_ERR(err, "nameservice_blocking_lookup failed");
-    }
-    
-    err = skb_execute("available_nr_cores(Nr),write(nrcores(Nr)).");
-    if (err_is_fail(err)) {
-        DEBUG_ERR(err, "Could not determine the number of cores."
-                "Stay with one core...\n");
-    }
-    err = skb_read_output("nrcores(%d)", &nr_available_cores);
-    if (err_is_fail(err)) {
-        DEBUG_ERR(err, "Could not determine the number of cores <2>."
-                "Stay with one core...\n");
-    }
-    printf("nr available cores: %d\n", nr_available_cores);
-    
-    coreid_t my_core_id = disp_get_core_id();
-    
-    int curr_core_nr = (my_core_id + 1) % nr_available_cores;
-    while (curr_core_nr != my_core_id) {
-//    while (curr_core_nr != ((my_core_id + 11)%nr_available_cores)) {
-        err = domain_new_dispatcher(curr_core_nr, spanned_cb, NULL);
-        if (err_is_fail(err)) {
-            DEBUG_ERR(err, "failed to span domain\n");
-        }
-        assert(err_is_ok(err));
-//        printf("new thread on core %d\n", curr_core_nr);
-        curr_core_nr = (curr_core_nr + 1) % nr_available_cores;
-    }
-
-    printf("ack\n");
-    // we need to wait until the domain got spanned to all other cores
-    // this means that we need to wait for n-1 callbacks
-    thread_mutex_init(&all_done_mutex);