Closed Bug 289066 Opened 20 years ago Closed 20 years ago

bltest problems measuring AES performance.

Categories

(NSS :: Tools, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: nelson, Assigned: nelson)

Details

Attachments

(1 file)

While attempting to use bltest to measure AES performance, I discovered a 
problem in bltest related to AES.  

Our AES function actually implements the rijndael algorithm (of which AES 
is a proper subset).  Rijndael permits variable block sizes that are multiples
of 4 bytes in the range (16-32) bytes.  It is the only block cipher we have 
in NSS that implements a variable block size.  The init function for AES takes
a block size parameter, which the other block ciphers do not require.  

bltest has a -b option that specifies the size of the buffer of data to be
input to the cipher or hash in each test.  For AES only, bltest passes the
value of the -b option to AES_Init as the block size argument.  

Consequently, when testing AES performance, bltest can never test a buffer 
that is bigger than the size of a single block.  This means that the CBC
mode is never really tested, because the algorithm never gets to the second
block.  It also means that bltest cannot test AES performance over a range
of buffer sizes, as it does for other ciphers.  

The file .../nss/tests/cipher/symmkey.txt drives the performance testing
of symmetric ciphers in NSS's freebl.  It has no lines to test AES, 
probably because of the aforementioned problem with being unable to test
a buffer larger than one block.

We're not interested in full Rijndael.  We're only interested in AES. 
AES has a fixed block size of 16 bytes.  So, the fix for bltest is to 
make it always use a fixed block size of 16 bytes, and not couple that
to the buffer size, except to ensure that the buffer size is a multiple
of the block size.  

I have a patch to bltest that does just that.  I will attach it shortly.
It appears that all.sh does not run nss/tests/cipher/performance.sh 
and I could not find any script in nss/tests that does run it.	
IMO, we should add this test to our nightly QA runs to find performance
regressions (or improvements).
Attachment #179671 - Flags: review?(saul.edwards.bugs)
Just a note in support of the patch: Even though freebl exports a block
independent algorithm, the softoken interface to that algorithm always uses 16
byte blocks (Since the interface is to AES not Rijndael. (see softoken/pkcs11c.c
line 644).

One suggestion, there is a define in blapit.h called AES_BLOCK_SIZE... it should
probably be used in pkcs11c.c as well.

bob
Comment on attachment 179671 [details] [diff] [review]
patch to blapitest and performance script, v1

Other than Bob's comment, r+.
Attachment #179671 - Flags: review?(saul.edwards.bugs) → review+
cmd/bltest/blapitest.c;   new revision: 1.42; previous revision: 1.41
tests/cipher/hash.txt;    new revision: 1.2; previous revision: 1.1
tests/cipher/symmkey.txt; new revision: 1.2; previous revision: 1.1
Checked in on trunk.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: