Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 380257 | Differences between
and this patch

Collapse All | Expand All

(-)src/database.cc (-6 / +4 lines)
Lines 3425-3433 database::encrypt_rsa(key_id const & pub Link Here
3425
  rsa_pub_key pub;
3425
  rsa_pub_key pub;
3426
  get_key(pub_id, pub);
3426
  get_key(pub_id, pub);
3427
3427
3428
  SecureVector<Botan::byte> pub_block;
3428
  SecureVector<Botan::byte> pub_block
3429
  pub_block.set(reinterpret_cast<Botan::byte const *>(pub().data()),
3429
    (reinterpret_cast<Botan::byte const *>(pub().data()), pub().size());
3430
                pub().size());
3431
3430
3432
  shared_ptr<X509_PublicKey> x509_key(Botan::X509::load_key(pub_block));
3431
  shared_ptr<X509_PublicKey> x509_key(Botan::X509::load_key(pub_block));
3433
  shared_ptr<RSA_PublicKey> pub_key
3432
  shared_ptr<RSA_PublicKey> pub_key
Lines 3471-3484 database::check_signature(key_id const & Link Here
3471
  else
3470
  else
3472
    {
3471
    {
3473
      rsa_pub_key pub;
3472
      rsa_pub_key pub;
3474
      SecureVector<Botan::byte> pub_block;
3475
3473
3476
      if (!public_key_exists(id))
3474
      if (!public_key_exists(id))
3477
        return cert_unknown;
3475
        return cert_unknown;
3478
3476
3479
      get_key(id, pub);
3477
      get_key(id, pub);
3480
      pub_block.set(reinterpret_cast<Botan::byte const *>(pub().data()),
3478
      SecureVector<Botan::byte> pub_block
3481
                    pub().size());
3479
        (reinterpret_cast<Botan::byte const *>(pub().data()), pub().size());
3482
3480
3483
      L(FL("building verifier for %d-byte pub key") % pub_block.size());
3481
      L(FL("building verifier for %d-byte pub key") % pub_block.size());
3484
      shared_ptr<X509_PublicKey> x509_key(Botan::X509::load_key(pub_block));
3482
      shared_ptr<X509_PublicKey> x509_key(Botan::X509::load_key(pub_block));
(-)src/packet.cc (-2 / +2 lines)
Lines 156-163 namespace Link Here
156
    void validate_public_key_data(string const & name, string const & keydata) const
156
    void validate_public_key_data(string const & name, string const & keydata) const
157
    {
157
    {
158
      string decoded = decode_base64_as<string>(keydata, origin::user);
158
      string decoded = decode_base64_as<string>(keydata, origin::user);
159
      Botan::SecureVector<Botan::byte> key_block;
159
      Botan::SecureVector<Botan::byte> key_block
160
      key_block.set(reinterpret_cast<Botan::byte const *>(decoded.c_str()), decoded.size());
160
        (reinterpret_cast<Botan::byte const *>(decoded.c_str()), decoded.size());
161
      try
161
      try
162
        {
162
        {
163
          Botan::X509::load_key(key_block);
163
          Botan::X509::load_key(key_block);
(-)src/key_store.cc (-3 / +9 lines)
Lines 856-864 key_store::make_signature(database & db, Link Here
856
    {
856
    {
857
      if (agent.connected()) {
857
      if (agent.connected()) {
858
        //grab the monotone public key as an RSA_PublicKey
858
        //grab the monotone public key as an RSA_PublicKey
859
        SecureVector<Botan::byte> pub_block;
859
        SecureVector<Botan::byte> pub_block
860
        pub_block.set(reinterpret_cast<Botan::byte const *>(key.pub().data()),
860
          (reinterpret_cast<Botan::byte const *>(key.pub().data()),
861
                      key.pub().size());
861
           key.pub().size());
862
        L(FL("make_signature: building %d-byte pub key") % pub_block.size());
862
        L(FL("make_signature: building %d-byte pub key") % pub_block.size());
863
        shared_ptr<X509_PublicKey> x509_key =
863
        shared_ptr<X509_PublicKey> x509_key =
864
          shared_ptr<X509_PublicKey>(Botan::X509::load_key(pub_block));
864
          shared_ptr<X509_PublicKey>(Botan::X509::load_key(pub_block));
Lines 1031-1038 key_store_state::migrate_old_key_pair Link Here
1031
  for (;;)
1031
  for (;;)
1032
    try
1032
    try
1033
      {
1033
      {
1034
#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
1035
        arc4_key.resize(phrase().size());
1036
        arc4_key.copy(reinterpret_cast<Botan::byte const *>(phrase().data()),
1037
                      phrase().size());
1038
#else
1034
        arc4_key.set(reinterpret_cast<Botan::byte const *>(phrase().data()),
1039
        arc4_key.set(reinterpret_cast<Botan::byte const *>(phrase().data()),
1035
                     phrase().size());
1040
                     phrase().size());
1041
#endif
1036
1042
1037
        Pipe arc4_decryptor(get_cipher("ARC4", arc4_key, Botan::DECRYPTION));
1043
        Pipe arc4_decryptor(get_cipher("ARC4", arc4_key, Botan::DECRYPTION));
1038
1044
(-)src/sha1.cc (-1 / +4 lines)
Lines 50-58 CMD_HIDDEN(benchmark_sha1, "benchmark_sh Link Here
50
  Botan::Default_Benchmark_Timer timer;
50
  Botan::Default_Benchmark_Timer timer;
51
  std::map<std::string, double> results =
51
  std::map<std::string, double> results =
52
    Botan::algorithm_benchmark("SHA-1",  milliseconds, timer, rng, af);
52
    Botan::algorithm_benchmark("SHA-1",  milliseconds, timer, rng, af);
53
#elif BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,9,11)
54
  std::map<std::string, double> results =
55
    Botan::algorithm_benchmark("SHA-1",  milliseconds, rng, af);
53
#else
56
#else
54
  std::map<std::string, double> results =
57
  std::map<std::string, double> results =
55
    Botan::algorithm_benchmark("SHA-1",  milliseconds, rng, af);
58
    Botan::algorithm_benchmark("SHA-1",  af, rng, milliseconds, 16);
56
#endif
59
#endif
57
60
58
  for(std::map<std::string, double>::const_iterator i = results.begin();
61
  for(std::map<std::string, double>::const_iterator i = results.begin();
(-)src/ssh_agent.cc (-3 / +3 lines)
Lines 385-393 ssh_agent::has_key(const keypair & key) Link Here
385
ssh_agent::has_key(const keypair & key)
385
ssh_agent::has_key(const keypair & key)
386
{
386
{
387
  //grab the monotone public key as an RSA_PublicKey
387
  //grab the monotone public key as an RSA_PublicKey
388
  SecureVector<Botan::byte> pub_block;
388
  SecureVector<Botan::byte> pub_block
389
  pub_block.set(reinterpret_cast<Botan::byte const *>((key.pub)().data()),
389
    (reinterpret_cast<Botan::byte const *>((key.pub)().data()),
390
                (key.pub)().size());
390
     (key.pub)().size());
391
  L(FL("has_key: building %d-byte pub key") % pub_block.size());
391
  L(FL("has_key: building %d-byte pub key") % pub_block.size());
392
  shared_ptr<X509_PublicKey> x509_key =
392
  shared_ptr<X509_PublicKey> x509_key =
393
    shared_ptr<X509_PublicKey>(Botan::X509::load_key(pub_block));
393
    shared_ptr<X509_PublicKey>(Botan::X509::load_key(pub_block));
(-)src/gzip.cc (-4 / +19 lines)
Lines 137-143 void Gzip_Compression::start_msg() Link Here
137
/*************************************************
137
/*************************************************
138
* Compress Input with Gzip                       *
138
* Compress Input with Gzip                       *
139
*************************************************/
139
*************************************************/
140
void Gzip_Compression::write(const byte input[], u32bit length)
140
void Gzip_Compression::write(const byte input[], filter_length_t length)
141
   {
141
   {
142
142
143
   count += length;
143
   count += length;
Lines 267-273 void Gzip_Decompression::start_msg() Link Here
267
/*************************************************
267
/*************************************************
268
* Decompress Input with Gzip                     *
268
* Decompress Input with Gzip                     *
269
*************************************************/
269
*************************************************/
270
void Gzip_Decompression::write(const byte input[], u32bit length)
270
void Gzip_Decompression::write(const byte input[], filter_length_t length)
271
   {
271
   {
272
   if(length) no_writes = false;
272
   if(length) no_writes = false;
273
273
Lines 284-291 void Gzip_Decompression::write(const byt Link Here
284
   // Check the gzip header
284
   // Check the gzip header
285
   if (pos < sizeof(GZIP::GZIP_HEADER))
285
   if (pos < sizeof(GZIP::GZIP_HEADER))
286
      {
286
      {
287
      u32bit len = std::min((u32bit)sizeof(GZIP::GZIP_HEADER)-pos, length);
287
      filter_length_t len = std::min((filter_length_t)sizeof(GZIP::GZIP_HEADER)-pos, length);
288
      u32bit cmplen = len;
288
      filter_length_t cmplen = len;
289
      // The last byte is the OS flag - we don't care about that
289
      // The last byte is the OS flag - we don't care about that
290
      if (pos + len - 1 >= GZIP::HEADER_POS_OS)
290
      if (pos + len - 1 >= GZIP::HEADER_POS_OS)
291
         cmplen--;
291
         cmplen--;
Lines 346-353 u32bit Gzip_Decompression::eat_footer(co Link Here
346
      if (footer.size() >= GZIP::FOOTER_LENGTH)
346
      if (footer.size() >= GZIP::FOOTER_LENGTH)
347
         throw Decoding_Error("Gzip_Decompression: Data integrity error in footer");
347
         throw Decoding_Error("Gzip_Decompression: Data integrity error in footer");
348
348
349
#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
350
      size_t eat_len = std::min(GZIP::FOOTER_LENGTH-footer.size(),
351
                                static_cast<size_t>(length));
352
      footer += std::make_pair(input, eat_len);
353
#else
349
      u32bit eat_len = std::min(GZIP::FOOTER_LENGTH-footer.size(), length);
354
      u32bit eat_len = std::min(GZIP::FOOTER_LENGTH-footer.size(), length);
350
      footer.append(input, eat_len);
355
      footer.append(input, eat_len);
356
#endif
351
357
352
      if (footer.size() == GZIP::FOOTER_LENGTH)
358
      if (footer.size() == GZIP::FOOTER_LENGTH)
353
         {
359
         {
Lines 377-383 void Gzip_Decompression::check_footer() Link Here
377
  for (int i = 0; i < 4; i++)
383
  for (int i = 0; i < 4; i++)
378
     buf[3-i] = tmpbuf[i];
384
     buf[3-i] = tmpbuf[i];
379
385
386
#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
387
  tmpbuf.resize(4);
388
  tmpbuf.copy(footer.begin(), 4);
389
#else
380
  tmpbuf.set(footer.begin(), 4);
390
  tmpbuf.set(footer.begin(), 4);
391
#endif
381
  if (buf != tmpbuf)
392
  if (buf != tmpbuf)
382
      throw Decoding_Error("Gzip_Decompression: Data integrity error - CRC32 error");
393
      throw Decoding_Error("Gzip_Decompression: Data integrity error - CRC32 error");
383
394
Lines 412-418 void Gzip_Decompression::clear() Link Here
412
   no_writes = true;
423
   no_writes = true;
413
   inflateReset(&(zlib->stream));
424
   inflateReset(&(zlib->stream));
414
425
426
#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
427
   footer.clear();
428
#else
415
   footer.destroy();
429
   footer.destroy();
430
#endif
416
   pos = 0;
431
   pos = 0;
417
   datacount = 0;
432
   datacount = 0;
418
   }
433
   }
(-)src/gzip.hh (-2 / +9 lines)
Lines 7-12 Link Here
7
#ifndef BOTAN_EXT_GZIP_H__
7
#ifndef BOTAN_EXT_GZIP_H__
8
#define BOTAN_EXT_GZIP_H__
8
#define BOTAN_EXT_GZIP_H__
9
9
10
#include <botan/version.h>
10
#include <botan/filter.h>
11
#include <botan/filter.h>
11
#include <botan/pipe.h>
12
#include <botan/pipe.h>
12
13
Lines 30-42 namespace GZIP { Link Here
30
31
31
}
32
}
32
33
34
#if BOTAN_VERSION_CODE >= BOTAN_VERSION_CODE_FOR(1,9,11)
35
   typedef size_t filter_length_t;
36
#else
37
   typedef u32bit filter_length_t;
38
#endif
39
33
/*************************************************
40
/*************************************************
34
* Gzip Compression Filter                        *
41
* Gzip Compression Filter                        *
35
*************************************************/
42
*************************************************/
36
class Gzip_Compression : public Filter
43
class Gzip_Compression : public Filter
37
   {
44
   {
38
   public:
45
   public:
39
      void write(const byte input[], u32bit length);
46
      void write(const byte input[], filter_length_t length);
40
      void start_msg();
47
      void start_msg();
41
      void end_msg();
48
      void end_msg();
42
      std::string name() const { return "Gzip_Compression"; }
49
      std::string name() const { return "Gzip_Compression"; }
Lines 60-66 class Gzip_Decompression : public Filter Link Here
60
class Gzip_Decompression : public Filter
67
class Gzip_Decompression : public Filter
61
   {
68
   {
62
   public:
69
   public:
63
      void write(const byte input[], u32bit length);
70
      void write(const byte input[], filter_length_t length);
64
      void start_msg();
71
      void start_msg();
65
      void end_msg();
72
      void end_msg();
66
      std::string name() const { return "Gzip_Decompression"; }
73
      std::string name() const { return "Gzip_Decompression"; }
(-)src/key_packet.cc (-2 / +2 lines)
Lines 106-113 namespace Link Here
106
    void validate_public_key_data(string const & name, string const & keydata) const
106
    void validate_public_key_data(string const & name, string const & keydata) const
107
    {
107
    {
108
      string decoded = decode_base64_as<string>(keydata, origin::user);
108
      string decoded = decode_base64_as<string>(keydata, origin::user);
109
      Botan::SecureVector<Botan::byte> key_block;
109
      Botan::SecureVector<Botan::byte> key_block
110
      key_block.set(reinterpret_cast<Botan::byte const *>(decoded.c_str()), decoded.size());
110
        (reinterpret_cast<Botan::byte const *>(decoded.c_str()), decoded.size());
111
      try
111
      try
112
        {
112
        {
113
          Botan::X509::load_key(key_block);
113
          Botan::X509::load_key(key_block);

Return to bug 380257