aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/pk_pad
diff options
context:
space:
mode:
authorRenĂ© Korthaus <[email protected]>2018-03-26 09:33:13 +0200
committerRenĂ© Korthaus <[email protected]>2018-04-02 09:05:23 +0200
commit13529b9ea346604fca00ff186195ee0a0e3b5ca6 (patch)
treec87ffc3457fbb40163bb36c6d0fc9b31c30d85a9 /src/lib/pk_pad
parentc74410c9928dc56e33dd37feb1dadf8b740c9c44 (diff)
Support passing an OAEP label in EME name
TPM 1.2 expects passing the owner and SRK secret encrypted with the public endorsement key. For asymmetric encryption, the TPM 1.2 uses OAEP with the label "TCPA".
Diffstat (limited to 'src/lib/pk_pad')
-rw-r--r--src/lib/pk_pad/eme.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/pk_pad/eme.cpp b/src/lib/pk_pad/eme.cpp
index 23c444506..5164157f7 100644
--- a/src/lib/pk_pad/eme.cpp
+++ b/src/lib/pk_pad/eme.cpp
@@ -43,12 +43,13 @@ EME* get_eme(const std::string& algo_spec)
req.algo_name() == "EME-OAEP" ||
req.algo_name() == "EME1")
{
- if(req.arg_count() == 1 ||(req.arg_count() == 2 && req.arg(1) == "MGF1"))
+ if(req.arg_count() == 1 ||
+ ((req.arg_count() == 2 || req.arg_count() == 3) && req.arg(1) == "MGF1"))
{
if(auto hash = HashFunction::create(req.arg(0)))
- return new OAEP(hash.release());
+ return new OAEP(hash.release(), req.arg(2, ""));
}
- else if(req.arg_count() == 2)
+ else if(req.arg_count() == 2 || req.arg_count() == 3)
{
auto mgf_params = parse_algorithm_name(req.arg(1));
@@ -59,7 +60,7 @@ EME* get_eme(const std::string& algo_spec)
if(hash && mgf1_hash)
{
- return new OAEP(hash.release(), mgf1_hash.release());
+ return new OAEP(hash.release(), mgf1_hash.release(), req.arg(2, ""));
}
}
}