diff --git a/crypto/crypto.c b/crypto/crypto.c index 8766581b931..e463f3204cb 100644 --- a/crypto/crypto.c +++ b/crypto/crypto.c @@ -106,22 +106,18 @@ int crypto_newsession(FAR uint64_t *sid, if (cpc->cc_flags & CRYPTOCAP_F_SOFTWARE) { - /* First round of search, ignore - * software drivers. - */ + /* Thread round of search only for software */ - if (turn == 0) + if (turn != 2) { continue; } } - else + else if (cpc->cc_flags & CRYPTOCAP_F_REMOTE) { - /* !CRYPTOCAP_F_SOFTWARE - * Second round of search, only software. - */ + /* Second round of search only for remote */ - if (turn == 1) + if (turn != 1) { continue; } @@ -189,7 +185,7 @@ int crypto_newsession(FAR uint64_t *sid, /* If we only want hardware drivers, don't do second pass. */ } - while (turn <= 2 && hard == 0); + while (turn < 2 || (turn == 2 && !hard)); hid = hid2; diff --git a/include/crypto/cryptodev.h b/include/crypto/cryptodev.h index aaec0790dbd..c26810f3d6a 100644 --- a/include/crypto/cryptodev.h +++ b/include/crypto/cryptodev.h @@ -352,6 +352,7 @@ struct cryptocap #define CRYPTOCAP_F_SOFTWARE 0x02 #define CRYPTOCAP_F_ENCRYPT_MAC 0x04 /* Can do encrypt-then-MAC (IPsec) */ #define CRYPTOCAP_F_MAC_ENCRYPT 0x08 /* Can do MAC-then-encrypt (TLS) */ +#define CRYPTOCAP_F_REMOTE 0x10 /* Remote core driver */ CODE int (*cc_newsession)(FAR uint32_t *, FAR struct cryptoini *); CODE int (*cc_process)(FAR struct cryptop *);