curl: Dynamically query supported protocols and register appropriate features
[strongswan.git] / scripts / crypt_burn.c
index 1f1536a..1768d76 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <stdio.h>
 #include <library.h>
-#include <crypto/proposal/proposal_keywords.h>
 
 int main(int argc, char *argv[])
 {
@@ -27,8 +26,8 @@ int main(int argc, char *argv[])
        int i = 0, limit = 0;
 
 
-       library_init(NULL);
-       lib->plugins->load(lib->plugins, NULL, PLUGINS);
+       library_init(NULL, "crypt_burn");
+       lib->plugins->load(lib->plugins, PLUGINS);
        atexit(library_deinit);
 
        printf("loaded: %s\n", PLUGINS);
@@ -47,7 +46,7 @@ int main(int argc, char *argv[])
                limit = atoi(argv[2]);
        }
 
-       token = proposal_get_token(argv[1], strlen(argv[1]));
+       token = lib->proposal->get_token(lib->proposal, argv[1]);
        if (!token)
        {
                fprintf(stderr, "algorithm '%s' unknown!\n", argv[1]);
@@ -62,7 +61,7 @@ int main(int argc, char *argv[])
        if (encryption_algorithm_is_aead(token->algorithm))
        {
                aead = lib->crypto->create_aead(lib->crypto,
-                                                                               token->algorithm, token->keysize / 8);
+                                                                       token->algorithm, token->keysize / 8, 0);
                if (!aead)
                {
                        fprintf(stderr, "aead '%s' not supported!\n", argv[1]);
@@ -90,6 +89,7 @@ int main(int argc, char *argv[])
                                break;
                        }
                }
+               aead->destroy(aead);
        }
        else
        {
@@ -102,7 +102,7 @@ int main(int argc, char *argv[])
                }
                bs = crypter->get_block_size(crypter);
 
-               while (i--)
+               while (TRUE)
                {
                        if (!crypter->encrypt(crypter,
                                        chunk_create(buffer, sizeof(buffer) / bs * bs),
@@ -121,6 +121,7 @@ int main(int argc, char *argv[])
                                break;
                        }
                }
+               crypter->destroy(crypter);
        }
        return 0;
 }