summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
ba8144f)
Extend the auth_message struct to support the AUTH_MSG_DECRYPT
operation, allowing the existing authentications methods to be used for
passing a disk password from the UI to pb-discover.
In addition add DEVICE_TYPE_LUKS to identify encrypted disk devices.
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
/* enum + password + password */
return 4 + 4 + optional_strlen(msg->set_password.password) +
4 + optional_strlen(msg->set_password.new_password);
/* 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;
default:
pb_log("%s: invalid input\n", __func__);
return 0;
pos += pb_protocol_serialise_string(pos,
msg->set_password.new_password);
break;
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;
default:
pb_log("%s: invalid msg\n", __func__);
return -1;
&msg->set_password.new_password))
return -1;
break;
&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;
default:
pb_log("%s: unable to parse\n", __func__);
return -1;
AUTH_MSG_REQUEST,
AUTH_MSG_RESPONSE,
AUTH_MSG_SET,
AUTH_MSG_REQUEST,
AUTH_MSG_RESPONSE,
AUTH_MSG_SET,
char *password;
char *new_password;
} set_password;
char *password;
char *new_password;
} set_password;
+ struct {
+ char *password;
+ char *device_id;
+ } decrypt_dev;
return _("Network");
case DEVICE_TYPE_ANY:
return _("Any");
return _("Network");
case DEVICE_TYPE_ANY:
return _("Any");
+ case DEVICE_TYPE_LUKS:
+ return _("Encrypted Device");
case DEVICE_TYPE_UNKNOWN:
default:
return _("Unknown");
case DEVICE_TYPE_UNKNOWN:
default:
return _("Unknown");
return "network";
case DEVICE_TYPE_ANY:
return "any";
return "network";
case DEVICE_TYPE_ANY:
return "any";
+ case DEVICE_TYPE_LUKS:
+ return "encrypted";
case DEVICE_TYPE_UNKNOWN:
default:
return "unknown";
case DEVICE_TYPE_UNKNOWN:
default:
return "unknown";
return DEVICE_TYPE_NETWORK;
if (!strncmp(str, "any", strlen("any")))
return DEVICE_TYPE_ANY;
return DEVICE_TYPE_NETWORK;
if (!strncmp(str, "any", strlen("any")))
return DEVICE_TYPE_ANY;
+ if (!strncmp(str, "encrypted", strlen("encrypted")))
+ return DEVICE_TYPE_LUKS;
return DEVICE_TYPE_UNKNOWN;
}
return DEVICE_TYPE_UNKNOWN;
}
DEVICE_TYPE_USB,
DEVICE_TYPE_OPTICAL,
DEVICE_TYPE_ANY,
DEVICE_TYPE_USB,
DEVICE_TYPE_OPTICAL,
DEVICE_TYPE_ANY,
return "optical";
case DEVICE_TYPE_ANY:
return "any";
return "optical";
case DEVICE_TYPE_ANY:
return "any";
+ case DEVICE_TYPE_LUKS:
+ return "encrypted";
case DEVICE_TYPE_UNKNOWN:
return "unknown";
}
case DEVICE_TYPE_UNKNOWN:
return "unknown";
}