Bug 1371322

Summary: RFE: pbkdf2 password hash interface for NSS
Product: Red Hat Enterprise Linux 7 Reporter: wibrown <wibrown>
Component: nssAssignee: Bob Relyea <rrelyea>
Status: CLOSED NEXTRELEASE QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.2CC: dueno, kengert, lucas.yamanishi, nkinder, nmavrogi, rrelyea, szidek, vashirov
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1468075 (view as bug list) Environment:
Last Closed: 2017-07-06 00:28:57 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1457789, 1457794    

Description wibrown@redhat.com 2016-08-29 22:32:56 UTC
Description of problem:
The current implementation of pbkdf2 in NSS is highly targeted at the encryption key use case, where given a secret, the key is derived.

However, many sites use PBKDF2 for storing hashes of user passwords. This is due to the time factor in "repeating" the hash. This causes any potential attacker with bruteforce or rainbow table to have to expend a huge amount of work to attack the hashes.

Right now, in FIPS mode, NSS cannot be used to create hashes of passwords. Additionally, even in non-FIPS mode, the process is complex, fiddly, and prone to mistake. If the user of the library cannot use it correctly, this adds a potential weakness in the calling application. By having NSS implement this function wrapper as a whole, it can be implemented correctly, it can be verified, and it makes strong password hashing more acceptable to users of the NSS api. 

I would like to request that the authors of NSS add an interface such as:

SECStatus pbkdf2_hash(SECItem *salt, SECItem *pass, SECAlgorithmID *algid, PRUint32 rounds, SECItem *result);

Where:

salt is the salt to be combined with the password during hashing.
pass is the password material.
algid contains either SEC_OID_HMAC_SHA256, SEC_OID_HMAC_SHA1 or other relevant hash type.
rounds is the number of iterations of hashing to perform.
result is allocted by the function, containing a buffer of bytes that is the hash output. 

The function would return SECStatus to indicate success or failure. 

Thanks,