'version' is not optional in the encoding
[openssl.git] / crypto / ecdsa / ecdsatest.c
index 02f9df923f39bc236f38c28796346ca74a8f6bcd..cffc1949283bc7c6022c13012c2d994a46710bda 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
-#include <openssl/crypto.h>
-#include <openssl/bio.h>
-#include <openssl/evp.h>
-#include <openssl/x509.h>
-#include <openssl/ecdsa.h>
-#include <openssl/engine.h>
-#include <openssl/err.h>
 
 #ifdef CLOCKS_PER_SEC
        /* "To determine the time in seconds, the value returned
 
 #ifdef CLOCKS_PER_SEC
        /* "To determine the time in seconds, the value returned
 int main(int argc, char * argv[]) { puts("Elliptic curves are disabled."); return 0; }
 #else
 
 int main(int argc, char * argv[]) { puts("Elliptic curves are disabled."); return 0; }
 #else
 
+#include <openssl/crypto.h>
+#include <openssl/bio.h>
+#include <openssl/evp.h>
+#include <openssl/x509.h>
+#include <openssl/ecdsa.h>
+#include <openssl/engine.h>
+#include <openssl/err.h>
+
 static BIO *bio_err=NULL;
 static const char rnd_seed[] = "string to make the random number generator think it has entropy";
 
 static BIO *bio_err=NULL;
 static const char rnd_seed[] = "string to make the random number generator think it has entropy";
 
@@ -389,23 +390,6 @@ int main(void)
        OPENSSL_free(buffer);
        buffer = NULL;
 
        OPENSSL_free(buffer);
        buffer = NULL;
 
-       /* i2d_ - d2i_ECDSAPublicKey() */
-
-       BIO_printf(bio_err, "\nTesting i2d_ - d2i_ECDSAPublicKey \n");
-       buf_len = i2d_ECDSAPublicKey(ecdsa, NULL);
-       if (!buf_len || (buffer = OPENSSL_malloc(buf_len)) == NULL) goto err;
-       pp = buffer;
-       if (!i2d_ECDSAPublicKey(ecdsa, &pp)) goto err;
-       pp = buffer;
-       if ((ret_ecdsa = d2i_ECDSAPublicKey(&ret_ecdsa , (const unsigned char**)&pp, 
-                       buf_len)) == NULL) goto err;
-       ECDSA_print(bio_err, ret_ecdsa, 0);
-       if (ecdsa_cmp(ecdsa, ret_ecdsa)) goto err;
-       OPENSSL_free(buffer);
-       buffer = NULL;
-       ECDSA_free(ret_ecdsa);
-       ret_ecdsa = NULL;       
-       
        /* X509_PUBKEY_set() &  X509_PUBKEY_get() */    
 
        BIO_printf(bio_err, "\nTesting X509_PUBKEY_{get,set}            : ");
        /* X509_PUBKEY_set() &  X509_PUBKEY_get() */    
 
        BIO_printf(bio_err, "\nTesting X509_PUBKEY_{get,set}            : ");