Hi,

On Wed, Oct 26, 2016 at 02:09:24PM +0300, Cristian Stoica wrote:
> Signed-off-by: Cristian Stoica <cristian.sto...@nxp.com>
> ---
>  tests/async_cipher.c     | 36 ++++++++++++++--------------
>  tests/async_hmac.c       |  8 +++----
>  tests/cipher-aead-srtp.c | 50 +++++++++++++++++++-------------------
>  tests/cipher-aead.c      | 48 ++++++++++++++++++-------------------
>  tests/cipher-gcm.c       | 62 
> ++++++++++++++++++++++++------------------------
>  tests/cipher.c           | 35 ++++++++++++++-------------
>  tests/cipher_comp.c      | 12 +++++-----
>  tests/fullspeed.c        |  3 ++-
>  tests/hash_comp.c        |  8 +++----
>  tests/hmac.c             |  8 +++----
>  tests/speed.c            |  2 ++
>  11 files changed, 137 insertions(+), 135 deletions(-)
> 
> diff --git a/tests/async_cipher.c b/tests/async_cipher.c
> index 162a695..dd08403 100644
> --- a/tests/async_cipher.c
> +++ b/tests/async_cipher.c
> @@ -9,7 +9,7 @@
>  #include <string.h>
>  #include <unistd.h>
>  #include <fcntl.h>
> -
> +#include <stdint.h>

I guess you can omit this by casting to __u8 instead, which is used in
cryptodev.h already. Any reason why uint8_t is preferred instead?

>  #include <sys/ioctl.h>
>  #include <crypto/cryptodev.h>
>  
> @@ -26,10 +26,10 @@ static int debug = 0;
>  static int
>  test_crypto(int cfd)
>  {
> -     char plaintext_raw[DATA_SIZE + 63], *plaintext;
> -     char ciphertext_raw[DATA_SIZE + 63], *ciphertext;
> -     char iv[BLOCK_SIZE];
> -     char key[KEY_SIZE];
> +     uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext;
> +     uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext;
> +     uint8_t iv[BLOCK_SIZE];
> +     uint8_t key[KEY_SIZE];
>  
>       struct session_op sess;
>  #ifdef CIOCGSESSINFO
> @@ -62,8 +62,8 @@ test_crypto(int cfd)
>               perror("ioctl(CIOCGSESSINFO)");
>               return 1;
>       }
> -     plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & 
> ~siop.alignmask);
> -     ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) 
> & ~siop.alignmask);
> +     plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) 
> & ~siop.alignmask);
> +     ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + 
> siop.alignmask) & ~siop.alignmask);

I tried to fix tests/cipher.c after enabling -Wall by leaving the
variables in type char and casting at the point they are assigned to the
ioctl structs, which resulted in a smaller patch and less long lines. ;)
Would you mind giving it a try?

OTOH, the lines above cry for a macro. I think of something like:

#define buf_align(buf, align) \
        ((unsigned long)(buf) + (align) & ~(align))

What do you think?

[...]
> diff --git a/tests/async_hmac.c b/tests/async_hmac.c
> index 97fd0c5..94a02c0 100644
> --- a/tests/async_hmac.c
> +++ b/tests/async_hmac.c
> @@ -61,7 +61,7 @@ test_crypto(int cfd)
>  
>       cryp.ses = sess.ses;
>       cryp.len = sizeof("what do ya want for nothing?")-1;
> -     cryp.src = "what do ya want for nothing?";
> +     cryp.src = (uint8_t*)"what do ya want for nothing?";

Missing space between type and asterisk. (There are a few more cases,
but you get the idea.)

Thanks, Phil

_______________________________________________
Cryptodev-linux-devel mailing list
Cryptodev-linux-devel@gna.org
https://mail.gna.org/listinfo/cryptodev-linux-devel

Reply via email to