1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-15 00:16:48 +00:00
Commit graph

457 commits

Author SHA1 Message Date
Michael Scire
366cc5e189 Exosphere: Fix extremely spooky Security Engine bugs, now makes it to the end of package2loader. 2018-05-21 04:30:53 -06:00
TuxSH
b4eeddd7e1 Revamp all the Makefiles (thanks @fincs @WinterMute)
... dependencies are now properly handled (e.g. header changes, etc.)
2018-05-19 01:07:27 +02:00
Michael Scire
9424510f8f Exosphere: Fix remaining crt0 bugs, we now make it to pk2ldr. 2018-05-18 07:16:41 -06:00
Michael Scire
6954925f71 Exosphere: Fix bug, we now make it past MMU enable. 2018-05-18 06:58:49 -06:00
Michael Scire
ea905725c4 Exosphere: Copy initial data image to DRAM for coldboot init. 2018-05-18 06:49:49 -06:00
Michael Scire
1a9f095463 Exosphere: Fix relocation bug (warmboot relocs currently broken in edge case) 2018-05-18 03:10:48 -06:00
TuxSH
5b5d3c69c2 [exosphere] Fix bug in package2.c 2018-05-17 16:15:30 +02:00
TuxSH
3dac6c9268 Fix bug in fusee: package2.c, etc. 2018-05-17 16:11:10 +02:00
TuxSH
912590b2fd [exosphere] linker.ld: remove some unneeded "AT" commands 2018-05-11 16:28:55 +02:00
TuxSH
0d8ba7706d [exosphere] Map the crt0 too 2018-05-11 16:14:12 +02:00
TuxSH
05b8b42164 [exosphere] Rewrite crt0/init and ld script 2018-05-11 14:07:37 +02:00
Michael Scire
02e01360fd Exosphere: Fix crt0 bug resulting in bad relocation calculations 2018-05-10 18:37:11 -06:00
Michael Scire
ba7d0c2cb6 Exosphere: Add API for retrieving versioning info. 2018-05-09 06:29:56 -06:00
Resaec
1c32f1ae34 replacing tabs with spaces 2018-05-01 18:33:39 +02:00
Resaec
5430415578 somehow forgot to rename them 2018-04-28 01:27:16 +02:00
Resaec
dd319debe8 adding comment for uart_wait_idle to warn about a possible dead lock 2018-04-28 01:13:16 +02:00
Resaec
5dcf2cb319 adding UartFifoControl and UartInterruptIdentification for the UART_IIR_FCR_0 register
adding reference manual intem numbers for register enums
2018-04-28 00:58:42 +02:00
Resaec
b6b0073178 minor style fixes 2018-04-28 00:55:28 +02:00
Resaec
e0f586d2d5 change multiline comments, they game (only?) me strange spacing errors in the VS info popup 2018-04-28 00:54:43 +02:00
Resaec
ae69126509 adding UartVendorStatus, UartLineStatus and UartLineControl
refactor defines
edited uart_wait_idle() second parameter type to UartVendorStatus
2018-04-27 23:57:20 +02:00
Resaec
b6b8ca0eac ENUMs for APB Slave Security Enable registers (#67)
Exosphere: add enums for the APB_MISC_SECURE registers.
2018-04-25 09:46:17 -07:00
Naomi Peori
0075a42d39 Changed PACKAGE2_MAXVER_400_CURRENT to PACKAGE2_MAXVER_400_410. (#64)
* Changed PACKAGE2_MAXVER_400_CURRENT to PACKAGE2_MAXVER_400_410.

* Added top-level makefile and a .gitignore for thermosphere build files.
2018-04-23 11:07:49 -07:00
Michael Scire
7ddf5a922c Exosphere: Support unsigned/plaintext Package2s if signature is clear. 2018-04-11 21:56:30 -06:00
Michael Scire
3140ddc301 Reserve AMS0 magic for later use, change to eXosphere Boot Config rev 0 2018-03-25 17:02:24 -06:00
Michael Scire
c2eed3caf6 Integrate 5.x SMC API changes, add 4.x specific setup, implement target firmware selection 2018-03-25 15:05:08 -06:00
TuxSH
171c82ea9e Add build system for fusee 2018-03-14 21:14:02 +01:00
TuxSH
965971edbd Fix off-by-one mkey revision errors 2018-03-14 16:03:16 +01:00
TuxSH
6a0946378a Remove useless "pack" pragmas 2018-03-11 16:32:33 +01:00
TuxSH
52f7adfc50 Add spsr_el3 to cpu_context 2018-03-11 12:53:52 +01:00
Michael Scire
f624cccd0d Fix LP0 TZRAM CMAC calculation 2018-03-10 19:11:58 -08:00
Michael Scire
32bd5b3a73 Fix LP0 entry. Exit still fails in warmboot bin. 2018-03-10 18:57:17 -08:00
Michael Scire
ab2b8e4db5 Fix CpuSuspend not making it to finalize_powerdown() 2018-03-09 23:56:48 -08:00
Michael Scire
c2676c359c Fix CAR primitives 2018-03-09 15:40:11 -08:00
Michael Scire
88c4dfd444 Fix flow controller set functions 2018-03-09 14:56:16 -08:00
TuxSH
3f627798e7 Fix and/bic inversions in finalize_powerdown 2018-03-09 22:56:41 +01:00
TuxSH
3d72183471 Add 4.x configitem stuff 2018-03-09 12:47:58 +01:00
Michael Scire
1ffa239b5a Fix async expMod output + smcUnwrapAesWrappedTitlekey 2018-03-08 19:48:35 -08:00
Michael Scire
7e780301de Fix AES-GCM code. 2018-03-08 17:26:42 -08:00
Michael Scire
8e5228866c Fix smcComputeCmac, generally improve userpage cache usage 2018-03-08 04:59:00 -08:00
Michael Scire
ec8f27f1be Fix AES ECB encryption not encrypting 2018-03-08 03:16:50 -08:00
TuxSH
b35c418558 memcpy(x, NULL, 0) is undefined behavior 2018-03-08 11:17:46 +01:00
Michael Scire
3d8ff446ad Implement BootReason config 2018-03-08 01:48:57 -08:00
TuxSH
ff9322a468 Use and adapt the UART driver from hekate/hwinit 2018-03-08 01:02:45 +01:00
TuxSH
a409016a88 Fix fuse_get_hardware_type for 4.x 2018-03-07 23:24:38 +01:00
TuxSH
d5bb96c0f8 Fix and with mask issue in smc_user.c 2018-03-07 19:24:52 +01:00
Mike H
22f6c27654
Fix up comment 2018-03-07 16:11:53 +00:00
TuxSH
54fac349f2 Fix user_generate_specific_aes_key wrong register use 2018-03-07 15:50:50 +01:00
TuxSH
4f0e8b8467 Fix bug in user_generate_specific_aes_key, add other read/write le/be funcs 2018-03-07 15:11:53 +01:00
TuxSH
71f01aaa43 Fix freudian slip 2018-03-07 14:34:47 +01:00
Michael Scire
6592744b3b Add debug region to mapped memory 2018-03-07 04:00:19 -08:00
Michael Scire
b26b8e1f5c Fix smcConfigureCarveout 2018-03-07 03:45:27 -08:00
Michael Scire
d4c1e0b982 Merge branch 'master' of https://github.com/SciresM/Atmosphere-NX 2018-03-07 03:44:37 -08:00
Michael Scire
11e694d15c Fix SMMU Enable preventing FS from talking to NAND MMIO 2018-03-07 03:37:11 -08:00
TuxSH
d2b1febb43 Implement dbg log interface 2018-03-06 01:29:06 +01:00
TuxSH
a65d380889 Make enum names consistent 2018-03-05 23:59:46 +01:00
TuxSH
827280ca12 Fix lock_try_acquire(&g_is_user_smc_in_progress) calls 2018-03-05 21:07:09 +01:00
Michael Scire
6b10c21a10 Default kernel carveout is ID 4, not 5 2018-03-05 03:27:24 -08:00
TuxSH
5e75d8b2bd Fix func_copy null deref (?) 2018-03-05 09:41:39 +01:00
Michael Scire
ffd0181aa1 Fix Stack Overflow in SMC handler 2018-03-04 19:07:17 -08:00
Michael Scire
1fa64fccbf Add pre-defined panic utilities 2018-03-04 17:23:54 -08:00
TuxSH
4c38be1560 Fix lock clear in warmboot_main 2018-03-04 21:57:25 +01:00
TuxSH
3e128a8b3e Add TI charger stuff to warmboot_main, add 4.x hw_type stuff as well 2018-03-04 14:04:49 +01:00
TuxSH
ca80408349 Fix latest commit and set MAILBOX_NX_SECMON_BOOT_TIME 2018-03-04 00:36:40 +01:00
Michael Scire
58036dac0b Fix coldboot init (presentations lie) 2018-03-03 12:22:50 -08:00
TuxSH
a6c7a2c57e Refactor 32-bit register definitions 2018-03-03 20:23:13 +01:00
TuxSH
c0f99fcd1c Fix invalidate_icache_all dsb correctness 2018-03-03 20:03:52 +01:00
TuxSH
3d974857e4 warmboot_main: fix panic reason in panic code 2018-03-03 19:49:25 +01:00
TuxSH
4a2c9229ee Fix warmboot vs cpu_on check 2018-03-03 19:43:44 +01:00
TuxSH
03c1ad7119 Add most of warmboot_main 2018-03-03 19:31:22 +01:00
TuxSH
be6b67669f Finish writing warmboot _crt0_ 2018-03-03 16:58:23 +01:00
Michael Scire
48e8d9c7de Fix bugs required to successfully hand off to kernel 2018-03-03 06:15:46 -08:00
TuxSH
93864f2289 Use the boot critical section 2018-03-03 03:43:46 +01:00
TuxSH
92d2abaf1c Fix section alignment, attempt to clean up the crt0 a bit 2018-03-03 02:02:10 +01:00
Michael Scire
661bcaa3ec Change 'success' panic location to end of coldboot_main() 2018-03-02 15:09:51 -08:00
Michael Scire
102fb5004f Cleanup TODOs, implement bootconfig SCR_EL3 bit setting 2018-03-02 15:04:16 -08:00
TuxSH
bf63a077b1 Implement critical section (Lamport's Baker s algorithm)...
thanks @fincs for sample code
2018-03-02 23:37:36 +01:00
Michael Scire
301b166684 Implement CPU state init, fix bug in cpu_context restore 2018-03-02 14:16:54 -08:00
Michael Scire
a292e95c2f Finish bootup_misc_mmio() - Cur build gets to end of pk2ldr. 2018-03-02 13:44:21 -08:00
Michael Scire
ca7b441079 Add call to se_generate_stored_vector() before validating 2018-03-02 12:59:12 -08:00
Michael Scire
3388198a26 Add coldboot mmio init (for non 4.x), required for FLOW writes to succeed. 2018-03-02 12:45:37 -08:00
Michael Scire
e7e62ef90b Implement half of bootup_misc_mmio() 2018-03-02 12:16:30 -08:00
Michael Scire
b3dbfd8ee0 Update pk2ldr outline, prepare for bootup_misc_mmio() impl 2018-03-02 11:28:05 -08:00
Michael Scire
303e189559 Implement a few TODOs with CAR driver. 2018-03-01 23:33:43 -08:00
Michael Scire
5f7308efd1 Implement Clock/Reset Driver. 2018-03-01 22:50:07 -08:00
TuxSH
cad9cdc6e0 Reintroduce unmap_* in package2.c 2018-03-02 07:33:47 +01:00
Michael Scire
78bee60485 Fix dangling comments 2018-03-01 21:24:22 -08:00
Michael Scire
7b6d15ec36 Fix up package2.c, current build makes it to the panic() on hardware 2018-03-01 21:15:19 -08:00
Michael Scire
2390df4d07 Fix start.s to pass reloc_list properly to package2ldr 2018-03-01 20:39:49 -08:00
Michael Scire
0a80a7caf5 Fix coldboot init, Exosphere makes it to PK2LDR in this commit. 2018-03-01 20:10:05 -08:00
TuxSH
63d0b08ac4 Rewrite relocation stuff 2018-03-02 02:47:19 +01:00
TuxSH
6903b20579 Fix wrong subsection name 2018-03-01 21:28:50 +01:00
TuxSH
82f10b4320 Implements missings parts of pk2ldr, refactor relocation a bit 2018-03-01 19:11:09 +01:00
TuxSH
568781bc7e Strongly validate SPL's buffer address 2018-03-01 12:35:02 +01:00
Michael Scire
9553c69c8f Properly detect PK21 master key rev. 2018-03-01 03:28:34 -08:00
Michael Scire
205d3b8b80 Fix PK2LDR bugs, Fix SE bugs 2018-03-01 03:25:12 -08:00
TuxSH
7850d3fd57 Put the loaded bootconfig in the evt page 2018-03-01 11:06:55 +01:00
Michael Scire
b67ce08f84 Fix Modulus Exponentiation in SE driver 2018-03-01 02:00:39 -08:00
Michael Scire
4025781f1c Make clear_bss work regardless of load address 2018-03-01 00:59:48 -08:00
TuxSH
1d621f3bf4 Fix tzram_map_all_segments 2018-03-01 02:36:16 +01:00
TuxSH
78b9698260 Finish writing coldboot_main 2018-03-01 01:40:09 +01:00
TuxSH
19dda5ed48 Can't copy to VAs if VA don't exist (at that point of the program) 2018-03-01 01:13:10 +01:00
TuxSH
e34d86b16f Fix the set_memory_registers_enable_mmu call 2018-03-01 00:05:18 +01:00
TuxSH
3d4dcdde13 Fix ttbl init pointer arith bug, other fixes 2018-02-28 23:35:30 +01:00
TuxSH
0a89831193 Clear bss at runtime like Nintendo actually does 2018-02-28 22:29:17 +01:00
TuxSH
303774aeb7 Use bic instead of and in finalize_powerdown 2018-02-28 20:01:42 +01:00
TuxSH
6be5b0a52f Implement flush_dcache_all_tzram_pa and invalidate_icache_all_inner_shareable_tzram_pa for the crt0s 2018-02-28 19:06:41 +01:00
TuxSH
e5f293e004 Implement and use set_memory_registers_enable_mmu 2018-02-28 13:32:18 +01:00
TuxSH
64c8612342 Fix wrongly named register in __set_memory_registers, add prototype 2018-02-28 07:32:14 +01:00
Michael Scire
c5b0639b8a Implement BootConfig. 2018-02-27 20:28:34 -08:00
Michael Scire
d0b74d7751 Panic Bright Red on failed master key detection. 2018-02-27 20:00:48 -08:00
Michael Scire
694872b4cc Fix decrypt_data_into_keyslot 2018-02-27 19:59:51 -08:00
Michael Scire
0508ee29d8 Clean up SE TODOs, implement GIC nonsecure init 2018-02-27 19:58:56 -08:00
Michael Scire
1463266190 Status callback keys have guaranteed atomicity from caller locks. 2018-02-27 19:50:31 -08:00
Michael Scire
66b3b3a706 Implement Panic() stub. 2018-02-27 19:43:07 -08:00
Michael Scire
fba3d1c2d9 Finish implementing Security Engine context save 2018-02-27 19:05:45 -08:00
Michael Scire
a8a2f8c3f6 Implement more SE context save functionality 2018-02-27 17:40:59 -08:00
TuxSH
93634d08e3 Implement __set_memory_registers 2018-02-28 02:37:08 +01:00
Michael Scire
924d469344 Implement the rest of smcCpuSuspend with skeleton SE API calls. 2018-02-27 17:07:30 -08:00
TuxSH
a90a431d61 Refactor save/restore_current_core_context, fix memory ordering issue with inline asm 2018-02-28 01:59:50 +01:00
Michael Scire
c18af9f3d2 Finish smcCpuOff 2018-02-27 16:35:35 -08:00
Michael Scire
7a9e031bff Uncomment more sleep/suspend code 2018-02-27 16:10:51 -08:00
Michael Scire
235b7b65e1 Uncomment BPMP firmware copy in LP0 2018-02-27 16:01:09 -08:00
Michael Scire
c2c6745f60 Implement save/restore current core context 2018-02-27 15:40:05 -08:00
Michael Scire
9a5bc05259 Fix missing titlekey revision assignment 2018-02-27 15:14:23 -08:00
TuxSH
602507ee8f Rename cache.s/.h to arm.s/.h 2018-02-27 22:29:47 +01:00
TuxSH
5bade9ee1c Use specs file, remove -nostartfiles 2018-02-27 20:14:12 +01:00
TuxSH
0258324872 Use provided __libc_init_array and __libc_fini_array, bugfixes 2018-02-27 16:10:56 +01:00
TuxSH
24b15dad40 Unstub lma2vma code 2018-02-27 13:26:51 +01:00
TuxSH
b0cb819b06 Add proper linkscript...
...adapted from @fincs' own linkscripts
2018-02-27 04:19:38 +01:00
Michael Scire
c4789a5a11 Skeleton smcCpuOff, fix building, fix smcConfigureCarveout 2018-02-26 17:41:31 -08:00
TuxSH
23e9a8369a Fix Makefile 2018-02-27 01:00:58 +01:00
TuxSH
9384546753 Adapt code to match last commit, link in bpmpfw_bin(_size) 2018-02-26 22:30:51 +01:00
TuxSH
984ade3ede
Merge pull request #58 from MerryMage/context_id-rename
Rename set_core_entrypoint_and_context_id
2018-02-26 22:26:46 +01:00
TuxSH
c7d83c6eb6 Rewrite the memory map-related code...
...other style fixes, etc.
2018-02-26 22:09:35 +01:00
MerryMage
3d40051146 Rename set_core_entrypoint_and_context_id 2018-02-26 17:11:49 +00:00
Michael Scire
bda9dcbe73 Start implementing smcCpuSuspend 2018-02-26 02:00:17 -08:00
TuxSH
18d0a81bd5
Merge pull request #51 from lioncash/const
memory_map: Remove unnecessary const
2018-02-26 10:26:58 +01:00
Mat M
1de6b336bb all: Make file-scope variables internally linked where applicable (#57)
Narrows the scope of visible symbols to where they're actually used. Also
makes it easier to see true globals in source files
(ones used from multiple translation units)
2018-02-26 00:42:21 -08:00
Mat M
c94cfe4898 lock: Use stdatomic.h (#56)
Provides the same assembly output while using the standardized interface

e.g.

0000000000000000 <set_priv_smc_in_progress>:
   0:   90000000    adrp    x0, 0 <set_priv_smc_in_progress>
   4:   91000000    add x0, x0, #0x0
   8:   52800022    mov w2, #0x1                    // #1
   c:   d503201f    nop
  10:   085ffc01    ldaxrb  w1, [x0]
  14:   08037c02    stxrb   w3, w2, [x0]
  18:   35ffffc3    cbnz    w3, 10 <set_priv_smc_in_progress+0x10>
  1c:   72001c3f    tst w1, #0xff
  20:   54ffff81    b.ne    10 <set_priv_smc_in_progress+0x10>  // b.any
  24:   d65f03c0    ret
2018-02-25 22:59:48 -08:00
Mat M
461105a501 fuse: simplify checks in fuse_get_reserved_odm and fuse_get_spare_bit (#54)
A separate variable isn't particularly necessary here, and given that the type
is unsigned, we only need to test the upper bound.

This also resolves two -Wtype-limits warnings
2018-02-25 21:23:31 -08:00
Mat M
fff3912c81 mc: Remove dead code in get_carveout_by_id (#52) 2018-02-25 21:13:07 -08:00
Mat M
991d4f1355 se: Remove memset in se_perform_aes_block_operation (#53)
We can just initialize the array to be zeroed out. This is safer and less error-prone,
since the initializer is now associated with the variable directly, making it
impossible to put code relying on the zeroed out state before it (unlike with memset).
2018-02-25 21:12:49 -08:00
Lioncash
b328effd9b
memory_map: Remove unnecessary const
Since the return value isn't a pointer thing doesn't have much use.
2018-02-25 23:56:47 -05:00
TuxSH
4d3f1f6ae8 Remove built files that somehow got here 2018-02-25 22:36:32 +01:00
TuxSH
969b781a68 Failed attempt to fix loops not being unrolled, other fixes. 2018-02-25 21:41:16 +01:00
TuxSH
b0ea9c1a0b Move source files to src/, add Makefile, fix all build and linkage errors, etc. 2018-02-25 20:00:50 +01:00
TuxSH
4c7aa566f0 Fix user page mmu mapping and naming scheme 2018-02-25 15:12:49 +01:00
TuxSH
ab38217720 Fix mmu descriptor mistakes 2018-02-25 14:37:44 +01:00
Michael Scire
c46a3cc794 Map userpage in at appropriate address (TODO: Invalidate TLB) 2018-02-25 01:31:45 -08:00
Michael Scire
78c8fe36fe Fix read64le 2018-02-25 01:26:40 -08:00
Michael Scire
82b4c6763d Implement getters for fuse values, fill out smcGetConfig 2018-02-25 01:21:52 -08:00
TuxSH
b0079e404d Clear pk2ldr in coldboot_main 2018-02-25 03:54:28 +01:00
TuxSH
a00e68e94a Write a significant chunk of coldboot init...
...merge start.cold.s and start.warm.s, other changes, etc.
2018-02-25 03:34:15 +01:00
TuxSH
be67169390
Merge pull request #50 from lioncash/error
memory_map: Fix most compilation issues
2018-02-25 00:14:50 +01:00
Mat M
a081c93094 bootconfig/configitem: Fix includes and identifiers (#49) 2018-02-24 12:46:57 -08:00
Lioncash
a34813bcf4
memory_map: Fix most compilation issues 2018-02-24 15:38:48 -05:00
Mike H
f6008d947d
More previously unknown fuses 2018-02-24 18:48:11 +00:00
Mike H
3929ba77e6
Adding FUSE_RESERVED_SW 2018-02-24 18:34:49 +00:00
hexkyz
e2d45878c3 Preliminary Exosphere FUSE driver 2018-02-24 18:15:47 +00:00
TuxSH
cc4f6f7f84 Introduce memory_map.h 2018-02-24 17:22:55 +01:00
Michael Scire
ed5850ebbf Implement se_trigger_interrupt, fix up some configitems 2018-02-24 07:25:38 -08:00
Michael Scire
e8b1e0b965 Implement exception vectors. 2018-02-24 07:06:29 -08:00
Michael Scire
422cd14aac Implement driver for the GIC-400. 2018-02-24 05:33:16 -08:00
Michael Scire
c94fe287cb Exosphere I2C Driver. 2018-02-24 04:27:34 -08:00
Michael Scire
672d76cb31 Fix I2C success mask 2018-02-24 04:27:34 -08:00
Mat M
56f5b56235 smc_user: Correct cache_flush to flush_dcache_range (#48)
cache_flush is a non-existent function
2018-02-23 20:38:21 -08:00
Mat M
44a2b7a344 smc_user: Add missing gcm.h include (#47)
Resolves an implicit declaration warning for gcm_decrypt_key
2018-02-23 16:09:55 -08:00
Mat M
e3897bb731 se: Add missing string.h include (#46)
Resolves implicit declaration warnings for memcpy and memset
2018-02-23 16:09:44 -08:00
Mat M
34d8a859ab timers: Fix identifier name in wait's spin-lock (#45)
Also resolves implicit definition warnings for wait by including the necessary header where applicable
2018-02-23 16:09:34 -08:00
Michael Scire
dbf2eb7ed1 Clean up BPMPFW I2C prototypes.
Prototypes for internal functions shouldn't be in shared headers.
2018-02-23 12:07:02 -08:00
TuxSH
0a0a1b088d
Merge pull request #43 from lioncash/prototype
i2c: Fix -Wmissing-prototypes warnings
2018-02-23 19:18:46 +01:00
Lioncash
b4229f0fa8
mmu: Remove phys_addr parameter from mmu_unmap_range
It's unused
2018-02-23 09:25:21 -05:00
Lioncash
296b43744c
i2c: Fix -Wmissing-prototypes warnings 2018-02-23 09:19:32 -05:00
TuxSH
8e4a5bf32b
Merge pull request #17 from lioncash/include
Add missing string.h includes
2018-02-23 14:51:27 +01:00
TuxSH
dd3498a356
Merge pull request #27 from lioncash/param
mmu: Fix compilation issues
2018-02-23 14:50:54 +01:00
Mat M
9dfa6e2732 start.cold/warm: Correct MSR instructions (#42)
The second operand needs to be an immediate
2018-02-23 05:46:06 -08:00
Mat M
7b1fa3a8f0 start.cold/warm.s: Correct DSB instruction instances (#41)
DSB requires that the barrier option be specified
2018-02-23 05:42:55 -08:00
Merry
85df3dcb7e mc: fix invalid range comparison (#37) 2018-02-23 05:42:47 -08:00
Mat M
615216edeb smc_api: Fix compilation issues (#40)
* smc_api: Add missing includes

MASTERKEY_REVISION_400_CURRENT, seal_titlekey, PMC_BASE and the randomcache functions  aren't visible without them

* smc_api: Add missing parameter name to smc_get_result

* smc_api: Fix buffer being passed to se_get_exp_mod_output in smc_unwrap_rsa_oaep_wrapped_titlekey_get_result

wrapped_titlekey doesn't exist

* smc_api: Correct device physical address accesses in smc_read_write_register
2018-02-23 05:41:26 -08:00
Merry
e29123cac3 randomcache: Typo in randomcache_refill (#38)
g_random_cache_low > high_plus_one didn't update g_random_cache_high.
2018-02-23 05:40:47 -08:00
Mat M
0ec1ceca1f sealedkeys: Fix compilation issues (#39)
* sealedkeys: Remove non-existent variable in condition in seal_titlekey

* sealedkeys: call unseal_key_internal in unseal_key instead of seal_key_internal
2018-02-23 05:40:38 -08:00
TuxSH
91d1b047c4 Fix bpmpfw/Makefile, other changes. 2018-02-23 13:56:23 +01:00
Lioncash
705802d749
mmu: Fix call to non-existent mmu_unmap_page_range function in mmio_unmap_all_devices 2018-02-23 07:32:23 -05:00
Lioncash
d2f12c5900
mmu: Remove extraneous argument to mmu_unmap in mmu_unmap_range 2018-02-23 07:30:48 -05:00
Michael Scire
90f792b1cc Remove Makefile copy/paste leftovers for bpmpfw 2018-02-23 04:15:14 -08:00
Michael Scire
5370c7b150 Implement LP0-Entry BPMP Firmware 2018-02-23 04:13:18 -08:00
Michael Scire
f7598cb433 Implement smcConfigureCarveout 2018-02-23 01:12:38 -08:00
Michael Scire
b2dc858738 Implement smcReadWriteRegister 2018-02-23 00:20:51 -08:00
Mat M
765ae2c06a se: Fix compilation issues (#36)
* se: Correct excess argument errors with se_perform_aes_block_operation

* se: Fix excess arguments with set_se_ctr

* se: Correct variable identifiers in se_synchronous_exp_mod

* se: Correct offset variable identifier in se_get_exp_mod_output
2018-02-22 23:12:44 -08:00
Mat M
3596032869 package2: Silence a -Wcomment warning (#35) 2018-02-22 23:11:51 -08:00
Mat M
7ab0acf656 package2: Correct -> to . in load_package2 (#34)
header is a local on the stack, so this should just be regular member accessing
2018-02-22 23:11:15 -08:00
Mat M
06c8b7a764 package2: Fix buffer variable name in rsa2048_pss_verify (#32) 2018-02-22 20:40:41 -08:00
Mat M
4131a61d00 package2: Use assignment instead of memcpy in decrypt_and_validate_header (#33)
This is more concise and also compiles (the previous code was missing an & on the source argument)
2018-02-22 20:31:13 -08:00
Mat M
7d777a0e59 package2: Fix loop index in decrypt_and_validate_header (#31) 2018-02-22 20:18:18 -08:00
Mat M
83216409d2 all: Use bool where applicable (#30) 2018-02-22 19:58:39 -08:00
Mat M
1d8f443f68 gcm: Convert source data to a uint8_t pointer before subscripting it (#29)
It's not well-formed to subscript a pointer to void
2018-02-22 18:44:27 -08:00
Mat M
3020faf8a2 mmu: Pass missing tbl argument to mmu_map_page in mmu_map_page_range (#28) 2018-02-22 18:28:30 -08:00
Lioncash
6fb3c77764
Add missing string.h includes 2018-02-22 21:09:02 -05:00
Mat M
a798df5a2c cpu_context: Add missing include (#25) 2018-02-22 18:08:57 -08:00
Mat M
c6158d7d64 mmu: Fix loop index variable name in mmio_get_device_address (#24) 2018-02-22 18:05:43 -08:00
Mat M
0597fe887a package2: Correct variable name for new device key source (#19)
Identifiers can't begin with a number
2018-02-22 18:03:22 -08:00
Merry
a6c91ffe4e se: fix infinite loop in shift_left_xor_rb (#21) 2018-02-22 18:03:05 -08:00
Merry
220e574ff7 mmu: Correct TCR_ORGN_WBWA typo 2018-02-22 18:02:45 -08:00
Michael Scire
a007e98e17 Fix SE access typo 2018-02-22 17:58:48 -08:00
Michael Scire
d1d8d3da34 Switch all MMIO to the new access style 2018-02-22 17:50:37 -08:00
Merry
5d97ac48f2 userpage: fix declarations (#20) 2018-02-22 17:20:03 -08:00
Mat M
25a5eacb96 masterkey: Add missing semicolon to mkey_vectors (#18) 2018-02-22 17:18:28 -08:00
Michael Scire
215ae12b50 Access NX_BOOTLOADER_MAILBOXEN via mmu defs 2018-02-22 17:08:54 -08:00
Michael Scire
72da8dcf5a Finish SE API operations other than context-saving. 2018-02-22 17:05:36 -08:00
TuxSH
5e1c137e26 Add mmio handling to mmu.h 2018-02-23 01:45:26 +01:00
Michael Scire
0ef8f1db2e Implement SE secure AES API. 2018-02-22 16:17:12 -08:00
Michael Scire
ead0e2ba86 Implement RSA2048-PSS validation. 2018-02-22 15:19:29 -08:00
Mat M
32238984bf smc_user: Fix syntax (#16)
* smc_user: Fix syntax for size assignment in user_load_secure_exp_mod_key() and user_load_rsa_oaep_key()

* smc_user: Fix include directive
2018-02-22 14:18:34 -08:00
MerryMage
a290932034 uart: transmit string and hex 2018-02-22 19:27:22 +00:00
MerryMage
71b76c153d Add uart 2018-02-22 19:27:01 +00:00
Michael Scire
b00df2032d Clarify package2 relocation comment 2018-02-21 13:48:36 -08:00
Michael Scire
d0e28890b0 Finish actual Package2 loading code. 2018-02-21 13:38:55 -08:00
Michael Scire
896d167b64 Add more WIP Package2 loading code. 2018-02-21 11:52:39 -08:00
Michael Scire
904ed3ad4e Fix mangled register name. 2018-02-21 10:58:50 -08:00
Michael Scire
f0d0ec0dca Push WIP NX_BOOTLOADER sync code (for coldboots) 2018-02-21 10:57:51 -08:00
Michael Scire
330f8a0f8b Fix SMC names. 2018-02-20 18:48:09 -08:00
TuxSH
663c446439 Mention that Nintendo copy-pasted some startup code from arm-trusted-firmware 2018-02-21 00:53:23 +01:00
TuxSH
5681622f65 Add mmu table builder functions (mmu.h) 2018-02-20 23:44:10 +01:00
Michael Scire
9baab1aebc Clarify PASLR commentary 2018-02-20 13:51:17 -08:00
Michael Scire
d3d65f4800 smcGenerateSpecificAesKey, smcLoadRsaPrivateKey, smcLoadRsaOaepKey 2018-02-20 13:25:57 -08:00
Michael Scire
3d80b4edbc smcDecryptRsaPrivateKey 2018-02-20 12:56:41 -08:00
TuxSH
81b874cc14 Fix minor build issues in gcm.c, etc. 2018-02-20 19:29:44 +01:00
Michael Scire
25e6317272 Fix GHASH comment. 2018-02-20 09:41:16 -08:00
Michael Scire
77c93221e9 Implement Nintendo's non-standard AES-GCM. 2018-02-20 09:39:50 -08:00
Michael Scire
cec055a44b smcGetRandomFor{User,Priv} Implementations. 2018-02-20 03:19:35 -08:00
Michael Scire
34667a65f9 Implement titlekey unwrapping. 2018-02-20 01:49:10 -08:00
Michael Scire
cbdd130917 Fix Seal Key sources. 2018-02-20 01:03:53 -08:00
Michael Scire
4030c6eb20 smcGenerateAesKek + Key sealing. 2018-02-20 01:02:01 -08:00
Michael Scire
07f9e9500e Implement masterkey logic, KEYSLOT defines. 2018-02-19 23:41:27 -08:00
Michael Scire
61f8886879 Implement titlekey SMCs (with skeleton tkey API) 2018-02-19 21:47:11 -08:00
Michael Scire
59281c5a97 Implement smcRsaOaep 2018-02-19 21:09:53 -08:00
Michael Scire
f1c521a5d6 Implement smcExpMod. 2018-02-19 20:56:12 -08:00
Michael Scire
9b54bc536b Add missing userToSecure args in smcComputeCmac 2018-02-19 20:31:04 -08:00
Michael Scire
0340085c67 smcComputeCmac implementation. 2018-02-19 20:28:37 -08:00
Michael Scire
ff07451280 Outline user<->secure page copying. 2018-02-19 20:18:53 -08:00
TuxSH
a01d2c92b2 Add the crt0s 2018-02-20 01:27:15 +01:00
Michael Scire
d0beae376f SMCCryptAes + Skeleton blocking AES API 2018-02-19 13:27:18 -08:00
Michael Scire
21c2405f15 Async SE AES API 2018-02-19 13:00:12 -08:00
Michael Scire
83fd2c43a3 Flesh out more of the SE driver 2018-02-19 01:27:50 -08:00
Michael Scire
f77cae48d0 Skeleton for smcGetConfig and smcSetConfig 2018-02-19 00:41:19 -08:00
TuxSH
f629a629d1 Change argument types in se.c/h, implement read32le/be, etc. 2018-02-19 00:02:37 +01:00
TuxSH
9c588d4965 ic iallu doesn't broadcast at all, replace the "icache invalidate all" function 2018-02-18 23:45:44 +01:00
TuxSH
0cc2cf0dc0 Add cache+tlb functions 2018-02-18 23:11:11 +01:00
Michael Scire
a800c3c2e7 Add some more MMIO, smcCpuOn 2018-02-17 18:50:39 -08:00
Michael Scire
5c24f58402 Example SMC implementation (load_aes_key) 2018-02-17 16:34:31 -08:00