diff options
author | lloyd <[email protected]> | 2011-02-09 15:13:28 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2011-02-09 15:13:28 +0000 |
commit | 75eff6cba7ac959f0d3b5292aa5ca7e321bf2e0d (patch) | |
tree | ad44e3ce741c7d2c83c46a21f0242be4eec33402 /src/cms | |
parent | 5fa1a353fcdfc5fc83618f07a89b3d320596ae07 (diff) |
Convert the BER/DER coders to use size_t instead of u32bit for small
integer values. Update callers.
Diffstat (limited to 'src/cms')
-rw-r--r-- | src/cms/cms_algo.cpp | 4 | ||||
-rw-r--r-- | src/cms/cms_comp.cpp | 4 | ||||
-rw-r--r-- | src/cms/cms_dalg.cpp | 6 | ||||
-rw-r--r-- | src/cms/cms_ealg.cpp | 14 |
4 files changed, 14 insertions, 14 deletions
diff --git a/src/cms/cms_algo.cpp b/src/cms/cms_algo.cpp index a02f7e737..50384d85a 100644 --- a/src/cms/cms_algo.cpp +++ b/src/cms/cms_algo.cpp @@ -123,7 +123,7 @@ SecureVector<byte> CMS_Encoder::encode_params(const std::string& cipher, if(cipher == "RC2") { encoder.start_cons(SEQUENCE). - encode((u32bit)RC2::EKB_code(8*key.length())). + encode(static_cast<size_t>(RC2::EKB_code(8*key.length()))). encode(iv.bits_of(), OCTET_STRING). end_cons(); return encoder.get_contents(); @@ -134,7 +134,7 @@ SecureVector<byte> CMS_Encoder::encode_params(const std::string& cipher, { encoder.start_cons(SEQUENCE). encode(iv.bits_of(), OCTET_STRING). - encode(u32bit(8*key.length())). + encode(8*key.length()). end_cons(); } else diff --git a/src/cms/cms_comp.cpp b/src/cms/cms_comp.cpp index b11cf909b..3d9108e13 100644 --- a/src/cms/cms_comp.cpp +++ b/src/cms/cms_comp.cpp @@ -41,7 +41,7 @@ void CMS_Encoder::compress(const std::string& algo) DER_Encoder encoder; encoder.start_cons(SEQUENCE). - encode((u32bit)0). + encode(static_cast<size_t>(0)). encode(AlgorithmIdentifier("Compression." + algo, MemoryVector<byte>())). raw_bytes(make_econtent(compressed, type)). @@ -71,7 +71,7 @@ bool CMS_Encoder::can_compress_with(const std::string& algo) */ void CMS_Decoder::decompress(BER_Decoder& decoder) { - u32bit version; + size_t version; AlgorithmIdentifier comp_algo; BER_Decoder comp_info = decoder.start_cons(SEQUENCE); diff --git a/src/cms/cms_dalg.cpp b/src/cms/cms_dalg.cpp index 8b168902b..2935f3070 100644 --- a/src/cms/cms_dalg.cpp +++ b/src/cms/cms_dalg.cpp @@ -175,7 +175,7 @@ void CMS_Decoder::decode_layer() decompress(decoder); else if(type == OIDS::lookup("CMS.DigestedData")) { - u32bit version; + size_t version; AlgorithmIdentifier hash_algo; SecureVector<byte> digest; @@ -198,7 +198,7 @@ void CMS_Decoder::decode_layer() #if 1 throw Internal_Error("FIXME: not implemented"); #else - u32bit version; + size_t version; BER_Decoder sig_info = BER::get_subsequence(decoder); BER::decode(sig_info, version); @@ -213,7 +213,7 @@ void CMS_Decoder::decode_layer() { AlgorithmIdentifier sig_algo, hash_algo; SecureVector<byte> signature, digest; - u32bit version; + size_t version; BER_Decoder signer_info = BER::get_subsequence(signer_infos); BER::decode(signer_info, version); diff --git a/src/cms/cms_ealg.cpp b/src/cms/cms_ealg.cpp index 262c74b86..4aee8afd8 100644 --- a/src/cms/cms_ealg.cpp +++ b/src/cms/cms_ealg.cpp @@ -140,10 +140,10 @@ void CMS_Encoder::encrypt_ktri(RandomNumberGenerator& rng, DER_Encoder encoder; encoder.start_cons(SEQUENCE) - .encode((u32bit)0) + .encode(static_cast<size_t>(0)) .start_cons(SET) .start_cons(SEQUENCE) - .encode((u32bit)0); + .encode(static_cast<size_t>(0)); encode_si(encoder, to) .encode(alg_id) .encode(encryptor.encrypt(cek.bits_of(), rng), OCTET_STRING) @@ -203,9 +203,9 @@ void CMS_Encoder::encrypt(RandomNumberGenerator& rng, DER_Encoder encoder; encoder.start_cons(SEQUENCE) - .encode((u32bit)2) + .encode(static_cast<size_t>(2)) .start_explicit(ASN1_Tag(2)) - .encode((u32bit)4) + .encode(static_cast<size_t>(4)) .start_cons(SEQUENCE) .encode(kek_id, OCTET_STRING) .end_cons() @@ -302,8 +302,8 @@ void CMS_Encoder::sign(const X509_Certificate& cert, SecureVector<byte> signature = signer.signature(rng); signed_attr[0] = 0xA0; - const u32bit SI_VERSION = cert.subject_key_id().size() ? 3 : 1; - const u32bit CMS_VERSION = (type != "CMS.DataContent") ? 3 : SI_VERSION; + const size_t SI_VERSION = cert.subject_key_id().size() ? 3 : 1; + const size_t CMS_VERSION = (type != "CMS.DataContent") ? 3 : SI_VERSION; DER_Encoder encoder; @@ -347,7 +347,7 @@ void CMS_Encoder::digest(const std::string& user_hash) if(!OIDS::have_oid(hash)) throw Encoding_Error("CMS: No OID assigned for " + hash); - const u32bit VERSION = (type != "CMS.DataContent") ? 2 : 0; + const size_t VERSION = (type != "CMS.DataContent") ? 2 : 0; DER_Encoder encoder; encoder.start_cons(SEQUENCE) |