From: Nicolas Kaiser <nikai@nikai.net>
To: linux-crypto@vger.kernel.org
Subject: Re: [PATCH] crypto: cast5: simplify if-statements
Date: Thu, 4 Nov 2010 16:14:53 +0100 [thread overview]
Message-ID: <20101104161453.5e257b18@absol.kitzblitz> (raw)
In-Reply-To: <20101027120324.0b12a8b8@absol.kitzblitz>
* Nicolas Kaiser <nikai@nikai.net>:
> I noticed that by factoring out common rounds from the
> branches of the if-statements in the encryption and
> decryption functions, the executable file size goes down
> significantly, for crypto/cast5.ko from 26688 bytes
> to 24336 bytes (amd64).
>
> On my test system, I saw a slight speedup.
Hi there!
How would I add a simple cast5 cipher speed test to tcrypt.c, like this?
case 14:
test_cipher_speed("ecb(cast5)", ENCRYPT, sec, NULL, 0,
speed_template_8);
test_cipher_speed("ecb(cast5)", DECRYPT, sec, NULL, 0,
speed_template_8);
test_cipher_speed("cbc(cast5)", ENCRYPT, sec, NULL, 0,
speed_template_8);
test_cipher_speed("cbc(cast5)", DECRYPT, sec, NULL, 0,
speed_template_8);
break;
Does that make sense? Here are my results:
# insmod crypto/tcrypt.ko mode=14 sec=30
Before:
testing speed of ecb(cast5) encryption
test 0 (64 bit key, 16 byte blocks): 118241789 operations in 30 seconds (1891868624 bytes)
test 1 (64 bit key, 64 byte blocks): 40502820 operations in 30 seconds (2592180480 bytes)
test 2 (64 bit key, 256 byte blocks): 11111145 operations in 30 seconds (2844453120 bytes)
test 3 (64 bit key, 1024 byte blocks): 2858271 operations in 30 seconds (2926869504 bytes)
test 4 (64 bit key, 8192 byte blocks): 359327 operations in 30 seconds (2943606784 bytes)
testing speed of ecb(cast5) decryption
test 0 (64 bit key, 16 byte blocks): 118443232 operations in 30 seconds (1895091712 bytes)
test 1 (64 bit key, 64 byte blocks): 40060571 operations in 30 seconds (2563876544 bytes)
test 2 (64 bit key, 256 byte blocks): 10944717 operations in 30 seconds (2801847552 bytes)
test 3 (64 bit key, 1024 byte blocks): 2811154 operations in 30 seconds (2878621696 bytes)
test 4 (64 bit key, 8192 byte blocks): 353043 operations in 30 seconds (2892128256 bytes)
testing speed of cbc(cast5) encryption
test 0 (64 bit key, 16 byte blocks): 110614202 operations in 30 seconds (1769827232 bytes)
test 1 (64 bit key, 64 byte blocks): 37260496 operations in 30 seconds (2384671744 bytes)
test 2 (64 bit key, 256 byte blocks): 10323268 operations in 30 seconds (2642756608 bytes)
test 3 (64 bit key, 1024 byte blocks): 2650259 operations in 30 seconds (2713865216 bytes)
test 4 (64 bit key, 8192 byte blocks): 333281 operations in 30 seconds (2730237952 bytes)
testing speed of cbc(cast5) decryption
test 0 (64 bit key, 16 byte blocks): 102455488 operations in 30 seconds (1639287808 bytes)
test 1 (64 bit key, 64 byte blocks): 35507599 operations in 30 seconds (2272486336 bytes)
test 2 (64 bit key, 256 byte blocks): 9962653 operations in 30 seconds (2550439168 bytes)
test 3 (64 bit key, 1024 byte blocks): 2569557 operations in 30 seconds (2631226368 bytes)
test 4 (64 bit key, 8192 byte blocks): 323085 operations in 30 seconds (2646712320 bytes)
that's in sum:
87993190 bytes/s
86877105 bytes/s
81609058 bytes/s
78267680 bytes/s
After:
testing speed of ecb(cast5) encryption
test 0 (64 bit key, 16 byte blocks): 120033632 operations in 30 seconds (1920538112 bytes)
test 1 (64 bit key, 64 byte blocks): 41484473 operations in 30 seconds (2655006272 bytes)
test 2 (64 bit key, 256 byte blocks): 11418041 operations in 30 seconds (2923018496 bytes)
test 3 (64 bit key, 1024 byte blocks): 2940940 operations in 30 seconds (3011522560 bytes)
test 4 (64 bit key, 8192 byte blocks): 369831 operations in 30 seconds (3029655552 bytes)
testing speed of ecb(cast5) decryption
test 0 (64 bit key, 16 byte blocks): 122215696 operations in 30 seconds (1955451136 bytes)
test 1 (64 bit key, 64 byte blocks): 41845591 operations in 30 seconds (2678117824 bytes)
test 2 (64 bit key, 256 byte blocks): 11478322 operations in 30 seconds (2938450432 bytes)
test 3 (64 bit key, 1024 byte blocks): 2952595 operations in 30 seconds (3023457280 bytes)
test 4 (64 bit key, 8192 byte blocks): 371305 operations in 30 seconds (3041730560 bytes)
testing speed of cbc(cast5) encryption
test 0 (64 bit key, 16 byte blocks): 112301700 operations in 30 seconds (1796827200 bytes)
test 1 (64 bit key, 64 byte blocks): 38131586 operations in 30 seconds (2440421504 bytes)
test 2 (64 bit key, 256 byte blocks): 10609299 operations in 30 seconds (2715980544 bytes)
test 3 (64 bit key, 1024 byte blocks): 2728723 operations in 30 seconds (2794212352 bytes)
test 4 (64 bit key, 8192 byte blocks): 343249 operations in 30 seconds (2811895808 bytes)
testing speed of cbc(cast5) decryption
test 0 (64 bit key, 16 byte blocks): 106721453 operations in 30 seconds (1707543248 bytes)
test 1 (64 bit key, 64 byte blocks): 37573333 operations in 30 seconds (2404693312 bytes)
test 2 (64 bit key, 256 byte blocks): 10624511 operations in 30 seconds (2719874816 bytes)
test 3 (64 bit key, 1024 byte blocks): 2745305 operations in 30 seconds (2811192320 bytes)
test 4 (64 bit key, 8192 byte blocks): 345642 operations in 30 seconds (2831499264 bytes)
that's in sum:
90264940 bytes/s
90914715 bytes/s
83728916 bytes/s
83165353 bytes/s
Best regards,
Nicolas Kaiser
next prev parent reply other threads:[~2010-11-04 15:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-27 10:03 [PATCH] crypto: cast5: simplify if-statements Nicolas Kaiser
2010-11-04 15:14 ` Nicolas Kaiser [this message]
2010-11-04 18:59 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101104161453.5e257b18@absol.kitzblitz \
--to=nikai@nikai.net \
--cc=linux-crypto@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox