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

TOMOYO Linux Cross Reference
Linux/arch/arm/crypto/sha2-ce-glue.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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 /arch/arm/crypto/sha2-ce-glue.c (Version linux-6.11-rc3) and /arch/sparc64/crypto/sha2-ce-glue.c (Version linux-6.1.104)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 
  2 /*                                                
  3  * sha2-ce-glue.c - SHA-224/SHA-256 using ARMv    
  4  *                                                
  5  * Copyright (C) 2015 Linaro Ltd <ard.biesheuv    
  6  */                                               
  7                                                   
  8 #include <crypto/internal/hash.h>                 
  9 #include <crypto/internal/simd.h>                 
 10 #include <crypto/sha2.h>                          
 11 #include <crypto/sha256_base.h>                   
 12 #include <linux/cpufeature.h>                     
 13 #include <linux/crypto.h>                         
 14 #include <linux/module.h>                         
 15                                                   
 16 #include <asm/hwcap.h>                            
 17 #include <asm/simd.h>                             
 18 #include <asm/neon.h>                             
 19 #include <asm/unaligned.h>                        
 20                                                   
 21 #include "sha256_glue.h"                          
 22                                                   
 23 MODULE_DESCRIPTION("SHA-224/SHA-256 secure has    
 24 MODULE_AUTHOR("Ard Biesheuvel <ard.biesheuvel@    
 25 MODULE_LICENSE("GPL v2");                         
 26                                                   
 27 asmlinkage void sha2_ce_transform(struct sha25    
 28                                   int blocks);    
 29                                                   
 30 static int sha2_ce_update(struct shash_desc *d    
 31                           unsigned int len)       
 32 {                                                 
 33         struct sha256_state *sctx = shash_desc    
 34                                                   
 35         if (!crypto_simd_usable() ||              
 36             (sctx->count % SHA256_BLOCK_SIZE)     
 37                 return crypto_sha256_arm_updat    
 38                                                   
 39         kernel_neon_begin();                      
 40         sha256_base_do_update(desc, data, len,    
 41                               (sha256_block_fn    
 42         kernel_neon_end();                        
 43                                                   
 44         return 0;                                 
 45 }                                                 
 46                                                   
 47 static int sha2_ce_finup(struct shash_desc *de    
 48                          unsigned int len, u8     
 49 {                                                 
 50         if (!crypto_simd_usable())                
 51                 return crypto_sha256_arm_finup    
 52                                                   
 53         kernel_neon_begin();                      
 54         if (len)                                  
 55                 sha256_base_do_update(desc, da    
 56                                       (sha256_    
 57         sha256_base_do_finalize(desc, (sha256_    
 58         kernel_neon_end();                        
 59                                                   
 60         return sha256_base_finish(desc, out);     
 61 }                                                 
 62                                                   
 63 static int sha2_ce_final(struct shash_desc *de    
 64 {                                                 
 65         return sha2_ce_finup(desc, NULL, 0, ou    
 66 }                                                 
 67                                                   
 68 static struct shash_alg algs[] = { {              
 69         .init                   = sha224_base_    
 70         .update                 = sha2_ce_upda    
 71         .final                  = sha2_ce_fina    
 72         .finup                  = sha2_ce_finu    
 73         .descsize               = sizeof(struc    
 74         .digestsize             = SHA224_DIGES    
 75         .base                   = {               
 76                 .cra_name               = "sha    
 77                 .cra_driver_name        = "sha    
 78                 .cra_priority           = 300,    
 79                 .cra_blocksize          = SHA2    
 80                 .cra_module             = THIS    
 81         }                                         
 82 }, {                                              
 83         .init                   = sha256_base_    
 84         .update                 = sha2_ce_upda    
 85         .final                  = sha2_ce_fina    
 86         .finup                  = sha2_ce_finu    
 87         .descsize               = sizeof(struc    
 88         .digestsize             = SHA256_DIGES    
 89         .base                   = {               
 90                 .cra_name               = "sha    
 91                 .cra_driver_name        = "sha    
 92                 .cra_priority           = 300,    
 93                 .cra_blocksize          = SHA2    
 94                 .cra_module             = THIS    
 95         }                                         
 96 } };                                              
 97                                                   
 98 static int __init sha2_ce_mod_init(void)          
 99 {                                                 
100         return crypto_register_shashes(algs, A    
101 }                                                 
102                                                   
103 static void __exit sha2_ce_mod_fini(void)         
104 {                                                 
105         crypto_unregister_shashes(algs, ARRAY_    
106 }                                                 
107                                                   
108 module_cpu_feature_match(SHA2, sha2_ce_mod_ini    
109 module_exit(sha2_ce_mod_fini);                    
110                                                   

~ [ 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