1
Fork 0
mirror of https://github.com/naehrwert/scetool.git synced 2025-04-24 21:57:45 +00:00

Updated to v.0.2.14

- Added PS3 Linux support.
- Fixed ECDSA checking.
This commit is contained in:
Sorvigolova 2015-04-06 14:04:40 +03:00
parent 3aec982aa5
commit 5a46f2f1b3
3 changed files with 36 additions and 4 deletions

View file

@ -85,6 +85,9 @@ OPTIONS Possible Values Explanation
-j, --np-add-sig TRUE/FALSE(default) Whether to add a NP sig. or not.
==> History <==
Version 0.2.14
- Added PS3 Linux support.
- Fixed ECDSA checking.
Version 0.2.13
- Unlocked decryption for self files with network license type.
- Fixed one minor bug with capability flags.

View file

@ -119,6 +119,9 @@ void _print_sce_signature(FILE *fp, signature_t *sig)
void _print_sce_signature_status(FILE *fp, sce_buffer_ctxt_t *ctxt, u8 *keyset)
{
u8 hash[0x14];
u8 Q[0x28];
u8 M[0x14];
u8 zero_buf[0x14];
keyset_t *ks;
//Check if a keyset is provided.
@ -134,11 +137,25 @@ void _print_sce_signature_status(FILE *fp, sce_buffer_ctxt_t *ctxt, u8 *keyset)
}
//Generate header hash.
sha1(ctxt->scebuffer, _ES64(ctxt->metah->sig_input_length), hash);
//Validate the signature.
_hexdump(fp, " E", 0, hash, 0x14, FALSE);
ecdsa_set_curve(ks->ctype);
ecdsa_set_pub(ks->pub);
fprintf(fp, "[*] Signature status: %s\n", (ecdsa_verify(hash, ctxt->sig->r, ctxt->sig->s) == TRUE ? "OK" : "FAIL"));
#ifdef CONFIG_PRIVATE_BUILD
//validate private key and calculate M
ec_priv_to_pub(ks->priv, Q);
get_m(ctxt->sig->r, ctxt->sig->s, hash, ks->priv, M);
if (memcmp(ks->pub, Q, sizeof(Q)) == 0)
_hexdump (fp, " M", 0, M, 0x14, FALSE);
#endif
//Validate the signature.
memset(zero_buf, 0, sizeof(zero_buf));
if ((memcmp(ctxt->sig->r, zero_buf, sizeof(zero_buf)) == 0) || (memcmp(ctxt->sig->s, zero_buf, sizeof(zero_buf)) == 0))
fprintf(fp, "[*] Signature status: FAIL\n");
else
fprintf(fp, "[*] Signature status: %s\n", (ecdsa_verify(hash, ctxt->sig->r, ctxt->sig->s) == TRUE ? "OK" : "FAIL"));
}
static sce_buffer_ctxt_t *_sce_create_ctxt()
@ -1025,4 +1042,4 @@ opt_header_t *sce_get_opt_header(sce_buffer_ctxt_t *ctxt, u32 type)
}
return NULL;
}
}

View file

@ -38,6 +38,10 @@ typedef unsigned long long int u64;
#define _ES16(val) \
((u16)(((((u16)val) & 0xff00) >> 8) | \
((((u16)val) & 0x00ff) << 8)))
#ifdef __BIG_ENDIAN__
#define _ES16(val) val
#endif
//Endian swap for u32.
#define _ES32(val) \
@ -45,6 +49,10 @@ typedef unsigned long long int u64;
((((u32)val) & 0x00ff0000) >> 8 ) | \
((((u32)val) & 0x0000ff00) << 8 ) | \
((((u32)val) & 0x000000ff) << 24)))
#ifdef __BIG_ENDIAN__
#define _ES32(val) val
#endif
//Endian swap for u64.
#define _ES64(val) \
@ -57,6 +65,10 @@ typedef unsigned long long int u64;
((((u64)val) & 0x000000000000ff00ull) << 40) | \
((((u64)val) & 0x00000000000000ffull) << 56)))
#ifdef __BIG_ENDIAN__
#define _ES64(val) val
#endif
#ifdef __cplusplus
}
#endif