1
0
Fork 0
mirror of https://github.com/DarkMatterCore/nxdumptool.git synced 2024-11-22 18:26:39 +00:00

tik: look, I'm tired, I don't know what to say.

I don't even know what I'm thinking anymore. I'm frustrated.
This commit is contained in:
Pablo Curiel 2023-05-25 01:19:44 +02:00
parent e63c7ff939
commit cf71f3e484

View file

@ -168,7 +168,7 @@ bool tikConvertPersonalizedTicketToCommonTicket(Ticket *tik, u8 **out_raw_cert_c
u8 *signature = NULL; u8 *signature = NULL;
u64 signature_size = 0; u64 signature_size = 0;
bool generate_cert = false, dev_cert = false; bool dev_cert = false;
char cert_chain_issuer[0x40] = {0}; char cert_chain_issuer[0x40] = {0};
static const char *common_cert_names[] = { "XS00000020", "XS00000022", NULL }; static const char *common_cert_names[] = { "XS00000020", "XS00000022", NULL };
@ -183,10 +183,7 @@ bool tikConvertPersonalizedTicketToCommonTicket(Ticket *tik, u8 **out_raw_cert_c
return false; return false;
} }
/* Generate raw certificate chain for the new signature issuer (common), if needed. */ /* Generate raw certificate chain for the new signature issuer (common). */
generate_cert = (out_raw_cert_chain && out_raw_cert_chain_size);
if (generate_cert)
{
dev_cert = (strstr(tik_common_block->issuer, "CA00000004") != NULL); dev_cert = (strstr(tik_common_block->issuer, "CA00000004") != NULL);
for(u8 i = 0; common_cert_names[i] != NULL; i++) for(u8 i = 0; common_cert_names[i] != NULL; i++)
@ -201,7 +198,6 @@ bool tikConvertPersonalizedTicketToCommonTicket(Ticket *tik, u8 **out_raw_cert_c
LOG_MSG_ERROR("Failed to generate raw certificate chain for common ticket signature issuer!"); LOG_MSG_ERROR("Failed to generate raw certificate chain for common ticket signature issuer!");
return false; return false;
} }
}
/* Wipe signature. */ /* Wipe signature. */
sig_type = signatureGetSigType(tik->data, false); sig_type = signatureGetSigType(tik->data, false);
@ -235,11 +231,8 @@ bool tikConvertPersonalizedTicketToCommonTicket(Ticket *tik, u8 **out_raw_cert_c
memset(tik->data + tik->size, 0, SIGNED_TIK_MAX_SIZE - tik->size); memset(tik->data + tik->size, 0, SIGNED_TIK_MAX_SIZE - tik->size);
/* Update output pointers. */ /* Update output pointers. */
if (generate_cert) if (out_raw_cert_chain) *out_raw_cert_chain = raw_cert_chain;
{ if (out_raw_cert_chain_size) *out_raw_cert_chain_size = raw_cert_chain_size;
*out_raw_cert_chain = raw_cert_chain;
*out_raw_cert_chain_size = raw_cert_chain_size;
}
return true; return true;
} }