Commit 018f8cfb authored by John Doe's avatar John Doe Committed by Jean-Baptiste Kempf

Don't discard unit keys unless VUK is available

Previously libaacs discarded unit keys when e.g. config file had 1 unit
key and the disc had 2 or more. This is fine when we have VUK or MK+VID
available. However, when VUK is not available, discarding unit key means
that the disc can't be decrypted.
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 0f43f180
Pipeline #19239 passed with stage
in 1 minute and 56 seconds
......@@ -832,8 +832,8 @@ static void _find_config_entry(AACS *aacs, title_entry_list *ce,
ukcursor = ukcursor->next;
}
/* check against Unit_Key_RO.inf */
if (num_uks != aacs->uk->num_uk) {
/* check against Unit_Key_RO.inf, only discard incorrect amount of UKs if VUK or MK+VID is available */
if ((num_uks != aacs->uk->num_uk) && (memcmp(ce->entry.vuk, empty_key, 16) || (ce->entry.vid && ce->entry.mek))) {
BD_DEBUG(DBG_CRIT | DBG_AACS, "Ignoring unit keys from config file (expected %u keys, found %u)\n",
aacs->uk->num_uk, num_uks);
return;
......@@ -841,6 +841,11 @@ static void _find_config_entry(AACS *aacs, title_entry_list *ce,
/* get keys */
if (num_uks > aacs->uk->num_uk) {
/* config file has more unit keys than the disc has */
aacs->uk->num_uk = num_uks;
}
aacs->uk->uk = calloc(aacs->uk->num_uk, sizeof(aacs->uk->uk[0]));
if (!aacs->uk->uk) {
return;
......@@ -858,6 +863,13 @@ static void _find_config_entry(AACS *aacs, title_entry_list *ce,
num_uks++;
ukcursor = ukcursor->next;
}
/* set missing unit keys to 0 */
while (num_uks < aacs->uk->num_uk) {
memcpy(aacs->uk->uk[num_uks].key, empty_key, 16);
num_uks++;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment