Treat pwd data deserialization as an error 60/213260/1
authorKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Tue, 3 Sep 2019 09:33:13 +0000 (11:33 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Tue, 3 Sep 2019 09:39:53 +0000 (11:39 +0200)
The KM_PwdData structure keeps an authentication data needed to access
an item on the TA side. As such it should only be transferred from
key-manager to the TA.

Expecting such structure in an output buffer of the TA command
execution is a programmer error. It is now dealt with accordingly.

Change-Id: I209957a05700052eefc694d82b881c8aae96abb5

src/manager/crypto/tz-backend/tz-serializer.cpp

index b268e22..d8fc107 100644 (file)
@@ -23,6 +23,8 @@
 
 #include <string.h>
 
+#include <cassert>
+
 #include <generic-backend/crypto-params.h>
 
 namespace CKM {
@@ -107,9 +109,11 @@ int TZSerializablePwdData::Serialize(void **buffer, uint32_t *size_guard) const
        return KM_SerializePwdData(buffer, size_guard, const_cast<KM_PwdData*>(&m_data));
 }
 
-int TZSerializablePwdData::Deserialize(void **buffer, uint32_t *size_guard)
+int TZSerializablePwdData::Deserialize(void **, uint32_t *)
 {
-       return KM_DeserializePwdData(buffer, size_guard, &m_data);
+       // Key manager should not receive any password data from the TA
+       assert(false);
+       return -1;
 }
 
 // TZSerializableFlag