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

Side by Side Diff: nss/lib/freebl/rsapkcs.c

Issue 195763027: Update NSS to NSS_3_16_RC0. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/nss/
Patch Set: Use the RTM tag Created 6 years, 9 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
« no previous file with comments | « nss/lib/freebl/mpi/mpi.h ('k') | nss/lib/freebl/sysrand.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /* 5 /*
6 * RSA PKCS#1 v2.1 (RFC 3447) operations 6 * RSA PKCS#1 v2.1 (RFC 3447) operations
7 */ 7 */
8 8
9 #ifdef FREEBL_NO_DEPEND 9 #ifdef FREEBL_NO_DEPEND
10 #include "stubs.h" 10 #include "stubs.h"
11 #endif 11 #endif
12 12
13 #include "secerr.h" 13 #include "secerr.h"
14 14
15 #include "blapi.h" 15 #include "blapi.h"
16 #include "secitem.h" 16 #include "secitem.h"
17 #include "blapii.h" 17 #include "blapii.h"
18 18
19 #define RSA_BLOCK_MIN_PAD_LEN 8 19 #define RSA_BLOCK_MIN_PAD_LEN 8
20 #define RSA_BLOCK_FIRST_OCTET 0x00 20 #define RSA_BLOCK_FIRST_OCTET 0x00
21 #define RSA_BLOCK_PRIVATE_PAD_OCTET 0xff 21 #define RSA_BLOCK_PRIVATE_PAD_OCTET 0xff
22 #define RSA_BLOCK_AFTER_PAD_OCTET 0x00 22 #define RSA_BLOCK_AFTER_PAD_OCTET 0x00
23 23
24 /* 24 /*
25 * RSA block types 25 * RSA block types
26 * 26 *
27 * The actual values are important -- they are fixed, *not* arbitrary. 27 * The values of RSA_BlockPrivate and RSA_BlockPublic are fixed.
28 * The explicit value assignments are not needed (because C would give 28 * The value of RSA_BlockRaw isn't fixed by definition, but we are keeping
29 * us those same values anyway) but are included as a reminder... 29 * the value that NSS has been using in the past.
30 */ 30 */
31 typedef enum { 31 typedef enum {
32 RSA_BlockUnused = 0, /* unused */
33 RSA_BlockPrivate = 1, /* pad for a private-key operation */ 32 RSA_BlockPrivate = 1, /* pad for a private-key operation */
34 RSA_BlockPublic = 2, /* pad for a public-key operation */ 33 RSA_BlockPublic = 2, /* pad for a public-key operation */
35 RSA_BlockRaw = 4, /* simply justify the block appropriately */ 34 RSA_BlockRaw = 4 /* simply justify the block appropriately */
36 RSA_BlockTotal
37 } RSA_BlockType; 35 } RSA_BlockType;
38 36
39 /* Needed for RSA-PSS functions */ 37 /* Needed for RSA-PSS functions */
40 static const unsigned char eightZeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; 38 static const unsigned char eightZeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
41 39
42 /* Constant time comparison of a single byte. 40 /* Constant time comparison of a single byte.
43 * Returns 1 iff a == b, otherwise returns 0. 41 * Returns 1 iff a == b, otherwise returns 0.
44 * Note: For ranges of bytes, use constantTimeCompare. 42 * Note: For ranges of bytes, use constantTimeCompare.
45 */ 43 */
46 static unsigned char constantTimeEQ8(unsigned char a, unsigned char b) { 44 static unsigned char constantTimeEQ8(unsigned char a, unsigned char b) {
(...skipping 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 PORT_Memcpy(output, buffer + modulusLen - *outputLen, *outputLen); 1371 PORT_Memcpy(output, buffer + modulusLen - *outputLen, *outputLen);
1374 1372
1375 PORT_Free(buffer); 1373 PORT_Free(buffer);
1376 return SECSuccess; 1374 return SECSuccess;
1377 1375
1378 loser: 1376 loser:
1379 PORT_Free(buffer); 1377 PORT_Free(buffer);
1380 failure: 1378 failure:
1381 return SECFailure; 1379 return SECFailure;
1382 } 1380 }
OLDNEW
« no previous file with comments | « nss/lib/freebl/mpi/mpi.h ('k') | nss/lib/freebl/sysrand.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698