Skip to content

Commit 779f1b3

Browse files
committed
SATSE: add functions description
1 parent a8f7363 commit 779f1b3

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

libraries/SoftwareATSE/src/SoftwareATSE.h

+88
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,103 @@ class SoftwareATSEClass
3838
long random(long max);
3939
int random(byte data[], size_t length);
4040

41+
/** generatePrivateKey
42+
*
43+
* Create a new ECCurve_NIST_P256 keypair and stores it in the WiFi chip NVS.
44+
* Public key X Y values will be available inside publicKey buffer that should
45+
* be at least 64 bytes long.
46+
*
47+
* | Public key X Y values (64 bytes) |
48+
*
49+
* @param[in] slot objectID where to store the private key
50+
* @param[out] publicKey Buffer containing the public key X Y values
51+
*
52+
* @return 0 on Failure 1 on Success
53+
*/
4154
int generatePrivateKey(int slot, byte publicKey[]);
55+
56+
/** generatePublicKey
57+
*
58+
* Reads ECCurve_NIST_P256 public key from KeyID. Public key X Y values will be available
59+
* inside publicKey buffer that should be at least 64 bytes long.
60+
*
61+
* | Public key X Y values (64 bytes) |
62+
*
63+
* @param[in] slot objectID where is stored the keypair
64+
* @param[out] pubkey Buffer containing the public key X Y values
65+
*
66+
* @return 0 on Failure 1 on Success
67+
*/
4268
int generatePublicKey(int slot, byte publicKey[]);
4369

70+
/** ecdsaVerify
71+
*
72+
* Verify ECDSA signature using public key.
73+
*
74+
* Input SHA256
75+
* ? Match ?
76+
* Signature -> public Key -> Original SHA256
77+
*
78+
* @param[in] message Input SHA256 used to compute the signature 32 bytes
79+
* @param[in] sig Input buffer containint the signature R S values 64bytes
80+
* @param[in] pubkey Public key X Y values 64bytes
81+
*
82+
* @return 0 on Failure (Not match) 1 on Success (Match)
83+
*/
4484
int ecdsaVerify(const byte message[], const byte signature[], const byte pubkey[]);
85+
86+
/** ecSign
87+
*
88+
* Computes ECDSA signature using key stored in KeyID SE050 object.
89+
* Output signature buffer is filled with the signature R S values
90+
* and should be at least 64 bytes long:
91+
*
92+
* | R values 32 bytes | S values 32 bytes |
93+
*
94+
* SHA256 -> private Key -> Signature
95+
*
96+
* @param[in] slot object ID containing the key
97+
* @param[in] message Input SHA256 used to compute the signature 32 bytes
98+
* @param[out] signature Output buffer containint the signature 64 bytes
99+
*
100+
* @return 0 on Failure 1 on Success
101+
*/
45102
int ecSign(int slot, const byte message[], byte signature[]);
46103

104+
/** SHA256
105+
*
106+
* One-shot SHA256
107+
*
108+
* @param[in] buffer Input data buffer
109+
* @param[in] size Input data length
110+
* @param[out] digest Output buffer should be at least 32 bytes long
111+
*
112+
* @return 0 on Failure 1 on Success
113+
*/
47114
int SHA256(const uint8_t *buffer, size_t size, uint8_t *digest);
48115

116+
/** readSlot
117+
*
118+
* Reads binary data from Software AT Secure Element object.
119+
*
120+
* @param[in] slot object ID containing data
121+
* @param[out] data Output data buffer
122+
* @param[in] length Number of bytes to read
123+
*
124+
* @return 0 on Failure 1 on Success
125+
*/
49126
int readSlot(int slot, byte data[], int length);
127+
128+
/** writeSlot
129+
*
130+
* Writes binary data into Software AT Secure Element object.
131+
*
132+
* @param[in] slot object ID
133+
* @param[in] data Input data buffer
134+
* @param[in] length Number of bytes to write
135+
*
136+
* @return 0 on Failure 1 on Success
137+
*/
50138
int writeSlot(int slot, const byte data[], int length);
51139

52140
inline int locked() { return 1; }

0 commit comments

Comments
 (0)