~ubuntu-branches/ubuntu/hardy/openssl/hardy-security

« back to all changes in this revision

Viewing changes to crypto/des/destest.c

  • Committer: Bazaar Package Importer
  • Author(s): Kurt Roeckx
  • Date: 2005-12-13 21:37:42 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051213213742-7em5nrw5c7ceegyd
Tags: 0.9.8a-5
Stop ssh from crashing randomly on sparc (Closes: #335912)
Patch from upstream cvs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
#else
85
85
#include <openssl/des.h>
86
86
 
87
 
#define crypt(c,s) (des_crypt((c),(s)))
 
87
#define crypt(c,s) (DES_crypt((c),(s)))
88
88
 
89
89
/* tisk tisk - the test keys don't all have odd parity :-( */
90
90
/* test data */
333
333
static int ede_cfb64_test(unsigned char *cfb_cipher);
334
334
int main(int argc, char *argv[])
335
335
        {
336
 
        int i,j,err=0;
 
336
        int j,err=0;
 
337
        unsigned int i;
337
338
        des_cblock in,out,outin,iv3,iv2;
338
339
        des_key_schedule ks,ks2,ks3;
339
340
        unsigned char cbc_in[40];
391
392
        DES_ede3_cbcm_encrypt(cbc_out,cbc_in,i,&ks,&ks2,&ks3,&iv3,&iv2,DES_DECRYPT);
392
393
        if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
393
394
                {
394
 
                int n;
 
395
                unsigned int n;
395
396
 
396
397
                printf("des_ede3_cbcm_encrypt decrypt error\n");
397
398
                for(n=0 ; n < i ; ++n)
439
440
                memcpy(in,plain_data[i],8);
440
441
                memset(out,0,8);
441
442
                memset(outin,0,8);
442
 
                des_ecb2_encrypt(in,out,ks,ks2,DES_ENCRYPT);
443
 
                des_ecb2_encrypt(out,outin,ks,ks2,DES_DECRYPT);
 
443
                des_ecb2_encrypt(&in,&out,ks,ks2,DES_ENCRYPT);
 
444
                des_ecb2_encrypt(&out,&outin,ks,ks2,DES_DECRYPT);
444
445
 
445
446
                if (memcmp(out,cipher_ecb2[i],8) != 0)
446
447
                        {
540
541
        if (memcmp(cbc_out,cbc3_ok,
541
542
                (unsigned int)(strlen((char *)cbc_data)+1+7)/8*8) != 0)
542
543
                {
543
 
                int n;
 
544
                unsigned int n;
544
545
 
545
546
                printf("des_ede3_cbc_encrypt encrypt error\n");
546
547
                for(n=0 ; n < i ; ++n)
556
557
        des_ede3_cbc_encrypt(cbc_out,cbc_in,i,ks,ks2,ks3,&iv3,DES_DECRYPT);
557
558
        if (memcmp(cbc_in,cbc_data,strlen((char *)cbc_data)+1) != 0)
558
559
                {
559
 
                int n;
 
560
                unsigned int n;
560
561
 
561
562
                printf("des_ede3_cbc_encrypt decrypt error\n");
562
563
                for(n=0 ; n < i ; ++n)
820
821
                printf("fast crypt error, %s should be yA1Rp/1hZXIJk\n",str);
821
822
                err=1;
822
823
                }
 
824
#ifdef OPENSSL_SYS_NETWARE
 
825
    if (err) printf("ERROR: %d\n", err);
 
826
#endif
823
827
        printf("\n");
824
828
        return(err);
825
829
        }