diff mbox

[API-NEXT] validation: crypto: verify odp crypto capability

Message ID 1461334440-19840-1-git-send-email-balakrishna.garapati@linaro.org
State Superseded
Headers show

Commit Message

Balakrishna Garapati April 22, 2016, 2:14 p.m. UTC
test update to verify the crypto capability fucntionality

Signed-off-by: Balakrishna Garapati <balakrishna.garapati@linaro.org>
---
 test/validation/crypto/odp_crypto_test_inp.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

Maxim Uvarov April 22, 2016, 2:35 p.m. UTC | #1
it has to be patch set due to this patch will not run without 
implementation.

On 04/22/16 17:14, Balakrishna Garapati wrote:
> test update to verify the crypto capability fucntionality
>
> Signed-off-by: Balakrishna Garapati <balakrishna.garapati@linaro.org>
> ---
>   test/validation/crypto/odp_crypto_test_inp.c | 28 ++++++++++++++++++++++++++++
>   1 file changed, 28 insertions(+)
>
> diff --git a/test/validation/crypto/odp_crypto_test_inp.c b/test/validation/crypto/odp_crypto_test_inp.c
> index fc125f7..b608a76 100644
> --- a/test/validation/crypto/odp_crypto_test_inp.c
> +++ b/test/validation/crypto/odp_crypto_test_inp.c
> @@ -46,6 +46,7 @@ static void alg_test(odp_crypto_op_t op,
>   		     )
>   {
>   	odp_crypto_session_t session;
> +	odp_crypto_capability_t capability;
>   	int rc;
>   	odp_crypto_ses_create_err_t status;
>   	odp_bool_t posted;
> @@ -53,6 +54,33 @@ static void alg_test(odp_crypto_op_t op,
>   	odp_crypto_compl_t compl_event;
>   	odp_crypto_op_result_t result;
>   
> +	/* Initialize crypto capability structure */
> +	memset(&capability, 0, sizeof(odp_crypto_capability_t));
> +
> +	rc = odp_crypto_capability(&capability);
> +	CU_ASSERT(!rc);
> +
> +	if (cipher_alg == ODP_CIPHER_ALG_3DES_CBC &&
> +	    !(capability.ciphers.bit.trides_cbc))
> +		rc = -1;
> +	if (cipher_alg == ODP_CIPHER_ALG_AES128_CBC &&
> +	    !(capability.ciphers.bit.trides_cbc))
> +		rc = -1;
> +	if (cipher_alg == ODP_CIPHER_ALG_AES128_GCM &&
> +	    !(capability.ciphers.bit.trides_cbc))
> +		rc = -1;
looks like that only for your linux-generic implementation, on other
platforms there might be zeroes.

Maxim.
> +
> +	CU_ASSERT(!rc);
> +
> +	if (auth_alg == ODP_AUTH_ALG_AES128_GCM &&
> +	    !(capability.auths.bit.aes128_gcm))
> +		rc = -1;
> +	if (auth_alg == ODP_AUTH_ALG_NULL &&
> +	    !(capability.auths.bit.null))
> +		rc = -1;
> +
> +	CU_ASSERT(!rc);
> +
>   	/* Create a crypto session */
>   	odp_crypto_session_params_t ses_params;
>   	memset(&ses_params, 0, sizeof(ses_params));
Christophe Milard April 22, 2016, 3:43 p.m. UTC | #2
On 22 April 2016 at 16:14, Balakrishna Garapati <
balakrishna.garapati@linaro.org> wrote:

> test update to verify the crypto capability fucntionality

>

> Signed-off-by: Balakrishna Garapati <balakrishna.garapati@linaro.org>

> ---

>  test/validation/crypto/odp_crypto_test_inp.c | 28

> ++++++++++++++++++++++++++++

>  1 file changed, 28 insertions(+)

>

> diff --git a/test/validation/crypto/odp_crypto_test_inp.c

> b/test/validation/crypto/odp_crypto_test_inp.c

> index fc125f7..b608a76 100644

> --- a/test/validation/crypto/odp_crypto_test_inp.c

> +++ b/test/validation/crypto/odp_crypto_test_inp.c

> @@ -46,6 +46,7 @@ static void alg_test(odp_crypto_op_t op,

>                      )

>  {

>         odp_crypto_session_t session;

> +       odp_crypto_capability_t capability;

>         int rc;

>         odp_crypto_ses_create_err_t status;

>         odp_bool_t posted;

> @@ -53,6 +54,33 @@ static void alg_test(odp_crypto_op_t op,

>         odp_crypto_compl_t compl_event;

>         odp_crypto_op_result_t result;

>

> +       /* Initialize crypto capability structure */

> +       memset(&capability, 0, sizeof(odp_crypto_capability_t));

> +

> +       rc = odp_crypto_capability(&capability);

> +       CU_ASSERT(!rc);

> +

> +       if (cipher_alg == ODP_CIPHER_ALG_3DES_CBC &&

> +           !(capability.ciphers.bit.trides_cbc))

> +               rc = -1;

> +       if (cipher_alg == ODP_CIPHER_ALG_AES128_CBC &&

> +           !(capability.ciphers.bit.trides_cbc))

> +               rc = -1;

> +       if (cipher_alg == ODP_CIPHER_ALG_AES128_GCM &&

> +           !(capability.ciphers.bit.trides_cbc))

> +               rc = -1;

>


You are testing 3 times the same bit here... copy/paster error?

Christophe


> +

> +       CU_ASSERT(!rc);

> +

> +       if (auth_alg == ODP_AUTH_ALG_AES128_GCM &&

> +           !(capability.auths.bit.aes128_gcm))

> +               rc = -1;

> +       if (auth_alg == ODP_AUTH_ALG_NULL &&

> +           !(capability.auths.bit.null))

> +               rc = -1;

> +

> +       CU_ASSERT(!rc);

> +

>         /* Create a crypto session */

>         odp_crypto_session_params_t ses_params;

>         memset(&ses_params, 0, sizeof(ses_params));

> --

> 1.9.1

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>
Balakrishna Garapati April 22, 2016, 4:19 p.m. UTC | #3
On 22 April 2016 at 17:43, Christophe Milard <christophe.milard@linaro.org>
wrote:

>

>

> On 22 April 2016 at 16:14, Balakrishna Garapati <

> balakrishna.garapati@linaro.org> wrote:

>

>> test update to verify the crypto capability fucntionality

>>

>> Signed-off-by: Balakrishna Garapati <balakrishna.garapati@linaro.org>

>> ---

>>  test/validation/crypto/odp_crypto_test_inp.c | 28

>> ++++++++++++++++++++++++++++

>>  1 file changed, 28 insertions(+)

>>

>> diff --git a/test/validation/crypto/odp_crypto_test_inp.c

>> b/test/validation/crypto/odp_crypto_test_inp.c

>> index fc125f7..b608a76 100644

>> --- a/test/validation/crypto/odp_crypto_test_inp.c

>> +++ b/test/validation/crypto/odp_crypto_test_inp.c

>> @@ -46,6 +46,7 @@ static void alg_test(odp_crypto_op_t op,

>>                      )

>>  {

>>         odp_crypto_session_t session;

>> +       odp_crypto_capability_t capability;

>>         int rc;

>>         odp_crypto_ses_create_err_t status;

>>         odp_bool_t posted;

>> @@ -53,6 +54,33 @@ static void alg_test(odp_crypto_op_t op,

>>         odp_crypto_compl_t compl_event;

>>         odp_crypto_op_result_t result;

>>

>> +       /* Initialize crypto capability structure */

>> +       memset(&capability, 0, sizeof(odp_crypto_capability_t));

>> +

>> +       rc = odp_crypto_capability(&capability);

>> +       CU_ASSERT(!rc);

>> +

>> +       if (cipher_alg == ODP_CIPHER_ALG_3DES_CBC &&

>> +           !(capability.ciphers.bit.trides_cbc))

>> +               rc = -1;

>> +       if (cipher_alg == ODP_CIPHER_ALG_AES128_CBC &&

>> +           !(capability.ciphers.bit.trides_cbc))

>> +               rc = -1;

>> +       if (cipher_alg == ODP_CIPHER_ALG_AES128_GCM &&

>> +           !(capability.ciphers.bit.trides_cbc))

>> +               rc = -1;

>>

>

> You are testing 3 times the same bit here... copy/paster error?

>

You are right. I will fix it in the patch series.

>

> Christophe

>

>

>> +

>> +       CU_ASSERT(!rc);

>> +

>> +       if (auth_alg == ODP_AUTH_ALG_AES128_GCM &&

>> +           !(capability.auths.bit.aes128_gcm))

>> +               rc = -1;

>> +       if (auth_alg == ODP_AUTH_ALG_NULL &&

>> +           !(capability.auths.bit.null))

>> +               rc = -1;

>> +

>> +       CU_ASSERT(!rc);

>> +

>>         /* Create a crypto session */

>>         odp_crypto_session_params_t ses_params;

>>         memset(&ses_params, 0, sizeof(ses_params));

>> --

>> 1.9.1

>>

>> _______________________________________________

>> lng-odp mailing list

>> lng-odp@lists.linaro.org

>> https://lists.linaro.org/mailman/listinfo/lng-odp

>>

>

> /Krishna
diff mbox

Patch

diff --git a/test/validation/crypto/odp_crypto_test_inp.c b/test/validation/crypto/odp_crypto_test_inp.c
index fc125f7..b608a76 100644
--- a/test/validation/crypto/odp_crypto_test_inp.c
+++ b/test/validation/crypto/odp_crypto_test_inp.c
@@ -46,6 +46,7 @@  static void alg_test(odp_crypto_op_t op,
 		     )
 {
 	odp_crypto_session_t session;
+	odp_crypto_capability_t capability;
 	int rc;
 	odp_crypto_ses_create_err_t status;
 	odp_bool_t posted;
@@ -53,6 +54,33 @@  static void alg_test(odp_crypto_op_t op,
 	odp_crypto_compl_t compl_event;
 	odp_crypto_op_result_t result;
 
+	/* Initialize crypto capability structure */
+	memset(&capability, 0, sizeof(odp_crypto_capability_t));
+
+	rc = odp_crypto_capability(&capability);
+	CU_ASSERT(!rc);
+
+	if (cipher_alg == ODP_CIPHER_ALG_3DES_CBC &&
+	    !(capability.ciphers.bit.trides_cbc))
+		rc = -1;
+	if (cipher_alg == ODP_CIPHER_ALG_AES128_CBC &&
+	    !(capability.ciphers.bit.trides_cbc))
+		rc = -1;
+	if (cipher_alg == ODP_CIPHER_ALG_AES128_GCM &&
+	    !(capability.ciphers.bit.trides_cbc))
+		rc = -1;
+
+	CU_ASSERT(!rc);
+
+	if (auth_alg == ODP_AUTH_ALG_AES128_GCM &&
+	    !(capability.auths.bit.aes128_gcm))
+		rc = -1;
+	if (auth_alg == ODP_AUTH_ALG_NULL &&
+	    !(capability.auths.bit.null))
+		rc = -1;
+
+	CU_ASSERT(!rc);
+
 	/* Create a crypto session */
 	odp_crypto_session_params_t ses_params;
 	memset(&ses_params, 0, sizeof(ses_params));