Index: nss/lib/softoken/tlsprf.c |
=================================================================== |
--- nss/lib/softoken/tlsprf.c (revision 195639) |
+++ nss/lib/softoken/tlsprf.c (working copy) |
@@ -23,6 +23,7 @@ |
PRUint32 cxDataLen; /* bytes of cxBufPtr containing data. */ |
SECStatus cxRv; /* records failure of void functions. */ |
PRBool cxIsFIPS; /* true if conforming to FIPS 198. */ |
+ HASH_HashType cxHashAlg; /* hash algorithm to use for TLS 1.2+ */ |
unsigned char cxBuf[512]; /* actual size may be larger than 512. */ |
} TLSPRFContext; |
@@ -89,7 +90,12 @@ |
sigItem.data = sig; |
sigItem.len = maxLen; |
- rv = TLS_PRF(&secretItem, NULL, &seedItem, &sigItem, cx->cxIsFIPS); |
+ if (cx->cxHashAlg != HASH_AlgNULL) { |
+ rv = TLS_P_hash(cx->cxHashAlg, &secretItem, NULL, &seedItem, &sigItem, |
+ cx->cxIsFIPS); |
+ } else { |
+ rv = TLS_PRF(&secretItem, NULL, &seedItem, &sigItem, cx->cxIsFIPS); |
+ } |
if (rv == SECSuccess && sigLen != NULL) |
*sigLen = sigItem.len; |
return rv; |
@@ -136,7 +142,8 @@ |
CK_RV |
sftk_TLSPRFInit(SFTKSessionContext *context, |
SFTKObject * key, |
- CK_KEY_TYPE key_type) |
+ CK_KEY_TYPE key_type, |
+ HASH_HashType hash_alg) |
{ |
SFTKAttribute * keyVal; |
TLSPRFContext * prf_cx; |
@@ -162,6 +169,7 @@ |
prf_cx->cxRv = SECSuccess; |
prf_cx->cxIsFIPS = (key->slot->slotID == FIPS_SLOT_ID); |
prf_cx->cxBufPtr = prf_cx->cxBuf; |
+ prf_cx->cxHashAlg = hash_alg; |
if (keySize) |
PORT_Memcpy(prf_cx->cxBufPtr, keyVal->attrib.pValue, keySize); |