test/src/util/test_util.cc
branchsync
changeset 3001 8c1aafb3ad57
parent 2956 e82181973f21
parent 2995 6f2f9a7c060e
child 3270 d8aea79654c3
     1.1 --- a/test/src/util/test_util.cc	Thu Oct 04 17:43:08 2018 +0200
     1.2 +++ b/test/src/util/test_util.cc	Fri Oct 05 10:23:01 2018 +0200
     1.3 @@ -378,14 +378,19 @@
     1.4      }
     1.5  }
     1.6  
     1.7 +bool slurp_and_import_key(PEP_SESSION session, const char* key_filename) {
     1.8 +    std::string keyfile = slurp(key_filename);
     1.9 +    if (import_key(session, keyfile.c_str(), keyfile.size(), NULL) != PEP_STATUS_OK)
    1.10 +        return false;
    1.11 +    return true;
    1.12 +}
    1.13 +
    1.14  bool slurp_message_and_import_key(PEP_SESSION session, const char* message_fname, std::string& message, const char* key_filename) {
    1.15 +    bool ok = true;
    1.16      message = slurp(message_fname);
    1.17 -    if (key_filename) {
    1.18 -        std::string keyfile = slurp(key_filename);
    1.19 -        if (import_key(session, keyfile.c_str(), keyfile.size(), NULL) != PEP_STATUS_OK)
    1.20 -            return false;
    1.21 -    }
    1.22 -    return true;
    1.23 +    if (key_filename)
    1.24 +        ok = slurp_and_import_key(session, key_filename);
    1.25 +    return ok;
    1.26  }
    1.27  
    1.28