2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

Fix errors in the TPM2 support

This commit is contained in:
Jarrod Johnson 2020-11-06 13:38:37 -05:00
parent c8747ac369
commit 31c2c5f6f7
2 changed files with 9 additions and 6 deletions

View File

@ -109,7 +109,9 @@ int main(int argc, char* argv[]) {
while (buffer[0] != 255) {
currtype = buffer[0];
if (currtype & 0b10000000) {
currlen = buffer[1] << 8 & buffer[2];
currlen = buffer[1] << 8;
read(sock, buffer, 1);
currlen |= buffer[0];
} else {
currlen = buffer[1];
}

View File

@ -22,6 +22,7 @@ import eventlet
import eventlet.green.socket as socket
import eventlet.greenpool
import os
import struct
# cred grant tlvs:
# 0, 0 - null
@ -48,16 +49,16 @@ class CredServer(object):
return
nodename = util.stringify(client.recv(tlv[1]))
tlv = bytearray(client.recv(2)) # should always be null
apiarmed = self.cfm.get_node_attributes(nodename,
apimats = self.cfm.get_node_attributes(nodename,
['deployment.apiarmed', 'deployment.sealedapikey'])
apiarmed = apiarmed.get(nodename, {}).get('deployment.apiarmed', {}).get(
apiarmed = apimats.get(nodename, {}).get('deployment.apiarmed', {}).get(
'value', None)
if not apiarmed:
if apiarmed.get(nodename, {}).get(
if apimats.get(nodename, {}).get(
'deployment.sealedapikey', {}).get('value', None):
sealed = apiarmed[nodename]['deployment.sealedapikey'][
sealed = apimats[nodename]['deployment.sealedapikey'][
'value']
if not isintance(sealed, bytes):
if not isinstance(sealed, bytes):
sealed = sealed.encode('utf8')
reply = b'\x80' + struct.pack('>H', len(sealed) + 1) + sealed + b'\x00'
client.send(reply)