View: 6488|Reply: 3

Hardware AES / security system fails on H3

[Copy link]

1

threads

5

posts

41

credits

Novice

Rank: 1

credits
41
Published in 2015-10-20 06:28:27 | Show all floors |Read mode
The driver supplied with kernel 3.4.39 for hardware crypto security system (ss) fails with large AES requests, so it's unusable. What does "Too many scatter" even mean? The new sunxi-ss driver in mainline kernel works fine with A20, but there is no support for H3 in it nor is H3 usable with  mainline kernel yet for that matter.

Can anything be done or do we have to wait for mainline kernel and sunxi-ss to get support for H3?

cryptsetup benchmark fails with ss module loaded:
  1. root@OrangePI:~# cryptsetup benchmark
  2. # Tests are approximate using memory only (no storage IO).
  3. PBKDF2-sha1       137970 iterations per second
  4. PBKDF2-sha256      93622 iterations per second
  5. PBKDF2-sha512      42555 iterations per second
  6. PBKDF2-ripemd160  126030 iterations per second
  7. PBKDF2-whirlpool   10336 iterations per second
  8. #  Algorithm | Key |  Encryption |  Decryption
  9.      aes-cbc   128b           N/A           N/A
  10. serpent-cbc   128b           N/A           N/A
  11. twofish-cbc   128b           N/A           N/A
  12.      aes-cbc   256b           N/A           N/A
  13. serpent-cbc   256b           N/A           N/A
  14. twofish-cbc   256b           N/A           N/A
  15.      aes-xts   256b           N/A           N/A
  16. serpent-xts   256b           N/A           N/A
  17. twofish-xts   256b           N/A           N/A
  18.      aes-xts   512b           N/A           N/A
  19. serpent-xts   512b           N/A           N/A
  20. twofish-xts   512b           N/A           N/A
Copy code

logged output from af_alg_test shortened with uniq -c
  1. root@OrangePI:~# uniq -c log
  2. 1 root@OrangePI:~# ./af_alg_test aes
  3.       1 INFO: ./af_alg_test will do 1000.000000 request
  4.       1 aes 1000.000000 requests of 16 in 126534.000000us (0.126534s) 0.007903r/us 7.903014r/ms 7903.014160r/s
  5.       1 aes 1000.000000 requests of 32 in 123696.000000us (0.123696s) 0.008084r/us 8.084335r/ms 8084.335938r/s
  6.       1 aes 1000.000000 requests of 64 in 133176.000000us (0.133176s) 0.007509r/us 7.508861r/ms 7508.860352r/s
  7.       1 aes 1000.000000 requests of 128 in 132345.000000us (0.132345s) 0.007556r/us 7.556009r/ms 7556.008789r/s
  8.       1 aes 1000.000000 requests of 256 in 133477.000000us (0.133477s) 0.007492r/us 7.491928r/ms 7491.927246r/s
  9.       1 aes 1000.000000 requests of 512 in 146131.000000us (0.146131s) 0.006843r/us 6.843175r/ms 6843.174805r/s
  10.       1 aes 1000.000000 requests of 1024 in 150066.000000us (0.150066s) 0.006664r/us 6.663734r/ms 6663.734863r/s
  11.       1 aes 1000.000000 requests of 2048 in 164501.000000us (0.164501s) 0.006079r/us 6.078990r/ms 6078.990234r/s
  12.       1 aes 1000.000000 requests of 4096 in 214635.000000us (0.214635s) 0.004659r/us 4.659072r/ms 4659.072266r/s
  13.       1 aes 1000.000000 requests of 8192 in 370977.000000us (0.370977s) 0.002696r/us 2.695585r/ms 2695.584961r/s
  14.       1 aes 1000.000000 requests of 16384 in 576595.000000us (0.576595s) 0.001734r/us 1.734320r/ms 1734.319580r/s
  15.    1000 Did not receive the right amount of data
  16.       1 aes 1000.000000 requests of 32768 in 974193.000000us (0.974193s) 0.001026r/us 1.026491r/ms 1026.490601r/s
  17.    1000 Did not receive the right amount of data
  18.       1 aes 1000.000000 requests of 65536 in 1093468.000000us (1.093468s) 0.000915r/us 0.914522r/ms 914.521484r/s
  19.     100 Did not receive the right amount of data
  20.       1 aes 100.000000 requests of 131072 in 96782.000000us (0.096782s) 0.001033r/us 1.033250r/ms 1033.250000r/s
  21.     100 Did not receive the right amount of data
  22.       1 aes 100.000000 requests of 262144 in 104389.000000us (0.104389s) 0.000958r/us 0.957955r/ms 957.955322r/s
  23.     100 Did not receive the right amount of data
  24.       1 aes 100.000000 requests of 524288 in 94312.000000us (0.094312s) 0.001060r/us 1.060310r/ms 1060.310425r/s
  25.     100 Did not receive the right amount of data
  26.       1 aes 100.000000 requests of 1048576 in 107692.000000us (0.107692s) 0.000929r/us 0.928574r/ms 928.574097r/s
  27.     100 Did not receive the right amount of data
  28.       1 aes 100.000000 requests of 2097152 in 96809.000000us (0.096809s) 0.001033r/us 1.032962r/ms 1032.961792r/s
Copy code

fault logged to dmesg
  1. [1311385.175080] ------------[ cut here ]------------
  2. [1311385.175096] WARNING: at drivers/crypto/sunxi/v3/sunxi_ss_proc.c:101 ss_sg_config+0x5c/0x1d8 [ss]()
  3. [1311385.175105] Too many scatter: 8
  4. [1311385.175110]
  5. Modules linked in: ss crypto_user algif_hash algif_skcipher af_alg
  6. snd_usb_audio snd_usbmidi_lib snd_hwdep uvcvideo [last unloaded: ss]
  7. [1311385.175152] [<c0016a6c>] (unwind_backtrace+0x0/0xec) from [<c06a4bd8>] (dump_stack+0x20/0x24)
  8. [1311385.175167] [<c06a4bd8>] (dump_stack+0x20/0x24) from [<c0027a18>] (warn_slowpath_common+0x5c/0x74)
  9. [1311385.175181] [<c0027a18>] (warn_slowpath_common+0x5c/0x74) from [<c0027aec>] (warn_slowpath_fmt+0x40/0x48)
  10. [1311385.175202] [<c0027aec>] (warn_slowpath_fmt+0x40/0x48)rom [<bf08611c>] (ss_sg_config+0x5c/0x1d8 [ss])
  11. [1311385.175229] [<bf08611c>] (ss_sg_config+0x5c/0x1d8 [ss]) from [<bf086b8c>] (ss_aes_start+0x4f0/0x934 [ss])
  12. [1311385.175258] [<bf086b8c>] (ss_aes_start+0x4f0/0x934 [ss]) from [<bf087b84>] (ss_aes_one_req+0x13c/0x1a8 [ss])
  13. [1311385.175285] [<bf087b84>] (ss_aes_one_req+0x13c/0x1a8 [ss]) from [<bf085888>] (sunxi_ss_work+0x94/0x170 [ss])
  14. [1311385.175307] [<bf085888>] (sunxi_ss_work+0x94/0x170 [ss]) from [<c0043108>] (process_one_work+0x294/0x48c)
  15. [1311385.175322] [<c0043108>] (process_one_work+0x294/0x48c) from [<c0043674>] (worker_thread+0x1a8/0x2a4)
  16. [1311385.175337] [<c0043674>] (worker_thread+0x1a8/0x2a4) from [<c004837c>] (kthread+0x9c/0xa8)
  17. [1311385.175352] [<c004837c>] (kthread+0x9c/0xa8) from [<c000f360>] (kernel_thread_exit+0x0/0x8)
  18. [1311385.175361] ---[ end trace 25082aad9cb13992 ]---
  19. [1311385.175396] ss_aes_start()372 - CE return error: 2
  20. [1311385.175403] ss_aes_one_req()685 - ss_aes_start fail(-22)
Copy code



9

threads

634

posts

4427

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
4427
Published in 2015-10-22 00:55:01 | Show all floors
Edited by igorpec at 2015-10-21 17:57
Can anything be done or do we have to wait for mainline kernel and sunxi-ss to get support for H3?

http://sunxi.montjoie.ovh/
sunxi-ss also doesn't work properly on A20 with kernel 3.4 and I think author is not dealing with kernel 3.4 any more ... forget about it until H3 reaches mainline.

1

threads

5

posts

41

credits

Novice

Rank: 1

credits
41
 Author| Published in 2015-12-28 04:06:58 | Show all floors
Github user omonar seems to have patched the driver. https://github.com/omonar/OrangePI-Kernel/commit/26bb10ea978ba61e582f69f91dfef628fafd8c80

There is noticeable increase in aes-cbc performance.

cryptsetup benchmark without ss module loaded
  1. #  Algorithm | Key |  Encryption |  Decryption
  2.      aes-cbc   128b 19.1 MiB/s    19.8 MiB/s
  3.      aes-cbc   256b    14.7 MiB/s    15.0 MiB/s
Copy code

with ss loaded
  1. #  Algorithm | Key |  Encryption |  Decryption
  2.      aes-cbc   128b    37.7 MiB/s    37.8 MiB/s
  3. aes-cbc   256b    33.0 MiB/s    32.6 MiB/s
Copy code


1

threads

26

posts

123

credits

Registered member

Rank: 2

credits
123
Published in 2023-9-26 17:38:26 | Show all floors
A robust security system is an indispensable component in safeguarding digital assets and sensitive information in today's interconnected world. Organizations across various sectors are increasingly recognizing the importance of comprehensive cybersecurity measures to mitigate risks and protect against evolving threats. Conducting a thorough cyber risk assessment is a critical first step in this process, as highlighted in the insightful guide at https://nicolsonbray.com/insight ... -assessment-report. Such assessments help identify vulnerabilities, evaluate potential threats, and develop strategies to fortify defenses, ensuring that security systems remain resilient and adaptive in the face of an ever-changing cybersecurity landscape.
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list