gnupg_initialize_compliance:
   82|      1|{
   83|      1|  log_assert (! initialized);
   84|       |
   85|       |  /* We accept both OpenPGP-style and gcrypt-style algorithm ids.
   86|       |   * Assert that they are compatible.  */
   87|      0|  log_assert ((int) GCRY_PK_RSA          == (int) PUBKEY_ALGO_RSA);
   88|      0|  log_assert ((int) GCRY_PK_RSA_E        == (int) PUBKEY_ALGO_RSA_E);
   89|      0|  log_assert ((int) GCRY_PK_RSA_S        == (int) PUBKEY_ALGO_RSA_S);
   90|      0|  log_assert ((int) GCRY_PK_ELG_E        == (int) PUBKEY_ALGO_ELGAMAL_E);
   91|      0|  log_assert ((int) GCRY_PK_DSA          == (int) PUBKEY_ALGO_DSA);
   92|      0|  log_assert ((int) GCRY_PK_ECC          == (int) PUBKEY_ALGO_ECDH);
   93|      0|  log_assert ((int) GCRY_PK_ELG          == (int) PUBKEY_ALGO_ELGAMAL);
   94|      0|  log_assert ((int) GCRY_CIPHER_NONE     == (int) CIPHER_ALGO_NONE);
   95|      0|  log_assert ((int) GCRY_CIPHER_IDEA     == (int) CIPHER_ALGO_IDEA);
   96|      0|  log_assert ((int) GCRY_CIPHER_3DES     == (int) CIPHER_ALGO_3DES);
   97|      0|  log_assert ((int) GCRY_CIPHER_CAST5    == (int) CIPHER_ALGO_CAST5);
   98|      0|  log_assert ((int) GCRY_CIPHER_BLOWFISH == (int) CIPHER_ALGO_BLOWFISH);
   99|      0|  log_assert ((int) GCRY_CIPHER_AES      == (int) CIPHER_ALGO_AES);
  100|      0|  log_assert ((int) GCRY_CIPHER_AES192   == (int) CIPHER_ALGO_AES192);
  101|      0|  log_assert ((int) GCRY_CIPHER_AES256   == (int) CIPHER_ALGO_AES256);
  102|      0|  log_assert ((int) GCRY_CIPHER_TWOFISH  == (int) CIPHER_ALGO_TWOFISH);
  103|      0|  log_assert ((int) GCRY_MD_MD5          == (int) DIGEST_ALGO_MD5);
  104|      0|  log_assert ((int) GCRY_MD_SHA1         == (int) DIGEST_ALGO_SHA1);
  105|      0|  log_assert ((int) GCRY_MD_RMD160       == (int) DIGEST_ALGO_RMD160);
  106|      0|  log_assert ((int) GCRY_MD_SHA256       == (int) DIGEST_ALGO_SHA256);
  107|      0|  log_assert ((int) GCRY_MD_SHA384       == (int) DIGEST_ALGO_SHA384);
  108|      0|  log_assert ((int) GCRY_MD_SHA512       == (int) DIGEST_ALGO_SHA512);
  109|      0|  log_assert ((int) GCRY_MD_SHA224       == (int) DIGEST_ALGO_SHA224);
  110|       |
  111|      0|  switch (gnupg_module_name)
  112|      1|    {
  113|      0|    case GNUPG_MODULE_NAME_GPGSM:
  ------------------
  |  |  292|      0|#define GNUPG_MODULE_NAME_GPGSM         7
  ------------------
  |  Branch (113:5): [True: 0, False: 1]
  ------------------
  114|      1|    case GNUPG_MODULE_NAME_GPG:
  ------------------
  |  |  293|      1|#define GNUPG_MODULE_NAME_GPG           8
  ------------------
  |  Branch (114:5): [True: 1, False: 0]
  ------------------
  115|      1|      break;
  116|       |
  117|      0|    default:
  ------------------
  |  Branch (117:5): [True: 0, False: 1]
  ------------------
  118|      0|      log_assert (!"no policies for this module");
  119|      1|    }
  120|       |
  121|      1|  module = gnupg_module_name;
  122|      1|  initialized = 1;
  123|      1|}
gnupg_digest_is_allowed:
  495|  16.2k|{
  496|  16.2k|  if (! initialized)
  ------------------
  |  Branch (496:7): [True: 0, False: 16.2k]
  ------------------
  497|      0|    return 1;
  498|       |
  499|  16.2k|  switch (compliance)
  500|  16.2k|    {
  501|      0|    case CO_DE_VS:
  ------------------
  |  Branch (501:5): [True: 0, False: 16.2k]
  ------------------
  502|      0|      switch (digest)
  503|      0|	{
  504|      0|	case DIGEST_ALGO_SHA256:
  ------------------
  |  Branch (504:2): [True: 0, False: 0]
  ------------------
  505|      0|	case DIGEST_ALGO_SHA384:
  ------------------
  |  Branch (505:2): [True: 0, False: 0]
  ------------------
  506|      0|	case DIGEST_ALGO_SHA512:
  ------------------
  |  Branch (506:2): [True: 0, False: 0]
  ------------------
  507|      0|	  return 1;
  508|      0|	case DIGEST_ALGO_SHA1:
  ------------------
  |  Branch (508:2): [True: 0, False: 0]
  ------------------
  509|      0|	case DIGEST_ALGO_SHA224:
  ------------------
  |  Branch (509:2): [True: 0, False: 0]
  ------------------
  510|      0|	case DIGEST_ALGO_RMD160:
  ------------------
  |  Branch (510:2): [True: 0, False: 0]
  ------------------
  511|      0|	  return ! producer;
  512|      0|	case DIGEST_ALGO_MD5:
  ------------------
  |  Branch (512:2): [True: 0, False: 0]
  ------------------
  513|      0|	  return ! producer && module == GNUPG_MODULE_NAME_GPGSM;
  ------------------
  |  |  292|      0|#define GNUPG_MODULE_NAME_GPGSM         7
  ------------------
  |  Branch (513:11): [True: 0, False: 0]
  |  Branch (513:25): [True: 0, False: 0]
  ------------------
  514|      0|	default:
  ------------------
  |  Branch (514:2): [True: 0, False: 0]
  ------------------
  515|      0|	  return 0;
  516|      0|	}
  517|      0|      log_assert (!"reached");
  518|       |
  519|  16.2k|    default:
  ------------------
  |  Branch (519:5): [True: 16.2k, False: 0]
  ------------------
  520|       |      /* The default policy is to allow all algorithms.  */
  521|  16.2k|      return 1;
  522|  16.2k|    }
  523|       |
  524|      0|  log_assert (!"reached");
  525|      0|}

bin2hex:
  158|  4.25k|{
  159|  4.25k|  return do_bin2hex (buffer, length, stringbuf, 0);
  160|  4.25k|}
convert.c:do_bin2hex:
  117|  4.25k|{
  118|  4.25k|  const unsigned char *s;
  119|  4.25k|  char *p;
  120|       |
  121|  4.25k|  if (!stringbuf)
  ------------------
  |  Branch (121:7): [True: 4.25k, False: 0]
  ------------------
  122|  4.25k|    {
  123|       |      /* Not really correct for with_colon but we don't care about the
  124|       |         one wasted byte. */
  125|  4.25k|      size_t n = with_colon? 3:2;
  ------------------
  |  Branch (125:18): [True: 0, False: 4.25k]
  ------------------
  126|  4.25k|      size_t nbytes = n * length + 1;
  127|  4.25k|      if (length &&  (nbytes-1) / n != length)
  ------------------
  |  Branch (127:11): [True: 4.25k, False: 0]
  |  Branch (127:22): [True: 0, False: 4.25k]
  ------------------
  128|      0|        {
  129|      0|          gpg_err_set_errno (ENOMEM);
  130|      0|          return NULL;
  131|      0|        }
  132|  4.25k|      stringbuf = xtrymalloc (nbytes);
  ------------------
  |  |   97|  4.25k|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  133|  4.25k|      if (!stringbuf)
  ------------------
  |  Branch (133:11): [True: 0, False: 4.25k]
  ------------------
  134|      0|        return NULL;
  135|  4.25k|    }
  136|       |
  137|   114k|  for (s = buffer, p = stringbuf; length; length--, s++)
  ------------------
  |  Branch (137:35): [True: 110k, False: 4.25k]
  ------------------
  138|   110k|    {
  139|   110k|      if (with_colon && s != buffer)
  ------------------
  |  Branch (139:11): [True: 0, False: 110k]
  |  Branch (139:25): [True: 0, False: 0]
  ------------------
  140|      0|        *p++ = ':';
  141|   110k|      *p++ = tohex ((*s>>4)&15);
  ------------------
  |  |   38|   110k|#define tohex(n) ((n) < 10 ? ((n) + '0') : (((n) - 10) + 'A'))
  |  |  ------------------
  |  |  |  Branch (38:19): [True: 86.8k, False: 23.4k]
  |  |  ------------------
  ------------------
  142|   110k|      *p++ = tohex (*s&15);
  ------------------
  |  |   38|   110k|#define tohex(n) ((n) < 10 ? ((n) + '0') : (((n) - 10) + 'A'))
  |  |  ------------------
  |  |  |  Branch (38:19): [True: 74.4k, False: 35.8k]
  |  |  ------------------
  ------------------
  143|   110k|    }
  144|  4.25k|  *p = 0;
  145|       |
  146|  4.25k|  return stringbuf;
  147|  4.25k|}

dotlock_create:
  885|      3|{
  886|      3|  static int initialized;
  887|      3|  dotlock_t h;
  888|       |
  889|      3|  if ( !initialized )
  ------------------
  |  Branch (889:8): [True: 1, False: 2]
  ------------------
  890|      1|    {
  891|      1|      atexit (dotlock_remove_lockfiles);
  892|      1|      initialized = 1;
  893|      1|    }
  894|       |
  895|      3|  if ( !file_to_lock )
  ------------------
  |  Branch (895:8): [True: 0, False: 3]
  ------------------
  896|      0|    return NULL;  /* Only initialization was requested.  */
  897|       |
  898|      3|  if (flags)
  ------------------
  |  Branch (898:7): [True: 0, False: 3]
  ------------------
  899|      0|    {
  900|      0|      my_set_errno (EINVAL);
  ------------------
  |  |  341|      0|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
  901|      0|      return NULL;
  902|      0|    }
  903|       |
  904|      3|  h = xtrycalloc (1, sizeof *h);
  ------------------
  |  |   99|      3|#define xtrycalloc(a,b)  gcry_calloc ((a),(b))
  ------------------
  905|      3|  if (!h)
  ------------------
  |  Branch (905:7): [True: 0, False: 3]
  ------------------
  906|      0|    return NULL;
  907|      3|  h->extra_fd = -1;
  908|       |
  909|      3|  if (never_lock)
  ------------------
  |  Branch (909:7): [True: 0, False: 3]
  ------------------
  910|      0|    {
  911|      0|      h->disable = 1;
  912|      0|      LOCK_all_lockfiles ();
  ------------------
  |  |  424|      0|# define LOCK_all_lockfiles()   do { } while (0)
  |  |  ------------------
  |  |  |  Branch (424:47): [Folded - Ignored]
  |  |  ------------------
  ------------------
  913|      0|      h->next = all_lockfiles;
  914|      0|      all_lockfiles = h;
  915|      0|      UNLOCK_all_lockfiles ();
  ------------------
  |  |  425|      0|# define UNLOCK_all_lockfiles() do { } while (0)
  |  |  ------------------
  |  |  |  Branch (425:47): [Folded - Ignored]
  |  |  ------------------
  ------------------
  916|      0|      return h;
  917|      0|    }
  918|       |
  919|       |#ifdef HAVE_DOSISH_SYSTEM
  920|       |  return dotlock_create_w32 (h, file_to_lock);
  921|       |#else /*!HAVE_DOSISH_SYSTEM */
  922|      3|  return dotlock_create_unix (h, file_to_lock);
  923|      3|#endif /*!HAVE_DOSISH_SYSTEM*/
  924|      3|}
dotlock_destroy:
  980|      3|{
  981|      3|  dotlock_t hprev, htmp;
  982|       |
  983|      3|  if ( !h )
  ------------------
  |  Branch (983:8): [True: 0, False: 3]
  ------------------
  984|      0|    return;
  985|       |
  986|       |  /* First remove the handle from our global list of all locks. */
  987|      3|  LOCK_all_lockfiles ();
  ------------------
  |  |  424|      3|# define LOCK_all_lockfiles()   do { } while (0)
  |  |  ------------------
  |  |  |  Branch (424:47): [Folded - Ignored]
  |  |  ------------------
  ------------------
  988|      3|  for (hprev=NULL, htmp=all_lockfiles; htmp; hprev=htmp, htmp=htmp->next)
  ------------------
  |  Branch (988:40): [True: 1, False: 2]
  ------------------
  989|      1|    if (htmp == h)
  ------------------
  |  Branch (989:9): [True: 1, False: 0]
  ------------------
  990|      1|      {
  991|      1|        if (hprev)
  ------------------
  |  Branch (991:13): [True: 0, False: 1]
  ------------------
  992|      0|          hprev->next = htmp->next;
  993|      1|        else
  994|      1|          all_lockfiles = htmp->next;
  995|      1|        h->next = NULL;
  996|      1|        break;
  997|      1|      }
  998|      3|  UNLOCK_all_lockfiles ();
  ------------------
  |  |  425|      3|# define UNLOCK_all_lockfiles() do { } while (0)
  |  |  ------------------
  |  |  |  Branch (425:47): [Folded - Ignored]
  |  |  ------------------
  ------------------
  999|       |
 1000|       |  /* Then destroy the lock. */
 1001|      3|  if (!h->disable)
  ------------------
  |  Branch (1001:7): [True: 3, False: 0]
  ------------------
 1002|      3|    {
 1003|       |#ifdef HAVE_DOSISH_SYSTEM
 1004|       |      dotlock_destroy_w32 (h);
 1005|       |#else /* !HAVE_DOSISH_SYSTEM */
 1006|      3|      dotlock_destroy_unix (h);
 1007|      3|#endif /* HAVE_DOSISH_SYSTEM */
 1008|      3|      xfree (h->lockname);
  ------------------
  |  |  104|      3|#define xfree(a)         gcry_free ((a))
  ------------------
 1009|      3|    }
 1010|      3|  xfree(h);
  ------------------
  |  |  104|      3|#define xfree(a)         gcry_free ((a))
  ------------------
 1011|      3|}
dotlock_take:
 1281|      3|{
 1282|      3|  int ret;
 1283|       |
 1284|      3|  if ( h->disable )
  ------------------
  |  Branch (1284:8): [True: 0, False: 3]
  ------------------
 1285|      0|    return 0; /* Locks are completely disabled.  Return success. */
 1286|       |
 1287|      3|  if ( h->locked )
  ------------------
  |  Branch (1287:8): [True: 0, False: 3]
  ------------------
 1288|      0|    {
 1289|      0|      my_debug_1 ("Oops, '%s' is already locked\n", h->lockname);
  ------------------
  |  |  359|      0|# define my_debug_1(a,b)    log_debug ((a), (b))
  ------------------
 1290|      0|      return 0;
 1291|      0|    }
 1292|       |
 1293|       |#ifdef HAVE_DOSISH_SYSTEM
 1294|       |  ret = dotlock_take_w32 (h, timeout);
 1295|       |#else /*!HAVE_DOSISH_SYSTEM*/
 1296|      3|  ret = dotlock_take_unix (h, timeout);
 1297|      3|#endif /*!HAVE_DOSISH_SYSTEM*/
 1298|       |
 1299|      3|  return ret;
 1300|      3|}
dotlock_release:
 1367|      3|{
 1368|      3|  int ret;
 1369|       |
 1370|       |  /* To avoid atexit race conditions we first check whether there are
 1371|       |     any locks left.  It might happen that another atexit handler
 1372|       |     tries to release the lock while the atexit handler of this module
 1373|       |     already ran and thus H is undefined.  */
 1374|      3|  LOCK_all_lockfiles ();
  ------------------
  |  |  424|      3|# define LOCK_all_lockfiles()   do { } while (0)
  |  |  ------------------
  |  |  |  Branch (424:47): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1375|      3|  ret = !all_lockfiles;
 1376|      3|  UNLOCK_all_lockfiles ();
  ------------------
  |  |  425|      3|# define UNLOCK_all_lockfiles() do { } while (0)
  |  |  ------------------
  |  |  |  Branch (425:47): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1377|      3|  if (ret)
  ------------------
  |  Branch (1377:7): [True: 0, False: 3]
  ------------------
 1378|      0|    return 0;
 1379|       |
 1380|      3|  if ( h->disable )
  ------------------
  |  Branch (1380:8): [True: 0, False: 3]
  ------------------
 1381|      0|    return 0;
 1382|       |
 1383|      3|  if ( !h->locked )
  ------------------
  |  Branch (1383:8): [True: 0, False: 3]
  ------------------
 1384|      0|    {
 1385|      0|      my_debug_1 ("Oops, '%s' is not locked\n", h->lockname);
  ------------------
  |  |  359|      0|# define my_debug_1(a,b)    log_debug ((a), (b))
  ------------------
 1386|      0|      return 0;
 1387|      0|    }
 1388|       |
 1389|       |#ifdef HAVE_DOSISH_SYSTEM
 1390|       |  ret = dotlock_release_w32 (h);
 1391|       |#else
 1392|      3|  ret = dotlock_release_unix (h);
 1393|      3|#endif
 1394|       |
 1395|      3|  if (!ret)
  ------------------
  |  Branch (1395:7): [True: 3, False: 0]
  ------------------
 1396|      3|    h->locked = 0;
 1397|      3|  return ret;
 1398|      3|}
dotlock_remove_lockfiles:
 1407|      1|{
 1408|      1|  dotlock_t h, h2;
 1409|       |
 1410|       |  /* First set the lockfiles list to NULL so that for example
 1411|       |     dotlock_release is aware that this function is currently
 1412|       |     running.  */
 1413|      1|  LOCK_all_lockfiles ();
  ------------------
  |  |  424|      1|# define LOCK_all_lockfiles()   do { } while (0)
  |  |  ------------------
  |  |  |  Branch (424:47): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1414|      1|  h = all_lockfiles;
 1415|      1|  all_lockfiles = NULL;
 1416|      1|  UNLOCK_all_lockfiles ();
  ------------------
  |  |  425|      1|# define UNLOCK_all_lockfiles() do { } while (0)
  |  |  ------------------
  |  |  |  Branch (425:47): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1417|       |
 1418|      3|  while ( h )
  ------------------
  |  Branch (1418:11): [True: 2, False: 1]
  ------------------
 1419|      2|    {
 1420|      2|      h2 = h->next;
 1421|      2|      dotlock_destroy (h);
 1422|      2|      h = h2;
 1423|      2|    }
 1424|      1|}
dotlock.c:dotlock_create_unix:
  662|      3|{
  663|      3|  int  fd = -1;
  664|      3|  char pidstr[16];
  665|      3|  const char *nodename;
  666|      3|  const char *dirpart;
  667|      3|  int dirpartlen;
  668|      3|  struct utsname utsbuf;
  669|      3|  size_t tnamelen;
  670|       |
  671|      3|  snprintf (pidstr, sizeof pidstr, "%10d\n", (int)getpid() );
  ------------------
  |  |   84|      3|#define snprintf gpgrt_snprintf
  ------------------
  672|       |
  673|       |  /* Create a temporary file. */
  674|      3|  if ( uname ( &utsbuf ) )
  ------------------
  |  Branch (674:8): [True: 0, False: 3]
  ------------------
  675|      0|    nodename = "unknown";
  676|      3|  else
  677|      3|    nodename = utsbuf.nodename;
  678|       |
  679|      3|  if ( !(dirpart = strrchr (file_to_lock, DIRSEP_C)) )
  ------------------
  |  |  886|      3|#define DIRSEP_C '/'
  ------------------
  |  Branch (679:8): [True: 0, False: 3]
  ------------------
  680|      0|    {
  681|      0|      dirpart = EXTSEP_S;
  ------------------
  |  |  889|      0|#define EXTSEP_S "."
  ------------------
  682|      0|      dirpartlen = 1;
  683|      0|    }
  684|      3|  else
  685|      3|    {
  686|      3|      dirpartlen = dirpart - file_to_lock;
  687|      3|      dirpart = file_to_lock;
  688|      3|    }
  689|       |
  690|      3|  LOCK_all_lockfiles ();
  ------------------
  |  |  424|      3|# define LOCK_all_lockfiles()   do { } while (0)
  |  |  ------------------
  |  |  |  Branch (424:47): [Folded - Ignored]
  |  |  ------------------
  ------------------
  691|      3|  h->next = all_lockfiles;
  692|      3|  all_lockfiles = h;
  693|       |
  694|      3|  tnamelen = dirpartlen + 6 + 30 + strlen(nodename) + 10 + 1;
  695|      3|  h->tname = xtrymalloc (tnamelen + 1);
  ------------------
  |  |   97|      3|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  696|      3|  if (!h->tname)
  ------------------
  |  Branch (696:7): [True: 0, False: 3]
  ------------------
  697|      0|    {
  698|      0|      all_lockfiles = h->next;
  699|      0|      UNLOCK_all_lockfiles ();
  ------------------
  |  |  425|      0|# define UNLOCK_all_lockfiles() do { } while (0)
  |  |  ------------------
  |  |  |  Branch (425:47): [Folded - Ignored]
  |  |  ------------------
  ------------------
  700|      0|      xfree (h);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  701|      0|      return NULL;
  702|      0|    }
  703|      3|  h->nodename_len = strlen (nodename);
  704|       |
  705|      3|  snprintf (h->tname, tnamelen, "%.*s/.#lk%p.", dirpartlen, dirpart, h );
  ------------------
  |  |   84|      3|#define snprintf gpgrt_snprintf
  ------------------
  706|      3|  h->nodename_off = strlen (h->tname);
  707|      3|  snprintf (h->tname+h->nodename_off, tnamelen - h->nodename_off,
  ------------------
  |  |   84|      3|#define snprintf gpgrt_snprintf
  ------------------
  708|      3|           "%s.%d", nodename, (int)getpid ());
  709|       |
  710|      3|  do
  711|      3|    {
  712|      3|      my_set_errno (0);
  ------------------
  |  |  341|      3|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
  713|      3|      fd = open (h->tname, O_WRONLY|O_CREAT|O_EXCL,
  714|      3|                 S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR );
  715|      3|    }
  716|      3|  while (fd == -1 && errno == EINTR);
  ------------------
  |  Branch (716:10): [True: 0, False: 3]
  |  Branch (716:22): [True: 0, False: 0]
  ------------------
  717|       |
  718|      3|  if ( fd == -1 )
  ------------------
  |  Branch (718:8): [True: 0, False: 3]
  ------------------
  719|      0|    {
  720|      0|      int saveerrno = errno;
  721|      0|      all_lockfiles = h->next;
  722|      0|      UNLOCK_all_lockfiles ();
  ------------------
  |  |  425|      0|# define UNLOCK_all_lockfiles() do { } while (0)
  |  |  ------------------
  |  |  |  Branch (425:47): [Folded - Ignored]
  |  |  ------------------
  ------------------
  723|      0|      my_error_2 (_("failed to create temporary file '%s': %s\n"),
  ------------------
  |  |  358|      0|# define my_error_2(a,b,c)  log_error ((a), (b), (c))
  ------------------
  724|      0|                  h->tname, strerror (errno));
  725|      0|      xfree (h->tname);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  726|      0|      xfree (h);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  727|      0|      my_set_errno (saveerrno);
  ------------------
  |  |  341|      0|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
  728|      0|      return NULL;
  729|      0|    }
  730|      3|  if ( write (fd, pidstr, 11 ) != 11 )
  ------------------
  |  Branch (730:8): [True: 0, False: 3]
  ------------------
  731|      0|    goto write_failed;
  732|      3|  if ( write (fd, nodename, strlen (nodename) ) != strlen (nodename) )
  ------------------
  |  Branch (732:8): [True: 0, False: 3]
  ------------------
  733|      0|    goto write_failed;
  734|      3|  if ( write (fd, "\n", 1 ) != 1 )
  ------------------
  |  Branch (734:8): [True: 0, False: 3]
  ------------------
  735|      0|    goto write_failed;
  736|      3|  if ( close (fd) )
  ------------------
  |  Branch (736:8): [True: 0, False: 3]
  ------------------
  737|      0|    {
  738|      0|      if ( errno == EINTR )
  ------------------
  |  Branch (738:12): [True: 0, False: 0]
  ------------------
  739|      0|        fd = -1;
  740|      0|      goto write_failed;
  741|      0|    }
  742|      3|  fd = -1;
  743|       |
  744|       |  /* Check whether we support hard links.  */
  745|      3|  switch (use_hardlinks_p (h->tname))
  746|      3|    {
  747|      3|    case 0: /* Yes.  */
  ------------------
  |  Branch (747:5): [True: 3, False: 0]
  ------------------
  748|      3|      break;
  749|      0|    case 1: /* No.  */
  ------------------
  |  Branch (749:5): [True: 0, False: 3]
  ------------------
  750|      0|      unlink (h->tname);
  751|      0|      h->use_o_excl = 1;
  752|      0|      break;
  753|      0|    default:
  ------------------
  |  Branch (753:5): [True: 0, False: 3]
  ------------------
  754|      0|      {
  755|      0|        int saveerrno = errno;
  756|      0|        my_error_2 ("can't check whether hardlinks are supported for '%s': %s\n"
  ------------------
  |  |  358|      0|# define my_error_2(a,b,c)  log_error ((a), (b), (c))
  ------------------
  757|      0|                    , h->tname, strerror (saveerrno));
  758|      0|        my_set_errno (saveerrno);
  ------------------
  |  |  341|      0|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
  759|      0|      }
  760|      0|      goto write_failed;
  761|      3|    }
  762|       |
  763|      3|  h->lockname = xtrymalloc (strlen (file_to_lock) + 6 );
  ------------------
  |  |   97|      3|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  764|      3|  if (!h->lockname)
  ------------------
  |  Branch (764:7): [True: 0, False: 3]
  ------------------
  765|      0|    {
  766|      0|      int saveerrno = errno;
  767|      0|      all_lockfiles = h->next;
  768|      0|      UNLOCK_all_lockfiles ();
  ------------------
  |  |  425|      0|# define UNLOCK_all_lockfiles() do { } while (0)
  |  |  ------------------
  |  |  |  Branch (425:47): [Folded - Ignored]
  |  |  ------------------
  ------------------
  769|      0|      unlink (h->tname);
  770|      0|      xfree (h->tname);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  771|      0|      xfree (h);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  772|      0|      my_set_errno (saveerrno);
  ------------------
  |  |  341|      0|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
  773|      0|      return NULL;
  774|      0|    }
  775|      3|  strcpy (stpcpy (h->lockname, file_to_lock), EXTSEP_S "lock");
  ------------------
  |  |  889|      3|#define EXTSEP_S "."
  ------------------
  776|      3|  UNLOCK_all_lockfiles ();
  ------------------
  |  |  425|      3|# define UNLOCK_all_lockfiles() do { } while (0)
  |  |  ------------------
  |  |  |  Branch (425:47): [Folded - Ignored]
  |  |  ------------------
  ------------------
  777|       |
  778|      3|  return h;
  779|       |
  780|      0| write_failed:
  781|      0|  {
  782|      0|    int saveerrno = errno;
  783|      0|    all_lockfiles = h->next;
  784|      0|    UNLOCK_all_lockfiles ();
  ------------------
  |  |  425|      0|# define UNLOCK_all_lockfiles() do { } while (0)
  |  |  ------------------
  |  |  |  Branch (425:47): [Folded - Ignored]
  |  |  ------------------
  ------------------
  785|      0|    my_error_2 (_("error writing to '%s': %s\n"), h->tname, strerror (errno));
  ------------------
  |  |  358|      0|# define my_error_2(a,b,c)  log_error ((a), (b), (c))
  ------------------
  786|      0|    if ( fd != -1 )
  ------------------
  |  Branch (786:10): [True: 0, False: 0]
  ------------------
  787|      0|      close (fd);
  788|      0|    unlink (h->tname);
  789|      0|    xfree (h->tname);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  790|      0|    xfree (h);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  791|      0|    my_set_errno (saveerrno);
  ------------------
  |  |  341|      0|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
  792|      0|  }
  793|      0|  return NULL;
  794|      3|}
dotlock.c:use_hardlinks_p:
  623|      3|{
  624|      3|  char *lname;
  625|      3|  struct stat sb;
  626|      3|  unsigned int nlink;
  627|      3|  int res;
  628|       |
  629|      3|  if (stat (tname, &sb))
  ------------------
  |  Branch (629:7): [True: 0, False: 3]
  ------------------
  630|      0|    return -1;
  631|      3|  nlink = (unsigned int)sb.st_nlink;
  632|       |
  633|      3|  lname = xtrymalloc (strlen (tname) + 1 + 1);
  ------------------
  |  |   97|      3|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  634|      3|  if (!lname)
  ------------------
  |  Branch (634:7): [True: 0, False: 3]
  ------------------
  635|      0|    return -1;
  636|      3|  strcpy (lname, tname);
  637|      3|  strcat (lname, "x");
  638|       |
  639|       |  /* We ignore the return value of link() because it is unreliable.  */
  640|      3|  (void) link (tname, lname);
  641|       |
  642|      3|  if (stat (tname, &sb))
  ------------------
  |  Branch (642:7): [True: 0, False: 3]
  ------------------
  643|      0|    res = -1;  /* Ooops.  */
  644|      3|  else if (sb.st_nlink == nlink + 1)
  ------------------
  |  Branch (644:12): [True: 3, False: 0]
  ------------------
  645|      3|    res = 0;   /* Yeah, hardlinks are supported.  */
  646|      0|  else
  647|      0|    res = 1;   /* No hardlink support.  */
  648|       |
  649|      3|  unlink (lname);
  650|      3|  xfree (lname);
  ------------------
  |  |  104|      3|#define xfree(a)         gcry_free ((a))
  ------------------
  651|      3|  return res;
  652|      3|}
dotlock.c:dotlock_destroy_unix:
  950|      3|{
  951|      3|  if (h->locked && h->lockname)
  ------------------
  |  Branch (951:7): [True: 0, False: 3]
  |  Branch (951:20): [True: 0, False: 0]
  ------------------
  952|      0|    unlink (h->lockname);
  953|      3|  if (h->tname && !h->use_o_excl)
  ------------------
  |  Branch (953:7): [True: 3, False: 0]
  |  Branch (953:19): [True: 3, False: 0]
  ------------------
  954|      3|    unlink (h->tname);
  955|      3|  xfree (h->tname);
  ------------------
  |  |  104|      3|#define xfree(a)         gcry_free ((a))
  ------------------
  956|      3|}
dotlock.c:dotlock_take_unix:
 1020|      3|{
 1021|      3|  int wtime = 0;
 1022|      3|  int sumtime = 0;
 1023|      3|  int pid;
 1024|      3|  int lastpid = -1;
 1025|      3|  int ownerchanged;
 1026|      3|  const char *maybe_dead="";
 1027|      3|  int same_node;
 1028|      3|  int saveerrno;
 1029|      3|  int fd;
 1030|       |
 1031|      3| again:
 1032|      3|  if (h->use_o_excl)
  ------------------
  |  Branch (1032:7): [True: 0, False: 3]
  ------------------
 1033|      0|    {
 1034|       |      /* No hardlink support - use open(O_EXCL).  */
 1035|      0|      do
 1036|      0|        {
 1037|      0|          my_set_errno (0);
  ------------------
  |  |  341|      0|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
 1038|      0|          fd = open (h->lockname, O_WRONLY|O_CREAT|O_EXCL,
 1039|      0|                     S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR );
 1040|      0|        }
 1041|      0|      while (fd == -1 && errno == EINTR);
  ------------------
  |  Branch (1041:14): [True: 0, False: 0]
  |  Branch (1041:26): [True: 0, False: 0]
  ------------------
 1042|       |
 1043|      0|      if (fd == -1 && errno == EEXIST)
  ------------------
  |  Branch (1043:11): [True: 0, False: 0]
  |  Branch (1043:23): [True: 0, False: 0]
  ------------------
 1044|      0|        ; /* Lock held by another process.  */
 1045|      0|      else if (fd == -1)
  ------------------
  |  Branch (1045:16): [True: 0, False: 0]
  ------------------
 1046|      0|        {
 1047|      0|          saveerrno = errno;
 1048|      0|          my_error_2 ("lock not made: open(O_EXCL) of '%s' failed: %s\n",
  ------------------
  |  |  358|      0|# define my_error_2(a,b,c)  log_error ((a), (b), (c))
  ------------------
 1049|      0|                      h->lockname, strerror (saveerrno));
 1050|      0|          my_set_errno (saveerrno);
  ------------------
  |  |  341|      0|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
 1051|      0|          return -1;
 1052|      0|        }
 1053|      0|      else
 1054|      0|        {
 1055|      0|          char pidstr[16];
 1056|       |
 1057|      0|          snprintf (pidstr, sizeof pidstr, "%10d\n", (int)getpid());
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
 1058|      0|          if (write (fd, pidstr, 11 ) == 11
  ------------------
  |  Branch (1058:15): [True: 0, False: 0]
  ------------------
 1059|      0|              && write (fd, h->tname + h->nodename_off,h->nodename_len)
  ------------------
  |  Branch (1059:18): [True: 0, False: 0]
  ------------------
 1060|      0|              == h->nodename_len
 1061|      0|              && write (fd, "\n", 1) == 1
  ------------------
  |  Branch (1061:18): [True: 0, False: 0]
  ------------------
 1062|      0|              && !close (fd))
  ------------------
  |  Branch (1062:18): [True: 0, False: 0]
  ------------------
 1063|      0|            {
 1064|      0|              h->locked = 1;
 1065|      0|              return 0;
 1066|      0|            }
 1067|       |          /* Write error.  */
 1068|      0|          saveerrno = errno;
 1069|      0|          my_error_2 ("lock not made: writing to '%s' failed: %s\n",
  ------------------
  |  |  358|      0|# define my_error_2(a,b,c)  log_error ((a), (b), (c))
  ------------------
 1070|      0|                      h->lockname, strerror (errno));
 1071|      0|          close (fd);
 1072|      0|          unlink (h->lockname);
 1073|      0|          my_set_errno (saveerrno);
  ------------------
  |  |  341|      0|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
 1074|      0|          return -1;
 1075|      0|        }
 1076|      0|    }
 1077|      3|  else /* Standard method:  Use hardlinks.  */
 1078|      3|    {
 1079|      3|      struct stat sb;
 1080|       |
 1081|       |      /* We ignore the return value of link() because it is unreliable.  */
 1082|      3|      (void) link (h->tname, h->lockname);
 1083|       |
 1084|      3|      if (stat (h->tname, &sb))
  ------------------
  |  Branch (1084:11): [True: 0, False: 3]
  ------------------
 1085|      0|        {
 1086|      0|          saveerrno = errno;
 1087|      0|          my_error_1 ("lock not made: Oops: stat of tmp file failed: %s\n",
  ------------------
  |  |  357|      0|# define my_error_1(a,b)    log_error ((a), (b))
  ------------------
 1088|      0|                      strerror (errno));
 1089|       |          /* In theory this might be a severe error: It is possible
 1090|       |             that link succeeded but stat failed due to changed
 1091|       |             permissions.  We can't do anything about it, though.  */
 1092|      0|          my_set_errno (saveerrno);
  ------------------
  |  |  341|      0|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
 1093|      0|          return -1;
 1094|      0|        }
 1095|       |
 1096|      3|      if (sb.st_nlink == 2)
  ------------------
  |  Branch (1096:11): [True: 3, False: 0]
  ------------------
 1097|      3|        {
 1098|      3|          h->locked = 1;
 1099|      3|          return 0; /* Okay.  */
 1100|      3|        }
 1101|      3|    }
 1102|       |
 1103|       |  /* Check for stale lock files.  */
 1104|      0|  if ( (pid = read_lockfile (h, &same_node, &fd)) == -1 )
  ------------------
  |  Branch (1104:8): [True: 0, False: 0]
  ------------------
 1105|      0|    {
 1106|      0|      if ( errno != ENOENT )
  ------------------
  |  Branch (1106:12): [True: 0, False: 0]
  ------------------
 1107|      0|        {
 1108|      0|          saveerrno = errno;
 1109|      0|          my_info_0 ("cannot read lockfile\n");
  ------------------
  |  |  352|      0|# define my_info_0(a)       log_info ((a))
  ------------------
 1110|      0|          my_set_errno (saveerrno);
  ------------------
  |  |  341|      0|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
 1111|      0|          return -1;
 1112|      0|        }
 1113|      0|      my_info_0 ("lockfile disappeared\n");
  ------------------
  |  |  352|      0|# define my_info_0(a)       log_info ((a))
  ------------------
 1114|      0|      goto again;
 1115|      0|    }
 1116|      0|  else if ( (pid == getpid() && same_node)
  ------------------
  |  Branch (1116:14): [True: 0, False: 0]
  |  Branch (1116:33): [True: 0, False: 0]
  ------------------
 1117|      0|            || (same_node && kill (pid, 0) && errno == ESRCH) )
  ------------------
  |  Branch (1117:17): [True: 0, False: 0]
  |  Branch (1117:30): [True: 0, False: 0]
  |  Branch (1117:47): [True: 0, False: 0]
  ------------------
 1118|       |    /* Stale lockfile is detected. */
 1119|      0|    {
 1120|      0|      struct stat sb;
 1121|       |
 1122|       |      /* Check if it's unlocked during examining the lockfile.  */
 1123|      0|      if (fstat (fd, &sb) || sb.st_nlink == 0)
  ------------------
  |  Branch (1123:11): [True: 0, False: 0]
  |  Branch (1123:30): [True: 0, False: 0]
  ------------------
 1124|      0|        {
 1125|       |          /* It's gone already by another process.  */
 1126|      0|          close (fd);
 1127|      0|          goto again;
 1128|      0|        }
 1129|       |
 1130|       |      /*
 1131|       |       * Here, although it's quite _rare_, we have a race condition.
 1132|       |       *
 1133|       |       * When multiple processes race on a stale lockfile, detecting
 1134|       |       * AND removing should be done atomically.  That is, to work
 1135|       |       * correctly, the file to be removed should be the one which is
 1136|       |       * examined for detection.
 1137|       |       *
 1138|       |       * But, when it's not atomic, consider the case for us where it
 1139|       |       * takes some time between the detection and the removal of the
 1140|       |       * lockfile.
 1141|       |       *
 1142|       |       * In this situation, it is possible that the file which was
 1143|       |       * detected as stale is already removed by another process and
 1144|       |       * then new lockfile is created (by that process or other one).
 1145|       |       *
 1146|       |       * And it is newly created valid lockfile which is going to be
 1147|       |       * removed by us.
 1148|       |       *
 1149|       |       * Consider this long comment as it expresses possible (long)
 1150|       |       * time between fstat above and unlink below; Meanwhile, the
 1151|       |       * lockfile in question may be removed and there may be new
 1152|       |       * valid one.
 1153|       |       *
 1154|       |       * In short, when you see the message of removing stale lockfile
 1155|       |       * when there are multiple processes for the work, there is
 1156|       |       * (very) little possibility something went wrong.
 1157|       |       */
 1158|       |
 1159|      0|      unlink (h->lockname);
 1160|      0|      my_info_1 (_("removing stale lockfile (created by %d)\n"), pid);
  ------------------
  |  |  353|      0|# define my_info_1(a,b)     log_info ((a), (b))
  ------------------
 1161|      0|      close (fd);
 1162|      0|      goto again;
 1163|      0|    }
 1164|       |
 1165|      0|  close (fd);
 1166|      0|  if (lastpid == -1)
  ------------------
  |  Branch (1166:7): [True: 0, False: 0]
  ------------------
 1167|      0|    lastpid = pid;
 1168|      0|  ownerchanged = (pid != lastpid);
 1169|       |
 1170|      0|  if (timeout)
  ------------------
  |  Branch (1170:7): [True: 0, False: 0]
  ------------------
 1171|      0|    {
 1172|      0|      struct timeval tv;
 1173|       |
 1174|       |      /* Wait until lock has been released.  We use increasing retry
 1175|       |         intervals of 50ms, 100ms, 200ms, 400ms, 800ms, 2s, 4s and 8s
 1176|       |         but reset it if the lock owner meanwhile changed.  */
 1177|      0|      if (!wtime || ownerchanged)
  ------------------
  |  Branch (1177:11): [True: 0, False: 0]
  |  Branch (1177:21): [True: 0, False: 0]
  ------------------
 1178|      0|        wtime = 50;
 1179|      0|      else if (wtime < 800)
  ------------------
  |  Branch (1179:16): [True: 0, False: 0]
  ------------------
 1180|      0|        wtime *= 2;
 1181|      0|      else if (wtime == 800)
  ------------------
  |  Branch (1181:16): [True: 0, False: 0]
  ------------------
 1182|      0|        wtime = 2000;
 1183|      0|      else if (wtime < 8000)
  ------------------
  |  Branch (1183:16): [True: 0, False: 0]
  ------------------
 1184|      0|        wtime *= 2;
 1185|       |
 1186|      0|      if (timeout > 0)
  ------------------
  |  Branch (1186:11): [True: 0, False: 0]
  ------------------
 1187|      0|        {
 1188|      0|          if (wtime > timeout)
  ------------------
  |  Branch (1188:15): [True: 0, False: 0]
  ------------------
 1189|      0|            wtime = timeout;
 1190|      0|          timeout -= wtime;
 1191|      0|        }
 1192|       |
 1193|      0|      sumtime += wtime;
 1194|      0|      if (sumtime >= 1500)
  ------------------
  |  Branch (1194:11): [True: 0, False: 0]
  ------------------
 1195|      0|        {
 1196|      0|          sumtime = 0;
 1197|      0|          my_info_3 (_("waiting for lock (held by %d%s) %s...\n"),
  ------------------
  |  |  355|      0|# define my_info_3(a,b,c,d) log_info ((a), (b), (c), (d))
  |  |  ------------------
  |  |  |  Branch (355:55): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1198|      0|                     pid, maybe_dead, maybe_deadlock(h)? _("(deadlock?) "):"");
 1199|      0|        }
 1200|       |
 1201|       |
 1202|      0|      tv.tv_sec = wtime / 1000;
 1203|      0|      tv.tv_usec = (wtime % 1000) * 1000;
 1204|      0|      select (0, NULL, NULL, NULL, &tv);
 1205|      0|      goto again;
 1206|      0|    }
 1207|       |
 1208|      0|  my_set_errno (EACCES);
  ------------------
  |  |  341|      0|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
 1209|      0|  return -1;
 1210|      0|}
dotlock.c:read_lockfile:
  525|      3|{
  526|      3|  char buffer_space[10+1+70+1]; /* 70 is just an estimated value; node
  527|       |                                   names are usually shorter. */
  528|      3|  int fd;
  529|      3|  int pid = -1;
  530|      3|  char *buffer, *p;
  531|      3|  size_t expected_len;
  532|      3|  int res, nread;
  533|       |
  534|      3|  *same_node = 0;
  535|      3|  expected_len = 10 + 1 + h->nodename_len + 1;
  536|      3|  if ( expected_len >= sizeof buffer_space)
  ------------------
  |  Branch (536:8): [True: 0, False: 3]
  ------------------
  537|      0|    {
  538|      0|      buffer = xtrymalloc (expected_len);
  ------------------
  |  |   97|      0|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  539|      0|      if (!buffer)
  ------------------
  |  Branch (539:11): [True: 0, False: 0]
  ------------------
  540|      0|        return -1;
  541|      0|    }
  542|      3|  else
  543|      3|    buffer = buffer_space;
  544|       |
  545|      3|  if ( (fd = open (h->lockname, O_RDONLY)) == -1 )
  ------------------
  |  Branch (545:8): [True: 0, False: 3]
  ------------------
  546|      0|    {
  547|      0|      int e = errno;
  548|      0|      my_info_2 ("error opening lockfile '%s': %s\n",
  ------------------
  |  |  354|      0|# define my_info_2(a,b,c)   log_info ((a), (b), (c))
  ------------------
  549|      0|                 h->lockname, strerror(errno) );
  550|      0|      if (buffer != buffer_space)
  ------------------
  |  Branch (550:11): [True: 0, False: 0]
  ------------------
  551|      0|        xfree (buffer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  552|      0|      my_set_errno (e); /* Need to return ERRNO here. */
  ------------------
  |  |  341|      0|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
  553|      0|      return -1;
  554|      0|    }
  555|       |
  556|      3|  p = buffer;
  557|      3|  nread = 0;
  558|      3|  do
  559|      3|    {
  560|      3|      res = read (fd, p, expected_len - nread);
  561|      3|      if (res == -1 && errno == EINTR)
  ------------------
  |  Branch (561:11): [True: 0, False: 3]
  |  Branch (561:24): [True: 0, False: 0]
  ------------------
  562|      0|        continue;
  563|      3|      if (res < 0)
  ------------------
  |  Branch (563:11): [True: 0, False: 3]
  ------------------
  564|      0|        {
  565|      0|          int e = errno;
  566|      0|          my_info_1 ("error reading lockfile '%s'\n", h->lockname );
  ------------------
  |  |  353|      0|# define my_info_1(a,b)     log_info ((a), (b))
  ------------------
  567|      0|          close (fd);
  568|      0|          if (buffer != buffer_space)
  ------------------
  |  Branch (568:15): [True: 0, False: 0]
  ------------------
  569|      0|            xfree (buffer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  570|      0|          my_set_errno (e);
  ------------------
  |  |  341|      0|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
  571|      0|          return -1;
  572|      0|        }
  573|      3|      p += res;
  574|      3|      nread += res;
  575|      3|    }
  576|      3|  while (res && nread != expected_len);
  ------------------
  |  Branch (576:10): [True: 3, False: 0]
  |  Branch (576:17): [True: 0, False: 3]
  ------------------
  577|       |
  578|      3|  if (r_fd)
  ------------------
  |  Branch (578:7): [True: 0, False: 3]
  ------------------
  579|      0|    *r_fd = fd;
  580|      3|  else
  581|      3|    close(fd);
  582|       |
  583|      3|  if (nread < 11)
  ------------------
  |  Branch (583:7): [True: 0, False: 3]
  ------------------
  584|      0|    {
  585|      0|      my_info_1 ("invalid size of lockfile '%s'\n", h->lockname);
  ------------------
  |  |  353|      0|# define my_info_1(a,b)     log_info ((a), (b))
  ------------------
  586|      0|      if (buffer != buffer_space)
  ------------------
  |  Branch (586:11): [True: 0, False: 0]
  ------------------
  587|      0|        xfree (buffer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  588|      0|      my_set_errno (EINVAL);
  ------------------
  |  |  341|      0|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
  589|      0|      return -1;
  590|      0|    }
  591|       |
  592|      3|  if (buffer[10] != '\n'
  ------------------
  |  Branch (592:7): [True: 0, False: 3]
  ------------------
  593|      3|      || (buffer[10] = 0, pid = atoi (buffer)) == -1
  ------------------
  |  Branch (593:10): [True: 0, False: 3]
  ------------------
  594|      3|      || !pid )
  ------------------
  |  Branch (594:10): [True: 0, False: 3]
  ------------------
  595|      0|    {
  596|      0|      my_error_2 ("invalid pid %d in lockfile '%s'\n", pid, h->lockname);
  ------------------
  |  |  358|      0|# define my_error_2(a,b,c)  log_error ((a), (b), (c))
  ------------------
  597|      0|      if (buffer != buffer_space)
  ------------------
  |  Branch (597:11): [True: 0, False: 0]
  ------------------
  598|      0|        xfree (buffer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  599|      0|      my_set_errno (EINVAL);
  ------------------
  |  |  341|      0|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
  600|      0|      return -1;
  601|      0|    }
  602|       |
  603|      3|  if (nread == expected_len
  ------------------
  |  Branch (603:7): [True: 3, False: 0]
  ------------------
  604|      3|      && !memcmp (h->tname+h->nodename_off, buffer+11, h->nodename_len)
  ------------------
  |  Branch (604:10): [True: 3, False: 0]
  ------------------
  605|      3|      && buffer[11+h->nodename_len] == '\n')
  ------------------
  |  Branch (605:10): [True: 3, False: 0]
  ------------------
  606|      3|    *same_node = 1;
  607|       |
  608|      3|  if (buffer != buffer_space)
  ------------------
  |  Branch (608:7): [True: 0, False: 3]
  ------------------
  609|      0|    xfree (buffer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  610|      3|  return pid;
  611|      3|}
dotlock.c:dotlock_release_unix:
 1308|      3|{
 1309|      3|  int pid, same_node;
 1310|      3|  int saveerrno;
 1311|       |
 1312|      3|  pid = read_lockfile (h, &same_node, NULL);
 1313|      3|  if ( pid == -1 )
  ------------------
  |  Branch (1313:8): [True: 0, False: 3]
  ------------------
 1314|      0|    {
 1315|      0|      saveerrno = errno;
 1316|      0|      my_error_0 ("release_dotlock: lockfile error\n");
  ------------------
  |  |  356|      0|# define my_error_0(a)      log_error ((a))
  ------------------
 1317|      0|      my_set_errno (saveerrno);
  ------------------
  |  |  341|      0|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
 1318|      0|      return -1;
 1319|      0|    }
 1320|      3|  if ( pid != getpid() || !same_node )
  ------------------
  |  Branch (1320:8): [True: 0, False: 3]
  |  Branch (1320:27): [True: 0, False: 3]
  ------------------
 1321|      0|    {
 1322|      0|      my_error_1 ("release_dotlock: not our lock (pid=%d)\n", pid);
  ------------------
  |  |  357|      0|# define my_error_1(a,b)    log_error ((a), (b))
  ------------------
 1323|      0|      my_set_errno (EACCES);
  ------------------
  |  |  341|      0|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
 1324|      0|      return -1;
 1325|      0|    }
 1326|       |
 1327|      3|  if ( unlink( h->lockname ) )
  ------------------
  |  Branch (1327:8): [True: 0, False: 3]
  ------------------
 1328|      0|    {
 1329|      0|      saveerrno = errno;
 1330|      0|      my_error_1 ("release_dotlock: error removing lockfile '%s'\n",
  ------------------
  |  |  357|      0|# define my_error_1(a,b)    log_error ((a), (b))
  ------------------
 1331|      0|                  h->lockname);
 1332|      0|      my_set_errno (saveerrno);
  ------------------
  |  |  341|      0|#  define my_set_errno(e)  gpg_err_set_errno ((e))
  ------------------
 1333|      0|      return -1;
 1334|      0|    }
 1335|       |  /* Fixme: As an extra check we could check whether the link count is
 1336|       |     now really at 1. */
 1337|      3|  return 0;
 1338|      3|}

gnupg_get_time:
   68|  1.40k|{
   69|  1.40k|  time_t current = time (NULL);
   70|  1.40k|  if (current == (time_t)(-1))
  ------------------
  |  Branch (70:7): [True: 0, False: 1.40k]
  ------------------
   71|      0|    log_fatal ("time() failed\n");
   72|       |
   73|  1.40k|  if (timemode == NORMAL)
  ------------------
  |  Branch (73:7): [True: 1.40k, False: 0]
  ------------------
   74|  1.40k|    return current;
   75|      0|  else if (timemode == FROZEN)
  ------------------
  |  Branch (75:12): [True: 0, False: 0]
  ------------------
   76|      0|    return timewarp;
   77|      0|  else if (timemode == FUTURE)
  ------------------
  |  Branch (77:12): [True: 0, False: 0]
  ------------------
   78|      0|    return current + timewarp;
   79|      0|  else
   80|      0|    return current - timewarp;
   81|  1.40k|}
make_timestamp:
  169|  1.40k|{
  170|  1.40k|  time_t t = gnupg_get_time ();
  171|  1.40k|  return (u32)t;
  172|  1.40k|}
asctimestamp:
  688|  49.0k|{
  689|  49.0k|  static char buffer[80];
  690|  49.0k|#if defined (HAVE_STRFTIME) && defined (HAVE_NL_LANGINFO)
  691|  49.0k|  static char fmt[80];
  692|  49.0k|#endif
  693|  49.0k|  struct tm *tp;
  694|  49.0k|  time_t atime = stamp;
  695|       |
  696|  49.0k|  if (IS_INVALID_TIME_T (atime))
  ------------------
  |  |   53|  49.0k|# define IS_INVALID_TIME_T(a) ((a) < 0)
  |  |  ------------------
  |  |  |  Branch (53:31): [True: 0, False: 49.0k]
  |  |  ------------------
  ------------------
  697|      0|    {
  698|      0|      strcpy (buffer, "????" "-??" "-??");
  699|      0|      return buffer;
  700|      0|    }
  701|       |
  702|  49.0k|  tp = localtime( &atime );
  703|  49.0k|#ifdef HAVE_STRFTIME
  704|  49.0k|# if defined(HAVE_NL_LANGINFO)
  705|  49.0k|  mem2str( fmt, nl_langinfo(D_T_FMT), DIM(fmt)-3 );
  ------------------
  |  |   47|  49.0k|#define DIM(v)		     (sizeof(v)/sizeof((v)[0]))
  ------------------
  706|  49.0k|  if (!strstr( fmt, "%Z" ))
  ------------------
  |  Branch (706:7): [True: 49.0k, False: 0]
  ------------------
  707|  49.0k|    strcat( fmt, " %Z");
  708|       |  /* NOTE: gcc -Wformat-noliteral will complain here.  I have found no
  709|       |     way to suppress this warning.  */
  710|  49.0k|  strftime (buffer, DIM(buffer)-1, fmt, tp);
  ------------------
  |  |   47|  49.0k|#define DIM(v)		     (sizeof(v)/sizeof((v)[0]))
  ------------------
  711|       |# else
  712|       |#  if HAVE_W32_SYSTEM
  713|       |  {
  714|       |    static int done;
  715|       |
  716|       |    if (!done)
  717|       |      {
  718|       |        /* The locale names as used by Windows are in the form
  719|       |         * "German_Germany.1252" or "German_Austria.1252" with
  720|       |         * alternate names similar to Unix, e.g. "de-DE".  However
  721|       |         * that is the theory.  On current Windows and Mingw the
  722|       |         * alternate names do not work.  We would need a table to map
  723|       |         * them from the short names as provided by gpgrt to the long
  724|       |         * names and append some code page.  For now we use "" and
  725|       |         * take the locale from the user's system settings.  Thus the
  726|       |         * standard Unix envvars don't work for time and may mismatch
  727|       |         * with the string translations.  The new UCRT available since
  728|       |         * 2018 has a lot of additional support but that will for sure
  729|       |         * break other things.  We should move to ISO strings to get
  730|       |         * rid of such problems.  */
  731|       |        setlocale (LC_TIME, "");
  732|       |        done = 1;
  733|       |        /* log_debug ("LC_ALL  now '%s'\n", setlocale (LC_ALL, NULL)); */
  734|       |        /* log_debug ("LC_TIME now '%s'\n", setlocale (LC_TIME, NULL)); */
  735|       |      }
  736|       |  }
  737|       |#  endif
  738|       |   /* FIXME: we should check whether the locale appends a " %Z" These
  739|       |    * locales from glibc don't put the " %Z": fi_FI hr_HR ja_JP lt_LT
  740|       |    * lv_LV POSIX ru_RU ru_SU sv_FI sv_SE zh_CN.  */
  741|       |  strftime (buffer, DIM(buffer)-1, "%c %Z", tp);
  742|       |# endif
  743|  49.0k|  buffer[DIM(buffer)-1] = 0;
  ------------------
  |  |   47|  49.0k|#define DIM(v)		     (sizeof(v)/sizeof((v)[0]))
  ------------------
  744|       |#else
  745|       |  mem2str( buffer, asctime(tp), DIM(buffer) );
  746|       |#endif
  747|  49.0k|  return buffer;
  748|  49.0k|}

standard_homedir:
  234|      1|{
  235|       |#ifdef HAVE_W32_SYSTEM
  236|       |  static const char *dir;
  237|       |
  238|       |  if (!dir)
  239|       |    {
  240|       |      const char *rdir;
  241|       |
  242|       |      rdir = w32_rootdir ();
  243|       |      if (w32_portable_app)
  244|       |        {
  245|       |          dir = xstrconcat (rdir, DIRSEP_S "home", NULL);
  246|       |          gpgrt_annotate_leaked_object (dir);
  247|       |        }
  248|       |      else
  249|       |        {
  250|       |          char *path;
  251|       |
  252|       |          path = w32_shgetfolderpath (NULL, CSIDL_APPDATA|CSIDL_FLAG_CREATE,
  253|       |                                      NULL, 0);
  254|       |          if (path)
  255|       |            {
  256|       |              dir = xstrconcat (path, "\\gnupg", NULL);
  257|       |              xfree (path);
  258|       |              gpgrt_annotate_leaked_object (dir);
  259|       |
  260|       |              /* Try to create the directory if it does not yet exists.  */
  261|       |              if (gnupg_access (dir, F_OK))
  262|       |                gnupg_mkdir (dir, "-rwx");
  263|       |            }
  264|       |          else
  265|       |            dir = GNUPG_DEFAULT_HOMEDIR;
  266|       |        }
  267|       |    }
  268|       |  return dir;
  269|       |#else/*!HAVE_W32_SYSTEM*/
  270|      1|  return GNUPG_DEFAULT_HOMEDIR;
  ------------------
  |  |  906|      1|#define GNUPG_DEFAULT_HOMEDIR "~/.gnupg"
  ------------------
  271|      1|#endif /*!HAVE_W32_SYSTEM*/
  272|      1|}
gnupg_set_homedir:
  742|      1|{
  743|      1|  char *tmp = NULL;
  744|       |
  745|      1|  if (!newdir || !*newdir)
  ------------------
  |  Branch (745:7): [True: 0, False: 1]
  |  Branch (745:18): [True: 0, False: 1]
  ------------------
  746|      0|    newdir = default_homedir ();
  747|      1|  else
  748|      1|    {
  749|      1|      tmp = copy_dir_with_fixup (newdir);
  750|      1|      if (tmp)
  ------------------
  |  Branch (750:11): [True: 1, False: 0]
  ------------------
  751|      1|        newdir = tmp;
  752|       |
  753|      1|      if (!is_gnupg_default_homedir (newdir))
  ------------------
  |  Branch (753:11): [True: 1, False: 0]
  ------------------
  754|      1|        non_default_homedir = 1;
  755|      1|    }
  756|      1|  xfree (the_gnupg_homedir);
  ------------------
  |  |  104|      1|#define xfree(a)         gcry_free ((a))
  ------------------
  757|      1|  the_gnupg_homedir = make_absfilename (newdir, NULL);;
  758|      1|  xfree (tmp);
  ------------------
  |  |  104|      1|#define xfree(a)         gcry_free ((a))
  ------------------
  759|       |  /* Fixme: Should we use
  760|       |   *   gpgrt_annotate_leaked_object(the_gnupg_homedir)
  761|       |   * despite that we may free and allocate a new one in some
  762|       |   * cases?  */
  763|      1|}
gnupg_homedir:
  803|      2|{
  804|       |  /* If a homedir has not been set, set it to the default.  */
  805|      2|  if (!the_gnupg_homedir)
  ------------------
  |  Branch (805:7): [True: 0, False: 2]
  ------------------
  806|      0|    the_gnupg_homedir = make_absfilename (default_homedir (), NULL);
  807|      2|  return the_gnupg_homedir;
  808|      2|}
homedir.c:copy_dir_with_fixup:
  178|      1|{
  179|      1|  char *result = NULL;
  180|      1|  char *p;
  181|       |
  182|      1|  if (!*newdir)
  ------------------
  |  Branch (182:7): [True: 0, False: 1]
  ------------------
  183|      0|    return NULL;
  184|       |
  185|       |#ifdef HAVE_W32_SYSTEM
  186|       |  if (newdir[0] && newdir[1] == ':'
  187|       |      && !(newdir[2] == '/' || newdir[2] == '\\'))
  188|       |    {
  189|       |      /* Drive letter with missing leading slash.  */
  190|       |      p = result = xmalloc (strlen (newdir) + 1 + 1);
  191|       |      *p++ = newdir[0];
  192|       |      *p++ = newdir[1];
  193|       |      *p++ = '\\';
  194|       |      strcpy (p, newdir+2);
  195|       |
  196|       |      /* Remove trailing slashes.  */
  197|       |      p = result + strlen (result) - 1;
  198|       |      while (p > result+2 && (*p == '/' || *p == '\\'))
  199|       |        *p-- = 0;
  200|       |    }
  201|       |  else if (newdir[strlen (newdir)-1] == '/'
  202|       |           || newdir[strlen (newdir)-1] == '\\' )
  203|       |    {
  204|       |      result = xstrdup (newdir);
  205|       |      p = result + strlen (result) - 1;
  206|       |      while (p > result
  207|       |             && (*p == '/' || *p == '\\')
  208|       |             && (p-1 > result && p[-1] != ':')) /* We keep "c:/". */
  209|       |        *p-- = 0;
  210|       |    }
  211|       |
  212|       |#else /*!HAVE_W32_SYSTEM*/
  213|       |
  214|      1|  if (newdir[strlen (newdir)-1] == '/')
  ------------------
  |  Branch (214:7): [True: 1, False: 0]
  ------------------
  215|      1|    {
  216|      1|      result = xstrdup (newdir);
  ------------------
  |  |  112|      1|#define xstrdup(a)       gcry_xstrdup ((a))
  ------------------
  217|      1|      p = result + strlen (result) - 1;
  218|      2|      while (p > result && *p == '/')
  ------------------
  |  Branch (218:14): [True: 2, False: 0]
  |  Branch (218:28): [True: 1, False: 1]
  ------------------
  219|      1|        *p-- = 0;
  220|      1|    }
  221|       |
  222|      1|#endif /*!HAVE_W32_SYSTEM*/
  223|       |
  224|      1|  return result;
  225|      1|}
homedir.c:is_gnupg_default_homedir:
  161|      1|{
  162|      1|  int result;
  163|      1|  char *a = make_absfilename (dir, NULL);
  164|      1|  char *b = make_absfilename (standard_homedir (), NULL);
  165|      1|  result = !compare_filenames (a, b);
  166|      1|  xfree (b);
  ------------------
  |  |  104|      1|#define xfree(a)         gcry_free ((a))
  ------------------
  167|      1|  xfree (a);
  ------------------
  |  |  104|      1|#define xfree(a)         gcry_free ((a))
  ------------------
  168|      1|  return result;
  169|      1|}

register_mem_cleanup_func:
   93|      1|{
   94|      1|  mem_cleanup_item_t item;
   95|       |
   96|      1|  for (item = mem_cleanup_list; item; item = item->next)
  ------------------
  |  Branch (96:33): [True: 0, False: 1]
  ------------------
   97|      0|    if (item->func == func)
  ------------------
  |  Branch (97:9): [True: 0, False: 0]
  ------------------
   98|      0|      return; /* Function has already been registered.  */
   99|       |
  100|      1|  item = malloc (sizeof *item);
  101|      1|  if (item)
  ------------------
  |  Branch (101:7): [True: 1, False: 0]
  ------------------
  102|      1|    {
  103|      1|      item->func = func;
  104|      1|      item->next = mem_cleanup_list;
  105|      1|      mem_cleanup_list = item;
  106|      1|    }
  107|      1|}

iobuf_set_buffer_size:
 1122|  3.38k|{
 1123|  3.38k|  static int used;
 1124|       |
 1125|  3.38k|  if (!used && kilobyte)
  ------------------
  |  Branch (1125:7): [True: 3.38k, False: 0]
  |  Branch (1125:16): [True: 0, False: 3.38k]
  ------------------
 1126|      0|    {
 1127|      0|      if (kilobyte < 4)
  ------------------
  |  Branch (1127:11): [True: 0, False: 0]
  ------------------
 1128|      0|        kilobyte = 4;
 1129|      0|      else if (kilobyte > 16*1024)
  ------------------
  |  Branch (1129:16): [True: 0, False: 0]
  ------------------
 1130|      0|        kilobyte = 16*1024;
 1131|       |
 1132|      0|      iobuf_buffer_size = kilobyte * 1024;
 1133|      0|      used = 1;
 1134|      0|    }
 1135|  3.38k|  return iobuf_buffer_size / 1024;
 1136|  3.38k|}
iobuf_alloc:
 1182|  24.4k|{
 1183|  24.4k|  iobuf_t a;
 1184|  24.4k|  static int number = 0;
 1185|       |
 1186|  24.4k|  assert (use == IOBUF_INPUT || use == IOBUF_INPUT_TEMP
 1187|  24.4k|	  || use == IOBUF_OUTPUT || use == IOBUF_OUTPUT_TEMP);
 1188|  24.4k|  if (bufsize == 0)
  ------------------
  |  Branch (1188:7): [True: 0, False: 24.4k]
  ------------------
 1189|      0|    {
 1190|      0|      log_bug ("iobuf_alloc() passed a bufsize of 0!\n");
 1191|      0|      bufsize = iobuf_buffer_size;
 1192|      0|    }
 1193|       |
 1194|  24.4k|  a = xcalloc (1, sizeof *a);
  ------------------
  |  |  109|  24.4k|#define xcalloc(a,b)     gcry_xcalloc ((a),(b))
  ------------------
 1195|  24.4k|  a->use = use;
 1196|  24.4k|  a->d.buf = xmalloc (bufsize);
  ------------------
  |  |  107|  24.4k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 1197|  24.4k|  a->d.size = bufsize;
 1198|  24.4k|  a->e_d.buf = NULL;
 1199|  24.4k|  a->e_d.len = 0;
 1200|  24.4k|  a->e_d.used = 0;
 1201|  24.4k|  a->e_d.preferred = 0;
 1202|  24.4k|  a->no = ++number;
 1203|  24.4k|  a->subno = 0;
 1204|  24.4k|  a->real_fname = NULL;
 1205|  24.4k|  return a;
 1206|  24.4k|}
iobuf_close:
 1210|  44.5k|{
 1211|  44.5k|  iobuf_t a_chain;
 1212|  44.5k|  size_t dummy_len = 0;
 1213|  44.5k|  int rc = 0;
 1214|       |
 1215|  75.9k|  for (; a; a = a_chain)
  ------------------
  |  Branch (1215:10): [True: 31.4k, False: 44.5k]
  ------------------
 1216|  31.4k|    {
 1217|  31.4k|      byte desc[MAX_IOBUF_DESC];
 1218|  31.4k|      int rc2 = 0;
 1219|       |
 1220|  31.4k|      a_chain = a->chain;
 1221|       |
 1222|  31.4k|      if (a->use == IOBUF_OUTPUT && (rc = filter_flush (a)))
  ------------------
  |  Branch (1222:11): [True: 1, False: 31.4k]
  |  Branch (1222:37): [True: 0, False: 1]
  ------------------
 1223|      0|	log_error ("filter_flush failed on close: %s\n", gpg_strerror (rc));
 1224|       |
 1225|  31.4k|      if (DBG_IOBUF)
  ------------------
  |  |   98|  31.4k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 31.4k]
  |  |  ------------------
  ------------------
 1226|      0|	log_debug ("iobuf-%d.%d: close '%s'\n",
 1227|      0|		   a->no, a->subno, iobuf_desc (a, desc));
 1228|       |
 1229|  31.4k|      if (a->filter && (rc2 = a->filter (a->filter_ov, IOBUFCTRL_FREE,
  ------------------
  |  Branch (1229:11): [True: 8.84k, False: 22.5k]
  |  Branch (1229:24): [True: 0, False: 8.84k]
  ------------------
 1230|  8.84k|					 a->chain, NULL, &dummy_len)))
 1231|      0|	log_error ("IOBUFCTRL_FREE failed on close: %s\n", gpg_strerror (rc));
 1232|  31.4k|      if (! rc && rc2)
  ------------------
  |  Branch (1232:11): [True: 31.4k, False: 0]
  |  Branch (1232:19): [True: 0, False: 31.4k]
  ------------------
 1233|       |	/* Whoops!  An error occurred.  Save it in RC if we haven't
 1234|       |	   already recorded an error.  */
 1235|      0|	rc = rc2;
 1236|       |
 1237|  31.4k|      xfree (a->real_fname);
  ------------------
  |  |  104|  31.4k|#define xfree(a)         gcry_free ((a))
  ------------------
 1238|  31.4k|      if (a->d.buf)
  ------------------
  |  Branch (1238:11): [True: 31.4k, False: 0]
  ------------------
 1239|  31.4k|	{
 1240|  31.4k|	  memset (a->d.buf, 0, a->d.size);	/* erase the buffer */
 1241|  31.4k|	  xfree (a->d.buf);
  ------------------
  |  |  104|  31.4k|#define xfree(a)         gcry_free ((a))
  ------------------
 1242|  31.4k|	}
 1243|  31.4k|      xfree (a);
  ------------------
  |  |  104|  31.4k|#define xfree(a)         gcry_free ((a))
  ------------------
 1244|  31.4k|    }
 1245|  44.5k|  return rc;
 1246|  44.5k|}
iobuf_is_pipe_filename:
 1319|   182k|{
 1320|   182k|  if (!fname || (*fname=='-' && !fname[1]) )
  ------------------
  |  Branch (1320:7): [True: 0, False: 182k]
  |  Branch (1320:18): [True: 0, False: 182k]
  |  Branch (1320:33): [True: 0, False: 0]
  ------------------
 1321|      0|    return 1;
 1322|   182k|  return check_special_filename (fname, 0, 1) != -1;
 1323|   182k|}
iobuf_open:
 1391|  24.4k|{
 1392|  24.4k|  return do_open (fname, 1, IOBUF_INPUT, "rb", 0);
 1393|  24.4k|}
iobuf_create:
 1397|      1|{
 1398|      1|  return do_open (fname, 1, IOBUF_OUTPUT, "wb", mode700);
 1399|      1|}
iobuf_ioctl:
 1504|  12.2k|{
 1505|  12.2k|  byte desc[MAX_IOBUF_DESC];
 1506|       |
 1507|  12.2k|  if (cmd == IOBUF_IOCTL_KEEP_OPEN)
  ------------------
  |  Branch (1507:7): [True: 0, False: 12.2k]
  ------------------
 1508|      0|    {
 1509|       |      /* Keep system filepointer/descriptor open.  This was used in
 1510|       |         the past by http.c; this ioctl is not directly used
 1511|       |         anymore.  */
 1512|      0|      if (DBG_IOBUF)
  ------------------
  |  |   98|      0|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1513|      0|	log_debug ("iobuf-%d.%d: ioctl '%s' keep_open=%d\n",
 1514|      0|		   a ? a->no : -1, a ? a->subno : -1, iobuf_desc (a, desc),
  ------------------
  |  Branch (1514:6): [True: 0, False: 0]
  |  Branch (1514:22): [True: 0, False: 0]
  ------------------
 1515|      0|		   intval);
 1516|      0|      for (; a; a = a->chain)
  ------------------
  |  Branch (1516:14): [True: 0, False: 0]
  ------------------
 1517|      0|	if (!a->chain && a->filter == file_filter)
  ------------------
  |  Branch (1517:6): [True: 0, False: 0]
  |  Branch (1517:19): [True: 0, False: 0]
  ------------------
 1518|      0|	  {
 1519|      0|	    file_filter_ctx_t *b = a->filter_ov;
 1520|      0|	    b->keep_open = intval;
 1521|      0|	    return 0;
 1522|      0|	  }
 1523|       |#ifdef HAVE_W32_SYSTEM
 1524|       |	else if (!a->chain && a->filter == sock_filter)
 1525|       |	  {
 1526|       |	    sock_filter_ctx_t *b = a->filter_ov;
 1527|       |	    b->keep_open = intval;
 1528|       |	    return 0;
 1529|       |	  }
 1530|       |#endif
 1531|      0|    }
 1532|  12.2k|  else if (cmd == IOBUF_IOCTL_INVALIDATE_CACHE)
  ------------------
  |  Branch (1532:12): [True: 1, False: 12.2k]
  ------------------
 1533|      1|    {
 1534|      1|      if (DBG_IOBUF)
  ------------------
  |  |   98|      1|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1535|      0|	log_debug ("iobuf-*.*: ioctl '%s' invalidate\n",
 1536|      0|		   ptrval ? (char *) ptrval : "?");
  ------------------
  |  Branch (1536:6): [True: 0, False: 0]
  ------------------
 1537|      1|      if (!a && !intval && ptrval)
  ------------------
  |  Branch (1537:11): [True: 1, False: 0]
  |  Branch (1537:17): [True: 1, False: 0]
  |  Branch (1537:28): [True: 1, False: 0]
  ------------------
 1538|      1|	{
 1539|      1|	  if (fd_cache_invalidate (ptrval))
  ------------------
  |  Branch (1539:8): [True: 0, False: 1]
  ------------------
 1540|      0|            return -1;
 1541|      1|	  return 0;
 1542|      1|	}
 1543|      1|    }
 1544|  12.2k|  else if (cmd == IOBUF_IOCTL_NO_CACHE)
  ------------------
  |  Branch (1544:12): [True: 12.2k, False: 0]
  ------------------
 1545|  12.2k|    {
 1546|  12.2k|      if (DBG_IOBUF)
  ------------------
  |  |   98|  12.2k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 12.2k]
  |  |  ------------------
  ------------------
 1547|      0|	log_debug ("iobuf-%d.%d: ioctl '%s' no_cache=%d\n",
 1548|      0|		   a ? a->no : -1, a ? a->subno : -1, iobuf_desc (a, desc),
  ------------------
  |  Branch (1548:6): [True: 0, False: 0]
  |  Branch (1548:22): [True: 0, False: 0]
  ------------------
 1549|      0|		   intval);
 1550|  12.2k|      for (; a; a = a->chain)
  ------------------
  |  Branch (1550:14): [True: 12.2k, False: 0]
  ------------------
 1551|  12.2k|	if (!a->chain && a->filter == file_filter)
  ------------------
  |  Branch (1551:6): [True: 12.2k, False: 0]
  |  Branch (1551:19): [True: 12.2k, False: 0]
  ------------------
 1552|  12.2k|	  {
 1553|  12.2k|	    file_filter_ctx_t *b = a->filter_ov;
 1554|  12.2k|	    b->no_cache = intval;
 1555|  12.2k|	    return 0;
 1556|  12.2k|	  }
 1557|       |#ifdef HAVE_W32_SYSTEM
 1558|       |	else if (!a->chain && a->filter == sock_filter)
 1559|       |	  {
 1560|       |	    sock_filter_ctx_t *b = a->filter_ov;
 1561|       |	    b->no_cache = intval;
 1562|       |	    return 0;
 1563|       |	  }
 1564|       |#endif
 1565|  12.2k|    }
 1566|      0|  else if (cmd == IOBUF_IOCTL_FSYNC)
  ------------------
  |  Branch (1566:12): [True: 0, False: 0]
  ------------------
 1567|      0|    {
 1568|       |      /* Do a fsync on the open fd and return any errors to the caller
 1569|       |         of iobuf_ioctl.  Note that we work on a file name here. */
 1570|      0|      if (DBG_IOBUF)
  ------------------
  |  |   98|      0|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1571|      0|        log_debug ("iobuf-*.*: ioctl '%s' fsync\n",
 1572|      0|                   ptrval? (const char*)ptrval:"<null>");
  ------------------
  |  Branch (1572:20): [True: 0, False: 0]
  ------------------
 1573|       |
 1574|      0|      if (!a && !intval && ptrval)
  ------------------
  |  Branch (1574:11): [True: 0, False: 0]
  |  Branch (1574:17): [True: 0, False: 0]
  |  Branch (1574:28): [True: 0, False: 0]
  ------------------
 1575|      0|        {
 1576|      0|          return fd_cache_synchronize (ptrval);
 1577|      0|        }
 1578|      0|    }
 1579|       |
 1580|       |
 1581|      0|  return -1;
 1582|  12.2k|}
iobuf_push_filter:
 1593|  74.8k|{
 1594|  74.8k|  return iobuf_push_filter2 (a, f, ov, 0);
 1595|  74.8k|}
iobuf_push_filter2:
 1602|  74.8k|{
 1603|  74.8k|  iobuf_t b;
 1604|  74.8k|  size_t dummy_len = 0;
 1605|  74.8k|  int rc = 0;
 1606|       |
 1607|  74.8k|  if (a->use == IOBUF_OUTPUT && (rc = filter_flush (a)))
  ------------------
  |  Branch (1607:7): [True: 0, False: 74.8k]
  |  Branch (1607:33): [True: 0, False: 0]
  ------------------
 1608|      0|    return rc;
 1609|       |
 1610|  74.8k|  if (a->subno >= MAX_NESTING_FILTER)
  ------------------
  |  |   67|  74.8k|#define MAX_NESTING_FILTER 64
  ------------------
  |  Branch (1610:7): [True: 288, False: 74.5k]
  ------------------
 1611|    288|    {
 1612|    288|      log_error ("i/o filter too deeply nested - corrupted data?\n");
 1613|    288|      return GPG_ERR_BAD_DATA;
 1614|    288|    }
 1615|       |
 1616|       |  /* We want to create a new filter and put it in front of A.  A
 1617|       |     simple implementation would do:
 1618|       |
 1619|       |       b = iobuf_alloc (...);
 1620|       |       b->chain = a;
 1621|       |       return a;
 1622|       |
 1623|       |     This is a bit problematic: A is the head of the pipeline and
 1624|       |     there are potentially many pointers to it.  Requiring the caller
 1625|       |     to update all of these pointers is a burden.
 1626|       |
 1627|       |     An alternative implementation would add a level of indirection.
 1628|       |     For instance, we could use a pipeline object, which contains a
 1629|       |     pointer to the first filter in the pipeline.  This is not what we
 1630|       |     do either.
 1631|       |
 1632|       |     Instead, we allocate a new buffer (B) and copy the first filter's
 1633|       |     state into that and use the initial buffer (A) for the new
 1634|       |     filter.  One limitation of this approach is that it is not
 1635|       |     practical to maintain a pointer to a specific filter's state.
 1636|       |
 1637|       |     Before:
 1638|       |
 1639|       |           A
 1640|       |           |
 1641|       |           v 0x100               0x200
 1642|       |           +----------+          +----------+
 1643|       |           | filter x |--------->| filter y |---->....
 1644|       |           +----------+          +----------+
 1645|       |
 1646|       |     After:           B
 1647|       |                      |
 1648|       |                      v 0x300
 1649|       |                      +----------+
 1650|       |           A          | filter x |
 1651|       |           |          +----------+
 1652|       |           v 0x100    ^          v 0x200
 1653|       |           +----------+          +----------+
 1654|       |           | filter w |          | filter y |---->....
 1655|       |           +----------+          +----------+
 1656|       |
 1657|       |     Note: filter x's address changed from 0x100 to 0x300, but A still
 1658|       |     points to the head of the pipeline.
 1659|       |  */
 1660|       |
 1661|  74.5k|  b = xmalloc (sizeof *b);
  ------------------
  |  |  107|  74.5k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 1662|  74.5k|  memcpy (b, a, sizeof *b);
 1663|       |  /* fixme: it is stupid to keep a copy of the name at every level
 1664|       |   * but we need the name somewhere because the name known by file_filter
 1665|       |   * may have been released when we need the name of the file */
 1666|  74.5k|  b->real_fname = a->real_fname ? xstrdup (a->real_fname) : NULL;
  ------------------
  |  |  112|  74.5k|#define xstrdup(a)       gcry_xstrdup ((a))
  ------------------
  |  Branch (1666:19): [True: 74.5k, False: 0]
  ------------------
 1667|       |  /* remove the filter stuff from the new stream */
 1668|  74.5k|  a->filter = NULL;
 1669|  74.5k|  a->filter_ov = NULL;
 1670|  74.5k|  a->filter_ov_owner = 0;
 1671|  74.5k|  a->filter_eof = 0;
 1672|  74.5k|  if (a->use == IOBUF_OUTPUT_TEMP)
  ------------------
  |  Branch (1672:7): [True: 0, False: 74.5k]
  ------------------
 1673|       |    /* A TEMP filter buffers any data sent to it; it does not forward
 1674|       |       any data down the pipeline.  If we add a new filter to the
 1675|       |       pipeline, it shouldn't also buffer data.  It should send it
 1676|       |       downstream to be buffered.  Thus, the correct type for a filter
 1677|       |       added in front of an IOBUF_OUTPUT_TEMP filter is IOBUF_OUPUT, not
 1678|       |       IOBUF_OUTPUT_TEMP.  */
 1679|      0|    {
 1680|      0|      a->use = IOBUF_OUTPUT;
 1681|       |
 1682|       |      /* When pipeline is written to, the temp buffer's size is
 1683|       |	 increased accordingly.  We don't need to allocate a 10 MB
 1684|       |	 buffer for a non-terminal filter.  Just use the default
 1685|       |	 size.  */
 1686|      0|      a->d.size = iobuf_buffer_size;
 1687|      0|    }
 1688|  74.5k|  else if (a->use == IOBUF_INPUT_TEMP)
  ------------------
  |  Branch (1688:12): [True: 0, False: 74.5k]
  ------------------
 1689|       |    /* Same idea as above.  */
 1690|      0|    {
 1691|      0|      a->use = IOBUF_INPUT;
 1692|      0|      a->d.size = iobuf_buffer_size;
 1693|      0|    }
 1694|       |
 1695|       |  /* The new filter (A) gets a new buffer.
 1696|       |
 1697|       |     If the pipeline is an output or temp pipeline, then giving the
 1698|       |     buffer to the new filter means that data that was written before
 1699|       |     the filter was pushed gets sent to the filter.  That's clearly
 1700|       |     wrong.
 1701|       |
 1702|       |     If the pipeline is an input pipeline, then giving the buffer to
 1703|       |     the new filter (A) means that data that has read from (B), but
 1704|       |     not yet read from the pipeline won't be processed by the new
 1705|       |     filter (A)!  That's certainly not what we want.  */
 1706|  74.5k|  a->d.buf = xmalloc (a->d.size);
  ------------------
  |  |  107|  74.5k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 1707|  74.5k|  a->d.len = 0;
 1708|  74.5k|  a->d.start = 0;
 1709|       |
 1710|       |  /* disable nlimit for the new stream */
 1711|  74.5k|  a->ntotal = b->ntotal + b->nbytes;
 1712|  74.5k|  a->nlimit = a->nbytes = 0;
 1713|  74.5k|  a->nofast = 0;
 1714|       |  /* make a link from the new stream to the original stream */
 1715|  74.5k|  a->chain = b;
 1716|       |
 1717|       |  /* setup the function on the new stream */
 1718|  74.5k|  a->filter = f;
 1719|  74.5k|  a->filter_ov = ov;
 1720|  74.5k|  a->filter_ov_owner = rel_ov;
 1721|       |
 1722|  74.5k|  a->subno = b->subno + 1;
 1723|       |
 1724|  74.5k|  if (DBG_IOBUF)
  ------------------
  |  |   98|  74.5k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 74.5k]
  |  |  ------------------
  ------------------
 1725|      0|    {
 1726|      0|      byte desc[MAX_IOBUF_DESC];
 1727|      0|      log_debug ("iobuf-%d.%d: push '%s'\n",
 1728|      0|		 a->no, a->subno, iobuf_desc (a, desc));
 1729|      0|      print_chain (a);
 1730|      0|    }
 1731|       |
 1732|       |  /* now we can initialize the new function if we have one */
 1733|  74.5k|  if (a->filter && (rc = a->filter (a->filter_ov, IOBUFCTRL_INIT, a->chain,
  ------------------
  |  Branch (1733:7): [True: 74.5k, False: 0]
  |  Branch (1733:20): [True: 0, False: 74.5k]
  ------------------
 1734|  74.5k|				    NULL, &dummy_len)))
 1735|      0|    log_error ("IOBUFCTRL_INIT failed: %s\n", gpg_strerror (rc));
 1736|  74.5k|  return rc;
 1737|  74.8k|}
iobuf_readbyte:
 2101|  2.04G|{
 2102|  2.04G|  int c;
 2103|       |
 2104|  2.04G|  if (a->use == IOBUF_OUTPUT || a->use == IOBUF_OUTPUT_TEMP)
  ------------------
  |  Branch (2104:7): [True: 0, False: 2.04G]
  |  Branch (2104:33): [True: 0, False: 2.04G]
  ------------------
 2105|      0|    {
 2106|      0|      log_bug ("iobuf_readbyte called on a non-INPUT pipeline!\n");
 2107|      0|      return -1;
 2108|      0|    }
 2109|       |
 2110|  2.04G|  assert (a->d.start <= a->d.len);
 2111|       |
 2112|  2.04G|  if (a->nlimit && a->nbytes >= a->nlimit)
  ------------------
  |  Branch (2112:7): [True: 0, False: 2.04G]
  |  Branch (2112:20): [True: 0, False: 0]
  ------------------
 2113|      0|    return -1;			/* forced EOF */
 2114|       |
 2115|  2.04G|  if (a->d.start < a->d.len)
  ------------------
  |  Branch (2115:7): [True: 17.5k, False: 2.04G]
  ------------------
 2116|  17.5k|    {
 2117|  17.5k|      c = a->d.buf[a->d.start++];
 2118|  17.5k|    }
 2119|  2.04G|  else if ((c = underflow (a, 1)) == -1)
  ------------------
  |  Branch (2119:12): [True: 2.04G, False: 122k]
  ------------------
 2120|  2.04G|    return -1;			/* EOF */
 2121|       |
 2122|   139k|  assert (a->d.start <= a->d.len);
 2123|       |
 2124|       |  /* Note: if underflow doesn't return EOF, then it returns the first
 2125|       |     byte that was read and advances a->d.start appropriately.  */
 2126|       |
 2127|   139k|  a->nbytes++;
 2128|   139k|  return c;
 2129|   139k|}
iobuf_read:
 2134|   352k|{
 2135|   352k|  unsigned char *buf = (unsigned char *)buffer;
 2136|   352k|  int c, n;
 2137|       |
 2138|   352k|  if (a->use == IOBUF_OUTPUT || a->use == IOBUF_OUTPUT_TEMP)
  ------------------
  |  Branch (2138:7): [True: 0, False: 352k]
  |  Branch (2138:33): [True: 0, False: 352k]
  ------------------
 2139|      0|    {
 2140|      0|      log_bug ("iobuf_read called on a non-INPUT pipeline!\n");
 2141|      0|      return -1;
 2142|      0|    }
 2143|       |
 2144|   352k|  if (a->nlimit)
  ------------------
  |  Branch (2144:7): [True: 0, False: 352k]
  ------------------
 2145|      0|    {
 2146|       |      /* Handle special cases. */
 2147|      0|      for (n = 0; n < buflen; n++)
  ------------------
  |  Branch (2147:19): [True: 0, False: 0]
  ------------------
 2148|      0|	{
 2149|      0|	  if ((c = iobuf_readbyte (a)) == -1)
  ------------------
  |  Branch (2149:8): [True: 0, False: 0]
  ------------------
 2150|      0|	    {
 2151|      0|	      if (!n)
  ------------------
  |  Branch (2151:12): [True: 0, False: 0]
  ------------------
 2152|      0|		return -1;	/* eof */
 2153|      0|	      break;
 2154|      0|	    }
 2155|       |
 2156|      0|	  if (buf)
  ------------------
  |  Branch (2156:8): [True: 0, False: 0]
  ------------------
 2157|      0|	    {
 2158|      0|	      *buf = c;
 2159|      0|	      buf++;
 2160|      0|	    }
 2161|      0|	}
 2162|      0|      return n;
 2163|      0|    }
 2164|       |
 2165|   352k|  a->e_d.buf = NULL;
 2166|   352k|  a->e_d.len = 0;
 2167|       |
 2168|       |  /* Hint for how full to fill iobuf internal drain buffer. */
 2169|   352k|  a->e_d.preferred = (a->use != IOBUF_INPUT_TEMP)
  ------------------
  |  Branch (2169:22): [True: 352k, False: 0]
  ------------------
 2170|   352k|    && (buf && buflen >= IOBUF_ZEROCOPY_THRESHOLD_SIZE);
  ------------------
  |  |   71|   301k|#define IOBUF_ZEROCOPY_THRESHOLD_SIZE 1024
  ------------------
  |  Branch (2170:9): [True: 301k, False: 51.7k]
  |  Branch (2170:16): [True: 80.8k, False: 220k]
  ------------------
 2171|       |
 2172|   352k|  n = 0;
 2173|   352k|  do
 2174|   458k|    {
 2175|   458k|      if (n < buflen && a->d.start < a->d.len)
  ------------------
  |  Branch (2175:11): [True: 458k, False: 0]
  |  Branch (2175:25): [True: 413k, False: 45.2k]
  ------------------
 2176|       |	/* Drain the buffer.  */
 2177|   413k|	{
 2178|   413k|	  unsigned size = a->d.len - a->d.start;
 2179|   413k|	  if (size > buflen - n)
  ------------------
  |  Branch (2179:8): [True: 291k, False: 121k]
  ------------------
 2180|   291k|	    size = buflen - n;
 2181|   413k|	  if (buf)
  ------------------
  |  Branch (2181:8): [True: 374k, False: 38.6k]
  ------------------
 2182|   374k|	    memcpy (buf, a->d.buf + a->d.start, size);
 2183|   413k|	  n += size;
 2184|   413k|	  a->d.start += size;
 2185|   413k|	  if (buf)
  ------------------
  |  Branch (2185:8): [True: 374k, False: 38.6k]
  ------------------
 2186|   374k|	    buf += size;
 2187|   413k|	}
 2188|   458k|      if (n < buflen)
  ------------------
  |  Branch (2188:11): [True: 150k, False: 308k]
  ------------------
 2189|       |	/* Draining the internal buffer didn't fill BUFFER.  Call
 2190|       |	   underflow to read more data into the filter's internal
 2191|       |	   buffer.  */
 2192|   150k|	{
 2193|   150k|	  if (a->use != IOBUF_INPUT_TEMP && buf && n < buflen)
  ------------------
  |  Branch (2193:8): [True: 150k, False: 0]
  |  Branch (2193:38): [True: 96.9k, False: 53.3k]
  |  Branch (2193:45): [True: 96.9k, False: 0]
  ------------------
 2194|  96.9k|	    {
 2195|       |	      /* Setup external drain buffer for faster moving of data
 2196|       |	       * (avoid memcpy). */
 2197|  96.9k|	      a->e_d.buf = buf;
 2198|  96.9k|	      a->e_d.len = (buflen - n) / IOBUF_ZEROCOPY_THRESHOLD_SIZE
  ------------------
  |  |   71|  96.9k|#define IOBUF_ZEROCOPY_THRESHOLD_SIZE 1024
  ------------------
 2199|  96.9k|			    * IOBUF_ZEROCOPY_THRESHOLD_SIZE;
  ------------------
  |  |   71|  96.9k|#define IOBUF_ZEROCOPY_THRESHOLD_SIZE 1024
  ------------------
 2200|  96.9k|	      if (a->e_d.len == 0)
  ------------------
  |  Branch (2200:12): [True: 82.6k, False: 14.3k]
  ------------------
 2201|  82.6k|		a->e_d.buf = NULL;
 2202|  96.9k|	      if (a->e_d.buf && DBG_IOBUF)
  ------------------
  |  |   98|  14.3k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 14.3k]
  |  |  ------------------
  ------------------
  |  Branch (2202:12): [True: 14.3k, False: 82.6k]
  ------------------
 2203|      0|		log_debug ("iobuf-%d.%d: reading to external buffer, %lu bytes\n",
 2204|      0|			   a->no, a->subno, (ulong)a->e_d.len);
 2205|  96.9k|	    }
 2206|       |
 2207|   150k|	  if ((c = underflow (a, 1)) == -1)
  ------------------
  |  Branch (2207:8): [True: 44.4k, False: 105k]
  ------------------
 2208|       |	    /* EOF.  If we managed to read something, don't return EOF
 2209|       |	       now.  */
 2210|  44.4k|	    {
 2211|  44.4k|	      a->e_d.buf = NULL;
 2212|  44.4k|	      a->e_d.len = 0;
 2213|  44.4k|	      a->nbytes += n;
 2214|  44.4k|	      return n ? n : -1 /*EOF*/;
  ------------------
  |  Branch (2214:15): [True: 22.3k, False: 22.1k]
  ------------------
 2215|  44.4k|	    }
 2216|       |
 2217|   105k|	  if (a->e_d.buf && a->e_d.used > 0)
  ------------------
  |  Branch (2217:8): [True: 8.31k, False: 97.4k]
  |  Branch (2217:22): [True: 8.31k, False: 0]
  ------------------
 2218|  8.31k|	    {
 2219|       |	      /* Drain buffer was used, 'c' only contains return code
 2220|       |	       * 0 or -1. */
 2221|  8.31k|	      n += a->e_d.used;
 2222|  8.31k|	      buf += a->e_d.used;
 2223|  8.31k|	    }
 2224|  97.4k|	  else
 2225|  97.4k|	    {
 2226|  97.4k|	      if (buf)
  ------------------
  |  Branch (2226:12): [True: 78.9k, False: 18.5k]
  ------------------
 2227|  78.9k|		*buf++ = c;
 2228|  97.4k|	      n++;
 2229|  97.4k|	    }
 2230|       |
 2231|   105k|	  a->e_d.buf = NULL;
 2232|   105k|	  a->e_d.len = 0;
 2233|   105k|	}
 2234|   458k|    }
 2235|   414k|  while (n < buflen);
  ------------------
  |  Branch (2235:10): [True: 105k, False: 308k]
  ------------------
 2236|   308k|  a->nbytes += n;
 2237|   308k|  return n;
 2238|   352k|}
iobuf_peek:
 2244|  24.4k|{
 2245|  24.4k|  int n = 0;
 2246|       |
 2247|  24.4k|  assert (buflen > 0);
 2248|  24.4k|  assert (a->use == IOBUF_INPUT || a->use == IOBUF_INPUT_TEMP);
 2249|       |
 2250|  24.4k|  if (buflen > a->d.size)
  ------------------
  |  Branch (2250:7): [True: 0, False: 24.4k]
  ------------------
 2251|       |    /* We can't peek more than we can buffer.  */
 2252|      0|    buflen = a->d.size;
 2253|       |
 2254|       |  /* Try to fill the internal buffer with enough data to satisfy the
 2255|       |     request.  */
 2256|  48.8k|  while (buflen > a->d.len - a->d.start)
  ------------------
  |  Branch (2256:10): [True: 24.5k, False: 24.3k]
  ------------------
 2257|  24.5k|    {
 2258|  24.5k|      if (underflow_target (a, 0, buflen) == -1)
  ------------------
  |  Branch (2258:11): [True: 60, False: 24.4k]
  ------------------
 2259|       |	/* EOF.  We can't read any more.  */
 2260|     60|	break;
 2261|       |
 2262|       |      /* Underflow consumes the first character (it's the return
 2263|       |	 value).  unget() it by resetting the "file position".  */
 2264|  24.4k|      assert (a->d.start == 1);
 2265|  24.4k|      a->d.start = 0;
 2266|  24.4k|    }
 2267|       |
 2268|  24.4k|  n = a->d.len - a->d.start;
 2269|  24.4k|  if (n > buflen)
  ------------------
  |  Branch (2269:7): [True: 23.7k, False: 604]
  ------------------
 2270|  23.7k|    n = buflen;
 2271|       |
 2272|  24.4k|  if (n == 0)
  ------------------
  |  Branch (2272:7): [True: 0, False: 24.4k]
  ------------------
 2273|       |    /* EOF.  */
 2274|      0|    return -1;
 2275|       |
 2276|  24.4k|  memcpy (buf, &a->d.buf[a->d.start], n);
 2277|       |
 2278|  24.4k|  return n;
 2279|  24.4k|}
iobuf_get_fd:
 2580|  24.4k|{
 2581|  24.4k|  for (; a->chain; a = a->chain)
  ------------------
  |  Branch (2581:10): [True: 0, False: 24.4k]
  ------------------
 2582|      0|    ;
 2583|       |
 2584|  24.4k|  if (a->filter != file_filter)
  ------------------
  |  Branch (2584:7): [True: 0, False: 24.4k]
  ------------------
 2585|      0|    return -1;
 2586|       |
 2587|  24.4k|  {
 2588|  24.4k|    file_filter_ctx_t *b = a->filter_ov;
 2589|  24.4k|    gnupg_fd_t fp = b->fp;
 2590|       |
 2591|  24.4k|    return FD2INT (fp);
  ------------------
  |  |   46|  24.4k|#define FD2INT(h) (h)
  ------------------
 2592|  24.4k|  }
 2593|  24.4k|}
iobuf_set_partial_body_length_mode:
 2745|  68.1k|{
 2746|  68.1k|  if (!len)
  ------------------
  |  Branch (2746:7): [True: 0, False: 68.1k]
  ------------------
 2747|       |    /* Disable partial body length mode.  */
 2748|      0|    {
 2749|      0|      if (a->use == IOBUF_INPUT)
  ------------------
  |  Branch (2749:11): [True: 0, False: 0]
  ------------------
 2750|      0|	log_debug ("iobuf_pop_filter called in set_partial_block_mode"
 2751|      0|		   " - please report\n");
 2752|       |
 2753|      0|      log_assert (a->filter == block_filter);
 2754|      0|      iobuf_pop_filter (a, block_filter, NULL);
 2755|      0|    }
 2756|  68.1k|  else
 2757|       |    /* Enabled partial body length mode.  */
 2758|  68.1k|    {
 2759|  68.1k|      block_filter_ctx_t *ctx = xcalloc (1, sizeof *ctx);
  ------------------
  |  |  109|  68.1k|#define xcalloc(a,b)     gcry_xcalloc ((a),(b))
  ------------------
 2760|  68.1k|      ctx->use = a->use;
 2761|  68.1k|      ctx->partial = 1;
 2762|  68.1k|      ctx->size = 0;
 2763|  68.1k|      ctx->first_c = len;
 2764|  68.1k|      iobuf_push_filter (a, block_filter, ctx);
 2765|  68.1k|    }
 2766|  68.1k|}
iobuf_read_line:
 2773|  8.01M|{
 2774|  8.01M|  int c;
 2775|  8.01M|  char *buffer = (char *)*addr_of_buffer;
 2776|  8.01M|  unsigned length = *length_of_buffer;
 2777|  8.01M|  unsigned nbytes = 0;
 2778|  8.01M|  unsigned maxlen = *max_length;
 2779|  8.01M|  char *p;
 2780|       |
 2781|       |  /* The code assumes that we have space for at least a newline and a
 2782|       |     NUL character in the buffer.  This requires at least 2 bytes.  We
 2783|       |     don't complicate the code by handling the stupid corner case, but
 2784|       |     simply assert that it can't happen.  */
 2785|  8.01M|  assert (!buffer || length >= 2 || maxlen >= 2);
 2786|       |
 2787|  8.01M|  if (!buffer || length <= 1)
  ------------------
  |  Branch (2787:7): [True: 6.66k, False: 8.00M]
  |  Branch (2787:18): [True: 0, False: 8.00M]
  ------------------
 2788|       |    /* must allocate a new buffer */
 2789|  6.66k|    {
 2790|  6.66k|      length = 256 <= maxlen ? 256 : maxlen;
  ------------------
  |  Branch (2790:16): [True: 6.66k, False: 0]
  ------------------
 2791|  6.66k|      buffer = xrealloc (buffer, length);
  ------------------
  |  |  111|  6.66k|#define xrealloc(a,b)    gcry_xrealloc ((a),(b))
  ------------------
 2792|  6.66k|      *addr_of_buffer = (unsigned char *)buffer;
 2793|  6.66k|      *length_of_buffer = length;
 2794|  6.66k|    }
 2795|       |
 2796|  8.01M|  p = buffer;
 2797|  8.03M|  while (1)
  ------------------
  |  Branch (2797:10): [Folded - Ignored]
  ------------------
 2798|  8.03M|    {
 2799|  8.03M|      if (!a->nofast && a->d.start < a->d.len && nbytes < length - 1)
  ------------------
  |  Branch (2799:11): [True: 8.03M, False: 0]
  |  Branch (2799:25): [True: 8.01M, False: 12.0k]
  |  Branch (2799:50): [True: 8.01M, False: 0]
  ------------------
 2800|       |	/* Fast path for finding '\n' by using standard C library's optimized
 2801|       |	   memchr.  */
 2802|  8.01M|	{
 2803|  8.01M|	  unsigned size = a->d.len - a->d.start;
 2804|  8.01M|	  byte *newline_pos;
 2805|       |
 2806|  8.01M|	  if (size > length - 1 - nbytes)
  ------------------
  |  Branch (2806:8): [True: 7.83M, False: 180k]
  ------------------
 2807|  7.83M|	    size = length - 1 - nbytes;
 2808|       |
 2809|  8.01M|	  newline_pos = memchr (a->d.buf + a->d.start, '\n', size);
 2810|  8.01M|	  if (newline_pos)
  ------------------
  |  Branch (2810:8): [True: 8.00M, False: 18.7k]
  ------------------
 2811|  8.00M|	    {
 2812|       |	      /* Found newline, copy buffer and return. */
 2813|  8.00M|	      size = (newline_pos - (a->d.buf + a->d.start)) + 1;
 2814|  8.00M|	      memcpy (p, a->d.buf + a->d.start, size);
 2815|  8.00M|	      p += size;
 2816|  8.00M|	      nbytes += size;
 2817|  8.00M|	      a->d.start += size;
 2818|  8.00M|	      a->nbytes += size;
 2819|  8.00M|	      break;
 2820|  8.00M|	    }
 2821|  18.7k|	  else
 2822|  18.7k|	    {
 2823|       |	      /* No newline, copy buffer and continue. */
 2824|  18.7k|	      memcpy (p, a->d.buf + a->d.start, size);
 2825|  18.7k|	      p += size;
 2826|  18.7k|	      nbytes += size;
 2827|  18.7k|	      a->d.start += size;
 2828|  18.7k|	      a->nbytes += size;
 2829|  18.7k|	    }
 2830|  8.01M|	}
 2831|  12.0k|      else
 2832|  12.0k|	{
 2833|  12.0k|	  c = iobuf_readbyte (a);
 2834|  12.0k|	  if (c == -1)
  ------------------
  |  Branch (2834:8): [True: 11.5k, False: 503]
  ------------------
 2835|  11.5k|	    break;
 2836|    503|	  *p++ = c;
 2837|    503|	  nbytes++;
 2838|    503|	  if (c == '\n')
  ------------------
  |  Branch (2838:8): [True: 102, False: 401]
  ------------------
 2839|    102|	    break;
 2840|    503|	}
 2841|       |
 2842|  19.1k|      if (nbytes == length - 1)
  ------------------
  |  Branch (2842:11): [True: 13.7k, False: 5.38k]
  ------------------
 2843|       |	/* We don't have enough space to add a \n and a \0.  Increase
 2844|       |	   the buffer size.  */
 2845|  13.7k|	{
 2846|  13.7k|	  if (length == maxlen)
  ------------------
  |  Branch (2846:8): [True: 716, False: 13.0k]
  ------------------
 2847|       |	    /* We reached the buffer's size limit!  */
 2848|    716|	    {
 2849|       |	      /* Skip the rest of the line.  */
 2850|  5.48M|	      while ((c = iobuf_get (a)) != -1 && c != '\n')
  ------------------
  |  |  500|  5.48M|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 5.48M]
  |  |  |  Branch (500:24): [True: 196, False: 5.48M]
  |  |  ------------------
  |  |  501|  5.48M|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (2850:15): [True: 5.48M, False: 112]
  |  Branch (2850:44): [True: 5.48M, False: 604]
  ------------------
 2851|  5.48M|		;
 2852|       |
 2853|       |	      /* p is pointing at the last byte in the buffer.  We
 2854|       |		 always terminate the line with "\n\0" so overwrite
 2855|       |		 the previous byte with a \n.  */
 2856|    716|	      assert (p > buffer);
 2857|    716|	      p[-1] = '\n';
 2858|       |
 2859|       |	      /* Indicate truncation.  */
 2860|    716|	      *max_length = 0;
 2861|    716|	      break;
 2862|    716|	    }
 2863|       |
 2864|  13.0k|	  length += length < 1024 ? 256 : 1024;
  ------------------
  |  Branch (2864:14): [True: 3.77k, False: 9.27k]
  ------------------
 2865|  13.0k|	  if (length > maxlen)
  ------------------
  |  Branch (2865:8): [True: 279, False: 12.7k]
  ------------------
 2866|    279|	    length = maxlen;
 2867|       |
 2868|  13.0k|	  buffer = xrealloc (buffer, length);
  ------------------
  |  |  111|  13.0k|#define xrealloc(a,b)    gcry_xrealloc ((a),(b))
  ------------------
 2869|  13.0k|	  *addr_of_buffer = (unsigned char *)buffer;
 2870|  13.0k|	  *length_of_buffer = length;
 2871|  13.0k|	  p = buffer + nbytes;
 2872|  13.0k|	}
 2873|  19.1k|    }
 2874|       |  /* Add the terminating NUL.  */
 2875|  8.01M|  *p = 0;
 2876|       |
 2877|       |  /* Return the number of characters written to the buffer including
 2878|       |     the newline, but not including the terminating NUL.  */
 2879|  8.01M|  return nbytes;
 2880|  8.01M|}
iobuf_skip_rest:
 2915|   535k|{
 2916|   535k|  if ( partial )
  ------------------
  |  Branch (2916:8): [True: 0, False: 535k]
  ------------------
 2917|      0|    {
 2918|      0|      for (;;)
 2919|      0|        {
 2920|      0|          if (a->nofast || a->d.start >= a->d.len)
  ------------------
  |  Branch (2920:15): [True: 0, False: 0]
  |  Branch (2920:28): [True: 0, False: 0]
  ------------------
 2921|      0|            {
 2922|      0|              if (iobuf_readbyte (a) == -1)
  ------------------
  |  Branch (2922:19): [True: 0, False: 0]
  ------------------
 2923|      0|                {
 2924|      0|                  break;
 2925|      0|                }
 2926|      0|	    }
 2927|      0|          else
 2928|      0|            {
 2929|      0|              unsigned long count = a->d.len - a->d.start;
 2930|      0|              a->nbytes += count;
 2931|      0|              a->d.start = a->d.len;
 2932|      0|	    }
 2933|      0|	}
 2934|      0|    }
 2935|   535k|  else
 2936|   535k|    {
 2937|   535k|      unsigned long remaining = n;
 2938|   675k|      while (remaining > 0)
  ------------------
  |  Branch (2938:14): [True: 161k, False: 514k]
  ------------------
 2939|   161k|        {
 2940|   161k|          if (a->nofast || a->d.start >= a->d.len)
  ------------------
  |  Branch (2940:15): [True: 0, False: 161k]
  |  Branch (2940:28): [True: 40.8k, False: 120k]
  ------------------
 2941|  40.8k|            {
 2942|  40.8k|              if (iobuf_readbyte (a) == -1)
  ------------------
  |  Branch (2942:19): [True: 20.5k, False: 20.3k]
  ------------------
 2943|  20.5k|                {
 2944|  20.5k|                  break;
 2945|  20.5k|		}
 2946|  20.3k|              --remaining;
 2947|  20.3k|	    }
 2948|   120k|          else
 2949|   120k|            {
 2950|   120k|              unsigned long count = a->d.len - a->d.start;
 2951|   120k|              if (count > remaining)
  ------------------
  |  Branch (2951:19): [True: 94.9k, False: 25.1k]
  ------------------
 2952|  94.9k|                {
 2953|  94.9k|                  count = remaining;
 2954|  94.9k|		}
 2955|   120k|              a->nbytes += count;
 2956|   120k|              a->d.start += count;
 2957|   120k|              remaining -= count;
 2958|   120k|	    }
 2959|   161k|	}
 2960|   535k|    }
 2961|   535k|}
iobuf.c:print_chain:
 1160|  67.5k|{
 1161|  67.5k|  if (!DBG_IOBUF)
  ------------------
  |  |   98|  67.5k|#define DBG_IOBUF   iobuf_debug_mode
  ------------------
  |  Branch (1161:7): [True: 67.5k, False: 0]
  ------------------
 1162|  67.5k|    return;
 1163|      0|  for (; a; a = a->chain)
  ------------------
  |  Branch (1163:10): [True: 0, False: 0]
  ------------------
 1164|      0|    {
 1165|      0|      byte desc[MAX_IOBUF_DESC];
 1166|       |
 1167|      0|      log_debug ("iobuf chain: %d.%d '%s' filter_eof=%d start=%d len=%d\n",
 1168|      0|		 a->no, a->subno, iobuf_desc (a, desc), a->filter_eof,
 1169|      0|		 (int) a->d.start, (int) a->d.len);
 1170|      0|    }
 1171|      0|}
iobuf.c:do_open:
 1329|  24.4k|{
 1330|  24.4k|  iobuf_t a;
 1331|  24.4k|  gnupg_fd_t fp;
 1332|  24.4k|  file_filter_ctx_t *fcx;
 1333|  24.4k|  size_t len = 0;
 1334|  24.4k|  int print_only = 0;
 1335|  24.4k|  int fd;
 1336|  24.4k|  byte desc[MAX_IOBUF_DESC];
 1337|       |
 1338|  24.4k|  assert (use == IOBUF_INPUT || use == IOBUF_OUTPUT);
 1339|       |
 1340|  24.4k|  if (special_filenames
  ------------------
  |  Branch (1340:7): [True: 24.4k, False: 0]
  ------------------
 1341|       |      /* NULL or '-'.  */
 1342|  24.4k|      && (!fname || (*fname == '-' && !fname[1])))
  ------------------
  |  Branch (1342:11): [True: 0, False: 24.4k]
  |  Branch (1342:22): [True: 0, False: 24.4k]
  |  Branch (1342:39): [True: 0, False: 0]
  ------------------
 1343|      0|    {
 1344|      0|      if (use == IOBUF_INPUT)
  ------------------
  |  Branch (1344:11): [True: 0, False: 0]
  ------------------
 1345|      0|	{
 1346|      0|	  fp = FD_FOR_STDIN;
  ------------------
  |  |   84|      0|# define FD_FOR_STDIN  (0)
  ------------------
 1347|      0|	  fname = "[stdin]";
 1348|      0|	}
 1349|      0|      else
 1350|      0|	{
 1351|      0|	  fp = FD_FOR_STDOUT;
  ------------------
  |  |   85|      0|# define FD_FOR_STDOUT (1)
  ------------------
 1352|      0|	  fname = "[stdout]";
 1353|      0|	}
 1354|      0|      print_only = 1;
 1355|      0|    }
 1356|  24.4k|  else if (!fname)
  ------------------
  |  Branch (1356:12): [True: 0, False: 24.4k]
  ------------------
 1357|      0|    return NULL;
 1358|  24.4k|  else if (special_filenames
  ------------------
  |  Branch (1358:12): [True: 24.4k, False: 0]
  ------------------
 1359|  24.4k|           && (fd = check_special_filename (fname, 0, 1)) != -1)
  ------------------
  |  Branch (1359:15): [True: 0, False: 24.4k]
  ------------------
 1360|      0|    return iobuf_fdopen (translate_file_handle (fd, use == IOBUF_INPUT ? 0 : 1),
  ------------------
  |  Branch (1360:53): [True: 0, False: 0]
  ------------------
 1361|      0|			 opentype);
 1362|  24.4k|  else
 1363|  24.4k|    {
 1364|  24.4k|      if (use == IOBUF_INPUT)
  ------------------
  |  Branch (1364:11): [True: 24.4k, False: 1]
  ------------------
 1365|  24.4k|	fp = fd_cache_open (fname, opentype);
 1366|      1|      else
 1367|      1|	fp = direct_open (fname, opentype, mode700);
 1368|  24.4k|      if (fp == GNUPG_INVALID_FD)
  ------------------
  |  |   44|  24.4k|#define GNUPG_INVALID_FD (-1)
  ------------------
  |  Branch (1368:11): [True: 0, False: 24.4k]
  ------------------
 1369|      0|	return NULL;
 1370|  24.4k|    }
 1371|       |
 1372|  24.4k|  a = iobuf_alloc (use, iobuf_buffer_size);
 1373|  24.4k|  fcx = xmalloc (sizeof *fcx + strlen (fname));
  ------------------
  |  |  107|  24.4k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 1374|  24.4k|  fcx->fp = fp;
 1375|  24.4k|  fcx->print_only_name = print_only;
 1376|  24.4k|  strcpy (fcx->fname, fname);
 1377|  24.4k|  if (!print_only)
  ------------------
  |  Branch (1377:7): [True: 24.4k, False: 0]
  ------------------
 1378|  24.4k|    a->real_fname = xstrdup (fname);
  ------------------
  |  |  112|  24.4k|#define xstrdup(a)       gcry_xstrdup ((a))
  ------------------
 1379|  24.4k|  a->filter = file_filter;
 1380|  24.4k|  a->filter_ov = fcx;
 1381|  24.4k|  file_filter (fcx, IOBUFCTRL_INIT, NULL, NULL, &len);
 1382|  24.4k|  if (DBG_IOBUF)
  ------------------
  |  |   98|  24.4k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 24.4k]
  |  |  ------------------
  ------------------
 1383|      0|    log_debug ("iobuf-%d.%d: open '%s' desc=%s fd=%d\n",
 1384|      0|	       a->no, a->subno, fname, iobuf_desc (a, desc), FD2INT (fcx->fp));
  ------------------
  |  |   46|      0|#define FD2INT(h) (h)
  ------------------
 1385|       |
 1386|  24.4k|  return a;
 1387|  24.4k|}
iobuf.c:fd_cache_open:
  411|  24.4k|{
  412|  24.4k|  close_cache_t cc;
  413|       |
  414|  24.4k|  assert (fname);
  415|  48.8k|  for (cc = close_cache; cc; cc = cc->next)
  ------------------
  |  Branch (415:26): [True: 36.6k, False: 12.2k]
  ------------------
  416|  36.6k|    {
  417|  36.6k|      if (cc->fp != GNUPG_INVALID_FD && !fd_cache_strcmp (cc->fname, fname))
  ------------------
  |  |   44|  73.2k|#define GNUPG_INVALID_FD (-1)
  ------------------
  |  Branch (417:11): [True: 12.2k, False: 24.4k]
  |  Branch (417:41): [True: 12.2k, False: 0]
  ------------------
  418|  12.2k|	{
  419|  12.2k|	  gnupg_fd_t fp = cc->fp;
  420|  12.2k|	  cc->fp = GNUPG_INVALID_FD;
  ------------------
  |  |   44|  12.2k|#define GNUPG_INVALID_FD (-1)
  ------------------
  421|  12.2k|	  if (DBG_IOBUF)
  ------------------
  |  |   98|  12.2k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 12.2k]
  |  |  ------------------
  ------------------
  422|      0|	    log_debug ("fd_cache_open (%s) using cached fp\n", fname);
  423|       |#ifdef HAVE_W32_SYSTEM
  424|       |	  if (SetFilePointer (fp, 0, NULL, FILE_BEGIN) == 0xffffffff)
  425|       |	    {
  426|       |	      log_error ("rewind file failed on handle %p: ec=%d\n",
  427|       |			 fp, (int) GetLastError ());
  428|       |	      fp = GNUPG_INVALID_FD;
  429|       |	    }
  430|       |#else
  431|  12.2k|	  if (lseek (fp, 0, SEEK_SET) == (off_t) - 1)
  ------------------
  |  Branch (431:8): [True: 0, False: 12.2k]
  ------------------
  432|      0|	    {
  433|      0|	      log_error ("can't rewind fd %d: %s\n", fp, strerror (errno));
  434|      0|	      fp = GNUPG_INVALID_FD;
  ------------------
  |  |   44|      0|#define GNUPG_INVALID_FD (-1)
  ------------------
  435|      0|	    }
  436|  12.2k|#endif
  437|  12.2k|	  return fp;
  438|  12.2k|	}
  439|  36.6k|    }
  440|  12.2k|  if (DBG_IOBUF)
  ------------------
  |  |   98|  12.2k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 12.2k]
  |  |  ------------------
  ------------------
  441|      0|    log_debug ("fd_cache_open (%s) not cached\n", fname);
  442|  12.2k|  return direct_open (fname, mode, 0);
  443|  24.4k|}
iobuf.c:fd_cache_strcmp:
  186|  24.4k|{
  187|       |#ifdef HAVE_DOSISH_SYSTEM
  188|       |  for (; *a && *b; a++, b++)
  189|       |    {
  190|       |      if (*a != *b && !((*a == '/' && *b == '\\')
  191|       |                        || (*a == '\\' && *b == '/')) )
  192|       |        break;
  193|       |    }
  194|       |  return *(const unsigned char *)a - *(const unsigned char *)b;
  195|       |#else
  196|  24.4k|  return strcmp (a, b);
  197|  24.4k|#endif
  198|  24.4k|}
iobuf.c:direct_open:
  267|  12.2k|{
  268|       |#ifdef HAVE_W32_SYSTEM
  269|       |  unsigned long da, cd, sm;
  270|       |  HANDLE hfile;
  271|       |
  272|       |  (void)mode700;
  273|       |  /* Note, that we do not handle all mode combinations */
  274|       |
  275|       |  /* According to the ReactOS source it seems that open() of the
  276|       |   * standard MSW32 crt does open the file in shared mode which is
  277|       |   * something new for MS applications ;-)
  278|       |   */
  279|       |  if (strchr (mode, '+'))
  280|       |    {
  281|       |      if (fd_cache_invalidate (fname))
  282|       |        return GNUPG_INVALID_FD;
  283|       |      da = GENERIC_READ | GENERIC_WRITE;
  284|       |      cd = OPEN_EXISTING;
  285|       |      sm = FILE_SHARE_READ | FILE_SHARE_WRITE;
  286|       |    }
  287|       |  else if (strchr (mode, 'w'))
  288|       |    {
  289|       |      if (fd_cache_invalidate (fname))
  290|       |        return GNUPG_INVALID_FD;
  291|       |      da = GENERIC_WRITE;
  292|       |      cd = CREATE_ALWAYS;
  293|       |      sm = FILE_SHARE_WRITE;
  294|       |    }
  295|       |  else
  296|       |    {
  297|       |      da = GENERIC_READ;
  298|       |      cd = OPEN_EXISTING;
  299|       |      sm = FILE_SHARE_READ;
  300|       |    }
  301|       |
  302|       |  /* We always use the Unicode version because it supports file names
  303|       |   * longer than MAX_PATH.  (requires gpgrt 1.45) */
  304|       |  if (1)
  305|       |    {
  306|       |      wchar_t *wfname = gpgrt_fname_to_wchar (fname);
  307|       |      if (wfname)
  308|       |        {
  309|       |          hfile = CreateFileW (wfname, da, sm, NULL, cd,
  310|       |                               FILE_ATTRIBUTE_NORMAL, NULL);
  311|       |          xfree (wfname);
  312|       |        }
  313|       |      else
  314|       |        hfile = INVALID_HANDLE_VALUE;
  315|       |    }
  316|       |
  317|       |  return hfile;
  318|       |
  319|       |#else /*!HAVE_W32_SYSTEM*/
  320|       |
  321|  12.2k|  int oflag;
  322|  12.2k|  int cflag = S_IRUSR | S_IWUSR;
  323|       |
  324|  12.2k|  if (!mode700)
  ------------------
  |  Branch (324:7): [True: 12.2k, False: 0]
  ------------------
  325|  12.2k|    cflag |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
  326|       |
  327|       |  /* Note, that we do not handle all mode combinations */
  328|  12.2k|  if (strchr (mode, '+'))
  ------------------
  |  Branch (328:7): [True: 0, False: 12.2k]
  ------------------
  329|      0|    {
  330|      0|      if (fd_cache_invalidate (fname))
  ------------------
  |  Branch (330:11): [True: 0, False: 0]
  ------------------
  331|      0|        return GNUPG_INVALID_FD;
  ------------------
  |  |   44|      0|#define GNUPG_INVALID_FD (-1)
  ------------------
  332|      0|      oflag = O_RDWR;
  333|      0|    }
  334|  12.2k|  else if (strchr (mode, 'w'))
  ------------------
  |  Branch (334:12): [True: 1, False: 12.2k]
  ------------------
  335|      1|    {
  336|      1|      if (fd_cache_invalidate (fname))
  ------------------
  |  Branch (336:11): [True: 0, False: 1]
  ------------------
  337|      0|        return GNUPG_INVALID_FD;
  ------------------
  |  |   44|      0|#define GNUPG_INVALID_FD (-1)
  ------------------
  338|      1|      oflag = O_WRONLY | O_CREAT | O_TRUNC;
  339|      1|    }
  340|  12.2k|  else
  341|  12.2k|    {
  342|  12.2k|      oflag = O_RDONLY;
  343|  12.2k|    }
  344|       |#ifdef O_BINARY
  345|       |  if (strchr (mode, 'b'))
  346|       |    oflag |= O_BINARY;
  347|       |#endif
  348|       |
  349|       |#ifdef __riscos__
  350|       |  {
  351|       |    struct stat buf;
  352|       |
  353|       |    /* Don't allow iobufs on directories */
  354|       |    if (!stat (fname, &buf) && S_ISDIR (buf.st_mode) && !S_ISREG (buf.st_mode))
  355|       |      return __set_errno (EISDIR);
  356|       |  }
  357|       |#endif
  358|  12.2k|  return open (fname, oflag, cflag);
  359|       |
  360|  12.2k|#endif /*!HAVE_W32_SYSTEM*/
  361|  12.2k|}
iobuf.c:file_filter:
  449|  99.9k|{
  450|  99.9k|  file_filter_ctx_t *a = opaque;
  451|  99.9k|  gnupg_fd_t f = a->fp;
  452|  99.9k|  size_t size = *ret_len;
  453|  99.9k|  size_t nbytes = 0;
  454|  99.9k|  int rc = 0;
  455|       |
  456|  99.9k|  (void)chain; /* Not used.  */
  457|       |
  458|  99.9k|  if (control == IOBUFCTRL_UNDERFLOW)
  ------------------
  |  Branch (458:7): [True: 51.1k, False: 48.8k]
  ------------------
  459|  51.1k|    {
  460|  51.1k|      log_assert (size); /* We need a buffer.  */
  461|  51.1k|      if (a->eof_seen)
  ------------------
  |  Branch (461:11): [True: 0, False: 51.1k]
  ------------------
  462|      0|	{
  463|      0|	  rc = -1;
  464|      0|	  *ret_len = 0;
  465|      0|	}
  466|  51.1k|      else if (a->delayed_rc)
  ------------------
  |  Branch (466:16): [True: 22.5k, False: 28.6k]
  ------------------
  467|  22.5k|        {
  468|  22.5k|          rc = a->delayed_rc;
  469|  22.5k|          a->delayed_rc = 0;
  470|  22.5k|          if (rc == -1)
  ------------------
  |  Branch (470:15): [True: 22.5k, False: 0]
  ------------------
  471|  22.5k|            a->eof_seen = -1;
  472|  22.5k|	  *ret_len = 0;
  473|  22.5k|        }
  474|  28.6k|      else
  475|  28.6k|	{
  476|       |#ifdef HAVE_W32_SYSTEM
  477|       |	  unsigned long nread;
  478|       |
  479|       |	  nbytes = 0;
  480|       |	  if (!ReadFile (f, buf, size, &nread, NULL))
  481|       |	    {
  482|       |	      int ec = (int) GetLastError ();
  483|       |	      if (ec != ERROR_BROKEN_PIPE)
  484|       |		{
  485|       |		  rc = gpg_error_from_errno (ec);
  486|       |		  log_error ("%s: read error: ec=%d\n", a->fname, ec);
  487|       |		}
  488|       |	    }
  489|       |	  else if (!nread)
  490|       |	    {
  491|       |	      a->eof_seen = 1;
  492|       |	      rc = -1;
  493|       |	    }
  494|       |	  else
  495|       |	    {
  496|       |	      nbytes = nread;
  497|       |	    }
  498|       |
  499|       |#else
  500|       |
  501|  28.6k|	  int n;
  502|       |
  503|  28.6k|	  nbytes = 0;
  504|  52.9k|        read_more:
  505|  52.9k|          do
  506|  52.9k|            {
  507|  52.9k|              n = read (f, buf + nbytes, size - nbytes);
  508|  52.9k|            }
  509|  52.9k|          while (n == -1 && errno == EINTR);
  ------------------
  |  Branch (509:18): [True: 0, False: 52.9k]
  |  Branch (509:29): [True: 0, False: 0]
  ------------------
  510|  52.9k|          if (n > 0)
  ------------------
  |  Branch (510:15): [True: 28.6k, False: 24.3k]
  ------------------
  511|  28.6k|            {
  512|  28.6k|              nbytes += n;
  513|  28.6k|              if (nbytes < size)
  ------------------
  |  Branch (513:19): [True: 24.3k, False: 4.24k]
  ------------------
  514|  24.3k|                goto read_more;
  515|  28.6k|            }
  516|  24.3k|          else if (!n) /* eof */
  ------------------
  |  Branch (516:20): [True: 24.3k, False: 0]
  ------------------
  517|  24.3k|            {
  518|  24.3k|              if (nbytes)
  ------------------
  |  Branch (518:19): [True: 24.3k, False: 30]
  ------------------
  519|  24.3k|                a->delayed_rc = -1;
  520|     30|              else
  521|     30|                {
  522|     30|                  a->eof_seen = 1;
  523|     30|                  rc = -1;
  524|     30|                }
  525|  24.3k|            }
  526|      0|          else /* error */
  527|      0|            {
  528|      0|              rc = gpg_error_from_syserror ();
  529|      0|              if (gpg_err_code (rc) != GPG_ERR_EPIPE)
  ------------------
  |  Branch (529:19): [True: 0, False: 0]
  ------------------
  530|      0|                log_error ("%s: read error: %s\n", a->fname, gpg_strerror (rc));
  531|      0|              if (nbytes)
  ------------------
  |  Branch (531:19): [True: 0, False: 0]
  ------------------
  532|      0|                {
  533|      0|                  a->delayed_rc = rc;
  534|      0|                  rc = 0;
  535|      0|                }
  536|      0|            }
  537|  28.6k|#endif
  538|  28.6k|	  *ret_len = nbytes;
  539|  28.6k|	}
  540|  51.1k|    }
  541|  48.8k|  else if (control == IOBUFCTRL_FLUSH)
  ------------------
  |  Branch (541:12): [True: 1, False: 48.8k]
  ------------------
  542|      1|    {
  543|      1|      if (size)
  ------------------
  |  Branch (543:11): [True: 0, False: 1]
  ------------------
  544|      0|	{
  545|       |#ifdef HAVE_W32_SYSTEM
  546|       |	  byte *p = buf;
  547|       |	  unsigned long n;
  548|       |
  549|       |	  nbytes = size;
  550|       |	  do
  551|       |	    {
  552|       |	      if (size && !WriteFile (f, p, nbytes, &n, NULL))
  553|       |		{
  554|       |		  int ec = (int) GetLastError ();
  555|       |		  rc = gpg_error_from_errno (ec);
  556|       |		  log_error ("%s: write error: ec=%d\n", a->fname, ec);
  557|       |		  break;
  558|       |		}
  559|       |	      p += n;
  560|       |	      nbytes -= n;
  561|       |	    }
  562|       |	  while (nbytes);
  563|       |	  nbytes = p - buf;
  564|       |#else
  565|      0|	  byte *p = buf;
  566|      0|	  int n;
  567|       |
  568|      0|	  nbytes = size;
  569|      0|	  do
  570|      0|	    {
  571|      0|	      do
  572|      0|		{
  573|      0|		  n = write (f, p, nbytes);
  574|      0|		}
  575|      0|	      while (n == -1 && errno == EINTR);
  ------------------
  |  Branch (575:15): [True: 0, False: 0]
  |  Branch (575:26): [True: 0, False: 0]
  ------------------
  576|      0|	      if (n > 0)
  ------------------
  |  Branch (576:12): [True: 0, False: 0]
  ------------------
  577|      0|		{
  578|      0|		  p += n;
  579|      0|		  nbytes -= n;
  580|      0|		}
  581|      0|	    }
  582|      0|	  while (n != -1 && nbytes);
  ------------------
  |  Branch (582:11): [True: 0, False: 0]
  |  Branch (582:22): [True: 0, False: 0]
  ------------------
  583|      0|	  if (n == -1)
  ------------------
  |  Branch (583:8): [True: 0, False: 0]
  ------------------
  584|      0|	    {
  585|      0|	      rc = gpg_error_from_syserror ();
  586|      0|	      log_error ("%s: write error: %s\n", a->fname, strerror (errno));
  587|      0|	    }
  588|      0|	  nbytes = p - buf;
  589|      0|#endif
  590|      0|	}
  591|      1|      *ret_len = nbytes;
  592|      1|    }
  593|  48.8k|  else if (control == IOBUFCTRL_INIT)
  ------------------
  |  Branch (593:12): [True: 24.4k, False: 24.4k]
  ------------------
  594|  24.4k|    {
  595|  24.4k|      a->eof_seen = 0;
  596|  24.4k|      a->delayed_rc = 0;
  597|  24.4k|      a->keep_open = 0;
  598|  24.4k|      a->no_cache = 0;
  599|  24.4k|    }
  600|  24.4k|  else if (control == IOBUFCTRL_DESC)
  ------------------
  |  Branch (600:12): [True: 0, False: 24.4k]
  ------------------
  601|      0|    {
  602|      0|      mem2str (buf, "file_filter(fd)", *ret_len);
  603|      0|    }
  604|  24.4k|  else if (control == IOBUFCTRL_FREE)
  ------------------
  |  Branch (604:12): [True: 24.4k, False: 0]
  ------------------
  605|  24.4k|    {
  606|  24.4k|      if (f != FD_FOR_STDIN && f != FD_FOR_STDOUT)
  ------------------
  |  |   84|  48.8k|# define FD_FOR_STDIN  (0)
  ------------------
                    if (f != FD_FOR_STDIN && f != FD_FOR_STDOUT)
  ------------------
  |  |   85|  24.4k|# define FD_FOR_STDOUT (1)
  ------------------
  |  Branch (606:11): [True: 24.4k, False: 0]
  |  Branch (606:32): [True: 24.4k, False: 0]
  ------------------
  607|  24.4k|	{
  608|  24.4k|	  if (DBG_IOBUF)
  ------------------
  |  |   98|  24.4k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 24.4k]
  |  |  ------------------
  ------------------
  609|      0|	    log_debug ("%s: close fd/handle %d\n", a->fname, FD2INT (f));
  ------------------
  |  |   46|      0|#define FD2INT(h) (h)
  ------------------
  610|  24.4k|	  if (!a->keep_open)
  ------------------
  |  Branch (610:8): [True: 24.4k, False: 0]
  ------------------
  611|  24.4k|	    fd_cache_close (a->no_cache ? NULL : a->fname, f);
  ------------------
  |  Branch (611:22): [True: 12.2k, False: 12.2k]
  ------------------
  612|  24.4k|	}
  613|  24.4k|      xfree (a); /* We can free our context now. */
  ------------------
  |  |  104|  24.4k|#define xfree(a)         gcry_free ((a))
  ------------------
  614|  24.4k|    }
  615|       |
  616|  99.9k|  return rc;
  617|  99.9k|}
iobuf.c:fd_cache_close:
  370|  24.4k|{
  371|  24.4k|  close_cache_t cc;
  372|       |
  373|  24.4k|  assert (fp);
  374|  24.4k|  if (!fname || !*fname)
  ------------------
  |  Branch (374:7): [True: 12.2k, False: 12.2k]
  |  Branch (374:17): [True: 0, False: 12.2k]
  ------------------
  375|  12.2k|    {
  376|       |#ifdef HAVE_W32_SYSTEM
  377|       |      CloseHandle (fp);
  378|       |#else
  379|  12.2k|      close (fp);
  380|  12.2k|#endif
  381|  12.2k|      if (DBG_IOBUF)
  ------------------
  |  |   98|  12.2k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 12.2k]
  |  |  ------------------
  ------------------
  382|      0|	log_debug ("fd_cache_close (%d) real\n", (int)fp);
  383|  12.2k|      return;
  384|  12.2k|    }
  385|       |  /* try to reuse a slot */
  386|  12.2k|  for (cc = close_cache; cc; cc = cc->next)
  ------------------
  |  Branch (386:26): [True: 12.2k, False: 2]
  ------------------
  387|  12.2k|    {
  388|  12.2k|      if (cc->fp == GNUPG_INVALID_FD && !fd_cache_strcmp (cc->fname, fname))
  ------------------
  |  |   44|  24.4k|#define GNUPG_INVALID_FD (-1)
  ------------------
  |  Branch (388:11): [True: 12.2k, False: 0]
  |  Branch (388:41): [True: 12.2k, False: 1]
  ------------------
  389|  12.2k|	{
  390|  12.2k|	  cc->fp = fp;
  391|  12.2k|	  if (DBG_IOBUF)
  ------------------
  |  |   98|  12.2k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 12.2k]
  |  |  ------------------
  ------------------
  392|      0|	    log_debug ("fd_cache_close (%s) used existing slot\n", fname);
  393|  12.2k|	  return;
  394|  12.2k|	}
  395|  12.2k|    }
  396|       |  /* add a new one */
  397|      2|  if (DBG_IOBUF)
  ------------------
  |  |   98|      2|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 2]
  |  |  ------------------
  ------------------
  398|      0|    log_debug ("fd_cache_close (%s) new slot created\n", fname);
  399|      2|  cc = xcalloc (1, sizeof *cc + strlen (fname));
  ------------------
  |  |  109|      2|#define xcalloc(a,b)     gcry_xcalloc ((a),(b))
  ------------------
  400|      2|  strcpy (cc->fname, fname);
  401|      2|  cc->fp = fp;
  402|      2|  cc->next = close_cache;
  403|      2|  close_cache = cc;
  404|      2|}
iobuf.c:fd_cache_invalidate:
  206|      2|{
  207|      2|  close_cache_t cc;
  208|      2|  int rc = 0;
  209|       |
  210|      2|  assert (fname);
  211|      2|  if (DBG_IOBUF)
  ------------------
  |  |   98|      2|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 2]
  |  |  ------------------
  ------------------
  212|      0|    log_debug ("fd_cache_invalidate (%s)\n", fname);
  213|       |
  214|      3|  for (cc = close_cache; cc; cc = cc->next)
  ------------------
  |  Branch (214:26): [True: 1, False: 2]
  ------------------
  215|      1|    {
  216|      1|      if (cc->fp != GNUPG_INVALID_FD && !fd_cache_strcmp (cc->fname, fname))
  ------------------
  |  |   44|      2|#define GNUPG_INVALID_FD (-1)
  ------------------
  |  Branch (216:11): [True: 1, False: 0]
  |  Branch (216:41): [True: 1, False: 0]
  ------------------
  217|      1|	{
  218|      1|	  if (DBG_IOBUF)
  ------------------
  |  |   98|      1|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  219|      0|	    log_debug ("                did (%s)\n", cc->fname);
  220|       |#ifdef HAVE_W32_SYSTEM
  221|       |	  if (!CloseHandle (cc->fp))
  222|       |            rc = -1;
  223|       |#else
  224|      1|	  rc = close (cc->fp);
  225|      1|#endif
  226|      1|	  cc->fp = GNUPG_INVALID_FD;
  ------------------
  |  |   44|      1|#define GNUPG_INVALID_FD (-1)
  ------------------
  227|      1|	}
  228|      1|    }
  229|      2|  return rc;
  230|      2|}
iobuf.c:filter_flush:
 2043|      1|{
 2044|      1|  int external_used = 0;
 2045|      1|  byte *src_buf;
 2046|      1|  size_t src_len;
 2047|      1|  size_t len;
 2048|      1|  int rc;
 2049|       |
 2050|      1|  a->e_d.used = 0;
 2051|       |
 2052|      1|  if (a->use == IOBUF_OUTPUT_TEMP)
  ------------------
  |  Branch (2052:7): [True: 0, False: 1]
  ------------------
 2053|      0|    {				/* increase the temp buffer */
 2054|      0|      size_t newsize = a->d.size + iobuf_buffer_size;
 2055|       |
 2056|      0|      if (DBG_IOBUF)
  ------------------
  |  |   98|      0|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2057|      0|	log_debug ("increasing temp iobuf from %lu to %lu\n",
 2058|      0|		   (ulong) a->d.size, (ulong) newsize);
 2059|       |
 2060|      0|      a->d.buf = xrealloc (a->d.buf, newsize);
  ------------------
  |  |  111|      0|#define xrealloc(a,b)    gcry_xrealloc ((a),(b))
  ------------------
 2061|      0|      a->d.size = newsize;
 2062|      0|      return 0;
 2063|      0|    }
 2064|      1|  else if (a->use != IOBUF_OUTPUT)
  ------------------
  |  Branch (2064:12): [True: 0, False: 1]
  ------------------
 2065|      0|    log_bug ("flush on non-output iobuf\n");
 2066|      1|  else if (!a->filter)
  ------------------
  |  Branch (2066:12): [True: 0, False: 1]
  ------------------
 2067|      0|    log_bug ("filter_flush: no filter\n");
 2068|       |
 2069|      1|  if (a->d.len == 0 && a->e_d.buf && a->e_d.len > 0)
  ------------------
  |  Branch (2069:7): [True: 1, False: 0]
  |  Branch (2069:24): [True: 0, False: 1]
  |  Branch (2069:38): [True: 0, False: 0]
  ------------------
 2070|      0|    {
 2071|      0|      src_buf = a->e_d.buf;
 2072|      0|      src_len = a->e_d.len;
 2073|      0|      external_used = 1;
 2074|      0|    }
 2075|      1|  else
 2076|      1|    {
 2077|      1|      src_buf = a->d.buf;
 2078|      1|      src_len = a->d.len;
 2079|      1|      external_used = 0;
 2080|      1|    }
 2081|       |
 2082|      1|  len = src_len;
 2083|      1|  rc = a->filter (a->filter_ov, IOBUFCTRL_FLUSH, a->chain, src_buf, &len);
 2084|      1|  if (!rc && len != src_len)
  ------------------
  |  Branch (2084:7): [True: 1, False: 0]
  |  Branch (2084:14): [True: 0, False: 1]
  ------------------
 2085|      0|    {
 2086|      0|      log_info ("filter_flush did not write all!\n");
 2087|      0|      rc = GPG_ERR_INTERNAL;
 2088|      0|    }
 2089|      1|  else if (rc)
  ------------------
  |  Branch (2089:12): [True: 0, False: 1]
  ------------------
 2090|      0|    a->error = rc;
 2091|      1|  a->d.len = 0;
 2092|      1|  if (external_used)
  ------------------
  |  Branch (2092:7): [True: 0, False: 1]
  ------------------
 2093|      0|    a->e_d.used = len;
 2094|       |
 2095|      1|  return rc;
 2096|      1|}
iobuf.c:underflow:
 1833|  2.04G|{
 1834|  2.04G|  return underflow_target (a, clear_pending_eof, 1);
 1835|  2.04G|}
iobuf.c:underflow_target:
 1844|  2.04G|{
 1845|  2.04G|  size_t len;
 1846|  2.04G|  int rc;
 1847|       |
 1848|  2.04G|  if (DBG_IOBUF)
  ------------------
  |  |   98|  2.04G|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 2.04G]
  |  |  ------------------
  ------------------
 1849|      0|    log_debug ("iobuf-%d.%d: underflow: buffer size: %d; still buffered: %d => space for %d bytes\n",
 1850|      0|	       a->no, a->subno,
 1851|      0|	       (int) a->d.size, (int) (a->d.len - a->d.start),
 1852|      0|	       (int) (a->d.size - (a->d.len - a->d.start)));
 1853|       |
 1854|  2.04G|  if (a->use == IOBUF_INPUT_TEMP)
  ------------------
  |  Branch (1854:7): [True: 0, False: 2.04G]
  ------------------
 1855|       |    /* By definition, there isn't more data to read into the
 1856|       |       buffer.  */
 1857|      0|    return -1;
 1858|       |
 1859|  2.04G|  assert (a->use == IOBUF_INPUT);
 1860|       |
 1861|  2.04G|  a->e_d.used = 0;
 1862|       |
 1863|       |  /* If there is still some buffered data, then move it to the start
 1864|       |     of the buffer and try to fill the end of the buffer.  (This is
 1865|       |     useful if we are called from iobuf_peek().)  */
 1866|  2.04G|  assert (a->d.start <= a->d.len);
 1867|  2.04G|  a->d.len -= a->d.start;
 1868|  2.04G|  if (a->d.len)
  ------------------
  |  Branch (1868:7): [True: 120, False: 2.04G]
  ------------------
 1869|    120|    memmove (a->d.buf, &a->d.buf[a->d.start], a->d.len);
 1870|  2.04G|  a->d.start = 0;
 1871|       |
 1872|  2.04G|  if (a->d.len < target && a->filter_eof)
  ------------------
  |  Branch (1872:7): [True: 2.04G, False: 0]
  |  Branch (1872:28): [True: 19.0k, False: 2.04G]
  ------------------
 1873|       |    /* The last time we tried to read from this filter, we got an EOF.
 1874|       |       We couldn't return the EOF, because there was buffered data.
 1875|       |       Since there is no longer any buffered data, return the
 1876|       |       error.  */
 1877|  19.0k|    {
 1878|  19.0k|      if (DBG_IOBUF)
  ------------------
  |  |   98|  19.0k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 19.0k]
  |  |  ------------------
  ------------------
 1879|      0|	log_debug ("iobuf-%d.%d: underflow: eof (pending eof)\n",
 1880|      0|		   a->no, a->subno);
 1881|  19.0k|      if (! clear_pending_eof)
  ------------------
  |  Branch (1881:11): [True: 60, False: 18.9k]
  ------------------
 1882|     60|	return -1;
 1883|       |
 1884|  18.9k|      if (a->chain)
  ------------------
  |  Branch (1884:11): [True: 627, False: 18.3k]
  ------------------
 1885|       |	/* A filter follows this one.  Free this filter.  */
 1886|    627|	{
 1887|    627|	  iobuf_t b = a->chain;
 1888|    627|	  if (DBG_IOBUF)
  ------------------
  |  |   98|    627|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 627]
  |  |  ------------------
  ------------------
 1889|      0|	    log_debug ("iobuf-%d.%d: filter popped (pending EOF returned)\n",
 1890|      0|		       a->no, a->subno);
 1891|    627|	  xfree (a->d.buf);
  ------------------
  |  |  104|    627|#define xfree(a)         gcry_free ((a))
  ------------------
 1892|    627|	  xfree (a->real_fname);
  ------------------
  |  |  104|    627|#define xfree(a)         gcry_free ((a))
  ------------------
 1893|    627|	  memcpy (a, b, sizeof *a);
 1894|    627|	  xfree (b);
  ------------------
  |  |  104|    627|#define xfree(a)         gcry_free ((a))
  ------------------
 1895|    627|	  print_chain (a);
 1896|    627|	}
 1897|  18.3k|      else
 1898|  18.3k|	a->filter_eof = 0;	/* for the top level filter */
 1899|  18.9k|      return -1;		/* return one(!) EOF */
 1900|  19.0k|    }
 1901|       |
 1902|  2.04G|  if (a->d.len == 0 && a->error)
  ------------------
  |  Branch (1902:7): [True: 2.04G, False: 60]
  |  Branch (1902:24): [True: 27.1k, False: 2.04G]
  ------------------
 1903|       |    /* The last time we tried to read from this filter, we got an
 1904|       |       error.  We couldn't return the error, because there was
 1905|       |       buffered data.  Since there is no longer any buffered data,
 1906|       |       return the error.  */
 1907|  27.1k|    {
 1908|  27.1k|      if (DBG_IOBUF)
  ------------------
  |  |   98|  27.1k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 27.1k]
  |  |  ------------------
  ------------------
 1909|      0|	log_debug ("iobuf-%d.%d: pending error (%s) returned\n",
 1910|      0|		   a->no, a->subno, gpg_strerror (a->error));
 1911|  27.1k|      return -1;
 1912|  27.1k|    }
 1913|       |
 1914|  2.04G|  if (a->filter && ! a->filter_eof && ! a->error)
  ------------------
  |  Branch (1914:7): [True: 362k, False: 2.04G]
  |  Branch (1914:20): [True: 362k, False: 0]
  |  Branch (1914:39): [True: 362k, False: 0]
  ------------------
 1915|       |    /* We have a filter function and the last time we tried to read we
 1916|       |       didn't get an EOF or an error.  Try to fill the buffer.  */
 1917|   362k|    {
 1918|       |      /* Be careful to account for any buffered data.  */
 1919|   362k|      len = a->d.size - a->d.len;
 1920|       |
 1921|   362k|      if (a->e_d.preferred && a->d.len < IOBUF_ZEROCOPY_THRESHOLD_SIZE
  ------------------
  |  |   71|   465k|#define IOBUF_ZEROCOPY_THRESHOLD_SIZE 1024
  ------------------
  |  Branch (1921:11): [True: 103k, False: 259k]
  |  Branch (1921:31): [True: 103k, False: 0]
  ------------------
 1922|   362k|	  && (IOBUF_ZEROCOPY_THRESHOLD_SIZE - a->d.len) < len)
  ------------------
  |  |   71|   103k|#define IOBUF_ZEROCOPY_THRESHOLD_SIZE 1024
  ------------------
  |  Branch (1922:7): [True: 103k, False: 0]
  ------------------
 1923|   103k|	{
 1924|   103k|	  if (DBG_IOBUF)
  ------------------
  |  |   98|   103k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 103k]
  |  |  ------------------
  ------------------
 1925|      0|	    log_debug ("iobuf-%d.%d: limit buffering as external drain is "
 1926|      0|			"preferred\n",  a->no, a->subno);
 1927|   103k|	  len = IOBUF_ZEROCOPY_THRESHOLD_SIZE - a->d.len;
  ------------------
  |  |   71|   103k|#define IOBUF_ZEROCOPY_THRESHOLD_SIZE 1024
  ------------------
 1928|   103k|	}
 1929|       |
 1930|   362k|      if (len == 0)
  ------------------
  |  Branch (1930:11): [True: 0, False: 362k]
  ------------------
 1931|       |	/* There is no space for more data.  Don't bother calling
 1932|       |	   A->FILTER.  */
 1933|      0|	rc = 0;
 1934|   362k|      else
 1935|   362k|      {
 1936|       |	/* If no buffered data and drain buffer has been setup, and drain
 1937|       |	 * buffer is largish, read data directly to drain buffer. */
 1938|   362k|	if (a->d.len == 0
  ------------------
  |  Branch (1938:6): [True: 362k, False: 60]
  ------------------
 1939|   362k|	    && a->e_d.buf
  ------------------
  |  Branch (1939:9): [True: 13.3k, False: 349k]
  ------------------
 1940|   362k|	    && a->e_d.len >= IOBUF_ZEROCOPY_THRESHOLD_SIZE)
  ------------------
  |  |   71|  13.3k|#define IOBUF_ZEROCOPY_THRESHOLD_SIZE 1024
  ------------------
  |  Branch (1940:9): [True: 13.3k, False: 0]
  ------------------
 1941|  13.3k|	  {
 1942|  13.3k|	    len = a->e_d.len;
 1943|       |
 1944|  13.3k|	    if (DBG_IOBUF)
  ------------------
  |  |   98|  13.3k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 13.3k]
  |  |  ------------------
  ------------------
 1945|      0|	      log_debug ("iobuf-%d.%d: underflow: A->FILTER (%lu bytes, to external drain)\n",
 1946|      0|			 a->no, a->subno, (ulong)len);
 1947|       |
 1948|  13.3k|	    rc = a->filter (a->filter_ov, IOBUFCTRL_UNDERFLOW, a->chain,
 1949|  13.3k|			    a->e_d.buf, &len);
 1950|  13.3k|	    a->e_d.used = len;
 1951|  13.3k|	    len = 0;
 1952|  13.3k|	  }
 1953|   349k|	else
 1954|   349k|	  {
 1955|   349k|	    if (DBG_IOBUF)
  ------------------
  |  |   98|   349k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 349k]
  |  |  ------------------
  ------------------
 1956|      0|	      log_debug ("iobuf-%d.%d: underflow: A->FILTER (%lu bytes)\n",
 1957|      0|			 a->no, a->subno, (ulong)len);
 1958|       |
 1959|   349k|	    rc = a->filter (a->filter_ov, IOBUFCTRL_UNDERFLOW, a->chain,
 1960|   349k|			    &a->d.buf[a->d.len], &len);
 1961|   349k|	  }
 1962|   362k|      }
 1963|   362k|      a->d.len += len;
 1964|       |
 1965|   362k|      if (DBG_IOBUF)
  ------------------
  |  |   98|   362k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 362k]
  |  |  ------------------
  ------------------
 1966|      0|	log_debug ("iobuf-%d.%d: A->FILTER() returned rc=%d (%s), read %lu bytes%s\n",
 1967|      0|		   a->no, a->subno,
 1968|      0|		   rc, rc == 0 ? "ok" : rc == -1 ? "EOF" : gpg_strerror (rc),
  ------------------
  |  Branch (1968:10): [True: 0, False: 0]
  |  Branch (1968:27): [True: 0, False: 0]
  ------------------
 1969|      0|		   (ulong)(a->e_d.used ? a->e_d.used : len),
  ------------------
  |  Branch (1969:14): [True: 0, False: 0]
  ------------------
 1970|      0|		   a->e_d.used ? " (to external buffer)" : "");
  ------------------
  |  Branch (1970:6): [True: 0, False: 0]
  ------------------
 1971|       |/*  	    if( a->no == 1 ) */
 1972|       |/*                   log_hexdump ("     data:", a->d.buf, len); */
 1973|       |
 1974|   362k|      if (rc == -1)
  ------------------
  |  Branch (1974:11): [True: 90.1k, False: 272k]
  ------------------
 1975|       |	/* EOF.  */
 1976|  90.1k|	{
 1977|  90.1k|	  size_t dummy_len = 0;
 1978|       |
 1979|       |	  /* Tell the filter to free itself */
 1980|  90.1k|	  if ((rc = a->filter (a->filter_ov, IOBUFCTRL_FREE, a->chain,
  ------------------
  |  Branch (1980:8): [True: 0, False: 90.1k]
  ------------------
 1981|  90.1k|			       NULL, &dummy_len)))
 1982|      0|	    log_error ("IOBUFCTRL_FREE failed: %s\n", gpg_strerror (rc));
 1983|       |
 1984|       |	  /* Free everything except for the internal buffer.  */
 1985|  90.1k|	  if (a->filter_ov && a->filter_ov_owner)
  ------------------
  |  Branch (1985:8): [True: 90.1k, False: 0]
  |  Branch (1985:24): [True: 0, False: 90.1k]
  ------------------
 1986|      0|	    xfree (a->filter_ov);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1987|  90.1k|	  a->filter_ov = NULL;
 1988|  90.1k|	  a->filter = NULL;
 1989|  90.1k|	  a->filter_eof = 1;
 1990|       |
 1991|  90.1k|	  if (clear_pending_eof && a->d.len == 0 && a->e_d.used == 0
  ------------------
  |  Branch (1991:8): [True: 90.0k, False: 60]
  |  Branch (1991:29): [True: 89.4k, False: 613]
  |  Branch (1991:46): [True: 89.4k, False: 27]
  ------------------
 1992|  90.1k|	      && a->chain)
  ------------------
  |  Branch (1992:11): [True: 66.9k, False: 22.4k]
  ------------------
 1993|       |	    /* We don't need to keep this filter around at all:
 1994|       |
 1995|       |	         - we got an EOF
 1996|       |		 - we have no buffered data
 1997|       |		 - a filter follows this one.
 1998|       |
 1999|       |	      Unlink this filter.  */
 2000|  66.9k|	    {
 2001|  66.9k|	      iobuf_t b = a->chain;
 2002|  66.9k|	      if (DBG_IOBUF)
  ------------------
  |  |   98|  66.9k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 66.9k]
  |  |  ------------------
  ------------------
 2003|      0|		log_debug ("iobuf-%d.%d: pop in underflow (nothing buffered, got EOF)\n",
 2004|      0|			   a->no, a->subno);
 2005|  66.9k|	      xfree (a->d.buf);
  ------------------
  |  |  104|  66.9k|#define xfree(a)         gcry_free ((a))
  ------------------
 2006|  66.9k|	      xfree (a->real_fname);
  ------------------
  |  |  104|  66.9k|#define xfree(a)         gcry_free ((a))
  ------------------
 2007|  66.9k|	      memcpy (a, b, sizeof *a);
 2008|  66.9k|	      xfree (b);
  ------------------
  |  |  104|  66.9k|#define xfree(a)         gcry_free ((a))
  ------------------
 2009|       |
 2010|  66.9k|	      print_chain (a);
 2011|       |
 2012|  66.9k|	      return -1;
 2013|  66.9k|	    }
 2014|  23.1k|	  else if (a->d.len == 0 && a->e_d.used == 0)
  ------------------
  |  Branch (2014:13): [True: 22.5k, False: 673]
  |  Branch (2014:30): [True: 22.4k, False: 27]
  ------------------
 2015|       |	    /* We can't unlink this filter (it is the only one in the
 2016|       |	       pipeline), but we can immediately return EOF.  */
 2017|  22.4k|	    return -1;
 2018|  90.1k|	}
 2019|   272k|      else if (rc)
  ------------------
  |  Branch (2019:16): [True: 5.22k, False: 267k]
  ------------------
 2020|       |	/* Record the error.  */
 2021|  5.22k|	{
 2022|  5.22k|	  a->error = rc;
 2023|       |
 2024|  5.22k|	  if (a->d.len == 0 && a->e_d.used == 0)
  ------------------
  |  Branch (2024:8): [True: 2.61k, False: 2.60k]
  |  Branch (2024:25): [True: 2.59k, False: 17]
  ------------------
 2025|       |	    /* There is no buffered data.  Immediately return EOF.  */
 2026|  2.59k|	    return -1;
 2027|  5.22k|	}
 2028|   362k|    }
 2029|       |
 2030|  2.04G|  assert (a->d.start <= a->d.len);
 2031|  2.04G|  if (a->e_d.used > 0)
  ------------------
  |  Branch (2031:7): [True: 8.31k, False: 2.04G]
  ------------------
 2032|  8.31k|    return 0;
 2033|  2.04G|  if (a->d.start < a->d.len)
  ------------------
  |  Branch (2033:7): [True: 244k, False: 2.04G]
  ------------------
 2034|   244k|    return a->d.buf[a->d.start++];
 2035|       |
 2036|       |  /* EOF.  */
 2037|  2.04G|  return -1;
 2038|  2.04G|}
iobuf.c:block_filter:
  837|   338k|{
  838|   338k|  block_filter_ctx_t *a = opaque;
  839|   338k|  char *buf = (char *)buffer;
  840|   338k|  size_t size = *ret_len;
  841|   338k|  int c, needed, rc = 0;
  842|   338k|  char *p;
  843|       |
  844|   338k|  if (control == IOBUFCTRL_UNDERFLOW)
  ------------------
  |  Branch (844:7): [True: 202k, False: 135k]
  ------------------
  845|   202k|    {
  846|   202k|      size_t n = 0;
  847|       |
  848|   202k|      p = buf;
  849|   202k|      assert (size);		/* need a buffer */
  850|   202k|      if (a->eof)		/* don't read any further */
  ------------------
  |  Branch (850:11): [True: 62.2k, False: 140k]
  ------------------
  851|  62.2k|	rc = -1;
  852|   431k|      while (!rc && size)
  ------------------
  |  Branch (852:14): [True: 366k, False: 65.3k]
  |  Branch (852:21): [True: 293k, False: 72.9k]
  ------------------
  853|   293k|	{
  854|   293k|	  if (!a->size)
  ------------------
  |  Branch (854:8): [True: 221k, False: 72.0k]
  ------------------
  855|   221k|	    {			/* get the length bytes */
  856|   221k|	      if (a->partial == 2)
  ------------------
  |  Branch (856:12): [True: 43.8k, False: 177k]
  ------------------
  857|  43.8k|		{
  858|  43.8k|		  a->eof = 1;
  859|  43.8k|		  if (!n)
  ------------------
  |  Branch (859:9): [True: 194, False: 43.7k]
  ------------------
  860|    194|		    rc = -1;
  861|  43.8k|		  break;
  862|  43.8k|		}
  863|   177k|	      else if (a->partial)
  ------------------
  |  Branch (863:17): [True: 177k, False: 0]
  ------------------
  864|   177k|		{
  865|       |		  /* These OpenPGP introduced huffman like encoded length
  866|       |		   * bytes are really a mess :-( */
  867|   177k|		  if (a->first_c)
  ------------------
  |  Branch (867:9): [True: 67.8k, False: 109k]
  ------------------
  868|  67.8k|		    {
  869|  67.8k|		      c = a->first_c;
  870|  67.8k|		      a->first_c = 0;
  871|  67.8k|		    }
  872|   109k|		  else if ((c = iobuf_get (chain)) == -1)
  ------------------
  |  |  500|   109k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 109k]
  |  |  |  Branch (500:24): [True: 9.12k, False: 100k]
  |  |  ------------------
  |  |  501|   109k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (872:14): [True: 1.50k, False: 108k]
  ------------------
  873|  1.50k|		    {
  874|  1.50k|		      log_error ("block_filter: 1st length byte missing\n");
  875|  1.50k|		      rc = GPG_ERR_BAD_DATA;
  876|  1.50k|		      break;
  877|  1.50k|		    }
  878|   176k|		  if (c < 192)
  ------------------
  |  Branch (878:9): [True: 60.8k, False: 115k]
  ------------------
  879|  60.8k|		    {
  880|  60.8k|		      a->size = c;
  881|  60.8k|		      a->partial = 2;
  882|  60.8k|		      if (!a->size)
  ------------------
  |  Branch (882:13): [True: 18.0k, False: 42.7k]
  ------------------
  883|  18.0k|			{
  884|  18.0k|			  a->eof = 1;
  885|  18.0k|			  if (!n)
  ------------------
  |  Branch (885:10): [True: 10, False: 18.0k]
  ------------------
  886|     10|			    rc = -1;
  887|  18.0k|			  break;
  888|  18.0k|			}
  889|  60.8k|		    }
  890|   115k|		  else if (c < 224)
  ------------------
  |  Branch (890:14): [True: 1.37k, False: 113k]
  ------------------
  891|  1.37k|		    {
  892|  1.37k|		      a->size = (c - 192) * 256;
  893|  1.37k|		      if ((c = iobuf_get (chain)) == -1)
  ------------------
  |  |  500|  1.37k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 1.37k]
  |  |  |  Branch (500:24): [True: 247, False: 1.12k]
  |  |  ------------------
  |  |  501|  1.37k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (893:13): [True: 38, False: 1.33k]
  ------------------
  894|     38|			{
  895|     38|			  log_error
  896|     38|			    ("block_filter: 2nd length byte missing\n");
  897|     38|			  rc = GPG_ERR_BAD_DATA;
  898|     38|			  break;
  899|     38|			}
  900|  1.33k|		      a->size += c + 192;
  901|  1.33k|		      a->partial = 2;
  902|  1.33k|		      if (!a->size)
  ------------------
  |  Branch (902:13): [True: 0, False: 1.33k]
  ------------------
  903|      0|			{
  904|      0|			  a->eof = 1;
  905|      0|			  if (!n)
  ------------------
  |  Branch (905:10): [True: 0, False: 0]
  ------------------
  906|      0|			    rc = -1;
  907|      0|			  break;
  908|      0|			}
  909|  1.33k|		    }
  910|   113k|		  else if (c == 255)
  ------------------
  |  Branch (910:14): [True: 3.36k, False: 110k]
  ------------------
  911|  3.36k|		    {
  912|  3.36k|                      size_t len = 0;
  913|  3.36k|                      int i;
  914|       |
  915|  16.6k|                      for (i = 0; i < 4; i++)
  ------------------
  |  Branch (915:35): [True: 13.3k, False: 3.30k]
  ------------------
  916|  13.3k|                        if ((c = iobuf_get (chain)) == -1)
  ------------------
  |  |  500|  13.3k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 13.3k]
  |  |  |  Branch (500:24): [True: 74, False: 13.2k]
  |  |  ------------------
  |  |  501|  13.3k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (916:29): [True: 52, False: 13.3k]
  ------------------
  917|     52|                          break;
  918|  13.3k|                        else
  919|  13.3k|                          len = ((len << 8) | c);
  920|       |
  921|  3.36k|                      if (i < 4)
  ------------------
  |  Branch (921:27): [True: 52, False: 3.30k]
  ------------------
  922|     52|			{
  923|     52|			  log_error ("block_filter: invalid 4 byte length\n");
  924|     52|			  rc = GPG_ERR_BAD_DATA;
  925|     52|			  break;
  926|     52|			}
  927|  3.30k|                      a->size = len;
  928|  3.30k|                      a->partial = 2;
  929|  3.30k|                      if (!a->size)
  ------------------
  |  Branch (929:27): [True: 540, False: 2.76k]
  ------------------
  930|    540|                        {
  931|    540|                          a->eof = 1;
  932|    540|                          if (!n)
  ------------------
  |  Branch (932:31): [True: 3, False: 537]
  ------------------
  933|      3|                            rc = -1;
  934|    540|                          break;
  935|    540|			}
  936|  3.30k|		    }
  937|   110k|		  else
  938|   110k|		    { /* Next partial body length. */
  939|   110k|		      a->size = 1 << (c & 0x1f);
  940|   110k|		    }
  941|       |		  /*  log_debug("partial: ctx=%p c=%02x size=%u\n", a, c, a->size); */
  942|   176k|		}
  943|      0|	      else
  944|      0|		BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  945|   221k|	    }
  946|       |
  947|   458k|	  while (!rc && size && a->size)
  ------------------
  |  Branch (947:11): [True: 455k, False: 3.09k]
  |  Branch (947:18): [True: 382k, False: 72.9k]
  |  Branch (947:26): [True: 229k, False: 153k]
  ------------------
  948|   229k|	    {
  949|   229k|	      needed = size < a->size ? size : a->size;
  ------------------
  |  Branch (949:17): [True: 75.0k, False: 154k]
  ------------------
  950|   229k|	      c = iobuf_read (chain, p, needed);
  951|   229k|	      if (c < needed)
  ------------------
  |  Branch (951:12): [True: 3.09k, False: 226k]
  ------------------
  952|  3.09k|		{
  953|  3.09k|		  if (c == -1)
  ------------------
  |  Branch (953:9): [True: 407, False: 2.68k]
  ------------------
  954|    407|		    c = 0;
  955|  3.09k|		  log_error
  956|  3.09k|		    ("block_filter %p: read error (size=%lu,a->size=%lu)\n",
  957|  3.09k|		     a, (ulong) size + c, (ulong) a->size + c);
  958|  3.09k|		  rc = GPG_ERR_BAD_DATA;
  959|  3.09k|		}
  960|   226k|	      else
  961|   226k|		{
  962|   226k|		  size -= c;
  963|   226k|		  a->size -= c;
  964|   226k|		  p += c;
  965|   226k|		  n += c;
  966|   226k|		}
  967|   229k|	    }
  968|   229k|	}
  969|   202k|      *ret_len = n;
  970|   202k|    }
  971|   135k|  else if (control == IOBUFCTRL_FLUSH)
  ------------------
  |  Branch (971:12): [True: 0, False: 135k]
  ------------------
  972|      0|    {
  973|      0|      if (a->partial)
  ------------------
  |  Branch (973:11): [True: 0, False: 0]
  ------------------
  974|      0|	{			/* the complicated openpgp scheme */
  975|      0|	  size_t blen, n, nbytes = size + a->buflen;
  976|       |
  977|      0|	  assert (a->buflen <= OP_MIN_PARTIAL_CHUNK);
  978|      0|	  if (nbytes < OP_MIN_PARTIAL_CHUNK)
  ------------------
  |  |  144|      0|#define OP_MIN_PARTIAL_CHUNK	  512
  ------------------
  |  Branch (978:8): [True: 0, False: 0]
  ------------------
  979|      0|	    {
  980|       |	      /* not enough to write a partial block out; so we store it */
  981|      0|	      if (!a->buffer)
  ------------------
  |  Branch (981:12): [True: 0, False: 0]
  ------------------
  982|      0|		a->buffer = xmalloc (OP_MIN_PARTIAL_CHUNK);
  ------------------
  |  |  107|      0|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  983|      0|	      memcpy (a->buffer + a->buflen, buf, size);
  984|      0|	      a->buflen += size;
  985|      0|	    }
  986|      0|	  else
  987|      0|	    {			/* okay, we can write out something */
  988|       |	      /* do this in a loop to use the most efficient block lengths */
  989|      0|	      p = buf;
  990|      0|	      do
  991|      0|		{
  992|       |		  /* find the best matching block length - this is limited
  993|       |		   * by the size of the internal buffering */
  994|      0|		  for (blen = OP_MIN_PARTIAL_CHUNK * 2,
  ------------------
  |  |  144|      0|#define OP_MIN_PARTIAL_CHUNK	  512
  ------------------
  995|      0|		       c = OP_MIN_PARTIAL_CHUNK_2POW + 1; blen <= nbytes;
  ------------------
  |  |  145|      0|#define OP_MIN_PARTIAL_CHUNK_2POW 9
  ------------------
  |  Branch (995:45): [True: 0, False: 0]
  ------------------
  996|      0|		       blen *= 2, c++)
  997|      0|		    ;
  998|      0|		  blen /= 2;
  999|      0|		  c--;
 1000|       |		  /* write the partial length header */
 1001|      0|		  assert (c <= 0x1f);	/*;-) */
 1002|      0|		  c |= 0xe0;
 1003|      0|		  iobuf_put (chain, c);
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
 1004|      0|		  if ((n = a->buflen))
  ------------------
  |  Branch (1004:9): [True: 0, False: 0]
  ------------------
 1005|      0|		    {		/* write stuff from the buffer */
 1006|      0|		      assert (n == OP_MIN_PARTIAL_CHUNK);
 1007|      0|		      if (iobuf_write (chain, a->buffer, n))
  ------------------
  |  Branch (1007:13): [True: 0, False: 0]
  ------------------
 1008|      0|			rc = gpg_error_from_syserror ();
 1009|      0|		      a->buflen = 0;
 1010|      0|		      nbytes -= n;
 1011|      0|		    }
 1012|      0|		  if ((n = nbytes) > blen)
  ------------------
  |  Branch (1012:9): [True: 0, False: 0]
  ------------------
 1013|      0|		    n = blen;
 1014|      0|		  if (n && iobuf_write (chain, p, n))
  ------------------
  |  Branch (1014:9): [True: 0, False: 0]
  |  Branch (1014:14): [True: 0, False: 0]
  ------------------
 1015|      0|		    rc = gpg_error_from_syserror ();
 1016|      0|		  p += n;
 1017|      0|		  nbytes -= n;
 1018|      0|		}
 1019|      0|	      while (!rc && nbytes >= OP_MIN_PARTIAL_CHUNK);
  ------------------
  |  |  144|      0|#define OP_MIN_PARTIAL_CHUNK	  512
  ------------------
  |  Branch (1019:15): [True: 0, False: 0]
  |  Branch (1019:22): [True: 0, False: 0]
  ------------------
 1020|       |	      /* store the rest in the buffer */
 1021|      0|	      if (!rc && nbytes)
  ------------------
  |  Branch (1021:12): [True: 0, False: 0]
  |  Branch (1021:19): [True: 0, False: 0]
  ------------------
 1022|      0|		{
 1023|      0|		  assert (!a->buflen);
 1024|      0|		  assert (nbytes < OP_MIN_PARTIAL_CHUNK);
 1025|      0|		  if (!a->buffer)
  ------------------
  |  Branch (1025:9): [True: 0, False: 0]
  ------------------
 1026|      0|		    a->buffer = xmalloc (OP_MIN_PARTIAL_CHUNK);
  ------------------
  |  |  107|      0|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 1027|      0|		  memcpy (a->buffer, p, nbytes);
 1028|      0|		  a->buflen = nbytes;
 1029|      0|		}
 1030|      0|	    }
 1031|      0|	}
 1032|      0|      else
 1033|      0|	BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1034|      0|    }
 1035|   135k|  else if (control == IOBUFCTRL_INIT)
  ------------------
  |  Branch (1035:12): [True: 67.8k, False: 67.8k]
  ------------------
 1036|  67.8k|    {
 1037|  67.8k|      if (DBG_IOBUF)
  ------------------
  |  |   98|  67.8k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 67.8k]
  |  |  ------------------
  ------------------
 1038|      0|	log_debug ("init block_filter %p\n", a);
 1039|  67.8k|      if (a->partial)
  ------------------
  |  Branch (1039:11): [True: 67.8k, False: 0]
  ------------------
 1040|  67.8k|	a->count = 0;
 1041|      0|      else if (a->use == IOBUF_INPUT)
  ------------------
  |  Branch (1041:16): [True: 0, False: 0]
  ------------------
 1042|      0|	a->count = a->size = 0;
 1043|      0|      else
 1044|      0|	a->count = a->size;	/* force first length bytes */
 1045|  67.8k|      a->eof = 0;
 1046|  67.8k|      a->buffer = NULL;
 1047|  67.8k|      a->buflen = 0;
 1048|  67.8k|    }
 1049|  67.8k|  else if (control == IOBUFCTRL_DESC)
  ------------------
  |  Branch (1049:12): [True: 0, False: 67.8k]
  ------------------
 1050|      0|    {
 1051|      0|      mem2str (buf, "block_filter", *ret_len);
 1052|      0|    }
 1053|  67.8k|  else if (control == IOBUFCTRL_FREE)
  ------------------
  |  Branch (1053:12): [True: 67.8k, False: 0]
  ------------------
 1054|  67.8k|    {
 1055|  67.8k|      if (a->use == IOBUF_OUTPUT)
  ------------------
  |  Branch (1055:11): [True: 0, False: 67.8k]
  ------------------
 1056|      0|	{			/* write the end markers */
 1057|      0|	  if (a->partial)
  ------------------
  |  Branch (1057:8): [True: 0, False: 0]
  ------------------
 1058|      0|	    {
 1059|      0|	      u32 len;
 1060|       |	      /* write out the remaining bytes without a partial header
 1061|       |	       * the length of this header may be 0 - but if it is
 1062|       |	       * the first block we are not allowed to use a partial header
 1063|       |	       * and frankly we can't do so, because this length must be
 1064|       |	       * a power of 2. This is _really_ complicated because we
 1065|       |	       * have to check the possible length of a packet prior
 1066|       |	       * to it's creation: a chain of filters becomes complicated
 1067|       |	       * and we need a lot of code to handle compressed packets etc.
 1068|       |	       *   :-(((((((
 1069|       |	       */
 1070|       |	      /* construct header */
 1071|      0|	      len = a->buflen;
 1072|       |	      /*log_debug("partial: remaining length=%u\n", len ); */
 1073|      0|	      if (len < 192)
  ------------------
  |  Branch (1073:12): [True: 0, False: 0]
  ------------------
 1074|      0|		rc = iobuf_put (chain, len);
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
 1075|      0|	      else if (len < 8384)
  ------------------
  |  Branch (1075:17): [True: 0, False: 0]
  ------------------
 1076|      0|		{
 1077|      0|		  if (!(rc = iobuf_put (chain, ((len - 192) / 256) + 192)))
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
  |  Branch (1077:9): [True: 0, False: 0]
  ------------------
 1078|      0|		    rc = iobuf_put (chain, ((len - 192) % 256));
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
 1079|      0|		}
 1080|      0|	      else
 1081|      0|		{		/* use a 4 byte header */
 1082|      0|		  if (!(rc = iobuf_put (chain, 0xff)))
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
  |  Branch (1082:9): [True: 0, False: 0]
  ------------------
 1083|      0|		    if (!(rc = iobuf_put (chain, (len >> 24) & 0xff)))
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
  |  Branch (1083:11): [True: 0, False: 0]
  ------------------
 1084|      0|		      if (!(rc = iobuf_put (chain, (len >> 16) & 0xff)))
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
  |  Branch (1084:13): [True: 0, False: 0]
  ------------------
 1085|      0|			if (!(rc = iobuf_put (chain, (len >> 8) & 0xff)))
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
  |  Branch (1085:8): [True: 0, False: 0]
  ------------------
 1086|      0|			  rc = iobuf_put (chain, len & 0xff);
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
 1087|      0|		}
 1088|      0|	      if (!rc && len)
  ------------------
  |  Branch (1088:12): [True: 0, False: 0]
  |  Branch (1088:19): [True: 0, False: 0]
  ------------------
 1089|      0|		rc = iobuf_write (chain, a->buffer, len);
 1090|      0|	      if (rc)
  ------------------
  |  Branch (1090:12): [True: 0, False: 0]
  ------------------
 1091|      0|		{
 1092|      0|		  log_error ("block_filter: write error: %s\n",
 1093|      0|			     strerror (errno));
 1094|      0|		  rc = gpg_error_from_syserror ();
 1095|      0|		}
 1096|      0|	      xfree (a->buffer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1097|      0|	      a->buffer = NULL;
 1098|      0|	      a->buflen = 0;
 1099|      0|	    }
 1100|      0|	  else
 1101|      0|	    BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1102|      0|	}
 1103|  67.8k|      else if (a->size)
  ------------------
  |  Branch (1103:16): [True: 3.77k, False: 64.1k]
  ------------------
 1104|  3.77k|	{
 1105|  3.77k|	  log_error ("block_filter: pending bytes!\n");
 1106|  3.77k|	}
 1107|  67.8k|      if (DBG_IOBUF)
  ------------------
  |  |   98|  67.8k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 67.8k]
  |  |  ------------------
  ------------------
 1108|      0|	log_debug ("free block_filter %p\n", a);
 1109|  67.8k|      xfree (a);		/* we can free our context now */
  ------------------
  |  |  104|  67.8k|#define xfree(a)         gcry_free ((a))
  ------------------
 1110|  67.8k|    }
 1111|       |
 1112|   338k|  return rc;
 1113|   338k|}

has_invalid_email_chars:
  126|  6.12k|{
  127|  6.12k|  const unsigned char *s = buffer;
  128|  6.12k|  int at_seen=0;
  129|  6.12k|  const char *valid_chars=
  130|  6.12k|    "01234567890_-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  131|       |
  132|  20.3k|  for ( ; length && *s; length--, s++ )
  ------------------
  |  Branch (132:11): [True: 17.6k, False: 2.74k]
  |  Branch (132:21): [True: 17.6k, False: 0]
  ------------------
  133|  17.6k|    {
  134|  17.6k|      if ((*s & 0x80))
  ------------------
  |  Branch (134:11): [True: 4.34k, False: 13.2k]
  ------------------
  135|  4.34k|        continue; /* We only care about ASCII.  */
  136|  13.2k|      if (*s == '@')
  ------------------
  |  Branch (136:11): [True: 2.23k, False: 11.0k]
  ------------------
  137|  2.23k|        at_seen=1;
  138|  11.0k|      else if (!at_seen && !(strchr (valid_chars, *s)
  ------------------
  |  Branch (138:16): [True: 8.92k, False: 2.14k]
  |  Branch (138:30): [True: 4.80k, False: 4.12k]
  ------------------
  139|  8.92k|                             || strchr ("!#$%&'*+/=?^`{|}~", *s)))
  ------------------
  |  Branch (139:33): [True: 1.19k, False: 2.92k]
  ------------------
  140|  2.92k|        return 1;
  141|  8.14k|      else if (at_seen && !strchr (valid_chars, *s))
  ------------------
  |  Branch (141:16): [True: 2.14k, False: 6.00k]
  |  Branch (141:27): [True: 451, False: 1.68k]
  ------------------
  142|    451|        return 1;
  143|  13.2k|    }
  144|  2.74k|  return 0;
  145|  6.12k|}
is_valid_mailbox_mem:
  152|  6.12k|{
  153|  6.12k|  const char *name = name_arg;
  154|       |
  155|  6.12k|  return !( !name
  ------------------
  |  Branch (155:13): [True: 0, False: 6.12k]
  ------------------
  156|  6.12k|            || !namelen
  ------------------
  |  Branch (156:16): [True: 0, False: 6.12k]
  ------------------
  157|  6.12k|            || has_invalid_email_chars (name, namelen)
  ------------------
  |  Branch (157:16): [True: 3.37k, False: 2.74k]
  ------------------
  158|  6.12k|            || mem_count_chr (name, '@', namelen) != 1
  ------------------
  |  Branch (158:16): [True: 1.42k, False: 1.31k]
  ------------------
  159|  6.12k|            || *name == '@'
  ------------------
  |  Branch (159:16): [True: 352, False: 967]
  ------------------
  160|  6.12k|            || name[namelen-1] == '@'
  ------------------
  |  Branch (160:16): [True: 296, False: 671]
  ------------------
  161|  6.12k|            || name[namelen-1] == '.'
  ------------------
  |  Branch (161:16): [True: 264, False: 407]
  ------------------
  162|  6.12k|            || my_memstr (name, namelen, ".."));
  ------------------
  |  Branch (162:16): [True: 76, False: 331]
  ------------------
  163|  6.12k|}
is_valid_mailbox:
  170|  6.12k|{
  171|  6.12k|  return name? is_valid_mailbox_mem (name, strlen (name)) : 0;
  ------------------
  |  Branch (171:10): [True: 6.12k, False: 0]
  ------------------
  172|  6.12k|}
mailbox_from_userid:
  182|  12.0k|{
  183|  12.0k|  const char *s, *s_end;
  184|  12.0k|  size_t len;
  185|  12.0k|  char *result = NULL;
  186|       |
  187|  12.0k|  s = strchr (userid, '<');
  188|  12.0k|  if (s)
  ------------------
  |  Branch (188:7): [True: 5.88k, False: 6.12k]
  ------------------
  189|  5.88k|    {
  190|       |      /* Seems to be a standard user id.  */
  191|  5.88k|      s++;
  192|  5.88k|      s_end = strchr (s, '>');
  193|  5.88k|      if (s_end && s_end > s)
  ------------------
  |  Branch (193:11): [True: 3.92k, False: 1.95k]
  |  Branch (193:20): [True: 3.60k, False: 318]
  ------------------
  194|  3.60k|        {
  195|  3.60k|          len = s_end - s;
  196|  3.60k|          result = xtrymalloc (len + 1);
  ------------------
  |  |   97|  3.60k|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  197|  3.60k|          if (!result)
  ------------------
  |  Branch (197:15): [True: 0, False: 3.60k]
  ------------------
  198|      0|            return NULL; /* Ooops - out of core.  */
  199|  3.60k|          strncpy (result, s, len);
  200|  3.60k|          result[len] = 0;
  201|       |          /* Apply some basic checks on the address.  We do not use
  202|       |             is_valid_mailbox because those checks are too strict.  */
  203|  3.60k|          if (string_count_chr (result, '@') != 1  /* Need exactly one '@.  */
  ------------------
  |  Branch (203:15): [True: 421, False: 3.18k]
  ------------------
  204|  3.60k|              || *result == '@'           /* local-part missing.  */
  ------------------
  |  Branch (204:18): [True: 1.00k, False: 2.18k]
  ------------------
  205|  3.60k|              || result[len-1] == '@'     /* domain missing.  */
  ------------------
  |  Branch (205:18): [True: 244, False: 1.93k]
  ------------------
  206|  3.60k|              || result[len-1] == '.'     /* ends with a dot.  */
  ------------------
  |  Branch (206:18): [True: 250, False: 1.68k]
  ------------------
  207|  3.60k|              || string_has_ctrl_or_space (result)
  ------------------
  |  Branch (207:18): [True: 1.28k, False: 403]
  ------------------
  208|  3.60k|              || has_dotdot_after_at (result))
  ------------------
  |  Branch (208:18): [True: 66, False: 337]
  ------------------
  209|  3.27k|            {
  210|  3.27k|              xfree (result);
  ------------------
  |  |  104|  3.27k|#define xfree(a)         gcry_free ((a))
  ------------------
  211|  3.27k|              result = NULL;
  212|  3.27k|              errno = EINVAL;
  213|  3.27k|            }
  214|  3.60k|        }
  215|  2.27k|      else
  216|  2.27k|        errno = EINVAL;
  217|  5.88k|    }
  218|  6.12k|  else if (is_valid_mailbox (userid))
  ------------------
  |  Branch (218:12): [True: 331, False: 5.79k]
  ------------------
  219|    331|    {
  220|       |      /* The entire user id is a mailbox.  Return that one.  Note that
  221|       |         this fallback method has some restrictions on the valid
  222|       |         syntax of the mailbox.  However, those who want weird
  223|       |         addresses should know about it and use the regular <...>
  224|       |         syntax.  */
  225|    331|      result = xtrystrdup (userid);
  ------------------
  |  |  103|    331|#define xtrystrdup(a)    gcry_strdup ((a))
  ------------------
  226|    331|    }
  227|  5.79k|  else
  228|  5.79k|    errno = EINVAL;
  229|       |
  230|  12.0k|  if (result && subaddress == 1)
  ------------------
  |  Branch (230:7): [True: 668, False: 11.3k]
  |  Branch (230:17): [True: 0, False: 668]
  ------------------
  231|      0|    {
  232|      0|      char *atsign, *plus;
  233|       |
  234|      0|      if ((atsign = strchr (result, '@')))
  ------------------
  |  Branch (234:11): [True: 0, False: 0]
  ------------------
  235|      0|        {
  236|       |          /* We consider a subaddress only if there is a single '+'
  237|       |           * in the local part and the '+' is not the first or last
  238|       |           * character.  */
  239|      0|          *atsign = 0;
  240|      0|          if ((plus = strchr (result, '+'))
  ------------------
  |  Branch (240:15): [True: 0, False: 0]
  ------------------
  241|      0|              && !strchr (plus+1, '+')
  ------------------
  |  Branch (241:18): [True: 0, False: 0]
  ------------------
  242|      0|              && result != plus
  ------------------
  |  Branch (242:18): [True: 0, False: 0]
  ------------------
  243|      0|              && plus[1] )
  ------------------
  |  Branch (243:18): [True: 0, False: 0]
  ------------------
  244|      0|            {
  245|      0|              *atsign = '@';
  246|      0|              memmove (plus, atsign, strlen (atsign)+1);
  247|      0|            }
  248|      0|          else
  249|      0|            *atsign = '@';
  250|      0|        }
  251|      0|    }
  252|       |
  253|  12.0k|  return result? ascii_strlwr (result): NULL;
  ------------------
  |  Branch (253:10): [True: 668, False: 11.3k]
  ------------------
  254|  12.0k|}
mbox-util.c:mem_count_chr:
   49|  2.74k|{
   50|  2.74k|  const char *s = buffer;
   51|  2.74k|  int count;
   52|       |
   53|  11.1k|  for (count=0; length; length--, s++)
  ------------------
  |  Branch (53:17): [True: 8.40k, False: 2.74k]
  ------------------
   54|  8.40k|    if (*s == c)
  ------------------
  |  Branch (54:9): [True: 1.71k, False: 6.68k]
  ------------------
   55|  1.71k|      count++;
   56|  2.74k|  return count;
   57|  2.74k|}
mbox-util.c:my_memstr:
   65|    407|{
   66|    407|  const unsigned char *buf = buffer;
   67|    407|  const unsigned char *t = (const unsigned char *)buf;
   68|    407|  const unsigned char *s = (const unsigned char *)sub;
   69|    407|  size_t n = buflen;
   70|       |
   71|  2.99k|  for ( ; n ; t++, n-- )
  ------------------
  |  Branch (71:11): [True: 2.66k, False: 331]
  ------------------
   72|  2.66k|    {
   73|  2.66k|      if (*t == *s)
  ------------------
  |  Branch (73:11): [True: 820, False: 1.84k]
  ------------------
   74|    820|        {
   75|    896|          for (buf = t++, buflen = n--, s++; n && *t ==*s; t++, s++, n--)
  ------------------
  |  Branch (75:46): [True: 896, False: 0]
  |  Branch (75:51): [True: 76, False: 820]
  ------------------
   76|     76|            ;
   77|    820|          if (!*s)
  ------------------
  |  Branch (77:15): [True: 76, False: 744]
  ------------------
   78|     76|            return (const char*)buf;
   79|    744|          t = (const unsigned char *)buf;
   80|    744|          s = (const unsigned char *)sub ;
   81|    744|          n = buflen;
   82|    744|	}
   83|  2.66k|    }
   84|    331|  return NULL;
   85|    407|}
mbox-util.c:string_count_chr:
   38|  3.60k|{
   39|  3.60k|  int count;
   40|       |
   41|  21.1k|  for (count=0; *string; string++ )
  ------------------
  |  Branch (41:17): [True: 17.5k, False: 3.60k]
  ------------------
   42|  17.5k|    if ( *string == c )
  ------------------
  |  Branch (42:10): [True: 3.25k, False: 14.3k]
  ------------------
   43|  3.25k|      count++;
   44|  3.60k|  return count;
   45|  3.60k|}
mbox-util.c:string_has_ctrl_or_space:
   91|  1.68k|{
   92|  7.53k|  for (; *string; string++ )
  ------------------
  |  Branch (92:10): [True: 7.13k, False: 403]
  ------------------
   93|  7.13k|    if (!(*string & 0x80) && *string <= 0x20)
  ------------------
  |  Branch (93:9): [True: 6.18k, False: 944]
  |  Branch (93:30): [True: 1.28k, False: 4.90k]
  ------------------
   94|  1.28k|      return 1;
   95|    403|  return 0;
   96|  1.68k|}
mbox-util.c:has_dotdot_after_at:
  103|    403|{
  104|    403|  string = strchr (string, '@');
  105|    403|  if (!string)
  ------------------
  |  Branch (105:7): [True: 0, False: 403]
  ------------------
  106|      0|    return 0; /* No at-sign.  */
  107|    403|  string++;
  108|    403|  return !!strstr (string, "..");
  109|    403|}

print_utf8_buffer:
  238|  3.86k|{
  239|  3.86k|  do_print_utf8_buffer (stream, p, n, NULL, NULL);
  240|  3.86k|}
try_make_printable_string:
  277|  12.0k|{
  278|  12.0k|  const unsigned char *p = p_arg;
  279|  12.0k|  size_t save_n, buflen;
  280|  12.0k|  const unsigned char *save_p;
  281|  12.0k|  char *buffer, *d;
  282|       |
  283|       |  /* First count length. */
  284|   256k|  for (save_n = n, save_p = p, buflen=1 ; n; n--, p++ )
  ------------------
  |  Branch (284:43): [True: 244k, False: 12.0k]
  ------------------
  285|   244k|    {
  286|   244k|      if ( *p < 0x20 || *p == 0x7f || *p == delim  || (delim && *p=='\\'))
  ------------------
  |  Branch (286:12): [True: 123k, False: 120k]
  |  Branch (286:25): [True: 3.67k, False: 116k]
  |  Branch (286:39): [True: 0, False: 116k]
  |  Branch (286:56): [True: 0, False: 116k]
  |  Branch (286:65): [True: 0, False: 0]
  ------------------
  287|   127k|        {
  288|   127k|          if ( *p=='\n' || *p=='\r' || *p=='\f'
  ------------------
  |  Branch (288:16): [True: 3.28k, False: 124k]
  |  Branch (288:28): [True: 602, False: 123k]
  |  Branch (288:40): [True: 480, False: 123k]
  ------------------
  289|   127k|               || *p=='\v' || *p=='\b' || !*p )
  ------------------
  |  Branch (289:19): [True: 1.13k, False: 121k]
  |  Branch (289:31): [True: 1.45k, False: 120k]
  |  Branch (289:43): [True: 11.7k, False: 108k]
  ------------------
  290|  18.7k|            buflen += 2;
  291|   108k|          else
  292|   108k|            buflen += 5;
  293|   127k|	}
  294|   116k|      else
  295|   116k|        buflen++;
  296|   244k|    }
  297|  12.0k|  p = save_p;
  298|  12.0k|  n = save_n;
  299|       |  /* And now make the string */
  300|  12.0k|  d = buffer = xtrymalloc (buflen);
  ------------------
  |  |   97|  12.0k|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  301|   256k|  for ( ; n; n--, p++ )
  ------------------
  |  Branch (301:11): [True: 244k, False: 12.0k]
  ------------------
  302|   244k|    {
  303|   244k|      if (*p < 0x20 || *p == 0x7f || *p == delim || (delim && *p=='\\')) {
  ------------------
  |  Branch (303:11): [True: 123k, False: 120k]
  |  Branch (303:24): [True: 3.67k, False: 116k]
  |  Branch (303:38): [True: 0, False: 116k]
  |  Branch (303:54): [True: 0, False: 116k]
  |  Branch (303:63): [True: 0, False: 0]
  ------------------
  304|   127k|        *d++ = '\\';
  305|   127k|        if( *p == '\n' )
  ------------------
  |  Branch (305:13): [True: 3.28k, False: 124k]
  ------------------
  306|  3.28k|          *d++ = 'n';
  307|   124k|        else if( *p == '\r' )
  ------------------
  |  Branch (307:18): [True: 602, False: 123k]
  ------------------
  308|    602|          *d++ = 'r';
  309|   123k|        else if( *p == '\f' )
  ------------------
  |  Branch (309:18): [True: 480, False: 123k]
  ------------------
  310|    480|          *d++ = 'f';
  311|   123k|        else if( *p == '\v' )
  ------------------
  |  Branch (311:18): [True: 1.13k, False: 121k]
  ------------------
  312|  1.13k|          *d++ = 'v';
  313|   121k|        else if( *p == '\b' )
  ------------------
  |  Branch (313:18): [True: 1.45k, False: 120k]
  ------------------
  314|  1.45k|          *d++ = 'b';
  315|   120k|        else if( !*p )
  ------------------
  |  Branch (315:18): [True: 11.7k, False: 108k]
  ------------------
  316|  11.7k|          *d++ = '0';
  317|   108k|        else {
  318|   108k|          sprintf(d, "x%02x", *p );
  319|   108k|          d += 3;
  320|   108k|        }
  321|   127k|      }
  322|   116k|      else
  323|   116k|        *d++ = *p;
  324|   244k|    }
  325|  12.0k|  *d = 0;
  326|  12.0k|  return buffer;
  327|  12.0k|}
miscellaneous.c:do_print_utf8_buffer:
  188|  3.86k|{
  189|  3.86k|  const char *p = buffer;
  190|  3.86k|  size_t i;
  191|       |
  192|       |  /* We can handle plain ascii simpler, so check for it first. */
  193|  8.59k|  for (i=0; i < length; i++ )
  ------------------
  |  Branch (193:13): [True: 6.94k, False: 1.65k]
  ------------------
  194|  6.94k|    {
  195|  6.94k|      if ( (p[i] & 0x80) )
  ------------------
  |  Branch (195:12): [True: 2.21k, False: 4.73k]
  ------------------
  196|  2.21k|        break;
  197|  6.94k|    }
  198|  3.86k|  if (i < length)
  ------------------
  |  Branch (198:7): [True: 2.21k, False: 1.65k]
  ------------------
  199|  2.21k|    {
  200|  2.21k|      int delim = delimiters? *delimiters : 0;
  ------------------
  |  Branch (200:19): [True: 0, False: 2.21k]
  ------------------
  201|  2.21k|      char *buf;
  202|  2.21k|      int ret;
  203|       |
  204|       |      /*(utf8 conversion already does the control character quoting). */
  205|  2.21k|      buf = utf8_to_native (p, length, delim);
  206|  2.21k|      if (bytes_written)
  ------------------
  |  Branch (206:11): [True: 0, False: 2.21k]
  ------------------
  207|      0|        *bytes_written = strlen (buf);
  208|  2.21k|      ret = es_fputs (buf, stream);
  209|  2.21k|      xfree (buf);
  ------------------
  |  |  104|  2.21k|#define xfree(a)         gcry_free ((a))
  ------------------
  210|  2.21k|      return ret == EOF? ret : (int)i;
  ------------------
  |  Branch (210:14): [True: 0, False: 2.21k]
  ------------------
  211|  2.21k|    }
  212|  1.65k|  else
  213|  1.65k|    return es_write_sanitized (stream, p, length, delimiters, bytes_written);
  214|  3.86k|}

mem2str:
  173|  49.0k|{
  174|  49.0k|  char *d;
  175|  49.0k|  const char *s;
  176|       |
  177|  49.0k|  if (n)
  ------------------
  |  Branch (177:7): [True: 49.0k, False: 0]
  ------------------
  178|  49.0k|    {
  179|  49.0k|      if (!dest)
  ------------------
  |  Branch (179:11): [True: 0, False: 49.0k]
  ------------------
  180|      0|        dest = xmalloc (n);
  ------------------
  |  |  107|      0|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  181|  49.0k|      d = dest;
  182|  49.0k|      s = src ;
  183|  1.03M|      for (n--; n && *s; n--)
  ------------------
  |  Branch (183:17): [True: 1.03M, False: 0]
  |  Branch (183:22): [True: 981k, False: 49.0k]
  ------------------
  184|   981k|        *d++ = *s++;
  185|  49.0k|      *d = '\0' ;
  186|  49.0k|    }
  187|       |
  188|  49.0k|  return dest;
  189|  49.0k|}
trim_trailing_chars:
  273|  4.44M|{
  274|  4.44M|    byte *p, *mark;
  275|  4.44M|    unsigned n;
  276|       |
  277|  19.7M|    for(mark=NULL, p=line, n=0; n < len; n++, p++ ) {
  ------------------
  |  Branch (277:33): [True: 15.2M, False: 4.44M]
  ------------------
  278|  15.2M|	if( strchr(trimchars, *p ) ) {
  ------------------
  |  Branch (278:6): [True: 8.43M, False: 6.86M]
  ------------------
  279|  8.43M|	    if( !mark )
  ------------------
  |  Branch (279:10): [True: 5.04M, False: 3.39M]
  ------------------
  280|  5.04M|		mark = p;
  281|  8.43M|	}
  282|  6.86M|	else
  283|  6.86M|	    mark = NULL;
  284|  15.2M|    }
  285|       |
  286|  4.44M|    if( mark ) {
  ------------------
  |  Branch (286:9): [True: 4.44M, False: 829]
  ------------------
  287|  4.44M|	*mark = 0;
  288|  4.44M|	return mark - line;
  289|  4.44M|    }
  290|    829|    return len;
  291|  4.44M|}
length_sans_trailing_chars:
  305|  79.7k|{
  306|  79.7k|  const unsigned char *p, *mark;
  307|  79.7k|  size_t n;
  308|       |
  309|  4.28M|  for( mark=NULL, p=line, n=0; n < len; n++, p++ )
  ------------------
  |  Branch (309:32): [True: 4.20M, False: 79.7k]
  ------------------
  310|  4.20M|    {
  311|  4.20M|      if (strchr (trimchars, *p ))
  ------------------
  |  Branch (311:11): [True: 756k, False: 3.44M]
  ------------------
  312|   756k|        {
  313|   756k|          if( !mark )
  ------------------
  |  Branch (313:15): [True: 272k, False: 483k]
  ------------------
  314|   272k|            mark = p;
  315|   756k|        }
  316|  3.44M|      else
  317|  3.44M|        mark = NULL;
  318|  4.20M|    }
  319|       |
  320|  79.7k|  if (mark)
  ------------------
  |  Branch (320:7): [True: 77.5k, False: 2.24k]
  ------------------
  321|  77.5k|    return mark - line;
  322|  2.24k|  return len;
  323|  79.7k|}
length_sans_trailing_ws:
  330|  79.7k|{
  331|  79.7k|  return length_sans_trailing_chars (line, len, " \t\r\n");
  332|  79.7k|}
make_filename:
  612|      2|{
  613|      2|  va_list arg_ptr;
  614|      2|  char *result;
  615|       |
  616|      2|  va_start (arg_ptr, first_part);
  617|      2|  result = do_make_filename (1, first_part, arg_ptr);
  618|      2|  va_end (arg_ptr);
  619|      2|  return result;
  620|      2|}
make_absfilename:
  642|      3|{
  643|      3|  va_list arg_ptr;
  644|      3|  char *result;
  645|       |
  646|      3|  va_start (arg_ptr, first_part);
  647|      3|  result = do_make_filename (3, first_part, arg_ptr);
  648|      3|  va_end (arg_ptr);
  649|      3|  return result;
  650|      3|}
compare_filenames:
  676|      1|{
  677|       |#ifdef HAVE_DOSISH_SYSTEM
  678|       |  for ( ; *a && *b; a++, b++ )
  679|       |    {
  680|       |      if (*a != *b
  681|       |          && (toupper (*(const unsigned char*)a)
  682|       |              != toupper (*(const unsigned char*)b) )
  683|       |          && !((*a == '/' && *b == '\\') || (*a == '\\' && *b == '/')))
  684|       |        break;
  685|       |    }
  686|       |  if ((*a == '/' && *b == '\\') || (*a == '\\' && *b == '/'))
  687|       |    return 0;
  688|       |  else
  689|       |    return (toupper (*(const unsigned char*)a)
  690|       |            - toupper (*(const unsigned char*)b));
  691|       |#else
  692|      1|    return strcmp(a,b);
  693|      1|#endif
  694|      1|}
ascii_toupper:
  818|  1.21k|{
  819|  1.21k|    if (c >= 'a' && c <= 'z')
  ------------------
  |  Branch (819:9): [True: 257, False: 956]
  |  Branch (819:21): [True: 257, False: 0]
  ------------------
  820|    257|        c &= ~0x20;
  821|  1.21k|    return c;
  822|  1.21k|}
ascii_strlwr:
  835|    668|{
  836|    668|  char *p = s;
  837|       |
  838|  5.66k|  for (p=s; *p; p++ )
  ------------------
  |  Branch (838:13): [True: 5.00k, False: 668]
  ------------------
  839|  5.00k|    if (isascii (*p) && *p >= 'A' && *p <= 'Z')
  ------------------
  |  Branch (839:25): [True: 2.01k, False: 2.16k]
  |  Branch (839:38): [True: 733, False: 1.27k]
  ------------------
  840|    733|      *p |= 0x20;
  841|       |
  842|    668|  return s;
  843|    668|}
stringhelp.c:do_make_filename:
  444|      5|{
  445|      5|  const char *argv[32];
  446|      5|  int argc;
  447|      5|  size_t n;
  448|      5|  int skip = 1;
  449|      5|  char *home_buffer = NULL;
  450|      5|  char *name, *home, *p;
  451|      5|  int want_abs;
  452|       |
  453|      5|  want_abs = !!(xmode & 2);
  454|      5|  xmode &= 1;
  455|       |
  456|      5|  n = strlen (first_part) + 1;
  457|      5|  argc = 0;
  458|      7|  while ( (argv[argc] = va_arg (arg_ptr, const char *)) )
  ------------------
  |  Branch (458:11): [True: 2, False: 5]
  ------------------
  459|      2|    {
  460|      2|      n += strlen (argv[argc]) + 1;
  461|      2|      if (argc >= DIM (argv)-1)
  ------------------
  |  |   47|      2|#define DIM(v)		     (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (461:11): [True: 0, False: 2]
  ------------------
  462|      0|        {
  463|      0|          if (xmode)
  ------------------
  |  Branch (463:15): [True: 0, False: 0]
  ------------------
  464|      0|            BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  465|      0|          gpg_err_set_errno (EINVAL);
  466|      0|          return NULL;
  467|      0|        }
  468|      2|      argc++;
  469|      2|    }
  470|      5|  n++;
  471|       |
  472|      5|  home = NULL;
  473|      5|  if (*first_part == '~')
  ------------------
  |  Branch (473:7): [True: 1, False: 4]
  ------------------
  474|      1|    {
  475|      1|      if (first_part[1] == '/' || !first_part[1])
  ------------------
  |  Branch (475:11): [True: 1, False: 0]
  |  Branch (475:35): [True: 0, False: 0]
  ------------------
  476|      1|        {
  477|       |          /* This is the "~/" or "~" case.  */
  478|      1|          home = getenv("HOME");
  479|      1|          if (!home)
  ------------------
  |  Branch (479:15): [True: 0, False: 1]
  ------------------
  480|      0|            home = home_buffer = get_pwdir (xmode, NULL);
  481|      1|          if (home && *home)
  ------------------
  |  Branch (481:15): [True: 1, False: 0]
  |  Branch (481:23): [True: 1, False: 0]
  ------------------
  482|      1|            n += strlen (home);
  483|      1|        }
  484|      0|      else
  485|      0|        {
  486|       |          /* This is the "~username/" or "~username" case.  */
  487|      0|          char *user;
  488|       |
  489|      0|          if (xmode)
  ------------------
  |  Branch (489:15): [True: 0, False: 0]
  ------------------
  490|      0|            user = xstrdup (first_part+1);
  ------------------
  |  |  112|      0|#define xstrdup(a)       gcry_xstrdup ((a))
  ------------------
  491|      0|          else
  492|      0|            {
  493|      0|              user = xtrystrdup (first_part+1);
  ------------------
  |  |  103|      0|#define xtrystrdup(a)    gcry_strdup ((a))
  ------------------
  494|      0|              if (!user)
  ------------------
  |  Branch (494:19): [True: 0, False: 0]
  ------------------
  495|      0|                return NULL;
  496|      0|            }
  497|      0|          p = strchr (user, '/');
  498|      0|          if (p)
  ------------------
  |  Branch (498:15): [True: 0, False: 0]
  ------------------
  499|      0|            *p = 0;
  500|      0|          skip = 1 + strlen (user);
  501|       |
  502|      0|          home = home_buffer = get_pwdir (xmode, user);
  503|      0|          xfree (user);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  504|      0|          if (home)
  ------------------
  |  Branch (504:15): [True: 0, False: 0]
  ------------------
  505|      0|            n += strlen (home);
  506|      0|          else
  507|      0|            skip = 1;
  508|      0|        }
  509|      1|    }
  510|       |
  511|      5|  if (xmode)
  ------------------
  |  Branch (511:7): [True: 5, False: 0]
  ------------------
  512|      5|    name = xmalloc (n);
  ------------------
  |  |  107|      5|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  513|      0|  else
  514|      0|    {
  515|      0|      name = xtrymalloc (n);
  ------------------
  |  |   97|      0|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  516|      0|      if (!name)
  ------------------
  |  Branch (516:11): [True: 0, False: 0]
  ------------------
  517|      0|        {
  518|      0|          xfree (home_buffer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  519|      0|          return NULL;
  520|      0|        }
  521|      0|    }
  522|       |
  523|      5|  if (home)
  ------------------
  |  Branch (523:7): [True: 1, False: 4]
  ------------------
  524|      1|    p = stpcpy (stpcpy (name, home), first_part + skip);
  525|      4|  else
  526|      4|    p = stpcpy (name, first_part);
  527|       |
  528|      5|  xfree (home_buffer);
  ------------------
  |  |  104|      5|#define xfree(a)         gcry_free ((a))
  ------------------
  529|      7|  for (argc=0; argv[argc]; argc++)
  ------------------
  |  Branch (529:16): [True: 2, False: 5]
  ------------------
  530|      2|    {
  531|       |      /* Avoid a leading double slash if the first part was "/".  */
  532|      2|      if (!argc && name[0] == '/' && !name[1])
  ------------------
  |  Branch (532:11): [True: 2, False: 0]
  |  Branch (532:20): [True: 2, False: 0]
  |  Branch (532:38): [True: 0, False: 2]
  ------------------
  533|      0|        p = stpcpy (p, argv[argc]);
  534|      2|      else
  535|      2|        p = stpcpy (stpcpy (p, "/"), argv[argc]);
  536|      2|    }
  537|       |
  538|      5|  if (want_abs)
  ------------------
  |  Branch (538:7): [True: 3, False: 2]
  ------------------
  539|      3|    {
  540|       |#ifdef HAVE_DRIVE_LETTERS
  541|       |      p = strchr (name, ':');
  542|       |      if (p)
  543|       |        p++;
  544|       |      else
  545|       |        p = name;
  546|       |#else
  547|      3|      p = name;
  548|      3|#endif
  549|      3|      if (*p != '/'
  ------------------
  |  Branch (549:11): [True: 0, False: 3]
  ------------------
  550|       |#ifdef HAVE_DRIVE_LETTERS
  551|       |          && *p != '\\'
  552|       |#endif
  553|      3|          )
  554|      0|        {
  555|      0|          home = gnupg_getcwd ();
  556|      0|          if (!home)
  ------------------
  |  Branch (556:15): [True: 0, False: 0]
  ------------------
  557|      0|            {
  558|      0|              if (xmode)
  ------------------
  |  Branch (558:19): [True: 0, False: 0]
  ------------------
  559|      0|                {
  560|      0|                  fprintf (stderr, "\nfatal: getcwd failed: %s\n",
  561|      0|                           strerror (errno));
  562|      0|                  exit(2);
  563|      0|                }
  564|      0|              xfree (name);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  565|      0|              return NULL;
  566|      0|            }
  567|      0|          n = strlen (home) + 1 + strlen (name) + 1;
  568|      0|          if (xmode)
  ------------------
  |  Branch (568:15): [True: 0, False: 0]
  ------------------
  569|      0|            home_buffer = xmalloc (n);
  ------------------
  |  |  107|      0|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  570|      0|          else
  571|      0|            {
  572|      0|              home_buffer = xtrymalloc (n);
  ------------------
  |  |   97|      0|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  573|      0|              if (!home_buffer)
  ------------------
  |  Branch (573:19): [True: 0, False: 0]
  ------------------
  574|      0|                {
  575|      0|                  xfree (home);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  576|      0|                  xfree (name);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  577|      0|                  return NULL;
  578|      0|                }
  579|      0|            }
  580|      0|          if (p == name)
  ------------------
  |  Branch (580:15): [True: 0, False: 0]
  ------------------
  581|      0|            p = home_buffer;
  582|      0|          else /* Windows case.  */
  583|      0|            {
  584|      0|              memcpy (home_buffer, p, p - name + 1);
  585|      0|              p = home_buffer + (p - name + 1);
  586|      0|            }
  587|       |
  588|       |          /* Avoid a leading double slash if the cwd is "/".  */
  589|      0|          if (home[0] == '/' && !home[1])
  ------------------
  |  Branch (589:15): [True: 0, False: 0]
  |  Branch (589:33): [True: 0, False: 0]
  ------------------
  590|      0|            strcpy (stpcpy (p, "/"), name);
  591|      0|          else
  592|      0|            strcpy (stpcpy (stpcpy (p, home), "/"), name);
  593|       |
  594|      0|          xfree (home);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  595|      0|          xfree (name);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  596|      0|          name = home_buffer;
  597|       |          /* Let's do a simple compression to catch the most common
  598|       |             case of using "." for gpg's --homedir option.  */
  599|      0|          n = strlen (name);
  600|      0|          if (n > 2 && name[n-2] == '/' && name[n-1] == '.')
  ------------------
  |  Branch (600:15): [True: 0, False: 0]
  |  Branch (600:24): [True: 0, False: 0]
  |  Branch (600:44): [True: 0, False: 0]
  ------------------
  601|      0|            name[n-2] = 0;
  602|      0|        }
  603|      3|    }
  604|      5|  return change_slashes (name);
  605|      5|}
stringhelp.c:change_slashes:
   70|      5|{
   71|       |#ifdef HAVE_DOSISH_SYSTEM
   72|       |  char *p;
   73|       |
   74|       |  if (strchr (name, '\\'))
   75|       |    {
   76|       |      for (p=name; *p; p++)
   77|       |        if (*p == '/')
   78|       |          *p = '\\';
   79|       |    }
   80|       |#endif /*HAVE_DOSISH_SYSTEM*/
   81|      5|  return name;
   82|      5|}

free_strlist:
   46|  28.2k|{
   47|  28.2k|    strlist_t sl2;
   48|       |
   49|  28.2k|    for(; sl; sl = sl2 ) {
  ------------------
  |  Branch (49:11): [True: 0, False: 28.2k]
  ------------------
   50|      0|	sl2 = sl->next;
   51|      0|	xfree(sl);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
   52|      0|    }
   53|  28.2k|}
add_to_strlist:
   73|      1|{
   74|      1|    strlist_t sl;
   75|       |
   76|      1|    sl = xmalloc( sizeof *sl + strlen(string));
  ------------------
  |  |  107|      1|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
   77|      1|    sl->flags = 0;
   78|      1|    strcpy(sl->d, string);
   79|      1|    sl->next = *list;
   80|      1|    *list = sl;
   81|      1|    return sl;
   82|      1|}

get_session_marker:
  352|  46.5k|{
  353|  46.5k|  static byte marker[SIZEOF_UNSIGNED_LONG*2];
  354|  46.5k|  static int initialized;
  355|       |
  356|  46.5k|  if (!initialized)
  ------------------
  |  Branch (356:7): [True: 1, False: 46.5k]
  ------------------
  357|      1|    {
  358|      1|      gcry_create_nonce (marker, sizeof marker);
  359|      1|      initialized = 1;
  360|      1|    }
  361|  46.5k|  *rlen = sizeof (marker);
  362|  46.5k|  return marker;
  363|  46.5k|}
check_special_filename:
  582|   207k|{
  583|   207k|  if (allow_special_filenames
  ------------------
  |  Branch (583:7): [True: 0, False: 207k]
  ------------------
  584|   207k|      && fname && *fname == '-' && fname[1] == '&')
  ------------------
  |  Branch (584:10): [True: 0, False: 0]
  |  Branch (584:19): [True: 0, False: 0]
  |  Branch (584:36): [True: 0, False: 0]
  ------------------
  585|      0|    {
  586|      0|      int i;
  587|       |
  588|      0|      fname += 2;
  589|      0|      for (i=0; digitp (fname+i); i++ )
  ------------------
  |  |  408|      0|#define digitp(p)   (*(p) >= '0' && *(p) <= '9')
  |  |  ------------------
  |  |  |  Branch (408:22): [True: 0, False: 0]
  |  |  |  Branch (408:37): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  590|      0|        ;
  591|      0|      if (!fname[i])
  ------------------
  |  Branch (591:11): [True: 0, False: 0]
  ------------------
  592|      0|        return notranslate? atoi (fname)
  ------------------
  |  Branch (592:16): [True: 0, False: 0]
  ------------------
  593|      0|          /**/            : translate_sys2libc_fd_int (atoi (fname), for_write);
  594|      0|    }
  595|   207k|  return -1;
  596|   207k|}
gnupg_access:
 1235|      9|{
 1236|      9|  return gpgrt_access (name, mode);
 1237|      9|}
gnupg_stat:
 1244|      1|{
 1245|       |# ifdef HAVE_W32_SYSTEM
 1246|       |#  if __MINGW32_MAJOR_VERSION > 3
 1247|       |    /* mingw.org's MinGW */
 1248|       |#   define STRUCT_STAT _stat
 1249|       |#  elif defined(_USE_32BIT_TIME_T)
 1250|       |    /* MinGW64 for i686 */
 1251|       |#   define STRUCT_STAT _stat32
 1252|       |#  else
 1253|       |    /* MinGW64 for x86_64 */
 1254|       |#   define STRUCT_STAT _stat64i32
 1255|       |#  endif
 1256|       |  if (any8bitchar (name))
 1257|       |    {
 1258|       |      wchar_t *wname;
 1259|       |      struct STRUCT_STAT st32;
 1260|       |      int ret;
 1261|       |
 1262|       |      wname = utf8_to_wchar (name);
 1263|       |      if (!wname)
 1264|       |        return -1;
 1265|       |      ret = _wstat (wname, &st32);
 1266|       |      xfree (wname);
 1267|       |      if (!ret)
 1268|       |        {
 1269|       |          statbuf->st_dev   = st32.st_dev;
 1270|       |          statbuf->st_ino   = st32.st_ino;
 1271|       |          statbuf->st_mode  = st32.st_mode;
 1272|       |          statbuf->st_nlink = st32.st_nlink;
 1273|       |          statbuf->st_uid   = st32.st_uid;
 1274|       |          statbuf->st_gid   = st32.st_gid;
 1275|       |          statbuf->st_rdev  = st32.st_rdev;
 1276|       |          statbuf->st_size  = st32.st_size;
 1277|       |          statbuf->st_atime = st32.st_atime;
 1278|       |          statbuf->st_mtime = st32.st_mtime;
 1279|       |          statbuf->st_ctime = st32.st_ctime;
 1280|       |        }
 1281|       |      return ret;
 1282|       |    }
 1283|       |  else
 1284|       |    return stat (name, statbuf);
 1285|       |# else
 1286|      1|  return stat (name, statbuf);
 1287|      1|# endif
 1288|      1|}
gnupg_open:
 1295|      1|{
 1296|       |#ifdef HAVE_W32_SYSTEM
 1297|       |  if (any8bitchar (name))
 1298|       |    {
 1299|       |      wchar_t *wname;
 1300|       |      int ret;
 1301|       |
 1302|       |      wname = utf8_to_wchar (name);
 1303|       |      if (!wname)
 1304|       |        return -1;
 1305|       |      ret = _wopen (wname, flags, mode);
 1306|       |      xfree (wname);
 1307|       |      return ret;
 1308|       |    }
 1309|       |  else
 1310|       |    return open (name, flags, mode);
 1311|       |#else
 1312|      1|  return open (name, flags, mode);
 1313|      1|#endif
 1314|      1|}

utf8_to_native:
  689|  2.21k|{
  690|  2.21k|  return do_utf8_to_native (string, length, delim, use_iconv);
  691|  2.21k|}
utf8conv.c:do_utf8_to_native:
  410|  2.21k|{
  411|  2.21k|  int nleft;
  412|  2.21k|  int i;
  413|  2.21k|  unsigned char encbuf[8];
  414|  2.21k|  int encidx;
  415|  2.21k|  const unsigned char *s;
  416|  2.21k|  size_t n;
  417|  2.21k|  char *buffer = NULL;
  418|  2.21k|  char *p = NULL;
  419|  2.21k|  unsigned long val = 0;
  420|  2.21k|  size_t slen;
  421|  2.21k|  int resync = 0;
  422|       |
  423|       |  /* First pass (p==NULL): count the extended utf-8 characters.  */
  424|       |  /* Second pass (p!=NULL): create string.  */
  425|  2.21k|  for (;;)
  426|  4.42k|    {
  427|  4.42k|      for (slen = length, nleft = encidx = 0, n = 0,
  428|  4.42k|             s = (const unsigned char *)string;
  429|  43.0k|           slen;
  ------------------
  |  Branch (429:12): [True: 38.5k, False: 4.42k]
  ------------------
  430|  38.5k|	   s++, slen--)
  431|  38.5k|	{
  432|  38.5k|	  if (resync)
  ------------------
  |  Branch (432:8): [True: 9.75k, False: 28.8k]
  ------------------
  433|  9.75k|	    {
  434|  9.75k|	      if (!(*s < 128 || (*s >= 0xc0 && *s <= 0xfd)))
  ------------------
  |  Branch (434:14): [True: 2.89k, False: 6.85k]
  |  Branch (434:27): [True: 4.41k, False: 2.43k]
  |  Branch (434:41): [True: 3.54k, False: 874]
  ------------------
  435|  3.30k|		{
  436|       |		  /* Still invalid. */
  437|  3.30k|		  if (p)
  ------------------
  |  Branch (437:9): [True: 2.06k, False: 1.24k]
  ------------------
  438|  2.06k|		    {
  439|  2.06k|		      sprintf (p, "\\x%02x", *s);
  440|  2.06k|		      p += 4;
  441|  2.06k|		    }
  442|  3.30k|		  n += 4;
  443|  3.30k|		  continue;
  444|  3.30k|		}
  445|  6.44k|	      resync = 0;
  446|  6.44k|	    }
  447|  35.2k|	  if (!nleft)
  ------------------
  |  Branch (447:8): [True: 25.5k, False: 9.76k]
  ------------------
  448|  25.5k|	    {
  449|  25.5k|	      if (!(*s & 0x80))
  ------------------
  |  Branch (449:12): [True: 13.9k, False: 11.5k]
  ------------------
  450|  13.9k|		{
  451|       |                  /* Plain ascii. */
  452|  13.9k|		  if ( delim != -1
  ------------------
  |  Branch (452:10): [True: 13.9k, False: 0]
  ------------------
  453|  13.9k|                       && (*s < 0x20 || *s == 0x7f || *s == delim
  ------------------
  |  Branch (453:28): [True: 8.53k, False: 5.45k]
  |  Branch (453:41): [True: 124, False: 5.33k]
  |  Branch (453:55): [True: 0, False: 5.33k]
  ------------------
  454|  13.9k|                           || (delim && *s == '\\')))
  ------------------
  |  Branch (454:32): [True: 0, False: 5.33k]
  |  Branch (454:41): [True: 0, False: 0]
  ------------------
  455|  8.65k|		    {
  456|  8.65k|		      n++;
  457|  8.65k|		      if (p)
  ------------------
  |  Branch (457:13): [True: 4.32k, False: 4.32k]
  ------------------
  458|  4.32k|			*p++ = '\\';
  459|  8.65k|		      switch (*s)
  460|  8.65k|			{
  461|    738|                        case '\n': n++; if ( p ) *p++ = 'n'; break;
  ------------------
  |  Branch (461:25): [True: 738, False: 7.91k]
  |  Branch (461:46): [True: 369, False: 369]
  ------------------
  462|    488|                        case '\r': n++; if ( p ) *p++ = 'r'; break;
  ------------------
  |  Branch (462:25): [True: 488, False: 8.16k]
  |  Branch (462:46): [True: 244, False: 244]
  ------------------
  463|    872|                        case '\f': n++; if ( p ) *p++ = 'f'; break;
  ------------------
  |  Branch (463:25): [True: 872, False: 7.78k]
  |  Branch (463:46): [True: 436, False: 436]
  ------------------
  464|    512|                        case '\v': n++; if ( p ) *p++ = 'v'; break;
  ------------------
  |  Branch (464:25): [True: 512, False: 8.14k]
  |  Branch (464:46): [True: 256, False: 256]
  ------------------
  465|    652|                        case '\b': n++; if ( p ) *p++ = 'b'; break;
  ------------------
  |  Branch (465:25): [True: 652, False: 8.00k]
  |  Branch (465:46): [True: 326, False: 326]
  ------------------
  466|  2.89k|                        case    0: n++; if ( p ) *p++ = '0'; break;
  ------------------
  |  Branch (466:25): [True: 2.89k, False: 5.76k]
  |  Branch (466:46): [True: 1.44k, False: 1.44k]
  ------------------
  467|  2.49k|			default:
  ------------------
  |  Branch (467:4): [True: 2.49k, False: 6.15k]
  ------------------
  468|  2.49k|			  n += 3;
  469|  2.49k|			  if (p)
  ------------------
  |  Branch (469:10): [True: 1.24k, False: 1.24k]
  ------------------
  470|  1.24k|			    {
  471|  1.24k|			      sprintf (p, "x%02x", *s);
  472|  1.24k|			      p += 3;
  473|  1.24k|			    }
  474|  2.49k|			  break;
  475|  8.65k|			}
  476|  8.65k|		    }
  477|  5.33k|		  else
  478|  5.33k|		    {
  479|  5.33k|		      if (p)
  ------------------
  |  Branch (479:13): [True: 2.66k, False: 2.66k]
  ------------------
  480|  2.66k|			*p++ = *s;
  481|  5.33k|		      n++;
  482|  5.33k|		    }
  483|  13.9k|		}
  484|  11.5k|	      else if ((*s & 0xe0) == 0xc0) /* 110x xxxx */
  ------------------
  |  Branch (484:17): [True: 4.14k, False: 7.39k]
  ------------------
  485|  4.14k|		{
  486|  4.14k|		  val = *s & 0x1f;
  487|  4.14k|		  nleft = 1;
  488|  4.14k|		  encidx = 0;
  489|  4.14k|		  encbuf[encidx++] = *s;
  490|  4.14k|		}
  491|  7.39k|	      else if ((*s & 0xf0) == 0xe0) /* 1110 xxxx */
  ------------------
  |  Branch (491:17): [True: 766, False: 6.62k]
  ------------------
  492|    766|		{
  493|    766|		  val = *s & 0x0f;
  494|    766|		  nleft = 2;
  495|    766|		  encidx = 0;
  496|    766|		  encbuf[encidx++] = *s;
  497|    766|		}
  498|  6.62k|	      else if ((*s & 0xf8) == 0xf0) /* 1111 0xxx */
  ------------------
  |  Branch (498:17): [True: 1.01k, False: 5.61k]
  ------------------
  499|  1.01k|		{
  500|  1.01k|		  val = *s & 0x07;
  501|  1.01k|		  nleft = 3;
  502|  1.01k|		  encidx = 0;
  503|  1.01k|		  encbuf[encidx++] = *s;
  504|  1.01k|		}
  505|  5.61k|	      else if ((*s & 0xfc) == 0xf8) /* 1111 10xx */
  ------------------
  |  Branch (505:17): [True: 496, False: 5.11k]
  ------------------
  506|    496|		{
  507|    496|		  val = *s & 0x03;
  508|    496|		  nleft = 4;
  509|    496|		  encidx = 0;
  510|    496|		  encbuf[encidx++] = *s;
  511|    496|		}
  512|  5.11k|	      else if ((*s & 0xfe) == 0xfc) /* 1111 110x */
  ------------------
  |  Branch (512:17): [True: 496, False: 4.62k]
  ------------------
  513|    496|		{
  514|    496|		  val = *s & 0x01;
  515|    496|		  nleft = 5;
  516|    496|		  encidx = 0;
  517|    496|		  encbuf[encidx++] = *s;
  518|    496|		}
  519|  4.62k|	      else /* Invalid encoding: print as \xNN. */
  520|  4.62k|		{
  521|  4.62k|		  if (p)
  ------------------
  |  Branch (521:9): [True: 1.90k, False: 2.71k]
  ------------------
  522|  1.90k|		    {
  523|  1.90k|		      sprintf (p, "\\x%02x", *s);
  524|  1.90k|		      p += 4;
  525|  1.90k|		    }
  526|  4.62k|		  n += 4;
  527|  4.62k|		  resync = 1;
  528|  4.62k|		}
  529|  25.5k|	    }
  530|  9.76k|	  else if (*s < 0x80 || *s >= 0xc0) /* Invalid utf-8 */
  ------------------
  |  Branch (530:13): [True: 1.50k, False: 8.26k]
  |  Branch (530:26): [True: 1.43k, False: 6.82k]
  ------------------
  531|  2.93k|	    {
  532|  2.93k|	      if (p)
  ------------------
  |  Branch (532:12): [True: 1.46k, False: 1.46k]
  ------------------
  533|  1.46k|		{
  534|  3.48k|		  for (i = 0; i < encidx; i++)
  ------------------
  |  Branch (534:17): [True: 2.01k, False: 1.46k]
  ------------------
  535|  2.01k|		    {
  536|  2.01k|		      sprintf (p, "\\x%02x", encbuf[i]);
  537|  2.01k|		      p += 4;
  538|  2.01k|		    }
  539|  1.46k|		  sprintf (p, "\\x%02x", *s);
  540|  1.46k|		  p += 4;
  541|  1.46k|		}
  542|  2.93k|	      n += 4 + 4 * encidx;
  543|  2.93k|	      nleft = 0;
  544|  2.93k|	      encidx = 0;
  545|  2.93k|	      resync = 1;
  546|  2.93k|	    }
  547|  6.82k|	  else
  548|  6.82k|	    {
  549|  6.82k|	      encbuf[encidx++] = *s;
  550|  6.82k|	      val <<= 6;
  551|  6.82k|	      val |= *s & 0x3f;
  552|  6.82k|	      if (!--nleft)  /* Ready. */
  ------------------
  |  Branch (552:12): [True: 3.79k, False: 3.03k]
  ------------------
  553|  3.79k|		{
  554|  3.79k|		  if (no_translation)
  ------------------
  |  Branch (554:9): [True: 0, False: 3.79k]
  ------------------
  555|      0|		    {
  556|      0|		      if (p)
  ------------------
  |  Branch (556:13): [True: 0, False: 0]
  ------------------
  557|      0|			{
  558|      0|			  for (i = 0; i < encidx; i++)
  ------------------
  |  Branch (558:18): [True: 0, False: 0]
  ------------------
  559|      0|			    *p++ = encbuf[i];
  560|      0|			}
  561|      0|		      n += encidx;
  562|      0|		      encidx = 0;
  563|      0|		    }
  564|  3.79k|                  else if (with_iconv)
  ------------------
  |  Branch (564:28): [True: 0, False: 3.79k]
  ------------------
  565|      0|                    {
  566|       |                      /* Our strategy for using iconv is a bit strange
  567|       |                         but it better keeps compatibility with
  568|       |                         previous versions in regard to how invalid
  569|       |                         encodings are displayed.  What we do is to
  570|       |                         keep the utf-8 as is and have the real
  571|       |                         translation step then at the end.  Yes, I
  572|       |                         know that this is ugly.  However we are short
  573|       |                         of the 1.4 release and for this branch we
  574|       |                         should not mess too much around with iconv
  575|       |                         things.  One reason for this is that we don't
  576|       |                         know enough about non-GNU iconv
  577|       |                         implementation and want to minimize the risk
  578|       |                         of breaking the code on too many platforms.  */
  579|      0|                        if ( p )
  ------------------
  |  Branch (579:30): [True: 0, False: 0]
  ------------------
  580|      0|                          {
  581|      0|                            for (i=0; i < encidx; i++ )
  ------------------
  |  Branch (581:39): [True: 0, False: 0]
  ------------------
  582|      0|                              *p++ = encbuf[i];
  583|      0|                          }
  584|      0|                        n += encidx;
  585|      0|                        encidx = 0;
  586|      0|                    }
  587|  3.79k|		  else 	/* Latin-1 case. */
  588|  3.79k|                    {
  589|  3.79k|		      if (val >= 0x80 && val < 256)
  ------------------
  |  Branch (589:13): [True: 3.01k, False: 784]
  |  Branch (589:28): [True: 1.86k, False: 1.14k]
  ------------------
  590|  1.86k|			{
  591|       |                          /* We can simply print this character */
  592|  1.86k|			  n++;
  593|  1.86k|			  if (p)
  ------------------
  |  Branch (593:10): [True: 934, False: 934]
  ------------------
  594|    934|			    *p++ = val;
  595|  1.86k|			}
  596|  1.93k|		      else
  597|  1.93k|			{
  598|       |                          /* We do not have a translation: print utf8. */
  599|  1.93k|			  if (p)
  ------------------
  |  Branch (599:10): [True: 965, False: 965]
  ------------------
  600|    965|			    {
  601|  3.83k|			      for (i = 0; i < encidx; i++)
  ------------------
  |  Branch (601:22): [True: 2.86k, False: 965]
  ------------------
  602|  2.86k|				{
  603|  2.86k|				  sprintf (p, "\\x%02x", encbuf[i]);
  604|  2.86k|				  p += 4;
  605|  2.86k|				}
  606|    965|			    }
  607|  1.93k|			  n += encidx * 4;
  608|  1.93k|			  encidx = 0;
  609|  1.93k|			}
  610|  3.79k|		    }
  611|  3.79k|		}
  612|       |
  613|  6.82k|	    }
  614|  35.2k|	}
  615|  4.42k|      if (!buffer)
  ------------------
  |  Branch (615:11): [True: 2.21k, False: 2.21k]
  ------------------
  616|  2.21k|	{
  617|       |          /* Allocate the buffer after the first pass. */
  618|  2.21k|	  buffer = p = xmalloc (n + 1);
  ------------------
  |  |  107|  2.21k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  619|  2.21k|	}
  620|  2.21k|      else if (with_iconv)
  ------------------
  |  Branch (620:16): [True: 0, False: 2.21k]
  ------------------
  621|      0|        {
  622|       |          /* Note: See above for comments.  */
  623|      0|          iconv_t cd;
  624|      0|          const char *inptr;
  625|      0|          char *outbuf, *outptr;
  626|      0|          size_t inbytes, outbytes;
  627|       |
  628|      0|          *p = 0;  /* Terminate the buffer. */
  629|       |
  630|      0|          cd = iconv_open (active_charset_name, "utf-8");
  631|      0|          if (cd == (iconv_t)-1)
  ------------------
  |  Branch (631:15): [True: 0, False: 0]
  ------------------
  632|      0|            {
  633|      0|              handle_iconv_error (active_charset_name, "utf-8", 1);
  634|      0|              xfree (buffer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  635|      0|              return utf8_to_native (string, length, delim);
  636|      0|            }
  637|       |
  638|       |          /* Allocate a new buffer large enough to hold all possible
  639|       |             encodings. */
  640|      0|          n = p - buffer + 1;
  641|      0|          inbytes = n - 1;;
  642|      0|          inptr = buffer;
  643|      0|          outbytes = n * MB_LEN_MAX;
  ------------------
  |  |   63|      0|#define MB_LEN_MAX 16
  ------------------
  644|      0|          if (outbytes / MB_LEN_MAX != n)
  ------------------
  |  |   63|      0|#define MB_LEN_MAX 16
  ------------------
  |  Branch (644:15): [True: 0, False: 0]
  ------------------
  645|      0|            BUG (); /* Actually an overflow. */
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  646|      0|          outbuf = outptr = xmalloc (outbytes);
  ------------------
  |  |  107|      0|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  647|      0|          if ( iconv (cd, (ICONV_CONST char **)&inptr, &inbytes,
  ------------------
  |  Branch (647:16): [True: 0, False: 0]
  ------------------
  648|      0|                      &outptr, &outbytes) == (size_t)-1)
  649|      0|            {
  650|      0|              static int shown;
  651|       |
  652|      0|              if (!shown)
  ------------------
  |  Branch (652:19): [True: 0, False: 0]
  ------------------
  653|      0|                log_info (_("conversion from '%s' to '%s' failed: %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  654|      0|                          "utf-8", active_charset_name, strerror (errno));
  655|      0|              shown = 1;
  656|       |              /* Didn't worked out.  Try again but without iconv.  */
  657|      0|              xfree (buffer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  658|      0|              buffer = NULL;
  659|      0|              xfree (outbuf);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  660|      0|              outbuf = do_utf8_to_native (string, length, delim, 0);
  661|      0|            }
  662|      0|            else /* Success.  */
  663|      0|              {
  664|      0|                *outptr = 0; /* Make sure it is a string. */
  665|       |                /* We could realloc the buffer now but I doubt that it
  666|       |                   makes much sense given that it will get freed
  667|       |                   anyway soon after.  */
  668|      0|                xfree (buffer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  669|      0|              }
  670|      0|          iconv_close (cd);
  671|      0|          return outbuf;
  672|      0|        }
  673|  2.21k|      else /* Not using iconv. */
  674|  2.21k|	{
  675|  2.21k|	  *p = 0; /* Make sure it is a string. */
  676|  2.21k|	  return buffer;
  677|  2.21k|	}
  678|  4.42k|    }
  679|  2.21k|}

parse-packet.c:buf32_to_ulong:
   89|  3.26k|{
   90|  3.26k|  const unsigned char *p = buffer;
   91|       |
   92|  3.26k|  return (((unsigned long)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
   93|  3.26k|}
parse-packet.c:buf32_to_size_t:
   81|  18.8k|{
   82|  18.8k|  const unsigned char *p = buffer;
   83|       |
   84|  18.8k|  return (((size_t)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
   85|  18.8k|}
parse-packet.c:buf32_to_u32:
  105|  15.8k|{
  106|  15.8k|  const unsigned char *p = buffer;
  107|       |
  108|  15.8k|  return (((u32)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
  109|  15.8k|}
tdbio.c:buf32_to_ulong:
   89|    273|{
   90|    273|  const unsigned char *p = buffer;
   91|       |
   92|    273|  return (((unsigned long)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
   93|    273|}

new_armor_context:
  115|  6.66k|{
  116|  6.66k|  armor_filter_context_t *afx;
  117|  6.66k|  gpg_error_t err;
  118|       |
  119|  6.66k|  afx = xcalloc (1, sizeof *afx);
  ------------------
  |  |  109|  6.66k|#define xcalloc(a,b)     gcry_xcalloc ((a),(b))
  ------------------
  120|  6.66k|  if (afx)
  ------------------
  |  Branch (120:7): [True: 6.66k, False: 0]
  ------------------
  121|  6.66k|    {
  122|  6.66k|      err = gcry_md_open (&afx->crc_md, GCRY_MD_CRC24_RFC2440, 0);
  123|  6.66k|      if (err != 0)
  ------------------
  |  Branch (123:11): [True: 0, False: 6.66k]
  ------------------
  124|      0|	{
  125|      0|	  log_error ("gcry_md_open failed for GCRY_MD_CRC24_RFC2440: %s",
  126|      0|		    gpg_strerror (err));
  127|      0|	  xfree (afx);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  128|      0|	  return NULL;
  129|      0|	}
  130|       |
  131|  6.66k|      afx->refcount = 1;
  132|  6.66k|    }
  133|       |
  134|  6.66k|  return afx;
  135|  6.66k|}
release_armor_context:
  141|  31.0k|{
  142|  31.0k|  if (!afx)
  ------------------
  |  Branch (142:7): [True: 17.7k, False: 13.3k]
  ------------------
  143|  17.7k|    return;
  144|  13.3k|  log_assert (afx->refcount);
  145|  13.3k|  if ( --afx->refcount )
  ------------------
  |  Branch (145:8): [True: 6.66k, False: 6.66k]
  ------------------
  146|  6.66k|    return;
  147|  6.66k|  gcry_md_close (afx->crc_md);
  148|  6.66k|  xfree (afx);
  ------------------
  |  |  104|  6.66k|#define xfree(a)         gcry_free ((a))
  ------------------
  149|  6.66k|}
push_armor_filter:
  154|  6.66k|{
  155|  6.66k|  int rc;
  156|       |
  157|  6.66k|  afx->refcount++;
  158|  6.66k|  rc = iobuf_push_filter (iobuf, armor_filter, afx);
  159|  6.66k|  if (rc)
  ------------------
  |  Branch (159:7): [True: 0, False: 6.66k]
  ------------------
  160|      0|    afx->refcount--;
  161|  6.66k|  return rc;
  162|  6.66k|}
use_armor_filter:
  295|  24.4k|{
  296|  24.4k|    byte buf[2];
  297|  24.4k|    int n;
  298|       |
  299|       |    /* fixme: there might be a problem with iobuf_peek */
  300|  24.4k|    n = iobuf_peek (a, buf, 2);
  301|  24.4k|    if( n == -1 )
  ------------------
  |  Branch (301:9): [True: 0, False: 24.4k]
  ------------------
  302|      0|	return 0; /* EOF, doesn't matter whether armored or not */
  303|  24.4k|    if( !n )
  ------------------
  |  Branch (303:9): [True: 0, False: 24.4k]
  ------------------
  304|      0|	return 1; /* can't check it: try armored */
  305|  24.4k|    if (n != 2)
  ------------------
  |  Branch (305:9): [True: 60, False: 24.3k]
  ------------------
  306|     60|	return 0; /* short buffer */
  307|  24.3k|    return is_armored(buf);
  308|  24.4k|}
armor.c:is_armored:
  218|  67.6k|{
  219|  67.6k|  int ctb, pkttype;
  220|  67.6k|  int indeterminate_length_allowed;
  221|       |
  222|  67.6k|    ctb = *buf;
  223|  67.6k|    if( !(ctb & 0x80) )
  ------------------
  |  Branch (223:9): [True: 45.5k, False: 22.1k]
  ------------------
  224|       |      /* The most significant bit of the CTB must be set.  Since it is
  225|       |         cleared, this is not a binary OpenPGP message.  Assume it is
  226|       |         armored.  */
  227|  45.5k|      return 1;
  228|       |
  229|  22.1k|    pkttype =  ctb & 0x40 ? (ctb & 0x3f) : ((ctb>>2)&0xf);
  ------------------
  |  Branch (229:16): [True: 9.28k, False: 12.8k]
  ------------------
  230|  22.1k|    switch( pkttype ) {
  231|    404|      case PKT_PUBKEY_ENC:
  ------------------
  |  Branch (231:7): [True: 404, False: 21.7k]
  ------------------
  232|  6.41k|      case PKT_SIGNATURE:
  ------------------
  |  Branch (232:7): [True: 6.01k, False: 16.0k]
  ------------------
  233|  6.84k|      case PKT_SYMKEY_ENC:
  ------------------
  |  Branch (233:7): [True: 431, False: 21.6k]
  ------------------
  234|  7.66k|      case PKT_ONEPASS_SIG:
  ------------------
  |  Branch (234:7): [True: 820, False: 21.2k]
  ------------------
  235|  7.86k|      case PKT_SECRET_KEY:
  ------------------
  |  Branch (235:7): [True: 198, False: 21.9k]
  ------------------
  236|  8.17k|      case PKT_PUBLIC_KEY:
  ------------------
  |  Branch (236:7): [True: 306, False: 21.8k]
  ------------------
  237|  9.20k|      case PKT_SECRET_SUBKEY:
  ------------------
  |  Branch (237:7): [True: 1.03k, False: 21.0k]
  ------------------
  238|  9.46k|      case PKT_MARKER:
  ------------------
  |  Branch (238:7): [True: 260, False: 21.8k]
  ------------------
  239|  10.1k|      case PKT_RING_TRUST:
  ------------------
  |  Branch (239:7): [True: 667, False: 21.4k]
  ------------------
  240|  10.3k|      case PKT_USER_ID:
  ------------------
  |  Branch (240:7): [True: 194, False: 21.9k]
  ------------------
  241|  10.6k|      case PKT_PUBLIC_SUBKEY:
  ------------------
  |  Branch (241:7): [True: 288, False: 21.8k]
  ------------------
  242|  11.2k|      case PKT_ATTRIBUTE:
  ------------------
  |  Branch (242:7): [True: 587, False: 21.5k]
  ------------------
  243|  11.7k|      case PKT_MDC:
  ------------------
  |  Branch (243:7): [True: 568, False: 21.5k]
  ------------------
  244|  11.7k|	indeterminate_length_allowed = 0;
  245|  11.7k|        break;
  246|       |
  247|  3.52k|      case PKT_COMPRESSED:
  ------------------
  |  Branch (247:7): [True: 3.52k, False: 18.5k]
  ------------------
  248|  3.95k|      case PKT_ENCRYPTED:
  ------------------
  |  Branch (248:7): [True: 434, False: 21.6k]
  ------------------
  249|  4.07k|      case PKT_ENCRYPTED_MDC:
  ------------------
  |  Branch (249:7): [True: 114, False: 21.9k]
  ------------------
  250|  4.23k|      case PKT_ENCRYPTED_AEAD:
  ------------------
  |  Branch (250:7): [True: 162, False: 21.9k]
  ------------------
  251|  6.85k|      case PKT_PLAINTEXT:
  ------------------
  |  Branch (251:7): [True: 2.62k, False: 19.4k]
  ------------------
  252|  6.94k|      case PKT_OLD_COMMENT:
  ------------------
  |  Branch (252:7): [True: 90, False: 22.0k]
  ------------------
  253|  7.10k|      case PKT_COMMENT:
  ------------------
  |  Branch (253:7): [True: 158, False: 21.9k]
  ------------------
  254|  7.49k|      case PKT_GPG_CONTROL:
  ------------------
  |  Branch (254:7): [True: 388, False: 21.7k]
  ------------------
  255|  7.49k|	indeterminate_length_allowed = 1;
  256|  7.49k|        break;
  257|       |
  258|  2.84k|      default:
  ------------------
  |  Branch (258:7): [True: 2.84k, False: 19.2k]
  ------------------
  259|       |        /* Invalid packet type.  */
  260|  2.84k|        return 1;
  261|  22.1k|    }
  262|       |
  263|  19.2k|    if (! indeterminate_length_allowed)
  ------------------
  |  Branch (263:9): [True: 11.7k, False: 7.49k]
  ------------------
  264|       |      /* It is only legal to use an indeterminate length with a few
  265|       |         packet types.  If a packet uses an indeterminate length, but
  266|       |         that is not allowed, then the data is not valid binary
  267|       |         OpenPGP data.  */
  268|  11.7k|      {
  269|  11.7k|        int new_format;
  270|  11.7k|        int indeterminate_length;
  271|       |
  272|  11.7k|        new_format = !! (ctb & (1 << 6));
  273|  11.7k|        if (new_format)
  ------------------
  |  Branch (273:13): [True: 4.38k, False: 7.38k]
  ------------------
  274|  4.38k|          indeterminate_length = (buf[1] >= 224 && buf[1] < 255);
  ------------------
  |  Branch (274:35): [True: 793, False: 3.59k]
  |  Branch (274:52): [True: 501, False: 292]
  ------------------
  275|  7.38k|        else
  276|  7.38k|          indeterminate_length = (ctb & 3) == 3;
  277|       |
  278|  11.7k|        if (indeterminate_length)
  ------------------
  |  Branch (278:13): [True: 791, False: 10.9k]
  ------------------
  279|    791|          return 1;
  280|  11.7k|      }
  281|       |
  282|       |    /* The first CTB seems legit.  It is probably not armored
  283|       |       data.  */
  284|  18.4k|    return 0;
  285|  19.2k|}
armor.c:armor_filter:
 1284|   122k|{
 1285|   122k|    size_t size = *ret_len;
 1286|   122k|    armor_filter_context_t *afx = opaque;
 1287|   122k|    int rc=0, c;
 1288|   122k|    byte radbuf[3];
 1289|   122k|    int  idx, idx2;
 1290|   122k|    size_t n=0;
 1291|   122k|    u32 crc;
 1292|       |#if 0
 1293|       |    static FILE *fp ;
 1294|       |
 1295|       |    if( !fp ) {
 1296|       |	fp = fopen("armor.out", "w");
 1297|       |	log_assert(fp);
 1298|       |    }
 1299|       |#endif
 1300|       |
 1301|   122k|    if( DBG_FILTER )
  ------------------
  |  |  351|   122k|#define DBG_FILTER (opt.debug & DBG_FILTER_VALUE)
  |  |  ------------------
  |  |  |  |  335|   122k|#define DBG_FILTER_VALUE  8	/* debug internal filter handling */
  |  |  ------------------
  |  |  |  Branch (351:20): [True: 0, False: 122k]
  |  |  ------------------
  ------------------
 1302|      0|	log_debug("armor-filter: control: %d\n", control );
 1303|   122k|    if( control == IOBUFCTRL_UNDERFLOW && afx->inp_bypass ) {
  ------------------
  |  Branch (1303:9): [True: 109k, False: 13.3k]
  |  Branch (1303:43): [True: 2.99k, False: 106k]
  ------------------
 1304|  2.99k|	n = 0;
 1305|  2.99k|	if( afx->buffer_len ) {
  ------------------
  |  Branch (1305:6): [True: 742, False: 2.25k]
  ------------------
 1306|       |            /* Copy the data from AFX->BUFFER to BUF.  */
 1307|  3.29M|	    for(; n < size && afx->buffer_pos < afx->buffer_len; n++ )
  ------------------
  |  Branch (1307:12): [True: 3.29M, False: 466]
  |  Branch (1307:24): [True: 3.29M, False: 276]
  ------------------
 1308|  3.29M|		buf[n++] = afx->buffer[afx->buffer_pos++];
 1309|    742|	    if( afx->buffer_pos >= afx->buffer_len )
  ------------------
  |  Branch (1309:10): [True: 285, False: 457]
  ------------------
 1310|    285|		afx->buffer_len = 0;
 1311|    742|	}
 1312|       |        /* If there is still space in BUF, read directly into it.  */
 1313|  19.4M|	for(; n < size; n++ ) {
  ------------------
  |  Branch (1313:8): [True: 19.4M, False: 1.95k]
  ------------------
 1314|  19.4M|	    if( (c=iobuf_get(a)) == -1 )
  ------------------
  |  |  500|  19.4M|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 19.4M]
  |  |  |  Branch (500:24): [True: 1.26k, False: 19.4M]
  |  |  ------------------
  |  |  501|  19.4M|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (1314:10): [True: 1.04k, False: 19.4M]
  ------------------
 1315|  1.04k|		break;
 1316|  19.4M|	    buf[n] = c & 0xff;
 1317|  19.4M|	}
 1318|  2.99k|	if( !n )
  ------------------
  |  Branch (1318:6): [True: 577, False: 2.41k]
  ------------------
 1319|       |            /* We didn't get any data.  EOF.  */
 1320|    577|	    rc = -1;
 1321|  2.99k|	*ret_len = n;
 1322|  2.99k|    }
 1323|   119k|    else if( control == IOBUFCTRL_UNDERFLOW ) {
  ------------------
  |  Branch (1323:14): [True: 106k, False: 13.3k]
  ------------------
 1324|       |        /* We need some space for the faked packet.  The minmum
 1325|       |         * required size is the PARTIAL_CHUNK size plus a byte for the
 1326|       |         * length itself */
 1327|   106k|	if( size < PARTIAL_CHUNK+1 )
  ------------------
  |  |  636|   106k|#define PARTIAL_CHUNK 512
  ------------------
  |  Branch (1327:6): [True: 0, False: 106k]
  ------------------
 1328|      0|	    BUG(); /* supplied buffer too short */
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1329|       |
 1330|   106k|	if( afx->faked )
  ------------------
  |  Branch (1330:6): [True: 30.6k, False: 75.6k]
  ------------------
 1331|  30.6k|	    rc = fake_packet( afx, a, &n, buf, size );
 1332|  75.6k|	else if( !afx->inp_checked ) {
  ------------------
  |  Branch (1332:11): [True: 47.3k, False: 28.3k]
  ------------------
 1333|  47.3k|	    rc = check_input( afx, a );
 1334|  47.3k|	    if( afx->inp_bypass ) {
  ------------------
  |  Branch (1334:10): [True: 882, False: 46.4k]
  ------------------
 1335|  1.00M|		for(n=0; n < size && afx->buffer_pos < afx->buffer_len; )
  ------------------
  |  Branch (1335:12): [True: 1.00M, False: 300]
  |  Branch (1335:24): [True: 1.00M, False: 582]
  ------------------
 1336|  1.00M|		    buf[n++] = afx->buffer[afx->buffer_pos++];
 1337|    882|		if( afx->buffer_pos >= afx->buffer_len )
  ------------------
  |  Branch (1337:7): [True: 585, False: 297]
  ------------------
 1338|    585|		    afx->buffer_len = 0;
 1339|    882|		if( !n )
  ------------------
  |  Branch (1339:7): [True: 181, False: 701]
  ------------------
 1340|    181|		    rc = -1;
 1341|    882|	    }
 1342|  46.4k|	    else if( afx->faked ) {
  ------------------
  |  Branch (1342:15): [True: 29.5k, False: 16.9k]
  ------------------
 1343|  29.5k|	        unsigned int hashes = afx->hashes;
 1344|  29.5k|                const byte *sesmark;
 1345|  29.5k|                size_t sesmarklen;
 1346|       |
 1347|  29.5k|                sesmark = get_session_marker( &sesmarklen );
 1348|  29.5k|                if ( sesmarklen > 20 )
  ------------------
  |  Branch (1348:22): [True: 0, False: 29.5k]
  ------------------
 1349|      0|                    BUG();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1350|       |
 1351|       |		/* the buffer is at least 15+n*15 bytes long, so it
 1352|       |		 * is easy to construct the packets */
 1353|       |
 1354|  29.5k|		hashes &= 1|2|8|16|32|64;
 1355|  29.5k|		if( !hashes ) {
  ------------------
  |  Branch (1355:7): [True: 22.7k, False: 6.78k]
  ------------------
 1356|  22.7k|		    hashes |= 2;  /* Default to SHA-1. */
 1357|  22.7k|		}
 1358|  29.5k|		n=0;
 1359|       |                /* First a gpg control packet... */
 1360|  29.5k|                buf[n++] = 0xff; /* new format, type 63, 1 length byte */
 1361|  29.5k|                n++;   /* see below */
 1362|  29.5k|                memcpy(buf+n, sesmark, sesmarklen ); n+= sesmarklen;
 1363|  29.5k|                buf[n++] = CTRLPKT_CLEARSIGN_START;
 1364|  29.5k|                buf[n++] = afx->not_dash_escaped? 0:1; /* sigclass */
  ------------------
  |  Branch (1364:28): [True: 411, False: 29.1k]
  ------------------
 1365|  29.5k|                if( hashes & 1 )
  ------------------
  |  Branch (1365:21): [True: 2.44k, False: 27.1k]
  ------------------
 1366|  2.44k|                    buf[n++] = DIGEST_ALGO_RMD160;
 1367|  29.5k|                if( hashes & 2 )
  ------------------
  |  Branch (1367:21): [True: 24.2k, False: 5.28k]
  ------------------
 1368|  24.2k|                    buf[n++] = DIGEST_ALGO_SHA1;
 1369|  29.5k|                if( hashes & 8 )
  ------------------
  |  Branch (1369:21): [True: 488, False: 29.0k]
  ------------------
 1370|    488|                    buf[n++] = DIGEST_ALGO_SHA224;
 1371|  29.5k|                if( hashes & 16 )
  ------------------
  |  Branch (1371:21): [True: 2.57k, False: 26.9k]
  ------------------
 1372|  2.57k|                    buf[n++] = DIGEST_ALGO_SHA256;
 1373|  29.5k|                if( hashes & 32 )
  ------------------
  |  Branch (1373:21): [True: 520, False: 29.0k]
  ------------------
 1374|    520|                    buf[n++] = DIGEST_ALGO_SHA384;
 1375|  29.5k|                if( hashes & 64 )
  ------------------
  |  Branch (1375:21): [True: 342, False: 29.2k]
  ------------------
 1376|    342|                    buf[n++] = DIGEST_ALGO_SHA512;
 1377|  29.5k|                buf[1] = n - 2;
 1378|       |
 1379|       |		/* ...followed by an invented plaintext packet.
 1380|       |		   Amusingly enough, this packet is not compliant with
 1381|       |		   2440 as the initial partial length is less than 512
 1382|       |		   bytes.  Of course, we'll accept it anyway ;) */
 1383|       |
 1384|  29.5k|		buf[n++] = 0xCB; /* new packet format, type 11 */
 1385|  29.5k|		buf[n++] = 0xE1; /* 2^1 == 2 bytes */
 1386|  29.5k|		buf[n++] = 't';  /* canonical text mode */
 1387|  29.5k|		buf[n++] = 0;	 /* namelength */
 1388|  29.5k|		buf[n++] = 0xE2; /* 2^2 == 4 more bytes */
 1389|  29.5k|		memset(buf+n, 0, 4); /* timestamp */
 1390|  29.5k|		n += 4;
 1391|  29.5k|	    }
 1392|  16.9k|	    else if( !rc )
  ------------------
  |  Branch (1392:15): [True: 16.7k, False: 150]
  ------------------
 1393|  16.7k|		rc = radix64_read( afx, a, &n, buf, size );
 1394|  47.3k|	}
 1395|  28.3k|	else
 1396|  28.3k|	    rc = radix64_read( afx, a, &n, buf, size );
 1397|       |#if 0
 1398|       |	if( n )
 1399|       |	    if( fwrite(buf, n, 1, fp ) != 1 )
 1400|       |		BUG();
 1401|       |#endif
 1402|   106k|	*ret_len = n;
 1403|   106k|    }
 1404|  13.3k|    else if( control == IOBUFCTRL_FLUSH && !afx->cancel ) {
  ------------------
  |  Branch (1404:14): [True: 0, False: 13.3k]
  |  Branch (1404:44): [True: 0, False: 0]
  ------------------
 1405|      0|	if( !afx->status ) { /* write the header line */
  ------------------
  |  Branch (1405:6): [True: 0, False: 0]
  ------------------
 1406|      0|	    const char *s;
 1407|      0|	    strlist_t comment=opt.comments;
 1408|       |
 1409|      0|	    if( afx->what >= DIM(head_strings) )
  ------------------
  |  |   47|      0|#define DIM(v)		     (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (1409:10): [True: 0, False: 0]
  ------------------
 1410|      0|		log_bug("afx->what=%d", afx->what);
 1411|      0|	    iobuf_writestr(a, "-----");
 1412|      0|	    iobuf_writestr(a, head_strings[afx->what] );
 1413|      0|	    iobuf_writestr(a, "-----" );
 1414|      0|	    iobuf_writestr(a,afx->eol);
 1415|      0|	    if (opt.emit_version)
  ------------------
  |  Branch (1415:10): [True: 0, False: 0]
  ------------------
 1416|      0|	      {
 1417|      0|		iobuf_writestr (a, "Version: "GNUPG_NAME" v");
 1418|      0|                for (s=VERSION; *s && *s != '.'; s++)
  ------------------
  |  |  811|      0|#define VERSION "2.3.9"
  ------------------
  |  Branch (1418:33): [True: 0, False: 0]
  |  Branch (1418:39): [True: 0, False: 0]
  ------------------
 1419|      0|                  iobuf_writebyte (a, *s);
 1420|      0|                if (opt.emit_version > 1 && *s)
  ------------------
  |  Branch (1420:21): [True: 0, False: 0]
  |  Branch (1420:45): [True: 0, False: 0]
  ------------------
 1421|      0|                  {
 1422|      0|                    iobuf_writebyte (a, *s++);
 1423|      0|                    for (; *s && *s != '.'; s++)
  ------------------
  |  Branch (1423:28): [True: 0, False: 0]
  |  Branch (1423:34): [True: 0, False: 0]
  ------------------
 1424|      0|                      iobuf_writebyte (a, *s);
 1425|      0|                    if (opt.emit_version > 2)
  ------------------
  |  Branch (1425:25): [True: 0, False: 0]
  ------------------
 1426|      0|                      {
 1427|      0|                        for (; *s && *s != '-' && !spacep (s); s++)
  ------------------
  |  |  407|      0|#define spacep(p)   (*(p) == ' ' || *(p) == '\t')
  |  |  ------------------
  |  |  |  Branch (407:22): [True: 0, False: 0]
  |  |  |  Branch (407:37): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1427:32): [True: 0, False: 0]
  |  Branch (1427:38): [True: 0, False: 0]
  ------------------
 1428|      0|                          iobuf_writebyte (a, *s);
 1429|      0|                        if (opt.emit_version > 3)
  ------------------
  |  Branch (1429:29): [True: 0, False: 0]
  ------------------
 1430|      0|                          iobuf_writestr (a, " (" PRINTABLE_OS_NAME ")");
 1431|      0|                      }
 1432|      0|                  }
 1433|      0|		iobuf_writestr(a,afx->eol);
 1434|      0|	      }
 1435|       |
 1436|       |	    /* write the comment strings */
 1437|      0|	    for(;comment;comment=comment->next)
  ------------------
  |  Branch (1437:11): [True: 0, False: 0]
  ------------------
 1438|      0|	      {
 1439|      0|		iobuf_writestr(a, "Comment: " );
 1440|      0|		for( s=comment->d; *s; s++ )
  ------------------
  |  Branch (1440:22): [True: 0, False: 0]
  ------------------
 1441|      0|		  {
 1442|      0|		    if( *s == '\n' )
  ------------------
  |  Branch (1442:11): [True: 0, False: 0]
  ------------------
 1443|      0|		      iobuf_writestr(a, "\\n" );
 1444|      0|		    else if( *s == '\r' )
  ------------------
  |  Branch (1444:16): [True: 0, False: 0]
  ------------------
 1445|      0|		      iobuf_writestr(a, "\\r" );
 1446|      0|		    else if( *s == '\v' )
  ------------------
  |  Branch (1446:16): [True: 0, False: 0]
  ------------------
 1447|      0|		      iobuf_writestr(a, "\\v" );
 1448|      0|		    else
 1449|      0|		      iobuf_put(a, *s );
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
 1450|      0|		  }
 1451|       |
 1452|      0|		iobuf_writestr(a,afx->eol);
 1453|      0|	      }
 1454|       |
 1455|      0|	    if ( afx->hdrlines ) {
  ------------------
  |  Branch (1455:11): [True: 0, False: 0]
  ------------------
 1456|      0|                for ( s = afx->hdrlines; *s; s++ ) {
  ------------------
  |  Branch (1456:42): [True: 0, False: 0]
  ------------------
 1457|       |#ifdef HAVE_DOSISH_SYSTEM
 1458|       |                    if ( *s == '\n' )
 1459|       |                        iobuf_put( a, '\r');
 1460|       |#endif
 1461|      0|                    iobuf_put(a, *s );
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
 1462|      0|                }
 1463|      0|            }
 1464|       |
 1465|      0|	    iobuf_writestr(a,afx->eol);
 1466|      0|	    afx->status++;
 1467|      0|	    afx->idx = 0;
 1468|      0|	    afx->idx2 = 0;
 1469|      0|	    gcry_md_reset (afx->crc_md);
 1470|      0|	}
 1471|       |
 1472|      0|	if( size ) {
  ------------------
  |  Branch (1472:6): [True: 0, False: 0]
  ------------------
 1473|      0|	    gcry_md_write (afx->crc_md, buf, size);
 1474|      0|	    armor_output_buf_as_radix64 (afx, a, buf, size);
 1475|      0|        }
 1476|      0|    }
 1477|  13.3k|    else if( control == IOBUFCTRL_INIT )
  ------------------
  |  Branch (1477:14): [True: 6.66k, False: 6.66k]
  ------------------
 1478|  6.66k|      {
 1479|  6.66k|	if( !is_initialized )
  ------------------
  |  Branch (1479:6): [True: 1, False: 6.66k]
  ------------------
 1480|      1|	  initialize();
 1481|       |
 1482|       |	/* Figure out what we're using for line endings if the caller
 1483|       |	   didn't specify. */
 1484|  6.66k|	if(afx->eol[0]==0)
  ------------------
  |  Branch (1484:5): [True: 6.66k, False: 0]
  ------------------
 1485|  6.66k|	  {
 1486|       |#ifdef HAVE_DOSISH_SYSTEM
 1487|       |	    afx->eol[0]='\r';
 1488|       |	    afx->eol[1]='\n';
 1489|       |#else
 1490|  6.66k|	    afx->eol[0]='\n';
 1491|  6.66k|#endif
 1492|  6.66k|	  }
 1493|  6.66k|      }
 1494|  6.66k|    else if( control == IOBUFCTRL_CANCEL ) {
  ------------------
  |  Branch (1494:14): [True: 0, False: 6.66k]
  ------------------
 1495|      0|	afx->cancel = 1;
 1496|      0|    }
 1497|  6.66k|    else if( control == IOBUFCTRL_FREE ) {
  ------------------
  |  Branch (1497:14): [True: 6.66k, False: 0]
  ------------------
 1498|  6.66k|	if( afx->cancel )
  ------------------
  |  Branch (1498:6): [True: 0, False: 6.66k]
  ------------------
 1499|      0|	    ;
 1500|  6.66k|	else if( afx->status ) { /* pad, write cecksum, and bottom line */
  ------------------
  |  Branch (1500:11): [True: 0, False: 6.66k]
  ------------------
 1501|      0|	    gcry_md_final (afx->crc_md);
 1502|      0|	    crc = get_afx_crc (afx);
 1503|      0|	    idx = afx->idx;
 1504|      0|	    idx2 = afx->idx2;
 1505|      0|	    if( idx ) {
  ------------------
  |  Branch (1505:10): [True: 0, False: 0]
  ------------------
 1506|      0|		c = bintoasc[(afx->radbuf[0]>>2)&077];
 1507|      0|		iobuf_put(a, c);
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
 1508|      0|		if( idx == 1 ) {
  ------------------
  |  Branch (1508:7): [True: 0, False: 0]
  ------------------
 1509|      0|		    c = bintoasc[((afx->radbuf[0] << 4) & 060) & 077];
 1510|      0|		    iobuf_put(a, c);
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
 1511|      0|		    iobuf_put(a, '=');
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
 1512|      0|		    iobuf_put(a, '=');
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
 1513|      0|		}
 1514|      0|		else { /* 2 */
 1515|      0|		    c = bintoasc[(((afx->radbuf[0]<<4)&060)
 1516|      0|                                  |((afx->radbuf[1]>>4)&017))&077];
 1517|      0|		    iobuf_put(a, c);
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
 1518|      0|		    c = bintoasc[((afx->radbuf[1] << 2) & 074) & 077];
 1519|      0|		    iobuf_put(a, c);
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
 1520|      0|		    iobuf_put(a, '=');
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
 1521|      0|		}
 1522|      0|		if( ++idx2 >= (64/4) )
  ------------------
  |  Branch (1522:7): [True: 0, False: 0]
  ------------------
 1523|      0|		  { /* pgp doesn't like 72 here */
 1524|      0|		    iobuf_writestr(a,afx->eol);
 1525|      0|		    idx2=0;
 1526|      0|		  }
 1527|      0|	    }
 1528|       |	    /* may need a linefeed */
 1529|      0|	    if( idx2 )
  ------------------
  |  Branch (1529:10): [True: 0, False: 0]
  ------------------
 1530|      0|	      iobuf_writestr(a,afx->eol);
 1531|       |	    /* write the CRC */
 1532|      0|	    iobuf_put(a, '=');
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
 1533|      0|	    radbuf[0] = crc >>16;
 1534|      0|	    radbuf[1] = crc >> 8;
 1535|      0|	    radbuf[2] = crc;
 1536|      0|	    c = bintoasc[(*radbuf >> 2) & 077];
 1537|      0|	    iobuf_put(a, c);
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
 1538|      0|	    c = bintoasc[(((*radbuf<<4)&060)|((radbuf[1] >> 4)&017))&077];
 1539|      0|	    iobuf_put(a, c);
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
 1540|      0|	    c = bintoasc[(((radbuf[1]<<2)&074)|((radbuf[2]>>6)&03))&077];
 1541|      0|	    iobuf_put(a, c);
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
 1542|      0|	    c = bintoasc[radbuf[2]&077];
 1543|      0|	    iobuf_put(a, c);
  ------------------
  |  |  548|      0|#define iobuf_put(a,c)	iobuf_writebyte(a,c)
  ------------------
 1544|      0|	    iobuf_writestr(a,afx->eol);
 1545|       |	    /* and the trailer */
 1546|      0|	    if( afx->what >= DIM(tail_strings) )
  ------------------
  |  |   47|      0|#define DIM(v)		     (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (1546:10): [True: 0, False: 0]
  ------------------
 1547|      0|		log_bug("afx->what=%d", afx->what);
 1548|      0|	    iobuf_writestr(a, "-----");
 1549|      0|	    iobuf_writestr(a, tail_strings[afx->what] );
 1550|      0|	    iobuf_writestr(a, "-----" );
 1551|      0|	    iobuf_writestr(a,afx->eol);
 1552|      0|	}
 1553|  6.66k|	else if( !afx->any_data && !afx->inp_bypass ) {
  ------------------
  |  Branch (1553:11): [True: 3.25k, False: 3.41k]
  |  Branch (1553:29): [True: 3.22k, False: 28]
  ------------------
 1554|  3.22k|	    log_error(_("no valid OpenPGP data found.\n"));
  ------------------
  |  |   28|  3.22k|#  define _(a) gettext (a)
  ------------------
 1555|  3.22k|	    afx->no_openpgp_data = 1;
 1556|  3.22k|	    write_status_text( STATUS_NODATA, "1" );
 1557|  3.22k|	}
 1558|       |        /* Note that in a cleartext signature truncated lines in the
 1559|       |         * plaintext are detected and propagated to the signature
 1560|       |         * checking code by inserting a \f into the plaintext.  We do
 1561|       |         * not use log_info here because some of the truncated lines
 1562|       |         * are harmless.  */
 1563|  6.66k|	if( afx->truncated )
  ------------------
  |  Branch (1563:6): [True: 67, False: 6.60k]
  ------------------
 1564|     67|	    log_info(_("invalid armor: line longer than %d characters\n"),
  ------------------
  |  |   28|     67|#  define _(a) gettext (a)
  ------------------
 1565|     67|		      MAX_LINELEN );
  ------------------
  |  |   38|     67|#define MAX_LINELEN 20000
  ------------------
 1566|       |	/* issue an error to enforce dissemination of correct software */
 1567|  6.66k|	if( afx->qp_detected )
  ------------------
  |  Branch (1567:6): [True: 79, False: 6.58k]
  ------------------
 1568|     79|	    log_error(_("quoted printable character in armor - "
  ------------------
  |  |   28|     79|#  define _(a) gettext (a)
  ------------------
 1569|     79|			"probably a buggy MTA has been used\n") );
 1570|  6.66k|	xfree( afx->buffer );
  ------------------
  |  |  104|  6.66k|#define xfree(a)         gcry_free ((a))
  ------------------
 1571|  6.66k|	afx->buffer = NULL;
 1572|  6.66k|        release_armor_context (afx);
 1573|  6.66k|    }
 1574|      0|    else if( control == IOBUFCTRL_DESC )
  ------------------
  |  Branch (1574:14): [True: 0, False: 0]
  ------------------
 1575|      0|        mem2str (buf, "armor_filter", *ret_len);
 1576|   122k|    return rc;
 1577|   122k|}
armor.c:fake_packet:
  647|  30.6k|{
  648|  30.6k|    int rc = 0;
  649|  30.6k|    size_t len = 0;
  650|  30.6k|    int lastline = 0;
  651|  30.6k|    unsigned maxlen, n;
  652|  30.6k|    byte *p;
  653|  30.6k|    byte tempbuf[PARTIAL_CHUNK];
  654|  30.6k|    size_t tempbuf_len=0;
  655|  30.6k|    int this_truncated;
  656|       |
  657|  4.71M|    while( !rc && size-len>=(PARTIAL_CHUNK+1)) {
  ------------------
  |  |  636|  4.68M|#define PARTIAL_CHUNK 512
  ------------------
  |  Branch (657:12): [True: 4.68M, False: 29.5k]
  |  Branch (657:19): [True: 4.68M, False: 1.08k]
  ------------------
  658|       |	/* copy what we have in the line buffer */
  659|  4.68M|	if( afx->faked == 1 )
  ------------------
  |  Branch (659:6): [True: 29.5k, False: 4.65M]
  ------------------
  660|  29.5k|	    afx->faked++; /* skip the first (empty) line */
  661|  4.65M|	else
  662|  4.65M|	  {
  663|       |	    /* It's full, so write this partial chunk */
  664|  4.65M|	    if(tempbuf_len==PARTIAL_CHUNK)
  ------------------
  |  |  636|  4.65M|#define PARTIAL_CHUNK 512
  ------------------
  |  Branch (664:9): [True: 26.7k, False: 4.62M]
  ------------------
  665|  26.7k|	      {
  666|  26.7k|		buf[len++]=0xE0+PARTIAL_POW;
  ------------------
  |  |  637|  26.7k|#define PARTIAL_POW   9
  ------------------
  667|  26.7k|		memcpy(&buf[len],tempbuf,PARTIAL_CHUNK);
  ------------------
  |  |  636|  26.7k|#define PARTIAL_CHUNK 512
  ------------------
  668|  26.7k|		len+=PARTIAL_CHUNK;
  ------------------
  |  |  636|  26.7k|#define PARTIAL_CHUNK 512
  ------------------
  669|  26.7k|		tempbuf_len=0;
  670|  26.7k|		continue;
  671|  26.7k|	      }
  672|       |
  673|  20.0M|	    while( tempbuf_len < PARTIAL_CHUNK
  ------------------
  |  |  636|  40.0M|#define PARTIAL_CHUNK 512
  ------------------
  |  Branch (673:13): [True: 19.9M, False: 26.7k]
  ------------------
  674|  20.0M|		   && afx->buffer_pos < afx->buffer_len )
  ------------------
  |  Branch (674:9): [True: 15.3M, False: 4.59M]
  ------------------
  675|  15.3M|	      tempbuf[tempbuf_len++] = afx->buffer[afx->buffer_pos++];
  676|  4.62M|	    if( tempbuf_len==PARTIAL_CHUNK )
  ------------------
  |  |  636|  4.62M|#define PARTIAL_CHUNK 512
  ------------------
  |  Branch (676:10): [True: 26.7k, False: 4.59M]
  ------------------
  677|  26.7k|	      continue;
  678|  4.62M|	  }
  679|       |
  680|       |	/* read the next line */
  681|  4.62M|	maxlen = MAX_LINELEN;
  ------------------
  |  |   38|  4.62M|#define MAX_LINELEN 20000
  ------------------
  682|  4.62M|	afx->buffer_pos = 0;
  683|  4.62M|	afx->buffer_len = iobuf_read_line( a, &afx->buffer,
  684|  4.62M|					   &afx->buffer_size, &maxlen );
  685|  4.62M|	if( !afx->buffer_len ) {
  ------------------
  |  Branch (685:6): [True: 1.51k, False: 4.62M]
  ------------------
  686|  1.51k|	    rc = -1; /* eof (should not happen) */
  687|  1.51k|	    continue;
  688|  1.51k|	}
  689|  4.62M|	if( !maxlen )
  ------------------
  |  Branch (689:6): [True: 135, False: 4.62M]
  ------------------
  690|    135|          {
  691|    135|	    afx->truncated++;
  692|    135|            this_truncated = 1;
  693|    135|          }
  694|  4.62M|        else
  695|  4.62M|          this_truncated = 0;
  696|       |
  697|       |
  698|  4.62M|	p = afx->buffer;
  699|  4.62M|	n = afx->buffer_len;
  700|       |
  701|       |	/* Armor header or dash-escaped line? */
  702|  4.62M|	if(p[0]=='-')
  ------------------
  |  Branch (702:5): [True: 39.9k, False: 4.58M]
  ------------------
  703|  39.9k|	  {
  704|       |	    /* 2440bis-10: When reversing dash-escaping, an
  705|       |	       implementation MUST strip the string "- " if it occurs
  706|       |	       at the beginning of a line, and SHOULD warn on "-" and
  707|       |	       any character other than a space at the beginning of a
  708|       |	       line.  */
  709|       |
  710|  39.9k|	    if(p[1]==' ' && !afx->not_dash_escaped)
  ------------------
  |  Branch (710:9): [True: 496, False: 39.4k]
  |  Branch (710:22): [True: 220, False: 276]
  ------------------
  711|    220|	      {
  712|       |		/* It's a dash-escaped line, so skip over the
  713|       |		   escape. */
  714|    220|		afx->buffer_pos = 2;
  715|    220|	      }
  716|  39.7k|	    else if(p[1]=='-' && p[2]=='-' && p[3]=='-' && p[4]=='-')
  ------------------
  |  Branch (716:14): [True: 34.7k, False: 4.96k]
  |  Branch (716:27): [True: 32.7k, False: 2.03k]
  |  Branch (716:40): [True: 31.8k, False: 866]
  |  Branch (716:53): [True: 29.5k, False: 2.26k]
  ------------------
  717|  29.5k|	      {
  718|       |		/* Five dashes in a row mean it's probably armor
  719|       |		   header. */
  720|  29.5k|		int type = is_armor_header( p, n );
  721|  29.5k|                if (type == 42)
  ------------------
  |  Branch (721:21): [True: 1.20k, False: 28.3k]
  ------------------
  722|  1.20k|                  type = -1;  /* Only OpenPGP armors are expected.  */
  723|  29.5k|		if( afx->not_dash_escaped && type != BEGIN_SIGNATURE )
  ------------------
  |  |   82|  1.86k|#define BEGIN_SIGNATURE 2
  ------------------
  |  Branch (723:7): [True: 1.86k, False: 27.7k]
  |  Branch (723:32): [True: 1.57k, False: 289]
  ------------------
  724|  1.57k|		  ; /* this is okay */
  725|  28.0k|		else
  726|  28.0k|		  {
  727|  28.0k|		    if( type != BEGIN_SIGNATURE )
  ------------------
  |  |   82|  28.0k|#define BEGIN_SIGNATURE 2
  ------------------
  |  Branch (727:11): [True: 27.4k, False: 564]
  ------------------
  728|  27.4k|		      {
  729|  27.4k|			log_info(_("unexpected armor: "));
  ------------------
  |  |   28|  27.4k|#  define _(a) gettext (a)
  ------------------
  730|  27.4k|			es_write_sanitized (log_get_stream (), p, n,
  731|  27.4k|                                            NULL, NULL);
  732|  27.4k|			log_printf ("\n");
  733|  27.4k|		      }
  734|       |
  735|  28.0k|		    lastline = 1;
  736|  28.0k|		    rc = -1;
  737|  28.0k|		  }
  738|  29.5k|	      }
  739|  10.1k|	    else if(!afx->not_dash_escaped)
  ------------------
  |  Branch (739:14): [True: 9.00k, False: 1.12k]
  ------------------
  740|  9.00k|	      {
  741|       |		/* Bad dash-escaping. */
  742|  9.00k|		log_info (_("invalid dash escaped line: "));
  ------------------
  |  |   28|  9.00k|#  define _(a) gettext (a)
  ------------------
  743|  9.00k|		es_write_sanitized (log_get_stream (), p, n, NULL, NULL);
  744|  9.00k|		log_printf ("\n");
  745|  9.00k|	      }
  746|  39.9k|	  }
  747|       |
  748|       |	/* Now handle the end-of-line canonicalization */
  749|  4.62M|	if( !afx->not_dash_escaped || this_truncated)
  ------------------
  |  Branch (749:6): [True: 4.44M, False: 185k]
  |  Branch (749:32): [True: 70, False: 185k]
  ------------------
  750|  4.44M|	  {
  751|  4.44M|	    int crlf = n > 1 && p[n-2] == '\r' && p[n-1]=='\n';
  ------------------
  |  Branch (751:17): [True: 184k, False: 4.25M]
  |  Branch (751:26): [True: 5.06k, False: 179k]
  |  Branch (751:44): [True: 5.03k, False: 31]
  ------------------
  752|       |
  753|  4.44M|	    afx->buffer_len=
  754|  4.44M|	      trim_trailing_chars( &p[afx->buffer_pos], n-afx->buffer_pos,
  755|  4.44M|				   " \t\r\n");
  756|  4.44M|	    afx->buffer_len+=afx->buffer_pos;
  757|       |	    /* the buffer is always allocated with enough space to append
  758|       |	     * the removed [CR], LF and a Nul
  759|       |	     * The reason for this complicated procedure is to keep at least
  760|       |	     * the original type of lineending - handling of the removed
  761|       |	     * trailing spaces seems to be impossible in our method
  762|       |	     * of faking a packet; either we have to use a temporary file
  763|       |	     * or calculate the hash here in this module and somehow find
  764|       |	     * a way to send the hash down the processing line (well, a special
  765|       |	     * faked packet could do the job).
  766|       |             *
  767|       |             * To make sure that a truncated line triggers a bad
  768|       |             * signature error we replace a removed LF by a FF or
  769|       |             * append a FF.  Right, this is a hack but better than a
  770|       |             * global variable and way easier than to introduce a new
  771|       |             * control packet or insert a line like "[truncated]\n"
  772|       |             * into the filter output.
  773|       |	     */
  774|  4.44M|	    if( crlf )
  ------------------
  |  Branch (774:10): [True: 5.03k, False: 4.43M]
  ------------------
  775|  5.03k|	      afx->buffer[afx->buffer_len++] = '\r';
  776|  4.44M|	    afx->buffer[afx->buffer_len++] = this_truncated? '\f':'\n';
  ------------------
  |  Branch (776:39): [True: 135, False: 4.44M]
  ------------------
  777|  4.44M|	    afx->buffer[afx->buffer_len] = '\0';
  778|  4.44M|	  }
  779|  4.62M|    }
  780|       |
  781|  30.6k|    if( lastline ) { /* write last (ending) length header */
  ------------------
  |  Branch (781:9): [True: 28.0k, False: 2.60k]
  ------------------
  782|  28.0k|        if(tempbuf_len<192)
  ------------------
  |  Branch (782:12): [True: 24.5k, False: 3.48k]
  ------------------
  783|  24.5k|	  buf[len++]=tempbuf_len;
  784|  3.48k|	else
  785|  3.48k|	  {
  786|  3.48k|	    buf[len++]=((tempbuf_len-192)/256) + 192;
  787|  3.48k|	    buf[len++]=(tempbuf_len-192) % 256;
  788|  3.48k|	  }
  789|  28.0k|	memcpy(&buf[len],tempbuf,tempbuf_len);
  790|  28.0k|	len+=tempbuf_len;
  791|       |
  792|  28.0k|	rc = 0;
  793|  28.0k|	afx->faked = 0;
  794|  28.0k|	afx->in_cleartext = 0;
  795|       |	/* and now read the header lines */
  796|  28.0k|	afx->buffer_pos = 0;
  797|  29.6k|	for(;;) {
  798|  29.6k|	    int i;
  799|       |
  800|       |	    /* read the next line (skip all truncated lines) */
  801|  29.7k|	    do {
  802|  29.7k|		maxlen = MAX_LINELEN;
  ------------------
  |  |   38|  29.7k|#define MAX_LINELEN 20000
  ------------------
  803|  29.7k|		afx->buffer_len = iobuf_read_line( a, &afx->buffer,
  804|  29.7k|						 &afx->buffer_size, &maxlen );
  805|  29.7k|	    } while( !maxlen );
  ------------------
  |  Branch (805:15): [True: 72, False: 29.6k]
  ------------------
  806|  29.6k|	    p = afx->buffer;
  807|  29.6k|	    n = afx->buffer_len;
  808|  29.6k|	    if( !n ) {
  ------------------
  |  Branch (808:10): [True: 497, False: 29.1k]
  ------------------
  809|    497|		rc = -1;
  810|    497|		break; /* eof */
  811|    497|	    }
  812|  29.1k|	    i = parse_header_line( afx, p , n );
  813|  29.1k|	    if( i <= 0 ) {
  ------------------
  |  Branch (813:10): [True: 27.5k, False: 1.67k]
  ------------------
  814|  27.5k|		if( i )
  ------------------
  |  Branch (814:7): [True: 20.8k, False: 6.70k]
  ------------------
  815|  20.8k|		    invalid_armor();
  816|  27.5k|		break;
  817|  27.5k|	    }
  818|  29.1k|	}
  819|  28.0k|	afx->inp_checked = 1;
  820|  28.0k|	gcry_md_reset (afx->crc_md);
  821|  28.0k|	afx->idx = 0;
  822|  28.0k|	afx->radbuf[0] = 0;
  823|  28.0k|    }
  824|       |
  825|  30.6k|    *retn = len;
  826|  30.6k|    return rc;
  827|  30.6k|}
armor.c:is_armor_header:
  393|  3.21M|{
  394|  3.21M|    const char *s;
  395|  3.21M|    byte *save_p, *p;
  396|  3.21M|    int save_c;
  397|  3.21M|    int i;
  398|       |
  399|  3.21M|    if( len < 15 )
  ------------------
  |  Branch (399:9): [True: 3.06M, False: 151k]
  ------------------
  400|  3.06M|	return -1; /* too short */
  401|   151k|    if( memcmp( line, "-----", 5 ) )
  ------------------
  |  Branch (401:9): [True: 84.8k, False: 66.8k]
  ------------------
  402|  84.8k|	return -1; /* no */
  403|  66.8k|    p = strstr( line+5, "-----");
  404|  66.8k|    if( !p )
  ------------------
  |  Branch (404:9): [True: 11.8k, False: 54.9k]
  ------------------
  405|  11.8k|	return -1;
  406|  54.9k|    save_p = p;
  407|  54.9k|    p += 5;
  408|       |
  409|       |    /* Some Windows environments seem to add whitespace to the end of
  410|       |       the line, so we strip it here.  This becomes strict if
  411|       |       --rfc2440 is set since 2440 reads "The header lines, therefore,
  412|       |       MUST start at the beginning of a line, and MUST NOT have text
  413|       |       following them on the same line."  It is unclear whether "text"
  414|       |       refers to all text or just non-whitespace text.  4880 clarified
  415|       |       this was only non-whitespace text. */
  416|       |
  417|  54.9k|    if(RFC2440)
  ------------------
  |  |  373|  54.9k|#define RFC2440 (opt.compliance==CO_RFC2440)
  |  |  ------------------
  |  |  |  Branch (373:17): [True: 0, False: 54.9k]
  |  |  ------------------
  ------------------
  418|      0|      {
  419|      0|	if( *p == '\r' )
  ------------------
  |  Branch (419:6): [True: 0, False: 0]
  ------------------
  420|      0|	  p++;
  421|      0|	if( *p == '\n' )
  ------------------
  |  Branch (421:6): [True: 0, False: 0]
  ------------------
  422|      0|	  p++;
  423|      0|      }
  424|  54.9k|    else
  425|   109k|      while(*p==' ' || *p=='\r' || *p=='\n' || *p=='\t')
  ------------------
  |  Branch (425:13): [True: 292, False: 109k]
  |  Branch (425:24): [True: 271, False: 108k]
  |  Branch (425:36): [True: 53.0k, False: 55.9k]
  |  Branch (425:48): [True: 1.02k, False: 54.9k]
  ------------------
  426|  54.5k|	p++;
  427|       |
  428|  54.9k|    if( *p )
  ------------------
  |  Branch (428:9): [True: 1.36k, False: 53.5k]
  ------------------
  429|  1.36k|	return -1; /* garbage after dashes */
  430|  53.5k|    save_c = *save_p; *save_p = 0;
  431|  53.5k|    p = line+5;
  432|   207k|    for(i=0; (s=head_strings[i]); i++ )
  ------------------
  |  Branch (432:14): [True: 200k, False: 7.16k]
  ------------------
  433|   200k|	if( !strcmp(s, p) )
  ------------------
  |  Branch (433:6): [True: 46.4k, False: 153k]
  ------------------
  434|  46.4k|	    break;
  435|  53.5k|    *save_p = save_c;
  436|  53.5k|    if (!s)
  ------------------
  |  Branch (436:9): [True: 7.16k, False: 46.4k]
  ------------------
  437|  7.16k|      {
  438|  7.16k|        if (!strncmp (p, "BEGIN ", 6))
  ------------------
  |  Branch (438:13): [True: 4.24k, False: 2.91k]
  ------------------
  439|  4.24k|          return 42;
  440|  2.91k|	return -1; /* unknown armor line */
  441|  7.16k|      }
  442|       |
  443|  46.4k|    if( opt.verbose > 1 )
  ------------------
  |  Branch (443:9): [True: 0, False: 46.4k]
  ------------------
  444|      0|	log_info(_("armor: %s\n"), head_strings[i]);
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  445|  46.4k|    return i;
  446|  53.5k|}
armor.c:parse_header_line:
  458|  79.7k|{
  459|  79.7k|    byte *p;
  460|  79.7k|    int hashes=0;
  461|  79.7k|    unsigned int len2;
  462|       |
  463|  79.7k|    len2 = length_sans_trailing_ws ( line, len );
  464|  79.7k|    if( !len2 ) {
  ------------------
  |  Branch (464:9): [True: 26.7k, False: 53.0k]
  ------------------
  465|  26.7k|        afx->buffer_pos = len2;  /* (it is not the fine way to do it here) */
  466|  26.7k|	return 0; /* WS only: same as empty line */
  467|  26.7k|    }
  468|       |
  469|       |    /*
  470|       |      This is fussy.  The spec says that a header line is delimited
  471|       |      with a colon-space pair.  This means that a line such as
  472|       |      "Comment: " (with nothing else) is actually legal as an empty
  473|       |      string comment.  However, email and cut-and-paste being what it
  474|       |      is, that trailing space may go away.  Therefore, we accept empty
  475|       |      headers delimited with only a colon.  --rfc2440, as always,
  476|       |      makes this strict and enforces the colon-space pair. -dms
  477|       |    */
  478|       |
  479|  53.0k|    p = strchr( line, ':');
  480|  53.0k|    if (!p && afx->dearmor_state)
  ------------------
  |  Branch (480:9): [True: 39.8k, False: 13.1k]
  |  Branch (480:15): [True: 0, False: 39.8k]
  ------------------
  481|      0|      return 0; /* Special treatment in --dearmor mode.  */
  482|  53.0k|    if( !p || (RFC2440 && p[1]!=' ')
  ------------------
  |  |  373|  26.3k|#define RFC2440 (opt.compliance==CO_RFC2440)
  |  |  ------------------
  |  |  |  Branch (373:17): [True: 0, False: 13.1k]
  |  |  ------------------
  ------------------
  |  Branch (482:9): [True: 39.8k, False: 13.1k]
  |  Branch (482:27): [True: 0, False: 0]
  ------------------
  483|  53.0k|	|| (!RFC2440 && p[1]!=' ' && p[1]!='\n' && p[1]!='\r'))
  ------------------
  |  |  373|  26.3k|#define RFC2440 (opt.compliance==CO_RFC2440)
  ------------------
  |  Branch (483:6): [True: 13.1k, False: 0]
  |  Branch (483:18): [True: 3.09k, False: 10.0k]
  |  Branch (483:31): [True: 1.02k, False: 2.07k]
  |  Branch (483:45): [True: 642, False: 384]
  ------------------
  484|  40.4k|      {
  485|  40.4k|	log_error (_("invalid armor header: "));
  ------------------
  |  |   28|  40.4k|#  define _(a) gettext (a)
  ------------------
  486|  40.4k|	es_write_sanitized (log_get_stream (), line, len, NULL, NULL);
  487|  40.4k|	log_printf ("\n");
  488|  40.4k|	return -1;
  489|  40.4k|      }
  490|       |
  491|       |    /* Chop off the whitespace we detected before */
  492|  12.5k|    len=len2;
  493|  12.5k|    line[len2]='\0';
  494|       |
  495|  12.5k|    if( opt.verbose ) {
  ------------------
  |  Branch (495:9): [True: 0, False: 12.5k]
  ------------------
  496|      0|	log_info(_("armor header: "));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  497|      0|	es_write_sanitized (log_get_stream (), line, len, NULL, NULL);
  498|      0|	log_printf ("\n");
  499|      0|    }
  500|       |
  501|  12.5k|    if (afx->dearmor_mode)
  ------------------
  |  Branch (501:9): [True: 0, False: 12.5k]
  ------------------
  502|      0|      ;
  503|  12.5k|    else if (afx->in_cleartext)
  ------------------
  |  Branch (503:14): [True: 8.21k, False: 4.30k]
  ------------------
  504|  8.21k|      {
  505|  8.21k|	if( (hashes=parse_hash_header( line )) )
  ------------------
  |  Branch (505:6): [True: 2.20k, False: 6.01k]
  ------------------
  506|  2.20k|	  afx->hashes |= hashes;
  507|  6.01k|	else if( strlen(line) > 15 && !memcmp( line, "NotDashEscaped:", 15 ) )
  ------------------
  |  Branch (507:11): [True: 1.66k, False: 4.34k]
  |  Branch (507:32): [True: 615, False: 1.04k]
  ------------------
  508|    615|	  afx->not_dash_escaped = 1;
  509|  5.39k|	else
  510|  5.39k|	  {
  511|  5.39k|	    log_error(_("invalid clearsig header\n"));
  ------------------
  |  |   28|  5.39k|#  define _(a) gettext (a)
  ------------------
  512|  5.39k|	    return -1;
  513|  5.39k|	  }
  514|  8.21k|      }
  515|  4.30k|    else if(!is_armor_tag(line))
  ------------------
  |  Branch (515:13): [True: 2.45k, False: 1.85k]
  ------------------
  516|  2.45k|      {
  517|       |	/* Section 6.2: "Unknown keys should be reported to the user,
  518|       |	   but OpenPGP should continue to process the message."  Note
  519|       |	   that in a clearsigned message this applies to the signature
  520|       |	   part (i.e. "BEGIN PGP SIGNATURE") and not the signed data
  521|       |	   ("BEGIN PGP SIGNED MESSAGE").  The only key allowed in the
  522|       |	   signed data section is "Hash". */
  523|       |
  524|  2.45k|	log_info(_("unknown armor header: "));
  ------------------
  |  |   28|  2.45k|#  define _(a) gettext (a)
  ------------------
  525|  2.45k|	es_write_sanitized (log_get_stream (), line, len, NULL, NULL);
  526|  2.45k|	log_printf ("\n");
  527|  2.45k|      }
  528|       |
  529|  7.12k|    return 1;
  530|  12.5k|}
armor.c:parse_hash_header:
  332|  8.21k|{
  333|  8.21k|    const char *s, *s2;
  334|  8.21k|    unsigned found = 0;
  335|       |
  336|  8.21k|    if( strlen(line) < 6  || strlen(line) > 60 )
  ------------------
  |  Branch (336:9): [True: 671, False: 7.54k]
  |  Branch (336:30): [True: 232, False: 7.31k]
  ------------------
  337|    903|	return 0; /* too short or too long */
  338|  7.31k|    if( memcmp( line, "Hash:", 5 ) )
  ------------------
  |  Branch (338:9): [True: 1.27k, False: 6.03k]
  ------------------
  339|  1.27k|	return 0; /* invalid header */
  340|       |
  341|  8.97k|    for(s=line+5;;s=s2) {
  342|  15.1k|	for(; *s && (*s==' ' || *s == '\t'); s++ )
  ------------------
  |  Branch (342:8): [True: 12.9k, False: 2.20k]
  |  Branch (342:15): [True: 6.10k, False: 6.85k]
  |  Branch (342:26): [True: 92, False: 6.76k]
  ------------------
  343|  6.19k|	    ;
  344|  8.97k|	if( !*s )
  ------------------
  |  Branch (344:6): [True: 2.20k, False: 6.76k]
  ------------------
  345|  2.20k|	    break;
  346|  18.1k|	for(s2=s+1; *s2 && *s2!=' ' && *s2 != '\t' && *s2 != ','; s2++ )
  ------------------
  |  Branch (346:14): [True: 15.5k, False: 2.61k]
  |  Branch (346:21): [True: 14.3k, False: 1.24k]
  |  Branch (346:33): [True: 11.7k, False: 2.56k]
  |  Branch (346:48): [True: 11.4k, False: 348]
  ------------------
  347|  11.4k|	    ;
  348|  6.76k|	if( !strncmp( s, "RIPEMD160", s2-s ) )
  ------------------
  |  Branch (348:6): [True: 574, False: 6.19k]
  ------------------
  349|    574|	    found |= 1;
  350|  6.19k|	else if( !strncmp( s, "SHA1", s2-s ) )
  ------------------
  |  Branch (350:11): [True: 4.06k, False: 2.13k]
  ------------------
  351|  4.06k|	    found |= 2;
  352|  2.13k|	else if( !strncmp( s, "SHA224", s2-s ) )
  ------------------
  |  Branch (352:11): [True: 316, False: 1.81k]
  ------------------
  353|    316|	    found |= 8;
  354|  1.81k|	else if( !strncmp( s, "SHA256", s2-s ) )
  ------------------
  |  Branch (354:11): [True: 274, False: 1.54k]
  ------------------
  355|    274|	    found |= 16;
  356|  1.54k|	else if( !strncmp( s, "SHA384", s2-s ) )
  ------------------
  |  Branch (356:11): [True: 274, False: 1.26k]
  ------------------
  357|    274|	    found |= 32;
  358|  1.26k|	else if( !strncmp( s, "SHA512", s2-s ) )
  ------------------
  |  Branch (358:11): [True: 329, False: 940]
  ------------------
  359|    329|	    found |= 64;
  360|    940|	else
  361|    940|	    return 0;
  362|  10.0k|	for(; *s2 && (*s2==' ' || *s2 == '\t'); s2++ )
  ------------------
  |  Branch (362:8): [True: 7.94k, False: 2.11k]
  |  Branch (362:16): [True: 1.64k, False: 6.29k]
  |  Branch (362:28): [True: 2.58k, False: 3.71k]
  ------------------
  363|  4.23k|	    ;
  364|  5.82k|	if( *s2 && *s2 != ',' )
  ------------------
  |  Branch (364:6): [True: 3.71k, False: 2.11k]
  |  Branch (364:13): [True: 2.88k, False: 826]
  ------------------
  365|  2.88k|	    return 0;
  366|  2.93k|	if( *s2 )
  ------------------
  |  Branch (366:6): [True: 826, False: 2.11k]
  ------------------
  367|    826|	    s2++;
  368|  2.93k|    }
  369|  2.20k|    return found;
  370|  6.03k|}
armor.c:is_armor_tag:
  375|  4.30k|{
  376|  4.30k|  if(strncmp(line,"Version",7)==0
  ------------------
  |  Branch (376:6): [True: 598, False: 3.70k]
  ------------------
  377|  4.30k|     || strncmp(line,"Comment",7)==0
  ------------------
  |  Branch (377:9): [True: 221, False: 3.48k]
  ------------------
  378|  4.30k|     || strncmp(line,"MessageID",9)==0
  ------------------
  |  Branch (378:9): [True: 224, False: 3.25k]
  ------------------
  379|  4.30k|     || strncmp(line,"Hash",4)==0
  ------------------
  |  Branch (379:9): [True: 588, False: 2.67k]
  ------------------
  380|  4.30k|     || strncmp(line,"Charset",7)==0)
  ------------------
  |  Branch (380:9): [True: 219, False: 2.45k]
  ------------------
  381|  1.85k|    return 1;
  382|       |
  383|  2.45k|  return 0;
  384|  4.30k|}
armor.c:invalid_armor:
  315|  20.8k|{
  316|  20.8k|    write_status(STATUS_BADARMOR);
  317|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  318|       |    g10_exit(1); /* stop here */
  319|       |#endif
  320|  20.8k|}
armor.c:check_input:
  537|  47.3k|{
  538|  47.3k|    int rc = 0;
  539|  47.3k|    int i;
  540|  47.3k|    byte *line;
  541|  47.3k|    unsigned len;
  542|  47.3k|    unsigned maxlen;
  543|  47.3k|    int hdr_line = -1;
  544|       |
  545|       |    /* read the first line to see whether this is armored data */
  546|  47.3k|    maxlen = MAX_LINELEN;
  ------------------
  |  |   38|  47.3k|#define MAX_LINELEN 20000
  ------------------
  547|  47.3k|    len = afx->buffer_len = iobuf_read_line( a, &afx->buffer,
  548|  47.3k|					     &afx->buffer_size, &maxlen );
  549|  47.3k|    line = afx->buffer;
  550|  47.3k|    if( !maxlen ) {
  ------------------
  |  Branch (550:9): [True: 88, False: 47.2k]
  ------------------
  551|       |	/* line has been truncated: assume not armored */
  552|     88|	afx->inp_checked = 1;
  553|     88|	afx->inp_bypass = 1;
  554|     88|	return 0;
  555|     88|    }
  556|       |
  557|  47.2k|    if( !len ) {
  ------------------
  |  Branch (557:9): [True: 150, False: 47.1k]
  ------------------
  558|    150|	return -1; /* eof */
  559|    150|    }
  560|       |
  561|       |    /* (the line is always a C string but maybe longer) */
  562|  47.1k|    if( *line == '\n' || ( len && (*line == '\r' && line[1]=='\n') ) )
  ------------------
  |  Branch (562:9): [True: 1.34k, False: 45.7k]
  |  Branch (562:28): [True: 45.7k, False: 0]
  |  Branch (562:36): [True: 3.64k, False: 42.1k]
  |  Branch (562:53): [True: 2.39k, False: 1.25k]
  ------------------
  563|  3.74k|	;
  564|  43.3k|    else if (len >= 2 && !is_armored (line)) {
  ------------------
  |  Branch (564:14): [True: 43.3k, False: 49]
  |  Branch (564:26): [True: 794, False: 42.5k]
  ------------------
  565|    794|	afx->inp_checked = 1;
  566|    794|	afx->inp_bypass = 1;
  567|    794|	return 0;
  568|    794|    }
  569|       |
  570|       |    /* find the armor header */
  571|  3.18M|    while(len) {
  ------------------
  |  Branch (571:11): [True: 3.18M, False: 1.17k]
  ------------------
  572|  3.18M|	i = is_armor_header( line, len );
  573|  3.18M|        if ( i == 42 ) {
  ------------------
  |  Branch (573:14): [True: 3.04k, False: 3.18M]
  ------------------
  574|  3.04k|            if (afx->dearmor_mode) {
  ------------------
  |  Branch (574:17): [True: 0, False: 3.04k]
  ------------------
  575|      0|                afx->dearmor_state = 1;
  576|      0|                break;
  577|      0|            }
  578|  3.04k|        }
  579|  3.18M|        else if (i >= 0
  ------------------
  |  Branch (579:18): [True: 45.1k, False: 3.14M]
  ------------------
  580|  3.18M|                 && !(afx->only_keyblocks && i != 1 && i != 5 && i != 6 )) {
  ------------------
  |  Branch (580:23): [True: 0, False: 45.1k]
  |  Branch (580:46): [True: 0, False: 0]
  |  Branch (580:56): [True: 0, False: 0]
  |  Branch (580:66): [True: 0, False: 0]
  ------------------
  581|  45.1k|	    hdr_line = i;
  582|  45.1k|	    if( hdr_line == BEGIN_SIGNED_MSG_IDX ) {
  ------------------
  |  |   83|  45.1k|#define BEGIN_SIGNED_MSG_IDX 3
  ------------------
  |  Branch (582:10): [True: 29.5k, False: 15.5k]
  ------------------
  583|  29.5k|	        if( afx->in_cleartext ) {
  ------------------
  |  Branch (583:14): [True: 0, False: 29.5k]
  ------------------
  584|      0|		    log_error(_("nested clear text signatures\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  585|      0|		    rc = gpg_error (GPG_ERR_INV_ARMOR);
  586|      0|                }
  587|  29.5k|		afx->in_cleartext = 1;
  588|  29.5k|	    }
  589|  45.1k|	    break;
  590|  45.1k|	}
  591|       |
  592|       |	/* read the next line (skip all truncated lines) */
  593|  3.14M|	do {
  594|  3.14M|	    maxlen = MAX_LINELEN;
  ------------------
  |  |   38|  3.14M|#define MAX_LINELEN 20000
  ------------------
  595|  3.14M|	    afx->buffer_len = iobuf_read_line( a, &afx->buffer,
  596|  3.14M|					       &afx->buffer_size, &maxlen );
  597|  3.14M|	    line = afx->buffer;
  598|  3.14M|	    len = afx->buffer_len;
  599|  3.14M|	} while( !maxlen );
  ------------------
  |  Branch (599:11): [True: 189, False: 3.14M]
  ------------------
  600|  3.14M|    }
  601|       |
  602|       |    /* Parse the header lines.  */
  603|  51.7k|    while(len) {
  ------------------
  |  Branch (603:11): [True: 50.5k, False: 1.17k]
  ------------------
  604|       |	/* Read the next line (skip all truncated lines). */
  605|  50.6k|	do {
  606|  50.6k|	    maxlen = MAX_LINELEN;
  ------------------
  |  |   38|  50.6k|#define MAX_LINELEN 20000
  ------------------
  607|  50.6k|	    afx->buffer_len = iobuf_read_line( a, &afx->buffer,
  608|  50.6k|					       &afx->buffer_size, &maxlen );
  609|  50.6k|	    line = afx->buffer;
  610|  50.6k|	    len = afx->buffer_len;
  611|  50.6k|	} while( !maxlen );
  ------------------
  |  Branch (611:11): [True: 72, False: 50.5k]
  ------------------
  612|       |
  613|  50.5k|	i = parse_header_line( afx, line, len );
  614|  50.5k|	if( i <= 0 ) {
  ------------------
  |  Branch (614:6): [True: 45.1k, False: 5.44k]
  ------------------
  615|  45.1k|	    if (i && RFC2440)
  ------------------
  |  |  373|  25.0k|#define RFC2440 (opt.compliance==CO_RFC2440)
  |  |  ------------------
  |  |  |  Branch (373:17): [True: 0, False: 25.0k]
  |  |  ------------------
  ------------------
  |  Branch (615:10): [True: 25.0k, False: 20.0k]
  ------------------
  616|      0|		rc = GPG_ERR_INV_ARMOR;
  617|  45.1k|	    break;
  618|  45.1k|	}
  619|  50.5k|    }
  620|       |
  621|       |
  622|  46.3k|    if( rc )
  ------------------
  |  Branch (622:9): [True: 0, False: 46.3k]
  ------------------
  623|      0|	invalid_armor();
  624|  46.3k|    else if( afx->in_cleartext )
  ------------------
  |  Branch (624:14): [True: 29.5k, False: 16.7k]
  ------------------
  625|  29.5k|	afx->faked = 1;
  626|  16.7k|    else {
  627|  16.7k|	afx->inp_checked = 1;
  628|  16.7k|	gcry_md_reset (afx->crc_md);
  629|  16.7k|	afx->idx = 0;
  630|  16.7k|	afx->radbuf[0] = 0;
  631|  16.7k|    }
  632|       |
  633|  46.3k|    return rc;
  634|  47.1k|}
armor.c:radix64_read:
  843|  45.0k|{
  844|  45.0k|    byte val;
  845|  45.0k|    int c;
  846|  45.0k|    u32 binc;
  847|  45.0k|    int checkcrc=0;
  848|  45.0k|    int rc = 0;
  849|  45.0k|    size_t n = 0;
  850|  45.0k|    int idx, onlypad=0;
  851|  45.0k|    int skip_fast = 0;
  852|       |
  853|  45.0k|    idx = afx->idx;
  854|  45.0k|    val = afx->radbuf[0];
  855|  3.70M|    for( n=0; n < size; ) {
  ------------------
  |  Branch (855:15): [True: 3.70M, False: 505]
  ------------------
  856|       |
  857|  3.70M|	if( afx->buffer_pos < afx->buffer_len )
  ------------------
  |  Branch (857:6): [True: 3.60M, False: 104k]
  ------------------
  858|  3.60M|	    c = afx->buffer[afx->buffer_pos++];
  859|   104k|	else { /* read the next line */
  860|   104k|	    unsigned maxlen = MAX_LINELEN;
  ------------------
  |  |   38|   104k|#define MAX_LINELEN 20000
  ------------------
  861|   104k|	    afx->buffer_pos = 0;
  862|   104k|	    afx->buffer_len = iobuf_read_line( a, &afx->buffer,
  863|   104k|					       &afx->buffer_size, &maxlen );
  864|   104k|	    if( !maxlen )
  ------------------
  |  Branch (864:10): [True: 94, False: 104k]
  ------------------
  865|     94|		afx->truncated++;
  866|   104k|	    if( !afx->buffer_len )
  ------------------
  |  Branch (866:10): [True: 2.76k, False: 101k]
  ------------------
  867|  2.76k|		break; /* eof */
  868|   101k|	    continue;
  869|   104k|	}
  870|       |
  871|  3.60M|      again:
  872|  3.60M|	binc = asctobin[0][c];
  873|       |
  874|  3.60M|	if( binc != 0xffffffffUL )
  ------------------
  |  Branch (874:6): [True: 416k, False: 3.18M]
  ------------------
  875|   416k|	  {
  876|   416k|	    if( idx == 0 && skip_fast == 0
  ------------------
  |  Branch (876:10): [True: 223k, False: 193k]
  |  Branch (876:22): [True: 208k, False: 14.5k]
  ------------------
  877|   416k|		&& afx->buffer_pos + (16 - 1) < afx->buffer_len
  ------------------
  |  Branch (877:6): [True: 170k, False: 37.6k]
  ------------------
  878|   416k|		&& n + 12 < size)
  ------------------
  |  Branch (878:6): [True: 169k, False: 1.20k]
  ------------------
  879|   169k|	      {
  880|       |		/* Fast path for radix64 to binary conversion.  */
  881|   169k|		u32 b0,b1,b2,b3;
  882|       |
  883|       |		/* Speculatively load 15 more input bytes.  */
  884|   169k|		b0 = binc << (3 * 6);
  885|   169k|		b0 |= asctobin[2][afx->buffer[afx->buffer_pos + 0]];
  886|   169k|		b0 |= asctobin[1][afx->buffer[afx->buffer_pos + 1]];
  887|   169k|		b0 |= asctobin[0][afx->buffer[afx->buffer_pos + 2]];
  888|   169k|		b1  = asctobin[3][afx->buffer[afx->buffer_pos + 3]];
  889|   169k|		b1 |= asctobin[2][afx->buffer[afx->buffer_pos + 4]];
  890|   169k|		b1 |= asctobin[1][afx->buffer[afx->buffer_pos + 5]];
  891|   169k|		b1 |= asctobin[0][afx->buffer[afx->buffer_pos + 6]];
  892|   169k|		b2  = asctobin[3][afx->buffer[afx->buffer_pos + 7]];
  893|   169k|		b2 |= asctobin[2][afx->buffer[afx->buffer_pos + 8]];
  894|   169k|		b2 |= asctobin[1][afx->buffer[afx->buffer_pos + 9]];
  895|   169k|		b2 |= asctobin[0][afx->buffer[afx->buffer_pos + 10]];
  896|   169k|		b3  = asctobin[3][afx->buffer[afx->buffer_pos + 11]];
  897|   169k|		b3 |= asctobin[2][afx->buffer[afx->buffer_pos + 12]];
  898|   169k|		b3 |= asctobin[1][afx->buffer[afx->buffer_pos + 13]];
  899|   169k|		b3 |= asctobin[0][afx->buffer[afx->buffer_pos + 14]];
  900|       |
  901|       |		/* Check if any of the input bytes were invalid. */
  902|   169k|		if( (b0 | b1 | b2 | b3) != 0xffffffffUL )
  ------------------
  |  Branch (902:7): [True: 119k, False: 50.2k]
  ------------------
  903|   119k|		  {
  904|       |		    /* All 16 bytes are valid. */
  905|   119k|		    buf[n + 0] = b0 >> (2 * 8);
  906|   119k|		    buf[n + 1] = b0 >> (1 * 8);
  907|   119k|		    buf[n + 2] = b0 >> (0 * 8);
  908|   119k|		    buf[n + 3] = b1 >> (2 * 8);
  909|   119k|		    buf[n + 4] = b1 >> (1 * 8);
  910|   119k|		    buf[n + 5] = b1 >> (0 * 8);
  911|   119k|		    buf[n + 6] = b2 >> (2 * 8);
  912|   119k|		    buf[n + 7] = b2 >> (1 * 8);
  913|   119k|		    buf[n + 8] = b2 >> (0 * 8);
  914|   119k|		    buf[n + 9] = b3 >> (2 * 8);
  915|   119k|		    buf[n + 10] = b3 >> (1 * 8);
  916|   119k|		    buf[n + 11] = b3 >> (0 * 8);
  917|   119k|		    afx->buffer_pos += 16 - 1;
  918|   119k|		    n += 12;
  919|   119k|		    continue;
  920|   119k|		  }
  921|  50.2k|		else if( b0 == 0xffffffffUL )
  ------------------
  |  Branch (921:12): [True: 29.3k, False: 20.8k]
  ------------------
  922|  29.3k|		  {
  923|       |		    /* byte[1..3] have invalid character(s).  Switch to slow
  924|       |		       path.  */
  925|  29.3k|		    skip_fast = 1;
  926|  29.3k|		  }
  927|  20.8k|		else if( b1 == 0xffffffffUL )
  ------------------
  |  Branch (927:12): [True: 12.0k, False: 8.78k]
  ------------------
  928|  12.0k|		  {
  929|       |		    /* byte[4..7] have invalid character(s), first 4 bytes are
  930|       |		       valid.  */
  931|  12.0k|		    buf[n + 0] = b0 >> (2 * 8);
  932|  12.0k|		    buf[n + 1] = b0 >> (1 * 8);
  933|  12.0k|		    buf[n + 2] = b0 >> (0 * 8);
  934|  12.0k|		    afx->buffer_pos += 4 - 1;
  935|  12.0k|		    n += 3;
  936|  12.0k|		    skip_fast = 1;
  937|  12.0k|		    continue;
  938|  12.0k|		  }
  939|  8.78k|		else if( b2 == 0xffffffffUL )
  ------------------
  |  Branch (939:12): [True: 5.21k, False: 3.56k]
  ------------------
  940|  5.21k|		  {
  941|       |		    /* byte[8..11] have invalid character(s), first 8 bytes are
  942|       |		       valid.  */
  943|  5.21k|		    buf[n + 0] = b0 >> (2 * 8);
  944|  5.21k|		    buf[n + 1] = b0 >> (1 * 8);
  945|  5.21k|		    buf[n + 2] = b0 >> (0 * 8);
  946|  5.21k|		    buf[n + 3] = b1 >> (2 * 8);
  947|  5.21k|		    buf[n + 4] = b1 >> (1 * 8);
  948|  5.21k|		    buf[n + 5] = b1 >> (0 * 8);
  949|  5.21k|		    afx->buffer_pos += 8 - 1;
  950|  5.21k|		    n += 6;
  951|  5.21k|		    skip_fast = 1;
  952|  5.21k|		    continue;
  953|  5.21k|		  }
  954|  3.56k|		else /*if( b3 == 0xffffffffUL )*/
  955|  3.56k|		  {
  956|       |		    /* byte[12..15] have invalid character(s), first 12 bytes
  957|       |		       are valid.  */
  958|  3.56k|		    buf[n + 0] = b0 >> (2 * 8);
  959|  3.56k|		    buf[n + 1] = b0 >> (1 * 8);
  960|  3.56k|		    buf[n + 2] = b0 >> (0 * 8);
  961|  3.56k|		    buf[n + 3] = b1 >> (2 * 8);
  962|  3.56k|		    buf[n + 4] = b1 >> (1 * 8);
  963|  3.56k|		    buf[n + 5] = b1 >> (0 * 8);
  964|  3.56k|		    buf[n + 6] = b2 >> (2 * 8);
  965|  3.56k|		    buf[n + 7] = b2 >> (1 * 8);
  966|  3.56k|		    buf[n + 8] = b2 >> (0 * 8);
  967|  3.56k|		    afx->buffer_pos += 12 - 1;
  968|  3.56k|		    n += 9;
  969|  3.56k|		    skip_fast = 1;
  970|  3.56k|		    continue;
  971|  3.56k|		  }
  972|   169k|	      }
  973|       |
  974|   276k|	    switch(idx)
  ------------------
  |  Branch (974:13): [True: 0, False: 276k]
  ------------------
  975|   276k|	      {
  976|  82.7k|		case 0: val =  binc << 2; break;
  ------------------
  |  Branch (976:3): [True: 82.7k, False: 193k]
  ------------------
  977|  67.9k|		case 1: val |= (binc>>4)&3; buf[n++]=val;val=(binc<<4)&0xf0;break;
  ------------------
  |  Branch (977:3): [True: 67.9k, False: 208k]
  ------------------
  978|  65.4k|		case 2: val |= (binc>>2)&15; buf[n++]=val;val=(binc<<6)&0xc0;break;
  ------------------
  |  Branch (978:3): [True: 65.4k, False: 211k]
  ------------------
  979|  60.4k|		case 3: val |= binc&0x3f; buf[n++] = val; break;
  ------------------
  |  Branch (979:3): [True: 60.4k, False: 216k]
  ------------------
  980|   276k|	      }
  981|   276k|	    idx = (idx+1) % 4;
  982|       |
  983|   276k|	    continue;
  984|   276k|	  }
  985|       |
  986|  3.18M|	skip_fast = 0;
  987|       |
  988|  3.18M|	if( c == '\n' || c == ' ' || c == '\r' || c == '\t' )
  ------------------
  |  Branch (988:6): [True: 101k, False: 3.08M]
  |  Branch (988:19): [True: 11.4k, False: 3.07M]
  |  Branch (988:31): [True: 8.48k, False: 3.06M]
  |  Branch (988:44): [True: 9.81k, False: 3.05M]
  ------------------
  989|   131k|	    continue;
  990|  3.05M|	else if( c == '=' ) { /* pad character: stop */
  ------------------
  |  Branch (990:11): [True: 42.8k, False: 3.01M]
  ------------------
  991|       |	    /* some mailers leave quoted-printable encoded characters
  992|       |	     * so we try to workaround this */
  993|  42.8k|	    if( afx->buffer_pos+2 < afx->buffer_len ) {
  ------------------
  |  Branch (993:10): [True: 16.1k, False: 26.7k]
  ------------------
  994|  16.1k|		int cc1, cc2, cc3;
  995|  16.1k|		cc1 = afx->buffer[afx->buffer_pos];
  996|  16.1k|		cc2 = afx->buffer[afx->buffer_pos+1];
  997|  16.1k|		cc3 = afx->buffer[afx->buffer_pos+2];
  998|  16.1k|		if( isxdigit(cc1) && isxdigit(cc2)
  999|  16.1k|				  && strchr( "=\n\r\t ", cc3 )) {
  ------------------
  |  Branch (999:10): [True: 1.08k, False: 217]
  ------------------
 1000|       |		    /* well it seems to be the case - adjust */
 1001|  1.08k|		    c = isdigit(cc1)? (cc1 - '0'): (ascii_toupper(cc1)-'A'+10);
 1002|  1.08k|		    c <<= 4;
 1003|  1.08k|		    c |= isdigit(cc2)? (cc2 - '0'): (ascii_toupper(cc2)-'A'+10);
 1004|  1.08k|		    afx->buffer_pos += 2;
 1005|  1.08k|		    afx->qp_detected = 1;
 1006|  1.08k|		    goto again;
 1007|  1.08k|		}
 1008|  16.1k|	    }
 1009|       |
 1010|       |            /* Occasionally a bug MTA will leave the = escaped as
 1011|       |               =3D.  If the 4 characters following that are valid
 1012|       |               Radix64 characters and they are following by a new
 1013|       |               line, assume that this is the case and skip the
 1014|       |               3D.  */
 1015|  41.7k|            if (afx->buffer_pos + 6 < afx->buffer_len
  ------------------
  |  Branch (1015:17): [True: 5.34k, False: 36.4k]
  ------------------
 1016|  41.7k|                && afx->buffer[afx->buffer_pos + 0] == '3'
  ------------------
  |  Branch (1016:20): [True: 75, False: 5.26k]
  ------------------
 1017|  41.7k|                && afx->buffer[afx->buffer_pos + 1] == 'D'
  ------------------
  |  Branch (1017:20): [True: 52, False: 23]
  ------------------
 1018|  41.7k|                && asctobin[0][afx->buffer[afx->buffer_pos + 2]] != 0xffffffffUL
  ------------------
  |  Branch (1018:20): [True: 47, False: 5]
  ------------------
 1019|  41.7k|                && asctobin[0][afx->buffer[afx->buffer_pos + 3]] != 0xffffffffUL
  ------------------
  |  Branch (1019:20): [True: 44, False: 3]
  ------------------
 1020|  41.7k|                && asctobin[0][afx->buffer[afx->buffer_pos + 4]] != 0xffffffffUL
  ------------------
  |  Branch (1020:20): [True: 37, False: 7]
  ------------------
 1021|  41.7k|                && asctobin[0][afx->buffer[afx->buffer_pos + 5]] != 0xffffffffUL
  ------------------
  |  Branch (1021:20): [True: 26, False: 11]
  ------------------
 1022|  41.7k|                && afx->buffer[afx->buffer_pos + 6] == '\n')
  ------------------
  |  Branch (1022:20): [True: 3, False: 23]
  ------------------
 1023|      3|              {
 1024|      3|                afx->buffer_pos += 2;
 1025|      3|                afx->qp_detected = 1;
 1026|      3|              }
 1027|       |
 1028|  41.7k|	    if (!n)
  ------------------
  |  Branch (1028:10): [True: 30.5k, False: 11.2k]
  ------------------
 1029|  30.5k|	      onlypad = 1;
 1030|       |
 1031|  41.7k|	    if( idx == 1 )
  ------------------
  |  Branch (1031:10): [True: 14.5k, False: 27.2k]
  ------------------
 1032|  14.5k|		buf[n++] = val;
 1033|  41.7k|	    checkcrc++;
 1034|  41.7k|	    break;
 1035|  42.8k|	}
 1036|  3.01M|        else if (afx->dearmor_state && c == '-'
  ------------------
  |  Branch (1036:18): [True: 0, False: 3.01M]
  |  Branch (1036:40): [True: 0, False: 0]
  ------------------
 1037|  3.01M|                 && afx->buffer_pos + 8 < afx->buffer_len
  ------------------
  |  Branch (1037:21): [True: 0, False: 0]
  ------------------
 1038|  3.01M|                 && !strncmp (afx->buffer, "-----END ", 8)) {
  ------------------
  |  Branch (1038:21): [True: 0, False: 0]
  ------------------
 1039|      0|            break; /* End in --dearmor mode.  */
 1040|      0|        }
 1041|  3.01M|	else {
 1042|  3.01M|	    log_error(_("invalid radix64 character %02X skipped\n"), c);
  ------------------
  |  |   28|  3.01M|#  define _(a) gettext (a)
  ------------------
 1043|  3.01M|	    continue;
 1044|  3.01M|	}
 1045|  3.18M|    }
 1046|       |
 1047|  45.0k|    afx->idx = idx;
 1048|  45.0k|    afx->radbuf[0] = val;
 1049|       |
 1050|  45.0k|    if( n )
  ------------------
  |  Branch (1050:9): [True: 24.3k, False: 20.7k]
  ------------------
 1051|  24.3k|      gcry_md_write (afx->crc_md, buf, n);
 1052|       |
 1053|  45.0k|    if( checkcrc ) {
  ------------------
  |  Branch (1053:9): [True: 41.7k, False: 3.27k]
  ------------------
 1054|  41.7k|	gcry_md_final (afx->crc_md);
 1055|  41.7k|	afx->any_data = 1;
 1056|  41.7k|	afx->inp_checked=0;
 1057|  41.7k|	afx->faked = 0;
 1058|  59.4k|	for(;;) { /* skip lf and pad characters */
 1059|  59.4k|	    if( afx->buffer_pos < afx->buffer_len )
  ------------------
  |  Branch (1059:10): [True: 51.8k, False: 7.66k]
  ------------------
 1060|  51.8k|		c = afx->buffer[afx->buffer_pos++];
 1061|  7.66k|	    else { /* read the next line */
 1062|  7.66k|		unsigned maxlen = MAX_LINELEN;
  ------------------
  |  |   38|  7.66k|#define MAX_LINELEN 20000
  ------------------
 1063|  7.66k|		afx->buffer_pos = 0;
 1064|  7.66k|		afx->buffer_len = iobuf_read_line( a, &afx->buffer,
 1065|  7.66k|						   &afx->buffer_size, &maxlen );
 1066|  7.66k|		if( !maxlen )
  ------------------
  |  Branch (1066:7): [True: 66, False: 7.59k]
  ------------------
 1067|     66|		    afx->truncated++;
 1068|  7.66k|		if( !afx->buffer_len )
  ------------------
  |  Branch (1068:7): [True: 137, False: 7.52k]
  ------------------
 1069|    137|		    break; /* eof */
 1070|  7.52k|		continue;
 1071|  7.66k|	    }
 1072|  51.8k|	    if( c == '\n' || c == ' ' || c == '\r'
  ------------------
  |  Branch (1072:10): [True: 7.54k, False: 44.2k]
  |  Branch (1072:23): [True: 434, False: 43.8k]
  |  Branch (1072:35): [True: 677, False: 43.1k]
  ------------------
 1073|  51.8k|		|| c == '\t' || c == '=' )
  ------------------
  |  Branch (1073:6): [True: 276, False: 42.8k]
  |  Branch (1073:19): [True: 1.21k, False: 41.6k]
  ------------------
 1074|  10.1k|		continue;
 1075|  41.6k|	    break;
 1076|  51.8k|	}
 1077|  41.7k|	if( !afx->buffer_len )
  ------------------
  |  Branch (1077:6): [True: 137, False: 41.6k]
  ------------------
 1078|    137|	    log_error(_("premature eof (no CRC)\n"));
  ------------------
  |  |   28|    137|#  define _(a) gettext (a)
  ------------------
 1079|  41.6k|	else {
 1080|  41.6k|	    u32 mycrc = 0;
 1081|  41.6k|	    idx = 0;
 1082|  45.9k|	    do {
 1083|  45.9k|		if( (binc = asctobin[0][c]) == 0xffffffffUL )
  ------------------
  |  Branch (1083:7): [True: 40.1k, False: 5.80k]
  ------------------
 1084|  40.1k|		    break;
 1085|  5.80k|		switch(idx) {
  ------------------
  |  Branch (1085:10): [True: 0, False: 5.80k]
  ------------------
 1086|  1.65k|		  case 0: val =  binc << 2; break;
  ------------------
  |  Branch (1086:5): [True: 1.65k, False: 4.15k]
  ------------------
 1087|  1.47k|		  case 1: val |= (binc>>4)&3; mycrc |= val << 16;val=(binc<<4)&0xf0;break;
  ------------------
  |  Branch (1087:5): [True: 1.47k, False: 4.32k]
  ------------------
 1088|  1.35k|		  case 2: val |= (binc>>2)&15; mycrc |= val << 8;val=(binc<<6)&0xc0;break;
  ------------------
  |  Branch (1088:5): [True: 1.35k, False: 4.45k]
  ------------------
 1089|  1.32k|		  case 3: val |= binc&0x3f; mycrc |= val; break;
  ------------------
  |  Branch (1089:5): [True: 1.32k, False: 4.48k]
  ------------------
 1090|  5.80k|		}
 1091|  5.80k|		for(;;) {
 1092|  5.80k|		    if( afx->buffer_pos < afx->buffer_len )
  ------------------
  |  Branch (1092:11): [True: 5.60k, False: 197]
  ------------------
 1093|  5.60k|			c = afx->buffer[afx->buffer_pos++];
 1094|    197|		    else { /* read the next line */
 1095|    197|			unsigned maxlen = MAX_LINELEN;
  ------------------
  |  |   38|    197|#define MAX_LINELEN 20000
  ------------------
 1096|    197|			afx->buffer_pos = 0;
 1097|    197|			afx->buffer_len = iobuf_read_line( a, &afx->buffer,
 1098|    197|							   &afx->buffer_size,
 1099|    197|								&maxlen );
 1100|    197|			if( !maxlen )
  ------------------
  |  Branch (1100:8): [True: 0, False: 197]
  ------------------
 1101|      0|			    afx->truncated++;
 1102|    197|			if( !afx->buffer_len )
  ------------------
  |  Branch (1102:8): [True: 197, False: 0]
  ------------------
 1103|    197|			    break; /* eof */
 1104|      0|			continue;
 1105|    197|		    }
 1106|  5.60k|		    break;
 1107|  5.80k|		}
 1108|  5.80k|		if( !afx->buffer_len )
  ------------------
  |  Branch (1108:7): [True: 197, False: 5.60k]
  ------------------
 1109|    197|		    break; /* eof */
 1110|  5.80k|	    } while( ++idx < 4 );
  ------------------
  |  Branch (1110:15): [True: 4.29k, False: 1.31k]
  ------------------
 1111|  41.6k|	    if( !afx->buffer_len ) {
  ------------------
  |  Branch (1111:10): [True: 197, False: 41.4k]
  ------------------
 1112|    197|		log_info(_("premature eof (in CRC)\n"));
  ------------------
  |  |   28|    197|#  define _(a) gettext (a)
  ------------------
 1113|    197|		rc = invalid_crc();
 1114|    197|	    }
 1115|  41.4k|	    else if( idx == 0 ) {
  ------------------
  |  Branch (1115:15): [True: 40.0k, False: 1.45k]
  ------------------
 1116|       |	        /* No CRC at all is legal ("MAY") */
 1117|  40.0k|	        rc=0;
 1118|  40.0k|	    }
 1119|  1.45k|	    else if( idx != 4 ) {
  ------------------
  |  Branch (1119:15): [True: 146, False: 1.31k]
  ------------------
 1120|    146|		log_info(_("malformed CRC\n"));
  ------------------
  |  |   28|    146|#  define _(a) gettext (a)
  ------------------
 1121|    146|		rc = invalid_crc();
 1122|    146|	    }
 1123|  1.31k|	    else if( mycrc != get_afx_crc (afx) ) {
  ------------------
  |  Branch (1123:15): [True: 190, False: 1.12k]
  ------------------
 1124|    190|		log_info (_("CRC error; %06lX - %06lX\n"),
  ------------------
  |  |   28|    190|#  define _(a) gettext (a)
  ------------------
 1125|    190|				    (ulong)get_afx_crc (afx), (ulong)mycrc);
 1126|    190|		rc = invalid_crc();
 1127|    190|	    }
 1128|  1.12k|	    else {
 1129|  1.12k|		rc = 0;
 1130|       |                /* FIXME: Here we should emit another control packet,
 1131|       |                 * so that we know in mainproc that we are processing
 1132|       |                 * a clearsign message */
 1133|       |#if 0
 1134|       |		for(rc=0;!rc;) {
 1135|       |		    rc = 0 /*check_trailer( &fhdr, c )*/;
 1136|       |		    if( !rc ) {
 1137|       |			if( (c=iobuf_get(a)) == -1 )
 1138|       |			    rc = 2;
 1139|       |		    }
 1140|       |		}
 1141|       |		if( rc == -1 )
 1142|       |		    rc = 0;
 1143|       |		else if( rc == 2 ) {
 1144|       |		    log_error(_("premature eof (in trailer)\n"));
 1145|       |		    rc = GPG_ERR_INV_ARMOR;
 1146|       |		}
 1147|       |		else {
 1148|       |		    log_error(_("error in trailer line\n"));
 1149|       |		    rc = GPG_ERR_INV_ARMOR;
 1150|       |		}
 1151|       |#endif
 1152|  1.12k|	    }
 1153|  41.6k|	}
 1154|  41.7k|    }
 1155|       |
 1156|  45.0k|    if( !n && !onlypad )
  ------------------
  |  Branch (1156:9): [True: 20.7k, False: 24.3k]
  |  Branch (1156:15): [True: 2.16k, False: 18.6k]
  ------------------
 1157|  2.16k|	rc = -1;
 1158|       |
 1159|  45.0k|    *retn = n;
 1160|  45.0k|    return rc;
 1161|  45.0k|}
armor.c:invalid_crc:
  832|    533|{
  833|    533|  if ( opt.ignore_crc_error )
  ------------------
  |  Branch (833:8): [True: 0, False: 533]
  ------------------
  834|      0|    return 0;
  835|    533|  log_inc_errorcount();
  836|    533|  return gpg_error (GPG_ERR_INV_ARMOR);
  837|    533|}
armor.c:initialize:
  170|      1|{
  171|      1|    u32 i;
  172|      1|    const byte *s;
  173|       |
  174|       |    /* Build the helptable for radix64 to bin conversion.  Value 0xffffffff is
  175|       |       used to detect invalid characters.  */
  176|      1|    memset (asctobin, 0xff, sizeof(asctobin));
  177|     65|    for(s=bintoasc,i=0; *s; s++,i++ )
  ------------------
  |  Branch (177:25): [True: 64, False: 1]
  ------------------
  178|     64|      {
  179|     64|	asctobin[0][*s] = i << (0 * 6);
  180|     64|	asctobin[1][*s] = i << (1 * 6);
  181|     64|	asctobin[2][*s] = i << (2 * 6);
  182|     64|	asctobin[3][*s] = i << (3 * 6);
  183|     64|      }
  184|       |
  185|      1|    is_initialized=1;
  186|      1|}
armor.c:get_afx_crc:
  191|  1.50k|{
  192|  1.50k|  const byte *crc_buf;
  193|  1.50k|  u32 crc;
  194|       |
  195|  1.50k|  crc_buf = gcry_md_read (afx->crc_md, GCRY_MD_CRC24_RFC2440);
  196|       |
  197|  1.50k|  crc = crc_buf[0];
  198|  1.50k|  crc <<= 8;
  199|  1.50k|  crc |= crc_buf[1];
  200|  1.50k|  crc <<= 8;
  201|  1.50k|  crc |= crc_buf[2];
  202|       |
  203|  1.50k|  return crc;
  204|  1.50k|}

gpg_dirmngr_deinit_session_data:
  127|  24.4k|{
  128|  24.4k|  dirmngr_local_t dml;
  129|       |
  130|  24.4k|  while ((dml = ctrl->dirmngr_local))
  ------------------
  |  Branch (130:10): [True: 0, False: 24.4k]
  ------------------
  131|      0|    {
  132|      0|      ctrl->dirmngr_local = dml->next;
  133|      0|      if (dml->is_active)
  ------------------
  |  Branch (133:11): [True: 0, False: 0]
  ------------------
  134|      0|        log_error ("oops: trying to cleanup an active dirmngr context\n");
  135|      0|      else
  136|      0|        assuan_release (dml->ctx);
  137|      0|      xfree (dml);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  138|      0|    }
  139|  24.4k|}

keydb_new:
  255|  4.50k|{
  256|  4.50k|  gpg_error_t err;
  257|  4.50k|  KEYDB_HANDLE hd;
  258|       |
  259|  4.50k|  if (DBG_CLOCK)
  ------------------
  |  |  356|  4.50k|#define DBG_CLOCK   (opt.debug & DBG_CLOCK_VALUE)
  |  |  ------------------
  |  |  |  |  343|  4.50k|#define DBG_CLOCK_VALUE   4096
  |  |  ------------------
  |  |  |  Branch (356:21): [True: 0, False: 4.50k]
  |  |  ------------------
  ------------------
  260|      0|    log_clock ("keydb_new");
  261|       |
  262|  4.50k|  hd = xtrycalloc (1, sizeof *hd);
  ------------------
  |  |   99|  4.50k|#define xtrycalloc(a,b)  gcry_calloc ((a),(b))
  ------------------
  263|  4.50k|  if (!hd)
  ------------------
  |  Branch (263:7): [True: 0, False: 4.50k]
  ------------------
  264|      0|    {
  265|      0|      err = gpg_error_from_syserror ();
  266|      0|      goto leave;
  267|      0|    }
  268|       |
  269|  4.50k|  if (!opt.use_keyboxd)
  ------------------
  |  Branch (269:7): [True: 4.50k, False: 0]
  ------------------
  270|  4.50k|    {
  271|  4.50k|      err = internal_keydb_init (hd);
  272|  4.50k|      goto leave;
  273|  4.50k|    }
  274|      0|  hd->use_keyboxd = 1;
  275|      0|  hd->ctrl = ctrl;
  276|       |
  277|      0|  err = open_context (ctrl, &hd->kbl);
  278|       |
  279|  4.50k| leave:
  280|  4.50k|  if (err)
  ------------------
  |  Branch (280:7): [True: 0, False: 4.50k]
  ------------------
  281|      0|    {
  282|      0|      int rc;
  283|      0|      log_error (_("error opening key DB: %s\n"), gpg_strerror (err));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  284|      0|      xfree (hd);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  285|      0|      hd = NULL;
  286|      0|      if (!(rc = gpg_err_code_to_errno (err)))
  ------------------
  |  Branch (286:11): [True: 0, False: 0]
  ------------------
  287|      0|        rc = gpg_err_code_to_errno (GPG_ERR_EIO);
  288|      0|      gpg_err_set_errno (rc);
  289|      0|    }
  290|  4.50k|  return hd;
  291|      0|}
keydb_release:
  297|  27.7k|{
  298|  27.7k|  keyboxd_local_t kbl;
  299|       |
  300|  27.7k|  if (!hd)
  ------------------
  |  Branch (300:7): [True: 23.2k, False: 4.50k]
  ------------------
  301|  23.2k|    return;
  302|       |
  303|  4.50k|  if (DBG_CLOCK)
  ------------------
  |  |  356|  4.50k|#define DBG_CLOCK   (opt.debug & DBG_CLOCK_VALUE)
  |  |  ------------------
  |  |  |  |  343|  4.50k|#define DBG_CLOCK_VALUE   4096
  |  |  ------------------
  |  |  |  Branch (356:21): [True: 0, False: 4.50k]
  |  |  ------------------
  ------------------
  304|      0|    log_clock ("keydb_release");
  305|  4.50k|  if (!hd->use_keyboxd)
  ------------------
  |  Branch (305:7): [True: 4.50k, False: 0]
  ------------------
  306|  4.50k|    internal_keydb_deinit (hd);
  307|      0|  else
  308|      0|    {
  309|      0|      kbl = hd->kbl;
  310|      0|      if (DBG_CLOCK)
  ------------------
  |  |  356|      0|#define DBG_CLOCK   (opt.debug & DBG_CLOCK_VALUE)
  |  |  ------------------
  |  |  |  |  343|      0|#define DBG_CLOCK_VALUE   4096
  |  |  ------------------
  |  |  |  Branch (356:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  311|      0|        log_clock ("close_context (found)");
  312|      0|      if (!kbl->is_active)
  ------------------
  |  Branch (312:11): [True: 0, False: 0]
  ------------------
  313|      0|        log_fatal ("closing inactive keyboxd context %p\n", kbl);
  314|      0|      kbl->is_active = 0;
  315|      0|      hd->kbl = NULL;
  316|      0|      hd->ctrl = NULL;
  317|      0|    }
  318|  4.50k|  xfree (hd);
  ------------------
  |  |  104|  4.50k|#define xfree(a)         gcry_free ((a))
  ------------------
  319|  4.50k|}
keydb_search_reset:
  577|  11.4k|{
  578|  11.4k|  gpg_error_t err;
  579|       |
  580|  11.4k|  if (!hd)
  ------------------
  |  Branch (580:7): [True: 0, False: 11.4k]
  ------------------
  581|      0|    return gpg_error (GPG_ERR_INV_ARG);
  582|       |
  583|  11.4k|  if (DBG_CLOCK)
  ------------------
  |  |  356|  11.4k|#define DBG_CLOCK   (opt.debug & DBG_CLOCK_VALUE)
  |  |  ------------------
  |  |  |  |  343|  11.4k|#define DBG_CLOCK_VALUE   4096
  |  |  ------------------
  |  |  |  Branch (356:21): [True: 0, False: 11.4k]
  |  |  ------------------
  ------------------
  584|      0|    log_clock ("%s", __func__);
  585|  11.4k|  if (DBG_CACHE)
  ------------------
  |  |  352|  11.4k|#define DBG_CACHE  (opt.debug & DBG_CACHE_VALUE)
  |  |  ------------------
  |  |  |  |  338|  11.4k|#define DBG_CACHE_VALUE   64	/* debug the caching */
  |  |  ------------------
  |  |  |  Branch (352:20): [True: 0, False: 11.4k]
  |  |  ------------------
  ------------------
  586|      0|    log_debug ("%s (hd=%p)", __func__, hd);
  587|       |
  588|  11.4k|  if (!hd->use_keyboxd)
  ------------------
  |  Branch (588:7): [True: 11.4k, False: 0]
  ------------------
  589|  11.4k|    {
  590|  11.4k|      err = internal_keydb_search_reset (hd);
  591|  11.4k|      goto leave;
  592|  11.4k|    }
  593|       |
  594|       |  /* All we need is to tell search that a reset is pending.  Note that
  595|       |   * keydb_new sets this flag as well.  To comply with the
  596|       |   * specification of keydb_delete_keyblock we also need to clear the
  597|       |   * ubid flag so that after a reset a delete can't be performed.  */
  598|      0|  hd->kbl->need_search_reset = 1;
  599|      0|  hd->last_ubid_valid = 0;
  600|      0|  err = 0;
  601|       |
  602|  11.4k| leave:
  603|  11.4k|  return err;
  604|      0|}
keydb_search:
  677|  16.0k|{
  678|  16.0k|  gpg_error_t err;
  679|  16.0k|  int i;
  680|  16.0k|  char line[ASSUAN_LINELENGTH];
  681|  16.0k|  char *buffer;
  682|  16.0k|  size_t len;
  683|       |
  684|  16.0k|  if (!hd)
  ------------------
  |  Branch (684:7): [True: 0, False: 16.0k]
  ------------------
  685|      0|    return gpg_error (GPG_ERR_INV_ARG);
  686|       |
  687|  16.0k|  if (descindex)
  ------------------
  |  Branch (687:7): [True: 0, False: 16.0k]
  ------------------
  688|      0|    *descindex = 0; /* Make sure it is always set on return.  */
  689|       |
  690|  16.0k|  if (DBG_CLOCK)
  ------------------
  |  |  356|  16.0k|#define DBG_CLOCK   (opt.debug & DBG_CLOCK_VALUE)
  |  |  ------------------
  |  |  |  |  343|  16.0k|#define DBG_CLOCK_VALUE   4096
  |  |  ------------------
  |  |  |  Branch (356:21): [True: 0, False: 16.0k]
  |  |  ------------------
  ------------------
  691|      0|    log_clock ("%s enter", __func__);
  692|       |
  693|  16.0k|  if (DBG_LOOKUP)
  ------------------
  |  |  357|  16.0k|#define DBG_LOOKUP  (opt.debug & DBG_LOOKUP_VALUE)
  |  |  ------------------
  |  |  |  |  344|  16.0k|#define DBG_LOOKUP_VALUE  8192	/* debug the key lookup */
  |  |  ------------------
  |  |  |  Branch (357:21): [True: 0, False: 16.0k]
  |  |  ------------------
  ------------------
  694|      0|    {
  695|      0|      log_debug ("%s: %zu search descriptions:\n", __func__, ndesc);
  696|      0|      for (i = 0; i < ndesc; i ++)
  ------------------
  |  Branch (696:19): [True: 0, False: 0]
  ------------------
  697|      0|        {
  698|      0|          char *t = keydb_search_desc_dump (&desc[i]);
  699|      0|          log_debug ("%s   %d: %s\n", __func__, i, t);
  700|      0|          xfree (t);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  701|      0|        }
  702|      0|    }
  703|       |
  704|  16.0k|  if (!hd->use_keyboxd)
  ------------------
  |  Branch (704:7): [True: 16.0k, False: 0]
  ------------------
  705|  16.0k|    {
  706|  16.0k|      err = internal_keydb_search (hd, desc, ndesc, descindex);
  707|  16.0k|      goto leave;
  708|  16.0k|    }
  709|       |
  710|       |  /* Clear the result objects.  */
  711|      0|  if (hd->kbl->search_result)
  ------------------
  |  Branch (711:7): [True: 0, False: 0]
  ------------------
  712|      0|    {
  713|      0|      iobuf_close (hd->kbl->search_result);
  714|      0|      hd->kbl->search_result = NULL;
  715|      0|    }
  716|       |
  717|       |  /* Check whether this is a NEXT search.  */
  718|      0|  if (!hd->kbl->need_search_reset)
  ------------------
  |  Branch (718:7): [True: 0, False: 0]
  ------------------
  719|      0|    {
  720|       |      /* No reset requested thus continue the search.  The keyboxd
  721|       |       * keeps the context of the search and thus the NEXT operates on
  722|       |       * the last search pattern.  This is how we always used the
  723|       |       * keydb.c functions.  In theory we were able to modify the
  724|       |       * search pattern between searches but that is not anymore
  725|       |       * supported by keyboxd and a cursory check does not show that
  726|       |       * we actually made used of that misfeature.  */
  727|      0|      snprintf (line, sizeof line, "NEXT");
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  728|      0|      goto do_search;
  729|      0|    }
  730|       |
  731|      0|  hd->kbl->need_search_reset = 0;
  732|       |
  733|      0|  if (!ndesc)
  ------------------
  |  Branch (733:7): [True: 0, False: 0]
  ------------------
  734|      0|    {
  735|      0|      err = gpg_error (GPG_ERR_INV_ARG);
  736|      0|      goto leave;
  737|      0|    }
  738|      0|  for (i = 0; i < ndesc; i++)
  ------------------
  |  Branch (738:15): [True: 0, False: 0]
  ------------------
  739|      0|    if (desc->mode == KEYDB_SEARCH_MODE_FIRST)
  ------------------
  |  Branch (739:9): [True: 0, False: 0]
  ------------------
  740|      0|      {
  741|       |        /* If any description has mode FIRST, this item trumps all
  742|       |         * other descriptions.  */
  743|      0|        snprintf (line, sizeof line, "SEARCH --openpgp");
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  744|      0|        goto do_search;
  745|      0|      }
  746|       |
  747|      0|  for ( ; ndesc; desc++, ndesc--)
  ------------------
  |  Branch (747:11): [True: 0, False: 0]
  ------------------
  748|      0|    {
  749|      0|      const char *more = ndesc > 1 ? "--openpgp --more" : "--openpgp";
  ------------------
  |  Branch (749:26): [True: 0, False: 0]
  ------------------
  750|       |
  751|      0|      switch (desc->mode)
  752|      0|        {
  753|      0|        case KEYDB_SEARCH_MODE_EXACT:
  ------------------
  |  Branch (753:9): [True: 0, False: 0]
  ------------------
  754|      0|          snprintf (line, sizeof line, "SEARCH %s -- =%s", more, desc->u.name);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  755|      0|          break;
  756|       |
  757|      0|        case KEYDB_SEARCH_MODE_SUBSTR:
  ------------------
  |  Branch (757:9): [True: 0, False: 0]
  ------------------
  758|      0|          snprintf (line, sizeof line, "SEARCH %s -- *%s", more, desc->u.name);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  759|      0|          break;
  760|       |
  761|      0|        case KEYDB_SEARCH_MODE_MAIL:
  ------------------
  |  Branch (761:9): [True: 0, False: 0]
  ------------------
  762|      0|          snprintf (line, sizeof line, "SEARCH %s -- <%s",
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  763|      0|                    more, desc->u.name+(desc->u.name[0] == '<') );
  764|      0|          break;
  765|       |
  766|      0|        case KEYDB_SEARCH_MODE_MAILSUB:
  ------------------
  |  Branch (766:9): [True: 0, False: 0]
  ------------------
  767|      0|          snprintf (line, sizeof line, "SEARCH %s -- @%s", more, desc->u.name);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  768|      0|          break;
  769|       |
  770|      0|        case KEYDB_SEARCH_MODE_MAILEND:
  ------------------
  |  Branch (770:9): [True: 0, False: 0]
  ------------------
  771|      0|          snprintf (line, sizeof line, "SEARCH %s -- .%s", more, desc->u.name);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  772|      0|          break;
  773|       |
  774|      0|        case KEYDB_SEARCH_MODE_WORDS:
  ------------------
  |  Branch (774:9): [True: 0, False: 0]
  ------------------
  775|      0|          snprintf (line, sizeof line, "SEARCH %s -- +%s", more, desc->u.name);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  776|      0|          break;
  777|       |
  778|      0|        case KEYDB_SEARCH_MODE_SHORT_KID:
  ------------------
  |  Branch (778:9): [True: 0, False: 0]
  ------------------
  779|      0|          snprintf (line, sizeof line, "SEARCH %s -- 0x%08lX", more,
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  780|      0|                    (ulong)desc->u.kid[1]);
  781|      0|          break;
  782|       |
  783|      0|        case KEYDB_SEARCH_MODE_LONG_KID:
  ------------------
  |  Branch (783:9): [True: 0, False: 0]
  ------------------
  784|      0|          snprintf (line, sizeof line, "SEARCH %s -- 0x%08lX%08lX", more,
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  785|      0|                    (ulong)desc->u.kid[0], (ulong)desc->u.kid[1]);
  786|      0|          break;
  787|       |
  788|      0|        case KEYDB_SEARCH_MODE_FPR:
  ------------------
  |  Branch (788:9): [True: 0, False: 0]
  ------------------
  789|      0|          {
  790|      0|            unsigned char hexfpr[MAX_FINGERPRINT_LEN * 2 + 1];
  791|      0|            log_assert (desc->fprlen <= MAX_FINGERPRINT_LEN);
  792|      0|            bin2hex (desc->u.fpr, desc->fprlen, hexfpr);
  793|      0|            snprintf (line, sizeof line, "SEARCH %s -- 0x%s", more, hexfpr);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  794|      0|          }
  795|      0|          break;
  796|       |
  797|      0|        case KEYDB_SEARCH_MODE_ISSUER:
  ------------------
  |  Branch (797:9): [True: 0, False: 0]
  ------------------
  798|      0|          snprintf (line, sizeof line, "SEARCH %s -- #/%s", more, desc->u.name);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  799|      0|          break;
  800|       |
  801|      0|        case KEYDB_SEARCH_MODE_ISSUER_SN:
  ------------------
  |  Branch (801:9): [True: 0, False: 0]
  ------------------
  802|      0|        case KEYDB_SEARCH_MODE_SN:
  ------------------
  |  Branch (802:9): [True: 0, False: 0]
  ------------------
  803|      0|          snprintf (line, sizeof line, "SEARCH %s -- #%s", more, desc->u.name);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  804|      0|          break;
  805|       |
  806|      0|        case KEYDB_SEARCH_MODE_SUBJECT:
  ------------------
  |  Branch (806:9): [True: 0, False: 0]
  ------------------
  807|      0|          snprintf (line, sizeof line, "SEARCH %s -- /%s", more, desc->u.name);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  808|      0|          break;
  809|       |
  810|      0|        case KEYDB_SEARCH_MODE_KEYGRIP:
  ------------------
  |  Branch (810:9): [True: 0, False: 0]
  ------------------
  811|      0|          {
  812|      0|            unsigned char hexgrip[KEYGRIP_LEN * 2 + 1];
  813|      0|            bin2hex (desc->u.grip, KEYGRIP_LEN, hexgrip);
  ------------------
  |  |   56|      0|#define KEYGRIP_LEN 20
  ------------------
  814|      0|            snprintf (line, sizeof line, "SEARCH %s -- &%s", more, hexgrip);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  815|      0|          }
  816|      0|          break;
  817|       |
  818|      0|        case KEYDB_SEARCH_MODE_UBID:
  ------------------
  |  Branch (818:9): [True: 0, False: 0]
  ------------------
  819|      0|          {
  820|      0|            unsigned char hexubid[UBID_LEN * 2 + 1];
  821|      0|            bin2hex (desc->u.ubid, UBID_LEN, hexubid);
  ------------------
  |  |   60|      0|#define UBID_LEN    20
  ------------------
  822|      0|            snprintf (line, sizeof line, "SEARCH %s -- ^%s", more, hexubid);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  823|      0|          }
  824|      0|          break;
  825|       |
  826|      0|        case KEYDB_SEARCH_MODE_NEXT:
  ------------------
  |  Branch (826:9): [True: 0, False: 0]
  ------------------
  827|      0|          log_debug ("%s: mode next - we should not get to here!\n", __func__);
  828|      0|          snprintf (line, sizeof line, "NEXT");
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  829|      0|          break;
  830|       |
  831|      0|        case KEYDB_SEARCH_MODE_FIRST:
  ------------------
  |  Branch (831:9): [True: 0, False: 0]
  ------------------
  832|      0|          log_debug ("%s: mode first - we should not get to here!\n", __func__);
  833|       |          /*fallthru*/
  834|      0|        default:
  ------------------
  |  Branch (834:9): [True: 0, False: 0]
  ------------------
  835|      0|          err = gpg_error (GPG_ERR_INV_ARG);
  836|      0|          goto leave;
  837|      0|        }
  838|       |
  839|      0|      if (ndesc > 1)
  ------------------
  |  Branch (839:11): [True: 0, False: 0]
  ------------------
  840|      0|        {
  841|      0|          err = kbx_client_data_simple (hd->kbl->kcd, line);
  842|      0|          if (err)
  ------------------
  |  Branch (842:15): [True: 0, False: 0]
  ------------------
  843|      0|            goto leave;
  844|      0|        }
  845|      0|    }
  846|      0|  while (ndesc);
  ------------------
  |  Branch (846:10): [True: 0, False: 0]
  ------------------
  847|       |
  848|       |
  849|      0| do_search:
  850|      0|  hd->last_ubid_valid = 0;
  851|      0|  err = kbx_client_data_cmd (hd->kbl->kcd, line, search_status_cb, hd);
  852|      0|  if (!err && !(err = kbx_client_data_wait (hd->kbl->kcd, &buffer, &len)))
  ------------------
  |  Branch (852:7): [True: 0, False: 0]
  |  Branch (852:15): [True: 0, False: 0]
  ------------------
  853|      0|    {
  854|      0|      hd->kbl->search_result = iobuf_temp_with_content (buffer, len);
  855|      0|      xfree (buffer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  856|      0|      if (DBG_LOOKUP && hd->last_ubid_valid)
  ------------------
  |  |  357|      0|#define DBG_LOOKUP  (opt.debug & DBG_LOOKUP_VALUE)
  |  |  ------------------
  |  |  |  |  344|      0|#define DBG_LOOKUP_VALUE  8192	/* debug the key lookup */
  |  |  ------------------
  |  |  |  Branch (357:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (856:25): [True: 0, False: 0]
  ------------------
  857|      0|        log_printhex (hd->last_ubid, 20, "found UBID (%d,%d):",
  858|      0|                      hd->last_uid_no, hd->last_pk_no);
  859|      0|    }
  860|       |
  861|  16.0k| leave:
  862|  16.0k|  if (DBG_CLOCK)
  ------------------
  |  |  356|  16.0k|#define DBG_CLOCK   (opt.debug & DBG_CLOCK_VALUE)
  |  |  ------------------
  |  |  |  |  343|  16.0k|#define DBG_CLOCK_VALUE   4096
  |  |  ------------------
  |  |  |  Branch (356:21): [True: 0, False: 16.0k]
  |  |  ------------------
  ------------------
  863|      0|    log_clock ("%s leave (%sfound)", __func__, err? "not ":"");
  ------------------
  |  Branch (863:48): [True: 0, False: 0]
  ------------------
  864|  16.0k|  return err;
  865|      0|}

handle_compressed:
  313|   263k|{
  314|   263k|    int rc;
  315|       |
  316|   263k|    if(check_compress_algo(cd->algorithm))
  ------------------
  |  Branch (316:8): [True: 341, False: 263k]
  ------------------
  317|    341|      return GPG_ERR_COMPR_ALGO;
  318|   263k|    if(cd->algorithm) {
  ------------------
  |  Branch (318:8): [True: 0, False: 263k]
  ------------------
  319|      0|        compress_filter_context_t *cfx;
  320|       |
  321|      0|        cfx = xmalloc_clear (sizeof *cfx);
  ------------------
  |  |  116|      0|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
  322|      0|        cfx->release = release_context;
  323|      0|        cfx->algo = cd->algorithm;
  324|      0|        if (push_compress_filter(cd->buf, cfx, cd->algorithm))
  ------------------
  |  Branch (324:13): [True: 0, False: 0]
  ------------------
  325|      0|          xfree (cfx);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  326|      0|    }
  327|   263k|    if( callback )
  ------------------
  |  Branch (327:9): [True: 263k, False: 0]
  ------------------
  328|   263k|	rc = callback(cd->buf, passthru );
  329|      0|    else
  330|      0|      rc = proc_packets (ctrl,procctx, cd->buf);
  331|   263k|    cd->buf = NULL;
  332|   263k|    return rc;
  333|   263k|}

write_status:
  139|  33.0k|{
  140|  33.0k|    write_status_text( no, NULL );
  141|  33.0k|}
write_status_strings:
  149|   412k|{
  150|   412k|  va_list arg_ptr;
  151|   412k|  const char *s;
  152|       |
  153|   412k|  if (!statusfp || !status_currently_allowed (no) )
  ------------------
  |  Branch (153:7): [True: 412k, False: 0]
  |  Branch (153:20): [True: 0, False: 0]
  ------------------
  154|   412k|    return;  /* Not enabled or allowed. */
  155|       |
  156|      0|  es_fputs ("[GNUPG:] ", statusfp);
  157|      0|  es_fputs (get_status_string (no), statusfp);
  158|      0|  if ( text )
  ------------------
  |  Branch (158:8): [True: 0, False: 0]
  ------------------
  159|      0|    {
  160|      0|      es_putc ( ' ', statusfp);
  161|      0|      va_start (arg_ptr, text);
  162|      0|      s = text;
  163|      0|      do
  164|      0|        {
  165|      0|          for (; *s; s++)
  ------------------
  |  Branch (165:18): [True: 0, False: 0]
  ------------------
  166|      0|            {
  167|      0|              if (*s == '\n')
  ------------------
  |  Branch (167:19): [True: 0, False: 0]
  ------------------
  168|      0|                es_fputs ("\\n", statusfp);
  169|      0|              else if (*s == '\r')
  ------------------
  |  Branch (169:24): [True: 0, False: 0]
  ------------------
  170|      0|                es_fputs ("\\r", statusfp);
  171|      0|              else
  172|      0|                es_fputc (*(const byte *)s, statusfp);
  173|      0|            }
  174|      0|        }
  175|      0|      while ((s = va_arg (arg_ptr, const char*)));
  ------------------
  |  Branch (175:14): [True: 0, False: 0]
  ------------------
  176|      0|      va_end (arg_ptr);
  177|      0|    }
  178|      0|  es_putc ('\n', statusfp);
  179|      0|  if (es_fflush (statusfp) && opt.exit_on_status_write_error)
  ------------------
  |  Branch (179:7): [True: 0, False: 0]
  |  Branch (179:31): [True: 0, False: 0]
  ------------------
  180|      0|    g10_exit (0);
  181|      0|}
write_status_text:
  230|   412k|{
  231|   412k|  write_status_strings (no, text, NULL);
  232|   412k|}
write_status_printf:
  239|  61.6k|{
  240|  61.6k|  va_list arg_ptr;
  241|  61.6k|  char *buf;
  242|       |
  243|  61.6k|  if (!statusfp || !status_currently_allowed (no) )
  ------------------
  |  Branch (243:7): [True: 61.6k, False: 0]
  |  Branch (243:20): [True: 0, False: 0]
  ------------------
  244|  61.6k|    return;  /* Not enabled or allowed. */
  245|       |
  246|      0|  es_fputs ("[GNUPG:] ", statusfp);
  247|      0|  es_fputs (get_status_string (no), statusfp);
  248|      0|  if (format)
  ------------------
  |  Branch (248:7): [True: 0, False: 0]
  ------------------
  249|      0|    {
  250|      0|      es_putc ( ' ', statusfp);
  251|      0|      va_start (arg_ptr, format);
  252|      0|      buf = gpgrt_vbsprintf (format, arg_ptr);
  253|      0|      if (!buf)
  ------------------
  |  Branch (253:11): [True: 0, False: 0]
  ------------------
  254|      0|        log_error ("error printing status line: %s\n",
  255|      0|                   gpg_strerror (gpg_err_code_from_syserror ()));
  256|      0|      else
  257|      0|        {
  258|      0|          if (strpbrk (buf, "\r\n"))
  ------------------
  |  Branch (258:15): [True: 0, False: 0]
  ------------------
  259|      0|            {
  260|      0|              const byte *s;
  261|      0|              for (s=buf; *s; s++)
  ------------------
  |  Branch (261:27): [True: 0, False: 0]
  ------------------
  262|      0|                {
  263|      0|                  if (*s == '\n')
  ------------------
  |  Branch (263:23): [True: 0, False: 0]
  ------------------
  264|      0|                    es_fputs ("\\n", statusfp);
  265|      0|                  else if (*s == '\r')
  ------------------
  |  Branch (265:28): [True: 0, False: 0]
  ------------------
  266|      0|                    es_fputs ("\\r", statusfp);
  267|      0|                  else
  268|      0|                    es_fputc (*s, statusfp);
  269|      0|                }
  270|      0|            }
  271|      0|          else
  272|      0|            es_fputs (buf, statusfp);
  273|      0|          gpgrt_free (buf);
  274|      0|        }
  275|       |
  276|      0|      va_end (arg_ptr);
  277|      0|    }
  278|      0|  es_putc ('\n', statusfp);
  279|      0|  if (es_fflush (statusfp) && opt.exit_on_status_write_error)
  ------------------
  |  Branch (279:7): [True: 0, False: 0]
  |  Branch (279:31): [True: 0, False: 0]
  ------------------
  280|      0|    g10_exit (0);
  281|      0|}
write_status_text_and_buffer:
  339|  7.46k|{
  340|  7.46k|  const char *s, *text;
  341|  7.46k|  int esc, first;
  342|  7.46k|  int lower_limit = ' ';
  343|  7.46k|  size_t n, count, dowrap;
  344|       |
  345|  7.46k|  if (!statusfp || !status_currently_allowed (no))
  ------------------
  |  Branch (345:7): [True: 7.46k, False: 0]
  |  Branch (345:20): [True: 0, False: 0]
  ------------------
  346|  7.46k|    return;  /* Not enabled or allowed. */
  347|       |
  348|      0|  if (wrap == -1)
  ------------------
  |  Branch (348:7): [True: 0, False: 0]
  ------------------
  349|      0|    {
  350|      0|      lower_limit--;
  351|      0|      wrap = 0;
  352|      0|    }
  353|       |
  354|      0|  text = get_status_string (no);
  355|      0|  count = dowrap = first = 1;
  356|      0|  do
  357|      0|    {
  358|      0|      if (dowrap)
  ------------------
  |  Branch (358:11): [True: 0, False: 0]
  ------------------
  359|      0|        {
  360|      0|          es_fprintf (statusfp, "[GNUPG:] %s ", text);
  361|      0|          count = dowrap = 0;
  362|      0|          if (first && string)
  ------------------
  |  Branch (362:15): [True: 0, False: 0]
  |  Branch (362:24): [True: 0, False: 0]
  ------------------
  363|      0|            {
  364|      0|              es_fputs (string, statusfp);
  365|      0|              count += strlen (string);
  366|       |              /* Make sure that there is a space after the string.  */
  367|      0|              if (*string && string[strlen (string)-1] != ' ')
  ------------------
  |  Branch (367:19): [True: 0, False: 0]
  |  Branch (367:30): [True: 0, False: 0]
  ------------------
  368|      0|                {
  369|      0|                  es_putc (' ', statusfp);
  370|      0|                  count++;
  371|      0|                }
  372|      0|            }
  373|      0|          first = 0;
  374|      0|        }
  375|      0|      for (esc=0, s=buffer, n=len; n; s++, n--)
  ------------------
  |  Branch (375:36): [True: 0, False: 0]
  ------------------
  376|      0|        {
  377|      0|          if (*s == '%' || *(const byte*)s <= lower_limit
  ------------------
  |  Branch (377:15): [True: 0, False: 0]
  |  Branch (377:28): [True: 0, False: 0]
  ------------------
  378|      0|              || *(const byte*)s == 127 )
  ------------------
  |  Branch (378:18): [True: 0, False: 0]
  ------------------
  379|      0|            esc = 1;
  380|      0|          if (wrap && ++count > wrap)
  ------------------
  |  Branch (380:15): [True: 0, False: 0]
  |  Branch (380:23): [True: 0, False: 0]
  ------------------
  381|      0|            dowrap=1;
  382|      0|          if (esc || dowrap)
  ------------------
  |  Branch (382:15): [True: 0, False: 0]
  |  Branch (382:22): [True: 0, False: 0]
  ------------------
  383|      0|            break;
  384|      0|        }
  385|      0|      if (s != buffer)
  ------------------
  |  Branch (385:11): [True: 0, False: 0]
  ------------------
  386|      0|        es_fwrite (buffer, s-buffer, 1, statusfp);
  387|      0|      if ( esc )
  ------------------
  |  Branch (387:12): [True: 0, False: 0]
  ------------------
  388|      0|        {
  389|      0|          es_fprintf (statusfp, "%%%02X", *(const byte*)s );
  390|      0|          s++; n--;
  391|      0|        }
  392|      0|      buffer = s;
  393|      0|      len = n;
  394|      0|      if (dowrap && len)
  ------------------
  |  Branch (394:11): [True: 0, False: 0]
  |  Branch (394:21): [True: 0, False: 0]
  ------------------
  395|      0|        es_putc ('\n', statusfp);
  396|      0|    }
  397|      0|  while (len);
  ------------------
  |  Branch (397:10): [True: 0, False: 0]
  ------------------
  398|       |
  399|      0|  es_putc ('\n',statusfp);
  400|      0|  if (es_fflush (statusfp) && opt.exit_on_status_write_error)
  ------------------
  |  Branch (400:7): [True: 0, False: 0]
  |  Branch (400:31): [True: 0, False: 0]
  ------------------
  401|      0|    g10_exit (0);
  402|      0|}
write_status_buffer:
  407|  7.46k|{
  408|  7.46k|  write_status_text_and_buffer (no, NULL, buffer, len, wrap);
  409|  7.46k|}

free_symkey_enc:
   76|    723|{
   77|    723|    xfree(enc);
  ------------------
  |  |  104|    723|#define xfree(a)         gcry_free ((a))
  ------------------
   78|    723|}
free_pubkey_enc:
   82|  32.9k|{
   83|  32.9k|    int n, i;
   84|  32.9k|    n = pubkey_get_nenc( enc->pubkey_algo );
   85|  32.9k|    if( !n )
  ------------------
  |  Branch (85:9): [True: 9.92k, False: 23.0k]
  ------------------
   86|  9.92k|	mpi_release(enc->data[0]);
   87|  78.7k|    for(i=0; i < n; i++ )
  ------------------
  |  Branch (87:14): [True: 45.7k, False: 32.9k]
  ------------------
   88|  45.7k|	mpi_release( enc->data[i] );
   89|  32.9k|    xfree(enc);
  ------------------
  |  |  104|  32.9k|#define xfree(a)         gcry_free ((a))
  ------------------
   90|  32.9k|}
free_seckey_enc:
   94|   342k|{
   95|   342k|  int n, i;
   96|       |
   97|   342k|  n = pubkey_get_nsig( sig->pubkey_algo );
   98|   342k|  if( !n )
  ------------------
  |  Branch (98:7): [True: 323k, False: 18.7k]
  ------------------
   99|   323k|    mpi_release(sig->data[0]);
  100|   374k|  for(i=0; i < n; i++ )
  ------------------
  |  Branch (100:12): [True: 31.3k, False: 342k]
  ------------------
  101|  31.3k|    mpi_release( sig->data[i] );
  102|       |
  103|   342k|  xfree(sig->revkey);
  ------------------
  |  |  104|   342k|#define xfree(a)         gcry_free ((a))
  ------------------
  104|   342k|  xfree(sig->hashed);
  ------------------
  |  |  104|   342k|#define xfree(a)         gcry_free ((a))
  ------------------
  105|   342k|  xfree(sig->unhashed);
  ------------------
  |  |  104|   342k|#define xfree(a)         gcry_free ((a))
  ------------------
  106|       |
  107|   342k|  xfree (sig->signers_uid);
  ------------------
  |  |  104|   342k|#define xfree(a)         gcry_free ((a))
  ------------------
  108|       |
  109|   342k|  xfree(sig);
  ------------------
  |  |  104|   342k|#define xfree(a)         gcry_free ((a))
  ------------------
  110|   342k|}
release_public_key_parts:
  115|  59.1k|{
  116|  59.1k|  int n, i;
  117|       |
  118|  59.1k|  if (pk->seckey_info)
  ------------------
  |  Branch (118:7): [True: 24.1k, False: 34.9k]
  ------------------
  119|  24.1k|    n = pubkey_get_nskey (pk->pubkey_algo);
  120|  34.9k|  else
  121|  34.9k|    n = pubkey_get_npkey (pk->pubkey_algo);
  122|  59.1k|  if (!n)
  ------------------
  |  Branch (122:7): [True: 26.2k, False: 32.9k]
  ------------------
  123|  26.2k|    mpi_release (pk->pkey[0]);
  124|   217k|  for (i=0; i < n; i++ )
  ------------------
  |  Branch (124:13): [True: 158k, False: 59.1k]
  ------------------
  125|   158k|    {
  126|   158k|      mpi_release (pk->pkey[i]);
  127|   158k|      pk->pkey[i] = NULL;
  128|   158k|    }
  129|  59.1k|  if (pk->seckey_info)
  ------------------
  |  Branch (129:7): [True: 24.1k, False: 34.9k]
  ------------------
  130|  24.1k|    {
  131|  24.1k|      xfree (pk->seckey_info);
  ------------------
  |  |  104|  24.1k|#define xfree(a)         gcry_free ((a))
  ------------------
  132|  24.1k|      pk->seckey_info = NULL;
  133|  24.1k|    }
  134|  59.1k|  if (pk->prefs)
  ------------------
  |  Branch (134:7): [True: 0, False: 59.1k]
  ------------------
  135|      0|    {
  136|      0|      xfree (pk->prefs);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  137|      0|      pk->prefs = NULL;
  138|      0|    }
  139|  59.1k|  free_user_id (pk->user_id);
  140|  59.1k|  pk->user_id = NULL;
  141|  59.1k|  if (pk->revkey)
  ------------------
  |  Branch (141:7): [True: 0, False: 59.1k]
  ------------------
  142|      0|    {
  143|      0|      xfree(pk->revkey);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  144|      0|      pk->revkey=NULL;
  145|      0|      pk->numrevkeys=0;
  146|      0|    }
  147|  59.1k|  if (pk->serialno)
  ------------------
  |  Branch (147:7): [True: 0, False: 59.1k]
  ------------------
  148|      0|    {
  149|      0|      xfree (pk->serialno);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  150|      0|      pk->serialno = NULL;
  151|      0|    }
  152|  59.1k|  if (pk->updateurl)
  ------------------
  |  Branch (152:7): [True: 0, False: 59.1k]
  ------------------
  153|      0|    {
  154|      0|      xfree (pk->updateurl);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  155|      0|      pk->updateurl = NULL;
  156|      0|    }
  157|  59.1k|}
free_public_key:
  164|  91.9k|{
  165|  91.9k|  if (pk)
  ------------------
  |  Branch (165:7): [True: 59.1k, False: 32.8k]
  ------------------
  166|  59.1k|    {
  167|  59.1k|      release_public_key_parts (pk);
  168|  59.1k|      xfree(pk);
  ------------------
  |  |  104|  59.1k|#define xfree(a)         gcry_free ((a))
  ------------------
  169|  59.1k|    }
  170|  91.9k|}
free_comment:
  304|    865|{
  305|    865|    xfree(rem);
  ------------------
  |  |  104|    865|#define xfree(a)         gcry_free ((a))
  ------------------
  306|    865|}
free_attributes:
  310|  5.23k|{
  311|  5.23k|  if (!uid)
  ------------------
  |  Branch (311:7): [True: 0, False: 5.23k]
  ------------------
  312|      0|    return;
  313|       |
  314|  5.23k|  xfree(uid->attribs);
  ------------------
  |  |  104|  5.23k|#define xfree(a)         gcry_free ((a))
  ------------------
  315|  5.23k|  xfree(uid->attrib_data);
  ------------------
  |  |  104|  5.23k|#define xfree(a)         gcry_free ((a))
  ------------------
  316|       |
  317|  5.23k|  uid->attribs=NULL;
  318|  5.23k|  uid->attrib_data=NULL;
  319|  5.23k|  uid->attrib_len=0;
  320|  5.23k|}
free_user_id:
  324|  64.3k|{
  325|  64.3k|  if (!uid)
  ------------------
  |  Branch (325:7): [True: 59.1k, False: 5.23k]
  ------------------
  326|  59.1k|    return;
  327|       |
  328|  5.23k|  log_assert (uid->ref > 0);
  329|  5.23k|  if (--uid->ref)
  ------------------
  |  Branch (329:7): [True: 0, False: 5.23k]
  ------------------
  330|      0|    return;
  331|       |
  332|  5.23k|  free_attributes(uid);
  333|  5.23k|  xfree (uid->prefs);
  ------------------
  |  |  104|  5.23k|#define xfree(a)         gcry_free ((a))
  ------------------
  334|  5.23k|  xfree (uid->namehash);
  ------------------
  |  |  104|  5.23k|#define xfree(a)         gcry_free ((a))
  ------------------
  335|  5.23k|  xfree (uid->updateurl);
  ------------------
  |  |  104|  5.23k|#define xfree(a)         gcry_free ((a))
  ------------------
  336|  5.23k|  xfree (uid->mbox);
  ------------------
  |  |  104|  5.23k|#define xfree(a)         gcry_free ((a))
  ------------------
  337|  5.23k|  xfree (uid);
  ------------------
  |  |  104|  5.23k|#define xfree(a)         gcry_free ((a))
  ------------------
  338|  5.23k|}
free_compressed:
  342|   264k|{
  343|   264k|  if (!zd)
  ------------------
  |  Branch (343:7): [True: 0, False: 264k]
  ------------------
  344|      0|    return;
  345|       |
  346|   264k|  if (zd->buf)
  ------------------
  |  Branch (346:7): [True: 738, False: 263k]
  ------------------
  347|    738|    {
  348|       |      /* We need to skip some bytes.  Because don't have any
  349|       |       * information about the length, so we assume this is the last
  350|       |       * packet */
  351|  2.74k|      while (iobuf_read( zd->buf, NULL, 1<<30 ) != -1)
  ------------------
  |  Branch (351:14): [True: 2.00k, False: 738]
  ------------------
  352|  2.00k|        ;
  353|    738|    }
  354|   264k|  xfree(zd);
  ------------------
  |  |  104|   264k|#define xfree(a)         gcry_free ((a))
  ------------------
  355|   264k|}
free_encrypted:
  359|  8.33k|{
  360|  8.33k|  if (!ed)
  ------------------
  |  Branch (360:7): [True: 0, False: 8.33k]
  ------------------
  361|      0|    return;
  362|       |
  363|  8.33k|  if (ed->buf)
  ------------------
  |  Branch (363:7): [True: 2.38k, False: 5.95k]
  ------------------
  364|  2.38k|    {
  365|       |      /* We need to skip some bytes. */
  366|  2.38k|      if (ed->is_partial)
  ------------------
  |  Branch (366:11): [True: 165, False: 2.22k]
  ------------------
  367|    165|        {
  368|    478|          while (iobuf_read( ed->buf, NULL, 1<<30 ) != -1)
  ------------------
  |  Branch (368:18): [True: 313, False: 165]
  ------------------
  369|    313|            ;
  370|    165|	}
  371|  2.22k|      else
  372|  2.22k|        {
  373|  3.18k|          while (ed->len)
  ------------------
  |  Branch (373:18): [True: 962, False: 2.22k]
  ------------------
  374|    962|            {
  375|       |              /* Skip the packet. */
  376|    962|              int n = iobuf_read( ed->buf, NULL, ed->len );
  377|    962|              if (n == -1)
  ------------------
  |  Branch (377:19): [True: 350, False: 612]
  ------------------
  378|    350|                ed->len = 0;
  379|    612|              else
  380|    612|                ed->len -= n;
  381|    962|            }
  382|  2.22k|	}
  383|  2.38k|    }
  384|  8.33k|  xfree (ed);
  ------------------
  |  |  104|  8.33k|#define xfree(a)         gcry_free ((a))
  ------------------
  385|  8.33k|}
free_plaintext:
  390|  69.3k|{
  391|  69.3k|  if (!pt)
  ------------------
  |  Branch (391:7): [True: 0, False: 69.3k]
  ------------------
  392|      0|    return;
  393|       |
  394|  69.3k|  if (pt->buf)
  ------------------
  |  Branch (394:7): [True: 66.4k, False: 2.86k]
  ------------------
  395|  66.4k|    { /* We need to skip some bytes.  */
  396|  66.4k|      if (pt->is_partial)
  ------------------
  |  Branch (396:11): [True: 13.5k, False: 52.9k]
  ------------------
  397|  13.5k|        {
  398|  22.9k|          while (iobuf_read( pt->buf, NULL, 1<<30 ) != -1)
  ------------------
  |  Branch (398:18): [True: 9.37k, False: 13.5k]
  ------------------
  399|  9.37k|            ;
  400|  13.5k|        }
  401|  52.9k|      else
  402|  52.9k|        {
  403|  77.4k|          while( pt->len )
  ------------------
  |  Branch (403:18): [True: 24.5k, False: 52.9k]
  ------------------
  404|  24.5k|            { /* Skip the packet.  */
  405|  24.5k|              int n = iobuf_read( pt->buf, NULL, pt->len );
  406|  24.5k|              if (n == -1)
  ------------------
  |  Branch (406:19): [True: 4.99k, False: 19.5k]
  ------------------
  407|  4.99k|                pt->len = 0;
  408|  19.5k|              else
  409|  19.5k|                pt->len -= n;
  410|  24.5k|            }
  411|  52.9k|	}
  412|  66.4k|    }
  413|  69.3k|  xfree (pt);
  ------------------
  |  |  104|  69.3k|#define xfree(a)         gcry_free ((a))
  ------------------
  414|  69.3k|}
free_packet:
  422|  2.21M|{
  423|  2.21M|  if (!pkt || !pkt->pkt.generic)
  ------------------
  |  Branch (423:7): [True: 874k, False: 1.34M]
  |  Branch (423:15): [True: 472k, False: 867k]
  ------------------
  424|  1.34M|    {
  425|  1.34M|      if (parsectx && parsectx->last_pkt.pkt.generic)
  ------------------
  |  Branch (425:11): [True: 1.34M, False: 0]
  |  Branch (425:23): [True: 328k, False: 1.01M]
  ------------------
  426|   328k|        {
  427|   328k|          if (parsectx->free_last_pkt)
  ------------------
  |  Branch (427:15): [True: 5.73k, False: 322k]
  ------------------
  428|  5.73k|            {
  429|  5.73k|              free_packet (&parsectx->last_pkt, NULL);
  430|  5.73k|              parsectx->free_last_pkt = 0;
  431|  5.73k|            }
  432|   328k|          parsectx->last_pkt.pkttype = 0;
  433|   328k|          parsectx->last_pkt.pkt.generic = NULL;
  434|   328k|        }
  435|  1.34M|      return;
  436|  1.34M|    }
  437|       |
  438|   867k|  if (DBG_MEMORY)
  ------------------
  |  |  361|   867k|#define DBG_MEMORY    memory_debug_mode
  |  |  ------------------
  |  |  |  Branch (361:23): [True: 0, False: 867k]
  |  |  ------------------
  ------------------
  439|      0|    log_debug ("free_packet() type=%d\n", pkt->pkttype);
  440|       |
  441|       |  /* If we have a parser context holding PKT then do not free the
  442|       |   * packet but set a flag that the packet in the parser context is
  443|       |   * now a deep copy.  */
  444|   867k|  if (parsectx && !parsectx->free_last_pkt
  ------------------
  |  Branch (444:7): [True: 123k, False: 743k]
  |  Branch (444:19): [True: 123k, False: 0]
  ------------------
  445|   867k|      && parsectx->last_pkt.pkttype == pkt->pkttype
  ------------------
  |  Branch (445:10): [True: 5.73k, False: 118k]
  ------------------
  446|   867k|      && parsectx->last_pkt.pkt.generic == pkt->pkt.generic)
  ------------------
  |  Branch (446:10): [True: 5.73k, False: 0]
  ------------------
  447|  5.73k|    {
  448|  5.73k|      parsectx->last_pkt = *pkt;
  449|  5.73k|      parsectx->free_last_pkt = 1;
  450|  5.73k|      pkt->pkt.generic = NULL;
  451|  5.73k|      return;
  452|  5.73k|    }
  453|       |
  454|   862k|  switch (pkt->pkttype)
  455|   862k|    {
  456|   342k|    case PKT_SIGNATURE:
  ------------------
  |  Branch (456:5): [True: 342k, False: 519k]
  ------------------
  457|   342k|      free_seckey_enc (pkt->pkt.signature);
  458|   342k|      break;
  459|  32.9k|    case PKT_PUBKEY_ENC:
  ------------------
  |  Branch (459:5): [True: 32.9k, False: 829k]
  ------------------
  460|  32.9k|      free_pubkey_enc (pkt->pkt.pubkey_enc);
  461|  32.9k|      break;
  462|    723|    case PKT_SYMKEY_ENC:
  ------------------
  |  Branch (462:5): [True: 723, False: 861k]
  ------------------
  463|    723|      free_symkey_enc (pkt->pkt.symkey_enc);
  464|    723|      break;
  465|  2.25k|    case PKT_PUBLIC_KEY:
  ------------------
  |  Branch (465:5): [True: 2.25k, False: 859k]
  ------------------
  466|  4.43k|    case PKT_PUBLIC_SUBKEY:
  ------------------
  |  Branch (466:5): [True: 2.18k, False: 859k]
  ------------------
  467|  25.3k|    case PKT_SECRET_KEY:
  ------------------
  |  Branch (467:5): [True: 20.9k, False: 841k]
  ------------------
  468|  42.9k|    case PKT_SECRET_SUBKEY:
  ------------------
  |  Branch (468:5): [True: 17.5k, False: 844k]
  ------------------
  469|  42.9k|      free_public_key (pkt->pkt.public_key);
  470|  42.9k|      break;
  471|    865|    case PKT_COMMENT:
  ------------------
  |  Branch (471:5): [True: 865, False: 861k]
  ------------------
  472|    865|      free_comment (pkt->pkt.comment);
  473|    865|      break;
  474|  5.23k|    case PKT_USER_ID:
  ------------------
  |  Branch (474:5): [True: 5.23k, False: 856k]
  ------------------
  475|  5.23k|      free_user_id (pkt->pkt.user_id);
  476|  5.23k|      break;
  477|   264k|    case PKT_COMPRESSED:
  ------------------
  |  Branch (477:5): [True: 264k, False: 598k]
  ------------------
  478|   264k|      free_compressed (pkt->pkt.compressed);
  479|   264k|      break;
  480|  1.45k|    case PKT_ENCRYPTED:
  ------------------
  |  Branch (480:5): [True: 1.45k, False: 860k]
  ------------------
  481|  3.93k|    case PKT_ENCRYPTED_MDC:
  ------------------
  |  Branch (481:5): [True: 2.47k, False: 859k]
  ------------------
  482|  8.33k|    case PKT_ENCRYPTED_AEAD:
  ------------------
  |  Branch (482:5): [True: 4.40k, False: 857k]
  ------------------
  483|  8.33k|      free_encrypted (pkt->pkt.encrypted);
  484|  8.33k|      break;
  485|  69.3k|    case PKT_PLAINTEXT:
  ------------------
  |  Branch (485:5): [True: 69.3k, False: 792k]
  ------------------
  486|  69.3k|      free_plaintext (pkt->pkt.plaintext);
  487|  69.3k|      break;
  488|  94.9k|    default:
  ------------------
  |  Branch (488:5): [True: 94.9k, False: 767k]
  ------------------
  489|  94.9k|      xfree (pkt->pkt.generic);
  ------------------
  |  |  104|  94.9k|#define xfree(a)         gcry_free ((a))
  ------------------
  490|  94.9k|      break;
  491|   862k|    }
  492|       |
  493|   862k|  pkt->pkt.generic = NULL;
  494|   862k|}

get_pubkey_for_sig:
  317|  12.5k|{
  318|  12.5k|  const byte *fpr;
  319|  12.5k|  size_t fprlen;
  320|       |
  321|  12.5k|  if (forced_pk)
  ------------------
  |  Branch (321:7): [True: 0, False: 12.5k]
  ------------------
  322|      0|    {
  323|      0|      copy_public_key (pk, forced_pk);
  324|      0|      return 0;
  325|      0|    }
  326|       |
  327|       |  /* First try the ISSUER_FPR info.  */
  328|  12.5k|  fpr = issuer_fpr_raw (sig, &fprlen);
  329|  12.5k|  if (fpr && !get_pubkey_byfprint (ctrl, pk, NULL, fpr, fprlen))
  ------------------
  |  Branch (329:7): [True: 3.40k, False: 9.18k]
  |  Branch (329:14): [True: 0, False: 3.40k]
  ------------------
  330|      0|    return 0;
  331|       |
  332|       |  /* Fallback to use the ISSUER_KEYID.  */
  333|  12.5k|  return get_pubkey (ctrl, pk, sig->keyid);
  334|  12.5k|}
get_pubkey:
  360|  12.5k|{
  361|  12.5k|  int internal = 0;
  362|  12.5k|  int rc = 0;
  363|       |
  364|  12.5k|#if MAX_PK_CACHE_ENTRIES
  365|  12.5k|  if (pk)
  ------------------
  |  Branch (365:7): [True: 12.5k, False: 0]
  ------------------
  366|  12.5k|    {
  367|       |      /* Try to get it from the cache.  We don't do this when pk is
  368|       |         NULL as it does not guarantee that the user IDs are
  369|       |         cached. */
  370|  12.5k|      pk_cache_entry_t ce;
  371|  12.5k|      for (ce = pk_cache; ce; ce = ce->next)
  ------------------
  |  Branch (371:27): [True: 0, False: 12.5k]
  ------------------
  372|      0|	{
  373|      0|	  if (ce->keyid[0] == keyid[0] && ce->keyid[1] == keyid[1])
  ------------------
  |  Branch (373:8): [True: 0, False: 0]
  |  Branch (373:36): [True: 0, False: 0]
  ------------------
  374|       |	    /* XXX: We don't check PK->REQ_USAGE here, but if we don't
  375|       |	       read from the cache, we do check it!  */
  376|      0|	    {
  377|      0|	      copy_public_key (pk, ce->pk);
  378|      0|	      return 0;
  379|      0|	    }
  380|      0|	}
  381|  12.5k|    }
  382|  12.5k|#endif
  383|       |  /* More init stuff.  */
  384|  12.5k|  if (!pk)
  ------------------
  |  Branch (384:7): [True: 0, False: 12.5k]
  ------------------
  385|      0|    {
  386|      0|      internal++;
  387|      0|      pk = xtrycalloc (1, sizeof *pk);
  ------------------
  |  |   99|      0|#define xtrycalloc(a,b)  gcry_calloc ((a),(b))
  ------------------
  388|      0|      if (!pk)
  ------------------
  |  Branch (388:11): [True: 0, False: 0]
  ------------------
  389|      0|        {
  390|      0|          rc = gpg_error_from_syserror ();
  391|      0|          goto leave;
  392|      0|        }
  393|      0|    }
  394|       |
  395|       |
  396|       |  /* Do a lookup.  */
  397|  12.5k|  {
  398|  12.5k|    struct getkey_ctx_s ctx;
  399|  12.5k|    kbnode_t kb = NULL;
  400|  12.5k|    kbnode_t found_key = NULL;
  401|       |
  402|  12.5k|    memset (&ctx, 0, sizeof ctx);
  403|  12.5k|    ctx.exact = 1; /* Use the key ID exactly as given.  */
  404|  12.5k|    ctx.not_allocated = 1;
  405|       |
  406|  12.5k|    if (ctrl && ctrl->cached_getkey_kdb)
  ------------------
  |  Branch (406:9): [True: 12.5k, False: 0]
  |  Branch (406:17): [True: 11.4k, False: 1.09k]
  ------------------
  407|  11.4k|      {
  408|  11.4k|        ctx.kr_handle = ctrl->cached_getkey_kdb;
  409|  11.4k|        ctrl->cached_getkey_kdb = NULL;
  410|  11.4k|        keydb_search_reset (ctx.kr_handle);
  411|  11.4k|      }
  412|  1.09k|    else
  413|  1.09k|      {
  414|  1.09k|        ctx.kr_handle = keydb_new (ctrl);
  415|  1.09k|        if (!ctx.kr_handle)
  ------------------
  |  Branch (415:13): [True: 0, False: 1.09k]
  ------------------
  416|      0|          {
  417|      0|            rc = gpg_error_from_syserror ();
  418|      0|            goto leave;
  419|      0|          }
  420|  1.09k|      }
  421|  12.5k|    ctx.nitems = 1;
  422|  12.5k|    ctx.items[0].mode = KEYDB_SEARCH_MODE_LONG_KID;
  423|  12.5k|    ctx.items[0].u.kid[0] = keyid[0];
  424|  12.5k|    ctx.items[0].u.kid[1] = keyid[1];
  425|  12.5k|    ctx.req_usage = pk->req_usage;
  426|  12.5k|    rc = lookup (ctrl, &ctx, 0, &kb, &found_key);
  427|  12.5k|    if (!rc)
  ------------------
  |  Branch (427:9): [True: 0, False: 12.5k]
  ------------------
  428|      0|      {
  429|      0|	pk_from_block (pk, kb, found_key);
  430|      0|      }
  431|  12.5k|    getkey_end (ctrl, &ctx);
  432|  12.5k|    release_kbnode (kb);
  433|  12.5k|  }
  434|  12.5k|  if (!rc)
  ------------------
  |  Branch (434:7): [True: 0, False: 12.5k]
  ------------------
  435|      0|    goto leave;
  436|       |
  437|  12.5k|  rc = GPG_ERR_NO_PUBKEY;
  438|       |
  439|  12.5k|leave:
  440|  12.5k|  if (!rc)
  ------------------
  |  Branch (440:7): [True: 0, False: 12.5k]
  ------------------
  441|      0|    cache_public_key (pk);
  442|  12.5k|  if (internal)
  ------------------
  |  Branch (442:7): [True: 0, False: 12.5k]
  ------------------
  443|      0|    free_public_key (pk);
  444|  12.5k|  return rc;
  445|  12.5k|}
get_pubkey_byfprint:
 1836|  3.40k|{
 1837|  3.40k|  int rc;
 1838|       |
 1839|  3.40k|  if (r_keyblock)
  ------------------
  |  Branch (1839:7): [True: 0, False: 3.40k]
  ------------------
 1840|      0|    *r_keyblock = NULL;
 1841|       |
 1842|  3.40k|  if (fprint_len == 32 || fprint_len == 20 || fprint_len == 16)
  ------------------
  |  Branch (1842:7): [True: 1.37k, False: 2.03k]
  |  Branch (1842:27): [True: 2.03k, False: 0]
  |  Branch (1842:47): [True: 0, False: 0]
  ------------------
 1843|  3.40k|    {
 1844|  3.40k|      struct getkey_ctx_s ctx;
 1845|  3.40k|      KBNODE kb = NULL;
 1846|  3.40k|      KBNODE found_key = NULL;
 1847|       |
 1848|  3.40k|      memset (&ctx, 0, sizeof ctx);
 1849|  3.40k|      ctx.exact = 1;
 1850|  3.40k|      ctx.not_allocated = 1;
 1851|       |      /* FIXME: We should get the handle from the cache like we do in
 1852|       |       * get_pubkey.  */
 1853|  3.40k|      ctx.kr_handle = keydb_new (ctrl);
 1854|  3.40k|      if (!ctx.kr_handle)
  ------------------
  |  Branch (1854:11): [True: 0, False: 3.40k]
  ------------------
 1855|      0|        return gpg_error_from_syserror ();
 1856|       |
 1857|  3.40k|      ctx.nitems = 1;
 1858|  3.40k|      ctx.items[0].mode = KEYDB_SEARCH_MODE_FPR;
 1859|  3.40k|      memcpy (ctx.items[0].u.fpr, fprint, fprint_len);
 1860|  3.40k|      ctx.items[0].fprlen = fprint_len;
 1861|  3.40k|      if (pk)
  ------------------
  |  Branch (1861:11): [True: 3.40k, False: 0]
  ------------------
 1862|  3.40k|        ctx.req_usage = pk->req_usage;
 1863|  3.40k|      rc = lookup (ctrl, &ctx, 0, &kb, &found_key);
 1864|  3.40k|      if (!rc && pk)
  ------------------
  |  Branch (1864:11): [True: 0, False: 3.40k]
  |  Branch (1864:18): [True: 0, False: 0]
  ------------------
 1865|      0|	pk_from_block (pk, kb, found_key);
 1866|  3.40k|      if (!rc && r_keyblock)
  ------------------
  |  Branch (1866:11): [True: 0, False: 3.40k]
  |  Branch (1866:18): [True: 0, False: 0]
  ------------------
 1867|      0|	{
 1868|      0|	  *r_keyblock = kb;
 1869|      0|	  kb = NULL;
 1870|      0|	}
 1871|  3.40k|      release_kbnode (kb);
 1872|  3.40k|      getkey_end (ctrl, &ctx);
 1873|  3.40k|    }
 1874|      0|  else
 1875|      0|    rc = GPG_ERR_GENERAL; /* Oops */
 1876|  3.40k|  return rc;
 1877|  3.40k|}
getkey_end:
 2333|  16.0k|{
 2334|  16.0k|  if (ctx)
  ------------------
  |  Branch (2334:7): [True: 16.0k, False: 0]
  ------------------
 2335|  16.0k|    {
 2336|       |#ifdef HAVE_W32_SYSTEM
 2337|       |
 2338|       |      /* FIXME: This creates a big regression for Windows because the
 2339|       |       * keyring is only released after the global ctrl is released.
 2340|       |       * So if an operation does a getkey and then tries to modify the
 2341|       |       * keyring it will fail on Windows with a sharing violation.  We
 2342|       |       * need to modify all keyring write operations to also take the
 2343|       |       * ctrl and close the cached_getkey_kdb handle to make writing
 2344|       |       * work.  See: GnuPG-bug-id: 3097  */
 2345|       |      (void)ctrl;
 2346|       |      keydb_release (ctx->kr_handle);
 2347|       |
 2348|       |#else /*!HAVE_W32_SYSTEM*/
 2349|       |
 2350|  16.0k|      if (ctrl && !ctrl->cached_getkey_kdb)
  ------------------
  |  Branch (2350:11): [True: 16.0k, False: 0]
  |  Branch (2350:19): [True: 12.6k, False: 3.31k]
  ------------------
 2351|  12.6k|        ctrl->cached_getkey_kdb = ctx->kr_handle;
 2352|  3.31k|      else
 2353|  3.31k|        keydb_release (ctx->kr_handle);
 2354|       |
 2355|  16.0k|#endif /*!HAVE_W32_SYSTEM*/
 2356|       |
 2357|  16.0k|      free_strlist (ctx->extra_list);
 2358|  16.0k|      if (!ctx->not_allocated)
  ------------------
  |  Branch (2358:11): [True: 0, False: 16.0k]
  ------------------
 2359|      0|	xfree (ctx);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 2360|  16.0k|    }
 2361|  16.0k|}
getkey.c:lookup:
 3907|  16.0k|{
 3908|  16.0k|  int rc;
 3909|  16.0k|  int no_suitable_key = 0;
 3910|  16.0k|  KBNODE keyblock = NULL;
 3911|  16.0k|  KBNODE found_key = NULL;
 3912|  16.0k|  unsigned int infoflags;
 3913|       |
 3914|  16.0k|  log_assert (ret_found_key == NULL || ret_keyblock != NULL);
 3915|  16.0k|  if (ret_keyblock)
  ------------------
  |  Branch (3915:7): [True: 16.0k, False: 0]
  ------------------
 3916|  16.0k|    *ret_keyblock = NULL;
 3917|       |
 3918|  16.0k|  for (;;)
 3919|  16.0k|    {
 3920|  16.0k|      rc = keydb_search (ctx->kr_handle, ctx->items, ctx->nitems, NULL);
 3921|  16.0k|      if (rc)
  ------------------
  |  Branch (3921:11): [True: 16.0k, False: 0]
  ------------------
 3922|  16.0k|        break;
 3923|       |
 3924|       |      /* If we are iterating over the entire database, then we need to
 3925|       |       * change from KEYDB_SEARCH_MODE_FIRST, which does an implicit
 3926|       |       * reset, to KEYDB_SEARCH_MODE_NEXT, which gets the next record.  */
 3927|      0|      if (ctx->nitems && ctx->items->mode == KEYDB_SEARCH_MODE_FIRST)
  ------------------
  |  Branch (3927:11): [True: 0, False: 0]
  |  Branch (3927:26): [True: 0, False: 0]
  ------------------
 3928|      0|	ctx->items->mode = KEYDB_SEARCH_MODE_NEXT;
 3929|       |
 3930|      0|      rc = keydb_get_keyblock (ctx->kr_handle, &keyblock);
 3931|      0|      if (rc)
  ------------------
  |  Branch (3931:11): [True: 0, False: 0]
  ------------------
 3932|      0|	{
 3933|      0|	  log_error ("keydb_get_keyblock failed: %s\n", gpg_strerror (rc));
 3934|      0|	  goto skip;
 3935|      0|	}
 3936|       |
 3937|      0|      if (want_secret)
  ------------------
  |  Branch (3937:11): [True: 0, False: 0]
  ------------------
 3938|      0|	{
 3939|      0|	  rc = agent_probe_any_secret_key (ctrl, keyblock);
 3940|      0|	  if (gpg_err_code(rc) == GPG_ERR_NO_SECKEY)
  ------------------
  |  Branch (3940:8): [True: 0, False: 0]
  ------------------
 3941|      0|	    goto skip; /* No secret key available.  */
 3942|      0|	  if (rc)
  ------------------
  |  Branch (3942:8): [True: 0, False: 0]
  ------------------
 3943|      0|	    goto found; /* Unexpected error.  */
 3944|      0|	}
 3945|       |
 3946|       |      /* Warning: node flag bits 0 and 1 should be preserved by
 3947|       |       * merge_selfsigs.  */
 3948|      0|      merge_selfsigs (ctrl, keyblock);
 3949|      0|      found_key = finish_lookup (keyblock, ctx->req_usage, ctx->exact,
 3950|      0|                                 want_secret, &infoflags);
 3951|      0|      print_status_key_considered (keyblock, infoflags);
 3952|      0|      if (found_key)
  ------------------
  |  Branch (3952:11): [True: 0, False: 0]
  ------------------
 3953|      0|	{
 3954|      0|	  no_suitable_key = 0;
 3955|      0|	  goto found;
 3956|      0|	}
 3957|      0|      else
 3958|      0|        {
 3959|      0|          no_suitable_key = 1;
 3960|      0|        }
 3961|       |
 3962|      0|    skip:
 3963|       |      /* Release resources and continue search. */
 3964|      0|      release_kbnode (keyblock);
 3965|      0|      keyblock = NULL;
 3966|       |      /* The keyblock cache ignores the current "file position".
 3967|       |       * Thus, if we request the next result and the cache matches
 3968|       |       * (and it will since it is what we just looked for), we'll get
 3969|       |       * the same entry back!  We can avoid this infinite loop by
 3970|       |       * disabling the cache.  */
 3971|      0|      keydb_disable_caching (ctx->kr_handle);
 3972|      0|    }
 3973|       |
 3974|  16.0k| found:
 3975|  16.0k|  if (rc && gpg_err_code (rc) != GPG_ERR_NOT_FOUND)
  ------------------
  |  Branch (3975:7): [True: 16.0k, False: 0]
  |  Branch (3975:13): [True: 0, False: 16.0k]
  ------------------
 3976|      0|    log_error ("keydb_search failed: %s\n", gpg_strerror (rc));
 3977|       |
 3978|  16.0k|  if (!rc)
  ------------------
  |  Branch (3978:7): [True: 0, False: 16.0k]
  ------------------
 3979|      0|    {
 3980|      0|      if (ret_keyblock)
  ------------------
  |  Branch (3980:11): [True: 0, False: 0]
  ------------------
 3981|      0|        {
 3982|      0|          *ret_keyblock = keyblock; /* Return the keyblock.  */
 3983|      0|          keyblock = NULL;
 3984|      0|        }
 3985|      0|    }
 3986|  16.0k|  else if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND && no_suitable_key)
  ------------------
  |  Branch (3986:12): [True: 16.0k, False: 0]
  |  Branch (3986:54): [True: 0, False: 16.0k]
  ------------------
 3987|      0|    rc = want_secret? GPG_ERR_UNUSABLE_SECKEY : GPG_ERR_UNUSABLE_PUBKEY;
  ------------------
  |  Branch (3987:10): [True: 0, False: 0]
  ------------------
 3988|  16.0k|  else if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND)
  ------------------
  |  Branch (3988:12): [True: 16.0k, False: 0]
  ------------------
 3989|  16.0k|    rc = want_secret? GPG_ERR_NO_SECKEY : GPG_ERR_NO_PUBKEY;
  ------------------
  |  Branch (3989:10): [True: 0, False: 16.0k]
  ------------------
 3990|       |
 3991|  16.0k|  release_kbnode (keyblock);
 3992|       |
 3993|  16.0k|  if (ret_found_key)
  ------------------
  |  Branch (3993:7): [True: 16.0k, False: 0]
  ------------------
 3994|  16.0k|    {
 3995|  16.0k|      if (! rc)
  ------------------
  |  Branch (3995:11): [True: 0, False: 16.0k]
  ------------------
 3996|      0|	*ret_found_key = found_key;
 3997|  16.0k|      else
 3998|  16.0k|	*ret_found_key = NULL;
 3999|  16.0k|    }
 4000|       |
 4001|  16.0k|  return rc;
 4002|  16.0k|}

new_kbnode:
   94|   406k|{
   95|   406k|    KBNODE n = alloc_node();
   96|   406k|    n->pkt = pkt;
   97|   406k|    return n;
   98|   406k|}
release_kbnode:
  127|   376k|{
  128|   376k|    KBNODE n2;
  129|       |
  130|   783k|    while( n ) {
  ------------------
  |  Branch (130:12): [True: 406k, False: 376k]
  ------------------
  131|   406k|	n2 = n->next;
  132|   406k|	if( !is_cloned_kbnode(n) ) {
  ------------------
  |  |   71|   406k|#define is_cloned_kbnode(a)   ((a)->private_flag & 2)
  ------------------
  |  Branch (132:6): [True: 406k, False: 0]
  ------------------
  133|   406k|            free_packet (n->pkt, NULL);
  134|   406k|            xfree( n->pkt );
  ------------------
  |  |  104|   406k|#define xfree(a)         gcry_free ((a))
  ------------------
  135|   406k|	}
  136|   406k|	free_node( n );
  137|   406k|	n = n2;
  138|   406k|    }
  139|   376k|}
add_kbnode:
  157|   183k|{
  158|   183k|    KBNODE n1;
  159|       |
  160|  27.5M|    for(n1=root; n1->next; n1 = n1->next)
  ------------------
  |  Branch (160:18): [True: 27.4M, False: 183k]
  ------------------
  161|  27.4M|	;
  162|   183k|    n1->next = node;
  163|   183k|}
find_next_kbnode:
  219|   584k|{
  220|   647k|    for( node=node->next ; node; node = node->next ) {
  ------------------
  |  Branch (220:28): [True: 246k, False: 401k]
  ------------------
  221|   246k|	if( !pkttype )
  ------------------
  |  Branch (221:6): [True: 0, False: 246k]
  ------------------
  222|      0|	    return node;
  223|   246k|	else if( pkttype == PKT_USER_ID
  ------------------
  |  Branch (223:11): [True: 0, False: 246k]
  ------------------
  224|   246k|		 && (	node->pkt->pkttype == PKT_PUBLIC_KEY
  ------------------
  |  Branch (224:9): [True: 0, False: 0]
  ------------------
  225|      0|		     || node->pkt->pkttype == PKT_SECRET_KEY ) )
  ------------------
  |  Branch (225:11): [True: 0, False: 0]
  ------------------
  226|      0|	    return NULL;
  227|   246k|	else if( pkttype == PKT_SIGNATURE
  ------------------
  |  Branch (227:11): [True: 246k, False: 0]
  ------------------
  228|   246k|		 && (	node->pkt->pkttype == PKT_USER_ID
  ------------------
  |  Branch (228:9): [True: 0, False: 246k]
  ------------------
  229|   246k|		     || node->pkt->pkttype == PKT_PUBLIC_KEY
  ------------------
  |  Branch (229:11): [True: 0, False: 246k]
  ------------------
  230|   246k|		     || node->pkt->pkttype == PKT_SECRET_KEY ) )
  ------------------
  |  Branch (230:11): [True: 0, False: 246k]
  ------------------
  231|      0|	    return NULL;
  232|   246k|	else if( node->pkt->pkttype == pkttype )
  ------------------
  |  Branch (232:11): [True: 183k, False: 63.1k]
  ------------------
  233|   183k|	    return node;
  234|   246k|    }
  235|   401k|    return NULL;
  236|   584k|}
dump_kbnode:
  376|    646|{
  377|  1.97k|  for (; node; node = node->next )
  ------------------
  |  Branch (377:10): [True: 1.32k, False: 646]
  ------------------
  378|  1.32k|    {
  379|  1.32k|      const char *s;
  380|  1.32k|      switch (node->pkt->pkttype)
  381|  1.32k|        {
  382|      0|        case 0:		s="empty"; break;
  ------------------
  |  Branch (382:9): [True: 0, False: 1.32k]
  ------------------
  383|      0|        case PKT_PUBLIC_KEY:	s="public-key"; break;
  ------------------
  |  Branch (383:9): [True: 0, False: 1.32k]
  ------------------
  384|      0|        case PKT_SECRET_KEY:	s="secret-key"; break;
  ------------------
  |  Branch (384:9): [True: 0, False: 1.32k]
  ------------------
  385|      0|        case PKT_SECRET_SUBKEY: s= "secret-subkey"; break;
  ------------------
  |  Branch (385:9): [True: 0, False: 1.32k]
  ------------------
  386|      0|        case PKT_PUBKEY_ENC:	s="public-enc"; break;
  ------------------
  |  Branch (386:9): [True: 0, False: 1.32k]
  ------------------
  387|    512|        case PKT_SIGNATURE:	s="signature"; break;
  ------------------
  |  Branch (387:9): [True: 512, False: 814]
  ------------------
  388|     30|        case PKT_ONEPASS_SIG: s="onepass-sig"; break;
  ------------------
  |  Branch (388:9): [True: 30, False: 1.29k]
  ------------------
  389|      0|        case PKT_USER_ID:	s="user-id"; break;
  ------------------
  |  Branch (389:9): [True: 0, False: 1.32k]
  ------------------
  390|      0|        case PKT_PUBLIC_SUBKEY: s="public-subkey"; break;
  ------------------
  |  Branch (390:9): [True: 0, False: 1.32k]
  ------------------
  391|      0|        case PKT_COMMENT:	s="comment"; break;
  ------------------
  |  Branch (391:9): [True: 0, False: 1.32k]
  ------------------
  392|      0|        case PKT_RING_TRUST:	s="trust"; break;
  ------------------
  |  Branch (392:9): [True: 0, False: 1.32k]
  ------------------
  393|      0|        case PKT_PLAINTEXT:	s="plaintext"; break;
  ------------------
  |  Branch (393:9): [True: 0, False: 1.32k]
  ------------------
  394|      0|        case PKT_COMPRESSED:	s="compressed"; break;
  ------------------
  |  Branch (394:9): [True: 0, False: 1.32k]
  ------------------
  395|      0|        case PKT_ENCRYPTED:	s="encrypted"; break;
  ------------------
  |  Branch (395:9): [True: 0, False: 1.32k]
  ------------------
  396|    784|        case PKT_GPG_CONTROL: s="gpg-control"; break;
  ------------------
  |  Branch (396:9): [True: 784, False: 542]
  ------------------
  397|      0|        default:		s="unknown"; break;
  ------------------
  |  Branch (397:9): [True: 0, False: 1.32k]
  ------------------
  398|  1.32k|	}
  399|  1.32k|      log_debug ("node %p %02x/%02x type=%s",
  400|  1.32k|                 node, node->flag, node->private_flag, s);
  401|  1.32k|      if (node->pkt->pkttype == PKT_USER_ID)
  ------------------
  |  Branch (401:11): [True: 0, False: 1.32k]
  ------------------
  402|      0|        {
  403|      0|          PKT_user_id *uid = node->pkt->pkt.user_id;
  404|      0|          log_printf ("  \"");
  405|      0|          es_write_sanitized (log_get_stream (), uid->name, uid->len,
  406|      0|                              NULL, NULL);
  407|      0|          log_printf ("\" %c%c%c%c\n",
  408|      0|                      uid->flags.expired? 'e':'.',
  ------------------
  |  Branch (408:23): [True: 0, False: 0]
  ------------------
  409|      0|                      uid->flags.revoked? 'r':'.',
  ------------------
  |  Branch (409:23): [True: 0, False: 0]
  ------------------
  410|      0|                      uid->created?    'v':'.',
  ------------------
  |  Branch (410:23): [True: 0, False: 0]
  ------------------
  411|      0|                      uid->flags.primary? 'p':'.' );
  ------------------
  |  Branch (411:23): [True: 0, False: 0]
  ------------------
  412|      0|        }
  413|  1.32k|      else if (node->pkt->pkttype == PKT_SIGNATURE)
  ------------------
  |  Branch (413:16): [True: 512, False: 814]
  ------------------
  414|    512|        {
  415|    512|          log_printf ("  class=%02x keyid=%08lX ts=%lu\n",
  416|    512|                      node->pkt->pkt.signature->sig_class,
  417|    512|                      (ulong)node->pkt->pkt.signature->keyid[1],
  418|    512|                      (ulong)node->pkt->pkt.signature->timestamp);
  419|    512|        }
  420|    814|      else if (node->pkt->pkttype == PKT_GPG_CONTROL)
  ------------------
  |  Branch (420:16): [True: 784, False: 30]
  ------------------
  421|    784|        {
  422|    784|          log_printf (" ctrl=%d len=%u\n",
  423|    784|                      node->pkt->pkt.gpg_control->control,
  424|    784|                      (unsigned int)node->pkt->pkt.gpg_control->datalen);
  425|    784|        }
  426|     30|      else if (node->pkt->pkttype == PKT_PUBLIC_KEY
  ------------------
  |  Branch (426:16): [True: 0, False: 30]
  ------------------
  427|     30|               || node->pkt->pkttype == PKT_PUBLIC_SUBKEY)
  ------------------
  |  Branch (427:19): [True: 0, False: 30]
  ------------------
  428|      0|        {
  429|      0|          PKT_public_key *pk = node->pkt->pkt.public_key;
  430|       |
  431|      0|          log_printf ("  keyid=%08lX a=%d u=%d %c%c%c%c%c\n",
  432|      0|                      (ulong)keyid_from_pk( pk, NULL ),
  433|      0|                      pk->pubkey_algo, pk->pubkey_usage,
  434|      0|                      pk->has_expired? 'e':'.',
  ------------------
  |  Branch (434:23): [True: 0, False: 0]
  ------------------
  435|      0|                      pk->flags.revoked? 'r':'.',
  ------------------
  |  Branch (435:23): [True: 0, False: 0]
  ------------------
  436|      0|                      pk->flags.valid?    'v':'.',
  ------------------
  |  Branch (436:23): [True: 0, False: 0]
  ------------------
  437|      0|                      pk->flags.mdc?   'm':'.',
  ------------------
  |  Branch (437:23): [True: 0, False: 0]
  ------------------
  438|      0|                      pk->flags.aead?  'a':'.');
  ------------------
  |  Branch (438:23): [True: 0, False: 0]
  ------------------
  439|      0|        }
  440|     30|      else
  441|     30|        log_printf ("\n");
  442|       |
  443|  1.32k|      log_flush ();
  444|  1.32k|    }
  445|    646|}
kbnode.c:alloc_node:
   53|   406k|{
   54|   406k|  kbnode_t n;
   55|       |
   56|   406k|  n = unused_nodes;
   57|   406k|  if (n)
  ------------------
  |  Branch (57:7): [True: 402k, False: 4.21k]
  ------------------
   58|   402k|    unused_nodes = n->next;
   59|  4.21k|  else
   60|  4.21k|    {
   61|  4.21k|      if (!cleanup_registered)
  ------------------
  |  Branch (61:11): [True: 1, False: 4.21k]
  ------------------
   62|      1|        {
   63|      1|          cleanup_registered = 1;
   64|      1|          register_mem_cleanup_func (release_unused_nodes);
   65|      1|        }
   66|  4.21k|      n = xmalloc (sizeof *n);
  ------------------
  |  |  107|  4.21k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
   67|  4.21k|    }
   68|   406k|  n->next = NULL;
   69|   406k|  n->pkt = NULL;
   70|   406k|  n->flag = 0;
   71|   406k|  n->tag = 0;
   72|   406k|  n->private_flag=0;
   73|   406k|  return n;
   74|   406k|}
kbnode.c:free_node:
   78|   406k|{
   79|   406k|  if (n)
  ------------------
  |  Branch (79:7): [True: 406k, False: 0]
  ------------------
   80|   406k|    {
   81|   406k|#if USE_UNUSED_NODES
   82|   406k|      n->next = unused_nodes;
   83|   406k|      unused_nodes = n;
   84|       |#else
   85|       |      xfree (n);
   86|       |#endif
   87|   406k|    }
   88|   406k|}

keydb_add_resource:
  561|      1|{
  562|       |  /* The file named by the URL (i.e., without the prototype).  */
  563|      1|  const char *resname = url;
  564|       |
  565|      1|  char *filename = NULL;
  566|      1|  int create;
  567|      1|  int read_only = !!(flags&KEYDB_RESOURCE_FLAG_READONLY);
  ------------------
  |  |  213|      1|#define KEYDB_RESOURCE_FLAG_READONLY 8  /* Open in read only mode.  */
  ------------------
  568|      1|  int is_default = !!(flags&KEYDB_RESOURCE_FLAG_DEFAULT);
  ------------------
  |  |  212|      1|#define KEYDB_RESOURCE_FLAG_DEFAULT  4  /* The default one.  */
  ------------------
  569|      1|  int is_gpgvdef = !!(flags&KEYDB_RESOURCE_FLAG_GPGVDEF);
  ------------------
  |  |  214|      1|#define KEYDB_RESOURCE_FLAG_GPGVDEF 16  /* Default file for gpgv.  */
  ------------------
  570|      1|  gpg_error_t err = 0;
  571|      1|  KeydbResourceType rt = KEYDB_RESOURCE_TYPE_NONE;
  572|      1|  void *token;
  573|       |
  574|       |  /* Create the resource if it is the first registered one.  */
  575|      1|  create = (!read_only && !any_registered);
  ------------------
  |  Branch (575:13): [True: 1, False: 0]
  |  Branch (575:27): [True: 1, False: 0]
  ------------------
  576|       |
  577|      1|  if (strlen (resname) > 11 && !strncmp( resname, "gnupg-ring:", 11) )
  ------------------
  |  Branch (577:7): [True: 0, False: 1]
  |  Branch (577:32): [True: 0, False: 0]
  ------------------
  578|      0|    {
  579|      0|      rt = KEYDB_RESOURCE_TYPE_KEYRING;
  580|      0|      resname += 11;
  581|      0|    }
  582|      1|  else if (strlen (resname) > 10 && !strncmp (resname, "gnupg-kbx:", 10) )
  ------------------
  |  Branch (582:12): [True: 1, False: 0]
  |  Branch (582:37): [True: 0, False: 1]
  ------------------
  583|      0|    {
  584|      0|      rt = KEYDB_RESOURCE_TYPE_KEYBOX;
  585|      0|      resname += 10;
  586|      0|    }
  587|      1|#if !defined(HAVE_DRIVE_LETTERS) && !defined(__riscos__)
  588|      1|  else if (strchr (resname, ':'))
  ------------------
  |  Branch (588:12): [True: 0, False: 1]
  ------------------
  589|      0|    {
  590|      0|      log_error ("invalid key resource URL '%s'\n", url );
  591|      0|      err = gpg_error (GPG_ERR_GENERAL);
  592|      0|      goto leave;
  593|      0|    }
  594|      1|#endif /* !HAVE_DRIVE_LETTERS && !__riscos__ */
  595|       |
  596|      1|  if (*resname != DIRSEP_C
  ------------------
  |  |  886|      1|#define DIRSEP_C '/'
  ------------------
  |  Branch (596:7): [True: 1, False: 0]
  ------------------
  597|       |#ifdef HAVE_W32_SYSTEM
  598|       |      && *resname != '/'  /* Fixme: does not handle drive letters.  */
  599|       |#endif
  600|      1|        )
  601|      1|    {
  602|       |      /* Do tilde expansion etc. */
  603|      1|      if (strchr (resname, DIRSEP_C)
  ------------------
  |  |  886|      1|#define DIRSEP_C '/'
  ------------------
  |  Branch (603:11): [True: 0, False: 1]
  ------------------
  604|       |#ifdef HAVE_W32_SYSTEM
  605|       |          || strchr (resname, '/')  /* Windows also accepts this.  */
  606|       |#endif
  607|      1|          )
  608|      0|        filename = make_filename (resname, NULL);
  609|      1|      else
  610|      1|        filename = make_filename (gnupg_homedir (), resname, NULL);
  611|      1|    }
  612|      0|  else
  613|      0|    filename = xstrdup (resname);
  ------------------
  |  |  112|      0|#define xstrdup(a)       gcry_xstrdup ((a))
  ------------------
  614|       |
  615|       |  /* See whether we can determine the filetype.  */
  616|      1|  if (rt == KEYDB_RESOURCE_TYPE_NONE)
  ------------------
  |  Branch (616:7): [True: 1, False: 0]
  ------------------
  617|      1|    {
  618|      1|      int found, openpgp_flag;
  619|      1|      int pass = 0;
  620|      1|      size_t filenamelen;
  621|       |
  622|      2|    check_again:
  623|      2|      filenamelen = strlen (filename);
  624|      2|      rt = rt_from_file (filename, &found, &openpgp_flag);
  625|      2|      if (found)
  ------------------
  |  Branch (625:11): [True: 0, False: 2]
  ------------------
  626|      0|        {
  627|       |          /* The file exists and we have the resource type in RT.
  628|       |
  629|       |             Now let us check whether in addition to the "pubring.gpg"
  630|       |             a "pubring.kbx with openpgp keys exists.  This is so that
  631|       |             GPG 2.1 will use an existing "pubring.kbx" by default iff
  632|       |             that file has been created or used by 2.1.  This check is
  633|       |             needed because after creation or use of the kbx file with
  634|       |             2.1 an older version of gpg may have created a new
  635|       |             pubring.gpg for its own use.  */
  636|      0|          if (!pass && is_default && rt == KEYDB_RESOURCE_TYPE_KEYRING
  ------------------
  |  Branch (636:15): [True: 0, False: 0]
  |  Branch (636:24): [True: 0, False: 0]
  |  Branch (636:38): [True: 0, False: 0]
  ------------------
  637|      0|              && filenamelen > 4 && !strcmp (filename+filenamelen-4, ".gpg"))
  ------------------
  |  Branch (637:18): [True: 0, False: 0]
  |  Branch (637:37): [True: 0, False: 0]
  ------------------
  638|      0|            {
  639|      0|              strcpy (filename+filenamelen-4, ".kbx");
  640|      0|              if ((rt_from_file (filename, &found, &openpgp_flag)
  ------------------
  |  Branch (640:19): [True: 0, False: 0]
  ------------------
  641|      0|                   == KEYDB_RESOURCE_TYPE_KEYBOX) && found && openpgp_flag)
  ------------------
  |  Branch (641:54): [True: 0, False: 0]
  |  Branch (641:63): [True: 0, False: 0]
  ------------------
  642|      0|                rt = KEYDB_RESOURCE_TYPE_KEYBOX;
  643|      0|              else /* Restore filename */
  644|      0|                strcpy (filename+filenamelen-4, ".gpg");
  645|      0|            }
  646|      0|	}
  647|      2|      else if (!pass && is_gpgvdef
  ------------------
  |  Branch (647:16): [True: 1, False: 1]
  |  Branch (647:25): [True: 0, False: 1]
  ------------------
  648|      2|               && filenamelen > 4 && !strcmp (filename+filenamelen-4, ".kbx"))
  ------------------
  |  Branch (648:19): [True: 0, False: 0]
  |  Branch (648:38): [True: 0, False: 0]
  ------------------
  649|      0|        {
  650|       |          /* Not found but gpgv's default "trustedkeys.kbx" file has
  651|       |             been requested.  We did not found it so now check whether
  652|       |             a "trustedkeys.gpg" file exists and use that instead.  */
  653|      0|          KeydbResourceType rttmp;
  654|       |
  655|      0|          strcpy (filename+filenamelen-4, ".gpg");
  656|      0|          rttmp = rt_from_file (filename, &found, &openpgp_flag);
  657|      0|          if (found
  ------------------
  |  Branch (657:15): [True: 0, False: 0]
  ------------------
  658|      0|              && ((rttmp == KEYDB_RESOURCE_TYPE_KEYBOX && openpgp_flag)
  ------------------
  |  Branch (658:20): [True: 0, False: 0]
  |  Branch (658:59): [True: 0, False: 0]
  ------------------
  659|      0|                  || (rttmp == KEYDB_RESOURCE_TYPE_KEYRING)))
  ------------------
  |  Branch (659:22): [True: 0, False: 0]
  ------------------
  660|      0|            rt = rttmp;
  661|      0|          else /* Restore filename */
  662|      0|            strcpy (filename+filenamelen-4, ".kbx");
  663|      0|        }
  664|      2|      else if (!pass
  ------------------
  |  Branch (664:16): [True: 1, False: 1]
  ------------------
  665|      2|               && is_default && create
  ------------------
  |  Branch (665:19): [True: 1, False: 0]
  |  Branch (665:33): [True: 1, False: 0]
  ------------------
  666|      2|               && filenamelen > 4 && !strcmp (filename+filenamelen-4, ".gpg"))
  ------------------
  |  Branch (666:19): [True: 1, False: 0]
  |  Branch (666:38): [True: 1, False: 0]
  ------------------
  667|      1|        {
  668|       |          /* The file does not exist, the default resource has been
  669|       |             requested, the file shall be created, and the file has a
  670|       |             ".gpg" suffix.  Change the suffix to ".kbx" and try once
  671|       |             more.  This way we achieve that we open an existing
  672|       |             ".gpg" keyring, but create a new keybox file with an
  673|       |             ".kbx" suffix.  */
  674|      1|          strcpy (filename+filenamelen-4, ".kbx");
  675|      1|          pass++;
  676|      1|          goto check_again;
  677|      1|        }
  678|      1|      else /* No file yet: create keybox. */
  679|      1|        rt = KEYDB_RESOURCE_TYPE_KEYBOX;
  680|      2|    }
  681|       |
  682|      1|  switch (rt)
  683|      1|    {
  684|      0|    case KEYDB_RESOURCE_TYPE_NONE:
  ------------------
  |  Branch (684:5): [True: 0, False: 1]
  ------------------
  685|      0|      log_error ("unknown type of key resource '%s'\n", url );
  686|      0|      err = gpg_error (GPG_ERR_GENERAL);
  687|      0|      goto leave;
  688|       |
  689|      0|    case KEYDB_RESOURCE_TYPE_KEYRING:
  ------------------
  |  Branch (689:5): [True: 0, False: 1]
  ------------------
  690|      0|      err = maybe_create_keyring_or_box (filename, 0, create);
  691|      0|      if (err)
  ------------------
  |  Branch (691:11): [True: 0, False: 0]
  ------------------
  692|      0|        goto leave;
  693|       |
  694|      0|      if (keyring_register_filename (filename, read_only, &token))
  ------------------
  |  Branch (694:11): [True: 0, False: 0]
  ------------------
  695|      0|        {
  696|      0|          if (used_resources >= MAX_KEYDB_RESOURCES)
  ------------------
  |  |   36|      0|#define MAX_KEYDB_RESOURCES 40
  ------------------
  |  Branch (696:15): [True: 0, False: 0]
  ------------------
  697|      0|            err = gpg_error (GPG_ERR_RESOURCE_LIMIT);
  698|      0|          else
  699|      0|            {
  700|      0|              if ((flags & KEYDB_RESOURCE_FLAG_PRIMARY))
  ------------------
  |  |  211|      0|#define KEYDB_RESOURCE_FLAG_PRIMARY  2  /* The primary resource.  */
  ------------------
  |  Branch (700:19): [True: 0, False: 0]
  ------------------
  701|      0|                primary_keydb = token;
  702|      0|              all_resources[used_resources].type = rt;
  703|      0|              all_resources[used_resources].u.kr = NULL; /* Not used here */
  704|      0|              all_resources[used_resources].token = token;
  705|      0|              used_resources++;
  706|      0|            }
  707|      0|        }
  708|      0|      else
  709|      0|        {
  710|       |          /* This keyring was already registered, so ignore it.
  711|       |             However, we can still mark it as primary even if it was
  712|       |             already registered.  */
  713|      0|          if ((flags & KEYDB_RESOURCE_FLAG_PRIMARY))
  ------------------
  |  |  211|      0|#define KEYDB_RESOURCE_FLAG_PRIMARY  2  /* The primary resource.  */
  ------------------
  |  Branch (713:15): [True: 0, False: 0]
  ------------------
  714|      0|            primary_keydb = token;
  715|      0|        }
  716|      0|      break;
  717|       |
  718|      1|    case KEYDB_RESOURCE_TYPE_KEYBOX:
  ------------------
  |  Branch (718:5): [True: 1, False: 0]
  ------------------
  719|      1|      {
  720|      1|        err = maybe_create_keyring_or_box (filename, 1, create);
  721|      1|        if (err)
  ------------------
  |  Branch (721:13): [True: 0, False: 1]
  ------------------
  722|      0|          goto leave;
  723|       |
  724|      1|        err = keybox_register_file (filename, 0, &token);
  725|      1|        if (!err)
  ------------------
  |  Branch (725:13): [True: 1, False: 0]
  ------------------
  726|      1|          {
  727|      1|            if (used_resources >= MAX_KEYDB_RESOURCES)
  ------------------
  |  |   36|      1|#define MAX_KEYDB_RESOURCES 40
  ------------------
  |  Branch (727:17): [True: 0, False: 1]
  ------------------
  728|      0|              err = gpg_error (GPG_ERR_RESOURCE_LIMIT);
  729|      1|            else
  730|      1|              {
  731|      1|                KEYBOX_HANDLE kbxhd;
  732|       |
  733|      1|                if ((flags & KEYDB_RESOURCE_FLAG_PRIMARY))
  ------------------
  |  |  211|      1|#define KEYDB_RESOURCE_FLAG_PRIMARY  2  /* The primary resource.  */
  ------------------
  |  Branch (733:21): [True: 0, False: 1]
  ------------------
  734|      0|                  primary_keydb = token;
  735|      1|                all_resources[used_resources].type = rt;
  736|      1|                all_resources[used_resources].u.kb = NULL; /* Not used here */
  737|      1|                all_resources[used_resources].token = token;
  738|       |
  739|       |                /* Do a compress run if needed and no other user is
  740|       |                 * currently using the keybox. */
  741|      1|                kbxhd = keybox_new_openpgp (token, 0);
  742|      1|                if (kbxhd)
  ------------------
  |  Branch (742:21): [True: 1, False: 0]
  ------------------
  743|      1|                  {
  744|      1|                    if (!keybox_lock (kbxhd, 1, 0))
  ------------------
  |  Branch (744:25): [True: 1, False: 0]
  ------------------
  745|      1|                      {
  746|      1|                        keybox_compress (kbxhd);
  747|      1|                        keybox_lock (kbxhd, 0, 0);
  748|      1|                      }
  749|       |
  750|      1|                    keybox_release (kbxhd);
  751|      1|                  }
  752|       |
  753|      1|                used_resources++;
  754|      1|              }
  755|      1|          }
  756|      0|        else if (gpg_err_code (err) == GPG_ERR_EEXIST)
  ------------------
  |  Branch (756:18): [True: 0, False: 0]
  ------------------
  757|      0|          {
  758|       |            /* Already registered.  We will mark it as the primary key
  759|       |               if requested.  */
  760|      0|            if ((flags & KEYDB_RESOURCE_FLAG_PRIMARY))
  ------------------
  |  |  211|      0|#define KEYDB_RESOURCE_FLAG_PRIMARY  2  /* The primary resource.  */
  ------------------
  |  Branch (760:17): [True: 0, False: 0]
  ------------------
  761|      0|              primary_keydb = token;
  762|      0|          }
  763|      1|      }
  764|      0|      break;
  765|       |
  766|      0|      default:
  ------------------
  |  Branch (766:7): [True: 0, False: 1]
  ------------------
  767|      0|	log_error ("resource type of '%s' not supported\n", url);
  768|      0|	err = gpg_error (GPG_ERR_GENERAL);
  769|      0|	goto leave;
  770|      1|    }
  771|       |
  772|       |  /* fixme: check directory permissions and print a warning */
  773|       |
  774|      1| leave:
  775|      1|  if (err)
  ------------------
  |  Branch (775:7): [True: 0, False: 1]
  ------------------
  776|      0|    {
  777|      0|      log_error (_("keyblock resource '%s': %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  778|      0|                 filename, gpg_strerror (err));
  779|      0|      write_status_error ("add_keyblock_resource", err);
  780|      0|    }
  781|      1|  else
  782|      1|    any_registered = 1;
  783|      1|  xfree (filename);
  ------------------
  |  |  104|      1|#define xfree(a)         gcry_free ((a))
  ------------------
  784|      1|  return err;
  785|      1|}
internal_keydb_init:
  818|  4.50k|{
  819|  4.50k|  gpg_error_t err = 0;
  820|  4.50k|  int i, j;
  821|  4.50k|  int die = 0;
  822|  4.50k|  int reterrno;
  823|       |
  824|  4.50k|  log_assert (!hd->use_keyboxd);
  825|      0|  hd->found = -1;
  826|  4.50k|  hd->saved_found = -1;
  827|  4.50k|  hd->is_reset = 1;
  828|       |
  829|  4.50k|  log_assert (used_resources <= MAX_KEYDB_RESOURCES);
  830|  9.01k|  for (i=j=0; ! die && i < used_resources; i++)
  ------------------
  |  Branch (830:15): [True: 9.01k, False: 0]
  |  Branch (830:24): [True: 4.50k, False: 4.50k]
  ------------------
  831|  4.50k|    {
  832|  4.50k|      switch (all_resources[i].type)
  ------------------
  |  Branch (832:15): [True: 0, False: 4.50k]
  ------------------
  833|  4.50k|        {
  834|      0|        case KEYDB_RESOURCE_TYPE_NONE: /* ignore */
  ------------------
  |  Branch (834:9): [True: 0, False: 4.50k]
  ------------------
  835|      0|          break;
  836|      0|        case KEYDB_RESOURCE_TYPE_KEYRING:
  ------------------
  |  Branch (836:9): [True: 0, False: 4.50k]
  ------------------
  837|      0|          hd->active[j].type   = all_resources[i].type;
  838|      0|          hd->active[j].token  = all_resources[i].token;
  839|      0|          hd->active[j].u.kr = keyring_new (all_resources[i].token);
  840|      0|          if (!hd->active[j].u.kr)
  ------------------
  |  Branch (840:15): [True: 0, False: 0]
  ------------------
  841|      0|            {
  842|      0|              reterrno = errno;
  843|      0|              die = 1;
  844|      0|            }
  845|      0|          j++;
  846|      0|          break;
  847|  4.50k|        case KEYDB_RESOURCE_TYPE_KEYBOX:
  ------------------
  |  Branch (847:9): [True: 4.50k, False: 0]
  ------------------
  848|  4.50k|          hd->active[j].type   = all_resources[i].type;
  849|  4.50k|          hd->active[j].token  = all_resources[i].token;
  850|  4.50k|          hd->active[j].u.kb   = keybox_new_openpgp (all_resources[i].token, 0);
  851|  4.50k|          if (!hd->active[j].u.kb)
  ------------------
  |  Branch (851:15): [True: 0, False: 4.50k]
  ------------------
  852|      0|            {
  853|      0|              reterrno = errno;
  854|      0|              die = 1;
  855|      0|            }
  856|  4.50k|          j++;
  857|  4.50k|          break;
  858|  4.50k|        }
  859|  4.50k|    }
  860|  4.50k|  hd->used = j;
  861|       |
  862|  4.50k|  active_handles++;
  863|  4.50k|  keydb_stats.handles++;
  864|       |
  865|  4.50k|  if (die)
  ------------------
  |  Branch (865:7): [True: 0, False: 4.50k]
  ------------------
  866|      0|    err = gpg_error_from_errno (reterrno);
  867|       |
  868|  4.50k|   return err;
  869|  4.50k|}
internal_keydb_deinit:
  876|  4.50k|{
  877|  4.50k|  int i;
  878|       |
  879|  4.50k|  log_assert (!hd->use_keyboxd);
  880|       |
  881|      0|  log_assert (active_handles > 0);
  882|      0|  active_handles--;
  883|       |
  884|  4.50k|  hd->keep_lock = 0;
  885|  4.50k|  unlock_all (hd);
  886|  9.01k|  for (i=0; i < hd->used; i++)
  ------------------
  |  Branch (886:13): [True: 4.50k, False: 4.50k]
  ------------------
  887|  4.50k|    {
  888|  4.50k|      switch (hd->active[i].type)
  ------------------
  |  Branch (888:15): [True: 0, False: 4.50k]
  ------------------
  889|  4.50k|        {
  890|      0|        case KEYDB_RESOURCE_TYPE_NONE:
  ------------------
  |  Branch (890:9): [True: 0, False: 4.50k]
  ------------------
  891|      0|          break;
  892|      0|        case KEYDB_RESOURCE_TYPE_KEYRING:
  ------------------
  |  Branch (892:9): [True: 0, False: 4.50k]
  ------------------
  893|      0|          keyring_release (hd->active[i].u.kr);
  894|      0|          break;
  895|  4.50k|        case KEYDB_RESOURCE_TYPE_KEYBOX:
  ------------------
  |  Branch (895:9): [True: 4.50k, False: 0]
  ------------------
  896|  4.50k|          keybox_release (hd->active[i].u.kb);
  897|  4.50k|          break;
  898|  4.50k|        }
  899|  4.50k|    }
  900|       |
  901|  4.50k|  keyblock_cache_clear (hd);
  902|  4.50k|}
internal_keydb_search_reset:
 1682|  11.4k|{
 1683|  11.4k|  gpg_error_t rc = 0;
 1684|  11.4k|  int i;
 1685|       |
 1686|  11.4k|  log_assert (!hd->use_keyboxd);
 1687|       |
 1688|      0|  keyblock_cache_clear (hd);
 1689|       |
 1690|  11.4k|  hd->skipped_long_blobs = 0;
 1691|  11.4k|  hd->current = 0;
 1692|  11.4k|  hd->found = -1;
 1693|       |  /* Now reset all resources.  */
 1694|  22.9k|  for (i=0; !rc && i < hd->used; i++)
  ------------------
  |  Branch (1694:13): [True: 22.9k, False: 0]
  |  Branch (1694:20): [True: 11.4k, False: 11.4k]
  ------------------
 1695|  11.4k|    {
 1696|  11.4k|      switch (hd->active[i].type)
  ------------------
  |  Branch (1696:15): [True: 0, False: 11.4k]
  ------------------
 1697|  11.4k|        {
 1698|      0|        case KEYDB_RESOURCE_TYPE_NONE:
  ------------------
  |  Branch (1698:9): [True: 0, False: 11.4k]
  ------------------
 1699|      0|          break;
 1700|      0|        case KEYDB_RESOURCE_TYPE_KEYRING:
  ------------------
  |  Branch (1700:9): [True: 0, False: 11.4k]
  ------------------
 1701|      0|          rc = keyring_search_reset (hd->active[i].u.kr);
 1702|      0|          break;
 1703|  11.4k|        case KEYDB_RESOURCE_TYPE_KEYBOX:
  ------------------
  |  Branch (1703:9): [True: 11.4k, False: 0]
  ------------------
 1704|  11.4k|          rc = keybox_search_reset (hd->active[i].u.kb);
 1705|  11.4k|          break;
 1706|  11.4k|        }
 1707|  11.4k|    }
 1708|  11.4k|  hd->is_reset = 1;
 1709|  11.4k|  if (!rc)
  ------------------
  |  Branch (1709:7): [True: 11.4k, False: 0]
  ------------------
 1710|  11.4k|    keydb_stats.search_resets++;
 1711|  11.4k|  return rc;
 1712|  11.4k|}
internal_keydb_search:
 1737|  16.0k|{
 1738|  16.0k|  gpg_error_t rc;
 1739|  16.0k|  int was_reset = hd->is_reset;
 1740|       |  /* If an entry is already in the cache, then don't add it again.  */
 1741|  16.0k|  int already_in_cache = 0;
 1742|  16.0k|  int fprlen;
 1743|       |
 1744|  16.0k|  log_assert (!hd->use_keyboxd);
 1745|       |
 1746|  16.0k|  if (!any_registered)
  ------------------
  |  Branch (1746:7): [True: 0, False: 16.0k]
  ------------------
 1747|      0|    {
 1748|      0|      write_status_error ("keydb_search", gpg_error (GPG_ERR_KEYRING_OPEN));
 1749|      0|      return gpg_error (GPG_ERR_NOT_FOUND);
 1750|      0|    }
 1751|       |
 1752|  16.0k|  if (ndesc == 1 && desc[0].mode == KEYDB_SEARCH_MODE_LONG_KID
  ------------------
  |  Branch (1752:7): [True: 16.0k, False: 0]
  |  Branch (1752:21): [True: 12.5k, False: 3.41k]
  ------------------
 1753|  16.0k|      && (already_in_cache = kid_not_found_p (desc[0].u.kid)) == 1 )
  ------------------
  |  Branch (1753:10): [True: 11.9k, False: 684]
  ------------------
 1754|  11.9k|    {
 1755|  11.9k|      if (DBG_CLOCK)
  ------------------
  |  |  356|  11.9k|#define DBG_CLOCK   (opt.debug & DBG_CLOCK_VALUE)
  |  |  ------------------
  |  |  |  |  343|  11.9k|#define DBG_CLOCK_VALUE   4096
  |  |  ------------------
  |  |  |  Branch (356:21): [True: 0, False: 11.9k]
  |  |  ------------------
  ------------------
 1756|      0|        log_clock ("%s leave (not found, cached)", __func__);
 1757|  11.9k|      keydb_stats.notfound_cached++;
 1758|  11.9k|      return gpg_error (GPG_ERR_NOT_FOUND);
 1759|  11.9k|    }
 1760|       |
 1761|       |  /* NB: If one of the exact search modes below is used in a loop to
 1762|       |     walk over all keys (with the same fingerprint) the caching must
 1763|       |     have been disabled for the handle.  */
 1764|  4.09k|  if (desc[0].mode == KEYDB_SEARCH_MODE_FPR)
  ------------------
  |  Branch (1764:7): [True: 3.40k, False: 685]
  ------------------
 1765|  3.40k|    fprlen = desc[0].fprlen;
 1766|    685|  else
 1767|    685|    fprlen = 0;
 1768|       |
 1769|  4.09k|  if (!hd->no_caching
  ------------------
  |  Branch (1769:7): [True: 4.09k, False: 0]
  ------------------
 1770|  4.09k|      && ndesc == 1
  ------------------
  |  Branch (1770:10): [True: 4.09k, False: 0]
  ------------------
 1771|  4.09k|      && fprlen
  ------------------
  |  Branch (1771:10): [True: 3.40k, False: 685]
  ------------------
 1772|  4.09k|      && hd->keyblock_cache.state == KEYBLOCK_CACHE_FILLED
  ------------------
  |  Branch (1772:10): [True: 0, False: 3.40k]
  ------------------
 1773|  4.09k|      && hd->keyblock_cache.fprlen == fprlen
  ------------------
  |  Branch (1773:10): [True: 0, False: 0]
  ------------------
 1774|  4.09k|      && !memcmp (hd->keyblock_cache.fpr, desc[0].u.fpr, fprlen)
  ------------------
  |  Branch (1774:10): [True: 0, False: 0]
  ------------------
 1775|       |      /* Make sure the current file position occurs before the cached
 1776|       |         result to avoid an infinite loop.  */
 1777|  4.09k|      && (hd->current < hd->keyblock_cache.resource
  ------------------
  |  Branch (1777:11): [True: 0, False: 0]
  ------------------
 1778|      0|          || (hd->current == hd->keyblock_cache.resource
  ------------------
  |  Branch (1778:15): [True: 0, False: 0]
  ------------------
 1779|      0|              && (keybox_offset (hd->active[hd->current].u.kb)
  ------------------
  |  Branch (1779:18): [True: 0, False: 0]
  ------------------
 1780|      0|                  <= hd->keyblock_cache.offset))))
 1781|      0|    {
 1782|       |      /* (DESCINDEX is already set).  */
 1783|      0|      if (DBG_CLOCK)
  ------------------
  |  |  356|      0|#define DBG_CLOCK   (opt.debug & DBG_CLOCK_VALUE)
  |  |  ------------------
  |  |  |  |  343|      0|#define DBG_CLOCK_VALUE   4096
  |  |  ------------------
  |  |  |  Branch (356:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1784|      0|        log_clock ("%s leave (cached)", __func__);
 1785|       |
 1786|      0|      hd->current = hd->keyblock_cache.resource;
 1787|       |      /* HD->KEYBLOCK_CACHE.OFFSET is the last byte in the record.
 1788|       |         Seek just beyond that.  */
 1789|      0|      keybox_seek (hd->active[hd->current].u.kb, hd->keyblock_cache.offset + 1);
 1790|      0|      keydb_stats.found_cached++;
 1791|      0|      return 0;
 1792|      0|    }
 1793|       |
 1794|  4.09k|  rc = -1;
 1795|  8.18k|  while ((rc == -1 || gpg_err_code (rc) == GPG_ERR_EOF)
  ------------------
  |  Branch (1795:11): [True: 8.18k, False: 0]
  |  Branch (1795:23): [True: 0, False: 0]
  ------------------
 1796|  8.18k|         && hd->current >= 0 && hd->current < hd->used)
  ------------------
  |  Branch (1796:13): [True: 8.18k, False: 0]
  |  Branch (1796:33): [True: 4.09k, False: 4.09k]
  ------------------
 1797|  4.09k|    {
 1798|  4.09k|      if (DBG_LOOKUP)
  ------------------
  |  |  357|  4.09k|#define DBG_LOOKUP  (opt.debug & DBG_LOOKUP_VALUE)
  |  |  ------------------
  |  |  |  |  344|  4.09k|#define DBG_LOOKUP_VALUE  8192	/* debug the key lookup */
  |  |  ------------------
  |  |  |  Branch (357:21): [True: 0, False: 4.09k]
  |  |  ------------------
  ------------------
 1799|      0|        log_debug ("%s: searching %s (resource %d of %d)\n",
 1800|      0|                   __func__,
 1801|      0|                   hd->active[hd->current].type == KEYDB_RESOURCE_TYPE_KEYRING
  ------------------
  |  Branch (1801:20): [True: 0, False: 0]
  ------------------
 1802|      0|                   ? "keyring"
 1803|      0|                   : (hd->active[hd->current].type == KEYDB_RESOURCE_TYPE_KEYBOX
  ------------------
  |  Branch (1803:23): [True: 0, False: 0]
  ------------------
 1804|      0|                      ? "keybox" : "unknown type"),
 1805|      0|                   hd->current, hd->used);
 1806|       |
 1807|  4.09k|       switch (hd->active[hd->current].type)
  ------------------
  |  Branch (1807:16): [True: 0, False: 4.09k]
  ------------------
 1808|  4.09k|        {
 1809|      0|        case KEYDB_RESOURCE_TYPE_NONE:
  ------------------
  |  Branch (1809:9): [True: 0, False: 4.09k]
  ------------------
 1810|      0|          BUG(); /* we should never see it here */
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1811|      0|          break;
 1812|      0|        case KEYDB_RESOURCE_TYPE_KEYRING:
  ------------------
  |  Branch (1812:9): [True: 0, False: 4.09k]
  ------------------
 1813|      0|          rc = keyring_search (hd->active[hd->current].u.kr, desc,
 1814|      0|                               ndesc, descindex, 1);
 1815|      0|          break;
 1816|  4.09k|        case KEYDB_RESOURCE_TYPE_KEYBOX:
  ------------------
  |  Branch (1816:9): [True: 4.09k, False: 0]
  ------------------
 1817|  4.09k|          do
 1818|  4.09k|            rc = keybox_search (hd->active[hd->current].u.kb, desc,
 1819|  4.09k|                                ndesc, KEYBOX_BLOBTYPE_PGP,
 1820|  4.09k|                                descindex, &hd->skipped_long_blobs);
 1821|  4.09k|          while (rc == GPG_ERR_LEGACY_KEY);
  ------------------
  |  Branch (1821:18): [True: 0, False: 4.09k]
  ------------------
 1822|  4.09k|          break;
 1823|  4.09k|        }
 1824|       |
 1825|  4.09k|      if (DBG_LOOKUP)
  ------------------
  |  |  357|  4.09k|#define DBG_LOOKUP  (opt.debug & DBG_LOOKUP_VALUE)
  |  |  ------------------
  |  |  |  |  344|  4.09k|#define DBG_LOOKUP_VALUE  8192	/* debug the key lookup */
  |  |  ------------------
  |  |  |  Branch (357:21): [True: 0, False: 4.09k]
  |  |  ------------------
  ------------------
 1826|      0|        log_debug ("%s: searched %s (resource %d of %d) => %s\n",
 1827|      0|                   __func__,
 1828|      0|                   hd->active[hd->current].type == KEYDB_RESOURCE_TYPE_KEYRING
  ------------------
  |  Branch (1828:20): [True: 0, False: 0]
  ------------------
 1829|      0|                   ? "keyring"
 1830|      0|                   : (hd->active[hd->current].type == KEYDB_RESOURCE_TYPE_KEYBOX
  ------------------
  |  Branch (1830:23): [True: 0, False: 0]
  ------------------
 1831|      0|                      ? "keybox" : "unknown type"),
 1832|      0|                   hd->current, hd->used,
 1833|      0|                   rc == -1 ? "EOF" : gpg_strerror (rc));
  ------------------
  |  Branch (1833:20): [True: 0, False: 0]
  ------------------
 1834|       |
 1835|  4.09k|      if (rc == -1 || gpg_err_code (rc) == GPG_ERR_EOF)
  ------------------
  |  Branch (1835:11): [True: 4.09k, False: 0]
  |  Branch (1835:23): [True: 0, False: 0]
  ------------------
 1836|  4.09k|        {
 1837|       |          /* EOF -> switch to next resource */
 1838|  4.09k|          hd->current++;
 1839|  4.09k|        }
 1840|      0|      else if (!rc)
  ------------------
  |  Branch (1840:16): [True: 0, False: 0]
  ------------------
 1841|      0|        hd->found = hd->current;
 1842|  4.09k|    }
 1843|  4.09k|  hd->is_reset = 0;
 1844|       |
 1845|  4.09k|  rc = ((rc == -1 || gpg_err_code (rc) == GPG_ERR_EOF)
  ------------------
  |  Branch (1845:10): [True: 4.09k, False: 0]
  |  Branch (1845:22): [True: 0, False: 0]
  ------------------
 1846|  4.09k|        ? gpg_error (GPG_ERR_NOT_FOUND)
 1847|  4.09k|        : rc);
 1848|       |
 1849|  4.09k|  keyblock_cache_clear (hd);
 1850|  4.09k|  if (!hd->no_caching
  ------------------
  |  Branch (1850:7): [True: 4.09k, False: 0]
  ------------------
 1851|  4.09k|      && !rc
  ------------------
  |  Branch (1851:10): [True: 0, False: 4.09k]
  ------------------
 1852|  4.09k|      && ndesc == 1
  ------------------
  |  Branch (1852:10): [True: 0, False: 0]
  ------------------
 1853|  4.09k|      && fprlen
  ------------------
  |  Branch (1853:10): [True: 0, False: 0]
  ------------------
 1854|  4.09k|      && hd->active[hd->current].type == KEYDB_RESOURCE_TYPE_KEYBOX)
  ------------------
  |  Branch (1854:10): [True: 0, False: 0]
  ------------------
 1855|      0|    {
 1856|      0|      hd->keyblock_cache.state = KEYBLOCK_CACHE_PREPARED;
 1857|      0|      hd->keyblock_cache.resource = hd->current;
 1858|       |      /* The current offset is at the start of the next record.  Since
 1859|       |         a record is at least 1 byte, we just use offset - 1, which is
 1860|       |         within the record.  */
 1861|      0|      hd->keyblock_cache.offset
 1862|      0|        = keybox_offset (hd->active[hd->current].u.kb) - 1;
 1863|      0|      memcpy (hd->keyblock_cache.fpr, desc[0].u.fpr, fprlen);
 1864|      0|      hd->keyblock_cache.fprlen = fprlen;
 1865|      0|    }
 1866|       |
 1867|  4.09k|  if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND
  ------------------
  |  Branch (1867:7): [True: 4.09k, False: 0]
  ------------------
 1868|  4.09k|      && ndesc == 1
  ------------------
  |  Branch (1868:10): [True: 4.09k, False: 0]
  ------------------
 1869|  4.09k|      && desc[0].mode == KEYDB_SEARCH_MODE_LONG_KID
  ------------------
  |  Branch (1869:10): [True: 684, False: 3.41k]
  ------------------
 1870|  4.09k|      && was_reset
  ------------------
  |  Branch (1870:10): [True: 684, False: 0]
  ------------------
 1871|  4.09k|      && !already_in_cache)
  ------------------
  |  Branch (1871:10): [True: 684, False: 0]
  ------------------
 1872|    684|    kid_not_found_insert (desc[0].u.kid);
 1873|       |
 1874|  4.09k|  if (!rc)
  ------------------
  |  Branch (1874:7): [True: 0, False: 4.09k]
  ------------------
 1875|      0|    keydb_stats.found++;
 1876|  4.09k|  else
 1877|  4.09k|    keydb_stats.notfound++;
 1878|  4.09k|  return rc;
 1879|  4.09k|}
keydb_search_first:
 1889|      1|{
 1890|      1|  gpg_error_t err;
 1891|      1|  KEYDB_SEARCH_DESC desc;
 1892|       |
 1893|      1|  err = keydb_search_reset (hd);
 1894|      1|  if (err)
  ------------------
  |  Branch (1894:7): [True: 0, False: 1]
  ------------------
 1895|      0|    return err;
 1896|       |
 1897|      1|  memset (&desc, 0, sizeof desc);
 1898|      1|  desc.mode = KEYDB_SEARCH_MODE_FIRST;
 1899|      1|  return keydb_search (hd, &desc, 1, NULL);
 1900|      1|}
keydb.c:rt_from_file:
  418|      2|{
  419|      2|  u32 magic;
  420|      2|  unsigned char verbuf[4];
  421|      2|  estream_t fp;
  422|      2|  KeydbResourceType rt = KEYDB_RESOURCE_TYPE_NONE;
  423|       |
  424|      2|  *r_found = *r_openpgp = 0;
  425|      2|  fp = es_fopen (filename, "rb");
  426|      2|  if (fp)
  ------------------
  |  Branch (426:7): [True: 0, False: 2]
  ------------------
  427|      0|    {
  428|      0|      *r_found = 1;
  429|       |
  430|      0|      if (es_fread (&magic, 4, 1, fp) == 1 )
  ------------------
  |  Branch (430:11): [True: 0, False: 0]
  ------------------
  431|      0|        {
  432|      0|          if (magic == 0x13579ace || magic == 0xce9a5713)
  ------------------
  |  Branch (432:15): [True: 0, False: 0]
  |  Branch (432:38): [True: 0, False: 0]
  ------------------
  433|      0|            ; /* GDBM magic - not anymore supported. */
  434|      0|          else if (es_fread (&verbuf, 4, 1, fp) == 1
  ------------------
  |  Branch (434:20): [True: 0, False: 0]
  ------------------
  435|      0|                   && verbuf[0] == 1
  ------------------
  |  Branch (435:23): [True: 0, False: 0]
  ------------------
  436|      0|                   && es_fread (&magic, 4, 1, fp) == 1
  ------------------
  |  Branch (436:23): [True: 0, False: 0]
  ------------------
  437|      0|                   && !memcmp (&magic, "KBXf", 4))
  ------------------
  |  Branch (437:23): [True: 0, False: 0]
  ------------------
  438|      0|            {
  439|      0|              if ((verbuf[3] & 0x02))
  ------------------
  |  Branch (439:19): [True: 0, False: 0]
  ------------------
  440|      0|                *r_openpgp = 1;
  441|      0|              rt = KEYDB_RESOURCE_TYPE_KEYBOX;
  442|      0|            }
  443|      0|          else
  444|      0|            rt = KEYDB_RESOURCE_TYPE_KEYRING;
  445|      0|        }
  446|      0|      else /* Maybe empty: assume keyring. */
  447|      0|        rt = KEYDB_RESOURCE_TYPE_KEYRING;
  448|       |
  449|      0|      es_fclose (fp);
  450|      0|    }
  451|       |
  452|      2|  return rt;
  453|      2|}
keydb.c:maybe_create_keyring_or_box:
  214|      1|{
  215|      1|  gpg_err_code_t ec;
  216|      1|  dotlock_t lockhd = NULL;
  217|      1|  IOBUF iobuf;
  218|      1|  int rc;
  219|      1|  mode_t oldmask;
  220|      1|  char *last_slash_in_filename;
  221|      1|  char *bak_fname = NULL;
  222|      1|  char *tmp_fname = NULL;
  223|      1|  int save_slash;
  224|       |
  225|       |  /* A quick test whether the filename already exists. */
  226|      1|  if (!gnupg_access (filename, F_OK))
  ------------------
  |  Branch (226:7): [True: 0, False: 1]
  ------------------
  227|      0|    return !gnupg_access (filename, R_OK)? 0 : gpg_error (GPG_ERR_EACCES);
  ------------------
  |  Branch (227:12): [True: 0, False: 0]
  ------------------
  228|       |
  229|       |  /* If we don't want to create a new file at all, there is no need to
  230|       |     go any further - bail out right here.  */
  231|      1|  if (!force_create)
  ------------------
  |  Branch (231:7): [True: 0, False: 1]
  ------------------
  232|      0|    return gpg_error (GPG_ERR_ENOENT);
  233|       |
  234|       |  /* First of all we try to create the home directory.  Note, that we
  235|       |     don't do any locking here because any sane application of gpg
  236|       |     would create the home directory by itself and not rely on gpg's
  237|       |     tricky auto-creation which is anyway only done for certain home
  238|       |     directory name pattern. */
  239|      1|  last_slash_in_filename = strrchr (filename, DIRSEP_C);
  ------------------
  |  |  886|      1|#define DIRSEP_C '/'
  ------------------
  240|       |#if HAVE_W32_SYSTEM
  241|       |  {
  242|       |    /* Windows may either have a slash or a backslash.  Take care of it.  */
  243|       |    char *p = strrchr (filename, '/');
  244|       |    if (!last_slash_in_filename || p > last_slash_in_filename)
  245|       |      last_slash_in_filename = p;
  246|       |  }
  247|       |#endif /*HAVE_W32_SYSTEM*/
  248|      1|  if (!last_slash_in_filename)
  ------------------
  |  Branch (248:7): [True: 0, False: 1]
  ------------------
  249|      0|    return gpg_error (GPG_ERR_ENOENT);  /* No slash at all - should
  250|       |                                           not happen though.  */
  251|      1|  save_slash = *last_slash_in_filename;
  252|      1|  *last_slash_in_filename = 0;
  253|      1|  if (gnupg_access(filename, F_OK))
  ------------------
  |  Branch (253:7): [True: 0, False: 1]
  ------------------
  254|      0|    {
  255|      0|      static int tried;
  256|       |
  257|      0|      if (!tried)
  ------------------
  |  Branch (257:11): [True: 0, False: 0]
  ------------------
  258|      0|        {
  259|      0|          tried = 1;
  260|      0|          try_make_homedir (filename);
  261|      0|        }
  262|      0|      if ((ec = gnupg_access (filename, F_OK)))
  ------------------
  |  Branch (262:11): [True: 0, False: 0]
  ------------------
  263|      0|        {
  264|      0|          rc = gpg_error (ec);
  265|      0|          *last_slash_in_filename = save_slash;
  266|      0|          goto leave;
  267|      0|        }
  268|      0|    }
  269|      1|  *last_slash_in_filename = save_slash;
  270|       |
  271|       |  /* To avoid races with other instances of gpg trying to create or
  272|       |     update the keyring (it is removed during an update for a short
  273|       |     time), we do the next stuff in a locked state. */
  274|      1|  lockhd = dotlock_create (filename, 0);
  275|      1|  if (!lockhd)
  ------------------
  |  Branch (275:7): [True: 0, False: 1]
  ------------------
  276|      0|    {
  277|      0|      rc = gpg_error_from_syserror ();
  278|       |      /* A reason for this to fail is that the directory is not
  279|       |         writable. However, this whole locking stuff does not make
  280|       |         sense if this is the case. An empty non-writable directory
  281|       |         with no keyring is not really useful at all. */
  282|      0|      if (opt.verbose)
  ------------------
  |  Branch (282:11): [True: 0, False: 0]
  ------------------
  283|      0|        log_info ("can't allocate lock for '%s': %s\n",
  284|      0|                  filename, gpg_strerror (rc));
  285|       |
  286|      0|      if (!force_create)
  ------------------
  |  Branch (286:11): [True: 0, False: 0]
  ------------------
  287|      0|        return gpg_error (GPG_ERR_ENOENT);  /* Won't happen.  */
  288|      0|      else
  289|      0|        return rc;
  290|      0|    }
  291|       |
  292|      1|  if ( dotlock_take (lockhd, -1) )
  ------------------
  |  Branch (292:8): [True: 0, False: 1]
  ------------------
  293|      0|    {
  294|      0|      rc = gpg_error_from_syserror ();
  295|       |      /* This is something bad.  Probably a stale lockfile.  */
  296|      0|      log_info ("can't lock '%s': %s\n", filename, gpg_strerror (rc));
  297|      0|      goto leave;
  298|      0|    }
  299|       |
  300|       |  /* Now the real test while we are locked. */
  301|       |
  302|       |  /* Gpg either uses pubring.gpg or pubring.kbx and thus different
  303|       |   * lock files.  Now, when one gpg process is updating a pubring.gpg
  304|       |   * and thus holding the corresponding lock, a second gpg process may
  305|       |   * get to here at the time between the two rename operation used by
  306|       |   * the first process to update pubring.gpg.  The lock taken above
  307|       |   * may not protect the second process if it tries to create a
  308|       |   * pubring.kbx file which would be protected by a different lock
  309|       |   * file.
  310|       |   *
  311|       |   * We can detect this case by checking that the two temporary files
  312|       |   * used by the update code exist at the same time.  In that case we
  313|       |   * do not create a new file but act as if FORCE_CREATE has not been
  314|       |   * given.  Obviously there is a race between our two checks but the
  315|       |   * worst thing is that we won't create a new file, which is better
  316|       |   * than to accidentally creating one.  */
  317|      1|  rc = keybox_tmp_names (filename, is_box, &bak_fname, &tmp_fname);
  318|      1|  if (rc)
  ------------------
  |  Branch (318:7): [True: 0, False: 1]
  ------------------
  319|      0|    goto leave;
  320|       |
  321|      1|  if (!gnupg_access (filename, F_OK))
  ------------------
  |  Branch (321:7): [True: 0, False: 1]
  ------------------
  322|      0|    {
  323|      0|      rc = 0;  /* Okay, we may access the file now.  */
  324|      0|      goto leave;
  325|      0|    }
  326|      1|  if (!gnupg_access (bak_fname, F_OK) && !gnupg_access (tmp_fname, F_OK))
  ------------------
  |  Branch (326:7): [True: 0, False: 1]
  |  Branch (326:42): [True: 0, False: 0]
  ------------------
  327|      0|    {
  328|       |      /* Very likely another process is updating a pubring.gpg and we
  329|       |         should not create a pubring.kbx.  */
  330|      0|      rc = gpg_error (GPG_ERR_ENOENT);
  331|      0|      goto leave;
  332|      0|    }
  333|       |
  334|       |
  335|       |  /* The file does not yet exist, create it now. */
  336|      1|  oldmask = umask (077);
  337|      1|  if (is_secured_filename (filename))
  ------------------
  |  Branch (337:7): [True: 0, False: 1]
  ------------------
  338|      0|    {
  339|      0|      iobuf = NULL;
  340|      0|      gpg_err_set_errno (EPERM);
  341|      0|    }
  342|      1|  else
  343|      1|    iobuf = iobuf_create (filename, 0);
  344|      1|  umask (oldmask);
  345|      1|  if (!iobuf)
  ------------------
  |  Branch (345:7): [True: 0, False: 1]
  ------------------
  346|      0|    {
  347|      0|      rc = gpg_error_from_syserror ();
  348|      0|      if (is_box)
  ------------------
  |  Branch (348:11): [True: 0, False: 0]
  ------------------
  349|      0|        log_error (_("error creating keybox '%s': %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  350|      0|                   filename, gpg_strerror (rc));
  351|      0|      else
  352|      0|        log_error (_("error creating keyring '%s': %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  353|      0|                   filename, gpg_strerror (rc));
  354|      0|      goto leave;
  355|      0|    }
  356|       |
  357|      1|  iobuf_close (iobuf);
  358|       |  /* Must invalidate that ugly cache */
  359|      1|  iobuf_ioctl (NULL, IOBUF_IOCTL_INVALIDATE_CACHE, 0, filename);
  360|       |
  361|       |  /* Make sure that at least one record is in a new keybox file, so
  362|       |     that the detection magic will work the next time it is used.  */
  363|      1|  if (is_box)
  ------------------
  |  Branch (363:7): [True: 1, False: 0]
  ------------------
  364|      1|    {
  365|      1|      estream_t fp = es_fopen (filename, "wb");
  366|      1|      if (!fp)
  ------------------
  |  Branch (366:11): [True: 0, False: 1]
  ------------------
  367|      0|        rc = gpg_error_from_syserror ();
  368|      1|      else
  369|      1|        {
  370|      1|          rc = _keybox_write_header_blob (fp, 1);
  371|      1|          es_fclose (fp);
  372|      1|        }
  373|      1|      if (rc)
  ------------------
  |  Branch (373:11): [True: 0, False: 1]
  ------------------
  374|      0|        {
  375|      0|          if (is_box)
  ------------------
  |  Branch (375:15): [True: 0, False: 0]
  ------------------
  376|      0|            log_error (_("error creating keybox '%s': %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  377|      0|                       filename, gpg_strerror (rc));
  378|      0|          else
  379|      0|            log_error (_("error creating keyring '%s': %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  380|      0|                       filename, gpg_strerror (rc));
  381|      0|          goto leave;
  382|      0|        }
  383|      1|    }
  384|       |
  385|      1|  if (!opt.quiet)
  ------------------
  |  Branch (385:7): [True: 1, False: 0]
  ------------------
  386|      1|    {
  387|      1|      if (is_box)
  ------------------
  |  Branch (387:11): [True: 1, False: 0]
  ------------------
  388|      1|        log_info (_("keybox '%s' created\n"), filename);
  ------------------
  |  |   28|      1|#  define _(a) gettext (a)
  ------------------
  389|      0|      else
  390|      0|        log_info (_("keyring '%s' created\n"), filename);
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  391|      1|    }
  392|       |
  393|      1|  rc = 0;
  394|       |
  395|      1| leave:
  396|      1|  if (lockhd)
  ------------------
  |  Branch (396:7): [True: 1, False: 0]
  ------------------
  397|      1|    {
  398|      1|      dotlock_release (lockhd);
  399|      1|      dotlock_destroy (lockhd);
  400|      1|    }
  401|      1|  xfree (bak_fname);
  ------------------
  |  |  104|      1|#define xfree(a)         gcry_free ((a))
  ------------------
  402|      1|  xfree (tmp_fname);
  ------------------
  |  |  104|      1|#define xfree(a)         gcry_free ((a))
  ------------------
  403|      1|  return rc;
  404|      1|}
keydb.c:keyblock_cache_clear:
  195|  20.0k|{
  196|  20.0k|  hd->keyblock_cache.state = KEYBLOCK_CACHE_EMPTY;
  197|  20.0k|  iobuf_close (hd->keyblock_cache.iobuf);
  198|  20.0k|  hd->keyblock_cache.iobuf = NULL;
  199|  20.0k|  hd->keyblock_cache.resource = -1;
  200|  20.0k|  hd->keyblock_cache.offset = -1;
  201|  20.0k|}
keydb.c:unlock_all:
 1035|  4.50k|{
 1036|  4.50k|  int i;
 1037|       |
 1038|  4.50k|  if (!hd->locked || hd->keep_lock)
  ------------------
  |  Branch (1038:7): [True: 4.50k, False: 0]
  |  Branch (1038:22): [True: 0, False: 0]
  ------------------
 1039|  4.50k|    return;
 1040|       |
 1041|      0|  for (i=hd->used-1; i >= 0; i--)
  ------------------
  |  Branch (1041:22): [True: 0, False: 0]
  ------------------
 1042|      0|    {
 1043|      0|      switch (hd->active[i].type)
  ------------------
  |  Branch (1043:15): [True: 0, False: 0]
  ------------------
 1044|      0|        {
 1045|      0|        case KEYDB_RESOURCE_TYPE_NONE:
  ------------------
  |  Branch (1045:9): [True: 0, False: 0]
  ------------------
 1046|      0|          break;
 1047|      0|        case KEYDB_RESOURCE_TYPE_KEYRING:
  ------------------
  |  Branch (1047:9): [True: 0, False: 0]
  ------------------
 1048|      0|          keyring_lock (hd->active[i].u.kr, 0);
 1049|      0|          break;
 1050|      0|        case KEYDB_RESOURCE_TYPE_KEYBOX:
  ------------------
  |  Branch (1050:9): [True: 0, False: 0]
  ------------------
 1051|      0|          keybox_lock (hd->active[i].u.kb, 0, 0);
 1052|      0|          break;
 1053|      0|        }
 1054|      0|    }
 1055|      0|  hd->locked = 0;
 1056|      0|}
keydb.c:kid_not_found_p:
  123|  12.5k|{
  124|  12.5k|  struct kid_not_found_cache_bucket *k;
  125|       |
  126|   974k|  for (k = kid_not_found_cache[kid[0] % KID_NOT_FOUND_CACHE_BUCKETS]; k; k = k->next)
  ------------------
  |  |   70|  12.5k|#define KID_NOT_FOUND_CACHE_BUCKETS 256
  ------------------
  |  Branch (126:71): [True: 973k, False: 684]
  ------------------
  127|   973k|    if (k->kid[0] == kid[0] && k->kid[1] == kid[1])
  ------------------
  |  Branch (127:9): [True: 235k, False: 738k]
  |  Branch (127:32): [True: 11.9k, False: 223k]
  ------------------
  128|  11.9k|      {
  129|  11.9k|        if (DBG_CACHE)
  ------------------
  |  |  352|  11.9k|#define DBG_CACHE  (opt.debug & DBG_CACHE_VALUE)
  |  |  ------------------
  |  |  |  |  338|  11.9k|#define DBG_CACHE_VALUE   64	/* debug the caching */
  |  |  ------------------
  |  |  |  Branch (352:20): [True: 0, False: 11.9k]
  |  |  ------------------
  ------------------
  130|      0|          log_debug ("keydb: kid_not_found_p (%08lx%08lx) => not in DB\n",
  131|      0|                     (ulong)kid[0], (ulong)kid[1]);
  132|  11.9k|        return 1;
  133|  11.9k|      }
  134|       |
  135|    684|  if (DBG_CACHE)
  ------------------
  |  |  352|    684|#define DBG_CACHE  (opt.debug & DBG_CACHE_VALUE)
  |  |  ------------------
  |  |  |  |  338|    684|#define DBG_CACHE_VALUE   64	/* debug the caching */
  |  |  ------------------
  |  |  |  Branch (352:20): [True: 0, False: 684]
  |  |  ------------------
  ------------------
  136|      0|    log_debug ("keydb: kid_not_found_p (%08lx%08lx) => indeterminate\n",
  137|      0|               (ulong)kid[0], (ulong)kid[1]);
  138|    684|  return 0;
  139|  12.5k|}
keydb.c:kid_not_found_insert:
  149|    684|{
  150|    684|  struct kid_not_found_cache_bucket *k;
  151|       |
  152|    684|  if (DBG_CACHE)
  ------------------
  |  |  352|    684|#define DBG_CACHE  (opt.debug & DBG_CACHE_VALUE)
  |  |  ------------------
  |  |  |  |  338|    684|#define DBG_CACHE_VALUE   64	/* debug the caching */
  |  |  ------------------
  |  |  |  Branch (352:20): [True: 0, False: 684]
  |  |  ------------------
  ------------------
  153|      0|    log_debug ("keydb: kid_not_found_insert (%08lx%08lx)\n",
  154|      0|               (ulong)kid[0], (ulong)kid[1]);
  155|    684|  k = xmalloc (sizeof *k);
  ------------------
  |  |  107|    684|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  156|    684|  k->kid[0] = kid[0];
  157|    684|  k->kid[1] = kid[1];
  158|    684|  k->next = kid_not_found_cache[kid[0] % KID_NOT_FOUND_CACHE_BUCKETS];
  ------------------
  |  |   70|    684|#define KID_NOT_FOUND_CACHE_BUCKETS 256
  ------------------
  159|    684|  kid_not_found_cache[kid[0] % KID_NOT_FOUND_CACHE_BUCKETS] = k;
  ------------------
  |  |   70|    684|#define KID_NOT_FOUND_CACHE_BUCKETS 256
  ------------------
  160|    684|  kid_not_found_stats.count++;
  161|    684|}

format_keyid:
  359|  44.8k|{
  360|  44.8k|  if (! buffer)
  ------------------
  |  Branch (360:7): [True: 0, False: 44.8k]
  ------------------
  361|      0|    {
  362|      0|      len = KEYID_STR_SIZE;
  ------------------
  |  |   41|      0|#define KEYID_STR_SIZE 19
  ------------------
  363|      0|      buffer = xtrymalloc (len);
  ------------------
  |  |   97|      0|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  364|      0|      if (!buffer)
  ------------------
  |  Branch (364:11): [True: 0, False: 0]
  ------------------
  365|      0|        return NULL;
  366|      0|    }
  367|       |
  368|  44.8k|  if (format == KF_DEFAULT)
  ------------------
  |  Branch (368:7): [True: 0, False: 44.8k]
  ------------------
  369|      0|    format = opt.keyid_format;
  370|  44.8k|  if (format == KF_DEFAULT)
  ------------------
  |  Branch (370:7): [True: 0, False: 44.8k]
  ------------------
  371|      0|    format = KF_NONE;
  372|       |
  373|  44.8k|  switch (format)
  374|  44.8k|    {
  375|      0|    case KF_NONE:
  ------------------
  |  Branch (375:5): [True: 0, False: 44.8k]
  ------------------
  376|      0|      if (len)
  ------------------
  |  Branch (376:11): [True: 0, False: 0]
  ------------------
  377|      0|        *buffer = 0;
  378|      0|      break;
  379|       |
  380|      0|    case KF_SHORT:
  ------------------
  |  Branch (380:5): [True: 0, False: 44.8k]
  ------------------
  381|      0|      snprintf (buffer, len, "%08lX", (ulong)keyid[1]);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  382|      0|      break;
  383|       |
  384|  44.8k|    case KF_LONG:
  ------------------
  |  Branch (384:5): [True: 44.8k, False: 0]
  ------------------
  385|  44.8k|      snprintf (buffer, len, "%08lX%08lX", (ulong)keyid[0], (ulong)keyid[1]);
  ------------------
  |  |   84|  44.8k|#define snprintf gpgrt_snprintf
  ------------------
  386|  44.8k|      break;
  387|       |
  388|      0|    case KF_0xSHORT:
  ------------------
  |  Branch (388:5): [True: 0, False: 44.8k]
  ------------------
  389|      0|      snprintf (buffer, len, "0x%08lX", (ulong)keyid[1]);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  390|      0|      break;
  391|       |
  392|      0|    case KF_0xLONG:
  ------------------
  |  Branch (392:5): [True: 0, False: 44.8k]
  ------------------
  393|      0|      snprintf (buffer, len, "0x%08lX%08lX", (ulong)keyid[0],(ulong)keyid[1]);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  394|      0|      break;
  395|       |
  396|      0|    default:
  ------------------
  |  Branch (396:5): [True: 0, False: 44.8k]
  ------------------
  397|      0|      BUG();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  398|  44.8k|    }
  399|       |
  400|  44.8k|  return buffer;
  401|  44.8k|}
keystrlen:
  405|  44.8k|{
  406|  44.8k|  int format = opt.keyid_format;
  407|  44.8k|  if (format == KF_DEFAULT)
  ------------------
  |  Branch (407:7): [True: 44.8k, False: 0]
  ------------------
  408|  44.8k|    format = KF_NONE;
  409|       |
  410|  44.8k|  switch(format)
  411|  44.8k|    {
  412|  44.8k|    case KF_NONE:
  ------------------
  |  Branch (412:5): [True: 44.8k, False: 0]
  ------------------
  413|  44.8k|      return 0;
  414|       |
  415|      0|    case KF_SHORT:
  ------------------
  |  Branch (415:5): [True: 0, False: 44.8k]
  ------------------
  416|      0|      return 8;
  417|       |
  418|      0|    case KF_LONG:
  ------------------
  |  Branch (418:5): [True: 0, False: 44.8k]
  ------------------
  419|      0|      return 16;
  420|       |
  421|      0|    case KF_0xSHORT:
  ------------------
  |  Branch (421:5): [True: 0, False: 44.8k]
  ------------------
  422|      0|      return 10;
  423|       |
  424|      0|    case KF_0xLONG:
  ------------------
  |  Branch (424:5): [True: 0, False: 44.8k]
  ------------------
  425|      0|      return 18;
  426|       |
  427|      0|    default:
  ------------------
  |  Branch (427:5): [True: 0, False: 44.8k]
  ------------------
  428|      0|      BUG();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  429|  44.8k|    }
  430|  44.8k|}
keystr:
  435|  44.8k|{
  436|  44.8k|  static char keyid_str[KEYID_STR_SIZE];
  437|  44.8k|  int format = opt.keyid_format;
  438|       |
  439|  44.8k|  if (format == KF_DEFAULT)
  ------------------
  |  Branch (439:7): [True: 44.8k, False: 0]
  ------------------
  440|  44.8k|    format = KF_NONE;
  441|  44.8k|  if (format == KF_NONE)
  ------------------
  |  Branch (441:7): [True: 44.8k, False: 0]
  ------------------
  442|  44.8k|    format = KF_LONG;
  443|       |
  444|  44.8k|  return format_keyid (keyid, format, keyid_str, sizeof (keyid_str));
  445|  44.8k|}

public_key_list:
  146|      1|{
  147|      1|#ifndef NO_TRUST_MODELS
  148|      1|  if (opt.with_colons)
  ------------------
  |  Branch (148:7): [True: 0, False: 1]
  ------------------
  149|      0|    {
  150|      0|      byte trust_model, marginals, completes, cert_depth, min_cert_level;
  151|      0|      ulong created, nextcheck;
  152|       |
  153|      0|      read_trust_options (ctrl, &trust_model, &created, &nextcheck,
  154|      0|			  &marginals, &completes, &cert_depth, &min_cert_level);
  155|       |
  156|      0|      es_fprintf (es_stdout, "tru:");
  157|       |
  158|      0|      if (nextcheck && nextcheck <= make_timestamp ())
  ------------------
  |  Branch (158:11): [True: 0, False: 0]
  |  Branch (158:24): [True: 0, False: 0]
  ------------------
  159|      0|	es_fprintf (es_stdout, "o");
  160|      0|      if (trust_model != opt.trust_model)
  ------------------
  |  Branch (160:11): [True: 0, False: 0]
  ------------------
  161|      0|	es_fprintf (es_stdout, "t");
  162|      0|      if (opt.trust_model == TM_PGP || opt.trust_model == TM_CLASSIC
  ------------------
  |  Branch (162:11): [True: 0, False: 0]
  |  Branch (162:40): [True: 0, False: 0]
  ------------------
  163|      0|	  || opt.trust_model == TM_TOFU_PGP)
  ------------------
  |  Branch (163:7): [True: 0, False: 0]
  ------------------
  164|      0|	{
  165|      0|	  if (marginals != opt.marginals_needed)
  ------------------
  |  Branch (165:8): [True: 0, False: 0]
  ------------------
  166|      0|	    es_fprintf (es_stdout, "m");
  167|      0|	  if (completes != opt.completes_needed)
  ------------------
  |  Branch (167:8): [True: 0, False: 0]
  ------------------
  168|      0|	    es_fprintf (es_stdout, "c");
  169|      0|	  if (cert_depth != opt.max_cert_depth)
  ------------------
  |  Branch (169:8): [True: 0, False: 0]
  ------------------
  170|      0|	    es_fprintf (es_stdout, "d");
  171|      0|	  if (min_cert_level != opt.min_cert_level)
  ------------------
  |  Branch (171:8): [True: 0, False: 0]
  ------------------
  172|      0|	    es_fprintf (es_stdout, "l");
  173|      0|	}
  174|       |
  175|      0|      es_fprintf (es_stdout, ":%d:%lu:%lu", trust_model, created, nextcheck);
  176|       |
  177|       |      /* Only show marginals, completes, and cert_depth in the classic
  178|       |         or PGP trust models since they are not meaningful
  179|       |         otherwise. */
  180|       |
  181|      0|      if (trust_model == TM_PGP || trust_model == TM_CLASSIC)
  ------------------
  |  Branch (181:11): [True: 0, False: 0]
  |  Branch (181:36): [True: 0, False: 0]
  ------------------
  182|      0|	es_fprintf (es_stdout, ":%d:%d:%d", marginals, completes, cert_depth);
  183|      0|      es_fprintf (es_stdout, "\n");
  184|      0|    }
  185|      1|#endif /*!NO_TRUST_MODELS*/
  186|       |
  187|       |  /* We need to do the stale check right here because it might need to
  188|       |     update the keyring while we already have the keyring open.  This
  189|       |     is very bad for W32 because of a sharing violation. For real OSes
  190|       |     it might lead to false results if we are later listing a keyring
  191|       |     which is associated with the inode of a deleted file.  */
  192|      1|  check_trustdb_stale (ctrl);
  193|       |
  194|       |#ifdef USE_TOFU
  195|       |  tofu_begin_batch_update (ctrl);
  196|       |#endif
  197|       |
  198|      1|  if (locate_mode)
  ------------------
  |  Branch (198:7): [True: 0, False: 1]
  ------------------
  199|      0|    locate_one (ctrl, list, no_local);
  200|      1|  else if (!list)
  ------------------
  |  Branch (200:12): [True: 1, False: 0]
  ------------------
  201|      1|    list_all (ctrl, 0, opt.with_secret);
  202|      0|  else
  203|      0|    list_one (ctrl, list, 0, opt.with_secret);
  204|       |
  205|       |#ifdef USE_TOFU
  206|       |  tofu_end_batch_update (ctrl);
  207|       |#endif
  208|      1|}
keylist.c:list_all:
  741|      1|{
  742|      1|  KEYDB_HANDLE hd;
  743|      1|  KBNODE keyblock = NULL;
  744|      1|  int rc = 0;
  745|      1|  int any_secret;
  746|      1|  const char *lastresname, *resname;
  747|      1|  struct keylist_context listctx;
  748|       |
  749|      1|  memset (&listctx, 0, sizeof (listctx));
  750|      1|  if (opt.check_sigs)
  ------------------
  |  Branch (750:7): [True: 0, False: 1]
  ------------------
  751|      0|    listctx.check_sigs = 1;
  752|       |
  753|      1|  hd = keydb_new (ctrl);
  754|      1|  if (!hd)
  ------------------
  |  Branch (754:7): [True: 0, False: 1]
  ------------------
  755|      0|    rc = gpg_error_from_syserror ();
  756|      1|  else
  757|      1|    rc = keydb_search_first (hd);
  758|      1|  if (rc)
  ------------------
  |  Branch (758:7): [True: 1, False: 0]
  ------------------
  759|      1|    {
  760|      1|      if (gpg_err_code (rc) != GPG_ERR_NOT_FOUND)
  ------------------
  |  Branch (760:11): [True: 0, False: 1]
  ------------------
  761|      0|	log_error ("keydb_search_first failed: %s\n", gpg_strerror (rc));
  762|      1|      goto leave;
  763|      1|    }
  764|       |
  765|      0|  lastresname = NULL;
  766|      0|  do
  767|      0|    {
  768|      0|      if (secret)
  ------------------
  |  Branch (768:11): [True: 0, False: 0]
  ------------------
  769|      0|        glo_ctrl.silence_parse_warnings++;
  770|      0|      rc = keydb_get_keyblock (hd, &keyblock);
  771|      0|      if (secret)
  ------------------
  |  Branch (771:11): [True: 0, False: 0]
  ------------------
  772|      0|        glo_ctrl.silence_parse_warnings--;
  773|      0|      if (rc)
  ------------------
  |  Branch (773:11): [True: 0, False: 0]
  ------------------
  774|      0|	{
  775|      0|          if (gpg_err_code (rc) == GPG_ERR_LEGACY_KEY)
  ------------------
  |  Branch (775:15): [True: 0, False: 0]
  ------------------
  776|      0|            continue;  /* Skip legacy keys.  */
  777|      0|	  log_error ("keydb_get_keyblock failed: %s\n", gpg_strerror (rc));
  778|      0|	  goto leave;
  779|      0|	}
  780|       |
  781|      0|      if (secret || mark_secret)
  ------------------
  |  Branch (781:11): [True: 0, False: 0]
  |  Branch (781:21): [True: 0, False: 0]
  ------------------
  782|      0|        any_secret = !agent_probe_any_secret_key (ctrl, keyblock);
  783|      0|      else
  784|      0|        any_secret = 0;
  785|       |
  786|      0|      if (secret && !any_secret)
  ------------------
  |  Branch (786:11): [True: 0, False: 0]
  |  Branch (786:21): [True: 0, False: 0]
  ------------------
  787|      0|        ; /* Secret key listing requested but this isn't one.  */
  788|      0|      else
  789|      0|        {
  790|      0|          if (!opt.with_colons && !(opt.list_options & LIST_SHOW_ONLY_FPR_MBOX))
  ------------------
  |  |  425|      0|#define LIST_SHOW_ONLY_FPR_MBOX          (1<<12)
  ------------------
  |  Branch (790:15): [True: 0, False: 0]
  |  Branch (790:35): [True: 0, False: 0]
  ------------------
  791|      0|            {
  792|      0|              resname = keydb_get_resource_name (hd);
  793|      0|              if (lastresname != resname)
  ------------------
  |  Branch (793:19): [True: 0, False: 0]
  ------------------
  794|      0|                {
  795|      0|                  int i;
  796|       |
  797|      0|                  es_fprintf (es_stdout, "%s\n", resname);
  798|      0|                  for (i = strlen (resname); i; i--)
  ------------------
  |  Branch (798:46): [True: 0, False: 0]
  ------------------
  799|      0|                    es_putc ('-', es_stdout);
  800|      0|                  es_putc ('\n', es_stdout);
  801|      0|                  lastresname = resname;
  802|      0|                }
  803|      0|            }
  804|      0|          merge_keys_and_selfsig (ctrl, keyblock);
  805|      0|          list_keyblock (ctrl, keyblock, secret, any_secret, opt.fingerprint,
  806|      0|                         &listctx);
  807|      0|        }
  808|      0|      release_kbnode (keyblock);
  809|      0|      keyblock = NULL;
  810|      0|    }
  811|      0|  while (!(rc = keydb_search_next (hd)));
  ------------------
  |  Branch (811:10): [True: 0, False: 0]
  ------------------
  812|      0|  es_fflush (es_stdout);
  813|      0|  if (rc && gpg_err_code (rc) != GPG_ERR_NOT_FOUND)
  ------------------
  |  Branch (813:7): [True: 0, False: 0]
  |  Branch (813:13): [True: 0, False: 0]
  ------------------
  814|      0|    log_error ("keydb_search_next failed: %s\n", gpg_strerror (rc));
  815|      0|  if (keydb_get_skipped_counter (hd))
  ------------------
  |  Branch (815:7): [True: 0, False: 0]
  ------------------
  816|      0|    log_info (ngettext("Warning: %lu key skipped due to its large size\n",
  817|      0|                       "Warning: %lu keys skipped due to their large sizes\n",
  818|      0|                       keydb_get_skipped_counter (hd)),
  819|      0|              keydb_get_skipped_counter (hd));
  820|       |
  821|      0|  if (opt.check_sigs && !opt.with_colons)
  ------------------
  |  Branch (821:7): [True: 0, False: 0]
  |  Branch (821:25): [True: 0, False: 0]
  ------------------
  822|      0|    print_signature_stats (&listctx);
  823|       |
  824|      1| leave:
  825|      1|  keylist_context_release (&listctx);
  826|      1|  release_kbnode (keyblock);
  827|      1|  keydb_release (hd);
  828|      1|}
keylist.c:keylist_context_release:
   92|      1|{
   93|      1|  (void)listctx; /* Nothing to release.  */
   94|      1|}

reset_literals_seen:
  130|  12.2k|{
  131|  12.2k|  literals_seen = 0;
  132|  12.2k|}
proc_signature_packets:
 1510|   287k|{
 1511|   287k|  CTX c = xmalloc_clear (sizeof *c);
  ------------------
  |  |  116|   287k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
 1512|   287k|  int rc;
 1513|       |
 1514|   287k|  c->ctrl = ctrl;
 1515|   287k|  c->anchor = anchor;
 1516|   287k|  c->sigs_only = 1;
 1517|       |
 1518|   287k|  c->signed_data.data_fd = -1;
 1519|   287k|  c->signed_data.data_names = signedfiles;
 1520|   287k|  c->signed_data.used = !!signedfiles;
 1521|       |
 1522|   287k|  c->sigfilename = sigfilename;
 1523|   287k|  rc = do_proc_packets (c, a);
 1524|       |
 1525|       |  /* If we have not encountered any signature we print an error
 1526|       |     messages, send a NODATA status back and return an error code.
 1527|       |     Using log_error is required because verify_files does not check
 1528|       |     error codes for each file but we want to terminate the process
 1529|       |     with an error. */
 1530|   287k|  if (!rc && !c->any.sig_seen)
  ------------------
  |  Branch (1530:7): [True: 274k, False: 12.9k]
  |  Branch (1530:14): [True: 11.3k, False: 263k]
  ------------------
 1531|  11.3k|    {
 1532|  11.3k|      write_status_text (STATUS_NODATA, "4");
 1533|  11.3k|      log_error (_("no signature found\n"));
  ------------------
  |  |   28|  11.3k|#  define _(a) gettext (a)
  ------------------
 1534|  11.3k|      rc = GPG_ERR_NO_DATA;
 1535|  11.3k|    }
 1536|       |
 1537|       |  /* Propagate the signature seen flag upward. Do this only on success
 1538|       |     so that we won't issue the nodata status several times.  */
 1539|   287k|  if (!rc && c->anchor && c->any.sig_seen)
  ------------------
  |  Branch (1539:7): [True: 263k, False: 24.2k]
  |  Branch (1539:14): [True: 254k, False: 8.73k]
  |  Branch (1539:27): [True: 254k, False: 0]
  ------------------
 1540|   254k|    c->anchor->any.sig_seen = 1;
 1541|       |
 1542|   287k|  xfree (c);
  ------------------
  |  |  104|   287k|#define xfree(a)         gcry_free ((a))
  ------------------
 1543|   287k|  return rc;
 1544|   287k|}
issuer_fpr_raw:
 1809|  61.6k|{
 1810|  61.6k|  const byte *p;
 1811|  61.6k|  size_t n;
 1812|       |
 1813|  61.6k|  p = parse_sig_subpkt (sig, 1, SIGSUBPKT_ISSUER_FPR, &n);
 1814|  61.6k|  if (p && ((n == 21 && p[0] == 4) || (n == 33 && p[0] == 5)))
  ------------------
  |  Branch (1814:7): [True: 10.5k, False: 51.1k]
  |  Branch (1814:14): [True: 5.12k, False: 5.42k]
  |  Branch (1814:25): [True: 4.19k, False: 924]
  |  Branch (1814:40): [True: 5.41k, False: 935]
  |  Branch (1814:51): [True: 3.47k, False: 1.94k]
  ------------------
 1815|  7.66k|    {
 1816|  7.66k|      *r_len = n - 1;
 1817|  7.66k|      return p+1;
 1818|  7.66k|    }
 1819|  53.9k|  *r_len = 0;
 1820|  53.9k|  return NULL;
 1821|  61.6k|}
issuer_fpr_string:
 1829|  49.0k|{
 1830|  49.0k|  const byte *p;
 1831|  49.0k|  size_t n;
 1832|       |
 1833|  49.0k|  p = issuer_fpr_raw (sig, &n);
 1834|  49.0k|  return p? bin2hex (p, n, NULL) : NULL;
  ------------------
  |  Branch (1834:10): [True: 4.25k, False: 44.8k]
  ------------------
 1835|  49.0k|}
mainproc.c:do_proc_packets:
 1626|   287k|{
 1627|   287k|  PACKET *pkt;
 1628|   287k|  struct parse_packet_ctx_s parsectx;
 1629|   287k|  int rc = 0;
 1630|   287k|  int any_data = 0;
 1631|   287k|  int newpkt;
 1632|       |
 1633|   287k|  rc = check_nesting (c);
 1634|   287k|  if (rc)
  ------------------
  |  Branch (1634:7): [True: 22, False: 287k]
  ------------------
 1635|     22|    return rc;
 1636|       |
 1637|   287k|  pkt = xmalloc( sizeof *pkt );
  ------------------
  |  |  107|   287k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 1638|   287k|  c->iobuf = a;
 1639|   287k|  init_packet(pkt);
  ------------------
  |  |  581|   287k|#define init_packet(a) do { (a)->pkttype = 0;		\
  |  |  582|   287k|			    (a)->pkt.generic = NULL;	\
  |  |  583|   287k|		       } while(0)
  |  |  ------------------
  |  |  |  Branch (583:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1640|   287k|  init_parse_packet (&parsectx, a);
  ------------------
  |  |  666|   287k|#define init_parse_packet(a,i) do { \
  |  |  667|   287k|    (a)->inp = (i);                 \
  |  |  668|   287k|    (a)->last_pkt.pkttype = 0;      \
  |  |  669|   287k|    (a)->last_pkt.pkt.generic= NULL;\
  |  |  670|   287k|    (a)->free_last_pkt = 0;         \
  |  |  671|   287k|    (a)->skip_meta = 0;             \
  |  |  672|   287k|    (a)->n_parsed_packets = 0;      \
  |  |  673|   287k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (673:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1641|  1.01M|  while ((rc=parse_packet (&parsectx, pkt)) != -1)
  ------------------
  |  |  697|  1.01M|	     dbg_parse_packet( (a), (b), __FILE__, __LINE__ )
  ------------------
  |  Branch (1641:10): [True: 980k, False: 33.2k]
  ------------------
 1642|   980k|    {
 1643|   980k|      any_data = 1;
 1644|   980k|      if (rc)
  ------------------
  |  Branch (1644:11): [True: 281k, False: 699k]
  ------------------
 1645|   281k|        {
 1646|   281k|          free_packet (pkt, &parsectx);
 1647|       |          /* Stop processing when an invalid packet has been encountered
 1648|       |           * but don't do so when we are doing a --list-packets.  */
 1649|   281k|          if (gpg_err_code (rc) == GPG_ERR_INV_PACKET
  ------------------
  |  Branch (1649:15): [True: 243k, False: 37.3k]
  ------------------
 1650|   281k|              && opt.list_packets == 0)
  ------------------
  |  Branch (1650:18): [True: 243k, False: 0]
  ------------------
 1651|   243k|            break;
 1652|  37.3k|          continue;
 1653|   281k|	}
 1654|   699k|      newpkt = -1;
 1655|   699k|      if (opt.list_packets)
  ------------------
  |  Branch (1655:11): [True: 0, False: 699k]
  ------------------
 1656|      0|        {
 1657|      0|          switch (pkt->pkttype)
 1658|      0|            {
 1659|      0|            case PKT_PUBKEY_ENC:    proc_pubkey_enc (c, pkt); break;
  ------------------
  |  Branch (1659:13): [True: 0, False: 0]
  ------------------
 1660|      0|            case PKT_SYMKEY_ENC:    proc_symkey_enc (c, pkt); break;
  ------------------
  |  Branch (1660:13): [True: 0, False: 0]
  ------------------
 1661|      0|            case PKT_ENCRYPTED:
  ------------------
  |  Branch (1661:13): [True: 0, False: 0]
  ------------------
 1662|      0|            case PKT_ENCRYPTED_MDC:
  ------------------
  |  Branch (1662:13): [True: 0, False: 0]
  ------------------
 1663|      0|            case PKT_ENCRYPTED_AEAD:proc_encrypted (c, pkt); break;
  ------------------
  |  Branch (1663:13): [True: 0, False: 0]
  ------------------
 1664|      0|            case PKT_COMPRESSED:    rc = proc_compressed (c, pkt); break;
  ------------------
  |  Branch (1664:13): [True: 0, False: 0]
  ------------------
 1665|      0|            default: newpkt = 0; break;
  ------------------
  |  Branch (1665:13): [True: 0, False: 0]
  ------------------
 1666|      0|	    }
 1667|      0|	}
 1668|   699k|      else if (c->sigs_only)
  ------------------
  |  Branch (1668:16): [True: 699k, False: 0]
  ------------------
 1669|   699k|        {
 1670|   699k|          switch (pkt->pkttype)
 1671|   699k|            {
 1672|     97|            case PKT_PUBLIC_KEY:
  ------------------
  |  Branch (1672:13): [True: 97, False: 699k]
  ------------------
 1673|    242|            case PKT_SECRET_KEY:
  ------------------
  |  Branch (1673:13): [True: 145, False: 699k]
  ------------------
 1674|    907|            case PKT_USER_ID:
  ------------------
  |  Branch (1674:13): [True: 665, False: 699k]
  ------------------
 1675|  1.10k|            case PKT_SYMKEY_ENC:
  ------------------
  |  Branch (1675:13): [True: 198, False: 699k]
  ------------------
 1676|  1.25k|            case PKT_PUBKEY_ENC:
  ------------------
  |  Branch (1676:13): [True: 150, False: 699k]
  ------------------
 1677|  1.70k|            case PKT_ENCRYPTED:
  ------------------
  |  Branch (1677:13): [True: 452, False: 699k]
  ------------------
 1678|  1.71k|            case PKT_ENCRYPTED_MDC:
  ------------------
  |  Branch (1678:13): [True: 6, False: 699k]
  ------------------
 1679|  1.75k|            case PKT_ENCRYPTED_AEAD:
  ------------------
  |  Branch (1679:13): [True: 46, False: 699k]
  ------------------
 1680|  1.75k|              write_status_text( STATUS_UNEXPECTED, "0" );
 1681|  1.75k|              rc = GPG_ERR_UNEXPECTED;
 1682|  1.75k|              goto leave;
 1683|       |
 1684|   322k|            case PKT_SIGNATURE:   newpkt = add_signature (c, pkt); break;
  ------------------
  |  Branch (1684:13): [True: 322k, False: 377k]
  ------------------
 1685|  67.6k|            case PKT_PLAINTEXT:   proc_plaintext (c, pkt); break;
  ------------------
  |  Branch (1685:13): [True: 67.6k, False: 632k]
  ------------------
 1686|   263k|            case PKT_COMPRESSED:  rc = proc_compressed (c, pkt); break;
  ------------------
  |  Branch (1686:13): [True: 263k, False: 436k]
  ------------------
 1687|  8.26k|            case PKT_ONEPASS_SIG: newpkt = add_onepass_sig (c, pkt); break;
  ------------------
  |  Branch (1687:13): [True: 8.26k, False: 691k]
  ------------------
 1688|  8.58k|            case PKT_GPG_CONTROL: newpkt = add_gpg_control (c, pkt); break;
  ------------------
  |  Branch (1688:13): [True: 8.58k, False: 691k]
  ------------------
 1689|  27.4k|            default: newpkt = 0; break;
  ------------------
  |  Branch (1689:13): [True: 27.4k, False: 672k]
  ------------------
 1690|   699k|	    }
 1691|   699k|	}
 1692|      0|      else if (c->encrypt_only)
  ------------------
  |  Branch (1692:16): [True: 0, False: 0]
  ------------------
 1693|      0|        {
 1694|      0|          switch (pkt->pkttype)
 1695|      0|            {
 1696|      0|            case PKT_PUBLIC_KEY:
  ------------------
  |  Branch (1696:13): [True: 0, False: 0]
  ------------------
 1697|      0|            case PKT_SECRET_KEY:
  ------------------
  |  Branch (1697:13): [True: 0, False: 0]
  ------------------
 1698|      0|            case PKT_USER_ID:
  ------------------
  |  Branch (1698:13): [True: 0, False: 0]
  ------------------
 1699|      0|              write_status_text (STATUS_UNEXPECTED, "0");
 1700|      0|              rc = GPG_ERR_UNEXPECTED;
 1701|      0|              goto leave;
 1702|       |
 1703|      0|            case PKT_SIGNATURE:   newpkt = add_signature (c, pkt); break;
  ------------------
  |  Branch (1703:13): [True: 0, False: 0]
  ------------------
 1704|      0|            case PKT_SYMKEY_ENC:  proc_symkey_enc (c, pkt); break;
  ------------------
  |  Branch (1704:13): [True: 0, False: 0]
  ------------------
 1705|      0|            case PKT_PUBKEY_ENC:  proc_pubkey_enc (c, pkt); break;
  ------------------
  |  Branch (1705:13): [True: 0, False: 0]
  ------------------
 1706|      0|            case PKT_ENCRYPTED:
  ------------------
  |  Branch (1706:13): [True: 0, False: 0]
  ------------------
 1707|      0|            case PKT_ENCRYPTED_MDC:
  ------------------
  |  Branch (1707:13): [True: 0, False: 0]
  ------------------
 1708|      0|            case PKT_ENCRYPTED_AEAD: proc_encrypted (c, pkt); break;
  ------------------
  |  Branch (1708:13): [True: 0, False: 0]
  ------------------
 1709|      0|            case PKT_PLAINTEXT:   proc_plaintext (c, pkt); break;
  ------------------
  |  Branch (1709:13): [True: 0, False: 0]
  ------------------
 1710|      0|            case PKT_COMPRESSED:  rc = proc_compressed (c, pkt); break;
  ------------------
  |  Branch (1710:13): [True: 0, False: 0]
  ------------------
 1711|      0|            case PKT_ONEPASS_SIG: newpkt = add_onepass_sig (c, pkt); break;
  ------------------
  |  Branch (1711:13): [True: 0, False: 0]
  ------------------
 1712|      0|            case PKT_GPG_CONTROL: newpkt = add_gpg_control (c, pkt); break;
  ------------------
  |  Branch (1712:13): [True: 0, False: 0]
  ------------------
 1713|      0|            default: newpkt = 0; break;
  ------------------
  |  Branch (1713:13): [True: 0, False: 0]
  ------------------
 1714|      0|	    }
 1715|      0|	}
 1716|      0|      else
 1717|      0|        {
 1718|      0|          switch (pkt->pkttype)
 1719|      0|            {
 1720|      0|            case PKT_PUBLIC_KEY:
  ------------------
  |  Branch (1720:13): [True: 0, False: 0]
  ------------------
 1721|      0|            case PKT_SECRET_KEY:
  ------------------
  |  Branch (1721:13): [True: 0, False: 0]
  ------------------
 1722|      0|              release_list (c);
 1723|      0|              c->list = new_kbnode (pkt);
 1724|      0|              newpkt = 1;
 1725|      0|              break;
 1726|      0|            case PKT_PUBLIC_SUBKEY:
  ------------------
  |  Branch (1726:13): [True: 0, False: 0]
  ------------------
 1727|      0|            case PKT_SECRET_SUBKEY:
  ------------------
  |  Branch (1727:13): [True: 0, False: 0]
  ------------------
 1728|      0|              newpkt = add_subkey (c, pkt);
 1729|      0|              break;
 1730|      0|            case PKT_USER_ID:     newpkt = add_user_id (c, pkt); break;
  ------------------
  |  Branch (1730:13): [True: 0, False: 0]
  ------------------
 1731|      0|            case PKT_SIGNATURE:   newpkt = add_signature (c, pkt); break;
  ------------------
  |  Branch (1731:13): [True: 0, False: 0]
  ------------------
 1732|      0|            case PKT_PUBKEY_ENC:  proc_pubkey_enc (c, pkt); break;
  ------------------
  |  Branch (1732:13): [True: 0, False: 0]
  ------------------
 1733|      0|            case PKT_SYMKEY_ENC:  proc_symkey_enc (c, pkt); break;
  ------------------
  |  Branch (1733:13): [True: 0, False: 0]
  ------------------
 1734|      0|            case PKT_ENCRYPTED:
  ------------------
  |  Branch (1734:13): [True: 0, False: 0]
  ------------------
 1735|      0|            case PKT_ENCRYPTED_MDC:
  ------------------
  |  Branch (1735:13): [True: 0, False: 0]
  ------------------
 1736|      0|            case PKT_ENCRYPTED_AEAD: proc_encrypted (c, pkt); break;
  ------------------
  |  Branch (1736:13): [True: 0, False: 0]
  ------------------
 1737|      0|            case PKT_PLAINTEXT:   proc_plaintext (c, pkt); break;
  ------------------
  |  Branch (1737:13): [True: 0, False: 0]
  ------------------
 1738|      0|            case PKT_COMPRESSED:  rc = proc_compressed (c, pkt); break;
  ------------------
  |  Branch (1738:13): [True: 0, False: 0]
  ------------------
 1739|      0|            case PKT_ONEPASS_SIG: newpkt = add_onepass_sig (c, pkt); break;
  ------------------
  |  Branch (1739:13): [True: 0, False: 0]
  ------------------
 1740|      0|            case PKT_GPG_CONTROL: newpkt = add_gpg_control(c, pkt); break;
  ------------------
  |  Branch (1740:13): [True: 0, False: 0]
  ------------------
 1741|      0|            case PKT_RING_TRUST:  newpkt = add_ring_trust (c, pkt); break;
  ------------------
  |  Branch (1741:13): [True: 0, False: 0]
  ------------------
 1742|      0|            default: newpkt = 0; break;
  ------------------
  |  Branch (1742:13): [True: 0, False: 0]
  ------------------
 1743|      0|	    }
 1744|      0|	}
 1745|       |
 1746|   697k|      if (rc)
  ------------------
  |  Branch (1746:11): [True: 8.96k, False: 689k]
  ------------------
 1747|  8.96k|        goto leave;
 1748|       |
 1749|       |      /* This is a very ugly construct and frankly, I don't remember why
 1750|       |       * I used it.  Adding the MDC check here is a hack.
 1751|       |       * The right solution is to initiate another context for encrypted
 1752|       |       * packet and not to reuse the current one ...  It works right
 1753|       |       * when there is a compression packet between which adds just
 1754|       |       * an extra layer.
 1755|       |       * Hmmm: Rewrite this whole module here??
 1756|       |       */
 1757|   689k|      if (pkt->pkttype != PKT_SIGNATURE && pkt->pkttype != PKT_MDC)
  ------------------
  |  Branch (1757:11): [True: 366k, False: 322k]
  |  Branch (1757:44): [True: 362k, False: 4.14k]
  ------------------
 1758|   362k|        c->any.data = (pkt->pkttype == PKT_PLAINTEXT);
 1759|       |
 1760|   689k|      if (newpkt == -1)
  ------------------
  |  Branch (1760:11): [True: 322k, False: 366k]
  ------------------
 1761|   322k|        ;
 1762|   366k|      else if (newpkt)
  ------------------
  |  Branch (1762:16): [True: 339k, False: 27.4k]
  ------------------
 1763|   339k|        {
 1764|   339k|          pkt = xmalloc (sizeof *pkt);
  ------------------
  |  |  107|   339k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 1765|   339k|          init_packet (pkt);
  ------------------
  |  |  581|   339k|#define init_packet(a) do { (a)->pkttype = 0;		\
  |  |  582|   339k|			    (a)->pkt.generic = NULL;	\
  |  |  583|   339k|		       } while(0)
  |  |  ------------------
  |  |  |  Branch (583:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1766|   339k|	}
 1767|  27.4k|      else
 1768|  27.4k|        free_packet (pkt, &parsectx);
 1769|   689k|    }
 1770|       |
 1771|   276k|  if (rc == GPG_ERR_INV_PACKET)
  ------------------
  |  Branch (1771:7): [True: 243k, False: 33.2k]
  ------------------
 1772|   243k|    write_status_text (STATUS_NODATA, "3");
 1773|       |
 1774|   276k|  if (any_data)
  ------------------
  |  Branch (1774:7): [True: 274k, False: 2.23k]
  ------------------
 1775|   274k|    rc = 0;
 1776|  2.23k|  else if (rc == -1)
  ------------------
  |  Branch (1776:12): [True: 2.23k, False: 0]
  ------------------
 1777|  2.23k|    write_status_text (STATUS_NODATA, "2");
 1778|       |
 1779|       |
 1780|   287k| leave:
 1781|   287k|  release_list (c);
 1782|   287k|  xfree(c->dek);
  ------------------
  |  |  104|   287k|#define xfree(a)         gcry_free ((a))
  ------------------
 1783|   287k|  free_packet (pkt, &parsectx);
 1784|   287k|  deinit_parse_packet (&parsectx);
  ------------------
  |  |  675|   287k|#define deinit_parse_packet(a) do { \
  |  |  676|   287k|    if ((a)->free_last_pkt)         \
  |  |  ------------------
  |  |  |  Branch (676:9): [True: 907, False: 286k]
  |  |  ------------------
  |  |  677|   287k|      free_packet (NULL, (a));      \
  |  |  678|   287k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (678:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1785|   287k|  xfree (pkt);
  ------------------
  |  |  104|   287k|#define xfree(a)         gcry_free ((a))
  ------------------
 1786|   287k|  free_md_filter_context (&c->mfx);
 1787|   287k|  return rc;
 1788|   276k|}
mainproc.c:check_nesting:
 1607|   287k|{
 1608|   287k|  int level;
 1609|       |
 1610|  3.28M|  for (level=0; c; c = c->anchor)
  ------------------
  |  Branch (1610:17): [True: 2.99M, False: 287k]
  ------------------
 1611|  2.99M|    level++;
 1612|       |
 1613|   287k|  if (level > MAX_NESTING_DEPTH)
  ------------------
  |  |   47|   287k|#define MAX_NESTING_DEPTH 32
  ------------------
  |  Branch (1613:7): [True: 22, False: 287k]
  ------------------
 1614|     22|    {
 1615|     22|      log_error ("input data with too deeply nested packets\n");
 1616|     22|      write_status_text (STATUS_UNEXPECTED, "1");
 1617|     22|      return GPG_ERR_BAD_DATA;
 1618|     22|    }
 1619|       |
 1620|   287k|  return 0;
 1621|   287k|}
mainproc.c:proc_compressed:
 1116|   263k|{
 1117|   263k|  PKT_compressed *zd = pkt->pkt.compressed;
 1118|   263k|  int rc;
 1119|       |
 1120|       |  /*printf("zip: compressed data packet\n");*/
 1121|   263k|  if (c->sigs_only)
  ------------------
  |  Branch (1121:7): [True: 263k, False: 0]
  ------------------
 1122|   263k|    rc = handle_compressed (c->ctrl, c, zd, proc_compressed_cb, c);
 1123|      0|  else if( c->encrypt_only )
  ------------------
  |  Branch (1123:12): [True: 0, False: 0]
  ------------------
 1124|      0|    rc = handle_compressed (c->ctrl, c, zd, proc_encrypt_cb, c);
 1125|      0|  else
 1126|      0|    rc = handle_compressed (c->ctrl, c, zd, NULL, NULL);
 1127|       |
 1128|   263k|  if (gpg_err_code (rc) == GPG_ERR_BAD_DATA)
  ------------------
  |  Branch (1128:7): [True: 704, False: 262k]
  ------------------
 1129|    704|    {
 1130|    704|      if  (!c->any.uncompress_failed)
  ------------------
  |  Branch (1130:12): [True: 22, False: 682]
  ------------------
 1131|     22|        {
 1132|     22|          CTX cc;
 1133|       |
 1134|    726|          for (cc=c; cc; cc = cc->anchor)
  ------------------
  |  Branch (1134:22): [True: 704, False: 22]
  ------------------
 1135|    704|            cc->any.uncompress_failed = 1;
 1136|     22|          log_error ("uncompressing failed: %s\n", gpg_strerror (rc));
 1137|     22|        }
 1138|    704|    }
 1139|   262k|  else if (rc)
  ------------------
  |  Branch (1139:12): [True: 8.26k, False: 254k]
  ------------------
 1140|  8.26k|    log_error ("uncompressing failed: %s\n", gpg_strerror (rc));
 1141|       |
 1142|   263k|  free_packet (pkt, NULL);
 1143|   263k|  c->last_was_session_key = 0;
 1144|   263k|  return rc;
 1145|   263k|}
mainproc.c:proc_compressed_cb:
 1094|   263k|{
 1095|   263k|  if ( ((CTX)info)->signed_data.used
  ------------------
  |  Branch (1095:8): [True: 0, False: 263k]
  ------------------
 1096|   263k|       && ((CTX)info)->signed_data.data_fd != -1)
  ------------------
  |  Branch (1096:11): [True: 0, False: 0]
  ------------------
 1097|      0|    return proc_signature_packets_by_fd (((CTX)info)->ctrl, info, a,
 1098|      0|                                         ((CTX)info)->signed_data.data_fd);
 1099|   263k|  else
 1100|   263k|    return proc_signature_packets (((CTX)info)->ctrl, info, a,
 1101|   263k|                                   ((CTX)info)->signed_data.data_names,
 1102|   263k|                                   ((CTX)info)->sigfilename );
 1103|   263k|}
mainproc.c:add_signature:
  242|   322k|{
  243|   322k|  kbnode_t node;
  244|       |
  245|   322k|  c->any.sig_seen = 1;
  246|   322k|  if (pkt->pkttype == PKT_SIGNATURE && !c->list)
  ------------------
  |  Branch (246:7): [True: 322k, False: 0]
  |  Branch (246:40): [True: 203k, False: 119k]
  ------------------
  247|   203k|    {
  248|       |      /* This is the first signature for the following datafile.
  249|       |       * GPG does not write such packets; instead it always uses
  250|       |       * onepass-sig packets.  The drawback of PGP's method
  251|       |       * of prepending the signature to the data is
  252|       |       * that it is not possible to make a signature from data read
  253|       |       * from stdin.	(GPG is able to read PGP stuff anyway.) */
  254|   203k|      node = new_kbnode (pkt);
  255|   203k|      c->list = node;
  256|   203k|      return 1;
  257|   203k|    }
  258|   119k|  else if (!c->list)
  ------------------
  |  Branch (258:12): [True: 0, False: 119k]
  ------------------
  259|      0|    return 0; /* oops (invalid packet sequence)*/
  260|   119k|  else if (!c->list->pkt)
  ------------------
  |  Branch (260:12): [True: 0, False: 119k]
  ------------------
  261|      0|    BUG();    /* so nicht */
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  262|       |
  263|       |  /* Add a new signature node item at the end. */
  264|   119k|  node = new_kbnode (pkt);
  265|   119k|  add_kbnode (c->list, node);
  266|       |
  267|   119k|  return 1;
  268|   322k|}
mainproc.c:proc_plaintext:
  933|  67.6k|{
  934|  67.6k|  PKT_plaintext *pt = pkt->pkt.plaintext;
  935|  67.6k|  int any, clearsig, rc;
  936|  67.6k|  kbnode_t n;
  937|  67.6k|  unsigned char *extrahash;
  938|  67.6k|  size_t extrahashlen;
  939|       |
  940|       |  /* This is a literal data packet.  Bump a counter for later checks.  */
  941|  67.6k|  literals_seen++;
  942|       |
  943|  67.6k|  if (pt->namelen == 8 && !memcmp( pt->name, "_CONSOLE", 8))
  ------------------
  |  Branch (943:7): [True: 641, False: 67.0k]
  |  Branch (943:27): [True: 198, False: 443]
  ------------------
  944|    198|    log_info (_("Note: sender requested \"for-your-eyes-only\"\n"));
  ------------------
  |  |   28|    198|#  define _(a) gettext (a)
  ------------------
  945|  67.4k|  else if (opt.verbose)
  ------------------
  |  Branch (945:12): [True: 0, False: 67.4k]
  ------------------
  946|      0|    {
  947|       |      /* We don't use print_utf8_buffer because that would require a
  948|       |       * string change which we don't want in 2.2.  It is also not
  949|       |       * clear whether the filename is always utf-8 encoded.  */
  950|      0|      char *tmp = make_printable_string (pt->name, pt->namelen, 0);
  951|      0|      log_info (_("original file name='%.*s'\n"), (int)strlen (tmp), tmp);
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  952|      0|      xfree (tmp);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  953|      0|    }
  954|       |
  955|  67.6k|  free_md_filter_context (&c->mfx);
  956|  67.6k|  if (gcry_md_open (&c->mfx.md, 0, 0))
  ------------------
  |  Branch (956:7): [True: 0, False: 67.6k]
  ------------------
  957|      0|    BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  958|       |  /* fixme: we may need to push the textfilter if we have sigclass 1
  959|       |   * and no armoring - Not yet tested
  960|       |   * Hmmm, why don't we need it at all if we have sigclass 1
  961|       |   * Should we assume that plaintext in mode 't' has always sigclass 1??
  962|       |   * See: Russ Allbery's mail 1999-02-09
  963|       |   */
  964|  67.6k|  any = clearsig = 0;
  965|  20.1M|  for (n=c->list; n; n = n->next )
  ------------------
  |  Branch (965:19): [True: 20.0M, False: 55.6k]
  ------------------
  966|  20.0M|    {
  967|  20.0M|      if (n->pkt->pkttype == PKT_ONEPASS_SIG)
  ------------------
  |  Branch (967:11): [True: 9.32k, False: 20.0M]
  ------------------
  968|  9.32k|        {
  969|       |          /* The onepass signature case. */
  970|  9.32k|          if (n->pkt->pkt.onepass_sig->digest_algo)
  ------------------
  |  Branch (970:15): [True: 7.34k, False: 1.98k]
  ------------------
  971|  7.34k|            {
  972|  7.34k|              if (!opt.skip_verify)
  ------------------
  |  Branch (972:19): [True: 7.34k, False: 0]
  ------------------
  973|  7.34k|                gcry_md_enable (c->mfx.md,
  974|  7.34k|                                n->pkt->pkt.onepass_sig->digest_algo);
  975|       |
  976|  7.34k|              any = 1;
  977|  7.34k|            }
  978|  9.32k|        }
  979|  20.0M|      else if (n->pkt->pkttype == PKT_GPG_CONTROL
  ------------------
  |  Branch (979:16): [True: 19.9M, False: 98.4k]
  ------------------
  980|  20.0M|               && n->pkt->pkt.gpg_control->control == CTRLPKT_CLEARSIGN_START)
  ------------------
  |  Branch (980:19): [True: 11.9k, False: 19.9M]
  ------------------
  981|  11.9k|        {
  982|       |          /* The clearsigned message case. */
  983|  11.9k|          size_t datalen = n->pkt->pkt.gpg_control->datalen;
  984|  11.9k|          const byte *data = n->pkt->pkt.gpg_control->data;
  985|       |
  986|       |          /* Check that we have at least the sigclass and one hash.  */
  987|  11.9k|          if  (datalen < 2)
  ------------------
  |  Branch (987:16): [True: 0, False: 11.9k]
  ------------------
  988|      0|            log_fatal ("invalid control packet CTRLPKT_CLEARSIGN_START\n");
  989|       |          /* Note that we don't set the clearsig flag for not-dash-escaped
  990|       |           * documents.  */
  991|  11.9k|          clearsig = (*data == 0x01);
  992|  29.9k|          for (data++, datalen--; datalen; datalen--, data++)
  ------------------
  |  Branch (992:35): [True: 17.9k, False: 11.9k]
  ------------------
  993|  17.9k|            if (!opt.skip_verify)
  ------------------
  |  Branch (993:17): [True: 17.9k, False: 0]
  ------------------
  994|  17.9k|              gcry_md_enable (c->mfx.md, *data);
  995|  11.9k|          any = 1;
  996|  11.9k|          break;  /* Stop here as one-pass signature packets are not
  997|       |                     expected.  */
  998|  11.9k|        }
  999|  20.0M|      else if (n->pkt->pkttype == PKT_SIGNATURE)
  ------------------
  |  Branch (999:16): [True: 98.4k, False: 19.9M]
  ------------------
 1000|  98.4k|        {
 1001|       |          /* The SIG+LITERAL case that PGP used to use.  */
 1002|  98.4k|          if (!opt.skip_verify)
  ------------------
  |  Branch (1002:15): [True: 98.4k, False: 0]
  ------------------
 1003|  98.4k|            gcry_md_enable (c->mfx.md, n->pkt->pkt.signature->digest_algo);
 1004|  98.4k|          any = 1;
 1005|  98.4k|        }
 1006|  20.0M|    }
 1007|       |
 1008|  67.6k|  if (!any && !opt.skip_verify && !have_seen_pkt_encrypted_aead_or_mdc(c))
  ------------------
  |  Branch (1008:7): [True: 16.6k, False: 51.0k]
  |  Branch (1008:15): [True: 16.6k, False: 0]
  |  Branch (1008:35): [True: 16.6k, False: 0]
  ------------------
 1009|  16.6k|    {
 1010|       |      /* This is for the old GPG LITERAL+SIG case.  It's not legal
 1011|       |         according to 2440, so hopefully it won't come up that often.
 1012|       |         There is no good way to specify what algorithms to use in
 1013|       |         that case, so these there are the historical answer. */
 1014|  16.6k|	gcry_md_enable (c->mfx.md, DIGEST_ALGO_RMD160);
 1015|  16.6k|	gcry_md_enable (c->mfx.md, DIGEST_ALGO_SHA1);
 1016|  16.6k|    }
 1017|  67.6k|  if (DBG_HASHING)
  ------------------
  |  |  354|  67.6k|#define DBG_HASHING (opt.debug & DBG_HASHING_VALUE)
  |  |  ------------------
  |  |  |  |  341|  67.6k|#define DBG_HASHING_VALUE 512	/* debug hashing operations */
  |  |  ------------------
  |  |  |  Branch (354:21): [True: 0, False: 67.6k]
  |  |  ------------------
  ------------------
 1018|      0|    {
 1019|      0|      gcry_md_debug (c->mfx.md, "verify");
 1020|      0|      if (c->mfx.md2)
  ------------------
  |  Branch (1020:11): [True: 0, False: 0]
  ------------------
 1021|      0|        gcry_md_debug (c->mfx.md2, "verify2");
 1022|      0|    }
 1023|       |
 1024|  67.6k|  rc=0;
 1025|       |
 1026|  67.6k|  if (literals_seen > 1)
  ------------------
  |  Branch (1026:7): [True: 63.0k, False: 4.58k]
  ------------------
 1027|  63.0k|    {
 1028|  63.0k|      log_info (_("WARNING: multiple plaintexts seen\n"));
  ------------------
  |  |   28|  63.0k|#  define _(a) gettext (a)
  ------------------
 1029|       |
 1030|  63.0k|      write_status_text (STATUS_ERROR, "proc_pkt.plaintext 89_BAD_DATA");
 1031|  63.0k|      log_inc_errorcount ();
 1032|  63.0k|      rc = gpg_error (GPG_ERR_UNEXPECTED);
 1033|  63.0k|    }
 1034|       |
 1035|  67.6k|  if (!rc)
  ------------------
  |  Branch (1035:7): [True: 4.58k, False: 63.0k]
  ------------------
 1036|  4.58k|    {
 1037|       |      /* It we are in --verify mode, we do not want to output the
 1038|       |       * signed text.  However, if --output is also used we do what
 1039|       |       * has been requested and write out the signed data.  */
 1040|  4.58k|      rc = handle_plaintext (pt, &c->mfx,
 1041|  4.58k|                             (opt.outfp || opt.outfile)? 0 :  c->sigs_only,
  ------------------
  |  Branch (1041:31): [True: 0, False: 4.58k]
  |  Branch (1041:44): [True: 0, False: 4.58k]
  ------------------
 1042|  4.58k|                             clearsig);
 1043|  4.58k|      if (gpg_err_code (rc) == GPG_ERR_EACCES && !c->sigs_only)
  ------------------
  |  Branch (1043:11): [True: 0, False: 4.58k]
  |  Branch (1043:50): [True: 0, False: 0]
  ------------------
 1044|      0|        {
 1045|       |          /* Can't write output but we hash it anyway to check the
 1046|       |             signature. */
 1047|      0|          rc = handle_plaintext( pt, &c->mfx, 1, clearsig );
 1048|      0|        }
 1049|  4.58k|    }
 1050|       |
 1051|  67.6k|  if (rc)
  ------------------
  |  Branch (1051:7): [True: 64.2k, False: 3.39k]
  ------------------
 1052|  64.2k|    log_error ("handle plaintext failed: %s\n", gpg_strerror (rc));
 1053|       |
 1054|       |  /* We add a marker control packet instead of the plaintext packet.
 1055|       |   * This is so that we can later detect invalid packet sequences.
 1056|       |   * The packet is further used to convey extra data from the
 1057|       |   * plaintext packet to the signature verification. */
 1058|  67.6k|  extrahash = xtrymalloc (6 + pt->namelen);
  ------------------
  |  |   97|  67.6k|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
 1059|  67.6k|  if (!extrahash)
  ------------------
  |  Branch (1059:7): [True: 0, False: 67.6k]
  ------------------
 1060|      0|    {
 1061|       |      /* No way to return an error.  */
 1062|      0|      rc = gpg_error_from_syserror ();
 1063|      0|      log_error ("malloc failed in %s: %s\n", __func__, gpg_strerror (rc));
 1064|      0|      extrahashlen = 0;
 1065|      0|    }
 1066|  67.6k|  else
 1067|  67.6k|    {
 1068|  67.6k|      extrahash[0] = pt->mode;
 1069|  67.6k|      extrahash[1] = pt->namelen;
 1070|  67.6k|      if (pt->namelen)
  ------------------
  |  Branch (1070:11): [True: 37.0k, False: 30.5k]
  ------------------
 1071|  37.0k|        memcpy (extrahash+2, pt->name, pt->namelen);
 1072|  67.6k|      extrahashlen = 2 + pt->namelen;
 1073|  67.6k|      extrahash[extrahashlen++] = pt->timestamp >> 24;
 1074|  67.6k|      extrahash[extrahashlen++] = pt->timestamp >> 16;
 1075|  67.6k|      extrahash[extrahashlen++] = pt->timestamp >>  8;
 1076|  67.6k|      extrahash[extrahashlen++] = pt->timestamp      ;
 1077|  67.6k|    }
 1078|       |
 1079|  67.6k|  free_packet (pkt, NULL);
 1080|  67.6k|  c->last_was_session_key = 0;
 1081|       |
 1082|  67.6k|  n = new_kbnode (create_gpg_control (CTRLPKT_PLAINTEXT_MARK,
 1083|  67.6k|                                      extrahash, extrahashlen));
 1084|  67.6k|  xfree (extrahash);
  ------------------
  |  |  104|  67.6k|#define xfree(a)         gcry_free ((a))
  ------------------
 1085|  67.6k|  if (c->list)
  ------------------
  |  Branch (1085:7): [True: 59.9k, False: 7.70k]
  ------------------
 1086|  59.9k|    add_kbnode (c->list, n);
 1087|  7.70k|  else
 1088|  7.70k|    c->list = n;
 1089|  67.6k|}
mainproc.c:have_seen_pkt_encrypted_aead_or_mdc:
  916|  16.6k|{
  917|  16.6k|  CTX cc;
  918|       |
  919|   111k|  for (cc = c; cc; cc = cc->anchor)
  ------------------
  |  Branch (919:16): [True: 94.7k, False: 16.6k]
  ------------------
  920|  94.7k|    {
  921|  94.7k|      if (cc->seen_pkt_encrypted_aead)
  ------------------
  |  Branch (921:11): [True: 0, False: 94.7k]
  ------------------
  922|      0|	return 1;
  923|  94.7k|      if (cc->seen_pkt_encrypted_mdc)
  ------------------
  |  Branch (923:11): [True: 0, False: 94.7k]
  ------------------
  924|      0|	return 1;
  925|  94.7k|    }
  926|       |
  927|  16.6k|  return 0;
  928|  16.6k|}
mainproc.c:add_onepass_sig:
  170|  8.26k|{
  171|  8.26k|  kbnode_t node;
  172|       |
  173|  8.26k|  if (c->list) /* Add another packet. */
  ------------------
  |  Branch (173:7): [True: 3.79k, False: 4.47k]
  ------------------
  174|  3.79k|    add_kbnode (c->list, new_kbnode (pkt));
  175|  4.47k|  else /* Insert the first one.  */
  176|  4.47k|    c->list = node = new_kbnode (pkt);
  177|       |
  178|  8.26k|  return 1;
  179|  8.26k|}
mainproc.c:add_gpg_control:
  184|  8.58k|{
  185|  8.58k|  if ( pkt->pkt.gpg_control->control == CTRLPKT_CLEARSIGN_START )
  ------------------
  |  Branch (185:8): [True: 7.94k, False: 633]
  ------------------
  186|  7.94k|    {
  187|       |      /* New clear text signature.
  188|       |       * Process the last one and reset everything */
  189|  7.94k|      release_list(c);
  190|  7.94k|    }
  191|       |
  192|  8.58k|  if (c->list)  /* Add another packet.  */
  ------------------
  |  Branch (192:7): [True: 312, False: 8.26k]
  ------------------
  193|    312|    add_kbnode (c->list, new_kbnode (pkt));
  194|  8.26k|  else /* Insert the first one. */
  195|  8.26k|    c->list = new_kbnode (pkt);
  196|       |
  197|  8.58k|  return 1;
  198|  8.58k|}
mainproc.c:release_list:
  137|   295k|{
  138|   295k|  proc_tree (c, c->list);
  139|   295k|  release_kbnode (c->list);
  140|   295k|  while (c->pkenc_list)
  ------------------
  |  Branch (140:10): [True: 0, False: 295k]
  ------------------
  141|      0|    {
  142|      0|      struct pubkey_enc_list *tmp = c->pkenc_list->next;
  143|       |
  144|      0|      mpi_release (c->pkenc_list->data[0]);
  145|      0|      mpi_release (c->pkenc_list->data[1]);
  146|      0|      xfree (c->pkenc_list);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  147|      0|      c->pkenc_list = tmp;
  148|      0|    }
  149|   295k|  c->pkenc_list = NULL;
  150|   295k|  while (c->symenc_list)
  ------------------
  |  Branch (150:10): [True: 0, False: 295k]
  ------------------
  151|      0|    {
  152|      0|      struct symlist_item *tmp = c->symenc_list->next;
  153|      0|      xfree (c->symenc_list);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  154|      0|      c->symenc_list = tmp;
  155|      0|    }
  156|   295k|  c->symenc_list = NULL;
  157|   295k|  c->list = NULL;
  158|   295k|  c->any.data = 0;
  159|   295k|  c->any.uncompress_failed = 0;
  160|   295k|  c->last_was_session_key = 0;
  161|   295k|  c->seen_pkt_encrypted_aead = 0;
  162|   295k|  c->seen_pkt_encrypted_mdc = 0;
  163|   295k|  xfree (c->dek);
  ------------------
  |  |  104|   295k|#define xfree(a)         gcry_free ((a))
  ------------------
  164|   295k|  c->dek = NULL;
  165|   295k|}
mainproc.c:proc_tree:
 2574|   295k|{
 2575|   295k|  kbnode_t n1;
 2576|   295k|  int rc;
 2577|       |
 2578|   295k|  if (opt.list_packets || opt.list_only)
  ------------------
  |  Branch (2578:7): [True: 0, False: 295k]
  |  Branch (2578:27): [True: 0, False: 295k]
  ------------------
 2579|      0|    return;
 2580|       |
 2581|       |  /* We must skip our special plaintext marker packets here because
 2582|       |     they may be the root packet.  These packets are only used in
 2583|       |     additional checks and skipping them here doesn't matter.  */
 2584|   311k|  while (node
  ------------------
  |  Branch (2584:10): [True: 234k, False: 77.3k]
  ------------------
 2585|   311k|         && node->pkt->pkttype == PKT_GPG_CONTROL
  ------------------
  |  Branch (2585:13): [True: 24.1k, False: 210k]
  ------------------
 2586|   311k|          && node->pkt->pkt.gpg_control->control == CTRLPKT_PLAINTEXT_MARK)
  ------------------
  |  Branch (2586:14): [True: 15.8k, False: 8.27k]
  ------------------
 2587|  15.8k|    {
 2588|  15.8k|      node = node->next;
 2589|  15.8k|    }
 2590|   295k|  if (!node)
  ------------------
  |  Branch (2590:7): [True: 77.3k, False: 218k]
  ------------------
 2591|  77.3k|    return;
 2592|       |
 2593|   218k|  c->trustletter = ' ';
 2594|   218k|  if (node->pkt->pkttype == PKT_PUBLIC_KEY
  ------------------
  |  Branch (2594:7): [True: 0, False: 218k]
  ------------------
 2595|   218k|      || node->pkt->pkttype == PKT_PUBLIC_SUBKEY)
  ------------------
  |  Branch (2595:10): [True: 0, False: 218k]
  ------------------
 2596|      0|    {
 2597|      0|      merge_keys_and_selfsig (c->ctrl, node);
 2598|      0|      list_node (c, node);
 2599|      0|    }
 2600|   218k|  else if (node->pkt->pkttype == PKT_SECRET_KEY)
  ------------------
  |  Branch (2600:12): [True: 0, False: 218k]
  ------------------
 2601|      0|    {
 2602|      0|      merge_keys_and_selfsig (c->ctrl, node);
 2603|      0|      list_node (c, node);
 2604|      0|    }
 2605|   218k|  else if (node->pkt->pkttype == PKT_ONEPASS_SIG)
  ------------------
  |  Branch (2605:12): [True: 5.54k, False: 212k]
  ------------------
 2606|  5.54k|    {
 2607|       |      /* Check all signatures.  */
 2608|  5.54k|      if (!c->any.data)
  ------------------
  |  Branch (2608:11): [True: 2.14k, False: 3.40k]
  ------------------
 2609|  2.14k|        {
 2610|  2.14k|          int use_textmode = 0;
 2611|       |
 2612|  2.14k|          free_md_filter_context (&c->mfx);
 2613|       |          /* Prepare to create all requested message digests.  */
 2614|  2.14k|          rc = gcry_md_open (&c->mfx.md, 0, 0);
 2615|  2.14k|          if (rc)
  ------------------
  |  Branch (2615:15): [True: 0, False: 2.14k]
  ------------------
 2616|      0|            goto hash_err;
 2617|       |
 2618|       |          /* Fixme: why looking for the signature packet and not the
 2619|       |             one-pass packet?  */
 2620|  3.91k|          for (n1 = node; (n1 = find_next_kbnode (n1, PKT_SIGNATURE));)
  ------------------
  |  Branch (2620:27): [True: 1.76k, False: 2.14k]
  ------------------
 2621|  1.76k|            gcry_md_enable (c->mfx.md, n1->pkt->pkt.signature->digest_algo);
 2622|       |
 2623|  2.14k|          if (n1 && n1->pkt->pkt.onepass_sig->sig_class == 0x01)
  ------------------
  |  Branch (2623:15): [True: 0, False: 2.14k]
  |  Branch (2623:21): [True: 0, False: 0]
  ------------------
 2624|      0|            use_textmode = 1;
 2625|       |
 2626|       |          /* Ask for file and hash it. */
 2627|  2.14k|          if (c->sigs_only)
  ------------------
  |  Branch (2627:15): [True: 2.14k, False: 0]
  ------------------
 2628|  2.14k|            {
 2629|  2.14k|              if (c->signed_data.used && c->signed_data.data_fd != -1)
  ------------------
  |  Branch (2629:19): [True: 0, False: 2.14k]
  |  Branch (2629:42): [True: 0, False: 0]
  ------------------
 2630|      0|                rc = hash_datafile_by_fd (c->mfx.md, NULL,
 2631|      0|                                          c->signed_data.data_fd,
 2632|      0|                                          use_textmode);
 2633|  2.14k|              else
 2634|  2.14k|                rc = hash_datafiles (c->mfx.md, NULL,
 2635|  2.14k|                                     c->signed_data.data_names,
 2636|  2.14k|                                     c->sigfilename,
 2637|  2.14k|                                     use_textmode);
 2638|  2.14k|	    }
 2639|      0|          else
 2640|      0|            {
 2641|      0|              rc = ask_for_detached_datafile (c->mfx.md, NULL,
 2642|      0|                                              iobuf_get_real_fname (c->iobuf),
 2643|      0|                                              use_textmode);
 2644|      0|	    }
 2645|       |
 2646|  2.14k|        hash_err:
 2647|  2.14k|          if (rc)
  ------------------
  |  Branch (2647:15): [True: 2.14k, False: 0]
  ------------------
 2648|  2.14k|            {
 2649|  2.14k|              log_error ("can't hash datafile: %s\n", gpg_strerror (rc));
 2650|  2.14k|              return;
 2651|  2.14k|	    }
 2652|  2.14k|	}
 2653|  3.40k|      else if (c->signed_data.used)
  ------------------
  |  Branch (2653:16): [True: 0, False: 3.40k]
  ------------------
 2654|      0|        {
 2655|      0|          log_error (_("not a detached signature\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2656|      0|          return;
 2657|      0|        }
 2658|       |
 2659|  8.31k|      for (n1 = node; (n1 = find_next_kbnode (n1, PKT_SIGNATURE));)
  ------------------
  |  Branch (2659:23): [True: 4.91k, False: 3.40k]
  ------------------
 2660|  4.91k|        check_sig_and_print (c, n1);
 2661|       |
 2662|  3.40k|    }
 2663|   212k|  else if (node->pkt->pkttype == PKT_GPG_CONTROL
  ------------------
  |  Branch (2663:12): [True: 8.27k, False: 204k]
  ------------------
 2664|   212k|           && node->pkt->pkt.gpg_control->control == CTRLPKT_CLEARSIGN_START)
  ------------------
  |  Branch (2664:15): [True: 7.94k, False: 323]
  ------------------
 2665|  7.94k|    {
 2666|       |      /* Clear text signed message.  */
 2667|  7.94k|      if (!c->any.data)
  ------------------
  |  Branch (2667:11): [True: 1.90k, False: 6.04k]
  ------------------
 2668|  1.90k|        {
 2669|  1.90k|          log_error ("cleartext signature without data\n");
 2670|  1.90k|          return;
 2671|  1.90k|        }
 2672|  6.04k|      else if (c->signed_data.used)
  ------------------
  |  Branch (2672:16): [True: 0, False: 6.04k]
  ------------------
 2673|      0|        {
 2674|      0|          log_error (_("not a detached signature\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2675|      0|          return;
 2676|      0|        }
 2677|       |
 2678|  12.9k|      for (n1 = node; (n1 = find_next_kbnode (n1, PKT_SIGNATURE));)
  ------------------
  |  Branch (2678:23): [True: 6.90k, False: 6.04k]
  ------------------
 2679|  6.90k|        check_sig_and_print (c, n1);
 2680|       |
 2681|  6.04k|    }
 2682|   204k|  else if (node->pkt->pkttype == PKT_SIGNATURE)
  ------------------
  |  Branch (2682:12): [True: 204k, False: 323]
  ------------------
 2683|   204k|    {
 2684|   204k|      PKT_signature *sig = node->pkt->pkt.signature;
 2685|   204k|      int multiple_ok = 1;
 2686|       |
 2687|   204k|      n1 = find_next_kbnode (node, PKT_SIGNATURE);
 2688|   204k|      if (n1)
  ------------------
  |  Branch (2688:11): [True: 43.7k, False: 160k]
  ------------------
 2689|  43.7k|        {
 2690|  43.7k|          byte class = sig->sig_class;
 2691|  43.7k|          byte hash  = sig->digest_algo;
 2692|       |
 2693|   125k|          for (; n1; (n1 = find_next_kbnode(n1, PKT_SIGNATURE)))
  ------------------
  |  Branch (2693:18): [True: 90.8k, False: 34.6k]
  ------------------
 2694|  90.8k|            {
 2695|       |              /* We can't currently handle multiple signatures of
 2696|       |               * different classes (we'd pretty much have to run a
 2697|       |               * different hash context for each), but if they are all
 2698|       |               * the same and it is detached signature, we make an
 2699|       |               * exception.  Note that the old code also disallowed
 2700|       |               * multiple signatures if the digest algorithms are
 2701|       |               * different.  We softened this restriction only for
 2702|       |               * detached signatures, to be on the safe side. */
 2703|  90.8k|              if (n1->pkt->pkt.signature->sig_class != class
  ------------------
  |  Branch (2703:19): [True: 8.63k, False: 82.2k]
  ------------------
 2704|  90.8k|                  || (c->any.data
  ------------------
  |  Branch (2704:23): [True: 14.8k, False: 67.3k]
  ------------------
 2705|  82.2k|                      && n1->pkt->pkt.signature->digest_algo != hash))
  ------------------
  |  Branch (2705:26): [True: 425, False: 14.4k]
  ------------------
 2706|  9.06k|                {
 2707|  9.06k|                  multiple_ok = 0;
 2708|  9.06k|                  log_info (_("WARNING: multiple signatures detected.  "
  ------------------
  |  |   28|  9.06k|#  define _(a) gettext (a)
  ------------------
 2709|  9.06k|                              "Only the first will be checked.\n"));
 2710|  9.06k|                  break;
 2711|  9.06k|                }
 2712|  90.8k|            }
 2713|  43.7k|        }
 2714|       |
 2715|   204k|      if (sig->sig_class != 0x00 && sig->sig_class != 0x01)
  ------------------
  |  Branch (2715:11): [True: 12.0k, False: 192k]
  |  Branch (2715:37): [True: 10.7k, False: 1.31k]
  ------------------
 2716|  10.7k|        {
 2717|  10.7k|          log_info(_("standalone signature of class 0x%02x\n"), sig->sig_class);
  ------------------
  |  |   28|  10.7k|#  define _(a) gettext (a)
  ------------------
 2718|  10.7k|        }
 2719|   193k|      else if (!c->any.data)
  ------------------
  |  Branch (2719:16): [True: 181k, False: 12.2k]
  ------------------
 2720|   181k|        {
 2721|       |          /* Detached signature */
 2722|   181k|          free_md_filter_context (&c->mfx);
 2723|   181k|          rc = gcry_md_open (&c->mfx.md, sig->digest_algo, 0);
 2724|   181k|          if (rc)
  ------------------
  |  Branch (2724:15): [True: 1.03k, False: 180k]
  ------------------
 2725|  1.03k|            goto detached_hash_err;
 2726|       |
 2727|   180k|          if (multiple_ok)
  ------------------
  |  Branch (2727:15): [True: 174k, False: 6.27k]
  ------------------
 2728|   174k|            {
 2729|       |              /* If we have and want to handle multiple signatures we
 2730|       |               * need to enable all hash algorithms for the context.  */
 2731|   229k|              for (n1 = node; (n1 = find_next_kbnode (n1, PKT_SIGNATURE)); )
  ------------------
  |  Branch (2731:31): [True: 55.0k, False: 174k]
  ------------------
 2732|  55.0k|                if (!openpgp_md_test_algo (n1->pkt->pkt.signature->digest_algo))
  ------------------
  |  Branch (2732:21): [True: 2.85k, False: 52.1k]
  ------------------
 2733|  2.85k|                  gcry_md_enable (c->mfx.md,
 2734|  2.85k|                                  map_md_openpgp_to_gcry
 2735|  2.85k|                                  (n1->pkt->pkt.signature->digest_algo));
 2736|   174k|            }
 2737|       |
 2738|   180k|          if (RFC2440 || RFC4880)
  ------------------
  |  |  373|   360k|#define RFC2440 (opt.compliance==CO_RFC2440)
  |  |  ------------------
  |  |  |  Branch (373:17): [True: 0, False: 180k]
  |  |  ------------------
  ------------------
                        if (RFC2440 || RFC4880)
  ------------------
  |  |  374|   180k|#define RFC4880 (opt.compliance==CO_RFC4880)
  |  |  ------------------
  |  |  |  Branch (374:17): [True: 0, False: 180k]
  |  |  ------------------
  ------------------
 2739|      0|            ; /* Strict RFC mode.  */
 2740|   180k|          else if (sig->digest_algo == DIGEST_ALGO_SHA1
  ------------------
  |  Branch (2740:20): [True: 5.74k, False: 174k]
  ------------------
 2741|   180k|                   && sig->pubkey_algo == PUBKEY_ALGO_DSA
  ------------------
  |  Branch (2741:23): [True: 4.69k, False: 1.04k]
  ------------------
 2742|   180k|                   && sig->sig_class == 0x01)
  ------------------
  |  Branch (2742:23): [True: 430, False: 4.26k]
  ------------------
 2743|    430|            {
 2744|       |              /* Enable a workaround for a pgp5 bug when the detached
 2745|       |               * signature has been created in textmode.  Note that we
 2746|       |               * do not implement this for multiple signatures with
 2747|       |               * different hash algorithms. */
 2748|    430|              rc = gcry_md_open (&c->mfx.md2, sig->digest_algo, 0);
 2749|    430|              if (rc)
  ------------------
  |  Branch (2749:19): [True: 0, False: 430]
  ------------------
 2750|      0|                goto detached_hash_err;
 2751|    430|	    }
 2752|       |
 2753|       |          /* Here we used to have another hack to work around a pgp
 2754|       |           * 2 bug: It worked by not using the textmode for detached
 2755|       |           * signatures; this would let the first signature check
 2756|       |           * (on md) fail but the second one (on md2), which adds an
 2757|       |           * extra CR would then have produced the "correct" hash.
 2758|       |           * This is very, very ugly hack but it may haved help in
 2759|       |           * some cases (and break others).
 2760|       |           *	 c->mfx.md2? 0 :(sig->sig_class == 0x01)
 2761|       |           */
 2762|       |
 2763|   180k|          if (DBG_HASHING)
  ------------------
  |  |  354|   180k|#define DBG_HASHING (opt.debug & DBG_HASHING_VALUE)
  |  |  ------------------
  |  |  |  |  341|   180k|#define DBG_HASHING_VALUE 512	/* debug hashing operations */
  |  |  ------------------
  |  |  |  Branch (354:21): [True: 0, False: 180k]
  |  |  ------------------
  ------------------
 2764|      0|            {
 2765|      0|              gcry_md_debug (c->mfx.md, "verify");
 2766|      0|              if (c->mfx.md2)
  ------------------
  |  Branch (2766:19): [True: 0, False: 0]
  ------------------
 2767|      0|                gcry_md_debug (c->mfx.md2, "verify2");
 2768|      0|            }
 2769|       |
 2770|   180k|          if (c->sigs_only)
  ------------------
  |  Branch (2770:15): [True: 180k, False: 0]
  ------------------
 2771|   180k|            {
 2772|   180k|              if (c->signed_data.used && c->signed_data.data_fd != -1)
  ------------------
  |  Branch (2772:19): [True: 0, False: 180k]
  |  Branch (2772:42): [True: 0, False: 0]
  ------------------
 2773|      0|                rc = hash_datafile_by_fd (c->mfx.md, c->mfx.md2,
 2774|      0|                                          c->signed_data.data_fd,
 2775|      0|                                          (sig->sig_class == 0x01));
 2776|   180k|              else
 2777|   180k|                rc = hash_datafiles (c->mfx.md, c->mfx.md2,
 2778|   180k|                                     c->signed_data.data_names,
 2779|   180k|                                     c->sigfilename,
 2780|   180k|                                     (sig->sig_class == 0x01));
 2781|   180k|	    }
 2782|      0|          else
 2783|      0|            {
 2784|      0|              rc = ask_for_detached_datafile (c->mfx.md, c->mfx.md2,
 2785|      0|                                              iobuf_get_real_fname(c->iobuf),
 2786|      0|                                              (sig->sig_class == 0x01));
 2787|      0|	    }
 2788|       |
 2789|   181k|        detached_hash_err:
 2790|   181k|          if (rc)
  ------------------
  |  Branch (2790:15): [True: 181k, False: 0]
  ------------------
 2791|   181k|            {
 2792|   181k|              log_error ("can't hash datafile: %s\n", gpg_strerror (rc));
 2793|   181k|              return;
 2794|   181k|	    }
 2795|   181k|	}
 2796|  12.2k|      else if (c->signed_data.used)
  ------------------
  |  Branch (2796:16): [True: 0, False: 12.2k]
  ------------------
 2797|      0|        {
 2798|      0|          log_error (_("not a detached signature\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2799|      0|          return;
 2800|      0|        }
 2801|  12.2k|      else if (!opt.quiet)
  ------------------
  |  Branch (2801:16): [True: 12.2k, False: 0]
  ------------------
 2802|  12.2k|        log_info (_("old style (PGP 2.x) signature\n"));
  ------------------
  |  |   28|  12.2k|#  define _(a) gettext (a)
  ------------------
 2803|       |
 2804|  22.9k|      if (multiple_ok)
  ------------------
  |  Branch (2804:11): [True: 20.2k, False: 2.73k]
  ------------------
 2805|  20.2k|        {
 2806|  64.3k|          for (n1 = node; n1; (n1 = find_next_kbnode(n1, PKT_SIGNATURE)))
  ------------------
  |  Branch (2806:27): [True: 44.0k, False: 20.2k]
  ------------------
 2807|  44.0k|	    check_sig_and_print (c, n1);
 2808|  20.2k|        }
 2809|  2.73k|      else
 2810|  2.73k|        check_sig_and_print (c, node);
 2811|       |
 2812|  22.9k|    }
 2813|    323|  else
 2814|    323|    {
 2815|    323|      dump_kbnode (c->list);
 2816|    323|      log_error ("invalid root packet detected in proc_tree()\n");
 2817|    323|      dump_kbnode (node);
 2818|    323|    }
 2819|   218k|}
mainproc.c:do_check_sig:
 1159|  49.0k|{
 1160|  49.0k|  PKT_signature *sig;
 1161|  49.0k|  gcry_md_hd_t md = NULL;
 1162|  49.0k|  gcry_md_hd_t md2 = NULL;
 1163|  49.0k|  gcry_md_hd_t md_good = NULL;
 1164|  49.0k|  int algo, rc;
 1165|       |
 1166|  49.0k|  if (r_pk)
  ------------------
  |  Branch (1166:7): [True: 49.0k, False: 0]
  ------------------
 1167|  49.0k|    *r_pk = NULL;
 1168|       |
 1169|  49.0k|  log_assert (node->pkt->pkttype == PKT_SIGNATURE);
 1170|  49.0k|  if (is_selfsig)
  ------------------
  |  Branch (1170:7): [True: 0, False: 49.0k]
  ------------------
 1171|      0|    *is_selfsig = 0;
 1172|  49.0k|  sig = node->pkt->pkt.signature;
 1173|       |
 1174|  49.0k|  algo = sig->digest_algo;
 1175|  49.0k|  rc = openpgp_md_test_algo (algo);
 1176|  49.0k|  if (rc)
  ------------------
  |  Branch (1176:7): [True: 19.9k, False: 29.0k]
  ------------------
 1177|  19.9k|    return rc;
 1178|       |
 1179|  29.0k|  if (sig->sig_class == 0x00)
  ------------------
  |  Branch (1179:7): [True: 13.3k, False: 15.6k]
  ------------------
 1180|  13.3k|    {
 1181|  13.3k|      if (c->mfx.md)
  ------------------
  |  Branch (1181:11): [True: 13.3k, False: 0]
  ------------------
 1182|  13.3k|        {
 1183|  13.3k|          if (gcry_md_copy (&md, c->mfx.md ))
  ------------------
  |  Branch (1183:15): [True: 0, False: 13.3k]
  ------------------
 1184|      0|            BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1185|  13.3k|        }
 1186|      0|      else /* detached signature */
 1187|      0|        {
 1188|       |          /* check_signature() will enable the md. */
 1189|      0|          if (gcry_md_open (&md, 0, 0 ))
  ------------------
  |  Branch (1189:15): [True: 0, False: 0]
  ------------------
 1190|      0|            BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1191|      0|        }
 1192|  13.3k|    }
 1193|  15.6k|  else if (sig->sig_class == 0x01)
  ------------------
  |  Branch (1193:12): [True: 2.83k, False: 12.8k]
  ------------------
 1194|  2.83k|    {
 1195|       |      /* How do we know that we have to hash the (already hashed) text
 1196|       |         in canonical mode ??? (calculating both modes???) */
 1197|  2.83k|      if (c->mfx.md)
  ------------------
  |  Branch (1197:11): [True: 2.83k, False: 0]
  ------------------
 1198|  2.83k|        {
 1199|  2.83k|          if (gcry_md_copy (&md, c->mfx.md ))
  ------------------
  |  Branch (1199:15): [True: 0, False: 2.83k]
  ------------------
 1200|      0|            BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1201|  2.83k|          if (c->mfx.md2 && gcry_md_copy (&md2, c->mfx.md2))
  ------------------
  |  Branch (1201:15): [True: 0, False: 2.83k]
  |  Branch (1201:29): [True: 0, False: 0]
  ------------------
 1202|      0|            BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1203|  2.83k|	}
 1204|      0|      else /* detached signature */
 1205|      0|        {
 1206|      0|          log_debug ("Do we really need this here?");
 1207|       |          /* check_signature() will enable the md*/
 1208|      0|          if (gcry_md_open (&md, 0, 0 ))
  ------------------
  |  Branch (1208:15): [True: 0, False: 0]
  ------------------
 1209|      0|            BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1210|      0|          if (gcry_md_open (&md2, 0, 0 ))
  ------------------
  |  Branch (1210:15): [True: 0, False: 0]
  ------------------
 1211|      0|            BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1212|      0|	}
 1213|  2.83k|    }
 1214|  12.8k|  else if ((sig->sig_class&~3) == 0x10
  ------------------
  |  Branch (1214:12): [True: 559, False: 12.3k]
  ------------------
 1215|  12.8k|           ||   sig->sig_class == 0x18
  ------------------
  |  Branch (1215:17): [True: 238, False: 12.0k]
  ------------------
 1216|  12.8k|           ||   sig->sig_class == 0x1f
  ------------------
  |  Branch (1216:17): [True: 748, False: 11.3k]
  ------------------
 1217|  12.8k|	   ||   sig->sig_class == 0x20
  ------------------
  |  Branch (1217:10): [True: 698, False: 10.6k]
  ------------------
 1218|  12.8k|	   ||   sig->sig_class == 0x28
  ------------------
  |  Branch (1218:10): [True: 372, False: 10.2k]
  ------------------
 1219|  12.8k|           ||   sig->sig_class == 0x30)
  ------------------
  |  Branch (1219:17): [True: 359, False: 9.89k]
  ------------------
 1220|  2.97k|    {
 1221|  2.97k|      if (c->list->pkt->pkttype == PKT_PUBLIC_KEY
  ------------------
  |  Branch (1221:11): [True: 0, False: 2.97k]
  ------------------
 1222|  2.97k|          || c->list->pkt->pkttype == PKT_PUBLIC_SUBKEY)
  ------------------
  |  Branch (1222:14): [True: 0, False: 2.97k]
  ------------------
 1223|      0|        {
 1224|      0|          return check_key_signature (c->ctrl, c->list, node, is_selfsig);
 1225|      0|	}
 1226|  2.97k|      else if (sig->sig_class == 0x20)
  ------------------
  |  Branch (1226:16): [True: 698, False: 2.27k]
  ------------------
 1227|    698|        {
 1228|    698|          log_error (_("standalone revocation - "
  ------------------
  |  |   28|    698|#  define _(a) gettext (a)
  ------------------
 1229|    698|                       "use \"gpg --import\" to apply\n"));
 1230|    698|          return GPG_ERR_NOT_PROCESSED;
 1231|    698|	}
 1232|  2.27k|      else
 1233|  2.27k|        {
 1234|  2.27k|          log_error ("invalid root packet for sigclass %02x\n", sig->sig_class);
 1235|  2.27k|          return GPG_ERR_SIG_CLASS;
 1236|  2.27k|	}
 1237|  2.97k|    }
 1238|  9.89k|  else
 1239|  9.89k|    return GPG_ERR_SIG_CLASS;
 1240|       |
 1241|       |  /* We only get here if we are checking the signature of a binary
 1242|       |     (0x00) or text document (0x01).  */
 1243|  16.2k|  rc = check_signature2 (c->ctrl, sig, md, extrahash, extrahashlen,
 1244|  16.2k|                         forced_pk,
 1245|  16.2k|                         NULL, is_expkey, is_revkey, r_pk);
 1246|  16.2k|  if (! rc)
  ------------------
  |  Branch (1246:7): [True: 0, False: 16.2k]
  ------------------
 1247|      0|    md_good = md;
 1248|  16.2k|  else if (gpg_err_code (rc) == GPG_ERR_BAD_SIGNATURE && md2)
  ------------------
  |  Branch (1248:12): [True: 0, False: 16.2k]
  |  Branch (1248:58): [True: 0, False: 0]
  ------------------
 1249|      0|    {
 1250|      0|      PKT_public_key *pk2;
 1251|       |
 1252|      0|      rc = check_signature2 (c->ctrl, sig, md2, extrahash, extrahashlen,
 1253|      0|                             forced_pk,
 1254|      0|                             NULL, is_expkey, is_revkey,
 1255|      0|                             r_pk? &pk2 : NULL);
  ------------------
  |  Branch (1255:30): [True: 0, False: 0]
  ------------------
 1256|      0|      if (!rc)
  ------------------
  |  Branch (1256:11): [True: 0, False: 0]
  ------------------
 1257|      0|        {
 1258|      0|          md_good = md2;
 1259|      0|          if (r_pk)
  ------------------
  |  Branch (1259:15): [True: 0, False: 0]
  ------------------
 1260|      0|            {
 1261|      0|              free_public_key (*r_pk);
 1262|      0|              *r_pk = pk2;
 1263|      0|            }
 1264|      0|        }
 1265|      0|    }
 1266|       |
 1267|  16.2k|  if (md_good)
  ------------------
  |  Branch (1267:7): [True: 0, False: 16.2k]
  ------------------
 1268|      0|    {
 1269|      0|      unsigned char *buffer = gcry_md_read (md_good, sig->digest_algo);
 1270|      0|      sig->digest_len = gcry_md_get_algo_dlen (map_md_openpgp_to_gcry (algo));
 1271|      0|      memcpy (sig->digest, buffer, sig->digest_len);
 1272|      0|    }
 1273|       |
 1274|  16.2k|  gcry_md_close (md);
 1275|  16.2k|  gcry_md_close (md2);
 1276|       |
 1277|  16.2k|  return rc;
 1278|  29.0k|}
mainproc.c:check_sig_and_print:
 1868|  58.6k|{
 1869|  58.6k|  PKT_signature *sig = node->pkt->pkt.signature;
 1870|  58.6k|  const char *astr;
 1871|  58.6k|  gpg_error_t rc;
 1872|  58.6k|  int is_expkey = 0;
 1873|  58.6k|  int is_revkey = 0;
 1874|  58.6k|  char *issuer_fpr = NULL;
 1875|  58.6k|  PKT_public_key *pk = NULL;  /* The public key for the signature or NULL. */
 1876|  58.6k|  const void *extrahash = NULL;
 1877|  58.6k|  size_t extrahashlen = 0;
 1878|  58.6k|  kbnode_t included_keyblock = NULL;
 1879|       |
 1880|  58.6k|  if (opt.skip_verify)
  ------------------
  |  Branch (1880:7): [True: 0, False: 58.6k]
  ------------------
 1881|      0|    {
 1882|      0|      log_info(_("signature verification suppressed\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 1883|      0|      return 0;
 1884|      0|    }
 1885|       |
 1886|       |  /* Check that the message composition is valid.
 1887|       |   *
 1888|       |   * Per RFC-2440bis (-15) allowed:
 1889|       |   *
 1890|       |   * S{1,n}           -- detached signature.
 1891|       |   * S{1,n} P         -- old style PGP2 signature
 1892|       |   * O{1,n} P S{1,n}  -- standard OpenPGP signature.
 1893|       |   * C P S{1,n}       -- cleartext signature.
 1894|       |   *
 1895|       |   *
 1896|       |   *      O = One-Pass Signature packet.
 1897|       |   *      S = Signature packet.
 1898|       |   *      P = OpenPGP Message packet (Encrypted | Compressed | Literal)
 1899|       |   *             (Note that the current rfc2440bis draft also allows
 1900|       |   *              for a signed message but that does not work as it
 1901|       |   *              introduces ambiguities.)
 1902|       |   *          We keep track of these packages using the marker packet
 1903|       |   *          CTRLPKT_PLAINTEXT_MARK.
 1904|       |   *      C = Marker packet for cleartext signatures.
 1905|       |   *
 1906|       |   * We reject all other messages.
 1907|       |   *
 1908|       |   * Actually we are calling this too often, i.e. for verification of
 1909|       |   * each message but better have some duplicate work than to silently
 1910|       |   * introduce a bug here.
 1911|       |   */
 1912|  58.6k|  {
 1913|  58.6k|    kbnode_t n;
 1914|  58.6k|    int n_onepass, n_sig;
 1915|       |
 1916|       |/*     log_debug ("checking signature packet composition\n"); */
 1917|       |/*     dump_kbnode (c->list); */
 1918|       |
 1919|  58.6k|    n = c->list;
 1920|  58.6k|    log_assert (n);
 1921|  58.6k|    if ( n->pkt->pkttype == PKT_SIGNATURE )
  ------------------
  |  Branch (1921:10): [True: 45.3k, False: 13.2k]
  ------------------
 1922|  45.3k|      {
 1923|       |        /* This is either "S{1,n}" case (detached signature) or
 1924|       |           "S{1,n} P" (old style PGP2 signature). */
 1925|   709k|        for (n = n->next; n; n = n->next)
  ------------------
  |  Branch (1925:27): [True: 690k, False: 19.2k]
  ------------------
 1926|   690k|          if (n->pkt->pkttype != PKT_SIGNATURE)
  ------------------
  |  Branch (1926:15): [True: 26.1k, False: 664k]
  ------------------
 1927|  26.1k|            break;
 1928|  45.3k|        if (!n)
  ------------------
  |  Branch (1928:13): [True: 19.2k, False: 26.1k]
  ------------------
 1929|  19.2k|          ; /* Okay, this is a detached signature.  */
 1930|  26.1k|        else if (n->pkt->pkttype == PKT_GPG_CONTROL
  ------------------
  |  Branch (1930:18): [True: 25.4k, False: 619]
  ------------------
 1931|  26.1k|                 && (n->pkt->pkt.gpg_control->control
  ------------------
  |  Branch (1931:21): [True: 25.2k, False: 207]
  ------------------
 1932|  25.4k|                     == CTRLPKT_PLAINTEXT_MARK) )
 1933|  25.2k|          {
 1934|  25.2k|            if (n->next)
  ------------------
  |  Branch (1934:17): [True: 4.23k, False: 21.0k]
  ------------------
 1935|  4.23k|              goto ambiguous;  /* We only allow one P packet. */
 1936|  21.0k|            extrahash = n->pkt->pkt.gpg_control->data;
 1937|  21.0k|            extrahashlen = n->pkt->pkt.gpg_control->datalen;
 1938|  21.0k|          }
 1939|    826|        else
 1940|    826|          goto ambiguous;
 1941|  45.3k|      }
 1942|  13.2k|    else if (n->pkt->pkttype == PKT_ONEPASS_SIG)
  ------------------
  |  Branch (1942:14): [True: 4.73k, False: 8.52k]
  ------------------
 1943|  4.73k|      {
 1944|       |        /* This is the "O{1,n} P S{1,n}" case (standard signature). */
 1945|  4.73k|        for (n_onepass=1, n = n->next;
 1946|  5.33k|             n && n->pkt->pkttype == PKT_ONEPASS_SIG; n = n->next)
  ------------------
  |  Branch (1946:14): [True: 5.33k, False: 0]
  |  Branch (1946:19): [True: 603, False: 4.73k]
  ------------------
 1947|    603|          n_onepass++;
 1948|  4.73k|        if (!n || !(n->pkt->pkttype == PKT_GPG_CONTROL
  ------------------
  |  Branch (1948:13): [True: 0, False: 4.73k]
  |  Branch (1948:21): [True: 3.13k, False: 1.59k]
  ------------------
 1949|  4.73k|                    && (n->pkt->pkt.gpg_control->control
  ------------------
  |  Branch (1949:24): [True: 3.10k, False: 34]
  ------------------
 1950|  3.13k|                        == CTRLPKT_PLAINTEXT_MARK)))
 1951|  1.62k|          goto ambiguous;
 1952|  3.10k|        extrahash = n->pkt->pkt.gpg_control->data;
 1953|  3.10k|        extrahashlen = n->pkt->pkt.gpg_control->datalen;
 1954|       |
 1955|  3.10k|        for (n_sig=0, n = n->next;
 1956|  32.3k|             n && n->pkt->pkttype == PKT_SIGNATURE; n = n->next)
  ------------------
  |  Branch (1956:14): [True: 31.6k, False: 763]
  |  Branch (1956:19): [True: 29.2k, False: 2.34k]
  ------------------
 1957|  29.2k|          n_sig++;
 1958|  3.10k|        if (!n_sig)
  ------------------
  |  Branch (1958:13): [True: 347, False: 2.75k]
  ------------------
 1959|    347|          goto ambiguous;
 1960|       |
 1961|       |	/* If we wanted to disallow multiple sig verification, we'd do
 1962|       |	 * something like this:
 1963|       |         *
 1964|       |	 * if (n)
 1965|       |         *   goto ambiguous;
 1966|       |         *
 1967|       |         * However, this can stay allowable as we can't get here.  */
 1968|       |
 1969|  2.75k|        if (n_onepass != n_sig)
  ------------------
  |  Branch (1969:13): [True: 684, False: 2.07k]
  ------------------
 1970|    684|          {
 1971|    684|            log_info ("number of one-pass packets does not match "
 1972|    684|                      "number of signature packets\n");
 1973|    684|            goto ambiguous;
 1974|    684|          }
 1975|  2.75k|      }
 1976|  8.52k|    else if (n->pkt->pkttype == PKT_GPG_CONTROL
  ------------------
  |  Branch (1976:14): [True: 8.52k, False: 0]
  ------------------
 1977|  8.52k|             && n->pkt->pkt.gpg_control->control == CTRLPKT_CLEARSIGN_START )
  ------------------
  |  Branch (1977:17): [True: 6.90k, False: 1.61k]
  ------------------
 1978|  6.90k|      {
 1979|       |        /* This is the "C P S{1,n}" case (clear text signature). */
 1980|  6.90k|        n = n->next;
 1981|  6.90k|        if (!n || !(n->pkt->pkttype == PKT_GPG_CONTROL
  ------------------
  |  Branch (1981:13): [True: 0, False: 6.90k]
  |  Branch (1981:21): [True: 6.90k, False: 0]
  ------------------
 1982|  6.90k|                    && (n->pkt->pkt.gpg_control->control
  ------------------
  |  Branch (1982:24): [True: 6.90k, False: 0]
  ------------------
 1983|  6.90k|                        == CTRLPKT_PLAINTEXT_MARK)))
 1984|      0|          goto ambiguous;
 1985|  6.90k|        extrahash = n->pkt->pkt.gpg_control->data;
 1986|  6.90k|        extrahashlen = n->pkt->pkt.gpg_control->datalen;
 1987|  6.90k|        for (n_sig=0, n = n->next;
 1988|   155k|             n && n->pkt->pkttype == PKT_SIGNATURE; n = n->next)
  ------------------
  |  Branch (1988:14): [True: 149k, False: 6.69k]
  |  Branch (1988:19): [True: 148k, False: 212]
  ------------------
 1989|   148k|          n_sig++;
 1990|  6.90k|        if (n || !n_sig)
  ------------------
  |  Branch (1990:13): [True: 212, False: 6.69k]
  |  Branch (1990:18): [True: 0, False: 6.69k]
  ------------------
 1991|    212|          goto ambiguous;
 1992|  6.90k|      }
 1993|  1.61k|    else
 1994|  1.61k|      {
 1995|  9.54k|      ambiguous:
 1996|  9.54k|        log_error(_("can't handle this ambiguous signature data\n"));
  ------------------
  |  |   28|  9.54k|#  define _(a) gettext (a)
  ------------------
 1997|  9.54k|        return 0;
 1998|  1.61k|      }
 1999|  58.6k|  } /* End checking signature packet composition.  */
 2000|       |
 2001|  49.0k|  if (sig->signers_uid)
  ------------------
  |  Branch (2001:7): [True: 7.46k, False: 41.6k]
  ------------------
 2002|  7.46k|    write_status_buffer (STATUS_NEWSIG,
 2003|  7.46k|                         sig->signers_uid, strlen (sig->signers_uid), 0);
 2004|  41.6k|  else
 2005|  41.6k|    write_status_text (STATUS_NEWSIG, NULL);
 2006|       |
 2007|  49.0k|  astr = openpgp_pk_algo_name ( sig->pubkey_algo );
 2008|  49.0k|  issuer_fpr = issuer_fpr_string (sig);
 2009|       |
 2010|  49.0k|  if (issuer_fpr)
  ------------------
  |  Branch (2010:7): [True: 4.25k, False: 44.8k]
  ------------------
 2011|  4.25k|    {
 2012|  4.25k|      log_info (_("Signature made %s\n"), asctimestamp(sig->timestamp));
  ------------------
  |  |   28|  4.25k|#  define _(a) gettext (a)
  ------------------
 2013|  4.25k|      log_info (_("               using %s key %s\n"),
  ------------------
  |  |   28|  4.25k|#  define _(a) gettext (a)
  ------------------
 2014|  4.25k|                astr? astr: "?", issuer_fpr);
  ------------------
  |  Branch (2014:17): [True: 4.25k, False: 0]
  ------------------
 2015|       |
 2016|  4.25k|    }
 2017|  44.8k|  else if (!keystrlen () || keystrlen () > 8)
  ------------------
  |  Branch (2017:12): [True: 44.8k, False: 0]
  |  Branch (2017:29): [True: 0, False: 0]
  ------------------
 2018|  44.8k|    {
 2019|  44.8k|      log_info (_("Signature made %s\n"), asctimestamp(sig->timestamp));
  ------------------
  |  |   28|  44.8k|#  define _(a) gettext (a)
  ------------------
 2020|  44.8k|      log_info (_("               using %s key %s\n"),
  ------------------
  |  |   28|  44.8k|#  define _(a) gettext (a)
  ------------------
 2021|  44.8k|                astr? astr: "?", keystr(sig->keyid));
  ------------------
  |  Branch (2021:17): [True: 44.8k, False: 0]
  ------------------
 2022|  44.8k|    }
 2023|      0|  else /* Legacy format.  */
 2024|      0|    log_info (_("Signature made %s using %s key ID %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2025|      0|              asctimestamp(sig->timestamp), astr? astr: "?",
  ------------------
  |  Branch (2025:45): [True: 0, False: 0]
  ------------------
 2026|      0|              keystr(sig->keyid));
 2027|       |
 2028|       |  /* In verbose mode print the signers UID.  */
 2029|  49.0k|  if (sig->signers_uid)
  ------------------
  |  Branch (2029:7): [True: 7.46k, False: 41.6k]
  ------------------
 2030|  7.46k|    log_info (_("               issuer \"%s\"\n"), sig->signers_uid);
  ------------------
  |  |   28|  7.46k|#  define _(a) gettext (a)
  ------------------
 2031|       |
 2032|  49.0k|  rc = do_check_sig (c, node, extrahash, extrahashlen, NULL,
 2033|  49.0k|                     NULL, &is_expkey, &is_revkey, &pk);
 2034|       |
 2035|       |  /* If the key is not found but the signature includes a key block we
 2036|       |   * use that key block for verification and on success import it.  */
 2037|  49.0k|  if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY
  ------------------
  |  Branch (2037:7): [True: 12.5k, False: 36.4k]
  ------------------
 2038|  49.0k|      && sig->flags.key_block
  ------------------
  |  Branch (2038:10): [True: 63, False: 12.5k]
  ------------------
 2039|  49.0k|      && opt.flags.auto_key_import)
  ------------------
  |  Branch (2039:10): [True: 0, False: 63]
  ------------------
 2040|      0|    {
 2041|      0|      PKT_public_key *included_pk;
 2042|      0|      const byte *kblock;
 2043|      0|      size_t kblock_len;
 2044|       |
 2045|      0|      included_pk = xcalloc (1, sizeof *included_pk);
  ------------------
  |  |  109|      0|#define xcalloc(a,b)     gcry_xcalloc ((a),(b))
  ------------------
 2046|      0|      kblock = parse_sig_subpkt (sig, 1, SIGSUBPKT_KEY_BLOCK, &kblock_len);
 2047|      0|      if (kblock && kblock_len > 1
  ------------------
  |  Branch (2047:11): [True: 0, False: 0]
  |  Branch (2047:21): [True: 0, False: 0]
  ------------------
 2048|      0|          && !get_pubkey_from_buffer (c->ctrl, included_pk,
  ------------------
  |  Branch (2048:14): [True: 0, False: 0]
  ------------------
 2049|      0|                                      kblock+1, kblock_len-1,
 2050|      0|                                      sig->keyid, &included_keyblock))
 2051|      0|        {
 2052|      0|          rc = do_check_sig (c, node, extrahash, extrahashlen, included_pk,
 2053|      0|                             NULL, &is_expkey, &is_revkey, &pk);
 2054|      0|          if (opt.verbose)
  ------------------
  |  Branch (2054:15): [True: 0, False: 0]
  ------------------
 2055|      0|            log_debug ("checked signature using included key block: %s\n",
 2056|      0|                       gpg_strerror (rc));
 2057|      0|          if (!rc)
  ------------------
  |  Branch (2057:15): [True: 0, False: 0]
  ------------------
 2058|      0|            {
 2059|       |              /* The keyblock has been verified, we now import it.  */
 2060|      0|              rc = import_included_key_block (c->ctrl, included_keyblock);
 2061|      0|            }
 2062|       |
 2063|      0|        }
 2064|      0|      free_public_key (included_pk);
 2065|      0|    }
 2066|       |
 2067|       |  /* If the key isn't found, check for a preferred keyserver.  Note
 2068|       |   * that this is only done if honor-keyserver-url has been set.  We
 2069|       |   * test for this in the loop so that we can show info about the
 2070|       |   * preferred keyservers.  */
 2071|  49.0k|  if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY
  ------------------
  |  Branch (2071:7): [True: 12.5k, False: 36.4k]
  ------------------
 2072|  49.0k|      && sig->flags.pref_ks)
  ------------------
  |  Branch (2072:10): [True: 3.34k, False: 9.25k]
  ------------------
 2073|  3.34k|    {
 2074|  3.34k|      const byte *p;
 2075|  3.34k|      int seq = 0;
 2076|  3.34k|      size_t n;
 2077|  3.34k|      int any_pref_ks = 0;
 2078|       |
 2079|  7.20k|      while ((p=enum_sig_subpkt (sig, 1, SIGSUBPKT_PREF_KS, &n, &seq, NULL)))
  ------------------
  |  Branch (2079:14): [True: 3.86k, False: 3.34k]
  ------------------
 2080|  3.86k|        {
 2081|       |          /* According to my favorite copy editor, in English grammar,
 2082|       |             you say "at" if the key is located on a web page, but
 2083|       |             "from" if it is located on a keyserver.  I'm not going to
 2084|       |             even try to make two strings here :) */
 2085|  3.86k|          log_info(_("Key available at: ") );
  ------------------
  |  |   28|  3.86k|#  define _(a) gettext (a)
  ------------------
 2086|  3.86k|          print_utf8_buffer (log_get_stream(), p, n);
 2087|  3.86k|          log_printf ("\n");
 2088|  3.86k|          any_pref_ks = 1;
 2089|       |
 2090|  3.86k|          if ((opt.keyserver_options.options&KEYSERVER_AUTO_KEY_RETRIEVE)
  ------------------
  |  |  443|  3.86k|#define KEYSERVER_AUTO_KEY_RETRIEVE      (1<<3)
  ------------------
  |  Branch (2090:15): [True: 0, False: 3.86k]
  ------------------
 2091|  3.86k|              && (opt.keyserver_options.options&KEYSERVER_HONOR_KEYSERVER_URL))
  ------------------
  |  |  444|      0|#define KEYSERVER_HONOR_KEYSERVER_URL    (1<<4)
  ------------------
  |  Branch (2091:18): [True: 0, False: 0]
  ------------------
 2092|      0|            {
 2093|      0|              struct keyserver_spec *spec;
 2094|       |
 2095|      0|              spec = parse_preferred_keyserver (sig);
 2096|      0|              if (spec)
  ------------------
  |  Branch (2096:19): [True: 0, False: 0]
  ------------------
 2097|      0|                {
 2098|      0|                  int res;
 2099|       |
 2100|      0|                  if (DBG_LOOKUP)
  ------------------
  |  |  357|      0|#define DBG_LOOKUP  (opt.debug & DBG_LOOKUP_VALUE)
  |  |  ------------------
  |  |  |  |  344|      0|#define DBG_LOOKUP_VALUE  8192	/* debug the key lookup */
  |  |  ------------------
  |  |  |  Branch (357:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2101|      0|                    log_debug ("trying auto-key-retrieve method %s\n",
 2102|      0|                               "Pref-KS");
 2103|       |
 2104|      0|                  free_public_key (pk);
 2105|      0|                  pk = NULL;
 2106|      0|                  glo_ctrl.in_auto_key_retrieve++;
 2107|      0|                  res = keyserver_import_keyid (c->ctrl, sig->keyid,spec,
 2108|      0|                                                KEYSERVER_IMPORT_FLAG_QUICK);
  ------------------
  |  |   28|      0|#define KEYSERVER_IMPORT_FLAG_QUICK 1
  ------------------
 2109|      0|                  glo_ctrl.in_auto_key_retrieve--;
 2110|      0|                  if (!res)
  ------------------
  |  Branch (2110:23): [True: 0, False: 0]
  ------------------
 2111|      0|                    rc = do_check_sig (c, node, extrahash, extrahashlen, NULL,
 2112|      0|                                       NULL, &is_expkey, &is_revkey, &pk);
 2113|      0|                  else if (DBG_LOOKUP)
  ------------------
  |  |  357|      0|#define DBG_LOOKUP  (opt.debug & DBG_LOOKUP_VALUE)
  |  |  ------------------
  |  |  |  |  344|      0|#define DBG_LOOKUP_VALUE  8192	/* debug the key lookup */
  |  |  ------------------
  |  |  |  Branch (357:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2114|      0|                    log_debug ("lookup via %s failed: %s\n", "Pref-KS",
 2115|      0|                               gpg_strerror (res));
 2116|      0|                  free_keyserver_spec (spec);
 2117|       |
 2118|      0|                  if (!rc)
  ------------------
  |  Branch (2118:23): [True: 0, False: 0]
  ------------------
 2119|      0|                    break;
 2120|      0|                }
 2121|      0|            }
 2122|  3.86k|        }
 2123|       |
 2124|  3.34k|      if (any_pref_ks
  ------------------
  |  Branch (2124:11): [True: 3.34k, False: 0]
  ------------------
 2125|  3.34k|          && (opt.keyserver_options.options&KEYSERVER_AUTO_KEY_RETRIEVE)
  ------------------
  |  |  443|  3.34k|#define KEYSERVER_AUTO_KEY_RETRIEVE      (1<<3)
  ------------------
  |  Branch (2125:14): [True: 0, False: 3.34k]
  ------------------
 2126|  3.34k|          && !(opt.keyserver_options.options&KEYSERVER_HONOR_KEYSERVER_URL))
  ------------------
  |  |  444|      0|#define KEYSERVER_HONOR_KEYSERVER_URL    (1<<4)
  ------------------
  |  Branch (2126:14): [True: 0, False: 0]
  ------------------
 2127|      0|        log_info (_("Note: Use '%s' to make use of this info\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2128|      0|                  "--keyserver-option honor-keyserver-url");
 2129|  3.34k|    }
 2130|       |
 2131|       |  /* If the above methods didn't work, our next try is to retrieve the
 2132|       |   * key from the WKD.  This requires that WKD is in the AKL and the
 2133|       |   * Signer's UID is in the signature.  */
 2134|  49.0k|  if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY
  ------------------
  |  Branch (2134:7): [True: 12.5k, False: 36.4k]
  ------------------
 2135|  49.0k|      && (opt.keyserver_options.options & KEYSERVER_AUTO_KEY_RETRIEVE)
  ------------------
  |  |  443|  12.5k|#define KEYSERVER_AUTO_KEY_RETRIEVE      (1<<3)
  ------------------
  |  Branch (2135:10): [True: 0, False: 12.5k]
  ------------------
 2136|  49.0k|      && !opt.flags.disable_signer_uid
  ------------------
  |  Branch (2136:10): [True: 0, False: 0]
  ------------------
 2137|  49.0k|      && akl_has_wkd_method ()
  ------------------
  |  Branch (2137:10): [True: 0, False: 0]
  ------------------
 2138|  49.0k|      && sig->signers_uid)
  ------------------
  |  Branch (2138:10): [True: 0, False: 0]
  ------------------
 2139|      0|    {
 2140|      0|      int res;
 2141|       |
 2142|      0|      if (DBG_LOOKUP)
  ------------------
  |  |  357|      0|#define DBG_LOOKUP  (opt.debug & DBG_LOOKUP_VALUE)
  |  |  ------------------
  |  |  |  |  344|      0|#define DBG_LOOKUP_VALUE  8192	/* debug the key lookup */
  |  |  ------------------
  |  |  |  Branch (357:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2143|      0|        log_debug ("trying auto-key-retrieve method %s\n", "WKD");
 2144|      0|      free_public_key (pk);
 2145|      0|      pk = NULL;
 2146|      0|      glo_ctrl.in_auto_key_retrieve++;
 2147|      0|      res = keyserver_import_wkd (c->ctrl, sig->signers_uid,
 2148|      0|                                  KEYSERVER_IMPORT_FLAG_QUICK, NULL, NULL);
  ------------------
  |  |   28|      0|#define KEYSERVER_IMPORT_FLAG_QUICK 1
  ------------------
 2149|      0|      glo_ctrl.in_auto_key_retrieve--;
 2150|       |      /* Fixme: If the fingerprint is embedded in the signature,
 2151|       |       * compare it to the fingerprint of the returned key.  */
 2152|      0|      if (!res)
  ------------------
  |  Branch (2152:11): [True: 0, False: 0]
  ------------------
 2153|      0|        rc = do_check_sig (c, node, extrahash, extrahashlen, NULL,
 2154|      0|                           NULL, &is_expkey, &is_revkey, &pk);
 2155|      0|      else if (DBG_LOOKUP)
  ------------------
  |  |  357|      0|#define DBG_LOOKUP  (opt.debug & DBG_LOOKUP_VALUE)
  |  |  ------------------
  |  |  |  |  344|      0|#define DBG_LOOKUP_VALUE  8192	/* debug the key lookup */
  |  |  ------------------
  |  |  |  Branch (357:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2156|      0|        log_debug ("lookup via %s failed: %s\n", "WKD", gpg_strerror (res));
 2157|      0|    }
 2158|       |
 2159|       |  /* If the above methods didn't work, our next try is to locate
 2160|       |   * the key via its fingerprint from a keyserver.  This requires
 2161|       |   * that the signers fingerprint is encoded in the signature.  */
 2162|  49.0k|  if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY
  ------------------
  |  Branch (2162:7): [True: 12.5k, False: 36.4k]
  ------------------
 2163|  49.0k|      && (opt.keyserver_options.options&KEYSERVER_AUTO_KEY_RETRIEVE)
  ------------------
  |  |  443|  12.5k|#define KEYSERVER_AUTO_KEY_RETRIEVE      (1<<3)
  ------------------
  |  Branch (2163:10): [True: 0, False: 12.5k]
  ------------------
 2164|  49.0k|      && keyserver_any_configured (c->ctrl))
  ------------------
  |  Branch (2164:10): [True: 0, False: 0]
  ------------------
 2165|      0|    {
 2166|      0|      int res;
 2167|      0|      const byte *p;
 2168|      0|      size_t n;
 2169|       |
 2170|      0|      p = issuer_fpr_raw (sig, &n);
 2171|      0|      if (p)
  ------------------
  |  Branch (2171:11): [True: 0, False: 0]
  ------------------
 2172|      0|        {
 2173|      0|          if (DBG_LOOKUP)
  ------------------
  |  |  357|      0|#define DBG_LOOKUP  (opt.debug & DBG_LOOKUP_VALUE)
  |  |  ------------------
  |  |  |  |  344|      0|#define DBG_LOOKUP_VALUE  8192	/* debug the key lookup */
  |  |  ------------------
  |  |  |  Branch (357:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2174|      0|            log_debug ("trying auto-key-retrieve method %s\n", "KS");
 2175|       |
 2176|       |          /* v4 or v5 packet with a SHA-1/256 fingerprint.  */
 2177|      0|          free_public_key (pk);
 2178|      0|          pk = NULL;
 2179|      0|          glo_ctrl.in_auto_key_retrieve++;
 2180|      0|          res = keyserver_import_fprint (c->ctrl, p, n, opt.keyserver,
 2181|      0|                                         KEYSERVER_IMPORT_FLAG_QUICK);
  ------------------
  |  |   28|      0|#define KEYSERVER_IMPORT_FLAG_QUICK 1
  ------------------
 2182|      0|          glo_ctrl.in_auto_key_retrieve--;
 2183|      0|          if (!res)
  ------------------
  |  Branch (2183:15): [True: 0, False: 0]
  ------------------
 2184|      0|            rc = do_check_sig (c, node, extrahash, extrahashlen, NULL,
 2185|      0|                               NULL, &is_expkey, &is_revkey, &pk);
 2186|      0|          else if (DBG_LOOKUP)
  ------------------
  |  |  357|      0|#define DBG_LOOKUP  (opt.debug & DBG_LOOKUP_VALUE)
  |  |  ------------------
  |  |  |  |  344|      0|#define DBG_LOOKUP_VALUE  8192	/* debug the key lookup */
  |  |  ------------------
  |  |  |  Branch (357:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2187|      0|            log_debug ("lookup via %s failed: %s\n", "KS", gpg_strerror (res));
 2188|      0|        }
 2189|      0|    }
 2190|       |
 2191|       |  /* Do do something with the result of the signature checking.  */
 2192|  49.0k|  if (!rc || gpg_err_code (rc) == GPG_ERR_BAD_SIGNATURE)
  ------------------
  |  Branch (2192:7): [True: 0, False: 49.0k]
  |  Branch (2192:14): [True: 0, False: 49.0k]
  ------------------
 2193|      0|    {
 2194|       |      /* We have checked the signature and the result is either a good
 2195|       |       * signature or a bad signature.  Further examination follows.  */
 2196|      0|      kbnode_t un, keyblock;
 2197|      0|      int count = 0;
 2198|      0|      int keyblock_has_pk = 0;  /* For failsafe check.  */
 2199|      0|      int statno;
 2200|      0|      char keyid_str[50];
 2201|      0|      PKT_public_key *mainpk = NULL;
 2202|       |
 2203|      0|      if (rc)
  ------------------
  |  Branch (2203:11): [True: 0, False: 0]
  ------------------
 2204|      0|        statno = STATUS_BADSIG;
 2205|      0|      else if (sig->flags.expired)
  ------------------
  |  Branch (2205:16): [True: 0, False: 0]
  ------------------
 2206|      0|        statno = STATUS_EXPSIG;
 2207|      0|      else if (is_expkey)
  ------------------
  |  Branch (2207:16): [True: 0, False: 0]
  ------------------
 2208|      0|        statno = STATUS_EXPKEYSIG;
 2209|      0|      else if(is_revkey)
  ------------------
  |  Branch (2209:15): [True: 0, False: 0]
  ------------------
 2210|      0|        statno = STATUS_REVKEYSIG;
 2211|      0|      else
 2212|      0|        statno = STATUS_GOODSIG;
 2213|       |
 2214|       |      /* FIXME: We should have the public key in PK and thus the
 2215|       |       * keyblock has already been fetched.  Thus we could use the
 2216|       |       * fingerprint or PK itself to lookup the entire keyblock.  That
 2217|       |       * would best be done with a cache.  */
 2218|      0|      if (included_keyblock)
  ------------------
  |  Branch (2218:11): [True: 0, False: 0]
  ------------------
 2219|      0|        {
 2220|      0|          keyblock = included_keyblock;
 2221|      0|          included_keyblock = NULL;
 2222|      0|        }
 2223|      0|      else
 2224|      0|        keyblock = get_pubkeyblock_for_sig (c->ctrl, sig);
 2225|       |
 2226|      0|      snprintf (keyid_str, sizeof keyid_str, "%08lX%08lX [uncertain] ",
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
 2227|      0|                (ulong)sig->keyid[0], (ulong)sig->keyid[1]);
 2228|       |
 2229|       |      /* Find and print the primary user ID along with the
 2230|       |         "Good|Expired|Bad signature" line.  */
 2231|      0|      for (un=keyblock; un; un = un->next)
  ------------------
  |  Branch (2231:25): [True: 0, False: 0]
  ------------------
 2232|      0|        {
 2233|      0|          int valid;
 2234|       |
 2235|      0|          if (!keyblock_has_pk
  ------------------
  |  Branch (2235:15): [True: 0, False: 0]
  ------------------
 2236|      0|              && (un->pkt->pkttype == PKT_PUBLIC_KEY
  ------------------
  |  Branch (2236:19): [True: 0, False: 0]
  ------------------
 2237|      0|                  || un->pkt->pkttype == PKT_PUBLIC_SUBKEY)
  ------------------
  |  Branch (2237:22): [True: 0, False: 0]
  ------------------
 2238|      0|              && !cmp_public_keys (un->pkt->pkt.public_key, pk))
  ------------------
  |  Branch (2238:18): [True: 0, False: 0]
  ------------------
 2239|      0|            {
 2240|      0|              keyblock_has_pk = 1;
 2241|      0|            }
 2242|      0|          if (un->pkt->pkttype == PKT_PUBLIC_KEY)
  ------------------
  |  Branch (2242:15): [True: 0, False: 0]
  ------------------
 2243|      0|            {
 2244|      0|              mainpk = un->pkt->pkt.public_key;
 2245|      0|              continue;
 2246|      0|            }
 2247|      0|          if (un->pkt->pkttype != PKT_USER_ID)
  ------------------
  |  Branch (2247:15): [True: 0, False: 0]
  ------------------
 2248|      0|            continue;
 2249|      0|          if (!un->pkt->pkt.user_id->created)
  ------------------
  |  Branch (2249:15): [True: 0, False: 0]
  ------------------
 2250|      0|            continue;
 2251|      0|          if (un->pkt->pkt.user_id->flags.revoked)
  ------------------
  |  Branch (2251:15): [True: 0, False: 0]
  ------------------
 2252|      0|            continue;
 2253|      0|          if (un->pkt->pkt.user_id->flags.expired)
  ------------------
  |  Branch (2253:15): [True: 0, False: 0]
  ------------------
 2254|      0|            continue;
 2255|      0|          if (!un->pkt->pkt.user_id->flags.primary)
  ------------------
  |  Branch (2255:15): [True: 0, False: 0]
  ------------------
 2256|      0|            continue;
 2257|       |          /* We want the textual primary user ID here */
 2258|      0|          if (un->pkt->pkt.user_id->attrib_data)
  ------------------
  |  Branch (2258:15): [True: 0, False: 0]
  ------------------
 2259|      0|            continue;
 2260|       |
 2261|      0|          log_assert (mainpk);
 2262|       |
 2263|       |	  /* Since this is just informational, don't actually ask the
 2264|       |	     user to update any trust information.  (Note: we register
 2265|       |	     the signature later.)  Because print_good_bad_signature
 2266|       |	     does not print a LF we need to compute the validity
 2267|       |	     before calling that function.  */
 2268|      0|          if ((opt.verify_options & VERIFY_SHOW_UID_VALIDITY))
  ------------------
  |  |  436|      0|#define VERIFY_SHOW_UID_VALIDITY         (1<<5)
  ------------------
  |  Branch (2268:15): [True: 0, False: 0]
  ------------------
 2269|      0|            valid = get_validity (c->ctrl, keyblock, mainpk,
 2270|      0|                                  un->pkt->pkt.user_id, NULL, 0);
 2271|      0|          else
 2272|      0|            valid = 0; /* Not used.  */
 2273|       |
 2274|      0|          keyid_str[17] = 0; /* cut off the "[uncertain]" part */
 2275|       |
 2276|      0|          print_good_bad_signature (statno, keyid_str, un, sig, rc);
 2277|       |
 2278|      0|          if ((opt.verify_options & VERIFY_SHOW_UID_VALIDITY))
  ------------------
  |  |  436|      0|#define VERIFY_SHOW_UID_VALIDITY         (1<<5)
  ------------------
  |  Branch (2278:15): [True: 0, False: 0]
  ------------------
 2279|      0|            log_printf (" [%s]\n",trust_value_to_string(valid));
 2280|      0|          else
 2281|      0|            log_printf ("\n");
 2282|       |
 2283|      0|          count++;
 2284|       |          /* At this point we could in theory stop because the primary
 2285|       |           * UID flag is never set for more than one User ID per
 2286|       |           * keyblock.  However, we use this loop also for a failsafe
 2287|       |           * check that the public key used to create the signature is
 2288|       |           * contained in the keyring.*/
 2289|      0|	}
 2290|       |
 2291|      0|      log_assert (mainpk);
 2292|      0|      if (!keyblock_has_pk)
  ------------------
  |  Branch (2292:11): [True: 0, False: 0]
  ------------------
 2293|      0|        {
 2294|      0|          log_error ("signature key lost from keyblock\n");
 2295|      0|          rc = gpg_error (GPG_ERR_INTERNAL);
 2296|      0|        }
 2297|       |
 2298|       |      /* In case we did not found a valid textual userid above
 2299|       |         we print the first user id packet or a "[?]" instead along
 2300|       |         with the "Good|Expired|Bad signature" line.  */
 2301|      0|      if (!count)
  ------------------
  |  Branch (2301:11): [True: 0, False: 0]
  ------------------
 2302|      0|        {
 2303|       |          /* Try for an invalid textual userid */
 2304|      0|          for (un=keyblock; un; un = un->next)
  ------------------
  |  Branch (2304:29): [True: 0, False: 0]
  ------------------
 2305|      0|            {
 2306|      0|              if (un->pkt->pkttype == PKT_USER_ID
  ------------------
  |  Branch (2306:19): [True: 0, False: 0]
  ------------------
 2307|      0|                  && !un->pkt->pkt.user_id->attrib_data)
  ------------------
  |  Branch (2307:22): [True: 0, False: 0]
  ------------------
 2308|      0|                break;
 2309|      0|            }
 2310|       |
 2311|       |          /* Try for any userid at all */
 2312|      0|          if (!un)
  ------------------
  |  Branch (2312:15): [True: 0, False: 0]
  ------------------
 2313|      0|            {
 2314|      0|              for (un=keyblock; un; un = un->next)
  ------------------
  |  Branch (2314:33): [True: 0, False: 0]
  ------------------
 2315|      0|                {
 2316|      0|                  if (un->pkt->pkttype == PKT_USER_ID)
  ------------------
  |  Branch (2316:23): [True: 0, False: 0]
  ------------------
 2317|      0|                    break;
 2318|      0|		}
 2319|      0|	    }
 2320|       |
 2321|      0|          if (opt.trust_model==TM_ALWAYS || !un)
  ------------------
  |  Branch (2321:15): [True: 0, False: 0]
  |  Branch (2321:45): [True: 0, False: 0]
  ------------------
 2322|      0|            keyid_str[17] = 0; /* cut off the "[uncertain]" part */
 2323|       |
 2324|      0|          print_good_bad_signature (statno, keyid_str, un, sig, rc);
 2325|       |
 2326|      0|          if (opt.trust_model != TM_ALWAYS && un)
  ------------------
  |  Branch (2326:15): [True: 0, False: 0]
  |  Branch (2326:47): [True: 0, False: 0]
  ------------------
 2327|      0|            log_printf (" %s",_("[uncertain]") );
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2328|      0|          log_printf ("\n");
 2329|      0|	}
 2330|       |
 2331|       |      /* If we have a good signature and already printed
 2332|       |       * the primary user ID, print all the other user IDs */
 2333|      0|      if (count
  ------------------
  |  Branch (2333:11): [True: 0, False: 0]
  ------------------
 2334|      0|          && !rc
  ------------------
  |  Branch (2334:14): [True: 0, False: 0]
  ------------------
 2335|      0|          && !(opt.verify_options & VERIFY_SHOW_PRIMARY_UID_ONLY))
  ------------------
  |  |  438|      0|#define VERIFY_SHOW_PRIMARY_UID_ONLY     (1<<9)
  ------------------
  |  Branch (2335:14): [True: 0, False: 0]
  ------------------
 2336|      0|        {
 2337|      0|          char *p;
 2338|      0|          for( un=keyblock; un; un = un->next)
  ------------------
  |  Branch (2338:29): [True: 0, False: 0]
  ------------------
 2339|      0|            {
 2340|      0|              if (un->pkt->pkttype != PKT_USER_ID)
  ------------------
  |  Branch (2340:19): [True: 0, False: 0]
  ------------------
 2341|      0|                continue;
 2342|      0|              if ((un->pkt->pkt.user_id->flags.revoked
  ------------------
  |  Branch (2342:20): [True: 0, False: 0]
  ------------------
 2343|      0|                   || un->pkt->pkt.user_id->flags.expired)
  ------------------
  |  Branch (2343:23): [True: 0, False: 0]
  ------------------
 2344|      0|                  && !(opt.verify_options & VERIFY_SHOW_UNUSABLE_UIDS))
  ------------------
  |  |  437|      0|#define VERIFY_SHOW_UNUSABLE_UIDS        (1<<6)
  ------------------
  |  Branch (2344:22): [True: 0, False: 0]
  ------------------
 2345|      0|                continue;
 2346|       |              /* Skip textual primary user ids which we printed above. */
 2347|      0|              if (un->pkt->pkt.user_id->flags.primary
  ------------------
  |  Branch (2347:19): [True: 0, False: 0]
  ------------------
 2348|      0|                  && !un->pkt->pkt.user_id->attrib_data )
  ------------------
  |  Branch (2348:22): [True: 0, False: 0]
  ------------------
 2349|      0|                continue;
 2350|       |
 2351|       |              /* If this user id has attribute data, print that.  */
 2352|      0|              if (un->pkt->pkt.user_id->attrib_data)
  ------------------
  |  Branch (2352:19): [True: 0, False: 0]
  ------------------
 2353|      0|                {
 2354|      0|                  dump_attribs (un->pkt->pkt.user_id, mainpk);
 2355|       |
 2356|      0|                  if (opt.verify_options&VERIFY_SHOW_PHOTOS)
  ------------------
  |  |  430|      0|#define VERIFY_SHOW_PHOTOS               (1<<0)
  ------------------
  |  Branch (2356:23): [True: 0, False: 0]
  ------------------
 2357|      0|                    show_photos (c->ctrl,
 2358|      0|                                 un->pkt->pkt.user_id->attribs,
 2359|      0|                                 un->pkt->pkt.user_id->numattribs,
 2360|      0|                                 mainpk ,un->pkt->pkt.user_id);
 2361|      0|                }
 2362|       |
 2363|      0|              p = utf8_to_native (un->pkt->pkt.user_id->name,
 2364|      0|				  un->pkt->pkt.user_id->len, 0);
 2365|      0|              log_info (_("                aka \"%s\""), p);
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2366|      0|              xfree (p);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 2367|       |
 2368|      0|              if ((opt.verify_options & VERIFY_SHOW_UID_VALIDITY))
  ------------------
  |  |  436|      0|#define VERIFY_SHOW_UID_VALIDITY         (1<<5)
  ------------------
  |  Branch (2368:19): [True: 0, False: 0]
  ------------------
 2369|      0|                {
 2370|      0|                  const char *valid;
 2371|       |
 2372|      0|                  if (un->pkt->pkt.user_id->flags.revoked)
  ------------------
  |  Branch (2372:23): [True: 0, False: 0]
  ------------------
 2373|      0|                    valid = _("revoked");
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2374|      0|                  else if (un->pkt->pkt.user_id->flags.expired)
  ------------------
  |  Branch (2374:28): [True: 0, False: 0]
  ------------------
 2375|      0|                    valid = _("expired");
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2376|      0|                  else
 2377|       |		    /* Since this is just informational, don't
 2378|       |		       actually ask the user to update any trust
 2379|       |		       information.  */
 2380|      0|                    valid = (trust_value_to_string
 2381|      0|                             (get_validity (c->ctrl, keyblock, mainpk,
 2382|      0|                                            un->pkt->pkt.user_id, NULL, 0)));
 2383|      0|                  log_printf (" [%s]\n",valid);
 2384|      0|                }
 2385|      0|              else
 2386|      0|                log_printf ("\n");
 2387|      0|            }
 2388|      0|	}
 2389|       |
 2390|       |      /* For good signatures print notation data.  */
 2391|      0|      if (!rc)
  ------------------
  |  Branch (2391:11): [True: 0, False: 0]
  ------------------
 2392|      0|        {
 2393|      0|          if ((opt.verify_options & VERIFY_SHOW_POLICY_URLS))
  ------------------
  |  |  431|      0|#define VERIFY_SHOW_POLICY_URLS          (1<<1)
  ------------------
  |  Branch (2393:15): [True: 0, False: 0]
  ------------------
 2394|      0|            show_policy_url (sig, 0, 1);
 2395|      0|          else
 2396|      0|            show_policy_url (sig, 0, 2);
 2397|       |
 2398|      0|          if ((opt.verify_options & VERIFY_SHOW_KEYSERVER_URLS))
  ------------------
  |  |  435|      0|#define VERIFY_SHOW_KEYSERVER_URLS       (1<<4)
  ------------------
  |  Branch (2398:15): [True: 0, False: 0]
  ------------------
 2399|      0|            show_keyserver_url (sig, 0, 1);
 2400|      0|          else
 2401|      0|            show_keyserver_url (sig, 0, 2);
 2402|       |
 2403|      0|          if ((opt.verify_options & VERIFY_SHOW_NOTATIONS))
  ------------------
  |  |  434|      0|#define VERIFY_SHOW_NOTATIONS (VERIFY_SHOW_STD_NOTATIONS|VERIFY_SHOW_USER_NOTATIONS)
  |  |  ------------------
  |  |  |  |  432|      0|#define VERIFY_SHOW_STD_NOTATIONS        (1<<2)
  |  |  ------------------
  |  |               #define VERIFY_SHOW_NOTATIONS (VERIFY_SHOW_STD_NOTATIONS|VERIFY_SHOW_USER_NOTATIONS)
  |  |  ------------------
  |  |  |  |  433|      0|#define VERIFY_SHOW_USER_NOTATIONS       (1<<3)
  |  |  ------------------
  ------------------
  |  Branch (2403:15): [True: 0, False: 0]
  ------------------
 2404|      0|            show_notation
 2405|      0|              (sig, 0, 1,
 2406|      0|               (((opt.verify_options&VERIFY_SHOW_STD_NOTATIONS)?1:0)
  ------------------
  |  |  432|      0|#define VERIFY_SHOW_STD_NOTATIONS        (1<<2)
  ------------------
  |  Branch (2406:18): [True: 0, False: 0]
  ------------------
 2407|      0|                + ((opt.verify_options&VERIFY_SHOW_USER_NOTATIONS)?2:0)));
  ------------------
  |  |  433|      0|#define VERIFY_SHOW_USER_NOTATIONS       (1<<3)
  ------------------
  |  Branch (2407:20): [True: 0, False: 0]
  ------------------
 2408|      0|          else
 2409|      0|            show_notation (sig, 0, 2, 0);
 2410|      0|        }
 2411|       |
 2412|       |      /* For good signatures print the VALIDSIG status line.  */
 2413|      0|      if (!rc && is_status_enabled () && pk)
  ------------------
  |  Branch (2413:11): [True: 0, False: 0]
  |  Branch (2413:18): [True: 0, False: 0]
  |  Branch (2413:42): [True: 0, False: 0]
  ------------------
 2414|      0|        {
 2415|      0|          char pkhex[MAX_FINGERPRINT_LEN*2+1];
 2416|      0|          char mainpkhex[MAX_FINGERPRINT_LEN*2+1];
 2417|       |
 2418|      0|          hexfingerprint (pk, pkhex, sizeof pkhex);
 2419|      0|          hexfingerprint (mainpk, mainpkhex, sizeof mainpkhex);
 2420|       |
 2421|       |          /* TODO: Replace the reserved '0' in the field below with
 2422|       |             bits for status flags (policy url, notation, etc.).  */
 2423|      0|          write_status_printf (STATUS_VALIDSIG,
 2424|      0|                               "%s %s %lu %lu %d 0 %d %d %02X %s",
 2425|      0|                               pkhex,
 2426|      0|                               strtimestamp (sig->timestamp),
 2427|      0|                               (ulong)sig->timestamp,
 2428|      0|                               (ulong)sig->expiredate,
 2429|      0|                               sig->version, sig->pubkey_algo,
 2430|      0|                               sig->digest_algo,
 2431|      0|                               sig->sig_class,
 2432|      0|                               mainpkhex);
 2433|      0|	}
 2434|       |
 2435|       |      /* Print compliance warning for Good signatures.  */
 2436|      0|      if (!rc && pk && !opt.quiet
  ------------------
  |  Branch (2436:11): [True: 0, False: 0]
  |  Branch (2436:18): [True: 0, False: 0]
  |  Branch (2436:24): [True: 0, False: 0]
  ------------------
 2437|      0|          && !gnupg_pk_is_compliant (opt.compliance, pk->pubkey_algo, 0,
  ------------------
  |  Branch (2437:14): [True: 0, False: 0]
  ------------------
 2438|      0|                                     pk->pkey, nbits_from_pk (pk), NULL))
 2439|      0|        {
 2440|      0|          log_info (_("WARNING: This key is not suitable for signing"
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2441|      0|                      " in %s mode\n"),
 2442|      0|                    gnupg_compliance_option_string (opt.compliance));
 2443|      0|        }
 2444|       |
 2445|       |      /* For good signatures compute and print the trust information.
 2446|       |         Note that in the Tofu trust model this may ask the user on
 2447|       |         how to resolve a conflict.  */
 2448|      0|      if (!rc)
  ------------------
  |  Branch (2448:11): [True: 0, False: 0]
  ------------------
 2449|      0|        {
 2450|      0|          rc = check_signatures_trust (c->ctrl, keyblock, pk, sig);
 2451|      0|        }
 2452|       |
 2453|       |      /* Print extra information about the signature.  */
 2454|      0|      if (sig->flags.expired)
  ------------------
  |  Branch (2454:11): [True: 0, False: 0]
  ------------------
 2455|      0|        {
 2456|      0|          log_info (_("Signature expired %s\n"), asctimestamp(sig->expiredate));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2457|      0|          if (!rc)
  ------------------
  |  Branch (2457:15): [True: 0, False: 0]
  ------------------
 2458|      0|            rc = gpg_error (GPG_ERR_GENERAL); /* Need a better error here?  */
 2459|      0|        }
 2460|      0|      else if (sig->expiredate)
  ------------------
  |  Branch (2460:16): [True: 0, False: 0]
  ------------------
 2461|      0|        log_info (_("Signature expires %s\n"), asctimestamp(sig->expiredate));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2462|       |
 2463|      0|      if (opt.verbose)
  ------------------
  |  Branch (2463:11): [True: 0, False: 0]
  ------------------
 2464|      0|        {
 2465|      0|          char pkstrbuf[PUBKEY_STRING_SIZE];
 2466|       |
 2467|      0|          if (pk)
  ------------------
  |  Branch (2467:15): [True: 0, False: 0]
  ------------------
 2468|      0|            pubkey_string (pk, pkstrbuf, sizeof pkstrbuf);
 2469|      0|          else
 2470|      0|            *pkstrbuf = 0;
 2471|       |
 2472|      0|          log_info (_("%s signature, digest algorithm %s%s%s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2473|      0|                    sig->sig_class==0x00?_("binary"):
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  |  Branch (2473:21): [True: 0, False: 0]
  ------------------
 2474|      0|                    sig->sig_class==0x01?_("textmode"):_("unknown"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
                                  sig->sig_class==0x01?_("textmode"):_("unknown"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  |  Branch (2474:21): [True: 0, False: 0]
  ------------------
 2475|      0|                    gcry_md_algo_name (sig->digest_algo),
 2476|      0|                    *pkstrbuf?_(", key algorithm "):"", pkstrbuf);
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  |  Branch (2476:21): [True: 0, False: 0]
  ------------------
 2477|      0|        }
 2478|       |
 2479|       |      /* Print final warnings.  */
 2480|      0|      if (!rc && !c->signed_data.used)
  ------------------
  |  Branch (2480:11): [True: 0, False: 0]
  |  Branch (2480:18): [True: 0, False: 0]
  ------------------
 2481|      0|        {
 2482|       |          /* Signature is basically good but we test whether the
 2483|       |             deprecated command
 2484|       |               gpg --verify FILE.sig
 2485|       |             was used instead of
 2486|       |               gpg --verify FILE.sig FILE
 2487|       |             to verify a detached signature.  If we figure out that a
 2488|       |             data file with a matching name exists, we print a warning.
 2489|       |
 2490|       |             The problem is that the first form would also verify a
 2491|       |             standard signature.  This behavior could be used to
 2492|       |             create a made up .sig file for a tarball by creating a
 2493|       |             standard signature from a valid detached signature packet
 2494|       |             (for example from a signed git tag).  Then replace the
 2495|       |             sig file on the FTP server along with a changed tarball.
 2496|       |             Using the first form the verify command would correctly
 2497|       |             verify the signature but don't even consider the tarball.  */
 2498|      0|          kbnode_t n;
 2499|      0|          char *dfile;
 2500|       |
 2501|      0|          dfile = get_matching_datafile (c->sigfilename);
 2502|      0|          if (dfile)
  ------------------
  |  Branch (2502:15): [True: 0, False: 0]
  ------------------
 2503|      0|            {
 2504|      0|              for (n = c->list; n; n = n->next)
  ------------------
  |  Branch (2504:33): [True: 0, False: 0]
  ------------------
 2505|      0|                if (n->pkt->pkttype != PKT_SIGNATURE)
  ------------------
  |  Branch (2505:21): [True: 0, False: 0]
  ------------------
 2506|      0|                  break;
 2507|      0|              if (n)
  ------------------
  |  Branch (2507:19): [True: 0, False: 0]
  ------------------
 2508|      0|                {
 2509|       |                  /* Not only signature packets in the tree thus this
 2510|       |                     is not a detached signature.  */
 2511|      0|                  log_info (_("WARNING: not a detached signature; "
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2512|      0|                              "file '%s' was NOT verified!\n"), dfile);
 2513|      0|                }
 2514|      0|              xfree (dfile);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 2515|      0|            }
 2516|      0|        }
 2517|       |
 2518|       |      /* Compute compliance with CO_DE_VS.  */
 2519|      0|      if (pk && is_status_enabled ()
  ------------------
  |  Branch (2519:11): [True: 0, False: 0]
  |  Branch (2519:17): [True: 0, False: 0]
  ------------------
 2520|      0|          && gnupg_gcrypt_is_compliant (CO_DE_VS)
  ------------------
  |  Branch (2520:14): [True: 0, False: 0]
  ------------------
 2521|      0|          && gnupg_pk_is_compliant (CO_DE_VS, pk->pubkey_algo, 0, pk->pkey,
  ------------------
  |  Branch (2521:14): [True: 0, False: 0]
  ------------------
 2522|      0|                                    nbits_from_pk (pk), NULL)
 2523|      0|          && gnupg_digest_is_compliant (CO_DE_VS, sig->digest_algo))
  ------------------
  |  Branch (2523:14): [True: 0, False: 0]
  ------------------
 2524|      0|        write_status_strings (STATUS_VERIFICATION_COMPLIANCE_MODE,
 2525|      0|                              gnupg_status_compliance_flag (CO_DE_VS),
 2526|      0|                              NULL);
 2527|      0|      else if (opt.flags.require_compliance
  ------------------
  |  Branch (2527:16): [True: 0, False: 0]
  ------------------
 2528|      0|               && opt.compliance == CO_DE_VS)
  ------------------
  |  Branch (2528:19): [True: 0, False: 0]
  ------------------
 2529|      0|        {
 2530|      0|          log_error (_("operation forced to fail due to"
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2531|      0|                       " unfulfilled compliance rules\n"));
 2532|      0|          if (!rc)
  ------------------
  |  Branch (2532:15): [True: 0, False: 0]
  ------------------
 2533|      0|            rc = gpg_error (GPG_ERR_FORBIDDEN);
 2534|      0|        }
 2535|       |
 2536|       |
 2537|      0|      free_public_key (pk);
 2538|      0|      pk = NULL;
 2539|      0|      release_kbnode( keyblock );
 2540|      0|      if (rc)
  ------------------
  |  Branch (2540:11): [True: 0, False: 0]
  ------------------
 2541|      0|        g10_errors_seen = 1;
 2542|      0|      if (opt.batch && rc)
  ------------------
  |  Branch (2542:11): [True: 0, False: 0]
  |  Branch (2542:24): [True: 0, False: 0]
  ------------------
 2543|      0|        g10_exit (1);
 2544|      0|    }
 2545|  49.0k|  else  /* Error checking the signature. (neither Good nor Bad).  */
 2546|  49.0k|    {
 2547|  49.0k|      write_status_printf (STATUS_ERRSIG, "%08lX%08lX %d %d %02x %lu %d %s",
 2548|  49.0k|                           (ulong)sig->keyid[0], (ulong)sig->keyid[1],
 2549|  49.0k|                           sig->pubkey_algo, sig->digest_algo,
 2550|  49.0k|                           sig->sig_class, (ulong)sig->timestamp,
 2551|  49.0k|                           gpg_err_code (rc),
 2552|  49.0k|                           issuer_fpr? issuer_fpr:"-");
  ------------------
  |  Branch (2552:28): [True: 4.25k, False: 44.8k]
  ------------------
 2553|  49.0k|      if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY)
  ------------------
  |  Branch (2553:11): [True: 12.5k, False: 36.4k]
  ------------------
 2554|  12.5k|        {
 2555|  12.5k|          write_status_printf (STATUS_NO_PUBKEY, "%08lX%08lX",
 2556|  12.5k|                               (ulong)sig->keyid[0], (ulong)sig->keyid[1]);
 2557|  12.5k|	}
 2558|  49.0k|      if (gpg_err_code (rc) != GPG_ERR_NOT_PROCESSED)
  ------------------
  |  Branch (2558:11): [True: 48.3k, False: 698]
  ------------------
 2559|  48.3k|        log_error (_("Can't check signature: %s\n"), gpg_strerror (rc));
  ------------------
  |  |   28|  48.3k|#  define _(a) gettext (a)
  ------------------
 2560|  49.0k|    }
 2561|       |
 2562|  49.0k|  free_public_key (pk);
 2563|  49.0k|  release_kbnode (included_keyblock);
 2564|  49.0k|  xfree (issuer_fpr);
  ------------------
  |  |  104|  49.0k|#define xfree(a)         gcry_free ((a))
  ------------------
 2565|  49.0k|  return rc;
 2566|  49.0k|}

free_md_filter_context:
   67|   538k|{
   68|   538k|    gcry_md_close(mfx->md);
   69|   538k|    gcry_md_close(mfx->md2);
   70|   538k|    mfx->md = NULL;
   71|   538k|    mfx->md2 = NULL;
   72|   538k|    mfx->maxbuf_size = 0;
   73|   538k|}

is_secured_file:
  164|  24.4k|{
  165|       |#ifdef ENABLE_SELINUX_HACKS
  166|       |  struct stat buf;
  167|       |  struct secured_file_item *sf;
  168|       |
  169|       |  if (fd == -1)
  170|       |    return 0; /* No file descriptor so it can't be secured either.  */
  171|       |
  172|       |  /* Note that we print out a error here and claim that a file is
  173|       |     secure if something went wrong. */
  174|       |  if (fstat (fd, &buf))
  175|       |    {
  176|       |      log_error (_("fstat(%d) failed in %s: %s\n"), fd,
  177|       |                 "is_secured_file", strerror (errno));
  178|       |      return 1;
  179|       |    }
  180|       |/*   log_debug ("is_secured_file (%d) i=%lu.%lu\n", fd, */
  181|       |/*              (unsigned long)buf.st_dev, (unsigned long)buf.st_ino); */
  182|       |  for (sf=secured_files; sf; sf = sf->next)
  183|       |    {
  184|       |      if (sf->ino == buf.st_ino && sf->dev == buf.st_dev)
  185|       |        return 1; /* Yes.  */
  186|       |    }
  187|       |#else /*!ENABLE_SELINUX_HACKS*/
  188|  24.4k|  (void)fd;
  189|  24.4k|#endif /*!ENABLE_SELINUX_HACKS*/
  190|  24.4k|  return 0; /* No. */
  191|  24.4k|}
is_secured_filename:
  199|      2|{
  200|       |#ifdef ENABLE_SELINUX_HACKS
  201|       |  struct stat buf;
  202|       |  struct secured_file_item *sf;
  203|       |
  204|       |  if (iobuf_is_pipe_filename (fname) || !*fname)
  205|       |    return 0;
  206|       |
  207|       |  /* Note that we print out a error here and claim that a file is
  208|       |     secure if something went wrong. */
  209|       |  if (gnupg_stat (fname, &buf))
  210|       |    {
  211|       |      if (errno == ENOENT || errno == EPERM || errno == EACCES)
  212|       |        return 0;
  213|       |      log_error (_("fstat of '%s' failed in %s: %s\n"), fname,
  214|       |                 "is_secured_filename", strerror (errno));
  215|       |      return 1;
  216|       |    }
  217|       |/*   log_debug ("is_secured_filename (%s) i=%lu.%lu\n", fname, */
  218|       |/*              (unsigned long)buf.st_dev, (unsigned long)buf.st_ino); */
  219|       |  for (sf=secured_files; sf; sf = sf->next)
  220|       |    {
  221|       |      if (sf->ino == buf.st_ino && sf->dev == buf.st_dev)
  222|       |        return 1; /* Yes.  */
  223|       |    }
  224|       |#else /*!ENABLE_SELINUX_HACKS*/
  225|      2|  (void)fname;
  226|      2|#endif /*!ENABLE_SELINUX_HACKS*/
  227|      2|  return 0; /* No. */
  228|      2|}
openpgp_cipher_blocklen:
  552|  11.9k|{
  553|       |  /* We use the numbers from OpenPGP to be sure that we get the right
  554|       |     block length.  This is so that the packet parsing code works even
  555|       |     for unknown algorithms (for which we assume 8 due to tradition).
  556|       |
  557|       |     NOTE: If you change the returned blocklen above 16, check
  558|       |     the callers because they may use a fixed size buffer of that
  559|       |     size. */
  560|  11.9k|  switch (algo)
  561|  11.9k|    {
  562|      2|    case CIPHER_ALGO_AES:
  ------------------
  |  Branch (562:5): [True: 2, False: 11.9k]
  ------------------
  563|     13|    case CIPHER_ALGO_AES192:
  ------------------
  |  Branch (563:5): [True: 11, False: 11.9k]
  ------------------
  564|     29|    case CIPHER_ALGO_AES256:
  ------------------
  |  Branch (564:5): [True: 16, False: 11.9k]
  ------------------
  565|     33|    case CIPHER_ALGO_TWOFISH:
  ------------------
  |  Branch (565:5): [True: 4, False: 11.9k]
  ------------------
  566|     35|    case CIPHER_ALGO_CAMELLIA128:
  ------------------
  |  Branch (566:5): [True: 2, False: 11.9k]
  ------------------
  567|     63|    case CIPHER_ALGO_CAMELLIA192:
  ------------------
  |  Branch (567:5): [True: 28, False: 11.9k]
  ------------------
  568|  4.12k|    case CIPHER_ALGO_CAMELLIA256:
  ------------------
  |  Branch (568:5): [True: 4.06k, False: 7.89k]
  ------------------
  569|  4.12k|      return 16;
  570|       |
  571|  7.83k|    default:
  ------------------
  |  Branch (571:5): [True: 7.83k, False: 4.12k]
  ------------------
  572|  7.83k|      return 8;
  573|  11.9k|    }
  574|  11.9k|}
openpgp_pk_test_algo:
  701|  16.2k|{
  702|  16.2k|  return openpgp_pk_test_algo2 (algo, 0);
  703|  16.2k|}
openpgp_pk_test_algo2:
  710|  16.2k|{
  711|  16.2k|  enum gcry_pk_algos ga = 0;
  712|  16.2k|  size_t use_buf = use;
  713|       |
  714|  16.2k|  switch (algo)
  715|  16.2k|    {
  716|      0|#ifdef GPG_USE_RSA
  717|    207|    case PUBKEY_ALGO_RSA:       ga = GCRY_PK_RSA;   break;
  ------------------
  |  Branch (717:5): [True: 207, False: 16.0k]
  ------------------
  718|    947|    case PUBKEY_ALGO_RSA_E:     ga = GCRY_PK_RSA_E; break;
  ------------------
  |  Branch (718:5): [True: 947, False: 15.2k]
  ------------------
  719|    233|    case PUBKEY_ALGO_RSA_S:     ga = GCRY_PK_RSA_S; break;
  ------------------
  |  Branch (719:5): [True: 233, False: 15.9k]
  ------------------
  720|       |#else
  721|       |    case PUBKEY_ALGO_RSA:       break;
  722|       |    case PUBKEY_ALGO_RSA_E:     break;
  723|       |    case PUBKEY_ALGO_RSA_S:     break;
  724|       |#endif
  725|       |
  726|  8.42k|    case PUBKEY_ALGO_ELGAMAL_E: ga = GCRY_PK_ELG;   break;
  ------------------
  |  Branch (726:5): [True: 8.42k, False: 7.78k]
  ------------------
  727|  1.53k|    case PUBKEY_ALGO_DSA:       ga = GCRY_PK_DSA;   break;
  ------------------
  |  Branch (727:5): [True: 1.53k, False: 14.6k]
  ------------------
  728|       |
  729|      0|#ifdef GPG_USE_ECDH
  730|  2.92k|    case PUBKEY_ALGO_ECDH:      ga = GCRY_PK_ECC;   break;
  ------------------
  |  Branch (730:5): [True: 2.92k, False: 13.2k]
  ------------------
  731|       |#else
  732|       |    case PUBKEY_ALGO_ECDH:      break;
  733|       |#endif
  734|       |
  735|      0|#ifdef GPG_USE_ECDSA
  736|     86|    case PUBKEY_ALGO_ECDSA:     ga = GCRY_PK_ECC;   break;
  ------------------
  |  Branch (736:5): [True: 86, False: 16.1k]
  ------------------
  737|       |#else
  738|       |    case PUBKEY_ALGO_ECDSA:     break;
  739|       |#endif
  740|       |
  741|      0|#ifdef GPG_USE_EDDSA
  742|    193|    case PUBKEY_ALGO_EDDSA:     ga = GCRY_PK_ECC;   break;
  ------------------
  |  Branch (742:5): [True: 193, False: 16.0k]
  ------------------
  743|       |#else
  744|       |    case PUBKEY_ALGO_EDDSA:     break;
  745|       |#endif
  746|       |
  747|    376|    case PUBKEY_ALGO_ELGAMAL:
  ------------------
  |  Branch (747:5): [True: 376, False: 15.8k]
  ------------------
  748|       |      /* Don't allow type 20 keys unless in rfc2440 mode.  */
  749|    376|      if (RFC2440)
  ------------------
  |  |  373|    376|#define RFC2440 (opt.compliance==CO_RFC2440)
  |  |  ------------------
  |  |  |  Branch (373:17): [True: 0, False: 376]
  |  |  ------------------
  ------------------
  750|      0|        ga = GCRY_PK_ELG;
  751|    376|      break;
  752|       |
  753|  1.28k|    default:
  ------------------
  |  Branch (753:5): [True: 1.28k, False: 14.9k]
  ------------------
  754|  1.28k|      break;
  755|  16.2k|    }
  756|  16.2k|  if (!ga)
  ------------------
  |  Branch (756:7): [True: 1.66k, False: 14.5k]
  ------------------
  757|  1.66k|    return gpg_error (GPG_ERR_PUBKEY_ALGO);
  758|       |
  759|       |  /* Elgamal in OpenPGP used to support signing and Libgcrypt still
  760|       |   * does.  However, we removed the signing capability from gpg ages
  761|       |   * ago.  This function should reflect this so that errors are thrown
  762|       |   * early and not only when we try to sign using Elgamal.  */
  763|  14.5k|  if (ga == GCRY_PK_ELG && (use & (PUBKEY_USAGE_CERT | PUBKEY_USAGE_SIG)))
  ------------------
  |  |   51|  8.42k|#define PUBKEY_USAGE_CERT    GCRY_PK_USAGE_CERT  /* Also good to certify keys.*/
  ------------------
                if (ga == GCRY_PK_ELG && (use & (PUBKEY_USAGE_CERT | PUBKEY_USAGE_SIG)))
  ------------------
  |  |   49|  8.42k|#define PUBKEY_USAGE_SIG     GCRY_PK_USAGE_SIGN  /* Good for signatures. */
  ------------------
  |  Branch (763:7): [True: 8.42k, False: 6.12k]
  |  Branch (763:28): [True: 0, False: 8.42k]
  ------------------
  764|      0|    return gpg_error (GPG_ERR_WRONG_PUBKEY_ALGO);
  765|       |
  766|       |  /* Now check whether Libgcrypt has support for the algorithm.  */
  767|  14.5k|  return gcry_pk_algo_info (ga, GCRYCTL_TEST_ALGO, NULL, &use_buf);
  768|  14.5k|}
openpgp_pk_algo_name:
  813|  49.0k|{
  814|  49.0k|  switch (algo)
  815|  49.0k|    {
  816|    226|    case PUBKEY_ALGO_RSA:
  ------------------
  |  Branch (816:5): [True: 226, False: 48.8k]
  ------------------
  817|  1.18k|    case PUBKEY_ALGO_RSA_E:
  ------------------
  |  Branch (817:5): [True: 957, False: 48.1k]
  ------------------
  818|  1.41k|    case PUBKEY_ALGO_RSA_S:     return "RSA";
  ------------------
  |  Branch (818:5): [True: 233, False: 48.8k]
  ------------------
  819|    394|    case PUBKEY_ALGO_ELGAMAL:
  ------------------
  |  Branch (819:5): [True: 394, False: 48.6k]
  ------------------
  820|  9.96k|    case PUBKEY_ALGO_ELGAMAL_E: return "ELG";
  ------------------
  |  Branch (820:5): [True: 9.56k, False: 39.4k]
  ------------------
  821|  1.62k|    case PUBKEY_ALGO_DSA:       return "DSA";
  ------------------
  |  Branch (821:5): [True: 1.62k, False: 47.4k]
  ------------------
  822|  3.05k|    case PUBKEY_ALGO_ECDH:      return "ECDH";
  ------------------
  |  Branch (822:5): [True: 3.05k, False: 46.0k]
  ------------------
  823|     86|    case PUBKEY_ALGO_ECDSA:     return "ECDSA";
  ------------------
  |  Branch (823:5): [True: 86, False: 48.9k]
  ------------------
  824|    195|    case PUBKEY_ALGO_EDDSA:     return "EDDSA";
  ------------------
  |  Branch (824:5): [True: 195, False: 48.8k]
  ------------------
  825|  32.7k|    default: return "?";
  ------------------
  |  Branch (825:5): [True: 32.7k, False: 16.3k]
  ------------------
  826|  49.0k|    }
  827|  49.0k|}
map_md_openpgp_to_gcry:
  834|   123k|{
  835|   123k|  switch (algo)
  836|   123k|    {
  837|      0|#ifdef GPG_USE_MD5
  838|  4.29k|    case DIGEST_ALGO_MD5:    return GCRY_MD_MD5;
  ------------------
  |  Branch (838:5): [True: 4.29k, False: 118k]
  ------------------
  839|       |#else
  840|       |    case DIGEST_ALGO_MD5:    return 0;
  841|       |#endif
  842|       |
  843|  13.4k|    case DIGEST_ALGO_SHA1:   return GCRY_MD_SHA1;
  ------------------
  |  Branch (843:5): [True: 13.4k, False: 109k]
  ------------------
  844|       |
  845|      0|#ifdef GPG_USE_RMD160
  846|  6.65k|    case DIGEST_ALGO_RMD160: return GCRY_MD_RMD160;
  ------------------
  |  Branch (846:5): [True: 6.65k, False: 116k]
  ------------------
  847|       |#else
  848|       |    case DIGEST_ALGO_RMD160: return 0;
  849|       |#endif
  850|       |
  851|      0|#ifdef GPG_USE_SHA224
  852|  3.28k|    case DIGEST_ALGO_SHA224: return GCRY_MD_SHA224;
  ------------------
  |  Branch (852:5): [True: 3.28k, False: 119k]
  ------------------
  853|       |#else
  854|       |    case DIGEST_ALGO_SHA224: return 0;
  855|       |#endif
  856|       |
  857|  13.4k|    case DIGEST_ALGO_SHA256: return GCRY_MD_SHA256;
  ------------------
  |  Branch (857:5): [True: 13.4k, False: 109k]
  ------------------
  858|       |
  859|      0|#ifdef GPG_USE_SHA384
  860|  1.42k|    case DIGEST_ALGO_SHA384: return GCRY_MD_SHA384;
  ------------------
  |  Branch (860:5): [True: 1.42k, False: 121k]
  ------------------
  861|       |#else
  862|       |    case DIGEST_ALGO_SHA384: return 0;
  863|       |#endif
  864|       |
  865|      0|#ifdef GPG_USE_SHA512
  866|  8.38k|    case DIGEST_ALGO_SHA512: return GCRY_MD_SHA512;
  ------------------
  |  Branch (866:5): [True: 8.38k, False: 114k]
  ------------------
  867|       |#else
  868|       |    case DIGEST_ALGO_SHA512: return 0;
  869|       |#endif
  870|  72.1k|    default: return 0;
  ------------------
  |  Branch (870:5): [True: 72.1k, False: 50.9k]
  ------------------
  871|   123k|    }
  872|   123k|}
openpgp_md_test_algo:
  879|   120k|{
  880|   120k|  enum gcry_md_algos ga;
  881|       |
  882|   120k|  ga = map_md_openpgp_to_gcry (algo);
  883|   120k|  if (!ga)
  ------------------
  |  Branch (883:7): [True: 72.1k, False: 48.1k]
  ------------------
  884|  72.1k|    return gpg_error (GPG_ERR_DIGEST_ALGO);
  885|       |
  886|  48.1k|  return gcry_md_test_algo (ga);
  887|   120k|}
check_compress_algo:
 1363|   263k|{
 1364|   263k|  switch (algo)
 1365|   263k|    {
 1366|   263k|    case 0: return 0;
  ------------------
  |  Branch (1366:5): [True: 263k, False: 341]
  ------------------
 1367|       |#ifdef HAVE_ZIP
 1368|       |    case 1:
 1369|       |    case 2: return 0;
 1370|       |#endif
 1371|       |#ifdef HAVE_BZIP2
 1372|       |    case 3: return 0;
 1373|       |#endif
 1374|    341|    default: return GPG_ERR_COMPR_ALGO;
  ------------------
  |  Branch (1374:5): [True: 341, False: 263k]
  ------------------
 1375|   263k|    }
 1376|   263k|}
pubkey_get_npkey:
 1697|   134k|{
 1698|   134k|  switch (algo)
 1699|   134k|    {
 1700|  29.7k|    case PUBKEY_ALGO_RSA:
  ------------------
  |  Branch (1700:5): [True: 29.7k, False: 104k]
  ------------------
 1701|  32.8k|    case PUBKEY_ALGO_RSA_E:
  ------------------
  |  Branch (1701:5): [True: 3.10k, False: 131k]
  ------------------
 1702|  33.8k|    case PUBKEY_ALGO_RSA_S:     return 2;
  ------------------
  |  Branch (1702:5): [True: 999, False: 133k]
  ------------------
 1703|  13.2k|    case PUBKEY_ALGO_ELGAMAL_E: return 3;
  ------------------
  |  Branch (1703:5): [True: 13.2k, False: 121k]
  ------------------
 1704|    368|    case PUBKEY_ALGO_DSA:       return 4;
  ------------------
  |  Branch (1704:5): [True: 368, False: 134k]
  ------------------
 1705|  6.51k|    case PUBKEY_ALGO_ECDH:      return 3;
  ------------------
  |  Branch (1705:5): [True: 6.51k, False: 128k]
  ------------------
 1706|  2.36k|    case PUBKEY_ALGO_ECDSA:     return 2;
  ------------------
  |  Branch (1706:5): [True: 2.36k, False: 132k]
  ------------------
 1707|     30|    case PUBKEY_ALGO_ELGAMAL:   return 3;
  ------------------
  |  Branch (1707:5): [True: 30, False: 134k]
  ------------------
 1708|  2.60k|    case PUBKEY_ALGO_EDDSA:     return 2;
  ------------------
  |  Branch (1708:5): [True: 2.60k, False: 132k]
  ------------------
 1709|  75.7k|    default: return 0;
  ------------------
  |  Branch (1709:5): [True: 75.7k, False: 58.9k]
  ------------------
 1710|   134k|    }
 1711|   134k|}
pubkey_get_nskey:
 1717|  59.8k|{
 1718|  59.8k|  switch (algo)
 1719|  59.8k|    {
 1720|  43.5k|    case PUBKEY_ALGO_RSA:
  ------------------
  |  Branch (1720:5): [True: 43.5k, False: 16.2k]
  ------------------
 1721|  48.3k|    case PUBKEY_ALGO_RSA_E:
  ------------------
  |  Branch (1721:5): [True: 4.81k, False: 55.0k]
  ------------------
 1722|  50.0k|    case PUBKEY_ALGO_RSA_S:     return 6;
  ------------------
  |  Branch (1722:5): [True: 1.67k, False: 58.1k]
  ------------------
 1723|     83|    case PUBKEY_ALGO_ELGAMAL_E: return 4;
  ------------------
  |  Branch (1723:5): [True: 83, False: 59.7k]
  ------------------
 1724|    499|    case PUBKEY_ALGO_DSA:       return 5;
  ------------------
  |  Branch (1724:5): [True: 499, False: 59.3k]
  ------------------
 1725|  1.25k|    case PUBKEY_ALGO_ECDH:      return 4;
  ------------------
  |  Branch (1725:5): [True: 1.25k, False: 58.5k]
  ------------------
 1726|  2.20k|    case PUBKEY_ALGO_ECDSA:     return 3;
  ------------------
  |  Branch (1726:5): [True: 2.20k, False: 57.6k]
  ------------------
 1727|     18|    case PUBKEY_ALGO_ELGAMAL:   return 4;
  ------------------
  |  Branch (1727:5): [True: 18, False: 59.8k]
  ------------------
 1728|  2.98k|    case PUBKEY_ALGO_EDDSA:     return 3;
  ------------------
  |  Branch (1728:5): [True: 2.98k, False: 56.8k]
  ------------------
 1729|  2.74k|    default: return 0;
  ------------------
  |  Branch (1729:5): [True: 2.74k, False: 57.0k]
  ------------------
 1730|  59.8k|    }
 1731|  59.8k|}
pubkey_get_nsig:
 1736|   421k|{
 1737|   421k|  switch (algo)
 1738|   421k|    {
 1739|  1.00k|    case PUBKEY_ALGO_RSA:
  ------------------
  |  Branch (1739:5): [True: 1.00k, False: 420k]
  ------------------
 1740|  11.4k|    case PUBKEY_ALGO_RSA_E:
  ------------------
  |  Branch (1740:5): [True: 10.4k, False: 411k]
  ------------------
 1741|  12.0k|    case PUBKEY_ALGO_RSA_S:     return 1;
  ------------------
  |  Branch (1741:5): [True: 678, False: 420k]
  ------------------
 1742|  26.9k|    case PUBKEY_ALGO_ELGAMAL_E: return 0;
  ------------------
  |  Branch (1742:5): [True: 26.9k, False: 394k]
  ------------------
 1743|  16.8k|    case PUBKEY_ALGO_DSA:       return 2;
  ------------------
  |  Branch (1743:5): [True: 16.8k, False: 404k]
  ------------------
 1744|  8.73k|    case PUBKEY_ALGO_ECDH:      return 0;
  ------------------
  |  Branch (1744:5): [True: 8.73k, False: 412k]
  ------------------
 1745|  1.05k|    case PUBKEY_ALGO_ECDSA:     return 2;
  ------------------
  |  Branch (1745:5): [True: 1.05k, False: 420k]
  ------------------
 1746|  2.72k|    case PUBKEY_ALGO_ELGAMAL:   return 2;
  ------------------
  |  Branch (1746:5): [True: 2.72k, False: 418k]
  ------------------
 1747|  3.85k|    case PUBKEY_ALGO_EDDSA:     return 2;
  ------------------
  |  Branch (1747:5): [True: 3.85k, False: 417k]
  ------------------
 1748|   349k|    default: return 0;
  ------------------
  |  Branch (1748:5): [True: 349k, False: 72.2k]
  ------------------
 1749|   421k|    }
 1750|   421k|}
pubkey_get_nenc:
 1756|  56.4k|{
 1757|  56.4k|  switch (algo)
 1758|  56.4k|    {
 1759|     90|    case PUBKEY_ALGO_RSA:
  ------------------
  |  Branch (1759:5): [True: 90, False: 56.3k]
  ------------------
 1760|    564|    case PUBKEY_ALGO_RSA_E:
  ------------------
  |  Branch (1760:5): [True: 474, False: 55.9k]
  ------------------
 1761|    724|    case PUBKEY_ALGO_RSA_S:     return 1;
  ------------------
  |  Branch (1761:5): [True: 160, False: 56.2k]
  ------------------
 1762|  2.78k|    case PUBKEY_ALGO_ELGAMAL_E: return 2;
  ------------------
  |  Branch (1762:5): [True: 2.78k, False: 53.6k]
  ------------------
 1763|      0|    case PUBKEY_ALGO_DSA:       return 0;
  ------------------
  |  Branch (1763:5): [True: 0, False: 56.4k]
  ------------------
 1764|  42.5k|    case PUBKEY_ALGO_ECDH:      return 2;
  ------------------
  |  Branch (1764:5): [True: 42.5k, False: 13.8k]
  ------------------
 1765|      0|    case PUBKEY_ALGO_ECDSA:     return 0;
  ------------------
  |  Branch (1765:5): [True: 0, False: 56.4k]
  ------------------
 1766|      2|    case PUBKEY_ALGO_ELGAMAL:   return 2;
  ------------------
  |  Branch (1766:5): [True: 2, False: 56.4k]
  ------------------
 1767|      0|    case PUBKEY_ALGO_EDDSA:     return 0;
  ------------------
  |  Branch (1767:5): [True: 0, False: 56.4k]
  ------------------
 1768|  10.3k|    default: return 0;
  ------------------
  |  Branch (1768:5): [True: 10.3k, False: 46.0k]
  ------------------
 1769|  56.4k|    }
 1770|  56.4k|}

get_matching_datafile:
  313|   182k|{
  314|   182k|  char *fname = NULL;
  315|   182k|  size_t len;
  316|       |
  317|   182k|  if (iobuf_is_pipe_filename (sigfilename))
  ------------------
  |  Branch (317:7): [True: 0, False: 182k]
  ------------------
  318|      0|    return NULL;
  319|       |
  320|   182k|  len = strlen (sigfilename);
  321|   182k|  if (len > 4
  ------------------
  |  Branch (321:7): [True: 182k, False: 0]
  ------------------
  322|   182k|      && (!strcmp (sigfilename + len - 4, EXTSEP_S "sig")
  ------------------
  |  |  889|   182k|#define EXTSEP_S "."
  ------------------
  |  Branch (322:11): [True: 0, False: 182k]
  ------------------
  323|   182k|          || (len > 5 && !strcmp(sigfilename + len - 5, EXTSEP_S "sign"))
  ------------------
  |  |  889|   182k|#define EXTSEP_S "."
  ------------------
  |  Branch (323:15): [True: 182k, False: 0]
  |  Branch (323:26): [True: 0, False: 182k]
  ------------------
  324|   182k|          || !strcmp(sigfilename + len - 4, EXTSEP_S "asc")))
  ------------------
  |  |  889|   182k|#define EXTSEP_S "."
  ------------------
  |  Branch (324:14): [True: 0, False: 182k]
  ------------------
  325|      0|    {
  326|       |
  327|      0|      fname = xstrdup (sigfilename);
  ------------------
  |  |  112|      0|#define xstrdup(a)       gcry_xstrdup ((a))
  ------------------
  328|      0|      fname[len-(fname[len-1]=='n'?5:4)] = 0 ;
  ------------------
  |  Branch (328:18): [True: 0, False: 0]
  ------------------
  329|      0|      if (gnupg_access (fname, R_OK ))
  ------------------
  |  Branch (329:11): [True: 0, False: 0]
  ------------------
  330|      0|        {
  331|       |          /* Not found or other error.  */
  332|      0|          xfree (fname);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  333|      0|          fname = NULL;
  334|      0|        }
  335|      0|    }
  336|       |
  337|   182k|  return fname;
  338|   182k|}
open_sigfile:
  347|   182k|{
  348|   182k|  iobuf_t a = NULL;
  349|   182k|  char *buf;
  350|       |
  351|   182k|  buf = get_matching_datafile (sigfilename);
  352|   182k|  if (buf)
  ------------------
  |  Branch (352:7): [True: 0, False: 182k]
  ------------------
  353|      0|    {
  354|      0|      a = iobuf_open (buf);
  355|      0|      if (a && is_secured_file (iobuf_get_fd (a)))
  ------------------
  |  Branch (355:11): [True: 0, False: 0]
  |  Branch (355:16): [True: 0, False: 0]
  ------------------
  356|      0|        {
  357|      0|          iobuf_close (a);
  358|      0|          a = NULL;
  359|      0|          gpg_err_set_errno (EPERM);
  360|      0|        }
  361|      0|      if (a)
  ------------------
  |  Branch (361:11): [True: 0, False: 0]
  ------------------
  362|      0|        log_info (_("assuming signed data in '%s'\n"), buf);
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  363|      0|      if (a && pfx)
  ------------------
  |  Branch (363:11): [True: 0, False: 0]
  |  Branch (363:16): [True: 0, False: 0]
  ------------------
  364|      0|        handle_progress (pfx, a, buf);
  365|      0|      xfree (buf);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  366|      0|    }
  367|       |
  368|   182k|  return a;
  369|   182k|}

register_known_notation:
  264|  2.30k|{
  265|  2.30k|  strlist_t sl;
  266|       |
  267|  2.30k|  if (!known_notations_list)
  ------------------
  |  Branch (267:7): [True: 1, False: 2.29k]
  ------------------
  268|      1|    {
  269|      1|      sl = add_to_strlist (&known_notations_list,
  270|      1|                           "preferred-email-encoding@pgp.com");
  271|      1|      sl->flags = 32;  /* Length of the string.  */
  272|      1|    }
  273|  2.30k|  if (!string)
  ------------------
  |  Branch (273:7): [True: 2.30k, False: 0]
  ------------------
  274|  2.30k|    return; /* Only initialized the default known notations.  */
  275|       |
  276|       |  /* In --set-notation we use an exclamation mark to indicate a
  277|       |   * critical notation.  As a convenience skip this here.  */
  278|      0|  if (*string == '!')
  ------------------
  |  Branch (278:7): [True: 0, False: 0]
  ------------------
  279|      0|    string++;
  280|       |
  281|      0|  if (!*string || strlist_find (known_notations_list, string))
  ------------------
  |  Branch (281:7): [True: 0, False: 0]
  |  Branch (281:19): [True: 0, False: 0]
  ------------------
  282|      0|    return; /* Empty string or already registered.  */
  283|       |
  284|      0|  sl = add_to_strlist (&known_notations_list, string);
  285|      0|  sl->flags = strlen (string);
  286|      0|}
dbg_parse_packet:
  368|  1.01M|{
  369|  1.01M|  int skip, rc;
  370|       |
  371|  1.01M|  do
  372|  1.05M|    {
  373|  1.05M|      rc = parse (ctx, pkt, 0, NULL, &skip, NULL, 0, "parse", dbg_f, dbg_l);
  374|  1.05M|    }
  375|  1.05M|  while (skip && ! rc);
  ------------------
  |  Branch (375:10): [True: 36.9k, False: 1.01M]
  |  Branch (375:18): [True: 36.9k, False: 7]
  ------------------
  376|  1.01M|  return rc;
  377|  1.01M|}
parse_one_sig_subpkt:
 1739|  63.7k|{
 1740|  63.7k|  switch (type)
 1741|  63.7k|    {
 1742|  2.84k|    case SIGSUBPKT_REV_KEY:
  ------------------
  |  Branch (1742:5): [True: 2.84k, False: 60.8k]
  ------------------
 1743|  2.84k|      if (n < 22)
  ------------------
  |  Branch (1743:11): [True: 416, False: 2.43k]
  ------------------
 1744|    416|	break;
 1745|  2.43k|      return 0;
 1746|  3.37k|    case SIGSUBPKT_SIG_CREATED:
  ------------------
  |  Branch (1746:5): [True: 3.37k, False: 60.3k]
  ------------------
 1747|  5.92k|    case SIGSUBPKT_SIG_EXPIRE:
  ------------------
  |  Branch (1747:5): [True: 2.55k, False: 61.1k]
  ------------------
 1748|  5.92k|    case SIGSUBPKT_KEY_EXPIRE:
  ------------------
  |  Branch (1748:5): [True: 0, False: 63.7k]
  ------------------
 1749|  5.92k|      if (n < 4)
  ------------------
  |  Branch (1749:11): [True: 1.99k, False: 3.93k]
  ------------------
 1750|  1.99k|	break;
 1751|  3.93k|      return 0;
 1752|      0|    case SIGSUBPKT_KEY_FLAGS:
  ------------------
  |  Branch (1752:5): [True: 0, False: 63.7k]
  ------------------
 1753|      0|    case SIGSUBPKT_KS_FLAGS:
  ------------------
  |  Branch (1753:5): [True: 0, False: 63.7k]
  ------------------
 1754|      0|    case SIGSUBPKT_PREF_SYM:
  ------------------
  |  Branch (1754:5): [True: 0, False: 63.7k]
  ------------------
 1755|      0|    case SIGSUBPKT_PREF_AEAD:
  ------------------
  |  Branch (1755:5): [True: 0, False: 63.7k]
  ------------------
 1756|      0|    case SIGSUBPKT_PREF_HASH:
  ------------------
  |  Branch (1756:5): [True: 0, False: 63.7k]
  ------------------
 1757|      0|    case SIGSUBPKT_PREF_COMPR:
  ------------------
  |  Branch (1757:5): [True: 0, False: 63.7k]
  ------------------
 1758|  1.03k|    case SIGSUBPKT_POLICY:
  ------------------
  |  Branch (1758:5): [True: 1.03k, False: 62.6k]
  ------------------
 1759|  8.97k|    case SIGSUBPKT_PREF_KS:
  ------------------
  |  Branch (1759:5): [True: 7.94k, False: 55.7k]
  ------------------
 1760|  8.97k|    case SIGSUBPKT_FEATURES:
  ------------------
  |  Branch (1760:5): [True: 0, False: 63.7k]
  ------------------
 1761|  9.30k|    case SIGSUBPKT_REGEXP:
  ------------------
  |  Branch (1761:5): [True: 329, False: 63.3k]
  ------------------
 1762|  9.30k|    case SIGSUBPKT_ATTST_SIGS:
  ------------------
  |  Branch (1762:5): [True: 0, False: 63.7k]
  ------------------
 1763|  9.30k|      return 0;
 1764|      0|    case SIGSUBPKT_SIGNATURE:
  ------------------
  |  Branch (1764:5): [True: 0, False: 63.7k]
  ------------------
 1765|  1.90k|    case SIGSUBPKT_EXPORTABLE:
  ------------------
  |  Branch (1765:5): [True: 1.90k, False: 61.8k]
  ------------------
 1766|  3.16k|    case SIGSUBPKT_REVOCABLE:
  ------------------
  |  Branch (1766:5): [True: 1.26k, False: 62.4k]
  ------------------
 1767|  3.16k|    case SIGSUBPKT_REVOC_REASON:
  ------------------
  |  Branch (1767:5): [True: 0, False: 63.7k]
  ------------------
 1768|  3.16k|      if (!n)
  ------------------
  |  Branch (1768:11): [True: 682, False: 2.48k]
  ------------------
 1769|    682|	break;
 1770|  2.48k|      return 0;
 1771|    839|    case SIGSUBPKT_ISSUER:	/* issuer key ID */
  ------------------
  |  Branch (1771:5): [True: 839, False: 62.8k]
  ------------------
 1772|    839|      if (n < 8)
  ------------------
  |  Branch (1772:11): [True: 603, False: 236]
  ------------------
 1773|    603|	break;
 1774|    236|      return 0;
 1775|  21.1k|    case SIGSUBPKT_ISSUER_FPR:	/* issuer key fingerprint */
  ------------------
  |  Branch (1775:5): [True: 21.1k, False: 42.6k]
  ------------------
 1776|  21.1k|      if (n < 21)
  ------------------
  |  Branch (1776:11): [True: 3.23k, False: 17.8k]
  ------------------
 1777|  3.23k|	break;
 1778|  17.8k|      return 0;
 1779|  3.08k|    case SIGSUBPKT_NOTATION:
  ------------------
  |  Branch (1779:5): [True: 3.08k, False: 60.6k]
  ------------------
 1780|       |      /* minimum length needed, and the subpacket must be well-formed
 1781|       |         where the name length and value length all fit inside the
 1782|       |         packet. */
 1783|  3.08k|      if (n < 8
  ------------------
  |  Branch (1783:11): [True: 541, False: 2.54k]
  ------------------
 1784|  3.08k|	  || 8 + ((buffer[4] << 8) | buffer[5]) +
  ------------------
  |  Branch (1784:7): [True: 2.29k, False: 250]
  ------------------
 1785|  2.54k|	  ((buffer[6] << 8) | buffer[7]) != n)
 1786|  2.83k|	break;
 1787|    250|      return 0;
 1788|      0|    case SIGSUBPKT_PRIMARY_UID:
  ------------------
  |  Branch (1788:5): [True: 0, False: 63.7k]
  ------------------
 1789|      0|      if (n != 1)
  ------------------
  |  Branch (1789:11): [True: 0, False: 0]
  ------------------
 1790|      0|	break;
 1791|      0|      return 0;
 1792|  2.75k|    case SIGSUBPKT_TRUST:
  ------------------
  |  Branch (1792:5): [True: 2.75k, False: 60.9k]
  ------------------
 1793|  2.75k|      if (n != 2)
  ------------------
  |  Branch (1793:11): [True: 2.34k, False: 416]
  ------------------
 1794|  2.34k|	break;
 1795|    416|      return 0;
 1796|  2.21k|    case SIGSUBPKT_KEY_BLOCK:
  ------------------
  |  Branch (1796:5): [True: 2.21k, False: 61.4k]
  ------------------
 1797|  2.21k|      if (n && buffer[0])
  ------------------
  |  Branch (1797:11): [True: 1.16k, False: 1.05k]
  |  Branch (1797:16): [True: 739, False: 426]
  ------------------
 1798|    739|        return -1; /* Unknown version - ignore.  */
 1799|  1.47k|      if (n < 50)
  ------------------
  |  Branch (1799:11): [True: 1.34k, False: 129]
  ------------------
 1800|  1.34k|	break;  /* Definitely too short to carry a key block.  */
 1801|    129|      return 0;
 1802|  12.4k|    default:
  ------------------
  |  Branch (1802:5): [True: 12.4k, False: 51.2k]
  ------------------
 1803|  12.4k|      return 0;
 1804|  63.7k|    }
 1805|  13.4k|  return -2;
 1806|  63.7k|}
enum_sig_subpkt:
 1885|   878k|{
 1886|   878k|  const byte *buffer;
 1887|   878k|  int buflen;
 1888|   878k|  int type;
 1889|   878k|  int critical_dummy;
 1890|   878k|  int offset;
 1891|   878k|  size_t n;
 1892|   878k|  const subpktarea_t *pktbuf = want_hashed? sig->hashed : sig->unhashed;
  ------------------
  |  Branch (1892:32): [True: 758k, False: 120k]
  ------------------
 1893|   878k|  int seq = 0;
 1894|   878k|  int reqseq = start ? *start : 0;
  ------------------
  |  Branch (1894:16): [True: 16.2k, False: 862k]
  ------------------
 1895|       |
 1896|   878k|  if (!critical)
  ------------------
  |  Branch (1896:7): [True: 878k, False: 0]
  ------------------
 1897|   878k|    critical = &critical_dummy;
 1898|       |
 1899|   878k|  if (!pktbuf || reqseq == -1)
  ------------------
  |  Branch (1899:7): [True: 176k, False: 701k]
  |  Branch (1899:18): [True: 0, False: 701k]
  ------------------
 1900|   176k|    {
 1901|   176k|      static char dummy[] = "x";
 1902|       |      /* Return a value different from NULL to indicate that
 1903|       |       * there is no critical bit we do not understand.  */
 1904|   176k|      return reqtype ==	SIGSUBPKT_TEST_CRITICAL ? dummy : NULL;
  ------------------
  |  Branch (1904:14): [True: 20.0k, False: 156k]
  ------------------
 1905|   176k|    }
 1906|   701k|  buffer = pktbuf->data;
 1907|   701k|  buflen = pktbuf->len;
 1908|  2.07M|  while (buflen)
  ------------------
  |  Branch (1908:10): [True: 1.76M, False: 309k]
  ------------------
 1909|  1.76M|    {
 1910|  1.76M|      n = *buffer++;
 1911|  1.76M|      buflen--;
 1912|  1.76M|      if (n == 255) /* 4 byte length header.  */
  ------------------
  |  Branch (1912:11): [True: 44.1k, False: 1.72M]
  ------------------
 1913|  44.1k|	{
 1914|  44.1k|	  if (buflen < 4)
  ------------------
  |  Branch (1914:8): [True: 26.1k, False: 17.9k]
  ------------------
 1915|  26.1k|	    goto too_short;
 1916|  17.9k|	  n = buf32_to_size_t (buffer);
 1917|  17.9k|	  buffer += 4;
 1918|  17.9k|	  buflen -= 4;
 1919|  17.9k|	}
 1920|  1.72M|      else if (n >= 192) /* 4 byte special encoded length header.  */
  ------------------
  |  Branch (1920:16): [True: 84.1k, False: 1.63M]
  ------------------
 1921|  84.1k|	{
 1922|  84.1k|	  if (buflen < 2)
  ------------------
  |  Branch (1922:8): [True: 54.8k, False: 29.3k]
  ------------------
 1923|  54.8k|	    goto too_short;
 1924|  29.3k|	  n = ((n - 192) << 8) + *buffer + 192;
 1925|  29.3k|	  buffer++;
 1926|  29.3k|	  buflen--;
 1927|  29.3k|	}
 1928|  1.68M|      if (buflen < n)
  ------------------
  |  Branch (1928:11): [True: 175k, False: 1.50M]
  ------------------
 1929|   175k|	goto too_short;
 1930|  1.50M|      if (!buflen)
  ------------------
  |  Branch (1930:11): [True: 51.9k, False: 1.45M]
  ------------------
 1931|  51.9k|        goto no_type_byte;
 1932|  1.45M|      type = *buffer;
 1933|  1.45M|      if (type & 0x80)
  ------------------
  |  Branch (1933:11): [True: 580k, False: 876k]
  ------------------
 1934|   580k|	{
 1935|   580k|	  type &= 0x7f;
 1936|   580k|	  *critical = 1;
 1937|   580k|	}
 1938|   876k|      else
 1939|   876k|	*critical = 0;
 1940|  1.45M|      if (!(++seq > reqseq))
  ------------------
  |  Branch (1940:11): [True: 14.8k, False: 1.44M]
  ------------------
 1941|  14.8k|	;
 1942|  1.44M|      else if (reqtype == SIGSUBPKT_TEST_CRITICAL)
  ------------------
  |  Branch (1942:16): [True: 93.1k, False: 1.34M]
  ------------------
 1943|  93.1k|	{
 1944|  93.1k|	  if (*critical)
  ------------------
  |  Branch (1944:8): [True: 42.3k, False: 50.7k]
  ------------------
 1945|  42.3k|	    {
 1946|  42.3k|	      if (n - 1 > buflen + 1)
  ------------------
  |  Branch (1946:12): [True: 4.20k, False: 38.1k]
  ------------------
 1947|  4.20k|		goto too_short;
 1948|  38.1k|	      if (!can_handle_critical (buffer + 1, n - 1, type))
  ------------------
  |  Branch (1948:12): [True: 14.1k, False: 24.0k]
  ------------------
 1949|  14.1k|		{
 1950|  14.1k|		  if (opt.verbose && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (1950:9): [True: 0, False: 14.1k]
  |  Branch (1950:24): [True: 0, False: 0]
  ------------------
 1951|      0|		    log_info (_("subpacket of type %d has "
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 1952|      0|				"critical bit set\n"), type);
 1953|  14.1k|		  if (start)
  ------------------
  |  Branch (1953:9): [True: 0, False: 14.1k]
  ------------------
 1954|      0|		    *start = seq;
 1955|  14.1k|		  return NULL;	/* This is an error.  */
 1956|  14.1k|		}
 1957|  38.1k|	    }
 1958|  93.1k|	}
 1959|  1.34M|      else if (reqtype < 0) /* List packets.  */
  ------------------
  |  Branch (1959:16): [True: 0, False: 1.34M]
  ------------------
 1960|      0|	dump_sig_subpkt (reqtype == SIGSUBPKT_LIST_HASHED,
 1961|      0|			 type, *critical, buffer, buflen, n, sig->digest_algo);
 1962|  1.34M|      else if (type == reqtype) /* Found.  */
  ------------------
  |  Branch (1962:16): [True: 65.4k, False: 1.28M]
  ------------------
 1963|  65.4k|	{
 1964|  65.4k|	  buffer++;
 1965|  65.4k|	  n--;
 1966|  65.4k|	  if (n > buflen)
  ------------------
  |  Branch (1966:8): [True: 1.73k, False: 63.7k]
  ------------------
 1967|  1.73k|	    goto too_short;
 1968|  63.7k|	  if (ret_n)
  ------------------
  |  Branch (1968:8): [True: 43.3k, False: 20.3k]
  ------------------
 1969|  43.3k|	    *ret_n = n;
 1970|  63.7k|	  offset = parse_one_sig_subpkt (buffer, n, type);
 1971|  63.7k|	  switch (offset)
 1972|  63.7k|	    {
 1973|  13.4k|	    case -2:
  ------------------
  |  Branch (1973:6): [True: 13.4k, False: 50.2k]
  ------------------
 1974|  13.4k|	      log_error ("subpacket of type %d too short\n", type);
 1975|  13.4k|	      return NULL;
 1976|    739|	    case -1:
  ------------------
  |  Branch (1976:6): [True: 739, False: 62.9k]
  ------------------
 1977|    739|	      return NULL;
 1978|  49.5k|	    default:
  ------------------
  |  Branch (1978:6): [True: 49.5k, False: 14.1k]
  ------------------
 1979|  49.5k|	      break;
 1980|  63.7k|	    }
 1981|  49.5k|	  if (start)
  ------------------
  |  Branch (1981:8): [True: 6.29k, False: 43.2k]
  ------------------
 1982|  6.29k|	    *start = seq;
 1983|  49.5k|	  return buffer + offset;
 1984|  63.7k|	}
 1985|  1.37M|      buffer += n;
 1986|  1.37M|      buflen -= n;
 1987|  1.37M|    }
 1988|   309k|  if (reqtype == SIGSUBPKT_TEST_CRITICAL)
  ------------------
  |  Branch (1988:7): [True: 17.0k, False: 292k]
  ------------------
 1989|       |    /* Returning NULL means we found a subpacket with the critical bit
 1990|       |       set that we don't grok.  We've iterated over all the subpackets
 1991|       |       and haven't found such a packet so we need to return a non-NULL
 1992|       |       value.  */
 1993|  17.0k|    return buffer;
 1994|       |
 1995|       |  /* Critical bit we don't understand. */
 1996|   292k|  if (start)
  ------------------
  |  Branch (1996:7): [True: 2.48k, False: 289k]
  ------------------
 1997|  2.48k|    *start = -1;
 1998|   292k|  return NULL;	/* End of packets; not found.  */
 1999|       |
 2000|   262k| too_short:
 2001|   262k|  if (opt.debug && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (2001:7): [True: 0, False: 262k]
  |  Branch (2001:20): [True: 0, False: 0]
  ------------------
 2002|      0|    {
 2003|      0|      es_fflush (es_stdout);
 2004|      0|      log_printhex (pktbuf->data, pktbuf->len > 16? 16 : pktbuf->len,
  ------------------
  |  Branch (2004:35): [True: 0, False: 0]
  ------------------
 2005|      0|                    "buffer shorter than subpacket (%zu/%d/%zu); dump:",
 2006|      0|                    pktbuf->len, buflen, n);
 2007|      0|    }
 2008|       |
 2009|   262k|  if (start)
  ------------------
  |  Branch (2009:7): [True: 4.66k, False: 258k]
  ------------------
 2010|  4.66k|    *start = -1;
 2011|   262k|  return NULL;
 2012|       |
 2013|  51.9k| no_type_byte:
 2014|  51.9k|  if (opt.verbose && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (2014:7): [True: 0, False: 51.9k]
  |  Branch (2014:22): [True: 0, False: 0]
  ------------------
 2015|      0|    log_info ("type octet missing in subpacket\n");
 2016|  51.9k|  if (start)
  ------------------
  |  Branch (2016:7): [True: 2.28k, False: 49.6k]
  ------------------
 2017|  2.28k|    *start = -1;
 2018|  51.9k|  return NULL;
 2019|   309k|}
parse_sig_subpkt:
 2025|   862k|{
 2026|   862k|  return enum_sig_subpkt (sig, want_hashed, reqtype, ret_n, NULL, NULL);
 2027|   862k|}
parse_sig_subpkt2:
 2032|   100k|{
 2033|   100k|  const byte *p;
 2034|       |
 2035|   100k|  p = parse_sig_subpkt (sig, 1, reqtype, NULL);
 2036|   100k|  if (!p)
  ------------------
  |  Branch (2036:7): [True: 99.7k, False: 734]
  ------------------
 2037|  99.7k|    p = parse_sig_subpkt (sig, 0, reqtype, NULL);
 2038|   100k|  return p;
 2039|   100k|}
parse_revkeys:
 2045|  6.57k|{
 2046|  6.57k|  const byte *revkey;
 2047|  6.57k|  int seq = 0;
 2048|  6.57k|  size_t len;
 2049|       |
 2050|  6.57k|  if (sig->sig_class != 0x1F)
  ------------------
  |  Branch (2050:7): [True: 0, False: 6.57k]
  ------------------
 2051|      0|    return;
 2052|       |
 2053|  9.01k|  while ((revkey = enum_sig_subpkt (sig, 1, SIGSUBPKT_REV_KEY,
  ------------------
  |  Branch (2053:10): [True: 2.43k, False: 6.57k]
  ------------------
 2054|  9.01k|                                    &len, &seq, NULL)))
 2055|  2.43k|    {
 2056|       |      /* Consider only valid packets.  They must have a length of
 2057|       |       * either 2+20 or 2+32 octets and bit 7 of the class octet must
 2058|       |       * be set.  */
 2059|  2.43k|      if ((len == 22 || len == 34)
  ------------------
  |  Branch (2059:12): [True: 85, False: 2.34k]
  |  Branch (2059:25): [True: 2.17k, False: 171]
  ------------------
 2060|  2.43k|          && (revkey[0] & 0x80))
  ------------------
  |  Branch (2060:14): [True: 66, False: 2.19k]
  ------------------
 2061|     66|	{
 2062|     66|	  sig->revkey = xrealloc (sig->revkey,
  ------------------
  |  |  111|     66|#define xrealloc(a,b)    gcry_xrealloc ((a),(b))
  ------------------
 2063|     66|				  sizeof (struct revocation_key) *
 2064|     66|				  (sig->numrevkeys + 1));
 2065|       |
 2066|     66|	  sig->revkey[sig->numrevkeys].class = revkey[0];
 2067|     66|	  sig->revkey[sig->numrevkeys].algid = revkey[1];
 2068|     66|          len -= 2;
 2069|     66|	  sig->revkey[sig->numrevkeys].fprlen = len;
 2070|     66|	  memcpy (sig->revkey[sig->numrevkeys].fpr, revkey+2, len);
 2071|     66|	  memset (sig->revkey[sig->numrevkeys].fpr+len, 0,
 2072|     66|                  sizeof (sig->revkey[sig->numrevkeys].fpr) - len);
 2073|     66|	  sig->numrevkeys++;
 2074|     66|	}
 2075|  2.43k|    }
 2076|  6.57k|}
parse_signature:
 2082|   342k|{
 2083|   342k|  int md5_len = 0;
 2084|   342k|  unsigned n;
 2085|   342k|  int is_v4or5 = 0;
 2086|   342k|  int rc = 0;
 2087|   342k|  int i, ndata;
 2088|       |
 2089|   342k|  if (pktlen < 16)
  ------------------
  |  Branch (2089:7): [True: 250k, False: 91.9k]
  ------------------
 2090|   250k|    {
 2091|   250k|      log_error ("packet(%d) too short\n", pkttype);
 2092|   250k|      if (list_mode)
  ------------------
  |  Branch (2092:11): [True: 0, False: 250k]
  ------------------
 2093|      0|        es_fputs (":signature packet: [too short]\n", listfp);
 2094|   250k|      goto leave;
 2095|   250k|    }
 2096|  91.9k|  sig->version = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  91.9k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  91.9k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 91.9k]
  |  |  |  |  |  Branch (500:24): [True: 164, False: 91.8k]
  |  |  |  |  ------------------
  |  |  |  |  501|  91.9k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2097|  91.9k|  pktlen--;
 2098|  91.9k|  if (sig->version == 4 || sig->version == 5)
  ------------------
  |  Branch (2098:7): [True: 42.8k, False: 49.1k]
  |  Branch (2098:28): [True: 19.1k, False: 29.9k]
  ------------------
 2099|  62.0k|    is_v4or5 = 1;
 2100|  29.9k|  else if (sig->version != 2 && sig->version != 3)
  ------------------
  |  Branch (2100:12): [True: 18.2k, False: 11.7k]
  |  Branch (2100:33): [True: 3.62k, False: 14.6k]
  ------------------
 2101|  3.62k|    {
 2102|  3.62k|      log_error ("packet(%d) with unknown version %d\n",
 2103|  3.62k|		 pkttype, sig->version);
 2104|  3.62k|      if (list_mode)
  ------------------
  |  Branch (2104:11): [True: 0, False: 3.62k]
  ------------------
 2105|      0|        es_fputs (":signature packet: [unknown version]\n", listfp);
 2106|  3.62k|      rc = gpg_error (GPG_ERR_INV_PACKET);
 2107|  3.62k|      goto leave;
 2108|  3.62k|    }
 2109|       |
 2110|  88.3k|  if (!is_v4or5)
  ------------------
  |  Branch (2110:7): [True: 26.3k, False: 62.0k]
  ------------------
 2111|  26.3k|    {
 2112|  26.3k|      if (pktlen == 0)
  ------------------
  |  Branch (2112:11): [True: 0, False: 26.3k]
  ------------------
 2113|      0|	goto underflow;
 2114|  26.3k|      md5_len = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  26.3k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  26.3k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 26.3k]
  |  |  |  |  |  Branch (500:24): [True: 1.33k, False: 25.0k]
  |  |  |  |  ------------------
  |  |  |  |  501|  26.3k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2115|  26.3k|      pktlen--;
 2116|  26.3k|    }
 2117|  88.3k|  if (pktlen == 0)
  ------------------
  |  Branch (2117:7): [True: 0, False: 88.3k]
  ------------------
 2118|      0|    goto underflow;
 2119|  88.3k|  sig->sig_class = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  88.3k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  88.3k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 88.3k]
  |  |  |  |  |  Branch (500:24): [True: 1.61k, False: 86.7k]
  |  |  |  |  ------------------
  |  |  |  |  501|  88.3k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2120|  88.3k|  pktlen--;
 2121|  88.3k|  if (!is_v4or5)
  ------------------
  |  Branch (2121:7): [True: 26.3k, False: 62.0k]
  ------------------
 2122|  26.3k|    {
 2123|  26.3k|      if (pktlen < 12)
  ------------------
  |  Branch (2123:11): [True: 0, False: 26.3k]
  ------------------
 2124|      0|	goto underflow;
 2125|  26.3k|      sig->timestamp = read_32 (inp);
 2126|  26.3k|      pktlen -= 4;
 2127|  26.3k|      sig->keyid[0] = read_32 (inp);
 2128|  26.3k|      pktlen -= 4;
 2129|  26.3k|      sig->keyid[1] = read_32 (inp);
 2130|  26.3k|      pktlen -= 4;
 2131|  26.3k|    }
 2132|  88.3k|  if (pktlen < 2)
  ------------------
  |  Branch (2132:7): [True: 549, False: 87.7k]
  ------------------
 2133|    549|    goto underflow;
 2134|  87.7k|  sig->pubkey_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  87.7k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  87.7k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 87.7k]
  |  |  |  |  |  Branch (500:24): [True: 1.19k, False: 86.6k]
  |  |  |  |  ------------------
  |  |  |  |  501|  87.7k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2135|  87.7k|  pktlen--;
 2136|  87.7k|  sig->digest_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  87.7k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  87.7k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 87.7k]
  |  |  |  |  |  Branch (500:24): [True: 1.54k, False: 86.2k]
  |  |  |  |  ------------------
  |  |  |  |  501|  87.7k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2137|  87.7k|  pktlen--;
 2138|  87.7k|  sig->flags.exportable = 1;
 2139|  87.7k|  sig->flags.revocable = 1;
 2140|  87.7k|  if (is_v4or5) /* Read subpackets.  */
  ------------------
  |  Branch (2140:7): [True: 62.0k, False: 25.7k]
  ------------------
 2141|  62.0k|    {
 2142|  62.0k|      if (pktlen < 2)
  ------------------
  |  Branch (2142:11): [True: 0, False: 62.0k]
  ------------------
 2143|      0|	goto underflow;
 2144|  62.0k|      n = read_16 (inp);
 2145|  62.0k|      pktlen -= 2;  /* Length of hashed data. */
 2146|  62.0k|      if (pktlen < n)
  ------------------
  |  Branch (2146:11): [True: 2.60k, False: 59.3k]
  ------------------
 2147|  2.60k|	goto underflow;
 2148|  59.3k|      if (n > 10000)
  ------------------
  |  Branch (2148:11): [True: 723, False: 58.6k]
  ------------------
 2149|    723|	{
 2150|    723|	  log_error ("signature packet: hashed data too long\n");
 2151|    723|          if (list_mode)
  ------------------
  |  Branch (2151:15): [True: 0, False: 723]
  ------------------
 2152|      0|            es_fputs (":signature packet: [hashed data too long]\n", listfp);
 2153|    723|	  rc = GPG_ERR_INV_PACKET;
 2154|    723|	  goto leave;
 2155|    723|	}
 2156|  58.6k|      if (n)
  ------------------
  |  Branch (2156:11): [True: 52.8k, False: 5.82k]
  ------------------
 2157|  52.8k|	{
 2158|  52.8k|	  sig->hashed = xmalloc (sizeof (*sig->hashed) + n - 1);
  ------------------
  |  |  107|  52.8k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 2159|  52.8k|	  sig->hashed->size = n;
 2160|  52.8k|	  sig->hashed->len = n;
 2161|  52.8k|	  if (iobuf_read (inp, sig->hashed->data, n) != n)
  ------------------
  |  Branch (2161:8): [True: 995, False: 51.8k]
  ------------------
 2162|    995|	    {
 2163|    995|	      log_error ("premature eof while reading "
 2164|    995|			 "hashed signature data\n");
 2165|    995|              if (list_mode)
  ------------------
  |  Branch (2165:19): [True: 0, False: 995]
  ------------------
 2166|      0|                es_fputs (":signature packet: [premature eof]\n", listfp);
 2167|    995|	      rc = -1;
 2168|    995|	      goto leave;
 2169|    995|	    }
 2170|  51.8k|	  pktlen -= n;
 2171|  51.8k|	}
 2172|  57.6k|      if (pktlen < 2)
  ------------------
  |  Branch (2172:11): [True: 376, False: 57.3k]
  ------------------
 2173|    376|	goto underflow;
 2174|  57.3k|      n = read_16 (inp);
 2175|  57.3k|      pktlen -= 2;  /* Length of unhashed data.  */
 2176|  57.3k|      if (pktlen < n)
  ------------------
  |  Branch (2176:11): [True: 3.21k, False: 54.0k]
  ------------------
 2177|  3.21k|	goto underflow;
 2178|  54.0k|      if (n > 10000)
  ------------------
  |  Branch (2178:11): [True: 170, False: 53.9k]
  ------------------
 2179|    170|	{
 2180|    170|	  log_error ("signature packet: unhashed data too long\n");
 2181|    170|          if (list_mode)
  ------------------
  |  Branch (2181:15): [True: 0, False: 170]
  ------------------
 2182|      0|            es_fputs (":signature packet: [unhashed data too long]\n", listfp);
 2183|    170|	  rc = GPG_ERR_INV_PACKET;
 2184|    170|	  goto leave;
 2185|    170|	}
 2186|  53.9k|      if (n)
  ------------------
  |  Branch (2186:11): [True: 13.4k, False: 40.4k]
  ------------------
 2187|  13.4k|	{
 2188|  13.4k|	  sig->unhashed = xmalloc (sizeof (*sig->unhashed) + n - 1);
  ------------------
  |  |  107|  13.4k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 2189|  13.4k|	  sig->unhashed->size = n;
 2190|  13.4k|	  sig->unhashed->len = n;
 2191|  13.4k|	  if (iobuf_read (inp, sig->unhashed->data, n) != n)
  ------------------
  |  Branch (2191:8): [True: 370, False: 13.0k]
  ------------------
 2192|    370|	    {
 2193|    370|	      log_error ("premature eof while reading "
 2194|    370|			 "unhashed signature data\n");
 2195|    370|              if (list_mode)
  ------------------
  |  Branch (2195:19): [True: 0, False: 370]
  ------------------
 2196|      0|                es_fputs (":signature packet: [premature eof]\n", listfp);
 2197|    370|	      rc = -1;
 2198|    370|	      goto leave;
 2199|    370|	    }
 2200|  13.0k|	  pktlen -= n;
 2201|  13.0k|	}
 2202|  53.9k|    }
 2203|       |
 2204|  79.3k|  if (pktlen < 2)
  ------------------
  |  Branch (2204:7): [True: 448, False: 78.8k]
  ------------------
 2205|    448|    goto underflow;
 2206|  78.8k|  sig->digest_start[0] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  78.8k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  78.8k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 78.8k]
  |  |  |  |  |  Branch (500:24): [True: 2.43k, False: 76.4k]
  |  |  |  |  ------------------
  |  |  |  |  501|  78.8k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2207|  78.8k|  pktlen--;
 2208|  78.8k|  sig->digest_start[1] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  78.8k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  78.8k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 78.8k]
  |  |  |  |  |  Branch (500:24): [True: 3.79k, False: 75.0k]
  |  |  |  |  ------------------
  |  |  |  |  501|  78.8k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2209|  78.8k|  pktlen--;
 2210|       |
 2211|  78.8k|  if (is_v4or5 && sig->pubkey_algo)  /* Extract required information.  */
  ------------------
  |  Branch (2211:7): [True: 53.4k, False: 25.4k]
  |  Branch (2211:19): [True: 52.7k, False: 695]
  ------------------
 2212|  52.7k|    {
 2213|  52.7k|      const byte *p;
 2214|  52.7k|      size_t len;
 2215|       |
 2216|       |      /* Set sig->flags.unknown_critical if there is a critical bit
 2217|       |       * set for packets which we do not understand.  */
 2218|  52.7k|      if (!parse_sig_subpkt (sig, 1, SIGSUBPKT_TEST_CRITICAL, NULL)
  ------------------
  |  Branch (2218:11): [True: 32.3k, False: 20.3k]
  ------------------
 2219|  52.7k|	  || !parse_sig_subpkt (sig, 0, SIGSUBPKT_TEST_CRITICAL, NULL))
  ------------------
  |  Branch (2219:7): [True: 3.68k, False: 16.6k]
  ------------------
 2220|  36.0k|	sig->flags.unknown_critical = 1;
 2221|       |
 2222|  52.7k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_SIG_CREATED, NULL);
 2223|  52.7k|      if (p)
  ------------------
  |  Branch (2223:11): [True: 2.26k, False: 50.4k]
  ------------------
 2224|  2.26k|	sig->timestamp = buf32_to_u32 (p);
 2225|  50.4k|      else if (!(sig->pubkey_algo >= 100 && sig->pubkey_algo <= 110)
  ------------------
  |  Branch (2225:18): [True: 11.1k, False: 39.3k]
  |  Branch (2225:45): [True: 1.71k, False: 9.41k]
  ------------------
 2226|  50.4k|	       && opt.verbose > 1 && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (2226:12): [True: 0, False: 48.7k]
  |  Branch (2226:31): [True: 0, False: 0]
  ------------------
 2227|      0|        log_info ("signature packet without timestamp\n");
 2228|       |
 2229|       |      /* Set the key id.  We first try the issuer fingerprint and if
 2230|       |       * it is a v4 signature the fallback to the issuer.  Note that
 2231|       |       * only the issuer packet is also searched in the unhashed area.  */
 2232|  52.7k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_ISSUER_FPR, &len);
 2233|  52.7k|      if (p && len == 21 && p[0] == 4)
  ------------------
  |  Branch (2233:11): [True: 7.31k, False: 45.4k]
  |  Branch (2233:16): [True: 3.07k, False: 4.24k]
  |  Branch (2233:29): [True: 2.44k, False: 627]
  ------------------
 2234|  2.44k|        {
 2235|  2.44k|          sig->keyid[0] = buf32_to_u32 (p + 1 + 12);
 2236|  2.44k|	  sig->keyid[1] = buf32_to_u32 (p + 1 + 16);
 2237|  2.44k|	}
 2238|  50.2k|      else if (p && len == 33 && p[0] == 5)
  ------------------
  |  Branch (2238:16): [True: 4.87k, False: 45.4k]
  |  Branch (2238:21): [True: 4.22k, False: 649]
  |  Branch (2238:34): [True: 2.56k, False: 1.66k]
  ------------------
 2239|  2.56k|        {
 2240|  2.56k|          sig->keyid[0] = buf32_to_u32 (p + 1 );
 2241|  2.56k|	  sig->keyid[1] = buf32_to_u32 (p + 1 + 4);
 2242|  2.56k|	}
 2243|  47.7k|      else if ((p = parse_sig_subpkt2 (sig, SIGSUBPKT_ISSUER)))
  ------------------
  |  Branch (2243:16): [True: 236, False: 47.4k]
  ------------------
 2244|    236|        {
 2245|    236|          sig->keyid[0] = buf32_to_u32 (p);
 2246|    236|	  sig->keyid[1] = buf32_to_u32 (p + 4);
 2247|    236|	}
 2248|  47.4k|      else if (!(sig->pubkey_algo >= 100 && sig->pubkey_algo <= 110)
  ------------------
  |  Branch (2248:18): [True: 13.0k, False: 34.4k]
  |  Branch (2248:45): [True: 1.71k, False: 11.3k]
  ------------------
 2249|  47.4k|	       && opt.verbose > 1 && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (2249:12): [True: 0, False: 45.7k]
  |  Branch (2249:31): [True: 0, False: 0]
  ------------------
 2250|      0|	log_info ("signature packet without keyid\n");
 2251|       |
 2252|  52.7k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_SIG_EXPIRE, NULL);
 2253|  52.7k|      if (p && buf32_to_u32 (p))
  ------------------
  |  Branch (2253:11): [True: 1.66k, False: 51.0k]
  |  Branch (2253:16): [True: 1.39k, False: 270]
  ------------------
 2254|  1.39k|	sig->expiredate = sig->timestamp + buf32_to_u32 (p);
 2255|  52.7k|      if (sig->expiredate && sig->expiredate <= make_timestamp ())
  ------------------
  |  Branch (2255:11): [True: 1.39k, False: 51.3k]
  |  Branch (2255:30): [True: 949, False: 449]
  ------------------
 2256|    949|	sig->flags.expired = 1;
 2257|       |
 2258|  52.7k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_POLICY, NULL);
 2259|  52.7k|      if (p)
  ------------------
  |  Branch (2259:11): [True: 1.03k, False: 51.6k]
  ------------------
 2260|  1.03k|	sig->flags.policy_url = 1;
 2261|       |
 2262|  52.7k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_PREF_KS, NULL);
 2263|  52.7k|      if (p)
  ------------------
  |  Branch (2263:11): [True: 4.08k, False: 48.6k]
  ------------------
 2264|  4.08k|	sig->flags.pref_ks = 1;
 2265|       |
 2266|  52.7k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_SIGNERS_UID, &len);
 2267|  52.7k|      if (p && len)
  ------------------
  |  Branch (2267:11): [True: 12.4k, False: 40.2k]
  |  Branch (2267:16): [True: 12.0k, False: 459]
  ------------------
 2268|  12.0k|        {
 2269|  12.0k|          char *mbox;
 2270|       |
 2271|  12.0k|          sig->signers_uid = try_make_printable_string (p, len, 0);
 2272|  12.0k|          if (!sig->signers_uid)
  ------------------
  |  Branch (2272:15): [True: 0, False: 12.0k]
  ------------------
 2273|      0|            {
 2274|      0|              rc = gpg_error_from_syserror ();
 2275|      0|              goto leave;
 2276|      0|            }
 2277|  12.0k|          mbox = mailbox_from_userid (sig->signers_uid, 0);
 2278|  12.0k|          if (mbox)
  ------------------
  |  Branch (2278:15): [True: 668, False: 11.3k]
  ------------------
 2279|    668|            {
 2280|    668|              xfree (sig->signers_uid);
  ------------------
  |  |  104|    668|#define xfree(a)         gcry_free ((a))
  ------------------
 2281|    668|              sig->signers_uid = mbox;
 2282|    668|            }
 2283|  12.0k|        }
 2284|       |
 2285|  52.7k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_KEY_BLOCK, NULL);
 2286|  52.7k|      if (p)
  ------------------
  |  Branch (2286:11): [True: 129, False: 52.5k]
  ------------------
 2287|    129|        sig->flags.key_block = 1;
 2288|       |
 2289|  52.7k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_NOTATION, NULL);
 2290|  52.7k|      if (p)
  ------------------
  |  Branch (2290:11): [True: 250, False: 52.4k]
  ------------------
 2291|    250|	sig->flags.notation = 1;
 2292|       |
 2293|  52.7k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_REVOCABLE, NULL);
 2294|  52.7k|      if (p && *p == 0)
  ------------------
  |  Branch (2294:11): [True: 1.16k, False: 51.5k]
  |  Branch (2294:16): [True: 460, False: 701]
  ------------------
 2295|    460|	sig->flags.revocable = 0;
 2296|       |
 2297|  52.7k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_TRUST, &len);
 2298|  52.7k|      if (p && len == 2)
  ------------------
  |  Branch (2298:11): [True: 416, False: 52.3k]
  |  Branch (2298:16): [True: 416, False: 0]
  ------------------
 2299|    416|	{
 2300|    416|	  sig->trust_depth = p[0];
 2301|    416|	  sig->trust_value = p[1];
 2302|       |
 2303|       |	  /* Only look for a regexp if there is also a trust
 2304|       |	     subpacket. */
 2305|    416|	  sig->trust_regexp =
 2306|    416|	    parse_sig_subpkt (sig, 1, SIGSUBPKT_REGEXP, &len);
 2307|       |
 2308|       |	  /* If the regular expression is of 0 length, there is no
 2309|       |	     regular expression. */
 2310|    416|	  if (len == 0)
  ------------------
  |  Branch (2310:8): [True: 328, False: 88]
  ------------------
 2311|    328|	    sig->trust_regexp = NULL;
 2312|    416|	}
 2313|       |
 2314|       |      /* We accept the exportable subpacket from either the hashed or
 2315|       |         unhashed areas as older versions of gpg put it in the
 2316|       |         unhashed area.  In theory, anyway, we should never see this
 2317|       |         packet off of a local keyring. */
 2318|       |
 2319|  52.7k|      p = parse_sig_subpkt2 (sig, SIGSUBPKT_EXPORTABLE);
 2320|  52.7k|      if (p && *p == 0)
  ------------------
  |  Branch (2320:11): [True: 1.31k, False: 51.4k]
  |  Branch (2320:16): [True: 370, False: 949]
  ------------------
 2321|    370|	sig->flags.exportable = 0;
 2322|       |
 2323|       |      /* Find all revocation keys.  */
 2324|  52.7k|      if (sig->sig_class == 0x1F)
  ------------------
  |  Branch (2324:11): [True: 6.57k, False: 46.1k]
  ------------------
 2325|  6.57k|	parse_revkeys (sig);
 2326|  52.7k|    }
 2327|       |
 2328|  78.8k|  if (list_mode)
  ------------------
  |  Branch (2328:7): [True: 0, False: 78.8k]
  ------------------
 2329|      0|    {
 2330|      0|      es_fprintf (listfp, ":signature packet: algo %d, keyid %08lX%08lX\n"
 2331|      0|                  "\tversion %d, created %lu, md5len %d, sigclass 0x%02x\n"
 2332|      0|                  "\tdigest algo %d, begin of digest %02x %02x\n",
 2333|      0|                  sig->pubkey_algo,
 2334|      0|                  (ulong) sig->keyid[0], (ulong) sig->keyid[1],
 2335|      0|                  sig->version, (ulong) sig->timestamp, md5_len, sig->sig_class,
 2336|      0|                  sig->digest_algo, sig->digest_start[0], sig->digest_start[1]);
 2337|      0|      if (is_v4or5)
  ------------------
  |  Branch (2337:11): [True: 0, False: 0]
  ------------------
 2338|      0|	{
 2339|      0|	  parse_sig_subpkt (sig, 1, SIGSUBPKT_LIST_HASHED, NULL);
 2340|      0|	  parse_sig_subpkt (sig, 0, SIGSUBPKT_LIST_UNHASHED, NULL);
 2341|      0|	}
 2342|      0|    }
 2343|       |
 2344|  78.8k|  ndata = pubkey_get_nsig (sig->pubkey_algo);
 2345|  78.8k|  if (!ndata)
  ------------------
  |  Branch (2345:7): [True: 61.0k, False: 17.8k]
  ------------------
 2346|  61.0k|    {
 2347|  61.0k|      if (list_mode)
  ------------------
  |  Branch (2347:11): [True: 0, False: 61.0k]
  ------------------
 2348|      0|	es_fprintf (listfp, "\tunknown algorithm %d\n", sig->pubkey_algo);
 2349|  61.0k|      unknown_pubkey_warning (sig->pubkey_algo);
 2350|       |
 2351|       |      /* We store the plain material in data[0], so that we are able
 2352|       |       * to write it back with build_packet().  */
 2353|  61.0k|      if (pktlen > (5 * MAX_EXTERN_MPI_BITS / 8))
  ------------------
  |  |   42|  61.0k|#define MAX_EXTERN_MPI_BITS 16384
  ------------------
  |  Branch (2353:11): [True: 371, False: 60.6k]
  ------------------
 2354|    371|	{
 2355|       |	  /* We include a limit to avoid too trivial DoS attacks by
 2356|       |	     having gpg allocate too much memory.  */
 2357|    371|	  log_error ("signature packet: too much data\n");
 2358|    371|	  rc = GPG_ERR_INV_PACKET;
 2359|    371|	}
 2360|  60.6k|      else
 2361|  60.6k|	{
 2362|  60.6k|          void *tmpp;
 2363|       |
 2364|  60.6k|          tmpp = read_rest (inp, pktlen);
 2365|  60.6k|	  sig->data[0] = gcry_mpi_set_opaque (NULL, tmpp, tmpp? pktlen * 8 : 0);
  ------------------
  |  Branch (2365:52): [True: 26.2k, False: 34.3k]
  ------------------
 2366|  60.6k|	  pktlen = 0;
 2367|  60.6k|	}
 2368|  61.0k|    }
 2369|  17.8k|  else
 2370|  17.8k|    {
 2371|  47.6k|      for (i = 0; i < ndata; i++)
  ------------------
  |  Branch (2371:19): [True: 29.7k, False: 17.8k]
  ------------------
 2372|  29.7k|	{
 2373|  29.7k|	  n = pktlen;
 2374|  29.7k|          if (sig->pubkey_algo == PUBKEY_ALGO_ECDSA
  ------------------
  |  Branch (2374:15): [True: 1.04k, False: 28.7k]
  ------------------
 2375|  29.7k|              || sig->pubkey_algo == PUBKEY_ALGO_EDDSA)
  ------------------
  |  Branch (2375:18): [True: 3.84k, False: 24.8k]
  ------------------
 2376|  4.88k|            sig->data[i] = sos_read (inp, &n, 0);
 2377|  24.8k|          else
 2378|  24.8k|            sig->data[i] = mpi_read (inp, &n, 0);
 2379|  29.7k|	  pktlen -= n;
 2380|  29.7k|	  if (list_mode)
  ------------------
  |  Branch (2380:8): [True: 0, False: 29.7k]
  ------------------
 2381|      0|	    {
 2382|      0|	      es_fprintf (listfp, "\tdata: ");
 2383|      0|	      mpi_print (listfp, sig->data[i], mpi_print_mode);
 2384|      0|	      es_putc ('\n', listfp);
 2385|      0|	    }
 2386|  29.7k|	  if (!sig->data[i])
  ------------------
  |  Branch (2386:8): [True: 9.81k, False: 19.9k]
  ------------------
 2387|  9.81k|	    rc = GPG_ERR_INV_PACKET;
 2388|  29.7k|	}
 2389|  17.8k|    }
 2390|       |
 2391|   335k| leave:
 2392|   335k|  iobuf_skip_rest (inp, pktlen, 0);
 2393|   335k|  return rc;
 2394|       |
 2395|  7.19k| underflow:
 2396|  7.19k|  log_error ("packet(%d) too short\n", pkttype);
 2397|  7.19k|  if (list_mode)
  ------------------
  |  Branch (2397:7): [True: 0, False: 7.19k]
  ------------------
 2398|      0|    es_fputs (":signature packet: [too short]\n", listfp);
 2399|       |
 2400|  7.19k|  iobuf_skip_rest (inp, pktlen, 0);
 2401|       |
 2402|  7.19k|  return GPG_ERR_INV_PACKET;
 2403|  78.8k|}
parse_attribute_subpkts:
 3018|  4.40k|{
 3019|  4.40k|  size_t n;
 3020|  4.40k|  int count = 0;
 3021|  4.40k|  struct user_attribute *attribs = NULL;
 3022|  4.40k|  const byte *buffer = uid->attrib_data;
 3023|  4.40k|  int buflen = uid->attrib_len;
 3024|  4.40k|  byte type;
 3025|       |
 3026|  4.40k|  xfree (uid->attribs);
  ------------------
  |  |  104|  4.40k|#define xfree(a)         gcry_free ((a))
  ------------------
 3027|       |
 3028|  32.0k|  while (buflen)
  ------------------
  |  Branch (3028:10): [True: 30.7k, False: 1.32k]
  ------------------
 3029|  30.7k|    {
 3030|  30.7k|      n = *buffer++;
 3031|  30.7k|      buflen--;
 3032|  30.7k|      if (n == 255)  /* 4 byte length header.  */
  ------------------
  |  Branch (3032:11): [True: 1.57k, False: 29.2k]
  ------------------
 3033|  1.57k|	{
 3034|  1.57k|	  if (buflen < 4)
  ------------------
  |  Branch (3034:8): [True: 661, False: 909]
  ------------------
 3035|    661|	    goto too_short;
 3036|    909|	  n = buf32_to_size_t (buffer);
 3037|    909|	  buffer += 4;
 3038|    909|	  buflen -= 4;
 3039|    909|	}
 3040|  29.2k|      else if (n >= 192)  /* 2 byte special encoded length header.  */
  ------------------
  |  Branch (3040:16): [True: 1.07k, False: 28.1k]
  ------------------
 3041|  1.07k|	{
 3042|  1.07k|	  if (buflen < 2)
  ------------------
  |  Branch (3042:8): [True: 634, False: 441]
  ------------------
 3043|    634|	    goto too_short;
 3044|    441|	  n = ((n - 192) << 8) + *buffer + 192;
 3045|    441|	  buffer++;
 3046|    441|	  buflen--;
 3047|    441|	}
 3048|  29.4k|      if (buflen < n)
  ------------------
  |  Branch (3048:11): [True: 1.54k, False: 27.9k]
  ------------------
 3049|  1.54k|	goto too_short;
 3050|       |
 3051|  27.9k|      if (!n)
  ------------------
  |  Branch (3051:11): [True: 240, False: 27.6k]
  ------------------
 3052|    240|        {
 3053|       |          /* Too short to encode the subpacket type.  */
 3054|    240|          if (opt.verbose)
  ------------------
  |  Branch (3054:15): [True: 0, False: 240]
  ------------------
 3055|      0|            log_info ("attribute subpacket too short\n");
 3056|    240|          break;
 3057|    240|        }
 3058|       |
 3059|  27.6k|      attribs = xrealloc (attribs,
  ------------------
  |  |  111|  27.6k|#define xrealloc(a,b)    gcry_xrealloc ((a),(b))
  ------------------
 3060|  27.6k|                          (count + 1) * sizeof (struct user_attribute));
 3061|  27.6k|      memset (&attribs[count], 0, sizeof (struct user_attribute));
 3062|       |
 3063|  27.6k|      type = *buffer;
 3064|  27.6k|      buffer++;
 3065|  27.6k|      buflen--;
 3066|  27.6k|      n--;
 3067|       |
 3068|  27.6k|      attribs[count].type = type;
 3069|  27.6k|      attribs[count].data = buffer;
 3070|  27.6k|      attribs[count].len = n;
 3071|  27.6k|      buffer += n;
 3072|  27.6k|      buflen -= n;
 3073|  27.6k|      count++;
 3074|  27.6k|    }
 3075|       |
 3076|  1.56k|  uid->attribs = attribs;
 3077|  1.56k|  uid->numattribs = count;
 3078|  1.56k|  return count;
 3079|       |
 3080|  2.83k| too_short:
 3081|  2.83k|  if (opt.verbose && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (3081:7): [True: 0, False: 2.83k]
  |  Branch (3081:22): [True: 0, False: 0]
  ------------------
 3082|      0|    log_info ("buffer shorter than attribute subpacket\n");
 3083|  2.83k|  uid->attribs = attribs;
 3084|  2.83k|  uid->numattribs = count;
 3085|  2.83k|  return count;
 3086|  4.40k|}
make_attribute_uidname:
 3139|  4.40k|{
 3140|  4.40k|  log_assert (max_namelen > 70);
 3141|  4.40k|  if (uid->numattribs <= 0)
  ------------------
  |  Branch (3141:7): [True: 1.04k, False: 3.36k]
  ------------------
 3142|  1.04k|    sprintf (uid->name, "[bad attribute packet of size %lu]",
 3143|  1.04k|	     uid->attrib_len);
 3144|  3.36k|  else if (uid->numattribs > 1)
  ------------------
  |  Branch (3144:12): [True: 249, False: 3.11k]
  ------------------
 3145|    249|    sprintf (uid->name, "[%d attributes of size %lu]",
 3146|    249|	     uid->numattribs, uid->attrib_len);
 3147|  3.11k|  else
 3148|  3.11k|    {
 3149|       |      /* Only one attribute, so list it as the "user id" */
 3150|       |
 3151|  3.11k|      if (uid->attribs->type == ATTRIB_IMAGE)
  ------------------
  |  |  263|  3.11k|#define ATTRIB_IMAGE 1
  ------------------
  |  Branch (3151:11): [True: 2.30k, False: 803]
  ------------------
 3152|  2.30k|	{
 3153|  2.30k|	  u32 len;
 3154|  2.30k|	  byte type;
 3155|       |
 3156|  2.30k|	  if (parse_image_header (uid->attribs, &type, &len))
  ------------------
  |  Branch (3156:8): [True: 998, False: 1.31k]
  ------------------
 3157|    998|	    sprintf (uid->name, "[%.20s image of size %lu]",
 3158|    998|		     image_type_to_string (type, 1), (ulong) len);
 3159|  1.31k|	  else
 3160|  1.31k|	    sprintf (uid->name, "[invalid image]");
 3161|  2.30k|	}
 3162|    803|      else
 3163|    803|	sprintf (uid->name, "[unknown attribute of size %lu]",
 3164|    803|		 (ulong) uid->attribs->len);
 3165|  3.11k|    }
 3166|       |
 3167|  4.40k|  uid->len = strlen (uid->name);
 3168|  4.40k|}
create_gpg_control:
 3788|  67.6k|{
 3789|  67.6k|  PACKET *packet;
 3790|  67.6k|  byte *p;
 3791|       |
 3792|  67.6k|  if (!data)
  ------------------
  |  Branch (3792:7): [True: 0, False: 67.6k]
  ------------------
 3793|      0|    datalen = 0;
 3794|       |
 3795|  67.6k|  packet = xmalloc (sizeof *packet);
  ------------------
  |  |  107|  67.6k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 3796|  67.6k|  init_packet (packet);
  ------------------
  |  |  581|  67.6k|#define init_packet(a) do { (a)->pkttype = 0;		\
  |  |  582|  67.6k|			    (a)->pkt.generic = NULL;	\
  |  |  583|  67.6k|		       } while(0)
  |  |  ------------------
  |  |  |  Branch (583:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3797|  67.6k|  packet->pkttype = PKT_GPG_CONTROL;
 3798|  67.6k|  packet->pkt.gpg_control = xmalloc (sizeof *packet->pkt.gpg_control + datalen);
  ------------------
  |  |  107|  67.6k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 3799|  67.6k|  packet->pkt.gpg_control->control = type;
 3800|  67.6k|  packet->pkt.gpg_control->datalen = datalen;
 3801|  67.6k|  p = packet->pkt.gpg_control->data;
 3802|  2.26M|  for (; datalen; datalen--, p++)
  ------------------
  |  Branch (3802:10): [True: 2.20M, False: 67.6k]
  ------------------
 3803|  2.20M|    *p = *data++;
 3804|       |
 3805|  67.6k|  return packet;
 3806|  67.6k|}
parse-packet.c:parse:
  631|  1.05M|{
  632|  1.05M|  int rc = 0;
  633|  1.05M|  iobuf_t inp;
  634|  1.05M|  int c, ctb, pkttype, lenbytes;
  635|  1.05M|  unsigned long pktlen;
  636|  1.05M|  byte hdr[8];
  637|  1.05M|  int hdrlen;
  638|  1.05M|  int new_ctb = 0, partial = 0;
  639|  1.05M|  int with_uid = (onlykeypkts == 2);
  640|  1.05M|  off_t pos;
  641|       |
  642|  1.05M|  *skip = 0;
  643|  1.05M|  inp = ctx->inp;
  644|       |
  645|  1.07M| again:
  646|  1.07M|  log_assert (!pkt->pkt.generic);
  647|  1.07M|  if (retpos || list_mode)
  ------------------
  |  Branch (647:7): [True: 0, False: 1.07M]
  |  Branch (647:17): [True: 0, False: 1.07M]
  ------------------
  648|      0|    {
  649|      0|      pos = iobuf_tell (inp);
  650|      0|      if (retpos)
  ------------------
  |  Branch (650:11): [True: 0, False: 0]
  ------------------
  651|      0|        *retpos = pos;
  652|      0|    }
  653|  1.07M|  else
  654|  1.07M|    pos = 0; /* (silence compiler warning) */
  655|       |
  656|       |  /* The first byte of a packet is the so-called tag.  The highest bit
  657|       |     must be set.  */
  658|  1.07M|  if ((ctb = iobuf_get (inp)) == -1)
  ------------------
  |  |  500|  1.07M|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 1.07M]
  |  |  |  Branch (500:24): [True: 48.0k, False: 1.02M]
  |  |  ------------------
  |  |  501|  1.07M|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (658:7): [True: 31.8k, False: 1.04M]
  ------------------
  659|  31.8k|    {
  660|  31.8k|      rc = -1;
  661|  31.8k|      goto leave;
  662|  31.8k|    }
  663|  1.04M|  hdrlen = 0;
  664|  1.04M|  hdr[hdrlen++] = ctb;
  665|       |
  666|  1.04M|  if (!(ctb & 0x80))
  ------------------
  |  Branch (666:7): [True: 125k, False: 918k]
  ------------------
  667|   125k|    {
  668|   125k|      log_error ("%s: invalid packet (ctb=%02x)\n", iobuf_where (inp), ctb);
  ------------------
  |  |  630|   125k|#define iobuf_where(a)	"[don't know]"
  ------------------
  669|   125k|      rc = gpg_error (GPG_ERR_INV_PACKET);
  670|   125k|      goto leave;
  671|   125k|    }
  672|       |
  673|       |  /* Immediately following the header is the length.  There are two
  674|       |     formats: the old format and the new format.  If bit 6 (where the
  675|       |     least significant bit is bit 0) is set in the tag, then we are
  676|       |     dealing with a new format packet.  Otherwise, it is an old format
  677|       |     packet.  */
  678|   918k|  pktlen = 0;
  679|   918k|  new_ctb = !!(ctb & 0x40);
  680|   918k|  if (new_ctb)
  ------------------
  |  Branch (680:7): [True: 401k, False: 517k]
  ------------------
  681|   401k|    {
  682|       |      /* Get the packet's type.  This is encoded in the 6 least
  683|       |	 significant bits of the tag.  */
  684|   401k|      pkttype = ctb & 0x3f;
  685|       |
  686|       |      /* Extract the packet's length.  New format packets have 4 ways
  687|       |	 to encode the packet length.  The value of the first byte
  688|       |	 determines the encoding and partially determines the length.
  689|       |	 See section 4.2.2 of RFC 4880 for details.  */
  690|   401k|      if ((c = iobuf_get (inp)) == -1)
  ------------------
  |  |  500|   401k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 401k]
  |  |  |  Branch (500:24): [True: 1.23k, False: 400k]
  |  |  ------------------
  |  |  501|   401k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (690:11): [True: 834, False: 400k]
  ------------------
  691|    834|	{
  692|    834|	  log_error ("%s: 1st length byte missing\n", iobuf_where (inp));
  ------------------
  |  |  630|    834|#define iobuf_where(a)	"[don't know]"
  ------------------
  693|    834|	  rc = gpg_error (GPG_ERR_INV_PACKET);
  694|    834|	  goto leave;
  695|    834|	}
  696|       |
  697|       |
  698|   400k|      hdr[hdrlen++] = c;
  699|   400k|      if (c < 192)
  ------------------
  |  Branch (699:11): [True: 322k, False: 78.6k]
  ------------------
  700|   322k|        pktlen = c;
  701|  78.6k|      else if (c < 224)
  ------------------
  |  Branch (701:16): [True: 3.39k, False: 75.2k]
  ------------------
  702|  3.39k|        {
  703|  3.39k|          pktlen = (c - 192) * 256;
  704|  3.39k|          if ((c = iobuf_get (inp)) == -1)
  ------------------
  |  |  500|  3.39k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 3.39k]
  |  |  |  Branch (500:24): [True: 435, False: 2.96k]
  |  |  ------------------
  |  |  501|  3.39k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (704:15): [True: 234, False: 3.16k]
  ------------------
  705|    234|            {
  706|    234|              log_error ("%s: 2nd length byte missing\n",
  707|    234|                         iobuf_where (inp));
  ------------------
  |  |  630|    234|#define iobuf_where(a)	"[don't know]"
  ------------------
  708|    234|              rc = gpg_error (GPG_ERR_INV_PACKET);
  709|    234|              goto leave;
  710|    234|            }
  711|  3.16k|          hdr[hdrlen++] = c;
  712|  3.16k|          pktlen += c + 192;
  713|  3.16k|        }
  714|  75.2k|      else if (c == 255)
  ------------------
  |  Branch (714:16): [True: 3.67k, False: 71.5k]
  ------------------
  715|  3.67k|        {
  716|  3.67k|	  int i;
  717|  3.67k|	  char value[4];
  718|       |
  719|  16.8k|	  for (i = 0; i < 4; i ++)
  ------------------
  |  Branch (719:16): [True: 13.5k, False: 3.26k]
  ------------------
  720|  13.5k|            {
  721|  13.5k|              if ((c = iobuf_get (inp)) == -1)
  ------------------
  |  |  500|  13.5k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 13.5k]
  |  |  |  Branch (500:24): [True: 619, False: 12.9k]
  |  |  ------------------
  |  |  501|  13.5k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (721:19): [True: 409, False: 13.1k]
  ------------------
  722|    409|                {
  723|    409|                  log_error ("%s: 4 byte length invalid\n", iobuf_where (inp));
  ------------------
  |  |  630|    409|#define iobuf_where(a)	"[don't know]"
  ------------------
  724|    409|                  rc = gpg_error (GPG_ERR_INV_PACKET);
  725|    409|                  goto leave;
  726|    409|                }
  727|  13.1k|              value[i] = hdr[hdrlen++] = c;
  728|  13.1k|            }
  729|       |
  730|  3.26k|	  pktlen = buf32_to_ulong (value);
  731|  3.26k|        }
  732|  71.5k|      else /* Partial body length.  */
  733|  71.5k|        {
  734|  71.5k|          switch (pkttype)
  735|  71.5k|            {
  736|  14.4k|            case PKT_PLAINTEXT:
  ------------------
  |  Branch (736:13): [True: 14.4k, False: 57.1k]
  ------------------
  737|  14.5k|            case PKT_ENCRYPTED:
  ------------------
  |  Branch (737:13): [True: 106, False: 71.4k]
  ------------------
  738|  16.1k|            case PKT_ENCRYPTED_MDC:
  ------------------
  |  Branch (738:13): [True: 1.62k, False: 69.9k]
  ------------------
  739|  18.7k|            case PKT_ENCRYPTED_AEAD:
  ------------------
  |  Branch (739:13): [True: 2.59k, False: 69.0k]
  ------------------
  740|  68.1k|            case PKT_COMPRESSED:
  ------------------
  |  Branch (740:13): [True: 49.4k, False: 22.1k]
  ------------------
  741|  68.1k|              iobuf_set_partial_body_length_mode (inp, c & 0xff);
  742|  68.1k|              pktlen = 0;	/* To indicate partial length.  */
  743|  68.1k|              partial = 1;
  744|  68.1k|              break;
  745|       |
  746|  3.41k|            default:
  ------------------
  |  Branch (746:13): [True: 3.41k, False: 68.1k]
  ------------------
  747|  3.41k|              log_error ("%s: partial length invalid for"
  748|  3.41k|                         " packet type %d\n", iobuf_where (inp), pkttype);
  ------------------
  |  |  630|  3.41k|#define iobuf_where(a)	"[don't know]"
  ------------------
  749|  3.41k|              rc = gpg_error (GPG_ERR_INV_PACKET);
  750|  3.41k|              goto leave;
  751|  71.5k|            }
  752|  71.5k|        }
  753|       |
  754|   400k|    }
  755|   517k|  else
  756|       |    /* This is an old format packet.  */
  757|   517k|    {
  758|       |      /* Extract the packet's type.  This is encoded in bits 2-5.  */
  759|   517k|      pkttype = (ctb >> 2) & 0xf;
  760|       |
  761|       |      /* The type of length encoding is encoded in bits 0-1 of the
  762|       |	 tag.  */
  763|   517k|      lenbytes = ((ctb & 3) == 3) ? 0 : (1 << (ctb & 3));
  ------------------
  |  Branch (763:18): [True: 206k, False: 311k]
  ------------------
  764|   517k|      if (!lenbytes)
  ------------------
  |  Branch (764:11): [True: 206k, False: 311k]
  ------------------
  765|   206k|	{
  766|   206k|	  pktlen = 0;	/* Don't know the value.  */
  767|       |	  /* This isn't really partial, but we can treat it the same
  768|       |	     in a "read until the end" sort of way.  */
  769|   206k|	  partial = 1;
  770|   206k|	  if (pkttype != PKT_ENCRYPTED && pkttype != PKT_PLAINTEXT
  ------------------
  |  Branch (770:8): [True: 205k, False: 52]
  |  Branch (770:36): [True: 203k, False: 2.02k]
  ------------------
  771|   206k|	      && pkttype != PKT_COMPRESSED)
  ------------------
  |  Branch (771:11): [True: 1.77k, False: 202k]
  ------------------
  772|  1.77k|	    {
  773|  1.77k|	      log_error ("%s: indeterminate length for invalid"
  774|  1.77k|			 " packet type %d\n", iobuf_where (inp), pkttype);
  ------------------
  |  |  630|  1.77k|#define iobuf_where(a)	"[don't know]"
  ------------------
  775|  1.77k|	      rc = gpg_error (GPG_ERR_INV_PACKET);
  776|  1.77k|	      goto leave;
  777|  1.77k|	    }
  778|   206k|	}
  779|   311k|      else
  780|   311k|	{
  781|   681k|	  for (; lenbytes; lenbytes--)
  ------------------
  |  Branch (781:11): [True: 370k, False: 310k]
  ------------------
  782|   370k|	    {
  783|   370k|	      pktlen <<= 8;
  784|   370k|	      c = iobuf_get (inp);
  ------------------
  |  |  500|   370k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 370k]
  |  |  |  Branch (500:24): [True: 804, False: 369k]
  |  |  ------------------
  |  |  501|   370k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  785|   370k|	      if (c == -1)
  ------------------
  |  Branch (785:12): [True: 641, False: 369k]
  ------------------
  786|    641|		{
  787|    641|		  log_error ("%s: length invalid\n", iobuf_where (inp));
  ------------------
  |  |  630|    641|#define iobuf_where(a)	"[don't know]"
  ------------------
  788|    641|		  rc = gpg_error (GPG_ERR_INV_PACKET);
  789|    641|		  goto leave;
  790|    641|		}
  791|   369k|	      pktlen |= hdr[hdrlen++] = c;
  792|   369k|	    }
  793|   311k|	}
  794|   517k|    }
  795|       |
  796|       |  /* Sometimes the decompressing layer enters an error state in which
  797|       |     it simply outputs 0xff for every byte read.  If we have a stream
  798|       |     of 0xff bytes, then it will be detected as a new format packet
  799|       |     with type 63 and a 4-byte encoded length that is 4G-1.  Since
  800|       |     packets with type 63 are private and we use them as a control
  801|       |     packet, which won't be 4 GB, we reject such packets as
  802|       |     invalid.  */
  803|   911k|  if (pkttype == 63 && pktlen == 0xFFFFFFFF)
  ------------------
  |  Branch (803:7): [True: 17.7k, False: 893k]
  |  Branch (803:24): [True: 777, False: 16.9k]
  ------------------
  804|    777|    {
  805|       |      /* With some probability this is caused by a problem in the
  806|       |       * the uncompressing layer - in some error cases it just loops
  807|       |       * and spits out 0xff bytes. */
  808|    777|      log_error ("%s: garbled packet detected\n", iobuf_where (inp));
  ------------------
  |  |  630|    777|#define iobuf_where(a)	"[don't know]"
  ------------------
  809|    777|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  810|    777|      rc = gpg_error (GPG_ERR_INV_PACKET);
  811|    777|      goto leave;
  812|       |#else
  813|       |      g10_exit (2);
  814|       |#endif
  815|    777|    }
  816|       |
  817|   910k|  if (out && pkttype)
  ------------------
  |  Branch (817:7): [True: 0, False: 910k]
  |  Branch (817:14): [True: 0, False: 0]
  ------------------
  818|      0|    {
  819|       |      /* This type of copying won't work if the packet uses a partial
  820|       |	 body length.  (In other words, this only works if HDR is
  821|       |	 actually the length.)  Currently, no callers require this
  822|       |	 functionality so we just log this as an error.  */
  823|      0|      if (partial)
  ------------------
  |  Branch (823:11): [True: 0, False: 0]
  ------------------
  824|      0|	{
  825|      0|	  log_error ("parse: Can't copy partial packet.  Aborting.\n");
  826|      0|	  rc = gpg_error (GPG_ERR_INV_PACKET);
  827|      0|	  goto leave;
  828|      0|	}
  829|       |
  830|      0|      rc = iobuf_write (out, hdr, hdrlen);
  831|      0|      if (!rc)
  ------------------
  |  Branch (831:11): [True: 0, False: 0]
  ------------------
  832|      0|	rc = copy_packet (inp, out, pkttype, pktlen, partial);
  833|      0|      goto leave;
  834|      0|    }
  835|       |
  836|   910k|  if (with_uid && pkttype == PKT_USER_ID)
  ------------------
  |  Branch (836:7): [True: 0, False: 910k]
  |  Branch (836:19): [True: 0, False: 0]
  ------------------
  837|       |    /* If ONLYKEYPKTS is set to 2, then we never skip user id packets,
  838|       |       even if DO_SKIP is set.  */
  839|      0|    ;
  840|   910k|  else if (do_skip
  ------------------
  |  Branch (840:12): [True: 0, False: 910k]
  ------------------
  841|       |	   /* type==0 is not allowed.  This is an invalid packet.  */
  842|   910k|	   || !pkttype
  ------------------
  |  Branch (842:8): [True: 36.9k, False: 873k]
  ------------------
  843|       |	   /* When ONLYKEYPKTS is set, we don't skip keys.  */
  844|   910k|	   || (onlykeypkts && pkttype != PKT_PUBLIC_SUBKEY
  ------------------
  |  Branch (844:9): [True: 0, False: 873k]
  |  Branch (844:24): [True: 0, False: 0]
  ------------------
  845|   873k|	       && pkttype != PKT_PUBLIC_KEY
  ------------------
  |  Branch (845:12): [True: 0, False: 0]
  ------------------
  846|   873k|	       && pkttype != PKT_SECRET_SUBKEY && pkttype != PKT_SECRET_KEY))
  ------------------
  |  Branch (846:12): [True: 0, False: 0]
  |  Branch (846:44): [True: 0, False: 0]
  ------------------
  847|  36.9k|    {
  848|  36.9k|      iobuf_skip_rest (inp, pktlen, partial);
  849|  36.9k|      *skip = 1;
  850|  36.9k|      rc = 0;
  851|  36.9k|      goto leave;
  852|  36.9k|    }
  853|       |
  854|   873k|  if (DBG_PACKET)
  ------------------
  |  |  348|   873k|#define DBG_PACKET (opt.debug & DBG_PACKET_VALUE)
  |  |  ------------------
  |  |  |  |  331|   873k|#define DBG_PACKET_VALUE  1	/* debug packet reading/writing */
  |  |  ------------------
  |  |  |  Branch (348:20): [True: 0, False: 873k]
  |  |  ------------------
  ------------------
  855|      0|    {
  856|      0|#if DEBUG_PARSE_PACKET
  857|      0|      log_debug ("parse_packet(iob=%d): type=%d length=%lu%s (%s.%s.%d)\n",
  858|      0|		 iobuf_id (inp), pkttype, pktlen, new_ctb ? " (new_ctb)" : "",
  ------------------
  |  |  635|      0|#define iobuf_id(a)	((a)->no)
  ------------------
  |  Branch (858:37): [True: 0, False: 0]
  ------------------
  859|      0|		 dbg_w, dbg_f, dbg_l);
  860|       |#else
  861|       |      log_debug ("parse_packet(iob=%d): type=%d length=%lu%s\n",
  862|       |		 iobuf_id (inp), pkttype, pktlen,
  863|       |		 new_ctb ? " (new_ctb)" : "");
  864|       |#endif
  865|      0|    }
  866|       |
  867|   873k|  if (list_mode)
  ------------------
  |  Branch (867:7): [True: 0, False: 873k]
  ------------------
  868|      0|    es_fprintf (listfp, "# off=%lu ctb=%02x tag=%d hlen=%d plen=%lu%s%s\n",
  869|      0|                (unsigned long)pos, ctb, pkttype, hdrlen, pktlen,
  870|      0|                partial? (new_ctb ? " partial" : " indeterminate") :"",
  ------------------
  |  Branch (870:17): [True: 0, False: 0]
  |  Branch (870:27): [True: 0, False: 0]
  ------------------
  871|      0|                new_ctb? " new-ctb":"");
  ------------------
  |  Branch (871:17): [True: 0, False: 0]
  ------------------
  872|       |
  873|       |  /* Count it.  */
  874|   873k|  ctx->n_parsed_packets++;
  875|       |
  876|   873k|  pkt->pkttype = pkttype;
  877|   873k|  rc = GPG_ERR_UNKNOWN_PACKET;	/* default error */
  878|   873k|  switch (pkttype)
  879|   873k|    {
  880|  2.25k|    case PKT_PUBLIC_KEY:
  ------------------
  |  Branch (880:5): [True: 2.25k, False: 871k]
  ------------------
  881|  4.43k|    case PKT_PUBLIC_SUBKEY:
  ------------------
  |  Branch (881:5): [True: 2.18k, False: 871k]
  ------------------
  882|  25.3k|    case PKT_SECRET_KEY:
  ------------------
  |  Branch (882:5): [True: 20.9k, False: 853k]
  ------------------
  883|  42.9k|    case PKT_SECRET_SUBKEY:
  ------------------
  |  Branch (883:5): [True: 17.5k, False: 856k]
  ------------------
  884|  42.9k|      pkt->pkt.public_key = xmalloc_clear (sizeof *pkt->pkt.public_key);
  ------------------
  |  |  116|  42.9k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
  885|  42.9k|      rc = parse_key (inp, pkttype, pktlen, hdr, hdrlen, pkt);
  886|  42.9k|      break;
  887|  8.61k|    case PKT_SYMKEY_ENC:
  ------------------
  |  Branch (887:5): [True: 8.61k, False: 865k]
  ------------------
  888|  8.61k|      rc = parse_symkeyenc (inp, pkttype, pktlen, pkt);
  889|  8.61k|      break;
  890|  32.9k|    case PKT_PUBKEY_ENC:
  ------------------
  |  Branch (890:5): [True: 32.9k, False: 840k]
  ------------------
  891|  32.9k|      rc = parse_pubkeyenc (inp, pkttype, pktlen, pkt);
  892|  32.9k|      break;
  893|   342k|    case PKT_SIGNATURE:
  ------------------
  |  Branch (893:5): [True: 342k, False: 531k]
  ------------------
  894|   342k|      pkt->pkt.signature = xmalloc_clear (sizeof *pkt->pkt.signature);
  ------------------
  |  |  116|   342k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
  895|   342k|      rc = parse_signature (inp, pkttype, pktlen, pkt->pkt.signature);
  896|   342k|      break;
  897|  11.1k|    case PKT_ONEPASS_SIG:
  ------------------
  |  Branch (897:5): [True: 11.1k, False: 862k]
  ------------------
  898|  11.1k|      pkt->pkt.onepass_sig = xmalloc_clear (sizeof *pkt->pkt.onepass_sig);
  ------------------
  |  |  116|  11.1k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
  899|  11.1k|      rc = parse_onepass_sig (inp, pkttype, pktlen, pkt->pkt.onepass_sig);
  900|  11.1k|      break;
  901|  1.12k|    case PKT_USER_ID:
  ------------------
  |  Branch (901:5): [True: 1.12k, False: 872k]
  ------------------
  902|  1.12k|      rc = parse_user_id (inp, pkttype, pktlen, pkt);
  903|  1.12k|      break;
  904|  4.51k|    case PKT_ATTRIBUTE:
  ------------------
  |  Branch (904:5): [True: 4.51k, False: 869k]
  ------------------
  905|  4.51k|      pkt->pkttype = pkttype = PKT_USER_ID;	/* we store it in the userID */
  906|  4.51k|      rc = parse_attribute (inp, pkttype, pktlen, pkt);
  907|  4.51k|      break;
  908|  1.78k|    case PKT_OLD_COMMENT:
  ------------------
  |  Branch (908:5): [True: 1.78k, False: 872k]
  ------------------
  909|  2.68k|    case PKT_COMMENT:
  ------------------
  |  Branch (909:5): [True: 899, False: 873k]
  ------------------
  910|  2.68k|      rc = parse_comment (inp, pkttype, pktlen, pkt);
  911|  2.68k|      break;
  912|  25.4k|    case PKT_RING_TRUST:
  ------------------
  |  Branch (912:5): [True: 25.4k, False: 848k]
  ------------------
  913|  25.4k|      {
  914|  25.4k|        rc = parse_ring_trust (ctx, pktlen);
  915|  25.4k|        if (!rc)
  ------------------
  |  Branch (915:13): [True: 25.4k, False: 0]
  ------------------
  916|  25.4k|          goto again; /* Directly read the next packet.  */
  917|  25.4k|      }
  918|      0|      break;
  919|  70.0k|    case PKT_PLAINTEXT:
  ------------------
  |  Branch (919:5): [True: 70.0k, False: 803k]
  ------------------
  920|  70.0k|      rc = parse_plaintext (inp, pkttype, pktlen, pkt, new_ctb, partial);
  921|  70.0k|      break;
  922|   264k|    case PKT_COMPRESSED:
  ------------------
  |  Branch (922:5): [True: 264k, False: 609k]
  ------------------
  923|   264k|      rc = parse_compressed (inp, pkttype, pktlen, pkt, new_ctb);
  924|   264k|      break;
  925|  1.45k|    case PKT_ENCRYPTED:
  ------------------
  |  Branch (925:5): [True: 1.45k, False: 872k]
  ------------------
  926|  3.93k|    case PKT_ENCRYPTED_MDC:
  ------------------
  |  Branch (926:5): [True: 2.47k, False: 871k]
  ------------------
  927|  3.93k|      rc = parse_encrypted (inp, pkttype, pktlen, pkt, new_ctb, partial);
  928|  3.93k|      break;
  929|  6.45k|    case PKT_MDC:
  ------------------
  |  Branch (929:5): [True: 6.45k, False: 867k]
  ------------------
  930|  6.45k|      rc = parse_mdc (inp, pkttype, pktlen, pkt, new_ctb);
  931|  6.45k|      break;
  932|  4.40k|    case PKT_ENCRYPTED_AEAD:
  ------------------
  |  Branch (932:5): [True: 4.40k, False: 869k]
  ------------------
  933|  4.40k|      rc = parse_encrypted_aead (inp, pkttype, pktlen, pkt, partial);
  934|  4.40k|      break;
  935|  16.9k|    case PKT_GPG_CONTROL:
  ------------------
  |  Branch (935:5): [True: 16.9k, False: 856k]
  ------------------
  936|  16.9k|      rc = parse_gpg_control (inp, pkttype, pktlen, pkt, partial);
  937|  16.9k|      break;
  938|  13.2k|    case PKT_MARKER:
  ------------------
  |  Branch (938:5): [True: 13.2k, False: 860k]
  ------------------
  939|  13.2k|      rc = parse_marker (inp, pkttype, pktlen);
  940|  13.2k|      break;
  941|  22.6k|    default:
  ------------------
  |  Branch (941:5): [True: 22.6k, False: 851k]
  ------------------
  942|       |      /* Unknown packet.  Skip it.  */
  943|  22.6k|      skip_packet (inp, pkttype, pktlen, partial);
  944|  22.6k|      break;
  945|   873k|    }
  946|       |
  947|       |  /* Store a shallow copy of certain packets in the context.  */
  948|   848k|  free_packet (NULL, ctx);
  949|   848k|  if (!rc && (pkttype == PKT_PUBLIC_KEY
  ------------------
  |  Branch (949:7): [True: 710k, False: 137k]
  |  Branch (949:15): [True: 128, False: 710k]
  ------------------
  950|   710k|              || pkttype == PKT_SECRET_KEY
  ------------------
  |  Branch (950:18): [True: 208, False: 710k]
  ------------------
  951|   710k|              || pkttype == PKT_USER_ID
  ------------------
  |  Branch (951:18): [True: 5.23k, False: 705k]
  ------------------
  952|   710k|              || pkttype == PKT_ATTRIBUTE
  ------------------
  |  Branch (952:18): [True: 0, False: 705k]
  ------------------
  953|   710k|              || pkttype == PKT_SIGNATURE))
  ------------------
  |  Branch (953:18): [True: 322k, False: 382k]
  ------------------
  954|   328k|    {
  955|   328k|      ctx->last_pkt = *pkt;
  956|   328k|    }
  957|       |
  958|  1.05M| leave:
  959|       |  /* FIXME: We leak in case of an error (see the xmalloc's above).  */
  960|  1.05M|  if (!rc && iobuf_error (inp))
  ------------------
  |  |  454|   747k|#define iobuf_error(a)	      ((a)->error)
  |  |  ------------------
  |  |  |  Branch (454:30): [True: 10.9k, False: 736k]
  |  |  ------------------
  ------------------
  |  Branch (960:7): [True: 747k, False: 303k]
  ------------------
  961|  10.9k|    rc = GPG_ERR_INV_KEYRING;
  962|       |
  963|       |  /* FIXME: We use only the error code for now to avoid problems with
  964|       |     callers which have not been checked to always use gpg_err_code()
  965|       |     when comparing error codes.  */
  966|  1.05M|  return rc == -1? -1 : gpg_err_code (rc);
  ------------------
  |  Branch (966:10): [True: 33.2k, False: 1.01M]
  ------------------
  967|   848k|}
parse-packet.c:parse_key:
 2462|  42.9k|{
 2463|  42.9k|  gpg_error_t err = 0;
 2464|  42.9k|  int i, version, algorithm;
 2465|  42.9k|  unsigned long timestamp, expiredate, max_expiredate;
 2466|  42.9k|  int npkey, nskey;
 2467|  42.9k|  u32 keyid[2];
 2468|  42.9k|  PKT_public_key *pk;
 2469|  42.9k|  int is_v5;
 2470|  42.9k|  unsigned int pkbytes; /* For v5 keys: Number of bytes in the public
 2471|       |                         * key material.  For v4 keys: 0.  */
 2472|       |
 2473|  42.9k|  (void) hdr;
 2474|       |
 2475|  42.9k|  pk = pkt->pkt.public_key; /* PK has been cleared. */
 2476|       |
 2477|  42.9k|  version = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  42.9k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  42.9k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 42.9k]
  |  |  |  |  |  Branch (500:24): [True: 478, False: 42.4k]
  |  |  |  |  ------------------
  |  |  |  |  501|  42.9k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2478|  42.9k|  pktlen--;
 2479|  42.9k|  if (pkttype == PKT_PUBLIC_SUBKEY && version == '#')
  ------------------
  |  Branch (2479:7): [True: 2.18k, False: 40.7k]
  |  Branch (2479:39): [True: 196, False: 1.98k]
  ------------------
 2480|    196|    {
 2481|       |      /* Early versions of G10 used the old PGP comments packets;
 2482|       |       * luckily all those comments are started by a hash.  */
 2483|    196|      if (list_mode)
  ------------------
  |  Branch (2483:11): [True: 0, False: 196]
  ------------------
 2484|      0|	{
 2485|      0|	  es_fprintf (listfp, ":rfc1991 comment packet: \"");
 2486|      0|	  for (; pktlen; pktlen--)
  ------------------
  |  Branch (2486:11): [True: 0, False: 0]
  ------------------
 2487|      0|	    {
 2488|      0|	      int c;
 2489|      0|	      c = iobuf_get (inp);
  ------------------
  |  |  500|      0|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 0]
  |  |  |  Branch (500:24): [True: 0, False: 0]
  |  |  ------------------
  |  |  501|      0|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
 2490|      0|              if (c == -1)
  ------------------
  |  Branch (2490:19): [True: 0, False: 0]
  ------------------
 2491|      0|                break; /* Ooops: shorter than indicated.  */
 2492|      0|	      if (c >= ' ' && c <= 'z')
  ------------------
  |  Branch (2492:12): [True: 0, False: 0]
  |  Branch (2492:24): [True: 0, False: 0]
  ------------------
 2493|      0|		es_putc (c, listfp);
 2494|      0|	      else
 2495|      0|		es_fprintf (listfp, "\\x%02x", c);
 2496|      0|	    }
 2497|      0|	  es_fprintf (listfp, "\"\n");
 2498|      0|	}
 2499|    196|      iobuf_skip_rest (inp, pktlen, 0);
 2500|    196|      return 0;
 2501|    196|    }
 2502|  42.7k|  else if (version == 4)
  ------------------
  |  Branch (2502:12): [True: 31.4k, False: 11.2k]
  ------------------
 2503|  31.4k|    is_v5 = 0;
 2504|  11.2k|  else if (version == 5)
  ------------------
  |  Branch (2504:12): [True: 4.91k, False: 6.38k]
  ------------------
 2505|  4.91k|    is_v5 = 1;
 2506|  6.38k|  else if (version == 2 || version == 3)
  ------------------
  |  Branch (2506:12): [True: 766, False: 5.62k]
  |  Branch (2506:28): [True: 2.90k, False: 2.71k]
  ------------------
 2507|  3.67k|    {
 2508|       |      /* Not anymore supported since 2.1.  Use an older gpg version
 2509|       |       * (i.e. gpg 1.4) to parse v3 packets.  */
 2510|  3.67k|      if (opt.verbose > 1 && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (2510:11): [True: 0, False: 3.67k]
  |  Branch (2510:30): [True: 0, False: 0]
  ------------------
 2511|      0|        log_info ("packet(%d) with obsolete version %d\n", pkttype, version);
 2512|  3.67k|      if (list_mode)
  ------------------
  |  Branch (2512:11): [True: 0, False: 3.67k]
  ------------------
 2513|      0|        es_fprintf (listfp, ":key packet: [obsolete version %d]\n", version);
 2514|  3.67k|      pk->version = version;
 2515|  3.67k|      err = gpg_error (GPG_ERR_LEGACY_KEY);
 2516|  3.67k|      goto leave;
 2517|  3.67k|    }
 2518|  2.71k|  else
 2519|  2.71k|    {
 2520|  2.71k|      log_error ("packet(%d) with unknown version %d\n", pkttype, version);
 2521|  2.71k|      if (list_mode)
  ------------------
  |  Branch (2521:11): [True: 0, False: 2.71k]
  ------------------
 2522|      0|        es_fputs (":key packet: [unknown version]\n", listfp);
 2523|  2.71k|      err = gpg_error (GPG_ERR_INV_PACKET);
 2524|  2.71k|      goto leave;
 2525|  2.71k|    }
 2526|       |
 2527|  36.3k|  if (pktlen < (is_v5? 15:11))
  ------------------
  |  Branch (2527:7): [True: 209, False: 36.1k]
  |  Branch (2527:17): [True: 4.91k, False: 31.4k]
  ------------------
 2528|    209|    {
 2529|    209|      log_error ("packet(%d) too short\n", pkttype);
 2530|    209|      if (list_mode)
  ------------------
  |  Branch (2530:11): [True: 0, False: 209]
  ------------------
 2531|      0|        es_fputs (":key packet: [too short]\n", listfp);
 2532|    209|      err = gpg_error (GPG_ERR_INV_PACKET);
 2533|    209|      goto leave;
 2534|    209|    }
 2535|  36.1k|  else if (pktlen > MAX_KEY_PACKET_LENGTH)
  ------------------
  |  |   37|  36.1k|#define MAX_KEY_PACKET_LENGTH     (256 * 1024)
  ------------------
  |  Branch (2535:12): [True: 467, False: 35.6k]
  ------------------
 2536|    467|    {
 2537|    467|      log_error ("packet(%d) too large\n", pkttype);
 2538|    467|      if (list_mode)
  ------------------
  |  Branch (2538:11): [True: 0, False: 467]
  ------------------
 2539|      0|        es_fputs (":key packet: [too large]\n", listfp);
 2540|    467|      err = gpg_error (GPG_ERR_INV_PACKET);
 2541|    467|      goto leave;
 2542|    467|    }
 2543|       |
 2544|  35.6k|  timestamp = read_32 (inp);
 2545|  35.6k|  pktlen -= 4;
 2546|  35.6k|  expiredate = 0;		/* have to get it from the selfsignature */
 2547|  35.6k|  max_expiredate = 0;
 2548|  35.6k|  algorithm = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  35.6k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  35.6k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 35.6k]
  |  |  |  |  |  Branch (500:24): [True: 258, False: 35.3k]
  |  |  |  |  ------------------
  |  |  |  |  501|  35.6k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2549|  35.6k|  pktlen--;
 2550|  35.6k|  if (is_v5)
  ------------------
  |  Branch (2550:7): [True: 4.48k, False: 31.1k]
  ------------------
 2551|  4.48k|    {
 2552|  4.48k|      pkbytes = read_32 (inp);
 2553|  4.48k|      pktlen -= 4;
 2554|  4.48k|    }
 2555|  31.1k|  else
 2556|  31.1k|    pkbytes = 0;
 2557|       |
 2558|  35.6k|  if (list_mode)
  ------------------
  |  Branch (2558:7): [True: 0, False: 35.6k]
  ------------------
 2559|      0|    {
 2560|      0|      es_fprintf (listfp, ":%s key packet:\n"
 2561|      0|                  "\tversion %d, algo %d, created %lu, expires %lu",
 2562|      0|                  pkttype == PKT_PUBLIC_KEY ? "public" :
  ------------------
  |  Branch (2562:19): [True: 0, False: 0]
  ------------------
 2563|      0|                  pkttype == PKT_SECRET_KEY ? "secret" :
  ------------------
  |  Branch (2563:19): [True: 0, False: 0]
  ------------------
 2564|      0|                  pkttype == PKT_PUBLIC_SUBKEY ? "public sub" :
  ------------------
  |  Branch (2564:19): [True: 0, False: 0]
  ------------------
 2565|      0|                  pkttype == PKT_SECRET_SUBKEY ? "secret sub" : "??",
  ------------------
  |  Branch (2565:19): [True: 0, False: 0]
  ------------------
 2566|      0|                  version, algorithm, timestamp, expiredate);
 2567|      0|      if (is_v5)
  ------------------
  |  Branch (2567:11): [True: 0, False: 0]
  ------------------
 2568|      0|        es_fprintf (listfp, ", pkbytes %u\n", pkbytes);
 2569|      0|      else
 2570|      0|        es_fprintf (listfp, "\n");
 2571|      0|    }
 2572|       |
 2573|  35.6k|  pk->timestamp = timestamp;
 2574|  35.6k|  pk->expiredate = expiredate;
 2575|  35.6k|  pk->max_expiredate = max_expiredate;
 2576|  35.6k|  pk->hdrbytes = hdrlen;
 2577|  35.6k|  pk->version = version;
 2578|  35.6k|  pk->flags.primary = (pkttype == PKT_PUBLIC_KEY || pkttype == PKT_SECRET_KEY);
  ------------------
  |  Branch (2578:24): [True: 890, False: 34.7k]
  |  Branch (2578:53): [True: 17.5k, False: 17.1k]
  ------------------
 2579|  35.6k|  pk->pubkey_algo = algorithm;
 2580|       |
 2581|  35.6k|  nskey = pubkey_get_nskey (algorithm);
 2582|  35.6k|  npkey = pubkey_get_npkey (algorithm);
 2583|  35.6k|  if (!npkey)
  ------------------
  |  Branch (2583:7): [True: 2.74k, False: 32.9k]
  ------------------
 2584|  2.74k|    {
 2585|  2.74k|      if (list_mode)
  ------------------
  |  Branch (2585:11): [True: 0, False: 2.74k]
  ------------------
 2586|      0|	es_fprintf (listfp, "\tunknown algorithm %d\n", algorithm);
 2587|  2.74k|      unknown_pubkey_warning (algorithm);
 2588|  2.74k|    }
 2589|       |
 2590|  35.6k|  if (!npkey)
  ------------------
  |  Branch (2590:7): [True: 2.74k, False: 32.9k]
  ------------------
 2591|  2.74k|    {
 2592|       |      /* Unknown algorithm - put data into an opaque MPI.  */
 2593|  2.74k|      void *tmpp = read_rest (inp, pktlen);
 2594|       |      /* Current gcry_mpi_cmp does not handle a (NULL,n>0) nicely and
 2595|       |       * thus we avoid to create such an MPI.  */
 2596|  2.74k|      pk->pkey[0] = gcry_mpi_set_opaque (NULL, tmpp, tmpp? pktlen * 8 : 0);
  ------------------
  |  Branch (2596:54): [True: 2.12k, False: 615]
  ------------------
 2597|  2.74k|      pktlen = 0;
 2598|  2.74k|      goto leave;
 2599|  2.74k|    }
 2600|  32.9k|  else
 2601|  32.9k|    {
 2602|  87.0k|      for (i = 0; i < npkey; i++)
  ------------------
  |  Branch (2602:19): [True: 62.0k, False: 25.0k]
  ------------------
 2603|  62.0k|        {
 2604|  62.0k|          if (    (algorithm == PUBKEY_ALGO_ECDSA && (i == 0))
  ------------------
  |  Branch (2604:20): [True: 2.76k, False: 59.2k]
  |  Branch (2604:54): [True: 1.52k, False: 1.24k]
  ------------------
 2605|  62.0k|               || (algorithm == PUBKEY_ALGO_EDDSA && (i == 0))
  ------------------
  |  Branch (2605:20): [True: 3.58k, False: 56.8k]
  |  Branch (2605:54): [True: 1.86k, False: 1.72k]
  ------------------
 2606|  62.0k|               || (algorithm == PUBKEY_ALGO_ECDH  && (i == 0 || i == 2)))
  ------------------
  |  Branch (2606:20): [True: 2.67k, False: 55.9k]
  |  Branch (2606:55): [True: 1.18k, False: 1.49k]
  |  Branch (2606:65): [True: 487, False: 1.00k]
  ------------------
 2607|  5.05k|            {
 2608|       |              /* Read the OID (i==0) or the KDF params (i==2).  */
 2609|  5.05k|              size_t n;
 2610|  5.05k|	      err = read_size_body (inp, pktlen, &n, pk->pkey+i);
 2611|  5.05k|              pktlen -= n;
 2612|  5.05k|            }
 2613|  56.9k|          else
 2614|  56.9k|            {
 2615|  56.9k|              unsigned int n = pktlen;
 2616|  56.9k|              if (algorithm == PUBKEY_ALGO_ECDSA
  ------------------
  |  Branch (2616:19): [True: 1.24k, False: 55.7k]
  ------------------
 2617|  56.9k|                  || algorithm == PUBKEY_ALGO_EDDSA
  ------------------
  |  Branch (2617:22): [True: 1.72k, False: 53.9k]
  ------------------
 2618|  56.9k|                  || algorithm == PUBKEY_ALGO_ECDH)
  ------------------
  |  Branch (2618:22): [True: 1.00k, False: 52.9k]
  ------------------
 2619|  3.96k|                pk->pkey[i] = sos_read (inp, &n, 0);
 2620|  52.9k|              else
 2621|  52.9k|                pk->pkey[i] = mpi_read (inp, &n, 0);
 2622|  56.9k|              pktlen -= n;
 2623|  56.9k|              if (!pk->pkey[i])
  ------------------
  |  Branch (2623:19): [True: 6.85k, False: 50.0k]
  ------------------
 2624|  6.85k|                err = gpg_error (GPG_ERR_INV_PACKET);
 2625|  56.9k|            }
 2626|  62.0k|          if (err)
  ------------------
  |  Branch (2626:15): [True: 7.86k, False: 54.1k]
  ------------------
 2627|  7.86k|            goto leave;
 2628|  54.1k|          if (list_mode)
  ------------------
  |  Branch (2628:15): [True: 0, False: 54.1k]
  ------------------
 2629|      0|            {
 2630|      0|              es_fprintf (listfp, "\tpkey[%d]: ", i);
 2631|      0|              mpi_print (listfp, pk->pkey[i], mpi_print_mode);
 2632|      0|              if ((algorithm == PUBKEY_ALGO_ECDSA
  ------------------
  |  Branch (2632:20): [True: 0, False: 0]
  ------------------
 2633|      0|                   || algorithm == PUBKEY_ALGO_EDDSA
  ------------------
  |  Branch (2633:23): [True: 0, False: 0]
  ------------------
 2634|      0|                   || algorithm == PUBKEY_ALGO_ECDH) && i==0)
  ------------------
  |  Branch (2634:23): [True: 0, False: 0]
  |  Branch (2634:57): [True: 0, False: 0]
  ------------------
 2635|      0|                {
 2636|      0|                  char *curve = openpgp_oid_to_str (pk->pkey[0]);
 2637|      0|                  const char *name = openpgp_oid_to_curve (curve, 0);
 2638|      0|                  es_fprintf (listfp, " %s (%s)", name?name:"", curve);
  ------------------
  |  Branch (2638:51): [True: 0, False: 0]
  ------------------
 2639|      0|                  xfree (curve);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 2640|      0|                }
 2641|      0|              es_putc ('\n', listfp);
 2642|      0|            }
 2643|  54.1k|        }
 2644|  32.9k|    }
 2645|  25.0k|  if (list_mode)
  ------------------
  |  Branch (2645:7): [True: 0, False: 25.0k]
  ------------------
 2646|      0|    keyid_from_pk (pk, keyid);
 2647|       |
 2648|  25.0k|  if (pkttype == PKT_SECRET_KEY || pkttype == PKT_SECRET_SUBKEY)
  ------------------
  |  Branch (2648:7): [True: 11.5k, False: 13.4k]
  |  Branch (2648:36): [True: 13.1k, False: 358]
  ------------------
 2649|  24.6k|    {
 2650|  24.6k|      struct seckey_info *ski;
 2651|  24.6k|      byte temp[16];
 2652|  24.6k|      size_t snlen = 0;
 2653|  24.6k|      unsigned int skbytes;
 2654|       |
 2655|  24.6k|      if (pktlen < 1)
  ------------------
  |  Branch (2655:11): [True: 488, False: 24.1k]
  ------------------
 2656|    488|        {
 2657|    488|          err = gpg_error (GPG_ERR_INV_PACKET);
 2658|    488|          goto leave;
 2659|    488|        }
 2660|       |
 2661|  24.1k|      pk->seckey_info = ski = xtrycalloc (1, sizeof *ski);
  ------------------
  |  |   99|  24.1k|#define xtrycalloc(a,b)  gcry_calloc ((a),(b))
  ------------------
 2662|  24.1k|      if (!pk->seckey_info)
  ------------------
  |  Branch (2662:11): [True: 0, False: 24.1k]
  ------------------
 2663|      0|        {
 2664|      0|          err = gpg_error_from_syserror ();
 2665|      0|          goto leave;
 2666|      0|        }
 2667|       |
 2668|  24.1k|      ski->algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  24.1k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  24.1k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 24.1k]
  |  |  |  |  |  Branch (500:24): [True: 322, False: 23.8k]
  |  |  |  |  ------------------
  |  |  |  |  501|  24.1k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2669|  24.1k|      pktlen--;
 2670|       |
 2671|  24.1k|      if (is_v5)
  ------------------
  |  Branch (2671:11): [True: 3.76k, False: 20.4k]
  ------------------
 2672|  3.76k|        {
 2673|  3.76k|          unsigned int protcount = 0;
 2674|       |
 2675|       |          /* Read the one octet count of the following key-protection
 2676|       |           * material.  Only required in case of unknown values. */
 2677|  3.76k|          if (!pktlen)
  ------------------
  |  Branch (2677:15): [True: 66, False: 3.69k]
  ------------------
 2678|     66|            {
 2679|     66|              err = gpg_error (GPG_ERR_INV_PACKET);
 2680|     66|              goto leave;
 2681|     66|            }
 2682|  3.69k|          protcount = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  3.69k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  3.69k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 3.69k]
  |  |  |  |  |  Branch (500:24): [True: 228, False: 3.46k]
  |  |  |  |  ------------------
  |  |  |  |  501|  3.69k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2683|  3.69k|          pktlen--;
 2684|  3.69k|          if (list_mode)
  ------------------
  |  Branch (2684:15): [True: 0, False: 3.69k]
  ------------------
 2685|      0|            es_fprintf (listfp, "\tprotbytes: %u\n", protcount);
 2686|  3.69k|        }
 2687|       |
 2688|  24.1k|      if (ski->algo)
  ------------------
  |  Branch (2688:11): [True: 19.0k, False: 5.11k]
  ------------------
 2689|  19.0k|	{
 2690|  19.0k|	  ski->is_protected = 1;
 2691|  19.0k|	  ski->s2k.count = 0;
 2692|  19.0k|	  if (ski->algo == 254 || ski->algo == 255)
  ------------------
  |  Branch (2692:8): [True: 12.7k, False: 6.25k]
  |  Branch (2692:28): [True: 2.90k, False: 3.35k]
  ------------------
 2693|  15.6k|	    {
 2694|  15.6k|              if (pktlen < 3)
  ------------------
  |  Branch (2694:19): [True: 219, False: 15.4k]
  ------------------
 2695|    219|		{
 2696|    219|		  err = gpg_error (GPG_ERR_INV_PACKET);
 2697|    219|		  goto leave;
 2698|    219|		}
 2699|       |
 2700|  15.4k|              ski->sha1chk = (ski->algo == 254);
 2701|  15.4k|	      ski->algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  15.4k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  15.4k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 15.4k]
  |  |  |  |  |  Branch (500:24): [True: 182, False: 15.2k]
  |  |  |  |  ------------------
  |  |  |  |  501|  15.4k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2702|  15.4k|	      pktlen--;
 2703|       |	      /* Note that a ski->algo > 110 is illegal, but I'm not
 2704|       |	       * erroring out here as otherwise there would be no way
 2705|       |	       * to delete such a key.  */
 2706|  15.4k|	      ski->s2k.mode = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  15.4k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  15.4k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 15.4k]
  |  |  |  |  |  Branch (500:24): [True: 470, False: 14.9k]
  |  |  |  |  ------------------
  |  |  |  |  501|  15.4k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2707|  15.4k|	      pktlen--;
 2708|  15.4k|	      ski->s2k.hash_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  15.4k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  15.4k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 15.4k]
  |  |  |  |  |  Branch (500:24): [True: 477, False: 14.9k]
  |  |  |  |  ------------------
  |  |  |  |  501|  15.4k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2709|  15.4k|	      pktlen--;
 2710|       |	      /* Check for the special GNU extension.  */
 2711|  15.4k|	      if (ski->s2k.mode == 101)
  ------------------
  |  Branch (2711:12): [True: 7.87k, False: 7.55k]
  ------------------
 2712|  7.87k|		{
 2713|  39.1k|		  for (i = 0; i < 4 && pktlen; i++, pktlen--)
  ------------------
  |  Branch (2713:17): [True: 31.4k, False: 7.61k]
  |  Branch (2713:26): [True: 31.2k, False: 268]
  ------------------
 2714|  31.2k|		    temp[i] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  31.2k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  31.2k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 31.2k]
  |  |  |  |  |  Branch (500:24): [True: 535, False: 30.6k]
  |  |  |  |  ------------------
  |  |  |  |  501|  31.2k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2715|  7.87k|		  if (i < 4 || memcmp (temp, "GNU", 3))
  ------------------
  |  Branch (2715:9): [True: 268, False: 7.61k]
  |  Branch (2715:18): [True: 1.77k, False: 5.84k]
  ------------------
 2716|  2.03k|		    {
 2717|  2.03k|		      if (list_mode)
  ------------------
  |  Branch (2717:13): [True: 0, False: 2.03k]
  ------------------
 2718|      0|			es_fprintf (listfp, "\tunknown S2K %d\n",
 2719|      0|                                    ski->s2k.mode);
 2720|  2.03k|		      err = gpg_error (GPG_ERR_INV_PACKET);
 2721|  2.03k|		      goto leave;
 2722|  2.03k|		    }
 2723|       |		  /* Here we know that it is a GNU extension.  What
 2724|       |		   * follows is the GNU protection mode: All values
 2725|       |		   * have special meanings and they are mapped to MODE
 2726|       |		   * with a base of 1000.  */
 2727|  5.84k|		  ski->s2k.mode = 1000 + temp[3];
 2728|  5.84k|		}
 2729|       |
 2730|       |              /* Read the salt.  */
 2731|  13.3k|	      if (ski->s2k.mode == 3 || ski->s2k.mode == 1)
  ------------------
  |  Branch (2731:12): [True: 1.99k, False: 11.4k]
  |  Branch (2731:34): [True: 1.52k, False: 9.88k]
  ------------------
 2732|  3.51k|		{
 2733|  24.6k|		  for (i = 0; i < 8 && pktlen; i++, pktlen--)
  ------------------
  |  Branch (2733:17): [True: 22.0k, False: 2.63k]
  |  Branch (2733:26): [True: 21.1k, False: 879]
  ------------------
 2734|  21.1k|		    temp[i] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  21.1k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  21.1k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 21.1k]
  |  |  |  |  |  Branch (500:24): [True: 809, False: 20.3k]
  |  |  |  |  ------------------
  |  |  |  |  501|  21.1k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2735|  3.51k|                  if (i < 8)
  ------------------
  |  Branch (2735:23): [True: 879, False: 2.63k]
  ------------------
 2736|    879|                    {
 2737|    879|		      err = gpg_error (GPG_ERR_INV_PACKET);
 2738|    879|		      goto leave;
 2739|    879|                    }
 2740|  2.63k|		  memcpy (ski->s2k.salt, temp, 8);
 2741|  2.63k|		}
 2742|       |
 2743|       |              /* Check the mode.  */
 2744|  12.5k|	      switch (ski->s2k.mode)
 2745|  12.5k|		{
 2746|  1.78k|		case 0:
  ------------------
  |  Branch (2746:3): [True: 1.78k, False: 10.7k]
  ------------------
 2747|  1.78k|		  if (list_mode)
  ------------------
  |  Branch (2747:9): [True: 0, False: 1.78k]
  ------------------
 2748|      0|		    es_fprintf (listfp, "\tsimple S2K");
 2749|  1.78k|		  break;
 2750|    649|		case 1:
  ------------------
  |  Branch (2750:3): [True: 649, False: 11.8k]
  ------------------
 2751|    649|		  if (list_mode)
  ------------------
  |  Branch (2751:9): [True: 0, False: 649]
  ------------------
 2752|      0|		    es_fprintf (listfp, "\tsalted S2K");
 2753|    649|		  break;
 2754|  1.98k|		case 3:
  ------------------
  |  Branch (2754:3): [True: 1.98k, False: 10.5k]
  ------------------
 2755|  1.98k|		  if (list_mode)
  ------------------
  |  Branch (2755:9): [True: 0, False: 1.98k]
  ------------------
 2756|      0|		    es_fprintf (listfp, "\titer+salt S2K");
 2757|  1.98k|		  break;
 2758|    767|		case 1001:
  ------------------
  |  Branch (2758:3): [True: 767, False: 11.7k]
  ------------------
 2759|    767|		  if (list_mode)
  ------------------
  |  Branch (2759:9): [True: 0, False: 767]
  ------------------
 2760|      0|		    es_fprintf (listfp, "\tgnu-dummy");
 2761|    767|		  break;
 2762|  4.49k|		case 1002:
  ------------------
  |  Branch (2762:3): [True: 4.49k, False: 8.02k]
  ------------------
 2763|  4.49k|		  if (list_mode)
  ------------------
  |  Branch (2763:9): [True: 0, False: 4.49k]
  ------------------
 2764|      0|		    es_fprintf (listfp, "\tgnu-divert-to-card");
 2765|  4.49k|		  break;
 2766|    165|		case 1003:
  ------------------
  |  Branch (2766:3): [True: 165, False: 12.3k]
  ------------------
 2767|    165|		  if (list_mode)
  ------------------
  |  Branch (2767:9): [True: 0, False: 165]
  ------------------
 2768|      0|		    es_fprintf (listfp, "\tgnu-mode1003");
 2769|    165|		  break;
 2770|  2.67k|		default:
  ------------------
  |  Branch (2770:3): [True: 2.67k, False: 9.85k]
  ------------------
 2771|  2.67k|		  if (list_mode)
  ------------------
  |  Branch (2771:9): [True: 0, False: 2.67k]
  ------------------
 2772|      0|		    es_fprintf (listfp, "\tunknown %sS2K %d\n",
 2773|      0|                                ski->s2k.mode < 1000 ? "" : "GNU ",
  ------------------
  |  Branch (2773:33): [True: 0, False: 0]
  ------------------
 2774|      0|                                ski->s2k.mode);
 2775|  2.67k|		  err = gpg_error (GPG_ERR_INV_PACKET);
 2776|  2.67k|		  goto leave;
 2777|  12.5k|		}
 2778|       |
 2779|       |              /* Print some info.  */
 2780|  9.85k|	      if (list_mode && ski->s2k.mode != 1003)
  ------------------
  |  Branch (2780:12): [True: 0, False: 9.85k]
  |  Branch (2780:25): [True: 0, False: 0]
  ------------------
 2781|      0|		{
 2782|      0|		  es_fprintf (listfp, ", algo: %d,%s hash: %d",
 2783|      0|                              ski->algo,
 2784|      0|                              ski->sha1chk ? " SHA1 protection,"
  ------------------
  |  Branch (2784:31): [True: 0, False: 0]
  ------------------
 2785|      0|                              : " simple checksum,", ski->s2k.hash_algo);
 2786|      0|		  if (ski->s2k.mode == 1 || ski->s2k.mode == 3)
  ------------------
  |  Branch (2786:9): [True: 0, False: 0]
  |  Branch (2786:31): [True: 0, False: 0]
  ------------------
 2787|      0|		    {
 2788|      0|		      es_fprintf (listfp, ", salt: ");
 2789|      0|                      es_write_hexstring (listfp, ski->s2k.salt, 8, 0, NULL);
 2790|      0|		    }
 2791|      0|                }
 2792|  9.85k|              if (list_mode)
  ------------------
  |  Branch (2792:19): [True: 0, False: 9.85k]
  ------------------
 2793|      0|                es_putc ('\n', listfp);
 2794|       |
 2795|       |              /* Read remaining protection parameters.  */
 2796|  9.85k|	      if (ski->s2k.mode == 3)
  ------------------
  |  Branch (2796:12): [True: 1.98k, False: 7.86k]
  ------------------
 2797|  1.98k|		{
 2798|  1.98k|		  if (pktlen < 1)
  ------------------
  |  Branch (2798:9): [True: 548, False: 1.44k]
  ------------------
 2799|    548|		    {
 2800|    548|		      err = gpg_error (GPG_ERR_INV_PACKET);
 2801|    548|		      goto leave;
 2802|    548|		    }
 2803|  1.44k|		  ski->s2k.count = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  1.44k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  1.44k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 1.44k]
  |  |  |  |  |  Branch (500:24): [True: 146, False: 1.29k]
  |  |  |  |  ------------------
  |  |  |  |  501|  1.44k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2804|  1.44k|		  pktlen--;
 2805|  1.44k|		  if (list_mode)
  ------------------
  |  Branch (2805:9): [True: 0, False: 1.44k]
  ------------------
 2806|      0|		    es_fprintf (listfp, "\tprotect count: %lu (%lu)\n",
 2807|      0|                                (ulong)S2K_DECODE_COUNT ((ulong)ski->s2k.count),
  ------------------
  |  |  210|      0|#define S2K_DECODE_COUNT(_val) ((16ul + ((_val) & 15)) << (((_val) >> 4) + 6))
  ------------------
 2808|      0|                                (ulong) ski->s2k.count);
 2809|  1.44k|		}
 2810|  7.86k|	      else if (ski->s2k.mode == 1002)
  ------------------
  |  Branch (2810:17): [True: 4.49k, False: 3.36k]
  ------------------
 2811|  4.49k|		{
 2812|       |		  /* Read the serial number. */
 2813|  4.49k|		  if (pktlen < 1)
  ------------------
  |  Branch (2813:9): [True: 228, False: 4.27k]
  ------------------
 2814|    228|		    {
 2815|    228|		      err = gpg_error (GPG_ERR_INV_PACKET);
 2816|    228|		      goto leave;
 2817|    228|		    }
 2818|  4.27k|		  snlen = iobuf_get (inp);
  ------------------
  |  |  500|  4.27k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 4.27k]
  |  |  |  Branch (500:24): [True: 98, False: 4.17k]
  |  |  ------------------
  |  |  501|  4.27k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
 2819|  4.27k|		  pktlen--;
 2820|  4.27k|		  if (pktlen < snlen || snlen == (size_t)(-1))
  ------------------
  |  Branch (2820:9): [True: 470, False: 3.80k]
  |  Branch (2820:27): [True: 0, False: 3.80k]
  ------------------
 2821|    470|		    {
 2822|    470|		      err = gpg_error (GPG_ERR_INV_PACKET);
 2823|    470|		      goto leave;
 2824|    470|		    }
 2825|  4.27k|		}
 2826|  9.85k|	    }
 2827|  3.35k|	  else /* Old version; no S2K, so we set mode to 0, hash MD5.  */
 2828|  3.35k|	    {
 2829|       |              /* Note that a ski->algo > 110 is illegal, but I'm not
 2830|       |                 erroring on it here as otherwise there would be no
 2831|       |                 way to delete such a key.  */
 2832|  3.35k|	      ski->s2k.mode = 0;
 2833|  3.35k|	      ski->s2k.hash_algo = DIGEST_ALGO_MD5;
 2834|  3.35k|	      if (list_mode)
  ------------------
  |  Branch (2834:12): [True: 0, False: 3.35k]
  ------------------
 2835|      0|		es_fprintf (listfp, "\tprotect algo: %d  (hash algo: %d)\n",
 2836|      0|                            ski->algo, ski->s2k.hash_algo);
 2837|  3.35k|	    }
 2838|       |
 2839|       |	  /* It is really ugly that we don't know the size
 2840|       |	   * of the IV here in cases we are not aware of the algorithm.
 2841|       |	   * so a
 2842|       |	   *   ski->ivlen = cipher_get_blocksize (ski->algo);
 2843|       |	   * won't work.  The only solution I see is to hardwire it.
 2844|       |	   * NOTE: if you change the ivlen above 16, don't forget to
 2845|       |	   * enlarge temp.
 2846|       |           * FIXME: For v5 keys we can deduce this info!
 2847|       |           */
 2848|  11.9k|	  ski->ivlen = openpgp_cipher_blocklen (ski->algo);
 2849|  11.9k|	  log_assert (ski->ivlen <= sizeof (temp));
 2850|       |
 2851|  11.9k|	  if (ski->s2k.mode == 1001 || ski->s2k.mode == 1003)
  ------------------
  |  Branch (2851:8): [True: 767, False: 11.1k]
  |  Branch (2851:33): [True: 165, False: 11.0k]
  ------------------
 2852|    932|	    ski->ivlen = 0;
 2853|  11.0k|	  else if (ski->s2k.mode == 1002)
  ------------------
  |  Branch (2853:13): [True: 3.80k, False: 7.22k]
  ------------------
 2854|  3.80k|	    ski->ivlen = snlen < 16 ? snlen : 16;
  ------------------
  |  Branch (2854:19): [True: 3.66k, False: 139]
  ------------------
 2855|       |
 2856|  11.9k|	  if (pktlen < ski->ivlen)
  ------------------
  |  Branch (2856:8): [True: 2.02k, False: 9.93k]
  ------------------
 2857|  2.02k|	    {
 2858|  2.02k|              err = gpg_error (GPG_ERR_INV_PACKET);
 2859|  2.02k|	      goto leave;
 2860|  2.02k|	    }
 2861|  57.3k|	  for (i = 0; i < ski->ivlen; i++, pktlen--)
  ------------------
  |  Branch (2861:16): [True: 47.4k, False: 9.93k]
  ------------------
 2862|  47.4k|	    temp[i] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  57.3k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  47.4k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 47.4k]
  |  |  |  |  |  Branch (500:24): [True: 2.50k, False: 44.9k]
  |  |  |  |  ------------------
  |  |  |  |  501|  47.4k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2863|  9.93k|	  if (list_mode && ski->s2k.mode != 1003)
  ------------------
  |  Branch (2863:8): [True: 0, False: 9.93k]
  |  Branch (2863:21): [True: 0, False: 0]
  ------------------
 2864|      0|	    {
 2865|      0|	      es_fprintf (listfp,
 2866|      0|                          ski->s2k.mode == 1002 ? "\tserial-number: "
  ------------------
  |  Branch (2866:27): [True: 0, False: 0]
  ------------------
 2867|      0|                          : "\tprotect IV: ");
 2868|      0|	      for (i = 0; i < ski->ivlen; i++)
  ------------------
  |  Branch (2868:20): [True: 0, False: 0]
  ------------------
 2869|      0|		es_fprintf (listfp, " %02x", temp[i]);
 2870|      0|	      es_putc ('\n', listfp);
 2871|      0|	    }
 2872|  9.93k|	  memcpy (ski->iv, temp, ski->ivlen);
 2873|  9.93k|	}
 2874|       |
 2875|       |      /* Skip count of secret key material.  */
 2876|  15.0k|      if (is_v5)
  ------------------
  |  Branch (2876:11): [True: 3.21k, False: 11.8k]
  ------------------
 2877|  3.21k|        {
 2878|  3.21k|          if (pktlen < 4)
  ------------------
  |  Branch (2878:15): [True: 673, False: 2.54k]
  ------------------
 2879|    673|            {
 2880|    673|              err = gpg_error (GPG_ERR_INV_PACKET);
 2881|    673|              goto leave;
 2882|    673|            }
 2883|  2.54k|          skbytes = read_32 (inp);
 2884|  2.54k|          pktlen -= 4;
 2885|  2.54k|          if (list_mode)
  ------------------
  |  Branch (2885:15): [True: 0, False: 2.54k]
  ------------------
 2886|      0|            es_fprintf (listfp, "\tskbytes: %u\n", skbytes);
 2887|  2.54k|        }
 2888|       |
 2889|       |      /* It does not make sense to read it into secure memory.
 2890|       |       * If the user is so careless, not to protect his secret key,
 2891|       |       * we can assume, that he operates an open system :=(.
 2892|       |       * So we put the key into secure memory when we unprotect it. */
 2893|  14.3k|      if (ski->s2k.mode == 1001 || ski->s2k.mode == 1002)
  ------------------
  |  Branch (2893:11): [True: 767, False: 13.6k]
  |  Branch (2893:36): [True: 3.80k, False: 9.80k]
  ------------------
 2894|  4.56k|	{
 2895|       |	  /* Better set some dummy stuff here.  */
 2896|  4.56k|	  pk->pkey[npkey] = gcry_mpi_set_opaque (NULL,
 2897|  4.56k|						 xstrdup ("dummydata"),
  ------------------
  |  |  112|  4.56k|#define xstrdup(a)       gcry_xstrdup ((a))
  ------------------
 2898|  4.56k|						 10 * 8);
 2899|  4.56k|	  pktlen = 0;
 2900|  4.56k|	}
 2901|  9.80k|      else if (ski->s2k.mode == 1003)
  ------------------
  |  Branch (2901:16): [True: 165, False: 9.63k]
  ------------------
 2902|    165|	{
 2903|    165|          void *tmpp;
 2904|       |
 2905|    165|	  if (pktlen < 2) /* At least two bytes for parenthesis.  */
  ------------------
  |  Branch (2905:8): [True: 72, False: 93]
  ------------------
 2906|     72|	    {
 2907|     72|              err = gpg_error (GPG_ERR_INV_PACKET);
 2908|     72|	      goto leave;
 2909|     72|	    }
 2910|       |
 2911|     93|          tmpp = read_rest (inp, pktlen);
 2912|     93|          if (list_mode)
  ------------------
  |  Branch (2912:15): [True: 0, False: 93]
  ------------------
 2913|      0|            {
 2914|      0|              if (mpi_print_mode)
  ------------------
  |  Branch (2914:19): [True: 0, False: 0]
  ------------------
 2915|      0|                {
 2916|      0|                  char *tmpsxp = canon_sexp_to_string (tmpp, pktlen);
 2917|      0|                  es_fprintf (listfp, "\tskey[%d]: %s\n", npkey,
 2918|      0|                              tmpsxp? trim_trailing_spaces (tmpsxp)
  ------------------
  |  Branch (2918:31): [True: 0, False: 0]
  ------------------
 2919|      0|                              /*  */: "[invalid S-expression]");
 2920|      0|                  xfree (tmpsxp);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 2921|      0|                }
 2922|      0|              else
 2923|      0|                es_fprintf (listfp, "\tskey[%d]: [s-expression %lu octets]\n",
 2924|      0|                            npkey, pktlen);
 2925|      0|            }
 2926|     93|	  pk->pkey[npkey] = gcry_mpi_set_opaque (NULL,
 2927|     93|						 tmpp, tmpp? pktlen * 8 : 0);
  ------------------
  |  Branch (2927:14): [True: 81, False: 12]
  ------------------
 2928|     93|          pktlen = 0;
 2929|     93|	}
 2930|  9.63k|      else if (ski->is_protected)
  ------------------
  |  Branch (2930:16): [True: 4.57k, False: 5.06k]
  ------------------
 2931|  4.57k|	{
 2932|  4.57k|          void *tmpp;
 2933|       |
 2934|  4.57k|	  if (pktlen < 2) /* At least two bytes for the length.  */
  ------------------
  |  Branch (2934:8): [True: 2.58k, False: 1.98k]
  ------------------
 2935|  2.58k|	    {
 2936|  2.58k|              err = gpg_error (GPG_ERR_INV_PACKET);
 2937|  2.58k|	      goto leave;
 2938|  2.58k|	    }
 2939|       |
 2940|       |	  /* Ugly: The length is encrypted too, so we read all stuff
 2941|       |	   * up to the end of the packet into the first SKEY
 2942|       |	   * element.
 2943|       |           * FIXME: We can do better for v5 keys.  */
 2944|       |
 2945|  1.98k|          tmpp = read_rest (inp, pktlen);
 2946|  1.98k|	  pk->pkey[npkey] = gcry_mpi_set_opaque (NULL,
 2947|  1.98k|						 tmpp, tmpp? pktlen * 8 : 0);
  ------------------
  |  Branch (2947:14): [True: 1.69k, False: 287]
  ------------------
 2948|       |          /* Mark that MPI as protected - we need this information for
 2949|       |           * importing a key.  The OPAQUE flag can't be used because
 2950|       |           * we also store public EdDSA values in opaque MPIs.  */
 2951|  1.98k|          if (pk->pkey[npkey])
  ------------------
  |  Branch (2951:15): [True: 1.98k, False: 0]
  ------------------
 2952|  1.98k|            gcry_mpi_set_flag (pk->pkey[npkey], GCRYMPI_FLAG_USER1);
 2953|  1.98k|	  pktlen = 0;
 2954|  1.98k|	  if (list_mode)
  ------------------
  |  Branch (2954:8): [True: 0, False: 1.98k]
  ------------------
 2955|      0|            es_fprintf (listfp, "\tskey[%d]: [v4 protected]\n", npkey);
 2956|  1.98k|	}
 2957|  5.06k|      else
 2958|  5.06k|	{
 2959|       |          /* Not encrypted.  */
 2960|  15.8k|	  for (i = npkey; i < nskey; i++)
  ------------------
  |  Branch (2960:20): [True: 12.3k, False: 3.48k]
  ------------------
 2961|  12.3k|	    {
 2962|  12.3k|              unsigned int n;
 2963|       |
 2964|  12.3k|              if (pktlen < 2) /* At least two bytes for the length.  */
  ------------------
  |  Branch (2964:19): [True: 1.58k, False: 10.7k]
  ------------------
 2965|  1.58k|                {
 2966|  1.58k|                  err = gpg_error (GPG_ERR_INV_PACKET);
 2967|  1.58k|                  goto leave;
 2968|  1.58k|                }
 2969|  10.7k|              n = pktlen;
 2970|  10.7k|              if (algorithm == PUBKEY_ALGO_ECDSA
  ------------------
  |  Branch (2970:19): [True: 670, False: 10.0k]
  ------------------
 2971|  10.7k|                  || algorithm == PUBKEY_ALGO_EDDSA
  ------------------
  |  Branch (2971:22): [True: 744, False: 9.34k]
  ------------------
 2972|  10.7k|                  || algorithm == PUBKEY_ALGO_ECDH)
  ------------------
  |  Branch (2972:22): [True: 67, False: 9.27k]
  ------------------
 2973|  1.48k|                pk->pkey[i] = sos_read (inp, &n, 0);
 2974|  9.27k|              else
 2975|  9.27k|                pk->pkey[i] = mpi_read (inp, &n, 0);
 2976|  10.7k|              pktlen -= n;
 2977|  10.7k|              if (list_mode)
  ------------------
  |  Branch (2977:19): [True: 0, False: 10.7k]
  ------------------
 2978|      0|                {
 2979|      0|                  es_fprintf (listfp, "\tskey[%d]: ", i);
 2980|      0|                  mpi_print (listfp, pk->pkey[i], mpi_print_mode);
 2981|      0|                  es_putc ('\n', listfp);
 2982|      0|                }
 2983|       |
 2984|  10.7k|	      if (!pk->pkey[i])
  ------------------
  |  Branch (2984:12): [True: 7.00k, False: 3.75k]
  ------------------
 2985|  7.00k|		err = gpg_error (GPG_ERR_INV_PACKET);
 2986|  10.7k|	    }
 2987|  3.48k|	  if (err)
  ------------------
  |  Branch (2987:8): [True: 3.08k, False: 404]
  ------------------
 2988|  3.08k|	    goto leave;
 2989|       |
 2990|    404|	  if (pktlen < 2)
  ------------------
  |  Branch (2990:8): [True: 119, False: 285]
  ------------------
 2991|    119|	    {
 2992|    119|              err = gpg_error (GPG_ERR_INV_PACKET);
 2993|    119|	      goto leave;
 2994|    119|	    }
 2995|    285|	  ski->csum = read_16 (inp);
 2996|    285|	  pktlen -= 2;
 2997|    285|	  if (list_mode)
  ------------------
  |  Branch (2997:8): [True: 0, False: 285]
  ------------------
 2998|      0|            es_fprintf (listfp, "\tchecksum: %04hx\n", ski->csum);
 2999|    285|	}
 3000|  14.3k|    }
 3001|       |
 3002|       |  /* Note that KEYID below has been initialized above in list_mode.  */
 3003|  7.28k|  if (list_mode)
  ------------------
  |  Branch (3003:7): [True: 0, False: 7.28k]
  ------------------
 3004|      0|    es_fprintf (listfp, "\tkeyid: %08lX%08lX\n",
 3005|      0|                (ulong) keyid[0], (ulong) keyid[1]);
 3006|       |
 3007|  42.7k| leave:
 3008|  42.7k|  iobuf_skip_rest (inp, pktlen, 0);
 3009|  42.7k|  return err;
 3010|  7.28k|}
parse-packet.c:read_size_body:
 1117|  21.3k|{
 1118|  21.3k|  char buffer[256];
 1119|  21.3k|  char *tmpbuf;
 1120|  21.3k|  int i, c, nbytes;
 1121|       |
 1122|  21.3k|  *r_nread = 0;
 1123|  21.3k|  *r_data = NULL;
 1124|       |
 1125|  21.3k|  if (!pktlen)
  ------------------
  |  Branch (1125:7): [True: 3.61k, False: 17.7k]
  ------------------
 1126|  3.61k|    return gpg_error (GPG_ERR_INV_PACKET);
 1127|  17.7k|  c = iobuf_readbyte (inp);
 1128|  17.7k|  if (c < 0)
  ------------------
  |  Branch (1128:7): [True: 161, False: 17.5k]
  ------------------
 1129|    161|    return gpg_error (GPG_ERR_INV_PACKET);
 1130|  17.5k|  pktlen--;
 1131|  17.5k|  ++*r_nread;
 1132|  17.5k|  nbytes = c;
 1133|  17.5k|  if (nbytes < 2 || nbytes > 254)
  ------------------
  |  Branch (1133:7): [True: 2.98k, False: 14.6k]
  |  Branch (1133:21): [True: 3.31k, False: 11.3k]
  ------------------
 1134|  6.29k|    return gpg_error (GPG_ERR_INV_PACKET);
 1135|  11.3k|  if (nbytes > pktlen)
  ------------------
  |  Branch (1135:7): [True: 7.03k, False: 4.27k]
  ------------------
 1136|  7.03k|    return gpg_error (GPG_ERR_INV_PACKET);
 1137|       |
 1138|  4.27k|  buffer[0] = nbytes;
 1139|       |
 1140|  22.8k|  for (i = 0; i < nbytes; i++)
  ------------------
  |  Branch (1140:15): [True: 18.8k, False: 4.05k]
  ------------------
 1141|  18.8k|    {
 1142|  18.8k|      c = iobuf_get (inp);
  ------------------
  |  |  500|  18.8k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 18.8k]
  |  |  |  Branch (500:24): [True: 398, False: 18.4k]
  |  |  ------------------
  |  |  501|  18.8k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
 1143|  18.8k|      if (c < 0)
  ------------------
  |  Branch (1143:11): [True: 220, False: 18.5k]
  ------------------
 1144|    220|        return gpg_error (GPG_ERR_INV_PACKET);
 1145|  18.5k|      ++*r_nread;
 1146|  18.5k|      buffer[1+i] = c;
 1147|  18.5k|    }
 1148|       |
 1149|  4.05k|  tmpbuf = xtrymalloc (1 + nbytes);
  ------------------
  |  |   97|  4.05k|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
 1150|  4.05k|  if (!tmpbuf)
  ------------------
  |  Branch (1150:7): [True: 0, False: 4.05k]
  ------------------
 1151|      0|    return gpg_error_from_syserror ();
 1152|  4.05k|  memcpy (tmpbuf, buffer, 1 + nbytes);
 1153|  4.05k|  *r_data = gcry_mpi_set_opaque (NULL, tmpbuf, 8 * (1 + nbytes));
 1154|  4.05k|  if (!*r_data)
  ------------------
  |  Branch (1154:7): [True: 0, False: 4.05k]
  ------------------
 1155|      0|    {
 1156|      0|      xfree (tmpbuf);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1157|      0|      return gpg_error_from_syserror ();
 1158|      0|    }
 1159|  4.05k|  return 0;
 1160|  4.05k|}
parse-packet.c:parse_symkeyenc:
 1207|  8.61k|{
 1208|  8.61k|  PKT_symkey_enc *k;
 1209|  8.61k|  int rc = 0;
 1210|  8.61k|  int i, version, s2kmode, cipher_algo, aead_algo, hash_algo, seskeylen, minlen;
 1211|       |
 1212|  8.61k|  if (pktlen < 4)
  ------------------
  |  Branch (1212:7): [True: 2.36k, False: 6.24k]
  ------------------
 1213|  2.36k|    goto too_short;
 1214|  6.24k|  version = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  6.24k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  6.24k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 6.24k]
  |  |  |  |  |  Branch (500:24): [True: 133, False: 6.11k]
  |  |  |  |  ------------------
  |  |  |  |  501|  6.24k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1215|  6.24k|  pktlen--;
 1216|  6.24k|  if (version == 4)
  ------------------
  |  Branch (1216:7): [True: 3.33k, False: 2.90k]
  ------------------
 1217|  3.33k|    ;
 1218|  2.90k|  else if (version == 5)
  ------------------
  |  Branch (1218:12): [True: 2.16k, False: 740]
  ------------------
 1219|  2.16k|    ;
 1220|    740|  else
 1221|    740|    {
 1222|    740|      log_error ("packet(%d) with unknown version %d\n", pkttype, version);
 1223|    740|      if (list_mode)
  ------------------
  |  Branch (1223:11): [True: 0, False: 740]
  ------------------
 1224|      0|        es_fprintf (listfp, ":symkey enc packet: [unknown version]\n");
 1225|    740|      rc = gpg_error (GPG_ERR_INV_PACKET);
 1226|    740|      goto leave;
 1227|    740|    }
 1228|  5.50k|  if (pktlen > 200)
  ------------------
  |  Branch (1228:7): [True: 500, False: 5.00k]
  ------------------
 1229|    500|    {				/* (we encode the seskeylen in a byte) */
 1230|    500|      log_error ("packet(%d) too large\n", pkttype);
 1231|    500|      if (list_mode)
  ------------------
  |  Branch (1231:11): [True: 0, False: 500]
  ------------------
 1232|      0|        es_fprintf (listfp, ":symkey enc packet: [too large]\n");
 1233|    500|      rc = gpg_error (GPG_ERR_INV_PACKET);
 1234|    500|      goto leave;
 1235|    500|    }
 1236|  5.00k|  cipher_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  5.00k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  5.00k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 5.00k]
  |  |  |  |  |  Branch (500:24): [True: 1.11k, False: 3.89k]
  |  |  |  |  ------------------
  |  |  |  |  501|  5.00k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1237|  5.00k|  pktlen--;
 1238|  5.00k|  if (version == 5)
  ------------------
  |  Branch (1238:7): [True: 2.15k, False: 2.85k]
  ------------------
 1239|  2.15k|    {
 1240|  2.15k|      aead_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  2.15k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  2.15k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 2.15k]
  |  |  |  |  |  Branch (500:24): [True: 311, False: 1.84k]
  |  |  |  |  ------------------
  |  |  |  |  501|  2.15k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1241|  2.15k|      pktlen--;
 1242|  2.15k|    }
 1243|  2.85k|  else
 1244|  2.85k|    aead_algo = 0;
 1245|  5.00k|  if (pktlen < 2)
  ------------------
  |  Branch (1245:7): [True: 1.53k, False: 3.46k]
  ------------------
 1246|  1.53k|    goto too_short;
 1247|  3.46k|  s2kmode = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  3.46k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  3.46k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 3.46k]
  |  |  |  |  |  Branch (500:24): [True: 42, False: 3.42k]
  |  |  |  |  ------------------
  |  |  |  |  501|  3.46k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1248|  3.46k|  pktlen--;
 1249|  3.46k|  hash_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  3.46k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  3.46k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 3.46k]
  |  |  |  |  |  Branch (500:24): [True: 487, False: 2.98k]
  |  |  |  |  ------------------
  |  |  |  |  501|  3.46k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1250|  3.46k|  pktlen--;
 1251|  3.46k|  switch (s2kmode)
 1252|  3.46k|    {
 1253|    653|    case 0: /* Simple S2K.  */
  ------------------
  |  Branch (1253:5): [True: 653, False: 2.81k]
  ------------------
 1254|    653|      minlen = 0;
 1255|    653|      break;
 1256|    557|    case 1: /* Salted S2K.  */
  ------------------
  |  Branch (1256:5): [True: 557, False: 2.91k]
  ------------------
 1257|    557|      minlen = 8;
 1258|    557|      break;
 1259|  1.11k|    case 3: /* Iterated+salted S2K.  */
  ------------------
  |  Branch (1259:5): [True: 1.11k, False: 2.35k]
  ------------------
 1260|  1.11k|      minlen = 9;
 1261|  1.11k|      break;
 1262|  1.14k|    default:
  ------------------
  |  Branch (1262:5): [True: 1.14k, False: 2.32k]
  ------------------
 1263|  1.14k|      log_error ("unknown S2K mode %d\n", s2kmode);
 1264|  1.14k|      if (list_mode)
  ------------------
  |  Branch (1264:11): [True: 0, False: 1.14k]
  ------------------
 1265|      0|        es_fprintf (listfp, ":symkey enc packet: [unknown S2K mode]\n");
 1266|  1.14k|      goto leave;
 1267|  3.46k|    }
 1268|  2.32k|  if (minlen > pktlen)
  ------------------
  |  Branch (1268:7): [True: 1.60k, False: 723]
  ------------------
 1269|  1.60k|    {
 1270|  1.60k|      log_error ("packet with S2K %d too short\n", s2kmode);
 1271|  1.60k|      if (list_mode)
  ------------------
  |  Branch (1271:11): [True: 0, False: 1.60k]
  ------------------
 1272|      0|        es_fprintf (listfp, ":symkey enc packet: [too short]\n");
 1273|  1.60k|      rc = gpg_error (GPG_ERR_INV_PACKET);
 1274|  1.60k|      goto leave;
 1275|  1.60k|    }
 1276|    723|  seskeylen = pktlen - minlen;
 1277|    723|  k = packet->pkt.symkey_enc = xmalloc_clear (sizeof *packet->pkt.symkey_enc
  ------------------
  |  |  116|    723|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
 1278|    723|					      + seskeylen - 1);
 1279|    723|  k->version = version;
 1280|    723|  k->cipher_algo = cipher_algo;
 1281|    723|  k->aead_algo = aead_algo;
 1282|    723|  k->s2k.mode = s2kmode;
 1283|    723|  k->s2k.hash_algo = hash_algo;
 1284|    723|  if (s2kmode == 1 || s2kmode == 3)
  ------------------
  |  Branch (1284:7): [True: 29, False: 694]
  |  Branch (1284:23): [True: 41, False: 653]
  ------------------
 1285|     70|    {
 1286|    630|      for (i = 0; i < 8 && pktlen; i++, pktlen--)
  ------------------
  |  Branch (1286:19): [True: 560, False: 70]
  |  Branch (1286:28): [True: 560, False: 0]
  ------------------
 1287|    560|	k->s2k.salt[i] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|    560|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|    560|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 560]
  |  |  |  |  |  Branch (500:24): [True: 218, False: 342]
  |  |  |  |  ------------------
  |  |  |  |  501|    560|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1288|     70|    }
 1289|    723|  if (s2kmode == 3)
  ------------------
  |  Branch (1289:7): [True: 41, False: 682]
  ------------------
 1290|     41|    {
 1291|     41|      k->s2k.count = iobuf_get_noeof (inp);
  ------------------
  |  |  502|     41|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|     41|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 41]
  |  |  |  |  |  Branch (500:24): [True: 11, False: 30]
  |  |  |  |  ------------------
  |  |  |  |  501|     41|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1292|     41|      pktlen--;
 1293|     41|    }
 1294|    723|  k->seskeylen = seskeylen;
 1295|    723|  if (k->seskeylen)
  ------------------
  |  Branch (1295:7): [True: 720, False: 3]
  ------------------
 1296|    720|    {
 1297|  10.6k|      for (i = 0; i < seskeylen && pktlen; i++, pktlen--)
  ------------------
  |  Branch (1297:19): [True: 9.89k, False: 720]
  |  Branch (1297:36): [True: 9.89k, False: 0]
  ------------------
 1298|  9.89k|	k->seskey[i] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  9.89k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  9.89k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 9.89k]
  |  |  |  |  |  Branch (500:24): [True: 5.50k, False: 4.39k]
  |  |  |  |  ------------------
  |  |  |  |  501|  9.89k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1299|       |
 1300|       |      /* What we're watching out for here is a session key decryptor
 1301|       |         with no salt.  The RFC says that using salt for this is a
 1302|       |         MUST. */
 1303|    720|      if (s2kmode != 1 && s2kmode != 3)
  ------------------
  |  Branch (1303:11): [True: 692, False: 28]
  |  Branch (1303:27): [True: 651, False: 41]
  ------------------
 1304|    651|	log_info (_("WARNING: potentially insecure symmetrically"
  ------------------
  |  |   28|    651|#  define _(a) gettext (a)
  ------------------
 1305|    651|		    " encrypted session key\n"));
 1306|    720|    }
 1307|    723|  log_assert (!pktlen);
 1308|       |
 1309|    723|  if (list_mode)
  ------------------
  |  Branch (1309:7): [True: 0, False: 723]
  ------------------
 1310|      0|    {
 1311|      0|      es_fprintf (listfp,
 1312|      0|                  ":symkey enc packet: version %d, cipher %d, aead %d,"
 1313|      0|                  " s2k %d, hash %d",
 1314|      0|                  version, cipher_algo, aead_algo, s2kmode, hash_algo);
 1315|      0|      if (seskeylen)
  ------------------
  |  Branch (1315:11): [True: 0, False: 0]
  ------------------
 1316|      0|        {
 1317|       |          /* To compute the size of the session key we need to know
 1318|       |           * the size of the AEAD nonce which we may not know.  Thus
 1319|       |           * we show only the size of the entire encrypted session
 1320|       |           * key.  */
 1321|      0|          if (aead_algo)
  ------------------
  |  Branch (1321:15): [True: 0, False: 0]
  ------------------
 1322|      0|            es_fprintf (listfp, ", encrypted seskey %d bytes", seskeylen);
 1323|      0|          else
 1324|      0|            es_fprintf (listfp, ", seskey %d bits", (seskeylen - 1) * 8);
 1325|      0|        }
 1326|      0|      es_fprintf (listfp, "\n");
 1327|      0|      if (s2kmode == 1 || s2kmode == 3)
  ------------------
  |  Branch (1327:11): [True: 0, False: 0]
  |  Branch (1327:27): [True: 0, False: 0]
  ------------------
 1328|      0|	{
 1329|      0|	  es_fprintf (listfp, "\tsalt ");
 1330|      0|          es_write_hexstring (listfp, k->s2k.salt, 8, 0, NULL);
 1331|      0|	  if (s2kmode == 3)
  ------------------
  |  Branch (1331:8): [True: 0, False: 0]
  ------------------
 1332|      0|	    es_fprintf (listfp, ", count %lu (%lu)",
 1333|      0|                        S2K_DECODE_COUNT ((ulong) k->s2k.count),
  ------------------
  |  |  210|      0|#define S2K_DECODE_COUNT(_val) ((16ul + ((_val) & 15)) << (((_val) >> 4) + 6))
  ------------------
 1334|      0|                        (ulong) k->s2k.count);
 1335|      0|	  es_fprintf (listfp, "\n");
 1336|      0|	}
 1337|      0|    }
 1338|       |
 1339|  8.61k| leave:
 1340|  8.61k|  iobuf_skip_rest (inp, pktlen, 0);
 1341|  8.61k|  return rc;
 1342|       |
 1343|  3.90k| too_short:
 1344|  3.90k|  log_error ("packet(%d) too short\n", pkttype);
 1345|  3.90k|  if (list_mode)
  ------------------
  |  Branch (1345:7): [True: 0, False: 3.90k]
  ------------------
 1346|      0|    es_fprintf (listfp, ":symkey enc packet: [too short]\n");
 1347|  3.90k|  rc = gpg_error (GPG_ERR_INV_PACKET);
 1348|  3.90k|  goto leave;
 1349|    723|}
parse-packet.c:parse_pubkeyenc:
 1355|  32.9k|{
 1356|  32.9k|  int rc = 0;
 1357|  32.9k|  int i, ndata;
 1358|  32.9k|  PKT_pubkey_enc *k;
 1359|       |
 1360|  32.9k|  k = packet->pkt.pubkey_enc = xmalloc_clear (sizeof *packet->pkt.pubkey_enc);
  ------------------
  |  |  116|  32.9k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
 1361|  32.9k|  if (pktlen < 12)
  ------------------
  |  Branch (1361:7): [True: 7.48k, False: 25.4k]
  ------------------
 1362|  7.48k|    {
 1363|  7.48k|      log_error ("packet(%d) too short\n", pkttype);
 1364|  7.48k|      if (list_mode)
  ------------------
  |  Branch (1364:11): [True: 0, False: 7.48k]
  ------------------
 1365|      0|        es_fputs (":pubkey enc packet: [too short]\n", listfp);
 1366|  7.48k|      rc = gpg_error (GPG_ERR_INV_PACKET);
 1367|  7.48k|      goto leave;
 1368|  7.48k|    }
 1369|  25.4k|  k->version = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  25.4k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  25.4k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 25.4k]
  |  |  |  |  |  Branch (500:24): [True: 154, False: 25.3k]
  |  |  |  |  ------------------
  |  |  |  |  501|  25.4k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1370|  25.4k|  pktlen--;
 1371|  25.4k|  if (k->version != 2 && k->version != 3)
  ------------------
  |  Branch (1371:7): [True: 23.7k, False: 1.69k]
  |  Branch (1371:26): [True: 2.06k, False: 21.7k]
  ------------------
 1372|  2.06k|    {
 1373|  2.06k|      log_error ("packet(%d) with unknown version %d\n", pkttype, k->version);
 1374|  2.06k|      if (list_mode)
  ------------------
  |  Branch (1374:11): [True: 0, False: 2.06k]
  ------------------
 1375|      0|        es_fputs (":pubkey enc packet: [unknown version]\n", listfp);
 1376|  2.06k|      rc = gpg_error (GPG_ERR_INV_PACKET);
 1377|  2.06k|      goto leave;
 1378|  2.06k|    }
 1379|  23.4k|  k->keyid[0] = read_32 (inp);
 1380|  23.4k|  pktlen -= 4;
 1381|  23.4k|  k->keyid[1] = read_32 (inp);
 1382|  23.4k|  pktlen -= 4;
 1383|  23.4k|  k->pubkey_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  23.4k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  23.4k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 23.4k]
  |  |  |  |  |  Branch (500:24): [True: 136, False: 23.2k]
  |  |  |  |  ------------------
  |  |  |  |  501|  23.4k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1384|  23.4k|  pktlen--;
 1385|  23.4k|  k->throw_keyid = 0;  /* Only used as flag for build_packet.  */
 1386|  23.4k|  if (list_mode)
  ------------------
  |  Branch (1386:7): [True: 0, False: 23.4k]
  ------------------
 1387|      0|    es_fprintf (listfp,
 1388|      0|                ":pubkey enc packet: version %d, algo %d, keyid %08lX%08lX\n",
 1389|      0|                k->version, k->pubkey_algo, (ulong) k->keyid[0],
 1390|      0|                (ulong) k->keyid[1]);
 1391|       |
 1392|  23.4k|  ndata = pubkey_get_nenc (k->pubkey_algo);
 1393|  23.4k|  if (!ndata)
  ------------------
  |  Branch (1393:7): [True: 381, False: 23.0k]
  ------------------
 1394|    381|    {
 1395|    381|      if (list_mode)
  ------------------
  |  Branch (1395:11): [True: 0, False: 381]
  ------------------
 1396|      0|	es_fprintf (listfp, "\tunsupported algorithm %d\n", k->pubkey_algo);
 1397|    381|      unknown_pubkey_warning (k->pubkey_algo);
 1398|    381|      k->data[0] = NULL; /* No need to store the encrypted data.  */
 1399|    381|    }
 1400|  23.0k|  else
 1401|  23.0k|    {
 1402|  40.9k|      for (i = 0; i < ndata; i++)
  ------------------
  |  Branch (1402:19): [True: 40.7k, False: 223]
  ------------------
 1403|  40.7k|        {
 1404|  40.7k|          if (k->pubkey_algo == PUBKEY_ALGO_ECDH)
  ------------------
  |  Branch (1404:15): [True: 37.6k, False: 3.09k]
  ------------------
 1405|  37.6k|            {
 1406|  37.6k|              if (i == 1)
  ------------------
  |  Branch (1406:19): [True: 16.3k, False: 21.2k]
  ------------------
 1407|  16.3k|                {
 1408|  16.3k|                  size_t n;
 1409|  16.3k|                  rc = read_size_body (inp, pktlen, &n, k->data+i);
 1410|  16.3k|                  pktlen -= n;
 1411|  16.3k|                }
 1412|  21.2k|              else
 1413|  21.2k|                {
 1414|  21.2k|                  int n = pktlen;
 1415|  21.2k|                  k->data[i] = sos_read (inp, &n, 0);
 1416|  21.2k|                  pktlen -= n;
 1417|  21.2k|                  if (!k->data[i])
  ------------------
  |  Branch (1417:23): [True: 4.97k, False: 16.3k]
  ------------------
 1418|  4.97k|                    rc = gpg_error (GPG_ERR_INV_PACKET);
 1419|  21.2k|                }
 1420|  37.6k|            }
 1421|  3.09k|          else
 1422|  3.09k|            {
 1423|  3.09k|	      int n = pktlen;
 1424|  3.09k|              k->data[i] = mpi_read (inp, &n, 0);
 1425|  3.09k|              pktlen -= n;
 1426|  3.09k|              if (!k->data[i])
  ------------------
  |  Branch (1426:19): [True: 1.53k, False: 1.55k]
  ------------------
 1427|  1.53k|                rc = gpg_error (GPG_ERR_INV_PACKET);
 1428|  3.09k|            }
 1429|  40.7k|          if (rc)
  ------------------
  |  Branch (1429:15): [True: 22.8k, False: 17.8k]
  ------------------
 1430|  22.8k|            goto leave;
 1431|  17.8k|          if (list_mode)
  ------------------
  |  Branch (1431:15): [True: 0, False: 17.8k]
  ------------------
 1432|      0|            {
 1433|      0|              es_fprintf (listfp, "\tdata: ");
 1434|      0|              mpi_print (listfp, k->data[i], mpi_print_mode);
 1435|      0|              es_putc ('\n', listfp);
 1436|      0|            }
 1437|  17.8k|        }
 1438|  23.0k|    }
 1439|       |
 1440|  32.9k| leave:
 1441|  32.9k|  iobuf_skip_rest (inp, pktlen, 0);
 1442|  32.9k|  return rc;
 1443|  23.4k|}
parse-packet.c:parse_onepass_sig:
 2409|  11.1k|{
 2410|  11.1k|  int version;
 2411|  11.1k|  int rc = 0;
 2412|       |
 2413|  11.1k|  if (pktlen < 13)
  ------------------
  |  Branch (2413:7): [True: 1.25k, False: 9.85k]
  ------------------
 2414|  1.25k|    {
 2415|  1.25k|      log_error ("packet(%d) too short\n", pkttype);
 2416|  1.25k|      if (list_mode)
  ------------------
  |  Branch (2416:11): [True: 0, False: 1.25k]
  ------------------
 2417|      0|        es_fputs (":onepass_sig packet: [too short]\n", listfp);
 2418|  1.25k|      rc = gpg_error (GPG_ERR_INV_PACKET);
 2419|  1.25k|      goto leave;
 2420|  1.25k|    }
 2421|  9.85k|  version = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  9.85k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  9.85k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 9.85k]
  |  |  |  |  |  Branch (500:24): [True: 785, False: 9.06k]
  |  |  |  |  ------------------
  |  |  |  |  501|  9.85k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2422|  9.85k|  pktlen--;
 2423|  9.85k|  if (version != 3)
  ------------------
  |  Branch (2423:7): [True: 1.59k, False: 8.26k]
  ------------------
 2424|  1.59k|    {
 2425|  1.59k|      log_error ("onepass_sig with unknown version %d\n", version);
 2426|  1.59k|      if (list_mode)
  ------------------
  |  Branch (2426:11): [True: 0, False: 1.59k]
  ------------------
 2427|      0|        es_fputs (":onepass_sig packet: [unknown version]\n", listfp);
 2428|  1.59k|      rc = gpg_error (GPG_ERR_INV_PACKET);
 2429|  1.59k|      goto leave;
 2430|  1.59k|    }
 2431|  8.26k|  ops->sig_class = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  8.26k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  8.26k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 8.26k]
  |  |  |  |  |  Branch (500:24): [True: 1.04k, False: 7.21k]
  |  |  |  |  ------------------
  |  |  |  |  501|  8.26k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2432|  8.26k|  pktlen--;
 2433|  8.26k|  ops->digest_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  8.26k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  8.26k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 8.26k]
  |  |  |  |  |  Branch (500:24): [True: 1.31k, False: 6.94k]
  |  |  |  |  ------------------
  |  |  |  |  501|  8.26k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2434|  8.26k|  pktlen--;
 2435|  8.26k|  ops->pubkey_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  8.26k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  8.26k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 8.26k]
  |  |  |  |  |  Branch (500:24): [True: 585, False: 7.67k]
  |  |  |  |  ------------------
  |  |  |  |  501|  8.26k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2436|  8.26k|  pktlen--;
 2437|  8.26k|  ops->keyid[0] = read_32 (inp);
 2438|  8.26k|  pktlen -= 4;
 2439|  8.26k|  ops->keyid[1] = read_32 (inp);
 2440|  8.26k|  pktlen -= 4;
 2441|  8.26k|  ops->last = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  8.26k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  8.26k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 8.26k]
  |  |  |  |  |  Branch (500:24): [True: 219, False: 8.04k]
  |  |  |  |  ------------------
  |  |  |  |  501|  8.26k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2442|  8.26k|  pktlen--;
 2443|  8.26k|  if (list_mode)
  ------------------
  |  Branch (2443:7): [True: 0, False: 8.26k]
  ------------------
 2444|      0|    es_fprintf (listfp,
 2445|      0|                ":onepass_sig packet: keyid %08lX%08lX\n"
 2446|      0|                "\tversion %d, sigclass 0x%02x, digest %d, pubkey %d, "
 2447|      0|                "last=%d\n",
 2448|      0|                (ulong) ops->keyid[0], (ulong) ops->keyid[1],
 2449|      0|                version, ops->sig_class,
 2450|      0|                ops->digest_algo, ops->pubkey_algo, ops->last);
 2451|       |
 2452|       |
 2453|  11.1k| leave:
 2454|  11.1k|  iobuf_skip_rest (inp, pktlen, 0);
 2455|  11.1k|  return rc;
 2456|  8.26k|}
parse-packet.c:parse_user_id:
 3091|  1.12k|{
 3092|  1.12k|  byte *p;
 3093|       |
 3094|       |  /* Cap the size of a user ID at 2k: a value absurdly large enough
 3095|       |     that there is no sane user ID string (which is printable text
 3096|       |     as of RFC2440bis) that won't fit in it, but yet small enough to
 3097|       |     avoid allocation problems.  A large pktlen may not be
 3098|       |     allocatable, and a very large pktlen could actually cause our
 3099|       |     allocation to wrap around in xmalloc to a small number. */
 3100|       |
 3101|  1.12k|  if (pktlen > MAX_UID_PACKET_LENGTH)
  ------------------
  |  |   38|  1.12k|#define MAX_UID_PACKET_LENGTH     (  2 * 1024)
  ------------------
  |  Branch (3101:7): [True: 291, False: 835]
  ------------------
 3102|    291|    {
 3103|    291|      log_error ("packet(%d) too large\n", pkttype);
 3104|    291|      if (list_mode)
  ------------------
  |  Branch (3104:11): [True: 0, False: 291]
  ------------------
 3105|      0|        es_fprintf (listfp, ":user ID packet: [too large]\n");
 3106|    291|      iobuf_skip_rest (inp, pktlen, 0);
 3107|    291|      return GPG_ERR_INV_PACKET;
 3108|    291|    }
 3109|       |
 3110|    835|  packet->pkt.user_id = xmalloc_clear (sizeof *packet->pkt.user_id + pktlen);
  ------------------
  |  |  116|    835|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
 3111|    835|  packet->pkt.user_id->len = pktlen;
 3112|    835|  packet->pkt.user_id->ref = 1;
 3113|       |
 3114|    835|  p = packet->pkt.user_id->name;
 3115|  51.7k|  for (; pktlen; pktlen--, p++)
  ------------------
  |  Branch (3115:10): [True: 50.8k, False: 835]
  ------------------
 3116|  50.8k|    *p = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  51.7k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  50.8k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 50.8k]
  |  |  |  |  |  Branch (500:24): [True: 48.4k, False: 2.41k]
  |  |  |  |  ------------------
  |  |  |  |  501|  50.8k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3117|    835|  *p = 0;
 3118|       |
 3119|    835|  if (list_mode)
  ------------------
  |  Branch (3119:7): [True: 0, False: 835]
  ------------------
 3120|      0|    {
 3121|      0|      int n = packet->pkt.user_id->len;
 3122|      0|      es_fprintf (listfp, ":user ID packet: \"");
 3123|       |      /* fixme: Hey why don't we replace this with es_write_sanitized?? */
 3124|      0|      for (p = packet->pkt.user_id->name; n; p++, n--)
  ------------------
  |  Branch (3124:43): [True: 0, False: 0]
  ------------------
 3125|      0|	{
 3126|      0|	  if (*p >= ' ' && *p <= 'z')
  ------------------
  |  Branch (3126:8): [True: 0, False: 0]
  |  Branch (3126:21): [True: 0, False: 0]
  ------------------
 3127|      0|	    es_putc (*p, listfp);
 3128|      0|	  else
 3129|      0|	    es_fprintf (listfp, "\\x%02x", *p);
 3130|      0|	}
 3131|      0|      es_fprintf (listfp, "\"\n");
 3132|      0|    }
 3133|    835|  return 0;
 3134|  1.12k|}
parse-packet.c:parse_attribute:
 3174|  4.51k|{
 3175|  4.51k|  byte *p;
 3176|       |
 3177|  4.51k|  (void) pkttype;
 3178|       |
 3179|       |  /* We better cap the size of an attribute packet to make DoS not too
 3180|       |     easy.  16MB should be more then enough for one attribute packet
 3181|       |     (ie. a photo).  */
 3182|  4.51k|  if (pktlen > MAX_ATTR_PACKET_LENGTH)
  ------------------
  |  |   40|  4.51k|#define MAX_ATTR_PACKET_LENGTH    ( 16 * 1024*1024)
  ------------------
  |  Branch (3182:7): [True: 110, False: 4.40k]
  ------------------
 3183|    110|    {
 3184|    110|      log_error ("packet(%d) too large\n", pkttype);
 3185|    110|      if (list_mode)
  ------------------
  |  Branch (3185:11): [True: 0, False: 110]
  ------------------
 3186|      0|        es_fprintf (listfp, ":attribute packet: [too large]\n");
 3187|    110|      iobuf_skip_rest (inp, pktlen, 0);
 3188|    110|      return GPG_ERR_INV_PACKET;
 3189|    110|    }
 3190|       |
 3191|  4.40k|#define EXTRA_UID_NAME_SPACE 71
 3192|  4.40k|  packet->pkt.user_id = xmalloc_clear (sizeof *packet->pkt.user_id
  ------------------
  |  |  116|  4.40k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
 3193|  4.40k|				       + EXTRA_UID_NAME_SPACE);
 3194|  4.40k|  packet->pkt.user_id->ref = 1;
 3195|  4.40k|  packet->pkt.user_id->attrib_data = xmalloc (pktlen? pktlen:1);
  ------------------
  |  |  107|  8.80k|#define xmalloc(a)       gcry_xmalloc ((a))
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 4.39k, False: 11]
  |  |  ------------------
  ------------------
 3196|  4.40k|  packet->pkt.user_id->attrib_len = pktlen;
 3197|       |
 3198|  4.40k|  p = packet->pkt.user_id->attrib_data;
 3199|  2.04G|  for (; pktlen; pktlen--, p++)
  ------------------
  |  Branch (3199:10): [True: 2.04G, False: 4.40k]
  ------------------
 3200|  2.04G|    *p = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  2.04G|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  2.04G|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 2.04G]
  |  |  |  |  |  Branch (500:24): [True: 2.04G, False: 465k]
  |  |  |  |  ------------------
  |  |  |  |  501|  2.04G|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3201|       |
 3202|       |  /* Now parse out the individual attribute subpackets.  This is
 3203|       |     somewhat pointless since there is only one currently defined
 3204|       |     attribute type (jpeg), but it is correct by the spec. */
 3205|  4.40k|  parse_attribute_subpkts (packet->pkt.user_id);
 3206|       |
 3207|  4.40k|  make_attribute_uidname (packet->pkt.user_id, EXTRA_UID_NAME_SPACE);
  ------------------
  |  | 3191|  4.40k|#define EXTRA_UID_NAME_SPACE 71
  ------------------
 3208|       |
 3209|  4.40k|  if (list_mode)
  ------------------
  |  Branch (3209:7): [True: 0, False: 4.40k]
  ------------------
 3210|      0|    {
 3211|      0|      es_fprintf (listfp, ":attribute packet: %s\n", packet->pkt.user_id->name);
 3212|      0|    }
 3213|  4.40k|  return 0;
 3214|  4.51k|}
parse-packet.c:parse_comment:
 3219|  2.68k|{
 3220|  2.68k|  byte *p;
 3221|       |
 3222|       |  /* Cap comment packet at a reasonable value to avoid an integer
 3223|       |     overflow in the malloc below.  Comment packets are actually not
 3224|       |     anymore define my OpenPGP and we even stopped to use our
 3225|       |     private comment packet.  */
 3226|  2.68k|  if (pktlen > MAX_COMMENT_PACKET_LENGTH)
  ------------------
  |  |   39|  2.68k|#define MAX_COMMENT_PACKET_LENGTH ( 64 * 1024)
  ------------------
  |  Branch (3226:7): [True: 629, False: 2.05k]
  ------------------
 3227|    629|    {
 3228|    629|      log_error ("packet(%d) too large\n", pkttype);
 3229|    629|      if (list_mode)
  ------------------
  |  Branch (3229:11): [True: 0, False: 629]
  ------------------
 3230|      0|        es_fprintf (listfp, ":%scomment packet: [too large]\n",
 3231|      0|                    pkttype == PKT_OLD_COMMENT ? "OpenPGP draft " : "");
  ------------------
  |  Branch (3231:21): [True: 0, False: 0]
  ------------------
 3232|    629|      iobuf_skip_rest (inp, pktlen, 0);
 3233|    629|      return GPG_ERR_INV_PACKET;
 3234|    629|    }
 3235|  2.05k|  packet->pkt.comment = xmalloc (sizeof *packet->pkt.comment + pktlen - 1);
  ------------------
  |  |  107|  2.05k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 3236|  2.05k|  packet->pkt.comment->len = pktlen;
 3237|  2.05k|  p = packet->pkt.comment->data;
 3238|  1.68M|  for (; pktlen; pktlen--, p++)
  ------------------
  |  Branch (3238:10): [True: 1.67M, False: 2.05k]
  ------------------
 3239|  1.67M|    *p = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  1.68M|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  1.67M|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 1.67M]
  |  |  |  |  |  Branch (500:24): [True: 1.55M, False: 127k]
  |  |  |  |  ------------------
  |  |  |  |  501|  1.67M|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3240|       |
 3241|  2.05k|  if (list_mode)
  ------------------
  |  Branch (3241:7): [True: 0, False: 2.05k]
  ------------------
 3242|      0|    {
 3243|      0|      int n = packet->pkt.comment->len;
 3244|      0|      es_fprintf (listfp, ":%scomment packet: \"", pkttype == PKT_OLD_COMMENT ?
  ------------------
  |  Branch (3244:52): [True: 0, False: 0]
  ------------------
 3245|      0|                  "OpenPGP draft " : "");
 3246|      0|      for (p = packet->pkt.comment->data; n; p++, n--)
  ------------------
  |  Branch (3246:43): [True: 0, False: 0]
  ------------------
 3247|      0|	{
 3248|      0|	  if (*p >= ' ' && *p <= 'z')
  ------------------
  |  Branch (3248:8): [True: 0, False: 0]
  |  Branch (3248:21): [True: 0, False: 0]
  ------------------
 3249|      0|	    es_putc (*p, listfp);
 3250|      0|	  else
 3251|      0|	    es_fprintf (listfp, "\\x%02x", *p);
 3252|      0|	}
 3253|      0|      es_fprintf (listfp, "\"\n");
 3254|      0|    }
 3255|  2.05k|  return 0;
 3256|  2.68k|}
parse-packet.c:parse_ring_trust:
 3265|  25.4k|{
 3266|  25.4k|  gpg_error_t err;
 3267|  25.4k|  iobuf_t inp = ctx->inp;
 3268|  25.4k|  PKT_ring_trust rt = {0};
 3269|  25.4k|  int c;
 3270|  25.4k|  int not_gpg = 0;
 3271|       |
 3272|  25.4k|  if (!pktlen)
  ------------------
  |  Branch (3272:7): [True: 4.29k, False: 21.1k]
  ------------------
 3273|  4.29k|    {
 3274|  4.29k|      if (list_mode)
  ------------------
  |  Branch (3274:11): [True: 0, False: 4.29k]
  ------------------
 3275|      0|	es_fprintf (listfp, ":trust packet: empty\n");
 3276|  4.29k|      err = 0;
 3277|  4.29k|      goto leave;
 3278|  4.29k|    }
 3279|       |
 3280|  21.1k|  c = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  21.1k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  21.1k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 21.1k]
  |  |  |  |  |  Branch (500:24): [True: 366, False: 20.7k]
  |  |  |  |  ------------------
  |  |  |  |  501|  21.1k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3281|  21.1k|  pktlen--;
 3282|  21.1k|  rt.trustval = c;
 3283|  21.1k|  if (pktlen)
  ------------------
  |  Branch (3283:7): [True: 19.6k, False: 1.49k]
  ------------------
 3284|  19.6k|    {
 3285|  19.6k|      if (!c)
  ------------------
  |  Branch (3285:11): [True: 5.38k, False: 14.2k]
  ------------------
 3286|  5.38k|        {
 3287|  5.38k|          c = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  5.38k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  5.38k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 5.38k]
  |  |  |  |  |  Branch (500:24): [True: 208, False: 5.18k]
  |  |  |  |  ------------------
  |  |  |  |  501|  5.38k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3288|       |          /* We require that bit 7 of the sigcache is 0 (easier
 3289|       |           * eof handling).  */
 3290|  5.38k|          if (!(c & 0x80))
  ------------------
  |  Branch (3290:15): [True: 3.86k, False: 1.52k]
  ------------------
 3291|  3.86k|            rt.sigcache = c;
 3292|  5.38k|        }
 3293|  14.2k|      else
 3294|  14.2k|        iobuf_get_noeof (inp);  /* Dummy read.  */
  ------------------
  |  |  502|  14.2k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  14.2k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 14.2k]
  |  |  |  |  |  Branch (500:24): [True: 477, False: 13.7k]
  |  |  |  |  ------------------
  |  |  |  |  501|  14.2k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3295|  19.6k|      pktlen--;
 3296|  19.6k|    }
 3297|       |
 3298|       |  /* Next is the optional subtype.  */
 3299|  21.1k|  if (pktlen > 3)
  ------------------
  |  Branch (3299:7): [True: 17.4k, False: 3.68k]
  ------------------
 3300|  17.4k|    {
 3301|  17.4k|      char tmp[4];
 3302|  17.4k|      tmp[0] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  17.4k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  17.4k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 17.4k]
  |  |  |  |  |  Branch (500:24): [True: 534, False: 16.9k]
  |  |  |  |  ------------------
  |  |  |  |  501|  17.4k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3303|  17.4k|      tmp[1] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  17.4k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  17.4k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 17.4k]
  |  |  |  |  |  Branch (500:24): [True: 546, False: 16.9k]
  |  |  |  |  ------------------
  |  |  |  |  501|  17.4k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3304|  17.4k|      tmp[2] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  17.4k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  17.4k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 17.4k]
  |  |  |  |  |  Branch (500:24): [True: 621, False: 16.8k]
  |  |  |  |  ------------------
  |  |  |  |  501|  17.4k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3305|  17.4k|      tmp[3] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  17.4k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  17.4k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 17.4k]
  |  |  |  |  |  Branch (500:24): [True: 3.36k, False: 14.1k]
  |  |  |  |  ------------------
  |  |  |  |  501|  17.4k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3306|  17.4k|      pktlen -= 4;
 3307|  17.4k|      if (!memcmp (tmp, "gpg", 3))
  ------------------
  |  Branch (3307:11): [True: 5.93k, False: 11.5k]
  ------------------
 3308|  5.93k|        rt.subtype = tmp[3];
 3309|  11.5k|      else
 3310|  11.5k|        not_gpg = 1;
 3311|  17.4k|    }
 3312|       |  /* If it is a key or uid subtype read the remaining data.  */
 3313|  21.1k|  if ((rt.subtype == RING_TRUST_KEY || rt.subtype == RING_TRUST_UID)
  ------------------
  |  |  517|  42.3k|#define RING_TRUST_KEY 1  /* A KEYORG on a primary key.      */
  ------------------
                if ((rt.subtype == RING_TRUST_KEY || rt.subtype == RING_TRUST_UID)
  ------------------
  |  |  518|  17.3k|#define RING_TRUST_UID 2  /* A KEYORG on a user id.          */
  ------------------
  |  Branch (3313:8): [True: 3.84k, False: 17.3k]
  |  Branch (3313:40): [True: 1.42k, False: 15.8k]
  ------------------
 3314|  21.1k|      && pktlen >= 6 )
  ------------------
  |  Branch (3314:10): [True: 3.59k, False: 1.67k]
  ------------------
 3315|  3.59k|    {
 3316|  3.59k|      int i;
 3317|  3.59k|      unsigned int namelen;
 3318|       |
 3319|  3.59k|      rt.keyorg = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  3.59k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  3.59k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 3.59k]
  |  |  |  |  |  Branch (500:24): [True: 331, False: 3.26k]
  |  |  |  |  ------------------
  |  |  |  |  501|  3.59k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3320|  3.59k|      pktlen--;
 3321|  3.59k|      rt.keyupdate = read_32 (inp);
 3322|  3.59k|      pktlen -= 4;
 3323|  3.59k|      namelen = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  3.59k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  3.59k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 3.59k]
  |  |  |  |  |  Branch (500:24): [True: 404, False: 3.18k]
  |  |  |  |  ------------------
  |  |  |  |  501|  3.59k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3324|  3.59k|      pktlen--;
 3325|  3.59k|      if (namelen && pktlen)
  ------------------
  |  Branch (3325:11): [True: 1.92k, False: 1.67k]
  |  Branch (3325:22): [True: 859, False: 1.06k]
  ------------------
 3326|    859|        {
 3327|    859|          rt.url = xtrymalloc (namelen + 1);
  ------------------
  |  |   97|    859|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
 3328|    859|          if (!rt.url)
  ------------------
  |  Branch (3328:15): [True: 0, False: 859]
  ------------------
 3329|      0|            {
 3330|      0|              err = gpg_error_from_syserror ();
 3331|      0|              goto leave;
 3332|      0|            }
 3333|  37.4k|          for (i = 0; pktlen && i < namelen; pktlen--, i++)
  ------------------
  |  Branch (3333:23): [True: 36.8k, False: 578]
  |  Branch (3333:33): [True: 36.6k, False: 281]
  ------------------
 3334|  36.6k|            rt.url[i] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  37.4k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  36.6k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 36.6k]
  |  |  |  |  |  Branch (500:24): [True: 16.1k, False: 20.4k]
  |  |  |  |  ------------------
  |  |  |  |  501|  36.6k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3335|    859|          rt.url[i] = 0;
 3336|    859|        }
 3337|  3.59k|    }
 3338|       |
 3339|  21.1k|  if (list_mode)
  ------------------
  |  Branch (3339:7): [True: 0, False: 21.1k]
  ------------------
 3340|      0|    {
 3341|      0|      if (rt.subtype == RING_TRUST_SIG)
  ------------------
  |  |  516|      0|#define RING_TRUST_SIG 0  /* The classical signature cache.  */
  ------------------
  |  Branch (3341:11): [True: 0, False: 0]
  ------------------
 3342|      0|        es_fprintf (listfp, ":trust packet: sig flag=%02x sigcache=%02x\n",
 3343|      0|                    rt.trustval, rt.sigcache);
 3344|      0|      else if (rt.subtype == RING_TRUST_UID || rt.subtype == RING_TRUST_KEY)
  ------------------
  |  |  518|      0|#define RING_TRUST_UID 2  /* A KEYORG on a user id.          */
  ------------------
                    else if (rt.subtype == RING_TRUST_UID || rt.subtype == RING_TRUST_KEY)
  ------------------
  |  |  517|      0|#define RING_TRUST_KEY 1  /* A KEYORG on a primary key.      */
  ------------------
  |  Branch (3344:16): [True: 0, False: 0]
  |  Branch (3344:48): [True: 0, False: 0]
  ------------------
 3345|      0|        {
 3346|      0|          unsigned char *p;
 3347|       |
 3348|      0|          es_fprintf (listfp, ":trust packet: %s upd=%lu src=%d%s",
 3349|      0|                      (rt.subtype == RING_TRUST_UID? "uid" : "key"),
  ------------------
  |  |  518|      0|#define RING_TRUST_UID 2  /* A KEYORG on a user id.          */
  ------------------
  |  Branch (3349:24): [True: 0, False: 0]
  ------------------
 3350|      0|                      (unsigned long)rt.keyupdate,
 3351|      0|                      rt.keyorg,
 3352|      0|                      (rt.url? " url=":""));
  ------------------
  |  Branch (3352:24): [True: 0, False: 0]
  ------------------
 3353|      0|          if (rt.url)
  ------------------
  |  Branch (3353:15): [True: 0, False: 0]
  ------------------
 3354|      0|            {
 3355|      0|              for (p = rt.url; *p; p++)
  ------------------
  |  Branch (3355:32): [True: 0, False: 0]
  ------------------
 3356|      0|                {
 3357|      0|                  if (*p >= ' ' && *p <= 'z')
  ------------------
  |  Branch (3357:23): [True: 0, False: 0]
  |  Branch (3357:36): [True: 0, False: 0]
  ------------------
 3358|      0|                    es_putc (*p, listfp);
 3359|      0|                  else
 3360|      0|                    es_fprintf (listfp, "\\x%02x", *p);
 3361|      0|                }
 3362|      0|            }
 3363|      0|          es_putc ('\n', listfp);
 3364|      0|        }
 3365|      0|      else if (not_gpg)
  ------------------
  |  Branch (3365:16): [True: 0, False: 0]
  ------------------
 3366|      0|        es_fprintf (listfp, ":trust packet: not created by gpg\n");
 3367|      0|      else
 3368|      0|        es_fprintf (listfp, ":trust packet: subtype=%02x\n",
 3369|      0|                    rt.subtype);
 3370|      0|    }
 3371|       |
 3372|       |  /* Now transfer the data to the respective packet.  Do not do this
 3373|       |   * if SKIP_META is set.  */
 3374|  21.1k|  if (!ctx->last_pkt.pkt.generic || ctx->skip_meta)
  ------------------
  |  Branch (3374:7): [True: 7.87k, False: 13.2k]
  |  Branch (3374:37): [True: 0, False: 13.2k]
  ------------------
 3375|  7.87k|    ;
 3376|  13.2k|  else if (rt.subtype == RING_TRUST_SIG
  ------------------
  |  |  516|  26.5k|#define RING_TRUST_SIG 0  /* The classical signature cache.  */
  ------------------
  |  Branch (3376:12): [True: 9.62k, False: 3.66k]
  ------------------
 3377|  13.2k|           && ctx->last_pkt.pkttype == PKT_SIGNATURE)
  ------------------
  |  Branch (3377:15): [True: 9.15k, False: 461]
  ------------------
 3378|  9.15k|    {
 3379|  9.15k|      PKT_signature *sig = ctx->last_pkt.pkt.signature;
 3380|       |
 3381|  9.15k|      if ((rt.sigcache & 1))
  ------------------
  |  Branch (3381:11): [True: 742, False: 8.41k]
  ------------------
 3382|    742|        {
 3383|    742|          sig->flags.checked = 1;
 3384|    742|          sig->flags.valid = !!(rt.sigcache & 2);
 3385|    742|        }
 3386|  9.15k|    }
 3387|  4.13k|  else if (rt.subtype == RING_TRUST_UID
  ------------------
  |  |  518|  8.26k|#define RING_TRUST_UID 2  /* A KEYORG on a user id.          */
  ------------------
  |  Branch (3387:12): [True: 1.07k, False: 3.05k]
  ------------------
 3388|  4.13k|           && (ctx->last_pkt.pkttype == PKT_USER_ID
  ------------------
  |  Branch (3388:16): [True: 0, False: 1.07k]
  ------------------
 3389|  1.07k|               || ctx->last_pkt.pkttype == PKT_ATTRIBUTE))
  ------------------
  |  Branch (3389:19): [True: 0, False: 1.07k]
  ------------------
 3390|      0|    {
 3391|      0|      PKT_user_id *uid = ctx->last_pkt.pkt.user_id;
 3392|       |
 3393|      0|      uid->keyorg = rt.keyorg;
 3394|      0|      uid->keyupdate = rt.keyupdate;
 3395|      0|      uid->updateurl = rt.url;
 3396|      0|      rt.url = NULL;
 3397|      0|    }
 3398|  4.13k|  else if (rt.subtype == RING_TRUST_KEY
  ------------------
  |  |  517|  8.26k|#define RING_TRUST_KEY 1  /* A KEYORG on a primary key.      */
  ------------------
  |  Branch (3398:12): [True: 2.54k, False: 1.59k]
  ------------------
 3399|  4.13k|           && (ctx->last_pkt.pkttype == PKT_PUBLIC_KEY
  ------------------
  |  Branch (3399:16): [True: 0, False: 2.54k]
  ------------------
 3400|  2.54k|               || ctx->last_pkt.pkttype == PKT_SECRET_KEY))
  ------------------
  |  Branch (3400:19): [True: 0, False: 2.54k]
  ------------------
 3401|      0|    {
 3402|      0|      PKT_public_key *pk = ctx->last_pkt.pkt.public_key;
 3403|       |
 3404|      0|      pk->keyorg = rt.keyorg;
 3405|      0|      pk->keyupdate = rt.keyupdate;
 3406|      0|      pk->updateurl = rt.url;
 3407|      0|      rt.url = NULL;
 3408|      0|    }
 3409|       |
 3410|  21.1k|  err = 0;
 3411|       |
 3412|  25.4k| leave:
 3413|  25.4k|  xfree (rt.url);
  ------------------
  |  |  104|  25.4k|#define xfree(a)         gcry_free ((a))
  ------------------
 3414|  25.4k|  free_packet (NULL, ctx); /* This sets ctx->last_pkt to NULL.  */
 3415|  25.4k|  iobuf_skip_rest (inp, pktlen, 0);
 3416|  25.4k|  return err;
 3417|  21.1k|}
parse-packet.c:parse_plaintext:
 3423|  70.0k|{
 3424|  70.0k|  int rc = 0;
 3425|  70.0k|  int mode, namelen;
 3426|  70.0k|  PKT_plaintext *pt;
 3427|  70.0k|  byte *p;
 3428|  70.0k|  int c, i;
 3429|       |
 3430|  70.0k|  if (!partial && pktlen < 6)
  ------------------
  |  Branch (3430:7): [True: 53.6k, False: 16.4k]
  |  Branch (3430:19): [True: 714, False: 52.9k]
  ------------------
 3431|    714|    {
 3432|    714|      log_error ("packet(%d) too short (%lu)\n", pkttype, (ulong) pktlen);
 3433|    714|      if (list_mode)
  ------------------
  |  Branch (3433:11): [True: 0, False: 714]
  ------------------
 3434|      0|        es_fputs (":literal data packet: [too short]\n", listfp);
 3435|    714|      rc = gpg_error (GPG_ERR_INV_PACKET);
 3436|    714|      goto leave;
 3437|    714|    }
 3438|  69.3k|  mode = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  69.3k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  69.3k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 69.3k]
  |  |  |  |  |  Branch (500:24): [True: 16.2k, False: 53.1k]
  |  |  |  |  ------------------
  |  |  |  |  501|  69.3k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3439|  69.3k|  if (pktlen)
  ------------------
  |  Branch (3439:7): [True: 52.9k, False: 16.4k]
  ------------------
 3440|  52.9k|    pktlen--;
 3441|  69.3k|  namelen = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  69.3k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  69.3k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 69.3k]
  |  |  |  |  |  Branch (500:24): [True: 2.54k, False: 66.8k]
  |  |  |  |  ------------------
  |  |  |  |  501|  69.3k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3442|  69.3k|  if (pktlen)
  ------------------
  |  Branch (3442:7): [True: 52.9k, False: 16.4k]
  ------------------
 3443|  52.9k|    pktlen--;
 3444|       |  /* Note that namelen will never exceed 255 bytes. */
 3445|  69.3k|  pt = pkt->pkt.plaintext =
 3446|  69.3k|    xmalloc (sizeof *pkt->pkt.plaintext + namelen - 1);
  ------------------
  |  |  107|  69.3k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 3447|  69.3k|  pt->new_ctb = new_ctb;
 3448|  69.3k|  pt->mode = mode;
 3449|  69.3k|  pt->namelen = namelen;
 3450|  69.3k|  pt->is_partial = partial;
 3451|  69.3k|  if (pktlen)
  ------------------
  |  Branch (3451:7): [True: 52.9k, False: 16.4k]
  ------------------
 3452|  52.9k|    {
 3453|   228k|      for (i = 0; pktlen > 4 && i < namelen; pktlen--, i++)
  ------------------
  |  Branch (3453:19): [True: 197k, False: 30.9k]
  |  Branch (3453:33): [True: 175k, False: 21.9k]
  ------------------
 3454|   175k|	pt->name[i] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|   175k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   175k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 175k]
  |  |  |  |  |  Branch (500:24): [True: 129k, False: 46.4k]
  |  |  |  |  ------------------
  |  |  |  |  501|   175k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3455|  52.9k|    }
 3456|  16.4k|  else
 3457|  16.4k|    {
 3458|  65.4k|      for (i = 0; i < namelen; i++)
  ------------------
  |  Branch (3458:19): [True: 52.2k, False: 13.2k]
  ------------------
 3459|  52.2k|	if ((c = iobuf_get (inp)) == -1)
  ------------------
  |  |  500|  52.2k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 52.2k]
  |  |  |  Branch (500:24): [True: 3.30k, False: 48.9k]
  |  |  ------------------
  |  |  501|  52.2k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (3459:6): [True: 3.22k, False: 49.0k]
  ------------------
 3460|  3.22k|	  break;
 3461|  49.0k|	else
 3462|  49.0k|	  pt->name[i] = c;
 3463|  16.4k|    }
 3464|       |  /* Fill up NAME so that a check with valgrind won't complain about
 3465|       |   * reading from uninitialized memory.  This case may be triggred by
 3466|       |   * corrupted packets.  */
 3467|  1.73M|  for (; i < namelen; i++)
  ------------------
  |  Branch (3467:10): [True: 1.66M, False: 69.3k]
  ------------------
 3468|  1.66M|    pt->name[i] = 0;
 3469|       |
 3470|  69.3k|  pt->timestamp = read_32 (inp);
 3471|  69.3k|  if (pktlen)
  ------------------
  |  Branch (3471:7): [True: 52.9k, False: 16.4k]
  ------------------
 3472|  52.9k|    pktlen -= 4;
 3473|  69.3k|  pt->len = pktlen;
 3474|  69.3k|  pt->buf = inp;
 3475|       |
 3476|  69.3k|  if (list_mode)
  ------------------
  |  Branch (3476:7): [True: 0, False: 69.3k]
  ------------------
 3477|      0|    {
 3478|      0|      es_fprintf (listfp, ":literal data packet:\n"
 3479|      0|                  "\tmode %c (%X), created %lu, name=\"",
 3480|      0|                  mode >= ' ' && mode < 'z' ? mode : '?', mode,
  ------------------
  |  Branch (3480:19): [True: 0, False: 0]
  |  Branch (3480:34): [True: 0, False: 0]
  ------------------
 3481|      0|                  (ulong) pt->timestamp);
 3482|      0|      for (p = pt->name, i = 0; i < namelen; p++, i++)
  ------------------
  |  Branch (3482:33): [True: 0, False: 0]
  ------------------
 3483|      0|	{
 3484|      0|	  if (*p >= ' ' && *p <= 'z')
  ------------------
  |  Branch (3484:8): [True: 0, False: 0]
  |  Branch (3484:21): [True: 0, False: 0]
  ------------------
 3485|      0|	    es_putc (*p, listfp);
 3486|      0|	  else
 3487|      0|	    es_fprintf (listfp, "\\x%02x", *p);
 3488|      0|	}
 3489|      0|      es_fprintf (listfp, "\",\n\traw data: ");
 3490|      0|      if (partial)
  ------------------
  |  Branch (3490:11): [True: 0, False: 0]
  ------------------
 3491|      0|	es_fprintf (listfp, "unknown length\n");
 3492|      0|      else
 3493|      0|	es_fprintf (listfp, "%lu bytes\n", (ulong) pt->len);
 3494|      0|    }
 3495|       |
 3496|  70.0k| leave:
 3497|  70.0k|  return rc;
 3498|  69.3k|}
parse-packet.c:parse_compressed:
 3504|   264k|{
 3505|   264k|  PKT_compressed *zd;
 3506|       |
 3507|       |  /* PKTLEN is here 0, but data follows (this should be the last
 3508|       |     object in a file or the compress algorithm should know the
 3509|       |     length).  */
 3510|   264k|  (void) pkttype;
 3511|   264k|  (void) pktlen;
 3512|       |
 3513|   264k|  zd = pkt->pkt.compressed = xmalloc (sizeof *pkt->pkt.compressed);
  ------------------
  |  |  107|   264k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 3514|   264k|  zd->algorithm = iobuf_get_noeof (inp);
  ------------------
  |  |  502|   264k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   264k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 264k]
  |  |  |  |  |  Branch (500:24): [True: 49.2k, False: 214k]
  |  |  |  |  ------------------
  |  |  |  |  501|   264k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3515|   264k|  zd->len = 0;			/* not used */
 3516|   264k|  zd->new_ctb = new_ctb;
 3517|   264k|  zd->buf = inp;
 3518|   264k|  if (list_mode)
  ------------------
  |  Branch (3518:7): [True: 0, False: 264k]
  ------------------
 3519|      0|    es_fprintf (listfp, ":compressed packet: algo=%d\n", zd->algorithm);
 3520|   264k|  return 0;
 3521|   264k|}
parse-packet.c:parse_encrypted:
 3527|  3.93k|{
 3528|  3.93k|  int rc = 0;
 3529|  3.93k|  PKT_encrypted *ed;
 3530|  3.93k|  unsigned long orig_pktlen = pktlen;
 3531|       |
 3532|  3.93k|  ed = pkt->pkt.encrypted = xmalloc (sizeof *pkt->pkt.encrypted);
  ------------------
  |  |  107|  3.93k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 3533|       |  /* ed->len is set below.  */
 3534|  3.93k|  ed->extralen = 0;  /* Unknown here; only used in build_packet.  */
 3535|  3.93k|  ed->buf = NULL;
 3536|  3.93k|  ed->new_ctb = new_ctb;
 3537|  3.93k|  ed->is_partial = partial;
 3538|  3.93k|  ed->aead_algo = 0;
 3539|  3.93k|  ed->cipher_algo = 0; /* Only used with AEAD.  */
 3540|  3.93k|  ed->chunkbyte = 0;   /* Only used with AEAD.  */
 3541|  3.93k|  if (pkttype == PKT_ENCRYPTED_MDC)
  ------------------
  |  Branch (3541:7): [True: 2.47k, False: 1.45k]
  ------------------
 3542|  2.47k|    {
 3543|       |      /* Fixme: add some pktlen sanity checks.  */
 3544|  2.47k|      int version;
 3545|       |
 3546|  2.47k|      version = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  2.47k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  2.47k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 2.47k]
  |  |  |  |  |  Branch (500:24): [True: 1.69k, False: 783]
  |  |  |  |  ------------------
  |  |  |  |  501|  2.47k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3547|  2.47k|      if (orig_pktlen)
  ------------------
  |  Branch (3547:11): [True: 839, False: 1.63k]
  ------------------
 3548|    839|	pktlen--;
 3549|  2.47k|      if (version != 1)
  ------------------
  |  Branch (3549:11): [True: 2.11k, False: 361]
  ------------------
 3550|  2.11k|	{
 3551|  2.11k|	  log_error ("encrypted_mdc packet with unknown version %d\n",
 3552|  2.11k|		     version);
 3553|  2.11k|          if (list_mode)
  ------------------
  |  Branch (3553:15): [True: 0, False: 2.11k]
  ------------------
 3554|      0|            es_fputs (":encrypted data packet: [unknown version]\n", listfp);
 3555|       |	  /*skip_rest(inp, pktlen); should we really do this? */
 3556|  2.11k|	  rc = gpg_error (GPG_ERR_INV_PACKET);
 3557|  2.11k|	  goto leave;
 3558|  2.11k|	}
 3559|    361|      ed->mdc_method = DIGEST_ALGO_SHA1;
 3560|    361|    }
 3561|  1.45k|  else
 3562|  1.45k|    ed->mdc_method = 0;
 3563|       |
 3564|       |  /* A basic sanity check.  We need at least an 8 byte IV plus the 2
 3565|       |     detection bytes.  Note that we don't known the algorithm and thus
 3566|       |     we may only check against the minimum blocksize.  */
 3567|  1.81k|  if (orig_pktlen && pktlen < 10)
  ------------------
  |  Branch (3567:7): [True: 886, False: 931]
  |  Branch (3567:22): [True: 396, False: 490]
  ------------------
 3568|    396|    {
 3569|       |      /* Actually this is blocksize+2.  */
 3570|    396|      log_error ("packet(%d) too short\n", pkttype);
 3571|    396|      if (list_mode)
  ------------------
  |  Branch (3571:11): [True: 0, False: 396]
  ------------------
 3572|      0|        es_fputs (":encrypted data packet: [too short]\n", listfp);
 3573|    396|      rc = GPG_ERR_INV_PACKET;
 3574|    396|      iobuf_skip_rest (inp, pktlen, partial);
 3575|    396|      goto leave;
 3576|    396|    }
 3577|       |
 3578|       |  /* Store the remaining length of the encrypted data (i.e. without
 3579|       |     the MDC version number but with the IV etc.).  This value is
 3580|       |     required during decryption.  */
 3581|  1.42k|  ed->len = pktlen;
 3582|       |
 3583|  1.42k|  if (list_mode)
  ------------------
  |  Branch (3583:7): [True: 0, False: 1.42k]
  ------------------
 3584|      0|    {
 3585|      0|      if (orig_pktlen)
  ------------------
  |  Branch (3585:11): [True: 0, False: 0]
  ------------------
 3586|      0|	es_fprintf (listfp, ":encrypted data packet:\n\tlength: %lu\n",
 3587|      0|                    orig_pktlen);
 3588|      0|      else
 3589|      0|	es_fprintf (listfp, ":encrypted data packet:\n\tlength: unknown\n");
 3590|      0|      if (ed->mdc_method)
  ------------------
  |  Branch (3590:11): [True: 0, False: 0]
  ------------------
 3591|      0|	es_fprintf (listfp, "\tmdc_method: %d\n", ed->mdc_method);
 3592|      0|    }
 3593|       |
 3594|  1.42k|  ed->buf = inp;
 3595|       |
 3596|  3.93k| leave:
 3597|  3.93k|  return rc;
 3598|  1.42k|}
parse-packet.c:parse_mdc:
 3607|  6.45k|{
 3608|  6.45k|  int rc = 0;
 3609|  6.45k|  PKT_mdc *mdc;
 3610|  6.45k|  byte *p;
 3611|       |
 3612|  6.45k|  (void) pkttype;
 3613|       |
 3614|  6.45k|  mdc = pkt->pkt.mdc = xmalloc (sizeof *pkt->pkt.mdc);
  ------------------
  |  |  107|  6.45k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 3615|  6.45k|  if (list_mode)
  ------------------
  |  Branch (3615:7): [True: 0, False: 6.45k]
  ------------------
 3616|      0|    es_fprintf (listfp, ":mdc packet: length=%lu\n", pktlen);
 3617|  6.45k|  if (!new_ctb || pktlen != 20)
  ------------------
  |  Branch (3617:7): [True: 0, False: 6.45k]
  |  Branch (3617:19): [True: 2.30k, False: 4.14k]
  ------------------
 3618|  2.30k|    {
 3619|  2.30k|      log_error ("mdc_packet with invalid encoding\n");
 3620|  2.30k|      rc = gpg_error (GPG_ERR_INV_PACKET);
 3621|  2.30k|      goto leave;
 3622|  2.30k|    }
 3623|  4.14k|  p = mdc->hash;
 3624|  87.0k|  for (; pktlen; pktlen--, p++)
  ------------------
  |  Branch (3624:10): [True: 82.9k, False: 4.14k]
  ------------------
 3625|  82.9k|    *p = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  87.0k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  82.9k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 82.9k]
  |  |  |  |  |  Branch (500:24): [True: 1.55k, False: 81.3k]
  |  |  |  |  ------------------
  |  |  |  |  501|  82.9k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3626|       |
 3627|  6.45k| leave:
 3628|  6.45k|  return rc;
 3629|  4.14k|}
parse-packet.c:parse_encrypted_aead:
 3635|  4.40k|{
 3636|  4.40k|  int rc = 0;
 3637|  4.40k|  PKT_encrypted *ed;
 3638|  4.40k|  unsigned long orig_pktlen = pktlen;
 3639|  4.40k|  int version;
 3640|       |
 3641|  4.40k|  ed = pkt->pkt.encrypted = xtrymalloc (sizeof *pkt->pkt.encrypted);
  ------------------
  |  |   97|  4.40k|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
 3642|  4.40k|  if (!ed)
  ------------------
  |  Branch (3642:7): [True: 0, False: 4.40k]
  ------------------
 3643|      0|    return gpg_error_from_syserror ();
 3644|  4.40k|  ed->len = 0;
 3645|  4.40k|  ed->extralen = 0;  /* (only used in build_packet.)  */
 3646|  4.40k|  ed->buf = NULL;
 3647|  4.40k|  ed->new_ctb = 1;   /* (packet number requires a new CTB anyway.)  */
 3648|  4.40k|  ed->is_partial = partial;
 3649|  4.40k|  ed->mdc_method = 0;
 3650|       |  /* A basic sanity check.  We need one version byte, one algo byte,
 3651|       |   * one aead algo byte, one chunkbyte, at least 15 byte IV.  */
 3652|  4.40k|  if (orig_pktlen && pktlen < 19)
  ------------------
  |  Branch (3652:7): [True: 838, False: 3.57k]
  |  Branch (3652:22): [True: 375, False: 463]
  ------------------
 3653|    375|    {
 3654|    375|      log_error ("packet(%d) too short\n", pkttype);
 3655|    375|      if (list_mode)
  ------------------
  |  Branch (3655:11): [True: 0, False: 375]
  ------------------
 3656|      0|        es_fputs (":aead encrypted packet: [too short]\n", listfp);
 3657|    375|      rc = gpg_error (GPG_ERR_INV_PACKET);
 3658|    375|      iobuf_skip_rest (inp, pktlen, partial);
 3659|    375|      goto leave;
 3660|    375|    }
 3661|       |
 3662|  4.03k|  version = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  4.03k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  4.03k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 4.03k]
  |  |  |  |  |  Branch (500:24): [True: 2.70k, False: 1.33k]
  |  |  |  |  ------------------
  |  |  |  |  501|  4.03k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3663|  4.03k|  if (orig_pktlen)
  ------------------
  |  Branch (3663:7): [True: 463, False: 3.57k]
  ------------------
 3664|    463|    pktlen--;
 3665|  4.03k|  if (version != 1)
  ------------------
  |  Branch (3665:7): [True: 3.06k, False: 965]
  ------------------
 3666|  3.06k|    {
 3667|  3.06k|      log_error ("aead encrypted packet with unknown version %d\n",
 3668|  3.06k|                 version);
 3669|  3.06k|      if (list_mode)
  ------------------
  |  Branch (3669:11): [True: 0, False: 3.06k]
  ------------------
 3670|      0|        es_fputs (":aead encrypted packet: [unknown version]\n", listfp);
 3671|       |      /*skip_rest(inp, pktlen); should we really do this? */
 3672|  3.06k|      rc = gpg_error (GPG_ERR_INV_PACKET);
 3673|  3.06k|      goto leave;
 3674|  3.06k|    }
 3675|       |
 3676|    965|  ed->cipher_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|    965|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|    965|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 965]
  |  |  |  |  |  Branch (500:24): [True: 6, False: 959]
  |  |  |  |  ------------------
  |  |  |  |  501|    965|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3677|    965|  if (orig_pktlen)
  ------------------
  |  Branch (3677:7): [True: 56, False: 909]
  ------------------
 3678|     56|    pktlen--;
 3679|    965|  ed->aead_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|    965|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|    965|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 965]
  |  |  |  |  |  Branch (500:24): [True: 41, False: 924]
  |  |  |  |  ------------------
  |  |  |  |  501|    965|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3680|    965|  if (orig_pktlen)
  ------------------
  |  Branch (3680:7): [True: 56, False: 909]
  ------------------
 3681|     56|    pktlen--;
 3682|    965|  ed->chunkbyte = iobuf_get_noeof (inp);
  ------------------
  |  |  502|    965|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|    965|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 965]
  |  |  |  |  |  Branch (500:24): [True: 48, False: 917]
  |  |  |  |  ------------------
  |  |  |  |  501|    965|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3683|    965|  if (orig_pktlen)
  ------------------
  |  Branch (3683:7): [True: 56, False: 909]
  ------------------
 3684|     56|    pktlen--;
 3685|       |
 3686|       |  /* Store the remaining length of the encrypted data.  We read the
 3687|       |   * rest during decryption.  */
 3688|    965|  ed->len = pktlen;
 3689|       |
 3690|    965|  if (list_mode)
  ------------------
  |  Branch (3690:7): [True: 0, False: 965]
  ------------------
 3691|      0|    {
 3692|      0|      es_fprintf (listfp, ":aead encrypted packet: cipher=%u aead=%u cb=%u\n",
 3693|      0|                  ed->cipher_algo, ed->aead_algo, ed->chunkbyte);
 3694|      0|      if (orig_pktlen)
  ------------------
  |  Branch (3694:11): [True: 0, False: 0]
  ------------------
 3695|      0|	es_fprintf (listfp, "\tlength: %lu\n", orig_pktlen);
 3696|      0|      else
 3697|      0|	es_fprintf (listfp, "\tlength: unknown\n");
 3698|      0|    }
 3699|       |
 3700|    965|  ed->buf = inp;
 3701|       |
 3702|  4.40k| leave:
 3703|  4.40k|  return rc;
 3704|    965|}
parse-packet.c:parse_gpg_control:
 3721|  16.9k|{
 3722|  16.9k|  byte *p;
 3723|  16.9k|  const byte *sesmark;
 3724|  16.9k|  size_t sesmarklen;
 3725|  16.9k|  int i;
 3726|       |
 3727|  16.9k|  (void) pkttype;
 3728|       |
 3729|  16.9k|  if (list_mode)
  ------------------
  |  Branch (3729:7): [True: 0, False: 16.9k]
  ------------------
 3730|      0|    es_fprintf (listfp, ":packet 63: length %lu ", pktlen);
 3731|       |
 3732|  16.9k|  sesmark = get_session_marker (&sesmarklen);
 3733|  16.9k|  if (pktlen < sesmarklen + 1)	/* 1 is for the control bytes */
  ------------------
  |  Branch (3733:7): [True: 6.57k, False: 10.3k]
  ------------------
 3734|  6.57k|    goto skipit;
 3735|   150k|  for (i = 0; i < sesmarklen; i++, pktlen--)
  ------------------
  |  Branch (3735:15): [True: 142k, False: 8.77k]
  ------------------
 3736|   142k|    {
 3737|   142k|      if (sesmark[i] != iobuf_get_noeof (inp))
  ------------------
  |  |  502|   142k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   142k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 142k]
  |  |  |  |  |  Branch (500:24): [True: 480, False: 141k]
  |  |  |  |  ------------------
  |  |  |  |  501|   142k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
  |  Branch (3737:11): [True: 1.61k, False: 140k]
  ------------------
 3738|  1.61k|	goto skipit;
 3739|   142k|    }
 3740|  8.77k|  if (pktlen > 4096)
  ------------------
  |  Branch (3740:7): [True: 199, False: 8.58k]
  ------------------
 3741|    199|    goto skipit;  /* Definitely too large.  We skip it to avoid an
 3742|       |                     overflow in the malloc.  */
 3743|  8.58k|  if (list_mode)
  ------------------
  |  Branch (3743:7): [True: 0, False: 8.58k]
  ------------------
 3744|      0|    es_fputs ("- gpg control packet", listfp);
 3745|       |
 3746|  8.58k|  packet->pkt.gpg_control = xmalloc (sizeof *packet->pkt.gpg_control
  ------------------
  |  |  107|  8.58k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 3747|  8.58k|				     + pktlen - 1);
 3748|  8.58k|  packet->pkt.gpg_control->control = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  8.58k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  8.58k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 8.58k]
  |  |  |  |  |  Branch (500:24): [True: 569, False: 8.01k]
  |  |  |  |  ------------------
  |  |  |  |  501|  8.58k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3749|  8.58k|  pktlen--;
 3750|  8.58k|  packet->pkt.gpg_control->datalen = pktlen;
 3751|  8.58k|  p = packet->pkt.gpg_control->data;
 3752|  26.4k|  for (; pktlen; pktlen--, p++)
  ------------------
  |  Branch (3752:10): [True: 17.8k, False: 8.58k]
  ------------------
 3753|  17.8k|    *p = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  26.4k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  17.8k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 17.8k]
  |  |  |  |  |  Branch (500:24): [True: 268, False: 17.6k]
  |  |  |  |  ------------------
  |  |  |  |  501|  17.8k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3754|       |
 3755|  8.58k|  return 0;
 3756|       |
 3757|  8.39k| skipit:
 3758|  8.39k|  if (list_mode)
  ------------------
  |  Branch (3758:7): [True: 0, False: 8.39k]
  ------------------
 3759|      0|    {
 3760|      0|      int c;
 3761|       |
 3762|      0|      i = 0;
 3763|      0|      es_fprintf (listfp, "- private (rest length %lu)\n", pktlen);
 3764|      0|      if (partial)
  ------------------
  |  Branch (3764:11): [True: 0, False: 0]
  ------------------
 3765|      0|	{
 3766|      0|	  while ((c = iobuf_get (inp)) != -1)
  ------------------
  |  |  500|      0|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 0]
  |  |  |  Branch (500:24): [True: 0, False: 0]
  |  |  ------------------
  |  |  501|      0|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (3766:11): [True: 0, False: 0]
  ------------------
 3767|      0|	    dump_hex_line (c, &i);
 3768|      0|	}
 3769|      0|      else
 3770|      0|	{
 3771|      0|	  for (; pktlen; pktlen--)
  ------------------
  |  Branch (3771:11): [True: 0, False: 0]
  ------------------
 3772|      0|	    {
 3773|      0|	      dump_hex_line ((c = iobuf_get (inp)), &i);
  ------------------
  |  |  500|      0|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 0]
  |  |  |  Branch (500:24): [True: 0, False: 0]
  |  |  ------------------
  |  |  501|      0|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
 3774|      0|	      if (c == -1)
  ------------------
  |  Branch (3774:12): [True: 0, False: 0]
  ------------------
 3775|      0|		break;
 3776|      0|	    }
 3777|      0|	}
 3778|      0|      es_putc ('\n', listfp);
 3779|      0|    }
 3780|  8.39k|  iobuf_skip_rest (inp, pktlen, 0);
 3781|  8.39k|  return gpg_error (GPG_ERR_INV_PACKET);
 3782|  8.77k|}
parse-packet.c:parse_marker:
 1166|  13.2k|{
 1167|  13.2k|  (void) pkttype;
 1168|       |
 1169|  13.2k|  if (pktlen != 3)
  ------------------
  |  Branch (1169:7): [True: 549, False: 12.7k]
  ------------------
 1170|    549|    goto fail;
 1171|       |
 1172|  12.7k|  if (iobuf_get (inp) != 'P')
  ------------------
  |  |  500|  12.7k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 12.7k]
  |  |  |  Branch (500:24): [True: 282, False: 12.4k]
  |  |  ------------------
  |  |  501|  12.7k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (1172:7): [True: 643, False: 12.1k]
  ------------------
 1173|    643|    {
 1174|    643|      pktlen--;
 1175|    643|      goto fail;
 1176|    643|    }
 1177|       |
 1178|  12.1k|  if (iobuf_get (inp) != 'G')
  ------------------
  |  |  500|  12.1k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 12.1k]
  |  |  |  Branch (500:24): [True: 362, False: 11.7k]
  |  |  ------------------
  |  |  501|  12.1k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (1178:7): [True: 560, False: 11.5k]
  ------------------
 1179|    560|    {
 1180|    560|      pktlen--;
 1181|    560|      goto fail;
 1182|    560|    }
 1183|       |
 1184|  11.5k|  if (iobuf_get (inp) != 'P')
  ------------------
  |  |  500|  11.5k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 11.5k]
  |  |  |  Branch (500:24): [True: 113, False: 11.4k]
  |  |  ------------------
  |  |  501|  11.5k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (1184:7): [True: 198, False: 11.3k]
  ------------------
 1185|    198|    {
 1186|    198|      pktlen--;
 1187|    198|      goto fail;
 1188|    198|    }
 1189|       |
 1190|  11.3k|  if (list_mode)
  ------------------
  |  Branch (1190:7): [True: 0, False: 11.3k]
  ------------------
 1191|      0|    es_fputs (":marker packet: PGP\n", listfp);
 1192|       |
 1193|  11.3k|  return 0;
 1194|       |
 1195|  1.95k| fail:
 1196|  1.95k|  log_error ("invalid marker packet\n");
 1197|  1.95k|  if (list_mode)
  ------------------
  |  Branch (1197:7): [True: 0, False: 1.95k]
  ------------------
 1198|      0|    es_fputs (":marker packet: [invalid]\n", listfp);
 1199|  1.95k|  iobuf_skip_rest (inp, pktlen, 0);
 1200|  1.95k|  return GPG_ERR_INV_PACKET;
 1201|  11.5k|}
parse-packet.c:skip_packet:
 1045|  22.6k|{
 1046|  22.6k|  if (list_mode)
  ------------------
  |  Branch (1046:7): [True: 0, False: 22.6k]
  ------------------
 1047|      0|    {
 1048|      0|      es_fprintf (listfp, ":unknown packet: type %2d, length %lu\n",
 1049|      0|                  pkttype, pktlen);
 1050|      0|      if (pkttype)
  ------------------
  |  Branch (1050:11): [True: 0, False: 0]
  ------------------
 1051|      0|	{
 1052|      0|	  int c, i = 0;
 1053|      0|	  es_fputs ("dump:", listfp);
 1054|      0|	  if (partial)
  ------------------
  |  Branch (1054:8): [True: 0, False: 0]
  ------------------
 1055|      0|	    {
 1056|      0|	      while ((c = iobuf_get (inp)) != -1)
  ------------------
  |  |  500|      0|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 0]
  |  |  |  Branch (500:24): [True: 0, False: 0]
  |  |  ------------------
  |  |  501|      0|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (1056:15): [True: 0, False: 0]
  ------------------
 1057|      0|		dump_hex_line (c, &i);
 1058|      0|	    }
 1059|      0|	  else
 1060|      0|	    {
 1061|      0|	      for (; pktlen; pktlen--)
  ------------------
  |  Branch (1061:15): [True: 0, False: 0]
  ------------------
 1062|      0|		{
 1063|      0|		  dump_hex_line ((c = iobuf_get (inp)), &i);
  ------------------
  |  |  500|      0|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 0]
  |  |  |  Branch (500:24): [True: 0, False: 0]
  |  |  ------------------
  |  |  501|      0|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
 1064|      0|		  if (c == -1)
  ------------------
  |  Branch (1064:9): [True: 0, False: 0]
  ------------------
 1065|      0|		    break;
 1066|      0|		}
 1067|      0|	    }
 1068|      0|	  es_putc ('\n', listfp);
 1069|      0|	  return;
 1070|      0|	}
 1071|      0|    }
 1072|  22.6k|  iobuf_skip_rest (inp, pktlen, partial);
 1073|  22.6k|}
parse-packet.c:can_handle_critical:
 1834|  38.1k|{
 1835|  38.1k|  switch (type)
 1836|  38.1k|    {
 1837|  2.73k|    case SIGSUBPKT_NOTATION:
  ------------------
  |  Branch (1837:5): [True: 2.73k, False: 35.4k]
  ------------------
 1838|  2.73k|      if (n >= 8)
  ------------------
  |  Branch (1838:11): [True: 2.48k, False: 250]
  ------------------
 1839|  2.48k|	{
 1840|  2.48k|	  size_t notation_len = ((buffer[4] << 8) | buffer[5]);
 1841|  2.48k|	  if (n - 8 >= notation_len)
  ------------------
  |  Branch (1841:8): [True: 2.30k, False: 188]
  ------------------
 1842|  2.30k|	    return can_handle_critical_notation (buffer + 8, notation_len);
 1843|  2.48k|	}
 1844|    438|      return 0;
 1845|    812|    case SIGSUBPKT_SIGNATURE:
  ------------------
  |  Branch (1845:5): [True: 812, False: 37.3k]
  ------------------
 1846|  1.39k|    case SIGSUBPKT_SIG_CREATED:
  ------------------
  |  Branch (1846:5): [True: 587, False: 37.6k]
  ------------------
 1847|  3.29k|    case SIGSUBPKT_SIG_EXPIRE:
  ------------------
  |  Branch (1847:5): [True: 1.89k, False: 36.3k]
  ------------------
 1848|  3.70k|    case SIGSUBPKT_KEY_EXPIRE:
  ------------------
  |  Branch (1848:5): [True: 411, False: 37.7k]
  ------------------
 1849|  4.32k|    case SIGSUBPKT_EXPORTABLE:
  ------------------
  |  Branch (1849:5): [True: 622, False: 37.5k]
  ------------------
 1850|  5.10k|    case SIGSUBPKT_REVOCABLE:
  ------------------
  |  Branch (1850:5): [True: 777, False: 37.4k]
  ------------------
 1851|  5.85k|    case SIGSUBPKT_REV_KEY:
  ------------------
  |  Branch (1851:5): [True: 754, False: 37.4k]
  ------------------
 1852|  6.73k|    case SIGSUBPKT_ISSUER:	/* issuer key ID */
  ------------------
  |  Branch (1852:5): [True: 885, False: 37.3k]
  ------------------
 1853|  10.2k|    case SIGSUBPKT_ISSUER_FPR:	/* issuer fingerprint */
  ------------------
  |  Branch (1853:5): [True: 3.51k, False: 34.6k]
  ------------------
 1854|  10.6k|    case SIGSUBPKT_PREF_SYM:
  ------------------
  |  Branch (1854:5): [True: 428, False: 37.7k]
  ------------------
 1855|  11.6k|    case SIGSUBPKT_PREF_AEAD:
  ------------------
  |  Branch (1855:5): [True: 929, False: 37.2k]
  ------------------
 1856|  11.9k|    case SIGSUBPKT_PREF_HASH:
  ------------------
  |  Branch (1856:5): [True: 378, False: 37.8k]
  ------------------
 1857|  12.1k|    case SIGSUBPKT_PREF_COMPR:
  ------------------
  |  Branch (1857:5): [True: 132, False: 38.0k]
  ------------------
 1858|  14.2k|    case SIGSUBPKT_KEY_FLAGS:
  ------------------
  |  Branch (1858:5): [True: 2.14k, False: 36.0k]
  ------------------
 1859|  14.7k|    case SIGSUBPKT_PRIMARY_UID:
  ------------------
  |  Branch (1859:5): [True: 455, False: 37.7k]
  ------------------
 1860|  15.1k|    case SIGSUBPKT_FEATURES:
  ------------------
  |  Branch (1860:5): [True: 394, False: 37.8k]
  ------------------
 1861|  15.9k|    case SIGSUBPKT_TRUST:
  ------------------
  |  Branch (1861:5): [True: 788, False: 37.4k]
  ------------------
 1862|  17.3k|    case SIGSUBPKT_REGEXP:
  ------------------
  |  Branch (1862:5): [True: 1.43k, False: 36.7k]
  ------------------
 1863|  17.6k|    case SIGSUBPKT_ATTST_SIGS:
  ------------------
  |  Branch (1863:5): [True: 322, False: 37.8k]
  ------------------
 1864|       |      /* Is it enough to show the policy or keyserver? */
 1865|  18.6k|    case SIGSUBPKT_POLICY:
  ------------------
  |  Branch (1865:5): [True: 1.03k, False: 37.1k]
  ------------------
 1866|  22.3k|    case SIGSUBPKT_PREF_KS:
  ------------------
  |  Branch (1866:5): [True: 3.61k, False: 34.5k]
  ------------------
 1867|  22.5k|    case SIGSUBPKT_REVOC_REASON: /* At least we know about it.  */
  ------------------
  |  Branch (1867:5): [True: 234, False: 37.9k]
  ------------------
 1868|  22.5k|      return 1;
 1869|       |
 1870|  2.22k|    case SIGSUBPKT_KEY_BLOCK:
  ------------------
  |  Branch (1870:5): [True: 2.22k, False: 35.9k]
  ------------------
 1871|  2.22k|      if (n && !buffer[0])
  ------------------
  |  Branch (1871:11): [True: 1.36k, False: 860]
  |  Branch (1871:16): [True: 663, False: 698]
  ------------------
 1872|    663|        return 1;
 1873|  1.55k|      else
 1874|  1.55k|        return 0;
 1875|       |
 1876|  10.6k|    default:
  ------------------
  |  Branch (1876:5): [True: 10.6k, False: 27.5k]
  ------------------
 1877|  10.6k|      return 0;
 1878|  38.1k|    }
 1879|  38.1k|}
parse-packet.c:can_handle_critical_notation:
 1812|  2.30k|{
 1813|  2.30k|  strlist_t sl;
 1814|       |
 1815|  2.30k|  register_known_notation (NULL); /* Make sure it is initialized.  */
 1816|       |
 1817|  3.74k|  for (sl = known_notations_list; sl; sl = sl->next)
  ------------------
  |  Branch (1817:35): [True: 2.30k, False: 1.44k]
  ------------------
 1818|  2.30k|    if (sl->flags == len && !memcmp (sl->d, name, len))
  ------------------
  |  Branch (1818:9): [True: 2.01k, False: 290]
  |  Branch (1818:29): [True: 858, False: 1.15k]
  ------------------
 1819|    858|      return 1; /* Known */
 1820|       |
 1821|  1.44k|  if (opt.verbose && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (1821:7): [True: 0, False: 1.44k]
  |  Branch (1821:22): [True: 0, False: 0]
  ------------------
 1822|      0|    {
 1823|      0|      log_info(_("Unknown critical signature notation: ") );
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 1824|      0|      print_utf8_buffer (log_get_stream(), name, len);
 1825|      0|      log_printf ("\n");
 1826|      0|    }
 1827|       |
 1828|  1.44k|  return 0; /* Unknown.  */
 1829|  2.30k|}
parse-packet.c:read_32:
  106|   258k|{
  107|   258k|  unsigned long a;
  108|   258k|  a = (unsigned long)iobuf_get_noeof (inp) << 24;
  ------------------
  |  |  502|   258k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   258k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 258k]
  |  |  |  |  |  Branch (500:24): [True: 4.93k, False: 253k]
  |  |  |  |  ------------------
  |  |  |  |  501|   258k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
  109|   258k|  a |= iobuf_get_noeof (inp) << 16;
  ------------------
  |  |  502|   258k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   258k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 258k]
  |  |  |  |  |  Branch (500:24): [True: 6.39k, False: 251k]
  |  |  |  |  ------------------
  |  |  |  |  501|   258k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
  110|   258k|  a |= iobuf_get_noeof (inp) << 8;
  ------------------
  |  |  502|   258k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   258k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 258k]
  |  |  |  |  |  Branch (500:24): [True: 6.50k, False: 251k]
  |  |  |  |  ------------------
  |  |  |  |  501|   258k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
  111|   258k|  a |= iobuf_get_noeof (inp);
  ------------------
  |  |  502|   258k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   258k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 258k]
  |  |  |  |  |  Branch (500:24): [True: 5.10k, False: 252k]
  |  |  |  |  ------------------
  |  |  |  |  501|   258k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
  112|   258k|  return a;
  113|   258k|}
parse-packet.c:read_16:
   95|   119k|{
   96|   119k|  unsigned short a;
   97|   119k|  a = (unsigned short)iobuf_get_noeof (inp) << 8;
  ------------------
  |  |  502|   119k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   119k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 119k]
  |  |  |  |  |  Branch (500:24): [True: 1.63k, False: 117k]
  |  |  |  |  ------------------
  |  |  |  |  501|   119k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
   98|   119k|  a |= iobuf_get_noeof (inp);
  ------------------
  |  |  502|   119k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   119k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 119k]
  |  |  |  |  |  Branch (500:24): [True: 1.42k, False: 118k]
  |  |  |  |  ------------------
  |  |  |  |  501|   119k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
   99|   119k|  return a;
  100|   119k|}
parse-packet.c:unknown_pubkey_warning:
  334|  64.1k|{
  335|  64.1k|  static byte unknown_pubkey_algos[256];
  336|       |
  337|       |  /* First check whether the algorithm is usable but not suitable for
  338|       |     encryption/signing.  */
  339|  64.1k|  if (pubkey_get_npkey (algo))
  ------------------
  |  Branch (339:7): [True: 17.3k, False: 46.7k]
  ------------------
  340|  17.3k|    {
  341|  17.3k|      if (opt.verbose && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (341:11): [True: 0, False: 17.3k]
  |  Branch (341:26): [True: 0, False: 0]
  ------------------
  342|      0|        {
  343|      0|          if (!pubkey_get_nsig (algo))
  ------------------
  |  Branch (343:15): [True: 0, False: 0]
  ------------------
  344|      0|            log_info ("public key algorithm %s not suitable for %s\n",
  345|      0|                      openpgp_pk_algo_name (algo), "signing");
  346|      0|          if (!pubkey_get_nenc (algo))
  ------------------
  |  Branch (346:15): [True: 0, False: 0]
  ------------------
  347|      0|            log_info ("public key algorithm %s not suitable for %s\n",
  348|      0|                      openpgp_pk_algo_name (algo), "encryption");
  349|      0|        }
  350|  17.3k|    }
  351|  46.7k|  else
  352|  46.7k|    {
  353|  46.7k|      algo &= 0xff;
  354|  46.7k|      if (!unknown_pubkey_algos[algo])
  ------------------
  |  Branch (354:11): [True: 224, False: 46.5k]
  ------------------
  355|    224|        {
  356|    224|          if (opt.verbose && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (356:15): [True: 0, False: 224]
  |  Branch (356:30): [True: 0, False: 0]
  ------------------
  357|      0|            log_info (_("can't handle public key algorithm %d\n"), algo);
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  358|    224|          unknown_pubkey_algos[algo] = 1;
  359|    224|        }
  360|  46.7k|    }
  361|  64.1k|}
parse-packet.c:read_rest:
 1082|  65.4k|{
 1083|  65.4k|  int c;
 1084|  65.4k|  byte *buf, *p;
 1085|       |
 1086|  65.4k|  buf = xtrymalloc (pktlen);
  ------------------
  |  |   97|  65.4k|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
 1087|  65.4k|  if (!buf)
  ------------------
  |  Branch (1087:7): [True: 31.5k, False: 33.9k]
  ------------------
 1088|  31.5k|    {
 1089|  31.5k|      gpg_error_t err = gpg_error_from_syserror ();
 1090|  31.5k|      log_error ("error reading rest of packet: %s\n", gpg_strerror (err));
 1091|  31.5k|      return NULL;
 1092|  31.5k|    }
 1093|   714k|  for (p = buf; pktlen; pktlen--)
  ------------------
  |  Branch (1093:17): [True: 684k, False: 30.2k]
  ------------------
 1094|   684k|    {
 1095|   684k|      c = iobuf_get (inp);
  ------------------
  |  |  500|   684k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 684k]
  |  |  |  Branch (500:24): [True: 6.01k, False: 678k]
  |  |  ------------------
  |  |  501|   684k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
 1096|   684k|      if (c == -1)
  ------------------
  |  Branch (1096:11): [True: 3.76k, False: 680k]
  ------------------
 1097|  3.76k|        {
 1098|  3.76k|          log_error ("premature eof while reading rest of packet\n");
 1099|  3.76k|          xfree (buf);
  ------------------
  |  |  104|  3.76k|#define xfree(a)         gcry_free ((a))
  ------------------
 1100|  3.76k|          return NULL;
 1101|  3.76k|        }
 1102|   680k|      *p++ = c;
 1103|   680k|    }
 1104|       |
 1105|  30.2k|  return buf;
 1106|  33.9k|}
parse-packet.c:sos_read:
  204|  31.6k|{
  205|  31.6k|  int c, c1, c2, i;
  206|  31.6k|  unsigned int nmax = *ret_nread;
  207|  31.6k|  unsigned int nbits, nbytes;
  208|  31.6k|  size_t nread = 0;
  209|  31.6k|  gcry_mpi_t a = NULL;
  210|  31.6k|  byte *buf = NULL;
  211|  31.6k|  byte *p;
  212|       |
  213|  31.6k|  if (!nmax)
  ------------------
  |  Branch (213:7): [True: 524, False: 31.1k]
  ------------------
  214|    524|    goto overflow;
  215|       |
  216|  31.1k|  if ((c = c1 = iobuf_get (inp)) == -1)
  ------------------
  |  |  500|  31.1k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 31.1k]
  |  |  |  Branch (500:24): [True: 1.06k, False: 30.0k]
  |  |  ------------------
  |  |  501|  31.1k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (216:7): [True: 621, False: 30.4k]
  ------------------
  217|    621|    goto leave;
  218|  30.4k|  if (++nread == nmax)
  ------------------
  |  Branch (218:7): [True: 211, False: 30.2k]
  ------------------
  219|    211|    goto overflow;
  220|  30.2k|  nbits = c << 8;
  221|  30.2k|  if ((c = c2 = iobuf_get (inp)) == -1)
  ------------------
  |  |  500|  30.2k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 30.2k]
  |  |  |  Branch (500:24): [True: 295, False: 29.9k]
  |  |  ------------------
  |  |  501|  30.2k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (221:7): [True: 295, False: 29.9k]
  ------------------
  222|    295|    goto leave;
  223|  29.9k|  ++nread;
  224|  29.9k|  nbits |= c;
  225|  29.9k|  if (nbits > MAX_EXTERN_MPI_BITS)
  ------------------
  |  |   42|  29.9k|#define MAX_EXTERN_MPI_BITS 16384
  ------------------
  |  Branch (225:7): [True: 4.42k, False: 25.5k]
  ------------------
  226|  4.42k|    {
  227|  4.42k|      log_error ("mpi too large (%u bits)\n", nbits);
  228|  4.42k|      goto leave;
  229|  4.42k|    }
  230|       |
  231|  25.5k|  nbytes = (nbits + 7) / 8;
  232|  25.5k|  buf = secure ? gcry_xmalloc_secure (nbytes) : gcry_xmalloc (nbytes);
  ------------------
  |  Branch (232:9): [True: 0, False: 25.5k]
  ------------------
  233|  25.5k|  p = buf;
  234|   192k|  for (i = 0; i < nbytes; i++)
  ------------------
  |  Branch (234:15): [True: 173k, False: 19.5k]
  ------------------
  235|   173k|    {
  236|   173k|      if (nread == nmax)
  ------------------
  |  Branch (236:11): [True: 5.50k, False: 167k]
  ------------------
  237|  5.50k|        goto overflow;
  238|       |
  239|   167k|      c = iobuf_get (inp);
  ------------------
  |  |  500|   167k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 167k]
  |  |  |  Branch (500:24): [True: 993, False: 166k]
  |  |  ------------------
  |  |  501|   167k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  240|   167k|      if (c == -1)
  ------------------
  |  Branch (240:11): [True: 485, False: 167k]
  ------------------
  241|    485|        goto leave;
  242|       |
  243|   167k|      p[i] = c;
  244|   167k|      nread ++;
  245|   167k|    }
  246|       |
  247|  19.5k|  a = gcry_mpi_set_opaque (NULL, buf, nbits);
  248|  19.5k|  gcry_mpi_set_flag (a, GCRYMPI_FLAG_USER2);
  249|  19.5k|  *ret_nread = nread;
  250|  19.5k|  return a;
  251|       |
  252|  6.24k| overflow:
  253|  6.24k|  log_error ("mpi larger than indicated length (%u bits)\n", 8*nmax);
  254|  12.0k| leave:
  255|  12.0k|  *ret_nread = nread;
  256|  12.0k|  gcry_free(buf);
  257|  12.0k|  return a;
  258|  6.24k|}
parse-packet.c:mpi_read:
  130|  90.2k|{
  131|  90.2k|  int c, c1, c2, i;
  132|  90.2k|  unsigned int nmax = *ret_nread;
  133|  90.2k|  unsigned int nbits, nbytes;
  134|  90.2k|  size_t nread = 0;
  135|  90.2k|  gcry_mpi_t a = NULL;
  136|  90.2k|  byte *buf = NULL;
  137|  90.2k|  byte *p;
  138|       |
  139|  90.2k|  if (!nmax)
  ------------------
  |  Branch (139:7): [True: 1.18k, False: 89.0k]
  ------------------
  140|  1.18k|    goto overflow;
  141|       |
  142|  89.0k|  if ((c = c1 = iobuf_get (inp)) == -1)
  ------------------
  |  |  500|  89.0k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 89.0k]
  |  |  |  Branch (500:24): [True: 1.61k, False: 87.4k]
  |  |  ------------------
  |  |  501|  89.0k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (142:7): [True: 1.61k, False: 87.4k]
  ------------------
  143|  1.61k|    goto leave;
  144|  87.4k|  if (++nread == nmax)
  ------------------
  |  Branch (144:7): [True: 1.37k, False: 86.0k]
  ------------------
  145|  1.37k|    goto overflow;
  146|  86.0k|  nbits = c << 8;
  147|  86.0k|  if ((c = c2 = iobuf_get (inp)) == -1)
  ------------------
  |  |  500|  86.0k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 86.0k]
  |  |  |  Branch (500:24): [True: 974, False: 85.0k]
  |  |  ------------------
  |  |  501|  86.0k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (147:7): [True: 973, False: 85.0k]
  ------------------
  148|    973|    goto leave;
  149|  85.0k|  ++nread;
  150|  85.0k|  nbits |= c;
  151|  85.0k|  if (nbits > MAX_EXTERN_MPI_BITS)
  ------------------
  |  |   42|  85.0k|#define MAX_EXTERN_MPI_BITS 16384
  ------------------
  |  Branch (151:7): [True: 3.89k, False: 81.1k]
  ------------------
  152|  3.89k|    {
  153|  3.89k|      log_error ("mpi too large (%u bits)\n", nbits);
  154|  3.89k|      goto leave;
  155|  3.89k|    }
  156|       |
  157|  81.1k|  nbytes = (nbits + 7) / 8;
  158|  81.1k|  buf = secure ? gcry_xmalloc_secure (nbytes + 2) : gcry_xmalloc (nbytes + 2);
  ------------------
  |  Branch (158:9): [True: 0, False: 81.1k]
  ------------------
  159|  81.1k|  p = buf;
  160|  81.1k|  p[0] = c1;
  161|  81.1k|  p[1] = c2;
  162|   291k|  for (i = 0; i < nbytes; i++)
  ------------------
  |  Branch (162:15): [True: 219k, False: 72.1k]
  ------------------
  163|   219k|    {
  164|   219k|      if (nread == nmax)
  ------------------
  |  Branch (164:11): [True: 8.59k, False: 210k]
  ------------------
  165|  8.59k|	goto overflow;
  166|       |
  167|   210k|      c = iobuf_get (inp);
  ------------------
  |  |  500|   210k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 210k]
  |  |  |  Branch (500:24): [True: 654, False: 209k]
  |  |  ------------------
  |  |  501|   210k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  168|   210k|      if (c == -1)
  ------------------
  |  Branch (168:11): [True: 470, False: 210k]
  ------------------
  169|    470|	goto leave;
  170|       |
  171|   210k|      p[i + 2] = c;
  172|   210k|      nread ++;
  173|   210k|    }
  174|       |
  175|  72.1k|  if (gcry_mpi_scan (&a, GCRYMPI_FMT_PGP, buf, nread, &nread))
  ------------------
  |  Branch (175:7): [True: 0, False: 72.1k]
  ------------------
  176|      0|    a = NULL;
  177|       |
  178|  72.1k|  *ret_nread = nread;
  179|  72.1k|  gcry_free(buf);
  180|  72.1k|  return a;
  181|       |
  182|  11.1k| overflow:
  183|  11.1k|  log_error ("mpi larger than indicated length (%u bits)\n", 8*nmax);
  184|  18.1k| leave:
  185|  18.1k|  *ret_nread = nread;
  186|  18.1k|  gcry_free(buf);
  187|  18.1k|  return a;
  188|  11.1k|}

parse_image_header:
  310|  2.30k|{
  311|  2.30k|  u16 headerlen;
  312|       |
  313|  2.30k|  if(attr->len<3)
  ------------------
  |  Branch (313:6): [True: 238, False: 2.07k]
  ------------------
  314|    238|    return 0;
  315|       |
  316|       |  /* For historical reasons (i.e. "oops!"), the header length is
  317|       |     little endian. */
  318|  2.07k|  headerlen=(attr->data[1]<<8) | attr->data[0];
  319|       |
  320|  2.07k|  if(headerlen>attr->len)
  ------------------
  |  Branch (320:6): [True: 467, False: 1.60k]
  ------------------
  321|    467|    return 0;
  322|       |
  323|  1.60k|  if(type && attr->len>=4)
  ------------------
  |  Branch (323:6): [True: 1.60k, False: 0]
  |  Branch (323:14): [True: 1.03k, False: 569]
  ------------------
  324|  1.03k|    {
  325|  1.03k|      if(attr->data[2]==1) /* header version 1 */
  ------------------
  |  Branch (325:10): [True: 362, False: 673]
  ------------------
  326|    362|	*type=attr->data[3];
  327|    673|      else
  328|    673|	*type=0;
  329|  1.03k|    }
  330|       |
  331|  1.60k|  *len=attr->len-headerlen;
  332|       |
  333|  1.60k|  if(*len==0)
  ------------------
  |  Branch (333:6): [True: 606, False: 998]
  ------------------
  334|    606|    return 0;
  335|       |
  336|    998|  return 1;
  337|  1.60k|}
image_type_to_string:
  346|    998|{
  347|    998|  const char *string;
  348|       |
  349|    998|  switch(type)
  350|    998|    {
  351|      3|    case 1: /* jpeg */
  ------------------
  |  Branch (351:5): [True: 3, False: 995]
  ------------------
  352|      3|      if(style==0)
  ------------------
  |  Branch (352:10): [True: 0, False: 3]
  ------------------
  353|      0|	string="jpg";
  354|      3|      else if(style==1)
  ------------------
  |  Branch (354:15): [True: 3, False: 0]
  ------------------
  355|      3|	string="jpeg";
  356|      0|      else
  357|      0|	string="image/jpeg";
  358|      3|      break;
  359|       |
  360|    995|    default:
  ------------------
  |  Branch (360:5): [True: 995, False: 3]
  ------------------
  361|    995|      if(style==0)
  ------------------
  |  Branch (361:10): [True: 0, False: 995]
  ------------------
  362|      0|	string="bin";
  363|    995|      else if(style==1)
  ------------------
  |  Branch (363:15): [True: 995, False: 0]
  ------------------
  364|    995|	string="unknown";
  365|      0|      else
  366|      0|	string="image/x-unknown";
  367|    995|      break;
  368|    998|    }
  369|       |
  370|    998|  return string;
  371|    998|}

handle_plaintext:
  192|  4.58k|{
  193|  4.58k|  char *fname = NULL;
  194|  4.58k|  estream_t fp = NULL;
  195|  4.58k|  static off_t count = 0;
  196|  4.58k|  int err = 0;
  197|  4.58k|  int c;
  198|  4.58k|  int convert;
  199|       |#ifdef __riscos__
  200|       |  int filetype = 0xfff;
  201|       |#endif
  202|       |
  203|  4.58k|  if (pt->mode == 't' || pt->mode == 'u' || pt->mode == 'm')
  ------------------
  |  Branch (203:7): [True: 976, False: 3.60k]
  |  Branch (203:26): [True: 131, False: 3.47k]
  |  Branch (203:45): [True: 90, False: 3.38k]
  ------------------
  204|  1.19k|    convert = pt->mode;
  205|  3.38k|  else
  206|  3.38k|    convert = 0;
  207|       |
  208|       |  /* Let people know what the plaintext info is. This allows the
  209|       |     receiving program to try and do something different based on the
  210|       |     format code (say, recode UTF-8 to local). */
  211|  4.58k|  if (!nooutput && is_status_enabled ())
  ------------------
  |  Branch (211:7): [True: 0, False: 4.58k]
  |  Branch (211:20): [True: 0, False: 0]
  ------------------
  212|      0|    {
  213|      0|      char status[50];
  214|       |
  215|       |      /* Better make sure that stdout has been flushed in case the
  216|       |         output will be written to it.  This is to make sure that no
  217|       |         not-yet-flushed stuff will be written after the plaintext
  218|       |         status message.  */
  219|      0|      es_fflush (es_stdout);
  220|       |
  221|      0|      snprintf (status, sizeof status,
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  222|      0|                "%X %lu ", (byte) pt->mode, (ulong) pt->timestamp);
  223|      0|      write_status_text_and_buffer (STATUS_PLAINTEXT,
  224|      0|				    status, pt->name, pt->namelen, 0);
  225|       |
  226|      0|      if (!pt->is_partial)
  ------------------
  |  Branch (226:11): [True: 0, False: 0]
  ------------------
  227|      0|	{
  228|      0|	  snprintf (status, sizeof status, "%lu", (ulong) pt->len);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  229|      0|	  write_status_text (STATUS_PLAINTEXT_LENGTH, status);
  230|      0|	}
  231|      0|    }
  232|       |
  233|  4.58k|  if (! nooutput)
  ------------------
  |  Branch (233:7): [True: 0, False: 4.58k]
  ------------------
  234|      0|    {
  235|      0|      err = get_output_file (pt->name, pt->namelen, pt->buf, &fname, &fp);
  236|      0|      if (err)
  ------------------
  |  Branch (236:11): [True: 0, False: 0]
  ------------------
  237|      0|        goto leave;
  238|      0|    }
  239|       |
  240|  4.58k|  if (!pt->is_partial)
  ------------------
  |  Branch (240:7): [True: 1.71k, False: 2.86k]
  ------------------
  241|  1.71k|    {
  242|       |      /* We have an actual length (which might be zero). */
  243|       |
  244|  1.71k|      if (clearsig)
  ------------------
  |  Branch (244:11): [True: 1, False: 1.71k]
  ------------------
  245|      1|	{
  246|      1|	  log_error ("clearsig encountered while not expected\n");
  247|      1|	  err = gpg_error (GPG_ERR_UNEXPECTED);
  248|      1|	  goto leave;
  249|      1|	}
  250|       |
  251|  1.71k|      if (convert) /* Text mode.  */
  ------------------
  |  Branch (251:11): [True: 150, False: 1.56k]
  ------------------
  252|    150|	{
  253|   421k|	  for (; pt->len; pt->len--)
  ------------------
  |  Branch (253:11): [True: 421k, False: 11]
  ------------------
  254|   421k|	    {
  255|   421k|	      if ((c = iobuf_get (pt->buf)) == -1)
  ------------------
  |  |  500|   421k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 421k]
  |  |  |  Branch (500:24): [True: 617, False: 421k]
  |  |  ------------------
  |  |  501|   421k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (255:12): [True: 139, False: 421k]
  ------------------
  256|    139|		{
  257|    139|		  err = gpg_error_from_syserror ();
  258|    139|		  log_error ("problem reading source (%u bytes remaining)\n",
  259|    139|			     (unsigned) pt->len);
  260|    139|		  goto leave;
  261|    139|		}
  262|   421k|	      if (mfx->md)
  ------------------
  |  Branch (262:12): [True: 421k, False: 0]
  ------------------
  263|   421k|		gcry_md_putc (mfx->md, c);
  264|   421k|#ifndef HAVE_DOSISH_SYSTEM
  265|       |              /* Convert to native line ending. */
  266|       |              /* fixme: this hack might be too simple */
  267|   421k|	      if (c == '\r' && convert != 'm')
  ------------------
  |  Branch (267:12): [True: 1.65k, False: 419k]
  |  Branch (267:25): [True: 1.31k, False: 337]
  ------------------
  268|  1.31k|		continue;
  269|   420k|#endif
  270|   420k|	      if (fp)
  ------------------
  |  Branch (270:12): [True: 0, False: 420k]
  ------------------
  271|      0|		{
  272|      0|		  if (opt.max_output && (++count) > opt.max_output)
  ------------------
  |  Branch (272:9): [True: 0, False: 0]
  |  Branch (272:27): [True: 0, False: 0]
  ------------------
  273|      0|		    {
  274|      0|		      log_error ("error writing to '%s': %s\n",
  275|      0|				 fname, "exceeded --max-output limit\n");
  276|      0|		      err = gpg_error (GPG_ERR_TOO_LARGE);
  277|      0|		      goto leave;
  278|      0|		    }
  279|      0|		  else if (es_putc (c, fp) == EOF)
  ------------------
  |  Branch (279:14): [True: 0, False: 0]
  ------------------
  280|      0|		    {
  281|      0|		      if (es_ferror (fp))
  ------------------
  |  Branch (281:13): [True: 0, False: 0]
  ------------------
  282|      0|			err = gpg_error_from_syserror ();
  283|      0|		      else
  284|      0|			err = gpg_error (GPG_ERR_EOF);
  285|      0|		      log_error ("error writing to '%s': %s\n",
  286|      0|				 fname, gpg_strerror (err));
  287|      0|		      goto leave;
  288|      0|		    }
  289|      0|		}
  290|   420k|	    }
  291|    150|	}
  292|  1.56k|      else  /* Binary mode.  */
  293|  1.56k|	{
  294|  1.56k|	  size_t temp_size = iobuf_set_buffer_size(0) * 1024;
  295|  1.56k|	  byte *buffer;
  296|       |
  297|  1.56k|	  if (fp)
  ------------------
  |  Branch (297:8): [True: 0, False: 1.56k]
  ------------------
  298|      0|	    {
  299|       |	      /* Disable buffering in estream as we are passing large
  300|       |	       * buffers to es_fwrite. */
  301|      0|	      es_setbuf (fp, NULL);
  302|      0|	    }
  303|       |
  304|  1.56k|	  buffer = xmalloc (temp_size);
  ------------------
  |  |  107|  1.56k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  305|  1.56k|          if (!buffer)
  ------------------
  |  Branch (305:15): [True: 0, False: 1.56k]
  ------------------
  306|      0|            {
  307|      0|              err = gpg_error_from_syserror ();
  308|      0|              goto leave;
  309|      0|            }
  310|       |
  311|  4.09k|	  while (pt->len)
  ------------------
  |  Branch (311:11): [True: 3.57k, False: 516]
  ------------------
  312|  3.57k|	    {
  313|  3.57k|	      int len = pt->len > temp_size ? temp_size : pt->len;
  ------------------
  |  Branch (313:18): [True: 2.03k, False: 1.54k]
  ------------------
  314|  3.57k|	      len = iobuf_read (pt->buf, buffer, len);
  315|  3.57k|	      if (len == -1)
  ------------------
  |  Branch (315:12): [True: 1.04k, False: 2.53k]
  ------------------
  316|  1.04k|		{
  317|  1.04k|		  err = gpg_error_from_syserror ();
  318|  1.04k|		  log_error ("problem reading source (%u bytes remaining)\n",
  319|  1.04k|			     (unsigned) pt->len);
  320|  1.04k|		  xfree (buffer);
  ------------------
  |  |  104|  1.04k|#define xfree(a)         gcry_free ((a))
  ------------------
  321|  1.04k|		  goto leave;
  322|  1.04k|		}
  323|  2.53k|	      if (mfx->md)
  ------------------
  |  Branch (323:12): [True: 2.53k, False: 0]
  ------------------
  324|  2.53k|		gcry_md_write (mfx->md, buffer, len);
  325|  2.53k|	      if (fp)
  ------------------
  |  Branch (325:12): [True: 0, False: 2.53k]
  ------------------
  326|      0|		{
  327|      0|		  if (opt.max_output && (count += len) > opt.max_output)
  ------------------
  |  Branch (327:9): [True: 0, False: 0]
  |  Branch (327:27): [True: 0, False: 0]
  ------------------
  328|      0|		    {
  329|      0|		      log_error ("error writing to '%s': %s\n",
  330|      0|				 fname, "exceeded --max-output limit\n");
  331|      0|		      err = gpg_error (GPG_ERR_TOO_LARGE);
  332|      0|		      xfree (buffer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  333|      0|		      goto leave;
  334|      0|		    }
  335|      0|		  else if (es_fwrite (buffer, 1, len, fp) != len)
  ------------------
  |  Branch (335:14): [True: 0, False: 0]
  ------------------
  336|      0|		    {
  337|      0|		      err = gpg_error_from_syserror ();
  338|      0|		      log_error ("error writing to '%s': %s\n",
  339|      0|				 fname, gpg_strerror (err));
  340|      0|		      xfree (buffer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  341|      0|		      goto leave;
  342|      0|		    }
  343|      0|		}
  344|  2.53k|	      pt->len -= len;
  345|  2.53k|	    }
  346|    516|	  xfree (buffer);
  ------------------
  |  |  104|    516|#define xfree(a)         gcry_free ((a))
  ------------------
  347|    516|	}
  348|  1.71k|    }
  349|  2.86k|  else if (!clearsig)
  ------------------
  |  Branch (349:12): [True: 1.98k, False: 877]
  ------------------
  350|  1.98k|    {
  351|  1.98k|      if (convert)
  ------------------
  |  Branch (351:11): [True: 170, False: 1.81k]
  ------------------
  352|    170|	{			/* text mode */
  353|   919k|	  while ((c = iobuf_get (pt->buf)) != -1)
  ------------------
  |  |  500|   919k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 919k]
  |  |  |  Branch (500:24): [True: 842, False: 918k]
  |  |  ------------------
  |  |  501|   919k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (353:11): [True: 919k, False: 170]
  ------------------
  354|   919k|	    {
  355|   919k|	      if (mfx->md)
  ------------------
  |  Branch (355:12): [True: 919k, False: 0]
  ------------------
  356|   919k|		gcry_md_putc (mfx->md, c);
  357|   919k|#ifndef HAVE_DOSISH_SYSTEM
  358|   919k|	      if (c == '\r' && convert != 'm')
  ------------------
  |  Branch (358:12): [True: 5.30k, False: 913k]
  |  Branch (358:25): [True: 393, False: 4.91k]
  ------------------
  359|    393|		continue;	/* fixme: this hack might be too simple */
  360|   918k|#endif
  361|   918k|	      if (fp)
  ------------------
  |  Branch (361:12): [True: 0, False: 918k]
  ------------------
  362|      0|		{
  363|      0|		  if (opt.max_output && (++count) > opt.max_output)
  ------------------
  |  Branch (363:9): [True: 0, False: 0]
  |  Branch (363:27): [True: 0, False: 0]
  ------------------
  364|      0|		    {
  365|      0|		      log_error ("Error writing to '%s': %s\n",
  366|      0|				 fname, "exceeded --max-output limit\n");
  367|      0|		      err = gpg_error (GPG_ERR_TOO_LARGE);
  368|      0|		      goto leave;
  369|      0|		    }
  370|      0|		  else if (es_putc (c, fp) == EOF)
  ------------------
  |  Branch (370:14): [True: 0, False: 0]
  ------------------
  371|      0|		    {
  372|      0|		      if (es_ferror (fp))
  ------------------
  |  Branch (372:13): [True: 0, False: 0]
  ------------------
  373|      0|			err = gpg_error_from_syserror ();
  374|      0|		      else
  375|      0|			err = gpg_error (GPG_ERR_EOF);
  376|      0|		      log_error ("error writing to '%s': %s\n",
  377|      0|				 fname, gpg_strerror (err));
  378|      0|		      goto leave;
  379|      0|		    }
  380|      0|		}
  381|   918k|	    }
  382|    170|	}
  383|  1.81k|      else
  384|  1.81k|	{			/* binary mode */
  385|  1.81k|	  size_t temp_size = iobuf_set_buffer_size(0) * 1024;
  386|  1.81k|	  byte *buffer;
  387|  1.81k|	  int eof_seen = 0;
  388|       |
  389|  1.81k|	  if (fp)
  ------------------
  |  Branch (389:8): [True: 0, False: 1.81k]
  ------------------
  390|      0|	    {
  391|       |	      /* Disable buffering in estream as we are passing large
  392|       |	       * buffers to es_fwrite. */
  393|      0|	      es_setbuf (fp, NULL);
  394|      0|	    }
  395|       |
  396|  1.81k|          buffer = xtrymalloc (temp_size);
  ------------------
  |  |   97|  1.81k|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  397|  1.81k|          if (!buffer)
  ------------------
  |  Branch (397:15): [True: 0, False: 1.81k]
  ------------------
  398|      0|            {
  399|      0|              err = gpg_error_from_syserror ();
  400|      0|              goto leave;
  401|      0|            }
  402|       |
  403|  3.01k|	  while (!eof_seen)
  ------------------
  |  Branch (403:11): [True: 1.93k, False: 1.08k]
  ------------------
  404|  1.93k|	    {
  405|       |	      /* Why do we check for len < temp_size:
  406|       |	       * If we won't, we would practically read 2 EOFs but
  407|       |	       * the first one has already popped the block_filter
  408|       |	       * off and therefore we don't catch the boundary.
  409|       |	       * So, always assume EOF if iobuf_read returns less bytes
  410|       |	       * then requested */
  411|  1.93k|	      int len = iobuf_read (pt->buf, buffer, temp_size);
  412|  1.93k|	      if (len == -1)
  ------------------
  |  Branch (412:12): [True: 738, False: 1.19k]
  ------------------
  413|    738|		break;
  414|  1.19k|	      if (len < temp_size)
  ------------------
  |  Branch (414:12): [True: 1.08k, False: 111]
  ------------------
  415|  1.08k|		eof_seen = 1;
  416|  1.19k|	      if (mfx->md)
  ------------------
  |  Branch (416:12): [True: 1.19k, False: 0]
  ------------------
  417|  1.19k|		gcry_md_write (mfx->md, buffer, len);
  418|  1.19k|	      if (fp)
  ------------------
  |  Branch (418:12): [True: 0, False: 1.19k]
  ------------------
  419|      0|		{
  420|      0|		  if (opt.max_output && (count += len) > opt.max_output)
  ------------------
  |  Branch (420:9): [True: 0, False: 0]
  |  Branch (420:27): [True: 0, False: 0]
  ------------------
  421|      0|		    {
  422|      0|		      log_error ("error writing to '%s': %s\n",
  423|      0|				 fname, "exceeded --max-output limit\n");
  424|      0|		      err = gpg_error (GPG_ERR_TOO_LARGE);
  425|      0|		      xfree (buffer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  426|      0|		      goto leave;
  427|      0|		    }
  428|      0|		  else if (es_fwrite (buffer, 1, len, fp) != len)
  ------------------
  |  Branch (428:14): [True: 0, False: 0]
  ------------------
  429|      0|		    {
  430|      0|		      err = gpg_error_from_syserror ();
  431|      0|		      log_error ("error writing to '%s': %s\n",
  432|      0|				 fname, gpg_strerror (err));
  433|      0|		      xfree (buffer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  434|      0|		      goto leave;
  435|      0|		    }
  436|      0|		}
  437|  1.19k|	    }
  438|  1.81k|	  xfree (buffer);
  ------------------
  |  |  104|  1.81k|#define xfree(a)         gcry_free ((a))
  ------------------
  439|  1.81k|	}
  440|  1.98k|      pt->buf = NULL;
  441|  1.98k|    }
  442|    877|  else /* Clear text signature - don't hash the last CR,LF.   */
  443|    877|    {
  444|    877|      int state = 0;
  445|       |
  446|  4.76M|      while ((c = iobuf_get (pt->buf)) != -1)
  ------------------
  |  |  500|  4.76M|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 4.76M]
  |  |  |  Branch (500:24): [True: 1.23k, False: 4.76M]
  |  |  ------------------
  |  |  501|  4.76M|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (446:14): [True: 4.76M, False: 877]
  ------------------
  447|  4.76M|	{
  448|  4.76M|	  if (fp)
  ------------------
  |  Branch (448:8): [True: 0, False: 4.76M]
  ------------------
  449|      0|	    {
  450|      0|	      if (opt.max_output && (++count) > opt.max_output)
  ------------------
  |  Branch (450:12): [True: 0, False: 0]
  |  Branch (450:30): [True: 0, False: 0]
  ------------------
  451|      0|		{
  452|      0|		  log_error ("error writing to '%s': %s\n",
  453|      0|			     fname, "exceeded --max-output limit\n");
  454|      0|		  err = gpg_error (GPG_ERR_TOO_LARGE);
  455|      0|		  goto leave;
  456|      0|		}
  457|      0|	      else if (es_putc (c, fp) == EOF)
  ------------------
  |  Branch (457:17): [True: 0, False: 0]
  ------------------
  458|      0|		{
  459|      0|		  err = gpg_error_from_syserror ();
  460|      0|		  log_error ("error writing to '%s': %s\n",
  461|      0|			     fname, gpg_strerror (err));
  462|      0|		  goto leave;
  463|      0|		}
  464|      0|	    }
  465|  4.76M|	  if (!mfx->md)
  ------------------
  |  Branch (465:8): [True: 0, False: 4.76M]
  ------------------
  466|      0|	    continue;
  467|  4.76M|	  if (state == 2)
  ------------------
  |  Branch (467:8): [True: 2.11M, False: 2.65M]
  ------------------
  468|  2.11M|	    {
  469|  2.11M|	      gcry_md_putc (mfx->md, '\r');
  470|  2.11M|	      gcry_md_putc (mfx->md, '\n');
  471|  2.11M|	      state = 0;
  472|  2.11M|	    }
  473|  4.76M|	  if (!state)
  ------------------
  |  Branch (473:8): [True: 4.55M, False: 215k]
  ------------------
  474|  4.55M|	    {
  475|  4.55M|	      if (c == '\r')
  ------------------
  |  Branch (475:12): [True: 38.7k, False: 4.51M]
  ------------------
  476|  38.7k|		state = 1;
  477|  4.51M|	      else if (c == '\n')
  ------------------
  |  Branch (477:17): [True: 2.11M, False: 2.39M]
  ------------------
  478|  2.11M|		state = 2;
  479|  2.39M|	      else
  480|  2.39M|		gcry_md_putc (mfx->md, c);
  481|  4.55M|	    }
  482|   215k|	  else if (state == 1)
  ------------------
  |  Branch (482:13): [True: 215k, False: 0]
  ------------------
  483|   215k|	    {
  484|   215k|	      if (c == '\n')
  ------------------
  |  Branch (484:12): [True: 647, False: 214k]
  ------------------
  485|    647|		state = 2;
  486|   214k|	      else
  487|   214k|		{
  488|   214k|		  gcry_md_putc (mfx->md, '\r');
  489|   214k|		  if (c == '\r')
  ------------------
  |  Branch (489:9): [True: 176k, False: 38.1k]
  ------------------
  490|   176k|		    state = 1;
  491|  38.1k|		  else
  492|  38.1k|		    {
  493|  38.1k|		      state = 0;
  494|  38.1k|		      gcry_md_putc (mfx->md, c);
  495|  38.1k|		    }
  496|   214k|		}
  497|   215k|	    }
  498|  4.76M|	}
  499|    877|      pt->buf = NULL;
  500|    877|    }
  501|       |
  502|  3.39k|  if (fp && fp != es_stdout && fp != opt.outfp && es_fclose (fp))
  ------------------
  |  Branch (502:7): [True: 0, False: 3.39k]
  |  Branch (502:13): [True: 0, False: 0]
  |  Branch (502:32): [True: 0, False: 0]
  |  Branch (502:51): [True: 0, False: 0]
  ------------------
  503|      0|    {
  504|      0|      err = gpg_error_from_syserror ();
  505|      0|      log_error ("error closing '%s': %s\n", fname, gpg_strerror (err));
  506|      0|      fp = NULL;
  507|      0|      goto leave;
  508|      0|    }
  509|  3.39k|  fp = NULL;
  510|       |
  511|  4.58k| leave:
  512|       |  /* Make sure that stdout gets flushed after the plaintext has been
  513|       |     handled.  This is for extra security as we do a flush anyway
  514|       |     before checking the signature.  */
  515|  4.58k|  if (es_fflush (es_stdout))
  ------------------
  |  Branch (515:7): [True: 0, False: 4.58k]
  ------------------
  516|      0|    {
  517|       |      /* We need to check the return code to detect errors like disk
  518|       |         full for short plaintexts.  See bug#1207.  Checking return
  519|       |         values is a good idea in any case.  */
  520|      0|      if (!err)
  ------------------
  |  Branch (520:11): [True: 0, False: 0]
  ------------------
  521|      0|        err = gpg_error_from_syserror ();
  522|      0|      log_error ("error flushing '%s': %s\n", "[stdout]",
  523|      0|                 gpg_strerror (err));
  524|      0|    }
  525|       |
  526|  4.58k|  if (fp && fp != es_stdout && fp != opt.outfp)
  ------------------
  |  Branch (526:7): [True: 0, False: 4.58k]
  |  Branch (526:13): [True: 0, False: 0]
  |  Branch (526:32): [True: 0, False: 0]
  ------------------
  527|      0|    es_fclose (fp);
  528|  4.58k|  xfree (fname);
  ------------------
  |  |  104|  4.58k|#define xfree(a)         gcry_free ((a))
  ------------------
  529|  4.58k|  return err;
  530|  3.39k|}
hash_datafiles:
  677|   182k|{
  678|   182k|  progress_filter_context_t *pfx;
  679|   182k|  IOBUF fp;
  680|   182k|  strlist_t sl;
  681|       |
  682|   182k|  pfx = new_progress_context ();
  683|       |
  684|   182k|  if (!files)
  ------------------
  |  Branch (684:7): [True: 182k, False: 0]
  ------------------
  685|   182k|    {
  686|       |      /* Check whether we can open the signed material.  We avoid
  687|       |         trying to open a file if run in batch mode.  This assumed
  688|       |         data file for a sig file feature is just a convenience thing
  689|       |         for the command line and the user needs to read possible
  690|       |         warning messages. */
  691|   182k|      if (!opt.batch)
  ------------------
  |  Branch (691:11): [True: 182k, False: 0]
  ------------------
  692|   182k|        {
  693|   182k|          fp = open_sigfile (sigfilename, pfx);
  694|   182k|          if (fp)
  ------------------
  |  Branch (694:15): [True: 0, False: 182k]
  ------------------
  695|      0|            {
  696|      0|              do_hash (md, md2, fp, textmode);
  697|      0|              iobuf_close (fp);
  698|      0|              release_progress_context (pfx);
  699|      0|              return 0;
  700|      0|            }
  701|   182k|        }
  702|   182k|      log_error (_("no signed data\n"));
  ------------------
  |  |   28|   182k|#  define _(a) gettext (a)
  ------------------
  703|   182k|      release_progress_context (pfx);
  704|   182k|      return gpg_error (GPG_ERR_NO_DATA);
  705|   182k|    }
  706|       |
  707|       |
  708|      0|  for (sl = files; sl; sl = sl->next)
  ------------------
  |  Branch (708:20): [True: 0, False: 0]
  ------------------
  709|      0|    {
  710|      0|      fp = iobuf_open (sl->d);
  711|      0|      if (fp && is_secured_file (iobuf_get_fd (fp)))
  ------------------
  |  Branch (711:11): [True: 0, False: 0]
  |  Branch (711:17): [True: 0, False: 0]
  ------------------
  712|      0|	{
  713|      0|	  iobuf_close (fp);
  714|      0|	  fp = NULL;
  715|      0|	  gpg_err_set_errno (EPERM);
  716|      0|	}
  717|      0|      if (!fp)
  ------------------
  |  Branch (717:11): [True: 0, False: 0]
  ------------------
  718|      0|	{
  719|      0|	  int rc = gpg_error_from_syserror ();
  720|      0|	  log_error (_("can't open signed data '%s'\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  721|      0|		     print_fname_stdin (sl->d));
  722|      0|	  release_progress_context (pfx);
  723|      0|	  return rc;
  724|      0|	}
  725|      0|      handle_progress (pfx, fp, sl->d);
  726|      0|      do_hash (md, md2, fp, textmode);
  727|      0|      iobuf_close (fp);
  728|      0|    }
  729|       |
  730|      0|  release_progress_context (pfx);
  731|      0|  return 0;
  732|      0|}

new_progress_context:
   44|   206k|{
   45|   206k|  progress_filter_context_t *pfx;
   46|       |
   47|   206k|  if (!opt.enable_progress_filter)
  ------------------
  |  Branch (47:7): [True: 206k, False: 0]
  ------------------
   48|   206k|    return NULL;
   49|       |
   50|      0|  if (!is_status_enabled ())
  ------------------
  |  Branch (50:7): [True: 0, False: 0]
  ------------------
   51|      0|    return NULL;
   52|       |
   53|      0|  pfx = xcalloc (1, sizeof *pfx);
  ------------------
  |  |  109|      0|#define xcalloc(a,b)     gcry_xcalloc ((a),(b))
  ------------------
   54|      0|  pfx->refcount = 1;
   55|       |
   56|      0|  return pfx;
   57|      0|}
release_progress_context:
   63|   206k|{
   64|   206k|  if (!pfx)
  ------------------
  |  Branch (64:7): [True: 206k, False: 0]
  ------------------
   65|   206k|    return;
   66|      0|  log_assert (pfx->refcount);
   67|      0|  if ( --pfx->refcount )
  ------------------
  |  Branch (67:8): [True: 0, False: 0]
  ------------------
   68|      0|    return;
   69|      0|  xfree (pfx->what);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
   70|      0|  xfree (pfx);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
   71|      0|}
handle_progress:
  183|  24.4k|{
  184|  24.4k|  off_t filesize = 0;
  185|       |
  186|  24.4k|  if (!pfx)
  ------------------
  |  Branch (186:7): [True: 24.4k, False: 0]
  ------------------
  187|  24.4k|    return;
  188|       |
  189|      0|  log_assert (opt.enable_progress_filter);
  190|      0|  log_assert (is_status_enabled ());
  191|       |
  192|      0|  if ( !iobuf_is_pipe_filename (name) && *name )
  ------------------
  |  Branch (192:8): [True: 0, False: 0]
  |  Branch (192:42): [True: 0, False: 0]
  ------------------
  193|      0|    filesize = iobuf_get_filelength (inp, NULL);
  194|      0|  else if (opt.set_filesize)
  ------------------
  |  Branch (194:12): [True: 0, False: 0]
  ------------------
  195|      0|    filesize = opt.set_filesize;
  196|       |
  197|       |  /* register the progress filter */
  198|      0|  pfx->what = xstrdup (name ? name : "stdin");
  ------------------
  |  |  112|      0|#define xstrdup(a)       gcry_xstrdup ((a))
  |  |  ------------------
  |  |  |  Branch (112:41): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  199|      0|  pfx->total = filesize;
  200|      0|  pfx->refcount++;
  201|      0|  iobuf_push_filter (inp, progress_filter, pfx);
  202|      0|}

rmd160.c:rmd160_init:
   70|  18.5k|{
   71|  18.5k|  hd->h0 = 0x67452301;
   72|  18.5k|  hd->h1 = 0xEFCDAB89;
   73|  18.5k|  hd->h2 = 0x98BADCFE;
   74|  18.5k|  hd->h3 = 0x10325476;
   75|  18.5k|  hd->h4 = 0xC3D2E1F0;
   76|  18.5k|  hd->nblocks = 0;
   77|  18.5k|  hd->count = 0;
   78|  18.5k|}

check_signature2:
  160|  16.2k|{
  161|  16.2k|  int rc=0;
  162|  16.2k|  PKT_public_key *pk;
  163|       |
  164|  16.2k|  if (r_expiredate)
  ------------------
  |  Branch (164:7): [True: 0, False: 16.2k]
  ------------------
  165|      0|    *r_expiredate = 0;
  166|  16.2k|  if (r_expired)
  ------------------
  |  Branch (166:7): [True: 16.2k, False: 0]
  ------------------
  167|  16.2k|    *r_expired = 0;
  168|  16.2k|  if (r_revoked)
  ------------------
  |  Branch (168:7): [True: 16.2k, False: 0]
  ------------------
  169|  16.2k|    *r_revoked = 0;
  170|  16.2k|  if (r_pk)
  ------------------
  |  Branch (170:7): [True: 16.2k, False: 0]
  ------------------
  171|  16.2k|    *r_pk = NULL;
  172|       |
  173|  16.2k|  pk = xtrycalloc (1, sizeof *pk);
  ------------------
  |  |   99|  16.2k|#define xtrycalloc(a,b)  gcry_calloc ((a),(b))
  ------------------
  174|  16.2k|  if (!pk)
  ------------------
  |  Branch (174:7): [True: 0, False: 16.2k]
  ------------------
  175|      0|    return gpg_error_from_syserror ();
  176|       |
  177|  16.2k|  if  ((rc=openpgp_md_test_algo(sig->digest_algo)))
  ------------------
  |  Branch (177:8): [True: 0, False: 16.2k]
  ------------------
  178|      0|    {
  179|       |      /* We don't have this digest. */
  180|      0|    }
  181|  16.2k|  else if (!gnupg_digest_is_allowed (opt.compliance, 0, sig->digest_algo))
  ------------------
  |  Branch (181:12): [True: 0, False: 16.2k]
  ------------------
  182|      0|    {
  183|       |      /* Compliance failure.  */
  184|      0|      log_info (_("digest algorithm '%s' may not be used in %s mode\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  185|      0|                gcry_md_algo_name (sig->digest_algo),
  186|      0|                gnupg_compliance_option_string (opt.compliance));
  187|      0|      rc = gpg_error (GPG_ERR_DIGEST_ALGO);
  188|      0|    }
  189|  16.2k|  else if ((rc=openpgp_pk_test_algo(sig->pubkey_algo)))
  ------------------
  |  Branch (189:12): [True: 1.66k, False: 14.5k]
  ------------------
  190|  1.66k|    {
  191|       |      /* We don't have this pubkey algo. */
  192|  1.66k|    }
  193|  14.5k|  else if (!gcry_md_is_enabled (digest,sig->digest_algo))
  ------------------
  |  Branch (193:12): [True: 1.95k, False: 12.5k]
  ------------------
  194|  1.95k|    {
  195|       |      /* Sanity check that the md has a context for the hash that the
  196|       |       * sig is expecting.  This can happen if a onepass sig header
  197|       |       * does not match the actual sig, and also if the clearsign
  198|       |       * "Hash:" header is missing or does not match the actual sig. */
  199|  1.95k|      log_info(_("WARNING: signature digest conflict in message\n"));
  ------------------
  |  |   28|  1.95k|#  define _(a) gettext (a)
  ------------------
  200|  1.95k|      rc = gpg_error (GPG_ERR_GENERAL);
  201|  1.95k|    }
  202|  12.5k|  else if (get_pubkey_for_sig (ctrl, pk, sig, forced_pk))
  ------------------
  |  Branch (202:12): [True: 12.5k, False: 0]
  ------------------
  203|  12.5k|    rc = gpg_error (GPG_ERR_NO_PUBKEY);
  204|      0|  else if ((rc = check_key_verify_compliance (pk)))
  ------------------
  |  Branch (204:12): [True: 0, False: 0]
  ------------------
  205|      0|    ;/* Compliance failure.  */
  206|      0|  else if (!pk->flags.valid)
  ------------------
  |  Branch (206:12): [True: 0, False: 0]
  ------------------
  207|      0|    {
  208|       |      /* You cannot have a good sig from an invalid key.  */
  209|      0|      rc = gpg_error (GPG_ERR_BAD_PUBKEY);
  210|      0|    }
  211|      0|  else
  212|      0|    {
  213|      0|      if (r_expiredate)
  ------------------
  |  Branch (213:11): [True: 0, False: 0]
  ------------------
  214|      0|        *r_expiredate = pk->expiredate;
  215|       |
  216|      0|      rc = check_signature_end (pk, sig, digest, extrahash, extrahashlen,
  217|      0|                                r_expired, r_revoked, NULL);
  218|       |
  219|       |      /* Check the backsig.  This is a back signature (0x19) from
  220|       |       * the subkey on the primary key.  The idea here is that it
  221|       |       * should not be possible for someone to "steal" subkeys and
  222|       |       * claim them as their own.  The attacker couldn't actually
  223|       |       * use the subkey, but they could try and claim ownership of
  224|       |       * any signatures issued by it.  */
  225|      0|      if (!rc && !pk->flags.primary && pk->flags.backsig < 2)
  ------------------
  |  Branch (225:11): [True: 0, False: 0]
  |  Branch (225:18): [True: 0, False: 0]
  |  Branch (225:40): [True: 0, False: 0]
  ------------------
  226|      0|        {
  227|      0|          if (!pk->flags.backsig)
  ------------------
  |  Branch (227:15): [True: 0, False: 0]
  ------------------
  228|      0|            {
  229|      0|              log_info (_("WARNING: signing subkey %s is not"
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  230|      0|                          " cross-certified\n"),keystr_from_pk(pk));
  231|      0|              log_info (_("please see %s for more information\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  232|      0|                        "https://gnupg.org/faq/subkey-cross-certify.html");
  233|       |              /* The default option --require-cross-certification
  234|       |               * makes this warning an error.  */
  235|      0|              if (opt.flags.require_cross_cert)
  ------------------
  |  Branch (235:19): [True: 0, False: 0]
  ------------------
  236|      0|                rc = gpg_error (GPG_ERR_GENERAL);
  237|      0|            }
  238|      0|          else if(pk->flags.backsig == 1)
  ------------------
  |  Branch (238:19): [True: 0, False: 0]
  ------------------
  239|      0|            {
  240|      0|              log_info (_("WARNING: signing subkey %s has an invalid"
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  241|      0|                          " cross-certification\n"), keystr_from_pk(pk));
  242|      0|              rc = gpg_error (GPG_ERR_GENERAL);
  243|      0|            }
  244|      0|        }
  245|       |
  246|      0|    }
  247|       |
  248|  16.2k|    if( !rc && sig->sig_class < 2 && is_status_enabled() ) {
  ------------------
  |  Branch (248:9): [True: 0, False: 16.2k]
  |  Branch (248:16): [True: 0, False: 0]
  |  Branch (248:38): [True: 0, False: 0]
  ------------------
  249|       |	/* This signature id works best with DLP algorithms because
  250|       |	 * they use a random parameter for every signature.  Instead of
  251|       |	 * this sig-id we could have also used the hash of the document
  252|       |	 * and the timestamp, but the drawback of this is, that it is
  253|       |	 * not possible to sign more than one identical document within
  254|       |	 * one second.	Some remote batch processing applications might
  255|       |	 * like this feature here.
  256|       |         *
  257|       |         * Note that before 2.0.10, we used RIPE-MD160 for the hash
  258|       |         * and accidentally didn't include the timestamp and algorithm
  259|       |         * information in the hash.  Given that this feature is not
  260|       |         * commonly used and that a replay attacks detection should
  261|       |         * not solely be based on this feature (because it does not
  262|       |         * work with RSA), we take the freedom and switch to SHA-1
  263|       |         * with 2.0.10 to take advantage of hardware supported SHA-1
  264|       |         * implementations.  We also include the missing information
  265|       |         * in the hash.  Note also the SIG_ID as computed by gpg 1.x
  266|       |         * and gpg 2.x didn't matched either because 2.x used to print
  267|       |         * MPIs not in PGP format.  */
  268|      0|	u32 a = sig->timestamp;
  269|      0|	int nsig = pubkey_get_nsig( sig->pubkey_algo );
  270|      0|	unsigned char *p, *buffer;
  271|      0|        size_t n, nbytes;
  272|      0|        int i;
  273|      0|        char hashbuf[20];  /* We use SHA-1 here.  */
  274|       |
  275|      0|      nbytes = 6;
  276|      0|      for (i=0; i < nsig; i++ )
  ------------------
  |  Branch (276:17): [True: 0, False: 0]
  ------------------
  277|      0|        {
  278|      0|          if (gcry_mpi_get_flag (sig->data[i], GCRYMPI_FLAG_OPAQUE))
  ------------------
  |  Branch (278:15): [True: 0, False: 0]
  ------------------
  279|      0|            {
  280|      0|              unsigned int nbits;
  281|       |
  282|      0|              gcry_mpi_get_opaque (sig->data[i], &nbits);
  283|      0|              n = (nbits+7)/8 + 2;
  284|      0|            }
  285|      0|          else if (gcry_mpi_print (GCRYMPI_FMT_PGP, NULL, 0, &n, sig->data[i]))
  ------------------
  |  Branch (285:20): [True: 0, False: 0]
  ------------------
  286|      0|            BUG();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  287|      0|          nbytes += n;
  288|      0|        }
  289|       |
  290|       |      /* Make buffer large enough to be later used as output buffer.  */
  291|      0|      if (nbytes < 100)
  ------------------
  |  Branch (291:11): [True: 0, False: 0]
  ------------------
  292|      0|        nbytes = 100;
  293|      0|      nbytes += 10;  /* Safety margin.  */
  294|       |
  295|       |      /* Fill and hash buffer.  */
  296|      0|      buffer = p = xmalloc (nbytes);
  ------------------
  |  |  107|      0|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  297|      0|      *p++ = sig->pubkey_algo;
  298|      0|      *p++ = sig->digest_algo;
  299|      0|      *p++ = (a >> 24) & 0xff;
  300|      0|      *p++ = (a >> 16) & 0xff;
  301|      0|      *p++ = (a >>  8) & 0xff;
  302|      0|      *p++ =  a & 0xff;
  303|      0|      nbytes -= 6;
  304|      0|      for (i=0; i < nsig; i++ )
  ------------------
  |  Branch (304:17): [True: 0, False: 0]
  ------------------
  305|      0|        {
  306|      0|          if (gcry_mpi_get_flag (sig->data[i], GCRYMPI_FLAG_OPAQUE))
  ------------------
  |  Branch (306:15): [True: 0, False: 0]
  ------------------
  307|      0|            {
  308|      0|              const byte *sigdata;
  309|      0|              unsigned int nbits;
  310|       |
  311|      0|              sigdata = gcry_mpi_get_opaque (sig->data[i], &nbits);
  312|      0|              n = (nbits+7)/8;
  313|      0|              p[0] = nbits >> 8;
  314|      0|              p[1] = (nbits & 0xff);
  315|      0|              memcpy (p+2, sigdata, n);
  316|      0|              n += 2;
  317|      0|            }
  318|      0|          else if (gcry_mpi_print (GCRYMPI_FMT_PGP, p, nbytes, &n, sig->data[i]))
  ------------------
  |  Branch (318:20): [True: 0, False: 0]
  ------------------
  319|      0|            BUG();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  320|      0|          p += n;
  321|      0|          nbytes -= n;
  322|      0|        }
  323|      0|      gcry_md_hash_buffer (GCRY_MD_SHA1, hashbuf, buffer, p-buffer);
  324|       |
  325|      0|      p = make_radix64_string (hashbuf, 20);
  326|      0|      sprintf (buffer, "%s %s %lu",
  327|      0|               p, strtimestamp (sig->timestamp), (ulong)sig->timestamp);
  328|      0|      xfree (p);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  329|      0|      write_status_text (STATUS_SIG_ID, buffer);
  330|      0|      xfree (buffer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  331|      0|    }
  332|       |
  333|  16.2k|  if (r_pk)
  ------------------
  |  Branch (333:7): [True: 16.2k, False: 0]
  ------------------
  334|  16.2k|    *r_pk = pk;
  335|      0|  else
  336|      0|    {
  337|      0|      release_public_key_parts (pk);
  338|      0|      xfree (pk);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  339|      0|    }
  340|       |
  341|  16.2k|  return rc;
  342|  16.2k|}

tdbio_sync:
  429|      2|{
  430|      2|    CACHE_CTRL r;
  431|      2|    int did_lock = 0;
  432|       |
  433|      2|    if( db_fd == -1 )
  ------------------
  |  Branch (433:9): [True: 0, False: 2]
  ------------------
  434|      0|	open_db();
  435|       |#if 0 /* Transactions are not yet used.  */
  436|       |    if( in_transaction )
  437|       |	log_bug("tdbio: syncing while in transaction\n");
  438|       |#endif
  439|       |
  440|      2|    if( !cache_is_dirty )
  ------------------
  |  Branch (440:9): [True: 0, False: 2]
  ------------------
  441|      0|	return 0;
  442|       |
  443|      2|    if (!take_write_lock ())
  ------------------
  |  Branch (443:9): [True: 0, False: 2]
  ------------------
  444|      0|        did_lock = 1;
  445|       |
  446|     33|    for( r = cache_list; r; r = r->next ) {
  ------------------
  |  Branch (446:26): [True: 31, False: 2]
  ------------------
  447|     31|	if( r->flags.used && r->flags.dirty ) {
  ------------------
  |  Branch (447:6): [True: 31, False: 0]
  |  Branch (447:23): [True: 31, False: 0]
  ------------------
  448|     31|	    int rc = write_cache_item( r );
  449|     31|	    if( rc )
  ------------------
  |  Branch (449:10): [True: 0, False: 31]
  ------------------
  450|      0|		return rc;
  451|     31|	}
  452|     31|    }
  453|      2|    cache_is_dirty = 0;
  454|      2|    if (did_lock)
  ------------------
  |  Branch (454:9): [True: 0, False: 2]
  ------------------
  455|      0|        release_write_lock ();
  456|       |
  457|      2|    return 0;
  458|      2|}
tdbio_set_dbname:
  639|      1|{
  640|      1|  char *fname, *p;
  641|      1|  struct stat statbuf;
  642|      1|  static int initialized = 0;
  643|      1|  int save_slash;
  644|       |
  645|      1|  if (!initialized)
  ------------------
  |  Branch (645:7): [True: 1, False: 0]
  ------------------
  646|      1|    {
  647|      1|      atexit (cleanup);
  648|      1|      initialized = 1;
  649|      1|    }
  650|       |
  651|      1|  *r_nofile = 0;
  652|       |
  653|      1|  if (!new_dbname)
  ------------------
  |  Branch (653:7): [True: 1, False: 0]
  ------------------
  654|      1|    {
  655|      1|      fname = make_filename (gnupg_homedir (),
  656|      1|                             "trustdb" EXTSEP_S GPGEXT_GPG, NULL);
  ------------------
  |  |  122|      1|#define GPGEXT_GPG "gpg"
  ------------------
  657|      1|    }
  658|      0|  else if (*new_dbname != DIRSEP_C )
  ------------------
  |  |  886|      0|#define DIRSEP_C '/'
  ------------------
  |  Branch (658:12): [True: 0, False: 0]
  ------------------
  659|      0|    {
  660|      0|      if (strchr (new_dbname, DIRSEP_C))
  ------------------
  |  |  886|      0|#define DIRSEP_C '/'
  ------------------
  |  Branch (660:11): [True: 0, False: 0]
  ------------------
  661|      0|        fname = make_filename (new_dbname, NULL);
  662|      0|      else
  663|      0|        fname = make_filename (gnupg_homedir (), new_dbname, NULL);
  664|      0|    }
  665|      0|  else
  666|      0|    {
  667|      0|      fname = xstrdup (new_dbname);
  ------------------
  |  |  112|      0|#define xstrdup(a)       gcry_xstrdup ((a))
  ------------------
  668|      0|    }
  669|       |
  670|      1|  xfree (db_name);
  ------------------
  |  |  104|      1|#define xfree(a)         gcry_free ((a))
  ------------------
  671|      1|  db_name = fname;
  672|       |
  673|       |  /* Quick check for (likely) case where there already is a
  674|       |   * trustdb.gpg.  This check is not required in theory, but it helps
  675|       |   * in practice avoiding costly operations of preparing and taking
  676|       |   * the lock.  */
  677|      1|  if (!gnupg_stat (fname, &statbuf) && statbuf.st_size > 0)
  ------------------
  |  Branch (677:7): [True: 0, False: 1]
  |  Branch (677:40): [True: 0, False: 0]
  ------------------
  678|      0|    {
  679|       |      /* OK, we have the valid trustdb.gpg already.  */
  680|      0|      return 0;
  681|      0|    }
  682|      1|  else if (!create)
  ------------------
  |  Branch (682:12): [True: 0, False: 1]
  ------------------
  683|      0|    {
  684|      0|      *r_nofile = 1;
  685|      0|      return 0;
  686|      0|    }
  687|       |
  688|       |  /* Here comes: No valid trustdb.gpg AND CREATE==1 */
  689|       |
  690|       |  /*
  691|       |   * Make sure the directory exists.  This should be done before
  692|       |   * acquiring the lock, which assumes the existence of the directory.
  693|       |   */
  694|      1|  p = strrchr (fname, DIRSEP_C);
  ------------------
  |  |  886|      1|#define DIRSEP_C '/'
  ------------------
  695|       |#if HAVE_W32_SYSTEM
  696|       |  {
  697|       |    /* Windows may either have a slash or a backslash.  Take
  698|       |       care of it.  */
  699|       |    char *pp = strrchr (fname, '/');
  700|       |    if (!p || pp > p)
  701|       |      p = pp;
  702|       |  }
  703|       |#endif /*HAVE_W32_SYSTEM*/
  704|      1|  log_assert (p);
  705|      0|  save_slash = *p;
  706|      1|  *p = 0;
  707|      1|  if (gnupg_access (fname, F_OK))
  ------------------
  |  Branch (707:7): [True: 0, False: 1]
  ------------------
  708|      0|    {
  709|      0|      try_make_homedir (fname);
  710|      0|      if (gnupg_access (fname, F_OK))
  ------------------
  |  Branch (710:11): [True: 0, False: 0]
  ------------------
  711|      0|        log_fatal (_("%s: directory does not exist!\n"), fname);
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  712|      0|    }
  713|      1|  *p = save_slash;
  714|       |
  715|      1|  take_write_lock ();
  716|       |
  717|      1|  if (gnupg_access (fname, R_OK)
  ------------------
  |  Branch (717:7): [True: 1, False: 0]
  ------------------
  718|      1|      || gnupg_stat (fname, &statbuf)
  ------------------
  |  Branch (718:10): [True: 0, False: 0]
  ------------------
  719|      1|      || statbuf.st_size == 0)
  ------------------
  |  Branch (719:10): [True: 0, False: 0]
  ------------------
  720|      1|    {
  721|      1|      estream_t fp;
  722|      1|      TRUSTREC rec;
  723|      1|      int rc;
  724|      1|      mode_t oldmask;
  725|       |
  726|      1|      if (errno && errno != ENOENT)
  ------------------
  |  Branch (726:20): [True: 0, False: 1]
  ------------------
  727|      0|        log_fatal ( _("can't access '%s': %s\n"), fname, strerror (errno));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  728|       |
  729|      1|      oldmask = umask (077);
  730|      1|      if (is_secured_filename (fname))
  ------------------
  |  Branch (730:11): [True: 0, False: 1]
  ------------------
  731|      0|        {
  732|      0|          fp = NULL;
  733|      0|          gpg_err_set_errno (EPERM);
  734|      0|        }
  735|      1|      else
  736|      1|        fp = es_fopen (fname, "wb");
  737|      1|      umask(oldmask);
  738|      1|      if (!fp)
  ------------------
  |  Branch (738:11): [True: 0, False: 1]
  ------------------
  739|      0|        log_fatal (_("can't create '%s': %s\n"), fname, strerror (errno));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  740|      1|      es_fclose (fp);
  741|       |
  742|      1|      db_fd = gnupg_open (db_name, O_RDWR | MY_O_BINARY, 0);
  ------------------
  |  |   48|      1|#define MY_O_BINARY  0
  ------------------
  743|      1|      if (db_fd == -1)
  ------------------
  |  Branch (743:11): [True: 0, False: 1]
  ------------------
  744|      0|        log_fatal (_("can't open '%s': %s\n"), db_name, strerror (errno));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  745|       |
  746|      1|      rc = create_version_record (ctrl);
  747|      1|      if (rc)
  ------------------
  |  Branch (747:11): [True: 0, False: 1]
  ------------------
  748|      0|        log_fatal (_("%s: failed to create version record: %s"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  749|      0|                   fname, gpg_strerror (rc));
  750|       |
  751|       |      /* Read again to check that we are okay. */
  752|      1|      if (tdbio_read_record (0, &rec, RECTYPE_VER))
  ------------------
  |  |   36|      1|#define RECTYPE_VER  1
  ------------------
  |  Branch (752:11): [True: 0, False: 1]
  ------------------
  753|      0|        log_fatal (_("%s: invalid trustdb created\n"), db_name);
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  754|       |
  755|      1|      if (!opt.quiet)
  ------------------
  |  Branch (755:11): [True: 1, False: 0]
  ------------------
  756|      1|        log_info (_("%s: trustdb created\n"), db_name);
  ------------------
  |  |   28|      1|#  define _(a) gettext (a)
  ------------------
  757|      1|    }
  758|       |
  759|      1|  release_write_lock ();
  760|      1|  return 0;
  761|      1|}
tdbio_db_matches_options:
  863|      1|{
  864|      1|  static int yes_no = -1;
  865|       |
  866|      1|  if (yes_no == -1)
  ------------------
  |  Branch (866:7): [True: 1, False: 0]
  ------------------
  867|      1|    {
  868|      1|      TRUSTREC vr;
  869|      1|      int rc;
  870|      1|      int opt_tm, tm;
  871|       |
  872|      1|      rc = tdbio_read_record (0, &vr, RECTYPE_VER);
  ------------------
  |  |   36|      1|#define RECTYPE_VER  1
  ------------------
  873|      1|      if( rc )
  ------------------
  |  Branch (873:11): [True: 0, False: 1]
  ------------------
  874|      0|	log_fatal( _("%s: error reading version record: %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  875|      0|		   db_name, gpg_strerror (rc) );
  876|       |
  877|       |      /* Consider tofu and pgp the same.  */
  878|      1|      tm = vr.r.ver.trust_model;
  879|      1|      if (tm == TM_TOFU || tm == TM_TOFU_PGP)
  ------------------
  |  Branch (879:11): [True: 0, False: 1]
  |  Branch (879:28): [True: 0, False: 1]
  ------------------
  880|      0|        tm = TM_PGP;
  881|      1|      opt_tm  = opt.trust_model;
  882|      1|      if (opt_tm == TM_TOFU || opt_tm == TM_TOFU_PGP)
  ------------------
  |  Branch (882:11): [True: 0, False: 1]
  |  Branch (882:32): [True: 0, False: 1]
  ------------------
  883|      0|        opt_tm = TM_PGP;
  884|       |
  885|      1|      yes_no = vr.r.ver.marginals == opt.marginals_needed
  ------------------
  |  Branch (885:16): [True: 1, False: 0]
  ------------------
  886|      1|	&& vr.r.ver.completes == opt.completes_needed
  ------------------
  |  Branch (886:5): [True: 1, False: 0]
  ------------------
  887|      1|	&& vr.r.ver.cert_depth == opt.max_cert_depth
  ------------------
  |  Branch (887:5): [True: 1, False: 0]
  ------------------
  888|      1|	&& tm == opt_tm
  ------------------
  |  Branch (888:5): [True: 1, False: 0]
  ------------------
  889|      1|	&& vr.r.ver.min_cert_level == opt.min_cert_level;
  ------------------
  |  Branch (889:5): [True: 1, False: 0]
  ------------------
  890|      1|    }
  891|       |
  892|      1|  return yes_no;
  893|      1|}
tdbio_read_nextcheck:
  920|      1|{
  921|      1|  TRUSTREC vr;
  922|      1|  int rc;
  923|       |
  924|      1|  rc = tdbio_read_record (0, &vr, RECTYPE_VER);
  ------------------
  |  |   36|      1|#define RECTYPE_VER  1
  ------------------
  925|      1|  if (rc)
  ------------------
  |  Branch (925:7): [True: 0, False: 1]
  ------------------
  926|      0|    log_fatal (_("%s: error reading version record: %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  927|      0|               db_name, gpg_strerror (rc));
  928|      1|  return vr.r.ver.nextcheck;
  929|      1|}
tdbio_read_record:
 1490|     33|{
 1491|     33|  byte readbuf[TRUST_RECORD_LEN];
 1492|     33|  const byte *buf, *p;
 1493|     33|  gpg_error_t err = 0;
 1494|     33|  int n, i;
 1495|       |
 1496|     33|  if (db_fd == -1)
  ------------------
  |  Branch (1496:7): [True: 0, False: 33]
  ------------------
 1497|      0|    open_db ();
 1498|       |
 1499|     33|  buf = get_record_from_cache( recnum );
 1500|     33|  if (!buf)
  ------------------
  |  Branch (1500:7): [True: 1, False: 32]
  ------------------
 1501|      1|    {
 1502|      1|      if (lseek (db_fd, recnum * TRUST_RECORD_LEN, SEEK_SET) == -1)
  ------------------
  |  |   25|      1|#define TRUST_RECORD_LEN 40
  ------------------
  |  Branch (1502:11): [True: 0, False: 1]
  ------------------
 1503|      0|        {
 1504|      0|          err = gpg_error_from_syserror ();
 1505|      0|          log_error (_("trustdb: lseek failed: %s\n"), strerror (errno));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 1506|      0|          return err;
 1507|      0|	}
 1508|      1|      n = read (db_fd, readbuf, TRUST_RECORD_LEN);
  ------------------
  |  |   25|      1|#define TRUST_RECORD_LEN 40
  ------------------
 1509|      1|      if (!n)
  ------------------
  |  Branch (1509:11): [True: 1, False: 0]
  ------------------
 1510|      1|        {
 1511|      1|          return gpg_error (GPG_ERR_EOF);
 1512|      1|	}
 1513|      0|      else if (n != TRUST_RECORD_LEN)
  ------------------
  |  |   25|      0|#define TRUST_RECORD_LEN 40
  ------------------
  |  Branch (1513:16): [True: 0, False: 0]
  ------------------
 1514|      0|        {
 1515|      0|          err = gpg_error_from_syserror ();
 1516|      0|          log_error (_("trustdb: read failed (n=%d): %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 1517|      0|                     n, strerror(errno));
 1518|      0|          return err;
 1519|      0|	}
 1520|      0|      buf = readbuf;
 1521|      0|    }
 1522|     32|  rec->recnum = recnum;
 1523|     32|  rec->dirty = 0;
 1524|     32|  p = buf;
 1525|     32|  rec->rectype = *p++;
 1526|     32|  if (expected && rec->rectype != expected)
  ------------------
  |  Branch (1526:7): [True: 3, False: 29]
  |  Branch (1526:19): [True: 0, False: 3]
  ------------------
 1527|      0|    {
 1528|      0|      log_error ("%lu: read expected rec type %d, got %d\n",
 1529|      0|                 recnum, expected, rec->rectype);
 1530|      0|      return gpg_error (GPG_ERR_TRUSTDB);
 1531|      0|    }
 1532|     32|  p++;    /* Skip reserved byte.  */
 1533|     32|  switch (rec->rectype)
 1534|     32|    {
 1535|      0|    case 0:  /* unused (free) record */
  ------------------
  |  Branch (1535:5): [True: 0, False: 32]
  ------------------
 1536|      0|      break;
 1537|       |
 1538|      3|    case RECTYPE_VER: /* version record */
  ------------------
  |  |   36|      3|#define RECTYPE_VER  1
  ------------------
  |  Branch (1538:5): [True: 3, False: 29]
  ------------------
 1539|      3|      if (memcmp(buf+1, GPGEXT_GPG, 3))
  ------------------
  |  |  122|      3|#define GPGEXT_GPG "gpg"
  ------------------
  |  Branch (1539:11): [True: 0, False: 3]
  ------------------
 1540|      0|        {
 1541|      0|          log_error (_("%s: not a trustdb file\n"), db_name );
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 1542|      0|          err = gpg_error (GPG_ERR_TRUSTDB);
 1543|      0|        }
 1544|      3|      else
 1545|      3|        {
 1546|      3|          p += 2; /* skip "gpg" */
 1547|      3|          rec->r.ver.version  = *p++;
 1548|      3|          rec->r.ver.marginals = *p++;
 1549|      3|          rec->r.ver.completes = *p++;
 1550|      3|          rec->r.ver.cert_depth = *p++;
 1551|      3|          rec->r.ver.trust_model = *p++;
 1552|      3|          rec->r.ver.min_cert_level = *p++;
 1553|      3|          p += 2;
 1554|      3|          rec->r.ver.created  = buf32_to_ulong(p);
 1555|      3|          p += 4;
 1556|      3|          rec->r.ver.nextcheck = buf32_to_ulong(p);
 1557|      3|          p += 4;
 1558|      3|          p += 4;
 1559|      3|          p += 4;
 1560|      3|          rec->r.ver.firstfree = buf32_to_ulong(p);
 1561|      3|          p += 4;
 1562|      3|          p += 4;
 1563|      3|          rec->r.ver.trusthashtbl = buf32_to_ulong(p);
 1564|      3|          if (recnum)
  ------------------
  |  Branch (1564:15): [True: 0, False: 3]
  ------------------
 1565|      0|            {
 1566|      0|              log_error( _("%s: version record with recnum %lu\n"), db_name,
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 1567|      0|                         (ulong)recnum );
 1568|      0|              err = gpg_error (GPG_ERR_TRUSTDB);
 1569|      0|            }
 1570|      3|          else if (rec->r.ver.version != 3)
  ------------------
  |  Branch (1570:20): [True: 0, False: 3]
  ------------------
 1571|      0|            {
 1572|      0|              log_error( _("%s: invalid file version %d\n"), db_name,
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 1573|      0|                         rec->r.ver.version );
 1574|      0|              err = gpg_error (GPG_ERR_TRUSTDB);
 1575|      0|            }
 1576|      3|        }
 1577|      3|      break;
 1578|       |
 1579|      0|    case RECTYPE_FREE:
  ------------------
  |  |   41|      0|#define RECTYPE_FREE 254
  ------------------
  |  Branch (1579:5): [True: 0, False: 32]
  ------------------
 1580|      0|      rec->r.free.next  = buf32_to_ulong(p);
 1581|      0|      break;
 1582|       |
 1583|     29|    case RECTYPE_HTBL:
  ------------------
  |  |   37|     29|#define RECTYPE_HTBL 10
  ------------------
  |  Branch (1583:5): [True: 29, False: 3]
  ------------------
 1584|    290|      for (i=0; i < ITEMS_PER_HTBL_RECORD; i++)
  ------------------
  |  |   27|    290|#define ITEMS_PER_HTBL_RECORD	((TRUST_RECORD_LEN-2)/4)
  |  |  ------------------
  |  |  |  |   25|    290|#define TRUST_RECORD_LEN 40
  |  |  ------------------
  ------------------
  |  Branch (1584:17): [True: 261, False: 29]
  ------------------
 1585|    261|        {
 1586|    261|          rec->r.htbl.item[i] = buf32_to_ulong(p);
 1587|    261|          p += 4;
 1588|    261|	}
 1589|     29|      break;
 1590|       |
 1591|      0|    case RECTYPE_HLST:
  ------------------
  |  |   38|      0|#define RECTYPE_HLST 11
  ------------------
  |  Branch (1591:5): [True: 0, False: 32]
  ------------------
 1592|      0|      rec->r.hlst.next = buf32_to_ulong(p);
 1593|      0|      p += 4;
 1594|      0|      for (i=0; i < ITEMS_PER_HLST_RECORD; i++)
  ------------------
  |  |   28|      0|#define ITEMS_PER_HLST_RECORD	((TRUST_RECORD_LEN-6)/5)
  |  |  ------------------
  |  |  |  |   25|      0|#define TRUST_RECORD_LEN 40
  |  |  ------------------
  ------------------
  |  Branch (1594:17): [True: 0, False: 0]
  ------------------
 1595|      0|        {
 1596|      0|          rec->r.hlst.rnum[i] = buf32_to_ulong(p);
 1597|      0|          p += 4;
 1598|      0|	}
 1599|      0|      break;
 1600|       |
 1601|      0|    case RECTYPE_TRUST:
  ------------------
  |  |   39|      0|#define RECTYPE_TRUST 12
  ------------------
  |  Branch (1601:5): [True: 0, False: 32]
  ------------------
 1602|      0|      memcpy (rec->r.trust.fingerprint, p, 20);
 1603|      0|      p+=20;
 1604|      0|      rec->r.trust.ownertrust = *p++;
 1605|      0|      rec->r.trust.depth = *p++;
 1606|      0|      rec->r.trust.min_ownertrust = *p++;
 1607|      0|      rec->r.trust.flags = *p++;
 1608|      0|      rec->r.trust.validlist = buf32_to_ulong(p);
 1609|      0|      break;
 1610|       |
 1611|      0|    case RECTYPE_VALID:
  ------------------
  |  |   40|      0|#define RECTYPE_VALID 13
  ------------------
  |  Branch (1611:5): [True: 0, False: 32]
  ------------------
 1612|      0|      memcpy (rec->r.valid.namehash, p, 20);
 1613|      0|      p+=20;
 1614|      0|      rec->r.valid.validity = *p++;
 1615|      0|      rec->r.valid.next = buf32_to_ulong(p);
 1616|      0|      p += 4;
 1617|      0|      rec->r.valid.full_count = *p++;
 1618|      0|      rec->r.valid.marginal_count = *p++;
 1619|      0|      break;
 1620|       |
 1621|      0|    default:
  ------------------
  |  Branch (1621:5): [True: 0, False: 32]
  ------------------
 1622|      0|      log_error ("%s: invalid record type %d at recnum %lu\n",
 1623|      0|                 db_name, rec->rectype, (ulong)recnum);
 1624|      0|      err = gpg_error (GPG_ERR_TRUSTDB);
 1625|      0|      break;
 1626|     32|    }
 1627|       |
 1628|     32|  return err;
 1629|     32|}
tdbio_write_record:
 1639|     31|{
 1640|     31|  byte buf[TRUST_RECORD_LEN];
 1641|     31|  byte *p;
 1642|     31|  int rc = 0;
 1643|     31|  int i;
 1644|     31|  ulong recnum = rec->recnum;
 1645|       |
 1646|     31|  if (db_fd == -1)
  ------------------
  |  Branch (1646:7): [True: 0, False: 31]
  ------------------
 1647|      0|    open_db ();
 1648|       |
 1649|     31|  memset (buf, 0, TRUST_RECORD_LEN);
  ------------------
  |  |   25|     31|#define TRUST_RECORD_LEN 40
  ------------------
 1650|     31|  p = buf;
 1651|     31|  *p++ = rec->rectype; p++;
 1652|       |
 1653|     31|  switch (rec->rectype)
 1654|     31|    {
 1655|      0|    case 0:  /* unused record */
  ------------------
  |  Branch (1655:5): [True: 0, False: 31]
  ------------------
 1656|      0|      break;
 1657|       |
 1658|      2|    case RECTYPE_VER: /* version record */
  ------------------
  |  |   36|      2|#define RECTYPE_VER  1
  ------------------
  |  Branch (1658:5): [True: 2, False: 29]
  ------------------
 1659|      2|      if (recnum)
  ------------------
  |  Branch (1659:11): [True: 0, False: 2]
  ------------------
 1660|      0|        BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1661|      2|      memcpy(p-1, GPGEXT_GPG, 3 ); p += 2;
  ------------------
  |  |  122|      2|#define GPGEXT_GPG "gpg"
  ------------------
 1662|      2|      *p++ = rec->r.ver.version;
 1663|      2|      *p++ = rec->r.ver.marginals;
 1664|      2|      *p++ = rec->r.ver.completes;
 1665|      2|      *p++ = rec->r.ver.cert_depth;
 1666|      2|      *p++ = rec->r.ver.trust_model;
 1667|      2|      *p++ = rec->r.ver.min_cert_level;
 1668|      2|      p += 2;
 1669|      2|      ulongtobuf(p, rec->r.ver.created); p += 4;
  ------------------
  |  |   35|      2|#define ulongtobuf( p, a ) do { 			  \
  |  |   36|      2|			    ((byte*)p)[0] = a >> 24;	\
  |  |   37|      2|			    ((byte*)p)[1] = a >> 16;	\
  |  |   38|      2|			    ((byte*)p)[2] = a >>  8;	\
  |  |   39|      2|			    ((byte*)p)[3] = a	   ;	\
  |  |   40|      2|			} while(0)
  |  |  ------------------
  |  |  |  Branch (40:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1670|      2|      ulongtobuf(p, rec->r.ver.nextcheck); p += 4;
  ------------------
  |  |   35|      2|#define ulongtobuf( p, a ) do { 			  \
  |  |   36|      2|			    ((byte*)p)[0] = a >> 24;	\
  |  |   37|      2|			    ((byte*)p)[1] = a >> 16;	\
  |  |   38|      2|			    ((byte*)p)[2] = a >>  8;	\
  |  |   39|      2|			    ((byte*)p)[3] = a	   ;	\
  |  |   40|      2|			} while(0)
  |  |  ------------------
  |  |  |  Branch (40:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1671|      2|      p += 4;
 1672|      2|      p += 4;
 1673|      2|      ulongtobuf(p, rec->r.ver.firstfree ); p += 4;
  ------------------
  |  |   35|      2|#define ulongtobuf( p, a ) do { 			  \
  |  |   36|      2|			    ((byte*)p)[0] = a >> 24;	\
  |  |   37|      2|			    ((byte*)p)[1] = a >> 16;	\
  |  |   38|      2|			    ((byte*)p)[2] = a >>  8;	\
  |  |   39|      2|			    ((byte*)p)[3] = a	   ;	\
  |  |   40|      2|			} while(0)
  |  |  ------------------
  |  |  |  Branch (40:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1674|      2|      p += 4;
 1675|      2|      ulongtobuf(p, rec->r.ver.trusthashtbl ); p += 4;
  ------------------
  |  |   35|      2|#define ulongtobuf( p, a ) do { 			  \
  |  |   36|      2|			    ((byte*)p)[0] = a >> 24;	\
  |  |   37|      2|			    ((byte*)p)[1] = a >> 16;	\
  |  |   38|      2|			    ((byte*)p)[2] = a >>  8;	\
  |  |   39|      2|			    ((byte*)p)[3] = a	   ;	\
  |  |   40|      2|			} while(0)
  |  |  ------------------
  |  |  |  Branch (40:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1676|      2|      break;
 1677|       |
 1678|      0|    case RECTYPE_FREE:
  ------------------
  |  |   41|      0|#define RECTYPE_FREE 254
  ------------------
  |  Branch (1678:5): [True: 0, False: 31]
  ------------------
 1679|      0|      ulongtobuf(p, rec->r.free.next); p += 4;
  ------------------
  |  |   35|      0|#define ulongtobuf( p, a ) do { 			  \
  |  |   36|      0|			    ((byte*)p)[0] = a >> 24;	\
  |  |   37|      0|			    ((byte*)p)[1] = a >> 16;	\
  |  |   38|      0|			    ((byte*)p)[2] = a >>  8;	\
  |  |   39|      0|			    ((byte*)p)[3] = a	   ;	\
  |  |   40|      0|			} while(0)
  |  |  ------------------
  |  |  |  Branch (40:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1680|      0|      break;
 1681|       |
 1682|     29|    case RECTYPE_HTBL:
  ------------------
  |  |   37|     29|#define RECTYPE_HTBL 10
  ------------------
  |  Branch (1682:5): [True: 29, False: 2]
  ------------------
 1683|    290|      for (i=0; i < ITEMS_PER_HTBL_RECORD; i++)
  ------------------
  |  |   27|    290|#define ITEMS_PER_HTBL_RECORD	((TRUST_RECORD_LEN-2)/4)
  |  |  ------------------
  |  |  |  |   25|    290|#define TRUST_RECORD_LEN 40
  |  |  ------------------
  ------------------
  |  Branch (1683:17): [True: 261, False: 29]
  ------------------
 1684|    261|        {
 1685|    261|          ulongtobuf( p, rec->r.htbl.item[i]); p += 4;
  ------------------
  |  |   35|    261|#define ulongtobuf( p, a ) do { 			  \
  |  |   36|    261|			    ((byte*)p)[0] = a >> 24;	\
  |  |   37|    261|			    ((byte*)p)[1] = a >> 16;	\
  |  |   38|    261|			    ((byte*)p)[2] = a >>  8;	\
  |  |   39|    261|			    ((byte*)p)[3] = a	   ;	\
  |  |   40|    261|			} while(0)
  |  |  ------------------
  |  |  |  Branch (40:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1686|    261|        }
 1687|     29|      break;
 1688|       |
 1689|      0|    case RECTYPE_HLST:
  ------------------
  |  |   38|      0|#define RECTYPE_HLST 11
  ------------------
  |  Branch (1689:5): [True: 0, False: 31]
  ------------------
 1690|      0|      ulongtobuf( p, rec->r.hlst.next); p += 4;
  ------------------
  |  |   35|      0|#define ulongtobuf( p, a ) do { 			  \
  |  |   36|      0|			    ((byte*)p)[0] = a >> 24;	\
  |  |   37|      0|			    ((byte*)p)[1] = a >> 16;	\
  |  |   38|      0|			    ((byte*)p)[2] = a >>  8;	\
  |  |   39|      0|			    ((byte*)p)[3] = a	   ;	\
  |  |   40|      0|			} while(0)
  |  |  ------------------
  |  |  |  Branch (40:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1691|      0|      for (i=0; i < ITEMS_PER_HLST_RECORD; i++ )
  ------------------
  |  |   28|      0|#define ITEMS_PER_HLST_RECORD	((TRUST_RECORD_LEN-6)/5)
  |  |  ------------------
  |  |  |  |   25|      0|#define TRUST_RECORD_LEN 40
  |  |  ------------------
  ------------------
  |  Branch (1691:17): [True: 0, False: 0]
  ------------------
 1692|      0|        {
 1693|      0|          ulongtobuf( p, rec->r.hlst.rnum[i]); p += 4;
  ------------------
  |  |   35|      0|#define ulongtobuf( p, a ) do { 			  \
  |  |   36|      0|			    ((byte*)p)[0] = a >> 24;	\
  |  |   37|      0|			    ((byte*)p)[1] = a >> 16;	\
  |  |   38|      0|			    ((byte*)p)[2] = a >>  8;	\
  |  |   39|      0|			    ((byte*)p)[3] = a	   ;	\
  |  |   40|      0|			} while(0)
  |  |  ------------------
  |  |  |  Branch (40:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1694|      0|	}
 1695|      0|      break;
 1696|       |
 1697|      0|    case RECTYPE_TRUST:
  ------------------
  |  |   39|      0|#define RECTYPE_TRUST 12
  ------------------
  |  Branch (1697:5): [True: 0, False: 31]
  ------------------
 1698|      0|      memcpy (p, rec->r.trust.fingerprint, 20); p += 20;
 1699|      0|      *p++ = rec->r.trust.ownertrust;
 1700|      0|      *p++ = rec->r.trust.depth;
 1701|      0|      *p++ = rec->r.trust.min_ownertrust;
 1702|      0|      *p++ = rec->r.trust.flags;
 1703|      0|      ulongtobuf( p, rec->r.trust.validlist); p += 4;
  ------------------
  |  |   35|      0|#define ulongtobuf( p, a ) do { 			  \
  |  |   36|      0|			    ((byte*)p)[0] = a >> 24;	\
  |  |   37|      0|			    ((byte*)p)[1] = a >> 16;	\
  |  |   38|      0|			    ((byte*)p)[2] = a >>  8;	\
  |  |   39|      0|			    ((byte*)p)[3] = a	   ;	\
  |  |   40|      0|			} while(0)
  |  |  ------------------
  |  |  |  Branch (40:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1704|      0|      break;
 1705|       |
 1706|      0|    case RECTYPE_VALID:
  ------------------
  |  |   40|      0|#define RECTYPE_VALID 13
  ------------------
  |  Branch (1706:5): [True: 0, False: 31]
  ------------------
 1707|      0|      memcpy (p, rec->r.valid.namehash, 20); p += 20;
 1708|      0|      *p++ = rec->r.valid.validity;
 1709|      0|      ulongtobuf( p, rec->r.valid.next); p += 4;
  ------------------
  |  |   35|      0|#define ulongtobuf( p, a ) do { 			  \
  |  |   36|      0|			    ((byte*)p)[0] = a >> 24;	\
  |  |   37|      0|			    ((byte*)p)[1] = a >> 16;	\
  |  |   38|      0|			    ((byte*)p)[2] = a >>  8;	\
  |  |   39|      0|			    ((byte*)p)[3] = a	   ;	\
  |  |   40|      0|			} while(0)
  |  |  ------------------
  |  |  |  Branch (40:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1710|      0|      *p++ = rec->r.valid.full_count;
 1711|      0|      *p++ = rec->r.valid.marginal_count;
 1712|      0|      break;
 1713|       |
 1714|      0|    default:
  ------------------
  |  Branch (1714:5): [True: 0, False: 31]
  ------------------
 1715|      0|      BUG();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1716|     31|    }
 1717|       |
 1718|     31|  rc = put_record_into_cache (recnum, buf);
 1719|     31|  if (rc)
  ------------------
  |  Branch (1719:7): [True: 0, False: 31]
  ------------------
 1720|      0|    ;
 1721|     31|  else if (rec->rectype == RECTYPE_TRUST)
  ------------------
  |  |   39|     31|#define RECTYPE_TRUST 12
  ------------------
  |  Branch (1721:12): [True: 0, False: 31]
  ------------------
 1722|      0|    rc = update_trusthashtbl (ctrl, rec);
 1723|       |
 1724|     31|  return rc;
 1725|     31|}
tdbio.c:take_write_lock:
  131|      3|{
  132|      3|  int rc;
  133|       |
  134|      3|  if (!lockhandle)
  ------------------
  |  Branch (134:7): [True: 1, False: 2]
  ------------------
  135|      1|    lockhandle = dotlock_create (db_name, 0);
  136|      3|  if (!lockhandle)
  ------------------
  |  Branch (136:7): [True: 0, False: 3]
  ------------------
  137|      0|    log_fatal ( _("can't create lock for '%s'\n"), db_name );
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  138|       |
  139|      3|  if (!is_locked)
  ------------------
  |  Branch (139:7): [True: 1, False: 2]
  ------------------
  140|      1|    {
  141|      1|      if (dotlock_take (lockhandle, -1) )
  ------------------
  |  Branch (141:11): [True: 0, False: 1]
  ------------------
  142|      0|        log_fatal ( _("can't lock '%s'\n"), db_name );
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  143|      1|      rc = 0;
  144|      1|    }
  145|      2|  else
  146|      2|    rc = 1;
  147|       |
  148|      3|  if (opt.lock_once)
  ------------------
  |  Branch (148:7): [True: 0, False: 3]
  ------------------
  149|      0|    is_locked = 1;
  150|      3|  else
  151|      3|    is_locked++;
  152|      3|  return rc;
  153|      3|}
tdbio.c:write_cache_item:
  210|     31|{
  211|     31|  gpg_error_t err;
  212|     31|  int n;
  213|       |
  214|     31|  if (lseek (db_fd, r->recno * TRUST_RECORD_LEN, SEEK_SET) == -1)
  ------------------
  |  |   25|     31|#define TRUST_RECORD_LEN 40
  ------------------
  |  Branch (214:7): [True: 0, False: 31]
  ------------------
  215|      0|    {
  216|      0|      err = gpg_error_from_syserror ();
  217|      0|      log_error (_("trustdb rec %lu: lseek failed: %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  218|      0|                 r->recno, strerror (errno));
  219|      0|      return err;
  220|      0|    }
  221|     31|  n = write (db_fd, r->data, TRUST_RECORD_LEN);
  ------------------
  |  |   25|     31|#define TRUST_RECORD_LEN 40
  ------------------
  222|     31|  if (n != TRUST_RECORD_LEN)
  ------------------
  |  |   25|     31|#define TRUST_RECORD_LEN 40
  ------------------
  |  Branch (222:7): [True: 0, False: 31]
  ------------------
  223|      0|    {
  224|      0|      err = gpg_error_from_syserror ();
  225|      0|      log_error (_("trustdb rec %lu: write failed (n=%d): %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  226|      0|                 r->recno, n, strerror (errno) );
  227|      0|      return err;
  228|      0|    }
  229|     31|  r->flags.dirty = 0;
  230|     31|  return 0;
  231|     31|}
tdbio.c:release_write_lock:
  162|      1|{
  163|      1|  if (opt.lock_once)
  ------------------
  |  Branch (163:7): [True: 0, False: 1]
  ------------------
  164|      0|    return;  /* Don't care; here IS_LOCKED is fixed to 1.  */
  165|       |
  166|      1|  if (!is_locked)
  ------------------
  |  Branch (166:7): [True: 0, False: 1]
  ------------------
  167|      0|    {
  168|      0|      log_error ("Ooops, tdbio:release_write_lock with no lock held\n");
  169|      0|      return;
  170|      0|    }
  171|      1|  if (--is_locked)
  ------------------
  |  Branch (171:7): [True: 1, False: 0]
  ------------------
  172|      1|    return;
  173|       |
  174|      0|  if (dotlock_release (lockhandle))
  ------------------
  |  Branch (174:7): [True: 0, False: 0]
  ------------------
  175|      0|    log_error ("Oops, tdbio:release_write_locked failed\n");
  176|      0|}
tdbio.c:cleanup:
  538|      1|{
  539|      1|  if (is_locked)
  ------------------
  |  Branch (539:7): [True: 1, False: 0]
  ------------------
  540|      1|    {
  541|      1|      if (!dotlock_release (lockhandle))
  ------------------
  |  Branch (541:11): [True: 1, False: 0]
  ------------------
  542|      1|        is_locked = 0;
  543|      1|    }
  544|      1|}
tdbio.c:create_version_record:
  590|      1|{
  591|      1|  TRUSTREC rec;
  592|      1|  int rc;
  593|      1|  int opt_tm;
  594|       |
  595|       |  /* Never store a TOFU trust model in the trustdb.  Use PGP instead.  */
  596|      1|  opt_tm = opt.trust_model;
  597|      1|  if (opt_tm == TM_TOFU || opt_tm == TM_TOFU_PGP)
  ------------------
  |  Branch (597:7): [True: 0, False: 1]
  |  Branch (597:28): [True: 0, False: 1]
  ------------------
  598|      0|    opt_tm = TM_PGP;
  599|       |
  600|      1|  memset (&rec, 0, sizeof rec);
  601|      1|  rec.r.ver.version     = 3;
  602|      1|  rec.r.ver.created     = make_timestamp ();
  603|      1|  rec.r.ver.marginals   = opt.marginals_needed;
  604|      1|  rec.r.ver.completes   = opt.completes_needed;
  605|      1|  rec.r.ver.cert_depth  = opt.max_cert_depth;
  606|      1|  if (opt_tm == TM_PGP || opt_tm == TM_CLASSIC)
  ------------------
  |  Branch (606:7): [True: 0, False: 1]
  |  Branch (606:27): [True: 1, False: 0]
  ------------------
  607|      1|    rec.r.ver.trust_model = opt_tm;
  608|      0|  else
  609|      0|    rec.r.ver.trust_model = TM_PGP;
  610|      1|  rec.r.ver.min_cert_level = opt.min_cert_level;
  611|      1|  rec.rectype = RECTYPE_VER;
  ------------------
  |  |   36|      1|#define RECTYPE_VER  1
  ------------------
  612|      1|  rec.recnum = 0;
  613|      1|  rc = tdbio_write_record (ctrl, &rec);
  614|       |
  615|      1|  if (!rc)
  ------------------
  |  Branch (615:7): [True: 1, False: 0]
  ------------------
  616|      1|    tdbio_sync ();
  617|       |
  618|      1|  if (!rc)
  ------------------
  |  Branch (618:7): [True: 1, False: 0]
  ------------------
  619|      1|    create_hashtable (ctrl, &rec, 0);
  620|       |
  621|      1|  return rc;
  622|      1|}
tdbio.c:create_hashtable:
  818|      1|{
  819|      1|  TRUSTREC rec;
  820|      1|  off_t offset;
  821|      1|  ulong recnum;
  822|      1|  int i, n, rc;
  823|       |
  824|      1|  offset = lseek (db_fd, 0, SEEK_END);
  825|      1|  if (offset == -1)
  ------------------
  |  Branch (825:7): [True: 0, False: 1]
  ------------------
  826|      0|    log_fatal ("trustdb: lseek to end failed: %s\n", strerror(errno));
  827|      1|  recnum = offset / TRUST_RECORD_LEN;
  ------------------
  |  |   25|      1|#define TRUST_RECORD_LEN 40
  ------------------
  828|      1|  log_assert (recnum); /* This is will never be the first record. */
  829|       |
  830|      1|  if (!type)
  ------------------
  |  Branch (830:7): [True: 1, False: 0]
  ------------------
  831|      1|    vr->r.ver.trusthashtbl = recnum;
  832|       |
  833|       |  /* Now write the records making up the hash table. */
  834|      1|  n = (256+ITEMS_PER_HTBL_RECORD-1) / ITEMS_PER_HTBL_RECORD;
  ------------------
  |  |   27|      1|#define ITEMS_PER_HTBL_RECORD	((TRUST_RECORD_LEN-2)/4)
  |  |  ------------------
  |  |  |  |   25|      1|#define TRUST_RECORD_LEN 40
  |  |  ------------------
  ------------------
                n = (256+ITEMS_PER_HTBL_RECORD-1) / ITEMS_PER_HTBL_RECORD;
  ------------------
  |  |   27|      1|#define ITEMS_PER_HTBL_RECORD	((TRUST_RECORD_LEN-2)/4)
  |  |  ------------------
  |  |  |  |   25|      1|#define TRUST_RECORD_LEN 40
  |  |  ------------------
  ------------------
  835|     30|  for (i=0; i < n; i++, recnum++)
  ------------------
  |  Branch (835:13): [True: 29, False: 1]
  ------------------
  836|     29|    {
  837|     29|      memset (&rec, 0, sizeof rec);
  838|     29|      rec.rectype = RECTYPE_HTBL;
  ------------------
  |  |   37|     29|#define RECTYPE_HTBL 10
  ------------------
  839|     29|      rec.recnum = recnum;
  840|     29|      rc = tdbio_write_record (ctrl, &rec);
  841|     29|      if (rc)
  ------------------
  |  Branch (841:11): [True: 0, False: 29]
  ------------------
  842|      0|        log_fatal (_("%s: failed to create hashtable: %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  843|      0|                   db_name, gpg_strerror (rc));
  844|     29|    }
  845|       |  /* Update the version record and flush. */
  846|      1|  rc = tdbio_write_record (ctrl, vr);
  847|      1|  if (!rc)
  ------------------
  |  Branch (847:7): [True: 1, False: 0]
  ------------------
  848|      1|    rc = tdbio_sync ();
  849|      1|  if (rc)
  ------------------
  |  Branch (849:7): [True: 0, False: 1]
  ------------------
  850|      0|    log_fatal (_("%s: error updating version record: %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  851|      0|               db_name, gpg_strerror (rc));
  852|      1|}
tdbio.c:get_record_from_cache:
  191|     33|{
  192|     33|  CACHE_CTRL r;
  193|       |
  194|    556|  for (r = cache_list; r; r = r->next)
  ------------------
  |  Branch (194:24): [True: 555, False: 1]
  ------------------
  195|    555|    {
  196|    555|      if (r->flags.used && r->recno == recno)
  ------------------
  |  Branch (196:11): [True: 555, False: 0]
  |  Branch (196:28): [True: 32, False: 523]
  ------------------
  197|     32|        return r->data;
  198|    555|    }
  199|      1|  return NULL;
  200|     33|}
tdbio.c:put_record_into_cache:
  242|     31|{
  243|     31|  CACHE_CTRL r, unused;
  244|     31|  int dirty_count = 0;
  245|     31|  int clean_count = 0;
  246|       |
  247|       |  /* See whether we already cached this one.  */
  248|    495|  for (unused = NULL, r = cache_list; r; r = r->next)
  ------------------
  |  Branch (248:39): [True: 465, False: 30]
  ------------------
  249|    465|    {
  250|    465|      if (!r->flags.used)
  ------------------
  |  Branch (250:11): [True: 0, False: 465]
  ------------------
  251|      0|        {
  252|      0|          if (!unused)
  ------------------
  |  Branch (252:15): [True: 0, False: 0]
  ------------------
  253|      0|            unused = r;
  254|      0|	}
  255|    465|      else if (r->recno == recno)
  ------------------
  |  Branch (255:16): [True: 1, False: 464]
  ------------------
  256|      1|        {
  257|      1|          if (!r->flags.dirty)
  ------------------
  |  Branch (257:15): [True: 1, False: 0]
  ------------------
  258|      1|            {
  259|       |              /* Hmmm: should we use a copy and compare? */
  260|      1|              if (memcmp (r->data, data, TRUST_RECORD_LEN))
  ------------------
  |  |   25|      1|#define TRUST_RECORD_LEN 40
  ------------------
  |  Branch (260:19): [True: 1, False: 0]
  ------------------
  261|      1|                {
  262|      1|                  r->flags.dirty = 1;
  263|      1|                  cache_is_dirty = 1;
  264|      1|		}
  265|      1|	    }
  266|      1|          memcpy (r->data, data, TRUST_RECORD_LEN);
  ------------------
  |  |   25|      1|#define TRUST_RECORD_LEN 40
  ------------------
  267|      1|          return 0;
  268|      1|	}
  269|    464|      if (r->flags.used)
  ------------------
  |  Branch (269:11): [True: 464, False: 0]
  ------------------
  270|    464|        {
  271|    464|          if (r->flags.dirty)
  ------------------
  |  Branch (271:15): [True: 435, False: 29]
  ------------------
  272|    435|            dirty_count++;
  273|     29|          else
  274|     29|            clean_count++;
  275|    464|	}
  276|    464|    }
  277|       |
  278|       |  /* Not in the cache: add a new entry. */
  279|     30|  if (unused)
  ------------------
  |  Branch (279:7): [True: 0, False: 30]
  ------------------
  280|      0|    {
  281|       |      /* Reuse this entry. */
  282|      0|      r = unused;
  283|      0|      r->flags.used = 1;
  284|      0|      r->recno = recno;
  285|      0|      memcpy (r->data, data, TRUST_RECORD_LEN);
  ------------------
  |  |   25|      0|#define TRUST_RECORD_LEN 40
  ------------------
  286|      0|      r->flags.dirty = 1;
  287|      0|      cache_is_dirty = 1;
  288|      0|      cache_entries++;
  289|      0|      return 0;
  290|      0|    }
  291|       |
  292|       |  /* See whether we reached the limit. */
  293|     30|  if (cache_entries < MAX_CACHE_ENTRIES_SOFT)
  ------------------
  |  |   72|     30|#define MAX_CACHE_ENTRIES_SOFT	200
  ------------------
  |  Branch (293:7): [True: 30, False: 0]
  ------------------
  294|     30|    {
  295|       |      /* No: Put into cache.  */
  296|     30|      r = xmalloc (sizeof *r);
  ------------------
  |  |  107|     30|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  297|     30|      r->flags.used = 1;
  298|     30|      r->recno = recno;
  299|     30|      memcpy (r->data, data, TRUST_RECORD_LEN);
  ------------------
  |  |   25|     30|#define TRUST_RECORD_LEN 40
  ------------------
  300|     30|      r->flags.dirty = 1;
  301|     30|      r->next = cache_list;
  302|     30|      cache_list = r;
  303|     30|      cache_is_dirty = 1;
  304|     30|      cache_entries++;
  305|     30|      return 0;
  306|     30|    }
  307|       |
  308|       |  /* Cache is full: discard some clean entries.  */
  309|      0|  if (clean_count)
  ------------------
  |  Branch (309:7): [True: 0, False: 0]
  ------------------
  310|      0|    {
  311|      0|      int n;
  312|       |
  313|       |      /* We discard a third of the clean entries.  */
  314|      0|      n = clean_count / 3;
  315|      0|      if (!n)
  ------------------
  |  Branch (315:11): [True: 0, False: 0]
  ------------------
  316|      0|        n = 1;
  317|       |
  318|      0|      for (unused = NULL, r = cache_list; r; r = r->next)
  ------------------
  |  Branch (318:43): [True: 0, False: 0]
  ------------------
  319|      0|        {
  320|      0|          if (r->flags.used && !r->flags.dirty)
  ------------------
  |  Branch (320:15): [True: 0, False: 0]
  |  Branch (320:32): [True: 0, False: 0]
  ------------------
  321|      0|            {
  322|      0|              if (!unused)
  ------------------
  |  Branch (322:19): [True: 0, False: 0]
  ------------------
  323|      0|                unused = r;
  324|      0|              r->flags.used = 0;
  325|      0|              cache_entries--;
  326|      0|              if (!--n)
  ------------------
  |  Branch (326:19): [True: 0, False: 0]
  ------------------
  327|      0|                break;
  328|      0|	    }
  329|      0|	}
  330|       |
  331|       |      /* Now put into the cache.  */
  332|      0|      log_assert (unused);
  333|      0|      r = unused;
  334|      0|      r->flags.used = 1;
  335|      0|      r->recno = recno;
  336|      0|      memcpy (r->data, data, TRUST_RECORD_LEN);
  ------------------
  |  |   25|      0|#define TRUST_RECORD_LEN 40
  ------------------
  337|      0|      r->flags.dirty = 1;
  338|      0|      cache_is_dirty = 1;
  339|      0|      cache_entries++;
  340|      0|      return 0;
  341|      0|    }
  342|       |
  343|       |  /* No clean entries: We have to flush some dirty entries.  */
  344|       |#if 0 /* Transactions are not yet used.  */
  345|       |  if (in_transaction)
  346|       |    {
  347|       |      /* But we can't do this while in a transaction.  Thus we
  348|       |       * increase the cache size instead.  */
  349|       |      if (cache_entries < MAX_CACHE_ENTRIES_HARD)
  350|       |        {
  351|       |          if (opt.debug && !(cache_entries % 100))
  352|       |            log_debug ("increasing tdbio cache size\n");
  353|       |          r = xmalloc (sizeof *r);
  354|       |          r->flags.used = 1;
  355|       |          r->recno = recno;
  356|       |          memcpy (r->data, data, TRUST_RECORD_LEN);
  357|       |          r->flags.dirty = 1;
  358|       |          r->next = cache_list;
  359|       |          cache_list = r;
  360|       |          cache_is_dirty = 1;
  361|       |          cache_entries++;
  362|       |          return 0;
  363|       |	}
  364|       |      /* Hard limit for the cache size reached.  */
  365|       |      log_info (_("trustdb transaction too large\n"));
  366|       |      return GPG_ERR_RESOURCE_LIMIT;
  367|       |    }
  368|       |#endif
  369|       |
  370|      0|  if (dirty_count)
  ------------------
  |  Branch (370:7): [True: 0, False: 0]
  ------------------
  371|      0|    {
  372|      0|      int n;
  373|       |
  374|       |      /* Discard some dirty entries. */
  375|      0|      n = dirty_count / 5;
  376|      0|      if (!n)
  ------------------
  |  Branch (376:11): [True: 0, False: 0]
  ------------------
  377|      0|        n = 1;
  378|       |
  379|      0|      take_write_lock ();
  380|      0|      for (unused = NULL, r = cache_list; r; r = r->next)
  ------------------
  |  Branch (380:43): [True: 0, False: 0]
  ------------------
  381|      0|        {
  382|      0|          if (r->flags.used && r->flags.dirty)
  ------------------
  |  Branch (382:15): [True: 0, False: 0]
  |  Branch (382:32): [True: 0, False: 0]
  ------------------
  383|      0|            {
  384|      0|              int rc;
  385|       |
  386|      0|              rc = write_cache_item (r);
  387|      0|              if (rc)
  ------------------
  |  Branch (387:19): [True: 0, False: 0]
  ------------------
  388|      0|                return rc;
  389|      0|              if (!unused)
  ------------------
  |  Branch (389:19): [True: 0, False: 0]
  ------------------
  390|      0|                unused = r;
  391|      0|              r->flags.used = 0;
  392|      0|              cache_entries--;
  393|      0|              if (!--n)
  ------------------
  |  Branch (393:19): [True: 0, False: 0]
  ------------------
  394|      0|                break;
  395|      0|	    }
  396|      0|	}
  397|      0|      release_write_lock ();
  398|       |
  399|       |      /* Now put into the cache.  */
  400|      0|      log_assert (unused);
  401|      0|      r = unused;
  402|      0|      r->flags.used = 1;
  403|      0|      r->recno = recno;
  404|      0|      memcpy (r->data, data, TRUST_RECORD_LEN);
  ------------------
  |  |   25|      0|#define TRUST_RECORD_LEN 40
  ------------------
  405|      0|      r->flags.dirty = 1;
  406|      0|      cache_is_dirty = 1;
  407|      0|      cache_entries++;
  408|      0|      return 0;
  409|      0|    }
  410|       |
  411|       |  /* We should never reach this.  */
  412|      0|  BUG();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  413|      0|}

check_trustdb_stale:
  302|      1|{
  303|      1|#ifndef NO_TRUST_MODELS
  304|      1|  tdb_check_trustdb_stale (ctrl);
  305|       |#else
  306|       |  (void)ctrl;
  307|       |#endif
  308|      1|}

setup_trustdb:
  537|      1|{
  538|       |    /* just store the args */
  539|      1|    if( trustdb_args.init )
  ------------------
  |  Branch (539:9): [True: 0, False: 1]
  ------------------
  540|      0|	return 0;
  541|      1|    trustdb_args.level = level;
  542|      1|    trustdb_args.dbname = dbname? xstrdup(dbname): NULL;
  ------------------
  |  |  112|      0|#define xstrdup(a)       gcry_xstrdup ((a))
  ------------------
  |  Branch (542:27): [True: 0, False: 1]
  ------------------
  543|      1|    return 0;
  544|      1|}
init_trustdb:
  573|      1|{
  574|      1|  int level = trustdb_args.level;
  575|      1|  const char* dbname = trustdb_args.dbname;
  576|       |
  577|      1|  if( trustdb_args.init )
  ------------------
  |  Branch (577:7): [True: 0, False: 1]
  ------------------
  578|      0|    return 0;
  579|       |
  580|      1|  trustdb_args.init = 1;
  581|       |
  582|      1|  if(level==0 || level==1)
  ------------------
  |  Branch (582:6): [True: 0, False: 1]
  |  Branch (582:18): [True: 1, False: 0]
  ------------------
  583|      1|    {
  584|      1|      int rc = tdbio_set_dbname (ctrl, dbname, (!no_create && level),
  ------------------
  |  Branch (584:49): [True: 1, False: 0]
  |  Branch (584:63): [True: 1, False: 0]
  ------------------
  585|      1|                                 &trustdb_args.no_trustdb);
  586|      1|      if (no_create && trustdb_args.no_trustdb)
  ------------------
  |  Branch (586:11): [True: 0, False: 1]
  |  Branch (586:24): [True: 0, False: 0]
  ------------------
  587|      0|        {
  588|       |          /* No trustdb found and the caller asked us not to create
  589|       |           * it.  Return an error and set the initialization state
  590|       |           * back so that we always test for an existing trustdb.  */
  591|      0|          trustdb_args.init = 0;
  592|      0|          return gpg_error (GPG_ERR_ENOENT);
  593|      0|        }
  594|      1|      if (rc)
  ------------------
  |  Branch (594:11): [True: 0, False: 1]
  ------------------
  595|      0|	log_fatal("can't init trustdb: %s\n", gpg_strerror (rc) );
  596|      1|    }
  597|      0|  else
  598|      0|    BUG();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  599|       |
  600|      1|  if(opt.trust_model==TM_AUTO)
  ------------------
  |  Branch (600:6): [True: 0, False: 1]
  ------------------
  601|      0|    {
  602|       |      /* Try and set the trust model off of whatever the trustdb says
  603|       |	 it is. */
  604|      0|      opt.trust_model=tdbio_read_model();
  605|       |
  606|       |      /* Sanity check this ;) */
  607|      0|      if(opt.trust_model != TM_CLASSIC
  ------------------
  |  Branch (607:10): [True: 0, False: 0]
  ------------------
  608|      0|	 && opt.trust_model != TM_PGP
  ------------------
  |  Branch (608:6): [True: 0, False: 0]
  ------------------
  609|      0|	 && opt.trust_model != TM_TOFU_PGP
  ------------------
  |  Branch (609:6): [True: 0, False: 0]
  ------------------
  610|      0|	 && opt.trust_model != TM_TOFU
  ------------------
  |  Branch (610:6): [True: 0, False: 0]
  ------------------
  611|      0|	 && opt.trust_model != TM_EXTERNAL)
  ------------------
  |  Branch (611:6): [True: 0, False: 0]
  ------------------
  612|      0|	{
  613|      0|	  log_info(_("unable to use unknown trust model (%d) - "
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  614|      0|		     "assuming %s trust model\n"),opt.trust_model,"pgp");
  615|      0|	  opt.trust_model = TM_PGP;
  616|      0|	}
  617|       |
  618|      0|      if(opt.verbose)
  ------------------
  |  Branch (618:10): [True: 0, False: 0]
  ------------------
  619|      0|	log_info(_("using %s trust model\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  620|      0|                 trust_model_string (opt.trust_model));
  621|      0|    }
  622|       |
  623|      1|  if (opt.trust_model==TM_PGP || opt.trust_model==TM_CLASSIC
  ------------------
  |  Branch (623:7): [True: 0, False: 1]
  |  Branch (623:34): [True: 1, False: 0]
  ------------------
  624|      1|      || opt.trust_model == TM_TOFU || opt.trust_model == TM_TOFU_PGP)
  ------------------
  |  Branch (624:10): [True: 0, False: 0]
  |  Branch (624:40): [True: 0, False: 0]
  ------------------
  625|      1|    {
  626|       |      /* Verify the list of ultimately trusted keys and move the
  627|       |	 --trusted-keys list there as well. */
  628|      1|      if(level==1)
  ------------------
  |  Branch (628:10): [True: 1, False: 0]
  ------------------
  629|      1|	verify_own_keys (ctrl);
  630|       |
  631|      1|      if(!tdbio_db_matches_options())
  ------------------
  |  Branch (631:10): [True: 0, False: 1]
  ------------------
  632|      0|	pending_check_trustdb=1;
  633|      1|    }
  634|       |
  635|      1|  return 0;
  636|      1|}
tdb_check_trustdb_stale:
 1132|      1|{
 1133|      1|  static int did_nextcheck=0;
 1134|       |
 1135|      1|  init_trustdb (ctrl, 0);
 1136|       |
 1137|      1|  if (trustdb_args.no_trustdb)
  ------------------
  |  Branch (1137:7): [True: 0, False: 1]
  ------------------
 1138|      0|    return;  /* No trustdb => can't be stale.  */
 1139|       |
 1140|      1|  if (!did_nextcheck
  ------------------
  |  Branch (1140:7): [True: 1, False: 0]
  ------------------
 1141|      1|      && (opt.trust_model == TM_PGP || opt.trust_model == TM_CLASSIC
  ------------------
  |  Branch (1141:11): [True: 0, False: 1]
  |  Branch (1141:40): [True: 1, False: 0]
  ------------------
 1142|      1|          || opt.trust_model == TM_TOFU_PGP || opt.trust_model == TM_TOFU))
  ------------------
  |  Branch (1142:14): [True: 0, False: 0]
  |  Branch (1142:48): [True: 0, False: 0]
  ------------------
 1143|      1|    {
 1144|      1|      ulong scheduled;
 1145|       |
 1146|      1|      did_nextcheck = 1;
 1147|      1|      scheduled = tdbio_read_nextcheck ();
 1148|      1|      if ((scheduled && scheduled <= make_timestamp ())
  ------------------
  |  Branch (1148:12): [True: 0, False: 1]
  |  Branch (1148:25): [True: 0, False: 0]
  ------------------
 1149|      1|	  || pending_check_trustdb)
  ------------------
  |  Branch (1149:7): [True: 0, False: 1]
  ------------------
 1150|      0|        {
 1151|      0|          if (opt.no_auto_check_trustdb)
  ------------------
  |  Branch (1151:15): [True: 0, False: 0]
  ------------------
 1152|      0|            {
 1153|      0|              pending_check_trustdb = 1;
 1154|      0|              if (!opt.quiet)
  ------------------
  |  Branch (1154:19): [True: 0, False: 0]
  ------------------
 1155|      0|                log_info (_("please do a --check-trustdb\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 1156|      0|            }
 1157|      0|          else
 1158|      0|            {
 1159|      0|              if (!opt.quiet)
  ------------------
  |  Branch (1159:19): [True: 0, False: 0]
  ------------------
 1160|      0|                log_info (_("checking the trustdb\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 1161|      0|              validate_keys (ctrl, 0);
 1162|      0|            }
 1163|      0|        }
 1164|      1|    }
 1165|      1|}
trustdb.c:verify_own_keys:
  359|      1|{
  360|      1|  TRUSTREC rec;
  361|      1|  ulong recnum;
  362|      1|  int rc;
  363|      1|  struct key_item *k, *k2;
  364|      1|  int need_revalidation = 0;
  365|       |
  366|      1|  if (utk_list)
  ------------------
  |  Branch (366:7): [True: 0, False: 1]
  ------------------
  367|      0|    return; /* Has already been run.  */
  368|       |
  369|       |  /* scan the trustdb to find all ultimately trusted keys */
  370|     30|  for (recnum=1; !tdbio_read_record (recnum, &rec, 0); recnum++ )
  ------------------
  |  Branch (370:18): [True: 29, False: 1]
  ------------------
  371|     29|    {
  372|     29|      if (rec.rectype == RECTYPE_TRUST
  ------------------
  |  |   39|     58|#define RECTYPE_TRUST 12
  ------------------
  |  Branch (372:11): [True: 0, False: 29]
  ------------------
  373|     29|          && (rec.r.trust.ownertrust & TRUST_MASK) == TRUST_ULTIMATE)
  ------------------
  |  |   25|      0|#define TRUST_MASK	 15
  ------------------
                        && (rec.r.trust.ownertrust & TRUST_MASK) == TRUST_ULTIMATE)
  ------------------
  |  |   32|      0|#define TRUST_ULTIMATE	  6  /* u: ultimately trusted */
  ------------------
  |  Branch (373:14): [True: 0, False: 0]
  ------------------
  374|      0|        {
  375|      0|          u32 kid[2];
  376|       |
  377|      0|          keyid_from_fpr20 (ctrl, rec.r.trust.fingerprint, kid);
  378|      0|          if (!add_utk (kid))
  ------------------
  |  Branch (378:15): [True: 0, False: 0]
  ------------------
  379|      0|            log_info (_("key %s occurs more than once in the trustdb\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  380|      0|                      keystr(kid));
  381|      0|          else if ((rec.r.trust.flags & 1))
  ------------------
  |  Branch (381:20): [True: 0, False: 0]
  ------------------
  382|      0|            {
  383|       |              /* Record marked as inserted via --trusted-key.  Is this
  384|       |               * still the case?  */
  385|      0|              for (k2 = user_utk_list; k2; k2 = k2->next)
  ------------------
  |  Branch (385:40): [True: 0, False: 0]
  ------------------
  386|      0|                if (k2->kid[0] == kid[0] && k2->kid[1] == kid[1])
  ------------------
  |  Branch (386:21): [True: 0, False: 0]
  |  Branch (386:45): [True: 0, False: 0]
  ------------------
  387|      0|                  break;
  388|      0|              if (!k2) /* No - clear the flag.  */
  ------------------
  |  Branch (388:19): [True: 0, False: 0]
  ------------------
  389|      0|                {
  390|      0|                  if (DBG_TRUST)
  ------------------
  |  |  353|      0|#define DBG_TRUST  (opt.debug & DBG_TRUST_VALUE)
  |  |  ------------------
  |  |  |  |  340|      0|#define DBG_TRUST_VALUE   256	/* debug the trustdb */
  |  |  ------------------
  |  |  |  Branch (353:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  391|      0|                    log_debug ("clearing former --trusted-key %s\n",
  392|      0|                               keystr (kid));
  393|      0|                  rec.r.trust.ownertrust = TRUST_UNKNOWN;
  ------------------
  |  |   26|      0|#define TRUST_UNKNOWN	  0  /* o: not yet calculated/assigned */
  ------------------
  394|      0|                  rec.r.trust.flags &= ~(rec.r.trust.flags & 1);
  395|      0|                  write_record (ctrl, &rec);
  396|      0|                  need_revalidation = 1;
  397|      0|                }
  398|      0|            }
  399|      0|        }
  400|     29|    }
  401|       |
  402|      1|  if (need_revalidation)
  ------------------
  |  Branch (402:7): [True: 0, False: 1]
  ------------------
  403|      0|    {
  404|      0|      tdb_revalidation_mark (ctrl);
  405|      0|      do_sync ();
  406|      0|    }
  407|       |
  408|       |  /* Put any --trusted-key keys into the trustdb */
  409|      1|  for (k = user_utk_list; k; k = k->next)
  ------------------
  |  Branch (409:27): [True: 0, False: 1]
  ------------------
  410|      0|    {
  411|      0|      if ( add_utk (k->kid) )
  ------------------
  |  Branch (411:12): [True: 0, False: 0]
  ------------------
  412|      0|        { /* not yet in trustDB as ultimately trusted */
  413|      0|          PKT_public_key pk;
  414|       |
  415|      0|          memset (&pk, 0, sizeof pk);
  416|      0|          rc = get_pubkey_with_ldap_fallback (ctrl, &pk, k->kid);
  417|      0|          if (rc)
  ------------------
  |  Branch (417:15): [True: 0, False: 0]
  ------------------
  418|      0|	    log_info(_("key %s: no public key for trusted key - skipped\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  419|      0|		     keystr(k->kid));
  420|      0|          else
  421|      0|	    {
  422|      0|	      tdb_update_ownertrust
  423|      0|                (ctrl, &pk, ((tdb_get_ownertrust (ctrl, &pk, 0) & ~TRUST_MASK)
  ------------------
  |  |   25|      0|#define TRUST_MASK	 15
  ------------------
  424|      0|                             | TRUST_ULTIMATE ),  1);
  ------------------
  |  |   32|      0|#define TRUST_ULTIMATE	  6  /* u: ultimately trusted */
  ------------------
  425|      0|	      release_public_key_parts (&pk);
  426|      0|	    }
  427|       |
  428|      0|          if (!opt.quiet)
  ------------------
  |  Branch (428:15): [True: 0, False: 0]
  ------------------
  429|      0|            log_info (_("key %s marked as ultimately trusted\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  430|      0|                      keystr(k->kid));
  431|      0|        }
  432|      0|    }
  433|       |
  434|       |  /* release the helper table table */
  435|      1|  release_key_items (user_utk_list);
  436|      1|  user_utk_list = NULL;
  437|      1|  return;
  438|      1|}
trustdb.c:release_key_items:
  137|      1|{
  138|      1|  struct key_item *k2;
  139|       |
  140|      1|  for (; k; k = k2)
  ------------------
  |  Branch (140:10): [True: 0, False: 1]
  ------------------
  141|      0|    {
  142|      0|      k2 = k->next;
  143|      0|      xfree (k->trust_regexp);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  144|      0|      xfree (k);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  145|      0|    }
  146|      1|}

verify_signatures:
   52|  12.2k|{
   53|  12.2k|    IOBUF fp;
   54|  12.2k|    armor_filter_context_t *afx = NULL;
   55|  12.2k|    progress_filter_context_t *pfx = new_progress_context ();
   56|  12.2k|    const char *sigfile;
   57|  12.2k|    int i, rc;
   58|  12.2k|    strlist_t sl;
   59|       |
   60|       |    /* Decide whether we should handle a detached or a normal signature,
   61|       |     * which is needed so that the code later can hash the correct data and
   62|       |     * not have a normal signature act as detached signature and ignoring the
   63|       |     * intended signed material from the 2nd file or stdin.
   64|       |     * 1. gpg <file        - normal
   65|       |     * 2. gpg file         - normal (or detached)
   66|       |     * 3. gpg file <file2  - detached
   67|       |     * 4. gpg file file2   - detached
   68|       |     * The question is how decide between case 2 and 3?  The only way
   69|       |     * we can do it is by reading one byte from stdin and then unget
   70|       |     * it; the problem here is that we may be reading from the
   71|       |     * terminal (which could be detected using isatty() but won't work
   72|       |     * when under control of a pty using program (e.g. expect)) and
   73|       |     * might get us in trouble when stdin is used for another purpose
   74|       |     * (--passphrase-fd 0).  So we have to break with the behaviour
   75|       |     * prior to gpg 1.0.4 by assuming that case 3 is a normal
   76|       |     * signature (where file2 is ignored and require for a detached
   77|       |     * signature to indicate signed material comes from stdin by using
   78|       |     * case 4 with a file2 of "-".
   79|       |     *
   80|       |     * Actually we don't have to change anything here but can handle
   81|       |     * that all quite easily in mainproc.c
   82|       |     */
   83|       |
   84|  12.2k|    sigfile = nfiles? *files : NULL;
  ------------------
  |  Branch (84:15): [True: 12.2k, False: 0]
  ------------------
   85|       |
   86|       |    /* open the signature file */
   87|  12.2k|    fp = iobuf_open(sigfile);
   88|  12.2k|    if (fp && is_secured_file (iobuf_get_fd (fp)))
  ------------------
  |  Branch (88:9): [True: 12.2k, False: 0]
  |  Branch (88:15): [True: 0, False: 12.2k]
  ------------------
   89|      0|      {
   90|      0|        iobuf_close (fp);
   91|      0|        fp = NULL;
   92|      0|        gpg_err_set_errno (EPERM);
   93|      0|      }
   94|  12.2k|    if( !fp ) {
  ------------------
  |  Branch (94:9): [True: 0, False: 12.2k]
  ------------------
   95|      0|        rc = gpg_error_from_syserror ();
   96|      0|	log_error(_("can't open '%s': %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
   97|      0|                  print_fname_stdin(sigfile), gpg_strerror (rc));
   98|      0|        goto leave;
   99|      0|    }
  100|  12.2k|    handle_progress (pfx, fp, sigfile);
  101|       |
  102|  12.2k|    if ( !opt.no_armor && use_armor_filter( fp ) )
  ------------------
  |  Branch (102:10): [True: 12.2k, False: 0]
  |  Branch (102:27): [True: 3.33k, False: 8.86k]
  ------------------
  103|  3.33k|      {
  104|  3.33k|        afx = new_armor_context ();
  105|  3.33k|	push_armor_filter (afx, fp);
  106|  3.33k|      }
  107|       |
  108|  12.2k|    sl = NULL;
  109|  12.2k|    for(i=nfiles-1 ; i > 0 ; i-- )
  ------------------
  |  Branch (109:22): [True: 0, False: 12.2k]
  ------------------
  110|      0|	add_to_strlist( &sl, files[i] );
  111|  12.2k|    rc = proc_signature_packets (ctrl, NULL, fp, sl, sigfile );
  112|  12.2k|    free_strlist(sl);
  113|  12.2k|    iobuf_close(fp);
  114|  12.2k|    if( (afx && afx->no_openpgp_data && rc == -1)
  ------------------
  |  Branch (114:10): [True: 3.33k, False: 8.86k]
  |  Branch (114:17): [True: 1.61k, False: 1.72k]
  |  Branch (114:41): [True: 650, False: 963]
  ------------------
  115|  12.2k|        || gpg_err_code (rc) == GPG_ERR_NO_DATA ) {
  ------------------
  |  Branch (115:12): [True: 5.47k, False: 6.08k]
  ------------------
  116|  6.12k|	log_error(_("the signature could not be verified.\n"
  ------------------
  |  |   28|  6.12k|#  define _(a) gettext (a)
  ------------------
  117|  6.12k|		   "Please remember that the signature file (.sig or .asc)\n"
  118|  6.12k|		   "should be the first file given on the command line.\n") );
  119|  6.12k|	rc = 0;
  120|  6.12k|    }
  121|       |
  122|  12.2k| leave:
  123|  12.2k|    release_armor_context (afx);
  124|  12.2k|    release_progress_context (pfx);
  125|  12.2k|    return rc;
  126|  12.2k|}
print_file_status:
  132|  12.2k|{
  133|  12.2k|    char *p = xmalloc(strlen(name)+10);
  ------------------
  |  |  107|  12.2k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  134|  12.2k|    sprintf(p, "%d %s", what, name );
  135|  12.2k|    write_status_text( status, p );
  136|  12.2k|    xfree(p);
  ------------------
  |  |  104|  12.2k|#define xfree(a)         gcry_free ((a))
  ------------------
  137|  12.2k|}
verify_files:
  193|  12.2k|{
  194|  12.2k|    int i, rc;
  195|  12.2k|    int first_rc = 0;
  196|       |
  197|  12.2k|    if( !nfiles ) { /* read the filenames from stdin */
  ------------------
  |  Branch (197:9): [True: 0, False: 12.2k]
  ------------------
  198|      0|	char line[2048];
  199|      0|	unsigned int lno = 0;
  200|       |
  201|      0|	while( fgets(line, DIM(line), stdin) ) {
  ------------------
  |  |   47|      0|#define DIM(v)		     (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (201:9): [True: 0, False: 0]
  ------------------
  202|      0|	    lno++;
  203|      0|	    if( !*line || line[strlen(line)-1] != '\n' ) {
  ------------------
  |  Branch (203:10): [True: 0, False: 0]
  |  Branch (203:20): [True: 0, False: 0]
  ------------------
  204|      0|		log_error(_("input line %u too long or missing LF\n"), lno );
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  205|      0|		return GPG_ERR_GENERAL;
  206|      0|	    }
  207|       |	    /* This code does not work on MSDOS but hwo cares there are
  208|       |	     * also no script languages available.  We don't strip any
  209|       |	     * spaces, so that we can process nearly all filenames */
  210|      0|	    line[strlen(line)-1] = 0;
  211|      0|	    rc = verify_one_file (ctrl, line);
  212|      0|            if (!first_rc)
  ------------------
  |  Branch (212:17): [True: 0, False: 0]
  ------------------
  213|      0|              first_rc = rc;
  214|      0|	}
  215|       |
  216|      0|    }
  217|  12.2k|    else {  /* take filenames from the array */
  218|  24.4k|	for(i=0; i < nfiles; i++ )
  ------------------
  |  Branch (218:11): [True: 12.2k, False: 12.2k]
  ------------------
  219|  12.2k|          {
  220|  12.2k|            rc = verify_one_file (ctrl, files[i]);
  221|  12.2k|            if (!first_rc)
  ------------------
  |  Branch (221:17): [True: 12.2k, False: 0]
  ------------------
  222|  12.2k|              first_rc = rc;
  223|  12.2k|          }
  224|  12.2k|    }
  225|       |
  226|  12.2k|    return first_rc;
  227|  12.2k|}
verify.c:verify_one_file:
  142|  12.2k|{
  143|  12.2k|    IOBUF fp;
  144|  12.2k|    armor_filter_context_t *afx = NULL;
  145|  12.2k|    progress_filter_context_t *pfx = new_progress_context ();
  146|  12.2k|    int rc;
  147|       |
  148|  12.2k|    print_file_status( STATUS_FILE_START, name, 1 );
  149|  12.2k|    fp = iobuf_open(name);
  150|  12.2k|    if (fp)
  ------------------
  |  Branch (150:9): [True: 12.2k, False: 0]
  ------------------
  151|  12.2k|      iobuf_ioctl (fp, IOBUF_IOCTL_NO_CACHE, 1, NULL);
  152|  12.2k|    if (fp && is_secured_file (iobuf_get_fd (fp)))
  ------------------
  |  Branch (152:9): [True: 12.2k, False: 0]
  |  Branch (152:15): [True: 0, False: 12.2k]
  ------------------
  153|      0|      {
  154|      0|        iobuf_close (fp);
  155|      0|        fp = NULL;
  156|      0|        gpg_err_set_errno (EPERM);
  157|      0|      }
  158|  12.2k|    if( !fp ) {
  ------------------
  |  Branch (158:9): [True: 0, False: 12.2k]
  ------------------
  159|      0|        rc = gpg_error_from_syserror ();
  160|      0|	log_error(_("can't open '%s': %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  161|      0|                  print_fname_stdin(name), strerror (errno));
  162|      0|	print_file_status( STATUS_FILE_ERROR, name, 1 );
  163|      0|        goto leave;
  164|      0|    }
  165|  12.2k|    handle_progress (pfx, fp, name);
  166|       |
  167|  12.2k|    if( !opt.no_armor ) {
  ------------------
  |  Branch (167:9): [True: 12.2k, False: 0]
  ------------------
  168|  12.2k|	if( use_armor_filter( fp ) ) {
  ------------------
  |  Branch (168:6): [True: 3.33k, False: 8.86k]
  ------------------
  169|  3.33k|            afx = new_armor_context ();
  170|  3.33k|	    push_armor_filter (afx, fp);
  171|  3.33k|	}
  172|  12.2k|    }
  173|       |
  174|  12.2k|    rc = proc_signature_packets (ctrl, NULL, fp, NULL, name );
  175|  12.2k|    iobuf_close(fp);
  176|  12.2k|    write_status( STATUS_FILE_DONE );
  177|       |
  178|  12.2k|    reset_literals_seen();
  179|       |
  180|  12.2k| leave:
  181|  12.2k|    release_armor_context (afx);
  182|  12.2k|    release_progress_context (pfx);
  183|  12.2k|    return rc;
  184|  12.2k|}

keybox-update.c:buf32_to_u32:
  105|      1|{
  106|      1|  const unsigned char *p = buffer;
  107|       |
  108|      1|  return (((u32)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
  109|      1|}

_keybox_new_blob:
 1050|  4.09k|{
 1051|  4.09k|  KEYBOXBLOB blob;
 1052|       |
 1053|  4.09k|  *r_blob = NULL;
 1054|  4.09k|  blob = xtrycalloc (1, sizeof *blob);
  ------------------
  |  |   99|  4.09k|#define xtrycalloc(a,b)  gcry_calloc ((a),(b))
  ------------------
 1055|  4.09k|  if (!blob)
  ------------------
  |  Branch (1055:7): [True: 0, False: 4.09k]
  ------------------
 1056|      0|    return gpg_error_from_syserror ();
 1057|       |
 1058|  4.09k|  blob->blob = image;
 1059|  4.09k|  blob->bloblen = imagelen;
 1060|  4.09k|  blob->fileoffset = off;
 1061|  4.09k|  *r_blob = blob;
 1062|  4.09k|  return 0;
 1063|  4.09k|}
_keybox_release_blob:
 1068|  21.3k|{
 1069|  21.3k|  int i;
 1070|  21.3k|  if (!blob)
  ------------------
  |  Branch (1070:7): [True: 17.2k, False: 4.09k]
  ------------------
 1071|  17.2k|    return;
 1072|  4.09k|  if (blob->buf)
  ------------------
  |  Branch (1072:7): [True: 0, False: 4.09k]
  ------------------
 1073|      0|    {
 1074|      0|      size_t len;
 1075|      0|      xfree (get_membuf (blob->buf, &len));
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1076|      0|    }
 1077|  4.09k|  xfree (blob->keys );
  ------------------
  |  |  104|  4.09k|#define xfree(a)         gcry_free ((a))
  ------------------
 1078|  4.09k|  xfree (blob->serialbuf);
  ------------------
  |  |  104|  4.09k|#define xfree(a)         gcry_free ((a))
  ------------------
 1079|  4.09k|  for (i=0; i < blob->nuids; i++)
  ------------------
  |  Branch (1079:13): [True: 0, False: 4.09k]
  ------------------
 1080|      0|    xfree (blob->uids[i].name);
  ------------------
  |  |  104|  4.09k|#define xfree(a)         gcry_free ((a))
  ------------------
 1081|  4.09k|  xfree (blob->uids );
  ------------------
  |  |  104|  4.09k|#define xfree(a)         gcry_free ((a))
  ------------------
 1082|  4.09k|  xfree (blob->sigs );
  ------------------
  |  |  104|  4.09k|#define xfree(a)         gcry_free ((a))
  ------------------
 1083|  4.09k|  xfree (blob->blob );
  ------------------
  |  |  104|  4.09k|#define xfree(a)         gcry_free ((a))
  ------------------
 1084|  4.09k|  xfree (blob );
  ------------------
  |  |  104|  4.09k|#define xfree(a)         gcry_free ((a))
  ------------------
 1085|  4.09k|}
_keybox_get_blob_image:
 1091|  4.09k|{
 1092|  4.09k|  *n = blob->bloblen;
 1093|  4.09k|  return blob->blob;
 1094|  4.09k|}

keybox-search.c:blob_get_type:
  182|  4.09k|{
  183|  4.09k|  const unsigned char *buffer;
  184|  4.09k|  size_t length;
  185|       |
  186|  4.09k|  buffer = _keybox_get_blob_image (blob, &length);
  187|  4.09k|  if (length < 32)
  ------------------
  |  Branch (187:7): [True: 0, False: 4.09k]
  ------------------
  188|      0|    return -1; /* blob too short */
  189|       |
  190|  4.09k|  return buffer[4];
  191|  4.09k|}

_keybox_read_blob:
   52|  8.18k|{
   53|  8.18k|  unsigned char *image;
   54|  8.18k|  size_t imagelen = 0;
   55|  8.18k|  int c1, c2, c3, c4, type;
   56|  8.18k|  int rc;
   57|  8.18k|  off_t off;
   58|       |
   59|  8.18k|  if (skipped_deleted)
  ------------------
  |  Branch (59:7): [True: 0, False: 8.18k]
  ------------------
   60|      0|    *skipped_deleted = 0;
   61|  8.18k| again:
   62|  8.18k|  if (r_blob)
  ------------------
  |  Branch (62:7): [True: 8.18k, False: 0]
  ------------------
   63|  8.18k|    *r_blob = NULL;
   64|  8.18k|  off = es_ftello (fp);
   65|  8.18k|  if (off == (off_t)-1)
  ------------------
  |  Branch (65:7): [True: 0, False: 8.18k]
  ------------------
   66|      0|    return gpg_error_from_syserror ();
   67|       |
   68|  8.18k|  if ((c1 = es_getc (fp)) == EOF
  ------------------
  |  Branch (68:7): [True: 4.09k, False: 4.09k]
  ------------------
   69|  8.18k|      || (c2 = es_getc (fp)) == EOF
  ------------------
  |  Branch (69:10): [True: 0, False: 4.09k]
  ------------------
   70|  8.18k|      || (c3 = es_getc (fp)) == EOF
  ------------------
  |  Branch (70:10): [True: 0, False: 4.09k]
  ------------------
   71|  8.18k|      || (c4 = es_getc (fp)) == EOF
  ------------------
  |  Branch (71:10): [True: 0, False: 4.09k]
  ------------------
   72|  8.18k|      || (type = es_getc (fp)) == EOF)
  ------------------
  |  Branch (72:10): [True: 0, False: 4.09k]
  ------------------
   73|  4.09k|    {
   74|  4.09k|      if ( c1 == EOF && !es_ferror (fp) )
  ------------------
  |  Branch (74:12): [True: 4.09k, False: 0]
  |  Branch (74:25): [True: 4.09k, False: 0]
  ------------------
   75|  4.09k|        return -1; /* eof */
   76|      0|      if (!es_ferror (fp))
  ------------------
  |  Branch (76:11): [True: 0, False: 0]
  ------------------
   77|      0|        return gpg_error (GPG_ERR_TOO_SHORT);
   78|      0|      return gpg_error_from_syserror ();
   79|      0|    }
   80|       |
   81|  4.09k|  imagelen = ((unsigned int) c1 << 24) | (c2 << 16) | (c3 << 8 ) | c4;
   82|  4.09k|  if (imagelen < 5)
  ------------------
  |  Branch (82:7): [True: 0, False: 4.09k]
  ------------------
   83|      0|    return gpg_error (GPG_ERR_TOO_SHORT);
   84|       |
   85|  4.09k|  if (!type)
  ------------------
  |  Branch (85:7): [True: 0, False: 4.09k]
  ------------------
   86|      0|    {
   87|       |      /* Special treatment for empty blobs. */
   88|      0|      if (es_fseek (fp, imagelen-5, SEEK_CUR))
  ------------------
  |  Branch (88:11): [True: 0, False: 0]
  ------------------
   89|      0|        return gpg_error_from_syserror ();
   90|      0|      if (skipped_deleted)
  ------------------
  |  Branch (90:11): [True: 0, False: 0]
  ------------------
   91|      0|        *skipped_deleted = 1;
   92|      0|      goto again;
   93|      0|    }
   94|       |
   95|  4.09k|  if (imagelen > IMAGELEN_LIMIT) /* Sanity check. */
  ------------------
  |  |   30|  4.09k|#define IMAGELEN_LIMIT (5*1024*1024)
  ------------------
  |  Branch (95:7): [True: 0, False: 4.09k]
  ------------------
   96|      0|    {
   97|       |      /* Seek forward so that the caller may choose to ignore this
   98|       |         record.  */
   99|      0|      if (es_fseek (fp, imagelen-5, SEEK_CUR))
  ------------------
  |  Branch (99:11): [True: 0, False: 0]
  ------------------
  100|      0|        return gpg_error_from_syserror ();
  101|      0|      return gpg_error (GPG_ERR_TOO_LARGE);
  102|      0|    }
  103|       |
  104|  4.09k|  if (!r_blob)
  ------------------
  |  Branch (104:7): [True: 0, False: 4.09k]
  ------------------
  105|      0|    {
  106|       |      /* This blob shall be skipped.  */
  107|      0|      if (es_fseek (fp, imagelen-5, SEEK_CUR))
  ------------------
  |  Branch (107:11): [True: 0, False: 0]
  ------------------
  108|      0|        return gpg_error_from_syserror ();
  109|      0|      return 0;
  110|      0|    }
  111|       |
  112|  4.09k|  image = xtrymalloc (imagelen);
  ------------------
  |  |   97|  4.09k|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  113|  4.09k|  if (!image)
  ------------------
  |  Branch (113:7): [True: 0, False: 4.09k]
  ------------------
  114|      0|    return gpg_error_from_syserror ();
  115|       |
  116|  4.09k|  image[0] = c1; image[1] = c2; image[2] = c3; image[3] = c4; image[4] = type;
  117|  4.09k|  if (es_fread (image+5, imagelen-5, 1, fp) != 1)
  ------------------
  |  Branch (117:7): [True: 0, False: 4.09k]
  ------------------
  118|      0|    {
  119|      0|      gpg_error_t tmperr = gpg_error_from_syserror ();
  120|      0|      xfree (image);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  121|      0|      return tmperr;
  122|      0|    }
  123|       |
  124|  4.09k|  rc = _keybox_new_blob (r_blob, image, imagelen, off);
  125|  4.09k|  if (rc)
  ------------------
  |  Branch (125:7): [True: 0, False: 4.09k]
  ------------------
  126|      0|    xfree (image);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  127|  4.09k|  return rc;
  128|  4.09k|}
_keybox_write_header_blob:
  161|      1|{
  162|      1|  unsigned char image[32];
  163|      1|  u32 val;
  164|       |
  165|      1|  memset (image, 0, sizeof image);
  166|       |  /* Length of this blob. */
  167|      1|  image[3] = 32;
  168|       |
  169|      1|  image[4] = KEYBOX_BLOBTYPE_HEADER;
  170|      1|  image[5] = 1; /* Version */
  171|      1|  if (for_openpgp)
  ------------------
  |  Branch (171:7): [True: 1, False: 0]
  ------------------
  172|      1|    image[7] = 0x02; /* OpenPGP data may be available.  */
  173|       |
  174|      1|  memcpy (image+8, "KBXf", 4);
  175|      1|  val = time (NULL);
  176|       |  /* created_at and last maintenance run. */
  177|      1|  image[16]   = (val >> 24);
  178|      1|  image[16+1] = (val >> 16);
  179|      1|  image[16+2] = (val >>  8);
  180|      1|  image[16+3] = (val      );
  181|      1|  image[20]   = (val >> 24);
  182|      1|  image[20+1] = (val >> 16);
  183|      1|  image[20+2] = (val >>  8);
  184|      1|  image[20+3] = (val      );
  185|       |
  186|      1|  if (es_fwrite (image, 32, 1, fp) != 1)
  ------------------
  |  Branch (186:7): [True: 0, False: 1]
  ------------------
  187|      0|    return gpg_error_from_syserror ();
  188|       |
  189|      1|  return 0;
  190|      1|}

keybox_register_file:
   41|      1|{
   42|      1|  KB_NAME kr;
   43|       |
   44|      1|  *r_token = NULL;
   45|       |
   46|      1|  for (kr=kb_names; kr; kr = kr->next)
  ------------------
  |  Branch (46:21): [True: 0, False: 1]
  ------------------
   47|      0|    {
   48|      0|      if (same_file_p (kr->fname, fname) )
  ------------------
  |  Branch (48:11): [True: 0, False: 0]
  ------------------
   49|      0|        {
   50|      0|          *r_token = kr;
   51|      0|          return gpg_error (GPG_ERR_EEXIST); /* Already registered. */
   52|      0|        }
   53|      0|    }
   54|       |
   55|      1|  kr = xtrymalloc (sizeof *kr + strlen (fname));
  ------------------
  |  |   97|      1|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
   56|      1|  if (!kr)
  ------------------
  |  Branch (56:7): [True: 0, False: 1]
  ------------------
   57|      0|    return gpg_error_from_syserror ();
   58|      1|  strcpy (kr->fname, fname);
   59|      1|  kr->secret = !!secret;
   60|       |
   61|      1|  kr->handle_table = NULL;
   62|      1|  kr->handle_table_size = 0;
   63|       |
   64|      1|  kr->lockhd = NULL;
   65|      1|  kr->is_locked = 0;
   66|      1|  kr->did_full_scan = 0;
   67|       |  /* keep a list of all issued pointers */
   68|      1|  kr->next = kb_names;
   69|      1|  kb_names = kr;
   70|       |
   71|       |  /* create the offset table the first time a function here is used */
   72|       |/*      if (!kb_offtbl) */
   73|       |/*        kb_offtbl = new_offset_hash_table (); */
   74|       |
   75|      1|  *r_token = kr;
   76|      1|  return 0;
   77|      1|}
keybox_is_writable:
   81|      2|{
   82|      2|  KB_NAME r = token;
   83|       |
   84|      2|  return r? !gnupg_access (r->fname, W_OK) : 0;
  ------------------
  |  Branch (84:10): [True: 2, False: 0]
  ------------------
   85|      2|}
keybox_new_openpgp:
  149|  4.50k|{
  150|  4.50k|  KB_NAME resource = token;
  151|       |
  152|  4.50k|  return do_keybox_new (resource, secret, 1);
  153|  4.50k|}
keybox_release:
  169|  4.50k|{
  170|  4.50k|  if (!hd)
  ------------------
  |  Branch (170:7): [True: 0, False: 4.50k]
  ------------------
  171|      0|    return;
  172|  4.50k|  if (hd->kb->handle_table)
  ------------------
  |  Branch (172:7): [True: 4.50k, False: 0]
  ------------------
  173|  4.50k|    {
  174|  4.50k|      int idx;
  175|  18.0k|      for (idx=0; idx < hd->kb->handle_table_size; idx++)
  ------------------
  |  Branch (175:19): [True: 13.5k, False: 4.50k]
  ------------------
  176|  13.5k|        if (hd->kb->handle_table[idx] == hd)
  ------------------
  |  Branch (176:13): [True: 4.50k, False: 9.01k]
  ------------------
  177|  4.50k|          hd->kb->handle_table[idx] = NULL;
  178|  4.50k|    }
  179|  4.50k|  _keybox_release_blob (hd->found.blob);
  180|  4.50k|  _keybox_release_blob (hd->saved_found.blob);
  181|  4.50k|  if (hd->fp)
  ------------------
  |  Branch (181:7): [True: 3.53k, False: 971]
  ------------------
  182|  3.53k|    {
  183|  3.53k|      es_fclose (hd->fp);
  184|  3.53k|      hd->fp = NULL;
  185|  3.53k|    }
  186|  4.50k|  xfree (hd->word_match.name);
  ------------------
  |  |  104|  4.50k|#define xfree(a)         gcry_free ((a))
  ------------------
  187|  4.50k|  xfree (hd->word_match.pattern);
  ------------------
  |  |  104|  4.50k|#define xfree(a)         gcry_free ((a))
  ------------------
  188|  4.50k|  xfree (hd);
  ------------------
  |  |  104|  4.50k|#define xfree(a)         gcry_free ((a))
  ------------------
  189|  4.50k|}
_keybox_close_file:
  244|      1|{
  245|      1|  int idx;
  246|      1|  KEYBOX_HANDLE roverhd;
  247|       |
  248|      1|  if (!hd || !hd->kb || !hd->kb->handle_table)
  ------------------
  |  Branch (248:7): [True: 0, False: 1]
  |  Branch (248:14): [True: 0, False: 1]
  |  Branch (248:25): [True: 0, False: 1]
  ------------------
  249|      0|    return;
  250|       |
  251|      4|  for (idx=0; idx < hd->kb->handle_table_size; idx++)
  ------------------
  |  Branch (251:15): [True: 3, False: 1]
  ------------------
  252|      3|    if ((roverhd = hd->kb->handle_table[idx]))
  ------------------
  |  Branch (252:9): [True: 1, False: 2]
  ------------------
  253|      1|      {
  254|      1|        if (roverhd->fp)
  ------------------
  |  Branch (254:13): [True: 0, False: 1]
  ------------------
  255|      0|          {
  256|      0|            es_fclose (roverhd->fp);
  257|      0|            roverhd->fp = NULL;
  258|      0|          }
  259|      1|      }
  260|      1|  log_assert (!hd->fp);
  261|      1|}
keybox_lock:
  271|      2|{
  272|      2|  gpg_error_t err = 0;
  273|      2|  KB_NAME kb = hd->kb;
  274|       |
  275|      2|  if (!keybox_is_writable (kb))
  ------------------
  |  Branch (275:7): [True: 0, False: 2]
  ------------------
  276|      0|    return 0;
  277|       |
  278|       |  /* Make sure the lock handle has been created.  */
  279|      2|  if (!kb->lockhd)
  ------------------
  |  Branch (279:7): [True: 1, False: 1]
  ------------------
  280|      1|    {
  281|      1|      kb->lockhd = dotlock_create (kb->fname, 0);
  282|      1|      if (!kb->lockhd)
  ------------------
  |  Branch (282:11): [True: 0, False: 1]
  ------------------
  283|      0|        {
  284|      0|          err = gpg_error_from_syserror ();
  285|      0|          log_info ("can't allocate lock for '%s'\n", kb->fname );
  286|      0|          return err;
  287|      0|        }
  288|      1|    }
  289|       |
  290|      2|  if (yes) /* Take the lock.  */
  ------------------
  |  Branch (290:7): [True: 1, False: 1]
  ------------------
  291|      1|    {
  292|      1|      if (!kb->is_locked)
  ------------------
  |  Branch (292:11): [True: 1, False: 0]
  ------------------
  293|      1|        {
  294|       |#ifdef HAVE_W32_SYSTEM
  295|       |          /* Under Windows we need to close the file before we try
  296|       |           * to lock it.  This is because another process might have
  297|       |           * taken the lock and is using keybox_file_rename to
  298|       |           * rename the base file.  Now if our dotlock_take below is
  299|       |           * waiting for the lock but we have the base file still
  300|       |           * open, keybox_file_rename will never succeed as we are
  301|       |           * in a deadlock.  */
  302|       |          _keybox_close_file (hd);
  303|       |#endif /*HAVE_W32_SYSTEM*/
  304|      1|          if (dotlock_take (kb->lockhd, timeout))
  ------------------
  |  Branch (304:15): [True: 0, False: 1]
  ------------------
  305|      0|            {
  306|      0|              err = gpg_error_from_syserror ();
  307|      0|              if (!timeout && gpg_err_code (err) == GPG_ERR_EACCES)
  ------------------
  |  Branch (307:19): [True: 0, False: 0]
  |  Branch (307:31): [True: 0, False: 0]
  ------------------
  308|      0|                ; /* No diagnostic if we only tried to lock.  */
  309|      0|              else
  310|      0|                log_info ("can't lock '%s'\n", kb->fname );
  311|      0|            }
  312|      1|          else
  313|      1|            kb->is_locked = 1;
  314|      1|        }
  315|      1|    }
  316|      1|  else /* Release the lock.  */
  317|      1|    {
  318|      1|      if (kb->is_locked)
  ------------------
  |  Branch (318:11): [True: 1, False: 0]
  ------------------
  319|      1|        {
  320|      1|          if (dotlock_release (kb->lockhd))
  ------------------
  |  Branch (320:15): [True: 0, False: 1]
  ------------------
  321|      0|            {
  322|      0|              err = gpg_error_from_syserror ();
  323|      0|              log_info ("can't unlock '%s'\n", kb->fname );
  324|      0|            }
  325|      1|          else
  326|      1|            kb->is_locked = 0;
  327|      1|        }
  328|      1|   }
  329|       |
  330|      2|  return err;
  331|      2|}
keybox-init.c:do_keybox_new:
   91|  4.50k|{
   92|  4.50k|  KEYBOX_HANDLE hd;
   93|  4.50k|  int idx;
   94|       |
   95|  4.50k|  assert (resource && !resource->secret == !secret);
   96|  4.50k|  hd = xtrycalloc (1, sizeof *hd);
  ------------------
  |  |   99|  4.50k|#define xtrycalloc(a,b)  gcry_calloc ((a),(b))
  ------------------
   97|  4.50k|  if (hd)
  ------------------
  |  Branch (97:7): [True: 4.50k, False: 0]
  ------------------
   98|  4.50k|    {
   99|  4.50k|      hd->kb = resource;
  100|  4.50k|      hd->secret = !!secret;
  101|  4.50k|      hd->for_openpgp = for_openpgp;
  102|  4.50k|      if (!resource->handle_table)
  ------------------
  |  Branch (102:11): [True: 1, False: 4.50k]
  ------------------
  103|      1|        {
  104|      1|          resource->handle_table_size = 3;
  105|      1|          resource->handle_table = xtrycalloc (resource->handle_table_size,
  ------------------
  |  |   99|      1|#define xtrycalloc(a,b)  gcry_calloc ((a),(b))
  ------------------
  106|      1|                                               sizeof *resource->handle_table);
  107|      1|          if (!resource->handle_table)
  ------------------
  |  Branch (107:15): [True: 0, False: 1]
  ------------------
  108|      0|            {
  109|      0|              resource->handle_table_size = 0;
  110|      0|              xfree (hd);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  111|      0|              return NULL;
  112|      0|            }
  113|      1|        }
  114|  7.82k|      for (idx=0; idx < resource->handle_table_size; idx++)
  ------------------
  |  Branch (114:19): [True: 7.82k, False: 0]
  ------------------
  115|  7.82k|        if (!resource->handle_table[idx])
  ------------------
  |  Branch (115:13): [True: 4.50k, False: 3.31k]
  ------------------
  116|  4.50k|          {
  117|  4.50k|            resource->handle_table[idx] = hd;
  118|  4.50k|            break;
  119|  4.50k|          }
  120|  4.50k|      if (!(idx < resource->handle_table_size))
  ------------------
  |  Branch (120:11): [True: 0, False: 4.50k]
  ------------------
  121|      0|        {
  122|      0|          KEYBOX_HANDLE *tmptbl;
  123|      0|          size_t newsize;
  124|       |
  125|      0|          newsize = resource->handle_table_size + 5;
  126|      0|          tmptbl = xtryrealloc (resource->handle_table,
  ------------------
  |  |  101|      0|#define xtryrealloc(a,b) gcry_realloc ((a),(b))
  ------------------
  127|      0|                                newsize * sizeof (*tmptbl));
  128|      0|          if (!tmptbl)
  ------------------
  |  Branch (128:15): [True: 0, False: 0]
  ------------------
  129|      0|            {
  130|      0|              xfree (hd);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  131|      0|              return NULL;
  132|      0|            }
  133|      0|          resource->handle_table = tmptbl;
  134|      0|          resource->handle_table_size = newsize;
  135|      0|          resource->handle_table[idx] = hd;
  136|      0|          for (idx++; idx < resource->handle_table_size; idx++)
  ------------------
  |  Branch (136:23): [True: 0, False: 0]
  ------------------
  137|      0|            resource->handle_table[idx] = NULL;
  138|      0|        }
  139|  4.50k|    }
  140|  4.50k|  return hd;
  141|  4.50k|}

keybox_search_reset:
  901|  11.4k|{
  902|  11.4k|  if (!hd)
  ------------------
  |  Branch (902:7): [True: 0, False: 11.4k]
  ------------------
  903|      0|    return gpg_error (GPG_ERR_INV_VALUE);
  904|       |
  905|  11.4k|  if (hd->found.blob)
  ------------------
  |  Branch (905:7): [True: 0, False: 11.4k]
  ------------------
  906|      0|    {
  907|      0|      _keybox_release_blob (hd->found.blob);
  908|      0|      hd->found.blob = NULL;
  909|      0|    }
  910|       |
  911|  11.4k|  if (hd->fp)
  ------------------
  |  Branch (911:7): [True: 4.46k, False: 7.03k]
  ------------------
  912|  4.46k|    {
  913|  4.46k|      if (es_fseeko (hd->fp, 0, SEEK_SET))
  ------------------
  |  Branch (913:11): [True: 0, False: 4.46k]
  ------------------
  914|      0|        {
  915|       |          /* Ooops.  Seek did not work.  Close so that the search will
  916|       |           * open the file again.  */
  917|      0|          es_fclose (hd->fp);
  918|      0|          hd->fp = NULL;
  919|      0|        }
  920|  4.46k|    }
  921|  11.4k|  hd->error = 0;
  922|  11.4k|  hd->eof = 0;
  923|  11.4k|  return 0;
  924|  11.4k|}
keybox_search:
  936|  4.09k|{
  937|  4.09k|  gpg_error_t rc;
  938|  4.09k|  size_t n;
  939|  4.09k|  int need_words, any_skip;
  940|  4.09k|  KEYBOXBLOB blob = NULL;
  941|  4.09k|  struct sn_array_s *sn_array = NULL;
  942|  4.09k|  int pk_no, uid_no;
  943|  4.09k|  off_t lastfoundoff;
  944|       |
  945|  4.09k|  if (!hd)
  ------------------
  |  Branch (945:7): [True: 0, False: 4.09k]
  ------------------
  946|      0|    return gpg_error (GPG_ERR_INV_VALUE);
  947|       |
  948|       |  /* Clear last found result but record the offset of the last found
  949|       |   * blob which we may need later. */
  950|  4.09k|  if (hd->found.blob)
  ------------------
  |  Branch (950:7): [True: 0, False: 4.09k]
  ------------------
  951|      0|    {
  952|      0|      lastfoundoff = _keybox_get_blob_fileoffset (hd->found.blob);
  953|      0|      _keybox_release_blob (hd->found.blob);
  954|      0|      hd->found.blob = NULL;
  955|      0|    }
  956|  4.09k|  else
  957|  4.09k|    lastfoundoff = 0;
  958|       |
  959|  4.09k|  if (hd->error)
  ------------------
  |  Branch (959:7): [True: 0, False: 4.09k]
  ------------------
  960|      0|    return hd->error; /* still in error state */
  961|  4.09k|  if (hd->eof)
  ------------------
  |  Branch (961:7): [True: 0, False: 4.09k]
  ------------------
  962|      0|    return -1; /* still EOF */
  963|       |
  964|       |  /* figure out what information we need */
  965|  4.09k|  need_words = any_skip = 0;
  966|  8.18k|  for (n=0; n < ndesc; n++)
  ------------------
  |  Branch (966:13): [True: 4.09k, False: 4.09k]
  ------------------
  967|  4.09k|    {
  968|  4.09k|      switch (desc[n].mode)
  969|  4.09k|        {
  970|      0|        case KEYDB_SEARCH_MODE_WORDS:
  ------------------
  |  Branch (970:9): [True: 0, False: 4.09k]
  ------------------
  971|      0|          need_words = 1;
  972|      0|          break;
  973|      1|        case KEYDB_SEARCH_MODE_FIRST:
  ------------------
  |  Branch (973:9): [True: 1, False: 4.09k]
  ------------------
  974|       |          /* always restart the search in this mode */
  975|      1|          keybox_search_reset (hd);
  976|      1|          lastfoundoff = 0;
  977|      1|          break;
  978|  4.09k|        default:
  ------------------
  |  Branch (978:9): [True: 4.09k, False: 1]
  ------------------
  979|  4.09k|          break;
  980|  4.09k|	}
  981|  4.09k|      if (desc[n].skipfnc)
  ------------------
  |  Branch (981:11): [True: 0, False: 4.09k]
  ------------------
  982|      0|        any_skip = 1;
  983|  4.09k|      if (desc[n].snhex && !sn_array)
  ------------------
  |  Branch (983:11): [True: 0, False: 4.09k]
  |  Branch (983:28): [True: 0, False: 0]
  ------------------
  984|      0|        {
  985|      0|          sn_array = xtrycalloc (ndesc, sizeof *sn_array);
  ------------------
  |  |   99|      0|#define xtrycalloc(a,b)  gcry_calloc ((a),(b))
  ------------------
  986|      0|          if (!sn_array)
  ------------------
  |  Branch (986:15): [True: 0, False: 0]
  ------------------
  987|      0|            return (hd->error = gpg_error_from_syserror ());
  988|      0|        }
  989|  4.09k|    }
  990|       |
  991|  4.09k|  (void)need_words;  /* Not yet implemented.  */
  992|       |
  993|  4.09k|  if (!hd->fp)
  ------------------
  |  Branch (993:7): [True: 3.53k, False: 556]
  ------------------
  994|  3.53k|    {
  995|  3.53k|      rc = open_file (hd);
  996|  3.53k|      if (rc)
  ------------------
  |  Branch (996:11): [True: 0, False: 3.53k]
  ------------------
  997|      0|        {
  998|      0|          xfree (sn_array);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  999|      0|          return rc;
 1000|      0|        }
 1001|       |      /* log_debug ("%s: re-opened file\n", __func__); */
 1002|  3.53k|      if (ndesc && desc[0].mode != KEYDB_SEARCH_MODE_FIRST && lastfoundoff)
  ------------------
  |  Branch (1002:11): [True: 3.53k, False: 0]
  |  Branch (1002:20): [True: 3.53k, False: 1]
  |  Branch (1002:63): [True: 0, False: 3.53k]
  ------------------
 1003|      0|        {
 1004|       |          /* Search mode is not first and the last search operation
 1005|       |           * returned a blob which also was not the first one.  We now
 1006|       |           * need to skip over that blob and hope that the file has
 1007|       |           * not changed.  */
 1008|      0|          if (es_fseeko (hd->fp, lastfoundoff, SEEK_SET))
  ------------------
  |  Branch (1008:15): [True: 0, False: 0]
  ------------------
 1009|      0|            {
 1010|      0|              rc = gpg_error_from_syserror ();
 1011|      0|              log_debug ("%s: seeking to last found offset failed: %s\n",
 1012|      0|                         __func__, gpg_strerror (rc));
 1013|      0|              xfree (sn_array);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1014|      0|              return gpg_error (GPG_ERR_NOTHING_FOUND);
 1015|      0|            }
 1016|       |          /* log_debug ("%s: re-opened file and sought to last offset\n", */
 1017|       |          /*            __func__); */
 1018|      0|          rc = _keybox_read_blob (NULL, hd->fp, NULL);
 1019|      0|          if (rc)
  ------------------
  |  Branch (1019:15): [True: 0, False: 0]
  ------------------
 1020|      0|            {
 1021|      0|              log_debug ("%s: skipping last found blob failed: %s\n",
 1022|      0|                         __func__, gpg_strerror (rc));
 1023|      0|              xfree (sn_array);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1024|      0|              return gpg_error (GPG_ERR_NOTHING_FOUND);
 1025|      0|            }
 1026|      0|        }
 1027|  3.53k|    }
 1028|       |
 1029|       |  /* Kludge: We need to convert an SN given as hexstring to its binary
 1030|       |     representation - in some cases we are not able to store it in the
 1031|       |     search descriptor, because due to the way we use it, it is not
 1032|       |     possible to free allocated memory. */
 1033|  4.09k|  if (sn_array)
  ------------------
  |  Branch (1033:7): [True: 0, False: 4.09k]
  ------------------
 1034|      0|    {
 1035|      0|      const unsigned char *s;
 1036|      0|      int i, odd;
 1037|      0|      size_t snlen;
 1038|       |
 1039|      0|      for (n=0; n < ndesc; n++)
  ------------------
  |  Branch (1039:17): [True: 0, False: 0]
  ------------------
 1040|      0|        {
 1041|      0|          if (!desc[n].sn)
  ------------------
  |  Branch (1041:15): [True: 0, False: 0]
  ------------------
 1042|      0|            ;
 1043|      0|          else if (desc[n].snhex)
  ------------------
  |  Branch (1043:20): [True: 0, False: 0]
  ------------------
 1044|      0|            {
 1045|      0|              unsigned char *sn;
 1046|       |
 1047|      0|              s = desc[n].sn;
 1048|      0|              for (i=0; *s && *s != '/' && i < desc[n].snlen; s++, i++)
  ------------------
  |  Branch (1048:25): [True: 0, False: 0]
  |  Branch (1048:31): [True: 0, False: 0]
  |  Branch (1048:44): [True: 0, False: 0]
  ------------------
 1049|      0|                ;
 1050|      0|              odd = (i & 1);
 1051|      0|              snlen = (i+1)/2;
 1052|      0|              sn_array[n].sn = xtrymalloc (snlen);
  ------------------
  |  |   97|      0|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
 1053|      0|              if (!sn_array[n].sn)
  ------------------
  |  Branch (1053:19): [True: 0, False: 0]
  ------------------
 1054|      0|                {
 1055|      0|                  hd->error = gpg_error_from_syserror ();
 1056|      0|                  release_sn_array (sn_array, n);
 1057|      0|                  return hd->error;
 1058|      0|                }
 1059|      0|              sn_array[n].snlen = snlen;
 1060|      0|              sn = sn_array[n].sn;
 1061|      0|              s = desc[n].sn;
 1062|      0|              if (odd)
  ------------------
  |  Branch (1062:19): [True: 0, False: 0]
  ------------------
 1063|      0|                {
 1064|      0|                  *sn++ = xtoi_1 (s);
  ------------------
  |  |   33|      0|#define xtoi_1(p)   (*(p) <= '9'? (*(p)- '0'): \
  |  |  ------------------
  |  |  |  Branch (33:22): [True: 0, False: 0]
  |  |  ------------------
  |  |   34|      0|                     *(p) <= 'F'? (*(p)-'A'+10):(*(p)-'a'+10))
  |  |  ------------------
  |  |  |  Branch (34:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1065|      0|                  s++;
 1066|      0|                }
 1067|      0|              for (; *s && *s != '/';  s += 2)
  ------------------
  |  Branch (1067:22): [True: 0, False: 0]
  |  Branch (1067:28): [True: 0, False: 0]
  ------------------
 1068|      0|                *sn++ = xtoi_2 (s);
  ------------------
  |  |   35|      0|#define xtoi_2(p)   ((xtoi_1(p) * 16) + xtoi_1((p)+1))
  |  |  ------------------
  |  |  |  |   33|      0|#define xtoi_1(p)   (*(p) <= '9'? (*(p)- '0'): \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (33:22): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   34|      0|                     *(p) <= 'F'? (*(p)-'A'+10):(*(p)-'a'+10))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:22): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define xtoi_2(p)   ((xtoi_1(p) * 16) + xtoi_1((p)+1))
  |  |  ------------------
  |  |  |  |   33|      0|#define xtoi_1(p)   (*(p) <= '9'? (*(p)- '0'): \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (33:22): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |   34|      0|                     *(p) <= 'F'? (*(p)-'A'+10):(*(p)-'a'+10))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:22): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1069|      0|            }
 1070|      0|          else
 1071|      0|            {
 1072|      0|              const unsigned char *sn;
 1073|       |
 1074|      0|              sn = desc[n].sn;
 1075|      0|              snlen = desc[n].snlen;
 1076|      0|              sn_array[n].sn = xtrymalloc (snlen);
  ------------------
  |  |   97|      0|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
 1077|      0|              if (!sn_array[n].sn)
  ------------------
  |  Branch (1077:19): [True: 0, False: 0]
  ------------------
 1078|      0|                {
 1079|      0|                  hd->error = gpg_error_from_syserror ();
 1080|      0|                  release_sn_array (sn_array, n);
 1081|      0|                  return hd->error;
 1082|      0|                }
 1083|      0|              sn_array[n].snlen = snlen;
 1084|      0|              memcpy (sn_array[n].sn, sn, snlen);
 1085|      0|            }
 1086|      0|        }
 1087|      0|    }
 1088|       |
 1089|       |
 1090|  4.09k|  pk_no = uid_no = 0;
 1091|  4.09k|  for (;;)
 1092|  8.18k|    {
 1093|  8.18k|      unsigned int blobflags;
 1094|  8.18k|      int blobtype;
 1095|       |
 1096|  8.18k|      _keybox_release_blob (blob); blob = NULL;
 1097|  8.18k|      rc = _keybox_read_blob (&blob, hd->fp, NULL);
 1098|  8.18k|      if (gpg_err_code (rc) == GPG_ERR_TOO_LARGE
  ------------------
  |  Branch (1098:11): [True: 0, False: 8.18k]
  ------------------
 1099|  8.18k|          && gpg_err_source (rc) == GPG_ERR_SOURCE_KEYBOX)
  ------------------
  |  Branch (1099:14): [True: 0, False: 0]
  ------------------
 1100|      0|        {
 1101|      0|          ++*r_skipped;
 1102|      0|          continue; /* Skip too large records.  */
 1103|      0|        }
 1104|       |
 1105|  8.18k|      if (rc)
  ------------------
  |  Branch (1105:11): [True: 4.09k, False: 4.09k]
  ------------------
 1106|  4.09k|        break;
 1107|       |
 1108|  4.09k|      blobtype = blob_get_type (blob);
 1109|  4.09k|      if (blobtype == KEYBOX_BLOBTYPE_HEADER)
  ------------------
  |  Branch (1109:11): [True: 4.09k, False: 0]
  ------------------
 1110|  4.09k|        continue;
 1111|      0|      if (want_blobtype && blobtype != want_blobtype)
  ------------------
  |  Branch (1111:11): [True: 0, False: 0]
  |  Branch (1111:28): [True: 0, False: 0]
  ------------------
 1112|      0|        continue;
 1113|       |
 1114|      0|      blobflags = blob_get_blob_flags (blob);
 1115|      0|      if (!hd->ephemeral && (blobflags & 2))
  ------------------
  |  Branch (1115:11): [True: 0, False: 0]
  |  Branch (1115:29): [True: 0, False: 0]
  ------------------
 1116|      0|        continue; /* Not in ephemeral mode but blob is flagged ephemeral.  */
 1117|       |
 1118|      0|      for (n=0; n < ndesc; n++)
  ------------------
  |  Branch (1118:17): [True: 0, False: 0]
  ------------------
 1119|      0|        {
 1120|      0|          switch (desc[n].mode)
 1121|      0|            {
 1122|      0|            case KEYDB_SEARCH_MODE_NONE:
  ------------------
  |  Branch (1122:13): [True: 0, False: 0]
  ------------------
 1123|      0|              never_reached ();
  ------------------
  |  |   88|      0|#define never_reached() do {                             \
  |  |   89|      0|    log_debug ("%s:%d: oops - should never get here\n",  \
  |  |   90|      0|               __FILE__, __LINE__ );                     \
  |  |   91|      0|    } while (0)
  |  |  ------------------
  |  |  |  Branch (91:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1124|      0|              break;
 1125|      0|            case KEYDB_SEARCH_MODE_EXACT:
  ------------------
  |  Branch (1125:13): [True: 0, False: 0]
  ------------------
 1126|      0|              uid_no = has_username (blob, desc[n].u.name, 0);
 1127|      0|              if (uid_no)
  ------------------
  |  Branch (1127:19): [True: 0, False: 0]
  ------------------
 1128|      0|                goto found;
 1129|      0|              break;
 1130|      0|            case KEYDB_SEARCH_MODE_MAIL:
  ------------------
  |  Branch (1130:13): [True: 0, False: 0]
  ------------------
 1131|      0|              uid_no = has_mail (blob, desc[n].u.name, 0);
 1132|      0|              if (uid_no)
  ------------------
  |  Branch (1132:19): [True: 0, False: 0]
  ------------------
 1133|      0|                goto found;
 1134|      0|              break;
 1135|      0|            case KEYDB_SEARCH_MODE_MAILSUB:
  ------------------
  |  Branch (1135:13): [True: 0, False: 0]
  ------------------
 1136|      0|              uid_no = has_mail (blob, desc[n].u.name, 1);
 1137|      0|              if (uid_no)
  ------------------
  |  Branch (1137:19): [True: 0, False: 0]
  ------------------
 1138|      0|                goto found;
 1139|      0|              break;
 1140|      0|            case KEYDB_SEARCH_MODE_SUBSTR:
  ------------------
  |  Branch (1140:13): [True: 0, False: 0]
  ------------------
 1141|      0|              uid_no =  has_username (blob, desc[n].u.name, 1);
 1142|      0|              if (uid_no)
  ------------------
  |  Branch (1142:19): [True: 0, False: 0]
  ------------------
 1143|      0|                goto found;
 1144|      0|              break;
 1145|      0|            case KEYDB_SEARCH_MODE_MAILEND:
  ------------------
  |  Branch (1145:13): [True: 0, False: 0]
  ------------------
 1146|      0|            case KEYDB_SEARCH_MODE_WORDS:
  ------------------
  |  Branch (1146:13): [True: 0, False: 0]
  ------------------
 1147|       |              /* not yet implemented */
 1148|      0|              break;
 1149|      0|            case KEYDB_SEARCH_MODE_ISSUER:
  ------------------
  |  Branch (1149:13): [True: 0, False: 0]
  ------------------
 1150|      0|              if (has_issuer (blob, desc[n].u.name))
  ------------------
  |  Branch (1150:19): [True: 0, False: 0]
  ------------------
 1151|      0|                goto found;
 1152|      0|              break;
 1153|      0|            case KEYDB_SEARCH_MODE_ISSUER_SN:
  ------------------
  |  Branch (1153:13): [True: 0, False: 0]
  ------------------
 1154|      0|              if (has_issuer_sn (blob, desc[n].u.name,
  ------------------
  |  Branch (1154:19): [True: 0, False: 0]
  ------------------
 1155|      0|                                 sn_array? sn_array[n].sn : desc[n].sn,
  ------------------
  |  Branch (1155:34): [True: 0, False: 0]
  ------------------
 1156|      0|                                 sn_array? sn_array[n].snlen : desc[n].snlen))
  ------------------
  |  Branch (1156:34): [True: 0, False: 0]
  ------------------
 1157|      0|                goto found;
 1158|      0|              break;
 1159|      0|            case KEYDB_SEARCH_MODE_SN:
  ------------------
  |  Branch (1159:13): [True: 0, False: 0]
  ------------------
 1160|      0|              if (has_sn (blob, sn_array? sn_array[n].sn : desc[n].sn,
  ------------------
  |  Branch (1160:19): [True: 0, False: 0]
  |  Branch (1160:33): [True: 0, False: 0]
  ------------------
 1161|      0|                                sn_array? sn_array[n].snlen : desc[n].snlen))
  ------------------
  |  Branch (1161:33): [True: 0, False: 0]
  ------------------
 1162|      0|                goto found;
 1163|      0|              break;
 1164|      0|            case KEYDB_SEARCH_MODE_SUBJECT:
  ------------------
  |  Branch (1164:13): [True: 0, False: 0]
  ------------------
 1165|      0|              if (has_subject (blob, desc[n].u.name))
  ------------------
  |  Branch (1165:19): [True: 0, False: 0]
  ------------------
 1166|      0|                goto found;
 1167|      0|              break;
 1168|      0|            case KEYDB_SEARCH_MODE_SHORT_KID:
  ------------------
  |  Branch (1168:13): [True: 0, False: 0]
  ------------------
 1169|      0|              pk_no = has_short_kid (blob, desc[n].u.kid[1]);
 1170|      0|              if (pk_no)
  ------------------
  |  Branch (1170:19): [True: 0, False: 0]
  ------------------
 1171|      0|                goto found;
 1172|      0|              break;
 1173|      0|            case KEYDB_SEARCH_MODE_LONG_KID:
  ------------------
  |  Branch (1173:13): [True: 0, False: 0]
  ------------------
 1174|      0|              pk_no = has_long_kid (blob, desc[n].u.kid[0], desc[n].u.kid[1]);
 1175|      0|              if (pk_no)
  ------------------
  |  Branch (1175:19): [True: 0, False: 0]
  ------------------
 1176|      0|                goto found;
 1177|      0|              break;
 1178|       |
 1179|      0|            case KEYDB_SEARCH_MODE_FPR:
  ------------------
  |  Branch (1179:13): [True: 0, False: 0]
  ------------------
 1180|      0|              pk_no = has_fingerprint (blob, desc[n].u.fpr, desc[n].fprlen);
 1181|      0|              if (pk_no)
  ------------------
  |  Branch (1181:19): [True: 0, False: 0]
  ------------------
 1182|      0|                goto found;
 1183|      0|              break;
 1184|       |
 1185|      0|            case KEYDB_SEARCH_MODE_KEYGRIP:
  ------------------
  |  Branch (1185:13): [True: 0, False: 0]
  ------------------
 1186|      0|              if (has_keygrip (blob, desc[n].u.grip))
  ------------------
  |  Branch (1186:19): [True: 0, False: 0]
  ------------------
 1187|      0|                goto found;
 1188|      0|              break;
 1189|      0|            case KEYDB_SEARCH_MODE_UBID:
  ------------------
  |  Branch (1189:13): [True: 0, False: 0]
  ------------------
 1190|      0|              if (has_ubid (blob, desc[n].u.ubid))
  ------------------
  |  Branch (1190:19): [True: 0, False: 0]
  ------------------
 1191|      0|                goto found;
 1192|      0|              break;
 1193|      0|            case KEYDB_SEARCH_MODE_FIRST:
  ------------------
  |  Branch (1193:13): [True: 0, False: 0]
  ------------------
 1194|      0|              goto found;
 1195|      0|              break;
 1196|      0|            case KEYDB_SEARCH_MODE_NEXT:
  ------------------
  |  Branch (1196:13): [True: 0, False: 0]
  ------------------
 1197|      0|              goto found;
 1198|      0|              break;
 1199|      0|            default:
  ------------------
  |  Branch (1199:13): [True: 0, False: 0]
  ------------------
 1200|      0|              rc = gpg_error (GPG_ERR_INV_VALUE);
 1201|      0|              goto found;
 1202|      0|            }
 1203|      0|	}
 1204|      0|      continue;
 1205|      0|    found:
 1206|       |      /* Record which DESC we matched on.  Note this value is only
 1207|       |	 meaningful if this function returns with no errors. */
 1208|      0|      if(r_descindex)
  ------------------
  |  Branch (1208:10): [True: 0, False: 0]
  ------------------
 1209|      0|	*r_descindex = n;
 1210|      0|      for (n=any_skip?0:ndesc; n < ndesc; n++)
  ------------------
  |  Branch (1210:14): [True: 0, False: 0]
  |  Branch (1210:32): [True: 0, False: 0]
  ------------------
 1211|      0|        {
 1212|      0|          u32 kid[2];
 1213|       |
 1214|      0|          if (desc[n].skipfnc
  ------------------
  |  Branch (1214:15): [True: 0, False: 0]
  ------------------
 1215|      0|              && blob_get_first_keyid (blob, kid)
  ------------------
  |  Branch (1215:18): [True: 0, False: 0]
  ------------------
 1216|      0|	      && desc[n].skipfnc (desc[n].skipfncvalue, kid, uid_no))
  ------------------
  |  Branch (1216:11): [True: 0, False: 0]
  ------------------
 1217|      0|		break;
 1218|      0|        }
 1219|      0|      if (n == ndesc)
  ------------------
  |  Branch (1219:11): [True: 0, False: 0]
  ------------------
 1220|      0|        break; /* got it */
 1221|      0|    }
 1222|       |
 1223|  4.09k|  if (!rc)
  ------------------
  |  Branch (1223:7): [True: 0, False: 4.09k]
  ------------------
 1224|      0|    {
 1225|      0|      hd->found.blob = blob;
 1226|      0|      hd->found.pk_no = pk_no;
 1227|      0|      hd->found.uid_no = uid_no;
 1228|      0|    }
 1229|  4.09k|  else if (rc == -1 || gpg_err_code (rc) == GPG_ERR_EOF)
  ------------------
  |  Branch (1229:12): [True: 4.09k, False: 0]
  |  Branch (1229:24): [True: 0, False: 0]
  ------------------
 1230|  4.09k|    {
 1231|  4.09k|      _keybox_release_blob (blob);
 1232|  4.09k|      hd->eof = 1;
 1233|  4.09k|    }
 1234|      0|  else
 1235|      0|    {
 1236|      0|      _keybox_release_blob (blob);
 1237|      0|      hd->error = rc;
 1238|      0|    }
 1239|       |
 1240|  4.09k|  if (sn_array)
  ------------------
  |  Branch (1240:7): [True: 0, False: 4.09k]
  ------------------
 1241|      0|    release_sn_array (sn_array, ndesc);
 1242|       |
 1243|  4.09k|  return rc;
 1244|  4.09k|}
keybox-search.c:open_file:
  879|  3.53k|{
  880|       |
  881|  3.53k|  hd->fp = es_fopen (hd->kb->fname, "rb");
  882|  3.53k|  if (!hd->fp)
  ------------------
  |  Branch (882:7): [True: 0, False: 3.53k]
  ------------------
  883|      0|    {
  884|      0|      hd->error = gpg_error_from_syserror ();
  885|      0|      return hd->error;
  886|      0|    }
  887|       |
  888|  3.53k|  return 0;
  889|  3.53k|}

keybox_compress:
  629|      1|{
  630|      1|  gpg_err_code_t ec;
  631|      1|  int read_rc, rc;
  632|      1|  const char *fname;
  633|      1|  estream_t fp, newfp;
  634|      1|  char *bakfname = NULL;
  635|      1|  char *tmpfname = NULL;
  636|      1|  int first_blob;
  637|      1|  KEYBOXBLOB blob = NULL;
  638|      1|  u32 cut_time;
  639|      1|  int any_changes = 0;
  640|      1|  int skipped_deleted;
  641|       |
  642|      1|  if (!hd)
  ------------------
  |  Branch (642:7): [True: 0, False: 1]
  ------------------
  643|      0|    return gpg_error (GPG_ERR_INV_HANDLE);
  644|      1|  if (!hd->kb)
  ------------------
  |  Branch (644:7): [True: 0, False: 1]
  ------------------
  645|      0|    return gpg_error (GPG_ERR_INV_HANDLE);
  646|      1|  if (hd->secret)
  ------------------
  |  Branch (646:7): [True: 0, False: 1]
  ------------------
  647|      0|    return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
  648|      1|  fname = hd->kb->fname;
  649|      1|  if (!fname)
  ------------------
  |  Branch (649:7): [True: 0, False: 1]
  ------------------
  650|      0|    return gpg_error (GPG_ERR_INV_HANDLE);
  651|       |
  652|      1|  _keybox_close_file (hd);
  653|       |
  654|       |  /* Open the source file. Because we do a rename, we have to check the
  655|       |     permissions of the file */
  656|      1|  if ((ec = gnupg_access (fname, W_OK)))
  ------------------
  |  Branch (656:7): [True: 0, False: 1]
  ------------------
  657|      0|    return gpg_error (ec);
  658|       |
  659|      1|  fp = es_fopen (fname, "rb");
  660|      1|  if (!fp && errno == ENOENT)
  ------------------
  |  Branch (660:7): [True: 0, False: 1]
  |  Branch (660:14): [True: 0, False: 0]
  ------------------
  661|      0|    return 0; /* Ready. File has been deleted right after the access above. */
  662|      1|  if (!fp)
  ------------------
  |  Branch (662:7): [True: 0, False: 1]
  ------------------
  663|      0|    {
  664|      0|      rc = gpg_error_from_syserror ();
  665|      0|      return rc;
  666|      0|    }
  667|       |
  668|       |  /* A quick test to see if we need to compress the file at all.  We
  669|       |     schedule a compress run after 3 hours. */
  670|      1|  if ( !_keybox_read_blob (&blob, fp, NULL) )
  ------------------
  |  Branch (670:8): [True: 1, False: 0]
  ------------------
  671|      1|    {
  672|      1|      const unsigned char *buffer;
  673|      1|      size_t length;
  674|       |
  675|      1|      buffer = _keybox_get_blob_image (blob, &length);
  676|      1|      if (length > 4 && buffer[4] == KEYBOX_BLOBTYPE_HEADER)
  ------------------
  |  Branch (676:11): [True: 1, False: 0]
  |  Branch (676:25): [True: 1, False: 0]
  ------------------
  677|      1|        {
  678|      1|          u32 last_maint = buf32_to_u32 (buffer+20);
  679|       |
  680|      1|          if ( (last_maint + 3*3600) > make_timestamp () )
  ------------------
  |  Branch (680:16): [True: 1, False: 0]
  ------------------
  681|      1|            {
  682|      1|              es_fclose (fp);
  683|      1|              _keybox_release_blob (blob);
  684|      1|              return 0; /* Compress run not yet needed. */
  685|      1|            }
  686|      1|        }
  687|      0|      _keybox_release_blob (blob);
  688|      0|      es_fseek (fp, 0, SEEK_SET);
  689|      0|      es_clearerr (fp);
  690|      0|    }
  691|       |
  692|       |  /* Create the new file. */
  693|      0|  rc = create_tmp_file (fname, &bakfname, &tmpfname, &newfp);
  694|      0|  if (rc)
  ------------------
  |  Branch (694:7): [True: 0, False: 0]
  ------------------
  695|      0|    {
  696|      0|      es_fclose (fp);
  697|      0|      return rc;;
  698|      0|    }
  699|       |
  700|       |
  701|       |  /* Processing loop.  By reading using _keybox_read_blob we
  702|       |     automagically skip any blobs flagged as deleted.  Thus what we
  703|       |     only have to do is to check all ephemeral flagged blocks whether
  704|       |     their time has come and write out all other blobs. */
  705|      0|  cut_time = make_timestamp () - 86400;
  706|      0|  first_blob = 1;
  707|      0|  skipped_deleted = 0;
  708|      0|  for (rc=0; !(read_rc = _keybox_read_blob (&blob, fp, &skipped_deleted));
  ------------------
  |  Branch (708:14): [True: 0, False: 0]
  ------------------
  709|      0|       _keybox_release_blob (blob), blob = NULL )
  710|      0|    {
  711|      0|      unsigned int blobflags;
  712|      0|      const unsigned char *buffer;
  713|      0|      size_t length, pos, size;
  714|      0|      u32 created_at;
  715|       |
  716|      0|      if (skipped_deleted)
  ------------------
  |  Branch (716:11): [True: 0, False: 0]
  ------------------
  717|      0|        any_changes = 1;
  718|      0|      buffer = _keybox_get_blob_image (blob, &length);
  719|      0|      if (first_blob)
  ------------------
  |  Branch (719:11): [True: 0, False: 0]
  ------------------
  720|      0|        {
  721|      0|          first_blob = 0;
  722|      0|          if (length > 4 && buffer[4] == KEYBOX_BLOBTYPE_HEADER)
  ------------------
  |  Branch (722:15): [True: 0, False: 0]
  |  Branch (722:29): [True: 0, False: 0]
  ------------------
  723|      0|            {
  724|       |              /* Write out the blob with an updated maintenance time
  725|       |                 stamp and if needed (ie. used by gpg) set the openpgp
  726|       |                 flag.  */
  727|      0|              _keybox_update_header_blob (blob, hd->for_openpgp);
  728|      0|              rc = _keybox_write_blob (blob, newfp, NULL);
  729|      0|              if (rc)
  ------------------
  |  Branch (729:19): [True: 0, False: 0]
  ------------------
  730|      0|                break;
  731|      0|              continue;
  732|      0|            }
  733|       |
  734|       |          /* The header blob is missing.  Insert it.  */
  735|      0|          rc = _keybox_write_header_blob (newfp, hd->for_openpgp);
  736|      0|          if (rc)
  ------------------
  |  Branch (736:15): [True: 0, False: 0]
  ------------------
  737|      0|            break;
  738|      0|          any_changes = 1;
  739|      0|        }
  740|      0|      else if (length > 4 && buffer[4] == KEYBOX_BLOBTYPE_HEADER)
  ------------------
  |  Branch (740:16): [True: 0, False: 0]
  |  Branch (740:30): [True: 0, False: 0]
  ------------------
  741|      0|        {
  742|       |          /* Oops: There is another header record - remove it. */
  743|      0|          any_changes = 1;
  744|      0|          continue;
  745|      0|        }
  746|       |
  747|      0|      if (_keybox_get_flag_location (buffer, length,
  ------------------
  |  Branch (747:11): [True: 0, False: 0]
  ------------------
  748|      0|                                     KEYBOX_FLAG_BLOB, &pos, &size)
  749|      0|          || size != 2)
  ------------------
  |  Branch (749:14): [True: 0, False: 0]
  ------------------
  750|      0|        {
  751|      0|          rc = gpg_error (GPG_ERR_BUG);
  752|      0|          break;
  753|      0|        }
  754|      0|      blobflags = buf16_to_uint (buffer+pos);
  755|      0|      if ((blobflags & KEYBOX_FLAG_BLOB_EPHEMERAL))
  ------------------
  |  |   54|      0|#define KEYBOX_FLAG_BLOB_EPHEMERAL  2
  ------------------
  |  Branch (755:11): [True: 0, False: 0]
  ------------------
  756|      0|        {
  757|       |          /* This is an ephemeral blob. */
  758|      0|          if (_keybox_get_flag_location (buffer, length,
  ------------------
  |  Branch (758:15): [True: 0, False: 0]
  ------------------
  759|      0|                                         KEYBOX_FLAG_CREATED_AT, &pos, &size)
  760|      0|              || size != 4)
  ------------------
  |  Branch (760:18): [True: 0, False: 0]
  ------------------
  761|      0|            created_at = 0; /* oops. */
  762|      0|          else
  763|      0|            created_at = buf32_to_u32 (buffer+pos);
  764|       |
  765|      0|          if (created_at && created_at < cut_time)
  ------------------
  |  Branch (765:15): [True: 0, False: 0]
  |  Branch (765:29): [True: 0, False: 0]
  ------------------
  766|      0|            {
  767|      0|              any_changes = 1;
  768|      0|              continue; /* Skip this blob. */
  769|      0|            }
  770|      0|        }
  771|       |
  772|      0|      rc = _keybox_write_blob (blob, newfp, NULL);
  773|      0|      if (rc)
  ------------------
  |  Branch (773:11): [True: 0, False: 0]
  ------------------
  774|      0|        break;
  775|      0|    }
  776|      0|  if (skipped_deleted)
  ------------------
  |  Branch (776:7): [True: 0, False: 0]
  ------------------
  777|      0|    any_changes = 1;
  778|      0|  _keybox_release_blob (blob); blob = NULL;
  779|      0|  if (!rc && read_rc == -1)
  ------------------
  |  Branch (779:7): [True: 0, False: 0]
  |  Branch (779:14): [True: 0, False: 0]
  ------------------
  780|      0|    rc = 0;
  781|      0|  else if (!rc)
  ------------------
  |  Branch (781:12): [True: 0, False: 0]
  ------------------
  782|      0|    rc = read_rc;
  783|       |
  784|       |  /* Close both files. */
  785|      0|  if (es_fclose(fp) && !rc)
  ------------------
  |  Branch (785:7): [True: 0, False: 0]
  |  Branch (785:24): [True: 0, False: 0]
  ------------------
  786|      0|    rc = gpg_error_from_syserror ();
  787|      0|  if (es_fclose(newfp) && !rc)
  ------------------
  |  Branch (787:7): [True: 0, False: 0]
  |  Branch (787:27): [True: 0, False: 0]
  ------------------
  788|      0|    rc = gpg_error_from_syserror ();
  789|       |
  790|       |  /* Rename or remove the temporary file. */
  791|      0|  if (rc || !any_changes)
  ------------------
  |  Branch (791:7): [True: 0, False: 0]
  |  Branch (791:13): [True: 0, False: 0]
  ------------------
  792|      0|    gnupg_remove (tmpfname);
  793|      0|  else
  794|      0|    rc = rename_tmp_file (bakfname, tmpfname, fname, hd->secret);
  795|       |
  796|      0|  xfree(bakfname);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  797|      0|  xfree(tmpfname);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  798|      0|  return rc;
  799|      0|}

keybox_tmp_names:
   40|      1|{
   41|      1|  gpg_error_t err;
   42|      1|  char *bak_name, *tmp_name;
   43|       |
   44|      1|  *r_bakname = NULL;
   45|      1|  *r_tmpname = NULL;
   46|       |
   47|       |# ifdef USE_ONLY_8DOT3
   48|       |  /* Here is another Windoze bug?:
   49|       |   * you can't rename("pubring.kbx.tmp", "pubring.kbx");
   50|       |   * but	rename("pubring.kbx.tmp", "pubring.aaa");
   51|       |   * works.  So we replace ".kbx" by ".kb_" or ".k__".  Note that we
   52|       |   * can't use ".bak" and ".tmp", because these suffixes are used by
   53|       |   * gpg's keyrings and would lead to a sharing violation or data
   54|       |   * corruption.  If the name does not end in ".kbx" we assume working
   55|       |   * on a modern file system and append the suffix.  */
   56|       |  {
   57|       |    const char *ext   = for_keyring? EXTSEP_S GPGEXT_GPG : EXTSEP_S "kbx";
   58|       |    const char *b_ext = for_keyring? EXTSEP_S "bak"      : EXTSEP_S "kb_";
   59|       |    const char *t_ext = for_keyring? EXTSEP_S "tmp"      : EXTSEP_S "k__";
   60|       |    int repl;
   61|       |
   62|       |    if (strlen (ext) != 4 || strlen (b_ext) != 4)
   63|       |      BUG ();
   64|       |    repl = (strlen (filename) > 4
   65|       |            && !strcmp (filename + strlen (filename) - 4, ext));
   66|       |    bak_name = xtrymalloc (strlen (filename) + (repl?0:4) + 1);
   67|       |    if (!bak_name)
   68|       |      return gpg_error_from_syserror ();
   69|       |    strcpy (bak_name, filename);
   70|       |    strcpy (bak_name + strlen (filename) - (repl?4:0), b_ext);
   71|       |
   72|       |    tmp_name = xtrymalloc (strlen (filename) + (repl?0:4) + 1);
   73|       |    if (!tmp_name)
   74|       |      {
   75|       |        err = gpg_error_from_syserror ();
   76|       |        xfree (bak_name);
   77|       |        return err;
   78|       |      }
   79|       |    strcpy (tmp_name, filename);
   80|       |    strcpy (tmp_name + strlen (filename) - (repl?4:0), t_ext);
   81|       |  }
   82|       |# else /* Posix file names */
   83|      1|  (void)for_keyring;
   84|      1|  bak_name = xtrymalloc (strlen (filename) + 2);
  ------------------
  |  |   97|      1|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
   85|      1|  if (!bak_name)
  ------------------
  |  Branch (85:7): [True: 0, False: 1]
  ------------------
   86|      0|    return gpg_error_from_syserror ();
   87|      1|  strcpy (stpcpy (bak_name, filename), "~");
   88|       |
   89|      1|  tmp_name = xtrymalloc (strlen (filename) + 5);
  ------------------
  |  |   97|      1|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
   90|      1|  if (!tmp_name)
  ------------------
  |  Branch (90:7): [True: 0, False: 1]
  ------------------
   91|      0|    {
   92|      0|      err = gpg_error_from_syserror ();
   93|      0|      xfree (bak_name);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
   94|      0|      return err;
   95|      0|    }
   96|      1|  strcpy (stpcpy (tmp_name,filename), EXTSEP_S "tmp");
  ------------------
  |  |  889|      1|#define EXTSEP_S "."
  ------------------
   97|      1|# endif /* Posix filename */
   98|       |
   99|      1|  *r_bakname = bak_name;
  100|      1|  *r_tmpname = tmp_name;
  101|      1|  return 0;
  102|      1|}

LLVMFuzzerTestOneInput:
   90|  12.2k|int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   91|       |
   92|  12.2k|    if (! initialized) {
  ------------------
  |  Branch (92:9): [True: 1, False: 12.2k]
  ------------------
   93|      1|        ctrlGlobal = (ctrl_t) malloc(sizeof(*ctrlGlobal));
   94|      1|        if (!ctrlGlobal) {
  ------------------
  |  Branch (94:13): [True: 0, False: 1]
  ------------------
   95|      0|            exit(1);
   96|      0|        }
   97|       |        //deletes previous tmp dir and (re)create it as a ramfs
   98|       |        //system("umount /tmp/fuzzdirverify");
   99|      1|        rmrfdir("/tmp/fuzzdirverify");
  100|      1|        mkdir("/tmp/fuzzdirverify/", 0700);
  101|       |        //system("mount -t tmpfs -o size=64M tmpfs /tmp/fuzzdirverify");
  102|      1|        filename=strdup("/tmp/fuzzdirverify/fuzz.gpg");
  103|      1|        if (!filename) {
  ------------------
  |  Branch (103:13): [True: 0, False: 1]
  ------------------
  104|      0|            free(ctrlGlobal);
  105|      0|            return 0;
  106|      0|        }
  107|      1|        fd = open("/tmp/fuzzdirverify/fuzz.gpg", O_RDWR | O_CREAT, 0600);
  108|      1|        if (fd == -1) {
  ------------------
  |  Branch (108:13): [True: 0, False: 1]
  ------------------
  109|      0|            free(ctrlGlobal);
  110|      0|            free(filename);
  111|      0|            return 0;
  112|      0|        }
  113|      1|        gnupg_set_homedir("/tmp/fuzzdirverify/");
  114|      1|        if (keydb_add_resource ("pubring" EXTSEP_S GPGEXT_GPG,
  ------------------
  |  |  122|      1|#define GPGEXT_GPG "gpg"
  ------------------
  |  Branch (114:13): [True: 0, False: 1]
  ------------------
  115|      1|                                KEYDB_RESOURCE_FLAG_DEFAULT) != GPG_ERR_NO_ERROR) {
  ------------------
  |  |  212|      1|#define KEYDB_RESOURCE_FLAG_DEFAULT  4  /* The default one.  */
  ------------------
  116|      0|            free(filename);
  117|      0|            free(ctrlGlobal);
  118|      0|            close(fd);
  119|      0|            return 0;
  120|      0|        }
  121|      1|        if (setup_trustdb (1, NULL) != GPG_ERR_NO_ERROR) {
  ------------------
  |  Branch (121:13): [True: 0, False: 1]
  ------------------
  122|      0|            free(filename);
  123|      0|            free(ctrlGlobal);
  124|      0|            close(fd);
  125|      0|            return 0;
  126|      0|        }
  127|       |        //populate /tmp/fuzzdirverify/ as homedir ~/.gnupg
  128|      1|        strlist_t sl = NULL;
  129|      1|        public_key_list (ctrlGlobal, sl, 0, 0);
  130|      1|        free_strlist(sl);
  131|       |        //no output for stderr
  132|      1|        log_set_file("/dev/null");
  133|      1|        gcry_set_log_handler (my_gcry_logger, NULL);
  134|      1|        gnupg_initialize_compliance (GNUPG_MODULE_NAME_GPG);
  ------------------
  |  |  293|      1|#define GNUPG_MODULE_NAME_GPG           8
  ------------------
  135|      1|        initialized = true;
  136|      1|    }
  137|       |
  138|  12.2k|    memset(ctrlGlobal, 0, sizeof(*ctrlGlobal));
  139|  12.2k|    ctrlGlobal->magic = SERVER_CONTROL_MAGIC;
  ------------------
  |  |   83|  12.2k|# define SERVER_CONTROL_MAGIC 0x53616c696e676572
  ------------------
  140|       |
  141|  12.2k|    if (ftruncate(fd, Size) == -1) {
  ------------------
  |  Branch (141:9): [True: 0, False: 12.2k]
  ------------------
  142|      0|        return 0;
  143|      0|    }
  144|  12.2k|    if (lseek (fd, 0, SEEK_SET) < 0) {
  ------------------
  |  Branch (144:9): [True: 0, False: 12.2k]
  ------------------
  145|      0|        return 0;
  146|      0|    }
  147|  12.2k|    if (write (fd, Data, Size) != Size) {
  ------------------
  |  Branch (147:9): [True: 0, False: 12.2k]
  ------------------
  148|      0|        return 0;
  149|      0|    }
  150|       |
  151|  12.2k|    verify_signatures(ctrlGlobal, 1, &filename);
  152|  12.2k|    gpg_deinit_default_ctrl (ctrlGlobal);
  153|  12.2k|    memset(ctrlGlobal, 0, sizeof(*ctrlGlobal));
  154|  12.2k|    ctrlGlobal->magic = SERVER_CONTROL_MAGIC;
  ------------------
  |  |   83|  12.2k|# define SERVER_CONTROL_MAGIC 0x53616c696e676572
  ------------------
  155|  12.2k|    verify_files(ctrlGlobal, 1, &filename);
  156|  12.2k|    gpg_deinit_default_ctrl (ctrlGlobal);
  157|       |
  158|  12.2k|    return 0;
  159|  12.2k|}
fuzz_verify.c:rmrfdir:
   83|      1|{
   84|      1|    ftw(path, unlink_cb, 16);
   85|      1|    if (rmdir(path) != 0) {
  ------------------
  |  Branch (85:9): [True: 1, False: 0]
  ------------------
   86|      1|        printf("failed rmdir, errno=%d\n", errno);
   87|      1|    }
   88|      1|}
fuzz_verify.c:my_gcry_logger:
   70|  70.7k|{
   71|  70.7k|    return;
   72|  70.7k|}
fuzz_verify.c:gpg_deinit_default_ctrl:
   59|  24.4k|{
   60|       |#ifdef USE_TOFU
   61|       |    tofu_closedbs (ctrl);
   62|       |#endif
   63|  24.4k|    gpg_dirmngr_deinit_session_data (ctrl);
   64|       |
   65|  24.4k|    keydb_release (ctrl->cached_getkey_kdb);
   66|  24.4k|}

md5.c:_gcry_ctz:
   84|    834|{
   85|    834|#if defined (HAVE_BUILTIN_CTZ)
   86|    834|  return x ? __builtin_ctz (x) : 8 * sizeof (x);
  ------------------
  |  Branch (86:10): [True: 834, False: 0]
  ------------------
   87|       |#else
   88|       |  /* See
   89|       |   * http://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightModLookup
   90|       |   */
   91|       |  static const unsigned char mod37[] =
   92|       |    {
   93|       |      sizeof (unsigned int)*8,
   94|       |          0,  1, 26,  2, 23, 27,  0,  3, 16, 24, 30, 28, 11,  0, 13,
   95|       |      4,  7, 17,  0, 25, 22, 31, 15, 29, 10, 12,  6,  0, 21, 14,  9,
   96|       |      5, 20,  8, 19, 18
   97|       |    };
   98|       |  return (int)mod37[(-x & x) % 37];
   99|       |#endif
  100|    834|}
md5.c:rol:
   29|  1.29M|{
   30|  1.29M|	return ( (x << (n&(32-1))) | (x >> ((32-n)&(32-1))) );
   31|  1.29M|}
rmd160.c:_gcry_ctz:
   84|  18.5k|{
   85|  18.5k|#if defined (HAVE_BUILTIN_CTZ)
   86|  18.5k|  return x ? __builtin_ctz (x) : 8 * sizeof (x);
  ------------------
  |  Branch (86:10): [True: 18.5k, False: 0]
  ------------------
   87|       |#else
   88|       |  /* See
   89|       |   * http://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightModLookup
   90|       |   */
   91|       |  static const unsigned char mod37[] =
   92|       |    {
   93|       |      sizeof (unsigned int)*8,
   94|       |          0,  1, 26,  2, 23, 27,  0,  3, 16, 24, 30, 28, 11,  0, 13,
   95|       |      4,  7, 17,  0, 25, 22, 31, 15, 29, 10, 12,  6,  0, 21, 14,  9,
   96|       |      5, 20,  8, 19, 18
   97|       |    };
   98|       |  return (int)mod37[(-x & x) % 37];
   99|       |#endif
  100|  18.5k|}
rmd160.c:rol:
   29|  61.5M|{
   30|  61.5M|	return ( (x << (n&(32-1))) | (x >> ((32-n)&(32-1))) );
   31|  61.5M|}
sha1.c:_gcry_ctz:
   84|   241k|{
   85|   241k|#if defined (HAVE_BUILTIN_CTZ)
   86|   241k|  return x ? __builtin_ctz (x) : 8 * sizeof (x);
  ------------------
  |  Branch (86:10): [True: 241k, False: 0]
  ------------------
   87|       |#else
   88|       |  /* See
   89|       |   * http://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightModLookup
   90|       |   */
   91|       |  static const unsigned char mod37[] =
   92|       |    {
   93|       |      sizeof (unsigned int)*8,
   94|       |          0,  1, 26,  2, 23, 27,  0,  3, 16, 24, 30, 28, 11,  0, 13,
   95|       |      4,  7, 17,  0, 25, 22, 31, 15, 29, 10, 12,  6,  0, 21, 14,  9,
   96|       |      5, 20,  8, 19, 18
   97|       |    };
   98|       |  return (int)mod37[(-x & x) % 37];
   99|       |#endif
  100|   241k|}
sha256.c:_gcry_ctz:
   84|  22.2k|{
   85|  22.2k|#if defined (HAVE_BUILTIN_CTZ)
   86|  22.2k|  return x ? __builtin_ctz (x) : 8 * sizeof (x);
  ------------------
  |  Branch (86:10): [True: 22.2k, False: 0]
  ------------------
   87|       |#else
   88|       |  /* See
   89|       |   * http://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightModLookup
   90|       |   */
   91|       |  static const unsigned char mod37[] =
   92|       |    {
   93|       |      sizeof (unsigned int)*8,
   94|       |          0,  1, 26,  2, 23, 27,  0,  3, 16, 24, 30, 28, 11,  0, 13,
   95|       |      4,  7, 17,  0, 25, 22, 31, 15, 29, 10, 12,  6,  0, 21, 14,  9,
   96|       |      5, 20,  8, 19, 18
   97|       |    };
   98|       |  return (int)mod37[(-x & x) % 37];
   99|       |#endif
  100|  22.2k|}
sha512.c:_gcry_ctz:
   84|  7.97k|{
   85|  7.97k|#if defined (HAVE_BUILTIN_CTZ)
   86|  7.97k|  return x ? __builtin_ctz (x) : 8 * sizeof (x);
  ------------------
  |  Branch (86:10): [True: 7.97k, False: 0]
  ------------------
   87|       |#else
   88|       |  /* See
   89|       |   * http://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightModLookup
   90|       |   */
   91|       |  static const unsigned char mod37[] =
   92|       |    {
   93|       |      sizeof (unsigned int)*8,
   94|       |          0,  1, 26,  2, 23, 27,  0,  3, 16, 24, 30, 28, 11,  0, 13,
   95|       |      4,  7, 17,  0, 25, 22, 31, 15, 29, 10, 12,  6,  0, 21, 14,  9,
   96|       |      5, 20,  8, 19, 18
   97|       |    };
   98|       |  return (int)mod37[(-x & x) % 37];
   99|       |#endif
  100|  7.97k|}
tiger.c:_gcry_ctz:
   84|    763|{
   85|    763|#if defined (HAVE_BUILTIN_CTZ)
   86|    763|  return x ? __builtin_ctz (x) : 8 * sizeof (x);
  ------------------
  |  Branch (86:10): [True: 763, False: 0]
  ------------------
   87|       |#else
   88|       |  /* See
   89|       |   * http://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightModLookup
   90|       |   */
   91|       |  static const unsigned char mod37[] =
   92|       |    {
   93|       |      sizeof (unsigned int)*8,
   94|       |          0,  1, 26,  2, 23, 27,  0,  3, 16, 24, 30, 28, 11,  0, 13,
   95|       |      4,  7, 17,  0, 25, 22, 31, 15, 29, 10, 12,  6,  0, 21, 14,  9,
   96|       |      5, 20,  8, 19, 18
   97|       |    };
   98|       |  return (int)mod37[(-x & x) % 37];
   99|       |#endif
  100|    763|}

md5.c:buf_get_le32:
  136|   323k|{
  137|   323k|  return le_bswap32(((const bufhelp_u32_t *)_buf)->a);
  ------------------
  |  |   72|   323k|# define le_bswap32(x) ((u32)(x))
  ------------------
  138|   323k|}
rmd160.c:buf_get_le32:
  136|  3.07M|{
  137|  3.07M|  return le_bswap32(((const bufhelp_u32_t *)_buf)->a);
  ------------------
  |  |   72|  3.07M|# define le_bswap32(x) ((u32)(x))
  ------------------
  138|  3.07M|}
sha1.c:buf_put_be32:
  141|   723k|{
  142|   723k|  bufhelp_u32_t *out = _buf;
  143|   723k|  out->a = be_bswap32(val);
  ------------------
  |  |   73|   723k|# define be_bswap32(x) _gcry_bswap32(x)
  |  |  ------------------
  |  |  |  |   46|   723k|# define _gcry_bswap32 __builtin_bswap32
  |  |  ------------------
  ------------------
  144|   723k|}
tiger.c:buf_get_le64:
  166|   191k|{
  167|   191k|  return le_bswap64(((const bufhelp_u64_t *)_buf)->a);
  ------------------
  |  |   74|   191k|# define le_bswap64(x) ((u64)(x))
  ------------------
  168|   191k|}
crc.c:buf_put_le32:
  147|  41.7k|{
  148|  41.7k|  bufhelp_u32_t *out = _buf;
  149|  41.7k|  out->a = le_bswap32(val);
  ------------------
  |  |   72|  41.7k|# define le_bswap32(x) ((u32)(x))
  ------------------
  150|  41.7k|}
hash-common.c:buf_cpy:
  203|   122k|{
  204|   122k|  byte *dst = _dst;
  205|   122k|  const byte *src = _src;
  206|       |
  207|   122k|#if __GNUC__ >= 4
  208|   122k|  if (!__builtin_constant_p (len))
  ------------------
  |  Branch (208:7): [True: 122k, False: 0]
  ------------------
  209|   122k|    {
  210|   122k|      if (UNLIKELY(len == 0))
  ------------------
  |  |   86|   122k|#define UNLIKELY(expr)    __builtin_expect( !!(expr), 0 )
  |  |  ------------------
  |  |  |  Branch (86:27): [True: 0, False: 122k]
  |  |  ------------------
  ------------------
  211|      0|	return;
  212|   122k|      memcpy(_dst, _src, len);
  213|   122k|      return;
  214|   122k|    }
  215|      0|#endif
  216|       |
  217|      0|  while (len >= sizeof(u64))
  ------------------
  |  Branch (217:10): [True: 0, False: 0]
  ------------------
  218|      0|    {
  219|      0|      buf_put_he64(dst, buf_get_he64(src));
  ------------------
  |  |  195|      0|# define buf_put_he64 buf_put_le64
  ------------------
                    buf_put_he64(dst, buf_get_he64(src));
  ------------------
  |  |  194|      0|# define buf_get_he64 buf_get_le64
  ------------------
  220|      0|      dst += sizeof(u64);
  221|      0|      src += sizeof(u64);
  222|      0|      len -= sizeof(u64);
  223|      0|    }
  224|       |
  225|      0|  if (len >= sizeof(u32))
  ------------------
  |  Branch (225:7): [True: 0, False: 0]
  ------------------
  226|      0|    {
  227|      0|      buf_put_he32(dst, buf_get_he32(src));
  ------------------
  |  |  193|      0|# define buf_put_he32 buf_put_le32
  ------------------
                    buf_put_he32(dst, buf_get_he32(src));
  ------------------
  |  |  192|      0|# define buf_get_he32 buf_get_le32
  ------------------
  228|      0|      dst += sizeof(u32);
  229|      0|      src += sizeof(u32);
  230|      0|      len -= sizeof(u32);
  231|      0|    }
  232|       |
  233|       |  /* Handle tail.  */
  234|      0|  for (; len; len--)
  ------------------
  |  Branch (234:10): [True: 0, False: 0]
  ------------------
  235|      0|    *dst++ = *src++;
  236|      0|}

_gcry_cipher_init:
 1984|      1|{
 1985|      1|  return 0;
 1986|      1|}

crc.c:crc32_read:
  485|  1.50k|{
  486|  1.50k|  CRC_CONTEXT *ctx = (CRC_CONTEXT *) context;
  487|  1.50k|  return ctx->buf;
  488|  1.50k|}
crc.c:crc24rfc2440_init:
  840|  51.4k|{
  841|  51.4k|  CRC_CONTEXT *ctx = (CRC_CONTEXT *) context;
  842|  51.4k|  u32 hwf = _gcry_get_hw_features ();
  843|       |
  844|  51.4k|#ifdef USE_INTEL_PCLMUL
  845|  51.4k|  ctx->use_pclmul = (hwf & HWF_INTEL_SSE4_1) && (hwf & HWF_INTEL_PCLMUL);
  ------------------
  |  |  230|  51.4k|#define HWF_INTEL_SSE4_1        (1 << 8)
  ------------------
                ctx->use_pclmul = (hwf & HWF_INTEL_SSE4_1) && (hwf & HWF_INTEL_PCLMUL);
  ------------------
  |  |  231|  51.4k|#define HWF_INTEL_PCLMUL        (1 << 9)
  ------------------
  |  Branch (845:21): [True: 51.4k, False: 0]
  |  Branch (845:49): [True: 51.4k, False: 0]
  ------------------
  846|  51.4k|#endif
  847|       |#ifdef USE_ARM_PMULL
  848|       |  ctx->use_pmull = (hwf & HWF_ARM_NEON) && (hwf & HWF_ARM_PMULL);
  849|       |#endif
  850|       |#ifdef USE_PPC_VPMSUM
  851|       |  ctx->use_vpmsum = !!(hwf & HWF_PPC_ARCH_2_07);
  852|       |#endif
  853|       |
  854|  51.4k|  (void)hwf;
  855|  51.4k|  (void)flags;
  856|       |
  857|  51.4k|  ctx->CRC = crc24_init();
  858|  51.4k|}
crc.c:crc24_init:
  807|  51.4k|{
  808|       |  /* Transformed to 32-bit CRC by multiplied by x⁸ and then byte swapped. */
  809|  51.4k|  return 0xce04b7; /* _gcry_bswap(0xb704ce << 8) */
  810|  51.4k|}
crc.c:crc24rfc2440_write:
  862|  24.3k|{
  863|  24.3k|  const unsigned char *inbuf = inbuf_arg;
  864|  24.3k|  CRC_CONTEXT *ctx = (CRC_CONTEXT *) context;
  865|  24.3k|  u32 crc;
  866|       |
  867|  24.3k|#ifdef USE_INTEL_PCLMUL
  868|  24.3k|  if (ctx->use_pclmul)
  ------------------
  |  Branch (868:7): [True: 24.3k, False: 0]
  ------------------
  869|  24.3k|    {
  870|  24.3k|      _gcry_crc24rfc2440_intel_pclmul(&ctx->CRC, inbuf, inlen);
  871|  24.3k|      return;
  872|  24.3k|    }
  873|      0|#endif
  874|       |#ifdef USE_ARM_PMULL
  875|       |  if (ctx->use_pmull)
  876|       |    {
  877|       |      _gcry_crc24rfc2440_armv8_ce_pmull(&ctx->CRC, inbuf, inlen);
  878|       |      return;
  879|       |    }
  880|       |#endif
  881|       |#ifdef USE_PPC_VPMSUM
  882|       |  if (ctx->use_vpmsum)
  883|       |    {
  884|       |      _gcry_crc24rfc2440_ppc8_vpmsum(&ctx->CRC, inbuf, inlen);
  885|       |      return;
  886|       |    }
  887|       |#endif
  888|       |
  889|      0|  if (!inbuf || !inlen)
  ------------------
  |  Branch (889:7): [True: 0, False: 0]
  |  Branch (889:17): [True: 0, False: 0]
  ------------------
  890|      0|    return;
  891|       |
  892|      0|  crc = ctx->CRC;
  893|       |
  894|      0|  while (inlen >= 16)
  ------------------
  |  Branch (894:10): [True: 0, False: 0]
  ------------------
  895|      0|    {
  896|      0|      inlen -= 16;
  897|      0|      crc = crc24_next4(crc, buf_get_le32(&inbuf[0]));
  898|      0|      crc = crc24_next4(crc, buf_get_le32(&inbuf[4]));
  899|      0|      crc = crc24_next4(crc, buf_get_le32(&inbuf[8]));
  900|      0|      crc = crc24_next4(crc, buf_get_le32(&inbuf[12]));
  901|      0|      inbuf += 16;
  902|      0|    }
  903|       |
  904|      0|  while (inlen >= 4)
  ------------------
  |  Branch (904:10): [True: 0, False: 0]
  ------------------
  905|      0|    {
  906|      0|      inlen -= 4;
  907|      0|      crc = crc24_next4(crc, buf_get_le32(inbuf));
  908|      0|      inbuf += 4;
  909|      0|    }
  910|       |
  911|      0|  while (inlen--)
  ------------------
  |  Branch (911:10): [True: 0, False: 0]
  ------------------
  912|      0|    {
  913|      0|      crc = crc24_next(crc, *inbuf++);
  914|      0|    }
  915|       |
  916|      0|  ctx->CRC = crc;
  917|      0|}
crc.c:crc24rfc2440_final:
  921|  41.7k|{
  922|  41.7k|  CRC_CONTEXT *ctx = (CRC_CONTEXT *) context;
  923|  41.7k|  ctx->CRC = crc24_final(ctx->CRC);
  924|  41.7k|  buf_put_le32 (ctx->buf, ctx->CRC);
  925|  41.7k|}
crc.c:crc24_final:
  834|  41.7k|{
  835|  41.7k|  return crc & 0xffffff;
  836|  41.7k|}

_gcry_md_block_write:
  121|   135k|{
  122|   135k|  const unsigned char *inbuf = inbuf_arg;
  123|   135k|  gcry_md_block_ctx_t *hd = context;
  124|   135k|  unsigned int stack_burn = 0;
  125|   135k|  unsigned int nburn;
  126|   135k|  const unsigned int blocksize_shift = hd->blocksize_shift;
  127|   135k|  const unsigned int blocksize = 1 << blocksize_shift;
  128|   135k|  size_t inblocks;
  129|   135k|  size_t copylen;
  130|       |
  131|   135k|  if (sizeof(hd->buf) < blocksize)
  ------------------
  |  Branch (131:7): [True: 0, False: 135k]
  ------------------
  132|      0|    BUG();
  ------------------
  |  |  187|      0|#define BUG() _gcry_bug( __FILE__ , __LINE__, __FUNCTION__ )
  ------------------
  133|       |
  134|   135k|  if (!hd->bwrite)
  ------------------
  |  Branch (134:7): [True: 0, False: 135k]
  ------------------
  135|      0|    return;
  136|       |
  137|   135k|  if (hd->count > blocksize)
  ------------------
  |  Branch (137:7): [True: 0, False: 135k]
  ------------------
  138|      0|    {
  139|       |      /* This happens only when gcry_md_write is called after final.
  140|       |       * Writing after final is used for mitigating timing attacks. */
  141|      0|      hd->count = 0;
  142|      0|    }
  143|       |
  144|   151k|  while (hd->count)
  ------------------
  |  Branch (144:10): [True: 18.6k, False: 133k]
  ------------------
  145|  18.6k|    {
  146|  18.6k|      if (hd->count == blocksize)  /* Flush the buffer. */
  ------------------
  |  Branch (146:11): [True: 7.05k, False: 11.6k]
  ------------------
  147|  7.05k|	{
  148|  7.05k|	  nburn = hd->bwrite (hd, hd->buf, 1);
  149|  7.05k|	  stack_burn = nburn > stack_burn ? nburn : stack_burn;
  ------------------
  |  Branch (149:17): [True: 3.41k, False: 3.64k]
  ------------------
  150|  7.05k|	  hd->count = 0;
  151|  7.05k|	  if (!++hd->nblocks)
  ------------------
  |  Branch (151:8): [True: 0, False: 7.05k]
  ------------------
  152|      0|	    hd->nblocks_high++;
  153|  7.05k|	}
  154|  11.6k|      else
  155|  11.6k|	{
  156|  11.6k|	  copylen = inlen;
  157|  11.6k|	  if (copylen > blocksize - hd->count)
  ------------------
  |  Branch (157:8): [True: 6.93k, False: 4.66k]
  ------------------
  158|  6.93k|	    copylen = blocksize - hd->count;
  159|       |
  160|  11.6k|	  if (copylen == 0)
  ------------------
  |  Branch (160:8): [True: 2.33k, False: 9.26k]
  ------------------
  161|  2.33k|	    break;
  162|       |
  163|  9.26k|	  buf_cpy (&hd->buf[hd->count], inbuf, copylen);
  164|  9.26k|	  hd->count += copylen;
  165|  9.26k|	  inbuf += copylen;
  166|  9.26k|	  inlen -= copylen;
  167|  9.26k|	}
  168|  18.6k|    }
  169|       |
  170|   135k|  if (inlen == 0)
  ------------------
  |  Branch (170:7): [True: 12.2k, False: 123k]
  ------------------
  171|  12.2k|    return;
  172|       |
  173|   123k|  if (inlen >= blocksize)
  ------------------
  |  Branch (173:7): [True: 116k, False: 6.45k]
  ------------------
  174|   116k|    {
  175|   116k|      inblocks = inlen >> blocksize_shift;
  176|   116k|      nburn = hd->bwrite (hd, inbuf, inblocks);
  177|   116k|      stack_burn = nburn > stack_burn ? nburn : stack_burn;
  ------------------
  |  Branch (177:20): [True: 4.81k, False: 111k]
  ------------------
  178|   116k|      hd->count = 0;
  179|   116k|      hd->nblocks_high += (hd->nblocks + inblocks < inblocks);
  180|   116k|      hd->nblocks += inblocks;
  181|   116k|      inlen -= inblocks << blocksize_shift;
  182|   116k|      inbuf += inblocks << blocksize_shift;
  183|   116k|    }
  184|       |
  185|   123k|  if (inlen)
  ------------------
  |  Branch (185:7): [True: 112k, False: 10.3k]
  ------------------
  186|   112k|    {
  187|   112k|      buf_cpy (hd->buf, inbuf, inlen);
  188|   112k|      hd->count = inlen;
  189|   112k|    }
  190|       |
  191|   123k|  if (stack_burn > 0)
  ------------------
  |  Branch (191:7): [True: 8.16k, False: 114k]
  ------------------
  192|  8.16k|    _gcry_burn_stack (stack_burn);
  ------------------
  |  |  371|  8.16k|	do { __gcry_burn_stack (bytes); \
  |  |  372|  8.16k|	     __gcry_burn_stack_dummy (); } while(0)
  |  |  ------------------
  |  |  |  |  364|  8.16k|#define  __gcry_burn_stack_dummy() asm volatile ("":::"memory")
  |  |  ------------------
  |  |  |  Branch (372:43): [Folded - Ignored]
  |  |  ------------------
  ------------------
  193|   123k|}

_gcry_mac_init:
  384|      1|{
  385|      1|  return 0;
  386|      1|}

_gcry_md_open:
  530|   258k|{
  531|   258k|  gcry_err_code_t rc;
  532|   258k|  gcry_md_hd_t hd;
  533|       |
  534|   258k|  if ((flags & ~(GCRY_MD_FLAG_SECURE
  ------------------
  |  Branch (534:7): [True: 0, False: 258k]
  ------------------
  535|   258k|                 | GCRY_MD_FLAG_HMAC
  536|   258k|                 | GCRY_MD_FLAG_BUGEMU1)))
  537|      0|    rc = GPG_ERR_INV_ARG;
  538|   258k|  else
  539|   258k|    rc = md_open (&hd, algo, flags);
  540|       |
  541|   258k|  *h = rc? NULL : hd;
  ------------------
  |  Branch (541:8): [True: 1.03k, False: 257k]
  ------------------
  542|   258k|  return rc;
  543|   258k|}
_gcry_md_enable:
  612|   161k|{
  613|   161k|  return md_enable (hd, algorithm);
  614|   161k|}
_gcry_md_copy:
  684|  16.2k|{
  685|  16.2k|  gcry_err_code_t rc;
  686|       |
  687|  16.2k|  rc = md_copy (hd, handle);
  688|  16.2k|  if (rc)
  ------------------
  |  Branch (688:7): [True: 0, False: 16.2k]
  ------------------
  689|      0|    *handle = NULL;
  690|  16.2k|  return rc;
  691|  16.2k|}
_gcry_md_reset:
  700|  44.7k|{
  701|  44.7k|  GcryDigestEntry *r;
  702|       |
  703|       |  /* Note: We allow this even in fips non operational mode.  */
  704|       |
  705|  44.7k|  a->bufpos = a->ctx->flags.finalized = 0;
  706|       |
  707|  44.7k|  if (a->ctx->flags.hmac)
  ------------------
  |  Branch (707:7): [True: 0, False: 44.7k]
  ------------------
  708|      0|    for (r = a->ctx->list; r; r = r->next)
  ------------------
  |  Branch (708:28): [True: 0, False: 0]
  ------------------
  709|      0|      {
  710|      0|        memcpy (r->context, (char *)r->context + r->spec->contextsize,
  711|      0|                r->spec->contextsize);
  712|      0|      }
  713|  44.7k|  else
  714|  89.5k|    for (r = a->ctx->list; r; r = r->next)
  ------------------
  |  Branch (714:28): [True: 44.7k, False: 44.7k]
  ------------------
  715|  44.7k|      {
  716|  44.7k|        memset (r->context, 0, r->spec->contextsize);
  717|  44.7k|        (*r->spec->init) (r->context,
  718|  44.7k|                          a->ctx->flags.bugemu1? GCRY_MD_FLAG_BUGEMU1:0);
  ------------------
  |  Branch (718:27): [True: 0, False: 44.7k]
  ------------------
  719|  44.7k|      }
  720|  44.7k|}
_gcry_md_close:
  746|  1.11M|{
  747|       |  /* Note: We allow this even in fips non operational mode.  */
  748|  1.11M|  md_close (hd);
  749|  1.11M|}
_gcry_md_write:
  780|  35.9k|{
  781|  35.9k|  md_write (hd, inbuf, inlen);
  782|  35.9k|}
_gcry_md_ctl:
 1001|  43.2k|{
 1002|  43.2k|  gcry_err_code_t rc = 0;
 1003|       |
 1004|  43.2k|  (void)buflen; /* Currently not used.  */
 1005|       |
 1006|  43.2k|  switch (cmd)
 1007|  43.2k|    {
 1008|  43.2k|    case GCRYCTL_FINALIZE:
  ------------------
  |  Branch (1008:5): [True: 43.2k, False: 0]
  ------------------
 1009|  43.2k|      md_final (hd);
 1010|  43.2k|      break;
 1011|      0|    case GCRYCTL_START_DUMP:
  ------------------
  |  Branch (1011:5): [True: 0, False: 43.2k]
  ------------------
 1012|      0|      md_start_debug (hd, buffer);
 1013|      0|      break;
 1014|      0|    case GCRYCTL_STOP_DUMP:
  ------------------
  |  Branch (1014:5): [True: 0, False: 43.2k]
  ------------------
 1015|      0|      md_stop_debug ( hd );
 1016|      0|      break;
 1017|      0|    default:
  ------------------
  |  Branch (1017:5): [True: 0, False: 43.2k]
  ------------------
 1018|      0|      rc = GPG_ERR_INV_OP;
 1019|  43.2k|    }
 1020|  43.2k|  return rc;
 1021|  43.2k|}
_gcry_md_read:
 1103|  1.50k|{
 1104|       |  /* This function is expected to always return a digest, thus we
 1105|       |     can't return an error which we actually should do in
 1106|       |     non-operational state.  */
 1107|  1.50k|  _gcry_md_ctl (hd, GCRYCTL_FINALIZE, NULL, 0);
 1108|  1.50k|  return md_read (hd, algo);
 1109|  1.50k|}
_gcry_md_algo_info:
 1429|  48.1k|{
 1430|  48.1k|  gcry_err_code_t rc;
 1431|       |
 1432|  48.1k|  switch (what)
 1433|  48.1k|    {
 1434|  48.1k|    case GCRYCTL_TEST_ALGO:
  ------------------
  |  Branch (1434:5): [True: 48.1k, False: 0]
  ------------------
 1435|  48.1k|      if (buffer || nbytes)
  ------------------
  |  Branch (1435:11): [True: 0, False: 48.1k]
  |  Branch (1435:21): [True: 0, False: 48.1k]
  ------------------
 1436|      0|	rc = GPG_ERR_INV_ARG;
 1437|  48.1k|      else
 1438|  48.1k|	rc = check_digest_algo (algo);
 1439|  48.1k|      break;
 1440|       |
 1441|      0|    case GCRYCTL_GET_ASNOID:
  ------------------
  |  Branch (1441:5): [True: 0, False: 48.1k]
  ------------------
 1442|       |      /* We need to check that the algo is available because
 1443|       |         md_asn_oid would otherwise raise an assertion. */
 1444|      0|      rc = check_digest_algo (algo);
 1445|      0|      if (!rc)
  ------------------
  |  Branch (1445:11): [True: 0, False: 0]
  ------------------
 1446|      0|        {
 1447|      0|          const char unsigned *asn;
 1448|      0|          size_t asnlen;
 1449|       |
 1450|      0|          asn = md_asn_oid (algo, &asnlen, NULL);
 1451|      0|          if (buffer && (*nbytes >= asnlen))
  ------------------
  |  Branch (1451:15): [True: 0, False: 0]
  |  Branch (1451:25): [True: 0, False: 0]
  ------------------
 1452|      0|            {
 1453|      0|              memcpy (buffer, asn, asnlen);
 1454|      0|              *nbytes = asnlen;
 1455|      0|            }
 1456|      0|          else if (!buffer && nbytes)
  ------------------
  |  Branch (1456:20): [True: 0, False: 0]
  |  Branch (1456:31): [True: 0, False: 0]
  ------------------
 1457|      0|            *nbytes = asnlen;
 1458|      0|          else
 1459|      0|            {
 1460|      0|              if (buffer)
  ------------------
  |  Branch (1460:19): [True: 0, False: 0]
  ------------------
 1461|      0|                rc = GPG_ERR_TOO_SHORT;
 1462|      0|              else
 1463|      0|                rc = GPG_ERR_INV_ARG;
 1464|      0|            }
 1465|      0|        }
 1466|      0|      break;
 1467|       |
 1468|      0|    case GCRYCTL_SELFTEST:
  ------------------
  |  Branch (1468:5): [True: 0, False: 48.1k]
  ------------------
 1469|       |      /* Helper function for the regression tests.  */
 1470|      0|      rc = gpg_err_code (_gcry_md_selftest (algo, nbytes? (int)*nbytes : 0,
  ------------------
  |  Branch (1470:51): [True: 0, False: 0]
  ------------------
 1471|      0|                                             NULL));
 1472|      0|      break;
 1473|       |
 1474|      0|    default:
  ------------------
  |  Branch (1474:5): [True: 0, False: 48.1k]
  ------------------
 1475|      0|      rc = GPG_ERR_INV_OP;
 1476|      0|      break;
 1477|  48.1k|  }
 1478|       |
 1479|  48.1k|  return rc;
 1480|  48.1k|}
_gcry_md_info:
 1538|  14.5k|{
 1539|  14.5k|  gcry_err_code_t rc = 0;
 1540|       |
 1541|  14.5k|  switch (cmd)
 1542|  14.5k|    {
 1543|      0|    case GCRYCTL_IS_SECURE:
  ------------------
  |  Branch (1543:5): [True: 0, False: 14.5k]
  ------------------
 1544|      0|      *nbytes = h->ctx->flags.secure;
 1545|      0|      break;
 1546|       |
 1547|  14.5k|    case GCRYCTL_IS_ALGO_ENABLED:
  ------------------
  |  Branch (1547:5): [True: 14.5k, False: 0]
  ------------------
 1548|  14.5k|      {
 1549|  14.5k|	GcryDigestEntry *r;
 1550|  14.5k|	int algo;
 1551|       |
 1552|  14.5k|	if ( !buffer || !nbytes || *nbytes != sizeof (int))
  ------------------
  |  Branch (1552:7): [True: 0, False: 14.5k]
  |  Branch (1552:18): [True: 0, False: 14.5k]
  |  Branch (1552:29): [True: 0, False: 14.5k]
  ------------------
 1553|      0|	  rc = GPG_ERR_INV_ARG;
 1554|  14.5k|	else
 1555|  14.5k|	  {
 1556|  14.5k|	    algo = *(int*)buffer;
 1557|       |
 1558|  14.5k|	    *nbytes = 0;
 1559|  15.9k|	    for(r=h->ctx->list; r; r = r->next ) {
  ------------------
  |  Branch (1559:26): [True: 14.0k, False: 1.95k]
  ------------------
 1560|  14.0k|	      if (r->spec->algo == algo)
  ------------------
  |  Branch (1560:12): [True: 12.5k, False: 1.44k]
  ------------------
 1561|  12.5k|		{
 1562|  12.5k|		  *nbytes = 1;
 1563|  12.5k|		  break;
 1564|  12.5k|		}
 1565|  14.0k|	    }
 1566|  14.5k|	  }
 1567|  14.5k|	break;
 1568|      0|      }
 1569|       |
 1570|      0|  default:
  ------------------
  |  Branch (1570:3): [True: 0, False: 14.5k]
  ------------------
 1571|      0|    rc = GPG_ERR_INV_OP;
 1572|  14.5k|  }
 1573|       |
 1574|  14.5k|  return rc;
 1575|  14.5k|}
_gcry_md_init:
 1581|      1|{
 1582|      1|  return 0;
 1583|      1|}
_gcry_md_is_enabled:
 1600|  14.5k|{
 1601|  14.5k|  size_t value;
 1602|       |
 1603|  14.5k|  value = sizeof algo;
 1604|  14.5k|  if (_gcry_md_info (a, GCRYCTL_IS_ALGO_ENABLED, &algo, &value))
  ------------------
  |  Branch (1604:7): [True: 0, False: 14.5k]
  ------------------
 1605|      0|    value = 0;
 1606|  14.5k|  return value;
 1607|  14.5k|}
md.c:spec_from_algo:
  301|   210k|{
  302|   210k|  const gcry_md_spec_t *spec = NULL;
  303|       |
  304|   210k|  algo = map_algo (algo);
  305|       |
  306|   210k|  if (algo >= 0 && algo < DIM(digest_list_algo0))
  ------------------
  |  |  104|   210k|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (306:7): [True: 210k, False: 0]
  |  Branch (306:20): [True: 195k, False: 15.2k]
  ------------------
  307|   195k|    spec = digest_list_algo0[algo];
  308|  15.2k|  else if (algo >= 301 && algo < 301 + DIM(digest_list_algo301))
  ------------------
  |  |  104|  6.66k|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (308:12): [True: 6.66k, False: 8.58k]
  |  Branch (308:27): [True: 6.66k, False: 0]
  ------------------
  309|  6.66k|    spec = digest_list_algo301[algo - 301];
  310|       |
  311|   210k|  if (spec)
  ------------------
  |  Branch (311:7): [True: 140k, False: 70.7k]
  ------------------
  312|   140k|    gcry_assert (spec->algo == algo);
  ------------------
  |  |  188|   140k|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|   140k|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 140k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|   140k|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  313|       |
  314|      0|  return spec;
  315|   210k|}
md.c:map_algo:
  292|   210k|{
  293|   210k|  return algo;
  294|   210k|}
md.c:md_open:
  450|   258k|{
  451|   258k|  gcry_err_code_t err = 0;
  452|   258k|  int secure = !!(flags & GCRY_MD_FLAG_SECURE);
  453|   258k|  int hmac =   !!(flags & GCRY_MD_FLAG_HMAC);
  454|   258k|  int bufsize = secure ? 512 : 1024;
  ------------------
  |  Branch (454:17): [True: 0, False: 258k]
  ------------------
  455|   258k|  gcry_md_hd_t hd;
  456|   258k|  size_t n;
  457|       |
  458|       |  /* Allocate a memory area to hold the caller visible buffer with it's
  459|       |   * control information and the data required by this module. Set the
  460|       |   * context pointer at the beginning to this area.
  461|       |   * We have to use this strange scheme because we want to hide the
  462|       |   * internal data but have a variable sized buffer.
  463|       |   *
  464|       |   *	+---+------+---........------+-------------+
  465|       |   *	!ctx! bctl !  buffer	     ! private	   !
  466|       |   *	+---+------+---........------+-------------+
  467|       |   *	  !			      ^
  468|       |   *	  !---------------------------!
  469|       |   *
  470|       |   * We have to make sure that private is well aligned.
  471|       |   */
  472|   258k|  n = offsetof (struct gcry_md_handle, buf) + bufsize;
  473|   258k|  n = ((n + sizeof (PROPERLY_ALIGNED_TYPE) - 1)
  474|   258k|       / sizeof (PROPERLY_ALIGNED_TYPE)) * sizeof (PROPERLY_ALIGNED_TYPE);
  475|       |
  476|       |  /* Allocate and set the Context pointer to the private data */
  477|   258k|  if (secure)
  ------------------
  |  Branch (477:7): [True: 0, False: 258k]
  ------------------
  478|      0|    hd = xtrymalloc_secure (n + sizeof (struct gcry_md_context));
  ------------------
  |  |  140|      0|#define xtrymalloc_secure(a)   _gcry_malloc_secure ((a))
  ------------------
  479|   258k|  else
  480|   258k|    hd = xtrymalloc (n + sizeof (struct gcry_md_context));
  ------------------
  |  |  138|   258k|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  481|       |
  482|   258k|  if (! hd)
  ------------------
  |  Branch (482:7): [True: 0, False: 258k]
  ------------------
  483|      0|    err = gpg_err_code_from_errno (errno);
  484|       |
  485|   258k|  if (! err)
  ------------------
  |  Branch (485:7): [True: 258k, False: 0]
  ------------------
  486|   258k|    {
  487|   258k|      struct gcry_md_context *ctx;
  488|       |
  489|   258k|      ctx = (void *) (hd->buf - offsetof (struct gcry_md_handle, buf) + n);
  490|       |      /* Setup the globally visible data (bctl in the diagram).*/
  491|   258k|      hd->ctx = ctx;
  492|   258k|      hd->bufsize = n - offsetof (struct gcry_md_handle, buf);
  493|   258k|      hd->bufpos = 0;
  494|       |
  495|       |      /* Initialize the private data. */
  496|   258k|      wipememory2 (ctx, 0, sizeof *ctx);
  ------------------
  |  |  388|   258k|#define wipememory2(_ptr,_set,_len) do { \
  |  |  389|   258k|	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  ------------------
  |  |  |  |   87|   516k|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  ------------------
  |  |               	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  ------------------
  |  |  |  |   87|      0|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  ------------------
  |  |  |  Branch (389:12): [Folded - Ignored]
  |  |  |  Branch (389:33): [Folded - Ignored]
  |  |  ------------------
  |  |  390|      0|		if (CONSTANT_P(_set) && (_set) == 0) \
  |  |  ------------------
  |  |  |  |   87|      0|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (87:27): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (390:27): [Folded - Ignored]
  |  |  ------------------
  |  |  391|      0|		  _gcry_fast_wipememory((void *)(_ptr), (_len)); \
  |  |  392|      0|		else \
  |  |  393|      0|		  _gcry_fast_wipememory2((void *)(_ptr), (_set), (_len)); \
  |  |  394|   258k|	      } else { \
  |  |  395|   258k|		fast_wipememory2_inline((void *)(_ptr), (_set), (_len)); \
  |  |  ------------------
  |  |  |  |  380|   258k|#define fast_wipememory2_inline(_ptr,_set,_len) do { \
  |  |  |  |  381|   258k|	      memset((_ptr), (_set), (_len)); \
  |  |  |  |  382|   258k|	      asm volatile ("\n" :: "r" (_ptr) : "memory"); \
  |  |  |  |  383|   258k|	    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (383:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  396|   258k|	      } \
  |  |  397|   258k|	    } while(0)
  |  |  ------------------
  |  |  |  Branch (397:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  497|   258k|      ctx->magic = secure ? CTX_MAGIC_SECURE : CTX_MAGIC_NORMAL;
  ------------------
  |  |  277|      0|#define CTX_MAGIC_SECURE 0x16917011
  ------------------
                    ctx->magic = secure ? CTX_MAGIC_SECURE : CTX_MAGIC_NORMAL;
  ------------------
  |  |  276|   516k|#define CTX_MAGIC_NORMAL 0x11071961
  ------------------
  |  Branch (497:20): [True: 0, False: 258k]
  ------------------
  498|   258k|      ctx->actual_handle_size = n + sizeof (struct gcry_md_context);
  499|   258k|      ctx->flags.secure = secure;
  500|   258k|      ctx->flags.hmac = hmac;
  501|   258k|      ctx->flags.bugemu1 = !!(flags & GCRY_MD_FLAG_BUGEMU1);
  502|   258k|    }
  503|       |
  504|   258k|  if (! err)
  ------------------
  |  Branch (504:7): [True: 258k, False: 0]
  ------------------
  505|   258k|    {
  506|       |      /* Hmmm, should we really do that? - yes [-wk] */
  507|   258k|      _gcry_fast_random_poll ();
  508|       |
  509|   258k|      if (algo)
  ------------------
  |  Branch (509:11): [True: 14.1k, False: 244k]
  ------------------
  510|  14.1k|	{
  511|  14.1k|	  err = md_enable (hd, algo);
  512|  14.1k|	  if (err)
  ------------------
  |  Branch (512:8): [True: 1.03k, False: 13.0k]
  ------------------
  513|  1.03k|	    md_close (hd);
  514|  14.1k|	}
  515|   258k|    }
  516|       |
  517|   258k|  if (! err)
  ------------------
  |  Branch (517:7): [True: 257k, False: 1.03k]
  ------------------
  518|   257k|    *h = hd;
  519|       |
  520|   258k|  return err;
  521|   258k|}
md.c:md_enable:
  549|   175k|{
  550|   175k|  struct gcry_md_context *h = hd->ctx;
  551|   175k|  const gcry_md_spec_t *spec;
  552|   175k|  GcryDigestEntry *entry;
  553|   175k|  gcry_err_code_t err = 0;
  554|       |
  555|   213k|  for (entry = h->list; entry; entry = entry->next)
  ------------------
  |  Branch (555:25): [True: 51.0k, False: 162k]
  ------------------
  556|  51.0k|    if (entry->spec->algo == algorithm)
  ------------------
  |  Branch (556:9): [True: 13.0k, False: 38.0k]
  ------------------
  557|  13.0k|      return 0; /* Already enabled */
  558|       |
  559|   162k|  spec = spec_from_algo (algorithm);
  560|   162k|  if (!spec)
  ------------------
  |  Branch (560:7): [True: 70.7k, False: 91.9k]
  ------------------
  561|  70.7k|    {
  562|  70.7k|      log_debug ("md_enable: algorithm %d not available\n", algorithm);
  ------------------
  |  |  205|  70.7k|#define log_debug   _gcry_log_debug
  ------------------
  563|  70.7k|      err = GPG_ERR_DIGEST_ALGO;
  564|  70.7k|    }
  565|       |
  566|   162k|  if (!err && spec->flags.disabled)
  ------------------
  |  Branch (566:7): [True: 91.9k, False: 70.7k]
  |  Branch (566:15): [True: 0, False: 91.9k]
  ------------------
  567|      0|    err = GPG_ERR_DIGEST_ALGO;
  568|       |
  569|       |  /* Any non-FIPS algorithm should go this way */
  570|   162k|  if (!err && !spec->flags.fips && fips_mode ())
  ------------------
  |  |  449|  20.1k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 20.1k]
  |  |  ------------------
  ------------------
  |  Branch (570:7): [True: 91.9k, False: 70.7k]
  |  Branch (570:15): [True: 20.1k, False: 71.8k]
  ------------------
  571|      0|    err = GPG_ERR_DIGEST_ALGO;
  572|       |
  573|   162k|  if (!err && h->flags.hmac && spec->read == NULL)
  ------------------
  |  Branch (573:7): [True: 91.9k, False: 70.7k]
  |  Branch (573:15): [True: 0, False: 91.9k]
  |  Branch (573:32): [True: 0, False: 0]
  ------------------
  574|      0|    {
  575|       |      /* Expandable output function cannot act as part of HMAC. */
  576|      0|      err = GPG_ERR_DIGEST_ALGO;
  577|      0|    }
  578|       |
  579|   162k|  if (!err)
  ------------------
  |  Branch (579:7): [True: 91.9k, False: 70.7k]
  ------------------
  580|  91.9k|    {
  581|  91.9k|      size_t size = (sizeof (*entry)
  582|  91.9k|                     + spec->contextsize * (h->flags.hmac? 3 : 1)
  ------------------
  |  Branch (582:45): [True: 0, False: 91.9k]
  ------------------
  583|  91.9k|                     - sizeof (entry->context));
  584|       |
  585|       |      /* And allocate a new list entry. */
  586|  91.9k|      if (h->flags.secure)
  ------------------
  |  Branch (586:11): [True: 0, False: 91.9k]
  ------------------
  587|      0|	entry = xtrymalloc_secure (size);
  ------------------
  |  |  140|      0|#define xtrymalloc_secure(a)   _gcry_malloc_secure ((a))
  ------------------
  588|  91.9k|      else
  589|  91.9k|	entry = xtrymalloc (size);
  ------------------
  |  |  138|  91.9k|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  590|       |
  591|  91.9k|      if (! entry)
  ------------------
  |  Branch (591:11): [True: 0, False: 91.9k]
  ------------------
  592|      0|	err = gpg_err_code_from_errno (errno);
  593|  91.9k|      else
  594|  91.9k|	{
  595|  91.9k|	  entry->spec = spec;
  596|  91.9k|	  entry->next = h->list;
  597|  91.9k|          entry->actual_struct_size = size;
  598|  91.9k|	  h->list = entry;
  599|       |
  600|       |	  /* And init this instance. */
  601|  91.9k|	  entry->spec->init (entry->context,
  602|  91.9k|                             h->flags.bugemu1? GCRY_MD_FLAG_BUGEMU1:0);
  ------------------
  |  Branch (602:30): [True: 0, False: 91.9k]
  ------------------
  603|  91.9k|	}
  604|  91.9k|    }
  605|       |
  606|   162k|  return err;
  607|   175k|}
md.c:md_copy:
  619|  16.2k|{
  620|  16.2k|  gcry_err_code_t err = 0;
  621|  16.2k|  struct gcry_md_context *a = ahd->ctx;
  622|  16.2k|  struct gcry_md_context *b;
  623|  16.2k|  GcryDigestEntry *ar, *br;
  624|  16.2k|  gcry_md_hd_t bhd;
  625|  16.2k|  size_t n;
  626|       |
  627|  16.2k|  if (ahd->bufpos)
  ------------------
  |  Branch (627:7): [True: 41, False: 16.1k]
  ------------------
  628|     41|    md_write (ahd, NULL, 0);
  629|       |
  630|  16.2k|  n = (char *) ahd->ctx - (char *) ahd;
  631|  16.2k|  if (a->flags.secure)
  ------------------
  |  Branch (631:7): [True: 0, False: 16.2k]
  ------------------
  632|      0|    bhd = xtrymalloc_secure (n + sizeof (struct gcry_md_context));
  ------------------
  |  |  140|      0|#define xtrymalloc_secure(a)   _gcry_malloc_secure ((a))
  ------------------
  633|  16.2k|  else
  634|  16.2k|    bhd = xtrymalloc (n + sizeof (struct gcry_md_context));
  ------------------
  |  |  138|  16.2k|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  635|       |
  636|  16.2k|  if (!bhd)
  ------------------
  |  Branch (636:7): [True: 0, False: 16.2k]
  ------------------
  637|      0|    {
  638|      0|      err = gpg_err_code_from_syserror ();
  639|      0|      goto leave;
  640|      0|    }
  641|       |
  642|  16.2k|  bhd->ctx = b = (void *) ((char *) bhd + n);
  643|       |  /* No need to copy the buffer due to the write above. */
  644|  16.2k|  gcry_assert (ahd->bufsize == (n - offsetof (struct gcry_md_handle, buf)));
  ------------------
  |  |  188|  16.2k|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|  16.2k|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 16.2k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|  16.2k|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  645|      0|  bhd->bufsize = ahd->bufsize;
  646|  16.2k|  bhd->bufpos = 0;
  647|  16.2k|  gcry_assert (! ahd->bufpos);
  ------------------
  |  |  188|  16.2k|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|  16.2k|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 16.2k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|  16.2k|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  648|      0|  memcpy (b, a, sizeof *a);
  649|  16.2k|  b->list = NULL;
  650|  16.2k|  b->debug = NULL;
  651|       |
  652|       |  /* Copy the complete list of algorithms.  The copied list is
  653|       |     reversed, but that doesn't matter. */
  654|  32.0k|  for (ar = a->list; ar; ar = ar->next)
  ------------------
  |  Branch (654:22): [True: 15.8k, False: 16.2k]
  ------------------
  655|  15.8k|    {
  656|  15.8k|      if (a->flags.secure)
  ------------------
  |  Branch (656:11): [True: 0, False: 15.8k]
  ------------------
  657|      0|        br = xtrymalloc_secure (ar->actual_struct_size);
  ------------------
  |  |  140|      0|#define xtrymalloc_secure(a)   _gcry_malloc_secure ((a))
  ------------------
  658|  15.8k|      else
  659|  15.8k|        br = xtrymalloc (ar->actual_struct_size);
  ------------------
  |  |  138|  15.8k|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  660|  15.8k|      if (!br)
  ------------------
  |  Branch (660:11): [True: 0, False: 15.8k]
  ------------------
  661|      0|        {
  662|      0|          err = gpg_err_code_from_syserror ();
  663|      0|          md_close (bhd);
  664|      0|          goto leave;
  665|      0|        }
  666|       |
  667|  15.8k|      memcpy (br, ar, ar->actual_struct_size);
  668|  15.8k|      br->next = b->list;
  669|  15.8k|      b->list = br;
  670|  15.8k|    }
  671|       |
  672|  16.2k|  if (a->debug)
  ------------------
  |  Branch (672:7): [True: 0, False: 16.2k]
  ------------------
  673|      0|    md_start_debug (bhd, "unknown");
  674|       |
  675|  16.2k|  *b_hd = bhd;
  676|       |
  677|  16.2k| leave:
  678|  16.2k|  return err;
  679|  16.2k|}
md.c:md_close:
  725|  1.11M|{
  726|  1.11M|  GcryDigestEntry *r, *r2;
  727|       |
  728|  1.11M|  if (! a)
  ------------------
  |  Branch (728:7): [True: 843k, False: 274k]
  ------------------
  729|   843k|    return;
  730|   274k|  if (a->ctx->debug)
  ------------------
  |  Branch (730:7): [True: 0, False: 274k]
  ------------------
  731|      0|    md_stop_debug (a);
  732|   382k|  for (r = a->ctx->list; r; r = r2)
  ------------------
  |  Branch (732:26): [True: 107k, False: 274k]
  ------------------
  733|   107k|    {
  734|   107k|      r2 = r->next;
  735|   107k|      wipememory (r, r->actual_struct_size);
  ------------------
  |  |  398|   107k|#define wipememory(_ptr,_len) wipememory2((_ptr),0,(_len))
  |  |  ------------------
  |  |  |  |  388|   107k|#define wipememory2(_ptr,_set,_len) do { \
  |  |  |  |  389|   107k|	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|   215k|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  ------------------
  |  |  |  |               	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|      0|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (389:12): [True: 107k, False: 0]
  |  |  |  |  |  Branch (389:33): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  390|   107k|		if (CONSTANT_P(_set) && (_set) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|   215k|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (87:27): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:27): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  391|   107k|		  _gcry_fast_wipememory((void *)(_ptr), (_len)); \
  |  |  |  |  392|   107k|		else \
  |  |  |  |  393|   107k|		  _gcry_fast_wipememory2((void *)(_ptr), (_set), (_len)); \
  |  |  |  |  394|   107k|	      } else { \
  |  |  |  |  395|      0|		fast_wipememory2_inline((void *)(_ptr), (_set), (_len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|      0|#define fast_wipememory2_inline(_ptr,_set,_len) do { \
  |  |  |  |  |  |  381|      0|	      memset((_ptr), (_set), (_len)); \
  |  |  |  |  |  |  382|      0|	      asm volatile ("\n" :: "r" (_ptr) : "memory"); \
  |  |  |  |  |  |  383|      0|	    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (383:14): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  396|      0|	      } \
  |  |  |  |  397|   107k|	    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (397:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  736|   107k|      xfree (r);
  ------------------
  |  |  150|   107k|#define xfree(a)         _gcry_free ((a))
  ------------------
  737|   107k|    }
  738|       |
  739|   274k|  wipememory (a, a->ctx->actual_handle_size);
  ------------------
  |  |  398|   274k|#define wipememory(_ptr,_len) wipememory2((_ptr),0,(_len))
  |  |  ------------------
  |  |  |  |  388|   274k|#define wipememory2(_ptr,_set,_len) do { \
  |  |  |  |  389|   274k|	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|   549k|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  ------------------
  |  |  |  |               	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|      0|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (389:12): [True: 274k, False: 0]
  |  |  |  |  |  Branch (389:33): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  390|   274k|		if (CONSTANT_P(_set) && (_set) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|   549k|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (87:27): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:27): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  391|   274k|		  _gcry_fast_wipememory((void *)(_ptr), (_len)); \
  |  |  |  |  392|   274k|		else \
  |  |  |  |  393|   274k|		  _gcry_fast_wipememory2((void *)(_ptr), (_set), (_len)); \
  |  |  |  |  394|   274k|	      } else { \
  |  |  |  |  395|      0|		fast_wipememory2_inline((void *)(_ptr), (_set), (_len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|      0|#define fast_wipememory2_inline(_ptr,_set,_len) do { \
  |  |  |  |  |  |  381|      0|	      memset((_ptr), (_set), (_len)); \
  |  |  |  |  |  |  382|      0|	      asm volatile ("\n" :: "r" (_ptr) : "memory"); \
  |  |  |  |  |  |  383|      0|	    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (383:14): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  396|      0|	      } \
  |  |  |  |  397|   274k|	    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (397:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  740|   274k|  xfree(a);
  ------------------
  |  |  150|   274k|#define xfree(a)         _gcry_free ((a))
  ------------------
  741|   274k|}
md.c:md_write:
  754|  35.9k|{
  755|  35.9k|  GcryDigestEntry *r;
  756|       |
  757|  35.9k|  if (a->ctx->debug)
  ------------------
  |  Branch (757:7): [True: 0, False: 35.9k]
  ------------------
  758|      0|    {
  759|      0|      if (a->bufpos && fwrite (a->buf, a->bufpos, 1, a->ctx->debug) != 1)
  ------------------
  |  Branch (759:11): [True: 0, False: 0]
  |  Branch (759:24): [True: 0, False: 0]
  ------------------
  760|      0|	BUG();
  ------------------
  |  |  187|      0|#define BUG() _gcry_bug( __FILE__ , __LINE__, __FUNCTION__ )
  ------------------
  761|      0|      if (inlen && fwrite (inbuf, inlen, 1, a->ctx->debug) != 1)
  ------------------
  |  Branch (761:11): [True: 0, False: 0]
  |  Branch (761:20): [True: 0, False: 0]
  ------------------
  762|      0|	BUG();
  ------------------
  |  |  187|      0|#define BUG() _gcry_bug( __FILE__ , __LINE__, __FUNCTION__ )
  ------------------
  763|      0|    }
  764|       |
  765|  82.4k|  for (r = a->ctx->list; r; r = r->next)
  ------------------
  |  Branch (765:26): [True: 46.4k, False: 35.9k]
  ------------------
  766|  46.4k|    {
  767|  46.4k|      if (a->bufpos)
  ------------------
  |  Branch (767:11): [True: 9.90k, False: 36.5k]
  ------------------
  768|  9.90k|	(*r->spec->write) (r->context, a->buf, a->bufpos);
  769|  46.4k|      (*r->spec->write) (r->context, inbuf, inlen);
  770|  46.4k|    }
  771|  35.9k|  a->bufpos = 0;
  772|  35.9k|}
md.c:md_final:
  787|  43.2k|{
  788|  43.2k|  GcryDigestEntry *r;
  789|       |
  790|  43.2k|  if (a->ctx->flags.finalized)
  ------------------
  |  Branch (790:7): [True: 1.50k, False: 41.7k]
  ------------------
  791|  1.50k|    return;
  792|       |
  793|  41.7k|  if (a->bufpos)
  ------------------
  |  Branch (793:7): [True: 0, False: 41.7k]
  ------------------
  794|      0|    md_write (a, NULL, 0);
  795|       |
  796|  83.5k|  for (r = a->ctx->list; r; r = r->next)
  ------------------
  |  Branch (796:26): [True: 41.7k, False: 41.7k]
  ------------------
  797|  41.7k|    (*r->spec->final) (r->context);
  798|       |
  799|  41.7k|  a->ctx->flags.finalized = 1;
  800|       |
  801|  41.7k|  if (!a->ctx->flags.hmac)
  ------------------
  |  Branch (801:7): [True: 41.7k, False: 0]
  ------------------
  802|  41.7k|    return;
  803|       |
  804|      0|  for (r = a->ctx->list; r; r = r->next)
  ------------------
  |  Branch (804:26): [True: 0, False: 0]
  ------------------
  805|      0|    {
  806|      0|      byte *p;
  807|      0|      size_t dlen = r->spec->mdlen;
  808|      0|      byte *hash;
  809|      0|      gcry_err_code_t err;
  810|       |
  811|      0|      if (r->spec->read == NULL)
  ------------------
  |  Branch (811:11): [True: 0, False: 0]
  ------------------
  812|      0|        continue;
  813|       |
  814|      0|      p = r->spec->read (r->context);
  815|       |
  816|      0|      if (a->ctx->flags.secure)
  ------------------
  |  Branch (816:11): [True: 0, False: 0]
  ------------------
  817|      0|        hash = xtrymalloc_secure (dlen);
  ------------------
  |  |  140|      0|#define xtrymalloc_secure(a)   _gcry_malloc_secure ((a))
  ------------------
  818|      0|      else
  819|      0|        hash = xtrymalloc (dlen);
  ------------------
  |  |  138|      0|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  820|      0|      if (!hash)
  ------------------
  |  Branch (820:11): [True: 0, False: 0]
  ------------------
  821|      0|        {
  822|      0|          err = gpg_err_code_from_errno (errno);
  823|      0|          _gcry_fatal_error (err, NULL);
  824|      0|        }
  825|       |
  826|      0|      memcpy (hash, p, dlen);
  827|      0|      memcpy (r->context, (char *)r->context + r->spec->contextsize * 2,
  828|      0|              r->spec->contextsize);
  829|      0|      (*r->spec->write) (r->context, hash, dlen);
  830|      0|      (*r->spec->final) (r->context);
  831|      0|      xfree (hash);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  832|      0|    }
  833|      0|}
md.c:md_read:
 1063|  1.50k|{
 1064|  1.50k|  GcryDigestEntry *r = a->ctx->list;
 1065|       |
 1066|  1.50k|  if (! algo)
  ------------------
  |  Branch (1066:7): [True: 0, False: 1.50k]
  ------------------
 1067|      0|    {
 1068|       |      /* Return the first algorithm */
 1069|      0|      if (r)
  ------------------
  |  Branch (1069:11): [True: 0, False: 0]
  ------------------
 1070|      0|        {
 1071|      0|          if (r->next)
  ------------------
  |  Branch (1071:15): [True: 0, False: 0]
  ------------------
 1072|      0|            log_debug ("more than one algorithm in md_read(0)\n");
  ------------------
  |  |  205|      0|#define log_debug   _gcry_log_debug
  ------------------
 1073|      0|          if (r->spec->read)
  ------------------
  |  Branch (1073:15): [True: 0, False: 0]
  ------------------
 1074|      0|            return r->spec->read (r->context);
 1075|      0|        }
 1076|      0|    }
 1077|  1.50k|  else
 1078|  1.50k|    {
 1079|  1.50k|      for (r = a->ctx->list; r; r = r->next)
  ------------------
  |  Branch (1079:30): [True: 1.50k, False: 0]
  ------------------
 1080|  1.50k|	if (r->spec->algo == algo)
  ------------------
  |  Branch (1080:6): [True: 1.50k, False: 0]
  ------------------
 1081|  1.50k|	  {
 1082|  1.50k|	    if (r->spec->read)
  ------------------
  |  Branch (1082:10): [True: 1.50k, False: 0]
  ------------------
 1083|  1.50k|              return r->spec->read (r->context);
 1084|      0|            break;
 1085|  1.50k|	  }
 1086|  1.50k|    }
 1087|       |
 1088|      0|  if (r && !r->spec->read)
  ------------------
  |  Branch (1088:7): [True: 0, False: 0]
  |  Branch (1088:12): [True: 0, False: 0]
  ------------------
 1089|      0|    _gcry_fatal_error (GPG_ERR_DIGEST_ALGO,
 1090|      0|                       "requested algo has no fixed digest length");
 1091|      0|  else
 1092|      0|    _gcry_fatal_error (GPG_ERR_DIGEST_ALGO, "requested algo not in md context");
 1093|      0|  return NULL;
 1094|      0|}
md.c:check_digest_algo:
  431|  48.1k|{
  432|  48.1k|  const gcry_md_spec_t *spec;
  433|       |
  434|  48.1k|  spec = spec_from_algo (algorithm);
  435|  48.1k|  if (spec && !spec->flags.disabled && (spec->flags.fips || !fips_mode ()))
  ------------------
  |  |  449|  10.0k|#define fips_mode() (!_gcry_no_fips_mode_required)
  ------------------
  |  Branch (435:7): [True: 48.1k, False: 0]
  |  Branch (435:15): [True: 48.1k, False: 0]
  |  Branch (435:41): [True: 38.1k, False: 10.0k]
  |  Branch (435:61): [True: 10.0k, False: 0]
  ------------------
  436|  48.1k|    return 0;
  437|       |
  438|      0|  return GPG_ERR_DIGEST_ALGO;
  439|       |
  440|  48.1k|}

md5.c:md5_init:
   57|    834|{
   58|    834|  MD5_CONTEXT *ctx = context;
   59|       |
   60|    834|  (void)flags;
   61|       |
   62|    834|  ctx->A = 0x67452301;
   63|    834|  ctx->B = 0xefcdab89;
   64|    834|  ctx->C = 0x98badcfe;
   65|    834|  ctx->D = 0x10325476;
   66|       |
   67|    834|  ctx->bctx.nblocks = 0;
   68|    834|  ctx->bctx.nblocks_high = 0;
   69|    834|  ctx->bctx.count = 0;
   70|    834|  ctx->bctx.blocksize_shift = _gcry_ctz(64);
   71|    834|  ctx->bctx.bwrite = transform;
   72|    834|}
md5.c:transform:
  212|  2.30k|{
  213|  2.30k|  unsigned int burn;
  214|       |
  215|  2.30k|  do
  216|  20.2k|    {
  217|  20.2k|      burn = transform_blk (c, data);
  218|  20.2k|      data += 64;
  219|  20.2k|    }
  220|  20.2k|  while (--nblks);
  ------------------
  |  Branch (220:10): [True: 17.9k, False: 2.30k]
  ------------------
  221|       |
  222|  2.30k|  return burn;
  223|  2.30k|}
md5.c:transform_blk:
   90|  20.2k|{
   91|  20.2k|  MD5_CONTEXT *ctx = c;
   92|  20.2k|  u32 correct_words[16];
   93|  20.2k|  register u32 A = ctx->A;
   94|  20.2k|  register u32 B = ctx->B;
   95|  20.2k|  register u32 C = ctx->C;
   96|  20.2k|  register u32 D = ctx->D;
   97|  20.2k|  u32 *cwp = correct_words;
   98|  20.2k|  int i;
   99|       |
  100|   344k|  for ( i = 0; i < 16; i++ )
  ------------------
  |  Branch (100:16): [True: 323k, False: 20.2k]
  ------------------
  101|   323k|    correct_words[i] = buf_get_le32(data + i * 4);
  102|       |
  103|  20.2k|#define OP(a, b, c, d, s, T) \
  104|  20.2k|  do			         	   \
  105|  20.2k|    {					   \
  106|  20.2k|      a += FF (b, c, d) + (*cwp++) + T;    \
  107|  20.2k|      a = rol(a, s);			   \
  108|  20.2k|      a += b;				   \
  109|  20.2k|    }					   \
  110|  20.2k|  while (0)
  111|       |
  112|       |  /* Before we start, one word about the strange constants.
  113|       |     They are defined in RFC 1321 as
  114|       |
  115|       |     T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
  116|       |  */
  117|       |
  118|       |  /* Round 1.  */
  119|  20.2k|  OP (A, B, C, D,  7, 0xd76aa478);
  ------------------
  |  |  104|  20.2k|  do			         	   \
  |  |  105|  20.2k|    {					   \
  |  |  106|  20.2k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  20.2k|      a = rol(a, s);			   \
  |  |  108|  20.2k|      a += b;				   \
  |  |  109|  20.2k|    }					   \
  |  |  110|  20.2k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  120|  20.2k|  OP (D, A, B, C, 12, 0xe8c7b756);
  ------------------
  |  |  104|  20.2k|  do			         	   \
  |  |  105|  20.2k|    {					   \
  |  |  106|  20.2k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  20.2k|      a = rol(a, s);			   \
  |  |  108|  20.2k|      a += b;				   \
  |  |  109|  20.2k|    }					   \
  |  |  110|  20.2k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  121|  20.2k|  OP (C, D, A, B, 17, 0x242070db);
  ------------------
  |  |  104|  20.2k|  do			         	   \
  |  |  105|  20.2k|    {					   \
  |  |  106|  20.2k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  20.2k|      a = rol(a, s);			   \
  |  |  108|  20.2k|      a += b;				   \
  |  |  109|  20.2k|    }					   \
  |  |  110|  20.2k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  122|  20.2k|  OP (B, C, D, A, 22, 0xc1bdceee);
  ------------------
  |  |  104|  20.2k|  do			         	   \
  |  |  105|  20.2k|    {					   \
  |  |  106|  20.2k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  20.2k|      a = rol(a, s);			   \
  |  |  108|  20.2k|      a += b;				   \
  |  |  109|  20.2k|    }					   \
  |  |  110|  20.2k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  123|  20.2k|  OP (A, B, C, D,  7, 0xf57c0faf);
  ------------------
  |  |  104|  20.2k|  do			         	   \
  |  |  105|  20.2k|    {					   \
  |  |  106|  20.2k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  20.2k|      a = rol(a, s);			   \
  |  |  108|  20.2k|      a += b;				   \
  |  |  109|  20.2k|    }					   \
  |  |  110|  20.2k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  124|  20.2k|  OP (D, A, B, C, 12, 0x4787c62a);
  ------------------
  |  |  104|  20.2k|  do			         	   \
  |  |  105|  20.2k|    {					   \
  |  |  106|  20.2k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  20.2k|      a = rol(a, s);			   \
  |  |  108|  20.2k|      a += b;				   \
  |  |  109|  20.2k|    }					   \
  |  |  110|  20.2k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  125|  20.2k|  OP (C, D, A, B, 17, 0xa8304613);
  ------------------
  |  |  104|  20.2k|  do			         	   \
  |  |  105|  20.2k|    {					   \
  |  |  106|  20.2k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  20.2k|      a = rol(a, s);			   \
  |  |  108|  20.2k|      a += b;				   \
  |  |  109|  20.2k|    }					   \
  |  |  110|  20.2k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  126|  20.2k|  OP (B, C, D, A, 22, 0xfd469501);
  ------------------
  |  |  104|  20.2k|  do			         	   \
  |  |  105|  20.2k|    {					   \
  |  |  106|  20.2k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  20.2k|      a = rol(a, s);			   \
  |  |  108|  20.2k|      a += b;				   \
  |  |  109|  20.2k|    }					   \
  |  |  110|  20.2k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  127|  20.2k|  OP (A, B, C, D,  7, 0x698098d8);
  ------------------
  |  |  104|  20.2k|  do			         	   \
  |  |  105|  20.2k|    {					   \
  |  |  106|  20.2k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  20.2k|      a = rol(a, s);			   \
  |  |  108|  20.2k|      a += b;				   \
  |  |  109|  20.2k|    }					   \
  |  |  110|  20.2k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  128|  20.2k|  OP (D, A, B, C, 12, 0x8b44f7af);
  ------------------
  |  |  104|  20.2k|  do			         	   \
  |  |  105|  20.2k|    {					   \
  |  |  106|  20.2k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  20.2k|      a = rol(a, s);			   \
  |  |  108|  20.2k|      a += b;				   \
  |  |  109|  20.2k|    }					   \
  |  |  110|  20.2k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  129|  20.2k|  OP (C, D, A, B, 17, 0xffff5bb1);
  ------------------
  |  |  104|  20.2k|  do			         	   \
  |  |  105|  20.2k|    {					   \
  |  |  106|  20.2k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  20.2k|      a = rol(a, s);			   \
  |  |  108|  20.2k|      a += b;				   \
  |  |  109|  20.2k|    }					   \
  |  |  110|  20.2k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  130|  20.2k|  OP (B, C, D, A, 22, 0x895cd7be);
  ------------------
  |  |  104|  20.2k|  do			         	   \
  |  |  105|  20.2k|    {					   \
  |  |  106|  20.2k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  20.2k|      a = rol(a, s);			   \
  |  |  108|  20.2k|      a += b;				   \
  |  |  109|  20.2k|    }					   \
  |  |  110|  20.2k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  131|  20.2k|  OP (A, B, C, D,  7, 0x6b901122);
  ------------------
  |  |  104|  20.2k|  do			         	   \
  |  |  105|  20.2k|    {					   \
  |  |  106|  20.2k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  20.2k|      a = rol(a, s);			   \
  |  |  108|  20.2k|      a += b;				   \
  |  |  109|  20.2k|    }					   \
  |  |  110|  20.2k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  132|  20.2k|  OP (D, A, B, C, 12, 0xfd987193);
  ------------------
  |  |  104|  20.2k|  do			         	   \
  |  |  105|  20.2k|    {					   \
  |  |  106|  20.2k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  20.2k|      a = rol(a, s);			   \
  |  |  108|  20.2k|      a += b;				   \
  |  |  109|  20.2k|    }					   \
  |  |  110|  20.2k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  133|  20.2k|  OP (C, D, A, B, 17, 0xa679438e);
  ------------------
  |  |  104|  20.2k|  do			         	   \
  |  |  105|  20.2k|    {					   \
  |  |  106|  20.2k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  20.2k|      a = rol(a, s);			   \
  |  |  108|  20.2k|      a += b;				   \
  |  |  109|  20.2k|    }					   \
  |  |  110|  20.2k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  134|  20.2k|  OP (B, C, D, A, 22, 0x49b40821);
  ------------------
  |  |  104|  20.2k|  do			         	   \
  |  |  105|  20.2k|    {					   \
  |  |  106|  20.2k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  20.2k|      a = rol(a, s);			   \
  |  |  108|  20.2k|      a += b;				   \
  |  |  109|  20.2k|    }					   \
  |  |  110|  20.2k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  135|       |
  136|  20.2k|#undef OP
  137|  20.2k|#define OP(f, a, b, c, d, k, s, T)  \
  138|  20.2k|    do								      \
  139|  20.2k|      { 							      \
  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  141|  20.2k|	a = rol(a, s);						      \
  142|  20.2k|	a += b; 						      \
  143|  20.2k|      } 							      \
  144|  20.2k|    while (0)
  145|       |
  146|       |  /* Round 2.  */
  147|  20.2k|  OP (FG, A, B, C, D,  1,  5, 0xf61e2562);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  147|  20.2k|  OP (FG, A, B, C, D,  1,  5, 0xf61e2562);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  20.2k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  148|  20.2k|  OP (FG, D, A, B, C,  6,  9, 0xc040b340);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  148|  20.2k|  OP (FG, D, A, B, C,  6,  9, 0xc040b340);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  20.2k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  149|  20.2k|  OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  149|  20.2k|  OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  20.2k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  150|  20.2k|  OP (FG, B, C, D, A,  0, 20, 0xe9b6c7aa);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  150|  20.2k|  OP (FG, B, C, D, A,  0, 20, 0xe9b6c7aa);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  20.2k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  151|  20.2k|  OP (FG, A, B, C, D,  5,  5, 0xd62f105d);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  151|  20.2k|  OP (FG, A, B, C, D,  5,  5, 0xd62f105d);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  20.2k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  152|  20.2k|  OP (FG, D, A, B, C, 10,  9, 0x02441453);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  152|  20.2k|  OP (FG, D, A, B, C, 10,  9, 0x02441453);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  20.2k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  153|  20.2k|  OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  153|  20.2k|  OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  20.2k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  154|  20.2k|  OP (FG, B, C, D, A,  4, 20, 0xe7d3fbc8);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  154|  20.2k|  OP (FG, B, C, D, A,  4, 20, 0xe7d3fbc8);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  20.2k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  155|  20.2k|  OP (FG, A, B, C, D,  9,  5, 0x21e1cde6);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  155|  20.2k|  OP (FG, A, B, C, D,  9,  5, 0x21e1cde6);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  20.2k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  156|  20.2k|  OP (FG, D, A, B, C, 14,  9, 0xc33707d6);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  156|  20.2k|  OP (FG, D, A, B, C, 14,  9, 0xc33707d6);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  20.2k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  157|  20.2k|  OP (FG, C, D, A, B,  3, 14, 0xf4d50d87);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  157|  20.2k|  OP (FG, C, D, A, B,  3, 14, 0xf4d50d87);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  20.2k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  158|  20.2k|  OP (FG, B, C, D, A,  8, 20, 0x455a14ed);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  158|  20.2k|  OP (FG, B, C, D, A,  8, 20, 0x455a14ed);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  20.2k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  159|  20.2k|  OP (FG, A, B, C, D, 13,  5, 0xa9e3e905);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  159|  20.2k|  OP (FG, A, B, C, D, 13,  5, 0xa9e3e905);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  20.2k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  160|  20.2k|  OP (FG, D, A, B, C,  2,  9, 0xfcefa3f8);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  160|  20.2k|  OP (FG, D, A, B, C,  2,  9, 0xfcefa3f8);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  20.2k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  161|  20.2k|  OP (FG, C, D, A, B,  7, 14, 0x676f02d9);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  161|  20.2k|  OP (FG, C, D, A, B,  7, 14, 0x676f02d9);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  20.2k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  162|  20.2k|  OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  162|  20.2k|  OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  20.2k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  20.2k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  163|       |
  164|       |  /* Round 3.  */
  165|  20.2k|  OP (FH, A, B, C, D,  5,  4, 0xfffa3942);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  165|  20.2k|  OP (FH, A, B, C, D,  5,  4, 0xfffa3942);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  20.2k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  166|  20.2k|  OP (FH, D, A, B, C,  8, 11, 0x8771f681);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  166|  20.2k|  OP (FH, D, A, B, C,  8, 11, 0x8771f681);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  20.2k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  167|  20.2k|  OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  167|  20.2k|  OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  20.2k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  168|  20.2k|  OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  168|  20.2k|  OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  20.2k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  169|  20.2k|  OP (FH, A, B, C, D,  1,  4, 0xa4beea44);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  169|  20.2k|  OP (FH, A, B, C, D,  1,  4, 0xa4beea44);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  20.2k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  170|  20.2k|  OP (FH, D, A, B, C,  4, 11, 0x4bdecfa9);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  170|  20.2k|  OP (FH, D, A, B, C,  4, 11, 0x4bdecfa9);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  20.2k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  171|  20.2k|  OP (FH, C, D, A, B,  7, 16, 0xf6bb4b60);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  171|  20.2k|  OP (FH, C, D, A, B,  7, 16, 0xf6bb4b60);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  20.2k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  172|  20.2k|  OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  172|  20.2k|  OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  20.2k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  173|  20.2k|  OP (FH, A, B, C, D, 13,  4, 0x289b7ec6);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  173|  20.2k|  OP (FH, A, B, C, D, 13,  4, 0x289b7ec6);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  20.2k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  174|  20.2k|  OP (FH, D, A, B, C,  0, 11, 0xeaa127fa);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  174|  20.2k|  OP (FH, D, A, B, C,  0, 11, 0xeaa127fa);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  20.2k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  175|  20.2k|  OP (FH, C, D, A, B,  3, 16, 0xd4ef3085);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  175|  20.2k|  OP (FH, C, D, A, B,  3, 16, 0xd4ef3085);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  20.2k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  176|  20.2k|  OP (FH, B, C, D, A,  6, 23, 0x04881d05);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  176|  20.2k|  OP (FH, B, C, D, A,  6, 23, 0x04881d05);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  20.2k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  177|  20.2k|  OP (FH, A, B, C, D,  9,  4, 0xd9d4d039);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  177|  20.2k|  OP (FH, A, B, C, D,  9,  4, 0xd9d4d039);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  20.2k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  178|  20.2k|  OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  178|  20.2k|  OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  20.2k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  179|  20.2k|  OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  179|  20.2k|  OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  20.2k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  180|  20.2k|  OP (FH, B, C, D, A,  2, 23, 0xc4ac5665);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  180|  20.2k|  OP (FH, B, C, D, A,  2, 23, 0xc4ac5665);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  20.2k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  181|       |
  182|       |  /* Round 4.  */
  183|  20.2k|  OP (FI, A, B, C, D,  0,  6, 0xf4292244);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  183|  20.2k|  OP (FI, A, B, C, D,  0,  6, 0xf4292244);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  20.2k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  184|  20.2k|  OP (FI, D, A, B, C,  7, 10, 0x432aff97);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  184|  20.2k|  OP (FI, D, A, B, C,  7, 10, 0x432aff97);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  20.2k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  185|  20.2k|  OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  185|  20.2k|  OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  20.2k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  186|  20.2k|  OP (FI, B, C, D, A,  5, 21, 0xfc93a039);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  186|  20.2k|  OP (FI, B, C, D, A,  5, 21, 0xfc93a039);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  20.2k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  187|  20.2k|  OP (FI, A, B, C, D, 12,  6, 0x655b59c3);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  187|  20.2k|  OP (FI, A, B, C, D, 12,  6, 0x655b59c3);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  20.2k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  188|  20.2k|  OP (FI, D, A, B, C,  3, 10, 0x8f0ccc92);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  188|  20.2k|  OP (FI, D, A, B, C,  3, 10, 0x8f0ccc92);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  20.2k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  189|  20.2k|  OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  189|  20.2k|  OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  20.2k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  190|  20.2k|  OP (FI, B, C, D, A,  1, 21, 0x85845dd1);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  190|  20.2k|  OP (FI, B, C, D, A,  1, 21, 0x85845dd1);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  20.2k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  191|  20.2k|  OP (FI, A, B, C, D,  8,  6, 0x6fa87e4f);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  191|  20.2k|  OP (FI, A, B, C, D,  8,  6, 0x6fa87e4f);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  20.2k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  192|  20.2k|  OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  192|  20.2k|  OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  20.2k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  193|  20.2k|  OP (FI, C, D, A, B,  6, 15, 0xa3014314);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  193|  20.2k|  OP (FI, C, D, A, B,  6, 15, 0xa3014314);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  20.2k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  194|  20.2k|  OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  194|  20.2k|  OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  20.2k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  195|  20.2k|  OP (FI, A, B, C, D,  4,  6, 0xf7537e82);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  195|  20.2k|  OP (FI, A, B, C, D,  4,  6, 0xf7537e82);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  20.2k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  196|  20.2k|  OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  196|  20.2k|  OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  20.2k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  197|  20.2k|  OP (FI, C, D, A, B,  2, 15, 0x2ad7d2bb);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  197|  20.2k|  OP (FI, C, D, A, B,  2, 15, 0x2ad7d2bb);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  20.2k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  198|  20.2k|  OP (FI, B, C, D, A,  9, 21, 0xeb86d391);
  ------------------
  |  |  138|  20.2k|    do								      \
  |  |  139|  20.2k|      { 							      \
  |  |  140|  20.2k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  198|  20.2k|  OP (FI, B, C, D, A,  9, 21, 0xeb86d391);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  20.2k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  20.2k|	a = rol(a, s);						      \
  |  |  142|  20.2k|	a += b; 						      \
  |  |  143|  20.2k|      } 							      \
  |  |  144|  20.2k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  199|       |
  200|       |  /* Put checksum in context given as argument.  */
  201|  20.2k|  ctx->A += A;
  202|  20.2k|  ctx->B += B;
  203|  20.2k|  ctx->C += C;
  204|  20.2k|  ctx->D += D;
  205|       |
  206|  20.2k|  return /*burn_stack*/ 80+6*sizeof(void*);
  207|  20.2k|}

_gcry_primegen_init:
  148|      1|{
  149|       |  /* This function was formerly used to initialize the primepool
  150|       |     Mutex. This has been replace by a static initialization.  */
  151|      1|  return 0;
  152|      1|}

_gcry_pk_algo_info:
 1133|  14.5k|{
 1134|  14.5k|  gcry_err_code_t rc = 0;
 1135|       |
 1136|  14.5k|  switch (what)
 1137|  14.5k|    {
 1138|  14.5k|    case GCRYCTL_TEST_ALGO:
  ------------------
  |  Branch (1138:5): [True: 14.5k, False: 0]
  ------------------
 1139|  14.5k|      {
 1140|  14.5k|	int use = nbytes ? *nbytes : 0;
  ------------------
  |  Branch (1140:12): [True: 14.5k, False: 0]
  ------------------
 1141|  14.5k|	if (buffer)
  ------------------
  |  Branch (1141:6): [True: 0, False: 14.5k]
  ------------------
 1142|      0|	  rc = GPG_ERR_INV_ARG;
 1143|  14.5k|	else if (check_pubkey_algo (algorithm, use))
  ------------------
  |  Branch (1143:11): [True: 0, False: 14.5k]
  ------------------
 1144|      0|	  rc = GPG_ERR_PUBKEY_ALGO;
 1145|  14.5k|	break;
 1146|      0|      }
 1147|       |
 1148|      0|    case GCRYCTL_GET_ALGO_USAGE:
  ------------------
  |  Branch (1148:5): [True: 0, False: 14.5k]
  ------------------
 1149|      0|      {
 1150|      0|	gcry_pk_spec_t *spec;
 1151|       |
 1152|      0|	spec = spec_from_algo (algorithm);
 1153|      0|        *nbytes = spec? spec->use : 0;
  ------------------
  |  Branch (1153:19): [True: 0, False: 0]
  ------------------
 1154|      0|	break;
 1155|      0|      }
 1156|       |
 1157|      0|    case GCRYCTL_GET_ALGO_NPKEY:
  ------------------
  |  Branch (1157:5): [True: 0, False: 14.5k]
  ------------------
 1158|      0|      {
 1159|       |	/* FIXME?  */
 1160|      0|	int npkey = pubkey_get_npkey (algorithm);
 1161|      0|	*nbytes = npkey;
 1162|      0|	break;
 1163|      0|      }
 1164|      0|    case GCRYCTL_GET_ALGO_NSKEY:
  ------------------
  |  Branch (1164:5): [True: 0, False: 14.5k]
  ------------------
 1165|      0|      {
 1166|       |	/* FIXME?  */
 1167|      0|	int nskey = pubkey_get_nskey (algorithm);
 1168|      0|	*nbytes = nskey;
 1169|      0|	break;
 1170|      0|      }
 1171|      0|    case GCRYCTL_GET_ALGO_NSIGN:
  ------------------
  |  Branch (1171:5): [True: 0, False: 14.5k]
  ------------------
 1172|      0|      {
 1173|       |	/* FIXME?  */
 1174|      0|	int nsign = pubkey_get_nsig (algorithm);
 1175|      0|	*nbytes = nsign;
 1176|      0|	break;
 1177|      0|      }
 1178|      0|    case GCRYCTL_GET_ALGO_NENCR:
  ------------------
  |  Branch (1178:5): [True: 0, False: 14.5k]
  ------------------
 1179|      0|      {
 1180|       |	/* FIXME?  */
 1181|      0|	int nencr = pubkey_get_nenc (algorithm);
 1182|      0|	*nbytes = nencr;
 1183|      0|	break;
 1184|      0|      }
 1185|       |
 1186|      0|    default:
  ------------------
  |  Branch (1186:5): [True: 0, False: 14.5k]
  ------------------
 1187|      0|      rc = GPG_ERR_INV_OP;
 1188|  14.5k|    }
 1189|       |
 1190|  14.5k|  return rc;
 1191|  14.5k|}
_gcry_pk_init:
 1239|      1|{
 1240|      1|  return 0;
 1241|      1|}
pubkey.c:spec_from_algo:
   75|  14.5k|{
   76|  14.5k|  int idx;
   77|  14.5k|  gcry_pk_spec_t *spec;
   78|       |
   79|  14.5k|  algo = map_algo (algo);
   80|       |
   81|  44.2k|  for (idx = 0; (spec = pubkey_list[idx]); idx++)
  ------------------
  |  Branch (81:17): [True: 44.2k, False: 0]
  ------------------
   82|  44.2k|    if (algo == spec->algo)
  ------------------
  |  Branch (82:9): [True: 14.5k, False: 29.7k]
  ------------------
   83|  14.5k|      return spec;
   84|      0|  return NULL;
   85|  14.5k|}
pubkey.c:map_algo:
   57|  14.5k|{
   58|  14.5k| switch (algo)
   59|  14.5k|   {
   60|    947|   case GCRY_PK_RSA_E: return GCRY_PK_RSA;
  ------------------
  |  Branch (60:4): [True: 947, False: 13.6k]
  ------------------
   61|    233|   case GCRY_PK_RSA_S: return GCRY_PK_RSA;
  ------------------
  |  Branch (61:4): [True: 233, False: 14.3k]
  ------------------
   62|      0|   case GCRY_PK_ELG_E: return GCRY_PK_ELG;
  ------------------
  |  Branch (62:4): [True: 0, False: 14.5k]
  ------------------
   63|      0|   case GCRY_PK_ECDSA: return GCRY_PK_ECC;
  ------------------
  |  Branch (63:4): [True: 0, False: 14.5k]
  ------------------
   64|      0|   case GCRY_PK_EDDSA: return GCRY_PK_ECC;
  ------------------
  |  Branch (64:4): [True: 0, False: 14.5k]
  ------------------
   65|      0|   case GCRY_PK_ECDH:  return GCRY_PK_ECC;
  ------------------
  |  Branch (65:4): [True: 0, False: 14.5k]
  ------------------
   66|  13.3k|   default:            return algo;
  ------------------
  |  Branch (66:4): [True: 13.3k, False: 1.18k]
  ------------------
   67|  14.5k|   }
   68|  14.5k|}
pubkey.c:check_pubkey_algo:
  224|  14.5k|{
  225|  14.5k|  gcry_err_code_t err = 0;
  226|  14.5k|  gcry_pk_spec_t *spec;
  227|       |
  228|  14.5k|  spec = spec_from_algo (algo);
  229|  14.5k|  if (spec && !spec->flags.disabled && (spec->flags.fips || !fips_mode ()))
  ------------------
  |  |  449|  9.95k|#define fips_mode() (!_gcry_no_fips_mode_required)
  ------------------
  |  Branch (229:7): [True: 14.5k, False: 0]
  |  Branch (229:15): [True: 14.5k, False: 0]
  |  Branch (229:41): [True: 4.59k, False: 9.95k]
  |  Branch (229:61): [True: 9.95k, False: 0]
  ------------------
  230|  14.5k|    {
  231|  14.5k|      if (((use & GCRY_PK_USAGE_SIGN)
  ------------------
  |  | 1151|  14.5k|#define GCRY_PK_USAGE_SIGN 1   /* Good for signatures. */
  ------------------
  |  Branch (231:12): [True: 0, False: 14.5k]
  ------------------
  232|  14.5k|	   && (! (spec->use & GCRY_PK_USAGE_SIGN)))
  ------------------
  |  | 1151|      0|#define GCRY_PK_USAGE_SIGN 1   /* Good for signatures. */
  ------------------
  |  Branch (232:8): [True: 0, False: 0]
  ------------------
  233|  14.5k|	  || ((use & GCRY_PK_USAGE_ENCR)
  ------------------
  |  | 1152|  14.5k|#define GCRY_PK_USAGE_ENCR 2   /* Good for encryption. */
  ------------------
  |  Branch (233:8): [True: 0, False: 14.5k]
  ------------------
  234|  14.5k|	      && (! (spec->use & GCRY_PK_USAGE_ENCR))))
  ------------------
  |  | 1152|      0|#define GCRY_PK_USAGE_ENCR 2   /* Good for encryption. */
  ------------------
  |  Branch (234:11): [True: 0, False: 0]
  ------------------
  235|      0|	err = GPG_ERR_WRONG_PUBKEY_ALGO;
  236|  14.5k|    }
  237|      0|  else
  238|      0|    err = GPG_ERR_PUBKEY_ALGO;
  239|       |
  240|  14.5k|  return err;
  241|  14.5k|}

rmd160.c:transform_blk:
  179|   192k|{
  180|   192k|  RMD160_CONTEXT *hd = ctx;
  181|   192k|  register u32 al, ar, bl, br, cl, cr, dl, dr, el, er;
  182|   192k|  u32 x[16];
  183|   192k|  int i;
  184|       |
  185|  3.26M|  for ( i = 0; i < 16; i++ )
  ------------------
  |  Branch (185:16): [True: 3.07M, False: 192k]
  ------------------
  186|  3.07M|    x[i] = buf_get_le32(data + i * 4);
  187|       |
  188|   192k|#define K0  0x00000000
  189|   192k|#define K1  0x5A827999
  190|   192k|#define K2  0x6ED9EBA1
  191|   192k|#define K3  0x8F1BBCDC
  192|   192k|#define K4  0xA953FD4E
  193|   192k|#define KK0 0x50A28BE6
  194|   192k|#define KK1 0x5C4DD124
  195|   192k|#define KK2 0x6D703EF3
  196|   192k|#define KK3 0x7A6D76E9
  197|   192k|#define KK4 0x00000000
  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  204|   192k|				  a = rol(a,s) + e;	       \
  205|   192k|				  c = rol(c,10);	       \
  206|   192k|				} while(0)
  207|       |
  208|       |  /* left lane and right lanes interleaved */
  209|   192k|  al = ar = hd->h0;
  210|   192k|  bl = br = hd->h1;
  211|   192k|  cl = cr = hd->h2;
  212|   192k|  dl = dr = hd->h3;
  213|   192k|  el = er = hd->h4;
  214|   192k|  R( al, bl, cl, dl, el, F0, K0,  0, 11 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  214|   192k|  R( al, bl, cl, dl, el, F0, K0,  0, 11 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  215|   192k|  R( ar, br, cr, dr, er, F4, KK0,	5,  8);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  215|   192k|  R( ar, br, cr, dr, er, F4, KK0,	5,  8);
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  216|   192k|  R( el, al, bl, cl, dl, F0, K0,  1, 14 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  216|   192k|  R( el, al, bl, cl, dl, F0, K0,  1, 14 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  217|   192k|  R( er, ar, br, cr, dr, F4, KK0, 14,  9);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  217|   192k|  R( er, ar, br, cr, dr, F4, KK0, 14,  9);
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  218|   192k|  R( dl, el, al, bl, cl, F0, K0,  2, 15 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  218|   192k|  R( dl, el, al, bl, cl, F0, K0,  2, 15 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  219|   192k|  R( dr, er, ar, br, cr, F4, KK0,	7,  9);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  219|   192k|  R( dr, er, ar, br, cr, F4, KK0,	7,  9);
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  220|   192k|  R( cl, dl, el, al, bl, F0, K0,  3, 12 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  220|   192k|  R( cl, dl, el, al, bl, F0, K0,  3, 12 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  221|   192k|  R( cr, dr, er, ar, br, F4, KK0,	0, 11);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  221|   192k|  R( cr, dr, er, ar, br, F4, KK0,	0, 11);
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  222|   192k|  R( bl, cl, dl, el, al, F0, K0,  4,  5 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  222|   192k|  R( bl, cl, dl, el, al, F0, K0,  4,  5 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  223|   192k|  R( br, cr, dr, er, ar, F4, KK0,	9, 13);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  223|   192k|  R( br, cr, dr, er, ar, F4, KK0,	9, 13);
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  224|   192k|  R( al, bl, cl, dl, el, F0, K0,  5,  8 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  224|   192k|  R( al, bl, cl, dl, el, F0, K0,  5,  8 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  225|   192k|  R( ar, br, cr, dr, er, F4, KK0,	2, 15);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  225|   192k|  R( ar, br, cr, dr, er, F4, KK0,	2, 15);
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  226|   192k|  R( el, al, bl, cl, dl, F0, K0,  6,  7 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  226|   192k|  R( el, al, bl, cl, dl, F0, K0,  6,  7 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  227|   192k|  R( er, ar, br, cr, dr, F4, KK0, 11, 15);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  227|   192k|  R( er, ar, br, cr, dr, F4, KK0, 11, 15);
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  228|   192k|  R( dl, el, al, bl, cl, F0, K0,  7,  9 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  228|   192k|  R( dl, el, al, bl, cl, F0, K0,  7,  9 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  229|   192k|  R( dr, er, ar, br, cr, F4, KK0,	4,  5);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  229|   192k|  R( dr, er, ar, br, cr, F4, KK0,	4,  5);
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  230|   192k|  R( cl, dl, el, al, bl, F0, K0,  8, 11 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  230|   192k|  R( cl, dl, el, al, bl, F0, K0,  8, 11 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  231|   192k|  R( cr, dr, er, ar, br, F4, KK0, 13,  7);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  231|   192k|  R( cr, dr, er, ar, br, F4, KK0, 13,  7);
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  232|   192k|  R( bl, cl, dl, el, al, F0, K0,  9, 13 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  232|   192k|  R( bl, cl, dl, el, al, F0, K0,  9, 13 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  233|   192k|  R( br, cr, dr, er, ar, F4, KK0,	6,  7);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  233|   192k|  R( br, cr, dr, er, ar, F4, KK0,	6,  7);
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  234|   192k|  R( al, bl, cl, dl, el, F0, K0, 10, 14 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  234|   192k|  R( al, bl, cl, dl, el, F0, K0, 10, 14 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  235|   192k|  R( ar, br, cr, dr, er, F4, KK0, 15,  8);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  235|   192k|  R( ar, br, cr, dr, er, F4, KK0, 15,  8);
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  236|   192k|  R( el, al, bl, cl, dl, F0, K0, 11, 15 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  236|   192k|  R( el, al, bl, cl, dl, F0, K0, 11, 15 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  237|   192k|  R( er, ar, br, cr, dr, F4, KK0,	8, 11);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  237|   192k|  R( er, ar, br, cr, dr, F4, KK0,	8, 11);
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  238|   192k|  R( dl, el, al, bl, cl, F0, K0, 12,  6 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  238|   192k|  R( dl, el, al, bl, cl, F0, K0, 12,  6 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  239|   192k|  R( dr, er, ar, br, cr, F4, KK0,	1, 14);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  239|   192k|  R( dr, er, ar, br, cr, F4, KK0,	1, 14);
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  240|   192k|  R( cl, dl, el, al, bl, F0, K0, 13,  7 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  240|   192k|  R( cl, dl, el, al, bl, F0, K0, 13,  7 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  241|   192k|  R( cr, dr, er, ar, br, F4, KK0, 10, 14);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  241|   192k|  R( cr, dr, er, ar, br, F4, KK0, 10, 14);
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  242|   192k|  R( bl, cl, dl, el, al, F0, K0, 14,  9 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  242|   192k|  R( bl, cl, dl, el, al, F0, K0, 14,  9 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  243|   192k|  R( br, cr, dr, er, ar, F4, KK0,	3, 12);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  243|   192k|  R( br, cr, dr, er, ar, F4, KK0,	3, 12);
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  244|   192k|  R( al, bl, cl, dl, el, F0, K0, 15,  8 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  244|   192k|  R( al, bl, cl, dl, el, F0, K0, 15,  8 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  245|   192k|  R( ar, br, cr, dr, er, F4, KK0, 12,  6);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  245|   192k|  R( ar, br, cr, dr, er, F4, KK0, 12,  6);
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  246|   192k|  R( el, al, bl, cl, dl, F1, K1,  7,  7 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  246|   192k|  R( el, al, bl, cl, dl, F1, K1,  7,  7 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  247|   192k|  R( er, ar, br, cr, dr, F3, KK1,	6,  9);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  247|   192k|  R( er, ar, br, cr, dr, F3, KK1,	6,  9);
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  248|   192k|  R( dl, el, al, bl, cl, F1, K1,  4,  6 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  248|   192k|  R( dl, el, al, bl, cl, F1, K1,  4,  6 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  249|   192k|  R( dr, er, ar, br, cr, F3, KK1, 11, 13);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  249|   192k|  R( dr, er, ar, br, cr, F3, KK1, 11, 13);
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  250|   192k|  R( cl, dl, el, al, bl, F1, K1, 13,  8 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  250|   192k|  R( cl, dl, el, al, bl, F1, K1, 13,  8 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  251|   192k|  R( cr, dr, er, ar, br, F3, KK1,	3, 15);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  251|   192k|  R( cr, dr, er, ar, br, F3, KK1,	3, 15);
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  252|   192k|  R( bl, cl, dl, el, al, F1, K1,  1, 13 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  252|   192k|  R( bl, cl, dl, el, al, F1, K1,  1, 13 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  253|   192k|  R( br, cr, dr, er, ar, F3, KK1,	7,  7);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  253|   192k|  R( br, cr, dr, er, ar, F3, KK1,	7,  7);
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  254|   192k|  R( al, bl, cl, dl, el, F1, K1, 10, 11 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  254|   192k|  R( al, bl, cl, dl, el, F1, K1, 10, 11 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  255|   192k|  R( ar, br, cr, dr, er, F3, KK1,	0, 12);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  255|   192k|  R( ar, br, cr, dr, er, F3, KK1,	0, 12);
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  256|   192k|  R( el, al, bl, cl, dl, F1, K1,  6,  9 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  256|   192k|  R( el, al, bl, cl, dl, F1, K1,  6,  9 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  257|   192k|  R( er, ar, br, cr, dr, F3, KK1, 13,  8);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  257|   192k|  R( er, ar, br, cr, dr, F3, KK1, 13,  8);
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  258|   192k|  R( dl, el, al, bl, cl, F1, K1, 15,  7 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  258|   192k|  R( dl, el, al, bl, cl, F1, K1, 15,  7 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  259|   192k|  R( dr, er, ar, br, cr, F3, KK1,	5,  9);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  259|   192k|  R( dr, er, ar, br, cr, F3, KK1,	5,  9);
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  260|   192k|  R( cl, dl, el, al, bl, F1, K1,  3, 15 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  260|   192k|  R( cl, dl, el, al, bl, F1, K1,  3, 15 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  261|   192k|  R( cr, dr, er, ar, br, F3, KK1, 10, 11);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  261|   192k|  R( cr, dr, er, ar, br, F3, KK1, 10, 11);
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  262|   192k|  R( bl, cl, dl, el, al, F1, K1, 12,  7 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  262|   192k|  R( bl, cl, dl, el, al, F1, K1, 12,  7 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  263|   192k|  R( br, cr, dr, er, ar, F3, KK1, 14,  7);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  263|   192k|  R( br, cr, dr, er, ar, F3, KK1, 14,  7);
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  264|   192k|  R( al, bl, cl, dl, el, F1, K1,  0, 12 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  264|   192k|  R( al, bl, cl, dl, el, F1, K1,  0, 12 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  265|   192k|  R( ar, br, cr, dr, er, F3, KK1, 15,  7);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  265|   192k|  R( ar, br, cr, dr, er, F3, KK1, 15,  7);
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  266|   192k|  R( el, al, bl, cl, dl, F1, K1,  9, 15 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  266|   192k|  R( el, al, bl, cl, dl, F1, K1,  9, 15 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  267|   192k|  R( er, ar, br, cr, dr, F3, KK1,	8, 12);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  267|   192k|  R( er, ar, br, cr, dr, F3, KK1,	8, 12);
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  268|   192k|  R( dl, el, al, bl, cl, F1, K1,  5,  9 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  268|   192k|  R( dl, el, al, bl, cl, F1, K1,  5,  9 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  269|   192k|  R( dr, er, ar, br, cr, F3, KK1, 12,  7);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  269|   192k|  R( dr, er, ar, br, cr, F3, KK1, 12,  7);
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  270|   192k|  R( cl, dl, el, al, bl, F1, K1,  2, 11 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  270|   192k|  R( cl, dl, el, al, bl, F1, K1,  2, 11 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  271|   192k|  R( cr, dr, er, ar, br, F3, KK1,	4,  6);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  271|   192k|  R( cr, dr, er, ar, br, F3, KK1,	4,  6);
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  272|   192k|  R( bl, cl, dl, el, al, F1, K1, 14,  7 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  272|   192k|  R( bl, cl, dl, el, al, F1, K1, 14,  7 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  273|   192k|  R( br, cr, dr, er, ar, F3, KK1,	9, 15);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  273|   192k|  R( br, cr, dr, er, ar, F3, KK1,	9, 15);
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  274|   192k|  R( al, bl, cl, dl, el, F1, K1, 11, 13 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  274|   192k|  R( al, bl, cl, dl, el, F1, K1, 11, 13 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  275|   192k|  R( ar, br, cr, dr, er, F3, KK1,	1, 13);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  275|   192k|  R( ar, br, cr, dr, er, F3, KK1,	1, 13);
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  276|   192k|  R( el, al, bl, cl, dl, F1, K1,  8, 12 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  276|   192k|  R( el, al, bl, cl, dl, F1, K1,  8, 12 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  277|   192k|  R( er, ar, br, cr, dr, F3, KK1,	2, 11);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  277|   192k|  R( er, ar, br, cr, dr, F3, KK1,	2, 11);
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  278|   192k|  R( dl, el, al, bl, cl, F2, K2,  3, 11 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  278|   192k|  R( dl, el, al, bl, cl, F2, K2,  3, 11 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  279|   192k|  R( dr, er, ar, br, cr, F2, KK2, 15,  9);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  279|   192k|  R( dr, er, ar, br, cr, F2, KK2, 15,  9);
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  280|   192k|  R( cl, dl, el, al, bl, F2, K2, 10, 13 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  280|   192k|  R( cl, dl, el, al, bl, F2, K2, 10, 13 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  281|   192k|  R( cr, dr, er, ar, br, F2, KK2,	5,  7);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  281|   192k|  R( cr, dr, er, ar, br, F2, KK2,	5,  7);
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  282|   192k|  R( bl, cl, dl, el, al, F2, K2, 14,  6 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  282|   192k|  R( bl, cl, dl, el, al, F2, K2, 14,  6 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  283|   192k|  R( br, cr, dr, er, ar, F2, KK2,	1, 15);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  283|   192k|  R( br, cr, dr, er, ar, F2, KK2,	1, 15);
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  284|   192k|  R( al, bl, cl, dl, el, F2, K2,  4,  7 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  284|   192k|  R( al, bl, cl, dl, el, F2, K2,  4,  7 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  285|   192k|  R( ar, br, cr, dr, er, F2, KK2,	3, 11);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  285|   192k|  R( ar, br, cr, dr, er, F2, KK2,	3, 11);
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  286|   192k|  R( el, al, bl, cl, dl, F2, K2,  9, 14 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  286|   192k|  R( el, al, bl, cl, dl, F2, K2,  9, 14 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  287|   192k|  R( er, ar, br, cr, dr, F2, KK2,	7,  8);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  287|   192k|  R( er, ar, br, cr, dr, F2, KK2,	7,  8);
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  288|   192k|  R( dl, el, al, bl, cl, F2, K2, 15,  9 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  288|   192k|  R( dl, el, al, bl, cl, F2, K2, 15,  9 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  289|   192k|  R( dr, er, ar, br, cr, F2, KK2, 14,  6);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  289|   192k|  R( dr, er, ar, br, cr, F2, KK2, 14,  6);
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  290|   192k|  R( cl, dl, el, al, bl, F2, K2,  8, 13 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  290|   192k|  R( cl, dl, el, al, bl, F2, K2,  8, 13 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  291|   192k|  R( cr, dr, er, ar, br, F2, KK2,	6,  6);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  291|   192k|  R( cr, dr, er, ar, br, F2, KK2,	6,  6);
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  292|   192k|  R( bl, cl, dl, el, al, F2, K2,  1, 15 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  292|   192k|  R( bl, cl, dl, el, al, F2, K2,  1, 15 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  293|   192k|  R( br, cr, dr, er, ar, F2, KK2,	9, 14);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  293|   192k|  R( br, cr, dr, er, ar, F2, KK2,	9, 14);
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  294|   192k|  R( al, bl, cl, dl, el, F2, K2,  2, 14 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  294|   192k|  R( al, bl, cl, dl, el, F2, K2,  2, 14 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  295|   192k|  R( ar, br, cr, dr, er, F2, KK2, 11, 12);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  295|   192k|  R( ar, br, cr, dr, er, F2, KK2, 11, 12);
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  296|   192k|  R( el, al, bl, cl, dl, F2, K2,  7,  8 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  296|   192k|  R( el, al, bl, cl, dl, F2, K2,  7,  8 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  297|   192k|  R( er, ar, br, cr, dr, F2, KK2,	8, 13);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  297|   192k|  R( er, ar, br, cr, dr, F2, KK2,	8, 13);
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  298|   192k|  R( dl, el, al, bl, cl, F2, K2,  0, 13 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  298|   192k|  R( dl, el, al, bl, cl, F2, K2,  0, 13 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  299|   192k|  R( dr, er, ar, br, cr, F2, KK2, 12,  5);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  299|   192k|  R( dr, er, ar, br, cr, F2, KK2, 12,  5);
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  300|   192k|  R( cl, dl, el, al, bl, F2, K2,  6,  6 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  300|   192k|  R( cl, dl, el, al, bl, F2, K2,  6,  6 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  301|   192k|  R( cr, dr, er, ar, br, F2, KK2,	2, 14);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  301|   192k|  R( cr, dr, er, ar, br, F2, KK2,	2, 14);
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  302|   192k|  R( bl, cl, dl, el, al, F2, K2, 13,  5 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  302|   192k|  R( bl, cl, dl, el, al, F2, K2, 13,  5 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  303|   192k|  R( br, cr, dr, er, ar, F2, KK2, 10, 13);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  303|   192k|  R( br, cr, dr, er, ar, F2, KK2, 10, 13);
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  304|   192k|  R( al, bl, cl, dl, el, F2, K2, 11, 12 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  304|   192k|  R( al, bl, cl, dl, el, F2, K2, 11, 12 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  305|   192k|  R( ar, br, cr, dr, er, F2, KK2,	0, 13);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  305|   192k|  R( ar, br, cr, dr, er, F2, KK2,	0, 13);
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  306|   192k|  R( el, al, bl, cl, dl, F2, K2,  5,  7 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  306|   192k|  R( el, al, bl, cl, dl, F2, K2,  5,  7 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  307|   192k|  R( er, ar, br, cr, dr, F2, KK2,	4,  7);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  307|   192k|  R( er, ar, br, cr, dr, F2, KK2,	4,  7);
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  308|   192k|  R( dl, el, al, bl, cl, F2, K2, 12,  5 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  308|   192k|  R( dl, el, al, bl, cl, F2, K2, 12,  5 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  309|   192k|  R( dr, er, ar, br, cr, F2, KK2, 13,  5);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  309|   192k|  R( dr, er, ar, br, cr, F2, KK2, 13,  5);
  |  |  |  |  ------------------
  |  |  |  |  |  |  200|   192k|#define F2(x,y,z)   ( ((x) | ~(y)) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  310|   192k|  R( cl, dl, el, al, bl, F3, K3,  1, 11 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  310|   192k|  R( cl, dl, el, al, bl, F3, K3,  1, 11 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  311|   192k|  R( cr, dr, er, ar, br, F1, KK3,	8, 15);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  311|   192k|  R( cr, dr, er, ar, br, F1, KK3,	8, 15);
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  312|   192k|  R( bl, cl, dl, el, al, F3, K3,  9, 12 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  312|   192k|  R( bl, cl, dl, el, al, F3, K3,  9, 12 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  313|   192k|  R( br, cr, dr, er, ar, F1, KK3,	6,  5);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  313|   192k|  R( br, cr, dr, er, ar, F1, KK3,	6,  5);
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  314|   192k|  R( al, bl, cl, dl, el, F3, K3, 11, 14 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  314|   192k|  R( al, bl, cl, dl, el, F3, K3, 11, 14 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  315|   192k|  R( ar, br, cr, dr, er, F1, KK3,	4,  8);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  315|   192k|  R( ar, br, cr, dr, er, F1, KK3,	4,  8);
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  316|   192k|  R( el, al, bl, cl, dl, F3, K3, 10, 15 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  316|   192k|  R( el, al, bl, cl, dl, F3, K3, 10, 15 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  317|   192k|  R( er, ar, br, cr, dr, F1, KK3,	1, 11);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  317|   192k|  R( er, ar, br, cr, dr, F1, KK3,	1, 11);
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  318|   192k|  R( dl, el, al, bl, cl, F3, K3,  0, 14 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  318|   192k|  R( dl, el, al, bl, cl, F3, K3,  0, 14 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  319|   192k|  R( dr, er, ar, br, cr, F1, KK3,	3, 14);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  319|   192k|  R( dr, er, ar, br, cr, F1, KK3,	3, 14);
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  320|   192k|  R( cl, dl, el, al, bl, F3, K3,  8, 15 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  320|   192k|  R( cl, dl, el, al, bl, F3, K3,  8, 15 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  321|   192k|  R( cr, dr, er, ar, br, F1, KK3, 11, 14);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  321|   192k|  R( cr, dr, er, ar, br, F1, KK3, 11, 14);
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  322|   192k|  R( bl, cl, dl, el, al, F3, K3, 12,  9 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  322|   192k|  R( bl, cl, dl, el, al, F3, K3, 12,  9 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  323|   192k|  R( br, cr, dr, er, ar, F1, KK3, 15,  6);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  323|   192k|  R( br, cr, dr, er, ar, F1, KK3, 15,  6);
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  324|   192k|  R( al, bl, cl, dl, el, F3, K3,  4,  8 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  324|   192k|  R( al, bl, cl, dl, el, F3, K3,  4,  8 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  325|   192k|  R( ar, br, cr, dr, er, F1, KK3,	0, 14);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  325|   192k|  R( ar, br, cr, dr, er, F1, KK3,	0, 14);
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  326|   192k|  R( el, al, bl, cl, dl, F3, K3, 13,  9 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  326|   192k|  R( el, al, bl, cl, dl, F3, K3, 13,  9 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  327|   192k|  R( er, ar, br, cr, dr, F1, KK3,	5,  6);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  327|   192k|  R( er, ar, br, cr, dr, F1, KK3,	5,  6);
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  328|   192k|  R( dl, el, al, bl, cl, F3, K3,  3, 14 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  328|   192k|  R( dl, el, al, bl, cl, F3, K3,  3, 14 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  329|   192k|  R( dr, er, ar, br, cr, F1, KK3, 12,  9);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  329|   192k|  R( dr, er, ar, br, cr, F1, KK3, 12,  9);
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  330|   192k|  R( cl, dl, el, al, bl, F3, K3,  7,  5 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  330|   192k|  R( cl, dl, el, al, bl, F3, K3,  7,  5 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  331|   192k|  R( cr, dr, er, ar, br, F1, KK3,	2, 12);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  331|   192k|  R( cr, dr, er, ar, br, F1, KK3,	2, 12);
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  332|   192k|  R( bl, cl, dl, el, al, F3, K3, 15,  6 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  332|   192k|  R( bl, cl, dl, el, al, F3, K3, 15,  6 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  333|   192k|  R( br, cr, dr, er, ar, F1, KK3, 13,  9);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  333|   192k|  R( br, cr, dr, er, ar, F1, KK3, 13,  9);
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  334|   192k|  R( al, bl, cl, dl, el, F3, K3, 14,  8 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  334|   192k|  R( al, bl, cl, dl, el, F3, K3, 14,  8 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  335|   192k|  R( ar, br, cr, dr, er, F1, KK3,	9, 12);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  335|   192k|  R( ar, br, cr, dr, er, F1, KK3,	9, 12);
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  336|   192k|  R( el, al, bl, cl, dl, F3, K3,  5,  6 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  336|   192k|  R( el, al, bl, cl, dl, F3, K3,  5,  6 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  337|   192k|  R( er, ar, br, cr, dr, F1, KK3,	7,  5);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  337|   192k|  R( er, ar, br, cr, dr, F1, KK3,	7,  5);
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  338|   192k|  R( dl, el, al, bl, cl, F3, K3,  6,  5 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  338|   192k|  R( dl, el, al, bl, cl, F3, K3,  6,  5 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  339|   192k|  R( dr, er, ar, br, cr, F1, KK3, 10, 15);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  339|   192k|  R( dr, er, ar, br, cr, F1, KK3, 10, 15);
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  340|   192k|  R( cl, dl, el, al, bl, F3, K3,  2, 12 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  340|   192k|  R( cl, dl, el, al, bl, F3, K3,  2, 12 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  201|   192k|#define F3(x,y,z)   ( ((x) & (z)) | ((y) & ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  341|   192k|  R( cr, dr, er, ar, br, F1, KK3, 14,  8);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  341|   192k|  R( cr, dr, er, ar, br, F1, KK3, 14,  8);
  |  |  |  |  ------------------
  |  |  |  |  |  |  199|   192k|#define F1(x,y,z)   ( ((x) & (y)) | (~(x) & (z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  342|   192k|  R( bl, cl, dl, el, al, F4, K4,  4,  9 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  342|   192k|  R( bl, cl, dl, el, al, F4, K4,  4,  9 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  343|   192k|  R( br, cr, dr, er, ar, F0, KK4, 12,  8);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  343|   192k|  R( br, cr, dr, er, ar, F0, KK4, 12,  8);
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  344|   192k|  R( al, bl, cl, dl, el, F4, K4,  0, 15 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  344|   192k|  R( al, bl, cl, dl, el, F4, K4,  0, 15 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  345|   192k|  R( ar, br, cr, dr, er, F0, KK4, 15,  5);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  345|   192k|  R( ar, br, cr, dr, er, F0, KK4, 15,  5);
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  346|   192k|  R( el, al, bl, cl, dl, F4, K4,  5,  5 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  346|   192k|  R( el, al, bl, cl, dl, F4, K4,  5,  5 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  347|   192k|  R( er, ar, br, cr, dr, F0, KK4, 10, 12);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  347|   192k|  R( er, ar, br, cr, dr, F0, KK4, 10, 12);
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  348|   192k|  R( dl, el, al, bl, cl, F4, K4,  9, 11 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  348|   192k|  R( dl, el, al, bl, cl, F4, K4,  9, 11 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  349|   192k|  R( dr, er, ar, br, cr, F0, KK4,	4,  9);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  349|   192k|  R( dr, er, ar, br, cr, F0, KK4,	4,  9);
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  350|   192k|  R( cl, dl, el, al, bl, F4, K4,  7,  6 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  350|   192k|  R( cl, dl, el, al, bl, F4, K4,  7,  6 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  351|   192k|  R( cr, dr, er, ar, br, F0, KK4,	1, 12);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  351|   192k|  R( cr, dr, er, ar, br, F0, KK4,	1, 12);
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  352|   192k|  R( bl, cl, dl, el, al, F4, K4, 12,  8 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  352|   192k|  R( bl, cl, dl, el, al, F4, K4, 12,  8 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  353|   192k|  R( br, cr, dr, er, ar, F0, KK4,	5,  5);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  353|   192k|  R( br, cr, dr, er, ar, F0, KK4,	5,  5);
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  354|   192k|  R( al, bl, cl, dl, el, F4, K4,  2, 13 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  354|   192k|  R( al, bl, cl, dl, el, F4, K4,  2, 13 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  355|   192k|  R( ar, br, cr, dr, er, F0, KK4,	8, 14);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  355|   192k|  R( ar, br, cr, dr, er, F0, KK4,	8, 14);
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  356|   192k|  R( el, al, bl, cl, dl, F4, K4, 10, 12 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  356|   192k|  R( el, al, bl, cl, dl, F4, K4, 10, 12 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  357|   192k|  R( er, ar, br, cr, dr, F0, KK4,	7,  6);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  357|   192k|  R( er, ar, br, cr, dr, F0, KK4,	7,  6);
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  358|   192k|  R( dl, el, al, bl, cl, F4, K4, 14,  5 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  358|   192k|  R( dl, el, al, bl, cl, F4, K4, 14,  5 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  359|   192k|  R( dr, er, ar, br, cr, F0, KK4,	6,  8);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  359|   192k|  R( dr, er, ar, br, cr, F0, KK4,	6,  8);
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  360|   192k|  R( cl, dl, el, al, bl, F4, K4,  1, 12 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  360|   192k|  R( cl, dl, el, al, bl, F4, K4,  1, 12 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  361|   192k|  R( cr, dr, er, ar, br, F0, KK4,	2, 13);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  361|   192k|  R( cr, dr, er, ar, br, F0, KK4,	2, 13);
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  362|   192k|  R( bl, cl, dl, el, al, F4, K4,  3, 13 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  362|   192k|  R( bl, cl, dl, el, al, F4, K4,  3, 13 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  363|   192k|  R( br, cr, dr, er, ar, F0, KK4, 13,  6);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  363|   192k|  R( br, cr, dr, er, ar, F0, KK4, 13,  6);
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  364|   192k|  R( al, bl, cl, dl, el, F4, K4,  8, 14 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  364|   192k|  R( al, bl, cl, dl, el, F4, K4,  8, 14 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  365|   192k|  R( ar, br, cr, dr, er, F0, KK4, 14,  5);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  365|   192k|  R( ar, br, cr, dr, er, F0, KK4, 14,  5);
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  366|   192k|  R( el, al, bl, cl, dl, F4, K4, 11, 11 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  366|   192k|  R( el, al, bl, cl, dl, F4, K4, 11, 11 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  367|   192k|  R( er, ar, br, cr, dr, F0, KK4,	0, 15);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  367|   192k|  R( er, ar, br, cr, dr, F0, KK4,	0, 15);
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  368|   192k|  R( dl, el, al, bl, cl, F4, K4,  6,  8 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  368|   192k|  R( dl, el, al, bl, cl, F4, K4,  6,  8 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  369|   192k|  R( dr, er, ar, br, cr, F0, KK4,	3, 13);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  369|   192k|  R( dr, er, ar, br, cr, F0, KK4,	3, 13);
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  370|   192k|  R( cl, dl, el, al, bl, F4, K4, 15,  5 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  370|   192k|  R( cl, dl, el, al, bl, F4, K4, 15,  5 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  371|   192k|  R( cr, dr, er, ar, br, F0, KK4,	9, 11);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  371|   192k|  R( cr, dr, er, ar, br, F0, KK4,	9, 11);
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  372|   192k|  R( bl, cl, dl, el, al, F4, K4, 13,  6 );
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  372|   192k|  R( bl, cl, dl, el, al, F4, K4, 13,  6 );
  |  |  |  |  ------------------
  |  |  |  |  |  |  202|   192k|#define F4(x,y,z)   ( (x) ^ ((y) | ~(z)) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  373|   192k|  R( br, cr, dr, er, ar, F0, KK4, 11, 11);
  ------------------
  |  |  203|   192k|#define R(a,b,c,d,e,f,k,r,s) do { a += f(b,c,d) + k + x[r]; \
  |  |  ------------------
  |  |  |  |  373|   192k|  R( br, cr, dr, er, ar, F0, KK4, 11, 11);
  |  |  |  |  ------------------
  |  |  |  |  |  |  198|   192k|#define F0(x,y,z)   ( (x) ^ (y) ^ (z) )
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  204|   192k|				  a = rol(a,s) + e;	       \
  |  |  205|   192k|				  c = rol(c,10);	       \
  |  |  206|   192k|				} while(0)
  |  |  ------------------
  |  |  |  Branch (206:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  374|       |
  375|   192k|  dr += cl + hd->h1;
  376|   192k|  hd->h1 = hd->h2 + dl + er;
  377|   192k|  hd->h2 = hd->h3 + el + ar;
  378|   192k|  hd->h3 = hd->h4 + al + br;
  379|   192k|  hd->h4 = hd->h0 + bl + cr;
  380|   192k|  hd->h0 = dr;
  381|       |
  382|   192k|  return /*burn_stack*/ 104+5*sizeof(void*);
  383|   192k|}

_gcry_sha1_mixblock_init:
  373|   103k|{
  374|   103k|  sha1_init (hd, 0);
  375|   103k|}
_gcry_sha1_mixblock:
  532|  3.10M|{
  533|  3.10M|  u32 *p = blockof64byte;
  534|  3.10M|  unsigned int nburn;
  535|       |
  536|  3.10M|  nburn = (*hd->bctx.bwrite) (hd, blockof64byte, 1);
  537|  3.10M|  p[0] = hd->h0;
  538|  3.10M|  p[1] = hd->h1;
  539|  3.10M|  p[2] = hd->h2;
  540|  3.10M|  p[3] = hd->h3;
  541|  3.10M|  p[4] = hd->h4;
  542|       |
  543|  3.10M|  return nburn;
  544|  3.10M|}
_gcry_sha1_hash_buffer:
  658|   103k|{
  659|   103k|  gcry_buffer_t iov = { 0 };
  660|       |
  661|   103k|  iov.data = (void *)buffer;
  662|   103k|  iov.len = length;
  663|       |
  664|   103k|  _gcry_sha1_hash_buffers (outbuf, 20, &iov, 1);
  665|   103k|}
sha1.c:sha1_init:
  298|   241k|{
  299|   241k|  SHA1_CONTEXT *hd = context;
  300|   241k|  unsigned int features = _gcry_get_hw_features ();
  301|       |
  302|   241k|  (void)flags;
  303|       |
  304|   241k|  hd->h0 = 0x67452301;
  305|   241k|  hd->h1 = 0xefcdab89;
  306|   241k|  hd->h2 = 0x98badcfe;
  307|   241k|  hd->h3 = 0x10325476;
  308|   241k|  hd->h4 = 0xc3d2e1f0;
  309|       |
  310|   241k|  hd->bctx.nblocks = 0;
  311|   241k|  hd->bctx.nblocks_high = 0;
  312|   241k|  hd->bctx.count = 0;
  313|   241k|  hd->bctx.blocksize_shift = _gcry_ctz(64);
  314|       |
  315|       |  /* Order of feature checks is important here; last match will be
  316|       |   * selected.  Keep slower implementations at the top and faster at
  317|       |   * the bottom.  */
  318|   241k|  hd->bctx.bwrite = do_transform_generic;
  319|   241k|#ifdef USE_SSSE3
  320|   241k|  if ((features & HWF_INTEL_SSSE3) != 0)
  ------------------
  |  |  229|   241k|#define HWF_INTEL_SSSE3         (1 << 7)
  ------------------
  |  Branch (320:7): [True: 241k, False: 0]
  ------------------
  321|   241k|    hd->bctx.bwrite = do_sha1_transform_amd64_ssse3;
  322|   241k|#endif
  323|   241k|#ifdef USE_AVX
  324|       |  /* AVX implementation uses SHLD which is known to be slow on non-Intel CPUs.
  325|       |   * Therefore use this implementation on Intel CPUs only. */
  326|   241k|  if ((features & HWF_INTEL_AVX) && (features & HWF_INTEL_FAST_SHLD))
  ------------------
  |  |  234|   241k|#define HWF_INTEL_AVX           (1 << 12)
  ------------------
                if ((features & HWF_INTEL_AVX) && (features & HWF_INTEL_FAST_SHLD))
  ------------------
  |  |  227|   241k|#define HWF_INTEL_FAST_SHLD     (1 << 5)
  ------------------
  |  Branch (326:7): [True: 241k, False: 0]
  |  Branch (326:37): [True: 241k, False: 0]
  ------------------
  327|   241k|    hd->bctx.bwrite = do_sha1_transform_amd64_avx;
  328|   241k|#endif
  329|   241k|#ifdef USE_BMI2
  330|   241k|  if ((features & HWF_INTEL_AVX) && (features & HWF_INTEL_BMI2))
  ------------------
  |  |  234|   241k|#define HWF_INTEL_AVX           (1 << 12)
  ------------------
                if ((features & HWF_INTEL_AVX) && (features & HWF_INTEL_BMI2))
  ------------------
  |  |  228|   241k|#define HWF_INTEL_BMI2          (1 << 6)
  ------------------
  |  Branch (330:7): [True: 241k, False: 0]
  |  Branch (330:37): [True: 241k, False: 0]
  ------------------
  331|   241k|    hd->bctx.bwrite = do_sha1_transform_amd64_avx_bmi2;
  332|   241k|#endif
  333|   241k|#ifdef USE_AVX2
  334|   241k|  if ((features & HWF_INTEL_AVX2) && (features & HWF_INTEL_AVX) &&
  ------------------
  |  |  235|   241k|#define HWF_INTEL_AVX2          (1 << 13)
  ------------------
                if ((features & HWF_INTEL_AVX2) && (features & HWF_INTEL_AVX) &&
  ------------------
  |  |  234|   241k|#define HWF_INTEL_AVX           (1 << 12)
  ------------------
  |  Branch (334:7): [True: 241k, False: 0]
  |  Branch (334:38): [True: 241k, False: 0]
  ------------------
  335|   241k|      (features & HWF_INTEL_BMI2))
  ------------------
  |  |  228|   241k|#define HWF_INTEL_BMI2          (1 << 6)
  ------------------
  |  Branch (335:7): [True: 241k, False: 0]
  ------------------
  336|   241k|    hd->bctx.bwrite = do_sha1_transform_amd64_avx2_bmi2;
  337|   241k|#endif
  338|   241k|#ifdef USE_SHAEXT
  339|   241k|  if ((features & HWF_INTEL_SHAEXT) && (features & HWF_INTEL_SSE4_1))
  ------------------
  |  |  238|   241k|#define HWF_INTEL_SHAEXT        (1 << 16)
  ------------------
                if ((features & HWF_INTEL_SHAEXT) && (features & HWF_INTEL_SSE4_1))
  ------------------
  |  |  230|      0|#define HWF_INTEL_SSE4_1        (1 << 8)
  ------------------
  |  Branch (339:7): [True: 0, False: 241k]
  |  Branch (339:40): [True: 0, False: 0]
  ------------------
  340|      0|    hd->bctx.bwrite = do_sha1_transform_intel_shaext;
  341|   241k|#endif
  342|       |#ifdef USE_NEON
  343|       |  if ((features & HWF_ARM_NEON) != 0)
  344|       |    hd->bctx.bwrite = do_sha1_transform_armv7_neon;
  345|       |#endif
  346|       |#ifdef USE_ARM_CE
  347|       |  if ((features & HWF_ARM_SHA1) != 0)
  348|       |    hd->bctx.bwrite = do_sha1_transform_armv8_ce;
  349|       |#endif
  350|       |#ifdef SHA1_USE_S390X_CRYPTO
  351|       |  hd->use_s390x_crypto = 0;
  352|       |  if ((features & HWF_S390X_MSA) != 0)
  353|       |    {
  354|       |      if ((kimd_query () & km_function_to_mask (KMID_FUNCTION_SHA1)) &&
  355|       |	  (klmd_query () & km_function_to_mask (KMID_FUNCTION_SHA1)))
  356|       |	{
  357|       |	  hd->bctx.bwrite = do_sha1_transform_s390x;
  358|       |	  hd->use_s390x_crypto = 1;
  359|       |	}
  360|       |    }
  361|       |#endif
  362|       |
  363|   241k|  (void)features;
  364|   241k|}
sha1.c:do_sha1_transform_amd64_avx_bmi2:
  176|  3.20M|{
  177|  3.20M|  SHA1_CONTEXT *hd = ctx;
  178|  3.20M|  return _gcry_sha1_transform_amd64_avx_bmi2 (&hd->h0, data, nblks)
  179|  3.20M|         + ASM_EXTRA_STACK;
  ------------------
  |  |  133|  3.20M|#  define ASM_EXTRA_STACK 0
  ------------------
  180|  3.20M|}
sha1.c:do_sha1_transform_amd64_avx2_bmi2:
  190|  3.31M|{
  191|  3.31M|  SHA1_CONTEXT *hd = ctx;
  192|       |
  193|       |  /* AVX2/BMI2 function only handles pair of blocks so nblks needs to be
  194|       |   * multiple of 2 and function does not handle zero nblks. Use AVX/BMI2
  195|       |   * code to handle these cases. */
  196|       |
  197|  3.31M|  if (nblks <= 1)
  ------------------
  |  Branch (197:7): [True: 3.20M, False: 108k]
  ------------------
  198|  3.20M|    return do_sha1_transform_amd64_avx_bmi2 (ctx, data, nblks);
  199|       |
  200|   108k|  if (nblks & 1)
  ------------------
  |  Branch (200:7): [True: 103k, False: 5.24k]
  ------------------
  201|   103k|    {
  202|   103k|      (void)_gcry_sha1_transform_amd64_avx_bmi2 (&hd->h0, data, 1);
  203|   103k|      nblks--;
  204|   103k|      data += 64;
  205|   103k|    }
  206|       |
  207|   108k|  return _gcry_sha1_transform_amd64_avx2_bmi2 (&hd->h0, data, nblks)
  208|   108k|         + ASM_EXTRA_STACK;
  ------------------
  |  |  133|   108k|#  define ASM_EXTRA_STACK 0
  ------------------
  209|  3.31M|}
sha1.c:_gcry_sha1_hash_buffers:
  642|   103k|{
  643|   103k|  SHA1_CONTEXT hd;
  644|       |
  645|   103k|  (void)nbytes;
  646|       |
  647|   103k|  sha1_init (&hd, 0);
  648|   206k|  for (;iovcnt > 0; iov++, iovcnt--)
  ------------------
  |  Branch (648:9): [True: 103k, False: 103k]
  ------------------
  649|   103k|    _gcry_md_block_write (&hd,
  650|   103k|                          (const char*)iov[0].data + iov[0].off, iov[0].len);
  651|   103k|  sha1_final (&hd);
  652|   103k|  memcpy (outbuf, hd.bctx.buf, 20);
  653|   103k|}
sha1.c:sha1_final:
  556|   103k|{
  557|   103k|  SHA1_CONTEXT *hd = context;
  558|   103k|  u32 t, th, msb, lsb;
  559|   103k|  unsigned char *p;
  560|   103k|  unsigned int burn;
  561|       |
  562|   103k|  t = hd->bctx.nblocks;
  563|   103k|  if (sizeof t == sizeof hd->bctx.nblocks)
  ------------------
  |  Branch (563:7): [Folded - Ignored]
  ------------------
  564|      0|    th = hd->bctx.nblocks_high;
  565|   103k|  else
  566|   103k|    th = hd->bctx.nblocks >> 32;
  567|       |
  568|       |  /* multiply by 64 to make a byte count */
  569|   103k|  lsb = t << 6;
  570|   103k|  msb = (th << 6) | (t >> 26);
  571|       |  /* add the count */
  572|   103k|  t = lsb;
  573|   103k|  if( (lsb += hd->bctx.count) < t )
  ------------------
  |  Branch (573:7): [True: 0, False: 103k]
  ------------------
  574|      0|    msb++;
  575|       |  /* multiply by 8 to make a bit count */
  576|   103k|  t = lsb;
  577|   103k|  lsb <<= 3;
  578|   103k|  msb <<= 3;
  579|   103k|  msb |= t >> 29;
  580|       |
  581|   103k|  if (0)
  ------------------
  |  Branch (581:7): [Folded - Ignored]
  ------------------
  582|      0|    { }
  583|       |#ifdef SHA1_USE_S390X_CRYPTO
  584|       |  else if (hd->use_s390x_crypto)
  585|       |    {
  586|       |      burn = do_sha1_final_s390x (hd, hd->bctx.buf, hd->bctx.count, msb, lsb);
  587|       |    }
  588|       |#endif
  589|   103k|  else if (hd->bctx.count < 56)  /* enough room */
  ------------------
  |  Branch (589:12): [True: 103k, False: 0]
  ------------------
  590|   103k|    {
  591|   103k|      hd->bctx.buf[hd->bctx.count++] = 0x80; /* pad */
  592|   103k|      if (hd->bctx.count < 56)
  ------------------
  |  Branch (592:11): [True: 103k, False: 0]
  ------------------
  593|   103k|	memset (&hd->bctx.buf[hd->bctx.count], 0, 56 - hd->bctx.count);
  594|       |
  595|       |      /* append the 64 bit count */
  596|   103k|      buf_put_be32(hd->bctx.buf + 56, msb);
  597|   103k|      buf_put_be32(hd->bctx.buf + 60, lsb);
  598|   103k|      burn = (*hd->bctx.bwrite) ( hd, hd->bctx.buf, 1 );
  599|   103k|    }
  600|      0|  else  /* need one extra block */
  601|      0|    {
  602|      0|      hd->bctx.buf[hd->bctx.count++] = 0x80; /* pad character */
  603|       |      /* fill pad and next block with zeroes */
  604|      0|      memset (&hd->bctx.buf[hd->bctx.count], 0, 64 - hd->bctx.count + 56);
  605|       |
  606|       |      /* append the 64 bit count */
  607|      0|      buf_put_be32(hd->bctx.buf + 64 + 56, msb);
  608|      0|      buf_put_be32(hd->bctx.buf + 64 + 60, lsb);
  609|      0|      burn = (*hd->bctx.bwrite) ( hd, hd->bctx.buf, 2 );
  610|      0|    }
  611|       |
  612|   103k|  p = hd->bctx.buf;
  613|   103k|#define X(a) do { buf_put_be32(p, hd->h##a); p += 4; } while(0)
  614|   103k|  X(0);
  ------------------
  |  |  613|   103k|#define X(a) do { buf_put_be32(p, hd->h##a); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (613:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  615|   103k|  X(1);
  ------------------
  |  |  613|   103k|#define X(a) do { buf_put_be32(p, hd->h##a); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (613:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  616|   103k|  X(2);
  ------------------
  |  |  613|   103k|#define X(a) do { buf_put_be32(p, hd->h##a); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (613:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  617|   103k|  X(3);
  ------------------
  |  |  613|   103k|#define X(a) do { buf_put_be32(p, hd->h##a); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (613:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  618|   103k|  X(4);
  ------------------
  |  |  613|   103k|#define X(a) do { buf_put_be32(p, hd->h##a); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (613:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  619|   103k|#undef X
  620|       |
  621|   103k|  hd->bctx.count = 0;
  622|       |
  623|   103k|  _gcry_burn_stack (burn);
  ------------------
  |  |  371|   103k|	do { __gcry_burn_stack (bytes); \
  |  |  372|   103k|	     __gcry_burn_stack_dummy (); } while(0)
  |  |  ------------------
  |  |  |  |  364|   103k|#define  __gcry_burn_stack_dummy() asm volatile ("":::"memory")
  |  |  ------------------
  |  |  |  Branch (372:43): [Folded - Ignored]
  |  |  ------------------
  ------------------
  624|   103k|}

sha256.c:sha224_init:
  365|  12.2k|{
  366|  12.2k|  SHA256_CONTEXT *hd = context;
  367|       |
  368|  12.2k|  (void)flags;
  369|       |
  370|  12.2k|  hd->h[0] = 0xc1059ed8;
  371|  12.2k|  hd->h[1] = 0x367cd507;
  372|  12.2k|  hd->h[2] = 0x3070dd17;
  373|  12.2k|  hd->h[3] = 0xf70e5939;
  374|  12.2k|  hd->h[4] = 0xffc00b31;
  375|  12.2k|  hd->h[5] = 0x68581511;
  376|  12.2k|  hd->h[6] = 0x64f98fa7;
  377|  12.2k|  hd->h[7] = 0xbefa4fa4;
  378|       |
  379|  12.2k|  sha256_common_init (hd);
  380|  12.2k|}
sha256.c:sha256_common_init:
  287|  22.2k|{
  288|  22.2k|  unsigned int features = _gcry_get_hw_features ();
  289|       |
  290|  22.2k|  hd->bctx.nblocks = 0;
  291|  22.2k|  hd->bctx.nblocks_high = 0;
  292|  22.2k|  hd->bctx.count = 0;
  293|  22.2k|  hd->bctx.blocksize_shift = _gcry_ctz(64);
  294|       |
  295|       |  /* Order of feature checks is important here; last match will be
  296|       |   * selected.  Keep slower implementations at the top and faster at
  297|       |   * the bottom.  */
  298|  22.2k|  hd->bctx.bwrite = do_transform_generic;
  299|  22.2k|#ifdef USE_SSSE3
  300|  22.2k|  if ((features & HWF_INTEL_SSSE3) != 0)
  ------------------
  |  |  229|  22.2k|#define HWF_INTEL_SSSE3         (1 << 7)
  ------------------
  |  Branch (300:7): [True: 22.2k, False: 0]
  ------------------
  301|  22.2k|    hd->bctx.bwrite = do_sha256_transform_amd64_ssse3;
  302|  22.2k|#endif
  303|  22.2k|#ifdef USE_AVX
  304|       |  /* AVX implementation uses SHLD which is known to be slow on non-Intel CPUs.
  305|       |   * Therefore use this implementation on Intel CPUs only. */
  306|  22.2k|  if ((features & HWF_INTEL_AVX) && (features & HWF_INTEL_FAST_SHLD))
  ------------------
  |  |  234|  22.2k|#define HWF_INTEL_AVX           (1 << 12)
  ------------------
                if ((features & HWF_INTEL_AVX) && (features & HWF_INTEL_FAST_SHLD))
  ------------------
  |  |  227|  22.2k|#define HWF_INTEL_FAST_SHLD     (1 << 5)
  ------------------
  |  Branch (306:7): [True: 22.2k, False: 0]
  |  Branch (306:37): [True: 22.2k, False: 0]
  ------------------
  307|  22.2k|    hd->bctx.bwrite = do_sha256_transform_amd64_avx;
  308|  22.2k|#endif
  309|  22.2k|#ifdef USE_AVX2
  310|  22.2k|  if ((features & HWF_INTEL_AVX2) && (features & HWF_INTEL_BMI2))
  ------------------
  |  |  235|  22.2k|#define HWF_INTEL_AVX2          (1 << 13)
  ------------------
                if ((features & HWF_INTEL_AVX2) && (features & HWF_INTEL_BMI2))
  ------------------
  |  |  228|  22.2k|#define HWF_INTEL_BMI2          (1 << 6)
  ------------------
  |  Branch (310:7): [True: 22.2k, False: 0]
  |  Branch (310:38): [True: 22.2k, False: 0]
  ------------------
  311|  22.2k|    hd->bctx.bwrite = do_sha256_transform_amd64_avx2;
  312|  22.2k|#endif
  313|  22.2k|#ifdef USE_SHAEXT
  314|  22.2k|  if ((features & HWF_INTEL_SHAEXT) && (features & HWF_INTEL_SSE4_1))
  ------------------
  |  |  238|  22.2k|#define HWF_INTEL_SHAEXT        (1 << 16)
  ------------------
                if ((features & HWF_INTEL_SHAEXT) && (features & HWF_INTEL_SSE4_1))
  ------------------
  |  |  230|      0|#define HWF_INTEL_SSE4_1        (1 << 8)
  ------------------
  |  Branch (314:7): [True: 0, False: 22.2k]
  |  Branch (314:40): [True: 0, False: 0]
  ------------------
  315|      0|    hd->bctx.bwrite = do_sha256_transform_intel_shaext;
  316|  22.2k|#endif
  317|       |#ifdef USE_ARM_CE
  318|       |  if ((features & HWF_ARM_SHA2) != 0)
  319|       |    hd->bctx.bwrite = do_sha256_transform_armv8_ce;
  320|       |#endif
  321|       |#ifdef USE_PPC_CRYPTO
  322|       |  if ((features & HWF_PPC_VCRYPTO) != 0)
  323|       |    hd->bctx.bwrite = do_sha256_transform_ppc8;
  324|       |  if ((features & HWF_PPC_VCRYPTO) != 0 && (features & HWF_PPC_ARCH_3_00) != 0)
  325|       |    hd->bctx.bwrite = do_sha256_transform_ppc9;
  326|       |#endif
  327|       |#ifdef USE_S390X_CRYPTO
  328|       |  hd->use_s390x_crypto = 0;
  329|       |  if ((features & HWF_S390X_MSA) != 0)
  330|       |    {
  331|       |      if ((kimd_query () & km_function_to_mask (KMID_FUNCTION_SHA256)) &&
  332|       |	  (klmd_query () & km_function_to_mask (KMID_FUNCTION_SHA256)))
  333|       |	{
  334|       |	  hd->bctx.bwrite = do_sha256_transform_s390x;
  335|       |	  hd->use_s390x_crypto = 1;
  336|       |	}
  337|       |    }
  338|       |#endif
  339|  22.2k|  (void)features;
  340|  22.2k|}
sha256.c:do_sha256_transform_amd64_avx2:
  184|  2.75k|{
  185|  2.75k|  SHA256_CONTEXT *hd = ctx;
  186|  2.75k|  return _gcry_sha256_transform_amd64_avx2 (data, hd->h, nblks)
  187|  2.75k|         + ASM_EXTRA_STACK;
  ------------------
  |  |  141|  2.75k|#  define ASM_EXTRA_STACK 0
  ------------------
  188|  2.75k|}
sha256.c:sha256_init:
  345|  10.0k|{
  346|  10.0k|  SHA256_CONTEXT *hd = context;
  347|       |
  348|  10.0k|  (void)flags;
  349|       |
  350|  10.0k|  hd->h[0] = 0x6a09e667;
  351|  10.0k|  hd->h[1] = 0xbb67ae85;
  352|  10.0k|  hd->h[2] = 0x3c6ef372;
  353|  10.0k|  hd->h[3] = 0xa54ff53a;
  354|  10.0k|  hd->h[4] = 0x510e527f;
  355|  10.0k|  hd->h[5] = 0x9b05688c;
  356|  10.0k|  hd->h[6] = 0x1f83d9ab;
  357|  10.0k|  hd->h[7] = 0x5be0cd19;
  358|       |
  359|  10.0k|  sha256_common_init (hd);
  360|  10.0k|}

sha512.c:sha512_init:
  500|    865|{
  501|    865|  SHA512_CONTEXT *ctx = context;
  502|    865|  SHA512_STATE *hd = &ctx->state;
  503|       |
  504|    865|  hd->h[0] = U64_C(0x6a09e667f3bcc908);
  ------------------
  |  |  106|    865|#  define U64_C(c) (UINT64_C(c))
  ------------------
  505|    865|  hd->h[1] = U64_C(0xbb67ae8584caa73b);
  ------------------
  |  |  106|    865|#  define U64_C(c) (UINT64_C(c))
  ------------------
  506|    865|  hd->h[2] = U64_C(0x3c6ef372fe94f82b);
  ------------------
  |  |  106|    865|#  define U64_C(c) (UINT64_C(c))
  ------------------
  507|    865|  hd->h[3] = U64_C(0xa54ff53a5f1d36f1);
  ------------------
  |  |  106|    865|#  define U64_C(c) (UINT64_C(c))
  ------------------
  508|    865|  hd->h[4] = U64_C(0x510e527fade682d1);
  ------------------
  |  |  106|    865|#  define U64_C(c) (UINT64_C(c))
  ------------------
  509|    865|  hd->h[5] = U64_C(0x9b05688c2b3e6c1f);
  ------------------
  |  |  106|    865|#  define U64_C(c) (UINT64_C(c))
  ------------------
  510|    865|  hd->h[6] = U64_C(0x1f83d9abfb41bd6b);
  ------------------
  |  |  106|    865|#  define U64_C(c) (UINT64_C(c))
  ------------------
  511|    865|  hd->h[7] = U64_C(0x5be0cd19137e2179);
  ------------------
  |  |  106|    865|#  define U64_C(c) (UINT64_C(c))
  ------------------
  512|       |
  513|    865|  sha512_init_common (ctx, flags);
  514|    865|}
sha512.c:sha512_init_common:
  433|  7.97k|{
  434|  7.97k|  unsigned int features = _gcry_get_hw_features ();
  435|       |
  436|  7.97k|  (void)flags;
  437|  7.97k|  (void)k;
  438|       |
  439|  7.97k|  ctx->bctx.nblocks = 0;
  440|  7.97k|  ctx->bctx.nblocks_high = 0;
  441|  7.97k|  ctx->bctx.count = 0;
  442|  7.97k|  ctx->bctx.blocksize_shift = _gcry_ctz(128);
  443|       |
  444|       |  /* Order of feature checks is important here; last match will be
  445|       |   * selected.  Keep slower implementations at the top and faster at
  446|       |   * the bottom.  */
  447|  7.97k|  ctx->bctx.bwrite = do_transform_generic;
  448|       |#ifdef USE_ARM_NEON_ASM
  449|       |  if ((features & HWF_ARM_NEON) != 0)
  450|       |    ctx->bctx.bwrite = do_sha512_transform_armv7_neon;
  451|       |#endif
  452|       |#ifdef USE_ARM64_SHA512
  453|       |  if ((features & HWF_ARM_NEON) && (features & HWF_ARM_SHA512))
  454|       |    ctx->bctx.bwrite = do_sha512_transform_armv8_ce;
  455|       |#endif
  456|  7.97k|#ifdef USE_SSSE3
  457|  7.97k|  if ((features & HWF_INTEL_SSSE3) != 0)
  ------------------
  |  |  229|  7.97k|#define HWF_INTEL_SSSE3         (1 << 7)
  ------------------
  |  Branch (457:7): [True: 7.97k, False: 0]
  ------------------
  458|  7.97k|    ctx->bctx.bwrite = do_sha512_transform_amd64_ssse3;
  459|  7.97k|#endif
  460|  7.97k|#ifdef USE_AVX
  461|  7.97k|  if ((features & HWF_INTEL_AVX) && (features & HWF_INTEL_FAST_SHLD))
  ------------------
  |  |  234|  7.97k|#define HWF_INTEL_AVX           (1 << 12)
  ------------------
                if ((features & HWF_INTEL_AVX) && (features & HWF_INTEL_FAST_SHLD))
  ------------------
  |  |  227|  7.97k|#define HWF_INTEL_FAST_SHLD     (1 << 5)
  ------------------
  |  Branch (461:7): [True: 7.97k, False: 0]
  |  Branch (461:37): [True: 7.97k, False: 0]
  ------------------
  462|  7.97k|    ctx->bctx.bwrite = do_sha512_transform_amd64_avx;
  463|  7.97k|#endif
  464|  7.97k|#ifdef USE_AVX2
  465|  7.97k|  if ((features & HWF_INTEL_AVX2) && (features & HWF_INTEL_BMI2))
  ------------------
  |  |  235|  7.97k|#define HWF_INTEL_AVX2          (1 << 13)
  ------------------
                if ((features & HWF_INTEL_AVX2) && (features & HWF_INTEL_BMI2))
  ------------------
  |  |  228|  7.97k|#define HWF_INTEL_BMI2          (1 << 6)
  ------------------
  |  Branch (465:7): [True: 7.97k, False: 0]
  |  Branch (465:38): [True: 7.97k, False: 0]
  ------------------
  466|  7.97k|    ctx->bctx.bwrite = do_sha512_transform_amd64_avx2;
  467|  7.97k|#endif
  468|  7.97k|#ifdef USE_AVX512
  469|  7.97k|  if ((features & HWF_INTEL_AVX512) && (features & HWF_INTEL_CPU))
  ------------------
  |  |  240|  7.97k|#define HWF_INTEL_AVX512        (1 << 18)
  ------------------
                if ((features & HWF_INTEL_AVX512) && (features & HWF_INTEL_CPU))
  ------------------
  |  |  226|      0|#define HWF_INTEL_CPU           (1 << 4)
  ------------------
  |  Branch (469:7): [True: 0, False: 7.97k]
  |  Branch (469:40): [True: 0, False: 0]
  ------------------
  470|      0|    ctx->bctx.bwrite = do_sha512_transform_amd64_avx512;
  471|  7.97k|#endif
  472|       |#ifdef USE_PPC_CRYPTO
  473|       |  if ((features & HWF_PPC_VCRYPTO) != 0)
  474|       |    ctx->bctx.bwrite = do_sha512_transform_ppc8;
  475|       |  if ((features & HWF_PPC_VCRYPTO) != 0 && (features & HWF_PPC_ARCH_3_00) != 0)
  476|       |    ctx->bctx.bwrite = do_sha512_transform_ppc9;
  477|       |#endif
  478|       |#ifdef USE_SSSE3_I386
  479|       |  if ((features & HWF_INTEL_SSSE3) != 0)
  480|       |    ctx->bctx.bwrite = do_sha512_transform_i386_ssse3;
  481|       |#endif
  482|       |#ifdef USE_S390X_CRYPTO
  483|       |  ctx->use_s390x_crypto = 0;
  484|       |  if ((features & HWF_S390X_MSA) != 0)
  485|       |    {
  486|       |      if ((kimd_query () & km_function_to_mask (KMID_FUNCTION_SHA512)) &&
  487|       |	  (klmd_query () & km_function_to_mask (KMID_FUNCTION_SHA512)))
  488|       |	{
  489|       |	  ctx->bctx.bwrite = do_sha512_transform_s390x;
  490|       |	  ctx->use_s390x_crypto = 1;
  491|       |	}
  492|       |    }
  493|       |#endif
  494|  7.97k|  (void)features;
  495|  7.97k|}
sha512.c:do_sha512_transform_amd64_avx2:
  312|  1.99k|{
  313|  1.99k|  SHA512_CONTEXT *hd = ctx;
  314|  1.99k|  unsigned int burn;
  315|  1.99k|  burn = _gcry_sha512_transform_amd64_avx2 (data, &hd->state, nblks);
  316|  1.99k|  burn += burn > 0 ? ASM_EXTRA_STACK : 0;
  ------------------
  |  |  236|      0|#  define ASM_EXTRA_STACK 0
  ------------------
  |  Branch (316:11): [True: 0, False: 1.99k]
  ------------------
  317|  1.99k|  return burn;
  318|  1.99k|}
sha512.c:sha384_init:
  518|  7.11k|{
  519|  7.11k|  SHA512_CONTEXT *ctx = context;
  520|  7.11k|  SHA512_STATE *hd = &ctx->state;
  521|       |
  522|  7.11k|  hd->h[0] = U64_C(0xcbbb9d5dc1059ed8);
  ------------------
  |  |  106|  7.11k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  523|  7.11k|  hd->h[1] = U64_C(0x629a292a367cd507);
  ------------------
  |  |  106|  7.11k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  524|  7.11k|  hd->h[2] = U64_C(0x9159015a3070dd17);
  ------------------
  |  |  106|  7.11k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  525|  7.11k|  hd->h[3] = U64_C(0x152fecd8f70e5939);
  ------------------
  |  |  106|  7.11k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  526|  7.11k|  hd->h[4] = U64_C(0x67332667ffc00b31);
  ------------------
  |  |  106|  7.11k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  527|  7.11k|  hd->h[5] = U64_C(0x8eb44a8768581511);
  ------------------
  |  |  106|  7.11k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  528|  7.11k|  hd->h[6] = U64_C(0xdb0c2e0d64f98fa7);
  ------------------
  |  |  106|  7.11k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  529|  7.11k|  hd->h[7] = U64_C(0x47b5481dbefa4fa4);
  ------------------
  |  |  106|  7.11k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  530|       |
  531|  7.11k|  sha512_init_common (ctx, flags);
  532|  7.11k|}

tiger.c:tiger_init:
  611|    763|{
  612|    763|  (void)flags;
  613|       |
  614|    763|  do_init (context, 0);
  615|    763|}
tiger.c:do_init:
  594|    763|{
  595|    763|  TIGER_CONTEXT *hd = context;
  596|       |
  597|    763|  hd->a = 0x0123456789abcdefLL;
  598|    763|  hd->b = 0xfedcba9876543210LL;
  599|    763|  hd->c = 0xf096a5b4c3b2e187LL;
  600|       |
  601|    763|  hd->bctx.nblocks = 0;
  602|    763|  hd->bctx.nblocks_high = 0;
  603|    763|  hd->bctx.count = 0;
  604|    763|  hd->bctx.blocksize_shift = _gcry_ctz(64);
  605|    763|  hd->bctx.bwrite = transform;
  606|    763|  hd->variant = variant;
  607|    763|}
tiger.c:transform:
  713|  1.93k|{
  714|  1.93k|  unsigned int burn;
  715|       |
  716|  1.93k|  do
  717|  23.9k|    {
  718|  23.9k|      burn = transform_blk (c, data);
  719|  23.9k|      data += 64;
  720|  23.9k|    }
  721|  23.9k|  while (--nblks);
  ------------------
  |  Branch (721:10): [True: 21.9k, False: 1.93k]
  ------------------
  722|       |
  723|  1.93k|  return burn;
  724|  1.93k|}
tiger.c:transform_blk:
  678|  23.9k|{
  679|  23.9k|  TIGER_CONTEXT *hd = ctx;
  680|  23.9k|  u64 a,b,c,aa,bb,cc;
  681|  23.9k|  u64 x[8];
  682|  23.9k|  int i;
  683|       |
  684|   215k|  for ( i = 0; i < 8; i++ )
  ------------------
  |  Branch (684:16): [True: 191k, False: 23.9k]
  ------------------
  685|   191k|    x[i] = buf_get_le64(data + i * 8);
  686|       |
  687|       |  /* save */
  688|  23.9k|  a = aa = hd->a;
  689|  23.9k|  b = bb = hd->b;
  690|  23.9k|  c = cc = hd->c;
  691|       |
  692|  23.9k|  pass( a, b, c, x, 5);
  ------------------
  |  |  643|  23.9k|#define pass(ya, yb, yc, yx, ymul) { \
  |  |  644|  23.9k|  tiger_round( ya, yb, yc, yx[0], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  645|  23.9k|  tiger_round( yb, yc, ya, yx[1], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  646|  23.9k|  tiger_round( yc, ya, yb, yx[2], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  647|  23.9k|  tiger_round( ya, yb, yc, yx[3], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  648|  23.9k|  tiger_round( yb, yc, ya, yx[4], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  649|  23.9k|  tiger_round( yc, ya, yb, yx[5], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  650|  23.9k|  tiger_round( ya, yb, yc, yx[6], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  651|  23.9k|  tiger_round( yb, yc, ya, yx[7], ymul ); }
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  ------------------
  693|  23.9k|  key_schedule( x );
  ------------------
  |  |  654|  23.9k|#define key_schedule(x) { \
  |  |  655|  23.9k|  x[0] -= x[7] ^ 0xa5a5a5a5a5a5a5a5LL; \
  |  |  656|  23.9k|  x[1] ^= x[0]; \
  |  |  657|  23.9k|  x[2] += x[1]; \
  |  |  658|  23.9k|  x[3] -= x[2] ^ ((~x[1]) << 19 ); \
  |  |  659|  23.9k|  x[4] ^= x[3]; \
  |  |  660|  23.9k|  x[5] += x[4]; \
  |  |  661|  23.9k|  x[6] -= x[5] ^ ((~x[4]) >> 23 ); \
  |  |  662|  23.9k|  x[7] ^= x[6]; \
  |  |  663|  23.9k|  x[0] += x[7]; \
  |  |  664|  23.9k|  x[1] -= x[0] ^ ((~x[7]) << 19 ); \
  |  |  665|  23.9k|  x[2] ^= x[1]; \
  |  |  666|  23.9k|  x[3] += x[2]; \
  |  |  667|  23.9k|  x[4] -= x[3] ^ ((~x[2]) >> 23 ); \
  |  |  668|  23.9k|  x[5] ^= x[4]; \
  |  |  669|  23.9k|  x[6] += x[5]; \
  |  |  670|  23.9k|  x[7] -= x[6] ^ 0x0123456789abcdefLL; }
  ------------------
  694|  23.9k|  pass( c, a, b, x, 7);
  ------------------
  |  |  643|  23.9k|#define pass(ya, yb, yc, yx, ymul) { \
  |  |  644|  23.9k|  tiger_round( ya, yb, yc, yx[0], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  645|  23.9k|  tiger_round( yb, yc, ya, yx[1], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  646|  23.9k|  tiger_round( yc, ya, yb, yx[2], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  647|  23.9k|  tiger_round( ya, yb, yc, yx[3], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  648|  23.9k|  tiger_round( yb, yc, ya, yx[4], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  649|  23.9k|  tiger_round( yc, ya, yb, yx[5], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  650|  23.9k|  tiger_round( ya, yb, yc, yx[6], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  651|  23.9k|  tiger_round( yb, yc, ya, yx[7], ymul ); }
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  ------------------
  695|  23.9k|  key_schedule( x );
  ------------------
  |  |  654|  23.9k|#define key_schedule(x) { \
  |  |  655|  23.9k|  x[0] -= x[7] ^ 0xa5a5a5a5a5a5a5a5LL; \
  |  |  656|  23.9k|  x[1] ^= x[0]; \
  |  |  657|  23.9k|  x[2] += x[1]; \
  |  |  658|  23.9k|  x[3] -= x[2] ^ ((~x[1]) << 19 ); \
  |  |  659|  23.9k|  x[4] ^= x[3]; \
  |  |  660|  23.9k|  x[5] += x[4]; \
  |  |  661|  23.9k|  x[6] -= x[5] ^ ((~x[4]) >> 23 ); \
  |  |  662|  23.9k|  x[7] ^= x[6]; \
  |  |  663|  23.9k|  x[0] += x[7]; \
  |  |  664|  23.9k|  x[1] -= x[0] ^ ((~x[7]) << 19 ); \
  |  |  665|  23.9k|  x[2] ^= x[1]; \
  |  |  666|  23.9k|  x[3] += x[2]; \
  |  |  667|  23.9k|  x[4] -= x[3] ^ ((~x[2]) >> 23 ); \
  |  |  668|  23.9k|  x[5] ^= x[4]; \
  |  |  669|  23.9k|  x[6] += x[5]; \
  |  |  670|  23.9k|  x[7] -= x[6] ^ 0x0123456789abcdefLL; }
  ------------------
  696|  23.9k|  pass( b, c, a, x, 9);
  ------------------
  |  |  643|  23.9k|#define pass(ya, yb, yc, yx, ymul) { \
  |  |  644|  23.9k|  tiger_round( ya, yb, yc, yx[0], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  645|  23.9k|  tiger_round( yb, yc, ya, yx[1], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  646|  23.9k|  tiger_round( yc, ya, yb, yx[2], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  647|  23.9k|  tiger_round( ya, yb, yc, yx[3], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  648|  23.9k|  tiger_round( yb, yc, ya, yx[4], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  649|  23.9k|  tiger_round( yc, ya, yb, yx[5], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  650|  23.9k|  tiger_round( ya, yb, yc, yx[6], ymul ); \
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  |  |  651|  23.9k|  tiger_round( yb, yc, ya, yx[7], ymul ); }
  |  |  ------------------
  |  |  |  |  634|  23.9k|#define tiger_round(xa, xb, xc, xx, xmul) { \
  |  |  |  |  635|  23.9k|  xc ^= xx; \
  |  |  |  |  636|  23.9k|  xa -= (  sbox1[  (xc)        & 0xff ] ^ sbox2[ ((xc) >> 16) & 0xff ] \
  |  |  |  |  637|  23.9k|         ^ sbox3[ ((xc) >> 32) & 0xff ] ^ sbox4[ ((xc) >> 48) & 0xff ]); \
  |  |  |  |  638|  23.9k|  xb += (  sbox4[ ((xc) >>  8) & 0xff ] ^ sbox3[ ((xc) >> 24) & 0xff ] \
  |  |  |  |  639|  23.9k|         ^ sbox2[ ((xc) >> 40) & 0xff ] ^ sbox1[ ((xc) >> 56) & 0xff ]); \
  |  |  |  |  640|  23.9k|  xb *= xmul; }
  |  |  ------------------
  ------------------
  697|       |
  698|       |  /* feedforward */
  699|  23.9k|  a ^= aa;
  700|  23.9k|  b -= bb;
  701|  23.9k|  c += cc;
  702|       |  /* store */
  703|  23.9k|  hd->a = a;
  704|  23.9k|  hd->b = b;
  705|  23.9k|  hd->c = c;
  706|       |
  707|  23.9k|  return /*burn_stack*/ 21*8+11*sizeof(void*);
  708|  23.9k|}

mpicoder.c:buf_get_be64:
  161|  13.4k|{
  162|  13.4k|  return be_bswap64(((const bufhelp_u64_t *)_buf)->a);
  ------------------
  |  |   75|  13.4k|# define be_bswap64(x) _gcry_bswap64(x)
  |  |  ------------------
  |  |  |  |   56|  13.4k|# define _gcry_bswap64 __builtin_bswap64
  |  |  ------------------
  ------------------
  163|  13.4k|}

_gcry_mpi_normalize:
   57|  72.1k|{
   58|  72.1k|    if( mpi_is_opaque(a) )
  ------------------
  |  |  114|  72.1k|#define mpi_is_opaque(a)      ((a) && ((a)->flags&4))
  |  |  ------------------
  |  |  |  Branch (114:32): [True: 72.1k, False: 0]
  |  |  |  Branch (114:39): [True: 0, False: 72.1k]
  |  |  ------------------
  ------------------
   59|      0|	return;
   60|       |
   61|  77.7k|    for( ; a->nlimbs && !a->d[a->nlimbs-1]; a->nlimbs-- )
  ------------------
  |  Branch (61:12): [True: 20.8k, False: 56.9k]
  |  Branch (61:25): [True: 5.62k, False: 15.1k]
  ------------------
   62|  5.62k|	;
   63|  72.1k|}

_gcry_mpi_scan:
  541|  72.1k|{
  542|  72.1k|  const unsigned char *buffer = (const unsigned char*)buffer_arg;
  543|  72.1k|  struct gcry_mpi *a = NULL;
  544|  72.1k|  unsigned int len;
  545|  72.1k|  int secure = (buffer && _gcry_is_secure (buffer));
  ------------------
  |  Branch (545:17): [True: 72.1k, False: 0]
  |  Branch (545:27): [True: 0, False: 72.1k]
  ------------------
  546|       |
  547|  72.1k|  if (buflen > MAX_EXTERN_SCAN_BYTES)
  ------------------
  |  |   37|  72.1k|#define MAX_EXTERN_SCAN_BYTES (16*1024*1024)
  ------------------
  |  Branch (547:7): [True: 0, False: 72.1k]
  ------------------
  548|      0|    {
  549|      0|      if (nscanned)
  ------------------
  |  Branch (549:11): [True: 0, False: 0]
  ------------------
  550|      0|        *nscanned = 0;
  551|      0|      return GPG_ERR_INV_OBJ;
  552|      0|    }
  553|       |
  554|  72.1k|  if (format == GCRYMPI_FMT_SSH)
  ------------------
  |  Branch (554:7): [True: 0, False: 72.1k]
  ------------------
  555|      0|    len = 0;
  556|  72.1k|  else
  557|  72.1k|    len = buflen;
  558|       |
  559|  72.1k|  if (format == GCRYMPI_FMT_STD)
  ------------------
  |  Branch (559:7): [True: 0, False: 72.1k]
  ------------------
  560|      0|    {
  561|      0|      const unsigned char *s = buffer;
  562|       |
  563|      0|      a = secure? mpi_alloc_secure ((len+BYTES_PER_MPI_LIMB-1)
  ------------------
  |  |   98|      0|# define mpi_alloc_secure(n)  _gcry_mpi_alloc_secure((n) )
  ------------------
  |  Branch (563:11): [True: 0, False: 0]
  ------------------
  564|      0|                                    /BYTES_PER_MPI_LIMB)
  565|      0|                : mpi_alloc ((len+BYTES_PER_MPI_LIMB-1)/BYTES_PER_MPI_LIMB);
  ------------------
  |  |   97|      0|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  566|      0|      if (len)
  ------------------
  |  Branch (566:11): [True: 0, False: 0]
  ------------------
  567|      0|        {
  568|      0|          _gcry_mpi_set_buffer (a, s, len, 0);
  569|      0|          a->sign = !!(*s & 0x80);
  570|      0|          if (a->sign)
  ------------------
  |  Branch (570:15): [True: 0, False: 0]
  ------------------
  571|      0|            {
  572|      0|              onecompl (a);
  573|      0|              mpi_add_ui (a, a, 1);
  ------------------
  |  |  515|      0|#define mpi_add_ui(w,u,v)      _gcry_mpi_add_ui((w),(u),(v))
  ------------------
  574|      0|              a->sign = 1;
  575|      0|	    }
  576|      0|	}
  577|      0|      if (ret_mpi)
  ------------------
  |  Branch (577:11): [True: 0, False: 0]
  ------------------
  578|      0|        {
  579|      0|          mpi_normalize ( a );
  ------------------
  |  |  223|      0|#define mpi_normalize(a)       _gcry_mpi_normalize ((a))
  ------------------
  580|      0|          *ret_mpi = a;
  581|      0|	}
  582|      0|      else
  583|      0|        mpi_free(a);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  584|      0|      if (nscanned)
  ------------------
  |  Branch (584:11): [True: 0, False: 0]
  ------------------
  585|      0|        *nscanned = len;
  586|      0|      return 0;
  587|      0|    }
  588|  72.1k|  else if (format == GCRYMPI_FMT_USG)
  ------------------
  |  Branch (588:12): [True: 0, False: 72.1k]
  ------------------
  589|      0|    {
  590|      0|      a = secure? mpi_alloc_secure ((len+BYTES_PER_MPI_LIMB-1)
  ------------------
  |  |   98|      0|# define mpi_alloc_secure(n)  _gcry_mpi_alloc_secure((n) )
  ------------------
  |  Branch (590:11): [True: 0, False: 0]
  ------------------
  591|      0|                                    /BYTES_PER_MPI_LIMB)
  592|      0|                : mpi_alloc ((len+BYTES_PER_MPI_LIMB-1)/BYTES_PER_MPI_LIMB);
  ------------------
  |  |   97|      0|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  593|       |
  594|      0|      if (len)
  ------------------
  |  Branch (594:11): [True: 0, False: 0]
  ------------------
  595|      0|        _gcry_mpi_set_buffer (a, buffer, len, 0);
  596|      0|      if (ret_mpi)
  ------------------
  |  Branch (596:11): [True: 0, False: 0]
  ------------------
  597|      0|        {
  598|      0|          mpi_normalize ( a );
  ------------------
  |  |  223|      0|#define mpi_normalize(a)       _gcry_mpi_normalize ((a))
  ------------------
  599|      0|          *ret_mpi = a;
  600|      0|	}
  601|      0|      else
  602|      0|        mpi_free(a);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  603|      0|      if (nscanned)
  ------------------
  |  Branch (603:11): [True: 0, False: 0]
  ------------------
  604|      0|        *nscanned = len;
  605|      0|      return 0;
  606|      0|    }
  607|  72.1k|  else if (format == GCRYMPI_FMT_PGP)
  ------------------
  |  Branch (607:12): [True: 72.1k, False: 0]
  ------------------
  608|  72.1k|    {
  609|  72.1k|      a = mpi_read_from_buffer (buffer, &len, secure);
  610|  72.1k|      if (nscanned)
  ------------------
  |  Branch (610:11): [True: 72.1k, False: 0]
  ------------------
  611|  72.1k|        *nscanned = len;
  612|  72.1k|      if (ret_mpi && a)
  ------------------
  |  Branch (612:11): [True: 72.1k, False: 0]
  |  Branch (612:22): [True: 72.1k, False: 0]
  ------------------
  613|  72.1k|        {
  614|  72.1k|          mpi_normalize (a);
  ------------------
  |  |  223|  72.1k|#define mpi_normalize(a)       _gcry_mpi_normalize ((a))
  ------------------
  615|  72.1k|          *ret_mpi = a;
  616|  72.1k|	}
  617|      0|      else if (a)
  ------------------
  |  Branch (617:16): [True: 0, False: 0]
  ------------------
  618|      0|        {
  619|      0|          mpi_free(a);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  620|      0|          a = NULL;
  621|      0|        }
  622|  72.1k|      return a? 0 : GPG_ERR_INV_OBJ;
  ------------------
  |  Branch (622:14): [True: 72.1k, False: 0]
  ------------------
  623|  72.1k|    }
  624|      0|  else if (format == GCRYMPI_FMT_SSH)
  ------------------
  |  Branch (624:12): [True: 0, False: 0]
  ------------------
  625|      0|    {
  626|      0|      const unsigned char *s = buffer;
  627|      0|      size_t n;
  628|       |
  629|       |      /* This test is not strictly necessary and an assert (!len)
  630|       |         would be sufficient.  We keep this test in case we later
  631|       |         allow the BUFLEN argument to act as a sanitiy check.  Same
  632|       |         below. */
  633|      0|      if (len && len < 4)
  ------------------
  |  Branch (633:11): [True: 0, False: 0]
  |  Branch (633:18): [True: 0, False: 0]
  ------------------
  634|      0|        return GPG_ERR_TOO_SHORT;
  635|       |
  636|      0|      n = buf_get_be32 (s);
  637|      0|      s += 4;
  638|      0|      if (len)
  ------------------
  |  Branch (638:11): [True: 0, False: 0]
  ------------------
  639|      0|        len -= 4;
  640|      0|      if (len && n > len)
  ------------------
  |  Branch (640:11): [True: 0, False: 0]
  |  Branch (640:18): [True: 0, False: 0]
  ------------------
  641|      0|        return GPG_ERR_TOO_LARGE;
  642|       |
  643|      0|      a = secure? mpi_alloc_secure ((n+BYTES_PER_MPI_LIMB-1)
  ------------------
  |  |   98|      0|# define mpi_alloc_secure(n)  _gcry_mpi_alloc_secure((n) )
  ------------------
  |  Branch (643:11): [True: 0, False: 0]
  ------------------
  644|      0|                                    /BYTES_PER_MPI_LIMB)
  645|      0|                : mpi_alloc ((n+BYTES_PER_MPI_LIMB-1)/BYTES_PER_MPI_LIMB);
  ------------------
  |  |   97|      0|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  646|      0|      if (n)
  ------------------
  |  Branch (646:11): [True: 0, False: 0]
  ------------------
  647|      0|        {
  648|      0|          _gcry_mpi_set_buffer( a, s, n, 0 );
  649|      0|          a->sign = !!(*s & 0x80);
  650|      0|          if (a->sign)
  ------------------
  |  Branch (650:15): [True: 0, False: 0]
  ------------------
  651|      0|            {
  652|      0|              onecompl (a);
  653|      0|              mpi_add_ui (a, a, 1);
  ------------------
  |  |  515|      0|#define mpi_add_ui(w,u,v)      _gcry_mpi_add_ui((w),(u),(v))
  ------------------
  654|      0|              a->sign = 1;
  655|      0|	    }
  656|      0|	}
  657|      0|      if (nscanned)
  ------------------
  |  Branch (657:11): [True: 0, False: 0]
  ------------------
  658|      0|        *nscanned = n+4;
  659|      0|      if (ret_mpi)
  ------------------
  |  Branch (659:11): [True: 0, False: 0]
  ------------------
  660|      0|        {
  661|      0|          mpi_normalize ( a );
  ------------------
  |  |  223|      0|#define mpi_normalize(a)       _gcry_mpi_normalize ((a))
  ------------------
  662|      0|          *ret_mpi = a;
  663|      0|        }
  664|      0|      else
  665|      0|        mpi_free(a);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  666|      0|      return 0;
  667|      0|    }
  668|      0|  else if (format == GCRYMPI_FMT_HEX)
  ------------------
  |  Branch (668:12): [True: 0, False: 0]
  ------------------
  669|      0|    {
  670|      0|      size_t slen;
  671|       |      /* We can only handle C strings for now.  */
  672|      0|      if (buflen)
  ------------------
  |  Branch (672:11): [True: 0, False: 0]
  ------------------
  673|      0|        return GPG_ERR_INV_ARG;
  674|       |
  675|      0|      slen = strlen ((const char *)buffer);
  676|      0|      if (slen > MAX_EXTERN_SCAN_BYTES)
  ------------------
  |  |   37|      0|#define MAX_EXTERN_SCAN_BYTES (16*1024*1024)
  ------------------
  |  Branch (676:11): [True: 0, False: 0]
  ------------------
  677|      0|	return GPG_ERR_INV_OBJ;
  678|      0|      a = secure? mpi_alloc_secure ((((slen+1)/2)+BYTES_PER_MPI_LIMB-1)
  ------------------
  |  |   98|      0|# define mpi_alloc_secure(n)  _gcry_mpi_alloc_secure((n) )
  ------------------
  |  Branch (678:11): [True: 0, False: 0]
  ------------------
  679|      0|				    /BYTES_PER_MPI_LIMB)
  680|      0|		: mpi_alloc((((slen+1)/2)+BYTES_PER_MPI_LIMB-1)
  ------------------
  |  |   97|      0|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  681|      0|			    /BYTES_PER_MPI_LIMB);
  682|      0|      if (mpi_fromstr (a, (const char *)buffer, slen))
  ------------------
  |  Branch (682:11): [True: 0, False: 0]
  ------------------
  683|      0|        {
  684|      0|          mpi_free (a);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  685|      0|          return GPG_ERR_INV_OBJ;
  686|      0|        }
  687|      0|      if (ret_mpi)
  ------------------
  |  Branch (687:11): [True: 0, False: 0]
  ------------------
  688|      0|        {
  689|      0|          mpi_normalize ( a );
  ------------------
  |  |  223|      0|#define mpi_normalize(a)       _gcry_mpi_normalize ((a))
  ------------------
  690|      0|          *ret_mpi = a;
  691|      0|	}
  692|      0|      else
  693|      0|        mpi_free(a);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  694|      0|      if (nscanned)
  ------------------
  |  Branch (694:11): [True: 0, False: 0]
  ------------------
  695|      0|        *nscanned = strlen ((const char*)buffer);
  696|      0|      return 0;
  697|      0|    }
  698|      0|  else
  699|      0|    return GPG_ERR_INV_ARG;
  700|  72.1k|}
mpicoder.c:mpi_read_from_buffer:
   50|  72.1k|{
   51|  72.1k|  int i, j;
   52|  72.1k|  unsigned int nbits, nbytes, nlimbs, nread=0;
   53|  72.1k|  mpi_limb_t a;
   54|  72.1k|  gcry_mpi_t val = MPI_NULL;
  ------------------
  |  |   78|  72.1k|#define MPI_NULL NULL
  ------------------
   55|  72.1k|  unsigned int max_nread = *ret_nread;
   56|       |
   57|  72.1k|  if ( max_nread < 2 )
  ------------------
  |  Branch (57:8): [True: 0, False: 72.1k]
  ------------------
   58|      0|    goto leave;
   59|  72.1k|  nbits = buffer[0] << 8 | buffer[1];
   60|  72.1k|  if ( nbits > MAX_EXTERN_MPI_BITS )
  ------------------
  |  |   43|  72.1k|#define MAX_EXTERN_MPI_BITS 16384
  ------------------
  |  Branch (60:8): [True: 0, False: 72.1k]
  ------------------
   61|      0|    {
   62|       |/*       log_debug ("mpi too large (%u bits)\n", nbits); */
   63|      0|      goto leave;
   64|      0|    }
   65|  72.1k|  buffer += 2;
   66|  72.1k|  nread = 2;
   67|       |
   68|  72.1k|  nbytes = (nbits+7) / 8;
   69|  72.1k|  nlimbs = (nbytes+BYTES_PER_MPI_LIMB-1) / BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|  72.1k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  72.1k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
                nlimbs = (nbytes+BYTES_PER_MPI_LIMB-1) / BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|  72.1k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  72.1k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
   70|  72.1k|  val = secure? mpi_alloc_secure (nlimbs) : mpi_alloc (nlimbs);
  ------------------
  |  |   98|      0|# define mpi_alloc_secure(n)  _gcry_mpi_alloc_secure((n) )
  ------------------
                val = secure? mpi_alloc_secure (nlimbs) : mpi_alloc (nlimbs);
  ------------------
  |  |   97|   144k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  |  Branch (70:9): [True: 0, False: 72.1k]
  ------------------
   71|  72.1k|  i = BYTES_PER_MPI_LIMB - nbytes % BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|  72.1k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  72.1k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
                i = BYTES_PER_MPI_LIMB - nbytes % BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|  72.1k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  72.1k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
   72|  72.1k|  i %= BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|  72.1k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  72.1k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
   73|  72.1k|  j= val->nlimbs = nlimbs;
   74|  72.1k|  val->sign = 0;
   75|   103k|  for ( ; j > 0; j-- )
  ------------------
  |  Branch (75:11): [True: 31.7k, False: 72.1k]
  ------------------
   76|  31.7k|    {
   77|  31.7k|      a = 0;
   78|  31.7k|      if (i == 0 && nread + BYTES_PER_MPI_LIMB <= max_nread)
  ------------------
  |  |    4|  13.4k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  13.4k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
  |  Branch (78:11): [True: 13.4k, False: 18.3k]
  |  Branch (78:21): [True: 13.4k, False: 0]
  ------------------
   79|  13.4k|	{
   80|       |#if BYTES_PER_MPI_LIMB == 4
   81|       |	  a = buf_get_be32 (buffer);
   82|       |#elif BYTES_PER_MPI_LIMB == 8
   83|  13.4k|	  a = buf_get_be64 (buffer);
   84|       |#else
   85|       |#     error please implement for this limb size.
   86|       |#endif
   87|  13.4k|	  buffer += BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|  13.4k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  13.4k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
   88|  13.4k|	  nread += BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|  13.4k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  13.4k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
   89|  13.4k|	  i += BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|  13.4k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  13.4k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
   90|  13.4k|	}
   91|  59.6k|      for (; i < BYTES_PER_MPI_LIMB; i++ )
  ------------------
  |  |    4|  59.6k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  59.6k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
  |  Branch (91:14): [True: 27.8k, False: 31.7k]
  ------------------
   92|  27.8k|        {
   93|  27.8k|          if ( ++nread > max_nread )
  ------------------
  |  Branch (93:16): [True: 0, False: 27.8k]
  ------------------
   94|      0|            {
   95|       |/*               log_debug ("mpi larger than buffer"); */
   96|      0|              mpi_free (val);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
   97|      0|              val = NULL;
   98|      0|              goto leave;
   99|      0|            }
  100|  27.8k|          a <<= 8;
  101|  27.8k|          a |= *buffer++;
  102|  27.8k|	}
  103|  31.7k|      i = 0;
  104|  31.7k|      val->d[j-1] = a;
  105|  31.7k|    }
  106|       |
  107|  72.1k| leave:
  108|  72.1k|  *ret_nread = nread;
  109|  72.1k|  return val;
  110|  72.1k|}

_gcry_mpi_init:
   67|      1|{
   68|      1|  int idx;
   69|      1|  unsigned long value;
   70|       |
   71|      7|  for (idx=0; idx < MPI_NUMBER_OF_CONSTANTS; idx++)
  ------------------
  |  |  144|      7|#define MPI_NUMBER_OF_CONSTANTS 6
  ------------------
  |  Branch (71:15): [True: 6, False: 1]
  ------------------
   72|      6|    {
   73|      6|      switch (idx)
   74|      6|        {
   75|      1|        case MPI_C_ZERO:  value = 0; break;
  ------------------
  |  Branch (75:9): [True: 1, False: 5]
  ------------------
   76|      1|        case MPI_C_ONE:   value = 1; break;
  ------------------
  |  Branch (76:9): [True: 1, False: 5]
  ------------------
   77|      1|        case MPI_C_TWO:   value = 2; break;
  ------------------
  |  Branch (77:9): [True: 1, False: 5]
  ------------------
   78|      1|        case MPI_C_THREE: value = 3; break;
  ------------------
  |  Branch (78:9): [True: 1, False: 5]
  ------------------
   79|      1|        case MPI_C_FOUR:  value = 4; break;
  ------------------
  |  Branch (79:9): [True: 1, False: 5]
  ------------------
   80|      1|        case MPI_C_EIGHT: value = 8; break;
  ------------------
  |  Branch (80:9): [True: 1, False: 5]
  ------------------
   81|      0|        default: log_bug ("invalid mpi_const selector %d\n", idx);
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  |  Branch (81:9): [True: 0, False: 6]
  ------------------
   82|      6|        }
   83|      6|      constants[idx] = mpi_alloc_set_ui (value);
  ------------------
  |  |  119|      6|#define mpi_alloc_set_ui(a)   _gcry_mpi_alloc_set_ui ((a))
  ------------------
   84|      6|      constants[idx]->flags = (16|32);
   85|      6|    }
   86|       |
   87|      1|  return 0;
   88|      1|}
_gcry_mpi_alloc:
  101|   165k|{
  102|   165k|    gcry_mpi_t a;
  103|       |
  104|   165k|    a = xmalloc( sizeof *a );
  ------------------
  |  |  144|   165k|#define xmalloc(a)       _gcry_xmalloc ((a))
  ------------------
  105|   165k|    a->d = nlimbs? mpi_alloc_limb_space( nlimbs, 0 ) : NULL;
  ------------------
  |  |  178|  20.2k|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  |  Branch (105:12): [True: 20.2k, False: 145k]
  ------------------
  106|   165k|    a->alloced = nlimbs;
  107|   165k|    a->nlimbs = 0;
  108|   165k|    a->sign = 0;
  109|   165k|    a->flags = 0;
  110|   165k|    return a;
  111|   165k|}
_gcry_mpi_alloc_limb_space:
  131|  20.2k|{
  132|  20.2k|    mpi_ptr_t p;
  133|  20.2k|    size_t len;
  134|       |
  135|  20.2k|    len = (nlimbs ? nlimbs : 1) * sizeof (mpi_limb_t);
  ------------------
  |  Branch (135:12): [True: 20.2k, False: 0]
  ------------------
  136|  20.2k|    p = secure ? xmalloc_secure (len) : xmalloc (len);
  ------------------
  |  |  146|      0|#define xmalloc_secure(a)   _gcry_xmalloc_secure ((a))
  ------------------
                  p = secure ? xmalloc_secure (len) : xmalloc (len);
  ------------------
  |  |  144|  40.4k|#define xmalloc(a)       _gcry_xmalloc ((a))
  ------------------
  |  Branch (136:9): [True: 0, False: 20.2k]
  ------------------
  137|  20.2k|    if (! nlimbs)
  ------------------
  |  Branch (137:9): [True: 0, False: 20.2k]
  ------------------
  138|      0|      *p = 0;
  139|       |
  140|  20.2k|    return p;
  141|  20.2k|}
_gcry_mpi_free_limb_space:
  145|   165k|{
  146|   165k|  if (a)
  ------------------
  |  Branch (146:7): [True: 20.2k, False: 145k]
  ------------------
  147|  20.2k|    {
  148|  20.2k|      size_t len = nlimbs * sizeof(mpi_limb_t);
  149|       |
  150|       |      /* If we have information on the number of allocated limbs, we
  151|       |         better wipe that space out.  This is a failsafe feature if
  152|       |         secure memory has been disabled or was not properly
  153|       |         implemented in user provided allocation functions. */
  154|  20.2k|      if (len)
  ------------------
  |  Branch (154:11): [True: 20.2k, False: 0]
  ------------------
  155|  20.2k|        wipememory (a, len);
  ------------------
  |  |  398|  20.2k|#define wipememory(_ptr,_len) wipememory2((_ptr),0,(_len))
  |  |  ------------------
  |  |  |  |  388|  20.2k|#define wipememory2(_ptr,_set,_len) do { \
  |  |  |  |  389|  20.2k|	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  40.4k|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  ------------------
  |  |  |  |               	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|      0|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (389:12): [True: 20.2k, False: 0]
  |  |  |  |  |  Branch (389:33): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  390|  20.2k|		if (CONSTANT_P(_set) && (_set) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  40.4k|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (87:27): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:27): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  391|  20.2k|		  _gcry_fast_wipememory((void *)(_ptr), (_len)); \
  |  |  |  |  392|  20.2k|		else \
  |  |  |  |  393|  20.2k|		  _gcry_fast_wipememory2((void *)(_ptr), (_set), (_len)); \
  |  |  |  |  394|  20.2k|	      } else { \
  |  |  |  |  395|      0|		fast_wipememory2_inline((void *)(_ptr), (_set), (_len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|      0|#define fast_wipememory2_inline(_ptr,_set,_len) do { \
  |  |  |  |  |  |  381|      0|	      memset((_ptr), (_set), (_len)); \
  |  |  |  |  |  |  382|      0|	      asm volatile ("\n" :: "r" (_ptr) : "memory"); \
  |  |  |  |  |  |  383|      0|	    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (383:14): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  396|      0|	      } \
  |  |  |  |  397|  20.2k|	    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (397:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  156|  20.2k|      xfree(a);
  ------------------
  |  |  150|  20.2k|#define xfree(a)         _gcry_free ((a))
  ------------------
  157|  20.2k|    }
  158|   165k|}
_gcry_mpi_free:
  223|   595k|{
  224|   595k|  if (!a )
  ------------------
  |  Branch (224:7): [True: 429k, False: 165k]
  ------------------
  225|   429k|    return;
  226|   165k|  if ((a->flags & 32))
  ------------------
  |  Branch (226:7): [True: 0, False: 165k]
  ------------------
  227|      0|  {
  228|      0|#if GPGRT_VERSION_NUMBER >= 0x011600  /* 1.22 */
  229|      0|    gpgrt_annotate_leaked_object(a);
  230|      0|#endif
  231|      0|    return; /* Never release a constant. */
  232|      0|  }
  233|   165k|  if ((a->flags & 4))
  ------------------
  |  Branch (233:7): [True: 93.6k, False: 72.1k]
  ------------------
  234|  93.6k|    xfree( a->d );
  ------------------
  |  |  150|  93.6k|#define xfree(a)         _gcry_free ((a))
  ------------------
  235|  72.1k|  else
  236|  72.1k|    {
  237|  72.1k|      _gcry_mpi_free_limb_space(a->d, a->alloced);
  238|  72.1k|    }
  239|       |  /* Check that the flags makes sense.  We better allow for bit 1
  240|       |     (value 2) for backward ABI compatibility.  */
  241|   165k|  if ((a->flags & ~(1|2|4|16
  ------------------
  |  Branch (241:7): [True: 0, False: 165k]
  ------------------
  242|   165k|                    |GCRYMPI_FLAG_USER1
  243|   165k|                    |GCRYMPI_FLAG_USER2
  244|   165k|                    |GCRYMPI_FLAG_USER3
  245|   165k|                    |GCRYMPI_FLAG_USER4)))
  246|      0|    log_bug("invalid flag value in mpi_free\n");
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  247|   165k|  xfree (a);
  ------------------
  |  |  150|   165k|#define xfree(a)         _gcry_free ((a))
  ------------------
  248|   165k|}
_gcry_mpi_set_opaque:
  281|  93.6k|{
  282|  93.6k|  if (!a)
  ------------------
  |  Branch (282:7): [True: 93.6k, False: 0]
  ------------------
  283|  93.6k|    a = mpi_alloc(0);
  ------------------
  |  |   97|  93.6k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  284|       |
  285|  93.6k|  if (mpi_is_immutable (a))
  ------------------
  |  |  113|  93.6k|#define mpi_is_immutable(a)   ((a)->flags&16)
  |  |  ------------------
  |  |  |  Branch (113:31): [True: 0, False: 93.6k]
  |  |  ------------------
  ------------------
  286|      0|    {
  287|      0|      mpi_immutable_failed ();
  ------------------
  |  |  110|      0|#define mpi_immutable_failed() _gcry_mpi_immutable_failed ()
  ------------------
  288|      0|      return a;
  289|      0|    }
  290|       |
  291|  93.6k|  if( a->flags & 4 )
  ------------------
  |  Branch (291:7): [True: 0, False: 93.6k]
  ------------------
  292|      0|    xfree (a->d);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  293|  93.6k|  else
  294|  93.6k|    _gcry_mpi_free_limb_space (a->d, a->alloced);
  295|       |
  296|  93.6k|  a->d = p;
  297|  93.6k|  a->alloced = 0;
  298|  93.6k|  a->nlimbs = 0;
  299|  93.6k|  a->sign  = nbits;
  300|  93.6k|  a->flags = 4 | (a->flags & (GCRYMPI_FLAG_USER1|GCRYMPI_FLAG_USER2
  301|  93.6k|                              |GCRYMPI_FLAG_USER3|GCRYMPI_FLAG_USER4));
  302|  93.6k|  if (_gcry_is_secure (a->d))
  ------------------
  |  Branch (302:7): [True: 0, False: 93.6k]
  ------------------
  303|      0|    a->flags |= 1;
  304|  93.6k|  return a;
  305|  93.6k|}
_gcry_mpi_alloc_set_ui:
  592|      6|{
  593|      6|    gcry_mpi_t w = mpi_alloc(1);
  ------------------
  |  |   97|      6|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  594|      6|    w->d[0] = u;
  595|      6|    w->nlimbs = u? 1:0;
  ------------------
  |  Branch (595:17): [True: 5, False: 1]
  ------------------
  596|      6|    w->sign = 0;
  597|      6|    return w;
  598|      6|}
_gcry_mpi_release:
  687|   595k|{
  688|   595k|    _gcry_mpi_free( a );
  689|   595k|}
_gcry_mpi_set_flag:
  721|  21.5k|{
  722|  21.5k|  switch (flag)
  723|  21.5k|    {
  724|      0|    case GCRYMPI_FLAG_SECURE:     mpi_set_secure(a); break;
  ------------------
  |  Branch (724:5): [True: 0, False: 21.5k]
  ------------------
  725|      0|    case GCRYMPI_FLAG_CONST:      a->flags |= (16|32); break;
  ------------------
  |  Branch (725:5): [True: 0, False: 21.5k]
  ------------------
  726|      0|    case GCRYMPI_FLAG_IMMUTABLE:  a->flags |= 16; break;
  ------------------
  |  Branch (726:5): [True: 0, False: 21.5k]
  ------------------
  727|       |
  728|  1.98k|    case GCRYMPI_FLAG_USER1:
  ------------------
  |  Branch (728:5): [True: 1.98k, False: 19.5k]
  ------------------
  729|  21.5k|    case GCRYMPI_FLAG_USER2:
  ------------------
  |  Branch (729:5): [True: 19.5k, False: 1.98k]
  ------------------
  730|  21.5k|    case GCRYMPI_FLAG_USER3:
  ------------------
  |  Branch (730:5): [True: 0, False: 21.5k]
  ------------------
  731|  21.5k|    case GCRYMPI_FLAG_USER4:      a->flags |= flag; break;
  ------------------
  |  Branch (731:5): [True: 0, False: 21.5k]
  ------------------
  732|       |
  733|      0|    case GCRYMPI_FLAG_OPAQUE:
  ------------------
  |  Branch (733:5): [True: 0, False: 21.5k]
  ------------------
  734|      0|    default: log_bug("invalid flag value\n");
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  |  Branch (734:5): [True: 0, False: 21.5k]
  ------------------
  735|  21.5k|    }
  736|  21.5k|}

_gcry_rngcsprng_initialize:
  317|      1|{
  318|      1|  if (!full)
  ------------------
  |  Branch (318:7): [True: 0, False: 1]
  ------------------
  319|      0|    initialize_basics ();
  320|      1|  else
  321|      1|    initialize ();
  322|      1|}
_gcry_rngcsprng_randomize:
  450|      1|{
  451|      1|  unsigned char *p;
  452|       |
  453|       |  /* Make sure we are initialized. */
  454|      1|  initialize ();
  455|       |
  456|       |  /* Handle our hack used for regression tests of Libgcrypt. */
  457|      1|  if ( quick_test && level > GCRY_STRONG_RANDOM )
  ------------------
  |  Branch (457:8): [True: 0, False: 1]
  |  Branch (457:22): [True: 0, False: 0]
  ------------------
  458|      0|    level = GCRY_STRONG_RANDOM;
  459|       |
  460|       |  /* Make sure the level is okay. */
  461|      1|  level &= 3;
  462|       |
  463|       |  /* Acquire the pool lock. */
  464|      1|  lock_pool ();
  465|       |
  466|       |  /* Update the statistics. */
  467|      1|  if (level >= GCRY_VERY_STRONG_RANDOM)
  ------------------
  |  Branch (467:7): [True: 0, False: 1]
  ------------------
  468|      0|    {
  469|      0|      rndstats.getbytes2 += length;
  470|      0|      rndstats.ngetbytes2++;
  471|      0|    }
  472|      1|  else
  473|      1|    {
  474|      1|      rndstats.getbytes1 += length;
  475|      1|      rndstats.ngetbytes1++;
  476|      1|    }
  477|       |
  478|       |  /* Read the random into the provided buffer. */
  479|      2|  for (p = buffer; length > 0;)
  ------------------
  |  Branch (479:20): [True: 1, False: 1]
  ------------------
  480|      1|    {
  481|      1|      size_t n;
  482|       |
  483|      1|      n = length > POOLSIZE? POOLSIZE : length;
  ------------------
  |  |   95|      1|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|      1|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|      1|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
                    n = length > POOLSIZE? POOLSIZE : length;
  ------------------
  |  |   95|      0|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|      0|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|      0|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
  |  Branch (483:11): [True: 0, False: 1]
  ------------------
  484|      1|      read_pool (p, n, level);
  485|      1|      length -= n;
  486|      1|      p += n;
  487|      1|    }
  488|       |
  489|       |  /* Release the pool lock. */
  490|      1|  unlock_pool ();
  491|      1|}
_gcry_rngcsprng_fast_poll:
 1296|   258k|{
 1297|   258k|  initialize_basics ();
 1298|       |
 1299|   258k|  lock_pool ();
 1300|   258k|  if (rndpool)
  ------------------
  |  Branch (1300:7): [True: 258k, False: 10]
  ------------------
 1301|   258k|    {
 1302|       |      /* Yes, we are fully initialized. */
 1303|   258k|      do_fast_random_poll ();
 1304|   258k|    }
 1305|   258k|  unlock_pool ();
 1306|   258k|}
random-csprng.c:initialize_basics:
  234|   258k|{
  235|   258k|  static int initialized;
  236|       |
  237|   258k|  if (!initialized)
  ------------------
  |  Branch (237:7): [True: 1, False: 258k]
  ------------------
  238|      1|    {
  239|      1|      initialized = 1;
  240|       |
  241|       |      /* Make sure that we are still using the values we have
  242|       |         traditionally used for the random levels.  */
  243|      1|      gcry_assert (GCRY_WEAK_RANDOM == 0
  ------------------
  |  |  188|      1|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|      2|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [Folded - Ignored]
  |  |  |  |  |  Branch (85:48): [Folded - Ignored]
  |  |  |  |  |  Branch (85:48): [Folded - Ignored]
  |  |  |  |  |  Branch (85:48): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|      1|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  244|      1|                   && GCRY_STRONG_RANDOM == 1
  245|      1|                   && GCRY_VERY_STRONG_RANDOM == 2);
  246|      1|    }
  247|   258k|}
random-csprng.c:initialize:
  277|      2|{
  278|       |  /* Although the basic initialization should have happened already,
  279|       |     we call it here to make sure that all prerequisites are met.  */
  280|      2|  initialize_basics ();
  281|       |
  282|       |  /* Now we can look the pool and complete the initialization if
  283|       |     necessary.  */
  284|      2|  lock_pool ();
  285|      2|  if (!rndpool)
  ------------------
  |  Branch (285:7): [True: 1, False: 1]
  ------------------
  286|      1|    {
  287|       |      /* The data buffer is allocated somewhat larger, so that we can
  288|       |         use this extra space (which is allocated in secure memory) as
  289|       |         a temporary hash buffer */
  290|      1|      rndpool = (secure_alloc
  ------------------
  |  Branch (290:18): [True: 0, False: 1]
  ------------------
  291|      1|                 ? xcalloc_secure (1, POOLSIZE + BLOCKLEN)
  ------------------
  |  |  147|      0|#define xcalloc_secure(a,b) _gcry_xcalloc_secure ((a),(b))
  ------------------
  292|      1|                 : xcalloc (1, POOLSIZE + BLOCKLEN));
  ------------------
  |  |  145|      1|#define xcalloc(a,b)     _gcry_xcalloc ((a),(b))
  ------------------
  293|      1|      keypool = (secure_alloc
  ------------------
  |  Branch (293:18): [True: 0, False: 1]
  ------------------
  294|      1|                 ? xcalloc_secure (1, POOLSIZE + BLOCKLEN)
  ------------------
  |  |  147|      0|#define xcalloc_secure(a,b) _gcry_xcalloc_secure ((a),(b))
  ------------------
  295|      1|                 : xcalloc (1, POOLSIZE + BLOCKLEN));
  ------------------
  |  |  145|      1|#define xcalloc(a,b)     _gcry_xcalloc ((a),(b))
  ------------------
  296|       |
  297|       |      /* Setup the slow entropy gathering function.  The code requires
  298|       |         that this function exists. */
  299|      1|      slow_gather_fnc = getfnc_gather_random ();
  300|       |
  301|       |      /* Setup the fast entropy gathering function.  */
  302|      1|      fast_gather_fnc = getfnc_fast_random_poll ();
  303|       |
  304|      1|    }
  305|      2|  unlock_pool ();
  306|      2|}
random-csprng.c:getfnc_gather_random:
 1146|      1|{
 1147|      1|  int (*fnc)(void (*)(const void*, size_t, enum random_origins),
 1148|      1|             enum random_origins, size_t, int);
 1149|       |
 1150|      1|#if USE_RNDGETENTROPY
 1151|      1|  fnc = _gcry_rndgetentropy_gather_random;
 1152|      1|  return fnc;
 1153|      0|#endif
 1154|       |
 1155|       |#if USE_RNDOLDLINUX
 1156|       |  if ( !access (NAME_OF_DEV_RANDOM, R_OK)
 1157|       |       && !access (NAME_OF_DEV_URANDOM, R_OK))
 1158|       |    {
 1159|       |      fnc = _gcry_rndoldlinux_gather_random;
 1160|       |      return fnc;
 1161|       |    }
 1162|       |#endif
 1163|       |
 1164|       |#if USE_RNDEGD
 1165|       |  if ( _gcry_rndegd_connect_socket (1) != -1 )
 1166|       |    {
 1167|       |      fnc = _gcry_rndegd_gather_random;
 1168|       |      return fnc;
 1169|       |    }
 1170|       |#endif
 1171|       |
 1172|       |#if USE_RNDUNIX
 1173|       |  fnc = _gcry_rndunix_gather_random;
 1174|       |  return fnc;
 1175|       |#endif
 1176|       |
 1177|       |#if USE_RNDW32
 1178|       |  fnc = _gcry_rndw32_gather_random;
 1179|       |  return fnc;
 1180|       |#endif
 1181|       |
 1182|       |#if USE_RNDW32CE
 1183|       |  fnc = _gcry_rndw32ce_gather_random;
 1184|       |  return fnc;
 1185|       |#endif
 1186|       |
 1187|      0|  log_fatal (_("no entropy gathering module detected\n"));
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
                log_fatal (_("no entropy gathering module detected\n"));
  ------------------
  |  |   96|      0|#define _(a)  _gcry_gettext(a)
  ------------------
 1188|       |
 1189|      0|  return NULL; /*NOTREACHED*/
 1190|      1|}
random-csprng.c:getfnc_fast_random_poll:
 1198|      1|{
 1199|       |#if USE_RNDW32
 1200|       |  return _gcry_rndw32_gather_random_fast;
 1201|       |#endif
 1202|       |#if USE_RNDW32CE
 1203|       |  return _gcry_rndw32ce_gather_random_fast;
 1204|       |#endif
 1205|      1|  return NULL;
 1206|      1|}
random-csprng.c:lock_pool:
  252|   258k|{
  253|   258k|  int err;
  254|       |
  255|   258k|  err = gpgrt_lock_lock (&pool_lock);
  256|   258k|  if (err)
  ------------------
  |  Branch (256:7): [True: 0, False: 258k]
  ------------------
  257|      0|    log_fatal ("failed to acquire the pool lock: %s\n", gpg_strerror (err));
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
  258|   258k|  pool_is_locked = 1;
  259|   258k|}
random-csprng.c:unlock_pool:
  264|   258k|{
  265|   258k|  int err;
  266|       |
  267|   258k|  pool_is_locked = 0;
  268|   258k|  err = gpgrt_lock_unlock (&pool_lock);
  269|   258k|  if (err)
  ------------------
  |  Branch (269:7): [True: 0, False: 258k]
  ------------------
  270|      0|    log_fatal ("failed to release the pool lock: %s\n", gpg_strerror (err));
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
  271|   258k|}
random-csprng.c:mix_pool:
  540|   103k|{
  541|   103k|  static unsigned char failsafe_digest[DIGESTLEN];
  542|   103k|  static int failsafe_digest_valid;
  543|       |
  544|   103k|  unsigned char *hashbuf = pool + POOLSIZE;
  ------------------
  |  |   95|   103k|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|   103k|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|   103k|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
  545|   103k|  unsigned char *p, *pend;
  546|   103k|  int i, n;
  547|   103k|  SHA1_CONTEXT md;
  548|   103k|  unsigned int nburn;
  549|       |
  550|       |#if DIGESTLEN != 20
  551|       |#error must have a digest length of 20 for SHA-1
  552|       |#endif
  553|       |
  554|   103k|  gcry_assert (pool_is_locked);
  ------------------
  |  |  188|   103k|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|   103k|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 103k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|   103k|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  555|      0|  _gcry_sha1_mixblock_init (&md);
  556|       |
  557|       |  /* pool_0 -> pool'.  */
  558|   103k|  pend = pool + POOLSIZE;
  ------------------
  |  |   95|   103k|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|   103k|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|   103k|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
  559|   103k|  memcpy (hashbuf, pend - DIGESTLEN, DIGESTLEN);
  ------------------
  |  |   89|   103k|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  ------------------
                memcpy (hashbuf, pend - DIGESTLEN, DIGESTLEN);
  ------------------
  |  |   89|   103k|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  ------------------
  560|   103k|  memcpy (hashbuf+DIGESTLEN, pool, BLOCKLEN-DIGESTLEN);
  ------------------
  |  |   89|   103k|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  ------------------
                memcpy (hashbuf+DIGESTLEN, pool, BLOCKLEN-DIGESTLEN);
  ------------------
  |  |   88|   103k|#define BLOCKLEN  64   /* Hash this amount of bytes... */
  ------------------
                memcpy (hashbuf+DIGESTLEN, pool, BLOCKLEN-DIGESTLEN);
  ------------------
  |  |   89|   103k|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  ------------------
  561|   103k|  nburn = _gcry_sha1_mixblock (&md, hashbuf);
  562|   103k|  memcpy (pool, hashbuf, DIGESTLEN);
  ------------------
  |  |   89|   103k|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  ------------------
  563|       |
  564|   103k|  if (failsafe_digest_valid && pool == rndpool)
  ------------------
  |  Branch (564:7): [True: 103k, False: 1]
  |  Branch (564:32): [True: 103k, False: 1]
  ------------------
  565|   103k|    {
  566|  2.17M|      for (i=0; i < DIGESTLEN; i++)
  ------------------
  |  |   89|  2.17M|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  ------------------
  |  Branch (566:17): [True: 2.06M, False: 103k]
  ------------------
  567|  2.06M|        pool[i] ^= failsafe_digest[i];
  568|   103k|    }
  569|       |
  570|       |  /* Loop for the remaining iterations.  */
  571|   103k|  p = pool;
  572|  3.10M|  for (n=1; n < POOLBLOCKS; n++)
  ------------------
  |  |   91|  3.10M|#define POOLBLOCKS 30
  ------------------
  |  Branch (572:13): [True: 2.99M, False: 103k]
  ------------------
  573|  2.99M|    {
  574|  2.99M|      if (p + BLOCKLEN < pend)
  ------------------
  |  |   88|  2.99M|#define BLOCKLEN  64   /* Hash this amount of bytes... */
  ------------------
  |  Branch (574:11): [True: 2.79M, False: 206k]
  ------------------
  575|  2.79M|        memcpy (hashbuf, p, BLOCKLEN);
  ------------------
  |  |   88|  2.79M|#define BLOCKLEN  64   /* Hash this amount of bytes... */
  ------------------
  576|   206k|      else
  577|   206k|        {
  578|   206k|          unsigned char *pp = p;
  579|       |
  580|  13.4M|          for (i=0; i < BLOCKLEN; i++ )
  ------------------
  |  |   88|  13.4M|#define BLOCKLEN  64   /* Hash this amount of bytes... */
  ------------------
  |  Branch (580:21): [True: 13.2M, False: 206k]
  ------------------
  581|  13.2M|            {
  582|  13.2M|              if ( pp >= pend )
  ------------------
  |  Branch (582:20): [True: 206k, False: 13.0M]
  ------------------
  583|   206k|                pp = pool;
  584|  13.2M|              hashbuf[i] = *pp++;
  585|  13.2M|	    }
  586|   206k|	}
  587|       |
  588|  2.99M|      _gcry_sha1_mixblock (&md, hashbuf);
  589|  2.99M|      p += DIGESTLEN;
  ------------------
  |  |   89|  2.99M|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  ------------------
  590|  2.99M|      memcpy (p, hashbuf, DIGESTLEN);
  ------------------
  |  |   89|  2.99M|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  ------------------
  591|  2.99M|    }
  592|       |
  593|       |  /* Our hash implementation does only leave small parts (64 bytes)
  594|       |     of the pool on the stack, so it is okay not to require secure
  595|       |     memory here.  Before we use this pool, it will be copied to the
  596|       |     help buffer anyway. */
  597|   103k|  if ( pool == rndpool)
  ------------------
  |  Branch (597:8): [True: 103k, False: 1]
  ------------------
  598|   103k|    {
  599|   103k|      _gcry_sha1_hash_buffer (failsafe_digest, pool, POOLSIZE);
  ------------------
  |  |   95|   103k|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|   103k|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|   103k|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
  600|   103k|      failsafe_digest_valid = 1;
  601|   103k|    }
  602|       |
  603|   103k|  _gcry_burn_stack (nburn);
  ------------------
  |  |  371|   103k|	do { __gcry_burn_stack (bytes); \
  |  |  372|   103k|	     __gcry_burn_stack_dummy (); } while(0)
  |  |  ------------------
  |  |  |  |  364|   103k|#define  __gcry_burn_stack_dummy() asm volatile ("":::"memory")
  |  |  ------------------
  |  |  |  Branch (372:43): [Folded - Ignored]
  |  |  ------------------
  ------------------
  604|   103k|}
random-csprng.c:read_pool:
  951|      1|{
  952|      1|  int i;
  953|      1|  unsigned long *sp, *dp;
  954|       |  /* The volatile is there to make sure the compiler does not optimize
  955|       |     the code away in case the getpid function is badly attributed.
  956|       |     Note that we keep a pid in a static variable as well as in a
  957|       |     stack based one; the latter is to detect ill behaving thread
  958|       |     libraries, ignoring the pool mutexes. */
  959|      1|  static volatile pid_t my_pid = (pid_t)(-1);
  960|      1|  volatile pid_t my_pid2;
  961|       |
  962|      1|  gcry_assert (pool_is_locked);
  ------------------
  |  |  188|      1|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|      1|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|      1|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  963|       |
  964|      1| retry:
  965|       |  /* Get our own pid, so that we can detect a fork. */
  966|      1|  my_pid2 = getpid ();
  967|      1|  if (my_pid == (pid_t)(-1))
  ------------------
  |  Branch (967:7): [True: 1, False: 0]
  ------------------
  968|      1|    my_pid = my_pid2;
  969|      1|  if ( my_pid != my_pid2 )
  ------------------
  |  Branch (969:8): [True: 0, False: 1]
  ------------------
  970|      0|    {
  971|       |      /* We detected a plain fork; i.e. we are now the child.  Update
  972|       |         the static pid and add some randomness. */
  973|      0|      pid_t x;
  974|       |
  975|      0|      my_pid = my_pid2;
  976|      0|      x = my_pid;
  977|      0|      add_randomness (&x, sizeof(x), RANDOM_ORIGIN_INIT);
  978|      0|      just_mixed = 0; /* Make sure it will get mixed. */
  979|      0|    }
  980|       |
  981|      1|  gcry_assert (pool_is_locked);
  ------------------
  |  |  188|      1|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|      1|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|      1|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  982|       |
  983|       |  /* Our code does not allow to extract more than POOLSIZE.  Better
  984|       |     check it here. */
  985|      1|  if (length > POOLSIZE)
  ------------------
  |  |   95|      1|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|      1|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|      1|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
  |  Branch (985:7): [True: 0, False: 1]
  ------------------
  986|      0|    {
  987|      0|      log_bug("too many random bits requested\n");
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  988|      0|    }
  989|       |
  990|      1|  if (!pool_filled)
  ------------------
  |  Branch (990:7): [True: 1, False: 0]
  ------------------
  991|      1|    {
  992|      1|      if (read_seed_file() )
  ------------------
  |  Branch (992:11): [True: 0, False: 1]
  ------------------
  993|      0|        pool_filled = 1;
  994|      1|    }
  995|       |
  996|       |  /* For level 2 quality (key generation) we always make sure that the
  997|       |     pool has been seeded enough initially. */
  998|      1|  if (level == GCRY_VERY_STRONG_RANDOM && !did_initial_extra_seeding)
  ------------------
  |  Branch (998:7): [True: 0, False: 1]
  |  Branch (998:43): [True: 0, False: 0]
  ------------------
  999|      0|    {
 1000|      0|      size_t needed;
 1001|       |
 1002|      0|      pool_balance = 0;
 1003|      0|      needed = length - pool_balance;
 1004|      0|      if (needed < 16)  /* At least 128 bits.  */
  ------------------
  |  Branch (1004:11): [True: 0, False: 0]
  ------------------
 1005|      0|        needed = 16;
 1006|      0|      else if( needed > POOLSIZE )
  ------------------
  |  |   95|      0|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|      0|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|      0|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
  |  Branch (1006:16): [True: 0, False: 0]
  ------------------
 1007|      0|        BUG ();
  ------------------
  |  |  187|      0|#define BUG() _gcry_bug( __FILE__ , __LINE__, __FUNCTION__ )
  ------------------
 1008|      0|      read_random_source (RANDOM_ORIGIN_EXTRAPOLL, needed,
 1009|      0|                          GCRY_VERY_STRONG_RANDOM);
 1010|      0|      pool_balance += needed;
 1011|      0|      did_initial_extra_seeding = 1;
 1012|      0|    }
 1013|       |
 1014|       |  /* For level 2 make sure that there is enough random in the pool. */
 1015|      1|  if (level == GCRY_VERY_STRONG_RANDOM && pool_balance < length)
  ------------------
  |  Branch (1015:7): [True: 0, False: 1]
  |  Branch (1015:43): [True: 0, False: 0]
  ------------------
 1016|      0|    {
 1017|      0|      size_t needed;
 1018|       |
 1019|      0|      if (pool_balance < 0)
  ------------------
  |  Branch (1019:11): [True: 0, False: 0]
  ------------------
 1020|      0|        pool_balance = 0;
 1021|      0|      needed = length - pool_balance;
 1022|      0|      if (needed > POOLSIZE)
  ------------------
  |  |   95|      0|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|      0|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|      0|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
  |  Branch (1022:11): [True: 0, False: 0]
  ------------------
 1023|      0|        BUG ();
  ------------------
  |  |  187|      0|#define BUG() _gcry_bug( __FILE__ , __LINE__, __FUNCTION__ )
  ------------------
 1024|      0|      read_random_source (RANDOM_ORIGIN_EXTRAPOLL, needed,
 1025|      0|                          GCRY_VERY_STRONG_RANDOM);
 1026|      0|      pool_balance += needed;
 1027|      0|    }
 1028|       |
 1029|       |  /* Make sure the pool is filled. */
 1030|     26|  while (!pool_filled)
  ------------------
  |  Branch (1030:10): [True: 25, False: 1]
  ------------------
 1031|     25|    random_poll();
 1032|       |
 1033|       |  /* Always do a fast random poll (we have to use the unlocked version). */
 1034|      1|  do_fast_random_poll();
 1035|       |
 1036|       |  /* Mix the pid in so that we for sure won't deliver the same random
 1037|       |     after a fork. */
 1038|      1|  {
 1039|      1|    pid_t apid = my_pid;
 1040|      1|    add_randomness (&apid, sizeof (apid), RANDOM_ORIGIN_INIT);
 1041|      1|  }
 1042|       |
 1043|       |  /* Mix the pool (if add_randomness() didn't it). */
 1044|      1|  if (!just_mixed)
  ------------------
  |  Branch (1044:7): [True: 0, False: 1]
  ------------------
 1045|      0|    {
 1046|      0|      mix_pool(rndpool);
 1047|      0|      rndstats.mixrnd++;
 1048|      0|    }
 1049|       |
 1050|       |  /* Create a new pool. */
 1051|      1|  for(i=0,dp=(unsigned long*)(void*)keypool, sp=(unsigned long*)(void*)rndpool;
 1052|     76|      i < POOLWORDS; i++, dp++, sp++ )
  ------------------
  |  |   99|     76|#define POOLWORDS (POOLSIZE / SIZEOF_UNSIGNED_LONG)
  |  |  ------------------
  |  |  |  |   95|     76|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  |  |  ------------------
  |  |  |  |  |  |   91|     76|#define POOLBLOCKS 30
  |  |  |  |  ------------------
  |  |  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  |  |  ------------------
  |  |  |  |  |  |   89|     76|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define POOLWORDS (POOLSIZE / SIZEOF_UNSIGNED_LONG)
  |  |  ------------------
  |  |  |  |  521|     76|#define SIZEOF_UNSIGNED_LONG 8
  |  |  ------------------
  ------------------
  |  Branch (1052:7): [True: 75, False: 1]
  ------------------
 1053|     75|    *dp = *sp + ADD_VALUE;
  ------------------
  |  |   80|     76|#define ADD_VALUE 0xa5a5a5a5a5a5a5a5
  ------------------
 1054|       |
 1055|       |  /* Mix both pools. */
 1056|      1|  mix_pool(rndpool); rndstats.mixrnd++;
 1057|      1|  mix_pool(keypool); rndstats.mixkey++;
 1058|       |
 1059|       |  /* Read the requested data.  We use a read pointer to read from a
 1060|       |     different position each time.  */
 1061|      9|  while (length--)
  ------------------
  |  Branch (1061:10): [True: 8, False: 1]
  ------------------
 1062|      8|    {
 1063|      8|      *buffer++ = keypool[pool_readpos++];
 1064|      8|      if (pool_readpos >= POOLSIZE)
  ------------------
  |  |   95|      8|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|      8|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|      8|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
  |  Branch (1064:11): [True: 0, False: 8]
  ------------------
 1065|      0|        pool_readpos = 0;
 1066|      8|      pool_balance--;
 1067|      8|    }
 1068|       |
 1069|      1|  if (pool_balance < 0)
  ------------------
  |  Branch (1069:7): [True: 1, False: 0]
  ------------------
 1070|      1|    pool_balance = 0;
 1071|       |
 1072|       |  /* Clear the keypool. */
 1073|      1|  memset (keypool, 0, POOLSIZE);
  ------------------
  |  |   95|      1|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|      1|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|      1|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
 1074|       |
 1075|       |  /* We need to detect whether a fork has happened.  A fork might have
 1076|       |     an identical pool and thus the child and the parent could emit
 1077|       |     the very same random number.  This test here is to detect forks
 1078|       |     in a multi-threaded process.  It does not work with all thread
 1079|       |     implementations in particular not with pthreads.  However it is
 1080|       |     good enough for GNU Pth. */
 1081|      1|  if ( getpid () != my_pid2 )
  ------------------
  |  Branch (1081:8): [True: 0, False: 1]
  ------------------
 1082|      0|    {
 1083|      0|      pid_t x = getpid();
 1084|      0|      add_randomness (&x, sizeof(x), RANDOM_ORIGIN_INIT);
 1085|      0|      just_mixed = 0; /* Make sure it will get mixed. */
 1086|      0|      my_pid = x;     /* Also update the static pid. */
 1087|      0|      goto retry;
 1088|      0|    }
 1089|      1|}
random-csprng.c:read_seed_file:
  761|      1|{
  762|      1|  int fd;
  763|      1|  struct stat sb;
  764|      1|  unsigned char buffer[POOLSIZE];
  765|      1|  int n;
  766|       |
  767|      1|  gcry_assert (pool_is_locked);
  ------------------
  |  |  188|      1|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|      1|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 1, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|      1|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  768|       |
  769|      1|  if (!seed_file_name)
  ------------------
  |  Branch (769:7): [True: 1, False: 0]
  ------------------
  770|      1|    return 0;
  771|       |
  772|       |#ifdef HAVE_DOSISH_SYSTEM
  773|       |  fd = my_open (seed_file_name, O_RDONLY | O_BINARY, 0);
  774|       |#else
  775|      0|  fd = my_open (seed_file_name, O_RDONLY, 0);
  776|      0|#endif
  777|      0|  if( fd == -1 && errno == ENOENT)
  ------------------
  |  Branch (777:7): [True: 0, False: 0]
  |  Branch (777:19): [True: 0, False: 0]
  ------------------
  778|      0|    {
  779|      0|      allow_seed_file_update = 1;
  780|      0|      return 0;
  781|      0|    }
  782|       |
  783|      0|  if (fd == -1 )
  ------------------
  |  Branch (783:7): [True: 0, False: 0]
  ------------------
  784|      0|    {
  785|      0|      log_info(_("can't open `%s': %s\n"), seed_file_name, strerror(errno) );
  ------------------
  |  |  204|      0|#define log_info    _gcry_log_info
  ------------------
                    log_info(_("can't open `%s': %s\n"), seed_file_name, strerror(errno) );
  ------------------
  |  |   96|      0|#define _(a)  _gcry_gettext(a)
  ------------------
  786|      0|      return 0;
  787|      0|    }
  788|      0|  if (lock_seed_file (fd, seed_file_name, 0))
  ------------------
  |  Branch (788:7): [True: 0, False: 0]
  ------------------
  789|      0|    {
  790|      0|      close (fd);
  791|      0|      return 0;
  792|      0|    }
  793|      0|  if (fstat( fd, &sb ) )
  ------------------
  |  Branch (793:7): [True: 0, False: 0]
  ------------------
  794|      0|    {
  795|      0|      log_info(_("can't stat `%s': %s\n"), seed_file_name, strerror(errno) );
  ------------------
  |  |  204|      0|#define log_info    _gcry_log_info
  ------------------
                    log_info(_("can't stat `%s': %s\n"), seed_file_name, strerror(errno) );
  ------------------
  |  |   96|      0|#define _(a)  _gcry_gettext(a)
  ------------------
  796|      0|      close(fd);
  797|      0|      return 0;
  798|      0|    }
  799|      0|  if (!S_ISREG(sb.st_mode) )
  ------------------
  |  Branch (799:7): [True: 0, False: 0]
  ------------------
  800|      0|    {
  801|      0|      log_info(_("`%s' is not a regular file - ignored\n"), seed_file_name );
  ------------------
  |  |  204|      0|#define log_info    _gcry_log_info
  ------------------
                    log_info(_("`%s' is not a regular file - ignored\n"), seed_file_name );
  ------------------
  |  |   96|      0|#define _(a)  _gcry_gettext(a)
  ------------------
  802|      0|      close(fd);
  803|      0|      return 0;
  804|      0|    }
  805|      0|  if (!sb.st_size )
  ------------------
  |  Branch (805:7): [True: 0, False: 0]
  ------------------
  806|      0|    {
  807|      0|      log_info(_("note: random_seed file is empty\n") );
  ------------------
  |  |  204|      0|#define log_info    _gcry_log_info
  ------------------
                    log_info(_("note: random_seed file is empty\n") );
  ------------------
  |  |   96|      0|#define _(a)  _gcry_gettext(a)
  ------------------
  808|      0|      close(fd);
  809|      0|      allow_seed_file_update = 1;
  810|      0|      return 0;
  811|      0|    }
  812|      0|  if (sb.st_size != POOLSIZE )
  ------------------
  |  |   95|      0|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|      0|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|      0|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
  |  Branch (812:7): [True: 0, False: 0]
  ------------------
  813|      0|    {
  814|      0|      log_info(_("warning: invalid size of random_seed file - not used\n") );
  ------------------
  |  |  204|      0|#define log_info    _gcry_log_info
  ------------------
                    log_info(_("warning: invalid size of random_seed file - not used\n") );
  ------------------
  |  |   96|      0|#define _(a)  _gcry_gettext(a)
  ------------------
  815|      0|      close(fd);
  816|      0|      return 0;
  817|      0|    }
  818|       |
  819|      0|  do
  820|      0|    {
  821|      0|      n = read( fd, buffer, POOLSIZE );
  ------------------
  |  |   95|      0|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|      0|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|      0|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
  822|      0|    }
  823|      0|  while (n == -1 && errno == EINTR );
  ------------------
  |  Branch (823:10): [True: 0, False: 0]
  |  Branch (823:21): [True: 0, False: 0]
  ------------------
  824|       |
  825|      0|  if (n != POOLSIZE)
  ------------------
  |  |   95|      0|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|      0|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|      0|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
  |  Branch (825:7): [True: 0, False: 0]
  ------------------
  826|      0|    {
  827|      0|      log_fatal(_("can't read `%s': %s\n"), seed_file_name,strerror(errno) );
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
                    log_fatal(_("can't read `%s': %s\n"), seed_file_name,strerror(errno) );
  ------------------
  |  |   96|      0|#define _(a)  _gcry_gettext(a)
  ------------------
  828|      0|      close(fd);/*NOTREACHED*/
  829|      0|      return 0;
  830|      0|    }
  831|       |
  832|      0|  close(fd);
  833|       |
  834|      0|  add_randomness( buffer, POOLSIZE, RANDOM_ORIGIN_INIT );
  ------------------
  |  |   95|      0|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|      0|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|      0|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
  835|       |  /* add some minor entropy to the pool now (this will also force a mixing) */
  836|      0|  {
  837|      0|    pid_t x = getpid();
  838|      0|    add_randomness( &x, sizeof(x), RANDOM_ORIGIN_INIT );
  839|      0|  }
  840|      0|  {
  841|      0|    time_t x = time(NULL);
  842|      0|    add_randomness( &x, sizeof(x), RANDOM_ORIGIN_INIT );
  843|      0|  }
  844|      0|  {
  845|      0|    clock_t x = clock();
  846|      0|    add_randomness( &x, sizeof(x), RANDOM_ORIGIN_INIT );
  847|      0|  }
  848|       |
  849|       |  /* And read a few bytes from our entropy source.  If we have the
  850|       |   * Jitter RNG we can fast get a lot of entropy.  Thus we read 1024
  851|       |   * bits from that source.
  852|       |   *
  853|       |   * Without the Jitter RNG we keep the old method of reading only a
  854|       |   * few bytes usually from /dev/urandom which won't block.  */
  855|      0|  if (_gcry_rndjent_get_version (NULL))
  ------------------
  |  Branch (855:7): [True: 0, False: 0]
  ------------------
  856|      0|    read_random_source (RANDOM_ORIGIN_INIT, 128, GCRY_STRONG_RANDOM);
  857|      0|  else
  858|      0|    read_random_source (RANDOM_ORIGIN_INIT, 32, GCRY_STRONG_RANDOM);
  859|       |
  860|      0|  allow_seed_file_update = 1;
  861|      0|  return 1;
  862|      0|}
random-csprng.c:read_random_source:
 1312|     25|{
 1313|     25|  if ( !slow_gather_fnc )
  ------------------
  |  Branch (1313:8): [True: 0, False: 25]
  ------------------
 1314|      0|    log_fatal ("Slow entropy gathering module not yet initialized\n");
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
 1315|       |
 1316|     25|  if (slow_gather_fnc (add_randomness, origin, length, level) < 0)
  ------------------
  |  Branch (1316:7): [True: 0, False: 25]
  ------------------
 1317|      0|    log_fatal ("No way to gather entropy for the RNG\n");
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
 1318|     25|}
random-csprng.c:random_poll:
 1135|     25|{
 1136|     25|  rndstats.slowpolls++;
 1137|     25|  read_random_source (RANDOM_ORIGIN_SLOWPOLL, POOLSIZE/5, GCRY_STRONG_RANDOM);
  ------------------
  |  |   95|     25|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|     25|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|     25|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
 1138|     25|}
random-csprng.c:add_randomness:
 1098|  1.55M|{
 1099|  1.55M|  const unsigned char *p = buffer;
 1100|  1.55M|  size_t count = 0;
 1101|       |
 1102|  1.55M|  gcry_assert (pool_is_locked);
  ------------------
  |  |  188|  1.55M|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|  1.55M|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 1.55M, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|  1.55M|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
 1103|       |
 1104|      0|  rndstats.addbytes += length;
 1105|  1.55M|  rndstats.naddbytes++;
 1106|  63.5M|  while (length-- )
  ------------------
  |  Branch (1106:10): [True: 62.0M, False: 1.55M]
  ------------------
 1107|  62.0M|    {
 1108|  62.0M|      rndpool[pool_writepos++] ^= *p++;
 1109|  62.0M|      count++;
 1110|  62.0M|      if (pool_writepos >= POOLSIZE )
  ------------------
  |  |   95|  62.0M|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|  62.0M|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|  62.0M|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
  |  Branch (1110:11): [True: 103k, False: 61.9M]
  ------------------
 1111|   103k|        {
 1112|       |          /* It is possible that we are invoked before the pool is
 1113|       |             filled using an unreliable origin of entropy, for example
 1114|       |             the fast random poll.  To avoid flagging the pool as
 1115|       |             filled in this case, we track the initial filling state
 1116|       |             separately.  See also the remarks about the seed file. */
 1117|   103k|          if (origin >= RANDOM_ORIGIN_SLOWPOLL && !pool_filled)
  ------------------
  |  Branch (1117:15): [True: 5, False: 103k]
  |  Branch (1117:51): [True: 5, False: 0]
  ------------------
 1118|      5|            {
 1119|      5|              pool_filled_counter += count;
 1120|      5|              count = 0;
 1121|      5|              if (pool_filled_counter >= POOLSIZE)
  ------------------
  |  |   95|      5|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|      5|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|      5|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
  |  Branch (1121:19): [True: 1, False: 4]
  ------------------
 1122|      1|                pool_filled = 1;
 1123|      5|            }
 1124|   103k|          pool_writepos = 0;
 1125|   103k|          mix_pool(rndpool); rndstats.mixrnd++;
 1126|   103k|          just_mixed = !length;
 1127|   103k|	}
 1128|  62.0M|    }
 1129|  1.55M|}
random-csprng.c:do_fast_random_poll:
 1212|   258k|{
 1213|   258k|  gcry_assert (pool_is_locked);
  ------------------
  |  |  188|   258k|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|   258k|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 258k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|   258k|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
 1214|       |
 1215|      0|  rndstats.fastpolls++;
 1216|       |
 1217|   258k|  if (fast_gather_fnc)
  ------------------
  |  Branch (1217:7): [True: 0, False: 258k]
  ------------------
 1218|      0|    fast_gather_fnc (add_randomness, RANDOM_ORIGIN_FASTPOLL);
 1219|       |
 1220|       |  /* Continue with the generic functions. */
 1221|       |#if HAVE_GETHRTIME
 1222|       |  {
 1223|       |    hrtime_t tv;
 1224|       |    tv = gethrtime();
 1225|       |    add_randomness( &tv, sizeof(tv), RANDOM_ORIGIN_FASTPOLL );
 1226|       |  }
 1227|       |#elif HAVE_GETTIMEOFDAY
 1228|   258k|  {
 1229|   258k|    struct timeval tv;
 1230|   258k|    if( gettimeofday( &tv, NULL ) )
  ------------------
  |  Branch (1230:9): [True: 0, False: 258k]
  ------------------
 1231|      0|      BUG();
  ------------------
  |  |  187|      0|#define BUG() _gcry_bug( __FILE__ , __LINE__, __FUNCTION__ )
  ------------------
 1232|   258k|    add_randomness( &tv.tv_sec, sizeof(tv.tv_sec), RANDOM_ORIGIN_FASTPOLL );
 1233|   258k|    add_randomness( &tv.tv_usec, sizeof(tv.tv_usec), RANDOM_ORIGIN_FASTPOLL );
 1234|   258k|  }
 1235|       |#elif HAVE_CLOCK_GETTIME
 1236|       |  {	struct timespec tv;
 1237|       |  if( clock_gettime( CLOCK_REALTIME, &tv ) == -1 )
 1238|       |    BUG();
 1239|       |  add_randomness( &tv.tv_sec, sizeof(tv.tv_sec), RANDOM_ORIGIN_FASTPOLL );
 1240|       |  add_randomness( &tv.tv_nsec, sizeof(tv.tv_nsec), RANDOM_ORIGIN_FASTPOLL );
 1241|       |  }
 1242|       |#else /* use times */
 1243|       |# ifndef HAVE_DOSISH_SYSTEM
 1244|       |  {	struct tms buf;
 1245|       |  times( &buf );
 1246|       |  add_randomness( &buf, sizeof buf, RANDOM_ORIGIN_FASTPOLL );
 1247|       |  }
 1248|       |# endif
 1249|       |#endif
 1250|       |
 1251|      0|#ifdef HAVE_GETRUSAGE
 1252|      0|# ifdef RUSAGE_SELF
 1253|      0|  {
 1254|   258k|    struct rusage buf;
 1255|       |    /* QNX/Neutrino does return ENOSYS - so we just ignore it and add
 1256|       |       whatever is in buf.  In a chroot environment it might not work
 1257|       |       at all (i.e. because /proc/ is not accessible), so we better
 1258|       |       ignore all error codes and hope for the best. */
 1259|   258k|    getrusage (RUSAGE_SELF, &buf );
 1260|   258k|    add_randomness( &buf, sizeof buf, RANDOM_ORIGIN_FASTPOLL );
 1261|   258k|    memset( &buf, 0, sizeof buf );
 1262|   258k|  }
 1263|       |# else /*!RUSAGE_SELF*/
 1264|       |#  ifdef __GCC__
 1265|       |#   warning There is no RUSAGE_SELF on this system
 1266|       |#  endif
 1267|       |# endif /*!RUSAGE_SELF*/
 1268|   258k|#endif /*HAVE_GETRUSAGE*/
 1269|       |
 1270|       |  /* Time and clock are available on all systems - so we better do it
 1271|       |     just in case one of the above functions didn't work.  */
 1272|   258k|  {
 1273|   258k|    time_t x = time(NULL);
 1274|   258k|    add_randomness( &x, sizeof(x), RANDOM_ORIGIN_FASTPOLL );
 1275|   258k|  }
 1276|   258k|  {
 1277|   258k|    clock_t x = clock();
 1278|   258k|    add_randomness( &x, sizeof(x), RANDOM_ORIGIN_FASTPOLL );
 1279|   258k|  }
 1280|       |
 1281|       |  /* If the system features a fast hardware RNG, read some bytes from
 1282|       |     there.  */
 1283|   258k|  _gcry_rndhw_poll_fast (add_randomness, RANDOM_ORIGIN_FASTPOLL);
 1284|   258k|}

_gcry_set_preferred_rng_type:
  166|      1|{
  167|      1|  static int any_init;
  168|       |
  169|      1|  if (!type)
  ------------------
  |  Branch (169:7): [True: 1, False: 0]
  ------------------
  170|      1|    {
  171|      1|      any_init = 1;
  172|      1|    }
  173|      0|  else if (type == GCRY_RNG_TYPE_STANDARD)
  ------------------
  |  Branch (173:12): [True: 0, False: 0]
  ------------------
  174|      0|    {
  175|      0|      rng_types.standard = 1;
  176|      0|    }
  177|      0|  else if (any_init)
  ------------------
  |  Branch (177:12): [True: 0, False: 0]
  ------------------
  178|      0|    {
  179|       |      /* After any initialization has been done we only allow to
  180|       |         upgrade to the standard RNG (handled above).  All other
  181|       |         requests are ignored.  The idea is that the application needs
  182|       |         to declare a preference for a weaker RNG as soon as possible
  183|       |         and before any library sets a preference.  We assume that a
  184|       |         library which uses Libgcrypt calls an init function very
  185|       |         early.  This way --- even if the library gets initialized
  186|       |         early by the application --- it is unlikely that it can
  187|       |         select a lower priority RNG.
  188|       |
  189|       |         This scheme helps to ensure that existing unmodified
  190|       |         applications (e.g. gpg2), which don't known about the new RNG
  191|       |         selection system, will continue to use the standard RNG and
  192|       |         not be tricked by some library to use a lower priority RNG.
  193|       |         There are some loopholes here but at least most GnuPG stuff
  194|       |         should be save because it calls src_c{gcry_control
  195|       |         (GCRYCTL_SUSPEND_SECMEM_WARN);} quite early and thus inhibits
  196|       |         switching to a low priority RNG.
  197|       |       */
  198|      0|    }
  199|      0|  else if (type == GCRY_RNG_TYPE_FIPS)
  ------------------
  |  Branch (199:12): [True: 0, False: 0]
  ------------------
  200|      0|    {
  201|      0|      rng_types.fips = 1;
  202|      0|    }
  203|      0|  else if (type == GCRY_RNG_TYPE_SYSTEM)
  ------------------
  |  Branch (203:12): [True: 0, False: 0]
  ------------------
  204|      0|    {
  205|      0|      rng_types.system = 1;
  206|      0|    }
  207|      1|}
_gcry_random_initialize:
  217|      1|{
  218|      1|  if (fips_mode ())
  ------------------
  |  |  449|      1|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  219|      0|    _gcry_rngdrbg_inititialize (full);
  220|      1|  else if (rng_types.standard)
  ------------------
  |  Branch (220:12): [True: 0, False: 1]
  ------------------
  221|      0|    _gcry_rngcsprng_initialize (full);
  222|      1|  else if (rng_types.fips)
  ------------------
  |  Branch (222:12): [True: 0, False: 1]
  ------------------
  223|      0|    _gcry_rngdrbg_inititialize (full);
  224|      1|  else if (rng_types.system)
  ------------------
  |  Branch (224:12): [True: 0, False: 1]
  ------------------
  225|      0|    _gcry_rngsystem_initialize (full);
  226|      1|  else
  227|      1|    _gcry_rngcsprng_initialize (full);
  228|      1|}
_gcry_randomize:
  395|      1|{
  396|      1|  do_randomize (buffer, length, level);
  397|      1|}
_gcry_fast_random_poll:
  447|   258k|{
  448|   258k|  if (fips_mode ())
  ------------------
  |  |  449|   258k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 258k]
  |  |  ------------------
  ------------------
  449|      0|    ; /* No need for this in fips mode.  */
  450|   258k|  else if (rng_types.standard)
  ------------------
  |  Branch (450:12): [True: 0, False: 258k]
  ------------------
  451|      0|    _gcry_rngcsprng_fast_poll ();
  452|   258k|  else if (rng_types.fips)
  ------------------
  |  Branch (452:12): [True: 0, False: 258k]
  ------------------
  453|      0|    ;
  454|   258k|  else if (rng_types.system)
  ------------------
  |  Branch (454:12): [True: 0, False: 258k]
  ------------------
  455|      0|    ;
  456|   258k|  else /* default */
  457|   258k|    _gcry_rngcsprng_fast_poll ();
  458|   258k|}
_gcry_create_nonce:
  465|      1|{
  466|      1|  static unsigned char nonce_buffer[20+8];
  467|      1|  static int nonce_buffer_initialized = 0;
  468|      1|  static volatile pid_t my_pid; /* The volatile is there to make sure the
  469|       |                                   compiler does not optimize the code away
  470|       |                                   in case the getpid function is badly
  471|       |                                   attributed. */
  472|      1|  volatile pid_t apid;
  473|      1|  unsigned char *p;
  474|      1|  size_t n;
  475|      1|  int err;
  476|       |
  477|       |  /* First check whether we shall use the FIPS nonce generator.  This
  478|       |     is only done in FIPS mode, in all other modes, we use our own
  479|       |     nonce generator which is seeded by the RNG actual in use.  */
  480|      1|  if (fips_mode ())
  ------------------
  |  |  449|      1|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  481|      0|    {
  482|      0|      _gcry_rngdrbg_randomize (buffer, length, GCRY_WEAK_RANDOM);
  483|      0|      return;
  484|      0|    }
  485|       |
  486|       |  /* This is the nonce generator, which formerly lived in
  487|       |     random-csprng.c.  It is now used by all RNG types except when in
  488|       |     FIPS mode (not that this means it is also used if the FIPS RNG
  489|       |     has been selected but we are not in fips mode).  */
  490|       |
  491|       |  /* Make sure we are initialized. */
  492|      1|  _gcry_random_initialize (1);
  493|       |
  494|       |  /* Acquire the nonce buffer lock. */
  495|      1|  err = gpgrt_lock_lock (&nonce_buffer_lock);
  496|      1|  if (err)
  ------------------
  |  Branch (496:7): [True: 0, False: 1]
  ------------------
  497|      0|    log_fatal ("failed to acquire the nonce buffer lock: %s\n",
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
  498|      0|               gpg_strerror (err));
  499|       |
  500|      1|  apid = getpid ();
  501|       |  /* The first time initialize our buffer. */
  502|      1|  if (!nonce_buffer_initialized)
  ------------------
  |  Branch (502:7): [True: 1, False: 0]
  ------------------
  503|      1|    {
  504|      1|      time_t atime = time (NULL);
  505|      1|      pid_t xpid = apid;
  506|       |
  507|      1|      my_pid = apid;
  508|       |
  509|      1|      if ((sizeof apid + sizeof atime) > sizeof nonce_buffer)
  ------------------
  |  Branch (509:11): [Folded - Ignored]
  ------------------
  510|      0|        BUG ();
  ------------------
  |  |  187|      0|#define BUG() _gcry_bug( __FILE__ , __LINE__, __FUNCTION__ )
  ------------------
  511|       |
  512|       |      /* Initialize the first 20 bytes with a reasonable value so that
  513|       |         a failure of gcry_randomize won't affect us too much.  Don't
  514|       |         care about the uninitialized remaining bytes. */
  515|      1|      p = nonce_buffer;
  516|      1|      memcpy (p, &xpid, sizeof xpid);
  517|      1|      p += sizeof xpid;
  518|      1|      memcpy (p, &atime, sizeof atime);
  519|       |
  520|       |      /* Initialize the never changing private part of 64 bits. */
  521|      1|      _gcry_randomize (nonce_buffer+20, 8, GCRY_WEAK_RANDOM);
  522|       |
  523|      1|      nonce_buffer_initialized = 1;
  524|      1|    }
  525|      0|  else if ( my_pid != apid )
  ------------------
  |  Branch (525:13): [True: 0, False: 0]
  ------------------
  526|      0|    {
  527|       |      /* We forked. Need to reseed the buffer - doing this for the
  528|       |         private part should be sufficient. */
  529|      0|      do_randomize (nonce_buffer+20, 8, GCRY_WEAK_RANDOM);
  530|       |      /* Update the pid so that we won't run into here again and
  531|       |         again. */
  532|      0|      my_pid = apid;
  533|      0|    }
  534|       |
  535|       |  /* Create the nonce by hashing the entire buffer, returning the hash
  536|       |     and updating the first 20 bytes of the buffer with this hash. */
  537|      2|  for (p = buffer; length > 0; length -= n, p += n)
  ------------------
  |  Branch (537:20): [True: 1, False: 1]
  ------------------
  538|      1|    {
  539|      1|      _gcry_sha1_hash_buffer (nonce_buffer,
  540|      1|                              nonce_buffer, sizeof nonce_buffer);
  541|      1|      n = length > 20? 20 : length;
  ------------------
  |  Branch (541:11): [True: 0, False: 1]
  ------------------
  542|      1|      memcpy (p, nonce_buffer, n);
  543|      1|    }
  544|       |
  545|       |  /* Release the nonce buffer lock. */
  546|      1|  err = gpgrt_lock_unlock (&nonce_buffer_lock);
  547|      1|  if (err)
  ------------------
  |  Branch (547:7): [True: 0, False: 1]
  ------------------
  548|      0|    log_fatal ("failed to release the nonce buffer lock: %s\n",
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
  549|      0|               gpg_strerror (err));
  550|      1|}
random.c:do_randomize:
  344|      1|{
  345|      1|  if (fips_mode ())
  ------------------
  |  |  449|      1|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  346|      0|    _gcry_rngdrbg_randomize (buffer, length, level);
  347|      1|  else if (rng_types.standard)
  ------------------
  |  Branch (347:12): [True: 0, False: 1]
  ------------------
  348|      0|    _gcry_rngcsprng_randomize (buffer, length, level);
  349|      1|  else if (rng_types.fips)
  ------------------
  |  Branch (349:12): [True: 0, False: 1]
  ------------------
  350|      0|    _gcry_rngdrbg_randomize (buffer, length, level);
  351|      1|  else if (rng_types.system)
  ------------------
  |  Branch (351:12): [True: 0, False: 1]
  ------------------
  352|      0|    _gcry_rngsystem_randomize (buffer, length, level);
  353|      1|  else /* default */
  354|      1|    _gcry_rngcsprng_randomize (buffer, length, level);
  355|      1|}

_gcry_rndgetentropy_gather_random:
   44|     25|{
   45|     25|  byte buffer[256];
   46|       |
   47|     25|  if (!add)
  ------------------
  |  Branch (47:7): [True: 0, False: 25]
  ------------------
   48|      0|    {
   49|       |      /* Special mode to release resouces.  */
   50|      0|      _gcry_rndjent_fini ();
   51|      0|      return 0;
   52|      0|    }
   53|       |
   54|       |  /* When using a blocking random generator try to get some entropy
   55|       |   * from the jitter based RNG.  In this case we take up to 50% of the
   56|       |   * remaining requested bytes.  */
   57|     25|  if (level >= GCRY_VERY_STRONG_RANDOM)
  ------------------
  |  Branch (57:7): [True: 0, False: 25]
  ------------------
   58|      0|    {
   59|      0|      size_t n;
   60|       |
   61|      0|      n = _gcry_rndjent_poll (add, origin, length/2);
   62|      0|      if (n > length/2)
  ------------------
  |  Branch (62:11): [True: 0, False: 0]
  ------------------
   63|      0|        n = length/2;
   64|      0|      if (length > 1)
  ------------------
  |  Branch (64:11): [True: 0, False: 0]
  ------------------
   65|      0|        length -= n;
   66|      0|    }
   67|       |
   68|       |  /* Enter the loop.  */
   69|     50|  while (length)
  ------------------
  |  Branch (69:10): [True: 25, False: 25]
  ------------------
   70|     25|    {
   71|     25|      int ret;
   72|     25|      size_t nbytes;
   73|       |
   74|       |      /* For a modern operating system, we use the new getentropy
   75|       |       * function.  That call guarantees that the kernel's RNG has
   76|       |       * been properly seeded before returning any data.  This is
   77|       |       * different from /dev/urandom which may, due to its
   78|       |       * non-blocking semantics, return data even if the kernel has
   79|       |       * not been properly seeded.  And it differs from /dev/random by
   80|       |       * never blocking once the kernel is seeded.  */
   81|     25|      do
   82|     25|        {
   83|     25|          _gcry_pre_syscall ();
   84|     25|          if (fips_mode ())
  ------------------
  |  |  449|     25|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 25]
  |  |  ------------------
  ------------------
   85|      0|            {
   86|       |              /* DRBG chaining defined in SP 800-90A (rev 1) specify
   87|       |               * the upstream (kernel) DRBG needs to be reseeded for
   88|       |               * initialization of downstream (libgcrypt) DRBG. For this
   89|       |               * in RHEL, we repurposed the GRND_RANDOM flag of getrandom API.
   90|       |               * The libgcrypt DRBG is initialized with 48B of entropy, but
   91|       |               * the kernel can provide only 32B at a time after reseeding
   92|       |               * so we need to limit our requests to 32B here.
   93|       |               * This is clarified in IG 7.19 / IG D.K. for FIPS 140-2 / 3
   94|       |               * and might not be applicable on other FIPS modules not running
   95|       |               * RHEL kernel.
   96|       |               */
   97|      0|              nbytes = length < 32 ? length : 32;
  ------------------
  |  Branch (97:24): [True: 0, False: 0]
  ------------------
   98|      0|              ret = getrandom (buffer, nbytes, GRND_RANDOM);
   99|      0|            }
  100|     25|          else
  101|     25|            {
  102|     25|              nbytes = length < sizeof (buffer) ? length : sizeof (buffer);
  ------------------
  |  Branch (102:24): [True: 25, False: 0]
  ------------------
  103|     25|              ret = getentropy (buffer, nbytes);
  104|     25|            }
  105|     25|          _gcry_post_syscall ();
  106|     25|        }
  107|     25|      while (ret == -1 && errno == EINTR);
  ------------------
  |  Branch (107:14): [True: 0, False: 25]
  |  Branch (107:27): [True: 0, False: 0]
  ------------------
  108|       |
  109|     25|      if (ret == -1 && errno == ENOSYS)
  ------------------
  |  Branch (109:11): [True: 0, False: 25]
  |  Branch (109:24): [True: 0, False: 0]
  ------------------
  110|      0|        log_fatal ("getentropy is not supported: %s\n", strerror (errno));
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
  111|     25|      else
  112|     25|        { /* getentropy is supported.  Some sanity checks.  */
  113|     25|          if (ret == -1)
  ------------------
  |  Branch (113:15): [True: 0, False: 25]
  ------------------
  114|      0|            log_fatal ("unexpected error from getentropy: %s\n",
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
  115|      0|                       strerror (errno));
  116|       |
  117|     25|          (*add) (buffer, nbytes, origin);
  118|     25|          length -= nbytes;
  119|     25|        }
  120|     25|    }
  121|     25|  wipememory (buffer, sizeof buffer);
  ------------------
  |  |  398|     25|#define wipememory(_ptr,_len) wipememory2((_ptr),0,(_len))
  |  |  ------------------
  |  |  |  |  388|     25|#define wipememory2(_ptr,_set,_len) do { \
  |  |  |  |  389|     25|	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|     50|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  ------------------
  |  |  |  |               	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|      0|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (389:12): [Folded - Ignored]
  |  |  |  |  |  Branch (389:33): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  390|      0|		if (CONSTANT_P(_set) && (_set) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|      0|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (87:27): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:27): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  391|      0|		  _gcry_fast_wipememory((void *)(_ptr), (_len)); \
  |  |  |  |  392|      0|		else \
  |  |  |  |  393|      0|		  _gcry_fast_wipememory2((void *)(_ptr), (_set), (_len)); \
  |  |  |  |  394|     25|	      } else { \
  |  |  |  |  395|     25|		fast_wipememory2_inline((void *)(_ptr), (_set), (_len)); \
  |  |  |  |  ------------------
  |  |  |  |  |  |  380|     25|#define fast_wipememory2_inline(_ptr,_set,_len) do { \
  |  |  |  |  |  |  381|     25|	      memset((_ptr), (_set), (_len)); \
  |  |  |  |  |  |  382|     25|	      asm volatile ("\n" :: "r" (_ptr) : "memory"); \
  |  |  |  |  |  |  383|     25|	    } while(0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (383:14): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  396|     25|	      } \
  |  |  |  |  397|     25|	    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (397:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  122|       |
  123|     25|  return 0; /* success */
  124|     25|}

_gcry_rndhw_poll_fast:
  185|   258k|{
  186|   258k|  (void)add;
  187|   258k|  (void)origin;
  188|       |
  189|   258k|#ifdef USE_DRNG
  190|   258k|  if ((_gcry_get_hw_features () & HWF_INTEL_RDRAND))
  ------------------
  |  |  233|   258k|#define HWF_INTEL_RDRAND        (1 << 11)
  ------------------
  |  Branch (190:7): [True: 258k, False: 0]
  ------------------
  191|   258k|    poll_drng (add, origin, 1);
  192|   258k|#endif
  193|   258k|#ifdef USE_PADLOCK
  194|   258k|  if ((_gcry_get_hw_features () & HWF_PADLOCK_RNG))
  ------------------
  |  |  221|   258k|#define HWF_PADLOCK_RNG         (1 << 0)
  ------------------
  |  Branch (194:7): [True: 0, False: 258k]
  ------------------
  195|      0|    poll_padlock (add, origin, 1);
  196|   258k|#endif
  197|   258k|}
rndhw.c:poll_drng:
  159|   258k|{
  160|   258k|  volatile unsigned long buffer[8] __attribute__ ((aligned (8)));
  161|   258k|  unsigned int nbytes = sizeof (buffer);
  162|       |
  163|   258k|  (void)fast;
  164|       |
  165|   258k|  if (!rdrand_nlong (buffer, DIM(buffer)))
  ------------------
  |  |  104|   258k|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (165:7): [True: 0, False: 258k]
  ------------------
  166|      0|    return 0;
  167|   258k|  (*add)((void *)buffer, nbytes, origin);
  168|   258k|  return nbytes;
  169|   258k|}
rndhw.c:rdrand_nlong:
  149|   258k|{
  150|  2.32M|  while (count--)
  ------------------
  |  Branch (150:10): [True: 2.06M, False: 258k]
  ------------------
  151|  2.06M|    if (!rdrand_long(v++))
  ------------------
  |  Branch (151:9): [True: 0, False: 2.06M]
  ------------------
  152|      0|      return 0;
  153|   258k|  return 1;
  154|   258k|}
rndhw.c:rdrand_long:
  133|  2.06M|{
  134|  2.06M|  int ok;
  135|  2.06M|  asm volatile ("1: " RDRAND_LONG "\n\t"
  136|  2.06M|                "jc 2f\n\t"
  137|  2.06M|                "decl %0\n\t"
  138|  2.06M|                "jnz 1b\n\t"
  139|  2.06M|                "2:"
  140|  2.06M|                : "=r" (ok), "=a" (*v)
  141|  2.06M|                : "0" (RDRAND_RETRY_LOOPS)
  ------------------
  |  |  124|  2.06M|# define RDRAND_RETRY_LOOPS	10
  ------------------
  142|  2.06M|                : "cc", "memory");
  143|  2.06M|  return ok;
  144|  2.06M|}

_gcry_initialize_fips_mode:
  165|      1|{
  166|      1|  static int done;
  167|      1|  gpg_error_t err;
  168|       |
  169|       |  /* Make sure we are not accidentally called twice.  */
  170|      1|  if (done)
  ------------------
  |  Branch (170:7): [True: 0, False: 1]
  ------------------
  171|      0|    {
  172|      0|      if ( fips_mode () )
  ------------------
  |  |  449|      0|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  173|      0|        {
  174|      0|          fips_new_state (STATE_FATALERROR);
  175|      0|          fips_noreturn ();
  ------------------
  |  |  489|      0|#define fips_noreturn()  (_gcry_fips_noreturn ())
  ------------------
  176|      0|        }
  177|       |      /* If not in fips mode an assert is sufficient.  */
  178|      0|      gcry_assert (!done);
  ------------------
  |  |  188|      0|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|      0|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|      0|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  179|      0|    }
  180|      0|  done = 1;
  181|       |
  182|       |  /* If the calling application explicitly requested fipsmode, do so.  */
  183|      1|  if (force)
  ------------------
  |  Branch (183:7): [True: 0, False: 1]
  ------------------
  184|      0|    {
  185|      0|      gcry_assert (!_gcry_no_fips_mode_required);
  ------------------
  |  |  188|      0|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|      0|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|      0|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  186|      0|      goto leave;
  187|      0|    }
  188|       |
  189|       |  /* If the system explicitly requested fipsmode, do so.  */
  190|      1|  if (check_fips_system_setting ())
  ------------------
  |  Branch (190:7): [True: 0, False: 1]
  ------------------
  191|      0|    {
  192|      0|      gcry_assert (!_gcry_no_fips_mode_required);
  ------------------
  |  |  188|      0|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|      0|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|      0|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  193|      0|      goto leave;
  194|      0|    }
  195|       |
  196|       |  /* Fips not not requested, set flag.  */
  197|      1|  _gcry_no_fips_mode_required = 1;
  198|       |
  199|      1| leave:
  200|      1|  if (!_gcry_no_fips_mode_required)
  ------------------
  |  Branch (200:7): [True: 0, False: 1]
  ------------------
  201|      0|    {
  202|       |      /* Yes, we are in FIPS mode.  */
  203|       |
  204|       |      /* Intitialize the lock to protect the FSM.  */
  205|      0|      err = gpgrt_lock_init (&fsm_lock);
  206|      0|      if (err)
  ------------------
  |  Branch (206:11): [True: 0, False: 0]
  ------------------
  207|      0|        {
  208|       |          /* If that fails we can't do anything but abort the
  209|       |             process. We need to use log_info so that the FSM won't
  210|       |             get involved.  */
  211|      0|          log_info ("FATAL: failed to create the FSM lock in libgcrypt: %s\n",
  ------------------
  |  |  204|      0|#define log_info    _gcry_log_info
  ------------------
  212|      0|                    gpg_strerror (err));
  213|      0|#ifdef HAVE_SYSLOG
  214|      0|          syslog (LOG_USER|LOG_ERR, "Libgcrypt error: "
  215|      0|                  "creating FSM lock failed: %s - abort",
  216|      0|                  gpg_strerror (err));
  217|      0|#endif /*HAVE_SYSLOG*/
  218|      0|          abort ();
  219|      0|        }
  220|       |
  221|       |      /* Now get us into the INIT state.  */
  222|      0|      fips_new_state (STATE_INIT);
  223|      0|    }
  224|       |
  225|      1|  return;
  226|      1|}
_gcry_fips_is_operational:
  290|      1|{
  291|      1|  int result;
  292|       |
  293|      1|  if (!fips_mode ())
  ------------------
  |  |  449|      1|#define fips_mode() (!_gcry_no_fips_mode_required)
  ------------------
  |  Branch (293:7): [True: 1, False: 0]
  ------------------
  294|      1|    result = 1;
  295|      0|  else
  296|      0|    {
  297|      0|      lock_fsm ();
  298|      0|      if (current_state == STATE_INIT)
  ------------------
  |  Branch (298:11): [True: 0, False: 0]
  ------------------
  299|      0|        {
  300|       |          /* If we are still in the INIT state, we need to run the
  301|       |             selftests so that the FSM can eventually get into
  302|       |             operational state.  Given that we would need a 2-phase
  303|       |             initialization of libgcrypt, but that has traditionally
  304|       |             not been enforced, we use this on demand self-test
  305|       |             checking.  Note that Proper applications would do the
  306|       |             application specific libgcrypt initialization between a
  307|       |             gcry_check_version() and gcry_control
  308|       |             (GCRYCTL_INITIALIZATION_FINISHED) where the latter will
  309|       |             run the selftests.  The drawback of these on-demand
  310|       |             self-tests are a small chance that self-tests are
  311|       |             performed by several threads; that is no problem because
  312|       |             our FSM make sure that we won't oversee any error. */
  313|      0|          unlock_fsm ();
  314|      0|          _gcry_fips_run_selftests (0);
  315|       |
  316|       |          /* Release resources for random.  */
  317|      0|          _gcry_random_close_fds ();
  318|      0|          lock_fsm ();
  319|      0|        }
  320|       |
  321|      0|      result = (current_state == STATE_OPERATIONAL);
  322|      0|      unlock_fsm ();
  323|      0|    }
  324|      1|  return result;
  325|      1|}
fips.c:check_fips_system_setting:
   95|      1|{
   96|       |  /* Do we have the environment variable set?  */
   97|      1|  if (getenv ("LIBGCRYPT_FORCE_FIPS_MODE"))
  ------------------
  |  Branch (97:7): [True: 0, False: 1]
  ------------------
   98|      0|    return 1;
   99|       |
  100|       |  /* For testing the system it is useful to override the system
  101|       |     provided detection of the FIPS mode and force FIPS mode using a
  102|       |     file.  The filename is hardwired so that there won't be any
  103|       |     confusion on whether /etc/gcrypt/ or /usr/local/etc/gcrypt/ is
  104|       |     actually used.  The file itself may be empty.  */
  105|      1|  if ( !access (FIPS_FORCE_FILE, F_OK) )
  ------------------
  |  |   37|      1|#define FIPS_FORCE_FILE "/etc/gcrypt/fips_enabled"
  ------------------
  |  Branch (105:8): [True: 0, False: 1]
  ------------------
  106|      0|    return 1;
  107|       |
  108|       |  /* Checking based on /proc file properties.  */
  109|      1|  {
  110|      1|    static const char procfname[] = "/proc/sys/crypto/fips_enabled";
  111|      1|    FILE *fp;
  112|      1|    int saved_errno;
  113|       |
  114|      1|    fp = fopen (procfname, "r");
  115|      1|    if (fp)
  ------------------
  |  Branch (115:9): [True: 1, False: 0]
  ------------------
  116|      1|      {
  117|      1|        char line[256];
  118|       |
  119|      1|        if (fgets (line, sizeof line, fp) && atoi (line))
  ------------------
  |  Branch (119:13): [True: 1, False: 0]
  |  Branch (119:46): [True: 0, False: 1]
  ------------------
  120|      0|          {
  121|       |            /* System is in fips mode.  */
  122|      0|            fclose (fp);
  123|      0|            return 1;
  124|      0|          }
  125|      1|        fclose (fp);
  126|      1|      }
  127|      0|    else if ((saved_errno = errno) != ENOENT
  ------------------
  |  Branch (127:14): [True: 0, False: 0]
  ------------------
  128|      0|             && saved_errno != EACCES
  ------------------
  |  Branch (128:17): [True: 0, False: 0]
  ------------------
  129|      0|             && !access ("/proc/version", F_OK) )
  ------------------
  |  Branch (129:17): [True: 0, False: 0]
  ------------------
  130|      0|      {
  131|       |        /* Problem reading the fips file despite that we have the proc
  132|       |           file system.  We better stop right away. */
  133|      0|        log_info ("FATAL: error reading `%s' in libgcrypt: %s\n",
  ------------------
  |  |  204|      0|#define log_info    _gcry_log_info
  ------------------
  134|      0|                  procfname, strerror (saved_errno));
  135|      0|#ifdef HAVE_SYSLOG
  136|      0|        syslog (LOG_USER|LOG_ERR, "Libgcrypt error: "
  137|      0|                "reading `%s' failed: %s - abort",
  138|      0|                procfname, strerror (saved_errno));
  139|      0|#endif /*HAVE_SYSLOG*/
  140|      0|        abort ();
  141|      0|      }
  142|      1|  }
  143|       |
  144|      1|  return 0;
  145|      1|}

_gcry_global_is_operational:
  182|      1|{
  183|      1|  if (!_gcry_global_any_init_done)
  ------------------
  |  Branch (183:7): [True: 1, False: 0]
  ------------------
  184|      1|    {
  185|      1|#ifdef HAVE_SYSLOG
  186|      1|      syslog (LOG_USER|LOG_WARNING, "Libgcrypt warning: "
  187|      1|              "missing initialization - please fix the application");
  188|      1|#endif /*HAVE_SYSLOG*/
  189|      1|      global_init ();
  190|      1|    }
  191|      1|  return _gcry_fips_is_operational ();
  192|      1|}
_gcry_malloc:
 1009|  3.23M|{
 1010|  3.23M|  void *mem = NULL;
 1011|       |
 1012|  3.23M|  do_malloc (n, 0, &mem);
 1013|       |
 1014|  3.23M|  return mem;
 1015|  3.23M|}
_gcry_is_secure:
 1036|   269k|{
 1037|   269k|  if (no_secure_memory)
  ------------------
  |  Branch (1037:7): [True: 0, False: 269k]
  ------------------
 1038|      0|    return 0;
 1039|   269k|  if (is_secure_func)
  ------------------
  |  Branch (1039:7): [True: 0, False: 269k]
  ------------------
 1040|      0|    return is_secure_func (a) ;
 1041|   269k|  return _gcry_private_is_secure (a);
 1042|   269k|}
_gcry_free:
 1078|  5.25M|{
 1079|  5.25M|  int save_errno;
 1080|       |
 1081|  5.25M|  if (!p)
  ------------------
  |  Branch (1081:7): [True: 2.05M, False: 3.20M]
  ------------------
 1082|  2.05M|    return;
 1083|       |
 1084|       |  /* In case ERRNO is set we better save it so that the free machinery
 1085|       |     may not accidentally change ERRNO.  We restore it only if it was
 1086|       |     already set to comply with the usual C semantic for ERRNO.  */
 1087|  3.20M|  save_errno = errno;
 1088|  3.20M|  if (free_func)
  ------------------
  |  Branch (1088:7): [True: 0, False: 3.20M]
  ------------------
 1089|      0|    free_func (p);
 1090|  3.20M|  else
 1091|  3.20M|    _gcry_private_free (p);
 1092|       |
 1093|  3.20M|  if (save_errno && save_errno != errno)
  ------------------
  |  Branch (1093:7): [True: 3.20M, False: 7]
  |  Branch (1093:21): [True: 0, False: 3.20M]
  ------------------
 1094|      0|    gpg_err_set_errno (save_errno);
 1095|  3.20M|}
_gcry_calloc:
 1099|  53.5k|{
 1100|  53.5k|  size_t bytes;
 1101|  53.5k|  void *p;
 1102|       |
 1103|  53.5k|  bytes = n * m; /* size_t is unsigned so the behavior on overflow is
 1104|       |                    defined. */
 1105|  53.5k|  if (m && bytes / m != n)
  ------------------
  |  Branch (1105:7): [True: 53.5k, False: 0]
  |  Branch (1105:12): [True: 0, False: 53.5k]
  ------------------
 1106|      0|    {
 1107|      0|      gpg_err_set_errno (ENOMEM);
 1108|      0|      return NULL;
 1109|      0|    }
 1110|       |
 1111|  53.5k|  p = _gcry_malloc (bytes);
 1112|  53.5k|  if (p)
  ------------------
  |  Branch (1112:7): [True: 53.5k, False: 0]
  ------------------
 1113|  53.5k|    memset (p, 0, bytes);
 1114|  53.5k|  return p;
 1115|  53.5k|}
_gcry_strdup:
 1163|    331|{
 1164|    331|  return _gcry_strdup_core (string, 0);
 1165|    331|}
_gcry_xmalloc:
 1169|  2.52M|{
 1170|  2.52M|  void *p;
 1171|       |
 1172|  2.52M|  while ( !(p = _gcry_malloc( n )) )
  ------------------
  |  Branch (1172:11): [True: 0, False: 2.52M]
  ------------------
 1173|      0|    {
 1174|      0|      if ( fips_mode ()
  ------------------
  |  |  449|      0|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1175|      0|           || !outofcore_handler
  ------------------
  |  Branch (1175:15): [True: 0, False: 0]
  ------------------
 1176|      0|           || !outofcore_handler (outofcore_handler_value, n, 0) )
  ------------------
  |  Branch (1176:15): [True: 0, False: 0]
  ------------------
 1177|      0|        {
 1178|      0|          _gcry_fatal_error (gpg_err_code_from_errno (errno), NULL);
 1179|      0|        }
 1180|      0|    }
 1181|  2.52M|    return p;
 1182|  2.52M|}
_gcry_xrealloc:
 1186|  47.4k|{
 1187|  47.4k|  void *p;
 1188|       |
 1189|  47.4k|  while (!(p = _gcry_realloc_core (a, n, 1)))
  ------------------
  |  Branch (1189:10): [True: 0, False: 47.4k]
  ------------------
 1190|      0|    {
 1191|      0|      if ( fips_mode ()
  ------------------
  |  |  449|      0|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1192|      0|           || !outofcore_handler
  ------------------
  |  Branch (1192:15): [True: 0, False: 0]
  ------------------
 1193|      0|           || !outofcore_handler (outofcore_handler_value, n,
  ------------------
  |  Branch (1193:15): [True: 0, False: 0]
  ------------------
 1194|      0|                                  _gcry_is_secure(a)? 3:2))
  ------------------
  |  Branch (1194:35): [True: 0, False: 0]
  ------------------
 1195|      0|        {
 1196|      0|          _gcry_fatal_error (gpg_err_code_from_errno (errno), NULL );
 1197|      0|	}
 1198|      0|    }
 1199|  47.4k|    return p;
 1200|  47.4k|}
_gcry_xcalloc:
 1223|   822k|{
 1224|   822k|  size_t nbytes;
 1225|   822k|  void *p;
 1226|       |
 1227|   822k|  nbytes = n * m;
 1228|   822k|  if (m && nbytes / m != n)
  ------------------
  |  Branch (1228:7): [True: 822k, False: 0]
  |  Branch (1228:12): [True: 0, False: 822k]
  ------------------
 1229|      0|    {
 1230|      0|      gpg_err_set_errno (ENOMEM);
 1231|      0|      _gcry_fatal_error(gpg_err_code_from_errno (errno), NULL );
 1232|      0|    }
 1233|       |
 1234|   822k|  p = _gcry_xmalloc ( nbytes );
 1235|   822k|  memset ( p, 0, nbytes );
 1236|   822k|  return p;
 1237|   822k|}
_gcry_xstrdup:
 1259|   103k|{
 1260|   103k|  char *p;
 1261|       |
 1262|   103k|  while ( !(p = _gcry_strdup_core (string, 1)) )
  ------------------
  |  Branch (1262:11): [True: 0, False: 103k]
  ------------------
 1263|      0|    {
 1264|      0|      size_t n = strlen (string);
 1265|      0|      int is_sec = !!_gcry_is_secure (string);
 1266|       |
 1267|      0|      if (fips_mode ()
  ------------------
  |  |  449|      0|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1268|      0|          || !outofcore_handler
  ------------------
  |  Branch (1268:14): [True: 0, False: 0]
  ------------------
 1269|      0|          || !outofcore_handler (outofcore_handler_value, n, is_sec) )
  ------------------
  |  Branch (1269:14): [True: 0, False: 0]
  ------------------
 1270|      0|        {
 1271|      0|          _gcry_fatal_error (gpg_err_code_from_errno (errno),
 1272|      0|                             is_sec? _("out of core in secure memory"):NULL);
  ------------------
  |  |   96|      0|#define _(a)  _gcry_gettext(a)
  ------------------
  |  Branch (1272:30): [True: 0, False: 0]
  ------------------
 1273|      0|	}
 1274|      0|    }
 1275|       |
 1276|   103k|  return p;
 1277|   103k|}
_gcry_pre_syscall:
 1283|     25|{
 1284|     25|  if (pre_syscall_func)
  ------------------
  |  Branch (1284:7): [True: 0, False: 25]
  ------------------
 1285|      0|    pre_syscall_func ();
 1286|     25|}
_gcry_post_syscall:
 1292|     25|{
 1293|     25|  if (post_syscall_func)
  ------------------
  |  Branch (1293:7): [True: 0, False: 25]
  ------------------
 1294|      0|    post_syscall_func ();
 1295|     25|}
global.c:global_init:
   91|      1|{
   92|      1|  gcry_error_t err = 0;
   93|       |
   94|      1|  if (_gcry_global_any_init_done)
  ------------------
  |  Branch (94:7): [True: 0, False: 1]
  ------------------
   95|      0|    return;
   96|      1|  _gcry_global_any_init_done = 1;
   97|       |
   98|       |  /* Tell the random module that we have seen an init call.  */
   99|      1|  _gcry_set_preferred_rng_type (0);
  100|       |
  101|       |  /* Get the system call clamp functions.  */
  102|      1|  if (!pre_syscall_func)
  ------------------
  |  Branch (102:7): [True: 1, False: 0]
  ------------------
  103|      1|    gpgrt_get_syscall_clamp (&pre_syscall_func, &post_syscall_func);
  104|       |
  105|       |  /* See whether the system is in FIPS mode.  This needs to come as
  106|       |     early as possible but after ATH has been initialized.  */
  107|      1|  _gcry_initialize_fips_mode (force_fips_mode);
  108|       |
  109|       |  /* Before we do any other initialization we need to test available
  110|       |     hardware features.  */
  111|      1|  _gcry_detect_hw_features ();
  112|       |
  113|       |  /* Initialize the modules - this is mainly allocating some memory and
  114|       |     creating mutexes.  */
  115|      1|  err = _gcry_cipher_init ();
  116|      1|  if (err)
  ------------------
  |  Branch (116:7): [True: 0, False: 1]
  ------------------
  117|      0|    goto fail;
  118|      1|  err = _gcry_md_init ();
  119|      1|  if (err)
  ------------------
  |  Branch (119:7): [True: 0, False: 1]
  ------------------
  120|      0|    goto fail;
  121|      1|  err = _gcry_mac_init ();
  122|      1|  if (err)
  ------------------
  |  Branch (122:7): [True: 0, False: 1]
  ------------------
  123|      0|    goto fail;
  124|      1|  err = _gcry_pk_init ();
  125|      1|  if (err)
  ------------------
  |  Branch (125:7): [True: 0, False: 1]
  ------------------
  126|      0|    goto fail;
  127|      1|  err = _gcry_primegen_init ();
  128|      1|  if (err)
  ------------------
  |  Branch (128:7): [True: 0, False: 1]
  ------------------
  129|      0|    goto fail;
  130|      1|  err = _gcry_secmem_module_init ();
  131|      1|  if (err)
  ------------------
  |  Branch (131:7): [True: 0, False: 1]
  ------------------
  132|      0|    goto fail;
  133|      1|  err = _gcry_mpi_init ();
  134|      1|  if (err)
  ------------------
  |  Branch (134:7): [True: 0, False: 1]
  ------------------
  135|      0|    goto fail;
  136|       |
  137|      1|  return;
  138|       |
  139|      1| fail:
  140|      0|  BUG ();
  ------------------
  |  |  187|      0|#define BUG() _gcry_bug( __FILE__ , __LINE__, __FUNCTION__ )
  ------------------
  141|      1|}
global.c:do_malloc:
  974|  3.23M|{
  975|  3.23M|  gcry_err_code_t err = 0;
  976|  3.23M|  void *m;
  977|       |
  978|  3.23M|  if ((flags & GCRY_ALLOC_FLAG_SECURE) && !no_secure_memory)
  ------------------
  |  |  423|  3.23M|#define GCRY_ALLOC_FLAG_SECURE (1 << 0)
  ------------------
  |  Branch (978:7): [True: 0, False: 3.23M]
  |  Branch (978:43): [True: 0, False: 0]
  ------------------
  979|      0|    {
  980|      0|      if (alloc_secure_func)
  ------------------
  |  Branch (980:11): [True: 0, False: 0]
  ------------------
  981|      0|	m = (*alloc_secure_func) (n);
  982|      0|      else
  983|      0|	m = _gcry_private_malloc_secure (n, !!(flags & GCRY_ALLOC_FLAG_XHINT));
  ------------------
  |  |  424|      0|#define GCRY_ALLOC_FLAG_XHINT  (1 << 1)  /* Called from xmalloc.  */
  ------------------
  984|      0|    }
  985|  3.23M|  else
  986|  3.23M|    {
  987|  3.23M|      if (alloc_func)
  ------------------
  |  Branch (987:11): [True: 0, False: 3.23M]
  ------------------
  988|      0|	m = (*alloc_func) (n);
  989|  3.23M|      else
  990|  3.23M|	m = _gcry_private_malloc (n);
  991|  3.23M|    }
  992|       |
  993|  3.23M|  if (!m)
  ------------------
  |  Branch (993:7): [True: 31.5k, False: 3.20M]
  ------------------
  994|  31.5k|    {
  995|       |      /* Make sure that ERRNO has been set in case a user supplied
  996|       |         memory handler didn't it correctly. */
  997|  31.5k|      if (!errno)
  ------------------
  |  Branch (997:11): [True: 0, False: 31.5k]
  ------------------
  998|      0|        gpg_err_set_errno (ENOMEM);
  999|  31.5k|      err = gpg_err_code_from_errno (errno);
 1000|  31.5k|    }
 1001|  3.20M|  else
 1002|  3.20M|    *mem = m;
 1003|       |
 1004|  3.23M|  return err;
 1005|  3.23M|}
global.c:_gcry_realloc_core:
 1046|  47.4k|{
 1047|  47.4k|  void *p;
 1048|       |
 1049|       |  /* To avoid problems with non-standard realloc implementations and
 1050|       |     our own secmem_realloc, we divert to malloc and free here.  */
 1051|  47.4k|  if (!a)
  ------------------
  |  Branch (1051:7): [True: 10.0k, False: 37.3k]
  ------------------
 1052|  10.0k|    return _gcry_malloc (n);
 1053|  37.3k|  if (!n)
  ------------------
  |  Branch (1053:7): [True: 0, False: 37.3k]
  ------------------
 1054|      0|    {
 1055|      0|      xfree (a);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1056|      0|      return NULL;
 1057|      0|    }
 1058|       |
 1059|  37.3k|  if (realloc_func)
  ------------------
  |  Branch (1059:7): [True: 0, False: 37.3k]
  ------------------
 1060|      0|    p = realloc_func (a, n);
 1061|  37.3k|  else
 1062|  37.3k|    p =  _gcry_private_realloc (a, n, xhint);
 1063|  37.3k|  if (!p && !errno)
  ------------------
  |  Branch (1063:7): [True: 0, False: 37.3k]
  |  Branch (1063:13): [True: 0, False: 0]
  ------------------
 1064|      0|    gpg_err_set_errno (ENOMEM);
 1065|  37.3k|  return p;
 1066|  37.3k|}
global.c:_gcry_strdup_core:
 1140|   103k|{
 1141|   103k|  char *string_cp = NULL;
 1142|   103k|  size_t string_n = 0;
 1143|       |
 1144|   103k|  string_n = strlen (string);
 1145|       |
 1146|   103k|  if (_gcry_is_secure (string))
  ------------------
  |  Branch (1146:7): [True: 0, False: 103k]
  ------------------
 1147|      0|    string_cp = _gcry_malloc_secure_core (string_n + 1, xhint);
 1148|   103k|  else
 1149|   103k|    string_cp = _gcry_malloc (string_n + 1);
 1150|       |
 1151|   103k|  if (string_cp)
  ------------------
  |  Branch (1151:7): [True: 103k, False: 0]
  ------------------
 1152|   103k|    strcpy (string_cp, string);
 1153|       |
 1154|   103k|  return string_cp;
 1155|   103k|}

_gcry_hwf_detect_x86:
  465|      1|{
  466|      1|#if defined (HAS_X86_CPUID)
  467|      1|  return detect_x86_gnuc ();
  468|       |#else
  469|       |  return 0;
  470|       |#endif
  471|      1|}
hwf-x86.c:detect_x86_gnuc:
  177|      1|{
  178|      1|  union
  179|      1|  {
  180|      1|    char c[12+1];
  181|      1|    unsigned int ui[3];
  182|      1|  } vendor_id;
  183|      1|  unsigned int features, features2;
  184|      1|  unsigned int os_supports_avx_avx2_registers = 0;
  185|      1|  unsigned int os_supports_avx512_registers = 0;
  186|      1|  unsigned int max_cpuid_level;
  187|      1|  unsigned int fms, family, model;
  188|      1|  unsigned int result = 0;
  189|      1|  unsigned int avoid_vpgather = 0;
  190|      1|  unsigned int is_amd_cpu = 0;
  191|       |
  192|      1|  (void)os_supports_avx_avx2_registers;
  193|      1|  (void)os_supports_avx512_registers;
  194|       |
  195|      1|  if (!is_cpuid_available())
  ------------------
  |  Branch (195:7): [True: 0, False: 1]
  ------------------
  196|      0|    return 0;
  197|       |
  198|      1|  get_cpuid(0, &max_cpuid_level, &vendor_id.ui[0], &vendor_id.ui[2],
  199|      1|            &vendor_id.ui[1]);
  200|      1|  vendor_id.c[12] = 0;
  201|       |
  202|      1|  if (0)
  ------------------
  |  Branch (202:7): [Folded - Ignored]
  ------------------
  203|      0|    ; /* Just to make "else if" and ifdef macros look pretty.  */
  204|      1|#ifdef ENABLE_PADLOCK_SUPPORT
  205|      1|  else if (!strcmp (vendor_id.c, "CentaurHauls"))
  ------------------
  |  Branch (205:12): [True: 0, False: 1]
  ------------------
  206|      0|    {
  207|       |      /* This is a VIA CPU.  Check what PadLock features we have.  */
  208|       |
  209|       |      /* Check for extended centaur (EAX).  */
  210|      0|      get_cpuid(0xC0000000, &features, NULL, NULL, NULL);
  211|       |
  212|       |      /* Has extended centaur features? */
  213|      0|      if (features > 0xC0000000)
  ------------------
  |  Branch (213:11): [True: 0, False: 0]
  ------------------
  214|      0|        {
  215|       |           /* Ask for the extended feature flags (EDX). */
  216|      0|           get_cpuid(0xC0000001, NULL, NULL, NULL, &features);
  217|       |
  218|       |           /* Test bits 2 and 3 to see whether the RNG exists and is enabled. */
  219|      0|           if ((features & 0x0C) == 0x0C)
  ------------------
  |  Branch (219:16): [True: 0, False: 0]
  ------------------
  220|      0|             result |= HWF_PADLOCK_RNG;
  ------------------
  |  |  221|      0|#define HWF_PADLOCK_RNG         (1 << 0)
  ------------------
  221|       |
  222|       |           /* Test bits 6 and 7 to see whether the ACE exists and is enabled. */
  223|      0|           if ((features & 0xC0) == 0xC0)
  ------------------
  |  Branch (223:16): [True: 0, False: 0]
  ------------------
  224|      0|             result |= HWF_PADLOCK_AES;
  ------------------
  |  |  222|      0|#define HWF_PADLOCK_AES         (1 << 1)
  ------------------
  225|       |
  226|       |           /* Test bits 10 and 11 to see whether the PHE exists and is
  227|       |              enabled.  */
  228|      0|           if ((features & 0xC00) == 0xC00)
  ------------------
  |  Branch (228:16): [True: 0, False: 0]
  ------------------
  229|      0|             result |= HWF_PADLOCK_SHA;
  ------------------
  |  |  223|      0|#define HWF_PADLOCK_SHA         (1 << 2)
  ------------------
  230|       |
  231|       |           /* Test bits 12 and 13 to see whether the MONTMUL exists and is
  232|       |              enabled.  */
  233|      0|           if ((features & 0x3000) == 0x3000)
  ------------------
  |  Branch (233:16): [True: 0, False: 0]
  ------------------
  234|      0|             result |= HWF_PADLOCK_MMUL;
  ------------------
  |  |  224|      0|#define HWF_PADLOCK_MMUL        (1 << 3)
  ------------------
  235|      0|        }
  236|      0|    }
  237|      1|#endif /*ENABLE_PADLOCK_SUPPORT*/
  238|      1|  else if (!strcmp (vendor_id.c, "GenuineIntel"))
  ------------------
  |  Branch (238:12): [True: 1, False: 0]
  ------------------
  239|      1|    {
  240|       |      /* This is an Intel CPU.  */
  241|      1|      result |= HWF_INTEL_CPU;
  ------------------
  |  |  226|      1|#define HWF_INTEL_CPU           (1 << 4)
  ------------------
  242|      1|    }
  243|      0|  else if (!strcmp (vendor_id.c, "AuthenticAMD"))
  ------------------
  |  Branch (243:12): [True: 0, False: 0]
  ------------------
  244|      0|    {
  245|       |      /* This is an AMD CPU.  */
  246|      0|      is_amd_cpu = 1;
  247|      0|    }
  248|       |
  249|       |  /* Detect Intel features, that might also be supported by other
  250|       |     vendors.  */
  251|       |
  252|       |  /* Get CPU family/model/stepping (EAX) and Intel feature flags (ECX, EDX).  */
  253|      1|  get_cpuid(1, &fms, NULL, &features, &features2);
  254|       |
  255|      1|  family = ((fms & 0xf00) >> 8) + ((fms & 0xff00000) >> 20);
  256|      1|  model = ((fms & 0xf0) >> 4) + ((fms & 0xf0000) >> 12);
  257|       |
  258|      1|#ifdef ENABLE_PCLMUL_SUPPORT
  259|       |  /* Test bit 1 for PCLMUL.  */
  260|      1|  if (features & 0x00000002)
  ------------------
  |  Branch (260:7): [True: 1, False: 0]
  ------------------
  261|      1|     result |= HWF_INTEL_PCLMUL;
  ------------------
  |  |  231|      1|#define HWF_INTEL_PCLMUL        (1 << 9)
  ------------------
  262|      1|#endif
  263|       |  /* Test bit 9 for SSSE3.  */
  264|      1|  if (features & 0x00000200)
  ------------------
  |  Branch (264:7): [True: 1, False: 0]
  ------------------
  265|      1|     result |= HWF_INTEL_SSSE3;
  ------------------
  |  |  229|      1|#define HWF_INTEL_SSSE3         (1 << 7)
  ------------------
  266|       |  /* Test bit 19 for SSE4.1.  */
  267|      1|  if (features & 0x00080000)
  ------------------
  |  Branch (267:7): [True: 1, False: 0]
  ------------------
  268|      1|     result |= HWF_INTEL_SSE4_1;
  ------------------
  |  |  230|      1|#define HWF_INTEL_SSE4_1        (1 << 8)
  ------------------
  269|      1|#ifdef ENABLE_AESNI_SUPPORT
  270|       |  /* Test bit 25 for AES-NI.  */
  271|      1|  if (features & 0x02000000)
  ------------------
  |  Branch (271:7): [True: 1, False: 0]
  ------------------
  272|      1|     result |= HWF_INTEL_AESNI;
  ------------------
  |  |  232|      1|#define HWF_INTEL_AESNI         (1 << 10)
  ------------------
  273|      1|#endif /*ENABLE_AESNI_SUPPORT*/
  274|      1|#if defined(ENABLE_AVX_SUPPORT) || defined(ENABLE_AVX2_SUPPORT) \
  275|      1|    || defined(ENABLE_AVX512_SUPPORT)
  276|       |  /* Test bit 27 for OSXSAVE (required for AVX/AVX2/AVX512).  */
  277|      1|  if (features & 0x08000000)
  ------------------
  |  Branch (277:7): [True: 1, False: 0]
  ------------------
  278|      1|    {
  279|      1|      unsigned int xmm_ymm_mask = (1 << 2) | (1 << 1);
  280|      1|      unsigned int zmm15_ymm31_k7_mask = (1 << 7) | (1 << 6) | (1 << 5);
  281|      1|      unsigned int xgetbv = get_xgetbv();
  282|       |
  283|       |      /* Check that OS has enabled both XMM and YMM state support.  */
  284|      1|      if ((xgetbv & xmm_ymm_mask) == xmm_ymm_mask)
  ------------------
  |  Branch (284:11): [True: 1, False: 0]
  ------------------
  285|      1|        os_supports_avx_avx2_registers = 1;
  286|       |
  287|       |      /* Check that OS has enabled full AVX512 state support.  */
  288|      1|      if ((xgetbv & zmm15_ymm31_k7_mask) == zmm15_ymm31_k7_mask)
  ------------------
  |  Branch (288:11): [True: 0, False: 1]
  ------------------
  289|      0|        os_supports_avx512_registers = 1;
  290|      1|    }
  291|      1|#endif
  292|      1|#ifdef ENABLE_AVX_SUPPORT
  293|       |  /* Test bit 28 for AVX.  */
  294|      1|  if (features & 0x10000000)
  ------------------
  |  Branch (294:7): [True: 1, False: 0]
  ------------------
  295|      1|    if (os_supports_avx_avx2_registers)
  ------------------
  |  Branch (295:9): [True: 1, False: 0]
  ------------------
  296|      1|      result |= HWF_INTEL_AVX;
  ------------------
  |  |  234|      1|#define HWF_INTEL_AVX           (1 << 12)
  ------------------
  297|      1|#endif /*ENABLE_AVX_SUPPORT*/
  298|      1|#ifdef ENABLE_DRNG_SUPPORT
  299|       |  /* Test bit 30 for RDRAND.  */
  300|      1|  if (features & 0x40000000)
  ------------------
  |  Branch (300:7): [True: 1, False: 0]
  ------------------
  301|      1|     result |= HWF_INTEL_RDRAND;
  ------------------
  |  |  233|      1|#define HWF_INTEL_RDRAND        (1 << 11)
  ------------------
  302|      1|#endif /*ENABLE_DRNG_SUPPORT*/
  303|       |
  304|       |  /* Test bit 4 of EDX for TSC.  */
  305|      1|  if (features2 & 0x00000010)
  ------------------
  |  Branch (305:7): [True: 1, False: 0]
  ------------------
  306|      1|    result |= HWF_INTEL_RDTSC;
  ------------------
  |  |  237|      1|#define HWF_INTEL_RDTSC         (1 << 15)
  ------------------
  307|       |
  308|       |  /* Check additional Intel feature flags.  Early Intel P5 processors report
  309|       |   * too high max_cpuid_level, so don't check level 7 if processor does not
  310|       |   * support SSE3 (as cpuid:7 contains only features for newer processors).
  311|       |   * Source: http://www.sandpile.org/x86/cpuid.htm  */
  312|      1|  if (max_cpuid_level >= 7 && (features & 0x00000001))
  ------------------
  |  Branch (312:7): [True: 1, False: 0]
  |  Branch (312:31): [True: 1, False: 0]
  ------------------
  313|      1|    {
  314|       |      /* Get CPUID:7 contains further Intel feature flags. */
  315|      1|      get_cpuid(7, NULL, &features, &features2, NULL);
  316|       |
  317|       |      /* Test bit 8 for BMI2.  */
  318|      1|      if (features & 0x00000100)
  ------------------
  |  Branch (318:11): [True: 1, False: 0]
  ------------------
  319|      1|          result |= HWF_INTEL_BMI2;
  ------------------
  |  |  228|      1|#define HWF_INTEL_BMI2          (1 << 6)
  ------------------
  320|       |
  321|      1|#ifdef ENABLE_AVX2_SUPPORT
  322|       |      /* Test bit 5 for AVX2.  */
  323|      1|      if (features & 0x00000020)
  ------------------
  |  Branch (323:11): [True: 1, False: 0]
  ------------------
  324|      1|        if (os_supports_avx_avx2_registers)
  ------------------
  |  Branch (324:13): [True: 1, False: 0]
  ------------------
  325|      1|          result |= HWF_INTEL_AVX2;
  ------------------
  |  |  235|      1|#define HWF_INTEL_AVX2          (1 << 13)
  ------------------
  326|      1|#endif /*ENABLE_AVX_SUPPORT*/
  327|       |
  328|       |      /* Test bit 29 for SHA Extensions. */
  329|      1|      if (features & (1 << 29))
  ------------------
  |  Branch (329:11): [True: 0, False: 1]
  ------------------
  330|      0|        result |= HWF_INTEL_SHAEXT;
  ------------------
  |  |  238|      0|#define HWF_INTEL_SHAEXT        (1 << 16)
  ------------------
  331|       |
  332|      1|#if defined(ENABLE_AVX2_SUPPORT) && defined(ENABLE_AESNI_SUPPORT) && \
  333|      1|    defined(ENABLE_PCLMUL_SUPPORT)
  334|       |      /* Test features2 bit 9 for VAES and features2 bit 10 for VPCLMULDQD */
  335|      1|      if ((features2 & 0x00000200) && (features2 & 0x00000400))
  ------------------
  |  Branch (335:11): [True: 0, False: 1]
  |  Branch (335:39): [True: 0, False: 0]
  ------------------
  336|      0|        result |= HWF_INTEL_VAES_VPCLMUL;
  ------------------
  |  |  239|      0|#define HWF_INTEL_VAES_VPCLMUL  (1 << 17)
  ------------------
  337|      1|#endif
  338|       |
  339|      1|#ifdef ENABLE_AVX512_SUPPORT
  340|       |      /* Test for AVX512 features. List of features is selected so that
  341|       |       * supporting CPUs are new enough not to suffer from reduced clock
  342|       |       * frequencies when AVX512 is used, which was issue on early AVX512
  343|       |       * capable CPUs.
  344|       |       *  - AVX512F (features bit 16)
  345|       |       *  - AVX512DQ (features bit 17)
  346|       |       *  - AVX512IFMA (features bit 21)
  347|       |       *  - AVX512CD (features bit 28)
  348|       |       *  - AVX512BW (features bit 30)
  349|       |       *  - AVX512VL (features bit 31)
  350|       |       *  - AVX512_VBMI (features2 bit 1)
  351|       |       *  - AVX512_VBMI2 (features2 bit 6)
  352|       |       *  - AVX512_VNNI (features2 bit 11)
  353|       |       *  - AVX512_BITALG (features2 bit 12)
  354|       |       *  - AVX512_VPOPCNTDQ (features2 bit 14)
  355|       |       */
  356|      1|      if (os_supports_avx512_registers
  ------------------
  |  Branch (356:11): [True: 0, False: 1]
  ------------------
  357|      1|	  && (features & (1 << 16))
  ------------------
  |  Branch (357:7): [True: 0, False: 0]
  ------------------
  358|      1|	  && (features & (1 << 17))
  ------------------
  |  Branch (358:7): [True: 0, False: 0]
  ------------------
  359|      1|	  && (features & (1 << 21))
  ------------------
  |  Branch (359:7): [True: 0, False: 0]
  ------------------
  360|      1|	  && (features & (1 << 28))
  ------------------
  |  Branch (360:7): [True: 0, False: 0]
  ------------------
  361|      1|	  && (features & (1 << 30))
  ------------------
  |  Branch (361:7): [True: 0, False: 0]
  ------------------
  362|      1|	  && (features & (1U << 31))
  ------------------
  |  Branch (362:7): [True: 0, False: 0]
  ------------------
  363|      1|	  && (features2 & (1 << 1))
  ------------------
  |  Branch (363:7): [True: 0, False: 0]
  ------------------
  364|      1|	  && (features2 & (1 << 6))
  ------------------
  |  Branch (364:7): [True: 0, False: 0]
  ------------------
  365|      1|	  && (features2 & (1 << 11))
  ------------------
  |  Branch (365:7): [True: 0, False: 0]
  ------------------
  366|      1|	  && (features2 & (1 << 12))
  ------------------
  |  Branch (366:7): [True: 0, False: 0]
  ------------------
  367|      1|	  && (features2 & (1 << 14)))
  ------------------
  |  Branch (367:7): [True: 0, False: 0]
  ------------------
  368|      0|	result |= HWF_INTEL_AVX512;
  ------------------
  |  |  240|      0|#define HWF_INTEL_AVX512        (1 << 18)
  ------------------
  369|      1|#endif
  370|       |
  371|       |      /* Test features2 bit 6 for GFNI (Galois field new instructions).
  372|       |       * These instructions are available for SSE/AVX/AVX2/AVX512. */
  373|      1|      if (features2 & (1 << 6))
  ------------------
  |  Branch (373:11): [True: 0, False: 1]
  ------------------
  374|      0|        result |= HWF_INTEL_GFNI;
  ------------------
  |  |  241|      0|#define HWF_INTEL_GFNI          (1 << 19)
  ------------------
  375|      1|    }
  376|       |
  377|      1|  if ((result & HWF_INTEL_CPU) && family == 6)
  ------------------
  |  |  226|      1|#define HWF_INTEL_CPU           (1 << 4)
  ------------------
  |  Branch (377:7): [True: 1, False: 0]
  |  Branch (377:35): [True: 1, False: 0]
  ------------------
  378|      1|    {
  379|       |      /* These Intel Core processor models have SHLD/SHRD instruction that
  380|       |       * can do integer rotation faster actual ROL/ROR instructions. */
  381|      1|      switch (model)
  ------------------
  |  Branch (381:15): [True: 0, False: 1]
  ------------------
  382|      1|	{
  383|      0|	case 0x2A:
  ------------------
  |  Branch (383:2): [True: 0, False: 1]
  ------------------
  384|      0|	case 0x2D:
  ------------------
  |  Branch (384:2): [True: 0, False: 1]
  ------------------
  385|      0|	case 0x3A:
  ------------------
  |  Branch (385:2): [True: 0, False: 1]
  ------------------
  386|      0|	case 0x3C:
  ------------------
  |  Branch (386:2): [True: 0, False: 1]
  ------------------
  387|      0|	case 0x3F:
  ------------------
  |  Branch (387:2): [True: 0, False: 1]
  ------------------
  388|      0|	case 0x45:
  ------------------
  |  Branch (388:2): [True: 0, False: 1]
  ------------------
  389|      0|	case 0x46:
  ------------------
  |  Branch (389:2): [True: 0, False: 1]
  ------------------
  390|      0|	case 0x3D:
  ------------------
  |  Branch (390:2): [True: 0, False: 1]
  ------------------
  391|      1|	case 0x4F:
  ------------------
  |  Branch (391:2): [True: 1, False: 0]
  ------------------
  392|      1|	case 0x56:
  ------------------
  |  Branch (392:2): [True: 0, False: 1]
  ------------------
  393|      1|	case 0x47:
  ------------------
  |  Branch (393:2): [True: 0, False: 1]
  ------------------
  394|      1|	case 0x4E:
  ------------------
  |  Branch (394:2): [True: 0, False: 1]
  ------------------
  395|      1|	case 0x5E:
  ------------------
  |  Branch (395:2): [True: 0, False: 1]
  ------------------
  396|      1|	case 0x8E:
  ------------------
  |  Branch (396:2): [True: 0, False: 1]
  ------------------
  397|      1|	case 0x9E:
  ------------------
  |  Branch (397:2): [True: 0, False: 1]
  ------------------
  398|      1|	case 0x55:
  ------------------
  |  Branch (398:2): [True: 0, False: 1]
  ------------------
  399|      1|	case 0x66:
  ------------------
  |  Branch (399:2): [True: 0, False: 1]
  ------------------
  400|      1|	  result |= HWF_INTEL_FAST_SHLD;
  ------------------
  |  |  227|      1|#define HWF_INTEL_FAST_SHLD     (1 << 5)
  ------------------
  401|      1|	  break;
  402|      1|	}
  403|       |
  404|       |      /* These Intel Core processors that have AVX2 have slow VPGATHER and
  405|       |       * should be avoided for table-lookup use. */
  406|      1|      switch (model)
  ------------------
  |  Branch (406:15): [True: 1, False: 0]
  ------------------
  407|      1|	{
  408|      0|	case 0x3C:
  ------------------
  |  Branch (408:2): [True: 0, False: 1]
  ------------------
  409|      0|	case 0x3F:
  ------------------
  |  Branch (409:2): [True: 0, False: 1]
  ------------------
  410|      0|	case 0x45:
  ------------------
  |  Branch (410:2): [True: 0, False: 1]
  ------------------
  411|      0|	case 0x46:
  ------------------
  |  Branch (411:2): [True: 0, False: 1]
  ------------------
  412|       |	  /* Haswell */
  413|      0|	  avoid_vpgather |= 1;
  414|      0|	  break;
  415|      1|	}
  416|      1|    }
  417|      0|  else if (is_amd_cpu)
  ------------------
  |  Branch (417:12): [True: 0, False: 0]
  ------------------
  418|      0|    {
  419|       |      /* Non-AVX512 AMD CPUs (pre-Zen4) have slow VPGATHER and should be
  420|       |       * avoided for table-lookup use. */
  421|      0|      avoid_vpgather |= !(result & HWF_INTEL_AVX512);
  ------------------
  |  |  240|      0|#define HWF_INTEL_AVX512        (1 << 18)
  ------------------
  422|      0|    }
  423|      0|  else
  424|      0|    {
  425|       |      /* Avoid VPGATHER for non-Intel/non-AMD CPUs as testing is needed to
  426|       |       * make sure it is fast enough. */
  427|      0|      avoid_vpgather |= 1;
  428|      0|    }
  429|       |
  430|       |#ifdef ENABLE_FORCE_SOFT_HWFEATURES
  431|       |  /* Soft HW features mark functionality that is available on all systems
  432|       |   * but not feasible to use because of slow HW implementation. */
  433|       |
  434|       |  /* Some implementations are disabled for non-Intel CPUs. Mark
  435|       |   * current CPU as Intel one to enable those implementations. */
  436|       |  result |= HWF_INTEL_CPU;
  437|       |
  438|       |  /* SHLD is faster at rotating register than actual ROR/ROL instructions
  439|       |   * on older Intel systems (~sandy-bridge era). However, SHLD is very
  440|       |   * slow on almost anything else and later Intel processors have faster
  441|       |   * ROR/ROL. Therefore in regular build HWF_INTEL_FAST_SHLD is enabled
  442|       |   * only for those Intel processors that benefit from the SHLD
  443|       |   * instruction. Enabled here unconditionally as requested. */
  444|       |  result |= HWF_INTEL_FAST_SHLD;
  445|       |
  446|       |  /* VPGATHER instructions are used for look-up table based
  447|       |   * implementations which require VPGATHER to be fast enough to beat
  448|       |   * regular parallelized look-up table implementations (see Twofish).
  449|       |   * So far, only Intel processors beginning with Skylake and AMD
  450|       |   * processors starting with Zen4 have had VPGATHER fast enough to be
  451|       |   * enabled. Enable VPGATHER here unconditionally as requested. */
  452|       |  avoid_vpgather = 0;
  453|       |#endif
  454|       |
  455|      1|  if ((result & HWF_INTEL_AVX2) && !avoid_vpgather)
  ------------------
  |  |  235|      1|#define HWF_INTEL_AVX2          (1 << 13)
  ------------------
  |  Branch (455:7): [True: 1, False: 0]
  |  Branch (455:36): [True: 1, False: 0]
  ------------------
  456|      1|    result |= HWF_INTEL_FAST_VPGATHER;
  ------------------
  |  |  236|      1|#define HWF_INTEL_FAST_VPGATHER (1 << 14)
  ------------------
  457|       |
  458|      1|  return result;
  459|      1|}
hwf-x86.c:is_cpuid_available:
  128|      1|{
  129|      1|  return 1;
  130|      1|}
hwf-x86.c:get_cpuid:
  135|      3|{
  136|      3|  unsigned int regs[4];
  137|       |
  138|      3|  asm volatile
  139|      3|    ("cpuid\n\t"
  140|      3|     : "=a" (regs[0]), "=b" (regs[1]), "=c" (regs[2]), "=d" (regs[3])
  141|      3|     : "0" (in), "1" (0), "2" (0), "3" (0)
  142|      3|     : "cc"
  143|      3|     );
  144|       |
  145|      3|  if (eax)
  ------------------
  |  Branch (145:7): [True: 2, False: 1]
  ------------------
  146|      2|    *eax = regs[0];
  147|      3|  if (ebx)
  ------------------
  |  Branch (147:7): [True: 2, False: 1]
  ------------------
  148|      2|    *ebx = regs[1];
  149|      3|  if (ecx)
  ------------------
  |  Branch (149:7): [True: 3, False: 0]
  ------------------
  150|      3|    *ecx = regs[2];
  151|      3|  if (edx)
  ------------------
  |  Branch (151:7): [True: 2, False: 1]
  ------------------
  152|      2|    *edx = regs[3];
  153|      3|}
hwf-x86.c:get_xgetbv:
  158|      1|{
  159|      1|  unsigned int t_eax, t_edx;
  160|       |
  161|      1|  asm volatile
  162|      1|    ("xgetbv\n\t"
  163|      1|     : "=a" (t_eax), "=d" (t_edx)
  164|      1|     : "c" (0)
  165|      1|    );
  166|       |
  167|      1|  return t_eax;
  168|      1|}

_gcry_get_hw_features:
  148|   840k|{
  149|   840k|  return hw_features;
  150|   840k|}
_gcry_detect_hw_features:
  227|      1|{
  228|      1|  hw_features = 0;
  229|       |
  230|      1|  parse_hwf_deny_file ();
  231|       |
  232|      1|#if defined (HAVE_CPU_ARCH_X86)
  233|      1|  {
  234|      1|    hw_features = _gcry_hwf_detect_x86 ();
  235|      1|  }
  236|       |#elif defined (HAVE_CPU_ARCH_ARM)
  237|       |  {
  238|       |    hw_features = _gcry_hwf_detect_arm ();
  239|       |  }
  240|       |#elif defined (HAVE_CPU_ARCH_PPC)
  241|       |  {
  242|       |    hw_features = _gcry_hwf_detect_ppc ();
  243|       |  }
  244|       |#elif defined (HAVE_CPU_ARCH_S390X)
  245|       |  {
  246|       |    hw_features = _gcry_hwf_detect_s390x ();
  247|       |  }
  248|       |#endif
  249|      1|  hw_features &= ~disabled_hw_features;
  250|      1|}
hwfeatures.c:parse_hwf_deny_file:
  171|      1|{
  172|      1|  const char *fname = HWF_DENY_FILE;
  ------------------
  |  |   36|      1|#define HWF_DENY_FILE "/etc/gcrypt/hwf.deny"
  ------------------
  173|      1|  FILE *fp;
  174|      1|  char buffer[256];
  175|      1|  char *p, *pend;
  176|      1|  int lnr = 0;
  177|       |
  178|      1|  fp = fopen (fname, "r");
  179|      1|  if (!fp)
  ------------------
  |  Branch (179:7): [True: 1, False: 0]
  ------------------
  180|      1|    return;
  181|       |
  182|      0|  for (;;)
  183|      0|    {
  184|      0|      if (!fgets (buffer, sizeof buffer, fp))
  ------------------
  |  Branch (184:11): [True: 0, False: 0]
  ------------------
  185|      0|        {
  186|      0|          if (!feof (fp))
  ------------------
  |  Branch (186:15): [True: 0, False: 0]
  ------------------
  187|      0|            {
  188|      0|#ifdef HAVE_SYSLOG
  189|      0|              syslog (LOG_USER|LOG_WARNING,
  190|      0|                      "Libgcrypt warning: error reading '%s', line %d",
  191|      0|                      fname, lnr);
  192|      0|#endif /*HAVE_SYSLOG*/
  193|      0|            }
  194|      0|          fclose (fp);
  195|      0|          return;
  196|      0|        }
  197|      0|      lnr++;
  198|      0|      for (p=buffer; my_isascii (*p) && isspace (*p); p++)
  ------------------
  |  |  107|      0|#define my_isascii(c) (!((c) & 0x80))
  |  |  ------------------
  |  |  |  Branch (107:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  199|      0|        ;
  200|      0|      pend = strchr (p, '\n');
  201|      0|      if (pend)
  ------------------
  |  Branch (201:11): [True: 0, False: 0]
  ------------------
  202|      0|        *pend = 0;
  203|      0|      pend = p + (*p? (strlen (p)-1):0);
  ------------------
  |  Branch (203:19): [True: 0, False: 0]
  ------------------
  204|      0|      for ( ;pend > p; pend--)
  ------------------
  |  Branch (204:14): [True: 0, False: 0]
  ------------------
  205|      0|        if (my_isascii (*pend) && isspace (*pend))
  ------------------
  |  |  107|      0|#define my_isascii(c) (!((c) & 0x80))
  |  |  ------------------
  |  |  |  Branch (107:23): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  206|      0|          *pend = 0;
  207|      0|      if (!*p || *p == '#')
  ------------------
  |  Branch (207:11): [True: 0, False: 0]
  |  Branch (207:18): [True: 0, False: 0]
  ------------------
  208|      0|        continue;
  209|       |
  210|      0|      if (_gcry_disable_hw_feature (p) == GPG_ERR_INV_NAME)
  ------------------
  |  Branch (210:11): [True: 0, False: 0]
  ------------------
  211|      0|        {
  212|      0|#ifdef HAVE_SYSLOG
  213|      0|          syslog (LOG_USER|LOG_WARNING,
  214|      0|                  "Libgcrypt warning: unknown feature in '%s', line %d",
  215|      0|                  fname, lnr);
  216|      0|#endif /*HAVE_SYSLOG*/
  217|      0|        }
  218|      0|    }
  219|      0|}

_gcry_set_log_handler:
  102|      1|{
  103|      1|    log_handler = f;
  104|      1|    log_handler_value = opaque;
  105|      1|}
_gcry_logv:
  125|  70.7k|{
  126|  70.7k|  if (log_handler)
  ------------------
  |  Branch (126:7): [True: 70.7k, False: 0]
  ------------------
  127|  70.7k|    log_handler (log_handler_value, level, fmt, arg_ptr);
  128|      0|  else
  129|      0|    {
  130|      0|      switch (level)
  131|      0|        {
  132|      0|        case GCRY_LOG_CONT:  break;
  ------------------
  |  Branch (132:9): [True: 0, False: 0]
  ------------------
  133|      0|        case GCRY_LOG_INFO:  break;
  ------------------
  |  Branch (133:9): [True: 0, False: 0]
  ------------------
  134|      0|        case GCRY_LOG_WARN:  break;
  ------------------
  |  Branch (134:9): [True: 0, False: 0]
  ------------------
  135|      0|        case GCRY_LOG_ERROR: break;
  ------------------
  |  Branch (135:9): [True: 0, False: 0]
  ------------------
  136|      0|        case GCRY_LOG_FATAL: fputs("Fatal: ",stderr ); break;
  ------------------
  |  Branch (136:9): [True: 0, False: 0]
  ------------------
  137|      0|        case GCRY_LOG_BUG:   fputs("Ohhhh jeeee: ", stderr); break;
  ------------------
  |  Branch (137:9): [True: 0, False: 0]
  ------------------
  138|      0|        case GCRY_LOG_DEBUG: fputs("DBG: ", stderr ); break;
  ------------------
  |  Branch (138:9): [True: 0, False: 0]
  ------------------
  139|      0|        default: fprintf(stderr,"[Unknown log level %d]: ", level ); break;
  ------------------
  |  Branch (139:9): [True: 0, False: 0]
  ------------------
  140|      0|	}
  141|      0|      vfprintf(stderr,fmt,arg_ptr) ;
  142|      0|    }
  143|       |
  144|  70.7k|  if ( level == GCRY_LOG_FATAL || level == GCRY_LOG_BUG )
  ------------------
  |  Branch (144:8): [True: 0, False: 70.7k]
  |  Branch (144:35): [True: 0, False: 70.7k]
  ------------------
  145|      0|    {
  146|      0|      fips_signal_fatal_error ("internal error (fatal or bug)");
  ------------------
  |  |  461|      0|           _gcry_fips_signal_error (__FILE__, __LINE__, __FUNCTION__, 1, (a))
  ------------------
  147|      0|      _gcry_secmem_term ();
  148|      0|      abort ();
  149|      0|    }
  150|  70.7k|}
_gcry_log_debug:
  242|  70.7k|{
  243|  70.7k|    va_list arg_ptr ;
  244|       |
  245|  70.7k|    va_start( arg_ptr, fmt ) ;
  246|  70.7k|    _gcry_logv( GCRY_LOG_DEBUG, fmt, arg_ptr );
  247|  70.7k|    va_end(arg_ptr);
  248|  70.7k|}
_gcry_fast_wipememory:
  508|   617k|{
  509|       |  /* Note: This function is called from wipememory/wipememory2 only if LEN
  510|       |     is large or unknown at compile time. New wipe function alternatives
  511|       |     need to be checked before adding to this function. New implementations
  512|       |     need to be faster than wipememory/wipememory2 macros in 'g10lib.h'.
  513|       |
  514|       |     Following implementations were found to have suboptimal performance:
  515|       |
  516|       |     - [_WIN32/mingw32] SecureZeroMemory; Inline function, equivalent to
  517|       |       volatile byte buffer set: while(buflen--) (volatile char *)(buf++)=set;
  518|       |   */
  519|   617k|#ifdef HAVE_EXPLICIT_BZERO
  520|   617k|  explicit_bzero (ptr, len);
  521|       |#elif defined(HAVE_EXPLICIT_MEMSET)
  522|       |  explicit_memset (ptr, 0, len);
  523|       |#else
  524|       |  memset_ptr (ptr, 0, len);
  525|       |#endif
  526|   617k|}
__gcry_burn_stack:
  550|   214k|{
  551|   214k|#ifdef HAVE_VLA
  552|       |  /* (bytes == 0 ? 1 : bytes) == (!bytes + bytes) */
  553|   214k|  unsigned int buflen = ((!bytes + bytes) + 63) & ~63;
  554|   214k|  char buf[buflen];
  555|       |
  556|   214k|  _gcry_fast_wipememory (buf, buflen);
  557|       |#else
  558|       |  volatile char buf[64];
  559|       |
  560|       |  _gcry_fast_wipememory (buf, sizeof buf);
  561|       |
  562|       |  if (bytes > sizeof buf)
  563|       |      _gcry_burn_stack (bytes - sizeof buf);
  564|       |#endif
  565|   214k|}

_gcry_secmem_module_init:
  568|      1|{
  569|       |  /* Not anymore needed.  */
  570|      1|  return 0;
  571|      1|}
_gcry_private_is_secure:
  801|  3.51M|{
  802|  3.51M|  pooldesc_t *pool;
  803|       |
  804|       |  /* We do no lock here because once a pool is allocated it will not
  805|       |   * be removed anymore (except for gcry_secmem_term).  Further, as
  806|       |   * assigment of POOL->NEXT in new pool structure is visible in
  807|       |   * this thread before assigment of MAINPOOL.NEXT, pool list can be
  808|       |   * iterated locklessly.  This visiblity is ensured by memory barrier
  809|       |   * between POOL->NEXT and MAINPOOL.NEXT assignments in
  810|       |   * _gcry_secmem_malloc_internal. */
  811|  7.02M|  for (pool = &mainpool; pool; pool = pool->next)
  ------------------
  |  Branch (811:26): [True: 3.51M, False: 3.51M]
  ------------------
  812|  3.51M|    if (pool->okay && ptr_into_pool_p (pool, p))
  ------------------
  |  Branch (812:9): [True: 0, False: 3.51M]
  |  Branch (812:23): [True: 0, False: 0]
  ------------------
  813|      0|      return 1;
  814|       |
  815|  3.51M|  return 0;
  816|  3.51M|}

_gcry_private_malloc:
   66|  3.23M|{
   67|  3.23M|  if (!n)
  ------------------
  |  Branch (67:7): [True: 31.5k, False: 3.20M]
  ------------------
   68|  31.5k|    {
   69|  31.5k|      gpg_err_set_errno (EINVAL);
   70|  31.5k|      return NULL; /* Allocating 0 bytes is undefined - we better return
   71|       |                      an error to detect such coding errors.  */
   72|  31.5k|    }
   73|       |
   74|  3.20M|  return malloc( n );
   75|  3.23M|}
_gcry_private_realloc:
  104|  37.3k|{
  105|  37.3k|  if ( _gcry_private_is_secure(a) )
  ------------------
  |  Branch (105:8): [True: 0, False: 37.3k]
  ------------------
  106|      0|    {
  107|      0|      return _gcry_secmem_realloc (a, n, xhint);
  108|      0|    }
  109|  37.3k|  else
  110|  37.3k|    {
  111|  37.3k|      return realloc( a, n );
  112|  37.3k|    }
  113|  37.3k|}
_gcry_private_free:
  121|  3.20M|{
  122|  3.20M|  unsigned char *p = a;
  123|  3.20M|  unsigned char *freep;
  124|       |
  125|  3.20M|  if (!p)
  ------------------
  |  Branch (125:7): [True: 0, False: 3.20M]
  ------------------
  126|      0|    return;
  127|       |
  128|  3.20M|  freep = p;
  129|       |
  130|  3.20M|  if (!_gcry_private_is_secure (freep) ||
  ------------------
  |  Branch (130:7): [True: 3.20M, False: 0]
  ------------------
  131|  3.20M|      !_gcry_secmem_free (freep))
  ------------------
  |  Branch (131:7): [True: 0, False: 0]
  ------------------
  132|  3.20M|    {
  133|  3.20M|      free (freep);
  134|  3.20M|    }
  135|  3.20M|}

gcry_mpi_release:
  283|   595k|{
  284|   595k|  _gcry_mpi_release (a);
  285|   595k|}
gcry_mpi_scan:
  357|  72.1k|{
  358|  72.1k|  return gpg_error (_gcry_mpi_scan (ret_mpi, format, buffer, buflen, nscanned));
  359|  72.1k|}
gcry_mpi_set_opaque:
  682|  93.6k|{
  683|  93.6k|  return _gcry_mpi_set_opaque (a, p, nbits);
  684|  93.6k|}
gcry_mpi_set_flag:
  700|  21.5k|{
  701|  21.5k|  _gcry_mpi_set_flag (a, flag);
  702|  21.5k|}
gcry_pk_algo_info:
 1104|  14.5k|{
 1105|  14.5k|  if (!fips_is_operational ())
  ------------------
  |  |  477|  14.5k|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 0, False: 14.5k]
  |  |  ------------------
  |  |  478|  14.5k|                _gcry_global_is_operational() : \
  |  |  479|  14.5k|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|  29.0k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 14.5k, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1105:7): [True: 0, False: 14.5k]
  ------------------
 1106|      0|    return gpg_error (fips_not_operational ());
  ------------------
  |  |  481|      0|#define fips_not_operational()  (GPG_ERR_NOT_OPERATIONAL)
  ------------------
 1107|       |
 1108|  14.5k|  return gpg_error (_gcry_pk_algo_info (algo, what, buffer, nbytes));
 1109|  14.5k|}
gcry_md_open:
 1194|   258k|{
 1195|   258k|  if (!fips_is_operational ())
  ------------------
  |  |  477|   258k|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 1, False: 258k]
  |  |  ------------------
  |  |  478|   258k|                _gcry_global_is_operational() : \
  |  |  479|   258k|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|   516k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 258k, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1195:7): [True: 0, False: 258k]
  ------------------
 1196|      0|    {
 1197|      0|      *h = NULL;
 1198|      0|      return gpg_error (fips_not_operational ());
  ------------------
  |  |  481|      0|#define fips_not_operational()  (GPG_ERR_NOT_OPERATIONAL)
  ------------------
 1199|      0|    }
 1200|       |
 1201|   258k|  return gpg_error (_gcry_md_open (h, algo, flags));
 1202|   258k|}
gcry_md_close:
 1206|  1.11M|{
 1207|  1.11M|  _gcry_md_close (hd);
 1208|  1.11M|}
gcry_md_enable:
 1212|   161k|{
 1213|   161k|  if (!fips_is_operational ())
  ------------------
  |  |  477|   161k|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 0, False: 161k]
  |  |  ------------------
  |  |  478|   161k|                _gcry_global_is_operational() : \
  |  |  479|   161k|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|   323k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 161k, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1213:7): [True: 0, False: 161k]
  ------------------
 1214|      0|    return gpg_error (fips_not_operational ());
  ------------------
  |  |  481|      0|#define fips_not_operational()  (GPG_ERR_NOT_OPERATIONAL)
  ------------------
 1215|   161k|  return gpg_error (_gcry_md_enable (hd, algo));
 1216|   161k|}
gcry_md_copy:
 1220|  16.2k|{
 1221|  16.2k|  if (!fips_is_operational ())
  ------------------
  |  |  477|  16.2k|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 0, False: 16.2k]
  |  |  ------------------
  |  |  478|  16.2k|                _gcry_global_is_operational() : \
  |  |  479|  16.2k|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|  32.4k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 16.2k, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1221:7): [True: 0, False: 16.2k]
  ------------------
 1222|      0|    {
 1223|      0|      *bhd = NULL;
 1224|      0|      return gpg_error (fips_not_operational ());
  ------------------
  |  |  481|      0|#define fips_not_operational()  (GPG_ERR_NOT_OPERATIONAL)
  ------------------
 1225|      0|    }
 1226|  16.2k|  return gpg_error (_gcry_md_copy (bhd, ahd));
 1227|  16.2k|}
gcry_md_reset:
 1231|  44.7k|{
 1232|  44.7k|  _gcry_md_reset (hd);
 1233|  44.7k|}
gcry_md_ctl:
 1237|  41.7k|{
 1238|  41.7k|  if (!fips_is_operational ())
  ------------------
  |  |  477|  41.7k|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 0, False: 41.7k]
  |  |  ------------------
  |  |  478|  41.7k|                _gcry_global_is_operational() : \
  |  |  479|  41.7k|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|  83.5k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 41.7k, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1238:7): [True: 0, False: 41.7k]
  ------------------
 1239|      0|    return gpg_error (fips_not_operational ());
  ------------------
  |  |  481|      0|#define fips_not_operational()  (GPG_ERR_NOT_OPERATIONAL)
  ------------------
 1240|  41.7k|  return gpg_error (_gcry_md_ctl (hd, cmd, buffer, buflen));
 1241|  41.7k|}
gcry_md_write:
 1245|  35.9k|{
 1246|  35.9k|  if (!fips_is_operational ())
  ------------------
  |  |  477|  35.9k|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 0, False: 35.9k]
  |  |  ------------------
  |  |  478|  35.9k|                _gcry_global_is_operational() : \
  |  |  479|  35.9k|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|  71.9k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 35.9k, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1246:7): [True: 0, False: 35.9k]
  ------------------
 1247|      0|    {
 1248|      0|      (void)fips_not_operational ();
  ------------------
  |  |  481|      0|#define fips_not_operational()  (GPG_ERR_NOT_OPERATIONAL)
  ------------------
 1249|      0|      return;
 1250|      0|    }
 1251|  35.9k|  _gcry_md_write (hd, buffer, length);
 1252|  35.9k|}
gcry_md_read:
 1256|  1.50k|{
 1257|  1.50k|  return _gcry_md_read (hd, algo);
 1258|  1.50k|}
gcry_md_is_enabled:
 1312|  14.5k|{
 1313|  14.5k|  if (!fips_is_operational ())
  ------------------
  |  |  477|  14.5k|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 0, False: 14.5k]
  |  |  ------------------
  |  |  478|  14.5k|                _gcry_global_is_operational() : \
  |  |  479|  14.5k|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|  29.0k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 14.5k, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1313:7): [True: 0, False: 14.5k]
  ------------------
 1314|      0|    {
 1315|      0|      (void)fips_not_operational ();
  ------------------
  |  |  481|      0|#define fips_not_operational()  (GPG_ERR_NOT_OPERATIONAL)
  ------------------
 1316|      0|      return 0;
 1317|      0|    }
 1318|       |
 1319|  14.5k|  return _gcry_md_is_enabled (a, algo);
 1320|  14.5k|}
gcry_md_algo_info:
 1339|  48.1k|{
 1340|  48.1k|  return gpg_error (_gcry_md_algo_info (algo, what, buffer, nbytes));
 1341|  48.1k|}
gcry_create_nonce:
 1486|      1|{
 1487|      1|  if (!fips_is_operational ())
  ------------------
  |  |  477|      1|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 0, False: 1]
  |  |  ------------------
  |  |  478|      1|                _gcry_global_is_operational() : \
  |  |  479|      1|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|      2|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 1, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1487:7): [True: 0, False: 1]
  ------------------
 1488|      0|    {
 1489|      0|      (void)fips_not_operational ();
  ------------------
  |  |  481|      0|#define fips_not_operational()  (GPG_ERR_NOT_OPERATIONAL)
  ------------------
 1490|      0|      fips_signal_fatal_error ("called in non-operational state");
  ------------------
  |  |  461|      0|           _gcry_fips_signal_error (__FILE__, __LINE__, __FUNCTION__, 1, (a))
  ------------------
 1491|      0|      fips_noreturn ();
  ------------------
  |  |  489|      0|#define fips_noreturn()  (_gcry_fips_noreturn ())
  ------------------
 1492|      0|    }
 1493|      1|  _gcry_create_nonce (buffer, length);
 1494|      1|}
gcry_set_log_handler:
 1614|      1|{
 1615|      1|  _gcry_set_log_handler (f, opaque);
 1616|      1|}
gcry_malloc:
 1626|   168k|{
 1627|   168k|  return _gcry_malloc (n);
 1628|   168k|}
gcry_calloc:
 1632|  53.5k|{
 1633|  53.5k|  return _gcry_calloc (n, m);
 1634|  53.5k|}
gcry_strdup:
 1656|    331|{
 1657|    331|  return _gcry_strdup (string);
 1658|    331|}
gcry_xmalloc:
 1662|  1.51M|{
 1663|  1.51M|  return _gcry_xmalloc (n);
 1664|  1.51M|}
gcry_xcalloc:
 1668|   822k|{
 1669|   822k|  return _gcry_xcalloc (n, m);
 1670|   822k|}
gcry_xrealloc:
 1686|  47.4k|{
 1687|  47.4k|  return _gcry_xrealloc (a, n);
 1688|  47.4k|}
gcry_xstrdup:
 1692|   103k|{
 1693|   103k|  return _gcry_xstrdup (a);
 1694|   103k|}
gcry_free:
 1698|  4.59M|{
 1699|  4.59M|  _gcry_free (a);
 1700|  4.59M|}

_gpg_err_code_from_errno:
   36|  31.5k|{
   37|  31.5k|  int idx;
   38|       |
   39|  31.5k|  if (!err)
  ------------------
  |  Branch (39:7): [True: 0, False: 31.5k]
  ------------------
   40|      0|    return GPG_ERR_NO_ERROR;
   41|       |
   42|  31.5k|  idx = errno_to_idx (err);
  ------------------
  |  |  151|  31.5k|#define errno_to_idx(code) (0 ? -1 \
  |  |  ------------------
  |  |  |  Branch (151:29): [Folded - Ignored]
  |  |  ------------------
  |  |  152|  31.5k|  : ((code >= 1) && (code <= 11)) ? (code - 1) \
  |  |  ------------------
  |  |  |  Branch (152:6): [True: 31.5k, False: 0]
  |  |  |  Branch (152:21): [True: 0, False: 31.5k]
  |  |  ------------------
  |  |  153|  31.5k|  : ((code >= 11) && (code <= 35)) ? (code - 0) \
  |  |  ------------------
  |  |  |  Branch (153:6): [True: 31.5k, False: 0]
  |  |  |  Branch (153:22): [True: 31.5k, False: 0]
  |  |  ------------------
  |  |  154|  31.5k|  : ((code >= 35) && (code <= 40)) ? (code - -1) \
  |  |  ------------------
  |  |  |  Branch (154:6): [True: 0, False: 0]
  |  |  |  Branch (154:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  155|      0|  : ((code >= 42) && (code <= 57)) ? (code - 0) \
  |  |  ------------------
  |  |  |  Branch (155:6): [True: 0, False: 0]
  |  |  |  Branch (155:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  156|      0|  : ((code >= 59) && (code <= 95)) ? (code - 1) \
  |  |  ------------------
  |  |  |  Branch (156:6): [True: 0, False: 0]
  |  |  |  Branch (156:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  157|      0|  : ((code >= 95) && (code <= 125)) ? (code - 0) \
  |  |  ------------------
  |  |  |  Branch (157:6): [True: 0, False: 0]
  |  |  |  Branch (157:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  158|      0|  : -1)
  ------------------
   43|       |
   44|  31.5k|  if (idx < 0)
  ------------------
  |  Branch (44:7): [True: 0, False: 31.5k]
  ------------------
   45|      0|    return GPG_ERR_UNKNOWN_ERRNO;
   46|       |
   47|  31.5k|  return GPG_ERR_SYSTEM_ERROR | err_code_from_index[idx];
  ------------------
  |  |  584|  31.5k|#define GPG_ERR_SYSTEM_ERROR	(1 << 15)
  ------------------
   48|  31.5k|}
_gpg_err_code_from_syserror:
   56|  32.7k|{
   57|  32.7k|  int err = errno;
   58|  32.7k|  int idx;
   59|       |
   60|  32.7k|  if (!err)
  ------------------
  |  Branch (60:7): [True: 0, False: 32.7k]
  ------------------
   61|      0|    return GPG_ERR_MISSING_ERRNO;
   62|       |
   63|  32.7k|  idx = errno_to_idx (err);
  ------------------
  |  |  151|  32.7k|#define errno_to_idx(code) (0 ? -1 \
  |  |  ------------------
  |  |  |  Branch (151:29): [Folded - Ignored]
  |  |  ------------------
  |  |  152|  32.7k|  : ((code >= 1) && (code <= 11)) ? (code - 1) \
  |  |  ------------------
  |  |  |  Branch (152:6): [True: 32.7k, False: 0]
  |  |  |  Branch (152:21): [True: 1.05k, False: 31.6k]
  |  |  ------------------
  |  |  153|  32.7k|  : ((code >= 11) && (code <= 35)) ? (code - 0) \
  |  |  ------------------
  |  |  |  Branch (153:6): [True: 31.6k, False: 0]
  |  |  |  Branch (153:22): [True: 31.6k, False: 0]
  |  |  ------------------
  |  |  154|  31.6k|  : ((code >= 35) && (code <= 40)) ? (code - -1) \
  |  |  ------------------
  |  |  |  Branch (154:6): [True: 0, False: 0]
  |  |  |  Branch (154:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  155|      0|  : ((code >= 42) && (code <= 57)) ? (code - 0) \
  |  |  ------------------
  |  |  |  Branch (155:6): [True: 0, False: 0]
  |  |  |  Branch (155:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  156|      0|  : ((code >= 59) && (code <= 95)) ? (code - 1) \
  |  |  ------------------
  |  |  |  Branch (156:6): [True: 0, False: 0]
  |  |  |  Branch (156:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  157|      0|  : ((code >= 95) && (code <= 125)) ? (code - 0) \
  |  |  ------------------
  |  |  |  Branch (157:6): [True: 0, False: 0]
  |  |  |  Branch (157:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  158|      0|  : -1)
  ------------------
   64|       |
   65|  32.7k|  if (idx < 0)
  ------------------
  |  Branch (65:7): [True: 0, False: 32.7k]
  ------------------
   66|      0|    return GPG_ERR_UNKNOWN_ERRNO;
   67|       |
   68|  32.7k|  return GPG_ERR_SYSTEM_ERROR | err_code_from_index[idx];
  ------------------
  |  |  584|  32.7k|#define GPG_ERR_SYSTEM_ERROR	(1 << 15)
  ------------------
   69|  32.7k|}

_gpg_err_code_to_errno:
   33|  33.6k|{
   34|  33.6k|  if (!(code & GPG_ERR_SYSTEM_ERROR))
  ------------------
  |  |  584|  33.6k|#define GPG_ERR_SYSTEM_ERROR	(1 << 15)
  ------------------
  |  Branch (34:7): [True: 0, False: 33.6k]
  ------------------
   35|      0|    return 0;
   36|  33.6k|  code &= ~GPG_ERR_SYSTEM_ERROR;
  ------------------
  |  |  584|  33.6k|#define GPG_ERR_SYSTEM_ERROR	(1 << 15)
  ------------------
   37|       |
   38|  33.6k|  if (code < sizeof (err_code_to_errno) / sizeof (err_code_to_errno[0]))
  ------------------
  |  Branch (38:7): [True: 32.6k, False: 942]
  ------------------
   39|  32.6k|    return err_code_to_errno[code];
   40|    942|  else
   41|    942|    return 0;
   42|  33.6k|}

strerror.c:msgidxof:
  913|   303k|{
  914|   303k|  return (0 ? 0
  ------------------
  |  Branch (914:11): [Folded - Ignored]
  ------------------
  915|   303k|  : ((code >= 0) && (code <= 213)) ? (code - 0)
  ------------------
  |  Branch (915:6): [True: 303k, False: 0]
  |  Branch (915:21): [True: 302k, False: 942]
  ------------------
  916|   303k|  : ((code >= 217) && (code <= 271)) ? (code - 3)
  ------------------
  |  Branch (916:6): [True: 942, False: 0]
  |  Branch (916:23): [True: 0, False: 942]
  ------------------
  917|    942|  : ((code >= 273) && (code <= 281)) ? (code - 4)
  ------------------
  |  Branch (917:6): [True: 942, False: 0]
  |  Branch (917:23): [True: 0, False: 942]
  ------------------
  918|    942|  : ((code >= 300) && (code <= 319)) ? (code - 22)
  ------------------
  |  Branch (918:6): [True: 942, False: 0]
  |  Branch (918:23): [True: 0, False: 942]
  ------------------
  919|    942|  : ((code >= 666) && (code <= 666)) ? (code - 368)
  ------------------
  |  Branch (919:6): [True: 942, False: 0]
  |  Branch (919:23): [True: 0, False: 942]
  ------------------
  920|    942|  : ((code >= 711) && (code <= 718)) ? (code - 412)
  ------------------
  |  Branch (920:6): [True: 942, False: 0]
  |  Branch (920:23): [True: 0, False: 942]
  ------------------
  921|    942|  : ((code >= 721) && (code <= 729)) ? (code - 414)
  ------------------
  |  Branch (921:6): [True: 942, False: 0]
  |  Branch (921:23): [True: 0, False: 942]
  ------------------
  922|    942|  : ((code >= 750) && (code <= 752)) ? (code - 434)
  ------------------
  |  Branch (922:6): [True: 942, False: 0]
  |  Branch (922:23): [True: 0, False: 942]
  ------------------
  923|    942|  : ((code >= 754) && (code <= 782)) ? (code - 435)
  ------------------
  |  Branch (923:6): [True: 942, False: 0]
  |  Branch (923:23): [True: 0, False: 942]
  ------------------
  924|    942|  : ((code >= 784) && (code <= 789)) ? (code - 436)
  ------------------
  |  Branch (924:6): [True: 942, False: 0]
  |  Branch (924:23): [True: 0, False: 942]
  ------------------
  925|    942|  : ((code >= 800) && (code <= 804)) ? (code - 446)
  ------------------
  |  Branch (925:6): [True: 942, False: 0]
  |  Branch (925:23): [True: 0, False: 942]
  ------------------
  926|    942|  : ((code >= 815) && (code <= 822)) ? (code - 456)
  ------------------
  |  Branch (926:6): [True: 942, False: 0]
  |  Branch (926:23): [True: 0, False: 942]
  ------------------
  927|    942|  : ((code >= 832) && (code <= 839)) ? (code - 465)
  ------------------
  |  Branch (927:6): [True: 942, False: 0]
  |  Branch (927:23): [True: 0, False: 942]
  ------------------
  928|    942|  : ((code >= 844) && (code <= 844)) ? (code - 469)
  ------------------
  |  Branch (928:6): [True: 942, False: 0]
  |  Branch (928:23): [True: 0, False: 942]
  ------------------
  929|    942|  : ((code >= 848) && (code <= 848)) ? (code - 472)
  ------------------
  |  Branch (929:6): [True: 942, False: 0]
  |  Branch (929:23): [True: 0, False: 942]
  ------------------
  930|    942|  : ((code >= 881) && (code <= 891)) ? (code - 504)
  ------------------
  |  Branch (930:6): [True: 942, False: 0]
  |  Branch (930:23): [True: 0, False: 942]
  ------------------
  931|    942|  : ((code >= 1024) && (code <= 1039)) ? (code - 636)
  ------------------
  |  Branch (931:6): [True: 942, False: 0]
  |  Branch (931:24): [True: 0, False: 942]
  ------------------
  932|    942|  : ((code >= 1500) && (code <= 1528)) ? (code - 1096)
  ------------------
  |  Branch (932:6): [True: 942, False: 0]
  |  Branch (932:24): [True: 0, False: 942]
  ------------------
  933|    942|  : ((code >= 1600) && (code <= 1601)) ? (code - 1167)
  ------------------
  |  Branch (933:6): [True: 942, False: 0]
  |  Branch (933:24): [True: 0, False: 942]
  ------------------
  934|    942|  : ((code >= 16381) && (code <= 16383)) ? (code - 15946)
  ------------------
  |  Branch (934:6): [True: 942, False: 0]
  |  Branch (934:25): [True: 942, False: 0]
  ------------------
  935|    942|  : 16384 - 15946);
  936|   303k|}

_gpgrt_estream_format:
 1492|  10.0M|{
 1493|       |  /* Buffer to hold the argspecs and a pointer to it.*/
 1494|  10.0M|  struct argspec_s argspecs_buffer[DEFAULT_MAX_ARGSPECS];
 1495|  10.0M|  argspec_t argspecs = argspecs_buffer;
 1496|  10.0M|  size_t argspecs_len;  /* Number of specifications in ARGSPECS.  */
 1497|       |
 1498|       |  /* Buffer to hold the description for the values.  */
 1499|  10.0M|  struct valueitem_s valuetable_buffer[DEFAULT_MAX_VALUES];
 1500|  10.0M|  valueitem_t valuetable = valuetable_buffer;
 1501|       |
 1502|  10.0M|  int rc;        /* Return code. */
 1503|  10.0M|  size_t argidx; /* Used to index the argspecs array.  */
 1504|  10.0M|  size_t validx; /* Used to index the valuetable.  */
 1505|  10.0M|  int max_pos;   /* Highest argument position.  */
 1506|       |
 1507|  10.0M|  size_t nbytes = 0; /* Keep track of the number of bytes passed to
 1508|       |                        the output function.  */
 1509|       |
 1510|  10.0M|  int myerrno = errno; /* Save the errno for use with "%m". */
 1511|       |
 1512|       |
 1513|       |  /* Parse the arguments to come up with descriptive list.  We can't
 1514|       |     do this on the fly because we need to support positional
 1515|       |     arguments. */
 1516|  10.0M|  rc = parse_format (format, &argspecs, DIM(argspecs_buffer), &argspecs_len);
  ------------------
  |  |   93|  10.0M|# define DIM(array) (sizeof (array) / sizeof (*array))
  ------------------
 1517|  10.0M|  if (rc)
  ------------------
  |  Branch (1517:7): [True: 0, False: 10.0M]
  ------------------
 1518|      0|    goto leave;
 1519|       |
 1520|       |  /* Check that all ARG_POS fields are set.  */
 1521|  19.8M|  for (argidx=0,max_pos=0; argidx < argspecs_len; argidx++)
  ------------------
  |  Branch (1521:28): [True: 9.79M, False: 10.0M]
  ------------------
 1522|  9.79M|    {
 1523|  9.79M|      if (argspecs[argidx].arg_pos != -1
  ------------------
  |  Branch (1523:11): [True: 9.79M, False: 0]
  ------------------
 1524|  9.79M|          && argspecs[argidx].arg_pos > max_pos)
  ------------------
  |  Branch (1524:14): [True: 0, False: 9.79M]
  ------------------
 1525|      0|        max_pos = argspecs[argidx].arg_pos;
 1526|  9.79M|      if (argspecs[argidx].width_pos > max_pos)
  ------------------
  |  Branch (1526:11): [True: 0, False: 9.79M]
  ------------------
 1527|      0|        max_pos = argspecs[argidx].width_pos;
 1528|  9.79M|      if (argspecs[argidx].precision_pos > max_pos)
  ------------------
  |  Branch (1528:11): [True: 0, False: 9.79M]
  ------------------
 1529|      0|        max_pos = argspecs[argidx].precision_pos;
 1530|  9.79M|    }
 1531|  10.0M|  if (!max_pos)
  ------------------
  |  Branch (1531:7): [True: 10.0M, False: 0]
  ------------------
 1532|  10.0M|    {
 1533|       |      /* Fill in all the positions.  */
 1534|  19.8M|      for (argidx=0; argidx < argspecs_len; argidx++)
  ------------------
  |  Branch (1534:22): [True: 9.79M, False: 10.0M]
  ------------------
 1535|  9.79M|        {
 1536|  9.79M|          if (argspecs[argidx].width == STAR_FIELD_VALUE)
  ------------------
  |  |  133|  9.79M|#define STAR_FIELD_VALUE (-2)
  ------------------
  |  Branch (1536:15): [True: 0, False: 9.79M]
  ------------------
 1537|      0|            argspecs[argidx].width_pos = ++max_pos;
 1538|  9.79M|          if (argspecs[argidx].precision == STAR_FIELD_VALUE)
  ------------------
  |  |  133|  9.79M|#define STAR_FIELD_VALUE (-2)
  ------------------
  |  Branch (1538:15): [True: 3, False: 9.79M]
  ------------------
 1539|      3|            argspecs[argidx].precision_pos = ++max_pos;
 1540|  9.79M|          if (argspecs[argidx].arg_pos != -1 )
  ------------------
  |  Branch (1540:15): [True: 9.79M, False: 0]
  ------------------
 1541|  9.79M|            argspecs[argidx].arg_pos = ++max_pos;
 1542|  9.79M|        }
 1543|  10.0M|    }
 1544|      0|  else
 1545|      0|    {
 1546|       |      /* Check that they are all filled.   More test are done later.  */
 1547|      0|      for (argidx=0; argidx < argspecs_len; argidx++)
  ------------------
  |  Branch (1547:22): [True: 0, False: 0]
  ------------------
 1548|      0|        {
 1549|      0|          if (!argspecs[argidx].arg_pos
  ------------------
  |  Branch (1549:15): [True: 0, False: 0]
  ------------------
 1550|      0|              || (argspecs[argidx].width == STAR_FIELD_VALUE
  ------------------
  |  |  133|      0|#define STAR_FIELD_VALUE (-2)
  ------------------
  |  Branch (1550:19): [True: 0, False: 0]
  ------------------
 1551|      0|                  && !argspecs[argidx].width_pos)
  ------------------
  |  Branch (1551:22): [True: 0, False: 0]
  ------------------
 1552|      0|              || (argspecs[argidx].precision == STAR_FIELD_VALUE
  ------------------
  |  |  133|      0|#define STAR_FIELD_VALUE (-2)
  ------------------
  |  Branch (1552:19): [True: 0, False: 0]
  ------------------
 1553|      0|                  && !argspecs[argidx].precision_pos))
  ------------------
  |  Branch (1553:22): [True: 0, False: 0]
  ------------------
 1554|      0|            goto leave_einval;
 1555|      0|        }
 1556|      0|    }
 1557|       |  /* Check that there is no overflow in max_pos and that it has a
 1558|       |     reasonable length.  There may never be more elements than the
 1559|       |     number of characters in FORMAT.  */
 1560|  10.0M|  if (max_pos < 0 || max_pos >= strlen (format))
  ------------------
  |  Branch (1560:7): [True: 0, False: 10.0M]
  |  Branch (1560:22): [True: 0, False: 10.0M]
  ------------------
 1561|      0|    goto leave_einval;
 1562|       |
 1563|       |#ifdef DEBUG
 1564|       |    dump_argspecs (argspecs, argspecs_len);
 1565|       |#endif
 1566|       |
 1567|       |  /* Allocate a table to hold the values.  If it is small enough we
 1568|       |     use a stack allocated buffer.  */
 1569|  10.0M|  if (max_pos > DIM(valuetable_buffer))
  ------------------
  |  |   93|  10.0M|# define DIM(array) (sizeof (array) / sizeof (*array))
  ------------------
  |  Branch (1569:7): [True: 0, False: 10.0M]
  ------------------
 1570|      0|    {
 1571|      0|      valuetable = calloc (max_pos, sizeof *valuetable);
 1572|      0|      if (!valuetable)
  ------------------
  |  Branch (1572:11): [True: 0, False: 0]
  ------------------
 1573|      0|        goto leave_error;
 1574|      0|    }
 1575|  10.0M|  else
 1576|  10.0M|    {
 1577|  90.3M|      for (validx=0; validx < DIM(valuetable_buffer); validx++)
  ------------------
  |  |   93|  90.3M|# define DIM(array) (sizeof (array) / sizeof (*array))
  ------------------
  |  Branch (1577:22): [True: 80.3M, False: 10.0M]
  ------------------
 1578|  80.3M|        {
 1579|  80.3M|          valuetable[validx].vt = VALTYPE_UNSUPPORTED;
 1580|  80.3M|          memset (&valuetable[validx].value, 0,
 1581|  80.3M|                  sizeof valuetable[validx].value);
 1582|  80.3M|        }
 1583|  10.0M|    }
 1584|  19.8M|  for (argidx=0; argidx < argspecs_len; argidx++)
  ------------------
  |  Branch (1584:18): [True: 9.79M, False: 10.0M]
  ------------------
 1585|  9.79M|    {
 1586|  9.79M|      if (argspecs[argidx].arg_pos != - 1)
  ------------------
  |  Branch (1586:11): [True: 9.79M, False: 0]
  ------------------
 1587|  9.79M|        {
 1588|  9.79M|          validx = argspecs[argidx].arg_pos - 1;
 1589|  9.79M|          if (valuetable[validx].vt)
  ------------------
  |  Branch (1589:15): [True: 0, False: 9.79M]
  ------------------
 1590|      0|            goto leave_einval; /* Already defined. */
 1591|  9.79M|          valuetable[validx].vt = argspecs[argidx].vt;
 1592|  9.79M|        }
 1593|  9.79M|      if (argspecs[argidx].width == STAR_FIELD_VALUE)
  ------------------
  |  |  133|  9.79M|#define STAR_FIELD_VALUE (-2)
  ------------------
  |  Branch (1593:11): [True: 0, False: 9.79M]
  ------------------
 1594|      0|        {
 1595|      0|          validx = argspecs[argidx].width_pos - 1;
 1596|      0|          if (valuetable[validx].vt)
  ------------------
  |  Branch (1596:15): [True: 0, False: 0]
  ------------------
 1597|      0|            goto leave_einval; /* Already defined.  */
 1598|      0|          valuetable[validx].vt = VALTYPE_INT;
 1599|      0|        }
 1600|  9.79M|      if (argspecs[argidx].precision == STAR_FIELD_VALUE)
  ------------------
  |  |  133|  9.79M|#define STAR_FIELD_VALUE (-2)
  ------------------
  |  Branch (1600:11): [True: 3, False: 9.79M]
  ------------------
 1601|      3|        {
 1602|      3|          validx = argspecs[argidx].precision_pos - 1;
 1603|      3|          if (valuetable[validx].vt)
  ------------------
  |  Branch (1603:15): [True: 0, False: 3]
  ------------------
 1604|      0|            goto leave_einval; /* Already defined.  */
 1605|      3|          valuetable[validx].vt = VALTYPE_INT;
 1606|      3|        }
 1607|  9.79M|    }
 1608|       |
 1609|       |  /* Read all the arguments.  This will error out for unsupported
 1610|       |     types and for not given positional arguments. */
 1611|  10.0M|  rc = read_values (valuetable, max_pos, vaargs);
 1612|  10.0M|  if (rc)
  ------------------
  |  Branch (1612:7): [True: 0, False: 10.0M]
  ------------------
 1613|      0|    goto leave_einval;
 1614|       |
 1615|       |/*   for (validx=0; validx < max_pos; validx++) */
 1616|       |/*     fprintf (stderr, "%2d: vt=%d\n", validx, valuetable[validx].vt); */
 1617|       |
 1618|       |  /* Everything has been collected, go ahead with the formatting.  */
 1619|  10.0M|  rc = do_format (outfnc, outfncarg, sf, sfvalue, format,
 1620|  10.0M|                  argspecs, argspecs_len, valuetable, myerrno, &nbytes);
 1621|       |
 1622|  10.0M|  goto leave;
 1623|       |
 1624|      0| leave_einval:
 1625|      0|  _set_errno (EINVAL);
  ------------------
  |  |  113|      0|#define _set_errno(a)  do { errno = (a); } while (0)
  |  |  ------------------
  |  |  |  Branch (113:51): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1626|      0| leave_error:
 1627|      0|  rc = -1;
 1628|  10.0M| leave:
 1629|  10.0M|  if (valuetable != valuetable_buffer)
  ------------------
  |  Branch (1629:7): [True: 0, False: 10.0M]
  ------------------
 1630|      0|    free (valuetable);
 1631|  10.0M|  if (argspecs != argspecs_buffer)
  ------------------
  |  Branch (1631:7): [True: 0, False: 10.0M]
  ------------------
 1632|      0|    free (argspecs);
 1633|  10.0M|  return rc;
 1634|      0|}
_gpgrt_estream_vsnprintf:
 1733|  44.8k|{
 1734|  44.8k|  struct fixed_buffer_parm_s parm;
 1735|  44.8k|  int rc;
 1736|       |
 1737|  44.8k|  parm.size = bufsize;
 1738|  44.8k|  parm.count = 0;
 1739|  44.8k|  parm.used = 0;
 1740|  44.8k|  parm.buffer = bufsize?buf:NULL;
  ------------------
  |  Branch (1740:17): [True: 44.8k, False: 0]
  ------------------
 1741|  44.8k|  rc = _gpgrt_estream_format (fixed_buffer_out, &parm, NULL, NULL,
 1742|  44.8k|                              format, arg_ptr);
 1743|  44.8k|  if (!rc)
  ------------------
  |  Branch (1743:7): [True: 44.8k, False: 0]
  ------------------
 1744|  44.8k|    rc = fixed_buffer_out (&parm, "", 1); /* Print terminating Nul.  */
 1745|  44.8k|  if (rc == -1)
  ------------------
  |  Branch (1745:7): [True: 0, False: 44.8k]
  ------------------
 1746|      0|    return -1;
 1747|  44.8k|  if (bufsize && buf && parm.size && parm.count >= parm.size)
  ------------------
  |  Branch (1747:7): [True: 44.8k, False: 0]
  |  Branch (1747:18): [True: 44.8k, False: 0]
  |  Branch (1747:25): [True: 44.8k, False: 0]
  |  Branch (1747:38): [True: 0, False: 44.8k]
  ------------------
 1748|      0|    buf[parm.size-1] = 0;
 1749|       |
 1750|  44.8k|  parm.count--; /* Do not count the trailing nul.  */
 1751|  44.8k|  return (int)parm.count; /* Return number of bytes which would have
 1752|       |                             been written.  */
 1753|  44.8k|}
estream-printf.c:parse_format:
  445|  10.0M|{
  446|  10.0M|  const char *s;
  447|  10.0M|  argspec_t argspecs = *argspecs_addr;
  448|  10.0M|  argspec_t arg;
  449|  10.0M|  size_t argcount = 0;
  450|       |
  451|  10.0M|  if (!format)
  ------------------
  |  Branch (451:7): [True: 0, False: 10.0M]
  ------------------
  452|      0|    goto leave_einval;
  453|       |
  454|   162M|  for (; *format; format++)
  ------------------
  |  Branch (454:10): [True: 152M, False: 10.0M]
  ------------------
  455|   152M|    {
  456|   152M|      unsigned int flags;
  457|   152M|      int width, precision;
  458|   152M|      lenmod_t lenmod;
  459|   152M|      conspec_t conspec;
  460|   152M|      int arg_pos, width_pos, precision_pos;
  461|       |
  462|   152M|      if (*format != '%')
  ------------------
  |  Branch (462:11): [True: 142M, False: 9.79M]
  ------------------
  463|   142M|        continue;
  464|  9.79M|      s = ++format;
  465|  9.79M|      if (!*s)
  ------------------
  |  Branch (465:11): [True: 0, False: 9.79M]
  ------------------
  466|      0|        goto leave_einval;
  467|  9.79M|      if (*s == '%')
  ------------------
  |  Branch (467:11): [True: 0, False: 9.79M]
  ------------------
  468|      0|        continue; /* Just a quoted percent.  */
  469|       |
  470|       |      /* First check whether there is a positional argument.  */
  471|  9.79M|      arg_pos = 0; /* No positional argument given.  */
  472|  9.79M|      if (*s >= '1' && *s <= '9')
  ------------------
  |  Branch (472:11): [True: 986k, False: 8.80M]
  |  Branch (472:24): [True: 3, False: 986k]
  ------------------
  473|      3|        {
  474|      3|          const char *save_s = s;
  475|       |
  476|      3|          arg_pos = (*s++ - '0');
  477|      6|          for (; *s >= '0' && *s <= '9'; s++)
  ------------------
  |  Branch (477:18): [True: 6, False: 0]
  |  Branch (477:31): [True: 3, False: 3]
  ------------------
  478|      3|            arg_pos = 10*arg_pos + (*s - '0');
  479|      3|          if (arg_pos < 0)
  ------------------
  |  Branch (479:15): [True: 0, False: 3]
  ------------------
  480|      0|            goto leave_einval; /* Overflow during conversion.  */
  481|      3|          if (*s == '$')
  ------------------
  |  Branch (481:15): [True: 0, False: 3]
  ------------------
  482|      0|            s++;
  483|      3|          else
  484|      3|            {
  485|      3|              arg_pos = 0;
  486|      3|              s = save_s;
  487|      3|            }
  488|      3|        }
  489|       |
  490|       |      /* Parse the flags.  */
  491|  9.79M|      flags = 0;
  492|  18.5M|      for ( ; *s; s++)
  ------------------
  |  Branch (492:15): [True: 18.5M, False: 0]
  ------------------
  493|  18.5M|        {
  494|  18.5M|          switch (*s)
  495|  18.5M|            {
  496|      0|            case '\'': flags |= FLAG_GROUPING; break;
  ------------------
  |  |  136|      0|#define FLAG_GROUPING   1
  ------------------
  |  Branch (496:13): [True: 0, False: 18.5M]
  ------------------
  497|      0|            case '-': flags |= FLAG_LEFT_JUST; break;
  ------------------
  |  |  137|      0|#define FLAG_LEFT_JUST  2
  ------------------
  |  Branch (497:13): [True: 0, False: 18.5M]
  ------------------
  498|      0|            case '+': flags |= FLAG_PLUS_SIGN; break;
  ------------------
  |  |  138|      0|#define FLAG_PLUS_SIGN  4
  ------------------
  |  Branch (498:13): [True: 0, False: 18.5M]
  ------------------
  499|      0|            case ' ': flags |= FLAG_SPACE_PLUS; break;
  ------------------
  |  |  139|      0|#define FLAG_SPACE_PLUS 8
  ------------------
  |  Branch (499:13): [True: 0, False: 18.5M]
  ------------------
  500|      0|            case '#': flags |= FLAG_ALT_CONV; break;
  ------------------
  |  |  140|      0|#define FLAG_ALT_CONV   16
  ------------------
  |  Branch (500:13): [True: 0, False: 18.5M]
  ------------------
  501|  8.80M|            case '0': flags |= FLAG_ZERO_PAD; break;
  ------------------
  |  |  141|  8.80M|#define FLAG_ZERO_PAD   32
  ------------------
  |  Branch (501:13): [True: 8.80M, False: 9.79M]
  ------------------
  502|  9.79M|            default:
  ------------------
  |  Branch (502:13): [True: 9.79M, False: 8.80M]
  ------------------
  503|  9.79M|              goto flags_parsed;
  504|  18.5M|            }
  505|  18.5M|        }
  506|  9.79M|    flags_parsed:
  507|       |
  508|       |      /* Parse the field width.  */
  509|  9.79M|      width_pos = 0;
  510|  9.79M|      if (*s == '*')
  ------------------
  |  Branch (510:11): [True: 0, False: 9.79M]
  ------------------
  511|      0|        {
  512|      0|          width = STAR_FIELD_VALUE;
  ------------------
  |  |  133|      0|#define STAR_FIELD_VALUE (-2)
  ------------------
  513|      0|          s++;
  514|       |          /* If we have a positional argument, another one might also
  515|       |             be used to give the position of the star's value. */
  516|      0|          if (arg_pos && *s >= '1' && *s <= '9')
  ------------------
  |  Branch (516:15): [True: 0, False: 0]
  |  Branch (516:26): [True: 0, False: 0]
  |  Branch (516:39): [True: 0, False: 0]
  ------------------
  517|      0|            {
  518|      0|              width_pos = (*s++ - '0');
  519|      0|              for (; *s >= '0' && *s <= '9'; s++)
  ------------------
  |  Branch (519:22): [True: 0, False: 0]
  |  Branch (519:35): [True: 0, False: 0]
  ------------------
  520|      0|                width_pos = 10*width_pos + (*s - '0');
  521|      0|              if (width_pos < 1)
  ------------------
  |  Branch (521:19): [True: 0, False: 0]
  ------------------
  522|      0|                goto leave_einval; /* Overflow during conversion.  */
  523|      0|              if (*s != '$')
  ------------------
  |  Branch (523:19): [True: 0, False: 0]
  ------------------
  524|      0|                goto leave_einval; /* Not followed by $.  */
  525|      0|              s++;
  526|      0|            }
  527|      0|        }
  528|  9.79M|      else if ( *s >= '0' && *s <= '9')
  ------------------
  |  Branch (528:17): [True: 9.79M, False: 3]
  |  Branch (528:30): [True: 8.80M, False: 986k]
  ------------------
  529|  8.80M|        {
  530|  8.80M|          width = (*s++ - '0');
  531|  8.80M|          for (; *s >= '0' && *s <= '9'; s++)
  ------------------
  |  Branch (531:18): [True: 8.80M, False: 0]
  |  Branch (531:31): [True: 3, False: 8.80M]
  ------------------
  532|      3|            {
  533|      3|              if (!width && *s == '0')
  ------------------
  |  Branch (533:19): [True: 0, False: 3]
  |  Branch (533:29): [True: 0, False: 0]
  ------------------
  534|      0|                goto leave_einval; /* Leading zeroes are not allowed.
  535|       |                                      Fixme: check what other
  536|       |                                      implementations do. */
  537|      3|              width = 10*width + (*s - '0');
  538|      3|            }
  539|  8.80M|          if (width < 0)
  ------------------
  |  Branch (539:15): [True: 0, False: 8.80M]
  ------------------
  540|      0|            goto leave_einval; /* Overflow during conversion.  */
  541|  8.80M|        }
  542|   986k|      else
  543|   986k|        width = NO_FIELD_VALUE;
  ------------------
  |  |  132|   986k|#define NO_FIELD_VALUE   (-1)
  ------------------
  544|       |
  545|       |      /* Parse the precision.  */
  546|  9.79M|      precision_pos = 0;
  547|  9.79M|      precision = NO_FIELD_VALUE;
  ------------------
  |  |  132|  9.79M|#define NO_FIELD_VALUE   (-1)
  ------------------
  548|  9.79M|      if (*s == '.')
  ------------------
  |  Branch (548:11): [True: 3, False: 9.79M]
  ------------------
  549|      3|        {
  550|      3|          int ignore_value = (s[1] == '-');
  551|       |
  552|      3|          s++;
  553|      3|          if (*s == '*')
  ------------------
  |  Branch (553:15): [True: 3, False: 0]
  ------------------
  554|      3|            {
  555|      3|              precision = STAR_FIELD_VALUE;
  ------------------
  |  |  133|      3|#define STAR_FIELD_VALUE (-2)
  ------------------
  556|      3|              s++;
  557|       |              /* If we have a positional argument, another one might also
  558|       |                 be used to give the position of the star's value. */
  559|      3|              if (arg_pos && *s >= '1' && *s <= '9')
  ------------------
  |  Branch (559:19): [True: 0, False: 3]
  |  Branch (559:30): [True: 0, False: 0]
  |  Branch (559:43): [True: 0, False: 0]
  ------------------
  560|      0|                {
  561|      0|                  precision_pos = (*s++ - '0');
  562|      0|                  for (; *s >= '0' && *s <= '9'; s++)
  ------------------
  |  Branch (562:26): [True: 0, False: 0]
  |  Branch (562:39): [True: 0, False: 0]
  ------------------
  563|      0|                    precision_pos = 10*precision_pos + (*s - '0');
  564|      0|                  if (precision_pos < 1)
  ------------------
  |  Branch (564:23): [True: 0, False: 0]
  ------------------
  565|      0|                    goto leave_einval; /* Overflow during conversion.  */
  566|      0|                  if (*s != '$')
  ------------------
  |  Branch (566:23): [True: 0, False: 0]
  ------------------
  567|      0|                    goto leave_einval; /* Not followed by $.  */
  568|      0|                  s++;
  569|      0|                }
  570|      3|            }
  571|      0|          else if ( *s >= '0' && *s <= '9')
  ------------------
  |  Branch (571:21): [True: 0, False: 0]
  |  Branch (571:34): [True: 0, False: 0]
  ------------------
  572|      0|            {
  573|      0|              precision = (*s++ - '0');
  574|      0|              for (; *s >= '0' && *s <= '9'; s++)
  ------------------
  |  Branch (574:22): [True: 0, False: 0]
  |  Branch (574:35): [True: 0, False: 0]
  ------------------
  575|      0|                {
  576|      0|                  if (!precision && *s == '0')
  ------------------
  |  Branch (576:23): [True: 0, False: 0]
  |  Branch (576:37): [True: 0, False: 0]
  ------------------
  577|      0|                    goto leave_einval; /* Leading zeroes are not allowed.
  578|       |                                          Fixme: check what other
  579|       |                                          implementations do. */
  580|      0|                  precision = 10*precision + (*s - '0');
  581|      0|                }
  582|      0|              if (precision < 0)
  ------------------
  |  Branch (582:19): [True: 0, False: 0]
  ------------------
  583|      0|                goto leave_einval; /* Overflow during conversion.  */
  584|      0|            }
  585|      0|          else
  586|      0|            precision = 0;
  587|      3|          if (ignore_value)
  ------------------
  |  Branch (587:15): [True: 0, False: 3]
  ------------------
  588|      0|            precision = NO_FIELD_VALUE;
  ------------------
  |  |  132|      0|#define NO_FIELD_VALUE   (-1)
  ------------------
  589|      3|        }
  590|       |
  591|       |      /* Parse the length modifiers.  */
  592|  9.79M|      switch (*s)
  593|  9.79M|        {
  594|      0|        case 'h':
  ------------------
  |  Branch (594:9): [True: 0, False: 9.79M]
  ------------------
  595|      0|          if (s[1] == 'h')
  ------------------
  |  Branch (595:15): [True: 0, False: 0]
  ------------------
  596|      0|            {
  597|      0|              lenmod = LENMOD_CHAR;
  598|      0|              s++;
  599|      0|            }
  600|      0|          else
  601|      0|            lenmod = LENMOD_SHORT;
  602|      0|          s++;
  603|      0|          break;
  604|  97.9k|        case 'l':
  ------------------
  |  Branch (604:9): [True: 97.9k, False: 9.69M]
  ------------------
  605|  97.9k|          if (s[1] == 'l')
  ------------------
  |  Branch (605:15): [True: 0, False: 97.9k]
  ------------------
  606|      0|            {
  607|      0|              lenmod = LENMOD_LONGLONG;
  608|      0|              s++;
  609|      0|            }
  610|  97.9k|          else
  611|  97.9k|            lenmod = LENMOD_LONG;
  612|  97.9k|          s++;
  613|  97.9k|          break;
  614|      0|        case 'j': lenmod = LENMOD_INTMAX; s++; break;
  ------------------
  |  Branch (614:9): [True: 0, False: 9.79M]
  ------------------
  615|      0|        case 'z': lenmod = LENMOD_SIZET; s++; break;
  ------------------
  |  Branch (615:9): [True: 0, False: 9.79M]
  ------------------
  616|      0|        case 't': lenmod = LENMOD_PTRDIFF; s++; break;
  ------------------
  |  Branch (616:9): [True: 0, False: 9.79M]
  ------------------
  617|      0|        case 'L': lenmod = LENMOD_LONGDBL; s++; break;
  ------------------
  |  Branch (617:9): [True: 0, False: 9.79M]
  ------------------
  618|  9.69M|        default:  lenmod = LENMOD_NONE; break;
  ------------------
  |  Branch (618:9): [True: 9.69M, False: 97.9k]
  ------------------
  619|  9.79M|        }
  620|       |
  621|       |      /* Parse the conversion specifier.  */
  622|  9.79M|      switch (*s)
  623|  9.79M|        {
  624|   321k|        case 'd':
  ------------------
  |  Branch (624:9): [True: 321k, False: 9.47M]
  ------------------
  625|   321k|        case 'i': conspec = CONSPEC_DECIMAL; break;
  ------------------
  |  Branch (625:9): [True: 0, False: 9.79M]
  ------------------
  626|      0|        case 'o': conspec = CONSPEC_OCTAL; break;
  ------------------
  |  Branch (626:9): [True: 0, False: 9.79M]
  ------------------
  627|  35.1k|        case 'u': conspec = CONSPEC_UNSIGNED; break;
  ------------------
  |  Branch (627:9): [True: 35.1k, False: 9.75M]
  ------------------
  628|  5.70M|        case 'x': conspec = CONSPEC_HEX; break;
  ------------------
  |  Branch (628:9): [True: 5.70M, False: 4.08M]
  ------------------
  629|  3.10M|        case 'X': conspec = CONSPEC_HEX_UP; break;
  ------------------
  |  Branch (629:9): [True: 3.10M, False: 6.69M]
  ------------------
  630|      0|        case 'f': conspec = CONSPEC_FLOAT; break;
  ------------------
  |  Branch (630:9): [True: 0, False: 9.79M]
  ------------------
  631|      0|        case 'F': conspec = CONSPEC_FLOAT_UP; break;
  ------------------
  |  Branch (631:9): [True: 0, False: 9.79M]
  ------------------
  632|      0|        case 'e': conspec = CONSPEC_EXP; break;
  ------------------
  |  Branch (632:9): [True: 0, False: 9.79M]
  ------------------
  633|      0|        case 'E': conspec = CONSPEC_EXP_UP; break;
  ------------------
  |  Branch (633:9): [True: 0, False: 9.79M]
  ------------------
  634|      0|        case 'g': conspec = CONSPEC_F_OR_G; break;
  ------------------
  |  Branch (634:9): [True: 0, False: 9.79M]
  ------------------
  635|      0|        case 'G': conspec = CONSPEC_F_OR_G_UP; break;
  ------------------
  |  Branch (635:9): [True: 0, False: 9.79M]
  ------------------
  636|      0|        case 'a': conspec = CONSPEC_HEX_EXP; break;
  ------------------
  |  Branch (636:9): [True: 0, False: 9.79M]
  ------------------
  637|      0|        case 'A': conspec = CONSPEC_HEX_EXP_UP; break;
  ------------------
  |  Branch (637:9): [True: 0, False: 9.79M]
  ------------------
  638|      0|        case 'c': conspec = CONSPEC_CHAR; break;
  ------------------
  |  Branch (638:9): [True: 0, False: 9.79M]
  ------------------
  639|   625k|        case 's': conspec = CONSPEC_STRING; break;
  ------------------
  |  Branch (639:9): [True: 625k, False: 9.16M]
  ------------------
  640|  4.42k|        case 'p': conspec = CONSPEC_POINTER; break;
  ------------------
  |  Branch (640:9): [True: 4.42k, False: 9.78M]
  ------------------
  641|      0|        case 'n': conspec = CONSPEC_BYTES_SO_FAR; break;
  ------------------
  |  Branch (641:9): [True: 0, False: 9.79M]
  ------------------
  642|      0|        case 'C': conspec = CONSPEC_CHAR; lenmod = LENMOD_LONG; break;
  ------------------
  |  Branch (642:9): [True: 0, False: 9.79M]
  ------------------
  643|      0|        case 'S': conspec = CONSPEC_STRING; lenmod = LENMOD_LONG; break;
  ------------------
  |  Branch (643:9): [True: 0, False: 9.79M]
  ------------------
  644|      0|        case 'm': conspec = CONSPEC_STRERROR; arg_pos = -1; break;
  ------------------
  |  Branch (644:9): [True: 0, False: 9.79M]
  ------------------
  645|      0|        default: conspec = CONSPEC_UNKNOWN;
  ------------------
  |  Branch (645:9): [True: 0, False: 9.79M]
  ------------------
  646|  9.79M|        }
  647|       |
  648|       |      /* Save the args. */
  649|  9.79M|      if (argcount >= max_argspecs)
  ------------------
  |  Branch (649:11): [True: 0, False: 9.79M]
  ------------------
  650|      0|        {
  651|       |          /* We either need to allocate a new array instead of the
  652|       |             caller provided one or realloc the array.  Instead of
  653|       |             using realloc we allocate a new one and release the
  654|       |             original one then. */
  655|      0|          size_t n, newmax;
  656|      0|          argspec_t newarg;
  657|       |
  658|      0|          newmax = max_argspecs + ARGSPECS_BUMP_VALUE;
  ------------------
  |  |  129|      0|#define ARGSPECS_BUMP_VALUE   10
  ------------------
  659|      0|          if (newmax <= max_argspecs)
  ------------------
  |  Branch (659:15): [True: 0, False: 0]
  ------------------
  660|      0|            goto leave_einval;  /* Too many arguments. */
  661|      0|          newarg = calloc (newmax, sizeof *newarg);
  662|      0|          if (!newarg)
  ------------------
  |  Branch (662:15): [True: 0, False: 0]
  ------------------
  663|      0|            goto leave;
  664|      0|          for (n=0; n < argcount; n++)
  ------------------
  |  Branch (664:21): [True: 0, False: 0]
  ------------------
  665|      0|            newarg[n] = argspecs[n];
  666|      0|          if (argspecs != *argspecs_addr)
  ------------------
  |  Branch (666:15): [True: 0, False: 0]
  ------------------
  667|      0|            free (argspecs);
  668|      0|          argspecs = newarg;
  669|      0|          max_argspecs = newmax;
  670|      0|        }
  671|       |
  672|  9.79M|      arg = argspecs + argcount;
  673|  9.79M|      arg->length = s - format + 2;
  674|  9.79M|      arg->flags = flags;
  675|  9.79M|      arg->width = width;
  676|  9.79M|      arg->precision = precision;
  677|  9.79M|      arg->lenmod = lenmod;
  678|  9.79M|      arg->conspec = conspec;
  679|  9.79M|      arg->arg_pos = arg_pos;
  680|  9.79M|      arg->width_pos = width_pos;
  681|  9.79M|      arg->precision_pos = precision_pos;
  682|  9.79M|      compute_type (arg);
  683|  9.79M|      argcount++;
  684|  9.79M|      format = s;
  685|  9.79M|    }
  686|       |
  687|  10.0M|  *argspecs_addr = argspecs;
  688|  10.0M|  *r_argspecs_count = argcount;
  689|  10.0M|  return 0; /* Success.  */
  690|       |
  691|      0| leave_einval:
  692|      0|  _set_errno (EINVAL);
  ------------------
  |  |  113|      0|#define _set_errno(a)  do { errno = (a); } while (0)
  |  |  ------------------
  |  |  |  Branch (113:51): [Folded - Ignored]
  |  |  ------------------
  ------------------
  693|      0| leave:
  694|      0|  if (argspecs != *argspecs_addr)
  ------------------
  |  Branch (694:7): [True: 0, False: 0]
  ------------------
  695|      0|    free (argspecs);
  696|      0|  *argspecs_addr = NULL;
  697|      0|  return -1;
  698|      0|}
estream-printf.c:compute_type:
  345|  9.79M|{
  346|  9.79M|  switch (arg->conspec)
  ------------------
  |  Branch (346:11): [True: 0, False: 9.79M]
  ------------------
  347|  9.79M|    {
  348|      0|    case CONSPEC_UNKNOWN:
  ------------------
  |  Branch (348:5): [True: 0, False: 9.79M]
  ------------------
  349|      0|      arg->vt = VALTYPE_UNSUPPORTED;
  350|      0|      break;
  351|       |
  352|   321k|    case CONSPEC_DECIMAL:
  ------------------
  |  Branch (352:5): [True: 321k, False: 9.47M]
  ------------------
  353|   321k|      switch (arg->lenmod)
  354|   321k|        {
  355|      0|        case LENMOD_CHAR: arg->vt = VALTYPE_SCHAR; break;
  ------------------
  |  Branch (355:9): [True: 0, False: 321k]
  ------------------
  356|      0|        case LENMOD_SHORT: arg->vt = VALTYPE_SHORT; break;
  ------------------
  |  Branch (356:9): [True: 0, False: 321k]
  ------------------
  357|      0|        case LENMOD_LONG: arg->vt = VALTYPE_LONG; break;
  ------------------
  |  Branch (357:9): [True: 0, False: 321k]
  ------------------
  358|      0|        case LENMOD_LONGLONG: arg->vt = VALTYPE_LONGLONG; break;
  ------------------
  |  Branch (358:9): [True: 0, False: 321k]
  ------------------
  359|      0|        case LENMOD_INTMAX: arg->vt = VALTYPE_INTMAX; break;
  ------------------
  |  Branch (359:9): [True: 0, False: 321k]
  ------------------
  360|      0|        case LENMOD_SIZET: arg->vt = VALTYPE_SIZE; break;
  ------------------
  |  Branch (360:9): [True: 0, False: 321k]
  ------------------
  361|      0|        case LENMOD_PTRDIFF: arg->vt = VALTYPE_PTRDIFF; break;
  ------------------
  |  Branch (361:9): [True: 0, False: 321k]
  ------------------
  362|   321k|        default: arg->vt = VALTYPE_INT; break;
  ------------------
  |  Branch (362:9): [True: 321k, False: 0]
  ------------------
  363|   321k|        }
  364|   321k|      break;
  365|       |
  366|   321k|    case CONSPEC_OCTAL:
  ------------------
  |  Branch (366:5): [True: 0, False: 9.79M]
  ------------------
  367|  35.1k|    case CONSPEC_UNSIGNED:
  ------------------
  |  Branch (367:5): [True: 35.1k, False: 9.75M]
  ------------------
  368|  5.74M|    case CONSPEC_HEX:
  ------------------
  |  Branch (368:5): [True: 5.70M, False: 4.08M]
  ------------------
  369|  8.84M|    case CONSPEC_HEX_UP:
  ------------------
  |  Branch (369:5): [True: 3.10M, False: 6.69M]
  ------------------
  370|  8.84M|      switch (arg->lenmod)
  371|  8.84M|        {
  372|      0|        case LENMOD_CHAR: arg->vt = VALTYPE_UCHAR; break;
  ------------------
  |  Branch (372:9): [True: 0, False: 8.84M]
  ------------------
  373|      0|        case LENMOD_SHORT: arg->vt = VALTYPE_USHORT; break;
  ------------------
  |  Branch (373:9): [True: 0, False: 8.84M]
  ------------------
  374|  97.9k|        case LENMOD_LONG: arg->vt = VALTYPE_ULONG; break;
  ------------------
  |  Branch (374:9): [True: 97.9k, False: 8.74M]
  ------------------
  375|      0|        case LENMOD_LONGLONG: arg->vt = VALTYPE_ULONGLONG; break;
  ------------------
  |  Branch (375:9): [True: 0, False: 8.84M]
  ------------------
  376|      0|        case LENMOD_INTMAX: arg->vt = VALTYPE_UINTMAX; break;
  ------------------
  |  Branch (376:9): [True: 0, False: 8.84M]
  ------------------
  377|      0|        case LENMOD_SIZET: arg->vt = VALTYPE_SIZE; break;
  ------------------
  |  Branch (377:9): [True: 0, False: 8.84M]
  ------------------
  378|      0|        case LENMOD_PTRDIFF: arg->vt = VALTYPE_PTRDIFF; break;
  ------------------
  |  Branch (378:9): [True: 0, False: 8.84M]
  ------------------
  379|  8.74M|        default: arg->vt = VALTYPE_UINT; break;
  ------------------
  |  Branch (379:9): [True: 8.74M, False: 97.9k]
  ------------------
  380|  8.84M|        }
  381|  8.84M|      break;
  382|       |
  383|  8.84M|    case CONSPEC_FLOAT:
  ------------------
  |  Branch (383:5): [True: 0, False: 9.79M]
  ------------------
  384|      0|    case CONSPEC_FLOAT_UP:
  ------------------
  |  Branch (384:5): [True: 0, False: 9.79M]
  ------------------
  385|      0|    case CONSPEC_EXP:
  ------------------
  |  Branch (385:5): [True: 0, False: 9.79M]
  ------------------
  386|      0|    case CONSPEC_EXP_UP:
  ------------------
  |  Branch (386:5): [True: 0, False: 9.79M]
  ------------------
  387|      0|    case CONSPEC_F_OR_G:
  ------------------
  |  Branch (387:5): [True: 0, False: 9.79M]
  ------------------
  388|      0|    case CONSPEC_F_OR_G_UP:
  ------------------
  |  Branch (388:5): [True: 0, False: 9.79M]
  ------------------
  389|      0|    case CONSPEC_HEX_EXP:
  ------------------
  |  Branch (389:5): [True: 0, False: 9.79M]
  ------------------
  390|      0|    case CONSPEC_HEX_EXP_UP:
  ------------------
  |  Branch (390:5): [True: 0, False: 9.79M]
  ------------------
  391|      0|      switch (arg->lenmod)
  392|      0|        {
  393|      0|        case LENMOD_LONGDBL: arg->vt = VALTYPE_LONGDOUBLE; break;
  ------------------
  |  Branch (393:9): [True: 0, False: 0]
  ------------------
  394|      0|        case LENMOD_LONG: arg->vt = VALTYPE_DOUBLE; break;
  ------------------
  |  Branch (394:9): [True: 0, False: 0]
  ------------------
  395|      0|        default: arg->vt = VALTYPE_DOUBLE; break;
  ------------------
  |  Branch (395:9): [True: 0, False: 0]
  ------------------
  396|      0|        }
  397|      0|      break;
  398|       |
  399|      0|    case CONSPEC_CHAR:
  ------------------
  |  Branch (399:5): [True: 0, False: 9.79M]
  ------------------
  400|      0|      arg->vt = VALTYPE_INT;
  401|      0|      break;
  402|       |
  403|   625k|    case CONSPEC_STRING:
  ------------------
  |  Branch (403:5): [True: 625k, False: 9.16M]
  ------------------
  404|   625k|      arg->vt = VALTYPE_STRING;
  405|   625k|      break;
  406|       |
  407|  4.42k|    case CONSPEC_POINTER:
  ------------------
  |  Branch (407:5): [True: 4.42k, False: 9.78M]
  ------------------
  408|  4.42k|      arg->vt = VALTYPE_POINTER;
  409|  4.42k|      break;
  410|       |
  411|      0|    case CONSPEC_STRERROR:
  ------------------
  |  Branch (411:5): [True: 0, False: 9.79M]
  ------------------
  412|      0|      arg->vt = VALTYPE_STRING;
  413|      0|      break;
  414|       |
  415|      0|    case CONSPEC_BYTES_SO_FAR:
  ------------------
  |  Branch (415:5): [True: 0, False: 9.79M]
  ------------------
  416|      0|      switch (arg->lenmod)
  417|      0|        {
  418|      0|        case LENMOD_CHAR: arg->vt = VALTYPE_SCHAR_PTR; break;
  ------------------
  |  Branch (418:9): [True: 0, False: 0]
  ------------------
  419|      0|        case LENMOD_SHORT: arg->vt = VALTYPE_SHORT_PTR; break;
  ------------------
  |  Branch (419:9): [True: 0, False: 0]
  ------------------
  420|      0|        case LENMOD_LONG: arg->vt = VALTYPE_LONG_PTR; break;
  ------------------
  |  Branch (420:9): [True: 0, False: 0]
  ------------------
  421|      0|        case LENMOD_LONGLONG: arg->vt = VALTYPE_LONGLONG_PTR; break;
  ------------------
  |  Branch (421:9): [True: 0, False: 0]
  ------------------
  422|      0|        case LENMOD_INTMAX: arg->vt = VALTYPE_INTMAX_PTR; break;
  ------------------
  |  Branch (422:9): [True: 0, False: 0]
  ------------------
  423|      0|        case LENMOD_SIZET: arg->vt = VALTYPE_SIZE_PTR; break;
  ------------------
  |  Branch (423:9): [True: 0, False: 0]
  ------------------
  424|      0|        case LENMOD_PTRDIFF: arg->vt = VALTYPE_PTRDIFF_PTR; break;
  ------------------
  |  Branch (424:9): [True: 0, False: 0]
  ------------------
  425|      0|        default: arg->vt = VALTYPE_INT_PTR; break;
  ------------------
  |  Branch (425:9): [True: 0, False: 0]
  ------------------
  426|      0|        }
  427|      0|      break;
  428|       |
  429|  9.79M|    }
  430|  9.79M|}
estream-printf.c:read_values:
  706|  10.0M|{
  707|  10.0M|  int validx;
  708|       |
  709|  19.8M|  for (validx=0; validx < valuetable_len; validx++)
  ------------------
  |  Branch (709:18): [True: 9.79M, False: 10.0M]
  ------------------
  710|  9.79M|    {
  711|  9.79M|      value_t *value = &valuetable[validx].value;
  712|  9.79M|      valtype_t vt = valuetable[validx].vt;
  713|       |
  714|  9.79M|      switch (vt)
  715|  9.79M|        {
  716|      0|        case VALTYPE_CHAR: value->a_char = va_arg (vaargs, int); break;
  ------------------
  |  Branch (716:9): [True: 0, False: 9.79M]
  ------------------
  717|      0|        case VALTYPE_CHAR_PTR:
  ------------------
  |  Branch (717:9): [True: 0, False: 9.79M]
  ------------------
  718|      0|          value->a_char_ptr = va_arg (vaargs, char *);
  719|      0|          break;
  720|      0|        case VALTYPE_SCHAR: value->a_schar = va_arg (vaargs, int); break;
  ------------------
  |  Branch (720:9): [True: 0, False: 9.79M]
  ------------------
  721|      0|        case VALTYPE_SCHAR_PTR:
  ------------------
  |  Branch (721:9): [True: 0, False: 9.79M]
  ------------------
  722|      0|          value->a_schar_ptr = va_arg (vaargs, signed char *);
  723|      0|          break;
  724|      0|        case VALTYPE_UCHAR: value->a_uchar = va_arg (vaargs, int); break;
  ------------------
  |  Branch (724:9): [True: 0, False: 9.79M]
  ------------------
  725|      0|        case VALTYPE_SHORT: value->a_short = va_arg (vaargs, int); break;
  ------------------
  |  Branch (725:9): [True: 0, False: 9.79M]
  ------------------
  726|      0|        case VALTYPE_USHORT: value->a_ushort = va_arg (vaargs, int); break;
  ------------------
  |  Branch (726:9): [True: 0, False: 9.79M]
  ------------------
  727|      0|        case VALTYPE_SHORT_PTR:
  ------------------
  |  Branch (727:9): [True: 0, False: 9.79M]
  ------------------
  728|      0|          value->a_short_ptr = va_arg (vaargs, short *);
  729|      0|          break;
  730|   321k|        case VALTYPE_INT:
  ------------------
  |  Branch (730:9): [True: 321k, False: 9.47M]
  ------------------
  731|   321k|          value->a_int = va_arg (vaargs, int);
  732|   321k|          break;
  733|      0|        case VALTYPE_INT_PTR:
  ------------------
  |  Branch (733:9): [True: 0, False: 9.79M]
  ------------------
  734|      0|          value->a_int_ptr = va_arg (vaargs, int *);
  735|      0|          break;
  736|  8.74M|        case VALTYPE_UINT:
  ------------------
  |  Branch (736:9): [True: 8.74M, False: 1.04M]
  ------------------
  737|  8.74M|          value->a_uint = va_arg (vaargs, unsigned int);
  738|  8.74M|          break;
  739|      0|        case VALTYPE_LONG:
  ------------------
  |  Branch (739:9): [True: 0, False: 9.79M]
  ------------------
  740|      0|          value->a_long = va_arg (vaargs, long);
  741|      0|          break;
  742|  97.9k|        case VALTYPE_ULONG:
  ------------------
  |  Branch (742:9): [True: 97.9k, False: 9.69M]
  ------------------
  743|  97.9k|          value->a_ulong = va_arg (vaargs, unsigned long);
  744|  97.9k|          break;
  745|      0|        case VALTYPE_LONG_PTR:
  ------------------
  |  Branch (745:9): [True: 0, False: 9.79M]
  ------------------
  746|      0|          value->a_long_ptr = va_arg (vaargs, long *);
  747|      0|          break;
  748|      0|#ifdef HAVE_LONG_LONG_INT
  749|      0|        case VALTYPE_LONGLONG:
  ------------------
  |  Branch (749:9): [True: 0, False: 9.79M]
  ------------------
  750|      0|          value->a_longlong = va_arg (vaargs, long long int);
  751|      0|          break;
  752|      0|        case VALTYPE_ULONGLONG:
  ------------------
  |  Branch (752:9): [True: 0, False: 9.79M]
  ------------------
  753|      0|          value->a_ulonglong = va_arg (vaargs, unsigned long long int);
  754|      0|          break;
  755|      0|        case VALTYPE_LONGLONG_PTR:
  ------------------
  |  Branch (755:9): [True: 0, False: 9.79M]
  ------------------
  756|      0|          value->a_longlong_ptr = va_arg (vaargs, long long *);
  757|      0|          break;
  758|      0|#endif
  759|      0|        case VALTYPE_DOUBLE:
  ------------------
  |  Branch (759:9): [True: 0, False: 9.79M]
  ------------------
  760|      0|          value->a_double = va_arg (vaargs, double);
  761|      0|          break;
  762|      0|#ifdef HAVE_LONG_DOUBLE
  763|      0|        case VALTYPE_LONGDOUBLE:
  ------------------
  |  Branch (763:9): [True: 0, False: 9.79M]
  ------------------
  764|      0|          value->a_longdouble = va_arg (vaargs, long double);
  765|      0|          break;
  766|      0|#endif
  767|   625k|        case VALTYPE_STRING:
  ------------------
  |  Branch (767:9): [True: 625k, False: 9.16M]
  ------------------
  768|   625k|          value->a_string = va_arg (vaargs, const char *);
  769|   625k|          break;
  770|  4.42k|        case VALTYPE_POINTER:
  ------------------
  |  Branch (770:9): [True: 4.42k, False: 9.78M]
  ------------------
  771|  4.42k|          value->a_void_ptr = va_arg (vaargs, void *);
  772|  4.42k|          break;
  773|      0|#ifdef HAVE_INTMAX_T
  774|      0|        case VALTYPE_INTMAX:
  ------------------
  |  Branch (774:9): [True: 0, False: 9.79M]
  ------------------
  775|      0|          value->a_intmax = va_arg (vaargs, intmax_t);
  776|      0|          break;
  777|      0|        case VALTYPE_INTMAX_PTR:
  ------------------
  |  Branch (777:9): [True: 0, False: 9.79M]
  ------------------
  778|      0|          value->a_intmax_ptr = va_arg (vaargs, intmax_t *);
  779|      0|          break;
  780|      0|#endif
  781|      0|#ifdef HAVE_UINTMAX_T
  782|      0|        case VALTYPE_UINTMAX:
  ------------------
  |  Branch (782:9): [True: 0, False: 9.79M]
  ------------------
  783|      0|          value->a_uintmax = va_arg (vaargs, uintmax_t);
  784|      0|          break;
  785|      0|#endif
  786|      0|        case VALTYPE_SIZE:
  ------------------
  |  Branch (786:9): [True: 0, False: 9.79M]
  ------------------
  787|      0|          value->a_size = va_arg (vaargs, size_t);
  788|      0|          break;
  789|      0|        case VALTYPE_SIZE_PTR:
  ------------------
  |  Branch (789:9): [True: 0, False: 9.79M]
  ------------------
  790|      0|          value->a_size_ptr = va_arg (vaargs, size_t *);
  791|      0|          break;
  792|      0|#ifdef HAVE_PTRDIFF_T
  793|      0|        case VALTYPE_PTRDIFF:
  ------------------
  |  Branch (793:9): [True: 0, False: 9.79M]
  ------------------
  794|      0|          value->a_ptrdiff = va_arg (vaargs, ptrdiff_t);
  795|      0|          break;
  796|      0|        case VALTYPE_PTRDIFF_PTR:
  ------------------
  |  Branch (796:9): [True: 0, False: 9.79M]
  ------------------
  797|      0|          value->a_ptrdiff_ptr = va_arg (vaargs, ptrdiff_t *);
  798|      0|          break;
  799|      0|#endif
  800|      0|        default: /* Unsupported type.  */
  ------------------
  |  Branch (800:9): [True: 0, False: 9.79M]
  ------------------
  801|      0|          return -1;
  802|  9.79M|        }
  803|  9.79M|    }
  804|  10.0M|  return 0;
  805|  10.0M|}
estream-printf.c:do_format:
 1354|  10.0M|{
 1355|  10.0M|  int rc = 0;
 1356|  10.0M|  const char *s;
 1357|  10.0M|  argspec_t arg = argspecs;
 1358|  10.0M|  int argidx = 0; /* Only used for assertion.  */
 1359|  10.0M|  size_t n;
 1360|  10.0M|  value_t value;
 1361|  10.0M|  int string_no = 0;  /* Number of processed "%s" args.  */
 1362|       |
 1363|  10.0M|  s = format;
 1364|   162M|  while ( *s )
  ------------------
  |  Branch (1364:11): [True: 152M, False: 10.0M]
  ------------------
 1365|   152M|    {
 1366|   152M|      if (*s != '%')
  ------------------
  |  Branch (1366:11): [True: 142M, False: 9.79M]
  ------------------
 1367|   142M|        {
 1368|   142M|          s++;
 1369|   142M|          continue;
 1370|   142M|        }
 1371|  9.79M|      if (s != format)
  ------------------
  |  Branch (1371:11): [True: 9.56M, False: 223k]
  ------------------
 1372|  9.56M|        {
 1373|  9.56M|          rc = outfnc (outfncarg, format, (n=s-format));
 1374|  9.56M|          if (rc)
  ------------------
  |  Branch (1374:15): [True: 0, False: 9.56M]
  ------------------
 1375|      0|            return rc;
 1376|  9.56M|          *nbytes += n;
 1377|  9.56M|        }
 1378|  9.79M|      if (s[1] == '%')
  ------------------
  |  Branch (1378:11): [True: 0, False: 9.79M]
  ------------------
 1379|      0|        {
 1380|       |          /* Note that this code ignores one trailing percent escape -
 1381|       |             this is however okay as the args parser must have
 1382|       |             detected this already.  */
 1383|      0|          rc = outfnc (outfncarg, s, 1);
 1384|      0|          if (rc)
  ------------------
  |  Branch (1384:15): [True: 0, False: 0]
  ------------------
 1385|      0|            return rc;
 1386|      0|          *nbytes += 1;
 1387|      0|          s += 2;
 1388|      0|          format = s;
 1389|      0|          continue;
 1390|      0|        }
 1391|       |
 1392|       |      /* Save the next start.  */
 1393|  9.79M|      s += arg->length;
 1394|  9.79M|      format = s;
 1395|       |
 1396|  9.79M|      gpgrt_assert (argidx < argspecs_len);
  ------------------
  |  |  577|  9.79M|  ((expr)                                                       \
  |  |  ------------------
  |  |  |  Branch (577:4): [True: 9.79M, False: 0]
  |  |  ------------------
  |  |  578|  9.79M|   ? (void) 0                                                   \
  |  |  579|  9.79M|   : _gpgrt__log_assert (#expr, __FILE__, __LINE__, __FUNCTION__))
  ------------------
 1397|      0|      argidx++;
 1398|       |
 1399|       |      /* Apply indirect field width and precision values.  */
 1400|  9.79M|      if (arg->width == STAR_FIELD_VALUE)
  ------------------
  |  |  133|  9.79M|#define STAR_FIELD_VALUE (-2)
  ------------------
  |  Branch (1400:11): [True: 0, False: 9.79M]
  ------------------
 1401|      0|        {
 1402|      0|          gpgrt_assert (valuetable[arg->width_pos-1].vt == VALTYPE_INT);
  ------------------
  |  |  577|      0|  ((expr)                                                       \
  |  |  ------------------
  |  |  |  Branch (577:4): [True: 0, False: 0]
  |  |  ------------------
  |  |  578|      0|   ? (void) 0                                                   \
  |  |  579|      0|   : _gpgrt__log_assert (#expr, __FILE__, __LINE__, __FUNCTION__))
  ------------------
 1403|      0|          arg->width = valuetable[arg->width_pos-1].value.a_int;
 1404|      0|          if (arg->width < 0)
  ------------------
  |  Branch (1404:15): [True: 0, False: 0]
  ------------------
 1405|      0|            {
 1406|      0|              arg->width = -arg->width;
 1407|      0|              arg->flags |= FLAG_LEFT_JUST;
  ------------------
  |  |  137|      0|#define FLAG_LEFT_JUST  2
  ------------------
 1408|      0|            }
 1409|      0|        }
 1410|  9.79M|      if (arg->precision == STAR_FIELD_VALUE)
  ------------------
  |  |  133|  9.79M|#define STAR_FIELD_VALUE (-2)
  ------------------
  |  Branch (1410:11): [True: 3, False: 9.79M]
  ------------------
 1411|      3|        {
 1412|      3|          gpgrt_assert (valuetable[arg->precision_pos-1].vt == VALTYPE_INT);
  ------------------
  |  |  577|      3|  ((expr)                                                       \
  |  |  ------------------
  |  |  |  Branch (577:4): [True: 3, False: 0]
  |  |  ------------------
  |  |  578|      3|   ? (void) 0                                                   \
  |  |  579|      3|   : _gpgrt__log_assert (#expr, __FILE__, __LINE__, __FUNCTION__))
  ------------------
 1413|      0|          arg->precision = valuetable[arg->precision_pos-1].value.a_int;
 1414|      3|          if (arg->precision < 0)
  ------------------
  |  Branch (1414:15): [True: 0, False: 3]
  ------------------
 1415|      0|            arg->precision = NO_FIELD_VALUE;
  ------------------
  |  |  132|      0|#define NO_FIELD_VALUE   (-1)
  ------------------
 1416|      3|        }
 1417|       |
 1418|  9.79M|      if (arg->arg_pos == -1 && arg->conspec == CONSPEC_STRERROR)
  ------------------
  |  Branch (1418:11): [True: 0, False: 9.79M]
  |  Branch (1418:33): [True: 0, False: 0]
  ------------------
 1419|      0|        value.a_string = strerror (myerrno);
 1420|  9.79M|      else
 1421|  9.79M|        {
 1422|  9.79M|          gpgrt_assert (arg->vt == valuetable[arg->arg_pos-1].vt);
  ------------------
  |  |  577|  9.79M|  ((expr)                                                       \
  |  |  ------------------
  |  |  |  Branch (577:4): [True: 9.79M, False: 0]
  |  |  ------------------
  |  |  578|  9.79M|   ? (void) 0                                                   \
  |  |  579|  9.79M|   : _gpgrt__log_assert (#expr, __FILE__, __LINE__, __FUNCTION__))
  ------------------
 1423|      0|          value = valuetable[arg->arg_pos-1].value;
 1424|  9.79M|        }
 1425|       |
 1426|      0|      switch (arg->conspec)
  ------------------
  |  Branch (1426:15): [True: 0, False: 9.79M]
  ------------------
 1427|  9.79M|        {
 1428|      0|        case CONSPEC_UNKNOWN: gpgrt_assert (!"bug"); break;
  ------------------
  |  |  577|      0|  ((expr)                                                       \
  |  |  ------------------
  |  |  |  Branch (577:4): [Folded - Ignored]
  |  |  ------------------
  |  |  578|      0|   ? (void) 0                                                   \
  |  |  579|      0|   : _gpgrt__log_assert (#expr, __FILE__, __LINE__, __FUNCTION__))
  ------------------
  |  Branch (1428:9): [True: 0, False: 9.79M]
  ------------------
 1429|       |
 1430|   321k|        case CONSPEC_DECIMAL:
  ------------------
  |  Branch (1430:9): [True: 321k, False: 9.47M]
  ------------------
 1431|   356k|        case CONSPEC_UNSIGNED:
  ------------------
  |  Branch (1431:9): [True: 35.1k, False: 9.75M]
  ------------------
 1432|   356k|        case CONSPEC_OCTAL:
  ------------------
  |  Branch (1432:9): [True: 0, False: 9.79M]
  ------------------
 1433|  6.06M|        case CONSPEC_HEX:
  ------------------
  |  Branch (1433:9): [True: 5.70M, False: 4.08M]
  ------------------
 1434|  9.16M|        case CONSPEC_HEX_UP:
  ------------------
  |  Branch (1434:9): [True: 3.10M, False: 6.69M]
  ------------------
 1435|  9.16M|          rc = pr_integer (outfnc, outfncarg, arg, value, nbytes);
 1436|  9.16M|          break;
 1437|      0|        case CONSPEC_FLOAT:
  ------------------
  |  Branch (1437:9): [True: 0, False: 9.79M]
  ------------------
 1438|      0|        case CONSPEC_FLOAT_UP:
  ------------------
  |  Branch (1438:9): [True: 0, False: 9.79M]
  ------------------
 1439|      0|        case CONSPEC_EXP:
  ------------------
  |  Branch (1439:9): [True: 0, False: 9.79M]
  ------------------
 1440|      0|        case CONSPEC_EXP_UP:
  ------------------
  |  Branch (1440:9): [True: 0, False: 9.79M]
  ------------------
 1441|      0|        case CONSPEC_F_OR_G:
  ------------------
  |  Branch (1441:9): [True: 0, False: 9.79M]
  ------------------
 1442|      0|        case CONSPEC_F_OR_G_UP:
  ------------------
  |  Branch (1442:9): [True: 0, False: 9.79M]
  ------------------
 1443|      0|        case CONSPEC_HEX_EXP:
  ------------------
  |  Branch (1443:9): [True: 0, False: 9.79M]
  ------------------
 1444|      0|        case CONSPEC_HEX_EXP_UP:
  ------------------
  |  Branch (1444:9): [True: 0, False: 9.79M]
  ------------------
 1445|      0|          rc = pr_float (outfnc, outfncarg, arg, value, nbytes);
 1446|      0|          break;
 1447|      0|        case CONSPEC_CHAR:
  ------------------
  |  Branch (1447:9): [True: 0, False: 9.79M]
  ------------------
 1448|      0|          rc = pr_char (outfnc, outfncarg, arg, value, nbytes);
 1449|      0|          break;
 1450|   625k|        case CONSPEC_STRING:
  ------------------
  |  Branch (1450:9): [True: 625k, False: 9.16M]
  ------------------
 1451|   625k|          rc = pr_string (outfnc, outfncarg, arg, value, nbytes,
 1452|   625k|                          sf, sfvalue, string_no++);
 1453|   625k|          break;
 1454|      0|        case CONSPEC_STRERROR:
  ------------------
  |  Branch (1454:9): [True: 0, False: 9.79M]
  ------------------
 1455|      0|          rc = pr_string (outfnc, outfncarg, arg, value, nbytes,
 1456|      0|                          NULL, NULL, 0);
 1457|      0|          break;
 1458|  4.42k|        case CONSPEC_POINTER:
  ------------------
  |  Branch (1458:9): [True: 4.42k, False: 9.78M]
  ------------------
 1459|  4.42k|          rc = pr_pointer (outfnc, outfncarg, arg, value, nbytes);
 1460|  4.42k|          break;
 1461|      0|        case CONSPEC_BYTES_SO_FAR:
  ------------------
  |  Branch (1461:9): [True: 0, False: 9.79M]
  ------------------
 1462|      0|          rc = pr_bytes_so_far (outfnc, outfncarg, arg, value, nbytes);
 1463|      0|          break;
 1464|  9.79M|        }
 1465|  9.79M|      if (rc)
  ------------------
  |  Branch (1465:11): [True: 0, False: 9.79M]
  ------------------
 1466|      0|        return rc;
 1467|  9.79M|      arg++;
 1468|  9.79M|    }
 1469|       |
 1470|       |  /* Print out any trailing stuff. */
 1471|  10.0M|  n = s - format;
 1472|  10.0M|  rc = n? outfnc (outfncarg, format, n) : 0;
  ------------------
  |  Branch (1472:8): [True: 4.42M, False: 5.60M]
  ------------------
 1473|  10.0M|  if (!rc)
  ------------------
  |  Branch (1473:7): [True: 10.0M, False: 0]
  ------------------
 1474|  10.0M|    *nbytes += n;
 1475|       |
 1476|  10.0M|  return rc;
 1477|  10.0M|}
estream-printf.c:pr_integer:
  840|  9.16M|{
  841|  9.16M|  int rc;
  842|  9.16M|#ifdef HAVE_LONG_LONG_INT
  843|  9.16M|  unsigned long long aulong;
  844|       |#else
  845|       |  unsigned long aulong;
  846|       |#endif
  847|  9.16M|  char numbuf[100];
  848|  9.16M|  char *p, *pend;
  849|  9.16M|  size_t n;
  850|  9.16M|  char signchar = 0;
  851|  9.16M|  int n_prec;  /* Number of extra precision digits required.  */
  852|  9.16M|  int n_extra; /* Extra number of prefix or sign characters.  */
  853|       |
  854|  9.16M|  if (arg->conspec == CONSPEC_DECIMAL)
  ------------------
  |  Branch (854:7): [True: 321k, False: 8.84M]
  ------------------
  855|   321k|    {
  856|   321k|#ifdef HAVE_LONG_LONG_INT
  857|   321k|      long long along;
  858|       |#else
  859|       |      long along;
  860|       |#endif
  861|       |
  862|   321k|      switch (arg->vt)
  863|   321k|        {
  864|      0|        case VALTYPE_SHORT: along = value.a_short; break;
  ------------------
  |  Branch (864:9): [True: 0, False: 321k]
  ------------------
  865|   321k|        case VALTYPE_INT: along = value.a_int; break;
  ------------------
  |  Branch (865:9): [True: 321k, False: 0]
  ------------------
  866|      0|        case VALTYPE_LONG: along = value.a_long; break;
  ------------------
  |  Branch (866:9): [True: 0, False: 321k]
  ------------------
  867|      0|#ifdef HAVE_LONG_LONG_INT
  868|      0|        case VALTYPE_LONGLONG: along = value.a_longlong; break;
  ------------------
  |  Branch (868:9): [True: 0, False: 321k]
  ------------------
  869|      0|        case VALTYPE_SIZE: along = value.a_size; break;
  ------------------
  |  Branch (869:9): [True: 0, False: 321k]
  ------------------
  870|      0|# ifdef HAVE_INTMAX_T
  871|      0|        case VALTYPE_INTMAX: along = value.a_intmax; break;
  ------------------
  |  Branch (871:9): [True: 0, False: 321k]
  ------------------
  872|      0|# endif
  873|      0|# ifdef HAVE_PTRDIFF_T
  874|      0|        case VALTYPE_PTRDIFF: along = value.a_ptrdiff; break;
  ------------------
  |  Branch (874:9): [True: 0, False: 321k]
  ------------------
  875|      0|# endif
  876|      0|#endif /*HAVE_LONG_LONG_INT*/
  877|      0|        default:
  ------------------
  |  Branch (877:9): [True: 0, False: 321k]
  ------------------
  878|      0|          return -1;
  879|   321k|        }
  880|   321k|      if (along < 0)
  ------------------
  |  Branch (880:11): [True: 0, False: 321k]
  ------------------
  881|      0|        {
  882|      0|          aulong = -along;
  883|      0|          signchar = '-';
  884|      0|        }
  885|   321k|      else
  886|   321k|        aulong = along;
  887|   321k|    }
  888|  8.84M|  else
  889|  8.84M|    {
  890|  8.84M|      switch (arg->vt)
  891|  8.84M|        {
  892|      0|        case VALTYPE_USHORT: aulong = value.a_ushort; break;
  ------------------
  |  Branch (892:9): [True: 0, False: 8.84M]
  ------------------
  893|  8.74M|        case VALTYPE_UINT: aulong = value.a_uint; break;
  ------------------
  |  Branch (893:9): [True: 8.74M, False: 97.9k]
  ------------------
  894|  97.9k|        case VALTYPE_ULONG: aulong = value.a_ulong; break;
  ------------------
  |  Branch (894:9): [True: 97.9k, False: 8.74M]
  ------------------
  895|      0|#ifdef HAVE_LONG_LONG_INT
  896|      0|        case VALTYPE_ULONGLONG: aulong = value.a_ulonglong; break;
  ------------------
  |  Branch (896:9): [True: 0, False: 8.84M]
  ------------------
  897|      0|        case VALTYPE_SIZE: aulong = value.a_size; break;
  ------------------
  |  Branch (897:9): [True: 0, False: 8.84M]
  ------------------
  898|      0|# ifdef HAVE_UINTMAX_T
  899|      0|        case VALTYPE_UINTMAX: aulong = value.a_uintmax; break;
  ------------------
  |  Branch (899:9): [True: 0, False: 8.84M]
  ------------------
  900|      0|# endif
  901|      0|# ifdef HAVE_PTRDIFF_T
  902|      0|        case VALTYPE_PTRDIFF: aulong = value.a_ptrdiff; break;
  ------------------
  |  Branch (902:9): [True: 0, False: 8.84M]
  ------------------
  903|      0|# endif
  904|      0|#endif /*HAVE_LONG_LONG_INT*/
  905|      0|        default:
  ------------------
  |  Branch (905:9): [True: 0, False: 8.84M]
  ------------------
  906|      0|          return -1;
  907|  8.84M|        }
  908|  8.84M|    }
  909|       |
  910|  9.16M|  if (signchar == '-')
  ------------------
  |  Branch (910:7): [True: 0, False: 9.16M]
  ------------------
  911|      0|    ;
  912|  9.16M|  else if ((arg->flags & FLAG_PLUS_SIGN))
  ------------------
  |  |  138|  9.16M|#define FLAG_PLUS_SIGN  4
  ------------------
  |  Branch (912:12): [True: 0, False: 9.16M]
  ------------------
  913|      0|    signchar = '+';
  914|  9.16M|  else if ((arg->flags & FLAG_SPACE_PLUS))
  ------------------
  |  |  139|  9.16M|#define FLAG_SPACE_PLUS 8
  ------------------
  |  Branch (914:12): [True: 0, False: 9.16M]
  ------------------
  915|      0|    signchar = ' ';
  916|       |
  917|  9.16M|  n_extra = !!signchar;
  918|       |
  919|       |  /* We build the string up backwards.  */
  920|  9.16M|  p = pend = numbuf + DIM(numbuf);
  ------------------
  |  |   93|  9.16M|# define DIM(array) (sizeof (array) / sizeof (*array))
  ------------------
  921|  9.16M|  if ((!aulong && !arg->precision))
  ------------------
  |  Branch (921:8): [True: 2.12M, False: 7.03M]
  |  Branch (921:19): [True: 0, False: 2.12M]
  ------------------
  922|      0|    ;
  923|  9.16M|  else if (arg->conspec == CONSPEC_DECIMAL
  ------------------
  |  Branch (923:12): [True: 321k, False: 8.84M]
  ------------------
  924|  9.16M|           || arg->conspec == CONSPEC_UNSIGNED)
  ------------------
  |  Branch (924:15): [True: 35.1k, False: 8.80M]
  ------------------
  925|   356k|    {
  926|   356k|      int grouping = -1;
  927|   356k|      const char * grouping_string =
  928|   356k|#ifdef HAVE_LANGINFO_THOUSEP
  929|   356k|        nl_langinfo(THOUSEP);
  930|       |#else
  931|       |        "'";
  932|       |#endif
  933|       |
  934|   356k|      do
  935|   484k|        {
  936|   484k|          if ((arg->flags & FLAG_GROUPING)
  ------------------
  |  |  136|   484k|#define FLAG_GROUPING   1
  ------------------
  |  Branch (936:15): [True: 0, False: 484k]
  ------------------
  937|   484k|              && (++grouping == 3) && *grouping_string)
  ------------------
  |  Branch (937:18): [True: 0, False: 0]
  |  Branch (937:39): [True: 0, False: 0]
  ------------------
  938|      0|            {
  939|      0|              *--p = *grouping_string;
  940|      0|              grouping = 0;
  941|      0|            }
  942|   484k|          *--p = '0' + (aulong % 10);
  943|   484k|          aulong /= 10;
  944|   484k|        }
  945|   484k|      while (aulong);
  ------------------
  |  Branch (945:14): [True: 127k, False: 356k]
  ------------------
  946|   356k|    }
  947|  8.80M|  else if (arg->conspec == CONSPEC_OCTAL)
  ------------------
  |  Branch (947:12): [True: 0, False: 8.80M]
  ------------------
  948|      0|    {
  949|      0|      do
  950|      0|        {
  951|      0|          *--p = '0' + (aulong % 8);
  952|      0|          aulong /= 8;
  953|      0|        }
  954|      0|      while (aulong);
  ------------------
  |  Branch (954:14): [True: 0, False: 0]
  ------------------
  955|      0|      if ((arg->flags & FLAG_ALT_CONV) && *p != '0')
  ------------------
  |  |  140|      0|#define FLAG_ALT_CONV   16
  ------------------
  |  Branch (955:11): [True: 0, False: 0]
  |  Branch (955:43): [True: 0, False: 0]
  ------------------
  956|      0|        *--p = '0';
  957|      0|    }
  958|  8.80M|  else /* HEX or HEXUP */
  959|  8.80M|    {
  960|  8.80M|      const char *digits = ((arg->conspec == CONSPEC_HEX)
  ------------------
  |  Branch (960:29): [True: 5.70M, False: 3.10M]
  ------------------
  961|  8.80M|                            ? "0123456789abcdef" : "0123456789ABCDEF");
  962|  8.80M|      do
  963|  15.2M|        {
  964|  15.2M|          *--p = digits[(aulong % 16)];
  965|  15.2M|          aulong /= 16;
  966|  15.2M|        }
  967|  15.2M|      while (aulong);
  ------------------
  |  Branch (967:14): [True: 6.49M, False: 8.80M]
  ------------------
  968|  8.80M|      if ((arg->flags & FLAG_ALT_CONV))
  ------------------
  |  |  140|  8.80M|#define FLAG_ALT_CONV   16
  ------------------
  |  Branch (968:11): [True: 0, False: 8.80M]
  ------------------
  969|      0|        n_extra += 2;
  970|  8.80M|    }
  971|       |
  972|  9.16M|  n = pend - p;
  973|       |
  974|  9.16M|  if ((arg->flags & FLAG_ZERO_PAD)
  ------------------
  |  |  141|  9.16M|#define FLAG_ZERO_PAD   32
  ------------------
  |  Branch (974:7): [True: 8.80M, False: 356k]
  ------------------
  975|  9.16M|      && arg->precision == NO_FIELD_VALUE && !(arg->flags & FLAG_LEFT_JUST)
  ------------------
  |  |  132|  17.9M|#define NO_FIELD_VALUE   (-1)
  ------------------
                    && arg->precision == NO_FIELD_VALUE && !(arg->flags & FLAG_LEFT_JUST)
  ------------------
  |  |  137|  8.80M|#define FLAG_LEFT_JUST  2
  ------------------
  |  Branch (975:10): [True: 8.80M, False: 0]
  |  Branch (975:46): [True: 8.80M, False: 0]
  ------------------
  976|  9.16M|      && n && arg->width - n_extra > n )
  ------------------
  |  Branch (976:10): [True: 8.80M, False: 0]
  |  Branch (976:15): [True: 2.40M, False: 6.39M]
  ------------------
  977|  2.40M|    n_prec = arg->width - n_extra - n;
  978|  6.75M|  else if (arg->precision > 0 && arg->precision > n)
  ------------------
  |  Branch (978:12): [True: 0, False: 6.75M]
  |  Branch (978:34): [True: 0, False: 0]
  ------------------
  979|      0|    n_prec = arg->precision - n;
  980|  6.75M|  else
  981|  6.75M|    n_prec = 0;
  982|       |
  983|  9.16M|  if (!(arg->flags & FLAG_LEFT_JUST)
  ------------------
  |  |  137|  9.16M|#define FLAG_LEFT_JUST  2
  ------------------
  |  Branch (983:7): [True: 9.16M, False: 0]
  ------------------
  984|  9.16M|      && arg->width >= 0 && arg->width - n_extra > n
  ------------------
  |  Branch (984:10): [True: 8.80M, False: 356k]
  |  Branch (984:29): [True: 2.40M, False: 6.39M]
  ------------------
  985|  9.16M|      && arg->width - n_extra - n >= n_prec )
  ------------------
  |  Branch (985:10): [True: 2.40M, False: 0]
  ------------------
  986|  2.40M|    {
  987|  2.40M|      rc = pad_out (outfnc, outfncarg, ' ',
  988|  2.40M|                    arg->width - n_extra - n - n_prec, nbytes);
  989|  2.40M|      if (rc)
  ------------------
  |  Branch (989:11): [True: 0, False: 2.40M]
  ------------------
  990|      0|        return rc;
  991|  2.40M|    }
  992|       |
  993|  9.16M|  if (signchar)
  ------------------
  |  Branch (993:7): [True: 0, False: 9.16M]
  ------------------
  994|      0|    {
  995|      0|      rc = outfnc (outfncarg, &signchar, 1);
  996|      0|      if (rc)
  ------------------
  |  Branch (996:11): [True: 0, False: 0]
  ------------------
  997|      0|        return rc;
  998|      0|      *nbytes += 1;
  999|      0|    }
 1000|       |
 1001|  9.16M|  if ((arg->flags & FLAG_ALT_CONV)
  ------------------
  |  |  140|  9.16M|#define FLAG_ALT_CONV   16
  ------------------
  |  Branch (1001:7): [True: 0, False: 9.16M]
  ------------------
 1002|  9.16M|      && (arg->conspec == CONSPEC_HEX || arg->conspec == CONSPEC_HEX_UP))
  ------------------
  |  Branch (1002:11): [True: 0, False: 0]
  |  Branch (1002:42): [True: 0, False: 0]
  ------------------
 1003|      0|    {
 1004|      0|      rc = outfnc (outfncarg, arg->conspec == CONSPEC_HEX? "0x": "0X", 2);
  ------------------
  |  Branch (1004:31): [True: 0, False: 0]
  ------------------
 1005|      0|      if (rc)
  ------------------
  |  Branch (1005:11): [True: 0, False: 0]
  ------------------
 1006|      0|        return rc;
 1007|      0|      *nbytes += 2;
 1008|      0|    }
 1009|       |
 1010|  9.16M|  if (n_prec)
  ------------------
  |  Branch (1010:7): [True: 2.40M, False: 6.75M]
  ------------------
 1011|  2.40M|    {
 1012|  2.40M|      rc = pad_out (outfnc, outfncarg, '0', n_prec, nbytes);
 1013|  2.40M|      if (rc)
  ------------------
  |  Branch (1013:11): [True: 0, False: 2.40M]
  ------------------
 1014|      0|        return rc;
 1015|  2.40M|    }
 1016|       |
 1017|  9.16M|  rc = outfnc (outfncarg, p, pend - p);
 1018|  9.16M|  if (rc)
  ------------------
  |  Branch (1018:7): [True: 0, False: 9.16M]
  ------------------
 1019|      0|    return rc;
 1020|  9.16M|  *nbytes += pend - p;
 1021|       |
 1022|  9.16M|  if ((arg->flags & FLAG_LEFT_JUST)
  ------------------
  |  |  137|  9.16M|#define FLAG_LEFT_JUST  2
  ------------------
  |  Branch (1022:7): [True: 0, False: 9.16M]
  ------------------
 1023|  9.16M|      && arg->width >= 0 && arg->width - n_extra - n_prec > n)
  ------------------
  |  Branch (1023:10): [True: 0, False: 0]
  |  Branch (1023:29): [True: 0, False: 0]
  ------------------
 1024|      0|    {
 1025|      0|      rc = pad_out (outfnc, outfncarg, ' ',
 1026|      0|                    arg->width - n_extra - n_prec - n, nbytes);
 1027|      0|      if (rc)
  ------------------
  |  Branch (1027:11): [True: 0, False: 0]
  ------------------
 1028|      0|        return rc;
 1029|      0|    }
 1030|       |
 1031|  9.16M|  return 0;
 1032|  9.16M|}
estream-printf.c:pad_out:
  814|  4.81M|{
  815|  4.81M|  char buf[32];
  816|  4.81M|  size_t n;
  817|  4.81M|  int rc;
  818|       |
  819|  7.22M|  while (count > 0)
  ------------------
  |  Branch (819:10): [True: 2.40M, False: 4.81M]
  ------------------
  820|  2.40M|    {
  821|  2.40M|      n = (count <= sizeof buf)? count : sizeof buf;
  ------------------
  |  Branch (821:11): [True: 2.40M, False: 0]
  ------------------
  822|  2.40M|      memset (buf, padchar, n);
  823|  2.40M|      rc = outfnc (outfncarg, buf, n);
  824|  2.40M|      if (rc)
  ------------------
  |  Branch (824:11): [True: 0, False: 2.40M]
  ------------------
  825|      0|        return rc;
  826|  2.40M|      *nbytes += n;
  827|  2.40M|      count -= n;
  828|  2.40M|    }
  829|       |
  830|  4.81M|  return 0;
  831|  4.81M|}
estream-printf.c:pr_string:
 1190|   625k|{
 1191|   625k|  int rc;
 1192|   625k|  size_t n;
 1193|   625k|  const char *string, *s;
 1194|       |
 1195|   625k|  if (arg->vt != VALTYPE_STRING)
  ------------------
  |  Branch (1195:7): [True: 0, False: 625k]
  ------------------
 1196|      0|    return -1;
 1197|   625k|  if (sf)
  ------------------
  |  Branch (1197:7): [True: 625k, False: 6]
  ------------------
 1198|   625k|    string = sf (value.a_string, string_no, sfvalue);
 1199|      6|  else
 1200|      6|    string = value.a_string;
 1201|       |
 1202|   625k|  if (!string)
  ------------------
  |  Branch (1202:7): [True: 0, False: 625k]
  ------------------
 1203|      0|    string = "(null)";
 1204|   625k|  if (arg->precision >= 0)
  ------------------
  |  Branch (1204:7): [True: 3, False: 625k]
  ------------------
 1205|      3|    {
 1206|       |      /* Test for nul after N so that we can pass a non-nul terminated
 1207|       |         string.  */
 1208|     57|      for (n=0,s=string; n < arg->precision && *s; s++)
  ------------------
  |  Branch (1208:26): [True: 54, False: 3]
  |  Branch (1208:48): [True: 54, False: 0]
  ------------------
 1209|     54|        n++;
 1210|      3|    }
 1211|   625k|  else
 1212|   625k|    n = strlen (string);
 1213|       |
 1214|   625k|  if (!(arg->flags & FLAG_LEFT_JUST)
  ------------------
  |  |  137|   625k|#define FLAG_LEFT_JUST  2
  ------------------
  |  Branch (1214:7): [True: 625k, False: 0]
  ------------------
 1215|   625k|      && arg->width >= 0 && arg->width > n )
  ------------------
  |  Branch (1215:10): [True: 0, False: 625k]
  |  Branch (1215:29): [True: 0, False: 0]
  ------------------
 1216|      0|    {
 1217|      0|      rc = pad_out (outfnc, outfncarg, ' ', arg->width - n, nbytes);
 1218|      0|      if (rc)
  ------------------
  |  Branch (1218:11): [True: 0, False: 0]
  ------------------
 1219|      0|        goto leave;
 1220|      0|    }
 1221|       |
 1222|   625k|  rc = outfnc (outfncarg, string, n);
 1223|   625k|  if (rc)
  ------------------
  |  Branch (1223:7): [True: 0, False: 625k]
  ------------------
 1224|      0|    goto leave;
 1225|   625k|  *nbytes += n;
 1226|       |
 1227|   625k|  if ((arg->flags & FLAG_LEFT_JUST)
  ------------------
  |  |  137|   625k|#define FLAG_LEFT_JUST  2
  ------------------
  |  Branch (1227:7): [True: 0, False: 625k]
  ------------------
 1228|   625k|      && arg->width >= 0 && arg->width > n)
  ------------------
  |  Branch (1228:10): [True: 0, False: 0]
  |  Branch (1228:29): [True: 0, False: 0]
  ------------------
 1229|      0|    {
 1230|      0|      rc = pad_out (outfnc, outfncarg, ' ', arg->width - n, nbytes);
 1231|      0|      if (rc)
  ------------------
  |  Branch (1231:11): [True: 0, False: 0]
  ------------------
 1232|      0|        goto leave;
 1233|      0|    }
 1234|       |
 1235|   625k|  rc = 0;
 1236|       |
 1237|   625k| leave:
 1238|   625k|  if (sf) /* Tell the filter to release resources.  */
  ------------------
  |  Branch (1238:7): [True: 625k, False: 6]
  ------------------
 1239|   625k|    sf (value.a_string, -1, sfvalue);
 1240|       |
 1241|   625k|  return rc;
 1242|   625k|}
estream-printf.c:pr_pointer:
 1249|  4.42k|{
 1250|  4.42k|  int rc;
 1251|       |#if defined(HAVE_LONG_LONG_INT) && (SIZEOF_UNSIGNED_LONG < SIZEOF_VOID_P)
 1252|       |  unsigned long long aulong;
 1253|       |#else
 1254|  4.42k|  unsigned long aulong;
 1255|  4.42k|#endif
 1256|  4.42k|  char numbuf[100];
 1257|  4.42k|  char *p, *pend;
 1258|       |
 1259|  4.42k|  if (arg->vt != VALTYPE_POINTER)
  ------------------
  |  Branch (1259:7): [True: 0, False: 4.42k]
  ------------------
 1260|      0|    return -1;
 1261|       |  /* We assume that a pointer can be converted to an unsigned long.
 1262|       |     That is not correct for a 64 bit Windows, but then we assume that
 1263|       |     long long is supported and usable for storing a pointer.  */
 1264|       |#if defined(HAVE_LONG_LONG_INT) && (SIZEOF_UNSIGNED_LONG < SIZEOF_VOID_P)
 1265|       |  aulong = (unsigned long long)value.a_void_ptr;
 1266|       |#else
 1267|  4.42k|  aulong = (unsigned long)value.a_void_ptr;
 1268|  4.42k|#endif
 1269|       |
 1270|  4.42k|  p = pend = numbuf + DIM(numbuf);
  ------------------
  |  |   93|  4.42k|# define DIM(array) (sizeof (array) / sizeof (*array))
  ------------------
 1271|  4.42k|  do
 1272|  30.9k|    {
 1273|  30.9k|      *--p = "0123456789abcdefx"[(aulong % 16)];
 1274|  30.9k|      aulong /= 16;
 1275|  30.9k|    }
 1276|  30.9k|  while (aulong);
  ------------------
  |  Branch (1276:10): [True: 26.5k, False: 4.42k]
  ------------------
 1277|  44.2k|  while ((pend-p) < 2*sizeof (aulong))
  ------------------
  |  Branch (1277:10): [True: 39.7k, False: 4.42k]
  ------------------
 1278|  39.7k|    *--p = '0';
 1279|  4.42k|  *--p = 'x';
 1280|  4.42k|  *--p = '0';
 1281|       |
 1282|  4.42k|  rc = outfnc (outfncarg, p, pend - p);
 1283|  4.42k|  if (rc)
  ------------------
  |  Branch (1283:7): [True: 0, False: 4.42k]
  ------------------
 1284|      0|    return rc;
 1285|  4.42k|  *nbytes += pend - p;
 1286|       |
 1287|  4.42k|  return 0;
 1288|  4.42k|}
estream-printf.c:fixed_buffer_out:
 1704|   215k|{
 1705|   215k|  struct fixed_buffer_parm_s *parm = outfncarg;
 1706|       |
 1707|   215k|  parm->count += buflen;
 1708|       |
 1709|   215k|  if (!parm->buffer)
  ------------------
  |  Branch (1709:7): [True: 0, False: 215k]
  ------------------
 1710|      0|    ;
 1711|   215k|  else if (parm->used + buflen < parm->size)
  ------------------
  |  Branch (1711:12): [True: 215k, False: 0]
  ------------------
 1712|   215k|    {
 1713|       |      /* Handle the common case that everything fits into the buffer
 1714|       |         separately.  */
 1715|   215k|      memcpy (parm->buffer + parm->used, buf, buflen);
 1716|   215k|      parm->used += buflen;
 1717|   215k|    }
 1718|      0|  else
 1719|      0|    {
 1720|       |      /* The slow version of above.  */
 1721|      0|      for ( ;buflen && parm->used < parm->size; buflen--)
  ------------------
  |  Branch (1721:14): [True: 0, False: 0]
  |  Branch (1721:24): [True: 0, False: 0]
  ------------------
 1722|      0|        parm->buffer[parm->used++] = *buf++;
 1723|      0|    }
 1724|       |
 1725|   215k|  return 0;
 1726|   215k|}

_gpgrt_estream_init:
  595|      2|{
  596|      2|  static int initialized;
  597|       |
  598|      2|  if (!initialized)
  ------------------
  |  Branch (598:7): [True: 2, False: 0]
  ------------------
  599|      2|    {
  600|      2|      initialized = 1;
  601|      2|      atexit (do_deinit);
  602|      2|    }
  603|      2|  return 0;
  604|      2|}
_gpgrt_fopen:
 3509|  3.54k|{
 3510|  3.54k|  unsigned int modeflags, cmode, xmode;
 3511|  3.54k|  int create_called = 0;
 3512|  3.54k|  estream_t stream = NULL;
 3513|  3.54k|  void *cookie = NULL;
 3514|  3.54k|  int err;
 3515|  3.54k|  struct cookie_io_functions_s *functions;
 3516|  3.54k|  es_syshd_t syshd;
 3517|  3.54k|  int kind;
 3518|       |
 3519|  3.54k|  err = parse_mode (mode, &modeflags, &xmode, &cmode);
 3520|  3.54k|  if (err)
  ------------------
  |  Branch (3520:7): [True: 0, False: 3.54k]
  ------------------
 3521|      0|    goto leave;
 3522|       |
 3523|       |  /* Convenience hack so that we can use /dev/null on Windows.  */
 3524|       |#ifdef HAVE_W32_SYSTEM
 3525|       |  if (path && !strcmp (path, "/dev/null"))
 3526|       |    path = "nul";
 3527|       |#endif
 3528|       |
 3529|       |#ifdef HAVE_W32_SYSTEM
 3530|       |  if ((xmode & X_SYSOPEN))
 3531|       |    {
 3532|       |      kind = BACKEND_W32;
 3533|       |      functions = &estream_functions_w32;
 3534|       |      syshd.type = ES_SYSHD_HANDLE;
 3535|       |      err = func_file_create_w32 (&cookie, &syshd.u.handle,
 3536|       |                                  path, modeflags, cmode);
 3537|       |    }
 3538|       |  else
 3539|       |#endif /* W32 */
 3540|  3.54k|    {
 3541|  3.54k|      kind = BACKEND_FD;
 3542|  3.54k|      functions = &estream_functions_fd;
 3543|  3.54k|      syshd.type = ES_SYSHD_FD;
  ------------------
  |  | 1255|  3.54k|#define ES_SYSHD_FD     GPGRT_SYSHD_FD
  ------------------
 3544|  3.54k|      err = func_file_create (&cookie, &syshd.u.fd,
 3545|  3.54k|                              path, modeflags, cmode);
 3546|  3.54k|    }
 3547|  3.54k|  if (err)
  ------------------
  |  Branch (3547:7): [True: 2, False: 3.54k]
  ------------------
 3548|      2|    goto leave;
 3549|       |
 3550|  3.54k|  create_called = 1;
 3551|  3.54k|  err = create_stream (&stream, cookie, &syshd, kind,
 3552|  3.54k|                       *functions, modeflags, xmode, 0);
 3553|  3.54k|  if (err)
  ------------------
  |  Branch (3553:7): [True: 0, False: 3.54k]
  ------------------
 3554|      0|    goto leave;
 3555|       |
 3556|  3.54k|  if (stream && path)
  ------------------
  |  Branch (3556:7): [True: 3.54k, False: 0]
  |  Branch (3556:17): [True: 3.54k, False: 0]
  ------------------
 3557|  3.54k|    fname_set_internal (stream, path, 1);
 3558|       |
 3559|  3.54k| leave:
 3560|  3.54k|  if (err && create_called)
  ------------------
  |  Branch (3560:7): [True: 2, False: 3.54k]
  |  Branch (3560:14): [True: 0, False: 2]
  ------------------
 3561|      0|    functions->public.func_close (cookie);
 3562|       |
 3563|  3.54k|  return stream;
 3564|  3.54k|}
_gpgrt__get_std_stream:
 4001|  4.58k|{
 4002|  4.58k|  estream_list_t list_obj;
 4003|  4.58k|  estream_t stream = NULL;
 4004|       |
 4005|  4.58k|  fd %= 3; /* We only allow 0, 1 or 2 but we don't want to return an error. */
 4006|       |
 4007|  4.58k|  lock_list ();
 4008|       |
 4009|  4.58k|  for (list_obj = estream_list; list_obj; list_obj = list_obj->next)
  ------------------
  |  Branch (4009:33): [True: 4.58k, False: 2]
  ------------------
 4010|  4.58k|    if (list_obj->stream && list_obj->stream->intern->is_stdstream
  ------------------
  |  Branch (4010:9): [True: 4.58k, False: 0]
  |  Branch (4010:29): [True: 4.58k, False: 1]
  ------------------
 4011|  4.58k|        && list_obj->stream->intern->stdstream_fd == fd)
  ------------------
  |  Branch (4011:12): [True: 4.58k, False: 1]
  ------------------
 4012|  4.58k|      {
 4013|  4.58k|	stream = list_obj->stream;
 4014|  4.58k|	break;
 4015|  4.58k|      }
 4016|  4.58k|  if (!stream)
  ------------------
  |  Branch (4016:7): [True: 2, False: 4.58k]
  ------------------
 4017|      2|    {
 4018|       |      /* Standard stream not yet created.  We first try to create them
 4019|       |         from registered file descriptors.  */
 4020|      2|      if (!fd && custom_std_fds_valid[0])
  ------------------
  |  Branch (4020:11): [True: 0, False: 2]
  |  Branch (4020:18): [True: 0, False: 0]
  ------------------
 4021|      0|        stream = do_fdopen (custom_std_fds[0], "r", 1, 1);
 4022|      2|      else if (fd == 1 && custom_std_fds_valid[1])
  ------------------
  |  Branch (4022:16): [True: 1, False: 1]
  |  Branch (4022:27): [True: 0, False: 1]
  ------------------
 4023|      0|        stream = do_fdopen (custom_std_fds[1], "a", 1, 1);
 4024|      2|      else if (custom_std_fds_valid[2])
  ------------------
  |  Branch (4024:16): [True: 0, False: 2]
  ------------------
 4025|      0|        stream = do_fdopen (custom_std_fds[2], "a", 1, 1);
 4026|       |
 4027|      2|      if (!stream)
  ------------------
  |  Branch (4027:11): [True: 2, False: 0]
  ------------------
 4028|      2|        {
 4029|       |          /* Second try is to use the standard C streams.  */
 4030|      2|          if (!fd)
  ------------------
  |  Branch (4030:15): [True: 0, False: 2]
  ------------------
 4031|      0|            stream = do_fpopen (stdin, "r", 1, 1);
 4032|      2|          else if (fd == 1)
  ------------------
  |  Branch (4032:20): [True: 1, False: 1]
  ------------------
 4033|      1|            stream = do_fpopen (stdout, "a", 1, 1);
 4034|      1|          else
 4035|      1|            stream = do_fpopen (stderr, "a", 1, 1);
 4036|      2|        }
 4037|       |
 4038|      2|      if (!stream)
  ------------------
  |  Branch (4038:11): [True: 0, False: 2]
  ------------------
 4039|      0|        {
 4040|       |          /* Last try: Create a bit bucket.  */
 4041|      0|          stream = do_fpopen (NULL, fd? "a":"r", 0, 1);
  ------------------
  |  Branch (4041:37): [True: 0, False: 0]
  ------------------
 4042|      0|          if (!stream)
  ------------------
  |  Branch (4042:15): [True: 0, False: 0]
  ------------------
 4043|      0|            {
 4044|      0|              fprintf (stderr, "fatal: error creating a dummy estream"
 4045|      0|                       " for %d: %s\n", fd, strerror (errno));
 4046|      0|              _gpgrt_abort();
 4047|      0|            }
 4048|      0|        }
 4049|       |
 4050|      2|      stream->intern->is_stdstream = 1;
 4051|      2|      stream->intern->stdstream_fd = fd;
 4052|      2|      if (fd == 2)
  ------------------
  |  Branch (4052:11): [True: 1, False: 1]
  ------------------
 4053|      1|        es_set_buffering (stream, NULL, _IOLBF, 0);
 4054|      2|      fname_set_internal (stream,
 4055|      2|                          fd == 0? "[stdin]" :
  ------------------
  |  Branch (4055:27): [True: 0, False: 2]
  ------------------
 4056|      2|                          fd == 1? "[stdout]" : "[stderr]", 0);
  ------------------
  |  Branch (4056:27): [True: 1, False: 1]
  ------------------
 4057|      2|    }
 4058|       |
 4059|  4.58k|  unlock_list ();
 4060|  4.58k|  return stream;
 4061|  4.58k|}
_gpgrt_fclose:
 4144|  3.54k|{
 4145|  3.54k|  int err;
 4146|       |
 4147|  3.54k|  err = do_close (stream, 0, 0);
 4148|       |
 4149|  3.54k|  return err;
 4150|  3.54k|}
_gpgrt_flockfile:
 4302|  4.43M|{
 4303|  4.43M|  lock_stream (stream);
 4304|  4.43M|}
_gpgrt_funlockfile:
 4316|  4.43M|{
 4317|  4.43M|  unlock_stream (stream);
 4318|  4.43M|}
_gpgrt_ferror_unlocked:
 4401|  85.1k|{
 4402|  85.1k|  return stream->intern->indicators.err;
 4403|  85.1k|}
_gpgrt_ferror:
 4408|  4.09k|{
 4409|  4.09k|  int ret;
 4410|       |
 4411|  4.09k|  lock_stream (stream);
 4412|  4.09k|  ret = _gpgrt_ferror_unlocked (stream);
 4413|  4.09k|  unlock_stream (stream);
 4414|       |
 4415|  4.09k|  return ret;
 4416|  4.09k|}
_gpgrt_fflush:
 4457|  4.58k|{
 4458|  4.58k|  int err;
 4459|       |
 4460|  4.58k|  if (stream)
  ------------------
  |  Branch (4460:7): [True: 4.58k, False: 0]
  ------------------
 4461|  4.58k|    {
 4462|  4.58k|      lock_stream (stream);
 4463|  4.58k|      err = do_fflush (stream);
 4464|  4.58k|      unlock_stream (stream);
 4465|  4.58k|    }
 4466|      0|  else
 4467|      0|    {
 4468|      0|      estream_list_t item;
 4469|       |
 4470|      0|      err = 0;
 4471|      0|      lock_list ();
 4472|      0|      for (item = estream_list; item; item = item->next)
  ------------------
  |  Branch (4472:33): [True: 0, False: 0]
  ------------------
 4473|      0|        if (item->stream)
  ------------------
  |  Branch (4473:13): [True: 0, False: 0]
  ------------------
 4474|      0|          {
 4475|      0|            lock_stream (item->stream);
 4476|      0|            err |= do_fflush (item->stream);
 4477|      0|            unlock_stream (item->stream);
 4478|      0|          }
 4479|      0|      unlock_list ();
 4480|      0|    }
 4481|  4.58k|  return err ? EOF : 0;
  ------------------
  |  Branch (4481:10): [True: 0, False: 4.58k]
  ------------------
 4482|  4.58k|}
_gpgrt_fseeko:
 4500|  4.46k|{
 4501|  4.46k|  int err;
 4502|       |
 4503|  4.46k|  lock_stream (stream);
 4504|  4.46k|  err = es_seek (stream, offset, whence, NULL);
 4505|  4.46k|  unlock_stream (stream);
 4506|       |
 4507|  4.46k|  return err;
 4508|  4.46k|}
_gpgrt_ftello:
 4526|  8.18k|{
 4527|  8.18k|  gpgrt_off_t ret = -1;
 4528|       |
 4529|  8.18k|  lock_stream (stream);
 4530|  8.18k|  ret = es_offset_calculate (stream);
 4531|  8.18k|  unlock_stream (stream);
 4532|       |
 4533|  8.18k|  return ret;
 4534|  8.18k|}
_gpgrt__getc_underflow:
 4573|  8.18k|{
 4574|  8.18k|  int err;
 4575|  8.18k|  unsigned char c;
 4576|  8.18k|  size_t bytes_read;
 4577|       |
 4578|  8.18k|  err = es_readn (stream, &c, 1, &bytes_read);
 4579|       |
 4580|  8.18k|  return (err || (! bytes_read)) ? EOF : c;
  ------------------
  |  Branch (4580:11): [True: 0, False: 8.18k]
  |  Branch (4580:18): [True: 4.09k, False: 4.09k]
  ------------------
 4581|  8.18k|}
_gpgrt__putc_overflow:
 4586|  1.87k|{
 4587|  1.87k|  unsigned char d = c;
 4588|  1.87k|  int err;
 4589|       |
 4590|  1.87k|  err = es_writen (stream, &d, 1, NULL);
 4591|       |
 4592|  1.87k|  return err ? EOF : c;
  ------------------
  |  Branch (4592:10): [True: 0, False: 1.87k]
  ------------------
 4593|  1.87k|}
_gpgrt_fgetc:
 4598|  24.5k|{
 4599|  24.5k|  int ret;
 4600|       |
 4601|  24.5k|  lock_stream (stream);
 4602|  24.5k|  ret = _gpgrt_getc_unlocked (stream);
  ------------------
  |  |  395|  24.5k|  (((!(stream)->flags.writing)					\
  |  |  ------------------
  |  |  |  Branch (395:5): [True: 24.5k, False: 0]
  |  |  ------------------
  |  |  396|  24.5k|    && ((stream)->data_offset < (stream)->data_len)		\
  |  |  ------------------
  |  |  |  Branch (396:8): [True: 16.3k, False: 8.18k]
  |  |  ------------------
  |  |  397|  24.5k|    && (! (stream)->unread_data_len))				\
  |  |  ------------------
  |  |  |  Branch (397:8): [True: 16.3k, False: 0]
  |  |  ------------------
  |  |  398|  24.5k|  ? ((int) (stream)->buffer[((stream)->data_offset)++])		\
  |  |  399|  24.5k|  : _gpgrt__getc_underflow ((stream)))
  ------------------
 4603|  24.5k|  unlock_stream (stream);
 4604|       |
 4605|  24.5k|  return ret;
 4606|  24.5k|}
_gpgrt_fread:
 4679|  4.09k|{
 4680|  4.09k|  size_t ret, bytes;
 4681|       |
 4682|  4.09k|  if (size && nitems)
  ------------------
  |  Branch (4682:7): [True: 4.09k, False: 0]
  |  Branch (4682:15): [True: 4.09k, False: 0]
  ------------------
 4683|  4.09k|    {
 4684|  4.09k|      lock_stream (stream);
 4685|  4.09k|      es_readn (stream, ptr, size * nitems, &bytes);
 4686|  4.09k|      unlock_stream (stream);
 4687|       |
 4688|  4.09k|      ret = bytes / size;
 4689|  4.09k|    }
 4690|      0|  else
 4691|      0|    ret = 0;
 4692|       |
 4693|  4.09k|  return ret;
 4694|  4.09k|}
_gpgrt_fwrite:
 4700|      1|{
 4701|      1|  size_t ret, bytes;
 4702|       |
 4703|      1|  if (size && nitems)
  ------------------
  |  Branch (4703:7): [True: 1, False: 0]
  |  Branch (4703:15): [True: 1, False: 0]
  ------------------
 4704|      1|    {
 4705|      1|      lock_stream (stream);
 4706|      1|      es_writen (stream, ptr, size * nitems, &bytes);
 4707|      1|      unlock_stream (stream);
 4708|       |
 4709|      1|      ret = bytes / size;
 4710|      1|    }
 4711|      0|  else
 4712|      0|    ret = 0;
 4713|       |
 4714|      1|  return ret;
 4715|      1|}
_gpgrt_fputs_unlocked:
 4751|  1.32k|{
 4752|  1.32k|  size_t length;
 4753|  1.32k|  int err;
 4754|       |
 4755|  1.32k|  length = strlen (s);
 4756|  1.32k|  err = es_writen (stream, s, length, NULL);
 4757|  1.32k|  return err ? EOF : 0;
  ------------------
  |  Branch (4757:10): [True: 0, False: 1.32k]
  ------------------
 4758|  1.32k|}
_gpgrt_fputs:
 4762|  2.21k|{
 4763|  2.21k|  size_t length;
 4764|  2.21k|  int err;
 4765|       |
 4766|  2.21k|  length = strlen (s);
 4767|  2.21k|  lock_stream (stream);
 4768|  2.21k|  err = es_writen (stream, s, length, NULL);
 4769|  2.21k|  unlock_stream (stream);
 4770|       |
 4771|  2.21k|  return err ? EOF : 0;
  ------------------
  |  Branch (4771:10): [True: 0, False: 2.21k]
  ------------------
 4772|  2.21k|}
_gpgrt_vfprintf_unlocked:
 4961|  4.43M|{
 4962|  4.43M|  return do_print_stream (stream, sf, sfvalue, format, ap);
 4963|  4.43M|}
_gpgrt_fprintf_unlocked:
 4985|  5.56M|{
 4986|  5.56M|  int ret;
 4987|       |
 4988|  5.56M|  va_list ap;
 4989|  5.56M|  va_start (ap, format);
 4990|  5.56M|  ret = do_print_stream (stream, NULL, NULL, format, ap);
 4991|  5.56M|  va_end (ap);
 4992|       |
 4993|  5.56M|  return ret;
 4994|  5.56M|}
_gpgrt_setvbuf:
 5145|      2|{
 5146|      2|  int err;
 5147|       |
 5148|      2|  if ((type == _IOFBF || type == _IOLBF || type == _IONBF)
  ------------------
  |  Branch (5148:8): [True: 0, False: 2]
  |  Branch (5148:26): [True: 2, False: 0]
  |  Branch (5148:44): [True: 0, False: 0]
  ------------------
 5149|      2|      && (!buf || size || type == _IONBF))
  ------------------
  |  Branch (5149:11): [True: 2, False: 0]
  |  Branch (5149:19): [True: 0, False: 0]
  |  Branch (5149:27): [True: 0, False: 0]
  ------------------
 5150|      2|    {
 5151|      2|      lock_stream (stream);
 5152|      2|      err = es_set_buffering (stream, buf, type, size);
 5153|      2|      unlock_stream (stream);
 5154|      2|    }
 5155|      0|  else
 5156|      0|    {
 5157|      0|      _set_errno (EINVAL);
  ------------------
  |  |  146|      0|#define _set_errno(a)  do { errno = (a); } while (0)
  |  |  ------------------
  |  |  |  Branch (146:51): [Folded - Ignored]
  |  |  ------------------
  ------------------
 5158|      0|      err = -1;
 5159|      0|    }
 5160|       |
 5161|      2|  return err;
 5162|      2|}
_gpgrt_write_sanitized:
 5665|  81.0k|{
 5666|  81.0k|  const unsigned char *p = buffer;
 5667|  81.0k|  size_t count = 0;
 5668|  81.0k|  int ret;
 5669|       |
 5670|  81.0k|  lock_stream (stream);
 5671|  8.70M|  for (; length; length--, p++, count++)
  ------------------
  |  Branch (5671:10): [True: 8.62M, False: 81.0k]
  ------------------
 5672|  8.62M|    {
 5673|  8.62M|      if (*p < 0x20
  ------------------
  |  Branch (5673:11): [True: 6.59M, False: 2.03M]
  ------------------
 5674|  8.62M|          || *p == 0x7f
  ------------------
  |  Branch (5674:14): [True: 4.25k, False: 2.02M]
  ------------------
 5675|  8.62M|          || (delimiters
  ------------------
  |  Branch (5675:15): [True: 0, False: 2.02M]
  ------------------
 5676|  2.02M|              && (strchr (delimiters, *p) || *p == '\\')))
  ------------------
  |  Branch (5676:19): [True: 0, False: 0]
  |  Branch (5676:46): [True: 0, False: 0]
  ------------------
 5677|  6.59M|        {
 5678|  6.59M|          _gpgrt_putc_unlocked ('\\', stream);
  ------------------
  |  |  402|  6.59M|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 6.59M, False: 0]
  |  |  ------------------
  |  |  403|  6.59M|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 6.59M, False: 345]
  |  |  ------------------
  |  |  404|  6.59M|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|  6.59M|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|  6.59M|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
 5679|  6.59M|          count++;
 5680|  6.59M|          if (*p == '\n')
  ------------------
  |  Branch (5680:15): [True: 75.0k, False: 6.52M]
  ------------------
 5681|  75.0k|            {
 5682|  75.0k|              _gpgrt_putc_unlocked ('n', stream);
  ------------------
  |  |  402|  75.0k|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 75.0k, False: 0]
  |  |  ------------------
  |  |  403|  75.0k|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 74.7k, False: 286]
  |  |  ------------------
  |  |  404|  75.0k|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|  75.0k|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|  75.0k|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
 5683|  75.0k|              count++;
 5684|  75.0k|            }
 5685|  6.52M|          else if (*p == '\r')
  ------------------
  |  Branch (5685:20): [True: 47.6k, False: 6.47M]
  ------------------
 5686|  47.6k|            {
 5687|  47.6k|              _gpgrt_putc_unlocked ('r', stream);
  ------------------
  |  |  402|  47.6k|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 47.6k, False: 0]
  |  |  ------------------
  |  |  403|  47.6k|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 47.5k, False: 68]
  |  |  ------------------
  |  |  404|  47.6k|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|  47.6k|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|  47.6k|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
 5688|  47.6k|              count++;
 5689|  47.6k|            }
 5690|  6.47M|          else if (*p == '\f')
  ------------------
  |  Branch (5690:20): [True: 5.67k, False: 6.46M]
  ------------------
 5691|  5.67k|            {
 5692|  5.67k|              _gpgrt_putc_unlocked ('f', stream);
  ------------------
  |  |  402|  5.67k|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 5.67k, False: 0]
  |  |  ------------------
  |  |  403|  5.67k|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 5.47k, False: 194]
  |  |  ------------------
  |  |  404|  5.67k|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|  5.67k|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|  5.67k|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
 5693|  5.67k|              count++;
 5694|  5.67k|            }
 5695|  6.46M|          else if (*p == '\v')
  ------------------
  |  Branch (5695:20): [True: 16.0k, False: 6.45M]
  ------------------
 5696|  16.0k|            {
 5697|  16.0k|              _gpgrt_putc_unlocked ('v', stream);
  ------------------
  |  |  402|  16.0k|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 16.0k, False: 0]
  |  |  ------------------
  |  |  403|  16.0k|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 15.9k, False: 68]
  |  |  ------------------
  |  |  404|  16.0k|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|  16.0k|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|  16.0k|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
 5698|  16.0k|              count++;
 5699|  16.0k|            }
 5700|  6.45M|          else if (*p == '\b')
  ------------------
  |  Branch (5700:20): [True: 14.0k, False: 6.43M]
  ------------------
 5701|  14.0k|            {
 5702|  14.0k|              _gpgrt_putc_unlocked ('b', stream);
  ------------------
  |  |  402|  14.0k|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 14.0k, False: 0]
  |  |  ------------------
  |  |  403|  14.0k|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 13.8k, False: 198]
  |  |  ------------------
  |  |  404|  14.0k|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|  14.0k|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|  14.0k|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
 5703|  14.0k|              count++;
 5704|  14.0k|            }
 5705|  6.43M|          else if (!*p)
  ------------------
  |  Branch (5705:20): [True: 875k, False: 5.56M]
  ------------------
 5706|   875k|            {
 5707|   875k|              _gpgrt_putc_unlocked('0', stream);
  ------------------
  |  |  402|   875k|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 875k, False: 0]
  |  |  ------------------
  |  |  403|   875k|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 874k, False: 387]
  |  |  ------------------
  |  |  404|   875k|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|   875k|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|   875k|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
 5708|   875k|              count++;
 5709|   875k|            }
 5710|  5.56M|          else
 5711|  5.56M|            {
 5712|  5.56M|              _gpgrt_fprintf_unlocked (stream, "x%02x", *p);
 5713|  5.56M|              count += 3;
 5714|  5.56M|            }
 5715|  6.59M|	}
 5716|  2.02M|      else
 5717|  2.02M|        {
 5718|  2.02M|          _gpgrt_putc_unlocked (*p, stream);
  ------------------
  |  |  402|  2.02M|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 2.02M, False: 0]
  |  |  ------------------
  |  |  403|  2.02M|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 2.02M, False: 328]
  |  |  ------------------
  |  |  404|  2.02M|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [True: 2.02M, False: 0]
  |  |  ------------------
  |  |  405|  2.02M|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|  2.02M|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
 5719|  2.02M|          count++;
 5720|  2.02M|        }
 5721|  8.62M|    }
 5722|       |
 5723|  81.0k|  if (bytes_written)
  ------------------
  |  Branch (5723:7): [True: 0, False: 81.0k]
  ------------------
 5724|      0|    *bytes_written = count;
 5725|  81.0k|  ret =  _gpgrt_ferror_unlocked (stream)? -1 : 0;
  ------------------
  |  Branch (5725:10): [True: 0, False: 81.0k]
  ------------------
 5726|  81.0k|  unlock_stream (stream);
 5727|       |
 5728|  81.0k|  return ret;
 5729|  81.0k|}
estream.c:parse_mode:
 2101|  3.54k|{
 2102|  3.54k|  unsigned int omode, oflags, cmode;
 2103|  3.54k|  int got_cmode = 0;
 2104|       |
 2105|  3.54k|  *r_xmode = 0;
 2106|       |
 2107|  3.54k|  switch (*modestr)
 2108|  3.54k|    {
 2109|  3.54k|    case 'r':
  ------------------
  |  Branch (2109:5): [True: 3.54k, False: 5]
  ------------------
 2110|  3.54k|      omode = O_RDONLY;
 2111|  3.54k|      oflags = 0;
 2112|  3.54k|      break;
 2113|      2|    case 'w':
  ------------------
  |  Branch (2113:5): [True: 2, False: 3.54k]
  ------------------
 2114|      2|      omode = O_WRONLY;
 2115|      2|      oflags = O_TRUNC | O_CREAT;
 2116|      2|      break;
 2117|      3|    case 'a':
  ------------------
  |  Branch (2117:5): [True: 3, False: 3.54k]
  ------------------
 2118|      3|      omode = O_WRONLY;
 2119|      3|      oflags = O_APPEND | O_CREAT;
 2120|      3|      break;
 2121|      0|    default:
  ------------------
  |  Branch (2121:5): [True: 0, False: 3.54k]
  ------------------
 2122|      0|      _set_errno (EINVAL);
  ------------------
  |  |  146|      0|#define _set_errno(a)  do { errno = (a); } while (0)
  |  |  ------------------
  |  |  |  Branch (146:51): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2123|      0|      return -1;
 2124|  3.54k|    }
 2125|  7.08k|  for (modestr++; *modestr; modestr++)
  ------------------
  |  Branch (2125:19): [True: 3.54k, False: 3.54k]
  ------------------
 2126|  3.54k|    {
 2127|  3.54k|      switch (*modestr)
 2128|  3.54k|        {
 2129|      0|        case '+':
  ------------------
  |  Branch (2129:9): [True: 0, False: 3.54k]
  ------------------
 2130|      0|          omode = O_RDWR;
 2131|      0|          break;
 2132|  3.54k|        case 'b':
  ------------------
  |  Branch (2132:9): [True: 3.54k, False: 0]
  ------------------
 2133|  3.54k|          oflags |= O_BINARY;
  ------------------
  |  |  106|  3.54k|# define O_BINARY 0
  ------------------
 2134|  3.54k|          break;
 2135|      0|        case 'x':
  ------------------
  |  Branch (2135:9): [True: 0, False: 3.54k]
  ------------------
 2136|      0|          oflags |= O_EXCL;
 2137|      0|          break;
 2138|      0|        case ',':
  ------------------
  |  Branch (2138:9): [True: 0, False: 3.54k]
  ------------------
 2139|      0|          goto keyvalue;
 2140|      0|        default: /* Ignore unknown flags.  */
  ------------------
  |  Branch (2140:9): [True: 0, False: 3.54k]
  ------------------
 2141|      0|          break;
 2142|  3.54k|        }
 2143|  3.54k|    }
 2144|       |
 2145|  3.54k| keyvalue:
 2146|       |  /* Parse key/value pairs (similar to fopen on mainframes).  */
 2147|  3.54k|  for (cmode=0; *modestr == ','; modestr += strcspn (modestr, ","))
  ------------------
  |  Branch (2147:17): [True: 0, False: 3.54k]
  ------------------
 2148|      0|    {
 2149|      0|      modestr++;
 2150|      0|      modestr += strspn (modestr, " \t");
 2151|      0|      if (!strncmp (modestr, "mode=", 5))
  ------------------
  |  Branch (2151:11): [True: 0, False: 0]
  ------------------
 2152|      0|        {
 2153|      0|          static struct {
 2154|      0|            char letter;
 2155|      0|            unsigned int value;
 2156|      0|          } table[] = { { '-', 0 },
 2157|      0|                        { 'r', S_IRUSR }, { 'w', S_IWUSR }, { 'x', S_IXUSR },
 2158|      0|                        { 'r', S_IRGRP }, { 'w', S_IWGRP }, { 'x', S_IXGRP },
 2159|      0|                        { 'r', S_IROTH }, { 'w', S_IWOTH }, { 'x', S_IXOTH }};
 2160|      0|          int idx;
 2161|       |
 2162|      0|          got_cmode = 1;
 2163|      0|          modestr += 5;
 2164|       |          /* For now we only support a string as used by ls(1) and no
 2165|       |             octal numbers.  The first character must be a dash.  */
 2166|      0|          for (idx=0; idx < 10 && *modestr; idx++, modestr++)
  ------------------
  |  Branch (2166:23): [True: 0, False: 0]
  |  Branch (2166:35): [True: 0, False: 0]
  ------------------
 2167|      0|            {
 2168|      0|              if (*modestr == table[idx].letter)
  ------------------
  |  Branch (2168:19): [True: 0, False: 0]
  ------------------
 2169|      0|                cmode |= table[idx].value;
 2170|      0|              else if (*modestr != '-')
  ------------------
  |  Branch (2170:24): [True: 0, False: 0]
  ------------------
 2171|      0|                break;
 2172|      0|            }
 2173|      0|          if (*modestr && !strchr (" \t,", *modestr))
  ------------------
  |  Branch (2173:15): [True: 0, False: 0]
  |  Branch (2173:27): [True: 0, False: 0]
  ------------------
 2174|      0|            {
 2175|      0|              _set_errno (EINVAL);
  ------------------
  |  |  146|      0|#define _set_errno(a)  do { errno = (a); } while (0)
  |  |  ------------------
  |  |  |  Branch (146:51): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2176|      0|              return -1;
 2177|      0|            }
 2178|      0|        }
 2179|      0|      else if (!strncmp (modestr, "samethread", 10))
  ------------------
  |  Branch (2179:16): [True: 0, False: 0]
  ------------------
 2180|      0|        {
 2181|      0|          modestr += 10;
 2182|      0|          if (*modestr && !strchr (" \t,", *modestr))
  ------------------
  |  Branch (2182:15): [True: 0, False: 0]
  |  Branch (2182:27): [True: 0, False: 0]
  ------------------
 2183|      0|            {
 2184|      0|              _set_errno (EINVAL);
  ------------------
  |  |  146|      0|#define _set_errno(a)  do { errno = (a); } while (0)
  |  |  ------------------
  |  |  |  Branch (146:51): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2185|      0|              return -1;
 2186|      0|            }
 2187|      0|          *r_xmode |= X_SAMETHREAD;
  ------------------
  |  | 2044|      0|#define X_SAMETHREAD	(1 << 0)
  ------------------
 2188|      0|        }
 2189|      0|      else if (!strncmp (modestr, "nonblock", 8))
  ------------------
  |  Branch (2189:16): [True: 0, False: 0]
  ------------------
 2190|      0|        {
 2191|      0|          modestr += 8;
 2192|      0|          if (*modestr && !strchr (" \t,", *modestr))
  ------------------
  |  Branch (2192:15): [True: 0, False: 0]
  |  Branch (2192:27): [True: 0, False: 0]
  ------------------
 2193|      0|            {
 2194|      0|              _set_errno (EINVAL);
  ------------------
  |  |  146|      0|#define _set_errno(a)  do { errno = (a); } while (0)
  |  |  ------------------
  |  |  |  Branch (146:51): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2195|      0|              return -1;
 2196|      0|            }
 2197|      0|          oflags |= O_NONBLOCK;
 2198|       |#if HAVE_W32_SYSTEM
 2199|       |          /* Currently, nonblock implies pollable on Windows.  */
 2200|       |          *r_xmode |= X_POLLABLE;
 2201|       |#endif
 2202|      0|        }
 2203|      0|      else if (!strncmp (modestr, "sysopen", 7))
  ------------------
  |  Branch (2203:16): [True: 0, False: 0]
  ------------------
 2204|      0|        {
 2205|      0|          modestr += 7;
 2206|      0|          if (*modestr && !strchr (" \t,", *modestr))
  ------------------
  |  Branch (2206:15): [True: 0, False: 0]
  |  Branch (2206:27): [True: 0, False: 0]
  ------------------
 2207|      0|            {
 2208|      0|              _set_errno (EINVAL);
  ------------------
  |  |  146|      0|#define _set_errno(a)  do { errno = (a); } while (0)
  |  |  ------------------
  |  |  |  Branch (146:51): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2209|      0|              return -1;
 2210|      0|            }
 2211|      0|          *r_xmode |= X_SYSOPEN;
  ------------------
  |  | 2045|      0|#define X_SYSOPEN	(1 << 1)
  ------------------
 2212|      0|        }
 2213|      0|      else if (!strncmp (modestr, "pollable", 8))
  ------------------
  |  Branch (2213:16): [True: 0, False: 0]
  ------------------
 2214|      0|        {
 2215|      0|          modestr += 8;
 2216|      0|          if (*modestr && !strchr (" \t,", *modestr))
  ------------------
  |  Branch (2216:15): [True: 0, False: 0]
  |  Branch (2216:27): [True: 0, False: 0]
  ------------------
 2217|      0|            {
 2218|      0|              _set_errno (EINVAL);
  ------------------
  |  |  146|      0|#define _set_errno(a)  do { errno = (a); } while (0)
  |  |  ------------------
  |  |  |  Branch (146:51): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2219|      0|              return -1;
 2220|      0|            }
 2221|      0|          *r_xmode |= X_POLLABLE;
  ------------------
  |  | 2046|      0|#define X_POLLABLE	(1 << 2)
  ------------------
 2222|      0|        }
 2223|      0|    }
 2224|  3.54k|  if (!got_cmode)
  ------------------
  |  Branch (2224:7): [True: 3.54k, False: 0]
  ------------------
 2225|  3.54k|    cmode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
 2226|       |
 2227|  3.54k|  *modeflags = (omode | oflags);
 2228|  3.54k|  if (r_cmode)
  ------------------
  |  Branch (2228:7): [True: 3.54k, False: 0]
  ------------------
 2229|  3.54k|    *r_cmode = cmode;
 2230|  3.54k|  return 0;
 2231|  3.54k|}
estream.c:func_fd_read:
 1008|  8.18k|{
 1009|  8.18k|  estream_cookie_fd_t file_cookie = cookie;
 1010|  8.18k|  gpgrt_ssize_t bytes_read;
 1011|       |
 1012|  8.18k|  trace (("enter: cookie=%p buffer=%p size=%d", cookie, buffer, (int)size));
  ------------------
  |  |  189|  8.18k|# define trace(X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (189:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1013|       |
 1014|  8.18k|  if (!size)
  ------------------
  |  Branch (1014:7): [True: 0, False: 8.18k]
  ------------------
 1015|      0|    bytes_read = -1; /* We don't know whether anything is pending.  */
 1016|  8.18k|  else if (IS_INVALID_FD (file_cookie->fd))
  ------------------
  |  |  148|  8.18k|#define IS_INVALID_FD(a)    ((a) == -1)
  |  |  ------------------
  |  |  |  Branch (148:29): [True: 0, False: 8.18k]
  |  |  ------------------
  ------------------
 1017|      0|    {
 1018|      0|      _gpgrt_yield ();
 1019|      0|      bytes_read = 0;
 1020|      0|    }
 1021|  8.18k|  else
 1022|  8.18k|    {
 1023|  8.18k|      _gpgrt_pre_syscall ();
 1024|  8.18k|      do
 1025|  8.18k|        {
 1026|  8.18k|          bytes_read = read (file_cookie->fd, buffer, size);
 1027|  8.18k|        }
 1028|  8.18k|      while (bytes_read == -1 && errno == EINTR);
  ------------------
  |  Branch (1028:14): [True: 0, False: 8.18k]
  |  Branch (1028:34): [True: 0, False: 0]
  ------------------
 1029|  8.18k|      _gpgrt_post_syscall ();
 1030|  8.18k|    }
 1031|       |
 1032|  8.18k|  trace_errno (bytes_read == -1, ("leave: bytes_read=%d", (int)bytes_read));
  ------------------
  |  |  190|  8.18k|# define trace_errno(C,X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (190:41): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1033|  8.18k|  return bytes_read;
 1034|  8.18k|}
estream.c:func_fd_write:
 1042|  12.7M|{
 1043|  12.7M|  estream_cookie_fd_t file_cookie = cookie;
 1044|  12.7M|  gpgrt_ssize_t bytes_written;
 1045|       |
 1046|  12.7M|  trace (("enter: cookie=%p buffer=%p size=%d", cookie, buffer, (int)size));
  ------------------
  |  |  189|  12.7M|# define trace(X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (189:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1047|       |
 1048|  12.7M|  if (IS_INVALID_FD (file_cookie->fd))
  ------------------
  |  |  148|  12.7M|#define IS_INVALID_FD(a)    ((a) == -1)
  |  |  ------------------
  |  |  |  Branch (148:29): [True: 0, False: 12.7M]
  |  |  ------------------
  ------------------
 1049|      0|    {
 1050|      0|      _gpgrt_yield ();
 1051|      0|      bytes_written = size; /* Yeah:  Success writing to the bit bucket.  */
 1052|      0|    }
 1053|  12.7M|  else if (buffer)
  ------------------
  |  Branch (1053:12): [True: 8.36M, False: 4.34M]
  ------------------
 1054|  8.36M|    {
 1055|  8.36M|      _gpgrt_pre_syscall ();
 1056|  8.36M|      do
 1057|  8.36M|        {
 1058|  8.36M|          bytes_written = write (file_cookie->fd, buffer, size);
 1059|  8.36M|        }
 1060|  8.36M|      while (bytes_written == -1 && errno == EINTR);
  ------------------
  |  Branch (1060:14): [True: 0, False: 8.36M]
  |  Branch (1060:37): [True: 0, False: 0]
  ------------------
 1061|  8.36M|      _gpgrt_post_syscall ();
 1062|  8.36M|    }
 1063|  4.34M|  else
 1064|  4.34M|    bytes_written = size; /* Note that for a flush SIZE should be 0.  */
 1065|       |
 1066|  12.7M|  trace_errno (bytes_written == -1,
  ------------------
  |  |  190|  12.7M|# define trace_errno(C,X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (190:41): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1067|  12.7M|               ("leave: bytes_written=%d", (int)bytes_written));
 1068|  12.7M|  return bytes_written;
 1069|  12.7M|}
estream.c:func_fd_seek:
 1077|  4.46k|{
 1078|  4.46k|  estream_cookie_fd_t file_cookie = cookie;
 1079|  4.46k|  gpgrt_off_t offset_new;
 1080|  4.46k|  int err;
 1081|       |
 1082|  4.46k|  if (IS_INVALID_FD (file_cookie->fd))
  ------------------
  |  |  148|  4.46k|#define IS_INVALID_FD(a)    ((a) == -1)
  |  |  ------------------
  |  |  |  Branch (148:29): [True: 0, False: 4.46k]
  |  |  ------------------
  ------------------
 1083|      0|    {
 1084|      0|      _set_errno (ESPIPE);
  ------------------
  |  |  146|      0|#define _set_errno(a)  do { errno = (a); } while (0)
  |  |  ------------------
  |  |  |  Branch (146:51): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1085|      0|      err = -1;
 1086|      0|    }
 1087|  4.46k|  else
 1088|  4.46k|    {
 1089|  4.46k|      _gpgrt_pre_syscall ();
 1090|  4.46k|      offset_new = lseek (file_cookie->fd, *offset, whence);
 1091|  4.46k|      _gpgrt_post_syscall ();
 1092|  4.46k|      if (offset_new == -1)
  ------------------
  |  Branch (1092:11): [True: 0, False: 4.46k]
  ------------------
 1093|      0|        err = -1;
 1094|  4.46k|      else
 1095|  4.46k|        {
 1096|  4.46k|          *offset = offset_new;
 1097|  4.46k|          err = 0;
 1098|  4.46k|        }
 1099|  4.46k|    }
 1100|       |
 1101|  4.46k|  return err;
 1102|  4.46k|}
estream.c:func_file_create:
 1890|  3.54k|{
 1891|  3.54k|  estream_cookie_fd_t file_cookie;
 1892|  3.54k|  int err;
 1893|  3.54k|  int fd;
 1894|       |
 1895|  3.54k|  err = 0;
 1896|       |
 1897|  3.54k|  file_cookie = mem_alloc (sizeof (*file_cookie));
 1898|  3.54k|  if (! file_cookie)
  ------------------
  |  Branch (1898:7): [True: 0, False: 3.54k]
  ------------------
 1899|      0|    {
 1900|      0|      err = -1;
 1901|      0|      goto out;
 1902|      0|    }
 1903|       |
 1904|       |#ifdef HAVE_W32_SYSTEM
 1905|       |  if (any8bitchar (path))
 1906|       |    {
 1907|       |      wchar_t *wpath;
 1908|       |
 1909|       |      wpath = _gpgrt_utf8_to_wchar (path);
 1910|       |      if (!wpath)
 1911|       |        fd = -1;
 1912|       |      else
 1913|       |        {
 1914|       |          fd = _wopen (wpath, modeflags, cmode);
 1915|       |          _gpgrt_free_wchar (wpath);
 1916|       |        }
 1917|       |    }
 1918|       |  else  /* Avoid unnecessary conversion.  */
 1919|       |    fd = open (path, modeflags, cmode);
 1920|       |#else
 1921|  3.54k|  fd = open (path, modeflags, cmode);
 1922|  3.54k|#endif
 1923|  3.54k|  if (fd == -1)
  ------------------
  |  Branch (1923:7): [True: 2, False: 3.54k]
  ------------------
 1924|      2|    {
 1925|      2|      err = -1;
 1926|      2|      goto out;
 1927|      2|    }
 1928|       |#ifdef HAVE_DOSISH_SYSTEM
 1929|       |  /* Make sure it is in binary mode if requested.  */
 1930|       |  if ( (modeflags & O_BINARY) )
 1931|       |    setmode (fd, O_BINARY);
 1932|       |#endif
 1933|       |
 1934|  3.54k|  file_cookie->fd = fd;
 1935|  3.54k|  file_cookie->no_close = 0;
 1936|  3.54k|  *cookie = file_cookie;
 1937|  3.54k|  *filedes = fd;
 1938|       |
 1939|  3.54k| out:
 1940|       |
 1941|  3.54k|  if (err)
  ------------------
  |  Branch (1941:7): [True: 2, False: 3.54k]
  ------------------
 1942|      2|    mem_free (file_cookie);
 1943|       |
 1944|  3.54k|  return err;
 1945|  3.54k|}
estream.c:create_stream:
 2490|  3.54k|{
 2491|  3.54k|  estream_internal_t stream_internal_new;
 2492|  3.54k|  estream_t stream_new;
 2493|  3.54k|  int err;
 2494|       |#if HAVE_W32_SYSTEM
 2495|       |  void *old_cookie = NULL;
 2496|       |#endif
 2497|       |
 2498|  3.54k|  stream_new = NULL;
 2499|  3.54k|  stream_internal_new = NULL;
 2500|       |
 2501|       |#if HAVE_W32_SYSTEM
 2502|       |  if ((xmode & X_POLLABLE) && kind != BACKEND_W32)
 2503|       |    {
 2504|       |      /* We require the W32 backend, because only that allows us to
 2505|       |       * write directly using the native W32 API and to disable the
 2506|       |       * system clamp.  Note that func_w32_create has already been
 2507|       |       * called with the flag to disable the system call clamp.  */
 2508|       |      _set_errno (EINVAL);
 2509|       |      err = -1;
 2510|       |      goto out;
 2511|       |    }
 2512|       |#endif /*HAVE_W32_SYSTEM*/
 2513|       |
 2514|  3.54k|  stream_new = mem_alloc (sizeof (*stream_new));
 2515|  3.54k|  if (! stream_new)
  ------------------
  |  Branch (2515:7): [True: 0, False: 3.54k]
  ------------------
 2516|      0|    {
 2517|      0|      err = -1;
 2518|      0|      goto out;
 2519|      0|    }
 2520|       |
 2521|  3.54k|  stream_internal_new = mem_alloc (sizeof (*stream_internal_new));
 2522|  3.54k|  if (! stream_internal_new)
  ------------------
  |  Branch (2522:7): [True: 0, False: 3.54k]
  ------------------
 2523|      0|    {
 2524|      0|      err = -1;
 2525|      0|      goto out;
 2526|      0|    }
 2527|       |
 2528|  3.54k|  stream_new->buffer = stream_internal_new->buffer;
 2529|  3.54k|  stream_new->buffer_size = sizeof (stream_internal_new->buffer);
 2530|  3.54k|  stream_new->unread_buffer = stream_internal_new->unread_buffer;
 2531|  3.54k|  stream_new->unread_buffer_size = sizeof (stream_internal_new->unread_buffer);
 2532|  3.54k|  stream_new->intern = stream_internal_new;
 2533|       |
 2534|       |#if HAVE_W32_SYSTEM
 2535|       |  if ((xmode & X_POLLABLE))
 2536|       |    {
 2537|       |      void *new_cookie;
 2538|       |
 2539|       |      err = _gpgrt_w32_pollable_create (&new_cookie, modeflags,
 2540|       |                                        functions, cookie);
 2541|       |      if (err)
 2542|       |        goto out;
 2543|       |
 2544|       |      modeflags &= ~O_NONBLOCK;
 2545|       |      old_cookie = cookie;
 2546|       |      cookie = new_cookie;
 2547|       |      kind = BACKEND_W32_POLLABLE;
 2548|       |      functions = _gpgrt_functions_w32_pollable;
 2549|       |    }
 2550|       |#endif /*HAVE_W32_SYSTEM*/
 2551|       |
 2552|  3.54k|  init_stream_obj (stream_new, cookie, syshd, kind, functions, modeflags,
 2553|  3.54k|                   xmode);
 2554|  3.54k|  init_stream_lock (stream_new);
 2555|       |
 2556|  3.54k|  err = do_list_add (stream_new, with_locked_list);
 2557|  3.54k|  if (err)
  ------------------
  |  Branch (2557:7): [True: 0, False: 3.54k]
  ------------------
 2558|      0|    goto out;
 2559|       |
 2560|  3.54k|  *r_stream = stream_new;
 2561|       |
 2562|  3.54k| out:
 2563|       |
 2564|  3.54k|  if (err)
  ------------------
  |  Branch (2564:7): [True: 0, False: 3.54k]
  ------------------
 2565|      0|    {
 2566|      0|      trace_errno (err, ("leave: err=%d", err));
  ------------------
  |  |  190|      0|# define trace_errno(C,X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (190:41): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2567|      0|      if (stream_new)
  ------------------
  |  Branch (2567:11): [True: 0, False: 0]
  ------------------
 2568|      0|	{
 2569|      0|	  deinit_stream_obj (stream_new);
 2570|      0|          destroy_stream_lock (stream_new);
 2571|      0|	  mem_free (stream_new->intern);
 2572|      0|	  mem_free (stream_new);
 2573|      0|	}
 2574|      0|    }
 2575|       |#if HAVE_W32_SYSTEM
 2576|       |  else if (old_cookie)
 2577|       |    trace (("leave: success stream=%p cookie=%p,%p",
 2578|       |            *r_stream, old_cookie, cookie));
 2579|       |#endif
 2580|  3.54k|  else
 2581|  3.54k|    trace (("leave: success stream=%p cookie=%p", *r_stream, cookie));
  ------------------
  |  |  189|  3.54k|# define trace(X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (189:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2582|       |
 2583|  3.54k|  return err;
 2584|  3.54k|}
estream.c:init_stream_lock:
  399|  3.54k|{
  400|  3.54k|  int rc;
  401|       |
  402|  3.54k|  if (!stream->intern->samethread)
  ------------------
  |  Branch (402:7): [True: 3.54k, False: 0]
  ------------------
  403|  3.54k|    {
  404|  3.54k|      dbg_lock_1 ("enter init_stream_lock for %p\n", stream);
  405|  3.54k|      memset (&stream->intern->lock, 0 , sizeof stream->intern->lock);
  406|  3.54k|      rc = _gpgrt_lock_init (&stream->intern->lock);
  407|  3.54k|      dbg_lock_2 ("leave init_stream_lock for %p: rc=%d\n", stream, rc);
  408|  3.54k|    }
  409|      0|  else
  410|      0|    rc = 0;
  411|  3.54k|  return rc;
  412|  3.54k|}
estream.c:do_list_add:
  510|  3.54k|{
  511|  3.54k|  estream_list_t item;
  512|       |
  513|  3.54k|  if (!with_locked_list)
  ------------------
  |  Branch (513:7): [True: 3.54k, False: 2]
  ------------------
  514|  3.54k|    lock_list ();
  515|       |
  516|  16.6k|  for (item = estream_list; item && item->stream; item = item->next)
  ------------------
  |  Branch (516:29): [True: 13.1k, False: 3.54k]
  |  Branch (516:37): [True: 13.1k, False: 0]
  ------------------
  517|  13.1k|    ;
  518|  3.54k|  if (!item)
  ------------------
  |  Branch (518:7): [True: 3.54k, False: 0]
  ------------------
  519|  3.54k|    {
  520|  3.54k|      item = mem_alloc (sizeof *item);
  521|  3.54k|      if (item)
  ------------------
  |  Branch (521:11): [True: 3.54k, False: 0]
  ------------------
  522|  3.54k|        {
  523|  3.54k|          item->next = estream_list;
  524|  3.54k|          estream_list = item;
  525|  3.54k|        }
  526|  3.54k|    }
  527|  3.54k|  if (item)
  ------------------
  |  Branch (527:7): [True: 3.54k, False: 0]
  ------------------
  528|  3.54k|    item->stream = stream;
  529|       |
  530|  3.54k|  if (!with_locked_list)
  ------------------
  |  Branch (530:7): [True: 3.54k, False: 2]
  ------------------
  531|  3.54k|    unlock_list ();
  532|       |
  533|  3.54k|  return item? 0 : -1;
  ------------------
  |  Branch (533:10): [True: 3.54k, False: 0]
  ------------------
  534|  3.54k|}
estream.c:destroy_stream_lock:
  417|  3.54k|{
  418|  3.54k|  if (!stream->intern->samethread)
  ------------------
  |  Branch (418:7): [True: 3.54k, False: 0]
  ------------------
  419|  3.54k|    {
  420|  3.54k|      dbg_lock_1 ("enter destroy_stream_lock for %p\n", stream);
  421|  3.54k|      _gpgrt_lock_destroy (&stream->intern->lock);
  422|  3.54k|      dbg_lock_1 ("leave destroy_stream_lock for %p\n", stream);
  423|  3.54k|    }
  424|  3.54k|}
estream.c:mem_free:
  224|  17.7k|{
  225|  17.7k|  if (p)
  ------------------
  |  Branch (225:7): [True: 17.7k, False: 0]
  ------------------
  226|  17.7k|    _gpgrt_free (p);
  227|  17.7k|}
estream.c:es_writen:
 3145|  26.0M|{
 3146|  26.0M|  size_t data_written;
 3147|  26.0M|  int err;
 3148|       |
 3149|  26.0M|  data_written = 0;
 3150|  26.0M|  err = 0;
 3151|       |
 3152|  26.0M|  if (!stream->flags.writing)
  ------------------
  |  Branch (3152:7): [True: 0, False: 26.0M]
  ------------------
 3153|      0|    {
 3154|       |      /* Switching to writing mode -> discard input data and seek to
 3155|       |	 position at which reading has stopped.  We can do this only
 3156|       |	 if a seek function has been registered. */
 3157|      0|      if (stream->intern->func_seek)
  ------------------
  |  Branch (3157:11): [True: 0, False: 0]
  ------------------
 3158|      0|        {
 3159|      0|          err = es_seek (stream, 0, SEEK_CUR, NULL);
 3160|      0|          if (err)
  ------------------
  |  Branch (3160:15): [True: 0, False: 0]
  ------------------
 3161|      0|            {
 3162|      0|              if (errno == ESPIPE)
  ------------------
  |  Branch (3162:19): [True: 0, False: 0]
  ------------------
 3163|      0|                err = 0;
 3164|      0|              else
 3165|      0|                goto out;
 3166|      0|            }
 3167|      0|          stream->flags.writing = 1;
 3168|      0|        }
 3169|      0|    }
 3170|       |
 3171|  26.0M|  switch (stream->intern->strategy)
  ------------------
  |  Branch (3171:11): [True: 0, False: 26.0M]
  ------------------
 3172|  26.0M|    {
 3173|      0|    case _IONBF:
  ------------------
  |  Branch (3173:5): [True: 0, False: 26.0M]
  ------------------
 3174|      0|      err = es_write_nbf (stream, buffer, bytes_to_write, &data_written);
 3175|      0|      break;
 3176|       |
 3177|  26.0M|    case _IOLBF:
  ------------------
  |  Branch (3177:5): [True: 26.0M, False: 1]
  ------------------
 3178|  26.0M|      err = es_write_lbf (stream, buffer, bytes_to_write, &data_written);
 3179|  26.0M|      break;
 3180|       |
 3181|      1|    case _IOFBF:
  ------------------
  |  Branch (3181:5): [True: 1, False: 26.0M]
  ------------------
 3182|      1|      err = es_write_fbf (stream, buffer, bytes_to_write, &data_written);
 3183|      1|      break;
 3184|  26.0M|    }
 3185|       |
 3186|  26.0M| out:
 3187|       |
 3188|  26.0M|  if (bytes_written)
  ------------------
  |  Branch (3188:7): [True: 26.0M, False: 5.41k]
  ------------------
 3189|  26.0M|    *bytes_written = data_written;
 3190|       |
 3191|  26.0M|  return err;
 3192|  26.0M|}
estream.c:es_write_nbf:
 3015|  4.34M|{
 3016|  4.34M|  gpgrt_cookie_write_function_t func_write = stream->intern->func_write;
 3017|  4.34M|  size_t data_written;
 3018|  4.34M|  gpgrt_ssize_t ret;
 3019|  4.34M|  int err;
 3020|       |
 3021|  4.34M|  if (bytes_to_write && (! func_write))
  ------------------
  |  Branch (3021:7): [True: 4.34M, False: 0]
  |  Branch (3021:25): [True: 0, False: 4.34M]
  ------------------
 3022|      0|    {
 3023|      0|      _set_errno (EOPNOTSUPP);
  ------------------
  |  |  146|      0|#define _set_errno(a)  do { errno = (a); } while (0)
  |  |  ------------------
  |  |  |  Branch (146:51): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3024|      0|      err = -1;
 3025|      0|      goto out;
 3026|      0|    }
 3027|       |
 3028|  4.34M|  data_written = 0;
 3029|  4.34M|  err = 0;
 3030|       |
 3031|  8.69M|  while (bytes_to_write - data_written)
  ------------------
  |  Branch (3031:10): [True: 4.34M, False: 4.34M]
  ------------------
 3032|  4.34M|    {
 3033|  4.34M|      ret = (*func_write) (stream->intern->cookie,
 3034|  4.34M|			   buffer + data_written,
 3035|  4.34M|			   bytes_to_write - data_written);
 3036|  4.34M|      if (ret == -1)
  ------------------
  |  Branch (3036:11): [True: 0, False: 4.34M]
  ------------------
 3037|      0|	{
 3038|      0|	  err = -1;
 3039|       |#if EWOULDBLOCK != EAGAIN
 3040|       |          if (errno == EWOULDBLOCK)
 3041|       |            _set_errno (EAGAIN);
 3042|       |#endif
 3043|      0|	  break;
 3044|      0|	}
 3045|  4.34M|      else
 3046|  4.34M|	data_written += ret;
 3047|  4.34M|    }
 3048|       |
 3049|  4.34M|  stream->intern->offset += data_written;
 3050|  4.34M|  *bytes_written = data_written;
 3051|       |
 3052|  4.34M| out:
 3053|       |
 3054|  4.34M|  return err;
 3055|  4.34M|}
estream.c:es_write_lbf:
 3111|  26.0M|{
 3112|  26.0M|  size_t data_flushed = 0;
 3113|  26.0M|  size_t data_buffered = 0;
 3114|  26.0M|  unsigned char *nlp;
 3115|  26.0M|  int err = 0;
 3116|       |
 3117|  26.0M|  nlp = memrchr (buffer, '\n', bytes_to_write);
 3118|  26.0M|  if (nlp)
  ------------------
  |  Branch (3118:7): [True: 4.34M, False: 21.6M]
  ------------------
 3119|  4.34M|    {
 3120|       |      /* Found a newline, directly write up to (including) this
 3121|       |	 character.  */
 3122|  4.34M|      err = flush_stream (stream);
 3123|  4.34M|      if (!err)
  ------------------
  |  Branch (3123:11): [True: 4.34M, False: 0]
  ------------------
 3124|  4.34M|	err = es_write_nbf (stream, buffer, nlp - buffer + 1, &data_flushed);
 3125|  4.34M|    }
 3126|       |
 3127|  26.0M|  if (!err)
  ------------------
  |  Branch (3127:7): [True: 26.0M, False: 0]
  ------------------
 3128|  26.0M|    {
 3129|       |      /* Write remaining data fully buffered.  */
 3130|  26.0M|      err = es_write_fbf (stream, buffer + data_flushed,
 3131|  26.0M|			  bytes_to_write - data_flushed, &data_buffered);
 3132|  26.0M|    }
 3133|       |
 3134|  26.0M|  *bytes_written = data_flushed + data_buffered;
 3135|  26.0M|  return err;
 3136|  26.0M|}
estream.c:es_write_fbf:
 3067|  26.0M|{
 3068|  26.0M|  size_t space_available;
 3069|  26.0M|  size_t data_to_write;
 3070|  26.0M|  size_t data_written;
 3071|  26.0M|  int err;
 3072|       |
 3073|  26.0M|  data_written = 0;
 3074|  26.0M|  err = 0;
 3075|       |
 3076|  47.7M|  while ((bytes_to_write - data_written) && (! err))
  ------------------
  |  Branch (3076:10): [True: 21.6M, False: 26.0M]
  |  Branch (3076:45): [True: 21.6M, False: 0]
  ------------------
 3077|  21.6M|    {
 3078|  21.6M|      if (stream->data_offset == stream->buffer_size)
  ------------------
  |  Branch (3078:11): [True: 2.39k, False: 21.6M]
  ------------------
 3079|       |	/* Container full, flush buffer.  */
 3080|  2.39k|	err = flush_stream (stream);
 3081|       |
 3082|  21.6M|      if (! err)
  ------------------
  |  Branch (3082:11): [True: 21.6M, False: 0]
  ------------------
 3083|  21.6M|	{
 3084|       |	  /* Flushing resulted in empty container.  */
 3085|       |
 3086|  21.6M|	  data_to_write = bytes_to_write - data_written;
 3087|  21.6M|	  space_available = stream->buffer_size - stream->data_offset;
 3088|  21.6M|	  if (data_to_write > space_available)
  ------------------
  |  Branch (3088:8): [True: 346, False: 21.6M]
  ------------------
 3089|    346|	    data_to_write = space_available;
 3090|       |
 3091|  21.6M|	  memcpy (stream->buffer + stream->data_offset,
 3092|  21.6M|		  buffer + data_written, data_to_write);
 3093|  21.6M|	  stream->data_offset += data_to_write;
 3094|  21.6M|	  data_written += data_to_write;
 3095|  21.6M|	}
 3096|  21.6M|    }
 3097|       |
 3098|  26.0M|  *bytes_written = data_written;
 3099|       |
 3100|  26.0M|  return err;
 3101|  26.0M|}
estream.c:es_seek:
 2944|  4.46k|{
 2945|  4.46k|  gpgrt_cookie_seek_function_t func_seek = stream->intern->func_seek;
 2946|  4.46k|  int err, ret;
 2947|  4.46k|  gpgrt_off_t off;
 2948|       |
 2949|  4.46k|  if (! func_seek)
  ------------------
  |  Branch (2949:7): [True: 0, False: 4.46k]
  ------------------
 2950|      0|    {
 2951|      0|      _set_errno (EOPNOTSUPP);
  ------------------
  |  |  146|      0|#define _set_errno(a)  do { errno = (a); } while (0)
  |  |  ------------------
  |  |  |  Branch (146:51): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2952|      0|      err = -1;
 2953|      0|      goto out;
 2954|      0|    }
 2955|       |
 2956|  4.46k|  if (stream->flags.writing)
  ------------------
  |  Branch (2956:7): [True: 0, False: 4.46k]
  ------------------
 2957|      0|    {
 2958|       |      /* Flush data first in order to prevent flushing it to the wrong
 2959|       |	 offset.  */
 2960|      0|      err = flush_stream (stream);
 2961|      0|      if (err)
  ------------------
  |  Branch (2961:11): [True: 0, False: 0]
  ------------------
 2962|      0|	goto out;
 2963|      0|      stream->flags.writing = 0;
 2964|      0|    }
 2965|       |
 2966|  4.46k|  off = offset;
 2967|  4.46k|  if (whence == SEEK_CUR)
  ------------------
  |  Branch (2967:7): [True: 0, False: 4.46k]
  ------------------
 2968|      0|    {
 2969|      0|      off = off - stream->data_len + stream->data_offset;
 2970|      0|      off -= stream->unread_data_len;
 2971|      0|    }
 2972|       |
 2973|  4.46k|  ret = (*func_seek) (stream->intern->cookie, &off, whence);
 2974|  4.46k|  if (ret == -1)
  ------------------
  |  Branch (2974:7): [True: 0, False: 4.46k]
  ------------------
 2975|      0|    {
 2976|      0|      err = -1;
 2977|       |#if EWOULDBLOCK != EAGAIN
 2978|       |      if (errno == EWOULDBLOCK)
 2979|       |        _set_errno (EAGAIN);
 2980|       |#endif
 2981|      0|      goto out;
 2982|      0|    }
 2983|       |
 2984|  4.46k|  err = 0;
 2985|  4.46k|  es_empty (stream);
 2986|       |
 2987|  4.46k|  if (offset_new)
  ------------------
  |  Branch (2987:7): [True: 0, False: 4.46k]
  ------------------
 2988|      0|    *offset_new = off;
 2989|       |
 2990|  4.46k|  stream->intern->indicators.eof = 0;
 2991|  4.46k|  stream->intern->offset = off;
 2992|       |
 2993|  4.46k| out:
 2994|       |
 2995|  4.46k|  if (err)
  ------------------
  |  Branch (2995:7): [True: 0, False: 4.46k]
  ------------------
 2996|      0|    {
 2997|      0|      if (errno == EPIPE)
  ------------------
  |  Branch (2997:11): [True: 0, False: 0]
  ------------------
 2998|      0|        stream->intern->indicators.hup = 1;
 2999|      0|      stream->intern->indicators.err = 1;
 3000|      0|    }
 3001|       |
 3002|  4.46k|  return err;
 3003|  4.46k|}
estream.c:es_empty:
 2380|  4.46k|{
 2381|  4.46k|  gpgrt_assert (!stream->flags.writing);
  ------------------
  |  |  577|  4.46k|  ((expr)                                                       \
  |  |  ------------------
  |  |  |  Branch (577:4): [True: 4.46k, False: 0]
  |  |  ------------------
  |  |  578|  4.46k|   ? (void) 0                                                   \
  |  |  579|  4.46k|   : _gpgrt__log_assert (#expr, __FILE__, __LINE__, __FUNCTION__))
  ------------------
 2382|      0|  stream->data_len = 0;
 2383|  4.46k|  stream->data_offset = 0;
 2384|  4.46k|  stream->unread_data_len = 0;
 2385|  4.46k|}
estream.c:do_fpopen:
 3777|      2|{
 3778|      2|  unsigned int modeflags, cmode, xmode;
 3779|      2|  int create_called = 0;
 3780|      2|  estream_t stream = NULL;
 3781|      2|  void *cookie = NULL;
 3782|      2|  int err;
 3783|      2|  es_syshd_t syshd;
 3784|       |
 3785|      2|  err = parse_mode (mode, &modeflags, &xmode, &cmode);
 3786|      2|  if (err)
  ------------------
  |  Branch (3786:7): [True: 0, False: 2]
  ------------------
 3787|      0|    goto out;
 3788|      2|  if ((xmode & X_SYSOPEN))
  ------------------
  |  | 2045|      2|#define X_SYSOPEN	(1 << 1)
  ------------------
  |  Branch (3788:7): [True: 0, False: 2]
  ------------------
 3789|      0|    {
 3790|       |      /* Not allowed for fpopen.  */
 3791|      0|      _set_errno (EINVAL);
  ------------------
  |  |  146|      0|#define _set_errno(a)  do { errno = (a); } while (0)
  |  |  ------------------
  |  |  |  Branch (146:51): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3792|      0|      err = -1;
 3793|      0|      goto out;
 3794|      0|    }
 3795|       |
 3796|      2|  if (fp)
  ------------------
  |  Branch (3796:7): [True: 2, False: 0]
  ------------------
 3797|      2|    fflush (fp);
 3798|      2|  err = func_fp_create (&cookie, fp, modeflags, no_close);
 3799|      2|  if (err)
  ------------------
  |  Branch (3799:7): [True: 0, False: 2]
  ------------------
 3800|      0|    goto out;
 3801|       |
 3802|      2|  syshd.type = ES_SYSHD_FD;
  ------------------
  |  | 1255|      2|#define ES_SYSHD_FD     GPGRT_SYSHD_FD
  ------------------
 3803|      2|  syshd.u.fd = fp? fileno (fp): -1;
  ------------------
  |  Branch (3803:16): [True: 2, False: 0]
  ------------------
 3804|      2|  create_called = 1;
 3805|      2|  err = create_stream (&stream, cookie, &syshd,
 3806|      2|                       BACKEND_FP, estream_functions_fp,
 3807|      2|                       modeflags, xmode, with_locked_list);
 3808|       |
 3809|      2| out:
 3810|      2|  if (err && create_called)
  ------------------
  |  Branch (3810:7): [True: 0, False: 2]
  |  Branch (3810:14): [True: 0, False: 0]
  ------------------
 3811|      0|    (*estream_functions_fp.public.func_close) (cookie);
 3812|       |
 3813|      2|  return stream;
 3814|      2|}
estream.c:func_fp_create:
 1681|      2|{
 1682|      2|  estream_cookie_fp_t fp_cookie;
 1683|      2|  int err;
 1684|       |
 1685|      2|  fp_cookie = mem_alloc (sizeof *fp_cookie);
 1686|      2|  if (!fp_cookie)
  ------------------
  |  Branch (1686:7): [True: 0, False: 2]
  ------------------
 1687|      0|    err = -1;
 1688|      2|  else
 1689|      2|    {
 1690|       |#ifdef HAVE_DOSISH_SYSTEM
 1691|       |      /* Make sure it is in binary mode if requested.  */
 1692|       |      if ( (modeflags & O_BINARY) )
 1693|       |        setmode (fileno (fp), O_BINARY);
 1694|       |#else
 1695|      2|      (void)modeflags;
 1696|      2|#endif
 1697|      2|      fp_cookie->fp = fp;
 1698|      2|      fp_cookie->no_close = no_close;
 1699|      2|      *cookie = fp_cookie;
 1700|      2|      err = 0;
 1701|      2|    }
 1702|       |
 1703|      2|  return err;
 1704|      2|}
estream.c:func_fp_write:
 1739|  4.58k|{
 1740|  4.58k|  estream_cookie_fp_t file_cookie = cookie;
 1741|  4.58k|  size_t bytes_written;
 1742|       |
 1743|  4.58k|  if (file_cookie->fp)
  ------------------
  |  Branch (1743:7): [True: 4.58k, False: 0]
  ------------------
 1744|  4.58k|    {
 1745|  4.58k|      _gpgrt_pre_syscall ();
 1746|  4.58k|      if (buffer)
  ------------------
  |  Branch (1746:11): [True: 4, False: 4.58k]
  ------------------
 1747|      4|        {
 1748|       |#ifdef HAVE_W32_SYSTEM
 1749|       |          /* Using an fwrite to stdout connected to the console fails
 1750|       |             with the error "Not enough space" for an fwrite size of
 1751|       |             >= 52KB (tested on Windows XP SP2).  To solve this we
 1752|       |             always chunk the writes up into smaller blocks.  */
 1753|       |          bytes_written = 0;
 1754|       |          while (bytes_written < size)
 1755|       |            {
 1756|       |              size_t cnt = size - bytes_written;
 1757|       |
 1758|       |              if (cnt > 32*1024)
 1759|       |                cnt = 32*1024;
 1760|       |              if (fwrite ((const char*)buffer + bytes_written,
 1761|       |                          cnt, 1, file_cookie->fp) != 1)
 1762|       |                break; /* Write error.  */
 1763|       |              bytes_written += cnt;
 1764|       |            }
 1765|       |#else
 1766|      4|          bytes_written = fwrite (buffer, 1, size, file_cookie->fp);
 1767|      4|#endif
 1768|      4|        }
 1769|  4.58k|      else /* Only flush requested.  */
 1770|  4.58k|        bytes_written = size;
 1771|       |
 1772|  4.58k|      fflush (file_cookie->fp);
 1773|  4.58k|      _gpgrt_post_syscall ();
 1774|  4.58k|    }
 1775|      0|  else
 1776|      0|    bytes_written = size; /* Successfully written to the bit bucket.  */
 1777|       |
 1778|  4.58k|  if (bytes_written != size)
  ------------------
  |  Branch (1778:7): [True: 0, False: 4.58k]
  ------------------
 1779|      0|    return -1;
 1780|  4.58k|  return bytes_written;
 1781|  4.58k|}
estream.c:lock_list:
  470|  11.6k|{
  471|  11.6k|  dbg_lock_0 ("enter lock_list\n");
  472|  11.6k|  _gpgrt_lock_lock (&estream_list_lock);
  473|  11.6k|  dbg_lock_0 ("leave lock_list\n");
  474|  11.6k|}
estream.c:unlock_list:
  479|  11.6k|{
  480|  11.6k|  dbg_lock_0 ("enter unlock_list\n");
  481|  11.6k|  _gpgrt_lock_unlock (&estream_list_lock);
  482|  11.6k|  dbg_lock_0 ("leave unlock_list\n");
  483|  11.6k|}
estream.c:es_set_buffering:
 3419|      3|{
 3420|      3|  int err;
 3421|       |
 3422|       |  /* Flush or empty buffer depending on mode.  */
 3423|      3|  if (stream->flags.writing)
  ------------------
  |  Branch (3423:7): [True: 3, False: 0]
  ------------------
 3424|      3|    {
 3425|      3|      err = flush_stream (stream);
 3426|      3|      if (err)
  ------------------
  |  Branch (3426:11): [True: 0, False: 3]
  ------------------
 3427|      0|	goto out;
 3428|      3|    }
 3429|      0|  else
 3430|      0|    es_empty (stream);
 3431|       |
 3432|      3|  stream->intern->indicators.eof = 0;
 3433|       |
 3434|       |  /* Free old buffer in case that was allocated by this function.  */
 3435|      3|  if (stream->intern->deallocate_buffer)
  ------------------
  |  Branch (3435:7): [True: 1, False: 2]
  ------------------
 3436|      1|    {
 3437|      1|      stream->intern->deallocate_buffer = 0;
 3438|      1|      mem_free (stream->buffer);
 3439|      1|      stream->buffer = NULL;
 3440|      1|    }
 3441|       |
 3442|      3|  if (mode == _IONBF)
  ------------------
  |  Branch (3442:7): [True: 0, False: 3]
  ------------------
 3443|      0|    stream->buffer_size = 0;
 3444|      3|  else
 3445|      3|    {
 3446|      3|      void *buffer_new;
 3447|       |
 3448|      3|      if (buffer)
  ------------------
  |  Branch (3448:11): [True: 0, False: 3]
  ------------------
 3449|      0|	buffer_new = buffer;
 3450|      3|      else
 3451|      3|	{
 3452|      3|          if (!size)
  ------------------
  |  Branch (3452:15): [True: 3, False: 0]
  ------------------
 3453|      3|            size = BUFSIZ;
 3454|      3|	  buffer_new = mem_alloc (size);
 3455|      3|	  if (! buffer_new)
  ------------------
  |  Branch (3455:8): [True: 0, False: 3]
  ------------------
 3456|      0|	    {
 3457|      0|	      err = -1;
 3458|      0|	      goto out;
 3459|      0|	    }
 3460|      3|	}
 3461|       |
 3462|      3|      stream->buffer = buffer_new;
 3463|      3|      stream->buffer_size = size;
 3464|      3|      if (! buffer)
  ------------------
  |  Branch (3464:11): [True: 3, False: 0]
  ------------------
 3465|      3|	stream->intern->deallocate_buffer = 1;
 3466|      3|    }
 3467|      3|  stream->intern->strategy = mode;
 3468|      3|  err = 0;
 3469|       |
 3470|      3| out:
 3471|       |
 3472|      3|  return err;
 3473|      3|}
estream.c:lock_stream:
  429|  4.56M|{
  430|  4.56M|  if (!stream->intern->samethread)
  ------------------
  |  Branch (430:7): [True: 4.56M, False: 0]
  ------------------
  431|  4.56M|    {
  432|  4.56M|      dbg_lock_1 ("enter lock_stream for %p\n", stream);
  433|  4.56M|      _gpgrt_lock_lock (&stream->intern->lock);
  434|  4.56M|      dbg_lock_1 ("leave lock_stream for %p\n", stream);
  435|  4.56M|    }
  436|  4.56M|}
estream.c:deinit_stream_obj:
 2443|  3.54k|{
 2444|  3.54k|  gpgrt_cookie_close_function_t func_close;
 2445|  3.54k|  int err, tmp_err;
 2446|       |
 2447|  3.54k|  trace (("enter: stream %p", stream));
  ------------------
  |  |  189|  3.54k|# define trace(X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (189:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2448|  3.54k|  func_close = stream->intern->func_close;
 2449|       |
 2450|  3.54k|  err = 0;
 2451|  3.54k|  if (stream->flags.writing)
  ------------------
  |  Branch (2451:7): [True: 2, False: 3.53k]
  ------------------
 2452|      2|    {
 2453|      2|      tmp_err = flush_stream (stream);
 2454|      2|      if (!err)
  ------------------
  |  Branch (2454:11): [True: 2, False: 0]
  ------------------
 2455|      2|        err = tmp_err;
 2456|      2|    }
 2457|  3.54k|  if (func_close)
  ------------------
  |  Branch (2457:7): [True: 3.54k, False: 0]
  ------------------
 2458|  3.54k|    {
 2459|  3.54k|      trace (("stream %p calling func_close", stream));
  ------------------
  |  |  189|  3.54k|# define trace(X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (189:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2460|  3.54k|      tmp_err = func_close (stream->intern->cookie);
 2461|  3.54k|      if (!err)
  ------------------
  |  Branch (2461:11): [True: 3.54k, False: 0]
  ------------------
 2462|  3.54k|        err = tmp_err;
 2463|  3.54k|    }
 2464|       |
 2465|  3.54k|  mem_free (stream->intern->printable_fname);
 2466|  3.54k|  stream->intern->printable_fname = NULL;
 2467|  3.54k|  stream->intern->printable_fname_inuse = 0;
 2468|  3.54k|  while (stream->intern->onclose)
  ------------------
  |  Branch (2468:10): [True: 0, False: 3.54k]
  ------------------
 2469|      0|    {
 2470|      0|      notify_list_t tmp = stream->intern->onclose->next;
 2471|      0|      mem_free (stream->intern->onclose);
 2472|      0|      stream->intern->onclose = tmp;
 2473|      0|    }
 2474|       |
 2475|  3.54k|  trace_errno (err, ("leave: stream %p err=%d", stream, err));
  ------------------
  |  |  190|  3.54k|# define trace_errno(C,X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (190:41): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2476|  3.54k|  return err;
 2477|  3.54k|}
estream.c:init_stream_obj:
 2397|  3.54k|{
 2398|  3.54k|  stream->intern->kind = kind;
 2399|  3.54k|  stream->intern->cookie = cookie;
 2400|  3.54k|  stream->intern->opaque = NULL;
 2401|  3.54k|  stream->intern->offset = 0;
 2402|  3.54k|  stream->intern->func_read = functions.public.func_read;
 2403|  3.54k|  stream->intern->func_write = functions.public.func_write;
 2404|  3.54k|  stream->intern->func_seek = functions.public.func_seek;
 2405|  3.54k|  stream->intern->func_ioctl = functions.func_ioctl;
 2406|  3.54k|  stream->intern->func_close = functions.public.func_close;
 2407|  3.54k|  stream->intern->strategy = _IOFBF;
 2408|  3.54k|  stream->intern->syshd = *syshd;
 2409|  3.54k|  stream->intern->print_ntotal = 0;
 2410|  3.54k|  stream->intern->indicators.err = 0;
 2411|  3.54k|  stream->intern->indicators.eof = 0;
 2412|  3.54k|  stream->intern->indicators.hup = 0;
 2413|  3.54k|  stream->intern->is_stdstream = 0;
 2414|  3.54k|  stream->intern->stdstream_fd = 0;
 2415|  3.54k|  stream->intern->deallocate_buffer = 0;
 2416|  3.54k|  stream->intern->printable_fname = NULL;
 2417|  3.54k|  stream->intern->printable_fname_inuse = 0;
 2418|  3.54k|  stream->intern->samethread = !! (xmode & X_SAMETHREAD);
  ------------------
  |  | 2044|  3.54k|#define X_SAMETHREAD	(1 << 0)
  ------------------
 2419|  3.54k|  stream->intern->onclose = NULL;
 2420|       |
 2421|  3.54k|  stream->data_len = 0;
 2422|  3.54k|  stream->data_offset = 0;
 2423|  3.54k|  stream->data_flushed = 0;
 2424|  3.54k|  stream->unread_data_len = 0;
 2425|       |  /* Depending on the modeflags we set whether we start in writing or
 2426|       |     reading mode.  This is required in case we are working on a
 2427|       |     stream which is not seeekable (like stdout).  Without this
 2428|       |     pre-initialization we would do a seek at the first write call and
 2429|       |     as this will fail no output will be delivered. */
 2430|  3.54k|  if ((modeflags & O_WRONLY) || (modeflags & O_RDWR) )
  ------------------
  |  Branch (2430:7): [True: 5, False: 3.53k]
  |  Branch (2430:33): [True: 0, False: 3.53k]
  ------------------
 2431|      5|    stream->flags.writing = 1;
 2432|  3.53k|  else
 2433|  3.53k|    stream->flags.writing = 0;
 2434|  3.54k|}
estream.c:func_fd_destroy:
 1153|  3.54k|{
 1154|  3.54k|  estream_cookie_fd_t fd_cookie = cookie;
 1155|  3.54k|  int err;
 1156|       |
 1157|  3.54k|  trace (("enter: cookie=%p", cookie));
  ------------------
  |  |  189|  3.54k|# define trace(X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (189:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1158|       |
 1159|  3.54k|  if (fd_cookie)
  ------------------
  |  Branch (1159:7): [True: 3.54k, False: 0]
  ------------------
 1160|  3.54k|    {
 1161|  3.54k|      if (IS_INVALID_FD (fd_cookie->fd))
  ------------------
  |  |  148|  3.54k|#define IS_INVALID_FD(a)    ((a) == -1)
  |  |  ------------------
  |  |  |  Branch (148:29): [True: 0, False: 3.54k]
  |  |  ------------------
  ------------------
 1162|      0|        err = 0;
 1163|  3.54k|      else
 1164|  3.54k|        err = fd_cookie->no_close? 0 : close (fd_cookie->fd);
  ------------------
  |  Branch (1164:15): [True: 0, False: 3.54k]
  ------------------
 1165|  3.54k|      mem_free (fd_cookie);
 1166|  3.54k|    }
 1167|      0|  else
 1168|      0|    err = 0;
 1169|       |
 1170|  3.54k|  trace_errno (err,("leave: err=%d", err));
  ------------------
  |  |  190|  3.54k|# define trace_errno(C,X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (190:41): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1171|  3.54k|  return err;
 1172|  3.54k|}
estream.c:do_close:
 2593|  3.54k|{
 2594|  3.54k|  int err;
 2595|       |
 2596|  3.54k|  trace (("stream %p %s", stream, with_locked_list? "(with locked list)":""));
  ------------------
  |  |  189|  3.54k|# define trace(X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (189:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2597|       |
 2598|  3.54k|  if (stream)
  ------------------
  |  Branch (2598:7): [True: 3.54k, False: 0]
  ------------------
 2599|  3.54k|    {
 2600|  3.54k|      do_list_remove (stream, with_locked_list);
 2601|  3.54k|      if (cancel_mode)
  ------------------
  |  Branch (2601:11): [True: 0, False: 3.54k]
  ------------------
 2602|      0|        {
 2603|      0|          stream->flags.writing = 0;
 2604|      0|          es_empty (stream);
 2605|      0|        }
 2606|  3.54k|      while (stream->intern->onclose)
  ------------------
  |  Branch (2606:14): [True: 0, False: 3.54k]
  ------------------
 2607|      0|        {
 2608|      0|          notify_list_t tmp = stream->intern->onclose->next;
 2609|       |
 2610|      0|          if (stream->intern->onclose->fnc)
  ------------------
  |  Branch (2610:15): [True: 0, False: 0]
  ------------------
 2611|      0|            stream->intern->onclose->fnc (stream,
 2612|      0|                                          stream->intern->onclose->fnc_value);
 2613|      0|          mem_free (stream->intern->onclose);
 2614|      0|          stream->intern->onclose = tmp;
 2615|      0|        }
 2616|  3.54k|      err = deinit_stream_obj (stream);
 2617|  3.54k|      destroy_stream_lock (stream);
 2618|  3.54k|      if (stream->intern->deallocate_buffer)
  ------------------
  |  Branch (2618:11): [True: 0, False: 3.54k]
  ------------------
 2619|      0|        mem_free (stream->buffer);
 2620|  3.54k|      mem_free (stream->intern);
 2621|  3.54k|      mem_free (stream);
 2622|  3.54k|    }
 2623|      0|  else
 2624|      0|    err = 0;
 2625|       |
 2626|  3.54k|  trace_errno (err, ("stream %p err=%d", stream, err));
  ------------------
  |  |  190|  3.54k|# define trace_errno(C,X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (190:41): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2627|  3.54k|  return err;
 2628|  3.54k|}
estream.c:do_list_remove:
  541|  3.54k|{
  542|  3.54k|  estream_list_t item, item_prev = NULL;
  543|       |
  544|  3.54k|  if (!with_locked_list)
  ------------------
  |  Branch (544:7): [True: 3.54k, False: 0]
  ------------------
  545|  3.54k|    lock_list ();
  546|       |
  547|  3.54k|  for (item = estream_list; item; item = item->next)
  ------------------
  |  Branch (547:29): [True: 3.54k, False: 0]
  ------------------
  548|  3.54k|    if (item->stream == stream)
  ------------------
  |  Branch (548:9): [True: 3.54k, False: 0]
  ------------------
  549|  3.54k|      break;
  550|      0|    else
  551|      0|      item_prev = item;
  552|       |
  553|  3.54k|  if (item)
  ------------------
  |  Branch (553:7): [True: 3.54k, False: 0]
  ------------------
  554|  3.54k|    {
  555|  3.54k|      if (item_prev)
  ------------------
  |  Branch (555:11): [True: 0, False: 3.54k]
  ------------------
  556|      0|        item_prev->next = item->next;
  557|  3.54k|      else
  558|  3.54k|        estream_list = item->next;
  559|  3.54k|      mem_free (item);
  560|  3.54k|    }
  561|       |
  562|  3.54k|  if (!with_locked_list)
  ------------------
  |  Branch (562:7): [True: 3.54k, False: 0]
  ------------------
  563|  3.54k|    unlock_list ();
  564|  3.54k|}
estream.c:unlock_stream:
  458|  4.56M|{
  459|  4.56M|  if (!stream->intern->samethread)
  ------------------
  |  Branch (459:7): [True: 4.56M, False: 0]
  ------------------
  460|  4.56M|    {
  461|  4.56M|      dbg_lock_1 ("enter unlock_stream for %p\n", stream);
  462|  4.56M|      _gpgrt_lock_unlock (&stream->intern->lock);
  463|  4.56M|      dbg_lock_1 ("leave unlock_stream for %p\n", stream);
  464|  4.56M|    }
  465|  4.56M|}
estream.c:flush_stream:
 2296|  4.35M|{
 2297|  4.35M|  gpgrt_cookie_write_function_t func_write = stream->intern->func_write;
 2298|  4.35M|  int err;
 2299|       |
 2300|  4.35M|  gpgrt_assert (stream->flags.writing);
  ------------------
  |  |  577|  4.35M|  ((expr)                                                       \
  |  |  ------------------
  |  |  |  Branch (577:4): [True: 4.35M, False: 0]
  |  |  ------------------
  |  |  578|  4.35M|   ? (void) 0                                                   \
  |  |  579|  4.35M|   : _gpgrt__log_assert (#expr, __FILE__, __LINE__, __FUNCTION__))
  ------------------
 2301|       |
 2302|  4.35M|  if (stream->data_offset)
  ------------------
  |  Branch (2302:7): [True: 4.02M, False: 330k]
  ------------------
 2303|  4.02M|    {
 2304|  4.02M|      size_t bytes_written;
 2305|  4.02M|      size_t data_flushed;
 2306|  4.02M|      gpgrt_ssize_t ret;
 2307|       |
 2308|  4.02M|      if (! func_write)
  ------------------
  |  Branch (2308:11): [True: 0, False: 4.02M]
  ------------------
 2309|      0|	{
 2310|      0|          _set_errno (EOPNOTSUPP);
  ------------------
  |  |  146|      0|#define _set_errno(a)  do { errno = (a); } while (0)
  |  |  ------------------
  |  |  |  Branch (146:51): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2311|      0|          err = -1;
 2312|      0|	  goto out;
 2313|      0|	}
 2314|       |
 2315|       |      /* Note: to prevent an endless loop caused by user-provided
 2316|       |	 write-functions that pretend to have written more bytes than
 2317|       |	 they were asked to write, we have to check for
 2318|       |	 "(stream->data_offset - data_flushed) > 0" instead of
 2319|       |	 "stream->data_offset - data_flushed".  */
 2320|       |
 2321|  4.02M|      data_flushed = 0;
 2322|  4.02M|      err = 0;
 2323|       |
 2324|  8.04M|      while ((((gpgrt_ssize_t) (stream->data_offset - data_flushed)) > 0)
  ------------------
  |  Branch (2324:14): [True: 4.02M, False: 4.02M]
  ------------------
 2325|  8.04M|             && !err)
  ------------------
  |  Branch (2325:17): [True: 4.02M, False: 0]
  ------------------
 2326|  4.02M|	{
 2327|  4.02M|	  ret = (*func_write) (stream->intern->cookie,
 2328|  4.02M|			       stream->buffer + data_flushed,
 2329|  4.02M|			       stream->data_offset - data_flushed);
 2330|  4.02M|	  if (ret == -1)
  ------------------
  |  Branch (2330:8): [True: 0, False: 4.02M]
  ------------------
 2331|      0|	    {
 2332|      0|	      bytes_written = 0;
 2333|      0|	      err = -1;
 2334|       |#if EWOULDBLOCK != EAGAIN
 2335|       |              if (errno == EWOULDBLOCK)
 2336|       |                _set_errno (EAGAIN);
 2337|       |#endif
 2338|      0|	    }
 2339|  4.02M|	  else
 2340|  4.02M|	    bytes_written = ret;
 2341|       |
 2342|  4.02M|	  data_flushed += bytes_written;
 2343|  4.02M|	  if (err)
  ------------------
  |  Branch (2343:8): [True: 0, False: 4.02M]
  ------------------
 2344|      0|	    break;
 2345|  4.02M|	}
 2346|       |
 2347|  4.02M|      stream->data_flushed += data_flushed;
 2348|  4.02M|      if (stream->data_offset == data_flushed)
  ------------------
  |  Branch (2348:11): [True: 4.02M, False: 0]
  ------------------
 2349|  4.02M|	{
 2350|  4.02M|	  stream->intern->offset += stream->data_offset;
 2351|  4.02M|	  stream->data_offset = 0;
 2352|  4.02M|	  stream->data_flushed = 0;
 2353|  4.02M|	}
 2354|  4.02M|    }
 2355|   330k|  else
 2356|   330k|    err = 0;
 2357|       |
 2358|       |  /* Always propagate flush event in case gpgrt_fflush was called
 2359|       |   * explictly to do flush buffers in caller's cookie functions.  */
 2360|  4.35M|  (*func_write) (stream->intern->cookie, NULL, 0);
 2361|       |
 2362|  4.35M| out:
 2363|       |
 2364|  4.35M|  if (err && errno != EAGAIN)
  ------------------
  |  Branch (2364:7): [True: 0, False: 4.35M]
  |  Branch (2364:14): [True: 0, False: 0]
  ------------------
 2365|      0|    {
 2366|      0|      if (errno == EPIPE)
  ------------------
  |  Branch (2366:11): [True: 0, False: 0]
  ------------------
 2367|      0|        stream->intern->indicators.hup = 1;
 2368|      0|      stream->intern->indicators.err = 1;
 2369|      0|    }
 2370|       |
 2371|  4.35M|  return err;
 2372|  4.35M|}
estream.c:do_fflush:
 4440|  4.58k|{
 4441|  4.58k|  int err;
 4442|       |
 4443|  4.58k|  if (stream->flags.writing)
  ------------------
  |  Branch (4443:7): [True: 4.58k, False: 0]
  ------------------
 4444|  4.58k|    err = flush_stream (stream);
 4445|      0|  else
 4446|      0|    {
 4447|      0|      es_empty (stream);
 4448|      0|      err = 0;
 4449|      0|    }
 4450|       |
 4451|  4.58k|  return err;
 4452|  4.58k|}
estream.c:es_offset_calculate:
 3478|  8.18k|{
 3479|  8.18k|  gpgrt_off_t offset;
 3480|       |
 3481|  8.18k|  offset = stream->intern->offset + stream->data_offset;
 3482|  8.18k|  if (offset < stream->unread_data_len)
  ------------------
  |  Branch (3482:7): [True: 0, False: 8.18k]
  ------------------
 3483|       |    /* Offset undefined.  */
 3484|      0|    offset = 0;
 3485|  8.18k|  else
 3486|  8.18k|    offset -= stream->unread_data_len;
 3487|       |
 3488|  8.18k|  return offset;
 3489|  8.18k|}
estream.c:es_readn:
 2819|  12.2k|{
 2820|  12.2k|  unsigned char *buffer = (unsigned char *)buffer_arg;
 2821|  12.2k|  size_t data_read_unread, data_read;
 2822|  12.2k|  int err;
 2823|       |
 2824|  12.2k|  data_read_unread = 0;
 2825|  12.2k|  data_read = 0;
 2826|  12.2k|  err = 0;
 2827|       |
 2828|  12.2k|  if (stream->flags.writing)
  ------------------
  |  Branch (2828:7): [True: 0, False: 12.2k]
  ------------------
 2829|      0|    {
 2830|       |      /* Switching to reading mode -> flush output.  */
 2831|      0|      err = flush_stream (stream);
 2832|      0|      if (err)
  ------------------
  |  Branch (2832:11): [True: 0, False: 0]
  ------------------
 2833|      0|	goto out;
 2834|      0|      stream->flags.writing = 0;
 2835|      0|    }
 2836|       |
 2837|       |  /* Read unread data first.  */
 2838|  12.2k|  while ((bytes_to_read - data_read_unread) && stream->unread_data_len)
  ------------------
  |  Branch (2838:10): [True: 12.2k, False: 0]
  |  Branch (2838:48): [True: 0, False: 12.2k]
  ------------------
 2839|      0|    {
 2840|      0|      buffer[data_read_unread]
 2841|      0|	= stream->unread_buffer[stream->unread_data_len - 1];
 2842|      0|      stream->unread_data_len--;
 2843|      0|      data_read_unread++;
 2844|      0|    }
 2845|       |
 2846|  12.2k|  switch (stream->intern->strategy)
  ------------------
  |  Branch (2846:11): [True: 0, False: 12.2k]
  ------------------
 2847|  12.2k|    {
 2848|      0|    case _IONBF:
  ------------------
  |  Branch (2848:5): [True: 0, False: 12.2k]
  ------------------
 2849|      0|      err = do_read_nbf (stream,
 2850|      0|			 buffer + data_read_unread,
 2851|      0|			 bytes_to_read - data_read_unread, &data_read);
 2852|      0|      break;
 2853|      0|    case _IOLBF:
  ------------------
  |  Branch (2853:5): [True: 0, False: 12.2k]
  ------------------
 2854|      0|      err = do_read_lbf (stream,
 2855|      0|			 buffer + data_read_unread,
 2856|      0|			 bytes_to_read - data_read_unread, &data_read);
 2857|      0|      break;
 2858|  12.2k|    case _IOFBF:
  ------------------
  |  Branch (2858:5): [True: 12.2k, False: 0]
  ------------------
 2859|  12.2k|      err = do_read_fbf (stream,
 2860|  12.2k|			 buffer + data_read_unread,
 2861|  12.2k|			 bytes_to_read - data_read_unread, &data_read);
 2862|  12.2k|      break;
 2863|  12.2k|    }
 2864|       |
 2865|  12.2k| out:
 2866|       |
 2867|  12.2k|  if (bytes_read)
  ------------------
  |  Branch (2867:7): [True: 12.2k, False: 0]
  ------------------
 2868|  12.2k|    *bytes_read = data_read_unread + data_read;
 2869|       |
 2870|  12.2k|  return err;
 2871|  12.2k|}
estream.c:do_read_fbf:
 2728|  12.2k|{
 2729|  12.2k|  size_t data_available;
 2730|  12.2k|  size_t data_to_read;
 2731|  12.2k|  size_t data_read;
 2732|  12.2k|  int err;
 2733|       |
 2734|  12.2k|  data_read = 0;
 2735|  12.2k|  err = 0;
 2736|       |
 2737|  20.4k|  while ((bytes_to_read - data_read) && (! err))
  ------------------
  |  Branch (2737:10): [True: 12.2k, False: 8.19k]
  |  Branch (2737:41): [True: 12.2k, False: 0]
  ------------------
 2738|  12.2k|    {
 2739|  12.2k|      if (stream->data_offset == stream->data_len)
  ------------------
  |  Branch (2739:11): [True: 8.18k, False: 4.09k]
  ------------------
 2740|  8.18k|	{
 2741|       |	  /* Nothing more to read in current container, try to
 2742|       |	     fill container with new data.  */
 2743|  8.18k|	  err = fill_stream (stream);
 2744|  8.18k|	  if (! err)
  ------------------
  |  Branch (2744:8): [True: 8.18k, False: 0]
  ------------------
 2745|  8.18k|	    if (! stream->data_len)
  ------------------
  |  Branch (2745:10): [True: 4.09k, False: 4.09k]
  ------------------
 2746|       |	      /* Filling did not result in any data read.  */
 2747|  4.09k|	      break;
 2748|  8.18k|	}
 2749|       |
 2750|  8.19k|      if (! err)
  ------------------
  |  Branch (2750:11): [True: 8.19k, False: 0]
  ------------------
 2751|  8.19k|	{
 2752|       |	  /* Filling resulted in some new data.  */
 2753|       |
 2754|  8.19k|	  data_to_read = bytes_to_read - data_read;
 2755|  8.19k|	  data_available = stream->data_len - stream->data_offset;
 2756|  8.19k|	  if (data_to_read > data_available)
  ------------------
  |  Branch (2756:8): [True: 0, False: 8.19k]
  ------------------
 2757|      0|	    data_to_read = data_available;
 2758|       |
 2759|  8.19k|	  memcpy (buffer + data_read,
 2760|  8.19k|		  stream->buffer + stream->data_offset, data_to_read);
 2761|  8.19k|	  stream->data_offset += data_to_read;
 2762|  8.19k|	  data_read += data_to_read;
 2763|  8.19k|	}
 2764|  8.19k|    }
 2765|       |
 2766|  12.2k|  *bytes_read = data_read;
 2767|       |
 2768|  12.2k|  return err;
 2769|  12.2k|}
estream.c:fill_stream:
 2241|  8.18k|{
 2242|  8.18k|  size_t bytes_read = 0;
 2243|  8.18k|  int err;
 2244|       |
 2245|  8.18k|  if (!stream->intern->func_read)
  ------------------
  |  Branch (2245:7): [True: 0, False: 8.18k]
  ------------------
 2246|      0|    {
 2247|      0|      _set_errno (EOPNOTSUPP);
  ------------------
  |  |  146|      0|#define _set_errno(a)  do { errno = (a); } while (0)
  |  |  ------------------
  |  |  |  Branch (146:51): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2248|      0|      err = -1;
 2249|      0|    }
 2250|  8.18k|  else if (!stream->buffer_size)
  ------------------
  |  Branch (2250:12): [True: 0, False: 8.18k]
  ------------------
 2251|      0|    err = 0;
 2252|  8.18k|  else
 2253|  8.18k|    {
 2254|  8.18k|      gpgrt_cookie_read_function_t func_read = stream->intern->func_read;
 2255|  8.18k|      gpgrt_ssize_t ret;
 2256|       |
 2257|  8.18k|      ret = (*func_read) (stream->intern->cookie,
 2258|  8.18k|			  stream->buffer, stream->buffer_size);
 2259|  8.18k|      if (ret == -1)
  ------------------
  |  Branch (2259:11): [True: 0, False: 8.18k]
  ------------------
 2260|      0|	{
 2261|      0|	  bytes_read = 0;
 2262|      0|	  err = -1;
 2263|       |#if EWOULDBLOCK != EAGAIN
 2264|       |          if (errno == EWOULDBLOCK)
 2265|       |            _set_errno (EAGAIN);
 2266|       |#endif
 2267|      0|	}
 2268|  8.18k|      else
 2269|  8.18k|	{
 2270|  8.18k|	  bytes_read = ret;
 2271|  8.18k|	  err = 0;
 2272|  8.18k|	}
 2273|  8.18k|    }
 2274|       |
 2275|  8.18k|  if (err)
  ------------------
  |  Branch (2275:7): [True: 0, False: 8.18k]
  ------------------
 2276|      0|    {
 2277|      0|      if (errno != EAGAIN)
  ------------------
  |  Branch (2277:11): [True: 0, False: 0]
  ------------------
 2278|      0|        {
 2279|      0|          if (errno == EPIPE)
  ------------------
  |  Branch (2279:15): [True: 0, False: 0]
  ------------------
 2280|      0|            stream->intern->indicators.hup = 1;
 2281|      0|          stream->intern->indicators.err = 1;
 2282|      0|        }
 2283|      0|    }
 2284|  8.18k|  else if (!bytes_read)
  ------------------
  |  Branch (2284:12): [True: 4.09k, False: 4.09k]
  ------------------
 2285|  4.09k|    stream->intern->indicators.eof = 1;
 2286|       |
 2287|  8.18k|  stream->intern->offset += stream->data_len;
 2288|  8.18k|  stream->data_len = bytes_read;
 2289|  8.18k|  stream->data_offset = 0;
 2290|       |
 2291|  8.18k|  return err;
 2292|  8.18k|}
estream.c:mem_alloc:
  212|  17.7k|{
  213|  17.7k|  return _gpgrt_malloc (n);
  214|  17.7k|}
estream.c:do_print_stream:
 3405|  9.99M|{
 3406|  9.99M|  int rc;
 3407|       |
 3408|  9.99M|  stream->intern->print_ntotal = 0;
 3409|  9.99M|  rc = _gpgrt_estream_format (print_writer, stream, sf, sfvalue, format, ap);
 3410|  9.99M|  if (rc)
  ------------------
  |  Branch (3410:7): [True: 0, False: 9.99M]
  ------------------
 3411|      0|    return -1;
 3412|  9.99M|  return (int)stream->intern->print_ntotal;
 3413|  9.99M|}
estream.c:print_writer:
 3388|  26.0M|{
 3389|  26.0M|  estream_t stream = outfncarg;
 3390|  26.0M|  size_t nwritten;
 3391|  26.0M|  int rc;
 3392|       |
 3393|  26.0M|  nwritten = 0;
 3394|  26.0M|  rc = es_writen (stream, buf, buflen, &nwritten);
 3395|  26.0M|  stream->intern->print_ntotal += nwritten;
 3396|  26.0M|  return rc;
 3397|  26.0M|}
estream.c:fname_set_internal:
 5598|  3.54k|{
 5599|  3.54k|  if (stream->intern->printable_fname
  ------------------
  |  Branch (5599:7): [True: 0, False: 3.54k]
  ------------------
 5600|  3.54k|      && !stream->intern->printable_fname_inuse)
  ------------------
  |  Branch (5600:10): [True: 0, False: 0]
  ------------------
 5601|      0|    {
 5602|      0|      mem_free (stream->intern->printable_fname);
 5603|      0|      stream->intern->printable_fname = NULL;
 5604|      0|    }
 5605|  3.54k|  if (stream->intern->printable_fname)
  ------------------
  |  Branch (5605:7): [True: 0, False: 3.54k]
  ------------------
 5606|      0|    return; /* Can't change because it is in use.  */
 5607|       |
 5608|  3.54k|  if (*fname != '[')
  ------------------
  |  Branch (5608:7): [True: 3.54k, False: 2]
  ------------------
 5609|  3.54k|    quote = 0;
 5610|      2|  else
 5611|      2|    quote = !!quote;
 5612|       |
 5613|  3.54k|  stream->intern->printable_fname = mem_alloc (strlen (fname) + quote + 1);
 5614|  3.54k|  if (quote)
  ------------------
  |  Branch (5614:7): [True: 0, False: 3.54k]
  ------------------
 5615|      0|    stream->intern->printable_fname[0] = '\\';
 5616|  3.54k|  strcpy (stream->intern->printable_fname+quote, fname);
 5617|  3.54k|}

strerror.c:gpg_err_code:
  969|   336k|{
  970|   336k|  return (gpg_err_code_t) (err & GPG_ERR_CODE_MASK);
  ------------------
  |  |  742|   336k|#define GPG_ERR_CODE_MASK	(GPG_ERR_CODE_DIM - 1)
  ------------------
  971|   336k|}

_gpg_err_init:
   92|      2|{
   93|       |#ifdef HAVE_W32_SYSTEM
   94|       |# ifdef DLL_EXPORT
   95|       |  /* We always have a constructor and thus this function is called
   96|       |     automatically.  Due to the way the C init code of mingw works,
   97|       |     the constructors are called before our DllMain function is
   98|       |     called.  The problem with that is that the TLS has not been setup
   99|       |     and w32-gettext.c requires TLS.  To solve this we do nothing here
  100|       |     but call the actual init code from our DllMain.  */
  101|       |# else /*!DLL_EXPORT*/
  102|       |  /* Note that if the TLS is actually used, we can't release the TLS
  103|       |     as there is no way to know when a thread terminates (i.e. no
  104|       |     thread-specific-atexit).  You are really better off to use the
  105|       |     DLL! */
  106|       |  if (tls_index == TLS_OUT_OF_INDEXES)
  107|       |    {
  108|       |      tls_index = TlsAlloc ();
  109|       |      if (tls_index == TLS_OUT_OF_INDEXES)
  110|       |        {
  111|       |          /* No way to continue - commit suicide.  */
  112|       |          _gpgrt_abort ();
  113|       |        }
  114|       |      _gpg_w32__init_gettext_module ();
  115|       |      real_init ();
  116|       |    }
  117|       |# endif /*!DLL_EXPORT*/
  118|       |#else
  119|      2|  real_init ();
  120|      2|#endif
  121|      2|  return 0;
  122|      2|}
_gpgrt_realloc:
  234|  42.8k|{
  235|  42.8k|  if (custom_realloc)
  ------------------
  |  Branch (235:7): [True: 0, False: 42.8k]
  ------------------
  236|      0|    return custom_realloc (a, n);
  237|       |
  238|  42.8k|  if (!n)
  ------------------
  |  Branch (238:7): [True: 21.4k, False: 21.4k]
  ------------------
  239|  21.4k|    {
  240|  21.4k|      free (a);
  241|  21.4k|      return NULL;
  242|  21.4k|    }
  243|       |
  244|  21.4k|  if (!a)
  ------------------
  |  Branch (244:7): [True: 21.4k, False: 0]
  ------------------
  245|  21.4k|    return malloc (n);
  246|       |
  247|      0|  return realloc (a, n);
  248|  21.4k|}
_gpgrt_malloc:
  303|  21.4k|{
  304|  21.4k|  if (!n)
  ------------------
  |  Branch (304:7): [True: 0, False: 21.4k]
  ------------------
  305|      0|    n++;
  306|  21.4k|  return _gpgrt_realloc (NULL, n);
  307|  21.4k|}
_gpgrt_free:
  398|  25.0k|{
  399|  25.0k|  int save_errno;
  400|       |
  401|  25.0k|  if (!a)
  ------------------
  |  Branch (401:7): [True: 3.69k, False: 21.4k]
  ------------------
  402|  3.69k|    return;  /* Shortcut */
  403|       |
  404|       |  /* In case ERRNO is set we better save it so that the free machinery
  405|       |   * may not accidentally change ERRNO.  We restore it only if it was
  406|       |   * already set to comply with the usual C semantic for ERRNO.
  407|       |   * See also https://dev.gnupg.org/T5393#146261  */
  408|  21.4k|  save_errno = errno;
  409|  21.4k|  _gpgrt_realloc (a, 0);
  410|  21.4k|  if (save_errno && save_errno != errno)
  ------------------
  |  Branch (410:7): [True: 21.3k, False: 5]
  |  Branch (410:21): [True: 0, False: 21.3k]
  ------------------
  411|      0|    _gpg_err_set_errno (save_errno);
  412|  21.4k|}
_gpg_err_set_errno:
  417|  31.5k|{
  418|  31.5k|  errno = err;
  419|  31.5k|}
init.c:real_init:
   74|      2|{
   75|      2|#ifdef ENABLE_NLS
   76|      2|  char *locale_dir;
   77|       |
   78|       |  /* We only have to bind our locale directory to our text domain.  */
   79|      2|  locale_dir = get_locale_dir ();
  ------------------
  |  |   47|      2|#define get_locale_dir() LOCALEDIR
  ------------------
   80|      2|  if (locale_dir)
  ------------------
  |  Branch (80:7): [True: 2, False: 0]
  ------------------
   81|      2|    {
   82|      2|      bindtextdomain (PACKAGE, locale_dir);
  ------------------
  |  |  210|      2|#define PACKAGE "libgpg-error"
  ------------------
   83|      2|      drop_locale_dir (locale_dir);
   84|      2|    }
   85|      2|#endif
   86|      2|  _gpgrt_estream_init ();
   87|      2|}

_gpgrt_inc_errorcount:
  128|  4.16M|{
  129|       |  /* Protect against counter overflow.  */
  130|  4.16M|  if (errorcount < 30000)
  ------------------
  |  Branch (130:7): [True: 30.0k, False: 4.13M]
  ------------------
  131|  30.0k|    errorcount++;
  132|  4.16M|}
_gpgrt_log_set_sink:
  538|      2|{
  539|      2|  if (name && !stream && fd == -1)
  ------------------
  |  Branch (539:7): [True: 1, False: 1]
  |  Branch (539:15): [True: 1, False: 0]
  |  Branch (539:26): [True: 1, False: 0]
  ------------------
  540|      1|    set_file_fd (name, -1, NULL);
  541|      1|  else if (!name && !stream && fd != -1)
  ------------------
  |  Branch (541:12): [True: 1, False: 0]
  |  Branch (541:21): [True: 1, False: 0]
  |  Branch (541:32): [True: 0, False: 1]
  ------------------
  542|      0|    {
  543|      0|      if (!_gpgrt_fd_valid_p (fd))
  ------------------
  |  Branch (543:11): [True: 0, False: 0]
  ------------------
  544|      0|        _gpgrt_log_fatal ("gpgrt_log_set_sink: fd is invalid: %s\n",
  545|      0|                     strerror (errno));
  546|      0|      set_file_fd (NULL, fd, NULL);
  547|      0|    }
  548|      1|  else if (!name && stream && fd == -1)
  ------------------
  |  Branch (548:12): [True: 1, False: 0]
  |  Branch (548:21): [True: 0, False: 1]
  |  Branch (548:31): [True: 0, False: 0]
  ------------------
  549|      0|    {
  550|      0|      set_file_fd (NULL, -1, stream);
  551|      0|    }
  552|      1|  else /* default */
  553|      1|    set_file_fd ("-", -1, NULL);
  554|      2|}
_gpgrt_log_get_stream:
  643|  83.2k|{
  644|  83.2k|  if (!logstream)
  ------------------
  |  Branch (644:7): [True: 0, False: 83.2k]
  ------------------
  645|      0|    {
  646|       |      /* Make sure a log stream has been set.  */
  647|      0|      _gpgrt_log_set_sink (NULL, NULL, -1);
  648|      0|      if (!logstream)
  ------------------
  |  Branch (648:11): [True: 0, False: 0]
  ------------------
  649|      0|        {
  650|      0|          fputs ("gpgrt fatal: failed to init log stream\n", stderr);
  651|      0|          _gpgrt_abort ();
  652|      0|        }
  653|      0|    }
  654|  83.2k|  return logstream;
  655|  83.2k|}
_gpgrt_logv_internal:
  844|  4.43M|{
  845|  4.43M|  int leading_backspace = (fmt && *fmt == '\b');
  ------------------
  |  Branch (845:28): [True: 4.43M, False: 1.32k]
  |  Branch (845:35): [True: 0, False: 4.43M]
  ------------------
  846|  4.43M|  int length;
  847|  4.43M|  int rc;
  848|       |
  849|  4.43M|  if (!logstream)
  ------------------
  |  Branch (849:7): [True: 1, False: 4.43M]
  ------------------
  850|      1|    {
  851|       |#ifdef HAVE_W32_SYSTEM
  852|       |      char *tmp;
  853|       |
  854|       |      tmp = (no_registry
  855|       |             ? NULL
  856|       |             : _gpgrt_w32_reg_query_string (NULL, "Software\\\\GNU\\\\GnuPG",
  857|       |                                            "DefaultLogFile"));
  858|       |      _gpgrt_log_set_sink (tmp && *tmp? tmp : NULL, NULL, -1);
  859|       |      _gpgrt_free (tmp);
  860|       |#else
  861|       |      /* Make sure a log stream has been set.  */
  862|      1|      _gpgrt_log_set_sink (NULL, NULL, -1);
  863|      1|#endif
  864|      1|      if (!logstream)
  ------------------
  |  Branch (864:11): [True: 0, False: 1]
  ------------------
  865|      0|        {
  866|      0|          fputs ("gpgrt fatal: failed to init log stream\n", stderr);
  867|      0|          _gpgrt_abort ();
  868|      0|        }
  869|      1|    }
  870|       |
  871|  4.43M|  _gpgrt_flockfile (logstream);
  872|  4.43M|  if (missing_lf && level != GPGRT_LOGLVL_CONT)
  ------------------
  |  Branch (872:7): [True: 84.5k, False: 4.34M]
  |  Branch (872:21): [True: 0, False: 84.5k]
  ------------------
  873|      0|    _gpgrt_putc_unlocked ('\n', logstream );
  ------------------
  |  |  402|      0|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  403|      0|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 0, False: 0]
  |  |  ------------------
  |  |  404|      0|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|      0|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|      0|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
  874|  4.43M|  missing_lf = 0;
  875|       |
  876|  4.43M|  length = print_prefix (level, leading_backspace);
  877|  4.43M|  if (leading_backspace)
  ------------------
  |  Branch (877:7): [True: 0, False: 4.43M]
  ------------------
  878|      0|    fmt++;
  879|       |
  880|  4.43M|  if (fmt)
  ------------------
  |  Branch (880:7): [True: 4.43M, False: 1.32k]
  ------------------
  881|  4.43M|    {
  882|  4.43M|      if (prefmt)
  ------------------
  |  Branch (882:11): [True: 0, False: 4.43M]
  ------------------
  883|      0|        {
  884|      0|          _gpgrt_fputs_unlocked (prefmt, logstream);
  885|      0|          length += strlen (prefmt);
  886|      0|        }
  887|       |
  888|  4.43M|      if (ignore_arg_ptr)
  ------------------
  |  Branch (888:11): [True: 0, False: 4.43M]
  ------------------
  889|      0|        { /* This is used by log_string and comes with the extra
  890|       |           * feature that after a LF the next line is indent at the
  891|       |           * length of the prefix.  Note that we do not yet include
  892|       |           * the length of the timestamp and pid in the indent
  893|       |           * computation.  */
  894|      0|          const char *p, *pend;
  895|       |
  896|      0|          for (p = fmt; (pend = strchr (p, '\n')); p = pend+1)
  ------------------
  |  Branch (896:25): [True: 0, False: 0]
  ------------------
  897|      0|            {
  898|      0|              rc = _gpgrt_fprintf_unlocked (logstream, "%*s%.*s",
  899|      0|                                 (int)((p != fmt
  ------------------
  |  Branch (899:41): [True: 0, False: 0]
  ------------------
  900|      0|                                        && (with_prefix || force_prefixes))
  ------------------
  |  Branch (900:45): [True: 0, False: 0]
  |  Branch (900:60): [True: 0, False: 0]
  ------------------
  901|      0|                                       ?strlen (prefix_buffer)+2:0), "",
  902|      0|                                 (int)(pend - p)+1, p);
  903|      0|              if (rc > 0)
  ------------------
  |  Branch (903:19): [True: 0, False: 0]
  ------------------
  904|      0|                length += rc;
  905|      0|            }
  906|      0|          _gpgrt_fputs_unlocked (p, logstream);
  907|      0|          length += strlen (p);
  908|      0|        }
  909|  4.43M|      else
  910|  4.43M|        {
  911|  4.43M|          struct fmt_string_filter_s sf = {NULL};
  912|       |
  913|  4.43M|          rc = _gpgrt_vfprintf_unlocked (logstream, fmt_string_filter, &sf,
  914|  4.43M|                                         fmt, arg_ptr);
  915|  4.43M|          if (rc > 0)
  ------------------
  |  Branch (915:15): [True: 4.43M, False: 0]
  ------------------
  916|  4.43M|            length += rc;
  917|  4.43M|        }
  918|       |
  919|  4.43M|      if (*fmt && fmt[strlen(fmt)-1] != '\n')
  ------------------
  |  Branch (919:11): [True: 4.43M, False: 0]
  |  Branch (919:19): [True: 84.5k, False: 4.34M]
  ------------------
  920|  84.5k|        missing_lf = 1;
  921|  4.43M|    }
  922|       |
  923|       |  /* If we have an EXTRASTRING print it now while we still hold the
  924|       |   * lock on the logstream.  */
  925|  4.43M|  if (extrastring)
  ------------------
  |  Branch (925:7): [True: 0, False: 4.43M]
  ------------------
  926|      0|    {
  927|      0|      int c;
  928|       |
  929|      0|      if (missing_lf)
  ------------------
  |  Branch (929:11): [True: 0, False: 0]
  ------------------
  930|      0|        {
  931|      0|          _gpgrt_putc_unlocked ('\n', logstream);
  ------------------
  |  |  402|      0|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  403|      0|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 0, False: 0]
  |  |  ------------------
  |  |  404|      0|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|      0|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|      0|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
  932|      0|          missing_lf = 0;
  933|      0|          length = 0;
  934|      0|        }
  935|      0|      length += print_prefix (level, leading_backspace);
  936|      0|      _gpgrt_fputs_unlocked (">> ", logstream);
  937|      0|      length += 3;
  938|      0|      missing_lf = 1;
  939|      0|      while ((c = *extrastring++))
  ------------------
  |  Branch (939:14): [True: 0, False: 0]
  ------------------
  940|      0|        {
  941|      0|          missing_lf = 1;
  942|      0|          if (c == '\\')
  ------------------
  |  Branch (942:15): [True: 0, False: 0]
  ------------------
  943|      0|            {
  944|      0|              _gpgrt_fputs_unlocked ("\\\\", logstream);
  945|      0|              length += 2;
  946|      0|            }
  947|      0|          else if (c == '\r')
  ------------------
  |  Branch (947:20): [True: 0, False: 0]
  ------------------
  948|      0|            {
  949|      0|              _gpgrt_fputs_unlocked ("\\r", logstream);
  950|      0|              length += 2;
  951|      0|            }
  952|      0|          else if (c == '\n')
  ------------------
  |  Branch (952:20): [True: 0, False: 0]
  ------------------
  953|      0|            {
  954|      0|              _gpgrt_fputs_unlocked ("\\n\n", logstream);
  955|      0|              length = 0;
  956|      0|              if (*extrastring)
  ------------------
  |  Branch (956:19): [True: 0, False: 0]
  ------------------
  957|      0|                {
  958|      0|                  length += print_prefix (level, leading_backspace);
  959|      0|                  _gpgrt_fputs_unlocked (">> ", logstream);
  960|      0|                  length += 3;
  961|      0|                }
  962|      0|              else
  963|      0|                missing_lf = 0;
  964|      0|            }
  965|      0|          else
  966|      0|            {
  967|      0|              _gpgrt_putc_unlocked (c, logstream);
  ------------------
  |  |  402|      0|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  403|      0|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 0, False: 0]
  |  |  ------------------
  |  |  404|      0|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [True: 0, False: 0]
  |  |  ------------------
  |  |  405|      0|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|      0|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
  968|      0|              length++;
  969|      0|            }
  970|      0|        }
  971|      0|      if (missing_lf)
  ------------------
  |  Branch (971:11): [True: 0, False: 0]
  ------------------
  972|      0|        {
  973|      0|          _gpgrt_putc_unlocked ('\n', logstream);
  ------------------
  |  |  402|      0|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  403|      0|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 0, False: 0]
  |  |  ------------------
  |  |  404|      0|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|      0|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|      0|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
  974|      0|          length = 0;
  975|      0|          missing_lf = 0;
  976|      0|        }
  977|      0|    }
  978|       |
  979|  4.43M|  if (level == GPGRT_LOGLVL_FATAL)
  ------------------
  |  Branch (979:7): [True: 0, False: 4.43M]
  ------------------
  980|      0|    {
  981|      0|      if (missing_lf)
  ------------------
  |  Branch (981:11): [True: 0, False: 0]
  ------------------
  982|      0|        _gpgrt_putc_unlocked ('\n', logstream);
  ------------------
  |  |  402|      0|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  403|      0|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 0, False: 0]
  |  |  ------------------
  |  |  404|      0|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|      0|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|      0|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
  983|      0|      _gpgrt_funlockfile (logstream);
  984|      0|      exit (2);
  985|      0|    }
  986|  4.43M|  else if (level == GPGRT_LOGLVL_BUG)
  ------------------
  |  Branch (986:12): [True: 0, False: 4.43M]
  ------------------
  987|      0|    {
  988|      0|      if (missing_lf)
  ------------------
  |  Branch (988:11): [True: 0, False: 0]
  ------------------
  989|      0|        _gpgrt_putc_unlocked ('\n', logstream );
  ------------------
  |  |  402|      0|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  403|      0|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 0, False: 0]
  |  |  ------------------
  |  |  404|      0|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|      0|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|      0|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
  990|      0|      _gpgrt_funlockfile (logstream);
  991|       |      /* Using backtrace requires a configure test and to pass
  992|       |       * -rdynamic to gcc.  Thus we do not enable it now.  */
  993|       |      /* { */
  994|       |      /*   void *btbuf[20]; */
  995|       |      /*   int btidx, btlen; */
  996|       |      /*   char **btstr; */
  997|       |
  998|       |      /*   btlen = backtrace (btbuf, DIM (btbuf)); */
  999|       |      /*   btstr = backtrace_symbols (btbuf, btlen); */
 1000|       |      /*   if (btstr) */
 1001|       |      /*     for (btidx=0; btidx < btlen; btidx++) */
 1002|       |      /*       log_debug ("[%d] %s\n", btidx, btstr[btidx]); */
 1003|       |      /* } */
 1004|      0|      _gpgrt_abort ();
 1005|      0|    }
 1006|  4.43M|  else
 1007|  4.43M|    _gpgrt_funlockfile (logstream);
 1008|       |
 1009|       |  /* Bumb the error counter for log_error.  */
 1010|  4.43M|  if (level == GPGRT_LOGLVL_ERROR)
  ------------------
  |  Branch (1010:7): [True: 4.09M, False: 334k]
  ------------------
 1011|  4.09M|    _gpgrt_inc_errorcount ();
 1012|       |
 1013|  4.43M|  return length;
 1014|  4.43M|}
_gpgrt_logv:
 1030|  4.43M|{
 1031|  4.43M|  _gpgrt_logv_internal (level, 0, NULL, NULL, fmt, arg_ptr);
 1032|  4.43M|}
_gpgrt_log_flush:
 1155|  1.32k|{
 1156|  1.32k|  do_log_ignore_arg (GPGRT_LOGLVL_CONT, NULL);
 1157|  1.32k|}
logging.c:set_file_fd:
  450|      2|{
  451|      2|  estream_t fp;
  452|      2|  int want_socket = 0;
  453|      2|  struct fun_cookie_s *cookie;
  454|       |
  455|       |  /* Close an open log stream.  */
  456|      2|  if (logstream)
  ------------------
  |  Branch (456:7): [True: 1, False: 1]
  ------------------
  457|      1|    {
  458|      1|      if (logstream != es_stderr)
  ------------------
  |  |  363|      1|#define es_stderr _gpgrt__get_std_stream (2)
  ------------------
  |  Branch (458:11): [True: 0, False: 1]
  ------------------
  459|      0|        _gpgrt_fclose (logstream);
  460|      1|      logstream = NULL;
  461|      1|    }
  462|       |
  463|      2|  if (stream)
  ------------------
  |  Branch (463:7): [True: 0, False: 2]
  ------------------
  464|      0|    {
  465|       |      /* We don't use a cookie to log directly to a stream.  */
  466|      0|      fp = stream;
  467|      0|      goto leave;
  468|      0|    }
  469|       |
  470|       |  /* Figure out what kind of logging we want.  */
  471|      2|  if (name && !strcmp (name, "-"))
  ------------------
  |  Branch (471:7): [True: 2, False: 0]
  |  Branch (471:15): [True: 1, False: 1]
  ------------------
  472|      1|    {
  473|      1|      fp = es_stderr;
  ------------------
  |  |  363|      1|#define es_stderr _gpgrt__get_std_stream (2)
  ------------------
  474|      1|      goto leave;
  475|      1|    }
  476|      1|  else if (name && !strncmp (name, "tcp://", 6) && name[6])
  ------------------
  |  Branch (476:12): [True: 1, False: 0]
  |  Branch (476:20): [True: 0, False: 1]
  |  Branch (476:52): [True: 0, False: 0]
  ------------------
  477|      0|    want_socket = 1;
  478|      1|#ifndef HAVE_W32_SYSTEM
  479|      1|  else if (name && !strncmp (name, "socket://", 9))
  ------------------
  |  Branch (479:12): [True: 1, False: 0]
  |  Branch (479:20): [True: 0, False: 1]
  ------------------
  480|      0|    want_socket = 2;
  481|      1|#endif /*HAVE_W32_SYSTEM*/
  482|       |
  483|       |  /* Setup a new stream.  */
  484|       |
  485|      1|  if (!name)
  ------------------
  |  Branch (485:7): [True: 0, False: 1]
  ------------------
  486|      0|    fp = _gpgrt_fdopen (fd, "w");
  487|      1|  else if (!want_socket)
  ------------------
  |  Branch (487:12): [True: 1, False: 0]
  ------------------
  488|      1|    fp = _gpgrt_fopen (name, "a");
  489|      0|  else
  490|      0|    {
  491|      0|      es_cookie_io_functions_t io = { NULL };
  492|       |
  493|      0|      cookie = _gpgrt_malloc (sizeof *cookie + (name? strlen (name):0));
  ------------------
  |  Branch (493:49): [True: 0, False: 0]
  ------------------
  494|      0|      if (!cookie)
  ------------------
  |  Branch (494:11): [True: 0, False: 0]
  ------------------
  495|      0|        return; /* oops */
  496|      0|      strcpy (cookie->name, name? name:"");
  ------------------
  |  Branch (496:29): [True: 0, False: 0]
  ------------------
  497|      0|      cookie->quiet = 0;
  498|      0|      cookie->is_socket = 0;
  499|      0|      cookie->want_socket = want_socket;
  500|      0|      cookie->fd = -1;
  501|      0|      log_socket = cookie->fd;
  502|       |
  503|      0|      io.func_write = fun_writer;
  504|      0|      io.func_close = fun_closer;
  505|       |
  506|      0|      fp = _gpgrt_fopencookie (cookie, "w", io);
  507|      0|    }
  508|       |
  509|       |  /* On error default to a stderr based estream.  */
  510|      1|  if (!fp)
  ------------------
  |  Branch (510:7): [True: 0, False: 1]
  ------------------
  511|      0|    fp = es_stderr;
  ------------------
  |  |  363|      0|#define es_stderr _gpgrt__get_std_stream (2)
  ------------------
  512|       |
  513|      2| leave:
  514|      2|  _gpgrt_setvbuf (fp, NULL, _IOLBF, 0);
  515|       |
  516|      2|  logstream = fp;
  517|       |
  518|       |  /* We always need to print the prefix and the pid for socket mode,
  519|       |     so that the server reading the socket can do something
  520|       |     meaningful. */
  521|      2|  force_prefixes = want_socket;
  522|       |
  523|      2|  missing_lf = 0;
  524|      2|}
logging.c:print_prefix:
  752|  4.43M|{
  753|  4.43M|  int rc;
  754|  4.43M|  int length = 0;
  755|       |
  756|  4.43M|  if (level != GPGRT_LOGLVL_CONT)
  ------------------
  |  Branch (756:7): [True: 4.34M, False: 85.9k]
  ------------------
  757|  4.34M|    { /* Note this does not work for multiple line logging as we would
  758|       |       * need to print to a buffer first */
  759|  4.34M|      if (with_time && !force_prefixes)
  ------------------
  |  Branch (759:11): [True: 0, False: 4.34M]
  |  Branch (759:24): [True: 0, False: 0]
  ------------------
  760|      0|        {
  761|      0|          struct tm *tp;
  762|      0|          time_t atime = time (NULL);
  763|       |
  764|      0|          tp = localtime (&atime);
  765|      0|          rc = _gpgrt_fprintf_unlocked (logstream,
  766|      0|                                        "%04d-%02d-%02d %02d:%02d:%02d ",
  767|      0|                               1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday,
  768|      0|                               tp->tm_hour, tp->tm_min, tp->tm_sec );
  769|      0|          if (rc > 0)
  ------------------
  |  Branch (769:15): [True: 0, False: 0]
  ------------------
  770|      0|            length += rc;
  771|      0|        }
  772|  4.34M|      if (with_prefix || force_prefixes)
  ------------------
  |  Branch (772:11): [True: 0, False: 4.34M]
  |  Branch (772:26): [True: 0, False: 4.34M]
  ------------------
  773|      0|        {
  774|      0|          _gpgrt_fputs_unlocked (prefix_buffer, logstream);
  775|      0|          length += strlen (prefix_buffer);
  776|      0|        }
  777|  4.34M|      if (with_pid || force_prefixes)
  ------------------
  |  Branch (777:11): [True: 0, False: 4.34M]
  |  Branch (777:23): [True: 0, False: 4.34M]
  ------------------
  778|      0|        {
  779|      0|          unsigned long pidsuf;
  780|      0|          int pidfmt;
  781|       |
  782|      0|          if (get_pid_suffix_cb && (pidfmt=get_pid_suffix_cb (&pidsuf)))
  ------------------
  |  Branch (782:15): [True: 0, False: 0]
  |  Branch (782:36): [True: 0, False: 0]
  ------------------
  783|      0|            rc = _gpgrt_fprintf_unlocked (logstream,
  784|      0|                                          pidfmt == 1? "[%u.%lu]":"[%u.%lx]",
  ------------------
  |  Branch (784:43): [True: 0, False: 0]
  ------------------
  785|      0|                                          (unsigned int)getpid (), pidsuf);
  786|      0|          else
  787|      0|            rc = _gpgrt_fprintf_unlocked (logstream, "[%u]",
  788|      0|                                          (unsigned int)getpid ());
  789|      0|          if (rc > 0)
  ------------------
  |  Branch (789:15): [True: 0, False: 0]
  ------------------
  790|      0|            length += rc;
  791|      0|        }
  792|  4.34M|      if ((!with_time && (with_prefix || with_pid)) || force_prefixes)
  ------------------
  |  Branch (792:12): [True: 4.34M, False: 0]
  |  Branch (792:27): [True: 0, False: 4.34M]
  |  Branch (792:42): [True: 0, False: 4.34M]
  |  Branch (792:56): [True: 0, False: 4.34M]
  ------------------
  793|      0|        {
  794|      0|          _gpgrt_putc_unlocked (':', logstream);
  ------------------
  |  |  402|      0|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  403|      0|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 0, False: 0]
  |  |  ------------------
  |  |  404|      0|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|      0|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|      0|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
  795|      0|          length++;
  796|      0|        }
  797|       |      /* A leading backspace suppresses the extra space so that we can
  798|       |         correctly output, programname, filename and linenumber. */
  799|  4.34M|      if (!leading_backspace
  ------------------
  |  Branch (799:11): [True: 4.34M, False: 0]
  ------------------
  800|  4.34M|          && (with_time || with_prefix || with_pid || force_prefixes))
  ------------------
  |  Branch (800:15): [True: 0, False: 4.34M]
  |  Branch (800:28): [True: 0, False: 4.34M]
  |  Branch (800:43): [True: 0, False: 4.34M]
  |  Branch (800:55): [True: 0, False: 4.34M]
  ------------------
  801|      0|        {
  802|      0|          _gpgrt_putc_unlocked (' ', logstream);
  ------------------
  |  |  402|      0|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  403|      0|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 0, False: 0]
  |  |  ------------------
  |  |  404|      0|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|      0|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|      0|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
  803|      0|          length++;
  804|      0|        }
  805|  4.34M|    }
  806|       |
  807|  4.43M|  switch (level)
  808|  4.43M|    {
  809|      0|    case GPGRT_LOGLVL_BEGIN: break;
  ------------------
  |  Branch (809:5): [True: 0, False: 4.43M]
  ------------------
  810|  85.9k|    case GPGRT_LOGLVL_CONT: break;
  ------------------
  |  Branch (810:5): [True: 85.9k, False: 4.34M]
  ------------------
  811|   247k|    case GPGRT_LOGLVL_INFO: break;
  ------------------
  |  Branch (811:5): [True: 247k, False: 4.18M]
  ------------------
  812|      0|    case GPGRT_LOGLVL_WARN: break;
  ------------------
  |  Branch (812:5): [True: 0, False: 4.43M]
  ------------------
  813|  4.09M|    case GPGRT_LOGLVL_ERROR: break;
  ------------------
  |  Branch (813:5): [True: 4.09M, False: 334k]
  ------------------
  814|      0|    case GPGRT_LOGLVL_FATAL:
  ------------------
  |  Branch (814:5): [True: 0, False: 4.43M]
  ------------------
  815|      0|      _gpgrt_fputs_unlocked ("Fatal: ", logstream);
  816|      0|      length += 7;
  817|      0|      break;
  818|      0|    case GPGRT_LOGLVL_BUG:
  ------------------
  |  Branch (818:5): [True: 0, False: 4.43M]
  ------------------
  819|      0|      _gpgrt_fputs_unlocked ("Ohhhh jeeee: ", logstream);
  820|      0|      length += 13;
  821|      0|      break;
  822|  1.32k|    case GPGRT_LOGLVL_DEBUG:
  ------------------
  |  Branch (822:5): [True: 1.32k, False: 4.43M]
  ------------------
  823|  1.32k|      _gpgrt_fputs_unlocked ("DBG: ", logstream);
  824|  1.32k|      length += 5;
  825|  1.32k|      break;
  826|      0|    default:
  ------------------
  |  Branch (826:5): [True: 0, False: 4.43M]
  ------------------
  827|      0|      rc = _gpgrt_fprintf_unlocked (logstream,
  828|      0|                                    "[Unknown log level %d]: ", level);
  829|      0|      if (rc > 0)
  ------------------
  |  Branch (829:11): [True: 0, False: 0]
  ------------------
  830|      0|        length += rc;
  831|      0|      break;
  832|  4.43M|    }
  833|       |
  834|  4.43M|  return length;
  835|  4.43M|}
logging.c:fmt_string_filter:
  662|  1.25M|{
  663|  1.25M|  struct fmt_string_filter_s *state = opaque;
  664|  1.25M|  const unsigned char *p;
  665|  1.25M|  size_t buflen;
  666|  1.25M|  char *d;
  667|  1.25M|  int any;
  668|       |
  669|  1.25M|  if (no == -1)
  ------------------
  |  Branch (669:7): [True: 625k, False: 625k]
  ------------------
  670|   625k|    {
  671|       |      /* The printf engine asked us to release resources.  */
  672|   625k|      if (state->last_result)
  ------------------
  |  Branch (672:11): [True: 3.69k, False: 622k]
  ------------------
  673|  3.69k|        {
  674|  3.69k|          _gpgrt_free (state->last_result);
  675|  3.69k|          state->last_result = NULL;
  676|  3.69k|        }
  677|   625k|      return NULL;
  678|   625k|    }
  679|       |
  680|   625k|  if (!string)
  ------------------
  |  Branch (680:7): [True: 0, False: 625k]
  ------------------
  681|      0|    return NULL; /* Nothing to filter - printf handles NULL nicely.  */
  682|       |
  683|       |  /* Check whether escaping is needed and count needed length. */
  684|   625k|  any = 0;
  685|   625k|  buflen = 1;
  686|  9.10M|  for (p = (const unsigned char *)string; *p; p++)
  ------------------
  |  Branch (686:43): [True: 8.47M, False: 625k]
  ------------------
  687|  8.47M|    {
  688|  8.47M|      switch (*p)
  689|  8.47M|        {
  690|      0|        case '\n':
  ------------------
  |  Branch (690:9): [True: 0, False: 8.47M]
  ------------------
  691|      0|        case '\r':
  ------------------
  |  Branch (691:9): [True: 0, False: 8.47M]
  ------------------
  692|      0|        case '\f':
  ------------------
  |  Branch (692:9): [True: 0, False: 8.47M]
  ------------------
  693|      0|        case '\v':
  ------------------
  |  Branch (693:9): [True: 0, False: 8.47M]
  ------------------
  694|      0|        case '\b':
  ------------------
  |  Branch (694:9): [True: 0, False: 8.47M]
  ------------------
  695|      0|        case '\t':
  ------------------
  |  Branch (695:9): [True: 0, False: 8.47M]
  ------------------
  696|      0|        case '\a':
  ------------------
  |  Branch (696:9): [True: 0, False: 8.47M]
  ------------------
  697|   113k|        case '\\':
  ------------------
  |  Branch (697:9): [True: 113k, False: 8.36M]
  ------------------
  698|   113k|          buflen += 2;
  699|   113k|          any = 1;
  700|   113k|          break;
  701|  8.36M|        default:
  ------------------
  |  Branch (701:9): [True: 8.36M, False: 113k]
  ------------------
  702|  8.36M|          if (*p < 0x20 || *p == 0x7f)
  ------------------
  |  Branch (702:15): [True: 0, False: 8.36M]
  |  Branch (702:28): [True: 0, False: 8.36M]
  ------------------
  703|      0|            {
  704|      0|              buflen += 5;
  705|      0|              any = 1;
  706|      0|            }
  707|  8.36M|          else
  708|  8.36M|            buflen++;
  709|  8.47M|        }
  710|  8.47M|    }
  711|   625k|  if (!any)
  ------------------
  |  Branch (711:7): [True: 622k, False: 3.69k]
  ------------------
  712|   622k|    return (char*)string;  /* Nothing to escape.  */
  713|       |
  714|       |  /* Create a buffer and escape the input.  */
  715|  3.69k|  _gpgrt_free (state->last_result);
  716|  3.69k|  state->last_result = _gpgrt_malloc (buflen);
  717|  3.69k|  if (!state->last_result)
  ------------------
  |  Branch (717:7): [True: 0, False: 3.69k]
  ------------------
  718|      0|    return "[out_of_core_in_format_string_filter]";
  719|       |
  720|  3.69k|  d = state->last_result;
  721|   494k|  for (p = (const unsigned char *)string; *p; p++)
  ------------------
  |  Branch (721:43): [True: 490k, False: 3.69k]
  ------------------
  722|   490k|    {
  723|   490k|      switch (*p)
  724|   490k|        {
  725|      0|        case '\n': *d++ = '\\'; *d++ = 'n'; break;
  ------------------
  |  Branch (725:9): [True: 0, False: 490k]
  ------------------
  726|      0|        case '\r': *d++ = '\\'; *d++ = 'r'; break;
  ------------------
  |  Branch (726:9): [True: 0, False: 490k]
  ------------------
  727|      0|        case '\f': *d++ = '\\'; *d++ = 'f'; break;
  ------------------
  |  Branch (727:9): [True: 0, False: 490k]
  ------------------
  728|      0|        case '\v': *d++ = '\\'; *d++ = 'v'; break;
  ------------------
  |  Branch (728:9): [True: 0, False: 490k]
  ------------------
  729|      0|        case '\b': *d++ = '\\'; *d++ = 'b'; break;
  ------------------
  |  Branch (729:9): [True: 0, False: 490k]
  ------------------
  730|      0|        case '\t': *d++ = '\\'; *d++ = 't'; break;
  ------------------
  |  Branch (730:9): [True: 0, False: 490k]
  ------------------
  731|      0|        case '\a': *d++ = '\\'; *d++ = 'a'; break;
  ------------------
  |  Branch (731:9): [True: 0, False: 490k]
  ------------------
  732|   113k|        case '\\': *d++ = '\\'; *d++ = '\\'; break;
  ------------------
  |  Branch (732:9): [True: 113k, False: 376k]
  ------------------
  733|       |
  734|   376k|        default:
  ------------------
  |  Branch (734:9): [True: 376k, False: 113k]
  ------------------
  735|   376k|          if (*p < 0x20 || *p == 0x7f)
  ------------------
  |  Branch (735:15): [True: 0, False: 376k]
  |  Branch (735:28): [True: 0, False: 376k]
  ------------------
  736|      0|            {
  737|      0|              snprintf (d, 5, "\\x%02x", *p);
  ------------------
  |  |  483|      0|#define snprintf _gpgrt_estream_snprintf
  ------------------
  738|      0|              d += 4;
  739|      0|            }
  740|   376k|          else
  741|   376k|            *d++ = *p;
  742|   490k|        }
  743|   490k|    }
  744|  3.69k|  *d = 0;
  745|  3.69k|  return state->last_result;
  746|  3.69k|}
logging.c:do_log_ignore_arg:
 1048|  1.32k|{
 1049|  1.32k|  va_list arg_ptr;
 1050|  1.32k|  va_start (arg_ptr, str);
 1051|  1.32k|  _gpgrt_logv_internal (level, 1, NULL, NULL, str, arg_ptr);
 1052|  1.32k|  va_end (arg_ptr);
 1053|  1.32k|}

_gpgrt_lock_init:
  165|  3.54k|{
  166|  3.54k|  _gpgrt_lock_t *lock = (_gpgrt_lock_t*)lockhd;
  167|  3.54k|  int rc;
  168|       |
  169|       |  /* If VERS is zero we assume that no static initialization has been
  170|       |     done, so we setup our ABI version right here.  The caller might
  171|       |     have called us to test whether lock support is at all available. */
  172|  3.54k|  if (!lock->vers)
  ------------------
  |  Branch (172:7): [True: 3.54k, False: 0]
  ------------------
  173|  3.54k|    {
  174|  3.54k|      if (sizeof (gpgrt_lock_t) < sizeof (_gpgrt_lock_t))
  ------------------
  |  Branch (174:11): [Folded - Ignored]
  ------------------
  175|      0|        {
  176|      0|          fputs ("gpgrt fatal: sizeof lock obj\n", stderr);
  177|      0|          _gpgrt_abort ();
  178|      0|        }
  179|  3.54k|      lock->vers = LOCK_ABI_VERSION;
  ------------------
  |  |   25|  3.54k|# define LOCK_ABI_VERSION 1
  ------------------
  180|  3.54k|    }
  181|      0|  else /* Run the usual check.  */
  182|      0|    lock = get_lock_object (lockhd);
  183|       |
  184|  3.54k|#if USE_POSIX_THREADS
  185|  3.54k|  if (use_pthread_p())
  ------------------
  |  |   62|  3.54k|#   define use_pthread_p() (!!pthread_cancel)
  |  |  ------------------
  |  |  |  Branch (62:28): [True: 3.54k, False: 0]
  |  |  ------------------
  ------------------
  186|  3.54k|    {
  187|  3.54k|      rc = pthread_mutex_init (&lock->u.mtx, NULL);
  188|  3.54k|      if (rc)
  ------------------
  |  Branch (188:11): [True: 0, False: 3.54k]
  ------------------
  189|      0|        rc = _gpg_err_code_from_errno (rc);
  190|  3.54k|    }
  191|      0|  else
  192|      0|    rc = 0; /* Threads are not used.  */
  193|       |#else /* Unknown thread system.  */
  194|       |  rc = lock->vers == LOCK_ABI_NOT_AVAILABLE? 0 : GPG_ERR_NOT_IMPLEMENTED;
  195|       |#endif /* Unknown thread system.  */
  196|       |
  197|  3.54k|  return rc;
  198|  3.54k|}
_gpgrt_lock_lock:
  203|  4.83M|{
  204|  4.83M|  _gpgrt_lock_t *lock = get_lock_object (lockhd);
  205|  4.83M|  int rc;
  206|       |
  207|  4.83M|#if USE_POSIX_THREADS
  208|  4.83M|  if (use_pthread_p())
  ------------------
  |  |   62|  4.83M|#   define use_pthread_p() (!!pthread_cancel)
  |  |  ------------------
  |  |  |  Branch (62:28): [True: 4.83M, False: 0]
  |  |  ------------------
  ------------------
  209|  4.83M|    {
  210|  4.83M|      _gpgrt_pre_syscall ();
  211|  4.83M|      rc = pthread_mutex_lock (&lock->u.mtx);
  212|  4.83M|      if (rc)
  ------------------
  |  Branch (212:11): [True: 0, False: 4.83M]
  ------------------
  213|      0|        rc = _gpg_err_code_from_errno (rc);
  214|  4.83M|      _gpgrt_post_syscall ();
  215|  4.83M|    }
  216|      0|  else
  217|      0|    rc = 0; /* Threads are not used.  */
  218|       |#else /* Unknown thread system.  */
  219|       |  rc = lock->vers == LOCK_ABI_NOT_AVAILABLE? 0 : GPG_ERR_NOT_IMPLEMENTED;
  220|       |#endif /* Unknown thread system.  */
  221|       |
  222|  4.83M|  return rc;
  223|  4.83M|}
_gpgrt_lock_unlock:
  251|  4.83M|{
  252|  4.83M|  _gpgrt_lock_t *lock = get_lock_object (lockhd);
  253|  4.83M|  int rc;
  254|       |
  255|  4.83M|#if USE_POSIX_THREADS
  256|  4.83M|  if (use_pthread_p())
  ------------------
  |  |   62|  4.83M|#   define use_pthread_p() (!!pthread_cancel)
  |  |  ------------------
  |  |  |  Branch (62:28): [True: 4.83M, False: 0]
  |  |  ------------------
  ------------------
  257|  4.83M|    {
  258|  4.83M|      rc = pthread_mutex_unlock (&lock->u.mtx);
  259|  4.83M|      if (rc)
  ------------------
  |  Branch (259:11): [True: 0, False: 4.83M]
  ------------------
  260|      0|        rc = _gpg_err_code_from_errno (rc);
  261|  4.83M|    }
  262|      0|  else
  263|      0|    rc = 0; /* Threads are not used.  */
  264|       |#else /* Unknown thread system.  */
  265|       |  rc = lock->vers == LOCK_ABI_NOT_AVAILABLE? 0 : GPG_ERR_NOT_IMPLEMENTED;
  266|       |#endif /* Unknown thread system.  */
  267|       |
  268|  4.83M|  return rc;
  269|  4.83M|}
_gpgrt_lock_destroy:
  276|  3.54k|{
  277|  3.54k|  _gpgrt_lock_t *lock = get_lock_object (lockhd);
  278|  3.54k|  int rc;
  279|       |
  280|  3.54k|#if USE_POSIX_THREADS
  281|  3.54k|  if (use_pthread_p())
  ------------------
  |  |   62|  3.54k|#   define use_pthread_p() (!!pthread_cancel)
  |  |  ------------------
  |  |  |  Branch (62:28): [True: 3.54k, False: 0]
  |  |  ------------------
  ------------------
  282|  3.54k|    {
  283|  3.54k|      rc = pthread_mutex_destroy (&lock->u.mtx);
  284|  3.54k|      if (rc)
  ------------------
  |  Branch (284:11): [True: 0, False: 3.54k]
  ------------------
  285|      0|        rc = _gpg_err_code_from_errno (rc);
  286|  3.54k|      else
  287|  3.54k|        {
  288|       |          /* Re-init the mutex so that it can be re-used.  */
  289|  3.54k|          gpgrt_lock_t tmp = GPGRT_LOCK_INITIALIZER;
  ------------------
  |  | 1126|  3.54k|#define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \
  |  | 1127|  3.54k|                                    0,0,0,0,0,0,0,0, \
  |  | 1128|  3.54k|                                    0,0,0,0,0,0,0,0, \
  |  | 1129|  3.54k|                                    0,0,0,0,0,0,0,0, \
  |  | 1130|  3.54k|                                    0,0,0,0,0,0,0,0}}}
  ------------------
  290|  3.54k|          memcpy (lockhd, &tmp, sizeof tmp);
  291|  3.54k|        }
  292|  3.54k|    }
  293|      0|  else
  294|      0|    rc = 0; /* Threads are not used.  */
  295|       |#else /* Unknown thread system.  */
  296|       |  rc = lock->vers == LOCK_ABI_NOT_AVAILABLE? 0 : GPG_ERR_NOT_IMPLEMENTED;
  297|       |#endif /* Unknown thread system.  */
  298|       |
  299|  3.54k|  return rc;
  300|  3.54k|}
posix-lock.c:get_lock_object:
  145|  9.67M|{
  146|  9.67M|  _gpgrt_lock_t *lock = (_gpgrt_lock_t*)lockhd;
  147|       |
  148|  9.67M|  if (lock->vers != LOCK_ABI_VERSION)
  ------------------
  |  |   25|  9.67M|# define LOCK_ABI_VERSION 1
  ------------------
  |  Branch (148:7): [True: 0, False: 9.67M]
  ------------------
  149|      0|    {
  150|      0|      fputs ("gpgrt fatal: lock ABI version mismatch\n", stderr);
  151|      0|      _gpgrt_abort ();
  152|      0|    }
  153|  9.67M|  if (sizeof (gpgrt_lock_t) < sizeof (_gpgrt_lock_t))
  ------------------
  |  Branch (153:7): [Folded - Ignored]
  ------------------
  154|      0|    {
  155|      0|      fputs ("gpgrt fatal: sizeof lock obj\n", stderr);
  156|      0|      _gpgrt_abort ();
  157|      0|    }
  158|       |
  159|  9.67M|  return lock;
  160|  9.67M|}

_gpg_strerror:
   43|   336k|{
   44|   336k|  gpg_err_code_t code = gpg_err_code (err);
   45|       |
   46|   336k|  if (code & GPG_ERR_SYSTEM_ERROR)
  ------------------
  |  |  584|   336k|#define GPG_ERR_SYSTEM_ERROR	(1 << 15)
  ------------------
  |  Branch (46:7): [True: 33.6k, False: 302k]
  ------------------
   47|  33.6k|    {
   48|  33.6k|      int no = gpg_err_code_to_errno (code);
   49|  33.6k|      if (no)
  ------------------
  |  Branch (49:11): [True: 32.6k, False: 942]
  ------------------
   50|  32.6k|	return strerror (no);
   51|    942|      else
   52|    942|	code = GPG_ERR_UNKNOWN_ERRNO;
   53|  33.6k|    }
   54|   303k|  return dgettext (PACKAGE, msgstr + msgidx[msgidxof (code)]);
   55|   336k|}

_gpgrt_get_syscall_clamp:
   59|      1|{
   60|      1|  *r_pre  = pre_syscall_func;
   61|      1|  *r_post = post_syscall_func;
   62|      1|}
_gpgrt_pre_syscall:
   68|  13.2M|{
   69|  13.2M|  if (pre_syscall_func)
  ------------------
  |  Branch (69:7): [True: 0, False: 13.2M]
  ------------------
   70|      0|    pre_syscall_func ();
   71|  13.2M|}
_gpgrt_post_syscall:
   77|  13.2M|{
   78|  13.2M|  if (post_syscall_func)
  ------------------
  |  Branch (78:7): [True: 0, False: 13.2M]
  ------------------
   79|      0|    post_syscall_func ();
   80|  13.2M|}

_gpgrt_access:
  492|      9|{
  493|      9|  gpg_err_code_t ec;
  494|       |
  495|       |#ifdef HAVE_W32_SYSTEM
  496|       |  wchar_t *wfname;
  497|       |  DWORD attribs;
  498|       |
  499|       |  wfname = _gpgrt_fname_to_wchar (fname);
  500|       |  if (!wfname)
  501|       |    return _gpg_err_code_from_syserror ();
  502|       |
  503|       |  attribs = GetFileAttributesW (wfname);
  504|       |  if (attribs == (DWORD)(-1))
  505|       |    ec = _gpgrt_w32_get_last_err_code ();
  506|       |  else
  507|       |    {
  508|       |      if ((mode & W_OK) && (attribs & FILE_ATTRIBUTE_READONLY))
  509|       |        {
  510|       |          _gpg_err_set_errno (EACCES);
  511|       |          ec = _gpg_err_code_from_syserror ();
  512|       |        }
  513|       |      else
  514|       |        ec = 0;
  515|       |    }
  516|       |  _gpgrt_free_wchar (wfname);
  517|       |#else /* Unix */
  518|      9|  ec = access (fname, mode)? _gpg_err_code_from_syserror () : 0;
  ------------------
  |  Branch (518:8): [True: 4, False: 5]
  ------------------
  519|      9|#endif /* Unix */
  520|       |
  521|      9|  return ec;
  522|      9|}

gpg_strerror:
   30|   336k|{
   31|   336k|  return _gpg_strerror (err);
   32|   336k|}
gpg_err_code_from_errno:
   48|  31.5k|{
   49|  31.5k|  return _gpg_err_code_from_errno (err);
   50|  31.5k|}
gpg_err_code_to_errno:
   54|  33.6k|{
   55|  33.6k|  return _gpg_err_code_to_errno (code);
   56|  33.6k|}
gpg_err_code_from_syserror:
   60|  32.6k|{
   61|  32.6k|  return _gpg_err_code_from_syserror ();
   62|  32.6k|}
gpg_err_set_errno:
   66|  31.5k|{
   67|  31.5k|  _gpg_err_set_errno (err);
   68|  31.5k|}
gpg_err_init:
   73|      2|{
   74|      2|  return _gpg_err_init ();
   75|      2|}
gpgrt_get_syscall_clamp:
  115|      1|{
  116|      1|  _gpgrt_get_syscall_clamp (r_pre, r_post);
  117|      1|}
gpgrt_lock_lock:
  134|   258k|{
  135|   258k|  return _gpgrt_lock_lock (lockhd);
  136|   258k|}
gpgrt_lock_unlock:
  146|   258k|{
  147|   258k|  return _gpgrt_lock_unlock (lockhd);
  148|   258k|}
gpgrt_fopen:
  167|  3.54k|{
  168|  3.54k|  return _gpgrt_fopen (path, mode);
  169|  3.54k|}
gpgrt_fclose:
  249|  3.54k|{
  250|  3.54k|  return _gpgrt_fclose (stream);
  251|  3.54k|}
_gpgrt_get_std_stream:
  304|  4.58k|{
  305|  4.58k|  return _gpgrt__get_std_stream (fd);  /* (double dash in name) */
  306|  4.58k|}
gpgrt_ferror:
  352|  4.09k|{
  353|  4.09k|  return _gpgrt_ferror (stream);
  354|  4.09k|}
gpgrt_fflush:
  376|  4.58k|{
  377|  4.58k|  return _gpgrt_fflush (stream);
  378|  4.58k|}
gpgrt_fseeko:
  388|  4.46k|{
  389|  4.46k|  return _gpgrt_fseeko (stream, offset, whence);
  390|  4.46k|}
gpgrt_ftello:
  400|  8.18k|{
  401|  8.18k|  return _gpgrt_ftello (stream);
  402|  8.18k|}
gpgrt_fgetc:
  418|  24.5k|{
  419|  24.5k|  return _gpgrt_fgetc (stream);
  420|  24.5k|}
gpgrt_write_sanitized:
  467|  81.0k|{
  468|  81.0k|  return _gpgrt_write_sanitized (stream, buffer, length, delimiters,
  469|  81.0k|                                 bytes_written);
  470|  81.0k|}
gpgrt_fread:
  484|  4.09k|{
  485|  4.09k|  return _gpgrt_fread (ptr, size, nitems, stream);
  486|  4.09k|}
gpgrt_fwrite:
  491|      1|{
  492|      1|  return _gpgrt_fwrite (ptr, size, nitems, stream);
  493|      1|}
gpgrt_fputs:
  504|  2.21k|{
  505|  2.21k|  return _gpgrt_fputs (s, stream);
  506|  2.21k|}
gpgrt_snprintf:
  746|  44.8k|{
  747|  44.8k|  int rc;
  748|  44.8k|  va_list arg_ptr;
  749|       |
  750|  44.8k|  va_start (arg_ptr, format);
  751|  44.8k|  rc = _gpgrt_estream_vsnprintf (buf, bufsize, format, arg_ptr);
  752|  44.8k|  va_end (arg_ptr);
  753|       |
  754|  44.8k|  return rc;
  755|  44.8k|}
gpgrt_access:
  852|      9|{
  853|      9|  return _gpgrt_access (fname, mode);
  854|      9|}
gpgrt_inc_errorcount:
  905|  63.5k|{
  906|  63.5k|  _gpgrt_inc_errorcount ();
  907|  63.5k|}
gpgrt_log_set_sink:
  911|      1|{
  912|      1|  _gpgrt_log_set_sink (name, stream, fd);
  913|      1|}
gpgrt_log_get_stream:
  953|  83.2k|{
  954|  83.2k|  return _gpgrt_log_get_stream ();
  955|  83.2k|}
gpgrt_log_info:
  988|   247k|{
  989|   247k|  va_list arg_ptr;
  990|       |
  991|   247k|  va_start (arg_ptr, fmt);
  992|   247k|  _gpgrt_logv (GPGRT_LOGLVL_INFO, fmt, arg_ptr);
  993|   247k|  va_end (arg_ptr);
  994|   247k|}
gpgrt_log_error:
  998|  4.09M|{
  999|  4.09M|  va_list arg_ptr;
 1000|       |
 1001|  4.09M|  va_start (arg_ptr, fmt);
 1002|  4.09M|  _gpgrt_logv (GPGRT_LOGLVL_ERROR, fmt, arg_ptr);
 1003|  4.09M|  va_end (arg_ptr);
 1004|  4.09M|}
gpgrt_log_debug:
 1030|  1.32k|{
 1031|  1.32k|  va_list arg_ptr ;
 1032|       |
 1033|  1.32k|  va_start (arg_ptr, fmt);
 1034|  1.32k|  _gpgrt_logv (GPGRT_LOGLVL_DEBUG, fmt, arg_ptr);
 1035|  1.32k|  va_end (arg_ptr);
 1036|  1.32k|}
gpgrt_log_printf:
 1050|  84.5k|{
 1051|  84.5k|  va_list arg_ptr;
 1052|       |
 1053|  84.5k|  va_start (arg_ptr, fmt);
 1054|  84.5k|  _gpgrt_logv (fmt ? GPGRT_LOGLVL_CONT : GPGRT_LOGLVL_BEGIN, fmt, arg_ptr);
  ------------------
  |  Branch (1054:16): [True: 84.5k, False: 0]
  ------------------
 1055|  84.5k|  va_end (arg_ptr);
 1056|  84.5k|}
gpgrt_log_flush:
 1060|  1.32k|{
 1061|  1.32k|  _gpgrt_log_flush ();
 1062|  1.32k|}

