Skip to content

Commit 0d8f68e

Browse files
committed
address review comments
1 parent 47caa9b commit 0d8f68e

4 files changed

Lines changed: 133 additions & 131 deletions

File tree

IDE/Renesas/e2studio/RA6M4/common/user_settings.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
* e.g. Certificate verification, Master Secret Generation
2727
* WOLFSSL_RENESAS_SCEPROTECT enables specific code for SCE if needed
2828
*/
29-
# define WOLFSSL_RENESAS_FSPSM
30-
# define WOLFSSL_RENESAS_FSPSM_TLS
29+
#define WOLFSSL_RENESAS_FSPSM
30+
#define WOLFSSL_RENESAS_FSPSM_TLS
3131
#endif
3232

3333
/* XXX_CRYPTONLY definition enables FSP SM module for Crypto only use.
@@ -36,12 +36,12 @@
3636
/* # define WOLFSSL_RENESAS_SCEPROTECT_CRYPTONLY */
3737

3838
#if defined(WOLFSSL_RENESAS_SCEPROTECT_CRYPTONLY)
39-
# undef WOLFSSL_RENESAS_FSPSM_TLS
40-
# define WOLFSSL_RENESAS_FSPSM_CRYPTONLY
39+
#undef WOLFSSL_RENESAS_FSPSM_TLS
40+
#define WOLFSSL_RENESAS_FSPSM_CRYPTONLY
4141

42-
# if !defined(WOLFSSL_RENESAS_SCEPROTECT)
43-
# define WOLFSSL_RENESAS_SCEPROTECT
44-
# endif
42+
#if !defined(WOLFSSL_RENESAS_SCEPROTECT)
43+
#define WOLFSSL_RENESAS_SCEPROTECT
44+
#endif
4545
#endif
4646

4747
/* Operating Environment and Threading */

IDE/Renesas/e2studio/RA6M4/test/src/test_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,8 @@ void sce_test(void)
406406
info[i].ctx = client_ctx;
407407
info[i].id = i;
408408

409-
memset(info[i].name, 0, sizeof(info[i].name));
410-
sprintf(info[i].name, "wolfSSL_TLS_client_do(%02d)", i);
409+
XMEMSET(info[i].name, 0, sizeof(info[i].name));
410+
XSPRINTF(info[i].name, "wolfSSL_TLS_client_do(%02d)", i);
411411

412412
if(wolfSSL_TLS_client_do(&info[i]) == -116) {
413413
TCP_connect_retry++;

IDE/Renesas/e2studio/RA6M4/test/src/wolf_client.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,17 +196,17 @@ int wolfSSL_TLS_client_do(void *pvParam)
196196
/* Set callback CTX */
197197
#if !defined(TLS_MULTITHREAD_TEST)
198198

199-
memset(&guser_PKCbInfo, 0, sizeof(FSPSM_ST));
199+
XMEMSET(&guser_PKCbInfo, 0, sizeof(FSPSM_ST));
200200
guser_PKCbInfo.devId = 0;
201201
wc_sce_set_callback_ctx(ssl, (void*)&guser_PKCbInfo);
202202

203203
#else
204204
if (p->port - DEFAULT_PORT == 0) {
205-
memset(&guser_PKCbInfo_taskA, 0, sizeof(FSPSM_ST));
205+
XMEMSET(&guser_PKCbInfo_taskA, 0, sizeof(FSPSM_ST));
206206
wc_sce_set_callback_ctx(ssl, (void*)&guser_PKCbInfo_taskA);
207207
}
208208
else {
209-
memset(&guser_PKCbInfo_taskB, 0, sizeof(FSPSM_ST));
209+
XMEMSET(&guser_PKCbInfo_taskB, 0, sizeof(FSPSM_ST));
210210
wc_sce_set_callback_ctx(ssl, (void*)&guser_PKCbInfo_taskB);
211211
}
212212
#endif

wolfssl/wolfcrypt/port/Renesas/renesas-fspsm-types.h

Lines changed: 121 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -27,125 +27,127 @@
2727

2828
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
2929

30-
# include "r_sce.h"
31-
32-
#define FSPSM_W_KEYVAR renesas_sce_wrappedkey
33-
#define FSPSM_tls_flg_ST sce_keyflgs_tls
34-
#define FSPSM_key_flg_ST sce_keyflgs_cryt
35-
#define FSPSM_tag_ST tagUser_SCEPKCbInfo
36-
#define FSPSM_ST User_SCEPKCbInfo
37-
#define FSPSM_ST_PKC SCE_PKCbInfo
38-
39-
/* map SCE API to macro */
40-
#define FSPSM_INSTANCE sce_instance_ctrl_t
41-
#define gFSPSM_ctrl sce_ctrl
42-
#define FSPSM_CONFIG sce_cfg_t
43-
#define gFSPSM_cfg sce_cfg
44-
#define FSPSM_OPEN R_SCE_Open
45-
#define FSPSM_CLOSE R_SCE_Close
46-
47-
#define FSPSM_ROOTCA_RSA2048 R_SCE_TLS_RootCertificateRSA2048PublicKeyInstall
48-
#define FSPSM_TLS_SVRKEYExVfy R_SCE_TLS_ServerKeyExchangeVerify
49-
#define FSPSM_TLS_ECCS256R1_KPG \
50-
R_SCE_TLS_ECC_secp256r1_EphemeralWrappedKeyPairGenerate
51-
#define FSPSM_TLS_PREMASTERGEN \
52-
R_SCE_TLS_PreMasterSecretGenerateForECC_secp256r1
53-
/* hmac */
54-
#define FSPSM_S256HMAC_GInt R_SCE_SHA256HMAC_GenerateInit
55-
#define FSPSM_S256HMAC_GUp R_SCE_SHA256HMAC_GenerateUpdate
56-
#define FSPSM_S256HMAC_GFnl R_SCE_SHA256HMAC_GenerateFinal
57-
#define FSPSM_S256HMAC_VInt R_SCE_SHA256HMAC_VerifyInit
58-
#define FSPSM_S256HMAC_VUp R_SCE_SHA256HMAC_VerifyUpdate
59-
#define FSPSM_S256HMAC_VFnl R_SCE_SHA256HMAC_VerifyFinal
60-
#define FSPSM_HMAC_HANDLE sce_hmac_sha_handle_t
61-
#define FSPSM_HMAC_WKEY sce_hmac_sha_wrapped_key_t
62-
63-
/* TLS */
64-
#define FSPSM_SESSIONKEY_GEN_FUNC R_SCE_TLS_SessionKeyGenerate
65-
#define FSPSM_MASTERSECRET_GEN_FUNC R_SCE_TLS_MasterSecretGenerate
66-
#define FSPSM_PREGEN_FUNC R_SCE_TLS_PreMasterSecretGenerateForRSA2048
67-
#define FSPSM_PREGENENC_FUNC R_SCE_TLS_PreMasterSecretEncryptWithRSA2048
68-
69-
/* certificate */
70-
#define FSPSM_TLSCERT_VRY R_SCE_TLS_CertificateVerify
71-
#define FSPSM_TLSROOTCERT_VRY R_SCE_TLS_RootCertificateVerify
72-
#define FSPSM_CACERT_PUB_WKEY sce_tls_ca_certification_public_wrapped_key_t
73-
74-
/* verify data */
75-
#define FSPSM_VERIFY_DATA_FUNC R_SCE_TLS_VerifyDataGenerate
76-
77-
/* aes */
78-
#define FSPSM_AES_WKEY sce_aes_wrapped_key_t
79-
#define FSPSM_AESGCM_HANDLE sce_gcm_handle_t
80-
#define FSPSM_AES_HANDLE sce_aes_handle_t
81-
/* aes 128 cbc */
82-
#define FSPSM_AES128CBCEnc_Init R_SCE_AES128CBC_EncryptInit
83-
#define FSPSM_AES128CBCEnc_Up R_SCE_AES128CBC_EncryptUpdate
84-
#define FSPSM_AES128CBCEnc_Final R_SCE_AES128CBC_EncryptFinal
85-
#define FSPSM_AES128CBCDec_Init R_SCE_AES128CBC_DecryptInit
86-
#define FSPSM_AES128CBCDec_Up R_SCE_AES128CBC_DecryptUpdate
87-
#define FSPSM_AES128CBCDec_Final R_SCE_AES128CBC_DecryptFinal
88-
89-
/* aes 256 cbc */
90-
#define FSPSM_AES256CBCEnc_Init R_SCE_AES256CBC_EncryptInit
91-
#define FSPSM_AES256CBCEnc_Up R_SCE_AES256CBC_EncryptUpdate
92-
#define FSPSM_AES256CBCEnc_Final R_SCE_AES256CBC_EncryptFinal
93-
#define FSPSM_AES256CBCDec_Init R_SCE_AES256CBC_DecryptInit
94-
#define FSPSM_AES256CBCDec_Up R_SCE_AES256CBC_DecryptUpdate
95-
#define FSPSM_AES256CBCDec_Final R_SCE_AES256CBC_DecryptFinal
96-
97-
/* aes128 gcm */
98-
#define FSPSM_AES128GCMEnc_Init R_SCE_AES128GCM_EncryptInit
99-
#define FSPSM_AES128GCMEnc_Up R_SCE_AES128GCM_EncryptUpdate
100-
#define FSPSM_AES128GCMEnc_Final R_SCE_AES128GCM_EncryptFinal
101-
#define FSPSM_AES128GCMDec_Init R_SCE_AES128GCM_DecryptInit
102-
#define FSPSM_AES128GCMDec_Up R_SCE_AES128GCM_DecryptUpdate
103-
#define FSPSM_AES128GCMDec_Final R_SCE_AES128GCM_DecryptFinal
104-
105-
/* aes256 gcm */
106-
#define FSPSM_AES256GCMEnc_Init R_SCE_AES256GCM_EncryptInit
107-
#define FSPSM_AES256GCMEnc_Up R_SCE_AES256GCM_EncryptUpdate
108-
#define FSPSM_AES256GCMEnc_Final R_SCE_AES256GCM_EncryptFinal
109-
#define FSPSM_AES256GCMDec_Init R_SCE_AES256GCM_DecryptInit
110-
#define FSPSM_AES256GCMDec_Up R_SCE_AES256GCM_DecryptUpdate
111-
#define FSPSM_AES256GCMDec_Final R_SCE_AES256GCM_DecryptFinal
112-
113-
/* rsa */
114-
/* rsa data */
115-
#define FSPSM_RSA_DATA sce_rsa_byte_data_t
116-
/* rsa 1024 key */
117-
#define FSPSM_RSA1024_WPA_KEY sce_rsa1024_wrapped_pair_key_t
118-
#define FSPSM_RSA1024_WPB_KEY sce_rsa1024_public_wrapped_key_t
119-
#define FSPSM_RSA1024_WPI_KEY sce_rsa1024_private_wrapped_key_t
120-
/* rsa 2048 key */
121-
#define FSPSM_RSA2048_WPA_KEY sce_rsa2048_wrapped_pair_key_t
122-
#define FSPSM_RSA2048_WPB_KEY sce_rsa2048_public_wrapped_key_t
123-
#define FSPSM_RSA2048_WPI_KEY sce_rsa2048_private_wrapped_key_t
124-
125-
/* rsa key gen */
126-
#define FSPSM_RSA1024_KEYPA_GEN R_SCE_RSA1024_WrappedKeyPairGenerate
127-
#define FSPSM_RSA2048_KEYPA_GEN R_SCE_RSA2048_WrappedKeyPairGenerate
128-
129-
/* rsa function */
130-
#define FSPSM_RSA1024_PKCSENC_FUNC R_SCE_RSAES_PKCS1024_Encrypt
131-
#define FSPSM_RSA2048_PKCSENC_FUNC R_SCE_RSAES_PKCS2048_Encrypt
132-
#define FSPSM_RSA1024_PKCSDEC_FUNC R_SCE_RSAES_PKCS1024_Decrypt
133-
#define FSPSM_RSA2048_PKCSDEC_FUNC R_SCE_RSAES_PKCS2048_Decrypt
134-
#define FSPSM_RSA1024_SIGN_FUNC R_SCE_RSASSA_PKCS1024_SignatureGenerate
135-
#define FSPSM_RSA2048_SIGN_FUNC R_SCE_RSASSA_PKCS2048_SignatureGenerate
136-
#define FSPSM_RSA1024_VRY_FUNC R_SCE_RSASSA_PKCS1024_SignatureVerify
137-
#define FSPSM_RSA2048_VRY_FUNC R_SCE_RSASSA_PKCS2048_SignatureVerify
138-
/* sha */
139-
#define FSPSM_SHA_HANDLE sce_sha_md5_handle_t
140-
#define FSPSM_SHA256_Init R_SCE_SHA256_Init
141-
#define FSPSM_SHA256_Up R_SCE_SHA256_Update
142-
#define FSPSM_SHA256_Final R_SCE_SHA256_Final
143-
144-
/* user API */
145-
#define FSPSM_INFORM_FUNC wc_sce_inform_user_keys
146-
#define FSPSM_CALLBACK_FUNC wc_sce_set_callbacks
147-
#define FSPSM_CALLBACK_CTX_FUNC wc_sce_set_callback_ctx
148-
#define FSPSM_INFORM_CERT_SIGN wc_sce_inform_cert_sign
30+
#include "r_sce.h"
31+
32+
#define FSPSM_W_KEYVAR renesas_sce_wrappedkey
33+
#define FSPSM_tls_flg_ST sce_keyflgs_tls
34+
#define FSPSM_key_flg_ST sce_keyflgs_cryt
35+
#define FSPSM_tag_ST tagUser_SCEPKCbInfo
36+
#define FSPSM_ST User_SCEPKCbInfo
37+
#define FSPSM_ST_PKC SCE_PKCbInfo
38+
39+
/* map SCE API to macro */
40+
#define FSPSM_INSTANCE sce_instance_ctrl_t
41+
#define gFSPSM_ctrl sce_ctrl
42+
#define FSPSM_CONFIG sce_cfg_t
43+
#define gFSPSM_cfg sce_cfg
44+
#define FSPSM_OPEN R_SCE_Open
45+
#define FSPSM_CLOSE R_SCE_Close
46+
47+
#define FSPSM_ROOTCA_RSA2048 \
48+
R_SCE_TLS_RootCertificateRSA2048PublicKeyInstall
49+
#define FSPSM_TLS_SVRKEYExVfy R_SCE_TLS_ServerKeyExchangeVerify
50+
#define FSPSM_TLS_ECCS256R1_KPG \
51+
R_SCE_TLS_ECC_secp256r1_EphemeralWrappedKeyPairGenerate
52+
#define FSPSM_TLS_PREMASTERGEN \
53+
R_SCE_TLS_PreMasterSecretGenerateForECC_secp256r1
54+
/* hmac */
55+
#define FSPSM_S256HMAC_GInt R_SCE_SHA256HMAC_GenerateInit
56+
#define FSPSM_S256HMAC_GUp R_SCE_SHA256HMAC_GenerateUpdate
57+
#define FSPSM_S256HMAC_GFnl R_SCE_SHA256HMAC_GenerateFinal
58+
#define FSPSM_S256HMAC_VInt R_SCE_SHA256HMAC_VerifyInit
59+
#define FSPSM_S256HMAC_VUp R_SCE_SHA256HMAC_VerifyUpdate
60+
#define FSPSM_S256HMAC_VFnl R_SCE_SHA256HMAC_VerifyFinal
61+
#define FSPSM_HMAC_HANDLE sce_hmac_sha_handle_t
62+
#define FSPSM_HMAC_WKEY sce_hmac_sha_wrapped_key_t
63+
64+
/* TLS */
65+
#define FSPSM_SESSIONKEY_GEN_FUNC R_SCE_TLS_SessionKeyGenerate
66+
#define FSPSM_MASTERSECRET_GEN_FUNC R_SCE_TLS_MasterSecretGenerate
67+
#define FSPSM_PREGEN_FUNC R_SCE_TLS_PreMasterSecretGenerateForRSA2048
68+
#define FSPSM_PREGENENC_FUNC R_SCE_TLS_PreMasterSecretEncryptWithRSA2048
69+
70+
/* certificate */
71+
#define FSPSM_TLSCERT_VRY R_SCE_TLS_CertificateVerify
72+
#define FSPSM_TLSROOTCERT_VRY R_SCE_TLS_RootCertificateVerify
73+
#define FSPSM_CACERT_PUB_WKEY \
74+
sce_tls_ca_certification_public_wrapped_key_t
75+
76+
/* verify data */
77+
#define FSPSM_VERIFY_DATA_FUNC R_SCE_TLS_VerifyDataGenerate
78+
79+
/* aes */
80+
#define FSPSM_AES_WKEY sce_aes_wrapped_key_t
81+
#define FSPSM_AESGCM_HANDLE sce_gcm_handle_t
82+
#define FSPSM_AES_HANDLE sce_aes_handle_t
83+
/* aes 128 cbc */
84+
#define FSPSM_AES128CBCEnc_Init R_SCE_AES128CBC_EncryptInit
85+
#define FSPSM_AES128CBCEnc_Up R_SCE_AES128CBC_EncryptUpdate
86+
#define FSPSM_AES128CBCEnc_Final R_SCE_AES128CBC_EncryptFinal
87+
#define FSPSM_AES128CBCDec_Init R_SCE_AES128CBC_DecryptInit
88+
#define FSPSM_AES128CBCDec_Up R_SCE_AES128CBC_DecryptUpdate
89+
#define FSPSM_AES128CBCDec_Final R_SCE_AES128CBC_DecryptFinal
90+
91+
/* aes 256 cbc */
92+
#define FSPSM_AES256CBCEnc_Init R_SCE_AES256CBC_EncryptInit
93+
#define FSPSM_AES256CBCEnc_Up R_SCE_AES256CBC_EncryptUpdate
94+
#define FSPSM_AES256CBCEnc_Final R_SCE_AES256CBC_EncryptFinal
95+
#define FSPSM_AES256CBCDec_Init R_SCE_AES256CBC_DecryptInit
96+
#define FSPSM_AES256CBCDec_Up R_SCE_AES256CBC_DecryptUpdate
97+
#define FSPSM_AES256CBCDec_Final R_SCE_AES256CBC_DecryptFinal
98+
99+
/* aes128 gcm */
100+
#define FSPSM_AES128GCMEnc_Init R_SCE_AES128GCM_EncryptInit
101+
#define FSPSM_AES128GCMEnc_Up R_SCE_AES128GCM_EncryptUpdate
102+
#define FSPSM_AES128GCMEnc_Final R_SCE_AES128GCM_EncryptFinal
103+
#define FSPSM_AES128GCMDec_Init R_SCE_AES128GCM_DecryptInit
104+
#define FSPSM_AES128GCMDec_Up R_SCE_AES128GCM_DecryptUpdate
105+
#define FSPSM_AES128GCMDec_Final R_SCE_AES128GCM_DecryptFinal
106+
107+
/* aes256 gcm */
108+
#define FSPSM_AES256GCMEnc_Init R_SCE_AES256GCM_EncryptInit
109+
#define FSPSM_AES256GCMEnc_Up R_SCE_AES256GCM_EncryptUpdate
110+
#define FSPSM_AES256GCMEnc_Final R_SCE_AES256GCM_EncryptFinal
111+
#define FSPSM_AES256GCMDec_Init R_SCE_AES256GCM_DecryptInit
112+
#define FSPSM_AES256GCMDec_Up R_SCE_AES256GCM_DecryptUpdate
113+
#define FSPSM_AES256GCMDec_Final R_SCE_AES256GCM_DecryptFinal
114+
115+
/* rsa */
116+
/* rsa data */
117+
#define FSPSM_RSA_DATA sce_rsa_byte_data_t
118+
/* rsa 1024 key */
119+
#define FSPSM_RSA1024_WPA_KEY sce_rsa1024_wrapped_pair_key_t
120+
#define FSPSM_RSA1024_WPB_KEY sce_rsa1024_public_wrapped_key_t
121+
#define FSPSM_RSA1024_WPI_KEY sce_rsa1024_private_wrapped_key_t
122+
/* rsa 2048 key */
123+
#define FSPSM_RSA2048_WPA_KEY sce_rsa2048_wrapped_pair_key_t
124+
#define FSPSM_RSA2048_WPB_KEY sce_rsa2048_public_wrapped_key_t
125+
#define FSPSM_RSA2048_WPI_KEY sce_rsa2048_private_wrapped_key_t
126+
127+
/* rsa key gen */
128+
#define FSPSM_RSA1024_KEYPA_GEN R_SCE_RSA1024_WrappedKeyPairGenerate
129+
#define FSPSM_RSA2048_KEYPA_GEN R_SCE_RSA2048_WrappedKeyPairGenerate
130+
131+
/* rsa function */
132+
#define FSPSM_RSA1024_PKCSENC_FUNC R_SCE_RSAES_PKCS1024_Encrypt
133+
#define FSPSM_RSA2048_PKCSENC_FUNC R_SCE_RSAES_PKCS2048_Encrypt
134+
#define FSPSM_RSA1024_PKCSDEC_FUNC R_SCE_RSAES_PKCS1024_Decrypt
135+
#define FSPSM_RSA2048_PKCSDEC_FUNC R_SCE_RSAES_PKCS2048_Decrypt
136+
#define FSPSM_RSA1024_SIGN_FUNC R_SCE_RSASSA_PKCS1024_SignatureGenerate
137+
#define FSPSM_RSA2048_SIGN_FUNC R_SCE_RSASSA_PKCS2048_SignatureGenerate
138+
#define FSPSM_RSA1024_VRY_FUNC R_SCE_RSASSA_PKCS1024_SignatureVerify
139+
#define FSPSM_RSA2048_VRY_FUNC R_SCE_RSASSA_PKCS2048_SignatureVerify
140+
/* sha */
141+
#define FSPSM_SHA_HANDLE sce_sha_md5_handle_t
142+
#define FSPSM_SHA256_Init R_SCE_SHA256_Init
143+
#define FSPSM_SHA256_Up R_SCE_SHA256_Update
144+
#define FSPSM_SHA256_Final R_SCE_SHA256_Final
145+
146+
/* user API */
147+
#define FSPSM_INFORM_FUNC wc_sce_inform_user_keys
148+
#define FSPSM_CALLBACK_FUNC wc_sce_set_callbacks
149+
#define FSPSM_CALLBACK_CTX_FUNC wc_sce_set_callback_ctx
150+
#define FSPSM_INFORM_CERT_SIGN wc_sce_inform_cert_sign
149151

150152
#endif
151153

0 commit comments

Comments
 (0)