From 6c5d425528ba1205491d94c4ecc0f71994d5ff73 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Fri, 16 Feb 2018 23:55:08 -0800 Subject: [PATCH] Make exosphere subdir, start outlining SE driver API. --- README.md | 4 +--- exosphere/README.md | 6 ++++++ exosphere/se.h | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 exosphere/README.md create mode 100644 exosphere/se.h diff --git a/README.md b/README.md index aa74ec69d..96e7e0a66 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,4 @@ Atmosphère-NX ![License](https://img.shields.io/badge/License-GPLv2-blue.svg) -This is a placeholder repo reserved for any/all development work I do pertaining to customized firmware on the Nintendo Switch. - -Currently, I do not know on what timeline commits to this repository will appear. +This is a placeholder repo reserved for any/all development work I do pertaining to customized firmware on the Nintendo Switch. \ No newline at end of file diff --git a/exosphere/README.md b/exosphere/README.md new file mode 100644 index 000000000..1bc891504 --- /dev/null +++ b/exosphere/README.md @@ -0,0 +1,6 @@ +Exosphere +===== + +![License](https://img.shields.io/badge/License-GPLv2-blue.svg) + +Exosphere is a Secure Monitor implementation for the Nintendo Switch. \ No newline at end of file diff --git a/exosphere/se.h b/exosphere/se.h new file mode 100644 index 000000000..be7d155ac --- /dev/null +++ b/exosphere/se.h @@ -0,0 +1,32 @@ +#ifndef EXOSPHERE_SE_H +#define EXOSPHERE_SE_H + +/* Exosphere driver for the Tegra X1 security engine. */ + +/* TODO: Define constants for the C driver. */ + +/* WIP, API subject to change. */ + +#define KEYSLOT_AES_MAX 0x10 +#define KEYSLOT_RSA_MAX 0x2 + +void set_security_engine_address(void *security_engine); + +void set_aes_keyslot_flags(unsigned int keyslot, unsigned int flags); +void set_rsa_keyslot_flags(unsigned int keyslot, unsigned int flags); +void clear_aes_keyslot(unsigned int keyslot); +void clear_rsa_keyslot(unsigned int keyslot); + +void set_aes_keyslot(unsigned int keyslot, const char *key, unsigned int key_size); +void crypt_data_into_keyslot(unsigned int keyslot, ) +void set_rsa_keyslot(unsigned int keyslot, const char *modulus, unsigned int modulus_size, const char *exp, unsigned int exp_size); +void set_aes_keyslot_iv(unsigned int keyslot, const char *iv, unsigned int iv_size); +void set_se_ctr(const unsigned int *ctr); + +void se_crypt_aes(unsigned int keyslot, char *dst, unsigned int dst_size, const char *src, unsigned int src_size, unsigned int config, unsigned int mode, unsigned int (*callback)(void)); +void se_exp_mod(unsigned int keyslot, char *buf, unsigned int size, unsigned int (*callback)(void)); + +/* TODO: SE context save API, consider extending AES API for secure world vs non-secure world operations. */ +/* In particular, smc_crypt_aes takes in raw DMA lists, and we need to support that. */ + +#endif /* EXOSPHERE_SE_H */ \ No newline at end of file