Error message:

bash-2.05b$ ./des_cbc_test
Aborted

Stack trace:

Program received signal SIGABRT, Aborted.
0x4cdfae81 in kill () from /lib/libc.so.6
(gdb) bt
#0  0x4cdfae81 in kill () from /lib/libc.so.6
#1  0x4cdfac25 in raise () from /lib/libc.so.6
#2  0x4cdfc19b in abort () from /lib/libc.so.6
#3  0x4cd78837 in __cxxabiv1::__terminate(void (*)()) ()
   from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/libstdc++.so.5
#4  0x4cd78878 in std::terminate() () from
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/libstdc++.so.5
#5  0x4cd78a1e in __cxa_throw () from
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/libstdc++.so.5
#6  0x0805aabb in CryptoPP::StreamTransformationFilter::LastPut(unsigned
char const*, unsigned) (
    this=0xb863b280, inString=0x81f8af8 "ed\n", length=3) at
filters.cpp:556
#7  0x0805973a in
CryptoPP::FilterWithBufferedInput::PutMaybeModifiable(unsigned char*,
unsigned, int, bool, bool) (this=0xb863b280, inString=0x0, length=0,
messageEnd=-1, blocking=true, modifiable=false)
    at filters.cpp:337
#8  0x0805de78 in CryptoPP::FilterWithBufferedInput::Put2(unsigned char
const*, unsigned, int, bool) (
    this=0xb863b280, inString=0x0, length=0, messageEnd=-1,
blocking=true) at filters.h:138
#9  0x0804aa1c in main () at cryptlib.h:709
#10 0x4cde77a7 in __libc_start_main () from /lib/libc.so.6

Program to reproduce problem: See attached file

Versions:

crypto++: 5.1

OS: bash-2.05b$ uname -a
Linux base.torri.org 2.4.20-gentoo-r5 #3 SMP Thu Aug 14 00:24:32 CDT
2003 i686 Pentium III (Katmai) GenuineIntel GNU/Linux

GCC: gcc (GCC) 3.2.3 20030422 (Gentoo Linux 1.4 3.2.3-r1, propolice)

Stephen
-- 
Stephen Torri
GPG Key: http://www.cs.wustl.edu/~storri/storri.asc
#include "des.h"
#include <string>
#include <iostream>
#include <fstream>
#include "modes.h"
#include "filters.h"

using namespace std;
using namespace CryptoPP;


int main () {


  ifstream plaintext_file;
  char* input_buffer;
  byte* output_buffer;

  static const byte encrKey[] = {
    0x3F, 0x6F, 0x6B, 0x69, 0x20, 0x5E, 0x5F, 0x34};

  static const byte iv[] = {0x48,0x34,0x95,0xA4,0x49,0xFF,0x0F,0x19};
  byte* output_text;

  CBC_Mode<DES>::Encryption cbcEncryptor (encrKey,
					  DES::DEFAULT_KEYLENGTH,
					  iv);

  CBC_Mode<DES>::Decryption cbcDecryptor (encrKey,
					  DES::DEFAULT_KEYLENGTH,
					  iv);

  StreamTransformationFilter encryptor (cbcEncryptor,
					NULL,
					StreamTransformationFilter::NO_PADDING);
  StreamTransformationFilter decryptor (cbcDecryptor,
					NULL,
					StreamTransformationFilter::NO_PADDING);
  unsigned int length;
  unsigned int output_length;
  ofstream output_file;

  /* Encrypt Data */
  plaintext_file.open("tao_orb_tests.txt", ios::binary);
  output_file.open("tao_orb_tests.des", ios::binary);

  if (!plaintext_file) {
    cerr << "Unable to read tao_orb_tests.txt" << endl;
    exit(1);
  }
  if (!output_file) {
    cerr << "Unable to write to tao_orb_tests.des" << endl;
    exit(1);
  }

  plaintext_file.seekg (0, ios::end);
  length = plaintext_file.tellg ();
  plaintext_file.seekg (0, ios::beg);

  input_buffer = new char [length];
  plaintext_file.read (input_buffer, length);

  /* Encrypt */
  encryptor.Put ((byte*)input_buffer, length);
  encryptor.MessageEnd ();
  output_length = encryptor.MaxRetrievable ();
  output_buffer = new byte[(output_length)];
  encryptor.Get (output_buffer, output_length);

  /* Decrypt */
  decryptor.Put (output_buffer, output_length);
  decryptor.MessageEnd ();
  output_length = decryptor.MaxRetrievable ();
  output_buffer = new byte [output_length];
  decryptor.Get (output_buffer, output_length);

  output_file.write((char*)output_buffer, output_length);

  delete input_buffer;
  delete output_buffer;
  plaintext_file.close();
  output_file.close();
  return 0;
}

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to