1 /*---------------------------------------------------------------------------*
2   Project:  NitroSDK - CRYPTO - demos
3   File:     main.c
4 
5   Copyright 2003-2008 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Date:: 2008-09-17#$
14   $Rev: 8556 $
15   $Author: okubata_ryoma $
16  *---------------------------------------------------------------------------*/
17 /*---------------------------------------------------------------------------*
18   The electronic signature specific functions in the CRYPT library operation test demo
19  *---------------------------------------------------------------------------*/
20 
21 #include <nitro.h>
22 #include <nitro/crypto.h>
23 
24 //#define PRINT_ALLOCATION
25 
26 static void InitializeAllocateSystem(void);
27 static void VBlankIntr(void);
28 static void DisplayInit(void);
29 static void FillScreen(u16 col);
30 static BOOL SignTest(void);
31 static u32 GetStringLength(char* str);
32 static void PrintBinary(u8* ptr, int len);
33 
34 /*---------------------------------------------------------------------------*
35     Variable Definitions
36  *---------------------------------------------------------------------------*/
37 
38 #ifdef PRINT_ALLOCATION
39 static u32 total_allocated_size = 0;
40 #endif
41 
42 /*---------------------------------------------------------------------------*
43     Function Definitions
44  *---------------------------------------------------------------------------*/
45 
46 /*---------------------------------------------------------------------------*
47   Name:         MyAlloc
48 
49   Description:  OS_Alloc wrapper function
50  *---------------------------------------------------------------------------*/
MyAlloc(u32 size)51 static void* MyAlloc(u32 size)
52 {
53     void* ptr;
54 #ifdef PRINT_ALLOCATION
55     ptr = OS_Alloc(size+4);
56     *(u32*)ptr = size;
57     (u8*)ptr += 4;
58     total_allocated_size += size;
59     OS_TPrintf("Allocate %d bytes from %p: total %d bytes\n", size, ptr, total_allocated_size);
60 #else
61     ptr = OS_Alloc(size);
62 #endif
63     return ptr;
64 }
65 
66 /*---------------------------------------------------------------------------*
67   Name:         MyFree
68 
69   Description:  OS_Free wrapper function
70  *---------------------------------------------------------------------------*/
MyFree(void * ptr)71 static void MyFree(void* ptr)
72 {
73 #ifdef PRINT_ALLOCATION
74     u32 size;
75     (u8*)ptr -= 4;
76     size = *(u32*)ptr;
77     total_allocated_size -= size;
78     OS_TPrintf("Free %d bytes from %p: total %d bytes\n", size, ptr, total_allocated_size);
79 #endif
80     OS_Free(ptr);
81 }
82 
83 /*---------------------------------------------------------------------------*
84   Name:         NitroMain
85 
86   Description:  Initialization and main loop.
87 
88   Arguments:    None.
89 
90   Returns:      None.
91  *---------------------------------------------------------------------------*/
NitroMain(void)92 void NitroMain(void)
93 {
94     // Various types of initialization
95     OS_Init();
96     InitializeAllocateSystem();
97 
98     DisplayInit();
99 
100     if (SignTest())
101     {
102         // Success
103         OS_TPrintf("------ Test Succeeded ------\n");
104         FillScreen(GX_RGB(0, 31, 0));
105     }
106     else
107     {
108         // Failed
109         OS_TPrintf("****** Test Failed ******\n");
110         FillScreen(GX_RGB(31, 0, 0));
111     }
112 
113     // Main loop
114     while (TRUE)
115     {
116         // Waiting for the V-Blank
117         OS_WaitVBlankIntr();
118     }
119 }
120 
121 /*---------------------------------------------------------------------------*
122   Name:         VBlankIntr
123 
124   Description:  V-Blank interrupt vector.
125 
126   Arguments:    None.
127 
128   Returns:      None.
129  *---------------------------------------------------------------------------*/
VBlankIntr(void)130 static void VBlankIntr(void)
131 {
132     // Sets the IRQ check flag
133     OS_SetIrqCheckFlag(OS_IE_V_BLANK);
134 }
135 
136 /*---------------------------------------------------------------------------*
137   Name:         InitializeAllocateSystem
138 
139   Description:  Initializes the memory allocation system within the main memory arena.
140 
141   Arguments:    None.
142 
143   Returns:      None.
144  *---------------------------------------------------------------------------*/
InitializeAllocateSystem(void)145 static void InitializeAllocateSystem(void)
146 {
147     void *tempLo;
148     OSHeapHandle hh;
149 
150     tempLo = OS_InitAlloc(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi(), 1);
151     OS_SetArenaLo(OS_ARENA_MAIN, tempLo);
152     hh = OS_CreateHeap(OS_ARENA_MAIN, OS_GetMainArenaLo(), OS_GetMainArenaHi());
153     if (hh < 0)
154     {
155         OS_Panic("ARM9: Fail to create heap...\n");
156     }
157     hh = OS_SetCurrentHeap(OS_ARENA_MAIN, hh);
158 }
159 
160 /*---------------------------------------------------------------------------*
161   Name:         DisplayInit
162 
163   Description:  Graphics initialization.
164 
165   Arguments:    None.
166 
167   Returns:      None.
168  *---------------------------------------------------------------------------*/
DisplayInit(void)169 static void DisplayInit(void)
170 {
171 
172     GX_Init();
173     FX_Init();
174 
175     GX_DispOff();
176     GXS_DispOff();
177 
178     GX_SetDispSelect(GX_DISP_SELECT_SUB_MAIN);
179 
180     OS_SetIrqFunction(OS_IE_V_BLANK, VBlankIntr);
181     (void)OS_EnableIrqMask(OS_IE_V_BLANK);
182     (void)GX_VBlankIntr(TRUE);         // To generate V-Blank interrupt request
183     (void)OS_EnableIrq();
184 
185 
186     GX_SetBankForLCDC(GX_VRAM_LCDC_ALL);
187     MI_CpuClearFast((void *)HW_LCDC_VRAM, HW_LCDC_VRAM_SIZE);
188 
189     MI_CpuFillFast((void *)HW_OAM, 192, HW_OAM_SIZE);   // Clear OAM
190     MI_CpuClearFast((void *)HW_PLTT, HW_PLTT_SIZE);     // Clear the standard palette
191 
192     MI_CpuFillFast((void *)HW_DB_OAM, 192, HW_DB_OAM_SIZE);     // Clear OAM
193     MI_CpuClearFast((void *)HW_DB_PLTT, HW_DB_PLTT_SIZE);       // Clear the standard palette
194     MI_DmaFill32(3, (void *)HW_LCDC_VRAM_C, 0x7FFF7FFF, 256 * 192 * sizeof(u16));
195 
196 
197     GX_SetBankForOBJ(GX_VRAM_OBJ_256_AB);       // Set VRAM-A,B for OBJ
198 
199     GX_SetGraphicsMode(GX_DISPMODE_VRAM_C,      // VRAM mode
200                        (GXBGMode)0,    // Dummy
201                        (GXBG0As)0);    // Dummy
202 
203     GX_SetVisiblePlane(GX_PLANEMASK_OBJ);       // Make OBJs visible
204     GX_SetOBJVRamModeBmp(GX_OBJVRAMMODE_BMP_1D_128K);   // 2D mapping OBJ
205 
206     OS_WaitVBlankIntr();              // Waiting for the end of the V-Blank interrupt
207     GX_DispOn();
208 
209 }
210 
211 
212 /*---------------------------------------------------------------------------*
213   Name:         FillScreen
214 
215   Description:  Fills the screen.
216 
217   Arguments:    col: FillColor
218 
219   Returns:      None.
220  *---------------------------------------------------------------------------*/
FillScreen(u16 col)221 static void FillScreen(u16 col)
222 {
223     MI_CpuFill16((void *)HW_LCDC_VRAM_C, col, 256 * 192 * 2);
224 }
225 
226 /*---------------------------------------------------------------------------*
227   Name:         SignTest
228 
229   Description:  Test routine for electronic signature functions.
230 
231   Arguments:    None.
232 
233   Returns:      TRUE if test succeeds.
234  *---------------------------------------------------------------------------*/
235 #define PrintResultEq( a, b, f ) \
236     { OS_TPrintf( ((a) == (b)) ? "[--OK--] " : "[**NG**] " ); (f) = (f) && ((a) == (b)); }
237 
SignTest(void)238 static BOOL SignTest(void)
239 {
240     int i;
241     BOOL flag = TRUE;
242 
243     // Perform electronic signature operation test
244     {
245         char* d[] = {
246             "Copyright 2003-2005 Nintendo.  All rights reserved.",
247             "Copyright 2003-2005 Nintondo.  All rights reserved.", // Modified
248             "Copyright 2003-2005 Nintendo.  All rights reserved.",
249             "Copyright 2003-2005 Nintendo.  All rights reserved.",
250         };
251         unsigned char sign[][128] = {
252             {
253                 0x75, 0xdf, 0x56, 0x82, 0x01, 0x30, 0x0c, 0x6e, 0x91, 0x27, 0x7a, 0x1a, 0x20, 0x2e, 0xd3, 0x29,
254                 0x74, 0xb1, 0x91, 0x6c, 0xb9, 0xcd, 0x6f, 0xda, 0xc1, 0x12, 0x16, 0x5d, 0x49, 0x26, 0x9b, 0x69,
255                 0x44, 0xab, 0xeb, 0x29, 0xee, 0x53, 0x51, 0x55, 0x05, 0x03, 0x35, 0xbf, 0xbb, 0xde, 0x2a, 0xf9,
256                 0x37, 0xed, 0xc7, 0xe2, 0x25, 0x46, 0x26, 0xe5, 0x20, 0x6c, 0x28, 0x13, 0x8d, 0xf6, 0x92, 0x7e,
257                 0x60, 0x35, 0x23, 0xba, 0x7c, 0x61, 0xac, 0x6b, 0xd9, 0x2f, 0x5f, 0x3c, 0x64, 0x44, 0x51, 0x11,
258                 0x36, 0xfe, 0x6e, 0x21, 0x9c, 0x10, 0x1d, 0xe7, 0xba, 0xa1, 0x6e, 0x24, 0x63, 0x3f, 0x42, 0x4a,
259                 0x29, 0xea, 0x3c, 0x7a, 0x8f, 0x99, 0x51, 0x09, 0xf4, 0x0b, 0x01, 0x5a, 0x05, 0x3a, 0x52, 0x53,
260                 0xc9, 0xb7, 0xe4, 0xcc, 0x60, 0xa5, 0x53, 0x1d, 0xeb, 0x79, 0x88, 0x55, 0xc1, 0xb2, 0xfb, 0xd6,
261             },
262             {
263                 0x75, 0xdf, 0x56, 0x82, 0x01, 0x30, 0x0c, 0x6e, 0x91, 0x27, 0x7a, 0x1a, 0x20, 0x2e, 0xd3, 0x29,
264                 0x74, 0xb1, 0x91, 0x6c, 0xb9, 0xcd, 0x6f, 0xda, 0xc1, 0x12, 0x16, 0x5d, 0x49, 0x26, 0x9b, 0x69,
265                 0x44, 0xab, 0xeb, 0x29, 0xee, 0x53, 0x51, 0x55, 0x05, 0x03, 0x35, 0xbf, 0xbb, 0xde, 0x2a, 0xf9,
266                 0x37, 0xed, 0xc7, 0xe2, 0x25, 0x46, 0x26, 0xe5, 0x20, 0x6c, 0x28, 0x13, 0x8d, 0xf6, 0x92, 0x7e,
267                 0x60, 0x35, 0x23, 0xba, 0x7c, 0x61, 0xac, 0x6b, 0xd9, 0x2f, 0x5f, 0x3c, 0x64, 0x44, 0x51, 0x11,
268                 0x36, 0xfe, 0x6e, 0x21, 0x9c, 0x10, 0x1d, 0xe7, 0xba, 0xa1, 0x6e, 0x24, 0x63, 0x3f, 0x42, 0x4a,
269                 0x29, 0xea, 0x3c, 0x7a, 0x8f, 0x99, 0x51, 0x09, 0xf4, 0x0b, 0x01, 0x5a, 0x05, 0x3a, 0x52, 0x53,
270                 0xc9, 0xb7, 0xe4, 0xcc, 0x60, 0xa5, 0x53, 0x1d, 0xeb, 0x79, 0x88, 0x55, 0xc1, 0xb2, 0xfb, 0xd6,
271             },
272             { // Modified
273                 0x57, 0xdf, 0x56, 0x82, 0x01, 0x30, 0x0c, 0x6e, 0x91, 0x27, 0x7a, 0x1a, 0x20, 0x2e, 0xd3, 0x29,
274                 0x74, 0xb1, 0x91, 0x6c, 0xb9, 0xcd, 0x6f, 0xda, 0xc1, 0x12, 0x16, 0x5d, 0x49, 0x26, 0x9b, 0x69,
275                 0x44, 0xab, 0xeb, 0x29, 0xee, 0x53, 0x51, 0x55, 0x05, 0x03, 0x35, 0xbf, 0xbb, 0xde, 0x2a, 0xf9,
276                 0x37, 0xed, 0xc7, 0xe2, 0x25, 0x46, 0x26, 0xe5, 0x20, 0x6c, 0x28, 0x13, 0x8d, 0xf6, 0x92, 0x7e,
277                 0x60, 0x35, 0x23, 0xba, 0x7c, 0x61, 0xac, 0x6b, 0xd9, 0x2f, 0x5f, 0x3c, 0x64, 0x44, 0x51, 0x11,
278                 0x36, 0xfe, 0x6e, 0x21, 0x9c, 0x10, 0x1d, 0xe7, 0xba, 0xa1, 0x6e, 0x24, 0x63, 0x3f, 0x42, 0x4a,
279                 0x29, 0xea, 0x3c, 0x7a, 0x8f, 0x99, 0x51, 0x09, 0xf4, 0x0b, 0x01, 0x5a, 0x05, 0x3a, 0x52, 0x53,
280                 0xc9, 0xb7, 0xe4, 0xcc, 0x60, 0xa5, 0x53, 0x1d, 0xeb, 0x79, 0x88, 0x55, 0xc1, 0xb2, 0xfb, 0xd6,
281             },
282             {
283                 0x75, 0xdf, 0x56, 0x82, 0x01, 0x30, 0x0c, 0x6e, 0x91, 0x27, 0x7a, 0x1a, 0x20, 0x2e, 0xd3, 0x29,
284                 0x74, 0xb1, 0x91, 0x6c, 0xb9, 0xcd, 0x6f, 0xda, 0xc1, 0x12, 0x16, 0x5d, 0x49, 0x26, 0x9b, 0x69,
285                 0x44, 0xab, 0xeb, 0x29, 0xee, 0x53, 0x51, 0x55, 0x05, 0x03, 0x35, 0xbf, 0xbb, 0xde, 0x2a, 0xf9,
286                 0x37, 0xed, 0xc7, 0xe2, 0x25, 0x46, 0x26, 0xe5, 0x20, 0x6c, 0x28, 0x13, 0x8d, 0xf6, 0x92, 0x7e,
287                 0x60, 0x35, 0x23, 0xba, 0x7c, 0x61, 0xac, 0x6b, 0xd9, 0x2f, 0x5f, 0x3c, 0x64, 0x44, 0x51, 0x11,
288                 0x36, 0xfe, 0x6e, 0x21, 0x9c, 0x10, 0x1d, 0xe7, 0xba, 0xa1, 0x6e, 0x24, 0x63, 0x3f, 0x42, 0x4a,
289                 0x29, 0xea, 0x3c, 0x7a, 0x8f, 0x99, 0x51, 0x09, 0xf4, 0x0b, 0x01, 0x5a, 0x05, 0x3a, 0x52, 0x53,
290                 0xc9, 0xb7, 0xe4, 0xcc, 0x60, 0xa5, 0x53, 0x1d, 0xeb, 0x79, 0x88, 0x55, 0xc1, 0xb2, 0xfb, 0xd6,
291             },
292         };
293         unsigned char mod[][128] = {
294             {
295                 0xC4, 0xD0, 0x91, 0x44, 0x0A, 0xC3, 0x3E, 0xB1, 0xCC, 0xF7, 0x84, 0x62, 0x2E, 0xA5, 0x4B, 0xA3,
296                 0xF8, 0xA5, 0x44, 0x38, 0x1F, 0x00, 0x5C, 0x20, 0x54, 0x8A, 0x84, 0xF2, 0x5E, 0xEB, 0x5B, 0x09,
297                 0xA2, 0x80, 0x3F, 0x79, 0x5F, 0x11, 0x41, 0x21, 0xEA, 0x24, 0x47, 0xC5, 0xE8, 0x16, 0x46, 0x18,
298                 0xCA, 0x75, 0x08, 0x39, 0xAC, 0xCF, 0x17, 0x20, 0x4E, 0x8F, 0x68, 0xB6, 0xD5, 0x25, 0x1F, 0x61,
299                 0x2E, 0xD6, 0xC9, 0x63, 0x41, 0xA9, 0xC9, 0x78, 0x1D, 0x73, 0x34, 0xC9, 0x4F, 0xBB, 0x4C, 0x3C,
300                 0xB2, 0x6C, 0xCF, 0x87, 0xB7, 0x95, 0x66, 0xD3, 0x1A, 0xDE, 0x3F, 0xF8, 0x52, 0x3E, 0xDC, 0x82,
301                 0x35, 0x7C, 0x58, 0x7C, 0x10, 0x35, 0xB0, 0xFF, 0x5A, 0xF6, 0x1F, 0xD3, 0x0B, 0x9C, 0x49, 0x76,
302                 0x71, 0xE2, 0x4E, 0x69, 0x58, 0x54, 0x42, 0xA3, 0x3F, 0x93, 0x78, 0x58, 0xC6, 0xE0, 0x74, 0x0B,
303             },
304             {
305                 0xC4, 0xD0, 0x91, 0x44, 0x0A, 0xC3, 0x3E, 0xB1, 0xCC, 0xF7, 0x84, 0x62, 0x2E, 0xA5, 0x4B, 0xA3,
306                 0xF8, 0xA5, 0x44, 0x38, 0x1F, 0x00, 0x5C, 0x20, 0x54, 0x8A, 0x84, 0xF2, 0x5E, 0xEB, 0x5B, 0x09,
307                 0xA2, 0x80, 0x3F, 0x79, 0x5F, 0x11, 0x41, 0x21, 0xEA, 0x24, 0x47, 0xC5, 0xE8, 0x16, 0x46, 0x18,
308                 0xCA, 0x75, 0x08, 0x39, 0xAC, 0xCF, 0x17, 0x20, 0x4E, 0x8F, 0x68, 0xB6, 0xD5, 0x25, 0x1F, 0x61,
309                 0x2E, 0xD6, 0xC9, 0x63, 0x41, 0xA9, 0xC9, 0x78, 0x1D, 0x73, 0x34, 0xC9, 0x4F, 0xBB, 0x4C, 0x3C,
310                 0xB2, 0x6C, 0xCF, 0x87, 0xB7, 0x95, 0x66, 0xD3, 0x1A, 0xDE, 0x3F, 0xF8, 0x52, 0x3E, 0xDC, 0x82,
311                 0x35, 0x7C, 0x58, 0x7C, 0x10, 0x35, 0xB0, 0xFF, 0x5A, 0xF6, 0x1F, 0xD3, 0x0B, 0x9C, 0x49, 0x76,
312                 0x71, 0xE2, 0x4E, 0x69, 0x58, 0x54, 0x42, 0xA3, 0x3F, 0x93, 0x78, 0x58, 0xC6, 0xE0, 0x74, 0x0B,
313             },
314             {
315                 0xC4, 0xD0, 0x91, 0x44, 0x0A, 0xC3, 0x3E, 0xB1, 0xCC, 0xF7, 0x84, 0x62, 0x2E, 0xA5, 0x4B, 0xA3,
316                 0xF8, 0xA5, 0x44, 0x38, 0x1F, 0x00, 0x5C, 0x20, 0x54, 0x8A, 0x84, 0xF2, 0x5E, 0xEB, 0x5B, 0x09,
317                 0xA2, 0x80, 0x3F, 0x79, 0x5F, 0x11, 0x41, 0x21, 0xEA, 0x24, 0x47, 0xC5, 0xE8, 0x16, 0x46, 0x18,
318                 0xCA, 0x75, 0x08, 0x39, 0xAC, 0xCF, 0x17, 0x20, 0x4E, 0x8F, 0x68, 0xB6, 0xD5, 0x25, 0x1F, 0x61,
319                 0x2E, 0xD6, 0xC9, 0x63, 0x41, 0xA9, 0xC9, 0x78, 0x1D, 0x73, 0x34, 0xC9, 0x4F, 0xBB, 0x4C, 0x3C,
320                 0xB2, 0x6C, 0xCF, 0x87, 0xB7, 0x95, 0x66, 0xD3, 0x1A, 0xDE, 0x3F, 0xF8, 0x52, 0x3E, 0xDC, 0x82,
321                 0x35, 0x7C, 0x58, 0x7C, 0x10, 0x35, 0xB0, 0xFF, 0x5A, 0xF6, 0x1F, 0xD3, 0x0B, 0x9C, 0x49, 0x76,
322                 0x71, 0xE2, 0x4E, 0x69, 0x58, 0x54, 0x42, 0xA3, 0x3F, 0x93, 0x78, 0x58, 0xC6, 0xE0, 0x74, 0x0B,
323             },
324             { // Modified
325                 0xC4, 0xD0, 0x91, 0x44, 0x0A, 0xC3, 0x3E, 0xB1, 0xCC, 0xF7, 0x84, 0x62, 0x2E, 0xA5, 0x4B, 0xA3,
326                 0xF8, 0xA5, 0x44, 0x38, 0x1F, 0x00, 0x5C, 0x20, 0x54, 0x8A, 0x84, 0xF2, 0x5E, 0xEB, 0x5B, 0x09,
327                 0xA2, 0x80, 0x3F, 0x79, 0x5F, 0x11, 0x41, 0x21, 0xEA, 0x24, 0x47, 0xC5, 0xE8, 0x16, 0x46, 0x18,
328                 0xCA, 0x75, 0x08, 0x39, 0xAC, 0xCF, 0x17, 0x20, 0x4E, 0x8F, 0x68, 0xB6, 0xD5, 0x25, 0x1F, 0x61,
329                 0x2E, 0xD6, 0xC9, 0x63, 0x41, 0xA9, 0xC9, 0x78, 0x1D, 0x73, 0x34, 0xC9, 0x4F, 0xBB, 0x4C, 0x3C,
330                 0xB2, 0x6C, 0xCF, 0x87, 0xB7, 0x95, 0x66, 0xD3, 0x1A, 0xDE, 0x3F, 0xF8, 0x52, 0x3E, 0xDC, 0x82,
331                 0x35, 0x7C, 0x58, 0x7C, 0x10, 0x35, 0xB0, 0xFF, 0x5A, 0xF6, 0x1F, 0xD3, 0x0B, 0x9C, 0x49, 0x76,
332                 0x71, 0xE2, 0x4E, 0x69, 0x58, 0x54, 0x42, 0xA3, 0x3F, 0x93, 0x78, 0x58, 0xC6, 0xE0, 0x74, 0x06,
333             },
334         };
335         BOOL result_sign[] = {
336             TRUE,
337             FALSE,
338             FALSE,
339             FALSE,
340         };
341 
342         CRYPTO_SetAllocator(MyAlloc, MyFree);
343 
344         for (i = 0; i < sizeof(d) / sizeof(char*); i++)
345         {
346             BOOL result;
347             result = CRYPTO_VerifySignature(d[i], (int)GetStringLength(d[i]), sign[i], mod[i]);
348             PrintResultEq(result, result_sign[i], flag);
349             OS_TPrintf("CRYPTO_VerifySignature: Test Case %d: %s\n", i+1, result ? "Verified" : "Verification Failure");
350         }
351     }
352 
353 
354 
355 
356 
357     return flag;
358 }
359 
360 
361 /*---------------------------------------------------------------------------*
362   Name:         GetStringLength
363 
364   Description:  Gets the length of a string.
365 
366   Arguments:    str: Pointer to a string
367 
368   Returns:      Length of string
369  *---------------------------------------------------------------------------*/
GetStringLength(char * str)370 static u32 GetStringLength(char* str)
371 {
372     u32 i;
373     for (i = 0; ; i++)
374     {
375         if (*(str++) == '\0')
376         {
377             return i;
378         }
379     }
380 }
381 
382 /*---------------------------------------------------------------------------*
383   Name:         PrintBinary
384 
385   Description:  Binary array output.
386 
387   Arguments:    ptr: Memory location to be output
388                 len: Output length
389 
390   Returns:      None.
391  *---------------------------------------------------------------------------*/
PrintBinary(u8 * ptr,int len)392 static void PrintBinary(u8* ptr, int len)
393 {
394 #ifndef SDK_FINALROM
395     int i;
396     for (i = 0; i < len; i++)
397     {
398         if (i != 0)
399         {
400             OS_PutString(":");
401         }
402         OS_TPrintf("%02x", ptr[i]);
403     }
404 #else
405 #pragma unused(ptr,len)
406 #endif
407     return;
408 }
409 
410 /*---------------------------------------------------------------------------*
411   End of file
412  *---------------------------------------------------------------------------*/
413