| OLD | NEW |
| 1 /* | 1 /* |
| 2 * sha512.c - implementation of SHA256, SHA384 and SHA512 | 2 * sha512.c - implementation of SHA256, SHA384 and SHA512 |
| 3 * | 3 * |
| 4 * ***** BEGIN LICENSE BLOCK ***** | 4 * ***** BEGIN LICENSE BLOCK ***** |
| 5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
| 6 * | 6 * |
| 7 * The contents of this file are subject to the Mozilla Public License Version | 7 * The contents of this file are subject to the Mozilla Public License Version |
| 8 * 1.1 (the "License"); you may not use this file except in compliance with | 8 * 1.1 (the "License"); you may not use this file except in compliance with |
| 9 * the License. You may obtain a copy of the License at | 9 * the License. You may obtain a copy of the License at |
| 10 * http://www.mozilla.org/MPL/ | 10 * http://www.mozilla.org/MPL/ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 // Prevent manual unrolling in the sha256 code, which reduces the binary code | 41 // Prevent manual unrolling in the sha256 code, which reduces the binary code |
| 42 // size from ~10k to ~1k. The performance should be reasonable for our use. | 42 // size from ~10k to ~1k. The performance should be reasonable for our use. |
| 43 #define NOUNROLL256 1 | 43 #define NOUNROLL256 1 |
| 44 | 44 |
| 45 #include "base/third_party/nspr/prtypes.h" /* for PRUintXX */ | 45 #include "base/third_party/nspr/prtypes.h" /* for PRUintXX */ |
| 46 #if defined(_X86_) || defined(SHA_NO_LONG_LONG) | 46 #if defined(_X86_) || defined(SHA_NO_LONG_LONG) |
| 47 #define NOUNROLL512 1 | 47 #define NOUNROLL512 1 |
| 48 #undef HAVE_LONG_LONG | 48 #undef HAVE_LONG_LONG |
| 49 #endif | 49 #endif |
| 50 #include "base/third_party/nss/blapi.h" | 50 #include "crypto/third_party/nss/blapi.h" |
| 51 #include "base/third_party/nss/sha256.h" /* for struct SHA256ContextStr */ | 51 #include "crypto/third_party/nss/sha256.h" /* for struct SHA256ContextStr */ |
| 52 | 52 |
| 53 #include <stdlib.h> | 53 #include <stdlib.h> |
| 54 #include <string.h> | 54 #include <string.h> |
| 55 #define PORT_New(type) static_cast<type*>(malloc(sizeof(type))) | 55 #define PORT_New(type) static_cast<type*>(malloc(sizeof(type))) |
| 56 #define PORT_ZFree(ptr, len) do { memset(ptr, 0, len); free(ptr); } while (0) | 56 #define PORT_ZFree(ptr, len) do { memset(ptr, 0, len); free(ptr); } while (0) |
| 57 #define PORT_Strlen(s) static_cast<unsigned int>(strlen(s)) | 57 #define PORT_Strlen(s) static_cast<unsigned int>(strlen(s)) |
| 58 #define PORT_Memcpy memcpy | 58 #define PORT_Memcpy memcpy |
| 59 | 59 |
| 60 /* ============= Common constants and defines ======================= */ | 60 /* ============= Common constants and defines ======================= */ |
| 61 | 61 |
| (...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 } else { | 1382 } else { |
| 1383 while (i-- > 0) { | 1383 while (i-- > 0) { |
| 1384 time512(); | 1384 time512(); |
| 1385 } | 1385 } |
| 1386 printf("done\n"); | 1386 printf("done\n"); |
| 1387 } | 1387 } |
| 1388 return 0; | 1388 return 0; |
| 1389 } | 1389 } |
| 1390 | 1390 |
| 1391 #endif | 1391 #endif |
| OLD | NEW |