Bladeren bron

rsa_import_pkcs8 tests

Karel Miko 7 jaren geleden
bovenliggende
commit
2dd8bcdfe9
2 gewijzigde bestanden met toevoegingen van 7 en 1 verwijderingen
  1. 1 1
      tests/common.c
  2. 6 0
      tests/rsa_test.c

+ 1 - 1
tests/common.c

@@ -100,7 +100,7 @@ int test_process_dir(const char *path, void *ctx, dir_iter_cb process, dir_clean
       return CRYPT_FILE_NOTFOUND;
    while((de = readdir(d)) != NULL) {
       fname[0] = '\0';
-      if (strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0)
+      if (strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0 || strcmp(de->d_name, "README.txt") == 0)
          continue;
       strcat(fname, path);
       strcat(fname, "/");

+ 6 - 0
tests/rsa_test.c

@@ -341,6 +341,11 @@ static int _rsa_import_x509(const void *in, unsigned long inlen, void *key)
    }
    return rsa_import_x509(in, inlen, key);
 }
+
+static int _rsa_import_pkcs8(const void *in, unsigned long inlen, void *key)
+{
+   return rsa_import_pkcs8(in, inlen, "secret", 6, key);
+}
 #endif
 
 int rsa_test(void)
@@ -370,6 +375,7 @@ int rsa_test(void)
 
 #ifdef LTC_TEST_READDIR
    DO(test_process_dir("tests/rsa", &key, _rsa_import_x509, (dir_cleanup_cb)rsa_free, "rsa_test"));
+   DO(test_process_dir("tests/rsa-pkcs8", &key, _rsa_import_pkcs8, (dir_cleanup_cb)rsa_free, "rsa_pkcs8_test"));
 #endif
 
    DO(_rsa_issue_301(prng_idx));