cvs commit: src/sys/crypto/via padlock.h

Nate Lawson nate at root.org
Thu Jul 27 16:52:33 UTC 2006


Pawel Jakub Dawidek wrote:
> pjd         2006-07-25 19:06:54 UTC
> 
>   FreeBSD src repository
> 
>   Modified files:
>     sys/crypto/via       padlock.h 
>   Log:
>   Modify PADLOCK_ALIGN() macro, so when the given address is already 16 bytes
>   aligned, it will be used directly, not 'address + 16'.
>   
>   Revision  Changes    Path
>   1.3       +1 -1      src/sys/crypto/via/padlock.h
> 
> 
> Index: src/sys/crypto/via/padlock.h
> diff -u src/sys/crypto/via/padlock.h:1.2 src/sys/crypto/via/padlock.h:1.3
> --- src/sys/crypto/via/padlock.h:1.2	Tue Jul 25 19:04:26 2006
> +++ src/sys/crypto/via/padlock.h	Tue Jul 25 19:06:54 2006
> @@ -72,7 +72,7 @@
>  	TAILQ_ENTRY(padlock_session) ses_next;
>  };
>  
> -#define PADLOCK_ALIGN(p)	(void *)((char *)(p) - ((uintptr_t)(p) % 16) + 16)
> +#define PADLOCK_ALIGN(p)	(void *)((uintptr_t)(p) - (((uintptr_t)(p) - 1) % 16) + 15)
>  
>  int	padlock_cipher_setup(struct padlock_session *ses,
>  	    struct cryptoini *encini);

I think you want roundup2() since 16 is a power of 2, see sys/param.h

-- 
Nate



More information about the cvs-src mailing list