一、Kernel Crypto Arch

基于kernel 5.13 对crypto目录粗略分类

1、crypto_register_alg/crypto_register_algs

crypto_register_alg

arch/arm/crypto/aes-cipher-glue.c, line 54
arch/arm64/crypto/aes-ce-glue.c, line 170
arch/arm64/crypto/aes-cipher-glue.c, line 49
arch/arm64/crypto/sm4-ce-glue.c, line 65
arch/powerpc/crypto/aes-spe-glue.c, line 493
arch/s390/crypto/aes_s390.c, line 1000
arch/s390/crypto/des_s390.c, line 407
arch/sparc/crypto/aes_glue.c, line 451
arch/sparc/crypto/camellia_glue.c, line 270
arch/x86/crypto/aesni-intel_glue.c, line 1163
arch/x86/crypto/blowfish_glue.c, line 330
arch/x86/crypto/camellia_glue.c, line 1392
arch/x86/crypto/des3_ede_glue.c, line 374
arch/x86/crypto/twofish_glue.c, line 86
crypto/842.c, line 126
crypto/acompress.c, line 158
crypto/aead.c, line 247
crypto/aes_generic.c, line 1306
crypto/aes_ti.c, line 70
crypto/ahash.c, line 593
crypto/akcipher.c, line 137
crypto/algapi.c
line 432
line 472
crypto/anubis.c, line 692
crypto/blowfish_generic.c, line 118
crypto/camellia_generic.c, line 1059
crypto/cast5_generic.c, line 526
crypto/cast6_generic.c, line 266
crypto/deflate.c, line 315
crypto/fcrypt.c, line 406
crypto/khazad.c, line 869
crypto/kpp.c, line 104
crypto/lz4.c, line 136
crypto/lz4hc.c, line 137
crypto/lzo-rle.c, line 139
crypto/lzo.c, line 139
crypto/rng.c, line 188
crypto/scompress.c, line 265
crypto/seed.c, line 461
crypto/serpent_generic.c, line 594
crypto/shash.c, line 564
crypto/skcipher.c, line 819
crypto/sm4_generic.c, line 226
crypto/twofish_generic.c, line 182
crypto/zstd.c, line 236
drivers/crypto/cavium/zip/zip_main.c
line 406
line 412
drivers/crypto/geode-aes.c, line 389
drivers/crypto/nx/nx-842-pseries.c, line 1020
drivers/crypto/nx/nx-common-powernv.c, line 1113
drivers/crypto/padlock-aes.c, line 496
drivers/crypto/vmx/vmx.c, line 30

crypto_register_algs

arch/sparc/crypto/des_glue.c, line 458
crypto/algapi.c, line 485
crypto/crypto_null.c, line 192
crypto/des_generic.c, line 117
crypto/tea.c, line 263

2、crypto_register_template/crypto_register_templates

crypto_register_template

crypto/adiantum.c, line 605
crypto/algapi.c
line 516
line 523
crypto/authenc.c, line 456
crypto/authencesn.c, line 471
crypto/cbc.c, line 210
crypto/cfb.c, line 240
crypto/cmac.c, line 303
crypto/cryptd.c, line 1076
crypto/cts.c, line 397
crypto/ecb.c, line 91
crypto/echainiv.c, line 152
crypto/essiv.c, line 633
crypto/hmac.c, line 246
crypto/keywrap.c, line 305
crypto/lrw.c, line 417
crypto/ofb.c, line 92
crypto/pcbc.c, line 181
crypto/pcrypt.c, line 352
crypto/rsa.c, line 266
crypto/seqiv.c, line 175
crypto/vmac.c, line 683
crypto/xcbc.c, line 262
crypto/xts.c, line 454

crypto_register_templates

crypto/algapi.c, line 534
crypto/ccm.c, line 939
crypto/chacha20poly1305.c, line 661
crypto/ctr.c, line 345
crypto/gcm.c, line 1144

3、crypto_register_aead

 crypto_register_aead

arch/arm64/crypto/aes-ce-ccm-glue.c, line 363
arch/arm64/crypto/ghash-ce-glue.c, line 605
arch/s390/crypto/aes_s390.c, line 1040
crypto/aead.c
line 249
line 262
crypto/aegis128-core.c
line 548
line 554
crypto/simd.c, line 441
drivers/crypto/amcc/crypto4xx_core.c, line 1024
drivers/crypto/atmel-aes.c
line 2390
line 2408
drivers/crypto/bcm/cipher.c, line 4559
drivers/crypto/caam/caamalg.c, line 3639
drivers/crypto/caam/caamalg_qi.c, line 2712
drivers/crypto/caam/caamalg_qi2.c, line 5309
drivers/crypto/ccp/ccp-crypto-aes-galois.c, line 231
drivers/crypto/ccree/cc_aead.c, line 2646
drivers/crypto/chelsio/chcr_algo.c, line 4463
drivers/crypto/inside-secure/safexcel.c, line 1282
drivers/crypto/ixp4xx_crypto.c, line 1472
drivers/crypto/nx/nx.c, line 524
drivers/crypto/omap-aes.c, line 1216
drivers/crypto/sa2ul.c, line 2233
drivers/crypto/talitos.c, line 3510
drivers/crypto/xilinx/zynqmp-aes-gcm.c, line 408

4、crypto_register_shash/crypto_register_shashes

 crypto_register_shash

arch/arm/crypto/crct10dif-ce-glue.c, line 75
arch/arm/crypto/ghash-ce-glue.c, line 359
arch/arm/crypto/nhpoly1305-neon-glue.c, line 63
arch/arm/crypto/poly1305-glue.c, line 248
arch/arm/crypto/sha1-ce-glue.c, line 83
arch/arm/crypto/sha1_glue.c, line 72
arch/arm/crypto/sha1_neon_glue.c, line 91
arch/arm64/crypto/crct10dif-ce-glue.c, line 125
arch/arm64/crypto/ghash-ce-glue.c, line 607
arch/arm64/crypto/nhpoly1305-neon-glue.c, line 63
arch/arm64/crypto/poly1305-glue.c, line 217
arch/arm64/crypto/sha1-ce-glue.c, line 138
arch/arm64/crypto/sm3-ce-glue.c, line 80
arch/mips/cavium-octeon/crypto/octeon-md5.c, line 195
arch/mips/cavium-octeon/crypto/octeon-sha1.c, line 223
arch/mips/crypto/crc32-mips.c
line 320
line 325
arch/mips/crypto/poly1305-glue.c, line 177
arch/powerpc/crypto/crc32c-vpmsum_glue.c, line 158
arch/powerpc/crypto/crct10dif-vpmsum_glue.c, line 111
arch/powerpc/crypto/md5-glue.c, line 143
arch/powerpc/crypto/sha1-spe-glue.c, line 189
arch/powerpc/crypto/sha1.c, line 134
arch/s390/crypto/ghash_s390.c, line 140
arch/s390/crypto/sha1_s390.c, line 90
arch/s390/crypto/sha256_s390.c
line 121
line 124
arch/s390/crypto/sha3_256_s390.c
line 123
line 127
arch/s390/crypto/sha3_512_s390.c
line 134
line 137
arch/s390/crypto/sha512_s390.c
line 131
line 133
arch/sparc/crypto/crc32c_glue.c, line 162
arch/sparc/crypto/md5_glue.c, line 171
arch/sparc/crypto/sha1_glue.c, line 165
arch/sparc/crypto/sha256_glue.c
line 209
line 213
arch/sparc/crypto/sha512_glue.c
line 194
line 198
arch/x86/crypto/crc32-pclmul_glue.c, line 186
arch/x86/crypto/crc32c-intel_glue.c, line 234
arch/x86/crypto/crct10dif-pclmul_glue.c, line 127
arch/x86/crypto/ghash-clmulni-intel_glue.c, line 328
arch/x86/crypto/nhpoly1305-avx2-glue.c, line 64
arch/x86/crypto/nhpoly1305-sse2-glue.c, line 63
arch/x86/crypto/poly1305_glue.c, line 274
arch/x86/crypto/sha1_ssse3_glue.c
line 106
line 166
line 237
line 287
crypto/crc32_generic.c, line 117
crypto/crc32c_generic.c, line 153
crypto/crct10dif_generic.c, line 107
crypto/crypto_null.c, line 196
crypto/ghash-generic.c, line 170
crypto/md4.c, line 228
crypto/md5.c, line 237
crypto/michael_mic.c, line 160
crypto/nhpoly1305.c, line 240
crypto/poly1305_generic.c, line 134
crypto/rmd160.c, line 353
crypto/sha1_generic.c, line 81
crypto/shash.c
line 566
line 579
crypto/sm3_generic.c, line 184
crypto/xxhash_generic.c, line 91
drivers/crypto/nx/nx.c, line 532
drivers/crypto/padlock-sha.c
line 519
line 523
drivers/crypto/vmx/vmx.c, line 26

 crypto_register_shashes

arch/arm/crypto/blake2b-neon-glue.c, line 82
arch/arm/crypto/blake2s-glue.c, line 54
arch/arm/crypto/crc32-ce-glue.c, line 225
arch/arm/crypto/poly1305-glue.c, line 251
arch/arm/crypto/sha2-ce-glue.c, line 100
arch/arm/crypto/sha256_glue.c
line 89
line 95
arch/arm/crypto/sha512-glue.c
line 86
line 92
arch/arm64/crypto/aes-glue.c, line 1027
arch/arm64/crypto/crct10dif-ce-glue.c, line 121
arch/arm64/crypto/sha2-ce-glue.c, line 174
arch/arm64/crypto/sha256-glue.c
line 175
line 180
arch/arm64/crypto/sha3-ce-glue.c, line 157
arch/arm64/crypto/sha512-ce-glue.c, line 112
arch/arm64/crypto/sha512-glue.c, line 83
arch/mips/cavium-octeon/crypto/octeon-sha256.c, line 259
arch/mips/cavium-octeon/crypto/octeon-sha512.c, line 256
arch/powerpc/crypto/sha256-spe-glue.c, line 251
arch/s390/crypto/crc32-vx.c, line 292
arch/x86/crypto/blake2s-glue.c, line 113
arch/x86/crypto/sha256_ssse3_glue.c
line 134
line 210
line 284
line 350
arch/x86/crypto/sha512_ssse3_glue.c
line 132
line 208
line 283
crypto/blake2b_generic.c, line 166
crypto/blake2s_generic.c, line 56
crypto/sha256_generic.c, line 105
crypto/sha3_generic.c, line 284
crypto/sha512_generic.c, line 213
crypto/shash.c, line 592
crypto/streebog_generic.c, line 1077
crypto/wp512.c, line 1162
drivers/crypto/stm32/stm32-crc32.c, line 364

5、crypto_register_skcipher/crypto_register_skciphers

 crypto_register_skcipher

arch/s390/crypto/aes_s390.c, line 968
arch/s390/crypto/des_s390.c, line 417
arch/s390/crypto/paes_s390.c
line 757
line 765
line 772
line 785
crypto/arc4.c, line 73
crypto/crypto_null.c, line 200
crypto/simd.c, line 194
crypto/skcipher.c
line 821
line 834
drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c, line 474
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c, line 796
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c, line 589
drivers/crypto/amcc/crypto4xx_core.c, line 1036
drivers/crypto/amlogic/amlogic-gxl-core.c, line 186
drivers/crypto/atmel-aes.c
line 2374
line 2382
line 2398
drivers/crypto/atmel-tdes.c, line 1119
drivers/crypto/bcm/cipher.c, line 4475
drivers/crypto/caam/caamalg.c, line 3587
drivers/crypto/caam/caamalg_qi.c, line 2666
drivers/crypto/caam/caamalg_qi2.c, line 5259
drivers/crypto/ccp/ccp-crypto-aes-xts.c, line 262
drivers/crypto/ccp/ccp-crypto-aes.c, line 333
drivers/crypto/ccp/ccp-crypto-des3.c, line 203
drivers/crypto/ccree/cc_cipher.c, line 1491
drivers/crypto/chelsio/chcr_algo.c, line 4451
drivers/crypto/hifn_795x.c, line 2411
drivers/crypto/inside-secure/safexcel.c, line 1280
drivers/crypto/ixp4xx_crypto.c, line 1439
drivers/crypto/marvell/cesa/cesa.c, line 196
drivers/crypto/n2_core.c, line 1349
drivers/crypto/nx/nx.c, line 518
drivers/crypto/omap-aes.c, line 1200
drivers/crypto/omap-des.c, line 1059
drivers/crypto/padlock-aes.c
line 499
line 502
drivers/crypto/qce/skcipher.c, line 485
drivers/crypto/rockchip/rk3288_crypto.c, line 268
drivers/crypto/s5p-sss.c, line 2262
drivers/crypto/sa2ul.c, line 2227
drivers/crypto/sahara.c, line 1303
drivers/crypto/talitos.c, line 3504
drivers/crypto/ux500/cryp/cryp_core.c, line 1228
drivers/crypto/virtio/virtio_crypto_algs.c, line 632
drivers/crypto/vmx/vmx.c

 crypto_register_skciphers

arch/arm/crypto/aes-ce-glue.c, line 703
arch/arm/crypto/aes-neonbs-glue.c, line 538
arch/arm/crypto/chacha-glue.c
line 301
line 325
arch/arm64/crypto/aes-glue.c, line 1023
arch/arm64/crypto/aes-neonbs-glue.c, line 540
arch/arm64/crypto/chacha-neon-glue.c, line 223
arch/mips/crypto/chacha-glue.c, line 132
arch/powerpc/crypto/aes-spe-glue.c, line 497
arch/sparc/crypto/aes_glue.c, line 454
arch/sparc/crypto/camellia_glue.c, line 273
arch/sparc/crypto/des_glue.c, line 461
arch/x86/crypto/blowfish_glue.c, line 334
arch/x86/crypto/camellia_glue.c, line 1396
arch/x86/crypto/chacha_glue.c, line 297
arch/x86/crypto/des3_ede_glue.c, line 378
arch/x86/crypto/twofish_glue_3way.c, line 153
crypto/chacha_generic.c, line 120
crypto/simd.c, line 239
crypto/skcipher.c, line 847
drivers/crypto/axis/artpec6_crypto.c, line 2935
drivers/crypto/cavium/cpt/cptvf_algs.c, line 454
drivers/crypto/cavium/nitrox/nitrox_skcipher.c, line 544
drivers/crypto/geode-aes.c, line 393
drivers/crypto/hisilicon/sec/sec_algs.c, line 1104
drivers/crypto/hisilicon/sec2/sec_crypto.c, line 1671
drivers/crypto/keembay/keembay-ocs-aes-core.c, line 1563
drivers/crypto/marvell/octeontx/otx_cptvf_algs.c, line 1600
drivers/crypto/marvell/octeontx2/otx2_cptvf_algs.c, line 1641
drivers/crypto/mxs-dcp.c, line 1087
drivers/crypto/qat/qat_common/qat_algs.c, line 1550
drivers/crypto/stm32/stm32-cryp.c, line 2002

6、crypto_register_rng/crypto_register_rngs

 crypto_register_rngs

crypto/ansi_cprng.c, line 457
crypto/drbg.c, line 2138
crypto/rng.c, line 216

 crypto_register_rng

crypto/jitterentropy-kcapi.c, line 209
crypto/rng.c
line 190
line 203
drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c, line 490
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c, line 834
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c, line 598
drivers/crypto/amcc/crypto4xx_core.c, line 1032
drivers/crypto/exynos-rng.c, line 299
drivers/crypto/hisilicon/trng/trng.c, line 276
drivers/crypto/qcom-rng.c, line 182

7、crypto_register_kpp

crypto_register_kpp

arch/arm/crypto/curve25519-glue.c, line 120
arch/x86/crypto/curve25519-x86_64.c, line 1497
crypto/curve25519-generic.c, line 77
crypto/dh.c, line 265
crypto/ecdh.c
line 183
line 186
crypto/kpp.c, line 106
drivers/crypto/atmel-ecc.c, line 331
drivers/crypto/hisilicon/hpre/hpre_crypto.c
line 2005
line 2009
line 2033
line 2041
drivers/crypto/qat/qat_common/qat_asym_algs.c, line 1295

8、crypto_register_akcipher

crypto_register_akcipher

crypto/akcipher.c, line 139
crypto/ecdsa.c
line 340
line 343
line 347
crypto/ecrdsa.c, line 283
crypto/rsa.c, line 262
crypto/sm2.c, line 446
drivers/crypto/caam/caampkc.c, line 1177
drivers/crypto/ccp/ccp-crypto-rsa.c, line 263
drivers/crypto/hisilicon/hpre/hpre_crypto.c, line 2029
drivers/crypto/qat/qat_common/qat_asym_algs.c, line 1292

9、crypto_register_notifier

crypto_register_notifier

crypto/algapi.c, line 795
crypto/algboss.c, line 273
lib/crc-t10dif.c, line 95

10、af_alg_register_type

af_alg_register_type socket驱动

crypto/af_alg.c, line 87
crypto/algif_aead.c, line 592
crypto/algif_hash.c, line 470
crypto/algif_rng.c, line 332
crypto/algif_skcipher.c, line 377

11、其它文件

crypto/af_alg.c socket驱动
crypto/crypto_engine.c
crypto/crypto_user_base.c netlink通信
crypto/proc.c
crypto/scatterwalk.c
crypto/simd.c
crypto/tcrypt.c
crypto/testmgr.c

二、驱动

1、AES硬件加速引擎驱动代码

https://elixir.bootlin.com/linux/v5.13.13/source/drivers/crypto/geode-aes.c

https://elixir.bootlin.com/linux/v5.13.13/source/drivers/crypto/omap-aes.c

2、硬件加速驱动是否有配置 cra_alignmask;字段

 * @cra_alignmask: Alignment mask for the input and output data buffer. The data
 *           buffer containing the input data for the algorithm must be
 *           aligned to this alignment mask. The data buffer for the
 *           output data must be aligned to this alignment mask. Note that
 *           the Crypto API will do the re-alignment in software, but
 *           only under special conditions and there is a performance hit.
 *           The re-alignment happens at these occasions for different
 *           @cra_u types: cipher -- For both input data and output data
 *           buffer; ahash -- For output hash destination buf; shash --
 *           For output hash destination buf.
 *           This is needed on hardware which is flawed by design and
 *           cannot pick data from arbitrary addresses.

标签智能推荐:

Flutter之用md5加密

1.在pubspec.yaml中引入crucpto。crypto:^2.0.62.更新依赖3.在需要进行加密的地方文件中引入import'package:crypto/crypto.dart';import'dart:convert';第一个为工具类,第二个用来进行字符串的转化。4.使用md5.convert(utf8.encode(resStr)).toString()即可。

关闭内核Debug_log打印!

echo0>/proc/sys/kernel/printk \r

CentOS7的历史内核RPM包

http://193.49.22.109/elrepo/kernel/el7/x86_64/RPMS/

CSharp: itext7.* create pdf file

iText.Kernel;usingiText.IO;usingiText.Html2pdf;usingcom.itextpdf.layout;usingCommon.Logging;usingCommon.Logging.Factory;usingOrg.BouncyCastle;usingOrg.BouncyCastle.Crypto;usingOrg.BouncyCastle.X509;us

Is Parallel Programming Hard, And, If So, What Can You Do About It?

https://cdn.kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook.htmlhttps://mirrors.edge.kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook-e2.pdf (readingversionv2021.03.21a)h

PasswordEncoder in spring security 5

ty.crypto.password.LdapShaPasswordEncoder());6encoders.put("MD4",neworg.springframework.security.crypto.password.Md4PasswordEncoder());7encoders.put("MD5",neworg.springframework.security.crypto.passwo

openssl源码介绍

pto/x509v3),包括数字证书申请、数字证书和CRL的构造、解析和签名验证等功能了;22)对称算法(crypto/aes、crypto/bf、crypto/cast、ccrypto/omp和crypto/des等目录)。23)非对称算法(crypto/dh、crypto/dsa、crypto/ec和crypto/ecdh)。24)摘要算法(crypto/md2、crypto/md4、cryp

nodejs 公私钥文件加密解密

adFileSync(`publicKey.pem`).toString();constcrypto=require('crypto');constdata="eggsy";//公钥加密constencodeData=crypto.publicEncrypt(publicKey,Buffer.from(data)).toString('base64');console.log("encode:",

JCE加密报错

  默认不允许256位密钥的AES加解密,解决方法就是修改策略文件-JCE无限制权限策略文件。  安装Java密码学扩展(JCE)无限强度管辖权策略文件,  路径是JAVA_HOME/jre/lib/security。文本编辑器打开java.securityjava安全性属性crypto.policy的行,默认值是limited。#cry

Bugku-论剑场-Crypto-进制转换

Crypto-进制转换2021年10月21日10:304进制转16进制转字符串,脚本就好: