Changeset 472
- Timestamp:
- 05/04/07 16:36:53
- Files:
-
- openpgpsdk/trunk/tests/test_crypt_mpi.c (modified) (1 diff)
- openpgpsdk/trunk/tests/test_rsa_encrypt.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openpgpsdk/trunk/tests/test_crypt_mpi.c
r471 r472 99 99 100 100 // is it the same? 101 int n=strncmp((char *)buf,(char *)out,sizeof(buf)); 102 printf ("n=%d\n",n); 101 CU_ASSERT(strncmp((char *)buf,(char *)out,sizeof(buf))==0); 103 102 } 104 103 openpgpsdk/trunk/tests/test_rsa_encrypt.c
r471 r472 1 #include <assert.h>2 #include <stdio.h>3 #include <string.h>4 #include <stdlib.h>5 #include <unistd.h>6 #include <fcntl.h>7 #include <sys/stat.h>8 #include <sys/types.h>9 10 1 #include "CUnit/Basic.h" 11 2 3 #include <openpgpsdk/types.h> 4 #include "openpgpsdk/keyring.h" 12 5 #include <openpgpsdk/armour.h> 13 #include "openpgpsdk/keyring.h"14 6 #include "openpgpsdk/packet.h" 15 7 #include "openpgpsdk/packet-parse.h" 16 8 #include "openpgpsdk/util.h" 17 9 #include "openpgpsdk/std_print.h" 10 11 #include "tests.h" 18 12 19 13 /* … … 26 20 #define MAXBUF 128 27 21 static char pub_keyring_name[MAXBUF+1]; 28 static char dir[MAXBUF+1];29 22 static char keydetails[MAXBUF+1]; 30 23 static ops_keyring_t pub_keyring; … … 180 173 #endif 181 174 182 static int mktmpdir (void)183 {184 int limit=10; // don't try indefinitely185 long int rnd=0;186 while (limit--)187 {188 rnd=random();189 snprintf(dir,MAXBUF,"./testdir.encrypt.%ld",rnd);190 191 // Try to create directory192 if (!mkdir(dir,0700))193 {194 // success195 return 1;196 }197 else198 {199 fprintf (stderr,"Couldn't open dir: errno=%d\n", errno);200 perror(NULL);201 }202 }203 return 0;204 }205 206 175 207 176 /* Decryption suite initialization.
