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

Side by Side Diff: crypto/ec_signature_creator.h

Issue 1539353003: Switch to standard integer types in crypto/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 12 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
« no previous file with comments | « crypto/ec_private_key_unittest.cc ('k') | crypto/ec_signature_creator_impl.h » ('j') | 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 #ifndef CRYPTO_EC_SIGNATURE_CREATOR_H_ 5 #ifndef CRYPTO_EC_SIGNATURE_CREATOR_H_
6 #define CRYPTO_EC_SIGNATURE_CREATOR_H_ 6 #define CRYPTO_EC_SIGNATURE_CREATOR_H_
7 7
8 #include <stdint.h>
9
8 #include <string> 10 #include <string>
9 #include <vector> 11 #include <vector>
10 12
11 #include "base/basictypes.h"
12 #include "crypto/crypto_export.h" 13 #include "crypto/crypto_export.h"
13 14
14 namespace crypto { 15 namespace crypto {
15 16
16 class ECPrivateKey; 17 class ECPrivateKey;
17 class ECSignatureCreator; 18 class ECSignatureCreator;
18 19
19 class CRYPTO_EXPORT ECSignatureCreatorFactory { 20 class CRYPTO_EXPORT ECSignatureCreatorFactory {
20 public: 21 public:
21 virtual ~ECSignatureCreatorFactory() {} 22 virtual ~ECSignatureCreatorFactory() {}
(...skipping 19 matching lines...) Expand all
41 // randomness, this is useful for higher-level tests that want to have 42 // randomness, this is useful for higher-level tests that want to have
42 // deterministic mocked output to compare. 43 // deterministic mocked output to compare.
43 static void SetFactoryForTesting(ECSignatureCreatorFactory* factory); 44 static void SetFactoryForTesting(ECSignatureCreatorFactory* factory);
44 45
45 // Signs |data_len| bytes from |data| and writes the results into 46 // Signs |data_len| bytes from |data| and writes the results into
46 // |signature| as a DER encoded ECDSA-Sig-Value from RFC 3279. 47 // |signature| as a DER encoded ECDSA-Sig-Value from RFC 3279.
47 // 48 //
48 // ECDSA-Sig-Value ::= SEQUENCE { 49 // ECDSA-Sig-Value ::= SEQUENCE {
49 // r INTEGER, 50 // r INTEGER,
50 // s INTEGER } 51 // s INTEGER }
51 virtual bool Sign(const uint8* data, 52 virtual bool Sign(const uint8_t* data,
52 int data_len, 53 int data_len,
53 std::vector<uint8>* signature) = 0; 54 std::vector<uint8_t>* signature) = 0;
54 55
55 // DecodeSignature converts from a DER encoded ECDSA-Sig-Value (as produced 56 // DecodeSignature converts from a DER encoded ECDSA-Sig-Value (as produced
56 // by Sign) to a `raw' ECDSA signature which consists of a pair of 57 // by Sign) to a `raw' ECDSA signature which consists of a pair of
57 // big-endian, zero-padded, 256-bit integers, r and s. On success it returns 58 // big-endian, zero-padded, 256-bit integers, r and s. On success it returns
58 // true and puts the raw signature into |out_raw_sig|. 59 // true and puts the raw signature into |out_raw_sig|.
59 // (Only P-256 signatures are supported.) 60 // (Only P-256 signatures are supported.)
60 virtual bool DecodeSignature(const std::vector<uint8>& signature, 61 virtual bool DecodeSignature(const std::vector<uint8_t>& signature,
61 std::vector<uint8>* out_raw_sig) = 0; 62 std::vector<uint8_t>* out_raw_sig) = 0;
62 }; 63 };
63 64
64 } // namespace crypto 65 } // namespace crypto
65 66
66 #endif // CRYPTO_EC_SIGNATURE_CREATOR_H_ 67 #endif // CRYPTO_EC_SIGNATURE_CREATOR_H_
OLDNEW
« no previous file with comments | « crypto/ec_private_key_unittest.cc ('k') | crypto/ec_signature_creator_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698