Merge branch 'dnssec'
[strongswan.git] / scripts / crypt_burn.c
index 3b05144..449364a 100644 (file)
@@ -15,7 +15,6 @@
 
 #include <stdio.h>
 #include <library.h>
-#include <crypto/proposal/proposal_keywords.h>
 
 int main(int argc, char *argv[])
 {
@@ -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]);
@@ -104,12 +103,18 @@ int main(int argc, char *argv[])
 
                while (i--)
                {
-                       crypter->encrypt(crypter,
-                               chunk_create(buffer, sizeof(buffer) / bs * bs),
-                               chunk_create(iv, crypter->get_iv_size(crypter)), NULL);
-                       crypter->decrypt(crypter,
-                               chunk_create(buffer, sizeof(buffer) / bs * bs),
-                               chunk_create(iv, crypter->get_iv_size(crypter)), NULL);
+                       if (!crypter->encrypt(crypter,
+                                       chunk_create(buffer, sizeof(buffer) / bs * bs),
+                                       chunk_create(iv, crypter->get_iv_size(crypter)), NULL))
+                       {
+                               continue;
+                       }
+                       if (!crypter->decrypt(crypter,
+                                       chunk_create(buffer, sizeof(buffer) / bs * bs),
+                                       chunk_create(iv, crypter->get_iv_size(crypter)), NULL))
+                       {
+                               continue;
+                       }
                        if (limit && ++i == limit)
                        {
                                break;