diff options
author | Ritu Sood <ritu.sood@intel.com> | 2018-04-26 01:50:05 +0000 |
---|---|---|
committer | Ritu Sood <ritu.sood@intel.com> | 2018-05-24 05:55:20 +0000 |
commit | 57c7ad1aa0e485b5594f27f1ab501ff0306fe2fc (patch) | |
tree | f47b764bda303958051dae4f3e4f0222c338ac3e /SoftHSMv2/src/lib/P11Objects.cpp | |
parent | c1c9bfcabc4a5e4147d19c599de7d9bf925fa98b (diff) |
Added a new Attribute to store TPM key handle
Includes changes to detect existing instances of key and
also some bug fixes. Also added new functionality for
RSA_SignUpdate, RSA_SignFinal and RSA_Cleanup
Issue-ID: AAF-260
Change-Id: Ib064e86b8f112784ed6d352ab1557ab9a13c5978
Signed-off-by: Ritu Sood <ritu.sood@intel.com>
Diffstat (limited to 'SoftHSMv2/src/lib/P11Objects.cpp')
-rw-r--r-- | SoftHSMv2/src/lib/P11Objects.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/SoftHSMv2/src/lib/P11Objects.cpp b/SoftHSMv2/src/lib/P11Objects.cpp index c58d4ec..3e663b2 100644 --- a/SoftHSMv2/src/lib/P11Objects.cpp +++ b/SoftHSMv2/src/lib/P11Objects.cpp @@ -1107,6 +1107,7 @@ bool P11RSAPrivateKeyObj::init(OSObject *inobject) P11Attribute* attrExponent1 = new P11AttrExponent1(osobject); P11Attribute* attrExponent2 = new P11AttrExponent2(osobject); P11Attribute* attrCoefficient = new P11AttrCoefficient(osobject); + P11Attribute* attrPrivateHandle = new P11AttrPrivateHandle(osobject); // Initialize the attributes if @@ -1118,6 +1119,7 @@ bool P11RSAPrivateKeyObj::init(OSObject *inobject) !attrPrime2->init() || !attrExponent1->init() || !attrExponent2->init() || + !attrPrivateHandle->init() || !attrCoefficient->init() ) { @@ -1130,6 +1132,7 @@ bool P11RSAPrivateKeyObj::init(OSObject *inobject) delete attrExponent1; delete attrExponent2; delete attrCoefficient; + delete attrPrivateHandle; return false; } @@ -1142,6 +1145,7 @@ bool P11RSAPrivateKeyObj::init(OSObject *inobject) attributes[attrExponent1->getType()] = attrExponent1; attributes[attrExponent2->getType()] = attrExponent2; attributes[attrCoefficient->getType()] = attrCoefficient; + attributes[attrPrivateHandle->getType()] = attrPrivateHandle; initialized = true; return true; @@ -1223,23 +1227,27 @@ bool P11ECPrivateKeyObj::init(OSObject *inobject) // Create attributes P11Attribute* attrEcParams = new P11AttrEcParams(osobject,P11Attribute::ck4|P11Attribute::ck6); P11Attribute* attrValue = new P11AttrValue(osobject,P11Attribute::ck1|P11Attribute::ck4|P11Attribute::ck6|P11Attribute::ck7); + P11Attribute* attrPrivateHandle = new P11AttrPrivateHandle(osobject); // Initialize the attributes if ( !attrEcParams->init() || + !attrPrivateHandle->init() || !attrValue->init() ) { ERROR_MSG("Could not initialize the attribute"); delete attrEcParams; delete attrValue; + delete attrPrivateHandle; return false; } // Add them to the map attributes[attrEcParams->getType()] = attrEcParams; attributes[attrValue->getType()] = attrValue; + attributes[attrPrivateHandle->getType()] = attrPrivateHandle; initialized = true; return true; |