View Issue Details

IDProjectCategoryView StatusLast Update
0000620filegeneralpublic2017-06-11 22:27
ReporterDavid Korth 
Assigned ToChristos Zoulas 
PrioritynormalSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
Product Version5.31 
Target VersionFixed in VersionHEAD 
Summary0000620: Some more magic: Nintendo DS Secure Area; PNG CgBI
DescriptionThese two patches add detection for the following:
1. Nintendo DS: Determine the type of Secure Area. Dumped ROMs typically have decrypted secure areas for use with flashcards and emulators. Original ROMs have encrypted secure areas. Homebrew ROMs usually don't use the secure area at all.
2. PNG: Handle iOS-"optimized" PNG images. These have an extra CgBI chunk before the IHDR chunk.
TagsNo tags attached.

Relationships

Activities

David Korth

David Korth

2017-06-10 22:53

reporter  

file.2017-06-04.23-30.nds-secure-area.diff (963 bytes)
commit f4274fe6b6304448861ffeff09182b2c11ff6f01
Author: David Korth <gerbilsoft@gerbilsoft.com>
Date:   Sat Feb 18 14:40:16 2017 -0500

    console: Added the secure area type for Nintendo DS ROMs.

diff --git a/magic/Magdir/console b/magic/Magdir/console
index 0d98a7ae..52bbc4a6 100644
--- a/magic/Magdir/console
+++ b/magic/Magdir/console
@@ -413,6 +413,15 @@
 >0x1E	byte	x		\b, Rev.%02u)
 >0x12	byte	2		(DSi enhanced)
 >0x12	byte	3		(DSi only)
+# Secure Area check.
+>0x20		lelong	<0x4000		(homebrew)
+>0x20		lelong	>0x3FFF
+>>0x4000	lequad	0x0000000000000000	(multiboot)
+>>0x4000	lequad	!0x0000000000000000
+>>>0x4000	lequad	0xE7FFDEFFE7FFDEFF	(decrypted)
+>>>0x4000	lequad	!0xE7FFDEFFE7FFDEFF
+>>>>0x1000	lequad	0x0000000000000000	(encrypted)
+>>>>0x1000	lequad	!0x0000000000000000	(mask ROM)
 
 #------------------------------------------------------------------------------
 # nds_passme: file(1) magic for Nintendo DS ROM images for GBA cartridge boot.
file.2017-06-04.23-30.png-cgbi.diff (1,657 bytes)
commit 917ac176e6dbe0f4b551f288a7cdbe8fa1ecda6f
Author: David Korth <gerbilsoft@gerbilsoft.com>
Date:   Sun Jun 4 23:29:07 2017 -0400

    images: Add support for iOS PNG images. (CgBI chunk)

diff --git a/magic/Magdir/images b/magic/Magdir/images
index d14c1de1..8c30e71e 100644
--- a/magic/Magdir/images
+++ b/magic/Magdir/images
@@ -418,22 +418,35 @@
 # (Greg Roelofs, newt@uchicago.edu)
 # (Albert Cahalan, acahalan@cs.uml.edu)
 #
-# 137 P N G \r \n ^Z \n [4-byte length] H E A D [HEAD data] [HEAD crc] ...
+# 137 P N G \r \n ^Z \n [4-byte length] I H D R [HEAD data] [HEAD crc] ...
 #
-0	string		\x89PNG\x0d\x0a\x1a\x0a		PNG image data
+
+# IHDR parser
+0	name		png-ihdr
+>0	belong		x		\b, %d x
+>4	belong		x		%d,
+>8	byte		x		%d-bit
+>9	byte		0		grayscale,
+>9	byte		2		\b/color RGB,
+>9	byte		3		colormap,
+>9	byte		4		gray+alpha,
+>9	byte		6		\b/color RGBA,
+#>10	byte		0		deflate/32K,
+>12	byte		0		non-interlaced
+>12	byte		1		interlaced
+
+# Standard PNG image.
+0	string		\x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0DIHDR	PNG image data
+!:mime	image/png
+!:strength +10
+>16	use		png-ihdr
+
+# Apple CgBI PNG image.
+0	string		\x89PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x04CgBI
+>24	string  	\x00\x00\x00\x0DIHDR	PNG image data (CgBI)
 !:mime	image/png
 !:strength +10
->16	belong		x		\b, %d x
->20	belong		x		%d,
->24	byte		x		%d-bit
->25	byte		0		grayscale,
->25	byte		2		\b/color RGB,
->25	byte		3		colormap,
->25	byte		4		gray+alpha,
->25	byte		6		\b/color RGBA,
-#>26	byte		0		deflate/32K,
->28	byte		0		non-interlaced
->28	byte		1		interlaced
+>>32	use		png-ihdr
 
 # possible GIF replacements; none yet released!
 # (Greg Roelofs, newt@uchicago.edu)
Christos Zoulas

Christos Zoulas

2017-06-11 22:27

manager   ~0001536

Added, thanks!

Issue History

Date Modified Username Field Change
2017-06-10 22:53 David Korth New Issue
2017-06-10 22:53 David Korth File Added: file.2017-06-04.23-30.nds-secure-area.diff
2017-06-10 22:53 David Korth File Added: file.2017-06-04.23-30.png-cgbi.diff
2017-06-11 22:27 Christos Zoulas Assigned To => Christos Zoulas
2017-06-11 22:27 Christos Zoulas Status new => assigned
2017-06-11 22:27 Christos Zoulas Status assigned => resolved
2017-06-11 22:27 Christos Zoulas Resolution open => fixed
2017-06-11 22:27 Christos Zoulas Fixed in Version => HEAD
2017-06-11 22:27 Christos Zoulas Note Added: 0001536