| OLD | NEW |
| (Empty) | |
| 1 Index: pqg.c |
| 2 =================================================================== |
| 3 RCS file: /cvsroot/mozilla/security/nss/lib/freebl/pqg.c,v |
| 4 retrieving revision 1.21 |
| 5 diff -p -u -r1.21 pqg.c |
| 6 --- pqg.c 25 Jun 2012 17:30:17 -0000 1.21 |
| 7 +++ pqg.c 22 Sep 2012 14:41:57 -0000 |
| 8 @@ -21,7 +21,6 @@ |
| 9 #include "mpprime.h" |
| 10 #include "mplogic.h" |
| 11 #include "secmpi.h" |
| 12 -#include "sechash.h" |
| 13 |
| 14 #define MAX_ITERATIONS 1000 /* Maximum number of iterations of primegen */ |
| 15 |
| 16 @@ -152,6 +151,38 @@ getNextHash(HASH_HashType hashtype) |
| 17 return hashtype; |
| 18 } |
| 19 |
| 20 +static unsigned int |
| 21 +HASH_ResultLen(HASH_HashType type) |
| 22 +{ |
| 23 + const SECHashObject *hash_obj = HASH_GetRawHashObject(type); |
| 24 + if (hash_obj == NULL) { |
| 25 + return 0; |
| 26 + } |
| 27 + return hash_obj->length; |
| 28 +} |
| 29 + |
| 30 +static SECStatus |
| 31 +HASH_HashBuf(HASH_HashType type, unsigned char *dest, |
| 32 + const unsigned char *src, PRUint32 src_len) |
| 33 +{ |
| 34 + const SECHashObject *hash_obj = HASH_GetRawHashObject(type); |
| 35 + void *hashcx = NULL; |
| 36 + unsigned int dummy; |
| 37 + |
| 38 + if (hash_obj == NULL) { |
| 39 + return SECFailure; |
| 40 + } |
| 41 + |
| 42 + hashcx = hash_obj->create(); |
| 43 + if (hashcx == NULL) { |
| 44 + return SECFailure; |
| 45 + } |
| 46 + hash_obj->begin(hashcx); |
| 47 + hash_obj->update(hashcx,src,src_len); |
| 48 + hash_obj->end(hashcx,dest, &dummy, hash_obj->length); |
| 49 + hash_obj->destroy(hashcx, PR_TRUE); |
| 50 + return SECSuccess; |
| 51 +} |
| 52 |
| 53 unsigned int |
| 54 PQG_GetLength(const SECItem *obj) |
| 55 Index: rawhash.c |
| 56 =================================================================== |
| 57 RCS file: /cvsroot/mozilla/security/nss/lib/freebl/rawhash.c,v |
| 58 retrieving revision 1.10 |
| 59 diff -p -u -r1.10 rawhash.c |
| 60 --- rawhash.c 26 Jun 2012 22:27:29 -0000 1.10 |
| 61 +++ rawhash.c 22 Sep 2012 14:41:57 -0000 |
| 62 @@ -145,36 +145,3 @@ HASH_GetRawHashObject(HASH_HashType hash |
| 63 } |
| 64 return &SECRawHashObjects[hashType]; |
| 65 } |
| 66 - |
| 67 -unsigned int |
| 68 -HASH_ResultLen(HASH_HashType type) |
| 69 -{ |
| 70 - const SECHashObject *hash_obj = HASH_GetRawHashObject(type); |
| 71 - if (hash_obj == NULL) { |
| 72 - return 0; |
| 73 - } |
| 74 - return hash_obj->length; |
| 75 -} |
| 76 - |
| 77 -SECStatus |
| 78 -HASH_HashBuf(HASH_HashType type, unsigned char *dest, |
| 79 - const unsigned char *src, PRUint32 src_len) |
| 80 -{ |
| 81 - const SECHashObject *hash_obj = HASH_GetRawHashObject(type); |
| 82 - void *hashcx = NULL; |
| 83 - unsigned int dummy; |
| 84 - |
| 85 - if (hash_obj == NULL) { |
| 86 - return SECFailure; |
| 87 - } |
| 88 - |
| 89 - hashcx = hash_obj->create(); |
| 90 - if (hashcx == NULL) { |
| 91 - return SECFailure; |
| 92 - } |
| 93 - hash_obj->begin(hashcx); |
| 94 - hash_obj->update(hashcx,src,src_len); |
| 95 - hash_obj->end(hashcx,dest, &dummy, hash_obj->length); |
| 96 - hash_obj->destroy(hashcx, PR_TRUE); |
| 97 - return SECSuccess; |
| 98 -} |
| OLD | NEW |