Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Unified Diff: mozilla/security/nss/lib/freebl/shvfy.c

Issue 10961060: Update NSS to NSS 3.14 Beta 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Add the NSS snapshot timestamp to README.chromium and nss-checkout.sh Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mozilla/security/nss/lib/freebl/sha_fast.c ('k') | mozilla/security/nss/lib/freebl/tlsprfalg.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mozilla/security/nss/lib/freebl/shvfy.c
===================================================================
--- mozilla/security/nss/lib/freebl/shvfy.c (revision 158129)
+++ mozilla/security/nss/lib/freebl/shvfy.c (working copy)
@@ -2,7 +2,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-/* $Id: shvfy.c,v 1.17 2012/06/12 16:39:00 rrelyea%redhat.com Exp $ */
+/* $Id: shvfy.c,v 1.18 2012/09/22 15:18:19 wtc%google.com Exp $ */
#ifdef FREEBL_NO_DEPEND
#include "stubs.h"
@@ -15,6 +15,8 @@
#include "seccomon.h"
#include "stdio.h"
#include "prmem.h"
+#include "hasht.h"
+#include "pqg.h"
/*
* Most modern version of Linux support a speed optimization scheme where an
@@ -314,7 +316,8 @@
char *checkName = NULL;
PRFileDesc *checkFD = NULL;
PRFileDesc *shFD = NULL;
- SHA1Context *hashcx = NULL;
+ void *hashcx = NULL;
+ const SECHashObject *hashObj = NULL;
SECItem signature = { 0, NULL, 0 };
SECItem hash;
int bytesRead, offset;
@@ -328,7 +331,7 @@
PRBool result = PR_FALSE; /* if anything goes wrong,
* the signature does not verify */
unsigned char buf[4096];
- unsigned char hashBuf[SHA1_LENGTH];
+ unsigned char hashBuf[HASH_LENGTH_MAX];
PORT_Memset(&key,0,sizeof(key));
hash.data = hashBuf;
@@ -403,6 +406,11 @@
PR_Close(checkFD);
checkFD = NULL;
+ hashObj = HASH_GetRawHashObject(PQG_GetHashType(&key.params));
+ if (hashObj == NULL) {
+ goto loser;
+ }
+
/* open our library file */
#ifdef FREEBL_USE_PRELINK
shFD = bl_OpenUnPrelink(shName,&pid);
@@ -418,15 +426,15 @@
}
/* hash our library file with SHA1 */
- hashcx = SHA1_NewContext();
+ hashcx = hashObj->create();
if (hashcx == NULL) {
goto loser;
}
- SHA1_Begin(hashcx);
+ hashObj->begin(hashcx);
count = 0;
while ((bytesRead = PR_Read(shFD, buf, sizeof(buf))) > 0) {
- SHA1_Update(hashcx, buf, bytesRead);
+ hashObj->update(hashcx, buf, bytesRead);
count += bytesRead;
}
#ifdef FREEBL_USE_PRELINK
@@ -436,7 +444,7 @@
#endif
shFD = NULL;
- SHA1_End(hashcx, hash.data, &hash.len, hash.len);
+ hashObj->end(hashcx, hash.data, &hash.len, hash.len);
/* verify the hash against the check file */
@@ -480,7 +488,9 @@
PR_Close(shFD);
}
if (hashcx != NULL) {
- SHA1_DestroyContext(hashcx,PR_TRUE);
+ if (hashObj) {
+ hashObj->destroy(hashcx,PR_TRUE);
+ }
}
if (signature.data != NULL) {
PORT_Free(signature.data);
« no previous file with comments | « mozilla/security/nss/lib/freebl/sha_fast.c ('k') | mozilla/security/nss/lib/freebl/tlsprfalg.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698