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

Side by Side Diff: nss/mozilla/security/nss/lib/freebl/camellia.c

Issue 3135002: Update to NSS 3.12.7 and NSPR 4.8.6.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 10 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* ***** BEGIN LICENSE BLOCK ***** 1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3 * 3 *
4 * The contents of this file are subject to the Mozilla Public License Version 4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with 5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at 6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/ 7 * http://www.mozilla.org/MPL/
8 * 8 *
9 * Software distributed under the License is distributed on an "AS IS" basis, 9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
(...skipping 18 matching lines...) Expand all
29 * under the terms of either the GPL or the LGPL, and not to allow others to 29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your 30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice 31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete 32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under 33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL. 34 * the terms of any one of the MPL, the GPL or the LGPL.
35 * 35 *
36 * ***** END LICENSE BLOCK ***** */ 36 * ***** END LICENSE BLOCK ***** */
37 37
38 /* 38 /*
39 * $Id: camellia.c,v 1.2 2008/11/18 19:48:22 rrelyea%redhat.com Exp $ 39 * $Id: camellia.c,v 1.3 2010/04/30 00:10:53 wtc%google.com Exp $
40 */ 40 */
41 41
42 #ifdef FREEBL_NO_DEPEND 42 #ifdef FREEBL_NO_DEPEND
43 #include "stubs.h" 43 #include "stubs.h"
44 #endif 44 #endif
45 45
46 #include "prinit.h" 46 #include "prinit.h"
47 #include "prerr.h" 47 #include "prerr.h"
48 #include "secerr.h" 48 #include "secerr.h"
49 49
(...skipping 15 matching lines...) Expand all
65 #define CAMELLIA_SIGMA5L (0x10E527FAL) 65 #define CAMELLIA_SIGMA5L (0x10E527FAL)
66 #define CAMELLIA_SIGMA5R (0xDE682D1DL) 66 #define CAMELLIA_SIGMA5R (0xDE682D1DL)
67 #define CAMELLIA_SIGMA6L (0xB05688C2L) 67 #define CAMELLIA_SIGMA6L (0xB05688C2L)
68 #define CAMELLIA_SIGMA6R (0xB3E6C1FDL) 68 #define CAMELLIA_SIGMA6R (0xB3E6C1FDL)
69 69
70 /* 70 /*
71 * macros 71 * macros
72 */ 72 */
73 73
74 74
75 #if defined(_MSC_VER) 75 #if defined(_MSC_VER) && defined(NSS_X86_OR_X64)
76
77 /* require a little-endian CPU that allows unaligned access */
76 78
77 # define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00) 79 # define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00)
78 # define GETU32(p) SWAP(*((PRUint32 *)(p))) 80 # define GETU32(p) SWAP(*((PRUint32 *)(p)))
79 # define PUTU32(ct, st) {*((PRUint32 *)(ct)) = SWAP((st));} 81 # define PUTU32(ct, st) {*((PRUint32 *)(ct)) = SWAP((st));}
80 82
81 #else /* not MS-VC */ 83 #else /* not MSVC or not x86/x64 */
82 84
83 # define GETU32(pt) \ 85 # define GETU32(pt) \
84 (((PRUint32)(pt)[0] << 24) \ 86 (((PRUint32)(pt)[0] << 24) \
85 ^ ((PRUint32)(pt)[1] << 16) \ 87 ^ ((PRUint32)(pt)[1] << 16) \
86 ^ ((PRUint32)(pt)[2] << 8) \ 88 ^ ((PRUint32)(pt)[2] << 8) \
87 ^ ((PRUint32)(pt)[3])) 89 ^ ((PRUint32)(pt)[3]))
88 90
89 # define PUTU32(ct, st) { \ 91 # define PUTU32(ct, st) { \
90 (ct)[0] = (PRUint8)((st) >> 24); \ 92 (ct)[0] = (PRUint8)((st) >> 24); \
91 (ct)[1] = (PRUint8)((st) >> 16); \ 93 (ct)[1] = (PRUint8)((st) >> 16); \
(...skipping 1694 matching lines...) Expand 10 before | Expand all | Expand 10 after
1786 } 1788 }
1787 if (maxOutputLen < inputLen) { 1789 if (maxOutputLen < inputLen) {
1788 PORT_SetError(SEC_ERROR_OUTPUT_LEN); 1790 PORT_SetError(SEC_ERROR_OUTPUT_LEN);
1789 return SECFailure; 1791 return SECFailure;
1790 } 1792 }
1791 *outputLen = inputLen; 1793 *outputLen = inputLen;
1792 1794
1793 return (*cx->worker)(cx, output, outputLen, maxOutputLen, 1795 return (*cx->worker)(cx, output, outputLen, maxOutputLen,
1794 input, inputLen); 1796 input, inputLen);
1795 } 1797 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698