removed parameter asserts so that we can test failure cases in pEpEngine.c
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Wed, 05 Aug 2020 14:52:50 +0200
changeset 49278530fd2b4058
parent 4924 d5645a8e68bd
child 4929 07c8e5359f5c
child 4932 bee458d79f7e
removed parameter asserts so that we can test failure cases in pEpEngine.c
src/pEpEngine.c
     1.1 --- a/src/pEpEngine.c	Wed Aug 05 13:54:24 2020 +0200
     1.2 +++ b/src/pEpEngine.c	Wed Aug 05 14:52:50 2020 +0200
     1.3 @@ -538,9 +538,6 @@
     1.4          
     1.5  static int user_version(void *_version, int count, char **text, char **name)
     1.6  {
     1.7 -    assert(_version);
     1.8 -    assert(count == 1);
     1.9 -    assert(text && text[0]);
    1.10      if (!(_version && count == 1 && text && text[0]))
    1.11          return -1;
    1.12  
    1.13 @@ -983,7 +980,6 @@
    1.14      // client session, or by using synchronization primitive to protect
    1.15      // creation/deletion of first/last session from the app.
    1.16  
    1.17 -    assert(session);
    1.18      if (session == NULL)
    1.19          return PEP_ILLEGAL_VALUE;
    1.20  
    1.21 @@ -2124,10 +2120,7 @@
    1.22      bool out_last = false;
    1.23      int _count = --init_count;
    1.24      
    1.25 -    assert(_count >= -1);
    1.26 -    assert(session);
    1.27 -
    1.28 -    if (!((_count >= -1) && session))
    1.29 +    if ((_count < -1) || !session)
    1.30          return;
    1.31  
    1.32      // a small race condition but still a race condition
    1.33 @@ -2394,11 +2387,7 @@
    1.34      session->service_log = true;
    1.35  
    1.36      int result;
    1.37 -    
    1.38 -    assert(session);
    1.39 -    assert(title);
    1.40 -    assert(entity);
    1.41 -    
    1.42 +        
    1.43      if (!(session && title && entity))
    1.44          return PEP_ILLEGAL_VALUE;
    1.45      
    1.46 @@ -2428,7 +2417,6 @@
    1.47          const char *comment
    1.48      )
    1.49  {
    1.50 -    assert(session);
    1.51      if (!session)
    1.52          return PEP_ILLEGAL_VALUE;
    1.53  
    1.54 @@ -2445,10 +2433,6 @@
    1.55  {
    1.56      PEP_STATUS status = PEP_STATUS_OK;
    1.57  
    1.58 -    assert(session);
    1.59 -    assert(word);
    1.60 -    assert(wsize);
    1.61 -
    1.62      if (!(session && word && wsize))
    1.63          return PEP_ILLEGAL_VALUE;
    1.64  
    1.65 @@ -2458,6 +2442,7 @@
    1.66      if (lang == NULL)
    1.67          lang = "en";
    1.68  
    1.69 +    // FIXME: should this not be an actual check???
    1.70      assert((lang[0] >= 'A' && lang[0] <= 'Z')
    1.71              || (lang[0] >= 'a' && lang[0] <= 'z'));
    1.72      assert((lang[1] >= 'A' && lang[1] <= 'Z')
    1.73 @@ -2490,12 +2475,6 @@
    1.74  {
    1.75      const char *source = fingerprint;
    1.76  
    1.77 -    assert(session);
    1.78 -    assert(fingerprint);
    1.79 -    assert(words);
    1.80 -    assert(wsize);
    1.81 -    assert(max_words >= 0);
    1.82 -
    1.83      if (!(session && fingerprint && words && wsize && max_words >= 0))
    1.84          return PEP_ILLEGAL_VALUE;
    1.85  
    1.86 @@ -2513,6 +2492,7 @@
    1.87      if (!lang || !lang[0])
    1.88          lang = "en";
    1.89  
    1.90 +    // FIXME: Should this not be an actual check?
    1.91      assert((lang[0] >= 'A' && lang[0] <= 'Z')
    1.92              || (lang[0] >= 'a' && lang[0] <= 'z'));
    1.93      assert((lang[1] >= 'A' && lang[1] <= 'Z')
    1.94 @@ -2578,7 +2558,6 @@
    1.95      )
    1.96  {
    1.97      pEp_identity *result = calloc(1, sizeof(pEp_identity));
    1.98 -    assert(result);
    1.99      if (result) {
   1.100          if (address) {
   1.101              result->address = strdup(address);
   1.102 @@ -2618,23 +2597,23 @@
   1.103  
   1.104  pEp_identity *identity_dup(const pEp_identity *src)
   1.105  {
   1.106 -    assert(src);
   1.107 -
   1.108 -    pEp_identity *dup = new_identity(src->address, src->fpr, src->user_id,
   1.109 -            src->username);
   1.110 -    assert(dup);
   1.111 -    if (dup == NULL)
   1.112 -        return NULL;
   1.113 -    
   1.114 -    dup->comm_type = src->comm_type;
   1.115 -    dup->lang[0] = src->lang[0];
   1.116 -    dup->lang[1] = src->lang[1];
   1.117 -    dup->lang[2] = 0;
   1.118 -    dup->flags = src->flags;
   1.119 -    dup->me = src->me;
   1.120 -    dup->major_ver = src->major_ver;
   1.121 -    dup->minor_ver = src->minor_ver;
   1.122 -    
   1.123 +    pEp_identity* dup = NULL;
   1.124 +    if (src) {
   1.125 +        dup = new_identity(src->address, src->fpr, src->user_id,
   1.126 +                src->username);
   1.127 +        assert(dup);
   1.128 +        if (dup == NULL)
   1.129 +            return NULL;
   1.130 +        
   1.131 +        dup->comm_type = src->comm_type;
   1.132 +        dup->lang[0] = src->lang[0];
   1.133 +        dup->lang[1] = src->lang[1];
   1.134 +        dup->lang[2] = 0;
   1.135 +        dup->flags = src->flags;
   1.136 +        dup->me = src->me;
   1.137 +        dup->major_ver = src->major_ver;
   1.138 +        dup->minor_ver = src->minor_ver;
   1.139 +    }    
   1.140      return dup;
   1.141  }
   1.142  
   1.143 @@ -2654,8 +2633,6 @@
   1.144          char** userid
   1.145      )
   1.146  {
   1.147 -    assert(session);
   1.148 -    assert(userid);
   1.149      
   1.150      if (!session || !userid)
   1.151          return PEP_ILLEGAL_VALUE;
   1.152 @@ -2698,11 +2675,6 @@
   1.153          const char* alias_id,
   1.154          char** default_id) {
   1.155              
   1.156 -    assert(session);
   1.157 -    assert(alias_id);
   1.158 -    assert(alias_id[0]);
   1.159 -    assert(default_id);
   1.160 -
   1.161      if (!(session && alias_id && alias_id[0] && default_id))
   1.162          return PEP_ILLEGAL_VALUE;
   1.163  
   1.164 @@ -2743,10 +2715,6 @@
   1.165              
   1.166      int result;
   1.167  
   1.168 -    assert(session);
   1.169 -    assert(default_id);
   1.170 -    assert(alias_id);
   1.171 -
   1.172      if (!(session && default_id && alias_id && 
   1.173            default_id[0] != '\0' && alias_id[0] != '\0'))
   1.174          return PEP_ILLEGAL_VALUE;
   1.175 @@ -2782,11 +2750,6 @@
   1.176      PEP_STATUS status = PEP_STATUS_OK;
   1.177      pEp_identity *_identity = NULL;
   1.178  
   1.179 -    assert(session);
   1.180 -    assert(address);
   1.181 -    assert(address[0]);
   1.182 -    assert(identity);
   1.183 -
   1.184      if (!(session && address && address[0] && identity))
   1.185          return PEP_ILLEGAL_VALUE;
   1.186  
   1.187 @@ -3011,11 +2974,6 @@
   1.188      PEP_STATUS status = PEP_STATUS_OK;
   1.189      pEp_identity *_identity = NULL;
   1.190  
   1.191 -    assert(session);
   1.192 -    assert(address);
   1.193 -    assert(address[0]);
   1.194 -    assert(identity);
   1.195 -
   1.196      if (!(session && address && address[0] && identity))
   1.197          return PEP_ILLEGAL_VALUE;
   1.198  
   1.199 @@ -3080,10 +3038,6 @@
   1.200          identity_list** id_list
   1.201      )
   1.202  {
   1.203 -    assert(session);
   1.204 -    assert(address);
   1.205 -    assert(address[0]);
   1.206 -    assert(id_list);
   1.207  
   1.208      if (!(session && address && address[0] && id_list))
   1.209          return PEP_ILLEGAL_VALUE;
   1.210 @@ -3151,11 +3105,7 @@
   1.211  
   1.212  PEP_STATUS exists_identity_entry(PEP_SESSION session, pEp_identity* identity,
   1.213                                   bool* exists) {
   1.214 -    assert(session);
   1.215 -    assert(identity);
   1.216 -    assert(!EMPTYSTR(identity->user_id));        
   1.217 -    assert(!EMPTYSTR(identity->address));
   1.218 -    if (!session || !exists || EMPTYSTR(identity->user_id) || EMPTYSTR(identity->address))
   1.219 +    if (!session || !exists || !identity || EMPTYSTR(identity->user_id) || EMPTYSTR(identity->address))
   1.220          return PEP_ILLEGAL_VALUE;
   1.221      
   1.222      *exists = false;
   1.223 @@ -3186,11 +3136,7 @@
   1.224  
   1.225  PEP_STATUS exists_trust_entry(PEP_SESSION session, pEp_identity* identity,
   1.226                                bool* exists) {
   1.227 -    assert(session);
   1.228 -    assert(identity);
   1.229 -    assert(!EMPTYSTR(identity->user_id));        
   1.230 -    assert(!EMPTYSTR(identity->fpr));
   1.231 -    if (!session || !exists || EMPTYSTR(identity->user_id) || EMPTYSTR(identity->fpr))
   1.232 +    if (!session || !exists || !identity || EMPTYSTR(identity->user_id) || EMPTYSTR(identity->fpr))
   1.233          return PEP_ILLEGAL_VALUE;
   1.234      
   1.235      *exists = false;
   1.236 @@ -3261,11 +3207,6 @@
   1.237  static PEP_STATUS _set_or_update_trust(PEP_SESSION session,
   1.238                                         pEp_identity* identity,
   1.239                                         sqlite3_stmt* set_or_update) {
   1.240 -
   1.241 -    assert(session);
   1.242 -    assert(identity);
   1.243 -    assert(identity->user_id);
   1.244 -    assert(identity->fpr);
   1.245      
   1.246      if (!session || !identity || EMPTYSTR(identity->user_id) || EMPTYSTR(identity->fpr))
   1.247          return PEP_ILLEGAL_VALUE;
   1.248 @@ -3294,9 +3235,6 @@
   1.249  static PEP_STATUS _set_or_update_identity_entry(PEP_SESSION session,
   1.250                                                  pEp_identity* identity,
   1.251                                                  sqlite3_stmt* set_or_update) {
   1.252 -    assert(session);
   1.253 -    assert(identity);
   1.254 -    assert(set_or_update);
   1.255                        
   1.256      if (!session || !identity || !identity->user_id || !identity->address)
   1.257          return PEP_ILLEGAL_VALUE;
   1.258 @@ -3324,9 +3262,6 @@
   1.259  static PEP_STATUS _set_or_update_person(PEP_SESSION session, 
   1.260                                          pEp_identity* identity,
   1.261                                          sqlite3_stmt* set_or_update) {
   1.262 -    assert(session);
   1.263 -    assert(identity);
   1.264 -    assert(set_or_update);
   1.265                          
   1.266      if (!session || !identity || !identity->user_id || !identity->username)
   1.267          return PEP_ILLEGAL_VALUE;
   1.268 @@ -3433,12 +3368,6 @@
   1.269  {
   1.270      int result;
   1.271  
   1.272 -    assert(session);
   1.273 -    assert(identity);
   1.274 -    assert(identity->address);
   1.275 -    assert(identity->user_id);
   1.276 -    assert(identity->username);
   1.277 -
   1.278      if (!(session && identity && identity->address &&
   1.279                  identity->user_id && identity->username))
   1.280          return PEP_ILLEGAL_VALUE;
   1.281 @@ -3531,10 +3460,6 @@
   1.282  
   1.283  // This ONLY sets the user flag. Must be called outside of a transaction.
   1.284  DYNAMIC_API PEP_STATUS set_as_pEp_user(PEP_SESSION session, pEp_identity* user) {
   1.285 -
   1.286 -    assert(session);
   1.287 -    assert(user);
   1.288 -    assert(!EMPTYSTR(user->user_id));
   1.289          
   1.290      if (!session || !user || EMPTYSTR(user->user_id))
   1.291          return PEP_ILLEGAL_VALUE;
   1.292 @@ -3568,10 +3493,10 @@
   1.293  
   1.294  // This ONLY sets the version flag. Must be called outside of a transaction.
   1.295  PEP_STATUS set_pEp_version(PEP_SESSION session, pEp_identity* ident, unsigned int new_ver_major, unsigned int new_ver_minor) {
   1.296 -    assert(session);
   1.297 -    assert(!EMPTYSTR(ident->user_id));
   1.298 -    assert(!EMPTYSTR(ident->address));
   1.299 -    
   1.300 +
   1.301 +    if (!session || !ident || EMPTYSTR(ident->user_id) || EMPTYSTR(ident->address))
   1.302 +        return PEP_ILLEGAL_VALUE;
   1.303 +
   1.304      sqlite3_reset(session->set_pEp_version);
   1.305      sqlite3_bind_double(session->set_pEp_version, 1, new_ver_major);
   1.306      sqlite3_bind_double(session->set_pEp_version, 2, new_ver_minor);    
   1.307 @@ -3596,8 +3521,9 @@
   1.308          unsigned int new_ver_minor
   1.309      ) 
   1.310  {
   1.311 -    assert(session);
   1.312 -    assert(!EMPTYSTR(ident->user_id));
   1.313 +
   1.314 +    if (!session || !ident || EMPTYSTR(ident->user_id))
   1.315 +        return PEP_ILLEGAL_VALUE;
   1.316      
   1.317      sqlite3_reset(session->upgrade_pEp_version_by_user_id);
   1.318      sqlite3_bind_int(session->upgrade_pEp_version_by_user_id, 1, new_ver_major);
   1.319 @@ -3616,14 +3542,7 @@
   1.320  
   1.321  PEP_STATUS exists_person(PEP_SESSION session, pEp_identity* identity,
   1.322                           bool* exists) {            
   1.323 -    
   1.324 -    // const char* user_id,
   1.325 -    //                      char** default_id, bool* exists) {
   1.326 -    assert(session);
   1.327 -    assert(exists);
   1.328 -    assert(identity);
   1.329 -    assert(!EMPTYSTR(identity->user_id));
   1.330 -        
   1.331 +            
   1.332      if (!session || !exists || !identity || EMPTYSTR(identity->user_id))
   1.333          return PEP_ILLEGAL_VALUE;
   1.334      
   1.335 @@ -3665,8 +3584,7 @@
   1.336  }
   1.337  
   1.338  PEP_STATUS delete_person(PEP_SESSION session, const char* user_id) {
   1.339 -    assert(session);
   1.340 -    assert(!EMPTYSTR(user_id));        
   1.341 +
   1.342      if (!session || EMPTYSTR(user_id))
   1.343          return PEP_ILLEGAL_VALUE;
   1.344          
   1.345 @@ -3687,10 +3605,6 @@
   1.346  
   1.347  DYNAMIC_API PEP_STATUS is_pEp_user(PEP_SESSION session, pEp_identity *identity, bool* is_pEp)
   1.348  {
   1.349 -    assert(session);
   1.350 -    assert(is_pEp);
   1.351 -    assert(identity);
   1.352 -    assert(!EMPTYSTR(identity->user_id));
   1.353  
   1.354      if (!session || !is_pEp || !identity || EMPTYSTR(identity->user_id))
   1.355          return PEP_ILLEGAL_VALUE;
   1.356 @@ -3732,9 +3646,6 @@
   1.357  
   1.358  PEP_STATUS is_own_address(PEP_SESSION session, const char* address, bool* is_own_addr)
   1.359  {
   1.360 -    assert(session);
   1.361 -    assert(is_own_addr);
   1.362 -    assert(!EMPTYSTR(address));
   1.363  
   1.364      if (!session || !is_own_addr || EMPTYSTR(address))
   1.365          return PEP_ILLEGAL_VALUE;
   1.366 @@ -3792,12 +3703,7 @@
   1.367  // since this could be either way
   1.368  PEP_STATUS has_partner_contacted_address(PEP_SESSION session, const char* partner_id,
   1.369                                           const char* own_address, bool* was_contacted) {            
   1.370 -    
   1.371 -    assert(session);
   1.372 -    assert(!EMPTYSTR(partner_id));
   1.373 -    assert(!EMPTYSTR(own_address));    
   1.374 -    assert(was_contacted);
   1.375 -    
   1.376 +        
   1.377      if (!session || !was_contacted || EMPTYSTR(partner_id) || EMPTYSTR(own_address))
   1.378          return PEP_ILLEGAL_VALUE;
   1.379      
   1.380 @@ -3875,7 +3781,6 @@
   1.381  PEP_STATUS remove_fpr_as_default(PEP_SESSION session, 
   1.382                                   const char* fpr) 
   1.383  {
   1.384 -    assert(fpr);
   1.385      
   1.386      if (!session || !fpr)
   1.387          return PEP_ILLEGAL_VALUE;
   1.388 @@ -3908,8 +3813,6 @@
   1.389                                   const char* old_fpr, 
   1.390                                   const char* new_fpr) 
   1.391  {
   1.392 -    assert(old_fpr);
   1.393 -    assert(new_fpr);
   1.394      
   1.395      if (!old_fpr || !new_fpr)
   1.396          return PEP_ILLEGAL_VALUE;
   1.397 @@ -3957,11 +3860,6 @@
   1.398  {
   1.399      int result;
   1.400  
   1.401 -    assert(session);
   1.402 -    assert(identity);
   1.403 -    assert(identity->address);
   1.404 -    assert(identity->user_id);
   1.405 -
   1.406      if (!(session && identity && identity->address && identity->user_id))
   1.407          return PEP_ILLEGAL_VALUE;
   1.408  
   1.409 @@ -3990,11 +3888,6 @@
   1.410  {
   1.411      int result;
   1.412  
   1.413 -    assert(session);
   1.414 -    assert(identity);
   1.415 -    assert(identity->address);
   1.416 -    assert(identity->user_id);
   1.417 -
   1.418      if (!(session && identity && identity->address && identity->user_id))
   1.419          return PEP_ILLEGAL_VALUE;
   1.420  
   1.421 @@ -4022,11 +3915,6 @@
   1.422  {
   1.423      int result;
   1.424  
   1.425 -    assert(session);
   1.426 -    assert(identity);
   1.427 -    assert(identity->address);
   1.428 -    assert(identity->user_id);
   1.429 -
   1.430      if (!(session && identity && identity->address && identity->user_id))
   1.431          return PEP_ILLEGAL_VALUE;
   1.432  
   1.433 @@ -4367,9 +4255,6 @@
   1.434  
   1.435  PEP_STATUS replace_userid(PEP_SESSION session, const char* old_uid,
   1.436                            const char* new_uid) {
   1.437 -    assert(session);
   1.438 -    assert(old_uid);
   1.439 -    assert(new_uid);
   1.440      
   1.441      if (!session || !old_uid || !new_uid)
   1.442          return PEP_ILLEGAL_VALUE;
   1.443 @@ -4406,8 +4291,6 @@
   1.444  }
   1.445  
   1.446  PEP_STATUS remove_key(PEP_SESSION session, const char* fpr) {
   1.447 -    assert(session);
   1.448 -    assert(fpr);
   1.449      
   1.450      if (!session || EMPTYSTR(fpr))
   1.451          return PEP_ILLEGAL_VALUE;
   1.452 @@ -4427,8 +4310,6 @@
   1.453  
   1.454  
   1.455  PEP_STATUS refresh_userid_default_key(PEP_SESSION session, const char* user_id) {
   1.456 -    assert(session);
   1.457 -    assert(user_id);
   1.458      
   1.459      if (!session || !user_id)
   1.460          return PEP_ILLEGAL_VALUE;
   1.461 @@ -4448,9 +4329,6 @@
   1.462  
   1.463  PEP_STATUS replace_main_user_fpr(PEP_SESSION session, const char* user_id,
   1.464                                   const char* new_fpr) {
   1.465 -    assert(session);
   1.466 -    assert(user_id);
   1.467 -    assert(new_fpr);
   1.468      
   1.469      if (!session || !user_id || !new_fpr)
   1.470          return PEP_ILLEGAL_VALUE;
   1.471 @@ -4472,9 +4350,6 @@
   1.472  
   1.473  PEP_STATUS replace_main_user_fpr_if_equal(PEP_SESSION session, const char* user_id,
   1.474                                            const char* new_fpr, const char* compare_fpr) {
   1.475 -    assert(session);
   1.476 -    assert(user_id);
   1.477 -    assert(compare_fpr);
   1.478      
   1.479      if (!session || !user_id || !compare_fpr)
   1.480          return PEP_ILLEGAL_VALUE;
   1.481 @@ -4505,11 +4380,7 @@
   1.482  {
   1.483      PEP_STATUS status = PEP_STATUS_OK;
   1.484      int result;
   1.485 -    
   1.486 -    assert(session);
   1.487 -    assert(user_id);
   1.488 -    assert(main_fpr);
   1.489 -    
   1.490 +        
   1.491      if (!(session && user_id && user_id[0] && main_fpr))
   1.492          return PEP_ILLEGAL_VALUE;
   1.493          
   1.494 @@ -4557,9 +4428,6 @@
   1.495  {
   1.496      int result;
   1.497  
   1.498 -    assert(session);
   1.499 -    assert(fpr && fpr[0]);
   1.500 -
   1.501      if (!(session && fpr && fpr[0]))
   1.502          return PEP_ILLEGAL_VALUE;
   1.503  
   1.504 @@ -4590,15 +4458,6 @@
   1.505      PEP_STATUS status = PEP_STATUS_OK;
   1.506      int result;
   1.507  
   1.508 -    // We need to be able to test that we break correctly without shutting
   1.509 -    // asserts off everywhere.
   1.510 -    // assert(session);
   1.511 -    // assert(identity);
   1.512 -    // assert(identity->user_id);
   1.513 -    // assert(identity->user_id[0]);
   1.514 -    // assert(identity->fpr);
   1.515 -    // assert(identity->fpr[0]);
   1.516 -
   1.517      if (!(session && identity && identity->user_id && identity->user_id[0] &&
   1.518                  identity->fpr && identity->fpr[0]))
   1.519          return PEP_ILLEGAL_VALUE;
   1.520 @@ -4637,10 +4496,6 @@
   1.521      PEP_STATUS status = PEP_STATUS_OK;
   1.522      int result;
   1.523  
   1.524 -    assert(session);
   1.525 -    assert(fpr);
   1.526 -    assert(comm_type);
   1.527 -
   1.528      if (!(session && fpr && comm_type))
   1.529          return PEP_ILLEGAL_VALUE;
   1.530  
   1.531 @@ -4692,12 +4547,6 @@
   1.532      char** filename_ptr
   1.533      )
   1.534  {
   1.535 -    assert(session);
   1.536 -    assert(ctext);
   1.537 -    assert(csize);
   1.538 -    assert(ptext);
   1.539 -    assert(psize);
   1.540 -    assert(keylist);
   1.541  
   1.542      if (!(session && ctext && csize && ptext && psize && keylist))
   1.543          return PEP_ILLEGAL_VALUE;
   1.544 @@ -4720,12 +4569,6 @@
   1.545      size_t psize, char **ctext, size_t *csize
   1.546      )
   1.547  {
   1.548 -    assert(session);
   1.549 -    assert(keylist);
   1.550 -    assert(ptext);
   1.551 -    assert(psize);
   1.552 -    assert(ctext);
   1.553 -    assert(csize);
   1.554  
   1.555      if (!(session && keylist && ptext && psize && ctext && csize))
   1.556          return PEP_ILLEGAL_VALUE;
   1.557 @@ -4739,12 +4582,6 @@
   1.558      size_t psize, char **ctext, size_t *csize
   1.559      )
   1.560  {
   1.561 -    assert(session);
   1.562 -    assert(keylist);
   1.563 -    assert(ptext);
   1.564 -    assert(psize);
   1.565 -    assert(ctext);
   1.566 -    assert(csize);
   1.567  
   1.568      if (!(session && keylist && ptext && psize && ctext && csize))
   1.569          return PEP_ILLEGAL_VALUE;
   1.570 @@ -4759,12 +4596,6 @@
   1.571                       const char *fpr, 
   1.572                       char **sign, 
   1.573                       size_t *sign_size) {
   1.574 -    assert(session);
   1.575 -    assert(fpr);
   1.576 -    assert(data);
   1.577 -    assert(data_size);
   1.578 -    assert(sign);
   1.579 -    assert(sign_size);
   1.580  
   1.581      if (!(session && fpr && data && data_size && sign && sign_size))
   1.582          return PEP_ILLEGAL_VALUE;
   1.583 @@ -4781,12 +4612,6 @@
   1.584      const char *signature, size_t sig_size, stringlist_t **keylist
   1.585      )
   1.586  {
   1.587 -    assert(session);
   1.588 -    assert(text);
   1.589 -    assert(size);
   1.590 -    assert(signature);
   1.591 -    assert(sig_size);
   1.592 -    assert(keylist);
   1.593  
   1.594      if (!(session && text && size && signature && sig_size && keylist))
   1.595          return PEP_ILLEGAL_VALUE;
   1.596 @@ -4797,8 +4622,6 @@
   1.597  
   1.598  DYNAMIC_API PEP_STATUS delete_keypair(PEP_SESSION session, const char *fpr)
   1.599  {
   1.600 -    assert(session);
   1.601 -    assert(fpr);
   1.602  
   1.603      if (!(session && fpr))
   1.604          return PEP_ILLEGAL_VALUE;
   1.605 @@ -4810,10 +4633,6 @@
   1.606          PEP_SESSION session, const char *fpr, char **key_data, size_t *size
   1.607      )
   1.608  {
   1.609 -    assert(session);
   1.610 -    assert(fpr);
   1.611 -    assert(key_data);
   1.612 -    assert(size);
   1.613  
   1.614      if (!(session && fpr && key_data && size))
   1.615          return PEP_ILLEGAL_VALUE;
   1.616 @@ -4826,11 +4645,6 @@
   1.617          PEP_SESSION session, const char *fpr, char **key_data, size_t *size
   1.618      )
   1.619  {
   1.620 -    assert(session);
   1.621 -    assert(fpr);
   1.622 -    assert(key_data);
   1.623 -    assert(size);
   1.624 -
   1.625      if (!(session && fpr && key_data && size))
   1.626          return PEP_ILLEGAL_VALUE;
   1.627  
   1.628 @@ -4854,10 +4668,6 @@
   1.629          PEP_SESSION session, const char *pattern, stringlist_t **keylist
   1.630      )
   1.631  {
   1.632 -    assert(session);
   1.633 -    assert(pattern);
   1.634 -    assert(keylist);
   1.635 -
   1.636      if (!(session && pattern && keylist))
   1.637          return PEP_ILLEGAL_VALUE;
   1.638  
   1.639 @@ -4878,11 +4688,6 @@
   1.640                               bool suppress_event
   1.641      )
   1.642  {
   1.643 -    assert(session);
   1.644 -    assert(identity);
   1.645 -    assert(identity->address);
   1.646 -    assert(identity->fpr == NULL || identity->fpr[0] == 0);
   1.647 -//    assert(identity->username);
   1.648      // N.B. We now allow empty usernames, so the underlying layer for 
   1.649      // non-sequoia crypto implementations will have to deal with this.
   1.650  
   1.651 @@ -4941,10 +4746,6 @@
   1.652          PEP_comm_type *comm_type
   1.653      )
   1.654  {
   1.655 -    assert(session);
   1.656 -    assert(fpr);
   1.657 -    assert(comm_type);
   1.658 -
   1.659      if (!(session && fpr && comm_type))
   1.660          return PEP_ILLEGAL_VALUE;
   1.661  
   1.662 @@ -4970,9 +4771,6 @@
   1.663          uint64_t* changed_public_keys        
   1.664      )
   1.665  {
   1.666 -    assert(session);
   1.667 -    assert(key_data);
   1.668 -
   1.669      if (!(session && key_data))
   1.670          return PEP_ILLEGAL_VALUE;
   1.671          
   1.672 @@ -4984,10 +4782,7 @@
   1.673  }
   1.674  
   1.675  DYNAMIC_API PEP_STATUS recv_key(PEP_SESSION session, const char *pattern)
   1.676 -{
   1.677 -    assert(session);
   1.678 -    assert(pattern);
   1.679 -
   1.680 +{   
   1.681      if (!(session && pattern))
   1.682          return PEP_ILLEGAL_VALUE;
   1.683  
   1.684 @@ -4996,9 +4791,6 @@
   1.685  
   1.686  DYNAMIC_API PEP_STATUS send_key(PEP_SESSION session, const char *pattern)
   1.687  {
   1.688 -    assert(session);
   1.689 -    assert(pattern);
   1.690 -
   1.691      if (!(session && pattern))
   1.692          return PEP_ILLEGAL_VALUE;
   1.693  
   1.694 @@ -5011,9 +4803,6 @@
   1.695          const timestamp *ts
   1.696      )
   1.697  {
   1.698 -    assert(session);
   1.699 -    assert(fpr);
   1.700 -
   1.701      if (!(session && fpr))
   1.702          return PEP_ILLEGAL_VALUE;
   1.703  
   1.704 @@ -5026,9 +4815,6 @@
   1.705          const char *reason
   1.706      )
   1.707  {
   1.708 -    assert(session);
   1.709 -    assert(fpr);
   1.710 -
   1.711      if (!(session && fpr))
   1.712          return PEP_ILLEGAL_VALUE;
   1.713  
   1.714 @@ -5052,10 +4838,6 @@
   1.715          bool *expired
   1.716      )
   1.717  {
   1.718 -    assert(session);
   1.719 -    assert(fpr);
   1.720 -    assert(expired);
   1.721 -
   1.722      if (!(session && fpr && expired))
   1.723          return PEP_ILLEGAL_VALUE;
   1.724  
   1.725 @@ -5068,11 +4850,7 @@
   1.726         const char *fpr,
   1.727         bool *revoked
   1.728     )
   1.729 -{
   1.730 -    assert(session);
   1.731 -    assert(fpr);
   1.732 -    assert(revoked);
   1.733 -    
   1.734 +{    
   1.735      if (!(session && fpr && revoked))
   1.736          return PEP_ILLEGAL_VALUE;
   1.737      
   1.738 @@ -5083,7 +4861,6 @@
   1.739  DYNAMIC_API PEP_STATUS config_cipher_suite(PEP_SESSION session,
   1.740          PEP_CIPHER_SUITE suite)
   1.741  {
   1.742 -    assert(session);
   1.743      if (!session)
   1.744          return PEP_ILLEGAL_VALUE;
   1.745  
   1.746 @@ -5133,10 +4910,6 @@
   1.747      PEP_STATUS status = PEP_STATUS_OK;
   1.748      char *_logdata= NULL;
   1.749  
   1.750 -    assert(session);
   1.751 -    assert(maxlines >= 0 && maxlines <= CRASHDUMP_MAX_LINES);
   1.752 -    assert(logdata);
   1.753 -
   1.754      if (!(session && logdata && maxlines >= 0 && maxlines <=
   1.755              CRASHDUMP_MAX_LINES))
   1.756          return PEP_ILLEGAL_VALUE;
   1.757 @@ -5231,9 +5004,6 @@
   1.758      PEP_STATUS status = PEP_STATUS_OK;
   1.759      char *_languages= NULL;
   1.760  
   1.761 -    assert(session);
   1.762 -    assert(languages);
   1.763 -
   1.764      if (!(session && languages))
   1.765          return PEP_ILLEGAL_VALUE;
   1.766  
   1.767 @@ -5303,7 +5073,6 @@
   1.768  {
   1.769      PEP_STATUS status = PEP_STATUS_OK;
   1.770  
   1.771 -    assert(session && lang && lang[0] && lang[1] && lang[2] == 0 && phrase);
   1.772      if (!(session && lang && lang[0] && lang[1] && lang[2] == 0 && phrase))
   1.773          return PEP_ILLEGAL_VALUE;
   1.774  
   1.775 @@ -5349,7 +5118,6 @@
   1.776  static PEP_STATUS _get_sequence_value(PEP_SESSION session, const char *name,
   1.777          int32_t *value)
   1.778  {
   1.779 -    assert(session && name && value);
   1.780      if (!(session && name && value))
   1.781          return PEP_ILLEGAL_VALUE;
   1.782  
   1.783 @@ -5380,7 +5148,6 @@
   1.784  static PEP_STATUS _increment_sequence_value(PEP_SESSION session,
   1.785          const char *name)
   1.786  {
   1.787 -    assert(session && name);
   1.788      if (!(session && name))
   1.789          return PEP_ILLEGAL_VALUE;
   1.790  
   1.791 @@ -5403,9 +5170,6 @@
   1.792  {
   1.793      PEP_STATUS status = PEP_STATUS_OK;
   1.794  
   1.795 -    assert(session);
   1.796 -    assert(name && value);
   1.797 -
   1.798      if (!(session && name && name[0] && value))
   1.799          return PEP_ILLEGAL_VALUE;
   1.800  
   1.801 @@ -5468,12 +5232,7 @@
   1.802      )
   1.803  {
   1.804      PEP_STATUS status = PEP_STATUS_OK;
   1.805 -    
   1.806 -    assert(session &&
   1.807 -           revoked_fpr && revoked_fpr[0] &&
   1.808 -           replacement_fpr && replacement_fpr[0]
   1.809 -          );
   1.810 -    
   1.811 +        
   1.812      if (!(session &&
   1.813            revoked_fpr && revoked_fpr[0] &&
   1.814            replacement_fpr && replacement_fpr[0]
   1.815 @@ -5510,16 +5269,8 @@
   1.816      )
   1.817  {
   1.818      PEP_STATUS status = PEP_STATUS_OK;
   1.819 -
   1.820 -    assert(session &&
   1.821 -           revoked_fpr &&
   1.822 -           fpr && fpr[0]
   1.823 -          );
   1.824 -    
   1.825 -    if (!(session &&
   1.826 -           revoked_fpr &&
   1.827 -           fpr && fpr[0]
   1.828 -          ))
   1.829 +   
   1.830 +    if (!(session && revoked_fpr && fpr && fpr[0]))
   1.831          return PEP_ILLEGAL_VALUE;
   1.832  
   1.833      *revoked_fpr = NULL;
   1.834 @@ -5560,8 +5311,6 @@
   1.835      )
   1.836  {
   1.837      PEP_STATUS status = PEP_STATUS_OK;
   1.838 -
   1.839 -    assert(session && revoked_fpr && !EMPTYSTR(fpr) && revocation_date);
   1.840      
   1.841      if (!session || !revoked_fpr || EMPTYSTR(fpr) || !revocation_date)
   1.842          return PEP_ILLEGAL_VALUE;
   1.843 @@ -5601,9 +5350,6 @@
   1.844          identity_list** id_list
   1.845      )
   1.846  {
   1.847 -    assert(session);
   1.848 -    assert(id_list);
   1.849 -
   1.850      if (!(session && id_list))
   1.851          return PEP_ILLEGAL_VALUE;
   1.852  
   1.853 @@ -5649,7 +5395,6 @@
   1.854          time_t *created
   1.855      )
   1.856  {
   1.857 -    assert(session && fpr && created);
   1.858      if (!(session && fpr && created))
   1.859          return PEP_ILLEGAL_VALUE;
   1.860  
   1.861 @@ -5659,7 +5404,6 @@
   1.862  
   1.863  PEP_STATUS find_private_keys(PEP_SESSION session, const char* pattern,
   1.864                               stringlist_t **keylist) {
   1.865 -    assert(session && keylist);
   1.866      if (!(session && keylist))
   1.867          return PEP_ILLEGAL_VALUE;
   1.868      
   1.869 @@ -5678,7 +5422,6 @@
   1.870  
   1.871  DYNAMIC_API PEP_STATUS reset_pEptest_hack(PEP_SESSION session)
   1.872  {
   1.873 -    assert(session);
   1.874  
   1.875      if (!session)
   1.876          return PEP_ILLEGAL_VALUE;