@@ -282,6 +282,7 @@ static int wp_rsaa_encrypt(wp_RsaAsymCtx* ctx, unsigned char* out,
282282 size_t * outLen , size_t outSize , const unsigned char * in , size_t inLen )
283283{
284284 int ok = 1 ;
285+ word32 sz ;
285286
286287 if (!wolfssl_prov_is_running ()) {
287288 ok = 0 ;
@@ -318,6 +319,14 @@ static int wp_rsaa_encrypt(wp_RsaAsymCtx* ctx, unsigned char* out,
318319 ok = 0 ;
319320 }
320321 }
322+ else if (ctx -> padMode == RSA_NO_PADDING ) {
323+ sz = (word32 )outSize ;
324+ rc = wc_RsaDirect ((byte * )in , (word32 )inLen , out , & sz ,
325+ wp_rsa_get_key (ctx -> rsa ), RSA_PUBLIC_ENCRYPT , & ctx -> rng );
326+ if (rc < 0 ) {
327+ ok = 0 ;
328+ }
329+ }
321330 else {
322331 ok = 0 ;
323332 }
@@ -371,6 +380,7 @@ static int wp_rsaa_decrypt(wp_RsaAsymCtx* ctx, unsigned char* out,
371380 size_t * outLen , size_t outSize , const unsigned char * in , size_t inLen )
372381{
373382 int ok = 1 ;
383+ word32 sz ;
374384
375385 if (!wolfssl_prov_is_running ()) {
376386 ok = 0 ;
@@ -455,6 +465,16 @@ static int wp_rsaa_decrypt(wp_RsaAsymCtx* ctx, unsigned char* out,
455465 }
456466 }
457467 }
468+ else if (ctx -> padMode == RSA_NO_PADDING ) {
469+ sz = (word32 )outSize ;
470+ PRIVATE_KEY_UNLOCK ();
471+ rc = wc_RsaDirect ((byte * )in , (word32 )inLen , out , & sz ,
472+ wp_rsa_get_key (ctx -> rsa ), RSA_PRIVATE_DECRYPT , & ctx -> rng );
473+ PRIVATE_KEY_LOCK ();
474+ if (rc < 0 ) {
475+ ok = 0 ;
476+ }
477+ }
458478 else {
459479 ok = 0 ;
460480 }
0 commit comments