| OLD | NEW |
| 1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | 4 |
| 5 #ifdef FREEBL_NO_DEPEND | 5 #ifdef FREEBL_NO_DEPEND |
| 6 #include "stubs.h" | 6 #include "stubs.h" |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include "prerr.h" | 9 #include "prerr.h" |
| 10 #include "secerr.h" | 10 #include "secerr.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 SECStatus | 200 SECStatus |
| 201 MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length) | 201 MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length) |
| 202 { | 202 { |
| 203 unsigned int len; | 203 unsigned int len; |
| 204 MD5Context cx; | 204 MD5Context cx; |
| 205 | 205 |
| 206 MD5_Begin(&cx); | 206 MD5_Begin(&cx); |
| 207 MD5_Update(&cx, src, src_length); | 207 MD5_Update(&cx, src, src_length); |
| 208 MD5_End(&cx, dest, &len, MD5_HASH_LEN); | 208 MD5_End(&cx, dest, &len, MD5_HASH_LEN); |
| 209 /*» memset(&cx, 0, sizeof cx); */ | 209 » memset(&cx, 0, sizeof cx); |
| 210 return SECSuccess; | 210 return SECSuccess; |
| 211 } | 211 } |
| 212 | 212 |
| 213 MD5Context * | 213 MD5Context * |
| 214 MD5_NewContext(void) | 214 MD5_NewContext(void) |
| 215 { | 215 { |
| 216 /* no need to ZAlloc, MD5_Begin will init the context */ | 216 /* no need to ZAlloc, MD5_Begin will init the context */ |
| 217 MD5Context *cx = (MD5Context *)PORT_Alloc(sizeof(MD5Context)); | 217 MD5Context *cx = (MD5Context *)PORT_Alloc(sizeof(MD5Context)); |
| 218 if (cx == NULL) { | 218 if (cx == NULL) { |
| 219 PORT_SetError(PR_OUT_OF_MEMORY_ERROR); | 219 PORT_SetError(PR_OUT_OF_MEMORY_ERROR); |
| 220 return NULL; | 220 return NULL; |
| 221 } | 221 } |
| 222 return cx; | 222 return cx; |
| 223 } | 223 } |
| 224 | 224 |
| 225 void | 225 void |
| 226 MD5_DestroyContext(MD5Context *cx, PRBool freeit) | 226 MD5_DestroyContext(MD5Context *cx, PRBool freeit) |
| 227 { | 227 { |
| 228 /*» memset(cx, 0, sizeof *cx); */ | 228 » memset(cx, 0, sizeof *cx); |
| 229 if (freeit) { | 229 if (freeit) { |
| 230 PORT_Free(cx); | 230 PORT_Free(cx); |
| 231 } | 231 } |
| 232 } | 232 } |
| 233 | 233 |
| 234 void | 234 void |
| 235 MD5_Begin(MD5Context *cx) | 235 MD5_Begin(MD5Context *cx) |
| 236 { | 236 { |
| 237 cx->lsbInput = 0; | 237 cx->lsbInput = 0; |
| 238 cx->msbInput = 0; | 238 cx->msbInput = 0; |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 void MD5_Clone(MD5Context *dest, MD5Context *src) | 558 void MD5_Clone(MD5Context *dest, MD5Context *src) |
| 559 { | 559 { |
| 560 memcpy(dest, src, sizeof *dest); | 560 memcpy(dest, src, sizeof *dest); |
| 561 } | 561 } |
| 562 | 562 |
| 563 void | 563 void |
| 564 MD5_TraceState(MD5Context *cx) | 564 MD5_TraceState(MD5Context *cx) |
| 565 { | 565 { |
| 566 PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); | 566 PORT_SetError(PR_NOT_IMPLEMENTED_ERROR); |
| 567 } | 567 } |
| OLD | NEW |