~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/crypto/aegis.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /crypto/aegis.h (Version linux-6.11.5) and /crypto/aegis.h (Version linux-4.18.20)


  1 /* SPDX-License-Identifier: GPL-2.0-or-later * !!   1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*                                                  2 /*
  3  * AEGIS common definitions                         3  * AEGIS common definitions
  4  *                                                  4  *
  5  * Copyright (c) 2018 Ondrej Mosnacek <omosnac      5  * Copyright (c) 2018 Ondrej Mosnacek <omosnacek@gmail.com>
  6  * Copyright (c) 2018 Red Hat, Inc. All rights      6  * Copyright (c) 2018 Red Hat, Inc. All rights reserved.
                                                   >>   7  *
                                                   >>   8  * This program is free software; you can redistribute it and/or modify it
                                                   >>   9  * under the terms of the GNU General Public License as published by the Free
                                                   >>  10  * Software Foundation; either version 2 of the License, or (at your option)
                                                   >>  11  * any later version.
  7  */                                                12  */
  8                                                    13 
  9 #ifndef _CRYPTO_AEGIS_H                            14 #ifndef _CRYPTO_AEGIS_H
 10 #define _CRYPTO_AEGIS_H                            15 #define _CRYPTO_AEGIS_H
 11                                                    16 
 12 #include <crypto/aes.h>                            17 #include <crypto/aes.h>
 13 #include <linux/bitops.h>                      << 
 14 #include <linux/types.h>                           18 #include <linux/types.h>
 15                                                    19 
 16 #define AEGIS_BLOCK_SIZE 16                        20 #define AEGIS_BLOCK_SIZE 16
 17                                                    21 
 18 union aegis_block {                                22 union aegis_block {
 19         __le64 words64[AEGIS_BLOCK_SIZE / size     23         __le64 words64[AEGIS_BLOCK_SIZE / sizeof(__le64)];
 20         __le32 words32[AEGIS_BLOCK_SIZE / size     24         __le32 words32[AEGIS_BLOCK_SIZE / sizeof(__le32)];
 21         u8 bytes[AEGIS_BLOCK_SIZE];                25         u8 bytes[AEGIS_BLOCK_SIZE];
 22 };                                                 26 };
 23                                                    27 
 24 struct aegis_state;                            << 
 25                                                << 
 26 extern int aegis128_have_aes_insn;             << 
 27                                                << 
 28 #define AEGIS_BLOCK_ALIGN (__alignof__(union a     28 #define AEGIS_BLOCK_ALIGN (__alignof__(union aegis_block))
 29 #define AEGIS_ALIGNED(p) IS_ALIGNED((uintptr_t     29 #define AEGIS_ALIGNED(p) IS_ALIGNED((uintptr_t)p, AEGIS_BLOCK_ALIGN)
 30                                                    30 
 31 bool crypto_aegis128_have_simd(void);          !!  31 static const union aegis_block crypto_aegis_const[2] = {
 32 void crypto_aegis128_update_simd(struct aegis_ !!  32         { .words64 = {
 33 void crypto_aegis128_init_simd(struct aegis_st !!  33                 cpu_to_le64(U64_C(0x0d08050302010100)),
 34                                const union aeg !!  34                 cpu_to_le64(U64_C(0x6279e99059372215)),
 35                                const u8 *iv);  !!  35         } },
 36 void crypto_aegis128_encrypt_chunk_simd(struct !!  36         { .words64 = {
 37                                         const  !!  37                 cpu_to_le64(U64_C(0xf12fc26d55183ddb)),
 38 void crypto_aegis128_decrypt_chunk_simd(struct !!  38                 cpu_to_le64(U64_C(0xdd28b57342311120)),
 39                                         const  !!  39         } },
 40 int crypto_aegis128_final_simd(struct aegis_st !!  40 };
 41                                union aegis_blo << 
 42                                unsigned int as << 
 43                                unsigned int cr << 
 44                                unsigned int au << 
 45                                                    41 
 46 static __always_inline void crypto_aegis_block !!  42 static void crypto_aegis_block_xor(union aegis_block *dst,
 47                                                !!  43                                    const union aegis_block *src)
 48 {                                                  44 {
 49         dst->words64[0] ^= src->words64[0];        45         dst->words64[0] ^= src->words64[0];
 50         dst->words64[1] ^= src->words64[1];        46         dst->words64[1] ^= src->words64[1];
 51 }                                                  47 }
 52                                                    48 
 53 static __always_inline void crypto_aegis_block !!  49 static void crypto_aegis_block_and(union aegis_block *dst,
 54                                                !!  50                                    const union aegis_block *src)
 55 {                                                  51 {
 56         dst->words64[0] &= src->words64[0];        52         dst->words64[0] &= src->words64[0];
 57         dst->words64[1] &= src->words64[1];        53         dst->words64[1] &= src->words64[1];
 58 }                                                  54 }
 59                                                    55 
 60 static __always_inline void crypto_aegis_aesen !!  56 static void crypto_aegis_aesenc(union aegis_block *dst,
 61                                                !!  57                                 const union aegis_block *src,
 62                                                !!  58                                 const union aegis_block *key)
 63 {                                                  59 {
 64         const u8  *s  = src->bytes;                60         const u8  *s  = src->bytes;
 65         const u32 *t = crypto_ft_tab[0];       !!  61         const u32 *t0 = crypto_ft_tab[0];
                                                   >>  62         const u32 *t1 = crypto_ft_tab[1];
                                                   >>  63         const u32 *t2 = crypto_ft_tab[2];
                                                   >>  64         const u32 *t3 = crypto_ft_tab[3];
 66         u32 d0, d1, d2, d3;                        65         u32 d0, d1, d2, d3;
 67                                                    66 
 68         d0 = t[s[ 0]] ^ rol32(t[s[ 5]], 8) ^ r !!  67         d0 = t0[s[ 0]] ^ t1[s[ 5]] ^ t2[s[10]] ^ t3[s[15]];
 69         d1 = t[s[ 4]] ^ rol32(t[s[ 9]], 8) ^ r !!  68         d1 = t0[s[ 4]] ^ t1[s[ 9]] ^ t2[s[14]] ^ t3[s[ 3]];
 70         d2 = t[s[ 8]] ^ rol32(t[s[13]], 8) ^ r !!  69         d2 = t0[s[ 8]] ^ t1[s[13]] ^ t2[s[ 2]] ^ t3[s[ 7]];
 71         d3 = t[s[12]] ^ rol32(t[s[ 1]], 8) ^ r !!  70         d3 = t0[s[12]] ^ t1[s[ 1]] ^ t2[s[ 6]] ^ t3[s[11]];
 72                                                    71 
 73         dst->words32[0] = cpu_to_le32(d0) ^ ke     72         dst->words32[0] = cpu_to_le32(d0) ^ key->words32[0];
 74         dst->words32[1] = cpu_to_le32(d1) ^ ke     73         dst->words32[1] = cpu_to_le32(d1) ^ key->words32[1];
 75         dst->words32[2] = cpu_to_le32(d2) ^ ke     74         dst->words32[2] = cpu_to_le32(d2) ^ key->words32[2];
 76         dst->words32[3] = cpu_to_le32(d3) ^ ke     75         dst->words32[3] = cpu_to_le32(d3) ^ key->words32[3];
 77 }                                                  76 }
 78                                                    77 
 79 #endif /* _CRYPTO_AEGIS_H */                       78 #endif /* _CRYPTO_AEGIS_H */
 80                                                    79 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php