curl: Dynamically query supported protocols and register appropriate features
[strongswan.git] / scripts / crypt_burn.c
index 449364a..1768d76 100644 (file)
@@ -26,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);
@@ -61,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]);
@@ -89,6 +89,7 @@ int main(int argc, char *argv[])
                                break;
                        }
                }
+               aead->destroy(aead);
        }
        else
        {
@@ -101,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),
@@ -120,6 +121,7 @@ int main(int argc, char *argv[])
                                break;
                        }
                }
+               crypter->destroy(crypter);
        }
        return 0;
 }