00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __UTILS_H__
00015 #define __UTILS_H__
00016
00017 #include <psptypes.h>
00018
00019 #ifdef __cplusplus
00020 extern "C" {
00021 #endif
00022
00023
00024
00025
00031
00032 #include <sys/time.h>
00033
00038 time_t sceKernelLibcTime(time_t *t);
00039
00043 clock_t sceKernelLibcClock(void);
00044
00048 int sceKernelLibcGettimeofday(struct timeval *tp, struct timezone *tzp);
00049
00053 void sceKernelDcacheWritebackAll(void);
00054
00058 void sceKernelDcacheWritebackInvalidateAll(void);
00059
00061 typedef struct _SceKernelUtilsMt19937Context {
00062 unsigned int count;
00063 unsigned int state[624];
00064 } SceKernelUtilsMt19937Context;
00065
00081 int sceKernelUtilsMt19937Init(SceKernelUtilsMt19937Context *ctx, u32 seed);
00082
00089 u32 sceKernelUtilsMt19937UInt(SceKernelUtilsMt19937Context *ctx);
00090
00092 typedef struct _SceKernelUtilsMd5Context {
00093 unsigned int h[4];
00094 unsigned int pad;
00095 short unsigned int usRemains;
00096 short unsigned int usComputed;
00097 long long unsigned int ullTotalLen;
00098 unsigned char buf[64];
00099 } SceKernelUtilsMd5Context;
00100
00110 int sceKernelUtilsMd5Digest(u8 *data, u32 size, u8 *digest);
00111
00127 int sceKernelUtilsMd5BlockInit(SceKernelUtilsMd5Context *ctx);
00128
00138 int sceKernelUtilsMd5BlockUpdate(SceKernelUtilsMd5Context *ctx, u8 *data, u32 size);
00139
00148 int sceKernelUtilsMd5BlockResult(SceKernelUtilsMd5Context *ctx, u8 *digest);
00149
00151 typedef struct _SceKernelUtilsSha1Context {
00152 unsigned int h[5];
00153 short unsigned int usRemains;
00154 short unsigned int usComputed;
00155 long long unsigned int ullTotalLen;
00156 unsigned char buf[64];
00157 } SceKernelUtilsSha1Context;
00158
00168 int sceKernelUtilsSha1Digest(u8 *data, u32 size, u8 *digest);
00169
00186 int sceKernelUtilsSha1BlockInit(SceKernelUtilsSha1Context *ctx);
00187
00197 int sceKernelUtilsSha1BlockUpdate(SceKernelUtilsSha1Context *ctx, u8 *data, u32 size);
00198
00207 int sceKernelUtilsSha1BlockResult(SceKernelUtilsSha1Context *ctx, u8 *digest);
00208
00211 #ifdef __cplusplus
00212 }
00213 #endif
00214
00215 #endif