mirror of
https://github.com/rvtr/twl_wrapsdk.git
synced 2025-06-18 14:25:43 -04:00

git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/twl_wrapsdk/trunk@331 4ee2a332-4b2b-5046-8439-1ba90f034370
143 lines
4.6 KiB
C
143 lines
4.6 KiB
C
/*---------------------------------------------------------------------------*
|
||
Project: TwlSDK - OS - include
|
||
File: systemCall.h
|
||
|
||
Copyright 2007 Nintendo. All rights reserved.
|
||
|
||
These coded instructions, statements, and computer programs contain
|
||
proprietary information of Nintendo of America Inc. and/or Nintendo
|
||
Company Ltd., and are protected by Federal copyright law. They may
|
||
not be disclosed to third parties or copied or duplicated in any form,
|
||
in whole or in part, without the prior written consent of Nintendo.
|
||
|
||
$Log: $
|
||
$NoKeywords: $
|
||
*---------------------------------------------------------------------------*/
|
||
|
||
#ifndef TWL_OS_SYSTEMCALL_H_
|
||
#define TWL_OS_SYSTEMCALL_H_
|
||
|
||
#define SVC_SHA1_DIGEST_SIZE 20
|
||
#define SVC_SHA1_BLOCK_SIZE 64
|
||
#define SVC_RSA1024_BLOCK_SIZE 128
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
typedef struct
|
||
{
|
||
u32* head;
|
||
u32* tail;
|
||
u32 size;
|
||
}
|
||
SVCSignHeapContext;
|
||
|
||
typedef struct SVCSHA1Context
|
||
{
|
||
u32 h0,h1,h2,h3,h4;
|
||
u32 Nl,Nh;
|
||
u32 data[16];
|
||
int num;
|
||
void (*sha_block)(struct SVCSHA1Context *c, const u8 *W, int num);
|
||
}
|
||
SVCSHA1Context;
|
||
|
||
typedef struct SVCHMACSHA1Context
|
||
{
|
||
SVCSHA1Context sha1_ctx;
|
||
u8 key[SVC_SHA1_BLOCK_SIZE];
|
||
u32 keylen;
|
||
}
|
||
SVCHMACSHA1Context;
|
||
|
||
typedef struct
|
||
{
|
||
void* output;
|
||
const void* input;
|
||
const void* key;
|
||
}
|
||
SVCSignBuffers;
|
||
|
||
|
||
void SVC_InitSignHeap(
|
||
SVCSignHeapContext* acmemory_pool,
|
||
void* heap,
|
||
u32 len
|
||
);
|
||
|
||
int SVC_DecryptRSA(
|
||
const SVCSignHeapContext* acmemory_pool,
|
||
const SVCSignBuffers* pData,
|
||
u32* len // <20>o—̓TƒCƒY
|
||
);
|
||
|
||
int SVC_DecryptSign(
|
||
const SVCSignHeapContext* acmemory_pool,
|
||
void* buffer, // <20>o—͗̈æ
|
||
const void* sgn_ptr, // ƒf<C692>[ƒ^‚ւ̃|ƒCƒ“ƒ^
|
||
const void* key_ptr // ƒL<C692>[‚ւ̃|ƒCƒ“ƒ^
|
||
);
|
||
|
||
int SVC_DecryptSignDER(
|
||
const SVCSignHeapContext* acmemory_pool,
|
||
void* buffer, // <20>o—͗̈æ
|
||
const void* sgn_ptr, // ƒf<C692>[ƒ^‚ւ̃|ƒCƒ“ƒ^
|
||
const void* key_ptr // ƒL<C692>[‚ւ̃|ƒCƒ“ƒ^
|
||
);
|
||
|
||
void SVC_SHA1Init( SVCSHA1Context *ctx );
|
||
void SVC_SHA1Update( SVCSHA1Context *ctx, const void *data, u32 len );
|
||
void SVC_SHA1GetHash( SVCSHA1Context *ctx, void *md );
|
||
|
||
void SVC_CalcSHA1(
|
||
void* md, // <20>o—͗̈æ
|
||
const void* data, // ƒf<C692>[ƒ^‚ւ̃|ƒCƒ“ƒ^
|
||
u32 len // ƒf<C692>[ƒ^‚Ì’·‚³
|
||
);
|
||
|
||
int SVC_CompareSHA1(
|
||
const void* decedHash, // SVC_Decrypto*‚Ì<E2809A>o—Í
|
||
const void* digest // SVC_GetDigest‚Ì<E2809A>o—Í
|
||
);
|
||
|
||
int SVC_RandomSHA1(
|
||
void* dest_ptr, // <20>o—̓f<C692>[ƒ^‚ւ̃|ƒCƒ“ƒ^
|
||
u32 dest_len, // <20>o—̓f<C692>[ƒ^‚Ì’·‚³
|
||
const void* src_ptr, // “ü—̓f<C692>[ƒ^‚ւ̃|ƒCƒ“ƒ^
|
||
u32 src_len // “ü—̓f<C692>[ƒ^‚Ì’·‚³
|
||
);
|
||
|
||
s32 SVC_UncompressLZ8FromDevice( const void* srcp,
|
||
void* destp,
|
||
const void* paramp,
|
||
const MIReadStreamCallbacks *callbacks
|
||
);
|
||
|
||
s32 SVC_UncompressLZ16FromDeviceIMG( const void* srcp,
|
||
void* destp,
|
||
const void* paramp,
|
||
const MIReadStreamCallbacks *callbacks
|
||
);
|
||
|
||
void SVC_HMACSHA1Init( SVCHMACSHA1Context *ctx, const void *key, u32 keylen );
|
||
void SVC_HMACSHA1Update( SVCHMACSHA1Context *ctx, const void *data, u32 len );
|
||
void SVC_HMACSHA1GetHash( SVCHMACSHA1Context *ctx, void* md );
|
||
void SVC_CalcHMACSHA1( void* md, const void* data, u32 len, const void* key, u32 keylen );
|
||
|
||
// internal
|
||
|
||
int SVCi_DecryptSign(
|
||
const SVCSignHeapContext* acmemory_pool,
|
||
void* buffer, // <20>o—͗̈æ
|
||
const void* sgn_ptr, // ƒf<C692>[ƒ^‚ւ̃|ƒCƒ“ƒ^
|
||
const void* key_ptr // ƒL<C692>[‚ւ̃|ƒCƒ“ƒ^
|
||
);
|
||
|
||
#ifdef __cplusplus
|
||
} /* extern "C" */
|
||
#endif
|
||
|
||
/* TWL_OS_SYSTEMCALL_H_ */
|
||
#endif
|