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

Side by Side Diff: crypto/p224.cc

Issue 819893002: Uses #pragma GCC reset_options to re-enable optimizations after ReduceLarge function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use #pragma GCC reset_options Created 6 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This is an implementation of the P224 elliptic curve group. It's written to 5 // This is an implementation of the P224 elliptic curve group. It's written to
6 // be short and simple rather than fast, although it's still constant-time. 6 // be short and simple rather than fast, although it's still constant-time.
7 // 7 //
8 // See http://www.imperialviolet.org/2010/12/04/ecc.html ([1]) for background. 8 // See http://www.imperialviolet.org/2010/12/04/ecc.html ([1]) for background.
9 9
10 #include "crypto/p224.h" 10 #include "crypto/p224.h"
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 (*out)[0] = static_cast<uint32>(in[0] & kBottom28Bits); 168 (*out)[0] = static_cast<uint32>(in[0] & kBottom28Bits);
169 (*out)[1] += static_cast<uint32>((in[0] >> 28) & kBottom28Bits); 169 (*out)[1] += static_cast<uint32>((in[0] >> 28) & kBottom28Bits);
170 (*out)[2] += static_cast<uint32>(in[0] >> 56); 170 (*out)[2] += static_cast<uint32>(in[0] >> 56);
171 // out[0] < 2**28 171 // out[0] < 2**28
172 // out[1..4] < 2**29 172 // out[1..4] < 2**29
173 // out[5..7] < 2**28 173 // out[5..7] < 2**28
174 } 174 }
175 175
176 // TODO(wez): Remove this when crbug.com/439566 is fixed. 176 // TODO(wez): Remove this when crbug.com/439566 is fixed.
177 #if defined(__GNUC__) && !defined(__clang__) 177 #if defined(__GNUC__) && !defined(__clang__)
178 #pragma GCC optimize("tree-vectorize") 178 // Reenable "tree-vectorize" optimization if it got disabled for ReduceLarge.
179 #pragma GCC reset_options
179 #endif 180 #endif
180 181
181 // Mul computes *out = a*b 182 // Mul computes *out = a*b
182 // 183 //
183 // a[i] < 2**29, b[i] < 2**30 (or vice versa) 184 // a[i] < 2**29, b[i] < 2**30 (or vice versa)
184 // out[i] < 2**29 185 // out[i] < 2**29
185 void Mul(FieldElement* out, const FieldElement& a, const FieldElement& b) { 186 void Mul(FieldElement* out, const FieldElement& a, const FieldElement& b) {
186 LargeFieldElement tmp; 187 LargeFieldElement tmp;
187 memset(&tmp, 0, sizeof(tmp)); 188 memset(&tmp, 0, sizeof(tmp));
188 189
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 Subtract(&out->y, kP, y); 749 Subtract(&out->y, kP, y);
749 Reduce(&out->y); 750 Reduce(&out->y);
750 751
751 memset(&out->z, 0, sizeof(out->z)); 752 memset(&out->z, 0, sizeof(out->z));
752 out->z[0] = 1; 753 out->z[0] = 1;
753 } 754 }
754 755
755 } // namespace p224 756 } // namespace p224
756 757
757 } // namespace crypto 758 } // namespace crypto
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698