[API-NEXT,4/4] validation: crypto: add stubs for sha-1 and sha-512 tests

Message ID 1487776105-32713-5-git-send-email-petri.savolainen@linaro.org
State New
Headers show
Series
  • Add sha-1 and sha-512
Related show

Commit Message

Petri Savolainen Feb. 22, 2017, 3:08 p.m.
API enumerations are tested but functional tests are missing still.

Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

---
 test/common_plat/validation/api/crypto/crypto.h    |  2 ++
 .../validation/api/crypto/odp_crypto_test_inp.c    | 32 ++++++++++++++++++++++
 2 files changed, 34 insertions(+)

-- 
2.8.1

Comments

Dmitry Eremin-Solenikov Feb. 22, 2017, 4:37 p.m. | #1
On 22.02.2017 18:08, Petri Savolainen wrote:
> API enumerations are tested but functional tests are missing still.


If nobody steps up, I will take a look onto implementing funcionality
and tests. I have several issues with the current code anyway.

> 

> Signed-off-by: Petri Savolainen <petri.savolainen@linaro.org>

> ---

>  test/common_plat/validation/api/crypto/crypto.h    |  2 ++

>  .../validation/api/crypto/odp_crypto_test_inp.c    | 32 ++++++++++++++++++++++

>  2 files changed, 34 insertions(+)

> 

> diff --git a/test/common_plat/validation/api/crypto/crypto.h b/test/common_plat/validation/api/crypto/crypto.h

> index 9b909aa..c25cbb3 100644

> --- a/test/common_plat/validation/api/crypto/crypto.h

> +++ b/test/common_plat/validation/api/crypto/crypto.h

> @@ -23,7 +23,9 @@ void crypto_test_enc_alg_aes128_gcm_ovr_iv(void);

>  void crypto_test_dec_alg_aes128_gcm(void);

>  void crypto_test_dec_alg_aes128_gcm_ovr_iv(void);

>  void crypto_test_alg_hmac_md5(void);

> +void crypto_test_alg_hmac_sha1(void);

>  void crypto_test_alg_hmac_sha256(void);

> +void crypto_test_alg_hmac_sha512(void);

>  

>  /* test arrays: */

>  extern odp_testinfo_t crypto_suite[];

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

> index 43ddb2f..42149ac 100644

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

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

> @@ -330,10 +330,18 @@ static int check_alg_support(odp_cipher_alg_t cipher, odp_auth_alg_t auth)

>  		if (!capability.auths.bit.md5_hmac)

>  			return ODP_TEST_INACTIVE;

>  		break;

> +	case ODP_AUTH_ALG_SHA1_HMAC:

> +		if (!capability.auths.bit.sha1_hmac)

> +			return ODP_TEST_INACTIVE;

> +		break;

>  	case ODP_AUTH_ALG_SHA256_HMAC:

>  		if (!capability.auths.bit.sha256_hmac)

>  			return ODP_TEST_INACTIVE;

>  		break;

> +	case ODP_AUTH_ALG_SHA512_HMAC:

> +		if (!capability.auths.bit.sha512_hmac)

> +			return ODP_TEST_INACTIVE;

> +		break;

>  	case ODP_AUTH_ALG_AES_GCM:

>  		if (!capability.auths.bit.aes_gcm)

>  			return ODP_TEST_INACTIVE;

> @@ -1001,6 +1009,26 @@ void crypto_test_alg_hmac_sha256(void)

>  	}

>  }

>  

> +static int check_alg_hmac_sha1(void)

> +{

> +	return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA1_HMAC);

> +}

> +

> +void crypto_test_alg_hmac_sha1(void)

> +{

> +	printf(" TEST NOT IMPLEMENTED YET ");

> +}

> +

> +static int check_alg_hmac_sha512(void)

> +{

> +	return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA512_HMAC);

> +}

> +

> +void crypto_test_alg_hmac_sha512(void)

> +{

> +	printf(" TEST NOT IMPLEMENTED YET ");

> +}

> +

>  int crypto_suite_sync_init(void)

>  {

>  	suite_context.pool = odp_pool_lookup("packet_pool");

> @@ -1052,8 +1080,12 @@ odp_testinfo_t crypto_suite[] = {

>  				  check_alg_aes_gcm),

>  	ODP_TEST_INFO_CONDITIONAL(crypto_test_alg_hmac_md5,

>  				  check_alg_hmac_md5),

> +	ODP_TEST_INFO_CONDITIONAL(crypto_test_alg_hmac_sha1,

> +				  check_alg_hmac_sha1),

>  	ODP_TEST_INFO_CONDITIONAL(crypto_test_alg_hmac_sha256,

>  				  check_alg_hmac_sha256),

> +	ODP_TEST_INFO_CONDITIONAL(crypto_test_alg_hmac_sha512,

> +				  check_alg_hmac_sha512),

>  	ODP_TEST_INFO_NULL,

>  };

>  

> 



-- 
With best wishes
Dmitry
Savolainen, Petri (Nokia - FI/Espoo) Feb. 23, 2017, 7:45 a.m. | #2
> -----Original Message-----

> From: Dmitry Eremin-Solenikov [mailto:dmitry.ereminsolenikov@linaro.org]

> Sent: Wednesday, February 22, 2017 6:37 PM

> To: Petri Savolainen <petri.savolainen@linaro.org>; lng-

> odp@lists.linaro.org

> Subject: Re: [lng-odp] [API-NEXT PATCH 4/4] validation: crypto: add stubs

> for sha-1 and sha-512 tests

> 

> On 22.02.2017 18:08, Petri Savolainen wrote:

> > API enumerations are tested but functional tests are missing still.

> 

> If nobody steps up, I will take a look onto implementing funcionality

> and tests. I have several issues with the current code anyway.

> 


That would be great. If you are happy with the changes in this patch set, send your reviewed-by signature (e.g. for the cover letter). So that Maxim can merge it into the repo.

-Petri

Patch hide | download patch | download mbox

diff --git a/test/common_plat/validation/api/crypto/crypto.h b/test/common_plat/validation/api/crypto/crypto.h
index 9b909aa..c25cbb3 100644
--- a/test/common_plat/validation/api/crypto/crypto.h
+++ b/test/common_plat/validation/api/crypto/crypto.h
@@ -23,7 +23,9 @@  void crypto_test_enc_alg_aes128_gcm_ovr_iv(void);
 void crypto_test_dec_alg_aes128_gcm(void);
 void crypto_test_dec_alg_aes128_gcm_ovr_iv(void);
 void crypto_test_alg_hmac_md5(void);
+void crypto_test_alg_hmac_sha1(void);
 void crypto_test_alg_hmac_sha256(void);
+void crypto_test_alg_hmac_sha512(void);
 
 /* test arrays: */
 extern odp_testinfo_t crypto_suite[];
diff --git a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
index 43ddb2f..42149ac 100644
--- a/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
+++ b/test/common_plat/validation/api/crypto/odp_crypto_test_inp.c
@@ -330,10 +330,18 @@  static int check_alg_support(odp_cipher_alg_t cipher, odp_auth_alg_t auth)
 		if (!capability.auths.bit.md5_hmac)
 			return ODP_TEST_INACTIVE;
 		break;
+	case ODP_AUTH_ALG_SHA1_HMAC:
+		if (!capability.auths.bit.sha1_hmac)
+			return ODP_TEST_INACTIVE;
+		break;
 	case ODP_AUTH_ALG_SHA256_HMAC:
 		if (!capability.auths.bit.sha256_hmac)
 			return ODP_TEST_INACTIVE;
 		break;
+	case ODP_AUTH_ALG_SHA512_HMAC:
+		if (!capability.auths.bit.sha512_hmac)
+			return ODP_TEST_INACTIVE;
+		break;
 	case ODP_AUTH_ALG_AES_GCM:
 		if (!capability.auths.bit.aes_gcm)
 			return ODP_TEST_INACTIVE;
@@ -1001,6 +1009,26 @@  void crypto_test_alg_hmac_sha256(void)
 	}
 }
 
+static int check_alg_hmac_sha1(void)
+{
+	return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA1_HMAC);
+}
+
+void crypto_test_alg_hmac_sha1(void)
+{
+	printf(" TEST NOT IMPLEMENTED YET ");
+}
+
+static int check_alg_hmac_sha512(void)
+{
+	return check_alg_support(ODP_CIPHER_ALG_NULL, ODP_AUTH_ALG_SHA512_HMAC);
+}
+
+void crypto_test_alg_hmac_sha512(void)
+{
+	printf(" TEST NOT IMPLEMENTED YET ");
+}
+
 int crypto_suite_sync_init(void)
 {
 	suite_context.pool = odp_pool_lookup("packet_pool");
@@ -1052,8 +1080,12 @@  odp_testinfo_t crypto_suite[] = {
 				  check_alg_aes_gcm),
 	ODP_TEST_INFO_CONDITIONAL(crypto_test_alg_hmac_md5,
 				  check_alg_hmac_md5),
+	ODP_TEST_INFO_CONDITIONAL(crypto_test_alg_hmac_sha1,
+				  check_alg_hmac_sha1),
 	ODP_TEST_INFO_CONDITIONAL(crypto_test_alg_hmac_sha256,
 				  check_alg_hmac_sha256),
+	ODP_TEST_INFO_CONDITIONAL(crypto_test_alg_hmac_sha512,
+				  check_alg_hmac_sha512),
 	ODP_TEST_INFO_NULL,
 };