~ubuntu-branches/ubuntu/breezy/openssl/breezy

« back to all changes in this revision

Viewing changes to apps/der_chop.in

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Martin
  • Date: 2004-12-16 18:41:29 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041216184129-gp6wugpx7s8cy5xz
Tags: 0.9.7e-3
* really fix der_chop. The fix from -1 was not really included (closes:
  #281212) 
* still fixes security problem CAN-2004-0975 etc.
  - tempfile raise condition in der_chop
  - Avoid a race condition when CRLs are checked in a multi threaded 
    environment.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
 
31
31
require 'getopts.pl';
 
32
use File::Temp qw/ tempfile /;
32
33
 
33
34
$debug=0;
34
35
 
65
66
        }
66
67
else
67
68
        {
68
 
        $file="/tmp/a$$.DER";
 
69
        ($fh,$file) = tempfile ('der_chop.XXXXXX');
69
70
        open(OUT,">$file") || die "unable to open $file:$!\n";
70
71
        for (;;)
71
72
                {
139
140
        {
140
141
        local($str)=@_;
141
142
        local(*OUT,*IN,@a,$t,$d,$ret);
142
 
        local($file)="/tmp/b$$.DER";
 
143
        local($fh,$file) = tempfile ('der_chop.XXXXXX');
143
144
        local(@ret);
144
145
 
145
146
        open(OUT,">$file");
225
226
sub do_private_key
226
227
        {
227
228
        local($data,@struct)=@_;
228
 
        local($file)="/tmp/b$$.DER";
 
229
        local($fh,$file) = tempfile ('der_chop.XXXXXX');
229
230
        local($off,$d,$hl,$len,$_,$b,@p,$s);
230
231
 
231
232
        ($type)=($struct[4] =~ /OBJECT_IDENTIFIER :(.*)\s*$/);
260
261
sub do_certificate
261
262
        {
262
263
        local($data,@struct)=@_;
263
 
        local($file)="/tmp/b$$.DER";
264
264
        local($off,$d,$hl,$len,$_,$b,@p,$s);
265
265
 
266
266
        ($off,$d,$hl,$len)=&parse_line($struct[2]);