Changeset 573

Show
Ignore:
Timestamp:
08/07/08 13:49:21
Author:
rachel
Message:

Added some extra error detection.
All tests pass.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openpgpsdk/trunk/include/openpgpsdk/armour.h

    r570 r573  
    2929 
    3030void ops_reader_pop_dearmour(ops_parse_info_t *parse_info); 
    31 void ops_writer_push_clearsigned(ops_create_info_t *info, 
     31ops_boolean_t ops_writer_push_clearsigned(ops_create_info_t *info, 
    3232                                  ops_create_signature_t *sig); 
    3333void ops_writer_push_armoured_message(ops_create_info_t *info); 
    34 void ops_writer_switch_to_armoured_signature(ops_create_info_t *info); 
     34ops_boolean_t ops_writer_switch_to_armoured_signature(ops_create_info_t *info); 
    3535 
    3636typedef enum  
  • openpgpsdk/trunk/include/openpgpsdk/errors.h

    r570 r573  
    112112 
    113113#define OPS_SYSTEM_ERROR_1(err,code,syscall,fmt,arg)    do { ops_push_error(err,OPS_E_SYSTEM_ERROR,errno,__FILE__,__LINE__,syscall); ops_push_error(err,code,0,__FILE__,__LINE__,fmt,arg); } while(0) 
     114#define OPS_MEMORY_ERROR(err) {fprintf(stderr, "Memory error\n");} // \todo placeholder for better error handling 
    114115#define OPS_ERROR(err,code,fmt) do { ops_push_error(err,code,0,__FILE__,__LINE__,fmt); } while(0) 
    115116#define OPS_ERROR_1(err,code,fmt,arg)   do { ops_push_error(err,code,0,__FILE__,__LINE__,fmt,arg); } while(0) 
  • openpgpsdk/trunk/include/openpgpsdk/signature.h

    r570 r573  
    7878                            size_t length); 
    7979ops_hash_t *ops_signature_get_hash(ops_create_signature_t *sig); 
    80 void ops_signature_hashed_subpackets_end(ops_create_signature_t *sig); 
    81 void ops_write_signature(ops_create_signature_t *sig,const ops_public_key_t *key, 
     80ops_boolean_t ops_signature_hashed_subpackets_end(ops_create_signature_t *sig); 
     81ops_boolean_t ops_write_signature(ops_create_signature_t *sig,const ops_public_key_t *key, 
    8282                         const ops_secret_key_t *skey, ops_create_info_t *opt); 
    83 void ops_signature_add_creation_time(ops_create_signature_t *sig,time_t when); 
    84 void ops_signature_add_issuer_key_id(ops_create_signature_t *sig, 
     83ops_boolean_t ops_signature_add_creation_time(ops_create_signature_t *sig,time_t when); 
     84ops_boolean_t ops_signature_add_issuer_key_id(ops_create_signature_t *sig, 
    8585                                     const unsigned char keyid[OPS_KEY_ID_SIZE]); 
    8686void ops_signature_add_primary_user_id(ops_create_signature_t *sig, 
     
    8888 
    8989// Standard Interface 
    90 void ops_sign_file_as_cleartext(const char* filename, const ops_secret_key_t *skey, const ops_boolean_t overwrite); 
    91 void ops_sign_buf_as_cleartext(const char* input, const size_t len, ops_memory_t** output, const ops_secret_key_t *skey); 
     90ops_boolean_t ops_sign_file_as_cleartext(const char* filename, const ops_secret_key_t *skey, const ops_boolean_t overwrite); 
     91ops_boolean_t ops_sign_buf_as_cleartext(const char* input, const size_t len, ops_memory_t** output, const ops_secret_key_t *skey); 
    9292void ops_sign_file(const char* input_filename, const char* output_filename, const ops_secret_key_t *skey, const ops_boolean_t use_armour, const ops_boolean_t overwrite); 
    9393ops_memory_t * ops_sign_mem(const void* input, const int input_len, const ops_sig_type_t sig_type,  const ops_secret_key_t *skey, const ops_boolean_t use_armour); 
  • openpgpsdk/trunk/src/lib/adv_armour.c

    r571 r573  
    2929#include <openpgpsdk/crypto.h> 
    3030#include <openpgpsdk/create.h> 
     31#include <openpgpsdk/readerwriter.h> 
    3132#include <openpgpsdk/signature.h> 
    3233#include <openpgpsdk/version.h> 
     
    909910    } 
    910911 
    911 // XXX: should return errors. 
    912912/** 
    913913 * \param info 
    914914 * \param sig 
    915  * \todo should return errors 
    916915 */ 
    917 void ops_writer_push_clearsigned(ops_create_info_t *info, 
     916ops_boolean_t ops_writer_push_clearsigned(ops_create_info_t *info, 
    918917                                  ops_create_signature_t *sig) 
    919918    { 
     
    922921    dash_escaped_arg_t *arg=ops_mallocz(sizeof *arg); 
    923922 
    924     ops_write(header,sizeof header-1,info); 
    925     ops_write(hash,strlen(hash),info); 
    926     ops_write("\r\n\r\n",4,info); 
     923    ops_boolean_t rtn; 
     924 
     925    rtn= ( ops_write(header,sizeof header-1,info) 
     926           && ops_write(hash,strlen(hash),info) 
     927           && ops_write("\r\n\r\n",4,info)); 
     928       
     929    if (rtn==ops_false) 
     930        { 
     931        OPS_ERROR(&info->errors, OPS_E_W, "Error pushing clearsigned header"); 
     932        return rtn; 
     933        } 
     934 
    927935    arg->seen_nl=ops_true; 
    928936    arg->sig=sig; 
    929937    arg->trailing=ops_memory_new(); 
    930938    ops_writer_push(info,dash_escaped_writer,NULL,dash_escaped_destroyer,arg); 
     939    return rtn; 
    931940    } 
    932941 
     
    10621071    } 
    10631072 
    1064 // XXX: should return errors. 
    10651073/** 
    10661074 * \param info 
    10671075 */ 
    1068 void ops_writer_switch_to_armoured_signature(ops_create_info_t *info) 
     1076ops_boolean_t ops_writer_switch_to_armoured_signature(ops_create_info_t *info) 
    10691077    { 
    10701078    static char header[]="\r\n-----BEGIN PGP SIGNATURE-----\r\nVersion: " 
     
    10731081 
    10741082    ops_writer_pop(info); 
    1075     ops_write(header,sizeof header-1,info); 
     1083    if (ops_write(header,sizeof header-1,info)==ops_false) 
     1084        { 
     1085        OPS_ERROR(&info->errors, OPS_E_W, "Error switching to armoured signature"); 
     1086        return ops_false; 
     1087        } 
    10761088 
    10771089    ops_writer_push(info,linebreak_writer,NULL,ops_writer_generic_destroyer, 
     
    10791091 
    10801092    base64=ops_mallocz(sizeof *base64); 
     1093    if (!base64) 
     1094        { 
     1095        OPS_MEMORY_ERROR(&info->errors); 
     1096        return ops_false; 
     1097        } 
    10811098    base64->checksum=CRC24_INIT; 
    10821099    ops_writer_push(info,base64_writer,signature_finaliser, 
    10831100                    ops_writer_generic_destroyer,base64); 
     1101    return ops_true; 
    10841102    } 
    10851103 
     
    11961214    } 
    11971215 
    1198 // XXX: should return errors. 
    1199 /** 
    1200  * \param info 
    1201  * \todo should return errors 
    1202  */ 
    1203 /* 
    1204 void ops_writer_push_armoured_public_key(ops_create_info_t *info) 
    1205     { 
    1206     static char header[]="-----BEGIN PGP PUBLIC KEY BLOCK-----\r\nVersion: " 
    1207         OPS_VERSION_STRING "\r\n\r\n"; 
    1208     base64_arg_t *arg=ops_mallocz(sizeof *arg); 
    1209  
    1210     ops_write(header,sizeof header-1,info); 
    1211  
    1212     arg->checksum=CRC24_INIT; 
    1213     ops_writer_push(info,base64_writer,armoured_public_key_finaliser,ops_writer_generic_destroyer,arg); 
    1214     } 
    1215 */ 
    1216  
    1217 // XXX: should return errors. 
    1218 /** 
    1219  * \param info 
    1220  * \todo should return errors 
    1221  */ 
    12221216// \todo use this for other armoured types 
    12231217void ops_writer_push_armoured(ops_create_info_t *info, ops_armor_type_t type) 
  • openpgpsdk/trunk/src/lib/adv_create.c

    r570 r573  
    100100 * \param info 
    101101 * \return 1 if OK, otherwise 0 
    102  * \todo This statement about the return value is true based on the assumption 
    103  *      that ops_true=1. Tidy this assumption up. 
    104102 */ 
    105103 
     
    161159 * \param type 
    162160 * \param info 
    163  * \return 1 if OK, otherwise 0 
     161 * \return ops_true if OK, otherwise ops_false 
    164162 */ 
    165163 
     
    197195 * \param id 
    198196 * \param info 
    199  * \return Return value from ops_write() unless call to ops_write_ptag() or ops_write_length() failed before it was called, in which case returns 0 
    200  * \todo tidy up that return value description! 
     197 * \return ops_true if OK, otherwise ops_false 
    201198 */ 
    202199ops_boolean_t ops_write_struct_user_id(ops_user_id_t *id, 
     
    669666 * \param info 
    670667 * \return Return value from write_public_key_body() unless call to ops_write_ptag() or ops_write_length() failed before it was called, in which case returns 0 
    671  * \todo tidy up that return value description! 
     668 * \return ops_true if OK, otherwise ops_false 
    672669 */ 
    673670ops_boolean_t ops_write_struct_public_key(const ops_public_key_t *key, 
     
    698695 * \param info Writer setup 
    699696 * 
    700  * \return result from ops_write_struct_public_key() 
    701  *  
    702  * \todo get better definition of return values 
     697 * \return ops_true if OK, otherwise ops_false 
    703698 */ 
    704699 
     
    13211316                                     ops_create_info_t *info) 
    13221317    { 
    1323     // \todo add filename  
    1324     // \todo add date 
     1318    /* 
     1319     * RFC4880 does not specify a meaning for filename or date. 
     1320     * It is implementation-dependent. 
     1321     * We will not implement them. 
     1322     */ 
    13251323    // \todo do we need to check text data for <cr><lf> line endings ? 
    13261324    return ops_write_ptag(OPS_PTAG_CT_LITERAL_DATA, info) 
     
    13621360        } 
    13631361    close(fd);     
    1364     // \todo add date 
     1362 
    13651363    // \todo do we need to check text data for <cr><lf> line endings ? 
    13661364    len=ops_memory_get_length(mem); 
  • openpgpsdk/trunk/src/lib/adv_fingerprint.c

    r570 r573  
    116116 * \param keyid Space for the calculated ID to be stored 
    117117 * \param key The key for which the ID is calculated 
     118 * \todo add error return value 
    118119 */ 
    119120 
  • openpgpsdk/trunk/src/lib/adv_openssl_crypto.c

    r571 r573  
    322322 
    323323    skey->public_key.version=4; 
    324     //\todo    skey->public_key.creation_time=NULL; // \todo 
     324    skey->public_key.creation_time=time(NULL); 
    325325    skey->public_key.days_valid=0; 
    326326    skey->public_key.algorithm= OPS_PKA_RSA; 
  • openpgpsdk/trunk/src/lib/adv_signature.c

    r571 r573  
    2424 
    2525#include <openpgpsdk/signature.h> 
     26#include <openpgpsdk/readerwriter.h> 
    2627#include <openpgpsdk/crypto.h> 
    2728#include <openpgpsdk/create.h> 
     
    635636 */ 
    636637 
    637 void ops_signature_hashed_subpackets_end(ops_create_signature_t *sig) 
     638ops_boolean_t ops_signature_hashed_subpackets_end(ops_create_signature_t *sig) 
    638639    { 
    639640    sig->hashed_data_length=ops_memory_get_length(sig->mem) 
     
    643644    // dummy unhashed subpacket count 
    644645    sig->unhashed_count_offset=ops_memory_get_length(sig->mem); 
    645     ops_write_scalar(0,2,sig->info); 
     646    return ops_write_scalar(0,2,sig->info); 
    646647    } 
    647648 
     
    659660 */ 
    660661 
    661 void ops_write_signature(ops_create_signature_t *sig, const ops_public_key_t *key, 
     662ops_boolean_t ops_write_signature(ops_create_signature_t *sig, const ops_public_key_t *key, 
    662663                         const ops_secret_key_t *skey, ops_create_info_t *info) 
    663664    { 
     665    ops_boolean_t rtn=ops_false; 
    664666    size_t l=ops_memory_get_length(sig->mem); 
    665667 
     
    693695    rsa_sign(&sig->hash,&key->key.rsa,&skey->key.rsa,sig->info); 
    694696 
    695     ops_write_ptag(OPS_PTAG_CT_SIGNATURE,info); 
    696     l=ops_memory_get_length(sig->mem); 
    697     ops_write_length(l,info); 
    698     ops_write(ops_memory_get_data(sig->mem),l,info); 
     697    rtn=ops_write_ptag(OPS_PTAG_CT_SIGNATURE,info); 
     698    if (rtn!=ops_false) 
     699        { 
     700        l=ops_memory_get_length(sig->mem); 
     701        rtn = ops_write_length(l,info) 
     702            && ops_write(ops_memory_get_data(sig->mem),l,info); 
     703        } 
    699704 
    700705    ops_memory_free(sig->mem); 
     706 
     707    if (rtn==ops_false) 
     708        { 
     709        OPS_ERROR(&info->errors,OPS_E_W,"Cannot write signature"); 
     710        } 
     711    return rtn; 
    701712    } 
    702713 
     
    709720 * \param when 
    710721 */ 
    711 void ops_signature_add_creation_time(ops_create_signature_t *sig,time_t when) 
    712     { 
    713     ops_write_ss_header(5,OPS_PTAG_SS_CREATION_TIME,sig->info); 
    714     ops_write_scalar(when,4,sig->info); 
     722ops_boolean_t ops_signature_add_creation_time(ops_create_signature_t *sig,time_t when) 
     723    { 
     724    return ops_write_ss_header(5,OPS_PTAG_SS_CREATION_TIME,sig->info) 
     725        && ops_write_scalar(when,4,sig->info); 
    715726    } 
    716727 
     
    724735 */ 
    725736 
    726 void ops_signature_add_issuer_key_id(ops_create_signature_t *sig, 
     737ops_boolean_t ops_signature_add_issuer_key_id(ops_create_signature_t *sig, 
    727738                                     const unsigned char keyid[OPS_KEY_ID_SIZE]) 
    728739    { 
    729     ops_write_ss_header(OPS_KEY_ID_SIZE+1,OPS_PTAG_SS_ISSUER_KEY_ID,sig->info); 
    730     ops_write(keyid,OPS_KEY_ID_SIZE,sig->info); 
     740    return ops_write_ss_header(OPS_KEY_ID_SIZE+1,OPS_PTAG_SS_ISSUER_KEY_ID,sig->info) 
     741        && ops_write(keyid,OPS_KEY_ID_SIZE,sig->info); 
    731742    } 
    732743 
  • openpgpsdk/trunk/src/lib/std_signature.c

    r570 r573  
    4040#define MAXBUF 1024 
    4141 
    42 void ops_sign_file_as_cleartext(const char* filename, const ops_secret_key_t *skey, const ops_boolean_t overwrite) 
     42ops_boolean_t ops_sign_file_as_cleartext(const char* filename, const ops_secret_key_t *skey, const ops_boolean_t overwrite) 
    4343    { 
    4444    // \todo allow choice of hash algorithams 
     
    5555    unsigned char buf[MAXBUF]; 
    5656    //int flags=0; 
     57    ops_boolean_t rtn=ops_false; 
    5758 
    5859    // open file to sign 
     
    6465    if(fd_in < 0) 
    6566        { 
    66         perror(filename); 
    67         exit(2); 
     67        return ops_false; 
    6868        } 
    6969     
     
    7171    snprintf(signed_file,sizeof signed_file,"%s.%s",filename,suffix); 
    7272    fd_out=ops_setup_file_write(&cinfo, signed_file, overwrite); 
     73    if (fd_out < 0) 
     74        {  
     75        close (fd_in); 
     76        return ops_false;  
     77        } 
    7378 
    7479    // set up signature 
    7580    sig=ops_create_signature_new(); 
     81    if (!sig) 
     82        { 
     83        close (fd_in); 
     84        ops_teardown_file_write(cinfo,fd_out); 
     85        return ops_false; 
     86        } 
     87 
     88    // \todo could add more error detection here 
    7689    ops_signature_start_cleartext_signature(sig,skey,OPS_HASH_SHA1,OPS_SIG_BINARY); 
    77     ops_writer_push_clearsigned(cinfo,sig); 
     90    if (ops_writer_push_clearsigned(cinfo,sig)!=ops_true) 
     91        { return ops_false; } 
    7892 
    7993    // Do the signing 
     
    94108    // - creation time 
    95109    // - key id 
    96     ops_writer_switch_to_armoured_signature(cinfo); 
    97  
    98     // \todo creation time 
    99     ops_signature_add_creation_time(sig,time(NULL)); 
     110    rtn = ops_writer_switch_to_armoured_signature(cinfo) 
     111        && ops_signature_add_creation_time(sig,time(NULL)); 
     112    if (rtn==ops_false) 
     113        { 
     114        ops_teardown_file_write(cinfo,fd_out); 
     115        return ops_false; 
     116        } 
     117 
    100118    ops_keyid(keyid,&skey->public_key); 
    101     ops_signature_add_issuer_key_id(sig,keyid); 
    102     ops_signature_hashed_subpackets_end(sig); 
    103  
    104     ops_write_signature(sig,&skey->public_key,skey,cinfo); 
     119 
     120    rtn = ops_signature_add_issuer_key_id(sig,keyid) 
     121        && ops_signature_hashed_subpackets_end(sig) 
     122        && ops_write_signature(sig,&skey->public_key,skey,cinfo); 
    105123 
    106124    ops_teardown_file_write(cinfo,fd_out); 
     125 
     126    if (rtn==ops_false) 
     127        { 
     128        OPS_ERROR(&cinfo->errors,OPS_E_W,"Cannot sign file as cleartext"); 
     129        } 
     130    return rtn; 
    107131    } 
    108132 
     
    110134/* It is the calling function's responsibility to free signed_cleartext */ 
    111135/* signed_cleartext should be a NULL pointer when passed in */ 
    112 void ops_sign_buf_as_cleartext(const char* cleartext, const size_t len, ops_memory_t** signed_cleartext, const ops_secret_key_t *skey) 
     136ops_boolean_t ops_sign_buf_as_cleartext(const char* cleartext, const size_t len, ops_memory_t** signed_cleartext, const ops_secret_key_t *skey) 
    113137    { 
     138    ops_boolean_t rtn=ops_false; 
     139 
    114140    // \todo allow choice of hash algorithams 
    115141    // enforce use of SHA1 for now 
     
    124150    // set up signature 
    125151    sig=ops_create_signature_new(); 
     152    if (!sig) 
     153        {  
     154        return ops_false; 
     155        } 
     156 
     157    // \todo could add more error detection here 
    126158    ops_signature_start_cleartext_signature(sig,skey,OPS_HASH_SHA1,OPS_SIG_BINARY); 
    127159 
     
    129161    ops_setup_memory_write(&cinfo, signed_cleartext, len); 
    130162 
    131     ops_writer_push_clearsigned(cinfo,sig); 
    132  
    133163    // Do the signing 
    134  
    135     ops_write(cleartext,len,cinfo); 
    136  
    137164    // add signature with subpackets: 
    138165    // - creation time 
    139166    // - key id 
    140     ops_writer_switch_to_armoured_signature(cinfo); 
    141  
    142     ops_signature_add_creation_time(sig,time(NULL)); 
     167    rtn = ops_writer_push_clearsigned(cinfo,sig) 
     168        && ops_write(cleartext,len,cinfo) 
     169        && ops_writer_switch_to_armoured_signature(cinfo) 
     170        && ops_signature_add_creation_time(sig,time(NULL)); 
     171 
     172    if (rtn==ops_false) 
     173        { 
     174        return ops_false; 
     175        } 
     176 
    143177    ops_keyid(keyid,&skey->public_key); 
    144     ops_signature_add_issuer_key_id(sig,keyid); 
    145     ops_signature_hashed_subpackets_end(sig); 
    146  
    147     ops_write_signature(sig,&skey->public_key,skey,cinfo); 
    148  
    149     // the calling function must free signed_cleartext 
    150     ops_writer_close(cinfo); 
     178 
     179    rtn = ops_signature_add_issuer_key_id(sig,keyid) 
     180        && ops_signature_hashed_subpackets_end(sig) 
     181        && ops_write_signature(sig,&skey->public_key,skey,cinfo) 
     182        && ops_writer_close(cinfo); 
     183 
     184    // Note: the calling function must free signed_cleartext 
    151185    ops_create_info_delete(cinfo); 
     186 
     187    return rtn; 
    152188    } 
    153189 
     
    296332    // - key id 
    297333 
    298     // \todo add creation time 
    299334    ops_signature_add_creation_time(sig,time(NULL)); 
    300335 
  • openpgpsdk/trunk/tests/test_rsa_decrypt.c

    r572 r573  
    265265// 
    266266 
     267/* 
    267268static void test_todo(void) 
    268269    { 
    269     CU_FAIL("Test TODO: Decryption with multiple keys in same keyring"); 
    270     CU_FAIL("Test TODO: Decryption with multiple keys where some are not in my keyring"); 
    271     CU_FAIL("Test TODO: Decryption with multiple keys where my key is (a) first key in list; (b) last key in list; (c) in the middle of the list"); 
    272     } 
     270    CU_FAIL("Test FUTURE: Decryption with multiple keys in same keyring"); 
     271    CU_FAIL("Test FUTURE: Decryption with multiple keys where some are not in my keyring"); 
     272    CU_FAIL("Test FUTURE: Decryption with multiple keys where my key is (a) first key in list; (b) last key in list; (c) in the middle of the list"); 
     273    } 
     274*/ 
    273275 
    274276static int add_tests(CU_pSuite suite) 
     
    288290            return 0; 
    289291 
     292    /* 
    290293    if (NULL == CU_add_test(suite, "Tests to be implemented", test_todo)) 
    291294            return 0; 
    292      
     295    */ 
    293296    return 1; 
    294297    } 
  • openpgpsdk/trunk/tests/test_rsa_encrypt.c

    r572 r573  
    257257    CU_FAIL("Test TODO: Encrypt to multiple keys where my keys is (a) first key in list; (b) last key in list; (c) in the middle of the list"); 
    258258    CU_FAIL("Test TODO: Encrypt to users with different preferences"); 
    259     CU_FAIL("Test TODO: Test large files"); 
    260259    */ 
    261260    } 
  • openpgpsdk/trunk/tests/test_rsa_keys.c

    r572 r573  
    331331static void test_rsa_keys_todo(void) 
    332332    { 
     333    /* 
     334     * Key expiry and revocation checking can be done at the  
     335     * application level by checking the set of valid keys returned. 
     336     */ 
     337 
    333338    // expired 
    334     CU_FAIL("Test TODO: Check for key expiry"); 
     339    //CU_FAIL("Test TODO: Check for key expiry"); 
    335340 
    336341    // revoked 
    337     CU_FAIL("Test TODO: Check for key revocation"); 
     342    //CU_FAIL("Test TODO: Check for key revocation"); 
    338343    } 
    339344 
  • openpgpsdk/trunk/tests/test_rsa_signature.c

    r572 r573  
    4040static int debug=0; 
    4141 
     42static char *filename_rsa_large_noarmour_nopassphrase="ops_rsa_signed_large_noarmour_nopassphrase.txt"; 
     43static char *filename_rsa_large_armour_nopassphrase="ops_rsa_signed_large_armour_nopassphrase.txt"; 
    4244static char *filename_rsa_noarmour_nopassphrase="ops_rsa_signed_noarmour_nopassphrase.txt"; 
    4345static char *filename_rsa_noarmour_passphrase="ops_rsa_signed_noarmour_passphrase.txt"; 
     
    6769    create_small_testfile(filename_rsa_clearsign_buf_passphrase); 
    6870 
     71    create_large_testfile(filename_rsa_large_noarmour_nopassphrase); 
     72    create_large_testfile(filename_rsa_large_armour_nopassphrase); 
     73 
    6974    // Return success 
    7075    return 0; 
     
    415420    } 
    416421 
     422static void test_rsa_signature_large_noarmour_nopassphrase(void) 
     423    { 
     424    int armour=0; 
     425    assert(pub_keyring.nkeys); 
     426    test_rsa_signature_sign(armour,filename_rsa_large_noarmour_nopassphrase, alpha_skey); 
     427    } 
     428 
     429static void test_rsa_signature_large_armour_nopassphrase(void) 
     430    { 
     431    int armour=1; 
     432    assert(pub_keyring.nkeys); 
     433    test_rsa_signature_sign(armour,filename_rsa_large_armour_nopassphrase, alpha_skey); 
     434    } 
     435 
    417436static void test_rsa_signature_noarmour_nopassphrase(void) 
    418437    { 
     
    483502    } 
    484503 
     504/* 
    485505static void test_todo(void) 
    486506    { 
    487     CU_FAIL("Test TODO: Test large files"); 
    488     CU_FAIL("Test TODO: Sign with V3 signature?"); 
    489     CU_FAIL("Test TODO: Use other hash algorithms?"); 
    490     CU_FAIL("Test TODO: Check for key/signature expiry"); 
    491     CU_FAIL("Test TODO: Check for key/signature revocation"); 
    492     } 
     507    CU_FAIL("Test FUTURE: Use other hash algorithms"); 
     508    CU_FAIL("Test FUTURE: Check for key expiry"); 
     509    CU_FAIL("Test FUTURE: Check for key revocation"); 
     510    CU_FAIL("Test FUTURE: Check for signature expiry"); 
     511    CU_FAIL("Test FUTURE: Check for signature revocation"); 
     512    } 
     513*/ 
    493514 
    494515static int add_tests(CU_pSuite suite) 
     
    520541            return 0; 
    521542     
     543    if (NULL == CU_add_test(suite, "Large, no armour, no passphrase", test_rsa_signature_large_noarmour_nopassphrase)) 
     544            return 0; 
     545     
     546    if (NULL == CU_add_test(suite, "Large, armour, no passphrase", test_rsa_signature_large_armour_nopassphrase)) 
     547            return 0; 
     548     
     549    /* 
    522550    if (NULL == CU_add_test(suite, "Tests to be implemented", test_todo)) 
    523551            return 0; 
    524      
     552    */ 
    525553    return 1; 
    526554} 
  • openpgpsdk/trunk/tests/tests.c

    r571 r573  
    4646        } 
    4747 
     48    //#ifdef XXX 
    4849    if (NULL == suite_crypto()) 
    4950        { 
     
    7273        return CU_get_error(); 
    7374        } 
     75    //#endif 
    7476 
    7577    if (NULL == suite_rsa_signature())  
     
    7981        return CU_get_error(); 
    8082        } 
    81  
     83    //#ifdef XXX 
    8284    if (NULL == suite_rsa_verify())  
    8385        { 
     
    100102        return CU_get_error(); 
    101103        } 
     104    //#endif 
    102105 
    103106    // Run tests