X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=lib%2Fpb-protocol%2Fpb-protocol.c;h=33bd4e6e3064c5f4d393605f79d24619d42f4275;hp=b4138bbf43e6e4aa781ba5a89768499e9667c138;hb=5f8fa2c151b8f0e568dc4015b7d307250b354a04;hpb=ba8144f917f5603e507e9c72aed4ae3257c6b0ce diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c index b4138bb..33bd4e6 100644 --- a/lib/pb-protocol/pb-protocol.c +++ b/lib/pb-protocol/pb-protocol.c @@ -394,6 +394,10 @@ int pb_protocol_authenticate_len(struct auth_message *msg) /* enum + password + password */ return 4 + 4 + optional_strlen(msg->set_password.password) + 4 + optional_strlen(msg->set_password.new_password); + case AUTH_MSG_DECRYPT: + /* enum + password + device id */ + return 4 + 4 + optional_strlen(msg->decrypt_dev.password) + + 4 + optional_strlen(msg->decrypt_dev.device_id); default: pb_log("%s: invalid input\n", __func__); return 0; @@ -750,6 +754,12 @@ int pb_protocol_serialise_authenticate(struct auth_message *msg, pos += pb_protocol_serialise_string(pos, msg->set_password.new_password); break; + case AUTH_MSG_DECRYPT: + pos += pb_protocol_serialise_string(pos, + msg->decrypt_dev.password); + pos += pb_protocol_serialise_string(pos, + msg->decrypt_dev.device_id); + break; default: pb_log("%s: invalid msg\n", __func__); return -1; @@ -1439,6 +1449,13 @@ int pb_protocol_deserialise_authenticate(struct auth_message *msg, &msg->set_password.new_password)) return -1; break; + case AUTH_MSG_DECRYPT: + if (read_string(msg, &pos, &len, &msg->decrypt_dev.password)) + return -1; + if (read_string(msg, &pos, &len, + &msg->decrypt_dev.device_id)) + return -1; + break; default: pb_log("%s: unable to parse\n", __func__); return -1;