start_new_gpg_agent:
  609|   130k|{
  610|   130k|  return start_new_service (r_ctx, GNUPG_MODULE_NAME_AGENT,
  ------------------
  |  |  286|   130k|#define GNUPG_MODULE_NAME_AGENT        1
  ------------------
  611|   130k|                            errsource, agent_program,
  612|   130k|                            opt_lc_ctype, opt_lc_messages, session_env,
  613|   130k|                            autostart, verbose, debug,
  614|   130k|                            status_cb, status_cb_arg);
  615|   130k|}
asshelp.c:start_new_service:
  392|   130k|{
  393|   130k|  gpg_error_t err;
  394|   130k|  assuan_context_t ctx;
  395|   130k|  int did_success_msg = 0;
  396|   130k|  char *sockname;
  397|   130k|  const char *printed_name;
  398|   130k|  const char *lock_name;
  399|   130k|  const char *status_start_line;
  400|   130k|  int no_service_err;
  401|   130k|  int seconds_to_wait;
  402|   130k|  unsigned int connect_flags = 0;
  403|   130k|  const char *argv[6];
  404|       |
  405|   130k|  *r_ctx = NULL;
  406|       |
  407|   130k|  err = assuan_new (&ctx);
  408|   130k|  if (err)
  ------------------
  |  Branch (408:7): [True: 0, False: 130k]
  ------------------
  409|      0|    {
  410|      0|      log_error ("error allocating assuan context: %s\n", gpg_strerror (err));
  411|      0|      return err;
  412|      0|    }
  413|       |
  414|   130k|  switch (module_name_id)
  415|   130k|    {
  416|   130k|    case GNUPG_MODULE_NAME_AGENT:
  ------------------
  |  |  286|   130k|#define GNUPG_MODULE_NAME_AGENT        1
  ------------------
  |  Branch (416:5): [True: 130k, False: 0]
  ------------------
  417|   130k|      sockname = make_filename (gnupg_socketdir (), GPG_AGENT_SOCK_NAME, NULL);
  ------------------
  |  |  146|   130k|#define GPG_AGENT_SOCK_NAME "S.gpg-agent"
  ------------------
  418|   130k|      lock_name = "agent";
  419|   130k|      printed_name = "gpg-agent";
  420|   130k|      status_start_line = "starting_agent ? 0 0";
  421|   130k|      no_service_err = GPG_ERR_NO_AGENT;
  422|   130k|      seconds_to_wait = SECS_TO_WAIT_FOR_AGENT;
  ------------------
  |  |   57|   130k|#define SECS_TO_WAIT_FOR_AGENT 5
  ------------------
  423|   130k|      break;
  424|      0|    case GNUPG_MODULE_NAME_DIRMNGR:
  ------------------
  |  |  289|      0|#define GNUPG_MODULE_NAME_DIRMNGR      4
  ------------------
  |  Branch (424:5): [True: 0, False: 130k]
  ------------------
  425|      0|      sockname = make_filename (gnupg_socketdir (), DIRMNGR_SOCK_NAME, NULL);
  ------------------
  |  |   64|      0|#define DIRMNGR_SOCK_NAME "S.dirmngr"
  ------------------
  426|      0|      lock_name = "dirmngr";
  427|      0|      printed_name = "dirmngr";
  428|      0|      status_start_line = "starting_dirmngr ? 0 0";
  429|      0|      no_service_err = GPG_ERR_NO_DIRMNGR;
  430|      0|      seconds_to_wait = SECS_TO_WAIT_FOR_DIRMNGR;
  ------------------
  |  |   59|      0|#define SECS_TO_WAIT_FOR_DIRMNGR 5
  ------------------
  431|      0|      break;
  432|      0|    case GNUPG_MODULE_NAME_KEYBOXD:
  ------------------
  |  |  298|      0|#define GNUPG_MODULE_NAME_KEYBOXD       13
  ------------------
  |  Branch (432:5): [True: 0, False: 130k]
  ------------------
  433|      0|      sockname = make_filename (gnupg_socketdir (), KEYBOXD_SOCK_NAME, NULL);
  ------------------
  |  |  650|      0|#define KEYBOXD_SOCK_NAME "S.keyboxd"
  ------------------
  434|      0|      lock_name = "keyboxd";
  435|      0|      printed_name = "keyboxd";
  436|      0|      status_start_line = "starting_keyboxd ? 0 0";
  437|      0|      no_service_err = GPG_ERR_NO_KEYBOXD;
  438|      0|      seconds_to_wait = SECS_TO_WAIT_FOR_KEYBOXD;
  ------------------
  |  |   58|      0|#define SECS_TO_WAIT_FOR_KEYBOXD 5
  ------------------
  439|      0|      connect_flags |= ASSUAN_SOCKET_CONNECT_FDPASSING;
  440|      0|      break;
  441|      0|    default:
  ------------------
  |  Branch (441:5): [True: 0, False: 130k]
  ------------------
  442|      0|      err = gpg_error (GPG_ERR_INV_ARG);
  443|      0|      assuan_release (ctx);
  444|      0|      return err;
  445|   130k|    }
  446|       |
  447|   130k|  err = assuan_socket_connect (ctx, sockname, 0, connect_flags);
  448|   130k|  if (err && autostart)
  ------------------
  |  Branch (448:7): [True: 130k, False: 0]
  |  Branch (448:14): [True: 0, False: 130k]
  ------------------
  449|      0|    {
  450|      0|      char *abs_homedir;
  451|      0|      lock_spawn_t lock;
  ------------------
  |  |   52|      0|# define lock_spawn_t dotlock_t
  ------------------
  452|      0|      char *program = NULL;
  453|      0|      const char *program_arg = NULL;
  454|      0|      char *p;
  455|      0|      const char *s;
  456|      0|      int i;
  457|       |
  458|       |      /* With no success start a new server.  */
  459|      0|      if (!program_name || !*program_name)
  ------------------
  |  Branch (459:11): [True: 0, False: 0]
  |  Branch (459:28): [True: 0, False: 0]
  ------------------
  460|      0|        program_name = gnupg_module_name (module_name_id);
  461|      0|      else if ((s=strchr (program_name, '|')) && s[1] == '-' && s[2]=='-')
  ------------------
  |  Branch (461:16): [True: 0, False: 0]
  |  Branch (461:50): [True: 0, False: 0]
  |  Branch (461:65): [True: 0, False: 0]
  ------------------
  462|      0|        {
  463|       |          /* Hack to insert an additional option on the command line.  */
  464|      0|          program = xtrystrdup (program_name);
  ------------------
  |  |  103|      0|#define xtrystrdup(a)    gcry_strdup ((a))
  ------------------
  465|      0|          if (!program)
  ------------------
  |  Branch (465:15): [True: 0, False: 0]
  ------------------
  466|      0|            {
  467|      0|              gpg_error_t tmperr = gpg_err_make (errsource,
  468|      0|                                                 gpg_err_code_from_syserror ());
  469|      0|              xfree (sockname);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  470|      0|              assuan_release (ctx);
  471|      0|              return tmperr;
  472|      0|            }
  473|      0|          p = strchr (program, '|');
  474|      0|          *p++ = 0;
  475|      0|          program_arg = p;
  476|      0|        }
  477|       |
  478|      0|      if (verbose)
  ------------------
  |  Branch (478:11): [True: 0, False: 0]
  ------------------
  479|      0|        log_info (_("no running %s - starting '%s'\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  480|      0|                  printed_name, program_name);
  481|       |
  482|      0|      if (status_cb)
  ------------------
  |  Branch (482:11): [True: 0, False: 0]
  ------------------
  483|      0|        status_cb (status_cb_arg, STATUS_PROGRESS, status_start_line, NULL);
  484|       |
  485|       |      /* We better pass an absolute home directory to the service just
  486|       |       * in case the service does not convert the passed name to an
  487|       |       * absolute one (which it should do).  */
  488|      0|      abs_homedir = make_absfilename_try (gnupg_homedir (), NULL);
  489|      0|      if (!abs_homedir)
  ------------------
  |  Branch (489:11): [True: 0, False: 0]
  ------------------
  490|      0|        {
  491|      0|          gpg_error_t tmperr = gpg_err_make (errsource,
  492|      0|                                             gpg_err_code_from_syserror ());
  493|      0|          log_error ("error building filename: %s\n", gpg_strerror (tmperr));
  494|      0|          xfree (sockname);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  495|      0|          assuan_release (ctx);
  496|      0|          xfree (program);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  497|      0|          return tmperr;
  498|      0|        }
  499|       |
  500|      0|      if (fflush (NULL))
  ------------------
  |  Branch (500:11): [True: 0, False: 0]
  ------------------
  501|      0|        {
  502|      0|          gpg_error_t tmperr = gpg_err_make (errsource,
  503|      0|                                             gpg_err_code_from_syserror ());
  504|      0|          log_error ("error flushing pending output: %s\n", strerror (errno));
  505|      0|          xfree (sockname);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  506|      0|          assuan_release (ctx);
  507|      0|          xfree (abs_homedir);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  508|      0|          xfree (program);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  509|      0|          return tmperr;
  510|      0|        }
  511|       |
  512|      0|      i = 0;
  513|      0|      argv[i++] = "--homedir";
  514|      0|      argv[i++] = abs_homedir;
  515|      0|      if (module_name_id == GNUPG_MODULE_NAME_AGENT)
  ------------------
  |  |  286|      0|#define GNUPG_MODULE_NAME_AGENT        1
  ------------------
  |  Branch (515:11): [True: 0, False: 0]
  ------------------
  516|      0|        argv[i++] = "--use-standard-socket";
  517|      0|      if (program_arg)
  ------------------
  |  Branch (517:11): [True: 0, False: 0]
  ------------------
  518|      0|        argv[i++] = program_arg;
  519|      0|      argv[i++] = "--daemon";
  520|      0|      argv[i++] = NULL;
  521|       |
  522|      0|      if (!(err = lock_spawning (&lock, gnupg_homedir (), lock_name, verbose))
  ------------------
  |  Branch (522:11): [True: 0, False: 0]
  ------------------
  523|      0|          && assuan_socket_connect (ctx, sockname, 0, connect_flags))
  ------------------
  |  Branch (523:14): [True: 0, False: 0]
  ------------------
  524|      0|        {
  525|       |#ifdef HAVE_W32_SYSTEM
  526|       |          err = gnupg_spawn_process_detached (program? program : program_name,
  527|       |                                              argv, NULL);
  528|       |#else /*!W32*/
  529|      0|          pid_t pid;
  530|       |
  531|      0|          err = gnupg_spawn_process_fd (program? program : program_name,
  ------------------
  |  Branch (531:41): [True: 0, False: 0]
  ------------------
  532|      0|                                        argv, -1, -1, -1, &pid);
  533|      0|          if (!err)
  ------------------
  |  Branch (533:15): [True: 0, False: 0]
  ------------------
  534|      0|            err = gnupg_wait_process (program? program : program_name,
  ------------------
  |  Branch (534:39): [True: 0, False: 0]
  ------------------
  535|      0|                                      pid, 1, NULL);
  536|      0|#endif /*!W32*/
  537|      0|          if (err)
  ------------------
  |  Branch (537:15): [True: 0, False: 0]
  ------------------
  538|      0|            log_error ("failed to start %s '%s': %s\n",
  539|      0|                       printed_name, program? program : program_name,
  ------------------
  |  Branch (539:38): [True: 0, False: 0]
  ------------------
  540|      0|                       gpg_strerror (err));
  541|      0|          else
  542|      0|            err = wait_for_sock (seconds_to_wait, module_name_id,
  543|      0|                                 sockname, connect_flags,
  544|      0|                                 verbose, ctx, &did_success_msg);
  545|      0|        }
  546|       |
  547|      0|      unlock_spawning (&lock, lock_name);
  548|      0|      xfree (abs_homedir);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  549|      0|      xfree (program);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  550|      0|    }
  551|   130k|  xfree (sockname);
  ------------------
  |  |  104|   130k|#define xfree(a)         gcry_free ((a))
  ------------------
  552|   130k|  if (err)
  ------------------
  |  Branch (552:7): [True: 130k, False: 0]
  ------------------
  553|   130k|    {
  554|   130k|      if (autostart || gpg_err_code (err) != GPG_ERR_ASS_CONNECT_FAILED)
  ------------------
  |  Branch (554:11): [True: 0, False: 130k]
  |  Branch (554:24): [True: 0, False: 130k]
  ------------------
  555|      0|        log_error ("can't connect to the %s: %s\n",
  556|      0|                   printed_name, gpg_strerror (err));
  557|   130k|      assuan_release (ctx);
  558|   130k|      return gpg_err_make (errsource, no_service_err);
  559|   130k|    }
  560|       |
  561|      0|  if (debug && !did_success_msg)
  ------------------
  |  Branch (561:7): [True: 0, False: 0]
  |  Branch (561:16): [True: 0, False: 0]
  ------------------
  562|      0|    log_debug ("connection to the %s established\n", printed_name);
  563|       |
  564|      0|  if (module_name_id == GNUPG_MODULE_NAME_AGENT)
  ------------------
  |  |  286|      0|#define GNUPG_MODULE_NAME_AGENT        1
  ------------------
  |  Branch (564:7): [True: 0, False: 0]
  ------------------
  565|      0|    err = assuan_transact (ctx, "RESET",
  566|      0|                           NULL, NULL, NULL, NULL, NULL, NULL);
  567|       |
  568|      0|  if (!err
  ------------------
  |  Branch (568:7): [True: 0, False: 0]
  ------------------
  569|      0|      && module_name_id == GNUPG_MODULE_NAME_AGENT)
  ------------------
  |  |  286|      0|#define GNUPG_MODULE_NAME_AGENT        1
  ------------------
  |  Branch (569:10): [True: 0, False: 0]
  ------------------
  570|      0|    {
  571|      0|      err = send_pinentry_environment (ctx, errsource,
  572|      0|                                       opt_lc_ctype, opt_lc_messages,
  573|      0|                                       session_env);
  574|      0|      if (gpg_err_code (err) == GPG_ERR_FORBIDDEN
  ------------------
  |  Branch (574:11): [True: 0, False: 0]
  ------------------
  575|      0|          && gpg_err_source (err) == GPG_ERR_SOURCE_GPGAGENT)
  ------------------
  |  Branch (575:14): [True: 0, False: 0]
  ------------------
  576|      0|        {
  577|       |          /* Check whether the agent is in restricted mode.  */
  578|      0|          if (!assuan_transact (ctx, "GETINFO restricted",
  ------------------
  |  Branch (578:15): [True: 0, False: 0]
  ------------------
  579|      0|                                NULL, NULL, NULL, NULL, NULL, NULL))
  580|      0|            {
  581|      0|              if (verbose)
  ------------------
  |  Branch (581:19): [True: 0, False: 0]
  ------------------
  582|      0|                log_info (_("connection to the agent is in restricted mode\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  583|      0|              err = 0;
  584|      0|            }
  585|      0|        }
  586|      0|    }
  587|      0|  if (err)
  ------------------
  |  Branch (587:7): [True: 0, False: 0]
  ------------------
  588|      0|    {
  589|      0|      assuan_release (ctx);
  590|      0|      return err;
  591|      0|    }
  592|       |
  593|      0|  *r_ctx = ctx;
  594|      0|  return 0;
  595|      0|}

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|  3.12k|{
  496|  3.12k|  if (! initialized)
  ------------------
  |  Branch (496:7): [True: 0, False: 3.12k]
  ------------------
  497|      0|    return 1;
  498|       |
  499|  3.12k|  switch (compliance)
  500|  3.12k|    {
  501|      0|    case CO_DE_VS:
  ------------------
  |  Branch (501:5): [True: 0, False: 3.12k]
  ------------------
  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|  3.12k|    default:
  ------------------
  |  Branch (519:5): [True: 3.12k, False: 0]
  ------------------
  520|       |      /* The default policy is to allow all algorithms.  */
  521|  3.12k|      return 1;
  522|  3.12k|    }
  523|       |
  524|      0|  log_assert (!"reached");
  525|      0|}

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

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|  58.2k|{
   69|  58.2k|  time_t current = time (NULL);
   70|  58.2k|  if (current == (time_t)(-1))
  ------------------
  |  Branch (70:7): [True: 0, False: 58.2k]
  ------------------
   71|      0|    log_fatal ("time() failed\n");
   72|       |
   73|  58.2k|  if (timemode == NORMAL)
  ------------------
  |  Branch (73:7): [True: 58.2k, False: 0]
  ------------------
   74|  58.2k|    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|  58.2k|}
make_timestamp:
  169|  58.2k|{
  170|  58.2k|  time_t t = gnupg_get_time ();
  171|  58.2k|  return (u32)t;
  172|  58.2k|}
asctimestamp:
  688|  11.0k|{
  689|  11.0k|  static char buffer[80];
  690|  11.0k|#if defined (HAVE_STRFTIME) && defined (HAVE_NL_LANGINFO)
  691|  11.0k|  static char fmt[80];
  692|  11.0k|#endif
  693|  11.0k|  struct tm *tp;
  694|  11.0k|  time_t atime = stamp;
  695|       |
  696|  11.0k|  if (IS_INVALID_TIME_T (atime))
  ------------------
  |  |   53|  11.0k|# define IS_INVALID_TIME_T(a) ((a) < 0)
  |  |  ------------------
  |  |  |  Branch (53:31): [True: 0, False: 11.0k]
  |  |  ------------------
  ------------------
  697|      0|    {
  698|      0|      strcpy (buffer, "????" "-??" "-??");
  699|      0|      return buffer;
  700|      0|    }
  701|       |
  702|  11.0k|  tp = localtime( &atime );
  703|  11.0k|#ifdef HAVE_STRFTIME
  704|  11.0k|# if defined(HAVE_NL_LANGINFO)
  705|  11.0k|  mem2str( fmt, nl_langinfo(D_T_FMT), DIM(fmt)-3 );
  ------------------
  |  |   47|  11.0k|#define DIM(v)		     (sizeof(v)/sizeof((v)[0]))
  ------------------
  706|  11.0k|  if (!strstr( fmt, "%Z" ))
  ------------------
  |  Branch (706:7): [True: 11.0k, False: 0]
  ------------------
  707|  11.0k|    strcat( fmt, " %Z");
  708|       |  /* NOTE: gcc -Wformat-noliteral will complain here.  I have found no
  709|       |     way to suppress this warning.  */
  710|  11.0k|  strftime (buffer, DIM(buffer)-1, fmt, tp);
  ------------------
  |  |   47|  11.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|  11.0k|  buffer[DIM(buffer)-1] = 0;
  ------------------
  |  |   47|  11.0k|#define DIM(v)		     (sizeof(v)/sizeof((v)[0]))
  ------------------
  744|       |#else
  745|       |  mem2str( buffer, asctime(tp), DIM(buffer) );
  746|       |#endif
  747|  11.0k|  return buffer;
  748|  11.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|      4|{
  804|       |  /* If a homedir has not been set, set it to the default.  */
  805|      4|  if (!the_gnupg_homedir)
  ------------------
  |  Branch (805:7): [True: 0, False: 4]
  ------------------
  806|      0|    the_gnupg_homedir = make_absfilename (default_homedir (), NULL);
  807|      4|  return the_gnupg_homedir;
  808|      4|}
_gnupg_socketdir_internal:
  866|      1|{
  867|       |#if defined(HAVE_W32_SYSTEM)
  868|       |  char *name;
  869|       |
  870|       |  (void)skip_checks;
  871|       |
  872|       |  *r_info = 0;
  873|       |
  874|       |  /* First make sure that non_default_homedir and w32_portable_app can
  875|       |   * be set.  */
  876|       |  gnupg_homedir ();
  877|       |
  878|       |  if (w32_portable_app)
  879|       |    {
  880|       |      name = xstrconcat (w32_rootdir (), DIRSEP_S, "gnupg", NULL);
  881|       |    }
  882|       |  else
  883|       |    {
  884|       |      char *path;
  885|       |
  886|       |      path = w32_shgetfolderpath (NULL,
  887|       |                                  CSIDL_LOCAL_APPDATA|CSIDL_FLAG_CREATE,
  888|       |                                  NULL, 0);
  889|       |      if (path)
  890|       |        {
  891|       |          name = xstrconcat (path, "\\gnupg", NULL);
  892|       |          xfree (path);
  893|       |          if (gnupg_access (name, F_OK))
  894|       |            gnupg_mkdir (name, "-rwx");
  895|       |        }
  896|       |      else
  897|       |        {
  898|       |          name = xstrdup (gnupg_homedir ());
  899|       |        }
  900|       |    }
  901|       |
  902|       |  /* If a non default homedir is used, we check whether an
  903|       |   * corresponding sub directory below the socket dir is available
  904|       |   * and use that.  We hash the non default homedir to keep the new
  905|       |   * subdir short enough.  */
  906|       |  if (non_default_homedir)
  907|       |    {
  908|       |      char sha1buf[20];
  909|       |      struct stat sb;
  910|       |      char *suffix;
  911|       |      char *p;
  912|       |
  913|       |      *r_info |= 32; /* Testing subdir.  */
  914|       |
  915|       |      /* Canonicalize the name to avoid problems with mixed case
  916|       |       * names.  Note that we use only 10 bytes of the hash because on
  917|       |       * Windows the account name is also part of the name.  */
  918|       |      suffix = ascii_strlwr (xstrdup (gnupg_homedir ()));
  919|       |      for (p=suffix; *p; p++)
  920|       |        if ( *p == '\\')
  921|       |          *p = '/';
  922|       |      gcry_md_hash_buffer (GCRY_MD_SHA1, sha1buf, suffix, strlen (suffix));
  923|       |      xfree (suffix);
  924|       |      suffix = zb32_encode (sha1buf, 8*10);
  925|       |      if (!suffix)
  926|       |        {
  927|       |          *r_info |= 1; /* Out of core etc. */
  928|       |          goto leave_w32;
  929|       |        }
  930|       |      p = xstrconcat (name, "\\d.", suffix, NULL);
  931|       |      xfree (suffix);
  932|       |      xfree (name);
  933|       |      name = p;
  934|       |
  935|       |      /* Stat that directory and check constraints.
  936|       |       * The command
  937|       |       *    gpgconf --remove-socketdir
  938|       |       * can be used to remove that directory.  */
  939|       |      if (gnupg_stat (name, &sb))
  940|       |        {
  941|       |          if (errno != ENOENT)
  942|       |            *r_info |= 1; /* stat failed. */
  943|       |          else if (!skip_checks)
  944|       |            {
  945|       |              /* Try to create the directory and check again.  */
  946|       |              if (gnupg_mkdir (name, "-rwx"))
  947|       |                *r_info |= 16; /* mkdir failed.  */
  948|       |              else if (gnupg_stat (name, &sb))
  949|       |                {
  950|       |                  if (errno != ENOENT)
  951|       |                    *r_info |= 1; /* stat failed. */
  952|       |                  else
  953|       |                    *r_info |= 64; /* Subdir does not exist.  */
  954|       |                }
  955|       |              else
  956|       |                goto leave_w32; /* Success!  */
  957|       |            }
  958|       |          else
  959|       |            *r_info |= 64; /* Subdir does not exist.  */
  960|       |          if (!skip_checks)
  961|       |            {
  962|       |              xfree (name);
  963|       |              name = NULL;
  964|       |              goto leave_w32;
  965|       |            }
  966|       |        }
  967|       |    }
  968|       |
  969|       | leave_w32:
  970|       |  /* If nothing works - fall back to the homedir.  */
  971|       |  if (!name)
  972|       |    {
  973|       |      *r_info |= 128; /* Fallback.  */
  974|       |      name = xstrdup (gnupg_homedir ());
  975|       |    }
  976|       |
  977|       |#elif !defined(HAVE_STAT)
  978|       |  char *name;
  979|       |
  980|       |  (void)skip_checks;
  981|       |  *r_info = 0;
  982|       |  name = xstrdup (gnupg_homedir ());
  983|       |
  984|       |#else /* Unix and stat(2) available. */
  985|       |
  986|      1|  static const char * const bases[] = {
  987|       |#ifdef USE_RUN_GNUPG_USER_SOCKET
  988|       |    "/run/gnupg",
  989|       |#endif
  990|      1|    "/run",
  991|       |#ifdef USE_RUN_GNUPG_USER_SOCKET
  992|       |    "/var/run/gnupg",
  993|       |#endif
  994|      1|    "/var/run",
  995|      1|    NULL
  996|      1|  };
  997|      1|  int i;
  998|      1|  struct stat sb;
  999|      1|  char prefix[19 + 1 + 20 + 6 + 1];
 1000|      1|  const char *s;
 1001|      1|  char *name = NULL;
 1002|       |
 1003|      1|  *r_info = 0;
 1004|       |
 1005|       |  /* First make sure that non_default_homedir can be set.  */
 1006|      1|  gnupg_homedir ();
 1007|       |
 1008|       |  /* It has been suggested to first check XDG_RUNTIME_DIR envvar.
 1009|       |   * However, the specs state that the lifetime of the directory MUST
 1010|       |   * be bound to the user being logged in.  Now GnuPG may also be run
 1011|       |   * as a background process with no (desktop) user logged in.  Thus
 1012|       |   * we better don't do that.  */
 1013|       |
 1014|       |  /* Check whether we have a /run/[gnupg/]user dir.  */
 1015|      3|  for (i=0; bases[i]; i++)
  ------------------
  |  Branch (1015:13): [True: 2, False: 1]
  ------------------
 1016|      2|    {
 1017|      2|      snprintf (prefix, sizeof prefix, "%s/user/%u",
  ------------------
  |  |   84|      2|#define snprintf gpgrt_snprintf
  ------------------
 1018|      2|                bases[i], (unsigned int)getuid ());
 1019|      2|      if (!stat (prefix, &sb) && S_ISDIR(sb.st_mode))
  ------------------
  |  Branch (1019:11): [True: 0, False: 2]
  ------------------
 1020|      0|        break;
 1021|      2|    }
 1022|      1|  if (!bases[i])
  ------------------
  |  Branch (1022:7): [True: 1, False: 0]
  ------------------
 1023|      1|    {
 1024|      1|      *r_info |= 2; /* No /run/user directory.  */
 1025|      1|      goto leave;
 1026|      1|    }
 1027|       |
 1028|      0|  if (sb.st_uid != getuid ())
  ------------------
  |  Branch (1028:7): [True: 0, False: 0]
  ------------------
 1029|      0|    {
 1030|      0|      *r_info |= 4; /* Not owned by the user.  */
 1031|      0|      if (!skip_checks)
  ------------------
  |  Branch (1031:11): [True: 0, False: 0]
  ------------------
 1032|      0|        goto leave;
 1033|      0|    }
 1034|       |
 1035|      0|  if (strlen (prefix) + 7 >= sizeof prefix)
  ------------------
  |  Branch (1035:7): [True: 0, False: 0]
  ------------------
 1036|      0|    {
 1037|      0|      *r_info |= 1; /* Ooops: Buffer too short to append "/gnupg".  */
 1038|      0|      goto leave;
 1039|      0|    }
 1040|      0|  strcat (prefix, "/gnupg");
 1041|       |
 1042|       |  /* Check whether the gnupg sub directory has proper permissions.  */
 1043|      0|  if (stat (prefix, &sb))
  ------------------
  |  Branch (1043:7): [True: 0, False: 0]
  ------------------
 1044|      0|    {
 1045|      0|      if (errno != ENOENT)
  ------------------
  |  Branch (1045:11): [True: 0, False: 0]
  ------------------
 1046|      0|        {
 1047|      0|          *r_info |= 1; /* stat failed.  */
 1048|      0|          goto leave;
 1049|      0|        }
 1050|       |
 1051|       |      /* Try to create the directory and check again.  */
 1052|      0|      if (gnupg_mkdir (prefix, "-rwx"))
  ------------------
  |  Branch (1052:11): [True: 0, False: 0]
  ------------------
 1053|      0|        {
 1054|      0|          *r_info |= 16; /* mkdir failed.  */
 1055|      0|          goto leave;
 1056|      0|        }
 1057|      0|      if (stat (prefix, &sb))
  ------------------
  |  Branch (1057:11): [True: 0, False: 0]
  ------------------
 1058|      0|        {
 1059|      0|          *r_info |= 1; /* stat failed.  */
 1060|      0|          goto leave;
 1061|      0|        }
 1062|      0|    }
 1063|       |  /* Check that it is a directory, owned by the user, and only the
 1064|       |   * user has permissions to use it.  */
 1065|      0|  if (!S_ISDIR(sb.st_mode)
  ------------------
  |  Branch (1065:7): [True: 0, False: 0]
  ------------------
 1066|      0|      || sb.st_uid != getuid ()
  ------------------
  |  Branch (1066:10): [True: 0, False: 0]
  ------------------
 1067|      0|      || (sb.st_mode & (S_IRWXG|S_IRWXO)))
  ------------------
  |  Branch (1067:10): [True: 0, False: 0]
  ------------------
 1068|      0|    {
 1069|      0|      *r_info |= 4; /* Bad permissions or not a directory. */
 1070|      0|      if (!skip_checks)
  ------------------
  |  Branch (1070:11): [True: 0, False: 0]
  ------------------
 1071|      0|        goto leave;
 1072|      0|    }
 1073|       |
 1074|       |  /* If a non default homedir is used, we check whether an
 1075|       |   * corresponding sub directory below the socket dir is available
 1076|       |   * and use that.  We hash the non default homedir to keep the new
 1077|       |   * subdir short enough.  */
 1078|      0|  if (non_default_homedir)
  ------------------
  |  Branch (1078:7): [True: 0, False: 0]
  ------------------
 1079|      0|    {
 1080|      0|      char sha1buf[20];
 1081|      0|      char *suffix;
 1082|       |
 1083|      0|      *r_info |= 32; /* Testing subdir.  */
 1084|      0|      s = gnupg_homedir ();
 1085|      0|      gcry_md_hash_buffer (GCRY_MD_SHA1, sha1buf, s, strlen (s));
 1086|      0|      suffix = zb32_encode (sha1buf, 8*15);
 1087|      0|      if (!suffix)
  ------------------
  |  Branch (1087:11): [True: 0, False: 0]
  ------------------
 1088|      0|        {
 1089|      0|          *r_info |= 1; /* Out of core etc. */
 1090|      0|          goto leave;
 1091|      0|        }
 1092|      0|      name = strconcat (prefix, "/d.", suffix, NULL);
 1093|      0|      xfree (suffix);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1094|      0|      if (!name)
  ------------------
  |  Branch (1094:11): [True: 0, False: 0]
  ------------------
 1095|      0|        {
 1096|      0|          *r_info |= 1; /* Out of core etc. */
 1097|      0|          goto leave;
 1098|      0|        }
 1099|       |
 1100|       |      /* Stat that directory and check constraints.
 1101|       |       * The command
 1102|       |       *    gpgconf --remove-socketdir
 1103|       |       * can be used to remove that directory.  */
 1104|      0|      if (stat (name, &sb))
  ------------------
  |  Branch (1104:11): [True: 0, False: 0]
  ------------------
 1105|      0|        {
 1106|      0|          if (errno != ENOENT)
  ------------------
  |  Branch (1106:15): [True: 0, False: 0]
  ------------------
 1107|      0|            *r_info |= 1; /* stat failed. */
 1108|      0|          else if (!skip_checks)
  ------------------
  |  Branch (1108:20): [True: 0, False: 0]
  ------------------
 1109|      0|            {
 1110|       |              /* Try to create the directory and check again.  */
 1111|      0|              if (gnupg_mkdir (name, "-rwx"))
  ------------------
  |  Branch (1111:19): [True: 0, False: 0]
  ------------------
 1112|      0|                *r_info |= 16; /* mkdir failed.  */
 1113|      0|              else if (stat (prefix, &sb))
  ------------------
  |  Branch (1113:24): [True: 0, False: 0]
  ------------------
 1114|      0|                {
 1115|      0|                  if (errno != ENOENT)
  ------------------
  |  Branch (1115:23): [True: 0, False: 0]
  ------------------
 1116|      0|                    *r_info |= 1; /* stat failed. */
 1117|      0|                  else
 1118|      0|                    *r_info |= 64; /* Subdir does not exist.  */
 1119|      0|                }
 1120|      0|              else
 1121|      0|                goto leave; /* Success!  */
 1122|      0|            }
 1123|      0|          else
 1124|      0|            *r_info |= 64; /* Subdir does not exist.  */
 1125|      0|          if (!skip_checks)
  ------------------
  |  Branch (1125:15): [True: 0, False: 0]
  ------------------
 1126|      0|            {
 1127|      0|              xfree (name);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1128|      0|              name = NULL;
 1129|      0|              goto leave;
 1130|      0|            }
 1131|      0|        }
 1132|      0|      else if (!S_ISDIR(sb.st_mode)
  ------------------
  |  Branch (1132:16): [True: 0, False: 0]
  ------------------
 1133|      0|               || sb.st_uid != getuid ()
  ------------------
  |  Branch (1133:19): [True: 0, False: 0]
  ------------------
 1134|      0|               || (sb.st_mode & (S_IRWXG|S_IRWXO)))
  ------------------
  |  Branch (1134:19): [True: 0, False: 0]
  ------------------
 1135|      0|        {
 1136|      0|          *r_info |= 8; /* Bad permissions or subdir is not a directory.  */
 1137|      0|          if (!skip_checks)
  ------------------
  |  Branch (1137:15): [True: 0, False: 0]
  ------------------
 1138|      0|            {
 1139|      0|              xfree (name);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1140|      0|              name = NULL;
 1141|      0|              goto leave;
 1142|      0|            }
 1143|      0|        }
 1144|      0|    }
 1145|      0|  else
 1146|      0|    name = xstrdup (prefix);
  ------------------
  |  |  112|      0|#define xstrdup(a)       gcry_xstrdup ((a))
  ------------------
 1147|       |
 1148|      1| leave:
 1149|       |  /* If nothing works fall back to the homedir.  */
 1150|      1|  if (!name)
  ------------------
  |  Branch (1150:7): [True: 1, False: 0]
  ------------------
 1151|      1|    {
 1152|      1|      *r_info |= 128; /* Fallback.  */
 1153|      1|      name = xstrdup (gnupg_homedir ());
  ------------------
  |  |  112|      1|#define xstrdup(a)       gcry_xstrdup ((a))
  ------------------
 1154|      1|    }
 1155|       |
 1156|      1|#endif /* Unix */
 1157|       |
 1158|      1|  return name;
 1159|      0|}
gnupg_socketdir:
 1168|   130k|{
 1169|   130k|  static char *name;
 1170|       |
 1171|   130k|  if (!name)
  ------------------
  |  Branch (1171:7): [True: 1, False: 130k]
  ------------------
 1172|      1|    {
 1173|      1|      unsigned int dummy;
 1174|      1|      name = _gnupg_socketdir_internal (0, &dummy);
 1175|      1|      gpgrt_annotate_leaked_object (name);
 1176|      1|    }
 1177|       |
 1178|   130k|  return name;
 1179|   130k|}
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|}

i18n_switchto_utf8:
  102|   127k|{
  103|       |#ifdef USE_SIMPLE_GETTEXT
  104|       |  /* Return an arbitrary pointer as true value.  */
  105|       |  return gettext_use_utf8 (1) ? (char*)(-1) : NULL;
  106|       |#elif defined(ENABLE_NLS)
  107|   127k|  char *orig_codeset = bind_textdomain_codeset (PACKAGE_GT, NULL);
  ------------------
  |  |  689|   127k|#define PACKAGE_GT "gnupg2"
  ------------------
  108|   127k|# ifdef HAVE_LANGINFO_CODESET
  109|   127k|  if (!orig_codeset)
  ------------------
  |  Branch (109:7): [True: 1, False: 127k]
  ------------------
  110|      1|    orig_codeset = nl_langinfo (CODESET);
  111|   127k|# endif
  112|   127k|  if (orig_codeset)
  ------------------
  |  Branch (112:7): [True: 127k, False: 0]
  ------------------
  113|   127k|    { /* We only switch when we are able to restore the codeset later.
  114|       |         Note that bind_textdomain_codeset does only return on memory
  115|       |         errors but not if a codeset is not available.  Thus we don't
  116|       |         bother printing a diagnostic here. */
  117|   127k|      orig_codeset = xstrdup (orig_codeset);
  ------------------
  |  |  112|   127k|#define xstrdup(a)       gcry_xstrdup ((a))
  ------------------
  118|   127k|      if (!bind_textdomain_codeset (PACKAGE_GT, "utf-8"))
  ------------------
  |  |  689|   127k|#define PACKAGE_GT "gnupg2"
  ------------------
  |  Branch (118:11): [True: 0, False: 127k]
  ------------------
  119|      0|        {
  120|      0|	  xfree (orig_codeset);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  121|      0|	  orig_codeset = NULL;
  122|      0|	}
  123|   127k|    }
  124|   127k|  return orig_codeset;
  125|       |#else
  126|       |  return NULL;
  127|       |#endif
  128|   127k|}
i18n_switchback:
  133|   127k|{
  134|       |#ifdef USE_SIMPLE_GETTEXT
  135|       |  gettext_use_utf8 (!!saved_codeset);
  136|       |#elif defined(ENABLE_NLS)
  137|   127k|  if (saved_codeset)
  ------------------
  |  Branch (137:7): [True: 127k, False: 0]
  ------------------
  138|   127k|    {
  139|   127k|      bind_textdomain_codeset (PACKAGE_GT, saved_codeset);
  ------------------
  |  |  689|   127k|#define PACKAGE_GT "gnupg2"
  ------------------
  140|   127k|      xfree (saved_codeset);
  ------------------
  |  |  104|   127k|#define xfree(a)         gcry_free ((a))
  ------------------
  141|   127k|    }
  142|       |#else
  143|       |  (void)saved_codeset;
  144|       |#endif
  145|   127k|}

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|  1.44k|{
 1123|  1.44k|  static int used;
 1124|       |
 1125|  1.44k|  if (!used && kilobyte)
  ------------------
  |  Branch (1125:7): [True: 1.44k, False: 0]
  |  Branch (1125:16): [True: 0, False: 1.44k]
  ------------------
 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|  1.44k|  return iobuf_buffer_size / 1024;
 1136|  1.44k|}
iobuf_alloc:
 1182|  18.9k|{
 1183|  18.9k|  iobuf_t a;
 1184|  18.9k|  static int number = 0;
 1185|       |
 1186|  18.9k|  assert (use == IOBUF_INPUT || use == IOBUF_INPUT_TEMP
 1187|  18.9k|	  || use == IOBUF_OUTPUT || use == IOBUF_OUTPUT_TEMP);
 1188|  18.9k|  if (bufsize == 0)
  ------------------
  |  Branch (1188:7): [True: 0, False: 18.9k]
  ------------------
 1189|      0|    {
 1190|      0|      log_bug ("iobuf_alloc() passed a bufsize of 0!\n");
 1191|      0|      bufsize = iobuf_buffer_size;
 1192|      0|    }
 1193|       |
 1194|  18.9k|  a = xcalloc (1, sizeof *a);
  ------------------
  |  |  109|  18.9k|#define xcalloc(a,b)     gcry_xcalloc ((a),(b))
  ------------------
 1195|  18.9k|  a->use = use;
 1196|  18.9k|  a->d.buf = xmalloc (bufsize);
  ------------------
  |  |  107|  18.9k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 1197|  18.9k|  a->d.size = bufsize;
 1198|  18.9k|  a->e_d.buf = NULL;
 1199|  18.9k|  a->e_d.len = 0;
 1200|  18.9k|  a->e_d.used = 0;
 1201|  18.9k|  a->e_d.preferred = 0;
 1202|  18.9k|  a->no = ++number;
 1203|  18.9k|  a->subno = 0;
 1204|  18.9k|  a->real_fname = NULL;
 1205|  18.9k|  return a;
 1206|  18.9k|}
iobuf_close:
 1210|  40.1k|{
 1211|  40.1k|  iobuf_t a_chain;
 1212|  40.1k|  size_t dummy_len = 0;
 1213|  40.1k|  int rc = 0;
 1214|       |
 1215|  61.2k|  for (; a; a = a_chain)
  ------------------
  |  Branch (1215:10): [True: 21.0k, False: 40.1k]
  ------------------
 1216|  21.0k|    {
 1217|  21.0k|      byte desc[MAX_IOBUF_DESC];
 1218|  21.0k|      int rc2 = 0;
 1219|       |
 1220|  21.0k|      a_chain = a->chain;
 1221|       |
 1222|  21.0k|      if (a->use == IOBUF_OUTPUT && (rc = filter_flush (a)))
  ------------------
  |  Branch (1222:11): [True: 1, False: 21.0k]
  |  Branch (1222:37): [True: 0, False: 1]
  ------------------
 1223|      0|	log_error ("filter_flush failed on close: %s\n", gpg_strerror (rc));
 1224|       |
 1225|  21.0k|      if (DBG_IOBUF)
  ------------------
  |  |   98|  21.0k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 21.0k]
  |  |  ------------------
  ------------------
 1226|      0|	log_debug ("iobuf-%d.%d: close '%s'\n",
 1227|      0|		   a->no, a->subno, iobuf_desc (a, desc));
 1228|       |
 1229|  21.0k|      if (a->filter && (rc2 = a->filter (a->filter_ov, IOBUFCTRL_FREE,
  ------------------
  |  Branch (1229:11): [True: 6.80k, False: 14.2k]
  |  Branch (1229:24): [True: 0, False: 6.80k]
  ------------------
 1230|  6.80k|					 a->chain, NULL, &dummy_len)))
 1231|      0|	log_error ("IOBUFCTRL_FREE failed on close: %s\n", gpg_strerror (rc));
 1232|  21.0k|      if (! rc && rc2)
  ------------------
  |  Branch (1232:11): [True: 21.0k, False: 0]
  |  Branch (1232:19): [True: 0, False: 21.0k]
  ------------------
 1233|       |	/* Whoops!  An error occurred.  Save it in RC if we haven't
 1234|       |	   already recorded an error.  */
 1235|      0|	rc = rc2;
 1236|       |
 1237|  21.0k|      xfree (a->real_fname);
  ------------------
  |  |  104|  21.0k|#define xfree(a)         gcry_free ((a))
  ------------------
 1238|  21.0k|      if (a->d.buf)
  ------------------
  |  Branch (1238:11): [True: 21.0k, False: 0]
  ------------------
 1239|  21.0k|	{
 1240|  21.0k|	  memset (a->d.buf, 0, a->d.size);	/* erase the buffer */
 1241|  21.0k|	  xfree (a->d.buf);
  ------------------
  |  |  104|  21.0k|#define xfree(a)         gcry_free ((a))
  ------------------
 1242|  21.0k|	}
 1243|  21.0k|      xfree (a);
  ------------------
  |  |  104|  21.0k|#define xfree(a)         gcry_free ((a))
  ------------------
 1244|  21.0k|    }
 1245|  40.1k|  return rc;
 1246|  40.1k|}
iobuf_temp_with_content:
 1302|  1.85k|{
 1303|  1.85k|  iobuf_t a;
 1304|  1.85k|  int i;
 1305|       |
 1306|  1.85k|  a = iobuf_alloc (IOBUF_INPUT_TEMP, length);
 1307|  1.85k|  assert (length == a->d.size);
 1308|       |  /* memcpy (a->d.buf, buffer, length); */
 1309|   130k|  for (i=0; i < length; i++)
  ------------------
  |  Branch (1309:13): [True: 128k, False: 1.85k]
  ------------------
 1310|   128k|    a->d.buf[i] = buffer[i];
 1311|  1.85k|  a->d.len = length;
 1312|       |
 1313|  1.85k|  return a;
 1314|  1.85k|}
iobuf_is_pipe_filename:
 1319|  67.7k|{
 1320|  67.7k|  if (!fname || (*fname=='-' && !fname[1]) )
  ------------------
  |  Branch (1320:7): [True: 0, False: 67.7k]
  |  Branch (1320:18): [True: 1.34k, False: 66.4k]
  |  Branch (1320:33): [True: 1.34k, False: 0]
  ------------------
 1321|  1.34k|    return 1;
 1322|  66.4k|  return check_special_filename (fname, 0, 1) != -1;
 1323|  67.7k|}
iobuf_open:
 1391|  17.0k|{
 1392|  17.0k|  return do_open (fname, 1, IOBUF_INPUT, "rb", 0);
 1393|  17.0k|}
iobuf_create:
 1397|      1|{
 1398|      1|  return do_open (fname, 1, IOBUF_OUTPUT, "wb", mode700);
 1399|      1|}
iobuf_ioctl:
 1504|  8.53k|{
 1505|  8.53k|  byte desc[MAX_IOBUF_DESC];
 1506|       |
 1507|  8.53k|  if (cmd == IOBUF_IOCTL_KEEP_OPEN)
  ------------------
  |  Branch (1507:7): [True: 0, False: 8.53k]
  ------------------
 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|  8.53k|  else if (cmd == IOBUF_IOCTL_INVALIDATE_CACHE)
  ------------------
  |  Branch (1532:12): [True: 1, False: 8.53k]
  ------------------
 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|  8.53k|  else if (cmd == IOBUF_IOCTL_NO_CACHE)
  ------------------
  |  Branch (1544:12): [True: 8.53k, False: 0]
  ------------------
 1545|  8.53k|    {
 1546|  8.53k|      if (DBG_IOBUF)
  ------------------
  |  |   98|  8.53k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 8.53k]
  |  |  ------------------
  ------------------
 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|  8.53k|      for (; a; a = a->chain)
  ------------------
  |  Branch (1550:14): [True: 8.53k, False: 0]
  ------------------
 1551|  8.53k|	if (!a->chain && a->filter == file_filter)
  ------------------
  |  Branch (1551:6): [True: 8.53k, False: 0]
  |  Branch (1551:19): [True: 8.53k, False: 0]
  ------------------
 1552|  8.53k|	  {
 1553|  8.53k|	    file_filter_ctx_t *b = a->filter_ov;
 1554|  8.53k|	    b->no_cache = intval;
 1555|  8.53k|	    return 0;
 1556|  8.53k|	  }
 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|  8.53k|    }
 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|  8.53k|}
iobuf_push_filter:
 1593|  34.3k|{
 1594|  34.3k|  return iobuf_push_filter2 (a, f, ov, 0);
 1595|  34.3k|}
iobuf_push_filter2:
 1602|  34.3k|{
 1603|  34.3k|  iobuf_t b;
 1604|  34.3k|  size_t dummy_len = 0;
 1605|  34.3k|  int rc = 0;
 1606|       |
 1607|  34.3k|  if (a->use == IOBUF_OUTPUT && (rc = filter_flush (a)))
  ------------------
  |  Branch (1607:7): [True: 0, False: 34.3k]
  |  Branch (1607:33): [True: 0, False: 0]
  ------------------
 1608|      0|    return rc;
 1609|       |
 1610|  34.3k|  if (a->subno >= MAX_NESTING_FILTER)
  ------------------
  |  |   67|  34.3k|#define MAX_NESTING_FILTER 64
  ------------------
  |  Branch (1610:7): [True: 0, False: 34.3k]
  ------------------
 1611|      0|    {
 1612|      0|      log_error ("i/o filter too deeply nested - corrupted data?\n");
 1613|      0|      return GPG_ERR_BAD_DATA;
 1614|      0|    }
 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|  34.3k|  b = xmalloc (sizeof *b);
  ------------------
  |  |  107|  34.3k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 1662|  34.3k|  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|  34.3k|  b->real_fname = a->real_fname ? xstrdup (a->real_fname) : NULL;
  ------------------
  |  |  112|  34.3k|#define xstrdup(a)       gcry_xstrdup ((a))
  ------------------
  |  Branch (1666:19): [True: 34.3k, False: 0]
  ------------------
 1667|       |  /* remove the filter stuff from the new stream */
 1668|  34.3k|  a->filter = NULL;
 1669|  34.3k|  a->filter_ov = NULL;
 1670|  34.3k|  a->filter_ov_owner = 0;
 1671|  34.3k|  a->filter_eof = 0;
 1672|  34.3k|  if (a->use == IOBUF_OUTPUT_TEMP)
  ------------------
  |  Branch (1672:7): [True: 0, False: 34.3k]
  ------------------
 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|  34.3k|  else if (a->use == IOBUF_INPUT_TEMP)
  ------------------
  |  Branch (1688:12): [True: 0, False: 34.3k]
  ------------------
 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|  34.3k|  a->d.buf = xmalloc (a->d.size);
  ------------------
  |  |  107|  34.3k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 1707|  34.3k|  a->d.len = 0;
 1708|  34.3k|  a->d.start = 0;
 1709|       |
 1710|       |  /* disable nlimit for the new stream */
 1711|  34.3k|  a->ntotal = b->ntotal + b->nbytes;
 1712|  34.3k|  a->nlimit = a->nbytes = 0;
 1713|  34.3k|  a->nofast = 0;
 1714|       |  /* make a link from the new stream to the original stream */
 1715|  34.3k|  a->chain = b;
 1716|       |
 1717|       |  /* setup the function on the new stream */
 1718|  34.3k|  a->filter = f;
 1719|  34.3k|  a->filter_ov = ov;
 1720|  34.3k|  a->filter_ov_owner = rel_ov;
 1721|       |
 1722|  34.3k|  a->subno = b->subno + 1;
 1723|       |
 1724|  34.3k|  if (DBG_IOBUF)
  ------------------
  |  |   98|  34.3k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 34.3k]
  |  |  ------------------
  ------------------
 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|  34.3k|  if (a->filter && (rc = a->filter (a->filter_ov, IOBUFCTRL_INIT, a->chain,
  ------------------
  |  Branch (1733:7): [True: 34.3k, False: 0]
  |  Branch (1733:20): [True: 0, False: 34.3k]
  ------------------
 1734|  34.3k|				    NULL, &dummy_len)))
 1735|      0|    log_error ("IOBUFCTRL_INIT failed: %s\n", gpg_strerror (rc));
 1736|  34.3k|  return rc;
 1737|  34.3k|}
iobuf_readbyte:
 2101|   930M|{
 2102|   930M|  int c;
 2103|       |
 2104|   930M|  if (a->use == IOBUF_OUTPUT || a->use == IOBUF_OUTPUT_TEMP)
  ------------------
  |  Branch (2104:7): [True: 0, False: 930M]
  |  Branch (2104:33): [True: 0, False: 930M]
  ------------------
 2105|      0|    {
 2106|      0|      log_bug ("iobuf_readbyte called on a non-INPUT pipeline!\n");
 2107|      0|      return -1;
 2108|      0|    }
 2109|       |
 2110|   930M|  assert (a->d.start <= a->d.len);
 2111|       |
 2112|   930M|  if (a->nlimit && a->nbytes >= a->nlimit)
  ------------------
  |  Branch (2112:7): [True: 0, False: 930M]
  |  Branch (2112:20): [True: 0, False: 0]
  ------------------
 2113|      0|    return -1;			/* forced EOF */
 2114|       |
 2115|   930M|  if (a->d.start < a->d.len)
  ------------------
  |  Branch (2115:7): [True: 11.5k, False: 930M]
  ------------------
 2116|  11.5k|    {
 2117|  11.5k|      c = a->d.buf[a->d.start++];
 2118|  11.5k|    }
 2119|   930M|  else if ((c = underflow (a, 1)) == -1)
  ------------------
  |  Branch (2119:12): [True: 930M, False: 50.7k]
  ------------------
 2120|   930M|    return -1;			/* EOF */
 2121|       |
 2122|  62.3k|  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|  62.3k|  a->nbytes++;
 2128|  62.3k|  return c;
 2129|  62.3k|}
iobuf_read:
 2134|   133k|{
 2135|   133k|  unsigned char *buf = (unsigned char *)buffer;
 2136|   133k|  int c, n;
 2137|       |
 2138|   133k|  if (a->use == IOBUF_OUTPUT || a->use == IOBUF_OUTPUT_TEMP)
  ------------------
  |  Branch (2138:7): [True: 0, False: 133k]
  |  Branch (2138:33): [True: 0, False: 133k]
  ------------------
 2139|      0|    {
 2140|      0|      log_bug ("iobuf_read called on a non-INPUT pipeline!\n");
 2141|      0|      return -1;
 2142|      0|    }
 2143|       |
 2144|   133k|  if (a->nlimit)
  ------------------
  |  Branch (2144:7): [True: 0, False: 133k]
  ------------------
 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|   133k|  a->e_d.buf = NULL;
 2166|   133k|  a->e_d.len = 0;
 2167|       |
 2168|       |  /* Hint for how full to fill iobuf internal drain buffer. */
 2169|   133k|  a->e_d.preferred = (a->use != IOBUF_INPUT_TEMP)
  ------------------
  |  Branch (2169:22): [True: 130k, False: 3.63k]
  ------------------
 2170|   133k|    && (buf && buflen >= IOBUF_ZEROCOPY_THRESHOLD_SIZE);
  ------------------
  |  |   71|   112k|#define IOBUF_ZEROCOPY_THRESHOLD_SIZE 1024
  ------------------
  |  Branch (2170:9): [True: 112k, False: 17.4k]
  |  Branch (2170:16): [True: 2.13k, False: 110k]
  ------------------
 2171|       |
 2172|   133k|  n = 0;
 2173|   133k|  do
 2174|   147k|    {
 2175|   147k|      if (n < buflen && a->d.start < a->d.len)
  ------------------
  |  Branch (2175:11): [True: 147k, False: 0]
  |  Branch (2175:25): [True: 131k, False: 16.1k]
  ------------------
 2176|       |	/* Drain the buffer.  */
 2177|   131k|	{
 2178|   131k|	  unsigned size = a->d.len - a->d.start;
 2179|   131k|	  if (size > buflen - n)
  ------------------
  |  Branch (2179:8): [True: 106k, False: 24.7k]
  ------------------
 2180|   106k|	    size = buflen - n;
 2181|   131k|	  if (buf)
  ------------------
  |  Branch (2181:8): [True: 116k, False: 15.7k]
  ------------------
 2182|   116k|	    memcpy (buf, a->d.buf + a->d.start, size);
 2183|   131k|	  n += size;
 2184|   131k|	  a->d.start += size;
 2185|   131k|	  if (buf)
  ------------------
  |  Branch (2185:8): [True: 116k, False: 15.7k]
  ------------------
 2186|   116k|	    buf += size;
 2187|   131k|	}
 2188|   147k|      if (n < buflen)
  ------------------
  |  Branch (2188:11): [True: 31.5k, False: 116k]
  ------------------
 2189|       |	/* Draining the internal buffer didn't fill BUFFER.  Call
 2190|       |	   underflow to read more data into the filter's internal
 2191|       |	   buffer.  */
 2192|  31.5k|	{
 2193|  31.5k|	  if (a->use != IOBUF_INPUT_TEMP && buf && n < buflen)
  ------------------
  |  Branch (2193:8): [True: 31.5k, False: 0]
  |  Branch (2193:38): [True: 6.20k, False: 25.3k]
  |  Branch (2193:45): [True: 6.20k, False: 0]
  ------------------
 2194|  6.20k|	    {
 2195|       |	      /* Setup external drain buffer for faster moving of data
 2196|       |	       * (avoid memcpy). */
 2197|  6.20k|	      a->e_d.buf = buf;
 2198|  6.20k|	      a->e_d.len = (buflen - n) / IOBUF_ZEROCOPY_THRESHOLD_SIZE
  ------------------
  |  |   71|  6.20k|#define IOBUF_ZEROCOPY_THRESHOLD_SIZE 1024
  ------------------
 2199|  6.20k|			    * IOBUF_ZEROCOPY_THRESHOLD_SIZE;
  ------------------
  |  |   71|  6.20k|#define IOBUF_ZEROCOPY_THRESHOLD_SIZE 1024
  ------------------
 2200|  6.20k|	      if (a->e_d.len == 0)
  ------------------
  |  Branch (2200:12): [True: 2.54k, False: 3.66k]
  ------------------
 2201|  2.54k|		a->e_d.buf = NULL;
 2202|  6.20k|	      if (a->e_d.buf && DBG_IOBUF)
  ------------------
  |  |   98|  3.66k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 3.66k]
  |  |  ------------------
  ------------------
  |  Branch (2202:12): [True: 3.66k, False: 2.54k]
  ------------------
 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|  6.20k|	    }
 2206|       |
 2207|  31.5k|	  if ((c = underflow (a, 1)) == -1)
  ------------------
  |  Branch (2207:8): [True: 17.5k, False: 13.9k]
  ------------------
 2208|       |	    /* EOF.  If we managed to read something, don't return EOF
 2209|       |	       now.  */
 2210|  17.5k|	    {
 2211|  17.5k|	      a->e_d.buf = NULL;
 2212|  17.5k|	      a->e_d.len = 0;
 2213|  17.5k|	      a->nbytes += n;
 2214|  17.5k|	      return n ? n : -1 /*EOF*/;
  ------------------
  |  Branch (2214:15): [True: 8.81k, False: 8.74k]
  ------------------
 2215|  17.5k|	    }
 2216|       |
 2217|  13.9k|	  if (a->e_d.buf && a->e_d.used > 0)
  ------------------
  |  Branch (2217:8): [True: 2.01k, False: 11.9k]
  |  Branch (2217:22): [True: 2.01k, False: 0]
  ------------------
 2218|  2.01k|	    {
 2219|       |	      /* Drain buffer was used, 'c' only contains return code
 2220|       |	       * 0 or -1. */
 2221|  2.01k|	      n += a->e_d.used;
 2222|  2.01k|	      buf += a->e_d.used;
 2223|  2.01k|	    }
 2224|  11.9k|	  else
 2225|  11.9k|	    {
 2226|  11.9k|	      if (buf)
  ------------------
  |  Branch (2226:12): [True: 1.64k, False: 10.3k]
  ------------------
 2227|  1.64k|		*buf++ = c;
 2228|  11.9k|	      n++;
 2229|  11.9k|	    }
 2230|       |
 2231|  13.9k|	  a->e_d.buf = NULL;
 2232|  13.9k|	  a->e_d.len = 0;
 2233|  13.9k|	}
 2234|   147k|    }
 2235|   133k|  while (n < buflen);
  ------------------
  |  Branch (2235:10): [True: 13.9k, False: 116k]
  ------------------
 2236|   116k|  a->nbytes += n;
 2237|   116k|  return n;
 2238|   133k|}
iobuf_peek:
 2244|  17.0k|{
 2245|  17.0k|  int n = 0;
 2246|       |
 2247|  17.0k|  assert (buflen > 0);
 2248|  17.0k|  assert (a->use == IOBUF_INPUT || a->use == IOBUF_INPUT_TEMP);
 2249|       |
 2250|  17.0k|  if (buflen > a->d.size)
  ------------------
  |  Branch (2250:7): [True: 0, False: 17.0k]
  ------------------
 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|  34.1k|  while (buflen > a->d.len - a->d.start)
  ------------------
  |  Branch (2256:10): [True: 17.1k, False: 17.0k]
  ------------------
 2257|  17.1k|    {
 2258|  17.1k|      if (underflow_target (a, 0, buflen) == -1)
  ------------------
  |  Branch (2258:11): [True: 34, False: 17.0k]
  ------------------
 2259|       |	/* EOF.  We can't read any more.  */
 2260|     34|	break;
 2261|       |
 2262|       |      /* Underflow consumes the first character (it's the return
 2263|       |	 value).  unget() it by resetting the "file position".  */
 2264|  17.0k|      assert (a->d.start == 1);
 2265|  17.0k|      a->d.start = 0;
 2266|  17.0k|    }
 2267|       |
 2268|  17.0k|  n = a->d.len - a->d.start;
 2269|  17.0k|  if (n > buflen)
  ------------------
  |  Branch (2269:7): [True: 16.7k, False: 324]
  ------------------
 2270|  16.7k|    n = buflen;
 2271|       |
 2272|  17.0k|  if (n == 0)
  ------------------
  |  Branch (2272:7): [True: 0, False: 17.0k]
  ------------------
 2273|       |    /* EOF.  */
 2274|      0|    return -1;
 2275|       |
 2276|  17.0k|  memcpy (buf, &a->d.buf[a->d.start], n);
 2277|       |
 2278|  17.0k|  return n;
 2279|  17.0k|}
iobuf_get_fd:
 2580|  17.0k|{
 2581|  17.0k|  for (; a->chain; a = a->chain)
  ------------------
  |  Branch (2581:10): [True: 0, False: 17.0k]
  ------------------
 2582|      0|    ;
 2583|       |
 2584|  17.0k|  if (a->filter != file_filter)
  ------------------
  |  Branch (2584:7): [True: 0, False: 17.0k]
  ------------------
 2585|      0|    return -1;
 2586|       |
 2587|  17.0k|  {
 2588|  17.0k|    file_filter_ctx_t *b = a->filter_ov;
 2589|  17.0k|    gnupg_fd_t fp = b->fp;
 2590|       |
 2591|  17.0k|    return FD2INT (fp);
  ------------------
  |  |   46|  17.0k|#define FD2INT(h) (h)
  ------------------
 2592|  17.0k|  }
 2593|  17.0k|}
iobuf_get_real_fname:
 2694|  55.8k|{
 2695|  55.8k|  if (a->real_fname)
  ------------------
  |  Branch (2695:7): [True: 55.8k, False: 0]
  ------------------
 2696|  55.8k|    return a->real_fname;
 2697|       |
 2698|       |  /* the old solution */
 2699|      0|  for (; a; a = a->chain)
  ------------------
  |  Branch (2699:10): [True: 0, False: 0]
  ------------------
 2700|      0|    if (!a->chain && a->filter == file_filter)
  ------------------
  |  Branch (2700:9): [True: 0, False: 0]
  |  Branch (2700:22): [True: 0, False: 0]
  ------------------
 2701|      0|      {
 2702|      0|	file_filter_ctx_t *b = a->filter_ov;
 2703|      0|	return b->print_only_name ? NULL : b->fname;
  ------------------
  |  Branch (2703:9): [True: 0, False: 0]
  ------------------
 2704|      0|      }
 2705|       |
 2706|      0|  return NULL;
 2707|      0|}
iobuf_set_partial_body_length_mode:
 2745|  30.9k|{
 2746|  30.9k|  if (!len)
  ------------------
  |  Branch (2746:7): [True: 0, False: 30.9k]
  ------------------
 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|  30.9k|  else
 2757|       |    /* Enabled partial body length mode.  */
 2758|  30.9k|    {
 2759|  30.9k|      block_filter_ctx_t *ctx = xcalloc (1, sizeof *ctx);
  ------------------
  |  |  109|  30.9k|#define xcalloc(a,b)     gcry_xcalloc ((a),(b))
  ------------------
 2760|  30.9k|      ctx->use = a->use;
 2761|  30.9k|      ctx->partial = 1;
 2762|  30.9k|      ctx->size = 0;
 2763|  30.9k|      ctx->first_c = len;
 2764|  30.9k|      iobuf_push_filter (a, block_filter, ctx);
 2765|  30.9k|    }
 2766|  30.9k|}
iobuf_read_line:
 2773|   543k|{
 2774|   543k|  int c;
 2775|   543k|  char *buffer = (char *)*addr_of_buffer;
 2776|   543k|  unsigned length = *length_of_buffer;
 2777|   543k|  unsigned nbytes = 0;
 2778|   543k|  unsigned maxlen = *max_length;
 2779|   543k|  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|   543k|  assert (!buffer || length >= 2 || maxlen >= 2);
 2786|       |
 2787|   543k|  if (!buffer || length <= 1)
  ------------------
  |  Branch (2787:7): [True: 3.44k, False: 540k]
  |  Branch (2787:18): [True: 0, False: 540k]
  ------------------
 2788|       |    /* must allocate a new buffer */
 2789|  3.44k|    {
 2790|  3.44k|      length = 256 <= maxlen ? 256 : maxlen;
  ------------------
  |  Branch (2790:16): [True: 3.44k, False: 0]
  ------------------
 2791|  3.44k|      buffer = xrealloc (buffer, length);
  ------------------
  |  |  111|  3.44k|#define xrealloc(a,b)    gcry_xrealloc ((a),(b))
  ------------------
 2792|  3.44k|      *addr_of_buffer = (unsigned char *)buffer;
 2793|  3.44k|      *length_of_buffer = length;
 2794|  3.44k|    }
 2795|       |
 2796|   543k|  p = buffer;
 2797|   550k|  while (1)
  ------------------
  |  Branch (2797:10): [Folded - Ignored]
  ------------------
 2798|   550k|    {
 2799|   550k|      if (!a->nofast && a->d.start < a->d.len && nbytes < length - 1)
  ------------------
  |  Branch (2799:11): [True: 550k, False: 0]
  |  Branch (2799:25): [True: 543k, False: 6.52k]
  |  Branch (2799:50): [True: 543k, False: 0]
  ------------------
 2800|       |	/* Fast path for finding '\n' by using standard C library's optimized
 2801|       |	   memchr.  */
 2802|   543k|	{
 2803|   543k|	  unsigned size = a->d.len - a->d.start;
 2804|   543k|	  byte *newline_pos;
 2805|       |
 2806|   543k|	  if (size > length - 1 - nbytes)
  ------------------
  |  Branch (2806:8): [True: 502k, False: 41.8k]
  ------------------
 2807|   502k|	    size = length - 1 - nbytes;
 2808|       |
 2809|   543k|	  newline_pos = memchr (a->d.buf + a->d.start, '\n', size);
 2810|   543k|	  if (newline_pos)
  ------------------
  |  Branch (2810:8): [True: 537k, False: 6.86k]
  ------------------
 2811|   537k|	    {
 2812|       |	      /* Found newline, copy buffer and return. */
 2813|   537k|	      size = (newline_pos - (a->d.buf + a->d.start)) + 1;
 2814|   537k|	      memcpy (p, a->d.buf + a->d.start, size);
 2815|   537k|	      p += size;
 2816|   537k|	      nbytes += size;
 2817|   537k|	      a->d.start += size;
 2818|   537k|	      a->nbytes += size;
 2819|   537k|	      break;
 2820|   537k|	    }
 2821|  6.86k|	  else
 2822|  6.86k|	    {
 2823|       |	      /* No newline, copy buffer and continue. */
 2824|  6.86k|	      memcpy (p, a->d.buf + a->d.start, size);
 2825|  6.86k|	      p += size;
 2826|  6.86k|	      nbytes += size;
 2827|  6.86k|	      a->d.start += size;
 2828|  6.86k|	      a->nbytes += size;
 2829|  6.86k|	    }
 2830|   543k|	}
 2831|  6.52k|      else
 2832|  6.52k|	{
 2833|  6.52k|	  c = iobuf_readbyte (a);
 2834|  6.52k|	  if (c == -1)
  ------------------
  |  Branch (2834:8): [True: 6.52k, False: 0]
  ------------------
 2835|  6.52k|	    break;
 2836|      0|	  *p++ = c;
 2837|      0|	  nbytes++;
 2838|      0|	  if (c == '\n')
  ------------------
  |  Branch (2838:8): [True: 0, False: 0]
  ------------------
 2839|      0|	    break;
 2840|      0|	}
 2841|       |
 2842|  6.86k|      if (nbytes == length - 1)
  ------------------
  |  Branch (2842:11): [True: 4.35k, False: 2.50k]
  ------------------
 2843|       |	/* We don't have enough space to add a \n and a \0.  Increase
 2844|       |	   the buffer size.  */
 2845|  4.35k|	{
 2846|  4.35k|	  if (length == maxlen)
  ------------------
  |  Branch (2846:8): [True: 60, False: 4.29k]
  ------------------
 2847|       |	    /* We reached the buffer's size limit!  */
 2848|     60|	    {
 2849|       |	      /* Skip the rest of the line.  */
 2850|   299k|	      while ((c = iobuf_get (a)) != -1 && c != '\n')
  ------------------
  |  |  500|   299k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 299k]
  |  |  |  Branch (500:24): [True: 34, False: 299k]
  |  |  ------------------
  |  |  501|   299k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (2850:15): [True: 299k, False: 34]
  |  Branch (2850:44): [True: 299k, False: 26]
  ------------------
 2851|   299k|		;
 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|     60|	      assert (p > buffer);
 2857|     60|	      p[-1] = '\n';
 2858|       |
 2859|       |	      /* Indicate truncation.  */
 2860|     60|	      *max_length = 0;
 2861|     60|	      break;
 2862|     60|	    }
 2863|       |
 2864|  4.29k|	  length += length < 1024 ? 256 : 1024;
  ------------------
  |  Branch (2864:14): [True: 1.55k, False: 2.74k]
  ------------------
 2865|  4.29k|	  if (length > maxlen)
  ------------------
  |  Branch (2865:8): [True: 57, False: 4.24k]
  ------------------
 2866|     57|	    length = maxlen;
 2867|       |
 2868|  4.29k|	  buffer = xrealloc (buffer, length);
  ------------------
  |  |  111|  4.29k|#define xrealloc(a,b)    gcry_xrealloc ((a),(b))
  ------------------
 2869|  4.29k|	  *addr_of_buffer = (unsigned char *)buffer;
 2870|  4.29k|	  *length_of_buffer = length;
 2871|  4.29k|	  p = buffer + nbytes;
 2872|  4.29k|	}
 2873|  6.86k|    }
 2874|       |  /* Add the terminating NUL.  */
 2875|   543k|  *p = 0;
 2876|       |
 2877|       |  /* Return the number of characters written to the buffer including
 2878|       |     the newline, but not including the terminating NUL.  */
 2879|   543k|  return nbytes;
 2880|   543k|}
iobuf_skip_rest:
 2915|   289k|{
 2916|   289k|  if ( partial )
  ------------------
  |  Branch (2916:8): [True: 0, False: 289k]
  ------------------
 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|   289k|  else
 2936|   289k|    {
 2937|   289k|      unsigned long remaining = n;
 2938|   364k|      while (remaining > 0)
  ------------------
  |  Branch (2938:14): [True: 82.9k, False: 281k]
  ------------------
 2939|  82.9k|        {
 2940|  82.9k|          if (a->nofast || a->d.start >= a->d.len)
  ------------------
  |  Branch (2940:15): [True: 0, False: 82.9k]
  |  Branch (2940:28): [True: 9.93k, False: 72.9k]
  ------------------
 2941|  9.93k|            {
 2942|  9.93k|              if (iobuf_readbyte (a) == -1)
  ------------------
  |  Branch (2942:19): [True: 7.47k, False: 2.46k]
  ------------------
 2943|  7.47k|                {
 2944|  7.47k|                  break;
 2945|  7.47k|		}
 2946|  2.46k|              --remaining;
 2947|  2.46k|	    }
 2948|  72.9k|          else
 2949|  72.9k|            {
 2950|  72.9k|              unsigned long count = a->d.len - a->d.start;
 2951|  72.9k|              if (count > remaining)
  ------------------
  |  Branch (2951:19): [True: 66.6k, False: 6.32k]
  ------------------
 2952|  66.6k|                {
 2953|  66.6k|                  count = remaining;
 2954|  66.6k|		}
 2955|  72.9k|              a->nbytes += count;
 2956|  72.9k|              a->d.start += count;
 2957|  72.9k|              remaining -= count;
 2958|  72.9k|	    }
 2959|  82.9k|	}
 2960|   289k|    }
 2961|   289k|}
iobuf.c:print_chain:
 1160|  32.1k|{
 1161|  32.1k|  if (!DBG_IOBUF)
  ------------------
  |  |   98|  32.1k|#define DBG_IOBUF   iobuf_debug_mode
  ------------------
  |  Branch (1161:7): [True: 32.1k, False: 0]
  ------------------
 1162|  32.1k|    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|  17.0k|{
 1330|  17.0k|  iobuf_t a;
 1331|  17.0k|  gnupg_fd_t fp;
 1332|  17.0k|  file_filter_ctx_t *fcx;
 1333|  17.0k|  size_t len = 0;
 1334|  17.0k|  int print_only = 0;
 1335|  17.0k|  int fd;
 1336|  17.0k|  byte desc[MAX_IOBUF_DESC];
 1337|       |
 1338|  17.0k|  assert (use == IOBUF_INPUT || use == IOBUF_OUTPUT);
 1339|       |
 1340|  17.0k|  if (special_filenames
  ------------------
  |  Branch (1340:7): [True: 17.0k, False: 0]
  ------------------
 1341|       |      /* NULL or '-'.  */
 1342|  17.0k|      && (!fname || (*fname == '-' && !fname[1])))
  ------------------
  |  Branch (1342:11): [True: 0, False: 17.0k]
  |  Branch (1342:22): [True: 0, False: 17.0k]
  |  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|  17.0k|  else if (!fname)
  ------------------
  |  Branch (1356:12): [True: 0, False: 17.0k]
  ------------------
 1357|      0|    return NULL;
 1358|  17.0k|  else if (special_filenames
  ------------------
  |  Branch (1358:12): [True: 17.0k, False: 0]
  ------------------
 1359|  17.0k|           && (fd = check_special_filename (fname, 0, 1)) != -1)
  ------------------
  |  Branch (1359:15): [True: 0, False: 17.0k]
  ------------------
 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|  17.0k|  else
 1363|  17.0k|    {
 1364|  17.0k|      if (use == IOBUF_INPUT)
  ------------------
  |  Branch (1364:11): [True: 17.0k, False: 1]
  ------------------
 1365|  17.0k|	fp = fd_cache_open (fname, opentype);
 1366|      1|      else
 1367|      1|	fp = direct_open (fname, opentype, mode700);
 1368|  17.0k|      if (fp == GNUPG_INVALID_FD)
  ------------------
  |  |   44|  17.0k|#define GNUPG_INVALID_FD (-1)
  ------------------
  |  Branch (1368:11): [True: 0, False: 17.0k]
  ------------------
 1369|      0|	return NULL;
 1370|  17.0k|    }
 1371|       |
 1372|  17.0k|  a = iobuf_alloc (use, iobuf_buffer_size);
 1373|  17.0k|  fcx = xmalloc (sizeof *fcx + strlen (fname));
  ------------------
  |  |  107|  17.0k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 1374|  17.0k|  fcx->fp = fp;
 1375|  17.0k|  fcx->print_only_name = print_only;
 1376|  17.0k|  strcpy (fcx->fname, fname);
 1377|  17.0k|  if (!print_only)
  ------------------
  |  Branch (1377:7): [True: 17.0k, False: 0]
  ------------------
 1378|  17.0k|    a->real_fname = xstrdup (fname);
  ------------------
  |  |  112|  17.0k|#define xstrdup(a)       gcry_xstrdup ((a))
  ------------------
 1379|  17.0k|  a->filter = file_filter;
 1380|  17.0k|  a->filter_ov = fcx;
 1381|  17.0k|  file_filter (fcx, IOBUFCTRL_INIT, NULL, NULL, &len);
 1382|  17.0k|  if (DBG_IOBUF)
  ------------------
  |  |   98|  17.0k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 17.0k]
  |  |  ------------------
  ------------------
 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|  17.0k|  return a;
 1387|  17.0k|}
iobuf.c:fd_cache_open:
  411|  17.0k|{
  412|  17.0k|  close_cache_t cc;
  413|       |
  414|  17.0k|  assert (fname);
  415|  34.1k|  for (cc = close_cache; cc; cc = cc->next)
  ------------------
  |  Branch (415:26): [True: 25.5k, False: 8.53k]
  ------------------
  416|  25.5k|    {
  417|  25.5k|      if (cc->fp != GNUPG_INVALID_FD && !fd_cache_strcmp (cc->fname, fname))
  ------------------
  |  |   44|  51.1k|#define GNUPG_INVALID_FD (-1)
  ------------------
  |  Branch (417:11): [True: 8.52k, False: 17.0k]
  |  Branch (417:41): [True: 8.52k, False: 0]
  ------------------
  418|  8.52k|	{
  419|  8.52k|	  gnupg_fd_t fp = cc->fp;
  420|  8.52k|	  cc->fp = GNUPG_INVALID_FD;
  ------------------
  |  |   44|  8.52k|#define GNUPG_INVALID_FD (-1)
  ------------------
  421|  8.52k|	  if (DBG_IOBUF)
  ------------------
  |  |   98|  8.52k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 8.52k]
  |  |  ------------------
  ------------------
  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|  8.52k|	  if (lseek (fp, 0, SEEK_SET) == (off_t) - 1)
  ------------------
  |  Branch (431:8): [True: 0, False: 8.52k]
  ------------------
  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|  8.52k|#endif
  437|  8.52k|	  return fp;
  438|  8.52k|	}
  439|  25.5k|    }
  440|  8.53k|  if (DBG_IOBUF)
  ------------------
  |  |   98|  8.53k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 8.53k]
  |  |  ------------------
  ------------------
  441|      0|    log_debug ("fd_cache_open (%s) not cached\n", fname);
  442|  8.53k|  return direct_open (fname, mode, 0);
  443|  17.0k|}
iobuf.c:fd_cache_strcmp:
  186|  17.0k|{
  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|  17.0k|  return strcmp (a, b);
  197|  17.0k|#endif
  198|  17.0k|}
iobuf.c:direct_open:
  267|  8.53k|{
  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|  8.53k|  int oflag;
  322|  8.53k|  int cflag = S_IRUSR | S_IWUSR;
  323|       |
  324|  8.53k|  if (!mode700)
  ------------------
  |  Branch (324:7): [True: 8.53k, False: 0]
  ------------------
  325|  8.53k|    cflag |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
  326|       |
  327|       |  /* Note, that we do not handle all mode combinations */
  328|  8.53k|  if (strchr (mode, '+'))
  ------------------
  |  Branch (328:7): [True: 0, False: 8.53k]
  ------------------
  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|  8.53k|  else if (strchr (mode, 'w'))
  ------------------
  |  Branch (334:12): [True: 1, False: 8.53k]
  ------------------
  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|  8.53k|  else
  341|  8.53k|    {
  342|  8.53k|      oflag = O_RDONLY;
  343|  8.53k|    }
  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|  8.53k|  return open (fname, oflag, cflag);
  359|       |
  360|  8.53k|#endif /*!HAVE_W32_SYSTEM*/
  361|  8.53k|}
iobuf.c:file_filter:
  449|  63.6k|{
  450|  63.6k|  file_filter_ctx_t *a = opaque;
  451|  63.6k|  gnupg_fd_t f = a->fp;
  452|  63.6k|  size_t size = *ret_len;
  453|  63.6k|  size_t nbytes = 0;
  454|  63.6k|  int rc = 0;
  455|       |
  456|  63.6k|  (void)chain; /* Not used.  */
  457|       |
  458|  63.6k|  if (control == IOBUFCTRL_UNDERFLOW)
  ------------------
  |  Branch (458:7): [True: 29.4k, False: 34.1k]
  ------------------
  459|  29.4k|    {
  460|  29.4k|      log_assert (size); /* We need a buffer.  */
  461|  29.4k|      if (a->eof_seen)
  ------------------
  |  Branch (461:11): [True: 0, False: 29.4k]
  ------------------
  462|      0|	{
  463|      0|	  rc = -1;
  464|      0|	  *ret_len = 0;
  465|      0|	}
  466|  29.4k|      else if (a->delayed_rc)
  ------------------
  |  Branch (466:16): [True: 12.3k, False: 17.0k]
  ------------------
  467|  12.3k|        {
  468|  12.3k|          rc = a->delayed_rc;
  469|  12.3k|          a->delayed_rc = 0;
  470|  12.3k|          if (rc == -1)
  ------------------
  |  Branch (470:15): [True: 12.3k, False: 0]
  ------------------
  471|  12.3k|            a->eof_seen = -1;
  472|  12.3k|	  *ret_len = 0;
  473|  12.3k|        }
  474|  17.0k|      else
  475|  17.0k|	{
  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|  17.0k|	  int n;
  502|       |
  503|  17.0k|	  nbytes = 0;
  504|  34.1k|        read_more:
  505|  34.1k|          do
  506|  34.1k|            {
  507|  34.1k|              n = read (f, buf + nbytes, size - nbytes);
  508|  34.1k|            }
  509|  34.1k|          while (n == -1 && errno == EINTR);
  ------------------
  |  Branch (509:18): [True: 0, False: 34.1k]
  |  Branch (509:29): [True: 0, False: 0]
  ------------------
  510|  34.1k|          if (n > 0)
  ------------------
  |  Branch (510:15): [True: 17.0k, False: 17.0k]
  ------------------
  511|  17.0k|            {
  512|  17.0k|              nbytes += n;
  513|  17.0k|              if (nbytes < size)
  ------------------
  |  Branch (513:19): [True: 17.0k, False: 56]
  ------------------
  514|  17.0k|                goto read_more;
  515|  17.0k|            }
  516|  17.0k|          else if (!n) /* eof */
  ------------------
  |  Branch (516:20): [True: 17.0k, False: 0]
  ------------------
  517|  17.0k|            {
  518|  17.0k|              if (nbytes)
  ------------------
  |  Branch (518:19): [True: 17.0k, False: 38]
  ------------------
  519|  17.0k|                a->delayed_rc = -1;
  520|     38|              else
  521|     38|                {
  522|     38|                  a->eof_seen = 1;
  523|     38|                  rc = -1;
  524|     38|                }
  525|  17.0k|            }
  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|  17.0k|#endif
  538|  17.0k|	  *ret_len = nbytes;
  539|  17.0k|	}
  540|  29.4k|    }
  541|  34.1k|  else if (control == IOBUFCTRL_FLUSH)
  ------------------
  |  Branch (541:12): [True: 1, False: 34.1k]
  ------------------
  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|  34.1k|  else if (control == IOBUFCTRL_INIT)
  ------------------
  |  Branch (593:12): [True: 17.0k, False: 17.0k]
  ------------------
  594|  17.0k|    {
  595|  17.0k|      a->eof_seen = 0;
  596|  17.0k|      a->delayed_rc = 0;
  597|  17.0k|      a->keep_open = 0;
  598|  17.0k|      a->no_cache = 0;
  599|  17.0k|    }
  600|  17.0k|  else if (control == IOBUFCTRL_DESC)
  ------------------
  |  Branch (600:12): [True: 0, False: 17.0k]
  ------------------
  601|      0|    {
  602|      0|      mem2str (buf, "file_filter(fd)", *ret_len);
  603|      0|    }
  604|  17.0k|  else if (control == IOBUFCTRL_FREE)
  ------------------
  |  Branch (604:12): [True: 17.0k, False: 0]
  ------------------
  605|  17.0k|    {
  606|  17.0k|      if (f != FD_FOR_STDIN && f != FD_FOR_STDOUT)
  ------------------
  |  |   84|  34.1k|# define FD_FOR_STDIN  (0)
  ------------------
                    if (f != FD_FOR_STDIN && f != FD_FOR_STDOUT)
  ------------------
  |  |   85|  17.0k|# define FD_FOR_STDOUT (1)
  ------------------
  |  Branch (606:11): [True: 17.0k, False: 0]
  |  Branch (606:32): [True: 17.0k, False: 0]
  ------------------
  607|  17.0k|	{
  608|  17.0k|	  if (DBG_IOBUF)
  ------------------
  |  |   98|  17.0k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 17.0k]
  |  |  ------------------
  ------------------
  609|      0|	    log_debug ("%s: close fd/handle %d\n", a->fname, FD2INT (f));
  ------------------
  |  |   46|      0|#define FD2INT(h) (h)
  ------------------
  610|  17.0k|	  if (!a->keep_open)
  ------------------
  |  Branch (610:8): [True: 17.0k, False: 0]
  ------------------
  611|  17.0k|	    fd_cache_close (a->no_cache ? NULL : a->fname, f);
  ------------------
  |  Branch (611:22): [True: 8.53k, False: 8.53k]
  ------------------
  612|  17.0k|	}
  613|  17.0k|      xfree (a); /* We can free our context now. */
  ------------------
  |  |  104|  17.0k|#define xfree(a)         gcry_free ((a))
  ------------------
  614|  17.0k|    }
  615|       |
  616|  63.6k|  return rc;
  617|  63.6k|}
iobuf.c:fd_cache_close:
  370|  17.0k|{
  371|  17.0k|  close_cache_t cc;
  372|       |
  373|  17.0k|  assert (fp);
  374|  17.0k|  if (!fname || !*fname)
  ------------------
  |  Branch (374:7): [True: 8.53k, False: 8.53k]
  |  Branch (374:17): [True: 0, False: 8.53k]
  ------------------
  375|  8.53k|    {
  376|       |#ifdef HAVE_W32_SYSTEM
  377|       |      CloseHandle (fp);
  378|       |#else
  379|  8.53k|      close (fp);
  380|  8.53k|#endif
  381|  8.53k|      if (DBG_IOBUF)
  ------------------
  |  |   98|  8.53k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 8.53k]
  |  |  ------------------
  ------------------
  382|      0|	log_debug ("fd_cache_close (%d) real\n", (int)fp);
  383|  8.53k|      return;
  384|  8.53k|    }
  385|       |  /* try to reuse a slot */
  386|  8.53k|  for (cc = close_cache; cc; cc = cc->next)
  ------------------
  |  Branch (386:26): [True: 8.53k, False: 2]
  ------------------
  387|  8.53k|    {
  388|  8.53k|      if (cc->fp == GNUPG_INVALID_FD && !fd_cache_strcmp (cc->fname, fname))
  ------------------
  |  |   44|  17.0k|#define GNUPG_INVALID_FD (-1)
  ------------------
  |  Branch (388:11): [True: 8.53k, False: 0]
  |  Branch (388:41): [True: 8.52k, False: 1]
  ------------------
  389|  8.52k|	{
  390|  8.52k|	  cc->fp = fp;
  391|  8.52k|	  if (DBG_IOBUF)
  ------------------
  |  |   98|  8.52k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 8.52k]
  |  |  ------------------
  ------------------
  392|      0|	    log_debug ("fd_cache_close (%s) used existing slot\n", fname);
  393|  8.52k|	  return;
  394|  8.52k|	}
  395|  8.53k|    }
  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|   930M|{
 1834|   930M|  return underflow_target (a, clear_pending_eof, 1);
 1835|   930M|}
iobuf.c:underflow_target:
 1844|   930M|{
 1845|   930M|  size_t len;
 1846|   930M|  int rc;
 1847|       |
 1848|   930M|  if (DBG_IOBUF)
  ------------------
  |  |   98|   930M|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 930M]
  |  |  ------------------
  ------------------
 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|   930M|  if (a->use == IOBUF_INPUT_TEMP)
  ------------------
  |  Branch (1854:7): [True: 0, False: 930M]
  ------------------
 1855|       |    /* By definition, there isn't more data to read into the
 1856|       |       buffer.  */
 1857|      0|    return -1;
 1858|       |
 1859|   930M|  assert (a->use == IOBUF_INPUT);
 1860|       |
 1861|   930M|  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|   930M|  assert (a->d.start <= a->d.len);
 1867|   930M|  a->d.len -= a->d.start;
 1868|   930M|  if (a->d.len)
  ------------------
  |  Branch (1868:7): [True: 68, False: 930M]
  ------------------
 1869|     68|    memmove (a->d.buf, &a->d.buf[a->d.start], a->d.len);
 1870|   930M|  a->d.start = 0;
 1871|       |
 1872|   930M|  if (a->d.len < target && a->filter_eof)
  ------------------
  |  Branch (1872:7): [True: 930M, False: 0]
  |  Branch (1872:28): [True: 10.2k, False: 930M]
  ------------------
 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|  10.2k|    {
 1878|  10.2k|      if (DBG_IOBUF)
  ------------------
  |  |   98|  10.2k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 10.2k]
  |  |  ------------------
  ------------------
 1879|      0|	log_debug ("iobuf-%d.%d: underflow: eof (pending eof)\n",
 1880|      0|		   a->no, a->subno);
 1881|  10.2k|      if (! clear_pending_eof)
  ------------------
  |  Branch (1881:11): [True: 34, False: 10.2k]
  ------------------
 1882|     34|	return -1;
 1883|       |
 1884|  10.2k|      if (a->chain)
  ------------------
  |  Branch (1884:11): [True: 275, False: 9.93k]
  ------------------
 1885|       |	/* A filter follows this one.  Free this filter.  */
 1886|    275|	{
 1887|    275|	  iobuf_t b = a->chain;
 1888|    275|	  if (DBG_IOBUF)
  ------------------
  |  |   98|    275|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 275]
  |  |  ------------------
  ------------------
 1889|      0|	    log_debug ("iobuf-%d.%d: filter popped (pending EOF returned)\n",
 1890|      0|		       a->no, a->subno);
 1891|    275|	  xfree (a->d.buf);
  ------------------
  |  |  104|    275|#define xfree(a)         gcry_free ((a))
  ------------------
 1892|    275|	  xfree (a->real_fname);
  ------------------
  |  |  104|    275|#define xfree(a)         gcry_free ((a))
  ------------------
 1893|    275|	  memcpy (a, b, sizeof *a);
 1894|    275|	  xfree (b);
  ------------------
  |  |  104|    275|#define xfree(a)         gcry_free ((a))
  ------------------
 1895|    275|	  print_chain (a);
 1896|    275|	}
 1897|  9.93k|      else
 1898|  9.93k|	a->filter_eof = 0;	/* for the top level filter */
 1899|  10.2k|      return -1;		/* return one(!) EOF */
 1900|  10.2k|    }
 1901|       |
 1902|   930M|  if (a->d.len == 0 && a->error)
  ------------------
  |  Branch (1902:7): [True: 930M, False: 34]
  |  Branch (1902:24): [True: 4.79k, False: 930M]
  ------------------
 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|  4.79k|    {
 1908|  4.79k|      if (DBG_IOBUF)
  ------------------
  |  |   98|  4.79k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 4.79k]
  |  |  ------------------
  ------------------
 1909|      0|	log_debug ("iobuf-%d.%d: pending error (%s) returned\n",
 1910|      0|		   a->no, a->subno, gpg_strerror (a->error));
 1911|  4.79k|      return -1;
 1912|  4.79k|    }
 1913|       |
 1914|   930M|  if (a->filter && ! a->filter_eof && ! a->error)
  ------------------
  |  Branch (1914:7): [True: 134k, False: 929M]
  |  Branch (1914:20): [True: 134k, False: 0]
  |  Branch (1914:39): [True: 134k, 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|   134k|    {
 1918|       |      /* Be careful to account for any buffered data.  */
 1919|   134k|      len = a->d.size - a->d.len;
 1920|       |
 1921|   134k|      if (a->e_d.preferred && a->d.len < IOBUF_ZEROCOPY_THRESHOLD_SIZE
  ------------------
  |  |   71|   138k|#define IOBUF_ZEROCOPY_THRESHOLD_SIZE 1024
  ------------------
  |  Branch (1921:11): [True: 4.50k, False: 129k]
  |  Branch (1921:31): [True: 4.50k, False: 0]
  ------------------
 1922|   134k|	  && (IOBUF_ZEROCOPY_THRESHOLD_SIZE - a->d.len) < len)
  ------------------
  |  |   71|  4.50k|#define IOBUF_ZEROCOPY_THRESHOLD_SIZE 1024
  ------------------
  |  Branch (1922:7): [True: 4.50k, False: 0]
  ------------------
 1923|  4.50k|	{
 1924|  4.50k|	  if (DBG_IOBUF)
  ------------------
  |  |   98|  4.50k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 4.50k]
  |  |  ------------------
  ------------------
 1925|      0|	    log_debug ("iobuf-%d.%d: limit buffering as external drain is "
 1926|      0|			"preferred\n",  a->no, a->subno);
 1927|  4.50k|	  len = IOBUF_ZEROCOPY_THRESHOLD_SIZE - a->d.len;
  ------------------
  |  |   71|  4.50k|#define IOBUF_ZEROCOPY_THRESHOLD_SIZE 1024
  ------------------
 1928|  4.50k|	}
 1929|       |
 1930|   134k|      if (len == 0)
  ------------------
  |  Branch (1930:11): [True: 0, False: 134k]
  ------------------
 1931|       |	/* There is no space for more data.  Don't bother calling
 1932|       |	   A->FILTER.  */
 1933|      0|	rc = 0;
 1934|   134k|      else
 1935|   134k|      {
 1936|       |	/* If no buffered data and drain buffer has been setup, and drain
 1937|       |	 * buffer is largish, read data directly to drain buffer. */
 1938|   134k|	if (a->d.len == 0
  ------------------
  |  Branch (1938:6): [True: 134k, False: 34]
  ------------------
 1939|   134k|	    && a->e_d.buf
  ------------------
  |  Branch (1939:9): [True: 3.19k, False: 130k]
  ------------------
 1940|   134k|	    && a->e_d.len >= IOBUF_ZEROCOPY_THRESHOLD_SIZE)
  ------------------
  |  |   71|  3.19k|#define IOBUF_ZEROCOPY_THRESHOLD_SIZE 1024
  ------------------
  |  Branch (1940:9): [True: 3.19k, False: 0]
  ------------------
 1941|  3.19k|	  {
 1942|  3.19k|	    len = a->e_d.len;
 1943|       |
 1944|  3.19k|	    if (DBG_IOBUF)
  ------------------
  |  |   98|  3.19k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 3.19k]
  |  |  ------------------
  ------------------
 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|  3.19k|	    rc = a->filter (a->filter_ov, IOBUFCTRL_UNDERFLOW, a->chain,
 1949|  3.19k|			    a->e_d.buf, &len);
 1950|  3.19k|	    a->e_d.used = len;
 1951|  3.19k|	    len = 0;
 1952|  3.19k|	  }
 1953|   131k|	else
 1954|   131k|	  {
 1955|   131k|	    if (DBG_IOBUF)
  ------------------
  |  |   98|   131k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 131k]
  |  |  ------------------
  ------------------
 1956|      0|	      log_debug ("iobuf-%d.%d: underflow: A->FILTER (%lu bytes)\n",
 1957|      0|			 a->no, a->subno, (ulong)len);
 1958|       |
 1959|   131k|	    rc = a->filter (a->filter_ov, IOBUFCTRL_UNDERFLOW, a->chain,
 1960|   131k|			    &a->d.buf[a->d.len], &len);
 1961|   131k|	  }
 1962|   134k|      }
 1963|   134k|      a->d.len += len;
 1964|       |
 1965|   134k|      if (DBG_IOBUF)
  ------------------
  |  |   98|   134k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 134k]
  |  |  ------------------
  ------------------
 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|   134k|      if (rc == -1)
  ------------------
  |  Branch (1974:11): [True: 44.6k, False: 89.6k]
  ------------------
 1975|       |	/* EOF.  */
 1976|  44.6k|	{
 1977|  44.6k|	  size_t dummy_len = 0;
 1978|       |
 1979|       |	  /* Tell the filter to free itself */
 1980|  44.6k|	  if ((rc = a->filter (a->filter_ov, IOBUFCTRL_FREE, a->chain,
  ------------------
  |  Branch (1980:8): [True: 0, False: 44.6k]
  ------------------
 1981|  44.6k|			       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|  44.6k|	  if (a->filter_ov && a->filter_ov_owner)
  ------------------
  |  Branch (1985:8): [True: 44.6k, False: 0]
  |  Branch (1985:24): [True: 0, False: 44.6k]
  ------------------
 1986|      0|	    xfree (a->filter_ov);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1987|  44.6k|	  a->filter_ov = NULL;
 1988|  44.6k|	  a->filter = NULL;
 1989|  44.6k|	  a->filter_eof = 1;
 1990|       |
 1991|  44.6k|	  if (clear_pending_eof && a->d.len == 0 && a->e_d.used == 0
  ------------------
  |  Branch (1991:8): [True: 44.5k, False: 34]
  |  Branch (1991:29): [True: 44.3k, False: 267]
  |  Branch (1991:46): [True: 44.2k, False: 17]
  ------------------
 1992|  44.6k|	      && a->chain)
  ------------------
  |  Branch (1992:11): [True: 31.8k, False: 12.3k]
  ------------------
 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|  31.8k|	    {
 2001|  31.8k|	      iobuf_t b = a->chain;
 2002|  31.8k|	      if (DBG_IOBUF)
  ------------------
  |  |   98|  31.8k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 31.8k]
  |  |  ------------------
  ------------------
 2003|      0|		log_debug ("iobuf-%d.%d: pop in underflow (nothing buffered, got EOF)\n",
 2004|      0|			   a->no, a->subno);
 2005|  31.8k|	      xfree (a->d.buf);
  ------------------
  |  |  104|  31.8k|#define xfree(a)         gcry_free ((a))
  ------------------
 2006|  31.8k|	      xfree (a->real_fname);
  ------------------
  |  |  104|  31.8k|#define xfree(a)         gcry_free ((a))
  ------------------
 2007|  31.8k|	      memcpy (a, b, sizeof *a);
 2008|  31.8k|	      xfree (b);
  ------------------
  |  |  104|  31.8k|#define xfree(a)         gcry_free ((a))
  ------------------
 2009|       |
 2010|  31.8k|	      print_chain (a);
 2011|       |
 2012|  31.8k|	      return -1;
 2013|  31.8k|	    }
 2014|  12.7k|	  else if (a->d.len == 0 && a->e_d.used == 0)
  ------------------
  |  Branch (2014:13): [True: 12.4k, False: 301]
  |  Branch (2014:30): [True: 12.3k, False: 17]
  ------------------
 2015|       |	    /* We can't unlink this filter (it is the only one in the
 2016|       |	       pipeline), but we can immediately return EOF.  */
 2017|  12.3k|	    return -1;
 2018|  44.6k|	}
 2019|  89.6k|      else if (rc)
  ------------------
  |  Branch (2019:16): [True: 1.22k, False: 88.3k]
  ------------------
 2020|       |	/* Record the error.  */
 2021|  1.22k|	{
 2022|  1.22k|	  a->error = rc;
 2023|       |
 2024|  1.22k|	  if (a->d.len == 0 && a->e_d.used == 0)
  ------------------
  |  Branch (2024:8): [True: 300, False: 920]
  |  Branch (2024:25): [True: 295, False: 5]
  ------------------
 2025|       |	    /* There is no buffered data.  Immediately return EOF.  */
 2026|    295|	    return -1;
 2027|  1.22k|	}
 2028|   134k|    }
 2029|       |
 2030|   930M|  assert (a->d.start <= a->d.len);
 2031|   930M|  if (a->e_d.used > 0)
  ------------------
  |  Branch (2031:7): [True: 2.01k, False: 930M]
  ------------------
 2032|  2.01k|    return 0;
 2033|   930M|  if (a->d.start < a->d.len)
  ------------------
  |  Branch (2033:7): [True: 79.8k, False: 929M]
  ------------------
 2034|  79.8k|    return a->d.buf[a->d.start++];
 2035|       |
 2036|       |  /* EOF.  */
 2037|   929M|  return -1;
 2038|   930M|}
iobuf.c:block_filter:
  837|   122k|{
  838|   122k|  block_filter_ctx_t *a = opaque;
  839|   122k|  char *buf = (char *)buffer;
  840|   122k|  size_t size = *ret_len;
  841|   122k|  int c, needed, rc = 0;
  842|   122k|  char *p;
  843|       |
  844|   122k|  if (control == IOBUFCTRL_UNDERFLOW)
  ------------------
  |  Branch (844:7): [True: 60.9k, False: 61.8k]
  ------------------
  845|  60.9k|    {
  846|  60.9k|      size_t n = 0;
  847|       |
  848|  60.9k|      p = buf;
  849|  60.9k|      assert (size);		/* need a buffer */
  850|  60.9k|      if (a->eof)		/* don't read any further */
  ------------------
  |  Branch (850:11): [True: 29.7k, False: 31.1k]
  ------------------
  851|  29.7k|	rc = -1;
  852|   122k|      while (!rc && size)
  ------------------
  |  Branch (852:14): [True: 92.1k, False: 30.2k]
  |  Branch (852:21): [True: 91.9k, False: 247]
  ------------------
  853|  91.9k|	{
  854|  91.9k|	  if (!a->size)
  ------------------
  |  Branch (854:8): [True: 91.7k, False: 213]
  ------------------
  855|  91.7k|	    {			/* get the length bytes */
  856|  91.7k|	      if (a->partial == 2)
  ------------------
  |  Branch (856:12): [True: 22.1k, False: 69.5k]
  ------------------
  857|  22.1k|		{
  858|  22.1k|		  a->eof = 1;
  859|  22.1k|		  if (!n)
  ------------------
  |  Branch (859:9): [True: 2, False: 22.1k]
  ------------------
  860|      2|		    rc = -1;
  861|  22.1k|		  break;
  862|  22.1k|		}
  863|  69.5k|	      else if (a->partial)
  ------------------
  |  Branch (863:17): [True: 69.5k, False: 0]
  ------------------
  864|  69.5k|		{
  865|       |		  /* These OpenPGP introduced huffman like encoded length
  866|       |		   * bytes are really a mess :-( */
  867|  69.5k|		  if (a->first_c)
  ------------------
  |  Branch (867:9): [True: 30.9k, False: 38.6k]
  ------------------
  868|  30.9k|		    {
  869|  30.9k|		      c = a->first_c;
  870|  30.9k|		      a->first_c = 0;
  871|  30.9k|		    }
  872|  38.6k|		  else if ((c = iobuf_get (chain)) == -1)
  ------------------
  |  |  500|  38.6k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 38.6k]
  |  |  |  Branch (500:24): [True: 5.45k, False: 33.2k]
  |  |  ------------------
  |  |  501|  38.6k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (872:14): [True: 505, False: 38.1k]
  ------------------
  873|    505|		    {
  874|    505|		      log_error ("block_filter: 1st length byte missing\n");
  875|    505|		      rc = GPG_ERR_BAD_DATA;
  876|    505|		      break;
  877|    505|		    }
  878|  69.0k|		  if (c < 192)
  ------------------
  |  Branch (878:9): [True: 29.2k, False: 39.8k]
  ------------------
  879|  29.2k|		    {
  880|  29.2k|		      a->size = c;
  881|  29.2k|		      a->partial = 2;
  882|  29.2k|		      if (!a->size)
  ------------------
  |  Branch (882:13): [True: 7.60k, False: 21.6k]
  ------------------
  883|  7.60k|			{
  884|  7.60k|			  a->eof = 1;
  885|  7.60k|			  if (!n)
  ------------------
  |  Branch (885:10): [True: 9, False: 7.59k]
  ------------------
  886|      9|			    rc = -1;
  887|  7.60k|			  break;
  888|  7.60k|			}
  889|  29.2k|		    }
  890|  39.8k|		  else if (c < 224)
  ------------------
  |  Branch (890:14): [True: 442, False: 39.4k]
  ------------------
  891|    442|		    {
  892|    442|		      a->size = (c - 192) * 256;
  893|    442|		      if ((c = iobuf_get (chain)) == -1)
  ------------------
  |  |  500|    442|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 442]
  |  |  |  Branch (500:24): [True: 58, False: 384]
  |  |  ------------------
  |  |  501|    442|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (893:13): [True: 13, False: 429]
  ------------------
  894|     13|			{
  895|     13|			  log_error
  896|     13|			    ("block_filter: 2nd length byte missing\n");
  897|     13|			  rc = GPG_ERR_BAD_DATA;
  898|     13|			  break;
  899|     13|			}
  900|    429|		      a->size += c + 192;
  901|    429|		      a->partial = 2;
  902|    429|		      if (!a->size)
  ------------------
  |  Branch (902:13): [True: 0, False: 429]
  ------------------
  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|    429|		    }
  910|  39.4k|		  else if (c == 255)
  ------------------
  |  Branch (910:14): [True: 519, False: 38.8k]
  ------------------
  911|    519|		    {
  912|    519|                      size_t len = 0;
  913|    519|                      int i;
  914|       |
  915|  2.49k|                      for (i = 0; i < 4; i++)
  ------------------
  |  Branch (915:35): [True: 2.01k, False: 489]
  ------------------
  916|  2.01k|                        if ((c = iobuf_get (chain)) == -1)
  ------------------
  |  |  500|  2.01k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 2.01k]
  |  |  |  Branch (500:24): [True: 46, False: 1.96k]
  |  |  ------------------
  |  |  501|  2.01k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (916:29): [True: 30, False: 1.98k]
  ------------------
  917|     30|                          break;
  918|  1.98k|                        else
  919|  1.98k|                          len = ((len << 8) | c);
  920|       |
  921|    519|                      if (i < 4)
  ------------------
  |  Branch (921:27): [True: 30, False: 489]
  ------------------
  922|     30|			{
  923|     30|			  log_error ("block_filter: invalid 4 byte length\n");
  924|     30|			  rc = GPG_ERR_BAD_DATA;
  925|     30|			  break;
  926|     30|			}
  927|    489|                      a->size = len;
  928|    489|                      a->partial = 2;
  929|    489|                      if (!a->size)
  ------------------
  |  Branch (929:27): [True: 104, False: 385]
  ------------------
  930|    104|                        {
  931|    104|                          a->eof = 1;
  932|    104|                          if (!n)
  ------------------
  |  Branch (932:31): [True: 3, False: 101]
  ------------------
  933|      3|                            rc = -1;
  934|    104|                          break;
  935|    104|			}
  936|    489|		    }
  937|  38.8k|		  else
  938|  38.8k|		    { /* Next partial body length. */
  939|  38.8k|		      a->size = 1 << (c & 0x1f);
  940|  38.8k|		    }
  941|       |		  /*  log_debug("partial: ctx=%p c=%02x size=%u\n", a, c, a->size); */
  942|  69.0k|		}
  943|      0|	      else
  944|      0|		BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  945|  91.7k|	    }
  946|       |
  947|   123k|	  while (!rc && size && a->size)
  ------------------
  |  Branch (947:11): [True: 122k, False: 515]
  |  Branch (947:18): [True: 122k, False: 247]
  |  Branch (947:26): [True: 61.5k, False: 60.7k]
  ------------------
  948|  61.5k|	    {
  949|  61.5k|	      needed = size < a->size ? size : a->size;
  ------------------
  |  Branch (949:17): [True: 325, False: 61.2k]
  ------------------
  950|  61.5k|	      c = iobuf_read (chain, p, needed);
  951|  61.5k|	      if (c < needed)
  ------------------
  |  Branch (951:12): [True: 515, False: 61.0k]
  ------------------
  952|    515|		{
  953|    515|		  if (c == -1)
  ------------------
  |  Branch (953:9): [True: 169, False: 346]
  ------------------
  954|    169|		    c = 0;
  955|    515|		  log_error
  956|    515|		    ("block_filter %p: read error (size=%lu,a->size=%lu)\n",
  957|    515|		     a, (ulong) size + c, (ulong) a->size + c);
  958|    515|		  rc = GPG_ERR_BAD_DATA;
  959|    515|		}
  960|  61.0k|	      else
  961|  61.0k|		{
  962|  61.0k|		  size -= c;
  963|  61.0k|		  a->size -= c;
  964|  61.0k|		  p += c;
  965|  61.0k|		  n += c;
  966|  61.0k|		}
  967|  61.5k|	    }
  968|  61.5k|	}
  969|  60.9k|      *ret_len = n;
  970|  60.9k|    }
  971|  61.8k|  else if (control == IOBUFCTRL_FLUSH)
  ------------------
  |  Branch (971:12): [True: 0, False: 61.8k]
  ------------------
  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|  61.8k|  else if (control == IOBUFCTRL_INIT)
  ------------------
  |  Branch (1035:12): [True: 30.9k, False: 30.9k]
  ------------------
 1036|  30.9k|    {
 1037|  30.9k|      if (DBG_IOBUF)
  ------------------
  |  |   98|  30.9k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 30.9k]
  |  |  ------------------
  ------------------
 1038|      0|	log_debug ("init block_filter %p\n", a);
 1039|  30.9k|      if (a->partial)
  ------------------
  |  Branch (1039:11): [True: 30.9k, False: 0]
  ------------------
 1040|  30.9k|	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|  30.9k|      a->eof = 0;
 1046|  30.9k|      a->buffer = NULL;
 1047|  30.9k|      a->buflen = 0;
 1048|  30.9k|    }
 1049|  30.9k|  else if (control == IOBUFCTRL_DESC)
  ------------------
  |  Branch (1049:12): [True: 0, False: 30.9k]
  ------------------
 1050|      0|    {
 1051|      0|      mem2str (buf, "block_filter", *ret_len);
 1052|      0|    }
 1053|  30.9k|  else if (control == IOBUFCTRL_FREE)
  ------------------
  |  Branch (1053:12): [True: 30.9k, False: 0]
  ------------------
 1054|  30.9k|    {
 1055|  30.9k|      if (a->use == IOBUF_OUTPUT)
  ------------------
  |  Branch (1055:11): [True: 0, False: 30.9k]
  ------------------
 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|  30.9k|      else if (a->size)
  ------------------
  |  Branch (1103:16): [True: 529, False: 30.3k]
  ------------------
 1104|    529|	{
 1105|    529|	  log_error ("block_filter: pending bytes!\n");
 1106|    529|	}
 1107|  30.9k|      if (DBG_IOBUF)
  ------------------
  |  |   98|  30.9k|#define DBG_IOBUF   iobuf_debug_mode
  |  |  ------------------
  |  |  |  Branch (98:21): [True: 0, False: 30.9k]
  |  |  ------------------
  ------------------
 1108|      0|	log_debug ("free block_filter %p\n", a);
 1109|  30.9k|      xfree (a);		/* we can free our context now */
  ------------------
  |  |  104|  30.9k|#define xfree(a)         gcry_free ((a))
  ------------------
 1110|  30.9k|    }
 1111|       |
 1112|   122k|  return rc;
 1113|   122k|}

has_invalid_email_chars:
  126|  2.34k|{
  127|  2.34k|  const unsigned char *s = buffer;
  128|  2.34k|  int at_seen=0;
  129|  2.34k|  const char *valid_chars=
  130|  2.34k|    "01234567890_-.abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  131|       |
  132|  10.0k|  for ( ; length && *s; length--, s++ )
  ------------------
  |  Branch (132:11): [True: 8.55k, False: 1.47k]
  |  Branch (132:21): [True: 8.55k, False: 0]
  ------------------
  133|  8.55k|    {
  134|  8.55k|      if ((*s & 0x80))
  ------------------
  |  Branch (134:11): [True: 1.25k, False: 7.30k]
  ------------------
  135|  1.25k|        continue; /* We only care about ASCII.  */
  136|  7.30k|      if (*s == '@')
  ------------------
  |  Branch (136:11): [True: 2.15k, False: 5.15k]
  ------------------
  137|  2.15k|        at_seen=1;
  138|  5.15k|      else if (!at_seen && !(strchr (valid_chars, *s)
  ------------------
  |  Branch (138:16): [True: 2.65k, False: 2.49k]
  |  Branch (138:30): [True: 1.60k, False: 1.05k]
  ------------------
  139|  2.65k|                             || strchr ("!#$%&'*+/=?^`{|}~", *s)))
  ------------------
  |  Branch (139:33): [True: 443, False: 607]
  ------------------
  140|    607|        return 1;
  141|  4.54k|      else if (at_seen && !strchr (valid_chars, *s))
  ------------------
  |  Branch (141:16): [True: 2.49k, False: 2.05k]
  |  Branch (141:27): [True: 267, False: 2.22k]
  ------------------
  142|    267|        return 1;
  143|  7.30k|    }
  144|  1.47k|  return 0;
  145|  2.34k|}
is_valid_mailbox_mem:
  152|  2.34k|{
  153|  2.34k|  const char *name = name_arg;
  154|       |
  155|  2.34k|  return !( !name
  ------------------
  |  Branch (155:13): [True: 0, False: 2.34k]
  ------------------
  156|  2.34k|            || !namelen
  ------------------
  |  Branch (156:16): [True: 0, False: 2.34k]
  ------------------
  157|  2.34k|            || has_invalid_email_chars (name, namelen)
  ------------------
  |  Branch (157:16): [True: 874, False: 1.47k]
  ------------------
  158|  2.34k|            || mem_count_chr (name, '@', namelen) != 1
  ------------------
  |  Branch (158:16): [True: 433, False: 1.04k]
  ------------------
  159|  2.34k|            || *name == '@'
  ------------------
  |  Branch (159:16): [True: 200, False: 840]
  ------------------
  160|  2.34k|            || name[namelen-1] == '@'
  ------------------
  |  Branch (160:16): [True: 31, False: 809]
  ------------------
  161|  2.34k|            || name[namelen-1] == '.'
  ------------------
  |  Branch (161:16): [True: 182, False: 627]
  ------------------
  162|  2.34k|            || my_memstr (name, namelen, ".."));
  ------------------
  |  Branch (162:16): [True: 177, False: 450]
  ------------------
  163|  2.34k|}
is_valid_mailbox:
  170|  2.34k|{
  171|  2.34k|  return name? is_valid_mailbox_mem (name, strlen (name)) : 0;
  ------------------
  |  Branch (171:10): [True: 2.34k, False: 0]
  ------------------
  172|  2.34k|}
mailbox_from_userid:
  182|  3.29k|{
  183|  3.29k|  const char *s, *s_end;
  184|  3.29k|  size_t len;
  185|  3.29k|  char *result = NULL;
  186|       |
  187|  3.29k|  s = strchr (userid, '<');
  188|  3.29k|  if (s)
  ------------------
  |  Branch (188:7): [True: 950, False: 2.34k]
  ------------------
  189|    950|    {
  190|       |      /* Seems to be a standard user id.  */
  191|    950|      s++;
  192|    950|      s_end = strchr (s, '>');
  193|    950|      if (s_end && s_end > s)
  ------------------
  |  Branch (193:11): [True: 909, False: 41]
  |  Branch (193:20): [True: 713, False: 196]
  ------------------
  194|    713|        {
  195|    713|          len = s_end - s;
  196|    713|          result = xtrymalloc (len + 1);
  ------------------
  |  |   97|    713|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  197|    713|          if (!result)
  ------------------
  |  Branch (197:15): [True: 0, False: 713]
  ------------------
  198|      0|            return NULL; /* Ooops - out of core.  */
  199|    713|          strncpy (result, s, len);
  200|    713|          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|    713|          if (string_count_chr (result, '@') != 1  /* Need exactly one '@.  */
  ------------------
  |  Branch (203:15): [True: 68, False: 645]
  ------------------
  204|    713|              || *result == '@'           /* local-part missing.  */
  ------------------
  |  Branch (204:18): [True: 192, False: 453]
  ------------------
  205|    713|              || result[len-1] == '@'     /* domain missing.  */
  ------------------
  |  Branch (205:18): [True: 68, False: 385]
  ------------------
  206|    713|              || result[len-1] == '.'     /* ends with a dot.  */
  ------------------
  |  Branch (206:18): [True: 65, False: 320]
  ------------------
  207|    713|              || string_has_ctrl_or_space (result)
  ------------------
  |  Branch (207:18): [True: 10, False: 310]
  ------------------
  208|    713|              || has_dotdot_after_at (result))
  ------------------
  |  Branch (208:18): [True: 49, False: 261]
  ------------------
  209|    452|            {
  210|    452|              xfree (result);
  ------------------
  |  |  104|    452|#define xfree(a)         gcry_free ((a))
  ------------------
  211|    452|              result = NULL;
  212|    452|              errno = EINVAL;
  213|    452|            }
  214|    713|        }
  215|    237|      else
  216|    237|        errno = EINVAL;
  217|    950|    }
  218|  2.34k|  else if (is_valid_mailbox (userid))
  ------------------
  |  Branch (218:12): [True: 450, False: 1.89k]
  ------------------
  219|    450|    {
  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|    450|      result = xtrystrdup (userid);
  ------------------
  |  |  103|    450|#define xtrystrdup(a)    gcry_strdup ((a))
  ------------------
  226|    450|    }
  227|  1.89k|  else
  228|  1.89k|    errno = EINVAL;
  229|       |
  230|  3.29k|  if (result && subaddress == 1)
  ------------------
  |  Branch (230:7): [True: 711, False: 2.58k]
  |  Branch (230:17): [True: 0, False: 711]
  ------------------
  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|  3.29k|  return result? ascii_strlwr (result): NULL;
  ------------------
  |  Branch (253:10): [True: 711, False: 2.58k]
  ------------------
  254|  3.29k|}
mbox-util.c:mem_count_chr:
   49|  1.47k|{
   50|  1.47k|  const char *s = buffer;
   51|  1.47k|  int count;
   52|       |
   53|  7.84k|  for (count=0; length; length--, s++)
  ------------------
  |  Branch (53:17): [True: 6.37k, False: 1.47k]
  ------------------
   54|  6.37k|    if (*s == c)
  ------------------
  |  Branch (54:9): [True: 1.84k, False: 4.52k]
  ------------------
   55|  1.84k|      count++;
   56|  1.47k|  return count;
   57|  1.47k|}
mbox-util.c:my_memstr:
   65|    627|{
   66|    627|  const unsigned char *buf = buffer;
   67|    627|  const unsigned char *t = (const unsigned char *)buf;
   68|    627|  const unsigned char *s = (const unsigned char *)sub;
   69|    627|  size_t n = buflen;
   70|       |
   71|  2.78k|  for ( ; n ; t++, n-- )
  ------------------
  |  Branch (71:11): [True: 2.33k, False: 450]
  ------------------
   72|  2.33k|    {
   73|  2.33k|      if (*t == *s)
  ------------------
  |  Branch (73:11): [True: 345, False: 1.99k]
  ------------------
   74|    345|        {
   75|    522|          for (buf = t++, buflen = n--, s++; n && *t ==*s; t++, s++, n--)
  ------------------
  |  Branch (75:46): [True: 522, False: 0]
  |  Branch (75:51): [True: 177, False: 345]
  ------------------
   76|    177|            ;
   77|    345|          if (!*s)
  ------------------
  |  Branch (77:15): [True: 177, False: 168]
  ------------------
   78|    177|            return (const char*)buf;
   79|    168|          t = (const unsigned char *)buf;
   80|    168|          s = (const unsigned char *)sub ;
   81|    168|          n = buflen;
   82|    168|	}
   83|  2.33k|    }
   84|    450|  return NULL;
   85|    627|}
mbox-util.c:string_count_chr:
   38|    713|{
   39|    713|  int count;
   40|       |
   41|  6.83k|  for (count=0; *string; string++ )
  ------------------
  |  Branch (41:17): [True: 6.11k, False: 713]
  ------------------
   42|  6.11k|    if ( *string == c )
  ------------------
  |  Branch (42:10): [True: 653, False: 5.46k]
  ------------------
   43|    653|      count++;
   44|    713|  return count;
   45|    713|}
mbox-util.c:string_has_ctrl_or_space:
   91|    320|{
   92|  3.72k|  for (; *string; string++ )
  ------------------
  |  Branch (92:10): [True: 3.41k, False: 310]
  ------------------
   93|  3.41k|    if (!(*string & 0x80) && *string <= 0x20)
  ------------------
  |  Branch (93:9): [True: 3.28k, False: 129]
  |  Branch (93:30): [True: 10, False: 3.27k]
  ------------------
   94|     10|      return 1;
   95|    310|  return 0;
   96|    320|}
mbox-util.c:has_dotdot_after_at:
  103|    310|{
  104|    310|  string = strchr (string, '@');
  105|    310|  if (!string)
  ------------------
  |  Branch (105:7): [True: 0, False: 310]
  ------------------
  106|      0|    return 0; /* No at-sign.  */
  107|    310|  string++;
  108|    310|  return !!strstr (string, "..");
  109|    310|}

print_fname_stdin:
  177|    604|{
  178|    604|    if( !s || (*s == '-' && !s[1]) )
  ------------------
  |  Branch (178:9): [True: 0, False: 604]
  |  Branch (178:16): [True: 0, False: 604]
  |  Branch (178:29): [True: 0, False: 0]
  ------------------
  179|      0|	return "[stdin]";
  180|    604|    return s;
  181|    604|}
print_utf8_buffer:
  238|  39.8k|{
  239|  39.8k|  do_print_utf8_buffer (stream, p, n, NULL, NULL);
  240|  39.8k|}
try_make_printable_string:
  277|  3.29k|{
  278|  3.29k|  const unsigned char *p = p_arg;
  279|  3.29k|  size_t save_n, buflen;
  280|  3.29k|  const unsigned char *save_p;
  281|  3.29k|  char *buffer, *d;
  282|       |
  283|       |  /* First count length. */
  284|  53.8k|  for (save_n = n, save_p = p, buflen=1 ; n; n--, p++ )
  ------------------
  |  Branch (284:43): [True: 50.5k, False: 3.29k]
  ------------------
  285|  50.5k|    {
  286|  50.5k|      if ( *p < 0x20 || *p == 0x7f || *p == delim  || (delim && *p=='\\'))
  ------------------
  |  Branch (286:12): [True: 8.64k, False: 41.8k]
  |  Branch (286:25): [True: 15.8k, False: 25.9k]
  |  Branch (286:39): [True: 0, False: 25.9k]
  |  Branch (286:56): [True: 0, False: 25.9k]
  |  Branch (286:65): [True: 0, False: 0]
  ------------------
  287|  24.5k|        {
  288|  24.5k|          if ( *p=='\n' || *p=='\r' || *p=='\f'
  ------------------
  |  Branch (288:16): [True: 438, False: 24.0k]
  |  Branch (288:28): [True: 341, False: 23.7k]
  |  Branch (288:40): [True: 101, False: 23.6k]
  ------------------
  289|  24.5k|               || *p=='\v' || *p=='\b' || !*p )
  ------------------
  |  Branch (289:19): [True: 524, False: 23.1k]
  |  Branch (289:31): [True: 552, False: 22.5k]
  |  Branch (289:43): [True: 2.41k, False: 20.1k]
  ------------------
  290|  4.37k|            buflen += 2;
  291|  20.1k|          else
  292|  20.1k|            buflen += 5;
  293|  24.5k|	}
  294|  25.9k|      else
  295|  25.9k|        buflen++;
  296|  50.5k|    }
  297|  3.29k|  p = save_p;
  298|  3.29k|  n = save_n;
  299|       |  /* And now make the string */
  300|  3.29k|  d = buffer = xtrymalloc (buflen);
  ------------------
  |  |   97|  3.29k|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  301|  53.8k|  for ( ; n; n--, p++ )
  ------------------
  |  Branch (301:11): [True: 50.5k, False: 3.29k]
  ------------------
  302|  50.5k|    {
  303|  50.5k|      if (*p < 0x20 || *p == 0x7f || *p == delim || (delim && *p=='\\')) {
  ------------------
  |  Branch (303:11): [True: 8.64k, False: 41.8k]
  |  Branch (303:24): [True: 15.8k, False: 25.9k]
  |  Branch (303:38): [True: 0, False: 25.9k]
  |  Branch (303:54): [True: 0, False: 25.9k]
  |  Branch (303:63): [True: 0, False: 0]
  ------------------
  304|  24.5k|        *d++ = '\\';
  305|  24.5k|        if( *p == '\n' )
  ------------------
  |  Branch (305:13): [True: 438, False: 24.0k]
  ------------------
  306|    438|          *d++ = 'n';
  307|  24.0k|        else if( *p == '\r' )
  ------------------
  |  Branch (307:18): [True: 341, False: 23.7k]
  ------------------
  308|    341|          *d++ = 'r';
  309|  23.7k|        else if( *p == '\f' )
  ------------------
  |  Branch (309:18): [True: 101, False: 23.6k]
  ------------------
  310|    101|          *d++ = 'f';
  311|  23.6k|        else if( *p == '\v' )
  ------------------
  |  Branch (311:18): [True: 524, False: 23.1k]
  ------------------
  312|    524|          *d++ = 'v';
  313|  23.1k|        else if( *p == '\b' )
  ------------------
  |  Branch (313:18): [True: 552, False: 22.5k]
  ------------------
  314|    552|          *d++ = 'b';
  315|  22.5k|        else if( !*p )
  ------------------
  |  Branch (315:18): [True: 2.41k, False: 20.1k]
  ------------------
  316|  2.41k|          *d++ = '0';
  317|  20.1k|        else {
  318|  20.1k|          sprintf(d, "x%02x", *p );
  319|  20.1k|          d += 3;
  320|  20.1k|        }
  321|  24.5k|      }
  322|  25.9k|      else
  323|  25.9k|        *d++ = *p;
  324|  50.5k|    }
  325|  3.29k|  *d = 0;
  326|  3.29k|  return buffer;
  327|  3.29k|}
miscellaneous.c:do_print_utf8_buffer:
  188|  39.8k|{
  189|  39.8k|  const char *p = buffer;
  190|  39.8k|  size_t i;
  191|       |
  192|       |  /* We can handle plain ascii simpler, so check for it first. */
  193|  92.9k|  for (i=0; i < length; i++ )
  ------------------
  |  Branch (193:13): [True: 60.0k, False: 32.8k]
  ------------------
  194|  60.0k|    {
  195|  60.0k|      if ( (p[i] & 0x80) )
  ------------------
  |  Branch (195:12): [True: 6.95k, False: 53.1k]
  ------------------
  196|  6.95k|        break;
  197|  60.0k|    }
  198|  39.8k|  if (i < length)
  ------------------
  |  Branch (198:7): [True: 6.95k, False: 32.8k]
  ------------------
  199|  6.95k|    {
  200|  6.95k|      int delim = delimiters? *delimiters : 0;
  ------------------
  |  Branch (200:19): [True: 0, False: 6.95k]
  ------------------
  201|  6.95k|      char *buf;
  202|  6.95k|      int ret;
  203|       |
  204|       |      /*(utf8 conversion already does the control character quoting). */
  205|  6.95k|      buf = utf8_to_native (p, length, delim);
  206|  6.95k|      if (bytes_written)
  ------------------
  |  Branch (206:11): [True: 0, False: 6.95k]
  ------------------
  207|      0|        *bytes_written = strlen (buf);
  208|  6.95k|      ret = es_fputs (buf, stream);
  209|  6.95k|      xfree (buf);
  ------------------
  |  |  104|  6.95k|#define xfree(a)         gcry_free ((a))
  ------------------
  210|  6.95k|      return ret == EOF? ret : (int)i;
  ------------------
  |  Branch (210:14): [True: 0, False: 6.95k]
  ------------------
  211|  6.95k|    }
  212|  32.8k|  else
  213|  32.8k|    return es_write_sanitized (stream, p, length, delimiters, bytes_written);
  214|  39.8k|}

openpgp_oidbuf_to_str:
  224|  12.3k|{
  225|  12.3k|  char *string, *p;
  226|  12.3k|  int n = 0;
  227|  12.3k|  unsigned long val, valmask;
  228|       |
  229|  12.3k|  valmask = (unsigned long)0xfe << (8 * (sizeof (valmask) - 1));
  230|       |  /* The first bytes gives the length; check consistency.  */
  231|       |
  232|  12.3k|  if (!len || buf[0] != len -1)
  ------------------
  |  Branch (232:7): [True: 0, False: 12.3k]
  |  Branch (232:15): [True: 0, False: 12.3k]
  ------------------
  233|      0|    {
  234|      0|      gpg_err_set_errno (EINVAL);
  235|      0|      return NULL;
  236|      0|    }
  237|       |  /* Skip length byte.  */
  238|  12.3k|  len--;
  239|  12.3k|  buf++;
  240|       |
  241|       |  /* To calculate the length of the string we can safely assume an
  242|       |     upper limit of 3 decimal characters per byte.  Two extra bytes
  243|       |     account for the special first octet */
  244|  12.3k|  string = p = xtrymalloc (len*(1+3)+2+1);
  ------------------
  |  |   97|  12.3k|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  245|  12.3k|  if (!string)
  ------------------
  |  Branch (245:7): [True: 0, False: 12.3k]
  ------------------
  246|      0|    return NULL;
  247|  12.3k|  if (!len)
  ------------------
  |  Branch (247:7): [True: 0, False: 12.3k]
  ------------------
  248|      0|    {
  249|      0|      *p = 0;
  250|      0|      return string;
  251|      0|    }
  252|       |
  253|  12.3k|  if (buf[0] < 40)
  ------------------
  |  Branch (253:7): [True: 1.07k, False: 11.2k]
  ------------------
  254|  1.07k|    p += sprintf (p, "0.%d", buf[n]);
  255|  11.2k|  else if (buf[0] < 80)
  ------------------
  |  Branch (255:12): [True: 9.42k, False: 1.86k]
  ------------------
  256|  9.42k|    p += sprintf (p, "1.%d", buf[n]-40);
  257|  1.86k|  else {
  258|  1.86k|    val = buf[n] & 0x7f;
  259|  6.58k|    while ( (buf[n]&0x80) && ++n < len )
  ------------------
  |  Branch (259:13): [True: 5.53k, False: 1.04k]
  |  Branch (259:30): [True: 5.16k, False: 369]
  ------------------
  260|  5.16k|      {
  261|  5.16k|        if ( (val & valmask) )
  ------------------
  |  Branch (261:14): [True: 450, False: 4.71k]
  ------------------
  262|    450|          goto badoid;  /* Overflow.  */
  263|  4.71k|        val <<= 7;
  264|  4.71k|        val |= buf[n] & 0x7f;
  265|  4.71k|      }
  266|  1.41k|    if (val < 80)
  ------------------
  |  Branch (266:9): [True: 43, False: 1.37k]
  ------------------
  267|     43|      goto badoid;
  268|  1.37k|    val -= 80;
  269|  1.37k|    sprintf (p, "2.%lu", val);
  270|  1.37k|    p += strlen (p);
  271|  1.37k|  }
  272|  74.2k|  for (n++; n < len; n++)
  ------------------
  |  Branch (272:13): [True: 62.4k, False: 11.8k]
  ------------------
  273|  62.4k|    {
  274|  62.4k|      val = buf[n] & 0x7f;
  275|  75.2k|      while ( (buf[n]&0x80) && ++n < len )
  ------------------
  |  Branch (275:15): [True: 13.0k, False: 62.1k]
  |  Branch (275:32): [True: 12.8k, False: 242]
  ------------------
  276|  12.8k|        {
  277|  12.8k|          if ( (val & valmask) )
  ------------------
  |  Branch (277:16): [True: 21, False: 12.8k]
  ------------------
  278|     21|            goto badoid;  /* Overflow.  */
  279|  12.8k|          val <<= 7;
  280|  12.8k|          val |= buf[n] & 0x7f;
  281|  12.8k|        }
  282|  62.4k|      sprintf (p, ".%lu", val);
  283|  62.4k|      p += strlen (p);
  284|  62.4k|    }
  285|       |
  286|  11.8k|  *p = 0;
  287|  11.8k|  return string;
  288|       |
  289|    514| badoid:
  290|       |  /* Return a special OID (gnu.gnupg.badoid) to indicate the error
  291|       |     case.  The OID is broken and thus we return one which can't do
  292|       |     any harm.  Formally this does not need to be a bad OID but an OID
  293|       |     with an arc that can't be represented in a 32 bit word is more
  294|       |     than likely corrupt.  */
  295|    514|  xfree (string);
  ------------------
  |  |  104|    514|#define xfree(a)         gcry_free ((a))
  ------------------
  296|    514|  return xtrystrdup ("1.3.6.1.4.1.11591.2.12242973");
  ------------------
  |  |  103|    514|#define xtrystrdup(a)    gcry_strdup ((a))
  ------------------
  297|  11.8k|}
openpgp_oid_to_str:
  304|  12.3k|{
  305|  12.3k|  const unsigned char *buf;
  306|  12.3k|  unsigned int lengthi;
  307|       |
  308|  12.3k|  if (!a
  ------------------
  |  Branch (308:7): [True: 0, False: 12.3k]
  ------------------
  309|  12.3k|      || !gcry_mpi_get_flag (a, GCRYMPI_FLAG_OPAQUE)
  ------------------
  |  Branch (309:10): [True: 0, False: 12.3k]
  ------------------
  310|  12.3k|      || !(buf = gcry_mpi_get_opaque (a, &lengthi)))
  ------------------
  |  Branch (310:10): [True: 0, False: 12.3k]
  ------------------
  311|      0|    {
  312|      0|      gpg_err_set_errno (EINVAL);
  313|      0|      return NULL;
  314|      0|    }
  315|       |
  316|  12.3k|  return openpgp_oidbuf_to_str (buf, (lengthi+7)/8);
  317|  12.3k|}
openpgp_oidbuf_is_ed25519:
  323|  14.2k|{
  324|  14.2k|  return (buf && len == DIM (oid_ed25519)
  ------------------
  |  |   47|  28.4k|#define DIM(v)		     (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (324:11): [True: 14.2k, False: 0]
  |  Branch (324:18): [True: 14.1k, False: 84]
  ------------------
  325|  14.2k|          && !memcmp (buf, oid_ed25519, DIM (oid_ed25519)));
  ------------------
  |  |   47|  14.1k|#define DIM(v)		     (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (325:14): [True: 14.1k, False: 0]
  ------------------
  326|  14.2k|}
openpgp_oid_is_ed25519:
  332|  14.2k|{
  333|  14.2k|  const unsigned char *buf;
  334|  14.2k|  unsigned int nbits;
  335|       |
  336|  14.2k|  if (!a || !gcry_mpi_get_flag (a, GCRYMPI_FLAG_OPAQUE))
  ------------------
  |  Branch (336:7): [True: 0, False: 14.2k]
  |  Branch (336:13): [True: 0, False: 14.2k]
  ------------------
  337|      0|    return 0;
  338|       |
  339|  14.2k|  buf = gcry_mpi_get_opaque (a, &nbits);
  340|  14.2k|  return openpgp_oidbuf_is_ed25519 (buf, (nbits+7)/8);
  341|  14.2k|}
openpgp_oid_to_curve:
  469|  4.89k|{
  470|  4.89k|  int i;
  471|       |
  472|  4.89k|  if (!oidstr)
  ------------------
  |  Branch (472:7): [True: 0, False: 4.89k]
  ------------------
  473|      0|    return NULL;
  474|       |
  475|  49.7k|  for (i=0; oidtable[i].name; i++)
  ------------------
  |  Branch (475:13): [True: 46.2k, False: 3.44k]
  ------------------
  476|  46.2k|    if (!strcmp (oidtable[i].oidstr, oidstr))
  ------------------
  |  Branch (476:9): [True: 1.45k, False: 44.8k]
  ------------------
  477|  1.45k|      return !canon && oidtable[i].alias? oidtable[i].alias : oidtable[i].name;
  ------------------
  |  Branch (477:14): [True: 1.45k, False: 0]
  |  Branch (477:24): [True: 985, False: 469]
  ------------------
  478|       |
  479|  3.44k|  return NULL;
  480|  4.89k|}

mem2str:
  173|  11.0k|{
  174|  11.0k|  char *d;
  175|  11.0k|  const char *s;
  176|       |
  177|  11.0k|  if (n)
  ------------------
  |  Branch (177:7): [True: 11.0k, False: 0]
  ------------------
  178|  11.0k|    {
  179|  11.0k|      if (!dest)
  ------------------
  |  Branch (179:11): [True: 0, False: 11.0k]
  ------------------
  180|      0|        dest = xmalloc (n);
  ------------------
  |  |  107|      0|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  181|  11.0k|      d = dest;
  182|  11.0k|      s = src ;
  183|   231k|      for (n--; n && *s; n--)
  ------------------
  |  Branch (183:17): [True: 231k, False: 0]
  |  Branch (183:22): [True: 220k, False: 11.0k]
  ------------------
  184|   220k|        *d++ = *s++;
  185|  11.0k|      *d = '\0' ;
  186|  11.0k|    }
  187|       |
  188|  11.0k|  return dest;
  189|  11.0k|}
trim_trailing_chars:
  273|   400k|{
  274|   400k|    byte *p, *mark;
  275|   400k|    unsigned n;
  276|       |
  277|  2.26M|    for(mark=NULL, p=line, n=0; n < len; n++, p++ ) {
  ------------------
  |  Branch (277:33): [True: 1.86M, False: 400k]
  ------------------
  278|  1.86M|	if( strchr(trimchars, *p ) ) {
  ------------------
  |  Branch (278:6): [True: 742k, False: 1.12M]
  ------------------
  279|   742k|	    if( !mark )
  ------------------
  |  Branch (279:10): [True: 672k, False: 69.9k]
  ------------------
  280|   672k|		mark = p;
  281|   742k|	}
  282|  1.12M|	else
  283|  1.12M|	    mark = NULL;
  284|  1.86M|    }
  285|       |
  286|   400k|    if( mark ) {
  ------------------
  |  Branch (286:9): [True: 400k, False: 388]
  ------------------
  287|   400k|	*mark = 0;
  288|   400k|	return mark - line;
  289|   400k|    }
  290|    388|    return len;
  291|   400k|}
length_sans_trailing_chars:
  305|  31.5k|{
  306|  31.5k|  const unsigned char *p, *mark;
  307|  31.5k|  size_t n;
  308|       |
  309|  1.26M|  for( mark=NULL, p=line, n=0; n < len; n++, p++ )
  ------------------
  |  Branch (309:32): [True: 1.22M, False: 31.5k]
  ------------------
  310|  1.22M|    {
  311|  1.22M|      if (strchr (trimchars, *p ))
  ------------------
  |  Branch (311:11): [True: 133k, False: 1.09M]
  ------------------
  312|   133k|        {
  313|   133k|          if( !mark )
  ------------------
  |  Branch (313:15): [True: 94.6k, False: 38.8k]
  ------------------
  314|  94.6k|            mark = p;
  315|   133k|        }
  316|  1.09M|      else
  317|  1.09M|        mark = NULL;
  318|  1.22M|    }
  319|       |
  320|  31.5k|  if (mark)
  ------------------
  |  Branch (320:7): [True: 30.6k, False: 915]
  ------------------
  321|  30.6k|    return mark - line;
  322|    915|  return len;
  323|  31.5k|}
length_sans_trailing_ws:
  330|  31.5k|{
  331|  31.5k|  return length_sans_trailing_chars (line, len, " \t\r\n");
  332|  31.5k|}
make_filename:
  612|   130k|{
  613|   130k|  va_list arg_ptr;
  614|   130k|  char *result;
  615|       |
  616|   130k|  va_start (arg_ptr, first_part);
  617|   130k|  result = do_make_filename (1, first_part, arg_ptr);
  618|   130k|  va_end (arg_ptr);
  619|   130k|  return result;
  620|   130k|}
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.01k|{
  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.01k|    return strcmp(a,b);
  693|  1.01k|#endif
  694|  1.01k|}
ascii_toupper:
  818|    837|{
  819|    837|    if (c >= 'a' && c <= 'z')
  ------------------
  |  Branch (819:9): [True: 628, False: 209]
  |  Branch (819:21): [True: 628, False: 0]
  ------------------
  820|    628|        c &= ~0x20;
  821|    837|    return c;
  822|    837|}
ascii_strlwr:
  835|    711|{
  836|    711|  char *p = s;
  837|       |
  838|  5.27k|  for (p=s; *p; p++ )
  ------------------
  |  Branch (838:13): [True: 4.56k, False: 711]
  ------------------
  839|  4.56k|    if (isascii (*p) && *p >= 'A' && *p <= 'Z')
  ------------------
  |  Branch (839:25): [True: 2.24k, False: 1.63k]
  |  Branch (839:38): [True: 289, False: 1.96k]
  ------------------
  840|    289|      *p |= 0x20;
  841|       |
  842|    711|  return s;
  843|    711|}
stringhelp.c:do_make_filename:
  444|   130k|{
  445|   130k|  const char *argv[32];
  446|   130k|  int argc;
  447|   130k|  size_t n;
  448|   130k|  int skip = 1;
  449|   130k|  char *home_buffer = NULL;
  450|   130k|  char *name, *home, *p;
  451|   130k|  int want_abs;
  452|       |
  453|   130k|  want_abs = !!(xmode & 2);
  454|   130k|  xmode &= 1;
  455|       |
  456|   130k|  n = strlen (first_part) + 1;
  457|   130k|  argc = 0;
  458|   261k|  while ( (argv[argc] = va_arg (arg_ptr, const char *)) )
  ------------------
  |  Branch (458:11): [True: 130k, False: 130k]
  ------------------
  459|   130k|    {
  460|   130k|      n += strlen (argv[argc]) + 1;
  461|   130k|      if (argc >= DIM (argv)-1)
  ------------------
  |  |   47|   130k|#define DIM(v)		     (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (461:11): [True: 0, False: 130k]
  ------------------
  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|   130k|      argc++;
  469|   130k|    }
  470|   130k|  n++;
  471|       |
  472|   130k|  home = NULL;
  473|   130k|  if (*first_part == '~')
  ------------------
  |  Branch (473:7): [True: 1, False: 130k]
  ------------------
  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|   130k|  if (xmode)
  ------------------
  |  Branch (511:7): [True: 130k, False: 0]
  ------------------
  512|   130k|    name = xmalloc (n);
  ------------------
  |  |  107|   130k|#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|   130k|  if (home)
  ------------------
  |  Branch (523:7): [True: 1, False: 130k]
  ------------------
  524|      1|    p = stpcpy (stpcpy (name, home), first_part + skip);
  525|   130k|  else
  526|   130k|    p = stpcpy (name, first_part);
  527|       |
  528|   130k|  xfree (home_buffer);
  ------------------
  |  |  104|   130k|#define xfree(a)         gcry_free ((a))
  ------------------
  529|   261k|  for (argc=0; argv[argc]; argc++)
  ------------------
  |  Branch (529:16): [True: 130k, False: 130k]
  ------------------
  530|   130k|    {
  531|       |      /* Avoid a leading double slash if the first part was "/".  */
  532|   130k|      if (!argc && name[0] == '/' && !name[1])
  ------------------
  |  Branch (532:11): [True: 130k, False: 0]
  |  Branch (532:20): [True: 130k, False: 0]
  |  Branch (532:38): [True: 0, False: 130k]
  ------------------
  533|      0|        p = stpcpy (p, argv[argc]);
  534|   130k|      else
  535|   130k|        p = stpcpy (stpcpy (p, "/"), argv[argc]);
  536|   130k|    }
  537|       |
  538|   130k|  if (want_abs)
  ------------------
  |  Branch (538:7): [True: 3, False: 130k]
  ------------------
  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|   130k|  return change_slashes (name);
  605|   130k|}
stringhelp.c:change_slashes:
   70|   130k|{
   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|   130k|  return name;
   82|   130k|}

free_strlist:
   46|  15.6k|{
   47|  15.6k|    strlist_t sl2;
   48|       |
   49|  15.6k|    for(; sl; sl = sl2 ) {
  ------------------
  |  Branch (49:11): [True: 0, False: 15.6k]
  ------------------
   50|      0|	sl2 = sl->next;
   51|      0|	xfree(sl);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
   52|      0|    }
   53|  15.6k|}
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|  21.5k|{
  353|  21.5k|  static byte marker[SIZEOF_UNSIGNED_LONG*2];
  354|  21.5k|  static int initialized;
  355|       |
  356|  21.5k|  if (!initialized)
  ------------------
  |  Branch (356:7): [True: 1, False: 21.5k]
  ------------------
  357|      1|    {
  358|      1|      gcry_create_nonce (marker, sizeof marker);
  359|      1|      initialized = 1;
  360|      1|    }
  361|  21.5k|  *rlen = sizeof (marker);
  362|  21.5k|  return marker;
  363|  21.5k|}
check_special_filename:
  582|  84.8k|{
  583|  84.8k|  if (allow_special_filenames
  ------------------
  |  Branch (583:7): [True: 0, False: 84.8k]
  ------------------
  584|  84.8k|      && 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|  84.8k|  return -1;
  596|  84.8k|}
gnupg_access:
 1235|  1.02k|{
 1236|  1.02k|  return gpgrt_access (name, mode);
 1237|  1.02k|}
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|}

tty_fprintf:
  298|   185k|{
  299|   185k|  va_list arg_ptr;
  300|       |
  301|   185k|  if (fp)
  ------------------
  |  Branch (301:7): [True: 185k, False: 0]
  ------------------
  302|   185k|    {
  303|   185k|      va_start (arg_ptr, fmt) ;
  304|   185k|      es_vfprintf (fp, fmt, arg_ptr );
  305|   185k|      va_end (arg_ptr);
  306|   185k|      return;
  307|   185k|    }
  308|       |
  309|      0|  if (no_terminal)
  ------------------
  |  Branch (309:7): [True: 0, False: 0]
  ------------------
  310|      0|    return;
  311|       |
  312|      0|  if (!initialized)
  ------------------
  |  Branch (312:7): [True: 0, False: 0]
  ------------------
  313|      0|    init_ttyfp ();
  314|       |
  315|      0|  va_start (arg_ptr, fmt);
  316|       |
  317|       |#ifdef HAVE_W32_SYSTEM
  318|       |  {
  319|       |    char *buf = NULL;
  320|       |
  321|       |    vasprintf (&buf, fmt, arg_ptr);
  322|       |    if (!buf)
  323|       |      log_bug ("vasprintf() failed\n");
  324|       |    w32_write_console (buf);
  325|       |    xfree (buf);
  326|       |  }
  327|       |#else /* Unix */
  328|      0|  last_prompt_len += vfprintf(ttyfp,fmt,arg_ptr) ;
  329|      0|  fflush(ttyfp);
  330|      0|#endif /* Unix */
  331|       |
  332|      0|  va_end(arg_ptr);
  333|      0|}

utf8_to_native:
  689|  6.95k|{
  690|  6.95k|  return do_utf8_to_native (string, length, delim, use_iconv);
  691|  6.95k|}
utf8conv.c:do_utf8_to_native:
  410|  6.95k|{
  411|  6.95k|  int nleft;
  412|  6.95k|  int i;
  413|  6.95k|  unsigned char encbuf[8];
  414|  6.95k|  int encidx;
  415|  6.95k|  const unsigned char *s;
  416|  6.95k|  size_t n;
  417|  6.95k|  char *buffer = NULL;
  418|  6.95k|  char *p = NULL;
  419|  6.95k|  unsigned long val = 0;
  420|  6.95k|  size_t slen;
  421|  6.95k|  int resync = 0;
  422|       |
  423|       |  /* First pass (p==NULL): count the extended utf-8 characters.  */
  424|       |  /* Second pass (p!=NULL): create string.  */
  425|  6.95k|  for (;;)
  426|  13.9k|    {
  427|  13.9k|      for (slen = length, nleft = encidx = 0, n = 0,
  428|  13.9k|             s = (const unsigned char *)string;
  429|   233k|           slen;
  ------------------
  |  Branch (429:12): [True: 219k, False: 13.9k]
  ------------------
  430|   219k|	   s++, slen--)
  431|   219k|	{
  432|   219k|	  if (resync)
  ------------------
  |  Branch (432:8): [True: 104k, False: 115k]
  ------------------
  433|   104k|	    {
  434|   104k|	      if (!(*s < 128 || (*s >= 0xc0 && *s <= 0xfd)))
  ------------------
  |  Branch (434:14): [True: 29.8k, False: 74.4k]
  |  Branch (434:27): [True: 61.0k, False: 13.3k]
  |  Branch (434:41): [True: 5.26k, False: 55.7k]
  ------------------
  435|  69.1k|		{
  436|       |		  /* Still invalid. */
  437|  69.1k|		  if (p)
  ------------------
  |  Branch (437:9): [True: 36.4k, False: 32.7k]
  ------------------
  438|  36.4k|		    {
  439|  36.4k|		      sprintf (p, "\\x%02x", *s);
  440|  36.4k|		      p += 4;
  441|  36.4k|		    }
  442|  69.1k|		  n += 4;
  443|  69.1k|		  continue;
  444|  69.1k|		}
  445|  35.0k|	      resync = 0;
  446|  35.0k|	    }
  447|   150k|	  if (!nleft)
  ------------------
  |  Branch (447:8): [True: 133k, False: 17.3k]
  ------------------
  448|   133k|	    {
  449|   133k|	      if (!(*s & 0x80))
  ------------------
  |  Branch (449:12): [True: 89.8k, False: 43.4k]
  ------------------
  450|  89.8k|		{
  451|       |                  /* Plain ascii. */
  452|  89.8k|		  if ( delim != -1
  ------------------
  |  Branch (452:10): [True: 89.8k, False: 0]
  ------------------
  453|  89.8k|                       && (*s < 0x20 || *s == 0x7f || *s == delim
  ------------------
  |  Branch (453:28): [True: 39.8k, False: 50.0k]
  |  Branch (453:41): [True: 490, False: 49.5k]
  |  Branch (453:55): [True: 0, False: 49.5k]
  ------------------
  454|  89.8k|                           || (delim && *s == '\\')))
  ------------------
  |  Branch (454:32): [True: 0, False: 49.5k]
  |  Branch (454:41): [True: 0, False: 0]
  ------------------
  455|  40.3k|		    {
  456|  40.3k|		      n++;
  457|  40.3k|		      if (p)
  ------------------
  |  Branch (457:13): [True: 20.1k, False: 20.1k]
  ------------------
  458|  20.1k|			*p++ = '\\';
  459|  40.3k|		      switch (*s)
  460|  40.3k|			{
  461|  1.33k|                        case '\n': n++; if ( p ) *p++ = 'n'; break;
  ------------------
  |  Branch (461:25): [True: 1.33k, False: 38.9k]
  |  Branch (461:46): [True: 666, False: 666]
  ------------------
  462|  2.01k|                        case '\r': n++; if ( p ) *p++ = 'r'; break;
  ------------------
  |  Branch (462:25): [True: 2.01k, False: 38.3k]
  |  Branch (462:46): [True: 1.00k, False: 1.00k]
  ------------------
  463|  1.05k|                        case '\f': n++; if ( p ) *p++ = 'f'; break;
  ------------------
  |  Branch (463:25): [True: 1.05k, False: 39.2k]
  |  Branch (463:46): [True: 528, False: 528]
  ------------------
  464|    610|                        case '\v': n++; if ( p ) *p++ = 'v'; break;
  ------------------
  |  Branch (464:25): [True: 610, False: 39.7k]
  |  Branch (464:46): [True: 305, False: 305]
  ------------------
  465|    584|                        case '\b': n++; if ( p ) *p++ = 'b'; break;
  ------------------
  |  Branch (465:25): [True: 584, False: 39.7k]
  |  Branch (465:46): [True: 292, False: 292]
  ------------------
  466|  19.5k|                        case    0: n++; if ( p ) *p++ = '0'; break;
  ------------------
  |  Branch (466:25): [True: 19.5k, False: 20.7k]
  |  Branch (466:46): [True: 9.76k, False: 9.76k]
  ------------------
  467|  15.1k|			default:
  ------------------
  |  Branch (467:4): [True: 15.1k, False: 25.1k]
  ------------------
  468|  15.1k|			  n += 3;
  469|  15.1k|			  if (p)
  ------------------
  |  Branch (469:10): [True: 7.59k, False: 7.59k]
  ------------------
  470|  7.59k|			    {
  471|  7.59k|			      sprintf (p, "x%02x", *s);
  472|  7.59k|			      p += 3;
  473|  7.59k|			    }
  474|  15.1k|			  break;
  475|  40.3k|			}
  476|  40.3k|		    }
  477|  49.5k|		  else
  478|  49.5k|		    {
  479|  49.5k|		      if (p)
  ------------------
  |  Branch (479:13): [True: 24.7k, False: 24.7k]
  ------------------
  480|  24.7k|			*p++ = *s;
  481|  49.5k|		      n++;
  482|  49.5k|		    }
  483|  89.8k|		}
  484|  43.4k|	      else if ((*s & 0xe0) == 0xc0) /* 110x xxxx */
  ------------------
  |  Branch (484:17): [True: 11.1k, False: 32.3k]
  ------------------
  485|  11.1k|		{
  486|  11.1k|		  val = *s & 0x1f;
  487|  11.1k|		  nleft = 1;
  488|  11.1k|		  encidx = 0;
  489|  11.1k|		  encbuf[encidx++] = *s;
  490|  11.1k|		}
  491|  32.3k|	      else if ((*s & 0xf0) == 0xe0) /* 1110 xxxx */
  ------------------
  |  Branch (491:17): [True: 1.80k, False: 30.5k]
  ------------------
  492|  1.80k|		{
  493|  1.80k|		  val = *s & 0x0f;
  494|  1.80k|		  nleft = 2;
  495|  1.80k|		  encidx = 0;
  496|  1.80k|		  encbuf[encidx++] = *s;
  497|  1.80k|		}
  498|  30.5k|	      else if ((*s & 0xf8) == 0xf0) /* 1111 0xxx */
  ------------------
  |  Branch (498:17): [True: 2.93k, False: 27.5k]
  ------------------
  499|  2.93k|		{
  500|  2.93k|		  val = *s & 0x07;
  501|  2.93k|		  nleft = 3;
  502|  2.93k|		  encidx = 0;
  503|  2.93k|		  encbuf[encidx++] = *s;
  504|  2.93k|		}
  505|  27.5k|	      else if ((*s & 0xfc) == 0xf8) /* 1111 10xx */
  ------------------
  |  Branch (505:17): [True: 954, False: 26.6k]
  ------------------
  506|    954|		{
  507|    954|		  val = *s & 0x03;
  508|    954|		  nleft = 4;
  509|    954|		  encidx = 0;
  510|    954|		  encbuf[encidx++] = *s;
  511|    954|		}
  512|  26.6k|	      else if ((*s & 0xfe) == 0xfc) /* 1111 110x */
  ------------------
  |  Branch (512:17): [True: 760, False: 25.8k]
  ------------------
  513|    760|		{
  514|    760|		  val = *s & 0x01;
  515|    760|		  nleft = 5;
  516|    760|		  encidx = 0;
  517|    760|		  encbuf[encidx++] = *s;
  518|    760|		}
  519|  25.8k|	      else /* Invalid encoding: print as \xNN. */
  520|  25.8k|		{
  521|  25.8k|		  if (p)
  ------------------
  |  Branch (521:9): [True: 11.0k, False: 14.7k]
  ------------------
  522|  11.0k|		    {
  523|  11.0k|		      sprintf (p, "\\x%02x", *s);
  524|  11.0k|		      p += 4;
  525|  11.0k|		    }
  526|  25.8k|		  n += 4;
  527|  25.8k|		  resync = 1;
  528|  25.8k|		}
  529|   133k|	    }
  530|  17.3k|	  else if (*s < 0x80 || *s >= 0xc0) /* Invalid utf-8 */
  ------------------
  |  Branch (530:13): [True: 10.2k, False: 7.06k]
  |  Branch (530:26): [True: 3.33k, False: 3.72k]
  ------------------
  531|  13.6k|	    {
  532|  13.6k|	      if (p)
  ------------------
  |  Branch (532:12): [True: 6.81k, False: 6.81k]
  ------------------
  533|  6.81k|		{
  534|  14.2k|		  for (i = 0; i < encidx; i++)
  ------------------
  |  Branch (534:17): [True: 7.48k, False: 6.81k]
  ------------------
  535|  7.48k|		    {
  536|  7.48k|		      sprintf (p, "\\x%02x", encbuf[i]);
  537|  7.48k|		      p += 4;
  538|  7.48k|		    }
  539|  6.81k|		  sprintf (p, "\\x%02x", *s);
  540|  6.81k|		  p += 4;
  541|  6.81k|		}
  542|  13.6k|	      n += 4 + 4 * encidx;
  543|  13.6k|	      nleft = 0;
  544|  13.6k|	      encidx = 0;
  545|  13.6k|	      resync = 1;
  546|  13.6k|	    }
  547|  3.72k|	  else
  548|  3.72k|	    {
  549|  3.72k|	      encbuf[encidx++] = *s;
  550|  3.72k|	      val <<= 6;
  551|  3.72k|	      val |= *s & 0x3f;
  552|  3.72k|	      if (!--nleft)  /* Ready. */
  ------------------
  |  Branch (552:12): [True: 2.12k, False: 1.59k]
  ------------------
  553|  2.12k|		{
  554|  2.12k|		  if (no_translation)
  ------------------
  |  Branch (554:9): [True: 0, False: 2.12k]
  ------------------
  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|  2.12k|                  else if (with_iconv)
  ------------------
  |  Branch (564:28): [True: 0, False: 2.12k]
  ------------------
  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|  2.12k|		  else 	/* Latin-1 case. */
  588|  2.12k|                    {
  589|  2.12k|		      if (val >= 0x80 && val < 256)
  ------------------
  |  Branch (589:13): [True: 1.75k, False: 374]
  |  Branch (589:28): [True: 550, False: 1.20k]
  ------------------
  590|    550|			{
  591|       |                          /* We can simply print this character */
  592|    550|			  n++;
  593|    550|			  if (p)
  ------------------
  |  Branch (593:10): [True: 275, False: 275]
  ------------------
  594|    275|			    *p++ = val;
  595|    550|			}
  596|  1.57k|		      else
  597|  1.57k|			{
  598|       |                          /* We do not have a translation: print utf8. */
  599|  1.57k|			  if (p)
  ------------------
  |  Branch (599:10): [True: 789, False: 789]
  ------------------
  600|    789|			    {
  601|  2.48k|			      for (i = 0; i < encidx; i++)
  ------------------
  |  Branch (601:22): [True: 1.69k, False: 789]
  ------------------
  602|  1.69k|				{
  603|  1.69k|				  sprintf (p, "\\x%02x", encbuf[i]);
  604|  1.69k|				  p += 4;
  605|  1.69k|				}
  606|    789|			    }
  607|  1.57k|			  n += encidx * 4;
  608|  1.57k|			  encidx = 0;
  609|  1.57k|			}
  610|  2.12k|		    }
  611|  2.12k|		}
  612|       |
  613|  3.72k|	    }
  614|   150k|	}
  615|  13.9k|      if (!buffer)
  ------------------
  |  Branch (615:11): [True: 6.95k, False: 6.95k]
  ------------------
  616|  6.95k|	{
  617|       |          /* Allocate the buffer after the first pass. */
  618|  6.95k|	  buffer = p = xmalloc (n + 1);
  ------------------
  |  |  107|  6.95k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  619|  6.95k|	}
  620|  6.95k|      else if (with_iconv)
  ------------------
  |  Branch (620:16): [True: 0, False: 6.95k]
  ------------------
  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|  6.95k|      else /* Not using iconv. */
  674|  6.95k|	{
  675|  6.95k|	  *p = 0; /* Make sure it is a string. */
  676|  6.95k|	  return buffer;
  677|  6.95k|	}
  678|  13.9k|    }
  679|  6.95k|}

keyid.c:buf32_to_u32:
  105|  62.6k|{
  106|  62.6k|  const unsigned char *p = buffer;
  107|       |
  108|  62.6k|  return (((u32)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
  109|  62.6k|}
parse-packet.c:buf32_to_ulong:
   89|  1.03k|{
   90|  1.03k|  const unsigned char *p = buffer;
   91|       |
   92|  1.03k|  return (((unsigned long)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
   93|  1.03k|}
parse-packet.c:buf32_to_size_t:
   81|  2.98k|{
   82|  2.98k|  const unsigned char *p = buffer;
   83|       |
   84|  2.98k|  return (((size_t)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
   85|  2.98k|}
parse-packet.c:buf32_to_u32:
  105|  56.8k|{
  106|  56.8k|  const unsigned char *p = buffer;
  107|       |
  108|  56.8k|  return (((u32)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
  109|  56.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|}
getkey.c:buf32_to_u32:
  105|  6.13k|{
  106|  6.13k|  const unsigned char *p = buffer;
  107|       |
  108|  6.13k|  return (((u32)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
  109|  6.13k|}

new_armor_context:
  115|  3.44k|{
  116|  3.44k|  armor_filter_context_t *afx;
  117|  3.44k|  gpg_error_t err;
  118|       |
  119|  3.44k|  afx = xcalloc (1, sizeof *afx);
  ------------------
  |  |  109|  3.44k|#define xcalloc(a,b)     gcry_xcalloc ((a),(b))
  ------------------
  120|  3.44k|  if (afx)
  ------------------
  |  Branch (120:7): [True: 3.44k, False: 0]
  ------------------
  121|  3.44k|    {
  122|  3.44k|      err = gcry_md_open (&afx->crc_md, GCRY_MD_CRC24_RFC2440, 0);
  123|  3.44k|      if (err != 0)
  ------------------
  |  Branch (123:11): [True: 0, False: 3.44k]
  ------------------
  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|  3.44k|      afx->refcount = 1;
  132|  3.44k|    }
  133|       |
  134|  3.44k|  return afx;
  135|  3.44k|}
release_armor_context:
  141|  13.6k|{
  142|  13.6k|  if (!afx)
  ------------------
  |  Branch (142:7): [True: 6.81k, False: 6.88k]
  ------------------
  143|  6.81k|    return;
  144|  6.88k|  log_assert (afx->refcount);
  145|  6.88k|  if ( --afx->refcount )
  ------------------
  |  Branch (145:8): [True: 3.44k, False: 3.44k]
  ------------------
  146|  3.44k|    return;
  147|  3.44k|  gcry_md_close (afx->crc_md);
  148|  3.44k|  xfree (afx);
  ------------------
  |  |  104|  3.44k|#define xfree(a)         gcry_free ((a))
  ------------------
  149|  3.44k|}
push_armor_filter:
  154|  3.44k|{
  155|  3.44k|  int rc;
  156|       |
  157|  3.44k|  afx->refcount++;
  158|  3.44k|  rc = iobuf_push_filter (iobuf, armor_filter, afx);
  159|  3.44k|  if (rc)
  ------------------
  |  Branch (159:7): [True: 0, False: 3.44k]
  ------------------
  160|      0|    afx->refcount--;
  161|  3.44k|  return rc;
  162|  3.44k|}
use_armor_filter:
  295|  17.0k|{
  296|  17.0k|    byte buf[2];
  297|  17.0k|    int n;
  298|       |
  299|       |    /* fixme: there might be a problem with iobuf_peek */
  300|  17.0k|    n = iobuf_peek (a, buf, 2);
  301|  17.0k|    if( n == -1 )
  ------------------
  |  Branch (301:9): [True: 0, False: 17.0k]
  ------------------
  302|      0|	return 0; /* EOF, doesn't matter whether armored or not */
  303|  17.0k|    if( !n )
  ------------------
  |  Branch (303:9): [True: 0, False: 17.0k]
  ------------------
  304|      0|	return 1; /* can't check it: try armored */
  305|  17.0k|    if (n != 2)
  ------------------
  |  Branch (305:9): [True: 34, False: 17.0k]
  ------------------
  306|     34|	return 0; /* short buffer */
  307|  17.0k|    return is_armored(buf);
  308|  17.0k|}
armor.c:is_armored:
  218|  32.7k|{
  219|  32.7k|  int ctb, pkttype;
  220|  32.7k|  int indeterminate_length_allowed;
  221|       |
  222|  32.7k|    ctb = *buf;
  223|  32.7k|    if( !(ctb & 0x80) )
  ------------------
  |  Branch (223:9): [True: 17.6k, False: 15.0k]
  ------------------
  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|  17.6k|      return 1;
  228|       |
  229|  15.0k|    pkttype =  ctb & 0x40 ? (ctb & 0x3f) : ((ctb>>2)&0xf);
  ------------------
  |  Branch (229:16): [True: 7.01k, False: 8.07k]
  ------------------
  230|  15.0k|    switch( pkttype ) {
  231|    441|      case PKT_PUBKEY_ENC:
  ------------------
  |  Branch (231:7): [True: 441, False: 14.6k]
  ------------------
  232|  2.42k|      case PKT_SIGNATURE:
  ------------------
  |  Branch (232:7): [True: 1.98k, False: 13.1k]
  ------------------
  233|  2.78k|      case PKT_SYMKEY_ENC:
  ------------------
  |  Branch (233:7): [True: 360, False: 14.7k]
  ------------------
  234|  3.07k|      case PKT_ONEPASS_SIG:
  ------------------
  |  Branch (234:7): [True: 290, False: 14.7k]
  ------------------
  235|  3.20k|      case PKT_SECRET_KEY:
  ------------------
  |  Branch (235:7): [True: 134, False: 14.9k]
  ------------------
  236|  7.92k|      case PKT_PUBLIC_KEY:
  ------------------
  |  Branch (236:7): [True: 4.72k, False: 10.3k]
  ------------------
  237|  8.14k|      case PKT_SECRET_SUBKEY:
  ------------------
  |  Branch (237:7): [True: 214, False: 14.8k]
  ------------------
  238|  8.23k|      case PKT_MARKER:
  ------------------
  |  Branch (238:7): [True: 96, False: 14.9k]
  ------------------
  239|  8.72k|      case PKT_RING_TRUST:
  ------------------
  |  Branch (239:7): [True: 489, False: 14.5k]
  ------------------
  240|  9.24k|      case PKT_USER_ID:
  ------------------
  |  Branch (240:7): [True: 516, False: 14.5k]
  ------------------
  241|  9.35k|      case PKT_PUBLIC_SUBKEY:
  ------------------
  |  Branch (241:7): [True: 110, False: 14.9k]
  ------------------
  242|  10.0k|      case PKT_ATTRIBUTE:
  ------------------
  |  Branch (242:7): [True: 692, False: 14.3k]
  ------------------
  243|  10.3k|      case PKT_MDC:
  ------------------
  |  Branch (243:7): [True: 312, False: 14.7k]
  ------------------
  244|  10.3k|	indeterminate_length_allowed = 0;
  245|  10.3k|        break;
  246|       |
  247|  2.31k|      case PKT_COMPRESSED:
  ------------------
  |  Branch (247:7): [True: 2.31k, False: 12.7k]
  ------------------
  248|  2.54k|      case PKT_ENCRYPTED:
  ------------------
  |  Branch (248:7): [True: 235, False: 14.8k]
  ------------------
  249|  2.69k|      case PKT_ENCRYPTED_MDC:
  ------------------
  |  Branch (249:7): [True: 150, False: 14.9k]
  ------------------
  250|  2.77k|      case PKT_ENCRYPTED_AEAD:
  ------------------
  |  Branch (250:7): [True: 79, False: 15.0k]
  ------------------
  251|  3.77k|      case PKT_PLAINTEXT:
  ------------------
  |  Branch (251:7): [True: 1.00k, False: 14.0k]
  ------------------
  252|  3.94k|      case PKT_OLD_COMMENT:
  ------------------
  |  Branch (252:7): [True: 169, False: 14.9k]
  ------------------
  253|  4.00k|      case PKT_COMMENT:
  ------------------
  |  Branch (253:7): [True: 56, False: 15.0k]
  ------------------
  254|  4.19k|      case PKT_GPG_CONTROL:
  ------------------
  |  Branch (254:7): [True: 195, False: 14.8k]
  ------------------
  255|  4.19k|	indeterminate_length_allowed = 1;
  256|  4.19k|        break;
  257|       |
  258|    535|      default:
  ------------------
  |  Branch (258:7): [True: 535, False: 14.5k]
  ------------------
  259|       |        /* Invalid packet type.  */
  260|    535|        return 1;
  261|  15.0k|    }
  262|       |
  263|  14.5k|    if (! indeterminate_length_allowed)
  ------------------
  |  Branch (263:9): [True: 10.3k, False: 4.19k]
  ------------------
  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|  10.3k|      {
  269|  10.3k|        int new_format;
  270|  10.3k|        int indeterminate_length;
  271|       |
  272|  10.3k|        new_format = !! (ctb & (1 << 6));
  273|  10.3k|        if (new_format)
  ------------------
  |  Branch (273:13): [True: 4.65k, False: 5.70k]
  ------------------
  274|  4.65k|          indeterminate_length = (buf[1] >= 224 && buf[1] < 255);
  ------------------
  |  Branch (274:35): [True: 466, False: 4.18k]
  |  Branch (274:52): [True: 334, False: 132]
  ------------------
  275|  5.70k|        else
  276|  5.70k|          indeterminate_length = (ctb & 3) == 3;
  277|       |
  278|  10.3k|        if (indeterminate_length)
  ------------------
  |  Branch (278:13): [True: 700, False: 9.65k]
  ------------------
  279|    700|          return 1;
  280|  10.3k|      }
  281|       |
  282|       |    /* The first CTB seems legit.  It is probably not armored
  283|       |       data.  */
  284|  13.8k|    return 0;
  285|  14.5k|}
armor.c:armor_filter:
 1284|  50.6k|{
 1285|  50.6k|    size_t size = *ret_len;
 1286|  50.6k|    armor_filter_context_t *afx = opaque;
 1287|  50.6k|    int rc=0, c;
 1288|  50.6k|    byte radbuf[3];
 1289|  50.6k|    int  idx, idx2;
 1290|  50.6k|    size_t n=0;
 1291|  50.6k|    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|  50.6k|    if( DBG_FILTER )
  ------------------
  |  |  351|  50.6k|#define DBG_FILTER (opt.debug & DBG_FILTER_VALUE)
  |  |  ------------------
  |  |  |  |  335|  50.6k|#define DBG_FILTER_VALUE  8	/* debug internal filter handling */
  |  |  ------------------
  |  |  |  Branch (351:20): [True: 0, False: 50.6k]
  |  |  ------------------
  ------------------
 1302|      0|	log_debug("armor-filter: control: %d\n", control );
 1303|  50.6k|    if( control == IOBUFCTRL_UNDERFLOW && afx->inp_bypass ) {
  ------------------
  |  Branch (1303:9): [True: 43.8k, False: 6.88k]
  |  Branch (1303:43): [True: 775, False: 43.0k]
  ------------------
 1304|    775|	n = 0;
 1305|    775|	if( afx->buffer_len ) {
  ------------------
  |  Branch (1305:6): [True: 186, False: 589]
  ------------------
 1306|       |            /* Copy the data from AFX->BUFFER to BUF.  */
 1307|   277k|	    for(; n < size && afx->buffer_pos < afx->buffer_len; n++ )
  ------------------
  |  Branch (1307:12): [True: 277k, False: 132]
  |  Branch (1307:24): [True: 277k, False: 54]
  ------------------
 1308|   277k|		buf[n++] = afx->buffer[afx->buffer_pos++];
 1309|    186|	    if( afx->buffer_pos >= afx->buffer_len )
  ------------------
  |  Branch (1309:10): [True: 54, False: 132]
  ------------------
 1310|     54|		afx->buffer_len = 0;
 1311|    186|	}
 1312|       |        /* If there is still space in BUF, read directly into it.  */
 1313|   571k|	for(; n < size; n++ ) {
  ------------------
  |  Branch (1313:8): [True: 571k, False: 408]
  ------------------
 1314|   571k|	    if( (c=iobuf_get(a)) == -1 )
  ------------------
  |  |  500|   571k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 571k]
  |  |  |  Branch (500:24): [True: 367, False: 571k]
  |  |  ------------------
  |  |  501|   571k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (1314:10): [True: 367, False: 571k]
  ------------------
 1315|    367|		break;
 1316|   571k|	    buf[n] = c & 0xff;
 1317|   571k|	}
 1318|    775|	if( !n )
  ------------------
  |  Branch (1318:6): [True: 196, False: 579]
  ------------------
 1319|       |            /* We didn't get any data.  EOF.  */
 1320|    196|	    rc = -1;
 1321|    775|	*ret_len = n;
 1322|    775|    }
 1323|  49.9k|    else if( control == IOBUFCTRL_UNDERFLOW ) {
  ------------------
  |  Branch (1323:14): [True: 43.0k, False: 6.88k]
  ------------------
 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|  43.0k|	if( size < PARTIAL_CHUNK+1 )
  ------------------
  |  |  636|  43.0k|#define PARTIAL_CHUNK 512
  ------------------
  |  Branch (1327:6): [True: 0, False: 43.0k]
  ------------------
 1328|      0|	    BUG(); /* supplied buffer too short */
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1329|       |
 1330|  43.0k|	if( afx->faked )
  ------------------
  |  Branch (1330:6): [True: 12.3k, False: 30.6k]
  ------------------
 1331|  12.3k|	    rc = fake_packet( afx, a, &n, buf, size );
 1332|  30.6k|	else if( !afx->inp_checked ) {
  ------------------
  |  Branch (1332:11): [True: 18.5k, False: 12.1k]
  ------------------
 1333|  18.5k|	    rc = check_input( afx, a );
 1334|  18.5k|	    if( afx->inp_bypass ) {
  ------------------
  |  Branch (1334:10): [True: 286, False: 18.2k]
  ------------------
 1335|   503k|		for(n=0; n < size && afx->buffer_pos < afx->buffer_len; )
  ------------------
  |  Branch (1335:12): [True: 503k, False: 85]
  |  Branch (1335:24): [True: 502k, False: 201]
  ------------------
 1336|   502k|		    buf[n++] = afx->buffer[afx->buffer_pos++];
 1337|    286|		if( afx->buffer_pos >= afx->buffer_len )
  ------------------
  |  Branch (1337:7): [True: 204, False: 82]
  ------------------
 1338|    204|		    afx->buffer_len = 0;
 1339|    286|		if( !n )
  ------------------
  |  Branch (1339:7): [True: 10, False: 276]
  ------------------
 1340|     10|		    rc = -1;
 1341|    286|	    }
 1342|  18.2k|	    else if( afx->faked ) {
  ------------------
  |  Branch (1342:15): [True: 12.2k, False: 6.04k]
  ------------------
 1343|  12.2k|	        unsigned int hashes = afx->hashes;
 1344|  12.2k|                const byte *sesmark;
 1345|  12.2k|                size_t sesmarklen;
 1346|       |
 1347|  12.2k|                sesmark = get_session_marker( &sesmarklen );
 1348|  12.2k|                if ( sesmarklen > 20 )
  ------------------
  |  Branch (1348:22): [True: 0, False: 12.2k]
  ------------------
 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|  12.2k|		hashes &= 1|2|8|16|32|64;
 1355|  12.2k|		if( !hashes ) {
  ------------------
  |  Branch (1355:7): [True: 7.31k, False: 4.93k]
  ------------------
 1356|  7.31k|		    hashes |= 2;  /* Default to SHA-1. */
 1357|  7.31k|		}
 1358|  12.2k|		n=0;
 1359|       |                /* First a gpg control packet... */
 1360|  12.2k|                buf[n++] = 0xff; /* new format, type 63, 1 length byte */
 1361|  12.2k|                n++;   /* see below */
 1362|  12.2k|                memcpy(buf+n, sesmark, sesmarklen ); n+= sesmarklen;
 1363|  12.2k|                buf[n++] = CTRLPKT_CLEARSIGN_START;
 1364|  12.2k|                buf[n++] = afx->not_dash_escaped? 0:1; /* sigclass */
  ------------------
  |  Branch (1364:28): [True: 402, False: 11.8k]
  ------------------
 1365|  12.2k|                if( hashes & 1 )
  ------------------
  |  Branch (1365:21): [True: 359, False: 11.8k]
  ------------------
 1366|    359|                    buf[n++] = DIGEST_ALGO_RMD160;
 1367|  12.2k|                if( hashes & 2 )
  ------------------
  |  Branch (1367:21): [True: 7.77k, False: 4.47k]
  ------------------
 1368|  7.77k|                    buf[n++] = DIGEST_ALGO_SHA1;
 1369|  12.2k|                if( hashes & 8 )
  ------------------
  |  Branch (1369:21): [True: 466, False: 11.7k]
  ------------------
 1370|    466|                    buf[n++] = DIGEST_ALGO_SHA224;
 1371|  12.2k|                if( hashes & 16 )
  ------------------
  |  Branch (1371:21): [True: 4.43k, False: 7.81k]
  ------------------
 1372|  4.43k|                    buf[n++] = DIGEST_ALGO_SHA256;
 1373|  12.2k|                if( hashes & 32 )
  ------------------
  |  Branch (1373:21): [True: 345, False: 11.9k]
  ------------------
 1374|    345|                    buf[n++] = DIGEST_ALGO_SHA384;
 1375|  12.2k|                if( hashes & 64 )
  ------------------
  |  Branch (1375:21): [True: 322, False: 11.9k]
  ------------------
 1376|    322|                    buf[n++] = DIGEST_ALGO_SHA512;
 1377|  12.2k|                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|  12.2k|		buf[n++] = 0xCB; /* new packet format, type 11 */
 1385|  12.2k|		buf[n++] = 0xE1; /* 2^1 == 2 bytes */
 1386|  12.2k|		buf[n++] = 't';  /* canonical text mode */
 1387|  12.2k|		buf[n++] = 0;	 /* namelength */
 1388|  12.2k|		buf[n++] = 0xE2; /* 2^2 == 4 more bytes */
 1389|  12.2k|		memset(buf+n, 0, 4); /* timestamp */
 1390|  12.2k|		n += 4;
 1391|  12.2k|	    }
 1392|  6.04k|	    else if( !rc )
  ------------------
  |  Branch (1392:15): [True: 6.00k, False: 39]
  ------------------
 1393|  6.00k|		rc = radix64_read( afx, a, &n, buf, size );
 1394|  18.5k|	}
 1395|  12.1k|	else
 1396|  12.1k|	    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|  43.0k|	*ret_len = n;
 1403|  43.0k|    }
 1404|  6.88k|    else if( control == IOBUFCTRL_FLUSH && !afx->cancel ) {
  ------------------
  |  Branch (1404:14): [True: 0, False: 6.88k]
  |  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|  6.88k|    else if( control == IOBUFCTRL_INIT )
  ------------------
  |  Branch (1477:14): [True: 3.44k, False: 3.44k]
  ------------------
 1478|  3.44k|      {
 1479|  3.44k|	if( !is_initialized )
  ------------------
  |  Branch (1479:6): [True: 1, False: 3.43k]
  ------------------
 1480|      1|	  initialize();
 1481|       |
 1482|       |	/* Figure out what we're using for line endings if the caller
 1483|       |	   didn't specify. */
 1484|  3.44k|	if(afx->eol[0]==0)
  ------------------
  |  Branch (1484:5): [True: 3.44k, False: 0]
  ------------------
 1485|  3.44k|	  {
 1486|       |#ifdef HAVE_DOSISH_SYSTEM
 1487|       |	    afx->eol[0]='\r';
 1488|       |	    afx->eol[1]='\n';
 1489|       |#else
 1490|  3.44k|	    afx->eol[0]='\n';
 1491|  3.44k|#endif
 1492|  3.44k|	  }
 1493|  3.44k|      }
 1494|  3.44k|    else if( control == IOBUFCTRL_CANCEL ) {
  ------------------
  |  Branch (1494:14): [True: 0, False: 3.44k]
  ------------------
 1495|      0|	afx->cancel = 1;
 1496|      0|    }
 1497|  3.44k|    else if( control == IOBUFCTRL_FREE ) {
  ------------------
  |  Branch (1497:14): [True: 3.44k, False: 0]
  ------------------
 1498|  3.44k|	if( afx->cancel )
  ------------------
  |  Branch (1498:6): [True: 0, False: 3.44k]
  ------------------
 1499|      0|	    ;
 1500|  3.44k|	else if( afx->status ) { /* pad, write cecksum, and bottom line */
  ------------------
  |  Branch (1500:11): [True: 0, False: 3.44k]
  ------------------
 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|  3.44k|	else if( !afx->any_data && !afx->inp_bypass ) {
  ------------------
  |  Branch (1553:11): [True: 1.96k, False: 1.48k]
  |  Branch (1553:29): [True: 1.94k, False: 16]
  ------------------
 1554|  1.94k|	    log_error(_("no valid OpenPGP data found.\n"));
  ------------------
  |  |   28|  1.94k|#  define _(a) gettext (a)
  ------------------
 1555|  1.94k|	    afx->no_openpgp_data = 1;
 1556|  1.94k|	    write_status_text( STATUS_NODATA, "1" );
 1557|  1.94k|	}
 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|  3.44k|	if( afx->truncated )
  ------------------
  |  Branch (1563:6): [True: 15, False: 3.42k]
  ------------------
 1564|     15|	    log_info(_("invalid armor: line longer than %d characters\n"),
  ------------------
  |  |   28|     15|#  define _(a) gettext (a)
  ------------------
 1565|     15|		      MAX_LINELEN );
  ------------------
  |  |   38|     15|#define MAX_LINELEN 20000
  ------------------
 1566|       |	/* issue an error to enforce dissemination of correct software */
 1567|  3.44k|	if( afx->qp_detected )
  ------------------
  |  Branch (1567:6): [True: 45, False: 3.39k]
  ------------------
 1568|     45|	    log_error(_("quoted printable character in armor - "
  ------------------
  |  |   28|     45|#  define _(a) gettext (a)
  ------------------
 1569|     45|			"probably a buggy MTA has been used\n") );
 1570|  3.44k|	xfree( afx->buffer );
  ------------------
  |  |  104|  3.44k|#define xfree(a)         gcry_free ((a))
  ------------------
 1571|  3.44k|	afx->buffer = NULL;
 1572|  3.44k|        release_armor_context (afx);
 1573|  3.44k|    }
 1574|      0|    else if( control == IOBUFCTRL_DESC )
  ------------------
  |  Branch (1574:14): [True: 0, False: 0]
  ------------------
 1575|      0|        mem2str (buf, "armor_filter", *ret_len);
 1576|  50.6k|    return rc;
 1577|  50.6k|}
armor.c:fake_packet:
  647|  12.3k|{
  648|  12.3k|    int rc = 0;
  649|  12.3k|    size_t len = 0;
  650|  12.3k|    int lastline = 0;
  651|  12.3k|    unsigned maxlen, n;
  652|  12.3k|    byte *p;
  653|  12.3k|    byte tempbuf[PARTIAL_CHUNK];
  654|  12.3k|    size_t tempbuf_len=0;
  655|  12.3k|    int this_truncated;
  656|       |
  657|   421k|    while( !rc && size-len>=(PARTIAL_CHUNK+1)) {
  ------------------
  |  |  636|   409k|#define PARTIAL_CHUNK 512
  ------------------
  |  Branch (657:12): [True: 409k, False: 12.2k]
  |  Branch (657:19): [True: 409k, False: 101]
  ------------------
  658|       |	/* copy what we have in the line buffer */
  659|   409k|	if( afx->faked == 1 )
  ------------------
  |  Branch (659:6): [True: 12.2k, False: 397k]
  ------------------
  660|  12.2k|	    afx->faked++; /* skip the first (empty) line */
  661|   397k|	else
  662|   397k|	  {
  663|       |	    /* It's full, so write this partial chunk */
  664|   397k|	    if(tempbuf_len==PARTIAL_CHUNK)
  ------------------
  |  |  636|   397k|#define PARTIAL_CHUNK 512
  ------------------
  |  Branch (664:9): [True: 2.91k, False: 394k]
  ------------------
  665|  2.91k|	      {
  666|  2.91k|		buf[len++]=0xE0+PARTIAL_POW;
  ------------------
  |  |  637|  2.91k|#define PARTIAL_POW   9
  ------------------
  667|  2.91k|		memcpy(&buf[len],tempbuf,PARTIAL_CHUNK);
  ------------------
  |  |  636|  2.91k|#define PARTIAL_CHUNK 512
  ------------------
  668|  2.91k|		len+=PARTIAL_CHUNK;
  ------------------
  |  |  636|  2.91k|#define PARTIAL_CHUNK 512
  ------------------
  669|  2.91k|		tempbuf_len=0;
  670|  2.91k|		continue;
  671|  2.91k|	      }
  672|       |
  673|  2.20M|	    while( tempbuf_len < PARTIAL_CHUNK
  ------------------
  |  |  636|  4.40M|#define PARTIAL_CHUNK 512
  ------------------
  |  Branch (673:13): [True: 2.19M, False: 2.91k]
  ------------------
  674|  2.20M|		   && afx->buffer_pos < afx->buffer_len )
  ------------------
  |  Branch (674:9): [True: 1.80M, False: 391k]
  ------------------
  675|  1.80M|	      tempbuf[tempbuf_len++] = afx->buffer[afx->buffer_pos++];
  676|   394k|	    if( tempbuf_len==PARTIAL_CHUNK )
  ------------------
  |  |  636|   394k|#define PARTIAL_CHUNK 512
  ------------------
  |  Branch (676:10): [True: 2.91k, False: 391k]
  ------------------
  677|  2.91k|	      continue;
  678|   394k|	  }
  679|       |
  680|       |	/* read the next line */
  681|   403k|	maxlen = MAX_LINELEN;
  ------------------
  |  |   38|   403k|#define MAX_LINELEN 20000
  ------------------
  682|   403k|	afx->buffer_pos = 0;
  683|   403k|	afx->buffer_len = iobuf_read_line( a, &afx->buffer,
  684|   403k|					   &afx->buffer_size, &maxlen );
  685|   403k|	if( !afx->buffer_len ) {
  ------------------
  |  Branch (685:6): [True: 561, False: 403k]
  ------------------
  686|    561|	    rc = -1; /* eof (should not happen) */
  687|    561|	    continue;
  688|    561|	}
  689|   403k|	if( !maxlen )
  ------------------
  |  Branch (689:6): [True: 12, False: 403k]
  ------------------
  690|     12|          {
  691|     12|	    afx->truncated++;
  692|     12|            this_truncated = 1;
  693|     12|          }
  694|   403k|        else
  695|   403k|          this_truncated = 0;
  696|       |
  697|       |
  698|   403k|	p = afx->buffer;
  699|   403k|	n = afx->buffer_len;
  700|       |
  701|       |	/* Armor header or dash-escaped line? */
  702|   403k|	if(p[0]=='-')
  ------------------
  |  Branch (702:5): [True: 15.6k, False: 387k]
  ------------------
  703|  15.6k|	  {
  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|  15.6k|	    if(p[1]==' ' && !afx->not_dash_escaped)
  ------------------
  |  Branch (710:9): [True: 350, False: 15.2k]
  |  Branch (710:22): [True: 162, False: 188]
  ------------------
  711|    162|	      {
  712|       |		/* It's a dash-escaped line, so skip over the
  713|       |		   escape. */
  714|    162|		afx->buffer_pos = 2;
  715|    162|	      }
  716|  15.4k|	    else if(p[1]=='-' && p[2]=='-' && p[3]=='-' && p[4]=='-')
  ------------------
  |  Branch (716:14): [True: 14.1k, False: 1.29k]
  |  Branch (716:27): [True: 13.5k, False: 669]
  |  Branch (716:40): [True: 13.0k, False: 463]
  |  Branch (716:53): [True: 12.5k, False: 467]
  ------------------
  717|  12.5k|	      {
  718|       |		/* Five dashes in a row mean it's probably armor
  719|       |		   header. */
  720|  12.5k|		int type = is_armor_header( p, n );
  721|  12.5k|                if (type == 42)
  ------------------
  |  Branch (721:21): [True: 431, False: 12.1k]
  ------------------
  722|    431|                  type = -1;  /* Only OpenPGP armors are expected.  */
  723|  12.5k|		if( afx->not_dash_escaped && type != BEGIN_SIGNATURE )
  ------------------
  |  |   82|  1.23k|#define BEGIN_SIGNATURE 2
  ------------------
  |  Branch (723:7): [True: 1.23k, False: 11.3k]
  |  Branch (723:32): [True: 896, False: 342]
  ------------------
  724|    896|		  ; /* this is okay */
  725|  11.6k|		else
  726|  11.6k|		  {
  727|  11.6k|		    if( type != BEGIN_SIGNATURE )
  ------------------
  |  |   82|  11.6k|#define BEGIN_SIGNATURE 2
  ------------------
  |  Branch (727:11): [True: 11.2k, False: 452]
  ------------------
  728|  11.2k|		      {
  729|  11.2k|			log_info(_("unexpected armor: "));
  ------------------
  |  |   28|  11.2k|#  define _(a) gettext (a)
  ------------------
  730|  11.2k|			es_write_sanitized (log_get_stream (), p, n,
  731|  11.2k|                                            NULL, NULL);
  732|  11.2k|			log_printf ("\n");
  733|  11.2k|		      }
  734|       |
  735|  11.6k|		    lastline = 1;
  736|  11.6k|		    rc = -1;
  737|  11.6k|		  }
  738|  12.5k|	      }
  739|  2.89k|	    else if(!afx->not_dash_escaped)
  ------------------
  |  Branch (739:14): [True: 2.45k, False: 441]
  ------------------
  740|  2.45k|	      {
  741|       |		/* Bad dash-escaping. */
  742|  2.45k|		log_info (_("invalid dash escaped line: "));
  ------------------
  |  |   28|  2.45k|#  define _(a) gettext (a)
  ------------------
  743|  2.45k|		es_write_sanitized (log_get_stream (), p, n, NULL, NULL);
  744|  2.45k|		log_printf ("\n");
  745|  2.45k|	      }
  746|  15.6k|	  }
  747|       |
  748|       |	/* Now handle the end-of-line canonicalization */
  749|   403k|	if( !afx->not_dash_escaped || this_truncated)
  ------------------
  |  Branch (749:6): [True: 400k, False: 2.68k]
  |  Branch (749:32): [True: 3, False: 2.68k]
  ------------------
  750|   400k|	  {
  751|   400k|	    int crlf = n > 1 && p[n-2] == '\r' && p[n-1]=='\n';
  ------------------
  |  Branch (751:17): [True: 116k, False: 284k]
  |  Branch (751:26): [True: 1.20k, False: 115k]
  |  Branch (751:44): [True: 1.19k, False: 7]
  ------------------
  752|       |
  753|   400k|	    afx->buffer_len=
  754|   400k|	      trim_trailing_chars( &p[afx->buffer_pos], n-afx->buffer_pos,
  755|   400k|				   " \t\r\n");
  756|   400k|	    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|   400k|	    if( crlf )
  ------------------
  |  Branch (774:10): [True: 1.19k, False: 399k]
  ------------------
  775|  1.19k|	      afx->buffer[afx->buffer_len++] = '\r';
  776|   400k|	    afx->buffer[afx->buffer_len++] = this_truncated? '\f':'\n';
  ------------------
  |  Branch (776:39): [True: 12, False: 400k]
  ------------------
  777|   400k|	    afx->buffer[afx->buffer_len] = '\0';
  778|   400k|	  }
  779|   403k|    }
  780|       |
  781|  12.3k|    if( lastline ) { /* write last (ending) length header */
  ------------------
  |  Branch (781:9): [True: 11.6k, False: 662]
  ------------------
  782|  11.6k|        if(tempbuf_len<192)
  ------------------
  |  Branch (782:12): [True: 11.0k, False: 666]
  ------------------
  783|  11.0k|	  buf[len++]=tempbuf_len;
  784|    666|	else
  785|    666|	  {
  786|    666|	    buf[len++]=((tempbuf_len-192)/256) + 192;
  787|    666|	    buf[len++]=(tempbuf_len-192) % 256;
  788|    666|	  }
  789|  11.6k|	memcpy(&buf[len],tempbuf,tempbuf_len);
  790|  11.6k|	len+=tempbuf_len;
  791|       |
  792|  11.6k|	rc = 0;
  793|  11.6k|	afx->faked = 0;
  794|  11.6k|	afx->in_cleartext = 0;
  795|       |	/* and now read the header lines */
  796|  11.6k|	afx->buffer_pos = 0;
  797|  11.8k|	for(;;) {
  798|  11.8k|	    int i;
  799|       |
  800|       |	    /* read the next line (skip all truncated lines) */
  801|  11.8k|	    do {
  802|  11.8k|		maxlen = MAX_LINELEN;
  ------------------
  |  |   38|  11.8k|#define MAX_LINELEN 20000
  ------------------
  803|  11.8k|		afx->buffer_len = iobuf_read_line( a, &afx->buffer,
  804|  11.8k|						 &afx->buffer_size, &maxlen );
  805|  11.8k|	    } while( !maxlen );
  ------------------
  |  Branch (805:15): [True: 6, False: 11.8k]
  ------------------
  806|  11.8k|	    p = afx->buffer;
  807|  11.8k|	    n = afx->buffer_len;
  808|  11.8k|	    if( !n ) {
  ------------------
  |  Branch (808:10): [True: 236, False: 11.5k]
  ------------------
  809|    236|		rc = -1;
  810|    236|		break; /* eof */
  811|    236|	    }
  812|  11.5k|	    i = parse_header_line( afx, p , n );
  813|  11.5k|	    if( i <= 0 ) {
  ------------------
  |  Branch (813:10): [True: 11.4k, False: 154]
  ------------------
  814|  11.4k|		if( i )
  ------------------
  |  Branch (814:7): [True: 4.79k, False: 6.65k]
  ------------------
  815|  4.79k|		    invalid_armor();
  816|  11.4k|		break;
  817|  11.4k|	    }
  818|  11.5k|	}
  819|  11.6k|	afx->inp_checked = 1;
  820|  11.6k|	gcry_md_reset (afx->crc_md);
  821|  11.6k|	afx->idx = 0;
  822|  11.6k|	afx->radbuf[0] = 0;
  823|  11.6k|    }
  824|       |
  825|  12.3k|    *retn = len;
  826|  12.3k|    return rc;
  827|  12.3k|}
armor.c:is_armor_header:
  393|  82.1k|{
  394|  82.1k|    const char *s;
  395|  82.1k|    byte *save_p, *p;
  396|  82.1k|    int save_c;
  397|  82.1k|    int i;
  398|       |
  399|  82.1k|    if( len < 15 )
  ------------------
  |  Branch (399:9): [True: 46.9k, False: 35.1k]
  ------------------
  400|  46.9k|	return -1; /* too short */
  401|  35.1k|    if( memcmp( line, "-----", 5 ) )
  ------------------
  |  Branch (401:9): [True: 8.70k, False: 26.4k]
  ------------------
  402|  8.70k|	return -1; /* no */
  403|  26.4k|    p = strstr( line+5, "-----");
  404|  26.4k|    if( !p )
  ------------------
  |  Branch (404:9): [True: 4.46k, False: 22.0k]
  ------------------
  405|  4.46k|	return -1;
  406|  22.0k|    save_p = p;
  407|  22.0k|    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|  22.0k|    if(RFC2440)
  ------------------
  |  |  373|  22.0k|#define RFC2440 (opt.compliance==CO_RFC2440)
  |  |  ------------------
  |  |  |  Branch (373:17): [True: 0, False: 22.0k]
  |  |  ------------------
  ------------------
  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|  22.0k|    else
  425|  43.9k|      while(*p==' ' || *p=='\r' || *p=='\n' || *p=='\t')
  ------------------
  |  Branch (425:13): [True: 44, False: 43.9k]
  |  Branch (425:24): [True: 245, False: 43.6k]
  |  Branch (425:36): [True: 21.6k, False: 22.0k]
  |  Branch (425:48): [True: 56, False: 22.0k]
  ------------------
  426|  21.9k|	p++;
  427|       |
  428|  22.0k|    if( *p )
  ------------------
  |  Branch (428:9): [True: 262, False: 21.7k]
  ------------------
  429|    262|	return -1; /* garbage after dashes */
  430|  21.7k|    save_c = *save_p; *save_p = 0;
  431|  21.7k|    p = line+5;
  432|  91.0k|    for(i=0; (s=head_strings[i]); i++ )
  ------------------
  |  Branch (432:14): [True: 87.5k, False: 3.51k]
  ------------------
  433|  87.5k|	if( !strcmp(s, p) )
  ------------------
  |  Branch (433:6): [True: 18.2k, False: 69.3k]
  ------------------
  434|  18.2k|	    break;
  435|  21.7k|    *save_p = save_c;
  436|  21.7k|    if (!s)
  ------------------
  |  Branch (436:9): [True: 3.51k, False: 18.2k]
  ------------------
  437|  3.51k|      {
  438|  3.51k|        if (!strncmp (p, "BEGIN ", 6))
  ------------------
  |  Branch (438:13): [True: 1.96k, False: 1.55k]
  ------------------
  439|  1.96k|          return 42;
  440|  1.55k|	return -1; /* unknown armor line */
  441|  3.51k|      }
  442|       |
  443|  18.2k|    if( opt.verbose > 1 )
  ------------------
  |  Branch (443:9): [True: 0, False: 18.2k]
  ------------------
  444|      0|	log_info(_("armor: %s\n"), head_strings[i]);
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  445|  18.2k|    return i;
  446|  21.7k|}
armor.c:parse_header_line:
  458|  31.5k|{
  459|  31.5k|    byte *p;
  460|  31.5k|    int hashes=0;
  461|  31.5k|    unsigned int len2;
  462|       |
  463|  31.5k|    len2 = length_sans_trailing_ws ( line, len );
  464|  31.5k|    if( !len2 ) {
  ------------------
  |  Branch (464:9): [True: 17.2k, False: 14.3k]
  ------------------
  465|  17.2k|        afx->buffer_pos = len2;  /* (it is not the fine way to do it here) */
  466|  17.2k|	return 0; /* WS only: same as empty line */
  467|  17.2k|    }
  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|  14.3k|    p = strchr( line, ':');
  480|  14.3k|    if (!p && afx->dearmor_state)
  ------------------
  |  Branch (480:9): [True: 9.17k, False: 5.13k]
  |  Branch (480:15): [True: 0, False: 9.17k]
  ------------------
  481|      0|      return 0; /* Special treatment in --dearmor mode.  */
  482|  14.3k|    if( !p || (RFC2440 && p[1]!=' ')
  ------------------
  |  |  373|  10.2k|#define RFC2440 (opt.compliance==CO_RFC2440)
  |  |  ------------------
  |  |  |  Branch (373:17): [True: 0, False: 5.13k]
  |  |  ------------------
  ------------------
  |  Branch (482:9): [True: 9.17k, False: 5.13k]
  |  Branch (482:27): [True: 0, False: 0]
  ------------------
  483|  14.3k|	|| (!RFC2440 && p[1]!=' ' && p[1]!='\n' && p[1]!='\r'))
  ------------------
  |  |  373|  10.2k|#define RFC2440 (opt.compliance==CO_RFC2440)
  ------------------
  |  Branch (483:6): [True: 5.13k, False: 0]
  |  Branch (483:18): [True: 2.31k, False: 2.82k]
  |  Branch (483:31): [True: 1.21k, False: 1.09k]
  |  Branch (483:45): [True: 1.12k, False: 96]
  ------------------
  484|  10.2k|      {
  485|  10.2k|	log_error (_("invalid armor header: "));
  ------------------
  |  |   28|  10.2k|#  define _(a) gettext (a)
  ------------------
  486|  10.2k|	es_write_sanitized (log_get_stream (), line, len, NULL, NULL);
  487|  10.2k|	log_printf ("\n");
  488|  10.2k|	return -1;
  489|  10.2k|      }
  490|       |
  491|       |    /* Chop off the whitespace we detected before */
  492|  4.01k|    len=len2;
  493|  4.01k|    line[len2]='\0';
  494|       |
  495|  4.01k|    if( opt.verbose ) {
  ------------------
  |  Branch (495:9): [True: 0, False: 4.01k]
  ------------------
  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|  4.01k|    if (afx->dearmor_mode)
  ------------------
  |  Branch (501:9): [True: 0, False: 4.01k]
  ------------------
  502|      0|      ;
  503|  4.01k|    else if (afx->in_cleartext)
  ------------------
  |  Branch (503:14): [True: 2.48k, False: 1.53k]
  ------------------
  504|  2.48k|      {
  505|  2.48k|	if( (hashes=parse_hash_header( line )) )
  ------------------
  |  Branch (505:6): [True: 747, False: 1.73k]
  ------------------
  506|    747|	  afx->hashes |= hashes;
  507|  1.73k|	else if( strlen(line) > 15 && !memcmp( line, "NotDashEscaped:", 15 ) )
  ------------------
  |  Branch (507:11): [True: 637, False: 1.10k]
  |  Branch (507:32): [True: 215, False: 422]
  ------------------
  508|    215|	  afx->not_dash_escaped = 1;
  509|  1.52k|	else
  510|  1.52k|	  {
  511|  1.52k|	    log_error(_("invalid clearsig header\n"));
  ------------------
  |  |   28|  1.52k|#  define _(a) gettext (a)
  ------------------
  512|  1.52k|	    return -1;
  513|  1.52k|	  }
  514|  2.48k|      }
  515|  1.53k|    else if(!is_armor_tag(line))
  ------------------
  |  Branch (515:13): [True: 1.03k, False: 500]
  ------------------
  516|  1.03k|      {
  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|  1.03k|	log_info(_("unknown armor header: "));
  ------------------
  |  |   28|  1.03k|#  define _(a) gettext (a)
  ------------------
  525|  1.03k|	es_write_sanitized (log_get_stream (), line, len, NULL, NULL);
  526|  1.03k|	log_printf ("\n");
  527|  1.03k|      }
  528|       |
  529|  2.49k|    return 1;
  530|  4.01k|}
armor.c:parse_hash_header:
  332|  2.48k|{
  333|  2.48k|    const char *s, *s2;
  334|  2.48k|    unsigned found = 0;
  335|       |
  336|  2.48k|    if( strlen(line) < 6  || strlen(line) > 60 )
  ------------------
  |  Branch (336:9): [True: 427, False: 2.05k]
  |  Branch (336:30): [True: 20, False: 2.03k]
  ------------------
  337|    447|	return 0; /* too short or too long */
  338|  2.03k|    if( memcmp( line, "Hash:", 5 ) )
  ------------------
  |  Branch (338:9): [True: 401, False: 1.63k]
  ------------------
  339|    401|	return 0; /* invalid header */
  340|       |
  341|  3.34k|    for(s=line+5;;s=s2) {
  342|  5.02k|	for(; *s && (*s==' ' || *s == '\t'); s++ )
  ------------------
  |  Branch (342:8): [True: 4.27k, False: 747]
  |  Branch (342:15): [True: 1.65k, False: 2.61k]
  |  Branch (342:26): [True: 22, False: 2.59k]
  ------------------
  343|  1.68k|	    ;
  344|  3.34k|	if( !*s )
  ------------------
  |  Branch (344:6): [True: 747, False: 2.59k]
  ------------------
  345|    747|	    break;
  346|  11.3k|	for(s2=s+1; *s2 && *s2!=' ' && *s2 != '\t' && *s2 != ','; s2++ )
  ------------------
  |  Branch (346:14): [True: 10.0k, False: 1.22k]
  |  Branch (346:21): [True: 9.87k, False: 208]
  |  Branch (346:33): [True: 9.69k, False: 186]
  |  Branch (346:48): [True: 8.72k, False: 972]
  ------------------
  347|  8.72k|	    ;
  348|  2.59k|	if( !strncmp( s, "RIPEMD160", s2-s ) )
  ------------------
  |  Branch (348:6): [True: 212, False: 2.38k]
  ------------------
  349|    212|	    found |= 1;
  350|  2.38k|	else if( !strncmp( s, "SHA1", s2-s ) )
  ------------------
  |  Branch (350:11): [True: 752, False: 1.63k]
  ------------------
  351|    752|	    found |= 2;
  352|  1.63k|	else if( !strncmp( s, "SHA224", s2-s ) )
  ------------------
  |  Branch (352:11): [True: 534, False: 1.09k]
  ------------------
  353|    534|	    found |= 8;
  354|  1.09k|	else if( !strncmp( s, "SHA256", s2-s ) )
  ------------------
  |  Branch (354:11): [True: 86, False: 1.01k]
  ------------------
  355|     86|	    found |= 16;
  356|  1.01k|	else if( !strncmp( s, "SHA384", s2-s ) )
  ------------------
  |  Branch (356:11): [True: 56, False: 954]
  ------------------
  357|     56|	    found |= 32;
  358|    954|	else if( !strncmp( s, "SHA512", s2-s ) )
  ------------------
  |  Branch (358:11): [True: 224, False: 730]
  ------------------
  359|    224|	    found |= 64;
  360|    730|	else
  361|    730|	    return 0;
  362|  2.04k|	for(; *s2 && (*s2==' ' || *s2 == '\t'); s2++ )
  ------------------
  |  Branch (362:8): [True: 1.29k, False: 743]
  |  Branch (362:16): [True: 173, False: 1.12k]
  |  Branch (362:28): [True: 4, False: 1.12k]
  ------------------
  363|    177|	    ;
  364|  1.86k|	if( *s2 && *s2 != ',' )
  ------------------
  |  Branch (364:6): [True: 1.12k, False: 743]
  |  Branch (364:13): [True: 159, False: 962]
  ------------------
  365|    159|	    return 0;
  366|  1.70k|	if( *s2 )
  ------------------
  |  Branch (366:6): [True: 962, False: 743]
  ------------------
  367|    962|	    s2++;
  368|  1.70k|    }
  369|    747|    return found;
  370|  1.63k|}
armor.c:is_armor_tag:
  375|  1.53k|{
  376|  1.53k|  if(strncmp(line,"Version",7)==0
  ------------------
  |  Branch (376:6): [True: 17, False: 1.51k]
  ------------------
  377|  1.53k|     || strncmp(line,"Comment",7)==0
  ------------------
  |  Branch (377:9): [True: 81, False: 1.43k]
  ------------------
  378|  1.53k|     || strncmp(line,"MessageID",9)==0
  ------------------
  |  Branch (378:9): [True: 64, False: 1.36k]
  ------------------
  379|  1.53k|     || strncmp(line,"Hash",4)==0
  ------------------
  |  Branch (379:9): [True: 255, False: 1.11k]
  ------------------
  380|  1.53k|     || strncmp(line,"Charset",7)==0)
  ------------------
  |  Branch (380:9): [True: 83, False: 1.03k]
  ------------------
  381|    500|    return 1;
  382|       |
  383|  1.03k|  return 0;
  384|  1.53k|}
armor.c:invalid_armor:
  315|  4.79k|{
  316|  4.79k|    write_status(STATUS_BADARMOR);
  317|       |#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  318|       |    g10_exit(1); /* stop here */
  319|       |#endif
  320|  4.79k|}
armor.c:check_input:
  537|  18.5k|{
  538|  18.5k|    int rc = 0;
  539|  18.5k|    int i;
  540|  18.5k|    byte *line;
  541|  18.5k|    unsigned len;
  542|  18.5k|    unsigned maxlen;
  543|  18.5k|    int hdr_line = -1;
  544|       |
  545|       |    /* read the first line to see whether this is armored data */
  546|  18.5k|    maxlen = MAX_LINELEN;
  ------------------
  |  |   38|  18.5k|#define MAX_LINELEN 20000
  ------------------
  547|  18.5k|    len = afx->buffer_len = iobuf_read_line( a, &afx->buffer,
  548|  18.5k|					     &afx->buffer_size, &maxlen );
  549|  18.5k|    line = afx->buffer;
  550|  18.5k|    if( !maxlen ) {
  ------------------
  |  Branch (550:9): [True: 19, False: 18.5k]
  ------------------
  551|       |	/* line has been truncated: assume not armored */
  552|     19|	afx->inp_checked = 1;
  553|     19|	afx->inp_bypass = 1;
  554|     19|	return 0;
  555|     19|    }
  556|       |
  557|  18.5k|    if( !len ) {
  ------------------
  |  Branch (557:9): [True: 39, False: 18.5k]
  ------------------
  558|     39|	return -1; /* eof */
  559|     39|    }
  560|       |
  561|       |    /* (the line is always a C string but maybe longer) */
  562|  18.5k|    if( *line == '\n' || ( len && (*line == '\r' && line[1]=='\n') ) )
  ------------------
  |  Branch (562:9): [True: 2.21k, False: 16.3k]
  |  Branch (562:28): [True: 16.3k, False: 0]
  |  Branch (562:36): [True: 700, False: 15.6k]
  |  Branch (562:53): [True: 610, False: 90]
  ------------------
  563|  2.82k|	;
  564|  15.7k|    else if (len >= 2 && !is_armored (line)) {
  ------------------
  |  Branch (564:14): [True: 15.6k, False: 21]
  |  Branch (564:26): [True: 267, False: 15.4k]
  ------------------
  565|    267|	afx->inp_checked = 1;
  566|    267|	afx->inp_bypass = 1;
  567|    267|	return 0;
  568|    267|    }
  569|       |
  570|       |    /* find the armor header */
  571|  70.2k|    while(len) {
  ------------------
  |  Branch (571:11): [True: 69.6k, False: 665]
  ------------------
  572|  69.6k|	i = is_armor_header( line, len );
  573|  69.6k|        if ( i == 42 ) {
  ------------------
  |  Branch (573:14): [True: 1.53k, False: 68.0k]
  ------------------
  574|  1.53k|            if (afx->dearmor_mode) {
  ------------------
  |  Branch (574:17): [True: 0, False: 1.53k]
  ------------------
  575|      0|                afx->dearmor_state = 1;
  576|      0|                break;
  577|      0|            }
  578|  1.53k|        }
  579|  68.0k|        else if (i >= 0
  ------------------
  |  Branch (579:18): [True: 17.5k, False: 50.4k]
  ------------------
  580|  68.0k|                 && !(afx->only_keyblocks && i != 1 && i != 5 && i != 6 )) {
  ------------------
  |  Branch (580:23): [True: 0, False: 17.5k]
  |  Branch (580:46): [True: 0, False: 0]
  |  Branch (580:56): [True: 0, False: 0]
  |  Branch (580:66): [True: 0, False: 0]
  ------------------
  581|  17.5k|	    hdr_line = i;
  582|  17.5k|	    if( hdr_line == BEGIN_SIGNED_MSG_IDX ) {
  ------------------
  |  |   83|  17.5k|#define BEGIN_SIGNED_MSG_IDX 3
  ------------------
  |  Branch (582:10): [True: 12.2k, False: 5.34k]
  ------------------
  583|  12.2k|	        if( afx->in_cleartext ) {
  ------------------
  |  Branch (583:14): [True: 0, False: 12.2k]
  ------------------
  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|  12.2k|		afx->in_cleartext = 1;
  588|  12.2k|	    }
  589|  17.5k|	    break;
  590|  17.5k|	}
  591|       |
  592|       |	/* read the next line (skip all truncated lines) */
  593|  52.0k|	do {
  594|  52.0k|	    maxlen = MAX_LINELEN;
  ------------------
  |  |   38|  52.0k|#define MAX_LINELEN 20000
  ------------------
  595|  52.0k|	    afx->buffer_len = iobuf_read_line( a, &afx->buffer,
  596|  52.0k|					       &afx->buffer_size, &maxlen );
  597|  52.0k|	    line = afx->buffer;
  598|  52.0k|	    len = afx->buffer_len;
  599|  52.0k|	} while( !maxlen );
  ------------------
  |  Branch (599:11): [True: 12, False: 52.0k]
  ------------------
  600|  52.0k|    }
  601|       |
  602|       |    /* Parse the header lines.  */
  603|  20.5k|    while(len) {
  ------------------
  |  Branch (603:11): [True: 19.9k, False: 665]
  ------------------
  604|       |	/* Read the next line (skip all truncated lines). */
  605|  19.9k|	do {
  606|  19.9k|	    maxlen = MAX_LINELEN;
  ------------------
  |  |   38|  19.9k|#define MAX_LINELEN 20000
  ------------------
  607|  19.9k|	    afx->buffer_len = iobuf_read_line( a, &afx->buffer,
  608|  19.9k|					       &afx->buffer_size, &maxlen );
  609|  19.9k|	    line = afx->buffer;
  610|  19.9k|	    len = afx->buffer_len;
  611|  19.9k|	} while( !maxlen );
  ------------------
  |  Branch (611:11): [True: 3, False: 19.9k]
  ------------------
  612|       |
  613|  19.9k|	i = parse_header_line( afx, line, len );
  614|  19.9k|	if( i <= 0 ) {
  ------------------
  |  Branch (614:6): [True: 17.5k, False: 2.33k]
  ------------------
  615|  17.5k|	    if (i && RFC2440)
  ------------------
  |  |  373|  7.03k|#define RFC2440 (opt.compliance==CO_RFC2440)
  |  |  ------------------
  |  |  |  Branch (373:17): [True: 0, False: 7.03k]
  |  |  ------------------
  ------------------
  |  Branch (615:10): [True: 7.03k, False: 10.5k]
  ------------------
  616|      0|		rc = GPG_ERR_INV_ARMOR;
  617|  17.5k|	    break;
  618|  17.5k|	}
  619|  19.9k|    }
  620|       |
  621|       |
  622|  18.2k|    if( rc )
  ------------------
  |  Branch (622:9): [True: 0, False: 18.2k]
  ------------------
  623|      0|	invalid_armor();
  624|  18.2k|    else if( afx->in_cleartext )
  ------------------
  |  Branch (624:14): [True: 12.2k, False: 6.00k]
  ------------------
  625|  12.2k|	afx->faked = 1;
  626|  6.00k|    else {
  627|  6.00k|	afx->inp_checked = 1;
  628|  6.00k|	gcry_md_reset (afx->crc_md);
  629|  6.00k|	afx->idx = 0;
  630|  6.00k|	afx->radbuf[0] = 0;
  631|  6.00k|    }
  632|       |
  633|  18.2k|    return rc;
  634|  18.5k|}
armor.c:radix64_read:
  843|  18.1k|{
  844|  18.1k|    byte val;
  845|  18.1k|    int c;
  846|  18.1k|    u32 binc;
  847|  18.1k|    int checkcrc=0;
  848|  18.1k|    int rc = 0;
  849|  18.1k|    size_t n = 0;
  850|  18.1k|    int idx, onlypad=0;
  851|  18.1k|    int skip_fast = 0;
  852|       |
  853|  18.1k|    idx = afx->idx;
  854|  18.1k|    val = afx->radbuf[0];
  855|   670k|    for( n=0; n < size; ) {
  ------------------
  |  Branch (855:15): [True: 670k, False: 259]
  ------------------
  856|       |
  857|   670k|	if( afx->buffer_pos < afx->buffer_len )
  ------------------
  |  Branch (857:6): [True: 634k, False: 35.6k]
  ------------------
  858|   634k|	    c = afx->buffer[afx->buffer_pos++];
  859|  35.6k|	else { /* read the next line */
  860|  35.6k|	    unsigned maxlen = MAX_LINELEN;
  ------------------
  |  |   38|  35.6k|#define MAX_LINELEN 20000
  ------------------
  861|  35.6k|	    afx->buffer_pos = 0;
  862|  35.6k|	    afx->buffer_len = iobuf_read_line( a, &afx->buffer,
  863|  35.6k|					       &afx->buffer_size, &maxlen );
  864|  35.6k|	    if( !maxlen )
  ------------------
  |  Branch (864:10): [True: 6, False: 35.6k]
  ------------------
  865|      6|		afx->truncated++;
  866|  35.6k|	    if( !afx->buffer_len )
  ------------------
  |  Branch (866:10): [True: 2.22k, False: 33.3k]
  ------------------
  867|  2.22k|		break; /* eof */
  868|  33.3k|	    continue;
  869|  35.6k|	}
  870|       |
  871|   635k|      again:
  872|   635k|	binc = asctobin[0][c];
  873|       |
  874|   635k|	if( binc != 0xffffffffUL )
  ------------------
  |  Branch (874:6): [True: 355k, False: 280k]
  ------------------
  875|   355k|	  {
  876|   355k|	    if( idx == 0 && skip_fast == 0
  ------------------
  |  Branch (876:10): [True: 216k, False: 138k]
  |  Branch (876:22): [True: 207k, False: 9.30k]
  ------------------
  877|   355k|		&& afx->buffer_pos + (16 - 1) < afx->buffer_len
  ------------------
  |  Branch (877:6): [True: 175k, False: 32.0k]
  ------------------
  878|   355k|		&& n + 12 < size)
  ------------------
  |  Branch (878:6): [True: 174k, False: 632]
  ------------------
  879|   174k|	      {
  880|       |		/* Fast path for radix64 to binary conversion.  */
  881|   174k|		u32 b0,b1,b2,b3;
  882|       |
  883|       |		/* Speculatively load 15 more input bytes.  */
  884|   174k|		b0 = binc << (3 * 6);
  885|   174k|		b0 |= asctobin[2][afx->buffer[afx->buffer_pos + 0]];
  886|   174k|		b0 |= asctobin[1][afx->buffer[afx->buffer_pos + 1]];
  887|   174k|		b0 |= asctobin[0][afx->buffer[afx->buffer_pos + 2]];
  888|   174k|		b1  = asctobin[3][afx->buffer[afx->buffer_pos + 3]];
  889|   174k|		b1 |= asctobin[2][afx->buffer[afx->buffer_pos + 4]];
  890|   174k|		b1 |= asctobin[1][afx->buffer[afx->buffer_pos + 5]];
  891|   174k|		b1 |= asctobin[0][afx->buffer[afx->buffer_pos + 6]];
  892|   174k|		b2  = asctobin[3][afx->buffer[afx->buffer_pos + 7]];
  893|   174k|		b2 |= asctobin[2][afx->buffer[afx->buffer_pos + 8]];
  894|   174k|		b2 |= asctobin[1][afx->buffer[afx->buffer_pos + 9]];
  895|   174k|		b2 |= asctobin[0][afx->buffer[afx->buffer_pos + 10]];
  896|   174k|		b3  = asctobin[3][afx->buffer[afx->buffer_pos + 11]];
  897|   174k|		b3 |= asctobin[2][afx->buffer[afx->buffer_pos + 12]];
  898|   174k|		b3 |= asctobin[1][afx->buffer[afx->buffer_pos + 13]];
  899|   174k|		b3 |= asctobin[0][afx->buffer[afx->buffer_pos + 14]];
  900|       |
  901|       |		/* Check if any of the input bytes were invalid. */
  902|   174k|		if( (b0 | b1 | b2 | b3) != 0xffffffffUL )
  ------------------
  |  Branch (902:7): [True: 150k, False: 23.8k]
  ------------------
  903|   150k|		  {
  904|       |		    /* All 16 bytes are valid. */
  905|   150k|		    buf[n + 0] = b0 >> (2 * 8);
  906|   150k|		    buf[n + 1] = b0 >> (1 * 8);
  907|   150k|		    buf[n + 2] = b0 >> (0 * 8);
  908|   150k|		    buf[n + 3] = b1 >> (2 * 8);
  909|   150k|		    buf[n + 4] = b1 >> (1 * 8);
  910|   150k|		    buf[n + 5] = b1 >> (0 * 8);
  911|   150k|		    buf[n + 6] = b2 >> (2 * 8);
  912|   150k|		    buf[n + 7] = b2 >> (1 * 8);
  913|   150k|		    buf[n + 8] = b2 >> (0 * 8);
  914|   150k|		    buf[n + 9] = b3 >> (2 * 8);
  915|   150k|		    buf[n + 10] = b3 >> (1 * 8);
  916|   150k|		    buf[n + 11] = b3 >> (0 * 8);
  917|   150k|		    afx->buffer_pos += 16 - 1;
  918|   150k|		    n += 12;
  919|   150k|		    continue;
  920|   150k|		  }
  921|  23.8k|		else if( b0 == 0xffffffffUL )
  ------------------
  |  Branch (921:12): [True: 9.32k, False: 14.5k]
  ------------------
  922|  9.32k|		  {
  923|       |		    /* byte[1..3] have invalid character(s).  Switch to slow
  924|       |		       path.  */
  925|  9.32k|		    skip_fast = 1;
  926|  9.32k|		  }
  927|  14.5k|		else if( b1 == 0xffffffffUL )
  ------------------
  |  Branch (927:12): [True: 7.78k, False: 6.72k]
  ------------------
  928|  7.78k|		  {
  929|       |		    /* byte[4..7] have invalid character(s), first 4 bytes are
  930|       |		       valid.  */
  931|  7.78k|		    buf[n + 0] = b0 >> (2 * 8);
  932|  7.78k|		    buf[n + 1] = b0 >> (1 * 8);
  933|  7.78k|		    buf[n + 2] = b0 >> (0 * 8);
  934|  7.78k|		    afx->buffer_pos += 4 - 1;
  935|  7.78k|		    n += 3;
  936|  7.78k|		    skip_fast = 1;
  937|  7.78k|		    continue;
  938|  7.78k|		  }
  939|  6.72k|		else if( b2 == 0xffffffffUL )
  ------------------
  |  Branch (939:12): [True: 3.87k, False: 2.85k]
  ------------------
  940|  3.87k|		  {
  941|       |		    /* byte[8..11] have invalid character(s), first 8 bytes are
  942|       |		       valid.  */
  943|  3.87k|		    buf[n + 0] = b0 >> (2 * 8);
  944|  3.87k|		    buf[n + 1] = b0 >> (1 * 8);
  945|  3.87k|		    buf[n + 2] = b0 >> (0 * 8);
  946|  3.87k|		    buf[n + 3] = b1 >> (2 * 8);
  947|  3.87k|		    buf[n + 4] = b1 >> (1 * 8);
  948|  3.87k|		    buf[n + 5] = b1 >> (0 * 8);
  949|  3.87k|		    afx->buffer_pos += 8 - 1;
  950|  3.87k|		    n += 6;
  951|  3.87k|		    skip_fast = 1;
  952|  3.87k|		    continue;
  953|  3.87k|		  }
  954|  2.85k|		else /*if( b3 == 0xffffffffUL )*/
  955|  2.85k|		  {
  956|       |		    /* byte[12..15] have invalid character(s), first 12 bytes
  957|       |		       are valid.  */
  958|  2.85k|		    buf[n + 0] = b0 >> (2 * 8);
  959|  2.85k|		    buf[n + 1] = b0 >> (1 * 8);
  960|  2.85k|		    buf[n + 2] = b0 >> (0 * 8);
  961|  2.85k|		    buf[n + 3] = b1 >> (2 * 8);
  962|  2.85k|		    buf[n + 4] = b1 >> (1 * 8);
  963|  2.85k|		    buf[n + 5] = b1 >> (0 * 8);
  964|  2.85k|		    buf[n + 6] = b2 >> (2 * 8);
  965|  2.85k|		    buf[n + 7] = b2 >> (1 * 8);
  966|  2.85k|		    buf[n + 8] = b2 >> (0 * 8);
  967|  2.85k|		    afx->buffer_pos += 12 - 1;
  968|  2.85k|		    n += 9;
  969|  2.85k|		    skip_fast = 1;
  970|  2.85k|		    continue;
  971|  2.85k|		  }
  972|   174k|	      }
  973|       |
  974|   189k|	    switch(idx)
  ------------------
  |  Branch (974:13): [True: 0, False: 189k]
  ------------------
  975|   189k|	      {
  976|  51.3k|		case 0: val =  binc << 2; break;
  ------------------
  |  Branch (976:3): [True: 51.3k, False: 138k]
  ------------------
  977|  47.7k|		case 1: val |= (binc>>4)&3; buf[n++]=val;val=(binc<<4)&0xf0;break;
  ------------------
  |  Branch (977:3): [True: 47.7k, False: 142k]
  ------------------
  978|  46.5k|		case 2: val |= (binc>>2)&15; buf[n++]=val;val=(binc<<6)&0xc0;break;
  ------------------
  |  Branch (978:3): [True: 46.5k, False: 143k]
  ------------------
  979|  44.2k|		case 3: val |= binc&0x3f; buf[n++] = val; break;
  ------------------
  |  Branch (979:3): [True: 44.2k, False: 145k]
  ------------------
  980|   189k|	      }
  981|   189k|	    idx = (idx+1) % 4;
  982|       |
  983|   189k|	    continue;
  984|   189k|	  }
  985|       |
  986|   280k|	skip_fast = 0;
  987|       |
  988|   280k|	if( c == '\n' || c == ' ' || c == '\r' || c == '\t' )
  ------------------
  |  Branch (988:6): [True: 32.7k, False: 247k]
  |  Branch (988:19): [True: 6.53k, False: 240k]
  |  Branch (988:31): [True: 2.90k, False: 237k]
  |  Branch (988:44): [True: 648, False: 237k]
  ------------------
  989|  42.8k|	    continue;
  990|   237k|	else if( c == '=' ) { /* pad character: stop */
  ------------------
  |  Branch (990:11): [True: 16.0k, False: 221k]
  ------------------
  991|       |	    /* some mailers leave quoted-printable encoded characters
  992|       |	     * so we try to workaround this */
  993|  16.0k|	    if( afx->buffer_pos+2 < afx->buffer_len ) {
  ------------------
  |  Branch (993:10): [True: 4.23k, False: 11.8k]
  ------------------
  994|  4.23k|		int cc1, cc2, cc3;
  995|  4.23k|		cc1 = afx->buffer[afx->buffer_pos];
  996|  4.23k|		cc2 = afx->buffer[afx->buffer_pos+1];
  997|  4.23k|		cc3 = afx->buffer[afx->buffer_pos+2];
  998|  4.23k|		if( isxdigit(cc1) && isxdigit(cc2)
  999|  4.23k|				  && strchr( "=\n\r\t ", cc3 )) {
  ------------------
  |  Branch (999:10): [True: 462, False: 80]
  ------------------
 1000|       |		    /* well it seems to be the case - adjust */
 1001|    462|		    c = isdigit(cc1)? (cc1 - '0'): (ascii_toupper(cc1)-'A'+10);
 1002|    462|		    c <<= 4;
 1003|    462|		    c |= isdigit(cc2)? (cc2 - '0'): (ascii_toupper(cc2)-'A'+10);
 1004|    462|		    afx->buffer_pos += 2;
 1005|    462|		    afx->qp_detected = 1;
 1006|    462|		    goto again;
 1007|    462|		}
 1008|  4.23k|	    }
 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|  15.6k|            if (afx->buffer_pos + 6 < afx->buffer_len
  ------------------
  |  Branch (1015:17): [True: 1.26k, False: 14.3k]
  ------------------
 1016|  15.6k|                && afx->buffer[afx->buffer_pos + 0] == '3'
  ------------------
  |  Branch (1016:20): [True: 16, False: 1.25k]
  ------------------
 1017|  15.6k|                && afx->buffer[afx->buffer_pos + 1] == 'D'
  ------------------
  |  Branch (1017:20): [True: 12, False: 4]
  ------------------
 1018|  15.6k|                && asctobin[0][afx->buffer[afx->buffer_pos + 2]] != 0xffffffffUL
  ------------------
  |  Branch (1018:20): [True: 9, False: 3]
  ------------------
 1019|  15.6k|                && asctobin[0][afx->buffer[afx->buffer_pos + 3]] != 0xffffffffUL
  ------------------
  |  Branch (1019:20): [True: 9, False: 0]
  ------------------
 1020|  15.6k|                && asctobin[0][afx->buffer[afx->buffer_pos + 4]] != 0xffffffffUL
  ------------------
  |  Branch (1020:20): [True: 7, False: 2]
  ------------------
 1021|  15.6k|                && asctobin[0][afx->buffer[afx->buffer_pos + 5]] != 0xffffffffUL
  ------------------
  |  Branch (1021:20): [True: 4, False: 3]
  ------------------
 1022|  15.6k|                && afx->buffer[afx->buffer_pos + 6] == '\n')
  ------------------
  |  Branch (1022:20): [True: 0, False: 4]
  ------------------
 1023|      0|              {
 1024|      0|                afx->buffer_pos += 2;
 1025|      0|                afx->qp_detected = 1;
 1026|      0|              }
 1027|       |
 1028|  15.6k|	    if (!n)
  ------------------
  |  Branch (1028:10): [True: 9.88k, False: 5.75k]
  ------------------
 1029|  9.88k|	      onlypad = 1;
 1030|       |
 1031|  15.6k|	    if( idx == 1 )
  ------------------
  |  Branch (1031:10): [True: 3.37k, False: 12.2k]
  ------------------
 1032|  3.37k|		buf[n++] = val;
 1033|  15.6k|	    checkcrc++;
 1034|  15.6k|	    break;
 1035|  16.0k|	}
 1036|   221k|        else if (afx->dearmor_state && c == '-'
  ------------------
  |  Branch (1036:18): [True: 0, False: 221k]
  |  Branch (1036:40): [True: 0, False: 0]
  ------------------
 1037|   221k|                 && afx->buffer_pos + 8 < afx->buffer_len
  ------------------
  |  Branch (1037:21): [True: 0, False: 0]
  ------------------
 1038|   221k|                 && !strncmp (afx->buffer, "-----END ", 8)) {
  ------------------
  |  Branch (1038:21): [True: 0, False: 0]
  ------------------
 1039|      0|            break; /* End in --dearmor mode.  */
 1040|      0|        }
 1041|   221k|	else {
 1042|   221k|	    log_error(_("invalid radix64 character %02X skipped\n"), c);
  ------------------
  |  |   28|   221k|#  define _(a) gettext (a)
  ------------------
 1043|   221k|	    continue;
 1044|   221k|	}
 1045|   280k|    }
 1046|       |
 1047|  18.1k|    afx->idx = idx;
 1048|  18.1k|    afx->radbuf[0] = val;
 1049|       |
 1050|  18.1k|    if( n )
  ------------------
  |  Branch (1050:9): [True: 8.93k, False: 9.18k]
  ------------------
 1051|  8.93k|      gcry_md_write (afx->crc_md, buf, n);
 1052|       |
 1053|  18.1k|    if( checkcrc ) {
  ------------------
  |  Branch (1053:9): [True: 15.6k, False: 2.48k]
  ------------------
 1054|  15.6k|	gcry_md_final (afx->crc_md);
 1055|  15.6k|	afx->any_data = 1;
 1056|  15.6k|	afx->inp_checked=0;
 1057|  15.6k|	afx->faked = 0;
 1058|  29.0k|	for(;;) { /* skip lf and pad characters */
 1059|  29.0k|	    if( afx->buffer_pos < afx->buffer_len )
  ------------------
  |  Branch (1059:10): [True: 27.2k, False: 1.82k]
  ------------------
 1060|  27.2k|		c = afx->buffer[afx->buffer_pos++];
 1061|  1.82k|	    else { /* read the next line */
 1062|  1.82k|		unsigned maxlen = MAX_LINELEN;
  ------------------
  |  |   38|  1.82k|#define MAX_LINELEN 20000
  ------------------
 1063|  1.82k|		afx->buffer_pos = 0;
 1064|  1.82k|		afx->buffer_len = iobuf_read_line( a, &afx->buffer,
 1065|  1.82k|						   &afx->buffer_size, &maxlen );
 1066|  1.82k|		if( !maxlen )
  ------------------
  |  Branch (1066:7): [True: 2, False: 1.82k]
  ------------------
 1067|      2|		    afx->truncated++;
 1068|  1.82k|		if( !afx->buffer_len )
  ------------------
  |  Branch (1068:7): [True: 52, False: 1.77k]
  ------------------
 1069|     52|		    break; /* eof */
 1070|  1.77k|		continue;
 1071|  1.82k|	    }
 1072|  27.2k|	    if( c == '\n' || c == ' ' || c == '\r'
  ------------------
  |  Branch (1072:10): [True: 1.78k, False: 25.4k]
  |  Branch (1072:23): [True: 7.95k, False: 17.5k]
  |  Branch (1072:35): [True: 180, False: 17.3k]
  ------------------
 1073|  27.2k|		|| c == '\t' || c == '=' )
  ------------------
  |  Branch (1073:6): [True: 241, False: 17.0k]
  |  Branch (1073:19): [True: 1.51k, False: 15.5k]
  ------------------
 1074|  11.6k|		continue;
 1075|  15.5k|	    break;
 1076|  27.2k|	}
 1077|  15.6k|	if( !afx->buffer_len )
  ------------------
  |  Branch (1077:6): [True: 52, False: 15.5k]
  ------------------
 1078|     52|	    log_error(_("premature eof (no CRC)\n"));
  ------------------
  |  |   28|     52|#  define _(a) gettext (a)
  ------------------
 1079|  15.5k|	else {
 1080|  15.5k|	    u32 mycrc = 0;
 1081|  15.5k|	    idx = 0;
 1082|  17.1k|	    do {
 1083|  17.1k|		if( (binc = asctobin[0][c]) == 0xffffffffUL )
  ------------------
  |  Branch (1083:7): [True: 15.0k, False: 2.06k]
  ------------------
 1084|  15.0k|		    break;
 1085|  2.06k|		switch(idx) {
  ------------------
  |  Branch (1085:10): [True: 0, False: 2.06k]
  ------------------
 1086|    575|		  case 0: val =  binc << 2; break;
  ------------------
  |  Branch (1086:5): [True: 575, False: 1.49k]
  ------------------
 1087|    515|		  case 1: val |= (binc>>4)&3; mycrc |= val << 16;val=(binc<<4)&0xf0;break;
  ------------------
  |  Branch (1087:5): [True: 515, False: 1.55k]
  ------------------
 1088|    496|		  case 2: val |= (binc>>2)&15; mycrc |= val << 8;val=(binc<<6)&0xc0;break;
  ------------------
  |  Branch (1088:5): [True: 496, False: 1.56k]
  ------------------
 1089|    479|		  case 3: val |= binc&0x3f; mycrc |= val; break;
  ------------------
  |  Branch (1089:5): [True: 479, False: 1.58k]
  ------------------
 1090|  2.06k|		}
 1091|  2.06k|		for(;;) {
 1092|  2.06k|		    if( afx->buffer_pos < afx->buffer_len )
  ------------------
  |  Branch (1092:11): [True: 2.03k, False: 35]
  ------------------
 1093|  2.03k|			c = afx->buffer[afx->buffer_pos++];
 1094|     35|		    else { /* read the next line */
 1095|     35|			unsigned maxlen = MAX_LINELEN;
  ------------------
  |  |   38|     35|#define MAX_LINELEN 20000
  ------------------
 1096|     35|			afx->buffer_pos = 0;
 1097|     35|			afx->buffer_len = iobuf_read_line( a, &afx->buffer,
 1098|     35|							   &afx->buffer_size,
 1099|     35|								&maxlen );
 1100|     35|			if( !maxlen )
  ------------------
  |  Branch (1100:8): [True: 0, False: 35]
  ------------------
 1101|      0|			    afx->truncated++;
 1102|     35|			if( !afx->buffer_len )
  ------------------
  |  Branch (1102:8): [True: 35, False: 0]
  ------------------
 1103|     35|			    break; /* eof */
 1104|      0|			continue;
 1105|     35|		    }
 1106|  2.03k|		    break;
 1107|  2.06k|		}
 1108|  2.06k|		if( !afx->buffer_len )
  ------------------
  |  Branch (1108:7): [True: 35, False: 2.03k]
  ------------------
 1109|     35|		    break; /* eof */
 1110|  2.06k|	    } while( ++idx < 4 );
  ------------------
  |  Branch (1110:15): [True: 1.55k, False: 477]
  ------------------
 1111|  15.5k|	    if( !afx->buffer_len ) {
  ------------------
  |  Branch (1111:10): [True: 35, False: 15.5k]
  ------------------
 1112|     35|		log_info(_("premature eof (in CRC)\n"));
  ------------------
  |  |   28|     35|#  define _(a) gettext (a)
  ------------------
 1113|     35|		rc = invalid_crc();
 1114|     35|	    }
 1115|  15.5k|	    else if( idx == 0 ) {
  ------------------
  |  Branch (1115:15): [True: 15.0k, False: 540]
  ------------------
 1116|       |	        /* No CRC at all is legal ("MAY") */
 1117|  15.0k|	        rc=0;
 1118|  15.0k|	    }
 1119|    540|	    else if( idx != 4 ) {
  ------------------
  |  Branch (1119:15): [True: 63, False: 477]
  ------------------
 1120|     63|		log_info(_("malformed CRC\n"));
  ------------------
  |  |   28|     63|#  define _(a) gettext (a)
  ------------------
 1121|     63|		rc = invalid_crc();
 1122|     63|	    }
 1123|    477|	    else if( mycrc != get_afx_crc (afx) ) {
  ------------------
  |  Branch (1123:15): [True: 59, False: 418]
  ------------------
 1124|     59|		log_info (_("CRC error; %06lX - %06lX\n"),
  ------------------
  |  |   28|     59|#  define _(a) gettext (a)
  ------------------
 1125|     59|				    (ulong)get_afx_crc (afx), (ulong)mycrc);
 1126|     59|		rc = invalid_crc();
 1127|     59|	    }
 1128|    418|	    else {
 1129|    418|		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|    418|	    }
 1153|  15.5k|	}
 1154|  15.6k|    }
 1155|       |
 1156|  18.1k|    if( !n && !onlypad )
  ------------------
  |  Branch (1156:9): [True: 9.18k, False: 8.93k]
  |  Branch (1156:15): [True: 1.34k, False: 7.83k]
  ------------------
 1157|  1.34k|	rc = -1;
 1158|       |
 1159|  18.1k|    *retn = n;
 1160|  18.1k|    return rc;
 1161|  18.1k|}
armor.c:invalid_crc:
  832|    157|{
  833|    157|  if ( opt.ignore_crc_error )
  ------------------
  |  Branch (833:8): [True: 0, False: 157]
  ------------------
  834|      0|    return 0;
  835|    157|  log_inc_errorcount();
  836|    157|  return gpg_error (GPG_ERR_INV_ARMOR);
  837|    157|}
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|    536|{
  192|    536|  const byte *crc_buf;
  193|    536|  u32 crc;
  194|       |
  195|    536|  crc_buf = gcry_md_read (afx->crc_md, GCRY_MD_CRC24_RFC2440);
  196|       |
  197|    536|  crc = crc_buf[0];
  198|    536|  crc <<= 8;
  199|    536|  crc |= crc_buf[1];
  200|    536|  crc <<= 8;
  201|    536|  crc |= crc_buf[2];
  202|       |
  203|    536|  return crc;
  204|    536|}

agent_scd_serialno:
 1444|  3.53k|{
 1445|  3.53k|  int err;
 1446|  3.53k|  char *serialno = NULL;
 1447|  3.53k|  char line[ASSUAN_LINELENGTH];
 1448|       |
 1449|  3.53k|  if (r_serialno)
  ------------------
  |  Branch (1449:7): [True: 0, False: 3.53k]
  ------------------
 1450|      0|    *r_serialno = NULL;
 1451|       |
 1452|  3.53k|  err = start_agent (NULL, (1 | FLAG_FOR_CARD_SUPPRESS_ERRORS));
  ------------------
  |  |  229|  3.53k|#define FLAG_FOR_CARD_SUPPRESS_ERRORS 2
  ------------------
 1453|  3.53k|  if (err)
  ------------------
  |  Branch (1453:7): [True: 3.53k, False: 0]
  ------------------
 1454|  3.53k|    return err;
 1455|       |
 1456|      0|  if (!demand)
  ------------------
  |  Branch (1456:7): [True: 0, False: 0]
  ------------------
 1457|      0|    strcpy (line, "SCD SERIALNO");
 1458|      0|  else
 1459|      0|    snprintf (line, DIM(line), "SCD SERIALNO --demand=%s", demand);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
                  snprintf (line, DIM(line), "SCD SERIALNO --demand=%s", demand);
  ------------------
  |  |   47|      0|#define DIM(v)		     (sizeof(v)/sizeof((v)[0]))
  ------------------
 1460|       |
 1461|      0|  err = assuan_transact (agent_ctx, line,
 1462|      0|                         NULL, NULL, NULL, NULL,
 1463|      0|                         get_serialno_cb, &serialno);
 1464|      0|  if (err)
  ------------------
  |  Branch (1464:7): [True: 0, False: 0]
  ------------------
 1465|      0|    {
 1466|      0|      xfree (serialno);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1467|      0|      return err;
 1468|      0|    }
 1469|       |
 1470|      0|  if (r_serialno)
  ------------------
  |  Branch (1470:7): [True: 0, False: 0]
  ------------------
 1471|      0|    *r_serialno = serialno;
 1472|      0|  else
 1473|      0|    xfree (serialno);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1474|       |
 1475|      0|  return 0;
 1476|      0|}
free_keypair_info:
 1813|  3.53k|{
 1814|  3.53k|  keypair_info_t l_next;
 1815|       |
 1816|  3.53k|  for (; l; l = l_next)
  ------------------
  |  Branch (1816:10): [True: 0, False: 3.53k]
  ------------------
 1817|      0|    {
 1818|      0|      l_next = l->next;
 1819|      0|      xfree (l->serialno);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1820|      0|      xfree (l->idstr);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1821|      0|      xfree (l);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1822|      0|    }
 1823|  3.53k|}
agent_get_passphrase:
 1960|   127k|{
 1961|   127k|  int rc;
 1962|   127k|  char line[ASSUAN_LINELENGTH];
 1963|   127k|  char *arg1 = NULL;
 1964|   127k|  char *arg2 = NULL;
 1965|   127k|  char *arg3 = NULL;
 1966|   127k|  char *arg4 = NULL;
 1967|   127k|  membuf_t data;
 1968|   127k|  struct default_inq_parm_s dfltparm;
 1969|   127k|  int have_newsymkey;
 1970|       |
 1971|   127k|  memset (&dfltparm, 0, sizeof dfltparm);
 1972|       |
 1973|   127k|  *r_passphrase = NULL;
 1974|       |
 1975|   127k|  rc = start_agent (NULL, 0);
 1976|   127k|  if (rc)
  ------------------
  |  Branch (1976:7): [True: 127k, False: 0]
  ------------------
 1977|   127k|    return rc;
 1978|      0|  dfltparm.ctx = agent_ctx;
 1979|       |
 1980|       |  /* Check that the gpg-agent understands the repeat option.  */
 1981|      0|  if (assuan_transact (agent_ctx,
  ------------------
  |  Branch (1981:7): [True: 0, False: 0]
  ------------------
 1982|      0|                       "GETINFO cmd_has_option GET_PASSPHRASE repeat",
 1983|      0|                       NULL, NULL, NULL, NULL, NULL, NULL))
 1984|      0|    return gpg_error (GPG_ERR_NOT_SUPPORTED);
 1985|      0|  have_newsymkey = !(assuan_transact
 1986|      0|                     (agent_ctx,
 1987|      0|                      "GETINFO cmd_has_option GET_PASSPHRASE newsymkey",
 1988|      0|                      NULL, NULL, NULL, NULL, NULL, NULL));
 1989|       |
 1990|      0|  if (cache_id && *cache_id)
  ------------------
  |  Branch (1990:7): [True: 0, False: 0]
  |  Branch (1990:19): [True: 0, False: 0]
  ------------------
 1991|      0|    if (!(arg1 = percent_plus_escape (cache_id)))
  ------------------
  |  Branch (1991:9): [True: 0, False: 0]
  ------------------
 1992|      0|      goto no_mem;
 1993|      0|  if (err_msg && *err_msg)
  ------------------
  |  Branch (1993:7): [True: 0, False: 0]
  |  Branch (1993:18): [True: 0, False: 0]
  ------------------
 1994|      0|    if (!(arg2 = percent_plus_escape (err_msg)))
  ------------------
  |  Branch (1994:9): [True: 0, False: 0]
  ------------------
 1995|      0|      goto no_mem;
 1996|      0|  if (prompt && *prompt)
  ------------------
  |  Branch (1996:7): [True: 0, False: 0]
  |  Branch (1996:17): [True: 0, False: 0]
  ------------------
 1997|      0|    if (!(arg3 = percent_plus_escape (prompt)))
  ------------------
  |  Branch (1997:9): [True: 0, False: 0]
  ------------------
 1998|      0|      goto no_mem;
 1999|      0|  if (desc_msg && *desc_msg)
  ------------------
  |  Branch (1999:7): [True: 0, False: 0]
  |  Branch (1999:19): [True: 0, False: 0]
  ------------------
 2000|      0|    if (!(arg4 = percent_plus_escape (desc_msg)))
  ------------------
  |  Branch (2000:9): [True: 0, False: 0]
  ------------------
 2001|      0|      goto no_mem;
 2002|       |
 2003|       |  /* CHECK && REPEAT or NEWSYMKEY is here an indication that a new
 2004|       |   * passphrase for symmetric encryption is requested; if the agent
 2005|       |   * supports this we enable the modern API by also passing --newsymkey.  */
 2006|      0|  snprintf (line, DIM(line),
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
                snprintf (line, DIM(line),
  ------------------
  |  |   47|      0|#define DIM(v)		     (sizeof(v)/sizeof((v)[0]))
  ------------------
 2007|      0|            "GET_PASSPHRASE --data --repeat=%d%s%s -- %s %s %s %s",
 2008|      0|            repeat,
 2009|      0|            ((repeat && check) || newsymkey)? " --check":"",
  ------------------
  |  Branch (2009:15): [True: 0, False: 0]
  |  Branch (2009:25): [True: 0, False: 0]
  |  Branch (2009:35): [True: 0, False: 0]
  ------------------
 2010|      0|            (have_newsymkey && newsymkey)? " --newsymkey":"",
  ------------------
  |  Branch (2010:14): [True: 0, False: 0]
  |  Branch (2010:32): [True: 0, False: 0]
  ------------------
 2011|      0|            arg1? arg1:"X",
  ------------------
  |  Branch (2011:13): [True: 0, False: 0]
  ------------------
 2012|      0|            arg2? arg2:"X",
  ------------------
  |  Branch (2012:13): [True: 0, False: 0]
  ------------------
 2013|      0|            arg3? arg3:"X",
  ------------------
  |  Branch (2013:13): [True: 0, False: 0]
  ------------------
 2014|      0|            arg4? arg4:"X");
  ------------------
  |  Branch (2014:13): [True: 0, False: 0]
  ------------------
 2015|      0|  xfree (arg1);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 2016|      0|  xfree (arg2);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 2017|      0|  xfree (arg3);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 2018|      0|  xfree (arg4);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 2019|       |
 2020|      0|  init_membuf_secure (&data, 64);
 2021|      0|  rc = assuan_transact (agent_ctx, line,
 2022|      0|                        put_membuf_cb, &data,
 2023|      0|                        default_inq_cb, &dfltparm,
 2024|      0|                        NULL, NULL);
 2025|       |
 2026|      0|  if (rc)
  ------------------
  |  Branch (2026:7): [True: 0, False: 0]
  ------------------
 2027|      0|    xfree (get_membuf (&data, NULL));
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 2028|      0|  else
 2029|      0|    {
 2030|      0|      put_membuf (&data, "", 1);
 2031|      0|      *r_passphrase = get_membuf (&data, NULL);
 2032|      0|      if (!*r_passphrase)
  ------------------
  |  Branch (2032:11): [True: 0, False: 0]
  ------------------
 2033|      0|        rc = gpg_error_from_syserror ();
 2034|      0|    }
 2035|      0|  return rc;
 2036|      0| no_mem:
 2037|      0|  rc = gpg_error_from_syserror ();
 2038|      0|  xfree (arg1);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 2039|      0|  xfree (arg2);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 2040|      0|  xfree (arg3);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 2041|      0|  xfree (arg4);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 2042|      0|  return rc;
 2043|      0|}
call-agent.c:start_agent:
  235|   130k|{
  236|   130k|  int rc;
  237|       |
  238|   130k|  (void)ctrl;  /* Not yet used.  */
  239|       |
  240|       |  /* Fixme: We need a context for each thread or serialize the access
  241|       |     to the agent. */
  242|   130k|  if (agent_ctx)
  ------------------
  |  Branch (242:7): [True: 0, False: 130k]
  ------------------
  243|      0|    rc = 0;
  244|   130k|  else
  245|   130k|    {
  246|   130k|      rc = start_new_gpg_agent (&agent_ctx,
  247|   130k|                                GPG_ERR_SOURCE_DEFAULT,
  ------------------
  |  |   34|   130k|#define GPG_ERR_SOURCE_DEFAULT  GPG_ERR_SOURCE_GPG
  ------------------
  248|   130k|                                opt.agent_program,
  249|   130k|                                opt.lc_ctype, opt.lc_messages,
  250|   130k|                                opt.session_env,
  251|   130k|                                opt.autostart, opt.verbose, DBG_IPC,
  ------------------
  |  |  355|   130k|#define DBG_IPC     (opt.debug & DBG_IPC_VALUE)
  |  |  ------------------
  |  |  |  |  342|   130k|#define DBG_IPC_VALUE     1024  /* debug assuan communication */
  |  |  ------------------
  ------------------
  252|   130k|                                NULL, NULL);
  253|   130k|      if (!opt.autostart && gpg_err_code (rc) == GPG_ERR_NO_AGENT)
  ------------------
  |  Branch (253:11): [True: 130k, False: 0]
  |  Branch (253:29): [True: 130k, False: 0]
  ------------------
  254|   130k|        {
  255|   130k|          static int shown;
  256|       |
  257|   130k|          if (!shown)
  ------------------
  |  Branch (257:15): [True: 1, False: 130k]
  ------------------
  258|      1|            {
  259|      1|              shown = 1;
  260|      1|              log_info (_("no gpg-agent running in this session\n"));
  ------------------
  |  |   28|      1|#  define _(a) gettext (a)
  ------------------
  261|      1|            }
  262|   130k|        }
  263|      0|      else if (!rc
  ------------------
  |  Branch (263:16): [True: 0, False: 0]
  ------------------
  264|      0|               && !(rc = warn_version_mismatch (agent_ctx, GPG_AGENT_NAME, 0)))
  ------------------
  |  |  143|      0|#define GPG_AGENT_NAME "gpg-agent"
  ------------------
  |  Branch (264:19): [True: 0, False: 0]
  ------------------
  265|      0|        {
  266|       |          /* Tell the agent that we support Pinentry notifications.
  267|       |             No error checking so that it will work also with older
  268|       |             agents.  */
  269|      0|          assuan_transact (agent_ctx, "OPTION allow-pinentry-notify",
  270|      0|                           NULL, NULL, NULL, NULL, NULL, NULL);
  271|       |          /* Tell the agent about what version we are aware.  This is
  272|       |             here used to indirectly enable GPG_ERR_FULLY_CANCELED.  */
  273|      0|          assuan_transact (agent_ctx, "OPTION agent-awareness=2.1.0",
  274|      0|                           NULL, NULL, NULL, NULL, NULL, NULL);
  275|       |          /* Pass on the pinentry mode.  */
  276|      0|          if (opt.pinentry_mode)
  ------------------
  |  Branch (276:15): [True: 0, False: 0]
  ------------------
  277|      0|            {
  278|      0|              char *tmp = xasprintf ("OPTION pinentry-mode=%s",
  279|      0|                                     str_pinentry_mode (opt.pinentry_mode));
  280|      0|              rc = assuan_transact (agent_ctx, tmp,
  281|      0|                               NULL, NULL, NULL, NULL, NULL, NULL);
  282|      0|              xfree (tmp);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  283|      0|              if (rc)
  ------------------
  |  Branch (283:19): [True: 0, False: 0]
  ------------------
  284|      0|                {
  285|      0|                  log_error ("setting pinentry mode '%s' failed: %s\n",
  286|      0|                             str_pinentry_mode (opt.pinentry_mode),
  287|      0|                             gpg_strerror (rc));
  288|      0|                  write_status_error ("set_pinentry_mode", rc);
  289|      0|                }
  290|      0|            }
  291|       |
  292|       |          /* Pass on the request origin.  */
  293|      0|          if (opt.request_origin)
  ------------------
  |  Branch (293:15): [True: 0, False: 0]
  ------------------
  294|      0|            {
  295|      0|              char *tmp = xasprintf ("OPTION pretend-request-origin=%s",
  296|      0|                                     str_request_origin (opt.request_origin));
  297|      0|              rc = assuan_transact (agent_ctx, tmp,
  298|      0|                               NULL, NULL, NULL, NULL, NULL, NULL);
  299|      0|              xfree (tmp);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  300|      0|              if (rc)
  ------------------
  |  Branch (300:19): [True: 0, False: 0]
  ------------------
  301|      0|                {
  302|      0|                  log_error ("setting request origin '%s' failed: %s\n",
  303|      0|                             str_request_origin (opt.request_origin),
  304|      0|                             gpg_strerror (rc));
  305|      0|                  write_status_error ("set_request_origin", rc);
  306|      0|                }
  307|      0|            }
  308|       |
  309|       |          /* In DE_VS mode under Windows we require that the JENT RNG
  310|       |           * is active.  */
  311|       |#ifdef HAVE_W32_SYSTEM
  312|       |          if (!rc && opt.compliance == CO_DE_VS)
  313|       |            {
  314|       |              if (assuan_transact (agent_ctx, "GETINFO jent_active",
  315|       |                                   NULL, NULL, NULL, NULL, NULL, NULL))
  316|       |                {
  317|       |                  rc = gpg_error (GPG_ERR_FORBIDDEN);
  318|       |                  log_error (_("%s is not compliant with %s mode\n"),
  319|       |                             GPG_AGENT_NAME,
  320|       |                             gnupg_compliance_option_string (opt.compliance));
  321|       |                  write_status_error ("random-compliance", rc);
  322|       |                }
  323|       |            }
  324|       |#endif /*HAVE_W32_SYSTEM*/
  325|       |
  326|      0|        }
  327|   130k|    }
  328|       |
  329|   130k|  if (!rc && flag_for_card && !did_early_card_test)
  ------------------
  |  Branch (329:7): [True: 0, False: 130k]
  |  Branch (329:14): [True: 0, False: 0]
  |  Branch (329:31): [True: 0, False: 0]
  ------------------
  330|      0|    {
  331|       |      /* Request the serial number of the card for an early test.  */
  332|      0|      struct agent_card_info_s info;
  333|       |
  334|      0|      memset (&info, 0, sizeof info);
  335|       |
  336|      0|      if (!(flag_for_card & FLAG_FOR_CARD_SUPPRESS_ERRORS))
  ------------------
  |  |  229|      0|#define FLAG_FOR_CARD_SUPPRESS_ERRORS 2
  ------------------
  |  Branch (336:11): [True: 0, False: 0]
  ------------------
  337|      0|        rc = warn_version_mismatch (agent_ctx, SCDAEMON_NAME, 2);
  ------------------
  |  |  719|      0|#define SCDAEMON_NAME "scdaemon"
  ------------------
  338|      0|      if (!rc)
  ------------------
  |  Branch (338:11): [True: 0, False: 0]
  ------------------
  339|      0|        rc = assuan_transact (agent_ctx,
  340|      0|                              opt.flags.use_only_openpgp_card?
  ------------------
  |  Branch (340:31): [True: 0, False: 0]
  ------------------
  341|      0|                              "SCD SERIALNO openpgp" : "SCD SERIALNO",
  342|      0|                              NULL, NULL, NULL, NULL,
  343|      0|                              learn_status_cb, &info);
  344|      0|      if (rc && !(flag_for_card & FLAG_FOR_CARD_SUPPRESS_ERRORS))
  ------------------
  |  |  229|      0|#define FLAG_FOR_CARD_SUPPRESS_ERRORS 2
  ------------------
  |  Branch (344:11): [True: 0, False: 0]
  |  Branch (344:17): [True: 0, False: 0]
  ------------------
  345|      0|        {
  346|      0|          switch (gpg_err_code (rc))
  347|      0|            {
  348|      0|            case GPG_ERR_NOT_SUPPORTED:
  ------------------
  |  Branch (348:13): [True: 0, False: 0]
  ------------------
  349|      0|            case GPG_ERR_NO_SCDAEMON:
  ------------------
  |  Branch (349:13): [True: 0, False: 0]
  ------------------
  350|      0|              write_status_text (STATUS_CARDCTRL, "6");
  351|      0|              break;
  352|      0|            case GPG_ERR_OBJ_TERM_STATE:
  ------------------
  |  Branch (352:13): [True: 0, False: 0]
  ------------------
  353|      0|              write_status_text (STATUS_CARDCTRL, "7");
  354|      0|              break;
  355|      0|            default:
  ------------------
  |  Branch (355:13): [True: 0, False: 0]
  ------------------
  356|      0|              write_status_text (STATUS_CARDCTRL, "4");
  357|      0|              log_info ("selecting card failed: %s\n", gpg_strerror (rc));
  358|      0|              break;
  359|      0|            }
  360|      0|        }
  361|       |
  362|      0|      if (!rc && is_status_enabled () && info.serialno)
  ------------------
  |  Branch (362:11): [True: 0, False: 0]
  |  Branch (362:18): [True: 0, False: 0]
  |  Branch (362:42): [True: 0, False: 0]
  ------------------
  363|      0|        {
  364|      0|          char *buf;
  365|       |
  366|      0|          buf = xasprintf ("3 %s", info.serialno);
  367|      0|          write_status_text (STATUS_CARDCTRL, buf);
  368|      0|          xfree (buf);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  369|      0|        }
  370|       |
  371|      0|      agent_release_card_info (&info);
  372|       |
  373|      0|      if (!rc)
  ------------------
  |  Branch (373:11): [True: 0, False: 0]
  ------------------
  374|      0|        did_early_card_test = 1;
  375|      0|    }
  376|       |
  377|       |
  378|   130k|  return rc;
  379|   130k|}

gpg_dirmngr_deinit_session_data:
  127|  17.0k|{
  128|  17.0k|  dirmngr_local_t dml;
  129|       |
  130|  17.0k|  while ((dml = ctrl->dirmngr_local))
  ------------------
  |  Branch (130:10): [True: 0, False: 17.0k]
  ------------------
  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|  17.0k|}

keydb_new:
  255|  9.10k|{
  256|  9.10k|  gpg_error_t err;
  257|  9.10k|  KEYDB_HANDLE hd;
  258|       |
  259|  9.10k|  if (DBG_CLOCK)
  ------------------
  |  |  356|  9.10k|#define DBG_CLOCK   (opt.debug & DBG_CLOCK_VALUE)
  |  |  ------------------
  |  |  |  |  343|  9.10k|#define DBG_CLOCK_VALUE   4096
  |  |  ------------------
  |  |  |  Branch (356:21): [True: 0, False: 9.10k]
  |  |  ------------------
  ------------------
  260|      0|    log_clock ("keydb_new");
  261|       |
  262|  9.10k|  hd = xtrycalloc (1, sizeof *hd);
  ------------------
  |  |   99|  9.10k|#define xtrycalloc(a,b)  gcry_calloc ((a),(b))
  ------------------
  263|  9.10k|  if (!hd)
  ------------------
  |  Branch (263:7): [True: 0, False: 9.10k]
  ------------------
  264|      0|    {
  265|      0|      err = gpg_error_from_syserror ();
  266|      0|      goto leave;
  267|      0|    }
  268|       |
  269|  9.10k|  if (!opt.use_keyboxd)
  ------------------
  |  Branch (269:7): [True: 9.10k, False: 0]
  ------------------
  270|  9.10k|    {
  271|  9.10k|      err = internal_keydb_init (hd);
  272|  9.10k|      goto leave;
  273|  9.10k|    }
  274|      0|  hd->use_keyboxd = 1;
  275|      0|  hd->ctrl = ctrl;
  276|       |
  277|      0|  err = open_context (ctrl, &hd->kbl);
  278|       |
  279|  9.10k| leave:
  280|  9.10k|  if (err)
  ------------------
  |  Branch (280:7): [True: 0, False: 9.10k]
  ------------------
  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|  9.10k|  return hd;
  291|      0|}
keydb_release:
  297|  25.6k|{
  298|  25.6k|  keyboxd_local_t kbl;
  299|       |
  300|  25.6k|  if (!hd)
  ------------------
  |  Branch (300:7): [True: 16.5k, False: 9.10k]
  ------------------
  301|  16.5k|    return;
  302|       |
  303|  9.10k|  if (DBG_CLOCK)
  ------------------
  |  |  356|  9.10k|#define DBG_CLOCK   (opt.debug & DBG_CLOCK_VALUE)
  |  |  ------------------
  |  |  |  |  343|  9.10k|#define DBG_CLOCK_VALUE   4096
  |  |  ------------------
  |  |  |  Branch (356:21): [True: 0, False: 9.10k]
  |  |  ------------------
  ------------------
  304|      0|    log_clock ("keydb_release");
  305|  9.10k|  if (!hd->use_keyboxd)
  ------------------
  |  Branch (305:7): [True: 9.10k, False: 0]
  ------------------
  306|  9.10k|    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|  9.10k|  xfree (hd);
  ------------------
  |  |  104|  9.10k|#define xfree(a)         gcry_free ((a))
  ------------------
  319|  9.10k|}
keydb_search_reset:
  577|  7.30k|{
  578|  7.30k|  gpg_error_t err;
  579|       |
  580|  7.30k|  if (!hd)
  ------------------
  |  Branch (580:7): [True: 0, False: 7.30k]
  ------------------
  581|      0|    return gpg_error (GPG_ERR_INV_ARG);
  582|       |
  583|  7.30k|  if (DBG_CLOCK)
  ------------------
  |  |  356|  7.30k|#define DBG_CLOCK   (opt.debug & DBG_CLOCK_VALUE)
  |  |  ------------------
  |  |  |  |  343|  7.30k|#define DBG_CLOCK_VALUE   4096
  |  |  ------------------
  |  |  |  Branch (356:21): [True: 0, False: 7.30k]
  |  |  ------------------
  ------------------
  584|      0|    log_clock ("%s", __func__);
  585|  7.30k|  if (DBG_CACHE)
  ------------------
  |  |  352|  7.30k|#define DBG_CACHE  (opt.debug & DBG_CACHE_VALUE)
  |  |  ------------------
  |  |  |  |  338|  7.30k|#define DBG_CACHE_VALUE   64	/* debug the caching */
  |  |  ------------------
  |  |  |  Branch (352:20): [True: 0, False: 7.30k]
  |  |  ------------------
  ------------------
  586|      0|    log_debug ("%s (hd=%p)", __func__, hd);
  587|       |
  588|  7.30k|  if (!hd->use_keyboxd)
  ------------------
  |  Branch (588:7): [True: 7.30k, False: 0]
  ------------------
  589|  7.30k|    {
  590|  7.30k|      err = internal_keydb_search_reset (hd);
  591|  7.30k|      goto leave;
  592|  7.30k|    }
  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|  7.30k| leave:
  603|  7.30k|  return err;
  604|      0|}
keydb_search:
  677|  16.4k|{
  678|  16.4k|  gpg_error_t err;
  679|  16.4k|  int i;
  680|  16.4k|  char line[ASSUAN_LINELENGTH];
  681|  16.4k|  char *buffer;
  682|  16.4k|  size_t len;
  683|       |
  684|  16.4k|  if (!hd)
  ------------------
  |  Branch (684:7): [True: 0, False: 16.4k]
  ------------------
  685|      0|    return gpg_error (GPG_ERR_INV_ARG);
  686|       |
  687|  16.4k|  if (descindex)
  ------------------
  |  Branch (687:7): [True: 0, False: 16.4k]
  ------------------
  688|      0|    *descindex = 0; /* Make sure it is always set on return.  */
  689|       |
  690|  16.4k|  if (DBG_CLOCK)
  ------------------
  |  |  356|  16.4k|#define DBG_CLOCK   (opt.debug & DBG_CLOCK_VALUE)
  |  |  ------------------
  |  |  |  |  343|  16.4k|#define DBG_CLOCK_VALUE   4096
  |  |  ------------------
  |  |  |  Branch (356:21): [True: 0, False: 16.4k]
  |  |  ------------------
  ------------------
  691|      0|    log_clock ("%s enter", __func__);
  692|       |
  693|  16.4k|  if (DBG_LOOKUP)
  ------------------
  |  |  357|  16.4k|#define DBG_LOOKUP  (opt.debug & DBG_LOOKUP_VALUE)
  |  |  ------------------
  |  |  |  |  344|  16.4k|#define DBG_LOOKUP_VALUE  8192	/* debug the key lookup */
  |  |  ------------------
  |  |  |  Branch (357:21): [True: 0, False: 16.4k]
  |  |  ------------------
  ------------------
  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.4k|  if (!hd->use_keyboxd)
  ------------------
  |  Branch (704:7): [True: 16.4k, False: 0]
  ------------------
  705|  16.4k|    {
  706|  16.4k|      err = internal_keydb_search (hd, desc, ndesc, descindex);
  707|  16.4k|      goto leave;
  708|  16.4k|    }
  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.4k| leave:
  862|  16.4k|  if (DBG_CLOCK)
  ------------------
  |  |  356|  16.4k|#define DBG_CLOCK   (opt.debug & DBG_CLOCK_VALUE)
  |  |  ------------------
  |  |  |  |  343|  16.4k|#define DBG_CLOCK_VALUE   4096
  |  |  ------------------
  |  |  |  Branch (356:21): [True: 0, False: 16.4k]
  |  |  ------------------
  ------------------
  863|      0|    log_clock ("%s leave (%sfound)", __func__, err? "not ":"");
  ------------------
  |  Branch (863:48): [True: 0, False: 0]
  ------------------
  864|  16.4k|  return err;
  865|      0|}

handle_compressed:
  313|   141k|{
  314|   141k|    int rc;
  315|       |
  316|   141k|    if(check_compress_algo(cd->algorithm))
  ------------------
  |  Branch (316:8): [True: 145, False: 141k]
  ------------------
  317|    145|      return GPG_ERR_COMPR_ALGO;
  318|   141k|    if(cd->algorithm) {
  ------------------
  |  Branch (318:8): [True: 0, False: 141k]
  ------------------
  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|   141k|    if( callback )
  ------------------
  |  Branch (327:9): [True: 53.3k, False: 88.3k]
  ------------------
  328|  53.3k|	rc = callback(cd->buf, passthru );
  329|  88.3k|    else
  330|  88.3k|      rc = proc_packets (ctrl,procctx, cd->buf);
  331|   141k|    cd->buf = NULL;
  332|   141k|    return rc;
  333|   141k|}

is_status_enabled:
  132|   135k|{
  133|   135k|  return !!statusfp;
  134|   135k|}
write_status:
  139|   521k|{
  140|   521k|    write_status_text( no, NULL );
  141|   521k|}
write_status_strings:
  149|   709k|{
  150|   709k|  va_list arg_ptr;
  151|   709k|  const char *s;
  152|       |
  153|   709k|  if (!statusfp || !status_currently_allowed (no) )
  ------------------
  |  Branch (153:7): [True: 709k, False: 0]
  |  Branch (153:20): [True: 0, False: 0]
  ------------------
  154|   709k|    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|   709k|{
  231|   709k|  write_status_strings (no, text, NULL);
  232|   709k|}
write_status_printf:
  239|  13.9k|{
  240|  13.9k|  va_list arg_ptr;
  241|  13.9k|  char *buf;
  242|       |
  243|  13.9k|  if (!statusfp || !status_currently_allowed (no) )
  ------------------
  |  Branch (243:7): [True: 13.9k, False: 0]
  |  Branch (243:20): [True: 0, False: 0]
  ------------------
  244|  13.9k|    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_error:
  287|  3.53k|{
  288|  3.53k|  if (!statusfp || !status_currently_allowed (STATUS_ERROR))
  ------------------
  |  Branch (288:7): [True: 3.53k, False: 0]
  |  Branch (288:20): [True: 0, False: 0]
  ------------------
  289|  3.53k|    return;  /* Not enabled or allowed. */
  290|       |
  291|      0|  es_fprintf (statusfp, "[GNUPG:] %s %s %u\n",
  292|      0|              get_status_string (STATUS_ERROR), where, err);
  293|      0|  if (es_fflush (statusfp) && opt.exit_on_status_write_error)
  ------------------
  |  Branch (293:7): [True: 0, False: 0]
  |  Branch (293:31): [True: 0, False: 0]
  ------------------
  294|      0|    g10_exit (0);
  295|      0|}
write_status_errcode:
  301|   253k|{
  302|   253k|  if (!statusfp || !status_currently_allowed (STATUS_ERROR))
  ------------------
  |  Branch (302:7): [True: 253k, False: 0]
  |  Branch (302:20): [True: 0, False: 0]
  ------------------
  303|   253k|    return;  /* Not enabled or allowed. */
  304|       |
  305|      0|  es_fprintf (statusfp, "[GNUPG:] %s %s %u\n",
  306|      0|              get_status_string (STATUS_ERROR), where, gpg_err_code (errcode));
  307|      0|  if (es_fflush (statusfp) && opt.exit_on_status_write_error)
  ------------------
  |  Branch (307:7): [True: 0, False: 0]
  |  Branch (307:31): [True: 0, False: 0]
  ------------------
  308|      0|    g10_exit (0);
  309|      0|}
write_status_text_and_buffer:
  339|  1.78k|{
  340|  1.78k|  const char *s, *text;
  341|  1.78k|  int esc, first;
  342|  1.78k|  int lower_limit = ' ';
  343|  1.78k|  size_t n, count, dowrap;
  344|       |
  345|  1.78k|  if (!statusfp || !status_currently_allowed (no))
  ------------------
  |  Branch (345:7): [True: 1.78k, False: 0]
  |  Branch (345:20): [True: 0, False: 0]
  ------------------
  346|  1.78k|    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|  1.78k|{
  408|  1.78k|  write_status_text_and_buffer (no, NULL, buffer, len, wrap);
  409|  1.78k|}

decrypt_message:
   46|  8.53k|{
   47|  8.53k|  IOBUF fp;
   48|  8.53k|  armor_filter_context_t *afx = NULL;
   49|  8.53k|  progress_filter_context_t *pfx;
   50|  8.53k|  int rc;
   51|       |
   52|  8.53k|  pfx = new_progress_context ();
   53|       |
   54|       |  /* Open the message file.  */
   55|  8.53k|  fp = iobuf_open (filename);
   56|  8.53k|  if (fp && is_secured_file (iobuf_get_fd (fp)))
  ------------------
  |  Branch (56:7): [True: 8.53k, False: 0]
  |  Branch (56:13): [True: 0, False: 8.53k]
  ------------------
   57|      0|    {
   58|      0|      iobuf_close (fp);
   59|      0|      fp = NULL;
   60|      0|      gpg_err_set_errno (EPERM);
   61|      0|    }
   62|  8.53k|  if ( !fp )
  ------------------
  |  Branch (62:8): [True: 0, False: 8.53k]
  ------------------
   63|      0|    {
   64|      0|      rc = gpg_error_from_syserror ();
   65|      0|      log_error (_("can't open '%s': %s\n"), print_fname_stdin(filename),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
   66|      0|                 gpg_strerror (rc));
   67|      0|      release_progress_context (pfx);
   68|      0|      return rc;
   69|      0|    }
   70|       |
   71|  8.53k|  handle_progress (pfx, fp, filename);
   72|       |
   73|  8.53k|  if ( !opt.no_armor )
  ------------------
  |  Branch (73:8): [True: 8.53k, False: 0]
  ------------------
   74|  8.53k|    {
   75|  8.53k|      if ( use_armor_filter( fp ) )
  ------------------
  |  Branch (75:12): [True: 1.72k, False: 6.81k]
  ------------------
   76|  1.72k|        {
   77|  1.72k|          afx = new_armor_context ();
   78|  1.72k|          push_armor_filter ( afx, fp );
   79|  1.72k|	}
   80|  8.53k|    }
   81|       |
   82|  8.53k|  if (!opt.outfile)
  ------------------
  |  Branch (82:7): [True: 8.53k, False: 0]
  ------------------
   83|  8.53k|    {
   84|  8.53k|      opt.outfile = "-";
   85|  8.53k|      opt.flags.dummy_outfile = 1;
   86|  8.53k|    }
   87|      0|  else
   88|      0|    opt.flags.dummy_outfile = 0;
   89|  8.53k|  rc = proc_encryption_packets (ctrl, NULL, fp );
   90|  8.53k|  if (opt.flags.dummy_outfile)
  ------------------
  |  Branch (90:7): [True: 8.53k, False: 0]
  ------------------
   91|  8.53k|    opt.outfile = NULL;
   92|       |
   93|  8.53k|  iobuf_close (fp);
   94|  8.53k|  release_armor_context (afx);
   95|  8.53k|  release_progress_context (pfx);
   96|  8.53k|  return rc;
   97|  8.53k|}
decrypt_messages:
  177|  8.53k|{
  178|  8.53k|  IOBUF fp;
  179|  8.53k|  progress_filter_context_t *pfx;
  180|  8.53k|  char *p, *output = NULL;
  181|  8.53k|  int rc=0,use_stdin=0;
  182|  8.53k|  unsigned int lno=0;
  183|       |
  184|  8.53k|  if (opt.outfile)
  ------------------
  |  Branch (184:7): [True: 0, False: 8.53k]
  ------------------
  185|      0|    {
  186|      0|      log_error(_("--output doesn't work for this command\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  187|      0|      return;
  188|      0|    }
  189|       |
  190|  8.53k|  pfx = new_progress_context ();
  191|       |
  192|  8.53k|  if(!nfiles)
  ------------------
  |  Branch (192:6): [True: 0, False: 8.53k]
  ------------------
  193|      0|    use_stdin=1;
  194|       |
  195|  8.53k|  for(;;)
  196|  17.0k|    {
  197|  17.0k|      char line[2048];
  198|  17.0k|      char *filename=NULL;
  199|       |
  200|  17.0k|      if(use_stdin)
  ------------------
  |  Branch (200:10): [True: 0, False: 17.0k]
  ------------------
  201|      0|	{
  202|      0|	  if(fgets(line, DIM(line), stdin))
  ------------------
  |  |   47|      0|#define DIM(v)		     (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (202:7): [True: 0, False: 0]
  ------------------
  203|      0|	    {
  204|      0|	      lno++;
  205|      0|	      if (!*line || line[strlen(line)-1] != '\n')
  ------------------
  |  Branch (205:12): [True: 0, False: 0]
  |  Branch (205:22): [True: 0, False: 0]
  ------------------
  206|      0|		log_error("input line %u too long or missing LF\n", lno);
  207|      0|	      else
  208|      0|		{
  209|      0|		  line[strlen(line)-1] = '\0';
  210|      0|		  filename=line;
  211|      0|		}
  212|      0|	    }
  213|      0|	}
  214|  17.0k|      else
  215|  17.0k|	{
  216|  17.0k|	  if(nfiles)
  ------------------
  |  Branch (216:7): [True: 8.53k, False: 8.53k]
  ------------------
  217|  8.53k|	    {
  218|  8.53k|	      filename=*files;
  219|  8.53k|	      nfiles--;
  220|  8.53k|	      files++;
  221|  8.53k|	    }
  222|  17.0k|	}
  223|       |
  224|  17.0k|      if(filename==NULL)
  ------------------
  |  Branch (224:10): [True: 8.53k, False: 8.53k]
  ------------------
  225|  8.53k|	break;
  226|       |
  227|  8.53k|      print_file_status(STATUS_FILE_START, filename, 3);
  228|  8.53k|      output = make_outfile_name(filename);
  229|  8.53k|      if (!output)
  ------------------
  |  Branch (229:11): [True: 0, False: 8.53k]
  ------------------
  230|      0|        goto next_file;
  231|  8.53k|      fp = iobuf_open(filename);
  232|  8.53k|      if (fp)
  ------------------
  |  Branch (232:11): [True: 8.53k, False: 0]
  ------------------
  233|  8.53k|        iobuf_ioctl (fp, IOBUF_IOCTL_NO_CACHE, 1, NULL);
  234|  8.53k|      if (fp && is_secured_file (iobuf_get_fd (fp)))
  ------------------
  |  Branch (234:11): [True: 8.53k, False: 0]
  |  Branch (234:17): [True: 0, False: 8.53k]
  ------------------
  235|      0|        {
  236|      0|          iobuf_close (fp);
  237|      0|          fp = NULL;
  238|      0|          gpg_err_set_errno (EPERM);
  239|      0|        }
  240|  8.53k|      if (!fp)
  ------------------
  |  Branch (240:11): [True: 0, False: 8.53k]
  ------------------
  241|      0|        {
  242|      0|          log_error(_("can't open '%s'\n"), print_fname_stdin(filename));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  243|      0|          goto next_file;
  244|      0|        }
  245|       |
  246|  8.53k|      handle_progress (pfx, fp, filename);
  247|       |
  248|  8.53k|      if (!opt.no_armor)
  ------------------
  |  Branch (248:11): [True: 8.53k, False: 0]
  ------------------
  249|  8.53k|        {
  250|  8.53k|          if (use_armor_filter(fp))
  ------------------
  |  Branch (250:15): [True: 1.72k, False: 6.81k]
  ------------------
  251|  1.72k|            {
  252|  1.72k|              armor_filter_context_t *afx = new_armor_context ();
  253|  1.72k|              rc = push_armor_filter (afx, fp);
  254|  1.72k|              if (rc)
  ------------------
  |  Branch (254:19): [True: 0, False: 1.72k]
  ------------------
  255|      0|                log_error("failed to push armor filter");
  256|  1.72k|              release_armor_context (afx);
  257|  1.72k|            }
  258|  8.53k|        }
  259|  8.53k|      rc = proc_packets (ctrl,NULL, fp);
  260|  8.53k|      iobuf_close(fp);
  261|  8.53k|      if (rc)
  ------------------
  |  Branch (261:11): [True: 604, False: 7.92k]
  ------------------
  262|    604|        log_error("%s: decryption failed: %s\n", print_fname_stdin(filename),
  263|    604|                  gpg_strerror (rc));
  264|  8.53k|      p = get_last_passphrase();
  265|  8.53k|      set_next_passphrase(p);
  266|  8.53k|      xfree (p);
  ------------------
  |  |  104|  8.53k|#define xfree(a)         gcry_free ((a))
  ------------------
  267|       |
  268|  8.53k|    next_file:
  269|       |      /* Note that we emit file_done even after an error. */
  270|  8.53k|      write_status( STATUS_FILE_DONE );
  271|  8.53k|      xfree(output);
  ------------------
  |  |  104|  8.53k|#define xfree(a)         gcry_free ((a))
  ------------------
  272|  8.53k|      reset_literals_seen();
  273|  8.53k|    }
  274|       |
  275|  8.53k|  set_next_passphrase(NULL);
  276|  8.53k|  release_progress_context (pfx);
  277|  8.53k|}

free_symkey_enc:
   76|  3.48k|{
   77|  3.48k|    xfree(enc);
  ------------------
  |  |  104|  3.48k|#define xfree(a)         gcry_free ((a))
  ------------------
   78|  3.48k|}
free_pubkey_enc:
   82|  8.37k|{
   83|  8.37k|    int n, i;
   84|  8.37k|    n = pubkey_get_nenc( enc->pubkey_algo );
   85|  8.37k|    if( !n )
  ------------------
  |  Branch (85:9): [True: 4.50k, False: 3.86k]
  ------------------
   86|  4.50k|	mpi_release(enc->data[0]);
   87|  15.7k|    for(i=0; i < n; i++ )
  ------------------
  |  Branch (87:14): [True: 7.35k, False: 8.37k]
  ------------------
   88|  7.35k|	mpi_release( enc->data[i] );
   89|  8.37k|    xfree(enc);
  ------------------
  |  |  104|  8.37k|#define xfree(a)         gcry_free ((a))
  ------------------
   90|  8.37k|}
free_seckey_enc:
   94|   137k|{
   95|   137k|  int n, i;
   96|       |
   97|   137k|  n = pubkey_get_nsig( sig->pubkey_algo );
   98|   137k|  if( !n )
  ------------------
  |  Branch (98:7): [True: 113k, False: 23.6k]
  ------------------
   99|   113k|    mpi_release(sig->data[0]);
  100|   175k|  for(i=0; i < n; i++ )
  ------------------
  |  Branch (100:12): [True: 37.7k, False: 137k]
  ------------------
  101|  37.7k|    mpi_release( sig->data[i] );
  102|       |
  103|   137k|  xfree(sig->revkey);
  ------------------
  |  |  104|   137k|#define xfree(a)         gcry_free ((a))
  ------------------
  104|   137k|  xfree(sig->hashed);
  ------------------
  |  |  104|   137k|#define xfree(a)         gcry_free ((a))
  ------------------
  105|   137k|  xfree(sig->unhashed);
  ------------------
  |  |  104|   137k|#define xfree(a)         gcry_free ((a))
  ------------------
  106|       |
  107|   137k|  xfree (sig->signers_uid);
  ------------------
  |  |  104|   137k|#define xfree(a)         gcry_free ((a))
  ------------------
  108|       |
  109|   137k|  xfree(sig);
  ------------------
  |  |  104|   137k|#define xfree(a)         gcry_free ((a))
  ------------------
  110|   137k|}
release_public_key_parts:
  115|  67.8k|{
  116|  67.8k|  int n, i;
  117|       |
  118|  67.8k|  if (pk->seckey_info)
  ------------------
  |  Branch (118:7): [True: 10.8k, False: 56.9k]
  ------------------
  119|  10.8k|    n = pubkey_get_nskey (pk->pubkey_algo);
  120|  56.9k|  else
  121|  56.9k|    n = pubkey_get_npkey (pk->pubkey_algo);
  122|  67.8k|  if (!n)
  ------------------
  |  Branch (122:7): [True: 39.8k, False: 28.0k]
  ------------------
  123|  39.8k|    mpi_release (pk->pkey[0]);
  124|   173k|  for (i=0; i < n; i++ )
  ------------------
  |  Branch (124:13): [True: 106k, False: 67.8k]
  ------------------
  125|   106k|    {
  126|   106k|      mpi_release (pk->pkey[i]);
  127|   106k|      pk->pkey[i] = NULL;
  128|   106k|    }
  129|  67.8k|  if (pk->seckey_info)
  ------------------
  |  Branch (129:7): [True: 10.8k, False: 56.9k]
  ------------------
  130|  10.8k|    {
  131|  10.8k|      xfree (pk->seckey_info);
  ------------------
  |  |  104|  10.8k|#define xfree(a)         gcry_free ((a))
  ------------------
  132|  10.8k|      pk->seckey_info = NULL;
  133|  10.8k|    }
  134|  67.8k|  if (pk->prefs)
  ------------------
  |  Branch (134:7): [True: 262, False: 67.5k]
  ------------------
  135|    262|    {
  136|    262|      xfree (pk->prefs);
  ------------------
  |  |  104|    262|#define xfree(a)         gcry_free ((a))
  ------------------
  137|    262|      pk->prefs = NULL;
  138|    262|    }
  139|  67.8k|  free_user_id (pk->user_id);
  140|  67.8k|  pk->user_id = NULL;
  141|  67.8k|  if (pk->revkey)
  ------------------
  |  Branch (141:7): [True: 123, False: 67.7k]
  ------------------
  142|    123|    {
  143|    123|      xfree(pk->revkey);
  ------------------
  |  |  104|    123|#define xfree(a)         gcry_free ((a))
  ------------------
  144|    123|      pk->revkey=NULL;
  145|    123|      pk->numrevkeys=0;
  146|    123|    }
  147|  67.8k|  if (pk->serialno)
  ------------------
  |  Branch (147:7): [True: 0, False: 67.8k]
  ------------------
  148|      0|    {
  149|      0|      xfree (pk->serialno);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  150|      0|      pk->serialno = NULL;
  151|      0|    }
  152|  67.8k|  if (pk->updateurl)
  ------------------
  |  Branch (152:7): [True: 1.25k, False: 66.5k]
  ------------------
  153|  1.25k|    {
  154|  1.25k|      xfree (pk->updateurl);
  ------------------
  |  |  104|  1.25k|#define xfree(a)         gcry_free ((a))
  ------------------
  155|  1.25k|      pk->updateurl = NULL;
  156|  1.25k|    }
  157|  67.8k|}
free_public_key:
  164|  75.7k|{
  165|  75.7k|  if (pk)
  ------------------
  |  Branch (165:7): [True: 67.8k, False: 7.90k]
  ------------------
  166|  67.8k|    {
  167|  67.8k|      release_public_key_parts (pk);
  168|  67.8k|      xfree(pk);
  ------------------
  |  |  104|  67.8k|#define xfree(a)         gcry_free ((a))
  ------------------
  169|  67.8k|    }
  170|  75.7k|}
copy_prefs:
  192|  4.10k|{
  193|  4.10k|    size_t n;
  194|  4.10k|    prefitem_t *new;
  195|       |
  196|  4.10k|    if (!prefs)
  ------------------
  |  Branch (196:9): [True: 3.84k, False: 262]
  ------------------
  197|  3.84k|        return NULL;
  198|       |
  199|  2.84k|    for (n=0; prefs[n].type; n++)
  ------------------
  |  Branch (199:15): [True: 2.57k, False: 262]
  ------------------
  200|  2.57k|        ;
  201|    262|    new = xmalloc ( sizeof (*new) * (n+1));
  ------------------
  |  |  107|    262|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  202|  2.84k|    for (n=0; prefs[n].type; n++) {
  ------------------
  |  Branch (202:15): [True: 2.57k, False: 262]
  ------------------
  203|  2.57k|        new[n].type = prefs[n].type;
  204|  2.57k|        new[n].value = prefs[n].value;
  205|  2.57k|    }
  206|    262|    new[n].type = PREFTYPE_NONE;
  207|    262|    new[n].value = 0;
  208|       |
  209|    262|    return new;
  210|  4.10k|}
free_comment:
  304|    997|{
  305|    997|    xfree(rem);
  ------------------
  |  |  104|    997|#define xfree(a)         gcry_free ((a))
  ------------------
  306|    997|}
free_attributes:
  310|  51.9k|{
  311|  51.9k|  if (!uid)
  ------------------
  |  Branch (311:7): [True: 0, False: 51.9k]
  ------------------
  312|      0|    return;
  313|       |
  314|  51.9k|  xfree(uid->attribs);
  ------------------
  |  |  104|  51.9k|#define xfree(a)         gcry_free ((a))
  ------------------
  315|  51.9k|  xfree(uid->attrib_data);
  ------------------
  |  |  104|  51.9k|#define xfree(a)         gcry_free ((a))
  ------------------
  316|       |
  317|  51.9k|  uid->attribs=NULL;
  318|  51.9k|  uid->attrib_data=NULL;
  319|  51.9k|  uid->attrib_len=0;
  320|  51.9k|}
free_user_id:
  324|   119k|{
  325|   119k|  if (!uid)
  ------------------
  |  Branch (325:7): [True: 67.8k, False: 51.9k]
  ------------------
  326|  67.8k|    return;
  327|       |
  328|  51.9k|  log_assert (uid->ref > 0);
  329|  51.9k|  if (--uid->ref)
  ------------------
  |  Branch (329:7): [True: 0, False: 51.9k]
  ------------------
  330|      0|    return;
  331|       |
  332|  51.9k|  free_attributes(uid);
  333|  51.9k|  xfree (uid->prefs);
  ------------------
  |  |  104|  51.9k|#define xfree(a)         gcry_free ((a))
  ------------------
  334|  51.9k|  xfree (uid->namehash);
  ------------------
  |  |  104|  51.9k|#define xfree(a)         gcry_free ((a))
  ------------------
  335|  51.9k|  xfree (uid->updateurl);
  ------------------
  |  |  104|  51.9k|#define xfree(a)         gcry_free ((a))
  ------------------
  336|  51.9k|  xfree (uid->mbox);
  ------------------
  |  |  104|  51.9k|#define xfree(a)         gcry_free ((a))
  ------------------
  337|  51.9k|  xfree (uid);
  ------------------
  |  |  104|  51.9k|#define xfree(a)         gcry_free ((a))
  ------------------
  338|  51.9k|}
free_compressed:
  342|   142k|{
  343|   142k|  if (!zd)
  ------------------
  |  Branch (343:7): [True: 0, False: 142k]
  ------------------
  344|      0|    return;
  345|       |
  346|   142k|  if (zd->buf)
  ------------------
  |  Branch (346:7): [True: 424, False: 141k]
  ------------------
  347|    424|    {
  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|    899|      while (iobuf_read( zd->buf, NULL, 1<<30 ) != -1)
  ------------------
  |  Branch (351:14): [True: 475, False: 424]
  ------------------
  352|    475|        ;
  353|    424|    }
  354|   142k|  xfree(zd);
  ------------------
  |  |  104|   142k|#define xfree(a)         gcry_free ((a))
  ------------------
  355|   142k|}
free_encrypted:
  359|   131k|{
  360|   131k|  if (!ed)
  ------------------
  |  Branch (360:7): [True: 0, False: 131k]
  ------------------
  361|      0|    return;
  362|       |
  363|   131k|  if (ed->buf)
  ------------------
  |  Branch (363:7): [True: 126k, False: 4.84k]
  ------------------
  364|   126k|    {
  365|       |      /* We need to skip some bytes. */
  366|   126k|      if (ed->is_partial)
  ------------------
  |  Branch (366:11): [True: 1.12k, False: 125k]
  ------------------
  367|  1.12k|        {
  368|  1.37k|          while (iobuf_read( ed->buf, NULL, 1<<30 ) != -1)
  ------------------
  |  Branch (368:18): [True: 257, False: 1.12k]
  ------------------
  369|    257|            ;
  370|  1.12k|	}
  371|   125k|      else
  372|   125k|        {
  373|   127k|          while (ed->len)
  ------------------
  |  Branch (373:18): [True: 2.07k, False: 125k]
  ------------------
  374|  2.07k|            {
  375|       |              /* Skip the packet. */
  376|  2.07k|              int n = iobuf_read( ed->buf, NULL, ed->len );
  377|  2.07k|              if (n == -1)
  ------------------
  |  Branch (377:19): [True: 285, False: 1.78k]
  ------------------
  378|    285|                ed->len = 0;
  379|  1.78k|              else
  380|  1.78k|                ed->len -= n;
  381|  2.07k|            }
  382|   125k|	}
  383|   126k|    }
  384|   131k|  xfree (ed);
  ------------------
  |  |  104|   131k|#define xfree(a)         gcry_free ((a))
  ------------------
  385|   131k|}
free_plaintext:
  390|  29.6k|{
  391|  29.6k|  if (!pt)
  ------------------
  |  Branch (391:7): [True: 0, False: 29.6k]
  ------------------
  392|      0|    return;
  393|       |
  394|  29.6k|  if (pt->buf)
  ------------------
  |  Branch (394:7): [True: 28.4k, False: 1.22k]
  ------------------
  395|  28.4k|    { /* We need to skip some bytes.  */
  396|  28.4k|      if (pt->is_partial)
  ------------------
  |  Branch (396:11): [True: 5.24k, False: 23.1k]
  ------------------
  397|  5.24k|        {
  398|  11.1k|          while (iobuf_read( pt->buf, NULL, 1<<30 ) != -1)
  ------------------
  |  Branch (398:18): [True: 5.90k, False: 5.24k]
  ------------------
  399|  5.90k|            ;
  400|  5.24k|        }
  401|  23.1k|      else
  402|  23.1k|        {
  403|  25.1k|          while( pt->len )
  ------------------
  |  Branch (403:18): [True: 1.97k, False: 23.1k]
  ------------------
  404|  1.97k|            { /* Skip the packet.  */
  405|  1.97k|              int n = iobuf_read( pt->buf, NULL, pt->len );
  406|  1.97k|              if (n == -1)
  ------------------
  |  Branch (406:19): [True: 886, False: 1.08k]
  ------------------
  407|    886|                pt->len = 0;
  408|  1.08k|              else
  409|  1.08k|                pt->len -= n;
  410|  1.97k|            }
  411|  23.1k|	}
  412|  28.4k|    }
  413|  29.6k|  xfree (pt);
  ------------------
  |  |  104|  29.6k|#define xfree(a)         gcry_free ((a))
  ------------------
  414|  29.6k|}
free_packet:
  422|  1.54M|{
  423|  1.54M|  if (!pkt || !pkt->pkt.generic)
  ------------------
  |  Branch (423:7): [True: 647k, False: 901k]
  |  Branch (423:15): [True: 270k, False: 630k]
  ------------------
  424|   918k|    {
  425|   918k|      if (parsectx && parsectx->last_pkt.pkt.generic)
  ------------------
  |  Branch (425:11): [True: 916k, False: 2.07k]
  |  Branch (425:23): [True: 205k, False: 710k]
  ------------------
  426|   205k|        {
  427|   205k|          if (parsectx->free_last_pkt)
  ------------------
  |  Branch (427:15): [True: 10.5k, False: 194k]
  ------------------
  428|  10.5k|            {
  429|  10.5k|              free_packet (&parsectx->last_pkt, NULL);
  430|  10.5k|              parsectx->free_last_pkt = 0;
  431|  10.5k|            }
  432|   205k|          parsectx->last_pkt.pkttype = 0;
  433|   205k|          parsectx->last_pkt.pkt.generic = NULL;
  434|   205k|        }
  435|   918k|      return;
  436|   918k|    }
  437|       |
  438|   630k|  if (DBG_MEMORY)
  ------------------
  |  |  361|   630k|#define DBG_MEMORY    memory_debug_mode
  |  |  ------------------
  |  |  |  Branch (361:23): [True: 0, False: 630k]
  |  |  ------------------
  ------------------
  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|   630k|  if (parsectx && !parsectx->free_last_pkt
  ------------------
  |  Branch (444:7): [True: 56.2k, False: 574k]
  |  Branch (444:19): [True: 56.2k, False: 0]
  ------------------
  445|   630k|      && parsectx->last_pkt.pkttype == pkt->pkttype
  ------------------
  |  Branch (445:10): [True: 10.5k, False: 45.7k]
  ------------------
  446|   630k|      && parsectx->last_pkt.pkt.generic == pkt->pkt.generic)
  ------------------
  |  Branch (446:10): [True: 10.5k, False: 0]
  ------------------
  447|  10.5k|    {
  448|  10.5k|      parsectx->last_pkt = *pkt;
  449|  10.5k|      parsectx->free_last_pkt = 1;
  450|  10.5k|      pkt->pkt.generic = NULL;
  451|  10.5k|      return;
  452|  10.5k|    }
  453|       |
  454|   620k|  switch (pkt->pkttype)
  455|   620k|    {
  456|   135k|    case PKT_SIGNATURE:
  ------------------
  |  Branch (456:5): [True: 135k, False: 484k]
  ------------------
  457|   135k|      free_seckey_enc (pkt->pkt.signature);
  458|   135k|      break;
  459|  8.37k|    case PKT_PUBKEY_ENC:
  ------------------
  |  Branch (459:5): [True: 8.37k, False: 611k]
  ------------------
  460|  8.37k|      free_pubkey_enc (pkt->pkt.pubkey_enc);
  461|  8.37k|      break;
  462|  3.48k|    case PKT_SYMKEY_ENC:
  ------------------
  |  Branch (462:5): [True: 3.48k, False: 616k]
  ------------------
  463|  3.48k|      free_symkey_enc (pkt->pkt.symkey_enc);
  464|  3.48k|      break;
  465|  24.2k|    case PKT_PUBLIC_KEY:
  ------------------
  |  Branch (465:5): [True: 24.2k, False: 595k]
  ------------------
  466|  35.8k|    case PKT_PUBLIC_SUBKEY:
  ------------------
  |  Branch (466:5): [True: 11.5k, False: 608k]
  ------------------
  467|  47.7k|    case PKT_SECRET_KEY:
  ------------------
  |  Branch (467:5): [True: 11.9k, False: 608k]
  ------------------
  468|  52.1k|    case PKT_SECRET_SUBKEY:
  ------------------
  |  Branch (468:5): [True: 4.33k, False: 615k]
  ------------------
  469|  52.1k|      free_public_key (pkt->pkt.public_key);
  470|  52.1k|      break;
  471|    997|    case PKT_COMMENT:
  ------------------
  |  Branch (471:5): [True: 997, False: 619k]
  ------------------
  472|    997|      free_comment (pkt->pkt.comment);
  473|    997|      break;
  474|  51.9k|    case PKT_USER_ID:
  ------------------
  |  Branch (474:5): [True: 51.9k, False: 568k]
  ------------------
  475|  51.9k|      free_user_id (pkt->pkt.user_id);
  476|  51.9k|      break;
  477|   142k|    case PKT_COMPRESSED:
  ------------------
  |  Branch (477:5): [True: 142k, False: 477k]
  ------------------
  478|   142k|      free_compressed (pkt->pkt.compressed);
  479|   142k|      break;
  480|  5.98k|    case PKT_ENCRYPTED:
  ------------------
  |  Branch (480:5): [True: 5.98k, False: 614k]
  ------------------
  481|  9.59k|    case PKT_ENCRYPTED_MDC:
  ------------------
  |  Branch (481:5): [True: 3.61k, False: 616k]
  ------------------
  482|   131k|    case PKT_ENCRYPTED_AEAD:
  ------------------
  |  Branch (482:5): [True: 122k, False: 497k]
  ------------------
  483|   131k|      free_encrypted (pkt->pkt.encrypted);
  484|   131k|      break;
  485|  29.6k|    case PKT_PLAINTEXT:
  ------------------
  |  Branch (485:5): [True: 29.6k, False: 590k]
  ------------------
  486|  29.6k|      free_plaintext (pkt->pkt.plaintext);
  487|  29.6k|      break;
  488|  64.1k|    default:
  ------------------
  |  Branch (488:5): [True: 64.1k, False: 555k]
  ------------------
  489|  64.1k|      xfree (pkt->pkt.generic);
  ------------------
  |  |  104|  64.1k|#define xfree(a)         gcry_free ((a))
  ------------------
  490|  64.1k|      break;
  491|   620k|    }
  492|       |
  493|   620k|  pkt->pkt.generic = NULL;
  494|   620k|}
cmp_user_ids:
  556|  17.7k|{
  557|  17.7k|    int res=1;
  558|       |
  559|  17.7k|    if( a == b )
  ------------------
  |  Branch (559:9): [True: 0, False: 17.7k]
  ------------------
  560|      0|        return 0;
  561|       |
  562|  17.7k|    if( a->attrib_data && b->attrib_data )
  ------------------
  |  Branch (562:9): [True: 0, False: 17.7k]
  |  Branch (562:27): [True: 0, False: 0]
  ------------------
  563|      0|      {
  564|      0|	res = a->attrib_len - b->attrib_len;
  565|      0|	if( !res )
  ------------------
  |  Branch (565:6): [True: 0, False: 0]
  ------------------
  566|      0|	  res = memcmp( a->attrib_data, b->attrib_data, a->attrib_len );
  567|      0|      }
  568|  17.7k|    else if( !a->attrib_data && !b->attrib_data )
  ------------------
  |  Branch (568:14): [True: 17.7k, False: 0]
  |  Branch (568:33): [True: 17.7k, False: 0]
  ------------------
  569|  17.7k|      {
  570|  17.7k|	res = a->len - b->len;
  571|  17.7k|	if( !res )
  ------------------
  |  Branch (571:6): [True: 12.1k, False: 5.65k]
  ------------------
  572|  12.1k|	  res = memcmp( a->name, b->name, a->len );
  573|  17.7k|      }
  574|       |
  575|  17.7k|    return res;
  576|  17.7k|}

get_pubkey_for_sig:
  317|  2.96k|{
  318|  2.96k|  const byte *fpr;
  319|  2.96k|  size_t fprlen;
  320|       |
  321|  2.96k|  if (forced_pk)
  ------------------
  |  Branch (321:7): [True: 0, False: 2.96k]
  ------------------
  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|  2.96k|  fpr = issuer_fpr_raw (sig, &fprlen);
  329|  2.96k|  if (fpr && !get_pubkey_byfprint (ctrl, pk, NULL, fpr, fprlen))
  ------------------
  |  Branch (329:7): [True: 826, False: 2.14k]
  |  Branch (329:14): [True: 0, False: 826]
  ------------------
  330|      0|    return 0;
  331|       |
  332|       |  /* Fallback to use the ISSUER_KEYID.  */
  333|  2.96k|  return get_pubkey (ctrl, pk, sig->keyid);
  334|  2.96k|}
get_pubkey:
  360|  7.73k|{
  361|  7.73k|  int internal = 0;
  362|  7.73k|  int rc = 0;
  363|       |
  364|  7.73k|#if MAX_PK_CACHE_ENTRIES
  365|  7.73k|  if (pk)
  ------------------
  |  Branch (365:7): [True: 7.73k, False: 0]
  ------------------
  366|  7.73k|    {
  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|  7.73k|      pk_cache_entry_t ce;
  371|  7.73k|      for (ce = pk_cache; ce; ce = ce->next)
  ------------------
  |  Branch (371:27): [True: 0, False: 7.73k]
  ------------------
  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|  7.73k|    }
  382|  7.73k|#endif
  383|       |  /* More init stuff.  */
  384|  7.73k|  if (!pk)
  ------------------
  |  Branch (384:7): [True: 0, False: 7.73k]
  ------------------
  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|  7.73k|  {
  398|  7.73k|    struct getkey_ctx_s ctx;
  399|  7.73k|    kbnode_t kb = NULL;
  400|  7.73k|    kbnode_t found_key = NULL;
  401|       |
  402|  7.73k|    memset (&ctx, 0, sizeof ctx);
  403|  7.73k|    ctx.exact = 1; /* Use the key ID exactly as given.  */
  404|  7.73k|    ctx.not_allocated = 1;
  405|       |
  406|  7.73k|    if (ctrl && ctrl->cached_getkey_kdb)
  ------------------
  |  Branch (406:9): [True: 7.73k, False: 0]
  |  Branch (406:17): [True: 7.30k, False: 436]
  ------------------
  407|  7.30k|      {
  408|  7.30k|        ctx.kr_handle = ctrl->cached_getkey_kdb;
  409|  7.30k|        ctrl->cached_getkey_kdb = NULL;
  410|  7.30k|        keydb_search_reset (ctx.kr_handle);
  411|  7.30k|      }
  412|    436|    else
  413|    436|      {
  414|    436|        ctx.kr_handle = keydb_new (ctrl);
  415|    436|        if (!ctx.kr_handle)
  ------------------
  |  Branch (415:13): [True: 0, False: 436]
  ------------------
  416|      0|          {
  417|      0|            rc = gpg_error_from_syserror ();
  418|      0|            goto leave;
  419|      0|          }
  420|    436|      }
  421|  7.73k|    ctx.nitems = 1;
  422|  7.73k|    ctx.items[0].mode = KEYDB_SEARCH_MODE_LONG_KID;
  423|  7.73k|    ctx.items[0].u.kid[0] = keyid[0];
  424|  7.73k|    ctx.items[0].u.kid[1] = keyid[1];
  425|  7.73k|    ctx.req_usage = pk->req_usage;
  426|  7.73k|    rc = lookup (ctrl, &ctx, 0, &kb, &found_key);
  427|  7.73k|    if (!rc)
  ------------------
  |  Branch (427:9): [True: 0, False: 7.73k]
  ------------------
  428|      0|      {
  429|      0|	pk_from_block (pk, kb, found_key);
  430|      0|      }
  431|  7.73k|    getkey_end (ctrl, &ctx);
  432|  7.73k|    release_kbnode (kb);
  433|  7.73k|  }
  434|  7.73k|  if (!rc)
  ------------------
  |  Branch (434:7): [True: 0, False: 7.73k]
  ------------------
  435|      0|    goto leave;
  436|       |
  437|  7.73k|  rc = GPG_ERR_NO_PUBKEY;
  438|       |
  439|  7.73k|leave:
  440|  7.73k|  if (!rc)
  ------------------
  |  Branch (440:7): [True: 0, False: 7.73k]
  ------------------
  441|      0|    cache_public_key (pk);
  442|  7.73k|  if (internal)
  ------------------
  |  Branch (442:7): [True: 0, False: 7.73k]
  ------------------
  443|      0|    free_public_key (pk);
  444|  7.73k|  return rc;
  445|  7.73k|}
get_pubkey_fast:
  496|  4.30k|{
  497|  4.30k|  int rc = 0;
  498|  4.30k|  KEYDB_HANDLE hd;
  499|  4.30k|  KBNODE keyblock;
  500|  4.30k|  u32 pkid[2];
  501|       |
  502|  4.30k|  log_assert (pk);
  503|      0|#if MAX_PK_CACHE_ENTRIES
  504|      0|  {
  505|       |    /* Try to get it from the cache */
  506|  4.30k|    pk_cache_entry_t ce;
  507|       |
  508|  4.30k|    for (ce = pk_cache; ce; ce = ce->next)
  ------------------
  |  Branch (508:25): [True: 0, False: 4.30k]
  ------------------
  509|      0|      {
  510|      0|	if (ce->keyid[0] == keyid[0] && ce->keyid[1] == keyid[1]
  ------------------
  |  Branch (510:6): [True: 0, False: 0]
  |  Branch (510:34): [True: 0, False: 0]
  ------------------
  511|       |	    /* Only consider primary keys.  */
  512|      0|	    && ce->pk->keyid[0] == ce->pk->main_keyid[0]
  ------------------
  |  Branch (512:9): [True: 0, False: 0]
  ------------------
  513|      0|	    && ce->pk->keyid[1] == ce->pk->main_keyid[1])
  ------------------
  |  Branch (513:9): [True: 0, False: 0]
  ------------------
  514|      0|	  {
  515|      0|	    if (pk)
  ------------------
  |  Branch (515:10): [True: 0, False: 0]
  ------------------
  516|      0|	      copy_public_key (pk, ce->pk);
  517|      0|	    return 0;
  518|      0|	  }
  519|      0|      }
  520|  4.30k|  }
  521|  4.30k|#endif
  522|       |
  523|  4.30k|  hd = keydb_new (ctrl);
  524|  4.30k|  if (!hd)
  ------------------
  |  Branch (524:7): [True: 0, False: 4.30k]
  ------------------
  525|      0|    return gpg_error_from_syserror ();
  526|  4.30k|  rc = keydb_search_kid (hd, keyid);
  527|  4.30k|  if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND)
  ------------------
  |  Branch (527:7): [True: 4.30k, False: 0]
  ------------------
  528|  4.30k|    {
  529|  4.30k|      keydb_release (hd);
  530|  4.30k|      return GPG_ERR_NO_PUBKEY;
  531|  4.30k|    }
  532|      0|  rc = keydb_get_keyblock (hd, &keyblock);
  533|      0|  keydb_release (hd);
  534|      0|  if (rc)
  ------------------
  |  Branch (534:7): [True: 0, False: 0]
  ------------------
  535|      0|    {
  536|      0|      log_error ("keydb_get_keyblock failed: %s\n", gpg_strerror (rc));
  537|      0|      return GPG_ERR_NO_PUBKEY;
  538|      0|    }
  539|       |
  540|      0|  log_assert (keyblock && keyblock->pkt
  541|      0|              && keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
  542|       |
  543|       |  /* We return the primary key.  If KEYID matched a subkey, then we
  544|       |     return an error.  */
  545|      0|  keyid_from_pk (keyblock->pkt->pkt.public_key, pkid);
  546|      0|  if (keyid[0] == pkid[0] && keyid[1] == pkid[1])
  ------------------
  |  Branch (546:7): [True: 0, False: 0]
  |  Branch (546:30): [True: 0, False: 0]
  ------------------
  547|      0|    copy_public_key (pk, keyblock->pkt->pkt.public_key);
  548|      0|  else
  549|      0|    rc = GPG_ERR_NO_PUBKEY;
  550|       |
  551|      0|  release_kbnode (keyblock);
  552|       |
  553|       |  /* Not caching key here since it won't have all of the fields
  554|       |     properly set. */
  555|       |
  556|      0|  return rc;
  557|      0|}
get_pubkey_byfprint:
 1836|    826|{
 1837|    826|  int rc;
 1838|       |
 1839|    826|  if (r_keyblock)
  ------------------
  |  Branch (1839:7): [True: 0, False: 826]
  ------------------
 1840|      0|    *r_keyblock = NULL;
 1841|       |
 1842|    826|  if (fprint_len == 32 || fprint_len == 20 || fprint_len == 16)
  ------------------
  |  Branch (1842:7): [True: 253, False: 573]
  |  Branch (1842:27): [True: 573, False: 0]
  |  Branch (1842:47): [True: 0, False: 0]
  ------------------
 1843|    826|    {
 1844|    826|      struct getkey_ctx_s ctx;
 1845|    826|      KBNODE kb = NULL;
 1846|    826|      KBNODE found_key = NULL;
 1847|       |
 1848|    826|      memset (&ctx, 0, sizeof ctx);
 1849|    826|      ctx.exact = 1;
 1850|    826|      ctx.not_allocated = 1;
 1851|       |      /* FIXME: We should get the handle from the cache like we do in
 1852|       |       * get_pubkey.  */
 1853|    826|      ctx.kr_handle = keydb_new (ctrl);
 1854|    826|      if (!ctx.kr_handle)
  ------------------
  |  Branch (1854:11): [True: 0, False: 826]
  ------------------
 1855|      0|        return gpg_error_from_syserror ();
 1856|       |
 1857|    826|      ctx.nitems = 1;
 1858|    826|      ctx.items[0].mode = KEYDB_SEARCH_MODE_FPR;
 1859|    826|      memcpy (ctx.items[0].u.fpr, fprint, fprint_len);
 1860|    826|      ctx.items[0].fprlen = fprint_len;
 1861|    826|      if (pk)
  ------------------
  |  Branch (1861:11): [True: 826, False: 0]
  ------------------
 1862|    826|        ctx.req_usage = pk->req_usage;
 1863|    826|      rc = lookup (ctrl, &ctx, 0, &kb, &found_key);
 1864|    826|      if (!rc && pk)
  ------------------
  |  Branch (1864:11): [True: 0, False: 826]
  |  Branch (1864:18): [True: 0, False: 0]
  ------------------
 1865|      0|	pk_from_block (pk, kb, found_key);
 1866|    826|      if (!rc && r_keyblock)
  ------------------
  |  Branch (1866:11): [True: 0, False: 826]
  |  Branch (1866:18): [True: 0, False: 0]
  ------------------
 1867|      0|	{
 1868|      0|	  *r_keyblock = kb;
 1869|      0|	  kb = NULL;
 1870|      0|	}
 1871|    826|      release_kbnode (kb);
 1872|    826|      getkey_end (ctrl, &ctx);
 1873|    826|    }
 1874|      0|  else
 1875|      0|    rc = GPG_ERR_GENERAL; /* Oops */
 1876|    826|  return rc;
 1877|    826|}
parse_def_secret_key:
 1994|  3.53k|{
 1995|  3.53k|  KEYDB_HANDLE hd = NULL;
 1996|  3.53k|  strlist_t t;
 1997|  3.53k|  static int warned;
 1998|       |
 1999|  3.53k|  for (t = opt.def_secret_key; t; t = t->next)
  ------------------
  |  Branch (1999:32): [True: 0, False: 3.53k]
  ------------------
 2000|      0|    {
 2001|      0|      gpg_error_t err;
 2002|      0|      KEYDB_SEARCH_DESC desc;
 2003|      0|      KBNODE kb;
 2004|      0|      KBNODE node;
 2005|       |
 2006|      0|      err = classify_user_id (t->d, &desc, 1);
 2007|      0|      if (err)
  ------------------
  |  Branch (2007:11): [True: 0, False: 0]
  ------------------
 2008|      0|        {
 2009|      0|          log_error (_("secret key \"%s\" not found: %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2010|      0|                     t->d, gpg_strerror (err));
 2011|      0|          if (!opt.quiet)
  ------------------
  |  Branch (2011:15): [True: 0, False: 0]
  ------------------
 2012|      0|            log_info (_("(check argument of option '%s')\n"), "--default-key");
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2013|      0|          continue;
 2014|      0|        }
 2015|       |
 2016|      0|      if (! hd)
  ------------------
  |  Branch (2016:11): [True: 0, False: 0]
  ------------------
 2017|      0|        {
 2018|      0|          hd = keydb_new (ctrl);
 2019|      0|          if (!hd)
  ------------------
  |  Branch (2019:15): [True: 0, False: 0]
  ------------------
 2020|      0|            return NULL;
 2021|      0|        }
 2022|      0|      else
 2023|      0|        keydb_search_reset (hd);
 2024|       |
 2025|       |
 2026|      0|      err = keydb_search (hd, &desc, 1, NULL);
 2027|      0|      if (gpg_err_code (err) == GPG_ERR_NOT_FOUND)
  ------------------
  |  Branch (2027:11): [True: 0, False: 0]
  ------------------
 2028|      0|        continue;
 2029|       |
 2030|      0|      if (err)
  ------------------
  |  Branch (2030:11): [True: 0, False: 0]
  ------------------
 2031|      0|        {
 2032|      0|          log_error (_("key \"%s\" not found: %s\n"), t->d, gpg_strerror (err));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2033|      0|          t = NULL;
 2034|      0|          break;
 2035|      0|        }
 2036|       |
 2037|      0|      err = keydb_get_keyblock (hd, &kb);
 2038|      0|      if (err)
  ------------------
  |  Branch (2038:11): [True: 0, False: 0]
  ------------------
 2039|      0|        {
 2040|      0|          log_error (_("error reading keyblock: %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2041|      0|                     gpg_strerror (err));
 2042|      0|          continue;
 2043|      0|        }
 2044|       |
 2045|      0|      merge_selfsigs (ctrl, kb);
 2046|       |
 2047|      0|      err = gpg_error (GPG_ERR_NO_SECKEY);
 2048|      0|      node = kb;
 2049|      0|      do
 2050|      0|        {
 2051|      0|          PKT_public_key *pk = node->pkt->pkt.public_key;
 2052|       |
 2053|       |          /* Check if the key is valid.  */
 2054|      0|          if (pk->flags.revoked)
  ------------------
  |  Branch (2054:15): [True: 0, False: 0]
  ------------------
 2055|      0|            {
 2056|      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]
  |  |  ------------------
  ------------------
 2057|      0|                log_debug ("not using %s as default key, %s",
 2058|      0|                           keystr_from_pk (pk), "revoked");
 2059|      0|              continue;
 2060|      0|            }
 2061|      0|          if (pk->has_expired)
  ------------------
  |  Branch (2061:15): [True: 0, False: 0]
  ------------------
 2062|      0|            {
 2063|      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]
  |  |  ------------------
  ------------------
 2064|      0|                log_debug ("not using %s as default key, %s",
 2065|      0|                           keystr_from_pk (pk), "expired");
 2066|      0|              continue;
 2067|      0|            }
 2068|      0|          if (pk_is_disabled (pk))
  ------------------
  |  |  449|      0|  (((a)->flags.disabled_valid)?                                 \
  |  |  ------------------
  |  |  |  Branch (449:3): [True: 0, False: 0]
  |  |  |  Branch (449:4): [True: 0, False: 0]
  |  |  ------------------
  |  |  450|      0|   ((a)->flags.disabled):(cache_disabled_value(ctrl,(a))))
  ------------------
 2069|      0|            {
 2070|      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]
  |  |  ------------------
  ------------------
 2071|      0|                log_debug ("not using %s as default key, %s",
 2072|      0|                           keystr_from_pk (pk), "disabled");
 2073|      0|              continue;
 2074|      0|            }
 2075|       |
 2076|      0|          if (agent_probe_secret_key (ctrl, pk))
  ------------------
  |  Branch (2076:15): [True: 0, False: 0]
  ------------------
 2077|      0|            {
 2078|       |              /* This is a valid key.  */
 2079|      0|              err = 0;
 2080|      0|              break;
 2081|      0|            }
 2082|      0|        }
 2083|      0|      while ((node = find_next_kbnode (node, PKT_PUBLIC_SUBKEY)));
  ------------------
  |  Branch (2083:14): [True: 0, False: 0]
  ------------------
 2084|       |
 2085|      0|      release_kbnode (kb);
 2086|      0|      if (err)
  ------------------
  |  Branch (2086:11): [True: 0, False: 0]
  ------------------
 2087|      0|        {
 2088|      0|          if (! warned && ! opt.quiet)
  ------------------
  |  Branch (2088:15): [True: 0, False: 0]
  |  Branch (2088:27): [True: 0, False: 0]
  ------------------
 2089|      0|            {
 2090|      0|              log_info (_("Warning: not using '%s' as default key: %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2091|      0|                        t->d, gpg_strerror (GPG_ERR_NO_SECKEY));
 2092|      0|              print_reported_error (err, GPG_ERR_NO_SECKEY);
 2093|      0|            }
 2094|      0|        }
 2095|      0|      else
 2096|      0|        {
 2097|      0|          if (! warned && ! opt.quiet)
  ------------------
  |  Branch (2097:15): [True: 0, False: 0]
  |  Branch (2097:27): [True: 0, False: 0]
  ------------------
 2098|      0|            log_info (_("using \"%s\" as default secret key for signing\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2099|      0|                      t->d);
 2100|      0|          break;
 2101|      0|        }
 2102|      0|    }
 2103|       |
 2104|  3.53k|  if (! warned && opt.def_secret_key && ! t)
  ------------------
  |  Branch (2104:7): [True: 1, False: 3.53k]
  |  Branch (2104:19): [True: 0, False: 1]
  |  Branch (2104:41): [True: 0, False: 0]
  ------------------
 2105|      0|    log_info (_("all values passed to '%s' ignored\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2106|      0|              "--default-key");
 2107|       |
 2108|  3.53k|  warned = 1;
 2109|       |
 2110|  3.53k|  if (hd)
  ------------------
  |  Branch (2110:7): [True: 0, False: 3.53k]
  ------------------
 2111|      0|    keydb_release (hd);
 2112|       |
 2113|  3.53k|  if (t)
  ------------------
  |  Branch (2113:7): [True: 0, False: 3.53k]
  ------------------
 2114|      0|    return t->d;
 2115|  3.53k|  return NULL;
 2116|  3.53k|}
getkey_bynames:
 2203|  3.53k|{
 2204|  3.53k|  return key_byname (ctrl, retctx, names, pk, want_secret, 1,
 2205|  3.53k|                     ret_keyblock, NULL);
 2206|  3.53k|}
getkey_end:
 2333|  15.6k|{
 2334|  15.6k|  if (ctx)
  ------------------
  |  Branch (2334:7): [True: 12.1k, False: 3.53k]
  ------------------
 2335|  12.1k|    {
 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|  12.1k|      if (ctrl && !ctrl->cached_getkey_kdb)
  ------------------
  |  Branch (2350:11): [True: 12.1k, False: 0]
  |  Branch (2350:19): [True: 7.76k, False: 4.33k]
  ------------------
 2351|  7.76k|        ctrl->cached_getkey_kdb = ctx->kr_handle;
 2352|  4.33k|      else
 2353|  4.33k|        keydb_release (ctx->kr_handle);
 2354|       |
 2355|  12.1k|#endif /*!HAVE_W32_SYSTEM*/
 2356|       |
 2357|  12.1k|      free_strlist (ctx->extra_list);
 2358|  12.1k|      if (!ctx->not_allocated)
  ------------------
  |  Branch (2358:11): [True: 3.53k, False: 8.56k]
  ------------------
 2359|  3.53k|	xfree (ctx);
  ------------------
  |  |  104|  3.53k|#define xfree(a)         gcry_free ((a))
  ------------------
 2360|  12.1k|    }
 2361|  15.6k|}
merge_keys_and_selfsig:
 2410|  19.9k|{
 2411|  19.9k|  if (!keyblock)
  ------------------
  |  Branch (2411:7): [True: 0, False: 19.9k]
  ------------------
 2412|      0|    ;
 2413|  19.9k|  else if (keyblock->pkt->pkttype == PKT_PUBLIC_KEY)
  ------------------
  |  Branch (2413:12): [True: 19.3k, False: 638]
  ------------------
 2414|  19.3k|    merge_selfsigs (ctrl, keyblock);
 2415|    638|  else
 2416|    638|    log_debug ("FIXME: merging secret key blocks is not anymore available\n");
 2417|  19.9k|}
getkey.c:key_byname:
  775|  3.53k|{
  776|  3.53k|  int rc = 0;
  777|  3.53k|  int n;
  778|  3.53k|  strlist_t r;
  779|  3.53k|  strlist_t namelist_expanded = NULL;
  780|  3.53k|  GETKEY_CTX ctx;
  781|  3.53k|  KBNODE help_kb = NULL;
  782|  3.53k|  KBNODE found_key = NULL;
  783|       |
  784|  3.53k|  if (retctx)
  ------------------
  |  Branch (784:7): [True: 3.53k, False: 0]
  ------------------
  785|  3.53k|    {
  786|       |      /* Reset the returned context in case of error.  */
  787|  3.53k|      log_assert (!ret_kdbhd); /* Not allowed because the handle is stored
  788|       |                                  in the context.  */
  789|      0|      *retctx = NULL;
  790|  3.53k|    }
  791|  3.53k|  if (ret_kdbhd)
  ------------------
  |  Branch (791:7): [True: 0, False: 3.53k]
  ------------------
  792|      0|    *ret_kdbhd = NULL;
  793|       |
  794|  3.53k|  if (!namelist)
  ------------------
  |  Branch (794:7): [True: 3.53k, False: 0]
  ------------------
  795|       |    /* No search terms: iterate over the whole DB.  */
  796|  3.53k|    {
  797|  3.53k|      ctx = xmalloc_clear (sizeof *ctx);
  ------------------
  |  |  116|  3.53k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
  798|  3.53k|      ctx->nitems = 1;
  799|  3.53k|      ctx->items[0].mode = KEYDB_SEARCH_MODE_FIRST;
  800|  3.53k|      if (!include_unusable)
  ------------------
  |  Branch (800:11): [True: 0, False: 3.53k]
  ------------------
  801|      0|        {
  802|      0|          ctx->items[0].skipfnc = skip_unusable;
  803|      0|          ctx->items[0].skipfncvalue = ctrl;
  804|      0|        }
  805|  3.53k|    }
  806|      0|  else
  807|      0|    {
  808|      0|      namelist_expanded = expand_group (namelist, 1);
  809|      0|      namelist = namelist_expanded;
  810|       |
  811|       |      /* Build the search context.  */
  812|      0|      for (n = 0, r = namelist; r; r = r->next)
  ------------------
  |  Branch (812:33): [True: 0, False: 0]
  ------------------
  813|      0|	n++;
  814|       |
  815|       |      /* CTX has space for a single search term at the end.  Thus, we
  816|       |	 need to allocate sizeof *CTX plus (n - 1) sizeof
  817|       |	 CTX->ITEMS.  */
  818|      0|      ctx = xmalloc_clear (sizeof *ctx + (n - 1) * sizeof ctx->items);
  ------------------
  |  |  116|      0|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
  819|      0|      ctx->nitems = n;
  820|       |
  821|      0|      for (n = 0, r = namelist; r; r = r->next, n++)
  ------------------
  |  Branch (821:33): [True: 0, False: 0]
  ------------------
  822|      0|	{
  823|      0|	  gpg_error_t err;
  824|       |
  825|      0|	  err = classify_user_id (r->d, &ctx->items[n], 1);
  826|       |
  827|      0|	  if (ctx->items[n].exact)
  ------------------
  |  Branch (827:8): [True: 0, False: 0]
  ------------------
  828|      0|	    ctx->exact = 1;
  829|      0|	  if (err)
  ------------------
  |  Branch (829:8): [True: 0, False: 0]
  ------------------
  830|      0|	    {
  831|      0|	      xfree (ctx);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  832|      0|	      rc = gpg_err_code (err); /* FIXME: remove gpg_err_code.  */
  833|      0|	      goto leave;
  834|      0|	    }
  835|      0|	  if (!include_unusable
  ------------------
  |  Branch (835:8): [True: 0, False: 0]
  ------------------
  836|      0|	      && ctx->items[n].mode != KEYDB_SEARCH_MODE_SHORT_KID
  ------------------
  |  Branch (836:11): [True: 0, False: 0]
  ------------------
  837|      0|	      && ctx->items[n].mode != KEYDB_SEARCH_MODE_LONG_KID
  ------------------
  |  Branch (837:11): [True: 0, False: 0]
  ------------------
  838|      0|	      && ctx->items[n].mode != KEYDB_SEARCH_MODE_FPR)
  ------------------
  |  Branch (838:11): [True: 0, False: 0]
  ------------------
  839|      0|            {
  840|      0|              ctx->items[n].skipfnc = skip_unusable;
  841|      0|              ctx->items[n].skipfncvalue = ctrl;
  842|      0|            }
  843|      0|	}
  844|      0|    }
  845|       |
  846|  3.53k|  ctx->want_secret = want_secret;
  847|  3.53k|  ctx->kr_handle = keydb_new (ctrl);
  848|  3.53k|  if (!ctx->kr_handle)
  ------------------
  |  Branch (848:7): [True: 0, False: 3.53k]
  ------------------
  849|      0|    {
  850|      0|      rc = gpg_error_from_syserror ();
  851|      0|      getkey_end (ctrl, ctx);
  852|      0|      goto leave;
  853|      0|    }
  854|       |
  855|  3.53k|  if (!ret_kb)
  ------------------
  |  Branch (855:7): [True: 0, False: 3.53k]
  ------------------
  856|      0|    ret_kb = &help_kb;
  857|       |
  858|  3.53k|  if (pk)
  ------------------
  |  Branch (858:7): [True: 0, False: 3.53k]
  ------------------
  859|      0|    {
  860|      0|      ctx->req_usage = pk->req_usage;
  861|      0|    }
  862|       |
  863|  3.53k|  rc = lookup (ctrl, ctx, want_secret, ret_kb, &found_key);
  864|  3.53k|  if (!rc && pk)
  ------------------
  |  Branch (864:7): [True: 0, False: 3.53k]
  |  Branch (864:14): [True: 0, False: 0]
  ------------------
  865|      0|    {
  866|      0|      pk_from_block (pk, *ret_kb, found_key);
  867|      0|    }
  868|       |
  869|  3.53k|  release_kbnode (help_kb);
  870|       |
  871|  3.53k|  if (retctx) /* Caller wants the context.  */
  ------------------
  |  Branch (871:7): [True: 3.53k, False: 0]
  ------------------
  872|  3.53k|    {
  873|  3.53k|      if (ctx->extra_list)
  ------------------
  |  Branch (873:11): [True: 0, False: 3.53k]
  ------------------
  874|      0|        {
  875|      0|          for (r=ctx->extra_list; r->next; r = r->next)
  ------------------
  |  Branch (875:35): [True: 0, False: 0]
  ------------------
  876|      0|            ;
  877|      0|          r->next = namelist_expanded;
  878|      0|        }
  879|  3.53k|      else
  880|  3.53k|        ctx->extra_list = namelist_expanded;
  881|  3.53k|      namelist_expanded = NULL;
  882|  3.53k|      *retctx = ctx;
  883|  3.53k|    }
  884|      0|  else
  885|      0|    {
  886|      0|      if (ret_kdbhd)
  ------------------
  |  Branch (886:11): [True: 0, False: 0]
  ------------------
  887|      0|	{
  888|      0|	  *ret_kdbhd = ctx->kr_handle;
  889|      0|	  ctx->kr_handle = NULL;
  890|      0|	}
  891|      0|      getkey_end (ctrl, ctx);
  892|      0|    }
  893|       |
  894|  3.53k| leave:
  895|  3.53k|  free_strlist (namelist_expanded);
  896|  3.53k|  return rc;
  897|  3.53k|}
getkey.c:merge_selfsigs:
 3450|  19.3k|{
 3451|  19.3k|  KBNODE k;
 3452|  19.3k|  int revoked;
 3453|  19.3k|  struct revoke_info rinfo;
 3454|  19.3k|  PKT_public_key *main_pk;
 3455|  19.3k|  prefitem_t *prefs;
 3456|  19.3k|  unsigned int mdc_feature;
 3457|  19.3k|  unsigned int aead_feature;
 3458|       |
 3459|  19.3k|  if (keyblock->pkt->pkttype != PKT_PUBLIC_KEY)
  ------------------
  |  Branch (3459:7): [True: 0, False: 19.3k]
  ------------------
 3460|      0|    {
 3461|      0|      if (keyblock->pkt->pkttype == PKT_SECRET_KEY)
  ------------------
  |  Branch (3461:11): [True: 0, False: 0]
  ------------------
 3462|      0|	{
 3463|      0|	  log_error ("expected public key but found secret key "
 3464|      0|		     "- must stop\n");
 3465|       |	  /* We better exit here because a public key is expected at
 3466|       |	   * other places too.  FIXME: Figure this out earlier and
 3467|       |	   * don't get to here at all */
 3468|      0|	  g10_exit (1);
 3469|      0|	}
 3470|      0|      BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 3471|      0|    }
 3472|       |
 3473|  19.3k|  merge_selfsigs_main (ctrl, keyblock, &revoked, &rinfo);
 3474|       |
 3475|       |  /* Now merge in the data from each of the subkeys.  */
 3476|   126k|  for (k = keyblock; k; k = k->next)
  ------------------
  |  Branch (3476:22): [True: 107k, False: 19.3k]
  ------------------
 3477|   107k|    {
 3478|   107k|      if (k->pkt->pkttype == PKT_PUBLIC_SUBKEY)
  ------------------
  |  Branch (3478:11): [True: 9.56k, False: 97.9k]
  ------------------
 3479|  9.56k|	{
 3480|  9.56k|	  merge_selfsigs_subkey (ctrl, keyblock, k);
 3481|  9.56k|	}
 3482|   107k|    }
 3483|       |
 3484|  19.3k|  main_pk = keyblock->pkt->pkt.public_key;
 3485|  19.3k|  if (revoked || main_pk->has_expired || !main_pk->flags.valid)
  ------------------
  |  Branch (3485:7): [True: 36, False: 19.2k]
  |  Branch (3485:18): [True: 257, False: 19.0k]
  |  Branch (3485:42): [True: 15.2k, False: 3.76k]
  ------------------
 3486|  15.5k|    {
 3487|       |      /* If the primary key is revoked, expired, or invalid we
 3488|       |       * better set the appropriate flags on that key and all
 3489|       |       * subkeys.  */
 3490|  86.9k|      for (k = keyblock; k; k = k->next)
  ------------------
  |  Branch (3490:26): [True: 71.4k, False: 15.5k]
  ------------------
 3491|  71.4k|	{
 3492|  71.4k|	  if (k->pkt->pkttype == PKT_PUBLIC_KEY
  ------------------
  |  Branch (3492:8): [True: 15.5k, False: 55.8k]
  ------------------
 3493|  71.4k|	      || k->pkt->pkttype == PKT_PUBLIC_SUBKEY)
  ------------------
  |  Branch (3493:11): [True: 9.22k, False: 46.6k]
  ------------------
 3494|  24.7k|	    {
 3495|  24.7k|	      PKT_public_key *pk = k->pkt->pkt.public_key;
 3496|  24.7k|	      if (!main_pk->flags.valid)
  ------------------
  |  Branch (3496:12): [True: 24.2k, False: 476]
  ------------------
 3497|  24.2k|		pk->flags.valid = 0;
 3498|  24.7k|	      if (revoked && !pk->flags.revoked)
  ------------------
  |  Branch (3498:12): [True: 703, False: 24.0k]
  |  Branch (3498:23): [True: 182, False: 521]
  ------------------
 3499|    182|		{
 3500|    182|		  pk->flags.revoked = revoked;
 3501|    182|		  memcpy (&pk->revoked, &rinfo, sizeof (rinfo));
 3502|    182|		}
 3503|  24.7k|	      if (main_pk->has_expired)
  ------------------
  |  Branch (3503:12): [True: 475, False: 24.2k]
  ------------------
 3504|    475|		{
 3505|    475|		  pk->has_expired = main_pk->has_expired;
 3506|    475|		  if (!pk->expiredate || pk->expiredate > main_pk->expiredate)
  ------------------
  |  Branch (3506:9): [True: 44, False: 431]
  |  Branch (3506:28): [True: 174, False: 257]
  ------------------
 3507|    218|		    pk->expiredate = main_pk->expiredate;
 3508|    475|		}
 3509|  24.7k|	    }
 3510|  71.4k|	}
 3511|  15.5k|      return;
 3512|  15.5k|    }
 3513|       |
 3514|       |  /* Set the preference list of all keys to those of the primary real
 3515|       |   * user ID.  Note: we use these preferences when we don't know by
 3516|       |   * which user ID the key has been selected.
 3517|       |   * fixme: we should keep atoms of commonly used preferences or
 3518|       |   * use reference counting to optimize the preference lists storage.
 3519|       |   * FIXME: it might be better to use the intersection of
 3520|       |   * all preferences.
 3521|       |   * Do a similar thing for the MDC feature flag.  */
 3522|  3.76k|  prefs = NULL;
 3523|  3.76k|  mdc_feature = aead_feature = 0;
 3524|  20.3k|  for (k = keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY; k = k->next)
  ------------------
  |  Branch (3524:22): [True: 20.1k, False: 189]
  |  Branch (3524:27): [True: 20.1k, False: 4]
  ------------------
 3525|  20.1k|    {
 3526|  20.1k|      if (k->pkt->pkttype == PKT_USER_ID
  ------------------
  |  Branch (3526:11): [True: 11.5k, False: 8.62k]
  ------------------
 3527|  20.1k|	  && !k->pkt->pkt.user_id->attrib_data
  ------------------
  |  Branch (3527:7): [True: 11.5k, False: 17]
  ------------------
 3528|  20.1k|	  && k->pkt->pkt.user_id->flags.primary)
  ------------------
  |  Branch (3528:7): [True: 3.57k, False: 7.97k]
  ------------------
 3529|  3.57k|	{
 3530|  3.57k|	  prefs = k->pkt->pkt.user_id->prefs;
 3531|  3.57k|	  mdc_feature = k->pkt->pkt.user_id->flags.mdc;
 3532|  3.57k|	  aead_feature = k->pkt->pkt.user_id->flags.aead;
 3533|  3.57k|	  break;
 3534|  3.57k|	}
 3535|  20.1k|    }
 3536|  39.8k|  for (k = keyblock; k; k = k->next)
  ------------------
  |  Branch (3536:22): [True: 36.1k, False: 3.76k]
  ------------------
 3537|  36.1k|    {
 3538|  36.1k|      if (k->pkt->pkttype == PKT_PUBLIC_KEY
  ------------------
  |  Branch (3538:11): [True: 3.76k, False: 32.3k]
  ------------------
 3539|  36.1k|	  || k->pkt->pkttype == PKT_PUBLIC_SUBKEY)
  ------------------
  |  Branch (3539:7): [True: 337, False: 32.0k]
  ------------------
 3540|  4.10k|	{
 3541|  4.10k|	  PKT_public_key *pk = k->pkt->pkt.public_key;
 3542|  4.10k|	  if (pk->prefs)
  ------------------
  |  Branch (3542:8): [True: 0, False: 4.10k]
  ------------------
 3543|      0|	    xfree (pk->prefs);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 3544|  4.10k|	  pk->prefs = copy_prefs (prefs);
 3545|  4.10k|	  pk->flags.mdc = mdc_feature;
 3546|  4.10k|	  pk->flags.aead = aead_feature;
 3547|  4.10k|	}
 3548|  36.1k|    }
 3549|  3.76k|}
getkey.c:merge_selfsigs_main:
 2669|  19.3k|{
 2670|  19.3k|  PKT_public_key *pk = NULL;
 2671|  19.3k|  KBNODE k;
 2672|  19.3k|  u32 kid[2];
 2673|  19.3k|  u32 sigdate, uiddate, uiddate2;
 2674|  19.3k|  KBNODE signode, uidnode, uidnode2;
 2675|  19.3k|  u32 curtime = make_timestamp ();
 2676|  19.3k|  unsigned int key_usage = 0;
 2677|  19.3k|  u32 keytimestamp = 0;  /* Creation time of the key.  */
 2678|  19.3k|  u32 key_expire = 0;
 2679|  19.3k|  int key_expire_seen = 0;
 2680|  19.3k|  byte sigversion = 0;
 2681|       |
 2682|  19.3k|  *r_revoked = 0;
 2683|  19.3k|  memset (rinfo, 0, sizeof (*rinfo));
 2684|       |
 2685|       |  /* Section 11.1 of RFC 4880 determines the order of packets within a
 2686|       |   * message.  There are three sections, which must occur in the
 2687|       |   * following order: the public key, the user ids and user attributes
 2688|       |   * and the subkeys.  Within each section, each primary packet (e.g.,
 2689|       |   * a user id packet) is followed by one or more signature packets,
 2690|       |   * which modify that packet.  */
 2691|       |
 2692|       |  /* According to Section 11.1 of RFC 4880, the public key must be the
 2693|       |     first packet.  Note that parse_keyblock_image ensures that the
 2694|       |     first packet is the public key.  */
 2695|  19.3k|  if (keyblock->pkt->pkttype != PKT_PUBLIC_KEY)
  ------------------
  |  Branch (2695:7): [True: 0, False: 19.3k]
  ------------------
 2696|      0|    BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 2697|  19.3k|  pk = keyblock->pkt->pkt.public_key;
 2698|  19.3k|  keytimestamp = pk->timestamp;
 2699|       |
 2700|  19.3k|  keyid_from_pk (pk, kid);
 2701|  19.3k|  pk->main_keyid[0] = kid[0];
 2702|  19.3k|  pk->main_keyid[1] = kid[1];
 2703|       |
 2704|  19.3k|  if (pk->version < 4)
  ------------------
  |  Branch (2704:7): [True: 0, False: 19.3k]
  ------------------
 2705|      0|    {
 2706|       |      /* Before v4 the key packet itself contains the expiration date
 2707|       |       * and there was no way to change it, so we start with the one
 2708|       |       * from the key packet.  We do not support v3 keys anymore but
 2709|       |       * we keep the code in case a future key versions introduces a
 2710|       |       * hadr expire time again. */
 2711|      0|      key_expire = pk->max_expiredate;
 2712|      0|      key_expire_seen = 1;
 2713|      0|    }
 2714|       |
 2715|       |  /* First pass:
 2716|       |   *
 2717|       |   * - Find the latest direct key self-signature.  We assume that the
 2718|       |   *   newest one overrides all others.
 2719|       |   *
 2720|       |   * - Determine whether the key has been revoked.
 2721|       |   *
 2722|       |   * - Gather all revocation keys (unlike other data, we don't just
 2723|       |   *   take them from the latest self-signed packet).
 2724|       |   *
 2725|       |   * - Determine max (sig[...]->version).
 2726|       |   */
 2727|       |
 2728|       |  /* Reset this in case this key was already merged. */
 2729|  19.3k|  xfree (pk->revkey);
  ------------------
  |  |  104|  19.3k|#define xfree(a)         gcry_free ((a))
  ------------------
 2730|  19.3k|  pk->revkey = NULL;
 2731|  19.3k|  pk->numrevkeys = 0;
 2732|       |
 2733|  19.3k|  signode = NULL;
 2734|  19.3k|  sigdate = 0; /* Helper variable to find the latest signature.  */
 2735|       |
 2736|       |  /* According to Section 11.1 of RFC 4880, the public key comes first
 2737|       |   * and is immediately followed by any signature packets that modify
 2738|       |   * it.  */
 2739|  19.3k|  for (k = keyblock;
 2740|  43.5k|       k && k->pkt->pkttype != PKT_USER_ID
  ------------------
  |  Branch (2740:8): [True: 32.8k, False: 10.6k]
  |  Branch (2740:13): [True: 25.1k, False: 7.78k]
  ------------------
 2741|  43.5k|	 && k->pkt->pkttype != PKT_ATTRIBUTE
  ------------------
  |  Branch (2741:6): [True: 25.1k, False: 0]
  ------------------
 2742|  43.5k|	 && k->pkt->pkttype != PKT_PUBLIC_SUBKEY;
  ------------------
  |  Branch (2742:6): [True: 24.2k, False: 845]
  ------------------
 2743|  24.2k|       k = k->next)
 2744|  24.2k|    {
 2745|  24.2k|      if (k->pkt->pkttype == PKT_SIGNATURE)
  ------------------
  |  Branch (2745:11): [True: 4.59k, False: 19.6k]
  ------------------
 2746|  4.59k|	{
 2747|  4.59k|	  PKT_signature *sig = k->pkt->pkt.signature;
 2748|  4.59k|	  if (sig->keyid[0] == kid[0] && sig->keyid[1] == kid[1])
  ------------------
  |  Branch (2748:8): [True: 3.42k, False: 1.17k]
  |  Branch (2748:35): [True: 3.12k, False: 306]
  ------------------
 2749|  3.12k|	    { /* Self sig.  */
 2750|       |
 2751|  3.12k|	      if (check_key_signature (ctrl, keyblock, k, NULL))
  ------------------
  |  Branch (2751:12): [True: 1.62k, False: 1.49k]
  ------------------
 2752|  1.62k|		; /* Signature did not verify.  */
 2753|  1.49k|	      else if (IS_KEY_REV (sig))
  ------------------
  |  |   45|  1.49k|#define IS_KEY_REV(s)    ((s)->sig_class == 0x20)
  |  |  ------------------
  |  |  |  Branch (45:26): [True: 53, False: 1.44k]
  |  |  ------------------
  ------------------
 2754|     53|		{
 2755|       |		  /* Key has been revoked - there is no way to
 2756|       |		   * override such a revocation, so we theoretically
 2757|       |		   * can stop now.  We should not cope with expiration
 2758|       |		   * times for revocations here because we have to
 2759|       |		   * assume that an attacker can generate all kinds of
 2760|       |		   * signatures.  However due to the fact that the key
 2761|       |		   * has been revoked it does not harm either and by
 2762|       |		   * continuing we gather some more info on that
 2763|       |		   * key.  */
 2764|     53|		  *r_revoked = 1;
 2765|     53|		  sig_to_revoke_info (sig, rinfo);
 2766|     53|		}
 2767|  1.44k|	      else if (IS_KEY_SIG (sig))
  ------------------
  |  |   40|  1.44k|#define IS_KEY_SIG(s)    ((s)->sig_class == 0x1f)
  |  |  ------------------
  |  |  |  Branch (40:26): [True: 1.41k, False: 25]
  |  |  ------------------
  ------------------
 2768|  1.41k|		{
 2769|       |		  /* Add the indicated revocations keys from all
 2770|       |		   * signatures not just the latest.  We do this
 2771|       |		   * because you need multiple 1F sigs to properly
 2772|       |		   * handle revocation keys (PGP does it this way, and
 2773|       |		   * a revocation key could be sensitive and hence in
 2774|       |		   * a different signature).  */
 2775|  1.41k|		  if (sig->revkey)
  ------------------
  |  Branch (2775:9): [True: 574, False: 843]
  ------------------
 2776|    574|		    {
 2777|    574|		      int i;
 2778|       |
 2779|    574|		      pk->revkey =
 2780|    574|			xrealloc (pk->revkey, sizeof (struct revocation_key) *
  ------------------
  |  |  111|    574|#define xrealloc(a,b)    gcry_xrealloc ((a),(b))
  ------------------
 2781|    574|				  (pk->numrevkeys + sig->numrevkeys));
 2782|       |
 2783|  1.14k|		      for (i = 0; i < sig->numrevkeys; i++, pk->numrevkeys++)
  ------------------
  |  Branch (2783:21): [True: 574, False: 574]
  ------------------
 2784|    574|                        {
 2785|    574|                          pk->revkey[pk->numrevkeys].class
 2786|    574|                            = sig->revkey[i].class;
 2787|    574|                          pk->revkey[pk->numrevkeys].algid
 2788|    574|                            = sig->revkey[i].algid;
 2789|    574|                          pk->revkey[pk->numrevkeys].fprlen
 2790|    574|                            = sig->revkey[i].fprlen;
 2791|    574|                          memcpy (pk->revkey[pk->numrevkeys].fpr,
 2792|    574|                                  sig->revkey[i].fpr, sig->revkey[i].fprlen);
 2793|    574|                          memset (pk->revkey[pk->numrevkeys].fpr
 2794|    574|                                  + sig->revkey[i].fprlen,
 2795|    574|                                  0,
 2796|    574|                                  sizeof (sig->revkey[i].fpr)
 2797|    574|                                  - sig->revkey[i].fprlen);
 2798|    574|                        }
 2799|    574|		    }
 2800|       |
 2801|  1.41k|		  if (sig->timestamp >= sigdate)
  ------------------
  |  Branch (2801:9): [True: 1.17k, False: 245]
  ------------------
 2802|  1.17k|		    { /* This is the latest signature so far.  */
 2803|       |
 2804|  1.17k|		      if (sig->flags.expired)
  ------------------
  |  Branch (2804:13): [True: 0, False: 1.17k]
  ------------------
 2805|      0|			; /* Signature has expired - ignore it.  */
 2806|  1.17k|		      else
 2807|  1.17k|			{
 2808|  1.17k|			  sigdate = sig->timestamp;
 2809|  1.17k|			  signode = k;
 2810|  1.17k|			  if (sig->version > sigversion)
  ------------------
  |  Branch (2810:10): [True: 390, False: 782]
  ------------------
 2811|    390|			    sigversion = sig->version;
 2812|       |
 2813|  1.17k|			}
 2814|  1.17k|		    }
 2815|  1.41k|		}
 2816|  3.12k|	    }
 2817|  4.59k|	}
 2818|  24.2k|    }
 2819|       |
 2820|       |  /* Remove dupes from the revocation keys.  */
 2821|  19.3k|  if (pk->revkey)
  ------------------
  |  Branch (2821:7): [True: 123, False: 19.1k]
  ------------------
 2822|    123|    {
 2823|    123|      int i, j, x, changed = 0;
 2824|       |
 2825|    305|      for (i = 0; i < pk->numrevkeys; i++)
  ------------------
  |  Branch (2825:19): [True: 182, False: 123]
  ------------------
 2826|    182|	{
 2827|    786|	  for (j = i + 1; j < pk->numrevkeys; j++)
  ------------------
  |  Branch (2827:20): [True: 604, False: 182]
  ------------------
 2828|    604|	    {
 2829|    604|	      if (memcmp (&pk->revkey[i], &pk->revkey[j],
  ------------------
  |  Branch (2829:12): [True: 392, False: 212]
  ------------------
 2830|    604|			  sizeof (struct revocation_key)) == 0)
 2831|    392|		{
 2832|       |		  /* remove j */
 2833|       |
 2834|  11.6k|		  for (x = j; x < pk->numrevkeys - 1; x++)
  ------------------
  |  Branch (2834:17): [True: 11.2k, False: 392]
  ------------------
 2835|  11.2k|		    pk->revkey[x] = pk->revkey[x + 1];
 2836|       |
 2837|    392|		  pk->numrevkeys--;
 2838|    392|		  j--;
 2839|    392|		  changed = 1;
 2840|    392|		}
 2841|    604|	    }
 2842|    182|	}
 2843|       |
 2844|    123|      if (changed)
  ------------------
  |  Branch (2844:11): [True: 41, False: 82]
  ------------------
 2845|     41|	pk->revkey = xrealloc (pk->revkey,
  ------------------
  |  |  111|     41|#define xrealloc(a,b)    gcry_xrealloc ((a),(b))
  ------------------
 2846|    123|			       pk->numrevkeys *
 2847|    123|			       sizeof (struct revocation_key));
 2848|    123|    }
 2849|       |
 2850|       |  /* SIGNODE is the direct key signature packet (sigclass 0x1f) with
 2851|       |   * the latest creation time.  Extract some information from it.  */
 2852|  19.3k|  if (signode)
  ------------------
  |  Branch (2852:7): [True: 390, False: 18.9k]
  ------------------
 2853|    390|    {
 2854|       |      /* Some information from a direct key signature take precedence
 2855|       |       * over the same information given in UID sigs.  */
 2856|    390|      PKT_signature *sig = signode->pkt->pkt.signature;
 2857|    390|      const byte *p;
 2858|       |
 2859|    390|      key_usage = parse_key_usage (sig);
 2860|       |
 2861|    390|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_KEY_EXPIRE, NULL);
 2862|    390|      if (p && buf32_to_u32 (p))
  ------------------
  |  Branch (2862:11): [True: 212, False: 178]
  |  Branch (2862:16): [True: 198, False: 14]
  ------------------
 2863|    198|	{
 2864|    198|	  key_expire = keytimestamp + buf32_to_u32 (p);
 2865|    198|	  key_expire_seen = 1;
 2866|    198|	}
 2867|       |
 2868|       |      /* Mark that key as valid: One direct key signature should
 2869|       |       * render a key as valid.  */
 2870|    390|      pk->flags.valid = 1;
 2871|    390|    }
 2872|       |
 2873|       |  /* Pass 1.5: Look for key revocation signatures that were not made
 2874|       |   * by the key (i.e. did a revocation key issue a revocation for
 2875|       |   * us?).  Only bother to do this if there is a revocation key in the
 2876|       |   * first place and we're not revoked already.  */
 2877|       |
 2878|  19.3k|  if (!*r_revoked && pk->revkey)
  ------------------
  |  Branch (2878:7): [True: 19.2k, False: 36]
  |  Branch (2878:22): [True: 123, False: 19.1k]
  ------------------
 2879|  1.77k|    for (k = keyblock; k && k->pkt->pkttype != PKT_USER_ID; k = k->next)
  ------------------
  |  Branch (2879:24): [True: 1.65k, False: 123]
  |  Branch (2879:29): [True: 1.65k, False: 0]
  ------------------
 2880|  1.65k|      {
 2881|  1.65k|	if (k->pkt->pkttype == PKT_SIGNATURE)
  ------------------
  |  Branch (2881:6): [True: 1.34k, False: 311]
  ------------------
 2882|  1.34k|	  {
 2883|  1.34k|	    PKT_signature *sig = k->pkt->pkt.signature;
 2884|       |
 2885|  1.34k|	    if (IS_KEY_REV (sig) &&
  ------------------
  |  |   45|  2.68k|#define IS_KEY_REV(s)    ((s)->sig_class == 0x20)
  |  |  ------------------
  |  |  |  Branch (45:26): [True: 741, False: 600]
  |  |  ------------------
  ------------------
 2886|  1.34k|		(sig->keyid[0] != kid[0] || sig->keyid[1] != kid[1]))
  ------------------
  |  Branch (2886:4): [True: 657, False: 84]
  |  Branch (2886:31): [True: 45, False: 39]
  ------------------
 2887|    702|	      {
 2888|    702|		int rc = check_revocation_keys (ctrl, pk, sig);
 2889|    702|		if (rc == 0)
  ------------------
  |  Branch (2889:7): [True: 0, False: 702]
  ------------------
 2890|      0|		  {
 2891|      0|		    *r_revoked = 2;
 2892|      0|		    sig_to_revoke_info (sig, rinfo);
 2893|       |		    /* Don't continue checking since we can't be any
 2894|       |		     * more revoked than this.  */
 2895|      0|		    break;
 2896|      0|		  }
 2897|    702|		else if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY)
  ------------------
  |  Branch (2897:12): [True: 0, False: 702]
  ------------------
 2898|      0|		  pk->flags.maybe_revoked = 1;
 2899|       |
 2900|       |		/* A failure here means the sig did not verify, was
 2901|       |		 * not issued by a revocation key, or a revocation
 2902|       |		 * key loop was broken.  If a revocation key isn't
 2903|       |		 * findable, however, the key might be revoked and
 2904|       |		 * we don't know it.  */
 2905|       |
 2906|       |		/* Fixme: In the future handle subkey and cert
 2907|       |		 * revocations?  PGP doesn't, but it's in 2440.  */
 2908|    702|	      }
 2909|  1.34k|	  }
 2910|  1.65k|      }
 2911|       |
 2912|       |  /* Second pass: Look at the self-signature of all user IDs.  */
 2913|       |
 2914|       |  /* According to RFC 4880 section 11.1, user id and attribute packets
 2915|       |   * are in the second section, after the public key packet and before
 2916|       |   * the subkey packets.  */
 2917|  19.3k|  signode = uidnode = NULL;
 2918|  19.3k|  sigdate = 0; /* Helper variable to find the latest signature in one UID. */
 2919|   108k|  for (k = keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY; k = k->next)
  ------------------
  |  Branch (2919:22): [True: 90.6k, False: 18.0k]
  |  Branch (2919:27): [True: 89.4k, False: 1.28k]
  ------------------
 2920|  89.4k|    {
 2921|  89.4k|      if (k->pkt->pkttype == PKT_USER_ID || k->pkt->pkttype == PKT_ATTRIBUTE)
  ------------------
  |  Branch (2921:11): [True: 36.7k, False: 52.6k]
  |  Branch (2921:45): [True: 0, False: 52.6k]
  ------------------
 2922|  36.7k|	{ /* New user id packet.  */
 2923|       |
 2924|       |          /* Apply the data from the most recent self-signed packet to
 2925|       |	   * the preceding user id packet.  */
 2926|  36.7k|	  if (uidnode && signode)
  ------------------
  |  Branch (2926:8): [True: 28.9k, False: 7.78k]
  |  Branch (2926:19): [True: 5.45k, False: 23.4k]
  ------------------
 2927|  5.45k|	    {
 2928|  5.45k|	      fixup_uidnode (uidnode, signode, keytimestamp);
 2929|  5.45k|	      pk->flags.valid = 1;
 2930|  5.45k|	    }
 2931|       |
 2932|       |	  /* Clear SIGNODE.  The only relevant self-signed data for
 2933|       |	   * UIDNODE follows it.  */
 2934|  36.7k|	  if (k->pkt->pkttype == PKT_USER_ID)
  ------------------
  |  Branch (2934:8): [True: 36.7k, False: 0]
  ------------------
 2935|  36.7k|	    uidnode = k;
 2936|      0|	  else
 2937|      0|	    uidnode = NULL;
 2938|       |
 2939|  36.7k|	  signode = NULL;
 2940|  36.7k|	  sigdate = 0;
 2941|  36.7k|	}
 2942|  52.6k|      else if (k->pkt->pkttype == PKT_SIGNATURE && uidnode)
  ------------------
  |  Branch (2942:16): [True: 33.0k, False: 19.6k]
  |  Branch (2942:52): [True: 28.4k, False: 4.59k]
  ------------------
 2943|  28.4k|	{
 2944|  28.4k|	  PKT_signature *sig = k->pkt->pkt.signature;
 2945|  28.4k|	  if (sig->keyid[0] == kid[0] && sig->keyid[1] == kid[1])
  ------------------
  |  Branch (2945:8): [True: 21.7k, False: 6.66k]
  |  Branch (2945:35): [True: 21.2k, False: 461]
  ------------------
 2946|  21.2k|	    {
 2947|  21.2k|	      if (check_key_signature (ctrl, keyblock, k, NULL))
  ------------------
  |  Branch (2947:12): [True: 12.5k, False: 8.76k]
  ------------------
 2948|  12.5k|		;		/* signature did not verify */
 2949|  8.76k|	      else if ((IS_UID_SIG (sig) || IS_UID_REV (sig))
  ------------------
  |  |   41|  17.5k|#define IS_UID_SIG(s)    (((s)->sig_class & ~3) == 0x10)
  |  |  ------------------
  |  |  |  Branch (41:26): [True: 6.53k, False: 2.23k]
  |  |  ------------------
  ------------------
              	      else if ((IS_UID_SIG (sig) || IS_UID_REV (sig))
  ------------------
  |  |   46|  2.23k|#define IS_UID_REV(s)    ((s)->sig_class == 0x30)
  |  |  ------------------
  |  |  |  Branch (46:26): [True: 1.99k, False: 238]
  |  |  ------------------
  ------------------
 2950|  8.76k|		       && sig->timestamp >= sigdate)
  ------------------
  |  Branch (2950:13): [True: 7.65k, False: 876]
  ------------------
 2951|  7.65k|		{
 2952|       |		  /* Note: we allow invalidation of cert revocations
 2953|       |		   * by a newer signature.  An attacker can't use this
 2954|       |		   * because a key should be revoked with a key revocation.
 2955|       |		   * The reason why we have to allow for that is that at
 2956|       |		   * one time an email address may become invalid but later
 2957|       |		   * the same email address may become valid again (hired,
 2958|       |		   * fired, hired again).  */
 2959|       |
 2960|  7.65k|		  sigdate = sig->timestamp;
 2961|  7.65k|		  signode = k;
 2962|  7.65k|		  signode->pkt->pkt.signature->flags.chosen_selfsig = 0;
 2963|  7.65k|		  if (sig->version > sigversion)
  ------------------
  |  Branch (2963:9): [True: 3.63k, False: 4.01k]
  ------------------
 2964|  3.63k|		    sigversion = sig->version;
 2965|  7.65k|		}
 2966|  21.2k|	    }
 2967|  28.4k|	}
 2968|  89.4k|    }
 2969|  19.3k|  if (uidnode && signode)
  ------------------
  |  Branch (2969:7): [True: 7.78k, False: 11.5k]
  |  Branch (2969:18): [True: 1.57k, False: 6.20k]
  ------------------
 2970|  1.57k|    {
 2971|  1.57k|      fixup_uidnode (uidnode, signode, keytimestamp);
 2972|  1.57k|      pk->flags.valid = 1;
 2973|  1.57k|    }
 2974|       |
 2975|       |  /* If the key isn't valid yet, and we have
 2976|       |   * --allow-non-selfsigned-uid set, then force it valid. */
 2977|  19.3k|  if (!pk->flags.valid && opt.allow_non_selfsigned_uid)
  ------------------
  |  Branch (2977:7): [True: 15.2k, False: 4.02k]
  |  Branch (2977:27): [True: 0, False: 15.2k]
  ------------------
 2978|      0|    {
 2979|      0|      if (opt.verbose)
  ------------------
  |  Branch (2979:11): [True: 0, False: 0]
  ------------------
 2980|      0|	log_info (_("Invalid key %s made valid by"
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2981|      0|		    " --allow-non-selfsigned-uid\n"), keystr_from_pk (pk));
 2982|      0|      pk->flags.valid = 1;
 2983|      0|    }
 2984|       |
 2985|       |  /* The key STILL isn't valid, so try and find an ultimately
 2986|       |   * trusted signature. */
 2987|  19.3k|  if (!pk->flags.valid)
  ------------------
  |  Branch (2987:7): [True: 15.2k, False: 4.02k]
  ------------------
 2988|  15.2k|    {
 2989|  15.2k|      uidnode = NULL;
 2990|       |
 2991|  66.6k|      for (k = keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY;
  ------------------
  |  Branch (2991:26): [True: 52.6k, False: 14.0k]
  |  Branch (2991:31): [True: 51.3k, False: 1.24k]
  ------------------
 2992|  51.3k|	   k = k->next)
 2993|  51.3k|	{
 2994|  51.3k|	  if (k->pkt->pkttype == PKT_USER_ID)
  ------------------
  |  Branch (2994:8): [True: 17.9k, False: 33.3k]
  ------------------
 2995|  17.9k|	    uidnode = k;
 2996|  33.3k|	  else if (k->pkt->pkttype == PKT_SIGNATURE && uidnode)
  ------------------
  |  Branch (2996:13): [True: 17.7k, False: 15.6k]
  |  Branch (2996:49): [True: 15.5k, False: 2.21k]
  ------------------
 2997|  15.5k|	    {
 2998|  15.5k|	      PKT_signature *sig = k->pkt->pkt.signature;
 2999|       |
 3000|  15.5k|	      if (sig->keyid[0] != kid[0] || sig->keyid[1] != kid[1])
  ------------------
  |  Branch (3000:12): [True: 3.94k, False: 11.5k]
  |  Branch (3000:39): [True: 362, False: 11.2k]
  ------------------
 3001|  4.30k|		{
 3002|  4.30k|		  PKT_public_key *ultimate_pk;
 3003|       |
 3004|  4.30k|		  ultimate_pk = xmalloc_clear (sizeof (*ultimate_pk));
  ------------------
  |  |  116|  4.30k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
 3005|       |
 3006|       |		  /* We don't want to use the full get_pubkey to avoid
 3007|       |		   * infinite recursion in certain cases.  There is no
 3008|       |		   * reason to check that an ultimately trusted key is
 3009|       |		   * still valid - if it has been revoked the user
 3010|       |		   * should also remove the ultimate trust flag.  */
 3011|  4.30k|		  if (get_pubkey_fast (ctrl, ultimate_pk, sig->keyid) == 0
  ------------------
  |  Branch (3011:9): [True: 0, False: 4.30k]
  ------------------
 3012|  4.30k|		      && check_key_signature2 (ctrl,
  ------------------
  |  Branch (3012:12): [True: 0, False: 0]
  ------------------
 3013|      0|                                               keyblock, k, ultimate_pk,
 3014|      0|					       NULL, NULL, NULL, NULL) == 0
 3015|  4.30k|		      && get_ownertrust (ctrl, ultimate_pk) == TRUST_ULTIMATE)
  ------------------
  |  |   32|      0|#define TRUST_ULTIMATE	  6  /* u: ultimately trusted */
  ------------------
  |  Branch (3015:12): [True: 0, False: 0]
  ------------------
 3016|      0|		    {
 3017|      0|		      free_public_key (ultimate_pk);
 3018|      0|		      pk->flags.valid = 1;
 3019|      0|		      break;
 3020|      0|		    }
 3021|       |
 3022|  4.30k|		  free_public_key (ultimate_pk);
 3023|  4.30k|		}
 3024|  15.5k|	    }
 3025|  51.3k|	}
 3026|  15.2k|    }
 3027|       |
 3028|       |  /* Record the highest selfsig version so we know if this is a v3 key
 3029|       |   * through and through, or a v3 key with a v4 selfsig somewhere.
 3030|       |   * This is useful in a few places to know if the key must be treated
 3031|       |   * as PGP2-style or OpenPGP-style.  Note that a selfsig revocation
 3032|       |   * with a higher version number will also raise this value.  This is
 3033|       |   * okay since such a revocation must be issued by the user (i.e. it
 3034|       |   * cannot be issued by someone else to modify the key behavior.) */
 3035|       |
 3036|  19.3k|  pk->selfsigversion = sigversion;
 3037|       |
 3038|       |  /* Now that we had a look at all user IDs we can now get some
 3039|       |   * information from those user IDs.  */
 3040|       |
 3041|  19.3k|  if (!key_usage)
  ------------------
  |  Branch (3041:7): [True: 19.2k, False: 30]
  ------------------
 3042|  19.2k|    {
 3043|       |      /* Find the latest user ID with key flags set. */
 3044|  19.2k|      uiddate = 0; /* Helper to find the latest user ID.  */
 3045|   108k|      for (k = keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY;
  ------------------
  |  Branch (3045:26): [True: 90.6k, False: 17.9k]
  |  Branch (3045:31): [True: 89.3k, False: 1.28k]
  ------------------
 3046|  89.3k|	   k = k->next)
 3047|  89.3k|	{
 3048|  89.3k|	  if (k->pkt->pkttype == PKT_USER_ID)
  ------------------
  |  Branch (3048:8): [True: 36.7k, False: 52.6k]
  ------------------
 3049|  36.7k|	    {
 3050|  36.7k|	      PKT_user_id *uid = k->pkt->pkt.user_id;
 3051|       |
 3052|  36.7k|	      if (uid->help_key_usage
  ------------------
  |  Branch (3052:12): [True: 1.68k, False: 35.0k]
  ------------------
 3053|  36.7k|                  && (uid->created > uiddate || (!uid->created && !uiddate)))
  ------------------
  |  Branch (3053:23): [True: 261, False: 1.42k]
  |  Branch (3053:50): [True: 0, False: 1.42k]
  |  Branch (3053:67): [True: 0, False: 0]
  ------------------
 3054|    261|		{
 3055|    261|		  key_usage = uid->help_key_usage;
 3056|    261|		  uiddate = uid->created;
 3057|    261|		}
 3058|  36.7k|	    }
 3059|  89.3k|	}
 3060|  19.2k|    }
 3061|       |
 3062|  19.3k|  if (!key_usage)
  ------------------
  |  Branch (3062:7): [True: 19.0k, False: 233]
  ------------------
 3063|  19.0k|    {
 3064|       |      /* No key flags at all: get it from the algo.  */
 3065|  19.0k|      key_usage = openpgp_pk_algo_usage (pk->pubkey_algo);
 3066|  19.0k|    }
 3067|    233|  else
 3068|    233|    {
 3069|       |      /* Check that the usage matches the usage as given by the algo.  */
 3070|    233|      int x = openpgp_pk_algo_usage (pk->pubkey_algo);
 3071|    233|      if (x) /* Mask it down to the actual allowed usage.  */
  ------------------
  |  Branch (3071:11): [True: 233, False: 0]
  ------------------
 3072|    233|	key_usage &= x;
 3073|    233|    }
 3074|       |
 3075|       |  /* Whatever happens, it's a primary key, so it can certify. */
 3076|  19.3k|  pk->pubkey_usage = key_usage | PUBKEY_USAGE_CERT;
  ------------------
  |  |   51|  19.3k|#define PUBKEY_USAGE_CERT    GCRY_PK_USAGE_CERT  /* Also good to certify keys.*/
  ------------------
 3077|       |
 3078|  19.3k|  if (!key_expire_seen)
  ------------------
  |  Branch (3078:7): [True: 19.1k, False: 198]
  ------------------
 3079|  19.1k|    {
 3080|       |      /* Find the latest valid user ID with a key expiration set.
 3081|       |       * This may be a different one than from usage computation above
 3082|       |       * because some user IDs may have no expiration date set.  */
 3083|  19.1k|      uiddate = 0;
 3084|   107k|      for (k = keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY;
  ------------------
  |  Branch (3084:26): [True: 90.0k, False: 17.8k]
  |  Branch (3084:31): [True: 88.8k, False: 1.28k]
  ------------------
 3085|  88.8k|	   k = k->next)
 3086|  88.8k|	{
 3087|  88.8k|	  if (k->pkt->pkttype == PKT_USER_ID)
  ------------------
  |  Branch (3087:8): [True: 36.5k, False: 52.2k]
  ------------------
 3088|  36.5k|	    {
 3089|  36.5k|	      PKT_user_id *uid = k->pkt->pkt.user_id;
 3090|  36.5k|	      if (uid->help_key_expire
  ------------------
  |  Branch (3090:12): [True: 1.14k, False: 35.3k]
  ------------------
 3091|  36.5k|                  && (uid->created > uiddate || (!uid->created && !uiddate)))
  ------------------
  |  Branch (3091:23): [True: 139, False: 1.00k]
  |  Branch (3091:50): [True: 0, False: 1.00k]
  |  Branch (3091:67): [True: 0, False: 0]
  ------------------
 3092|    139|		{
 3093|    139|		  key_expire = uid->help_key_expire;
 3094|    139|		  uiddate = uid->created;
 3095|    139|		}
 3096|  36.5k|	    }
 3097|  88.8k|	}
 3098|  19.1k|    }
 3099|       |
 3100|       |  /* Currently only the not anymore supported v3 keys have a maximum
 3101|       |   * expiration date, but future key versions may get this feature again. */
 3102|  19.3k|  if (key_expire == 0
  ------------------
  |  Branch (3102:7): [True: 19.0k, False: 301]
  ------------------
 3103|  19.3k|      || (pk->max_expiredate && key_expire > pk->max_expiredate))
  ------------------
  |  Branch (3103:11): [True: 0, False: 301]
  |  Branch (3103:33): [True: 0, False: 0]
  ------------------
 3104|  19.0k|    key_expire = pk->max_expiredate;
 3105|       |
 3106|  19.3k|  pk->has_expired = key_expire >= curtime ? 0 : key_expire;
  ------------------
  |  Branch (3106:21): [True: 44, False: 19.2k]
  ------------------
 3107|  19.3k|  pk->expiredate = key_expire;
 3108|       |
 3109|       |  /* Fixme: we should see how to get rid of the expiretime fields but
 3110|       |   * this needs changes at other places too.  */
 3111|       |
 3112|       |  /* And now find the real primary user ID and delete all others.  */
 3113|  19.3k|  uiddate = uiddate2 = 0;
 3114|  19.3k|  uidnode = uidnode2 = NULL;
 3115|   108k|  for (k = keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY; k = k->next)
  ------------------
  |  Branch (3115:22): [True: 90.6k, False: 18.0k]
  |  Branch (3115:27): [True: 89.4k, False: 1.28k]
  ------------------
 3116|  89.4k|    {
 3117|  89.4k|      if (k->pkt->pkttype == PKT_USER_ID && !k->pkt->pkt.user_id->attrib_data)
  ------------------
  |  Branch (3117:11): [True: 36.7k, False: 52.6k]
  |  Branch (3117:45): [True: 36.2k, False: 443]
  ------------------
 3118|  36.2k|	{
 3119|  36.2k|	  PKT_user_id *uid = k->pkt->pkt.user_id;
 3120|  36.2k|	  if (uid->flags.primary)
  ------------------
  |  Branch (3120:8): [True: 464, False: 35.8k]
  ------------------
 3121|    464|	    {
 3122|    464|	      if (uid->created > uiddate)
  ------------------
  |  Branch (3122:12): [True: 104, False: 360]
  ------------------
 3123|    104|		{
 3124|    104|		  uiddate = uid->created;
 3125|    104|		  uidnode = k;
 3126|    104|		}
 3127|    360|	      else if (uid->created == uiddate && uidnode)
  ------------------
  |  Branch (3127:17): [True: 269, False: 91]
  |  Branch (3127:44): [True: 269, False: 0]
  ------------------
 3128|    269|		{
 3129|       |		  /* The dates are equal, so we need to do a different
 3130|       |		   * (and arbitrary) comparison.  This should rarely,
 3131|       |		   * if ever, happen.  It's good to try and guarantee
 3132|       |		   * that two different GnuPG users with two different
 3133|       |		   * keyrings at least pick the same primary.  */
 3134|    269|		  if (cmp_user_ids (uid, uidnode->pkt->pkt.user_id) > 0)
  ------------------
  |  Branch (3134:9): [True: 19, False: 250]
  ------------------
 3135|     19|		    uidnode = k;
 3136|    269|		}
 3137|    464|	    }
 3138|  35.8k|	  else
 3139|  35.8k|	    {
 3140|  35.8k|	      if (uid->created > uiddate2)
  ------------------
  |  Branch (3140:12): [True: 2.44k, False: 33.3k]
  ------------------
 3141|  2.44k|		{
 3142|  2.44k|		  uiddate2 = uid->created;
 3143|  2.44k|		  uidnode2 = k;
 3144|  2.44k|		}
 3145|  33.3k|	      else if (uid->created == uiddate2 && uidnode2)
  ------------------
  |  Branch (3145:17): [True: 29.0k, False: 4.34k]
  |  Branch (3145:45): [True: 1.54k, False: 27.4k]
  ------------------
 3146|  1.54k|		{
 3147|  1.54k|		  if (cmp_user_ids (uid, uidnode2->pkt->pkt.user_id) > 0)
  ------------------
  |  Branch (3147:9): [True: 1.10k, False: 446]
  ------------------
 3148|  1.10k|		    uidnode2 = k;
 3149|  1.54k|		}
 3150|  35.8k|	    }
 3151|  36.2k|	}
 3152|  89.4k|    }
 3153|  19.3k|  if (uidnode)
  ------------------
  |  Branch (3153:7): [True: 79, False: 19.2k]
  ------------------
 3154|     79|    {
 3155|  3.88k|      for (k = keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY;
  ------------------
  |  Branch (3155:26): [True: 3.80k, False: 79]
  |  Branch (3155:31): [True: 3.80k, False: 0]
  ------------------
 3156|  3.80k|	   k = k->next)
 3157|  3.80k|	{
 3158|  3.80k|	  if (k->pkt->pkttype == PKT_USER_ID &&
  ------------------
  |  Branch (3158:8): [True: 1.26k, False: 2.54k]
  ------------------
 3159|  3.80k|	      !k->pkt->pkt.user_id->attrib_data)
  ------------------
  |  Branch (3159:8): [True: 1.25k, False: 5]
  ------------------
 3160|  1.25k|	    {
 3161|  1.25k|	      PKT_user_id *uid = k->pkt->pkt.user_id;
 3162|  1.25k|	      if (k != uidnode)
  ------------------
  |  Branch (3162:12): [True: 1.17k, False: 79]
  ------------------
 3163|  1.17k|		uid->flags.primary = 0;
 3164|  1.25k|	    }
 3165|  3.80k|	}
 3166|     79|    }
 3167|  19.2k|  else if (uidnode2)
  ------------------
  |  Branch (3167:12): [True: 2.38k, False: 16.8k]
  ------------------
 3168|  2.38k|    {
 3169|       |      /* None is flagged primary - use the latest user ID we have,
 3170|       |       * and disambiguate with the arbitrary packet comparison. */
 3171|  2.38k|      uidnode2->pkt->pkt.user_id->flags.primary = 1;
 3172|  2.38k|    }
 3173|  16.8k|  else
 3174|  16.8k|    {
 3175|       |      /* None of our uids were self-signed, so pick the one that
 3176|       |       * sorts first to be the primary.  This is the best we can do
 3177|       |       * here since there are no self sigs to date the uids. */
 3178|       |
 3179|  16.8k|      uidnode = NULL;
 3180|       |
 3181|  78.6k|      for (k = keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY;
  ------------------
  |  Branch (3181:26): [True: 63.0k, False: 15.5k]
  |  Branch (3181:31): [True: 61.8k, False: 1.26k]
  ------------------
 3182|  61.8k|	   k = k->next)
 3183|  61.8k|	{
 3184|  61.8k|	  if (k->pkt->pkttype == PKT_USER_ID
  ------------------
  |  Branch (3184:8): [True: 21.6k, False: 40.1k]
  ------------------
 3185|  61.8k|	      && !k->pkt->pkt.user_id->attrib_data)
  ------------------
  |  Branch (3185:11): [True: 21.2k, False: 422]
  ------------------
 3186|  21.2k|	    {
 3187|  21.2k|	      if (!uidnode)
  ------------------
  |  Branch (3187:12): [True: 5.22k, False: 15.9k]
  ------------------
 3188|  5.22k|		{
 3189|  5.22k|		  uidnode = k;
 3190|  5.22k|		  uidnode->pkt->pkt.user_id->flags.primary = 1;
 3191|  5.22k|		  continue;
 3192|  5.22k|		}
 3193|  15.9k|	      else
 3194|  15.9k|		{
 3195|  15.9k|		  if (cmp_user_ids (k->pkt->pkt.user_id,
  ------------------
  |  Branch (3195:9): [True: 638, False: 15.3k]
  ------------------
 3196|  15.9k|				    uidnode->pkt->pkt.user_id) > 0)
 3197|    638|		    {
 3198|    638|		      uidnode->pkt->pkt.user_id->flags.primary = 0;
 3199|    638|		      uidnode = k;
 3200|    638|		      uidnode->pkt->pkt.user_id->flags.primary = 1;
 3201|    638|		    }
 3202|  15.3k|		  else
 3203|  15.3k|                    {
 3204|       |                      /* just to be safe: */
 3205|  15.3k|                      k->pkt->pkt.user_id->flags.primary = 0;
 3206|  15.3k|                    }
 3207|  15.9k|		}
 3208|  21.2k|	    }
 3209|  61.8k|	}
 3210|  16.8k|    }
 3211|  19.3k|}
getkey.c:sig_to_revoke_info:
 2631|    588|{
 2632|    588|  rinfo->date = sig->timestamp;
 2633|    588|  rinfo->algo = sig->pubkey_algo;
 2634|    588|  rinfo->keyid[0] = sig->keyid[0];
 2635|    588|  rinfo->keyid[1] = sig->keyid[1];
 2636|    588|}
getkey.c:parse_key_usage:
 2422|  8.61k|{
 2423|  8.61k|  int key_usage = 0;
 2424|  8.61k|  const byte *p;
 2425|  8.61k|  size_t n;
 2426|  8.61k|  byte flags;
 2427|       |
 2428|  8.61k|  p = parse_sig_subpkt (sig, 1, SIGSUBPKT_KEY_FLAGS, &n);
 2429|  8.61k|  if (p && n)
  ------------------
  |  Branch (2429:7): [True: 2.96k, False: 5.64k]
  |  Branch (2429:12): [True: 2.84k, False: 126]
  ------------------
 2430|  2.84k|    {
 2431|       |      /* First octet of the keyflags.  */
 2432|  2.84k|      flags = *p;
 2433|       |
 2434|  2.84k|      if (flags & 1)
  ------------------
  |  Branch (2434:11): [True: 1.62k, False: 1.22k]
  ------------------
 2435|  1.62k|	{
 2436|  1.62k|	  key_usage |= PUBKEY_USAGE_CERT;
  ------------------
  |  |   51|  1.62k|#define PUBKEY_USAGE_CERT    GCRY_PK_USAGE_CERT  /* Also good to certify keys.*/
  ------------------
 2437|  1.62k|	  flags &= ~1;
 2438|  1.62k|	}
 2439|       |
 2440|  2.84k|      if (flags & 2)
  ------------------
  |  Branch (2440:11): [True: 2.54k, False: 299]
  ------------------
 2441|  2.54k|	{
 2442|  2.54k|	  key_usage |= PUBKEY_USAGE_SIG;
  ------------------
  |  |   49|  2.54k|#define PUBKEY_USAGE_SIG     GCRY_PK_USAGE_SIGN  /* Good for signatures. */
  ------------------
 2443|  2.54k|	  flags &= ~2;
 2444|  2.54k|	}
 2445|       |
 2446|       |      /* We do not distinguish between encrypting communications and
 2447|       |         encrypting storage. */
 2448|  2.84k|      if (flags & (0x04 | 0x08))
  ------------------
  |  Branch (2448:11): [True: 484, False: 2.35k]
  ------------------
 2449|    484|	{
 2450|    484|	  key_usage |= PUBKEY_USAGE_ENC;
  ------------------
  |  |   50|    484|#define PUBKEY_USAGE_ENC     GCRY_PK_USAGE_ENCR  /* Good for encryption. */
  ------------------
 2451|    484|	  flags &= ~(0x04 | 0x08);
 2452|    484|	}
 2453|       |
 2454|  2.84k|      if (flags & 0x20)
  ------------------
  |  Branch (2454:11): [True: 238, False: 2.60k]
  ------------------
 2455|    238|	{
 2456|    238|	  key_usage |= PUBKEY_USAGE_AUTH;
  ------------------
  |  |   52|    238|#define PUBKEY_USAGE_AUTH    GCRY_PK_USAGE_AUTH  /* Good for authentication. */
  ------------------
 2457|    238|	  flags &= ~0x20;
 2458|    238|	}
 2459|       |
 2460|  2.84k|      if ((flags & 0x80))
  ------------------
  |  Branch (2460:11): [True: 216, False: 2.62k]
  ------------------
 2461|    216|	{
 2462|    216|	  key_usage |= PUBKEY_USAGE_GROUP;
  ------------------
  |  |   61|    216|#define PUBKEY_USAGE_GROUP   512                 /* Group flag.  */
  ------------------
 2463|    216|	  flags &= ~0x80;
 2464|    216|	}
 2465|       |
 2466|  2.84k|      if (flags)
  ------------------
  |  Branch (2466:11): [True: 315, False: 2.52k]
  ------------------
 2467|    315|	key_usage |= PUBKEY_USAGE_UNKNOWN;
  ------------------
  |  |   53|    315|#define PUBKEY_USAGE_UNKNOWN GCRY_PK_USAGE_UNKN  /* Unknown usage flag. */
  ------------------
 2468|       |
 2469|  2.84k|      n--;
 2470|  2.84k|      p++;
 2471|  2.84k|      if (n)
  ------------------
  |  Branch (2471:11): [True: 398, False: 2.44k]
  ------------------
 2472|    398|        {
 2473|    398|          flags = *p;
 2474|    398|          if ((flags & 0x04))
  ------------------
  |  Branch (2474:15): [True: 18, False: 380]
  ------------------
 2475|     18|            key_usage |= PUBKEY_USAGE_RENC;
  ------------------
  |  |   59|     18|#define PUBKEY_USAGE_RENC    512                 /* Restricted encryption.  */
  ------------------
 2476|    398|          if ((flags & 0x08))
  ------------------
  |  Branch (2476:15): [True: 258, False: 140]
  ------------------
 2477|    258|            key_usage |= PUBKEY_USAGE_TIME;
  ------------------
  |  |   60|    258|#define PUBKEY_USAGE_TIME    1024                /* Timestamp use.  */
  ------------------
 2478|    398|        }
 2479|       |
 2480|  2.84k|      if (!key_usage)
  ------------------
  |  Branch (2480:11): [True: 18, False: 2.82k]
  ------------------
 2481|     18|	key_usage |= PUBKEY_USAGE_NONE;
  ------------------
  |  |   54|     18|#define PUBKEY_USAGE_NONE    256                 /* No usage given. */
  ------------------
 2482|       |
 2483|  2.84k|    }
 2484|  5.77k|  else if (p) /* Key flags of length zero.  */
  ------------------
  |  Branch (2484:12): [True: 126, False: 5.64k]
  ------------------
 2485|    126|    key_usage |= PUBKEY_USAGE_NONE;
  ------------------
  |  |   54|    126|#define PUBKEY_USAGE_NONE    256                 /* No usage given. */
  ------------------
 2486|       |
 2487|       |  /* We set PUBKEY_USAGE_UNKNOWN to indicate that this key has a
 2488|       |     capability that we do not handle.  This serves to distinguish
 2489|       |     between a zero key usage which we handle as the default
 2490|       |     capabilities for that algorithm, and a usage that we do not
 2491|       |     handle.  Likewise we use PUBKEY_USAGE_NONE to indicate that
 2492|       |     key_flags have been given but they do not specify any usage.  */
 2493|       |
 2494|  8.61k|  return key_usage;
 2495|  8.61k|}
getkey.c:fixup_uidnode:
 2509|  7.02k|{
 2510|  7.02k|  PKT_user_id *uid = uidnode->pkt->pkt.user_id;
 2511|  7.02k|  PKT_signature *sig = signode->pkt->pkt.signature;
 2512|  7.02k|  const byte *p, *sym, *aead, *hash, *zip;
 2513|  7.02k|  size_t n, nsym, naead, nhash, nzip;
 2514|       |
 2515|  7.02k|  sig->flags.chosen_selfsig = 1;/* We chose this one. */
 2516|  7.02k|  uid->created = 0;		/* Not created == invalid. */
 2517|  7.02k|  if (IS_UID_REV (sig))
  ------------------
  |  |   46|  7.02k|#define IS_UID_REV(s)    ((s)->sig_class == 0x30)
  |  |  ------------------
  |  |  |  Branch (46:26): [True: 1.43k, False: 5.59k]
  |  |  ------------------
  ------------------
 2518|  1.43k|    {
 2519|  1.43k|      uid->flags.revoked = 1;
 2520|  1.43k|      return; /* Has been revoked.  */
 2521|  1.43k|    }
 2522|  5.59k|  else
 2523|  5.59k|    uid->flags.revoked = 0;
 2524|       |
 2525|  5.59k|  uid->expiredate = sig->expiredate;
 2526|       |
 2527|  5.59k|  if (sig->flags.expired)
  ------------------
  |  Branch (2527:7): [True: 18, False: 5.57k]
  ------------------
 2528|     18|    {
 2529|     18|      uid->flags.expired = 1;
 2530|     18|      return; /* Has expired.  */
 2531|     18|    }
 2532|  5.57k|  else
 2533|  5.57k|    uid->flags.expired = 0;
 2534|       |
 2535|  5.57k|  uid->created = sig->timestamp; /* This one is okay. */
 2536|  5.57k|  uid->selfsigversion = sig->version;
 2537|       |  /* If we got this far, it's not expired :) */
 2538|  5.57k|  uid->flags.expired = 0;
 2539|       |
 2540|       |  /* Store the key flags in the helper variable for later processing.  */
 2541|  5.57k|  uid->help_key_usage = parse_key_usage (sig);
 2542|       |
 2543|       |  /* Ditto for the key expiration.  */
 2544|  5.57k|  p = parse_sig_subpkt (sig, 1, SIGSUBPKT_KEY_EXPIRE, NULL);
 2545|  5.57k|  if (p && buf32_to_u32 (p))
  ------------------
  |  Branch (2545:7): [True: 1.14k, False: 4.43k]
  |  Branch (2545:12): [True: 1.14k, False: 1]
  ------------------
 2546|  1.14k|    uid->help_key_expire = keycreated + buf32_to_u32 (p);
 2547|  4.43k|  else
 2548|  4.43k|    uid->help_key_expire = 0;
 2549|       |
 2550|       |  /* Set the primary user ID flag - we will later wipe out some
 2551|       |   * of them to only have one in our keyblock.  */
 2552|  5.57k|  uid->flags.primary = 0;
 2553|  5.57k|  p = parse_sig_subpkt (sig, 1, SIGSUBPKT_PRIMARY_UID, NULL);
 2554|  5.57k|  if (p && *p)
  ------------------
  |  Branch (2554:7): [True: 482, False: 5.09k]
  |  Branch (2554:12): [True: 464, False: 18]
  ------------------
 2555|    464|    uid->flags.primary = 2;
 2556|       |
 2557|       |  /* We could also query this from the unhashed area if it is not in
 2558|       |   * the hased area and then later try to decide which is the better
 2559|       |   * there should be no security problem with this.
 2560|       |   * For now we only look at the hashed one.  */
 2561|       |
 2562|       |  /* Now build the preferences list.  These must come from the
 2563|       |     hashed section so nobody can modify the ciphers a key is
 2564|       |     willing to accept.  */
 2565|  5.57k|  p = parse_sig_subpkt (sig, 1, SIGSUBPKT_PREF_SYM, &n);
 2566|  5.57k|  sym = p;
 2567|  5.57k|  nsym = p ? n : 0;
  ------------------
  |  Branch (2567:10): [True: 1.43k, False: 4.14k]
  ------------------
 2568|  5.57k|  p = parse_sig_subpkt (sig, 1, SIGSUBPKT_PREF_AEAD, &n);
 2569|  5.57k|  aead = p;
 2570|  5.57k|  naead = p ? n : 0;
  ------------------
  |  Branch (2570:11): [True: 246, False: 5.33k]
  ------------------
 2571|  5.57k|  p = parse_sig_subpkt (sig, 1, SIGSUBPKT_PREF_HASH, &n);
 2572|  5.57k|  hash = p;
 2573|  5.57k|  nhash = p ? n : 0;
  ------------------
  |  Branch (2573:11): [True: 1.11k, False: 4.46k]
  ------------------
 2574|  5.57k|  p = parse_sig_subpkt (sig, 1, SIGSUBPKT_PREF_COMPR, &n);
 2575|  5.57k|  zip = p;
 2576|  5.57k|  nzip = p ? n : 0;
  ------------------
  |  Branch (2576:10): [True: 1.35k, False: 4.22k]
  ------------------
 2577|  5.57k|  if (uid->prefs)
  ------------------
  |  Branch (2577:7): [True: 0, False: 5.57k]
  ------------------
 2578|      0|    xfree (uid->prefs);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 2579|  5.57k|  n = nsym + naead + nhash + nzip;
 2580|  5.57k|  if (!n)
  ------------------
  |  Branch (2580:7): [True: 3.87k, False: 1.69k]
  ------------------
 2581|  3.87k|    uid->prefs = NULL;
 2582|  1.69k|  else
 2583|  1.69k|    {
 2584|  1.69k|      uid->prefs = xmalloc (sizeof (*uid->prefs) * (n + 1));
  ------------------
  |  |  107|  1.69k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 2585|  1.69k|      n = 0;
 2586|  10.1k|      for (; nsym; nsym--, n++)
  ------------------
  |  Branch (2586:14): [True: 8.41k, False: 1.69k]
  ------------------
 2587|  8.41k|	{
 2588|  8.41k|	  uid->prefs[n].type = PREFTYPE_SYM;
 2589|  8.41k|	  uid->prefs[n].value = *sym++;
 2590|  8.41k|	}
 2591|  2.26k|      for (; naead; naead--, n++)
  ------------------
  |  Branch (2591:14): [True: 562, False: 1.69k]
  ------------------
 2592|    562|	{
 2593|    562|	  uid->prefs[n].type = PREFTYPE_AEAD;
 2594|    562|	  uid->prefs[n].value = *aead++;
 2595|    562|	}
 2596|  7.23k|      for (; nhash; nhash--, n++)
  ------------------
  |  Branch (2596:14): [True: 5.53k, False: 1.69k]
  ------------------
 2597|  5.53k|	{
 2598|  5.53k|	  uid->prefs[n].type = PREFTYPE_HASH;
 2599|  5.53k|	  uid->prefs[n].value = *hash++;
 2600|  5.53k|	}
 2601|  6.21k|      for (; nzip; nzip--, n++)
  ------------------
  |  Branch (2601:14): [True: 4.51k, False: 1.69k]
  ------------------
 2602|  4.51k|	{
 2603|  4.51k|	  uid->prefs[n].type = PREFTYPE_ZIP;
 2604|  4.51k|	  uid->prefs[n].value = *zip++;
 2605|  4.51k|	}
 2606|  1.69k|      uid->prefs[n].type = PREFTYPE_NONE; /* End of list marker  */
 2607|  1.69k|      uid->prefs[n].value = 0;
 2608|  1.69k|    }
 2609|       |
 2610|       |  /* See whether we have the MDC feature.  */
 2611|  5.57k|  uid->flags.mdc = 0;
 2612|  5.57k|  p = parse_sig_subpkt (sig, 1, SIGSUBPKT_FEATURES, &n);
 2613|  5.57k|  if (p && n && (p[0] & 0x01))
  ------------------
  |  Branch (2613:7): [True: 1.08k, False: 4.49k]
  |  Branch (2613:12): [True: 990, False: 94]
  |  Branch (2613:17): [True: 919, False: 71]
  ------------------
 2614|    919|    uid->flags.mdc = 1;
 2615|       |
 2616|       |  /* See whether we have the AEAD feature.  */
 2617|  5.57k|  uid->flags.aead = 0;
 2618|  5.57k|  p = parse_sig_subpkt (sig, 1, SIGSUBPKT_FEATURES, &n);
 2619|  5.57k|  if (p && n && (p[0] & 0x02))
  ------------------
  |  Branch (2619:7): [True: 1.08k, False: 4.49k]
  |  Branch (2619:12): [True: 990, False: 94]
  |  Branch (2619:17): [True: 257, False: 733]
  ------------------
 2620|    257|    uid->flags.aead = 1;
 2621|       |
 2622|       |  /* And the keyserver modify flag.  */
 2623|  5.57k|  uid->flags.ks_modify = 1;
 2624|  5.57k|  p = parse_sig_subpkt (sig, 1, SIGSUBPKT_KS_FLAGS, &n);
 2625|  5.57k|  if (p && n && (p[0] & 0x80))
  ------------------
  |  Branch (2625:7): [True: 1.05k, False: 4.52k]
  |  Branch (2625:12): [True: 991, False: 60]
  |  Branch (2625:17): [True: 923, False: 68]
  ------------------
 2626|    923|    uid->flags.ks_modify = 0;
 2627|  5.57k|}
getkey.c:merge_selfsigs_subkey:
 3257|  9.56k|{
 3258|  9.56k|  PKT_public_key *mainpk = NULL, *subpk = NULL;
 3259|  9.56k|  PKT_signature *sig;
 3260|  9.56k|  KBNODE k;
 3261|  9.56k|  u32 mainkid[2];
 3262|  9.56k|  u32 sigdate = 0;
 3263|  9.56k|  KBNODE signode;
 3264|  9.56k|  u32 curtime = make_timestamp ();
 3265|  9.56k|  unsigned int key_usage = 0;
 3266|  9.56k|  u32 keytimestamp = 0;
 3267|  9.56k|  u32 key_expire = 0;
 3268|  9.56k|  const byte *p;
 3269|       |
 3270|  9.56k|  if (subnode->pkt->pkttype != PKT_PUBLIC_SUBKEY)
  ------------------
  |  Branch (3270:7): [True: 0, False: 9.56k]
  ------------------
 3271|      0|    BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 3272|  9.56k|  mainpk = keyblock->pkt->pkt.public_key;
 3273|  9.56k|  if (mainpk->version < 4)
  ------------------
  |  Branch (3273:7): [True: 0, False: 9.56k]
  ------------------
 3274|      0|    return;/* (actually this should never happen) */
 3275|  9.56k|  keyid_from_pk (mainpk, mainkid);
 3276|  9.56k|  subpk = subnode->pkt->pkt.public_key;
 3277|  9.56k|  keytimestamp = subpk->timestamp;
 3278|       |
 3279|  9.56k|  subpk->flags.valid = 0;
 3280|  9.56k|  subpk->flags.exact = 0;
 3281|  9.56k|  subpk->main_keyid[0] = mainpk->main_keyid[0];
 3282|  9.56k|  subpk->main_keyid[1] = mainpk->main_keyid[1];
 3283|       |
 3284|       |  /* Find the latest key binding self-signature.  */
 3285|  9.56k|  signode = NULL;
 3286|  9.56k|  sigdate = 0; /* Helper to find the latest signature.  */
 3287|  18.1k|  for (k = subnode->next; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY;
  ------------------
  |  Branch (3287:27): [True: 16.8k, False: 1.28k]
  |  Branch (3287:32): [True: 8.56k, False: 8.28k]
  ------------------
 3288|  9.56k|       k = k->next)
 3289|  8.56k|    {
 3290|  8.56k|      if (k->pkt->pkttype == PKT_SIGNATURE)
  ------------------
  |  Branch (3290:11): [True: 6.36k, False: 2.20k]
  ------------------
 3291|  6.36k|	{
 3292|  6.36k|	  sig = k->pkt->pkt.signature;
 3293|  6.36k|	  if (sig->keyid[0] == mainkid[0] && sig->keyid[1] == mainkid[1])
  ------------------
  |  Branch (3293:8): [True: 5.88k, False: 480]
  |  Branch (3293:39): [True: 5.48k, False: 394]
  ------------------
 3294|  5.48k|	    {
 3295|  5.48k|	      if (check_key_signature (ctrl, keyblock, k, NULL))
  ------------------
  |  Branch (3295:12): [True: 1.92k, False: 3.56k]
  ------------------
 3296|  1.92k|		; /* Signature did not verify.  */
 3297|  3.56k|	      else if (IS_SUBKEY_REV (sig))
  ------------------
  |  |   47|  3.56k|#define IS_SUBKEY_REV(s) ((s)->sig_class == 0x28)
  |  |  ------------------
  |  |  |  Branch (47:26): [True: 535, False: 3.02k]
  |  |  ------------------
  ------------------
 3298|    535|		{
 3299|       |		  /* Note that this means that the date on a
 3300|       |		   * revocation sig does not matter - even if the
 3301|       |		   * binding sig is dated after the revocation sig,
 3302|       |		   * the subkey is still marked as revoked.  This
 3303|       |		   * seems ok, as it is just as easy to make new
 3304|       |		   * subkeys rather than re-sign old ones as the
 3305|       |		   * problem is in the distribution.  Plus, PGP (7)
 3306|       |		   * does this the same way.  */
 3307|    535|		  subpk->flags.revoked = 1;
 3308|    535|		  sig_to_revoke_info (sig, &subpk->revoked);
 3309|       |		  /* Although we could stop now, we continue to
 3310|       |		   * figure out other information like the old expiration
 3311|       |		   * time.  */
 3312|    535|		}
 3313|  3.02k|	      else if (IS_SUBKEY_SIG (sig) && sig->timestamp >= sigdate)
  ------------------
  |  |   43|  6.05k|#define IS_SUBKEY_SIG(s) ((s)->sig_class == 0x18)
  |  |  ------------------
  |  |  |  Branch (43:26): [True: 2.95k, False: 74]
  |  |  ------------------
  ------------------
  |  Branch (3313:40): [True: 2.77k, False: 182]
  ------------------
 3314|  2.77k|		{
 3315|  2.77k|		  if (sig->flags.expired)
  ------------------
  |  Branch (3315:9): [True: 37, False: 2.73k]
  ------------------
 3316|     37|		    ; /* Signature has expired - ignore it.  */
 3317|  2.73k|		  else
 3318|  2.73k|		    {
 3319|  2.73k|		      sigdate = sig->timestamp;
 3320|  2.73k|		      signode = k;
 3321|  2.73k|		      signode->pkt->pkt.signature->flags.chosen_selfsig = 0;
 3322|  2.73k|		    }
 3323|  2.77k|		}
 3324|  5.48k|	    }
 3325|  6.36k|	}
 3326|  8.56k|    }
 3327|       |
 3328|       |  /* No valid key binding.  */
 3329|  9.56k|  if (!signode)
  ------------------
  |  Branch (3329:7): [True: 6.91k, False: 2.65k]
  ------------------
 3330|  6.91k|    return;
 3331|       |
 3332|  2.65k|  sig = signode->pkt->pkt.signature;
 3333|  2.65k|  sig->flags.chosen_selfsig = 1; /* So we know which selfsig we chose later.  */
 3334|       |
 3335|  2.65k|  key_usage = parse_key_usage (sig);
 3336|  2.65k|  if (!key_usage)
  ------------------
  |  Branch (3336:7): [True: 1.39k, False: 1.25k]
  ------------------
 3337|  1.39k|    {
 3338|       |      /* No key flags at all: get it from the algo.  */
 3339|  1.39k|      key_usage = openpgp_pk_algo_usage (subpk->pubkey_algo);
 3340|  1.39k|    }
 3341|  1.25k|  else
 3342|  1.25k|    {
 3343|       |      /* Check that the usage matches the usage as given by the algo.  */
 3344|  1.25k|      int x = openpgp_pk_algo_usage (subpk->pubkey_algo);
 3345|  1.25k|      if (x) /* Mask it down to the actual allowed usage.  */
  ------------------
  |  Branch (3345:11): [True: 1.17k, False: 84]
  ------------------
 3346|  1.17k|	key_usage &= x;
 3347|  1.25k|    }
 3348|       |
 3349|  2.65k|  subpk->pubkey_usage = key_usage;
 3350|       |
 3351|  2.65k|  p = parse_sig_subpkt (sig, 1, SIGSUBPKT_KEY_EXPIRE, NULL);
 3352|  2.65k|  if (p && buf32_to_u32 (p))
  ------------------
  |  Branch (3352:7): [True: 1.71k, False: 931]
  |  Branch (3352:12): [True: 1.71k, False: 2]
  ------------------
 3353|  1.71k|    key_expire = keytimestamp + buf32_to_u32 (p);
 3354|    933|  else
 3355|    933|    key_expire = 0;
 3356|       |
 3357|  2.65k|  subpk->has_expired = key_expire >= curtime ? 0 : key_expire;
  ------------------
  |  Branch (3357:24): [True: 787, False: 1.86k]
  ------------------
 3358|  2.65k|  subpk->expiredate = key_expire;
 3359|       |
 3360|       |  /* Algo doesn't exist.  */
 3361|  2.65k|  if (openpgp_pk_test_algo (subpk->pubkey_algo))
  ------------------
  |  Branch (3361:7): [True: 720, False: 1.93k]
  ------------------
 3362|    720|    return;
 3363|       |
 3364|  1.93k|  subpk->flags.valid = 1;
 3365|       |
 3366|       |  /* Find the most recent 0x19 embedded signature on our self-sig. */
 3367|  1.93k|  if (!subpk->flags.backsig)
  ------------------
  |  Branch (3367:7): [True: 1.93k, False: 0]
  ------------------
 3368|  1.93k|    {
 3369|  1.93k|      int seq = 0;
 3370|  1.93k|      size_t n;
 3371|  1.93k|      PKT_signature *backsig = NULL;
 3372|       |
 3373|  1.93k|      sigdate = 0;
 3374|       |
 3375|       |      /* We do this while() since there may be other embedded
 3376|       |       * signatures in the future.  We only want 0x19 here. */
 3377|       |
 3378|  2.06k|      while ((p = enum_sig_subpkt (sig, 1, SIGSUBPKT_SIGNATURE,
  ------------------
  |  Branch (3378:14): [True: 136, False: 1.93k]
  ------------------
 3379|  2.06k|                                   &n, &seq, NULL)))
 3380|    136|        if (n > 3
  ------------------
  |  Branch (3380:13): [True: 60, False: 76]
  ------------------
 3381|    136|            && ((p[0] == 3 && p[2] == 0x19) || (p[0] == 4 && p[1] == 0x19)
  ------------------
  |  Branch (3381:18): [True: 13, False: 47]
  |  Branch (3381:31): [True: 0, False: 13]
  |  Branch (3381:49): [True: 6, False: 54]
  |  Branch (3381:62): [True: 0, False: 6]
  ------------------
 3382|     60|                || (p[0] == 5 && p[1] == 0x19)))
  ------------------
  |  Branch (3382:21): [True: 25, False: 35]
  |  Branch (3382:34): [True: 0, False: 25]
  ------------------
 3383|      0|          {
 3384|      0|	    PKT_signature *tempsig = buf_to_sig (p, n);
 3385|      0|	    if (tempsig)
  ------------------
  |  Branch (3385:10): [True: 0, False: 0]
  ------------------
 3386|      0|	      {
 3387|      0|		if (tempsig->timestamp > sigdate)
  ------------------
  |  Branch (3387:7): [True: 0, False: 0]
  ------------------
 3388|      0|		  {
 3389|      0|		    if (backsig)
  ------------------
  |  Branch (3389:11): [True: 0, False: 0]
  ------------------
 3390|      0|		      free_seckey_enc (backsig);
 3391|       |
 3392|      0|		    backsig = tempsig;
 3393|      0|		    sigdate = backsig->timestamp;
 3394|      0|		  }
 3395|      0|		else
 3396|      0|		  free_seckey_enc (tempsig);
 3397|      0|	      }
 3398|      0|	  }
 3399|       |
 3400|  1.93k|      seq = 0;
 3401|       |
 3402|       |      /* It is safe to have this in the unhashed area since the 0x19
 3403|       |       * is located on the selfsig for convenience, not security. */
 3404|  3.83k|      while ((p = enum_sig_subpkt (sig, 0, SIGSUBPKT_SIGNATURE,
  ------------------
  |  Branch (3404:14): [True: 1.90k, False: 1.93k]
  ------------------
 3405|  3.83k|				   &n, &seq, NULL)))
 3406|  1.90k|        if (n > 3
  ------------------
  |  Branch (3406:13): [True: 1.90k, False: 2]
  ------------------
 3407|  1.90k|            && ((p[0] == 3 && p[2] == 0x19) || (p[0] == 4 && p[1] == 0x19)
  ------------------
  |  Branch (3407:18): [True: 20, False: 1.88k]
  |  Branch (3407:31): [True: 6, False: 14]
  |  Branch (3407:49): [True: 1.63k, False: 268]
  |  Branch (3407:62): [True: 1.62k, False: 11]
  ------------------
 3408|  1.90k|                 || (p[0] == 5 && p[1] == 0x19)))
  ------------------
  |  Branch (3408:22): [True: 234, False: 45]
  |  Branch (3408:35): [True: 227, False: 7]
  ------------------
 3409|  1.85k|          {
 3410|  1.85k|	    PKT_signature *tempsig = buf_to_sig (p, n);
 3411|  1.85k|	    if (tempsig)
  ------------------
  |  Branch (3411:10): [True: 1.79k, False: 58]
  ------------------
 3412|  1.79k|	      {
 3413|  1.79k|		if (tempsig->timestamp > sigdate)
  ------------------
  |  Branch (3413:7): [True: 1.78k, False: 11]
  ------------------
 3414|  1.78k|		  {
 3415|  1.78k|		    if (backsig)
  ------------------
  |  Branch (3415:11): [True: 0, False: 1.78k]
  ------------------
 3416|      0|		      free_seckey_enc (backsig);
 3417|       |
 3418|  1.78k|		    backsig = tempsig;
 3419|  1.78k|		    sigdate = backsig->timestamp;
 3420|  1.78k|		  }
 3421|     11|		else
 3422|     11|		  free_seckey_enc (tempsig);
 3423|  1.79k|	      }
 3424|  1.85k|	  }
 3425|       |
 3426|  1.93k|      if (backsig)
  ------------------
  |  Branch (3426:11): [True: 1.78k, False: 144]
  ------------------
 3427|  1.78k|	{
 3428|       |	  /* At this point, backsig contains the most recent 0x19 sig.
 3429|       |	   * Let's see if it is good. */
 3430|       |
 3431|       |	  /* 2==valid, 1==invalid, 0==didn't check */
 3432|  1.78k|	  if (check_backsig (mainpk, subpk, backsig) == 0)
  ------------------
  |  Branch (3432:8): [True: 0, False: 1.78k]
  ------------------
 3433|      0|	    subpk->flags.backsig = 2;
 3434|  1.78k|	  else
 3435|  1.78k|	    subpk->flags.backsig = 1;
 3436|       |
 3437|  1.78k|	  free_seckey_enc (backsig);
 3438|  1.78k|	}
 3439|  1.93k|    }
 3440|  1.93k|}
getkey.c:buf_to_sig:
 3218|  1.85k|{
 3219|  1.85k|  PKT_signature *sig = xmalloc_clear (sizeof (PKT_signature));
  ------------------
  |  |  116|  1.85k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
 3220|  1.85k|  IOBUF iobuf = iobuf_temp_with_content (buf, len);
 3221|  1.85k|  int save_mode = set_packet_list_mode (0);
 3222|       |
 3223|  1.85k|  if (parse_signature (iobuf, PKT_SIGNATURE, len, sig) != 0)
  ------------------
  |  Branch (3223:7): [True: 58, False: 1.79k]
  ------------------
 3224|     58|    {
 3225|     58|      free_seckey_enc (sig);
 3226|     58|      sig = NULL;
 3227|     58|    }
 3228|       |
 3229|  1.85k|  set_packet_list_mode (save_mode);
 3230|  1.85k|  iobuf_close (iobuf);
 3231|       |
 3232|  1.85k|  return sig;
 3233|  1.85k|}
getkey.c:lookup:
 3907|  12.1k|{
 3908|  12.1k|  int rc;
 3909|  12.1k|  int no_suitable_key = 0;
 3910|  12.1k|  KBNODE keyblock = NULL;
 3911|  12.1k|  KBNODE found_key = NULL;
 3912|  12.1k|  unsigned int infoflags;
 3913|       |
 3914|  12.1k|  log_assert (ret_found_key == NULL || ret_keyblock != NULL);
 3915|  12.1k|  if (ret_keyblock)
  ------------------
  |  Branch (3915:7): [True: 12.1k, False: 0]
  ------------------
 3916|  12.1k|    *ret_keyblock = NULL;
 3917|       |
 3918|  12.1k|  for (;;)
 3919|  12.1k|    {
 3920|  12.1k|      rc = keydb_search (ctx->kr_handle, ctx->items, ctx->nitems, NULL);
 3921|  12.1k|      if (rc)
  ------------------
  |  Branch (3921:11): [True: 12.1k, False: 0]
  ------------------
 3922|  12.1k|        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|  12.1k| found:
 3975|  12.1k|  if (rc && gpg_err_code (rc) != GPG_ERR_NOT_FOUND)
  ------------------
  |  Branch (3975:7): [True: 12.1k, False: 0]
  |  Branch (3975:13): [True: 0, False: 12.1k]
  ------------------
 3976|      0|    log_error ("keydb_search failed: %s\n", gpg_strerror (rc));
 3977|       |
 3978|  12.1k|  if (!rc)
  ------------------
  |  Branch (3978:7): [True: 0, False: 12.1k]
  ------------------
 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|  12.1k|  else if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND && no_suitable_key)
  ------------------
  |  Branch (3986:12): [True: 12.1k, False: 0]
  |  Branch (3986:54): [True: 0, False: 12.1k]
  ------------------
 3987|      0|    rc = want_secret? GPG_ERR_UNUSABLE_SECKEY : GPG_ERR_UNUSABLE_PUBKEY;
  ------------------
  |  Branch (3987:10): [True: 0, False: 0]
  ------------------
 3988|  12.1k|  else if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND)
  ------------------
  |  Branch (3988:12): [True: 12.1k, False: 0]
  ------------------
 3989|  12.1k|    rc = want_secret? GPG_ERR_NO_SECKEY : GPG_ERR_NO_PUBKEY;
  ------------------
  |  Branch (3989:10): [True: 3.53k, False: 8.56k]
  ------------------
 3990|       |
 3991|  12.1k|  release_kbnode (keyblock);
 3992|       |
 3993|  12.1k|  if (ret_found_key)
  ------------------
  |  Branch (3993:7): [True: 12.1k, False: 0]
  ------------------
 3994|  12.1k|    {
 3995|  12.1k|      if (! rc)
  ------------------
  |  Branch (3995:11): [True: 0, False: 12.1k]
  ------------------
 3996|      0|	*ret_found_key = found_key;
 3997|  12.1k|      else
 3998|  12.1k|	*ret_found_key = NULL;
 3999|  12.1k|    }
 4000|       |
 4001|  12.1k|  return rc;
 4002|  12.1k|}

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

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|  9.10k|{
  819|  9.10k|  gpg_error_t err = 0;
  820|  9.10k|  int i, j;
  821|  9.10k|  int die = 0;
  822|  9.10k|  int reterrno;
  823|       |
  824|  9.10k|  log_assert (!hd->use_keyboxd);
  825|      0|  hd->found = -1;
  826|  9.10k|  hd->saved_found = -1;
  827|  9.10k|  hd->is_reset = 1;
  828|       |
  829|  9.10k|  log_assert (used_resources <= MAX_KEYDB_RESOURCES);
  830|  18.2k|  for (i=j=0; ! die && i < used_resources; i++)
  ------------------
  |  Branch (830:15): [True: 18.2k, False: 0]
  |  Branch (830:24): [True: 9.10k, False: 9.10k]
  ------------------
  831|  9.10k|    {
  832|  9.10k|      switch (all_resources[i].type)
  ------------------
  |  Branch (832:15): [True: 0, False: 9.10k]
  ------------------
  833|  9.10k|        {
  834|      0|        case KEYDB_RESOURCE_TYPE_NONE: /* ignore */
  ------------------
  |  Branch (834:9): [True: 0, False: 9.10k]
  ------------------
  835|      0|          break;
  836|      0|        case KEYDB_RESOURCE_TYPE_KEYRING:
  ------------------
  |  Branch (836:9): [True: 0, False: 9.10k]
  ------------------
  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|  9.10k|        case KEYDB_RESOURCE_TYPE_KEYBOX:
  ------------------
  |  Branch (847:9): [True: 9.10k, False: 0]
  ------------------
  848|  9.10k|          hd->active[j].type   = all_resources[i].type;
  849|  9.10k|          hd->active[j].token  = all_resources[i].token;
  850|  9.10k|          hd->active[j].u.kb   = keybox_new_openpgp (all_resources[i].token, 0);
  851|  9.10k|          if (!hd->active[j].u.kb)
  ------------------
  |  Branch (851:15): [True: 0, False: 9.10k]
  ------------------
  852|      0|            {
  853|      0|              reterrno = errno;
  854|      0|              die = 1;
  855|      0|            }
  856|  9.10k|          j++;
  857|  9.10k|          break;
  858|  9.10k|        }
  859|  9.10k|    }
  860|  9.10k|  hd->used = j;
  861|       |
  862|  9.10k|  active_handles++;
  863|  9.10k|  keydb_stats.handles++;
  864|       |
  865|  9.10k|  if (die)
  ------------------
  |  Branch (865:7): [True: 0, False: 9.10k]
  ------------------
  866|      0|    err = gpg_error_from_errno (reterrno);
  867|       |
  868|  9.10k|   return err;
  869|  9.10k|}
internal_keydb_deinit:
  876|  9.10k|{
  877|  9.10k|  int i;
  878|       |
  879|  9.10k|  log_assert (!hd->use_keyboxd);
  880|       |
  881|      0|  log_assert (active_handles > 0);
  882|      0|  active_handles--;
  883|       |
  884|  9.10k|  hd->keep_lock = 0;
  885|  9.10k|  unlock_all (hd);
  886|  18.2k|  for (i=0; i < hd->used; i++)
  ------------------
  |  Branch (886:13): [True: 9.10k, False: 9.10k]
  ------------------
  887|  9.10k|    {
  888|  9.10k|      switch (hd->active[i].type)
  ------------------
  |  Branch (888:15): [True: 0, False: 9.10k]
  ------------------
  889|  9.10k|        {
  890|      0|        case KEYDB_RESOURCE_TYPE_NONE:
  ------------------
  |  Branch (890:9): [True: 0, False: 9.10k]
  ------------------
  891|      0|          break;
  892|      0|        case KEYDB_RESOURCE_TYPE_KEYRING:
  ------------------
  |  Branch (892:9): [True: 0, False: 9.10k]
  ------------------
  893|      0|          keyring_release (hd->active[i].u.kr);
  894|      0|          break;
  895|  9.10k|        case KEYDB_RESOURCE_TYPE_KEYBOX:
  ------------------
  |  Branch (895:9): [True: 9.10k, False: 0]
  ------------------
  896|  9.10k|          keybox_release (hd->active[i].u.kb);
  897|  9.10k|          break;
  898|  9.10k|        }
  899|  9.10k|    }
  900|       |
  901|  9.10k|  keyblock_cache_clear (hd);
  902|  9.10k|}
internal_keydb_search_reset:
 1682|  7.30k|{
 1683|  7.30k|  gpg_error_t rc = 0;
 1684|  7.30k|  int i;
 1685|       |
 1686|  7.30k|  log_assert (!hd->use_keyboxd);
 1687|       |
 1688|      0|  keyblock_cache_clear (hd);
 1689|       |
 1690|  7.30k|  hd->skipped_long_blobs = 0;
 1691|  7.30k|  hd->current = 0;
 1692|  7.30k|  hd->found = -1;
 1693|       |  /* Now reset all resources.  */
 1694|  14.6k|  for (i=0; !rc && i < hd->used; i++)
  ------------------
  |  Branch (1694:13): [True: 14.6k, False: 0]
  |  Branch (1694:20): [True: 7.30k, False: 7.30k]
  ------------------
 1695|  7.30k|    {
 1696|  7.30k|      switch (hd->active[i].type)
  ------------------
  |  Branch (1696:15): [True: 0, False: 7.30k]
  ------------------
 1697|  7.30k|        {
 1698|      0|        case KEYDB_RESOURCE_TYPE_NONE:
  ------------------
  |  Branch (1698:9): [True: 0, False: 7.30k]
  ------------------
 1699|      0|          break;
 1700|      0|        case KEYDB_RESOURCE_TYPE_KEYRING:
  ------------------
  |  Branch (1700:9): [True: 0, False: 7.30k]
  ------------------
 1701|      0|          rc = keyring_search_reset (hd->active[i].u.kr);
 1702|      0|          break;
 1703|  7.30k|        case KEYDB_RESOURCE_TYPE_KEYBOX:
  ------------------
  |  Branch (1703:9): [True: 7.30k, False: 0]
  ------------------
 1704|  7.30k|          rc = keybox_search_reset (hd->active[i].u.kb);
 1705|  7.30k|          break;
 1706|  7.30k|        }
 1707|  7.30k|    }
 1708|  7.30k|  hd->is_reset = 1;
 1709|  7.30k|  if (!rc)
  ------------------
  |  Branch (1709:7): [True: 7.30k, False: 0]
  ------------------
 1710|  7.30k|    keydb_stats.search_resets++;
 1711|  7.30k|  return rc;
 1712|  7.30k|}
internal_keydb_search:
 1737|  16.4k|{
 1738|  16.4k|  gpg_error_t rc;
 1739|  16.4k|  int was_reset = hd->is_reset;
 1740|       |  /* If an entry is already in the cache, then don't add it again.  */
 1741|  16.4k|  int already_in_cache = 0;
 1742|  16.4k|  int fprlen;
 1743|       |
 1744|  16.4k|  log_assert (!hd->use_keyboxd);
 1745|       |
 1746|  16.4k|  if (!any_registered)
  ------------------
  |  Branch (1746:7): [True: 0, False: 16.4k]
  ------------------
 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.4k|  if (ndesc == 1 && desc[0].mode == KEYDB_SEARCH_MODE_LONG_KID
  ------------------
  |  Branch (1752:7): [True: 16.4k, False: 0]
  |  Branch (1752:21): [True: 12.0k, False: 4.36k]
  ------------------
 1753|  16.4k|      && (already_in_cache = kid_not_found_p (desc[0].u.kid)) == 1 )
  ------------------
  |  Branch (1753:10): [True: 11.5k, False: 453]
  ------------------
 1754|  11.5k|    {
 1755|  11.5k|      if (DBG_CLOCK)
  ------------------
  |  |  356|  11.5k|#define DBG_CLOCK   (opt.debug & DBG_CLOCK_VALUE)
  |  |  ------------------
  |  |  |  |  343|  11.5k|#define DBG_CLOCK_VALUE   4096
  |  |  ------------------
  |  |  |  Branch (356:21): [True: 0, False: 11.5k]
  |  |  ------------------
  ------------------
 1756|      0|        log_clock ("%s leave (not found, cached)", __func__);
 1757|  11.5k|      keydb_stats.notfound_cached++;
 1758|  11.5k|      return gpg_error (GPG_ERR_NOT_FOUND);
 1759|  11.5k|    }
 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.81k|  if (desc[0].mode == KEYDB_SEARCH_MODE_FPR)
  ------------------
  |  Branch (1764:7): [True: 826, False: 3.99k]
  ------------------
 1765|    826|    fprlen = desc[0].fprlen;
 1766|  3.99k|  else
 1767|  3.99k|    fprlen = 0;
 1768|       |
 1769|  4.81k|  if (!hd->no_caching
  ------------------
  |  Branch (1769:7): [True: 4.81k, False: 0]
  ------------------
 1770|  4.81k|      && ndesc == 1
  ------------------
  |  Branch (1770:10): [True: 4.81k, False: 0]
  ------------------
 1771|  4.81k|      && fprlen
  ------------------
  |  Branch (1771:10): [True: 826, False: 3.99k]
  ------------------
 1772|  4.81k|      && hd->keyblock_cache.state == KEYBLOCK_CACHE_FILLED
  ------------------
  |  Branch (1772:10): [True: 0, False: 826]
  ------------------
 1773|  4.81k|      && hd->keyblock_cache.fprlen == fprlen
  ------------------
  |  Branch (1773:10): [True: 0, False: 0]
  ------------------
 1774|  4.81k|      && !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.81k|      && (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.81k|  rc = -1;
 1795|  9.63k|  while ((rc == -1 || gpg_err_code (rc) == GPG_ERR_EOF)
  ------------------
  |  Branch (1795:11): [True: 9.63k, False: 0]
  |  Branch (1795:23): [True: 0, False: 0]
  ------------------
 1796|  9.63k|         && hd->current >= 0 && hd->current < hd->used)
  ------------------
  |  Branch (1796:13): [True: 9.63k, False: 0]
  |  Branch (1796:33): [True: 4.81k, False: 4.81k]
  ------------------
 1797|  4.81k|    {
 1798|  4.81k|      if (DBG_LOOKUP)
  ------------------
  |  |  357|  4.81k|#define DBG_LOOKUP  (opt.debug & DBG_LOOKUP_VALUE)
  |  |  ------------------
  |  |  |  |  344|  4.81k|#define DBG_LOOKUP_VALUE  8192	/* debug the key lookup */
  |  |  ------------------
  |  |  |  Branch (357:21): [True: 0, False: 4.81k]
  |  |  ------------------
  ------------------
 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.81k|       switch (hd->active[hd->current].type)
  ------------------
  |  Branch (1807:16): [True: 0, False: 4.81k]
  ------------------
 1808|  4.81k|        {
 1809|      0|        case KEYDB_RESOURCE_TYPE_NONE:
  ------------------
  |  Branch (1809:9): [True: 0, False: 4.81k]
  ------------------
 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.81k]
  ------------------
 1813|      0|          rc = keyring_search (hd->active[hd->current].u.kr, desc,
 1814|      0|                               ndesc, descindex, 1);
 1815|      0|          break;
 1816|  4.81k|        case KEYDB_RESOURCE_TYPE_KEYBOX:
  ------------------
  |  Branch (1816:9): [True: 4.81k, False: 0]
  ------------------
 1817|  4.81k|          do
 1818|  4.81k|            rc = keybox_search (hd->active[hd->current].u.kb, desc,
 1819|  4.81k|                                ndesc, KEYBOX_BLOBTYPE_PGP,
 1820|  4.81k|                                descindex, &hd->skipped_long_blobs);
 1821|  4.81k|          while (rc == GPG_ERR_LEGACY_KEY);
  ------------------
  |  Branch (1821:18): [True: 0, False: 4.81k]
  ------------------
 1822|  4.81k|          break;
 1823|  4.81k|        }
 1824|       |
 1825|  4.81k|      if (DBG_LOOKUP)
  ------------------
  |  |  357|  4.81k|#define DBG_LOOKUP  (opt.debug & DBG_LOOKUP_VALUE)
  |  |  ------------------
  |  |  |  |  344|  4.81k|#define DBG_LOOKUP_VALUE  8192	/* debug the key lookup */
  |  |  ------------------
  |  |  |  Branch (357:21): [True: 0, False: 4.81k]
  |  |  ------------------
  ------------------
 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.81k|      if (rc == -1 || gpg_err_code (rc) == GPG_ERR_EOF)
  ------------------
  |  Branch (1835:11): [True: 4.81k, False: 0]
  |  Branch (1835:23): [True: 0, False: 0]
  ------------------
 1836|  4.81k|        {
 1837|       |          /* EOF -> switch to next resource */
 1838|  4.81k|          hd->current++;
 1839|  4.81k|        }
 1840|      0|      else if (!rc)
  ------------------
  |  Branch (1840:16): [True: 0, False: 0]
  ------------------
 1841|      0|        hd->found = hd->current;
 1842|  4.81k|    }
 1843|  4.81k|  hd->is_reset = 0;
 1844|       |
 1845|  4.81k|  rc = ((rc == -1 || gpg_err_code (rc) == GPG_ERR_EOF)
  ------------------
  |  Branch (1845:10): [True: 4.81k, False: 0]
  |  Branch (1845:22): [True: 0, False: 0]
  ------------------
 1846|  4.81k|        ? gpg_error (GPG_ERR_NOT_FOUND)
 1847|  4.81k|        : rc);
 1848|       |
 1849|  4.81k|  keyblock_cache_clear (hd);
 1850|  4.81k|  if (!hd->no_caching
  ------------------
  |  Branch (1850:7): [True: 4.81k, False: 0]
  ------------------
 1851|  4.81k|      && !rc
  ------------------
  |  Branch (1851:10): [True: 0, False: 4.81k]
  ------------------
 1852|  4.81k|      && ndesc == 1
  ------------------
  |  Branch (1852:10): [True: 0, False: 0]
  ------------------
 1853|  4.81k|      && fprlen
  ------------------
  |  Branch (1853:10): [True: 0, False: 0]
  ------------------
 1854|  4.81k|      && 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.81k|  if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND
  ------------------
  |  Branch (1867:7): [True: 4.81k, False: 0]
  ------------------
 1868|  4.81k|      && ndesc == 1
  ------------------
  |  Branch (1868:10): [True: 4.81k, False: 0]
  ------------------
 1869|  4.81k|      && desc[0].mode == KEYDB_SEARCH_MODE_LONG_KID
  ------------------
  |  Branch (1869:10): [True: 453, False: 4.36k]
  ------------------
 1870|  4.81k|      && was_reset
  ------------------
  |  Branch (1870:10): [True: 453, False: 0]
  ------------------
 1871|  4.81k|      && !already_in_cache)
  ------------------
  |  Branch (1871:10): [True: 453, False: 0]
  ------------------
 1872|    453|    kid_not_found_insert (desc[0].u.kid);
 1873|       |
 1874|  4.81k|  if (!rc)
  ------------------
  |  Branch (1874:7): [True: 0, False: 4.81k]
  ------------------
 1875|      0|    keydb_stats.found++;
 1876|  4.81k|  else
 1877|  4.81k|    keydb_stats.notfound++;
 1878|  4.81k|  return rc;
 1879|  4.81k|}
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_search_kid:
 1926|  4.30k|{
 1927|  4.30k|  KEYDB_SEARCH_DESC desc;
 1928|       |
 1929|  4.30k|  memset (&desc, 0, sizeof desc);
 1930|  4.30k|  desc.mode = KEYDB_SEARCH_MODE_LONG_KID;
 1931|  4.30k|  desc.u.kid[0] = kid[0];
 1932|  4.30k|  desc.u.kid[1] = kid[1];
 1933|  4.30k|  return keydb_search (hd, &desc, 1, NULL);
 1934|  4.30k|}
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|  21.2k|{
  196|  21.2k|  hd->keyblock_cache.state = KEYBLOCK_CACHE_EMPTY;
  197|  21.2k|  iobuf_close (hd->keyblock_cache.iobuf);
  198|  21.2k|  hd->keyblock_cache.iobuf = NULL;
  199|  21.2k|  hd->keyblock_cache.resource = -1;
  200|  21.2k|  hd->keyblock_cache.offset = -1;
  201|  21.2k|}
keydb.c:unlock_all:
 1035|  9.10k|{
 1036|  9.10k|  int i;
 1037|       |
 1038|  9.10k|  if (!hd->locked || hd->keep_lock)
  ------------------
  |  Branch (1038:7): [True: 9.10k, False: 0]
  |  Branch (1038:22): [True: 0, False: 0]
  ------------------
 1039|  9.10k|    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.0k|{
  124|  12.0k|  struct kid_not_found_cache_bucket *k;
  125|       |
  126|   187k|  for (k = kid_not_found_cache[kid[0] % KID_NOT_FOUND_CACHE_BUCKETS]; k; k = k->next)
  ------------------
  |  |   70|  12.0k|#define KID_NOT_FOUND_CACHE_BUCKETS 256
  ------------------
  |  Branch (126:71): [True: 187k, False: 453]
  ------------------
  127|   187k|    if (k->kid[0] == kid[0] && k->kid[1] == kid[1])
  ------------------
  |  Branch (127:9): [True: 39.6k, False: 147k]
  |  Branch (127:32): [True: 11.5k, False: 28.0k]
  ------------------
  128|  11.5k|      {
  129|  11.5k|        if (DBG_CACHE)
  ------------------
  |  |  352|  11.5k|#define DBG_CACHE  (opt.debug & DBG_CACHE_VALUE)
  |  |  ------------------
  |  |  |  |  338|  11.5k|#define DBG_CACHE_VALUE   64	/* debug the caching */
  |  |  ------------------
  |  |  |  Branch (352:20): [True: 0, False: 11.5k]
  |  |  ------------------
  ------------------
  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.5k|        return 1;
  133|  11.5k|      }
  134|       |
  135|    453|  if (DBG_CACHE)
  ------------------
  |  |  352|    453|#define DBG_CACHE  (opt.debug & DBG_CACHE_VALUE)
  |  |  ------------------
  |  |  |  |  338|    453|#define DBG_CACHE_VALUE   64	/* debug the caching */
  |  |  ------------------
  |  |  |  Branch (352:20): [True: 0, False: 453]
  |  |  ------------------
  ------------------
  136|      0|    log_debug ("keydb: kid_not_found_p (%08lx%08lx) => indeterminate\n",
  137|      0|               (ulong)kid[0], (ulong)kid[1]);
  138|    453|  return 0;
  139|  12.0k|}
keydb.c:kid_not_found_insert:
  149|    453|{
  150|    453|  struct kid_not_found_cache_bucket *k;
  151|       |
  152|    453|  if (DBG_CACHE)
  ------------------
  |  |  352|    453|#define DBG_CACHE  (opt.debug & DBG_CACHE_VALUE)
  |  |  ------------------
  |  |  |  |  338|    453|#define DBG_CACHE_VALUE   64	/* debug the caching */
  |  |  ------------------
  |  |  |  Branch (352:20): [True: 0, False: 453]
  |  |  ------------------
  ------------------
  153|      0|    log_debug ("keydb: kid_not_found_insert (%08lx%08lx)\n",
  154|      0|               (ulong)kid[0], (ulong)kid[1]);
  155|    453|  k = xmalloc (sizeof *k);
  ------------------
  |  |  107|    453|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  156|    453|  k->kid[0] = kid[0];
  157|    453|  k->kid[1] = kid[1];
  158|    453|  k->next = kid_not_found_cache[kid[0] % KID_NOT_FOUND_CACHE_BUCKETS];
  ------------------
  |  |   70|    453|#define KID_NOT_FOUND_CACHE_BUCKETS 256
  ------------------
  159|    453|  kid_not_found_cache[kid[0] % KID_NOT_FOUND_CACHE_BUCKETS] = k;
  ------------------
  |  |   70|    453|#define KID_NOT_FOUND_CACHE_BUCKETS 256
  ------------------
  160|    453|  kid_not_found_stats.count++;
  161|    453|}

sig-check.c:keyid_cmp:
  502|  9.33k|{
  503|  9.33k|  if (a[0] < b[0])
  ------------------
  |  Branch (503:7): [True: 0, False: 9.33k]
  ------------------
  504|      0|    return -1;
  505|  9.33k|  if (a[0] > b[0])
  ------------------
  |  Branch (505:7): [True: 0, False: 9.33k]
  ------------------
  506|      0|    return 1;
  507|  9.33k|  if (a[1] < b[1])
  ------------------
  |  Branch (507:7): [True: 0, False: 9.33k]
  ------------------
  508|      0|    return -1;
  509|  9.33k|  if (a[1] > b[1])
  ------------------
  |  Branch (509:7): [True: 0, False: 9.33k]
  ------------------
  510|      0|    return 1;
  511|  9.33k|  return 0;
  512|  9.33k|}

pubkey_string:
   97|  28.9k|{
   98|  28.9k|  const char *prefix = NULL;
   99|       |
  100|  28.9k|  if (opt.legacy_list_mode)
  ------------------
  |  Branch (100:7): [True: 0, False: 28.9k]
  ------------------
  101|      0|    {
  102|      0|      snprintf (buffer, bufsize, "%4u%c",
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  103|      0|                nbits_from_pk (pk), pubkey_letter (pk->pubkey_algo));
  104|      0|      return buffer;
  105|      0|    }
  106|       |
  107|  28.9k|  switch (pk->pubkey_algo)
  ------------------
  |  Branch (107:11): [True: 18.5k, False: 10.4k]
  ------------------
  108|  28.9k|    {
  109|  1.41k|    case PUBKEY_ALGO_RSA:
  ------------------
  |  Branch (109:5): [True: 1.41k, False: 27.5k]
  ------------------
  110|  1.70k|    case PUBKEY_ALGO_RSA_E:
  ------------------
  |  Branch (110:5): [True: 281, False: 28.6k]
  ------------------
  111|  2.63k|    case PUBKEY_ALGO_RSA_S:	prefix = "rsa"; break;
  ------------------
  |  Branch (111:5): [True: 935, False: 28.0k]
  ------------------
  112|  1.23k|    case PUBKEY_ALGO_ELGAMAL_E: prefix = "elg"; break;
  ------------------
  |  Branch (112:5): [True: 1.23k, False: 27.7k]
  ------------------
  113|  1.30k|    case PUBKEY_ALGO_DSA:	prefix = "dsa"; break;
  ------------------
  |  Branch (113:5): [True: 1.30k, False: 27.6k]
  ------------------
  114|    387|    case PUBKEY_ALGO_ELGAMAL:   prefix = "xxx"; break;
  ------------------
  |  Branch (114:5): [True: 387, False: 28.5k]
  ------------------
  115|    430|    case PUBKEY_ALGO_ECDH:
  ------------------
  |  Branch (115:5): [True: 430, False: 28.5k]
  ------------------
  116|  3.13k|    case PUBKEY_ALGO_ECDSA:
  ------------------
  |  Branch (116:5): [True: 2.70k, False: 26.2k]
  ------------------
  117|  4.89k|    case PUBKEY_ALGO_EDDSA:     prefix = "";    break;
  ------------------
  |  Branch (117:5): [True: 1.76k, False: 27.1k]
  ------------------
  118|  28.9k|    }
  119|       |
  120|  28.9k|  if (prefix && *prefix)
  ------------------
  |  Branch (120:7): [True: 10.4k, False: 18.5k]
  |  Branch (120:17): [True: 5.55k, False: 4.89k]
  ------------------
  121|  5.55k|    snprintf (buffer, bufsize, "%s%u", prefix, nbits_from_pk (pk));
  ------------------
  |  |   84|  5.55k|#define snprintf gpgrt_snprintf
  ------------------
  122|  23.4k|  else if (prefix)
  ------------------
  |  Branch (122:12): [True: 4.89k, False: 18.5k]
  ------------------
  123|  4.89k|    {
  124|  4.89k|      char *curve = openpgp_oid_to_str (pk->pkey[0]);
  125|  4.89k|      const char *name = openpgp_oid_to_curve (curve, 0);
  126|       |
  127|  4.89k|      if (name)
  ------------------
  |  Branch (127:11): [True: 1.45k, False: 3.44k]
  ------------------
  128|  1.45k|        snprintf (buffer, bufsize, "%s", name);
  ------------------
  |  |   84|  1.45k|#define snprintf gpgrt_snprintf
  ------------------
  129|  3.44k|      else if (curve)
  ------------------
  |  Branch (129:16): [True: 3.44k, False: 0]
  ------------------
  130|  3.44k|        snprintf (buffer, bufsize, "E_%s", curve);
  ------------------
  |  |   84|  3.44k|#define snprintf gpgrt_snprintf
  ------------------
  131|      0|      else
  132|      0|        snprintf (buffer, bufsize, "E_error");
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  133|  4.89k|      xfree (curve);
  ------------------
  |  |  104|  4.89k|#define xfree(a)         gcry_free ((a))
  ------------------
  134|  4.89k|    }
  135|  18.5k|  else
  136|  18.5k|    snprintf (buffer, bufsize, "unknown_%u", (unsigned int)pk->pubkey_algo);
  ------------------
  |  |   84|  18.5k|#define snprintf gpgrt_snprintf
  ------------------
  137|       |
  138|  28.9k|  return buffer;
  139|  28.9k|}
hash_public_key:
  146|  47.9k|{
  147|  47.9k|  unsigned int n;
  148|  47.9k|  unsigned int nn[PUBKEY_MAX_NPKEY];
  149|  47.9k|  byte *pp[PUBKEY_MAX_NPKEY];
  150|  47.9k|  int i;
  151|  47.9k|  unsigned int nbits;
  152|  47.9k|  size_t nbytes;
  153|  47.9k|  int npkey = pubkey_get_npkey (pk->pubkey_algo);
  154|  47.9k|  int is_v5 = pk->version == 5;
  155|       |
  156|  47.9k|  n = is_v5? 10 : 6;
  ------------------
  |  Branch (156:7): [True: 576, False: 47.3k]
  ------------------
  157|       |  /* FIXME: We can avoid the extra malloc by calling only the first
  158|       |     mpi_print here which computes the required length and calling the
  159|       |     real mpi_print only at the end.  The speed advantage would only be
  160|       |     for ECC (opaque MPIs) or if we could implement an mpi_print
  161|       |     variant with a callback handler to do the hashing.  */
  162|  47.9k|  if (npkey==0 && pk->pkey[0]
  ------------------
  |  Branch (162:7): [True: 22.7k, False: 25.1k]
  |  Branch (162:19): [True: 14.7k, False: 8.00k]
  ------------------
  163|  47.9k|      && gcry_mpi_get_flag (pk->pkey[0], GCRYMPI_FLAG_OPAQUE))
  ------------------
  |  Branch (163:10): [True: 14.7k, False: 0]
  ------------------
  164|  14.7k|    {
  165|  14.7k|      pp[0] = gcry_mpi_get_opaque (pk->pkey[0], &nbits);
  166|  14.7k|      nn[0] = (nbits+7)/8;
  167|  14.7k|      n+=nn[0];
  168|  14.7k|    }
  169|  33.1k|  else
  170|  33.1k|    {
  171|  93.9k|      for (i=0; i < npkey; i++ )
  ------------------
  |  Branch (171:17): [True: 60.7k, False: 33.1k]
  ------------------
  172|  60.7k|        {
  173|  60.7k|          if (!pk->pkey[i])
  ------------------
  |  Branch (173:15): [True: 0, False: 60.7k]
  ------------------
  174|      0|            {
  175|       |              /* This case may only happen if the parsing of the MPI
  176|       |                 failed but the key was anyway created.  May happen
  177|       |                 during "gpg KEYFILE".  */
  178|      0|              pp[i] = NULL;
  179|      0|              nn[i] = 0;
  180|      0|            }
  181|  60.7k|          else if (gcry_mpi_get_flag (pk->pkey[i], GCRYMPI_FLAG_OPAQUE))
  ------------------
  |  Branch (181:20): [True: 26.5k, False: 34.1k]
  ------------------
  182|  26.5k|            {
  183|  26.5k|              const char *p;
  184|  26.5k|              int is_sos = 0;
  185|       |
  186|  26.5k|              if (gcry_mpi_get_flag (pk->pkey[i], GCRYMPI_FLAG_USER2))
  ------------------
  |  Branch (186:19): [True: 13.0k, False: 13.4k]
  ------------------
  187|  13.0k|                is_sos = 2;
  188|       |
  189|  26.5k|              p = gcry_mpi_get_opaque (pk->pkey[i], &nbits);
  190|  26.5k|              pp[i] = xmalloc ((nbits+7)/8 + is_sos);
  ------------------
  |  |  107|  26.5k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  191|  26.5k|              if (p)
  ------------------
  |  Branch (191:19): [True: 26.5k, False: 0]
  ------------------
  192|  26.5k|                memcpy (pp[i] + is_sos, p, (nbits+7)/8);
  193|      0|              else
  194|      0|                pp[i] = NULL;
  195|  26.5k|              if (is_sos)
  ------------------
  |  Branch (195:19): [True: 13.0k, False: 13.4k]
  ------------------
  196|  13.0k|                {
  197|  13.0k|                  if (*p)
  ------------------
  |  Branch (197:23): [True: 12.5k, False: 514]
  ------------------
  198|  12.5k|                    {
  199|  12.5k|                      nbits = ((nbits + 7) / 8) * 8;
  200|       |
  201|  12.5k|                      if (nbits >= 8 && !(*p & 0x80))
  ------------------
  |  Branch (201:27): [True: 12.5k, False: 0]
  |  Branch (201:41): [True: 12.2k, False: 288]
  ------------------
  202|  12.2k|                        if (--nbits >= 7 && !(*p & 0x40))
  ------------------
  |  Branch (202:29): [True: 12.2k, False: 0]
  |  Branch (202:45): [True: 6.50k, False: 5.75k]
  ------------------
  203|  6.50k|                          if (--nbits >= 6 && !(*p & 0x20))
  ------------------
  |  Branch (203:31): [True: 6.50k, False: 0]
  |  Branch (203:47): [True: 6.35k, False: 147]
  ------------------
  204|  6.35k|                            if (--nbits >= 5 && !(*p & 0x10))
  ------------------
  |  Branch (204:33): [True: 6.35k, False: 0]
  |  Branch (204:49): [True: 5.25k, False: 1.10k]
  ------------------
  205|  5.25k|                              if (--nbits >= 4 && !(*p & 0x08))
  ------------------
  |  Branch (205:35): [True: 5.25k, False: 0]
  |  Branch (205:51): [True: 4.95k, False: 305]
  ------------------
  206|  4.95k|                                if (--nbits >= 3 && !(*p & 0x04))
  ------------------
  |  Branch (206:37): [True: 4.95k, False: 0]
  |  Branch (206:53): [True: 245, False: 4.70k]
  ------------------
  207|    245|                                  if (--nbits >= 2 && !(*p & 0x02))
  ------------------
  |  Branch (207:39): [True: 245, False: 0]
  |  Branch (207:55): [True: 194, False: 51]
  ------------------
  208|    194|                                    if (--nbits >= 1 && !(*p & 0x01))
  ------------------
  |  Branch (208:41): [True: 194, False: 0]
  |  Branch (208:57): [True: 0, False: 194]
  ------------------
  209|      0|                                      --nbits;
  210|  12.5k|                    }
  211|       |
  212|  13.0k|                  pp[i][0] = (nbits >> 8);
  213|  13.0k|                  pp[i][1] = nbits;
  214|  13.0k|                }
  215|  26.5k|              nn[i] = (nbits+7)/8 + is_sos;
  216|  26.5k|              n += nn[i];
  217|  26.5k|            }
  218|  34.1k|          else
  219|  34.1k|            {
  220|  34.1k|              if (gcry_mpi_print (GCRYMPI_FMT_PGP, NULL, 0,
  ------------------
  |  Branch (220:19): [True: 0, False: 34.1k]
  ------------------
  221|  34.1k|                                  &nbytes, pk->pkey[i]))
  222|      0|                BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  223|  34.1k|              pp[i] = xmalloc (nbytes);
  ------------------
  |  |  107|  34.1k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  224|  34.1k|              if (gcry_mpi_print (GCRYMPI_FMT_PGP, pp[i], nbytes,
  ------------------
  |  Branch (224:19): [True: 0, False: 34.1k]
  ------------------
  225|  34.1k|                                  &nbytes, pk->pkey[i]))
  226|      0|                BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  227|  34.1k|              nn[i] = nbytes;
  228|  34.1k|              n += nn[i];
  229|  34.1k|            }
  230|  60.7k|        }
  231|  33.1k|    }
  232|       |
  233|  47.9k|  if (is_v5)
  ------------------
  |  Branch (233:7): [True: 576, False: 47.3k]
  ------------------
  234|    576|    {
  235|    576|      gcry_md_putc ( md, 0x9a );     /* ctb */
  236|    576|      gcry_md_putc ( md, n >> 24 );  /* 4 byte length header */
  237|    576|      gcry_md_putc ( md, n >> 16 );
  238|    576|      gcry_md_putc ( md, n >>  8 );
  239|    576|      gcry_md_putc ( md, n       );
  240|    576|      gcry_md_putc ( md, pk->version );
  241|    576|    }
  242|  47.3k|  else
  243|  47.3k|    {
  244|  47.3k|      gcry_md_putc ( md, 0x99 );     /* ctb */
  245|  47.3k|      gcry_md_putc ( md, n >> 8 );   /* 2 byte length header */
  246|  47.3k|      gcry_md_putc ( md, n );
  247|  47.3k|      gcry_md_putc ( md, pk->version );
  248|  47.3k|    }
  249|  47.9k|  gcry_md_putc ( md, pk->timestamp >> 24 );
  250|  47.9k|  gcry_md_putc ( md, pk->timestamp >> 16 );
  251|  47.9k|  gcry_md_putc ( md, pk->timestamp >>  8 );
  252|  47.9k|  gcry_md_putc ( md, pk->timestamp       );
  253|       |
  254|  47.9k|  gcry_md_putc ( md, pk->pubkey_algo );
  255|       |
  256|  47.9k|  if (is_v5)
  ------------------
  |  Branch (256:7): [True: 576, False: 47.3k]
  ------------------
  257|    576|    {
  258|    576|      n -= 10;
  259|    576|      gcry_md_putc ( md, n >> 24 );
  260|    576|      gcry_md_putc ( md, n >> 16 );
  261|    576|      gcry_md_putc ( md, n >>  8 );
  262|    576|      gcry_md_putc ( md, n       );
  263|    576|    }
  264|       |
  265|  47.9k|  if(npkey==0 && pk->pkey[0]
  ------------------
  |  Branch (265:6): [True: 22.7k, False: 25.1k]
  |  Branch (265:18): [True: 14.7k, False: 8.00k]
  ------------------
  266|  47.9k|     && gcry_mpi_get_flag (pk->pkey[0], GCRYMPI_FLAG_OPAQUE))
  ------------------
  |  Branch (266:9): [True: 14.7k, False: 0]
  ------------------
  267|  14.7k|    {
  268|  14.7k|      if (pp[0])
  ------------------
  |  Branch (268:11): [True: 10.8k, False: 3.92k]
  ------------------
  269|  10.8k|        gcry_md_write (md, pp[0], nn[0]);
  270|  14.7k|    }
  271|  33.1k|  else
  272|  33.1k|    {
  273|  93.9k|      for(i=0; i < npkey; i++ )
  ------------------
  |  Branch (273:16): [True: 60.7k, False: 33.1k]
  ------------------
  274|  60.7k|        {
  275|  60.7k|          if (pp[i])
  ------------------
  |  Branch (275:15): [True: 60.7k, False: 0]
  ------------------
  276|  60.7k|            gcry_md_write ( md, pp[i], nn[i] );
  277|  60.7k|          xfree(pp[i]);
  ------------------
  |  |  104|  60.7k|#define xfree(a)         gcry_free ((a))
  ------------------
  278|  60.7k|        }
  279|  33.1k|    }
  280|  47.9k|}
pk_keyid:
  314|  9.33k|{
  315|  9.33k|  keyid_from_pk (pk, NULL);
  316|       |
  317|       |  /* Uncomment this for help tracking down bugs related to keyid or
  318|       |     main_keyid not being set correctly.  */
  319|       |#if 0
  320|       |  if (! (pk->main_keyid[0] || pk->main_keyid[1]))
  321|       |    log_bug ("pk->main_keyid not set!\n");
  322|       |  if (keyid_cmp (pk->keyid, pk->main_keyid) == 0
  323|       |      && ! pk->flags.primary)
  324|       |    log_bug ("keyid and main_keyid are the same, but primary flag not set!\n");
  325|       |  if (keyid_cmp (pk->keyid, pk->main_keyid) != 0
  326|       |      && pk->flags.primary)
  327|       |    log_bug ("keyid and main_keyid are different, but primary flag set!\n");
  328|       |#endif
  329|       |
  330|  9.33k|  return pk->keyid;
  331|  9.33k|}
format_keyid:
  359|  45.9k|{
  360|  45.9k|  if (! buffer)
  ------------------
  |  Branch (360:7): [True: 0, False: 45.9k]
  ------------------
  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|  45.9k|  if (format == KF_DEFAULT)
  ------------------
  |  Branch (368:7): [True: 0, False: 45.9k]
  ------------------
  369|      0|    format = opt.keyid_format;
  370|  45.9k|  if (format == KF_DEFAULT)
  ------------------
  |  Branch (370:7): [True: 0, False: 45.9k]
  ------------------
  371|      0|    format = KF_NONE;
  372|       |
  373|  45.9k|  switch (format)
  374|  45.9k|    {
  375|      0|    case KF_NONE:
  ------------------
  |  Branch (375:5): [True: 0, False: 45.9k]
  ------------------
  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: 45.9k]
  ------------------
  381|      0|      snprintf (buffer, len, "%08lX", (ulong)keyid[1]);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  382|      0|      break;
  383|       |
  384|  45.9k|    case KF_LONG:
  ------------------
  |  Branch (384:5): [True: 45.9k, False: 0]
  ------------------
  385|  45.9k|      snprintf (buffer, len, "%08lX%08lX", (ulong)keyid[0], (ulong)keyid[1]);
  ------------------
  |  |   84|  45.9k|#define snprintf gpgrt_snprintf
  ------------------
  386|  45.9k|      break;
  387|       |
  388|      0|    case KF_0xSHORT:
  ------------------
  |  Branch (388:5): [True: 0, False: 45.9k]
  ------------------
  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: 45.9k]
  ------------------
  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: 45.9k]
  ------------------
  397|      0|      BUG();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  398|  45.9k|    }
  399|       |
  400|  45.9k|  return buffer;
  401|  45.9k|}
keystrlen:
  405|  29.4k|{
  406|  29.4k|  int format = opt.keyid_format;
  407|  29.4k|  if (format == KF_DEFAULT)
  ------------------
  |  Branch (407:7): [True: 29.4k, False: 0]
  ------------------
  408|  29.4k|    format = KF_NONE;
  409|       |
  410|  29.4k|  switch(format)
  411|  29.4k|    {
  412|  29.4k|    case KF_NONE:
  ------------------
  |  Branch (412:5): [True: 29.4k, False: 0]
  ------------------
  413|  29.4k|      return 0;
  414|       |
  415|      0|    case KF_SHORT:
  ------------------
  |  Branch (415:5): [True: 0, False: 29.4k]
  ------------------
  416|      0|      return 8;
  417|       |
  418|      0|    case KF_LONG:
  ------------------
  |  Branch (418:5): [True: 0, False: 29.4k]
  ------------------
  419|      0|      return 16;
  420|       |
  421|      0|    case KF_0xSHORT:
  ------------------
  |  Branch (421:5): [True: 0, False: 29.4k]
  ------------------
  422|      0|      return 10;
  423|       |
  424|      0|    case KF_0xLONG:
  ------------------
  |  Branch (424:5): [True: 0, False: 29.4k]
  ------------------
  425|      0|      return 18;
  426|       |
  427|      0|    default:
  ------------------
  |  Branch (427:5): [True: 0, False: 29.4k]
  ------------------
  428|      0|      BUG();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  429|  29.4k|    }
  430|  29.4k|}
keystr:
  435|  45.9k|{
  436|  45.9k|  static char keyid_str[KEYID_STR_SIZE];
  437|  45.9k|  int format = opt.keyid_format;
  438|       |
  439|  45.9k|  if (format == KF_DEFAULT)
  ------------------
  |  Branch (439:7): [True: 45.9k, False: 0]
  ------------------
  440|  45.9k|    format = KF_NONE;
  441|  45.9k|  if (format == KF_NONE)
  ------------------
  |  Branch (441:7): [True: 45.9k, False: 0]
  ------------------
  442|  45.9k|    format = KF_LONG;
  443|       |
  444|  45.9k|  return format_keyid (keyid, format, keyid_str, sizeof (keyid_str));
  445|  45.9k|}
keystr_from_pk:
  472|  30.0k|{
  473|  30.0k|  keyid_from_pk(pk,NULL);
  474|       |
  475|  30.0k|  return keystr(pk->keyid);
  476|  30.0k|}
keyid_from_pk:
  572|  70.9k|{
  573|  70.9k|  u32 dummy_keyid[2];
  574|       |
  575|  70.9k|  if (!keyid)
  ------------------
  |  Branch (575:7): [True: 40.8k, False: 30.1k]
  ------------------
  576|  40.8k|    keyid = dummy_keyid;
  577|       |
  578|  70.9k|  if (!pk->fprlen)
  ------------------
  |  Branch (578:7): [True: 29.7k, False: 41.2k]
  ------------------
  579|  29.7k|    compute_fingerprint (pk);
  580|       |
  581|  70.9k|  keyid[0] = pk->keyid[0];
  582|  70.9k|  keyid[1] = pk->keyid[1];
  583|       |
  584|  70.9k|  if (pk->fprlen == 32)
  ------------------
  |  Branch (584:7): [True: 1.28k, False: 69.7k]
  ------------------
  585|  1.28k|    return keyid[0];
  586|  69.7k|  else
  587|  69.7k|    return keyid[1];
  588|  70.9k|}
keyid_from_fingerprint:
  599|  1.61k|{
  600|  1.61k|  u32 dummy_keyid[2];
  601|       |
  602|  1.61k|  if( !keyid )
  ------------------
  |  Branch (602:7): [True: 0, False: 1.61k]
  ------------------
  603|      0|    keyid = dummy_keyid;
  604|       |
  605|  1.61k|  if (fprint_len != 20 && fprint_len != 32)
  ------------------
  |  Branch (605:7): [True: 0, False: 1.61k]
  |  Branch (605:27): [True: 0, False: 0]
  ------------------
  606|      0|    {
  607|       |      /* This is special as we have to lookup the key first.  */
  608|      0|      PKT_public_key pk;
  609|      0|      int rc;
  610|       |
  611|      0|      memset (&pk, 0, sizeof pk);
  612|      0|      rc = get_pubkey_byfprint (ctrl, &pk, NULL, fprint, fprint_len);
  613|      0|      if( rc )
  ------------------
  |  Branch (613:11): [True: 0, False: 0]
  ------------------
  614|      0|        {
  615|      0|          log_printhex (fprint, fprint_len,
  616|      0|                        "Oops: keyid_from_fingerprint: no pubkey; fpr:");
  617|      0|          keyid[0] = 0;
  618|      0|          keyid[1] = 0;
  619|      0|        }
  620|      0|      else
  621|      0|        keyid_from_pk (&pk, keyid);
  622|      0|    }
  623|  1.61k|  else
  624|  1.61k|    {
  625|  1.61k|      const byte *dp = fprint;
  626|  1.61k|      if (fprint_len == 20)  /* v4 key */
  ------------------
  |  Branch (626:11): [True: 1.61k, False: 0]
  ------------------
  627|  1.61k|        {
  628|  1.61k|          keyid[0] = buf32_to_u32 (dp+12);
  629|  1.61k|          keyid[1] = buf32_to_u32 (dp+16);
  630|  1.61k|        }
  631|      0|      else  /* v5 key */
  632|      0|        {
  633|      0|          keyid[0] = buf32_to_u32 (dp);
  634|      0|          keyid[1] = buf32_to_u32 (dp+4);
  635|      0|        }
  636|  1.61k|    }
  637|       |
  638|  1.61k|  return keyid[1];
  639|  1.61k|}
nbits_from_pk:
  676|  5.55k|{
  677|  5.55k|    return pubkey_nbits (pk->pubkey_algo, pk->pkey);
  678|  5.55k|}
mk_datestr:
  686|  31.7k|{
  687|  31.7k|  time_t atime = timestamp;
  688|  31.7k|  struct tm *tp;
  689|       |
  690|  31.7k|  if (IS_INVALID_TIME_T (atime))
  ------------------
  |  |   47|  31.7k|# define IS_INVALID_TIME_T(a) ((a) < 0)
  |  |  ------------------
  |  |  |  Branch (47:31): [True: 0, False: 31.7k]
  |  |  ------------------
  ------------------
  691|      0|    strcpy (buffer, "????" "-??" "-??"); /* Mark this as invalid. */
  692|  31.7k|  else
  693|  31.7k|    {
  694|  31.7k|      tp = gmtime (&atime);
  695|  31.7k|      snprintf (buffer, bufsize, "%04d-%02d-%02d",
  ------------------
  |  |   84|  31.7k|#define snprintf gpgrt_snprintf
  ------------------
  696|  31.7k|                1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday );
  697|  31.7k|    }
  698|  31.7k|  return buffer;
  699|  31.7k|}
dateonlystr_from_pk:
  709|  28.9k|{
  710|  28.9k|  static char buffer[MK_DATESTR_SIZE];
  711|       |
  712|  28.9k|  return mk_datestr (buffer, sizeof buffer, pk->timestamp);
  713|  28.9k|}
datestr_from_pk:
  721|  28.9k|{
  722|  28.9k|  if (opt.flags.full_timestrings)
  ------------------
  |  Branch (722:7): [True: 0, False: 28.9k]
  ------------------
  723|      0|    return isotimestamp (pk->timestamp);
  724|  28.9k|  else
  725|  28.9k|    return dateonlystr_from_pk (pk);
  726|  28.9k|}
expirestr_from_pk:
  749|  2.06k|{
  750|  2.06k|  static char buffer[MK_DATESTR_SIZE];
  751|       |
  752|  2.06k|  if (!pk->expiredate)
  ------------------
  |  Branch (752:7): [True: 0, False: 2.06k]
  ------------------
  753|      0|    return _("never     ");
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  754|       |
  755|  2.06k|  if (opt.flags.full_timestrings)
  ------------------
  |  Branch (755:7): [True: 0, False: 2.06k]
  ------------------
  756|      0|    return isotimestamp (pk->expiredate);
  757|       |
  758|  2.06k|  return mk_datestr (buffer, sizeof buffer, pk->expiredate);
  759|  2.06k|}
revokestr_from_pk:
  779|    712|{
  780|    712|  static char buffer[MK_DATESTR_SIZE];
  781|       |
  782|    712|  if(!pk->revoked.date)
  ------------------
  |  Branch (782:6): [True: 0, False: 712]
  ------------------
  783|      0|    return _("never     ");
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  784|       |
  785|    712|  if (opt.flags.full_timestrings)
  ------------------
  |  Branch (785:7): [True: 0, False: 712]
  ------------------
  786|      0|    return isotimestamp (pk->revoked.date);
  787|       |
  788|    712|  return mk_datestr (buffer, sizeof buffer, pk->revoked.date);
  789|    712|}
hexfingerprint:
  932|  19.3k|{
  933|  19.3k|  if (!pk->fprlen)
  ------------------
  |  Branch (933:7): [True: 0, False: 19.3k]
  ------------------
  934|      0|    compute_fingerprint (pk);
  935|       |
  936|  19.3k|  if (!buffer)
  ------------------
  |  Branch (936:7): [True: 0, False: 19.3k]
  ------------------
  937|      0|    {
  938|      0|      buffer = xtrymalloc (2 * pk->fprlen + 1);
  ------------------
  |  |   97|      0|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  939|      0|      if (!buffer)
  ------------------
  |  Branch (939:11): [True: 0, False: 0]
  ------------------
  940|      0|        return NULL;
  941|      0|    }
  942|  19.3k|  else if (buflen < 2 * pk->fprlen + 1)
  ------------------
  |  Branch (942:12): [True: 0, False: 19.3k]
  ------------------
  943|      0|    log_fatal ("%s: buffer too short (%zu)\n", __func__, buflen);
  944|       |
  945|  19.3k|  bin2hex (pk->fpr, pk->fprlen, buffer);
  946|  19.3k|  return buffer;
  947|  19.3k|}
keyid.c:compute_fingerprint:
  538|  29.7k|{
  539|  29.7k|  const byte *dp;
  540|  29.7k|  gcry_md_hd_t md;
  541|  29.7k|  size_t len;
  542|       |
  543|  29.7k|  if (gcry_md_open (&md, pk->version == 5 ? GCRY_MD_SHA256 : GCRY_MD_SHA1, 0))
  ------------------
  |  Branch (543:7): [True: 0, False: 29.7k]
  |  Branch (543:26): [True: 576, False: 29.1k]
  ------------------
  544|      0|    BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  545|  29.7k|  hash_public_key (md, pk);
  546|  29.7k|  gcry_md_final (md);
  547|  29.7k|  dp = gcry_md_read (md, 0);
  548|  29.7k|  len = gcry_md_get_algo_dlen (gcry_md_get_algo (md));
  549|  29.7k|  log_assert (len <= MAX_FINGERPRINT_LEN);
  550|      0|  memcpy (pk->fpr, dp, len);
  551|  29.7k|  pk->fprlen = len;
  552|  29.7k|  if (pk->version == 5)
  ------------------
  |  Branch (552:7): [True: 576, False: 29.1k]
  ------------------
  553|    576|    {
  554|    576|      pk->keyid[0] = buf32_to_u32 (dp);
  555|    576|      pk->keyid[1] = buf32_to_u32 (dp+4);
  556|    576|    }
  557|  29.1k|  else
  558|  29.1k|    {
  559|  29.1k|      pk->keyid[0] = buf32_to_u32 (dp+12);
  560|  29.1k|      pk->keyid[1] = buf32_to_u32 (dp+16);
  561|  29.1k|    }
  562|  29.7k|  gcry_md_close( md);
  563|  29.7k|}

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|}
print_fingerprint:
 2310|  19.3k|{
 2311|  19.3k|  char hexfpr[2*MAX_FINGERPRINT_LEN+1];
 2312|  19.3k|  char *p;
 2313|  19.3k|  size_t i;
 2314|  19.3k|  estream_t fp;
 2315|  19.3k|  const char *text;
 2316|  19.3k|  int primary = 0;
 2317|  19.3k|  int with_colons = opt.with_colons;
 2318|  19.3k|  int with_icao   = opt.with_icao_spelling;
 2319|  19.3k|  int compact = 0;
 2320|       |
 2321|  19.3k|  if (mode == 10)
  ------------------
  |  Branch (2321:7): [True: 0, False: 19.3k]
  ------------------
 2322|      0|    {
 2323|      0|      mode = 0;
 2324|      0|      with_colons = 0;
 2325|      0|      with_icao = 0;
 2326|      0|    }
 2327|  19.3k|  else if (mode == 20)
  ------------------
  |  Branch (2327:12): [True: 19.3k, False: 0]
  ------------------
 2328|  19.3k|    {
 2329|  19.3k|      mode = 0;
 2330|  19.3k|      with_colons = 0;
 2331|  19.3k|      compact = 1;
 2332|  19.3k|    }
 2333|       |
 2334|  19.3k|  if (!opt.fingerprint && !opt.with_fingerprint
  ------------------
  |  Branch (2334:7): [True: 19.3k, False: 0]
  |  Branch (2334:27): [True: 19.3k, False: 0]
  ------------------
 2335|  19.3k|      && opt.with_subkey_fingerprint)
  ------------------
  |  Branch (2335:10): [True: 0, False: 19.3k]
  ------------------
 2336|      0|    compact = 1;
 2337|       |
 2338|  19.3k|  if (pk->main_keyid[0] == pk->keyid[0]
  ------------------
  |  Branch (2338:7): [True: 19.3k, False: 0]
  ------------------
 2339|  19.3k|      && pk->main_keyid[1] == pk->keyid[1])
  ------------------
  |  Branch (2339:10): [True: 19.3k, False: 0]
  ------------------
 2340|  19.3k|    primary = 1;
 2341|       |
 2342|       |  /* Just to be safe */
 2343|  19.3k|  if ((mode & 0x80) && !primary)
  ------------------
  |  Branch (2343:7): [True: 0, False: 19.3k]
  |  Branch (2343:24): [True: 0, False: 0]
  ------------------
 2344|      0|    {
 2345|      0|      log_error ("primary key is not really primary!\n");
 2346|      0|      return;
 2347|      0|    }
 2348|       |
 2349|  19.3k|  mode &= ~0x80;
 2350|       |
 2351|  19.3k|  if (!primary && (mode == 1 || mode == 2))
  ------------------
  |  Branch (2351:7): [True: 0, False: 19.3k]
  |  Branch (2351:20): [True: 0, False: 0]
  |  Branch (2351:33): [True: 0, False: 0]
  ------------------
 2352|      0|    {
 2353|      0|      PKT_public_key *primary_pk = xmalloc_clear (sizeof (*primary_pk));
  ------------------
  |  |  116|      0|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
 2354|      0|      get_pubkey (ctrl, primary_pk, pk->main_keyid);
 2355|      0|      print_fingerprint (ctrl, override_fp, primary_pk, (mode | 0x80));
 2356|      0|      free_public_key (primary_pk);
 2357|      0|    }
 2358|       |
 2359|  19.3k|  if (mode == 1)
  ------------------
  |  Branch (2359:7): [True: 0, False: 19.3k]
  ------------------
 2360|      0|    {
 2361|      0|      fp = log_get_stream ();
 2362|      0|      if (primary)
  ------------------
  |  Branch (2362:11): [True: 0, False: 0]
  ------------------
 2363|      0|	text = _("Primary key fingerprint:");
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2364|      0|      else
 2365|      0|	text = _("     Subkey fingerprint:");
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2366|      0|    }
 2367|  19.3k|  else if (mode == 2)
  ------------------
  |  Branch (2367:12): [True: 0, False: 19.3k]
  ------------------
 2368|      0|    {
 2369|      0|      fp = override_fp; /* Use tty or given stream.  */
 2370|      0|      if (primary)
  ------------------
  |  Branch (2370:11): [True: 0, False: 0]
  ------------------
 2371|       |	/* TRANSLATORS: this should fit into 24 bytes so that the
 2372|       |	 * fingerprint data is properly aligned with the user ID */
 2373|      0|	text = _(" Primary key fingerprint:");
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2374|      0|      else
 2375|      0|	text = _("      Subkey fingerprint:");
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2376|      0|    }
 2377|  19.3k|  else if (mode == 3)
  ------------------
  |  Branch (2377:12): [True: 0, False: 19.3k]
  ------------------
 2378|      0|    {
 2379|      0|      fp = override_fp; /* Use tty or given stream.  */
 2380|      0|      text = _("      Key fingerprint =");
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2381|      0|    }
 2382|  19.3k|  else if (mode == 4)
  ------------------
  |  Branch (2382:12): [True: 0, False: 19.3k]
  ------------------
 2383|      0|    {
 2384|      0|      fp = override_fp; /* Use tty or given stream.  */
 2385|      0|      text = _("      Subkey fingerprint:");
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2386|      0|    }
 2387|  19.3k|  else
 2388|  19.3k|    {
 2389|  19.3k|      fp = override_fp? override_fp : es_stdout;
  ------------------
  |  Branch (2389:12): [True: 19.3k, False: 0]
  ------------------
 2390|  19.3k|      if (opt.keyid_format == KF_NONE)
  ------------------
  |  Branch (2390:11): [True: 0, False: 19.3k]
  ------------------
 2391|      0|        {
 2392|      0|          text = "     ";  /* To indent ICAO spelling.  */
 2393|      0|          compact = 1;
 2394|      0|        }
 2395|  19.3k|      else
 2396|  19.3k|        text = _("      Key fingerprint =");
  ------------------
  |  |   28|  19.3k|#  define _(a) gettext (a)
  ------------------
 2397|  19.3k|    }
 2398|       |
 2399|  19.3k|  hexfingerprint (pk, hexfpr, sizeof hexfpr);
 2400|  19.3k|  if (with_colons && !mode)
  ------------------
  |  Branch (2400:7): [True: 0, False: 19.3k]
  |  Branch (2400:22): [True: 0, False: 0]
  ------------------
 2401|      0|    {
 2402|      0|      es_fprintf (fp, "fpr:::::::::%s:", hexfpr);
 2403|      0|    }
 2404|  19.3k|  else if (compact && !opt.fingerprint && !opt.with_fingerprint)
  ------------------
  |  Branch (2404:12): [True: 19.3k, False: 0]
  |  Branch (2404:23): [True: 19.3k, False: 0]
  |  Branch (2404:43): [True: 19.3k, False: 0]
  ------------------
 2405|  19.3k|    {
 2406|  19.3k|      tty_fprintf (fp, "%*s%s", 6, "", hexfpr);
 2407|  19.3k|    }
 2408|      0|  else
 2409|      0|    {
 2410|      0|      char fmtfpr[MAX_FORMATTED_FINGERPRINT_LEN + 1];
 2411|      0|      format_hexfingerprint (hexfpr, fmtfpr, sizeof fmtfpr);
 2412|      0|      if (compact)
  ------------------
  |  Branch (2412:11): [True: 0, False: 0]
  ------------------
 2413|      0|        tty_fprintf (fp, "%*s%s", 6, "", fmtfpr);
 2414|      0|      else
 2415|      0|        tty_fprintf (fp, "%s %s", text, fmtfpr);
 2416|      0|    }
 2417|  19.3k|  tty_fprintf (fp, "\n");
 2418|  19.3k|  if (!with_colons && with_icao)
  ------------------
  |  Branch (2418:7): [True: 19.3k, False: 0]
  |  Branch (2418:23): [True: 0, False: 19.3k]
  ------------------
 2419|      0|    {
 2420|      0|      ;
 2421|      0|      tty_fprintf (fp, "%*s\"", (int)strlen(text)+1, "");
 2422|      0|      for (i = 0, p = hexfpr; *p; i++, p++)
  ------------------
  |  Branch (2422:31): [True: 0, False: 0]
  ------------------
 2423|      0|        {
 2424|      0|          if (!i)
  ------------------
  |  Branch (2424:15): [True: 0, False: 0]
  ------------------
 2425|      0|            ;
 2426|      0|          else if (!(i%10))
  ------------------
  |  Branch (2426:20): [True: 0, False: 0]
  ------------------
 2427|      0|            tty_fprintf (fp, "\n%*s ", (int)strlen(text)+1, "");
 2428|      0|          else if (!(i%5))
  ------------------
  |  Branch (2428:20): [True: 0, False: 0]
  ------------------
 2429|      0|            tty_fprintf (fp, "  ");
 2430|      0|          else
 2431|      0|            tty_fprintf (fp, " ");
 2432|      0|          print_icao_hexdigit (fp, xtoi_1 (p));
  ------------------
  |  |  423|      0|#define xtoi_1(p)   (*(p) <= '9'? (*(p)- '0'): \
  |  |  ------------------
  |  |  |  Branch (423:22): [True: 0, False: 0]
  |  |  ------------------
  |  |  424|      0|                     *(p) <= 'F'? (*(p)-'A'+10):(*(p)-'a'+10))
  |  |  ------------------
  |  |  |  Branch (424:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2433|      0|        }
 2434|      0|      tty_fprintf (fp, "\"\n");
 2435|      0|    }
 2436|  19.3k|}
print_key_line:
 2480|  28.9k|{
 2481|  28.9k|  char pkstrbuf[PUBKEY_STRING_SIZE];
 2482|       |
 2483|  28.9k|  tty_fprintf (fp, "%s%c  %s",
 2484|  28.9k|               pk->flags.primary? (secret? "sec":"pub")
  ------------------
  |  Branch (2484:16): [True: 19.3k, False: 9.65k]
  |  Branch (2484:36): [True: 0, False: 19.3k]
  ------------------
 2485|  28.9k|               /**/             : (secret? "ssb":"sub"),
  ------------------
  |  Branch (2485:36): [True: 0, False: 9.65k]
  ------------------
 2486|  28.9k|               secret == 2? '#' : secret == 3? '>' : ' ',
  ------------------
  |  Branch (2486:16): [True: 0, False: 28.9k]
  |  Branch (2486:35): [True: 0, False: 28.9k]
  ------------------
 2487|  28.9k|               pubkey_string (pk, pkstrbuf, sizeof pkstrbuf));
 2488|  28.9k|  if (opt.keyid_format != KF_NONE)
  ------------------
  |  Branch (2488:7): [True: 28.9k, False: 0]
  ------------------
 2489|  28.9k|    tty_fprintf (fp, "/%s", keystr_from_pk (pk));
 2490|  28.9k|  tty_fprintf (fp, " %s", datestr_from_pk (pk));
 2491|       |
 2492|  28.9k|  if (pk->flags.primary
  ------------------
  |  Branch (2492:7): [True: 19.3k, False: 9.65k]
  ------------------
 2493|  28.9k|      && !(openpgp_pk_algo_usage (pk->pubkey_algo)
  ------------------
  |  Branch (2493:10): [True: 13.2k, False: 6.02k]
  ------------------
 2494|  19.3k|           & (PUBKEY_USAGE_CERT| PUBKEY_USAGE_SIG|PUBKEY_USAGE_AUTH)))
  ------------------
  |  |   51|  19.3k|#define PUBKEY_USAGE_CERT    GCRY_PK_USAGE_CERT  /* Also good to certify keys.*/
  ------------------
                         & (PUBKEY_USAGE_CERT| PUBKEY_USAGE_SIG|PUBKEY_USAGE_AUTH)))
  ------------------
  |  |   49|  19.3k|#define PUBKEY_USAGE_SIG     GCRY_PK_USAGE_SIGN  /* Good for signatures. */
  ------------------
                         & (PUBKEY_USAGE_CERT| PUBKEY_USAGE_SIG|PUBKEY_USAGE_AUTH)))
  ------------------
  |  |   52|  19.3k|#define PUBKEY_USAGE_AUTH    GCRY_PK_USAGE_AUTH  /* Good for authentication. */
  ------------------
 2495|  13.2k|    {
 2496|       |      /* A primary key which is really not capable to sign.  */
 2497|  13.2k|      tty_fprintf (fp, " [INVALID_ALGO]");
 2498|  13.2k|    }
 2499|  15.6k|  else if ((opt.list_options & LIST_SHOW_USAGE))
  ------------------
  |  |  424|  15.6k|#define LIST_SHOW_USAGE                  (1<<11)
  ------------------
  |  Branch (2499:12): [True: 0, False: 15.6k]
  ------------------
 2500|      0|    {
 2501|      0|      tty_fprintf (fp, " [%s]", usagestr_from_pk (pk, 0));
 2502|      0|    }
 2503|       |
 2504|  28.9k|  if (pk->flags.revoked)
  ------------------
  |  Branch (2504:7): [True: 712, False: 28.2k]
  ------------------
 2505|    712|    {
 2506|    712|      tty_fprintf (fp, " [");
 2507|    712|      tty_fprintf (fp, _("revoked: %s"), revokestr_from_pk (pk));
  ------------------
  |  |   28|    712|#  define _(a) gettext (a)
  ------------------
 2508|    712|      tty_fprintf (fp, "]");
 2509|    712|    }
 2510|  28.2k|  else if (pk->has_expired)
  ------------------
  |  Branch (2510:12): [True: 1.40k, False: 26.8k]
  ------------------
 2511|  1.40k|    {
 2512|  1.40k|      tty_fprintf (fp, " [");
 2513|  1.40k|      tty_fprintf (fp, _("expired: %s"), expirestr_from_pk (pk));
  ------------------
  |  |   28|  1.40k|#  define _(a) gettext (a)
  ------------------
 2514|  1.40k|      tty_fprintf (fp, "]");
 2515|  1.40k|    }
 2516|  26.8k|  else if (pk->expiredate)
  ------------------
  |  Branch (2516:12): [True: 657, False: 26.1k]
  ------------------
 2517|    657|    {
 2518|    657|      tty_fprintf (fp, " [");
 2519|    657|      tty_fprintf (fp, _("expires: %s"), expirestr_from_pk (pk));
  ------------------
  |  |   28|    657|#  define _(a) gettext (a)
  ------------------
 2520|    657|      tty_fprintf (fp, "]");
 2521|    657|    }
 2522|       |
 2523|       |#if 0
 2524|       |  /* I need to think about this some more.  It's easy enough to
 2525|       |     include, but it looks sort of confusing in the listing... */
 2526|       |  if (opt.list_options & LIST_SHOW_VALIDITY)
 2527|       |    {
 2528|       |      int validity = get_validity (ctrl, pk, NULL, NULL, 0);
 2529|       |      tty_fprintf (fp, " [%s]", trust_value_to_string (validity));
 2530|       |    }
 2531|       |#endif
 2532|       |
 2533|  28.9k|  if (pk->pubkey_algo >= 100)
  ------------------
  |  Branch (2533:7): [True: 9.87k, False: 19.0k]
  ------------------
 2534|  9.87k|    tty_fprintf (fp, " [experimental algorithm %d]", pk->pubkey_algo);
 2535|       |
 2536|  28.9k|  tty_fprintf (fp, "\n");
 2537|       |
 2538|       |  /* if the user hasn't explicitly asked for human-readable
 2539|       |     fingerprints, show compact fpr of primary key: */
 2540|  28.9k|  if (pk->flags.primary &&
  ------------------
  |  Branch (2540:7): [True: 19.3k, False: 9.65k]
  ------------------
 2541|  28.9k|      !opt.fingerprint && !opt.with_fingerprint)
  ------------------
  |  Branch (2541:7): [True: 19.3k, False: 0]
  |  Branch (2541:27): [True: 19.3k, False: 0]
  ------------------
 2542|  19.3k|    print_fingerprint (ctrl, fp, pk, 20);
 2543|  28.9k|}
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|  8.53k|{
  131|  8.53k|  literals_seen = 0;
  132|  8.53k|}
proc_packets:
 1494|  96.8k|{
 1495|  96.8k|  int rc;
 1496|  96.8k|  CTX c = xmalloc_clear (sizeof *c);
  ------------------
  |  |  116|  96.8k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
 1497|       |
 1498|  96.8k|  c->ctrl = ctrl;
 1499|  96.8k|  c->anchor = anchor;
 1500|  96.8k|  rc = do_proc_packets (c, a);
 1501|  96.8k|  xfree (c);
  ------------------
  |  |  104|  96.8k|#define xfree(a)         gcry_free ((a))
  ------------------
 1502|       |
 1503|  96.8k|  return rc;
 1504|  96.8k|}
proc_encryption_packets:
 1592|  61.9k|{
 1593|  61.9k|  CTX c = xmalloc_clear (sizeof *c);
  ------------------
  |  |  116|  61.9k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
 1594|  61.9k|  int rc;
 1595|       |
 1596|  61.9k|  c->ctrl = ctrl;
 1597|  61.9k|  c->anchor = anchor;
 1598|  61.9k|  c->encrypt_only = 1;
 1599|  61.9k|  rc = do_proc_packets (c, a);
 1600|  61.9k|  xfree (c);
  ------------------
  |  |  104|  61.9k|#define xfree(a)         gcry_free ((a))
  ------------------
 1601|  61.9k|  return rc;
 1602|  61.9k|}
issuer_fpr_raw:
 1809|  13.9k|{
 1810|  13.9k|  const byte *p;
 1811|  13.9k|  size_t n;
 1812|       |
 1813|  13.9k|  p = parse_sig_subpkt (sig, 1, SIGSUBPKT_ISSUER_FPR, &n);
 1814|  13.9k|  if (p && ((n == 21 && p[0] == 4) || (n == 33 && p[0] == 5)))
  ------------------
  |  Branch (1814:7): [True: 2.96k, False: 11.0k]
  |  Branch (1814:14): [True: 1.24k, False: 1.72k]
  |  Branch (1814:25): [True: 1.17k, False: 70]
  |  Branch (1814:40): [True: 1.72k, False: 72]
  |  Branch (1814:51): [True: 508, False: 1.21k]
  ------------------
 1815|  1.68k|    {
 1816|  1.68k|      *r_len = n - 1;
 1817|  1.68k|      return p+1;
 1818|  1.68k|    }
 1819|  12.3k|  *r_len = 0;
 1820|  12.3k|  return NULL;
 1821|  13.9k|}
issuer_fpr_string:
 1829|  11.0k|{
 1830|  11.0k|  const byte *p;
 1831|  11.0k|  size_t n;
 1832|       |
 1833|  11.0k|  p = issuer_fpr_raw (sig, &n);
 1834|  11.0k|  return p? bin2hex (p, n, NULL) : NULL;
  ------------------
  |  Branch (1834:10): [True: 856, False: 10.1k]
  ------------------
 1835|  11.0k|}
mainproc.c:do_proc_packets:
 1626|   158k|{
 1627|   158k|  PACKET *pkt;
 1628|   158k|  struct parse_packet_ctx_s parsectx;
 1629|   158k|  int rc = 0;
 1630|   158k|  int any_data = 0;
 1631|   158k|  int newpkt;
 1632|       |
 1633|   158k|  rc = check_nesting (c);
 1634|   158k|  if (rc)
  ------------------
  |  Branch (1634:7): [True: 8, False: 158k]
  ------------------
 1635|      8|    return rc;
 1636|       |
 1637|   158k|  pkt = xmalloc( sizeof *pkt );
  ------------------
  |  |  107|   158k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 1638|   158k|  c->iobuf = a;
 1639|   158k|  init_packet(pkt);
  ------------------
  |  |  581|   158k|#define init_packet(a) do { (a)->pkttype = 0;		\
  |  |  582|   158k|			    (a)->pkt.generic = NULL;	\
  |  |  583|   158k|		       } while(0)
  |  |  ------------------
  |  |  |  Branch (583:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1640|   158k|  init_parse_packet (&parsectx, a);
  ------------------
  |  |  666|   158k|#define init_parse_packet(a,i) do { \
  |  |  667|   158k|    (a)->inp = (i);                 \
  |  |  668|   158k|    (a)->last_pkt.pkttype = 0;      \
  |  |  669|   158k|    (a)->last_pkt.pkt.generic= NULL;\
  |  |  670|   158k|    (a)->free_last_pkt = 0;         \
  |  |  671|   158k|    (a)->skip_meta = 0;             \
  |  |  672|   158k|    (a)->n_parsed_packets = 0;      \
  |  |  673|   158k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (673:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1641|   723k|  while ((rc=parse_packet (&parsectx, pkt)) != -1)
  ------------------
  |  |  697|   723k|	     dbg_parse_packet( (a), (b), __FILE__, __LINE__ )
  ------------------
  |  Branch (1641:10): [True: 706k, False: 16.3k]
  ------------------
 1642|   706k|    {
 1643|   706k|      any_data = 1;
 1644|   706k|      if (rc)
  ------------------
  |  Branch (1644:11): [True: 148k, False: 558k]
  ------------------
 1645|   148k|        {
 1646|   148k|          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|   148k|          if (gpg_err_code (rc) == GPG_ERR_INV_PACKET
  ------------------
  |  Branch (1649:15): [True: 135k, False: 12.8k]
  ------------------
 1650|   148k|              && opt.list_packets == 0)
  ------------------
  |  Branch (1650:18): [True: 135k, False: 0]
  ------------------
 1651|   135k|            break;
 1652|  12.8k|          continue;
 1653|   148k|	}
 1654|   558k|      newpkt = -1;
 1655|   558k|      if (opt.list_packets)
  ------------------
  |  Branch (1655:11): [True: 0, False: 558k]
  ------------------
 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|   558k|      else if (c->sigs_only)
  ------------------
  |  Branch (1668:16): [True: 0, False: 558k]
  ------------------
 1669|      0|        {
 1670|      0|          switch (pkt->pkttype)
 1671|      0|            {
 1672|      0|            case PKT_PUBLIC_KEY:
  ------------------
  |  Branch (1672:13): [True: 0, False: 0]
  ------------------
 1673|      0|            case PKT_SECRET_KEY:
  ------------------
  |  Branch (1673:13): [True: 0, False: 0]
  ------------------
 1674|      0|            case PKT_USER_ID:
  ------------------
  |  Branch (1674:13): [True: 0, False: 0]
  ------------------
 1675|      0|            case PKT_SYMKEY_ENC:
  ------------------
  |  Branch (1675:13): [True: 0, False: 0]
  ------------------
 1676|      0|            case PKT_PUBKEY_ENC:
  ------------------
  |  Branch (1676:13): [True: 0, False: 0]
  ------------------
 1677|      0|            case PKT_ENCRYPTED:
  ------------------
  |  Branch (1677:13): [True: 0, False: 0]
  ------------------
 1678|      0|            case PKT_ENCRYPTED_MDC:
  ------------------
  |  Branch (1678:13): [True: 0, False: 0]
  ------------------
 1679|      0|            case PKT_ENCRYPTED_AEAD:
  ------------------
  |  Branch (1679:13): [True: 0, False: 0]
  ------------------
 1680|      0|              write_status_text( STATUS_UNEXPECTED, "0" );
 1681|      0|              rc = GPG_ERR_UNEXPECTED;
 1682|      0|              goto leave;
 1683|       |
 1684|      0|            case PKT_SIGNATURE:   newpkt = add_signature (c, pkt); break;
  ------------------
  |  Branch (1684:13): [True: 0, False: 0]
  ------------------
 1685|      0|            case PKT_PLAINTEXT:   proc_plaintext (c, pkt); break;
  ------------------
  |  Branch (1685:13): [True: 0, False: 0]
  ------------------
 1686|      0|            case PKT_COMPRESSED:  rc = proc_compressed (c, pkt); break;
  ------------------
  |  Branch (1686:13): [True: 0, False: 0]
  ------------------
 1687|      0|            case PKT_ONEPASS_SIG: newpkt = add_onepass_sig (c, pkt); break;
  ------------------
  |  Branch (1687:13): [True: 0, False: 0]
  ------------------
 1688|      0|            case PKT_GPG_CONTROL: newpkt = add_gpg_control (c, pkt); break;
  ------------------
  |  Branch (1688:13): [True: 0, False: 0]
  ------------------
 1689|      0|            default: newpkt = 0; break;
  ------------------
  |  Branch (1689:13): [True: 0, False: 0]
  ------------------
 1690|      0|	    }
 1691|      0|	}
 1692|   558k|      else if (c->encrypt_only)
  ------------------
  |  Branch (1692:16): [True: 178k, False: 380k]
  ------------------
 1693|   178k|        {
 1694|   178k|          switch (pkt->pkttype)
 1695|   178k|            {
 1696|  2.96k|            case PKT_PUBLIC_KEY:
  ------------------
  |  Branch (1696:13): [True: 2.96k, False: 175k]
  ------------------
 1697|  3.06k|            case PKT_SECRET_KEY:
  ------------------
  |  Branch (1697:13): [True: 108, False: 177k]
  ------------------
 1698|  4.06k|            case PKT_USER_ID:
  ------------------
  |  Branch (1698:13): [True: 1.00k, False: 177k]
  ------------------
 1699|  4.06k|              write_status_text (STATUS_UNEXPECTED, "0");
 1700|  4.06k|              rc = GPG_ERR_UNEXPECTED;
 1701|  4.06k|              goto leave;
 1702|       |
 1703|  38.6k|            case PKT_SIGNATURE:   newpkt = add_signature (c, pkt); break;
  ------------------
  |  Branch (1703:13): [True: 38.6k, False: 139k]
  ------------------
 1704|  2.01k|            case PKT_SYMKEY_ENC:  proc_symkey_enc (c, pkt); break;
  ------------------
  |  Branch (1704:13): [True: 2.01k, False: 175k]
  ------------------
 1705|  1.11k|            case PKT_PUBKEY_ENC:  proc_pubkey_enc (c, pkt); break;
  ------------------
  |  Branch (1705:13): [True: 1.11k, False: 176k]
  ------------------
 1706|  1.83k|            case PKT_ENCRYPTED:
  ------------------
  |  Branch (1706:13): [True: 1.83k, False: 176k]
  ------------------
 1707|  2.74k|            case PKT_ENCRYPTED_MDC:
  ------------------
  |  Branch (1707:13): [True: 906, False: 177k]
  ------------------
 1708|  49.5k|            case PKT_ENCRYPTED_AEAD: proc_encrypted (c, pkt); break;
  ------------------
  |  Branch (1708:13): [True: 46.7k, False: 131k]
  ------------------
 1709|  13.8k|            case PKT_PLAINTEXT:   proc_plaintext (c, pkt); break;
  ------------------
  |  Branch (1709:13): [True: 13.8k, False: 164k]
  ------------------
 1710|  53.4k|            case PKT_COMPRESSED:  rc = proc_compressed (c, pkt); break;
  ------------------
  |  Branch (1710:13): [True: 53.4k, False: 124k]
  ------------------
 1711|  9.21k|            case PKT_ONEPASS_SIG: newpkt = add_onepass_sig (c, pkt); break;
  ------------------
  |  Branch (1711:13): [True: 9.21k, False: 168k]
  ------------------
 1712|  2.55k|            case PKT_GPG_CONTROL: newpkt = add_gpg_control (c, pkt); break;
  ------------------
  |  Branch (1712:13): [True: 2.55k, False: 175k]
  ------------------
 1713|  3.57k|            default: newpkt = 0; break;
  ------------------
  |  Branch (1713:13): [True: 3.57k, False: 174k]
  ------------------
 1714|   178k|	    }
 1715|   178k|	}
 1716|   380k|      else
 1717|   380k|        {
 1718|   380k|          switch (pkt->pkttype)
 1719|   380k|            {
 1720|  19.3k|            case PKT_PUBLIC_KEY:
  ------------------
  |  Branch (1720:13): [True: 19.3k, False: 360k]
  ------------------
 1721|  19.8k|            case PKT_SECRET_KEY:
  ------------------
  |  Branch (1721:13): [True: 547, False: 379k]
  ------------------
 1722|  19.8k|              release_list (c);
 1723|  19.8k|              c->list = new_kbnode (pkt);
 1724|  19.8k|              newpkt = 1;
 1725|  19.8k|              break;
 1726|  10.7k|            case PKT_PUBLIC_SUBKEY:
  ------------------
  |  Branch (1726:13): [True: 10.7k, False: 369k]
  ------------------
 1727|  12.0k|            case PKT_SECRET_SUBKEY:
  ------------------
  |  Branch (1727:13): [True: 1.24k, False: 379k]
  ------------------
 1728|  12.0k|              newpkt = add_subkey (c, pkt);
 1729|  12.0k|              break;
 1730|  50.9k|            case PKT_USER_ID:     newpkt = add_user_id (c, pkt); break;
  ------------------
  |  Branch (1730:13): [True: 50.9k, False: 329k]
  ------------------
 1731|  91.4k|            case PKT_SIGNATURE:   newpkt = add_signature (c, pkt); break;
  ------------------
  |  Branch (1731:13): [True: 91.4k, False: 288k]
  ------------------
 1732|  1.72k|            case PKT_PUBKEY_ENC:  proc_pubkey_enc (c, pkt); break;
  ------------------
  |  Branch (1732:13): [True: 1.72k, False: 378k]
  ------------------
 1733|  3.54k|            case PKT_SYMKEY_ENC:  proc_symkey_enc (c, pkt); break;
  ------------------
  |  Branch (1733:13): [True: 3.54k, False: 376k]
  ------------------
 1734|  4.09k|            case PKT_ENCRYPTED:
  ------------------
  |  Branch (1734:13): [True: 4.09k, False: 376k]
  ------------------
 1735|  5.26k|            case PKT_ENCRYPTED_MDC:
  ------------------
  |  Branch (1735:13): [True: 1.16k, False: 379k]
  ------------------
 1736|  77.4k|            case PKT_ENCRYPTED_AEAD: proc_encrypted (c, pkt); break;
  ------------------
  |  Branch (1736:13): [True: 72.1k, False: 308k]
  ------------------
 1737|  15.2k|            case PKT_PLAINTEXT:   proc_plaintext (c, pkt); break;
  ------------------
  |  Branch (1737:13): [True: 15.2k, False: 365k]
  ------------------
 1738|  88.4k|            case PKT_COMPRESSED:  rc = proc_compressed (c, pkt); break;
  ------------------
  |  Branch (1738:13): [True: 88.4k, False: 291k]
  ------------------
 1739|  10.4k|            case PKT_ONEPASS_SIG: newpkt = add_onepass_sig (c, pkt); break;
  ------------------
  |  Branch (1739:13): [True: 10.4k, False: 369k]
  ------------------
 1740|  2.80k|            case PKT_GPG_CONTROL: newpkt = add_gpg_control(c, pkt); break;
  ------------------
  |  Branch (1740:13): [True: 2.80k, False: 377k]
  ------------------
 1741|      0|            case PKT_RING_TRUST:  newpkt = add_ring_trust (c, pkt); break;
  ------------------
  |  Branch (1741:13): [True: 0, False: 380k]
  ------------------
 1742|  6.33k|            default: newpkt = 0; break;
  ------------------
  |  Branch (1742:13): [True: 6.33k, False: 373k]
  ------------------
 1743|   380k|	    }
 1744|   380k|	}
 1745|       |
 1746|   554k|      if (rc)
  ------------------
  |  Branch (1746:11): [True: 2.81k, False: 551k]
  ------------------
 1747|  2.81k|        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|   551k|      if (pkt->pkttype != PKT_SIGNATURE && pkt->pkttype != PKT_MDC)
  ------------------
  |  Branch (1757:11): [True: 421k, False: 130k]
  |  Branch (1757:44): [True: 418k, False: 2.76k]
  ------------------
 1758|   418k|        c->any.data = (pkt->pkttype == PKT_PLAINTEXT);
 1759|       |
 1760|   551k|      if (newpkt == -1)
  ------------------
  |  Branch (1760:11): [True: 303k, False: 247k]
  ------------------
 1761|   303k|        ;
 1762|   247k|      else if (newpkt)
  ------------------
  |  Branch (1762:16): [True: 230k, False: 17.4k]
  ------------------
 1763|   230k|        {
 1764|   230k|          pkt = xmalloc (sizeof *pkt);
  ------------------
  |  |  107|   230k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 1765|   230k|          init_packet (pkt);
  ------------------
  |  |  581|   230k|#define init_packet(a) do { (a)->pkttype = 0;		\
  |  |  582|   230k|			    (a)->pkt.generic = NULL;	\
  |  |  583|   230k|		       } while(0)
  |  |  ------------------
  |  |  |  Branch (583:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1766|   230k|	}
 1767|  17.4k|      else
 1768|  17.4k|        free_packet (pkt, &parsectx);
 1769|   551k|    }
 1770|       |
 1771|   151k|  if (rc == GPG_ERR_INV_PACKET)
  ------------------
  |  Branch (1771:7): [True: 135k, False: 16.3k]
  ------------------
 1772|   135k|    write_status_text (STATUS_NODATA, "3");
 1773|       |
 1774|   151k|  if (any_data)
  ------------------
  |  Branch (1774:7): [True: 150k, False: 1.03k]
  ------------------
 1775|   150k|    rc = 0;
 1776|  1.03k|  else if (rc == -1)
  ------------------
  |  Branch (1776:12): [True: 1.03k, False: 0]
  ------------------
 1777|  1.03k|    write_status_text (STATUS_NODATA, "2");
 1778|       |
 1779|       |
 1780|   158k| leave:
 1781|   158k|  release_list (c);
 1782|   158k|  xfree(c->dek);
  ------------------
  |  |  104|   158k|#define xfree(a)         gcry_free ((a))
  ------------------
 1783|   158k|  free_packet (pkt, &parsectx);
 1784|   158k|  deinit_parse_packet (&parsectx);
  ------------------
  |  |  675|   158k|#define deinit_parse_packet(a) do { \
  |  |  676|   158k|    if ((a)->free_last_pkt)         \
  |  |  ------------------
  |  |  |  Branch (676:9): [True: 4.06k, False: 154k]
  |  |  ------------------
  |  |  677|   158k|      free_packet (NULL, (a));      \
  |  |  678|   158k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (678:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1785|   158k|  xfree (pkt);
  ------------------
  |  |  104|   158k|#define xfree(a)         gcry_free ((a))
  ------------------
 1786|   158k|  free_md_filter_context (&c->mfx);
 1787|   158k|  return rc;
 1788|   151k|}
mainproc.c:check_nesting:
 1607|   158k|{
 1608|   158k|  int level;
 1609|       |
 1610|  1.60M|  for (level=0; c; c = c->anchor)
  ------------------
  |  Branch (1610:17): [True: 1.45M, False: 158k]
  ------------------
 1611|  1.45M|    level++;
 1612|       |
 1613|   158k|  if (level > MAX_NESTING_DEPTH)
  ------------------
  |  |   47|   158k|#define MAX_NESTING_DEPTH 32
  ------------------
  |  Branch (1613:7): [True: 8, False: 158k]
  ------------------
 1614|      8|    {
 1615|      8|      log_error ("input data with too deeply nested packets\n");
 1616|      8|      write_status_text (STATUS_UNEXPECTED, "1");
 1617|      8|      return GPG_ERR_BAD_DATA;
 1618|      8|    }
 1619|       |
 1620|   158k|  return 0;
 1621|   158k|}
mainproc.c:proc_pubkey_enc:
  502|  2.84k|{
  503|  2.84k|  PKT_pubkey_enc *enc;
  504|       |
  505|       |  /* Check whether the secret key is available and store in this case.  */
  506|  2.84k|  c->last_was_session_key = 1;
  507|  2.84k|  enc = pkt->pkt.pubkey_enc;
  508|       |  /*printf("enc: encrypted by a pubkey with keyid %08lX\n", enc->keyid[1] );*/
  509|       |  /* Hmmm: why do I have this algo check here - anyway there is
  510|       |   * function to check it. */
  511|  2.84k|  if (opt.verbose)
  ------------------
  |  Branch (511:7): [True: 0, False: 2.84k]
  ------------------
  512|      0|    log_info (_("public key is %s\n"), keystr (enc->keyid));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  513|       |
  514|  2.84k|  if (is_status_enabled ())
  ------------------
  |  Branch (514:7): [True: 0, False: 2.84k]
  ------------------
  515|      0|    {
  516|      0|      char buf[50];
  517|      0|      snprintf (buf, sizeof buf, "%08lX%08lX %d 0",
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  518|      0|                (ulong)enc->keyid[0], (ulong)enc->keyid[1], enc->pubkey_algo);
  519|      0|      write_status_text (STATUS_ENC_TO, buf);
  520|      0|    }
  521|       |
  522|  2.84k|  if (!opt.list_only && !opt.override_session_key)
  ------------------
  |  Branch (522:7): [True: 2.84k, False: 0]
  |  Branch (522:25): [True: 2.84k, False: 0]
  ------------------
  523|  2.84k|    {
  524|  2.84k|      struct pubkey_enc_list *x = xmalloc (sizeof *x);
  ------------------
  |  |  107|  2.84k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  525|       |
  526|  2.84k|      x->keyid[0] = enc->keyid[0];
  527|  2.84k|      x->keyid[1] = enc->keyid[1];
  528|  2.84k|      x->pubkey_algo = enc->pubkey_algo;
  529|  2.84k|      x->result = -1;
  530|  2.84k|      x->data[0] = x->data[1] = NULL;
  531|  2.84k|      if (enc->data[0])
  ------------------
  |  Branch (531:11): [True: 433, False: 2.40k]
  ------------------
  532|    433|        {
  533|    433|          x->data[0] = mpi_copy (enc->data[0]);
  534|    433|          x->data[1] = mpi_copy (enc->data[1]);
  535|    433|        }
  536|  2.84k|      x->next = c->pkenc_list;
  537|  2.84k|      c->pkenc_list = x;
  538|  2.84k|    }
  539|       |
  540|  2.84k|  free_packet(pkt, NULL);
  541|  2.84k|}
mainproc.c:proc_symkey_enc:
  379|  5.55k|{
  380|  5.55k|  gpg_error_t err;
  381|  5.55k|  PKT_symkey_enc *enc;
  382|       |
  383|  5.55k|  enc = pkt->pkt.symkey_enc;
  384|  5.55k|  if (!enc)
  ------------------
  |  Branch (384:7): [True: 2.07k, False: 3.48k]
  ------------------
  385|  2.07k|    log_error ("invalid symkey encrypted packet\n");
  386|  3.48k|  else if(!c->dek)
  ------------------
  |  Branch (386:11): [True: 3.48k, False: 0]
  ------------------
  387|  3.48k|    {
  388|  3.48k|      int algo = enc->cipher_algo;
  389|  3.48k|      const char *s = openpgp_cipher_algo_name (algo);
  390|  3.48k|      const char *a = (enc->aead_algo ? openpgp_aead_algo_name (enc->aead_algo)
  ------------------
  |  Branch (390:24): [True: 315, False: 3.16k]
  ------------------
  391|  3.48k|                       /**/           : "CFB");
  392|       |
  393|  3.48k|      if (!openpgp_cipher_test_algo (algo))
  ------------------
  |  Branch (393:11): [True: 2.56k, False: 917]
  ------------------
  394|  2.56k|        {
  395|  2.56k|          if (!opt.quiet)
  ------------------
  |  Branch (395:15): [True: 2.56k, False: 0]
  ------------------
  396|  2.56k|            {
  397|  2.56k|              if (enc->seskeylen)
  ------------------
  |  Branch (397:19): [True: 590, False: 1.97k]
  ------------------
  398|    590|                log_info (_("%s.%s encrypted session key\n"), s, a );
  ------------------
  |  |   28|    590|#  define _(a) gettext (a)
  ------------------
  399|  1.97k|              else
  400|  1.97k|                log_info (_("%s.%s encrypted data\n"), s, a );
  ------------------
  |  |   28|  1.97k|#  define _(a) gettext (a)
  ------------------
  401|  2.56k|            }
  402|  2.56k|        }
  403|    917|      else
  404|    917|        {
  405|    917|          log_error (_("encrypted with unknown algorithm %d.%s\n"), algo, a);
  ------------------
  |  |   28|    917|#  define _(a) gettext (a)
  ------------------
  406|    917|          s = NULL; /* Force a goto leave.  */
  407|    917|        }
  408|       |
  409|  3.48k|      if (openpgp_md_test_algo (enc->s2k.hash_algo))
  ------------------
  |  Branch (409:11): [True: 1.70k, False: 1.77k]
  ------------------
  410|  1.70k|        {
  411|  1.70k|          log_error(_("passphrase generated with unknown digest"
  ------------------
  |  |   28|  1.70k|#  define _(a) gettext (a)
  ------------------
  412|  1.70k|                      " algorithm %d\n"),enc->s2k.hash_algo);
  413|  1.70k|          s = NULL;
  414|  1.70k|        }
  415|       |
  416|  3.48k|      c->last_was_session_key = 2;
  417|  3.48k|      if (!s || opt.list_only)
  ------------------
  |  Branch (417:11): [True: 1.99k, False: 1.48k]
  |  Branch (417:17): [True: 0, False: 1.48k]
  ------------------
  418|  1.99k|        goto leave;
  419|       |
  420|  1.48k|      if (opt.override_session_key)
  ------------------
  |  Branch (420:11): [True: 0, False: 1.48k]
  ------------------
  421|      0|        {
  422|      0|          c->dek = xmalloc_clear (sizeof *c->dek);
  ------------------
  |  |  116|      0|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
  423|      0|          if (get_override_session_key (c->dek, opt.override_session_key))
  ------------------
  |  Branch (423:15): [True: 0, False: 0]
  ------------------
  424|      0|            {
  425|      0|              xfree (c->dek);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  426|      0|              c->dek = NULL;
  427|      0|            }
  428|      0|        }
  429|  1.48k|      else
  430|  1.48k|        {
  431|  1.48k|          c->dek = passphrase_to_dek (algo, &enc->s2k, 0, 0, NULL,
  432|  1.48k|                                      GETPASSWORD_FLAG_SYMDECRYPT, NULL);
  ------------------
  |  |  297|  1.48k|#define GETPASSWORD_FLAG_SYMDECRYPT  1
  ------------------
  433|  1.48k|          if (c->dek)
  ------------------
  |  Branch (433:15): [True: 0, False: 1.48k]
  ------------------
  434|      0|            {
  435|      0|              c->dek->symmetric = 1;
  436|      0|              c->dek->use_aead = enc->aead_algo;
  437|       |
  438|       |              /* FIXME: This doesn't work perfectly if a symmetric key
  439|       |                 comes before a public key in the message - if the
  440|       |                 user doesn't know the passphrase, then there is a
  441|       |                 chance that the "decrypted" algorithm will happen to
  442|       |                 be a valid one, which will make the returned dek
  443|       |                 appear valid, so we won't try any public keys that
  444|       |                 come later. */
  445|      0|              if (enc->seskeylen)
  ------------------
  |  Branch (445:19): [True: 0, False: 0]
  ------------------
  446|      0|                {
  447|      0|                  err = symkey_decrypt_seskey (c->dek,
  448|      0|                                               enc->seskey, enc->seskeylen);
  449|      0|                  if (err)
  ------------------
  |  Branch (449:23): [True: 0, False: 0]
  ------------------
  450|      0|                    {
  451|      0|                      log_info ("decryption of the symmetrically encrypted"
  452|      0|                                 " session key failed: %s\n",
  453|      0|                                 gpg_strerror (err));
  454|      0|                      if (gpg_err_code (err) != GPG_ERR_BAD_KEY
  ------------------
  |  Branch (454:27): [True: 0, False: 0]
  ------------------
  455|      0|                          && gpg_err_code (err) != GPG_ERR_CHECKSUM)
  ------------------
  |  Branch (455:30): [True: 0, False: 0]
  ------------------
  456|      0|                        log_fatal ("process terminated to be bug compatible"
  457|      0|                                   " with GnuPG <= 2.2\n");
  458|      0|                      else
  459|      0|                        write_status_text (STATUS_ERROR,
  460|      0|                                           "symkey_decrypt.maybe_error"
  461|      0|                                           " 11_BAD_PASSPHRASE");
  462|       |
  463|      0|                      if (c->dek->s2k_cacheid[0])
  ------------------
  |  Branch (463:27): [True: 0, False: 0]
  ------------------
  464|      0|                        {
  465|      0|                          if (opt.debug)
  ------------------
  |  Branch (465:31): [True: 0, False: 0]
  ------------------
  466|      0|                            log_debug ("cleared passphrase cached with ID:"
  467|      0|                                       " %s\n", c->dek->s2k_cacheid);
  468|      0|                          passphrase_clear_cache (c->dek->s2k_cacheid);
  469|      0|                        }
  470|      0|                      xfree (c->dek);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  471|      0|                      c->dek = NULL;
  472|      0|                    }
  473|      0|                }
  474|      0|              else
  475|      0|                c->dek->algo_info_printed = 1;
  476|      0|            }
  477|  1.48k|        }
  478|  1.48k|    }
  479|       |
  480|  5.55k| leave:
  481|       |  /* Record infos from the packet.  */
  482|  5.55k|  {
  483|  5.55k|    struct symlist_item  *symitem;
  484|  5.55k|    symitem = xcalloc (1, sizeof *symitem);
  ------------------
  |  |  109|  5.55k|#define xcalloc(a,b)     gcry_xcalloc ((a),(b))
  ------------------
  485|  5.55k|    if (enc)
  ------------------
  |  Branch (485:9): [True: 3.48k, False: 2.07k]
  ------------------
  486|  3.48k|      {
  487|  3.48k|        symitem->cipher_algo = enc->cipher_algo;
  488|  3.48k|        symitem->cfb_mode = !enc->aead_algo;
  489|  3.48k|      }
  490|  2.07k|    else
  491|  2.07k|      symitem->other_error = 1;
  492|  5.55k|    symitem->next = c->symenc_list;
  493|  5.55k|    c->symenc_list = symitem;
  494|  5.55k|  }
  495|  5.55k|  c->symkeys++;
  496|  5.55k|  free_packet (pkt, NULL);
  497|  5.55k|}
mainproc.c:proc_encrypted:
  583|   126k|{
  584|   126k|  int result = 0;
  585|   126k|  int early_plaintext = literals_seen;
  586|   126k|  unsigned int compliance_de_vs = 0;
  587|       |
  588|   126k|  if (pkt->pkttype == PKT_ENCRYPTED_AEAD)
  ------------------
  |  Branch (588:7): [True: 118k, False: 8.00k]
  ------------------
  589|   118k|    c->seen_pkt_encrypted_aead = 1;
  590|   126k|  if (pkt->pkttype == PKT_ENCRYPTED_MDC)
  ------------------
  |  Branch (590:7): [True: 2.06k, False: 124k]
  ------------------
  591|  2.06k|    c->seen_pkt_encrypted_mdc = 1;
  592|       |
  593|   126k|  if (early_plaintext)
  ------------------
  |  Branch (593:7): [True: 126k, False: 742]
  ------------------
  594|   126k|    {
  595|   126k|      log_info (_("WARNING: multiple plaintexts seen\n"));
  ------------------
  |  |   28|   126k|#  define _(a) gettext (a)
  ------------------
  596|   126k|      write_status_errcode ("decryption.early_plaintext", GPG_ERR_BAD_DATA);
  597|       |      /* We fail only later so that we can print some more info first.  */
  598|   126k|    }
  599|       |
  600|   126k|  if (!opt.quiet)
  ------------------
  |  Branch (600:7): [True: 126k, False: 0]
  ------------------
  601|   126k|    {
  602|   126k|      if (c->symkeys>1)
  ------------------
  |  Branch (602:11): [True: 487, False: 126k]
  ------------------
  603|    487|        log_info (_("encrypted with %lu passphrases\n"), c->symkeys);
  ------------------
  |  |   28|    487|#  define _(a) gettext (a)
  ------------------
  604|   126k|      else if (c->symkeys == 1)
  ------------------
  |  Branch (604:16): [True: 241, False: 126k]
  ------------------
  605|    241|        log_info (_("encrypted with 1 passphrase\n"));
  ------------------
  |  |   28|    241|#  define _(a) gettext (a)
  ------------------
  606|   126k|      print_pkenc_list (c->ctrl, c->pkenc_list);
  607|   126k|    }
  608|       |
  609|       |  /* Figure out the session key by looking at all pkenc packets. */
  610|   126k|  if (opt.list_only || c->dek)
  ------------------
  |  Branch (610:7): [True: 0, False: 126k]
  |  Branch (610:24): [True: 0, False: 126k]
  ------------------
  611|      0|    ;
  612|   126k|  else if (opt.override_session_key)
  ------------------
  |  Branch (612:12): [True: 0, False: 126k]
  ------------------
  613|      0|    {
  614|      0|      c->dek = xmalloc_clear (sizeof *c->dek);
  ------------------
  |  |  116|      0|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
  615|      0|      result = get_override_session_key (c->dek, opt.override_session_key);
  616|      0|      if (result)
  ------------------
  |  Branch (616:11): [True: 0, False: 0]
  ------------------
  617|      0|        {
  618|      0|          xfree (c->dek);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  619|      0|          c->dek = NULL;
  620|      0|          log_info (_("public key decryption failed: %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  621|      0|                    gpg_strerror (result));
  622|      0|          write_status_error ("pkdecrypt_failed", result);
  623|      0|        }
  624|      0|    }
  625|   126k|  else if (c->pkenc_list)
  ------------------
  |  Branch (625:12): [True: 3.53k, False: 123k]
  ------------------
  626|  3.53k|    {
  627|  3.53k|      c->dek = xmalloc_secure_clear (sizeof *c->dek);
  ------------------
  |  |  117|  3.53k|#define xmalloc_secure_clear(a) gcry_xcalloc_secure (1, (a))
  ------------------
  628|  3.53k|      result = get_session_key (c->ctrl, c->pkenc_list, c->dek);
  629|  3.53k|      if (is_status_enabled ())
  ------------------
  |  Branch (629:11): [True: 0, False: 3.53k]
  ------------------
  630|      0|        {
  631|      0|          struct pubkey_enc_list *list;
  632|       |
  633|      0|          for (list = c->pkenc_list; list; list = list->next)
  ------------------
  |  Branch (633:38): [True: 0, False: 0]
  ------------------
  634|      0|            if (list->result)
  ------------------
  |  Branch (634:17): [True: 0, False: 0]
  ------------------
  635|      0|              { /* Key was not tried or it caused an error.  */
  636|      0|                char buf[20];
  637|      0|                snprintf (buf, sizeof buf, "%08lX%08lX",
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  638|      0|                          (ulong)list->keyid[0], (ulong)list->keyid[1]);
  639|      0|                write_status_text (STATUS_NO_SECKEY, buf);
  640|      0|              }
  641|      0|        }
  642|       |
  643|  3.53k|      if (result)
  ------------------
  |  Branch (643:11): [True: 3.53k, False: 0]
  ------------------
  644|  3.53k|        {
  645|  3.53k|          log_info (_("public key decryption failed: %s\n"),
  ------------------
  |  |   28|  3.53k|#  define _(a) gettext (a)
  ------------------
  646|  3.53k|                    gpg_strerror (result));
  647|  3.53k|          write_status_error ("pkdecrypt_failed", result);
  648|       |
  649|       |          /* Error: Delete the DEK. */
  650|  3.53k|          xfree (c->dek);
  ------------------
  |  |  104|  3.53k|#define xfree(a)         gcry_free ((a))
  ------------------
  651|  3.53k|          c->dek = NULL;
  652|  3.53k|        }
  653|  3.53k|    }
  654|       |
  655|   126k|  if (c->dek && opt.verbose > 1)
  ------------------
  |  Branch (655:7): [True: 0, False: 126k]
  |  Branch (655:17): [True: 0, False: 0]
  ------------------
  656|      0|    log_info (_("public key encrypted data: good DEK\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  657|       |
  658|   126k|  write_status (STATUS_BEGIN_DECRYPTION);
  659|       |
  660|       |  /*log_debug("dat: %sencrypted data\n", c->dek?"":"conventional ");*/
  661|   126k|  if (opt.list_only)
  ------------------
  |  Branch (661:7): [True: 0, False: 126k]
  ------------------
  662|      0|    result = -1;
  663|   126k|  else if (!c->dek && !c->last_was_session_key)
  ------------------
  |  Branch (663:12): [True: 126k, False: 0]
  |  Branch (663:23): [True: 125k, False: 1.41k]
  ------------------
  664|   125k|    {
  665|   125k|      int algo;
  666|   125k|      STRING2KEY s2kbuf;
  667|   125k|      STRING2KEY *s2k = NULL;
  668|   125k|      int canceled;
  669|       |
  670|   125k|      if (opt.override_session_key)
  ------------------
  |  Branch (670:11): [True: 0, False: 125k]
  ------------------
  671|      0|        {
  672|      0|          c->dek = xmalloc_clear (sizeof *c->dek);
  ------------------
  |  |  116|      0|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
  673|      0|          result = get_override_session_key (c->dek, opt.override_session_key);
  674|      0|          if (result)
  ------------------
  |  Branch (674:15): [True: 0, False: 0]
  ------------------
  675|      0|            {
  676|      0|              xfree (c->dek);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  677|      0|              c->dek = NULL;
  678|      0|            }
  679|      0|        }
  680|   125k|      else
  681|   125k|        {
  682|       |          /* Assume this is old style conventional encrypted data. */
  683|   125k|          algo = opt.def_cipher_algo;
  684|   125k|          if (algo)
  ------------------
  |  Branch (684:15): [True: 0, False: 125k]
  ------------------
  685|      0|            log_info (_("assuming %s encrypted data\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  686|      0|                      openpgp_cipher_algo_name (algo));
  687|   125k|          else if (openpgp_cipher_test_algo (CIPHER_ALGO_IDEA))
  ------------------
  |  Branch (687:20): [True: 0, False: 125k]
  ------------------
  688|      0|            {
  689|      0|              algo = opt.def_cipher_algo;
  690|      0|              if (!algo)
  ------------------
  |  Branch (690:19): [True: 0, False: 0]
  ------------------
  691|      0|                algo = opt.s2k_cipher_algo;
  692|      0|              log_info (_("IDEA cipher unavailable, "
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  693|      0|                          "optimistically attempting to use %s instead\n"),
  694|      0|                        openpgp_cipher_algo_name (algo));
  695|      0|            }
  696|   125k|          else
  697|   125k|            {
  698|   125k|              algo = CIPHER_ALGO_IDEA;
  699|   125k|              if (!opt.s2k_digest_algo)
  ------------------
  |  Branch (699:19): [True: 125k, False: 0]
  ------------------
  700|   125k|                {
  701|       |                  /* If no digest is given we assume SHA-1. */
  702|   125k|                  s2kbuf.mode = 0;
  703|   125k|                  s2kbuf.hash_algo = DIGEST_ALGO_SHA1;
  704|   125k|                  s2k = &s2kbuf;
  705|   125k|                }
  706|   125k|              log_info (_("assuming %s encrypted data\n"), "IDEA");
  ------------------
  |  |   28|   125k|#  define _(a) gettext (a)
  ------------------
  707|   125k|            }
  708|       |
  709|   125k|          c->dek = passphrase_to_dek (algo, s2k, 0, 0, NULL,
  710|   125k|                                      GETPASSWORD_FLAG_SYMDECRYPT, &canceled);
  ------------------
  |  |  297|   125k|#define GETPASSWORD_FLAG_SYMDECRYPT  1
  ------------------
  711|   125k|          if (c->dek)
  ------------------
  |  Branch (711:15): [True: 0, False: 125k]
  ------------------
  712|      0|            c->dek->algo_info_printed = 1;
  713|   125k|          else if (canceled)
  ------------------
  |  Branch (713:20): [True: 125k, False: 0]
  ------------------
  714|   125k|            result = gpg_error (GPG_ERR_CANCELED);
  715|      0|          else
  716|      0|            result = gpg_error (GPG_ERR_INV_PASSPHRASE);
  717|   125k|        }
  718|   125k|    }
  719|  1.41k|  else if (!c->dek)
  ------------------
  |  Branch (719:12): [True: 1.41k, False: 0]
  ------------------
  720|  1.41k|    {
  721|  1.41k|      if (c->symkeys && !c->pkenc_list)
  ------------------
  |  Branch (721:11): [True: 533, False: 879]
  |  Branch (721:25): [True: 371, False: 162]
  ------------------
  722|    371|        result = gpg_error (GPG_ERR_BAD_KEY);
  723|       |
  724|  1.41k|      if (!result)
  ------------------
  |  Branch (724:11): [True: 0, False: 1.41k]
  ------------------
  725|      0|        result = gpg_error (GPG_ERR_NO_SECKEY);
  726|  1.41k|    }
  727|       |
  728|       |  /* Compute compliance with CO_DE_VS.  */
  729|   126k|  if (!result && (is_status_enabled () || opt.flags.require_compliance)
  ------------------
  |  Branch (729:7): [True: 0, False: 126k]
  |  Branch (729:19): [True: 0, False: 0]
  |  Branch (729:43): [True: 0, False: 0]
  ------------------
  730|       |      /* Overriding session key voids compliance.  */
  731|   126k|      && !opt.override_session_key
  ------------------
  |  Branch (731:10): [True: 0, False: 0]
  ------------------
  732|       |      /* Check symmetric cipher.  */
  733|   126k|      && gnupg_gcrypt_is_compliant (CO_DE_VS)
  ------------------
  |  Branch (733:10): [True: 0, False: 0]
  ------------------
  734|   126k|      && gnupg_cipher_is_compliant (CO_DE_VS, c->dek->algo,
  ------------------
  |  Branch (734:10): [True: 0, False: 0]
  ------------------
  735|      0|                                    GCRY_CIPHER_MODE_CFB))
  736|      0|    {
  737|      0|      struct pubkey_enc_list *i;
  738|      0|      struct symlist_item *si;
  739|      0|      int compliant = 1;
  740|      0|      PKT_public_key *pk = xmalloc (sizeof *pk);
  ------------------
  |  |  107|      0|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  741|       |
  742|      0|      if ( !(c->pkenc_list || c->symkeys) )
  ------------------
  |  Branch (742:14): [True: 0, False: 0]
  |  Branch (742:31): [True: 0, False: 0]
  ------------------
  743|      0|        log_debug ("%s: where else did the session key come from?\n", __func__);
  744|       |
  745|       |      /* Check that all seen symmetric key packets use compliant
  746|       |       * algos.  This is so that no non-compliant encrypted session
  747|       |       * key can be sneaked in.  */
  748|      0|      for (si = c->symenc_list; si && compliant; si = si->next)
  ------------------
  |  Branch (748:33): [True: 0, False: 0]
  |  Branch (748:39): [True: 0, False: 0]
  ------------------
  749|      0|        {
  750|      0|          if (!si->cfb_mode
  ------------------
  |  Branch (750:15): [True: 0, False: 0]
  ------------------
  751|      0|              || !gnupg_cipher_is_compliant (CO_DE_VS, si->cipher_algo,
  ------------------
  |  Branch (751:18): [True: 0, False: 0]
  ------------------
  752|      0|                                             GCRY_CIPHER_MODE_CFB))
  753|      0|            compliant = 0;
  754|      0|        }
  755|       |
  756|       |      /* Check that every known public key used to encrypt the session key
  757|       |       * is compliant.  */
  758|      0|      for (i = c->pkenc_list; i && compliant; i = i->next)
  ------------------
  |  Branch (758:31): [True: 0, False: 0]
  |  Branch (758:36): [True: 0, False: 0]
  ------------------
  759|      0|        {
  760|      0|          memset (pk, 0, sizeof *pk);
  761|      0|          pk->pubkey_algo = i->pubkey_algo;
  762|      0|          if (!get_pubkey (c->ctrl, pk, i->keyid)
  ------------------
  |  Branch (762:15): [True: 0, False: 0]
  ------------------
  763|      0|              && !gnupg_pk_is_compliant (CO_DE_VS, pk->pubkey_algo, 0,
  ------------------
  |  Branch (763:18): [True: 0, False: 0]
  ------------------
  764|      0|                                         pk->pkey, nbits_from_pk (pk), NULL))
  765|      0|            compliant = 0;
  766|      0|          release_public_key_parts (pk);
  767|      0|        }
  768|       |
  769|      0|      xfree (pk);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  770|       |
  771|      0|      if (compliant)
  ------------------
  |  Branch (771:11): [True: 0, False: 0]
  ------------------
  772|      0|        compliance_de_vs |= 1;
  773|      0|    }
  774|       |
  775|   126k|  if (!result)
  ------------------
  |  Branch (775:7): [True: 0, False: 126k]
  ------------------
  776|      0|    {
  777|      0|      int compl_error;
  778|      0|      result = decrypt_data (c->ctrl, c, pkt->pkt.encrypted, c->dek,
  779|      0|                             &compl_error);
  780|      0|      if (!result && !compl_error)
  ------------------
  |  Branch (780:11): [True: 0, False: 0]
  |  Branch (780:22): [True: 0, False: 0]
  ------------------
  781|      0|        compliance_de_vs |= 2;
  782|      0|    }
  783|       |
  784|       |  /* Trigger the deferred error.  */
  785|   126k|  if (!result && early_plaintext)
  ------------------
  |  Branch (785:7): [True: 0, False: 126k]
  |  Branch (785:18): [True: 0, False: 0]
  ------------------
  786|      0|    result = gpg_error (GPG_ERR_BAD_DATA);
  787|       |
  788|   126k|  if (result == -1)
  ------------------
  |  Branch (788:7): [True: 0, False: 126k]
  ------------------
  789|      0|    ;
  790|   126k|  else if (!result
  ------------------
  |  Branch (790:12): [True: 0, False: 126k]
  ------------------
  791|   126k|           && !opt.ignore_mdc_error
  ------------------
  |  Branch (791:15): [True: 0, False: 0]
  ------------------
  792|   126k|           && !pkt->pkt.encrypted->mdc_method
  ------------------
  |  Branch (792:15): [True: 0, False: 0]
  ------------------
  793|   126k|           && !pkt->pkt.encrypted->aead_algo)
  ------------------
  |  Branch (793:15): [True: 0, False: 0]
  ------------------
  794|      0|    {
  795|       |      /* The message has been decrypted but does not carry an MDC or
  796|       |       * uses AEAD encryption.  --ignore-mdc-error has also not been
  797|       |       * used.  To avoid attacks changing an MDC message to a non-MDC
  798|       |       * message, we fail here.  */
  799|      0|      log_error (_("WARNING: message was not integrity protected\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  800|      0|      if (!pkt->pkt.encrypted->mdc_method
  ------------------
  |  Branch (800:11): [True: 0, False: 0]
  ------------------
  801|      0|          && (openpgp_cipher_get_algo_blklen (c->dek->algo) == 8
  ------------------
  |  |  123|      0|  gcry_cipher_get_algo_blklen(map_cipher_openpgp_to_gcry((_a)))
  ------------------
  |  Branch (801:15): [True: 0, False: 0]
  ------------------
  802|      0|              || c->dek->algo == CIPHER_ALGO_TWOFISH))
  ------------------
  |  Branch (802:18): [True: 0, False: 0]
  ------------------
  803|      0|        {
  804|       |          /* Before 2.2.8 we did not fail hard for a missing MDC if
  805|       |           * one of the old ciphers where used.  Although these cases
  806|       |           * are rare in practice we print a hint on how to decrypt
  807|       |           * such messages.  */
  808|      0|          log_string
  809|      0|            (GPGRT_LOGLVL_INFO,
  810|      0|             _("Hint: If this message was created before the year 2003 it is\n"
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  811|      0|               "likely that this message is legitimate.  This is because back\n"
  812|      0|               "then integrity protection was not widely used.\n"));
  813|      0|          log_info (_("Use the option '%s' to decrypt anyway.\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  814|      0|                     "--ignore-mdc-error");
  815|      0|          write_status_errcode ("nomdc_with_legacy_cipher",
  816|      0|                                GPG_ERR_DECRYPT_FAILED);
  817|      0|        }
  818|      0|      log_info (_("decryption forced to fail!\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  819|      0|      write_status (STATUS_DECRYPTION_FAILED);
  820|      0|    }
  821|   126k|  else if (!result || (gpg_err_code (result) == GPG_ERR_BAD_SIGNATURE
  ------------------
  |  Branch (821:12): [True: 0, False: 126k]
  |  Branch (821:24): [True: 0, False: 126k]
  ------------------
  822|   126k|                       && !pkt->pkt.encrypted->aead_algo
  ------------------
  |  Branch (822:27): [True: 0, False: 0]
  ------------------
  823|   126k|                       && opt.ignore_mdc_error))
  ------------------
  |  Branch (823:27): [True: 0, False: 0]
  ------------------
  824|      0|    {
  825|       |      /* All is fine or for an MDC message the MDC failed but the
  826|       |       * --ignore-mdc-error option is active.  For compatibility
  827|       |       * reasons we issue GOODMDC also for AEAD messages.  */
  828|      0|      write_status (STATUS_DECRYPTION_OKAY);
  829|      0|      if (opt.verbose > 1)
  ------------------
  |  Branch (829:11): [True: 0, False: 0]
  ------------------
  830|      0|        log_info(_("decryption okay\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  831|       |
  832|      0|      if (pkt->pkt.encrypted->aead_algo)
  ------------------
  |  Branch (832:11): [True: 0, False: 0]
  ------------------
  833|      0|        {
  834|      0|          write_status (STATUS_GOODMDC);
  835|      0|          compliance_de_vs |= 4;
  836|      0|        }
  837|      0|      else if (pkt->pkt.encrypted->mdc_method && !result)
  ------------------
  |  Branch (837:16): [True: 0, False: 0]
  |  Branch (837:50): [True: 0, False: 0]
  ------------------
  838|      0|        {
  839|      0|          write_status (STATUS_GOODMDC);
  840|      0|          compliance_de_vs |= 4;
  841|      0|        }
  842|      0|      else
  843|      0|        log_info (_("WARNING: message was not integrity protected\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  844|      0|    }
  845|   126k|  else if (gpg_err_code (result) == GPG_ERR_BAD_SIGNATURE
  ------------------
  |  Branch (845:12): [True: 0, False: 126k]
  ------------------
  846|   126k|           || gpg_err_code (result) == GPG_ERR_TRUNCATED)
  ------------------
  |  Branch (846:15): [True: 0, False: 126k]
  ------------------
  847|      0|    {
  848|      0|      glo_ctrl.lasterr = result;
  849|      0|      log_error (_("WARNING: encrypted message has been manipulated!\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  850|      0|      write_status (STATUS_BADMDC);
  851|      0|      write_status (STATUS_DECRYPTION_FAILED);
  852|      0|    }
  853|   126k|  else
  854|   126k|    {
  855|   126k|      if (gpg_err_code (result) == GPG_ERR_BAD_KEY
  ------------------
  |  Branch (855:11): [True: 371, False: 126k]
  ------------------
  856|   126k|          || gpg_err_code (result) == GPG_ERR_CHECKSUM
  ------------------
  |  Branch (856:14): [True: 0, False: 126k]
  ------------------
  857|   126k|          || gpg_err_code (result) == GPG_ERR_CIPHER_ALGO)
  ------------------
  |  Branch (857:14): [True: 0, False: 126k]
  ------------------
  858|    371|        {
  859|    371|          if (c->symkeys)
  ------------------
  |  Branch (859:15): [True: 371, False: 0]
  ------------------
  860|    371|            write_status_text (STATUS_ERROR,
  861|    371|                               "symkey_decrypt.maybe_error"
  862|    371|                               " 11_BAD_PASSPHRASE");
  863|       |
  864|    371|          if (c->dek && *c->dek->s2k_cacheid != '\0')
  ------------------
  |  Branch (864:15): [True: 0, False: 371]
  |  Branch (864:25): [True: 0, False: 0]
  ------------------
  865|      0|            {
  866|      0|              if (opt.debug)
  ------------------
  |  Branch (866:19): [True: 0, False: 0]
  ------------------
  867|      0|                log_debug ("cleared passphrase cached with ID: %s\n",
  868|      0|                           c->dek->s2k_cacheid);
  869|      0|              passphrase_clear_cache (c->dek->s2k_cacheid);
  870|      0|            }
  871|    371|        }
  872|   126k|      glo_ctrl.lasterr = result;
  873|   126k|      write_status (STATUS_DECRYPTION_FAILED);
  874|   126k|      log_error (_("decryption failed: %s\n"), gpg_strerror (result));
  ------------------
  |  |   28|   126k|#  define _(a) gettext (a)
  ------------------
  875|       |      /* Hmmm: does this work when we have encrypted using multiple
  876|       |       * ways to specify the session key (symmmetric and PK). */
  877|   126k|    }
  878|       |
  879|       |
  880|       |  /* If we concluded that the decryption was compliant, issue a
  881|       |   * compliance status before the end of the decryption status.  */
  882|   126k|  if (compliance_de_vs == (4|2|1))
  ------------------
  |  Branch (882:7): [True: 0, False: 126k]
  ------------------
  883|      0|    {
  884|      0|      write_status_strings (STATUS_DECRYPTION_COMPLIANCE_MODE,
  885|      0|                            gnupg_status_compliance_flag (CO_DE_VS),
  886|      0|                            NULL);
  887|      0|    }
  888|       |
  889|   126k|  xfree (c->dek);
  ------------------
  |  |  104|   126k|#define xfree(a)         gcry_free ((a))
  ------------------
  890|   126k|  c->dek = NULL;
  891|   126k|  free_packet (pkt, NULL);
  892|   126k|  c->last_was_session_key = 0;
  893|   126k|  write_status (STATUS_END_DECRYPTION);
  894|       |
  895|       |  /* Bump the counter even if we have not seen a literal data packet
  896|       |   * inside an encryption container.  This acts as a sentinel in case
  897|       |   * a misplace extra literal data packets follows after this
  898|       |   * encrypted packet.  */
  899|   126k|  literals_seen++;
  900|       |
  901|       |  /* The --require-compliance option allows to simplify decryption in
  902|       |   * de-vs compliance mode by just looking at the exit status.  */
  903|   126k|  if (opt.flags.require_compliance
  ------------------
  |  Branch (903:7): [True: 0, False: 126k]
  ------------------
  904|   126k|      && opt.compliance == CO_DE_VS
  ------------------
  |  Branch (904:10): [True: 0, False: 0]
  ------------------
  905|   126k|      && compliance_de_vs != (4|2|1))
  ------------------
  |  Branch (905:10): [True: 0, False: 0]
  ------------------
  906|      0|    {
  907|      0|      log_error (_("operation forced to fail due to"
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  908|      0|                   " unfulfilled compliance rules\n"));
  909|      0|      g10_errors_seen = 1;
  910|      0|    }
  911|   126k|}
mainproc.c:print_pkenc_list:
  550|   126k|{
  551|   131k|  for (; list; list = list->next)
  ------------------
  |  Branch (551:10): [True: 4.77k, False: 126k]
  ------------------
  552|  4.77k|    {
  553|  4.77k|      PKT_public_key *pk;
  554|  4.77k|      char pkstrbuf[PUBKEY_STRING_SIZE];
  555|  4.77k|      char *p;
  556|       |
  557|  4.77k|      pk = xmalloc_clear (sizeof *pk);
  ------------------
  |  |  116|  4.77k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
  558|       |
  559|  4.77k|      pk->pubkey_algo = list->pubkey_algo;
  560|  4.77k|      if (!get_pubkey (ctrl, pk, list->keyid))
  ------------------
  |  Branch (560:11): [True: 0, False: 4.77k]
  ------------------
  561|      0|        {
  562|      0|          pubkey_string (pk, pkstrbuf, sizeof pkstrbuf);
  563|       |
  564|      0|          log_info (_("encrypted with %s key, ID %s, created %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  565|      0|                    pkstrbuf, keystr_from_pk (pk),
  566|      0|                    strtimestamp (pk->timestamp));
  567|      0|          p = get_user_id_native (ctrl, list->keyid);
  568|      0|          log_printf (_("      \"%s\"\n"), p);
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  569|      0|          xfree (p);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  570|      0|        }
  571|  4.77k|      else
  572|  4.77k|        log_info (_("encrypted with %s key, ID %s\n"),
  ------------------
  |  |   28|  4.77k|#  define _(a) gettext (a)
  ------------------
  573|  4.77k|                  openpgp_pk_algo_name (list->pubkey_algo),
  574|  4.77k|                  keystr(list->keyid));
  575|       |
  576|  4.77k|      free_public_key (pk);
  577|  4.77k|    }
  578|   126k|}
mainproc.c:proc_compressed:
 1116|   141k|{
 1117|   141k|  PKT_compressed *zd = pkt->pkt.compressed;
 1118|   141k|  int rc;
 1119|       |
 1120|       |  /*printf("zip: compressed data packet\n");*/
 1121|   141k|  if (c->sigs_only)
  ------------------
  |  Branch (1121:7): [True: 0, False: 141k]
  ------------------
 1122|      0|    rc = handle_compressed (c->ctrl, c, zd, proc_compressed_cb, c);
 1123|   141k|  else if( c->encrypt_only )
  ------------------
  |  Branch (1123:12): [True: 53.4k, False: 88.4k]
  ------------------
 1124|  53.4k|    rc = handle_compressed (c->ctrl, c, zd, proc_encrypt_cb, c);
 1125|  88.4k|  else
 1126|  88.4k|    rc = handle_compressed (c->ctrl, c, zd, NULL, NULL);
 1127|       |
 1128|   141k|  if (gpg_err_code (rc) == GPG_ERR_BAD_DATA)
  ------------------
  |  Branch (1128:7): [True: 256, False: 141k]
  ------------------
 1129|    256|    {
 1130|    256|      if  (!c->any.uncompress_failed)
  ------------------
  |  Branch (1130:12): [True: 8, False: 248]
  ------------------
 1131|      8|        {
 1132|      8|          CTX cc;
 1133|       |
 1134|    264|          for (cc=c; cc; cc = cc->anchor)
  ------------------
  |  Branch (1134:22): [True: 256, False: 8]
  ------------------
 1135|    256|            cc->any.uncompress_failed = 1;
 1136|      8|          log_error ("uncompressing failed: %s\n", gpg_strerror (rc));
 1137|      8|        }
 1138|    256|    }
 1139|   141k|  else if (rc)
  ------------------
  |  Branch (1139:12): [True: 2.56k, False: 139k]
  ------------------
 1140|  2.56k|    log_error ("uncompressing failed: %s\n", gpg_strerror (rc));
 1141|       |
 1142|   141k|  free_packet (pkt, NULL);
 1143|   141k|  c->last_was_session_key = 0;
 1144|   141k|  return rc;
 1145|   141k|}
mainproc.c:proc_encrypt_cb:
 1108|  53.3k|{
 1109|  53.3k|  CTX c = info;
 1110|  53.3k|  return proc_encryption_packets (c->ctrl, info, a );
 1111|  53.3k|}
mainproc.c:add_signature:
  242|   130k|{
  243|   130k|  kbnode_t node;
  244|       |
  245|   130k|  c->any.sig_seen = 1;
  246|   130k|  if (pkt->pkttype == PKT_SIGNATURE && !c->list)
  ------------------
  |  Branch (246:7): [True: 130k, False: 0]
  |  Branch (246:40): [True: 50.5k, False: 79.6k]
  ------------------
  247|  50.5k|    {
  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|  50.5k|      node = new_kbnode (pkt);
  255|  50.5k|      c->list = node;
  256|  50.5k|      return 1;
  257|  50.5k|    }
  258|  79.6k|  else if (!c->list)
  ------------------
  |  Branch (258:12): [True: 0, False: 79.6k]
  ------------------
  259|      0|    return 0; /* oops (invalid packet sequence)*/
  260|  79.6k|  else if (!c->list->pkt)
  ------------------
  |  Branch (260:12): [True: 0, False: 79.6k]
  ------------------
  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|  79.6k|  node = new_kbnode (pkt);
  265|  79.6k|  add_kbnode (c->list, node);
  266|       |
  267|  79.6k|  return 1;
  268|   130k|}
mainproc.c:proc_plaintext:
  933|  29.0k|{
  934|  29.0k|  PKT_plaintext *pt = pkt->pkt.plaintext;
  935|  29.0k|  int any, clearsig, rc;
  936|  29.0k|  kbnode_t n;
  937|  29.0k|  unsigned char *extrahash;
  938|  29.0k|  size_t extrahashlen;
  939|       |
  940|       |  /* This is a literal data packet.  Bump a counter for later checks.  */
  941|  29.0k|  literals_seen++;
  942|       |
  943|  29.0k|  if (pt->namelen == 8 && !memcmp( pt->name, "_CONSOLE", 8))
  ------------------
  |  Branch (943:7): [True: 834, False: 28.2k]
  |  Branch (943:27): [True: 114, False: 720]
  ------------------
  944|    114|    log_info (_("Note: sender requested \"for-your-eyes-only\"\n"));
  ------------------
  |  |   28|    114|#  define _(a) gettext (a)
  ------------------
  945|  28.9k|  else if (opt.verbose)
  ------------------
  |  Branch (945:12): [True: 0, False: 28.9k]
  ------------------
  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|  29.0k|  free_md_filter_context (&c->mfx);
  956|  29.0k|  if (gcry_md_open (&c->mfx.md, 0, 0))
  ------------------
  |  Branch (956:7): [True: 0, False: 29.0k]
  ------------------
  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|  29.0k|  any = clearsig = 0;
  965|   139k|  for (n=c->list; n; n = n->next )
  ------------------
  |  Branch (965:19): [True: 115k, False: 23.7k]
  ------------------
  966|   115k|    {
  967|   115k|      if (n->pkt->pkttype == PKT_ONEPASS_SIG)
  ------------------
  |  Branch (967:11): [True: 19.3k, False: 96.5k]
  ------------------
  968|  19.3k|        {
  969|       |          /* The onepass signature case. */
  970|  19.3k|          if (n->pkt->pkt.onepass_sig->digest_algo)
  ------------------
  |  Branch (970:15): [True: 19.2k, False: 121]
  ------------------
  971|  19.2k|            {
  972|  19.2k|              if (!opt.skip_verify)
  ------------------
  |  Branch (972:19): [True: 19.2k, False: 0]
  ------------------
  973|  19.2k|                gcry_md_enable (c->mfx.md,
  974|  19.2k|                                n->pkt->pkt.onepass_sig->digest_algo);
  975|       |
  976|  19.2k|              any = 1;
  977|  19.2k|            }
  978|  19.3k|        }
  979|  96.5k|      else if (n->pkt->pkttype == PKT_GPG_CONTROL
  ------------------
  |  Branch (979:16): [True: 71.3k, False: 25.1k]
  ------------------
  980|  96.5k|               && n->pkt->pkt.gpg_control->control == CTRLPKT_CLEARSIGN_START)
  ------------------
  |  Branch (980:19): [True: 5.35k, False: 65.9k]
  ------------------
  981|  5.35k|        {
  982|       |          /* The clearsigned message case. */
  983|  5.35k|          size_t datalen = n->pkt->pkt.gpg_control->datalen;
  984|  5.35k|          const byte *data = n->pkt->pkt.gpg_control->data;
  985|       |
  986|       |          /* Check that we have at least the sigclass and one hash.  */
  987|  5.35k|          if  (datalen < 2)
  ------------------
  |  Branch (987:16): [True: 0, False: 5.35k]
  ------------------
  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|  5.35k|          clearsig = (*data == 0x01);
  992|  11.9k|          for (data++, datalen--; datalen; datalen--, data++)
  ------------------
  |  Branch (992:35): [True: 6.64k, False: 5.35k]
  ------------------
  993|  6.64k|            if (!opt.skip_verify)
  ------------------
  |  Branch (993:17): [True: 6.64k, False: 0]
  ------------------
  994|  6.64k|              gcry_md_enable (c->mfx.md, *data);
  995|  5.35k|          any = 1;
  996|  5.35k|          break;  /* Stop here as one-pass signature packets are not
  997|       |                     expected.  */
  998|  5.35k|        }
  999|  91.1k|      else if (n->pkt->pkttype == PKT_SIGNATURE)
  ------------------
  |  Branch (999:16): [True: 24.6k, False: 66.4k]
  ------------------
 1000|  24.6k|        {
 1001|       |          /* The SIG+LITERAL case that PGP used to use.  */
 1002|  24.6k|          if (!opt.skip_verify)
  ------------------
  |  Branch (1002:15): [True: 24.6k, False: 0]
  ------------------
 1003|  24.6k|            gcry_md_enable (c->mfx.md, n->pkt->pkt.signature->digest_algo);
 1004|  24.6k|          any = 1;
 1005|  24.6k|        }
 1006|   115k|    }
 1007|       |
 1008|  29.0k|  if (!any && !opt.skip_verify && !have_seen_pkt_encrypted_aead_or_mdc(c))
  ------------------
  |  Branch (1008:7): [True: 4.62k, False: 24.4k]
  |  Branch (1008:15): [True: 4.62k, False: 0]
  |  Branch (1008:35): [True: 4.34k, False: 274]
  ------------------
 1009|  4.34k|    {
 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|  4.34k|	gcry_md_enable (c->mfx.md, DIGEST_ALGO_RMD160);
 1015|  4.34k|	gcry_md_enable (c->mfx.md, DIGEST_ALGO_SHA1);
 1016|  4.34k|    }
 1017|  29.0k|  if (DBG_HASHING)
  ------------------
  |  |  354|  29.0k|#define DBG_HASHING (opt.debug & DBG_HASHING_VALUE)
  |  |  ------------------
  |  |  |  |  341|  29.0k|#define DBG_HASHING_VALUE 512	/* debug hashing operations */
  |  |  ------------------
  |  |  |  Branch (354:21): [True: 0, False: 29.0k]
  |  |  ------------------
  ------------------
 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|  29.0k|  rc=0;
 1025|       |
 1026|  29.0k|  if (literals_seen > 1)
  ------------------
  |  Branch (1026:7): [True: 26.6k, False: 2.37k]
  ------------------
 1027|  26.6k|    {
 1028|  26.6k|      log_info (_("WARNING: multiple plaintexts seen\n"));
  ------------------
  |  |   28|  26.6k|#  define _(a) gettext (a)
  ------------------
 1029|       |
 1030|  26.6k|      write_status_text (STATUS_ERROR, "proc_pkt.plaintext 89_BAD_DATA");
 1031|  26.6k|      log_inc_errorcount ();
 1032|  26.6k|      rc = gpg_error (GPG_ERR_UNEXPECTED);
 1033|  26.6k|    }
 1034|       |
 1035|  29.0k|  if (!rc)
  ------------------
  |  Branch (1035:7): [True: 2.37k, False: 26.6k]
  ------------------
 1036|  2.37k|    {
 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|  2.37k|      rc = handle_plaintext (pt, &c->mfx,
 1041|  2.37k|                             (opt.outfp || opt.outfile)? 0 :  c->sigs_only,
  ------------------
  |  Branch (1041:31): [True: 0, False: 2.37k]
  |  Branch (1041:44): [True: 1.34k, False: 1.03k]
  ------------------
 1042|  2.37k|                             clearsig);
 1043|  2.37k|      if (gpg_err_code (rc) == GPG_ERR_EACCES && !c->sigs_only)
  ------------------
  |  Branch (1043:11): [True: 0, False: 2.37k]
  |  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|  2.37k|    }
 1050|       |
 1051|  29.0k|  if (rc)
  ------------------
  |  Branch (1051:7): [True: 27.1k, False: 1.93k]
  ------------------
 1052|  27.1k|    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|  29.0k|  extrahash = xtrymalloc (6 + pt->namelen);
  ------------------
  |  |   97|  29.0k|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
 1059|  29.0k|  if (!extrahash)
  ------------------
  |  Branch (1059:7): [True: 0, False: 29.0k]
  ------------------
 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|  29.0k|  else
 1067|  29.0k|    {
 1068|  29.0k|      extrahash[0] = pt->mode;
 1069|  29.0k|      extrahash[1] = pt->namelen;
 1070|  29.0k|      if (pt->namelen)
  ------------------
  |  Branch (1070:11): [True: 21.9k, False: 7.13k]
  ------------------
 1071|  21.9k|        memcpy (extrahash+2, pt->name, pt->namelen);
 1072|  29.0k|      extrahashlen = 2 + pt->namelen;
 1073|  29.0k|      extrahash[extrahashlen++] = pt->timestamp >> 24;
 1074|  29.0k|      extrahash[extrahashlen++] = pt->timestamp >> 16;
 1075|  29.0k|      extrahash[extrahashlen++] = pt->timestamp >>  8;
 1076|  29.0k|      extrahash[extrahashlen++] = pt->timestamp      ;
 1077|  29.0k|    }
 1078|       |
 1079|  29.0k|  free_packet (pkt, NULL);
 1080|  29.0k|  c->last_was_session_key = 0;
 1081|       |
 1082|  29.0k|  n = new_kbnode (create_gpg_control (CTRLPKT_PLAINTEXT_MARK,
 1083|  29.0k|                                      extrahash, extrahashlen));
 1084|  29.0k|  xfree (extrahash);
  ------------------
  |  |  104|  29.0k|#define xfree(a)         gcry_free ((a))
  ------------------
 1085|  29.0k|  if (c->list)
  ------------------
  |  Branch (1085:7): [True: 26.0k, False: 3.05k]
  ------------------
 1086|  26.0k|    add_kbnode (c->list, n);
 1087|  3.05k|  else
 1088|  3.05k|    c->list = n;
 1089|  29.0k|}
mainproc.c:have_seen_pkt_encrypted_aead_or_mdc:
  916|  4.62k|{
  917|  4.62k|  CTX cc;
  918|       |
  919|  21.9k|  for (cc = c; cc; cc = cc->anchor)
  ------------------
  |  Branch (919:16): [True: 17.5k, False: 4.34k]
  ------------------
  920|  17.5k|    {
  921|  17.5k|      if (cc->seen_pkt_encrypted_aead)
  ------------------
  |  Branch (921:11): [True: 198, False: 17.3k]
  ------------------
  922|    198|	return 1;
  923|  17.3k|      if (cc->seen_pkt_encrypted_mdc)
  ------------------
  |  Branch (923:11): [True: 76, False: 17.2k]
  ------------------
  924|     76|	return 1;
  925|  17.3k|    }
  926|       |
  927|  4.34k|  return 0;
  928|  4.62k|}
mainproc.c:add_onepass_sig:
  170|  19.7k|{
  171|  19.7k|  kbnode_t node;
  172|       |
  173|  19.7k|  if (c->list) /* Add another packet. */
  ------------------
  |  Branch (173:7): [True: 1.18k, False: 18.5k]
  ------------------
  174|  1.18k|    add_kbnode (c->list, new_kbnode (pkt));
  175|  18.5k|  else /* Insert the first one.  */
  176|  18.5k|    c->list = node = new_kbnode (pkt);
  177|       |
  178|  19.7k|  return 1;
  179|  19.7k|}
mainproc.c:add_gpg_control:
  184|  5.35k|{
  185|  5.35k|  if ( pkt->pkt.gpg_control->control == CTRLPKT_CLEARSIGN_START )
  ------------------
  |  Branch (185:8): [True: 5.04k, False: 310]
  ------------------
  186|  5.04k|    {
  187|       |      /* New clear text signature.
  188|       |       * Process the last one and reset everything */
  189|  5.04k|      release_list(c);
  190|  5.04k|    }
  191|       |
  192|  5.35k|  if (c->list)  /* Add another packet.  */
  ------------------
  |  Branch (192:7): [True: 70, False: 5.28k]
  ------------------
  193|     70|    add_kbnode (c->list, new_kbnode (pkt));
  194|  5.28k|  else /* Insert the first one. */
  195|  5.28k|    c->list = new_kbnode (pkt);
  196|       |
  197|  5.35k|  return 1;
  198|  5.35k|}
mainproc.c:release_list:
  137|   183k|{
  138|   183k|  proc_tree (c, c->list);
  139|   183k|  release_kbnode (c->list);
  140|   186k|  while (c->pkenc_list)
  ------------------
  |  Branch (140:10): [True: 2.84k, False: 183k]
  ------------------
  141|  2.84k|    {
  142|  2.84k|      struct pubkey_enc_list *tmp = c->pkenc_list->next;
  143|       |
  144|  2.84k|      mpi_release (c->pkenc_list->data[0]);
  145|  2.84k|      mpi_release (c->pkenc_list->data[1]);
  146|  2.84k|      xfree (c->pkenc_list);
  ------------------
  |  |  104|  2.84k|#define xfree(a)         gcry_free ((a))
  ------------------
  147|  2.84k|      c->pkenc_list = tmp;
  148|  2.84k|    }
  149|   183k|  c->pkenc_list = NULL;
  150|   189k|  while (c->symenc_list)
  ------------------
  |  Branch (150:10): [True: 5.55k, False: 183k]
  ------------------
  151|  5.55k|    {
  152|  5.55k|      struct symlist_item *tmp = c->symenc_list->next;
  153|  5.55k|      xfree (c->symenc_list);
  ------------------
  |  |  104|  5.55k|#define xfree(a)         gcry_free ((a))
  ------------------
  154|  5.55k|      c->symenc_list = tmp;
  155|  5.55k|    }
  156|   183k|  c->symenc_list = NULL;
  157|   183k|  c->list = NULL;
  158|   183k|  c->any.data = 0;
  159|   183k|  c->any.uncompress_failed = 0;
  160|   183k|  c->last_was_session_key = 0;
  161|   183k|  c->seen_pkt_encrypted_aead = 0;
  162|   183k|  c->seen_pkt_encrypted_mdc = 0;
  163|   183k|  xfree (c->dek);
  ------------------
  |  |  104|   183k|#define xfree(a)         gcry_free ((a))
  ------------------
  164|   183k|  c->dek = NULL;
  165|   183k|}
mainproc.c:proc_tree:
 2574|   183k|{
 2575|   183k|  kbnode_t n1;
 2576|   183k|  int rc;
 2577|       |
 2578|   183k|  if (opt.list_packets || opt.list_only)
  ------------------
  |  Branch (2578:7): [True: 0, False: 183k]
  |  Branch (2578:27): [True: 0, False: 183k]
  ------------------
 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|   187k|  while (node
  ------------------
  |  Branch (2584:10): [True: 98.7k, False: 89.2k]
  ------------------
 2585|   187k|         && node->pkt->pkttype == PKT_GPG_CONTROL
  ------------------
  |  Branch (2585:13): [True: 9.53k, False: 89.2k]
  ------------------
 2586|   187k|          && node->pkt->pkt.gpg_control->control == CTRLPKT_PLAINTEXT_MARK)
  ------------------
  |  Branch (2586:14): [True: 4.25k, False: 5.28k]
  ------------------
 2587|  4.25k|    {
 2588|  4.25k|      node = node->next;
 2589|  4.25k|    }
 2590|   183k|  if (!node)
  ------------------
  |  Branch (2590:7): [True: 89.2k, False: 94.5k]
  ------------------
 2591|  89.2k|    return;
 2592|       |
 2593|  94.5k|  c->trustletter = ' ';
 2594|  94.5k|  if (node->pkt->pkttype == PKT_PUBLIC_KEY
  ------------------
  |  Branch (2594:7): [True: 19.3k, False: 75.1k]
  ------------------
 2595|  94.5k|      || node->pkt->pkttype == PKT_PUBLIC_SUBKEY)
  ------------------
  |  Branch (2595:10): [True: 91, False: 75.1k]
  ------------------
 2596|  19.3k|    {
 2597|  19.3k|      merge_keys_and_selfsig (c->ctrl, node);
 2598|  19.3k|      list_node (c, node);
 2599|  19.3k|    }
 2600|  75.1k|  else if (node->pkt->pkttype == PKT_SECRET_KEY)
  ------------------
  |  Branch (2600:12): [True: 547, False: 74.5k]
  ------------------
 2601|    547|    {
 2602|    547|      merge_keys_and_selfsig (c->ctrl, node);
 2603|    547|      list_node (c, node);
 2604|    547|    }
 2605|  74.5k|  else if (node->pkt->pkttype == PKT_ONEPASS_SIG)
  ------------------
  |  Branch (2605:12): [True: 18.5k, False: 56.0k]
  ------------------
 2606|  18.5k|    {
 2607|       |      /* Check all signatures.  */
 2608|  18.5k|      if (!c->any.data)
  ------------------
  |  Branch (2608:11): [True: 8.96k, False: 9.55k]
  ------------------
 2609|  8.96k|        {
 2610|  8.96k|          int use_textmode = 0;
 2611|       |
 2612|  8.96k|          free_md_filter_context (&c->mfx);
 2613|       |          /* Prepare to create all requested message digests.  */
 2614|  8.96k|          rc = gcry_md_open (&c->mfx.md, 0, 0);
 2615|  8.96k|          if (rc)
  ------------------
  |  Branch (2615:15): [True: 0, False: 8.96k]
  ------------------
 2616|      0|            goto hash_err;
 2617|       |
 2618|       |          /* Fixme: why looking for the signature packet and not the
 2619|       |             one-pass packet?  */
 2620|  16.6k|          for (n1 = node; (n1 = find_next_kbnode (n1, PKT_SIGNATURE));)
  ------------------
  |  Branch (2620:27): [True: 7.71k, False: 8.96k]
  ------------------
 2621|  7.71k|            gcry_md_enable (c->mfx.md, n1->pkt->pkt.signature->digest_algo);
 2622|       |
 2623|  8.96k|          if (n1 && n1->pkt->pkt.onepass_sig->sig_class == 0x01)
  ------------------
  |  Branch (2623:15): [True: 0, False: 8.96k]
  |  Branch (2623:21): [True: 0, False: 0]
  ------------------
 2624|      0|            use_textmode = 1;
 2625|       |
 2626|       |          /* Ask for file and hash it. */
 2627|  8.96k|          if (c->sigs_only)
  ------------------
  |  Branch (2627:15): [True: 0, False: 8.96k]
  ------------------
 2628|      0|            {
 2629|      0|              if (c->signed_data.used && c->signed_data.data_fd != -1)
  ------------------
  |  Branch (2629:19): [True: 0, False: 0]
  |  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|      0|              else
 2634|      0|                rc = hash_datafiles (c->mfx.md, NULL,
 2635|      0|                                     c->signed_data.data_names,
 2636|      0|                                     c->sigfilename,
 2637|      0|                                     use_textmode);
 2638|      0|	    }
 2639|  8.96k|          else
 2640|  8.96k|            {
 2641|  8.96k|              rc = ask_for_detached_datafile (c->mfx.md, NULL,
 2642|  8.96k|                                              iobuf_get_real_fname (c->iobuf),
 2643|  8.96k|                                              use_textmode);
 2644|  8.96k|	    }
 2645|       |
 2646|  8.96k|        hash_err:
 2647|  8.96k|          if (rc)
  ------------------
  |  Branch (2647:15): [True: 8.96k, False: 0]
  ------------------
 2648|  8.96k|            {
 2649|  8.96k|              log_error ("can't hash datafile: %s\n", gpg_strerror (rc));
 2650|  8.96k|              return;
 2651|  8.96k|	    }
 2652|  8.96k|	}
 2653|  9.55k|      else if (c->signed_data.used)
  ------------------
  |  Branch (2653:16): [True: 0, False: 9.55k]
  ------------------
 2654|      0|        {
 2655|      0|          log_error (_("not a detached signature\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2656|      0|          return;
 2657|      0|        }
 2658|       |
 2659|  14.2k|      for (n1 = node; (n1 = find_next_kbnode (n1, PKT_SIGNATURE));)
  ------------------
  |  Branch (2659:23): [True: 4.70k, False: 9.55k]
  ------------------
 2660|  4.70k|        check_sig_and_print (c, n1);
 2661|       |
 2662|  9.55k|    }
 2663|  56.0k|  else if (node->pkt->pkttype == PKT_GPG_CONTROL
  ------------------
  |  Branch (2663:12): [True: 5.28k, False: 50.7k]
  ------------------
 2664|  56.0k|           && node->pkt->pkt.gpg_control->control == CTRLPKT_CLEARSIGN_START)
  ------------------
  |  Branch (2664:15): [True: 5.04k, False: 240]
  ------------------
 2665|  5.04k|    {
 2666|       |      /* Clear text signed message.  */
 2667|  5.04k|      if (!c->any.data)
  ------------------
  |  Branch (2667:11): [True: 907, False: 4.13k]
  ------------------
 2668|    907|        {
 2669|    907|          log_error ("cleartext signature without data\n");
 2670|    907|          return;
 2671|    907|        }
 2672|  4.13k|      else if (c->signed_data.used)
  ------------------
  |  Branch (2672:16): [True: 0, False: 4.13k]
  ------------------
 2673|      0|        {
 2674|      0|          log_error (_("not a detached signature\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2675|      0|          return;
 2676|      0|        }
 2677|       |
 2678|  6.35k|      for (n1 = node; (n1 = find_next_kbnode (n1, PKT_SIGNATURE));)
  ------------------
  |  Branch (2678:23): [True: 2.22k, False: 4.13k]
  ------------------
 2679|  2.22k|        check_sig_and_print (c, n1);
 2680|       |
 2681|  4.13k|    }
 2682|  50.9k|  else if (node->pkt->pkttype == PKT_SIGNATURE)
  ------------------
  |  Branch (2682:12): [True: 50.6k, False: 390]
  ------------------
 2683|  50.6k|    {
 2684|  50.6k|      PKT_signature *sig = node->pkt->pkt.signature;
 2685|  50.6k|      int multiple_ok = 1;
 2686|       |
 2687|  50.6k|      n1 = find_next_kbnode (node, PKT_SIGNATURE);
 2688|  50.6k|      if (n1)
  ------------------
  |  Branch (2688:11): [True: 9.18k, False: 41.4k]
  ------------------
 2689|  9.18k|        {
 2690|  9.18k|          byte class = sig->sig_class;
 2691|  9.18k|          byte hash  = sig->digest_algo;
 2692|       |
 2693|  29.3k|          for (; n1; (n1 = find_next_kbnode(n1, PKT_SIGNATURE)))
  ------------------
  |  Branch (2693:18): [True: 22.0k, False: 7.24k]
  ------------------
 2694|  22.0k|            {
 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|  22.0k|              if (n1->pkt->pkt.signature->sig_class != class
  ------------------
  |  Branch (2703:19): [True: 1.54k, False: 20.5k]
  ------------------
 2704|  22.0k|                  || (c->any.data
  ------------------
  |  Branch (2704:23): [True: 3.03k, False: 17.4k]
  ------------------
 2705|  20.5k|                      && n1->pkt->pkt.signature->digest_algo != hash))
  ------------------
  |  Branch (2705:26): [True: 392, False: 2.64k]
  ------------------
 2706|  1.93k|                {
 2707|  1.93k|                  multiple_ok = 0;
 2708|  1.93k|                  log_info (_("WARNING: multiple signatures detected.  "
  ------------------
  |  |   28|  1.93k|#  define _(a) gettext (a)
  ------------------
 2709|  1.93k|                              "Only the first will be checked.\n"));
 2710|  1.93k|                  break;
 2711|  1.93k|                }
 2712|  22.0k|            }
 2713|  9.18k|        }
 2714|       |
 2715|  50.6k|      if (sig->sig_class != 0x00 && sig->sig_class != 0x01)
  ------------------
  |  Branch (2715:11): [True: 3.45k, False: 47.1k]
  |  Branch (2715:37): [True: 3.03k, False: 421]
  ------------------
 2716|  3.03k|        {
 2717|  3.03k|          log_info(_("standalone signature of class 0x%02x\n"), sig->sig_class);
  ------------------
  |  |   28|  3.03k|#  define _(a) gettext (a)
  ------------------
 2718|  3.03k|        }
 2719|  47.5k|      else if (!c->any.data)
  ------------------
  |  Branch (2719:16): [True: 46.1k, False: 1.41k]
  ------------------
 2720|  46.1k|        {
 2721|       |          /* Detached signature */
 2722|  46.1k|          free_md_filter_context (&c->mfx);
 2723|  46.1k|          rc = gcry_md_open (&c->mfx.md, sig->digest_algo, 0);
 2724|  46.1k|          if (rc)
  ------------------
  |  Branch (2724:15): [True: 266, False: 45.8k]
  ------------------
 2725|    266|            goto detached_hash_err;
 2726|       |
 2727|  45.8k|          if (multiple_ok)
  ------------------
  |  Branch (2727:15): [True: 44.9k, False: 905]
  ------------------
 2728|  44.9k|            {
 2729|       |              /* If we have and want to handle multiple signatures we
 2730|       |               * need to enable all hash algorithms for the context.  */
 2731|  59.2k|              for (n1 = node; (n1 = find_next_kbnode (n1, PKT_SIGNATURE)); )
  ------------------
  |  Branch (2731:31): [True: 14.2k, False: 44.9k]
  ------------------
 2732|  14.2k|                if (!openpgp_md_test_algo (n1->pkt->pkt.signature->digest_algo))
  ------------------
  |  Branch (2732:21): [True: 2.24k, False: 12.0k]
  ------------------
 2733|  2.24k|                  gcry_md_enable (c->mfx.md,
 2734|  2.24k|                                  map_md_openpgp_to_gcry
 2735|  2.24k|                                  (n1->pkt->pkt.signature->digest_algo));
 2736|  44.9k|            }
 2737|       |
 2738|  45.8k|          if (RFC2440 || RFC4880)
  ------------------
  |  |  373|  91.7k|#define RFC2440 (opt.compliance==CO_RFC2440)
  |  |  ------------------
  |  |  |  Branch (373:17): [True: 0, False: 45.8k]
  |  |  ------------------
  ------------------
                        if (RFC2440 || RFC4880)
  ------------------
  |  |  374|  45.8k|#define RFC4880 (opt.compliance==CO_RFC4880)
  |  |  ------------------
  |  |  |  Branch (374:17): [True: 0, False: 45.8k]
  |  |  ------------------
  ------------------
 2739|      0|            ; /* Strict RFC mode.  */
 2740|  45.8k|          else if (sig->digest_algo == DIGEST_ALGO_SHA1
  ------------------
  |  Branch (2740:20): [True: 199, False: 45.6k]
  ------------------
 2741|  45.8k|                   && sig->pubkey_algo == PUBKEY_ALGO_DSA
  ------------------
  |  Branch (2741:23): [True: 153, False: 46]
  ------------------
 2742|  45.8k|                   && sig->sig_class == 0x01)
  ------------------
  |  Branch (2742:23): [True: 139, False: 14]
  ------------------
 2743|    139|            {
 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|    139|              rc = gcry_md_open (&c->mfx.md2, sig->digest_algo, 0);
 2749|    139|              if (rc)
  ------------------
  |  Branch (2749:19): [True: 0, False: 139]
  ------------------
 2750|      0|                goto detached_hash_err;
 2751|    139|	    }
 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|  45.8k|          if (DBG_HASHING)
  ------------------
  |  |  354|  45.8k|#define DBG_HASHING (opt.debug & DBG_HASHING_VALUE)
  |  |  ------------------
  |  |  |  |  341|  45.8k|#define DBG_HASHING_VALUE 512	/* debug hashing operations */
  |  |  ------------------
  |  |  |  Branch (354:21): [True: 0, False: 45.8k]
  |  |  ------------------
  ------------------
 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|  45.8k|          if (c->sigs_only)
  ------------------
  |  Branch (2770:15): [True: 0, False: 45.8k]
  ------------------
 2771|      0|            {
 2772|      0|              if (c->signed_data.used && c->signed_data.data_fd != -1)
  ------------------
  |  Branch (2772:19): [True: 0, False: 0]
  |  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|      0|              else
 2777|      0|                rc = hash_datafiles (c->mfx.md, c->mfx.md2,
 2778|      0|                                     c->signed_data.data_names,
 2779|      0|                                     c->sigfilename,
 2780|      0|                                     (sig->sig_class == 0x01));
 2781|      0|	    }
 2782|  45.8k|          else
 2783|  45.8k|            {
 2784|  45.8k|              rc = ask_for_detached_datafile (c->mfx.md, c->mfx.md2,
 2785|  45.8k|                                              iobuf_get_real_fname(c->iobuf),
 2786|  45.8k|                                              (sig->sig_class == 0x01));
 2787|  45.8k|	    }
 2788|       |
 2789|  46.1k|        detached_hash_err:
 2790|  46.1k|          if (rc)
  ------------------
  |  Branch (2790:15): [True: 46.1k, False: 0]
  ------------------
 2791|  46.1k|            {
 2792|  46.1k|              log_error ("can't hash datafile: %s\n", gpg_strerror (rc));
 2793|  46.1k|              return;
 2794|  46.1k|	    }
 2795|  46.1k|	}
 2796|  1.41k|      else if (c->signed_data.used)
  ------------------
  |  Branch (2796:16): [True: 0, False: 1.41k]
  ------------------
 2797|      0|        {
 2798|      0|          log_error (_("not a detached signature\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 2799|      0|          return;
 2800|      0|        }
 2801|  1.41k|      else if (!opt.quiet)
  ------------------
  |  Branch (2801:16): [True: 1.41k, False: 0]
  ------------------
 2802|  1.41k|        log_info (_("old style (PGP 2.x) signature\n"));
  ------------------
  |  |   28|  1.41k|#  define _(a) gettext (a)
  ------------------
 2803|       |
 2804|  4.44k|      if (multiple_ok)
  ------------------
  |  Branch (2804:11): [True: 3.43k, False: 1.01k]
  ------------------
 2805|  3.43k|        {
 2806|  12.0k|          for (n1 = node; n1; (n1 = find_next_kbnode(n1, PKT_SIGNATURE)))
  ------------------
  |  Branch (2806:27): [True: 8.63k, False: 3.43k]
  ------------------
 2807|  8.63k|	    check_sig_and_print (c, n1);
 2808|  3.43k|        }
 2809|  1.01k|      else
 2810|  1.01k|        check_sig_and_print (c, node);
 2811|       |
 2812|  4.44k|    }
 2813|    390|  else
 2814|    390|    {
 2815|    390|      dump_kbnode (c->list);
 2816|    390|      log_error ("invalid root packet detected in proc_tree()\n");
 2817|    390|      dump_kbnode (node);
 2818|    390|    }
 2819|  94.5k|}
mainproc.c:list_node:
 1313|  68.8k|{
 1314|  68.8k|  if (!node)
  ------------------
  |  Branch (1314:7): [True: 0, False: 68.8k]
  ------------------
 1315|      0|    ;
 1316|  68.8k|  else if (node->pkt->pkttype == PKT_PUBLIC_KEY
  ------------------
  |  Branch (1316:12): [True: 19.3k, False: 49.5k]
  ------------------
 1317|  68.8k|           || node->pkt->pkttype == PKT_PUBLIC_SUBKEY)
  ------------------
  |  Branch (1317:15): [True: 9.65k, False: 39.9k]
  ------------------
 1318|  28.9k|    {
 1319|  28.9k|      PKT_public_key *pk = node->pkt->pkt.public_key;
 1320|       |
 1321|  28.9k|      if (opt.with_colons)
  ------------------
  |  Branch (1321:11): [True: 0, False: 28.9k]
  ------------------
 1322|      0|        {
 1323|      0|          u32 keyid[2];
 1324|       |
 1325|      0|          keyid_from_pk( pk, keyid );
 1326|      0|          if (pk->flags.primary)
  ------------------
  |  Branch (1326:15): [True: 0, False: 0]
  ------------------
 1327|      0|            c->trustletter = (opt.fast_list_mode
  ------------------
  |  Branch (1327:31): [True: 0, False: 0]
  ------------------
 1328|      0|                              ? 0
 1329|      0|                              : get_validity_info
 1330|      0|                                  (c->ctrl,
 1331|      0|                                   node->pkt->pkttype == PKT_PUBLIC_KEY
  ------------------
  |  Branch (1331:36): [True: 0, False: 0]
  ------------------
 1332|      0|                                   ? node : NULL,
 1333|      0|                                   pk, NULL));
 1334|      0|          es_printf ("%s:", pk->flags.primary? "pub":"sub" );
  ------------------
  |  Branch (1334:29): [True: 0, False: 0]
  ------------------
 1335|      0|          if (c->trustletter)
  ------------------
  |  Branch (1335:15): [True: 0, False: 0]
  ------------------
 1336|      0|            es_putc (c->trustletter, es_stdout);
 1337|      0|          es_printf (":%u:%d:%08lX%08lX:%s:%s::",
 1338|      0|                     nbits_from_pk( pk ),
 1339|      0|                     pk->pubkey_algo,
 1340|      0|                     (ulong)keyid[0],(ulong)keyid[1],
 1341|      0|                     colon_datestr_from_pk( pk ),
 1342|      0|                     colon_strtime (pk->expiredate) );
 1343|      0|          if (pk->flags.primary && !opt.fast_list_mode)
  ------------------
  |  Branch (1343:15): [True: 0, False: 0]
  |  Branch (1343:36): [True: 0, False: 0]
  ------------------
 1344|      0|            es_putc (get_ownertrust_info (c->ctrl, pk, 1), es_stdout);
 1345|      0|          es_putc (':', es_stdout);
 1346|      0|          es_putc ('\n', es_stdout);
 1347|      0|        }
 1348|  28.9k|      else
 1349|  28.9k|        {
 1350|  28.9k|          print_key_line (c->ctrl, es_stdout, pk, 0);
 1351|  28.9k|        }
 1352|       |
 1353|  28.9k|      if (opt.keyid_format == KF_NONE && !opt.with_colons)
  ------------------
  |  Branch (1353:11): [True: 0, False: 28.9k]
  |  Branch (1353:42): [True: 0, False: 0]
  ------------------
 1354|      0|        ; /* Already printed.  */
 1355|  28.9k|      else if ((pk->flags.primary && opt.fingerprint) || opt.fingerprint > 1)
  ------------------
  |  Branch (1355:17): [True: 19.3k, False: 9.65k]
  |  Branch (1355:38): [True: 0, False: 19.3k]
  |  Branch (1355:58): [True: 0, False: 28.9k]
  ------------------
 1356|      0|        print_fingerprint (c->ctrl, NULL, pk, 0);
 1357|       |
 1358|  28.9k|      if (pk->flags.primary)
  ------------------
  |  Branch (1358:11): [True: 19.3k, False: 9.65k]
  ------------------
 1359|  19.3k|        {
 1360|  19.3k|          int kl = opt.keyid_format == KF_NONE? 0 : keystrlen ();
  ------------------
  |  Branch (1360:20): [True: 0, False: 19.3k]
  ------------------
 1361|       |
 1362|       |          /* Now list all userids with their signatures. */
 1363|   107k|          for (node = node->next; node; node = node->next)
  ------------------
  |  Branch (1363:35): [True: 88.2k, False: 19.3k]
  ------------------
 1364|  88.2k|            {
 1365|  88.2k|              if (node->pkt->pkttype == PKT_SIGNATURE)
  ------------------
  |  Branch (1365:19): [True: 39.3k, False: 48.8k]
  ------------------
 1366|  39.3k|                {
 1367|  39.3k|                  list_node (c,  node );
 1368|  39.3k|                }
 1369|  48.8k|              else if (node->pkt->pkttype == PKT_USER_ID)
  ------------------
  |  Branch (1369:24): [True: 38.9k, False: 9.93k]
  ------------------
 1370|  38.9k|                {
 1371|  38.9k|                  if (opt.with_colons)
  ------------------
  |  Branch (1371:23): [True: 0, False: 38.9k]
  ------------------
 1372|      0|                    es_printf ("%s:::::::::",
 1373|      0|                               node->pkt->pkt.user_id->attrib_data?"uat":"uid");
  ------------------
  |  Branch (1373:32): [True: 0, False: 0]
  ------------------
 1374|  38.9k|                  else
 1375|  38.9k|                    es_printf ("uid%*s",
 1376|  38.9k|                               kl + (opt.legacy_list_mode? 9:11),
  ------------------
  |  Branch (1376:38): [True: 0, False: 38.9k]
  ------------------
 1377|  38.9k|                               "" );
 1378|  38.9k|                  print_userid (node->pkt);
 1379|  38.9k|                  if (opt.with_colons)
  ------------------
  |  Branch (1379:23): [True: 0, False: 38.9k]
  ------------------
 1380|      0|                    es_putc (':', es_stdout);
 1381|  38.9k|                  es_putc ('\n', es_stdout);
 1382|  38.9k|		}
 1383|  9.93k|              else if (node->pkt->pkttype == PKT_PUBLIC_SUBKEY)
  ------------------
  |  Branch (1383:24): [True: 9.56k, False: 368]
  ------------------
 1384|  9.56k|                {
 1385|  9.56k|                  list_node(c,  node );
 1386|  9.56k|                }
 1387|  88.2k|            }
 1388|  19.3k|        }
 1389|  28.9k|    }
 1390|  39.9k|  else if (node->pkt->pkttype == PKT_SECRET_KEY
  ------------------
  |  Branch (1390:12): [True: 547, False: 39.3k]
  ------------------
 1391|  39.9k|           || node->pkt->pkttype == PKT_SECRET_SUBKEY)
  ------------------
  |  Branch (1391:15): [True: 0, False: 39.3k]
  ------------------
 1392|    547|    {
 1393|       |
 1394|    547|      log_debug ("FIXME: No way to print secret key packets here\n");
 1395|       |      /* fixme: We may use a function to turn a secret key packet into
 1396|       |         a public key one and use that here.  */
 1397|    547|    }
 1398|  39.3k|  else if (node->pkt->pkttype == PKT_SIGNATURE)
  ------------------
  |  Branch (1398:12): [True: 39.3k, False: 0]
  ------------------
 1399|  39.3k|    {
 1400|  39.3k|      PKT_signature *sig = node->pkt->pkt.signature;
 1401|  39.3k|      int is_selfsig = 0;
 1402|  39.3k|      int rc2 = 0;
 1403|  39.3k|      size_t n;
 1404|  39.3k|      char *p;
 1405|  39.3k|      int sigrc = ' ';
 1406|       |
 1407|  39.3k|      if (!opt.verbose)
  ------------------
  |  Branch (1407:11): [True: 39.3k, False: 0]
  ------------------
 1408|  39.3k|        return;
 1409|       |
 1410|      0|      if (sig->sig_class == 0x20 || sig->sig_class == 0x30)
  ------------------
  |  Branch (1410:11): [True: 0, False: 0]
  |  Branch (1410:37): [True: 0, False: 0]
  ------------------
 1411|      0|        es_fputs ("rev", es_stdout);
 1412|      0|      else
 1413|      0|        es_fputs ("sig", es_stdout);
 1414|      0|      if (opt.check_sigs)
  ------------------
  |  Branch (1414:11): [True: 0, False: 0]
  ------------------
 1415|      0|        {
 1416|      0|          fflush (stdout);
 1417|      0|          rc2 = do_check_sig (c, node, NULL, 0, NULL,
 1418|      0|                              &is_selfsig, NULL, NULL, NULL);
 1419|      0|          switch (gpg_err_code (rc2))
 1420|      0|            {
 1421|      0|            case 0:		          sigrc = '!'; break;
  ------------------
  |  Branch (1421:13): [True: 0, False: 0]
  ------------------
 1422|      0|            case GPG_ERR_BAD_SIGNATURE:   sigrc = '-'; break;
  ------------------
  |  Branch (1422:13): [True: 0, False: 0]
  ------------------
 1423|      0|            case GPG_ERR_NO_PUBKEY:
  ------------------
  |  Branch (1423:13): [True: 0, False: 0]
  ------------------
 1424|      0|            case GPG_ERR_UNUSABLE_PUBKEY: sigrc = '?'; break;
  ------------------
  |  Branch (1424:13): [True: 0, False: 0]
  ------------------
 1425|      0|            default:		          sigrc = '%'; break;
  ------------------
  |  Branch (1425:13): [True: 0, False: 0]
  ------------------
 1426|      0|	    }
 1427|      0|	}
 1428|      0|      else /* Check whether this is a self signature.  */
 1429|      0|        {
 1430|      0|          u32 keyid[2];
 1431|       |
 1432|      0|          if (c->list->pkt->pkttype == PKT_PUBLIC_KEY
  ------------------
  |  Branch (1432:15): [True: 0, False: 0]
  ------------------
 1433|      0|              || c->list->pkt->pkttype == PKT_SECRET_KEY )
  ------------------
  |  Branch (1433:18): [True: 0, False: 0]
  ------------------
 1434|      0|            {
 1435|      0|              keyid_from_pk (c->list->pkt->pkt.public_key, keyid);
 1436|       |
 1437|      0|              if (keyid[0] == sig->keyid[0] && keyid[1] == sig->keyid[1])
  ------------------
  |  Branch (1437:19): [True: 0, False: 0]
  |  Branch (1437:48): [True: 0, False: 0]
  ------------------
 1438|      0|                is_selfsig = 1;
 1439|      0|            }
 1440|      0|	}
 1441|       |
 1442|      0|      if (opt.with_colons)
  ------------------
  |  Branch (1442:11): [True: 0, False: 0]
  ------------------
 1443|      0|        {
 1444|      0|          es_putc (':', es_stdout);
 1445|      0|          if (sigrc != ' ')
  ------------------
  |  Branch (1445:15): [True: 0, False: 0]
  ------------------
 1446|      0|            es_putc (sigrc, es_stdout);
 1447|      0|          es_printf ("::%d:%08lX%08lX:%s:%s:", sig->pubkey_algo,
 1448|      0|                     (ulong)sig->keyid[0], (ulong)sig->keyid[1],
 1449|      0|                     colon_datestr_from_sig (sig),
 1450|      0|                     colon_expirestr_from_sig (sig));
 1451|       |
 1452|      0|          if (sig->trust_depth || sig->trust_value)
  ------------------
  |  Branch (1452:15): [True: 0, False: 0]
  |  Branch (1452:35): [True: 0, False: 0]
  ------------------
 1453|      0|            es_printf ("%d %d",sig->trust_depth,sig->trust_value);
 1454|      0|          es_putc (':', es_stdout);
 1455|       |
 1456|      0|          if (sig->trust_regexp)
  ------------------
  |  Branch (1456:15): [True: 0, False: 0]
  ------------------
 1457|      0|            es_write_sanitized (es_stdout, sig->trust_regexp,
 1458|      0|                                strlen (sig->trust_regexp), ":", NULL);
 1459|      0|          es_putc (':', es_stdout);
 1460|      0|	}
 1461|      0|      else
 1462|      0|        es_printf ("%c       %s %s   ",
 1463|      0|                   sigrc, keystr (sig->keyid), datestr_from_sig(sig));
 1464|      0|      if (sigrc == '%')
  ------------------
  |  Branch (1464:11): [True: 0, False: 0]
  ------------------
 1465|      0|        es_printf ("[%s] ", gpg_strerror (rc2) );
 1466|      0|      else if (sigrc == '?')
  ------------------
  |  Branch (1466:16): [True: 0, False: 0]
  ------------------
 1467|      0|        ;
 1468|      0|      else if (is_selfsig)
  ------------------
  |  Branch (1468:16): [True: 0, False: 0]
  ------------------
 1469|      0|        {
 1470|      0|          if (opt.with_colons)
  ------------------
  |  Branch (1470:15): [True: 0, False: 0]
  ------------------
 1471|      0|            es_putc (':', es_stdout);
 1472|      0|          es_fputs (sig->sig_class == 0x18? "[keybind]":"[selfsig]", es_stdout);
  ------------------
  |  Branch (1472:21): [True: 0, False: 0]
  ------------------
 1473|      0|          if (opt.with_colons)
  ------------------
  |  Branch (1473:15): [True: 0, False: 0]
  ------------------
 1474|      0|            es_putc (':', es_stdout);
 1475|      0|	}
 1476|      0|      else if (!opt.fast_list_mode)
  ------------------
  |  Branch (1476:16): [True: 0, False: 0]
  ------------------
 1477|      0|        {
 1478|      0|          p = get_user_id (c->ctrl, sig->keyid, &n, NULL);
 1479|      0|          es_write_sanitized (es_stdout, p, n,
 1480|      0|                              opt.with_colons?":":NULL, NULL );
  ------------------
  |  Branch (1480:31): [True: 0, False: 0]
  ------------------
 1481|      0|          xfree (p);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1482|      0|	}
 1483|      0|      if (opt.with_colons)
  ------------------
  |  Branch (1483:11): [True: 0, False: 0]
  ------------------
 1484|      0|        es_printf (":%02x%c:", sig->sig_class, sig->flags.exportable?'x':'l');
  ------------------
  |  Branch (1484:48): [True: 0, False: 0]
  ------------------
 1485|      0|      es_putc ('\n', es_stdout);
 1486|      0|    }
 1487|      0|  else
 1488|      0|    log_error ("invalid node with packet of type %d\n", node->pkt->pkttype);
 1489|  68.8k|}
mainproc.c:print_userid:
 1283|  38.9k|{
 1284|  38.9k|  if (!pkt)
  ------------------
  |  Branch (1284:7): [True: 0, False: 38.9k]
  ------------------
 1285|      0|    BUG();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1286|       |
 1287|  38.9k|  if (pkt->pkttype != PKT_USER_ID)
  ------------------
  |  Branch (1287:7): [True: 0, False: 38.9k]
  ------------------
 1288|      0|    {
 1289|      0|      es_printf ("ERROR: unexpected packet type %d", pkt->pkttype );
 1290|      0|      return;
 1291|      0|    }
 1292|  38.9k|  if (opt.with_colons)
  ------------------
  |  Branch (1292:7): [True: 0, False: 38.9k]
  ------------------
 1293|      0|    {
 1294|      0|      if (pkt->pkt.user_id->attrib_data)
  ------------------
  |  Branch (1294:11): [True: 0, False: 0]
  ------------------
 1295|      0|        es_printf("%u %lu",
 1296|      0|                  pkt->pkt.user_id->numattribs,
 1297|      0|                  pkt->pkt.user_id->attrib_len);
 1298|      0|      else
 1299|      0|        es_write_sanitized (es_stdout, pkt->pkt.user_id->name,
 1300|      0|                            pkt->pkt.user_id->len, ":", NULL);
 1301|      0|    }
 1302|  38.9k|  else
 1303|  38.9k|    print_utf8_buffer (es_stdout, pkt->pkt.user_id->name,
 1304|  38.9k|                       pkt->pkt.user_id->len );
 1305|  38.9k|}
mainproc.c:do_check_sig:
 1159|  11.0k|{
 1160|  11.0k|  PKT_signature *sig;
 1161|  11.0k|  gcry_md_hd_t md = NULL;
 1162|  11.0k|  gcry_md_hd_t md2 = NULL;
 1163|  11.0k|  gcry_md_hd_t md_good = NULL;
 1164|  11.0k|  int algo, rc;
 1165|       |
 1166|  11.0k|  if (r_pk)
  ------------------
  |  Branch (1166:7): [True: 11.0k, False: 0]
  ------------------
 1167|  11.0k|    *r_pk = NULL;
 1168|       |
 1169|  11.0k|  log_assert (node->pkt->pkttype == PKT_SIGNATURE);
 1170|  11.0k|  if (is_selfsig)
  ------------------
  |  Branch (1170:7): [True: 0, False: 11.0k]
  ------------------
 1171|      0|    *is_selfsig = 0;
 1172|  11.0k|  sig = node->pkt->pkt.signature;
 1173|       |
 1174|  11.0k|  algo = sig->digest_algo;
 1175|  11.0k|  rc = openpgp_md_test_algo (algo);
 1176|  11.0k|  if (rc)
  ------------------
  |  Branch (1176:7): [True: 4.93k, False: 6.09k]
  ------------------
 1177|  4.93k|    return rc;
 1178|       |
 1179|  6.09k|  if (sig->sig_class == 0x00)
  ------------------
  |  Branch (1179:7): [True: 2.53k, False: 3.55k]
  ------------------
 1180|  2.53k|    {
 1181|  2.53k|      if (c->mfx.md)
  ------------------
  |  Branch (1181:11): [True: 2.53k, False: 0]
  ------------------
 1182|  2.53k|        {
 1183|  2.53k|          if (gcry_md_copy (&md, c->mfx.md ))
  ------------------
  |  Branch (1183:15): [True: 0, False: 2.53k]
  ------------------
 1184|      0|            BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1185|  2.53k|        }
 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|  2.53k|    }
 1193|  3.55k|  else if (sig->sig_class == 0x01)
  ------------------
  |  Branch (1193:12): [True: 592, False: 2.96k]
  ------------------
 1194|    592|    {
 1195|       |      /* How do we know that we have to hash the (already hashed) text
 1196|       |         in canonical mode ??? (calculating both modes???) */
 1197|    592|      if (c->mfx.md)
  ------------------
  |  Branch (1197:11): [True: 592, False: 0]
  ------------------
 1198|    592|        {
 1199|    592|          if (gcry_md_copy (&md, c->mfx.md ))
  ------------------
  |  Branch (1199:15): [True: 0, False: 592]
  ------------------
 1200|      0|            BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1201|    592|          if (c->mfx.md2 && gcry_md_copy (&md2, c->mfx.md2))
  ------------------
  |  Branch (1201:15): [True: 0, False: 592]
  |  Branch (1201:29): [True: 0, False: 0]
  ------------------
 1202|      0|            BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1203|    592|	}
 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|    592|    }
 1214|  2.96k|  else if ((sig->sig_class&~3) == 0x10
  ------------------
  |  Branch (1214:12): [True: 624, False: 2.33k]
  ------------------
 1215|  2.96k|           ||   sig->sig_class == 0x18
  ------------------
  |  Branch (1215:17): [True: 37, False: 2.30k]
  ------------------
 1216|  2.96k|           ||   sig->sig_class == 0x1f
  ------------------
  |  Branch (1216:17): [True: 129, False: 2.17k]
  ------------------
 1217|  2.96k|	   ||   sig->sig_class == 0x20
  ------------------
  |  Branch (1217:10): [True: 166, False: 2.00k]
  ------------------
 1218|  2.96k|	   ||   sig->sig_class == 0x28
  ------------------
  |  Branch (1218:10): [True: 82, False: 1.92k]
  ------------------
 1219|  2.96k|           ||   sig->sig_class == 0x30)
  ------------------
  |  Branch (1219:17): [True: 395, False: 1.53k]
  ------------------
 1220|  1.43k|    {
 1221|  1.43k|      if (c->list->pkt->pkttype == PKT_PUBLIC_KEY
  ------------------
  |  Branch (1221:11): [True: 0, False: 1.43k]
  ------------------
 1222|  1.43k|          || c->list->pkt->pkttype == PKT_PUBLIC_SUBKEY)
  ------------------
  |  Branch (1222:14): [True: 0, False: 1.43k]
  ------------------
 1223|      0|        {
 1224|      0|          return check_key_signature (c->ctrl, c->list, node, is_selfsig);
 1225|      0|	}
 1226|  1.43k|      else if (sig->sig_class == 0x20)
  ------------------
  |  Branch (1226:16): [True: 166, False: 1.26k]
  ------------------
 1227|    166|        {
 1228|    166|          log_error (_("standalone revocation - "
  ------------------
  |  |   28|    166|#  define _(a) gettext (a)
  ------------------
 1229|    166|                       "use \"gpg --import\" to apply\n"));
 1230|    166|          return GPG_ERR_NOT_PROCESSED;
 1231|    166|	}
 1232|  1.26k|      else
 1233|  1.26k|        {
 1234|  1.26k|          log_error ("invalid root packet for sigclass %02x\n", sig->sig_class);
 1235|  1.26k|          return GPG_ERR_SIG_CLASS;
 1236|  1.26k|	}
 1237|  1.43k|    }
 1238|  1.53k|  else
 1239|  1.53k|    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|  3.12k|  rc = check_signature2 (c->ctrl, sig, md, extrahash, extrahashlen,
 1244|  3.12k|                         forced_pk,
 1245|  3.12k|                         NULL, is_expkey, is_revkey, r_pk);
 1246|  3.12k|  if (! rc)
  ------------------
  |  Branch (1246:7): [True: 0, False: 3.12k]
  ------------------
 1247|      0|    md_good = md;
 1248|  3.12k|  else if (gpg_err_code (rc) == GPG_ERR_BAD_SIGNATURE && md2)
  ------------------
  |  Branch (1248:12): [True: 0, False: 3.12k]
  |  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|  3.12k|  if (md_good)
  ------------------
  |  Branch (1267:7): [True: 0, False: 3.12k]
  ------------------
 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|  3.12k|  gcry_md_close (md);
 1275|  3.12k|  gcry_md_close (md2);
 1276|       |
 1277|  3.12k|  return rc;
 1278|  6.09k|}
mainproc.c:check_sig_and_print:
 1868|  16.5k|{
 1869|  16.5k|  PKT_signature *sig = node->pkt->pkt.signature;
 1870|  16.5k|  const char *astr;
 1871|  16.5k|  gpg_error_t rc;
 1872|  16.5k|  int is_expkey = 0;
 1873|  16.5k|  int is_revkey = 0;
 1874|  16.5k|  char *issuer_fpr = NULL;
 1875|  16.5k|  PKT_public_key *pk = NULL;  /* The public key for the signature or NULL. */
 1876|  16.5k|  const void *extrahash = NULL;
 1877|  16.5k|  size_t extrahashlen = 0;
 1878|  16.5k|  kbnode_t included_keyblock = NULL;
 1879|       |
 1880|  16.5k|  if (opt.skip_verify)
  ------------------
  |  Branch (1880:7): [True: 0, False: 16.5k]
  ------------------
 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|  16.5k|  {
 1913|  16.5k|    kbnode_t n;
 1914|  16.5k|    int n_onepass, n_sig;
 1915|       |
 1916|       |/*     log_debug ("checking signature packet composition\n"); */
 1917|       |/*     dump_kbnode (c->list); */
 1918|       |
 1919|  16.5k|    n = c->list;
 1920|  16.5k|    log_assert (n);
 1921|  16.5k|    if ( n->pkt->pkttype == PKT_SIGNATURE )
  ------------------
  |  Branch (1921:10): [True: 9.52k, False: 7.03k]
  ------------------
 1922|  9.52k|      {
 1923|       |        /* This is either "S{1,n}" case (detached signature) or
 1924|       |           "S{1,n} P" (old style PGP2 signature). */
 1925|   236k|        for (n = n->next; n; n = n->next)
  ------------------
  |  Branch (1925:27): [True: 231k, False: 5.37k]
  ------------------
 1926|   231k|          if (n->pkt->pkttype != PKT_SIGNATURE)
  ------------------
  |  Branch (1926:15): [True: 4.15k, False: 226k]
  ------------------
 1927|  4.15k|            break;
 1928|  9.52k|        if (!n)
  ------------------
  |  Branch (1928:13): [True: 5.37k, False: 4.15k]
  ------------------
 1929|  5.37k|          ; /* Okay, this is a detached signature.  */
 1930|  4.15k|        else if (n->pkt->pkttype == PKT_GPG_CONTROL
  ------------------
  |  Branch (1930:18): [True: 3.59k, False: 558]
  ------------------
 1931|  4.15k|                 && (n->pkt->pkt.gpg_control->control
  ------------------
  |  Branch (1931:21): [True: 3.52k, False: 70]
  ------------------
 1932|  3.59k|                     == CTRLPKT_PLAINTEXT_MARK) )
 1933|  3.52k|          {
 1934|  3.52k|            if (n->next)
  ------------------
  |  Branch (1934:17): [True: 777, False: 2.74k]
  ------------------
 1935|    777|              goto ambiguous;  /* We only allow one P packet. */
 1936|  2.74k|            extrahash = n->pkt->pkt.gpg_control->data;
 1937|  2.74k|            extrahashlen = n->pkt->pkt.gpg_control->datalen;
 1938|  2.74k|          }
 1939|    628|        else
 1940|    628|          goto ambiguous;
 1941|  9.52k|      }
 1942|  7.03k|    else if (n->pkt->pkttype == PKT_ONEPASS_SIG)
  ------------------
  |  Branch (1942:14): [True: 4.70k, False: 2.33k]
  ------------------
 1943|  4.70k|      {
 1944|       |        /* This is the "O{1,n} P S{1,n}" case (standard signature). */
 1945|  4.70k|        for (n_onepass=1, n = n->next;
 1946|  5.55k|             n && n->pkt->pkttype == PKT_ONEPASS_SIG; n = n->next)
  ------------------
  |  Branch (1946:14): [True: 5.55k, False: 0]
  |  Branch (1946:19): [True: 848, False: 4.70k]
  ------------------
 1947|    848|          n_onepass++;
 1948|  4.70k|        if (!n || !(n->pkt->pkttype == PKT_GPG_CONTROL
  ------------------
  |  Branch (1948:13): [True: 0, False: 4.70k]
  |  Branch (1948:21): [True: 3.80k, False: 900]
  ------------------
 1949|  4.70k|                    && (n->pkt->pkt.gpg_control->control
  ------------------
  |  Branch (1949:24): [True: 3.80k, False: 0]
  ------------------
 1950|  3.80k|                        == CTRLPKT_PLAINTEXT_MARK)))
 1951|    900|          goto ambiguous;
 1952|  3.80k|        extrahash = n->pkt->pkt.gpg_control->data;
 1953|  3.80k|        extrahashlen = n->pkt->pkt.gpg_control->datalen;
 1954|       |
 1955|  3.80k|        for (n_sig=0, n = n->next;
 1956|  4.14M|             n && n->pkt->pkttype == PKT_SIGNATURE; n = n->next)
  ------------------
  |  Branch (1956:14): [True: 4.13M, False: 2.64k]
  |  Branch (1956:19): [True: 4.13M, False: 1.15k]
  ------------------
 1957|  4.13M|          n_sig++;
 1958|  3.80k|        if (!n_sig)
  ------------------
  |  Branch (1958:13): [True: 533, False: 3.26k]
  ------------------
 1959|    533|          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|  3.26k|        if (n_onepass != n_sig)
  ------------------
  |  Branch (1969:13): [True: 2.45k, False: 819]
  ------------------
 1970|  2.45k|          {
 1971|  2.45k|            log_info ("number of one-pass packets does not match "
 1972|  2.45k|                      "number of signature packets\n");
 1973|  2.45k|            goto ambiguous;
 1974|  2.45k|          }
 1975|  3.26k|      }
 1976|  2.33k|    else if (n->pkt->pkttype == PKT_GPG_CONTROL
  ------------------
  |  Branch (1976:14): [True: 2.33k, False: 0]
  ------------------
 1977|  2.33k|             && n->pkt->pkt.gpg_control->control == CTRLPKT_CLEARSIGN_START )
  ------------------
  |  Branch (1977:17): [True: 2.22k, False: 116]
  ------------------
 1978|  2.22k|      {
 1979|       |        /* This is the "C P S{1,n}" case (clear text signature). */
 1980|  2.22k|        n = n->next;
 1981|  2.22k|        if (!n || !(n->pkt->pkttype == PKT_GPG_CONTROL
  ------------------
  |  Branch (1981:13): [True: 0, False: 2.22k]
  |  Branch (1981:21): [True: 2.22k, False: 0]
  ------------------
 1982|  2.22k|                    && (n->pkt->pkt.gpg_control->control
  ------------------
  |  Branch (1982:24): [True: 2.22k, False: 0]
  ------------------
 1983|  2.22k|                        == CTRLPKT_PLAINTEXT_MARK)))
 1984|      0|          goto ambiguous;
 1985|  2.22k|        extrahash = n->pkt->pkt.gpg_control->data;
 1986|  2.22k|        extrahashlen = n->pkt->pkt.gpg_control->datalen;
 1987|  2.22k|        for (n_sig=0, n = n->next;
 1988|  47.7k|             n && n->pkt->pkttype == PKT_SIGNATURE; n = n->next)
  ------------------
  |  Branch (1988:14): [True: 45.6k, False: 2.08k]
  |  Branch (1988:19): [True: 45.4k, False: 133]
  ------------------
 1989|  45.4k|          n_sig++;
 1990|  2.22k|        if (n || !n_sig)
  ------------------
  |  Branch (1990:13): [True: 133, False: 2.08k]
  |  Branch (1990:18): [True: 0, False: 2.08k]
  ------------------
 1991|    133|          goto ambiguous;
 1992|  2.22k|      }
 1993|    116|    else
 1994|    116|      {
 1995|  5.53k|      ambiguous:
 1996|  5.53k|        log_error(_("can't handle this ambiguous signature data\n"));
  ------------------
  |  |   28|  5.53k|#  define _(a) gettext (a)
  ------------------
 1997|  5.53k|        return 0;
 1998|    116|      }
 1999|  16.5k|  } /* End checking signature packet composition.  */
 2000|       |
 2001|  11.0k|  if (sig->signers_uid)
  ------------------
  |  Branch (2001:7): [True: 1.78k, False: 9.24k]
  ------------------
 2002|  1.78k|    write_status_buffer (STATUS_NEWSIG,
 2003|  1.78k|                         sig->signers_uid, strlen (sig->signers_uid), 0);
 2004|  9.24k|  else
 2005|  9.24k|    write_status_text (STATUS_NEWSIG, NULL);
 2006|       |
 2007|  11.0k|  astr = openpgp_pk_algo_name ( sig->pubkey_algo );
 2008|  11.0k|  issuer_fpr = issuer_fpr_string (sig);
 2009|       |
 2010|  11.0k|  if (issuer_fpr)
  ------------------
  |  Branch (2010:7): [True: 856, False: 10.1k]
  ------------------
 2011|    856|    {
 2012|    856|      log_info (_("Signature made %s\n"), asctimestamp(sig->timestamp));
  ------------------
  |  |   28|    856|#  define _(a) gettext (a)
  ------------------
 2013|    856|      log_info (_("               using %s key %s\n"),
  ------------------
  |  |   28|    856|#  define _(a) gettext (a)
  ------------------
 2014|    856|                astr? astr: "?", issuer_fpr);
  ------------------
  |  Branch (2014:17): [True: 856, False: 0]
  ------------------
 2015|       |
 2016|    856|    }
 2017|  10.1k|  else if (!keystrlen () || keystrlen () > 8)
  ------------------
  |  Branch (2017:12): [True: 10.1k, False: 0]
  |  Branch (2017:29): [True: 0, False: 0]
  ------------------
 2018|  10.1k|    {
 2019|  10.1k|      log_info (_("Signature made %s\n"), asctimestamp(sig->timestamp));
  ------------------
  |  |   28|  10.1k|#  define _(a) gettext (a)
  ------------------
 2020|  10.1k|      log_info (_("               using %s key %s\n"),
  ------------------
  |  |   28|  10.1k|#  define _(a) gettext (a)
  ------------------
 2021|  10.1k|                astr? astr: "?", keystr(sig->keyid));
  ------------------
  |  Branch (2021:17): [True: 10.1k, False: 0]
  ------------------
 2022|  10.1k|    }
 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|  11.0k|  if (sig->signers_uid)
  ------------------
  |  Branch (2029:7): [True: 1.78k, False: 9.24k]
  ------------------
 2030|  1.78k|    log_info (_("               issuer \"%s\"\n"), sig->signers_uid);
  ------------------
  |  |   28|  1.78k|#  define _(a) gettext (a)
  ------------------
 2031|       |
 2032|  11.0k|  rc = do_check_sig (c, node, extrahash, extrahashlen, NULL,
 2033|  11.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|  11.0k|  if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY
  ------------------
  |  Branch (2037:7): [True: 2.96k, False: 8.06k]
  ------------------
 2038|  11.0k|      && sig->flags.key_block
  ------------------
  |  Branch (2038:10): [True: 19, False: 2.94k]
  ------------------
 2039|  11.0k|      && opt.flags.auto_key_import)
  ------------------
  |  Branch (2039:10): [True: 0, False: 19]
  ------------------
 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|  11.0k|  if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY
  ------------------
  |  Branch (2071:7): [True: 2.96k, False: 8.06k]
  ------------------
 2072|  11.0k|      && sig->flags.pref_ks)
  ------------------
  |  Branch (2072:10): [True: 635, False: 2.33k]
  ------------------
 2073|    635|    {
 2074|    635|      const byte *p;
 2075|    635|      int seq = 0;
 2076|    635|      size_t n;
 2077|    635|      int any_pref_ks = 0;
 2078|       |
 2079|  1.54k|      while ((p=enum_sig_subpkt (sig, 1, SIGSUBPKT_PREF_KS, &n, &seq, NULL)))
  ------------------
  |  Branch (2079:14): [True: 907, False: 635]
  ------------------
 2080|    907|        {
 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|    907|          log_info(_("Key available at: ") );
  ------------------
  |  |   28|    907|#  define _(a) gettext (a)
  ------------------
 2086|    907|          print_utf8_buffer (log_get_stream(), p, n);
 2087|    907|          log_printf ("\n");
 2088|    907|          any_pref_ks = 1;
 2089|       |
 2090|    907|          if ((opt.keyserver_options.options&KEYSERVER_AUTO_KEY_RETRIEVE)
  ------------------
  |  |  443|    907|#define KEYSERVER_AUTO_KEY_RETRIEVE      (1<<3)
  ------------------
  |  Branch (2090:15): [True: 0, False: 907]
  ------------------
 2091|    907|              && (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|    907|        }
 2123|       |
 2124|    635|      if (any_pref_ks
  ------------------
  |  Branch (2124:11): [True: 635, False: 0]
  ------------------
 2125|    635|          && (opt.keyserver_options.options&KEYSERVER_AUTO_KEY_RETRIEVE)
  ------------------
  |  |  443|    635|#define KEYSERVER_AUTO_KEY_RETRIEVE      (1<<3)
  ------------------
  |  Branch (2125:14): [True: 0, False: 635]
  ------------------
 2126|    635|          && !(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|    635|    }
 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|  11.0k|  if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY
  ------------------
  |  Branch (2134:7): [True: 2.96k, False: 8.06k]
  ------------------
 2135|  11.0k|      && (opt.keyserver_options.options & KEYSERVER_AUTO_KEY_RETRIEVE)
  ------------------
  |  |  443|  2.96k|#define KEYSERVER_AUTO_KEY_RETRIEVE      (1<<3)
  ------------------
  |  Branch (2135:10): [True: 0, False: 2.96k]
  ------------------
 2136|  11.0k|      && !opt.flags.disable_signer_uid
  ------------------
  |  Branch (2136:10): [True: 0, False: 0]
  ------------------
 2137|  11.0k|      && akl_has_wkd_method ()
  ------------------
  |  Branch (2137:10): [True: 0, False: 0]
  ------------------
 2138|  11.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|  11.0k|  if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY
  ------------------
  |  Branch (2162:7): [True: 2.96k, False: 8.06k]
  ------------------
 2163|  11.0k|      && (opt.keyserver_options.options&KEYSERVER_AUTO_KEY_RETRIEVE)
  ------------------
  |  |  443|  2.96k|#define KEYSERVER_AUTO_KEY_RETRIEVE      (1<<3)
  ------------------
  |  Branch (2163:10): [True: 0, False: 2.96k]
  ------------------
 2164|  11.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|  11.0k|  if (!rc || gpg_err_code (rc) == GPG_ERR_BAD_SIGNATURE)
  ------------------
  |  Branch (2192:7): [True: 0, False: 11.0k]
  |  Branch (2192:14): [True: 0, False: 11.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|  11.0k|  else  /* Error checking the signature. (neither Good nor Bad).  */
 2546|  11.0k|    {
 2547|  11.0k|      write_status_printf (STATUS_ERRSIG, "%08lX%08lX %d %d %02x %lu %d %s",
 2548|  11.0k|                           (ulong)sig->keyid[0], (ulong)sig->keyid[1],
 2549|  11.0k|                           sig->pubkey_algo, sig->digest_algo,
 2550|  11.0k|                           sig->sig_class, (ulong)sig->timestamp,
 2551|  11.0k|                           gpg_err_code (rc),
 2552|  11.0k|                           issuer_fpr? issuer_fpr:"-");
  ------------------
  |  Branch (2552:28): [True: 856, False: 10.1k]
  ------------------
 2553|  11.0k|      if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY)
  ------------------
  |  Branch (2553:11): [True: 2.96k, False: 8.06k]
  ------------------
 2554|  2.96k|        {
 2555|  2.96k|          write_status_printf (STATUS_NO_PUBKEY, "%08lX%08lX",
 2556|  2.96k|                               (ulong)sig->keyid[0], (ulong)sig->keyid[1]);
 2557|  2.96k|	}
 2558|  11.0k|      if (gpg_err_code (rc) != GPG_ERR_NOT_PROCESSED)
  ------------------
  |  Branch (2558:11): [True: 10.8k, False: 166]
  ------------------
 2559|  10.8k|        log_error (_("Can't check signature: %s\n"), gpg_strerror (rc));
  ------------------
  |  |   28|  10.8k|#  define _(a) gettext (a)
  ------------------
 2560|  11.0k|    }
 2561|       |
 2562|  11.0k|  free_public_key (pk);
 2563|  11.0k|  release_kbnode (included_keyblock);
 2564|  11.0k|  xfree (issuer_fpr);
  ------------------
  |  |  104|  11.0k|#define xfree(a)         gcry_free ((a))
  ------------------
 2565|  11.0k|  return rc;
 2566|  11.0k|}
mainproc.c:add_subkey:
  216|  12.0k|{
  217|  12.0k|  if (!c->list)
  ------------------
  |  Branch (217:7): [True: 1.51k, False: 10.4k]
  ------------------
  218|  1.51k|    {
  219|  1.51k|      log_error ("subkey w/o mainkey\n");
  220|  1.51k|      return 0;
  221|  1.51k|    }
  222|  10.4k|  add_kbnode (c->list, new_kbnode (pkt));
  223|  10.4k|  return 1;
  224|  12.0k|}
mainproc.c:add_user_id:
  203|  50.9k|{
  204|  50.9k|  if (!c->list)
  ------------------
  |  Branch (204:7): [True: 5.97k, False: 44.9k]
  ------------------
  205|  5.97k|    {
  206|  5.97k|      log_error ("orphaned user ID\n");
  207|  5.97k|      return 0;
  208|  5.97k|    }
  209|  44.9k|  add_kbnode (c->list, new_kbnode (pkt));
  210|  44.9k|  return 1;
  211|  50.9k|}

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

is_secured_file:
  164|  17.0k|{
  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|  17.0k|  (void)fd;
  189|  17.0k|#endif /*!ENABLE_SELINUX_HACKS*/
  190|  17.0k|  return 0; /* No. */
  191|  17.0k|}
is_secured_filename:
  199|  1.01k|{
  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|  1.01k|  (void)fname;
  226|  1.01k|#endif /*!ENABLE_SELINUX_HACKS*/
  227|  1.01k|  return 0; /* No. */
  228|  1.01k|}
map_cipher_openpgp_to_gcry:
  456|   129k|{
  457|   129k|  switch (algo)
  458|   129k|    {
  459|    120|    case CIPHER_ALGO_NONE:        return GCRY_CIPHER_NONE;
  ------------------
  |  Branch (459:5): [True: 120, False: 128k]
  ------------------
  460|       |
  461|      0|#ifdef GPG_USE_IDEA
  462|   125k|    case CIPHER_ALGO_IDEA:        return GCRY_CIPHER_IDEA;
  ------------------
  |  Branch (462:5): [True: 125k, False: 3.47k]
  ------------------
  463|       |#else
  464|       |    case CIPHER_ALGO_IDEA:        return 0;
  465|       |#endif
  466|       |
  467|    264|    case CIPHER_ALGO_3DES:	  return GCRY_CIPHER_3DES;
  ------------------
  |  Branch (467:5): [True: 264, False: 128k]
  ------------------
  468|       |
  469|      0|#ifdef GPG_USE_CAST5
  470|    248|    case CIPHER_ALGO_CAST5:	  return GCRY_CIPHER_CAST5;
  ------------------
  |  Branch (470:5): [True: 248, False: 128k]
  ------------------
  471|       |#else
  472|       |    case CIPHER_ALGO_CAST5:	  return 0;
  473|       |#endif
  474|       |
  475|      0|#ifdef GPG_USE_BLOWFISH
  476|    137|    case CIPHER_ALGO_BLOWFISH:    return GCRY_CIPHER_BLOWFISH;
  ------------------
  |  Branch (476:5): [True: 137, False: 128k]
  ------------------
  477|       |#else
  478|       |    case CIPHER_ALGO_BLOWFISH:    return 0;
  479|       |#endif
  480|       |
  481|      0|#ifdef GPG_USE_AES128
  482|    149|    case CIPHER_ALGO_AES:         return GCRY_CIPHER_AES;
  ------------------
  |  Branch (482:5): [True: 149, False: 128k]
  ------------------
  483|       |#else
  484|       |    case CIPHER_ALGO_AES:         return 0;
  485|       |#endif
  486|       |
  487|      0|#ifdef GPG_USE_AES192
  488|    223|    case CIPHER_ALGO_AES192:      return GCRY_CIPHER_AES192;
  ------------------
  |  Branch (488:5): [True: 223, False: 128k]
  ------------------
  489|       |#else
  490|       |    case CIPHER_ALGO_AES192:      return 0;
  491|       |#endif
  492|       |
  493|      0|#ifdef GPG_USE_AES256
  494|    630|    case CIPHER_ALGO_AES256:      return GCRY_CIPHER_AES256;
  ------------------
  |  Branch (494:5): [True: 630, False: 128k]
  ------------------
  495|       |#else
  496|       |    case CIPHER_ALGO_AES256:      return 0;
  497|       |#endif
  498|       |
  499|      0|#ifdef GPG_USE_TWOFISH
  500|    584|    case CIPHER_ALGO_TWOFISH:     return GCRY_CIPHER_TWOFISH;
  ------------------
  |  Branch (500:5): [True: 584, False: 128k]
  ------------------
  501|       |#else
  502|       |    case CIPHER_ALGO_TWOFISH:     return 0;
  503|       |#endif
  504|       |
  505|      0|#ifdef GPG_USE_CAMELLIA128
  506|    254|    case CIPHER_ALGO_CAMELLIA128: return GCRY_CIPHER_CAMELLIA128;
  ------------------
  |  Branch (506:5): [True: 254, False: 128k]
  ------------------
  507|       |#else
  508|       |    case CIPHER_ALGO_CAMELLIA128: return 0;
  509|       |#endif
  510|       |
  511|      0|#ifdef GPG_USE_CAMELLIA192
  512|     19|    case CIPHER_ALGO_CAMELLIA192: return GCRY_CIPHER_CAMELLIA192;
  ------------------
  |  Branch (512:5): [True: 19, False: 128k]
  ------------------
  513|       |#else
  514|       |    case CIPHER_ALGO_CAMELLIA192: return 0;
  515|       |#endif
  516|       |
  517|      0|#ifdef GPG_USE_CAMELLIA256
  518|     50|    case CIPHER_ALGO_CAMELLIA256: return GCRY_CIPHER_CAMELLIA256;
  ------------------
  |  Branch (518:5): [True: 50, False: 128k]
  ------------------
  519|       |#else
  520|       |    case CIPHER_ALGO_CAMELLIA256: return 0;
  521|       |#endif
  522|    797|    default: return 0;
  ------------------
  |  Branch (522:5): [True: 797, False: 128k]
  ------------------
  523|   129k|    }
  524|   129k|}
openpgp_cipher_blocklen:
  552|  5.98k|{
  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|  5.98k|  switch (algo)
  561|  5.98k|    {
  562|     26|    case CIPHER_ALGO_AES:
  ------------------
  |  Branch (562:5): [True: 26, False: 5.95k]
  ------------------
  563|     35|    case CIPHER_ALGO_AES192:
  ------------------
  |  Branch (563:5): [True: 9, False: 5.97k]
  ------------------
  564|    970|    case CIPHER_ALGO_AES256:
  ------------------
  |  Branch (564:5): [True: 935, False: 5.05k]
  ------------------
  565|    970|    case CIPHER_ALGO_TWOFISH:
  ------------------
  |  Branch (565:5): [True: 0, False: 5.98k]
  ------------------
  566|    970|    case CIPHER_ALGO_CAMELLIA128:
  ------------------
  |  Branch (566:5): [True: 0, False: 5.98k]
  ------------------
  567|  1.02k|    case CIPHER_ALGO_CAMELLIA192:
  ------------------
  |  Branch (567:5): [True: 53, False: 5.93k]
  ------------------
  568|  1.02k|    case CIPHER_ALGO_CAMELLIA256:
  ------------------
  |  Branch (568:5): [True: 4, False: 5.98k]
  ------------------
  569|  1.02k|      return 16;
  570|       |
  571|  4.95k|    default:
  ------------------
  |  Branch (571:5): [True: 4.95k, False: 1.02k]
  ------------------
  572|  4.95k|      return 8;
  573|  5.98k|    }
  574|  5.98k|}
openpgp_cipher_test_algo:
  582|   129k|{
  583|   129k|  enum gcry_cipher_algos ga;
  584|       |
  585|   129k|  ga = map_cipher_openpgp_to_gcry (algo);
  586|   129k|  if (!ga)
  ------------------
  |  Branch (586:7): [True: 917, False: 128k]
  ------------------
  587|    917|    return gpg_error (GPG_ERR_CIPHER_ALGO);
  588|       |
  589|   128k|  return gcry_cipher_test_algo (ga);
  590|   129k|}
openpgp_cipher_algo_name:
  597|  3.48k|{
  598|  3.48k|  switch (algo)
  599|  3.48k|    {
  600|      6|    case CIPHER_ALGO_IDEA:        return "IDEA";
  ------------------
  |  Branch (600:5): [True: 6, False: 3.47k]
  ------------------
  601|    264|    case CIPHER_ALGO_3DES:	  return "3DES";
  ------------------
  |  Branch (601:5): [True: 264, False: 3.21k]
  ------------------
  602|    248|    case CIPHER_ALGO_CAST5:	  return "CAST5";
  ------------------
  |  Branch (602:5): [True: 248, False: 3.23k]
  ------------------
  603|    137|    case CIPHER_ALGO_BLOWFISH:    return "BLOWFISH";
  ------------------
  |  Branch (603:5): [True: 137, False: 3.34k]
  ------------------
  604|    149|    case CIPHER_ALGO_AES:         return "AES";
  ------------------
  |  Branch (604:5): [True: 149, False: 3.33k]
  ------------------
  605|    223|    case CIPHER_ALGO_AES192:      return "AES192";
  ------------------
  |  Branch (605:5): [True: 223, False: 3.25k]
  ------------------
  606|    630|    case CIPHER_ALGO_AES256:      return "AES256";
  ------------------
  |  Branch (606:5): [True: 630, False: 2.85k]
  ------------------
  607|    584|    case CIPHER_ALGO_TWOFISH:     return "TWOFISH";
  ------------------
  |  Branch (607:5): [True: 584, False: 2.89k]
  ------------------
  608|    254|    case CIPHER_ALGO_CAMELLIA128: return "CAMELLIA128";
  ------------------
  |  Branch (608:5): [True: 254, False: 3.22k]
  ------------------
  609|     19|    case CIPHER_ALGO_CAMELLIA192: return "CAMELLIA192";
  ------------------
  |  Branch (609:5): [True: 19, False: 3.46k]
  ------------------
  610|     50|    case CIPHER_ALGO_CAMELLIA256: return "CAMELLIA256";
  ------------------
  |  Branch (610:5): [True: 50, False: 3.43k]
  ------------------
  611|    120|    case CIPHER_ALGO_NONE:
  ------------------
  |  Branch (611:5): [True: 120, False: 3.36k]
  ------------------
  612|    917|    default: return "?";
  ------------------
  |  Branch (612:5): [True: 797, False: 2.68k]
  ------------------
  613|  3.48k|    }
  614|  3.48k|}
openpgp_aead_algo_name:
  658|    315|{
  659|    315|  switch (algo)
  ------------------
  |  Branch (659:11): [True: 315, False: 0]
  ------------------
  660|    315|    {
  661|      0|    case AEAD_ALGO_NONE:  break;
  ------------------
  |  Branch (661:5): [True: 0, False: 315]
  ------------------
  662|      0|    case AEAD_ALGO_EAX:   return "EAX";
  ------------------
  |  Branch (662:5): [True: 0, False: 315]
  ------------------
  663|      0|    case AEAD_ALGO_OCB:   return "OCB";
  ------------------
  |  Branch (663:5): [True: 0, False: 315]
  ------------------
  664|    315|    }
  665|       |
  666|    315|  return "?";
  667|    315|}
openpgp_pk_test_algo:
  701|  36.2k|{
  702|  36.2k|  return openpgp_pk_test_algo2 (algo, 0);
  703|  36.2k|}
openpgp_pk_test_algo2:
  710|  36.2k|{
  711|  36.2k|  enum gcry_pk_algos ga = 0;
  712|  36.2k|  size_t use_buf = use;
  713|       |
  714|  36.2k|  switch (algo)
  715|  36.2k|    {
  716|      0|#ifdef GPG_USE_RSA
  717|  4.02k|    case PUBKEY_ALGO_RSA:       ga = GCRY_PK_RSA;   break;
  ------------------
  |  Branch (717:5): [True: 4.02k, False: 32.2k]
  ------------------
  718|  1.94k|    case PUBKEY_ALGO_RSA_E:     ga = GCRY_PK_RSA_E; break;
  ------------------
  |  Branch (718:5): [True: 1.94k, False: 34.3k]
  ------------------
  719|    852|    case PUBKEY_ALGO_RSA_S:     ga = GCRY_PK_RSA_S; break;
  ------------------
  |  Branch (719:5): [True: 852, False: 35.4k]
  ------------------
  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|  7.23k|    case PUBKEY_ALGO_ELGAMAL_E: ga = GCRY_PK_ELG;   break;
  ------------------
  |  Branch (726:5): [True: 7.23k, False: 29.0k]
  ------------------
  727|  8.46k|    case PUBKEY_ALGO_DSA:       ga = GCRY_PK_DSA;   break;
  ------------------
  |  Branch (727:5): [True: 8.46k, False: 27.8k]
  ------------------
  728|       |
  729|      0|#ifdef GPG_USE_ECDH
  730|  1.66k|    case PUBKEY_ALGO_ECDH:      ga = GCRY_PK_ECC;   break;
  ------------------
  |  Branch (730:5): [True: 1.66k, False: 34.5k]
  ------------------
  731|       |#else
  732|       |    case PUBKEY_ALGO_ECDH:      break;
  733|       |#endif
  734|       |
  735|      0|#ifdef GPG_USE_ECDSA
  736|  5.97k|    case PUBKEY_ALGO_ECDSA:     ga = GCRY_PK_ECC;   break;
  ------------------
  |  Branch (736:5): [True: 5.97k, False: 30.2k]
  ------------------
  737|       |#else
  738|       |    case PUBKEY_ALGO_ECDSA:     break;
  739|       |#endif
  740|       |
  741|      0|#ifdef GPG_USE_EDDSA
  742|  4.47k|    case PUBKEY_ALGO_EDDSA:     ga = GCRY_PK_ECC;   break;
  ------------------
  |  Branch (742:5): [True: 4.47k, False: 31.7k]
  ------------------
  743|       |#else
  744|       |    case PUBKEY_ALGO_EDDSA:     break;
  745|       |#endif
  746|       |
  747|     51|    case PUBKEY_ALGO_ELGAMAL:
  ------------------
  |  Branch (747:5): [True: 51, False: 36.2k]
  ------------------
  748|       |      /* Don't allow type 20 keys unless in rfc2440 mode.  */
  749|     51|      if (RFC2440)
  ------------------
  |  |  373|     51|#define RFC2440 (opt.compliance==CO_RFC2440)
  |  |  ------------------
  |  |  |  Branch (373:17): [True: 0, False: 51]
  |  |  ------------------
  ------------------
  750|      0|        ga = GCRY_PK_ELG;
  751|     51|      break;
  752|       |
  753|  1.57k|    default:
  ------------------
  |  Branch (753:5): [True: 1.57k, False: 34.6k]
  ------------------
  754|  1.57k|      break;
  755|  36.2k|    }
  756|  36.2k|  if (!ga)
  ------------------
  |  Branch (756:7): [True: 1.62k, False: 34.6k]
  ------------------
  757|  1.62k|    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|  34.6k|  if (ga == GCRY_PK_ELG && (use & (PUBKEY_USAGE_CERT | PUBKEY_USAGE_SIG)))
  ------------------
  |  |   51|  7.23k|#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|  7.23k|#define PUBKEY_USAGE_SIG     GCRY_PK_USAGE_SIGN  /* Good for signatures. */
  ------------------
  |  Branch (763:7): [True: 7.23k, False: 27.4k]
  |  Branch (763:28): [True: 0, False: 7.23k]
  ------------------
  764|      0|    return gpg_error (GPG_ERR_WRONG_PUBKEY_ALGO);
  765|       |
  766|       |  /* Now check whether Libgcrypt has support for the algorithm.  */
  767|  34.6k|  return gcry_pk_algo_info (ga, GCRYCTL_TEST_ALGO, NULL, &use_buf);
  768|  34.6k|}
openpgp_pk_algo_usage:
  773|  41.2k|{
  774|  41.2k|    int use = 0;
  775|       |
  776|       |    /* They are hardwired in gpg 1.0. */
  777|  41.2k|    switch ( algo ) {
  778|  2.73k|      case PUBKEY_ALGO_RSA:
  ------------------
  |  Branch (778:7): [True: 2.73k, False: 38.5k]
  ------------------
  779|  2.73k|          use = (PUBKEY_USAGE_CERT | PUBKEY_USAGE_SIG
  ------------------
  |  |   51|  2.73k|#define PUBKEY_USAGE_CERT    GCRY_PK_USAGE_CERT  /* Also good to certify keys.*/
  ------------------
                        use = (PUBKEY_USAGE_CERT | PUBKEY_USAGE_SIG
  ------------------
  |  |   49|  2.73k|#define PUBKEY_USAGE_SIG     GCRY_PK_USAGE_SIGN  /* Good for signatures. */
  ------------------
  780|  2.73k|                 | PUBKEY_USAGE_ENC | PUBKEY_USAGE_AUTH);
  ------------------
  |  |   50|  2.73k|#define PUBKEY_USAGE_ENC     GCRY_PK_USAGE_ENCR  /* Good for encryption. */
  ------------------
                               | PUBKEY_USAGE_ENC | PUBKEY_USAGE_AUTH);
  ------------------
  |  |   52|  2.73k|#define PUBKEY_USAGE_AUTH    GCRY_PK_USAGE_AUTH  /* Good for authentication. */
  ------------------
  781|  2.73k|          break;
  782|    545|      case PUBKEY_ALGO_RSA_E:
  ------------------
  |  Branch (782:7): [True: 545, False: 40.7k]
  ------------------
  783|  1.40k|      case PUBKEY_ALGO_ECDH:
  ------------------
  |  Branch (783:7): [True: 860, False: 40.4k]
  ------------------
  784|  1.40k|          use = PUBKEY_USAGE_ENC;
  ------------------
  |  |   50|  1.40k|#define PUBKEY_USAGE_ENC     GCRY_PK_USAGE_ENCR  /* Good for encryption. */
  ------------------
  785|  1.40k|          break;
  786|  1.70k|      case PUBKEY_ALGO_RSA_S:
  ------------------
  |  Branch (786:7): [True: 1.70k, False: 39.5k]
  ------------------
  787|  1.70k|          use = PUBKEY_USAGE_CERT | PUBKEY_USAGE_SIG;
  ------------------
  |  |   51|  1.70k|#define PUBKEY_USAGE_CERT    GCRY_PK_USAGE_CERT  /* Also good to certify keys.*/
  ------------------
                        use = PUBKEY_USAGE_CERT | PUBKEY_USAGE_SIG;
  ------------------
  |  |   49|  1.70k|#define PUBKEY_USAGE_SIG     GCRY_PK_USAGE_SIGN  /* Good for signatures. */
  ------------------
  788|  1.70k|          break;
  789|    774|      case PUBKEY_ALGO_ELGAMAL:
  ------------------
  |  Branch (789:7): [True: 774, False: 40.4k]
  ------------------
  790|    774|          if (RFC2440)
  ------------------
  |  |  373|    774|#define RFC2440 (opt.compliance==CO_RFC2440)
  |  |  ------------------
  |  |  |  Branch (373:17): [True: 0, False: 774]
  |  |  ------------------
  ------------------
  791|      0|             use = PUBKEY_USAGE_ENC;
  ------------------
  |  |   50|      0|#define PUBKEY_USAGE_ENC     GCRY_PK_USAGE_ENCR  /* Good for encryption. */
  ------------------
  792|    774|          break;
  793|  1.58k|      case PUBKEY_ALGO_ELGAMAL_E:
  ------------------
  |  Branch (793:7): [True: 1.58k, False: 39.6k]
  ------------------
  794|  1.58k|          use = PUBKEY_USAGE_ENC;
  ------------------
  |  |   50|  1.58k|#define PUBKEY_USAGE_ENC     GCRY_PK_USAGE_ENCR  /* Good for encryption. */
  ------------------
  795|  1.58k|          break;
  796|  1.74k|      case PUBKEY_ALGO_DSA:
  ------------------
  |  Branch (796:7): [True: 1.74k, False: 39.5k]
  ------------------
  797|  1.74k|          use = PUBKEY_USAGE_CERT | PUBKEY_USAGE_SIG | PUBKEY_USAGE_AUTH;
  ------------------
  |  |   51|  1.74k|#define PUBKEY_USAGE_CERT    GCRY_PK_USAGE_CERT  /* Also good to certify keys.*/
  ------------------
                        use = PUBKEY_USAGE_CERT | PUBKEY_USAGE_SIG | PUBKEY_USAGE_AUTH;
  ------------------
  |  |   49|  1.74k|#define PUBKEY_USAGE_SIG     GCRY_PK_USAGE_SIGN  /* Good for signatures. */
  ------------------
                        use = PUBKEY_USAGE_CERT | PUBKEY_USAGE_SIG | PUBKEY_USAGE_AUTH;
  ------------------
  |  |   52|  1.74k|#define PUBKEY_USAGE_AUTH    GCRY_PK_USAGE_AUTH  /* Good for authentication. */
  ------------------
  798|  1.74k|          break;
  799|  3.51k|      case PUBKEY_ALGO_ECDSA:
  ------------------
  |  Branch (799:7): [True: 3.51k, False: 37.7k]
  ------------------
  800|  6.98k|      case PUBKEY_ALGO_EDDSA:
  ------------------
  |  Branch (800:7): [True: 3.47k, False: 37.7k]
  ------------------
  801|  6.98k|          use = PUBKEY_USAGE_CERT | PUBKEY_USAGE_SIG | PUBKEY_USAGE_AUTH;
  ------------------
  |  |   51|  6.98k|#define PUBKEY_USAGE_CERT    GCRY_PK_USAGE_CERT  /* Also good to certify keys.*/
  ------------------
                        use = PUBKEY_USAGE_CERT | PUBKEY_USAGE_SIG | PUBKEY_USAGE_AUTH;
  ------------------
  |  |   49|  6.98k|#define PUBKEY_USAGE_SIG     GCRY_PK_USAGE_SIGN  /* Good for signatures. */
  ------------------
                        use = PUBKEY_USAGE_CERT | PUBKEY_USAGE_SIG | PUBKEY_USAGE_AUTH;
  ------------------
  |  |   52|  6.98k|#define PUBKEY_USAGE_AUTH    GCRY_PK_USAGE_AUTH  /* Good for authentication. */
  ------------------
  802|  31.3k|      default:
  ------------------
  |  Branch (802:7): [True: 24.3k, False: 16.9k]
  ------------------
  803|  31.3k|          break;
  804|  41.2k|    }
  805|  41.2k|    return use;
  806|  41.2k|}
openpgp_pk_algo_name:
  813|  15.9k|{
  814|  15.9k|  switch (algo)
  815|  15.9k|    {
  816|    170|    case PUBKEY_ALGO_RSA:
  ------------------
  |  Branch (816:5): [True: 170, False: 15.7k]
  ------------------
  817|    178|    case PUBKEY_ALGO_RSA_E:
  ------------------
  |  Branch (817:5): [True: 8, False: 15.9k]
  ------------------
  818|    188|    case PUBKEY_ALGO_RSA_S:     return "RSA";
  ------------------
  |  Branch (818:5): [True: 10, False: 15.9k]
  ------------------
  819|     50|    case PUBKEY_ALGO_ELGAMAL:
  ------------------
  |  Branch (819:5): [True: 50, False: 15.8k]
  ------------------
  820|  3.43k|    case PUBKEY_ALGO_ELGAMAL_E: return "ELG";
  ------------------
  |  Branch (820:5): [True: 3.38k, False: 12.5k]
  ------------------
  821|    522|    case PUBKEY_ALGO_DSA:       return "DSA";
  ------------------
  |  Branch (821:5): [True: 522, False: 15.4k]
  ------------------
  822|  1.13k|    case PUBKEY_ALGO_ECDH:      return "ECDH";
  ------------------
  |  Branch (822:5): [True: 1.13k, False: 14.8k]
  ------------------
  823|    147|    case PUBKEY_ALGO_ECDSA:     return "ECDSA";
  ------------------
  |  Branch (823:5): [True: 147, False: 15.8k]
  ------------------
  824|      0|    case PUBKEY_ALGO_EDDSA:     return "EDDSA";
  ------------------
  |  Branch (824:5): [True: 0, False: 15.9k]
  ------------------
  825|  10.5k|    default: return "?";
  ------------------
  |  Branch (825:5): [True: 10.5k, False: 5.42k]
  ------------------
  826|  15.9k|    }
  827|  15.9k|}
map_md_openpgp_to_gcry:
  834|  80.8k|{
  835|  80.8k|  switch (algo)
  836|  80.8k|    {
  837|      0|#ifdef GPG_USE_MD5
  838|  10.7k|    case DIGEST_ALGO_MD5:    return GCRY_MD_MD5;
  ------------------
  |  Branch (838:5): [True: 10.7k, False: 70.0k]
  ------------------
  839|       |#else
  840|       |    case DIGEST_ALGO_MD5:    return 0;
  841|       |#endif
  842|       |
  843|  11.8k|    case DIGEST_ALGO_SHA1:   return GCRY_MD_SHA1;
  ------------------
  |  Branch (843:5): [True: 11.8k, False: 68.9k]
  ------------------
  844|       |
  845|      0|#ifdef GPG_USE_RMD160
  846|  5.60k|    case DIGEST_ALGO_RMD160: return GCRY_MD_RMD160;
  ------------------
  |  Branch (846:5): [True: 5.60k, False: 75.2k]
  ------------------
  847|       |#else
  848|       |    case DIGEST_ALGO_RMD160: return 0;
  849|       |#endif
  850|       |
  851|      0|#ifdef GPG_USE_SHA224
  852|  2.68k|    case DIGEST_ALGO_SHA224: return GCRY_MD_SHA224;
  ------------------
  |  Branch (852:5): [True: 2.68k, False: 78.1k]
  ------------------
  853|       |#else
  854|       |    case DIGEST_ALGO_SHA224: return 0;
  855|       |#endif
  856|       |
  857|  18.7k|    case DIGEST_ALGO_SHA256: return GCRY_MD_SHA256;
  ------------------
  |  Branch (857:5): [True: 18.7k, False: 62.1k]
  ------------------
  858|       |
  859|      0|#ifdef GPG_USE_SHA384
  860|  3.58k|    case DIGEST_ALGO_SHA384: return GCRY_MD_SHA384;
  ------------------
  |  Branch (860:5): [True: 3.58k, False: 77.2k]
  ------------------
  861|       |#else
  862|       |    case DIGEST_ALGO_SHA384: return 0;
  863|       |#endif
  864|       |
  865|      0|#ifdef GPG_USE_SHA512
  866|  8.20k|    case DIGEST_ALGO_SHA512: return GCRY_MD_SHA512;
  ------------------
  |  Branch (866:5): [True: 8.20k, False: 72.6k]
  ------------------
  867|       |#else
  868|       |    case DIGEST_ALGO_SHA512: return 0;
  869|       |#endif
  870|  19.3k|    default: return 0;
  ------------------
  |  Branch (870:5): [True: 19.3k, False: 61.4k]
  ------------------
  871|  80.8k|    }
  872|  80.8k|}
openpgp_md_test_algo:
  879|  63.3k|{
  880|  63.3k|  enum gcry_md_algos ga;
  881|       |
  882|  63.3k|  ga = map_md_openpgp_to_gcry (algo);
  883|  63.3k|  if (!ga)
  ------------------
  |  Branch (883:7): [True: 19.3k, False: 44.0k]
  ------------------
  884|  19.3k|    return gpg_error (GPG_ERR_DIGEST_ALGO);
  885|       |
  886|  44.0k|  return gcry_md_test_algo (ga);
  887|  63.3k|}
check_compress_algo:
 1363|   141k|{
 1364|   141k|  switch (algo)
 1365|   141k|    {
 1366|   141k|    case 0: return 0;
  ------------------
  |  Branch (1366:5): [True: 141k, False: 145]
  ------------------
 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|    145|    default: return GPG_ERR_COMPR_ALGO;
  ------------------
  |  Branch (1374:5): [True: 145, False: 141k]
  ------------------
 1375|   141k|    }
 1376|   141k|}
pubkey_get_npkey:
 1697|   199k|{
 1698|   199k|  switch (algo)
 1699|   199k|    {
 1700|  22.2k|    case PUBKEY_ALGO_RSA:
  ------------------
  |  Branch (1700:5): [True: 22.2k, False: 177k]
  ------------------
 1701|  24.0k|    case PUBKEY_ALGO_RSA_E:
  ------------------
  |  Branch (1701:5): [True: 1.79k, False: 198k]
  ------------------
 1702|  27.1k|    case PUBKEY_ALGO_RSA_S:     return 2;
  ------------------
  |  Branch (1702:5): [True: 3.11k, False: 196k]
  ------------------
 1703|  11.5k|    case PUBKEY_ALGO_ELGAMAL_E: return 3;
  ------------------
  |  Branch (1703:5): [True: 11.5k, False: 188k]
  ------------------
 1704|  7.36k|    case PUBKEY_ALGO_DSA:       return 4;
  ------------------
  |  Branch (1704:5): [True: 7.36k, False: 192k]
  ------------------
 1705|  5.97k|    case PUBKEY_ALGO_ECDH:      return 3;
  ------------------
  |  Branch (1705:5): [True: 5.97k, False: 193k]
  ------------------
 1706|  14.0k|    case PUBKEY_ALGO_ECDSA:     return 2;
  ------------------
  |  Branch (1706:5): [True: 14.0k, False: 185k]
  ------------------
 1707|  1.88k|    case PUBKEY_ALGO_ELGAMAL:   return 3;
  ------------------
  |  Branch (1707:5): [True: 1.88k, False: 198k]
  ------------------
 1708|  11.4k|    case PUBKEY_ALGO_EDDSA:     return 2;
  ------------------
  |  Branch (1708:5): [True: 11.4k, False: 188k]
  ------------------
 1709|   120k|    default: return 0;
  ------------------
  |  Branch (1709:5): [True: 120k, False: 79.4k]
  ------------------
 1710|   199k|    }
 1711|   199k|}
pubkey_get_nskey:
 1717|  51.9k|{
 1718|  51.9k|  switch (algo)
 1719|  51.9k|    {
 1720|  23.3k|    case PUBKEY_ALGO_RSA:
  ------------------
  |  Branch (1720:5): [True: 23.3k, False: 28.6k]
  ------------------
 1721|  25.3k|    case PUBKEY_ALGO_RSA_E:
  ------------------
  |  Branch (1721:5): [True: 1.97k, False: 49.9k]
  ------------------
 1722|  26.4k|    case PUBKEY_ALGO_RSA_S:     return 6;
  ------------------
  |  Branch (1722:5): [True: 1.09k, False: 50.8k]
  ------------------
 1723|  1.30k|    case PUBKEY_ALGO_ELGAMAL_E: return 4;
  ------------------
  |  Branch (1723:5): [True: 1.30k, False: 50.6k]
  ------------------
 1724|  1.46k|    case PUBKEY_ALGO_DSA:       return 5;
  ------------------
  |  Branch (1724:5): [True: 1.46k, False: 50.4k]
  ------------------
 1725|  1.37k|    case PUBKEY_ALGO_ECDH:      return 4;
  ------------------
  |  Branch (1725:5): [True: 1.37k, False: 50.5k]
  ------------------
 1726|  4.61k|    case PUBKEY_ALGO_ECDSA:     return 3;
  ------------------
  |  Branch (1726:5): [True: 4.61k, False: 47.3k]
  ------------------
 1727|    748|    case PUBKEY_ALGO_ELGAMAL:   return 4;
  ------------------
  |  Branch (1727:5): [True: 748, False: 51.2k]
  ------------------
 1728|  2.23k|    case PUBKEY_ALGO_EDDSA:     return 3;
  ------------------
  |  Branch (1728:5): [True: 2.23k, False: 49.7k]
  ------------------
 1729|  13.8k|    default: return 0;
  ------------------
  |  Branch (1729:5): [True: 13.8k, False: 38.1k]
  ------------------
 1730|  51.9k|    }
 1731|  51.9k|}
pubkey_get_nsig:
 1736|   198k|{
 1737|   198k|  switch (algo)
 1738|   198k|    {
 1739|  12.1k|    case PUBKEY_ALGO_RSA:
  ------------------
  |  Branch (1739:5): [True: 12.1k, False: 185k]
  ------------------
 1740|  16.0k|    case PUBKEY_ALGO_RSA_E:
  ------------------
  |  Branch (1740:5): [True: 3.97k, False: 194k]
  ------------------
 1741|  18.7k|    case PUBKEY_ALGO_RSA_S:     return 1;
  ------------------
  |  Branch (1741:5): [True: 2.64k, False: 195k]
  ------------------
 1742|  13.5k|    case PUBKEY_ALGO_ELGAMAL_E: return 0;
  ------------------
  |  Branch (1742:5): [True: 13.5k, False: 184k]
  ------------------
 1743|  14.8k|    case PUBKEY_ALGO_DSA:       return 2;
  ------------------
  |  Branch (1743:5): [True: 14.8k, False: 183k]
  ------------------
 1744|  6.00k|    case PUBKEY_ALGO_ECDH:      return 0;
  ------------------
  |  Branch (1744:5): [True: 6.00k, False: 192k]
  ------------------
 1745|  7.58k|    case PUBKEY_ALGO_ECDSA:     return 2;
  ------------------
  |  Branch (1745:5): [True: 7.58k, False: 190k]
  ------------------
 1746|    735|    case PUBKEY_ALGO_ELGAMAL:   return 2;
  ------------------
  |  Branch (1746:5): [True: 735, False: 197k]
  ------------------
 1747|  4.72k|    case PUBKEY_ALGO_EDDSA:     return 2;
  ------------------
  |  Branch (1747:5): [True: 4.72k, False: 193k]
  ------------------
 1748|   131k|    default: return 0;
  ------------------
  |  Branch (1748:5): [True: 131k, False: 66.1k]
  ------------------
 1749|   198k|    }
 1750|   198k|}
pubkey_get_nenc:
 1756|  14.6k|{
 1757|  14.6k|  switch (algo)
 1758|  14.6k|    {
 1759|    490|    case PUBKEY_ALGO_RSA:
  ------------------
  |  Branch (1759:5): [True: 490, False: 14.1k]
  ------------------
 1760|    514|    case PUBKEY_ALGO_RSA_E:
  ------------------
  |  Branch (1760:5): [True: 24, False: 14.6k]
  ------------------
 1761|    754|    case PUBKEY_ALGO_RSA_S:     return 1;
  ------------------
  |  Branch (1761:5): [True: 240, False: 14.4k]
  ------------------
 1762|    630|    case PUBKEY_ALGO_ELGAMAL_E: return 2;
  ------------------
  |  Branch (1762:5): [True: 630, False: 14.0k]
  ------------------
 1763|    396|    case PUBKEY_ALGO_DSA:       return 0;
  ------------------
  |  Branch (1763:5): [True: 396, False: 14.2k]
  ------------------
 1764|  6.34k|    case PUBKEY_ALGO_ECDH:      return 2;
  ------------------
  |  Branch (1764:5): [True: 6.34k, False: 8.30k]
  ------------------
 1765|      4|    case PUBKEY_ALGO_ECDSA:     return 0;
  ------------------
  |  Branch (1765:5): [True: 4, False: 14.6k]
  ------------------
 1766|      4|    case PUBKEY_ALGO_ELGAMAL:   return 2;
  ------------------
  |  Branch (1766:5): [True: 4, False: 14.6k]
  ------------------
 1767|     18|    case PUBKEY_ALGO_EDDSA:     return 0;
  ------------------
  |  Branch (1767:5): [True: 18, False: 14.6k]
  ------------------
 1768|  6.49k|    default: return 0;
  ------------------
  |  Branch (1768:5): [True: 6.49k, False: 8.14k]
  ------------------
 1769|  14.6k|    }
 1770|  14.6k|}
pubkey_nbits:
 1776|  5.55k|{
 1777|  5.55k|  int rc, nbits;
 1778|  5.55k|  gcry_sexp_t sexp;
 1779|       |
 1780|  5.55k|  if (algo == PUBKEY_ALGO_DSA
  ------------------
  |  Branch (1780:7): [True: 1.30k, False: 4.25k]
  ------------------
 1781|  5.55k|      && key[0] && key[1] && key[2] && key[3])
  ------------------
  |  Branch (1781:10): [True: 1.30k, False: 0]
  |  Branch (1781:20): [True: 1.30k, False: 0]
  |  Branch (1781:30): [True: 1.30k, False: 0]
  |  Branch (1781:40): [True: 1.30k, False: 0]
  ------------------
 1782|  1.30k|    {
 1783|  1.30k|      rc = gcry_sexp_build (&sexp, NULL,
 1784|  1.30k|                            "(public-key(dsa(p%m)(q%m)(g%m)(y%m)))",
 1785|  1.30k|                            key[0], key[1], key[2], key[3] );
 1786|  1.30k|    }
 1787|  4.25k|  else if ((algo == PUBKEY_ALGO_ELGAMAL || algo == PUBKEY_ALGO_ELGAMAL_E)
  ------------------
  |  Branch (1787:13): [True: 387, False: 3.86k]
  |  Branch (1787:44): [True: 1.23k, False: 2.63k]
  ------------------
 1788|  4.25k|           && key[0] && key[1] && key[2])
  ------------------
  |  Branch (1788:15): [True: 1.62k, False: 0]
  |  Branch (1788:25): [True: 1.62k, False: 0]
  |  Branch (1788:35): [True: 1.62k, False: 0]
  ------------------
 1789|  1.62k|    {
 1790|  1.62k|      rc = gcry_sexp_build (&sexp, NULL,
 1791|  1.62k|                            "(public-key(elg(p%m)(g%m)(y%m)))",
 1792|  1.62k|                            key[0], key[1], key[2] );
 1793|  1.62k|    }
 1794|  2.63k|  else if (is_RSA (algo)
  ------------------
  |  |   64|  5.27k|#define is_RSA(a)     ((a)==PUBKEY_ALGO_RSA || (a)==PUBKEY_ALGO_RSA_E \
  |  |  ------------------
  |  |  |  Branch (64:24): [True: 1.41k, False: 1.21k]
  |  |  |  Branch (64:48): [True: 281, False: 935]
  |  |  ------------------
  |  |   65|  5.27k|		       || (a)==PUBKEY_ALGO_RSA_S )
  |  |  ------------------
  |  |  |  Branch (65:13): [True: 935, False: 0]
  |  |  ------------------
  ------------------
 1795|  2.63k|           && key[0] && key[1])
  ------------------
  |  Branch (1795:15): [True: 2.63k, False: 0]
  |  Branch (1795:25): [True: 2.63k, False: 0]
  ------------------
 1796|  2.63k|    {
 1797|  2.63k|      rc = gcry_sexp_build (&sexp, NULL,
 1798|  2.63k|                            "(public-key(rsa(n%m)(e%m)))",
 1799|  2.63k|                            key[0], key[1] );
 1800|  2.63k|    }
 1801|      0|  else if ((algo == PUBKEY_ALGO_ECDSA || algo == PUBKEY_ALGO_ECDH
  ------------------
  |  Branch (1801:13): [True: 0, False: 0]
  |  Branch (1801:42): [True: 0, False: 0]
  ------------------
 1802|      0|            || algo == PUBKEY_ALGO_EDDSA)
  ------------------
  |  Branch (1802:16): [True: 0, False: 0]
  ------------------
 1803|      0|           && key[0] && key[1])
  ------------------
  |  Branch (1803:15): [True: 0, False: 0]
  |  Branch (1803:25): [True: 0, False: 0]
  ------------------
 1804|      0|    {
 1805|      0|      char *curve = openpgp_oid_to_str (key[0]);
 1806|      0|      if (!curve)
  ------------------
  |  Branch (1806:11): [True: 0, False: 0]
  ------------------
 1807|      0|        rc = gpg_error_from_syserror ();
 1808|      0|      else
 1809|      0|        {
 1810|      0|          rc = gcry_sexp_build (&sexp, NULL,
 1811|      0|                                "(public-key(ecc(curve%s)(q%m)))",
 1812|      0|                                curve, key[1]);
 1813|      0|          xfree (curve);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1814|      0|        }
 1815|      0|    }
 1816|      0|  else
 1817|      0|    return 0;
 1818|       |
 1819|  5.55k|  if (rc)
  ------------------
  |  Branch (1819:7): [True: 0, False: 5.55k]
  ------------------
 1820|      0|    BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1821|       |
 1822|  5.55k|  nbits = gcry_pk_get_nbits (sexp);
 1823|  5.55k|  gcry_sexp_release (sexp);
 1824|  5.55k|  return nbits;
 1825|  5.55k|}
ecdsa_qbits_from_Q:
 1874|  2.93k|{
 1875|  2.93k|  if ((qbits%8) > 3)
  ------------------
  |  Branch (1875:7): [True: 73, False: 2.85k]
  ------------------
 1876|     73|    {
 1877|     73|      log_error (_("ECDSA public key is expected to be in SEC encoding "
  ------------------
  |  |   28|     73|#  define _(a) gettext (a)
  ------------------
 1878|     73|                   "multiple of 8 bits\n"));
 1879|     73|      return 0;
 1880|     73|    }
 1881|  2.85k|  qbits -= qbits%8;
 1882|  2.85k|  qbits /= 2;
 1883|  2.85k|  return qbits;
 1884|  2.93k|}
is_weak_digest:
 1920|  15.1k|{
 1921|  15.1k|  const enum gcry_md_algos galgo = map_md_openpgp_to_gcry (algo);
 1922|  15.1k|  const struct weakhash *weak;
 1923|       |
 1924|  15.1k|  for (weak = opt.weak_digests; weak; weak = weak->next)
  ------------------
  |  Branch (1924:33): [True: 0, False: 15.1k]
  ------------------
 1925|      0|    if (weak->algo == galgo)
  ------------------
  |  Branch (1925:9): [True: 0, False: 0]
  ------------------
 1926|      0|      return 1;
 1927|  15.1k|  return 0;
 1928|  15.1k|}

overwrite_filep:
   63|  1.01k|{
   64|  1.01k|  if ( iobuf_is_pipe_filename (fname) )
  ------------------
  |  Branch (64:8): [True: 0, False: 1.01k]
  ------------------
   65|      0|    return 1; /* Writing to stdout is always okay.  */
   66|       |
   67|  1.01k|  if ( gnupg_access( fname, F_OK ) )
  ------------------
  |  Branch (67:8): [True: 1, False: 1.01k]
  ------------------
   68|      1|    return 1; /* Does not exist.  */
   69|       |
   70|  1.01k|  if ( !compare_filenames (fname, NAME_OF_DEV_NULL) )
  ------------------
  |  |   42|  1.01k|#define NAME_OF_DEV_NULL "/dev/null"
  ------------------
  |  Branch (70:8): [True: 0, False: 1.01k]
  ------------------
   71|      0|    return 1; /* Does not do any harm.  */
   72|       |
   73|  1.01k|  if (opt.answer_yes)
  ------------------
  |  Branch (73:7): [True: 1.01k, False: 0]
  ------------------
   74|  1.01k|    return 1;
   75|      0|  if (opt.answer_no || opt.batch)
  ------------------
  |  Branch (75:7): [True: 0, False: 0]
  |  Branch (75:24): [True: 0, False: 0]
  ------------------
   76|      0|    return 0;  /* Do not overwrite.  */
   77|       |
   78|      0|  tty_printf (_("File '%s' exists. "), fname);
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
   79|      0|  if (cpr_enabled ())
  ------------------
  |  Branch (79:7): [True: 0, False: 0]
  ------------------
   80|      0|    tty_printf ("\n");
   81|      0|  if (cpr_get_answer_is_yes ("openfile.overwrite.okay",
  ------------------
  |  Branch (81:7): [True: 0, False: 0]
  ------------------
   82|      0|                             _("Overwrite? (y/N) ")) )
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
   83|      0|    return 1;
   84|      0|  return 0;
   85|      0|}
make_outfile_name:
   94|  9.54k|{
   95|  9.54k|  size_t n;
   96|       |
   97|  9.54k|  if (iobuf_is_pipe_filename (iname))
  ------------------
  |  Branch (97:7): [True: 0, False: 9.54k]
  ------------------
   98|      0|    return xstrdup ("-");
  ------------------
  |  |  112|      0|#define xstrdup(a)       gcry_xstrdup ((a))
  ------------------
   99|       |
  100|  9.54k|  n = strlen (iname);
  101|  9.54k|  if (n > 4 && (!CMP_FILENAME(iname+n-4, EXTSEP_S GPGEXT_GPG)
  ------------------
  |  |   49|  19.0k|#define CMP_FILENAME(a,b) strcmp( (a), (b) )
  ------------------
  |  Branch (101:7): [True: 9.54k, False: 0]
  |  Branch (101:17): [True: 9.54k, False: 0]
  ------------------
  102|  9.54k|                || !CMP_FILENAME(iname+n-4, EXTSEP_S "pgp")
  ------------------
  |  |   49|  9.54k|#define CMP_FILENAME(a,b) strcmp( (a), (b) )
  ------------------
  |  Branch (102:20): [True: 0, False: 0]
  ------------------
  103|  9.54k|                || !CMP_FILENAME(iname+n-4, EXTSEP_S "sig")
  ------------------
  |  |   49|  9.54k|#define CMP_FILENAME(a,b) strcmp( (a), (b) )
  ------------------
  |  Branch (103:20): [True: 0, False: 0]
  ------------------
  104|  9.54k|                || !CMP_FILENAME(iname+n-4, EXTSEP_S "asc")))
  ------------------
  |  |   49|      0|#define CMP_FILENAME(a,b) strcmp( (a), (b) )
  ------------------
  |  Branch (104:20): [True: 0, False: 0]
  ------------------
  105|  9.54k|    {
  106|  9.54k|      char *buf = xstrdup (iname);
  ------------------
  |  |  112|  9.54k|#define xstrdup(a)       gcry_xstrdup ((a))
  ------------------
  107|  9.54k|      buf[n-4] = 0;
  108|  9.54k|      return buf;
  109|  9.54k|    }
  110|      0|  else if (n > 5 && !CMP_FILENAME(iname+n-5, EXTSEP_S "sign"))
  ------------------
  |  |   49|      0|#define CMP_FILENAME(a,b) strcmp( (a), (b) )
  ------------------
  |  Branch (110:12): [True: 0, False: 0]
  |  Branch (110:21): [True: 0, False: 0]
  ------------------
  111|      0|    {
  112|      0|      char *buf = xstrdup (iname);
  ------------------
  |  |  112|      0|#define xstrdup(a)       gcry_xstrdup ((a))
  ------------------
  113|      0|      buf[n-5] = 0;
  114|      0|      return buf;
  115|      0|    }
  116|       |
  117|      0|  log_info (_("%s: unknown suffix\n"), iname);
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  118|      0|  return NULL;
  119|  9.54k|}
get_matching_datafile:
  313|  54.8k|{
  314|  54.8k|  char *fname = NULL;
  315|  54.8k|  size_t len;
  316|       |
  317|  54.8k|  if (iobuf_is_pipe_filename (sigfilename))
  ------------------
  |  Branch (317:7): [True: 0, False: 54.8k]
  ------------------
  318|      0|    return NULL;
  319|       |
  320|  54.8k|  len = strlen (sigfilename);
  321|  54.8k|  if (len > 4
  ------------------
  |  Branch (321:7): [True: 54.8k, False: 0]
  ------------------
  322|  54.8k|      && (!strcmp (sigfilename + len - 4, EXTSEP_S "sig")
  ------------------
  |  |  889|  54.8k|#define EXTSEP_S "."
  ------------------
  |  Branch (322:11): [True: 0, False: 54.8k]
  ------------------
  323|  54.8k|          || (len > 5 && !strcmp(sigfilename + len - 5, EXTSEP_S "sign"))
  ------------------
  |  |  889|  54.8k|#define EXTSEP_S "."
  ------------------
  |  Branch (323:15): [True: 54.8k, False: 0]
  |  Branch (323:26): [True: 0, False: 54.8k]
  ------------------
  324|  54.8k|          || !strcmp(sigfilename + len - 4, EXTSEP_S "asc")))
  ------------------
  |  |  889|  54.8k|#define EXTSEP_S "."
  ------------------
  |  Branch (324:14): [True: 0, False: 54.8k]
  ------------------
  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|  54.8k|  return fname;
  338|  54.8k|}
open_sigfile:
  347|  54.8k|{
  348|  54.8k|  iobuf_t a = NULL;
  349|  54.8k|  char *buf;
  350|       |
  351|  54.8k|  buf = get_matching_datafile (sigfilename);
  352|  54.8k|  if (buf)
  ------------------
  |  Branch (352:7): [True: 0, False: 54.8k]
  ------------------
  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|  54.8k|  return a;
  369|  54.8k|}

register_known_notation:
  264|    165|{
  265|    165|  strlist_t sl;
  266|       |
  267|    165|  if (!known_notations_list)
  ------------------
  |  Branch (267:7): [True: 1, False: 164]
  ------------------
  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|    165|  if (!string)
  ------------------
  |  Branch (273:7): [True: 165, False: 0]
  ------------------
  274|    165|    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|}
set_packet_list_mode:
  291|  3.71k|{
  292|  3.71k|  int old = list_mode;
  293|  3.71k|  list_mode = mode;
  294|       |
  295|       |  /* We use stdout only if invoked by the --list-packets command
  296|       |     but switch to stderr in all other cases.  This breaks the
  297|       |     previous behaviour but that seems to be more of a bug than
  298|       |     intentional.  I don't believe that any application makes use of
  299|       |     this long standing annoying way of printing to stdout except when
  300|       |     doing a --list-packets. If this assumption fails, it will be easy
  301|       |     to add an option for the listing stream.  Note that we initialize
  302|       |     it only once; mainly because there is code which switches
  303|       |     opt.list_mode back to 1 and we want to have all output to the
  304|       |     same stream.  The MPI_PRINT_MODE will be enabled if the
  305|       |     corresponding debug flag is set or if we are in --list-packets
  306|       |     and --verbose is given.
  307|       |
  308|       |     Using stderr is not actually very clean because it bypasses the
  309|       |     logging code but it is a special thing anyway.  I am not sure
  310|       |     whether using log_stream() would be better.  Perhaps we should
  311|       |     enable the list mode only with a special option. */
  312|  3.71k|  if (!listfp)
  ------------------
  |  Branch (312:7): [True: 1, False: 3.70k]
  ------------------
  313|      1|    {
  314|      1|      if (opt.list_packets)
  ------------------
  |  Branch (314:11): [True: 0, False: 1]
  ------------------
  315|      0|        {
  316|      0|          listfp = es_stdout;
  317|      0|          if (opt.verbose)
  ------------------
  |  Branch (317:15): [True: 0, False: 0]
  ------------------
  318|      0|            mpi_print_mode = 1;
  319|      0|        }
  320|      1|      else
  321|      1|        listfp = es_stderr;
  322|       |
  323|      1|      if (DBG_MPI)
  ------------------
  |  |  349|      1|#define DBG_MPI    (opt.debug & DBG_MPI_VALUE)
  |  |  ------------------
  |  |  |  |  332|      1|#define DBG_MPI_VALUE	  2	/* debug mpi details */
  |  |  ------------------
  |  |  |  Branch (349:20): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  324|      0|        mpi_print_mode = 1;
  325|      1|    }
  326|  3.71k|  return old;
  327|  3.71k|}
dbg_parse_packet:
  368|   723k|{
  369|   723k|  int skip, rc;
  370|       |
  371|   723k|  do
  372|   737k|    {
  373|   737k|      rc = parse (ctx, pkt, 0, NULL, &skip, NULL, 0, "parse", dbg_f, dbg_l);
  374|   737k|    }
  375|   737k|  while (skip && ! rc);
  ------------------
  |  Branch (375:10): [True: 14.4k, False: 723k]
  |  Branch (375:18): [True: 14.4k, False: 0]
  ------------------
  376|   723k|  return rc;
  377|   723k|}
parse_one_sig_subpkt:
 1739|  73.6k|{
 1740|  73.6k|  switch (type)
 1741|  73.6k|    {
 1742|  2.08k|    case SIGSUBPKT_REV_KEY:
  ------------------
  |  Branch (1742:5): [True: 2.08k, False: 71.5k]
  ------------------
 1743|  2.08k|      if (n < 22)
  ------------------
  |  Branch (1743:11): [True: 373, False: 1.71k]
  ------------------
 1744|    373|	break;
 1745|  1.71k|      return 0;
 1746|  17.2k|    case SIGSUBPKT_SIG_CREATED:
  ------------------
  |  Branch (1746:5): [True: 17.2k, False: 56.3k]
  ------------------
 1747|  19.0k|    case SIGSUBPKT_SIG_EXPIRE:
  ------------------
  |  Branch (1747:5): [True: 1.81k, False: 71.7k]
  ------------------
 1748|  22.1k|    case SIGSUBPKT_KEY_EXPIRE:
  ------------------
  |  Branch (1748:5): [True: 3.09k, False: 70.5k]
  ------------------
 1749|  22.1k|      if (n < 4)
  ------------------
  |  Branch (1749:11): [True: 745, False: 21.4k]
  ------------------
 1750|    745|	break;
 1751|  21.4k|      return 0;
 1752|  2.96k|    case SIGSUBPKT_KEY_FLAGS:
  ------------------
  |  Branch (1752:5): [True: 2.96k, False: 70.6k]
  ------------------
 1753|  4.02k|    case SIGSUBPKT_KS_FLAGS:
  ------------------
  |  Branch (1753:5): [True: 1.05k, False: 72.5k]
  ------------------
 1754|  5.45k|    case SIGSUBPKT_PREF_SYM:
  ------------------
  |  Branch (1754:5): [True: 1.43k, False: 72.1k]
  ------------------
 1755|  5.69k|    case SIGSUBPKT_PREF_AEAD:
  ------------------
  |  Branch (1755:5): [True: 246, False: 73.3k]
  ------------------
 1756|  6.81k|    case SIGSUBPKT_PREF_HASH:
  ------------------
  |  Branch (1756:5): [True: 1.11k, False: 72.4k]
  ------------------
 1757|  8.16k|    case SIGSUBPKT_PREF_COMPR:
  ------------------
  |  Branch (1757:5): [True: 1.35k, False: 72.2k]
  ------------------
 1758|  8.58k|    case SIGSUBPKT_POLICY:
  ------------------
  |  Branch (1758:5): [True: 414, False: 73.1k]
  ------------------
 1759|  11.4k|    case SIGSUBPKT_PREF_KS:
  ------------------
  |  Branch (1759:5): [True: 2.88k, False: 70.7k]
  ------------------
 1760|  13.6k|    case SIGSUBPKT_FEATURES:
  ------------------
  |  Branch (1760:5): [True: 2.16k, False: 71.4k]
  ------------------
 1761|  13.7k|    case SIGSUBPKT_REGEXP:
  ------------------
  |  Branch (1761:5): [True: 105, False: 73.4k]
  ------------------
 1762|  13.7k|    case SIGSUBPKT_ATTST_SIGS:
  ------------------
  |  Branch (1762:5): [True: 0, False: 73.6k]
  ------------------
 1763|  13.7k|      return 0;
 1764|  2.04k|    case SIGSUBPKT_SIGNATURE:
  ------------------
  |  Branch (1764:5): [True: 2.04k, False: 71.5k]
  ------------------
 1765|  2.52k|    case SIGSUBPKT_EXPORTABLE:
  ------------------
  |  Branch (1765:5): [True: 475, False: 73.1k]
  ------------------
 1766|  4.15k|    case SIGSUBPKT_REVOCABLE:
  ------------------
  |  Branch (1766:5): [True: 1.63k, False: 71.9k]
  ------------------
 1767|  4.15k|    case SIGSUBPKT_REVOC_REASON:
  ------------------
  |  Branch (1767:5): [True: 0, False: 73.6k]
  ------------------
 1768|  4.15k|      if (!n)
  ------------------
  |  Branch (1768:11): [True: 493, False: 3.66k]
  ------------------
 1769|    493|	break;
 1770|  3.66k|      return 0;
 1771|  14.1k|    case SIGSUBPKT_ISSUER:	/* issuer key ID */
  ------------------
  |  Branch (1771:5): [True: 14.1k, False: 59.4k]
  ------------------
 1772|  14.1k|      if (n < 8)
  ------------------
  |  Branch (1772:11): [True: 563, False: 13.5k]
  ------------------
 1773|    563|	break;
 1774|  13.5k|      return 0;
 1775|  10.7k|    case SIGSUBPKT_ISSUER_FPR:	/* issuer key fingerprint */
  ------------------
  |  Branch (1775:5): [True: 10.7k, False: 62.8k]
  ------------------
 1776|  10.7k|      if (n < 21)
  ------------------
  |  Branch (1776:11): [True: 1.95k, False: 8.75k]
  ------------------
 1777|  1.95k|	break;
 1778|  8.75k|      return 0;
 1779|    621|    case SIGSUBPKT_NOTATION:
  ------------------
  |  Branch (1779:5): [True: 621, False: 72.9k]
  ------------------
 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|    621|      if (n < 8
  ------------------
  |  Branch (1783:11): [True: 57, False: 564]
  ------------------
 1784|    621|	  || 8 + ((buffer[4] << 8) | buffer[5]) +
  ------------------
  |  Branch (1784:7): [True: 475, False: 89]
  ------------------
 1785|    564|	  ((buffer[6] << 8) | buffer[7]) != n)
 1786|    532|	break;
 1787|     89|      return 0;
 1788|    511|    case SIGSUBPKT_PRIMARY_UID:
  ------------------
  |  Branch (1788:5): [True: 511, False: 73.0k]
  ------------------
 1789|    511|      if (n != 1)
  ------------------
  |  Branch (1789:11): [True: 29, False: 482]
  ------------------
 1790|     29|	break;
 1791|    482|      return 0;
 1792|    608|    case SIGSUBPKT_TRUST:
  ------------------
  |  Branch (1792:5): [True: 608, False: 72.9k]
  ------------------
 1793|    608|      if (n != 2)
  ------------------
  |  Branch (1793:11): [True: 213, False: 395]
  ------------------
 1794|    213|	break;
 1795|    395|      return 0;
 1796|    728|    case SIGSUBPKT_KEY_BLOCK:
  ------------------
  |  Branch (1796:5): [True: 728, False: 72.8k]
  ------------------
 1797|    728|      if (n && buffer[0])
  ------------------
  |  Branch (1797:11): [True: 696, False: 32]
  |  Branch (1797:16): [True: 131, False: 565]
  ------------------
 1798|    131|        return -1; /* Unknown version - ignore.  */
 1799|    597|      if (n < 50)
  ------------------
  |  Branch (1799:11): [True: 395, False: 202]
  ------------------
 1800|    395|	break;  /* Definitely too short to carry a key block.  */
 1801|    202|      return 0;
 1802|  4.16k|    default:
  ------------------
  |  Branch (1802:5): [True: 4.16k, False: 69.4k]
  ------------------
 1803|  4.16k|      return 0;
 1804|  73.6k|    }
 1805|  5.29k|  return -2;
 1806|  73.6k|}
enum_sig_subpkt:
 1885|   584k|{
 1886|   584k|  const byte *buffer;
 1887|   584k|  int buflen;
 1888|   584k|  int type;
 1889|   584k|  int critical_dummy;
 1890|   584k|  int offset;
 1891|   584k|  size_t n;
 1892|   584k|  const subpktarea_t *pktbuf = want_hashed? sig->hashed : sig->unhashed;
  ------------------
  |  Branch (1892:32): [True: 507k, False: 76.7k]
  ------------------
 1893|   584k|  int seq = 0;
 1894|   584k|  int reqseq = start ? *start : 0;
  ------------------
  |  Branch (1894:16): [True: 11.6k, False: 573k]
  ------------------
 1895|       |
 1896|   584k|  if (!critical)
  ------------------
  |  Branch (1896:7): [True: 584k, False: 0]
  ------------------
 1897|   584k|    critical = &critical_dummy;
 1898|       |
 1899|   584k|  if (!pktbuf || reqseq == -1)
  ------------------
  |  Branch (1899:7): [True: 88.7k, False: 496k]
  |  Branch (1899:18): [True: 0, False: 496k]
  ------------------
 1900|  88.7k|    {
 1901|  88.7k|      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|  88.7k|      return reqtype ==	SIGSUBPKT_TEST_CRITICAL ? dummy : NULL;
  ------------------
  |  Branch (1904:14): [True: 6.38k, False: 82.3k]
  ------------------
 1905|  88.7k|    }
 1906|   496k|  buffer = pktbuf->data;
 1907|   496k|  buflen = pktbuf->len;
 1908|  1.78M|  while (buflen)
  ------------------
  |  Branch (1908:10): [True: 1.57M, False: 208k]
  ------------------
 1909|  1.57M|    {
 1910|  1.57M|      n = *buffer++;
 1911|  1.57M|      buflen--;
 1912|  1.57M|      if (n == 255) /* 4 byte length header.  */
  ------------------
  |  Branch (1912:11): [True: 4.27k, False: 1.57M]
  ------------------
 1913|  4.27k|	{
 1914|  4.27k|	  if (buflen < 4)
  ------------------
  |  Branch (1914:8): [True: 1.59k, False: 2.68k]
  ------------------
 1915|  1.59k|	    goto too_short;
 1916|  2.68k|	  n = buf32_to_size_t (buffer);
 1917|  2.68k|	  buffer += 4;
 1918|  2.68k|	  buflen -= 4;
 1919|  2.68k|	}
 1920|  1.57M|      else if (n >= 192) /* 4 byte special encoded length header.  */
  ------------------
  |  Branch (1920:16): [True: 69.7k, False: 1.50M]
  ------------------
 1921|  69.7k|	{
 1922|  69.7k|	  if (buflen < 2)
  ------------------
  |  Branch (1922:8): [True: 18.8k, False: 50.9k]
  ------------------
 1923|  18.8k|	    goto too_short;
 1924|  50.9k|	  n = ((n - 192) << 8) + *buffer + 192;
 1925|  50.9k|	  buffer++;
 1926|  50.9k|	  buflen--;
 1927|  50.9k|	}
 1928|  1.55M|      if (buflen < n)
  ------------------
  |  Branch (1928:11): [True: 176k, False: 1.37M]
  ------------------
 1929|   176k|	goto too_short;
 1930|  1.37M|      if (!buflen)
  ------------------
  |  Branch (1930:11): [True: 6.64k, False: 1.37M]
  ------------------
 1931|  6.64k|        goto no_type_byte;
 1932|  1.37M|      type = *buffer;
 1933|  1.37M|      if (type & 0x80)
  ------------------
  |  Branch (1933:11): [True: 232k, False: 1.14M]
  ------------------
 1934|   232k|	{
 1935|   232k|	  type &= 0x7f;
 1936|   232k|	  *critical = 1;
 1937|   232k|	}
 1938|  1.14M|      else
 1939|  1.14M|	*critical = 0;
 1940|  1.37M|      if (!(++seq > reqseq))
  ------------------
  |  Branch (1940:11): [True: 14.3k, False: 1.35M]
  ------------------
 1941|  14.3k|	;
 1942|  1.35M|      else if (reqtype == SIGSUBPKT_TEST_CRITICAL)
  ------------------
  |  Branch (1942:16): [True: 99.5k, False: 1.25M]
  ------------------
 1943|  99.5k|	{
 1944|  99.5k|	  if (*critical)
  ------------------
  |  Branch (1944:8): [True: 18.2k, False: 81.2k]
  ------------------
 1945|  18.2k|	    {
 1946|  18.2k|	      if (n - 1 > buflen + 1)
  ------------------
  |  Branch (1946:12): [True: 863, False: 17.3k]
  ------------------
 1947|    863|		goto too_short;
 1948|  17.3k|	      if (!can_handle_critical (buffer + 1, n - 1, type))
  ------------------
  |  Branch (1948:12): [True: 7.23k, False: 10.1k]
  ------------------
 1949|  7.23k|		{
 1950|  7.23k|		  if (opt.verbose && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (1950:9): [True: 0, False: 7.23k]
  |  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|  7.23k|		  if (start)
  ------------------
  |  Branch (1953:9): [True: 0, False: 7.23k]
  ------------------
 1954|      0|		    *start = seq;
 1955|  7.23k|		  return NULL;	/* This is an error.  */
 1956|  7.23k|		}
 1957|  17.3k|	    }
 1958|  99.5k|	}
 1959|  1.25M|      else if (reqtype < 0) /* List packets.  */
  ------------------
  |  Branch (1959:16): [True: 0, False: 1.25M]
  ------------------
 1960|      0|	dump_sig_subpkt (reqtype == SIGSUBPKT_LIST_HASHED,
 1961|      0|			 type, *critical, buffer, buflen, n, sig->digest_algo);
 1962|  1.25M|      else if (type == reqtype) /* Found.  */
  ------------------
  |  Branch (1962:16): [True: 76.1k, False: 1.18M]
  ------------------
 1963|  76.1k|	{
 1964|  76.1k|	  buffer++;
 1965|  76.1k|	  n--;
 1966|  76.1k|	  if (n > buflen)
  ------------------
  |  Branch (1966:8): [True: 2.55k, False: 73.6k]
  ------------------
 1967|  2.55k|	    goto too_short;
 1968|  73.6k|	  if (ret_n)
  ------------------
  |  Branch (1968:8): [True: 30.9k, False: 42.6k]
  ------------------
 1969|  30.9k|	    *ret_n = n;
 1970|  73.6k|	  offset = parse_one_sig_subpkt (buffer, n, type);
 1971|  73.6k|	  switch (offset)
 1972|  73.6k|	    {
 1973|  5.29k|	    case -2:
  ------------------
  |  Branch (1973:6): [True: 5.29k, False: 68.3k]
  ------------------
 1974|  5.29k|	      log_error ("subpacket of type %d too short\n", type);
 1975|  5.29k|	      return NULL;
 1976|    131|	    case -1:
  ------------------
  |  Branch (1976:6): [True: 131, False: 73.4k]
  ------------------
 1977|    131|	      return NULL;
 1978|  68.1k|	    default:
  ------------------
  |  Branch (1978:6): [True: 68.1k, False: 5.42k]
  ------------------
 1979|  68.1k|	      break;
 1980|  73.6k|	    }
 1981|  68.1k|	  if (start)
  ------------------
  |  Branch (1981:8): [True: 4.66k, False: 63.5k]
  ------------------
 1982|  4.66k|	    *start = seq;
 1983|  68.1k|	  return buffer + offset;
 1984|  73.6k|	}
 1985|  1.28M|      buffer += n;
 1986|  1.28M|      buflen -= n;
 1987|  1.28M|    }
 1988|   208k|  if (reqtype == SIGSUBPKT_TEST_CRITICAL)
  ------------------
  |  Branch (1988:7): [True: 20.6k, False: 187k]
  ------------------
 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|  20.6k|    return buffer;
 1994|       |
 1995|       |  /* Critical bit we don't understand. */
 1996|   187k|  if (start)
  ------------------
  |  Branch (1996:7): [True: 4.82k, False: 182k]
  ------------------
 1997|  4.82k|    *start = -1;
 1998|   187k|  return NULL;	/* End of packets; not found.  */
 1999|       |
 2000|   200k| too_short:
 2001|   200k|  if (opt.debug && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (2001:7): [True: 0, False: 200k]
  |  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|   200k|  if (start)
  ------------------
  |  Branch (2009:7): [True: 1.63k, False: 198k]
  ------------------
 2010|  1.63k|    *start = -1;
 2011|   200k|  return NULL;
 2012|       |
 2013|  6.64k| no_type_byte:
 2014|  6.64k|  if (opt.verbose && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (2014:7): [True: 0, False: 6.64k]
  |  Branch (2014:22): [True: 0, False: 0]
  ------------------
 2015|      0|    log_info ("type octet missing in subpacket\n");
 2016|  6.64k|  if (start)
  ------------------
  |  Branch (2016:7): [True: 104, False: 6.54k]
  ------------------
 2017|    104|    *start = -1;
 2018|  6.64k|  return NULL;
 2019|   208k|}
parse_sig_subpkt:
 2025|   573k|{
 2026|   573k|  return enum_sig_subpkt (sig, want_hashed, reqtype, ret_n, NULL, NULL);
 2027|   573k|}
parse_sig_subpkt2:
 2032|  60.9k|{
 2033|  60.9k|  const byte *p;
 2034|       |
 2035|  60.9k|  p = parse_sig_subpkt (sig, 1, reqtype, NULL);
 2036|  60.9k|  if (!p)
  ------------------
  |  Branch (2036:7): [True: 58.8k, False: 2.09k]
  ------------------
 2037|  58.8k|    p = parse_sig_subpkt (sig, 0, reqtype, NULL);
 2038|  60.9k|  return p;
 2039|  60.9k|}
parse_revkeys:
 2045|  2.43k|{
 2046|  2.43k|  const byte *revkey;
 2047|  2.43k|  int seq = 0;
 2048|  2.43k|  size_t len;
 2049|       |
 2050|  2.43k|  if (sig->sig_class != 0x1F)
  ------------------
  |  Branch (2050:7): [True: 0, False: 2.43k]
  ------------------
 2051|      0|    return;
 2052|       |
 2053|  4.15k|  while ((revkey = enum_sig_subpkt (sig, 1, SIGSUBPKT_REV_KEY,
  ------------------
  |  Branch (2053:10): [True: 1.71k, False: 2.43k]
  ------------------
 2054|  4.15k|                                    &len, &seq, NULL)))
 2055|  1.71k|    {
 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|  1.71k|      if ((len == 22 || len == 34)
  ------------------
  |  Branch (2059:12): [True: 1.23k, False: 477]
  |  Branch (2059:25): [True: 451, False: 26]
  ------------------
 2060|  1.71k|          && (revkey[0] & 0x80))
  ------------------
  |  Branch (2060:14): [True: 1.09k, False: 591]
  ------------------
 2061|  1.09k|	{
 2062|  1.09k|	  sig->revkey = xrealloc (sig->revkey,
  ------------------
  |  |  111|  1.09k|#define xrealloc(a,b)    gcry_xrealloc ((a),(b))
  ------------------
 2063|  1.09k|				  sizeof (struct revocation_key) *
 2064|  1.09k|				  (sig->numrevkeys + 1));
 2065|       |
 2066|  1.09k|	  sig->revkey[sig->numrevkeys].class = revkey[0];
 2067|  1.09k|	  sig->revkey[sig->numrevkeys].algid = revkey[1];
 2068|  1.09k|          len -= 2;
 2069|  1.09k|	  sig->revkey[sig->numrevkeys].fprlen = len;
 2070|  1.09k|	  memcpy (sig->revkey[sig->numrevkeys].fpr, revkey+2, len);
 2071|  1.09k|	  memset (sig->revkey[sig->numrevkeys].fpr+len, 0,
 2072|  1.09k|                  sizeof (sig->revkey[sig->numrevkeys].fpr) - len);
 2073|  1.09k|	  sig->numrevkeys++;
 2074|  1.09k|	}
 2075|  1.71k|    }
 2076|  2.43k|}
parse_signature:
 2082|   137k|{
 2083|   137k|  int md5_len = 0;
 2084|   137k|  unsigned n;
 2085|   137k|  int is_v4or5 = 0;
 2086|   137k|  int rc = 0;
 2087|   137k|  int i, ndata;
 2088|       |
 2089|   137k|  if (pktlen < 16)
  ------------------
  |  Branch (2089:7): [True: 73.5k, False: 63.6k]
  ------------------
 2090|  73.5k|    {
 2091|  73.5k|      log_error ("packet(%d) too short\n", pkttype);
 2092|  73.5k|      if (list_mode)
  ------------------
  |  Branch (2092:11): [True: 0, False: 73.5k]
  ------------------
 2093|      0|        es_fputs (":signature packet: [too short]\n", listfp);
 2094|  73.5k|      goto leave;
 2095|  73.5k|    }
 2096|  63.6k|  sig->version = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  63.6k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  63.6k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 63.6k]
  |  |  |  |  |  Branch (500:24): [True: 66, False: 63.6k]
  |  |  |  |  ------------------
  |  |  |  |  501|  63.6k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2097|  63.6k|  pktlen--;
 2098|  63.6k|  if (sig->version == 4 || sig->version == 5)
  ------------------
  |  Branch (2098:7): [True: 26.4k, False: 37.2k]
  |  Branch (2098:28): [True: 8.54k, False: 28.7k]
  ------------------
 2099|  34.9k|    is_v4or5 = 1;
 2100|  28.7k|  else if (sig->version != 2 && sig->version != 3)
  ------------------
  |  Branch (2100:12): [True: 21.3k, False: 7.35k]
  |  Branch (2100:33): [True: 974, False: 20.3k]
  ------------------
 2101|    974|    {
 2102|    974|      log_error ("packet(%d) with unknown version %d\n",
 2103|    974|		 pkttype, sig->version);
 2104|    974|      if (list_mode)
  ------------------
  |  Branch (2104:11): [True: 0, False: 974]
  ------------------
 2105|      0|        es_fputs (":signature packet: [unknown version]\n", listfp);
 2106|    974|      rc = gpg_error (GPG_ERR_INV_PACKET);
 2107|    974|      goto leave;
 2108|    974|    }
 2109|       |
 2110|  62.7k|  if (!is_v4or5)
  ------------------
  |  Branch (2110:7): [True: 27.7k, False: 34.9k]
  ------------------
 2111|  27.7k|    {
 2112|  27.7k|      if (pktlen == 0)
  ------------------
  |  Branch (2112:11): [True: 0, False: 27.7k]
  ------------------
 2113|      0|	goto underflow;
 2114|  27.7k|      md5_len = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  27.7k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  27.7k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 27.7k]
  |  |  |  |  |  Branch (500:24): [True: 76, False: 27.6k]
  |  |  |  |  ------------------
  |  |  |  |  501|  27.7k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2115|  27.7k|      pktlen--;
 2116|  27.7k|    }
 2117|  62.7k|  if (pktlen == 0)
  ------------------
  |  Branch (2117:7): [True: 0, False: 62.7k]
  ------------------
 2118|      0|    goto underflow;
 2119|  62.7k|  sig->sig_class = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  62.7k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  62.7k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 62.7k]
  |  |  |  |  |  Branch (500:24): [True: 132, False: 62.5k]
  |  |  |  |  ------------------
  |  |  |  |  501|  62.7k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2120|  62.7k|  pktlen--;
 2121|  62.7k|  if (!is_v4or5)
  ------------------
  |  Branch (2121:7): [True: 27.7k, False: 34.9k]
  ------------------
 2122|  27.7k|    {
 2123|  27.7k|      if (pktlen < 12)
  ------------------
  |  Branch (2123:11): [True: 0, False: 27.7k]
  ------------------
 2124|      0|	goto underflow;
 2125|  27.7k|      sig->timestamp = read_32 (inp);
 2126|  27.7k|      pktlen -= 4;
 2127|  27.7k|      sig->keyid[0] = read_32 (inp);
 2128|  27.7k|      pktlen -= 4;
 2129|  27.7k|      sig->keyid[1] = read_32 (inp);
 2130|  27.7k|      pktlen -= 4;
 2131|  27.7k|    }
 2132|  62.7k|  if (pktlen < 2)
  ------------------
  |  Branch (2132:7): [True: 61, False: 62.6k]
  ------------------
 2133|     61|    goto underflow;
 2134|  62.6k|  sig->pubkey_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  62.6k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  62.6k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 62.6k]
  |  |  |  |  |  Branch (500:24): [True: 831, False: 61.8k]
  |  |  |  |  ------------------
  |  |  |  |  501|  62.6k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2135|  62.6k|  pktlen--;
 2136|  62.6k|  sig->digest_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  62.6k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  62.6k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 62.6k]
  |  |  |  |  |  Branch (500:24): [True: 374, False: 62.2k]
  |  |  |  |  ------------------
  |  |  |  |  501|  62.6k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2137|  62.6k|  pktlen--;
 2138|  62.6k|  sig->flags.exportable = 1;
 2139|  62.6k|  sig->flags.revocable = 1;
 2140|  62.6k|  if (is_v4or5) /* Read subpackets.  */
  ------------------
  |  Branch (2140:7): [True: 34.9k, False: 27.6k]
  ------------------
 2141|  34.9k|    {
 2142|  34.9k|      if (pktlen < 2)
  ------------------
  |  Branch (2142:11): [True: 0, False: 34.9k]
  ------------------
 2143|      0|	goto underflow;
 2144|  34.9k|      n = read_16 (inp);
 2145|  34.9k|      pktlen -= 2;  /* Length of hashed data. */
 2146|  34.9k|      if (pktlen < n)
  ------------------
  |  Branch (2146:11): [True: 580, False: 34.3k]
  ------------------
 2147|    580|	goto underflow;
 2148|  34.3k|      if (n > 10000)
  ------------------
  |  Branch (2148:11): [True: 105, False: 34.2k]
  ------------------
 2149|    105|	{
 2150|    105|	  log_error ("signature packet: hashed data too long\n");
 2151|    105|          if (list_mode)
  ------------------
  |  Branch (2151:15): [True: 0, False: 105]
  ------------------
 2152|      0|            es_fputs (":signature packet: [hashed data too long]\n", listfp);
 2153|    105|	  rc = GPG_ERR_INV_PACKET;
 2154|    105|	  goto leave;
 2155|    105|	}
 2156|  34.2k|      if (n)
  ------------------
  |  Branch (2156:11): [True: 32.2k, False: 2.00k]
  ------------------
 2157|  32.2k|	{
 2158|  32.2k|	  sig->hashed = xmalloc (sizeof (*sig->hashed) + n - 1);
  ------------------
  |  |  107|  32.2k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 2159|  32.2k|	  sig->hashed->size = n;
 2160|  32.2k|	  sig->hashed->len = n;
 2161|  32.2k|	  if (iobuf_read (inp, sig->hashed->data, n) != n)
  ------------------
  |  Branch (2161:8): [True: 268, False: 32.0k]
  ------------------
 2162|    268|	    {
 2163|    268|	      log_error ("premature eof while reading "
 2164|    268|			 "hashed signature data\n");
 2165|    268|              if (list_mode)
  ------------------
  |  Branch (2165:19): [True: 0, False: 268]
  ------------------
 2166|      0|                es_fputs (":signature packet: [premature eof]\n", listfp);
 2167|    268|	      rc = -1;
 2168|    268|	      goto leave;
 2169|    268|	    }
 2170|  32.0k|	  pktlen -= n;
 2171|  32.0k|	}
 2172|  34.0k|      if (pktlen < 2)
  ------------------
  |  Branch (2172:11): [True: 63, False: 33.9k]
  ------------------
 2173|     63|	goto underflow;
 2174|  33.9k|      n = read_16 (inp);
 2175|  33.9k|      pktlen -= 2;  /* Length of unhashed data.  */
 2176|  33.9k|      if (pktlen < n)
  ------------------
  |  Branch (2176:11): [True: 561, False: 33.3k]
  ------------------
 2177|    561|	goto underflow;
 2178|  33.3k|      if (n > 10000)
  ------------------
  |  Branch (2178:11): [True: 68, False: 33.3k]
  ------------------
 2179|     68|	{
 2180|     68|	  log_error ("signature packet: unhashed data too long\n");
 2181|     68|          if (list_mode)
  ------------------
  |  Branch (2181:15): [True: 0, False: 68]
  ------------------
 2182|      0|            es_fputs (":signature packet: [unhashed data too long]\n", listfp);
 2183|     68|	  rc = GPG_ERR_INV_PACKET;
 2184|     68|	  goto leave;
 2185|     68|	}
 2186|  33.3k|      if (n)
  ------------------
  |  Branch (2186:11): [True: 20.9k, False: 12.4k]
  ------------------
 2187|  20.9k|	{
 2188|  20.9k|	  sig->unhashed = xmalloc (sizeof (*sig->unhashed) + n - 1);
  ------------------
  |  |  107|  20.9k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 2189|  20.9k|	  sig->unhashed->size = n;
 2190|  20.9k|	  sig->unhashed->len = n;
 2191|  20.9k|	  if (iobuf_read (inp, sig->unhashed->data, n) != n)
  ------------------
  |  Branch (2191:8): [True: 181, False: 20.7k]
  ------------------
 2192|    181|	    {
 2193|    181|	      log_error ("premature eof while reading "
 2194|    181|			 "unhashed signature data\n");
 2195|    181|              if (list_mode)
  ------------------
  |  Branch (2195:19): [True: 0, False: 181]
  ------------------
 2196|      0|                es_fputs (":signature packet: [premature eof]\n", listfp);
 2197|    181|	      rc = -1;
 2198|    181|	      goto leave;
 2199|    181|	    }
 2200|  20.7k|	  pktlen -= n;
 2201|  20.7k|	}
 2202|  33.3k|    }
 2203|       |
 2204|  60.8k|  if (pktlen < 2)
  ------------------
  |  Branch (2204:7): [True: 15, False: 60.8k]
  ------------------
 2205|     15|    goto underflow;
 2206|  60.8k|  sig->digest_start[0] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  60.8k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  60.8k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 60.8k]
  |  |  |  |  |  Branch (500:24): [True: 1.43k, False: 59.3k]
  |  |  |  |  ------------------
  |  |  |  |  501|  60.8k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2207|  60.8k|  pktlen--;
 2208|  60.8k|  sig->digest_start[1] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  60.8k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  60.8k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 60.8k]
  |  |  |  |  |  Branch (500:24): [True: 1.27k, False: 59.5k]
  |  |  |  |  ------------------
  |  |  |  |  501|  60.8k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2209|  60.8k|  pktlen--;
 2210|       |
 2211|  60.8k|  if (is_v4or5 && sig->pubkey_algo)  /* Extract required information.  */
  ------------------
  |  Branch (2211:7): [True: 33.1k, False: 27.6k]
  |  Branch (2211:19): [True: 33.0k, False: 142]
  ------------------
 2212|  33.0k|    {
 2213|  33.0k|      const byte *p;
 2214|  33.0k|      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|  33.0k|      if (!parse_sig_subpkt (sig, 1, SIGSUBPKT_TEST_CRITICAL, NULL)
  ------------------
  |  Branch (2218:11): [True: 18.9k, False: 14.0k]
  ------------------
 2219|  33.0k|	  || !parse_sig_subpkt (sig, 0, SIGSUBPKT_TEST_CRITICAL, NULL))
  ------------------
  |  Branch (2219:7): [True: 1.09k, False: 12.9k]
  ------------------
 2220|  20.0k|	sig->flags.unknown_critical = 1;
 2221|       |
 2222|  33.0k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_SIG_CREATED, NULL);
 2223|  33.0k|      if (p)
  ------------------
  |  Branch (2223:11): [True: 17.0k, False: 15.9k]
  ------------------
 2224|  17.0k|	sig->timestamp = buf32_to_u32 (p);
 2225|  15.9k|      else if (!(sig->pubkey_algo >= 100 && sig->pubkey_algo <= 110)
  ------------------
  |  Branch (2225:18): [True: 5.85k, False: 10.1k]
  |  Branch (2225:45): [True: 264, False: 5.58k]
  ------------------
 2226|  15.9k|	       && opt.verbose > 1 && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (2226:12): [True: 0, False: 15.6k]
  |  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|  33.0k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_ISSUER_FPR, &len);
 2233|  33.0k|      if (p && len == 21 && p[0] == 4)
  ------------------
  |  Branch (2233:11): [True: 5.79k, False: 27.2k]
  |  Branch (2233:16): [True: 4.86k, False: 925]
  |  Branch (2233:29): [True: 4.76k, False: 103]
  ------------------
 2234|  4.76k|        {
 2235|  4.76k|          sig->keyid[0] = buf32_to_u32 (p + 1 + 12);
 2236|  4.76k|	  sig->keyid[1] = buf32_to_u32 (p + 1 + 16);
 2237|  4.76k|	}
 2238|  28.2k|      else if (p && len == 33 && p[0] == 5)
  ------------------
  |  Branch (2238:16): [True: 1.02k, False: 27.2k]
  |  Branch (2238:21): [True: 921, False: 107]
  |  Branch (2238:34): [True: 286, False: 635]
  ------------------
 2239|    286|        {
 2240|    286|          sig->keyid[0] = buf32_to_u32 (p + 1 );
 2241|    286|	  sig->keyid[1] = buf32_to_u32 (p + 1 + 4);
 2242|    286|	}
 2243|  27.9k|      else if ((p = parse_sig_subpkt2 (sig, SIGSUBPKT_ISSUER)))
  ------------------
  |  Branch (2243:16): [True: 13.5k, False: 14.3k]
  ------------------
 2244|  13.5k|        {
 2245|  13.5k|          sig->keyid[0] = buf32_to_u32 (p);
 2246|  13.5k|	  sig->keyid[1] = buf32_to_u32 (p + 4);
 2247|  13.5k|	}
 2248|  14.3k|      else if (!(sig->pubkey_algo >= 100 && sig->pubkey_algo <= 110)
  ------------------
  |  Branch (2248:18): [True: 6.12k, False: 8.26k]
  |  Branch (2248:45): [True: 265, False: 5.85k]
  ------------------
 2249|  14.3k|	       && opt.verbose > 1 && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (2249:12): [True: 0, False: 14.1k]
  |  Branch (2249:31): [True: 0, False: 0]
  ------------------
 2250|      0|	log_info ("signature packet without keyid\n");
 2251|       |
 2252|  33.0k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_SIG_EXPIRE, NULL);
 2253|  33.0k|      if (p && buf32_to_u32 (p))
  ------------------
  |  Branch (2253:11): [True: 1.28k, False: 31.7k]
  |  Branch (2253:16): [True: 1.27k, False: 14]
  ------------------
 2254|  1.27k|	sig->expiredate = sig->timestamp + buf32_to_u32 (p);
 2255|  33.0k|      if (sig->expiredate && sig->expiredate <= make_timestamp ())
  ------------------
  |  Branch (2255:11): [True: 1.27k, False: 31.7k]
  |  Branch (2255:30): [True: 1.10k, False: 168]
  ------------------
 2256|  1.10k|	sig->flags.expired = 1;
 2257|       |
 2258|  33.0k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_POLICY, NULL);
 2259|  33.0k|      if (p)
  ------------------
  |  Branch (2259:11): [True: 414, False: 32.5k]
  ------------------
 2260|    414|	sig->flags.policy_url = 1;
 2261|       |
 2262|  33.0k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_PREF_KS, NULL);
 2263|  33.0k|      if (p)
  ------------------
  |  Branch (2263:11): [True: 1.97k, False: 31.0k]
  ------------------
 2264|  1.97k|	sig->flags.pref_ks = 1;
 2265|       |
 2266|  33.0k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_SIGNERS_UID, &len);
 2267|  33.0k|      if (p && len)
  ------------------
  |  Branch (2267:11): [True: 4.16k, False: 28.8k]
  |  Branch (2267:16): [True: 3.29k, False: 863]
  ------------------
 2268|  3.29k|        {
 2269|  3.29k|          char *mbox;
 2270|       |
 2271|  3.29k|          sig->signers_uid = try_make_printable_string (p, len, 0);
 2272|  3.29k|          if (!sig->signers_uid)
  ------------------
  |  Branch (2272:15): [True: 0, False: 3.29k]
  ------------------
 2273|      0|            {
 2274|      0|              rc = gpg_error_from_syserror ();
 2275|      0|              goto leave;
 2276|      0|            }
 2277|  3.29k|          mbox = mailbox_from_userid (sig->signers_uid, 0);
 2278|  3.29k|          if (mbox)
  ------------------
  |  Branch (2278:15): [True: 711, False: 2.58k]
  ------------------
 2279|    711|            {
 2280|    711|              xfree (sig->signers_uid);
  ------------------
  |  |  104|    711|#define xfree(a)         gcry_free ((a))
  ------------------
 2281|    711|              sig->signers_uid = mbox;
 2282|    711|            }
 2283|  3.29k|        }
 2284|       |
 2285|  33.0k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_KEY_BLOCK, NULL);
 2286|  33.0k|      if (p)
  ------------------
  |  Branch (2286:11): [True: 202, False: 32.8k]
  ------------------
 2287|    202|        sig->flags.key_block = 1;
 2288|       |
 2289|  33.0k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_NOTATION, NULL);
 2290|  33.0k|      if (p)
  ------------------
  |  Branch (2290:11): [True: 89, False: 32.9k]
  ------------------
 2291|     89|	sig->flags.notation = 1;
 2292|       |
 2293|  33.0k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_REVOCABLE, NULL);
 2294|  33.0k|      if (p && *p == 0)
  ------------------
  |  Branch (2294:11): [True: 1.15k, False: 31.8k]
  |  Branch (2294:16): [True: 771, False: 379]
  ------------------
 2295|    771|	sig->flags.revocable = 0;
 2296|       |
 2297|  33.0k|      p = parse_sig_subpkt (sig, 1, SIGSUBPKT_TRUST, &len);
 2298|  33.0k|      if (p && len == 2)
  ------------------
  |  Branch (2298:11): [True: 395, False: 32.6k]
  |  Branch (2298:16): [True: 395, False: 0]
  ------------------
 2299|    395|	{
 2300|    395|	  sig->trust_depth = p[0];
 2301|    395|	  sig->trust_value = p[1];
 2302|       |
 2303|       |	  /* Only look for a regexp if there is also a trust
 2304|       |	     subpacket. */
 2305|    395|	  sig->trust_regexp =
 2306|    395|	    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|    395|	  if (len == 0)
  ------------------
  |  Branch (2310:8): [True: 89, False: 306]
  ------------------
 2311|     89|	    sig->trust_regexp = NULL;
 2312|    395|	}
 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|  33.0k|      p = parse_sig_subpkt2 (sig, SIGSUBPKT_EXPORTABLE);
 2320|  33.0k|      if (p && *p == 0)
  ------------------
  |  Branch (2320:11): [True: 470, False: 32.5k]
  |  Branch (2320:16): [True: 72, False: 398]
  ------------------
 2321|     72|	sig->flags.exportable = 0;
 2322|       |
 2323|       |      /* Find all revocation keys.  */
 2324|  33.0k|      if (sig->sig_class == 0x1F)
  ------------------
  |  Branch (2324:11): [True: 2.43k, False: 30.5k]
  ------------------
 2325|  2.43k|	parse_revkeys (sig);
 2326|  33.0k|    }
 2327|       |
 2328|  60.8k|  if (list_mode)
  ------------------
  |  Branch (2328:7): [True: 0, False: 60.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|  60.8k|  ndata = pubkey_get_nsig (sig->pubkey_algo);
 2345|  60.8k|  if (!ndata)
  ------------------
  |  Branch (2345:7): [True: 37.7k, False: 23.0k]
  ------------------
 2346|  37.7k|    {
 2347|  37.7k|      if (list_mode)
  ------------------
  |  Branch (2347:11): [True: 0, False: 37.7k]
  ------------------
 2348|      0|	es_fprintf (listfp, "\tunknown algorithm %d\n", sig->pubkey_algo);
 2349|  37.7k|      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|  37.7k|      if (pktlen > (5 * MAX_EXTERN_MPI_BITS / 8))
  ------------------
  |  |   42|  37.7k|#define MAX_EXTERN_MPI_BITS 16384
  ------------------
  |  Branch (2353:11): [True: 106, False: 37.6k]
  ------------------
 2354|    106|	{
 2355|       |	  /* We include a limit to avoid too trivial DoS attacks by
 2356|       |	     having gpg allocate too much memory.  */
 2357|    106|	  log_error ("signature packet: too much data\n");
 2358|    106|	  rc = GPG_ERR_INV_PACKET;
 2359|    106|	}
 2360|  37.6k|      else
 2361|  37.6k|	{
 2362|  37.6k|          void *tmpp;
 2363|       |
 2364|  37.6k|          tmpp = read_rest (inp, pktlen);
 2365|  37.6k|	  sig->data[0] = gcry_mpi_set_opaque (NULL, tmpp, tmpp? pktlen * 8 : 0);
  ------------------
  |  Branch (2365:52): [True: 27.6k, False: 9.99k]
  ------------------
 2366|  37.6k|	  pktlen = 0;
 2367|  37.6k|	}
 2368|  37.7k|    }
 2369|  23.0k|  else
 2370|  23.0k|    {
 2371|  59.8k|      for (i = 0; i < ndata; i++)
  ------------------
  |  Branch (2371:19): [True: 36.7k, False: 23.0k]
  ------------------
 2372|  36.7k|	{
 2373|  36.7k|	  n = pktlen;
 2374|  36.7k|          if (sig->pubkey_algo == PUBKEY_ALGO_ECDSA
  ------------------
  |  Branch (2374:15): [True: 7.55k, False: 29.2k]
  ------------------
 2375|  36.7k|              || sig->pubkey_algo == PUBKEY_ALGO_EDDSA)
  ------------------
  |  Branch (2375:18): [True: 4.71k, False: 24.5k]
  ------------------
 2376|  12.2k|            sig->data[i] = sos_read (inp, &n, 0);
 2377|  24.5k|          else
 2378|  24.5k|            sig->data[i] = mpi_read (inp, &n, 0);
 2379|  36.7k|	  pktlen -= n;
 2380|  36.7k|	  if (list_mode)
  ------------------
  |  Branch (2380:8): [True: 0, False: 36.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|  36.7k|	  if (!sig->data[i])
  ------------------
  |  Branch (2386:8): [True: 2.71k, False: 34.0k]
  ------------------
 2387|  2.71k|	    rc = GPG_ERR_INV_PACKET;
 2388|  36.7k|	}
 2389|  23.0k|    }
 2390|       |
 2391|   135k| leave:
 2392|   135k|  iobuf_skip_rest (inp, pktlen, 0);
 2393|   135k|  return rc;
 2394|       |
 2395|  1.28k| underflow:
 2396|  1.28k|  log_error ("packet(%d) too short\n", pkttype);
 2397|  1.28k|  if (list_mode)
  ------------------
  |  Branch (2397:7): [True: 0, False: 1.28k]
  ------------------
 2398|      0|    es_fputs (":signature packet: [too short]\n", listfp);
 2399|       |
 2400|  1.28k|  iobuf_skip_rest (inp, pktlen, 0);
 2401|       |
 2402|  1.28k|  return GPG_ERR_INV_PACKET;
 2403|  60.8k|}
parse_attribute_subpkts:
 3018|  10.6k|{
 3019|  10.6k|  size_t n;
 3020|  10.6k|  int count = 0;
 3021|  10.6k|  struct user_attribute *attribs = NULL;
 3022|  10.6k|  const byte *buffer = uid->attrib_data;
 3023|  10.6k|  int buflen = uid->attrib_len;
 3024|  10.6k|  byte type;
 3025|       |
 3026|  10.6k|  xfree (uid->attribs);
  ------------------
  |  |  104|  10.6k|#define xfree(a)         gcry_free ((a))
  ------------------
 3027|       |
 3028|  17.2k|  while (buflen)
  ------------------
  |  Branch (3028:10): [True: 15.0k, False: 2.18k]
  ------------------
 3029|  15.0k|    {
 3030|  15.0k|      n = *buffer++;
 3031|  15.0k|      buflen--;
 3032|  15.0k|      if (n == 255)  /* 4 byte length header.  */
  ------------------
  |  Branch (3032:11): [True: 561, False: 14.5k]
  ------------------
 3033|    561|	{
 3034|    561|	  if (buflen < 4)
  ------------------
  |  Branch (3034:8): [True: 260, False: 301]
  ------------------
 3035|    260|	    goto too_short;
 3036|    301|	  n = buf32_to_size_t (buffer);
 3037|    301|	  buffer += 4;
 3038|    301|	  buflen -= 4;
 3039|    301|	}
 3040|  14.5k|      else if (n >= 192)  /* 2 byte special encoded length header.  */
  ------------------
  |  Branch (3040:16): [True: 2.71k, False: 11.7k]
  ------------------
 3041|  2.71k|	{
 3042|  2.71k|	  if (buflen < 2)
  ------------------
  |  Branch (3042:8): [True: 2.37k, False: 338]
  ------------------
 3043|  2.37k|	    goto too_short;
 3044|    338|	  n = ((n - 192) << 8) + *buffer + 192;
 3045|    338|	  buffer++;
 3046|    338|	  buflen--;
 3047|    338|	}
 3048|  12.4k|      if (buflen < n)
  ------------------
  |  Branch (3048:11): [True: 4.16k, False: 8.26k]
  ------------------
 3049|  4.16k|	goto too_short;
 3050|       |
 3051|  8.26k|      if (!n)
  ------------------
  |  Branch (3051:11): [True: 1.69k, False: 6.57k]
  ------------------
 3052|  1.69k|        {
 3053|       |          /* Too short to encode the subpacket type.  */
 3054|  1.69k|          if (opt.verbose)
  ------------------
  |  Branch (3054:15): [True: 0, False: 1.69k]
  ------------------
 3055|      0|            log_info ("attribute subpacket too short\n");
 3056|  1.69k|          break;
 3057|  1.69k|        }
 3058|       |
 3059|  6.57k|      attribs = xrealloc (attribs,
  ------------------
  |  |  111|  6.57k|#define xrealloc(a,b)    gcry_xrealloc ((a),(b))
  ------------------
 3060|  6.57k|                          (count + 1) * sizeof (struct user_attribute));
 3061|  6.57k|      memset (&attribs[count], 0, sizeof (struct user_attribute));
 3062|       |
 3063|  6.57k|      type = *buffer;
 3064|  6.57k|      buffer++;
 3065|  6.57k|      buflen--;
 3066|  6.57k|      n--;
 3067|       |
 3068|  6.57k|      attribs[count].type = type;
 3069|  6.57k|      attribs[count].data = buffer;
 3070|  6.57k|      attribs[count].len = n;
 3071|  6.57k|      buffer += n;
 3072|  6.57k|      buflen -= n;
 3073|  6.57k|      count++;
 3074|  6.57k|    }
 3075|       |
 3076|  3.87k|  uid->attribs = attribs;
 3077|  3.87k|  uid->numattribs = count;
 3078|  3.87k|  return count;
 3079|       |
 3080|  6.80k| too_short:
 3081|  6.80k|  if (opt.verbose && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (3081:7): [True: 0, False: 6.80k]
  |  Branch (3081:22): [True: 0, False: 0]
  ------------------
 3082|      0|    log_info ("buffer shorter than attribute subpacket\n");
 3083|  6.80k|  uid->attribs = attribs;
 3084|  6.80k|  uid->numattribs = count;
 3085|  6.80k|  return count;
 3086|  10.6k|}
make_attribute_uidname:
 3139|  10.6k|{
 3140|  10.6k|  log_assert (max_namelen > 70);
 3141|  10.6k|  if (uid->numattribs <= 0)
  ------------------
  |  Branch (3141:7): [True: 4.43k, False: 6.24k]
  ------------------
 3142|  4.43k|    sprintf (uid->name, "[bad attribute packet of size %lu]",
 3143|  4.43k|	     uid->attrib_len);
 3144|  6.24k|  else if (uid->numattribs > 1)
  ------------------
  |  Branch (3144:12): [True: 233, False: 6.01k]
  ------------------
 3145|    233|    sprintf (uid->name, "[%d attributes of size %lu]",
 3146|    233|	     uid->numattribs, uid->attrib_len);
 3147|  6.01k|  else
 3148|  6.01k|    {
 3149|       |      /* Only one attribute, so list it as the "user id" */
 3150|       |
 3151|  6.01k|      if (uid->attribs->type == ATTRIB_IMAGE)
  ------------------
  |  |  263|  6.01k|#define ATTRIB_IMAGE 1
  ------------------
  |  Branch (3151:11): [True: 5.89k, False: 118]
  ------------------
 3152|  5.89k|	{
 3153|  5.89k|	  u32 len;
 3154|  5.89k|	  byte type;
 3155|       |
 3156|  5.89k|	  if (parse_image_header (uid->attribs, &type, &len))
  ------------------
  |  Branch (3156:8): [True: 1.63k, False: 4.25k]
  ------------------
 3157|  1.63k|	    sprintf (uid->name, "[%.20s image of size %lu]",
 3158|  1.63k|		     image_type_to_string (type, 1), (ulong) len);
 3159|  4.25k|	  else
 3160|  4.25k|	    sprintf (uid->name, "[invalid image]");
 3161|  5.89k|	}
 3162|    118|      else
 3163|    118|	sprintf (uid->name, "[unknown attribute of size %lu]",
 3164|    118|		 (ulong) uid->attribs->len);
 3165|  6.01k|    }
 3166|       |
 3167|  10.6k|  uid->len = strlen (uid->name);
 3168|  10.6k|}
create_gpg_control:
 3788|  29.0k|{
 3789|  29.0k|  PACKET *packet;
 3790|  29.0k|  byte *p;
 3791|       |
 3792|  29.0k|  if (!data)
  ------------------
  |  Branch (3792:7): [True: 0, False: 29.0k]
  ------------------
 3793|      0|    datalen = 0;
 3794|       |
 3795|  29.0k|  packet = xmalloc (sizeof *packet);
  ------------------
  |  |  107|  29.0k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 3796|  29.0k|  init_packet (packet);
  ------------------
  |  |  581|  29.0k|#define init_packet(a) do { (a)->pkttype = 0;		\
  |  |  582|  29.0k|			    (a)->pkt.generic = NULL;	\
  |  |  583|  29.0k|		       } while(0)
  |  |  ------------------
  |  |  |  Branch (583:18): [Folded - Ignored]
  |  |  ------------------
  ------------------
 3797|  29.0k|  packet->pkttype = PKT_GPG_CONTROL;
 3798|  29.0k|  packet->pkt.gpg_control = xmalloc (sizeof *packet->pkt.gpg_control + datalen);
  ------------------
  |  |  107|  29.0k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 3799|  29.0k|  packet->pkt.gpg_control->control = type;
 3800|  29.0k|  packet->pkt.gpg_control->datalen = datalen;
 3801|  29.0k|  p = packet->pkt.gpg_control->data;
 3802|  1.86M|  for (; datalen; datalen--, p++)
  ------------------
  |  Branch (3802:10): [True: 1.83M, False: 29.0k]
  ------------------
 3803|  1.83M|    *p = *data++;
 3804|       |
 3805|  29.0k|  return packet;
 3806|  29.0k|}
parse-packet.c:parse:
  631|   737k|{
  632|   737k|  int rc = 0;
  633|   737k|  iobuf_t inp;
  634|   737k|  int c, ctb, pkttype, lenbytes;
  635|   737k|  unsigned long pktlen;
  636|   737k|  byte hdr[8];
  637|   737k|  int hdrlen;
  638|   737k|  int new_ctb = 0, partial = 0;
  639|   737k|  int with_uid = (onlykeypkts == 2);
  640|   737k|  off_t pos;
  641|       |
  642|   737k|  *skip = 0;
  643|   737k|  inp = ctx->inp;
  644|       |
  645|   760k| again:
  646|   760k|  log_assert (!pkt->pkt.generic);
  647|   760k|  if (retpos || list_mode)
  ------------------
  |  Branch (647:7): [True: 0, False: 760k]
  |  Branch (647:17): [True: 0, False: 760k]
  ------------------
  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|   760k|  else
  654|   760k|    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|   760k|  if ((ctb = iobuf_get (inp)) == -1)
  ------------------
  |  |  500|   760k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 760k]
  |  |  |  Branch (500:24): [True: 25.3k, False: 735k]
  |  |  ------------------
  |  |  501|   760k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (658:7): [True: 15.9k, False: 744k]
  ------------------
  659|  15.9k|    {
  660|  15.9k|      rc = -1;
  661|  15.9k|      goto leave;
  662|  15.9k|    }
  663|   744k|  hdrlen = 0;
  664|   744k|  hdr[hdrlen++] = ctb;
  665|       |
  666|   744k|  if (!(ctb & 0x80))
  ------------------
  |  Branch (666:7): [True: 81.0k, False: 663k]
  ------------------
  667|  81.0k|    {
  668|  81.0k|      log_error ("%s: invalid packet (ctb=%02x)\n", iobuf_where (inp), ctb);
  ------------------
  |  |  630|  81.0k|#define iobuf_where(a)	"[don't know]"
  ------------------
  669|  81.0k|      rc = gpg_error (GPG_ERR_INV_PACKET);
  670|  81.0k|      goto leave;
  671|  81.0k|    }
  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|   663k|  pktlen = 0;
  679|   663k|  new_ctb = !!(ctb & 0x40);
  680|   663k|  if (new_ctb)
  ------------------
  |  Branch (680:7): [True: 300k, False: 363k]
  ------------------
  681|   300k|    {
  682|       |      /* Get the packet's type.  This is encoded in the 6 least
  683|       |	 significant bits of the tag.  */
  684|   300k|      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|   300k|      if ((c = iobuf_get (inp)) == -1)
  ------------------
  |  |  500|   300k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 300k]
  |  |  |  Branch (500:24): [True: 629, False: 299k]
  |  |  ------------------
  |  |  501|   300k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (690:11): [True: 502, False: 299k]
  ------------------
  691|    502|	{
  692|    502|	  log_error ("%s: 1st length byte missing\n", iobuf_where (inp));
  ------------------
  |  |  630|    502|#define iobuf_where(a)	"[don't know]"
  ------------------
  693|    502|	  rc = gpg_error (GPG_ERR_INV_PACKET);
  694|    502|	  goto leave;
  695|    502|	}
  696|       |
  697|       |
  698|   299k|      hdr[hdrlen++] = c;
  699|   299k|      if (c < 192)
  ------------------
  |  Branch (699:11): [True: 263k, False: 35.8k]
  ------------------
  700|   263k|        pktlen = c;
  701|  35.8k|      else if (c < 224)
  ------------------
  |  Branch (701:16): [True: 2.63k, False: 33.1k]
  ------------------
  702|  2.63k|        {
  703|  2.63k|          pktlen = (c - 192) * 256;
  704|  2.63k|          if ((c = iobuf_get (inp)) == -1)
  ------------------
  |  |  500|  2.63k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 2.63k]
  |  |  |  Branch (500:24): [True: 158, False: 2.48k]
  |  |  ------------------
  |  |  501|  2.63k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (704:15): [True: 146, False: 2.49k]
  ------------------
  705|    146|            {
  706|    146|              log_error ("%s: 2nd length byte missing\n",
  707|    146|                         iobuf_where (inp));
  ------------------
  |  |  630|    146|#define iobuf_where(a)	"[don't know]"
  ------------------
  708|    146|              rc = gpg_error (GPG_ERR_INV_PACKET);
  709|    146|              goto leave;
  710|    146|            }
  711|  2.49k|          hdr[hdrlen++] = c;
  712|  2.49k|          pktlen += c + 192;
  713|  2.49k|        }
  714|  33.1k|      else if (c == 255)
  ------------------
  |  Branch (714:16): [True: 1.40k, False: 31.7k]
  ------------------
  715|  1.40k|        {
  716|  1.40k|	  int i;
  717|  1.40k|	  char value[4];
  718|       |
  719|  6.17k|	  for (i = 0; i < 4; i ++)
  ------------------
  |  Branch (719:16): [True: 5.14k, False: 1.03k]
  ------------------
  720|  5.14k|            {
  721|  5.14k|              if ((c = iobuf_get (inp)) == -1)
  ------------------
  |  |  500|  5.14k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 5.14k]
  |  |  |  Branch (500:24): [True: 404, False: 4.73k]
  |  |  ------------------
  |  |  501|  5.14k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (721:19): [True: 377, False: 4.76k]
  ------------------
  722|    377|                {
  723|    377|                  log_error ("%s: 4 byte length invalid\n", iobuf_where (inp));
  ------------------
  |  |  630|    377|#define iobuf_where(a)	"[don't know]"
  ------------------
  724|    377|                  rc = gpg_error (GPG_ERR_INV_PACKET);
  725|    377|                  goto leave;
  726|    377|                }
  727|  4.76k|              value[i] = hdr[hdrlen++] = c;
  728|  4.76k|            }
  729|       |
  730|  1.03k|	  pktlen = buf32_to_ulong (value);
  731|  1.03k|        }
  732|  31.7k|      else /* Partial body length.  */
  733|  31.7k|        {
  734|  31.7k|          switch (pkttype)
  735|  31.7k|            {
  736|  5.83k|            case PKT_PLAINTEXT:
  ------------------
  |  Branch (736:13): [True: 5.83k, False: 25.9k]
  ------------------
  737|  6.07k|            case PKT_ENCRYPTED:
  ------------------
  |  Branch (737:13): [True: 234, False: 31.5k]
  ------------------
  738|  7.99k|            case PKT_ENCRYPTED_MDC:
  ------------------
  |  Branch (738:13): [True: 1.92k, False: 29.8k]
  ------------------
  739|  8.34k|            case PKT_ENCRYPTED_AEAD:
  ------------------
  |  Branch (739:13): [True: 350, False: 31.4k]
  ------------------
  740|  30.9k|            case PKT_COMPRESSED:
  ------------------
  |  Branch (740:13): [True: 22.5k, False: 9.19k]
  ------------------
  741|  30.9k|              iobuf_set_partial_body_length_mode (inp, c & 0xff);
  742|  30.9k|              pktlen = 0;	/* To indicate partial length.  */
  743|  30.9k|              partial = 1;
  744|  30.9k|              break;
  745|       |
  746|    845|            default:
  ------------------
  |  Branch (746:13): [True: 845, False: 30.9k]
  ------------------
  747|    845|              log_error ("%s: partial length invalid for"
  748|    845|                         " packet type %d\n", iobuf_where (inp), pkttype);
  ------------------
  |  |  630|    845|#define iobuf_where(a)	"[don't know]"
  ------------------
  749|    845|              rc = gpg_error (GPG_ERR_INV_PACKET);
  750|    845|              goto leave;
  751|  31.7k|            }
  752|  31.7k|        }
  753|       |
  754|   299k|    }
  755|   363k|  else
  756|       |    /* This is an old format packet.  */
  757|   363k|    {
  758|       |      /* Extract the packet's type.  This is encoded in bits 2-5.  */
  759|   363k|      pkttype = (ctb >> 2) & 0xf;
  760|       |
  761|       |      /* The type of length encoding is encoded in bits 0-1 of the
  762|       |	 tag.  */
  763|   363k|      lenbytes = ((ctb & 3) == 3) ? 0 : (1 << (ctb & 3));
  ------------------
  |  Branch (763:18): [True: 120k, False: 243k]
  ------------------
  764|   363k|      if (!lenbytes)
  ------------------
  |  Branch (764:11): [True: 120k, False: 243k]
  ------------------
  765|   120k|	{
  766|   120k|	  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|   120k|	  partial = 1;
  770|   120k|	  if (pkttype != PKT_ENCRYPTED && pkttype != PKT_PLAINTEXT
  ------------------
  |  Branch (770:8): [True: 120k, False: 267]
  |  Branch (770:36): [True: 119k, False: 628]
  ------------------
  771|   120k|	      && pkttype != PKT_COMPRESSED)
  ------------------
  |  Branch (771:11): [True: 2.80k, False: 116k]
  ------------------
  772|  2.80k|	    {
  773|  2.80k|	      log_error ("%s: indeterminate length for invalid"
  774|  2.80k|			 " packet type %d\n", iobuf_where (inp), pkttype);
  ------------------
  |  |  630|  2.80k|#define iobuf_where(a)	"[don't know]"
  ------------------
  775|  2.80k|	      rc = gpg_error (GPG_ERR_INV_PACKET);
  776|  2.80k|	      goto leave;
  777|  2.80k|	    }
  778|   120k|	}
  779|   243k|      else
  780|   243k|	{
  781|   515k|	  for (; lenbytes; lenbytes--)
  ------------------
  |  Branch (781:11): [True: 272k, False: 242k]
  ------------------
  782|   272k|	    {
  783|   272k|	      pktlen <<= 8;
  784|   272k|	      c = iobuf_get (inp);
  ------------------
  |  |  500|   272k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 272k]
  |  |  |  Branch (500:24): [True: 313, False: 271k]
  |  |  ------------------
  |  |  501|   272k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  785|   272k|	      if (c == -1)
  ------------------
  |  Branch (785:12): [True: 250, False: 271k]
  ------------------
  786|    250|		{
  787|    250|		  log_error ("%s: length invalid\n", iobuf_where (inp));
  ------------------
  |  |  630|    250|#define iobuf_where(a)	"[don't know]"
  ------------------
  788|    250|		  rc = gpg_error (GPG_ERR_INV_PACKET);
  789|    250|		  goto leave;
  790|    250|		}
  791|   271k|	      pktlen |= hdr[hdrlen++] = c;
  792|   271k|	    }
  793|   243k|	}
  794|   363k|    }
  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|   658k|  if (pkttype == 63 && pktlen == 0xFFFFFFFF)
  ------------------
  |  Branch (803:7): [True: 9.47k, False: 649k]
  |  Branch (803:24): [True: 205, False: 9.26k]
  ------------------
  804|    205|    {
  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|    205|      log_error ("%s: garbled packet detected\n", iobuf_where (inp));
  ------------------
  |  |  630|    205|#define iobuf_where(a)	"[don't know]"
  ------------------
  809|    205|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  810|    205|      rc = gpg_error (GPG_ERR_INV_PACKET);
  811|    205|      goto leave;
  812|       |#else
  813|       |      g10_exit (2);
  814|       |#endif
  815|    205|    }
  816|       |
  817|   658k|  if (out && pkttype)
  ------------------
  |  Branch (817:7): [True: 0, False: 658k]
  |  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|   658k|  if (with_uid && pkttype == PKT_USER_ID)
  ------------------
  |  Branch (836:7): [True: 0, False: 658k]
  |  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|   658k|  else if (do_skip
  ------------------
  |  Branch (840:12): [True: 0, False: 658k]
  ------------------
  841|       |	   /* type==0 is not allowed.  This is an invalid packet.  */
  842|   658k|	   || !pkttype
  ------------------
  |  Branch (842:8): [True: 14.4k, False: 643k]
  ------------------
  843|       |	   /* When ONLYKEYPKTS is set, we don't skip keys.  */
  844|   658k|	   || (onlykeypkts && pkttype != PKT_PUBLIC_SUBKEY
  ------------------
  |  Branch (844:9): [True: 0, False: 643k]
  |  Branch (844:24): [True: 0, False: 0]
  ------------------
  845|   643k|	       && pkttype != PKT_PUBLIC_KEY
  ------------------
  |  Branch (845:12): [True: 0, False: 0]
  ------------------
  846|   643k|	       && pkttype != PKT_SECRET_SUBKEY && pkttype != PKT_SECRET_KEY))
  ------------------
  |  Branch (846:12): [True: 0, False: 0]
  |  Branch (846:44): [True: 0, False: 0]
  ------------------
  847|  14.4k|    {
  848|  14.4k|      iobuf_skip_rest (inp, pktlen, partial);
  849|  14.4k|      *skip = 1;
  850|  14.4k|      rc = 0;
  851|  14.4k|      goto leave;
  852|  14.4k|    }
  853|       |
  854|   643k|  if (DBG_PACKET)
  ------------------
  |  |  348|   643k|#define DBG_PACKET (opt.debug & DBG_PACKET_VALUE)
  |  |  ------------------
  |  |  |  |  331|   643k|#define DBG_PACKET_VALUE  1	/* debug packet reading/writing */
  |  |  ------------------
  |  |  |  Branch (348:20): [True: 0, False: 643k]
  |  |  ------------------
  ------------------
  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|   643k|  if (list_mode)
  ------------------
  |  Branch (867:7): [True: 0, False: 643k]
  ------------------
  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|   643k|  ctx->n_parsed_packets++;
  875|       |
  876|   643k|  pkt->pkttype = pkttype;
  877|   643k|  rc = GPG_ERR_UNKNOWN_PACKET;	/* default error */
  878|   643k|  switch (pkttype)
  879|   643k|    {
  880|  24.2k|    case PKT_PUBLIC_KEY:
  ------------------
  |  Branch (880:5): [True: 24.2k, False: 619k]
  ------------------
  881|  35.8k|    case PKT_PUBLIC_SUBKEY:
  ------------------
  |  Branch (881:5): [True: 11.5k, False: 632k]
  ------------------
  882|  47.7k|    case PKT_SECRET_KEY:
  ------------------
  |  Branch (882:5): [True: 11.9k, False: 631k]
  ------------------
  883|  52.1k|    case PKT_SECRET_SUBKEY:
  ------------------
  |  Branch (883:5): [True: 4.33k, False: 639k]
  ------------------
  884|  52.1k|      pkt->pkt.public_key = xmalloc_clear (sizeof *pkt->pkt.public_key);
  ------------------
  |  |  116|  52.1k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
  885|  52.1k|      rc = parse_key (inp, pkttype, pktlen, hdr, hdrlen, pkt);
  886|  52.1k|      break;
  887|  14.1k|    case PKT_SYMKEY_ENC:
  ------------------
  |  Branch (887:5): [True: 14.1k, False: 629k]
  ------------------
  888|  14.1k|      rc = parse_symkeyenc (inp, pkttype, pktlen, pkt);
  889|  14.1k|      break;
  890|  8.37k|    case PKT_PUBKEY_ENC:
  ------------------
  |  Branch (890:5): [True: 8.37k, False: 635k]
  ------------------
  891|  8.37k|      rc = parse_pubkeyenc (inp, pkttype, pktlen, pkt);
  892|  8.37k|      break;
  893|   135k|    case PKT_SIGNATURE:
  ------------------
  |  Branch (893:5): [True: 135k, False: 508k]
  ------------------
  894|   135k|      pkt->pkt.signature = xmalloc_clear (sizeof *pkt->pkt.signature);
  ------------------
  |  |  116|   135k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
  895|   135k|      rc = parse_signature (inp, pkttype, pktlen, pkt->pkt.signature);
  896|   135k|      break;
  897|  21.1k|    case PKT_ONEPASS_SIG:
  ------------------
  |  Branch (897:5): [True: 21.1k, False: 622k]
  ------------------
  898|  21.1k|      pkt->pkt.onepass_sig = xmalloc_clear (sizeof *pkt->pkt.onepass_sig);
  ------------------
  |  |  116|  21.1k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
  899|  21.1k|      rc = parse_onepass_sig (inp, pkttype, pktlen, pkt->pkt.onepass_sig);
  900|  21.1k|      break;
  901|  41.3k|    case PKT_USER_ID:
  ------------------
  |  Branch (901:5): [True: 41.3k, False: 602k]
  ------------------
  902|  41.3k|      rc = parse_user_id (inp, pkttype, pktlen, pkt);
  903|  41.3k|      break;
  904|  10.7k|    case PKT_ATTRIBUTE:
  ------------------
  |  Branch (904:5): [True: 10.7k, False: 633k]
  ------------------
  905|  10.7k|      pkt->pkttype = pkttype = PKT_USER_ID;	/* we store it in the userID */
  906|  10.7k|      rc = parse_attribute (inp, pkttype, pktlen, pkt);
  907|  10.7k|      break;
  908|  4.17k|    case PKT_OLD_COMMENT:
  ------------------
  |  Branch (908:5): [True: 4.17k, False: 639k]
  ------------------
  909|  5.18k|    case PKT_COMMENT:
  ------------------
  |  Branch (909:5): [True: 1.00k, False: 642k]
  ------------------
  910|  5.18k|      rc = parse_comment (inp, pkttype, pktlen, pkt);
  911|  5.18k|      break;
  912|  22.8k|    case PKT_RING_TRUST:
  ------------------
  |  Branch (912:5): [True: 22.8k, False: 621k]
  ------------------
  913|  22.8k|      {
  914|  22.8k|        rc = parse_ring_trust (ctx, pktlen);
  915|  22.8k|        if (!rc)
  ------------------
  |  Branch (915:13): [True: 22.8k, False: 0]
  ------------------
  916|  22.8k|          goto again; /* Directly read the next packet.  */
  917|  22.8k|      }
  918|      0|      break;
  919|  29.9k|    case PKT_PLAINTEXT:
  ------------------
  |  Branch (919:5): [True: 29.9k, False: 613k]
  ------------------
  920|  29.9k|      rc = parse_plaintext (inp, pkttype, pktlen, pkt, new_ctb, partial);
  921|  29.9k|      break;
  922|   142k|    case PKT_COMPRESSED:
  ------------------
  |  Branch (922:5): [True: 142k, False: 501k]
  ------------------
  923|   142k|      rc = parse_compressed (inp, pkttype, pktlen, pkt, new_ctb);
  924|   142k|      break;
  925|  5.98k|    case PKT_ENCRYPTED:
  ------------------
  |  Branch (925:5): [True: 5.98k, False: 637k]
  ------------------
  926|  9.59k|    case PKT_ENCRYPTED_MDC:
  ------------------
  |  Branch (926:5): [True: 3.61k, False: 640k]
  ------------------
  927|  9.59k|      rc = parse_encrypted (inp, pkttype, pktlen, pkt, new_ctb, partial);
  928|  9.59k|      break;
  929|  4.40k|    case PKT_MDC:
  ------------------
  |  Branch (929:5): [True: 4.40k, False: 639k]
  ------------------
  930|  4.40k|      rc = parse_mdc (inp, pkttype, pktlen, pkt, new_ctb);
  931|  4.40k|      break;
  932|   122k|    case PKT_ENCRYPTED_AEAD:
  ------------------
  |  Branch (932:5): [True: 122k, False: 521k]
  ------------------
  933|   122k|      rc = parse_encrypted_aead (inp, pkttype, pktlen, pkt, partial);
  934|   122k|      break;
  935|  9.26k|    case PKT_GPG_CONTROL:
  ------------------
  |  Branch (935:5): [True: 9.26k, False: 634k]
  ------------------
  936|  9.26k|      rc = parse_gpg_control (inp, pkttype, pktlen, pkt, partial);
  937|  9.26k|      break;
  938|  3.82k|    case PKT_MARKER:
  ------------------
  |  Branch (938:5): [True: 3.82k, False: 640k]
  ------------------
  939|  3.82k|      rc = parse_marker (inp, pkttype, pktlen);
  940|  3.82k|      break;
  941|  11.0k|    default:
  ------------------
  |  Branch (941:5): [True: 11.0k, False: 632k]
  ------------------
  942|       |      /* Unknown packet.  Skip it.  */
  943|  11.0k|      skip_packet (inp, pkttype, pktlen, partial);
  944|  11.0k|      break;
  945|   643k|    }
  946|       |
  947|       |  /* Store a shallow copy of certain packets in the context.  */
  948|   621k|  free_packet (NULL, ctx);
  949|   621k|  if (!rc && (pkttype == PKT_PUBLIC_KEY
  ------------------
  |  Branch (949:7): [True: 559k, False: 61.3k]
  |  Branch (949:15): [True: 22.2k, False: 537k]
  ------------------
  950|   559k|              || pkttype == PKT_SECRET_KEY
  ------------------
  |  Branch (950:18): [True: 655, False: 536k]
  ------------------
  951|   559k|              || pkttype == PKT_USER_ID
  ------------------
  |  Branch (951:18): [True: 51.9k, False: 484k]
  ------------------
  952|   559k|              || pkttype == PKT_ATTRIBUTE
  ------------------
  |  Branch (952:18): [True: 0, False: 484k]
  ------------------
  953|   559k|              || pkttype == PKT_SIGNATURE))
  ------------------
  |  Branch (953:18): [True: 130k, False: 354k]
  ------------------
  954|   205k|    {
  955|   205k|      ctx->last_pkt = *pkt;
  956|   205k|    }
  957|       |
  958|   737k| leave:
  959|       |  /* FIXME: We leak in case of an error (see the xmalloc's above).  */
  960|   737k|  if (!rc && iobuf_error (inp))
  ------------------
  |  |  454|   574k|#define iobuf_error(a)	      ((a)->error)
  |  |  ------------------
  |  |  |  Branch (454:30): [True: 1.42k, False: 572k]
  |  |  ------------------
  ------------------
  |  Branch (960:7): [True: 574k, False: 163k]
  ------------------
  961|  1.42k|    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|   737k|  return rc == -1? -1 : gpg_err_code (rc);
  ------------------
  |  Branch (966:10): [True: 16.3k, False: 721k]
  ------------------
  967|   621k|}
parse-packet.c:parse_key:
 2462|  52.1k|{
 2463|  52.1k|  gpg_error_t err = 0;
 2464|  52.1k|  int i, version, algorithm;
 2465|  52.1k|  unsigned long timestamp, expiredate, max_expiredate;
 2466|  52.1k|  int npkey, nskey;
 2467|  52.1k|  u32 keyid[2];
 2468|  52.1k|  PKT_public_key *pk;
 2469|  52.1k|  int is_v5;
 2470|  52.1k|  unsigned int pkbytes; /* For v5 keys: Number of bytes in the public
 2471|       |                         * key material.  For v4 keys: 0.  */
 2472|       |
 2473|  52.1k|  (void) hdr;
 2474|       |
 2475|  52.1k|  pk = pkt->pkt.public_key; /* PK has been cleared. */
 2476|       |
 2477|  52.1k|  version = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  52.1k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  52.1k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 52.1k]
  |  |  |  |  |  Branch (500:24): [True: 263, False: 51.8k]
  |  |  |  |  ------------------
  |  |  |  |  501|  52.1k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2478|  52.1k|  pktlen--;
 2479|  52.1k|  if (pkttype == PKT_PUBLIC_SUBKEY && version == '#')
  ------------------
  |  Branch (2479:7): [True: 11.5k, False: 40.5k]
  |  Branch (2479:39): [True: 7.88k, False: 3.64k]
  ------------------
 2480|  7.88k|    {
 2481|       |      /* Early versions of G10 used the old PGP comments packets;
 2482|       |       * luckily all those comments are started by a hash.  */
 2483|  7.88k|      if (list_mode)
  ------------------
  |  Branch (2483:11): [True: 0, False: 7.88k]
  ------------------
 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|  7.88k|      iobuf_skip_rest (inp, pktlen, 0);
 2500|  7.88k|      return 0;
 2501|  7.88k|    }
 2502|  44.2k|  else if (version == 4)
  ------------------
  |  Branch (2502:12): [True: 39.8k, False: 4.32k]
  ------------------
 2503|  39.8k|    is_v5 = 0;
 2504|  4.32k|  else if (version == 5)
  ------------------
  |  Branch (2504:12): [True: 2.22k, False: 2.10k]
  ------------------
 2505|  2.22k|    is_v5 = 1;
 2506|  2.10k|  else if (version == 2 || version == 3)
  ------------------
  |  Branch (2506:12): [True: 202, False: 1.90k]
  |  Branch (2506:28): [True: 188, False: 1.71k]
  ------------------
 2507|    390|    {
 2508|       |      /* Not anymore supported since 2.1.  Use an older gpg version
 2509|       |       * (i.e. gpg 1.4) to parse v3 packets.  */
 2510|    390|      if (opt.verbose > 1 && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (2510:11): [True: 0, False: 390]
  |  Branch (2510:30): [True: 0, False: 0]
  ------------------
 2511|      0|        log_info ("packet(%d) with obsolete version %d\n", pkttype, version);
 2512|    390|      if (list_mode)
  ------------------
  |  Branch (2512:11): [True: 0, False: 390]
  ------------------
 2513|      0|        es_fprintf (listfp, ":key packet: [obsolete version %d]\n", version);
 2514|    390|      pk->version = version;
 2515|    390|      err = gpg_error (GPG_ERR_LEGACY_KEY);
 2516|    390|      goto leave;
 2517|    390|    }
 2518|  1.71k|  else
 2519|  1.71k|    {
 2520|  1.71k|      log_error ("packet(%d) with unknown version %d\n", pkttype, version);
 2521|  1.71k|      if (list_mode)
  ------------------
  |  Branch (2521:11): [True: 0, False: 1.71k]
  ------------------
 2522|      0|        es_fputs (":key packet: [unknown version]\n", listfp);
 2523|  1.71k|      err = gpg_error (GPG_ERR_INV_PACKET);
 2524|  1.71k|      goto leave;
 2525|  1.71k|    }
 2526|       |
 2527|  42.1k|  if (pktlen < (is_v5? 15:11))
  ------------------
  |  Branch (2527:7): [True: 312, False: 41.8k]
  |  Branch (2527:17): [True: 2.22k, False: 39.8k]
  ------------------
 2528|    312|    {
 2529|    312|      log_error ("packet(%d) too short\n", pkttype);
 2530|    312|      if (list_mode)
  ------------------
  |  Branch (2530:11): [True: 0, False: 312]
  ------------------
 2531|      0|        es_fputs (":key packet: [too short]\n", listfp);
 2532|    312|      err = gpg_error (GPG_ERR_INV_PACKET);
 2533|    312|      goto leave;
 2534|    312|    }
 2535|  41.8k|  else if (pktlen > MAX_KEY_PACKET_LENGTH)
  ------------------
  |  |   37|  41.8k|#define MAX_KEY_PACKET_LENGTH     (256 * 1024)
  ------------------
  |  Branch (2535:12): [True: 737, False: 41.0k]
  ------------------
 2536|    737|    {
 2537|    737|      log_error ("packet(%d) too large\n", pkttype);
 2538|    737|      if (list_mode)
  ------------------
  |  Branch (2538:11): [True: 0, False: 737]
  ------------------
 2539|      0|        es_fputs (":key packet: [too large]\n", listfp);
 2540|    737|      err = gpg_error (GPG_ERR_INV_PACKET);
 2541|    737|      goto leave;
 2542|    737|    }
 2543|       |
 2544|  41.0k|  timestamp = read_32 (inp);
 2545|  41.0k|  pktlen -= 4;
 2546|  41.0k|  expiredate = 0;		/* have to get it from the selfsignature */
 2547|  41.0k|  max_expiredate = 0;
 2548|  41.0k|  algorithm = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  41.0k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  41.0k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 41.0k]
  |  |  |  |  |  Branch (500:24): [True: 248, False: 40.8k]
  |  |  |  |  ------------------
  |  |  |  |  501|  41.0k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2549|  41.0k|  pktlen--;
 2550|  41.0k|  if (is_v5)
  ------------------
  |  Branch (2550:7): [True: 2.13k, False: 38.9k]
  ------------------
 2551|  2.13k|    {
 2552|  2.13k|      pkbytes = read_32 (inp);
 2553|  2.13k|      pktlen -= 4;
 2554|  2.13k|    }
 2555|  38.9k|  else
 2556|  38.9k|    pkbytes = 0;
 2557|       |
 2558|  41.0k|  if (list_mode)
  ------------------
  |  Branch (2558:7): [True: 0, False: 41.0k]
  ------------------
 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|  41.0k|  pk->timestamp = timestamp;
 2574|  41.0k|  pk->expiredate = expiredate;
 2575|  41.0k|  pk->max_expiredate = max_expiredate;
 2576|  41.0k|  pk->hdrbytes = hdrlen;
 2577|  41.0k|  pk->version = version;
 2578|  41.0k|  pk->flags.primary = (pkttype == PKT_PUBLIC_KEY || pkttype == PKT_SECRET_KEY);
  ------------------
  |  Branch (2578:24): [True: 22.6k, False: 18.3k]
  |  Branch (2578:53): [True: 11.0k, False: 7.37k]
  ------------------
 2579|  41.0k|  pk->pubkey_algo = algorithm;
 2580|       |
 2581|  41.0k|  nskey = pubkey_get_nskey (algorithm);
 2582|  41.0k|  npkey = pubkey_get_npkey (algorithm);
 2583|  41.0k|  if (!npkey)
  ------------------
  |  Branch (2583:7): [True: 13.8k, False: 27.2k]
  ------------------
 2584|  13.8k|    {
 2585|  13.8k|      if (list_mode)
  ------------------
  |  Branch (2585:11): [True: 0, False: 13.8k]
  ------------------
 2586|      0|	es_fprintf (listfp, "\tunknown algorithm %d\n", algorithm);
 2587|  13.8k|      unknown_pubkey_warning (algorithm);
 2588|  13.8k|    }
 2589|       |
 2590|  41.0k|  if (!npkey)
  ------------------
  |  Branch (2590:7): [True: 13.8k, False: 27.2k]
  ------------------
 2591|  13.8k|    {
 2592|       |      /* Unknown algorithm - put data into an opaque MPI.  */
 2593|  13.8k|      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|  13.8k|      pk->pkey[0] = gcry_mpi_set_opaque (NULL, tmpp, tmpp? pktlen * 8 : 0);
  ------------------
  |  Branch (2596:54): [True: 9.29k, False: 4.51k]
  ------------------
 2597|  13.8k|      pktlen = 0;
 2598|  13.8k|      goto leave;
 2599|  13.8k|    }
 2600|  27.2k|  else
 2601|  27.2k|    {
 2602|  82.4k|      for (i = 0; i < npkey; i++)
  ------------------
  |  Branch (2602:19): [True: 58.3k, False: 24.1k]
  ------------------
 2603|  58.3k|        {
 2604|  58.3k|          if (    (algorithm == PUBKEY_ALGO_ECDSA && (i == 0))
  ------------------
  |  Branch (2604:20): [True: 8.32k, False: 50.0k]
  |  Branch (2604:54): [True: 4.34k, False: 3.98k]
  ------------------
 2605|  58.3k|               || (algorithm == PUBKEY_ALGO_EDDSA && (i == 0))
  ------------------
  |  Branch (2605:20): [True: 4.36k, False: 49.6k]
  |  Branch (2605:54): [True: 2.22k, False: 2.14k]
  ------------------
 2606|  58.3k|               || (algorithm == PUBKEY_ALGO_ECDH  && (i == 0 || i == 2)))
  ------------------
  |  Branch (2606:20): [True: 3.69k, False: 48.0k]
  |  Branch (2606:55): [True: 1.30k, False: 2.38k]
  |  Branch (2606:65): [True: 1.14k, False: 1.23k]
  ------------------
 2607|  9.02k|            {
 2608|       |              /* Read the OID (i==0) or the KDF params (i==2).  */
 2609|  9.02k|              size_t n;
 2610|  9.02k|	      err = read_size_body (inp, pktlen, &n, pk->pkey+i);
 2611|  9.02k|              pktlen -= n;
 2612|  9.02k|            }
 2613|  49.3k|          else
 2614|  49.3k|            {
 2615|  49.3k|              unsigned int n = pktlen;
 2616|  49.3k|              if (algorithm == PUBKEY_ALGO_ECDSA
  ------------------
  |  Branch (2616:19): [True: 3.98k, False: 45.3k]
  ------------------
 2617|  49.3k|                  || algorithm == PUBKEY_ALGO_EDDSA
  ------------------
  |  Branch (2617:22): [True: 2.14k, False: 43.1k]
  ------------------
 2618|  49.3k|                  || algorithm == PUBKEY_ALGO_ECDH)
  ------------------
  |  Branch (2618:22): [True: 1.23k, False: 41.9k]
  ------------------
 2619|  7.36k|                pk->pkey[i] = sos_read (inp, &n, 0);
 2620|  41.9k|              else
 2621|  41.9k|                pk->pkey[i] = mpi_read (inp, &n, 0);
 2622|  49.3k|              pktlen -= n;
 2623|  49.3k|              if (!pk->pkey[i])
  ------------------
  |  Branch (2623:19): [True: 2.49k, False: 46.8k]
  ------------------
 2624|  2.49k|                err = gpg_error (GPG_ERR_INV_PACKET);
 2625|  49.3k|            }
 2626|  58.3k|          if (err)
  ------------------
  |  Branch (2626:15): [True: 3.13k, False: 55.1k]
  ------------------
 2627|  3.13k|            goto leave;
 2628|  55.1k|          if (list_mode)
  ------------------
  |  Branch (2628:15): [True: 0, False: 55.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|  55.1k|        }
 2644|  27.2k|    }
 2645|  24.1k|  if (list_mode)
  ------------------
  |  Branch (2645:7): [True: 0, False: 24.1k]
  ------------------
 2646|      0|    keyid_from_pk (pk, keyid);
 2647|       |
 2648|  24.1k|  if (pkttype == PKT_SECRET_KEY || pkttype == PKT_SECRET_SUBKEY)
  ------------------
  |  Branch (2648:7): [True: 8.44k, False: 15.6k]
  |  Branch (2648:36): [True: 3.09k, False: 12.5k]
  ------------------
 2649|  11.5k|    {
 2650|  11.5k|      struct seckey_info *ski;
 2651|  11.5k|      byte temp[16];
 2652|  11.5k|      size_t snlen = 0;
 2653|  11.5k|      unsigned int skbytes;
 2654|       |
 2655|  11.5k|      if (pktlen < 1)
  ------------------
  |  Branch (2655:11): [True: 636, False: 10.8k]
  ------------------
 2656|    636|        {
 2657|    636|          err = gpg_error (GPG_ERR_INV_PACKET);
 2658|    636|          goto leave;
 2659|    636|        }
 2660|       |
 2661|  10.8k|      pk->seckey_info = ski = xtrycalloc (1, sizeof *ski);
  ------------------
  |  |   99|  10.8k|#define xtrycalloc(a,b)  gcry_calloc ((a),(b))
  ------------------
 2662|  10.8k|      if (!pk->seckey_info)
  ------------------
  |  Branch (2662:11): [True: 0, False: 10.8k]
  ------------------
 2663|      0|        {
 2664|      0|          err = gpg_error_from_syserror ();
 2665|      0|          goto leave;
 2666|      0|        }
 2667|       |
 2668|  10.8k|      ski->algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  10.8k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  10.8k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 10.8k]
  |  |  |  |  |  Branch (500:24): [True: 43, False: 10.8k]
  |  |  |  |  ------------------
  |  |  |  |  501|  10.8k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2669|  10.8k|      pktlen--;
 2670|       |
 2671|  10.8k|      if (is_v5)
  ------------------
  |  Branch (2671:11): [True: 1.10k, False: 9.79k]
  ------------------
 2672|  1.10k|        {
 2673|  1.10k|          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|  1.10k|          if (!pktlen)
  ------------------
  |  Branch (2677:15): [True: 45, False: 1.05k]
  ------------------
 2678|     45|            {
 2679|     45|              err = gpg_error (GPG_ERR_INV_PACKET);
 2680|     45|              goto leave;
 2681|     45|            }
 2682|  1.05k|          protcount = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  1.05k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  1.05k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 1.05k]
  |  |  |  |  |  Branch (500:24): [True: 362, False: 696]
  |  |  |  |  ------------------
  |  |  |  |  501|  1.05k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2683|  1.05k|          pktlen--;
 2684|  1.05k|          if (list_mode)
  ------------------
  |  Branch (2684:15): [True: 0, False: 1.05k]
  ------------------
 2685|      0|            es_fprintf (listfp, "\tprotbytes: %u\n", protcount);
 2686|  1.05k|        }
 2687|       |
 2688|  10.8k|      if (ski->algo)
  ------------------
  |  Branch (2688:11): [True: 9.69k, False: 1.15k]
  ------------------
 2689|  9.69k|	{
 2690|  9.69k|	  ski->is_protected = 1;
 2691|  9.69k|	  ski->s2k.count = 0;
 2692|  9.69k|	  if (ski->algo == 254 || ski->algo == 255)
  ------------------
  |  Branch (2692:8): [True: 6.63k, False: 3.06k]
  |  Branch (2692:28): [True: 2.24k, False: 814]
  ------------------
 2693|  8.88k|	    {
 2694|  8.88k|              if (pktlen < 3)
  ------------------
  |  Branch (2694:19): [True: 262, False: 8.62k]
  ------------------
 2695|    262|		{
 2696|    262|		  err = gpg_error (GPG_ERR_INV_PACKET);
 2697|    262|		  goto leave;
 2698|    262|		}
 2699|       |
 2700|  8.62k|              ski->sha1chk = (ski->algo == 254);
 2701|  8.62k|	      ski->algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  8.62k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  8.62k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 8.62k]
  |  |  |  |  |  Branch (500:24): [True: 238, False: 8.38k]
  |  |  |  |  ------------------
  |  |  |  |  501|  8.62k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2702|  8.62k|	      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|  8.62k|	      ski->s2k.mode = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  8.62k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  8.62k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 8.62k]
  |  |  |  |  |  Branch (500:24): [True: 235, False: 8.38k]
  |  |  |  |  ------------------
  |  |  |  |  501|  8.62k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2707|  8.62k|	      pktlen--;
 2708|  8.62k|	      ski->s2k.hash_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  8.62k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  8.62k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 8.62k]
  |  |  |  |  |  Branch (500:24): [True: 399, False: 8.22k]
  |  |  |  |  ------------------
  |  |  |  |  501|  8.62k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2709|  8.62k|	      pktlen--;
 2710|       |	      /* Check for the special GNU extension.  */
 2711|  8.62k|	      if (ski->s2k.mode == 101)
  ------------------
  |  Branch (2711:12): [True: 2.90k, False: 5.71k]
  ------------------
 2712|  2.90k|		{
 2713|  14.4k|		  for (i = 0; i < 4 && pktlen; i++, pktlen--)
  ------------------
  |  Branch (2713:17): [True: 11.6k, False: 2.85k]
  |  Branch (2713:26): [True: 11.5k, False: 49]
  ------------------
 2714|  11.5k|		    temp[i] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  11.5k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  11.5k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 11.5k]
  |  |  |  |  |  Branch (500:24): [True: 32, False: 11.5k]
  |  |  |  |  ------------------
  |  |  |  |  501|  11.5k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2715|  2.90k|		  if (i < 4 || memcmp (temp, "GNU", 3))
  ------------------
  |  Branch (2715:9): [True: 49, False: 2.85k]
  |  Branch (2715:18): [True: 793, False: 2.06k]
  ------------------
 2716|    842|		    {
 2717|    842|		      if (list_mode)
  ------------------
  |  Branch (2717:13): [True: 0, False: 842]
  ------------------
 2718|      0|			es_fprintf (listfp, "\tunknown S2K %d\n",
 2719|      0|                                    ski->s2k.mode);
 2720|    842|		      err = gpg_error (GPG_ERR_INV_PACKET);
 2721|    842|		      goto leave;
 2722|    842|		    }
 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|  2.06k|		  ski->s2k.mode = 1000 + temp[3];
 2728|  2.06k|		}
 2729|       |
 2730|       |              /* Read the salt.  */
 2731|  7.78k|	      if (ski->s2k.mode == 3 || ski->s2k.mode == 1)
  ------------------
  |  Branch (2731:12): [True: 1.38k, False: 6.39k]
  |  Branch (2731:34): [True: 1.85k, False: 4.53k]
  ------------------
 2732|  3.24k|		{
 2733|  26.2k|		  for (i = 0; i < 8 && pktlen; i++, pktlen--)
  ------------------
  |  Branch (2733:17): [True: 23.3k, False: 2.85k]
  |  Branch (2733:26): [True: 22.9k, False: 383]
  ------------------
 2734|  22.9k|		    temp[i] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  22.9k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  22.9k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 22.9k]
  |  |  |  |  |  Branch (500:24): [True: 1.00k, False: 21.9k]
  |  |  |  |  ------------------
  |  |  |  |  501|  22.9k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2735|  3.24k|                  if (i < 8)
  ------------------
  |  Branch (2735:23): [True: 383, False: 2.85k]
  ------------------
 2736|    383|                    {
 2737|    383|		      err = gpg_error (GPG_ERR_INV_PACKET);
 2738|    383|		      goto leave;
 2739|    383|                    }
 2740|  2.85k|		  memcpy (ski->s2k.salt, temp, 8);
 2741|  2.85k|		}
 2742|       |
 2743|       |              /* Check the mode.  */
 2744|  7.39k|	      switch (ski->s2k.mode)
 2745|  7.39k|		{
 2746|  2.11k|		case 0:
  ------------------
  |  Branch (2746:3): [True: 2.11k, False: 5.27k]
  ------------------
 2747|  2.11k|		  if (list_mode)
  ------------------
  |  Branch (2747:9): [True: 0, False: 2.11k]
  ------------------
 2748|      0|		    es_fprintf (listfp, "\tsimple S2K");
 2749|  2.11k|		  break;
 2750|  1.65k|		case 1:
  ------------------
  |  Branch (2750:3): [True: 1.65k, False: 5.74k]
  ------------------
 2751|  1.65k|		  if (list_mode)
  ------------------
  |  Branch (2751:9): [True: 0, False: 1.65k]
  ------------------
 2752|      0|		    es_fprintf (listfp, "\tsalted S2K");
 2753|  1.65k|		  break;
 2754|  1.20k|		case 3:
  ------------------
  |  Branch (2754:3): [True: 1.20k, False: 6.19k]
  ------------------
 2755|  1.20k|		  if (list_mode)
  ------------------
  |  Branch (2755:9): [True: 0, False: 1.20k]
  ------------------
 2756|      0|		    es_fprintf (listfp, "\titer+salt S2K");
 2757|  1.20k|		  break;
 2758|    153|		case 1001:
  ------------------
  |  Branch (2758:3): [True: 153, False: 7.24k]
  ------------------
 2759|    153|		  if (list_mode)
  ------------------
  |  Branch (2759:9): [True: 0, False: 153]
  ------------------
 2760|      0|		    es_fprintf (listfp, "\tgnu-dummy");
 2761|    153|		  break;
 2762|    287|		case 1002:
  ------------------
  |  Branch (2762:3): [True: 287, False: 7.11k]
  ------------------
 2763|    287|		  if (list_mode)
  ------------------
  |  Branch (2763:9): [True: 0, False: 287]
  ------------------
 2764|      0|		    es_fprintf (listfp, "\tgnu-divert-to-card");
 2765|    287|		  break;
 2766|      8|		case 1003:
  ------------------
  |  Branch (2766:3): [True: 8, False: 7.39k]
  ------------------
 2767|      8|		  if (list_mode)
  ------------------
  |  Branch (2767:9): [True: 0, False: 8]
  ------------------
 2768|      0|		    es_fprintf (listfp, "\tgnu-mode1003");
 2769|      8|		  break;
 2770|  1.97k|		default:
  ------------------
  |  Branch (2770:3): [True: 1.97k, False: 5.42k]
  ------------------
 2771|  1.97k|		  if (list_mode)
  ------------------
  |  Branch (2771:9): [True: 0, False: 1.97k]
  ------------------
 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|  1.97k|		  err = gpg_error (GPG_ERR_INV_PACKET);
 2776|  1.97k|		  goto leave;
 2777|  7.39k|		}
 2778|       |
 2779|       |              /* Print some info.  */
 2780|  5.42k|	      if (list_mode && ski->s2k.mode != 1003)
  ------------------
  |  Branch (2780:12): [True: 0, False: 5.42k]
  |  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|  5.42k|              if (list_mode)
  ------------------
  |  Branch (2792:19): [True: 0, False: 5.42k]
  ------------------
 2793|      0|                es_putc ('\n', listfp);
 2794|       |
 2795|       |              /* Read remaining protection parameters.  */
 2796|  5.42k|	      if (ski->s2k.mode == 3)
  ------------------
  |  Branch (2796:12): [True: 1.20k, False: 4.22k]
  ------------------
 2797|  1.20k|		{
 2798|  1.20k|		  if (pktlen < 1)
  ------------------
  |  Branch (2798:9): [True: 103, False: 1.09k]
  ------------------
 2799|    103|		    {
 2800|    103|		      err = gpg_error (GPG_ERR_INV_PACKET);
 2801|    103|		      goto leave;
 2802|    103|		    }
 2803|  1.09k|		  ski->s2k.count = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  1.09k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  1.09k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 1.09k]
  |  |  |  |  |  Branch (500:24): [True: 194, False: 904]
  |  |  |  |  ------------------
  |  |  |  |  501|  1.09k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2804|  1.09k|		  pktlen--;
 2805|  1.09k|		  if (list_mode)
  ------------------
  |  Branch (2805:9): [True: 0, False: 1.09k]
  ------------------
 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.09k|		}
 2810|  4.22k|	      else if (ski->s2k.mode == 1002)
  ------------------
  |  Branch (2810:17): [True: 287, False: 3.93k]
  ------------------
 2811|    287|		{
 2812|       |		  /* Read the serial number. */
 2813|    287|		  if (pktlen < 1)
  ------------------
  |  Branch (2813:9): [True: 59, False: 228]
  ------------------
 2814|     59|		    {
 2815|     59|		      err = gpg_error (GPG_ERR_INV_PACKET);
 2816|     59|		      goto leave;
 2817|     59|		    }
 2818|    228|		  snlen = iobuf_get (inp);
  ------------------
  |  |  500|    228|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 228]
  |  |  |  Branch (500:24): [True: 12, False: 216]
  |  |  ------------------
  |  |  501|    228|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
 2819|    228|		  pktlen--;
 2820|    228|		  if (pktlen < snlen || snlen == (size_t)(-1))
  ------------------
  |  Branch (2820:9): [True: 93, False: 135]
  |  Branch (2820:27): [True: 0, False: 135]
  ------------------
 2821|     93|		    {
 2822|     93|		      err = gpg_error (GPG_ERR_INV_PACKET);
 2823|     93|		      goto leave;
 2824|     93|		    }
 2825|    228|		}
 2826|  5.42k|	    }
 2827|    814|	  else /* Old version; no S2K, so we set mode to 0, hash MD5.  */
 2828|    814|	    {
 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|    814|	      ski->s2k.mode = 0;
 2833|    814|	      ski->s2k.hash_algo = DIGEST_ALGO_MD5;
 2834|    814|	      if (list_mode)
  ------------------
  |  Branch (2834:12): [True: 0, False: 814]
  ------------------
 2835|      0|		es_fprintf (listfp, "\tprotect algo: %d  (hash algo: %d)\n",
 2836|      0|                            ski->algo, ski->s2k.hash_algo);
 2837|    814|	    }
 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|  5.98k|	  ski->ivlen = openpgp_cipher_blocklen (ski->algo);
 2849|  5.98k|	  log_assert (ski->ivlen <= sizeof (temp));
 2850|       |
 2851|  5.98k|	  if (ski->s2k.mode == 1001 || ski->s2k.mode == 1003)
  ------------------
  |  Branch (2851:8): [True: 153, False: 5.83k]
  |  Branch (2851:33): [True: 8, False: 5.82k]
  ------------------
 2852|    161|	    ski->ivlen = 0;
 2853|  5.82k|	  else if (ski->s2k.mode == 1002)
  ------------------
  |  Branch (2853:13): [True: 135, False: 5.68k]
  ------------------
 2854|    135|	    ski->ivlen = snlen < 16 ? snlen : 16;
  ------------------
  |  Branch (2854:19): [True: 35, False: 100]
  ------------------
 2855|       |
 2856|  5.98k|	  if (pktlen < ski->ivlen)
  ------------------
  |  Branch (2856:8): [True: 3.69k, False: 2.28k]
  ------------------
 2857|  3.69k|	    {
 2858|  3.69k|              err = gpg_error (GPG_ERR_INV_PACKET);
 2859|  3.69k|	      goto leave;
 2860|  3.69k|	    }
 2861|  19.9k|	  for (i = 0; i < ski->ivlen; i++, pktlen--)
  ------------------
  |  Branch (2861:16): [True: 17.6k, False: 2.28k]
  ------------------
 2862|  17.6k|	    temp[i] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  19.9k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  17.6k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 17.6k]
  |  |  |  |  |  Branch (500:24): [True: 905, False: 16.7k]
  |  |  |  |  ------------------
  |  |  |  |  501|  17.6k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2863|  2.28k|	  if (list_mode && ski->s2k.mode != 1003)
  ------------------
  |  Branch (2863:8): [True: 0, False: 2.28k]
  |  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|  2.28k|	  memcpy (ski->iv, temp, ski->ivlen);
 2873|  2.28k|	}
 2874|       |
 2875|       |      /* Skip count of secret key material.  */
 2876|  3.44k|      if (is_v5)
  ------------------
  |  Branch (2876:11): [True: 331, False: 3.11k]
  ------------------
 2877|    331|        {
 2878|    331|          if (pktlen < 4)
  ------------------
  |  Branch (2878:15): [True: 243, False: 88]
  ------------------
 2879|    243|            {
 2880|    243|              err = gpg_error (GPG_ERR_INV_PACKET);
 2881|    243|              goto leave;
 2882|    243|            }
 2883|     88|          skbytes = read_32 (inp);
 2884|     88|          pktlen -= 4;
 2885|     88|          if (list_mode)
  ------------------
  |  Branch (2885:15): [True: 0, False: 88]
  ------------------
 2886|      0|            es_fprintf (listfp, "\tskbytes: %u\n", skbytes);
 2887|     88|        }
 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|  3.19k|      if (ski->s2k.mode == 1001 || ski->s2k.mode == 1002)
  ------------------
  |  Branch (2893:11): [True: 153, False: 3.04k]
  |  Branch (2893:36): [True: 135, False: 2.91k]
  ------------------
 2894|    288|	{
 2895|       |	  /* Better set some dummy stuff here.  */
 2896|    288|	  pk->pkey[npkey] = gcry_mpi_set_opaque (NULL,
 2897|    288|						 xstrdup ("dummydata"),
  ------------------
  |  |  112|    288|#define xstrdup(a)       gcry_xstrdup ((a))
  ------------------
 2898|    288|						 10 * 8);
 2899|    288|	  pktlen = 0;
 2900|    288|	}
 2901|  2.91k|      else if (ski->s2k.mode == 1003)
  ------------------
  |  Branch (2901:16): [True: 8, False: 2.90k]
  ------------------
 2902|      8|	{
 2903|      8|          void *tmpp;
 2904|       |
 2905|      8|	  if (pktlen < 2) /* At least two bytes for parenthesis.  */
  ------------------
  |  Branch (2905:8): [True: 5, False: 3]
  ------------------
 2906|      5|	    {
 2907|      5|              err = gpg_error (GPG_ERR_INV_PACKET);
 2908|      5|	      goto leave;
 2909|      5|	    }
 2910|       |
 2911|      3|          tmpp = read_rest (inp, pktlen);
 2912|      3|          if (list_mode)
  ------------------
  |  Branch (2912:15): [True: 0, False: 3]
  ------------------
 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|      3|	  pk->pkey[npkey] = gcry_mpi_set_opaque (NULL,
 2927|      3|						 tmpp, tmpp? pktlen * 8 : 0);
  ------------------
  |  Branch (2927:14): [True: 0, False: 3]
  ------------------
 2928|      3|          pktlen = 0;
 2929|      3|	}
 2930|  2.90k|      else if (ski->is_protected)
  ------------------
  |  Branch (2930:16): [True: 1.99k, False: 911]
  ------------------
 2931|  1.99k|	{
 2932|  1.99k|          void *tmpp;
 2933|       |
 2934|  1.99k|	  if (pktlen < 2) /* At least two bytes for the length.  */
  ------------------
  |  Branch (2934:8): [True: 130, False: 1.86k]
  ------------------
 2935|    130|	    {
 2936|    130|              err = gpg_error (GPG_ERR_INV_PACKET);
 2937|    130|	      goto leave;
 2938|    130|	    }
 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.86k|          tmpp = read_rest (inp, pktlen);
 2946|  1.86k|	  pk->pkey[npkey] = gcry_mpi_set_opaque (NULL,
 2947|  1.86k|						 tmpp, tmpp? pktlen * 8 : 0);
  ------------------
  |  Branch (2947:14): [True: 1.43k, False: 425]
  ------------------
 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.86k|          if (pk->pkey[npkey])
  ------------------
  |  Branch (2951:15): [True: 1.86k, False: 0]
  ------------------
 2952|  1.86k|            gcry_mpi_set_flag (pk->pkey[npkey], GCRYMPI_FLAG_USER1);
 2953|  1.86k|	  pktlen = 0;
 2954|  1.86k|	  if (list_mode)
  ------------------
  |  Branch (2954:8): [True: 0, False: 1.86k]
  ------------------
 2955|      0|            es_fprintf (listfp, "\tskey[%d]: [v4 protected]\n", npkey);
 2956|  1.86k|	}
 2957|    911|      else
 2958|    911|	{
 2959|       |          /* Not encrypted.  */
 2960|  2.82k|	  for (i = npkey; i < nskey; i++)
  ------------------
  |  Branch (2960:20): [True: 2.14k, False: 672]
  ------------------
 2961|  2.14k|	    {
 2962|  2.14k|              unsigned int n;
 2963|       |
 2964|  2.14k|              if (pktlen < 2) /* At least two bytes for the length.  */
  ------------------
  |  Branch (2964:19): [True: 239, False: 1.90k]
  ------------------
 2965|    239|                {
 2966|    239|                  err = gpg_error (GPG_ERR_INV_PACKET);
 2967|    239|                  goto leave;
 2968|    239|                }
 2969|  1.90k|              n = pktlen;
 2970|  1.90k|              if (algorithm == PUBKEY_ALGO_ECDSA
  ------------------
  |  Branch (2970:19): [True: 222, False: 1.68k]
  ------------------
 2971|  1.90k|                  || algorithm == PUBKEY_ALGO_EDDSA
  ------------------
  |  Branch (2971:22): [True: 6, False: 1.68k]
  ------------------
 2972|  1.90k|                  || algorithm == PUBKEY_ALGO_ECDH)
  ------------------
  |  Branch (2972:22): [True: 54, False: 1.62k]
  ------------------
 2973|    282|                pk->pkey[i] = sos_read (inp, &n, 0);
 2974|  1.62k|              else
 2975|  1.62k|                pk->pkey[i] = mpi_read (inp, &n, 0);
 2976|  1.90k|              pktlen -= n;
 2977|  1.90k|              if (list_mode)
  ------------------
  |  Branch (2977:19): [True: 0, False: 1.90k]
  ------------------
 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|  1.90k|	      if (!pk->pkey[i])
  ------------------
  |  Branch (2984:12): [True: 1.21k, False: 692]
  ------------------
 2985|  1.21k|		err = gpg_error (GPG_ERR_INV_PACKET);
 2986|  1.90k|	    }
 2987|    672|	  if (err)
  ------------------
  |  Branch (2987:8): [True: 473, False: 199]
  ------------------
 2988|    473|	    goto leave;
 2989|       |
 2990|    199|	  if (pktlen < 2)
  ------------------
  |  Branch (2990:8): [True: 40, False: 159]
  ------------------
 2991|     40|	    {
 2992|     40|              err = gpg_error (GPG_ERR_INV_PACKET);
 2993|     40|	      goto leave;
 2994|     40|	    }
 2995|    159|	  ski->csum = read_16 (inp);
 2996|    159|	  pktlen -= 2;
 2997|    159|	  if (list_mode)
  ------------------
  |  Branch (2997:8): [True: 0, False: 159]
  ------------------
 2998|      0|            es_fprintf (listfp, "\tchecksum: %04hx\n", ski->csum);
 2999|    159|	}
 3000|  3.19k|    }
 3001|       |
 3002|       |  /* Note that KEYID below has been initialized above in list_mode.  */
 3003|  14.8k|  if (list_mode)
  ------------------
  |  Branch (3003:7): [True: 0, False: 14.8k]
  ------------------
 3004|      0|    es_fprintf (listfp, "\tkeyid: %08lX%08lX\n",
 3005|      0|                (ulong) keyid[0], (ulong) keyid[1]);
 3006|       |
 3007|  44.2k| leave:
 3008|  44.2k|  iobuf_skip_rest (inp, pktlen, 0);
 3009|  44.2k|  return err;
 3010|  14.8k|}
parse-packet.c:read_size_body:
 1117|  11.7k|{
 1118|  11.7k|  char buffer[256];
 1119|  11.7k|  char *tmpbuf;
 1120|  11.7k|  int i, c, nbytes;
 1121|       |
 1122|  11.7k|  *r_nread = 0;
 1123|  11.7k|  *r_data = NULL;
 1124|       |
 1125|  11.7k|  if (!pktlen)
  ------------------
  |  Branch (1125:7): [True: 105, False: 11.6k]
  ------------------
 1126|    105|    return gpg_error (GPG_ERR_INV_PACKET);
 1127|  11.6k|  c = iobuf_readbyte (inp);
 1128|  11.6k|  if (c < 0)
  ------------------
  |  Branch (1128:7): [True: 54, False: 11.5k]
  ------------------
 1129|     54|    return gpg_error (GPG_ERR_INV_PACKET);
 1130|  11.5k|  pktlen--;
 1131|  11.5k|  ++*r_nread;
 1132|  11.5k|  nbytes = c;
 1133|  11.5k|  if (nbytes < 2 || nbytes > 254)
  ------------------
  |  Branch (1133:7): [True: 41, False: 11.5k]
  |  Branch (1133:21): [True: 29, False: 11.4k]
  ------------------
 1134|     70|    return gpg_error (GPG_ERR_INV_PACKET);
 1135|  11.4k|  if (nbytes > pktlen)
  ------------------
  |  Branch (1135:7): [True: 2.66k, False: 8.82k]
  ------------------
 1136|  2.66k|    return gpg_error (GPG_ERR_INV_PACKET);
 1137|       |
 1138|  8.82k|  buffer[0] = nbytes;
 1139|       |
 1140|  58.5k|  for (i = 0; i < nbytes; i++)
  ------------------
  |  Branch (1140:15): [True: 50.0k, False: 8.45k]
  ------------------
 1141|  50.0k|    {
 1142|  50.0k|      c = iobuf_get (inp);
  ------------------
  |  |  500|  50.0k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 50.0k]
  |  |  |  Branch (500:24): [True: 494, False: 49.5k]
  |  |  ------------------
  |  |  501|  50.0k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
 1143|  50.0k|      if (c < 0)
  ------------------
  |  Branch (1143:11): [True: 366, False: 49.6k]
  ------------------
 1144|    366|        return gpg_error (GPG_ERR_INV_PACKET);
 1145|  49.6k|      ++*r_nread;
 1146|  49.6k|      buffer[1+i] = c;
 1147|  49.6k|    }
 1148|       |
 1149|  8.45k|  tmpbuf = xtrymalloc (1 + nbytes);
  ------------------
  |  |   97|  8.45k|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
 1150|  8.45k|  if (!tmpbuf)
  ------------------
  |  Branch (1150:7): [True: 0, False: 8.45k]
  ------------------
 1151|      0|    return gpg_error_from_syserror ();
 1152|  8.45k|  memcpy (tmpbuf, buffer, 1 + nbytes);
 1153|  8.45k|  *r_data = gcry_mpi_set_opaque (NULL, tmpbuf, 8 * (1 + nbytes));
 1154|  8.45k|  if (!*r_data)
  ------------------
  |  Branch (1154:7): [True: 0, False: 8.45k]
  ------------------
 1155|      0|    {
 1156|      0|      xfree (tmpbuf);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1157|      0|      return gpg_error_from_syserror ();
 1158|      0|    }
 1159|  8.45k|  return 0;
 1160|  8.45k|}
parse-packet.c:parse_symkeyenc:
 1207|  14.1k|{
 1208|  14.1k|  PKT_symkey_enc *k;
 1209|  14.1k|  int rc = 0;
 1210|  14.1k|  int i, version, s2kmode, cipher_algo, aead_algo, hash_algo, seskeylen, minlen;
 1211|       |
 1212|  14.1k|  if (pktlen < 4)
  ------------------
  |  Branch (1212:7): [True: 1.85k, False: 12.2k]
  ------------------
 1213|  1.85k|    goto too_short;
 1214|  12.2k|  version = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  12.2k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  12.2k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 12.2k]
  |  |  |  |  |  Branch (500:24): [True: 376, False: 11.9k]
  |  |  |  |  ------------------
  |  |  |  |  501|  12.2k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1215|  12.2k|  pktlen--;
 1216|  12.2k|  if (version == 4)
  ------------------
  |  Branch (1216:7): [True: 9.08k, False: 3.20k]
  ------------------
 1217|  9.08k|    ;
 1218|  3.20k|  else if (version == 5)
  ------------------
  |  Branch (1218:12): [True: 1.04k, False: 2.15k]
  ------------------
 1219|  1.04k|    ;
 1220|  2.15k|  else
 1221|  2.15k|    {
 1222|  2.15k|      log_error ("packet(%d) with unknown version %d\n", pkttype, version);
 1223|  2.15k|      if (list_mode)
  ------------------
  |  Branch (1223:11): [True: 0, False: 2.15k]
  ------------------
 1224|      0|        es_fprintf (listfp, ":symkey enc packet: [unknown version]\n");
 1225|  2.15k|      rc = gpg_error (GPG_ERR_INV_PACKET);
 1226|  2.15k|      goto leave;
 1227|  2.15k|    }
 1228|  10.1k|  if (pktlen > 200)
  ------------------
  |  Branch (1228:7): [True: 229, False: 9.90k]
  ------------------
 1229|    229|    {				/* (we encode the seskeylen in a byte) */
 1230|    229|      log_error ("packet(%d) too large\n", pkttype);
 1231|    229|      if (list_mode)
  ------------------
  |  Branch (1231:11): [True: 0, False: 229]
  ------------------
 1232|      0|        es_fprintf (listfp, ":symkey enc packet: [too large]\n");
 1233|    229|      rc = gpg_error (GPG_ERR_INV_PACKET);
 1234|    229|      goto leave;
 1235|    229|    }
 1236|  9.90k|  cipher_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  9.90k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  9.90k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 9.90k]
  |  |  |  |  |  Branch (500:24): [True: 285, False: 9.61k]
  |  |  |  |  ------------------
  |  |  |  |  501|  9.90k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1237|  9.90k|  pktlen--;
 1238|  9.90k|  if (version == 5)
  ------------------
  |  Branch (1238:7): [True: 1.03k, False: 8.86k]
  ------------------
 1239|  1.03k|    {
 1240|  1.03k|      aead_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  1.03k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  1.03k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 1.03k]
  |  |  |  |  |  Branch (500:24): [True: 75, False: 958]
  |  |  |  |  ------------------
  |  |  |  |  501|  1.03k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1241|  1.03k|      pktlen--;
 1242|  1.03k|    }
 1243|  8.86k|  else
 1244|  8.86k|    aead_algo = 0;
 1245|  9.90k|  if (pktlen < 2)
  ------------------
  |  Branch (1245:7): [True: 617, False: 9.28k]
  ------------------
 1246|    617|    goto too_short;
 1247|  9.28k|  s2kmode = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  9.28k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  9.28k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 9.28k]
  |  |  |  |  |  Branch (500:24): [True: 337, False: 8.94k]
  |  |  |  |  ------------------
  |  |  |  |  501|  9.28k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1248|  9.28k|  pktlen--;
 1249|  9.28k|  hash_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  9.28k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  9.28k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 9.28k]
  |  |  |  |  |  Branch (500:24): [True: 320, False: 8.96k]
  |  |  |  |  ------------------
  |  |  |  |  501|  9.28k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1250|  9.28k|  pktlen--;
 1251|  9.28k|  switch (s2kmode)
 1252|  9.28k|    {
 1253|  2.41k|    case 0: /* Simple S2K.  */
  ------------------
  |  Branch (1253:5): [True: 2.41k, False: 6.86k]
  ------------------
 1254|  2.41k|      minlen = 0;
 1255|  2.41k|      break;
 1256|  4.12k|    case 1: /* Salted S2K.  */
  ------------------
  |  Branch (1256:5): [True: 4.12k, False: 5.16k]
  ------------------
 1257|  4.12k|      minlen = 8;
 1258|  4.12k|      break;
 1259|    667|    case 3: /* Iterated+salted S2K.  */
  ------------------
  |  Branch (1259:5): [True: 667, False: 8.61k]
  ------------------
 1260|    667|      minlen = 9;
 1261|    667|      break;
 1262|  2.07k|    default:
  ------------------
  |  Branch (1262:5): [True: 2.07k, False: 7.20k]
  ------------------
 1263|  2.07k|      log_error ("unknown S2K mode %d\n", s2kmode);
 1264|  2.07k|      if (list_mode)
  ------------------
  |  Branch (1264:11): [True: 0, False: 2.07k]
  ------------------
 1265|      0|        es_fprintf (listfp, ":symkey enc packet: [unknown S2K mode]\n");
 1266|  2.07k|      goto leave;
 1267|  9.28k|    }
 1268|  7.20k|  if (minlen > pktlen)
  ------------------
  |  Branch (1268:7): [True: 3.72k, False: 3.48k]
  ------------------
 1269|  3.72k|    {
 1270|  3.72k|      log_error ("packet with S2K %d too short\n", s2kmode);
 1271|  3.72k|      if (list_mode)
  ------------------
  |  Branch (1271:11): [True: 0, False: 3.72k]
  ------------------
 1272|      0|        es_fprintf (listfp, ":symkey enc packet: [too short]\n");
 1273|  3.72k|      rc = gpg_error (GPG_ERR_INV_PACKET);
 1274|  3.72k|      goto leave;
 1275|  3.72k|    }
 1276|  3.48k|  seskeylen = pktlen - minlen;
 1277|  3.48k|  k = packet->pkt.symkey_enc = xmalloc_clear (sizeof *packet->pkt.symkey_enc
  ------------------
  |  |  116|  3.48k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
 1278|  3.48k|					      + seskeylen - 1);
 1279|  3.48k|  k->version = version;
 1280|  3.48k|  k->cipher_algo = cipher_algo;
 1281|  3.48k|  k->aead_algo = aead_algo;
 1282|  3.48k|  k->s2k.mode = s2kmode;
 1283|  3.48k|  k->s2k.hash_algo = hash_algo;
 1284|  3.48k|  if (s2kmode == 1 || s2kmode == 3)
  ------------------
  |  Branch (1284:7): [True: 399, False: 3.08k]
  |  Branch (1284:23): [True: 665, False: 2.41k]
  ------------------
 1285|  1.06k|    {
 1286|  9.57k|      for (i = 0; i < 8 && pktlen; i++, pktlen--)
  ------------------
  |  Branch (1286:19): [True: 8.51k, False: 1.06k]
  |  Branch (1286:28): [True: 8.51k, False: 0]
  ------------------
 1287|  8.51k|	k->s2k.salt[i] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  8.51k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  8.51k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 8.51k]
  |  |  |  |  |  Branch (500:24): [True: 339, False: 8.17k]
  |  |  |  |  ------------------
  |  |  |  |  501|  8.51k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1288|  1.06k|    }
 1289|  3.48k|  if (s2kmode == 3)
  ------------------
  |  Branch (1289:7): [True: 665, False: 2.81k]
  ------------------
 1290|    665|    {
 1291|    665|      k->s2k.count = iobuf_get_noeof (inp);
  ------------------
  |  |  502|    665|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|    665|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 665]
  |  |  |  |  |  Branch (500:24): [True: 21, False: 644]
  |  |  |  |  ------------------
  |  |  |  |  501|    665|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1292|    665|      pktlen--;
 1293|    665|    }
 1294|  3.48k|  k->seskeylen = seskeylen;
 1295|  3.48k|  if (k->seskeylen)
  ------------------
  |  Branch (1295:7): [True: 1.16k, False: 2.32k]
  ------------------
 1296|  1.16k|    {
 1297|  10.2k|      for (i = 0; i < seskeylen && pktlen; i++, pktlen--)
  ------------------
  |  Branch (1297:19): [True: 9.13k, False: 1.16k]
  |  Branch (1297:36): [True: 9.13k, False: 0]
  ------------------
 1298|  9.13k|	k->seskey[i] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  9.13k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  9.13k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 9.13k]
  |  |  |  |  |  Branch (500:24): [True: 6.31k, False: 2.82k]
  |  |  |  |  ------------------
  |  |  |  |  501|  9.13k|	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|  1.16k|      if (s2kmode != 1 && s2kmode != 3)
  ------------------
  |  Branch (1303:11): [True: 1.07k, False: 92]
  |  Branch (1303:27): [True: 409, False: 661]
  ------------------
 1304|    409|	log_info (_("WARNING: potentially insecure symmetrically"
  ------------------
  |  |   28|    409|#  define _(a) gettext (a)
  ------------------
 1305|    409|		    " encrypted session key\n"));
 1306|  1.16k|    }
 1307|  3.48k|  log_assert (!pktlen);
 1308|       |
 1309|  3.48k|  if (list_mode)
  ------------------
  |  Branch (1309:7): [True: 0, False: 3.48k]
  ------------------
 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|  14.1k| leave:
 1340|  14.1k|  iobuf_skip_rest (inp, pktlen, 0);
 1341|  14.1k|  return rc;
 1342|       |
 1343|  2.47k| too_short:
 1344|  2.47k|  log_error ("packet(%d) too short\n", pkttype);
 1345|  2.47k|  if (list_mode)
  ------------------
  |  Branch (1345:7): [True: 0, False: 2.47k]
  ------------------
 1346|      0|    es_fprintf (listfp, ":symkey enc packet: [too short]\n");
 1347|  2.47k|  rc = gpg_error (GPG_ERR_INV_PACKET);
 1348|  2.47k|  goto leave;
 1349|  3.48k|}
parse-packet.c:parse_pubkeyenc:
 1355|  8.37k|{
 1356|  8.37k|  int rc = 0;
 1357|  8.37k|  int i, ndata;
 1358|  8.37k|  PKT_pubkey_enc *k;
 1359|       |
 1360|  8.37k|  k = packet->pkt.pubkey_enc = xmalloc_clear (sizeof *packet->pkt.pubkey_enc);
  ------------------
  |  |  116|  8.37k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
 1361|  8.37k|  if (pktlen < 12)
  ------------------
  |  Branch (1361:7): [True: 1.21k, False: 7.15k]
  ------------------
 1362|  1.21k|    {
 1363|  1.21k|      log_error ("packet(%d) too short\n", pkttype);
 1364|  1.21k|      if (list_mode)
  ------------------
  |  Branch (1364:11): [True: 0, False: 1.21k]
  ------------------
 1365|      0|        es_fputs (":pubkey enc packet: [too short]\n", listfp);
 1366|  1.21k|      rc = gpg_error (GPG_ERR_INV_PACKET);
 1367|  1.21k|      goto leave;
 1368|  1.21k|    }
 1369|  7.15k|  k->version = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  7.15k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  7.15k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 7.15k]
  |  |  |  |  |  Branch (500:24): [True: 256, False: 6.90k]
  |  |  |  |  ------------------
  |  |  |  |  501|  7.15k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1370|  7.15k|  pktlen--;
 1371|  7.15k|  if (k->version != 2 && k->version != 3)
  ------------------
  |  Branch (1371:7): [True: 5.99k, False: 1.16k]
  |  Branch (1371:26): [True: 885, False: 5.10k]
  ------------------
 1372|    885|    {
 1373|    885|      log_error ("packet(%d) with unknown version %d\n", pkttype, k->version);
 1374|    885|      if (list_mode)
  ------------------
  |  Branch (1374:11): [True: 0, False: 885]
  ------------------
 1375|      0|        es_fputs (":pubkey enc packet: [unknown version]\n", listfp);
 1376|    885|      rc = gpg_error (GPG_ERR_INV_PACKET);
 1377|    885|      goto leave;
 1378|    885|    }
 1379|  6.27k|  k->keyid[0] = read_32 (inp);
 1380|  6.27k|  pktlen -= 4;
 1381|  6.27k|  k->keyid[1] = read_32 (inp);
 1382|  6.27k|  pktlen -= 4;
 1383|  6.27k|  k->pubkey_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  6.27k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  6.27k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 6.27k]
  |  |  |  |  |  Branch (500:24): [True: 130, False: 6.14k]
  |  |  |  |  ------------------
  |  |  |  |  501|  6.27k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 1384|  6.27k|  pktlen--;
 1385|  6.27k|  k->throw_keyid = 0;  /* Only used as flag for build_packet.  */
 1386|  6.27k|  if (list_mode)
  ------------------
  |  Branch (1386:7): [True: 0, False: 6.27k]
  ------------------
 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|  6.27k|  ndata = pubkey_get_nenc (k->pubkey_algo);
 1393|  6.27k|  if (!ndata)
  ------------------
  |  Branch (1393:7): [True: 2.40k, False: 3.86k]
  ------------------
 1394|  2.40k|    {
 1395|  2.40k|      if (list_mode)
  ------------------
  |  Branch (1395:11): [True: 0, False: 2.40k]
  ------------------
 1396|      0|	es_fprintf (listfp, "\tunsupported algorithm %d\n", k->pubkey_algo);
 1397|  2.40k|      unknown_pubkey_warning (k->pubkey_algo);
 1398|  2.40k|      k->data[0] = NULL; /* No need to store the encrypted data.  */
 1399|  2.40k|    }
 1400|  3.86k|  else
 1401|  3.86k|    {
 1402|  7.30k|      for (i = 0; i < ndata; i++)
  ------------------
  |  Branch (1402:19): [True: 6.87k, False: 433]
  ------------------
 1403|  6.87k|        {
 1404|  6.87k|          if (k->pubkey_algo == PUBKEY_ALGO_ECDH)
  ------------------
  |  Branch (1404:15): [True: 5.86k, False: 1.00k]
  ------------------
 1405|  5.86k|            {
 1406|  5.86k|              if (i == 1)
  ------------------
  |  Branch (1406:19): [True: 2.69k, False: 3.17k]
  ------------------
 1407|  2.69k|                {
 1408|  2.69k|                  size_t n;
 1409|  2.69k|                  rc = read_size_body (inp, pktlen, &n, k->data+i);
 1410|  2.69k|                  pktlen -= n;
 1411|  2.69k|                }
 1412|  3.17k|              else
 1413|  3.17k|                {
 1414|  3.17k|                  int n = pktlen;
 1415|  3.17k|                  k->data[i] = sos_read (inp, &n, 0);
 1416|  3.17k|                  pktlen -= n;
 1417|  3.17k|                  if (!k->data[i])
  ------------------
  |  Branch (1417:23): [True: 475, False: 2.69k]
  ------------------
 1418|    475|                    rc = gpg_error (GPG_ERR_INV_PACKET);
 1419|  3.17k|                }
 1420|  5.86k|            }
 1421|  1.00k|          else
 1422|  1.00k|            {
 1423|  1.00k|	      int n = pktlen;
 1424|  1.00k|              k->data[i] = mpi_read (inp, &n, 0);
 1425|  1.00k|              pktlen -= n;
 1426|  1.00k|              if (!k->data[i])
  ------------------
  |  Branch (1426:19): [True: 338, False: 668]
  ------------------
 1427|    338|                rc = gpg_error (GPG_ERR_INV_PACKET);
 1428|  1.00k|            }
 1429|  6.87k|          if (rc)
  ------------------
  |  Branch (1429:15): [True: 3.43k, False: 3.44k]
  ------------------
 1430|  3.43k|            goto leave;
 1431|  3.44k|          if (list_mode)
  ------------------
  |  Branch (1431:15): [True: 0, False: 3.44k]
  ------------------
 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|  3.44k|        }
 1438|  3.86k|    }
 1439|       |
 1440|  8.37k| leave:
 1441|  8.37k|  iobuf_skip_rest (inp, pktlen, 0);
 1442|  8.37k|  return rc;
 1443|  6.27k|}
parse-packet.c:parse_onepass_sig:
 2409|  21.1k|{
 2410|  21.1k|  int version;
 2411|  21.1k|  int rc = 0;
 2412|       |
 2413|  21.1k|  if (pktlen < 13)
  ------------------
  |  Branch (2413:7): [True: 26, False: 21.1k]
  ------------------
 2414|     26|    {
 2415|     26|      log_error ("packet(%d) too short\n", pkttype);
 2416|     26|      if (list_mode)
  ------------------
  |  Branch (2416:11): [True: 0, False: 26]
  ------------------
 2417|      0|        es_fputs (":onepass_sig packet: [too short]\n", listfp);
 2418|     26|      rc = gpg_error (GPG_ERR_INV_PACKET);
 2419|     26|      goto leave;
 2420|     26|    }
 2421|  21.1k|  version = 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: 412, False: 20.7k]
  |  |  |  |  ------------------
  |  |  |  |  501|  21.1k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2422|  21.1k|  pktlen--;
 2423|  21.1k|  if (version != 3)
  ------------------
  |  Branch (2423:7): [True: 1.46k, False: 19.7k]
  ------------------
 2424|  1.46k|    {
 2425|  1.46k|      log_error ("onepass_sig with unknown version %d\n", version);
 2426|  1.46k|      if (list_mode)
  ------------------
  |  Branch (2426:11): [True: 0, False: 1.46k]
  ------------------
 2427|      0|        es_fputs (":onepass_sig packet: [unknown version]\n", listfp);
 2428|  1.46k|      rc = gpg_error (GPG_ERR_INV_PACKET);
 2429|  1.46k|      goto leave;
 2430|  1.46k|    }
 2431|  19.7k|  ops->sig_class = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  19.7k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  19.7k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 19.7k]
  |  |  |  |  |  Branch (500:24): [True: 36, False: 19.6k]
  |  |  |  |  ------------------
  |  |  |  |  501|  19.7k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2432|  19.7k|  pktlen--;
 2433|  19.7k|  ops->digest_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  19.7k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  19.7k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 19.7k]
  |  |  |  |  |  Branch (500:24): [True: 37, False: 19.6k]
  |  |  |  |  ------------------
  |  |  |  |  501|  19.7k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2434|  19.7k|  pktlen--;
 2435|  19.7k|  ops->pubkey_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  19.7k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  19.7k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 19.7k]
  |  |  |  |  |  Branch (500:24): [True: 33, False: 19.6k]
  |  |  |  |  ------------------
  |  |  |  |  501|  19.7k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2436|  19.7k|  pktlen--;
 2437|  19.7k|  ops->keyid[0] = read_32 (inp);
 2438|  19.7k|  pktlen -= 4;
 2439|  19.7k|  ops->keyid[1] = read_32 (inp);
 2440|  19.7k|  pktlen -= 4;
 2441|  19.7k|  ops->last = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  19.7k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  19.7k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 19.7k]
  |  |  |  |  |  Branch (500:24): [True: 245, False: 19.4k]
  |  |  |  |  ------------------
  |  |  |  |  501|  19.7k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 2442|  19.7k|  pktlen--;
 2443|  19.7k|  if (list_mode)
  ------------------
  |  Branch (2443:7): [True: 0, False: 19.7k]
  ------------------
 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|  21.1k| leave:
 2454|  21.1k|  iobuf_skip_rest (inp, pktlen, 0);
 2455|  21.1k|  return rc;
 2456|  19.7k|}
parse-packet.c:parse_user_id:
 3091|  41.3k|{
 3092|  41.3k|  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|  41.3k|  if (pktlen > MAX_UID_PACKET_LENGTH)
  ------------------
  |  |   38|  41.3k|#define MAX_UID_PACKET_LENGTH     (  2 * 1024)
  ------------------
  |  Branch (3101:7): [True: 102, False: 41.2k]
  ------------------
 3102|    102|    {
 3103|    102|      log_error ("packet(%d) too large\n", pkttype);
 3104|    102|      if (list_mode)
  ------------------
  |  Branch (3104:11): [True: 0, False: 102]
  ------------------
 3105|      0|        es_fprintf (listfp, ":user ID packet: [too large]\n");
 3106|    102|      iobuf_skip_rest (inp, pktlen, 0);
 3107|    102|      return GPG_ERR_INV_PACKET;
 3108|    102|    }
 3109|       |
 3110|  41.2k|  packet->pkt.user_id = xmalloc_clear (sizeof *packet->pkt.user_id + pktlen);
  ------------------
  |  |  116|  41.2k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
 3111|  41.2k|  packet->pkt.user_id->len = pktlen;
 3112|  41.2k|  packet->pkt.user_id->ref = 1;
 3113|       |
 3114|  41.2k|  p = packet->pkt.user_id->name;
 3115|   220k|  for (; pktlen; pktlen--, p++)
  ------------------
  |  Branch (3115:10): [True: 179k, False: 41.2k]
  ------------------
 3116|   179k|    *p = iobuf_get_noeof (inp);
  ------------------
  |  |  502|   220k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   179k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 179k]
  |  |  |  |  |  Branch (500:24): [True: 60.0k, False: 119k]
  |  |  |  |  ------------------
  |  |  |  |  501|   179k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3117|  41.2k|  *p = 0;
 3118|       |
 3119|  41.2k|  if (list_mode)
  ------------------
  |  Branch (3119:7): [True: 0, False: 41.2k]
  ------------------
 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|  41.2k|  return 0;
 3134|  41.3k|}
parse-packet.c:parse_attribute:
 3174|  10.7k|{
 3175|  10.7k|  byte *p;
 3176|       |
 3177|  10.7k|  (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|  10.7k|  if (pktlen > MAX_ATTR_PACKET_LENGTH)
  ------------------
  |  |   40|  10.7k|#define MAX_ATTR_PACKET_LENGTH    ( 16 * 1024*1024)
  ------------------
  |  Branch (3182:7): [True: 54, False: 10.6k]
  ------------------
 3183|     54|    {
 3184|     54|      log_error ("packet(%d) too large\n", pkttype);
 3185|     54|      if (list_mode)
  ------------------
  |  Branch (3185:11): [True: 0, False: 54]
  ------------------
 3186|      0|        es_fprintf (listfp, ":attribute packet: [too large]\n");
 3187|     54|      iobuf_skip_rest (inp, pktlen, 0);
 3188|     54|      return GPG_ERR_INV_PACKET;
 3189|     54|    }
 3190|       |
 3191|  10.6k|#define EXTRA_UID_NAME_SPACE 71
 3192|  10.6k|  packet->pkt.user_id = xmalloc_clear (sizeof *packet->pkt.user_id
  ------------------
  |  |  116|  10.6k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
 3193|  10.6k|				       + EXTRA_UID_NAME_SPACE);
 3194|  10.6k|  packet->pkt.user_id->ref = 1;
 3195|  10.6k|  packet->pkt.user_id->attrib_data = xmalloc (pktlen? pktlen:1);
  ------------------
  |  |  107|  21.3k|#define xmalloc(a)       gcry_xmalloc ((a))
  |  |  ------------------
  |  |  |  Branch (107:41): [True: 9.08k, False: 1.60k]
  |  |  ------------------
  ------------------
 3196|  10.6k|  packet->pkt.user_id->attrib_len = pktlen;
 3197|       |
 3198|  10.6k|  p = packet->pkt.user_id->attrib_data;
 3199|   929M|  for (; pktlen; pktlen--, p++)
  ------------------
  |  Branch (3199:10): [True: 929M, False: 10.6k]
  ------------------
 3200|   929M|    *p = iobuf_get_noeof (inp);
  ------------------
  |  |  502|   929M|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   929M|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 929M]
  |  |  |  |  |  Branch (500:24): [True: 929M, False: 135k]
  |  |  |  |  ------------------
  |  |  |  |  501|   929M|	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|  10.6k|  parse_attribute_subpkts (packet->pkt.user_id);
 3206|       |
 3207|  10.6k|  make_attribute_uidname (packet->pkt.user_id, EXTRA_UID_NAME_SPACE);
  ------------------
  |  | 3191|  10.6k|#define EXTRA_UID_NAME_SPACE 71
  ------------------
 3208|       |
 3209|  10.6k|  if (list_mode)
  ------------------
  |  Branch (3209:7): [True: 0, False: 10.6k]
  ------------------
 3210|      0|    {
 3211|      0|      es_fprintf (listfp, ":attribute packet: %s\n", packet->pkt.user_id->name);
 3212|      0|    }
 3213|  10.6k|  return 0;
 3214|  10.7k|}
parse-packet.c:parse_comment:
 3219|  5.18k|{
 3220|  5.18k|  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|  5.18k|  if (pktlen > MAX_COMMENT_PACKET_LENGTH)
  ------------------
  |  |   39|  5.18k|#define MAX_COMMENT_PACKET_LENGTH ( 64 * 1024)
  ------------------
  |  Branch (3226:7): [True: 50, False: 5.13k]
  ------------------
 3227|     50|    {
 3228|     50|      log_error ("packet(%d) too large\n", pkttype);
 3229|     50|      if (list_mode)
  ------------------
  |  Branch (3229:11): [True: 0, False: 50]
  ------------------
 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|     50|      iobuf_skip_rest (inp, pktlen, 0);
 3233|     50|      return GPG_ERR_INV_PACKET;
 3234|     50|    }
 3235|  5.13k|  packet->pkt.comment = xmalloc (sizeof *packet->pkt.comment + pktlen - 1);
  ------------------
  |  |  107|  5.13k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 3236|  5.13k|  packet->pkt.comment->len = pktlen;
 3237|  5.13k|  p = packet->pkt.comment->data;
 3238|   808k|  for (; pktlen; pktlen--, p++)
  ------------------
  |  Branch (3238:10): [True: 803k, False: 5.13k]
  ------------------
 3239|   803k|    *p = iobuf_get_noeof (inp);
  ------------------
  |  |  502|   808k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   803k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 803k]
  |  |  |  |  |  Branch (500:24): [True: 774k, False: 28.8k]
  |  |  |  |  ------------------
  |  |  |  |  501|   803k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3240|       |
 3241|  5.13k|  if (list_mode)
  ------------------
  |  Branch (3241:7): [True: 0, False: 5.13k]
  ------------------
 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|  5.13k|  return 0;
 3256|  5.18k|}
parse-packet.c:parse_ring_trust:
 3265|  22.8k|{
 3266|  22.8k|  gpg_error_t err;
 3267|  22.8k|  iobuf_t inp = ctx->inp;
 3268|  22.8k|  PKT_ring_trust rt = {0};
 3269|  22.8k|  int c;
 3270|  22.8k|  int not_gpg = 0;
 3271|       |
 3272|  22.8k|  if (!pktlen)
  ------------------
  |  Branch (3272:7): [True: 121, False: 22.7k]
  ------------------
 3273|    121|    {
 3274|    121|      if (list_mode)
  ------------------
  |  Branch (3274:11): [True: 0, False: 121]
  ------------------
 3275|      0|	es_fprintf (listfp, ":trust packet: empty\n");
 3276|    121|      err = 0;
 3277|    121|      goto leave;
 3278|    121|    }
 3279|       |
 3280|  22.7k|  c = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  22.7k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  22.7k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 22.7k]
  |  |  |  |  |  Branch (500:24): [True: 271, False: 22.4k]
  |  |  |  |  ------------------
  |  |  |  |  501|  22.7k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3281|  22.7k|  pktlen--;
 3282|  22.7k|  rt.trustval = c;
 3283|  22.7k|  if (pktlen)
  ------------------
  |  Branch (3283:7): [True: 22.2k, False: 459]
  ------------------
 3284|  22.2k|    {
 3285|  22.2k|      if (!c)
  ------------------
  |  Branch (3285:11): [True: 15.4k, False: 6.85k]
  ------------------
 3286|  15.4k|        {
 3287|  15.4k|          c = 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: 203, False: 15.2k]
  |  |  |  |  ------------------
  |  |  |  |  501|  15.4k|	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|  15.4k|          if (!(c & 0x80))
  ------------------
  |  Branch (3290:15): [True: 15.1k, False: 293]
  ------------------
 3291|  15.1k|            rt.sigcache = c;
 3292|  15.4k|        }
 3293|  6.85k|      else
 3294|  6.85k|        iobuf_get_noeof (inp);  /* Dummy read.  */
  ------------------
  |  |  502|  6.85k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  6.85k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 6.85k]
  |  |  |  |  |  Branch (500:24): [True: 440, False: 6.41k]
  |  |  |  |  ------------------
  |  |  |  |  501|  6.85k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3295|  22.2k|      pktlen--;
 3296|  22.2k|    }
 3297|       |
 3298|       |  /* Next is the optional subtype.  */
 3299|  22.7k|  if (pktlen > 3)
  ------------------
  |  Branch (3299:7): [True: 16.4k, False: 6.27k]
  ------------------
 3300|  16.4k|    {
 3301|  16.4k|      char tmp[4];
 3302|  16.4k|      tmp[0] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  16.4k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  16.4k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 16.4k]
  |  |  |  |  |  Branch (500:24): [True: 769, False: 15.6k]
  |  |  |  |  ------------------
  |  |  |  |  501|  16.4k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3303|  16.4k|      tmp[1] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  16.4k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  16.4k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 16.4k]
  |  |  |  |  |  Branch (500:24): [True: 241, False: 16.2k]
  |  |  |  |  ------------------
  |  |  |  |  501|  16.4k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3304|  16.4k|      tmp[2] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  16.4k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  16.4k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 16.4k]
  |  |  |  |  |  Branch (500:24): [True: 318, False: 16.1k]
  |  |  |  |  ------------------
  |  |  |  |  501|  16.4k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3305|  16.4k|      tmp[3] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  16.4k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  16.4k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 16.4k]
  |  |  |  |  |  Branch (500:24): [True: 452, False: 15.9k]
  |  |  |  |  ------------------
  |  |  |  |  501|  16.4k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3306|  16.4k|      pktlen -= 4;
 3307|  16.4k|      if (!memcmp (tmp, "gpg", 3))
  ------------------
  |  Branch (3307:11): [True: 3.07k, False: 13.3k]
  ------------------
 3308|  3.07k|        rt.subtype = tmp[3];
 3309|  13.3k|      else
 3310|  13.3k|        not_gpg = 1;
 3311|  16.4k|    }
 3312|       |  /* If it is a key or uid subtype read the remaining data.  */
 3313|  22.7k|  if ((rt.subtype == RING_TRUST_KEY || rt.subtype == RING_TRUST_UID)
  ------------------
  |  |  517|  45.4k|#define RING_TRUST_KEY 1  /* A KEYORG on a primary key.      */
  ------------------
                if ((rt.subtype == RING_TRUST_KEY || rt.subtype == RING_TRUST_UID)
  ------------------
  |  |  518|  20.0k|#define RING_TRUST_UID 2  /* A KEYORG on a user id.          */
  ------------------
  |  Branch (3313:8): [True: 2.65k, False: 20.0k]
  |  Branch (3313:40): [True: 353, False: 19.7k]
  ------------------
 3314|  22.7k|      && pktlen >= 6 )
  ------------------
  |  Branch (3314:10): [True: 2.42k, False: 578]
  ------------------
 3315|  2.42k|    {
 3316|  2.42k|      int i;
 3317|  2.42k|      unsigned int namelen;
 3318|       |
 3319|  2.42k|      rt.keyorg = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  2.42k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  2.42k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 2.42k]
  |  |  |  |  |  Branch (500:24): [True: 32, False: 2.39k]
  |  |  |  |  ------------------
  |  |  |  |  501|  2.42k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3320|  2.42k|      pktlen--;
 3321|  2.42k|      rt.keyupdate = read_32 (inp);
 3322|  2.42k|      pktlen -= 4;
 3323|  2.42k|      namelen = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  2.42k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  2.42k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 2.42k]
  |  |  |  |  |  Branch (500:24): [True: 75, False: 2.35k]
  |  |  |  |  ------------------
  |  |  |  |  501|  2.42k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3324|  2.42k|      pktlen--;
 3325|  2.42k|      if (namelen && pktlen)
  ------------------
  |  Branch (3325:11): [True: 2.15k, False: 275]
  |  Branch (3325:22): [True: 1.66k, False: 485]
  ------------------
 3326|  1.66k|        {
 3327|  1.66k|          rt.url = xtrymalloc (namelen + 1);
  ------------------
  |  |   97|  1.66k|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
 3328|  1.66k|          if (!rt.url)
  ------------------
  |  Branch (3328:15): [True: 0, False: 1.66k]
  ------------------
 3329|      0|            {
 3330|      0|              err = gpg_error_from_syserror ();
 3331|      0|              goto leave;
 3332|      0|            }
 3333|  10.2k|          for (i = 0; pktlen && i < namelen; pktlen--, i++)
  ------------------
  |  Branch (3333:23): [True: 8.56k, False: 1.63k]
  |  Branch (3333:33): [True: 8.53k, False: 28]
  ------------------
 3334|  8.53k|            rt.url[i] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  10.2k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  8.53k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 8.53k]
  |  |  |  |  |  Branch (500:24): [True: 6.08k, False: 2.44k]
  |  |  |  |  ------------------
  |  |  |  |  501|  8.53k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3335|  1.66k|          rt.url[i] = 0;
 3336|  1.66k|        }
 3337|  2.42k|    }
 3338|       |
 3339|  22.7k|  if (list_mode)
  ------------------
  |  Branch (3339:7): [True: 0, False: 22.7k]
  ------------------
 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|  22.7k|  if (!ctx->last_pkt.pkt.generic || ctx->skip_meta)
  ------------------
  |  Branch (3374:7): [True: 3.45k, False: 19.2k]
  |  Branch (3374:37): [True: 0, False: 19.2k]
  ------------------
 3375|  3.45k|    ;
 3376|  19.2k|  else if (rt.subtype == RING_TRUST_SIG
  ------------------
  |  |  516|  38.5k|#define RING_TRUST_SIG 0  /* The classical signature cache.  */
  ------------------
  |  Branch (3376:12): [True: 17.0k, False: 2.17k]
  ------------------
 3377|  19.2k|           && ctx->last_pkt.pkttype == PKT_SIGNATURE)
  ------------------
  |  Branch (3377:15): [True: 16.4k, False: 647]
  ------------------
 3378|  16.4k|    {
 3379|  16.4k|      PKT_signature *sig = ctx->last_pkt.pkt.signature;
 3380|       |
 3381|  16.4k|      if ((rt.sigcache & 1))
  ------------------
  |  Branch (3381:11): [True: 14.6k, False: 1.76k]
  ------------------
 3382|  14.6k|        {
 3383|  14.6k|          sig->flags.checked = 1;
 3384|  14.6k|          sig->flags.valid = !!(rt.sigcache & 2);
 3385|  14.6k|        }
 3386|  16.4k|    }
 3387|  2.82k|  else if (rt.subtype == RING_TRUST_UID
  ------------------
  |  |  518|  5.64k|#define RING_TRUST_UID 2  /* A KEYORG on a user id.          */
  ------------------
  |  Branch (3387:12): [True: 293, False: 2.52k]
  ------------------
 3388|  2.82k|           && (ctx->last_pkt.pkttype == PKT_USER_ID
  ------------------
  |  Branch (3388:16): [True: 92, False: 201]
  ------------------
 3389|    293|               || ctx->last_pkt.pkttype == PKT_ATTRIBUTE))
  ------------------
  |  Branch (3389:19): [True: 0, False: 201]
  ------------------
 3390|     92|    {
 3391|     92|      PKT_user_id *uid = ctx->last_pkt.pkt.user_id;
 3392|       |
 3393|     92|      uid->keyorg = rt.keyorg;
 3394|     92|      uid->keyupdate = rt.keyupdate;
 3395|     92|      uid->updateurl = rt.url;
 3396|     92|      rt.url = NULL;
 3397|     92|    }
 3398|  2.73k|  else if (rt.subtype == RING_TRUST_KEY
  ------------------
  |  |  517|  5.46k|#define RING_TRUST_KEY 1  /* A KEYORG on a primary key.      */
  ------------------
  |  Branch (3398:12): [True: 1.83k, False: 894]
  ------------------
 3399|  2.73k|           && (ctx->last_pkt.pkttype == PKT_PUBLIC_KEY
  ------------------
  |  Branch (3399:16): [True: 1.45k, False: 384]
  ------------------
 3400|  1.83k|               || ctx->last_pkt.pkttype == PKT_SECRET_KEY))
  ------------------
  |  Branch (3400:19): [True: 20, False: 364]
  ------------------
 3401|  1.47k|    {
 3402|  1.47k|      PKT_public_key *pk = ctx->last_pkt.pkt.public_key;
 3403|       |
 3404|  1.47k|      pk->keyorg = rt.keyorg;
 3405|  1.47k|      pk->keyupdate = rt.keyupdate;
 3406|  1.47k|      pk->updateurl = rt.url;
 3407|  1.47k|      rt.url = NULL;
 3408|  1.47k|    }
 3409|       |
 3410|  22.7k|  err = 0;
 3411|       |
 3412|  22.8k| leave:
 3413|  22.8k|  xfree (rt.url);
  ------------------
  |  |  104|  22.8k|#define xfree(a)         gcry_free ((a))
  ------------------
 3414|  22.8k|  free_packet (NULL, ctx); /* This sets ctx->last_pkt to NULL.  */
 3415|  22.8k|  iobuf_skip_rest (inp, pktlen, 0);
 3416|  22.8k|  return err;
 3417|  22.7k|}
parse-packet.c:parse_plaintext:
 3423|  29.9k|{
 3424|  29.9k|  int rc = 0;
 3425|  29.9k|  int mode, namelen;
 3426|  29.9k|  PKT_plaintext *pt;
 3427|  29.9k|  byte *p;
 3428|  29.9k|  int c, i;
 3429|       |
 3430|  29.9k|  if (!partial && pktlen < 6)
  ------------------
  |  Branch (3430:7): [True: 23.5k, False: 6.46k]
  |  Branch (3430:19): [True: 309, False: 23.1k]
  ------------------
 3431|    309|    {
 3432|    309|      log_error ("packet(%d) too short (%lu)\n", pkttype, (ulong) pktlen);
 3433|    309|      if (list_mode)
  ------------------
  |  Branch (3433:11): [True: 0, False: 309]
  ------------------
 3434|      0|        es_fputs (":literal data packet: [too short]\n", listfp);
 3435|    309|      rc = gpg_error (GPG_ERR_INV_PACKET);
 3436|    309|      goto leave;
 3437|    309|    }
 3438|  29.6k|  mode = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  29.6k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  29.6k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 29.6k]
  |  |  |  |  |  Branch (500:24): [True: 6.25k, False: 23.4k]
  |  |  |  |  ------------------
  |  |  |  |  501|  29.6k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3439|  29.6k|  if (pktlen)
  ------------------
  |  Branch (3439:7): [True: 23.1k, False: 6.46k]
  ------------------
 3440|  23.1k|    pktlen--;
 3441|  29.6k|  namelen = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  29.6k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  29.6k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 29.6k]
  |  |  |  |  |  Branch (500:24): [True: 890, False: 28.7k]
  |  |  |  |  ------------------
  |  |  |  |  501|  29.6k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3442|  29.6k|  if (pktlen)
  ------------------
  |  Branch (3442:7): [True: 23.1k, False: 6.46k]
  ------------------
 3443|  23.1k|    pktlen--;
 3444|       |  /* Note that namelen will never exceed 255 bytes. */
 3445|  29.6k|  pt = pkt->pkt.plaintext =
 3446|  29.6k|    xmalloc (sizeof *pkt->pkt.plaintext + namelen - 1);
  ------------------
  |  |  107|  29.6k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 3447|  29.6k|  pt->new_ctb = new_ctb;
 3448|  29.6k|  pt->mode = mode;
 3449|  29.6k|  pt->namelen = namelen;
 3450|  29.6k|  pt->is_partial = partial;
 3451|  29.6k|  if (pktlen)
  ------------------
  |  Branch (3451:7): [True: 23.1k, False: 6.46k]
  ------------------
 3452|  23.1k|    {
 3453|   100k|      for (i = 0; pktlen > 4 && i < namelen; pktlen--, i++)
  ------------------
  |  Branch (3453:19): [True: 79.1k, False: 21.3k]
  |  Branch (3453:33): [True: 77.3k, False: 1.80k]
  ------------------
 3454|  77.3k|	pt->name[i] = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  77.3k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  77.3k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 77.3k]
  |  |  |  |  |  Branch (500:24): [True: 56.0k, False: 21.2k]
  |  |  |  |  ------------------
  |  |  |  |  501|  77.3k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3455|  23.1k|    }
 3456|  6.46k|  else
 3457|  6.46k|    {
 3458|  24.7k|      for (i = 0; i < namelen; i++)
  ------------------
  |  Branch (3458:19): [True: 18.8k, False: 5.91k]
  ------------------
 3459|  18.8k|	if ((c = iobuf_get (inp)) == -1)
  ------------------
  |  |  500|  18.8k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 18.8k]
  |  |  |  Branch (500:24): [True: 883, False: 17.9k]
  |  |  ------------------
  |  |  501|  18.8k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (3459:6): [True: 557, False: 18.3k]
  ------------------
 3460|    557|	  break;
 3461|  18.3k|	else
 3462|  18.3k|	  pt->name[i] = c;
 3463|  6.46k|    }
 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.61M|  for (; i < namelen; i++)
  ------------------
  |  Branch (3467:10): [True: 1.58M, False: 29.6k]
  ------------------
 3468|  1.58M|    pt->name[i] = 0;
 3469|       |
 3470|  29.6k|  pt->timestamp = read_32 (inp);
 3471|  29.6k|  if (pktlen)
  ------------------
  |  Branch (3471:7): [True: 23.1k, False: 6.46k]
  ------------------
 3472|  23.1k|    pktlen -= 4;
 3473|  29.6k|  pt->len = pktlen;
 3474|  29.6k|  pt->buf = inp;
 3475|       |
 3476|  29.6k|  if (list_mode)
  ------------------
  |  Branch (3476:7): [True: 0, False: 29.6k]
  ------------------
 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|  29.9k| leave:
 3497|  29.9k|  return rc;
 3498|  29.6k|}
parse-packet.c:parse_compressed:
 3504|   142k|{
 3505|   142k|  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|   142k|  (void) pkttype;
 3511|   142k|  (void) pktlen;
 3512|       |
 3513|   142k|  zd = pkt->pkt.compressed = xmalloc (sizeof *pkt->pkt.compressed);
  ------------------
  |  |  107|   142k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 3514|   142k|  zd->algorithm = 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: 22.6k, False: 119k]
  |  |  |  |  ------------------
  |  |  |  |  501|   142k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3515|   142k|  zd->len = 0;			/* not used */
 3516|   142k|  zd->new_ctb = new_ctb;
 3517|   142k|  zd->buf = inp;
 3518|   142k|  if (list_mode)
  ------------------
  |  Branch (3518:7): [True: 0, False: 142k]
  ------------------
 3519|      0|    es_fprintf (listfp, ":compressed packet: algo=%d\n", zd->algorithm);
 3520|   142k|  return 0;
 3521|   142k|}
parse-packet.c:parse_encrypted:
 3527|  9.59k|{
 3528|  9.59k|  int rc = 0;
 3529|  9.59k|  PKT_encrypted *ed;
 3530|  9.59k|  unsigned long orig_pktlen = pktlen;
 3531|       |
 3532|  9.59k|  ed = pkt->pkt.encrypted = xmalloc (sizeof *pkt->pkt.encrypted);
  ------------------
  |  |  107|  9.59k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 3533|       |  /* ed->len is set below.  */
 3534|  9.59k|  ed->extralen = 0;  /* Unknown here; only used in build_packet.  */
 3535|  9.59k|  ed->buf = NULL;
 3536|  9.59k|  ed->new_ctb = new_ctb;
 3537|  9.59k|  ed->is_partial = partial;
 3538|  9.59k|  ed->aead_algo = 0;
 3539|  9.59k|  ed->cipher_algo = 0; /* Only used with AEAD.  */
 3540|  9.59k|  ed->chunkbyte = 0;   /* Only used with AEAD.  */
 3541|  9.59k|  if (pkttype == PKT_ENCRYPTED_MDC)
  ------------------
  |  Branch (3541:7): [True: 3.61k, False: 5.98k]
  ------------------
 3542|  3.61k|    {
 3543|       |      /* Fixme: add some pktlen sanity checks.  */
 3544|  3.61k|      int version;
 3545|       |
 3546|  3.61k|      version = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  3.61k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  3.61k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 3.61k]
  |  |  |  |  |  Branch (500:24): [True: 1.95k, False: 1.65k]
  |  |  |  |  ------------------
  |  |  |  |  501|  3.61k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3547|  3.61k|      if (orig_pktlen)
  ------------------
  |  Branch (3547:11): [True: 1.48k, False: 2.12k]
  ------------------
 3548|  1.48k|	pktlen--;
 3549|  3.61k|      if (version != 1)
  ------------------
  |  Branch (3549:11): [True: 1.52k, False: 2.08k]
  ------------------
 3550|  1.52k|	{
 3551|  1.52k|	  log_error ("encrypted_mdc packet with unknown version %d\n",
 3552|  1.52k|		     version);
 3553|  1.52k|          if (list_mode)
  ------------------
  |  Branch (3553:15): [True: 0, False: 1.52k]
  ------------------
 3554|      0|            es_fputs (":encrypted data packet: [unknown version]\n", listfp);
 3555|       |	  /*skip_rest(inp, pktlen); should we really do this? */
 3556|  1.52k|	  rc = gpg_error (GPG_ERR_INV_PACKET);
 3557|  1.52k|	  goto leave;
 3558|  1.52k|	}
 3559|  2.08k|      ed->mdc_method = DIGEST_ALGO_SHA1;
 3560|  2.08k|    }
 3561|  5.98k|  else
 3562|  5.98k|    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|  8.06k|  if (orig_pktlen && pktlen < 10)
  ------------------
  |  Branch (3567:7): [True: 1.66k, False: 6.40k]
  |  Branch (3567:22): [True: 47, False: 1.61k]
  ------------------
 3568|     47|    {
 3569|       |      /* Actually this is blocksize+2.  */
 3570|     47|      log_error ("packet(%d) too short\n", pkttype);
 3571|     47|      if (list_mode)
  ------------------
  |  Branch (3571:11): [True: 0, False: 47]
  ------------------
 3572|      0|        es_fputs (":encrypted data packet: [too short]\n", listfp);
 3573|     47|      rc = GPG_ERR_INV_PACKET;
 3574|     47|      iobuf_skip_rest (inp, pktlen, partial);
 3575|     47|      goto leave;
 3576|     47|    }
 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|  8.01k|  ed->len = pktlen;
 3582|       |
 3583|  8.01k|  if (list_mode)
  ------------------
  |  Branch (3583:7): [True: 0, False: 8.01k]
  ------------------
 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|  8.01k|  ed->buf = inp;
 3595|       |
 3596|  9.59k| leave:
 3597|  9.59k|  return rc;
 3598|  8.01k|}
parse-packet.c:parse_mdc:
 3607|  4.40k|{
 3608|  4.40k|  int rc = 0;
 3609|  4.40k|  PKT_mdc *mdc;
 3610|  4.40k|  byte *p;
 3611|       |
 3612|  4.40k|  (void) pkttype;
 3613|       |
 3614|  4.40k|  mdc = pkt->pkt.mdc = xmalloc (sizeof *pkt->pkt.mdc);
  ------------------
  |  |  107|  4.40k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 3615|  4.40k|  if (list_mode)
  ------------------
  |  Branch (3615:7): [True: 0, False: 4.40k]
  ------------------
 3616|      0|    es_fprintf (listfp, ":mdc packet: length=%lu\n", pktlen);
 3617|  4.40k|  if (!new_ctb || pktlen != 20)
  ------------------
  |  Branch (3617:7): [True: 0, False: 4.40k]
  |  Branch (3617:19): [True: 1.63k, False: 2.76k]
  ------------------
 3618|  1.63k|    {
 3619|  1.63k|      log_error ("mdc_packet with invalid encoding\n");
 3620|  1.63k|      rc = gpg_error (GPG_ERR_INV_PACKET);
 3621|  1.63k|      goto leave;
 3622|  1.63k|    }
 3623|  2.76k|  p = mdc->hash;
 3624|  58.0k|  for (; pktlen; pktlen--, p++)
  ------------------
  |  Branch (3624:10): [True: 55.2k, False: 2.76k]
  ------------------
 3625|  55.2k|    *p = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  58.0k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  55.2k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 55.2k]
  |  |  |  |  |  Branch (500:24): [True: 710, False: 54.5k]
  |  |  |  |  ------------------
  |  |  |  |  501|  55.2k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3626|       |
 3627|  4.40k| leave:
 3628|  4.40k|  return rc;
 3629|  2.76k|}
parse-packet.c:parse_encrypted_aead:
 3635|   122k|{
 3636|   122k|  int rc = 0;
 3637|   122k|  PKT_encrypted *ed;
 3638|   122k|  unsigned long orig_pktlen = pktlen;
 3639|   122k|  int version;
 3640|       |
 3641|   122k|  ed = pkt->pkt.encrypted = xtrymalloc (sizeof *pkt->pkt.encrypted);
  ------------------
  |  |   97|   122k|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
 3642|   122k|  if (!ed)
  ------------------
  |  Branch (3642:7): [True: 0, False: 122k]
  ------------------
 3643|      0|    return gpg_error_from_syserror ();
 3644|   122k|  ed->len = 0;
 3645|   122k|  ed->extralen = 0;  /* (only used in build_packet.)  */
 3646|   122k|  ed->buf = NULL;
 3647|   122k|  ed->new_ctb = 1;   /* (packet number requires a new CTB anyway.)  */
 3648|   122k|  ed->is_partial = partial;
 3649|   122k|  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|   122k|  if (orig_pktlen && pktlen < 19)
  ------------------
  |  Branch (3652:7): [True: 687, False: 121k]
  |  Branch (3652:22): [True: 145, False: 542]
  ------------------
 3653|    145|    {
 3654|    145|      log_error ("packet(%d) too short\n", pkttype);
 3655|    145|      if (list_mode)
  ------------------
  |  Branch (3655:11): [True: 0, False: 145]
  ------------------
 3656|      0|        es_fputs (":aead encrypted packet: [too short]\n", listfp);
 3657|    145|      rc = gpg_error (GPG_ERR_INV_PACKET);
 3658|    145|      iobuf_skip_rest (inp, pktlen, partial);
 3659|    145|      goto leave;
 3660|    145|    }
 3661|       |
 3662|   122k|  version = iobuf_get_noeof (inp);
  ------------------
  |  |  502|   122k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   122k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 122k]
  |  |  |  |  |  Branch (500:24): [True: 400, False: 121k]
  |  |  |  |  ------------------
  |  |  |  |  501|   122k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3663|   122k|  if (orig_pktlen)
  ------------------
  |  Branch (3663:7): [True: 542, False: 121k]
  ------------------
 3664|    542|    pktlen--;
 3665|   122k|  if (version != 1)
  ------------------
  |  Branch (3665:7): [True: 3.12k, False: 118k]
  ------------------
 3666|  3.12k|    {
 3667|  3.12k|      log_error ("aead encrypted packet with unknown version %d\n",
 3668|  3.12k|                 version);
 3669|  3.12k|      if (list_mode)
  ------------------
  |  Branch (3669:11): [True: 0, False: 3.12k]
  ------------------
 3670|      0|        es_fputs (":aead encrypted packet: [unknown version]\n", listfp);
 3671|       |      /*skip_rest(inp, pktlen); should we really do this? */
 3672|  3.12k|      rc = gpg_error (GPG_ERR_INV_PACKET);
 3673|  3.12k|      goto leave;
 3674|  3.12k|    }
 3675|       |
 3676|   118k|  ed->cipher_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|   118k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   118k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 118k]
  |  |  |  |  |  Branch (500:24): [True: 39, False: 118k]
  |  |  |  |  ------------------
  |  |  |  |  501|   118k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3677|   118k|  if (orig_pktlen)
  ------------------
  |  Branch (3677:7): [True: 281, False: 118k]
  ------------------
 3678|    281|    pktlen--;
 3679|   118k|  ed->aead_algo = iobuf_get_noeof (inp);
  ------------------
  |  |  502|   118k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   118k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 118k]
  |  |  |  |  |  Branch (500:24): [True: 36, False: 118k]
  |  |  |  |  ------------------
  |  |  |  |  501|   118k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3680|   118k|  if (orig_pktlen)
  ------------------
  |  Branch (3680:7): [True: 281, False: 118k]
  ------------------
 3681|    281|    pktlen--;
 3682|   118k|  ed->chunkbyte = iobuf_get_noeof (inp);
  ------------------
  |  |  502|   118k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   118k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 118k]
  |  |  |  |  |  Branch (500:24): [True: 259, False: 118k]
  |  |  |  |  ------------------
  |  |  |  |  501|   118k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3683|   118k|  if (orig_pktlen)
  ------------------
  |  Branch (3683:7): [True: 281, False: 118k]
  ------------------
 3684|    281|    pktlen--;
 3685|       |
 3686|       |  /* Store the remaining length of the encrypted data.  We read the
 3687|       |   * rest during decryption.  */
 3688|   118k|  ed->len = pktlen;
 3689|       |
 3690|   118k|  if (list_mode)
  ------------------
  |  Branch (3690:7): [True: 0, False: 118k]
  ------------------
 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|   118k|  ed->buf = inp;
 3701|       |
 3702|   122k| leave:
 3703|   122k|  return rc;
 3704|   118k|}
parse-packet.c:parse_gpg_control:
 3721|  9.26k|{
 3722|  9.26k|  byte *p;
 3723|  9.26k|  const byte *sesmark;
 3724|  9.26k|  size_t sesmarklen;
 3725|  9.26k|  int i;
 3726|       |
 3727|  9.26k|  (void) pkttype;
 3728|       |
 3729|  9.26k|  if (list_mode)
  ------------------
  |  Branch (3729:7): [True: 0, False: 9.26k]
  ------------------
 3730|      0|    es_fprintf (listfp, ":packet 63: length %lu ", pktlen);
 3731|       |
 3732|  9.26k|  sesmark = get_session_marker (&sesmarklen);
 3733|  9.26k|  if (pktlen < sesmarklen + 1)	/* 1 is for the control bytes */
  ------------------
  |  Branch (3733:7): [True: 3.41k, False: 5.84k]
  ------------------
 3734|  3.41k|    goto skipit;
 3735|  91.9k|  for (i = 0; i < sesmarklen; i++, pktlen--)
  ------------------
  |  Branch (3735:15): [True: 86.5k, False: 5.38k]
  ------------------
 3736|  86.5k|    {
 3737|  86.5k|      if (sesmark[i] != iobuf_get_noeof (inp))
  ------------------
  |  |  502|  86.5k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  86.5k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 86.5k]
  |  |  |  |  |  Branch (500:24): [True: 137, False: 86.4k]
  |  |  |  |  ------------------
  |  |  |  |  501|  86.5k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
  |  Branch (3737:11): [True: 465, False: 86.1k]
  ------------------
 3738|    465|	goto skipit;
 3739|  86.5k|    }
 3740|  5.38k|  if (pktlen > 4096)
  ------------------
  |  Branch (3740:7): [True: 27, False: 5.35k]
  ------------------
 3741|     27|    goto skipit;  /* Definitely too large.  We skip it to avoid an
 3742|       |                     overflow in the malloc.  */
 3743|  5.35k|  if (list_mode)
  ------------------
  |  Branch (3743:7): [True: 0, False: 5.35k]
  ------------------
 3744|      0|    es_fputs ("- gpg control packet", listfp);
 3745|       |
 3746|  5.35k|  packet->pkt.gpg_control = xmalloc (sizeof *packet->pkt.gpg_control
  ------------------
  |  |  107|  5.35k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
 3747|  5.35k|				     + pktlen - 1);
 3748|  5.35k|  packet->pkt.gpg_control->control = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  5.35k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  5.35k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 5.35k]
  |  |  |  |  |  Branch (500:24): [True: 310, False: 5.04k]
  |  |  |  |  ------------------
  |  |  |  |  501|  5.35k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3749|  5.35k|  pktlen--;
 3750|  5.35k|  packet->pkt.gpg_control->datalen = pktlen;
 3751|  5.35k|  p = packet->pkt.gpg_control->data;
 3752|  17.3k|  for (; pktlen; pktlen--, p++)
  ------------------
  |  Branch (3752:10): [True: 12.0k, False: 5.35k]
  ------------------
 3753|  12.0k|    *p = iobuf_get_noeof (inp);
  ------------------
  |  |  502|  17.3k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  12.0k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 12.0k]
  |  |  |  |  |  Branch (500:24): [True: 21, False: 12.0k]
  |  |  |  |  ------------------
  |  |  |  |  501|  12.0k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
 3754|       |
 3755|  5.35k|  return 0;
 3756|       |
 3757|  3.91k| skipit:
 3758|  3.91k|  if (list_mode)
  ------------------
  |  Branch (3758:7): [True: 0, False: 3.91k]
  ------------------
 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|  3.91k|  iobuf_skip_rest (inp, pktlen, 0);
 3781|  3.91k|  return gpg_error (GPG_ERR_INV_PACKET);
 3782|  5.38k|}
parse-packet.c:parse_marker:
 1166|  3.82k|{
 1167|  3.82k|  (void) pkttype;
 1168|       |
 1169|  3.82k|  if (pktlen != 3)
  ------------------
  |  Branch (1169:7): [True: 424, False: 3.40k]
  ------------------
 1170|    424|    goto fail;
 1171|       |
 1172|  3.40k|  if (iobuf_get (inp) != 'P')
  ------------------
  |  |  500|  3.40k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 3.40k]
  |  |  |  Branch (500:24): [True: 73, False: 3.33k]
  |  |  ------------------
  |  |  501|  3.40k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (1172:7): [True: 194, False: 3.21k]
  ------------------
 1173|    194|    {
 1174|    194|      pktlen--;
 1175|    194|      goto fail;
 1176|    194|    }
 1177|       |
 1178|  3.21k|  if (iobuf_get (inp) != 'G')
  ------------------
  |  |  500|  3.21k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 3.21k]
  |  |  |  Branch (500:24): [True: 47, False: 3.16k]
  |  |  ------------------
  |  |  501|  3.21k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (1178:7): [True: 89, False: 3.12k]
  ------------------
 1179|     89|    {
 1180|     89|      pktlen--;
 1181|     89|      goto fail;
 1182|     89|    }
 1183|       |
 1184|  3.12k|  if (iobuf_get (inp) != 'P')
  ------------------
  |  |  500|  3.12k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 3.12k]
  |  |  |  Branch (500:24): [True: 195, False: 2.92k]
  |  |  ------------------
  |  |  501|  3.12k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (1184:7): [True: 2.72k, False: 395]
  ------------------
 1185|  2.72k|    {
 1186|  2.72k|      pktlen--;
 1187|  2.72k|      goto fail;
 1188|  2.72k|    }
 1189|       |
 1190|    395|  if (list_mode)
  ------------------
  |  Branch (1190:7): [True: 0, False: 395]
  ------------------
 1191|      0|    es_fputs (":marker packet: PGP\n", listfp);
 1192|       |
 1193|    395|  return 0;
 1194|       |
 1195|  3.43k| fail:
 1196|  3.43k|  log_error ("invalid marker packet\n");
 1197|  3.43k|  if (list_mode)
  ------------------
  |  Branch (1197:7): [True: 0, False: 3.43k]
  ------------------
 1198|      0|    es_fputs (":marker packet: [invalid]\n", listfp);
 1199|  3.43k|  iobuf_skip_rest (inp, pktlen, 0);
 1200|  3.43k|  return GPG_ERR_INV_PACKET;
 1201|  3.12k|}
parse-packet.c:skip_packet:
 1045|  11.0k|{
 1046|  11.0k|  if (list_mode)
  ------------------
  |  Branch (1046:7): [True: 0, False: 11.0k]
  ------------------
 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|  11.0k|  iobuf_skip_rest (inp, pktlen, partial);
 1073|  11.0k|}
parse-packet.c:can_handle_critical:
 1834|  17.3k|{
 1835|  17.3k|  switch (type)
 1836|  17.3k|    {
 1837|    291|    case SIGSUBPKT_NOTATION:
  ------------------
  |  Branch (1837:5): [True: 291, False: 17.0k]
  ------------------
 1838|    291|      if (n >= 8)
  ------------------
  |  Branch (1838:11): [True: 242, False: 49]
  ------------------
 1839|    242|	{
 1840|    242|	  size_t notation_len = ((buffer[4] << 8) | buffer[5]);
 1841|    242|	  if (n - 8 >= notation_len)
  ------------------
  |  Branch (1841:8): [True: 165, False: 77]
  ------------------
 1842|    165|	    return can_handle_critical_notation (buffer + 8, notation_len);
 1843|    242|	}
 1844|    126|      return 0;
 1845|    461|    case SIGSUBPKT_SIGNATURE:
  ------------------
  |  Branch (1845:5): [True: 461, False: 16.9k]
  ------------------
 1846|    540|    case SIGSUBPKT_SIG_CREATED:
  ------------------
  |  Branch (1846:5): [True: 79, False: 17.3k]
  ------------------
 1847|  1.04k|    case SIGSUBPKT_SIG_EXPIRE:
  ------------------
  |  Branch (1847:5): [True: 503, False: 16.8k]
  ------------------
 1848|  1.14k|    case SIGSUBPKT_KEY_EXPIRE:
  ------------------
  |  Branch (1848:5): [True: 99, False: 17.2k]
  ------------------
 1849|  1.33k|    case SIGSUBPKT_EXPORTABLE:
  ------------------
  |  Branch (1849:5): [True: 190, False: 17.1k]
  ------------------
 1850|  2.08k|    case SIGSUBPKT_REVOCABLE:
  ------------------
  |  Branch (1850:5): [True: 752, False: 16.6k]
  ------------------
 1851|  3.19k|    case SIGSUBPKT_REV_KEY:
  ------------------
  |  Branch (1851:5): [True: 1.11k, False: 16.2k]
  ------------------
 1852|  3.64k|    case SIGSUBPKT_ISSUER:	/* issuer key ID */
  ------------------
  |  Branch (1852:5): [True: 443, False: 16.9k]
  ------------------
 1853|  4.90k|    case SIGSUBPKT_ISSUER_FPR:	/* issuer fingerprint */
  ------------------
  |  Branch (1853:5): [True: 1.26k, False: 16.1k]
  ------------------
 1854|  4.97k|    case SIGSUBPKT_PREF_SYM:
  ------------------
  |  Branch (1854:5): [True: 70, False: 17.3k]
  ------------------
 1855|  5.07k|    case SIGSUBPKT_PREF_AEAD:
  ------------------
  |  Branch (1855:5): [True: 101, False: 17.2k]
  ------------------
 1856|  5.33k|    case SIGSUBPKT_PREF_HASH:
  ------------------
  |  Branch (1856:5): [True: 260, False: 17.1k]
  ------------------
 1857|  5.37k|    case SIGSUBPKT_PREF_COMPR:
  ------------------
  |  Branch (1857:5): [True: 42, False: 17.3k]
  ------------------
 1858|  5.41k|    case SIGSUBPKT_KEY_FLAGS:
  ------------------
  |  Branch (1858:5): [True: 41, False: 17.3k]
  ------------------
 1859|  5.55k|    case SIGSUBPKT_PRIMARY_UID:
  ------------------
  |  Branch (1859:5): [True: 136, False: 17.2k]
  ------------------
 1860|  5.87k|    case SIGSUBPKT_FEATURES:
  ------------------
  |  Branch (1860:5): [True: 317, False: 17.0k]
  ------------------
 1861|  6.30k|    case SIGSUBPKT_TRUST:
  ------------------
  |  Branch (1861:5): [True: 431, False: 16.9k]
  ------------------
 1862|  6.46k|    case SIGSUBPKT_REGEXP:
  ------------------
  |  Branch (1862:5): [True: 164, False: 17.2k]
  ------------------
 1863|  6.87k|    case SIGSUBPKT_ATTST_SIGS:
  ------------------
  |  Branch (1863:5): [True: 412, False: 16.9k]
  ------------------
 1864|       |      /* Is it enough to show the policy or keyserver? */
 1865|  7.19k|    case SIGSUBPKT_POLICY:
  ------------------
  |  Branch (1865:5): [True: 321, False: 17.0k]
  ------------------
 1866|  9.47k|    case SIGSUBPKT_PREF_KS:
  ------------------
  |  Branch (1866:5): [True: 2.27k, False: 15.1k]
  ------------------
 1867|  9.52k|    case SIGSUBPKT_REVOC_REASON: /* At least we know about it.  */
  ------------------
  |  Branch (1867:5): [True: 58, False: 17.3k]
  ------------------
 1868|  9.52k|      return 1;
 1869|       |
 1870|    799|    case SIGSUBPKT_KEY_BLOCK:
  ------------------
  |  Branch (1870:5): [True: 799, False: 16.5k]
  ------------------
 1871|    799|      if (n && !buffer[0])
  ------------------
  |  Branch (1871:11): [True: 751, False: 48]
  |  Branch (1871:16): [True: 617, False: 134]
  ------------------
 1872|    617|        return 1;
 1873|    182|      else
 1874|    182|        return 0;
 1875|       |
 1876|  6.76k|    default:
  ------------------
  |  Branch (1876:5): [True: 6.76k, False: 10.6k]
  ------------------
 1877|  6.76k|      return 0;
 1878|  17.3k|    }
 1879|  17.3k|}
parse-packet.c:can_handle_critical_notation:
 1812|    165|{
 1813|    165|  strlist_t sl;
 1814|       |
 1815|    165|  register_known_notation (NULL); /* Make sure it is initialized.  */
 1816|       |
 1817|    328|  for (sl = known_notations_list; sl; sl = sl->next)
  ------------------
  |  Branch (1817:35): [True: 165, False: 163]
  ------------------
 1818|    165|    if (sl->flags == len && !memcmp (sl->d, name, len))
  ------------------
  |  Branch (1818:9): [True: 44, False: 121]
  |  Branch (1818:29): [True: 2, False: 42]
  ------------------
 1819|      2|      return 1; /* Known */
 1820|       |
 1821|    163|  if (opt.verbose && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (1821:7): [True: 0, False: 163]
  |  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|    163|  return 0; /* Unknown.  */
 1829|    165|}
parse-packet.c:read_32:
  106|   210k|{
  107|   210k|  unsigned long a;
  108|   210k|  a = (unsigned long)iobuf_get_noeof (inp) << 24;
  ------------------
  |  |  502|   210k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   210k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 210k]
  |  |  |  |  |  Branch (500:24): [True: 2.13k, False: 208k]
  |  |  |  |  ------------------
  |  |  |  |  501|   210k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
  109|   210k|  a |= iobuf_get_noeof (inp) << 16;
  ------------------
  |  |  502|   210k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   210k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 210k]
  |  |  |  |  |  Branch (500:24): [True: 2.28k, False: 208k]
  |  |  |  |  ------------------
  |  |  |  |  501|   210k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
  110|   210k|  a |= iobuf_get_noeof (inp) << 8;
  ------------------
  |  |  502|   210k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   210k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 210k]
  |  |  |  |  |  Branch (500:24): [True: 2.20k, False: 208k]
  |  |  |  |  ------------------
  |  |  |  |  501|   210k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
  111|   210k|  a |= iobuf_get_noeof (inp);
  ------------------
  |  |  502|   210k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|   210k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 210k]
  |  |  |  |  |  Branch (500:24): [True: 2.20k, False: 208k]
  |  |  |  |  ------------------
  |  |  |  |  501|   210k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
  112|   210k|  return a;
  113|   210k|}
parse-packet.c:read_16:
   95|  69.0k|{
   96|  69.0k|  unsigned short a;
   97|  69.0k|  a = (unsigned short)iobuf_get_noeof (inp) << 8;
  ------------------
  |  |  502|  69.0k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  69.0k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 69.0k]
  |  |  |  |  |  Branch (500:24): [True: 417, False: 68.6k]
  |  |  |  |  ------------------
  |  |  |  |  501|  69.0k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
   98|  69.0k|  a |= iobuf_get_noeof (inp);
  ------------------
  |  |  502|  69.0k|#define iobuf_get_noeof(a)    (iobuf_get((a))&0xff)
  |  |  ------------------
  |  |  |  |  500|  69.0k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (500:9): [True: 0, False: 69.0k]
  |  |  |  |  |  Branch (500:24): [True: 569, False: 68.5k]
  |  |  |  |  ------------------
  |  |  |  |  501|  69.0k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  |  |  ------------------
  ------------------
   99|  69.0k|  return a;
  100|  69.0k|}
parse-packet.c:unknown_pubkey_warning:
  334|  53.9k|{
  335|  53.9k|  static byte unknown_pubkey_algos[256];
  336|       |
  337|       |  /* First check whether the algorithm is usable but not suitable for
  338|       |     encryption/signing.  */
  339|  53.9k|  if (pubkey_get_npkey (algo))
  ------------------
  |  Branch (339:7): [True: 9.92k, False: 44.0k]
  ------------------
  340|  9.92k|    {
  341|  9.92k|      if (opt.verbose && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (341:11): [True: 0, False: 9.92k]
  |  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|  9.92k|    }
  351|  44.0k|  else
  352|  44.0k|    {
  353|  44.0k|      algo &= 0xff;
  354|  44.0k|      if (!unknown_pubkey_algos[algo])
  ------------------
  |  Branch (354:11): [True: 220, False: 43.8k]
  ------------------
  355|    220|        {
  356|    220|          if (opt.verbose && !glo_ctrl.silence_parse_warnings)
  ------------------
  |  Branch (356:15): [True: 0, False: 220]
  |  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|    220|          unknown_pubkey_algos[algo] = 1;
  359|    220|        }
  360|  44.0k|    }
  361|  53.9k|}
parse-packet.c:read_rest:
 1082|  53.3k|{
 1083|  53.3k|  int c;
 1084|  53.3k|  byte *buf, *p;
 1085|       |
 1086|  53.3k|  buf = xtrymalloc (pktlen);
  ------------------
  |  |   97|  53.3k|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
 1087|  53.3k|  if (!buf)
  ------------------
  |  Branch (1087:7): [True: 8.43k, False: 44.8k]
  ------------------
 1088|  8.43k|    {
 1089|  8.43k|      gpg_error_t err = gpg_error_from_syserror ();
 1090|  8.43k|      log_error ("error reading rest of packet: %s\n", gpg_strerror (err));
 1091|  8.43k|      return NULL;
 1092|  8.43k|    }
 1093|   476k|  for (p = buf; pktlen; pktlen--)
  ------------------
  |  Branch (1093:17): [True: 438k, False: 38.3k]
  ------------------
 1094|   438k|    {
 1095|   438k|      c = iobuf_get (inp);
  ------------------
  |  |  500|   438k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 438k]
  |  |  |  Branch (500:24): [True: 7.40k, False: 430k]
  |  |  ------------------
  |  |  501|   438k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
 1096|   438k|      if (c == -1)
  ------------------
  |  Branch (1096:11): [True: 6.50k, False: 431k]
  ------------------
 1097|  6.50k|        {
 1098|  6.50k|          log_error ("premature eof while reading rest of packet\n");
 1099|  6.50k|          xfree (buf);
  ------------------
  |  |  104|  6.50k|#define xfree(a)         gcry_free ((a))
  ------------------
 1100|  6.50k|          return NULL;
 1101|  6.50k|        }
 1102|   431k|      *p++ = c;
 1103|   431k|    }
 1104|       |
 1105|  38.3k|  return buf;
 1106|  44.8k|}
parse-packet.c:sos_read:
  204|  23.0k|{
  205|  23.0k|  int c, c1, c2, i;
  206|  23.0k|  unsigned int nmax = *ret_nread;
  207|  23.0k|  unsigned int nbits, nbytes;
  208|  23.0k|  size_t nread = 0;
  209|  23.0k|  gcry_mpi_t a = NULL;
  210|  23.0k|  byte *buf = NULL;
  211|  23.0k|  byte *p;
  212|       |
  213|  23.0k|  if (!nmax)
  ------------------
  |  Branch (213:7): [True: 154, False: 22.9k]
  ------------------
  214|    154|    goto overflow;
  215|       |
  216|  22.9k|  if ((c = c1 = iobuf_get (inp)) == -1)
  ------------------
  |  |  500|  22.9k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 22.9k]
  |  |  |  Branch (500:24): [True: 464, False: 22.4k]
  |  |  ------------------
  |  |  501|  22.9k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (216:7): [True: 464, False: 22.4k]
  ------------------
  217|    464|    goto leave;
  218|  22.4k|  if (++nread == nmax)
  ------------------
  |  Branch (218:7): [True: 488, False: 21.9k]
  ------------------
  219|    488|    goto overflow;
  220|  21.9k|  nbits = c << 8;
  221|  21.9k|  if ((c = c2 = iobuf_get (inp)) == -1)
  ------------------
  |  |  500|  21.9k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 21.9k]
  |  |  |  Branch (500:24): [True: 665, False: 21.3k]
  |  |  ------------------
  |  |  501|  21.9k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (221:7): [True: 665, False: 21.3k]
  ------------------
  222|    665|    goto leave;
  223|  21.3k|  ++nread;
  224|  21.3k|  nbits |= c;
  225|  21.3k|  if (nbits > MAX_EXTERN_MPI_BITS)
  ------------------
  |  |   42|  21.3k|#define MAX_EXTERN_MPI_BITS 16384
  ------------------
  |  Branch (225:7): [True: 439, False: 20.8k]
  ------------------
  226|    439|    {
  227|    439|      log_error ("mpi too large (%u bits)\n", nbits);
  228|    439|      goto leave;
  229|    439|    }
  230|       |
  231|  20.8k|  nbytes = (nbits + 7) / 8;
  232|  20.8k|  buf = secure ? gcry_xmalloc_secure (nbytes) : gcry_xmalloc (nbytes);
  ------------------
  |  Branch (232:9): [True: 0, False: 20.8k]
  ------------------
  233|  20.8k|  p = buf;
  234|   362k|  for (i = 0; i < nbytes; i++)
  ------------------
  |  Branch (234:15): [True: 341k, False: 20.4k]
  ------------------
  235|   341k|    {
  236|   341k|      if (nread == nmax)
  ------------------
  |  Branch (236:11): [True: 283, False: 341k]
  ------------------
  237|    283|        goto overflow;
  238|       |
  239|   341k|      c = iobuf_get (inp);
  ------------------
  |  |  500|   341k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 341k]
  |  |  |  Branch (500:24): [True: 243, False: 341k]
  |  |  ------------------
  |  |  501|   341k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  240|   341k|      if (c == -1)
  ------------------
  |  Branch (240:11): [True: 117, False: 341k]
  ------------------
  241|    117|        goto leave;
  242|       |
  243|   341k|      p[i] = c;
  244|   341k|      nread ++;
  245|   341k|    }
  246|       |
  247|  20.4k|  a = gcry_mpi_set_opaque (NULL, buf, nbits);
  248|  20.4k|  gcry_mpi_set_flag (a, GCRYMPI_FLAG_USER2);
  249|  20.4k|  *ret_nread = nread;
  250|  20.4k|  return a;
  251|       |
  252|    925| overflow:
  253|    925|  log_error ("mpi larger than indicated length (%u bits)\n", 8*nmax);
  254|  2.61k| leave:
  255|  2.61k|  *ret_nread = nread;
  256|  2.61k|  gcry_free(buf);
  257|  2.61k|  return a;
  258|    925|}
parse-packet.c:mpi_read:
  130|  69.0k|{
  131|  69.0k|  int c, c1, c2, i;
  132|  69.0k|  unsigned int nmax = *ret_nread;
  133|  69.0k|  unsigned int nbits, nbytes;
  134|  69.0k|  size_t nread = 0;
  135|  69.0k|  gcry_mpi_t a = NULL;
  136|  69.0k|  byte *buf = NULL;
  137|  69.0k|  byte *p;
  138|       |
  139|  69.0k|  if (!nmax)
  ------------------
  |  Branch (139:7): [True: 138, False: 68.9k]
  ------------------
  140|    138|    goto overflow;
  141|       |
  142|  68.9k|  if ((c = c1 = iobuf_get (inp)) == -1)
  ------------------
  |  |  500|  68.9k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 68.9k]
  |  |  |  Branch (500:24): [True: 260, False: 68.6k]
  |  |  ------------------
  |  |  501|  68.9k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (142:7): [True: 260, False: 68.6k]
  ------------------
  143|    260|    goto leave;
  144|  68.6k|  if (++nread == nmax)
  ------------------
  |  Branch (144:7): [True: 247, False: 68.4k]
  ------------------
  145|    247|    goto overflow;
  146|  68.4k|  nbits = c << 8;
  147|  68.4k|  if ((c = c2 = iobuf_get (inp)) == -1)
  ------------------
  |  |  500|  68.4k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 68.4k]
  |  |  |  Branch (500:24): [True: 862, False: 67.5k]
  |  |  ------------------
  |  |  501|  68.4k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (147:7): [True: 862, False: 67.5k]
  ------------------
  148|    862|    goto leave;
  149|  67.5k|  ++nread;
  150|  67.5k|  nbits |= c;
  151|  67.5k|  if (nbits > MAX_EXTERN_MPI_BITS)
  ------------------
  |  |   42|  67.5k|#define MAX_EXTERN_MPI_BITS 16384
  ------------------
  |  Branch (151:7): [True: 2.14k, False: 65.4k]
  ------------------
  152|  2.14k|    {
  153|  2.14k|      log_error ("mpi too large (%u bits)\n", nbits);
  154|  2.14k|      goto leave;
  155|  2.14k|    }
  156|       |
  157|  65.4k|  nbytes = (nbits + 7) / 8;
  158|  65.4k|  buf = secure ? gcry_xmalloc_secure (nbytes + 2) : gcry_xmalloc (nbytes + 2);
  ------------------
  |  Branch (158:9): [True: 0, False: 65.4k]
  ------------------
  159|  65.4k|  p = buf;
  160|  65.4k|  p[0] = c1;
  161|  65.4k|  p[1] = c2;
  162|  1.49M|  for (i = 0; i < nbytes; i++)
  ------------------
  |  Branch (162:15): [True: 1.43M, False: 64.4k]
  ------------------
  163|  1.43M|    {
  164|  1.43M|      if (nread == nmax)
  ------------------
  |  Branch (164:11): [True: 480, False: 1.43M]
  ------------------
  165|    480|	goto overflow;
  166|       |
  167|  1.43M|      c = iobuf_get (inp);
  ------------------
  |  |  500|  1.43M|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 1.43M]
  |  |  |  Branch (500:24): [True: 645, False: 1.43M]
  |  |  ------------------
  |  |  501|  1.43M|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  168|  1.43M|      if (c == -1)
  ------------------
  |  Branch (168:11): [True: 500, False: 1.43M]
  ------------------
  169|    500|	goto leave;
  170|       |
  171|  1.43M|      p[i + 2] = c;
  172|  1.43M|      nread ++;
  173|  1.43M|    }
  174|       |
  175|  64.4k|  if (gcry_mpi_scan (&a, GCRYMPI_FMT_PGP, buf, nread, &nread))
  ------------------
  |  Branch (175:7): [True: 0, False: 64.4k]
  ------------------
  176|      0|    a = NULL;
  177|       |
  178|  64.4k|  *ret_nread = nread;
  179|  64.4k|  gcry_free(buf);
  180|  64.4k|  return a;
  181|       |
  182|    865| overflow:
  183|    865|  log_error ("mpi larger than indicated length (%u bits)\n", 8*nmax);
  184|  4.63k| leave:
  185|  4.63k|  *ret_nread = nread;
  186|  4.63k|  gcry_free(buf);
  187|  4.63k|  return a;
  188|    865|}

have_static_passphrase:
   53|   127k|{
   54|   127k|  return (!!fd_passwd
  ------------------
  |  Branch (54:11): [True: 0, False: 127k]
  ------------------
   55|   127k|          && (opt.batch || opt.pinentry_mode == PINENTRY_MODE_LOOPBACK));
  ------------------
  |  Branch (55:15): [True: 0, False: 0]
  |  Branch (55:28): [True: 0, False: 0]
  ------------------
   56|   127k|}
set_next_passphrase:
   76|  17.0k|{
   77|  17.0k|  xfree(next_pw);
  ------------------
  |  |  104|  17.0k|#define xfree(a)         gcry_free ((a))
  ------------------
   78|  17.0k|  next_pw = NULL;
   79|  17.0k|  if ( s )
  ------------------
  |  Branch (79:8): [True: 0, False: 17.0k]
  ------------------
   80|      0|    {
   81|      0|      next_pw = xmalloc_secure( strlen(s)+1 );
  ------------------
  |  |  108|      0|#define xmalloc_secure(a)  gcry_xmalloc_secure ((a))
  ------------------
   82|      0|      strcpy (next_pw, s );
   83|      0|    }
   84|  17.0k|}
get_last_passphrase:
   93|  8.53k|{
   94|  8.53k|  char *p = last_pw;
   95|  8.53k|  last_pw = NULL;
   96|  8.53k|  return p;
   97|  8.53k|}
passphrase_to_dek:
  284|   127k|{
  285|   127k|  char *pw = NULL;
  286|   127k|  DEK *dek;
  287|   127k|  STRING2KEY help_s2k;
  288|   127k|  int dummy_canceled;
  289|   127k|  char s2k_cacheidbuf[1+16+1];
  290|   127k|  char *s2k_cacheid = NULL;
  291|       |
  292|   127k|  if (!canceled)
  ------------------
  |  Branch (292:7): [True: 1.48k, False: 125k]
  ------------------
  293|  1.48k|    canceled = &dummy_canceled;
  294|   127k|  *canceled = 0;
  295|       |
  296|   127k|  if (opt.no_symkey_cache)
  ------------------
  |  Branch (296:7): [True: 0, False: 127k]
  ------------------
  297|      0|    nocache = 1;  /* Force no symmetric key caching.  */
  298|       |
  299|   127k|  if ( !s2k )
  ------------------
  |  Branch (299:8): [True: 0, False: 127k]
  ------------------
  300|      0|    {
  301|      0|      log_assert (create && !nocache);
  302|       |      /* This is used for the old rfc1991 mode
  303|       |       * Note: This must match the code in encode.c with opt.rfc1991 set */
  304|      0|      memset (&help_s2k, 0, sizeof (help_s2k));
  305|      0|      s2k = &help_s2k;
  306|      0|      s2k->hash_algo = S2K_DIGEST_ALGO;
  ------------------
  |  |   53|      0|#define S2K_DIGEST_ALGO (opt.s2k_digest_algo?opt.s2k_digest_algo:DEFAULT_S2K_DIGEST_ALGO)
  |  |  ------------------
  |  |  |  |   45|      0|#define DEFAULT_S2K_DIGEST_ALGO DIGEST_ALGO_SHA1
  |  |  ------------------
  |  |  |  Branch (53:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  307|      0|    }
  308|       |
  309|       |  /* Create a new salt or what else to be filled into the s2k for a
  310|       |     new key.  */
  311|   127k|  if (create && (s2k->mode == 1 || s2k->mode == 3))
  ------------------
  |  Branch (311:7): [True: 0, False: 127k]
  |  Branch (311:18): [True: 0, False: 0]
  |  Branch (311:36): [True: 0, False: 0]
  ------------------
  312|      0|    {
  313|      0|      gcry_randomize (s2k->salt, 8, GCRY_STRONG_RANDOM);
  314|      0|      if ( s2k->mode == 3 )
  ------------------
  |  Branch (314:12): [True: 0, False: 0]
  ------------------
  315|      0|        {
  316|       |          /* We delay the encoding until it is really needed.  This is
  317|       |             if we are going to dynamically calibrate it, we need to
  318|       |             call out to gpg-agent and that should not be done during
  319|       |             option processing in main().  */
  320|      0|          if (!opt.s2k_count)
  ------------------
  |  Branch (320:15): [True: 0, False: 0]
  ------------------
  321|      0|            opt.s2k_count = encode_s2k_iterations (agent_get_s2k_count ());
  322|      0|          s2k->count = opt.s2k_count;
  323|      0|        }
  324|      0|    }
  325|       |
  326|       |  /* If we do not have a passphrase available in NEXT_PW and status
  327|       |     information are request, we print them now. */
  328|   127k|  if ( !next_pw && is_status_enabled() )
  ------------------
  |  Branch (328:8): [True: 127k, False: 0]
  |  Branch (328:20): [True: 0, False: 127k]
  ------------------
  329|      0|    {
  330|      0|      char buf[50];
  331|       |
  332|      0|      snprintf (buf, sizeof buf, "%d %d %d",
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  333|      0|                cipher_algo, s2k->mode, s2k->hash_algo );
  334|      0|      write_status_text ( STATUS_NEED_PASSPHRASE_SYM, buf );
  335|      0|    }
  336|       |
  337|   127k|  if ( next_pw )
  ------------------
  |  Branch (337:8): [True: 0, False: 127k]
  ------------------
  338|      0|    {
  339|       |      /* Simply return the passphrase we already have in NEXT_PW. */
  340|      0|      pw = next_pw;
  341|      0|      next_pw = NULL;
  342|      0|    }
  343|   127k|  else if ( have_static_passphrase () )
  ------------------
  |  Branch (343:13): [True: 0, False: 127k]
  ------------------
  344|      0|    {
  345|       |      /* Return the passphrase we have stored in FD_PASSWD. */
  346|      0|      pw = xmalloc_secure ( strlen(fd_passwd)+1 );
  ------------------
  |  |  108|      0|#define xmalloc_secure(a)  gcry_xmalloc_secure ((a))
  ------------------
  347|      0|      strcpy ( pw, fd_passwd );
  348|      0|    }
  349|   127k|  else
  350|   127k|    {
  351|   127k|      if (!nocache && (s2k->mode == 1 || s2k->mode == 3))
  ------------------
  |  Branch (351:11): [True: 127k, False: 0]
  |  Branch (351:24): [True: 247, False: 126k]
  |  Branch (351:42): [True: 482, False: 126k]
  ------------------
  352|    729|	{
  353|    729|	  memset (s2k_cacheidbuf, 0, sizeof s2k_cacheidbuf);
  354|    729|	  *s2k_cacheidbuf = 'S';
  355|    729|	  bin2hex (s2k->salt, 8, s2k_cacheidbuf + 1);
  356|    729|	  s2k_cacheid = s2k_cacheidbuf;
  357|    729|	}
  358|       |
  359|   127k|      if (opt.pinentry_mode == PINENTRY_MODE_LOOPBACK)
  ------------------
  |  Branch (359:11): [True: 0, False: 127k]
  ------------------
  360|      0|        {
  361|      0|          char buf[32];
  362|       |
  363|      0|          snprintf (buf, sizeof (buf), "%u", 100);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  364|      0|          write_status_text (STATUS_INQUIRE_MAXLEN, buf);
  365|      0|        }
  366|       |
  367|       |      /* Divert to the gpg-agent. */
  368|   127k|      pw = passphrase_get (create, create && nocache, s2k_cacheid,
  ------------------
  |  Branch (368:36): [True: 0, False: 127k]
  |  Branch (368:46): [True: 0, False: 0]
  ------------------
  369|   127k|                           create? opt.passphrase_repeat : 0,
  ------------------
  |  Branch (369:28): [True: 0, False: 127k]
  ------------------
  370|   127k|                           tryagain_text, flags, canceled);
  371|   127k|      if (*canceled)
  ------------------
  |  Branch (371:11): [True: 127k, False: 0]
  ------------------
  372|   127k|        {
  373|   127k|          xfree (pw);
  ------------------
  |  |  104|   127k|#define xfree(a)         gcry_free ((a))
  ------------------
  374|   127k|	  write_status( STATUS_CANCELED_BY_USER );
  375|   127k|          return NULL;
  376|   127k|        }
  377|   127k|    }
  378|       |
  379|      0|  if ( !pw || !*pw )
  ------------------
  |  Branch (379:8): [True: 0, False: 0]
  |  Branch (379:15): [True: 0, False: 0]
  ------------------
  380|      0|    write_status( STATUS_MISSING_PASSPHRASE );
  381|       |
  382|       |  /* Hash the passphrase and store it in a newly allocated DEK object.
  383|       |     Keep a copy of the passphrase in LAST_PW for use by
  384|       |     get_last_passphrase(). */
  385|      0|  dek = xmalloc_secure_clear ( sizeof *dek );
  ------------------
  |  |  117|      0|#define xmalloc_secure_clear(a) gcry_xcalloc_secure (1, (a))
  ------------------
  386|      0|  dek->algo = cipher_algo;
  387|      0|  if ( (!pw || !*pw) && create)
  ------------------
  |  Branch (387:9): [True: 0, False: 0]
  |  Branch (387:16): [True: 0, False: 0]
  |  Branch (387:25): [True: 0, False: 0]
  ------------------
  388|      0|    dek->keylen = 0;
  389|      0|  else
  390|      0|    {
  391|      0|      gpg_error_t err;
  392|       |
  393|      0|      dek->keylen = openpgp_cipher_get_algo_keylen (dek->algo);
  ------------------
  |  |  121|      0|  gcry_cipher_get_algo_keylen(map_cipher_openpgp_to_gcry((_a)))
  ------------------
  394|      0|      if (!(dek->keylen > 0 && dek->keylen <= DIM(dek->key)))
  ------------------
  |  |   47|      0|#define DIM(v)		     (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (394:13): [True: 0, False: 0]
  |  Branch (394:32): [True: 0, False: 0]
  ------------------
  395|      0|        BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  396|      0|      err = gcry_kdf_derive (pw, strlen (pw),
  397|      0|                             s2k->mode == 3? GCRY_KDF_ITERSALTED_S2K :
  ------------------
  |  Branch (397:30): [True: 0, False: 0]
  ------------------
  398|      0|                             s2k->mode == 1? GCRY_KDF_SALTED_S2K :
  ------------------
  |  Branch (398:30): [True: 0, False: 0]
  ------------------
  399|      0|                             /* */           GCRY_KDF_SIMPLE_S2K,
  400|      0|                             s2k->hash_algo, s2k->salt, 8,
  401|      0|                             S2K_DECODE_COUNT(s2k->count),
  ------------------
  |  |  210|      0|#define S2K_DECODE_COUNT(_val) ((16ul + ((_val) & 15)) << (((_val) >> 4) + 6))
  ------------------
  402|      0|                             dek->keylen, dek->key);
  403|      0|      if (err)
  ------------------
  |  Branch (403:11): [True: 0, False: 0]
  ------------------
  404|      0|        {
  405|      0|          log_error ("gcry_kdf_derive failed: %s", gpg_strerror (err));
  406|      0|          xfree (pw);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  407|      0|          xfree (dek);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  408|      0|	  write_status( STATUS_MISSING_PASSPHRASE );
  409|      0|          return NULL;
  410|      0|        }
  411|      0|    }
  412|      0|  if (s2k_cacheid)
  ------------------
  |  Branch (412:7): [True: 0, False: 0]
  ------------------
  413|      0|    memcpy (dek->s2k_cacheid, s2k_cacheid, sizeof dek->s2k_cacheid);
  414|      0|  xfree(last_pw);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  415|      0|  last_pw = pw;
  416|      0|  return dek;
  417|      0|}
passphrase.c:passphrase_get:
  180|   127k|{
  181|   127k|  int rc;
  182|   127k|  char *pw = NULL;
  183|   127k|  char *orig_codeset;
  184|   127k|  const char *my_cacheid;
  185|   127k|  const char *desc;
  186|       |
  187|   127k|  if (canceled)
  ------------------
  |  Branch (187:7): [True: 127k, False: 0]
  ------------------
  188|   127k|    *canceled = 0;
  189|       |
  190|   127k|  orig_codeset = i18n_switchto_utf8 ();
  191|       |
  192|   127k|  if (!nocache && cacheid)
  ------------------
  |  Branch (192:7): [True: 127k, False: 0]
  |  Branch (192:19): [True: 729, False: 126k]
  ------------------
  193|    729|    my_cacheid = cacheid;
  194|   126k|  else
  195|   126k|    my_cacheid = NULL;
  196|       |
  197|   127k|  if (tryagain_text)
  ------------------
  |  Branch (197:7): [True: 0, False: 127k]
  ------------------
  198|      0|    tryagain_text = _(tryagain_text);
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  199|       |
  200|   127k|  if ((flags & GETPASSWORD_FLAG_SYMDECRYPT))
  ------------------
  |  |  297|   127k|#define GETPASSWORD_FLAG_SYMDECRYPT  1
  ------------------
  |  Branch (200:7): [True: 127k, False: 0]
  ------------------
  201|   127k|    desc = _("Please enter the passphrase for decryption.");
  ------------------
  |  |   28|   127k|#  define _(a) gettext (a)
  ------------------
  202|      0|  else
  203|      0|    desc = _("Enter passphrase\n");
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  204|       |
  205|       |  /* Here we have:
  206|       |   * REPEAT is set in create mode and if opt.passphrase_repeat is set.
  207|       |   * (Thus it is not a clean indication that we want a new passphrase).
  208|       |   * NOCACHE is set in create mode or if --no-symkey-cache is used.
  209|       |   * CACHEID is only set if caching shall be used.
  210|       |   * NEWSYMKEY has been added latter to make it clear that a new key
  211|       |   * is requested.  The whole chain of API is a bit too complex since
  212|       |   * we we stripped things out over time; however, there is no time
  213|       |   * for a full state analysis and thus this new parameter.
  214|       |   */
  215|   127k|  rc = agent_get_passphrase (my_cacheid, tryagain_text, NULL,
  216|   127k|                             desc,
  217|   127k|                             newsymkey, repeat, nocache, &pw);
  218|       |
  219|   127k|  i18n_switchback (orig_codeset);
  220|       |
  221|       |
  222|   127k|  if (!rc)
  ------------------
  |  Branch (222:7): [True: 0, False: 127k]
  ------------------
  223|      0|    ;
  224|   127k|  else if (gpg_err_code (rc) == GPG_ERR_CANCELED
  ------------------
  |  Branch (224:12): [True: 0, False: 127k]
  ------------------
  225|   127k|            || gpg_err_code (rc) == GPG_ERR_FULLY_CANCELED)
  ------------------
  |  Branch (225:16): [True: 0, False: 127k]
  ------------------
  226|      0|    {
  227|      0|      log_info (_("cancelled by user\n") );
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  228|      0|      if (canceled)
  ------------------
  |  Branch (228:11): [True: 0, False: 0]
  ------------------
  229|      0|        *canceled = 1;
  230|      0|    }
  231|   127k|  else
  232|   127k|    {
  233|   127k|      log_error (_("problem with the agent: %s\n"), gpg_strerror (rc));
  ------------------
  |  |   28|   127k|#  define _(a) gettext (a)
  ------------------
  234|       |      /* Due to limitations in the API of the upper layers they
  235|       |         consider an error as no passphrase entered.  This works in
  236|       |         most cases but not during key creation where this should
  237|       |         definitely not happen and let it continue without requiring a
  238|       |         passphrase.  Given that now all the upper layers handle a
  239|       |         cancel correctly, we simply set the cancel flag now for all
  240|       |         errors from the agent.  */
  241|   127k|      if (canceled)
  ------------------
  |  Branch (241:11): [True: 127k, False: 0]
  ------------------
  242|   127k|        *canceled = 1;
  243|       |
  244|   127k|      write_status_errcode ("get_passphrase", rc);
  245|   127k|    }
  246|       |
  247|   127k|  if (rc)
  ------------------
  |  Branch (247:7): [True: 127k, False: 0]
  ------------------
  248|   127k|    {
  249|   127k|      xfree (pw);
  ------------------
  |  |  104|   127k|#define xfree(a)         gcry_free ((a))
  ------------------
  250|   127k|      pw = NULL;
  251|   127k|    }
  252|   127k|  return pw;
  253|   127k|}

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

pk_verify:
  208|  12.1k|{
  209|  12.1k|  gcry_sexp_t s_sig, s_hash, s_pkey;
  210|  12.1k|  int rc;
  211|       |
  212|       |  /* Make a sexp from pkey.  */
  213|  12.1k|  if (pkalgo == PUBKEY_ALGO_DSA)
  ------------------
  |  Branch (213:7): [True: 2.46k, False: 9.69k]
  ------------------
  214|  2.46k|    {
  215|  2.46k|      rc = gcry_sexp_build (&s_pkey, NULL,
  216|  2.46k|			    "(public-key(dsa(p%m)(q%m)(g%m)(y%m)))",
  217|  2.46k|			    pkey[0], pkey[1], pkey[2], pkey[3]);
  218|  2.46k|    }
  219|  9.69k|  else if (pkalgo == PUBKEY_ALGO_ELGAMAL_E || pkalgo == PUBKEY_ALGO_ELGAMAL)
  ------------------
  |  Branch (219:12): [True: 665, False: 9.03k]
  |  Branch (219:47): [True: 0, False: 9.03k]
  ------------------
  220|    665|    {
  221|    665|      rc = gcry_sexp_build (&s_pkey, NULL,
  222|    665|			    "(public-key(elg(p%m)(g%m)(y%m)))",
  223|    665|			    pkey[0], pkey[1], pkey[2]);
  224|    665|    }
  225|  9.03k|  else if (pkalgo == PUBKEY_ALGO_RSA || pkalgo == PUBKEY_ALGO_RSA_S)
  ------------------
  |  Branch (225:12): [True: 1.40k, False: 7.62k]
  |  Branch (225:41): [True: 154, False: 7.47k]
  ------------------
  226|  1.55k|    {
  227|  1.55k|      rc = gcry_sexp_build (&s_pkey, NULL,
  228|  1.55k|			    "(public-key(rsa(n%m)(e%m)))", pkey[0], pkey[1]);
  229|  1.55k|    }
  230|  7.47k|  else if (pkalgo == PUBKEY_ALGO_ECDSA)
  ------------------
  |  Branch (230:12): [True: 2.72k, False: 4.75k]
  ------------------
  231|  2.72k|    {
  232|  2.72k|      char *curve = openpgp_oid_to_str (pkey[0]);
  233|  2.72k|      if (!curve)
  ------------------
  |  Branch (233:11): [True: 0, False: 2.72k]
  ------------------
  234|      0|        rc = gpg_error_from_syserror ();
  235|  2.72k|      else
  236|  2.72k|        {
  237|  2.72k|          rc = gcry_sexp_build (&s_pkey, NULL,
  238|  2.72k|                                "(public-key(ecdsa(curve %s)(q%m)))",
  239|  2.72k|                                curve, pkey[1]);
  240|  2.72k|          xfree (curve);
  ------------------
  |  |  104|  2.72k|#define xfree(a)         gcry_free ((a))
  ------------------
  241|  2.72k|        }
  242|  2.72k|    }
  243|  4.75k|  else if (pkalgo == PUBKEY_ALGO_EDDSA)
  ------------------
  |  Branch (243:12): [True: 4.74k, False: 6]
  ------------------
  244|  4.74k|    {
  245|  4.74k|      char *curve = openpgp_oid_to_str (pkey[0]);
  246|  4.74k|      if (!curve)
  ------------------
  |  Branch (246:11): [True: 0, False: 4.74k]
  ------------------
  247|      0|        rc = gpg_error_from_syserror ();
  248|  4.74k|      else
  249|  4.74k|        {
  250|  4.74k|          const char *fmt;
  251|       |
  252|  4.74k|          if (openpgp_oid_is_ed25519 (pkey[0]))
  ------------------
  |  Branch (252:15): [True: 4.72k, False: 28]
  ------------------
  253|  4.72k|            fmt = "(public-key(ecc(curve %s)(flags eddsa)(q%m)))";
  254|     28|          else
  255|     28|            fmt = "(public-key(ecc(curve %s)(q%m)))";
  256|       |
  257|  4.74k|          rc = gcry_sexp_build (&s_pkey, NULL, fmt, curve, pkey[1]);
  258|  4.74k|          xfree (curve);
  ------------------
  |  |  104|  4.74k|#define xfree(a)         gcry_free ((a))
  ------------------
  259|  4.74k|        }
  260|  4.74k|    }
  261|      6|  else
  262|      6|    return GPG_ERR_PUBKEY_ALGO;
  263|       |
  264|  12.1k|  if (rc)
  ------------------
  |  Branch (264:7): [True: 0, False: 12.1k]
  ------------------
  265|      0|    BUG ();  /* gcry_sexp_build should never fail.  */
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  266|       |
  267|       |  /* Put hash into a S-Exp s_hash. */
  268|  12.1k|  if (pkalgo == PUBKEY_ALGO_EDDSA)
  ------------------
  |  Branch (268:7): [True: 4.74k, False: 7.41k]
  ------------------
  269|  4.74k|    {
  270|  4.74k|      const char *fmt;
  271|       |
  272|  4.74k|      if (openpgp_oid_is_ed25519 (pkey[0]))
  ------------------
  |  Branch (272:11): [True: 4.72k, False: 28]
  ------------------
  273|  4.72k|        fmt = "(data(flags eddsa)(hash-algo sha512)(value %m))";
  274|     28|      else
  275|     28|        fmt = "(data(value %m))";
  276|       |
  277|  4.74k|      if (gcry_sexp_build (&s_hash, NULL, fmt, hash))
  ------------------
  |  Branch (277:11): [True: 0, False: 4.74k]
  ------------------
  278|      0|        BUG (); /* gcry_sexp_build should never fail.  */
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  279|  4.74k|    }
  280|  7.41k|  else
  281|  7.41k|    {
  282|  7.41k|      if (gcry_sexp_build (&s_hash, NULL, "%m", hash))
  ------------------
  |  Branch (282:11): [True: 0, False: 7.41k]
  ------------------
  283|      0|        BUG (); /* gcry_sexp_build should never fail.  */
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  284|  7.41k|    }
  285|       |
  286|       |  /* Put data into a S-Exp s_sig. */
  287|  12.1k|  s_sig = NULL;
  288|  12.1k|  if (pkalgo == PUBKEY_ALGO_DSA)
  ------------------
  |  Branch (288:7): [True: 2.46k, False: 9.69k]
  ------------------
  289|  2.46k|    {
  290|  2.46k|      if (!data[0] || !data[1])
  ------------------
  |  Branch (290:11): [True: 0, False: 2.46k]
  |  Branch (290:23): [True: 175, False: 2.29k]
  ------------------
  291|    175|        rc = gpg_error (GPG_ERR_BAD_MPI);
  292|  2.29k|      else
  293|  2.29k|        rc = gcry_sexp_build (&s_sig, NULL,
  294|  2.29k|                              "(sig-val(dsa(r%m)(s%m)))", data[0], data[1]);
  295|  2.46k|    }
  296|  9.69k|  else if (pkalgo == PUBKEY_ALGO_ECDSA)
  ------------------
  |  Branch (296:12): [True: 2.72k, False: 6.97k]
  ------------------
  297|  2.72k|    {
  298|  2.72k|      if (!data[0] || !data[1])
  ------------------
  |  Branch (298:11): [True: 0, False: 2.72k]
  |  Branch (298:23): [True: 15, False: 2.70k]
  ------------------
  299|     15|        rc = gpg_error (GPG_ERR_BAD_MPI);
  300|  2.70k|      else
  301|  2.70k|        rc = gcry_sexp_build (&s_sig, NULL,
  302|  2.70k|                              "(sig-val(ecdsa(r%m)(s%m)))", data[0], data[1]);
  303|  2.72k|    }
  304|  6.97k|  else if (pkalgo == PUBKEY_ALGO_EDDSA)
  ------------------
  |  Branch (304:12): [True: 4.74k, False: 2.22k]
  ------------------
  305|  4.74k|    {
  306|  4.74k|      gcry_mpi_t r = data[0];
  307|  4.74k|      gcry_mpi_t s = data[1];
  308|       |
  309|  4.74k|      if (openpgp_oid_is_ed25519 (pkey[0]))
  ------------------
  |  Branch (309:11): [True: 4.72k, False: 28]
  ------------------
  310|  4.72k|        {
  311|  4.72k|          size_t rlen, slen, n;  /* (bytes) */
  312|  4.72k|          char buf[64];
  313|  4.72k|          unsigned int nbits;
  314|  4.72k|          unsigned int neededfixedlen = 256 / 8;
  315|       |
  316|  4.72k|          log_assert (neededfixedlen <= sizeof buf);
  317|       |
  318|  4.72k|          if (!r || !s)
  ------------------
  |  Branch (318:15): [True: 0, False: 4.72k]
  |  Branch (318:21): [True: 94, False: 4.62k]
  ------------------
  319|     94|            rc = gpg_error (GPG_ERR_BAD_MPI);
  320|  4.62k|          else if ((rlen = (gcry_mpi_get_nbits (r)+7)/8) > neededfixedlen || !rlen)
  ------------------
  |  Branch (320:20): [True: 1, False: 4.62k]
  |  Branch (320:78): [True: 3, False: 4.62k]
  ------------------
  321|      4|            rc = gpg_error (GPG_ERR_BAD_MPI);
  322|  4.62k|          else if ((slen = (gcry_mpi_get_nbits (s)+7)/8) > neededfixedlen || !slen)
  ------------------
  |  Branch (322:20): [True: 0, False: 4.62k]
  |  Branch (322:78): [True: 32, False: 4.59k]
  ------------------
  323|     32|            rc = gpg_error (GPG_ERR_BAD_MPI);
  324|  4.59k|          else
  325|  4.59k|            {
  326|       |              /* We need to fixup the length in case of leading zeroes.
  327|       |               * OpenPGP does not allow leading zeroes and the parser for
  328|       |               * the signature packet has no information on the use curve,
  329|       |               * thus we need to do it here.  We won't do it for opaque
  330|       |               * MPIs under the assumption that they are known to be fine;
  331|       |               * we won't see them here anyway but the check is anyway
  332|       |               * required.  Fixme: A nifty feature for gcry_sexp_build
  333|       |               * would be a format to left pad the value (e.g. "%*M"). */
  334|  4.59k|              rc = 0;
  335|       |
  336|  4.59k|              if (rlen < neededfixedlen
  ------------------
  |  Branch (336:19): [True: 2.64k, False: 1.94k]
  ------------------
  337|  4.59k|                  && !gcry_mpi_get_flag (r, GCRYMPI_FLAG_OPAQUE)
  ------------------
  |  Branch (337:22): [True: 2.17k, False: 470]
  ------------------
  338|  4.59k|                  && !(rc=gcry_mpi_print (GCRYMPI_FMT_USG, buf, sizeof buf, &n, r)))
  ------------------
  |  Branch (338:22): [True: 2.17k, False: 0]
  ------------------
  339|  2.17k|                {
  340|  2.17k|                  log_assert (n < neededfixedlen);
  341|      0|                  memmove (buf + (neededfixedlen - n), buf, n);
  342|  2.17k|                  memset (buf, 0, neededfixedlen - n);
  343|  2.17k|                  r = gcry_mpi_set_opaque_copy (NULL, buf, neededfixedlen * 8);
  344|  2.17k|                }
  345|  2.41k|              else if (rlen < neededfixedlen
  ------------------
  |  Branch (345:24): [True: 470, False: 1.94k]
  ------------------
  346|  2.41k|                       && gcry_mpi_get_flag (r, GCRYMPI_FLAG_OPAQUE))
  ------------------
  |  Branch (346:27): [True: 470, False: 0]
  ------------------
  347|    470|                {
  348|    470|                  const unsigned char *p;
  349|       |
  350|    470|                  p = gcry_mpi_get_opaque (r, &nbits);
  351|    470|                  n = (nbits+7)/8;
  352|    470|                  memcpy (buf + (neededfixedlen - n), p, n);
  353|    470|                  memset (buf, 0, neededfixedlen - n);
  354|    470|                  gcry_mpi_set_opaque_copy (r, buf, neededfixedlen * 8);
  355|    470|                }
  356|  4.59k|              if (slen < neededfixedlen
  ------------------
  |  Branch (356:19): [True: 2.55k, False: 2.04k]
  ------------------
  357|  4.59k|                  && !gcry_mpi_get_flag (s, GCRYMPI_FLAG_OPAQUE)
  ------------------
  |  Branch (357:22): [True: 2.07k, False: 474]
  ------------------
  358|  4.59k|                  && !(rc=gcry_mpi_print (GCRYMPI_FMT_USG, buf, sizeof buf, &n, s)))
  ------------------
  |  Branch (358:22): [True: 2.07k, False: 0]
  ------------------
  359|  2.07k|                {
  360|  2.07k|                  log_assert (n < neededfixedlen);
  361|      0|                  memmove (buf + (neededfixedlen - n), buf, n);
  362|  2.07k|                  memset (buf, 0, neededfixedlen - n);
  363|  2.07k|                  s = gcry_mpi_set_opaque_copy (NULL, buf, neededfixedlen * 8);
  364|  2.07k|                }
  365|  2.51k|              else if (slen < neededfixedlen
  ------------------
  |  Branch (365:24): [True: 474, False: 2.04k]
  ------------------
  366|  2.51k|                       && gcry_mpi_get_flag (s, GCRYMPI_FLAG_OPAQUE))
  ------------------
  |  Branch (366:27): [True: 474, False: 0]
  ------------------
  367|    474|                {
  368|    474|                  const unsigned char *p;
  369|       |
  370|    474|                  p = gcry_mpi_get_opaque (s, &nbits);
  371|    474|                  n = (nbits+7)/8;
  372|    474|                  memcpy (buf + (neededfixedlen - n), p, n);
  373|    474|                  memset (buf, 0, neededfixedlen - n);
  374|    474|                  gcry_mpi_set_opaque_copy (s, buf, neededfixedlen * 8);
  375|    474|                }
  376|  4.59k|            }
  377|  4.72k|        }
  378|     28|      else
  379|     28|        rc = 0;
  380|       |
  381|  4.74k|      if (!rc)
  ------------------
  |  Branch (381:11): [True: 4.61k, False: 130]
  ------------------
  382|  4.61k|        rc = gcry_sexp_build (&s_sig, NULL,
  383|  4.61k|                              "(sig-val(eddsa(r%M)(s%M)))", r, s);
  384|       |
  385|  4.74k|      if (r != data[0])
  ------------------
  |  Branch (385:11): [True: 2.17k, False: 2.57k]
  ------------------
  386|  2.17k|        gcry_mpi_release (r);
  387|  4.74k|      if (s != data[1])
  ------------------
  |  Branch (387:11): [True: 2.07k, False: 2.67k]
  ------------------
  388|  2.07k|        gcry_mpi_release (s);
  389|  4.74k|    }
  390|  2.22k|  else if (pkalgo == PUBKEY_ALGO_ELGAMAL || pkalgo == PUBKEY_ALGO_ELGAMAL_E)
  ------------------
  |  Branch (390:12): [True: 0, False: 2.22k]
  |  Branch (390:45): [True: 665, False: 1.55k]
  ------------------
  391|    665|    {
  392|    665|      if (!data[0] || !data[1])
  ------------------
  |  Branch (392:11): [True: 0, False: 665]
  |  Branch (392:23): [True: 10, False: 655]
  ------------------
  393|     10|        rc = gpg_error (GPG_ERR_BAD_MPI);
  394|    655|      else
  395|    655|        rc = gcry_sexp_build (&s_sig, NULL,
  396|    655|                              "(sig-val(elg(r%m)(s%m)))", data[0], data[1]);
  397|    665|    }
  398|  1.55k|  else if (pkalgo == PUBKEY_ALGO_RSA || pkalgo == PUBKEY_ALGO_RSA_S)
  ------------------
  |  Branch (398:12): [True: 1.40k, False: 154]
  |  Branch (398:41): [True: 154, False: 0]
  ------------------
  399|  1.55k|    {
  400|  1.55k|      if (!data[0])
  ------------------
  |  Branch (400:11): [True: 0, False: 1.55k]
  ------------------
  401|      0|        rc = gpg_error (GPG_ERR_BAD_MPI);
  402|  1.55k|      else
  403|  1.55k|        rc = gcry_sexp_build (&s_sig, NULL, "(sig-val(rsa(s%m)))", data[0]);
  404|  1.55k|    }
  405|      0|  else
  406|      0|    BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  407|       |
  408|  12.1k|  if (!rc)
  ------------------
  |  Branch (408:7): [True: 11.8k, False: 330]
  ------------------
  409|  11.8k|    rc = gcry_pk_verify (s_sig, s_hash, s_pkey);
  410|       |
  411|  12.1k|  gcry_sexp_release (s_sig);
  412|  12.1k|  gcry_sexp_release (s_hash);
  413|  12.1k|  gcry_sexp_release (s_pkey);
  414|  12.1k|  return rc;
  415|  12.1k|}

get_output_file:
   57|  2.37k|{
   58|  2.37k|  gpg_error_t err = 0;
   59|  2.37k|  char *fname = NULL;
   60|  2.37k|  estream_t fp = NULL;
   61|  2.37k|  int nooutput = 0;
   62|       |
   63|       |  /* Create the filename as C string.  */
   64|  2.37k|  if (opt.outfp)
  ------------------
  |  Branch (64:7): [True: 0, False: 2.37k]
  ------------------
   65|      0|    {
   66|      0|      fname = xtrystrdup ("[FP]");
  ------------------
  |  |  103|      0|#define xtrystrdup(a)    gcry_strdup ((a))
  ------------------
   67|      0|      if (!fname)
  ------------------
  |  Branch (67:11): [True: 0, False: 0]
  ------------------
   68|      0|        {
   69|      0|          err = gpg_error_from_syserror ();
   70|      0|          goto leave;
   71|      0|        }
   72|      0|    }
   73|  2.37k|  else if (opt.outfile
  ------------------
  |  Branch (73:12): [True: 1.34k, False: 1.03k]
  ------------------
   74|  2.37k|           && !(opt.flags.use_embedded_filename && opt.flags.dummy_outfile))
  ------------------
  |  Branch (74:17): [True: 0, False: 1.34k]
  |  Branch (74:52): [True: 0, False: 0]
  ------------------
   75|  1.34k|    {
   76|  1.34k|      fname = xtrystrdup (opt.outfile);
  ------------------
  |  |  103|  1.34k|#define xtrystrdup(a)    gcry_strdup ((a))
  ------------------
   77|  1.34k|      if (!fname)
  ------------------
  |  Branch (77:11): [True: 0, False: 1.34k]
  ------------------
   78|      0|        {
   79|      0|          err = gpg_error_from_syserror ();
   80|      0|          goto leave;
   81|      0|        }
   82|  1.34k|    }
   83|  1.03k|  else if (embedded_namelen == 8 && !memcmp (embedded_name, "_CONSOLE", 8))
  ------------------
  |  Branch (83:12): [True: 71, False: 961]
  |  Branch (83:37): [True: 18, False: 53]
  ------------------
   84|     18|    {
   85|     18|      log_info (_("data not saved; use option \"--output\" to save it\n"));
  ------------------
  |  |   28|     18|#  define _(a) gettext (a)
  ------------------
   86|     18|      nooutput = 1;
   87|     18|    }
   88|  1.01k|  else if (!opt.flags.use_embedded_filename)
  ------------------
  |  Branch (88:12): [True: 1.01k, False: 0]
  ------------------
   89|  1.01k|    {
   90|  1.01k|      if (data)
  ------------------
  |  Branch (90:11): [True: 1.01k, False: 0]
  ------------------
   91|  1.01k|        fname = make_outfile_name (iobuf_get_real_fname (data));
   92|  1.01k|      if (!fname)
  ------------------
  |  Branch (92:11): [True: 0, False: 1.01k]
  ------------------
   93|      0|	fname = ask_outfile_name (embedded_name, embedded_namelen);
   94|  1.01k|      if (!fname)
  ------------------
  |  Branch (94:11): [True: 0, False: 1.01k]
  ------------------
   95|      0|	{
   96|      0|	  err = gpg_error (GPG_ERR_GENERAL);	/* Can't create file. */
   97|      0|	  goto leave;
   98|      0|	}
   99|  1.01k|    }
  100|      0|  else
  101|      0|    fname = utf8_to_native (embedded_name, embedded_namelen, 0);
  102|       |
  103|  2.37k|  if (nooutput)
  ------------------
  |  Branch (103:7): [True: 18, False: 2.35k]
  ------------------
  104|     18|    ;
  105|  2.35k|  else if (opt.outfp)
  ------------------
  |  Branch (105:12): [True: 0, False: 2.35k]
  ------------------
  106|      0|    {
  107|      0|      fp = opt.outfp;
  108|      0|      es_set_binary (fp);
  109|      0|    }
  110|  2.35k|  else if (iobuf_is_pipe_filename (fname) || !*fname)
  ------------------
  |  Branch (110:12): [True: 1.34k, False: 1.01k]
  |  Branch (110:46): [True: 0, False: 1.01k]
  ------------------
  111|  1.34k|    {
  112|       |      /* Special file name, no filename, or "-" given; write to the
  113|       |       * file descriptor or to stdout. */
  114|  1.34k|      int fd;
  115|  1.34k|      char xname[64];
  116|       |
  117|  1.34k|      fd = check_special_filename (fname, 1, 0);
  118|  1.34k|      if (fd == -1)
  ------------------
  |  Branch (118:11): [True: 1.34k, False: 0]
  ------------------
  119|  1.34k|        {
  120|       |          /* Not a special filename, thus we want stdout.  */
  121|  1.34k|          fp = es_stdout;
  122|  1.34k|          es_set_binary (fp);
  123|  1.34k|        }
  124|      0|      else if (!(fp = es_fdopen_nc (fd, "wb")))
  ------------------
  |  Branch (124:16): [True: 0, False: 0]
  ------------------
  125|      0|        {
  126|      0|          err = gpg_error_from_syserror ();
  127|      0|          snprintf (xname, sizeof xname, "[fd %d]", fd);
  ------------------
  |  |   84|      0|#define snprintf gpgrt_snprintf
  ------------------
  128|      0|          log_error (_("can't open '%s': %s\n"), xname, gpg_strerror (err));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  129|      0|          goto leave;
  130|      0|        }
  131|  1.34k|    }
  132|  1.01k|  else
  133|  1.01k|    {
  134|  1.01k|      while (!overwrite_filep (fname))
  ------------------
  |  Branch (134:14): [True: 0, False: 1.01k]
  ------------------
  135|      0|	{
  136|      0|	  char *tmp = ask_outfile_name (NULL, 0);
  137|      0|	  if (!tmp || !*tmp)
  ------------------
  |  Branch (137:8): [True: 0, False: 0]
  |  Branch (137:16): [True: 0, False: 0]
  ------------------
  138|      0|	    {
  139|      0|	      xfree (tmp);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  140|       |              /* FIXME: Below used to be GPG_ERR_CREATE_FILE */
  141|      0|	      err = gpg_error (GPG_ERR_GENERAL);
  142|      0|	      goto leave;
  143|      0|	    }
  144|      0|	  xfree (fname);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  145|      0|	  fname = tmp;
  146|      0|	}
  147|  1.01k|    }
  148|       |
  149|  2.37k|  if (opt.outfp && is_secured_file (es_fileno (opt.outfp)))
  ------------------
  |  Branch (149:7): [True: 0, False: 2.37k]
  |  Branch (149:20): [True: 0, False: 0]
  ------------------
  150|      0|    {
  151|      0|      err = gpg_error (GPG_ERR_EPERM);
  152|      0|      log_error (_("error creating '%s': %s\n"), fname, gpg_strerror (err));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  153|      0|      goto leave;
  154|      0|    }
  155|  2.37k|  else if (fp || nooutput)
  ------------------
  |  Branch (155:12): [True: 1.34k, False: 1.03k]
  |  Branch (155:18): [True: 18, False: 1.01k]
  ------------------
  156|  1.36k|    ;
  157|  1.01k|  else if (is_secured_filename (fname))
  ------------------
  |  Branch (157:12): [True: 0, False: 1.01k]
  ------------------
  158|      0|    {
  159|      0|      gpg_err_set_errno (EPERM);
  160|      0|      err = gpg_error_from_syserror ();
  161|      0|      log_error (_("error creating '%s': %s\n"), fname, gpg_strerror (err));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  162|      0|      goto leave;
  163|      0|    }
  164|  1.01k|  else if (!(fp = es_fopen (fname, "wb")))
  ------------------
  |  Branch (164:12): [True: 0, False: 1.01k]
  ------------------
  165|      0|    {
  166|      0|      err = gpg_error_from_syserror ();
  167|      0|      log_error (_("error creating '%s': %s\n"), fname, gpg_strerror (err));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  168|      0|      goto leave;
  169|      0|    }
  170|       |
  171|  2.37k| leave:
  172|  2.37k|  if (err)
  ------------------
  |  Branch (172:7): [True: 0, False: 2.37k]
  ------------------
  173|      0|    {
  174|      0|      if (fp && fp != es_stdout && fp != opt.outfp)
  ------------------
  |  Branch (174:11): [True: 0, False: 0]
  |  Branch (174:17): [True: 0, False: 0]
  |  Branch (174:36): [True: 0, False: 0]
  ------------------
  175|      0|        es_fclose (fp);
  176|      0|      xfree (fname);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  177|      0|      return err;
  178|      0|    }
  179|       |
  180|  2.37k|  *fnamep = fname;
  181|  2.37k|  *fpp = fp;
  182|  2.37k|  return 0;
  183|  2.37k|}
handle_plaintext:
  192|  2.37k|{
  193|  2.37k|  char *fname = NULL;
  194|  2.37k|  estream_t fp = NULL;
  195|  2.37k|  static off_t count = 0;
  196|  2.37k|  int err = 0;
  197|  2.37k|  int c;
  198|  2.37k|  int convert;
  199|       |#ifdef __riscos__
  200|       |  int filetype = 0xfff;
  201|       |#endif
  202|       |
  203|  2.37k|  if (pt->mode == 't' || pt->mode == 'u' || pt->mode == 'm')
  ------------------
  |  Branch (203:7): [True: 674, False: 1.70k]
  |  Branch (203:26): [True: 90, False: 1.61k]
  |  Branch (203:45): [True: 164, False: 1.44k]
  ------------------
  204|    928|    convert = pt->mode;
  205|  1.44k|  else
  206|  1.44k|    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|  2.37k|  if (!nooutput && is_status_enabled ())
  ------------------
  |  Branch (211:7): [True: 2.37k, False: 0]
  |  Branch (211:20): [True: 0, False: 2.37k]
  ------------------
  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|  2.37k|  if (! nooutput)
  ------------------
  |  Branch (233:7): [True: 2.37k, False: 0]
  ------------------
  234|  2.37k|    {
  235|  2.37k|      err = get_output_file (pt->name, pt->namelen, pt->buf, &fname, &fp);
  236|  2.37k|      if (err)
  ------------------
  |  Branch (236:11): [True: 0, False: 2.37k]
  ------------------
  237|      0|        goto leave;
  238|  2.37k|    }
  239|       |
  240|  2.37k|  if (!pt->is_partial)
  ------------------
  |  Branch (240:7): [True: 1.15k, False: 1.22k]
  ------------------
  241|  1.15k|    {
  242|       |      /* We have an actual length (which might be zero). */
  243|       |
  244|  1.15k|      if (clearsig)
  ------------------
  |  Branch (244:11): [True: 2, False: 1.15k]
  ------------------
  245|      2|	{
  246|      2|	  log_error ("clearsig encountered while not expected\n");
  247|      2|	  err = gpg_error (GPG_ERR_UNEXPECTED);
  248|      2|	  goto leave;
  249|      2|	}
  250|       |
  251|  1.15k|      if (convert) /* Text mode.  */
  ------------------
  |  Branch (251:11): [True: 151, False: 999]
  ------------------
  252|    151|	{
  253|   104k|	  for (; pt->len; pt->len--)
  ------------------
  |  Branch (253:11): [True: 104k, False: 18]
  ------------------
  254|   104k|	    {
  255|   104k|	      if ((c = iobuf_get (pt->buf)) == -1)
  ------------------
  |  |  500|   104k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 104k]
  |  |  |  Branch (500:24): [True: 160, False: 104k]
  |  |  ------------------
  |  |  501|   104k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (255:12): [True: 133, False: 104k]
  ------------------
  256|    133|		{
  257|    133|		  err = gpg_error_from_syserror ();
  258|    133|		  log_error ("problem reading source (%u bytes remaining)\n",
  259|    133|			     (unsigned) pt->len);
  260|    133|		  goto leave;
  261|    133|		}
  262|   104k|	      if (mfx->md)
  ------------------
  |  Branch (262:12): [True: 104k, False: 0]
  ------------------
  263|   104k|		gcry_md_putc (mfx->md, c);
  264|   104k|#ifndef HAVE_DOSISH_SYSTEM
  265|       |              /* Convert to native line ending. */
  266|       |              /* fixme: this hack might be too simple */
  267|   104k|	      if (c == '\r' && convert != 'm')
  ------------------
  |  Branch (267:12): [True: 768, False: 103k]
  |  Branch (267:25): [True: 451, False: 317]
  ------------------
  268|    451|		continue;
  269|   104k|#endif
  270|   104k|	      if (fp)
  ------------------
  |  Branch (270:12): [True: 104k, False: 6]
  ------------------
  271|   104k|		{
  272|   104k|		  if (opt.max_output && (++count) > opt.max_output)
  ------------------
  |  Branch (272:9): [True: 0, False: 104k]
  |  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|   104k|		  else if (es_putc (c, fp) == EOF)
  ------------------
  |  Branch (279:14): [True: 0, False: 104k]
  ------------------
  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|   104k|		}
  290|   104k|	    }
  291|    151|	}
  292|    999|      else  /* Binary mode.  */
  293|    999|	{
  294|    999|	  size_t temp_size = iobuf_set_buffer_size(0) * 1024;
  295|    999|	  byte *buffer;
  296|       |
  297|    999|	  if (fp)
  ------------------
  |  Branch (297:8): [True: 989, False: 10]
  ------------------
  298|    989|	    {
  299|       |	      /* Disable buffering in estream as we are passing large
  300|       |	       * buffers to es_fwrite. */
  301|    989|	      es_setbuf (fp, NULL);
  302|    989|	    }
  303|       |
  304|    999|	  buffer = xmalloc (temp_size);
  ------------------
  |  |  107|    999|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  305|    999|          if (!buffer)
  ------------------
  |  Branch (305:15): [True: 0, False: 999]
  ------------------
  306|      0|            {
  307|      0|              err = gpg_error_from_syserror ();
  308|      0|              goto leave;
  309|      0|            }
  310|       |
  311|  1.89k|	  while (pt->len)
  ------------------
  |  Branch (311:11): [True: 1.20k, False: 693]
  ------------------
  312|  1.20k|	    {
  313|  1.20k|	      int len = pt->len > temp_size ? temp_size : pt->len;
  ------------------
  |  Branch (313:18): [True: 722, False: 484]
  ------------------
  314|  1.20k|	      len = iobuf_read (pt->buf, buffer, len);
  315|  1.20k|	      if (len == -1)
  ------------------
  |  Branch (315:12): [True: 306, False: 900]
  ------------------
  316|    306|		{
  317|    306|		  err = gpg_error_from_syserror ();
  318|    306|		  log_error ("problem reading source (%u bytes remaining)\n",
  319|    306|			     (unsigned) pt->len);
  320|    306|		  xfree (buffer);
  ------------------
  |  |  104|    306|#define xfree(a)         gcry_free ((a))
  ------------------
  321|    306|		  goto leave;
  322|    306|		}
  323|    900|	      if (mfx->md)
  ------------------
  |  Branch (323:12): [True: 900, False: 0]
  ------------------
  324|    900|		gcry_md_write (mfx->md, buffer, len);
  325|    900|	      if (fp)
  ------------------
  |  Branch (325:12): [True: 773, False: 127]
  ------------------
  326|    773|		{
  327|    773|		  if (opt.max_output && (count += len) > opt.max_output)
  ------------------
  |  Branch (327:9): [True: 0, False: 773]
  |  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|    773|		  else if (es_fwrite (buffer, 1, len, fp) != len)
  ------------------
  |  Branch (335:14): [True: 0, False: 773]
  ------------------
  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|    773|		}
  344|    900|	      pt->len -= len;
  345|    900|	    }
  346|    693|	  xfree (buffer);
  ------------------
  |  |  104|    693|#define xfree(a)         gcry_free ((a))
  ------------------
  347|    693|	}
  348|  1.15k|    }
  349|  1.22k|  else if (!clearsig)
  ------------------
  |  Branch (349:12): [True: 638, False: 586]
  ------------------
  350|    638|    {
  351|    638|      if (convert)
  ------------------
  |  Branch (351:11): [True: 191, False: 447]
  ------------------
  352|    191|	{			/* text mode */
  353|   392k|	  while ((c = iobuf_get (pt->buf)) != -1)
  ------------------
  |  |  500|   392k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 392k]
  |  |  |  Branch (500:24): [True: 343, False: 392k]
  |  |  ------------------
  |  |  501|   392k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (353:11): [True: 392k, False: 191]
  ------------------
  354|   392k|	    {
  355|   392k|	      if (mfx->md)
  ------------------
  |  Branch (355:12): [True: 392k, False: 0]
  ------------------
  356|   392k|		gcry_md_putc (mfx->md, c);
  357|   392k|#ifndef HAVE_DOSISH_SYSTEM
  358|   392k|	      if (c == '\r' && convert != 'm')
  ------------------
  |  Branch (358:12): [True: 2.35k, False: 389k]
  |  Branch (358:25): [True: 1.56k, False: 789]
  ------------------
  359|  1.56k|		continue;	/* fixme: this hack might be too simple */
  360|   390k|#endif
  361|   390k|	      if (fp)
  ------------------
  |  Branch (361:12): [True: 386k, False: 4.43k]
  ------------------
  362|   386k|		{
  363|   386k|		  if (opt.max_output && (++count) > opt.max_output)
  ------------------
  |  Branch (363:9): [True: 0, False: 386k]
  |  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|   386k|		  else if (es_putc (c, fp) == EOF)
  ------------------
  |  Branch (370:14): [True: 0, False: 386k]
  ------------------
  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|   386k|		}
  381|   390k|	    }
  382|    191|	}
  383|    447|      else
  384|    447|	{			/* binary mode */
  385|    447|	  size_t temp_size = iobuf_set_buffer_size(0) * 1024;
  386|    447|	  byte *buffer;
  387|    447|	  int eof_seen = 0;
  388|       |
  389|    447|	  if (fp)
  ------------------
  |  Branch (389:8): [True: 446, False: 1]
  ------------------
  390|    446|	    {
  391|       |	      /* Disable buffering in estream as we are passing large
  392|       |	       * buffers to es_fwrite. */
  393|    446|	      es_setbuf (fp, NULL);
  394|    446|	    }
  395|       |
  396|    447|          buffer = xtrymalloc (temp_size);
  ------------------
  |  |   97|    447|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  397|    447|          if (!buffer)
  ------------------
  |  Branch (397:15): [True: 0, False: 447]
  ------------------
  398|      0|            {
  399|      0|              err = gpg_error_from_syserror ();
  400|      0|              goto leave;
  401|      0|            }
  402|       |
  403|    660|	  while (!eof_seen)
  ------------------
  |  Branch (403:11): [True: 450, False: 210]
  ------------------
  404|    450|	    {
  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|    450|	      int len = iobuf_read (pt->buf, buffer, temp_size);
  412|    450|	      if (len == -1)
  ------------------
  |  Branch (412:12): [True: 237, False: 213]
  ------------------
  413|    237|		break;
  414|    213|	      if (len < temp_size)
  ------------------
  |  Branch (414:12): [True: 210, False: 3]
  ------------------
  415|    210|		eof_seen = 1;
  416|    213|	      if (mfx->md)
  ------------------
  |  Branch (416:12): [True: 213, False: 0]
  ------------------
  417|    213|		gcry_md_write (mfx->md, buffer, len);
  418|    213|	      if (fp)
  ------------------
  |  Branch (418:12): [True: 212, False: 1]
  ------------------
  419|    212|		{
  420|    212|		  if (opt.max_output && (count += len) > opt.max_output)
  ------------------
  |  Branch (420:9): [True: 0, False: 212]
  |  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|    212|		  else if (es_fwrite (buffer, 1, len, fp) != len)
  ------------------
  |  Branch (428:14): [True: 0, False: 212]
  ------------------
  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|    212|		}
  437|    213|	    }
  438|    447|	  xfree (buffer);
  ------------------
  |  |  104|    447|#define xfree(a)         gcry_free ((a))
  ------------------
  439|    447|	}
  440|    638|      pt->buf = NULL;
  441|    638|    }
  442|    586|  else /* Clear text signature - don't hash the last CR,LF.   */
  443|    586|    {
  444|    586|      int state = 0;
  445|       |
  446|   631k|      while ((c = iobuf_get (pt->buf)) != -1)
  ------------------
  |  |  500|   631k|     (	((a)->nofast || (a)->d.start >= (a)->d.len )?  \
  |  |  ------------------
  |  |  |  Branch (500:9): [True: 0, False: 631k]
  |  |  |  Branch (500:24): [True: 586, False: 631k]
  |  |  ------------------
  |  |  501|   631k|	iobuf_readbyte((a)) : ( (a)->nbytes++, (a)->d.buf[(a)->d.start++] ) )
  ------------------
  |  Branch (446:14): [True: 631k, False: 586]
  ------------------
  447|   631k|	{
  448|   631k|	  if (fp)
  ------------------
  |  Branch (448:8): [True: 631k, False: 0]
  ------------------
  449|   631k|	    {
  450|   631k|	      if (opt.max_output && (++count) > opt.max_output)
  ------------------
  |  Branch (450:12): [True: 0, False: 631k]
  |  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|   631k|	      else if (es_putc (c, fp) == EOF)
  ------------------
  |  Branch (457:17): [True: 0, False: 631k]
  ------------------
  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|   631k|	    }
  465|   631k|	  if (!mfx->md)
  ------------------
  |  Branch (465:8): [True: 0, False: 631k]
  ------------------
  466|      0|	    continue;
  467|   631k|	  if (state == 2)
  ------------------
  |  Branch (467:8): [True: 165k, False: 465k]
  ------------------
  468|   165k|	    {
  469|   165k|	      gcry_md_putc (mfx->md, '\r');
  470|   165k|	      gcry_md_putc (mfx->md, '\n');
  471|   165k|	      state = 0;
  472|   165k|	    }
  473|   631k|	  if (!state)
  ------------------
  |  Branch (473:8): [True: 559k, False: 71.5k]
  ------------------
  474|   559k|	    {
  475|   559k|	      if (c == '\r')
  ------------------
  |  Branch (475:12): [True: 71.2k, False: 488k]
  ------------------
  476|  71.2k|		state = 1;
  477|   488k|	      else if (c == '\n')
  ------------------
  |  Branch (477:17): [True: 165k, False: 322k]
  ------------------
  478|   165k|		state = 2;
  479|   322k|	      else
  480|   322k|		gcry_md_putc (mfx->md, c);
  481|   559k|	    }
  482|  71.5k|	  else if (state == 1)
  ------------------
  |  Branch (482:13): [True: 71.5k, False: 0]
  ------------------
  483|  71.5k|	    {
  484|  71.5k|	      if (c == '\n')
  ------------------
  |  Branch (484:12): [True: 292, False: 71.2k]
  ------------------
  485|    292|		state = 2;
  486|  71.2k|	      else
  487|  71.2k|		{
  488|  71.2k|		  gcry_md_putc (mfx->md, '\r');
  489|  71.2k|		  if (c == '\r')
  ------------------
  |  Branch (489:9): [True: 295, False: 70.9k]
  ------------------
  490|    295|		    state = 1;
  491|  70.9k|		  else
  492|  70.9k|		    {
  493|  70.9k|		      state = 0;
  494|  70.9k|		      gcry_md_putc (mfx->md, c);
  495|  70.9k|		    }
  496|  71.2k|		}
  497|  71.5k|	    }
  498|   631k|	}
  499|    586|      pt->buf = NULL;
  500|    586|    }
  501|       |
  502|  1.93k|  if (fp && fp != es_stdout && fp != opt.outfp && es_fclose (fp))
  ------------------
  |  Branch (502:7): [True: 1.92k, False: 9]
  |  Branch (502:13): [True: 837, False: 1.08k]
  |  Branch (502:32): [True: 837, False: 0]
  |  Branch (502:51): [True: 0, False: 837]
  ------------------
  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|  1.93k|  fp = NULL;
  510|       |
  511|  2.37k| 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|  2.37k|  if (es_fflush (es_stdout))
  ------------------
  |  Branch (515:7): [True: 0, False: 2.37k]
  ------------------
  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|  2.37k|  if (fp && fp != es_stdout && fp != opt.outfp)
  ------------------
  |  Branch (526:7): [True: 432, False: 1.94k]
  |  Branch (526:13): [True: 177, False: 255]
  |  Branch (526:32): [True: 177, False: 0]
  ------------------
  527|    177|    es_fclose (fp);
  528|  2.37k|  xfree (fname);
  ------------------
  |  |  104|  2.37k|#define xfree(a)         gcry_free ((a))
  ------------------
  529|  2.37k|  return err;
  530|  1.93k|}
ask_for_detached_datafile:
  594|  54.8k|{
  595|  54.8k|  progress_filter_context_t *pfx;
  596|  54.8k|  char *answer = NULL;
  597|  54.8k|  IOBUF fp;
  598|  54.8k|  int rc = 0;
  599|       |
  600|  54.8k|  pfx = new_progress_context ();
  601|  54.8k|  fp = open_sigfile (inname, pfx);	/* Open default file. */
  602|       |
  603|  54.8k|  if (!fp && !opt.batch)
  ------------------
  |  Branch (603:7): [True: 54.8k, False: 0]
  |  Branch (603:14): [True: 0, False: 54.8k]
  ------------------
  604|      0|    {
  605|      0|      int any = 0;
  606|      0|      tty_printf (_("Detached signature.\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  607|      0|      do
  608|      0|	{
  609|      0|	  char *name;
  610|       |
  611|      0|	  xfree (answer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  612|      0|	  tty_enable_completion (NULL);
  613|      0|	  name = cpr_get ("detached_signature.filename",
  614|      0|			  _("Please enter name of data file: "));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  615|      0|	  tty_disable_completion ();
  616|      0|	  cpr_kill_prompt ();
  617|      0|	  answer = make_filename (name, (void *) NULL);
  618|      0|	  xfree (name);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  619|       |
  620|      0|	  if (any && !*answer)
  ------------------
  |  Branch (620:8): [True: 0, False: 0]
  |  Branch (620:15): [True: 0, False: 0]
  ------------------
  621|      0|	    {
  622|      0|	      rc = gpg_error (GPG_ERR_GENERAL);	/*G10ERR_READ_FILE */
  623|      0|	      goto leave;
  624|      0|	    }
  625|      0|	  fp = iobuf_open (answer);
  626|      0|	  if (fp && is_secured_file (iobuf_get_fd (fp)))
  ------------------
  |  Branch (626:8): [True: 0, False: 0]
  |  Branch (626:14): [True: 0, False: 0]
  ------------------
  627|      0|	    {
  628|      0|	      iobuf_close (fp);
  629|      0|	      fp = NULL;
  630|      0|	      gpg_err_set_errno (EPERM);
  631|      0|	    }
  632|      0|	  if (!fp && errno == ENOENT)
  ------------------
  |  Branch (632:8): [True: 0, False: 0]
  |  Branch (632:15): [True: 0, False: 0]
  ------------------
  633|      0|	    {
  634|      0|	      tty_printf ("No such file, try again or hit enter to quit.\n");
  635|      0|	      any++;
  636|      0|	    }
  637|      0|	  else if (!fp)
  ------------------
  |  Branch (637:13): [True: 0, False: 0]
  ------------------
  638|      0|	    {
  639|      0|	      rc = gpg_error_from_syserror ();
  640|      0|	      log_error (_("can't open '%s': %s\n"), answer,
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  641|      0|			 strerror (errno));
  642|      0|	      goto leave;
  643|      0|	    }
  644|      0|	}
  645|      0|      while (!fp);
  ------------------
  |  Branch (645:14): [True: 0, False: 0]
  ------------------
  646|      0|    }
  647|       |
  648|  54.8k|  if (!fp)
  ------------------
  |  Branch (648:7): [True: 54.8k, False: 0]
  ------------------
  649|  54.8k|    {
  650|  54.8k|#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
  651|  54.8k|        errno = ENOENT;
  652|  54.8k|        rc = gpg_error_from_syserror ();
  653|  54.8k|        goto leave;
  654|       |#else
  655|       |      if (opt.verbose)
  656|       |	log_info (_("reading stdin ...\n"));
  657|       |      fp = iobuf_open (NULL);
  658|       |      log_assert (fp);
  659|       |#endif
  660|  54.8k|    }
  661|      0|  do_hash (md, md2, fp, textmode);
  662|      0|  iobuf_close (fp);
  663|       |
  664|  54.8k|leave:
  665|  54.8k|  xfree (answer);
  ------------------
  |  |  104|  54.8k|#define xfree(a)         gcry_free ((a))
  ------------------
  666|  54.8k|  release_progress_context (pfx);
  667|  54.8k|  return rc;
  668|      0|}

new_progress_context:
   44|  71.9k|{
   45|  71.9k|  progress_filter_context_t *pfx;
   46|       |
   47|  71.9k|  if (!opt.enable_progress_filter)
  ------------------
  |  Branch (47:7): [True: 71.9k, False: 0]
  ------------------
   48|  71.9k|    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|  71.9k|{
   64|  71.9k|  if (!pfx)
  ------------------
  |  Branch (64:7): [True: 71.9k, False: 0]
  ------------------
   65|  71.9k|    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|  17.0k|{
  184|  17.0k|  off_t filesize = 0;
  185|       |
  186|  17.0k|  if (!pfx)
  ------------------
  |  Branch (186:7): [True: 17.0k, False: 0]
  ------------------
  187|  17.0k|    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|}

get_session_key:
   76|  3.53k|{
   77|  3.53k|  PKT_public_key *sk = NULL;
   78|  3.53k|  gpg_error_t err;
   79|  3.53k|  void *enum_context = NULL;
   80|  3.53k|  u32 keyid[2];
   81|  3.53k|  int search_for_secret_keys = 1;
   82|  3.53k|  struct pubkey_enc_list *k;
   83|       |
   84|  3.53k|  if (DBG_CLOCK)
  ------------------
  |  |  356|  3.53k|#define DBG_CLOCK   (opt.debug & DBG_CLOCK_VALUE)
  |  |  ------------------
  |  |  |  |  343|  3.53k|#define DBG_CLOCK_VALUE   4096
  |  |  ------------------
  |  |  |  Branch (356:21): [True: 0, False: 3.53k]
  |  |  ------------------
  ------------------
   85|      0|    log_clock ("get_session_key enter");
   86|       |
   87|  3.53k|  while (search_for_secret_keys)
  ------------------
  |  Branch (87:10): [True: 3.53k, False: 0]
  ------------------
   88|  3.53k|    {
   89|  3.53k|      sk = xmalloc_clear (sizeof *sk);
  ------------------
  |  |  116|  3.53k|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
   90|  3.53k|      err = enum_secret_keys (ctrl, &enum_context, sk);
   91|  3.53k|      if (err)
  ------------------
  |  Branch (91:11): [True: 3.53k, False: 0]
  ------------------
   92|  3.53k|        break;
   93|       |
   94|       |      /* Check compliance.  */
   95|      0|      if (! gnupg_pk_is_allowed (opt.compliance, PK_USE_DECRYPTION,
  ------------------
  |  Branch (95:11): [True: 0, False: 0]
  ------------------
   96|      0|                                 sk->pubkey_algo, 0,
   97|      0|                                 sk->pkey, nbits_from_pk (sk), NULL))
   98|      0|        {
   99|      0|          log_info (_("key %s is not suitable for decryption"
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  100|      0|                      " in %s mode\n"),
  101|      0|                    keystr_from_pk (sk),
  102|      0|                    gnupg_compliance_option_string (opt.compliance));
  103|      0|          continue;
  104|      0|        }
  105|       |
  106|       |      /* FIXME: The list needs to be sorted so that we try the keys in
  107|       |       * an appropriate order.  For example:
  108|       |       * - On-disk keys w/o protection
  109|       |       * - On-disk keys with a cached passphrase
  110|       |       * - On-card keys of an active card
  111|       |       * - On-disk keys with protection
  112|       |       * - On-card keys from cards which are not plugged it.  Here a
  113|       |       *   cancel-all button should stop asking for other cards.
  114|       |       * Without any anonymous keys the sorting can be skipped.
  115|       |       */
  116|      0|      for (k = list; k; k = k->next)
  ------------------
  |  Branch (116:22): [True: 0, False: 0]
  ------------------
  117|      0|        {
  118|      0|          if (!(k->pubkey_algo == PUBKEY_ALGO_ELGAMAL_E
  ------------------
  |  Branch (118:17): [True: 0, False: 0]
  ------------------
  119|      0|                || k->pubkey_algo == PUBKEY_ALGO_ECDH
  ------------------
  |  Branch (119:20): [True: 0, False: 0]
  ------------------
  120|      0|                || k->pubkey_algo == PUBKEY_ALGO_RSA
  ------------------
  |  Branch (120:20): [True: 0, False: 0]
  ------------------
  121|      0|                || k->pubkey_algo == PUBKEY_ALGO_RSA_E
  ------------------
  |  Branch (121:20): [True: 0, False: 0]
  ------------------
  122|      0|                || k->pubkey_algo == PUBKEY_ALGO_ELGAMAL))
  ------------------
  |  Branch (122:20): [True: 0, False: 0]
  ------------------
  123|      0|            continue;
  124|       |
  125|      0|          if (openpgp_pk_test_algo2 (k->pubkey_algo, PUBKEY_USAGE_ENC))
  ------------------
  |  |   50|      0|#define PUBKEY_USAGE_ENC     GCRY_PK_USAGE_ENCR  /* Good for encryption. */
  ------------------
  |  Branch (125:15): [True: 0, False: 0]
  ------------------
  126|      0|            continue;
  127|       |
  128|      0|          if (sk->pubkey_algo != k->pubkey_algo)
  ------------------
  |  Branch (128:15): [True: 0, False: 0]
  ------------------
  129|      0|            continue;
  130|       |
  131|      0|          keyid_from_pk (sk, keyid);
  132|       |
  133|      0|          if (!k->keyid[0] && !k->keyid[1])
  ------------------
  |  Branch (133:15): [True: 0, False: 0]
  |  Branch (133:31): [True: 0, False: 0]
  ------------------
  134|      0|            {
  135|      0|              if (opt.skip_hidden_recipients)
  ------------------
  |  Branch (135:19): [True: 0, False: 0]
  ------------------
  136|      0|                continue;
  137|       |
  138|      0|              if (!opt.quiet)
  ------------------
  |  Branch (138:19): [True: 0, False: 0]
  ------------------
  139|      0|                log_info (_("anonymous recipient; trying secret key %s ...\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  140|      0|                          keystr (keyid));
  141|      0|            }
  142|      0|          else if (opt.try_all_secrets
  ------------------
  |  Branch (142:20): [True: 0, False: 0]
  ------------------
  143|      0|                   || (k->keyid[0] == keyid[0] && k->keyid[1] == keyid[1]))
  ------------------
  |  Branch (143:24): [True: 0, False: 0]
  |  Branch (143:51): [True: 0, False: 0]
  ------------------
  144|      0|            {
  145|      0|              if (!opt.quiet && !(sk->pubkey_usage & PUBKEY_USAGE_ENC))
  ------------------
  |  |   50|      0|#define PUBKEY_USAGE_ENC     GCRY_PK_USAGE_ENCR  /* Good for encryption. */
  ------------------
  |  Branch (145:19): [True: 0, False: 0]
  |  Branch (145:33): [True: 0, False: 0]
  ------------------
  146|      0|                log_info (_("used key is not marked for encryption use.\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  147|      0|            }
  148|      0|          else
  149|      0|            continue;
  150|       |
  151|      0|          err = get_it (ctrl, k, dek, sk, keyid);
  152|      0|          k->result = err;
  153|      0|          if (!err)
  ------------------
  |  Branch (153:15): [True: 0, False: 0]
  ------------------
  154|      0|            {
  155|      0|              if (!opt.quiet && !k->keyid[0] && !k->keyid[1])
  ------------------
  |  Branch (155:19): [True: 0, False: 0]
  |  Branch (155:33): [True: 0, False: 0]
  |  Branch (155:49): [True: 0, False: 0]
  ------------------
  156|      0|                {
  157|      0|                  log_info (_("okay, we are the anonymous recipient.\n"));
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  158|      0|                  if (!(sk->pubkey_usage & PUBKEY_USAGE_ENC))
  ------------------
  |  |   50|      0|#define PUBKEY_USAGE_ENC     GCRY_PK_USAGE_ENCR  /* Good for encryption. */
  ------------------
  |  Branch (158:23): [True: 0, False: 0]
  ------------------
  159|      0|                    log_info (_("used key is not marked for encryption use.\n")
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  160|      0|                              );
  161|      0|                }
  162|      0|              search_for_secret_keys = 0;
  163|      0|              break;
  164|      0|            }
  165|      0|          else if (gpg_err_code (err) == GPG_ERR_FULLY_CANCELED)
  ------------------
  |  Branch (165:20): [True: 0, False: 0]
  ------------------
  166|      0|            {
  167|      0|              search_for_secret_keys = 0;
  168|      0|              break; /* Don't try any more secret keys.  */
  169|      0|            }
  170|      0|        }
  171|      0|    }
  172|  3.53k|  enum_secret_keys (ctrl, &enum_context, NULL);  /* free context */
  173|       |
  174|  3.53k|  if (gpg_err_code (err) == GPG_ERR_EOF)
  ------------------
  |  Branch (174:7): [True: 3.53k, False: 0]
  ------------------
  175|  3.53k|    {
  176|  3.53k|      err = gpg_error (GPG_ERR_NO_SECKEY);
  177|       |
  178|       |      /* Return the last specific error, if any.  */
  179|  8.30k|      for (k = list; k; k = k->next)
  ------------------
  |  Branch (179:22): [True: 4.77k, False: 3.53k]
  ------------------
  180|  4.77k|        if (k->result != -1)
  ------------------
  |  Branch (180:13): [True: 0, False: 4.77k]
  ------------------
  181|      0|          err = k->result;
  182|  3.53k|    }
  183|       |
  184|  3.53k|  if (DBG_CLOCK)
  ------------------
  |  |  356|  3.53k|#define DBG_CLOCK   (opt.debug & DBG_CLOCK_VALUE)
  |  |  ------------------
  |  |  |  |  343|  3.53k|#define DBG_CLOCK_VALUE   4096
  |  |  ------------------
  |  |  |  Branch (356:21): [True: 0, False: 3.53k]
  |  |  ------------------
  ------------------
  185|      0|    log_clock ("get_session_key leave");
  186|  3.53k|  return err;
  187|  3.53k|}

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

encode_md_value:
  257|  15.1k|{
  258|  15.1k|  gcry_mpi_t frame;
  259|  15.1k|  size_t mdlen;
  260|       |
  261|  15.1k|  log_assert (hash_algo);
  262|      0|  log_assert (pk);
  263|       |
  264|  15.1k|  if (pk->pubkey_algo == PUBKEY_ALGO_EDDSA)
  ------------------
  |  Branch (264:7): [True: 4.74k, False: 10.4k]
  ------------------
  265|  4.74k|    {
  266|       |      /* EdDSA signs data of arbitrary length.  Thus no special
  267|       |         treatment is required.  */
  268|  4.74k|      frame = gcry_mpi_set_opaque_copy (NULL, gcry_md_read (md, hash_algo),
  269|  4.74k|                                        8*gcry_md_get_algo_dlen (hash_algo));
  270|  4.74k|    }
  271|  10.4k|  else if (pk->pubkey_algo == PUBKEY_ALGO_DSA
  ------------------
  |  Branch (271:12): [True: 2.46k, False: 7.97k]
  ------------------
  272|  10.4k|           || pk->pubkey_algo == PUBKEY_ALGO_ECDSA)
  ------------------
  |  Branch (272:15): [True: 2.93k, False: 5.03k]
  ------------------
  273|  5.40k|    {
  274|       |      /* It's a DSA signature, so find out the size of q.  */
  275|       |
  276|  5.40k|      size_t qbits = gcry_mpi_get_nbits (pk->pkey[1]);
  277|       |
  278|       |      /* pkey[1] is Q for ECDSA, which is an uncompressed point,
  279|       |         i.e.  04 <x> <y>  */
  280|  5.40k|      if (pk->pubkey_algo == PUBKEY_ALGO_ECDSA)
  ------------------
  |  Branch (280:11): [True: 2.93k, False: 2.46k]
  ------------------
  281|  2.93k|        qbits = ecdsa_qbits_from_Q (qbits);
  282|       |
  283|       |      /* Make sure it is a multiple of 8 bits. */
  284|  5.40k|      if ((qbits%8))
  ------------------
  |  Branch (284:11): [True: 67, False: 5.33k]
  ------------------
  285|     67|	{
  286|     67|	  log_error(_("DSA requires the hash length to be a"
  ------------------
  |  |   28|     67|#  define _(a) gettext (a)
  ------------------
  287|     67|		      " multiple of 8 bits\n"));
  288|     67|	  return NULL;
  289|     67|	}
  290|       |
  291|       |      /* Don't allow any q smaller than 160 bits.  This might need a
  292|       |	 revisit as the DSA2 design firms up, but for now, we don't
  293|       |	 want someone to issue signatures from a key with a 16-bit q
  294|       |	 or something like that, which would look correct but allow
  295|       |	 trivial forgeries.  Yes, I know this rules out using MD5 with
  296|       |	 DSA. ;) */
  297|  5.33k|      if (qbits < 160)
  ------------------
  |  Branch (297:11): [True: 73, False: 5.26k]
  ------------------
  298|     73|	{
  299|     73|	  log_error (_("%s key %s uses an unsafe (%zu bit) hash\n"),
  ------------------
  |  |   28|     73|#  define _(a) gettext (a)
  ------------------
  300|     73|                     openpgp_pk_algo_name (pk->pubkey_algo),
  301|     73|                     keystr_from_pk (pk), qbits);
  302|     73|	  return NULL;
  303|     73|	}
  304|       |
  305|       |
  306|       |      /* ECDSA 521 is special has it is larger than the largest hash
  307|       |         we have (SHA-512).  Thus we change the size for further
  308|       |         processing to 512.  */
  309|  5.26k|      if (pk->pubkey_algo == PUBKEY_ALGO_ECDSA && qbits > 512)
  ------------------
  |  Branch (309:11): [True: 2.79k, False: 2.46k]
  |  Branch (309:51): [True: 503, False: 2.28k]
  ------------------
  310|    503|        qbits = 512;
  311|       |
  312|       |      /* Check if we're too short.  Too long is safe as we'll
  313|       |	 automatically left-truncate.  */
  314|  5.26k|      mdlen = gcry_md_get_algo_dlen (hash_algo);
  315|  5.26k|      if (mdlen < qbits/8)
  ------------------
  |  Branch (315:11): [True: 72, False: 5.18k]
  ------------------
  316|     72|	{
  317|     72|	  log_error (_("%s key %s requires a %zu bit or larger hash "
  ------------------
  |  |   28|     72|#  define _(a) gettext (a)
  ------------------
  318|     72|                       "(hash is %s)\n"),
  319|     72|                     openpgp_pk_algo_name (pk->pubkey_algo),
  320|     72|                     keystr_from_pk (pk), qbits,
  321|     72|                     gcry_md_algo_name (hash_algo));
  322|     72|	  return NULL;
  323|     72|	}
  324|       |
  325|       |     /* Note that we do the truncation by passing QBITS/8 as length to
  326|       |        mpi_scan.  */
  327|  5.18k|      if (gcry_mpi_scan (&frame, GCRYMPI_FMT_USG,
  ------------------
  |  Branch (327:11): [True: 0, False: 5.18k]
  ------------------
  328|  5.18k|                         gcry_md_read (md, hash_algo), qbits/8, NULL))
  329|      0|        BUG();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  330|  5.18k|    }
  331|  5.03k|  else
  332|  5.03k|    {
  333|  5.03k|      gpg_error_t rc;
  334|  5.03k|      byte *asn;
  335|  5.03k|      size_t asnlen;
  336|       |
  337|  5.03k|      rc = gcry_md_algo_info (hash_algo, GCRYCTL_GET_ASNOID, NULL, &asnlen);
  338|  5.03k|      if (rc)
  ------------------
  |  Branch (338:11): [True: 0, False: 5.03k]
  ------------------
  339|      0|        log_fatal ("can't get OID of digest algorithm %d: %s\n",
  340|      0|                   hash_algo, gpg_strerror (rc));
  341|  5.03k|      asn = xtrymalloc (asnlen);
  ------------------
  |  |   97|  5.03k|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  342|  5.03k|      if (!asn)
  ------------------
  |  Branch (342:11): [True: 0, False: 5.03k]
  ------------------
  343|      0|        return NULL;
  344|  5.03k|      if ( gcry_md_algo_info (hash_algo, GCRYCTL_GET_ASNOID, asn, &asnlen) )
  ------------------
  |  Branch (344:12): [True: 0, False: 5.03k]
  ------------------
  345|      0|        BUG();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  346|  5.03k|      frame = do_encode_md (md, hash_algo, gcry_md_get_algo_dlen (hash_algo),
  347|  5.03k|                            gcry_mpi_get_nbits (pk->pkey[0]), asn, asnlen);
  348|  5.03k|      xfree (asn);
  ------------------
  |  |  104|  5.03k|#define xfree(a)         gcry_free ((a))
  ------------------
  349|  5.03k|    }
  350|       |
  351|  14.9k|  return frame;
  352|  15.1k|}
seskey.c:do_encode_md:
  201|  5.03k|{
  202|  5.03k|    size_t nframe = (nbits+7) / 8;
  203|  5.03k|    byte *frame;
  204|  5.03k|    int i,n;
  205|  5.03k|    gcry_mpi_t a;
  206|       |
  207|  5.03k|    if (len + asnlen + 4  > nframe)
  ------------------
  |  Branch (207:9): [True: 2.81k, False: 2.22k]
  ------------------
  208|  2.81k|      {
  209|  2.81k|        log_error ("can't encode a %d bit MD into a %d bits frame, algo=%d\n",
  210|  2.81k|                   (int)(len*8), (int)nbits, algo);
  211|  2.81k|        return NULL;
  212|  2.81k|      }
  213|       |
  214|       |    /* We encode the MD in this way:
  215|       |     *
  216|       |     *	   0  1 PAD(n bytes)   0  ASN(asnlen bytes)  MD(len bytes)
  217|       |     *
  218|       |     * PAD consists of FF bytes.
  219|       |     */
  220|  2.22k|    frame = gcry_md_is_secure (md)? xmalloc_secure (nframe) : xmalloc (nframe);
  ------------------
  |  |  108|      0|#define xmalloc_secure(a)  gcry_xmalloc_secure ((a))
  ------------------
                  frame = gcry_md_is_secure (md)? xmalloc_secure (nframe) : xmalloc (nframe);
  ------------------
  |  |  107|  4.45k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  |  Branch (220:13): [True: 0, False: 2.22k]
  ------------------
  221|  2.22k|    n = 0;
  222|  2.22k|    frame[n++] = 0;
  223|  2.22k|    frame[n++] = 1; /* block type */
  224|  2.22k|    i = nframe - len - asnlen -3 ;
  225|  2.22k|    log_assert( i > 1 );
  226|      0|    memset( frame+n, 0xff, i ); n += i;
  227|  2.22k|    frame[n++] = 0;
  228|  2.22k|    memcpy( frame+n, asn, asnlen ); n += asnlen;
  229|  2.22k|    memcpy( frame+n, gcry_md_read (md, algo), len ); n += len;
  230|  2.22k|    log_assert( n == nframe );
  231|       |
  232|  2.22k|    if (gcry_mpi_scan( &a, GCRYMPI_FMT_USG, frame, n, &nframe ))
  ------------------
  |  Branch (232:9): [True: 0, False: 2.22k]
  ------------------
  233|      0|	BUG();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  234|  2.22k|    xfree(frame);
  ------------------
  |  |  104|  2.22k|#define xfree(a)         gcry_free ((a))
  ------------------
  235|       |
  236|       |    /* Note that PGP before version 2.3 encoded the MD as:
  237|       |     *
  238|       |     *   0   1   MD(16 bytes)   0   PAD(n bytes)   1
  239|       |     *
  240|       |     * The MD is always 16 bytes here because it's always MD5.  We do
  241|       |     * not support pre-v2.3 signatures, but I'm including this comment
  242|       |     * so the information is easily found in the future.
  243|       |     */
  244|       |
  245|  2.22k|    return a;
  246|  2.22k|}

check_signature2:
  160|  3.12k|{
  161|  3.12k|  int rc=0;
  162|  3.12k|  PKT_public_key *pk;
  163|       |
  164|  3.12k|  if (r_expiredate)
  ------------------
  |  Branch (164:7): [True: 0, False: 3.12k]
  ------------------
  165|      0|    *r_expiredate = 0;
  166|  3.12k|  if (r_expired)
  ------------------
  |  Branch (166:7): [True: 3.12k, False: 0]
  ------------------
  167|  3.12k|    *r_expired = 0;
  168|  3.12k|  if (r_revoked)
  ------------------
  |  Branch (168:7): [True: 3.12k, False: 0]
  ------------------
  169|  3.12k|    *r_revoked = 0;
  170|  3.12k|  if (r_pk)
  ------------------
  |  Branch (170:7): [True: 3.12k, False: 0]
  ------------------
  171|  3.12k|    *r_pk = NULL;
  172|       |
  173|  3.12k|  pk = xtrycalloc (1, sizeof *pk);
  ------------------
  |  |   99|  3.12k|#define xtrycalloc(a,b)  gcry_calloc ((a),(b))
  ------------------
  174|  3.12k|  if (!pk)
  ------------------
  |  Branch (174:7): [True: 0, False: 3.12k]
  ------------------
  175|      0|    return gpg_error_from_syserror ();
  176|       |
  177|  3.12k|  if  ((rc=openpgp_md_test_algo(sig->digest_algo)))
  ------------------
  |  Branch (177:8): [True: 0, False: 3.12k]
  ------------------
  178|      0|    {
  179|       |      /* We don't have this digest. */
  180|      0|    }
  181|  3.12k|  else if (!gnupg_digest_is_allowed (opt.compliance, 0, sig->digest_algo))
  ------------------
  |  Branch (181:12): [True: 0, False: 3.12k]
  ------------------
  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|  3.12k|  else if ((rc=openpgp_pk_test_algo(sig->pubkey_algo)))
  ------------------
  |  Branch (189:12): [True: 84, False: 3.04k]
  ------------------
  190|     84|    {
  191|       |      /* We don't have this pubkey algo. */
  192|     84|    }
  193|  3.04k|  else if (!gcry_md_is_enabled (digest,sig->digest_algo))
  ------------------
  |  Branch (193:12): [True: 77, False: 2.96k]
  ------------------
  194|     77|    {
  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|     77|      log_info(_("WARNING: signature digest conflict in message\n"));
  ------------------
  |  |   28|     77|#  define _(a) gettext (a)
  ------------------
  200|     77|      rc = gpg_error (GPG_ERR_GENERAL);
  201|     77|    }
  202|  2.96k|  else if (get_pubkey_for_sig (ctrl, pk, sig, forced_pk))
  ------------------
  |  Branch (202:12): [True: 2.96k, False: 0]
  ------------------
  203|  2.96k|    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|  3.12k|    if( !rc && sig->sig_class < 2 && is_status_enabled() ) {
  ------------------
  |  Branch (248:9): [True: 0, False: 3.12k]
  |  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|  3.12k|  if (r_pk)
  ------------------
  |  Branch (333:7): [True: 3.12k, False: 0]
  ------------------
  334|  3.12k|    *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|  3.12k|  return rc;
  342|  3.12k|}
check_revocation_keys:
  742|    702|{
  743|    702|  static int busy=0;
  744|    702|  int i;
  745|    702|  int rc = GPG_ERR_GENERAL;
  746|       |
  747|    702|  log_assert (IS_KEY_REV(sig));
  748|      0|  log_assert ((sig->keyid[0]!=pk->keyid[0]) || (sig->keyid[0]!=pk->keyid[1]));
  749|       |
  750|       |  /* Avoid infinite recursion.  Consider the following:
  751|       |   *
  752|       |   *   - We want to check if A is revoked.
  753|       |   *
  754|       |   *   - C is a designated revoker for B and has revoked B.
  755|       |   *
  756|       |   *   - B is a designated revoker for A and has revoked A.
  757|       |   *
  758|       |   * When checking if A is revoked (in merge_selfsigs_main), we
  759|       |   * observe that A has a designed revoker.  As such, we call this
  760|       |   * function.  This function sees that there is a valid revocation
  761|       |   * signature, which is signed by B.  It then calls check_signature()
  762|       |   * to verify that the signature is good.  To check the sig, we need
  763|       |   * to lookup B.  Looking up B means calling merge_selfsigs_main,
  764|       |   * which checks whether B is revoked, which calls this function to
  765|       |   * see if B was revoked by some key.
  766|       |   *
  767|       |   * In this case, the added level of indirection doesn't hurt.  It
  768|       |   * just means a bit more work.  However, if C == A, then we'd end up
  769|       |   * in a loop.  But, it doesn't make sense to look up C anyways: even
  770|       |   * if B is revoked, we conservatively consider a valid revocation
  771|       |   * signed by B to revoke A.  Since this is the only place where this
  772|       |   * type of recursion can occur, we simply cause this function to
  773|       |   * fail if it is entered recursively.  */
  774|    702|  if (busy)
  ------------------
  |  Branch (774:7): [True: 0, False: 702]
  ------------------
  775|      0|    {
  776|       |      /* Return an error (i.e. not revoked), but mark the pk as
  777|       |         uncacheable as we don't really know its revocation status
  778|       |         until it is checked directly.  */
  779|      0|      pk->flags.dont_cache = 1;
  780|      0|      return rc;
  781|      0|    }
  782|       |
  783|    702|  busy=1;
  784|       |
  785|       |  /*  es_printf("looking at %08lX with a sig from %08lX\n",(ulong)pk->keyid[1],
  786|       |      (ulong)sig->keyid[1]); */
  787|       |
  788|       |  /* is the issuer of the sig one of our revokers? */
  789|    702|  if( !pk->revkey && pk->numrevkeys )
  ------------------
  |  Branch (789:7): [True: 0, False: 702]
  |  Branch (789:22): [True: 0, False: 0]
  ------------------
  790|      0|     BUG();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
  791|    702|  else
  792|  2.31k|      for(i=0;i<pk->numrevkeys;i++)
  ------------------
  |  Branch (792:15): [True: 1.61k, False: 702]
  ------------------
  793|  1.61k|	{
  794|       |	  /* The revoker's keyid.  */
  795|  1.61k|          u32 keyid[2];
  796|       |
  797|  1.61k|          keyid_from_fingerprint (ctrl, pk->revkey[i].fpr, pk->revkey[i].fprlen,
  798|  1.61k|                                  keyid);
  799|       |
  800|  1.61k|          if(keyid[0]==sig->keyid[0] && keyid[1]==sig->keyid[1])
  ------------------
  |  Branch (800:14): [True: 104, False: 1.50k]
  |  Branch (800:41): [True: 0, False: 104]
  ------------------
  801|       |	    /* The signature was generated by a designated revoker.
  802|       |	       Verify the signature.  */
  803|      0|	    {
  804|      0|              gcry_md_hd_t md;
  805|       |
  806|      0|              rc = gcry_md_open (&md, sig->digest_algo, 0);
  807|      0|              if (rc)
  ------------------
  |  Branch (807:19): [True: 0, False: 0]
  ------------------
  808|      0|                  return rc;
  809|      0|              hash_public_key(md,pk);
  810|       |	      /* Note: check_signature only checks that the signature
  811|       |		 is good.  It does not fail if the key is revoked.  */
  812|      0|              rc = check_signature (ctrl, sig, md);
  813|      0|	      cache_sig_result(sig,rc);
  814|      0|              gcry_md_close (md);
  815|      0|	      break;
  816|      0|	    }
  817|  1.61k|	}
  818|       |
  819|    702|  busy=0;
  820|       |
  821|    702|  return rc;
  822|    702|}
check_backsig:
  836|  1.78k|{
  837|  1.78k|  gcry_md_hd_t md;
  838|  1.78k|  int rc;
  839|       |
  840|       |  /* Always check whether the algorithm is available.  Although
  841|       |     gcry_md_open would throw an error, some libgcrypt versions will
  842|       |     print a debug message in that case too. */
  843|  1.78k|  if ((rc=openpgp_md_test_algo (backsig->digest_algo)))
  ------------------
  |  Branch (843:7): [True: 13, False: 1.77k]
  ------------------
  844|     13|    return rc;
  845|       |
  846|  1.77k|  if(!opt.no_sig_cache && backsig->flags.checked)
  ------------------
  |  Branch (846:6): [True: 1.77k, False: 0]
  |  Branch (846:27): [True: 0, False: 1.77k]
  ------------------
  847|      0|    return backsig->flags.valid? 0 : gpg_error (GPG_ERR_BAD_SIGNATURE);
  ------------------
  |  Branch (847:12): [True: 0, False: 0]
  ------------------
  848|       |
  849|  1.77k|  rc = gcry_md_open (&md, backsig->digest_algo,0);
  850|  1.77k|  if (!rc)
  ------------------
  |  Branch (850:7): [True: 1.77k, False: 0]
  ------------------
  851|  1.77k|    {
  852|  1.77k|      hash_public_key(md,main_pk);
  853|  1.77k|      hash_public_key(md,sub_pk);
  854|  1.77k|      rc = check_signature_end (sub_pk, backsig, md, NULL, 0, NULL, NULL, NULL);
  855|  1.77k|      cache_sig_result(backsig,rc);
  856|  1.77k|      gcry_md_close(md);
  857|  1.77k|    }
  858|       |
  859|  1.77k|  return rc;
  860|  1.77k|}
check_key_signature:
  870|  29.8k|{
  871|  29.8k|  return check_key_signature2 (ctrl, root, node, NULL, NULL,
  872|  29.8k|                               is_selfsig, NULL, NULL);
  873|  29.8k|}
check_signature_over_key_or_uid:
  913|  13.5k|{
  914|  13.5k|  int rc;
  915|  13.5k|  PKT_public_key *pripk = kb->pkt->pkt.public_key;
  916|  13.5k|  gcry_md_hd_t md;
  917|  13.5k|  int signer_alloced = 0;
  918|  13.5k|  int stub_is_selfsig;
  919|       |
  920|  13.5k|  if (!is_selfsig)
  ------------------
  |  Branch (920:7): [True: 13.5k, False: 0]
  ------------------
  921|  13.5k|    is_selfsig = &stub_is_selfsig;
  922|       |
  923|  13.5k|  rc = openpgp_pk_test_algo (sig->pubkey_algo);
  924|  13.5k|  if (rc)
  ------------------
  |  Branch (924:7): [True: 0, False: 13.5k]
  ------------------
  925|      0|    return rc;
  926|  13.5k|  rc = openpgp_md_test_algo (sig->digest_algo);
  927|  13.5k|  if (rc)
  ------------------
  |  Branch (927:7): [True: 0, False: 13.5k]
  ------------------
  928|      0|    return rc;
  929|       |
  930|       |  /* A signature's class indicates the type of packet that it
  931|       |     signs.  */
  932|  13.5k|  if (IS_BACK_SIG (sig) || IS_KEY_SIG (sig) || IS_KEY_REV (sig))
  ------------------
  |  |   44|  27.0k|#define IS_BACK_SIG(s)   ((s)->sig_class == 0x19)
  |  |  ------------------
  |  |  |  Branch (44:26): [True: 0, False: 13.5k]
  |  |  ------------------
  ------------------
                if (IS_BACK_SIG (sig) || IS_KEY_SIG (sig) || IS_KEY_REV (sig))
  ------------------
  |  |   40|  27.0k|#define IS_KEY_SIG(s)    ((s)->sig_class == 0x1f)
  |  |  ------------------
  |  |  |  Branch (40:26): [True: 1.95k, False: 11.5k]
  |  |  ------------------
  ------------------
                if (IS_BACK_SIG (sig) || IS_KEY_SIG (sig) || IS_KEY_REV (sig))
  ------------------
  |  |   45|  11.5k|#define IS_KEY_REV(s)    ((s)->sig_class == 0x20)
  |  |  ------------------
  |  |  |  Branch (45:26): [True: 1.03k, False: 10.5k]
  |  |  ------------------
  ------------------
  933|  2.98k|    {
  934|       |      /* Key revocations can only be over primary keys.  */
  935|  2.98k|      if (packet->pkttype != PKT_PUBLIC_KEY)
  ------------------
  |  Branch (935:11): [True: 0, False: 2.98k]
  ------------------
  936|      0|        return gpg_error (GPG_ERR_SIG_CLASS);
  937|  2.98k|    }
  938|  10.5k|  else if (IS_SUBKEY_SIG (sig) || IS_SUBKEY_REV (sig))
  ------------------
  |  |   43|  21.0k|#define IS_SUBKEY_SIG(s) ((s)->sig_class == 0x18)
  |  |  ------------------
  |  |  |  Branch (43:26): [True: 1.00k, False: 9.51k]
  |  |  ------------------
  ------------------
                else if (IS_SUBKEY_SIG (sig) || IS_SUBKEY_REV (sig))
  ------------------
  |  |   47|  9.51k|#define IS_SUBKEY_REV(s) ((s)->sig_class == 0x28)
  |  |  ------------------
  |  |  |  Branch (47:26): [True: 184, False: 9.33k]
  |  |  ------------------
  ------------------
  939|  1.19k|    {
  940|  1.19k|      if (packet->pkttype != PKT_PUBLIC_SUBKEY)
  ------------------
  |  Branch (940:11): [True: 0, False: 1.19k]
  ------------------
  941|      0|        return gpg_error (GPG_ERR_SIG_CLASS);
  942|  1.19k|    }
  943|  9.33k|  else if (IS_UID_SIG (sig) || IS_UID_REV (sig))
  ------------------
  |  |   41|  18.6k|#define IS_UID_SIG(s)    (((s)->sig_class & ~3) == 0x10)
  |  |  ------------------
  |  |  |  Branch (41:26): [True: 8.64k, False: 688]
  |  |  ------------------
  ------------------
                else if (IS_UID_SIG (sig) || IS_UID_REV (sig))
  ------------------
  |  |   46|    688|#define IS_UID_REV(s)    ((s)->sig_class == 0x30)
  |  |  ------------------
  |  |  |  Branch (46:26): [True: 688, False: 0]
  |  |  ------------------
  ------------------
  944|  9.33k|    {
  945|  9.33k|      if (packet->pkttype != PKT_USER_ID)
  ------------------
  |  Branch (945:11): [True: 0, False: 9.33k]
  ------------------
  946|      0|        return gpg_error (GPG_ERR_SIG_CLASS);
  947|  9.33k|    }
  948|      0|  else
  949|      0|    return gpg_error (GPG_ERR_SIG_CLASS);
  950|       |
  951|       |  /* PACKET is the right type for SIG.  */
  952|       |
  953|  13.5k|  if (signer)
  ------------------
  |  Branch (953:7): [True: 12.4k, False: 1.00k]
  ------------------
  954|  12.4k|    {
  955|  12.4k|      if (signer->keyid[0] == pripk->keyid[0]
  ------------------
  |  Branch (955:11): [True: 12.4k, False: 0]
  ------------------
  956|  12.4k|          && signer->keyid[1] == pripk->keyid[1])
  ------------------
  |  Branch (956:14): [True: 12.4k, False: 0]
  ------------------
  957|  12.4k|        *is_selfsig = 1;
  958|      0|      else
  959|      0|        *is_selfsig = 0;
  960|  12.4k|    }
  961|  1.00k|  else
  962|  1.00k|    {
  963|       |      /* Get the signer.  If possible, avoid a look up.  */
  964|  1.00k|      if (sig->keyid[0] == pripk->keyid[0]
  ------------------
  |  Branch (964:11): [True: 1.00k, False: 0]
  ------------------
  965|  1.00k|          && sig->keyid[1] == pripk->keyid[1])
  ------------------
  |  Branch (965:14): [True: 1.00k, False: 0]
  ------------------
  966|  1.00k|        {
  967|       |          /* Issued by the primary key.  */
  968|  1.00k|          signer = pripk;
  969|  1.00k|          *is_selfsig = 1;
  970|  1.00k|        }
  971|      0|      else
  972|      0|        {
  973|       |          /* See if one of the subkeys was the signer (although this
  974|       |           * is extremely unlikely).  */
  975|      0|          kbnode_t ctx = NULL;
  976|      0|          kbnode_t n;
  977|       |
  978|      0|          while ((n = walk_kbnode (kb, &ctx, 0)))
  ------------------
  |  Branch (978:18): [True: 0, False: 0]
  ------------------
  979|      0|            {
  980|      0|              PKT_public_key *subk;
  981|       |
  982|      0|              if (n->pkt->pkttype != PKT_PUBLIC_SUBKEY)
  ------------------
  |  Branch (982:19): [True: 0, False: 0]
  ------------------
  983|      0|                continue;
  984|       |
  985|      0|              subk = n->pkt->pkt.public_key;
  986|      0|              if (sig->keyid[0] == subk->keyid[0]
  ------------------
  |  Branch (986:19): [True: 0, False: 0]
  ------------------
  987|      0|                  && sig->keyid[1] == subk->keyid[1])
  ------------------
  |  Branch (987:22): [True: 0, False: 0]
  ------------------
  988|      0|                {
  989|       |                  /* Issued by a subkey.  */
  990|      0|                  signer = subk;
  991|      0|                  break;
  992|      0|                }
  993|      0|            }
  994|       |
  995|      0|          if (! signer)
  ------------------
  |  Branch (995:15): [True: 0, False: 0]
  ------------------
  996|      0|            {
  997|       |              /* Signer by some other key.  */
  998|      0|              *is_selfsig = 0;
  999|      0|              if (ret_pk)
  ------------------
  |  Branch (999:19): [True: 0, False: 0]
  ------------------
 1000|      0|                {
 1001|      0|                  signer = ret_pk;
 1002|       |                  /* FIXME: Using memset here is probematic because it
 1003|       |                   * assumes that there are no allocated fields in
 1004|       |                   * SIGNER.  */
 1005|      0|                  memset (signer, 0, sizeof (*signer));
 1006|      0|                  signer_alloced = 1;
 1007|      0|                }
 1008|      0|              else
 1009|      0|                {
 1010|      0|                  signer = xmalloc_clear (sizeof (*signer));
  ------------------
  |  |  116|      0|#define xmalloc_clear(a) gcry_xcalloc (1, (a))
  ------------------
 1011|      0|                  signer_alloced = 2;
 1012|      0|                }
 1013|       |
 1014|      0|              if (IS_CERT (sig))
  ------------------
  |  |   32|      0|#define IS_CERT(s)       (IS_KEY_SIG(s)       \
  |  |  ------------------
  |  |  |  |   40|      0|#define IS_KEY_SIG(s)    ((s)->sig_class == 0x1f)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   33|      0|                          || IS_UID_SIG(s)    \
  |  |  ------------------
  |  |  |  |   41|      0|#define IS_UID_SIG(s)    (((s)->sig_class & ~3) == 0x10)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (41:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   34|      0|                          || IS_SUBKEY_SIG(s) \
  |  |  ------------------
  |  |  |  |   43|      0|#define IS_SUBKEY_SIG(s) ((s)->sig_class == 0x18)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   35|      0|                          || IS_KEY_REV(s)    \
  |  |  ------------------
  |  |  |  |   45|      0|#define IS_KEY_REV(s)    ((s)->sig_class == 0x20)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (45:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   36|      0|                          || IS_UID_REV(s)    \
  |  |  ------------------
  |  |  |  |   46|      0|#define IS_UID_REV(s)    ((s)->sig_class == 0x30)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (46:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   37|      0|                          || IS_SUBKEY_REV(s) \
  |  |  ------------------
  |  |  |  |   47|      0|#define IS_SUBKEY_REV(s) ((s)->sig_class == 0x28)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (47:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   38|      0|                          || IS_ATTST_SIGS(s) )
  |  |  ------------------
  |  |  |  |   42|      0|#define IS_ATTST_SIGS(s) ((s)->sig_class == 0x16)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:26): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1015|      0|                signer->req_usage = PUBKEY_USAGE_CERT;
  ------------------
  |  |   51|      0|#define PUBKEY_USAGE_CERT    GCRY_PK_USAGE_CERT  /* Also good to certify keys.*/
  ------------------
 1016|       |
 1017|      0|              rc = get_pubkey_for_sig (ctrl, signer, sig, NULL);
 1018|      0|              if (rc)
  ------------------
  |  Branch (1018:19): [True: 0, False: 0]
  ------------------
 1019|      0|                {
 1020|      0|                  xfree (signer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1021|      0|                  signer = NULL;
 1022|      0|                  signer_alloced = 0;
 1023|      0|                  goto leave;
 1024|      0|                }
 1025|      0|            }
 1026|      0|        }
 1027|  1.00k|    }
 1028|       |
 1029|       |  /* We checked above that we supported this algo, so an error here is
 1030|       |   * a bug.  */
 1031|  13.5k|  if (gcry_md_open (&md, sig->digest_algo, 0))
  ------------------
  |  Branch (1031:7): [True: 0, False: 13.5k]
  ------------------
 1032|      0|    BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1033|       |
 1034|       |  /* Hash the relevant data.  */
 1035|       |
 1036|  13.5k|  if (IS_KEY_SIG (sig) || IS_KEY_REV (sig))
  ------------------
  |  |   40|  27.0k|#define IS_KEY_SIG(s)    ((s)->sig_class == 0x1f)
  |  |  ------------------
  |  |  |  Branch (40:26): [True: 1.95k, False: 11.5k]
  |  |  ------------------
  ------------------
                if (IS_KEY_SIG (sig) || IS_KEY_REV (sig))
  ------------------
  |  |   45|  11.5k|#define IS_KEY_REV(s)    ((s)->sig_class == 0x20)
  |  |  ------------------
  |  |  |  Branch (45:26): [True: 1.03k, False: 10.5k]
  |  |  ------------------
  ------------------
 1037|  2.98k|    {
 1038|  2.98k|      log_assert (packet->pkttype == PKT_PUBLIC_KEY);
 1039|      0|      hash_public_key (md, packet->pkt.public_key);
 1040|  2.98k|      rc = check_signature_end_simple (signer, sig, md, NULL, 0);
 1041|  2.98k|    }
 1042|  10.5k|  else if (IS_BACK_SIG (sig))
  ------------------
  |  |   44|  10.5k|#define IS_BACK_SIG(s)   ((s)->sig_class == 0x19)
  |  |  ------------------
  |  |  |  Branch (44:26): [True: 0, False: 10.5k]
  |  |  ------------------
  ------------------
 1043|      0|    {
 1044|      0|      log_assert (packet->pkttype == PKT_PUBLIC_KEY);
 1045|      0|      hash_public_key (md, packet->pkt.public_key);
 1046|      0|      hash_public_key (md, signer);
 1047|      0|      rc = check_signature_end_simple (signer, sig, md, NULL, 0);
 1048|      0|    }
 1049|  10.5k|  else if (IS_SUBKEY_SIG (sig) || IS_SUBKEY_REV (sig))
  ------------------
  |  |   43|  21.0k|#define IS_SUBKEY_SIG(s) ((s)->sig_class == 0x18)
  |  |  ------------------
  |  |  |  Branch (43:26): [True: 1.00k, False: 9.51k]
  |  |  ------------------
  ------------------
                else if (IS_SUBKEY_SIG (sig) || IS_SUBKEY_REV (sig))
  ------------------
  |  |   47|  9.51k|#define IS_SUBKEY_REV(s) ((s)->sig_class == 0x28)
  |  |  ------------------
  |  |  |  Branch (47:26): [True: 184, False: 9.33k]
  |  |  ------------------
  ------------------
 1050|  1.19k|    {
 1051|  1.19k|      log_assert (packet->pkttype == PKT_PUBLIC_SUBKEY);
 1052|      0|      hash_public_key (md, pripk);
 1053|  1.19k|      hash_public_key (md, packet->pkt.public_key);
 1054|  1.19k|      rc = check_signature_end_simple (signer, sig, md, NULL, 0);
 1055|  1.19k|    }
 1056|  9.33k|  else if (IS_UID_SIG (sig) || IS_UID_REV (sig))
  ------------------
  |  |   41|  18.6k|#define IS_UID_SIG(s)    (((s)->sig_class & ~3) == 0x10)
  |  |  ------------------
  |  |  |  Branch (41:26): [True: 8.64k, False: 688]
  |  |  ------------------
  ------------------
                else if (IS_UID_SIG (sig) || IS_UID_REV (sig))
  ------------------
  |  |   46|    688|#define IS_UID_REV(s)    ((s)->sig_class == 0x30)
  |  |  ------------------
  |  |  |  Branch (46:26): [True: 688, False: 0]
  |  |  ------------------
  ------------------
 1057|  9.33k|    {
 1058|  9.33k|      log_assert (packet->pkttype == PKT_USER_ID);
 1059|  9.33k|      if (sig->digest_algo == DIGEST_ALGO_SHA1 && !*is_selfsig
  ------------------
  |  Branch (1059:11): [True: 1.49k, False: 7.83k]
  |  Branch (1059:51): [True: 0, False: 1.49k]
  ------------------
 1060|  9.33k|          && !opt.flags.allow_weak_key_signatures)
  ------------------
  |  Branch (1060:14): [True: 0, False: 0]
  ------------------
 1061|      0|        {
 1062|       |          /* If the signature was created using SHA-1 we consider this
 1063|       |           * signature invalid because it makes it possible to mount a
 1064|       |           * chosen-prefix collision.  We don't do this for
 1065|       |           * self-signatures, though.  */
 1066|      0|          print_sha1_keysig_rejected_note ();
 1067|      0|          rc = gpg_error (GPG_ERR_DIGEST_ALGO);
 1068|      0|        }
 1069|  9.33k|      else
 1070|  9.33k|        {
 1071|  9.33k|          hash_public_key (md, pripk);
 1072|  9.33k|          hash_uid_packet (packet->pkt.user_id, md, sig);
 1073|  9.33k|          rc = check_signature_end_simple (signer, sig, md, NULL, 0);
 1074|  9.33k|        }
 1075|  9.33k|    }
 1076|      0|  else
 1077|      0|    {
 1078|       |      /* We should never get here.  (The first if above should have
 1079|       |       * already caught this error.)  */
 1080|      0|      BUG ();
  ------------------
  |  |   44|      0|#  define BUG() bug_at ( __FILE__, __LINE__, __FUNCTION__)
  ------------------
 1081|      0|    }
 1082|       |
 1083|  13.5k|  gcry_md_close (md);
 1084|       |
 1085|  13.5k| leave:
 1086|  13.5k|  if (! rc && ret_pk && ret_pk != signer)
  ------------------
  |  Branch (1086:7): [True: 1.02k, False: 12.4k]
  |  Branch (1086:15): [True: 0, False: 1.02k]
  |  Branch (1086:25): [True: 0, False: 0]
  ------------------
 1087|      0|    copy_public_key (ret_pk, signer);
 1088|       |
 1089|  13.5k|  if (signer_alloced)
  ------------------
  |  Branch (1089:7): [True: 0, False: 13.5k]
  ------------------
 1090|      0|    {
 1091|       |      /* We looked up SIGNER; it is not a pointer into KB.  */
 1092|      0|      release_public_key_parts (signer);
 1093|       |      /* Free if we also allocated the memory.  */
 1094|      0|      if (signer_alloced == 2)
  ------------------
  |  Branch (1094:11): [True: 0, False: 0]
  ------------------
 1095|      0|        xfree (signer);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
 1096|      0|    }
 1097|       |
 1098|  13.5k|  return rc;
 1099|  13.5k|}
check_key_signature2:
 1141|  29.8k|{
 1142|  29.8k|  PKT_public_key *pk;
 1143|  29.8k|  PKT_signature *sig;
 1144|  29.8k|  int algo;
 1145|  29.8k|  int rc;
 1146|       |
 1147|  29.8k|  if (is_selfsig)
  ------------------
  |  Branch (1147:7): [True: 0, False: 29.8k]
  ------------------
 1148|      0|    *is_selfsig = 0;
 1149|  29.8k|  if (r_expiredate)
  ------------------
  |  Branch (1149:7): [True: 0, False: 29.8k]
  ------------------
 1150|      0|    *r_expiredate = 0;
 1151|  29.8k|  if (r_expired)
  ------------------
  |  Branch (1151:7): [True: 0, False: 29.8k]
  ------------------
 1152|      0|    *r_expired = 0;
 1153|  29.8k|  log_assert (node->pkt->pkttype == PKT_SIGNATURE);
 1154|      0|  log_assert (root->pkt->pkttype == PKT_PUBLIC_KEY);
 1155|       |
 1156|      0|  pk = root->pkt->pkt.public_key;
 1157|  29.8k|  sig = node->pkt->pkt.signature;
 1158|  29.8k|  algo = sig->digest_algo;
 1159|       |
 1160|       |  /* Check whether we have cached the result of a previous signature
 1161|       |   * check.  Note that we may no longer have the pubkey or hash
 1162|       |   * needed to verify a sig, but can still use the cached value.  A
 1163|       |   * cache refresh detects and clears these cases. */
 1164|  29.8k|  if ( !opt.no_sig_cache )
  ------------------
  |  Branch (1164:8): [True: 29.8k, False: 0]
  ------------------
 1165|  29.8k|    {
 1166|  29.8k|      cache_stats.total++;
 1167|  29.8k|      if (sig->flags.checked) /* Cached status available.  */
  ------------------
  |  Branch (1167:11): [True: 12.9k, False: 16.9k]
  ------------------
 1168|  12.9k|        {
 1169|  12.9k|          cache_stats.cached++;
 1170|  12.9k|          if (is_selfsig)
  ------------------
  |  Branch (1170:15): [True: 0, False: 12.9k]
  ------------------
 1171|      0|            {
 1172|      0|              u32 keyid[2];
 1173|       |
 1174|      0|              keyid_from_pk (pk, keyid);
 1175|      0|              if (keyid[0] == sig->keyid[0] && keyid[1] == sig->keyid[1])
  ------------------
  |  Branch (1175:19): [True: 0, False: 0]
  |  Branch (1175:48): [True: 0, False: 0]
  ------------------
 1176|      0|                *is_selfsig = 1;
 1177|      0|	    }
 1178|       |          /* BUG: This is wrong for non-self-sigs... needs to be the
 1179|       |           * actual pk.  */
 1180|  12.9k|          rc = check_signature_metadata_validity (pk, sig, r_expired, NULL);
 1181|  12.9k|          if (rc)
  ------------------
  |  Branch (1181:15): [True: 84, False: 12.8k]
  ------------------
 1182|     84|            return rc;
 1183|  12.8k|          if (sig->flags.valid)
  ------------------
  |  Branch (1183:15): [True: 12.7k, False: 33]
  ------------------
 1184|  12.7k|            {
 1185|  12.7k|              cache_stats.goodsig++;
 1186|  12.7k|              return 0;
 1187|  12.7k|            }
 1188|     33|          cache_stats.badsig++;
 1189|     33|          return gpg_error (GPG_ERR_BAD_SIGNATURE);
 1190|  12.8k|        }
 1191|  29.8k|    }
 1192|       |
 1193|  16.9k|  rc = openpgp_pk_test_algo(sig->pubkey_algo);
 1194|  16.9k|  if (rc)
  ------------------
  |  Branch (1194:7): [True: 819, False: 16.1k]
  ------------------
 1195|    819|    return rc;
 1196|  16.1k|  rc = openpgp_md_test_algo(algo);
 1197|  16.1k|  if (rc)
  ------------------
  |  Branch (1197:7): [True: 662, False: 15.5k]
  ------------------
 1198|    662|    return rc;
 1199|       |
 1200|  15.5k|  if (IS_KEY_REV (sig))
  ------------------
  |  |   45|  15.5k|#define IS_KEY_REV(s)    ((s)->sig_class == 0x20)
  |  |  ------------------
  |  |  |  Branch (45:26): [True: 1.25k, False: 14.2k]
  |  |  ------------------
  ------------------
 1201|  1.25k|    {
 1202|  1.25k|      u32 keyid[2];
 1203|  1.25k|      keyid_from_pk( pk, keyid );
 1204|       |
 1205|       |      /* Is it a designated revoker? */
 1206|  1.25k|      if (keyid[0] != sig->keyid[0] || keyid[1] != sig->keyid[1])
  ------------------
  |  Branch (1206:11): [True: 0, False: 1.25k]
  |  Branch (1206:40): [True: 0, False: 1.25k]
  ------------------
 1207|      0|        rc = check_revocation_keys (ctrl, pk, sig);
 1208|  1.25k|      else
 1209|  1.25k|        {
 1210|  1.25k|          rc = check_signature_metadata_validity (pk, sig,
 1211|  1.25k|                                                  r_expired, NULL);
 1212|  1.25k|          if (! rc)
  ------------------
  |  Branch (1212:15): [True: 1.03k, False: 219]
  ------------------
 1213|  1.03k|            rc = check_signature_over_key_or_uid (ctrl, pk, sig,
 1214|  1.03k|                                                  root, root->pkt,
 1215|  1.03k|                                                  is_selfsig, ret_pk);
 1216|  1.25k|        }
 1217|  1.25k|    }
 1218|  14.2k|  else if (IS_SUBKEY_REV (sig) || IS_SUBKEY_SIG (sig))
  ------------------
  |  |   47|  28.5k|#define IS_SUBKEY_REV(s) ((s)->sig_class == 0x28)
  |  |  ------------------
  |  |  |  Branch (47:26): [True: 525, False: 13.7k]
  |  |  ------------------
  ------------------
                else if (IS_SUBKEY_REV (sig) || IS_SUBKEY_SIG (sig))
  ------------------
  |  |   43|  13.7k|#define IS_SUBKEY_SIG(s) ((s)->sig_class == 0x18)
  |  |  ------------------
  |  |  |  Branch (43:26): [True: 1.43k, False: 12.2k]
  |  |  ------------------
  ------------------
 1219|  1.96k|    {
 1220|  1.96k|      kbnode_t snode = find_prev_kbnode (root, node, PKT_PUBLIC_SUBKEY);
 1221|       |
 1222|  1.96k|      if (snode)
  ------------------
  |  Branch (1222:11): [True: 1.61k, False: 344]
  ------------------
 1223|  1.61k|        {
 1224|  1.61k|          rc = check_signature_metadata_validity (pk, sig,
 1225|  1.61k|                                                  r_expired, NULL);
 1226|  1.61k|          if (! rc)
  ------------------
  |  Branch (1226:15): [True: 1.19k, False: 426]
  ------------------
 1227|  1.19k|            {
 1228|       |              /* A subkey revocation (0x28) must be a self-sig, but a
 1229|       |               * subkey signature (0x18) needn't be.  */
 1230|  1.19k|              rc = check_signature_over_key_or_uid (ctrl,
 1231|  1.19k|                                                    IS_SUBKEY_SIG (sig)
  ------------------
  |  |   43|  1.19k|#define IS_SUBKEY_SIG(s) ((s)->sig_class == 0x18)
  |  |  ------------------
  |  |  |  Branch (43:26): [True: 1.00k, False: 184]
  |  |  ------------------
  ------------------
 1232|  1.19k|                                                    ? NULL : pk,
 1233|  1.19k|                                                    sig, root, snode->pkt,
 1234|  1.19k|                                                    is_selfsig, ret_pk);
 1235|  1.19k|            }
 1236|  1.61k|        }
 1237|    344|      else
 1238|    344|        {
 1239|    344|          if (opt.verbose)
  ------------------
  |  Branch (1239:15): [True: 0, False: 344]
  ------------------
 1240|      0|            {
 1241|      0|              if (IS_SUBKEY_REV (sig))
  ------------------
  |  |   47|      0|#define IS_SUBKEY_REV(s) ((s)->sig_class == 0x28)
  |  |  ------------------
  |  |  |  Branch (47:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1242|      0|                log_info (_("key %s: no subkey for subkey"
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 1243|      0|                            " revocation signature\n"), keystr_from_pk(pk));
 1244|      0|              else if (sig->sig_class == 0x18)
  ------------------
  |  Branch (1244:24): [True: 0, False: 0]
  ------------------
 1245|      0|                log_info(_("key %s: no subkey for subkey"
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
 1246|      0|                           " binding signature\n"), keystr_from_pk(pk));
 1247|      0|            }
 1248|    344|          rc = GPG_ERR_SIG_CLASS;
 1249|    344|        }
 1250|  1.96k|    }
 1251|  12.2k|  else if (IS_KEY_SIG (sig)) /* direct key signature */
  ------------------
  |  |   40|  12.2k|#define IS_KEY_SIG(s)    ((s)->sig_class == 0x1f)
  |  |  ------------------
  |  |  |  Branch (40:26): [True: 1.96k, False: 10.3k]
  |  |  ------------------
  ------------------
 1252|  1.96k|      {
 1253|  1.96k|        rc = check_signature_metadata_validity (pk, sig,
 1254|  1.96k|                                                r_expired, NULL);
 1255|  1.96k|        if (! rc)
  ------------------
  |  Branch (1255:13): [True: 1.95k, False: 9]
  ------------------
 1256|  1.95k|          rc = check_signature_over_key_or_uid (ctrl, pk, sig, root, root->pkt,
 1257|  1.95k|                                                is_selfsig, ret_pk);
 1258|  1.96k|      }
 1259|  10.3k|    else if (IS_UID_SIG (sig) || IS_UID_REV (sig))
  ------------------
  |  |   41|  20.6k|#define IS_UID_SIG(s)    (((s)->sig_class & ~3) == 0x10)
  |  |  ------------------
  |  |  |  Branch (41:26): [True: 8.67k, False: 1.65k]
  |  |  ------------------
  ------------------
                  else if (IS_UID_SIG (sig) || IS_UID_REV (sig))
  ------------------
  |  |   46|  1.65k|#define IS_UID_REV(s)    ((s)->sig_class == 0x30)
  |  |  ------------------
  |  |  |  Branch (46:26): [True: 753, False: 901]
  |  |  ------------------
  ------------------
 1260|  9.42k|      {
 1261|  9.42k|	kbnode_t unode = find_prev_kbnode (root, node, PKT_USER_ID);
 1262|       |
 1263|  9.42k|	if (unode)
  ------------------
  |  Branch (1263:6): [True: 9.39k, False: 35]
  ------------------
 1264|  9.39k|          {
 1265|  9.39k|            rc = check_signature_metadata_validity (pk, sig, r_expired, NULL);
 1266|  9.39k|            if (! rc)
  ------------------
  |  Branch (1266:17): [True: 9.33k, False: 62]
  ------------------
 1267|  9.33k|              {
 1268|       |                /* If this is a self-sig, ignore check_pk.  */
 1269|  9.33k|                rc = check_signature_over_key_or_uid
 1270|  9.33k|                  (ctrl,
 1271|  9.33k|                   keyid_cmp (pk_keyid (pk), sig->keyid) == 0 ? pk : check_pk,
  ------------------
  |  Branch (1271:20): [True: 9.33k, False: 0]
  ------------------
 1272|  9.33k|                   sig, root, unode->pkt, NULL, ret_pk);
 1273|  9.33k|              }
 1274|  9.39k|          }
 1275|     35|	else
 1276|     35|	  {
 1277|     35|            if (!opt.quiet)
  ------------------
  |  Branch (1277:17): [True: 35, False: 0]
  ------------------
 1278|     35|	      log_info ("key %s: no user ID for key signature packet"
 1279|     35|			" of class %02x\n",keystr_from_pk(pk),sig->sig_class);
 1280|     35|	    rc = GPG_ERR_SIG_CLASS;
 1281|     35|	  }
 1282|  9.42k|      }
 1283|    901|  else
 1284|    901|    {
 1285|    901|      log_info ("sig issued by %s with class %d (digest: %02x %02x)"
 1286|    901|                " is not valid over a user id or a key id, ignoring.\n",
 1287|    901|                keystr (sig->keyid), sig->sig_class,
 1288|    901|                sig->digest_start[0], sig->digest_start[1]);
 1289|    901|      rc = gpg_error (GPG_ERR_BAD_SIGNATURE);
 1290|    901|    }
 1291|       |
 1292|  15.5k|  cache_sig_result  (sig, rc);
 1293|       |
 1294|  15.5k|  return rc;
 1295|  16.1k|}
sig-check.c:check_signature_end:
  483|  1.77k|{
  484|  1.77k|  int rc = 0;
  485|       |
  486|  1.77k|  if ((rc = check_signature_metadata_validity (pk, sig,
  ------------------
  |  Branch (486:7): [True: 90, False: 1.68k]
  ------------------
  487|  1.77k|                                               r_expired, r_revoked)))
  488|     90|    return rc;
  489|       |
  490|  1.68k|  if ((rc = check_signature_end_simple (pk, sig, digest,
  ------------------
  |  Branch (490:7): [True: 1.68k, False: 0]
  ------------------
  491|  1.68k|                                        extrahash, extrahashlen)))
  492|  1.68k|    return rc;
  493|       |
  494|      0|  if (!rc && ret_pk)
  ------------------
  |  Branch (494:7): [True: 0, False: 0]
  |  Branch (494:14): [True: 0, False: 0]
  ------------------
  495|      0|    copy_public_key(ret_pk,pk);
  496|       |
  497|      0|  return rc;
  498|  1.68k|}
sig-check.c:cache_sig_result:
  692|  17.2k|{
  693|  17.2k|  if (!result)
  ------------------
  |  Branch (693:7): [True: 1.02k, False: 16.2k]
  ------------------
  694|  1.02k|    {
  695|  1.02k|      sig->flags.checked = 1;
  696|  1.02k|      sig->flags.valid = 1;
  697|  1.02k|    }
  698|  16.2k|  else if  (gpg_err_code (result) == GPG_ERR_BAD_SIGNATURE)
  ------------------
  |  Branch (698:13): [True: 11.6k, False: 4.57k]
  ------------------
  699|  11.6k|    {
  700|  11.6k|      sig->flags.checked = 1;
  701|  11.6k|      sig->flags.valid = 0;
  702|  11.6k|    }
  703|  4.57k|  else
  704|  4.57k|    {
  705|  4.57k|      sig->flags.checked = 0;
  706|  4.57k|      sig->flags.valid = 0;
  707|  4.57k|    }
  708|  17.2k|}
sig-check.c:check_signature_end_simple:
  508|  15.1k|{
  509|  15.1k|  gcry_mpi_t result = NULL;
  510|  15.1k|  int rc = 0;
  511|       |
  512|  15.1k|  if (!opt.flags.allow_weak_digest_algos)
  ------------------
  |  Branch (512:7): [True: 15.1k, False: 0]
  ------------------
  513|  15.1k|    {
  514|  15.1k|      if (is_weak_digest (sig->digest_algo))
  ------------------
  |  Branch (514:11): [True: 0, False: 15.1k]
  ------------------
  515|      0|        {
  516|      0|          print_digest_rejected_note (sig->digest_algo);
  517|      0|          return GPG_ERR_DIGEST_ALGO;
  518|      0|        }
  519|  15.1k|    }
  520|       |
  521|       |  /* For key signatures check that the key has a cert usage.  We may
  522|       |   * do this only for subkeys because the primary may always issue key
  523|       |   * signature.  The latter may not be reflected in the pubkey_usage
  524|       |   * field because we need to check the key signatures to extract the
  525|       |   * key usage.  */
  526|  15.1k|  if (!pk->flags.primary
  ------------------
  |  Branch (526:7): [True: 1.68k, False: 13.5k]
  ------------------
  527|  15.1k|      && IS_CERT (sig) && !(pk->pubkey_usage & PUBKEY_USAGE_CERT))
  ------------------
  |  |   32|  16.8k|#define IS_CERT(s)       (IS_KEY_SIG(s)       \
  |  |  ------------------
  |  |  |  |   40|  3.36k|#define IS_KEY_SIG(s)    ((s)->sig_class == 0x1f)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (40:26): [True: 0, False: 1.68k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   33|  1.68k|                          || IS_UID_SIG(s)    \
  |  |  ------------------
  |  |  |  |   41|  3.36k|#define IS_UID_SIG(s)    (((s)->sig_class & ~3) == 0x10)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (41:26): [True: 0, False: 1.68k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   34|  1.68k|                          || IS_SUBKEY_SIG(s) \
  |  |  ------------------
  |  |  |  |   43|  3.36k|#define IS_SUBKEY_SIG(s) ((s)->sig_class == 0x18)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (43:26): [True: 0, False: 1.68k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   35|  1.68k|                          || IS_KEY_REV(s)    \
  |  |  ------------------
  |  |  |  |   45|  3.36k|#define IS_KEY_REV(s)    ((s)->sig_class == 0x20)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (45:26): [True: 0, False: 1.68k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   36|  1.68k|                          || IS_UID_REV(s)    \
  |  |  ------------------
  |  |  |  |   46|  3.36k|#define IS_UID_REV(s)    ((s)->sig_class == 0x30)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (46:26): [True: 0, False: 1.68k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   37|  1.68k|                          || IS_SUBKEY_REV(s) \
  |  |  ------------------
  |  |  |  |   47|  3.36k|#define IS_SUBKEY_REV(s) ((s)->sig_class == 0x28)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (47:26): [True: 0, False: 1.68k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   38|  16.8k|                          || IS_ATTST_SIGS(s) )
  |  |  ------------------
  |  |  |  |   42|  1.68k|#define IS_ATTST_SIGS(s) ((s)->sig_class == 0x16)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (42:26): [True: 0, False: 1.68k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                    && IS_CERT (sig) && !(pk->pubkey_usage & PUBKEY_USAGE_CERT))
  ------------------
  |  |   51|      0|#define PUBKEY_USAGE_CERT    GCRY_PK_USAGE_CERT  /* Also good to certify keys.*/
  ------------------
  |  Branch (527:27): [True: 0, False: 0]
  ------------------
  528|      0|    {
  529|      0|      rc = gpg_error (GPG_ERR_WRONG_KEY_USAGE);
  530|      0|      if (!opt.quiet)
  ------------------
  |  Branch (530:11): [True: 0, False: 0]
  ------------------
  531|      0|        log_info (_("bad key signature from key %s: %s (0x%02x, 0x%x)\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  532|      0|                  keystr_from_pk (pk), gpg_strerror (rc),
  533|      0|                  sig->sig_class, pk->pubkey_usage);
  534|      0|      return rc;
  535|      0|    }
  536|       |
  537|       |  /* For data signatures check that the key has sign usage.  */
  538|  15.1k|  if (!IS_BACK_SIG (sig) && IS_SIG (sig)
  ------------------
  |  |   44|  30.3k|#define IS_BACK_SIG(s)   ((s)->sig_class == 0x19)
  ------------------
                if (!IS_BACK_SIG (sig) && IS_SIG (sig)
  ------------------
  |  |   39|  28.6k|#define IS_SIG(s)        (!IS_CERT(s))
  |  |  ------------------
  |  |  |  |   32|  13.5k|#define IS_CERT(s)       (IS_KEY_SIG(s)       \
  |  |  |  |  ------------------
  |  |  |  |  |  |   40|  27.0k|#define IS_KEY_SIG(s)    ((s)->sig_class == 0x1f)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (40:26): [True: 1.95k, False: 11.5k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   33|  13.5k|                          || IS_UID_SIG(s)    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   41|  25.0k|#define IS_UID_SIG(s)    (((s)->sig_class & ~3) == 0x10)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (41:26): [True: 8.64k, False: 2.91k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   34|  13.5k|                          || IS_SUBKEY_SIG(s) \
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  16.4k|#define IS_SUBKEY_SIG(s) ((s)->sig_class == 0x18)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (43:26): [True: 1.00k, False: 1.90k]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   35|  13.5k|                          || IS_KEY_REV(s)    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   45|  15.4k|#define IS_KEY_REV(s)    ((s)->sig_class == 0x20)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (45:26): [True: 1.03k, False: 872]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   36|  13.5k|                          || IS_UID_REV(s)    \
  |  |  |  |  ------------------
  |  |  |  |  |  |   46|  14.3k|#define IS_UID_REV(s)    ((s)->sig_class == 0x30)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (46:26): [True: 688, False: 184]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   37|  13.5k|                          || IS_SUBKEY_REV(s) \
  |  |  |  |  ------------------
  |  |  |  |  |  |   47|  13.6k|#define IS_SUBKEY_REV(s) ((s)->sig_class == 0x28)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (47:26): [True: 184, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |   38|  13.5k|                          || IS_ATTST_SIGS(s) )
  |  |  |  |  ------------------
  |  |  |  |  |  |   42|      0|#define IS_ATTST_SIGS(s) ((s)->sig_class == 0x16)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (42:26): [True: 0, False: 0]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (538:7): [True: 13.5k, False: 1.68k]
  ------------------
  539|  15.1k|      && !(pk->pubkey_usage & PUBKEY_USAGE_SIG))
  ------------------
  |  |   49|      0|#define PUBKEY_USAGE_SIG     GCRY_PK_USAGE_SIGN  /* Good for signatures. */
  ------------------
  |  Branch (539:10): [True: 0, False: 0]
  ------------------
  540|      0|    {
  541|      0|      rc = gpg_error (GPG_ERR_WRONG_KEY_USAGE);
  542|      0|      if (!opt.quiet)
  ------------------
  |  Branch (542:11): [True: 0, False: 0]
  ------------------
  543|      0|        log_info (_("bad data signature from key %s: %s (0x%02x, 0x%x)\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  544|      0|                  keystr_from_pk (pk), gpg_strerror (rc),
  545|      0|                  sig->sig_class, pk->pubkey_usage);
  546|      0|      return rc;
  547|      0|    }
  548|       |
  549|       |  /* Make sure the digest algo is enabled (in case of a detached
  550|       |   * signature).  */
  551|  15.1k|  gcry_md_enable (digest, sig->digest_algo);
  552|       |
  553|       |  /* Complete the digest. */
  554|  15.1k|  if (sig->version >= 4)
  ------------------
  |  Branch (554:7): [True: 12.3k, False: 2.81k]
  ------------------
  555|  12.3k|    gcry_md_putc (digest, sig->version);
  556|       |
  557|  15.1k|  gcry_md_putc( digest, sig->sig_class );
  558|  15.1k|  if (sig->version < 4)
  ------------------
  |  Branch (558:7): [True: 2.81k, False: 12.3k]
  ------------------
  559|  2.81k|    {
  560|  2.81k|      u32 a = sig->timestamp;
  561|  2.81k|      gcry_md_putc (digest, ((a >> 24) & 0xff));
  562|  2.81k|      gcry_md_putc (digest, ((a >> 16) & 0xff));
  563|  2.81k|      gcry_md_putc (digest, ((a >>  8) & 0xff));
  564|  2.81k|      gcry_md_putc (digest, ( a        & 0xff));
  565|  2.81k|    }
  566|  12.3k|  else
  567|  12.3k|    {
  568|  12.3k|      byte buf[10];
  569|  12.3k|      int i;
  570|  12.3k|      size_t n;
  571|       |
  572|  12.3k|      gcry_md_putc (digest, sig->pubkey_algo);
  573|  12.3k|      gcry_md_putc (digest, sig->digest_algo);
  574|  12.3k|      if (sig->hashed)
  ------------------
  |  Branch (574:11): [True: 12.3k, False: 0]
  ------------------
  575|  12.3k|        {
  576|  12.3k|          n = sig->hashed->len;
  577|  12.3k|          gcry_md_putc (digest, (n >> 8) );
  578|  12.3k|          gcry_md_putc (digest,  n       );
  579|  12.3k|          gcry_md_write (digest, sig->hashed->data, n);
  580|  12.3k|          n += 6;
  581|  12.3k|	}
  582|      0|      else
  583|      0|        {
  584|       |	  /* Two octets for the (empty) length of the hashed
  585|       |           * section. */
  586|      0|          gcry_md_putc (digest, 0);
  587|      0|	  gcry_md_putc (digest, 0);
  588|      0|	  n = 6;
  589|      0|	}
  590|       |      /* Hash data from the literal data packet.  */
  591|  12.3k|      if (sig->version >= 5
  ------------------
  |  Branch (591:11): [True: 1.16k, False: 11.2k]
  ------------------
  592|  12.3k|          && (sig->sig_class == 0x00 || sig->sig_class == 0x01))
  ------------------
  |  Branch (592:15): [True: 0, False: 1.16k]
  |  Branch (592:41): [True: 0, False: 1.16k]
  ------------------
  593|      0|        {
  594|       |          /* - One octet content format
  595|       |           * - File name (one octet length followed by the name)
  596|       |           * - Four octet timestamp */
  597|      0|          if (extrahash && extrahashlen)
  ------------------
  |  Branch (597:15): [True: 0, False: 0]
  |  Branch (597:28): [True: 0, False: 0]
  ------------------
  598|      0|            gcry_md_write (digest, extrahash, extrahashlen);
  599|      0|          else /* Detached signature. */
  600|      0|            {
  601|      0|              memset (buf, 0, 6);
  602|      0|              gcry_md_write (digest, buf, 6);
  603|      0|            }
  604|      0|        }
  605|       |      /* Add some magic per Section 5.2.4 of RFC 4880.  */
  606|  12.3k|      i = 0;
  607|  12.3k|      buf[i++] = sig->version;
  608|  12.3k|      buf[i++] = 0xff;
  609|  12.3k|      if (sig->version >= 5)
  ------------------
  |  Branch (609:11): [True: 1.16k, False: 11.2k]
  ------------------
  610|  1.16k|        {
  611|  1.16k|#if SIZEOF_SIZE_T > 4
  612|  1.16k|          buf[i++] = n >> 56;
  613|  1.16k|          buf[i++] = n >> 48;
  614|  1.16k|          buf[i++] = n >> 40;
  615|  1.16k|          buf[i++] = n >> 32;
  616|       |#else
  617|       |          buf[i++] = 0;
  618|       |          buf[i++] = 0;
  619|       |          buf[i++] = 0;
  620|       |          buf[i++] = 0;
  621|       |#endif
  622|  1.16k|        }
  623|  12.3k|      buf[i++] = n >> 24;
  624|  12.3k|      buf[i++] = n >> 16;
  625|  12.3k|      buf[i++] = n >>  8;
  626|  12.3k|      buf[i++] = n;
  627|  12.3k|      gcry_md_write (digest, buf, i);
  628|  12.3k|    }
  629|  15.1k|    gcry_md_final( digest );
  630|       |
  631|       |    /* Convert the digest to an MPI.  */
  632|  15.1k|    result = encode_md_value (pk, digest, sig->digest_algo );
  633|  15.1k|    if (!result)
  ------------------
  |  Branch (633:9): [True: 3.02k, False: 12.1k]
  ------------------
  634|  3.02k|        return GPG_ERR_GENERAL;
  635|       |
  636|       |    /* Verify the signature.  */
  637|  12.1k|    if (DBG_CLOCK && sig->sig_class <= 0x01)
  ------------------
  |  |  356|  24.3k|#define DBG_CLOCK   (opt.debug & DBG_CLOCK_VALUE)
  |  |  ------------------
  |  |  |  |  343|  12.1k|#define DBG_CLOCK_VALUE   4096
  |  |  ------------------
  |  |  |  Branch (356:21): [True: 0, False: 12.1k]
  |  |  ------------------
  ------------------
  |  Branch (637:22): [True: 0, False: 0]
  ------------------
  638|      0|      log_clock ("enter pk_verify");
  639|  12.1k|    rc = pk_verify( pk->pubkey_algo, result, sig->data, pk->pkey );
  640|  12.1k|    if (DBG_CLOCK && sig->sig_class <= 0x01)
  ------------------
  |  |  356|  24.3k|#define DBG_CLOCK   (opt.debug & DBG_CLOCK_VALUE)
  |  |  ------------------
  |  |  |  |  343|  12.1k|#define DBG_CLOCK_VALUE   4096
  |  |  ------------------
  |  |  |  Branch (356:21): [True: 0, False: 12.1k]
  |  |  ------------------
  ------------------
  |  Branch (640:22): [True: 0, False: 0]
  ------------------
  641|      0|      log_clock ("leave pk_verify");
  642|  12.1k|    gcry_mpi_release (result);
  643|       |
  644|  12.1k|  if (!rc && sig->flags.unknown_critical)
  ------------------
  |  Branch (644:7): [True: 1.04k, False: 11.1k]
  |  Branch (644:14): [True: 21, False: 1.02k]
  ------------------
  645|     21|    {
  646|     21|      log_info(_("assuming bad signature from key %s"
  ------------------
  |  |   28|     21|#  define _(a) gettext (a)
  ------------------
  647|     21|                 " due to an unknown critical bit\n"),keystr_from_pk(pk));
  648|     21|      rc = GPG_ERR_BAD_SIGNATURE;
  649|     21|    }
  650|       |
  651|  12.1k|  return rc;
  652|  15.1k|}
sig-check.c:hash_uid_packet:
  659|  9.33k|{
  660|  9.33k|  if (uid->attrib_data)
  ------------------
  |  Branch (660:7): [True: 588, False: 8.74k]
  ------------------
  661|    588|    {
  662|    588|      if (sig->version >= 4)
  ------------------
  |  Branch (662:11): [True: 367, False: 221]
  ------------------
  663|    367|        {
  664|    367|          byte buf[5];
  665|    367|          buf[0] = 0xd1;		   /* packet of type 17 */
  666|    367|          buf[1] = uid->attrib_len >> 24;  /* always use 4 length bytes */
  667|    367|          buf[2] = uid->attrib_len >> 16;
  668|    367|          buf[3] = uid->attrib_len >>  8;
  669|    367|          buf[4] = uid->attrib_len;
  670|    367|          gcry_md_write( md, buf, 5 );
  671|    367|	}
  672|    588|      gcry_md_write( md, uid->attrib_data, uid->attrib_len );
  673|    588|    }
  674|  8.74k|  else
  675|  8.74k|    {
  676|  8.74k|      if (sig->version >= 4)
  ------------------
  |  Branch (676:11): [True: 8.11k, False: 632]
  ------------------
  677|  8.11k|        {
  678|  8.11k|          byte buf[5];
  679|  8.11k|          buf[0] = 0xb4;	      /* indicates a userid packet */
  680|  8.11k|          buf[1] = uid->len >> 24;    /* always use 4 length bytes */
  681|  8.11k|          buf[2] = uid->len >> 16;
  682|  8.11k|          buf[3] = uid->len >>  8;
  683|  8.11k|          buf[4] = uid->len;
  684|  8.11k|          gcry_md_write( md, buf, 5 );
  685|  8.11k|	}
  686|  8.74k|      gcry_md_write( md, uid->name, uid->len );
  687|  8.74k|    }
  688|  9.33k|}
sig-check.c:check_signature_metadata_validity:
  365|  28.9k|{
  366|  28.9k|  u32 cur_time;
  367|       |
  368|  28.9k|  if (r_expired)
  ------------------
  |  Branch (368:7): [True: 0, False: 28.9k]
  ------------------
  369|      0|    *r_expired = 0;
  370|  28.9k|  if (r_revoked)
  ------------------
  |  Branch (370:7): [True: 0, False: 28.9k]
  ------------------
  371|      0|    *r_revoked = 0;
  372|       |
  373|  28.9k|  if (pk->timestamp > sig->timestamp )
  ------------------
  |  Branch (373:7): [True: 827, False: 28.0k]
  ------------------
  374|    827|    {
  375|    827|      ulong d = pk->timestamp - sig->timestamp;
  376|    827|      if ( d < 86400 )
  ------------------
  |  Branch (376:12): [True: 213, False: 614]
  ------------------
  377|    213|        {
  378|    213|          log_info (ngettext
  379|    213|                    ("public key %s is %lu second newer than the signature\n",
  380|    213|                     "public key %s is %lu seconds newer than the signature\n",
  381|    213|                     d), keystr_from_pk (pk), d);
  382|    213|        }
  383|    614|      else
  384|    614|        {
  385|    614|          d /= 86400;
  386|    614|          log_info (ngettext
  387|    614|                    ("public key %s is %lu day newer than the signature\n",
  388|    614|                     "public key %s is %lu days newer than the signature\n",
  389|    614|                     d), keystr_from_pk (pk), d);
  390|    614|        }
  391|    827|      if (!opt.ignore_time_conflict)
  ------------------
  |  Branch (391:11): [True: 827, False: 0]
  ------------------
  392|    827|        return GPG_ERR_TIME_CONFLICT; /* pubkey newer than signature.  */
  393|    827|    }
  394|       |
  395|  28.0k|  cur_time = make_timestamp ();
  396|  28.0k|  if (pk->timestamp > cur_time)
  ------------------
  |  Branch (396:7): [True: 63, False: 28.0k]
  ------------------
  397|     63|    {
  398|     63|      ulong d = pk->timestamp - cur_time;
  399|     63|      if (d < 86400)
  ------------------
  |  Branch (399:11): [True: 0, False: 63]
  ------------------
  400|      0|        {
  401|      0|          log_info (ngettext("key %s was created %lu second"
  402|      0|                             " in the future (time warp or clock problem)\n",
  403|      0|                             "key %s was created %lu seconds"
  404|      0|                             " in the future (time warp or clock problem)\n",
  405|      0|                             d), keystr_from_pk (pk), d);
  406|      0|        }
  407|     63|      else
  408|     63|        {
  409|     63|          d /= 86400;
  410|     63|          log_info (ngettext("key %s was created %lu day"
  411|     63|                             " in the future (time warp or clock problem)\n",
  412|     63|                             "key %s was created %lu days"
  413|     63|                             " in the future (time warp or clock problem)\n",
  414|     63|                             d), keystr_from_pk (pk), d);
  415|     63|        }
  416|     63|      if (!opt.ignore_time_conflict)
  ------------------
  |  Branch (416:11): [True: 63, False: 0]
  ------------------
  417|     63|        return GPG_ERR_TIME_CONFLICT;
  418|     63|    }
  419|       |
  420|       |  /* Check whether the key has expired.  We check the has_expired
  421|       |   * flag which is set after a full evaluation of the key (getkey.c)
  422|       |   * as well as a simple compare to the current time in case the
  423|       |   * merge has for whatever reasons not been done.  */
  424|  28.0k|  if (pk->has_expired || (pk->expiredate && pk->expiredate < cur_time))
  ------------------
  |  Branch (424:7): [True: 1.15k, False: 26.8k]
  |  Branch (424:27): [True: 317, False: 26.5k]
  |  Branch (424:45): [True: 0, False: 317]
  ------------------
  425|  1.15k|    {
  426|  1.15k|      char buf[11];
  427|  1.15k|      if (opt.verbose)
  ------------------
  |  Branch (427:11): [True: 0, False: 1.15k]
  ------------------
  428|      0|        log_info (_("Note: signature key %s expired %s\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  429|      0|                  keystr_from_pk(pk), isotimestamp( pk->expiredate ) );
  430|  1.15k|      snprintf (buf, sizeof buf, "%lu",(ulong)pk->expiredate);
  ------------------
  |  |   84|  1.15k|#define snprintf gpgrt_snprintf
  ------------------
  431|  1.15k|      write_status_text (STATUS_KEYEXPIRED, buf);
  432|  1.15k|      if (r_expired)
  ------------------
  |  Branch (432:11): [True: 0, False: 1.15k]
  ------------------
  433|      0|        *r_expired = 1;
  434|  1.15k|    }
  435|       |
  436|  28.0k|  if (pk->flags.revoked)
  ------------------
  |  Branch (436:7): [True: 0, False: 28.0k]
  ------------------
  437|      0|    {
  438|      0|      if (opt.verbose)
  ------------------
  |  Branch (438:11): [True: 0, False: 0]
  ------------------
  439|      0|        log_info (_("Note: signature key %s has been revoked\n"),
  ------------------
  |  |   28|      0|#  define _(a) gettext (a)
  ------------------
  440|      0|                  keystr_from_pk(pk));
  441|      0|      if (r_revoked)
  ------------------
  |  Branch (441:11): [True: 0, False: 0]
  ------------------
  442|      0|        *r_revoked=1;
  443|      0|    }
  444|       |
  445|  28.0k|  return 0;
  446|  28.0k|}

release_sk_list:
   48|  3.53k|{
   49|  3.53k|  SK_LIST sk_rover;
   50|       |
   51|  3.53k|  for (; sk_list; sk_list = sk_rover)
  ------------------
  |  Branch (51:10): [True: 0, False: 3.53k]
  ------------------
   52|      0|    {
   53|      0|      sk_rover = sk_list->next;
   54|      0|      free_public_key (sk_list->pk);
   55|      0|      xfree (sk_list);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
   56|      0|    }
   57|  3.53k|}
enum_secret_keys:
  323|  7.07k|{
  324|  7.07k|  gpg_error_t err = 0;
  325|  7.07k|  const char *name;
  326|  7.07k|  int cardkey;
  327|  7.07k|  kbnode_t keyblock;
  328|  7.07k|  struct
  329|  7.07k|  {
  330|  7.07k|    int eof;
  331|  7.07k|    int state;
  332|  7.07k|    int cardkey_done;
  333|  7.07k|    strlist_t sl;
  334|  7.07k|    keypair_info_t card_keyinfo;
  335|  7.07k|    keypair_info_t card_keyinfo_list;
  336|  7.07k|    char fpr2[2 * MAX_FINGERPRINT_LEN + 2 ];
  337|  7.07k|    kbnode_t keyblock;
  338|  7.07k|    kbnode_t node;
  339|  7.07k|    getkey_ctx_t ctx;
  340|  7.07k|    SK_LIST results;
  341|  7.07k|  } *c = *context;
  342|       |
  343|       |#if MAX_FINGERPRINT_LEN < KEYGRIP_LEN
  344|       |# error buffer too short for this configuration
  345|       |#endif
  346|       |
  347|  7.07k|  if (!c)
  ------------------
  |  Branch (347:7): [True: 3.53k, False: 3.53k]
  ------------------
  348|  3.53k|    {
  349|       |      /* Make a new context.  */
  350|  3.53k|      c = xtrycalloc (1, sizeof *c);
  ------------------
  |  |   99|  3.53k|#define xtrycalloc(a,b)  gcry_calloc ((a),(b))
  ------------------
  351|  3.53k|      if (!c)
  ------------------
  |  Branch (351:11): [True: 0, False: 3.53k]
  ------------------
  352|      0|        {
  353|      0|          err = gpg_error_from_syserror ();
  354|      0|          free_public_key (sk);
  355|      0|          return err;
  356|      0|        }
  357|  3.53k|      *context = c;
  358|  3.53k|    }
  359|       |
  360|  7.07k|  if (!sk)
  ------------------
  |  Branch (360:7): [True: 3.53k, False: 3.53k]
  ------------------
  361|  3.53k|    {
  362|       |      /* Free the context.  */
  363|  3.53k|      free_keypair_info (c->card_keyinfo_list);
  364|  3.53k|      release_sk_list (c->results);
  365|  3.53k|      release_kbnode (c->keyblock);
  366|  3.53k|      getkey_end (ctrl, c->ctx);
  367|  3.53k|      xfree (c);
  ------------------
  |  |  104|  3.53k|#define xfree(a)         gcry_free ((a))
  ------------------
  368|  3.53k|      *context = NULL;
  369|  3.53k|      return 0;
  370|  3.53k|    }
  371|       |
  372|  3.53k|  if (c->eof)
  ------------------
  |  Branch (372:7): [True: 0, False: 3.53k]
  ------------------
  373|      0|    {
  374|      0|      free_public_key (sk);
  375|      0|      return gpg_error (GPG_ERR_EOF);
  376|      0|    }
  377|       |
  378|  3.53k|  for (;;)
  379|  3.53k|    {
  380|       |      /* Loop until we have a keyblock.  */
  381|  3.53k|      while (!c->keyblock)
  ------------------
  |  Branch (381:14): [True: 3.53k, False: 0]
  ------------------
  382|  3.53k|        {
  383|       |          /* Loop over the list of secret keys.  */
  384|  3.53k|          do
  385|  28.2k|            {
  386|  28.2k|              name = NULL;
  387|  28.2k|              cardkey = 0;
  388|  28.2k|              keyblock = NULL;
  389|  28.2k|              switch (c->state)
  390|  28.2k|                {
  391|  3.53k|                case 0: /* First try to use the --default-key.  */
  ------------------
  |  Branch (391:17): [True: 3.53k, False: 24.7k]
  ------------------
  392|  3.53k|                  name = parse_def_secret_key (ctrl);
  393|  3.53k|                  c->state = 1;
  394|  3.53k|                  break;
  395|       |
  396|  3.53k|                case 1: /* Init list of keys to try.  */
  ------------------
  |  Branch (396:17): [True: 3.53k, False: 24.7k]
  ------------------
  397|  3.53k|                  c->sl = opt.secret_keys_to_try;
  398|  3.53k|                  c->state++;
  399|  3.53k|                  break;
  400|       |
  401|  3.53k|                case 2: /* Get next item from list.  */
  ------------------
  |  Branch (401:17): [True: 3.53k, False: 24.7k]
  ------------------
  402|  3.53k|                  if (c->sl)
  ------------------
  |  Branch (402:23): [True: 0, False: 3.53k]
  ------------------
  403|      0|                    {
  404|      0|                      name = c->sl->d;
  405|      0|                      c->sl = c->sl->next;
  406|      0|                    }
  407|  3.53k|                  else
  408|  3.53k|                    c->state++;
  409|  3.53k|                  break;
  410|       |
  411|  3.53k|                case 3: /* Init list of card keys to try.  */
  ------------------
  |  Branch (411:17): [True: 3.53k, False: 24.7k]
  ------------------
  412|  3.53k|                  c->card_keyinfo_list = NULL;
  413|  3.53k|                  err = agent_scd_serialno (NULL, NULL);
  414|  3.53k|                  if (!err)
  ------------------
  |  Branch (414:23): [True: 0, False: 3.53k]
  ------------------
  415|      0|                    {
  416|      0|                      err = agent_scd_keyinfo (NULL, GCRY_PK_USAGE_ENCR,
  417|      0|                                               &c->card_keyinfo_list);
  418|      0|                    }
  419|  3.53k|                  c->card_keyinfo = c->card_keyinfo_list;
  420|  3.53k|                  c->state++;
  421|  3.53k|                  break;
  422|       |
  423|  3.53k|                case 4: /* Get next item from card keyinfo.  */
  ------------------
  |  Branch (423:17): [True: 3.53k, False: 24.7k]
  ------------------
  424|  3.53k|                  if (c->card_keyinfo)
  ------------------
  |  Branch (424:23): [True: 0, False: 3.53k]
  ------------------
  425|      0|                    {
  426|      0|                      const char *s;
  427|      0|                      int i;
  428|       |
  429|       |                      /* Get the key using the keygrip.  */
  430|      0|                      c->fpr2[0] = '&';
  431|      0|                      for (i=1, s = c->card_keyinfo->keygrip;
  432|      0|                           (*s && *s != ' '
  ------------------
  |  Branch (432:29): [True: 0, False: 0]
  |  Branch (432:35): [True: 0, False: 0]
  ------------------
  433|      0|                            && i < sizeof c->fpr2 - 2);
  ------------------
  |  Branch (433:32): [True: 0, False: 0]
  ------------------
  434|      0|                           s++, i++)
  435|      0|                        c->fpr2[i] = *s;
  436|      0|                      c->fpr2[i] = 0;
  437|      0|                      name = c->fpr2;
  438|      0|                      cardkey = 1;
  439|       |
  440|      0|                      c->card_keyinfo = c->card_keyinfo->next;
  441|      0|                    }
  442|  3.53k|                  else
  443|  3.53k|                    c->state++;
  444|  3.53k|                  break;
  445|       |
  446|  3.53k|                case 5: /* Init search context to enum all secret keys.  */
  ------------------
  |  Branch (446:17): [True: 3.53k, False: 24.7k]
  ------------------
  447|  3.53k|                  err = getkey_bynames (ctrl, &c->ctx, NULL, NULL, 1,
  448|  3.53k|                                        &keyblock);
  449|  3.53k|                  if (err)
  ------------------
  |  Branch (449:23): [True: 3.53k, False: 0]
  ------------------
  450|  3.53k|                    {
  451|  3.53k|                      release_kbnode (keyblock);
  452|  3.53k|                      keyblock = NULL;
  453|  3.53k|                      getkey_end (ctrl, c->ctx);
  454|  3.53k|                      c->ctx = NULL;
  455|  3.53k|                    }
  456|  3.53k|                  c->state++;
  457|  3.53k|                  break;
  458|       |
  459|  3.53k|                case 6: /* Get next item from the context.  */
  ------------------
  |  Branch (459:17): [True: 3.53k, False: 24.7k]
  ------------------
  460|  3.53k|                  if (c->ctx)
  ------------------
  |  Branch (460:23): [True: 0, False: 3.53k]
  ------------------
  461|      0|                    {
  462|      0|                      err = getkey_next (ctrl, c->ctx, NULL, &keyblock);
  463|      0|                      if (err)
  ------------------
  |  Branch (463:27): [True: 0, False: 0]
  ------------------
  464|      0|                        {
  465|      0|                          release_kbnode (keyblock);
  466|      0|                          keyblock = NULL;
  467|      0|                          getkey_end (ctrl, c->ctx);
  468|      0|                          c->ctx = NULL;
  469|      0|                        }
  470|      0|                    }
  471|  3.53k|                  else
  472|  3.53k|                    c->state++;
  473|  3.53k|                  break;
  474|       |
  475|  3.53k|                default: /* No more names to check - stop.  */
  ------------------
  |  Branch (475:17): [True: 3.53k, False: 24.7k]
  ------------------
  476|  3.53k|                  c->eof = 1;
  477|  3.53k|                  free_public_key (sk);
  478|  3.53k|                  return gpg_error (GPG_ERR_EOF);
  479|  28.2k|                }
  480|  28.2k|            }
  481|  24.7k|          while ((!name || !*name) && !keyblock);
  ------------------
  |  Branch (481:19): [True: 24.7k, False: 0]
  |  Branch (481:28): [True: 0, False: 0]
  |  Branch (481:39): [True: 24.7k, False: 0]
  ------------------
  482|       |
  483|      0|          if (keyblock)
  ------------------
  |  Branch (483:15): [True: 0, False: 0]
  ------------------
  484|      0|            c->node = c->keyblock = keyblock;
  485|      0|          else
  486|      0|            {
  487|      0|              err = getkey_byname (ctrl, NULL, NULL, name, 1, &c->keyblock);
  488|      0|              if (err)
  ------------------
  |  Branch (488:19): [True: 0, False: 0]
  ------------------
  489|      0|                {
  490|      0|                  struct agent_card_info_s cinfo = { 0 };
  491|       |
  492|       |                  /* getkey_byname might return a keyblock even in the
  493|       |                     error case - I have not checked.  Thus better release
  494|       |                     it.  */
  495|      0|                  release_kbnode (c->keyblock);
  496|      0|                  c->keyblock = NULL;
  497|       |                  /* If this was a card key we might not yet have the
  498|       |                   * public key for it.  Thus check whether the card
  499|       |                   * can return the fingerprint of the encryption key
  500|       |                   * and we can then find the public key via LDAP.  */
  501|      0|                  if (cardkey && !c->cardkey_done
  ------------------
  |  Branch (501:23): [True: 0, False: 0]
  |  Branch (501:34): [True: 0, False: 0]
  ------------------
  502|      0|                      && gpg_err_code (err) == GPG_ERR_NO_SECKEY
  ------------------
  |  Branch (502:26): [True: 0, False: 0]
  ------------------
  503|      0|                      && !agent_scd_getattr ("KEY-FPR", &cinfo)
  ------------------
  |  Branch (503:26): [True: 0, False: 0]
  ------------------
  504|      0|                      && cinfo.fpr2len)
  ------------------
  |  Branch (504:26): [True: 0, False: 0]
  ------------------
  505|      0|                    {
  506|       |                      /* Note that this code does not handle the case
  507|       |                       * for two readers having both openpgp
  508|       |                       * encryption keys. only one will be tried.  */
  509|      0|                      c->cardkey_done = 1;
  510|      0|                      if (opt.debug)
  ------------------
  |  Branch (510:27): [True: 0, False: 0]
  ------------------
  511|      0|                        log_debug ("using LDAP to find public key"
  512|      0|                                   " for current card\n");
  513|      0|                      if (!keyserver_import_fprint
  ------------------
  |  Branch (513:27): [True: 0, False: 0]
  ------------------
  514|      0|                          (ctrl, cinfo.fpr2, cinfo.fpr2len, opt.keyserver,
  515|      0|                           KEYSERVER_IMPORT_FLAG_LDAP))
  ------------------
  |  |   29|      0|#define KEYSERVER_IMPORT_FLAG_LDAP  2
  ------------------
  516|      0|                        {
  517|      0|                          char fpr_string[MAX_FINGERPRINT_LEN * 2 + 1];
  518|       |
  519|      0|                          bin2hex (cinfo.fpr2, cinfo.fpr2len, fpr_string);
  520|      0|                          err = getkey_byname (ctrl, NULL, NULL, fpr_string, 1,
  521|      0|                                               &c->keyblock);
  522|      0|                          if (err)
  ------------------
  |  Branch (522:31): [True: 0, False: 0]
  ------------------
  523|      0|                            {
  524|      0|                              release_kbnode (c->keyblock);
  525|      0|                              c->keyblock = NULL;
  526|      0|                            }
  527|      0|                          else
  528|      0|                            c->node = c->keyblock;
  529|      0|                        }
  530|      0|                    }
  531|      0|                }
  532|      0|              else
  533|      0|                c->node = c->keyblock;
  534|      0|            }
  535|      0|        }
  536|       |
  537|       |      /* Get the next key from the current keyblock.  */
  538|      0|      for (; c->node; c->node = c->node->next)
  ------------------
  |  Branch (538:14): [True: 0, False: 0]
  ------------------
  539|      0|        {
  540|      0|          if (c->node->pkt->pkttype == PKT_PUBLIC_KEY
  ------------------
  |  Branch (540:15): [True: 0, False: 0]
  ------------------
  541|      0|              || c->node->pkt->pkttype == PKT_PUBLIC_SUBKEY)
  ------------------
  |  Branch (541:18): [True: 0, False: 0]
  ------------------
  542|      0|            {
  543|      0|              SK_LIST r;
  544|       |
  545|       |              /* Skip this candidate if it's already enumerated.  */
  546|      0|              for (r = c->results; r; r = r->next)
  ------------------
  |  Branch (546:36): [True: 0, False: 0]
  ------------------
  547|      0|                if (!cmp_public_keys (r->pk, c->node->pkt->pkt.public_key))
  ------------------
  |  Branch (547:21): [True: 0, False: 0]
  ------------------
  548|      0|                  break;
  549|      0|              if (r)
  ------------------
  |  Branch (549:19): [True: 0, False: 0]
  ------------------
  550|      0|                continue;
  551|       |
  552|      0|              copy_public_key (sk, c->node->pkt->pkt.public_key);
  553|      0|              c->node = c->node->next;
  554|       |
  555|      0|              r = xtrycalloc (1, sizeof (*r));
  ------------------
  |  |   99|      0|#define xtrycalloc(a,b)  gcry_calloc ((a),(b))
  ------------------
  556|      0|              if (!r)
  ------------------
  |  Branch (556:19): [True: 0, False: 0]
  ------------------
  557|      0|                {
  558|      0|                  err = gpg_error_from_syserror ();
  559|      0|                  free_public_key (sk);
  560|      0|                  return err;
  561|      0|                }
  562|       |
  563|      0|              r->pk = sk;
  564|      0|              r->next = c->results;
  565|      0|              c->results = r;
  566|       |
  567|      0|              return 0; /* Found.  */
  568|      0|            }
  569|      0|        }
  570|       |
  571|       |      /* Dispose the keyblock and continue.  */
  572|      0|      release_kbnode (c->keyblock);
  573|      0|      c->keyblock = NULL;
  574|      0|    }
  575|  3.53k|}

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|}

print_file_status:
  132|  8.53k|{
  133|  8.53k|    char *p = xmalloc(strlen(name)+10);
  ------------------
  |  |  107|  8.53k|#define xmalloc(a)       gcry_xmalloc ((a))
  ------------------
  134|  8.53k|    sprintf(p, "%d %s", what, name );
  135|  8.53k|    write_status_text( status, p );
  136|  8.53k|    xfree(p);
  ------------------
  |  |  104|  8.53k|#define xfree(a)         gcry_free ((a))
  ------------------
  137|  8.53k|}

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

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

_keybox_read_blob:
   52|  9.63k|{
   53|  9.63k|  unsigned char *image;
   54|  9.63k|  size_t imagelen = 0;
   55|  9.63k|  int c1, c2, c3, c4, type;
   56|  9.63k|  int rc;
   57|  9.63k|  off_t off;
   58|       |
   59|  9.63k|  if (skipped_deleted)
  ------------------
  |  Branch (59:7): [True: 0, False: 9.63k]
  ------------------
   60|      0|    *skipped_deleted = 0;
   61|  9.63k| again:
   62|  9.63k|  if (r_blob)
  ------------------
  |  Branch (62:7): [True: 9.63k, False: 0]
  ------------------
   63|  9.63k|    *r_blob = NULL;
   64|  9.63k|  off = es_ftello (fp);
   65|  9.63k|  if (off == (off_t)-1)
  ------------------
  |  Branch (65:7): [True: 0, False: 9.63k]
  ------------------
   66|      0|    return gpg_error_from_syserror ();
   67|       |
   68|  9.63k|  if ((c1 = es_getc (fp)) == EOF
  ------------------
  |  Branch (68:7): [True: 4.81k, False: 4.81k]
  ------------------
   69|  9.63k|      || (c2 = es_getc (fp)) == EOF
  ------------------
  |  Branch (69:10): [True: 0, False: 4.81k]
  ------------------
   70|  9.63k|      || (c3 = es_getc (fp)) == EOF
  ------------------
  |  Branch (70:10): [True: 0, False: 4.81k]
  ------------------
   71|  9.63k|      || (c4 = es_getc (fp)) == EOF
  ------------------
  |  Branch (71:10): [True: 0, False: 4.81k]
  ------------------
   72|  9.63k|      || (type = es_getc (fp)) == EOF)
  ------------------
  |  Branch (72:10): [True: 0, False: 4.81k]
  ------------------
   73|  4.81k|    {
   74|  4.81k|      if ( c1 == EOF && !es_ferror (fp) )
  ------------------
  |  Branch (74:12): [True: 4.81k, False: 0]
  |  Branch (74:25): [True: 4.81k, False: 0]
  ------------------
   75|  4.81k|        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.81k|  imagelen = ((unsigned int) c1 << 24) | (c2 << 16) | (c3 << 8 ) | c4;
   82|  4.81k|  if (imagelen < 5)
  ------------------
  |  Branch (82:7): [True: 0, False: 4.81k]
  ------------------
   83|      0|    return gpg_error (GPG_ERR_TOO_SHORT);
   84|       |
   85|  4.81k|  if (!type)
  ------------------
  |  Branch (85:7): [True: 0, False: 4.81k]
  ------------------
   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.81k|  if (imagelen > IMAGELEN_LIMIT) /* Sanity check. */
  ------------------
  |  |   30|  4.81k|#define IMAGELEN_LIMIT (5*1024*1024)
  ------------------
  |  Branch (95:7): [True: 0, False: 4.81k]
  ------------------
   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.81k|  if (!r_blob)
  ------------------
  |  Branch (104:7): [True: 0, False: 4.81k]
  ------------------
  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.81k|  image = xtrymalloc (imagelen);
  ------------------
  |  |   97|  4.81k|#define xtrymalloc(a)    gcry_malloc ((a))
  ------------------
  113|  4.81k|  if (!image)
  ------------------
  |  Branch (113:7): [True: 0, False: 4.81k]
  ------------------
  114|      0|    return gpg_error_from_syserror ();
  115|       |
  116|  4.81k|  image[0] = c1; image[1] = c2; image[2] = c3; image[3] = c4; image[4] = type;
  117|  4.81k|  if (es_fread (image+5, imagelen-5, 1, fp) != 1)
  ------------------
  |  Branch (117:7): [True: 0, False: 4.81k]
  ------------------
  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.81k|  rc = _keybox_new_blob (r_blob, image, imagelen, off);
  125|  4.81k|  if (rc)
  ------------------
  |  Branch (125:7): [True: 0, False: 4.81k]
  ------------------
  126|      0|    xfree (image);
  ------------------
  |  |  104|      0|#define xfree(a)         gcry_free ((a))
  ------------------
  127|  4.81k|  return rc;
  128|  4.81k|}
_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|  9.10k|{
  150|  9.10k|  KB_NAME resource = token;
  151|       |
  152|  9.10k|  return do_keybox_new (resource, secret, 1);
  153|  9.10k|}
keybox_release:
  169|  9.10k|{
  170|  9.10k|  if (!hd)
  ------------------
  |  Branch (170:7): [True: 0, False: 9.10k]
  ------------------
  171|      0|    return;
  172|  9.10k|  if (hd->kb->handle_table)
  ------------------
  |  Branch (172:7): [True: 9.10k, False: 0]
  ------------------
  173|  9.10k|    {
  174|  9.10k|      int idx;
  175|  36.4k|      for (idx=0; idx < hd->kb->handle_table_size; idx++)
  ------------------
  |  Branch (175:19): [True: 27.3k, False: 9.10k]
  ------------------
  176|  27.3k|        if (hd->kb->handle_table[idx] == hd)
  ------------------
  |  Branch (176:13): [True: 9.10k, False: 18.2k]
  ------------------
  177|  9.10k|          hd->kb->handle_table[idx] = NULL;
  178|  9.10k|    }
  179|  9.10k|  _keybox_release_blob (hd->found.blob);
  180|  9.10k|  _keybox_release_blob (hd->saved_found.blob);
  181|  9.10k|  if (hd->fp)
  ------------------
  |  Branch (181:7): [True: 4.70k, False: 4.39k]
  ------------------
  182|  4.70k|    {
  183|  4.70k|      es_fclose (hd->fp);
  184|  4.70k|      hd->fp = NULL;
  185|  4.70k|    }
  186|  9.10k|  xfree (hd->word_match.name);
  ------------------
  |  |  104|  9.10k|#define xfree(a)         gcry_free ((a))
  ------------------
  187|  9.10k|  xfree (hd->word_match.pattern);
  ------------------
  |  |  104|  9.10k|#define xfree(a)         gcry_free ((a))
  ------------------
  188|  9.10k|  xfree (hd);
  ------------------
  |  |  104|  9.10k|#define xfree(a)         gcry_free ((a))
  ------------------
  189|  9.10k|}
_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|  9.10k|{
   92|  9.10k|  KEYBOX_HANDLE hd;
   93|  9.10k|  int idx;
   94|       |
   95|  9.10k|  assert (resource && !resource->secret == !secret);
   96|  9.10k|  hd = xtrycalloc (1, sizeof *hd);
  ------------------
  |  |   99|  9.10k|#define xtrycalloc(a,b)  gcry_calloc ((a),(b))
  ------------------
   97|  9.10k|  if (hd)
  ------------------
  |  Branch (97:7): [True: 9.10k, False: 0]
  ------------------
   98|  9.10k|    {
   99|  9.10k|      hd->kb = resource;
  100|  9.10k|      hd->secret = !!secret;
  101|  9.10k|      hd->for_openpgp = for_openpgp;
  102|  9.10k|      if (!resource->handle_table)
  ------------------
  |  Branch (102:11): [True: 1, False: 9.10k]
  ------------------
  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|  13.6k|      for (idx=0; idx < resource->handle_table_size; idx++)
  ------------------
  |  Branch (114:19): [True: 13.6k, False: 0]
  ------------------
  115|  13.6k|        if (!resource->handle_table[idx])
  ------------------
  |  Branch (115:13): [True: 9.10k, False: 4.55k]
  ------------------
  116|  9.10k|          {
  117|  9.10k|            resource->handle_table[idx] = hd;
  118|  9.10k|            break;
  119|  9.10k|          }
  120|  9.10k|      if (!(idx < resource->handle_table_size))
  ------------------
  |  Branch (120:11): [True: 0, False: 9.10k]
  ------------------
  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|  9.10k|    }
  140|  9.10k|  return hd;
  141|  9.10k|}

keybox_search_reset:
  901|  10.8k|{
  902|  10.8k|  if (!hd)
  ------------------
  |  Branch (902:7): [True: 0, False: 10.8k]
  ------------------
  903|      0|    return gpg_error (GPG_ERR_INV_VALUE);
  904|       |
  905|  10.8k|  if (hd->found.blob)
  ------------------
  |  Branch (905:7): [True: 0, False: 10.8k]
  ------------------
  906|      0|    {
  907|      0|      _keybox_release_blob (hd->found.blob);
  908|      0|      hd->found.blob = NULL;
  909|      0|    }
  910|       |
  911|  10.8k|  if (hd->fp)
  ------------------
  |  Branch (911:7): [True: 1.72k, False: 9.11k]
  ------------------
  912|  1.72k|    {
  913|  1.72k|      if (es_fseeko (hd->fp, 0, SEEK_SET))
  ------------------
  |  Branch (913:11): [True: 0, False: 1.72k]
  ------------------
  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|  1.72k|    }
  921|  10.8k|  hd->error = 0;
  922|  10.8k|  hd->eof = 0;
  923|  10.8k|  return 0;
  924|  10.8k|}
keybox_search:
  936|  4.81k|{
  937|  4.81k|  gpg_error_t rc;
  938|  4.81k|  size_t n;
  939|  4.81k|  int need_words, any_skip;
  940|  4.81k|  KEYBOXBLOB blob = NULL;
  941|  4.81k|  struct sn_array_s *sn_array = NULL;
  942|  4.81k|  int pk_no, uid_no;
  943|  4.81k|  off_t lastfoundoff;
  944|       |
  945|  4.81k|  if (!hd)
  ------------------
  |  Branch (945:7): [True: 0, False: 4.81k]
  ------------------
  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.81k|  if (hd->found.blob)
  ------------------
  |  Branch (950:7): [True: 0, False: 4.81k]
  ------------------
  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.81k|  else
  957|  4.81k|    lastfoundoff = 0;
  958|       |
  959|  4.81k|  if (hd->error)
  ------------------
  |  Branch (959:7): [True: 0, False: 4.81k]
  ------------------
  960|      0|    return hd->error; /* still in error state */
  961|  4.81k|  if (hd->eof)
  ------------------
  |  Branch (961:7): [True: 0, False: 4.81k]
  ------------------
  962|      0|    return -1; /* still EOF */
  963|       |
  964|       |  /* figure out what information we need */
  965|  4.81k|  need_words = any_skip = 0;
  966|  9.63k|  for (n=0; n < ndesc; n++)
  ------------------
  |  Branch (966:13): [True: 4.81k, False: 4.81k]
  ------------------
  967|  4.81k|    {
  968|  4.81k|      switch (desc[n].mode)
  969|  4.81k|        {
  970|      0|        case KEYDB_SEARCH_MODE_WORDS:
  ------------------
  |  Branch (970:9): [True: 0, False: 4.81k]
  ------------------
  971|      0|          need_words = 1;
  972|      0|          break;
  973|  3.53k|        case KEYDB_SEARCH_MODE_FIRST:
  ------------------
  |  Branch (973:9): [True: 3.53k, False: 1.27k]
  ------------------
  974|       |          /* always restart the search in this mode */
  975|  3.53k|          keybox_search_reset (hd);
  976|  3.53k|          lastfoundoff = 0;
  977|  3.53k|          break;
  978|  1.27k|        default:
  ------------------
  |  Branch (978:9): [True: 1.27k, False: 3.53k]
  ------------------
  979|  1.27k|          break;
  980|  4.81k|	}
  981|  4.81k|      if (desc[n].skipfnc)
  ------------------
  |  Branch (981:11): [True: 0, False: 4.81k]
  ------------------
  982|      0|        any_skip = 1;
  983|  4.81k|      if (desc[n].snhex && !sn_array)
  ------------------
  |  Branch (983:11): [True: 0, False: 4.81k]
  |  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.81k|    }
  990|       |
  991|  4.81k|  (void)need_words;  /* Not yet implemented.  */
  992|       |
  993|  4.81k|  if (!hd->fp)
  ------------------
  |  Branch (993:7): [True: 4.70k, False: 111]
  ------------------
  994|  4.70k|    {
  995|  4.70k|      rc = open_file (hd);
  996|  4.70k|      if (rc)
  ------------------
  |  Branch (996:11): [True: 0, False: 4.70k]
  ------------------
  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|  4.70k|      if (ndesc && desc[0].mode != KEYDB_SEARCH_MODE_FIRST && lastfoundoff)
  ------------------
  |  Branch (1002:11): [True: 4.70k, False: 0]
  |  Branch (1002:20): [True: 1.16k, False: 3.53k]
  |  Branch (1002:63): [True: 0, False: 1.16k]
  ------------------
 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|  4.70k|    }
 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.81k|  if (sn_array)
  ------------------
  |  Branch (1033:7): [True: 0, False: 4.81k]
  ------------------
 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.81k|  pk_no = uid_no = 0;
 1091|  4.81k|  for (;;)
 1092|  9.63k|    {
 1093|  9.63k|      unsigned int blobflags;
 1094|  9.63k|      int blobtype;
 1095|       |
 1096|  9.63k|      _keybox_release_blob (blob); blob = NULL;
 1097|  9.63k|      rc = _keybox_read_blob (&blob, hd->fp, NULL);
 1098|  9.63k|      if (gpg_err_code (rc) == GPG_ERR_TOO_LARGE
  ------------------
  |  Branch (1098:11): [True: 0, False: 9.63k]
  ------------------
 1099|  9.63k|          && 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|  9.63k|      if (rc)
  ------------------
  |  Branch (1105:11): [True: 4.81k, False: 4.81k]
  ------------------
 1106|  4.81k|        break;
 1107|       |
 1108|  4.81k|      blobtype = blob_get_type (blob);
 1109|  4.81k|      if (blobtype == KEYBOX_BLOBTYPE_HEADER)
  ------------------
  |  Branch (1109:11): [True: 4.81k, False: 0]
  ------------------
 1110|  4.81k|        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.81k|  if (!rc)
  ------------------
  |  Branch (1223:7): [True: 0, False: 4.81k]
  ------------------
 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.81k|  else if (rc == -1 || gpg_err_code (rc) == GPG_ERR_EOF)
  ------------------
  |  Branch (1229:12): [True: 4.81k, False: 0]
  |  Branch (1229:24): [True: 0, False: 0]
  ------------------
 1230|  4.81k|    {
 1231|  4.81k|      _keybox_release_blob (blob);
 1232|  4.81k|      hd->eof = 1;
 1233|  4.81k|    }
 1234|      0|  else
 1235|      0|    {
 1236|      0|      _keybox_release_blob (blob);
 1237|      0|      hd->error = rc;
 1238|      0|    }
 1239|       |
 1240|  4.81k|  if (sn_array)
  ------------------
  |  Branch (1240:7): [True: 0, False: 4.81k]
  ------------------
 1241|      0|    release_sn_array (sn_array, ndesc);
 1242|       |
 1243|  4.81k|  return rc;
 1244|  4.81k|}
keybox-search.c:open_file:
  879|  4.70k|{
  880|       |
  881|  4.70k|  hd->fp = es_fopen (hd->kb->fname, "rb");
  882|  4.70k|  if (!hd->fp)
  ------------------
  |  Branch (882:7): [True: 0, False: 4.70k]
  ------------------
  883|      0|    {
  884|      0|      hd->error = gpg_error_from_syserror ();
  885|      0|      return hd->error;
  886|      0|    }
  887|       |
  888|  4.70k|  return 0;
  889|  4.70k|}

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:
   93|  8.53k|int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   94|       |
   95|  8.53k|    if (! initialized) {
  ------------------
  |  Branch (95:9): [True: 1, False: 8.52k]
  ------------------
   96|      1|        ctrlGlobal = (ctrl_t) malloc(sizeof(*ctrlGlobal));
   97|      1|        if (!ctrlGlobal) {
  ------------------
  |  Branch (97:13): [True: 0, False: 1]
  ------------------
   98|      0|            exit(1);
   99|      0|        }
  100|       |        //deletes previous tmp dir and (re)create it as a ramfs
  101|       |        //system("umount /tmp/fuzzdirdecrypt");
  102|      1|        rmrfdir("/tmp/fuzzdirdecrypt");
  103|      1|        mkdir("/tmp/fuzzdirdecrypt", 0700);
  104|       |        //system("mount -t tmpfs -o size=64M tmpfs /tmp/fuzzdirdecrypt");
  105|      1|        filename=strdup("/tmp/fuzzdirdecrypt/fuzz.gpg");
  106|      1|        if (!filename) {
  ------------------
  |  Branch (106:13): [True: 0, False: 1]
  ------------------
  107|      0|            free(ctrlGlobal);
  108|      0|            return 0;
  109|      0|        }
  110|      1|        fd = open("/tmp/fuzzdirdecrypt/fuzz.gpg", O_RDWR | O_CREAT, 0600);
  111|      1|        if (fd == -1) {
  ------------------
  |  Branch (111:13): [True: 0, False: 1]
  ------------------
  112|      0|            free(ctrlGlobal);
  113|      0|            free(filename);
  114|      0|            return 0;
  115|      0|        }
  116|      1|        gnupg_set_homedir("/tmp/fuzzdirdecrypt/");
  117|      1|        if (keydb_add_resource ("pubring" EXTSEP_S GPGEXT_GPG,
  ------------------
  |  |  122|      1|#define GPGEXT_GPG "gpg"
  ------------------
  |  Branch (117:13): [True: 0, False: 1]
  ------------------
  118|      1|                                KEYDB_RESOURCE_FLAG_DEFAULT) != GPG_ERR_NO_ERROR) {
  ------------------
  |  |  212|      1|#define KEYDB_RESOURCE_FLAG_DEFAULT  4  /* The default one.  */
  ------------------
  119|      0|            free(filename);
  120|      0|            free(ctrlGlobal);
  121|      0|            close(fd);
  122|      0|            return 0;
  123|      0|        }
  124|      1|        if (setup_trustdb (1, NULL) != GPG_ERR_NO_ERROR) {
  ------------------
  |  Branch (124:13): [True: 0, False: 1]
  ------------------
  125|      0|            free(filename);
  126|      0|            free(ctrlGlobal);
  127|      0|            close(fd);
  128|      0|            return 0;
  129|      0|        }
  130|       |        //populate /tmp/fuzzdirdecrypt/ as homedir ~/.gnupg
  131|      1|        strlist_t sl = NULL;
  132|      1|        public_key_list (ctrlGlobal, sl, 0, 0);
  133|      1|        free_strlist(sl);
  134|       |        //no output for stderr
  135|      1|        log_set_file("/dev/null");
  136|      1|        gcry_set_log_handler (my_gcry_logger, NULL);
  137|      1|        gnupg_initialize_compliance (GNUPG_MODULE_NAME_GPG);
  ------------------
  |  |  293|      1|#define GNUPG_MODULE_NAME_GPG           8
  ------------------
  138|       |        //overwrite output file
  139|      1|        opt.batch = 1;
  140|      1|        opt.answer_yes = 1;
  141|      1|        initialized = true;
  142|      1|    }
  143|       |
  144|  8.53k|    memset(ctrlGlobal, 0, sizeof(*ctrlGlobal));
  145|  8.53k|    ctrlGlobal->magic = SERVER_CONTROL_MAGIC;
  ------------------
  |  |   83|  8.53k|# define SERVER_CONTROL_MAGIC 0x53616c696e676572
  ------------------
  146|  8.53k|    if (Size > MAX_LEN) {
  ------------------
  |  |   91|  8.53k|#define MAX_LEN 0x10000
  ------------------
  |  Branch (146:9): [True: 14, False: 8.51k]
  ------------------
  147|       |        // limit maximum size to avoid long computing times
  148|     14|        Size = MAX_LEN;
  ------------------
  |  |   91|     14|#define MAX_LEN 0x10000
  ------------------
  149|     14|    }
  150|       |
  151|  8.53k|    if (ftruncate(fd, Size) == -1) {
  ------------------
  |  Branch (151:9): [True: 0, False: 8.53k]
  ------------------
  152|      0|        return 0;
  153|      0|    }
  154|  8.53k|    if (lseek (fd, 0, SEEK_SET) < 0) {
  ------------------
  |  Branch (154:9): [True: 0, False: 8.53k]
  ------------------
  155|      0|        return 0;
  156|      0|    }
  157|  8.53k|    if (write (fd, Data, Size) != Size) {
  ------------------
  |  Branch (157:9): [True: 0, False: 8.53k]
  ------------------
  158|      0|        return 0;
  159|      0|    }
  160|       |
  161|  8.53k|    decrypt_messages(ctrlGlobal, 1, &filename);
  162|  8.53k|    gpg_deinit_default_ctrl (ctrlGlobal);
  163|  8.53k|    memset(ctrlGlobal, 0, sizeof(*ctrlGlobal));
  164|  8.53k|    ctrlGlobal->magic = SERVER_CONTROL_MAGIC;
  ------------------
  |  |   83|  8.53k|# define SERVER_CONTROL_MAGIC 0x53616c696e676572
  ------------------
  165|  8.53k|    decrypt_message(ctrlGlobal, filename);
  166|  8.53k|    gpg_deinit_default_ctrl (ctrlGlobal);
  167|       |
  168|  8.53k|    return 0;
  169|  8.53k|}
fuzz_decrypt.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_decrypt.c:my_gcry_logger:
   70|  43.3k|{
   71|  43.3k|    return;
   72|  43.3k|}
fuzz_decrypt.c:gpg_deinit_default_ctrl:
   59|  17.0k|{
   60|       |#ifdef USE_TOFU
   61|       |    tofu_closedbs (ctrl);
   62|       |#endif
   63|  17.0k|    gpg_dirmngr_deinit_session_data (ctrl);
   64|       |
   65|  17.0k|    keydb_release (ctrl->cached_getkey_kdb);
   66|  17.0k|}

assuan-socket-connect.c:_assuan_error:
  237|   130k|{
  238|   130k|  return gpg_err_make (ctx?ctx->err_source: GPG_ERR_SOURCE_ASSUAN, errcode);
  ------------------
  |  Branch (238:24): [True: 130k, False: 0]
  ------------------
  239|   130k|}

_assuan_log_handler:
  128|  1.30M|{
  129|  1.30M|  FILE *fp;
  130|  1.30M|  const char *prf;
  131|  1.30M|  int saved_errno = errno;
  132|       |
  133|       |  /* For now.  */
  134|  1.30M|  if (msg == NULL)
  ------------------
  |  Branch (134:7): [True: 1.30M, False: 0]
  ------------------
  135|  1.30M|    return TEST_LOG_CAT (cat);
  ------------------
  |  |   55|  1.30M|#define TEST_LOG_CAT(x) (!! (log_cats & (1 << (x - 1))))
  ------------------
  136|       |
  137|      0|  if (! TEST_LOG_CAT (cat))
  ------------------
  |  |   55|      0|#define TEST_LOG_CAT(x) (!! (log_cats & (1 << (x - 1))))
  ------------------
  |  Branch (137:7): [True: 0, False: 0]
  ------------------
  138|      0|    return 0;
  139|       |
  140|      0|  fp = ctx->log_fp ? ctx->log_fp : _assuan_log;
  ------------------
  |  Branch (140:8): [True: 0, False: 0]
  ------------------
  141|      0|  if (!fp)
  ------------------
  |  Branch (141:7): [True: 0, False: 0]
  ------------------
  142|      0|    return 0;
  143|       |
  144|      0|  prf = assuan_get_assuan_log_prefix ();
  145|      0|  if (*prf)
  ------------------
  |  Branch (145:7): [True: 0, False: 0]
  ------------------
  146|      0|    fprintf (fp, "%s[%u]: ", prf, (unsigned int)getpid ());
  147|       |
  148|      0|  fprintf (fp, "%s", msg);
  149|       |  /* If the log stream is a file, the output would be buffered.  This
  150|       |     is bad for debugging, thus we flush the stream if FORMAT ends
  151|       |     with a LF.  */
  152|      0|  if (msg && *msg && msg[strlen (msg) - 1] == '\n')
  ------------------
  |  Branch (152:7): [True: 0, False: 0]
  |  Branch (152:14): [True: 0, False: 0]
  |  Branch (152:22): [True: 0, False: 0]
  ------------------
  153|      0|    fflush (fp);
  154|      0|  gpg_err_set_errno (saved_errno);
  155|       |
  156|      0|  return 0;
  157|      0|}

assuan_socket_connect:
  221|   130k|{
  222|   130k|  gpg_error_t err = 0;
  223|   130k|  assuan_fd_t fd;
  224|   130k|#ifdef WITH_IPV6
  225|   130k|  struct sockaddr_in6 srvr_addr_in6;
  226|   130k|#endif
  227|   130k|  struct sockaddr_un srvr_addr_un;
  228|   130k|  struct sockaddr_in srvr_addr_in;
  229|   130k|  struct sockaddr *srvr_addr = NULL;
  230|   130k|  uint16_t port = 0;
  231|   130k|  size_t len = 0;
  232|   130k|  const char *s;
  233|   130k|  int af = AF_LOCAL;
  234|   130k|  int pf = PF_LOCAL;
  235|       |
  236|   130k|  TRACE2 (ctx, ASSUAN_LOG_CTX, "assuan_socket_connect", ctx,
  ------------------
  |  |  152|   130k|  _assuan_debug (ctx, lvl, "%s (%s=%p): call: " fmt "\n",		\
  |  |  153|   261k|		 name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \
  |  |  ------------------
  |  |  |  |   35|   130k|#define STRINGIFY(v) #v
  |  |  ------------------
  |  |  |  Branch (153:53): [True: 130k, False: 0]
  |  |  ------------------
  |  |  154|   130k|		 arg2)
  ------------------
  237|   130k|	  "name=%s, flags=0x%x", name ? name : "(null)", flags);
  238|       |
  239|   130k|  if (!ctx || !name)
  ------------------
  |  Branch (239:7): [True: 0, False: 130k]
  |  Branch (239:15): [True: 0, False: 130k]
  ------------------
  240|      0|    return _assuan_error (ctx, GPG_ERR_ASS_INV_VALUE);
  241|       |
  242|   130k|  if (!strncmp (name, "file://", 7) && name[7])
  ------------------
  |  Branch (242:7): [True: 0, False: 130k]
  |  Branch (242:40): [True: 0, False: 0]
  ------------------
  243|      0|    name += 7;
  244|   130k|  else if (!strncmp (name, "assuan://", 9) && name[9])
  ------------------
  |  Branch (244:12): [True: 0, False: 130k]
  |  Branch (244:47): [True: 0, False: 0]
  ------------------
  245|      0|    {
  246|      0|      name += 9;
  247|      0|      af = AF_INET;
  248|      0|      pf = PF_INET;
  249|      0|    }
  250|   130k|  else /* Default.  */
  251|   130k|    {
  252|       |      /* We require that the name starts with a slash if no URL
  253|       |         schemata is used.  To make things easier we allow an optional
  254|       |         drive prefix.  */
  255|   130k|      s = name;
  256|   130k|      if (*s && s[1] == ':')
  ------------------
  |  Branch (256:11): [True: 130k, False: 0]
  |  Branch (256:17): [True: 0, False: 130k]
  ------------------
  257|      0|        s += 2;
  258|   130k|      if (*s != DIRSEP_C && *s != '/')
  ------------------
  |  |   51|   261k|#define DIRSEP_C '/'
  ------------------
  |  Branch (258:11): [True: 0, False: 130k]
  |  Branch (258:29): [True: 0, False: 0]
  ------------------
  259|      0|        return _assuan_error (ctx, GPG_ERR_ASS_INV_VALUE);
  260|   130k|    }
  261|       |
  262|   130k|  if (af == AF_LOCAL)
  ------------------
  |  Branch (262:7): [True: 130k, False: 0]
  ------------------
  263|   130k|    {
  264|   130k|      int redirected;
  265|       |
  266|   130k|      if (_assuan_sock_set_sockaddr_un (name, (struct sockaddr *)&srvr_addr_un,
  ------------------
  |  Branch (266:11): [True: 0, False: 130k]
  ------------------
  267|   130k|                                        &redirected))
  268|      0|        return _assuan_error (ctx, gpg_err_code_from_syserror ());
  269|       |
  270|   130k|      len = SUN_LEN (&srvr_addr_un);
  271|   130k|      srvr_addr = (struct sockaddr *)&srvr_addr_un;
  272|   130k|    }
  273|      0|  else
  274|      0|    {
  275|      0|      char *addrstr, *p;
  276|      0|#ifdef HAVE_INET_PTON
  277|      0|      void *addrbuf = NULL;
  278|      0|#endif
  279|       |
  280|      0|      addrstr = _assuan_malloc (ctx, strlen (name) + 1);
  281|      0|      if (!addrstr)
  ------------------
  |  Branch (281:11): [True: 0, False: 0]
  ------------------
  282|      0|        return _assuan_error (ctx, gpg_err_code_from_syserror ());
  283|       |
  284|      0|      if (*name == '[')
  ------------------
  |  Branch (284:11): [True: 0, False: 0]
  ------------------
  285|      0|        {
  286|      0|          strcpy (addrstr, name+1);
  287|      0|          p = strchr (addrstr, ']');
  288|      0|          if (!p || p[1] != ':' || !parse_portno (p+2, &port))
  ------------------
  |  Branch (288:15): [True: 0, False: 0]
  |  Branch (288:21): [True: 0, False: 0]
  |  Branch (288:36): [True: 0, False: 0]
  ------------------
  289|      0|            err = _assuan_error (ctx, GPG_ERR_BAD_URI);
  290|      0|          else
  291|      0|            {
  292|      0|              *p = 0;
  293|      0|#ifdef WITH_IPV6
  294|      0|              af = AF_INET6;
  295|      0|              pf = PF_INET6;
  296|      0|              memset (&srvr_addr_in6, 0, sizeof srvr_addr_in6);
  297|      0|              srvr_addr_in6.sin6_family = af;
  298|      0|              srvr_addr_in6.sin6_port = htons (port);
  299|      0|#ifdef HAVE_INET_PTON
  300|      0|              addrbuf = &srvr_addr_in6.sin6_addr;
  301|      0|#endif
  302|      0|              srvr_addr = (struct sockaddr *)&srvr_addr_in6;
  303|      0|              len = sizeof srvr_addr_in6;
  304|       |#else
  305|       |              err =  _assuan_error (ctx, GPG_ERR_EAFNOSUPPORT);
  306|       |#endif
  307|      0|            }
  308|      0|        }
  309|      0|      else
  310|      0|        {
  311|      0|          strcpy (addrstr, name);
  312|      0|          p = strchr (addrstr, ':');
  313|      0|          if (!p || !parse_portno (p+1, &port))
  ------------------
  |  Branch (313:15): [True: 0, False: 0]
  |  Branch (313:21): [True: 0, False: 0]
  ------------------
  314|      0|            err = _assuan_error (ctx, GPG_ERR_BAD_URI);
  315|      0|          else
  316|      0|            {
  317|      0|              *p = 0;
  318|      0|              memset (&srvr_addr_in, 0, sizeof srvr_addr_in);
  319|      0|              srvr_addr_in.sin_family = af;
  320|      0|              srvr_addr_in.sin_port = htons (port);
  321|      0|#ifdef HAVE_INET_PTON
  322|      0|              addrbuf = &srvr_addr_in.sin_addr;
  323|      0|#endif
  324|      0|              srvr_addr = (struct sockaddr *)&srvr_addr_in;
  325|      0|              len = sizeof srvr_addr_in;
  326|      0|            }
  327|      0|        }
  328|       |
  329|      0|      if (!err)
  ------------------
  |  Branch (329:11): [True: 0, False: 0]
  ------------------
  330|      0|        {
  331|      0|#ifdef HAVE_INET_PTON
  332|      0|          switch (inet_pton (af, addrstr, addrbuf))
  333|      0|            {
  334|      0|            case 1:  break;
  ------------------
  |  Branch (334:13): [True: 0, False: 0]
  ------------------
  335|      0|            case 0:  err = _assuan_error (ctx, GPG_ERR_BAD_URI); break;
  ------------------
  |  Branch (335:13): [True: 0, False: 0]
  ------------------
  336|      0|            default: err = _assuan_error (ctx, gpg_err_code_from_syserror ());
  ------------------
  |  Branch (336:13): [True: 0, False: 0]
  ------------------
  337|      0|            }
  338|       |#else /*!HAVE_INET_PTON*/
  339|       |          /* We need to use the old function.  If we are here v6
  340|       |             support isn't enabled anyway and thus we can do fine
  341|       |             without.  Note that Windows as a compatible inet_pton
  342|       |             function named inetPton, but only since Vista.  */
  343|       |          srvr_addr_in.sin_addr.s_addr = inet_addr (addrstr);
  344|       |          if (srvr_addr_in.sin_addr.s_addr == INADDR_NONE)
  345|       |            err = _assuan_error (ctx, GPG_ERR_BAD_URI);
  346|       |#endif /*!HAVE_INET_PTON*/
  347|      0|        }
  348|       |
  349|      0|      _assuan_free (ctx, addrstr);
  350|      0|      if (err)
  ------------------
  |  Branch (350:11): [True: 0, False: 0]
  ------------------
  351|      0|        return err;
  352|      0|    }
  353|       |
  354|   130k|  fd = _assuan_sock_new (ctx, pf, SOCK_STREAM, 0);
  355|   130k|  if (fd == ASSUAN_INVALID_FD)
  ------------------
  |  |   86|   130k|#define ASSUAN_INVALID_FD  (-1)
  ------------------
  |  Branch (355:7): [True: 0, False: 130k]
  ------------------
  356|      0|    {
  357|      0|      err = _assuan_error (ctx, gpg_err_code_from_syserror ());
  358|      0|      TRACE1 (ctx, ASSUAN_LOG_SYSIO, "assuan_socket_connect", ctx,
  ------------------
  |  |  149|      0|  _assuan_debug (ctx, lvl, "%s (%s=%p): call: " fmt "\n",		\
  |  |  150|      0|		 name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1)
  |  |  ------------------
  |  |  |  |   35|      0|#define STRINGIFY(v) #v
  |  |  ------------------
  ------------------
  359|      0|              "can't create socket: %s", strerror (errno));
  360|      0|      return err;
  361|      0|    }
  362|       |
  363|   130k|  if (_assuan_sock_connect (ctx, fd, srvr_addr, len) == -1)
  ------------------
  |  Branch (363:7): [True: 130k, False: 0]
  ------------------
  364|   130k|    {
  365|   130k|      TRACE2 (ctx, ASSUAN_LOG_SYSIO, "assuan_socket_connect", ctx,
  ------------------
  |  |  152|   130k|  _assuan_debug (ctx, lvl, "%s (%s=%p): call: " fmt "\n",		\
  |  |  153|   130k|		 name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1, \
  |  |  ------------------
  |  |  |  |   35|   130k|#define STRINGIFY(v) #v
  |  |  ------------------
  |  |  154|   130k|		 arg2)
  ------------------
  366|   130k|	      "can't connect to `%s': %s\n", name, strerror (errno));
  367|   130k|      _assuan_close (ctx, fd);
  368|   130k|      return _assuan_error (ctx, GPG_ERR_ASS_CONNECT_FAILED);
  369|   130k|    }
  370|       |
  371|      0|  err = _assuan_connect_finalize (ctx, fd, flags);
  372|       |
  373|      0|  if (err)
  ------------------
  |  Branch (373:7): [True: 0, False: 0]
  ------------------
  374|      0|    _assuan_reset (ctx);
  375|       |
  376|      0|  return err;
  377|   130k|}

_assuan_sock_new:
  527|   130k|{
  528|       |#ifdef HAVE_W32_SYSTEM
  529|       |  assuan_fd_t res;
  530|       |  if (domain == AF_UNIX || domain == AF_LOCAL)
  531|       |    domain = AF_INET;
  532|       |  res = _assuan_socket (ctx, domain, type, proto);
  533|       |  return res;
  534|       |#else
  535|   130k|  return _assuan_socket (ctx, domain, type, proto);
  536|   130k|#endif
  537|   130k|}
_assuan_sock_connect:
 1011|   130k|{
 1012|       |#ifdef HAVE_W32_SYSTEM
 1013|       |  if (addr->sa_family == AF_LOCAL || addr->sa_family == AF_UNIX)
 1014|       |    {
 1015|       |      struct sockaddr_in myaddr;
 1016|       |      struct sockaddr_un *unaddr;
 1017|       |      unsigned short port;
 1018|       |      char nonce[16];
 1019|       |      int cygwin;
 1020|       |      int ret;
 1021|       |
 1022|       |      unaddr = (struct sockaddr_un *)addr;
 1023|       |      if (read_port_and_nonce (unaddr->sun_path, &port, nonce, &cygwin))
 1024|       |        return -1;
 1025|       |
 1026|       |      myaddr.sin_family = AF_INET;
 1027|       |      myaddr.sin_port = htons (port);
 1028|       |      myaddr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
 1029|       |
 1030|       |      /* Set return values.  */
 1031|       |      unaddr->sun_family = myaddr.sin_family;
 1032|       |      unaddr->sun_port = myaddr.sin_port;
 1033|       |      unaddr->sun_addr.s_addr = myaddr.sin_addr.s_addr;
 1034|       |
 1035|       |      ret = _assuan_connect (ctx, sockfd,
 1036|       |			    (struct sockaddr *)&myaddr, sizeof myaddr);
 1037|       |      if (!ret)
 1038|       |        {
 1039|       |          /* Send the nonce. */
 1040|       |          ret = do_writen (ctx, sockfd, nonce, 16);
 1041|       |          if (!ret && cygwin)
 1042|       |            {
 1043|       |              char buffer[16];
 1044|       |
 1045|       |              /* The client sends the nonce back - not useful.  We do
 1046|       |                 a dummy read.  */
 1047|       |              ret = do_readn (ctx, sockfd, buffer, 16);
 1048|       |              if (!ret)
 1049|       |                {
 1050|       |                  /* Send our credentials.  */
 1051|       |                  int n = getpid ();
 1052|       |                  memcpy (buffer, &n, 4);
 1053|       |                  memset (buffer+4, 0, 4); /* uid = gid = 0 */
 1054|       |                  ret = do_writen (ctx, sockfd, buffer, 8);
 1055|       |                  if (!ret)
 1056|       |                    {
 1057|       |                      /* Receive credentials.  We don't need them.  */
 1058|       |                      ret = do_readn (ctx, sockfd, buffer, 8);
 1059|       |                    }
 1060|       |                }
 1061|       |            }
 1062|       |        }
 1063|       |      return ret;
 1064|       |    }
 1065|       |  else if (use_socks (addr))
 1066|       |    {
 1067|       |      return socks5_connect (ctx, sockfd, tor_mode,
 1068|       |                             NULL, NULL, 0, addr, addrlen);
 1069|       |    }
 1070|       |  else
 1071|       |    {
 1072|       |      return _assuan_connect (ctx, sockfd, addr, addrlen);
 1073|       |    }
 1074|       |#else
 1075|   130k|# if HAVE_STAT
 1076|   130k|  if (addr->sa_family == AF_LOCAL || addr->sa_family == AF_UNIX)
  ------------------
  |  Branch (1076:7): [True: 130k, False: 0]
  |  Branch (1076:38): [True: 0, False: 0]
  ------------------
 1077|   130k|    {
 1078|   130k|      struct sockaddr_un *unaddr;
 1079|   130k|      struct stat statbuf;
 1080|   130k|      int redirect, res;
 1081|       |
 1082|   130k|      unaddr = (struct sockaddr_un *)addr;
 1083|   130k|      if (!stat (unaddr->sun_path, &statbuf)
  ------------------
  |  Branch (1083:11): [True: 0, False: 130k]
  ------------------
 1084|   130k|          && !S_ISSOCK (statbuf.st_mode)
  ------------------
  |  Branch (1084:14): [True: 0, False: 0]
  ------------------
 1085|   130k|          && S_ISREG (statbuf.st_mode))
 1086|      0|        {
 1087|       |          /* The given socket file is not a socket but a regular file.
 1088|       |             We use the content of that file to redirect to another
 1089|       |             socket file.  This can be used to use sockets on file
 1090|       |             systems which do not support sockets or if for example a
 1091|       |             home directory is shared by several machines.  */
 1092|      0|          unaddr = eval_redirection (unaddr->sun_path, &redirect);
 1093|      0|          if (unaddr)
  ------------------
  |  Branch (1093:15): [True: 0, False: 0]
  ------------------
 1094|      0|            {
 1095|      0|              res = _assuan_connect (ctx, sockfd, (struct sockaddr *)unaddr,
 1096|      0|                                     SUN_LEN (unaddr));
 1097|      0|              free (unaddr);
 1098|      0|              return res;
 1099|      0|            }
 1100|      0|          if (redirect)
  ------------------
  |  Branch (1100:15): [True: 0, False: 0]
  ------------------
 1101|      0|            return -1;
 1102|       |          /* Continue using the standard connect.  */
 1103|      0|        }
 1104|       |
 1105|   130k|    }
 1106|   130k|# endif /*HAVE_STAT*/
 1107|       |
 1108|   130k|  if (use_socks (addr))
  ------------------
  |  Branch (1108:7): [True: 0, False: 130k]
  ------------------
 1109|      0|    {
 1110|      0|      return socks5_connect (ctx, sockfd, tor_mode,
 1111|      0|                             NULL, NULL, 0, addr, addrlen);
 1112|      0|    }
 1113|   130k|  else
 1114|   130k|    {
 1115|   130k|      return _assuan_connect (ctx, sockfd, addr, addrlen);
 1116|   130k|    }
 1117|   130k|#endif
 1118|   130k|}
_assuan_sock_set_sockaddr_un:
 1278|   130k|{
 1279|   130k|  struct sockaddr_un *unaddr = (struct sockaddr_un *)addr;
 1280|   130k|#if !defined(HAVE_W32_SYSTEM) && defined(HAVE_STAT)
 1281|   130k|  struct stat statbuf;
 1282|   130k|#endif
 1283|       |
 1284|   130k|  if (r_redirected)
  ------------------
  |  Branch (1284:7): [True: 130k, False: 0]
  ------------------
 1285|   130k|    *r_redirected = 0;
 1286|       |
 1287|   130k|#if !defined(HAVE_W32_SYSTEM) && defined(HAVE_STAT)
 1288|   130k|  if (r_redirected
  ------------------
  |  Branch (1288:7): [True: 130k, False: 0]
  ------------------
 1289|   130k|      && !stat (fname, &statbuf)
  ------------------
  |  Branch (1289:10): [True: 0, False: 130k]
  ------------------
 1290|   130k|      && !S_ISSOCK (statbuf.st_mode)
  ------------------
  |  Branch (1290:10): [True: 0, False: 0]
  ------------------
 1291|   130k|      && S_ISREG (statbuf.st_mode))
 1292|      0|    {
 1293|       |      /* The given socket file is not a socket but a regular file.  We
 1294|       |         use the content of that file to redirect to another socket
 1295|       |         file.  This can be used to use sockets on file systems which
 1296|       |         do not support sockets or if for example a home directory is
 1297|       |         shared by several machines.  */
 1298|      0|      struct sockaddr_un *unaddr_new;
 1299|      0|      int redirect;
 1300|       |
 1301|      0|      unaddr_new = eval_redirection (fname, &redirect);
 1302|      0|      if (unaddr_new)
  ------------------
  |  Branch (1302:11): [True: 0, False: 0]
  ------------------
 1303|      0|        {
 1304|      0|          memcpy (unaddr, unaddr_new, sizeof *unaddr);
 1305|      0|          free (unaddr_new);
 1306|      0|          *r_redirected = 1;
 1307|      0|          return 0;
 1308|      0|        }
 1309|      0|      if (redirect)
  ------------------
  |  Branch (1309:11): [True: 0, False: 0]
  ------------------
 1310|      0|        {
 1311|      0|          *r_redirected = 1;
 1312|      0|          return -1;  /* Error.  */
 1313|      0|        }
 1314|       |      /* Fallback to standard setup.  */
 1315|      0|    }
 1316|   130k|#endif /*!HAVE_W32_SYSTEM && HAVE_STAT*/
 1317|       |
 1318|   130k|  if (strlen (fname)+1 >= sizeof unaddr->sun_path)
  ------------------
  |  Branch (1318:7): [True: 0, False: 130k]
  ------------------
 1319|      0|    {
 1320|      0|      gpg_err_set_errno (ENAMETOOLONG);
 1321|      0|      return -1;
 1322|      0|    }
 1323|       |
 1324|   130k|  memset (unaddr, 0, sizeof *unaddr);
 1325|   130k|  unaddr->sun_family = AF_LOCAL;
 1326|   130k|  strncpy (unaddr->sun_path, fname, sizeof unaddr->sun_path - 1);
 1327|   130k|  unaddr->sun_path[sizeof unaddr->sun_path - 1] = 0;
 1328|       |
 1329|   130k|  return 0;
 1330|   130k|}
assuan-socket.c:use_socks:
  953|   130k|{
  954|   130k|  union {
  955|   130k|    struct sockaddr *addr;
  956|   130k|    struct sockaddr_in *addr_in;
  957|   130k|    struct sockaddr_in6 *addr_in6;
  958|   130k|  } addru;
  959|       |
  960|   130k|  addru.addr = addr;
  961|       |
  962|   130k|  if (!tor_mode)
  ------------------
  |  Branch (962:7): [True: 130k, False: 0]
  ------------------
  963|   130k|    return 0;
  964|      0|  else if (addr->sa_family == AF_INET6)
  ------------------
  |  Branch (964:12): [True: 0, False: 0]
  ------------------
  965|      0|    {
  966|      0|      const unsigned char *s;
  967|      0|      int i;
  968|       |
  969|      0|      s = (unsigned char *)&addru.addr_in6->sin6_addr.s6_addr;
  970|      0|      if (s[15] != 1)
  ------------------
  |  Branch (970:11): [True: 0, False: 0]
  ------------------
  971|      0|        return 1;   /* Last octet is not 1 - not the loopback address.  */
  972|      0|      for (i=0; i < 15; i++, s++)
  ------------------
  |  Branch (972:17): [True: 0, False: 0]
  ------------------
  973|      0|        if (*s)
  ------------------
  |  Branch (973:13): [True: 0, False: 0]
  ------------------
  974|      0|          return 1; /* Non-zero octet found - not the loopback address.  */
  975|       |
  976|      0|      return 0; /* This is the loopback address.  */
  977|      0|    }
  978|      0|  else if (addr->sa_family == AF_INET)
  ------------------
  |  Branch (978:12): [True: 0, False: 0]
  ------------------
  979|      0|    {
  980|      0|      if (*(unsigned char*)&addru.addr_in->sin_addr.s_addr == 127)
  ------------------
  |  Branch (980:11): [True: 0, False: 0]
  ------------------
  981|      0|        return 0; /* Loopback (127.0.0.0/8) */
  982|       |
  983|      0|      return 1;
  984|      0|    }
  985|      0|  else
  986|      0|    return 0;
  987|   130k|}

_assuan_pre_syscall:
  120|   261k|{
  121|   261k|  if (pre_syscall_func)
  ------------------
  |  Branch (121:7): [True: 0, False: 261k]
  ------------------
  122|      0|    pre_syscall_func ();
  123|   261k|}
_assuan_post_syscall:
  129|   261k|{
  130|   261k|  if (post_syscall_func)
  ------------------
  |  Branch (130:7): [True: 0, False: 261k]
  ------------------
  131|      0|    post_syscall_func ();
  132|   261k|}
assuan_new_ext:
  140|   130k|{
  141|   130k|  struct assuan_context_s wctx;
  142|   130k|  assuan_context_t ctx;
  143|       |
  144|   130k|  if (!_assuan_syscall_func_initialized)
  ------------------
  |  Branch (144:7): [True: 1, False: 130k]
  ------------------
  145|      1|    {
  146|      1|      gpgrt_get_syscall_clamp (&pre_syscall_func, &post_syscall_func);
  147|      1|      _assuan_syscall_func_initialized = 1;
  148|      1|    }
  149|       |
  150|       |  /* Set up a working context so we can use standard functions.  */
  151|   130k|  memset (&wctx, 0, sizeof (wctx));
  152|   130k|  wctx.err_source = err_source;
  153|   130k|  wctx.malloc_hooks = *malloc_hooks;
  154|   130k|  wctx.log_cb = log_cb;
  155|   130k|  wctx.log_cb_data = log_cb_data;
  156|       |
  157|       |  /* Need a new block for the trace macros to work.  */
  158|   130k|  {
  159|   130k|    TRACE_BEG8 (&wctx, ASSUAN_LOG_CTX, "assuan_new_ext", r_ctx,
  ------------------
  |  |  135|   130k|  _TRACE (ctx, lvl, name, tag);						\
  |  |  ------------------
  |  |  |  |   84|   130k|  assuan_context_t _assuan_trace_context = ctx;				\
  |  |  |  |   85|   130k|  int _assuan_trace_level = lvl;					\
  |  |  |  |   86|   130k|  const char *const _assuan_trace_func = name;				\
  |  |  |  |   87|   130k|  const char *const _assuan_trace_tagname = STRINGIFY (tag);		\
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|   130k|#define STRINGIFY(v) #v
  |  |  |  |  ------------------
  |  |  |  |   88|   130k|  void *_assuan_trace_tag = (void *) (uintptr_t) tag
  |  |  ------------------
  |  |  136|   130k|  _assuan_debug (_assuan_trace_context, _assuan_trace_level,            \
  |  |  137|   130k|                 "%s (%s=%p): enter: " fmt "\n",                        \
  |  |  138|   130k|		 _assuan_trace_func, _assuan_trace_tagname,		\
  |  |  139|   130k|		 _assuan_trace_tag, arg1, arg2, arg3, arg4,		\
  |  |  140|   130k|		 arg5, arg6, arg7, arg8)
  ------------------
  160|   130k|		"err_source = %i (%s), malloc_hooks = %p (%p, %p, %p), "
  161|   130k|		"log_cb = %p, log_cb_data = %p", err_source,
  162|   130k|		gpg_strsource (err_source), malloc_hooks, malloc_hooks->malloc,
  163|   130k|		malloc_hooks->realloc, malloc_hooks->free, log_cb, log_cb_data);
  164|       |
  165|   130k|    *r_ctx = NULL;
  166|   130k|    ctx = _assuan_malloc (&wctx, sizeof (*ctx));
  167|   130k|    if (!ctx)
  ------------------
  |  Branch (167:9): [True: 0, False: 130k]
  ------------------
  168|      0|      return TRACE_ERR (gpg_err_code_from_syserror ());
  ------------------
  |  |  169|      0|  err == 0 ? (TRACE_SUC ()) :						\
  |  |  ------------------
  |  |  |  |  190|      0|  _assuan_debug (_assuan_trace_context, _assuan_trace_level,	 \
  |  |  |  |  191|      0|		 "%s (%s=%p): leave\n",				 \
  |  |  |  |  192|      0|		_assuan_trace_func, _assuan_trace_tagname,	 \
  |  |  |  |  193|      0|		_assuan_trace_tag), 0
  |  |  ------------------
  |  |  |  Branch (169:3): [True: 0, False: 0]
  |  |  ------------------
  |  |  170|      0|    (_assuan_debug (_assuan_trace_context, _assuan_trace_level,		\
  |  |  171|      0|		    "%s (%s=%p): error: %s <%s>\n",			\
  |  |  172|      0|		    _assuan_trace_func, _assuan_trace_tagname,		\
  |  |  173|      0|		    _assuan_trace_tag, gpg_strerror (err),		\
  |  |  174|      0|		    ctx?gpg_strsource (ctx->err_source):""),            \
  |  |  ------------------
  |  |  |  Branch (174:7): [True: 0, False: 0]
  |  |  ------------------
  |  |  175|      0|     _assuan_error (ctx, err))
  ------------------
  169|       |
  170|   130k|    memcpy (ctx, &wctx, sizeof (*ctx));
  171|   130k|    ctx->system = _assuan_system_hooks;
  172|       |
  173|       |    /* FIXME: Delegate to subsystems/engines, as the FDs are not our
  174|       |       responsibility (we don't deallocate them, for example).  */
  175|   130k|    ctx->input_fd = ASSUAN_INVALID_FD;
  ------------------
  |  |   86|   130k|#define ASSUAN_INVALID_FD  (-1)
  ------------------
  176|   130k|    ctx->output_fd = ASSUAN_INVALID_FD;
  ------------------
  |  |   86|   130k|#define ASSUAN_INVALID_FD  (-1)
  ------------------
  177|   130k|    ctx->inbound.fd = ASSUAN_INVALID_FD;
  ------------------
  |  |   86|   130k|#define ASSUAN_INVALID_FD  (-1)
  ------------------
  178|   130k|    ctx->outbound.fd = ASSUAN_INVALID_FD;
  ------------------
  |  |   86|   130k|#define ASSUAN_INVALID_FD  (-1)
  ------------------
  179|   130k|    ctx->listen_fd = ASSUAN_INVALID_FD;
  ------------------
  |  |   86|   130k|#define ASSUAN_INVALID_FD  (-1)
  ------------------
  180|       |
  181|   130k|    *r_ctx = ctx;
  182|       |
  183|   130k|    return TRACE_SUC1 ("ctx=%p", ctx);
  ------------------
  |  |  200|   130k|  _assuan_debug (_assuan_trace_context, _assuan_trace_level,		\
  |  |  201|   130k|		 "%s (%s=%p): leave: " fmt "\n",			\
  |  |  202|   130k|		 _assuan_trace_func, _assuan_trace_tagname,		\
  |  |  203|   130k|		 _assuan_trace_tag, arg1), 0
  ------------------
  184|   130k|  }
  185|   130k|}
assuan_new:
  191|   130k|{
  192|   130k|  return assuan_new_ext (r_ctx, _assuan_default_err_source,
  193|   130k|			 &_assuan_default_malloc_hooks,
  194|   130k|			 _assuan_default_log_cb,
  195|   130k|			 _assuan_default_log_cb_data);
  196|   130k|}
_assuan_reset:
  202|   130k|{
  203|   130k|  if (ctx->engine.release)
  ------------------
  |  Branch (203:7): [True: 0, False: 130k]
  ------------------
  204|      0|    {
  205|      0|      (*ctx->engine.release) (ctx);
  206|      0|      ctx->engine.release = NULL;
  207|      0|    }
  208|       |
  209|       |  /* FIXME: Clean standard commands */
  210|   130k|}
assuan_release:
  216|   130k|{
  217|   130k|  if (! ctx)
  ------------------
  |  Branch (217:7): [True: 0, False: 130k]
  ------------------
  218|      0|    return;
  219|       |
  220|   130k|  TRACE (ctx, ASSUAN_LOG_CTX, "assuan_release", ctx);
  ------------------
  |  |  143|   130k|  _assuan_debug (ctx, lvl, "%s (%s=%p): call\n",			\
  |  |  144|   130k|		 name, STRINGIFY (tag), (void *) (uintptr_t) tag)
  |  |  ------------------
  |  |  |  |   35|   130k|#define STRINGIFY(v) #v
  |  |  ------------------
  ------------------
  221|       |
  222|   130k|  _assuan_reset (ctx);
  223|       |  /* None of the members that are our responsibility requires
  224|       |     deallocation.  To avoid sensitive data in the line buffers we
  225|       |     wipe them out, though.  Note that we can't wipe the entire
  226|       |     context because it also has a pointer to the actual free().  */
  227|   130k|  wipememory (&ctx->inbound, sizeof ctx->inbound);
  ------------------
  |  |  410|   130k|#define wipememory(_ptr,_len) wipememory2(_ptr,0,_len)
  |  |  ------------------
  |  |  |  |  405|   130k|#define wipememory2(_ptr,_set,_len) do { \
  |  |  |  |  406|   130k|              volatile char *_vptr=(volatile char *)(_ptr); \
  |  |  |  |  407|   130k|              size_t _vlen=(_len); \
  |  |  |  |  408|   264M|              while(_vlen) { *_vptr=(_set); _vptr++; _vlen--; } \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (408:21): [True: 264M, False: 130k]
  |  |  |  |  ------------------
  |  |  |  |  409|   130k|                  } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (409:27): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  228|   130k|  wipememory (&ctx->outbound, sizeof ctx->outbound);
  ------------------
  |  |  410|   130k|#define wipememory(_ptr,_len) wipememory2(_ptr,0,_len)
  |  |  ------------------
  |  |  |  |  405|   130k|#define wipememory2(_ptr,_set,_len) do { \
  |  |  |  |  406|   130k|              volatile char *_vptr=(volatile char *)(_ptr); \
  |  |  |  |  407|   130k|              size_t _vlen=(_len); \
  |  |  |  |  408|   134M|              while(_vlen) { *_vptr=(_set); _vptr++; _vlen--; } \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (408:21): [True: 134M, False: 130k]
  |  |  |  |  ------------------
  |  |  |  |  409|   130k|                  } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (409:27): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  229|   130k|  _assuan_free (ctx, ctx);
  230|   130k|}

_assuan_debug:
   48|  1.30M|{
   49|  1.30M|  va_list arg_ptr;
   50|  1.30M|  int saved_errno;
   51|  1.30M|  char *msg;
   52|  1.30M|  int res;
   53|       |
   54|       |  /* vasprintf is an expensive operation thus we first check whether
   55|       |     the callback has enabled CAT for logging.  */
   56|  1.30M|  if (!ctx
  ------------------
  |  Branch (56:7): [True: 0, False: 1.30M]
  ------------------
   57|  1.30M|      || !ctx->log_cb
  ------------------
  |  Branch (57:10): [True: 0, False: 1.30M]
  ------------------
   58|  1.30M|      || !(*ctx->log_cb) (ctx, ctx->log_cb_data, cat, NULL))
  ------------------
  |  Branch (58:10): [True: 1.30M, False: 0]
  ------------------
   59|  1.30M|    return;
   60|       |
   61|      0|  saved_errno = errno;
   62|      0|  va_start (arg_ptr, format);
   63|      0|  res = gpgrt_vasprintf (&msg, format, arg_ptr);
   64|      0|  va_end (arg_ptr);
   65|      0|  if (res < 0)
  ------------------
  |  Branch (65:7): [True: 0, False: 0]
  ------------------
   66|      0|    return;
   67|      0|  ctx->log_cb (ctx, ctx->log_cb_data, cat, msg);
   68|      0|  gpgrt_free (msg);
   69|      0|  gpg_err_set_errno (saved_errno);
   70|      0|}

__assuan_close:
  103|   130k|{
  104|   130k|  return close (fd);
  105|   130k|}
__assuan_socket:
  421|   130k|{
  422|   130k|  return socket (namespace, style, protocol);
  423|   130k|}
__assuan_connect:
  429|   130k|{
  430|   130k|  return connect (sock, addr, length);
  431|   130k|}

_assuan_malloc:
   49|   130k|{
   50|   130k|  return ctx->malloc_hooks.malloc (cnt);
   51|   130k|}
_assuan_free:
   82|   130k|{
   83|   130k|  if (ptr)
  ------------------
  |  Branch (83:7): [True: 130k, False: 0]
  ------------------
   84|   130k|    ctx->malloc_hooks.free (ptr);
   85|   130k|}
_assuan_close:
  181|   130k|{
  182|   130k|  TRACE1 (ctx, ASSUAN_LOG_SYSIO, "_assuan_close", ctx,
  ------------------
  |  |  149|   130k|  _assuan_debug (ctx, lvl, "%s (%s=%p): call: " fmt "\n",		\
  |  |  150|   130k|		 name, STRINGIFY (tag), (void *) (uintptr_t) tag, arg1)
  |  |  ------------------
  |  |  |  |   35|   130k|#define STRINGIFY(v) #v
  |  |  ------------------
  ------------------
  183|   130k|	  "fd=0x%x", fd);
  184|       |
  185|   130k|  if (ctx->system.version)
  ------------------
  |  Branch (185:7): [True: 0, False: 130k]
  ------------------
  186|      0|    return (ctx->system.close) (ctx, fd);
  187|   130k|  else
  188|   130k|    {
  189|   130k|      int res;
  190|   130k|      _assuan_pre_syscall ();
  191|   130k|      res = __assuan_close (ctx, fd);
  192|   130k|      _assuan_post_syscall ();
  193|   130k|      return res;
  194|   130k|    }
  195|   130k|}
_assuan_socket:
  505|   130k|{
  506|   130k|  assuan_fd_t res;
  507|   130k|  TRACE_BEG3 (ctx, ASSUAN_LOG_SYSIO, "_assuan_socket", ctx,
  ------------------
  |  |  115|   130k|  _TRACE (ctx, lvl, name, tag);					      \
  |  |  ------------------
  |  |  |  |   84|   130k|  assuan_context_t _assuan_trace_context = ctx;				\
  |  |  |  |   85|   130k|  int _assuan_trace_level = lvl;					\
  |  |  |  |   86|   130k|  const char *const _assuan_trace_func = name;				\
  |  |  |  |   87|   130k|  const char *const _assuan_trace_tagname = STRINGIFY (tag);		\
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|   130k|#define STRINGIFY(v) #v
  |  |  |  |  ------------------
  |  |  |  |   88|   130k|  void *_assuan_trace_tag = (void *) (uintptr_t) tag
  |  |  ------------------
  |  |  116|   130k|  _assuan_debug (_assuan_trace_context, _assuan_trace_level,	      \
  |  |  117|   130k|		 "%s (%s=%p): enter: " fmt "\n",		      \
  |  |  118|   130k|		 _assuan_trace_func, _assuan_trace_tagname,	      \
  |  |  119|   130k|		 _assuan_trace_tag, arg1, arg2, arg3)
  ------------------
  508|   130k|	      "namespace=%i,style=%i,protocol=%i",
  509|   130k|	      namespace, style, protocol);
  510|       |
  511|   130k|  if (ctx->system.version)
  ------------------
  |  Branch (511:7): [True: 0, False: 130k]
  ------------------
  512|      0|    res = (ctx->system.socket) (ctx, namespace, style, protocol);
  513|   130k|  else
  514|   130k|    res = __assuan_socket (ctx, namespace, style, protocol);
  515|   130k|  return TRACE_SYSRES (res);
  ------------------
  |  |  179|   130k|  res >= 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) :		\
  |  |  ------------------
  |  |  |  |  200|   130k|  _assuan_debug (_assuan_trace_context, _assuan_trace_level,		\
  |  |  |  |  201|   130k|		 "%s (%s=%p): leave: " fmt "\n",			\
  |  |  |  |  202|   130k|		 _assuan_trace_func, _assuan_trace_tagname,		\
  |  |  |  |  203|   130k|		 _assuan_trace_tag, arg1), 0
  |  |  ------------------
  |  |  |  Branch (179:3): [True: 130k, False: 0]
  |  |  ------------------
  |  |  180|   130k|    (_assuan_debug (_assuan_trace_context, _assuan_trace_level, "%s (%s=%p): error: %s\n", \
  |  |  181|      0|		    _assuan_trace_func, _assuan_trace_tagname,		\
  |  |  182|      0|		   _assuan_trace_tag, strerror (errno)), (res))
  ------------------
  516|   130k|}
_assuan_connect:
  522|   130k|{
  523|   130k|  int res;
  524|   130k|  TRACE_BEG3 (ctx, ASSUAN_LOG_SYSIO, "_assuan_connect", ctx,
  ------------------
  |  |  115|   130k|  _TRACE (ctx, lvl, name, tag);					      \
  |  |  ------------------
  |  |  |  |   84|   130k|  assuan_context_t _assuan_trace_context = ctx;				\
  |  |  |  |   85|   130k|  int _assuan_trace_level = lvl;					\
  |  |  |  |   86|   130k|  const char *const _assuan_trace_func = name;				\
  |  |  |  |   87|   130k|  const char *const _assuan_trace_tagname = STRINGIFY (tag);		\
  |  |  |  |  ------------------
  |  |  |  |  |  |   35|   130k|#define STRINGIFY(v) #v
  |  |  |  |  ------------------
  |  |  |  |   88|   130k|  void *_assuan_trace_tag = (void *) (uintptr_t) tag
  |  |  ------------------
  |  |  116|   130k|  _assuan_debug (_assuan_trace_context, _assuan_trace_level,	      \
  |  |  117|   130k|		 "%s (%s=%p): enter: " fmt "\n",		      \
  |  |  118|   130k|		 _assuan_trace_func, _assuan_trace_tagname,	      \
  |  |  119|   130k|		 _assuan_trace_tag, arg1, arg2, arg3)
  ------------------
  525|   130k|	      "socket=%i,addr=%p,length=%i", sock, addr, length);
  526|       |
  527|   130k|  if (ctx->system.version)
  ------------------
  |  Branch (527:7): [True: 0, False: 130k]
  ------------------
  528|      0|    res = (ctx->system.connect) (ctx, sock, addr, length);
  529|   130k|  else
  530|   130k|    {
  531|   130k|      _assuan_pre_syscall ();
  532|   130k|      res = __assuan_connect (ctx, sock, addr, length);
  533|   130k|      _assuan_post_syscall ();
  534|   130k|    }
  535|   130k|  return TRACE_SYSRES (res);
  ------------------
  |  |  179|   130k|  res >= 0 ? ((void) (TRACE_SUC1 ("result=%i", res)), (res)) :		\
  |  |  ------------------
  |  |  |  |  200|      0|  _assuan_debug (_assuan_trace_context, _assuan_trace_level,		\
  |  |  |  |  201|      0|		 "%s (%s=%p): leave: " fmt "\n",			\
  |  |  |  |  202|      0|		 _assuan_trace_func, _assuan_trace_tagname,		\
  |  |  |  |  203|      0|		 _assuan_trace_tag, arg1), 0
  |  |  ------------------
  |  |  |  Branch (179:3): [True: 0, False: 130k]
  |  |  ------------------
  |  |  180|   130k|    (_assuan_debug (_assuan_trace_context, _assuan_trace_level, "%s (%s=%p): error: %s\n", \
  |  |  181|   130k|		    _assuan_trace_func, _assuan_trace_tagname,		\
  |  |  182|   130k|		   _assuan_trace_tag, strerror (errno)), (res))
  ------------------
  536|   130k|}

md5.c:_gcry_ctz:
   84|  2.75k|{
   85|  2.75k|#if defined (HAVE_BUILTIN_CTZ)
   86|  2.75k|  return x ? __builtin_ctz (x) : 8 * sizeof (x);
  ------------------
  |  Branch (86:10): [True: 2.75k, 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|  2.75k|}
md5.c:rol:
   29|   537k|{
   30|   537k|	return ( (x << (n&(32-1))) | (x >> ((32-n)&(32-1))) );
   31|   537k|}
rmd160.c:_gcry_ctz:
   84|  7.16k|{
   85|  7.16k|#if defined (HAVE_BUILTIN_CTZ)
   86|  7.16k|  return x ? __builtin_ctz (x) : 8 * sizeof (x);
  ------------------
  |  Branch (86:10): [True: 7.16k, 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.16k|}
rmd160.c:rol:
   29|  8.03M|{
   30|  8.03M|	return ( (x << (n&(32-1))) | (x >> ((32-n)&(32-1))) );
   31|  8.03M|}
sha1.c:_gcry_ctz:
   84|   148k|{
   85|   148k|#if defined (HAVE_BUILTIN_CTZ)
   86|   148k|  return x ? __builtin_ctz (x) : 8 * sizeof (x);
  ------------------
  |  Branch (86:10): [True: 148k, 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|   148k|}
sha256.c:_gcry_ctz:
   84|  9.05k|{
   85|  9.05k|#if defined (HAVE_BUILTIN_CTZ)
   86|  9.05k|  return x ? __builtin_ctz (x) : 8 * sizeof (x);
  ------------------
  |  Branch (86:10): [True: 9.05k, 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|  9.05k|}
sha512.c:_gcry_ctz:
   84|  9.10k|{
   85|  9.10k|#if defined (HAVE_BUILTIN_CTZ)
   86|  9.10k|  return x ? __builtin_ctz (x) : 8 * sizeof (x);
  ------------------
  |  Branch (86:10): [True: 9.10k, 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|  9.10k|}
tiger.c:_gcry_ctz:
   84|    314|{
   85|    314|#if defined (HAVE_BUILTIN_CTZ)
   86|    314|  return x ? __builtin_ctz (x) : 8 * sizeof (x);
  ------------------
  |  Branch (86:10): [True: 314, 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|    314|}

md5.c:buf_get_le32:
  136|   134k|{
  137|   134k|  return le_bswap32(((const bufhelp_u32_t *)_buf)->a);
  ------------------
  |  |   72|   134k|# define le_bswap32(x) ((u32)(x))
  ------------------
  138|   134k|}
md5.c:buf_put_le32:
  147|  8.66k|{
  148|  8.66k|  bufhelp_u32_t *out = _buf;
  149|  8.66k|  out->a = le_bswap32(val);
  ------------------
  |  |   72|  8.66k|# define le_bswap32(x) ((u32)(x))
  ------------------
  150|  8.66k|}
rmd160.c:buf_get_le32:
  136|   401k|{
  137|   401k|  return le_bswap32(((const bufhelp_u32_t *)_buf)->a);
  ------------------
  |  |   72|   401k|# define le_bswap32(x) ((u32)(x))
  ------------------
  138|   401k|}
rmd160.c:buf_put_le32:
  147|  6.94k|{
  148|  6.94k|  bufhelp_u32_t *out = _buf;
  149|  6.94k|  out->a = le_bswap32(val);
  ------------------
  |  |   72|  6.94k|# define le_bswap32(x) ((u32)(x))
  ------------------
  150|  6.94k|}
sha1.c:buf_put_be32:
  141|   605k|{
  142|   605k|  bufhelp_u32_t *out = _buf;
  143|   605k|  out->a = be_bswap32(val);
  ------------------
  |  |   73|   605k|# define be_bswap32(x) _gcry_bswap32(x)
  |  |  ------------------
  |  |  |  |   46|   605k|# define _gcry_bswap32 __builtin_bswap32
  |  |  ------------------
  ------------------
  144|   605k|}
sha256.c:buf_put_be32:
  141|  61.6k|{
  142|  61.6k|  bufhelp_u32_t *out = _buf;
  143|  61.6k|  out->a = be_bswap32(val);
  ------------------
  |  |   73|  61.6k|# define be_bswap32(x) _gcry_bswap32(x)
  |  |  ------------------
  |  |  |  |   46|  61.6k|# define _gcry_bswap32 __builtin_bswap32
  |  |  ------------------
  ------------------
  144|  61.6k|}
sha512.c:buf_put_be64:
  171|  75.4k|{
  172|  75.4k|  bufhelp_u64_t *out = _buf;
  173|  75.4k|  out->a = be_bswap64(val);
  ------------------
  |  |   75|  75.4k|# define be_bswap64(x) _gcry_bswap64(x)
  |  |  ------------------
  |  |  |  |   56|  75.4k|# define _gcry_bswap64 __builtin_bswap64
  |  |  ------------------
  ------------------
  174|  75.4k|}
tiger.c:buf_get_le64:
  166|  57.4k|{
  167|  57.4k|  return le_bswap64(((const bufhelp_u64_t *)_buf)->a);
  ------------------
  |  |   74|  57.4k|# define le_bswap64(x) ((u64)(x))
  ------------------
  168|  57.4k|}
crc.c:buf_put_le32:
  147|  15.6k|{
  148|  15.6k|  bufhelp_u32_t *out = _buf;
  149|  15.6k|  out->a = le_bswap32(val);
  ------------------
  |  |   72|  15.6k|# define le_bswap32(x) ((u32)(x))
  ------------------
  150|  15.6k|}
hash-common.c:buf_cpy:
  203|   275k|{
  204|   275k|  byte *dst = _dst;
  205|   275k|  const byte *src = _src;
  206|       |
  207|   275k|#if __GNUC__ >= 4
  208|   275k|  if (!__builtin_constant_p (len))
  ------------------
  |  Branch (208:7): [True: 275k, False: 0]
  ------------------
  209|   275k|    {
  210|   275k|      if (UNLIKELY(len == 0))
  ------------------
  |  |   86|   275k|#define UNLIKELY(expr)    __builtin_expect( !!(expr), 0 )
  |  |  ------------------
  |  |  |  Branch (86:27): [True: 0, False: 275k]
  |  |  ------------------
  ------------------
  211|      0|	return;
  212|   275k|      memcpy(_dst, _src, len);
  213|   275k|      return;
  214|   275k|    }
  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_algo_info:
 1893|   128k|{
 1894|   128k|  gcry_err_code_t rc = 0;
 1895|   128k|  unsigned int ui;
 1896|       |
 1897|   128k|  switch (what)
 1898|   128k|    {
 1899|      0|    case GCRYCTL_GET_KEYLEN:
  ------------------
  |  Branch (1899:5): [True: 0, False: 128k]
  ------------------
 1900|      0|      if (buffer || (! nbytes))
  ------------------
  |  Branch (1900:11): [True: 0, False: 0]
  |  Branch (1900:21): [True: 0, False: 0]
  ------------------
 1901|      0|	rc = GPG_ERR_CIPHER_ALGO;
 1902|      0|      else
 1903|      0|	{
 1904|      0|	  ui = cipher_get_keylen (algo);
 1905|      0|	  if ((ui > 0) && (ui <= 512))
  ------------------
  |  Branch (1905:8): [True: 0, False: 0]
  |  Branch (1905:20): [True: 0, False: 0]
  ------------------
 1906|      0|	    *nbytes = (size_t) ui / 8;
 1907|      0|	  else
 1908|       |	    /* The only reason for an error is an invalid algo.  */
 1909|      0|	    rc = GPG_ERR_CIPHER_ALGO;
 1910|      0|	}
 1911|      0|      break;
 1912|       |
 1913|      0|    case GCRYCTL_GET_BLKLEN:
  ------------------
  |  Branch (1913:5): [True: 0, False: 128k]
  ------------------
 1914|      0|      if (buffer || (! nbytes))
  ------------------
  |  Branch (1914:11): [True: 0, False: 0]
  |  Branch (1914:21): [True: 0, False: 0]
  ------------------
 1915|      0|	rc = GPG_ERR_CIPHER_ALGO;
 1916|      0|      else
 1917|      0|	{
 1918|      0|	  ui = cipher_get_blocksize (algo);
 1919|      0|	  if ((ui > 0) && (ui < 10000))
  ------------------
  |  Branch (1919:8): [True: 0, False: 0]
  |  Branch (1919:20): [True: 0, False: 0]
  ------------------
 1920|      0|	    *nbytes = ui;
 1921|      0|	  else
 1922|      0|            {
 1923|       |              /* The only reason is an invalid algo or a strange
 1924|       |                 blocksize.  */
 1925|      0|              rc = GPG_ERR_CIPHER_ALGO;
 1926|      0|            }
 1927|      0|	}
 1928|      0|      break;
 1929|       |
 1930|   128k|    case GCRYCTL_TEST_ALGO:
  ------------------
  |  Branch (1930:5): [True: 128k, False: 0]
  ------------------
 1931|   128k|      if (buffer || nbytes)
  ------------------
  |  Branch (1931:11): [True: 0, False: 128k]
  |  Branch (1931:21): [True: 0, False: 128k]
  ------------------
 1932|      0|	rc = GPG_ERR_INV_ARG;
 1933|   128k|      else
 1934|   128k|	rc = check_cipher_algo (algo);
 1935|   128k|      break;
 1936|       |
 1937|      0|      default:
  ------------------
  |  Branch (1937:7): [True: 0, False: 128k]
  ------------------
 1938|      0|	rc = GPG_ERR_INV_OP;
 1939|   128k|    }
 1940|       |
 1941|   128k|  return rc;
 1942|   128k|}
_gcry_cipher_init:
 1984|      1|{
 1985|      1|  return 0;
 1986|      1|}
cipher.c:spec_from_algo:
  231|   128k|{
  232|   128k|  gcry_cipher_spec_t *spec = NULL;
  233|       |
  234|   128k|  algo = map_algo (algo);
  235|       |
  236|   128k|  if (algo >= 0 && algo < DIM(cipher_list_algo0))
  ------------------
  |  |  104|   128k|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (236:7): [True: 128k, False: 0]
  |  Branch (236:20): [True: 127k, False: 323]
  ------------------
  237|   127k|    spec = cipher_list_algo0[algo];
  238|    323|  else if (algo >= 301 && algo < 301 + DIM(cipher_list_algo301))
  ------------------
  |  |  104|    323|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (238:12): [True: 323, False: 0]
  |  Branch (238:27): [True: 323, False: 0]
  ------------------
  239|    323|    spec = cipher_list_algo301[algo - 301];
  240|       |
  241|   128k|  if (spec)
  ------------------
  |  Branch (241:7): [True: 128k, False: 0]
  ------------------
  242|   128k|    gcry_assert (spec->algo == algo);
  ------------------
  |  |  188|   128k|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|   128k|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 128k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|   128k|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  243|       |
  244|      0|  return spec;
  245|   128k|}
cipher.c:map_algo:
  222|   128k|{
  223|   128k|  return algo;
  224|   128k|}
cipher.c:check_cipher_algo:
  411|   128k|{
  412|   128k|  gcry_cipher_spec_t *spec;
  413|       |
  414|   128k|  spec = spec_from_algo (algorithm);
  415|   128k|  if (spec && !spec->flags.disabled && (spec->flags.fips || !fips_mode ()))
  ------------------
  |  |  449|   127k|#define fips_mode() (!_gcry_no_fips_mode_required)
  ------------------
  |  Branch (415:7): [True: 128k, False: 0]
  |  Branch (415:15): [True: 128k, False: 0]
  |  Branch (415:41): [True: 1.00k, False: 127k]
  |  Branch (415:61): [True: 127k, False: 0]
  ------------------
  416|   128k|    return 0;
  417|       |
  418|      0|  return GPG_ERR_CIPHER_ALGO;
  419|   128k|}

crc.c:crc32_read:
  485|    536|{
  486|    536|  CRC_CONTEXT *ctx = (CRC_CONTEXT *) context;
  487|    536|  return ctx->buf;
  488|    536|}
crc.c:crc24rfc2440_init:
  840|  21.1k|{
  841|  21.1k|  CRC_CONTEXT *ctx = (CRC_CONTEXT *) context;
  842|  21.1k|  u32 hwf = _gcry_get_hw_features ();
  843|       |
  844|  21.1k|#ifdef USE_INTEL_PCLMUL
  845|  21.1k|  ctx->use_pclmul = (hwf & HWF_INTEL_SSE4_1) && (hwf & HWF_INTEL_PCLMUL);
  ------------------
  |  |  230|  21.1k|#define HWF_INTEL_SSE4_1        (1 << 8)
  ------------------
                ctx->use_pclmul = (hwf & HWF_INTEL_SSE4_1) && (hwf & HWF_INTEL_PCLMUL);
  ------------------
  |  |  231|  21.1k|#define HWF_INTEL_PCLMUL        (1 << 9)
  ------------------
  |  Branch (845:21): [True: 21.1k, False: 0]
  |  Branch (845:49): [True: 21.1k, False: 0]
  ------------------
  846|  21.1k|#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|  21.1k|  (void)hwf;
  855|  21.1k|  (void)flags;
  856|       |
  857|  21.1k|  ctx->CRC = crc24_init();
  858|  21.1k|}
crc.c:crc24_init:
  807|  21.1k|{
  808|       |  /* Transformed to 32-bit CRC by multiplied by x⁸ and then byte swapped. */
  809|  21.1k|  return 0xce04b7; /* _gcry_bswap(0xb704ce << 8) */
  810|  21.1k|}
crc.c:crc24rfc2440_write:
  862|  8.93k|{
  863|  8.93k|  const unsigned char *inbuf = inbuf_arg;
  864|  8.93k|  CRC_CONTEXT *ctx = (CRC_CONTEXT *) context;
  865|  8.93k|  u32 crc;
  866|       |
  867|  8.93k|#ifdef USE_INTEL_PCLMUL
  868|  8.93k|  if (ctx->use_pclmul)
  ------------------
  |  Branch (868:7): [True: 8.93k, False: 0]
  ------------------
  869|  8.93k|    {
  870|  8.93k|      _gcry_crc24rfc2440_intel_pclmul(&ctx->CRC, inbuf, inlen);
  871|  8.93k|      return;
  872|  8.93k|    }
  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|  15.6k|{
  922|  15.6k|  CRC_CONTEXT *ctx = (CRC_CONTEXT *) context;
  923|  15.6k|  ctx->CRC = crc24_final(ctx->CRC);
  924|  15.6k|  buf_put_le32 (ctx->buf, ctx->CRC);
  925|  15.6k|}
crc.c:crc24_final:
  834|  15.6k|{
  835|  15.6k|  return crc & 0xffffff;
  836|  15.6k|}

_gcry_dsa_normalize_hash:
  452|  3.98k|{
  453|  3.98k|  gpg_err_code_t rc = 0;
  454|  3.98k|  const void *abuf;
  455|  3.98k|  unsigned int abits;
  456|  3.98k|  gcry_mpi_t hash;
  457|       |
  458|  3.98k|  if (mpi_is_opaque (input))
  ------------------
  |  |  114|  3.98k|#define mpi_is_opaque(a)      ((a) && ((a)->flags&4))
  |  |  ------------------
  |  |  |  Branch (114:32): [True: 3.98k, False: 0]
  |  |  |  Branch (114:39): [True: 0, False: 3.98k]
  |  |  ------------------
  ------------------
  459|      0|    {
  460|      0|      abuf = mpi_get_opaque (input, &abits);
  ------------------
  |  |  562|      0|#define mpi_get_opaque(a,b)    _gcry_mpi_get_opaque ((a), (b))
  ------------------
  461|      0|      rc = _gcry_mpi_scan (&hash, GCRYMPI_FMT_USG, abuf, (abits+7)/8, NULL);
  462|      0|      if (rc)
  ------------------
  |  Branch (462:11): [True: 0, False: 0]
  ------------------
  463|      0|        return rc;
  464|      0|      if (abits > qbits)
  ------------------
  |  Branch (464:11): [True: 0, False: 0]
  ------------------
  465|      0|        mpi_rshift (hash, hash, abits - qbits);
  ------------------
  |  |  558|      0|#define mpi_rshift(a,b,c)      _gcry_mpi_rshift ((a),(b),(c))
  ------------------
  466|      0|    }
  467|  3.98k|  else
  468|  3.98k|    hash = input;
  469|       |
  470|  3.98k|  *out = hash;
  471|       |
  472|  3.98k|  return rc;
  473|  3.98k|}

dsa.c:dsa_check_keysize:
  151|  2.29k|{
  152|  2.29k|  if (fips_mode () && nbits < 2048)
  ------------------
  |  |  449|  4.58k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 2.29k]
  |  |  ------------------
  ------------------
  |  Branch (152:23): [True: 0, False: 0]
  ------------------
  153|      0|    return GPG_ERR_INV_VALUE;
  154|       |
  155|  2.29k|  return 0;
  156|  2.29k|}
dsa.c:verify:
  716|  2.29k|{
  717|  2.29k|  gpg_err_code_t rc = 0;
  718|  2.29k|  gcry_mpi_t w, u1, u2, v;
  719|  2.29k|  gcry_mpi_t base[3];
  720|  2.29k|  gcry_mpi_t ex[3];
  721|  2.29k|  gcry_mpi_t hash;
  722|  2.29k|  unsigned int nbits;
  723|  2.29k|  gcry_mpi_t hash_computed_internally = NULL;
  724|       |
  725|  2.29k|  if( !(mpi_cmp_ui( r, 0 ) > 0 && mpi_cmp( r, pkey->q ) < 0) )
  ------------------
  |  |  512|  2.29k|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
                if( !(mpi_cmp_ui( r, 0 ) > 0 && mpi_cmp( r, pkey->q ) < 0) )
  ------------------
  |  |  510|  2.23k|#define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
  ------------------
  |  Branch (725:9): [True: 2.23k, False: 64]
  |  Branch (725:35): [True: 2.19k, False: 36]
  ------------------
  726|    100|    return GPG_ERR_BAD_SIGNATURE; /* Assertion	0 < r < n  failed.  */
  727|  2.19k|  if( !(mpi_cmp_ui( s, 0 ) > 0 && mpi_cmp( s, pkey->q ) < 0) )
  ------------------
  |  |  512|  2.19k|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
                if( !(mpi_cmp_ui( s, 0 ) > 0 && mpi_cmp( s, pkey->q ) < 0) )
  ------------------
  |  |  510|  2.19k|#define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
  ------------------
  |  Branch (727:9): [True: 2.19k, False: 0]
  |  Branch (727:35): [True: 2.05k, False: 143]
  ------------------
  728|    143|    return GPG_ERR_BAD_SIGNATURE; /* Assertion	0 < s < n  failed.  */
  729|       |
  730|  2.05k|  nbits = mpi_get_nbits (pkey->q);
  ------------------
  |  |  552|  2.05k|#define mpi_get_nbits(a)       _gcry_mpi_get_nbits ((a))
  ------------------
  731|  2.05k|  if ((flags & PUBKEY_FLAG_PREHASH))
  ------------------
  |  |   46|  2.05k|#define PUBKEY_FLAG_PREHASH        (1 << 17)
  ------------------
  |  Branch (731:7): [True: 0, False: 2.05k]
  ------------------
  732|      0|    {
  733|      0|      rc = _gcry_dsa_compute_hash (&hash_computed_internally, input, hashalgo);
  734|      0|      if (rc)
  ------------------
  |  Branch (734:11): [True: 0, False: 0]
  ------------------
  735|      0|        return rc;
  736|      0|      input = hash_computed_internally;
  737|      0|    }
  738|  2.05k|  rc = _gcry_dsa_normalize_hash (input, &hash, nbits);
  739|  2.05k|  if (rc)
  ------------------
  |  Branch (739:7): [True: 0, False: 2.05k]
  ------------------
  740|      0|    {
  741|      0|      mpi_free (hash_computed_internally);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  742|      0|      return rc;
  743|      0|    }
  744|       |
  745|  2.05k|  w  = mpi_alloc( mpi_get_nlimbs(pkey->q) );
  ------------------
  |  |   97|  2.05k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  746|  2.05k|  u1 = mpi_alloc( mpi_get_nlimbs(pkey->q) );
  ------------------
  |  |   97|  2.05k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  747|  2.05k|  u2 = mpi_alloc( mpi_get_nlimbs(pkey->q) );
  ------------------
  |  |   97|  2.05k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  748|  2.05k|  v  = mpi_alloc( mpi_get_nlimbs(pkey->p) );
  ------------------
  |  |   97|  2.05k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  749|       |
  750|       |  /* w = s^(-1) mod q */
  751|  2.05k|  mpi_invm( w, s, pkey->q );
  ------------------
  |  |  530|  2.05k|#define mpi_invm(g,a,b)        _gcry_mpi_invm ( (g), (a), (b) )
  ------------------
  752|       |
  753|       |  /* u1 = (hash * w) mod q */
  754|  2.05k|  mpi_mulm( u1, hash, w, pkey->q );
  ------------------
  |  |  524|  2.05k|#define mpi_mulm(w,u,v,m)      _gcry_mpi_mulm ((w),(u),(v),(m))
  ------------------
  755|       |
  756|       |  /* u2 = r * w mod q  */
  757|  2.05k|  mpi_mulm( u2, r, w, pkey->q );
  ------------------
  |  |  524|  2.05k|#define mpi_mulm(w,u,v,m)      _gcry_mpi_mulm ((w),(u),(v),(m))
  ------------------
  758|       |
  759|       |  /* v =  g^u1 * y^u2 mod p mod q */
  760|  2.05k|  base[0] = pkey->g; ex[0] = u1;
  761|  2.05k|  base[1] = pkey->y; ex[1] = u2;
  762|  2.05k|  base[2] = NULL;    ex[2] = NULL;
  763|  2.05k|  mpi_mulpowm( v, base, ex, pkey->p );
  ------------------
  |  |  213|  2.05k|#define mpi_mulpowm(a,b,c,d) _gcry_mpi_mulpowm ((a),(b),(c),(d))
  ------------------
  764|  2.05k|  mpi_fdiv_r( v, v, pkey->q );
  ------------------
  |  |  177|  2.05k|#define mpi_fdiv_r(a,b,c)      _gcry_mpi_fdiv_r((a),(b),(c))
  ------------------
  765|       |
  766|  2.05k|  if (mpi_cmp( v, r ))
  ------------------
  |  |  510|  2.05k|#define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
  |  |  ------------------
  |  |  |  Branch (510:32): [True: 1.95k, False: 100]
  |  |  ------------------
  ------------------
  767|  1.95k|    {
  768|  1.95k|      if (DBG_CIPHER)
  ------------------
  |  |   25|  1.95k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 1.95k]
  |  |  ------------------
  ------------------
  769|      0|        {
  770|      0|          log_mpidump ("     i", input);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
  771|      0|          log_mpidump ("     h", hash);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
  772|      0|          log_mpidump ("     v", v);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
  773|      0|          log_mpidump ("     r", r);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
  774|      0|          log_mpidump ("     s", s);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
  775|      0|        }
  776|  1.95k|      rc = GPG_ERR_BAD_SIGNATURE;
  777|  1.95k|    }
  778|       |
  779|  2.05k|  mpi_free(w);
  ------------------
  |  |   99|  2.05k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  780|  2.05k|  mpi_free(u1);
  ------------------
  |  |   99|  2.05k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  781|  2.05k|  mpi_free(u2);
  ------------------
  |  |   99|  2.05k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  782|  2.05k|  mpi_free(v);
  ------------------
  |  |   99|  2.05k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  783|  2.05k|  if (hash != input)
  ------------------
  |  Branch (783:7): [True: 0, False: 2.05k]
  ------------------
  784|      0|    mpi_free (hash);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  785|  2.05k|  mpi_free (hash_computed_internally);
  ------------------
  |  |   99|  2.05k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  786|       |
  787|  2.05k|  return rc;
  788|  2.05k|}
dsa.c:dsa_verify:
 1150|  2.29k|{
 1151|  2.29k|  gcry_err_code_t rc;
 1152|  2.29k|  struct pk_encoding_ctx ctx;
 1153|  2.29k|  gcry_sexp_t l1 = NULL;
 1154|  2.29k|  gcry_mpi_t sig_r = NULL;
 1155|  2.29k|  gcry_mpi_t sig_s = NULL;
 1156|  2.29k|  gcry_mpi_t data = NULL;
 1157|  2.29k|  DSA_public_key pk = { NULL, NULL, NULL, NULL };
 1158|  2.29k|  unsigned int nbits = dsa_get_nbits (s_keyparms);
 1159|       |
 1160|  2.29k|  rc = dsa_check_keysize (nbits);
 1161|  2.29k|  if (rc)
  ------------------
  |  Branch (1161:7): [True: 0, False: 2.29k]
  ------------------
 1162|      0|    return rc;
 1163|       |
 1164|  2.29k|  _gcry_pk_util_init_encoding_ctx (&ctx, PUBKEY_OP_VERIFY, nbits);
 1165|       |
 1166|       |  /* Extract the data.  */
 1167|  2.29k|  rc = _gcry_pk_util_data_to_mpi (s_data, &data, &ctx);
 1168|  2.29k|  if (rc)
  ------------------
  |  Branch (1168:7): [True: 0, False: 2.29k]
  ------------------
 1169|      0|    goto leave;
 1170|  2.29k|  if (DBG_CIPHER)
  ------------------
  |  |   25|  2.29k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 2.29k]
  |  |  ------------------
  ------------------
 1171|      0|    log_mpidump ("dsa_verify data", data);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
 1172|       |
 1173|       |  /* Extract the signature value.  */
 1174|  2.29k|  rc = _gcry_pk_util_preparse_sigval (s_sig, dsa_names, &l1, NULL);
 1175|  2.29k|  if (rc)
  ------------------
  |  Branch (1175:7): [True: 0, False: 2.29k]
  ------------------
 1176|      0|    goto leave;
 1177|  2.29k|  rc = _gcry_sexp_extract_param (l1, NULL, "rs", &sig_r, &sig_s, NULL);
 1178|  2.29k|  if (rc)
  ------------------
  |  Branch (1178:7): [True: 0, False: 2.29k]
  ------------------
 1179|      0|    goto leave;
 1180|  2.29k|  if (DBG_CIPHER)
  ------------------
  |  |   25|  2.29k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 2.29k]
  |  |  ------------------
  ------------------
 1181|      0|    {
 1182|      0|      log_mpidump ("dsa_verify  s_r", sig_r);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
 1183|      0|      log_mpidump ("dsa_verify  s_s", sig_s);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
 1184|      0|    }
 1185|       |
 1186|       |  /* Extract the key.  */
 1187|  2.29k|  rc = _gcry_sexp_extract_param (s_keyparms, NULL, "pqgy",
 1188|  2.29k|                                 &pk.p, &pk.q, &pk.g, &pk.y, NULL);
 1189|  2.29k|  if (rc)
  ------------------
  |  Branch (1189:7): [True: 0, False: 2.29k]
  ------------------
 1190|      0|    goto leave;
 1191|  2.29k|  if (DBG_CIPHER)
  ------------------
  |  |   25|  2.29k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 2.29k]
  |  |  ------------------
  ------------------
 1192|      0|    {
 1193|      0|      log_mpidump ("dsa_verify    p", pk.p);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
 1194|      0|      log_mpidump ("dsa_verify    q", pk.q);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
 1195|      0|      log_mpidump ("dsa_verify    g", pk.g);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
 1196|      0|      log_mpidump ("dsa_verify    y", pk.y);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
 1197|      0|    }
 1198|       |
 1199|       |  /* Verify the signature.  */
 1200|  2.29k|  rc = verify (sig_r, sig_s, data, &pk, ctx.flags, ctx.hash_algo);
 1201|       |
 1202|  2.29k| leave:
 1203|  2.29k|  _gcry_mpi_release (pk.p);
 1204|  2.29k|  _gcry_mpi_release (pk.q);
 1205|  2.29k|  _gcry_mpi_release (pk.g);
 1206|  2.29k|  _gcry_mpi_release (pk.y);
 1207|  2.29k|  _gcry_mpi_release (data);
 1208|  2.29k|  _gcry_mpi_release (sig_r);
 1209|  2.29k|  _gcry_mpi_release (sig_s);
 1210|  2.29k|  sexp_release (l1);
  ------------------
  |  |  372|  2.29k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1211|  2.29k|  _gcry_pk_util_free_encoding_ctx (&ctx);
 1212|  2.29k|  if (DBG_CIPHER)
  ------------------
  |  |   25|  2.29k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 2.29k]
  |  |  ------------------
  ------------------
 1213|      0|    log_debug ("dsa_verify    => %s\n", rc?gpg_strerror (rc):"Good");
  ------------------
  |  |  205|      0|#define log_debug   _gcry_log_debug
  ------------------
  |  Branch (1213:41): [True: 0, False: 0]
  ------------------
 1214|  2.29k|  return rc;
 1215|  2.29k|}
dsa.c:dsa_get_nbits:
 1232|  3.59k|{
 1233|  3.59k|  gcry_sexp_t l1;
 1234|  3.59k|  gcry_mpi_t p;
 1235|  3.59k|  unsigned int nbits;
 1236|       |
 1237|  3.59k|  l1 = sexp_find_token (parms, "p", 1);
  ------------------
  |  |  381|  3.59k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
 1238|  3.59k|  if (!l1)
  ------------------
  |  Branch (1238:7): [True: 0, False: 3.59k]
  ------------------
 1239|      0|    return 0; /* Parameter P not found.  */
 1240|       |
 1241|  3.59k|  p = sexp_nth_mpi (l1, 1, GCRYMPI_FMT_USG);
  ------------------
  |  |  390|  3.59k|#define sexp_nth_mpi(a, b, c)        _gcry_sexp_nth_mpi ((a), (b), (c))
  ------------------
 1242|  3.59k|  sexp_release (l1);
  ------------------
  |  |  372|  3.59k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1243|  3.59k|  nbits = p? mpi_get_nbits (p) : 0;
  ------------------
  |  |  552|  3.59k|#define mpi_get_nbits(a)       _gcry_mpi_get_nbits ((a))
  ------------------
  |  Branch (1243:11): [True: 3.59k, False: 0]
  ------------------
 1244|  3.59k|  _gcry_mpi_release (p);
 1245|  3.59k|  return nbits;
 1246|  3.59k|}

_gcry_ecc_fill_in_curve:
  621|  14.6k|{
  622|  14.6k|  int idx;
  623|  14.6k|  const char *resname = NULL; /* Set to a found curve name.  */
  624|       |
  625|  14.6k|  if (name)
  ------------------
  |  Branch (625:7): [True: 14.6k, False: 0]
  ------------------
  626|  14.6k|    idx = find_domain_parms_idx (name);
  627|      0|  else
  628|      0|    {
  629|      0|      for (idx = 0; domain_parms[idx].desc; idx++)
  ------------------
  |  Branch (629:21): [True: 0, False: 0]
  ------------------
  630|      0|        if (nbits == domain_parms[idx].nbits
  ------------------
  |  Branch (630:13): [True: 0, False: 0]
  ------------------
  631|      0|            && domain_parms[idx].model == MPI_EC_WEIERSTRASS)
  ------------------
  |  Branch (631:16): [True: 0, False: 0]
  ------------------
  632|      0|          break;
  633|      0|      if (!domain_parms[idx].desc)
  ------------------
  |  Branch (633:11): [True: 0, False: 0]
  ------------------
  634|      0|        idx = -1;
  635|      0|    }
  636|  14.6k|  if (idx < 0)
  ------------------
  |  Branch (636:7): [True: 56, False: 14.5k]
  ------------------
  637|     56|    return GPG_ERR_UNKNOWN_CURVE;
  638|       |
  639|  14.5k|  resname = domain_parms[idx].desc;
  640|       |
  641|       |  /* In fips mode we only support NIST curves.  Note that it is
  642|       |     possible to bypass this check by specifying the curve parameters
  643|       |     directly.  */
  644|  14.5k|  if (fips_mode () && !domain_parms[idx].fips )
  ------------------
  |  |  449|  29.1k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 14.5k]
  |  |  ------------------
  ------------------
  |  Branch (644:23): [True: 0, False: 0]
  ------------------
  645|      0|    return GPG_ERR_NOT_SUPPORTED;
  646|       |
  647|  14.5k|  switch (domain_parms[idx].model)
  648|  14.5k|    {
  649|  5.41k|    case MPI_EC_WEIERSTRASS:
  ------------------
  |  Branch (649:5): [True: 5.41k, False: 9.18k]
  ------------------
  650|  14.5k|    case MPI_EC_EDWARDS:
  ------------------
  |  Branch (650:5): [True: 9.18k, False: 5.41k]
  ------------------
  651|  14.5k|    case MPI_EC_MONTGOMERY:
  ------------------
  |  Branch (651:5): [True: 0, False: 14.5k]
  ------------------
  652|  14.5k|      break;
  653|      0|    default:
  ------------------
  |  Branch (653:5): [True: 0, False: 14.5k]
  ------------------
  654|      0|      return GPG_ERR_BUG;
  655|  14.5k|    }
  656|       |
  657|       |
  658|  14.5k|  if (r_nbits)
  ------------------
  |  Branch (658:7): [True: 7.29k, False: 7.29k]
  ------------------
  659|  7.29k|    *r_nbits = domain_parms[idx].nbits;
  660|       |
  661|  14.5k|  if (curve)
  ------------------
  |  Branch (661:7): [True: 7.29k, False: 7.29k]
  ------------------
  662|  7.29k|    {
  663|  7.29k|      curve->model = domain_parms[idx].model;
  664|  7.29k|      curve->dialect = domain_parms[idx].dialect;
  665|  7.29k|      if (!curve->p)
  ------------------
  |  Branch (665:11): [True: 7.29k, False: 0]
  ------------------
  666|  7.29k|        curve->p = scanval (domain_parms[idx].p);
  667|  7.29k|      if (!curve->a)
  ------------------
  |  Branch (667:11): [True: 7.29k, False: 0]
  ------------------
  668|  7.29k|        {
  669|  7.29k|          curve->a = scanval (domain_parms[idx].a);
  670|  7.29k|          if (curve->a->sign)
  ------------------
  |  Branch (670:15): [True: 4.59k, False: 2.70k]
  ------------------
  671|  4.59k|            {
  672|  4.59k|              mpi_resize (curve->a, curve->p->nlimbs);
  ------------------
  |  |  100|  4.59k|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
  673|  4.59k|              _gcry_mpih_sub_n (curve->a->d, curve->p->d,
  674|  4.59k|                                curve->a->d, curve->p->nlimbs);
  675|  4.59k|              curve->a->nlimbs = curve->p->nlimbs;
  676|  4.59k|              curve->a->sign = 0;
  677|  4.59k|            }
  678|  7.29k|        }
  679|  7.29k|      if (!curve->b)
  ------------------
  |  Branch (679:11): [True: 7.29k, False: 0]
  ------------------
  680|  7.29k|        {
  681|  7.29k|          curve->b = scanval (domain_parms[idx].b);
  682|  7.29k|          if (curve->b->sign)
  ------------------
  |  Branch (682:15): [True: 4.59k, False: 2.70k]
  ------------------
  683|  4.59k|            {
  684|  4.59k|              mpi_resize (curve->b, curve->p->nlimbs);
  ------------------
  |  |  100|  4.59k|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
  685|  4.59k|              _gcry_mpih_sub_n (curve->b->d, curve->p->d,
  686|  4.59k|                                curve->b->d, curve->p->nlimbs);
  687|  4.59k|              curve->b->nlimbs = curve->p->nlimbs;
  688|  4.59k|              curve->b->sign = 0;
  689|  4.59k|            }
  690|  7.29k|        }
  691|  7.29k|      if (!curve->n)
  ------------------
  |  Branch (691:11): [True: 7.29k, False: 0]
  ------------------
  692|  7.29k|        curve->n = scanval (domain_parms[idx].n);
  693|  7.29k|      if (!curve->G.x)
  ------------------
  |  Branch (693:11): [True: 7.29k, False: 0]
  ------------------
  694|  7.29k|        curve->G.x = scanval (domain_parms[idx].g_x);
  695|  7.29k|      if (!curve->G.y)
  ------------------
  |  Branch (695:11): [True: 7.29k, False: 0]
  ------------------
  696|  7.29k|        curve->G.y = scanval (domain_parms[idx].g_y);
  697|  7.29k|      curve->h = domain_parms[idx].h;
  698|       |
  699|       |      /*
  700|       |       * In the constants of domain_parms, we defined Curve25519
  701|       |       * domain parameters as the ones in RFC-7748 before the errata
  702|       |       * (eid4730).  To keep the computation having exact same values,
  703|       |       * we recover the new value of g_y, here.
  704|       |       */
  705|  7.29k|      if (!strcmp (resname, "Curve25519"))
  ------------------
  |  Branch (705:11): [True: 0, False: 7.29k]
  ------------------
  706|      0|        mpi_sub (curve->G.y, curve->p, curve->G.y);
  ------------------
  |  |  519|      0|#define mpi_sub(w,u,v)         _gcry_mpi_sub ((w),(u),(v))
  ------------------
  707|       |
  708|  7.29k|      if (!curve->G.z)
  ------------------
  |  Branch (708:11): [True: 7.29k, False: 0]
  ------------------
  709|  7.29k|        curve->G.z = mpi_alloc_set_ui (1);
  ------------------
  |  |  119|  7.29k|#define mpi_alloc_set_ui(a)   _gcry_mpi_alloc_set_ui ((a))
  ------------------
  710|  7.29k|      if (!curve->name)
  ------------------
  |  Branch (710:11): [True: 7.29k, False: 0]
  ------------------
  711|  7.29k|        curve->name = resname;
  712|  7.29k|    }
  713|       |
  714|  14.5k|  return 0;
  715|  14.5k|}
_gcry_mpi_ec_internal_new:
 1261|  7.32k|{
 1262|  7.32k|  gpg_err_code_t errc;
 1263|  7.32k|  elliptic_curve_t E;
 1264|  7.32k|  mpi_ec_t ec;
 1265|       |
 1266|  7.32k|  *r_ec = NULL;
 1267|       |
 1268|  7.32k|  memset (&E, 0, sizeof E);
 1269|  7.32k|  errc = mpi_ec_get_elliptic_curve (&E, r_flags, keyparam, curvename);
 1270|  7.32k|  if (errc)
  ------------------
  |  Branch (1270:7): [True: 28, False: 7.29k]
  ------------------
 1271|     28|    goto leave;
 1272|       |
 1273|  7.29k|  ec = _gcry_mpi_ec_p_internal_new (E.model, E.dialect, *r_flags,
 1274|  7.29k|                                    E.p, E.a, E.b);
 1275|  7.29k|  if (!ec)
  ------------------
  |  Branch (1275:7): [True: 0, False: 7.29k]
  ------------------
 1276|      0|    goto leave;
 1277|       |
 1278|  7.29k|  errc = mpi_ec_setup_elliptic_curve (ec, *r_flags, &E, keyparam);
 1279|  7.29k|  if (errc)
  ------------------
  |  Branch (1279:7): [True: 0, False: 7.29k]
  ------------------
 1280|      0|    {
 1281|      0|      _gcry_mpi_ec_free (ec);
 1282|      0|      goto leave;
 1283|      0|    }
 1284|  7.29k|  else
 1285|  7.29k|    *r_ec = ec;
 1286|       |
 1287|  7.29k|  if (!errc && DBG_CIPHER)
  ------------------
  |  |   25|  7.29k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 7.29k]
  |  |  ------------------
  ------------------
  |  Branch (1287:7): [True: 7.29k, False: 0]
  ------------------
 1288|      0|    {
 1289|      0|      gcry_mpi_t mpi_q = NULL;
 1290|      0|      gcry_sexp_t l1;
 1291|      0|      char msg[80];
 1292|       |
 1293|      0|      l1 = sexp_find_token (keyparam, "q", 0);
  ------------------
  |  |  381|      0|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
 1294|      0|      if (l1)
  ------------------
  |  Branch (1294:11): [True: 0, False: 0]
  ------------------
 1295|      0|        {
 1296|      0|          mpi_q = sexp_nth_mpi (l1, 1, GCRYMPI_FMT_OPAQUE);
  ------------------
  |  |  390|      0|#define sexp_nth_mpi(a, b, c)        _gcry_sexp_nth_mpi ((a), (b), (c))
  ------------------
 1297|      0|          sexp_release (l1);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1298|      0|        }
 1299|       |
 1300|      0|      log_debug ("%s info: %s/%s%s\n", name_op,
  ------------------
  |  |  205|      0|#define log_debug   _gcry_log_debug
  ------------------
 1301|      0|                 _gcry_ecc_model2str (ec->model),
 1302|      0|                 _gcry_ecc_dialect2str (ec->dialect),
 1303|      0|                 (*r_flags & PUBKEY_FLAG_EDDSA)? "+EdDSA" : "");
  ------------------
  |  |   41|      0|#define PUBKEY_FLAG_EDDSA          (1 << 12)
  ------------------
  |  Branch (1303:18): [True: 0, False: 0]
  ------------------
 1304|      0|      if (ec->name)
  ------------------
  |  Branch (1304:11): [True: 0, False: 0]
  ------------------
 1305|      0|        log_debug  ("%s name: %s\n", name_op, ec->name);
  ------------------
  |  |  205|      0|#define log_debug   _gcry_log_debug
  ------------------
 1306|      0|      snprintf (msg, sizeof msg, "%s    p", name_op);
 1307|      0|      log_printmpi (msg, ec->p);
  ------------------
  |  |  208|      0|#define log_printmpi _gcry_log_printmpi
  ------------------
 1308|      0|      snprintf (msg, sizeof msg, "%s    a", name_op);
 1309|      0|      log_printmpi (msg, ec->a);
  ------------------
  |  |  208|      0|#define log_printmpi _gcry_log_printmpi
  ------------------
 1310|      0|      snprintf (msg, sizeof msg, "%s    b", name_op);
 1311|      0|      log_printmpi (msg, ec->b);
  ------------------
  |  |  208|      0|#define log_printmpi _gcry_log_printmpi
  ------------------
 1312|      0|      snprintf (msg, sizeof msg, "%s  g", name_op);
 1313|      0|      log_printpnt (msg, ec->G, NULL);
  ------------------
  |  |  275|      0|#define log_printpnt(a,p,c) _gcry_mpi_point_log ((a), (p), (c))
  ------------------
 1314|      0|      snprintf (msg, sizeof msg, "%s    n", name_op);
 1315|      0|      log_printmpi (msg, ec->n);
  ------------------
  |  |  208|      0|#define log_printmpi _gcry_log_printmpi
  ------------------
 1316|      0|      log_debug ("%s    h:+%02x\n", name_op, ec->h);
  ------------------
  |  |  205|      0|#define log_debug   _gcry_log_debug
  ------------------
 1317|      0|      if (mpi_q)
  ------------------
  |  Branch (1317:11): [True: 0, False: 0]
  ------------------
 1318|      0|        {
 1319|      0|          snprintf (msg, sizeof msg, "%s    q", name_op);
 1320|      0|          log_printmpi (msg, mpi_q);
  ------------------
  |  |  208|      0|#define log_printmpi _gcry_log_printmpi
  ------------------
 1321|      0|          mpi_free (mpi_q);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
 1322|      0|        }
 1323|      0|      if (!fips_mode () && ec->d)
  ------------------
  |  |  449|      0|#define fips_mode() (!_gcry_no_fips_mode_required)
  ------------------
  |  Branch (1323:11): [True: 0, False: 0]
  |  Branch (1323:28): [True: 0, False: 0]
  ------------------
 1324|      0|        {
 1325|      0|          snprintf (msg, sizeof msg, "%s    d", name_op);
 1326|      0|          log_printmpi (msg, ec->d);
  ------------------
  |  |  208|      0|#define log_printmpi _gcry_log_printmpi
  ------------------
 1327|      0|        }
 1328|      0|    }
 1329|       |
 1330|  7.32k| leave:
 1331|  7.32k|  _gcry_ecc_curve_free (&E);
 1332|  7.32k|  return errc;
 1333|  7.29k|}
ecc-curves.c:find_domain_parms_idx:
  584|  14.6k|{
  585|  14.6k|  int idx, aliasno;
  586|       |
  587|       |  /* First check our native curves.  */
  588|   410k|  for (idx = 0; domain_parms[idx].desc; idx++)
  ------------------
  |  Branch (588:17): [True: 395k, False: 14.6k]
  ------------------
  589|   395k|    if (!strcmp (name, domain_parms[idx].desc))
  ------------------
  |  Branch (589:9): [True: 0, False: 395k]
  ------------------
  590|      0|      return idx;
  591|       |
  592|       |  /* If not found consult the alias table.  */
  593|  14.6k|  if (!domain_parms[idx].desc)
  ------------------
  |  Branch (593:7): [True: 14.6k, False: 0]
  ------------------
  594|  14.6k|    {
  595|   148k|      for (aliasno = 0; curve_aliases[aliasno].name; aliasno++)
  ------------------
  |  Branch (595:25): [True: 148k, False: 56]
  ------------------
  596|   148k|        if (!strcmp (name, curve_aliases[aliasno].other))
  ------------------
  |  Branch (596:13): [True: 14.5k, False: 134k]
  ------------------
  597|  14.5k|          break;
  598|  14.6k|      if (curve_aliases[aliasno].name)
  ------------------
  |  Branch (598:11): [True: 14.5k, False: 56]
  ------------------
  599|  14.5k|        {
  600|  72.0k|          for (idx = 0; domain_parms[idx].desc; idx++)
  ------------------
  |  Branch (600:25): [True: 72.0k, False: 0]
  ------------------
  601|  72.0k|            if (!strcmp (curve_aliases[aliasno].name, domain_parms[idx].desc))
  ------------------
  |  Branch (601:17): [True: 14.5k, False: 57.4k]
  ------------------
  602|  14.5k|              return idx;
  603|  14.5k|        }
  604|  14.6k|    }
  605|       |
  606|     56|  return -1;
  607|  14.6k|}
ecc-curves.c:scanval:
  569|  43.7k|{
  570|  43.7k|  gpg_err_code_t rc;
  571|  43.7k|  gcry_mpi_t val;
  572|       |
  573|  43.7k|  rc = _gcry_mpi_scan (&val, GCRYMPI_FMT_HEX, string, 0, NULL);
  574|  43.7k|  if (rc)
  ------------------
  |  Branch (574:7): [True: 0, False: 43.7k]
  ------------------
  575|      0|    log_fatal ("scanning ECC parameter failed: %s\n", gpg_strerror (rc));
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
  576|  43.7k|  return val;
  577|  43.7k|}
ecc-curves.c:point_from_keyparam:
  963|  7.29k|{
  964|  7.29k|  gcry_err_code_t rc;
  965|  7.29k|  gcry_sexp_t l1;
  966|  7.29k|  gcry_mpi_point_t point;
  967|       |
  968|  7.29k|  l1 = sexp_find_token (keyparam, name, 0);
  ------------------
  |  |  381|  7.29k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
  969|  7.29k|  if (l1)
  ------------------
  |  Branch (969:7): [True: 7.29k, False: 0]
  ------------------
  970|  7.29k|    {
  971|  7.29k|      gcry_mpi_t a;
  972|       |
  973|  7.29k|      a = sexp_nth_mpi (l1, 1, GCRYMPI_FMT_OPAQUE);
  ------------------
  |  |  390|  7.29k|#define sexp_nth_mpi(a, b, c)        _gcry_sexp_nth_mpi ((a), (b), (c))
  ------------------
  974|  7.29k|      sexp_release (l1);
  ------------------
  |  |  372|  7.29k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  975|  7.29k|      if (!a)
  ------------------
  |  Branch (975:11): [True: 0, False: 7.29k]
  ------------------
  976|      0|        return GPG_ERR_INV_OBJ;
  977|       |
  978|  7.29k|      point = mpi_point_new (0);
  ------------------
  |  |  532|  7.29k|#define mpi_point_new(n)       _gcry_mpi_point_new((n))
  ------------------
  979|  7.29k|      rc = _gcry_mpi_ec_decode_point (point, a, ec);
  980|  7.29k|      mpi_free (a);
  ------------------
  |  |   99|  7.29k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  981|  7.29k|      if (rc)
  ------------------
  |  Branch (981:11): [True: 0, False: 7.29k]
  ------------------
  982|      0|        {
  983|      0|          mpi_point_release (point);
  ------------------
  |  |  535|      0|  do                                             \
  |  |  536|      0|    {                                            \
  |  |  537|      0|      _gcry_mpi_point_release ((p));             \
  |  |  538|      0|      (p) = NULL;                                \
  |  |  539|      0|    }                                            \
  |  |  540|      0|  while (0)
  |  |  ------------------
  |  |  |  Branch (540:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  984|      0|          return rc;
  985|      0|        }
  986|  7.29k|    }
  987|      0|  else
  988|      0|    {
  989|      0|      char *tmpname;
  990|      0|      gcry_mpi_t x = NULL;
  991|      0|      gcry_mpi_t y = NULL;
  992|      0|      gcry_mpi_t z = NULL;
  993|       |
  994|      0|      tmpname = xtrymalloc (strlen (name) + 2 + 1);
  ------------------
  |  |  138|      0|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  995|      0|      if (!tmpname)
  ------------------
  |  Branch (995:11): [True: 0, False: 0]
  ------------------
  996|      0|        return gpg_err_code_from_syserror ();
  997|      0|      strcpy (stpcpy (tmpname, name), ".x");
  998|      0|      rc = mpi_from_keyparam (&x, keyparam, tmpname, 0);
  999|      0|      if (rc)
  ------------------
  |  Branch (999:11): [True: 0, False: 0]
  ------------------
 1000|      0|        {
 1001|      0|          xfree (tmpname);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1002|      0|          return rc;
 1003|      0|        }
 1004|      0|      strcpy (stpcpy (tmpname, name), ".y");
 1005|      0|      rc = mpi_from_keyparam (&y, keyparam, tmpname, 0);
 1006|      0|      if (rc)
  ------------------
  |  Branch (1006:11): [True: 0, False: 0]
  ------------------
 1007|      0|        {
 1008|      0|          mpi_free (x);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
 1009|      0|          xfree (tmpname);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1010|      0|          return rc;
 1011|      0|        }
 1012|      0|      strcpy (stpcpy (tmpname, name), ".z");
 1013|      0|      rc = mpi_from_keyparam (&z, keyparam, tmpname, 0);
 1014|      0|      if (rc)
  ------------------
  |  Branch (1014:11): [True: 0, False: 0]
  ------------------
 1015|      0|        {
 1016|      0|          mpi_free (y);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
 1017|      0|          mpi_free (x);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
 1018|      0|          xfree (tmpname);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1019|      0|          return rc;
 1020|      0|        }
 1021|      0|      if (!z)
  ------------------
  |  Branch (1021:11): [True: 0, False: 0]
  ------------------
 1022|      0|        z = mpi_set_ui (NULL, 1);
  ------------------
  |  |  505|      0|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
 1023|      0|      if (x && y)
  ------------------
  |  Branch (1023:11): [True: 0, False: 0]
  |  Branch (1023:16): [True: 0, False: 0]
  ------------------
 1024|      0|        point = mpi_point_snatch_set (NULL, x, y, z);
  ------------------
  |  |  548|      0|#define mpi_point_snatch_set(p,x,y,z) _gcry_mpi_point_snatch_set((p),(x), \
  |  |  549|      0|                                                                 (y),(z))
  ------------------
 1025|      0|      else
 1026|      0|        {
 1027|      0|          mpi_free (x);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
 1028|      0|          mpi_free (y);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
 1029|      0|          mpi_free (z);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
 1030|      0|          point = NULL;
 1031|      0|        }
 1032|      0|      xfree (tmpname);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1033|      0|    }
 1034|       |
 1035|  7.29k|  if (point)
  ------------------
  |  Branch (1035:7): [True: 7.29k, False: 0]
  ------------------
 1036|  7.29k|    *r_a = point;
 1037|  7.29k|  return 0;
 1038|  7.29k|}
ecc-curves.c:mpi_from_keyparam:
  940|  7.29k|{
  941|  7.29k|  gcry_err_code_t ec = 0;
  942|  7.29k|  gcry_sexp_t l1;
  943|       |
  944|  7.29k|  l1 = sexp_find_token (keyparam, name, 0);
  ------------------
  |  |  381|  7.29k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
  945|  7.29k|  if (l1)
  ------------------
  |  Branch (945:7): [True: 0, False: 7.29k]
  ------------------
  946|      0|    {
  947|      0|      *r_a = sexp_nth_mpi (l1, 1, opaque? GCRYMPI_FMT_OPAQUE : GCRYMPI_FMT_USG);
  ------------------
  |  |  390|      0|#define sexp_nth_mpi(a, b, c)        _gcry_sexp_nth_mpi ((a), (b), (c))
  |  |  ------------------
  |  |  |  Branch (390:69): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  948|      0|      sexp_release (l1);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  949|      0|      if (!*r_a)
  ------------------
  |  Branch (949:11): [True: 0, False: 0]
  ------------------
  950|      0|        ec = GPG_ERR_INV_OBJ;
  951|      0|    }
  952|  7.29k|  return ec;
  953|  7.29k|}
ecc-curves.c:mpi_ec_get_elliptic_curve:
 1045|  7.32k|{
 1046|  7.32k|  gpg_err_code_t errc;
 1047|  7.32k|  unsigned int nbits;
 1048|  7.32k|  gcry_sexp_t l1;
 1049|       |
 1050|  7.32k|  errc = _gcry_pk_util_get_nbits (keyparam, &nbits);
 1051|  7.32k|  if (errc)
  ------------------
  |  Branch (1051:7): [True: 0, False: 7.32k]
  ------------------
 1052|      0|    return errc;
 1053|       |
 1054|  7.32k|  E->model = MPI_EC_WEIERSTRASS;
 1055|  7.32k|  E->dialect = ECC_DIALECT_STANDARD;
 1056|  7.32k|  E->h = 1;
 1057|       |
 1058|  7.32k|  if (keyparam)
  ------------------
  |  Branch (1058:7): [True: 7.32k, False: 0]
  ------------------
 1059|  7.32k|    {
 1060|       |      /* Parse an optional flags list.  */
 1061|  7.32k|      l1 = sexp_find_token (keyparam, "flags", 0);
  ------------------
  |  |  381|  7.32k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
 1062|  7.32k|      if (l1)
  ------------------
  |  Branch (1062:11): [True: 4.59k, False: 2.73k]
  ------------------
 1063|  4.59k|        {
 1064|  4.59k|          int flags = 0;
 1065|       |
 1066|  4.59k|          errc = _gcry_pk_util_parse_flaglist (l1, &flags, NULL);
 1067|  4.59k|          sexp_release (l1);
  ------------------
  |  |  372|  4.59k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1068|  4.59k|          l1 = NULL;
 1069|  4.59k|          if (errc)
  ------------------
  |  Branch (1069:15): [True: 0, False: 4.59k]
  ------------------
 1070|      0|            goto leave;
 1071|       |
 1072|  4.59k|          *r_flags |= flags;
 1073|  4.59k|        }
 1074|       |
 1075|       |      /* Parse the deprecated optional transient-key flag.  */
 1076|  7.32k|      l1 = sexp_find_token (keyparam, "transient-key", 0);
  ------------------
  |  |  381|  7.32k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
 1077|  7.32k|      if (l1)
  ------------------
  |  Branch (1077:11): [True: 0, False: 7.32k]
  ------------------
 1078|      0|        {
 1079|      0|          *r_flags |= PUBKEY_FLAG_TRANSIENT_KEY;
  ------------------
  |  |   34|      0|#define PUBKEY_FLAG_TRANSIENT_KEY  (1 << 5)
  ------------------
 1080|      0|          sexp_release (l1);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1081|      0|        }
 1082|       |
 1083|       |      /* Check whether a curve name was given.  */
 1084|  7.32k|      l1 = sexp_find_token (keyparam, "curve", 5);
  ------------------
  |  |  381|  7.32k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
 1085|       |
 1086|       |      /* If we don't have a curve name or if override parameters have
 1087|       |         explicitly been requested, parse them.  */
 1088|  7.32k|      if (!l1 || (*r_flags & PUBKEY_FLAG_PARAM))
  ------------------
  |  |   38|  7.32k|#define PUBKEY_FLAG_PARAM          (1 << 9)
  ------------------
  |  Branch (1088:11): [True: 0, False: 7.32k]
  |  Branch (1088:18): [True: 0, False: 7.32k]
  ------------------
 1089|      0|        {
 1090|      0|          gcry_mpi_point_t G = NULL;
 1091|      0|          gcry_mpi_t cofactor = NULL;
 1092|       |
 1093|      0|          errc = mpi_from_keyparam (&E->p, keyparam, "p", 0);
 1094|      0|          if (errc)
  ------------------
  |  Branch (1094:15): [True: 0, False: 0]
  ------------------
 1095|      0|            goto leave;
 1096|      0|          errc = mpi_from_keyparam (&E->a, keyparam, "a", 0);
 1097|      0|          if (errc)
  ------------------
  |  Branch (1097:15): [True: 0, False: 0]
  ------------------
 1098|      0|            goto leave;
 1099|      0|          errc = mpi_from_keyparam (&E->b, keyparam, "b", 0);
 1100|      0|          if (errc)
  ------------------
  |  Branch (1100:15): [True: 0, False: 0]
  ------------------
 1101|      0|            goto leave;
 1102|      0|          errc = point_from_keyparam (&G, keyparam, "g", NULL);
 1103|      0|          if (errc)
  ------------------
  |  Branch (1103:15): [True: 0, False: 0]
  ------------------
 1104|      0|            goto leave;
 1105|      0|          if (G)
  ------------------
  |  Branch (1105:15): [True: 0, False: 0]
  ------------------
 1106|      0|            {
 1107|      0|              _gcry_mpi_point_init (&E->G);
 1108|      0|              mpi_point_set (&E->G, G->x, G->y, G->z);
  ------------------
  |  |  547|      0|#define mpi_point_set(p,x,y,z)        _gcry_mpi_point_set((p),(x),(y),(z))
  ------------------
 1109|      0|              mpi_point_set (G, NULL, NULL, NULL);
  ------------------
  |  |  547|      0|#define mpi_point_set(p,x,y,z)        _gcry_mpi_point_set((p),(x),(y),(z))
  ------------------
 1110|      0|              mpi_point_release (G);
  ------------------
  |  |  535|      0|  do                                             \
  |  |  536|      0|    {                                            \
  |  |  537|      0|      _gcry_mpi_point_release ((p));             \
  |  |  538|      0|      (p) = NULL;                                \
  |  |  539|      0|    }                                            \
  |  |  540|      0|  while (0)
  |  |  ------------------
  |  |  |  Branch (540:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1111|      0|            }
 1112|      0|          errc = mpi_from_keyparam (&E->n, keyparam, "n", 0);
 1113|      0|          if (errc)
  ------------------
  |  Branch (1113:15): [True: 0, False: 0]
  ------------------
 1114|      0|            goto leave;
 1115|      0|          errc = mpi_from_keyparam (&cofactor, keyparam, "h", 0);
 1116|      0|          if (errc)
  ------------------
  |  Branch (1116:15): [True: 0, False: 0]
  ------------------
 1117|      0|            goto leave;
 1118|      0|          if (cofactor)
  ------------------
  |  Branch (1118:15): [True: 0, False: 0]
  ------------------
 1119|      0|            {
 1120|      0|              mpi_get_ui (&E->h, cofactor);
  ------------------
  |  |  506|      0|#define mpi_get_ui(w,u)        _gcry_mpi_get_ui( (w), (u) )
  ------------------
 1121|      0|              mpi_free (cofactor);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
 1122|      0|            }
 1123|      0|        }
 1124|  7.32k|    }
 1125|      0|  else
 1126|      0|    l1 = NULL; /* No curvename.  */
 1127|       |
 1128|       |  /* Check whether a curve parameter is available and use that to fill
 1129|       |     in missing values.  If no curve parameter is available try an
 1130|       |     optional provided curvename.  If only the curvename has been
 1131|       |     given use that one. */
 1132|  7.32k|  if (l1 || curvename || nbits)
  ------------------
  |  Branch (1132:7): [True: 7.32k, False: 0]
  |  Branch (1132:13): [True: 0, False: 0]
  |  Branch (1132:26): [True: 0, False: 0]
  ------------------
 1133|  7.32k|    {
 1134|  7.32k|      char *name;
 1135|       |
 1136|  7.32k|      if (l1)
  ------------------
  |  Branch (1136:11): [True: 7.32k, False: 0]
  ------------------
 1137|  7.32k|        {
 1138|  7.32k|          name = sexp_nth_string (l1, 1);
  ------------------
  |  |  389|  7.32k|#define sexp_nth_string(a, b)        _gcry_sexp_nth_string ((a), (b))
  ------------------
 1139|  7.32k|          sexp_release (l1);
  ------------------
  |  |  372|  7.32k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1140|  7.32k|          if (!name)
  ------------------
  |  Branch (1140:15): [True: 0, False: 7.32k]
  ------------------
 1141|      0|            {
 1142|      0|              errc = GPG_ERR_INV_OBJ; /* Name missing or out of core. */
 1143|      0|              goto leave;
 1144|      0|            }
 1145|  7.32k|        }
 1146|      0|      else
 1147|      0|        name = NULL;
 1148|       |
 1149|  7.32k|      errc = _gcry_ecc_fill_in_curve (nbits, name? name : curvename, E, NULL);
  ------------------
  |  Branch (1149:46): [True: 7.32k, False: 0]
  ------------------
 1150|  7.32k|      xfree (name);
  ------------------
  |  |  150|  7.32k|#define xfree(a)         _gcry_free ((a))
  ------------------
 1151|  7.32k|      if (errc)
  ------------------
  |  Branch (1151:11): [True: 28, False: 7.29k]
  ------------------
 1152|     28|        goto leave;
 1153|  7.32k|    }
 1154|       |
 1155|  7.32k| leave:
 1156|  7.32k|  return errc;
 1157|  7.32k|}
ecc-curves.c:mpi_ec_setup_elliptic_curve:
 1162|  7.29k|{
 1163|  7.29k|  gpg_err_code_t errc = 0;
 1164|       |
 1165|  7.29k|  ec->G = mpi_point_snatch_set (NULL, E->G.x, E->G.y, E->G.z);
  ------------------
  |  |  548|  7.29k|#define mpi_point_snatch_set(p,x,y,z) _gcry_mpi_point_snatch_set((p),(x), \
  |  |  549|  7.29k|                                                                 (y),(z))
  ------------------
 1166|  7.29k|  E->G.x = NULL;
 1167|  7.29k|  E->G.y = NULL;
 1168|  7.29k|  E->G.z = NULL;
 1169|  7.29k|  ec->n = E->n;
 1170|  7.29k|  E->n = NULL;
 1171|  7.29k|  ec->h = E->h;
 1172|  7.29k|  ec->name = E->name;
 1173|       |
 1174|       |  /* Now that we know the curve name we can look for the public key
 1175|       |     Q.  point_from_keyparam needs to know the curve parameters so
 1176|       |     that it is able to use the correct decompression.  Parsing
 1177|       |     the private key D could have been done earlier but it is less
 1178|       |     surprising if we do it here as well.  */
 1179|  7.29k|  if (keyparam)
  ------------------
  |  Branch (1179:7): [True: 7.29k, False: 0]
  ------------------
 1180|  7.29k|    {
 1181|  7.29k|      int is_opaque_bytes = ((ec->dialect == ECC_DIALECT_ED25519
  ------------------
  |  Branch (1181:31): [True: 4.59k, False: 2.70k]
  ------------------
 1182|  7.29k|                              && (flags & PUBKEY_FLAG_EDDSA))
  ------------------
  |  |   41|  4.59k|#define PUBKEY_FLAG_EDDSA          (1 << 12)
  ------------------
  |  Branch (1182:34): [True: 4.59k, False: 0]
  ------------------
 1183|  7.29k|                             || (ec->dialect == ECC_DIALECT_SAFECURVE));
  ------------------
  |  Branch (1183:33): [True: 0, False: 2.70k]
  ------------------
 1184|       |
 1185|  7.29k|      errc = point_from_keyparam (&ec->Q, keyparam, "q", ec);
 1186|  7.29k|      if (errc)
  ------------------
  |  Branch (1186:11): [True: 0, False: 7.29k]
  ------------------
 1187|      0|        return errc;
 1188|  7.29k|      errc = mpi_from_keyparam (&ec->d, keyparam, "d", is_opaque_bytes);
 1189|       |
 1190|       |      /* Size of opaque bytes should match size of P.  */
 1191|  7.29k|      if (!errc && ec->d && is_opaque_bytes)
  ------------------
  |  Branch (1191:11): [True: 7.29k, False: 0]
  |  Branch (1191:20): [True: 0, False: 7.29k]
  |  Branch (1191:29): [True: 0, False: 0]
  ------------------
 1192|      0|        {
 1193|      0|          unsigned int n = mpi_get_nbits (ec->d);
  ------------------
  |  |  552|      0|#define mpi_get_nbits(a)       _gcry_mpi_get_nbits ((a))
  ------------------
 1194|      0|          unsigned int len;
 1195|       |
 1196|      0|          len = (ec->nbits+7)/8;
 1197|       |          /* EdDSA requires additional bit for sign.  */
 1198|      0|          if ((ec->nbits%8) == 0 && ec->model == MPI_EC_EDWARDS)
  ------------------
  |  Branch (1198:15): [True: 0, False: 0]
  |  Branch (1198:37): [True: 0, False: 0]
  ------------------
 1199|      0|            len++;
 1200|       |
 1201|      0|          if ((n+7)/8 != len)
  ------------------
  |  Branch (1201:15): [True: 0, False: 0]
  ------------------
 1202|      0|            {
 1203|      0|              if (ec->dialect == ECC_DIALECT_ED25519)
  ------------------
  |  Branch (1203:19): [True: 0, False: 0]
  ------------------
 1204|      0|                {
 1205|       |                  /*
 1206|       |                   * GnuPG (<= 2.2) or OpenPGP implementations with no
 1207|       |                   * SOS support may remove zeros at the beginning.
 1208|       |                   * Recover those zeros.
 1209|       |                   */
 1210|       |                  /*
 1211|       |                   * Also, GnuPG (<= 2.2) may add additional zero at
 1212|       |                   * the beginning, when private key is moved from
 1213|       |                   * OpenPGP to gpg-agent.  Remove such a zero-prefix.
 1214|       |                   */
 1215|      0|                  const unsigned char *buf;
 1216|      0|                  unsigned char *value;
 1217|       |
 1218|      0|                  buf = mpi_get_opaque (ec->d, &n);
  ------------------
  |  |  562|      0|#define mpi_get_opaque(a,b)    _gcry_mpi_get_opaque ((a), (b))
  ------------------
 1219|      0|                  if (!buf)
  ------------------
  |  Branch (1219:23): [True: 0, False: 0]
  ------------------
 1220|      0|                    return GPG_ERR_INV_OBJ;
 1221|       |
 1222|      0|                  value = xtrymalloc_secure (len);
  ------------------
  |  |  140|      0|#define xtrymalloc_secure(a)   _gcry_malloc_secure ((a))
  ------------------
 1223|      0|                  if (!value)
  ------------------
  |  Branch (1223:23): [True: 0, False: 0]
  ------------------
 1224|      0|                    return gpg_err_code_from_syserror ();
 1225|       |
 1226|      0|                  if ((n+7)/8 < len)
  ------------------
  |  Branch (1226:23): [True: 0, False: 0]
  ------------------
 1227|       |                    /* Recover zeros.  */
 1228|      0|                    {
 1229|      0|                      memset (value, 0, len - (n+7)/8);
 1230|      0|                      memcpy (value + len - (n+7)/8, buf, (n+7)/8);
 1231|      0|                    }
 1232|      0|                  else if ((n+7)/8 == len + 1)
  ------------------
  |  Branch (1232:28): [True: 0, False: 0]
  ------------------
 1233|       |                    /* Remove a zero.  */
 1234|      0|                    memcpy (value, buf+1, len);
 1235|      0|                  else
 1236|      0|                    {
 1237|      0|                      xfree (value);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1238|      0|                      return GPG_ERR_INV_OBJ;
 1239|      0|                    }
 1240|       |
 1241|      0|                  mpi_set_opaque (ec->d, value, len*8);
  ------------------
  |  |  561|      0|#define mpi_set_opaque(a,b,c)  _gcry_mpi_set_opaque ((a), (b), (c))
  ------------------
 1242|      0|                }
 1243|      0|              else
 1244|      0|                {
 1245|      0|                  if (DBG_CIPHER)
  ------------------
  |  |   25|      0|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1246|      0|                    log_debug ("scalar size (%d) != prime size (%d)",
  ------------------
  |  |  205|      0|#define log_debug   _gcry_log_debug
  ------------------
 1247|      0|                               (n+7)/8, len);
 1248|       |
 1249|      0|                  errc = GPG_ERR_INV_OBJ;
 1250|      0|                }
 1251|      0|            }
 1252|      0|        }
 1253|  7.29k|    }
 1254|       |
 1255|  7.29k|  return errc;
 1256|  7.29k|}

_gcry_ecc_ecdsa_verify:
  204|  2.70k|{
  205|  2.70k|  gpg_err_code_t err = 0;
  206|  2.70k|  gcry_mpi_t hash, h, h1, h2, x;
  207|  2.70k|  mpi_point_struct Q, Q1, Q2;
  208|  2.70k|  unsigned int nbits;
  209|  2.70k|  gcry_mpi_t hash_computed_internally = NULL;
  210|       |
  211|  2.70k|  if (!_gcry_mpi_ec_curve_point (ec->Q, ec))
  ------------------
  |  Branch (211:7): [True: 0, False: 2.70k]
  ------------------
  212|      0|    return GPG_ERR_BROKEN_PUBKEY;
  213|       |
  214|  2.70k|  if( !(mpi_cmp_ui (r, 0) > 0 && mpi_cmp (r, ec->n) < 0) )
  ------------------
  |  |  512|  2.70k|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
                if( !(mpi_cmp_ui (r, 0) > 0 && mpi_cmp (r, ec->n) < 0) )
  ------------------
  |  |  510|  2.45k|#define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
  ------------------
  |  Branch (214:9): [True: 2.45k, False: 252]
  |  Branch (214:34): [True: 1.95k, False: 496]
  ------------------
  215|    748|    return GPG_ERR_BAD_SIGNATURE; /* Assertion	0 < r < n  failed.  */
  216|  1.95k|  if( !(mpi_cmp_ui (s, 0) > 0 && mpi_cmp (s, ec->n) < 0) )
  ------------------
  |  |  512|  1.95k|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
                if( !(mpi_cmp_ui (s, 0) > 0 && mpi_cmp (s, ec->n) < 0) )
  ------------------
  |  |  510|  1.95k|#define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
  ------------------
  |  Branch (216:9): [True: 1.95k, False: 7]
  |  Branch (216:34): [True: 1.93k, False: 20]
  ------------------
  217|     27|    return GPG_ERR_BAD_SIGNATURE; /* Assertion	0 < s < n  failed.  */
  218|       |
  219|  1.93k|  nbits = mpi_get_nbits (ec->n);
  ------------------
  |  |  552|  1.93k|#define mpi_get_nbits(a)       _gcry_mpi_get_nbits ((a))
  ------------------
  220|  1.93k|  if ((flags & PUBKEY_FLAG_PREHASH))
  ------------------
  |  |   46|  1.93k|#define PUBKEY_FLAG_PREHASH        (1 << 17)
  ------------------
  |  Branch (220:7): [True: 0, False: 1.93k]
  ------------------
  221|      0|    {
  222|      0|      err = _gcry_dsa_compute_hash (&hash_computed_internally, input,
  223|      0|                                    hashalgo);
  224|      0|      if (err)
  ------------------
  |  Branch (224:11): [True: 0, False: 0]
  ------------------
  225|      0|        return err;
  226|      0|      input = hash_computed_internally;
  227|      0|    }
  228|       |
  229|  1.93k|  err = _gcry_dsa_normalize_hash (input, &hash, nbits);
  230|  1.93k|  if (err)
  ------------------
  |  Branch (230:7): [True: 0, False: 1.93k]
  ------------------
  231|      0|    {
  232|      0|      mpi_free (hash_computed_internally);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  233|      0|      return err;
  234|      0|    }
  235|       |
  236|  1.93k|  h  = mpi_alloc (0);
  ------------------
  |  |   97|  1.93k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  237|  1.93k|  h1 = mpi_alloc (0);
  ------------------
  |  |   97|  1.93k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  238|  1.93k|  h2 = mpi_alloc (0);
  ------------------
  |  |   97|  1.93k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  239|  1.93k|  x = mpi_alloc (0);
  ------------------
  |  |   97|  1.93k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  240|  1.93k|  point_init (&Q);
  ------------------
  |  |   50|  1.93k|#define point_init(a)  _gcry_mpi_point_init ((a))
  ------------------
  241|  1.93k|  point_init (&Q1);
  ------------------
  |  |   50|  1.93k|#define point_init(a)  _gcry_mpi_point_init ((a))
  ------------------
  242|  1.93k|  point_init (&Q2);
  ------------------
  |  |   50|  1.93k|#define point_init(a)  _gcry_mpi_point_init ((a))
  ------------------
  243|       |
  244|       |  /* h  = s^(-1) (mod n) */
  245|  1.93k|  mpi_invm (h, s, ec->n);
  ------------------
  |  |  530|  1.93k|#define mpi_invm(g,a,b)        _gcry_mpi_invm ( (g), (a), (b) )
  ------------------
  246|       |  /* h1 = hash * s^(-1) (mod n) */
  247|  1.93k|  mpi_mulm (h1, hash, h, ec->n);
  ------------------
  |  |  524|  1.93k|#define mpi_mulm(w,u,v,m)      _gcry_mpi_mulm ((w),(u),(v),(m))
  ------------------
  248|       |  /* Q1 = [ hash * s^(-1) ]G  */
  249|  1.93k|  _gcry_mpi_ec_mul_point (&Q1, h1, ec->G, ec);
  250|       |  /* h2 = r * s^(-1) (mod n) */
  251|  1.93k|  mpi_mulm (h2, r, h, ec->n);
  ------------------
  |  |  524|  1.93k|#define mpi_mulm(w,u,v,m)      _gcry_mpi_mulm ((w),(u),(v),(m))
  ------------------
  252|       |  /* Q2 = [ r * s^(-1) ]Q */
  253|  1.93k|  _gcry_mpi_ec_mul_point (&Q2, h2, ec->Q, ec);
  254|       |  /* Q  = ([hash * s^(-1)]G) + ([r * s^(-1)]Q) */
  255|  1.93k|  _gcry_mpi_ec_add_points (&Q, &Q1, &Q2, ec);
  256|       |
  257|  1.93k|  if (!mpi_cmp_ui (Q.z, 0))
  ------------------
  |  |  512|  1.93k|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
  |  Branch (257:7): [True: 0, False: 1.93k]
  ------------------
  258|      0|    {
  259|      0|      if (DBG_CIPHER)
  ------------------
  |  |   25|      0|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  260|      0|          log_debug ("ecc verify: Rejected\n");
  ------------------
  |  |  205|      0|#define log_debug   _gcry_log_debug
  ------------------
  261|      0|      err = GPG_ERR_BAD_SIGNATURE;
  262|      0|      goto leave;
  263|      0|    }
  264|  1.93k|  if (_gcry_mpi_ec_get_affine (x, NULL, &Q, ec))
  ------------------
  |  Branch (264:7): [True: 0, False: 1.93k]
  ------------------
  265|      0|    {
  266|      0|      if (DBG_CIPHER)
  ------------------
  |  |   25|      0|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  267|      0|        log_debug ("ecc verify: Failed to get affine coordinates\n");
  ------------------
  |  |  205|      0|#define log_debug   _gcry_log_debug
  ------------------
  268|      0|      err = GPG_ERR_BAD_SIGNATURE;
  269|      0|      goto leave;
  270|      0|    }
  271|  1.93k|  mpi_mod (x, x, ec->n); /* x = x mod E_n */
  ------------------
  |  |  528|  1.93k|#define mpi_mod(r,a,m)         _gcry_mpi_mod ((r), (a), (m))
  ------------------
  272|  1.93k|  if (mpi_cmp (x, r))   /* x != r */
  ------------------
  |  |  510|  1.93k|#define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
  |  |  ------------------
  |  |  |  Branch (510:32): [True: 1.91k, False: 20]
  |  |  ------------------
  ------------------
  273|  1.91k|    {
  274|  1.91k|      if (DBG_CIPHER)
  ------------------
  |  |   25|  1.91k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 1.91k]
  |  |  ------------------
  ------------------
  275|      0|        {
  276|      0|          log_mpidump ("     x", x);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
  277|      0|          log_mpidump ("     r", r);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
  278|      0|          log_mpidump ("     s", s);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
  279|      0|        }
  280|  1.91k|      err = GPG_ERR_BAD_SIGNATURE;
  281|  1.91k|      goto leave;
  282|  1.91k|    }
  283|       |
  284|  1.93k| leave:
  285|  1.93k|  point_free (&Q2);
  ------------------
  |  |   51|  1.93k|#define point_free(a)  _gcry_mpi_point_free_parts ((a))
  ------------------
  286|  1.93k|  point_free (&Q1);
  ------------------
  |  |   51|  1.93k|#define point_free(a)  _gcry_mpi_point_free_parts ((a))
  ------------------
  287|  1.93k|  point_free (&Q);
  ------------------
  |  |   51|  1.93k|#define point_free(a)  _gcry_mpi_point_free_parts ((a))
  ------------------
  288|  1.93k|  mpi_free (x);
  ------------------
  |  |   99|  1.93k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  289|  1.93k|  mpi_free (h2);
  ------------------
  |  |   99|  1.93k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  290|  1.93k|  mpi_free (h1);
  ------------------
  |  |   99|  1.93k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  291|  1.93k|  mpi_free (h);
  ------------------
  |  |   99|  1.93k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  292|  1.93k|  if (hash != input)
  ------------------
  |  Branch (292:7): [True: 0, False: 1.93k]
  ------------------
  293|      0|    mpi_free (hash);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  294|  1.93k|  mpi_free (hash_computed_internally);
  ------------------
  |  |   99|  1.93k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  295|       |
  296|  1.93k|  return err;
  297|  1.93k|}

reverse_buffer:
   37|  13.7k|{
   38|  13.7k|  unsigned int tmp, i;
   39|       |
   40|   307k|  for (i=0; i < length/2; i++)
  ------------------
  |  Branch (40:13): [True: 293k, False: 13.7k]
  ------------------
   41|   293k|    {
   42|   293k|      tmp = buffer[i];
   43|   293k|      buffer[i] = buffer[length-1-i];
   44|   293k|      buffer[length-1-i] = tmp;
   45|   293k|    }
   46|  13.7k|}
_gcry_ecc_eddsa_encodepoint:
  125|  9.18k|{
  126|  9.18k|  gpg_err_code_t rc;
  127|  9.18k|  gcry_mpi_t x, y;
  128|       |
  129|  9.18k|  x = x_in? x_in : mpi_new (0);
  ------------------
  |  |  491|  13.7k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
  |  Branch (129:7): [True: 4.59k, False: 4.59k]
  ------------------
  130|  9.18k|  y = y_in? y_in : mpi_new (0);
  ------------------
  |  |  491|  13.7k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
  |  Branch (130:7): [True: 4.59k, False: 4.59k]
  ------------------
  131|       |
  132|  9.18k|  if (_gcry_mpi_ec_get_affine (x, y, point, ec))
  ------------------
  |  Branch (132:7): [True: 0, False: 9.18k]
  ------------------
  133|      0|    {
  134|      0|      log_error ("eddsa_encodepoint: Failed to get affine coordinates\n");
  ------------------
  |  |  203|      0|#define log_error   _gcry_log_error
  ------------------
  135|      0|      rc = GPG_ERR_INTERNAL;
  136|      0|    }
  137|  9.18k|  else
  138|  9.18k|    rc = eddsa_encode_x_y (x, y, ec->nbits, with_prefix, r_buffer, r_buflen);
  139|       |
  140|  9.18k|  if (!x_in)
  ------------------
  |  Branch (140:7): [True: 4.59k, False: 4.59k]
  ------------------
  141|  4.59k|    mpi_free (x);
  ------------------
  |  |   99|  4.59k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  142|  9.18k|  if (!y_in)
  ------------------
  |  Branch (142:7): [True: 4.59k, False: 4.59k]
  ------------------
  143|  4.59k|    mpi_free (y);
  ------------------
  |  |   99|  4.59k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  144|  9.18k|  return rc;
  145|  9.18k|}
_gcry_ecc_eddsa_recover_x:
  280|  4.59k|{
  281|  4.59k|  gpg_err_code_t rc = 0;
  282|  4.59k|  gcry_mpi_t u, v, v3, t;
  283|  4.59k|  static gcry_mpi_t p58, seven;
  284|       |
  285|       |  /*
  286|       |   * This routine is actually curve specific.  Now, only supports
  287|       |   * Ed25519 and Ed448.
  288|       |   */
  289|       |
  290|  4.59k|  if (ec->dialect != ECC_DIALECT_ED25519)
  ------------------
  |  Branch (290:7): [True: 0, False: 4.59k]
  ------------------
  291|       |    /* For now, it's only Ed448.  */
  292|      0|    return ecc_ed448_recover_x (x, y, sign, ec);
  293|       |
  294|       |  /* It's Ed25519.  */
  295|       |
  296|  4.59k|  if (!p58)
  ------------------
  |  Branch (296:7): [True: 1, False: 4.59k]
  ------------------
  297|      1|    p58 = scanval ("0FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
  298|      1|                   "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD");
  299|  4.59k|  if (!seven)
  ------------------
  |  Branch (299:7): [True: 1, False: 4.59k]
  ------------------
  300|      1|    seven = mpi_set_ui (NULL, 7);
  ------------------
  |  |  505|      1|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
  301|       |
  302|  4.59k|  u   = mpi_new (0);
  ------------------
  |  |  491|  4.59k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
  303|  4.59k|  v   = mpi_new (0);
  ------------------
  |  |  491|  4.59k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
  304|  4.59k|  v3  = mpi_new (0);
  ------------------
  |  |  491|  4.59k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
  305|  4.59k|  t   = mpi_new (0);
  ------------------
  |  |  491|  4.59k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
  306|       |
  307|       |  /* Compute u and v */
  308|       |  /* u = y^2    */
  309|  4.59k|  mpi_mulm (u, y, y, ec->p);
  ------------------
  |  |  524|  4.59k|#define mpi_mulm(w,u,v,m)      _gcry_mpi_mulm ((w),(u),(v),(m))
  ------------------
  310|       |  /* v = b*y^2   */
  311|  4.59k|  mpi_mulm (v, ec->b, u, ec->p);
  ------------------
  |  |  524|  4.59k|#define mpi_mulm(w,u,v,m)      _gcry_mpi_mulm ((w),(u),(v),(m))
  ------------------
  312|       |  /* u = y^2-1  */
  313|  4.59k|  mpi_sub_ui (u, u, 1);
  ------------------
  |  |  518|  4.59k|#define mpi_sub_ui(w,u,v)      _gcry_mpi_sub_ui ((w),(u),(v))
  ------------------
  314|       |  /* v = b*y^2+1 */
  315|  4.59k|  mpi_add_ui (v, v, 1);
  ------------------
  |  |  515|  4.59k|#define mpi_add_ui(w,u,v)      _gcry_mpi_add_ui((w),(u),(v))
  ------------------
  316|       |
  317|       |  /* Compute sqrt(u/v) */
  318|       |  /* v3 = v^3 */
  319|  4.59k|  mpi_powm (v3, v, mpi_const (MPI_C_THREE), ec->p);
  ------------------
  |  |  525|  4.59k|#define mpi_powm(w,b,e,m)      _gcry_mpi_powm ( (w), (b), (e), (m) )
  ------------------
  320|       |  /* t = v3 * v3 * u * v = u * v^7 */
  321|  4.59k|  mpi_powm (t, v, seven, ec->p);
  ------------------
  |  |  525|  4.59k|#define mpi_powm(w,b,e,m)      _gcry_mpi_powm ( (w), (b), (e), (m) )
  ------------------
  322|  4.59k|  mpi_mulm (t, t, u, ec->p);
  ------------------
  |  |  524|  4.59k|#define mpi_mulm(w,u,v,m)      _gcry_mpi_mulm ((w),(u),(v),(m))
  ------------------
  323|       |  /* t = t^((p-5)/8) = (u * v^7)^((p-5)/8)  */
  324|  4.59k|  mpi_powm (t, t, p58, ec->p);
  ------------------
  |  |  525|  4.59k|#define mpi_powm(w,b,e,m)      _gcry_mpi_powm ( (w), (b), (e), (m) )
  ------------------
  325|       |  /* x = t * u * v^3 = (u * v^3) * (u * v^7)^((p-5)/8) */
  326|  4.59k|  mpi_mulm (t, t, u, ec->p);
  ------------------
  |  |  524|  4.59k|#define mpi_mulm(w,u,v,m)      _gcry_mpi_mulm ((w),(u),(v),(m))
  ------------------
  327|  4.59k|  mpi_mulm (x, t, v3, ec->p);
  ------------------
  |  |  524|  4.59k|#define mpi_mulm(w,u,v,m)      _gcry_mpi_mulm ((w),(u),(v),(m))
  ------------------
  328|       |
  329|       |  /* Adjust if needed.  */
  330|       |  /* t = v * x^2  */
  331|  4.59k|  mpi_mulm (t, x, x, ec->p);
  ------------------
  |  |  524|  4.59k|#define mpi_mulm(w,u,v,m)      _gcry_mpi_mulm ((w),(u),(v),(m))
  ------------------
  332|  4.59k|  mpi_mulm (t, t, v, ec->p);
  ------------------
  |  |  524|  4.59k|#define mpi_mulm(w,u,v,m)      _gcry_mpi_mulm ((w),(u),(v),(m))
  ------------------
  333|       |  /* -t == u ? x = x * sqrt(-1) */
  334|  4.59k|  mpi_sub (t, ec->p, t);
  ------------------
  |  |  519|  4.59k|#define mpi_sub(w,u,v)         _gcry_mpi_sub ((w),(u),(v))
  ------------------
  335|  4.59k|  if (!mpi_cmp (t, u))
  ------------------
  |  |  510|  4.59k|#define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
  ------------------
  |  Branch (335:7): [True: 934, False: 3.65k]
  ------------------
  336|    934|    {
  337|    934|      static gcry_mpi_t m1;  /* Fixme: this is not thread-safe.  */
  338|    934|      if (!m1)
  ------------------
  |  Branch (338:11): [True: 1, False: 933]
  ------------------
  339|      1|        m1 = scanval ("2B8324804FC1DF0B2B4D00993DFBD7A7"
  340|      1|                      "2F431806AD2FE478C4EE1B274A0EA0B0");
  341|    934|      mpi_mulm (x, x, m1, ec->p);
  ------------------
  |  |  524|    934|#define mpi_mulm(w,u,v,m)      _gcry_mpi_mulm ((w),(u),(v),(m))
  ------------------
  342|       |      /* t = v * x^2  */
  343|    934|      mpi_mulm (t, x, x, ec->p);
  ------------------
  |  |  524|    934|#define mpi_mulm(w,u,v,m)      _gcry_mpi_mulm ((w),(u),(v),(m))
  ------------------
  344|    934|      mpi_mulm (t, t, v, ec->p);
  ------------------
  |  |  524|    934|#define mpi_mulm(w,u,v,m)      _gcry_mpi_mulm ((w),(u),(v),(m))
  ------------------
  345|       |      /* -t == u ? x = x * sqrt(-1) */
  346|    934|      mpi_sub (t, ec->p, t);
  ------------------
  |  |  519|    934|#define mpi_sub(w,u,v)         _gcry_mpi_sub ((w),(u),(v))
  ------------------
  347|    934|      if (!mpi_cmp (t, u))
  ------------------
  |  |  510|    934|#define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
  ------------------
  |  Branch (347:11): [True: 0, False: 934]
  ------------------
  348|      0|        rc = GPG_ERR_INV_OBJ;
  349|    934|    }
  350|       |
  351|       |  /* Choose the desired square root according to parity */
  352|  4.59k|  if (mpi_test_bit (x, 0) != !!sign)
  ------------------
  |  |  553|  4.59k|#define mpi_test_bit(a,b)      _gcry_mpi_test_bit ((a),(b))
  ------------------
  |  Branch (352:7): [True: 2.33k, False: 2.25k]
  ------------------
  353|  2.33k|    mpi_sub (x, ec->p, x);
  ------------------
  |  |  519|  2.33k|#define mpi_sub(w,u,v)         _gcry_mpi_sub ((w),(u),(v))
  ------------------
  354|       |
  355|  4.59k|  mpi_free (t);
  ------------------
  |  |   99|  4.59k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  356|  4.59k|  mpi_free (v3);
  ------------------
  |  |   99|  4.59k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  357|  4.59k|  mpi_free (v);
  ------------------
  |  |   99|  4.59k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  358|  4.59k|  mpi_free (u);
  ------------------
  |  |   99|  4.59k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  359|       |
  360|  4.59k|  return rc;
  361|  4.59k|}
_gcry_ecc_eddsa_decodepoint:
  373|  4.59k|{
  374|  4.59k|  gpg_err_code_t rc;
  375|  4.59k|  unsigned char *rawmpi;
  376|  4.59k|  unsigned int rawmpilen;
  377|  4.59k|  int sign;
  378|       |
  379|  4.59k|  if (mpi_is_opaque (pk))
  ------------------
  |  |  114|  4.59k|#define mpi_is_opaque(a)      ((a) && ((a)->flags&4))
  |  |  ------------------
  |  |  |  Branch (114:32): [True: 4.59k, False: 0]
  |  |  |  Branch (114:39): [True: 4.59k, False: 0]
  |  |  ------------------
  ------------------
  380|  4.59k|    {
  381|  4.59k|      const unsigned char *buf;
  382|  4.59k|      unsigned int len;
  383|       |
  384|  4.59k|      len = (ctx->nbits%8) == 0 ? (ctx->nbits/8 + 1): (ctx->nbits+7)/8;
  ------------------
  |  Branch (384:13): [True: 0, False: 4.59k]
  ------------------
  385|       |
  386|  4.59k|      buf = mpi_get_opaque (pk, &rawmpilen);
  ------------------
  |  |  562|  4.59k|#define mpi_get_opaque(a,b)    _gcry_mpi_get_opaque ((a), (b))
  ------------------
  387|  4.59k|      if (!buf)
  ------------------
  |  Branch (387:11): [True: 0, False: 4.59k]
  ------------------
  388|      0|        return GPG_ERR_INV_OBJ;
  389|  4.59k|      rawmpilen = (rawmpilen + 7)/8;
  390|       |
  391|  4.59k|      if (!(rawmpilen == len
  ------------------
  |  Branch (391:13): [True: 0, False: 4.59k]
  ------------------
  392|  4.59k|            || rawmpilen == len + 1
  ------------------
  |  Branch (392:16): [True: 4.59k, False: 0]
  ------------------
  393|  4.59k|            || rawmpilen == len * 2 + 1))
  ------------------
  |  Branch (393:16): [True: 0, False: 0]
  ------------------
  394|      0|        return GPG_ERR_INV_OBJ;
  395|       |
  396|       |      /* Handle compression prefixes.  The size of the buffer will be
  397|       |         odd in this case.  */
  398|  4.59k|      if (rawmpilen > 1 && (rawmpilen == len + 1 || rawmpilen == len * 2 + 1))
  ------------------
  |  Branch (398:11): [True: 4.59k, False: 0]
  |  Branch (398:29): [True: 4.59k, False: 0]
  |  Branch (398:53): [True: 0, False: 0]
  ------------------
  399|  4.59k|        {
  400|       |          /* First check whether the public key has been given in
  401|       |             standard uncompressed format (SEC1).  No need to recover
  402|       |             x in this case.  */
  403|  4.59k|          if (buf[0] == 0x04)
  ------------------
  |  Branch (403:15): [True: 0, False: 4.59k]
  ------------------
  404|      0|            {
  405|      0|              gcry_mpi_t x, y;
  406|       |
  407|      0|              rc = _gcry_mpi_scan (&x, GCRYMPI_FMT_USG,
  408|      0|                                   buf+1, (rawmpilen-1)/2, NULL);
  409|      0|              if (rc)
  ------------------
  |  Branch (409:19): [True: 0, False: 0]
  ------------------
  410|      0|                return rc;
  411|      0|              rc = _gcry_mpi_scan (&y, GCRYMPI_FMT_USG,
  412|      0|                                   buf+1+(rawmpilen-1)/2, (rawmpilen-1)/2,NULL);
  413|      0|              if (rc)
  ------------------
  |  Branch (413:19): [True: 0, False: 0]
  ------------------
  414|      0|                {
  415|      0|                  mpi_free (x);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  416|      0|                  return rc;
  417|      0|                }
  418|       |
  419|      0|              if (r_encpk)
  ------------------
  |  Branch (419:19): [True: 0, False: 0]
  ------------------
  420|      0|                {
  421|      0|                  rc = eddsa_encode_x_y (x, y, ctx->nbits, 0,
  422|      0|                                         r_encpk, r_encpklen);
  423|      0|                  if (rc)
  ------------------
  |  Branch (423:23): [True: 0, False: 0]
  ------------------
  424|      0|                    {
  425|      0|                      mpi_free (x);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  426|      0|                      mpi_free (y);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  427|      0|                      return rc;
  428|      0|                    }
  429|      0|                }
  430|      0|              mpi_snatch (result->x, x);
  ------------------
  |  |  503|      0|#define mpi_snatch( w, u)      _gcry_mpi_snatch( (w), (u) )
  ------------------
  431|      0|              mpi_snatch (result->y, y);
  ------------------
  |  |  503|      0|#define mpi_snatch( w, u)      _gcry_mpi_snatch( (w), (u) )
  ------------------
  432|      0|              mpi_set_ui (result->z, 1);
  ------------------
  |  |  505|      0|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
  433|      0|              return 0;
  434|      0|            }
  435|       |
  436|       |          /* Check whether the public key has been prefixed with a 0x40
  437|       |             byte to explicitly indicate compressed format using a SEC1
  438|       |             alike prefix byte.  This is a Libgcrypt extension.  */
  439|  4.59k|          if (buf[0] == 0x40)
  ------------------
  |  Branch (439:15): [True: 4.59k, False: 0]
  ------------------
  440|  4.59k|            {
  441|  4.59k|              rawmpilen--;
  442|  4.59k|              buf++;
  443|  4.59k|            }
  444|  4.59k|        }
  445|       |
  446|       |      /* EdDSA compressed point.  */
  447|  4.59k|      rawmpi = xtrymalloc (rawmpilen);
  ------------------
  |  |  138|  4.59k|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  448|  4.59k|      if (!rawmpi)
  ------------------
  |  Branch (448:11): [True: 0, False: 4.59k]
  ------------------
  449|      0|        return gpg_err_code_from_syserror ();
  450|  4.59k|      memcpy (rawmpi, buf, rawmpilen);
  451|  4.59k|      reverse_buffer (rawmpi, rawmpilen);
  452|  4.59k|    }
  453|      0|  else
  454|      0|    {
  455|       |      /* Note: Without using an opaque MPI it is not reliable possible
  456|       |         to find out whether the public key has been given in
  457|       |         uncompressed format.  Thus we expect native EdDSA format.  */
  458|      0|      rawmpi = _gcry_mpi_get_buffer (pk, (ctx->nbits+7)/8, &rawmpilen, NULL);
  459|      0|      if (!rawmpi)
  ------------------
  |  Branch (459:11): [True: 0, False: 0]
  ------------------
  460|      0|        return gpg_err_code_from_syserror ();
  461|      0|    }
  462|       |
  463|  4.59k|  if (rawmpilen)
  ------------------
  |  Branch (463:7): [True: 4.59k, False: 0]
  ------------------
  464|  4.59k|    {
  465|  4.59k|      sign = !!(rawmpi[0] & 0x80);
  466|  4.59k|      rawmpi[0] &= 0x7f;
  467|  4.59k|    }
  468|      0|  else
  469|      0|    sign = 0;
  470|  4.59k|  _gcry_mpi_set_buffer (result->y, rawmpi, rawmpilen, 0);
  471|  4.59k|  if (r_encpk)
  ------------------
  |  Branch (471:7): [True: 0, False: 4.59k]
  ------------------
  472|      0|    {
  473|       |      /* Revert to little endian.  */
  474|      0|      if (sign && rawmpilen)
  ------------------
  |  Branch (474:11): [True: 0, False: 0]
  |  Branch (474:19): [True: 0, False: 0]
  ------------------
  475|      0|        rawmpi[0] |= 0x80;
  476|      0|      reverse_buffer (rawmpi, rawmpilen);
  477|      0|      *r_encpk = rawmpi;
  478|      0|      if (r_encpklen)
  ------------------
  |  Branch (478:11): [True: 0, False: 0]
  ------------------
  479|      0|        *r_encpklen = rawmpilen;
  480|      0|    }
  481|  4.59k|  else
  482|  4.59k|    xfree (rawmpi);
  ------------------
  |  |  150|  4.59k|#define xfree(a)         _gcry_free ((a))
  ------------------
  483|       |
  484|  4.59k|  rc = _gcry_ecc_eddsa_recover_x (result->x, result->y, sign, ctx);
  485|  4.59k|  mpi_set_ui (result->z, 1);
  ------------------
  |  |  505|  4.59k|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
  486|       |
  487|  4.59k|  return rc;
  488|  4.59k|}
_gcry_ecc_eddsa_verify:
  899|  4.59k|{
  900|  4.59k|  int rc;
  901|  4.59k|  int b;
  902|  4.59k|  unsigned int tmp;
  903|  4.59k|  unsigned char *encpk = NULL; /* Encoded public key.  */
  904|  4.59k|  unsigned int encpklen = 0;
  905|  4.59k|  const void *mbuf, *rbuf;
  906|  4.59k|  unsigned char *tbuf = NULL;
  907|  4.59k|  size_t mlen, rlen;
  908|  4.59k|  unsigned int tlen;
  909|  4.59k|  unsigned char digest[114];
  910|  4.59k|  gcry_mpi_t h, s;
  911|  4.59k|  mpi_point_struct Ia, Ib;
  912|  4.59k|  const char *dom;
  913|  4.59k|  int domlen, digestlen;
  914|  4.59k|  int i;
  915|  4.59k|  unsigned char x_olen[2];
  916|  4.59k|  unsigned char prehashed_msg[64];
  917|  4.59k|  gcry_buffer_t hvec[6];
  918|  4.59k|  gcry_buffer_t hvec2[1];
  919|       |
  920|  4.59k|  if (!mpi_is_opaque (input) || !mpi_is_opaque (r_in) || !mpi_is_opaque (s_in))
  ------------------
  |  |  114|  9.18k|#define mpi_is_opaque(a)      ((a) && ((a)->flags&4))
  |  |  ------------------
  |  |  |  Branch (114:32): [True: 4.59k, False: 0]
  |  |  |  Branch (114:39): [True: 4.59k, False: 0]
  |  |  ------------------
  ------------------
                if (!mpi_is_opaque (input) || !mpi_is_opaque (r_in) || !mpi_is_opaque (s_in))
  ------------------
  |  |  114|  9.18k|#define mpi_is_opaque(a)      ((a) && ((a)->flags&4))
  |  |  ------------------
  |  |  |  Branch (114:32): [True: 4.59k, False: 0]
  |  |  |  Branch (114:39): [True: 4.59k, False: 0]
  |  |  ------------------
  ------------------
                if (!mpi_is_opaque (input) || !mpi_is_opaque (r_in) || !mpi_is_opaque (s_in))
  ------------------
  |  |  114|  4.59k|#define mpi_is_opaque(a)      ((a) && ((a)->flags&4))
  |  |  ------------------
  |  |  |  Branch (114:32): [True: 4.59k, False: 0]
  |  |  |  Branch (114:39): [True: 4.59k, False: 0]
  |  |  ------------------
  ------------------
  921|      0|    return GPG_ERR_INV_DATA;
  922|       |
  923|  4.59k|  b = (ec->nbits+7)/8;
  924|       |
  925|  4.59k|  if (ec->nbits == 255)
  ------------------
  |  Branch (925:7): [True: 4.59k, False: 0]
  ------------------
  926|  4.59k|    {
  927|  4.59k|      dom = DOM25519;
  ------------------
  |  |  667|  4.59k|#define DOM25519     "SigEd25519 no Ed25519 collisions"
  ------------------
  928|  4.59k|      domlen = DOM25519_LEN;
  ------------------
  |  |  668|  4.59k|#define DOM25519_LEN 32
  ------------------
  929|  4.59k|      digestlen = 64;
  930|  4.59k|    }
  931|      0|  else if (ec->nbits == 448)
  ------------------
  |  Branch (931:12): [True: 0, False: 0]
  ------------------
  932|      0|    {
  933|      0|      b++;
  934|      0|      dom = DOM448;
  ------------------
  |  |  669|      0|#define DOM448       "SigEd448"
  ------------------
  935|      0|      domlen = DOM448_LEN;
  ------------------
  |  |  670|      0|#define DOM448_LEN   8
  ------------------
  936|      0|      digestlen = 2 * b;
  937|      0|    }
  938|      0|  else
  939|      0|    return GPG_ERR_NOT_IMPLEMENTED;
  940|       |
  941|  4.59k|  point_init (&Ia);
  ------------------
  |  |   50|  4.59k|#define point_init(a)  _gcry_mpi_point_init ((a))
  ------------------
  942|  4.59k|  point_init (&Ib);
  ------------------
  |  |   50|  4.59k|#define point_init(a)  _gcry_mpi_point_init ((a))
  ------------------
  943|  4.59k|  h = mpi_new (0);
  ------------------
  |  |  491|  4.59k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
  944|  4.59k|  s = mpi_new (0);
  ------------------
  |  |  491|  4.59k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
  945|       |
  946|       |  /* Encode and check the public key.  */
  947|  4.59k|  rc = _gcry_ecc_eddsa_encodepoint (ec->Q, ec, NULL, NULL, 0,
  948|  4.59k|                                    &encpk, &encpklen);
  949|  4.59k|  if (rc)
  ------------------
  |  Branch (949:7): [True: 0, False: 4.59k]
  ------------------
  950|      0|    goto leave;
  951|  4.59k|  if (!_gcry_mpi_ec_curve_point (ec->Q, ec))
  ------------------
  |  Branch (951:7): [True: 0, False: 4.59k]
  ------------------
  952|      0|    {
  953|      0|      rc = GPG_ERR_BROKEN_PUBKEY;
  954|      0|      goto leave;
  955|      0|    }
  956|  4.59k|  if (DBG_CIPHER)
  ------------------
  |  |   25|  4.59k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 4.59k]
  |  |  ------------------
  ------------------
  957|      0|    log_printhex ("  e_pk", encpk, encpklen);
  ------------------
  |  |  207|      0|#define log_printhex _gcry_log_printhex
  ------------------
  958|  4.59k|  if (encpklen != b)
  ------------------
  |  Branch (958:7): [True: 0, False: 4.59k]
  ------------------
  959|      0|    {
  960|      0|      rc = GPG_ERR_INV_LENGTH;
  961|      0|      goto leave;
  962|      0|    }
  963|       |
  964|       |  /* Convert the other input parameters.  */
  965|  4.59k|  mbuf = mpi_get_opaque (input, &tmp);
  ------------------
  |  |  562|  4.59k|#define mpi_get_opaque(a,b)    _gcry_mpi_get_opaque ((a), (b))
  ------------------
  966|  4.59k|  mlen = (tmp +7)/8;
  967|  4.59k|  if (DBG_CIPHER)
  ------------------
  |  |   25|  4.59k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 4.59k]
  |  |  ------------------
  ------------------
  968|      0|    log_printhex ("     m", mbuf, mlen);
  ------------------
  |  |  207|      0|#define log_printhex _gcry_log_printhex
  ------------------
  969|  4.59k|  rbuf = mpi_get_opaque (r_in, &tmp);
  ------------------
  |  |  562|  4.59k|#define mpi_get_opaque(a,b)    _gcry_mpi_get_opaque ((a), (b))
  ------------------
  970|  4.59k|  rlen = (tmp +7)/8;
  971|  4.59k|  if (DBG_CIPHER)
  ------------------
  |  |   25|  4.59k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 4.59k]
  |  |  ------------------
  ------------------
  972|      0|    log_printhex ("     r", rbuf, rlen);
  ------------------
  |  |  207|      0|#define log_printhex _gcry_log_printhex
  ------------------
  973|  4.59k|  if (rlen != b)
  ------------------
  |  Branch (973:7): [True: 0, False: 4.59k]
  ------------------
  974|      0|    {
  975|      0|      rc = GPG_ERR_INV_LENGTH;
  976|      0|      goto leave;
  977|      0|    }
  978|       |
  979|  4.59k|  memset (hvec, 0, sizeof hvec);
  980|  4.59k|  i = 0;
  981|       |
  982|       |  /* h = H(dom2(F,C)+encodepoint(R)+encodepoint(pk)+m)  */
  983|  4.59k|  if ((ctx->flags & PUBKEY_FLAG_PREHASH) || ctx->labellen || ec->nbits == 448)
  ------------------
  |  |   46|  4.59k|#define PUBKEY_FLAG_PREHASH        (1 << 17)
  ------------------
  |  Branch (983:7): [True: 0, False: 4.59k]
  |  Branch (983:45): [True: 0, False: 4.59k]
  |  Branch (983:62): [True: 0, False: 4.59k]
  ------------------
  984|      0|    {
  985|      0|      hvec[i].data = (void *)dom;
  986|      0|      hvec[i].len  = domlen;
  987|      0|      i++;
  988|      0|      x_olen[0] = !!(ctx->flags & PUBKEY_FLAG_PREHASH);
  ------------------
  |  |   46|      0|#define PUBKEY_FLAG_PREHASH        (1 << 17)
  ------------------
  989|      0|      x_olen[1] = ctx->labellen;
  990|      0|      hvec[i].data = x_olen;
  991|      0|      hvec[i].len  = 2;
  992|      0|      i++;
  993|      0|      if (ctx->labellen)
  ------------------
  |  Branch (993:11): [True: 0, False: 0]
  ------------------
  994|      0|	{
  995|      0|	  hvec[i].data = ctx->label;
  996|      0|	  hvec[i].len  = ctx->labellen;
  997|      0|	  i++;
  998|      0|	}
  999|      0|    }
 1000|       |
 1001|  4.59k|  hvec[i].data = (char*)rbuf;
 1002|  4.59k|  hvec[i].len  = rlen;
 1003|  4.59k|  i++;
 1004|  4.59k|  hvec[i].data = encpk;
 1005|  4.59k|  hvec[i].len  = encpklen;
 1006|  4.59k|  i++;
 1007|  4.59k|  if ((ctx->flags & PUBKEY_FLAG_PREHASH))
  ------------------
  |  |   46|  4.59k|#define PUBKEY_FLAG_PREHASH        (1 << 17)
  ------------------
  |  Branch (1007:7): [True: 0, False: 4.59k]
  ------------------
 1008|      0|    {
 1009|      0|      memset (hvec2, 0, sizeof hvec2);
 1010|       |
 1011|      0|      hvec2[0].data = (char*)mbuf;
 1012|      0|      hvec2[0].len  = mlen;
 1013|       |
 1014|      0|      _gcry_md_hash_buffers_extract (ctx->hash_algo, 0, prehashed_msg, 64,
 1015|      0|				      hvec2, 1);
 1016|      0|      hvec[i].data = (char*)prehashed_msg;
 1017|      0|      hvec[i].len  = 64;
 1018|      0|    }
 1019|  4.59k|  else
 1020|  4.59k|    {
 1021|  4.59k|      hvec[i].data = (char*)mbuf;
 1022|  4.59k|      hvec[i].len  = mlen;
 1023|  4.59k|    }
 1024|  4.59k|  i++;
 1025|       |
 1026|  4.59k|  rc = _gcry_md_hash_buffers_extract (ctx->hash_algo, 0, digest, digestlen,
 1027|  4.59k|				      hvec, i);
 1028|  4.59k|  if (rc)
  ------------------
  |  Branch (1028:7): [True: 0, False: 4.59k]
  ------------------
 1029|      0|    goto leave;
 1030|  4.59k|  reverse_buffer (digest, digestlen);
 1031|  4.59k|  if (DBG_CIPHER)
  ------------------
  |  |   25|  4.59k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 4.59k]
  |  |  ------------------
  ------------------
 1032|      0|    log_printhex (" H(R+)", digest, digestlen);
  ------------------
  |  |  207|      0|#define log_printhex _gcry_log_printhex
  ------------------
 1033|  4.59k|  _gcry_mpi_set_buffer (h, digest, digestlen, 0);
 1034|       |
 1035|       |  /* According to the paper the best way for verification is:
 1036|       |         encodepoint(sG - h·Q) = encodepoint(r)
 1037|       |     because we don't need to decode R. */
 1038|  4.59k|  {
 1039|  4.59k|    void *sbuf;
 1040|  4.59k|    unsigned int slen;
 1041|       |
 1042|  4.59k|    sbuf = _gcry_mpi_get_opaque_copy (s_in, &tmp);
 1043|  4.59k|    slen = (tmp +7)/8;
 1044|  4.59k|    reverse_buffer (sbuf, slen);
 1045|  4.59k|    if (DBG_CIPHER)
  ------------------
  |  |   25|  4.59k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 4.59k]
  |  |  ------------------
  ------------------
 1046|      0|      log_printhex ("     s", sbuf, slen);
  ------------------
  |  |  207|      0|#define log_printhex _gcry_log_printhex
  ------------------
 1047|  4.59k|    _gcry_mpi_set_buffer (s, sbuf, slen, 0);
 1048|  4.59k|    xfree (sbuf);
  ------------------
  |  |  150|  4.59k|#define xfree(a)         _gcry_free ((a))
  ------------------
 1049|  4.59k|    if (slen != b)
  ------------------
  |  Branch (1049:9): [True: 0, False: 4.59k]
  ------------------
 1050|      0|      {
 1051|      0|        rc = GPG_ERR_INV_LENGTH;
 1052|      0|        goto leave;
 1053|      0|      }
 1054|  4.59k|  }
 1055|       |
 1056|  4.59k|  _gcry_mpi_ec_mul_point (&Ia, s, ec->G, ec);
 1057|  4.59k|  _gcry_mpi_ec_mul_point (&Ib, h, ec->Q, ec);
 1058|  4.59k|  _gcry_mpi_sub (Ib.x, ec->p, Ib.x);
 1059|  4.59k|  _gcry_mpi_ec_add_points (&Ia, &Ia, &Ib, ec);
 1060|  4.59k|  rc = _gcry_ecc_eddsa_encodepoint (&Ia, ec, s, h, 0, &tbuf, &tlen);
 1061|  4.59k|  if (rc)
  ------------------
  |  Branch (1061:7): [True: 0, False: 4.59k]
  ------------------
 1062|      0|    goto leave;
 1063|  4.59k|  if (tlen != rlen || memcmp (tbuf, rbuf, tlen))
  ------------------
  |  Branch (1063:7): [True: 0, False: 4.59k]
  |  Branch (1063:23): [True: 4.15k, False: 435]
  ------------------
 1064|  4.15k|    {
 1065|  4.15k|      rc = GPG_ERR_BAD_SIGNATURE;
 1066|  4.15k|      goto leave;
 1067|  4.15k|    }
 1068|       |
 1069|    435|  rc = 0;
 1070|       |
 1071|  4.59k| leave:
 1072|  4.59k|  xfree (encpk);
  ------------------
  |  |  150|  4.59k|#define xfree(a)         _gcry_free ((a))
  ------------------
 1073|  4.59k|  xfree (tbuf);
  ------------------
  |  |  150|  4.59k|#define xfree(a)         _gcry_free ((a))
  ------------------
 1074|  4.59k|  _gcry_mpi_release (s);
 1075|  4.59k|  _gcry_mpi_release (h);
 1076|  4.59k|  point_free (&Ia);
  ------------------
  |  |   51|  4.59k|#define point_free(a)  _gcry_mpi_point_free_parts ((a))
  ------------------
 1077|  4.59k|  point_free (&Ib);
  ------------------
  |  |   51|  4.59k|#define point_free(a)  _gcry_mpi_point_free_parts ((a))
  ------------------
 1078|  4.59k|  return rc;
 1079|    435|}
ecc-eddsa.c:eddsa_encode_x_y:
   95|  9.18k|{
   96|  9.18k|  unsigned char *rawmpi;
   97|  9.18k|  unsigned int rawmpilen;
   98|  9.18k|  int off = with_prefix? 1:0;
  ------------------
  |  Branch (98:13): [True: 0, False: 9.18k]
  ------------------
   99|  9.18k|  unsigned int minlen = (nbits%8) == 0 ? (nbits/8 + 1): (nbits+7)/8;
  ------------------
  |  Branch (99:25): [True: 0, False: 9.18k]
  ------------------
  100|       |
  101|  9.18k|  rawmpi = _gcry_mpi_get_buffer_extra (y, minlen, off?-1:0, &rawmpilen, NULL);
  ------------------
  |  Branch (101:51): [True: 0, False: 9.18k]
  ------------------
  102|  9.18k|  if (!rawmpi)
  ------------------
  |  Branch (102:7): [True: 0, False: 9.18k]
  ------------------
  103|      0|    return gpg_err_code_from_syserror ();
  104|  9.18k|  if (mpi_test_bit (x, 0) && rawmpilen)
  ------------------
  |  |  553|  18.3k|#define mpi_test_bit(a,b)      _gcry_mpi_test_bit ((a),(b))
  |  |  ------------------
  |  |  |  Branch (553:32): [True: 3.19k, False: 5.98k]
  |  |  ------------------
  ------------------
  |  Branch (104:30): [True: 3.19k, False: 0]
  ------------------
  105|  3.19k|    rawmpi[off + rawmpilen - 1] |= 0x80;  /* Set sign bit.  */
  106|  9.18k|  if (off)
  ------------------
  |  Branch (106:7): [True: 0, False: 9.18k]
  ------------------
  107|      0|    rawmpi[0] = 0x40;
  108|       |
  109|  9.18k|  *r_buffer = rawmpi;
  110|  9.18k|  *r_buflen = rawmpilen + off;
  111|  9.18k|  return 0;
  112|  9.18k|}
ecc-eddsa.c:scanval:
   52|      2|{
   53|      2|  gpg_err_code_t rc;
   54|      2|  gcry_mpi_t val;
   55|       |
   56|      2|  rc = _gcry_mpi_scan (&val, GCRYMPI_FMT_HEX, string, 0, NULL);
   57|      2|  if (rc)
  ------------------
  |  Branch (57:7): [True: 0, False: 2]
  ------------------
   58|      0|    log_fatal ("scanning ECC parameter failed: %s\n", gpg_strerror (rc));
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
   59|      2|  return val;
   60|      2|}

_gcry_ecc_curve_free:
   40|  7.32k|{
   41|  7.32k|  mpi_free (E->p); E->p = NULL;
  ------------------
  |  |   99|  7.32k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
   42|  7.32k|  mpi_free (E->a); E->a = NULL;
  ------------------
  |  |   99|  7.32k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
   43|  7.32k|  mpi_free (E->b);  E->b = NULL;
  ------------------
  |  |   99|  7.32k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
   44|  7.32k|  _gcry_mpi_point_free_parts (&E->G);
   45|  7.32k|  mpi_free (E->n);  E->n = NULL;
  ------------------
  |  |   99|  7.32k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
   46|  7.32k|}
_gcry_ecc_sec_decodepoint:
  180|  2.70k|{
  181|  2.70k|  gpg_err_code_t rc;
  182|  2.70k|  size_t n;
  183|  2.70k|  const unsigned char *buf;
  184|  2.70k|  unsigned char *buf_memory;
  185|  2.70k|  gcry_mpi_t x, y;
  186|       |
  187|  2.70k|  if (mpi_is_opaque (value))
  ------------------
  |  |  114|  2.70k|#define mpi_is_opaque(a)      ((a) && ((a)->flags&4))
  |  |  ------------------
  |  |  |  Branch (114:32): [True: 2.70k, False: 0]
  |  |  |  Branch (114:39): [True: 2.70k, False: 0]
  |  |  ------------------
  ------------------
  188|  2.70k|    {
  189|  2.70k|      unsigned int nbits;
  190|       |
  191|  2.70k|      buf = mpi_get_opaque (value, &nbits);
  ------------------
  |  |  562|  2.70k|#define mpi_get_opaque(a,b)    _gcry_mpi_get_opaque ((a), (b))
  ------------------
  192|  2.70k|      if (!buf)
  ------------------
  |  Branch (192:11): [True: 0, False: 2.70k]
  ------------------
  193|      0|        return GPG_ERR_INV_OBJ;
  194|  2.70k|      n = (nbits + 7)/8;
  195|  2.70k|      buf_memory = NULL;
  196|  2.70k|    }
  197|      0|  else
  198|      0|    {
  199|      0|      n = (mpi_get_nbits (value)+7)/8;
  ------------------
  |  |  552|      0|#define mpi_get_nbits(a)       _gcry_mpi_get_nbits ((a))
  ------------------
  200|      0|      buf_memory = xmalloc (n);
  ------------------
  |  |  144|      0|#define xmalloc(a)       _gcry_xmalloc ((a))
  ------------------
  201|      0|      rc = _gcry_mpi_print (GCRYMPI_FMT_USG, buf_memory, n, &n, value);
  202|      0|      if (rc)
  ------------------
  |  Branch (202:11): [True: 0, False: 0]
  ------------------
  203|      0|        {
  204|      0|          xfree (buf_memory);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  205|      0|          return rc;
  206|      0|        }
  207|      0|      buf = buf_memory;
  208|      0|    }
  209|       |
  210|  2.70k|  if (n < 1)
  ------------------
  |  Branch (210:7): [True: 0, False: 2.70k]
  ------------------
  211|      0|    {
  212|      0|      xfree (buf_memory);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  213|      0|      return GPG_ERR_INV_OBJ;
  214|      0|    }
  215|       |
  216|  2.70k|  if (*buf == 2 || *buf == 3)
  ------------------
  |  Branch (216:7): [True: 0, False: 2.70k]
  |  Branch (216:20): [True: 0, False: 2.70k]
  ------------------
  217|      0|    {
  218|      0|      gcry_mpi_t x3;
  219|      0|      gcry_mpi_t t;
  220|      0|      gcry_mpi_t p1_4;
  221|      0|      int y_bit = (*buf == 3);
  222|       |
  223|      0|      if (!mpi_test_bit (ec->p, 1))
  ------------------
  |  |  553|      0|#define mpi_test_bit(a,b)      _gcry_mpi_test_bit ((a),(b))
  ------------------
  |  Branch (223:11): [True: 0, False: 0]
  ------------------
  224|      0|        {
  225|      0|          xfree (buf_memory);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  226|      0|          return GPG_ERR_NOT_IMPLEMENTED; /* No support for point compression.  */
  227|      0|        }
  228|       |
  229|      0|      n = n - 1;
  230|      0|      rc = _gcry_mpi_scan (&x, GCRYMPI_FMT_USG, buf+1, n, NULL);
  231|      0|      xfree (buf_memory);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  232|      0|      if (rc)
  ------------------
  |  Branch (232:11): [True: 0, False: 0]
  ------------------
  233|      0|        return rc;
  234|       |
  235|       |      /*
  236|       |       * Recover Y.  The Weierstrass curve: y^2 = x^3 + a*x + b
  237|       |       */
  238|       |
  239|      0|      x3 = mpi_new (0);
  ------------------
  |  |  491|      0|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
  240|      0|      t = mpi_new (0);
  ------------------
  |  |  491|      0|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
  241|      0|      p1_4 = mpi_new (0);
  ------------------
  |  |  491|      0|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
  242|      0|      y = mpi_new (0);
  ------------------
  |  |  491|      0|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
  243|       |
  244|       |      /* Compute right hand side.  */
  245|      0|      mpi_powm (x3, x, mpi_const (MPI_C_THREE), ec->p);
  ------------------
  |  |  525|      0|#define mpi_powm(w,b,e,m)      _gcry_mpi_powm ( (w), (b), (e), (m) )
  ------------------
  246|      0|      mpi_mul (t, ec->a, x);
  ------------------
  |  |  523|      0|#define mpi_mul(w,u,v)         _gcry_mpi_mul ((w),(u),(v))
  ------------------
  247|      0|      mpi_mod (t, t, ec->p);
  ------------------
  |  |  528|      0|#define mpi_mod(r,a,m)         _gcry_mpi_mod ((r), (a), (m))
  ------------------
  248|      0|      mpi_add (t, t, ec->b);
  ------------------
  |  |  516|      0|#define mpi_add(w,u,v)         _gcry_mpi_add ((w),(u),(v))
  ------------------
  249|      0|      mpi_mod (t, t, ec->p);
  ------------------
  |  |  528|      0|#define mpi_mod(r,a,m)         _gcry_mpi_mod ((r), (a), (m))
  ------------------
  250|      0|      mpi_add (t, t, x3);
  ------------------
  |  |  516|      0|#define mpi_add(w,u,v)         _gcry_mpi_add ((w),(u),(v))
  ------------------
  251|      0|      mpi_mod (t, t, ec->p);
  ------------------
  |  |  528|      0|#define mpi_mod(r,a,m)         _gcry_mpi_mod ((r), (a), (m))
  ------------------
  252|       |
  253|       |      /*
  254|       |       * When p mod 4 = 3, modular square root of A can be computed by
  255|       |       * A^((p+1)/4) mod p
  256|       |       */
  257|       |
  258|       |      /* Compute (p+1)/4 into p1_4 */
  259|      0|      mpi_rshift (p1_4, ec->p, 2);
  ------------------
  |  |  558|      0|#define mpi_rshift(a,b,c)      _gcry_mpi_rshift ((a),(b),(c))
  ------------------
  260|      0|      _gcry_mpi_add_ui (p1_4, p1_4, 1);
  261|       |
  262|      0|      mpi_powm (y, t, p1_4, ec->p);
  ------------------
  |  |  525|      0|#define mpi_powm(w,b,e,m)      _gcry_mpi_powm ( (w), (b), (e), (m) )
  ------------------
  263|       |
  264|      0|      if (y_bit != mpi_test_bit (y, 0))
  ------------------
  |  |  553|      0|#define mpi_test_bit(a,b)      _gcry_mpi_test_bit ((a),(b))
  ------------------
  |  Branch (264:11): [True: 0, False: 0]
  ------------------
  265|      0|        mpi_sub (y, ec->p, y);
  ------------------
  |  |  519|      0|#define mpi_sub(w,u,v)         _gcry_mpi_sub ((w),(u),(v))
  ------------------
  266|       |
  267|      0|      mpi_free (p1_4);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  268|      0|      mpi_free (t);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  269|      0|      mpi_free (x3);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  270|      0|    }
  271|  2.70k|  else if (*buf == 4)
  ------------------
  |  Branch (271:12): [True: 2.70k, False: 0]
  ------------------
  272|  2.70k|    {
  273|  2.70k|      if ( ((n-1)%2) )
  ------------------
  |  Branch (273:12): [True: 0, False: 2.70k]
  ------------------
  274|      0|        {
  275|      0|          xfree (buf_memory);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  276|      0|          return GPG_ERR_INV_OBJ;
  277|      0|        }
  278|  2.70k|      n = (n-1)/2;
  279|  2.70k|      rc = _gcry_mpi_scan (&x, GCRYMPI_FMT_USG, buf+1, n, NULL);
  280|  2.70k|      if (rc)
  ------------------
  |  Branch (280:11): [True: 0, False: 2.70k]
  ------------------
  281|      0|        {
  282|      0|          xfree (buf_memory);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  283|      0|          return rc;
  284|      0|        }
  285|  2.70k|      rc = _gcry_mpi_scan (&y, GCRYMPI_FMT_USG, buf+1+n, n, NULL);
  286|  2.70k|      xfree (buf_memory);
  ------------------
  |  |  150|  2.70k|#define xfree(a)         _gcry_free ((a))
  ------------------
  287|  2.70k|      if (rc)
  ------------------
  |  Branch (287:11): [True: 0, False: 2.70k]
  ------------------
  288|      0|        {
  289|      0|          mpi_free (x);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  290|      0|          return rc;
  291|      0|        }
  292|  2.70k|    }
  293|      0|  else
  294|      0|    {
  295|      0|      xfree (buf_memory);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  296|      0|      return GPG_ERR_INV_OBJ;
  297|      0|    }
  298|       |
  299|  2.70k|  mpi_set (result->x, x);
  ------------------
  |  |  504|  2.70k|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
  300|  2.70k|  mpi_set (result->y, y);
  ------------------
  |  |  504|  2.70k|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
  301|  2.70k|  mpi_set_ui (result->z, 1);
  ------------------
  |  |  505|  2.70k|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
  302|       |
  303|  2.70k|  mpi_free (x);
  ------------------
  |  |   99|  2.70k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  304|  2.70k|  mpi_free (y);
  ------------------
  |  |   99|  2.70k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  305|       |
  306|  2.70k|  return 0;
  307|  2.70k|}

ecc.c:ecc_verify:
  830|  7.32k|{
  831|  7.32k|  gcry_err_code_t rc;
  832|  7.32k|  struct pk_encoding_ctx ctx;
  833|  7.32k|  gcry_sexp_t l1 = NULL;
  834|  7.32k|  gcry_mpi_t sig_r = NULL;
  835|  7.32k|  gcry_mpi_t sig_s = NULL;
  836|  7.32k|  gcry_mpi_t data = NULL;
  837|  7.32k|  int sigflags;
  838|  7.32k|  mpi_ec_t ec = NULL;
  839|  7.32k|  int flags = 0;
  840|       |
  841|  7.32k|  _gcry_pk_util_init_encoding_ctx (&ctx, PUBKEY_OP_VERIFY,
  842|  7.32k|                                   ecc_get_nbits (s_keyparms));
  843|       |
  844|       |  /*
  845|       |   * Extract the key.
  846|       |   */
  847|  7.32k|  rc = _gcry_mpi_ec_internal_new (&ec, &flags, "ecc_verify",
  848|  7.32k|                                  s_keyparms, NULL);
  849|  7.32k|  if (rc)
  ------------------
  |  Branch (849:7): [True: 28, False: 7.29k]
  ------------------
  850|     28|    goto leave;
  851|  7.29k|  if (!ec->p || !ec->a || !ec->b || !ec->G || !ec->n || !ec->Q)
  ------------------
  |  Branch (851:7): [True: 0, False: 7.29k]
  |  Branch (851:17): [True: 0, False: 7.29k]
  |  Branch (851:27): [True: 0, False: 7.29k]
  |  Branch (851:37): [True: 0, False: 7.29k]
  |  Branch (851:47): [True: 0, False: 7.29k]
  |  Branch (851:57): [True: 0, False: 7.29k]
  ------------------
  852|      0|    {
  853|      0|      rc = GPG_ERR_NO_OBJ;
  854|      0|      goto leave;
  855|      0|    }
  856|       |
  857|  7.29k|  if (ec->model == MPI_EC_MONTGOMERY)
  ------------------
  |  Branch (857:7): [True: 0, False: 7.29k]
  ------------------
  858|      0|    {
  859|      0|      if (DBG_CIPHER)
  ------------------
  |  |   25|      0|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  860|      0|        log_debug ("ecc_verify: Can't use a Montgomery curve\n");
  ------------------
  |  |  205|      0|#define log_debug   _gcry_log_debug
  ------------------
  861|      0|      rc = GPG_ERR_INTERNAL;
  862|      0|      goto leave;
  863|      0|    }
  864|       |
  865|  7.29k|  ctx.flags |= flags;
  866|  7.29k|  if (ec->model == MPI_EC_EDWARDS && ec->dialect == ECC_DIALECT_SAFECURVE)
  ------------------
  |  Branch (866:7): [True: 4.59k, False: 2.70k]
  |  Branch (866:38): [True: 0, False: 4.59k]
  ------------------
  867|      0|    ctx.flags |= PUBKEY_FLAG_EDDSA;
  ------------------
  |  |   41|      0|#define PUBKEY_FLAG_EDDSA          (1 << 12)
  ------------------
  868|       |  /* Clear hash algo for EdDSA.  */
  869|  7.29k|  if ((ctx.flags & PUBKEY_FLAG_EDDSA))
  ------------------
  |  |   41|  7.29k|#define PUBKEY_FLAG_EDDSA          (1 << 12)
  ------------------
  |  Branch (869:7): [True: 4.59k, False: 2.70k]
  ------------------
  870|  4.59k|    ctx.hash_algo = GCRY_MD_NONE;
  871|       |
  872|       |  /* Extract the data.  */
  873|  7.29k|  rc = _gcry_pk_util_data_to_mpi (s_data, &data, &ctx);
  874|  7.29k|  if (rc)
  ------------------
  |  Branch (874:7): [True: 0, False: 7.29k]
  ------------------
  875|      0|    goto leave;
  876|  7.29k|  if (DBG_CIPHER)
  ------------------
  |  |   25|  7.29k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 7.29k]
  |  |  ------------------
  ------------------
  877|      0|    log_mpidump ("ecc_verify data", data);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
  878|       |
  879|       |  /* Hash algo is determined by curve in EdDSA.  Fill it if not specified.  */
  880|  7.29k|  if ((ctx.flags & PUBKEY_FLAG_EDDSA) && !ctx.hash_algo)
  ------------------
  |  |   41|  7.29k|#define PUBKEY_FLAG_EDDSA          (1 << 12)
  ------------------
  |  Branch (880:7): [True: 4.59k, False: 2.70k]
  |  Branch (880:42): [True: 0, False: 4.59k]
  ------------------
  881|      0|    {
  882|      0|      if (ec->dialect == ECC_DIALECT_ED25519)
  ------------------
  |  Branch (882:11): [True: 0, False: 0]
  ------------------
  883|      0|        ctx.hash_algo = GCRY_MD_SHA512;
  884|      0|      else if (ec->dialect == ECC_DIALECT_SAFECURVE)
  ------------------
  |  Branch (884:16): [True: 0, False: 0]
  ------------------
  885|      0|        ctx.hash_algo = GCRY_MD_SHAKE256;
  886|      0|    }
  887|       |
  888|       |  /*
  889|       |   * Extract the signature value.
  890|       |   */
  891|  7.29k|  rc = _gcry_pk_util_preparse_sigval (s_sig, ecc_names, &l1, &sigflags);
  892|  7.29k|  if (rc)
  ------------------
  |  Branch (892:7): [True: 0, False: 7.29k]
  ------------------
  893|      0|    goto leave;
  894|  7.29k|  rc = sexp_extract_param (l1, NULL, (sigflags & PUBKEY_FLAG_EDDSA)? "/rs":"rs",
  ------------------
  |  |  391|  7.29k|#define sexp_extract_param           _gcry_sexp_extract_param
  ------------------
                rc = sexp_extract_param (l1, NULL, (sigflags & PUBKEY_FLAG_EDDSA)? "/rs":"rs",
  ------------------
  |  |   41|  7.29k|#define PUBKEY_FLAG_EDDSA          (1 << 12)
  ------------------
  |  Branch (894:38): [True: 4.59k, False: 2.70k]
  ------------------
  895|  7.29k|                           &sig_r, &sig_s, NULL);
  896|  7.29k|  if (rc)
  ------------------
  |  Branch (896:7): [True: 0, False: 7.29k]
  ------------------
  897|      0|    goto leave;
  898|  7.29k|  if (DBG_CIPHER)
  ------------------
  |  |   25|  7.29k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 7.29k]
  |  |  ------------------
  ------------------
  899|      0|    {
  900|      0|      log_mpidump ("ecc_verify  s_r", sig_r);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
  901|      0|      log_mpidump ("ecc_verify  s_s", sig_s);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
  902|      0|    }
  903|  7.29k|  if ((ctx.flags & PUBKEY_FLAG_EDDSA) ^ (sigflags & PUBKEY_FLAG_EDDSA))
  ------------------
  |  |   41|  7.29k|#define PUBKEY_FLAG_EDDSA          (1 << 12)
  ------------------
                if ((ctx.flags & PUBKEY_FLAG_EDDSA) ^ (sigflags & PUBKEY_FLAG_EDDSA))
  ------------------
  |  |   41|  7.29k|#define PUBKEY_FLAG_EDDSA          (1 << 12)
  ------------------
  |  Branch (903:7): [True: 0, False: 7.29k]
  ------------------
  904|      0|    {
  905|      0|      rc = GPG_ERR_CONFLICT; /* Inconsistent use of flag/algoname.  */
  906|      0|      goto leave;
  907|      0|    }
  908|       |
  909|       |  /*
  910|       |   * Verify the signature.
  911|       |   */
  912|  7.29k|  if ((sigflags & PUBKEY_FLAG_EDDSA))
  ------------------
  |  |   41|  7.29k|#define PUBKEY_FLAG_EDDSA          (1 << 12)
  ------------------
  |  Branch (912:7): [True: 4.59k, False: 2.70k]
  ------------------
  913|  4.59k|    {
  914|  4.59k|      rc = _gcry_ecc_eddsa_verify (data, ec, sig_r, sig_s, &ctx);
  915|  4.59k|    }
  916|  2.70k|  else if ((sigflags & PUBKEY_FLAG_GOST))
  ------------------
  |  |   42|  2.70k|#define PUBKEY_FLAG_GOST           (1 << 13)
  ------------------
  |  Branch (916:12): [True: 0, False: 2.70k]
  ------------------
  917|      0|    {
  918|      0|      rc = _gcry_ecc_gost_verify (data, ec, sig_r, sig_s);
  919|      0|    }
  920|  2.70k|  else if ((sigflags & PUBKEY_FLAG_SM2))
  ------------------
  |  |   45|  2.70k|#define PUBKEY_FLAG_SM2            (1 << 16)
  ------------------
  |  Branch (920:12): [True: 0, False: 2.70k]
  ------------------
  921|      0|    {
  922|      0|      rc = _gcry_ecc_sm2_verify (data, ec, sig_r, sig_s);
  923|      0|    }
  924|  2.70k|  else
  925|  2.70k|    {
  926|  2.70k|      rc = _gcry_ecc_ecdsa_verify (data, ec, sig_r, sig_s,
  927|  2.70k|                                   ctx.flags, ctx.hash_algo);
  928|  2.70k|    }
  929|       |
  930|  7.32k| leave:
  931|  7.32k|  _gcry_mpi_release (data);
  932|  7.32k|  _gcry_mpi_release (sig_r);
  933|  7.32k|  _gcry_mpi_release (sig_s);
  934|  7.32k|  _gcry_mpi_ec_free (ec);
  935|  7.32k|  sexp_release (l1);
  ------------------
  |  |  372|  7.32k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  936|  7.32k|  _gcry_pk_util_free_encoding_ctx (&ctx);
  937|  7.32k|  if (DBG_CIPHER)
  ------------------
  |  |   25|  7.32k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 7.32k]
  |  |  ------------------
  ------------------
  938|      0|    log_debug ("ecc_verify    => %s\n", rc?gpg_strerror (rc):"Good");
  ------------------
  |  |  205|      0|#define log_debug   _gcry_log_debug
  ------------------
  |  Branch (938:41): [True: 0, False: 0]
  ------------------
  939|  7.32k|  return rc;
  940|  7.29k|}
ecc.c:ecc_get_nbits:
 1336|  7.32k|{
 1337|  7.32k|  gcry_sexp_t l1;
 1338|  7.32k|  gcry_mpi_t p;
 1339|  7.32k|  unsigned int nbits = 0;
 1340|  7.32k|  char *curve;
 1341|       |
 1342|  7.32k|  l1 = sexp_find_token (parms, "p", 1);
  ------------------
  |  |  381|  7.32k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
 1343|  7.32k|  if (!l1)
  ------------------
  |  Branch (1343:7): [True: 7.32k, False: 0]
  ------------------
 1344|  7.32k|    { /* Parameter P not found - check whether we have "curve".  */
 1345|  7.32k|      l1 = sexp_find_token (parms, "curve", 5);
  ------------------
  |  |  381|  7.32k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
 1346|  7.32k|      if (!l1)
  ------------------
  |  Branch (1346:11): [True: 0, False: 7.32k]
  ------------------
 1347|      0|        return 0; /* Neither P nor CURVE found.  */
 1348|       |
 1349|  7.32k|      curve = sexp_nth_string (l1, 1);
  ------------------
  |  |  389|  7.32k|#define sexp_nth_string(a, b)        _gcry_sexp_nth_string ((a), (b))
  ------------------
 1350|  7.32k|      sexp_release (l1);
  ------------------
  |  |  372|  7.32k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1351|  7.32k|      if (!curve)
  ------------------
  |  Branch (1351:11): [True: 0, False: 7.32k]
  ------------------
 1352|      0|        return 0;  /* No curve name given (or out of core). */
 1353|       |
 1354|  7.32k|      if (_gcry_ecc_fill_in_curve (0, curve, NULL, &nbits))
  ------------------
  |  Branch (1354:11): [True: 28, False: 7.29k]
  ------------------
 1355|     28|        nbits = 0;
 1356|  7.32k|      xfree (curve);
  ------------------
  |  |  150|  7.32k|#define xfree(a)         _gcry_free ((a))
  ------------------
 1357|  7.32k|    }
 1358|      0|  else
 1359|      0|    {
 1360|      0|      p = sexp_nth_mpi (l1, 1, GCRYMPI_FMT_USG);
  ------------------
  |  |  390|      0|#define sexp_nth_mpi(a, b, c)        _gcry_sexp_nth_mpi ((a), (b), (c))
  ------------------
 1361|      0|      sexp_release (l1);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1362|      0|      if (p)
  ------------------
  |  Branch (1362:11): [True: 0, False: 0]
  ------------------
 1363|      0|        {
 1364|      0|          nbits = mpi_get_nbits (p);
  ------------------
  |  |  552|      0|#define mpi_get_nbits(a)       _gcry_mpi_get_nbits ((a))
  ------------------
 1365|      0|          _gcry_mpi_release (p);
 1366|      0|        }
 1367|      0|    }
 1368|  7.32k|  return nbits;
 1369|  7.32k|}

elgamal.c:verify:
  631|    655|{
  632|    655|  int rc;
  633|    655|  gcry_mpi_t t1;
  634|    655|  gcry_mpi_t t2;
  635|    655|  gcry_mpi_t base[4];
  636|    655|  gcry_mpi_t ex[4];
  637|       |
  638|    655|  if( !(mpi_cmp_ui( a, 0 ) > 0 && mpi_cmp( a, pkey->p ) < 0) )
  ------------------
  |  |  512|    655|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
                if( !(mpi_cmp_ui( a, 0 ) > 0 && mpi_cmp( a, pkey->p ) < 0) )
  ------------------
  |  |  510|    645|#define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
  ------------------
  |  Branch (638:9): [True: 645, False: 10]
  |  Branch (638:35): [True: 645, False: 0]
  ------------------
  639|     10|    return 0; /* assertion	0 < a < p  failed */
  640|       |
  641|    645|  t1 = mpi_alloc( mpi_get_nlimbs(a) );
  ------------------
  |  |   97|    645|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  642|    645|  t2 = mpi_alloc( mpi_get_nlimbs(a) );
  ------------------
  |  |   97|    645|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  643|       |
  644|       |#if 0
  645|       |  /* t1 = (y^a mod p) * (a^b mod p) mod p */
  646|       |  gcry_mpi_powm( t1, pkey->y, a, pkey->p );
  647|       |  gcry_mpi_powm( t2, a, b, pkey->p );
  648|       |  mpi_mulm( t1, t1, t2, pkey->p );
  649|       |
  650|       |  /* t2 = g ^ input mod p */
  651|       |  gcry_mpi_powm( t2, pkey->g, input, pkey->p );
  652|       |
  653|       |  rc = !mpi_cmp( t1, t2 );
  654|       |#elif 0
  655|       |  /* t1 = (y^a mod p) * (a^b mod p) mod p */
  656|       |  base[0] = pkey->y; ex[0] = a;
  657|       |  base[1] = a;       ex[1] = b;
  658|       |  base[2] = NULL;    ex[2] = NULL;
  659|       |  mpi_mulpowm( t1, base, ex, pkey->p );
  660|       |
  661|       |  /* t2 = g ^ input mod p */
  662|       |  gcry_mpi_powm( t2, pkey->g, input, pkey->p );
  663|       |
  664|       |  rc = !mpi_cmp( t1, t2 );
  665|       |#else
  666|       |  /* t1 = g ^ - input * y ^ a * a ^ b  mod p */
  667|    645|  mpi_invm(t2, pkey->g, pkey->p );
  ------------------
  |  |  530|    645|#define mpi_invm(g,a,b)        _gcry_mpi_invm ( (g), (a), (b) )
  ------------------
  668|    645|  base[0] = t2     ; ex[0] = input;
  669|    645|  base[1] = pkey->y; ex[1] = a;
  670|    645|  base[2] = a;       ex[2] = b;
  671|    645|  base[3] = NULL;    ex[3] = NULL;
  672|    645|  mpi_mulpowm( t1, base, ex, pkey->p );
  ------------------
  |  |  213|    645|#define mpi_mulpowm(a,b,c,d) _gcry_mpi_mulpowm ((a),(b),(c),(d))
  ------------------
  673|    645|  rc = !mpi_cmp_ui( t1, 1 );
  ------------------
  |  |  512|    645|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
  674|       |
  675|    645|#endif
  676|       |
  677|    645|  mpi_free(t1);
  ------------------
  |  |   99|    645|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  678|    645|  mpi_free(t2);
  ------------------
  |  |   99|    645|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  679|    645|  return rc;
  680|    655|}
elgamal.c:elg_verify:
 1039|    655|{
 1040|    655|  gcry_err_code_t rc;
 1041|    655|  struct pk_encoding_ctx ctx;
 1042|    655|  gcry_sexp_t l1 = NULL;
 1043|    655|  gcry_mpi_t sig_r = NULL;
 1044|    655|  gcry_mpi_t sig_s = NULL;
 1045|    655|  gcry_mpi_t data = NULL;
 1046|    655|  ELG_public_key pk = { NULL, NULL, NULL };
 1047|       |
 1048|    655|  _gcry_pk_util_init_encoding_ctx (&ctx, PUBKEY_OP_VERIFY,
 1049|    655|                                   elg_get_nbits (s_keyparms));
 1050|       |
 1051|       |  /* Extract the data.  */
 1052|    655|  rc = _gcry_pk_util_data_to_mpi (s_data, &data, &ctx);
 1053|    655|  if (rc)
  ------------------
  |  Branch (1053:7): [True: 0, False: 655]
  ------------------
 1054|      0|    goto leave;
 1055|    655|  if (DBG_CIPHER)
  ------------------
  |  |   25|    655|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 655]
  |  |  ------------------
  ------------------
 1056|      0|    log_mpidump ("elg_verify data", data);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
 1057|    655|  if (mpi_is_opaque (data))
  ------------------
  |  |  114|    655|#define mpi_is_opaque(a)      ((a) && ((a)->flags&4))
  |  |  ------------------
  |  |  |  Branch (114:32): [True: 655, False: 0]
  |  |  |  Branch (114:39): [True: 0, False: 655]
  |  |  ------------------
  ------------------
 1058|      0|    {
 1059|      0|      rc = GPG_ERR_INV_DATA;
 1060|      0|      goto leave;
 1061|      0|    }
 1062|       |
 1063|       |  /* Extract the signature value.  */
 1064|    655|  rc = _gcry_pk_util_preparse_sigval (s_sig, elg_names, &l1, NULL);
 1065|    655|  if (rc)
  ------------------
  |  Branch (1065:7): [True: 0, False: 655]
  ------------------
 1066|      0|    goto leave;
 1067|    655|  rc = sexp_extract_param (l1, NULL, "rs", &sig_r, &sig_s, NULL);
  ------------------
  |  |  391|    655|#define sexp_extract_param           _gcry_sexp_extract_param
  ------------------
 1068|    655|  if (rc)
  ------------------
  |  Branch (1068:7): [True: 0, False: 655]
  ------------------
 1069|      0|    goto leave;
 1070|    655|  if (DBG_CIPHER)
  ------------------
  |  |   25|    655|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 655]
  |  |  ------------------
  ------------------
 1071|      0|    {
 1072|      0|      log_mpidump ("elg_verify  s_r", sig_r);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
 1073|      0|      log_mpidump ("elg_verify  s_s", sig_s);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
 1074|      0|    }
 1075|       |
 1076|       |  /* Extract the key.  */
 1077|    655|  rc = sexp_extract_param (s_keyparms, NULL, "pgy",
  ------------------
  |  |  391|    655|#define sexp_extract_param           _gcry_sexp_extract_param
  ------------------
 1078|    655|                                 &pk.p, &pk.g, &pk.y, NULL);
 1079|    655|  if (rc)
  ------------------
  |  Branch (1079:7): [True: 0, False: 655]
  ------------------
 1080|      0|    goto leave;
 1081|    655|  if (DBG_CIPHER)
  ------------------
  |  |   25|    655|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 655]
  |  |  ------------------
  ------------------
 1082|      0|    {
 1083|      0|      log_mpidump ("elg_verify    p", pk.p);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
 1084|      0|      log_mpidump ("elg_verify    g", pk.g);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
 1085|      0|      log_mpidump ("elg_verify    y", pk.y);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
 1086|      0|    }
 1087|       |
 1088|       |  /* Verify the signature.  */
 1089|    655|  if (!verify (sig_r, sig_s, data, &pk))
  ------------------
  |  Branch (1089:7): [True: 655, False: 0]
  ------------------
 1090|    655|    rc = GPG_ERR_BAD_SIGNATURE;
 1091|       |
 1092|    655| leave:
 1093|    655|  _gcry_mpi_release (pk.p);
 1094|    655|  _gcry_mpi_release (pk.g);
 1095|    655|  _gcry_mpi_release (pk.y);
 1096|    655|  _gcry_mpi_release (data);
 1097|    655|  _gcry_mpi_release (sig_r);
 1098|    655|  _gcry_mpi_release (sig_s);
 1099|    655|  sexp_release (l1);
  ------------------
  |  |  372|    655|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1100|    655|  _gcry_pk_util_free_encoding_ctx (&ctx);
 1101|    655|  if (DBG_CIPHER)
  ------------------
  |  |   25|    655|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 655]
  |  |  ------------------
  ------------------
 1102|      0|    log_debug ("elg_verify    => %s\n", rc?gpg_strerror (rc):"Good");
  ------------------
  |  |  205|      0|#define log_debug   _gcry_log_debug
  ------------------
  |  Branch (1102:41): [True: 0, False: 0]
  ------------------
 1103|    655|  return rc;
 1104|    655|}
elgamal.c:elg_get_nbits:
 1120|  2.27k|{
 1121|  2.27k|  gcry_sexp_t l1;
 1122|  2.27k|  gcry_mpi_t p;
 1123|  2.27k|  unsigned int nbits;
 1124|       |
 1125|  2.27k|  l1 = sexp_find_token (parms, "p", 1);
  ------------------
  |  |  381|  2.27k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
 1126|  2.27k|  if (!l1)
  ------------------
  |  Branch (1126:7): [True: 0, False: 2.27k]
  ------------------
 1127|      0|    return 0; /* Parameter P not found.  */
 1128|       |
 1129|  2.27k|  p= sexp_nth_mpi (l1, 1, GCRYMPI_FMT_USG);
  ------------------
  |  |  390|  2.27k|#define sexp_nth_mpi(a, b, c)        _gcry_sexp_nth_mpi ((a), (b), (c))
  ------------------
 1130|  2.27k|  sexp_release (l1);
  ------------------
  |  |  372|  2.27k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1131|  2.27k|  nbits = p? mpi_get_nbits (p) : 0;
  ------------------
  |  |  552|  2.27k|#define mpi_get_nbits(a)       _gcry_mpi_get_nbits ((a))
  ------------------
  |  Branch (1131:11): [True: 2.27k, False: 0]
  ------------------
 1132|  2.27k|  _gcry_mpi_release (p);
 1133|  2.27k|  return nbits;
 1134|  2.27k|}

_gcry_md_block_write:
  121|   265k|{
  122|   265k|  const unsigned char *inbuf = inbuf_arg;
  123|   265k|  gcry_md_block_ctx_t *hd = context;
  124|   265k|  unsigned int stack_burn = 0;
  125|   265k|  unsigned int nburn;
  126|   265k|  const unsigned int blocksize_shift = hd->blocksize_shift;
  127|   265k|  const unsigned int blocksize = 1 << blocksize_shift;
  128|   265k|  size_t inblocks;
  129|   265k|  size_t copylen;
  130|       |
  131|   265k|  if (sizeof(hd->buf) < blocksize)
  ------------------
  |  Branch (131:7): [True: 0, False: 265k]
  ------------------
  132|      0|    BUG();
  ------------------
  |  |  187|      0|#define BUG() _gcry_bug( __FILE__ , __LINE__, __FUNCTION__ )
  ------------------
  133|       |
  134|   265k|  if (!hd->bwrite)
  ------------------
  |  Branch (134:7): [True: 0, False: 265k]
  ------------------
  135|      0|    return;
  136|       |
  137|   265k|  if (hd->count > blocksize)
  ------------------
  |  Branch (137:7): [True: 0, False: 265k]
  ------------------
  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|   439k|  while (hd->count)
  ------------------
  |  Branch (144:10): [True: 297k, False: 141k]
  ------------------
  145|   297k|    {
  146|   297k|      if (hd->count == blocksize)  /* Flush the buffer. */
  ------------------
  |  Branch (146:11): [True: 33.2k, False: 264k]
  ------------------
  147|  33.2k|	{
  148|  33.2k|	  nburn = hd->bwrite (hd, hd->buf, 1);
  149|  33.2k|	  stack_burn = nburn > stack_burn ? nburn : stack_burn;
  ------------------
  |  Branch (149:17): [True: 3.53k, False: 29.7k]
  ------------------
  150|  33.2k|	  hd->count = 0;
  151|  33.2k|	  if (!++hd->nblocks)
  ------------------
  |  Branch (151:8): [True: 0, False: 33.2k]
  ------------------
  152|      0|	    hd->nblocks_high++;
  153|  33.2k|	}
  154|   264k|      else
  155|   264k|	{
  156|   264k|	  copylen = inlen;
  157|   264k|	  if (copylen > blocksize - hd->count)
  ------------------
  |  Branch (157:8): [True: 30.6k, False: 233k]
  ------------------
  158|  30.6k|	    copylen = blocksize - hd->count;
  159|       |
  160|   264k|	  if (copylen == 0)
  ------------------
  |  Branch (160:8): [True: 123k, False: 140k]
  ------------------
  161|   123k|	    break;
  162|       |
  163|   140k|	  buf_cpy (&hd->buf[hd->count], inbuf, copylen);
  164|   140k|	  hd->count += copylen;
  165|   140k|	  inbuf += copylen;
  166|   140k|	  inlen -= copylen;
  167|   140k|	}
  168|   297k|    }
  169|       |
  170|   265k|  if (inlen == 0)
  ------------------
  |  Branch (170:7): [True: 128k, False: 136k]
  ------------------
  171|   128k|    return;
  172|       |
  173|   136k|  if (inlen >= blocksize)
  ------------------
  |  Branch (173:7): [True: 71.1k, False: 65.7k]
  ------------------
  174|  71.1k|    {
  175|  71.1k|      inblocks = inlen >> blocksize_shift;
  176|  71.1k|      nburn = hd->bwrite (hd, inbuf, inblocks);
  177|  71.1k|      stack_burn = nburn > stack_burn ? nburn : stack_burn;
  ------------------
  |  Branch (177:20): [True: 1.51k, False: 69.6k]
  ------------------
  178|  71.1k|      hd->count = 0;
  179|  71.1k|      hd->nblocks_high += (hd->nblocks + inblocks < inblocks);
  180|  71.1k|      hd->nblocks += inblocks;
  181|  71.1k|      inlen -= inblocks << blocksize_shift;
  182|  71.1k|      inbuf += inblocks << blocksize_shift;
  183|  71.1k|    }
  184|       |
  185|   136k|  if (inlen)
  ------------------
  |  Branch (185:7): [True: 134k, False: 2.31k]
  ------------------
  186|   134k|    {
  187|   134k|      buf_cpy (hd->buf, inbuf, inlen);
  188|   134k|      hd->count = inlen;
  189|   134k|    }
  190|       |
  191|   136k|  if (stack_burn > 0)
  ------------------
  |  Branch (191:7): [True: 5.02k, False: 131k]
  ------------------
  192|  5.02k|    _gcry_burn_stack (stack_burn);
  ------------------
  |  |  371|  5.02k|	do { __gcry_burn_stack (bytes); \
  |  |  372|  5.02k|	     __gcry_burn_stack_dummy (); } while(0)
  |  |  ------------------
  |  |  |  |  364|  5.02k|#define  __gcry_burn_stack_dummy() asm volatile ("":::"memory")
  |  |  ------------------
  |  |  |  Branch (372:43): [Folded - Ignored]
  |  |  ------------------
  ------------------
  193|   136k|}

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

_gcry_md_algo_name:
  421|     72|{
  422|     72|  const gcry_md_spec_t *spec;
  423|       |
  424|     72|  spec = spec_from_algo (algorithm);
  425|     72|  return spec ? spec->name : "?";
  ------------------
  |  Branch (425:10): [True: 72, False: 0]
  ------------------
  426|     72|}
_gcry_md_open:
  530|   132k|{
  531|   132k|  gcry_err_code_t rc;
  532|   132k|  gcry_md_hd_t hd;
  533|       |
  534|   132k|  if ((flags & ~(GCRY_MD_FLAG_SECURE
  ------------------
  |  Branch (534:7): [True: 0, False: 132k]
  ------------------
  535|   132k|                 | GCRY_MD_FLAG_HMAC
  536|   132k|                 | GCRY_MD_FLAG_BUGEMU1)))
  537|      0|    rc = GPG_ERR_INV_ARG;
  538|   132k|  else
  539|   132k|    rc = md_open (&hd, algo, flags);
  540|       |
  541|   132k|  *h = rc? NULL : hd;
  ------------------
  |  Branch (541:8): [True: 266, False: 132k]
  ------------------
  542|   132k|  return rc;
  543|   132k|}
_gcry_md_enable:
  612|  84.4k|{
  613|  84.4k|  return md_enable (hd, algorithm);
  614|  84.4k|}
_gcry_md_copy:
  684|  3.12k|{
  685|  3.12k|  gcry_err_code_t rc;
  686|       |
  687|  3.12k|  rc = md_copy (hd, handle);
  688|  3.12k|  if (rc)
  ------------------
  |  Branch (688:7): [True: 0, False: 3.12k]
  ------------------
  689|      0|    *handle = NULL;
  690|  3.12k|  return rc;
  691|  3.12k|}
_gcry_md_reset:
  700|  17.6k|{
  701|  17.6k|  GcryDigestEntry *r;
  702|       |
  703|       |  /* Note: We allow this even in fips non operational mode.  */
  704|       |
  705|  17.6k|  a->bufpos = a->ctx->flags.finalized = 0;
  706|       |
  707|  17.6k|  if (a->ctx->flags.hmac)
  ------------------
  |  Branch (707:7): [True: 0, False: 17.6k]
  ------------------
  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|  17.6k|  else
  714|  35.3k|    for (r = a->ctx->list; r; r = r->next)
  ------------------
  |  Branch (714:28): [True: 17.6k, False: 17.6k]
  ------------------
  715|  17.6k|      {
  716|  17.6k|        memset (r->context, 0, r->spec->contextsize);
  717|  17.6k|        (*r->spec->init) (r->context,
  718|  17.6k|                          a->ctx->flags.bugemu1? GCRY_MD_FLAG_BUGEMU1:0);
  ------------------
  |  Branch (718:27): [True: 0, False: 17.6k]
  ------------------
  719|  17.6k|      }
  720|  17.6k|}
_gcry_md_close:
  746|   540k|{
  747|       |  /* Note: We allow this even in fips non operational mode.  */
  748|   540k|  md_close (hd);
  749|   540k|}
_gcry_md_write:
  780|   125k|{
  781|   125k|  md_write (hd, inbuf, inlen);
  782|   125k|}
_gcry_md_ctl:
 1001|   102k|{
 1002|   102k|  gcry_err_code_t rc = 0;
 1003|       |
 1004|   102k|  (void)buflen; /* Currently not used.  */
 1005|       |
 1006|   102k|  switch (cmd)
 1007|   102k|    {
 1008|   102k|    case GCRYCTL_FINALIZE:
  ------------------
  |  Branch (1008:5): [True: 102k, False: 0]
  ------------------
 1009|   102k|      md_final (hd);
 1010|   102k|      break;
 1011|      0|    case GCRYCTL_START_DUMP:
  ------------------
  |  Branch (1011:5): [True: 0, False: 102k]
  ------------------
 1012|      0|      md_start_debug (hd, buffer);
 1013|      0|      break;
 1014|      0|    case GCRYCTL_STOP_DUMP:
  ------------------
  |  Branch (1014:5): [True: 0, False: 102k]
  ------------------
 1015|      0|      md_stop_debug ( hd );
 1016|      0|      break;
 1017|      0|    default:
  ------------------
  |  Branch (1017:5): [True: 0, False: 102k]
  ------------------
 1018|      0|      rc = GPG_ERR_INV_OP;
 1019|   102k|    }
 1020|   102k|  return rc;
 1021|   102k|}
_gcry_md_read:
 1103|  42.4k|{
 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|  42.4k|  _gcry_md_ctl (hd, GCRYCTL_FINALIZE, NULL, 0);
 1108|  42.4k|  return md_read (hd, algo);
 1109|  42.4k|}
_gcry_md_hash_buffers_extract:
 1249|  4.59k|{
 1250|  4.59k|  const gcry_md_spec_t *spec;
 1251|  4.59k|  int hmac;
 1252|       |
 1253|  4.59k|  if (!iov || iovcnt < 0)
  ------------------
  |  Branch (1253:7): [True: 0, False: 4.59k]
  |  Branch (1253:15): [True: 0, False: 4.59k]
  ------------------
 1254|      0|    return GPG_ERR_INV_ARG;
 1255|  4.59k|  if (flags & ~(GCRY_MD_FLAG_HMAC))
  ------------------
  |  Branch (1255:7): [True: 0, False: 4.59k]
  ------------------
 1256|      0|    return GPG_ERR_INV_ARG;
 1257|       |
 1258|  4.59k|  hmac = !!(flags & GCRY_MD_FLAG_HMAC);
 1259|  4.59k|  if (hmac && iovcnt < 1)
  ------------------
  |  Branch (1259:7): [True: 0, False: 4.59k]
  |  Branch (1259:15): [True: 0, False: 0]
  ------------------
 1260|      0|    return GPG_ERR_INV_ARG;
 1261|       |
 1262|  4.59k|  spec = spec_from_algo (algo);
 1263|  4.59k|  if (!spec)
  ------------------
  |  Branch (1263:7): [True: 0, False: 4.59k]
  ------------------
 1264|      0|    {
 1265|      0|      log_debug ("md_hash_buffers: algorithm %d not available\n", algo);
  ------------------
  |  |  205|      0|#define log_debug   _gcry_log_debug
  ------------------
 1266|      0|      return GPG_ERR_DIGEST_ALGO;
 1267|      0|    }
 1268|       |
 1269|  4.59k|  if (spec->mdlen > 0 && digestlen != -1 && digestlen != spec->mdlen)
  ------------------
  |  Branch (1269:7): [True: 4.59k, False: 0]
  |  Branch (1269:26): [True: 4.59k, False: 0]
  |  Branch (1269:45): [True: 0, False: 4.59k]
  ------------------
 1270|      0|    return GPG_ERR_DIGEST_ALGO;
 1271|  4.59k|  if (spec->mdlen == 0 && digestlen == -1)
  ------------------
  |  Branch (1271:7): [True: 0, False: 4.59k]
  |  Branch (1271:27): [True: 0, False: 0]
  ------------------
 1272|      0|    return GPG_ERR_DIGEST_ALGO;
 1273|       |
 1274|  4.59k|  if (!hmac && spec->hash_buffers)
  ------------------
  |  Branch (1274:7): [True: 4.59k, False: 0]
  |  Branch (1274:16): [True: 4.59k, False: 0]
  ------------------
 1275|  4.59k|    {
 1276|  4.59k|      if (spec->flags.disabled || (!spec->flags.fips && fips_mode ()))
  ------------------
  |  |  449|      0|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1276:11): [True: 0, False: 4.59k]
  |  Branch (1276:36): [True: 0, False: 4.59k]
  ------------------
 1277|      0|        return GPG_ERR_DIGEST_ALGO;
 1278|       |
 1279|  4.59k|      spec->hash_buffers (digest, digestlen, iov, iovcnt);
 1280|  4.59k|    }
 1281|      0|  else
 1282|      0|    {
 1283|       |      /* For the others we do not have a fast function, so we use the
 1284|       |         normal functions.  */
 1285|      0|      gcry_md_hd_t h;
 1286|      0|      gpg_err_code_t rc;
 1287|       |
 1288|      0|      rc = md_open (&h, algo, (hmac? GCRY_MD_FLAG_HMAC:0));
  ------------------
  |  Branch (1288:32): [True: 0, False: 0]
  ------------------
 1289|      0|      if (rc)
  ------------------
  |  Branch (1289:11): [True: 0, False: 0]
  ------------------
 1290|      0|        return rc;
 1291|       |
 1292|      0|      if (hmac)
  ------------------
  |  Branch (1292:11): [True: 0, False: 0]
  ------------------
 1293|      0|        {
 1294|      0|          rc = _gcry_md_setkey (h,
 1295|      0|                                (const char*)iov[0].data + iov[0].off,
 1296|      0|                                iov[0].len);
 1297|      0|          if (rc)
  ------------------
  |  Branch (1297:15): [True: 0, False: 0]
  ------------------
 1298|      0|            {
 1299|      0|              md_close (h);
 1300|      0|              return rc;
 1301|      0|            }
 1302|      0|          iov++; iovcnt--;
 1303|      0|        }
 1304|      0|      for (;iovcnt; iov++, iovcnt--)
  ------------------
  |  Branch (1304:13): [True: 0, False: 0]
  ------------------
 1305|      0|        md_write (h, (const char*)iov[0].data + iov[0].off, iov[0].len);
 1306|      0|      md_final (h);
 1307|      0|      if (spec->mdlen > 0)
  ------------------
  |  Branch (1307:11): [True: 0, False: 0]
  ------------------
 1308|      0|	memcpy (digest, md_read (h, algo), spec->mdlen);
 1309|      0|      else if (digestlen > 0)
  ------------------
  |  Branch (1309:16): [True: 0, False: 0]
  ------------------
 1310|      0|	md_extract (h, algo, digest, digestlen);
 1311|      0|      md_close (h);
 1312|      0|    }
 1313|       |
 1314|  4.59k|  return 0;
 1315|  4.59k|}
_gcry_md_get_algo:
 1356|  29.7k|{
 1357|  29.7k|  return md_get_algo (hd);
 1358|  29.7k|}
_gcry_md_get_algo_dlen:
 1380|  44.7k|{
 1381|  44.7k|  return md_digest_length (algorithm);
 1382|  44.7k|}
_gcry_md_algo_info:
 1429|  54.0k|{
 1430|  54.0k|  gcry_err_code_t rc;
 1431|       |
 1432|  54.0k|  switch (what)
 1433|  54.0k|    {
 1434|  44.0k|    case GCRYCTL_TEST_ALGO:
  ------------------
  |  Branch (1434:5): [True: 44.0k, False: 10.0k]
  ------------------
 1435|  44.0k|      if (buffer || nbytes)
  ------------------
  |  Branch (1435:11): [True: 0, False: 44.0k]
  |  Branch (1435:21): [True: 0, False: 44.0k]
  ------------------
 1436|      0|	rc = GPG_ERR_INV_ARG;
 1437|  44.0k|      else
 1438|  44.0k|	rc = check_digest_algo (algo);
 1439|  44.0k|      break;
 1440|       |
 1441|  10.0k|    case GCRYCTL_GET_ASNOID:
  ------------------
  |  Branch (1441:5): [True: 10.0k, False: 44.0k]
  ------------------
 1442|       |      /* We need to check that the algo is available because
 1443|       |         md_asn_oid would otherwise raise an assertion. */
 1444|  10.0k|      rc = check_digest_algo (algo);
 1445|  10.0k|      if (!rc)
  ------------------
  |  Branch (1445:11): [True: 10.0k, False: 0]
  ------------------
 1446|  10.0k|        {
 1447|  10.0k|          const char unsigned *asn;
 1448|  10.0k|          size_t asnlen;
 1449|       |
 1450|  10.0k|          asn = md_asn_oid (algo, &asnlen, NULL);
 1451|  10.0k|          if (buffer && (*nbytes >= asnlen))
  ------------------
  |  Branch (1451:15): [True: 5.03k, False: 5.03k]
  |  Branch (1451:25): [True: 5.03k, False: 0]
  ------------------
 1452|  5.03k|            {
 1453|  5.03k|              memcpy (buffer, asn, asnlen);
 1454|  5.03k|              *nbytes = asnlen;
 1455|  5.03k|            }
 1456|  5.03k|          else if (!buffer && nbytes)
  ------------------
  |  Branch (1456:20): [True: 5.03k, False: 0]
  |  Branch (1456:31): [True: 5.03k, False: 0]
  ------------------
 1457|  5.03k|            *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|  10.0k|        }
 1466|  10.0k|      break;
 1467|       |
 1468|      0|    case GCRYCTL_SELFTEST:
  ------------------
  |  Branch (1468:5): [True: 0, False: 54.0k]
  ------------------
 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: 54.0k]
  ------------------
 1475|      0|      rc = GPG_ERR_INV_OP;
 1476|      0|      break;
 1477|  54.0k|  }
 1478|       |
 1479|  54.0k|  return rc;
 1480|  54.0k|}
_gcry_md_info:
 1538|  5.27k|{
 1539|  5.27k|  gcry_err_code_t rc = 0;
 1540|       |
 1541|  5.27k|  switch (cmd)
 1542|  5.27k|    {
 1543|  2.22k|    case GCRYCTL_IS_SECURE:
  ------------------
  |  Branch (1543:5): [True: 2.22k, False: 3.04k]
  ------------------
 1544|  2.22k|      *nbytes = h->ctx->flags.secure;
 1545|  2.22k|      break;
 1546|       |
 1547|  3.04k|    case GCRYCTL_IS_ALGO_ENABLED:
  ------------------
  |  Branch (1547:5): [True: 3.04k, False: 2.22k]
  ------------------
 1548|  3.04k|      {
 1549|  3.04k|	GcryDigestEntry *r;
 1550|  3.04k|	int algo;
 1551|       |
 1552|  3.04k|	if ( !buffer || !nbytes || *nbytes != sizeof (int))
  ------------------
  |  Branch (1552:7): [True: 0, False: 3.04k]
  |  Branch (1552:18): [True: 0, False: 3.04k]
  |  Branch (1552:29): [True: 0, False: 3.04k]
  ------------------
 1553|      0|	  rc = GPG_ERR_INV_ARG;
 1554|  3.04k|	else
 1555|  3.04k|	  {
 1556|  3.04k|	    algo = *(int*)buffer;
 1557|       |
 1558|  3.04k|	    *nbytes = 0;
 1559|  3.78k|	    for(r=h->ctx->list; r; r = r->next ) {
  ------------------
  |  Branch (1559:26): [True: 3.70k, False: 77]
  ------------------
 1560|  3.70k|	      if (r->spec->algo == algo)
  ------------------
  |  Branch (1560:12): [True: 2.96k, False: 740]
  ------------------
 1561|  2.96k|		{
 1562|  2.96k|		  *nbytes = 1;
 1563|  2.96k|		  break;
 1564|  2.96k|		}
 1565|  3.70k|	    }
 1566|  3.04k|	  }
 1567|  3.04k|	break;
 1568|      0|      }
 1569|       |
 1570|      0|  default:
  ------------------
  |  Branch (1570:3): [True: 0, False: 5.27k]
  ------------------
 1571|      0|    rc = GPG_ERR_INV_OP;
 1572|  5.27k|  }
 1573|       |
 1574|  5.27k|  return rc;
 1575|  5.27k|}
_gcry_md_init:
 1581|      1|{
 1582|      1|  return 0;
 1583|      1|}
_gcry_md_is_secure:
 1588|  2.22k|{
 1589|  2.22k|  size_t value;
 1590|       |
 1591|  2.22k|  if (_gcry_md_info (a, GCRYCTL_IS_SECURE, NULL, &value))
  ------------------
  |  Branch (1591:7): [True: 0, False: 2.22k]
  ------------------
 1592|      0|    value = 1; /* It seems to be better to assume secure memory on
 1593|       |                  error. */
 1594|  2.22k|  return value;
 1595|  2.22k|}
_gcry_md_is_enabled:
 1600|  3.04k|{
 1601|  3.04k|  size_t value;
 1602|       |
 1603|  3.04k|  value = sizeof algo;
 1604|  3.04k|  if (_gcry_md_info (a, GCRYCTL_IS_ALGO_ENABLED, &algo, &value))
  ------------------
  |  Branch (1604:7): [True: 0, False: 3.04k]
  ------------------
 1605|      0|    value = 0;
 1606|  3.04k|  return value;
 1607|  3.04k|}
md.c:spec_from_algo:
  301|   226k|{
  302|   226k|  const gcry_md_spec_t *spec = NULL;
  303|       |
  304|   226k|  algo = map_algo (algo);
  305|       |
  306|   226k|  if (algo >= 0 && algo < DIM(digest_list_algo0))
  ------------------
  |  |  104|   226k|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (306:7): [True: 226k, False: 0]
  |  Branch (306:20): [True: 207k, False: 18.8k]
  ------------------
  307|   207k|    spec = digest_list_algo0[algo];
  308|  18.8k|  else if (algo >= 301 && algo < 301 + DIM(digest_list_algo301))
  ------------------
  |  |  104|  3.44k|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (308:12): [True: 3.44k, False: 15.4k]
  |  Branch (308:27): [True: 3.44k, False: 0]
  ------------------
  309|  3.44k|    spec = digest_list_algo301[algo - 301];
  310|       |
  311|   226k|  if (spec)
  ------------------
  |  Branch (311:7): [True: 182k, False: 43.3k]
  ------------------
  312|   182k|    gcry_assert (spec->algo == algo);
  ------------------
  |  |  188|   182k|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|   182k|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 182k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|   182k|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  313|       |
  314|      0|  return spec;
  315|   226k|}
md.c:map_algo:
  292|   226k|{
  293|   226k|  return algo;
  294|   226k|}
md.c:md_open:
  450|   132k|{
  451|   132k|  gcry_err_code_t err = 0;
  452|   132k|  int secure = !!(flags & GCRY_MD_FLAG_SECURE);
  453|   132k|  int hmac =   !!(flags & GCRY_MD_FLAG_HMAC);
  454|   132k|  int bufsize = secure ? 512 : 1024;
  ------------------
  |  Branch (454:17): [True: 0, False: 132k]
  ------------------
  455|   132k|  gcry_md_hd_t hd;
  456|   132k|  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|   132k|  n = offsetof (struct gcry_md_handle, buf) + bufsize;
  473|   132k|  n = ((n + sizeof (PROPERLY_ALIGNED_TYPE) - 1)
  474|   132k|       / sizeof (PROPERLY_ALIGNED_TYPE)) * sizeof (PROPERLY_ALIGNED_TYPE);
  475|       |
  476|       |  /* Allocate and set the Context pointer to the private data */
  477|   132k|  if (secure)
  ------------------
  |  Branch (477:7): [True: 0, False: 132k]
  ------------------
  478|      0|    hd = xtrymalloc_secure (n + sizeof (struct gcry_md_context));
  ------------------
  |  |  140|      0|#define xtrymalloc_secure(a)   _gcry_malloc_secure ((a))
  ------------------
  479|   132k|  else
  480|   132k|    hd = xtrymalloc (n + sizeof (struct gcry_md_context));
  ------------------
  |  |  138|   132k|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  481|       |
  482|   132k|  if (! hd)
  ------------------
  |  Branch (482:7): [True: 0, False: 132k]
  ------------------
  483|      0|    err = gpg_err_code_from_errno (errno);
  484|       |
  485|   132k|  if (! err)
  ------------------
  |  Branch (485:7): [True: 132k, False: 0]
  ------------------
  486|   132k|    {
  487|   132k|      struct gcry_md_context *ctx;
  488|       |
  489|   132k|      ctx = (void *) (hd->buf - offsetof (struct gcry_md_handle, buf) + n);
  490|       |      /* Setup the globally visible data (bctl in the diagram).*/
  491|   132k|      hd->ctx = ctx;
  492|   132k|      hd->bufsize = n - offsetof (struct gcry_md_handle, buf);
  493|   132k|      hd->bufpos = 0;
  494|       |
  495|       |      /* Initialize the private data. */
  496|   132k|      wipememory2 (ctx, 0, sizeof *ctx);
  ------------------
  |  |  388|   132k|#define wipememory2(_ptr,_set,_len) do { \
  |  |  389|   132k|	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  ------------------
  |  |  |  |   87|   265k|#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|   132k|	      } else { \
  |  |  395|   132k|		fast_wipememory2_inline((void *)(_ptr), (_set), (_len)); \
  |  |  ------------------
  |  |  |  |  380|   132k|#define fast_wipememory2_inline(_ptr,_set,_len) do { \
  |  |  |  |  381|   132k|	      memset((_ptr), (_set), (_len)); \
  |  |  |  |  382|   132k|	      asm volatile ("\n" :: "r" (_ptr) : "memory"); \
  |  |  |  |  383|   132k|	    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (383:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  396|   132k|	      } \
  |  |  397|   132k|	    } while(0)
  |  |  ------------------
  |  |  |  Branch (397:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  497|   132k|      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|   265k|#define CTX_MAGIC_NORMAL 0x11071961
  ------------------
  |  Branch (497:20): [True: 0, False: 132k]
  ------------------
  498|   132k|      ctx->actual_handle_size = n + sizeof (struct gcry_md_context);
  499|   132k|      ctx->flags.secure = secure;
  500|   132k|      ctx->flags.hmac = hmac;
  501|   132k|      ctx->flags.bugemu1 = !!(flags & GCRY_MD_FLAG_BUGEMU1);
  502|   132k|    }
  503|       |
  504|   132k|  if (! err)
  ------------------
  |  Branch (504:7): [True: 132k, False: 0]
  ------------------
  505|   132k|    {
  506|       |      /* Hmmm, should we really do that? - yes [-wk] */
  507|   132k|      _gcry_fast_random_poll ();
  508|       |
  509|   132k|      if (algo)
  ------------------
  |  Branch (509:11): [True: 49.1k, False: 83.6k]
  ------------------
  510|  49.1k|	{
  511|  49.1k|	  err = md_enable (hd, algo);
  512|  49.1k|	  if (err)
  ------------------
  |  Branch (512:8): [True: 266, False: 48.8k]
  ------------------
  513|    266|	    md_close (hd);
  514|  49.1k|	}
  515|   132k|    }
  516|       |
  517|   132k|  if (! err)
  ------------------
  |  Branch (517:7): [True: 132k, False: 266]
  ------------------
  518|   132k|    *h = hd;
  519|       |
  520|   132k|  return err;
  521|   132k|}
md.c:md_enable:
  549|   133k|{
  550|   133k|  struct gcry_md_context *h = hd->ctx;
  551|   133k|  const gcry_md_spec_t *spec;
  552|   133k|  GcryDigestEntry *entry;
  553|   133k|  gcry_err_code_t err = 0;
  554|       |
  555|   179k|  for (entry = h->list; entry; entry = entry->next)
  ------------------
  |  Branch (555:25): [True: 67.2k, False: 112k]
  ------------------
  556|  67.2k|    if (entry->spec->algo == algorithm)
  ------------------
  |  Branch (556:9): [True: 20.8k, False: 46.3k]
  ------------------
  557|  20.8k|      return 0; /* Already enabled */
  558|       |
  559|   112k|  spec = spec_from_algo (algorithm);
  560|   112k|  if (!spec)
  ------------------
  |  Branch (560:7): [True: 43.3k, False: 69.3k]
  ------------------
  561|  43.3k|    {
  562|  43.3k|      log_debug ("md_enable: algorithm %d not available\n", algorithm);
  ------------------
  |  |  205|  43.3k|#define log_debug   _gcry_log_debug
  ------------------
  563|  43.3k|      err = GPG_ERR_DIGEST_ALGO;
  564|  43.3k|    }
  565|       |
  566|   112k|  if (!err && spec->flags.disabled)
  ------------------
  |  Branch (566:7): [True: 69.3k, False: 43.3k]
  |  Branch (566:15): [True: 0, False: 69.3k]
  ------------------
  567|      0|    err = GPG_ERR_DIGEST_ALGO;
  568|       |
  569|       |  /* Any non-FIPS algorithm should go this way */
  570|   112k|  if (!err && !spec->flags.fips && fips_mode ())
  ------------------
  |  |  449|  10.2k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 10.2k]
  |  |  ------------------
  ------------------
  |  Branch (570:7): [True: 69.3k, False: 43.3k]
  |  Branch (570:15): [True: 10.2k, False: 59.0k]
  ------------------
  571|      0|    err = GPG_ERR_DIGEST_ALGO;
  572|       |
  573|   112k|  if (!err && h->flags.hmac && spec->read == NULL)
  ------------------
  |  Branch (573:7): [True: 69.3k, False: 43.3k]
  |  Branch (573:15): [True: 0, False: 69.3k]
  |  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|   112k|  if (!err)
  ------------------
  |  Branch (579:7): [True: 69.3k, False: 43.3k]
  ------------------
  580|  69.3k|    {
  581|  69.3k|      size_t size = (sizeof (*entry)
  582|  69.3k|                     + spec->contextsize * (h->flags.hmac? 3 : 1)
  ------------------
  |  Branch (582:45): [True: 0, False: 69.3k]
  ------------------
  583|  69.3k|                     - sizeof (entry->context));
  584|       |
  585|       |      /* And allocate a new list entry. */
  586|  69.3k|      if (h->flags.secure)
  ------------------
  |  Branch (586:11): [True: 0, False: 69.3k]
  ------------------
  587|      0|	entry = xtrymalloc_secure (size);
  ------------------
  |  |  140|      0|#define xtrymalloc_secure(a)   _gcry_malloc_secure ((a))
  ------------------
  588|  69.3k|      else
  589|  69.3k|	entry = xtrymalloc (size);
  ------------------
  |  |  138|  69.3k|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  590|       |
  591|  69.3k|      if (! entry)
  ------------------
  |  Branch (591:11): [True: 0, False: 69.3k]
  ------------------
  592|      0|	err = gpg_err_code_from_errno (errno);
  593|  69.3k|      else
  594|  69.3k|	{
  595|  69.3k|	  entry->spec = spec;
  596|  69.3k|	  entry->next = h->list;
  597|  69.3k|          entry->actual_struct_size = size;
  598|  69.3k|	  h->list = entry;
  599|       |
  600|       |	  /* And init this instance. */
  601|  69.3k|	  entry->spec->init (entry->context,
  602|  69.3k|                             h->flags.bugemu1? GCRY_MD_FLAG_BUGEMU1:0);
  ------------------
  |  Branch (602:30): [True: 0, False: 69.3k]
  ------------------
  603|  69.3k|	}
  604|  69.3k|    }
  605|       |
  606|   112k|  return err;
  607|   133k|}
md.c:md_copy:
  619|  3.12k|{
  620|  3.12k|  gcry_err_code_t err = 0;
  621|  3.12k|  struct gcry_md_context *a = ahd->ctx;
  622|  3.12k|  struct gcry_md_context *b;
  623|  3.12k|  GcryDigestEntry *ar, *br;
  624|  3.12k|  gcry_md_hd_t bhd;
  625|  3.12k|  size_t n;
  626|       |
  627|  3.12k|  if (ahd->bufpos)
  ------------------
  |  Branch (627:7): [True: 75, False: 3.05k]
  ------------------
  628|     75|    md_write (ahd, NULL, 0);
  629|       |
  630|  3.12k|  n = (char *) ahd->ctx - (char *) ahd;
  631|  3.12k|  if (a->flags.secure)
  ------------------
  |  Branch (631:7): [True: 0, False: 3.12k]
  ------------------
  632|      0|    bhd = xtrymalloc_secure (n + sizeof (struct gcry_md_context));
  ------------------
  |  |  140|      0|#define xtrymalloc_secure(a)   _gcry_malloc_secure ((a))
  ------------------
  633|  3.12k|  else
  634|  3.12k|    bhd = xtrymalloc (n + sizeof (struct gcry_md_context));
  ------------------
  |  |  138|  3.12k|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  635|       |
  636|  3.12k|  if (!bhd)
  ------------------
  |  Branch (636:7): [True: 0, False: 3.12k]
  ------------------
  637|      0|    {
  638|      0|      err = gpg_err_code_from_syserror ();
  639|      0|      goto leave;
  640|      0|    }
  641|       |
  642|  3.12k|  bhd->ctx = b = (void *) ((char *) bhd + n);
  643|       |  /* No need to copy the buffer due to the write above. */
  644|  3.12k|  gcry_assert (ahd->bufsize == (n - offsetof (struct gcry_md_handle, buf)));
  ------------------
  |  |  188|  3.12k|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|  3.12k|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 3.12k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|  3.12k|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  645|      0|  bhd->bufsize = ahd->bufsize;
  646|  3.12k|  bhd->bufpos = 0;
  647|  3.12k|  gcry_assert (! ahd->bufpos);
  ------------------
  |  |  188|  3.12k|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|  3.12k|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 3.12k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|  3.12k|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  648|      0|  memcpy (b, a, sizeof *a);
  649|  3.12k|  b->list = NULL;
  650|  3.12k|  b->debug = NULL;
  651|       |
  652|       |  /* Copy the complete list of algorithms.  The copied list is
  653|       |     reversed, but that doesn't matter. */
  654|  7.25k|  for (ar = a->list; ar; ar = ar->next)
  ------------------
  |  Branch (654:22): [True: 4.12k, False: 3.12k]
  ------------------
  655|  4.12k|    {
  656|  4.12k|      if (a->flags.secure)
  ------------------
  |  Branch (656:11): [True: 0, False: 4.12k]
  ------------------
  657|      0|        br = xtrymalloc_secure (ar->actual_struct_size);
  ------------------
  |  |  140|      0|#define xtrymalloc_secure(a)   _gcry_malloc_secure ((a))
  ------------------
  658|  4.12k|      else
  659|  4.12k|        br = xtrymalloc (ar->actual_struct_size);
  ------------------
  |  |  138|  4.12k|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  660|  4.12k|      if (!br)
  ------------------
  |  Branch (660:11): [True: 0, False: 4.12k]
  ------------------
  661|      0|        {
  662|      0|          err = gpg_err_code_from_syserror ();
  663|      0|          md_close (bhd);
  664|      0|          goto leave;
  665|      0|        }
  666|       |
  667|  4.12k|      memcpy (br, ar, ar->actual_struct_size);
  668|  4.12k|      br->next = b->list;
  669|  4.12k|      b->list = br;
  670|  4.12k|    }
  671|       |
  672|  3.12k|  if (a->debug)
  ------------------
  |  Branch (672:7): [True: 0, False: 3.12k]
  ------------------
  673|      0|    md_start_debug (bhd, "unknown");
  674|       |
  675|  3.12k|  *b_hd = bhd;
  676|       |
  677|  3.12k| leave:
  678|  3.12k|  return err;
  679|  3.12k|}
md.c:md_close:
  725|   540k|{
  726|   540k|  GcryDigestEntry *r, *r2;
  727|       |
  728|   540k|  if (! a)
  ------------------
  |  Branch (728:7): [True: 405k, False: 135k]
  ------------------
  729|   405k|    return;
  730|   135k|  if (a->ctx->debug)
  ------------------
  |  Branch (730:7): [True: 0, False: 135k]
  ------------------
  731|      0|    md_stop_debug (a);
  732|   209k|  for (r = a->ctx->list; r; r = r2)
  ------------------
  |  Branch (732:26): [True: 73.4k, False: 135k]
  ------------------
  733|  73.4k|    {
  734|  73.4k|      r2 = r->next;
  735|  73.4k|      wipememory (r, r->actual_struct_size);
  ------------------
  |  |  398|  73.4k|#define wipememory(_ptr,_len) wipememory2((_ptr),0,(_len))
  |  |  ------------------
  |  |  |  |  388|  73.4k|#define wipememory2(_ptr,_set,_len) do { \
  |  |  |  |  389|  73.4k|	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|   146k|#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: 73.4k, False: 0]
  |  |  |  |  |  Branch (389:33): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  390|  73.4k|		if (CONSTANT_P(_set) && (_set) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|   146k|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (87:27): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:27): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  391|  73.4k|		  _gcry_fast_wipememory((void *)(_ptr), (_len)); \
  |  |  |  |  392|  73.4k|		else \
  |  |  |  |  393|  73.4k|		  _gcry_fast_wipememory2((void *)(_ptr), (_set), (_len)); \
  |  |  |  |  394|  73.4k|	      } 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|  73.4k|	    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (397:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  736|  73.4k|      xfree (r);
  ------------------
  |  |  150|  73.4k|#define xfree(a)         _gcry_free ((a))
  ------------------
  737|  73.4k|    }
  738|       |
  739|   135k|  wipememory (a, a->ctx->actual_handle_size);
  ------------------
  |  |  398|   135k|#define wipememory(_ptr,_len) wipememory2((_ptr),0,(_len))
  |  |  ------------------
  |  |  |  |  388|   135k|#define wipememory2(_ptr,_set,_len) do { \
  |  |  |  |  389|   135k|	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|   271k|#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: 135k, False: 0]
  |  |  |  |  |  Branch (389:33): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  390|   135k|		if (CONSTANT_P(_set) && (_set) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|   271k|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (87:27): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:27): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  391|   135k|		  _gcry_fast_wipememory((void *)(_ptr), (_len)); \
  |  |  |  |  392|   135k|		else \
  |  |  |  |  393|   135k|		  _gcry_fast_wipememory2((void *)(_ptr), (_set), (_len)); \
  |  |  |  |  394|   135k|	      } 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|   135k|	    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (397:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  740|   135k|  xfree(a);
  ------------------
  |  |  150|   135k|#define xfree(a)         _gcry_free ((a))
  ------------------
  741|   135k|}
md.c:md_write:
  754|   139k|{
  755|   139k|  GcryDigestEntry *r;
  756|       |
  757|   139k|  if (a->ctx->debug)
  ------------------
  |  Branch (757:7): [True: 0, False: 139k]
  ------------------
  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|   281k|  for (r = a->ctx->list; r; r = r->next)
  ------------------
  |  Branch (765:26): [True: 141k, False: 139k]
  ------------------
  766|   141k|    {
  767|   141k|      if (a->bufpos)
  ------------------
  |  Branch (767:11): [True: 65.0k, False: 76.4k]
  ------------------
  768|  65.0k|	(*r->spec->write) (r->context, a->buf, a->bufpos);
  769|   141k|      (*r->spec->write) (r->context, inbuf, inlen);
  770|   141k|    }
  771|   139k|  a->bufpos = 0;
  772|   139k|}
md.c:md_final:
  787|   102k|{
  788|   102k|  GcryDigestEntry *r;
  789|       |
  790|   102k|  if (a->ctx->flags.finalized)
  ------------------
  |  Branch (790:7): [True: 42.4k, False: 60.5k]
  ------------------
  791|  42.4k|    return;
  792|       |
  793|  60.5k|  if (a->bufpos)
  ------------------
  |  Branch (793:7): [True: 14.1k, False: 46.4k]
  ------------------
  794|  14.1k|    md_write (a, NULL, 0);
  795|       |
  796|   121k|  for (r = a->ctx->list; r; r = r->next)
  ------------------
  |  Branch (796:26): [True: 60.5k, False: 60.5k]
  ------------------
  797|  60.5k|    (*r->spec->final) (r->context);
  798|       |
  799|  60.5k|  a->ctx->flags.finalized = 1;
  800|       |
  801|  60.5k|  if (!a->ctx->flags.hmac)
  ------------------
  |  Branch (801:7): [True: 60.5k, False: 0]
  ------------------
  802|  60.5k|    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|  42.4k|{
 1064|  42.4k|  GcryDigestEntry *r = a->ctx->list;
 1065|       |
 1066|  42.4k|  if (! algo)
  ------------------
  |  Branch (1066:7): [True: 29.7k, False: 12.7k]
  ------------------
 1067|  29.7k|    {
 1068|       |      /* Return the first algorithm */
 1069|  29.7k|      if (r)
  ------------------
  |  Branch (1069:11): [True: 29.7k, False: 0]
  ------------------
 1070|  29.7k|        {
 1071|  29.7k|          if (r->next)
  ------------------
  |  Branch (1071:15): [True: 0, False: 29.7k]
  ------------------
 1072|      0|            log_debug ("more than one algorithm in md_read(0)\n");
  ------------------
  |  |  205|      0|#define log_debug   _gcry_log_debug
  ------------------
 1073|  29.7k|          if (r->spec->read)
  ------------------
  |  Branch (1073:15): [True: 29.7k, False: 0]
  ------------------
 1074|  29.7k|            return r->spec->read (r->context);
 1075|  29.7k|        }
 1076|  29.7k|    }
 1077|  12.7k|  else
 1078|  12.7k|    {
 1079|  12.7k|      for (r = a->ctx->list; r; r = r->next)
  ------------------
  |  Branch (1079:30): [True: 12.7k, False: 0]
  ------------------
 1080|  12.7k|	if (r->spec->algo == algo)
  ------------------
  |  Branch (1080:6): [True: 12.7k, False: 0]
  ------------------
 1081|  12.7k|	  {
 1082|  12.7k|	    if (r->spec->read)
  ------------------
  |  Branch (1082:10): [True: 12.7k, False: 0]
  ------------------
 1083|  12.7k|              return r->spec->read (r->context);
 1084|      0|            break;
 1085|  12.7k|	  }
 1086|  12.7k|    }
 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:md_get_algo:
 1342|  29.7k|{
 1343|  29.7k|  GcryDigestEntry *r = a->ctx->list;
 1344|       |
 1345|  29.7k|  if (r && r->next)
  ------------------
  |  Branch (1345:7): [True: 29.7k, False: 0]
  |  Branch (1345:12): [True: 0, False: 29.7k]
  ------------------
 1346|      0|    {
 1347|      0|      fips_signal_error ("possible usage error");
  ------------------
  |  |  459|      0|           _gcry_fips_signal_error (__FILE__, __LINE__, __FUNCTION__, 0, (a))
  ------------------
 1348|      0|      log_error ("WARNING: more than one algorithm in md_get_algo()\n");
  ------------------
  |  |  203|      0|#define log_error   _gcry_log_error
  ------------------
 1349|      0|    }
 1350|  29.7k|  return r ? r->spec->algo : 0;
  ------------------
  |  Branch (1350:10): [True: 29.7k, False: 0]
  ------------------
 1351|  29.7k|}
md.c:md_digest_length:
 1366|  44.7k|{
 1367|  44.7k|  const gcry_md_spec_t *spec;
 1368|       |
 1369|  44.7k|  spec = spec_from_algo (algorithm);
 1370|  44.7k|  return spec? spec->mdlen : 0;
  ------------------
  |  Branch (1370:10): [True: 44.7k, False: 0]
  ------------------
 1371|  44.7k|}
md.c:check_digest_algo:
  431|  54.0k|{
  432|  54.0k|  const gcry_md_spec_t *spec;
  433|       |
  434|  54.0k|  spec = spec_from_algo (algorithm);
  435|  54.0k|  if (spec && !spec->flags.disabled && (spec->flags.fips || !fips_mode ()))
  ------------------
  |  |  449|  15.2k|#define fips_mode() (!_gcry_no_fips_mode_required)
  ------------------
  |  Branch (435:7): [True: 54.0k, False: 0]
  |  Branch (435:15): [True: 54.0k, False: 0]
  |  Branch (435:41): [True: 38.8k, False: 15.2k]
  |  Branch (435:61): [True: 15.2k, False: 0]
  ------------------
  436|  54.0k|    return 0;
  437|       |
  438|      0|  return GPG_ERR_DIGEST_ALGO;
  439|       |
  440|  54.0k|}
md.c:md_asn_oid:
 1389|  10.0k|{
 1390|  10.0k|  const gcry_md_spec_t *spec;
 1391|  10.0k|  const byte *asnoid = NULL;
 1392|       |
 1393|  10.0k|  spec = spec_from_algo (algorithm);
 1394|  10.0k|  if (spec)
  ------------------
  |  Branch (1394:7): [True: 10.0k, False: 0]
  ------------------
 1395|  10.0k|    {
 1396|  10.0k|      if (asnlen)
  ------------------
  |  Branch (1396:11): [True: 10.0k, False: 0]
  ------------------
 1397|  10.0k|	*asnlen = spec->asnlen;
 1398|  10.0k|      if (mdlen)
  ------------------
  |  Branch (1398:11): [True: 0, False: 10.0k]
  ------------------
 1399|      0|	*mdlen = spec->mdlen;
 1400|  10.0k|      asnoid = spec->asnoid;
 1401|  10.0k|    }
 1402|      0|  else
 1403|      0|    log_bug ("no ASN.1 OID for md algo %d\n", algorithm);
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
 1404|       |
 1405|  10.0k|  return asnoid;
 1406|  10.0k|}

md5.c:md5_init:
   57|  2.75k|{
   58|  2.75k|  MD5_CONTEXT *ctx = context;
   59|       |
   60|  2.75k|  (void)flags;
   61|       |
   62|  2.75k|  ctx->A = 0x67452301;
   63|  2.75k|  ctx->B = 0xefcdab89;
   64|  2.75k|  ctx->C = 0x98badcfe;
   65|  2.75k|  ctx->D = 0x10325476;
   66|       |
   67|  2.75k|  ctx->bctx.nblocks = 0;
   68|  2.75k|  ctx->bctx.nblocks_high = 0;
   69|  2.75k|  ctx->bctx.count = 0;
   70|  2.75k|  ctx->bctx.blocksize_shift = _gcry_ctz(64);
   71|  2.75k|  ctx->bctx.bwrite = transform;
   72|  2.75k|}
md5.c:transform:
  212|  2.78k|{
  213|  2.78k|  unsigned int burn;
  214|       |
  215|  2.78k|  do
  216|  8.39k|    {
  217|  8.39k|      burn = transform_blk (c, data);
  218|  8.39k|      data += 64;
  219|  8.39k|    }
  220|  8.39k|  while (--nblks);
  ------------------
  |  Branch (220:10): [True: 5.61k, False: 2.78k]
  ------------------
  221|       |
  222|  2.78k|  return burn;
  223|  2.78k|}
md5.c:transform_blk:
   90|  8.39k|{
   91|  8.39k|  MD5_CONTEXT *ctx = c;
   92|  8.39k|  u32 correct_words[16];
   93|  8.39k|  register u32 A = ctx->A;
   94|  8.39k|  register u32 B = ctx->B;
   95|  8.39k|  register u32 C = ctx->C;
   96|  8.39k|  register u32 D = ctx->D;
   97|  8.39k|  u32 *cwp = correct_words;
   98|  8.39k|  int i;
   99|       |
  100|   142k|  for ( i = 0; i < 16; i++ )
  ------------------
  |  Branch (100:16): [True: 134k, False: 8.39k]
  ------------------
  101|   134k|    correct_words[i] = buf_get_le32(data + i * 4);
  102|       |
  103|  8.39k|#define OP(a, b, c, d, s, T) \
  104|  8.39k|  do			         	   \
  105|  8.39k|    {					   \
  106|  8.39k|      a += FF (b, c, d) + (*cwp++) + T;    \
  107|  8.39k|      a = rol(a, s);			   \
  108|  8.39k|      a += b;				   \
  109|  8.39k|    }					   \
  110|  8.39k|  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|  8.39k|  OP (A, B, C, D,  7, 0xd76aa478);
  ------------------
  |  |  104|  8.39k|  do			         	   \
  |  |  105|  8.39k|    {					   \
  |  |  106|  8.39k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  8.39k|      a = rol(a, s);			   \
  |  |  108|  8.39k|      a += b;				   \
  |  |  109|  8.39k|    }					   \
  |  |  110|  8.39k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  120|  8.39k|  OP (D, A, B, C, 12, 0xe8c7b756);
  ------------------
  |  |  104|  8.39k|  do			         	   \
  |  |  105|  8.39k|    {					   \
  |  |  106|  8.39k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  8.39k|      a = rol(a, s);			   \
  |  |  108|  8.39k|      a += b;				   \
  |  |  109|  8.39k|    }					   \
  |  |  110|  8.39k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  121|  8.39k|  OP (C, D, A, B, 17, 0x242070db);
  ------------------
  |  |  104|  8.39k|  do			         	   \
  |  |  105|  8.39k|    {					   \
  |  |  106|  8.39k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  8.39k|      a = rol(a, s);			   \
  |  |  108|  8.39k|      a += b;				   \
  |  |  109|  8.39k|    }					   \
  |  |  110|  8.39k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  122|  8.39k|  OP (B, C, D, A, 22, 0xc1bdceee);
  ------------------
  |  |  104|  8.39k|  do			         	   \
  |  |  105|  8.39k|    {					   \
  |  |  106|  8.39k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  8.39k|      a = rol(a, s);			   \
  |  |  108|  8.39k|      a += b;				   \
  |  |  109|  8.39k|    }					   \
  |  |  110|  8.39k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  123|  8.39k|  OP (A, B, C, D,  7, 0xf57c0faf);
  ------------------
  |  |  104|  8.39k|  do			         	   \
  |  |  105|  8.39k|    {					   \
  |  |  106|  8.39k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  8.39k|      a = rol(a, s);			   \
  |  |  108|  8.39k|      a += b;				   \
  |  |  109|  8.39k|    }					   \
  |  |  110|  8.39k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  124|  8.39k|  OP (D, A, B, C, 12, 0x4787c62a);
  ------------------
  |  |  104|  8.39k|  do			         	   \
  |  |  105|  8.39k|    {					   \
  |  |  106|  8.39k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  8.39k|      a = rol(a, s);			   \
  |  |  108|  8.39k|      a += b;				   \
  |  |  109|  8.39k|    }					   \
  |  |  110|  8.39k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  125|  8.39k|  OP (C, D, A, B, 17, 0xa8304613);
  ------------------
  |  |  104|  8.39k|  do			         	   \
  |  |  105|  8.39k|    {					   \
  |  |  106|  8.39k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  8.39k|      a = rol(a, s);			   \
  |  |  108|  8.39k|      a += b;				   \
  |  |  109|  8.39k|    }					   \
  |  |  110|  8.39k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  126|  8.39k|  OP (B, C, D, A, 22, 0xfd469501);
  ------------------
  |  |  104|  8.39k|  do			         	   \
  |  |  105|  8.39k|    {					   \
  |  |  106|  8.39k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  8.39k|      a = rol(a, s);			   \
  |  |  108|  8.39k|      a += b;				   \
  |  |  109|  8.39k|    }					   \
  |  |  110|  8.39k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  127|  8.39k|  OP (A, B, C, D,  7, 0x698098d8);
  ------------------
  |  |  104|  8.39k|  do			         	   \
  |  |  105|  8.39k|    {					   \
  |  |  106|  8.39k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  8.39k|      a = rol(a, s);			   \
  |  |  108|  8.39k|      a += b;				   \
  |  |  109|  8.39k|    }					   \
  |  |  110|  8.39k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  128|  8.39k|  OP (D, A, B, C, 12, 0x8b44f7af);
  ------------------
  |  |  104|  8.39k|  do			         	   \
  |  |  105|  8.39k|    {					   \
  |  |  106|  8.39k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  8.39k|      a = rol(a, s);			   \
  |  |  108|  8.39k|      a += b;				   \
  |  |  109|  8.39k|    }					   \
  |  |  110|  8.39k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  129|  8.39k|  OP (C, D, A, B, 17, 0xffff5bb1);
  ------------------
  |  |  104|  8.39k|  do			         	   \
  |  |  105|  8.39k|    {					   \
  |  |  106|  8.39k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  8.39k|      a = rol(a, s);			   \
  |  |  108|  8.39k|      a += b;				   \
  |  |  109|  8.39k|    }					   \
  |  |  110|  8.39k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  130|  8.39k|  OP (B, C, D, A, 22, 0x895cd7be);
  ------------------
  |  |  104|  8.39k|  do			         	   \
  |  |  105|  8.39k|    {					   \
  |  |  106|  8.39k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  8.39k|      a = rol(a, s);			   \
  |  |  108|  8.39k|      a += b;				   \
  |  |  109|  8.39k|    }					   \
  |  |  110|  8.39k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  131|  8.39k|  OP (A, B, C, D,  7, 0x6b901122);
  ------------------
  |  |  104|  8.39k|  do			         	   \
  |  |  105|  8.39k|    {					   \
  |  |  106|  8.39k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  8.39k|      a = rol(a, s);			   \
  |  |  108|  8.39k|      a += b;				   \
  |  |  109|  8.39k|    }					   \
  |  |  110|  8.39k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  132|  8.39k|  OP (D, A, B, C, 12, 0xfd987193);
  ------------------
  |  |  104|  8.39k|  do			         	   \
  |  |  105|  8.39k|    {					   \
  |  |  106|  8.39k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  8.39k|      a = rol(a, s);			   \
  |  |  108|  8.39k|      a += b;				   \
  |  |  109|  8.39k|    }					   \
  |  |  110|  8.39k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  133|  8.39k|  OP (C, D, A, B, 17, 0xa679438e);
  ------------------
  |  |  104|  8.39k|  do			         	   \
  |  |  105|  8.39k|    {					   \
  |  |  106|  8.39k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  8.39k|      a = rol(a, s);			   \
  |  |  108|  8.39k|      a += b;				   \
  |  |  109|  8.39k|    }					   \
  |  |  110|  8.39k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  134|  8.39k|  OP (B, C, D, A, 22, 0x49b40821);
  ------------------
  |  |  104|  8.39k|  do			         	   \
  |  |  105|  8.39k|    {					   \
  |  |  106|  8.39k|      a += FF (b, c, d) + (*cwp++) + T;    \
  |  |  ------------------
  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  ------------------
  |  |  107|  8.39k|      a = rol(a, s);			   \
  |  |  108|  8.39k|      a += b;				   \
  |  |  109|  8.39k|    }					   \
  |  |  110|  8.39k|  while (0)
  |  |  ------------------
  |  |  |  Branch (110:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
  135|       |
  136|  8.39k|#undef OP
  137|  8.39k|#define OP(f, a, b, c, d, k, s, T)  \
  138|  8.39k|    do								      \
  139|  8.39k|      { 							      \
  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  141|  8.39k|	a = rol(a, s);						      \
  142|  8.39k|	a += b; 						      \
  143|  8.39k|      } 							      \
  144|  8.39k|    while (0)
  145|       |
  146|       |  /* Round 2.  */
  147|  8.39k|  OP (FG, A, B, C, D,  1,  5, 0xf61e2562);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  147|  8.39k|  OP (FG, A, B, C, D,  1,  5, 0xf61e2562);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  8.39k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  148|  8.39k|  OP (FG, D, A, B, C,  6,  9, 0xc040b340);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  148|  8.39k|  OP (FG, D, A, B, C,  6,  9, 0xc040b340);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  8.39k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  149|  8.39k|  OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  149|  8.39k|  OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  8.39k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  150|  8.39k|  OP (FG, B, C, D, A,  0, 20, 0xe9b6c7aa);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  150|  8.39k|  OP (FG, B, C, D, A,  0, 20, 0xe9b6c7aa);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  8.39k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  151|  8.39k|  OP (FG, A, B, C, D,  5,  5, 0xd62f105d);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  151|  8.39k|  OP (FG, A, B, C, D,  5,  5, 0xd62f105d);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  8.39k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  152|  8.39k|  OP (FG, D, A, B, C, 10,  9, 0x02441453);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  152|  8.39k|  OP (FG, D, A, B, C, 10,  9, 0x02441453);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  8.39k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  153|  8.39k|  OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  153|  8.39k|  OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  8.39k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  154|  8.39k|  OP (FG, B, C, D, A,  4, 20, 0xe7d3fbc8);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  154|  8.39k|  OP (FG, B, C, D, A,  4, 20, 0xe7d3fbc8);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  8.39k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  155|  8.39k|  OP (FG, A, B, C, D,  9,  5, 0x21e1cde6);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  155|  8.39k|  OP (FG, A, B, C, D,  9,  5, 0x21e1cde6);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  8.39k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  156|  8.39k|  OP (FG, D, A, B, C, 14,  9, 0xc33707d6);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  156|  8.39k|  OP (FG, D, A, B, C, 14,  9, 0xc33707d6);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  8.39k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  157|  8.39k|  OP (FG, C, D, A, B,  3, 14, 0xf4d50d87);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  157|  8.39k|  OP (FG, C, D, A, B,  3, 14, 0xf4d50d87);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  8.39k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  158|  8.39k|  OP (FG, B, C, D, A,  8, 20, 0x455a14ed);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  158|  8.39k|  OP (FG, B, C, D, A,  8, 20, 0x455a14ed);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  8.39k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  159|  8.39k|  OP (FG, A, B, C, D, 13,  5, 0xa9e3e905);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  159|  8.39k|  OP (FG, A, B, C, D, 13,  5, 0xa9e3e905);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  8.39k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  160|  8.39k|  OP (FG, D, A, B, C,  2,  9, 0xfcefa3f8);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  160|  8.39k|  OP (FG, D, A, B, C,  2,  9, 0xfcefa3f8);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  8.39k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  161|  8.39k|  OP (FG, C, D, A, B,  7, 14, 0x676f02d9);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  161|  8.39k|  OP (FG, C, D, A, B,  7, 14, 0x676f02d9);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  8.39k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  162|  8.39k|  OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  162|  8.39k|  OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
  |  |  |  |  ------------------
  |  |  |  |  |  |   80|  8.39k|#define FG(b, c, d) FF (d, b, c)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   79|  8.39k|#define FF(b, c, d) (d ^ (b & (c ^ d)))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  163|       |
  164|       |  /* Round 3.  */
  165|  8.39k|  OP (FH, A, B, C, D,  5,  4, 0xfffa3942);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  165|  8.39k|  OP (FH, A, B, C, D,  5,  4, 0xfffa3942);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  8.39k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  166|  8.39k|  OP (FH, D, A, B, C,  8, 11, 0x8771f681);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  166|  8.39k|  OP (FH, D, A, B, C,  8, 11, 0x8771f681);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  8.39k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  167|  8.39k|  OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  167|  8.39k|  OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  8.39k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  168|  8.39k|  OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  168|  8.39k|  OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  8.39k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  169|  8.39k|  OP (FH, A, B, C, D,  1,  4, 0xa4beea44);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  169|  8.39k|  OP (FH, A, B, C, D,  1,  4, 0xa4beea44);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  8.39k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  170|  8.39k|  OP (FH, D, A, B, C,  4, 11, 0x4bdecfa9);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  170|  8.39k|  OP (FH, D, A, B, C,  4, 11, 0x4bdecfa9);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  8.39k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  171|  8.39k|  OP (FH, C, D, A, B,  7, 16, 0xf6bb4b60);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  171|  8.39k|  OP (FH, C, D, A, B,  7, 16, 0xf6bb4b60);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  8.39k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  172|  8.39k|  OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  172|  8.39k|  OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  8.39k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  173|  8.39k|  OP (FH, A, B, C, D, 13,  4, 0x289b7ec6);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  173|  8.39k|  OP (FH, A, B, C, D, 13,  4, 0x289b7ec6);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  8.39k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  174|  8.39k|  OP (FH, D, A, B, C,  0, 11, 0xeaa127fa);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  174|  8.39k|  OP (FH, D, A, B, C,  0, 11, 0xeaa127fa);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  8.39k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  175|  8.39k|  OP (FH, C, D, A, B,  3, 16, 0xd4ef3085);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  175|  8.39k|  OP (FH, C, D, A, B,  3, 16, 0xd4ef3085);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  8.39k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  176|  8.39k|  OP (FH, B, C, D, A,  6, 23, 0x04881d05);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  176|  8.39k|  OP (FH, B, C, D, A,  6, 23, 0x04881d05);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  8.39k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  177|  8.39k|  OP (FH, A, B, C, D,  9,  4, 0xd9d4d039);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  177|  8.39k|  OP (FH, A, B, C, D,  9,  4, 0xd9d4d039);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  8.39k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  178|  8.39k|  OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  178|  8.39k|  OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  8.39k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  179|  8.39k|  OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  179|  8.39k|  OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  8.39k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  180|  8.39k|  OP (FH, B, C, D, A,  2, 23, 0xc4ac5665);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  180|  8.39k|  OP (FH, B, C, D, A,  2, 23, 0xc4ac5665);
  |  |  |  |  ------------------
  |  |  |  |  |  |   81|  8.39k|#define FH(b, c, d) (b ^ c ^ d)
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  181|       |
  182|       |  /* Round 4.  */
  183|  8.39k|  OP (FI, A, B, C, D,  0,  6, 0xf4292244);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  183|  8.39k|  OP (FI, A, B, C, D,  0,  6, 0xf4292244);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  8.39k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  184|  8.39k|  OP (FI, D, A, B, C,  7, 10, 0x432aff97);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  184|  8.39k|  OP (FI, D, A, B, C,  7, 10, 0x432aff97);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  8.39k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  185|  8.39k|  OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  185|  8.39k|  OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  8.39k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  186|  8.39k|  OP (FI, B, C, D, A,  5, 21, 0xfc93a039);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  186|  8.39k|  OP (FI, B, C, D, A,  5, 21, 0xfc93a039);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  8.39k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  187|  8.39k|  OP (FI, A, B, C, D, 12,  6, 0x655b59c3);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  187|  8.39k|  OP (FI, A, B, C, D, 12,  6, 0x655b59c3);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  8.39k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  188|  8.39k|  OP (FI, D, A, B, C,  3, 10, 0x8f0ccc92);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  188|  8.39k|  OP (FI, D, A, B, C,  3, 10, 0x8f0ccc92);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  8.39k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  189|  8.39k|  OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  189|  8.39k|  OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  8.39k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  190|  8.39k|  OP (FI, B, C, D, A,  1, 21, 0x85845dd1);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  190|  8.39k|  OP (FI, B, C, D, A,  1, 21, 0x85845dd1);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  8.39k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  191|  8.39k|  OP (FI, A, B, C, D,  8,  6, 0x6fa87e4f);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  191|  8.39k|  OP (FI, A, B, C, D,  8,  6, 0x6fa87e4f);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  8.39k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  192|  8.39k|  OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  192|  8.39k|  OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  8.39k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  193|  8.39k|  OP (FI, C, D, A, B,  6, 15, 0xa3014314);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  193|  8.39k|  OP (FI, C, D, A, B,  6, 15, 0xa3014314);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  8.39k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  194|  8.39k|  OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  194|  8.39k|  OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  8.39k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  195|  8.39k|  OP (FI, A, B, C, D,  4,  6, 0xf7537e82);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  195|  8.39k|  OP (FI, A, B, C, D,  4,  6, 0xf7537e82);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  8.39k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  196|  8.39k|  OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  196|  8.39k|  OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  8.39k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  197|  8.39k|  OP (FI, C, D, A, B,  2, 15, 0x2ad7d2bb);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  197|  8.39k|  OP (FI, C, D, A, B,  2, 15, 0x2ad7d2bb);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  8.39k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  198|  8.39k|  OP (FI, B, C, D, A,  9, 21, 0xeb86d391);
  ------------------
  |  |  138|  8.39k|    do								      \
  |  |  139|  8.39k|      { 							      \
  |  |  140|  8.39k|	a += f (b, c, d) + correct_words[k] + T;		      \
  |  |  ------------------
  |  |  |  |  198|  8.39k|  OP (FI, B, C, D, A,  9, 21, 0xeb86d391);
  |  |  |  |  ------------------
  |  |  |  |  |  |   82|  8.39k|#define FI(b, c, d) (c ^ (b | ~d))
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  141|  8.39k|	a = rol(a, s);						      \
  |  |  142|  8.39k|	a += b; 						      \
  |  |  143|  8.39k|      } 							      \
  |  |  144|  8.39k|    while (0)
  |  |  ------------------
  |  |  |  Branch (144:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  199|       |
  200|       |  /* Put checksum in context given as argument.  */
  201|  8.39k|  ctx->A += A;
  202|  8.39k|  ctx->B += B;
  203|  8.39k|  ctx->C += C;
  204|  8.39k|  ctx->D += D;
  205|       |
  206|  8.39k|  return /*burn_stack*/ 80+6*sizeof(void*);
  207|  8.39k|}
md5.c:md5_final:
  234|  1.44k|{
  235|  1.44k|  MD5_CONTEXT *hd = context;
  236|  1.44k|  u32 t, th, msb, lsb;
  237|  1.44k|  byte *p;
  238|  1.44k|  unsigned int burn;
  239|       |
  240|  1.44k|  t = hd->bctx.nblocks;
  241|  1.44k|  if (sizeof t == sizeof hd->bctx.nblocks)
  ------------------
  |  Branch (241:7): [Folded - Ignored]
  ------------------
  242|      0|    th = hd->bctx.nblocks_high;
  243|  1.44k|  else
  244|  1.44k|    th = hd->bctx.nblocks >> 32;
  245|       |
  246|       |  /* multiply by 64 to make a byte count */
  247|  1.44k|  lsb = t << 6;
  248|  1.44k|  msb = (th << 6) | (t >> 26);
  249|       |  /* add the count */
  250|  1.44k|  t = lsb;
  251|  1.44k|  if( (lsb += hd->bctx.count) < t )
  ------------------
  |  Branch (251:7): [True: 0, False: 1.44k]
  ------------------
  252|      0|    msb++;
  253|       |  /* multiply by 8 to make a bit count */
  254|  1.44k|  t = lsb;
  255|  1.44k|  lsb <<= 3;
  256|  1.44k|  msb <<= 3;
  257|  1.44k|  msb |= t >> 29;
  258|       |
  259|  1.44k|  if (hd->bctx.count < 56)  /* enough room */
  ------------------
  |  Branch (259:7): [True: 1.40k, False: 39]
  ------------------
  260|  1.40k|    {
  261|  1.40k|      hd->bctx.buf[hd->bctx.count++] = 0x80; /* pad */
  262|  1.40k|      if (hd->bctx.count < 56)
  ------------------
  |  Branch (262:11): [True: 1.16k, False: 238]
  ------------------
  263|  1.16k|	memset (&hd->bctx.buf[hd->bctx.count], 0, 56 - hd->bctx.count);
  264|       |
  265|       |      /* append the 64 bit count */
  266|  1.40k|      buf_put_le32(hd->bctx.buf + 56, lsb);
  267|  1.40k|      buf_put_le32(hd->bctx.buf + 60, msb);
  268|  1.40k|      burn = transform (hd, hd->bctx.buf, 1);
  269|  1.40k|    }
  270|     39|  else /* need one extra block */
  271|     39|    {
  272|     39|      hd->bctx.buf[hd->bctx.count++] = 0x80; /* pad character */
  273|       |      /* fill pad and next block with zeroes */
  274|     39|      memset (&hd->bctx.buf[hd->bctx.count], 0, 64 - hd->bctx.count + 56);
  275|       |
  276|       |      /* append the 64 bit count */
  277|     39|      buf_put_le32(hd->bctx.buf + 64 + 56, lsb);
  278|     39|      buf_put_le32(hd->bctx.buf + 64 + 60, msb);
  279|     39|      burn = transform (hd, hd->bctx.buf, 2);
  280|     39|    }
  281|       |
  282|  1.44k|  p = hd->bctx.buf;
  283|  1.44k|#define X(a) do { buf_put_le32(p, hd->a); p += 4; } while(0)
  284|  1.44k|  X(A);
  ------------------
  |  |  283|  1.44k|#define X(a) do { buf_put_le32(p, hd->a); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (283:59): [Folded - Ignored]
  |  |  ------------------
  ------------------
  285|  1.44k|  X(B);
  ------------------
  |  |  283|  1.44k|#define X(a) do { buf_put_le32(p, hd->a); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (283:59): [Folded - Ignored]
  |  |  ------------------
  ------------------
  286|  1.44k|  X(C);
  ------------------
  |  |  283|  1.44k|#define X(a) do { buf_put_le32(p, hd->a); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (283:59): [Folded - Ignored]
  |  |  ------------------
  ------------------
  287|  1.44k|  X(D);
  ------------------
  |  |  283|  1.44k|#define X(a) do { buf_put_le32(p, hd->a); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (283:59): [Folded - Ignored]
  |  |  ------------------
  ------------------
  288|  1.44k|#undef X
  289|       |
  290|  1.44k|  hd->bctx.count = 0;
  291|       |
  292|  1.44k|  _gcry_burn_stack (burn);
  ------------------
  |  |  371|  1.44k|	do { __gcry_burn_stack (bytes); \
  |  |  372|  1.44k|	     __gcry_burn_stack_dummy (); } while(0)
  |  |  ------------------
  |  |  |  |  364|  1.44k|#define  __gcry_burn_stack_dummy() asm volatile ("":::"memory")
  |  |  ------------------
  |  |  |  Branch (372:43): [Folded - Ignored]
  |  |  ------------------
  ------------------
  293|  1.44k|}
md5.c:md5_read:
  297|    172|{
  298|    172|  MD5_CONTEXT *hd = (MD5_CONTEXT *) context;
  299|    172|  return hd->bctx.buf;
  300|    172|}

_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_util_parse_flaglist:
   57|  9.18k|{
   58|  9.18k|  gpg_err_code_t rc = 0;
   59|  9.18k|  const char *s;
   60|  9.18k|  size_t n;
   61|  9.18k|  int i;
   62|  9.18k|  int encoding = PUBKEY_ENC_UNKNOWN;
   63|  9.18k|  int flags = 0;
   64|  9.18k|  int igninvflag = 0;
   65|       |
   66|  18.3k|  for (i = list ? sexp_length (list)-1 : 0; i > 0; i--)
  ------------------
  |  |  382|  9.18k|#define sexp_length(a)               _gcry_sexp_length ((a))
  ------------------
  |  Branch (66:12): [True: 9.18k, False: 0]
  |  Branch (66:45): [True: 9.18k, False: 9.18k]
  ------------------
   67|  9.18k|    {
   68|  9.18k|      s = sexp_nth_data (list, i, &n);
  ------------------
  |  |  387|  9.18k|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
   69|  9.18k|      if (!s)
  ------------------
  |  Branch (69:11): [True: 0, False: 9.18k]
  ------------------
   70|      0|        continue; /* Not a data element. */
   71|       |
   72|  9.18k|      switch (n)
   73|  9.18k|        {
   74|      0|        case 3:
  ------------------
  |  Branch (74:9): [True: 0, False: 9.18k]
  ------------------
   75|      0|          if (!memcmp (s, "pss", 3) && encoding == PUBKEY_ENC_UNKNOWN)
  ------------------
  |  Branch (75:15): [True: 0, False: 0]
  |  Branch (75:40): [True: 0, False: 0]
  ------------------
   76|      0|            {
   77|      0|              encoding = PUBKEY_ENC_PSS;
   78|      0|              flags |= PUBKEY_FLAG_FIXEDLEN;
  ------------------
  |  |   31|      0|#define PUBKEY_FLAG_FIXEDLEN       (1 << 2)
  ------------------
   79|      0|            }
   80|      0|          else if (!memcmp (s, "raw", 3) && encoding == PUBKEY_ENC_UNKNOWN)
  ------------------
  |  Branch (80:20): [True: 0, False: 0]
  |  Branch (80:45): [True: 0, False: 0]
  ------------------
   81|      0|            {
   82|      0|              encoding = PUBKEY_ENC_RAW;
   83|      0|              flags |= PUBKEY_FLAG_RAW_FLAG; /* Explicitly given.  */
  ------------------
  |  |   33|      0|#define PUBKEY_FLAG_RAW_FLAG       (1 << 4)
  ------------------
   84|      0|            }
   85|      0|          else if (!memcmp (s, "sm2", 3))
  ------------------
  |  Branch (85:20): [True: 0, False: 0]
  ------------------
   86|      0|            {
   87|      0|                encoding = PUBKEY_ENC_RAW;
   88|      0|                flags |= PUBKEY_FLAG_SM2 | PUBKEY_FLAG_RAW_FLAG;
  ------------------
  |  |   45|      0|#define PUBKEY_FLAG_SM2            (1 << 16)
  ------------------
                              flags |= PUBKEY_FLAG_SM2 | PUBKEY_FLAG_RAW_FLAG;
  ------------------
  |  |   33|      0|#define PUBKEY_FLAG_RAW_FLAG       (1 << 4)
  ------------------
   89|      0|            }
   90|      0|          else if (!igninvflag)
  ------------------
  |  Branch (90:20): [True: 0, False: 0]
  ------------------
   91|      0|            rc = GPG_ERR_INV_FLAG;
   92|      0|          break;
   93|       |
   94|      0|        case 4:
  ------------------
  |  Branch (94:9): [True: 0, False: 9.18k]
  ------------------
   95|      0|          if (!memcmp (s, "comp", 4))
  ------------------
  |  Branch (95:15): [True: 0, False: 0]
  ------------------
   96|      0|            flags |= PUBKEY_FLAG_COMP;
  ------------------
  |  |   39|      0|#define PUBKEY_FLAG_COMP           (1 << 10)
  ------------------
   97|      0|          else if (!memcmp (s, "oaep", 4) && encoding == PUBKEY_ENC_UNKNOWN)
  ------------------
  |  Branch (97:20): [True: 0, False: 0]
  |  Branch (97:46): [True: 0, False: 0]
  ------------------
   98|      0|            {
   99|      0|              encoding = PUBKEY_ENC_OAEP;
  100|      0|              flags |= PUBKEY_FLAG_FIXEDLEN;
  ------------------
  |  |   31|      0|#define PUBKEY_FLAG_FIXEDLEN       (1 << 2)
  ------------------
  101|      0|            }
  102|      0|          else if (!memcmp (s, "gost", 4))
  ------------------
  |  Branch (102:20): [True: 0, False: 0]
  ------------------
  103|      0|            {
  104|      0|              encoding = PUBKEY_ENC_RAW;
  105|      0|              flags |= PUBKEY_FLAG_GOST;
  ------------------
  |  |   42|      0|#define PUBKEY_FLAG_GOST           (1 << 13)
  ------------------
  106|      0|            }
  107|      0|          else if (!igninvflag)
  ------------------
  |  Branch (107:20): [True: 0, False: 0]
  ------------------
  108|      0|            rc = GPG_ERR_INV_FLAG;
  109|      0|          break;
  110|       |
  111|  9.18k|        case 5:
  ------------------
  |  Branch (111:9): [True: 9.18k, False: 0]
  ------------------
  112|  9.18k|          if (!memcmp (s, "eddsa", 5))
  ------------------
  |  Branch (112:15): [True: 9.18k, False: 0]
  ------------------
  113|  9.18k|            {
  114|  9.18k|              encoding = PUBKEY_ENC_RAW;
  115|  9.18k|              flags |= PUBKEY_FLAG_EDDSA;
  ------------------
  |  |   41|  9.18k|#define PUBKEY_FLAG_EDDSA          (1 << 12)
  ------------------
  116|  9.18k|              flags |= PUBKEY_FLAG_DJB_TWEAK;
  ------------------
  |  |   44|  9.18k|#define PUBKEY_FLAG_DJB_TWEAK      (1 << 15)
  ------------------
  117|  9.18k|            }
  118|      0|          else if (!memcmp (s, "pkcs1", 5) && encoding == PUBKEY_ENC_UNKNOWN)
  ------------------
  |  Branch (118:20): [True: 0, False: 0]
  |  Branch (118:47): [True: 0, False: 0]
  ------------------
  119|      0|            {
  120|      0|              encoding = PUBKEY_ENC_PKCS1;
  121|      0|              flags |= PUBKEY_FLAG_FIXEDLEN;
  ------------------
  |  |   31|      0|#define PUBKEY_FLAG_FIXEDLEN       (1 << 2)
  ------------------
  122|      0|            }
  123|      0|          else if (!memcmp (s, "param", 5))
  ------------------
  |  Branch (123:20): [True: 0, False: 0]
  ------------------
  124|      0|            flags |= PUBKEY_FLAG_PARAM;
  ------------------
  |  |   38|      0|#define PUBKEY_FLAG_PARAM          (1 << 9)
  ------------------
  125|      0|          else if (!igninvflag)
  ------------------
  |  Branch (125:20): [True: 0, False: 0]
  ------------------
  126|      0|            rc = GPG_ERR_INV_FLAG;
  127|  9.18k|          break;
  128|       |
  129|      0|        case 6:
  ------------------
  |  Branch (129:9): [True: 0, False: 9.18k]
  ------------------
  130|      0|          if (!memcmp (s, "nocomp", 6))
  ------------------
  |  Branch (130:15): [True: 0, False: 0]
  ------------------
  131|      0|            flags |= PUBKEY_FLAG_NOCOMP;
  ------------------
  |  |   40|      0|#define PUBKEY_FLAG_NOCOMP         (1 << 11)
  ------------------
  132|      0|          else if (!igninvflag)
  ------------------
  |  Branch (132:20): [True: 0, False: 0]
  ------------------
  133|      0|            rc = GPG_ERR_INV_FLAG;
  134|      0|          break;
  135|       |
  136|      0|        case 7:
  ------------------
  |  Branch (136:9): [True: 0, False: 9.18k]
  ------------------
  137|      0|          if (!memcmp (s, "rfc6979", 7))
  ------------------
  |  Branch (137:15): [True: 0, False: 0]
  ------------------
  138|      0|            flags |= PUBKEY_FLAG_RFC6979;
  ------------------
  |  |   30|      0|#define PUBKEY_FLAG_RFC6979        (1 << 1)
  ------------------
  139|      0|          else if (!memcmp (s, "noparam", 7))
  ------------------
  |  Branch (139:20): [True: 0, False: 0]
  ------------------
  140|      0|            ; /* Ignore - it is the default.  */
  141|      0|          else if (!memcmp (s, "prehash", 7))
  ------------------
  |  Branch (141:20): [True: 0, False: 0]
  ------------------
  142|      0|            flags |= PUBKEY_FLAG_PREHASH;
  ------------------
  |  |   46|      0|#define PUBKEY_FLAG_PREHASH        (1 << 17)
  ------------------
  143|      0|          else if (!igninvflag)
  ------------------
  |  Branch (143:20): [True: 0, False: 0]
  ------------------
  144|      0|            rc = GPG_ERR_INV_FLAG;
  145|      0|          break;
  146|       |
  147|      0|        case 8:
  ------------------
  |  Branch (147:9): [True: 0, False: 9.18k]
  ------------------
  148|      0|          if (!memcmp (s, "use-x931", 8))
  ------------------
  |  Branch (148:15): [True: 0, False: 0]
  ------------------
  149|      0|            flags |= PUBKEY_FLAG_USE_X931;
  ------------------
  |  |   35|      0|#define PUBKEY_FLAG_USE_X931       (1 << 6)
  ------------------
  150|      0|          else if (!igninvflag)
  ------------------
  |  Branch (150:20): [True: 0, False: 0]
  ------------------
  151|      0|            rc = GPG_ERR_INV_FLAG;
  152|      0|          break;
  153|       |
  154|      0|        case 9:
  ------------------
  |  Branch (154:9): [True: 0, False: 9.18k]
  ------------------
  155|      0|          if (!memcmp (s, "pkcs1-raw", 9) && encoding == PUBKEY_ENC_UNKNOWN)
  ------------------
  |  Branch (155:15): [True: 0, False: 0]
  |  Branch (155:46): [True: 0, False: 0]
  ------------------
  156|      0|            {
  157|      0|              encoding = PUBKEY_ENC_PKCS1_RAW;
  158|      0|              flags |= PUBKEY_FLAG_FIXEDLEN;
  ------------------
  |  |   31|      0|#define PUBKEY_FLAG_FIXEDLEN       (1 << 2)
  ------------------
  159|      0|            }
  160|      0|          else if (!memcmp (s, "djb-tweak", 9))
  ------------------
  |  Branch (160:20): [True: 0, False: 0]
  ------------------
  161|      0|            {
  162|      0|              encoding = PUBKEY_ENC_RAW;
  163|      0|              flags |= PUBKEY_FLAG_DJB_TWEAK;
  ------------------
  |  |   44|      0|#define PUBKEY_FLAG_DJB_TWEAK      (1 << 15)
  ------------------
  164|      0|            }
  165|      0|          else if (!igninvflag)
  ------------------
  |  Branch (165:20): [True: 0, False: 0]
  ------------------
  166|      0|            rc = GPG_ERR_INV_FLAG;
  167|      0|          break;
  168|       |
  169|      0|        case 10:
  ------------------
  |  Branch (169:9): [True: 0, False: 9.18k]
  ------------------
  170|      0|          if (!memcmp (s, "igninvflag", 10))
  ------------------
  |  Branch (170:15): [True: 0, False: 0]
  ------------------
  171|      0|            igninvflag = 1;
  172|      0|          else if (!memcmp (s, "no-keytest", 10))
  ------------------
  |  Branch (172:20): [True: 0, False: 0]
  ------------------
  173|      0|            flags |= PUBKEY_FLAG_NO_KEYTEST;
  ------------------
  |  |   43|      0|#define PUBKEY_FLAG_NO_KEYTEST     (1 << 14)
  ------------------
  174|      0|          else if (!igninvflag)
  ------------------
  |  Branch (174:20): [True: 0, False: 0]
  ------------------
  175|      0|            rc = GPG_ERR_INV_FLAG;
  176|      0|          break;
  177|       |
  178|      0|        case 11:
  ------------------
  |  Branch (178:9): [True: 0, False: 9.18k]
  ------------------
  179|      0|          if (!memcmp (s, "no-blinding", 11))
  ------------------
  |  Branch (179:15): [True: 0, False: 0]
  ------------------
  180|      0|            flags |= PUBKEY_FLAG_NO_BLINDING;
  ------------------
  |  |   29|      0|#define PUBKEY_FLAG_NO_BLINDING    (1 << 0)
  ------------------
  181|      0|          else if (!memcmp (s, "use-fips186", 11))
  ------------------
  |  Branch (181:20): [True: 0, False: 0]
  ------------------
  182|      0|            flags |= PUBKEY_FLAG_USE_FIPS186;
  ------------------
  |  |   36|      0|#define PUBKEY_FLAG_USE_FIPS186    (1 << 7)
  ------------------
  183|      0|          else if (!igninvflag)
  ------------------
  |  Branch (183:20): [True: 0, False: 0]
  ------------------
  184|      0|            rc = GPG_ERR_INV_FLAG;
  185|      0|          break;
  186|       |
  187|      0|        case 13:
  ------------------
  |  Branch (187:9): [True: 0, False: 9.18k]
  ------------------
  188|      0|          if (!memcmp (s, "use-fips186-2", 13))
  ------------------
  |  Branch (188:15): [True: 0, False: 0]
  ------------------
  189|      0|            flags |= PUBKEY_FLAG_USE_FIPS186_2;
  ------------------
  |  |   37|      0|#define PUBKEY_FLAG_USE_FIPS186_2  (1 << 8)
  ------------------
  190|      0|          else if (!memcmp (s, "transient-key", 13))
  ------------------
  |  Branch (190:20): [True: 0, False: 0]
  ------------------
  191|      0|            flags |= PUBKEY_FLAG_TRANSIENT_KEY;
  ------------------
  |  |   34|      0|#define PUBKEY_FLAG_TRANSIENT_KEY  (1 << 5)
  ------------------
  192|      0|          else if (!igninvflag)
  ------------------
  |  Branch (192:20): [True: 0, False: 0]
  ------------------
  193|      0|            rc = GPG_ERR_INV_FLAG;
  194|      0|          break;
  195|       |
  196|      0|        default:
  ------------------
  |  Branch (196:9): [True: 0, False: 9.18k]
  ------------------
  197|      0|          if (!igninvflag)
  ------------------
  |  Branch (197:15): [True: 0, False: 0]
  ------------------
  198|      0|            rc = GPG_ERR_INV_FLAG;
  199|      0|          break;
  200|  9.18k|        }
  201|  9.18k|    }
  202|       |
  203|  9.18k|  if (r_flags)
  ------------------
  |  Branch (203:7): [True: 9.18k, False: 0]
  ------------------
  204|  9.18k|    *r_flags = flags;
  205|  9.18k|  if (r_encoding)
  ------------------
  |  Branch (205:7): [True: 4.59k, False: 4.59k]
  ------------------
  206|  4.59k|    *r_encoding = encoding;
  207|       |
  208|  9.18k|  return rc;
  209|  9.18k|}
_gcry_pk_util_get_nbits:
  292|  7.32k|{
  293|  7.32k|  char buf[50];
  294|  7.32k|  const char *s;
  295|  7.32k|  size_t n;
  296|       |
  297|  7.32k|  *r_nbits = 0;
  298|       |
  299|  7.32k|  list = sexp_find_token (list, "nbits", 0);
  ------------------
  |  |  381|  7.32k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
  300|  7.32k|  if (!list)
  ------------------
  |  Branch (300:7): [True: 7.32k, False: 0]
  ------------------
  301|  7.32k|    return 0; /* No NBITS found.  */
  302|       |
  303|      0|  s = sexp_nth_data (list, 1, &n);
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
  304|      0|  if (!s || n >= DIM (buf) - 1 )
  ------------------
  |  |  104|      0|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (304:7): [True: 0, False: 0]
  |  Branch (304:13): [True: 0, False: 0]
  ------------------
  305|      0|    {
  306|       |      /* NBITS given without a cdr.  */
  307|      0|      sexp_release (list);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  308|      0|      return GPG_ERR_INV_OBJ;
  309|      0|    }
  310|      0|  memcpy (buf, s, n);
  311|      0|  buf[n] = 0;
  312|      0|  *r_nbits = (unsigned int)strtoul (buf, NULL, 0);
  313|      0|  sexp_release (list);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  314|      0|  return 0;
  315|      0|}
_gcry_pk_util_preparse_sigval:
  378|  11.8k|{
  379|  11.8k|  gpg_err_code_t rc;
  380|  11.8k|  gcry_sexp_t l1 = NULL;
  381|  11.8k|  gcry_sexp_t l2 = NULL;
  382|  11.8k|  char *name = NULL;
  383|  11.8k|  int i;
  384|       |
  385|  11.8k|  *r_parms = NULL;
  386|  11.8k|  if (r_eccflags)
  ------------------
  |  Branch (386:7): [True: 7.29k, False: 4.50k]
  ------------------
  387|  7.29k|    *r_eccflags = 0;
  388|       |
  389|       |  /* Extract the signature value.  */
  390|  11.8k|  l1 = sexp_find_token (s_sig, "sig-val", 0);
  ------------------
  |  |  381|  11.8k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
  391|  11.8k|  if (!l1)
  ------------------
  |  Branch (391:7): [True: 0, False: 11.8k]
  ------------------
  392|      0|    {
  393|      0|      rc = GPG_ERR_INV_OBJ; /* Does not contain a signature value object.  */
  394|      0|      goto leave;
  395|      0|    }
  396|       |
  397|  11.8k|  l2 = sexp_nth (l1, 1);
  ------------------
  |  |  383|  11.8k|#define sexp_nth(a, b)               _gcry_sexp_nth ((a), (b))
  ------------------
  398|  11.8k|  if (!l2)
  ------------------
  |  Branch (398:7): [True: 0, False: 11.8k]
  ------------------
  399|      0|    {
  400|      0|      rc = GPG_ERR_NO_OBJ;   /* No cadr for the sig object.  */
  401|      0|      goto leave;
  402|      0|    }
  403|  11.8k|  name = sexp_nth_string (l2, 0);
  ------------------
  |  |  389|  11.8k|#define sexp_nth_string(a, b)        _gcry_sexp_nth_string ((a), (b))
  ------------------
  404|  11.8k|  if (!name)
  ------------------
  |  Branch (404:7): [True: 0, False: 11.8k]
  ------------------
  405|      0|    {
  406|      0|      rc = GPG_ERR_INV_OBJ;  /* Invalid structure of object.  */
  407|      0|      goto leave;
  408|      0|    }
  409|  11.8k|  else if (!strcmp (name, "flags"))
  ------------------
  |  Branch (409:12): [True: 0, False: 11.8k]
  ------------------
  410|      0|    {
  411|       |      /* Skip a "flags" parameter and look again for the algorithm
  412|       |	 name.  This is not used but here just for the sake of
  413|       |	 consistent S-expressions we need to handle it. */
  414|      0|      sexp_release (l2);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  415|      0|      l2 = sexp_nth (l1, 2);
  ------------------
  |  |  383|      0|#define sexp_nth(a, b)               _gcry_sexp_nth ((a), (b))
  ------------------
  416|      0|      if (!l2)
  ------------------
  |  Branch (416:11): [True: 0, False: 0]
  ------------------
  417|      0|	{
  418|      0|	  rc = GPG_ERR_INV_OBJ;
  419|      0|          goto leave;
  420|      0|	}
  421|      0|      xfree (name);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  422|      0|      name = sexp_nth_string (l2, 0);
  ------------------
  |  |  389|      0|#define sexp_nth_string(a, b)        _gcry_sexp_nth_string ((a), (b))
  ------------------
  423|      0|      if (!name)
  ------------------
  |  Branch (423:11): [True: 0, False: 0]
  ------------------
  424|      0|        {
  425|      0|          rc = GPG_ERR_INV_OBJ;  /* Invalid structure of object.  */
  426|      0|          goto leave;
  427|      0|        }
  428|      0|    }
  429|       |
  430|  28.2k|  for (i=0; algo_names[i]; i++)
  ------------------
  |  Branch (430:13): [True: 28.2k, False: 0]
  ------------------
  431|  28.2k|    if (!stricmp (name, algo_names[i]))
  ------------------
  |  |  351|  28.2k|#define stricmp(a,b)	 strcasecmp( (a), (b) )
  ------------------
  |  Branch (431:9): [True: 11.8k, False: 16.4k]
  ------------------
  432|  11.8k|      break;
  433|  11.8k|  if (!algo_names[i])
  ------------------
  |  Branch (433:7): [True: 0, False: 11.8k]
  ------------------
  434|      0|    {
  435|      0|      rc = GPG_ERR_CONFLICT; /* "sig-val" uses an unexpected algo. */
  436|      0|      goto leave;
  437|      0|    }
  438|  11.8k|  if (r_eccflags)
  ------------------
  |  Branch (438:7): [True: 7.29k, False: 4.50k]
  ------------------
  439|  7.29k|    {
  440|  7.29k|      if (!strcmp (name, "eddsa"))
  ------------------
  |  Branch (440:11): [True: 4.59k, False: 2.70k]
  ------------------
  441|  4.59k|        *r_eccflags = PUBKEY_FLAG_EDDSA;
  ------------------
  |  |   41|  4.59k|#define PUBKEY_FLAG_EDDSA          (1 << 12)
  ------------------
  442|  7.29k|      if (!strcmp (name, "gost"))
  ------------------
  |  Branch (442:11): [True: 0, False: 7.29k]
  ------------------
  443|      0|        *r_eccflags = PUBKEY_FLAG_GOST;
  ------------------
  |  |   42|      0|#define PUBKEY_FLAG_GOST           (1 << 13)
  ------------------
  444|  7.29k|      if (!strcmp (name, "sm2"))
  ------------------
  |  Branch (444:11): [True: 0, False: 7.29k]
  ------------------
  445|      0|        *r_eccflags = PUBKEY_FLAG_SM2;
  ------------------
  |  |   45|      0|#define PUBKEY_FLAG_SM2            (1 << 16)
  ------------------
  446|  7.29k|    }
  447|       |
  448|  11.8k|  *r_parms = l2;
  449|  11.8k|  l2 = NULL;
  450|  11.8k|  rc = 0;
  451|       |
  452|  11.8k| leave:
  453|  11.8k|  xfree (name);
  ------------------
  |  |  150|  11.8k|#define xfree(a)         _gcry_free ((a))
  ------------------
  454|  11.8k|  sexp_release (l2);
  ------------------
  |  |  372|  11.8k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  455|  11.8k|  sexp_release (l1);
  ------------------
  |  |  372|  11.8k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  456|  11.8k|  return rc;
  457|  11.8k|}
_gcry_pk_util_init_encoding_ctx:
  630|  11.8k|{
  631|  11.8k|  ctx->op = op;
  632|  11.8k|  ctx->nbits = nbits;
  633|  11.8k|  ctx->encoding = PUBKEY_ENC_UNKNOWN;
  634|  11.8k|  ctx->flags = 0;
  635|  11.8k|  if (fips_mode ())
  ------------------
  |  |  449|  11.8k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 11.8k]
  |  |  ------------------
  ------------------
  636|      0|    {
  637|      0|      ctx->hash_algo = GCRY_MD_SHA256;
  638|      0|    }
  639|  11.8k|  else
  640|  11.8k|    {
  641|  11.8k|      ctx->hash_algo = GCRY_MD_SHA1;
  642|  11.8k|    }
  643|  11.8k|  ctx->label = NULL;
  644|  11.8k|  ctx->labellen = 0;
  645|  11.8k|  ctx->saltlen = 20;
  646|  11.8k|  ctx->verify_cmp = NULL;
  647|  11.8k|  ctx->verify_arg = NULL;
  648|  11.8k|}
_gcry_pk_util_free_encoding_ctx:
  653|  11.8k|{
  654|  11.8k|  xfree (ctx->label);
  ------------------
  |  |  150|  11.8k|#define xfree(a)         _gcry_free ((a))
  ------------------
  655|  11.8k|}
_gcry_pk_util_data_to_mpi:
  691|  11.8k|{
  692|  11.8k|  gcry_err_code_t rc = 0;
  693|  11.8k|  gcry_sexp_t ldata, lhash, lvalue;
  694|  11.8k|  size_t n;
  695|  11.8k|  const char *s;
  696|  11.8k|  int unknown_flag = 0;
  697|  11.8k|  int parsed_flags = 0;
  698|       |
  699|  11.8k|  *ret_mpi = NULL;
  700|  11.8k|  ldata = sexp_find_token (input, "data", 0);
  ------------------
  |  |  381|  11.8k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
  701|  11.8k|  if (!ldata)
  ------------------
  |  Branch (701:7): [True: 7.21k, False: 4.59k]
  ------------------
  702|  7.21k|    { /* assume old style */
  703|  7.21k|      int mpifmt = (ctx->flags & PUBKEY_FLAG_RAW_FLAG) ?
  ------------------
  |  |   33|  7.21k|#define PUBKEY_FLAG_RAW_FLAG       (1 << 4)
  ------------------
  |  Branch (703:20): [True: 0, False: 7.21k]
  ------------------
  704|  7.21k|        GCRYMPI_FMT_OPAQUE : GCRYMPI_FMT_STD;
  705|       |
  706|  7.21k|      *ret_mpi = sexp_nth_mpi (input, 0, mpifmt);
  ------------------
  |  |  390|  7.21k|#define sexp_nth_mpi(a, b, c)        _gcry_sexp_nth_mpi ((a), (b), (c))
  ------------------
  707|  7.21k|      return *ret_mpi ? GPG_ERR_NO_ERROR : GPG_ERR_INV_OBJ;
  ------------------
  |  Branch (707:14): [True: 7.21k, False: 0]
  ------------------
  708|  7.21k|    }
  709|       |
  710|       |  /* See whether there is a flags list.  */
  711|  4.59k|  {
  712|  4.59k|    gcry_sexp_t lflags = sexp_find_token (ldata, "flags", 0);
  ------------------
  |  |  381|  4.59k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
  713|  4.59k|    if (lflags)
  ------------------
  |  Branch (713:9): [True: 4.59k, False: 0]
  ------------------
  714|  4.59k|      {
  715|  4.59k|        if (_gcry_pk_util_parse_flaglist (lflags,
  ------------------
  |  Branch (715:13): [True: 0, False: 4.59k]
  ------------------
  716|  4.59k|                                          &parsed_flags, &ctx->encoding))
  717|      0|          unknown_flag = 1;
  718|  4.59k|        sexp_release (lflags);
  ------------------
  |  |  372|  4.59k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  719|  4.59k|      }
  720|  4.59k|  }
  721|       |
  722|  4.59k|  if (ctx->encoding == PUBKEY_ENC_UNKNOWN)
  ------------------
  |  Branch (722:7): [True: 0, False: 4.59k]
  ------------------
  723|      0|    ctx->encoding = PUBKEY_ENC_RAW; /* default to raw */
  724|       |
  725|       |  /* Get HASH or MPI */
  726|  4.59k|  lhash = sexp_find_token (ldata, "hash", 0);
  ------------------
  |  |  381|  4.59k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
  727|  4.59k|  lvalue = lhash? NULL : sexp_find_token (ldata, "value", 0);
  ------------------
  |  |  381|  9.18k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
  |  Branch (727:12): [True: 0, False: 4.59k]
  ------------------
  728|       |
  729|  4.59k|  if (!(!lhash ^ !lvalue))
  ------------------
  |  Branch (729:7): [True: 0, False: 4.59k]
  ------------------
  730|      0|    rc = GPG_ERR_INV_OBJ; /* none or both given */
  731|  4.59k|  else if (unknown_flag)
  ------------------
  |  Branch (731:12): [True: 0, False: 4.59k]
  ------------------
  732|      0|    rc = GPG_ERR_INV_FLAG;
  733|  4.59k|  else if (ctx->encoding == PUBKEY_ENC_RAW
  ------------------
  |  Branch (733:12): [True: 4.59k, False: 0]
  ------------------
  734|  4.59k|           && ((parsed_flags & PUBKEY_FLAG_EDDSA)
  ------------------
  |  |   41|  4.59k|#define PUBKEY_FLAG_EDDSA          (1 << 12)
  ------------------
  |  Branch (734:16): [True: 4.59k, False: 0]
  ------------------
  735|  4.59k|               || (ctx->flags & PUBKEY_FLAG_EDDSA)))
  ------------------
  |  |   41|      0|#define PUBKEY_FLAG_EDDSA          (1 << 12)
  ------------------
  |  Branch (735:19): [True: 0, False: 0]
  ------------------
  736|  4.59k|    {
  737|       |      /* Prepare for EdDSA.  */
  738|  4.59k|      gcry_sexp_t list;
  739|  4.59k|      void *value;
  740|  4.59k|      size_t valuelen;
  741|       |
  742|  4.59k|      if (!lvalue)
  ------------------
  |  Branch (742:11): [True: 0, False: 4.59k]
  ------------------
  743|      0|        {
  744|      0|          rc = GPG_ERR_INV_OBJ;
  745|      0|          goto leave;
  746|      0|        }
  747|       |      /* Hash algo is determined by curve.  No hash-algo is OK.  */
  748|       |      /* Get HASH-ALGO. */
  749|  4.59k|      list = sexp_find_token (ldata, "hash-algo", 0);
  ------------------
  |  |  381|  4.59k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
  750|  4.59k|      if (list)
  ------------------
  |  Branch (750:11): [True: 4.59k, False: 0]
  ------------------
  751|  4.59k|        {
  752|  4.59k|          s = sexp_nth_data (list, 1, &n);
  ------------------
  |  |  387|  4.59k|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
  753|  4.59k|          if (!s)
  ------------------
  |  Branch (753:15): [True: 0, False: 4.59k]
  ------------------
  754|      0|            rc = GPG_ERR_NO_OBJ;
  755|  4.59k|          else
  756|  4.59k|            {
  757|  4.59k|              ctx->hash_algo = get_hash_algo (s, n);
  758|  4.59k|              if (!ctx->hash_algo)
  ------------------
  |  Branch (758:19): [True: 0, False: 4.59k]
  ------------------
  759|      0|                rc = GPG_ERR_DIGEST_ALGO;
  760|  4.59k|            }
  761|  4.59k|          sexp_release (list);
  ------------------
  |  |  372|  4.59k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  762|  4.59k|        }
  763|  4.59k|      if (rc)
  ------------------
  |  Branch (763:11): [True: 0, False: 4.59k]
  ------------------
  764|      0|        goto leave;
  765|       |
  766|       |      /* Get LABEL. */
  767|  4.59k|      list = sexp_find_token (ldata, "label", 0);
  ------------------
  |  |  381|  4.59k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
  768|  4.59k|      if (list)
  ------------------
  |  Branch (768:11): [True: 0, False: 4.59k]
  ------------------
  769|      0|        {
  770|      0|          s = sexp_nth_data (list, 1, &n);
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
  771|      0|          if (!s)
  ------------------
  |  Branch (771:15): [True: 0, False: 0]
  ------------------
  772|      0|            rc = GPG_ERR_NO_OBJ;
  773|      0|          else if (n > 0)
  ------------------
  |  Branch (773:20): [True: 0, False: 0]
  ------------------
  774|      0|            {
  775|      0|              ctx->label = xtrymalloc (n);
  ------------------
  |  |  138|      0|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  776|      0|              if (!ctx->label)
  ------------------
  |  Branch (776:19): [True: 0, False: 0]
  ------------------
  777|      0|                rc = gpg_err_code_from_syserror ();
  778|      0|              else
  779|      0|                {
  780|      0|                  memcpy (ctx->label, s, n);
  781|      0|                  ctx->labellen = n;
  782|      0|                }
  783|      0|            }
  784|      0|          sexp_release (list);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  785|      0|          if (rc)
  ------------------
  |  Branch (785:15): [True: 0, False: 0]
  ------------------
  786|      0|            goto leave;
  787|      0|        }
  788|       |
  789|       |      /* Get VALUE.  */
  790|  4.59k|      value = sexp_nth_buffer (lvalue, 1, &valuelen);
  ------------------
  |  |  388|  4.59k|#define sexp_nth_buffer(a, b, c)     _gcry_sexp_nth_buffer ((a), (b), (c))
  ------------------
  791|  4.59k|      if (!value)
  ------------------
  |  Branch (791:11): [True: 0, False: 4.59k]
  ------------------
  792|      0|        {
  793|       |          /* We assume that a zero length message is meant by
  794|       |             "(value)".  This is commonly used by test vectors.  Note
  795|       |             that S-expression do not allow zero length items. */
  796|      0|          valuelen = 0;
  797|      0|          value = xtrymalloc (1);
  ------------------
  |  |  138|      0|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  798|      0|          if (!value)
  ------------------
  |  Branch (798:15): [True: 0, False: 0]
  ------------------
  799|      0|            rc = gpg_err_code_from_syserror ();
  800|      0|        }
  801|  4.59k|      else if ((valuelen * 8) < valuelen)
  ------------------
  |  Branch (801:16): [True: 0, False: 4.59k]
  ------------------
  802|      0|        {
  803|      0|          xfree (value);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  804|      0|          rc = GPG_ERR_TOO_LARGE;
  805|      0|        }
  806|  4.59k|      if (rc)
  ------------------
  |  Branch (806:11): [True: 0, False: 4.59k]
  ------------------
  807|      0|        goto leave;
  808|       |
  809|       |      /* Note that mpi_set_opaque takes ownership of VALUE.  */
  810|  4.59k|      *ret_mpi = mpi_set_opaque (NULL, value, valuelen*8);
  ------------------
  |  |  561|  4.59k|#define mpi_set_opaque(a,b,c)  _gcry_mpi_set_opaque ((a), (b), (c))
  ------------------
  811|  4.59k|    }
  812|      0|  else if (ctx->encoding == PUBKEY_ENC_RAW
  ------------------
  |  Branch (812:12): [True: 0, False: 0]
  ------------------
  813|      0|           && (lhash || (lvalue && (parsed_flags & PUBKEY_FLAG_PREHASH)))
  ------------------
  |  |   46|      0|#define PUBKEY_FLAG_PREHASH        (1 << 17)
  ------------------
  |  Branch (813:16): [True: 0, False: 0]
  |  Branch (813:26): [True: 0, False: 0]
  |  Branch (813:36): [True: 0, False: 0]
  ------------------
  814|      0|           && ((parsed_flags & PUBKEY_FLAG_RAW_FLAG)
  ------------------
  |  |   33|      0|#define PUBKEY_FLAG_RAW_FLAG       (1 << 4)
  ------------------
  |  Branch (814:16): [True: 0, False: 0]
  ------------------
  815|      0|               || (parsed_flags & PUBKEY_FLAG_RFC6979)))
  ------------------
  |  |   30|      0|#define PUBKEY_FLAG_RFC6979        (1 << 1)
  ------------------
  |  Branch (815:19): [True: 0, False: 0]
  ------------------
  816|      0|    {
  817|      0|      void * value;
  818|      0|      size_t valuelen;
  819|      0|      gcry_sexp_t list;
  820|       |
  821|       |      /* Raw encoding along with a hash element.  This is commonly
  822|       |         used for DSA.  For better backward error compatibility we
  823|       |         allow this only if either the rfc6979 flag has been given or
  824|       |         the raw flags was explicitly given.  */
  825|       |
  826|      0|      if (lvalue && (parsed_flags & PUBKEY_FLAG_PREHASH))
  ------------------
  |  |   46|      0|#define PUBKEY_FLAG_PREHASH        (1 << 17)
  ------------------
  |  Branch (826:11): [True: 0, False: 0]
  |  Branch (826:21): [True: 0, False: 0]
  ------------------
  827|      0|        {
  828|       |          /* Get HASH-ALGO. */
  829|      0|          list = sexp_find_token (ldata, "hash-algo", 0);
  ------------------
  |  |  381|      0|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
  830|      0|          if (list)
  ------------------
  |  Branch (830:15): [True: 0, False: 0]
  ------------------
  831|      0|            {
  832|      0|              s = sexp_nth_data (list, 1, &n);
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
  833|      0|              if (!s)
  ------------------
  |  Branch (833:19): [True: 0, False: 0]
  ------------------
  834|      0|                rc = GPG_ERR_NO_OBJ;
  835|      0|              else
  836|      0|                {
  837|      0|                  ctx->hash_algo = get_hash_algo (s, n);
  838|      0|                  if (!ctx->hash_algo)
  ------------------
  |  Branch (838:23): [True: 0, False: 0]
  ------------------
  839|      0|                    rc = GPG_ERR_DIGEST_ALGO;
  840|      0|                }
  841|      0|              sexp_release (list);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  842|      0|              if (rc)
  ------------------
  |  Branch (842:19): [True: 0, False: 0]
  ------------------
  843|      0|                goto leave;
  844|      0|            }
  845|       |
  846|       |          /* Get optional LABEL.  */
  847|      0|          list = sexp_find_token (ldata, "label", 0);
  ------------------
  |  |  381|      0|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
  848|      0|          if (list)
  ------------------
  |  Branch (848:15): [True: 0, False: 0]
  ------------------
  849|      0|            {
  850|      0|              s = sexp_nth_data (list, 1, &n);
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
  851|      0|              if (!s)
  ------------------
  |  Branch (851:19): [True: 0, False: 0]
  ------------------
  852|      0|                rc = GPG_ERR_NO_OBJ;
  853|      0|              else if (n > 0)
  ------------------
  |  Branch (853:24): [True: 0, False: 0]
  ------------------
  854|      0|                {
  855|      0|                  ctx->label = xtrymalloc (n);
  ------------------
  |  |  138|      0|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  856|      0|                  if (!ctx->label)
  ------------------
  |  Branch (856:23): [True: 0, False: 0]
  ------------------
  857|      0|                    rc = gpg_err_code_from_syserror ();
  858|      0|                  else
  859|      0|                    {
  860|      0|                      memcpy (ctx->label, s, n);
  861|      0|                      ctx->labellen = n;
  862|      0|                    }
  863|      0|                }
  864|      0|              else
  865|      0|                rc = GPG_ERR_INV_ARG;
  866|      0|              sexp_release (list);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  867|      0|              if (rc)
  ------------------
  |  Branch (867:19): [True: 0, False: 0]
  ------------------
  868|      0|                goto leave;
  869|      0|            }
  870|       |
  871|      0|          if ( !(value=sexp_nth_buffer (lvalue, 1, &valuelen)) || !valuelen )
  ------------------
  |  |  388|      0|#define sexp_nth_buffer(a, b, c)     _gcry_sexp_nth_buffer ((a), (b), (c))
  ------------------
  |  Branch (871:16): [True: 0, False: 0]
  |  Branch (871:67): [True: 0, False: 0]
  ------------------
  872|      0|            rc = GPG_ERR_INV_OBJ;
  873|      0|          else if ((valuelen * 8) < valuelen)
  ------------------
  |  Branch (873:20): [True: 0, False: 0]
  ------------------
  874|      0|            {
  875|      0|              xfree (value);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  876|      0|              rc = GPG_ERR_TOO_LARGE;
  877|      0|            }
  878|      0|          else
  879|      0|            *ret_mpi = mpi_set_opaque (NULL, value, valuelen*8);
  ------------------
  |  |  561|      0|#define mpi_set_opaque(a,b,c)  _gcry_mpi_set_opaque ((a), (b), (c))
  ------------------
  880|      0|        }
  881|      0|      else if (lhash)
  ------------------
  |  Branch (881:16): [True: 0, False: 0]
  ------------------
  882|      0|        {
  883|       |          /* Get optional LABEL.  */
  884|      0|          list = sexp_find_token (ldata, "label", 0);
  ------------------
  |  |  381|      0|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
  885|      0|          if (list)
  ------------------
  |  Branch (885:15): [True: 0, False: 0]
  ------------------
  886|      0|            {
  887|      0|              s = sexp_nth_data (list, 1, &n);
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
  888|      0|              if (!s)
  ------------------
  |  Branch (888:19): [True: 0, False: 0]
  ------------------
  889|      0|                rc = GPG_ERR_NO_OBJ;
  890|      0|              else if (n > 0)
  ------------------
  |  Branch (890:24): [True: 0, False: 0]
  ------------------
  891|      0|                {
  892|      0|                  ctx->label = xtrymalloc (n);
  ------------------
  |  |  138|      0|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  893|      0|                  if (!ctx->label)
  ------------------
  |  Branch (893:23): [True: 0, False: 0]
  ------------------
  894|      0|                    rc = gpg_err_code_from_syserror ();
  895|      0|                  else
  896|      0|                    {
  897|      0|                      memcpy (ctx->label, s, n);
  898|      0|                      ctx->labellen = n;
  899|      0|                    }
  900|      0|                }
  901|      0|              else
  902|      0|                rc = GPG_ERR_INV_ARG;
  903|      0|              sexp_release (list);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  904|      0|              if (rc)
  ------------------
  |  Branch (904:19): [True: 0, False: 0]
  ------------------
  905|      0|                goto leave;
  906|      0|            }
  907|       |
  908|      0|          if (sexp_length (lhash) != 3)
  ------------------
  |  |  382|      0|#define sexp_length(a)               _gcry_sexp_length ((a))
  ------------------
  |  Branch (908:15): [True: 0, False: 0]
  ------------------
  909|      0|            rc = GPG_ERR_INV_OBJ;
  910|      0|          else if ( !(s=sexp_nth_data (lhash, 1, &n)) || !n )
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
  |  Branch (910:21): [True: 0, False: 0]
  |  Branch (910:58): [True: 0, False: 0]
  ------------------
  911|      0|            rc = GPG_ERR_INV_OBJ;
  912|      0|          else
  913|      0|            {
  914|      0|              ctx->hash_algo = get_hash_algo (s, n);
  915|       |
  916|      0|              if (!ctx->hash_algo)
  ------------------
  |  Branch (916:19): [True: 0, False: 0]
  ------------------
  917|      0|                rc = GPG_ERR_DIGEST_ALGO;
  918|      0|              else if ( !(value=sexp_nth_buffer (lhash, 2, &valuelen))
  ------------------
  |  |  388|      0|#define sexp_nth_buffer(a, b, c)     _gcry_sexp_nth_buffer ((a), (b), (c))
  ------------------
  |  Branch (918:25): [True: 0, False: 0]
  ------------------
  919|      0|                        || !valuelen )
  ------------------
  |  Branch (919:28): [True: 0, False: 0]
  ------------------
  920|      0|                rc = GPG_ERR_INV_OBJ;
  921|      0|              else if ((valuelen * 8) < valuelen)
  ------------------
  |  Branch (921:24): [True: 0, False: 0]
  ------------------
  922|      0|                {
  923|      0|                  xfree (value);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  924|      0|                  rc = GPG_ERR_TOO_LARGE;
  925|      0|                }
  926|      0|              else
  927|      0|                *ret_mpi = mpi_set_opaque (NULL, value, valuelen*8);
  ------------------
  |  |  561|      0|#define mpi_set_opaque(a,b,c)  _gcry_mpi_set_opaque ((a), (b), (c))
  ------------------
  928|      0|            }
  929|      0|        }
  930|      0|      else
  931|      0|        rc = GPG_ERR_CONFLICT;
  932|       |
  933|      0|      if (rc)
  ------------------
  |  Branch (933:11): [True: 0, False: 0]
  ------------------
  934|      0|        goto leave;
  935|      0|    }
  936|      0|  else if (ctx->encoding == PUBKEY_ENC_RAW && lvalue)
  ------------------
  |  Branch (936:12): [True: 0, False: 0]
  |  Branch (936:47): [True: 0, False: 0]
  ------------------
  937|      0|    {
  938|       |      /* RFC6979 may only be used with the a hash value and not the
  939|       |         MPI based value.  */
  940|      0|      if (parsed_flags & PUBKEY_FLAG_RFC6979)
  ------------------
  |  |   30|      0|#define PUBKEY_FLAG_RFC6979        (1 << 1)
  ------------------
  |  Branch (940:11): [True: 0, False: 0]
  ------------------
  941|      0|        {
  942|      0|          rc = GPG_ERR_CONFLICT;
  943|      0|          goto leave;
  944|      0|        }
  945|       |
  946|       |      /* Get the value */
  947|      0|      *ret_mpi = sexp_nth_mpi (lvalue, 1, GCRYMPI_FMT_USG);
  ------------------
  |  |  390|      0|#define sexp_nth_mpi(a, b, c)        _gcry_sexp_nth_mpi ((a), (b), (c))
  ------------------
  948|      0|      if (!*ret_mpi)
  ------------------
  |  Branch (948:11): [True: 0, False: 0]
  ------------------
  949|      0|        rc = GPG_ERR_INV_OBJ;
  950|      0|    }
  951|      0|  else if (ctx->encoding == PUBKEY_ENC_PKCS1 && lvalue
  ------------------
  |  Branch (951:12): [True: 0, False: 0]
  |  Branch (951:49): [True: 0, False: 0]
  ------------------
  952|      0|	   && ctx->op == PUBKEY_OP_ENCRYPT)
  ------------------
  |  Branch (952:8): [True: 0, False: 0]
  ------------------
  953|      0|    {
  954|      0|      const void * value;
  955|      0|      size_t valuelen;
  956|      0|      gcry_sexp_t list;
  957|      0|      void *random_override = NULL;
  958|      0|      size_t random_override_len = 0;
  959|       |
  960|      0|      if ( !(value=sexp_nth_data (lvalue, 1, &valuelen)) || !valuelen )
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
  |  Branch (960:12): [True: 0, False: 0]
  |  Branch (960:61): [True: 0, False: 0]
  ------------------
  961|      0|        rc = GPG_ERR_INV_OBJ;
  962|      0|      else
  963|      0|        {
  964|       |          /* Get optional RANDOM-OVERRIDE.  */
  965|      0|          list = sexp_find_token (ldata, "random-override", 0);
  ------------------
  |  |  381|      0|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
  966|      0|          if (list)
  ------------------
  |  Branch (966:15): [True: 0, False: 0]
  ------------------
  967|      0|            {
  968|      0|              s = sexp_nth_data (list, 1, &n);
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
  969|      0|              if (!s)
  ------------------
  |  Branch (969:19): [True: 0, False: 0]
  ------------------
  970|      0|                rc = GPG_ERR_NO_OBJ;
  971|      0|              else if (n > 0)
  ------------------
  |  Branch (971:24): [True: 0, False: 0]
  ------------------
  972|      0|                {
  973|      0|                  random_override = xtrymalloc (n);
  ------------------
  |  |  138|      0|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  974|      0|                  if (!random_override)
  ------------------
  |  Branch (974:23): [True: 0, False: 0]
  ------------------
  975|      0|                    rc = gpg_err_code_from_syserror ();
  976|      0|                  else
  977|      0|                    {
  978|      0|                      memcpy (random_override, s, n);
  979|      0|                      random_override_len = n;
  980|      0|                    }
  981|      0|                }
  982|      0|              sexp_release (list);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  983|      0|              if (rc)
  ------------------
  |  Branch (983:19): [True: 0, False: 0]
  ------------------
  984|      0|                goto leave;
  985|      0|            }
  986|       |
  987|      0|          rc = _gcry_rsa_pkcs1_encode_for_enc (ret_mpi, ctx->nbits,
  988|      0|                                               value, valuelen,
  989|      0|                                               random_override,
  990|      0|                                               random_override_len);
  991|      0|          xfree (random_override);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  992|      0|        }
  993|      0|    }
  994|      0|  else if (ctx->encoding == PUBKEY_ENC_PKCS1
  ------------------
  |  Branch (994:12): [True: 0, False: 0]
  ------------------
  995|      0|           && (lhash || (lvalue && (parsed_flags & PUBKEY_FLAG_PREHASH)))
  ------------------
  |  |   46|      0|#define PUBKEY_FLAG_PREHASH        (1 << 17)
  ------------------
  |  Branch (995:16): [True: 0, False: 0]
  |  Branch (995:26): [True: 0, False: 0]
  |  Branch (995:36): [True: 0, False: 0]
  ------------------
  996|      0|	   && (ctx->op == PUBKEY_OP_SIGN || ctx->op == PUBKEY_OP_VERIFY))
  ------------------
  |  Branch (996:9): [True: 0, False: 0]
  |  Branch (996:38): [True: 0, False: 0]
  ------------------
  997|      0|    {
  998|      0|      if (lvalue && (parsed_flags & PUBKEY_FLAG_PREHASH))
  ------------------
  |  |   46|      0|#define PUBKEY_FLAG_PREHASH        (1 << 17)
  ------------------
  |  Branch (998:11): [True: 0, False: 0]
  |  Branch (998:21): [True: 0, False: 0]
  ------------------
  999|      0|        {
 1000|      0|          void * value;
 1001|      0|          size_t valuelen;
 1002|      0|          gcry_sexp_t list;
 1003|       |
 1004|       |          /* Get HASH-ALGO. */
 1005|      0|          list = sexp_find_token (ldata, "hash-algo", 0);
  ------------------
  |  |  381|      0|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
 1006|      0|          if (list)
  ------------------
  |  Branch (1006:15): [True: 0, False: 0]
  ------------------
 1007|      0|            {
 1008|      0|              s = sexp_nth_data (list, 1, &n);
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
 1009|      0|              if (!s)
  ------------------
  |  Branch (1009:19): [True: 0, False: 0]
  ------------------
 1010|      0|                rc = GPG_ERR_NO_OBJ;
 1011|      0|              else
 1012|      0|                {
 1013|      0|                  ctx->hash_algo = get_hash_algo (s, n);
 1014|      0|                  if (!ctx->hash_algo)
  ------------------
  |  Branch (1014:23): [True: 0, False: 0]
  ------------------
 1015|      0|                    rc = GPG_ERR_DIGEST_ALGO;
 1016|      0|                }
 1017|      0|              sexp_release (list);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1018|      0|              if (rc)
  ------------------
  |  Branch (1018:19): [True: 0, False: 0]
  ------------------
 1019|      0|                goto leave;
 1020|      0|            }
 1021|       |
 1022|      0|          if ( !(value=sexp_nth_buffer (lvalue, 1, &valuelen)) || !valuelen )
  ------------------
  |  |  388|      0|#define sexp_nth_buffer(a, b, c)     _gcry_sexp_nth_buffer ((a), (b), (c))
  ------------------
  |  Branch (1022:16): [True: 0, False: 0]
  |  Branch (1022:67): [True: 0, False: 0]
  ------------------
 1023|      0|            rc = GPG_ERR_INV_OBJ;
 1024|      0|          else if ((valuelen * 8) < valuelen)
  ------------------
  |  Branch (1024:20): [True: 0, False: 0]
  ------------------
 1025|      0|            {
 1026|      0|              xfree (value);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1027|      0|              rc = GPG_ERR_TOO_LARGE;
 1028|      0|            }
 1029|      0|          else
 1030|      0|            {
 1031|      0|              void *hash;
 1032|       |
 1033|      0|              n = _gcry_md_get_algo_dlen (ctx->hash_algo);
 1034|      0|              hash = xtrymalloc (n);
  ------------------
  |  |  138|      0|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
 1035|      0|              if (!hash)
  ------------------
  |  Branch (1035:19): [True: 0, False: 0]
  ------------------
 1036|      0|                rc = gpg_err_code_from_syserror ();
 1037|      0|              else
 1038|      0|                {
 1039|      0|                  _gcry_md_hash_buffer (ctx->hash_algo, hash, value, valuelen);
 1040|      0|                  rc = _gcry_rsa_pkcs1_encode_for_sig (ret_mpi, ctx->nbits,
 1041|      0|                                                       hash, n, ctx->hash_algo);
 1042|      0|                  xfree (hash);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1043|      0|                }
 1044|      0|            }
 1045|      0|        }
 1046|      0|      else if (lhash)
  ------------------
  |  Branch (1046:16): [True: 0, False: 0]
  ------------------
 1047|      0|        {
 1048|      0|          if (sexp_length (lhash) != 3)
  ------------------
  |  |  382|      0|#define sexp_length(a)               _gcry_sexp_length ((a))
  ------------------
  |  Branch (1048:15): [True: 0, False: 0]
  ------------------
 1049|      0|            rc = GPG_ERR_INV_OBJ;
 1050|      0|          else if ( !(s=sexp_nth_data (lhash, 1, &n)) || !n )
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
  |  Branch (1050:21): [True: 0, False: 0]
  |  Branch (1050:58): [True: 0, False: 0]
  ------------------
 1051|      0|            rc = GPG_ERR_INV_OBJ;
 1052|      0|          else
 1053|      0|            {
 1054|      0|              const void * value;
 1055|      0|              size_t valuelen;
 1056|       |
 1057|      0|              ctx->hash_algo = get_hash_algo (s, n);
 1058|       |
 1059|      0|              if (!ctx->hash_algo)
  ------------------
  |  Branch (1059:19): [True: 0, False: 0]
  ------------------
 1060|      0|                rc = GPG_ERR_DIGEST_ALGO;
 1061|      0|              else if ( !(value=sexp_nth_data (lhash, 2, &valuelen))
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
  |  Branch (1061:25): [True: 0, False: 0]
  ------------------
 1062|      0|                        || !valuelen )
  ------------------
  |  Branch (1062:28): [True: 0, False: 0]
  ------------------
 1063|      0|                rc = GPG_ERR_INV_OBJ;
 1064|      0|              else
 1065|      0|                rc = _gcry_rsa_pkcs1_encode_for_sig (ret_mpi, ctx->nbits,
 1066|      0|                                                     value, valuelen,
 1067|      0|                                                     ctx->hash_algo);
 1068|      0|            }
 1069|      0|        }
 1070|      0|    }
 1071|      0|  else if (ctx->encoding == PUBKEY_ENC_PKCS1_RAW && lvalue
  ------------------
  |  Branch (1071:12): [True: 0, False: 0]
  |  Branch (1071:53): [True: 0, False: 0]
  ------------------
 1072|      0|	   && (ctx->op == PUBKEY_OP_SIGN || ctx->op == PUBKEY_OP_VERIFY))
  ------------------
  |  Branch (1072:9): [True: 0, False: 0]
  |  Branch (1072:38): [True: 0, False: 0]
  ------------------
 1073|      0|    {
 1074|      0|      const void * value;
 1075|      0|      size_t valuelen;
 1076|       |
 1077|      0|      if (sexp_length (lvalue) != 2)
  ------------------
  |  |  382|      0|#define sexp_length(a)               _gcry_sexp_length ((a))
  ------------------
  |  Branch (1077:11): [True: 0, False: 0]
  ------------------
 1078|      0|        rc = GPG_ERR_INV_OBJ;
 1079|      0|      else if ( !(value=sexp_nth_data (lvalue, 1, &valuelen))
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
  |  Branch (1079:17): [True: 0, False: 0]
  ------------------
 1080|      0|                || !valuelen )
  ------------------
  |  Branch (1080:20): [True: 0, False: 0]
  ------------------
 1081|      0|        rc = GPG_ERR_INV_OBJ;
 1082|      0|      else
 1083|      0|        rc = _gcry_rsa_pkcs1_encode_raw_for_sig (ret_mpi, ctx->nbits,
 1084|      0|                                                 value, valuelen);
 1085|      0|    }
 1086|      0|  else if (ctx->encoding == PUBKEY_ENC_OAEP && lvalue
  ------------------
  |  Branch (1086:12): [True: 0, False: 0]
  |  Branch (1086:48): [True: 0, False: 0]
  ------------------
 1087|      0|	   && ctx->op == PUBKEY_OP_ENCRYPT)
  ------------------
  |  Branch (1087:8): [True: 0, False: 0]
  ------------------
 1088|      0|    {
 1089|      0|      const void * value;
 1090|      0|      size_t valuelen;
 1091|       |
 1092|      0|      if ( !(value=sexp_nth_data (lvalue, 1, &valuelen)) || !valuelen )
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
  |  Branch (1092:12): [True: 0, False: 0]
  |  Branch (1092:61): [True: 0, False: 0]
  ------------------
 1093|      0|	rc = GPG_ERR_INV_OBJ;
 1094|      0|      else
 1095|      0|	{
 1096|      0|	  gcry_sexp_t list;
 1097|      0|          void *random_override = NULL;
 1098|      0|          size_t random_override_len = 0;
 1099|       |
 1100|       |	  /* Get HASH-ALGO. */
 1101|      0|	  list = sexp_find_token (ldata, "hash-algo", 0);
  ------------------
  |  |  381|      0|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
 1102|      0|	  if (list)
  ------------------
  |  Branch (1102:8): [True: 0, False: 0]
  ------------------
 1103|      0|	    {
 1104|      0|	      s = sexp_nth_data (list, 1, &n);
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
 1105|      0|	      if (!s)
  ------------------
  |  Branch (1105:12): [True: 0, False: 0]
  ------------------
 1106|      0|		rc = GPG_ERR_NO_OBJ;
 1107|      0|	      else
 1108|      0|		{
 1109|      0|		  ctx->hash_algo = get_hash_algo (s, n);
 1110|      0|		  if (!ctx->hash_algo)
  ------------------
  |  Branch (1110:9): [True: 0, False: 0]
  ------------------
 1111|      0|		    rc = GPG_ERR_DIGEST_ALGO;
 1112|      0|		}
 1113|      0|	      sexp_release (list);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1114|      0|	      if (rc)
  ------------------
  |  Branch (1114:12): [True: 0, False: 0]
  ------------------
 1115|      0|		goto leave;
 1116|      0|	    }
 1117|       |
 1118|       |	  /* Get LABEL. */
 1119|      0|	  list = sexp_find_token (ldata, "label", 0);
  ------------------
  |  |  381|      0|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
 1120|      0|	  if (list)
  ------------------
  |  Branch (1120:8): [True: 0, False: 0]
  ------------------
 1121|      0|	    {
 1122|      0|	      s = sexp_nth_data (list, 1, &n);
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
 1123|      0|	      if (!s)
  ------------------
  |  Branch (1123:12): [True: 0, False: 0]
  ------------------
 1124|      0|		rc = GPG_ERR_NO_OBJ;
 1125|      0|	      else if (n > 0)
  ------------------
  |  Branch (1125:17): [True: 0, False: 0]
  ------------------
 1126|      0|		{
 1127|      0|		  ctx->label = xtrymalloc (n);
  ------------------
  |  |  138|      0|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
 1128|      0|		  if (!ctx->label)
  ------------------
  |  Branch (1128:9): [True: 0, False: 0]
  ------------------
 1129|      0|		    rc = gpg_err_code_from_syserror ();
 1130|      0|		  else
 1131|      0|		    {
 1132|      0|		      memcpy (ctx->label, s, n);
 1133|      0|		      ctx->labellen = n;
 1134|      0|		    }
 1135|      0|		}
 1136|      0|	      sexp_release (list);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1137|      0|	      if (rc)
  ------------------
  |  Branch (1137:12): [True: 0, False: 0]
  ------------------
 1138|      0|		goto leave;
 1139|      0|	    }
 1140|       |          /* Get optional RANDOM-OVERRIDE.  */
 1141|      0|          list = sexp_find_token (ldata, "random-override", 0);
  ------------------
  |  |  381|      0|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
 1142|      0|          if (list)
  ------------------
  |  Branch (1142:15): [True: 0, False: 0]
  ------------------
 1143|      0|            {
 1144|      0|              s = sexp_nth_data (list, 1, &n);
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
 1145|      0|              if (!s)
  ------------------
  |  Branch (1145:19): [True: 0, False: 0]
  ------------------
 1146|      0|                rc = GPG_ERR_NO_OBJ;
 1147|      0|              else if (n > 0)
  ------------------
  |  Branch (1147:24): [True: 0, False: 0]
  ------------------
 1148|      0|                {
 1149|      0|                  random_override = xtrymalloc (n);
  ------------------
  |  |  138|      0|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
 1150|      0|                  if (!random_override)
  ------------------
  |  Branch (1150:23): [True: 0, False: 0]
  ------------------
 1151|      0|                    rc = gpg_err_code_from_syserror ();
 1152|      0|                  else
 1153|      0|                    {
 1154|      0|                      memcpy (random_override, s, n);
 1155|      0|                      random_override_len = n;
 1156|      0|                    }
 1157|      0|                }
 1158|      0|              sexp_release (list);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1159|      0|              if (rc)
  ------------------
  |  Branch (1159:19): [True: 0, False: 0]
  ------------------
 1160|      0|                goto leave;
 1161|      0|            }
 1162|       |
 1163|      0|	  rc = _gcry_rsa_oaep_encode (ret_mpi, ctx->nbits, ctx->hash_algo,
 1164|      0|                                      value, valuelen,
 1165|      0|                                      ctx->label, ctx->labellen,
 1166|      0|                                      random_override, random_override_len);
 1167|       |
 1168|      0|          xfree (random_override);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1169|      0|	}
 1170|      0|    }
 1171|      0|  else if (ctx->encoding == PUBKEY_ENC_PSS && ctx->op == PUBKEY_OP_SIGN)
  ------------------
  |  Branch (1171:12): [True: 0, False: 0]
  |  Branch (1171:47): [True: 0, False: 0]
  ------------------
 1172|      0|    {
 1173|      0|      const void * value;
 1174|      0|      size_t valuelen;
 1175|      0|      gcry_sexp_t list;
 1176|      0|      void *random_override = NULL;
 1177|       |
 1178|      0|      if (lvalue)
  ------------------
  |  Branch (1178:11): [True: 0, False: 0]
  ------------------
 1179|      0|        {
 1180|       |          /* Get HASH-ALGO. */
 1181|      0|          list = sexp_find_token (ldata, "hash-algo", 0);
  ------------------
  |  |  381|      0|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
 1182|      0|          if (list)
  ------------------
  |  Branch (1182:15): [True: 0, False: 0]
  ------------------
 1183|      0|            {
 1184|      0|              s = sexp_nth_data (list, 1, &n);
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
 1185|      0|              if (!s)
  ------------------
  |  Branch (1185:19): [True: 0, False: 0]
  ------------------
 1186|      0|                rc = GPG_ERR_NO_OBJ;
 1187|      0|              else
 1188|      0|                {
 1189|      0|                  ctx->hash_algo = get_hash_algo (s, n);
 1190|      0|                  if (!ctx->hash_algo)
  ------------------
  |  Branch (1190:23): [True: 0, False: 0]
  ------------------
 1191|      0|                    rc = GPG_ERR_DIGEST_ALGO;
 1192|      0|                }
 1193|      0|              sexp_release (list);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1194|      0|              if (rc)
  ------------------
  |  Branch (1194:19): [True: 0, False: 0]
  ------------------
 1195|      0|                goto leave;
 1196|      0|            }
 1197|       |
 1198|      0|          if ( !(value=sexp_nth_data (lvalue, 1, &valuelen)) || !valuelen )
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
  |  Branch (1198:16): [True: 0, False: 0]
  |  Branch (1198:65): [True: 0, False: 0]
  ------------------
 1199|      0|            rc = GPG_ERR_INV_OBJ;
 1200|      0|          ctx->flags |= PUBKEY_FLAG_PREHASH;
  ------------------
  |  |   46|      0|#define PUBKEY_FLAG_PREHASH        (1 << 17)
  ------------------
 1201|      0|        }
 1202|      0|      else if (lhash)
  ------------------
  |  Branch (1202:16): [True: 0, False: 0]
  ------------------
 1203|      0|        {
 1204|      0|          if (sexp_length (lhash) != 3)
  ------------------
  |  |  382|      0|#define sexp_length(a)               _gcry_sexp_length ((a))
  ------------------
  |  Branch (1204:15): [True: 0, False: 0]
  ------------------
 1205|      0|            rc = GPG_ERR_INV_OBJ;
 1206|      0|          else if ( !(s=sexp_nth_data (lhash, 1, &n)) || !n )
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
  |  Branch (1206:21): [True: 0, False: 0]
  |  Branch (1206:58): [True: 0, False: 0]
  ------------------
 1207|      0|            rc = GPG_ERR_INV_OBJ;
 1208|      0|          else
 1209|      0|            {
 1210|      0|              ctx->hash_algo = get_hash_algo (s, n);
 1211|       |
 1212|      0|              if (!ctx->hash_algo)
  ------------------
  |  Branch (1212:19): [True: 0, False: 0]
  ------------------
 1213|      0|                rc = GPG_ERR_DIGEST_ALGO;
 1214|      0|              else if ( !(value=sexp_nth_data (lhash, 2, &valuelen))
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
  |  Branch (1214:25): [True: 0, False: 0]
  ------------------
 1215|      0|                        || !valuelen )
  ------------------
  |  Branch (1215:28): [True: 0, False: 0]
  ------------------
 1216|      0|                rc = GPG_ERR_INV_OBJ;
 1217|      0|            }
 1218|      0|        }
 1219|      0|      else
 1220|      0|        rc = GPG_ERR_CONFLICT;
 1221|       |
 1222|      0|      if (rc)
  ------------------
  |  Branch (1222:11): [True: 0, False: 0]
  ------------------
 1223|      0|        goto leave;
 1224|       |
 1225|       |      /* Get SALT-LENGTH. */
 1226|      0|      list = sexp_find_token (ldata, "salt-length", 0);
  ------------------
  |  |  381|      0|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
 1227|      0|      if (list)
  ------------------
  |  Branch (1227:11): [True: 0, False: 0]
  ------------------
 1228|      0|        {
 1229|      0|          s = sexp_nth_data (list, 1, &n);
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
 1230|      0|          if (!s)
  ------------------
  |  Branch (1230:15): [True: 0, False: 0]
  ------------------
 1231|      0|            {
 1232|      0|              rc = GPG_ERR_NO_OBJ;
 1233|      0|              goto leave;
 1234|      0|            }
 1235|      0|          ctx->saltlen = (unsigned int)strtoul (s, NULL, 10);
 1236|      0|          sexp_release (list);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1237|      0|        }
 1238|       |
 1239|       |      /* Get optional RANDOM-OVERRIDE.  */
 1240|      0|      list = sexp_find_token (ldata, "random-override", 0);
  ------------------
  |  |  381|      0|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
 1241|      0|      if (list)
  ------------------
  |  Branch (1241:11): [True: 0, False: 0]
  ------------------
 1242|      0|        {
 1243|      0|          s = sexp_nth_data (list, 1, &n);
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
 1244|      0|          if (!s)
  ------------------
  |  Branch (1244:15): [True: 0, False: 0]
  ------------------
 1245|      0|            rc = GPG_ERR_NO_OBJ;
 1246|      0|          else if (n == ctx->saltlen)
  ------------------
  |  Branch (1246:20): [True: 0, False: 0]
  ------------------
 1247|      0|            {
 1248|      0|              random_override = xtrymalloc (n);
  ------------------
  |  |  138|      0|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
 1249|      0|              if (!random_override)
  ------------------
  |  Branch (1249:19): [True: 0, False: 0]
  ------------------
 1250|      0|                rc = gpg_err_code_from_syserror ();
 1251|      0|              else
 1252|      0|                memcpy (random_override, s, n);
 1253|      0|            }
 1254|      0|          else
 1255|      0|            rc = GPG_ERR_INV_ARG;
 1256|      0|          sexp_release (list);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1257|      0|          if (rc)
  ------------------
  |  Branch (1257:15): [True: 0, False: 0]
  ------------------
 1258|      0|            goto leave;
 1259|      0|        }
 1260|       |
 1261|       |      /* Encode the data.  (NBITS-1 is due to 8.1.1, step 1.) */
 1262|      0|      rc = _gcry_rsa_pss_encode (ret_mpi, ctx->nbits - 1,
 1263|      0|                                 ctx->hash_algo, ctx->saltlen,
 1264|      0|                                 !(ctx->flags & PUBKEY_FLAG_PREHASH),
  ------------------
  |  |   46|      0|#define PUBKEY_FLAG_PREHASH        (1 << 17)
  ------------------
 1265|      0|                                 value, valuelen,
 1266|      0|                                 random_override);
 1267|      0|      xfree (random_override);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1268|      0|    }
 1269|      0|  else if (ctx->encoding == PUBKEY_ENC_PSS && ctx->op == PUBKEY_OP_VERIFY)
  ------------------
  |  Branch (1269:12): [True: 0, False: 0]
  |  Branch (1269:47): [True: 0, False: 0]
  ------------------
 1270|      0|    {
 1271|      0|      gcry_sexp_t list;
 1272|       |
 1273|      0|      if (lvalue)
  ------------------
  |  Branch (1273:11): [True: 0, False: 0]
  ------------------
 1274|      0|        {
 1275|       |          /* Get HASH-ALGO. */
 1276|      0|          list = sexp_find_token (ldata, "hash-algo", 0);
  ------------------
  |  |  381|      0|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
 1277|      0|          if (list)
  ------------------
  |  Branch (1277:15): [True: 0, False: 0]
  ------------------
 1278|      0|            {
 1279|      0|              s = sexp_nth_data (list, 1, &n);
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
 1280|      0|              if (!s)
  ------------------
  |  Branch (1280:19): [True: 0, False: 0]
  ------------------
 1281|      0|                rc = GPG_ERR_NO_OBJ;
 1282|      0|              else
 1283|      0|                {
 1284|      0|                  ctx->hash_algo = get_hash_algo (s, n);
 1285|      0|                  if (!ctx->hash_algo)
  ------------------
  |  Branch (1285:23): [True: 0, False: 0]
  ------------------
 1286|      0|                    rc = GPG_ERR_DIGEST_ALGO;
 1287|      0|                }
 1288|      0|              sexp_release (list);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1289|      0|              if (rc)
  ------------------
  |  Branch (1289:19): [True: 0, False: 0]
  ------------------
 1290|      0|                goto leave;
 1291|      0|            }
 1292|       |
 1293|      0|          *ret_mpi = sexp_nth_mpi (lvalue, 1, GCRYMPI_FMT_OPAQUE);
  ------------------
  |  |  390|      0|#define sexp_nth_mpi(a, b, c)        _gcry_sexp_nth_mpi ((a), (b), (c))
  ------------------
 1294|      0|          if (!*ret_mpi)
  ------------------
  |  Branch (1294:15): [True: 0, False: 0]
  ------------------
 1295|      0|            rc = GPG_ERR_INV_OBJ;
 1296|       |
 1297|      0|          ctx->flags |= PUBKEY_FLAG_PREHASH;
  ------------------
  |  |   46|      0|#define PUBKEY_FLAG_PREHASH        (1 << 17)
  ------------------
 1298|      0|        }
 1299|      0|      else if (lhash)
  ------------------
  |  Branch (1299:16): [True: 0, False: 0]
  ------------------
 1300|      0|        {
 1301|      0|          if (sexp_length (lhash) != 3)
  ------------------
  |  |  382|      0|#define sexp_length(a)               _gcry_sexp_length ((a))
  ------------------
  |  Branch (1301:15): [True: 0, False: 0]
  ------------------
 1302|      0|            rc = GPG_ERR_INV_OBJ;
 1303|      0|          else if ( !(s=sexp_nth_data (lhash, 1, &n)) || !n )
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
  |  Branch (1303:21): [True: 0, False: 0]
  |  Branch (1303:58): [True: 0, False: 0]
  ------------------
 1304|      0|            rc = GPG_ERR_INV_OBJ;
 1305|      0|          else
 1306|      0|            {
 1307|      0|              ctx->hash_algo = get_hash_algo (s, n);
 1308|       |
 1309|      0|              if (!ctx->hash_algo)
  ------------------
  |  Branch (1309:19): [True: 0, False: 0]
  ------------------
 1310|      0|                rc = GPG_ERR_DIGEST_ALGO;
 1311|      0|              else
 1312|      0|                {
 1313|      0|                  *ret_mpi = sexp_nth_mpi (lhash, 2, GCRYMPI_FMT_OPAQUE);
  ------------------
  |  |  390|      0|#define sexp_nth_mpi(a, b, c)        _gcry_sexp_nth_mpi ((a), (b), (c))
  ------------------
 1314|      0|                  if (!*ret_mpi)
  ------------------
  |  Branch (1314:23): [True: 0, False: 0]
  ------------------
 1315|      0|                    rc = GPG_ERR_INV_OBJ;
 1316|      0|                }
 1317|      0|            }
 1318|      0|        }
 1319|      0|      else
 1320|      0|        rc = GPG_ERR_CONFLICT;
 1321|       |
 1322|      0|      if (rc)
  ------------------
  |  Branch (1322:11): [True: 0, False: 0]
  ------------------
 1323|      0|        goto leave;
 1324|       |
 1325|       |      /* Get SALT-LENGTH. */
 1326|      0|      list = sexp_find_token (ldata, "salt-length", 0);
  ------------------
  |  |  381|      0|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
 1327|      0|      if (list)
  ------------------
  |  Branch (1327:11): [True: 0, False: 0]
  ------------------
 1328|      0|        {
 1329|      0|          s = sexp_nth_data (list, 1, &n);
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
 1330|      0|          if (!s)
  ------------------
  |  Branch (1330:15): [True: 0, False: 0]
  ------------------
 1331|      0|            {
 1332|      0|              rc = GPG_ERR_NO_OBJ;
 1333|      0|              goto leave;
 1334|      0|            }
 1335|      0|          ctx->saltlen = (unsigned int)strtoul (s, NULL, 10);
 1336|      0|          if (ctx->saltlen > 16384)
  ------------------
  |  Branch (1336:15): [True: 0, False: 0]
  ------------------
 1337|      0|            rc = GPG_ERR_TOO_LARGE;
 1338|      0|          sexp_release (list);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1339|      0|          if (rc)
  ------------------
  |  Branch (1339:15): [True: 0, False: 0]
  ------------------
 1340|      0|            goto leave;
 1341|      0|        }
 1342|       |
 1343|      0|      ctx->verify_cmp = pss_verify_cmp;
 1344|      0|      ctx->verify_arg = *ret_mpi;
 1345|      0|    }
 1346|      0|  else
 1347|      0|    rc = GPG_ERR_CONFLICT;
 1348|       |
 1349|  4.59k| leave:
 1350|  4.59k|  sexp_release (ldata);
  ------------------
  |  |  372|  4.59k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1351|  4.59k|  sexp_release (lhash);
  ------------------
  |  |  372|  4.59k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1352|  4.59k|  sexp_release (lvalue);
  ------------------
  |  |  372|  4.59k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1353|       |
 1354|  4.59k|  if (!rc)
  ------------------
  |  Branch (1354:7): [True: 4.59k, False: 0]
  ------------------
 1355|  4.59k|    ctx->flags |= parsed_flags;
 1356|      0|  else
 1357|      0|    {
 1358|      0|      xfree (ctx->label);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1359|      0|      ctx->label = NULL;
 1360|      0|    }
 1361|       |
 1362|  4.59k|  return rc;
 1363|  4.59k|}
pubkey-util.c:get_hash_algo:
  214|  4.59k|{
  215|  4.59k|  static const struct { const char *name; int algo; } hashnames[] = {
  216|  4.59k|    { "sha1",   GCRY_MD_SHA1 },
  217|  4.59k|    { "md5",    GCRY_MD_MD5 },
  218|  4.59k|    { "sha256", GCRY_MD_SHA256 },
  219|  4.59k|    { "ripemd160", GCRY_MD_RMD160 },
  220|  4.59k|    { "rmd160", GCRY_MD_RMD160 },
  221|  4.59k|    { "sha384", GCRY_MD_SHA384 },
  222|  4.59k|    { "sha512", GCRY_MD_SHA512 },
  223|  4.59k|    { "sha224", GCRY_MD_SHA224 },
  224|  4.59k|    { "md2",    GCRY_MD_MD2 },
  225|  4.59k|    { "md4",    GCRY_MD_MD4 },
  226|  4.59k|    { "tiger",  GCRY_MD_TIGER },
  227|  4.59k|    { "haval",  GCRY_MD_HAVAL },
  228|  4.59k|    { "sha3-224", GCRY_MD_SHA3_224 },
  229|  4.59k|    { "sha3-256", GCRY_MD_SHA3_256 },
  230|  4.59k|    { "sha3-384", GCRY_MD_SHA3_384 },
  231|  4.59k|    { "sha3-512", GCRY_MD_SHA3_512 },
  232|  4.59k|    { "sm3", GCRY_MD_SM3 },
  233|  4.59k|    { "shake128", GCRY_MD_SHAKE128 },
  234|  4.59k|    { "shake256", GCRY_MD_SHAKE256 },
  235|  4.59k|    { "sha512-224", GCRY_MD_SHA512_224 },
  236|  4.59k|    { "sha512-256", GCRY_MD_SHA512_256 },
  237|  4.59k|    { NULL, 0 }
  238|  4.59k|  };
  239|  4.59k|  int algo;
  240|  4.59k|  int i;
  241|       |
  242|  32.1k|  for (i=0; hashnames[i].name; i++)
  ------------------
  |  Branch (242:13): [True: 32.1k, False: 0]
  ------------------
  243|  32.1k|    {
  244|  32.1k|      if ( strlen (hashnames[i].name) == n
  ------------------
  |  Branch (244:12): [True: 18.3k, False: 13.7k]
  ------------------
  245|  32.1k|	   && !memcmp (hashnames[i].name, s, n))
  ------------------
  |  Branch (245:8): [True: 4.59k, False: 13.7k]
  ------------------
  246|  4.59k|	break;
  247|  32.1k|    }
  248|  4.59k|  if (hashnames[i].name)
  ------------------
  |  Branch (248:7): [True: 4.59k, False: 0]
  ------------------
  249|  4.59k|    algo = hashnames[i].algo;
  250|      0|  else
  251|      0|    {
  252|       |      /* In case of not listed or dynamically allocated hash
  253|       |	 algorithm we fall back to this somewhat slower
  254|       |	 method.  Further, it also allows to use OIDs as
  255|       |	 algorithm names. */
  256|      0|      char *tmpname;
  257|       |
  258|      0|      tmpname = xtrymalloc (n+1);
  ------------------
  |  |  138|      0|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  259|      0|      if (!tmpname)
  ------------------
  |  Branch (259:11): [True: 0, False: 0]
  ------------------
  260|      0|	algo = 0;  /* Out of core - silently give up.  */
  261|      0|      else
  262|      0|	{
  263|      0|	  memcpy (tmpname, s, n);
  264|      0|	  tmpname[n] = 0;
  265|      0|	  algo = _gcry_md_map_name (tmpname);
  266|      0|	  xfree (tmpname);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  267|      0|	}
  268|      0|    }
  269|  4.59k|  return algo;
  270|  4.59k|}

_gcry_pk_verify:
  605|  11.8k|{
  606|  11.8k|  gcry_err_code_t rc;
  607|  11.8k|  gcry_pk_spec_t *spec;
  608|  11.8k|  gcry_sexp_t keyparms;
  609|       |
  610|  11.8k|  rc = spec_from_sexp (s_pkey, 0, &spec, &keyparms);
  611|  11.8k|  if (rc)
  ------------------
  |  Branch (611:7): [True: 0, False: 11.8k]
  ------------------
  612|      0|    goto leave;
  613|       |
  614|  11.8k|  if (spec->flags.disabled)
  ------------------
  |  Branch (614:7): [True: 0, False: 11.8k]
  ------------------
  615|      0|    rc = GPG_ERR_PUBKEY_ALGO;
  616|  11.8k|  else if (!spec->flags.fips && fips_mode ())
  ------------------
  |  |  449|  2.94k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 2.94k]
  |  |  ------------------
  ------------------
  |  Branch (616:12): [True: 2.94k, False: 8.88k]
  ------------------
  617|      0|    rc = GPG_ERR_PUBKEY_ALGO;
  618|  11.8k|  else if (spec->verify)
  ------------------
  |  Branch (618:12): [True: 11.8k, False: 0]
  ------------------
  619|  11.8k|    rc = spec->verify (s_sig, s_hash, keyparms);
  620|      0|  else
  621|      0|    rc = GPG_ERR_NOT_IMPLEMENTED;
  622|       |
  623|  11.8k| leave:
  624|  11.8k|  sexp_release (keyparms);
  ------------------
  |  |  372|  11.8k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  625|  11.8k|  return rc;
  626|  11.8k|}
_gcry_pk_get_nbits:
  901|  5.55k|{
  902|  5.55k|  gcry_pk_spec_t *spec;
  903|  5.55k|  gcry_sexp_t parms;
  904|  5.55k|  unsigned int nbits;
  905|       |
  906|       |  /* Parsing KEY might be considered too much overhead.  For example
  907|       |     for RSA we would only need to look at P and stop parsing right
  908|       |     away.  However, with ECC things are more complicate in that only
  909|       |     a curve name might be specified.  Thus we need to tear the sexp
  910|       |     apart. */
  911|       |
  912|  5.55k|  if (spec_from_sexp (key, 0, &spec, &parms))
  ------------------
  |  Branch (912:7): [True: 0, False: 5.55k]
  ------------------
  913|      0|    return 0; /* Error - 0 is a suitable indication for that.  */
  914|  5.55k|  if (spec->flags.disabled)
  ------------------
  |  Branch (914:7): [True: 0, False: 5.55k]
  ------------------
  915|      0|    return 0;
  916|  5.55k|  if (!spec->flags.fips && fips_mode ())
  ------------------
  |  |  449|  2.92k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 2.92k]
  |  |  ------------------
  ------------------
  |  Branch (916:7): [True: 2.92k, False: 2.63k]
  ------------------
  917|      0|    return 0;
  918|       |
  919|  5.55k|  nbits = spec->get_nbits (parms);
  920|  5.55k|  sexp_release (parms);
  ------------------
  |  |  372|  5.55k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  921|  5.55k|  return nbits;
  922|  5.55k|}
_gcry_pk_algo_info:
 1133|  34.6k|{
 1134|  34.6k|  gcry_err_code_t rc = 0;
 1135|       |
 1136|  34.6k|  switch (what)
 1137|  34.6k|    {
 1138|  34.6k|    case GCRYCTL_TEST_ALGO:
  ------------------
  |  Branch (1138:5): [True: 34.6k, False: 0]
  ------------------
 1139|  34.6k|      {
 1140|  34.6k|	int use = nbytes ? *nbytes : 0;
  ------------------
  |  Branch (1140:12): [True: 34.6k, False: 0]
  ------------------
 1141|  34.6k|	if (buffer)
  ------------------
  |  Branch (1141:6): [True: 0, False: 34.6k]
  ------------------
 1142|      0|	  rc = GPG_ERR_INV_ARG;
 1143|  34.6k|	else if (check_pubkey_algo (algorithm, use))
  ------------------
  |  Branch (1143:11): [True: 0, False: 34.6k]
  ------------------
 1144|      0|	  rc = GPG_ERR_PUBKEY_ALGO;
 1145|  34.6k|	break;
 1146|      0|      }
 1147|       |
 1148|      0|    case GCRYCTL_GET_ALGO_USAGE:
  ------------------
  |  Branch (1148:5): [True: 0, False: 34.6k]
  ------------------
 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: 34.6k]
  ------------------
 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: 34.6k]
  ------------------
 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: 34.6k]
  ------------------
 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: 34.6k]
  ------------------
 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: 34.6k]
  ------------------
 1187|      0|      rc = GPG_ERR_INV_OP;
 1188|  34.6k|    }
 1189|       |
 1190|  34.6k|  return rc;
 1191|  34.6k|}
_gcry_pk_init:
 1239|      1|{
 1240|      1|  return 0;
 1241|      1|}
pubkey.c:spec_from_name:
   92|  17.3k|{
   93|  17.3k|  gcry_pk_spec_t *spec;
   94|  17.3k|  int idx;
   95|  17.3k|  const char **aliases;
   96|       |
   97|  35.6k|  for (idx=0; (spec = pubkey_list[idx]); idx++)
  ------------------
  |  Branch (97:15): [True: 35.6k, False: 0]
  ------------------
   98|  35.6k|    {
   99|  35.6k|      if (!stricmp (name, spec->name))
  ------------------
  |  |  351|  35.6k|#define stricmp(a,b)	 strcasecmp( (a), (b) )
  ------------------
  |  Branch (99:11): [True: 14.6k, False: 20.9k]
  ------------------
  100|  14.6k|        return spec;
  101|   106k|      for (aliases = spec->aliases; *aliases; aliases++)
  ------------------
  |  Branch (101:37): [True: 87.9k, False: 18.2k]
  ------------------
  102|  87.9k|        if (!stricmp (name, *aliases))
  ------------------
  |  |  351|  87.9k|#define stricmp(a,b)	 strcasecmp( (a), (b) )
  ------------------
  |  Branch (102:13): [True: 2.70k, False: 85.2k]
  ------------------
  103|  2.70k|          return spec;
  104|  20.9k|    }
  105|       |
  106|      0|  return NULL;
  107|  17.3k|}
pubkey.c:spec_from_algo:
   75|  34.6k|{
   76|  34.6k|  int idx;
   77|  34.6k|  gcry_pk_spec_t *spec;
   78|       |
   79|  34.6k|  algo = map_algo (algo);
   80|       |
   81|  80.1k|  for (idx = 0; (spec = pubkey_list[idx]); idx++)
  ------------------
  |  Branch (81:17): [True: 80.1k, False: 0]
  ------------------
   82|  80.1k|    if (algo == spec->algo)
  ------------------
  |  Branch (82:9): [True: 34.6k, False: 45.4k]
  ------------------
   83|  34.6k|      return spec;
   84|      0|  return NULL;
   85|  34.6k|}
pubkey.c:spec_from_sexp:
  125|  17.3k|{
  126|  17.3k|  gcry_sexp_t list, l2;
  127|  17.3k|  char *name;
  128|  17.3k|  gcry_pk_spec_t *spec;
  129|       |
  130|  17.3k|  *r_spec = NULL;
  131|  17.3k|  if (r_parms)
  ------------------
  |  Branch (131:7): [True: 17.3k, False: 0]
  ------------------
  132|  17.3k|    *r_parms = NULL;
  133|       |
  134|       |  /* Check that the first element is valid.  If we are looking for a
  135|       |     public key but a private key was supplied, we allow the use of
  136|       |     the private key anyway.  The rationale for this is that the
  137|       |     private key is a superset of the public key.  */
  138|  17.3k|  list = sexp_find_token (sexp, want_private? "private-key":"public-key", 0);
  ------------------
  |  |  381|  34.7k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  |  |  ------------------
  |  |  |  Branch (381:67): [True: 0, False: 17.3k]
  |  |  ------------------
  ------------------
  139|  17.3k|  if (!list && !want_private)
  ------------------
  |  Branch (139:7): [True: 0, False: 17.3k]
  |  Branch (139:16): [True: 0, False: 0]
  ------------------
  140|      0|    list = sexp_find_token (sexp, "private-key", 0);
  ------------------
  |  |  381|      0|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
  141|  17.3k|  if (!list)
  ------------------
  |  Branch (141:7): [True: 0, False: 17.3k]
  ------------------
  142|      0|    return GPG_ERR_INV_OBJ; /* Does not contain a key object.  */
  143|       |
  144|  17.3k|  l2 = sexp_cadr (list);
  ------------------
  |  |  386|  17.3k|#define sexp_cadr(a)                 _gcry_sexp_cadr ((a))
  ------------------
  145|  17.3k|  sexp_release (list);
  ------------------
  |  |  372|  17.3k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  146|  17.3k|  list = l2;
  147|  17.3k|  name = sexp_nth_string (list, 0);
  ------------------
  |  |  389|  17.3k|#define sexp_nth_string(a, b)        _gcry_sexp_nth_string ((a), (b))
  ------------------
  148|  17.3k|  if (!name)
  ------------------
  |  Branch (148:7): [True: 0, False: 17.3k]
  ------------------
  149|      0|    {
  150|      0|      sexp_release ( list );
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  151|      0|      return GPG_ERR_INV_OBJ;      /* Invalid structure of object. */
  152|      0|    }
  153|  17.3k|  spec = spec_from_name (name);
  154|  17.3k|  xfree (name);
  ------------------
  |  |  150|  17.3k|#define xfree(a)         _gcry_free ((a))
  ------------------
  155|  17.3k|  if (!spec)
  ------------------
  |  Branch (155:7): [True: 0, False: 17.3k]
  ------------------
  156|      0|    {
  157|      0|      sexp_release (list);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  158|      0|      return GPG_ERR_PUBKEY_ALGO; /* Unknown algorithm. */
  159|      0|    }
  160|  17.3k|  *r_spec = spec;
  161|  17.3k|  if (r_parms)
  ------------------
  |  Branch (161:7): [True: 17.3k, False: 0]
  ------------------
  162|  17.3k|    *r_parms = list;
  163|      0|  else
  164|      0|    sexp_release (list);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  165|  17.3k|  return 0;
  166|  17.3k|}
pubkey.c:map_algo:
   57|  34.6k|{
   58|  34.6k| switch (algo)
   59|  34.6k|   {
   60|  1.94k|   case GCRY_PK_RSA_E: return GCRY_PK_RSA;
  ------------------
  |  Branch (60:4): [True: 1.94k, False: 32.6k]
  ------------------
   61|    852|   case GCRY_PK_RSA_S: return GCRY_PK_RSA;
  ------------------
  |  Branch (61:4): [True: 852, False: 33.7k]
  ------------------
   62|      0|   case GCRY_PK_ELG_E: return GCRY_PK_ELG;
  ------------------
  |  Branch (62:4): [True: 0, False: 34.6k]
  ------------------
   63|      0|   case GCRY_PK_ECDSA: return GCRY_PK_ECC;
  ------------------
  |  Branch (63:4): [True: 0, False: 34.6k]
  ------------------
   64|      0|   case GCRY_PK_EDDSA: return GCRY_PK_ECC;
  ------------------
  |  Branch (64:4): [True: 0, False: 34.6k]
  ------------------
   65|      0|   case GCRY_PK_ECDH:  return GCRY_PK_ECC;
  ------------------
  |  Branch (65:4): [True: 0, False: 34.6k]
  ------------------
   66|  31.8k|   default:            return algo;
  ------------------
  |  Branch (66:4): [True: 31.8k, False: 2.79k]
  ------------------
   67|  34.6k|   }
   68|  34.6k|}
pubkey.c:check_pubkey_algo:
  224|  34.6k|{
  225|  34.6k|  gcry_err_code_t err = 0;
  226|  34.6k|  gcry_pk_spec_t *spec;
  227|       |
  228|  34.6k|  spec = spec_from_algo (algo);
  229|  34.6k|  if (spec && !spec->flags.disabled && (spec->flags.fips || !fips_mode ()))
  ------------------
  |  |  449|  15.7k|#define fips_mode() (!_gcry_no_fips_mode_required)
  ------------------
  |  Branch (229:7): [True: 34.6k, False: 0]
  |  Branch (229:15): [True: 34.6k, False: 0]
  |  Branch (229:41): [True: 18.9k, False: 15.7k]
  |  Branch (229:61): [True: 15.7k, False: 0]
  ------------------
  230|  34.6k|    {
  231|  34.6k|      if (((use & GCRY_PK_USAGE_SIGN)
  ------------------
  |  | 1151|  34.6k|#define GCRY_PK_USAGE_SIGN 1   /* Good for signatures. */
  ------------------
  |  Branch (231:12): [True: 0, False: 34.6k]
  ------------------
  232|  34.6k|	   && (! (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|  34.6k|	  || ((use & GCRY_PK_USAGE_ENCR)
  ------------------
  |  | 1152|  34.6k|#define GCRY_PK_USAGE_ENCR 2   /* Good for encryption. */
  ------------------
  |  Branch (233:8): [True: 0, False: 34.6k]
  ------------------
  234|  34.6k|	      && (! (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|  34.6k|    }
  237|      0|  else
  238|      0|    err = GPG_ERR_PUBKEY_ALGO;
  239|       |
  240|  34.6k|  return err;
  241|  34.6k|}

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

rsa.c:public:
  988|  1.55k|{
  989|  1.55k|  if( output == input )  /* powm doesn't like output and input the same */
  ------------------
  |  Branch (989:7): [True: 0, False: 1.55k]
  ------------------
  990|      0|    {
  991|      0|      gcry_mpi_t x = mpi_alloc( mpi_get_nlimbs(input)*2 );
  ------------------
  |  |   97|      0|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  992|      0|      mpi_powm( x, input, pkey->e, pkey->n );
  ------------------
  |  |  525|      0|#define mpi_powm(w,b,e,m)      _gcry_mpi_powm ( (w), (b), (e), (m) )
  ------------------
  993|      0|      mpi_set(output, x);
  ------------------
  |  |  504|      0|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
  994|      0|      mpi_free(x);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  995|      0|    }
  996|  1.55k|  else
  997|  1.55k|    mpi_powm( output, input, pkey->e, pkey->n );
  ------------------
  |  |  525|  1.55k|#define mpi_powm(w,b,e,m)      _gcry_mpi_powm ( (w), (b), (e), (m) )
  ------------------
  998|  1.55k|}
rsa.c:rsa_verify:
 1664|  1.55k|{
 1665|  1.55k|  gcry_err_code_t rc;
 1666|  1.55k|  struct pk_encoding_ctx ctx;
 1667|  1.55k|  gcry_sexp_t l1 = NULL;
 1668|  1.55k|  gcry_mpi_t sig = NULL;
 1669|  1.55k|  gcry_mpi_t data = NULL;
 1670|  1.55k|  RSA_public_key pk = { NULL, NULL };
 1671|  1.55k|  gcry_mpi_t result = NULL;
 1672|  1.55k|  unsigned int nbits = rsa_get_nbits (keyparms);
 1673|       |
 1674|  1.55k|  rc = rsa_check_verify_keysize (nbits);
 1675|  1.55k|  if (rc)
  ------------------
  |  Branch (1675:7): [True: 0, False: 1.55k]
  ------------------
 1676|      0|    return rc;
 1677|       |
 1678|  1.55k|  _gcry_pk_util_init_encoding_ctx (&ctx, PUBKEY_OP_VERIFY, nbits);
 1679|       |
 1680|       |  /* Extract the data.  */
 1681|  1.55k|  rc = _gcry_pk_util_data_to_mpi (s_data, &data, &ctx);
 1682|  1.55k|  if (rc)
  ------------------
  |  Branch (1682:7): [True: 0, False: 1.55k]
  ------------------
 1683|      0|    goto leave;
 1684|  1.55k|  if (DBG_CIPHER)
  ------------------
  |  |   25|  1.55k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 1.55k]
  |  |  ------------------
  ------------------
 1685|      0|    log_printmpi ("rsa_verify data", data);
  ------------------
  |  |  208|      0|#define log_printmpi _gcry_log_printmpi
  ------------------
 1686|  1.55k|  if (ctx.encoding != PUBKEY_ENC_PSS && mpi_is_opaque (data))
  ------------------
  |  |  114|  1.55k|#define mpi_is_opaque(a)      ((a) && ((a)->flags&4))
  |  |  ------------------
  |  |  |  Branch (114:32): [True: 1.55k, False: 0]
  |  |  |  Branch (114:39): [True: 0, False: 1.55k]
  |  |  ------------------
  ------------------
  |  Branch (1686:7): [True: 1.55k, False: 0]
  ------------------
 1687|      0|    {
 1688|      0|      rc = GPG_ERR_INV_DATA;
 1689|      0|      goto leave;
 1690|      0|    }
 1691|       |
 1692|       |  /* Extract the signature value.  */
 1693|  1.55k|  rc = _gcry_pk_util_preparse_sigval (s_sig, rsa_names, &l1, NULL);
 1694|  1.55k|  if (rc)
  ------------------
  |  Branch (1694:7): [True: 0, False: 1.55k]
  ------------------
 1695|      0|    goto leave;
 1696|  1.55k|  rc = sexp_extract_param (l1, NULL, "s", &sig, NULL);
  ------------------
  |  |  391|  1.55k|#define sexp_extract_param           _gcry_sexp_extract_param
  ------------------
 1697|  1.55k|  if (rc)
  ------------------
  |  Branch (1697:7): [True: 5, False: 1.55k]
  ------------------
 1698|      5|    goto leave;
 1699|  1.55k|  if (DBG_CIPHER)
  ------------------
  |  |   25|  1.55k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 1.55k]
  |  |  ------------------
  ------------------
 1700|      0|    log_printmpi ("rsa_verify  sig", sig);
  ------------------
  |  |  208|      0|#define log_printmpi _gcry_log_printmpi
  ------------------
 1701|       |
 1702|       |  /* Extract the key.  */
 1703|  1.55k|  rc = sexp_extract_param (keyparms, NULL, "ne", &pk.n, &pk.e, NULL);
  ------------------
  |  |  391|  1.55k|#define sexp_extract_param           _gcry_sexp_extract_param
  ------------------
 1704|  1.55k|  if (rc)
  ------------------
  |  Branch (1704:7): [True: 0, False: 1.55k]
  ------------------
 1705|      0|    goto leave;
 1706|  1.55k|  if (DBG_CIPHER)
  ------------------
  |  |   25|  1.55k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 1.55k]
  |  |  ------------------
  ------------------
 1707|      0|    {
 1708|      0|      log_printmpi ("rsa_verify    n", pk.n);
  ------------------
  |  |  208|      0|#define log_printmpi _gcry_log_printmpi
  ------------------
 1709|      0|      log_printmpi ("rsa_verify    e", pk.e);
  ------------------
  |  |  208|      0|#define log_printmpi _gcry_log_printmpi
  ------------------
 1710|      0|    }
 1711|       |
 1712|       |  /* Do RSA computation and compare.  */
 1713|  1.55k|  result = mpi_new (0);
  ------------------
  |  |  491|  1.55k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
 1714|  1.55k|  public (result, sig, &pk);
 1715|  1.55k|  if (DBG_CIPHER)
  ------------------
  |  |   25|  1.55k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 1.55k]
  |  |  ------------------
  ------------------
 1716|      0|    log_printmpi ("rsa_verify  cmp", result);
  ------------------
  |  |  208|      0|#define log_printmpi _gcry_log_printmpi
  ------------------
 1717|  1.55k|  if (ctx.verify_cmp)
  ------------------
  |  Branch (1717:7): [True: 0, False: 1.55k]
  ------------------
 1718|      0|    rc = ctx.verify_cmp (&ctx, result);
 1719|  1.55k|  else
 1720|  1.55k|    rc = mpi_cmp (result, data) ? GPG_ERR_BAD_SIGNATURE : 0;
  ------------------
  |  |  510|  1.55k|#define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
  |  |  ------------------
  |  |  |  Branch (510:32): [True: 1.06k, False: 490]
  |  |  ------------------
  ------------------
 1721|       |
 1722|  1.55k| leave:
 1723|  1.55k|  _gcry_mpi_release (result);
 1724|  1.55k|  _gcry_mpi_release (pk.n);
 1725|  1.55k|  _gcry_mpi_release (pk.e);
 1726|  1.55k|  _gcry_mpi_release (data);
 1727|  1.55k|  _gcry_mpi_release (sig);
 1728|  1.55k|  sexp_release (l1);
  ------------------
  |  |  372|  1.55k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1729|  1.55k|  _gcry_pk_util_free_encoding_ctx (&ctx);
 1730|  1.55k|  if (DBG_CIPHER)
  ------------------
  |  |   25|  1.55k|#define DBG_CIPHER _gcry_get_debug_flag( 1 )
  |  |  ------------------
  |  |  |  Branch (25:20): [True: 0, False: 1.55k]
  |  |  ------------------
  ------------------
 1731|      0|    log_debug ("rsa_verify    => %s\n", rc?gpg_strerror (rc):"Good");
  ------------------
  |  |  205|      0|#define log_debug   _gcry_log_debug
  ------------------
  |  Branch (1731:41): [True: 0, False: 0]
  ------------------
 1732|  1.55k|  return rc;
 1733|  1.55k|}
rsa.c:rsa_check_verify_keysize:
  414|  1.55k|{
  415|  1.55k|  if (fips_mode ())
  ------------------
  |  |  449|  1.55k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 1.55k]
  |  |  ------------------
  ------------------
  416|      0|    {
  417|      0|      if ((nbits >= 1024 && (nbits % 256) == 0) || nbits >= 2048)
  ------------------
  |  Branch (417:12): [True: 0, False: 0]
  |  Branch (417:29): [True: 0, False: 0]
  |  Branch (417:52): [True: 0, False: 0]
  ------------------
  418|      0|        return GPG_ERR_NO_ERROR;
  419|       |
  420|      0|      return GPG_ERR_INV_VALUE;
  421|      0|    }
  422|       |
  423|  1.55k|  return GPG_ERR_NO_ERROR;
  424|  1.55k|}
rsa.c:rsa_get_nbits:
 1749|  4.19k|{
 1750|  4.19k|  gcry_sexp_t l1;
 1751|  4.19k|  gcry_mpi_t n;
 1752|  4.19k|  unsigned int nbits;
 1753|       |
 1754|  4.19k|  l1 = sexp_find_token (parms, "n", 1);
  ------------------
  |  |  381|  4.19k|#define sexp_find_token(a, b, c)     _gcry_sexp_find_token ((a), (b), (c))
  ------------------
 1755|  4.19k|  if (!l1)
  ------------------
  |  Branch (1755:7): [True: 0, False: 4.19k]
  ------------------
 1756|      0|    return 0; /* Parameter N not found.  */
 1757|       |
 1758|  4.19k|  n = sexp_nth_mpi (l1, 1, GCRYMPI_FMT_USG);
  ------------------
  |  |  390|  4.19k|#define sexp_nth_mpi(a, b, c)        _gcry_sexp_nth_mpi ((a), (b), (c))
  ------------------
 1759|  4.19k|  sexp_release (l1);
  ------------------
  |  |  372|  4.19k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 1760|  4.19k|  nbits = n? mpi_get_nbits (n) : 0;
  ------------------
  |  |  552|  4.19k|#define mpi_get_nbits(a)       _gcry_mpi_get_nbits ((a))
  ------------------
  |  Branch (1760:11): [True: 4.19k, False: 0]
  ------------------
 1761|  4.19k|  _gcry_mpi_release (n);
 1762|  4.19k|  return nbits;
 1763|  4.19k|}

_gcry_sha1_mixblock_init:
  373|  53.1k|{
  374|  53.1k|  sha1_init (hd, 0);
  375|  53.1k|}
_gcry_sha1_mixblock:
  532|  1.59M|{
  533|  1.59M|  u32 *p = blockof64byte;
  534|  1.59M|  unsigned int nburn;
  535|       |
  536|  1.59M|  nburn = (*hd->bctx.bwrite) (hd, blockof64byte, 1);
  537|  1.59M|  p[0] = hd->h0;
  538|  1.59M|  p[1] = hd->h1;
  539|  1.59M|  p[2] = hd->h2;
  540|  1.59M|  p[3] = hd->h3;
  541|  1.59M|  p[4] = hd->h4;
  542|       |
  543|  1.59M|  return nburn;
  544|  1.59M|}
_gcry_sha1_hash_buffer:
  658|  53.1k|{
  659|  53.1k|  gcry_buffer_t iov = { 0 };
  660|       |
  661|  53.1k|  iov.data = (void *)buffer;
  662|  53.1k|  iov.len = length;
  663|       |
  664|  53.1k|  _gcry_sha1_hash_buffers (outbuf, 20, &iov, 1);
  665|  53.1k|}
sha1.c:sha1_init:
  298|   148k|{
  299|   148k|  SHA1_CONTEXT *hd = context;
  300|   148k|  unsigned int features = _gcry_get_hw_features ();
  301|       |
  302|   148k|  (void)flags;
  303|       |
  304|   148k|  hd->h0 = 0x67452301;
  305|   148k|  hd->h1 = 0xefcdab89;
  306|   148k|  hd->h2 = 0x98badcfe;
  307|   148k|  hd->h3 = 0x10325476;
  308|   148k|  hd->h4 = 0xc3d2e1f0;
  309|       |
  310|   148k|  hd->bctx.nblocks = 0;
  311|   148k|  hd->bctx.nblocks_high = 0;
  312|   148k|  hd->bctx.count = 0;
  313|   148k|  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|   148k|  hd->bctx.bwrite = do_transform_generic;
  319|   148k|#ifdef USE_SSSE3
  320|   148k|  if ((features & HWF_INTEL_SSSE3) != 0)
  ------------------
  |  |  229|   148k|#define HWF_INTEL_SSSE3         (1 << 7)
  ------------------
  |  Branch (320:7): [True: 148k, False: 0]
  ------------------
  321|   148k|    hd->bctx.bwrite = do_sha1_transform_amd64_ssse3;
  322|   148k|#endif
  323|   148k|#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|   148k|  if ((features & HWF_INTEL_AVX) && (features & HWF_INTEL_FAST_SHLD))
  ------------------
  |  |  234|   148k|#define HWF_INTEL_AVX           (1 << 12)
  ------------------
                if ((features & HWF_INTEL_AVX) && (features & HWF_INTEL_FAST_SHLD))
  ------------------
  |  |  227|   148k|#define HWF_INTEL_FAST_SHLD     (1 << 5)
  ------------------
  |  Branch (326:7): [True: 148k, False: 0]
  |  Branch (326:37): [True: 148k, False: 0]
  ------------------
  327|   148k|    hd->bctx.bwrite = do_sha1_transform_amd64_avx;
  328|   148k|#endif
  329|   148k|#ifdef USE_BMI2
  330|   148k|  if ((features & HWF_INTEL_AVX) && (features & HWF_INTEL_BMI2))
  ------------------
  |  |  234|   148k|#define HWF_INTEL_AVX           (1 << 12)
  ------------------
                if ((features & HWF_INTEL_AVX) && (features & HWF_INTEL_BMI2))
  ------------------
  |  |  228|   148k|#define HWF_INTEL_BMI2          (1 << 6)
  ------------------
  |  Branch (330:7): [True: 148k, False: 0]
  |  Branch (330:37): [True: 148k, False: 0]
  ------------------
  331|   148k|    hd->bctx.bwrite = do_sha1_transform_amd64_avx_bmi2;
  332|   148k|#endif
  333|   148k|#ifdef USE_AVX2
  334|   148k|  if ((features & HWF_INTEL_AVX2) && (features & HWF_INTEL_AVX) &&
  ------------------
  |  |  235|   148k|#define HWF_INTEL_AVX2          (1 << 13)
  ------------------
                if ((features & HWF_INTEL_AVX2) && (features & HWF_INTEL_AVX) &&
  ------------------
  |  |  234|   148k|#define HWF_INTEL_AVX           (1 << 12)
  ------------------
  |  Branch (334:7): [True: 148k, False: 0]
  |  Branch (334:38): [True: 148k, False: 0]
  ------------------
  335|   148k|      (features & HWF_INTEL_BMI2))
  ------------------
  |  |  228|   148k|#define HWF_INTEL_BMI2          (1 << 6)
  ------------------
  |  Branch (335:7): [True: 148k, False: 0]
  ------------------
  336|   148k|    hd->bctx.bwrite = do_sha1_transform_amd64_avx2_bmi2;
  337|   148k|#endif
  338|   148k|#ifdef USE_SHAEXT
  339|   148k|  if ((features & HWF_INTEL_SHAEXT) && (features & HWF_INTEL_SSE4_1))
  ------------------
  |  |  238|   148k|#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: 148k]
  |  Branch (339:40): [True: 0, False: 0]
  ------------------
  340|      0|    hd->bctx.bwrite = do_sha1_transform_intel_shaext;
  341|   148k|#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|   148k|  (void)features;
  364|   148k|}
sha1.c:do_sha1_transform_amd64_avx_bmi2:
  176|  1.70M|{
  177|  1.70M|  SHA1_CONTEXT *hd = ctx;
  178|  1.70M|  return _gcry_sha1_transform_amd64_avx_bmi2 (&hd->h0, data, nblks)
  179|  1.70M|         + ASM_EXTRA_STACK;
  ------------------
  |  |  133|  1.70M|#  define ASM_EXTRA_STACK 0
  ------------------
  180|  1.70M|}
sha1.c:do_sha1_transform_amd64_avx2_bmi2:
  190|  1.76M|{
  191|  1.76M|  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|  1.76M|  if (nblks <= 1)
  ------------------
  |  Branch (197:7): [True: 1.70M, False: 56.2k]
  ------------------
  198|  1.70M|    return do_sha1_transform_amd64_avx_bmi2 (ctx, data, nblks);
  199|       |
  200|  56.2k|  if (nblks & 1)
  ------------------
  |  Branch (200:7): [True: 54.2k, False: 1.92k]
  ------------------
  201|  54.2k|    {
  202|  54.2k|      (void)_gcry_sha1_transform_amd64_avx_bmi2 (&hd->h0, data, 1);
  203|  54.2k|      nblks--;
  204|  54.2k|      data += 64;
  205|  54.2k|    }
  206|       |
  207|  56.2k|  return _gcry_sha1_transform_amd64_avx2_bmi2 (&hd->h0, data, nblks)
  208|  56.2k|         + ASM_EXTRA_STACK;
  ------------------
  |  |  133|  56.2k|#  define ASM_EXTRA_STACK 0
  ------------------
  209|  1.76M|}
sha1.c:_gcry_sha1_hash_buffers:
  642|  53.1k|{
  643|  53.1k|  SHA1_CONTEXT hd;
  644|       |
  645|  53.1k|  (void)nbytes;
  646|       |
  647|  53.1k|  sha1_init (&hd, 0);
  648|   106k|  for (;iovcnt > 0; iov++, iovcnt--)
  ------------------
  |  Branch (648:9): [True: 53.1k, False: 53.1k]
  ------------------
  649|  53.1k|    _gcry_md_block_write (&hd,
  650|  53.1k|                          (const char*)iov[0].data + iov[0].off, iov[0].len);
  651|  53.1k|  sha1_final (&hd);
  652|  53.1k|  memcpy (outbuf, hd.bctx.buf, 20);
  653|  53.1k|}
sha1.c:sha1_final:
  556|  86.4k|{
  557|  86.4k|  SHA1_CONTEXT *hd = context;
  558|  86.4k|  u32 t, th, msb, lsb;
  559|  86.4k|  unsigned char *p;
  560|  86.4k|  unsigned int burn;
  561|       |
  562|  86.4k|  t = hd->bctx.nblocks;
  563|  86.4k|  if (sizeof t == sizeof hd->bctx.nblocks)
  ------------------
  |  Branch (563:7): [Folded - Ignored]
  ------------------
  564|      0|    th = hd->bctx.nblocks_high;
  565|  86.4k|  else
  566|  86.4k|    th = hd->bctx.nblocks >> 32;
  567|       |
  568|       |  /* multiply by 64 to make a byte count */
  569|  86.4k|  lsb = t << 6;
  570|  86.4k|  msb = (th << 6) | (t >> 26);
  571|       |  /* add the count */
  572|  86.4k|  t = lsb;
  573|  86.4k|  if( (lsb += hd->bctx.count) < t )
  ------------------
  |  Branch (573:7): [True: 0, False: 86.4k]
  ------------------
  574|      0|    msb++;
  575|       |  /* multiply by 8 to make a bit count */
  576|  86.4k|  t = lsb;
  577|  86.4k|  lsb <<= 3;
  578|  86.4k|  msb <<= 3;
  579|  86.4k|  msb |= t >> 29;
  580|       |
  581|  86.4k|  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|  86.4k|  else if (hd->bctx.count < 56)  /* enough room */
  ------------------
  |  Branch (589:12): [True: 85.8k, False: 567]
  ------------------
  590|  85.8k|    {
  591|  85.8k|      hd->bctx.buf[hd->bctx.count++] = 0x80; /* pad */
  592|  85.8k|      if (hd->bctx.count < 56)
  ------------------
  |  Branch (592:11): [True: 85.7k, False: 87]
  ------------------
  593|  85.7k|	memset (&hd->bctx.buf[hd->bctx.count], 0, 56 - hd->bctx.count);
  594|       |
  595|       |      /* append the 64 bit count */
  596|  85.8k|      buf_put_be32(hd->bctx.buf + 56, msb);
  597|  85.8k|      buf_put_be32(hd->bctx.buf + 60, lsb);
  598|  85.8k|      burn = (*hd->bctx.bwrite) ( hd, hd->bctx.buf, 1 );
  599|  85.8k|    }
  600|    567|  else  /* need one extra block */
  601|    567|    {
  602|    567|      hd->bctx.buf[hd->bctx.count++] = 0x80; /* pad character */
  603|       |      /* fill pad and next block with zeroes */
  604|    567|      memset (&hd->bctx.buf[hd->bctx.count], 0, 64 - hd->bctx.count + 56);
  605|       |
  606|       |      /* append the 64 bit count */
  607|    567|      buf_put_be32(hd->bctx.buf + 64 + 56, msb);
  608|    567|      buf_put_be32(hd->bctx.buf + 64 + 60, lsb);
  609|    567|      burn = (*hd->bctx.bwrite) ( hd, hd->bctx.buf, 2 );
  610|    567|    }
  611|       |
  612|  86.4k|  p = hd->bctx.buf;
  613|  86.4k|#define X(a) do { buf_put_be32(p, hd->h##a); p += 4; } while(0)
  614|  86.4k|  X(0);
  ------------------
  |  |  613|  86.4k|#define X(a) do { buf_put_be32(p, hd->h##a); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (613:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  615|  86.4k|  X(1);
  ------------------
  |  |  613|  86.4k|#define X(a) do { buf_put_be32(p, hd->h##a); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (613:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  616|  86.4k|  X(2);
  ------------------
  |  |  613|  86.4k|#define X(a) do { buf_put_be32(p, hd->h##a); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (613:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  617|  86.4k|  X(3);
  ------------------
  |  |  613|  86.4k|#define X(a) do { buf_put_be32(p, hd->h##a); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (613:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  618|  86.4k|  X(4);
  ------------------
  |  |  613|  86.4k|#define X(a) do { buf_put_be32(p, hd->h##a); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (613:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  619|  86.4k|#undef X
  620|       |
  621|  86.4k|  hd->bctx.count = 0;
  622|       |
  623|  86.4k|  _gcry_burn_stack (burn);
  ------------------
  |  |  371|  86.4k|	do { __gcry_burn_stack (bytes); \
  |  |  372|  86.4k|	     __gcry_burn_stack_dummy (); } while(0)
  |  |  ------------------
  |  |  |  |  364|  86.4k|#define  __gcry_burn_stack_dummy() asm volatile ("":::"memory")
  |  |  ------------------
  |  |  |  Branch (372:43): [Folded - Ignored]
  |  |  ------------------
  ------------------
  624|  86.4k|}
sha1.c:sha1_read:
  628|  32.6k|{
  629|  32.6k|  SHA1_CONTEXT *hd = context;
  630|       |
  631|  32.6k|  return hd->bctx.buf;
  632|  32.6k|}

sha256.c:sha224_init:
  365|  1.17k|{
  366|  1.17k|  SHA256_CONTEXT *hd = context;
  367|       |
  368|  1.17k|  (void)flags;
  369|       |
  370|  1.17k|  hd->h[0] = 0xc1059ed8;
  371|  1.17k|  hd->h[1] = 0x367cd507;
  372|  1.17k|  hd->h[2] = 0x3070dd17;
  373|  1.17k|  hd->h[3] = 0xf70e5939;
  374|  1.17k|  hd->h[4] = 0xffc00b31;
  375|  1.17k|  hd->h[5] = 0x68581511;
  376|  1.17k|  hd->h[6] = 0x64f98fa7;
  377|  1.17k|  hd->h[7] = 0xbefa4fa4;
  378|       |
  379|  1.17k|  sha256_common_init (hd);
  380|  1.17k|}
sha256.c:sha256_common_init:
  287|  9.05k|{
  288|  9.05k|  unsigned int features = _gcry_get_hw_features ();
  289|       |
  290|  9.05k|  hd->bctx.nblocks = 0;
  291|  9.05k|  hd->bctx.nblocks_high = 0;
  292|  9.05k|  hd->bctx.count = 0;
  293|  9.05k|  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|  9.05k|  hd->bctx.bwrite = do_transform_generic;
  299|  9.05k|#ifdef USE_SSSE3
  300|  9.05k|  if ((features & HWF_INTEL_SSSE3) != 0)
  ------------------
  |  |  229|  9.05k|#define HWF_INTEL_SSSE3         (1 << 7)
  ------------------
  |  Branch (300:7): [True: 9.05k, False: 0]
  ------------------
  301|  9.05k|    hd->bctx.bwrite = do_sha256_transform_amd64_ssse3;
  302|  9.05k|#endif
  303|  9.05k|#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|  9.05k|  if ((features & HWF_INTEL_AVX) && (features & HWF_INTEL_FAST_SHLD))
  ------------------
  |  |  234|  9.05k|#define HWF_INTEL_AVX           (1 << 12)
  ------------------
                if ((features & HWF_INTEL_AVX) && (features & HWF_INTEL_FAST_SHLD))
  ------------------
  |  |  227|  9.05k|#define HWF_INTEL_FAST_SHLD     (1 << 5)
  ------------------
  |  Branch (306:7): [True: 9.05k, False: 0]
  |  Branch (306:37): [True: 9.05k, False: 0]
  ------------------
  307|  9.05k|    hd->bctx.bwrite = do_sha256_transform_amd64_avx;
  308|  9.05k|#endif
  309|  9.05k|#ifdef USE_AVX2
  310|  9.05k|  if ((features & HWF_INTEL_AVX2) && (features & HWF_INTEL_BMI2))
  ------------------
  |  |  235|  9.05k|#define HWF_INTEL_AVX2          (1 << 13)
  ------------------
                if ((features & HWF_INTEL_AVX2) && (features & HWF_INTEL_BMI2))
  ------------------
  |  |  228|  9.05k|#define HWF_INTEL_BMI2          (1 << 6)
  ------------------
  |  Branch (310:7): [True: 9.05k, False: 0]
  |  Branch (310:38): [True: 9.05k, False: 0]
  ------------------
  311|  9.05k|    hd->bctx.bwrite = do_sha256_transform_amd64_avx2;
  312|  9.05k|#endif
  313|  9.05k|#ifdef USE_SHAEXT
  314|  9.05k|  if ((features & HWF_INTEL_SHAEXT) && (features & HWF_INTEL_SSE4_1))
  ------------------
  |  |  238|  9.05k|#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: 9.05k]
  |  Branch (314:40): [True: 0, False: 0]
  ------------------
  315|      0|    hd->bctx.bwrite = do_sha256_transform_intel_shaext;
  316|  9.05k|#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|  9.05k|  (void)features;
  340|  9.05k|}
sha256.c:do_sha256_transform_amd64_avx2:
  184|  15.2k|{
  185|  15.2k|  SHA256_CONTEXT *hd = ctx;
  186|  15.2k|  return _gcry_sha256_transform_amd64_avx2 (data, hd->h, nblks)
  187|  15.2k|         + ASM_EXTRA_STACK;
  ------------------
  |  |  141|  15.2k|#  define ASM_EXTRA_STACK 0
  ------------------
  188|  15.2k|}
sha256.c:sha256_final:
  549|  6.16k|{
  550|  6.16k|  SHA256_CONTEXT *hd = context;
  551|  6.16k|  u32 t, th, msb, lsb;
  552|  6.16k|  byte *p;
  553|  6.16k|  unsigned int burn;
  554|       |
  555|  6.16k|  t = hd->bctx.nblocks;
  556|  6.16k|  if (sizeof t == sizeof hd->bctx.nblocks)
  ------------------
  |  Branch (556:7): [Folded - Ignored]
  ------------------
  557|      0|    th = hd->bctx.nblocks_high;
  558|  6.16k|  else
  559|  6.16k|    th = hd->bctx.nblocks >> 32;
  560|       |
  561|       |  /* multiply by 64 to make a byte count */
  562|  6.16k|  lsb = t << 6;
  563|  6.16k|  msb = (th << 6) | (t >> 26);
  564|       |  /* add the count */
  565|  6.16k|  t = lsb;
  566|  6.16k|  if ((lsb += hd->bctx.count) < t)
  ------------------
  |  Branch (566:7): [True: 0, False: 6.16k]
  ------------------
  567|      0|    msb++;
  568|       |  /* multiply by 8 to make a bit count */
  569|  6.16k|  t = lsb;
  570|  6.16k|  lsb <<= 3;
  571|  6.16k|  msb <<= 3;
  572|  6.16k|  msb |= t >> 29;
  573|       |
  574|  6.16k|  if (0)
  ------------------
  |  Branch (574:7): [Folded - Ignored]
  ------------------
  575|      0|    { }
  576|       |#ifdef USE_S390X_CRYPTO
  577|       |  else if (hd->use_s390x_crypto)
  578|       |    {
  579|       |      burn = do_sha256_final_s390x (hd, hd->bctx.buf, hd->bctx.count, msb, lsb);
  580|       |    }
  581|       |#endif
  582|  6.16k|  else if (hd->bctx.count < 56)  /* enough room */
  ------------------
  |  Branch (582:12): [True: 5.13k, False: 1.02k]
  ------------------
  583|  5.13k|    {
  584|  5.13k|      hd->bctx.buf[hd->bctx.count++] = 0x80; /* pad */
  585|  5.13k|      if (hd->bctx.count < 56)
  ------------------
  |  Branch (585:11): [True: 3.52k, False: 1.61k]
  ------------------
  586|  3.52k|	memset (&hd->bctx.buf[hd->bctx.count], 0, 56 - hd->bctx.count);
  587|       |
  588|       |      /* append the 64 bit count */
  589|  5.13k|      buf_put_be32(hd->bctx.buf + 56, msb);
  590|  5.13k|      buf_put_be32(hd->bctx.buf + 60, lsb);
  591|  5.13k|      burn = (*hd->bctx.bwrite) (hd, hd->bctx.buf, 1);
  592|  5.13k|    }
  593|  1.02k|  else  /* need one extra block */
  594|  1.02k|    {
  595|  1.02k|      hd->bctx.buf[hd->bctx.count++] = 0x80; /* pad character */
  596|       |      /* fill pad and next block with zeroes */
  597|  1.02k|      memset (&hd->bctx.buf[hd->bctx.count], 0, 64 - hd->bctx.count + 56);
  598|       |
  599|       |      /* append the 64 bit count */
  600|  1.02k|      buf_put_be32(hd->bctx.buf + 64 + 56, msb);
  601|  1.02k|      buf_put_be32(hd->bctx.buf + 64 + 60, lsb);
  602|  1.02k|      burn = (*hd->bctx.bwrite) (hd, hd->bctx.buf, 2);
  603|  1.02k|    }
  604|       |
  605|  6.16k|  p = hd->bctx.buf;
  606|  6.16k|#define X(a) do { buf_put_be32(p, hd->h[a]); p += 4; } while(0)
  607|  6.16k|  X(0);
  ------------------
  |  |  606|  6.16k|#define X(a) do { buf_put_be32(p, hd->h[a]); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (606:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  608|  6.16k|  X(1);
  ------------------
  |  |  606|  6.16k|#define X(a) do { buf_put_be32(p, hd->h[a]); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (606:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  609|  6.16k|  X(2);
  ------------------
  |  |  606|  6.16k|#define X(a) do { buf_put_be32(p, hd->h[a]); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (606:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  610|  6.16k|  X(3);
  ------------------
  |  |  606|  6.16k|#define X(a) do { buf_put_be32(p, hd->h[a]); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (606:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  611|  6.16k|  X(4);
  ------------------
  |  |  606|  6.16k|#define X(a) do { buf_put_be32(p, hd->h[a]); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (606:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  612|  6.16k|  X(5);
  ------------------
  |  |  606|  6.16k|#define X(a) do { buf_put_be32(p, hd->h[a]); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (606:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  613|  6.16k|  X(6);
  ------------------
  |  |  606|  6.16k|#define X(a) do { buf_put_be32(p, hd->h[a]); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (606:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  614|  6.16k|  X(7);
  ------------------
  |  |  606|  6.16k|#define X(a) do { buf_put_be32(p, hd->h[a]); p += 4; } while(0)
  |  |  ------------------
  |  |  |  Branch (606:62): [Folded - Ignored]
  |  |  ------------------
  ------------------
  615|  6.16k|#undef X
  616|       |
  617|  6.16k|  hd->bctx.count = 0;
  618|       |
  619|  6.16k|  _gcry_burn_stack (burn);
  ------------------
  |  |  371|  6.16k|	do { __gcry_burn_stack (bytes); \
  |  |  372|  6.16k|	     __gcry_burn_stack_dummy (); } while(0)
  |  |  ------------------
  |  |  |  |  364|  6.16k|#define  __gcry_burn_stack_dummy() asm volatile ("":::"memory")
  |  |  ------------------
  |  |  |  Branch (372:43): [Folded - Ignored]
  |  |  ------------------
  ------------------
  620|  6.16k|}
sha256.c:sha256_read:
  624|  5.78k|{
  625|  5.78k|  SHA256_CONTEXT *hd = context;
  626|       |
  627|  5.78k|  return hd->bctx.buf;
  628|  5.78k|}
sha256.c:sha256_init:
  345|  7.87k|{
  346|  7.87k|  SHA256_CONTEXT *hd = context;
  347|       |
  348|  7.87k|  (void)flags;
  349|       |
  350|  7.87k|  hd->h[0] = 0x6a09e667;
  351|  7.87k|  hd->h[1] = 0xbb67ae85;
  352|  7.87k|  hd->h[2] = 0x3c6ef372;
  353|  7.87k|  hd->h[3] = 0xa54ff53a;
  354|  7.87k|  hd->h[4] = 0x510e527f;
  355|  7.87k|  hd->h[5] = 0x9b05688c;
  356|  7.87k|  hd->h[6] = 0x1f83d9ab;
  357|  7.87k|  hd->h[7] = 0x5be0cd19;
  358|       |
  359|  7.87k|  sha256_common_init (hd);
  360|  7.87k|}

sha512.c:sha512_init:
  500|  7.86k|{
  501|  7.86k|  SHA512_CONTEXT *ctx = context;
  502|  7.86k|  SHA512_STATE *hd = &ctx->state;
  503|       |
  504|  7.86k|  hd->h[0] = U64_C(0x6a09e667f3bcc908);
  ------------------
  |  |  106|  7.86k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  505|  7.86k|  hd->h[1] = U64_C(0xbb67ae8584caa73b);
  ------------------
  |  |  106|  7.86k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  506|  7.86k|  hd->h[2] = U64_C(0x3c6ef372fe94f82b);
  ------------------
  |  |  106|  7.86k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  507|  7.86k|  hd->h[3] = U64_C(0xa54ff53a5f1d36f1);
  ------------------
  |  |  106|  7.86k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  508|  7.86k|  hd->h[4] = U64_C(0x510e527fade682d1);
  ------------------
  |  |  106|  7.86k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  509|  7.86k|  hd->h[5] = U64_C(0x9b05688c2b3e6c1f);
  ------------------
  |  |  106|  7.86k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  510|  7.86k|  hd->h[6] = U64_C(0x1f83d9abfb41bd6b);
  ------------------
  |  |  106|  7.86k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  511|  7.86k|  hd->h[7] = U64_C(0x5be0cd19137e2179);
  ------------------
  |  |  106|  7.86k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  512|       |
  513|  7.86k|  sha512_init_common (ctx, flags);
  514|  7.86k|}
sha512.c:sha512_init_common:
  433|  9.10k|{
  434|  9.10k|  unsigned int features = _gcry_get_hw_features ();
  435|       |
  436|  9.10k|  (void)flags;
  437|  9.10k|  (void)k;
  438|       |
  439|  9.10k|  ctx->bctx.nblocks = 0;
  440|  9.10k|  ctx->bctx.nblocks_high = 0;
  441|  9.10k|  ctx->bctx.count = 0;
  442|  9.10k|  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|  9.10k|  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|  9.10k|#ifdef USE_SSSE3
  457|  9.10k|  if ((features & HWF_INTEL_SSSE3) != 0)
  ------------------
  |  |  229|  9.10k|#define HWF_INTEL_SSSE3         (1 << 7)
  ------------------
  |  Branch (457:7): [True: 9.10k, False: 0]
  ------------------
  458|  9.10k|    ctx->bctx.bwrite = do_sha512_transform_amd64_ssse3;
  459|  9.10k|#endif
  460|  9.10k|#ifdef USE_AVX
  461|  9.10k|  if ((features & HWF_INTEL_AVX) && (features & HWF_INTEL_FAST_SHLD))
  ------------------
  |  |  234|  9.10k|#define HWF_INTEL_AVX           (1 << 12)
  ------------------
                if ((features & HWF_INTEL_AVX) && (features & HWF_INTEL_FAST_SHLD))
  ------------------
  |  |  227|  9.10k|#define HWF_INTEL_FAST_SHLD     (1 << 5)
  ------------------
  |  Branch (461:7): [True: 9.10k, False: 0]
  |  Branch (461:37): [True: 9.10k, False: 0]
  ------------------
  462|  9.10k|    ctx->bctx.bwrite = do_sha512_transform_amd64_avx;
  463|  9.10k|#endif
  464|  9.10k|#ifdef USE_AVX2
  465|  9.10k|  if ((features & HWF_INTEL_AVX2) && (features & HWF_INTEL_BMI2))
  ------------------
  |  |  235|  9.10k|#define HWF_INTEL_AVX2          (1 << 13)
  ------------------
                if ((features & HWF_INTEL_AVX2) && (features & HWF_INTEL_BMI2))
  ------------------
  |  |  228|  9.10k|#define HWF_INTEL_BMI2          (1 << 6)
  ------------------
  |  Branch (465:7): [True: 9.10k, False: 0]
  |  Branch (465:38): [True: 9.10k, False: 0]
  ------------------
  466|  9.10k|    ctx->bctx.bwrite = do_sha512_transform_amd64_avx2;
  467|  9.10k|#endif
  468|  9.10k|#ifdef USE_AVX512
  469|  9.10k|  if ((features & HWF_INTEL_AVX512) && (features & HWF_INTEL_CPU))
  ------------------
  |  |  240|  9.10k|#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: 9.10k]
  |  Branch (469:40): [True: 0, False: 0]
  ------------------
  470|      0|    ctx->bctx.bwrite = do_sha512_transform_amd64_avx512;
  471|  9.10k|#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|  9.10k|  (void)features;
  495|  9.10k|}
sha512.c:do_sha512_transform_amd64_avx2:
  312|  12.4k|{
  313|  12.4k|  SHA512_CONTEXT *hd = ctx;
  314|  12.4k|  unsigned int burn;
  315|  12.4k|  burn = _gcry_sha512_transform_amd64_avx2 (data, &hd->state, nblks);
  316|  12.4k|  burn += burn > 0 ? ASM_EXTRA_STACK : 0;
  ------------------
  |  |  236|      0|#  define ASM_EXTRA_STACK 0
  ------------------
  |  Branch (316:11): [True: 0, False: 12.4k]
  ------------------
  317|  12.4k|  return burn;
  318|  12.4k|}
sha512.c:sha512_final:
  856|  7.54k|{
  857|  7.54k|  SHA512_CONTEXT *hd = context;
  858|  7.54k|  unsigned int burn;
  859|  7.54k|  u64 t, th, msb, lsb;
  860|  7.54k|  byte *p;
  861|       |
  862|  7.54k|  t = hd->bctx.nblocks;
  863|       |  /* if (sizeof t == sizeof hd->bctx.nblocks) */
  864|  7.54k|  th = hd->bctx.nblocks_high;
  865|       |  /* else */
  866|       |  /*   th = hd->bctx.nblocks >> 64; In case we ever use u128  */
  867|       |
  868|       |  /* multiply by 128 to make a byte count */
  869|  7.54k|  lsb = t << 7;
  870|  7.54k|  msb = (th << 7) | (t >> 57);
  871|       |  /* add the count */
  872|  7.54k|  t = lsb;
  873|  7.54k|  if ((lsb += hd->bctx.count) < t)
  ------------------
  |  Branch (873:7): [True: 0, False: 7.54k]
  ------------------
  874|      0|    msb++;
  875|       |  /* multiply by 8 to make a bit count */
  876|  7.54k|  t = lsb;
  877|  7.54k|  lsb <<= 3;
  878|  7.54k|  msb <<= 3;
  879|  7.54k|  msb |= t >> 61;
  880|       |
  881|  7.54k|  if (0)
  ------------------
  |  Branch (881:7): [Folded - Ignored]
  ------------------
  882|      0|    { }
  883|       |#ifdef USE_S390X_CRYPTO
  884|       |  else if (hd->use_s390x_crypto)
  885|       |    {
  886|       |      burn = do_sha512_final_s390x (hd, hd->bctx.buf, hd->bctx.count, msb, lsb);
  887|       |    }
  888|       |#endif
  889|  7.54k|  else
  890|  7.54k|    {
  891|  7.54k|      if (hd->bctx.count < 112)
  ------------------
  |  Branch (891:11): [True: 6.76k, False: 781]
  ------------------
  892|  6.76k|	{
  893|       |	  /* enough room */
  894|  6.76k|	  hd->bctx.buf[hd->bctx.count++] = 0x80;  /* pad */
  895|  6.76k|	  if (hd->bctx.count < 112)
  ------------------
  |  Branch (895:8): [True: 6.76k, False: 2]
  ------------------
  896|  6.76k|	    memset (&hd->bctx.buf[hd->bctx.count], 0, 112 - hd->bctx.count);
  897|  6.76k|	}
  898|    781|      else
  899|    781|	{
  900|       |	  /* need one extra block */
  901|    781|	  hd->bctx.buf[hd->bctx.count++] = 0x80;  /* pad character */
  902|    781|	  if (hd->bctx.count < 128)
  ------------------
  |  Branch (902:8): [True: 509, False: 272]
  ------------------
  903|    509|	    memset (&hd->bctx.buf[hd->bctx.count], 0, 128 - hd->bctx.count);
  904|    781|	  hd->bctx.count = 128;
  905|    781|	  _gcry_md_block_write (context, NULL, 0); /* flush */
  906|    781|	  memset (hd->bctx.buf, 0, 112);  /* fill next block with zeroes */
  907|    781|	}
  908|       |      /* append the 128 bit count */
  909|  7.54k|      buf_put_be64(hd->bctx.buf + 112, msb);
  910|  7.54k|      buf_put_be64(hd->bctx.buf + 120, lsb);
  911|  7.54k|      burn = (*hd->bctx.bwrite) (hd, hd->bctx.buf, 1);
  912|  7.54k|    }
  913|       |
  914|  7.54k|  p = hd->bctx.buf;
  915|  7.54k|#define X(a) do { buf_put_be64(p, hd->state.h[a]); p += 8; } while (0)
  916|  7.54k|  X (0);
  ------------------
  |  |  915|  7.54k|#define X(a) do { buf_put_be64(p, hd->state.h[a]); p += 8; } while (0)
  |  |  ------------------
  |  |  |  Branch (915:69): [Folded - Ignored]
  |  |  ------------------
  ------------------
  917|  7.54k|  X (1);
  ------------------
  |  |  915|  7.54k|#define X(a) do { buf_put_be64(p, hd->state.h[a]); p += 8; } while (0)
  |  |  ------------------
  |  |  |  Branch (915:69): [Folded - Ignored]
  |  |  ------------------
  ------------------
  918|  7.54k|  X (2);
  ------------------
  |  |  915|  7.54k|#define X(a) do { buf_put_be64(p, hd->state.h[a]); p += 8; } while (0)
  |  |  ------------------
  |  |  |  Branch (915:69): [Folded - Ignored]
  |  |  ------------------
  ------------------
  919|  7.54k|  X (3);
  ------------------
  |  |  915|  7.54k|#define X(a) do { buf_put_be64(p, hd->state.h[a]); p += 8; } while (0)
  |  |  ------------------
  |  |  |  Branch (915:69): [Folded - Ignored]
  |  |  ------------------
  ------------------
  920|  7.54k|  X (4);
  ------------------
  |  |  915|  7.54k|#define X(a) do { buf_put_be64(p, hd->state.h[a]); p += 8; } while (0)
  |  |  ------------------
  |  |  |  Branch (915:69): [Folded - Ignored]
  |  |  ------------------
  ------------------
  921|  7.54k|  X (5);
  ------------------
  |  |  915|  7.54k|#define X(a) do { buf_put_be64(p, hd->state.h[a]); p += 8; } while (0)
  |  |  ------------------
  |  |  |  Branch (915:69): [Folded - Ignored]
  |  |  ------------------
  ------------------
  922|       |  /* Note that these last two chunks are included even for SHA384.
  923|       |     We just ignore them. */
  924|  7.54k|  X (6);
  ------------------
  |  |  915|  7.54k|#define X(a) do { buf_put_be64(p, hd->state.h[a]); p += 8; } while (0)
  |  |  ------------------
  |  |  |  Branch (915:69): [Folded - Ignored]
  |  |  ------------------
  ------------------
  925|  7.54k|  X (7);
  ------------------
  |  |  915|  7.54k|#define X(a) do { buf_put_be64(p, hd->state.h[a]); p += 8; } while (0)
  |  |  ------------------
  |  |  |  Branch (915:69): [Folded - Ignored]
  |  |  ------------------
  ------------------
  926|  7.54k|#undef X
  927|       |
  928|  7.54k|  hd->bctx.count = 0;
  929|       |
  930|  7.54k|  _gcry_burn_stack (burn);
  ------------------
  |  |  371|  7.54k|	do { __gcry_burn_stack (bytes); \
  |  |  372|  7.54k|	     __gcry_burn_stack_dummy (); } while(0)
  |  |  ------------------
  |  |  |  |  364|  7.54k|#define  __gcry_burn_stack_dummy() asm volatile ("":::"memory")
  |  |  ------------------
  |  |  |  Branch (372:43): [Folded - Ignored]
  |  |  ------------------
  ------------------
  931|  7.54k|}
sha512.c:sha512_read:
  935|  2.53k|{
  936|  2.53k|  SHA512_CONTEXT *hd = (SHA512_CONTEXT *) context;
  937|  2.53k|  return hd->bctx.buf;
  938|  2.53k|}
sha512.c:_gcry_sha512_hash_buffers:
  946|  4.59k|{
  947|  4.59k|  SHA512_CONTEXT hd;
  948|       |
  949|  4.59k|  (void)nbytes;
  950|       |
  951|  4.59k|  sha512_init (&hd, 0);
  952|  18.3k|  for (;iovcnt > 0; iov++, iovcnt--)
  ------------------
  |  Branch (952:9): [True: 13.7k, False: 4.59k]
  ------------------
  953|  13.7k|    _gcry_md_block_write (&hd,
  954|  13.7k|                          (const char*)iov[0].data + iov[0].off, iov[0].len);
  955|  4.59k|  sha512_final (&hd);
  956|  4.59k|  memcpy (outbuf, hd.bctx.buf, 64);
  957|  4.59k|}
sha512.c:sha384_init:
  518|  1.24k|{
  519|  1.24k|  SHA512_CONTEXT *ctx = context;
  520|  1.24k|  SHA512_STATE *hd = &ctx->state;
  521|       |
  522|  1.24k|  hd->h[0] = U64_C(0xcbbb9d5dc1059ed8);
  ------------------
  |  |  106|  1.24k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  523|  1.24k|  hd->h[1] = U64_C(0x629a292a367cd507);
  ------------------
  |  |  106|  1.24k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  524|  1.24k|  hd->h[2] = U64_C(0x9159015a3070dd17);
  ------------------
  |  |  106|  1.24k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  525|  1.24k|  hd->h[3] = U64_C(0x152fecd8f70e5939);
  ------------------
  |  |  106|  1.24k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  526|  1.24k|  hd->h[4] = U64_C(0x67332667ffc00b31);
  ------------------
  |  |  106|  1.24k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  527|  1.24k|  hd->h[5] = U64_C(0x8eb44a8768581511);
  ------------------
  |  |  106|  1.24k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  528|  1.24k|  hd->h[6] = U64_C(0xdb0c2e0d64f98fa7);
  ------------------
  |  |  106|  1.24k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  529|  1.24k|  hd->h[7] = U64_C(0x47b5481dbefa4fa4);
  ------------------
  |  |  106|  1.24k|#  define U64_C(c) (UINT64_C(c))
  ------------------
  530|       |
  531|  1.24k|  sha512_init_common (ctx, flags);
  532|  1.24k|}

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

mpicoder.c:buf_put_be64:
  171|  1.03M|{
  172|  1.03M|  bufhelp_u64_t *out = _buf;
  173|  1.03M|  out->a = be_bswap64(val);
  ------------------
  |  |   75|  1.03M|# define be_bswap64(x) _gcry_bswap64(x)
  |  |  ------------------
  |  |  |  |   56|  1.03M|# define _gcry_bswap64 __builtin_bswap64
  |  |  ------------------
  ------------------
  174|  1.03M|}
mpicoder.c:buf_put_le64:
  177|  18.3k|{
  178|  18.3k|  bufhelp_u64_t *out = _buf;
  179|  18.3k|  out->a = le_bswap64(val);
  ------------------
  |  |   74|  18.3k|# define le_bswap64(x) ((u64)(x))
  ------------------
  180|  18.3k|}
mpicoder.c:buf_put_le32:
  147|  18.3k|{
  148|  18.3k|  bufhelp_u32_t *out = _buf;
  149|  18.3k|  out->a = le_bswap32(val);
  ------------------
  |  |   72|  18.3k|# define le_bswap32(x) ((u32)(x))
  ------------------
  150|  18.3k|}
mpicoder.c:buf_get_be64:
  161|   777k|{
  162|   777k|  return be_bswap64(((const bufhelp_u64_t *)_buf)->a);
  ------------------
  |  |   75|   777k|# define be_bswap64(x) _gcry_bswap64(x)
  |  |  ------------------
  |  |  |  |   56|   777k|# define _gcry_bswap64 __builtin_bswap64
  |  |  ------------------
  ------------------
  163|   777k|}
mpicoder.c:buf_get_be32:
  131|  18.3k|{
  132|  18.3k|  return be_bswap32(((const bufhelp_u32_t *)_buf)->a);
  ------------------
  |  |   73|  18.3k|# define be_bswap32(x) _gcry_bswap32(x)
  |  |  ------------------
  |  |  |  |   46|  18.3k|# define _gcry_bswap32 __builtin_bswap32
  |  |  ------------------
  ------------------
  133|  18.3k|}
mpicoder.c:buf_get_le32:
  136|   676k|{
  137|   676k|  return le_bswap32(((const bufhelp_u32_t *)_buf)->a);
  ------------------
  |  |   72|   676k|# define le_bswap32(x) ((u32)(x))
  ------------------
  138|   676k|}
ec-nist.c:buf_get_le64:
  166|  48.6M|{
  167|  48.6M|  return le_bswap64(((const bufhelp_u64_t *)_buf)->a);
  ------------------
  |  |   74|  48.6M|# define le_bswap64(x) ((u64)(x))
  ------------------
  168|  48.6M|}

ec-nist.c:mpi_nbits_more_than:
 1040|  13.8M|{
 1041|  13.8M|  unsigned int nbits_nlimbs;
 1042|  13.8M|  mpi_limb_t wlimb;
 1043|  13.8M|  unsigned int n;
 1044|       |
 1045|  13.8M|  nbits_nlimbs = (nbits + BITS_PER_MPI_LIMB - 1) / BITS_PER_MPI_LIMB;
  ------------------
  |  |   49|  13.8M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  13.8M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  13.8M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                nbits_nlimbs = (nbits + BITS_PER_MPI_LIMB - 1) / BITS_PER_MPI_LIMB;
  ------------------
  |  |   49|  13.8M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  13.8M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  13.8M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1046|       |
 1047|       |  /* Note: Assumes that 'w' is normalized. */
 1048|       |
 1049|  13.8M|  if (w->nlimbs > nbits_nlimbs)
  ------------------
  |  Branch (1049:7): [True: 0, False: 13.8M]
  ------------------
 1050|      0|    return 1;
 1051|  13.8M|  if (w->nlimbs < nbits_nlimbs)
  ------------------
  |  Branch (1051:7): [True: 5.60M, False: 8.27M]
  ------------------
 1052|  5.60M|    return 0;
 1053|  8.27M|  if ((nbits % BITS_PER_MPI_LIMB) == 0)
  ------------------
  |  |   49|  8.27M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  8.27M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  8.27M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1053:7): [True: 5.62M, False: 2.65M]
  ------------------
 1054|  5.62M|    return 0;
 1055|       |
 1056|  2.65M|  wlimb = w->d[nbits_nlimbs - 1];
 1057|  2.65M|  if (wlimb == 0)
  ------------------
  |  Branch (1057:7): [True: 0, False: 2.65M]
  ------------------
 1058|      0|    log_bug ("mpi_nbits_more_than: input mpi not normalized\n");
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
 1059|       |
 1060|  2.65M|  count_leading_zeros (n, wlimb);
  ------------------
  |  |  617|  2.65M|  do {                                                                  \
  |  |  618|  2.65M|    UDItype __cbtmp;                                                    \
  |  |  619|  2.65M|    __asm__ ("bsrq %1,%0"                                               \
  |  |  620|  2.65M|             : "=r" (__cbtmp) : "rm" ((UDItype)(x))                     \
  |  |  621|  2.65M|             __CLOBBER_CC);                                             \
  |  |  622|  2.65M|    (count) = __cbtmp ^ 63;                                             \
  |  |  623|  2.65M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (623:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1061|       |
 1062|  2.65M|  return (BITS_PER_MPI_LIMB - n) > (nbits % BITS_PER_MPI_LIMB);
  ------------------
  |  |   49|  2.65M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  2.65M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  2.65M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                return (BITS_PER_MPI_LIMB - n) > (nbits % BITS_PER_MPI_LIMB);
  ------------------
  |  |   49|  2.65M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  2.65M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  2.65M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1063|  2.65M|}
ec-nist.c:LIMB64_HILO:
   59|   123M|{
   60|   123M|  mpi_limb64_t v = hi;
   61|   123M|  return (v << 32) | lo;
   62|   123M|}
ec-nist.c:LOAD32:
   52|   168M|{
   53|   168M|  unsigned int shr = (pos % 2) * 32;
   54|   168M|  return (x[pos / 2] >> shr);
   55|   168M|}

_gcry_mpi_ec_nist256_mod:
  287|  9.24M|{
  288|  9.24M|  static const mpi_limb64_t p_mult[12][5] =
  289|  9.24M|  {
  290|  9.24M|    { /* P * -3 */
  291|  9.24M|      LIMB64_C(0x00000000U, 0x00000003U), LIMB64_C(0xfffffffdU, 0x00000000U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000003U), LIMB64_C(0xfffffffdU, 0x00000000U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  292|  9.24M|      LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0x00000002U, 0xfffffffcU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0x00000002U, 0xfffffffcU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  293|  9.24M|      LIMB64_C(0xffffffffU, 0xfffffffdU)
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  294|  9.24M|    },
  295|  9.24M|    { /* P * -2 */
  296|  9.24M|      LIMB64_C(0x00000000U, 0x00000002U), LIMB64_C(0xfffffffeU, 0x00000000U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000002U), LIMB64_C(0xfffffffeU, 0x00000000U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  297|  9.24M|      LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0x00000001U, 0xfffffffdU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0x00000001U, 0xfffffffdU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  298|  9.24M|      LIMB64_C(0xffffffffU, 0xfffffffeU)
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  299|  9.24M|    },
  300|  9.24M|    { /* P * -1 */
  301|  9.24M|      LIMB64_C(0x00000000U, 0x00000001U), LIMB64_C(0xffffffffU, 0x00000000U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000001U), LIMB64_C(0xffffffffU, 0x00000000U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  302|  9.24M|      LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0x00000000U, 0xfffffffeU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0x00000000U, 0xfffffffeU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  303|  9.24M|      LIMB64_C(0xffffffffU, 0xffffffffU)
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  304|  9.24M|    },
  305|  9.24M|    { /* P * 0 */
  306|  9.24M|      LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0x00000000U, 0x00000000U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0x00000000U, 0x00000000U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  307|  9.24M|      LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0x00000000U, 0x00000000U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0x00000000U, 0x00000000U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  308|  9.24M|      LIMB64_C(0x00000000U, 0x00000000U)
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  309|  9.24M|    },
  310|  9.24M|    { /* P * 1 */
  311|  9.24M|      LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0x00000000U, 0xffffffffU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0x00000000U, 0xffffffffU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  312|  9.24M|      LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0xffffffffU, 0x00000001U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0xffffffffU, 0x00000001U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  313|  9.24M|      LIMB64_C(0x00000000U, 0x00000000U)
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  314|  9.24M|    },
  315|  9.24M|    { /* P * 2 */
  316|  9.24M|      LIMB64_C(0xffffffffU, 0xfffffffeU), LIMB64_C(0x00000001U, 0xffffffffU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xfffffffeU), LIMB64_C(0x00000001U, 0xffffffffU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  317|  9.24M|      LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0xfffffffeU, 0x00000002U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0xfffffffeU, 0x00000002U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  318|  9.24M|      LIMB64_C(0x00000000U, 0x00000001U)
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  319|  9.24M|    },
  320|  9.24M|    { /* P * 3 */
  321|  9.24M|      LIMB64_C(0xffffffffU, 0xfffffffdU), LIMB64_C(0x00000002U, 0xffffffffU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xfffffffdU), LIMB64_C(0x00000002U, 0xffffffffU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  322|  9.24M|      LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0xfffffffdU, 0x00000003U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0xfffffffdU, 0x00000003U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  323|  9.24M|      LIMB64_C(0x00000000U, 0x00000002U)
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  324|  9.24M|    },
  325|  9.24M|    { /* P * 4 */
  326|  9.24M|      LIMB64_C(0xffffffffU, 0xfffffffcU), LIMB64_C(0x00000003U, 0xffffffffU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xfffffffcU), LIMB64_C(0x00000003U, 0xffffffffU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  327|  9.24M|      LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0xfffffffcU, 0x00000004U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0xfffffffcU, 0x00000004U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  328|  9.24M|      LIMB64_C(0x00000000U, 0x00000003U)
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  329|  9.24M|    },
  330|  9.24M|    { /* P * 5 */
  331|  9.24M|      LIMB64_C(0xffffffffU, 0xfffffffbU), LIMB64_C(0x00000004U, 0xffffffffU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xfffffffbU), LIMB64_C(0x00000004U, 0xffffffffU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  332|  9.24M|      LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0xfffffffbU, 0x00000005U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0xfffffffbU, 0x00000005U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  333|  9.24M|      LIMB64_C(0x00000000U, 0x00000004U)
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  334|  9.24M|    },
  335|  9.24M|    { /* P * 6 */
  336|  9.24M|      LIMB64_C(0xffffffffU, 0xfffffffaU), LIMB64_C(0x00000005U, 0xffffffffU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xfffffffaU), LIMB64_C(0x00000005U, 0xffffffffU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  337|  9.24M|      LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0xfffffffaU, 0x00000006U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0xfffffffaU, 0x00000006U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  338|  9.24M|      LIMB64_C(0x00000000U, 0x00000005U)
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  339|  9.24M|    },
  340|  9.24M|    { /* P * 7 */
  341|  9.24M|      LIMB64_C(0xffffffffU, 0xfffffff9U), LIMB64_C(0x00000006U, 0xffffffffU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xfffffff9U), LIMB64_C(0x00000006U, 0xffffffffU),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  342|  9.24M|      LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0xfffffff9U, 0x00000007U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0xfffffff9U, 0x00000007U),
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  343|  9.24M|      LIMB64_C(0x00000000U, 0x00000006U)
  ------------------
  |  |   42|  9.24M|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  344|  9.24M|    }
  345|  9.24M|  };
  346|  9.24M|  const mpi_limb64_t zero = LIMB_TO64(0);
  ------------------
  |  |   37|  9.24M|#define LIMB_TO64(v) ((mpi_limb_t)(v))
  ------------------
  347|  9.24M|  mpi_ptr_t wp;
  348|  9.24M|  mpi_limb64_t s[(256 + BITS_PER_MPI_LIMB64 - 1) / BITS_PER_MPI_LIMB64 + 1];
  349|  9.24M|  mpi_limb64_t t[DIM(s)];
  350|  9.24M|  mpi_limb64_t d[DIM(s)];
  351|  9.24M|  mpi_limb64_t e[DIM(s)];
  352|  9.24M|  const mpi_size_t wsize = DIM(s) - 1;
  ------------------
  |  |  104|  9.24M|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  353|  9.24M|  mpi_size_t psize = ctx->p->nlimbs;
  354|  9.24M|  mpi_limb_t mask1;
  355|  9.24M|  mpi_limb_t mask2;
  356|  9.24M|  mpi_limb_t mask3;
  357|  9.24M|  mpi_limb_t s_is_negative;
  358|  9.24M|  mpi_limb_t d_is_negative;
  359|  9.24M|  int carry;
  360|       |
  361|  9.24M|  MPN_NORMALIZE (w->d, w->nlimbs);
  ------------------
  |  |  119|  9.24M|    do {		       \
  |  |  120|  9.24M|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 9.24M, False: 0]
  |  |  ------------------
  |  |  121|  9.24M|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 9.24M, False: 0]
  |  |  ------------------
  |  |  122|  9.24M|		break;	       \
  |  |  123|  9.24M|	    (n)--;	       \
  |  |  124|      0|	}		       \
  |  |  125|  9.24M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  362|  9.24M|  if (mpi_nbits_more_than (w, 2 * 256))
  ------------------
  |  Branch (362:7): [True: 0, False: 9.24M]
  ------------------
  363|      0|    log_bug ("W must be less than m^2\n");
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  364|       |
  365|  9.24M|  RESIZE_AND_CLEAR_IF_NEEDED (w, wsize * 2 * LIMBS_PER_LIMB64);
  ------------------
  |  |   83|  9.24M|    do {			   \
  |  |   84|  9.24M|	if( (a)->nlimbs < (b) )   \
  |  |  ------------------
  |  |  |  Branch (84:6): [True: 3.73M, False: 5.51M]
  |  |  ------------------
  |  |   85|  9.24M|	    mpi_resize((a), (b));  \
  |  |  ------------------
  |  |  |  |  100|  3.73M|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  |  |  ------------------
  |  |   86|  9.24M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (86:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  366|  9.24M|  RESIZE_AND_CLEAR_IF_NEEDED (ctx->p, wsize * LIMBS_PER_LIMB64);
  ------------------
  |  |   83|  9.24M|    do {			   \
  |  |   84|  9.24M|	if( (a)->nlimbs < (b) )   \
  |  |  ------------------
  |  |  |  Branch (84:6): [True: 0, False: 9.24M]
  |  |  ------------------
  |  |   85|  9.24M|	    mpi_resize((a), (b));  \
  |  |  ------------------
  |  |  |  |  100|      0|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  |  |  ------------------
  |  |   86|  9.24M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (86:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  367|  9.24M|  ctx->p->nlimbs = psize;
  368|       |
  369|  9.24M|  wp = w->d;
  370|       |
  371|  9.24M|  prefetch (p_mult, sizeof(p_mult));
  372|       |
  373|       |  /* See "FIPS 186-4, D.2.3 Curve P-256". */
  374|       |
  375|       |  /* "S1 + S2" with 64-bit limbs:
  376|       |   *     [A15:A14]:[A13:A12]:[A11:0]:[0:0]
  377|       |   *  +    [0:A15]:[A14:A13]:[A12:0]:[0:0]
  378|       |   *  => s[4]:s[3]:s[2]:s[1]:s[0]
  379|       |   */
  380|  9.24M|  s[0] = zero;
  381|  9.24M|  ADD4_LIMB64 (s[4], s[3], s[2], s[1],
  ------------------
  |  |   99|  9.24M|  __asm__ ("addq %11, %3\n" \
  |  |  100|  9.24M|	   "adcq %10, %2\n" \
  |  |  101|  9.24M|	   "adcq %9, %1\n" \
  |  |  102|  9.24M|	   "adcq %8, %0\n" \
  |  |  103|  9.24M|	   : "=r" (A3), \
  |  |  104|  9.24M|	     "=&r" (A2), \
  |  |  105|  9.24M|	     "=&r" (A1), \
  |  |  106|  9.24M|	     "=&r" (A0) \
  |  |  107|  9.24M|	   : "0" ((mpi_limb_t)(B3)), \
  |  |  108|  9.24M|	     "1" ((mpi_limb_t)(B2)), \
  |  |  109|  9.24M|	     "2" ((mpi_limb_t)(B1)), \
  |  |  110|  9.24M|	     "3" ((mpi_limb_t)(B0)), \
  |  |  111|  9.24M|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  112|  9.24M|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  113|  9.24M|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  114|  9.24M|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  115|  9.24M|	   : "cc")
  ------------------
  382|  9.24M|	       zero,
  383|  9.24M|	       LOAD64(wp, 14 / 2),
  384|  9.24M|	       LOAD64(wp, 12 / 2),
  385|  9.24M|	       LIMB64_HILO(LOAD32(wp, 11), 0),
  386|  9.24M|	       zero,
  387|  9.24M|	       LIMB64_HILO(0, LOAD32(wp, 15)),
  388|  9.24M|	       LOAD64_UNALIGNED(wp, 13 / 2),
  389|  9.24M|	       LIMB64_HILO(LOAD32(wp, 12), 0));
  390|       |
  391|       |  /* "S3 + S4" with 64-bit limbs:
  392|       |   *     [A15:A14]:[  0:  0]:[  0:A10]:[ A9:A8]
  393|       |   *  +   [A8:A13]:[A15:A14]:[A13:A11]:[A10:A9]
  394|       |   *  => t[4]:t[3]:t[2]:t[1]:t[0]
  395|       |   */
  396|  9.24M|  ADD5_LIMB64 (t[4], t[3], t[2], t[1], t[0],
  ------------------
  |  |  138|  9.24M|  __asm__ ("addq %14, %4\n" \
  |  |  139|  9.24M|	   "adcq %13, %3\n" \
  |  |  140|  9.24M|	   "adcq %12, %2\n" \
  |  |  141|  9.24M|	   "adcq %11, %1\n" \
  |  |  142|  9.24M|	   "adcq %10, %0\n" \
  |  |  143|  9.24M|	   : "=r" (A4), \
  |  |  144|  9.24M|	     "=&r" (A3), \
  |  |  145|  9.24M|	     "=&r" (A2), \
  |  |  146|  9.24M|	     "=&r" (A1), \
  |  |  147|  9.24M|	     "=&r" (A0) \
  |  |  148|  9.24M|	   : "0" ((mpi_limb_t)(B4)), \
  |  |  149|  9.24M|	     "1" ((mpi_limb_t)(B3)), \
  |  |  150|  9.24M|	     "2" ((mpi_limb_t)(B2)), \
  |  |  151|  9.24M|	     "3" ((mpi_limb_t)(B1)), \
  |  |  152|  9.24M|	     "4" ((mpi_limb_t)(B0)), \
  |  |  153|  9.24M|	     "rme" ((mpi_limb_t)(C4)), \
  |  |  154|  9.24M|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  155|  9.24M|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  156|  9.24M|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  157|  9.24M|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  158|  9.24M|	   : "cc")
  ------------------
  397|  9.24M|	       zero,
  398|  9.24M|	       LOAD64(wp, 14 / 2),
  399|  9.24M|	       zero,
  400|  9.24M|	       LIMB64_HILO(0, LOAD32(wp, 10)),
  401|  9.24M|	       LOAD64(wp, 8 / 2),
  402|  9.24M|	       zero,
  403|  9.24M|	       LIMB64_HILO(LOAD32(wp, 8), LOAD32(wp, 13)),
  404|  9.24M|	       LOAD64(wp, 14 / 2),
  405|  9.24M|	       LIMB64_HILO(LOAD32(wp, 13), LOAD32(wp, 11)),
  406|  9.24M|	       LOAD64_UNALIGNED(wp, 9 / 2));
  407|       |
  408|       |  /* "2*S1 + 2*S2" */
  409|  9.24M|  ADD5_LIMB64 (s[4], s[3], s[2], s[1], s[0],
  ------------------
  |  |  138|  9.24M|  __asm__ ("addq %14, %4\n" \
  |  |  139|  9.24M|	   "adcq %13, %3\n" \
  |  |  140|  9.24M|	   "adcq %12, %2\n" \
  |  |  141|  9.24M|	   "adcq %11, %1\n" \
  |  |  142|  9.24M|	   "adcq %10, %0\n" \
  |  |  143|  9.24M|	   : "=r" (A4), \
  |  |  144|  9.24M|	     "=&r" (A3), \
  |  |  145|  9.24M|	     "=&r" (A2), \
  |  |  146|  9.24M|	     "=&r" (A1), \
  |  |  147|  9.24M|	     "=&r" (A0) \
  |  |  148|  9.24M|	   : "0" ((mpi_limb_t)(B4)), \
  |  |  149|  9.24M|	     "1" ((mpi_limb_t)(B3)), \
  |  |  150|  9.24M|	     "2" ((mpi_limb_t)(B2)), \
  |  |  151|  9.24M|	     "3" ((mpi_limb_t)(B1)), \
  |  |  152|  9.24M|	     "4" ((mpi_limb_t)(B0)), \
  |  |  153|  9.24M|	     "rme" ((mpi_limb_t)(C4)), \
  |  |  154|  9.24M|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  155|  9.24M|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  156|  9.24M|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  157|  9.24M|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  158|  9.24M|	   : "cc")
  ------------------
  410|  9.24M|               s[4], s[3], s[2], s[1], s[0],
  411|  9.24M|               s[4], s[3], s[2], s[1], s[0]);
  412|       |
  413|       |  /* "T + S3 + S4" */
  414|  9.24M|  ADD5_LIMB64 (t[4], t[3], t[2], t[1], t[0],
  ------------------
  |  |  138|  9.24M|  __asm__ ("addq %14, %4\n" \
  |  |  139|  9.24M|	   "adcq %13, %3\n" \
  |  |  140|  9.24M|	   "adcq %12, %2\n" \
  |  |  141|  9.24M|	   "adcq %11, %1\n" \
  |  |  142|  9.24M|	   "adcq %10, %0\n" \
  |  |  143|  9.24M|	   : "=r" (A4), \
  |  |  144|  9.24M|	     "=&r" (A3), \
  |  |  145|  9.24M|	     "=&r" (A2), \
  |  |  146|  9.24M|	     "=&r" (A1), \
  |  |  147|  9.24M|	     "=&r" (A0) \
  |  |  148|  9.24M|	   : "0" ((mpi_limb_t)(B4)), \
  |  |  149|  9.24M|	     "1" ((mpi_limb_t)(B3)), \
  |  |  150|  9.24M|	     "2" ((mpi_limb_t)(B2)), \
  |  |  151|  9.24M|	     "3" ((mpi_limb_t)(B1)), \
  |  |  152|  9.24M|	     "4" ((mpi_limb_t)(B0)), \
  |  |  153|  9.24M|	     "rme" ((mpi_limb_t)(C4)), \
  |  |  154|  9.24M|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  155|  9.24M|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  156|  9.24M|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  157|  9.24M|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  158|  9.24M|	   : "cc")
  ------------------
  415|  9.24M|	       t[4], t[3], t[2], t[1], t[0],
  416|  9.24M|	       zero,
  417|  9.24M|	       LOAD64(wp, 6 / 2),
  418|  9.24M|	       LOAD64(wp, 4 / 2),
  419|  9.24M|	       LOAD64(wp, 2 / 2),
  420|  9.24M|	       LOAD64(wp, 0 / 2));
  421|       |
  422|       |  /* "2*S1 + 2*S2 - D3" with 64-bit limbs:
  423|       |   *    s[4]:    s[3]:    s[2]:    s[1]:     s[0]
  424|       |   *  -       [A12:0]:[A10:A9]:[A8:A15]:[A14:A13]
  425|       |   *  => s[4]:s[3]:s[2]:s[1]:s[0]
  426|       |   */
  427|  9.24M|  SUB5_LIMB64 (s[4], s[3], s[2], s[1], s[0],
  ------------------
  |  |  162|  9.24M|  __asm__ ("subq %14, %4\n" \
  |  |  163|  9.24M|	   "sbbq %13, %3\n" \
  |  |  164|  9.24M|	   "sbbq %12, %2\n" \
  |  |  165|  9.24M|	   "sbbq %11, %1\n" \
  |  |  166|  9.24M|	   "sbbq %10, %0\n" \
  |  |  167|  9.24M|	   : "=r" (A4), \
  |  |  168|  9.24M|	     "=&r" (A3), \
  |  |  169|  9.24M|	     "=&r" (A2), \
  |  |  170|  9.24M|	     "=&r" (A1), \
  |  |  171|  9.24M|	     "=&r" (A0) \
  |  |  172|  9.24M|	   : "0" ((mpi_limb_t)(B4)), \
  |  |  173|  9.24M|	     "1" ((mpi_limb_t)(B3)), \
  |  |  174|  9.24M|	     "2" ((mpi_limb_t)(B2)), \
  |  |  175|  9.24M|	     "3" ((mpi_limb_t)(B1)), \
  |  |  176|  9.24M|	     "4" ((mpi_limb_t)(B0)), \
  |  |  177|  9.24M|	     "rme" ((mpi_limb_t)(C4)), \
  |  |  178|  9.24M|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  179|  9.24M|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  180|  9.24M|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  181|  9.24M|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  182|  9.24M|	   : "cc")
  ------------------
  428|  9.24M|               s[4], s[3], s[2], s[1], s[0],
  429|  9.24M|	       zero,
  430|  9.24M|	       LIMB64_HILO(LOAD32(wp, 12), 0),
  431|  9.24M|	       LOAD64_UNALIGNED(wp, 9 / 2),
  432|  9.24M|	       LIMB64_HILO(LOAD32(wp, 8), LOAD32(wp, 15)),
  433|  9.24M|	       LOAD64_UNALIGNED(wp, 13 / 2));
  434|       |
  435|       |  /* "T + 2*S1 + 2*S2 + S3 + S4 - D3" */
  436|  9.24M|  ADD5_LIMB64 (s[4], s[3], s[2], s[1], s[0],
  ------------------
  |  |  138|  9.24M|  __asm__ ("addq %14, %4\n" \
  |  |  139|  9.24M|	   "adcq %13, %3\n" \
  |  |  140|  9.24M|	   "adcq %12, %2\n" \
  |  |  141|  9.24M|	   "adcq %11, %1\n" \
  |  |  142|  9.24M|	   "adcq %10, %0\n" \
  |  |  143|  9.24M|	   : "=r" (A4), \
  |  |  144|  9.24M|	     "=&r" (A3), \
  |  |  145|  9.24M|	     "=&r" (A2), \
  |  |  146|  9.24M|	     "=&r" (A1), \
  |  |  147|  9.24M|	     "=&r" (A0) \
  |  |  148|  9.24M|	   : "0" ((mpi_limb_t)(B4)), \
  |  |  149|  9.24M|	     "1" ((mpi_limb_t)(B3)), \
  |  |  150|  9.24M|	     "2" ((mpi_limb_t)(B2)), \
  |  |  151|  9.24M|	     "3" ((mpi_limb_t)(B1)), \
  |  |  152|  9.24M|	     "4" ((mpi_limb_t)(B0)), \
  |  |  153|  9.24M|	     "rme" ((mpi_limb_t)(C4)), \
  |  |  154|  9.24M|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  155|  9.24M|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  156|  9.24M|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  157|  9.24M|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  158|  9.24M|	   : "cc")
  ------------------
  437|  9.24M|               s[4], s[3], s[2], s[1], s[0],
  438|  9.24M|               t[4], t[3], t[2], t[1], t[0]);
  439|       |
  440|       |  /* "D1 + D2" with 64-bit limbs:
  441|       |   *     [0:A13]:[A12:A11] + [A15:A14]:[A13:A12] => d[2]:d[1]:d[0]
  442|       |   *     [A10:A8] + [A11:A9] => d[4]:d[3]
  443|       |   */
  444|  9.24M|  ADD3_LIMB64 (d[2], d[1], d[0],
  ------------------
  |  |   69|  9.24M|  __asm__ ("addq %8, %2\n" \
  |  |   70|  9.24M|	   "adcq %7, %1\n" \
  |  |   71|  9.24M|	   "adcq %6, %0\n" \
  |  |   72|  9.24M|	   : "=r" (A2), \
  |  |   73|  9.24M|	     "=&r" (A1), \
  |  |   74|  9.24M|	     "=&r" (A0) \
  |  |   75|  9.24M|	   : "0" ((mpi_limb_t)(B2)), \
  |  |   76|  9.24M|	     "1" ((mpi_limb_t)(B1)), \
  |  |   77|  9.24M|	     "2" ((mpi_limb_t)(B0)), \
  |  |   78|  9.24M|	     "rme" ((mpi_limb_t)(C2)), \
  |  |   79|  9.24M|	     "rme" ((mpi_limb_t)(C1)), \
  |  |   80|  9.24M|	     "rme" ((mpi_limb_t)(C0)) \
  |  |   81|  9.24M|	   : "cc")
  ------------------
  445|  9.24M|	       zero,
  446|  9.24M|	       LIMB64_HILO(0, LOAD32(wp, 13)),
  447|  9.24M|	       LOAD64_UNALIGNED(wp, 11 / 2),
  448|  9.24M|	       zero,
  449|  9.24M|	       LOAD64(wp, 14 / 2),
  450|  9.24M|	       LOAD64(wp, 12 / 2));
  451|  9.24M|  ADD2_LIMB64 (d[4], d[3],
  ------------------
  |  |  556|  9.24M|  add_ssaaaa(A1, A0, B1, B0, C1, C0)
  |  |  ------------------
  |  |  |  |  582|  9.24M|  __asm__ ("addq %5,%1\n"                                               \
  |  |  |  |  583|  9.24M|	   "adcq %3,%0"                                                 \
  |  |  |  |  584|  9.24M|	   : "=r" ((sh)),                                               \
  |  |  |  |  585|  9.24M|	     "=&r" ((sl))                                               \
  |  |  |  |  586|  9.24M|	   : "0" ((UDItype)(ah)),                                       \
  |  |  |  |  587|  9.24M|	     "g"  ((UDItype)(bh)),                                      \
  |  |  |  |  588|  9.24M|	     "1" ((UDItype)(al)),                                       \
  |  |  |  |  589|  9.24M|	     "g"  ((UDItype)(bl))                                       \
  |  |  |  |  590|  9.24M|	   __CLOBBER_CC)
  |  |  ------------------
  ------------------
  452|  9.24M|	       zero, LIMB64_HILO(LOAD32(wp, 10), LOAD32(wp, 8)),
  453|  9.24M|	       zero, LIMB64_HILO(LOAD32(wp, 11), LOAD32(wp, 9)));
  454|       |
  455|       |  /* "D1 + D2 + D4" with 64-bit limbs:
  456|       |   *    d[4]:    d[3]:     d[2]:  d[1]:     d[0]
  457|       |   *  -       [A13:0]:[A11:A10]:[A9:0]:[A15:A14]
  458|       |   *  => d[4]:d[3]:d[2]:d[1]:d[0]
  459|       |   */
  460|  9.24M|  ADD5_LIMB64 (d[4], d[3], d[2], d[1], d[0],
  ------------------
  |  |  138|  9.24M|  __asm__ ("addq %14, %4\n" \
  |  |  139|  9.24M|	   "adcq %13, %3\n" \
  |  |  140|  9.24M|	   "adcq %12, %2\n" \
  |  |  141|  9.24M|	   "adcq %11, %1\n" \
  |  |  142|  9.24M|	   "adcq %10, %0\n" \
  |  |  143|  9.24M|	   : "=r" (A4), \
  |  |  144|  9.24M|	     "=&r" (A3), \
  |  |  145|  9.24M|	     "=&r" (A2), \
  |  |  146|  9.24M|	     "=&r" (A1), \
  |  |  147|  9.24M|	     "=&r" (A0) \
  |  |  148|  9.24M|	   : "0" ((mpi_limb_t)(B4)), \
  |  |  149|  9.24M|	     "1" ((mpi_limb_t)(B3)), \
  |  |  150|  9.24M|	     "2" ((mpi_limb_t)(B2)), \
  |  |  151|  9.24M|	     "3" ((mpi_limb_t)(B1)), \
  |  |  152|  9.24M|	     "4" ((mpi_limb_t)(B0)), \
  |  |  153|  9.24M|	     "rme" ((mpi_limb_t)(C4)), \
  |  |  154|  9.24M|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  155|  9.24M|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  156|  9.24M|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  157|  9.24M|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  158|  9.24M|	   : "cc")
  ------------------
  461|  9.24M|               d[4], d[3], d[2], d[1], d[0],
  462|  9.24M|	       zero,
  463|  9.24M|	       LIMB64_HILO(LOAD32(wp, 13), 0),
  464|  9.24M|	       LOAD64(wp, 10 / 2),
  465|  9.24M|	       LIMB64_HILO(LOAD32(wp, 9), 0),
  466|  9.24M|	       LOAD64(wp, 14 / 2));
  467|       |
  468|       |  /* "T + 2*S1 + 2*S2 + S3 + S4 - D1 - D2 - D3 - D4" */
  469|  9.24M|  SUB5_LIMB64 (s[4], s[3], s[2], s[1], s[0],
  ------------------
  |  |  162|  9.24M|  __asm__ ("subq %14, %4\n" \
  |  |  163|  9.24M|	   "sbbq %13, %3\n" \
  |  |  164|  9.24M|	   "sbbq %12, %2\n" \
  |  |  165|  9.24M|	   "sbbq %11, %1\n" \
  |  |  166|  9.24M|	   "sbbq %10, %0\n" \
  |  |  167|  9.24M|	   : "=r" (A4), \
  |  |  168|  9.24M|	     "=&r" (A3), \
  |  |  169|  9.24M|	     "=&r" (A2), \
  |  |  170|  9.24M|	     "=&r" (A1), \
  |  |  171|  9.24M|	     "=&r" (A0) \
  |  |  172|  9.24M|	   : "0" ((mpi_limb_t)(B4)), \
  |  |  173|  9.24M|	     "1" ((mpi_limb_t)(B3)), \
  |  |  174|  9.24M|	     "2" ((mpi_limb_t)(B2)), \
  |  |  175|  9.24M|	     "3" ((mpi_limb_t)(B1)), \
  |  |  176|  9.24M|	     "4" ((mpi_limb_t)(B0)), \
  |  |  177|  9.24M|	     "rme" ((mpi_limb_t)(C4)), \
  |  |  178|  9.24M|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  179|  9.24M|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  180|  9.24M|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  181|  9.24M|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  182|  9.24M|	   : "cc")
  ------------------
  470|  9.24M|               s[4], s[3], s[2], s[1], s[0],
  471|  9.24M|               d[4], d[3], d[2], d[1], d[0]);
  472|       |
  473|       |  /* mod p:
  474|       |   *  's[4]' holds carry value (-4..6). Subtract (carry + 1) * p. Result
  475|       |   *  will be with in range -2*p...p. Handle result being negative with
  476|       |   *  addition and conditional store. */
  477|       |
  478|  9.24M|  carry = LO32_LIMB64(s[4]);
  ------------------
  |  |   41|  9.24M|#define LO32_LIMB64(v) ((u32)(v))
  ------------------
  479|       |
  480|  9.24M|  SUB5_LIMB64 (s[4], s[3], s[2], s[1], s[0],
  ------------------
  |  |  162|  9.24M|  __asm__ ("subq %14, %4\n" \
  |  |  163|  9.24M|	   "sbbq %13, %3\n" \
  |  |  164|  9.24M|	   "sbbq %12, %2\n" \
  |  |  165|  9.24M|	   "sbbq %11, %1\n" \
  |  |  166|  9.24M|	   "sbbq %10, %0\n" \
  |  |  167|  9.24M|	   : "=r" (A4), \
  |  |  168|  9.24M|	     "=&r" (A3), \
  |  |  169|  9.24M|	     "=&r" (A2), \
  |  |  170|  9.24M|	     "=&r" (A1), \
  |  |  171|  9.24M|	     "=&r" (A0) \
  |  |  172|  9.24M|	   : "0" ((mpi_limb_t)(B4)), \
  |  |  173|  9.24M|	     "1" ((mpi_limb_t)(B3)), \
  |  |  174|  9.24M|	     "2" ((mpi_limb_t)(B2)), \
  |  |  175|  9.24M|	     "3" ((mpi_limb_t)(B1)), \
  |  |  176|  9.24M|	     "4" ((mpi_limb_t)(B0)), \
  |  |  177|  9.24M|	     "rme" ((mpi_limb_t)(C4)), \
  |  |  178|  9.24M|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  179|  9.24M|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  180|  9.24M|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  181|  9.24M|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  182|  9.24M|	   : "cc")
  ------------------
  481|  9.24M|	       s[4], s[3], s[2], s[1], s[0],
  482|  9.24M|	       p_mult[carry + 4][4], p_mult[carry + 4][3],
  483|  9.24M|	       p_mult[carry + 4][2], p_mult[carry + 4][1],
  484|  9.24M|	       p_mult[carry + 4][0]);
  485|       |
  486|       |  /* Add 1*P */
  487|  9.24M|  ADD5_LIMB64 (d[4], d[3], d[2], d[1], d[0],
  ------------------
  |  |  138|  9.24M|  __asm__ ("addq %14, %4\n" \
  |  |  139|  9.24M|	   "adcq %13, %3\n" \
  |  |  140|  9.24M|	   "adcq %12, %2\n" \
  |  |  141|  9.24M|	   "adcq %11, %1\n" \
  |  |  142|  9.24M|	   "adcq %10, %0\n" \
  |  |  143|  9.24M|	   : "=r" (A4), \
  |  |  144|  9.24M|	     "=&r" (A3), \
  |  |  145|  9.24M|	     "=&r" (A2), \
  |  |  146|  9.24M|	     "=&r" (A1), \
  |  |  147|  9.24M|	     "=&r" (A0) \
  |  |  148|  9.24M|	   : "0" ((mpi_limb_t)(B4)), \
  |  |  149|  9.24M|	     "1" ((mpi_limb_t)(B3)), \
  |  |  150|  9.24M|	     "2" ((mpi_limb_t)(B2)), \
  |  |  151|  9.24M|	     "3" ((mpi_limb_t)(B1)), \
  |  |  152|  9.24M|	     "4" ((mpi_limb_t)(B0)), \
  |  |  153|  9.24M|	     "rme" ((mpi_limb_t)(C4)), \
  |  |  154|  9.24M|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  155|  9.24M|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  156|  9.24M|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  157|  9.24M|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  158|  9.24M|	   : "cc")
  ------------------
  488|  9.24M|	       s[4], s[3], s[2], s[1], s[0],
  489|  9.24M|	       zero,
  490|  9.24M|	       p_mult[0 + 4][3], p_mult[0 + 4][2],
  491|  9.24M|	       p_mult[0 + 4][1], p_mult[0 + 4][0]);
  492|       |
  493|       |  /* Add 2*P */
  494|  9.24M|  ADD5_LIMB64 (e[4], e[3], e[2], e[1], e[0],
  ------------------
  |  |  138|  9.24M|  __asm__ ("addq %14, %4\n" \
  |  |  139|  9.24M|	   "adcq %13, %3\n" \
  |  |  140|  9.24M|	   "adcq %12, %2\n" \
  |  |  141|  9.24M|	   "adcq %11, %1\n" \
  |  |  142|  9.24M|	   "adcq %10, %0\n" \
  |  |  143|  9.24M|	   : "=r" (A4), \
  |  |  144|  9.24M|	     "=&r" (A3), \
  |  |  145|  9.24M|	     "=&r" (A2), \
  |  |  146|  9.24M|	     "=&r" (A1), \
  |  |  147|  9.24M|	     "=&r" (A0) \
  |  |  148|  9.24M|	   : "0" ((mpi_limb_t)(B4)), \
  |  |  149|  9.24M|	     "1" ((mpi_limb_t)(B3)), \
  |  |  150|  9.24M|	     "2" ((mpi_limb_t)(B2)), \
  |  |  151|  9.24M|	     "3" ((mpi_limb_t)(B1)), \
  |  |  152|  9.24M|	     "4" ((mpi_limb_t)(B0)), \
  |  |  153|  9.24M|	     "rme" ((mpi_limb_t)(C4)), \
  |  |  154|  9.24M|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  155|  9.24M|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  156|  9.24M|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  157|  9.24M|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  158|  9.24M|	   : "cc")
  ------------------
  495|  9.24M|	       s[4], s[3], s[2], s[1], s[0],
  496|  9.24M|	       zero,
  497|  9.24M|	       p_mult[1 + 4][3], p_mult[1 + 4][2],
  498|  9.24M|	       p_mult[1 + 4][1], p_mult[1 + 4][0]);
  499|       |
  500|  9.24M|  s_is_negative = LO32_LIMB64(s[4]) >> 31;
  ------------------
  |  |   41|  9.24M|#define LO32_LIMB64(v) ((u32)(v))
  ------------------
  501|  9.24M|  d_is_negative = LO32_LIMB64(d[4]) >> 31;
  ------------------
  |  |   41|  9.24M|#define LO32_LIMB64(v) ((u32)(v))
  ------------------
  502|  9.24M|  mask3 = vzero - d_is_negative;
  503|  9.24M|  mask2 = (vzero - s_is_negative) & ~mask3;
  504|  9.24M|  mask1 = (s_is_negative - vone) & ~mask3;
  505|       |
  506|  9.24M|  s[0] = LIMB_OR64(MASK_AND64(mask2, d[0]), MASK_AND64(mask1, s[0]));
  ------------------
  |  |   44|  9.24M|#define LIMB_OR64(val1, val2) ((val1) | (val2))
  ------------------
  507|  9.24M|  s[1] = LIMB_OR64(MASK_AND64(mask2, d[1]), MASK_AND64(mask1, s[1]));
  ------------------
  |  |   44|  9.24M|#define LIMB_OR64(val1, val2) ((val1) | (val2))
  ------------------
  508|  9.24M|  s[2] = LIMB_OR64(MASK_AND64(mask2, d[2]), MASK_AND64(mask1, s[2]));
  ------------------
  |  |   44|  9.24M|#define LIMB_OR64(val1, val2) ((val1) | (val2))
  ------------------
  509|  9.24M|  s[3] = LIMB_OR64(MASK_AND64(mask2, d[3]), MASK_AND64(mask1, s[3]));
  ------------------
  |  |   44|  9.24M|#define LIMB_OR64(val1, val2) ((val1) | (val2))
  ------------------
  510|  9.24M|  s[0] = LIMB_OR64(MASK_AND64(mask3, e[0]), s[0]);
  ------------------
  |  |   44|  9.24M|#define LIMB_OR64(val1, val2) ((val1) | (val2))
  ------------------
  511|  9.24M|  s[1] = LIMB_OR64(MASK_AND64(mask3, e[1]), s[1]);
  ------------------
  |  |   44|  9.24M|#define LIMB_OR64(val1, val2) ((val1) | (val2))
  ------------------
  512|  9.24M|  s[2] = LIMB_OR64(MASK_AND64(mask3, e[2]), s[2]);
  ------------------
  |  |   44|  9.24M|#define LIMB_OR64(val1, val2) ((val1) | (val2))
  ------------------
  513|  9.24M|  s[3] = LIMB_OR64(MASK_AND64(mask3, e[3]), s[3]);
  ------------------
  |  |   44|  9.24M|#define LIMB_OR64(val1, val2) ((val1) | (val2))
  ------------------
  514|       |
  515|  9.24M|  STORE64(wp, 0, s[0]);
  ------------------
  |  |   36|  9.24M|#define STORE64(x, pos, v) ((x)[pos] = (mpi_limb_t)(v))
  ------------------
  516|  9.24M|  STORE64(wp, 1, s[1]);
  ------------------
  |  |   36|  9.24M|#define STORE64(x, pos, v) ((x)[pos] = (mpi_limb_t)(v))
  ------------------
  517|  9.24M|  STORE64(wp, 2, s[2]);
  ------------------
  |  |   36|  9.24M|#define STORE64(x, pos, v) ((x)[pos] = (mpi_limb_t)(v))
  ------------------
  518|  9.24M|  STORE64(wp, 3, s[3]);
  ------------------
  |  |   36|  9.24M|#define STORE64(x, pos, v) ((x)[pos] = (mpi_limb_t)(v))
  ------------------
  519|       |
  520|  9.24M|  w->nlimbs = wsize * LIMBS_PER_LIMB64;
  ------------------
  |  |   34|  9.24M|#define LIMBS_PER_LIMB64 1
  ------------------
  521|  9.24M|  MPN_NORMALIZE (wp, w->nlimbs);
  ------------------
  |  |  119|  9.24M|    do {		       \
  |  |  120|  9.25M|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 9.25M, False: 0]
  |  |  ------------------
  |  |  121|  9.25M|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 9.24M, False: 6.01k]
  |  |  ------------------
  |  |  122|  9.25M|		break;	       \
  |  |  123|  9.25M|	    (n)--;	       \
  |  |  124|  6.01k|	}		       \
  |  |  125|  9.24M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  522|  9.24M|}
_gcry_mpi_ec_nist384_mod:
  526|   183k|{
  527|   183k|  static const mpi_limb64_t p_mult[11][7] =
  528|   183k|  {
  529|   183k|    { /* P * -2 */
  530|   183k|      LIMB64_C(0xfffffffeU, 0x00000002U), LIMB64_C(0x00000001U, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xfffffffeU, 0x00000002U), LIMB64_C(0x00000001U, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  531|   183k|      LIMB64_C(0x00000000U, 0x00000002U), LIMB64_C(0x00000000U, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000002U), LIMB64_C(0x00000000U, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  532|   183k|      LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0x00000000U, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0x00000000U, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  533|   183k|      LIMB64_C(0xffffffffU, 0xfffffffeU)
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  534|   183k|    },
  535|   183k|    { /* P * -1 */
  536|   183k|      LIMB64_C(0xffffffffU, 0x00000001U), LIMB64_C(0x00000000U, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0x00000001U), LIMB64_C(0x00000000U, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  537|   183k|      LIMB64_C(0x00000000U, 0x00000001U), LIMB64_C(0x00000000U, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000001U), LIMB64_C(0x00000000U, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  538|   183k|      LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0x00000000U, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0x00000000U, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  539|   183k|      LIMB64_C(0xffffffffU, 0xffffffffU)
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  540|   183k|    },
  541|   183k|    { /* P * 0 */
  542|   183k|      LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0x00000000U, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0x00000000U, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  543|   183k|      LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0x00000000U, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0x00000000U, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  544|   183k|      LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0x00000000U, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0x00000000U), LIMB64_C(0x00000000U, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  545|   183k|      LIMB64_C(0x00000000U, 0x00000000U)
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  546|   183k|    },
  547|   183k|    { /* P * 1 */
  548|   183k|      LIMB64_C(0x00000000U, 0xffffffffU), LIMB64_C(0xffffffffU, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000000U, 0xffffffffU), LIMB64_C(0xffffffffU, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  549|   183k|      LIMB64_C(0xffffffffU, 0xfffffffeU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xfffffffeU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  550|   183k|      LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  551|   183k|      LIMB64_C(0x00000000U, 0x00000000U)
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  552|   183k|    },
  553|   183k|    { /* P * 2 */
  554|   183k|      LIMB64_C(0x00000001U, 0xfffffffeU), LIMB64_C(0xfffffffeU, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000001U, 0xfffffffeU), LIMB64_C(0xfffffffeU, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  555|   183k|      LIMB64_C(0xffffffffU, 0xfffffffdU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xfffffffdU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  556|   183k|      LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  557|   183k|      LIMB64_C(0x00000000U, 0x00000001U)
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  558|   183k|    },
  559|   183k|    { /* P * 3 */
  560|   183k|      LIMB64_C(0x00000002U, 0xfffffffdU), LIMB64_C(0xfffffffdU, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000002U, 0xfffffffdU), LIMB64_C(0xfffffffdU, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  561|   183k|      LIMB64_C(0xffffffffU, 0xfffffffcU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xfffffffcU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  562|   183k|      LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  563|   183k|      LIMB64_C(0x00000000U, 0x00000002U)
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  564|   183k|    },
  565|   183k|    { /* P * 4 */
  566|   183k|      LIMB64_C(0x00000003U, 0xfffffffcU), LIMB64_C(0xfffffffcU, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000003U, 0xfffffffcU), LIMB64_C(0xfffffffcU, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  567|   183k|      LIMB64_C(0xffffffffU, 0xfffffffbU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xfffffffbU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  568|   183k|      LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  569|   183k|      LIMB64_C(0x00000000U, 0x00000003U)
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  570|   183k|    },
  571|   183k|    { /* P * 5 */
  572|   183k|      LIMB64_C(0x00000004U, 0xfffffffbU), LIMB64_C(0xfffffffbU, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000004U, 0xfffffffbU), LIMB64_C(0xfffffffbU, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  573|   183k|      LIMB64_C(0xffffffffU, 0xfffffffaU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xfffffffaU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  574|   183k|      LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  575|   183k|      LIMB64_C(0x00000000U, 0x00000004U)
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  576|   183k|    },
  577|   183k|    { /* P * 6 */
  578|   183k|      LIMB64_C(0x00000005U, 0xfffffffaU), LIMB64_C(0xfffffffaU, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000005U, 0xfffffffaU), LIMB64_C(0xfffffffaU, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  579|   183k|      LIMB64_C(0xffffffffU, 0xfffffff9U), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xfffffff9U), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  580|   183k|      LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  581|   183k|      LIMB64_C(0x00000000U, 0x00000005U)
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  582|   183k|    },
  583|   183k|    { /* P * 7 */
  584|   183k|      LIMB64_C(0x00000006U, 0xfffffff9U), LIMB64_C(0xfffffff9U, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000006U, 0xfffffff9U), LIMB64_C(0xfffffff9U, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  585|   183k|      LIMB64_C(0xffffffffU, 0xfffffff8U), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xfffffff8U), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  586|   183k|      LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  587|   183k|      LIMB64_C(0x00000000U, 0x00000006U)
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  588|   183k|    },
  589|   183k|    { /* P * 8 */
  590|   183k|      LIMB64_C(0x00000007U, 0xfffffff8U), LIMB64_C(0xfffffff8U, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0x00000007U, 0xfffffff8U), LIMB64_C(0xfffffff8U, 0x00000000U),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  591|   183k|      LIMB64_C(0xffffffffU, 0xfffffff7U), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xfffffff7U), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  592|   183k|      LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
                    LIMB64_C(0xffffffffU, 0xffffffffU), LIMB64_C(0xffffffffU, 0xffffffffU),
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  593|   183k|      LIMB64_C(0x00000000U, 0x00000007U)
  ------------------
  |  |   42|   183k|#define LIMB64_C(hi, lo) (((mpi_limb_t)(u32)(hi) << 32) | (u32)(lo))
  ------------------
  594|   183k|    },
  595|   183k|  };
  596|   183k|  const mpi_limb64_t zero = LIMB_TO64(0);
  ------------------
  |  |   37|   183k|#define LIMB_TO64(v) ((mpi_limb_t)(v))
  ------------------
  597|   183k|  mpi_ptr_t wp;
  598|   183k|  mpi_limb64_t s[(384 + BITS_PER_MPI_LIMB64 - 1) / BITS_PER_MPI_LIMB64 + 1];
  599|   183k|  mpi_limb64_t t[DIM(s)];
  600|   183k|  mpi_limb64_t d[DIM(s)];
  601|   183k|  mpi_limb64_t x[DIM(s)];
  602|       |#if (BITS_PER_MPI_LIMB64 == BITS_PER_MPI_LIMB) && defined(WORDS_BIGENDIAN)
  603|       |  mpi_limb_t wp_shr32[(DIM(s) - 1) * LIMBS_PER_LIMB64];
  604|       |#endif
  605|   183k|  const mpi_size_t wsize = DIM(s) - 1;
  ------------------
  |  |  104|   183k|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  606|   183k|  mpi_size_t psize = ctx->p->nlimbs;
  607|   183k|  mpi_limb_t mask1;
  608|   183k|  mpi_limb_t mask2;
  609|   183k|  mpi_limb_t s_is_negative;
  610|   183k|  int carry;
  611|       |
  612|   183k|  MPN_NORMALIZE (w->d, w->nlimbs);
  ------------------
  |  |  119|   183k|    do {		       \
  |  |  120|   183k|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 183k, False: 0]
  |  |  ------------------
  |  |  121|   183k|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 183k, False: 0]
  |  |  ------------------
  |  |  122|   183k|		break;	       \
  |  |  123|   183k|	    (n)--;	       \
  |  |  124|      0|	}		       \
  |  |  125|   183k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  613|   183k|  if (mpi_nbits_more_than (w, 2 * 384))
  ------------------
  |  Branch (613:7): [True: 0, False: 183k]
  ------------------
  614|      0|    log_bug ("W must be less than m^2\n");
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  615|       |
  616|   183k|  RESIZE_AND_CLEAR_IF_NEEDED (w, wsize * 2 * LIMBS_PER_LIMB64);
  ------------------
  |  |   83|   183k|    do {			   \
  |  |   84|   183k|	if( (a)->nlimbs < (b) )   \
  |  |  ------------------
  |  |  |  Branch (84:6): [True: 74.0k, False: 109k]
  |  |  ------------------
  |  |   85|   183k|	    mpi_resize((a), (b));  \
  |  |  ------------------
  |  |  |  |  100|  74.0k|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  |  |  ------------------
  |  |   86|   183k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (86:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  617|   183k|  RESIZE_AND_CLEAR_IF_NEEDED (ctx->p, wsize * LIMBS_PER_LIMB64);
  ------------------
  |  |   83|   183k|    do {			   \
  |  |   84|   183k|	if( (a)->nlimbs < (b) )   \
  |  |  ------------------
  |  |  |  Branch (84:6): [True: 0, False: 183k]
  |  |  ------------------
  |  |   85|   183k|	    mpi_resize((a), (b));  \
  |  |  ------------------
  |  |  |  |  100|      0|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  |  |  ------------------
  |  |   86|   183k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (86:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  618|   183k|  ctx->p->nlimbs = psize;
  619|       |
  620|   183k|  wp = w->d;
  621|       |
  622|   183k|  prefetch (p_mult, sizeof(p_mult));
  623|       |
  624|       |  /* See "FIPS 186-4, D.2.4 Curve P-384". */
  625|       |
  626|   183k|#if BITS_PER_MPI_LIMB64 == BITS_PER_MPI_LIMB
  627|       |# ifdef WORDS_BIGENDIAN
  628|       |#  define LOAD64_SHR32(idx) LOAD64(wp_shr32, ((idx) / 2 - wsize))
  629|       |  _gcry_mpih_rshift (wp_shr32, wp + 384 / BITS_PER_MPI_LIMB,
  630|       |		     wsize * LIMBS_PER_LIMB64, 32);
  631|       |# else
  632|   183k|# define LOAD64_SHR32(idx) LOAD64_UNALIGNED(wp, idx / 2)
  633|   183k|#endif
  634|       |#else
  635|       |# define LOAD64_SHR32(idx) LIMB64_HILO(LOAD32(wp, (idx) + 1), LOAD32(wp, idx))
  636|       |#endif
  637|       |
  638|       |  /* "S1 + S1" with 64-bit limbs:
  639|       |   *     [0:A23]:[A22:A21]
  640|       |   *  +  [0:A23]:[A22:A21]
  641|       |   *  => s[3]:s[2]
  642|       |   */
  643|   183k|  ADD2_LIMB64 (s[3], s[2],
  ------------------
  |  |  556|   183k|  add_ssaaaa(A1, A0, B1, B0, C1, C0)
  |  |  ------------------
  |  |  |  |  582|   183k|  __asm__ ("addq %5,%1\n"                                               \
  |  |  |  |  583|   183k|	   "adcq %3,%0"                                                 \
  |  |  |  |  584|   183k|	   : "=r" ((sh)),                                               \
  |  |  |  |  585|   183k|	     "=&r" ((sl))                                               \
  |  |  |  |  586|   183k|	   : "0" ((UDItype)(ah)),                                       \
  |  |  |  |  587|   183k|	     "g"  ((UDItype)(bh)),                                      \
  |  |  |  |  588|   183k|	     "1" ((UDItype)(al)),                                       \
  |  |  |  |  589|   183k|	     "g"  ((UDItype)(bl))                                       \
  |  |  |  |  590|   183k|	   __CLOBBER_CC)
  |  |  ------------------
  ------------------
  644|   183k|	       LIMB64_HILO(0, LOAD32(wp, 23)),
  645|   183k|	       LOAD64_SHR32(21),
  646|   183k|	       LIMB64_HILO(0, LOAD32(wp, 23)),
  647|   183k|	       LOAD64_SHR32(21));
  648|       |
  649|       |  /* "S5 + S6" with 64-bit limbs:
  650|       |   *     [A23:A22]:[A21:A20]:[  0:0]:[0:  0]
  651|       |   *  +  [  0:  0]:[A23:A22]:[A21:0]:[0:A20]
  652|       |   *  => x[4]:x[3]:x[2]:x[1]:x[0]
  653|       |   */
  654|   183k|  x[0] = LIMB64_HILO(0, LOAD32(wp, 20));
  655|   183k|  x[1] = LIMB64_HILO(LOAD32(wp, 21), 0);
  656|   183k|  ADD3_LIMB64 (x[4], x[3], x[2],
  ------------------
  |  |   69|   183k|  __asm__ ("addq %8, %2\n" \
  |  |   70|   183k|	   "adcq %7, %1\n" \
  |  |   71|   183k|	   "adcq %6, %0\n" \
  |  |   72|   183k|	   : "=r" (A2), \
  |  |   73|   183k|	     "=&r" (A1), \
  |  |   74|   183k|	     "=&r" (A0) \
  |  |   75|   183k|	   : "0" ((mpi_limb_t)(B2)), \
  |  |   76|   183k|	     "1" ((mpi_limb_t)(B1)), \
  |  |   77|   183k|	     "2" ((mpi_limb_t)(B0)), \
  |  |   78|   183k|	     "rme" ((mpi_limb_t)(C2)), \
  |  |   79|   183k|	     "rme" ((mpi_limb_t)(C1)), \
  |  |   80|   183k|	     "rme" ((mpi_limb_t)(C0)) \
  |  |   81|   183k|	   : "cc")
  ------------------
  657|   183k|	       zero, LOAD64(wp, 22 / 2), LOAD64(wp, 20 / 2),
  658|   183k|	       zero, zero, LOAD64(wp, 22 / 2));
  659|       |
  660|       |  /* "D2 + D3" with 64-bit limbs:
  661|       |   *     [0:A23]:[A22:A21]:[A20:0]
  662|       |   *  +  [0:A23]:[A23:0]:[0:0]
  663|       |   *  => d[2]:d[1]:d[0]
  664|       |   */
  665|   183k|  d[0] = LIMB64_HILO(LOAD32(wp, 20), 0);
  666|   183k|  ADD2_LIMB64 (d[2], d[1],
  ------------------
  |  |  556|   183k|  add_ssaaaa(A1, A0, B1, B0, C1, C0)
  |  |  ------------------
  |  |  |  |  582|   183k|  __asm__ ("addq %5,%1\n"                                               \
  |  |  |  |  583|   183k|	   "adcq %3,%0"                                                 \
  |  |  |  |  584|   183k|	   : "=r" ((sh)),                                               \
  |  |  |  |  585|   183k|	     "=&r" ((sl))                                               \
  |  |  |  |  586|   183k|	   : "0" ((UDItype)(ah)),                                       \
  |  |  |  |  587|   183k|	     "g"  ((UDItype)(bh)),                                      \
  |  |  |  |  588|   183k|	     "1" ((UDItype)(al)),                                       \
  |  |  |  |  589|   183k|	     "g"  ((UDItype)(bl))                                       \
  |  |  |  |  590|   183k|	   __CLOBBER_CC)
  |  |  ------------------
  ------------------
  667|   183k|	       LIMB64_HILO(0, LOAD32(wp, 23)),
  668|   183k|	       LOAD64_SHR32(21),
  669|   183k|	       LIMB64_HILO(0, LOAD32(wp, 23)),
  670|   183k|	       LIMB64_HILO(LOAD32(wp, 23), 0));
  671|       |
  672|       |  /* "2*S1 + S5 + S6" with 64-bit limbs:
  673|       |   *     s[4]:s[3]:s[2]:s[1]:s[0]
  674|       |   *  +  x[4]:x[3]:x[2]:x[1]:x[0]
  675|       |   *  => s[4]:s[3]:s[2]:s[1]:s[0]
  676|       |   */
  677|   183k|  s[0] = x[0];
  678|   183k|  s[1] = x[1];
  679|   183k|  ADD3_LIMB64(s[4], s[3], s[2],
  ------------------
  |  |   69|   183k|  __asm__ ("addq %8, %2\n" \
  |  |   70|   183k|	   "adcq %7, %1\n" \
  |  |   71|   183k|	   "adcq %6, %0\n" \
  |  |   72|   183k|	   : "=r" (A2), \
  |  |   73|   183k|	     "=&r" (A1), \
  |  |   74|   183k|	     "=&r" (A0) \
  |  |   75|   183k|	   : "0" ((mpi_limb_t)(B2)), \
  |  |   76|   183k|	     "1" ((mpi_limb_t)(B1)), \
  |  |   77|   183k|	     "2" ((mpi_limb_t)(B0)), \
  |  |   78|   183k|	     "rme" ((mpi_limb_t)(C2)), \
  |  |   79|   183k|	     "rme" ((mpi_limb_t)(C1)), \
  |  |   80|   183k|	     "rme" ((mpi_limb_t)(C0)) \
  |  |   81|   183k|	   : "cc")
  ------------------
  680|   183k|	      zero, s[3], s[2],
  681|   183k|	      x[4], x[3], x[2]);
  682|       |
  683|       |  /* "T + S2" with 64-bit limbs:
  684|       |   *     [A11:A10]:[ A9: A8]:[ A7: A6]:[ A5: A4]:[ A3: A2]:[ A1: A0]
  685|       |   *  +  [A23:A22]:[A21:A20]:[A19:A18]:[A17:A16]:[A15:A14]:[A13:A12]
  686|       |   *  => t[6]:t[5]:t[4]:t[3]:t[2]:t[1]:t[0]
  687|       |   */
  688|   183k|  ADD7_LIMB64 (t[6], t[5], t[4], t[3], t[2], t[1], t[0],
  ------------------
  |  |  974|   183k|                    C6, C5, C4, C3, C2, C1, C0) do { \
  |  |  975|   183k|    mpi_limb64_t __carry7; \
  |  |  976|   183k|    ADD4_LIMB64(__carry7, A2, A1, A0, zero, B2, B1, B0, \
  |  |  ------------------
  |  |  |  |   99|   183k|  __asm__ ("addq %11, %3\n" \
  |  |  |  |  100|   183k|	   "adcq %10, %2\n" \
  |  |  |  |  101|   183k|	   "adcq %9, %1\n" \
  |  |  |  |  102|   183k|	   "adcq %8, %0\n" \
  |  |  |  |  103|   183k|	   : "=r" (A3), \
  |  |  |  |  104|   183k|	     "=&r" (A2), \
  |  |  |  |  105|   183k|	     "=&r" (A1), \
  |  |  |  |  106|   183k|	     "=&r" (A0) \
  |  |  |  |  107|   183k|	   : "0" ((mpi_limb_t)(B3)), \
  |  |  |  |  108|   183k|	     "1" ((mpi_limb_t)(B2)), \
  |  |  |  |  109|   183k|	     "2" ((mpi_limb_t)(B1)), \
  |  |  |  |  110|   183k|	     "3" ((mpi_limb_t)(B0)), \
  |  |  |  |  111|   183k|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  |  |  112|   183k|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  |  |  113|   183k|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  |  |  114|   183k|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  |  |  115|   183k|	   : "cc")
  |  |  ------------------
  |  |  977|   183k|		zero, C2, C1, C0); \
  |  |  978|   183k|    ADD5_LIMB64(A6, A5, A4, A3, __carry7, B6, B5, B4, B3, \
  |  |  ------------------
  |  |  |  |  138|   183k|  __asm__ ("addq %14, %4\n" \
  |  |  |  |  139|   183k|	   "adcq %13, %3\n" \
  |  |  |  |  140|   183k|	   "adcq %12, %2\n" \
  |  |  |  |  141|   183k|	   "adcq %11, %1\n" \
  |  |  |  |  142|   183k|	   "adcq %10, %0\n" \
  |  |  |  |  143|   183k|	   : "=r" (A4), \
  |  |  |  |  144|   183k|	     "=&r" (A3), \
  |  |  |  |  145|   183k|	     "=&r" (A2), \
  |  |  |  |  146|   183k|	     "=&r" (A1), \
  |  |  |  |  147|   183k|	     "=&r" (A0) \
  |  |  |  |  148|   183k|	   : "0" ((mpi_limb_t)(B4)), \
  |  |  |  |  149|   183k|	     "1" ((mpi_limb_t)(B3)), \
  |  |  |  |  150|   183k|	     "2" ((mpi_limb_t)(B2)), \
  |  |  |  |  151|   183k|	     "3" ((mpi_limb_t)(B1)), \
  |  |  |  |  152|   183k|	     "4" ((mpi_limb_t)(B0)), \
  |  |  |  |  153|   183k|	     "rme" ((mpi_limb_t)(C4)), \
  |  |  |  |  154|   183k|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  |  |  155|   183k|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  |  |  156|   183k|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  |  |  157|   183k|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  |  |  158|   183k|	   : "cc")
  |  |  ------------------
  |  |  979|   183k|		__carry7, C6, C5, C4, C3, LIMB64_HILO(-1, -1)); \
  |  |  980|   183k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (980:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  689|   183k|	       zero,
  690|   183k|	       LOAD64(wp, 10 / 2), LOAD64(wp, 8 / 2), LOAD64(wp, 6 / 2),
  691|   183k|	       LOAD64(wp, 4 / 2), LOAD64(wp, 2 / 2), LOAD64(wp, 0 / 2),
  692|   183k|	       zero,
  693|   183k|	       LOAD64(wp, 22 / 2), LOAD64(wp, 20 / 2), LOAD64(wp, 18 / 2),
  694|   183k|	       LOAD64(wp, 16 / 2), LOAD64(wp, 14 / 2), LOAD64(wp, 12 / 2));
  695|       |
  696|       |  /* "2*S1 + S4 + S5 + S6" with 64-bit limbs:
  697|       |   *     s[6]:     s[5]:     s[4]:     s[3]:     s[2]:   s[1]:   s[0]
  698|       |   *  +       [A19:A18]:[A17:A16]:[A15:A14]:[A13:A12]:[A20:0]:[A23:0]
  699|       |   *  => s[6]:s[5]:s[4]:s[3]:s[2]:s[1]:s[0]
  700|       |   */
  701|   183k|  ADD7_LIMB64 (s[6], s[5], s[4], s[3], s[2], s[1], s[0],
  ------------------
  |  |  974|   183k|                    C6, C5, C4, C3, C2, C1, C0) do { \
  |  |  975|   183k|    mpi_limb64_t __carry7; \
  |  |  976|   183k|    ADD4_LIMB64(__carry7, A2, A1, A0, zero, B2, B1, B0, \
  |  |  ------------------
  |  |  |  |   99|   183k|  __asm__ ("addq %11, %3\n" \
  |  |  |  |  100|   183k|	   "adcq %10, %2\n" \
  |  |  |  |  101|   183k|	   "adcq %9, %1\n" \
  |  |  |  |  102|   183k|	   "adcq %8, %0\n" \
  |  |  |  |  103|   183k|	   : "=r" (A3), \
  |  |  |  |  104|   183k|	     "=&r" (A2), \
  |  |  |  |  105|   183k|	     "=&r" (A1), \
  |  |  |  |  106|   183k|	     "=&r" (A0) \
  |  |  |  |  107|   183k|	   : "0" ((mpi_limb_t)(B3)), \
  |  |  |  |  108|   183k|	     "1" ((mpi_limb_t)(B2)), \
  |  |  |  |  109|   183k|	     "2" ((mpi_limb_t)(B1)), \
  |  |  |  |  110|   183k|	     "3" ((mpi_limb_t)(B0)), \
  |  |  |  |  111|   183k|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  |  |  112|   183k|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  |  |  113|   183k|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  |  |  114|   183k|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  |  |  115|   183k|	   : "cc")
  |  |  ------------------
  |  |  977|   183k|		zero, C2, C1, C0); \
  |  |  978|   183k|    ADD5_LIMB64(A6, A5, A4, A3, __carry7, B6, B5, B4, B3, \
  |  |  ------------------
  |  |  |  |  138|   183k|  __asm__ ("addq %14, %4\n" \
  |  |  |  |  139|   183k|	   "adcq %13, %3\n" \
  |  |  |  |  140|   183k|	   "adcq %12, %2\n" \
  |  |  |  |  141|   183k|	   "adcq %11, %1\n" \
  |  |  |  |  142|   183k|	   "adcq %10, %0\n" \
  |  |  |  |  143|   183k|	   : "=r" (A4), \
  |  |  |  |  144|   183k|	     "=&r" (A3), \
  |  |  |  |  145|   183k|	     "=&r" (A2), \
  |  |  |  |  146|   183k|	     "=&r" (A1), \
  |  |  |  |  147|   183k|	     "=&r" (A0) \
  |  |  |  |  148|   183k|	   : "0" ((mpi_limb_t)(B4)), \
  |  |  |  |  149|   183k|	     "1" ((mpi_limb_t)(B3)), \
  |  |  |  |  150|   183k|	     "2" ((mpi_limb_t)(B2)), \
  |  |  |  |  151|   183k|	     "3" ((mpi_limb_t)(B1)), \
  |  |  |  |  152|   183k|	     "4" ((mpi_limb_t)(B0)), \
  |  |  |  |  153|   183k|	     "rme" ((mpi_limb_t)(C4)), \
  |  |  |  |  154|   183k|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  |  |  155|   183k|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  |  |  156|   183k|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  |  |  157|   183k|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  |  |  158|   183k|	   : "cc")
  |  |  ------------------
  |  |  979|   183k|		__carry7, C6, C5, C4, C3, LIMB64_HILO(-1, -1)); \
  |  |  980|   183k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (980:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  702|   183k|	       zero, zero, s[4], s[3], s[2], s[1], s[0],
  703|   183k|	       zero,
  704|   183k|	       LOAD64(wp, 18 / 2), LOAD64(wp, 16 / 2),
  705|   183k|	       LOAD64(wp, 14 / 2), LOAD64(wp, 12 / 2),
  706|   183k|	       LIMB64_HILO(LOAD32(wp, 20), 0),
  707|   183k|	       LIMB64_HILO(LOAD32(wp, 23), 0));
  708|       |
  709|       |  /* "D1 + D2 + D3" with 64-bit limbs:
  710|       |   *     d[6]:     d[5]:     d[4]:     d[3]:     d[2]:     d[1]:     d[0]
  711|       |   *  +       [A22:A21]:[A20:A19]:[A18:A17]:[A16:A15]:[A14:A13]:[A12:A23]
  712|       |   *  => d[6]:d[5]:d[4]:d[3]:d[2]:d[1]:d[0]
  713|       |   */
  714|   183k|  ADD7_LIMB64 (d[6], d[5], d[4], d[3], d[2], d[1], d[0],
  ------------------
  |  |  974|   183k|                    C6, C5, C4, C3, C2, C1, C0) do { \
  |  |  975|   183k|    mpi_limb64_t __carry7; \
  |  |  976|   183k|    ADD4_LIMB64(__carry7, A2, A1, A0, zero, B2, B1, B0, \
  |  |  ------------------
  |  |  |  |   99|   183k|  __asm__ ("addq %11, %3\n" \
  |  |  |  |  100|   183k|	   "adcq %10, %2\n" \
  |  |  |  |  101|   183k|	   "adcq %9, %1\n" \
  |  |  |  |  102|   183k|	   "adcq %8, %0\n" \
  |  |  |  |  103|   183k|	   : "=r" (A3), \
  |  |  |  |  104|   183k|	     "=&r" (A2), \
  |  |  |  |  105|   183k|	     "=&r" (A1), \
  |  |  |  |  106|   183k|	     "=&r" (A0) \
  |  |  |  |  107|   183k|	   : "0" ((mpi_limb_t)(B3)), \
  |  |  |  |  108|   183k|	     "1" ((mpi_limb_t)(B2)), \
  |  |  |  |  109|   183k|	     "2" ((mpi_limb_t)(B1)), \
  |  |  |  |  110|   183k|	     "3" ((mpi_limb_t)(B0)), \
  |  |  |  |  111|   183k|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  |  |  112|   183k|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  |  |  113|   183k|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  |  |  114|   183k|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  |  |  115|   183k|	   : "cc")
  |  |  ------------------
  |  |  977|   183k|		zero, C2, C1, C0); \
  |  |  978|   183k|    ADD5_LIMB64(A6, A5, A4, A3, __carry7, B6, B5, B4, B3, \
  |  |  ------------------
  |  |  |  |  138|   183k|  __asm__ ("addq %14, %4\n" \
  |  |  |  |  139|   183k|	   "adcq %13, %3\n" \
  |  |  |  |  140|   183k|	   "adcq %12, %2\n" \
  |  |  |  |  141|   183k|	   "adcq %11, %1\n" \
  |  |  |  |  142|   183k|	   "adcq %10, %0\n" \
  |  |  |  |  143|   183k|	   : "=r" (A4), \
  |  |  |  |  144|   183k|	     "=&r" (A3), \
  |  |  |  |  145|   183k|	     "=&r" (A2), \
  |  |  |  |  146|   183k|	     "=&r" (A1), \
  |  |  |  |  147|   183k|	     "=&r" (A0) \
  |  |  |  |  148|   183k|	   : "0" ((mpi_limb_t)(B4)), \
  |  |  |  |  149|   183k|	     "1" ((mpi_limb_t)(B3)), \
  |  |  |  |  150|   183k|	     "2" ((mpi_limb_t)(B2)), \
  |  |  |  |  151|   183k|	     "3" ((mpi_limb_t)(B1)), \
  |  |  |  |  152|   183k|	     "4" ((mpi_limb_t)(B0)), \
  |  |  |  |  153|   183k|	     "rme" ((mpi_limb_t)(C4)), \
  |  |  |  |  154|   183k|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  |  |  155|   183k|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  |  |  156|   183k|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  |  |  157|   183k|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  |  |  158|   183k|	   : "cc")
  |  |  ------------------
  |  |  979|   183k|		__carry7, C6, C5, C4, C3, LIMB64_HILO(-1, -1)); \
  |  |  980|   183k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (980:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  715|   183k|	       zero, zero, zero, zero, d[2], d[1], d[0],
  716|   183k|	       zero,
  717|   183k|	       LOAD64_SHR32(21),
  718|   183k|	       LOAD64_SHR32(19),
  719|   183k|	       LOAD64_SHR32(17),
  720|   183k|	       LOAD64_SHR32(15),
  721|   183k|	       LOAD64_SHR32(13),
  722|   183k|	       LIMB64_HILO(LOAD32(wp, 12), LOAD32(wp, 23)));
  723|       |
  724|       |  /* "2*S1 + S3 + S4 + S5 + S6" with 64-bit limbs:
  725|       |   *     s[6]:     s[5]:     s[4]:     s[3]:     s[2]:     s[1]:     s[0]
  726|       |   *  +       [A20:A19]:[A18:A17]:[A16:A15]:[A14:A13]:[A12:A23]:[A22:A21]
  727|       |   *  => s[6]:s[5]:s[4]:s[3]:s[2]:s[1]:s[0]
  728|       |   */
  729|   183k|  ADD7_LIMB64 (s[6], s[5], s[4], s[3], s[2], s[1], s[0],
  ------------------
  |  |  974|   183k|                    C6, C5, C4, C3, C2, C1, C0) do { \
  |  |  975|   183k|    mpi_limb64_t __carry7; \
  |  |  976|   183k|    ADD4_LIMB64(__carry7, A2, A1, A0, zero, B2, B1, B0, \
  |  |  ------------------
  |  |  |  |   99|   183k|  __asm__ ("addq %11, %3\n" \
  |  |  |  |  100|   183k|	   "adcq %10, %2\n" \
  |  |  |  |  101|   183k|	   "adcq %9, %1\n" \
  |  |  |  |  102|   183k|	   "adcq %8, %0\n" \
  |  |  |  |  103|   183k|	   : "=r" (A3), \
  |  |  |  |  104|   183k|	     "=&r" (A2), \
  |  |  |  |  105|   183k|	     "=&r" (A1), \
  |  |  |  |  106|   183k|	     "=&r" (A0) \
  |  |  |  |  107|   183k|	   : "0" ((mpi_limb_t)(B3)), \
  |  |  |  |  108|   183k|	     "1" ((mpi_limb_t)(B2)), \
  |  |  |  |  109|   183k|	     "2" ((mpi_limb_t)(B1)), \
  |  |  |  |  110|   183k|	     "3" ((mpi_limb_t)(B0)), \
  |  |  |  |  111|   183k|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  |  |  112|   183k|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  |  |  113|   183k|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  |  |  114|   183k|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  |  |  115|   183k|	   : "cc")
  |  |  ------------------
  |  |  977|   183k|		zero, C2, C1, C0); \
  |  |  978|   183k|    ADD5_LIMB64(A6, A5, A4, A3, __carry7, B6, B5, B4, B3, \
  |  |  ------------------
  |  |  |  |  138|   183k|  __asm__ ("addq %14, %4\n" \
  |  |  |  |  139|   183k|	   "adcq %13, %3\n" \
  |  |  |  |  140|   183k|	   "adcq %12, %2\n" \
  |  |  |  |  141|   183k|	   "adcq %11, %1\n" \
  |  |  |  |  142|   183k|	   "adcq %10, %0\n" \
  |  |  |  |  143|   183k|	   : "=r" (A4), \
  |  |  |  |  144|   183k|	     "=&r" (A3), \
  |  |  |  |  145|   183k|	     "=&r" (A2), \
  |  |  |  |  146|   183k|	     "=&r" (A1), \
  |  |  |  |  147|   183k|	     "=&r" (A0) \
  |  |  |  |  148|   183k|	   : "0" ((mpi_limb_t)(B4)), \
  |  |  |  |  149|   183k|	     "1" ((mpi_limb_t)(B3)), \
  |  |  |  |  150|   183k|	     "2" ((mpi_limb_t)(B2)), \
  |  |  |  |  151|   183k|	     "3" ((mpi_limb_t)(B1)), \
  |  |  |  |  152|   183k|	     "4" ((mpi_limb_t)(B0)), \
  |  |  |  |  153|   183k|	     "rme" ((mpi_limb_t)(C4)), \
  |  |  |  |  154|   183k|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  |  |  155|   183k|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  |  |  156|   183k|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  |  |  157|   183k|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  |  |  158|   183k|	   : "cc")
  |  |  ------------------
  |  |  979|   183k|		__carry7, C6, C5, C4, C3, LIMB64_HILO(-1, -1)); \
  |  |  980|   183k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (980:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  730|   183k|	       s[6], s[5], s[4], s[3], s[2], s[1], s[0],
  731|   183k|	       zero,
  732|   183k|	       LOAD64_SHR32(19),
  733|   183k|	       LOAD64_SHR32(17),
  734|   183k|	       LOAD64_SHR32(15),
  735|   183k|	       LOAD64_SHR32(13),
  736|   183k|	       LIMB64_HILO(LOAD32(wp, 12), LOAD32(wp, 23)),
  737|   183k|	       LOAD64_SHR32(21));
  738|       |
  739|       |  /* "T + 2*S1 + S2 + S3 + S4 + S5 + S6" */
  740|   183k|  ADD7_LIMB64 (s[6], s[5], s[4], s[3], s[2], s[1], s[0],
  ------------------
  |  |  974|   183k|                    C6, C5, C4, C3, C2, C1, C0) do { \
  |  |  975|   183k|    mpi_limb64_t __carry7; \
  |  |  976|   183k|    ADD4_LIMB64(__carry7, A2, A1, A0, zero, B2, B1, B0, \
  |  |  ------------------
  |  |  |  |   99|   183k|  __asm__ ("addq %11, %3\n" \
  |  |  |  |  100|   183k|	   "adcq %10, %2\n" \
  |  |  |  |  101|   183k|	   "adcq %9, %1\n" \
  |  |  |  |  102|   183k|	   "adcq %8, %0\n" \
  |  |  |  |  103|   183k|	   : "=r" (A3), \
  |  |  |  |  104|   183k|	     "=&r" (A2), \
  |  |  |  |  105|   183k|	     "=&r" (A1), \
  |  |  |  |  106|   183k|	     "=&r" (A0) \
  |  |  |  |  107|   183k|	   : "0" ((mpi_limb_t)(B3)), \
  |  |  |  |  108|   183k|	     "1" ((mpi_limb_t)(B2)), \
  |  |  |  |  109|   183k|	     "2" ((mpi_limb_t)(B1)), \
  |  |  |  |  110|   183k|	     "3" ((mpi_limb_t)(B0)), \
  |  |  |  |  111|   183k|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  |  |  112|   183k|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  |  |  113|   183k|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  |  |  114|   183k|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  |  |  115|   183k|	   : "cc")
  |  |  ------------------
  |  |  977|   183k|		zero, C2, C1, C0); \
  |  |  978|   183k|    ADD5_LIMB64(A6, A5, A4, A3, __carry7, B6, B5, B4, B3, \
  |  |  ------------------
  |  |  |  |  138|   183k|  __asm__ ("addq %14, %4\n" \
  |  |  |  |  139|   183k|	   "adcq %13, %3\n" \
  |  |  |  |  140|   183k|	   "adcq %12, %2\n" \
  |  |  |  |  141|   183k|	   "adcq %11, %1\n" \
  |  |  |  |  142|   183k|	   "adcq %10, %0\n" \
  |  |  |  |  143|   183k|	   : "=r" (A4), \
  |  |  |  |  144|   183k|	     "=&r" (A3), \
  |  |  |  |  145|   183k|	     "=&r" (A2), \
  |  |  |  |  146|   183k|	     "=&r" (A1), \
  |  |  |  |  147|   183k|	     "=&r" (A0) \
  |  |  |  |  148|   183k|	   : "0" ((mpi_limb_t)(B4)), \
  |  |  |  |  149|   183k|	     "1" ((mpi_limb_t)(B3)), \
  |  |  |  |  150|   183k|	     "2" ((mpi_limb_t)(B2)), \
  |  |  |  |  151|   183k|	     "3" ((mpi_limb_t)(B1)), \
  |  |  |  |  152|   183k|	     "4" ((mpi_limb_t)(B0)), \
  |  |  |  |  153|   183k|	     "rme" ((mpi_limb_t)(C4)), \
  |  |  |  |  154|   183k|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  |  |  155|   183k|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  |  |  156|   183k|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  |  |  157|   183k|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  |  |  158|   183k|	   : "cc")
  |  |  ------------------
  |  |  979|   183k|		__carry7, C6, C5, C4, C3, LIMB64_HILO(-1, -1)); \
  |  |  980|   183k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (980:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  741|   183k|               s[6], s[5], s[4], s[3], s[2], s[1], s[0],
  742|   183k|               t[6], t[5], t[4], t[3], t[2], t[1], t[0]);
  743|       |
  744|       |  /* "T + 2*S1 + S2 + S3 + S4 + S5 + S6 - D1 - D2 - D3" */
  745|   183k|  SUB7_LIMB64 (s[6], s[5], s[4], s[3], s[2], s[1], s[0],
  ------------------
  |  | 1017|   183k|                    C6, C5, C4, C3, C2, C1, C0) do { \
  |  | 1018|   183k|    mpi_limb64_t __borrow7; \
  |  | 1019|   183k|    SUB4_LIMB64(__borrow7, A2, A1, A0, zero, B2, B1, B0, \
  |  |  ------------------
  |  |  |  |  118|   183k|  __asm__ ("subq %11, %3\n" \
  |  |  |  |  119|   183k|	   "sbbq %10, %2\n" \
  |  |  |  |  120|   183k|	   "sbbq %9, %1\n" \
  |  |  |  |  121|   183k|	   "sbbq %8, %0\n" \
  |  |  |  |  122|   183k|	   : "=r" (A3), \
  |  |  |  |  123|   183k|	     "=&r" (A2), \
  |  |  |  |  124|   183k|	     "=&r" (A1), \
  |  |  |  |  125|   183k|	     "=&r" (A0) \
  |  |  |  |  126|   183k|	   : "0" ((mpi_limb_t)(B3)), \
  |  |  |  |  127|   183k|	     "1" ((mpi_limb_t)(B2)), \
  |  |  |  |  128|   183k|	     "2" ((mpi_limb_t)(B1)), \
  |  |  |  |  129|   183k|	     "3" ((mpi_limb_t)(B0)), \
  |  |  |  |  130|   183k|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  |  |  131|   183k|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  |  |  132|   183k|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  |  |  133|   183k|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  |  |  134|   183k|	   : "cc")
  |  |  ------------------
  |  | 1020|   183k|		zero, C2, C1, C0); \
  |  | 1021|   183k|    SUB5_LIMB64(A6, A5, A4, A3, __borrow7, B6, B5, B4, B3, zero, \
  |  |  ------------------
  |  |  |  |  162|   183k|  __asm__ ("subq %14, %4\n" \
  |  |  |  |  163|   183k|	   "sbbq %13, %3\n" \
  |  |  |  |  164|   183k|	   "sbbq %12, %2\n" \
  |  |  |  |  165|   183k|	   "sbbq %11, %1\n" \
  |  |  |  |  166|   183k|	   "sbbq %10, %0\n" \
  |  |  |  |  167|   183k|	   : "=r" (A4), \
  |  |  |  |  168|   183k|	     "=&r" (A3), \
  |  |  |  |  169|   183k|	     "=&r" (A2), \
  |  |  |  |  170|   183k|	     "=&r" (A1), \
  |  |  |  |  171|   183k|	     "=&r" (A0) \
  |  |  |  |  172|   183k|	   : "0" ((mpi_limb_t)(B4)), \
  |  |  |  |  173|   183k|	     "1" ((mpi_limb_t)(B3)), \
  |  |  |  |  174|   183k|	     "2" ((mpi_limb_t)(B2)), \
  |  |  |  |  175|   183k|	     "3" ((mpi_limb_t)(B1)), \
  |  |  |  |  176|   183k|	     "4" ((mpi_limb_t)(B0)), \
  |  |  |  |  177|   183k|	     "rme" ((mpi_limb_t)(C4)), \
  |  |  |  |  178|   183k|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  |  |  179|   183k|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  |  |  180|   183k|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  |  |  181|   183k|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  |  |  182|   183k|	   : "cc")
  |  |  ------------------
  |  | 1022|   183k|		C6, C5, C4, C3, LIMB_TO64(-LIMB_FROM64(__borrow7))); \
  |  | 1023|   183k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (1023:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  746|   183k|               s[6], s[5], s[4], s[3], s[2], s[1], s[0],
  747|   183k|               d[6], d[5], d[4], d[3], d[2], d[1], d[0]);
  748|       |
  749|   183k|#undef LOAD64_SHR32
  750|       |
  751|       |  /* mod p:
  752|       |   *  's[6]' holds carry value (-3..7). Subtract (carry + 1) * p. Result
  753|       |   *  will be with in range -p...p. Handle result being negative with
  754|       |   *  addition and conditional store. */
  755|       |
  756|   183k|  carry = LO32_LIMB64(s[6]);
  ------------------
  |  |   41|   183k|#define LO32_LIMB64(v) ((u32)(v))
  ------------------
  757|       |
  758|   183k|  SUB7_LIMB64 (s[6], s[5], s[4], s[3], s[2], s[1], s[0],
  ------------------
  |  | 1017|   183k|                    C6, C5, C4, C3, C2, C1, C0) do { \
  |  | 1018|   183k|    mpi_limb64_t __borrow7; \
  |  | 1019|   183k|    SUB4_LIMB64(__borrow7, A2, A1, A0, zero, B2, B1, B0, \
  |  |  ------------------
  |  |  |  |  118|   183k|  __asm__ ("subq %11, %3\n" \
  |  |  |  |  119|   183k|	   "sbbq %10, %2\n" \
  |  |  |  |  120|   183k|	   "sbbq %9, %1\n" \
  |  |  |  |  121|   183k|	   "sbbq %8, %0\n" \
  |  |  |  |  122|   183k|	   : "=r" (A3), \
  |  |  |  |  123|   183k|	     "=&r" (A2), \
  |  |  |  |  124|   183k|	     "=&r" (A1), \
  |  |  |  |  125|   183k|	     "=&r" (A0) \
  |  |  |  |  126|   183k|	   : "0" ((mpi_limb_t)(B3)), \
  |  |  |  |  127|   183k|	     "1" ((mpi_limb_t)(B2)), \
  |  |  |  |  128|   183k|	     "2" ((mpi_limb_t)(B1)), \
  |  |  |  |  129|   183k|	     "3" ((mpi_limb_t)(B0)), \
  |  |  |  |  130|   183k|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  |  |  131|   183k|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  |  |  132|   183k|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  |  |  133|   183k|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  |  |  134|   183k|	   : "cc")
  |  |  ------------------
  |  | 1020|   183k|		zero, C2, C1, C0); \
  |  | 1021|   183k|    SUB5_LIMB64(A6, A5, A4, A3, __borrow7, B6, B5, B4, B3, zero, \
  |  |  ------------------
  |  |  |  |  162|   183k|  __asm__ ("subq %14, %4\n" \
  |  |  |  |  163|   183k|	   "sbbq %13, %3\n" \
  |  |  |  |  164|   183k|	   "sbbq %12, %2\n" \
  |  |  |  |  165|   183k|	   "sbbq %11, %1\n" \
  |  |  |  |  166|   183k|	   "sbbq %10, %0\n" \
  |  |  |  |  167|   183k|	   : "=r" (A4), \
  |  |  |  |  168|   183k|	     "=&r" (A3), \
  |  |  |  |  169|   183k|	     "=&r" (A2), \
  |  |  |  |  170|   183k|	     "=&r" (A1), \
  |  |  |  |  171|   183k|	     "=&r" (A0) \
  |  |  |  |  172|   183k|	   : "0" ((mpi_limb_t)(B4)), \
  |  |  |  |  173|   183k|	     "1" ((mpi_limb_t)(B3)), \
  |  |  |  |  174|   183k|	     "2" ((mpi_limb_t)(B2)), \
  |  |  |  |  175|   183k|	     "3" ((mpi_limb_t)(B1)), \
  |  |  |  |  176|   183k|	     "4" ((mpi_limb_t)(B0)), \
  |  |  |  |  177|   183k|	     "rme" ((mpi_limb_t)(C4)), \
  |  |  |  |  178|   183k|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  |  |  179|   183k|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  |  |  180|   183k|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  |  |  181|   183k|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  |  |  182|   183k|	   : "cc")
  |  |  ------------------
  |  | 1022|   183k|		C6, C5, C4, C3, LIMB_TO64(-LIMB_FROM64(__borrow7))); \
  |  | 1023|   183k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (1023:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  759|   183k|	       s[6], s[5], s[4], s[3], s[2], s[1], s[0],
  760|   183k|	       p_mult[carry + 3][6], p_mult[carry + 3][5],
  761|   183k|	       p_mult[carry + 3][4], p_mult[carry + 3][3],
  762|   183k|	       p_mult[carry + 3][2], p_mult[carry + 3][1],
  763|   183k|	       p_mult[carry + 3][0]);
  764|       |
  765|   183k|  ADD7_LIMB64 (d[6], d[5], d[4], d[3], d[2], d[1], d[0],
  ------------------
  |  |  974|   183k|                    C6, C5, C4, C3, C2, C1, C0) do { \
  |  |  975|   183k|    mpi_limb64_t __carry7; \
  |  |  976|   183k|    ADD4_LIMB64(__carry7, A2, A1, A0, zero, B2, B1, B0, \
  |  |  ------------------
  |  |  |  |   99|   183k|  __asm__ ("addq %11, %3\n" \
  |  |  |  |  100|   183k|	   "adcq %10, %2\n" \
  |  |  |  |  101|   183k|	   "adcq %9, %1\n" \
  |  |  |  |  102|   183k|	   "adcq %8, %0\n" \
  |  |  |  |  103|   183k|	   : "=r" (A3), \
  |  |  |  |  104|   183k|	     "=&r" (A2), \
  |  |  |  |  105|   183k|	     "=&r" (A1), \
  |  |  |  |  106|   183k|	     "=&r" (A0) \
  |  |  |  |  107|   183k|	   : "0" ((mpi_limb_t)(B3)), \
  |  |  |  |  108|   183k|	     "1" ((mpi_limb_t)(B2)), \
  |  |  |  |  109|   183k|	     "2" ((mpi_limb_t)(B1)), \
  |  |  |  |  110|   183k|	     "3" ((mpi_limb_t)(B0)), \
  |  |  |  |  111|   183k|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  |  |  112|   183k|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  |  |  113|   183k|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  |  |  114|   183k|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  |  |  115|   183k|	   : "cc")
  |  |  ------------------
  |  |  977|   183k|		zero, C2, C1, C0); \
  |  |  978|   183k|    ADD5_LIMB64(A6, A5, A4, A3, __carry7, B6, B5, B4, B3, \
  |  |  ------------------
  |  |  |  |  138|   183k|  __asm__ ("addq %14, %4\n" \
  |  |  |  |  139|   183k|	   "adcq %13, %3\n" \
  |  |  |  |  140|   183k|	   "adcq %12, %2\n" \
  |  |  |  |  141|   183k|	   "adcq %11, %1\n" \
  |  |  |  |  142|   183k|	   "adcq %10, %0\n" \
  |  |  |  |  143|   183k|	   : "=r" (A4), \
  |  |  |  |  144|   183k|	     "=&r" (A3), \
  |  |  |  |  145|   183k|	     "=&r" (A2), \
  |  |  |  |  146|   183k|	     "=&r" (A1), \
  |  |  |  |  147|   183k|	     "=&r" (A0) \
  |  |  |  |  148|   183k|	   : "0" ((mpi_limb_t)(B4)), \
  |  |  |  |  149|   183k|	     "1" ((mpi_limb_t)(B3)), \
  |  |  |  |  150|   183k|	     "2" ((mpi_limb_t)(B2)), \
  |  |  |  |  151|   183k|	     "3" ((mpi_limb_t)(B1)), \
  |  |  |  |  152|   183k|	     "4" ((mpi_limb_t)(B0)), \
  |  |  |  |  153|   183k|	     "rme" ((mpi_limb_t)(C4)), \
  |  |  |  |  154|   183k|	     "rme" ((mpi_limb_t)(C3)), \
  |  |  |  |  155|   183k|	     "rme" ((mpi_limb_t)(C2)), \
  |  |  |  |  156|   183k|	     "rme" ((mpi_limb_t)(C1)), \
  |  |  |  |  157|   183k|	     "rme" ((mpi_limb_t)(C0)) \
  |  |  |  |  158|   183k|	   : "cc")
  |  |  ------------------
  |  |  979|   183k|		__carry7, C6, C5, C4, C3, LIMB64_HILO(-1, -1)); \
  |  |  980|   183k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (980:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  766|   183k|	       s[6], s[5], s[4], s[3], s[2], s[1], s[0],
  767|   183k|	       zero,
  768|   183k|	       p_mult[0 + 3][5], p_mult[0 + 3][4],
  769|   183k|	       p_mult[0 + 3][3], p_mult[0 + 3][2],
  770|   183k|	       p_mult[0 + 3][1], p_mult[0 + 3][0]);
  771|       |
  772|   183k|  s_is_negative = LO32_LIMB64(s[6]) >> 31;
  ------------------
  |  |   41|   183k|#define LO32_LIMB64(v) ((u32)(v))
  ------------------
  773|   183k|  mask2 = vzero - s_is_negative;
  774|   183k|  mask1 = s_is_negative - vone;
  775|       |
  776|   183k|  STORE64_COND(wp, 0, mask2, d[0], mask1, s[0]);
  ------------------
  |  |   46|   183k|    ((x)[(pos)] = ((mask1) & (val1)) | ((mask2) & (val2)))
  ------------------
  777|   183k|  STORE64_COND(wp, 1, mask2, d[1], mask1, s[1]);
  ------------------
  |  |   46|   183k|    ((x)[(pos)] = ((mask1) & (val1)) | ((mask2) & (val2)))
  ------------------
  778|   183k|  STORE64_COND(wp, 2, mask2, d[2], mask1, s[2]);
  ------------------
  |  |   46|   183k|    ((x)[(pos)] = ((mask1) & (val1)) | ((mask2) & (val2)))
  ------------------
  779|   183k|  STORE64_COND(wp, 3, mask2, d[3], mask1, s[3]);
  ------------------
  |  |   46|   183k|    ((x)[(pos)] = ((mask1) & (val1)) | ((mask2) & (val2)))
  ------------------
  780|   183k|  STORE64_COND(wp, 4, mask2, d[4], mask1, s[4]);
  ------------------
  |  |   46|   183k|    ((x)[(pos)] = ((mask1) & (val1)) | ((mask2) & (val2)))
  ------------------
  781|   183k|  STORE64_COND(wp, 5, mask2, d[5], mask1, s[5]);
  ------------------
  |  |   46|   183k|    ((x)[(pos)] = ((mask1) & (val1)) | ((mask2) & (val2)))
  ------------------
  782|       |
  783|   183k|  w->nlimbs = wsize * LIMBS_PER_LIMB64;
  ------------------
  |  |   34|   183k|#define LIMBS_PER_LIMB64 1
  ------------------
  784|   183k|  MPN_NORMALIZE (wp, w->nlimbs);
  ------------------
  |  |  119|   183k|    do {		       \
  |  |  120|   183k|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 183k, False: 0]
  |  |  ------------------
  |  |  121|   183k|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 183k, False: 130]
  |  |  ------------------
  |  |  122|   183k|		break;	       \
  |  |  123|   183k|	    (n)--;	       \
  |  |  124|    130|	}		       \
  |  |  125|   183k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  785|       |
  786|       |#if (BITS_PER_MPI_LIMB64 == BITS_PER_MPI_LIMB) && defined(WORDS_BIGENDIAN)
  787|       |  wipememory(wp_shr32, sizeof(wp_shr32));
  788|       |#endif
  789|   183k|}
_gcry_mpi_ec_nist521_mod:
  793|  4.45M|{
  794|  4.45M|  mpi_limb_t s[(521 + BITS_PER_MPI_LIMB - 1) / BITS_PER_MPI_LIMB];
  795|  4.45M|  const mpi_size_t wsize = DIM(s);
  ------------------
  |  |  104|  4.45M|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  796|  4.45M|  mpi_limb_t cy;
  797|  4.45M|  mpi_ptr_t wp;
  798|       |
  799|  4.45M|  MPN_NORMALIZE (w->d, w->nlimbs);
  ------------------
  |  |  119|  4.45M|    do {		       \
  |  |  120|  4.45M|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 4.45M, False: 0]
  |  |  ------------------
  |  |  121|  4.45M|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 4.45M, False: 9]
  |  |  ------------------
  |  |  122|  4.45M|		break;	       \
  |  |  123|  4.45M|	    (n)--;	       \
  |  |  124|      9|	}		       \
  |  |  125|  4.45M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  800|  4.45M|  if (mpi_nbits_more_than (w, 2 * 521))
  ------------------
  |  Branch (800:7): [True: 0, False: 4.45M]
  ------------------
  801|      0|    log_bug ("W must be less than m^2\n");
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  802|       |
  803|  4.45M|  RESIZE_AND_CLEAR_IF_NEEDED (w, wsize * 2);
  ------------------
  |  |   83|  4.45M|    do {			   \
  |  |   84|  4.45M|	if( (a)->nlimbs < (b) )   \
  |  |  ------------------
  |  |  |  Branch (84:6): [True: 4.45M, False: 0]
  |  |  ------------------
  |  |   85|  4.45M|	    mpi_resize((a), (b));  \
  |  |  ------------------
  |  |  |  |  100|  4.45M|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  |  |  ------------------
  |  |   86|  4.45M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (86:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  804|       |
  805|  4.45M|  wp = w->d;
  806|       |
  807|       |  /* See "FIPS 186-4, D.2.5 Curve P-521". */
  808|       |
  809|  4.45M|  _gcry_mpih_rshift (s, wp + wsize - 1, wsize, 521 % BITS_PER_MPI_LIMB);
  ------------------
  |  |   49|  4.45M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  4.45M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  4.45M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  810|  4.45M|  s[wsize - 1] &= (1 << (521 % BITS_PER_MPI_LIMB)) - 1;
  ------------------
  |  |   49|  4.45M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  4.45M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  4.45M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  811|  4.45M|  wp[wsize - 1] &= (1 << (521 % BITS_PER_MPI_LIMB)) - 1;
  ------------------
  |  |   49|  4.45M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  4.45M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  4.45M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  812|  4.45M|  _gcry_mpih_add_n (wp, wp, s, wsize);
  813|       |
  814|       |  /* "mod p" */
  815|  4.45M|  cy = _gcry_mpih_sub_n (wp, wp, ctx->p->d, wsize);
  816|  4.45M|  _gcry_mpih_add_n (s, wp, ctx->p->d, wsize);
  817|  4.45M|  mpih_set_cond (wp, s, wsize, (cy != 0UL));
  ------------------
  |  |  263|  4.45M|#define mpih_set_cond(w,u,s,o) _gcry_mpih_set_cond ((w),(u),(s),(o))
  ------------------
  818|       |
  819|  4.45M|  w->nlimbs = wsize;
  820|  4.45M|  MPN_NORMALIZE (wp, w->nlimbs);
  ------------------
  |  |  119|  4.45M|    do {		       \
  |  |  120|  4.46M|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 4.46M, False: 0]
  |  |  ------------------
  |  |  121|  4.46M|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 4.45M, False: 14.0k]
  |  |  ------------------
  |  |  122|  4.46M|		break;	       \
  |  |  123|  4.46M|	    (n)--;	       \
  |  |  124|  14.0k|	}		       \
  |  |  125|  4.45M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  821|  4.45M|}
ec-nist.c:prefetch:
   46|  9.42M|{
   47|  9.42M|  const volatile byte *vtab = tab;
   48|       |
   49|  9.42M|  if (len > 0 * 64)
  ------------------
  |  Branch (49:7): [True: 9.42M, False: 0]
  ------------------
   50|  9.42M|    (void)vtab[0 * 64];
   51|  9.42M|  if (len > 1 * 64)
  ------------------
  |  Branch (51:7): [True: 9.42M, False: 0]
  ------------------
   52|  9.42M|    (void)vtab[1 * 64];
   53|  9.42M|  if (len > 2 * 64)
  ------------------
  |  Branch (53:7): [True: 9.42M, False: 0]
  ------------------
   54|  9.42M|    (void)vtab[2 * 64];
   55|  9.42M|  if (len > 3 * 64)
  ------------------
  |  Branch (55:7): [True: 9.42M, False: 0]
  ------------------
   56|  9.42M|    (void)vtab[3 * 64];
   57|  9.42M|  if (len > 4 * 64)
  ------------------
  |  Branch (57:7): [True: 9.42M, False: 0]
  ------------------
   58|  9.42M|    (void)vtab[4 * 64];
   59|  9.42M|  if (len > 5 * 64)
  ------------------
  |  Branch (59:7): [True: 9.42M, False: 0]
  ------------------
   60|  9.42M|    (void)vtab[5 * 64];
   61|  9.42M|  if (len > 6 * 64)
  ------------------
  |  Branch (61:7): [True: 9.42M, False: 0]
  ------------------
   62|  9.42M|    (void)vtab[6 * 64];
   63|  9.42M|  if (len > 7 * 64)
  ------------------
  |  Branch (63:7): [True: 9.42M, False: 0]
  ------------------
   64|  9.42M|    (void)vtab[7 * 64];
   65|  9.42M|  if (len > 8 * 64)
  ------------------
  |  Branch (65:7): [True: 183k, False: 9.24M]
  ------------------
   66|   183k|    (void)vtab[8 * 64];
   67|  9.42M|  if (len > 9 * 64)
  ------------------
  |  Branch (67:7): [True: 183k, False: 9.24M]
  ------------------
   68|   183k|    (void)vtab[9 * 64];
   69|  9.42M|  if (len > 10 * 64)
  ------------------
  |  Branch (69:7): [True: 0, False: 9.42M]
  ------------------
   70|      0|    (void)vtab[10 * 64];
   71|  9.42M|  (void)vtab[len - 1];
   72|  9.42M|}

_gcry_mpi_point_new:
   89|  14.5k|{
   90|  14.5k|  mpi_point_t p;
   91|       |
   92|  14.5k|  (void)nbits;  /* Currently not used.  */
   93|       |
   94|  14.5k|  p = xmalloc (sizeof *p);
  ------------------
  |  |  144|  14.5k|#define xmalloc(a)       _gcry_xmalloc ((a))
  ------------------
   95|  14.5k|  _gcry_mpi_point_init (p);
   96|  14.5k|  return p;
   97|  14.5k|}
_gcry_mpi_point_release:
  103|  14.5k|{
  104|  14.5k|  if (p)
  ------------------
  |  Branch (104:7): [True: 14.5k, False: 0]
  ------------------
  105|  14.5k|    {
  106|  14.5k|      _gcry_mpi_point_free_parts (p);
  107|  14.5k|      xfree (p);
  ------------------
  |  |  150|  14.5k|#define xfree(a)         _gcry_free ((a))
  ------------------
  108|  14.5k|    }
  109|  14.5k|}
_gcry_mpi_point_init:
  116|  37.2k|{
  117|  37.2k|  p->x = mpi_new (0);
  ------------------
  |  |  491|  37.2k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
  118|  37.2k|  p->y = mpi_new (0);
  ------------------
  |  |  491|  37.2k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
  119|  37.2k|  p->z = mpi_new (0);
  ------------------
  |  |  491|  37.2k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
  120|  37.2k|}
_gcry_mpi_point_free_parts:
  126|  48.4k|{
  127|  48.4k|  mpi_free (p->x); p->x = NULL;
  ------------------
  |  |   99|  48.4k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  128|  48.4k|  mpi_free (p->y); p->y = NULL;
  ------------------
  |  |   99|  48.4k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  129|  48.4k|  mpi_free (p->z); p->z = NULL;
  ------------------
  |  |   99|  48.4k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  130|  48.4k|}
_gcry_mpi_ec_point_resize:
  159|  1.44M|{
  160|  1.44M|  size_t nlimbs = ctx->p->nlimbs;
  161|       |
  162|  1.44M|  mpi_resize (p->x, nlimbs);
  ------------------
  |  |  100|  1.44M|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
  163|  1.44M|  p->x->nlimbs = nlimbs;
  164|  1.44M|  mpi_resize (p->z, nlimbs);
  ------------------
  |  |  100|  1.44M|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
  165|  1.44M|  p->z->nlimbs = nlimbs;
  166|       |
  167|  1.44M|  if (ctx->model != MPI_EC_MONTGOMERY)
  ------------------
  |  Branch (167:7): [True: 1.44M, False: 0]
  ------------------
  168|  1.44M|    {
  169|  1.44M|      mpi_resize (p->y, nlimbs);
  ------------------
  |  |  100|  1.44M|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
  170|  1.44M|      p->y->nlimbs = nlimbs;
  171|  1.44M|    }
  172|  1.44M|}
_gcry_mpi_point_snatch_set:
  251|  7.29k|{
  252|  7.29k|  if (!point)
  ------------------
  |  Branch (252:7): [True: 7.29k, False: 0]
  ------------------
  253|  7.29k|    point = mpi_point_new (0);
  ------------------
  |  |  532|  7.29k|#define mpi_point_new(n)       _gcry_mpi_point_new((n))
  ------------------
  254|       |
  255|  7.29k|  if (x)
  ------------------
  |  Branch (255:7): [True: 7.29k, False: 0]
  ------------------
  256|  7.29k|    mpi_snatch (point->x, x);
  ------------------
  |  |  503|  7.29k|#define mpi_snatch( w, u)      _gcry_mpi_snatch( (w), (u) )
  ------------------
  257|      0|  else
  258|      0|    mpi_clear (point->x);
  ------------------
  |  |  116|      0|#define mpi_clear(a)          _gcry_mpi_clear ((a))
  ------------------
  259|  7.29k|  if (y)
  ------------------
  |  Branch (259:7): [True: 7.29k, False: 0]
  ------------------
  260|  7.29k|    mpi_snatch (point->y, y);
  ------------------
  |  |  503|  7.29k|#define mpi_snatch( w, u)      _gcry_mpi_snatch( (w), (u) )
  ------------------
  261|      0|  else
  262|      0|    mpi_clear (point->y);
  ------------------
  |  |  116|      0|#define mpi_clear(a)          _gcry_mpi_clear ((a))
  ------------------
  263|  7.29k|  if (z)
  ------------------
  |  Branch (263:7): [True: 7.29k, False: 0]
  ------------------
  264|  7.29k|    mpi_snatch (point->z, z);
  ------------------
  |  |  503|  7.29k|#define mpi_snatch( w, u)      _gcry_mpi_snatch( (w), (u) )
  ------------------
  265|      0|  else
  266|      0|    mpi_clear (point->z);
  ------------------
  |  |  116|      0|#define mpi_clear(a)          _gcry_mpi_clear ((a))
  ------------------
  267|       |
  268|  7.29k|  return point;
  269|  7.29k|}
_gcry_mpi_ec_get_reset:
  729|  7.29k|{
  730|  7.29k|  ec->t.valid.a_is_pminus3 = 0;
  731|  7.29k|  ec->t.valid.two_inv_p = 0;
  732|  7.29k|}
_gcry_mpi_ec_p_internal_new:
  996|  7.29k|{
  997|  7.29k|  mpi_ec_t ctx;
  998|       |
  999|  7.29k|  ctx = xcalloc (1, sizeof *ctx);
  ------------------
  |  |  145|  7.29k|#define xcalloc(a,b)     _gcry_xcalloc ((a),(b))
  ------------------
 1000|  7.29k|  ec_p_init (ctx, model, dialect, flags, p, a, b);
 1001|       |
 1002|  7.29k|  return ctx;
 1003|  7.29k|}
_gcry_mpi_ec_free:
 1040|  7.32k|{
 1041|  7.32k|  if (ctx)
  ------------------
  |  Branch (1041:7): [True: 7.29k, False: 28]
  ------------------
 1042|  7.29k|    {
 1043|  7.29k|      ec_deinit (ctx);
 1044|  7.29k|      xfree (ctx);
  ------------------
  |  |  150|  7.29k|#define xfree(a)         _gcry_free ((a))
  ------------------
 1045|  7.29k|    }
 1046|  7.32k|}
_gcry_mpi_ec_decode_point:
 1096|  7.29k|{
 1097|  7.29k|  gpg_err_code_t rc;
 1098|       |
 1099|  7.29k|  if (ec
  ------------------
  |  Branch (1099:7): [True: 7.29k, False: 0]
  ------------------
 1100|  7.29k|      && (ec->dialect == ECC_DIALECT_ED25519
  ------------------
  |  Branch (1100:11): [True: 4.59k, False: 2.70k]
  ------------------
 1101|  7.29k|          || (ec->model == MPI_EC_EDWARDS
  ------------------
  |  Branch (1101:15): [True: 0, False: 2.70k]
  ------------------
 1102|  2.70k|              && ec->dialect == ECC_DIALECT_SAFECURVE)))
  ------------------
  |  Branch (1102:18): [True: 0, False: 0]
  ------------------
 1103|  4.59k|    rc = _gcry_ecc_eddsa_decodepoint (value, ec, result, NULL, NULL);
 1104|  2.70k|  else if (ec && ec->model == MPI_EC_MONTGOMERY)
  ------------------
  |  Branch (1104:12): [True: 2.70k, False: 0]
  |  Branch (1104:18): [True: 0, False: 2.70k]
  ------------------
 1105|      0|    rc = _gcry_ecc_mont_decodepoint (value, ec, result);
 1106|  2.70k|  else
 1107|  2.70k|    rc = _gcry_ecc_sec_decodepoint (value, ec, result);
 1108|       |
 1109|  7.29k|  return rc;
 1110|  7.29k|}
_gcry_mpi_ec_get_affine:
 1120|  18.4k|{
 1121|  18.4k|  if (!mpi_cmp_ui (point->z, 0))
  ------------------
  |  |  512|  18.4k|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
  |  Branch (1121:7): [True: 0, False: 18.4k]
  ------------------
 1122|      0|    return -1;
 1123|       |
 1124|  18.4k|  switch (ctx->model)
 1125|  18.4k|    {
 1126|  4.63k|    case MPI_EC_WEIERSTRASS: /* Using Jacobian coordinates.  */
  ------------------
  |  Branch (1126:5): [True: 4.63k, False: 13.7k]
  ------------------
 1127|  4.63k|      {
 1128|  4.63k|        gcry_mpi_t z1, z2, z3;
 1129|       |
 1130|  4.63k|	if (!mpi_cmp_ui (point->z, 1))
  ------------------
  |  |  512|  4.63k|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
  |  Branch (1130:6): [True: 2.70k, False: 1.93k]
  ------------------
 1131|  2.70k|	  {
 1132|  2.70k|	    if (x)
  ------------------
  |  Branch (1132:10): [True: 2.70k, False: 0]
  ------------------
 1133|  2.70k|	      mpi_set (x, point->x);
  ------------------
  |  |  504|  2.70k|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
 1134|  2.70k|	    if (y)
  ------------------
  |  Branch (1134:10): [True: 2.70k, False: 0]
  ------------------
 1135|  2.70k|	      mpi_set (y, point->y);
  ------------------
  |  |  504|  2.70k|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
 1136|  2.70k|	    return 0;
 1137|  2.70k|	  }
 1138|       |
 1139|  1.93k|        z1 = mpi_new (0);
  ------------------
  |  |  491|  1.93k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
 1140|  1.93k|        z2 = mpi_new (0);
  ------------------
  |  |  491|  1.93k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
 1141|  1.93k|        ec_invm (z1, point->z, ctx);  /* z1 = z^(-1) mod p  */
 1142|  1.93k|        ec_mulm (z2, z1, z1, ctx);    /* z2 = z^(-2) mod p  */
 1143|       |
 1144|  1.93k|        if (x)
  ------------------
  |  Branch (1144:13): [True: 1.93k, False: 0]
  ------------------
 1145|  1.93k|          ec_mulm (x, point->x, z2, ctx);
 1146|       |
 1147|  1.93k|        if (y)
  ------------------
  |  Branch (1147:13): [True: 0, False: 1.93k]
  ------------------
 1148|      0|          {
 1149|      0|            z3 = mpi_new (0);
  ------------------
  |  |  491|      0|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
 1150|      0|            ec_mulm (z3, z2, z1, ctx);      /* z3 = z^(-3) mod p  */
 1151|      0|            ec_mulm (y, point->y, z3, ctx);
 1152|      0|            mpi_free (z3);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
 1153|      0|          }
 1154|       |
 1155|  1.93k|        mpi_free (z2);
  ------------------
  |  |   99|  1.93k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
 1156|  1.93k|        mpi_free (z1);
  ------------------
  |  |   99|  1.93k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
 1157|  1.93k|      }
 1158|      0|      return 0;
 1159|       |
 1160|      0|    case MPI_EC_MONTGOMERY:
  ------------------
  |  Branch (1160:5): [True: 0, False: 18.4k]
  ------------------
 1161|      0|      {
 1162|      0|        if (x)
  ------------------
  |  Branch (1162:13): [True: 0, False: 0]
  ------------------
 1163|      0|          mpi_set (x, point->x);
  ------------------
  |  |  504|      0|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
 1164|       |
 1165|      0|        if (y)
  ------------------
  |  Branch (1165:13): [True: 0, False: 0]
  ------------------
 1166|      0|          {
 1167|      0|            log_fatal ("%s: Getting Y-coordinate on %s is not supported\n",
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
 1168|      0|                       "_gcry_mpi_ec_get_affine", "Montgomery");
 1169|      0|            return -1;
 1170|      0|          }
 1171|      0|      }
 1172|      0|      return 0;
 1173|       |
 1174|  13.7k|    case MPI_EC_EDWARDS:
  ------------------
  |  Branch (1174:5): [True: 13.7k, False: 4.63k]
  ------------------
 1175|  13.7k|      {
 1176|  13.7k|        gcry_mpi_t z;
 1177|       |
 1178|  13.7k|	if (!mpi_cmp_ui (point->z, 1))
  ------------------
  |  |  512|  13.7k|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
  |  Branch (1178:6): [True: 9.18k, False: 4.59k]
  ------------------
 1179|  9.18k|	  {
 1180|  9.18k|	    if (x)
  ------------------
  |  Branch (1180:10): [True: 9.18k, False: 0]
  ------------------
 1181|  9.18k|	      mpi_set (x, point->x);
  ------------------
  |  |  504|  9.18k|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
 1182|  9.18k|	    if (y)
  ------------------
  |  Branch (1182:10): [True: 9.18k, False: 0]
  ------------------
 1183|  9.18k|	      mpi_set (y, point->y);
  ------------------
  |  |  504|  9.18k|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
 1184|  9.18k|	    return 0;
 1185|  9.18k|	  }
 1186|       |
 1187|  4.59k|        z = mpi_new (0);
  ------------------
  |  |  491|  4.59k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
 1188|  4.59k|        ec_invm (z, point->z, ctx);
 1189|       |
 1190|  4.59k|        mpi_resize (z, ctx->p->nlimbs);
  ------------------
  |  |  100|  4.59k|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
 1191|  4.59k|        z->nlimbs = ctx->p->nlimbs;
 1192|       |
 1193|  4.59k|        if (x)
  ------------------
  |  Branch (1193:13): [True: 4.59k, False: 0]
  ------------------
 1194|  4.59k|          {
 1195|  4.59k|            mpi_resize (x, ctx->p->nlimbs);
  ------------------
  |  |  100|  4.59k|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
 1196|  4.59k|            x->nlimbs = ctx->p->nlimbs;
 1197|  4.59k|            ctx->mulm (x, point->x, z, ctx);
 1198|  4.59k|          }
 1199|  4.59k|        if (y)
  ------------------
  |  Branch (1199:13): [True: 4.59k, False: 0]
  ------------------
 1200|  4.59k|          {
 1201|  4.59k|            mpi_resize (y, ctx->p->nlimbs);
  ------------------
  |  |  100|  4.59k|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
 1202|  4.59k|            y->nlimbs = ctx->p->nlimbs;
 1203|  4.59k|            ctx->mulm (y, point->y, z, ctx);
 1204|  4.59k|          }
 1205|       |
 1206|  4.59k|        _gcry_mpi_release (z);
 1207|  4.59k|      }
 1208|      0|      return 0;
 1209|       |
 1210|      0|    default:
  ------------------
  |  Branch (1210:5): [True: 0, False: 18.4k]
  ------------------
 1211|      0|      return -1;
 1212|  18.4k|    }
 1213|  18.4k|}
_gcry_mpi_ec_dup_point:
 1388|  4.56M|{
 1389|  4.56M|  switch (ctx->model)
  ------------------
  |  Branch (1389:11): [True: 0, False: 4.56M]
  ------------------
 1390|  4.56M|    {
 1391|  1.04M|    case MPI_EC_WEIERSTRASS:
  ------------------
  |  Branch (1391:5): [True: 1.04M, False: 3.51M]
  ------------------
 1392|  1.04M|      dup_point_weierstrass (result, point, ctx);
 1393|  1.04M|      break;
 1394|      0|    case MPI_EC_MONTGOMERY:
  ------------------
  |  Branch (1394:5): [True: 0, False: 4.56M]
  ------------------
 1395|      0|      dup_point_montgomery (result, point, ctx);
 1396|      0|      break;
 1397|  3.51M|    case MPI_EC_EDWARDS:
  ------------------
  |  Branch (1397:5): [True: 3.51M, False: 1.04M]
  ------------------
 1398|  3.51M|      dup_point_edwards (result, point, ctx);
 1399|  3.51M|      break;
 1400|  4.56M|    }
 1401|  4.56M|}
_gcry_mpi_ec_add_points:
 1691|  1.76M|{
 1692|  1.76M|  switch (ctx->model)
  ------------------
  |  Branch (1692:11): [True: 0, False: 1.76M]
  ------------------
 1693|  1.76M|    {
 1694|   346k|    case MPI_EC_WEIERSTRASS:
  ------------------
  |  Branch (1694:5): [True: 346k, False: 1.41M]
  ------------------
 1695|   346k|      add_points_weierstrass (result, p1, p2, ctx);
 1696|   346k|      break;
 1697|      0|    case MPI_EC_MONTGOMERY:
  ------------------
  |  Branch (1697:5): [True: 0, False: 1.76M]
  ------------------
 1698|      0|      add_points_montgomery (result, p1, p2, ctx);
 1699|      0|      break;
 1700|  1.41M|    case MPI_EC_EDWARDS:
  ------------------
  |  Branch (1700:5): [True: 1.41M, False: 346k]
  ------------------
 1701|  1.41M|      add_points_edwards (result, p1, p2, ctx);
 1702|  1.41M|      break;
 1703|  1.76M|    }
 1704|  1.76M|}
_gcry_mpi_ec_mul_point:
 1779|  13.0k|{
 1780|  13.0k|  gcry_mpi_t x1, y1, z1, k, h, yy;
 1781|  13.0k|  unsigned int i, loops;
 1782|  13.0k|  mpi_point_struct p1, p2, p1inv;
 1783|       |
 1784|       |  /* First try HW accelerated scalar multiplications.  Error
 1785|       |     is returned if acceleration is not supported or if HW
 1786|       |     does not support acceleration of given input.  */
 1787|  13.0k|  if (mpi_ec_hw_mul_point (result, scalar, point, ctx) >= 0)
  ------------------
  |  |   46|  13.0k|# define mpi_ec_hw_mul_point(r,s,p,c) (-1)
  ------------------
  |  Branch (1787:7): [Folded - Ignored]
  ------------------
 1788|      0|    {
 1789|      0|      return;
 1790|      0|    }
 1791|       |
 1792|  13.0k|  if (ctx->model == MPI_EC_EDWARDS
  ------------------
  |  Branch (1792:7): [True: 9.18k, False: 3.86k]
  ------------------
 1793|  13.0k|      || (ctx->model == MPI_EC_WEIERSTRASS
  ------------------
  |  Branch (1793:11): [True: 3.86k, False: 0]
  ------------------
 1794|  3.86k|          && mpi_is_secure (scalar)))
  ------------------
  |  |  115|  3.86k|#define mpi_is_secure(a)      ((a) && ((a)->flags&1))
  |  |  ------------------
  |  |  |  Branch (115:32): [True: 3.86k, False: 0]
  |  |  |  Branch (115:39): [True: 0, False: 3.86k]
  |  |  ------------------
  ------------------
 1795|  9.18k|    {
 1796|       |      /* Simple left to right binary method.  Algorithm 3.27 from
 1797|       |       * {author={Hankerson, Darrel and Menezes, Alfred J. and Vanstone, Scott},
 1798|       |       *  title = {Guide to Elliptic Curve Cryptography},
 1799|       |       *  year = {2003}, isbn = {038795273X},
 1800|       |       *  url = {http://www.cacr.math.uwaterloo.ca/ecc/},
 1801|       |       *  publisher = {Springer-Verlag New York, Inc.}} */
 1802|  9.18k|      unsigned int nbits;
 1803|  9.18k|      int j;
 1804|       |
 1805|  9.18k|      if (mpi_cmp (scalar, ctx->p) >= 0)
  ------------------
  |  |  510|  9.18k|#define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
  ------------------
  |  Branch (1805:11): [True: 4.91k, False: 4.27k]
  ------------------
 1806|  4.91k|        nbits = mpi_get_nbits (scalar);
  ------------------
  |  |  552|  4.91k|#define mpi_get_nbits(a)       _gcry_mpi_get_nbits ((a))
  ------------------
 1807|  4.27k|      else
 1808|  4.27k|        nbits = mpi_get_nbits (ctx->p);
  ------------------
  |  |  552|  4.27k|#define mpi_get_nbits(a)       _gcry_mpi_get_nbits ((a))
  ------------------
 1809|       |
 1810|  9.18k|      if (ctx->model == MPI_EC_WEIERSTRASS)
  ------------------
  |  Branch (1810:11): [True: 0, False: 9.18k]
  ------------------
 1811|      0|        {
 1812|      0|          mpi_set_ui (result->x, 1);
  ------------------
  |  |  505|      0|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
 1813|      0|          mpi_set_ui (result->y, 1);
  ------------------
  |  |  505|      0|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
 1814|      0|          mpi_set_ui (result->z, 0);
  ------------------
  |  |  505|      0|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
 1815|      0|        }
 1816|  9.18k|      else
 1817|  9.18k|        {
 1818|  9.18k|          mpi_set_ui (result->x, 0);
  ------------------
  |  |  505|  9.18k|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
 1819|  9.18k|          mpi_set_ui (result->y, 1);
  ------------------
  |  |  505|  9.18k|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
 1820|  9.18k|          mpi_set_ui (result->z, 1);
  ------------------
  |  |  505|  9.18k|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
 1821|  9.18k|          mpi_point_resize (point, ctx);
  ------------------
  |  |  550|  9.18k|#define mpi_point_resize(p,ctx) _gcry_mpi_ec_point_resize (p, ctx)
  ------------------
 1822|  9.18k|        }
 1823|       |
 1824|  9.18k|      if (mpi_is_secure (scalar))
  ------------------
  |  |  115|  9.18k|#define mpi_is_secure(a)      ((a) && ((a)->flags&1))
  |  |  ------------------
  |  |  |  Branch (115:32): [True: 9.18k, False: 0]
  |  |  |  Branch (115:39): [True: 0, False: 9.18k]
  |  |  ------------------
  ------------------
 1825|      0|        {
 1826|       |          /* If SCALAR is in secure memory we assume that it is the
 1827|       |             secret key we use constant time operation.  */
 1828|      0|          mpi_point_struct tmppnt;
 1829|       |
 1830|      0|          point_init (&tmppnt);
  ------------------
  |  |   35|      0|#define point_init(a)  _gcry_mpi_point_init ((a))
  ------------------
 1831|      0|          mpi_point_resize (result, ctx);
  ------------------
  |  |  550|      0|#define mpi_point_resize(p,ctx) _gcry_mpi_ec_point_resize (p, ctx)
  ------------------
 1832|      0|          mpi_point_resize (&tmppnt, ctx);
  ------------------
  |  |  550|      0|#define mpi_point_resize(p,ctx) _gcry_mpi_ec_point_resize (p, ctx)
  ------------------
 1833|      0|          for (j=nbits-1; j >= 0; j--)
  ------------------
  |  Branch (1833:27): [True: 0, False: 0]
  ------------------
 1834|      0|            {
 1835|      0|              _gcry_mpi_ec_dup_point (result, result, ctx);
 1836|      0|              _gcry_mpi_ec_add_points (&tmppnt, result, point, ctx);
 1837|      0|              point_swap_cond (result, &tmppnt, mpi_test_bit (scalar, j), ctx);
  ------------------
  |  |  553|      0|#define mpi_test_bit(a,b)      _gcry_mpi_test_bit ((a),(b))
  ------------------
 1838|      0|            }
 1839|      0|          point_free (&tmppnt);
  ------------------
  |  |   36|      0|#define point_free(a)  _gcry_mpi_point_free_parts ((a))
  ------------------
 1840|      0|        }
 1841|  9.18k|      else
 1842|  9.18k|        {
 1843|  9.18k|          if (ctx->model == MPI_EC_EDWARDS)
  ------------------
  |  Branch (1843:15): [True: 9.18k, False: 0]
  ------------------
 1844|  9.18k|            {
 1845|  9.18k|              mpi_point_resize (result, ctx);
  ------------------
  |  |  550|  9.18k|#define mpi_point_resize(p,ctx) _gcry_mpi_ec_point_resize (p, ctx)
  ------------------
 1846|  9.18k|              mpi_point_resize (point, ctx);
  ------------------
  |  |  550|  9.18k|#define mpi_point_resize(p,ctx) _gcry_mpi_ec_point_resize (p, ctx)
  ------------------
 1847|  9.18k|            }
 1848|       |
 1849|  3.52M|          for (j=nbits-1; j >= 0; j--)
  ------------------
  |  Branch (1849:27): [True: 3.51M, False: 9.18k]
  ------------------
 1850|  3.51M|            {
 1851|  3.51M|              _gcry_mpi_ec_dup_point (result, result, ctx);
 1852|  3.51M|              if (mpi_test_bit (scalar, j))
  ------------------
  |  |  553|  3.51M|#define mpi_test_bit(a,b)      _gcry_mpi_test_bit ((a),(b))
  |  |  ------------------
  |  |  |  Branch (553:32): [True: 1.41M, False: 2.10M]
  |  |  ------------------
  ------------------
 1853|  1.41M|                _gcry_mpi_ec_add_points (result, result, point, ctx);
 1854|  3.51M|            }
 1855|  9.18k|        }
 1856|  9.18k|      return;
 1857|  9.18k|    }
 1858|  3.86k|  else if (ctx->model == MPI_EC_MONTGOMERY)
  ------------------
  |  Branch (1858:12): [True: 0, False: 3.86k]
  ------------------
 1859|      0|    {
 1860|      0|      unsigned int nbits;
 1861|      0|      int j;
 1862|      0|      mpi_point_struct p1_, p2_;
 1863|      0|      mpi_point_t q1, q2, prd, sum;
 1864|      0|      unsigned long sw;
 1865|      0|      mpi_size_t rsize;
 1866|      0|      int scalar_copied = 0;
 1867|       |
 1868|       |      /* Compute scalar point multiplication with Montgomery Ladder.
 1869|       |         Note that we don't use Y-coordinate in the points at all.
 1870|       |         RESULT->Y will be filled by zero.  */
 1871|       |
 1872|      0|      nbits = mpi_get_nbits (scalar);
  ------------------
  |  |  552|      0|#define mpi_get_nbits(a)       _gcry_mpi_get_nbits ((a))
  ------------------
 1873|      0|      point_init (&p1);
  ------------------
  |  |   35|      0|#define point_init(a)  _gcry_mpi_point_init ((a))
  ------------------
 1874|      0|      point_init (&p2);
  ------------------
  |  |   35|      0|#define point_init(a)  _gcry_mpi_point_init ((a))
  ------------------
 1875|      0|      point_init (&p1_);
  ------------------
  |  |   35|      0|#define point_init(a)  _gcry_mpi_point_init ((a))
  ------------------
 1876|      0|      point_init (&p2_);
  ------------------
  |  |   35|      0|#define point_init(a)  _gcry_mpi_point_init ((a))
  ------------------
 1877|      0|      mpi_set_ui (p1.x, 1);
  ------------------
  |  |  505|      0|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
 1878|      0|      mpi_free (p2.x);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
 1879|      0|      p2.x  = mpi_copy (point->x);
  ------------------
  |  |  101|      0|# define mpi_copy(a)	       _gcry_mpi_copy((a))
  ------------------
 1880|      0|      mpi_set_ui (p2.z, 1);
  ------------------
  |  |  505|      0|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
 1881|       |
 1882|      0|      if (mpi_is_opaque (scalar))
  ------------------
  |  |  114|      0|#define mpi_is_opaque(a)      ((a) && ((a)->flags&4))
  |  |  ------------------
  |  |  |  Branch (114:32): [True: 0, False: 0]
  |  |  |  Branch (114:39): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1883|      0|        {
 1884|      0|          const unsigned int pbits = ctx->nbits;
 1885|      0|          gcry_mpi_t a;
 1886|      0|          unsigned int n;
 1887|      0|          unsigned char *raw;
 1888|       |
 1889|      0|          scalar_copied = 1;
 1890|       |
 1891|      0|          raw = _gcry_mpi_get_opaque_copy (scalar, &n);
 1892|      0|          if ((n+7)/8 != (pbits+7)/8)
  ------------------
  |  Branch (1892:15): [True: 0, False: 0]
  ------------------
 1893|      0|            log_fatal ("scalar size (%d) != prime size (%d)\n",
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
 1894|      0|                       (n+7)/8, (pbits+7)/8);
 1895|       |
 1896|      0|          reverse_buffer (raw, (n+7)/8);
 1897|      0|          if ((pbits % 8))
  ------------------
  |  Branch (1897:15): [True: 0, False: 0]
  ------------------
 1898|      0|            raw[0] &= (1 << (pbits % 8)) - 1;
 1899|      0|          raw[0] |= (1 << ((pbits + 7) % 8));
 1900|      0|          raw[(pbits+7)/8 - 1] &= (256 - ctx->h);
 1901|      0|          a = mpi_is_secure (scalar) ? mpi_snew (pbits): mpi_new (pbits);
  ------------------
  |  |  115|      0|#define mpi_is_secure(a)      ((a) && ((a)->flags&1))
  |  |  ------------------
  |  |  |  Branch (115:32): [True: 0, False: 0]
  |  |  |  Branch (115:39): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                        a = mpi_is_secure (scalar) ? mpi_snew (pbits): mpi_new (pbits);
  ------------------
  |  |  493|      0|#define mpi_snew(n)            _gcry_mpi_snew ((n))
  ------------------
                        a = mpi_is_secure (scalar) ? mpi_snew (pbits): mpi_new (pbits);
  ------------------
  |  |  491|      0|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
 1902|      0|          _gcry_mpi_set_buffer (a, raw, (n+7)/8, 0);
 1903|      0|          xfree (raw);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1904|       |
 1905|      0|          scalar = a;
 1906|      0|        }
 1907|       |
 1908|      0|      mpi_point_resize (&p1, ctx);
  ------------------
  |  |  550|      0|#define mpi_point_resize(p,ctx) _gcry_mpi_ec_point_resize (p, ctx)
  ------------------
 1909|      0|      mpi_point_resize (&p2, ctx);
  ------------------
  |  |  550|      0|#define mpi_point_resize(p,ctx) _gcry_mpi_ec_point_resize (p, ctx)
  ------------------
 1910|      0|      mpi_point_resize (&p1_, ctx);
  ------------------
  |  |  550|      0|#define mpi_point_resize(p,ctx) _gcry_mpi_ec_point_resize (p, ctx)
  ------------------
 1911|      0|      mpi_point_resize (&p2_, ctx);
  ------------------
  |  |  550|      0|#define mpi_point_resize(p,ctx) _gcry_mpi_ec_point_resize (p, ctx)
  ------------------
 1912|       |
 1913|      0|      mpi_resize (point->x, ctx->p->nlimbs);
  ------------------
  |  |  100|      0|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
 1914|      0|      point->x->nlimbs = ctx->p->nlimbs;
 1915|       |
 1916|      0|      q1 = &p1;
 1917|      0|      q2 = &p2;
 1918|      0|      prd = &p1_;
 1919|      0|      sum = &p2_;
 1920|       |
 1921|      0|      for (j=nbits-1; j >= 0; j--)
  ------------------
  |  Branch (1921:23): [True: 0, False: 0]
  ------------------
 1922|      0|        {
 1923|      0|          mpi_point_t t;
 1924|       |
 1925|      0|          sw = mpi_test_bit (scalar, j);
  ------------------
  |  |  553|      0|#define mpi_test_bit(a,b)      _gcry_mpi_test_bit ((a),(b))
  ------------------
 1926|      0|          point_swap_cond (q1, q2, sw, ctx);
 1927|      0|          montgomery_ladder (prd, sum, q1, q2, point->x, ctx);
 1928|      0|          point_swap_cond (prd, sum, sw, ctx);
 1929|      0|          t = q1;  q1 = prd;  prd = t;
 1930|      0|          t = q2;  q2 = sum;  sum = t;
 1931|      0|        }
 1932|       |
 1933|      0|      mpi_clear (result->y);
  ------------------
  |  |  116|      0|#define mpi_clear(a)          _gcry_mpi_clear ((a))
  ------------------
 1934|      0|      sw = (nbits & 1);
 1935|      0|      point_swap_cond (&p1, &p1_, sw, ctx);
 1936|       |
 1937|      0|      rsize = p1.z->nlimbs;
 1938|      0|      MPN_NORMALIZE (p1.z->d, rsize);
  ------------------
  |  |  119|      0|    do {		       \
  |  |  120|      0|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  121|      0|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 0, False: 0]
  |  |  ------------------
  |  |  122|      0|		break;	       \
  |  |  123|      0|	    (n)--;	       \
  |  |  124|      0|	}		       \
  |  |  125|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1939|      0|      if (rsize == 0)
  ------------------
  |  Branch (1939:11): [True: 0, False: 0]
  ------------------
 1940|      0|        {
 1941|      0|          mpi_set_ui (result->x, 1);
  ------------------
  |  |  505|      0|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
 1942|      0|          mpi_set_ui (result->z, 0);
  ------------------
  |  |  505|      0|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
 1943|      0|        }
 1944|      0|      else
 1945|      0|        {
 1946|      0|          z1 = mpi_new (0);
  ------------------
  |  |  491|      0|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
 1947|      0|          ec_invm (z1, p1.z, ctx);
 1948|      0|          ec_mulm (result->x, p1.x, z1, ctx);
 1949|      0|          mpi_set_ui (result->z, 1);
  ------------------
  |  |  505|      0|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
 1950|      0|          mpi_free (z1);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
 1951|      0|        }
 1952|       |
 1953|      0|      point_free (&p1);
  ------------------
  |  |   36|      0|#define point_free(a)  _gcry_mpi_point_free_parts ((a))
  ------------------
 1954|      0|      point_free (&p2);
  ------------------
  |  |   36|      0|#define point_free(a)  _gcry_mpi_point_free_parts ((a))
  ------------------
 1955|      0|      point_free (&p1_);
  ------------------
  |  |   36|      0|#define point_free(a)  _gcry_mpi_point_free_parts ((a))
  ------------------
 1956|      0|      point_free (&p2_);
  ------------------
  |  |   36|      0|#define point_free(a)  _gcry_mpi_point_free_parts ((a))
  ------------------
 1957|      0|      if (scalar_copied)
  ------------------
  |  Branch (1957:11): [True: 0, False: 0]
  ------------------
 1958|      0|        _gcry_mpi_release (scalar);
 1959|      0|      return;
 1960|      0|    }
 1961|       |
 1962|  3.86k|  x1 = mpi_alloc_like (ctx->p);
  ------------------
  |  |  117|  3.86k|#define mpi_alloc_like(a)     _gcry_mpi_alloc_like((a))
  ------------------
 1963|  3.86k|  y1 = mpi_alloc_like (ctx->p);
  ------------------
  |  |  117|  3.86k|#define mpi_alloc_like(a)     _gcry_mpi_alloc_like((a))
  ------------------
 1964|  3.86k|  h  = mpi_alloc_like (ctx->p);
  ------------------
  |  |  117|  3.86k|#define mpi_alloc_like(a)     _gcry_mpi_alloc_like((a))
  ------------------
 1965|  3.86k|  k  = mpi_copy (scalar);
  ------------------
  |  |  101|  3.86k|# define mpi_copy(a)	       _gcry_mpi_copy((a))
  ------------------
 1966|  3.86k|  yy = mpi_copy (point->y);
  ------------------
  |  |  101|  3.86k|# define mpi_copy(a)	       _gcry_mpi_copy((a))
  ------------------
 1967|       |
 1968|  3.86k|  if ( mpi_has_sign (k) )
  ------------------
  |  |   81|  3.86k|#define mpi_has_sign(a)	      ((a)->sign)
  |  |  ------------------
  |  |  |  Branch (81:31): [True: 0, False: 3.86k]
  |  |  ------------------
  ------------------
 1969|      0|    {
 1970|      0|      k->sign = 0;
 1971|      0|      ec_invm (yy, yy, ctx);
 1972|      0|    }
 1973|       |
 1974|  3.86k|  if (!mpi_cmp_ui (point->z, 1))
  ------------------
  |  |  512|  3.86k|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
  |  Branch (1974:7): [True: 3.86k, False: 0]
  ------------------
 1975|  3.86k|    {
 1976|  3.86k|      mpi_set (x1, point->x);
  ------------------
  |  |  504|  3.86k|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
 1977|  3.86k|      mpi_set (y1, yy);
  ------------------
  |  |  504|  3.86k|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
 1978|  3.86k|    }
 1979|      0|  else
 1980|      0|    {
 1981|      0|      gcry_mpi_t z2, z3;
 1982|       |
 1983|      0|      z2 = mpi_alloc_like (ctx->p);
  ------------------
  |  |  117|      0|#define mpi_alloc_like(a)     _gcry_mpi_alloc_like((a))
  ------------------
 1984|      0|      z3 = mpi_alloc_like (ctx->p);
  ------------------
  |  |  117|      0|#define mpi_alloc_like(a)     _gcry_mpi_alloc_like((a))
  ------------------
 1985|      0|      ec_mulm (z2, point->z, point->z, ctx);
 1986|      0|      ec_mulm (z3, point->z, z2, ctx);
 1987|      0|      ec_invm (z2, z2, ctx);
 1988|      0|      ec_mulm (x1, point->x, z2, ctx);
 1989|      0|      ec_invm (z3, z3, ctx);
 1990|      0|      ec_mulm (y1, yy, z3, ctx);
 1991|      0|      mpi_free (z2);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
 1992|      0|      mpi_free (z3);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
 1993|      0|    }
 1994|  3.86k|  z1 = mpi_copy (mpi_const (MPI_C_ONE));
  ------------------
  |  |  101|  3.86k|# define mpi_copy(a)	       _gcry_mpi_copy((a))
  ------------------
 1995|       |
 1996|  3.86k|  mpi_mul (h, k, mpi_const (MPI_C_THREE)); /* h = 3k */
  ------------------
  |  |  523|  3.86k|#define mpi_mul(w,u,v)         _gcry_mpi_mul ((w),(u),(v))
  ------------------
 1997|  3.86k|  loops = mpi_get_nbits (h);
  ------------------
  |  |  552|  3.86k|#define mpi_get_nbits(a)       _gcry_mpi_get_nbits ((a))
  ------------------
 1998|  3.86k|  if (loops < 2)
  ------------------
  |  Branch (1998:7): [True: 0, False: 3.86k]
  ------------------
 1999|      0|    {
 2000|       |      /* If SCALAR is zero, the above mpi_mul sets H to zero and thus
 2001|       |         LOOPs will be zero.  To avoid an underflow of I in the main
 2002|       |         loop we set LOOP to 2 and the result to (0,0,0).  */
 2003|      0|      loops = 2;
 2004|      0|      mpi_clear (result->x);
  ------------------
  |  |  116|      0|#define mpi_clear(a)          _gcry_mpi_clear ((a))
  ------------------
 2005|      0|      mpi_clear (result->y);
  ------------------
  |  |  116|      0|#define mpi_clear(a)          _gcry_mpi_clear ((a))
  ------------------
 2006|      0|      mpi_clear (result->z);
  ------------------
  |  |  116|      0|#define mpi_clear(a)          _gcry_mpi_clear ((a))
  ------------------
 2007|      0|    }
 2008|  3.86k|  else
 2009|  3.86k|    {
 2010|  3.86k|      mpi_set (result->x, point->x);
  ------------------
  |  |  504|  3.86k|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
 2011|  3.86k|      mpi_set (result->y, yy);
  ------------------
  |  |  504|  3.86k|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
 2012|  3.86k|      mpi_set (result->z, point->z);
  ------------------
  |  |  504|  3.86k|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
 2013|  3.86k|    }
 2014|  3.86k|  mpi_free (yy); yy = NULL;
  ------------------
  |  |   99|  3.86k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
 2015|       |
 2016|  3.86k|  p1.x = x1; x1 = NULL;
 2017|  3.86k|  p1.y = y1; y1 = NULL;
 2018|  3.86k|  p1.z = z1; z1 = NULL;
 2019|  3.86k|  point_init (&p2);
  ------------------
  |  |   35|  3.86k|#define point_init(a)  _gcry_mpi_point_init ((a))
  ------------------
 2020|  3.86k|  point_init (&p1inv);
  ------------------
  |  |   35|  3.86k|#define point_init(a)  _gcry_mpi_point_init ((a))
  ------------------
 2021|       |
 2022|       |  /* Invert point: y = p - y mod p  */
 2023|  3.86k|  point_set (&p1inv, &p1);
 2024|  3.86k|  ec_subm (p1inv.y, ctx->p, p1inv.y, ctx);
 2025|       |
 2026|  1.04M|  for (i=loops-2; i > 0; i--)
  ------------------
  |  Branch (2026:19): [True: 1.04M, False: 3.86k]
  ------------------
 2027|  1.04M|    {
 2028|  1.04M|      _gcry_mpi_ec_dup_point (result, result, ctx);
 2029|  1.04M|      if (mpi_test_bit (h, i) == 1 && mpi_test_bit (k, i) == 0)
  ------------------
  |  |  553|  1.04M|#define mpi_test_bit(a,b)      _gcry_mpi_test_bit ((a),(b))
  ------------------
                    if (mpi_test_bit (h, i) == 1 && mpi_test_bit (k, i) == 0)
  ------------------
  |  |  553|   526k|#define mpi_test_bit(a,b)      _gcry_mpi_test_bit ((a),(b))
  ------------------
  |  Branch (2029:11): [True: 526k, False: 516k]
  |  Branch (2029:39): [True: 169k, False: 356k]
  ------------------
 2030|   169k|        {
 2031|   169k|          point_set (&p2, result);
 2032|   169k|          _gcry_mpi_ec_add_points (result, &p2, &p1, ctx);
 2033|   169k|        }
 2034|  1.04M|      if (mpi_test_bit (h, i) == 0 && mpi_test_bit (k, i) == 1)
  ------------------
  |  |  553|  1.04M|#define mpi_test_bit(a,b)      _gcry_mpi_test_bit ((a),(b))
  ------------------
                    if (mpi_test_bit (h, i) == 0 && mpi_test_bit (k, i) == 1)
  ------------------
  |  |  553|   516k|#define mpi_test_bit(a,b)      _gcry_mpi_test_bit ((a),(b))
  ------------------
  |  Branch (2034:11): [True: 516k, False: 526k]
  |  Branch (2034:39): [True: 174k, False: 342k]
  ------------------
 2035|   174k|        {
 2036|   174k|          point_set (&p2, result);
 2037|   174k|          _gcry_mpi_ec_add_points (result, &p2, &p1inv, ctx);
 2038|   174k|        }
 2039|  1.04M|    }
 2040|       |
 2041|  3.86k|  point_free (&p1);
  ------------------
  |  |   36|  3.86k|#define point_free(a)  _gcry_mpi_point_free_parts ((a))
  ------------------
 2042|  3.86k|  point_free (&p2);
  ------------------
  |  |   36|  3.86k|#define point_free(a)  _gcry_mpi_point_free_parts ((a))
  ------------------
 2043|  3.86k|  point_free (&p1inv);
  ------------------
  |  |   36|  3.86k|#define point_free(a)  _gcry_mpi_point_free_parts ((a))
  ------------------
 2044|  3.86k|  mpi_free (h);
  ------------------
  |  |   99|  3.86k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
 2045|  3.86k|  mpi_free (k);
  ------------------
  |  |   99|  3.86k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
 2046|  3.86k|}
_gcry_mpi_ec_curve_point:
 2052|  7.29k|{
 2053|  7.29k|  int res = 0;
 2054|  7.29k|  gcry_mpi_t x, y, w;
 2055|       |
 2056|  7.29k|  x = mpi_new (0);
  ------------------
  |  |  491|  7.29k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
 2057|  7.29k|  y = mpi_new (0);
  ------------------
  |  |  491|  7.29k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
 2058|  7.29k|  w = mpi_new (0);
  ------------------
  |  |  491|  7.29k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
 2059|       |
 2060|       |  /* Check that the point is in range.  This needs to be done here and
 2061|       |   * not after conversion to affine coordinates.  */
 2062|  7.29k|  if (mpi_cmpabs (point->x, ctx->p) >= 0)
  ------------------
  |  |  511|  7.29k|#define mpi_cmpabs( u, v )     _gcry_mpi_cmpabs( (u), (v) )
  ------------------
  |  Branch (2062:7): [True: 0, False: 7.29k]
  ------------------
 2063|      0|    goto leave;
 2064|  7.29k|  if (mpi_cmpabs (point->y, ctx->p) >= 0)
  ------------------
  |  |  511|  7.29k|#define mpi_cmpabs( u, v )     _gcry_mpi_cmpabs( (u), (v) )
  ------------------
  |  Branch (2064:7): [True: 0, False: 7.29k]
  ------------------
 2065|      0|    goto leave;
 2066|  7.29k|  if (mpi_cmpabs (point->z, ctx->p) >= 0)
  ------------------
  |  |  511|  7.29k|#define mpi_cmpabs( u, v )     _gcry_mpi_cmpabs( (u), (v) )
  ------------------
  |  Branch (2066:7): [True: 0, False: 7.29k]
  ------------------
 2067|      0|    goto leave;
 2068|       |
 2069|  7.29k|  switch (ctx->model)
  ------------------
  |  Branch (2069:11): [True: 0, False: 7.29k]
  ------------------
 2070|  7.29k|    {
 2071|  2.70k|    case MPI_EC_WEIERSTRASS:
  ------------------
  |  Branch (2071:5): [True: 2.70k, False: 4.59k]
  ------------------
 2072|  2.70k|      {
 2073|  2.70k|        gcry_mpi_t xxx;
 2074|       |
 2075|  2.70k|        if (_gcry_mpi_ec_get_affine (x, y, point, ctx))
  ------------------
  |  Branch (2075:13): [True: 0, False: 2.70k]
  ------------------
 2076|      0|          goto leave;
 2077|       |
 2078|  2.70k|        xxx = mpi_new (0);
  ------------------
  |  |  491|  2.70k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
 2079|       |
 2080|       |        /* y^2 == x^3 + a·x + b */
 2081|  2.70k|        ec_pow2 (y, y, ctx);
 2082|       |
 2083|  2.70k|        ec_pow3 (xxx, x, ctx);
 2084|  2.70k|        ec_mulm (w, ctx->a, x, ctx);
 2085|  2.70k|        ec_addm (w, w, ctx->b, ctx);
 2086|  2.70k|        ec_addm (w, w, xxx, ctx);
 2087|       |
 2088|  2.70k|        if (!mpi_cmp (y, w))
  ------------------
  |  |  510|  2.70k|#define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
  ------------------
  |  Branch (2088:13): [True: 2.70k, False: 0]
  ------------------
 2089|  2.70k|          res = 1;
 2090|       |
 2091|  2.70k|        _gcry_mpi_release (xxx);
 2092|  2.70k|      }
 2093|      0|      break;
 2094|      0|    case MPI_EC_MONTGOMERY:
  ------------------
  |  Branch (2094:5): [True: 0, False: 7.29k]
  ------------------
 2095|      0|      {
 2096|      0|#define xx y
 2097|       |        /* With Montgomery curve, only X-coordinate is valid.  */
 2098|      0|        if (_gcry_mpi_ec_get_affine (x, NULL, point, ctx))
  ------------------
  |  Branch (2098:13): [True: 0, False: 0]
  ------------------
 2099|      0|          goto leave;
 2100|       |
 2101|       |        /* The equation is: b * y^2 == x^3 + a · x^2 + x */
 2102|       |        /* We check if right hand is quadratic residue or not by
 2103|       |           Euler's criterion.  */
 2104|       |        /* CTX->A has (a-2)/4 and CTX->B has b^-1 */
 2105|      0|        ec_mulm (w, ctx->a, mpi_const (MPI_C_FOUR), ctx);
  ------------------
  |  |  120|      0|#define mpi_const(n)          _gcry_mpi_const ((n))
  ------------------
 2106|      0|        ec_addm (w, w, mpi_const (MPI_C_TWO), ctx);
  ------------------
  |  |  120|      0|#define mpi_const(n)          _gcry_mpi_const ((n))
  ------------------
 2107|      0|        ec_mulm (w, w, x, ctx);
 2108|      0|        ec_pow2 (xx, x, ctx);
  ------------------
  |  | 2096|      0|#define xx y
  ------------------
 2109|      0|        ec_addm (w, w, xx, ctx);
  ------------------
  |  | 2096|      0|#define xx y
  ------------------
 2110|      0|        ec_addm (w, w, mpi_const (MPI_C_ONE), ctx);
  ------------------
  |  |  120|      0|#define mpi_const(n)          _gcry_mpi_const ((n))
  ------------------
 2111|      0|        ec_mulm (w, w, x, ctx);
 2112|      0|        ec_mulm (w, w, ctx->b, ctx);
 2113|      0|#undef xx
 2114|       |        /* Compute Euler's criterion: w^(p-1)/2 */
 2115|      0|#define p_minus1 y
 2116|      0|        ec_subm (p_minus1, ctx->p, mpi_const (MPI_C_ONE), ctx);
  ------------------
  |  | 2115|      0|#define p_minus1 y
  ------------------
                      ec_subm (p_minus1, ctx->p, mpi_const (MPI_C_ONE), ctx);
  ------------------
  |  |  120|      0|#define mpi_const(n)          _gcry_mpi_const ((n))
  ------------------
 2117|      0|        mpi_rshift (p_minus1, p_minus1, 1);
  ------------------
  |  |  558|      0|#define mpi_rshift(a,b,c)      _gcry_mpi_rshift ((a),(b),(c))
  ------------------
 2118|      0|        ec_powm (w, w, p_minus1, ctx);
  ------------------
  |  | 2115|      0|#define p_minus1 y
  ------------------
 2119|       |
 2120|      0|        res = !mpi_cmp_ui (w, 1);
  ------------------
  |  |  512|      0|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
 2121|      0|#undef p_minus1
 2122|      0|      }
 2123|      0|      break;
 2124|  4.59k|    case MPI_EC_EDWARDS:
  ------------------
  |  Branch (2124:5): [True: 4.59k, False: 2.70k]
  ------------------
 2125|  4.59k|      {
 2126|  4.59k|        if (_gcry_mpi_ec_get_affine (x, y, point, ctx))
  ------------------
  |  Branch (2126:13): [True: 0, False: 4.59k]
  ------------------
 2127|      0|          goto leave;
 2128|       |
 2129|  4.59k|        mpi_resize (w, ctx->p->nlimbs);
  ------------------
  |  |  100|  4.59k|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
 2130|  4.59k|        w->nlimbs = ctx->p->nlimbs;
 2131|       |
 2132|       |        /* a · x^2 + y^2 - 1 - b · x^2 · y^2 == 0 */
 2133|  4.59k|        ctx->pow2 (x, x, ctx);
 2134|  4.59k|        ctx->pow2 (y, y, ctx);
 2135|  4.59k|        if (ctx->dialect == ECC_DIALECT_ED25519)
  ------------------
  |  Branch (2135:13): [True: 4.59k, False: 0]
  ------------------
 2136|  4.59k|          ctx->subm (w, ctx->p, x, ctx);
 2137|      0|        else
 2138|      0|          ctx->mulm (w, ctx->a, x, ctx);
 2139|  4.59k|        ctx->addm (w, w, y, ctx);
 2140|  4.59k|        ctx->mulm (x, x, y, ctx);
 2141|  4.59k|        ctx->mulm (x, x, ctx->b, ctx);
 2142|  4.59k|        ctx->subm (w, w, x, ctx);
 2143|  4.59k|        if (!mpi_cmp_ui (w, 1))
  ------------------
  |  |  512|  4.59k|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
  |  Branch (2143:13): [True: 4.59k, False: 0]
  ------------------
 2144|  4.59k|          res = 1;
 2145|  4.59k|      }
 2146|      0|      break;
 2147|  7.29k|    }
 2148|       |
 2149|  7.29k| leave:
 2150|  7.29k|  _gcry_mpi_release (w);
 2151|  7.29k|  _gcry_mpi_release (x);
 2152|  7.29k|  _gcry_mpi_release (y);
 2153|       |
 2154|  7.29k|  return res;
 2155|  7.29k|}
ec.c:point_set:
  136|   348k|{
  137|   348k|  mpi_set (d->x, s->x);
  ------------------
  |  |  504|   348k|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
  138|   348k|  mpi_set (d->y, s->y);
  ------------------
  |  |  504|   348k|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
  139|   348k|  mpi_set (d->z, s->z);
  ------------------
  |  |  504|   348k|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
  140|   348k|}
ec.c:ec_p_init:
  821|  7.29k|{
  822|  7.29k|  int i;
  823|  7.29k|  static int use_barrett;
  824|       |
  825|  7.29k|  if (!use_barrett)
  ------------------
  |  Branch (825:7): [True: 1, False: 7.29k]
  ------------------
  826|      1|    {
  827|      1|      if (getenv ("GCRYPT_BARRETT"))
  ------------------
  |  Branch (827:11): [True: 0, False: 1]
  ------------------
  828|      0|        use_barrett = 1;
  829|      1|      else
  830|      1|        use_barrett = -1;
  831|      1|    }
  832|       |
  833|       |  /* Fixme: Do we want to check some constraints? e.g.  a < p  */
  834|       |
  835|  7.29k|  ctx->model = model;
  836|  7.29k|  ctx->dialect = dialect;
  837|  7.29k|  ctx->flags = flags;
  838|  7.29k|  ctx->nbits = mpi_get_nbits (p);
  ------------------
  |  |  552|  7.29k|#define mpi_get_nbits(a)       _gcry_mpi_get_nbits ((a))
  ------------------
  839|  7.29k|  ctx->p = mpi_copy (p);
  ------------------
  |  |  101|  7.29k|# define mpi_copy(a)	       _gcry_mpi_copy((a))
  ------------------
  840|  7.29k|  ctx->a = mpi_copy (a);
  ------------------
  |  |  101|  7.29k|# define mpi_copy(a)	       _gcry_mpi_copy((a))
  ------------------
  841|  7.29k|  ctx->b = mpi_copy (b);
  ------------------
  |  |  101|  7.29k|# define mpi_copy(a)	       _gcry_mpi_copy((a))
  ------------------
  842|       |
  843|  7.29k|  ctx->t.p_barrett = use_barrett > 0? _gcry_mpi_barrett_init (ctx->p, 0):NULL;
  ------------------
  |  Branch (843:22): [True: 0, False: 7.29k]
  ------------------
  844|       |
  845|  7.29k|  _gcry_mpi_ec_get_reset (ctx);
  846|       |
  847|  7.29k|  if (model == MPI_EC_MONTGOMERY)
  ------------------
  |  Branch (847:7): [True: 0, False: 7.29k]
  ------------------
  848|      0|    {
  849|      0|      for (i=0; i< DIM(bad_points_table); i++)
  ------------------
  |  |  104|      0|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (849:17): [True: 0, False: 0]
  ------------------
  850|      0|        {
  851|      0|          gcry_mpi_t p_candidate = scanval (bad_points_table[i][0]);
  852|      0|          int match_p = !mpi_cmp (ctx->p, p_candidate);
  ------------------
  |  |  510|      0|#define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
  ------------------
  853|      0|          int j;
  854|       |
  855|      0|          mpi_free (p_candidate);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  856|      0|          if (!match_p)
  ------------------
  |  Branch (856:15): [True: 0, False: 0]
  ------------------
  857|      0|            continue;
  858|       |
  859|      0|          for (j=0; i< DIM(ctx->t.scratch) && bad_points_table[i][j]; j++)
  ------------------
  |  |  104|      0|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (859:21): [True: 0, False: 0]
  |  Branch (859:47): [True: 0, False: 0]
  ------------------
  860|      0|            ctx->t.scratch[j] = scanval (bad_points_table[i][j]);
  861|      0|        }
  862|      0|    }
  863|  7.29k|  else
  864|  7.29k|    {
  865|       |      /* Allocate scratch variables.  */
  866|  87.5k|      for (i=0; i< DIM(ctx->t.scratch); i++)
  ------------------
  |  |  104|  87.5k|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (866:17): [True: 80.2k, False: 7.29k]
  ------------------
  867|  80.2k|        ctx->t.scratch[i] = mpi_alloc_like (ctx->p);
  ------------------
  |  |  117|  80.2k|#define mpi_alloc_like(a)     _gcry_mpi_alloc_like((a))
  ------------------
  868|  7.29k|    }
  869|       |
  870|  7.29k|  ctx->addm = ec_addm;
  871|  7.29k|  ctx->subm = ec_subm;
  872|  7.29k|  ctx->mulm = ec_mulm;
  873|  7.29k|  ctx->mul2 = ec_mul2;
  874|  7.29k|  ctx->pow2 = ec_pow2;
  875|  7.29k|  ctx->mod = ec_mod;
  876|       |
  877|  20.9k|  for (i=0; field_table[i].p; i++)
  ------------------
  |  Branch (877:13): [True: 20.9k, False: 15]
  ------------------
  878|  20.9k|    {
  879|  20.9k|      gcry_mpi_t f_p;
  880|  20.9k|      gpg_err_code_t rc;
  881|       |
  882|  20.9k|      if (field_table_mpis[i] == NULL)
  ------------------
  |  Branch (882:11): [True: 8, False: 20.9k]
  ------------------
  883|      8|	{
  884|      8|	  rc = _gcry_mpi_scan (&f_p, GCRYMPI_FMT_HEX, field_table[i].p, 0,
  885|      8|			       NULL);
  886|      8|	  if (rc)
  ------------------
  |  Branch (886:8): [True: 0, False: 8]
  ------------------
  887|      0|	    log_fatal ("scanning ECC parameter failed: %s\n",
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
  888|      0|		       gpg_strerror (rc));
  889|      8|	  field_table_mpis[i] = f_p; /* cache */
  890|      8|	}
  891|  20.9k|      else
  892|  20.9k|	{
  893|  20.9k|	  f_p = field_table_mpis[i];
  894|  20.9k|	}
  895|       |
  896|  20.9k|      if (!mpi_cmp (p, f_p))
  ------------------
  |  |  510|  20.9k|#define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
  ------------------
  |  Branch (896:11): [True: 7.28k, False: 13.6k]
  ------------------
  897|  7.28k|        {
  898|  7.28k|          ctx->addm = field_table[i].addm ? field_table[i].addm : ctx->addm;
  ------------------
  |  Branch (898:23): [True: 4.59k, False: 2.69k]
  ------------------
  899|  7.28k|          ctx->subm = field_table[i].subm ? field_table[i].subm : ctx->subm;
  ------------------
  |  Branch (899:23): [True: 4.59k, False: 2.69k]
  ------------------
  900|  7.28k|          ctx->mulm = field_table[i].mulm ? field_table[i].mulm : ctx->mulm;
  ------------------
  |  Branch (900:23): [True: 4.59k, False: 2.69k]
  ------------------
  901|  7.28k|          ctx->mul2 = field_table[i].mul2 ? field_table[i].mul2 : ctx->mul2;
  ------------------
  |  Branch (901:23): [True: 4.59k, False: 2.69k]
  ------------------
  902|  7.28k|          ctx->pow2 = field_table[i].pow2 ? field_table[i].pow2 : ctx->pow2;
  ------------------
  |  Branch (902:23): [True: 4.59k, False: 2.69k]
  ------------------
  903|  7.28k|          ctx->mod = field_table[i].mod ? field_table[i].mod : ctx->mod;
  ------------------
  |  Branch (903:22): [True: 2.69k, False: 4.59k]
  ------------------
  904|       |
  905|  7.28k|	  if (ctx->a)
  ------------------
  |  Branch (905:8): [True: 7.28k, False: 0]
  ------------------
  906|  7.28k|	    {
  907|  7.28k|	      mpi_resize (ctx->a, ctx->p->nlimbs);
  ------------------
  |  |  100|  7.28k|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
  908|  7.28k|	      ctx->a->nlimbs = ctx->p->nlimbs;
  909|  7.28k|	    }
  910|       |
  911|  7.28k|	  if (ctx->b)
  ------------------
  |  Branch (911:8): [True: 7.28k, False: 0]
  ------------------
  912|  7.28k|	    {
  913|  7.28k|	      mpi_resize (ctx->b, ctx->p->nlimbs);
  ------------------
  |  |  100|  7.28k|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
  914|  7.28k|	      ctx->b->nlimbs = ctx->p->nlimbs;
  915|  7.28k|	    }
  916|       |
  917|  87.3k|          for (i=0; i< DIM(ctx->t.scratch) && ctx->t.scratch[i]; i++)
  ------------------
  |  |  104|   174k|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (917:21): [True: 80.0k, False: 7.28k]
  |  Branch (917:47): [True: 80.0k, False: 0]
  ------------------
  918|  80.0k|            ctx->t.scratch[i]->nlimbs = ctx->p->nlimbs;
  919|       |
  920|  7.28k|          break;
  921|  7.28k|        }
  922|  20.9k|    }
  923|       |
  924|       |  /* Prepare for fast reduction.  */
  925|       |  /* FIXME: need a test for NIST values.  However it does not gain us
  926|       |     any real advantage, for 384 bits it is actually slower than using
  927|       |     mpi_mulm.  */
  928|       |/*   ctx->nist_nbits = mpi_get_nbits (ctx->p); */
  929|       |/*   if (ctx->nist_nbits == 192) */
  930|       |/*     { */
  931|       |/*       for (i=0; i < 4; i++) */
  932|       |/*         ctx->s[i] = mpi_new (192); */
  933|       |/*       ctx->c    = mpi_new (192*2); */
  934|       |/*     } */
  935|       |/*   else if (ctx->nist_nbits == 384) */
  936|       |/*     { */
  937|       |/*       for (i=0; i < 10; i++) */
  938|       |/*         ctx->s[i] = mpi_new (384); */
  939|       |/*       ctx->c    = mpi_new (384*2); */
  940|       |/*     } */
  941|  7.29k|}
ec.c:ec_mul2:
  310|  2.43M|{
  311|  2.43M|  mpi_lshift (w, u, 1);
  ------------------
  |  |  559|  2.43M|#define mpi_lshift(a,b,c)      _gcry_mpi_lshift ((a),(b),(c))
  ------------------
  312|  2.43M|  ctx->mod (w, ctx);
  313|  2.43M|}
ec.c:ec_mod:
  275|   164k|{
  276|   164k|  if (0 && ec->dialect == ECC_DIALECT_ED25519)
  ------------------
  |  Branch (276:7): [Folded - Ignored]
  |  Branch (276:12): [True: 0, False: 0]
  ------------------
  277|      0|    _gcry_mpi_ec_ed25519_mod (w);
  278|   164k|  else if (ec->t.p_barrett)
  ------------------
  |  Branch (278:12): [True: 0, False: 164k]
  ------------------
  279|      0|    _gcry_mpi_mod_barrett (w, w, ec->t.p_barrett);
  280|   164k|  else
  281|   164k|    _gcry_mpi_mod (w, w, ec->p);
  282|   164k|}
ec.c:ec_addm_25519:
  363|  16.2M|{
  364|  16.2M|  mpi_ptr_t wp, up, vp;
  365|  16.2M|  mpi_size_t wsize = LIMB_SIZE_25519;
  ------------------
  |  |  359|  16.2M|#define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  16.2M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  16.2M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  16.2M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  16.2M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  16.2M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  16.2M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  366|  16.2M|  mpi_limb_t n[LIMB_SIZE_25519];
  367|  16.2M|  mpi_limb_t borrow;
  368|       |
  369|  16.2M|  if (w->nlimbs != wsize || u->nlimbs != wsize || v->nlimbs != wsize)
  ------------------
  |  Branch (369:7): [True: 0, False: 16.2M]
  |  Branch (369:29): [True: 0, False: 16.2M]
  |  Branch (369:51): [True: 0, False: 16.2M]
  ------------------
  370|      0|    log_bug ("addm_25519: different sizes\n");
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  371|       |
  372|  16.2M|  up = u->d;
  373|  16.2M|  vp = v->d;
  374|  16.2M|  wp = w->d;
  375|       |
  376|  16.2M|  _gcry_mpih_add_n (wp, up, vp, wsize);
  377|  16.2M|  borrow = _gcry_mpih_sub_n (n, wp, ctx->p->d, wsize);
  378|  16.2M|  mpih_set_cond (wp, n, wsize, (borrow == 0UL));
  ------------------
  |  |  263|  16.2M|#define mpih_set_cond(w,u,s,o) _gcry_mpih_set_cond ((w),(u),(s),(o))
  ------------------
  379|  16.2M|  wp[LIMB_SIZE_25519-1] &= ~((mpi_limb_t)1 << (255 % BITS_PER_MPI_LIMB));
  ------------------
  |  |  359|  16.2M|#define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  16.2M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  16.2M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  16.2M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  16.2M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  16.2M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  16.2M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                wp[LIMB_SIZE_25519-1] &= ~((mpi_limb_t)1 << (255 % BITS_PER_MPI_LIMB));
  ------------------
  |  |   49|  16.2M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  16.2M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  16.2M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  380|  16.2M|}
ec.c:ec_subm_25519:
  384|  21.8M|{
  385|  21.8M|  mpi_ptr_t wp, up, vp;
  386|  21.8M|  mpi_size_t wsize = LIMB_SIZE_25519;
  ------------------
  |  |  359|  21.8M|#define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  21.8M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  21.8M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  21.8M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  21.8M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  21.8M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  21.8M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  387|  21.8M|  mpi_limb_t n[LIMB_SIZE_25519];
  388|  21.8M|  mpi_limb_t borrow;
  389|       |
  390|  21.8M|  if (w->nlimbs != wsize || u->nlimbs != wsize || v->nlimbs != wsize)
  ------------------
  |  Branch (390:7): [True: 0, False: 21.8M]
  |  Branch (390:29): [True: 0, False: 21.8M]
  |  Branch (390:51): [True: 0, False: 21.8M]
  ------------------
  391|      0|    log_bug ("subm_25519: different sizes\n");
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  392|       |
  393|  21.8M|  up = u->d;
  394|  21.8M|  vp = v->d;
  395|  21.8M|  wp = w->d;
  396|       |
  397|  21.8M|  borrow = _gcry_mpih_sub_n (wp, up, vp, wsize);
  398|  21.8M|  _gcry_mpih_add_n (n, wp, ctx->p->d, wsize);
  399|  21.8M|  mpih_set_cond (wp, n, wsize, (borrow != 0UL));
  ------------------
  |  |  263|  21.8M|#define mpih_set_cond(w,u,s,o) _gcry_mpih_set_cond ((w),(u),(s),(o))
  ------------------
  400|  21.8M|  wp[LIMB_SIZE_25519-1] &= ~((mpi_limb_t)1 << (255 % BITS_PER_MPI_LIMB));
  ------------------
  |  |  359|  21.8M|#define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  21.8M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  21.8M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  21.8M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  21.8M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  21.8M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  21.8M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                wp[LIMB_SIZE_25519-1] &= ~((mpi_limb_t)1 << (255 % BITS_PER_MPI_LIMB));
  ------------------
  |  |   49|  21.8M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  21.8M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  21.8M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  401|  21.8M|}
ec.c:ec_mulm_25519:
  405|  41.6M|{
  406|  41.6M|  mpi_ptr_t wp, up, vp;
  407|  41.6M|  mpi_size_t wsize = LIMB_SIZE_25519;
  ------------------
  |  |  359|  41.6M|#define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  41.6M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  41.6M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  41.6M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  41.6M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  41.6M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  41.6M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  408|  41.6M|  mpi_limb_t n[LIMB_SIZE_25519*2];
  409|  41.6M|  mpi_limb_t cy;
  410|  41.6M|  int msb;
  411|       |
  412|  41.6M|  (void)ctx;
  413|  41.6M|  if (w->nlimbs != wsize || u->nlimbs != wsize || v->nlimbs != wsize)
  ------------------
  |  Branch (413:7): [True: 0, False: 41.6M]
  |  Branch (413:29): [True: 0, False: 41.6M]
  |  Branch (413:51): [True: 0, False: 41.6M]
  ------------------
  414|      0|    log_bug ("mulm_25519: different sizes\n");
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  415|       |
  416|  41.6M|  up = u->d;
  417|  41.6M|  vp = v->d;
  418|  41.6M|  wp = w->d;
  419|       |
  420|  41.6M|  _gcry_mpih_mul_n (n, up, vp, wsize);
  421|  41.6M|  memcpy (wp, n, wsize * BYTES_PER_MPI_LIMB);
  ------------------
  |  |    4|  41.6M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  41.6M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
  422|  41.6M|  wp[LIMB_SIZE_25519-1] &= ~((mpi_limb_t)1 << (255 % BITS_PER_MPI_LIMB));
  ------------------
  |  |  359|  41.6M|#define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  41.6M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  41.6M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  41.6M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  41.6M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  41.6M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  41.6M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                wp[LIMB_SIZE_25519-1] &= ~((mpi_limb_t)1 << (255 % BITS_PER_MPI_LIMB));
  ------------------
  |  |   49|  41.6M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  41.6M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  41.6M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  423|       |
  424|  41.6M|  _gcry_mpih_rshift (n, n+LIMB_SIZE_25519-1, LIMB_SIZE_25519+1,
  ------------------
  |  |  359|  41.6M|#define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  41.6M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  41.6M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  41.6M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  41.6M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  41.6M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  41.6M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                _gcry_mpih_rshift (n, n+LIMB_SIZE_25519-1, LIMB_SIZE_25519+1,
  ------------------
  |  |  359|  41.6M|#define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  41.6M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  41.6M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  41.6M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  41.6M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  41.6M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  41.6M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  425|  41.6M|		     (255 % BITS_PER_MPI_LIMB));
  ------------------
  |  |   49|  41.6M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  41.6M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  41.6M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  426|       |
  427|  41.6M|  cy = _gcry_mpih_addmul_1 (wp, n, wsize, 19);
  428|       |
  429|  41.6M|  memset (n, 0, wsize * BYTES_PER_MPI_LIMB);
  ------------------
  |  |    4|  41.6M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  41.6M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
  430|  41.6M|  msb = (wp[LIMB_SIZE_25519-1] >> (255 % BITS_PER_MPI_LIMB));
  ------------------
  |  |  359|  41.6M|#define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  41.6M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  41.6M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  41.6M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  41.6M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  41.6M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  41.6M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                msb = (wp[LIMB_SIZE_25519-1] >> (255 % BITS_PER_MPI_LIMB));
  ------------------
  |  |   49|  41.6M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  41.6M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  41.6M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  431|  41.6M|  n[0] = (cy * 2 + msb) * 19;
  432|  41.6M|  wp[LIMB_SIZE_25519-1] &= ~((mpi_limb_t)1 << (255 % BITS_PER_MPI_LIMB));
  ------------------
  |  |  359|  41.6M|#define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  41.6M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  41.6M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  41.6M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define LIMB_SIZE_25519 ((256+BITS_PER_MPI_LIMB-1)/BITS_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |   49|  41.6M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  |  |  ------------------
  |  |  |  |  |  |    4|  41.6M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  524|  41.6M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                wp[LIMB_SIZE_25519-1] &= ~((mpi_limb_t)1 << (255 % BITS_PER_MPI_LIMB));
  ------------------
  |  |   49|  41.6M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  41.6M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  41.6M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  433|  41.6M|  _gcry_mpih_add_n (wp, wp, n, wsize);
  434|       |
  435|  41.6M|  cy = _gcry_mpih_sub_n (n, wp, ctx->p->d, wsize);
  436|  41.6M|  mpih_set_cond (wp, n, wsize, (cy == 0UL));
  ------------------
  |  |  263|  41.6M|#define mpih_set_cond(w,u,s,o) _gcry_mpih_set_cond ((w),(u),(s),(o))
  ------------------
  437|  41.6M|}
ec.c:ec_mul2_25519:
  441|  3.51M|{
  442|  3.51M|  ec_addm_25519 (w, u, u, ctx);
  443|  3.51M|}
ec.c:ec_pow2_25519:
  447|  15.4M|{
  448|  15.4M|  ec_mulm_25519 (w, b, b, ctx);
  449|  15.4M|}
ec.c:ec_secp256k1_mod:
  583|  5.77M|{
  584|  5.77M|  mpi_limb_t s[(256 + BITS_PER_MPI_LIMB - 1) / BITS_PER_MPI_LIMB + 1];
  585|  5.77M|  mpi_limb_t n[DIM(s)];
  586|  5.77M|  const mpi_size_t wsize = DIM(s) - 1;
  ------------------
  |  |  104|  5.77M|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  587|  5.77M|  mpi_limb_t cy, borrow;
  588|  5.77M|  mpi_ptr_t wp;
  589|       |
  590|  5.77M|  MPN_NORMALIZE (w->d, w->nlimbs);
  ------------------
  |  |  119|  5.77M|    do {		       \
  |  |  120|  5.77M|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 5.47M, False: 304k]
  |  |  ------------------
  |  |  121|  5.47M|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 5.46M, False: 5.98k]
  |  |  ------------------
  |  |  122|  5.47M|		break;	       \
  |  |  123|  5.47M|	    (n)--;	       \
  |  |  124|  5.98k|	}		       \
  |  |  125|  5.77M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  591|  5.77M|  if (w->nlimbs > 2 * 256 / BITS_PER_MPI_LIMB)
  ------------------
  |  |   49|  5.77M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  5.77M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  5.77M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (591:7): [True: 0, False: 5.77M]
  ------------------
  592|      0|    log_bug ("W must be less than m^2\n");
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  593|       |
  594|  5.77M|  RESIZE_AND_CLEAR_IF_NEEDED (w, wsize * 2);
  ------------------
  |  |   83|  5.77M|    do {			   \
  |  |   84|  5.77M|	if( (a)->nlimbs < (b) )   \
  |  |  ------------------
  |  |  |  Branch (84:6): [True: 2.63M, False: 3.13M]
  |  |  ------------------
  |  |   85|  5.77M|	    mpi_resize((a), (b));  \
  |  |  ------------------
  |  |  |  |  100|  2.63M|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  |  |  ------------------
  |  |   86|  5.77M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (86:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  595|       |
  596|  5.77M|  wp = w->d;
  597|       |
  598|       |  /* mod P (2^256 - 2^32 - 977) */
  599|       |
  600|       |  /* first pass of reduction */
  601|  5.77M|  memcpy (n, wp + wsize, wsize * BYTES_PER_MPI_LIMB);
  ------------------
  |  |    4|  5.77M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  5.77M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
  602|  5.77M|#if BITS_PER_MPI_LIMB == 64
  603|  5.77M|  s[wsize] = _gcry_mpih_lshift (s, wp + wsize, wsize, 32);
  604|       |#else
  605|       |  s[0] = 0;
  606|       |  memcpy (s + 1, wp + wsize, wsize * BYTES_PER_MPI_LIMB);
  607|       |#endif
  608|  5.77M|  wp[wsize] = _gcry_mpih_addmul_1 (wp, n, wsize, 977);
  609|  5.77M|  cy = _gcry_mpih_add_n (wp, wp, s, wsize + 1);
  610|       |
  611|       |  /* second pass of reduction */
  612|  5.77M|#if BITS_PER_MPI_LIMB == 64
  613|       |  /* cy == 0 */
  614|  5.77M|  memset (n + 1, 0, (wsize - 1) * BYTES_PER_MPI_LIMB);
  ------------------
  |  |    4|  5.77M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  5.77M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
  615|  5.77M|  umul_ppmm(n[1], n[0], wp[wsize], ((mpi_limb_t)1 << 32) + 977);
  ------------------
  |  |  602|  5.77M|  __asm__ ("mulq %3"                                                    \
  |  |  603|  5.77M|	   : "=a" ((w0)),                                               \
  |  |  604|  5.77M|	     "=d" ((w1))                                                \
  |  |  605|  5.77M|	   : "0" ((UDItype)(u)),                                        \
  |  |  606|  5.77M|	     "rm" ((UDItype)(v))                                        \
  |  |  607|  5.77M|	   __CLOBBER_CC)
  ------------------
  616|       |#else
  617|       |  memset (n + 2, 0, (wsize - 2) * BYTES_PER_MPI_LIMB);
  618|       |  umul_ppmm(n[1], n[0], wp[wsize], 977);
  619|       |  add_ssaaaa(n[2], n[1], 0, n[1], 0, cy * 977);
  620|       |  add_ssaaaa(n[2], n[1], n[2], n[1], cy, wp[wsize]);
  621|       |#endif
  622|  5.77M|  cy = _gcry_mpih_add_n (wp, wp, n, wsize);
  623|       |
  624|  5.77M|  borrow = _gcry_mpih_sub_n (s, wp, ctx->p->d, wsize);
  625|  5.77M|  mpih_set_cond (wp, s, wsize, (cy != 0UL) | (borrow == 0UL));
  ------------------
  |  |  263|  5.77M|#define mpih_set_cond(w,u,s,o) _gcry_mpih_set_cond ((w),(u),(s),(o))
  ------------------
  626|       |
  627|  5.77M|  w->nlimbs = wsize;
  628|  5.77M|  MPN_NORMALIZE (wp, w->nlimbs);
  ------------------
  |  |  119|  5.77M|    do {		       \
  |  |  120|  6.99M|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 6.68M, False: 304k]
  |  |  ------------------
  |  |  121|  6.68M|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 5.46M, False: 1.22M]
  |  |  ------------------
  |  |  122|  6.68M|		break;	       \
  |  |  123|  6.68M|	    (n)--;	       \
  |  |  124|  1.22M|	}		       \
  |  |  125|  5.77M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  629|  5.77M|}
ec.c:ec_deinit:
  946|  7.29k|{
  947|  7.29k|  mpi_ec_t ctx = opaque;
  948|  7.29k|  int i;
  949|       |
  950|  7.29k|  _gcry_mpi_barrett_free (ctx->t.p_barrett);
  951|       |
  952|       |  /* Domain parameter.  */
  953|  7.29k|  mpi_free (ctx->p);
  ------------------
  |  |   99|  7.29k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  954|  7.29k|  mpi_free (ctx->a);
  ------------------
  |  |   99|  7.29k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  955|  7.29k|  mpi_free (ctx->b);
  ------------------
  |  |   99|  7.29k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  956|  7.29k|  _gcry_mpi_point_release (ctx->G);
  957|  7.29k|  mpi_free (ctx->n);
  ------------------
  |  |   99|  7.29k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  958|       |
  959|       |  /* The key.  */
  960|  7.29k|  _gcry_mpi_point_release (ctx->Q);
  961|  7.29k|  mpi_free (ctx->d);
  ------------------
  |  |   99|  7.29k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  962|       |
  963|       |  /* Private data of ec.c.  */
  964|  7.29k|  mpi_free (ctx->t.two_inv_p);
  ------------------
  |  |   99|  7.29k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  965|       |
  966|  87.5k|  for (i=0; i< DIM(ctx->t.scratch); i++)
  ------------------
  |  |  104|  87.5k|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (966:13): [True: 80.2k, False: 7.29k]
  ------------------
  967|  80.2k|    mpi_free (ctx->t.scratch[i]);
  ------------------
  |  |   99|  80.2k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  968|       |
  969|       |/*   if (ctx->nist_nbits == 192) */
  970|       |/*     { */
  971|       |/*       for (i=0; i < 4; i++) */
  972|       |/*         mpi_free (ctx->s[i]); */
  973|       |/*       mpi_free (ctx->c); */
  974|       |/*     } */
  975|       |/*   else if (ctx->nist_nbits == 384) */
  976|       |/*     { */
  977|       |/*       for (i=0; i < 10; i++) */
  978|       |/*         mpi_free (ctx->s[i]); */
  979|       |/*       mpi_free (ctx->c); */
  980|       |/*     } */
  981|  7.29k|}
ec.c:ec_invm:
  348|  8.45k|{
  349|  8.45k|  if (!mpi_invm (x, a, ctx->p))
  ------------------
  |  |  530|  8.45k|#define mpi_invm(g,a,b)        _gcry_mpi_invm ( (g), (a), (b) )
  ------------------
  |  Branch (349:7): [True: 0, False: 8.45k]
  ------------------
  350|      0|    {
  351|      0|      log_error ("ec_invm: inverse does not exist:\n");
  ------------------
  |  |  203|      0|#define log_error   _gcry_log_error
  ------------------
  352|      0|      log_mpidump ("  a", a);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
  353|      0|      log_mpidump ("  p", ctx->p);
  ------------------
  |  |  212|      0|#define log_mpidump _gcry_log_printmpi
  ------------------
  354|      0|    }
  355|  8.45k|}
ec.c:ec_mulm:
  302|  15.6M|{
  303|  15.6M|  mpi_mul (w, u, v);
  ------------------
  |  |  523|  15.6M|#define mpi_mul(w,u,v)         _gcry_mpi_mul ((w),(u),(v))
  ------------------
  304|  15.6M|  ctx->mod (w, ctx);
  305|  15.6M|}
ec.c:dup_point_weierstrass:
 1220|  1.04M|{
 1221|  1.04M|#define x3 (result->x)
 1222|  1.04M|#define y3 (result->y)
 1223|  1.04M|#define z3 (result->z)
 1224|  1.04M|#define t1 (ctx->t.scratch[0])
 1225|  1.04M|#define t2 (ctx->t.scratch[1])
 1226|  1.04M|#define t3 (ctx->t.scratch[2])
 1227|  1.04M|#define l1 (ctx->t.scratch[3])
 1228|  1.04M|#define l2 (ctx->t.scratch[4])
 1229|  1.04M|#define l3 (ctx->t.scratch[5])
 1230|       |
 1231|  1.04M|  if (!mpi_cmp_ui (point->y, 0) || !mpi_cmp_ui (point->z, 0))
  ------------------
  |  |  512|  2.08M|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
                if (!mpi_cmp_ui (point->y, 0) || !mpi_cmp_ui (point->z, 0))
  ------------------
  |  |  512|  1.04M|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
  |  Branch (1231:7): [True: 0, False: 1.04M]
  |  Branch (1231:36): [True: 0, False: 1.04M]
  ------------------
 1232|      0|    {
 1233|       |      /* P_y == 0 || P_z == 0 => [1:1:0] */
 1234|      0|      mpi_set_ui (x3, 1);
  ------------------
  |  |  505|      0|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
 1235|      0|      mpi_set_ui (y3, 1);
  ------------------
  |  |  505|      0|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
 1236|      0|      mpi_set_ui (z3, 0);
  ------------------
  |  |  505|      0|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
 1237|      0|    }
 1238|  1.04M|  else
 1239|  1.04M|    {
 1240|  1.04M|      if (ec_get_a_is_pminus3 (ctx))  /* Use the faster case.  */
  ------------------
  |  Branch (1240:11): [True: 730k, False: 312k]
  ------------------
 1241|   730k|        {
 1242|       |          /* L1 = 3(X - Z^2)(X + Z^2) */
 1243|       |          /*                          T1: used for Z^2. */
 1244|       |          /*                          T2: used for the right term.  */
 1245|   730k|          ec_pow2 (t1, point->z, ctx);
  ------------------
  |  | 1224|   730k|#define t1 (ctx->t.scratch[0])
  ------------------
 1246|   730k|          ec_subm (l1, point->x, t1, ctx);
  ------------------
  |  | 1227|   730k|#define l1 (ctx->t.scratch[3])
  ------------------
                        ec_subm (l1, point->x, t1, ctx);
  ------------------
  |  | 1224|   730k|#define t1 (ctx->t.scratch[0])
  ------------------
 1247|   730k|          ec_mulm (l1, l1, mpi_const (MPI_C_THREE), ctx);
  ------------------
  |  | 1227|   730k|#define l1 (ctx->t.scratch[3])
  ------------------
                        ec_mulm (l1, l1, mpi_const (MPI_C_THREE), ctx);
  ------------------
  |  | 1227|   730k|#define l1 (ctx->t.scratch[3])
  ------------------
                        ec_mulm (l1, l1, mpi_const (MPI_C_THREE), ctx);
  ------------------
  |  |  120|   730k|#define mpi_const(n)          _gcry_mpi_const ((n))
  ------------------
 1248|   730k|          ec_addm (t2, point->x, t1, ctx);
  ------------------
  |  | 1225|   730k|#define t2 (ctx->t.scratch[1])
  ------------------
                        ec_addm (t2, point->x, t1, ctx);
  ------------------
  |  | 1224|   730k|#define t1 (ctx->t.scratch[0])
  ------------------
 1249|   730k|          ec_mulm (l1, l1, t2, ctx);
  ------------------
  |  | 1227|   730k|#define l1 (ctx->t.scratch[3])
  ------------------
                        ec_mulm (l1, l1, t2, ctx);
  ------------------
  |  | 1227|   730k|#define l1 (ctx->t.scratch[3])
  ------------------
                        ec_mulm (l1, l1, t2, ctx);
  ------------------
  |  | 1225|   730k|#define t2 (ctx->t.scratch[1])
  ------------------
 1250|   730k|        }
 1251|   312k|      else /* Standard case. */
 1252|   312k|        {
 1253|       |          /* L1 = 3X^2 + aZ^4 */
 1254|       |          /*                          T1: used for aZ^4. */
 1255|   312k|          ec_pow2 (l1, point->x, ctx);
  ------------------
  |  | 1227|   312k|#define l1 (ctx->t.scratch[3])
  ------------------
 1256|   312k|          ec_mulm (l1, l1, mpi_const (MPI_C_THREE), ctx);
  ------------------
  |  | 1227|   312k|#define l1 (ctx->t.scratch[3])
  ------------------
                        ec_mulm (l1, l1, mpi_const (MPI_C_THREE), ctx);
  ------------------
  |  | 1227|   312k|#define l1 (ctx->t.scratch[3])
  ------------------
                        ec_mulm (l1, l1, mpi_const (MPI_C_THREE), ctx);
  ------------------
  |  |  120|   312k|#define mpi_const(n)          _gcry_mpi_const ((n))
  ------------------
 1257|   312k|          ec_powm (t1, point->z, mpi_const (MPI_C_FOUR), ctx);
  ------------------
  |  | 1224|   312k|#define t1 (ctx->t.scratch[0])
  ------------------
                        ec_powm (t1, point->z, mpi_const (MPI_C_FOUR), ctx);
  ------------------
  |  |  120|   312k|#define mpi_const(n)          _gcry_mpi_const ((n))
  ------------------
 1258|   312k|          ec_mulm (t1, t1, ctx->a, ctx);
  ------------------
  |  | 1224|   312k|#define t1 (ctx->t.scratch[0])
  ------------------
                        ec_mulm (t1, t1, ctx->a, ctx);
  ------------------
  |  | 1224|   312k|#define t1 (ctx->t.scratch[0])
  ------------------
 1259|   312k|          ec_addm (l1, l1, t1, ctx);
  ------------------
  |  | 1227|   312k|#define l1 (ctx->t.scratch[3])
  ------------------
                        ec_addm (l1, l1, t1, ctx);
  ------------------
  |  | 1227|   312k|#define l1 (ctx->t.scratch[3])
  ------------------
                        ec_addm (l1, l1, t1, ctx);
  ------------------
  |  | 1224|   312k|#define t1 (ctx->t.scratch[0])
  ------------------
 1260|   312k|        }
 1261|       |      /* Z3 = 2YZ */
 1262|  1.04M|      ec_mulm (z3, point->y, point->z, ctx);
  ------------------
  |  | 1223|  1.04M|#define z3 (result->z)
  ------------------
 1263|  1.04M|      ec_mul2 (z3, z3, ctx);
  ------------------
  |  | 1223|  1.04M|#define z3 (result->z)
  ------------------
                    ec_mul2 (z3, z3, ctx);
  ------------------
  |  | 1223|  1.04M|#define z3 (result->z)
  ------------------
 1264|       |
 1265|       |      /* L2 = 4XY^2 */
 1266|       |      /*                              T2: used for Y2; required later. */
 1267|  1.04M|      ec_pow2 (t2, point->y, ctx);
  ------------------
  |  | 1225|  1.04M|#define t2 (ctx->t.scratch[1])
  ------------------
 1268|  1.04M|      ec_mulm (l2, t2, point->x, ctx);
  ------------------
  |  | 1228|  1.04M|#define l2 (ctx->t.scratch[4])
  ------------------
                    ec_mulm (l2, t2, point->x, ctx);
  ------------------
  |  | 1225|  1.04M|#define t2 (ctx->t.scratch[1])
  ------------------
 1269|  1.04M|      ec_mulm (l2, l2, mpi_const (MPI_C_FOUR), ctx);
  ------------------
  |  | 1228|  1.04M|#define l2 (ctx->t.scratch[4])
  ------------------
                    ec_mulm (l2, l2, mpi_const (MPI_C_FOUR), ctx);
  ------------------
  |  | 1228|  1.04M|#define l2 (ctx->t.scratch[4])
  ------------------
                    ec_mulm (l2, l2, mpi_const (MPI_C_FOUR), ctx);
  ------------------
  |  |  120|  1.04M|#define mpi_const(n)          _gcry_mpi_const ((n))
  ------------------
 1270|       |
 1271|       |      /* X3 = L1^2 - 2L2 */
 1272|       |      /*                              T1: used for L2^2. */
 1273|  1.04M|      ec_pow2 (x3, l1, ctx);
  ------------------
  |  | 1221|  1.04M|#define x3 (result->x)
  ------------------
                    ec_pow2 (x3, l1, ctx);
  ------------------
  |  | 1227|  1.04M|#define l1 (ctx->t.scratch[3])
  ------------------
 1274|  1.04M|      ec_mul2 (t1, l2, ctx);
  ------------------
  |  | 1224|  1.04M|#define t1 (ctx->t.scratch[0])
  ------------------
                    ec_mul2 (t1, l2, ctx);
  ------------------
  |  | 1228|  1.04M|#define l2 (ctx->t.scratch[4])
  ------------------
 1275|  1.04M|      ec_subm (x3, x3, t1, ctx);
  ------------------
  |  | 1221|  1.04M|#define x3 (result->x)
  ------------------
                    ec_subm (x3, x3, t1, ctx);
  ------------------
  |  | 1221|  1.04M|#define x3 (result->x)
  ------------------
                    ec_subm (x3, x3, t1, ctx);
  ------------------
  |  | 1224|  1.04M|#define t1 (ctx->t.scratch[0])
  ------------------
 1276|       |
 1277|       |      /* L3 = 8Y^4 */
 1278|       |      /*                              T2: taken from above. */
 1279|  1.04M|      ec_pow2 (t2, t2, ctx);
  ------------------
  |  | 1225|  1.04M|#define t2 (ctx->t.scratch[1])
  ------------------
                    ec_pow2 (t2, t2, ctx);
  ------------------
  |  | 1225|  1.04M|#define t2 (ctx->t.scratch[1])
  ------------------
 1280|  1.04M|      ec_mulm (l3, t2, mpi_const (MPI_C_EIGHT), ctx);
  ------------------
  |  | 1229|  1.04M|#define l3 (ctx->t.scratch[5])
  ------------------
                    ec_mulm (l3, t2, mpi_const (MPI_C_EIGHT), ctx);
  ------------------
  |  | 1225|  1.04M|#define t2 (ctx->t.scratch[1])
  ------------------
                    ec_mulm (l3, t2, mpi_const (MPI_C_EIGHT), ctx);
  ------------------
  |  |  120|  1.04M|#define mpi_const(n)          _gcry_mpi_const ((n))
  ------------------
 1281|       |
 1282|       |      /* Y3 = L1(L2 - X3) - L3 */
 1283|  1.04M|      ec_subm (y3, l2, x3, ctx);
  ------------------
  |  | 1222|  1.04M|#define y3 (result->y)
  ------------------
                    ec_subm (y3, l2, x3, ctx);
  ------------------
  |  | 1228|  1.04M|#define l2 (ctx->t.scratch[4])
  ------------------
                    ec_subm (y3, l2, x3, ctx);
  ------------------
  |  | 1221|  1.04M|#define x3 (result->x)
  ------------------
 1284|  1.04M|      ec_mulm (y3, y3, l1, ctx);
  ------------------
  |  | 1222|  1.04M|#define y3 (result->y)
  ------------------
                    ec_mulm (y3, y3, l1, ctx);
  ------------------
  |  | 1222|  1.04M|#define y3 (result->y)
  ------------------
                    ec_mulm (y3, y3, l1, ctx);
  ------------------
  |  | 1227|  1.04M|#define l1 (ctx->t.scratch[3])
  ------------------
 1285|  1.04M|      ec_subm (y3, y3, l3, ctx);
  ------------------
  |  | 1222|  1.04M|#define y3 (result->y)
  ------------------
                    ec_subm (y3, y3, l3, ctx);
  ------------------
  |  | 1222|  1.04M|#define y3 (result->y)
  ------------------
                    ec_subm (y3, y3, l3, ctx);
  ------------------
  |  | 1229|  1.04M|#define l3 (ctx->t.scratch[5])
  ------------------
 1286|  1.04M|    }
 1287|       |
 1288|  1.04M|#undef x3
 1289|  1.04M|#undef y3
 1290|  1.04M|#undef z3
 1291|  1.04M|#undef t1
 1292|  1.04M|#undef t2
 1293|  1.04M|#undef t3
 1294|  1.04M|#undef l1
 1295|  1.04M|#undef l2
 1296|  1.04M|#undef l3
 1297|  1.04M|}
ec.c:ec_get_a_is_pminus3:
  738|  1.04M|{
  739|  1.04M|  gcry_mpi_t tmp;
  740|       |
  741|  1.04M|  if (!ec->t.valid.a_is_pminus3)
  ------------------
  |  Branch (741:7): [True: 1.93k, False: 1.04M]
  ------------------
  742|  1.93k|    {
  743|  1.93k|      ec->t.valid.a_is_pminus3 = 1;
  744|  1.93k|      tmp = mpi_alloc_like (ec->p);
  ------------------
  |  |  117|  1.93k|#define mpi_alloc_like(a)     _gcry_mpi_alloc_like((a))
  ------------------
  745|  1.93k|      mpi_sub_ui (tmp, ec->p, 3);
  ------------------
  |  |  518|  1.93k|#define mpi_sub_ui(w,u,v)      _gcry_mpi_sub_ui ((w),(u),(v))
  ------------------
  746|  1.93k|      ec->t.a_is_pminus3 = !mpi_cmp (ec->a, tmp);
  ------------------
  |  |  510|  1.93k|#define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
  ------------------
  747|  1.93k|      mpi_free (tmp);
  ------------------
  |  |   99|  1.93k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  748|  1.93k|    }
  749|       |
  750|  1.04M|  return ec->t.a_is_pminus3;
  751|  1.04M|}
ec.c:dup_point_edwards:
 1315|  3.51M|{
 1316|  3.51M|#define X1 (point->x)
 1317|  3.51M|#define Y1 (point->y)
 1318|  3.51M|#define Z1 (point->z)
 1319|  3.51M|#define X3 (result->x)
 1320|  3.51M|#define Y3 (result->y)
 1321|  3.51M|#define Z3 (result->z)
 1322|  3.51M|#define B (ctx->t.scratch[0])
 1323|  3.51M|#define C (ctx->t.scratch[1])
 1324|  3.51M|#define D (ctx->t.scratch[2])
 1325|  3.51M|#define E (ctx->t.scratch[3])
 1326|  3.51M|#define F (ctx->t.scratch[4])
 1327|  3.51M|#define H (ctx->t.scratch[5])
 1328|  3.51M|#define J (ctx->t.scratch[6])
 1329|       |
 1330|       |  /* Compute: (X_3 : Y_3 : Z_3) = 2( X_1 : Y_1 : Z_1 ) */
 1331|       |
 1332|       |  /* B = (X_1 + Y_1)^2  */
 1333|  3.51M|  ctx->addm (B, X1, Y1, ctx);
  ------------------
  |  | 1322|  3.51M|#define B (ctx->t.scratch[0])
  ------------------
                ctx->addm (B, X1, Y1, ctx);
  ------------------
  |  | 1316|  3.51M|#define X1 (point->x)
  ------------------
                ctx->addm (B, X1, Y1, ctx);
  ------------------
  |  | 1317|  3.51M|#define Y1 (point->y)
  ------------------
 1334|  3.51M|  ctx->pow2 (B, B, ctx);
  ------------------
  |  | 1322|  3.51M|#define B (ctx->t.scratch[0])
  ------------------
                ctx->pow2 (B, B, ctx);
  ------------------
  |  | 1322|  3.51M|#define B (ctx->t.scratch[0])
  ------------------
 1335|       |
 1336|       |  /* C = X_1^2 */
 1337|       |  /* D = Y_1^2 */
 1338|  3.51M|  ctx->pow2 (C, X1, ctx);
  ------------------
  |  | 1323|  3.51M|#define C (ctx->t.scratch[1])
  ------------------
                ctx->pow2 (C, X1, ctx);
  ------------------
  |  | 1316|  3.51M|#define X1 (point->x)
  ------------------
 1339|  3.51M|  ctx->pow2 (D, Y1, ctx);
  ------------------
  |  | 1324|  3.51M|#define D (ctx->t.scratch[2])
  ------------------
                ctx->pow2 (D, Y1, ctx);
  ------------------
  |  | 1317|  3.51M|#define Y1 (point->y)
  ------------------
 1340|       |
 1341|       |  /* E = aC */
 1342|  3.51M|  if (ctx->dialect == ECC_DIALECT_ED25519)
  ------------------
  |  Branch (1342:7): [True: 3.51M, False: 0]
  ------------------
 1343|  3.51M|    ctx->subm (E, ctx->p, C, ctx);
  ------------------
  |  | 1325|  3.51M|#define E (ctx->t.scratch[3])
  ------------------
                  ctx->subm (E, ctx->p, C, ctx);
  ------------------
  |  | 1323|  3.51M|#define C (ctx->t.scratch[1])
  ------------------
 1344|      0|  else
 1345|      0|    ctx->mulm (E, ctx->a, C, ctx);
  ------------------
  |  | 1325|      0|#define E (ctx->t.scratch[3])
  ------------------
                  ctx->mulm (E, ctx->a, C, ctx);
  ------------------
  |  | 1323|      0|#define C (ctx->t.scratch[1])
  ------------------
 1346|       |
 1347|       |  /* F = E + D */
 1348|  3.51M|  ctx->addm (F, E, D, ctx);
  ------------------
  |  | 1326|  3.51M|#define F (ctx->t.scratch[4])
  ------------------
                ctx->addm (F, E, D, ctx);
  ------------------
  |  | 1325|  3.51M|#define E (ctx->t.scratch[3])
  ------------------
                ctx->addm (F, E, D, ctx);
  ------------------
  |  | 1324|  3.51M|#define D (ctx->t.scratch[2])
  ------------------
 1349|       |
 1350|       |  /* H = Z_1^2 */
 1351|  3.51M|  ctx->pow2 (H, Z1, ctx);
  ------------------
  |  | 1327|  3.51M|#define H (ctx->t.scratch[5])
  ------------------
                ctx->pow2 (H, Z1, ctx);
  ------------------
  |  | 1318|  3.51M|#define Z1 (point->z)
  ------------------
 1352|       |
 1353|       |  /* J = F - 2H */
 1354|  3.51M|  ctx->mul2 (J, H, ctx);
  ------------------
  |  | 1328|  3.51M|#define J (ctx->t.scratch[6])
  ------------------
                ctx->mul2 (J, H, ctx);
  ------------------
  |  | 1327|  3.51M|#define H (ctx->t.scratch[5])
  ------------------
 1355|  3.51M|  ctx->subm (J, F, J, ctx);
  ------------------
  |  | 1328|  3.51M|#define J (ctx->t.scratch[6])
  ------------------
                ctx->subm (J, F, J, ctx);
  ------------------
  |  | 1326|  3.51M|#define F (ctx->t.scratch[4])
  ------------------
                ctx->subm (J, F, J, ctx);
  ------------------
  |  | 1328|  3.51M|#define J (ctx->t.scratch[6])
  ------------------
 1356|       |
 1357|       |  /* X_3 = (B - C - D) · J */
 1358|  3.51M|  ctx->subm (X3, B, C, ctx);
  ------------------
  |  | 1319|  3.51M|#define X3 (result->x)
  ------------------
                ctx->subm (X3, B, C, ctx);
  ------------------
  |  | 1322|  3.51M|#define B (ctx->t.scratch[0])
  ------------------
                ctx->subm (X3, B, C, ctx);
  ------------------
  |  | 1323|  3.51M|#define C (ctx->t.scratch[1])
  ------------------
 1359|  3.51M|  ctx->subm (X3, X3, D, ctx);
  ------------------
  |  | 1319|  3.51M|#define X3 (result->x)
  ------------------
                ctx->subm (X3, X3, D, ctx);
  ------------------
  |  | 1319|  3.51M|#define X3 (result->x)
  ------------------
                ctx->subm (X3, X3, D, ctx);
  ------------------
  |  | 1324|  3.51M|#define D (ctx->t.scratch[2])
  ------------------
 1360|  3.51M|  ctx->mulm (X3, X3, J, ctx);
  ------------------
  |  | 1319|  3.51M|#define X3 (result->x)
  ------------------
                ctx->mulm (X3, X3, J, ctx);
  ------------------
  |  | 1319|  3.51M|#define X3 (result->x)
  ------------------
                ctx->mulm (X3, X3, J, ctx);
  ------------------
  |  | 1328|  3.51M|#define J (ctx->t.scratch[6])
  ------------------
 1361|       |
 1362|       |  /* Y_3 = F · (E - D) */
 1363|  3.51M|  ctx->subm (Y3, E, D, ctx);
  ------------------
  |  | 1320|  3.51M|#define Y3 (result->y)
  ------------------
                ctx->subm (Y3, E, D, ctx);
  ------------------
  |  | 1325|  3.51M|#define E (ctx->t.scratch[3])
  ------------------
                ctx->subm (Y3, E, D, ctx);
  ------------------
  |  | 1324|  3.51M|#define D (ctx->t.scratch[2])
  ------------------
 1364|  3.51M|  ctx->mulm (Y3, Y3, F, ctx);
  ------------------
  |  | 1320|  3.51M|#define Y3 (result->y)
  ------------------
                ctx->mulm (Y3, Y3, F, ctx);
  ------------------
  |  | 1320|  3.51M|#define Y3 (result->y)
  ------------------
                ctx->mulm (Y3, Y3, F, ctx);
  ------------------
  |  | 1326|  3.51M|#define F (ctx->t.scratch[4])
  ------------------
 1365|       |
 1366|       |  /* Z_3 = F · J */
 1367|  3.51M|  ctx->mulm (Z3, F, J, ctx);
  ------------------
  |  | 1321|  3.51M|#define Z3 (result->z)
  ------------------
                ctx->mulm (Z3, F, J, ctx);
  ------------------
  |  | 1326|  3.51M|#define F (ctx->t.scratch[4])
  ------------------
                ctx->mulm (Z3, F, J, ctx);
  ------------------
  |  | 1328|  3.51M|#define J (ctx->t.scratch[6])
  ------------------
 1368|       |
 1369|  3.51M|#undef X1
 1370|  3.51M|#undef Y1
 1371|  3.51M|#undef Z1
 1372|  3.51M|#undef X3
 1373|  3.51M|#undef Y3
 1374|  3.51M|#undef Z3
 1375|  3.51M|#undef B
 1376|  3.51M|#undef C
 1377|  3.51M|#undef D
 1378|  3.51M|#undef E
 1379|  3.51M|#undef F
 1380|  3.51M|#undef H
 1381|  3.51M|#undef J
 1382|  3.51M|}
ec.c:add_points_weierstrass:
 1409|   346k|{
 1410|   346k|#define x1 (p1->x    )
 1411|   346k|#define y1 (p1->y    )
 1412|   346k|#define z1 (p1->z    )
 1413|   346k|#define x2 (p2->x    )
 1414|   346k|#define y2 (p2->y    )
 1415|   346k|#define z2 (p2->z    )
 1416|   346k|#define x3 (result->x)
 1417|   346k|#define y3 (result->y)
 1418|   346k|#define z3 (result->z)
 1419|   346k|#define l1 (ctx->t.scratch[0])
 1420|   346k|#define l2 (ctx->t.scratch[1])
 1421|   346k|#define l3 (ctx->t.scratch[2])
 1422|   346k|#define l4 (ctx->t.scratch[3])
 1423|   346k|#define l5 (ctx->t.scratch[4])
 1424|   346k|#define l6 (ctx->t.scratch[5])
 1425|   346k|#define l7 (ctx->t.scratch[6])
 1426|   346k|#define l8 (ctx->t.scratch[7])
 1427|   346k|#define l9 (ctx->t.scratch[8])
 1428|   346k|#define t1 (ctx->t.scratch[9])
 1429|   346k|#define t2 (ctx->t.scratch[10])
 1430|       |
 1431|   346k|  if ( (!mpi_cmp (x1, x2)) && (!mpi_cmp (y1, y2)) && (!mpi_cmp (z1, z2)) )
  ------------------
  |  |  510|   346k|#define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
  ------------------
                if ( (!mpi_cmp (x1, x2)) && (!mpi_cmp (y1, y2)) && (!mpi_cmp (z1, z2)) )
  ------------------
  |  |  510|      0|#define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
  ------------------
                if ( (!mpi_cmp (x1, x2)) && (!mpi_cmp (y1, y2)) && (!mpi_cmp (z1, z2)) )
  ------------------
  |  |  510|      0|#define mpi_cmp( u, v )        _gcry_mpi_cmp( (u), (v) )
  ------------------
  |  Branch (1431:8): [True: 0, False: 346k]
  |  Branch (1431:31): [True: 0, False: 0]
  |  Branch (1431:54): [True: 0, False: 0]
  ------------------
 1432|      0|    {
 1433|       |      /* Same point; need to call the duplicate function.  */
 1434|      0|      _gcry_mpi_ec_dup_point (result, p1, ctx);
 1435|      0|    }
 1436|   346k|  else if (!mpi_cmp_ui (z1, 0))
  ------------------
  |  |  512|   346k|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
  |  Branch (1436:12): [True: 0, False: 346k]
  ------------------
 1437|      0|    {
 1438|       |      /* P1 is at infinity.  */
 1439|      0|      mpi_set (x3, p2->x);
  ------------------
  |  |  504|      0|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
 1440|      0|      mpi_set (y3, p2->y);
  ------------------
  |  |  504|      0|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
 1441|      0|      mpi_set (z3, p2->z);
  ------------------
  |  |  504|      0|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
 1442|      0|    }
 1443|   346k|  else if (!mpi_cmp_ui (z2, 0))
  ------------------
  |  |  512|   346k|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
  |  Branch (1443:12): [True: 0, False: 346k]
  ------------------
 1444|      0|    {
 1445|       |      /* P2 is at infinity.  */
 1446|      0|      mpi_set (x3, p1->x);
  ------------------
  |  |  504|      0|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
 1447|      0|      mpi_set (y3, p1->y);
  ------------------
  |  |  504|      0|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
 1448|      0|      mpi_set (z3, p1->z);
  ------------------
  |  |  504|      0|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
 1449|      0|    }
 1450|   346k|  else
 1451|   346k|    {
 1452|   346k|      int z1_is_one = !mpi_cmp_ui (z1, 1);
  ------------------
  |  |  512|   346k|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
 1453|   346k|      int z2_is_one = !mpi_cmp_ui (z2, 1);
  ------------------
  |  |  512|   346k|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
 1454|       |
 1455|       |      /* l1 = x1 z2^2  */
 1456|       |      /* l2 = x2 z1^2  */
 1457|   346k|      if (z2_is_one)
  ------------------
  |  Branch (1457:11): [True: 344k, False: 1.77k]
  ------------------
 1458|   344k|        mpi_set (l1, x1);
  ------------------
  |  |  504|   344k|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
 1459|  1.77k|      else
 1460|  1.77k|        {
 1461|  1.77k|          ec_pow2 (l1, z2, ctx);
  ------------------
  |  | 1419|  1.77k|#define l1 (ctx->t.scratch[0])
  ------------------
                        ec_pow2 (l1, z2, ctx);
  ------------------
  |  | 1415|  1.77k|#define z2 (p2->z    )
  ------------------
 1462|  1.77k|          ec_mulm (l1, l1, x1, ctx);
  ------------------
  |  | 1419|  1.77k|#define l1 (ctx->t.scratch[0])
  ------------------
                        ec_mulm (l1, l1, x1, ctx);
  ------------------
  |  | 1419|  1.77k|#define l1 (ctx->t.scratch[0])
  ------------------
                        ec_mulm (l1, l1, x1, ctx);
  ------------------
  |  | 1410|  1.77k|#define x1 (p1->x    )
  ------------------
 1463|  1.77k|        }
 1464|   346k|      if (z1_is_one)
  ------------------
  |  Branch (1464:11): [True: 0, False: 346k]
  ------------------
 1465|      0|        mpi_set (l2, x2);
  ------------------
  |  |  504|      0|#define mpi_set( w, u)         _gcry_mpi_set( (w), (u) )
  ------------------
 1466|   346k|      else
 1467|   346k|        {
 1468|   346k|          ec_pow2 (l2, z1, ctx);
  ------------------
  |  | 1420|   346k|#define l2 (ctx->t.scratch[1])
  ------------------
                        ec_pow2 (l2, z1, ctx);
  ------------------
  |  | 1412|   346k|#define z1 (p1->z    )
  ------------------
 1469|   346k|          ec_mulm (l2, l2, x2, ctx);
  ------------------
  |  | 1420|   346k|#define l2 (ctx->t.scratch[1])
  ------------------
                        ec_mulm (l2, l2, x2, ctx);
  ------------------
  |  | 1420|   346k|#define l2 (ctx->t.scratch[1])
  ------------------
                        ec_mulm (l2, l2, x2, ctx);
  ------------------
  |  | 1413|   346k|#define x2 (p2->x    )
  ------------------
 1470|   346k|        }
 1471|       |      /* l3 = l1 - l2 */
 1472|   346k|      ec_subm (l3, l1, l2, ctx);
  ------------------
  |  | 1421|   346k|#define l3 (ctx->t.scratch[2])
  ------------------
                    ec_subm (l3, l1, l2, ctx);
  ------------------
  |  | 1419|   346k|#define l1 (ctx->t.scratch[0])
  ------------------
                    ec_subm (l3, l1, l2, ctx);
  ------------------
  |  | 1420|   346k|#define l2 (ctx->t.scratch[1])
  ------------------
 1473|       |      /* l4 = y1 z2^3  */
 1474|   346k|      ec_powm (l4, z2, mpi_const (MPI_C_THREE), ctx);
  ------------------
  |  | 1422|   346k|#define l4 (ctx->t.scratch[3])
  ------------------
                    ec_powm (l4, z2, mpi_const (MPI_C_THREE), ctx);
  ------------------
  |  | 1415|   346k|#define z2 (p2->z    )
  ------------------
                    ec_powm (l4, z2, mpi_const (MPI_C_THREE), ctx);
  ------------------
  |  |  120|   346k|#define mpi_const(n)          _gcry_mpi_const ((n))
  ------------------
 1475|   346k|      ec_mulm (l4, l4, y1, ctx);
  ------------------
  |  | 1422|   346k|#define l4 (ctx->t.scratch[3])
  ------------------
                    ec_mulm (l4, l4, y1, ctx);
  ------------------
  |  | 1422|   346k|#define l4 (ctx->t.scratch[3])
  ------------------
                    ec_mulm (l4, l4, y1, ctx);
  ------------------
  |  | 1411|   346k|#define y1 (p1->y    )
  ------------------
 1476|       |      /* l5 = y2 z1^3  */
 1477|   346k|      ec_powm (l5, z1, mpi_const (MPI_C_THREE), ctx);
  ------------------
  |  | 1423|   346k|#define l5 (ctx->t.scratch[4])
  ------------------
                    ec_powm (l5, z1, mpi_const (MPI_C_THREE), ctx);
  ------------------
  |  | 1412|   346k|#define z1 (p1->z    )
  ------------------
                    ec_powm (l5, z1, mpi_const (MPI_C_THREE), ctx);
  ------------------
  |  |  120|   346k|#define mpi_const(n)          _gcry_mpi_const ((n))
  ------------------
 1478|   346k|      ec_mulm (l5, l5, y2, ctx);
  ------------------
  |  | 1423|   346k|#define l5 (ctx->t.scratch[4])
  ------------------
                    ec_mulm (l5, l5, y2, ctx);
  ------------------
  |  | 1423|   346k|#define l5 (ctx->t.scratch[4])
  ------------------
                    ec_mulm (l5, l5, y2, ctx);
  ------------------
  |  | 1414|   346k|#define y2 (p2->y    )
  ------------------
 1479|       |      /* l6 = l4 - l5  */
 1480|   346k|      ec_subm (l6, l4, l5, ctx);
  ------------------
  |  | 1424|   346k|#define l6 (ctx->t.scratch[5])
  ------------------
                    ec_subm (l6, l4, l5, ctx);
  ------------------
  |  | 1422|   346k|#define l4 (ctx->t.scratch[3])
  ------------------
                    ec_subm (l6, l4, l5, ctx);
  ------------------
  |  | 1423|   346k|#define l5 (ctx->t.scratch[4])
  ------------------
 1481|       |
 1482|   346k|      if (!mpi_cmp_ui (l3, 0))
  ------------------
  |  |  512|   346k|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
  |  Branch (1482:11): [True: 0, False: 346k]
  ------------------
 1483|      0|        {
 1484|      0|          if (!mpi_cmp_ui (l6, 0))
  ------------------
  |  |  512|      0|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
  |  Branch (1484:15): [True: 0, False: 0]
  ------------------
 1485|      0|            {
 1486|       |              /* P1 and P2 are the same - use duplicate function.  */
 1487|      0|              _gcry_mpi_ec_dup_point (result, p1, ctx);
 1488|      0|            }
 1489|      0|          else
 1490|      0|            {
 1491|       |              /* P1 is the inverse of P2.  */
 1492|      0|              mpi_set_ui (x3, 1);
  ------------------
  |  |  505|      0|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
 1493|      0|              mpi_set_ui (y3, 1);
  ------------------
  |  |  505|      0|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
 1494|      0|              mpi_set_ui (z3, 0);
  ------------------
  |  |  505|      0|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
 1495|      0|            }
 1496|      0|        }
 1497|   346k|      else
 1498|   346k|        {
 1499|       |          /* l7 = l1 + l2  */
 1500|   346k|          ec_addm (l7, l1, l2, ctx);
  ------------------
  |  | 1425|   346k|#define l7 (ctx->t.scratch[6])
  ------------------
                        ec_addm (l7, l1, l2, ctx);
  ------------------
  |  | 1419|   346k|#define l1 (ctx->t.scratch[0])
  ------------------
                        ec_addm (l7, l1, l2, ctx);
  ------------------
  |  | 1420|   346k|#define l2 (ctx->t.scratch[1])
  ------------------
 1501|       |          /* l8 = l4 + l5  */
 1502|   346k|          ec_addm (l8, l4, l5, ctx);
  ------------------
  |  | 1426|   346k|#define l8 (ctx->t.scratch[7])
  ------------------
                        ec_addm (l8, l4, l5, ctx);
  ------------------
  |  | 1422|   346k|#define l4 (ctx->t.scratch[3])
  ------------------
                        ec_addm (l8, l4, l5, ctx);
  ------------------
  |  | 1423|   346k|#define l5 (ctx->t.scratch[4])
  ------------------
 1503|       |          /* z3 = z1 z2 l3  */
 1504|   346k|          ec_mulm (z3, z1, z2, ctx);
  ------------------
  |  | 1418|   346k|#define z3 (result->z)
  ------------------
                        ec_mulm (z3, z1, z2, ctx);
  ------------------
  |  | 1412|   346k|#define z1 (p1->z    )
  ------------------
                        ec_mulm (z3, z1, z2, ctx);
  ------------------
  |  | 1415|   346k|#define z2 (p2->z    )
  ------------------
 1505|   346k|          ec_mulm (z3, z3, l3, ctx);
  ------------------
  |  | 1418|   346k|#define z3 (result->z)
  ------------------
                        ec_mulm (z3, z3, l3, ctx);
  ------------------
  |  | 1418|   346k|#define z3 (result->z)
  ------------------
                        ec_mulm (z3, z3, l3, ctx);
  ------------------
  |  | 1421|   346k|#define l3 (ctx->t.scratch[2])
  ------------------
 1506|       |          /* x3 = l6^2 - l7 l3^2  */
 1507|   346k|          ec_pow2 (t1, l6, ctx);
  ------------------
  |  | 1428|   346k|#define t1 (ctx->t.scratch[9])
  ------------------
                        ec_pow2 (t1, l6, ctx);
  ------------------
  |  | 1424|   346k|#define l6 (ctx->t.scratch[5])
  ------------------
 1508|   346k|          ec_pow2 (t2, l3, ctx);
  ------------------
  |  | 1429|   346k|#define t2 (ctx->t.scratch[10])
  ------------------
                        ec_pow2 (t2, l3, ctx);
  ------------------
  |  | 1421|   346k|#define l3 (ctx->t.scratch[2])
  ------------------
 1509|   346k|          ec_mulm (t2, t2, l7, ctx);
  ------------------
  |  | 1429|   346k|#define t2 (ctx->t.scratch[10])
  ------------------
                        ec_mulm (t2, t2, l7, ctx);
  ------------------
  |  | 1429|   346k|#define t2 (ctx->t.scratch[10])
  ------------------
                        ec_mulm (t2, t2, l7, ctx);
  ------------------
  |  | 1425|   346k|#define l7 (ctx->t.scratch[6])
  ------------------
 1510|   346k|          ec_subm (x3, t1, t2, ctx);
  ------------------
  |  | 1416|   346k|#define x3 (result->x)
  ------------------
                        ec_subm (x3, t1, t2, ctx);
  ------------------
  |  | 1428|   346k|#define t1 (ctx->t.scratch[9])
  ------------------
                        ec_subm (x3, t1, t2, ctx);
  ------------------
  |  | 1429|   346k|#define t2 (ctx->t.scratch[10])
  ------------------
 1511|       |          /* l9 = l7 l3^2 - 2 x3  */
 1512|   346k|          ec_mul2 (t1, x3, ctx);
  ------------------
  |  | 1428|   346k|#define t1 (ctx->t.scratch[9])
  ------------------
                        ec_mul2 (t1, x3, ctx);
  ------------------
  |  | 1416|   346k|#define x3 (result->x)
  ------------------
 1513|   346k|          ec_subm (l9, t2, t1, ctx);
  ------------------
  |  | 1427|   346k|#define l9 (ctx->t.scratch[8])
  ------------------
                        ec_subm (l9, t2, t1, ctx);
  ------------------
  |  | 1429|   346k|#define t2 (ctx->t.scratch[10])
  ------------------
                        ec_subm (l9, t2, t1, ctx);
  ------------------
  |  | 1428|   346k|#define t1 (ctx->t.scratch[9])
  ------------------
 1514|       |          /* y3 = (l9 l6 - l8 l3^3)/2  */
 1515|   346k|          ec_mulm (l9, l9, l6, ctx);
  ------------------
  |  | 1427|   346k|#define l9 (ctx->t.scratch[8])
  ------------------
                        ec_mulm (l9, l9, l6, ctx);
  ------------------
  |  | 1427|   346k|#define l9 (ctx->t.scratch[8])
  ------------------
                        ec_mulm (l9, l9, l6, ctx);
  ------------------
  |  | 1424|   346k|#define l6 (ctx->t.scratch[5])
  ------------------
 1516|   346k|          ec_powm (t1, l3, mpi_const (MPI_C_THREE), ctx); /* fixme: Use saved value*/
  ------------------
  |  | 1428|   346k|#define t1 (ctx->t.scratch[9])
  ------------------
                        ec_powm (t1, l3, mpi_const (MPI_C_THREE), ctx); /* fixme: Use saved value*/
  ------------------
  |  | 1421|   346k|#define l3 (ctx->t.scratch[2])
  ------------------
                        ec_powm (t1, l3, mpi_const (MPI_C_THREE), ctx); /* fixme: Use saved value*/
  ------------------
  |  |  120|   346k|#define mpi_const(n)          _gcry_mpi_const ((n))
  ------------------
 1517|   346k|          ec_mulm (t1, t1, l8, ctx);
  ------------------
  |  | 1428|   346k|#define t1 (ctx->t.scratch[9])
  ------------------
                        ec_mulm (t1, t1, l8, ctx);
  ------------------
  |  | 1428|   346k|#define t1 (ctx->t.scratch[9])
  ------------------
                        ec_mulm (t1, t1, l8, ctx);
  ------------------
  |  | 1426|   346k|#define l8 (ctx->t.scratch[7])
  ------------------
 1518|   346k|          ec_subm (y3, l9, t1, ctx);
  ------------------
  |  | 1417|   346k|#define y3 (result->y)
  ------------------
                        ec_subm (y3, l9, t1, ctx);
  ------------------
  |  | 1427|   346k|#define l9 (ctx->t.scratch[8])
  ------------------
                        ec_subm (y3, l9, t1, ctx);
  ------------------
  |  | 1428|   346k|#define t1 (ctx->t.scratch[9])
  ------------------
 1519|   346k|          ec_mulm (y3, y3, ec_get_two_inv_p (ctx), ctx);
  ------------------
  |  | 1417|   346k|#define y3 (result->y)
  ------------------
                        ec_mulm (y3, y3, ec_get_two_inv_p (ctx), ctx);
  ------------------
  |  | 1417|   346k|#define y3 (result->y)
  ------------------
 1520|   346k|        }
 1521|   346k|    }
 1522|       |
 1523|   346k|#undef x1
 1524|   346k|#undef y1
 1525|   346k|#undef z1
 1526|   346k|#undef x2
 1527|   346k|#undef y2
 1528|   346k|#undef z2
 1529|   346k|#undef x3
 1530|   346k|#undef y3
 1531|   346k|#undef z3
 1532|   346k|#undef l1
 1533|   346k|#undef l2
 1534|   346k|#undef l3
 1535|   346k|#undef l4
 1536|   346k|#undef l5
 1537|   346k|#undef l6
 1538|   346k|#undef l7
 1539|   346k|#undef l8
 1540|   346k|#undef l9
 1541|   346k|#undef t1
 1542|   346k|#undef t2
 1543|   346k|}
ec.c:ec_get_two_inv_p:
  757|   346k|{
  758|   346k|  if (!ec->t.valid.two_inv_p)
  ------------------
  |  Branch (758:7): [True: 1.93k, False: 344k]
  ------------------
  759|  1.93k|    {
  760|  1.93k|      ec->t.valid.two_inv_p = 1;
  761|  1.93k|      if (!ec->t.two_inv_p)
  ------------------
  |  Branch (761:11): [True: 1.93k, False: 0]
  ------------------
  762|  1.93k|        ec->t.two_inv_p = mpi_alloc (0);
  ------------------
  |  |   97|  1.93k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  763|  1.93k|      ec_invm (ec->t.two_inv_p, mpi_const (MPI_C_TWO), ec);
  ------------------
  |  |  120|  1.93k|#define mpi_const(n)          _gcry_mpi_const ((n))
  ------------------
  764|  1.93k|    }
  765|   346k|  return ec->t.two_inv_p;
  766|   346k|}
ec.c:add_points_edwards:
 1566|  1.41M|{
 1567|  1.41M|#define X1 (p1->x)
 1568|  1.41M|#define Y1 (p1->y)
 1569|  1.41M|#define Z1 (p1->z)
 1570|  1.41M|#define X2 (p2->x)
 1571|  1.41M|#define Y2 (p2->y)
 1572|  1.41M|#define Z2 (p2->z)
 1573|  1.41M|#define X3 (result->x)
 1574|  1.41M|#define Y3 (result->y)
 1575|  1.41M|#define Z3 (result->z)
 1576|  1.41M|#define A (ctx->t.scratch[0])
 1577|  1.41M|#define B (ctx->t.scratch[1])
 1578|  1.41M|#define C (ctx->t.scratch[2])
 1579|  1.41M|#define D (ctx->t.scratch[3])
 1580|  1.41M|#define E (ctx->t.scratch[4])
 1581|  1.41M|#define F (ctx->t.scratch[5])
 1582|  1.41M|#define G (ctx->t.scratch[6])
 1583|  1.41M|#define tmp (ctx->t.scratch[7])
 1584|       |
 1585|  1.41M|  mpi_point_resize (result, ctx);
  ------------------
  |  |  550|  1.41M|#define mpi_point_resize(p,ctx) _gcry_mpi_ec_point_resize (p, ctx)
  ------------------
 1586|       |
 1587|       |  /* Compute: (X_3 : Y_3 : Z_3) = (X_1 : Y_1 : Z_1) + (X_2 : Y_2 : Z_3)  */
 1588|       |
 1589|       |  /* A = Z1 · Z2 */
 1590|  1.41M|  ctx->mulm (A, Z1, Z2, ctx);
  ------------------
  |  | 1576|  1.41M|#define A (ctx->t.scratch[0])
  ------------------
                ctx->mulm (A, Z1, Z2, ctx);
  ------------------
  |  | 1569|  1.41M|#define Z1 (p1->z)
  ------------------
                ctx->mulm (A, Z1, Z2, ctx);
  ------------------
  |  | 1572|  1.41M|#define Z2 (p2->z)
  ------------------
 1591|       |
 1592|       |  /* B = A^2 */
 1593|  1.41M|  ctx->pow2 (B, A, ctx);
  ------------------
  |  | 1577|  1.41M|#define B (ctx->t.scratch[1])
  ------------------
                ctx->pow2 (B, A, ctx);
  ------------------
  |  | 1576|  1.41M|#define A (ctx->t.scratch[0])
  ------------------
 1594|       |
 1595|       |  /* C = X1 · X2 */
 1596|  1.41M|  ctx->mulm (C, X1, X2, ctx);
  ------------------
  |  | 1578|  1.41M|#define C (ctx->t.scratch[2])
  ------------------
                ctx->mulm (C, X1, X2, ctx);
  ------------------
  |  | 1567|  1.41M|#define X1 (p1->x)
  ------------------
                ctx->mulm (C, X1, X2, ctx);
  ------------------
  |  | 1570|  1.41M|#define X2 (p2->x)
  ------------------
 1597|       |
 1598|       |  /* D = Y1 · Y2 */
 1599|  1.41M|  ctx->mulm (D, Y1, Y2, ctx);
  ------------------
  |  | 1579|  1.41M|#define D (ctx->t.scratch[3])
  ------------------
                ctx->mulm (D, Y1, Y2, ctx);
  ------------------
  |  | 1568|  1.41M|#define Y1 (p1->y)
  ------------------
                ctx->mulm (D, Y1, Y2, ctx);
  ------------------
  |  | 1571|  1.41M|#define Y2 (p2->y)
  ------------------
 1600|       |
 1601|       |  /* E = d · C · D */
 1602|  1.41M|  ctx->mulm (E, ctx->b, C, ctx);
  ------------------
  |  | 1580|  1.41M|#define E (ctx->t.scratch[4])
  ------------------
                ctx->mulm (E, ctx->b, C, ctx);
  ------------------
  |  | 1578|  1.41M|#define C (ctx->t.scratch[2])
  ------------------
 1603|  1.41M|  ctx->mulm (E, E, D, ctx);
  ------------------
  |  | 1580|  1.41M|#define E (ctx->t.scratch[4])
  ------------------
                ctx->mulm (E, E, D, ctx);
  ------------------
  |  | 1580|  1.41M|#define E (ctx->t.scratch[4])
  ------------------
                ctx->mulm (E, E, D, ctx);
  ------------------
  |  | 1579|  1.41M|#define D (ctx->t.scratch[3])
  ------------------
 1604|       |
 1605|       |  /* F = B - E */
 1606|  1.41M|  ctx->subm (F, B, E, ctx);
  ------------------
  |  | 1581|  1.41M|#define F (ctx->t.scratch[5])
  ------------------
                ctx->subm (F, B, E, ctx);
  ------------------
  |  | 1577|  1.41M|#define B (ctx->t.scratch[1])
  ------------------
                ctx->subm (F, B, E, ctx);
  ------------------
  |  | 1580|  1.41M|#define E (ctx->t.scratch[4])
  ------------------
 1607|       |
 1608|       |  /* G = B + E */
 1609|  1.41M|  ctx->addm (G, B, E, ctx);
  ------------------
  |  | 1582|  1.41M|#define G (ctx->t.scratch[6])
  ------------------
                ctx->addm (G, B, E, ctx);
  ------------------
  |  | 1577|  1.41M|#define B (ctx->t.scratch[1])
  ------------------
                ctx->addm (G, B, E, ctx);
  ------------------
  |  | 1580|  1.41M|#define E (ctx->t.scratch[4])
  ------------------
 1610|       |
 1611|       |  /* X_3 = A · F · ((X_1 + Y_1) · (X_2 + Y_2) - C - D) */
 1612|  1.41M|  ctx->addm (tmp, X1, Y1, ctx);
  ------------------
  |  | 1583|  1.41M|#define tmp (ctx->t.scratch[7])
  ------------------
                ctx->addm (tmp, X1, Y1, ctx);
  ------------------
  |  | 1567|  1.41M|#define X1 (p1->x)
  ------------------
                ctx->addm (tmp, X1, Y1, ctx);
  ------------------
  |  | 1568|  1.41M|#define Y1 (p1->y)
  ------------------
 1613|  1.41M|  ctx->addm (X3, X2, Y2, ctx);
  ------------------
  |  | 1573|  1.41M|#define X3 (result->x)
  ------------------
                ctx->addm (X3, X2, Y2, ctx);
  ------------------
  |  | 1570|  1.41M|#define X2 (p2->x)
  ------------------
                ctx->addm (X3, X2, Y2, ctx);
  ------------------
  |  | 1571|  1.41M|#define Y2 (p2->y)
  ------------------
 1614|  1.41M|  ctx->mulm (X3, X3, tmp, ctx);
  ------------------
  |  | 1573|  1.41M|#define X3 (result->x)
  ------------------
                ctx->mulm (X3, X3, tmp, ctx);
  ------------------
  |  | 1573|  1.41M|#define X3 (result->x)
  ------------------
                ctx->mulm (X3, X3, tmp, ctx);
  ------------------
  |  | 1583|  1.41M|#define tmp (ctx->t.scratch[7])
  ------------------
 1615|  1.41M|  ctx->subm (X3, X3, C, ctx);
  ------------------
  |  | 1573|  1.41M|#define X3 (result->x)
  ------------------
                ctx->subm (X3, X3, C, ctx);
  ------------------
  |  | 1573|  1.41M|#define X3 (result->x)
  ------------------
                ctx->subm (X3, X3, C, ctx);
  ------------------
  |  | 1578|  1.41M|#define C (ctx->t.scratch[2])
  ------------------
 1616|  1.41M|  ctx->subm (X3, X3, D, ctx);
  ------------------
  |  | 1573|  1.41M|#define X3 (result->x)
  ------------------
                ctx->subm (X3, X3, D, ctx);
  ------------------
  |  | 1573|  1.41M|#define X3 (result->x)
  ------------------
                ctx->subm (X3, X3, D, ctx);
  ------------------
  |  | 1579|  1.41M|#define D (ctx->t.scratch[3])
  ------------------
 1617|  1.41M|  ctx->mulm (X3, X3, F, ctx);
  ------------------
  |  | 1573|  1.41M|#define X3 (result->x)
  ------------------
                ctx->mulm (X3, X3, F, ctx);
  ------------------
  |  | 1573|  1.41M|#define X3 (result->x)
  ------------------
                ctx->mulm (X3, X3, F, ctx);
  ------------------
  |  | 1581|  1.41M|#define F (ctx->t.scratch[5])
  ------------------
 1618|  1.41M|  ctx->mulm (X3, X3, A, ctx);
  ------------------
  |  | 1573|  1.41M|#define X3 (result->x)
  ------------------
                ctx->mulm (X3, X3, A, ctx);
  ------------------
  |  | 1573|  1.41M|#define X3 (result->x)
  ------------------
                ctx->mulm (X3, X3, A, ctx);
  ------------------
  |  | 1576|  1.41M|#define A (ctx->t.scratch[0])
  ------------------
 1619|       |
 1620|       |  /* Y_3 = A · G · (D - aC) */
 1621|  1.41M|  if (ctx->dialect == ECC_DIALECT_ED25519)
  ------------------
  |  Branch (1621:7): [True: 1.41M, False: 0]
  ------------------
 1622|  1.41M|    {
 1623|  1.41M|      ctx->addm (Y3, D, C, ctx);
  ------------------
  |  | 1574|  1.41M|#define Y3 (result->y)
  ------------------
                    ctx->addm (Y3, D, C, ctx);
  ------------------
  |  | 1579|  1.41M|#define D (ctx->t.scratch[3])
  ------------------
                    ctx->addm (Y3, D, C, ctx);
  ------------------
  |  | 1578|  1.41M|#define C (ctx->t.scratch[2])
  ------------------
 1624|  1.41M|    }
 1625|      0|  else
 1626|      0|    {
 1627|      0|      ctx->mulm (Y3, ctx->a, C, ctx);
  ------------------
  |  | 1574|      0|#define Y3 (result->y)
  ------------------
                    ctx->mulm (Y3, ctx->a, C, ctx);
  ------------------
  |  | 1578|      0|#define C (ctx->t.scratch[2])
  ------------------
 1628|      0|      ctx->subm (Y3, D, Y3, ctx);
  ------------------
  |  | 1574|      0|#define Y3 (result->y)
  ------------------
                    ctx->subm (Y3, D, Y3, ctx);
  ------------------
  |  | 1579|      0|#define D (ctx->t.scratch[3])
  ------------------
                    ctx->subm (Y3, D, Y3, ctx);
  ------------------
  |  | 1574|      0|#define Y3 (result->y)
  ------------------
 1629|      0|    }
 1630|  1.41M|  ctx->mulm (Y3, Y3, G, ctx);
  ------------------
  |  | 1574|  1.41M|#define Y3 (result->y)
  ------------------
                ctx->mulm (Y3, Y3, G, ctx);
  ------------------
  |  | 1574|  1.41M|#define Y3 (result->y)
  ------------------
                ctx->mulm (Y3, Y3, G, ctx);
  ------------------
  |  | 1582|  1.41M|#define G (ctx->t.scratch[6])
  ------------------
 1631|  1.41M|  ctx->mulm (Y3, Y3, A, ctx);
  ------------------
  |  | 1574|  1.41M|#define Y3 (result->y)
  ------------------
                ctx->mulm (Y3, Y3, A, ctx);
  ------------------
  |  | 1574|  1.41M|#define Y3 (result->y)
  ------------------
                ctx->mulm (Y3, Y3, A, ctx);
  ------------------
  |  | 1576|  1.41M|#define A (ctx->t.scratch[0])
  ------------------
 1632|       |
 1633|       |  /* Z_3 = F · G */
 1634|  1.41M|  ctx->mulm (Z3, F, G, ctx);
  ------------------
  |  | 1575|  1.41M|#define Z3 (result->z)
  ------------------
                ctx->mulm (Z3, F, G, ctx);
  ------------------
  |  | 1581|  1.41M|#define F (ctx->t.scratch[5])
  ------------------
                ctx->mulm (Z3, F, G, ctx);
  ------------------
  |  | 1582|  1.41M|#define G (ctx->t.scratch[6])
  ------------------
 1635|       |
 1636|       |
 1637|  1.41M|#undef X1
 1638|  1.41M|#undef Y1
 1639|  1.41M|#undef Z1
 1640|  1.41M|#undef X2
 1641|  1.41M|#undef Y2
 1642|  1.41M|#undef Z2
 1643|  1.41M|#undef X3
 1644|  1.41M|#undef Y3
 1645|  1.41M|#undef Z3
 1646|  1.41M|#undef A
 1647|  1.41M|#undef B
 1648|  1.41M|#undef C
 1649|  1.41M|#undef D
 1650|  1.41M|#undef E
 1651|  1.41M|#undef F
 1652|  1.41M|#undef G
 1653|  1.41M|#undef tmp
 1654|  1.41M|}
ec.c:ec_subm:
  293|  5.59M|{
  294|  5.59M|  mpi_sub (w, u, v);
  ------------------
  |  |  519|  5.59M|#define mpi_sub(w,u,v)         _gcry_mpi_sub ((w),(u),(v))
  ------------------
  295|  8.39M|  while (w->sign)
  ------------------
  |  Branch (295:10): [True: 2.79M, False: 5.59M]
  ------------------
  296|  2.79M|    mpi_add (w, w, ec->p);
  ------------------
  |  |  516|  2.79M|#define mpi_add(w,u,v)         _gcry_mpi_add ((w),(u),(v))
  ------------------
  297|       |  /*ctx->mod (w, ec);*/
  298|  5.59M|}
ec.c:ec_pow2:
  329|  5.21M|{
  330|       |  /* Using mpi_mul is slightly faster (at least on amd64).  */
  331|       |  /* mpi_powm (w, b, mpi_const (MPI_C_TWO), ctx->p); */
  332|  5.21M|  ec_mulm (w, b, b, ctx);
  333|  5.21M|}
ec.c:ec_pow3:
  341|  2.70k|{
  342|  2.70k|  mpi_powm (w, b, mpi_const (MPI_C_THREE), ctx->p);
  ------------------
  |  |  525|  2.70k|#define mpi_powm(w,b,e,m)      _gcry_mpi_powm ( (w), (b), (e), (m) )
  ------------------
  343|  2.70k|}
ec.c:ec_addm:
  286|  1.74M|{
  287|  1.74M|  mpi_add (w, u, v);
  ------------------
  |  |  516|  1.74M|#define mpi_add(w,u,v)         _gcry_mpi_add ((w),(u),(v))
  ------------------
  288|  1.74M|  ctx->mod (w, ctx);
  289|  1.74M|}
ec.c:ec_powm:
  318|  1.35M|{
  319|  1.35M|  mpi_powm (w, b, e, ctx->p);
  ------------------
  |  |  525|  1.35M|#define mpi_powm(w,b,e,m)      _gcry_mpi_powm ( (w), (b), (e), (m) )
  ------------------
  320|       |  /* _gcry_mpi_abs (w); */
  321|  1.35M|}

_gcry_mpi_add_ui:
   40|  4.59k|{
   41|  4.59k|    mpi_ptr_t wp, up;
   42|  4.59k|    mpi_size_t usize, wsize;
   43|  4.59k|    int usign, wsign;
   44|       |
   45|  4.59k|    usize = u->nlimbs;
   46|  4.59k|    usign = u->sign;
   47|  4.59k|    wsign = 0;
   48|       |
   49|       |    /* If not space for W (and possible carry), increase space.  */
   50|  4.59k|    wsize = usize + 1;
   51|  4.59k|    if( w->alloced < wsize )
  ------------------
  |  Branch (51:9): [True: 0, False: 4.59k]
  ------------------
   52|      0|	mpi_resize(w, wsize);
  ------------------
  |  |  100|      0|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
   53|       |
   54|       |    /* These must be after realloc (U may be the same as W).  */
   55|  4.59k|    up = u->d;
   56|  4.59k|    wp = w->d;
   57|       |
   58|  4.59k|    if( !usize ) {  /* simple */
  ------------------
  |  Branch (58:9): [True: 0, False: 4.59k]
  ------------------
   59|      0|	wp[0] = v;
   60|      0|	wsize = v? 1:0;
  ------------------
  |  Branch (60:10): [True: 0, False: 0]
  ------------------
   61|      0|    }
   62|  4.59k|    else if( !usign ) {  /* mpi is not negative */
  ------------------
  |  Branch (62:14): [True: 4.59k, False: 0]
  ------------------
   63|  4.59k|	mpi_limb_t cy;
   64|  4.59k|	cy = _gcry_mpih_add_1(wp, up, usize, v);
   65|  4.59k|	wp[usize] = cy;
   66|  4.59k|	wsize = usize + cy;
   67|  4.59k|    }
   68|      0|    else {  /* The signs are different.  Need exact comparison to determine
   69|       |	     * which operand to subtract from which.  */
   70|      0|	if( usize == 1 && up[0] < v ) {
  ------------------
  |  Branch (70:6): [True: 0, False: 0]
  |  Branch (70:20): [True: 0, False: 0]
  ------------------
   71|      0|	    wp[0] = v - up[0];
   72|      0|	    wsize = 1;
   73|      0|	}
   74|      0|	else {
   75|      0|	    _gcry_mpih_sub_1(wp, up, usize, v);
   76|       |	    /* Size can decrease with at most one limb. */
   77|      0|	    wsize = usize - (wp[usize-1]==0);
   78|      0|	    wsign = 1;
   79|      0|	}
   80|      0|    }
   81|       |
   82|  4.59k|    w->nlimbs = wsize;
   83|  4.59k|    w->sign   = wsign;
   84|  4.59k|}
_gcry_mpi_add:
   89|  10.1M|{
   90|  10.1M|    mpi_ptr_t wp, up, vp;
   91|  10.1M|    mpi_size_t usize, vsize, wsize;
   92|  10.1M|    int usign, vsign, wsign;
   93|       |
   94|  10.1M|    if( u->nlimbs < v->nlimbs ) { /* Swap U and V. */
  ------------------
  |  Branch (94:9): [True: 7.24k, False: 10.1M]
  ------------------
   95|  7.24k|	usize = v->nlimbs;
   96|  7.24k|	usign = v->sign;
   97|  7.24k|	vsize = u->nlimbs;
   98|  7.24k|	vsign = u->sign;
   99|  7.24k|	wsize = usize + 1;
  100|  7.24k|	RESIZE_IF_NEEDED(w, wsize);
  ------------------
  |  |   78|  7.24k|    do {			   \
  |  |   79|  7.24k|	if( (a)->alloced < (b) )   \
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 6, False: 7.23k]
  |  |  ------------------
  |  |   80|  7.24k|	    mpi_resize((a), (b));  \
  |  |  ------------------
  |  |  |  |  100|      6|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  |  |  ------------------
  |  |   81|  7.24k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (81:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  101|       |	/* These must be after realloc (u or v may be the same as w).  */
  102|  7.24k|	up    = v->d;
  103|  7.24k|	vp    = u->d;
  104|  7.24k|    }
  105|  10.1M|    else {
  106|  10.1M|	usize = u->nlimbs;
  107|  10.1M|	usign = u->sign;
  108|  10.1M|	vsize = v->nlimbs;
  109|  10.1M|	vsign = v->sign;
  110|  10.1M|	wsize = usize + 1;
  111|  10.1M|	RESIZE_IF_NEEDED(w, wsize);
  ------------------
  |  |   78|  10.1M|    do {			   \
  |  |   79|  10.1M|	if( (a)->alloced < (b) )   \
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 26.3k, False: 10.1M]
  |  |  ------------------
  |  |   80|  10.1M|	    mpi_resize((a), (b));  \
  |  |  ------------------
  |  |  |  |  100|  26.3k|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  |  |  ------------------
  |  |   81|  10.1M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (81:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  112|       |	/* These must be after realloc (u or v may be the same as w).  */
  113|  10.1M|	up    = u->d;
  114|  10.1M|	vp    = v->d;
  115|  10.1M|    }
  116|  10.1M|    wp = w->d;
  117|  10.1M|    wsign = 0;
  118|       |
  119|  10.1M|    if( !vsize ) {  /* simple */
  ------------------
  |  Branch (119:9): [True: 304k, False: 9.83M]
  ------------------
  120|   304k|	MPN_COPY(wp, up, usize );
  ------------------
  |  |   90|   304k|    do {				\
  |  |   91|   304k|	mpi_size_t _i;			\
  |  |   92|  1.52M|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 1.21M, False: 304k]
  |  |  ------------------
  |  |   93|  1.21M|	    (d)[_i] = (s)[_i];		\
  |  |   94|   304k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  121|   304k|	wsize = usize;
  122|   304k|	wsign = usign;
  123|   304k|    }
  124|  9.83M|    else if( usign != vsign ) { /* different sign */
  ------------------
  |  Branch (124:14): [True: 8.40M, False: 1.43M]
  ------------------
  125|       |	/* This test is right since USIZE >= VSIZE */
  126|  8.40M|	if( usize != vsize ) {
  ------------------
  |  Branch (126:6): [True: 10.2k, False: 8.39M]
  ------------------
  127|  10.2k|	    _gcry_mpih_sub(wp, up, usize, vp, vsize);
  128|  10.2k|	    wsize = usize;
  129|  10.2k|	    MPN_NORMALIZE(wp, wsize);
  ------------------
  |  |  119|  10.2k|    do {		       \
  |  |  120|  10.3k|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 10.3k, False: 0]
  |  |  ------------------
  |  |  121|  10.3k|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 10.2k, False: 20]
  |  |  ------------------
  |  |  122|  10.3k|		break;	       \
  |  |  123|  10.3k|	    (n)--;	       \
  |  |  124|     20|	}		       \
  |  |  125|  10.2k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  130|  10.2k|	    wsign = usign;
  131|  10.2k|	}
  132|  8.39M|	else if( _gcry_mpih_cmp(up, vp, usize) < 0 ) {
  ------------------
  |  Branch (132:11): [True: 5.58M, False: 2.80M]
  ------------------
  133|  5.58M|	    _gcry_mpih_sub_n(wp, vp, up, usize);
  134|  5.58M|	    wsize = usize;
  135|  5.58M|	    MPN_NORMALIZE(wp, wsize);
  ------------------
  |  |  119|  5.58M|    do {		       \
  |  |  120|  5.58M|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 5.58M, False: 0]
  |  |  ------------------
  |  |  121|  5.58M|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 5.58M, False: 2.21k]
  |  |  ------------------
  |  |  122|  5.58M|		break;	       \
  |  |  123|  5.58M|	    (n)--;	       \
  |  |  124|  2.21k|	}		       \
  |  |  125|  5.58M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  136|  5.58M|	    if( !usign )
  ------------------
  |  Branch (136:10): [True: 2.79M, False: 2.79M]
  ------------------
  137|  2.79M|		wsign = 1;
  138|  5.58M|	}
  139|  2.80M|	else {
  140|  2.80M|	    _gcry_mpih_sub_n(wp, up, vp, usize);
  141|  2.80M|	    wsize = usize;
  142|  2.80M|	    MPN_NORMALIZE(wp, wsize);
  ------------------
  |  |  119|  2.80M|    do {		       \
  |  |  120|  2.81M|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 2.81M, False: 0]
  |  |  ------------------
  |  |  121|  2.81M|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 2.80M, False: 3.32k]
  |  |  ------------------
  |  |  122|  2.81M|		break;	       \
  |  |  123|  2.81M|	    (n)--;	       \
  |  |  124|  3.32k|	}		       \
  |  |  125|  2.80M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  143|  2.80M|	    if( usign )
  ------------------
  |  Branch (143:10): [True: 0, False: 2.80M]
  ------------------
  144|      0|		wsign = 1;
  145|  2.80M|	}
  146|  8.40M|    }
  147|  1.43M|    else { /* U and V have same sign. Add them. */
  148|  1.43M|	mpi_limb_t cy = _gcry_mpih_add(wp, up, usize, vp, vsize);
  149|  1.43M|	wp[usize] = cy;
  150|  1.43M|	wsize = usize + cy;
  151|  1.43M|	if( usign )
  ------------------
  |  Branch (151:6): [True: 0, False: 1.43M]
  ------------------
  152|      0|	    wsign = 1;
  153|  1.43M|    }
  154|       |
  155|  10.1M|    w->nlimbs = wsize;
  156|  10.1M|    w->sign = wsign;
  157|  10.1M|}
_gcry_mpi_sub_ui:
  166|  6.52k|{
  167|  6.52k|    mpi_ptr_t wp, up;
  168|  6.52k|    mpi_size_t usize, wsize;
  169|  6.52k|    int usign, wsign;
  170|       |
  171|  6.52k|    usize = u->nlimbs;
  172|  6.52k|    usign = u->sign;
  173|  6.52k|    wsign = 0;
  174|       |
  175|       |    /* If not space for W (and possible carry), increase space.  */
  176|  6.52k|    wsize = usize + 1;
  177|  6.52k|    if( w->alloced < wsize )
  ------------------
  |  Branch (177:9): [True: 1.93k, False: 4.59k]
  ------------------
  178|  1.93k|	mpi_resize(w, wsize);
  ------------------
  |  |  100|  1.93k|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
  179|       |
  180|       |    /* These must be after realloc (U may be the same as W).  */
  181|  6.52k|    up = u->d;
  182|  6.52k|    wp = w->d;
  183|       |
  184|  6.52k|    if( !usize ) {  /* simple */
  ------------------
  |  Branch (184:9): [True: 0, False: 6.52k]
  ------------------
  185|      0|	wp[0] = v;
  186|      0|	wsize = v? 1:0;
  ------------------
  |  Branch (186:10): [True: 0, False: 0]
  ------------------
  187|      0|	wsign = 1;
  188|      0|    }
  189|  6.52k|    else if( usign ) {	/* mpi and v are negative */
  ------------------
  |  Branch (189:14): [True: 0, False: 6.52k]
  ------------------
  190|      0|	mpi_limb_t cy;
  191|      0|	cy = _gcry_mpih_add_1(wp, up, usize, v);
  192|      0|	wp[usize] = cy;
  193|      0|	wsize = usize + cy;
  194|      0|	wsign = 1;
  195|      0|    }
  196|  6.52k|    else {  /* The signs are different.  Need exact comparison to determine
  197|       |	     * which operand to subtract from which.  */
  198|  6.52k|	if( usize == 1 && up[0] < v ) {
  ------------------
  |  Branch (198:6): [True: 0, False: 6.52k]
  |  Branch (198:20): [True: 0, False: 0]
  ------------------
  199|      0|	    wp[0] = v - up[0];
  200|      0|	    wsize = 1;
  201|      0|	    wsign = 1;
  202|      0|	}
  203|  6.52k|	else {
  204|  6.52k|	    _gcry_mpih_sub_1(wp, up, usize, v);
  205|       |	    /* Size can decrease with at most one limb. */
  206|  6.52k|	    wsize = usize - (wp[usize-1]==0);
  207|  6.52k|	}
  208|  6.52k|    }
  209|       |
  210|  6.52k|    w->nlimbs = wsize;
  211|  6.52k|    w->sign   = wsign;
  212|  6.52k|}
_gcry_mpi_sub:
  216|  5.60M|{
  217|  5.60M|  gcry_mpi_t vv = mpi_copy (v);
  ------------------
  |  |  101|  5.60M|# define mpi_copy(a)	       _gcry_mpi_copy((a))
  ------------------
  218|  5.60M|  vv->sign = ! vv->sign;
  219|  5.60M|  mpi_add (w, u, vv);
  ------------------
  |  |  516|  5.60M|#define mpi_add(w,u,v)         _gcry_mpi_add ((w),(u),(v))
  ------------------
  220|  5.60M|  mpi_free (vv);
  ------------------
  |  |   99|  5.60M|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  221|  5.60M|}

_gcry_mpi_normalize:
   57|  5.12M|{
   58|  5.12M|    if( mpi_is_opaque(a) )
  ------------------
  |  |  114|  5.12M|#define mpi_is_opaque(a)      ((a) && ((a)->flags&4))
  |  |  ------------------
  |  |  |  Branch (114:32): [True: 5.12M, False: 0]
  |  |  |  Branch (114:39): [True: 0, False: 5.12M]
  |  |  ------------------
  ------------------
   59|      0|	return;
   60|       |
   61|  5.16M|    for( ; a->nlimbs && !a->d[a->nlimbs-1]; a->nlimbs-- )
  ------------------
  |  Branch (61:12): [True: 5.09M, False: 68.1k]
  |  Branch (61:25): [True: 32.9k, False: 5.06M]
  ------------------
   62|  32.9k|	;
   63|  5.12M|}
_gcry_mpi_get_nbits:
   72|   223k|{
   73|   223k|    unsigned n;
   74|       |
   75|   223k|    if( mpi_is_opaque(a) ) {
  ------------------
  |  |  114|   223k|#define mpi_is_opaque(a)      ((a) && ((a)->flags&4))
  |  |  ------------------
  |  |  |  Branch (114:32): [True: 223k, False: 0]
  |  |  |  Branch (114:39): [True: 10.1k, False: 213k]
  |  |  ------------------
  ------------------
   76|  10.1k|	return a->sign; /* which holds the number of bits */
   77|  10.1k|    }
   78|       |
   79|   213k|    _gcry_mpi_normalize( a );
   80|   213k|    if( a->nlimbs ) {
  ------------------
  |  Branch (80:9): [True: 183k, False: 30.2k]
  ------------------
   81|   183k|	mpi_limb_t alimb = a->d[a->nlimbs-1];
   82|   183k|	if( alimb )
  ------------------
  |  Branch (82:6): [True: 183k, False: 0]
  ------------------
   83|   183k|	    count_leading_zeros( n, alimb );
  ------------------
  |  |  617|   183k|  do {                                                                  \
  |  |  618|   183k|    UDItype __cbtmp;                                                    \
  |  |  619|   183k|    __asm__ ("bsrq %1,%0"                                               \
  |  |  620|   183k|             : "=r" (__cbtmp) : "rm" ((UDItype)(x))                     \
  |  |  621|   183k|             __CLOBBER_CC);                                             \
  |  |  622|   183k|    (count) = __cbtmp ^ 63;                                             \
  |  |  623|   183k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (623:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   84|      0|	else
   85|      0|	    n = BITS_PER_MPI_LIMB;
  ------------------
  |  |   49|      0|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|      0|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|      0|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   86|   183k|	n = BITS_PER_MPI_LIMB - n + (a->nlimbs-1) * BITS_PER_MPI_LIMB;
  ------------------
  |  |   49|   183k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|   183k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|   183k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              	n = BITS_PER_MPI_LIMB - n + (a->nlimbs-1) * BITS_PER_MPI_LIMB;
  ------------------
  |  |   49|   183k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|   183k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|   183k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   87|   183k|    }
   88|  30.2k|    else
   89|  30.2k|	n = 0;
   90|   213k|    return n;
   91|   223k|}
_gcry_mpi_test_bit:
   99|  9.56M|{
  100|  9.56M|    unsigned int limbno, bitno;
  101|  9.56M|    mpi_limb_t limb;
  102|       |
  103|  9.56M|    limbno = n / BITS_PER_MPI_LIMB;
  ------------------
  |  |   49|  9.56M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  9.56M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  9.56M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  104|  9.56M|    bitno  = n % BITS_PER_MPI_LIMB;
  ------------------
  |  |   49|  9.56M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  9.56M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  9.56M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  105|       |
  106|  9.56M|    if( limbno >= a->nlimbs )
  ------------------
  |  Branch (106:9): [True: 1.43M, False: 8.12M]
  ------------------
  107|  1.43M|	return 0; /* too far left: this is a 0 */
  108|  8.12M|    limb = a->d[limbno];
  109|  8.12M|    return (limb & (A_LIMB_1 << bitno))? 1: 0;
  ------------------
  |  |   48|  8.12M|#define A_LIMB_1 ((mpi_limb_t)1)
  ------------------
  |  Branch (109:12): [True: 3.98M, False: 4.14M]
  ------------------
  110|  9.56M|}
_gcry_mpi_rshift:
  253|  2.43M|{
  254|  2.43M|  mpi_size_t xsize;
  255|  2.43M|  unsigned int i;
  256|  2.43M|  unsigned int nlimbs = (n/BITS_PER_MPI_LIMB);
  ------------------
  |  |   49|  2.43M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  2.43M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  2.43M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  257|  2.43M|  unsigned int nbits = (n%BITS_PER_MPI_LIMB);
  ------------------
  |  |   49|  2.43M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  2.43M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  2.43M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  258|       |
  259|  2.43M|  if (mpi_is_immutable (x))
  ------------------
  |  |  113|  2.43M|#define mpi_is_immutable(a)   ((a)->flags&16)
  |  |  ------------------
  |  |  |  Branch (113:31): [True: 0, False: 2.43M]
  |  |  ------------------
  ------------------
  260|      0|    {
  261|      0|      mpi_immutable_failed ();
  ------------------
  |  |  110|      0|#define mpi_immutable_failed() _gcry_mpi_immutable_failed ()
  ------------------
  262|      0|      return;
  263|      0|    }
  264|       |
  265|  2.43M|  if ( x == a )
  ------------------
  |  Branch (265:8): [True: 2.43M, False: 1.08k]
  ------------------
  266|  2.43M|    {
  267|       |      /* In-place operation.  */
  268|  2.43M|      if ( nlimbs >= x->nlimbs )
  ------------------
  |  Branch (268:12): [True: 0, False: 2.43M]
  ------------------
  269|      0|        {
  270|      0|          x->nlimbs = 0;
  271|      0|          return;
  272|      0|        }
  273|       |
  274|  2.43M|      if (nlimbs)
  ------------------
  |  Branch (274:11): [True: 0, False: 2.43M]
  ------------------
  275|      0|        {
  276|      0|          for (i=0; i < x->nlimbs - nlimbs; i++ )
  ------------------
  |  Branch (276:21): [True: 0, False: 0]
  ------------------
  277|      0|            x->d[i] = x->d[i+nlimbs];
  278|      0|          x->d[i] = 0;
  279|      0|          x->nlimbs -= nlimbs;
  280|       |
  281|      0|        }
  282|  2.43M|      if ( x->nlimbs && nbits )
  ------------------
  |  Branch (282:12): [True: 2.43M, False: 0]
  |  Branch (282:25): [True: 2.43M, False: 0]
  ------------------
  283|  2.43M|        _gcry_mpih_rshift ( x->d, x->d, x->nlimbs, nbits );
  284|  2.43M|    }
  285|  1.08k|  else if ( nlimbs )
  ------------------
  |  Branch (285:13): [True: 814, False: 268]
  ------------------
  286|    814|    {
  287|       |      /* Copy and shift by more or equal bits than in a limb. */
  288|    814|      xsize = a->nlimbs;
  289|    814|      x->sign = a->sign;
  290|    814|      RESIZE_IF_NEEDED (x, xsize);
  ------------------
  |  |   78|    814|    do {			   \
  |  |   79|    814|	if( (a)->alloced < (b) )   \
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 814, False: 0]
  |  |  ------------------
  |  |   80|    814|	    mpi_resize((a), (b));  \
  |  |  ------------------
  |  |  |  |  100|    814|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  |  |  ------------------
  |  |   81|    814|    } while(0)
  |  |  ------------------
  |  |  |  Branch (81:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  291|    814|      x->nlimbs = xsize;
  292|  4.05k|      for (i=0; i < a->nlimbs; i++ )
  ------------------
  |  Branch (292:17): [True: 3.23k, False: 814]
  ------------------
  293|  3.23k|        x->d[i] = a->d[i];
  294|    814|      x->nlimbs = i;
  295|       |
  296|    814|      if ( nlimbs >= x->nlimbs )
  ------------------
  |  Branch (296:12): [True: 0, False: 814]
  ------------------
  297|      0|        {
  298|      0|          x->nlimbs = 0;
  299|      0|          return;
  300|      0|        }
  301|       |
  302|    814|      if (nlimbs)
  ------------------
  |  Branch (302:11): [True: 814, False: 0]
  ------------------
  303|    814|        {
  304|  2.58k|          for (i=0; i < x->nlimbs - nlimbs; i++ )
  ------------------
  |  Branch (304:21): [True: 1.77k, False: 814]
  ------------------
  305|  1.77k|            x->d[i] = x->d[i+nlimbs];
  306|    814|          x->d[i] = 0;
  307|    814|          x->nlimbs -= nlimbs;
  308|    814|        }
  309|       |
  310|    814|      if ( x->nlimbs && nbits )
  ------------------
  |  Branch (310:12): [True: 814, False: 0]
  |  Branch (310:25): [True: 786, False: 28]
  ------------------
  311|    786|        _gcry_mpih_rshift ( x->d, x->d, x->nlimbs, nbits );
  312|    814|    }
  313|    268|  else
  314|    268|    {
  315|       |      /* Copy and shift by less than bits in a limb.  */
  316|    268|      xsize = a->nlimbs;
  317|    268|      x->sign = a->sign;
  318|    268|      RESIZE_IF_NEEDED (x, xsize);
  ------------------
  |  |   78|    268|    do {			   \
  |  |   79|    268|	if( (a)->alloced < (b) )   \
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 268, False: 0]
  |  |  ------------------
  |  |   80|    268|	    mpi_resize((a), (b));  \
  |  |  ------------------
  |  |  |  |  100|    268|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  |  |  ------------------
  |  |   81|    268|    } while(0)
  |  |  ------------------
  |  |  |  Branch (81:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  319|    268|      x->nlimbs = xsize;
  320|       |
  321|    268|      if ( xsize )
  ------------------
  |  Branch (321:12): [True: 268, False: 0]
  ------------------
  322|    268|        {
  323|    268|          if (nbits )
  ------------------
  |  Branch (323:15): [True: 268, False: 0]
  ------------------
  324|    268|            _gcry_mpih_rshift (x->d, a->d, x->nlimbs, nbits );
  325|      0|          else
  326|      0|            {
  327|       |              /* The rshift helper function is not specified for
  328|       |                 NBITS==0, thus we do a plain copy here. */
  329|      0|              for (i=0; i < x->nlimbs; i++ )
  ------------------
  |  Branch (329:25): [True: 0, False: 0]
  ------------------
  330|      0|                x->d[i] = a->d[i];
  331|      0|            }
  332|    268|        }
  333|    268|    }
  334|  2.43M|  MPN_NORMALIZE (x->d, x->nlimbs);
  ------------------
  |  |  119|  2.43M|    do {		       \
  |  |  120|  3.92M|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 3.92M, False: 0]
  |  |  ------------------
  |  |  121|  3.92M|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 2.43M, False: 1.49M]
  |  |  ------------------
  |  |  122|  3.92M|		break;	       \
  |  |  123|  3.92M|	    (n)--;	       \
  |  |  124|  1.49M|	}		       \
  |  |  125|  2.43M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  335|  2.43M|}
_gcry_mpi_lshift_limbs:
  344|  2.43M|{
  345|  2.43M|  mpi_ptr_t ap;
  346|  2.43M|  int n = a->nlimbs;
  347|  2.43M|  int i;
  348|       |
  349|  2.43M|  if (!count || !n)
  ------------------
  |  Branch (349:7): [True: 0, False: 2.43M]
  |  Branch (349:17): [True: 0, False: 2.43M]
  ------------------
  350|      0|    return;
  351|       |
  352|  2.43M|  RESIZE_IF_NEEDED (a, n+count);
  ------------------
  |  |   78|  2.43M|    do {			   \
  |  |   79|  2.43M|	if( (a)->alloced < (b) )   \
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 0, False: 2.43M]
  |  |  ------------------
  |  |   80|  2.43M|	    mpi_resize((a), (b));  \
  |  |  ------------------
  |  |  |  |  100|      0|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  |  |  ------------------
  |  |   81|  2.43M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (81:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  353|       |
  354|  2.43M|  ap = a->d;
  355|  14.9M|  for (i = n-1; i >= 0; i--)
  ------------------
  |  Branch (355:17): [True: 12.5M, False: 2.43M]
  ------------------
  356|  12.5M|    ap[i+count] = ap[i];
  357|  4.86M|  for (i=0; i < count; i++ )
  ------------------
  |  Branch (357:13): [True: 2.43M, False: 2.43M]
  ------------------
  358|  2.43M|    ap[i] = 0;
  359|  2.43M|  a->nlimbs += count;
  360|  2.43M|}
_gcry_mpi_lshift:
  368|  2.43M|{
  369|  2.43M|  unsigned int nlimbs = (n/BITS_PER_MPI_LIMB);
  ------------------
  |  |   49|  2.43M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  2.43M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  2.43M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  370|  2.43M|  unsigned int nbits = (n%BITS_PER_MPI_LIMB);
  ------------------
  |  |   49|  2.43M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  2.43M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  2.43M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  371|       |
  372|  2.43M|  if (mpi_is_immutable (x))
  ------------------
  |  |  113|  2.43M|#define mpi_is_immutable(a)   ((a)->flags&16)
  |  |  ------------------
  |  |  |  Branch (113:31): [True: 0, False: 2.43M]
  |  |  ------------------
  ------------------
  373|      0|    {
  374|      0|      mpi_immutable_failed ();
  ------------------
  |  |  110|      0|#define mpi_immutable_failed() _gcry_mpi_immutable_failed ()
  ------------------
  375|      0|      return;
  376|      0|    }
  377|       |
  378|  2.43M|  if (x == a && !n)
  ------------------
  |  Branch (378:7): [True: 1.04M, False: 1.38M]
  |  Branch (378:17): [True: 0, False: 1.04M]
  ------------------
  379|      0|    return;  /* In-place shift with an amount of zero.  */
  380|       |
  381|  2.43M|  if ( x != a )
  ------------------
  |  Branch (381:8): [True: 1.38M, False: 1.04M]
  ------------------
  382|  1.38M|    {
  383|       |      /* Copy A to X.  */
  384|  1.38M|      unsigned int alimbs = a->nlimbs;
  385|  1.38M|      int asign  = a->sign;
  386|  1.38M|      mpi_ptr_t xp, ap;
  387|       |
  388|  1.38M|      RESIZE_IF_NEEDED (x, alimbs+nlimbs+1);
  ------------------
  |  |   78|  1.38M|    do {			   \
  |  |   79|  1.38M|	if( (a)->alloced < (b) )   \
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 0, False: 1.38M]
  |  |  ------------------
  |  |   80|  1.38M|	    mpi_resize((a), (b));  \
  |  |  ------------------
  |  |  |  |  100|      0|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  |  |  ------------------
  |  |   81|  1.38M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (81:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  389|  1.38M|      xp = x->d;
  390|  1.38M|      ap = a->d;
  391|  1.38M|      MPN_COPY (xp, ap, alimbs);
  ------------------
  |  |   90|  1.38M|    do {				\
  |  |   91|  1.38M|	mpi_size_t _i;			\
  |  |   92|  8.55M|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 7.16M, False: 1.38M]
  |  |  ------------------
  |  |   93|  7.16M|	    (d)[_i] = (s)[_i];		\
  |  |   94|  1.38M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  392|  1.38M|      x->nlimbs = alimbs;
  393|  1.38M|      x->flags = a->flags;
  394|  1.38M|      x->sign = asign;
  395|  1.38M|    }
  396|       |
  397|  2.43M|  if (nlimbs && !nbits)
  ------------------
  |  Branch (397:7): [True: 0, False: 2.43M]
  |  Branch (397:17): [True: 0, False: 0]
  ------------------
  398|      0|    {
  399|       |      /* Shift a full number of limbs.  */
  400|      0|      _gcry_mpi_lshift_limbs (x, nlimbs);
  401|      0|    }
  402|  2.43M|  else if (n)
  ------------------
  |  Branch (402:12): [True: 2.43M, False: 0]
  ------------------
  403|  2.43M|    {
  404|       |      /* We use a very dump approach: Shift left by the number of
  405|       |         limbs plus one and than fix it up by an rshift.  */
  406|  2.43M|      _gcry_mpi_lshift_limbs (x, nlimbs+1);
  407|  2.43M|      mpi_rshift (x, x, BITS_PER_MPI_LIMB - nbits);
  ------------------
  |  |  558|  2.43M|#define mpi_rshift(a,b,c)      _gcry_mpi_rshift ((a),(b),(c))
  ------------------
  408|  2.43M|    }
  409|       |
  410|  2.43M|  MPN_NORMALIZE (x->d, x->nlimbs);
  ------------------
  |  |  119|  2.43M|    do {		       \
  |  |  120|  2.43M|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 2.43M, False: 0]
  |  |  ------------------
  |  |  121|  2.43M|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 2.43M, False: 0]
  |  |  ------------------
  |  |  122|  2.43M|		break;	       \
  |  |  123|  2.43M|	    (n)--;	       \
  |  |  124|      0|	}		       \
  |  |  125|  2.43M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  411|  2.43M|}

_gcry_mpi_cmp_ui:
   28|  3.90M|{
   29|  3.90M|  mpi_limb_t limb = v;
   30|       |
   31|  3.90M|  _gcry_mpi_normalize (u);
   32|       |
   33|       |  /* Handle the case that U contains no limb.  */
   34|  3.90M|  if (u->nlimbs == 0)
  ------------------
  |  Branch (34:7): [True: 679, False: 3.90M]
  ------------------
   35|    679|    return -(limb != 0);
   36|       |
   37|       |  /* Handle the case that U is negative.  */
   38|  3.90M|  if (u->sign)
  ------------------
  |  Branch (38:7): [True: 0, False: 3.90M]
  ------------------
   39|      0|    return -1;
   40|       |
   41|  3.90M|  if (u->nlimbs == 1)
  ------------------
  |  Branch (41:7): [True: 732k, False: 3.16M]
  ------------------
   42|   732k|    {
   43|       |      /* Handle the case that U contains exactly one limb.  */
   44|       |
   45|   732k|      if (u->d[0] > limb)
  ------------------
  |  Branch (45:11): [True: 367k, False: 364k]
  ------------------
   46|   367k|	return 1;
   47|   364k|      if (u->d[0] < limb)
  ------------------
  |  Branch (47:11): [True: 0, False: 364k]
  ------------------
   48|      0|	return -1;
   49|   364k|      return 0;
   50|   364k|    }
   51|  3.16M|  else
   52|       |    /* Handle the case that U contains more than one limb.  */
   53|  3.16M|    return 1;
   54|  3.90M|}
_gcry_mpi_cmp:
  121|   401k|{
  122|   401k|  return do_mpi_cmp (u, v, 0);
  123|   401k|}
_gcry_mpi_cmpabs:
  128|  21.8k|{
  129|  21.8k|  return do_mpi_cmp (u, v, 1);
  130|  21.8k|}
mpi-cmp.c:do_mpi_cmp:
   60|   423k|{
   61|   423k|  mpi_size_t usize;
   62|   423k|  mpi_size_t vsize;
   63|   423k|  int usign;
   64|   423k|  int vsign;
   65|   423k|  int cmp;
   66|       |
   67|   423k|  if (mpi_is_opaque (u) || mpi_is_opaque (v))
  ------------------
  |  |  114|   846k|#define mpi_is_opaque(a)      ((a) && ((a)->flags&4))
  |  |  ------------------
  |  |  |  Branch (114:32): [True: 423k, False: 0]
  |  |  |  Branch (114:39): [True: 0, False: 423k]
  |  |  ------------------
  ------------------
                if (mpi_is_opaque (u) || mpi_is_opaque (v))
  ------------------
  |  |  114|   423k|#define mpi_is_opaque(a)      ((a) && ((a)->flags&4))
  |  |  ------------------
  |  |  |  Branch (114:32): [True: 423k, False: 0]
  |  |  |  Branch (114:39): [True: 0, False: 423k]
  |  |  ------------------
  ------------------
   68|      0|    {
   69|       |      /* We have no signan and thus ABSMODE has no efeect here.  */
   70|      0|      if (mpi_is_opaque (u) && !mpi_is_opaque (v))
  ------------------
  |  |  114|      0|#define mpi_is_opaque(a)      ((a) && ((a)->flags&4))
  |  |  ------------------
  |  |  |  Branch (114:32): [True: 0, False: 0]
  |  |  |  Branch (114:39): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                    if (mpi_is_opaque (u) && !mpi_is_opaque (v))
  ------------------
  |  |  114|      0|#define mpi_is_opaque(a)      ((a) && ((a)->flags&4))
  |  |  ------------------
  |  |  |  Branch (114:32): [True: 0, False: 0]
  |  |  |  Branch (114:39): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   71|      0|        return -1;
   72|      0|      if (!mpi_is_opaque (u) && mpi_is_opaque (v))
  ------------------
  |  |  114|      0|#define mpi_is_opaque(a)      ((a) && ((a)->flags&4))
  |  |  ------------------
  |  |  |  Branch (114:32): [True: 0, False: 0]
  |  |  |  Branch (114:39): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                    if (!mpi_is_opaque (u) && mpi_is_opaque (v))
  ------------------
  |  |  114|      0|#define mpi_is_opaque(a)      ((a) && ((a)->flags&4))
  |  |  ------------------
  |  |  |  Branch (114:32): [True: 0, False: 0]
  |  |  |  Branch (114:39): [True: 0, False: 0]
  |  |  ------------------
  ------------------
   73|      0|        return 1;
   74|      0|      if (!u->sign && !v->sign)
  ------------------
  |  Branch (74:11): [True: 0, False: 0]
  |  Branch (74:23): [True: 0, False: 0]
  ------------------
   75|      0|        return 0; /* Empty buffers are identical.  */
   76|      0|      if (u->sign < v->sign)
  ------------------
  |  Branch (76:11): [True: 0, False: 0]
  ------------------
   77|      0|        return -1;
   78|      0|      if (u->sign > v->sign)
  ------------------
  |  Branch (78:11): [True: 0, False: 0]
  ------------------
   79|      0|        return 1;
   80|      0|      return memcmp (u->d, v->d, (u->sign+7)/8);
   81|      0|    }
   82|   423k|  else
   83|   423k|    {
   84|   423k|      _gcry_mpi_normalize (u);
   85|   423k|      _gcry_mpi_normalize (v);
   86|       |
   87|   423k|      usize = u->nlimbs;
   88|   423k|      vsize = v->nlimbs;
   89|   423k|      usign = absmode? 0 : u->sign;
  ------------------
  |  Branch (89:15): [True: 21.8k, False: 401k]
  ------------------
   90|   423k|      vsign = absmode? 0 : v->sign;
  ------------------
  |  Branch (90:15): [True: 21.8k, False: 401k]
  ------------------
   91|       |
   92|       |      /* Special treatment for +0 == -0 */
   93|   423k|      if (!usize && !vsize)
  ------------------
  |  Branch (93:11): [True: 1.88k, False: 421k]
  |  Branch (93:21): [True: 0, False: 1.88k]
  ------------------
   94|      0|        return 0;
   95|       |
   96|       |      /* Compare sign bits.  */
   97|   423k|      if (!usign && vsign)
  ------------------
  |  Branch (97:11): [True: 423k, False: 0]
  |  Branch (97:21): [True: 0, False: 423k]
  ------------------
   98|      0|        return 1;
   99|   423k|      if (usign && !vsign)
  ------------------
  |  Branch (99:11): [True: 0, False: 423k]
  |  Branch (99:20): [True: 0, False: 0]
  ------------------
  100|      0|        return -1;
  101|       |
  102|       |      /* U and V are either both positive or both negative.  */
  103|       |
  104|   423k|      if (usize != vsize && !usign && !vsign)
  ------------------
  |  Branch (104:11): [True: 30.8k, False: 392k]
  |  Branch (104:29): [True: 30.8k, False: 0]
  |  Branch (104:39): [True: 30.8k, False: 0]
  ------------------
  105|  30.8k|        return usize - vsize;
  106|   392k|      if (usize != vsize && usign && vsign)
  ------------------
  |  Branch (106:11): [True: 0, False: 392k]
  |  Branch (106:29): [True: 0, False: 0]
  |  Branch (106:38): [True: 0, False: 0]
  ------------------
  107|      0|        return vsize + usize;
  108|   392k|      if (!usize )
  ------------------
  |  Branch (108:11): [True: 0, False: 392k]
  ------------------
  109|      0|        return 0;
  110|   392k|      if (!(cmp = _gcry_mpih_cmp (u->d, v->d, usize)))
  ------------------
  |  Branch (110:11): [True: 12.8k, False: 379k]
  ------------------
  111|  12.8k|        return 0;
  112|   379k|      if ((cmp < 0?1:0) == (usign?1:0))
  ------------------
  |  Branch (112:11): [True: 238k, False: 141k]
  |  Branch (112:12): [True: 141k, False: 238k]
  |  Branch (112:29): [True: 0, False: 379k]
  ------------------
  113|   238k|        return 1;
  114|   379k|    }
  115|   141k|  return -1;
  116|   423k|}

_gcry_mpi_fdiv_r:
   38|   168k|{
   39|   168k|    int divisor_sign = divisor->sign;
   40|   168k|    gcry_mpi_t temp_divisor = NULL;
   41|       |
   42|       |    /* We need the original value of the divisor after the remainder has been
   43|       |     * preliminary calculated.	We have to copy it to temporary space if it's
   44|       |     * the same variable as REM.  */
   45|   168k|    if( rem == divisor ) {
  ------------------
  |  Branch (45:9): [True: 0, False: 168k]
  ------------------
   46|      0|	temp_divisor = mpi_copy( divisor );
  ------------------
  |  |  101|      0|# define mpi_copy(a)	       _gcry_mpi_copy((a))
  ------------------
   47|      0|	divisor = temp_divisor;
   48|      0|    }
   49|       |
   50|   168k|    _gcry_mpi_tdiv_r( rem, dividend, divisor );
   51|       |
   52|   168k|    if( ((divisor_sign?1:0) ^ (dividend->sign?1:0)) && rem->nlimbs )
  ------------------
  |  Branch (52:9): [True: 0, False: 168k]
  |  Branch (52:11): [True: 0, False: 168k]
  |  Branch (52:32): [True: 0, False: 168k]
  |  Branch (52:56): [True: 0, False: 0]
  ------------------
   53|      0|	mpi_add (rem, rem, divisor);
  ------------------
  |  |  516|      0|#define mpi_add(w,u,v)         _gcry_mpi_add ((w),(u),(v))
  ------------------
   54|       |
   55|   168k|    if( temp_divisor )
  ------------------
  |  Branch (55:9): [True: 0, False: 168k]
  ------------------
   56|      0|	mpi_free(temp_divisor);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
   57|   168k|}
_gcry_mpi_tdiv_r:
  125|  2.35M|{
  126|  2.35M|    _gcry_mpi_tdiv_qr(NULL, rem, num, den );
  127|  2.35M|}
_gcry_mpi_tdiv_qr:
  131|  2.35M|{
  132|  2.35M|    mpi_ptr_t np, dp;
  133|  2.35M|    mpi_ptr_t qp, rp;
  134|  2.35M|    mpi_size_t nsize = num->nlimbs;
  135|  2.35M|    mpi_size_t dsize = den->nlimbs;
  136|  2.35M|    mpi_size_t qsize, rsize;
  137|  2.35M|    mpi_size_t sign_remainder = num->sign;
  138|  2.35M|    mpi_size_t sign_quotient = num->sign ^ den->sign;
  139|  2.35M|    unsigned normalization_steps;
  140|  2.35M|    mpi_limb_t q_limb;
  141|  2.35M|    mpi_ptr_t marker[5];
  142|  2.35M|    unsigned int marker_nlimbs[5];
  143|  2.35M|    int markidx=0;
  144|       |
  145|       |    /* Ensure space is enough for quotient and remainder.
  146|       |     * We need space for an extra limb in the remainder, because it's
  147|       |     * up-shifted (normalized) below.  */
  148|  2.35M|    rsize = nsize + 1;
  149|  2.35M|    mpi_resize( rem, rsize);
  ------------------
  |  |  100|  2.35M|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
  150|       |
  151|  2.35M|    qsize = rsize - dsize;	  /* qsize cannot be bigger than this.	*/
  152|  2.35M|    if( qsize <= 0 ) {
  ------------------
  |  Branch (152:9): [True: 809k, False: 1.54M]
  ------------------
  153|   809k|	if( num != rem ) {
  ------------------
  |  Branch (153:6): [True: 0, False: 809k]
  ------------------
  154|      0|	    rem->nlimbs = num->nlimbs;
  155|      0|	    rem->sign = num->sign;
  156|      0|	    MPN_COPY(rem->d, num->d, nsize);
  ------------------
  |  |   90|      0|    do {				\
  |  |   91|      0|	mpi_size_t _i;			\
  |  |   92|      0|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 0, False: 0]
  |  |  ------------------
  |  |   93|      0|	    (d)[_i] = (s)[_i];		\
  |  |   94|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  157|      0|	}
  158|   809k|	if( quot ) {
  ------------------
  |  Branch (158:6): [True: 0, False: 809k]
  ------------------
  159|       |	    /* This needs to follow the assignment to rem, in case the
  160|       |	     * numerator and quotient are the same.  */
  161|      0|	    quot->nlimbs = 0;
  162|      0|	    quot->sign = 0;
  163|      0|	}
  164|   809k|	return;
  165|   809k|    }
  166|       |
  167|  1.54M|    if( quot )
  ------------------
  |  Branch (167:9): [True: 0, False: 1.54M]
  ------------------
  168|      0|	mpi_resize( quot, qsize);
  ------------------
  |  |  100|      0|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
  169|       |
  170|  1.54M|    if (!dsize)
  ------------------
  |  Branch (170:9): [True: 0, False: 1.54M]
  ------------------
  171|      0|      _gcry_divide_by_zero();
  172|       |
  173|       |    /* Read pointers here, when reallocation is finished.  */
  174|  1.54M|    np = num->d;
  175|  1.54M|    dp = den->d;
  176|  1.54M|    rp = rem->d;
  177|       |
  178|       |    /* Optimize division by a single-limb divisor.  */
  179|  1.54M|    if( dsize == 1 ) {
  ------------------
  |  Branch (179:9): [True: 0, False: 1.54M]
  ------------------
  180|      0|	mpi_limb_t rlimb;
  181|      0|	if( quot ) {
  ------------------
  |  Branch (181:6): [True: 0, False: 0]
  ------------------
  182|      0|	    qp = quot->d;
  183|      0|	    rlimb = _gcry_mpih_divmod_1( qp, np, nsize, dp[0] );
  184|      0|	    qsize -= qp[qsize - 1] == 0;
  185|      0|	    quot->nlimbs = qsize;
  186|      0|	    quot->sign = sign_quotient;
  187|      0|	}
  188|      0|	else
  189|      0|	    rlimb = _gcry_mpih_mod_1( np, nsize, dp[0] );
  190|      0|	rp[0] = rlimb;
  191|      0|	rsize = rlimb != 0?1:0;
  ------------------
  |  Branch (191:10): [True: 0, False: 0]
  ------------------
  192|      0|	rem->nlimbs = rsize;
  193|      0|	rem->sign = sign_remainder;
  194|      0|	return;
  195|      0|    }
  196|       |
  197|       |
  198|  1.54M|    if( quot ) {
  ------------------
  |  Branch (198:9): [True: 0, False: 1.54M]
  ------------------
  199|      0|	qp = quot->d;
  200|       |	/* Make sure QP and NP point to different objects.  Otherwise the
  201|       |	 * numerator would be gradually overwritten by the quotient limbs.  */
  202|      0|	if(qp == np) { /* Copy NP object to temporary space.  */
  ------------------
  |  Branch (202:5): [True: 0, False: 0]
  ------------------
  203|      0|            marker_nlimbs[markidx] = nsize;
  204|      0|	    np = marker[markidx++] = mpi_alloc_limb_space(nsize,
  ------------------
  |  |  178|      0|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  |  |  ------------------
  |  |  |  Branch (178:68): [True: 0, False: 0]
  |  |  |  Branch (178:68): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  205|      0|							  mpi_is_secure(quot));
  206|      0|	    MPN_COPY(np, qp, nsize);
  ------------------
  |  |   90|      0|    do {				\
  |  |   91|      0|	mpi_size_t _i;			\
  |  |   92|      0|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 0, False: 0]
  |  |  ------------------
  |  |   93|      0|	    (d)[_i] = (s)[_i];		\
  |  |   94|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  207|      0|	}
  208|      0|    }
  209|  1.54M|    else /* Put quotient at top of remainder. */
  210|  1.54M|	qp = rp + dsize;
  211|       |
  212|  1.54M|    count_leading_zeros( normalization_steps, dp[dsize - 1] );
  ------------------
  |  |  617|  1.54M|  do {                                                                  \
  |  |  618|  1.54M|    UDItype __cbtmp;                                                    \
  |  |  619|  1.54M|    __asm__ ("bsrq %1,%0"                                               \
  |  |  620|  1.54M|             : "=r" (__cbtmp) : "rm" ((UDItype)(x))                     \
  |  |  621|  1.54M|             __CLOBBER_CC);                                             \
  |  |  622|  1.54M|    (count) = __cbtmp ^ 63;                                             \
  |  |  623|  1.54M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (623:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  213|       |
  214|       |    /* Normalize the denominator, i.e. make its most significant bit set by
  215|       |     * shifting it NORMALIZATION_STEPS bits to the left.  Also shift the
  216|       |     * numerator the same number of steps (to keep the quotient the same!).
  217|       |     */
  218|  1.54M|    if( normalization_steps ) {
  ------------------
  |  Branch (218:9): [True: 1.03M, False: 516k]
  ------------------
  219|  1.03M|	mpi_ptr_t tp;
  220|  1.03M|	mpi_limb_t nlimb;
  221|       |
  222|       |	/* Shift up the denominator setting the most significant bit of
  223|       |	 * the most significant word.  Use temporary storage not to clobber
  224|       |	 * the original contents of the denominator.  */
  225|  1.03M|        marker_nlimbs[markidx] = dsize;
  226|  1.03M|	tp = marker[markidx++] = mpi_alloc_limb_space(dsize,mpi_is_secure(den));
  ------------------
  |  |  178|  2.06M|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  |  |  ------------------
  |  |  |  Branch (178:68): [True: 1.03M, False: 0]
  |  |  |  Branch (178:68): [True: 0, False: 1.03M]
  |  |  ------------------
  ------------------
  227|  1.03M|	_gcry_mpih_lshift( tp, dp, dsize, normalization_steps );
  228|  1.03M|	dp = tp;
  229|       |
  230|       |	/* Shift up the numerator, possibly introducing a new most
  231|       |	 * significant word.  Move the shifted numerator in the remainder
  232|       |	 * meanwhile.  */
  233|  1.03M|	nlimb = _gcry_mpih_lshift(rp, np, nsize, normalization_steps);
  234|  1.03M|	if( nlimb ) {
  ------------------
  |  Branch (234:6): [True: 58.4k, False: 973k]
  ------------------
  235|  58.4k|	    rp[nsize] = nlimb;
  236|  58.4k|	    rsize = nsize + 1;
  237|  58.4k|	}
  238|   973k|	else
  239|   973k|	    rsize = nsize;
  240|  1.03M|    }
  241|   516k|    else {
  242|       |	/* The denominator is already normalized, as required.	Copy it to
  243|       |	 * temporary space if it overlaps with the quotient or remainder.  */
  244|   516k|	if( dp == rp || (quot && (dp == qp))) {
  ------------------
  |  Branch (244:6): [True: 0, False: 516k]
  |  Branch (244:19): [True: 0, False: 516k]
  |  Branch (244:27): [True: 0, False: 0]
  ------------------
  245|      0|	    mpi_ptr_t tp;
  246|       |
  247|      0|            marker_nlimbs[markidx] = dsize;
  248|      0|	    tp = marker[markidx++] = mpi_alloc_limb_space(dsize,
  ------------------
  |  |  178|      0|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  |  |  ------------------
  |  |  |  Branch (178:68): [True: 0, False: 0]
  |  |  |  Branch (178:68): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  249|      0|                                                          mpi_is_secure(den));
  250|      0|	    MPN_COPY( tp, dp, dsize );
  ------------------
  |  |   90|      0|    do {				\
  |  |   91|      0|	mpi_size_t _i;			\
  |  |   92|      0|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 0, False: 0]
  |  |  ------------------
  |  |   93|      0|	    (d)[_i] = (s)[_i];		\
  |  |   94|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  251|      0|	    dp = tp;
  252|      0|	}
  253|       |
  254|       |	/* Move the numerator to the remainder.  */
  255|   516k|	if( rp != np )
  ------------------
  |  Branch (255:6): [True: 0, False: 516k]
  ------------------
  256|      0|	    MPN_COPY(rp, np, nsize);
  ------------------
  |  |   90|      0|    do {				\
  |  |   91|      0|	mpi_size_t _i;			\
  |  |   92|      0|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 0, False: 0]
  |  |  ------------------
  |  |   93|      0|	    (d)[_i] = (s)[_i];		\
  |  |   94|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  257|       |
  258|   516k|	rsize = nsize;
  259|   516k|    }
  260|       |
  261|  1.54M|    q_limb = _gcry_mpih_divrem( qp, 0, rp, rsize, dp, dsize );
  262|       |
  263|  1.54M|    if( quot ) {
  ------------------
  |  Branch (263:9): [True: 0, False: 1.54M]
  ------------------
  264|      0|	qsize = rsize - dsize;
  265|      0|	if(q_limb) {
  ------------------
  |  Branch (265:5): [True: 0, False: 0]
  ------------------
  266|      0|	    qp[qsize] = q_limb;
  267|      0|	    qsize += 1;
  268|      0|	}
  269|       |
  270|      0|	quot->nlimbs = qsize;
  271|      0|	quot->sign = sign_quotient;
  272|      0|    }
  273|       |
  274|  1.54M|    rsize = dsize;
  275|  1.54M|    MPN_NORMALIZE (rp, rsize);
  ------------------
  |  |  119|  1.54M|    do {		       \
  |  |  120|  1.55M|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 1.55M, False: 0]
  |  |  ------------------
  |  |  121|  1.55M|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 1.54M, False: 2.35k]
  |  |  ------------------
  |  |  122|  1.55M|		break;	       \
  |  |  123|  1.55M|	    (n)--;	       \
  |  |  124|  2.35k|	}		       \
  |  |  125|  1.54M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  276|       |
  277|  1.54M|    if( normalization_steps && rsize ) {
  ------------------
  |  Branch (277:9): [True: 1.03M, False: 516k]
  |  Branch (277:32): [True: 1.03M, False: 0]
  ------------------
  278|  1.03M|	_gcry_mpih_rshift(rp, rp, rsize, normalization_steps);
  279|  1.03M|	rsize -= rp[rsize - 1] == 0?1:0;
  ------------------
  |  Branch (279:11): [True: 28.0k, False: 1.00M]
  ------------------
  280|  1.03M|    }
  281|       |
  282|  1.54M|    rem->nlimbs = rsize;
  283|  1.54M|    rem->sign	= sign_remainder;
  284|  2.57M|    while( markidx )
  ------------------
  |  Branch (284:12): [True: 1.03M, False: 1.54M]
  ------------------
  285|  1.03M|      {
  286|  1.03M|        markidx--;
  287|  1.03M|	_gcry_mpi_free_limb_space (marker[markidx], marker_nlimbs[markidx]);
  288|  1.03M|      }
  289|  1.54M|}

_gcry_mpih_add_1:
   45|  1.58M|{
   46|  1.58M|    mpi_limb_t x;
   47|       |
   48|  1.58M|    x = *s1_ptr++;
   49|  1.58M|    s2_limb += x;
   50|  1.58M|    *res_ptr++ = s2_limb;
   51|  1.58M|    if( s2_limb < x ) { /* sum is less than the left operand: handle carry */
  ------------------
  |  Branch (51:9): [True: 2.69k, False: 1.58M]
  ------------------
   52|  6.37k|	while( --s1_size ) {
  ------------------
  |  Branch (52:9): [True: 6.37k, False: 0]
  ------------------
   53|  6.37k|	    x = *s1_ptr++ + 1;	/* add carry */
   54|  6.37k|	    *res_ptr++ = x;	/* and store */
   55|  6.37k|	    if( x )		/* not 0 (no overflow): we can stop */
  ------------------
  |  Branch (55:10): [True: 2.69k, False: 3.67k]
  ------------------
   56|  2.69k|		goto leave;
   57|  6.37k|	}
   58|      0|	return 1; /* return carry (size of s1 to small) */
   59|  2.69k|    }
   60|       |
   61|  1.58M|  leave:
   62|  1.58M|    if( res_ptr != s1_ptr ) { /* not the same variable */
  ------------------
  |  Branch (62:9): [True: 222k, False: 1.36M]
  ------------------
   63|   222k|	mpi_size_t i;	       /* copy the rest */
   64|   371k|	for( i=0; i < s1_size-1; i++ )
  ------------------
  |  Branch (64:12): [True: 149k, False: 222k]
  ------------------
   65|   149k|	    res_ptr[i] = s1_ptr[i];
   66|   222k|    }
   67|  1.58M|    return 0; /* no carry */
   68|  1.58M|}
_gcry_mpih_add:
   75|  1.43M|{
   76|  1.43M|    mpi_limb_t cy = 0;
   77|       |
   78|  1.43M|    if( s2_size )
  ------------------
  |  Branch (78:9): [True: 1.43M, False: 0]
  ------------------
   79|  1.43M|	cy = _gcry_mpih_add_n( res_ptr, s1_ptr, s2_ptr, s2_size );
   80|       |
   81|  1.43M|    if( s1_size - s2_size )
  ------------------
  |  Branch (81:9): [True: 6.03k, False: 1.43M]
  ------------------
   82|  6.03k|	cy = _gcry_mpih_add_1( res_ptr + s2_size, s1_ptr + s2_size,
   83|  6.03k|			    s1_size - s2_size, cy);
   84|  1.43M|    return cy;
   85|  1.43M|}
_gcry_mpih_sub_1:
   91|  17.5k|{
   92|  17.5k|    mpi_limb_t x;
   93|       |
   94|  17.5k|    x = *s1_ptr++;
   95|  17.5k|    s2_limb = x - s2_limb;
   96|  17.5k|    *res_ptr++ = s2_limb;
   97|  17.5k|    if( s2_limb > x ) {
  ------------------
  |  Branch (97:9): [True: 0, False: 17.5k]
  ------------------
   98|      0|	while( --s1_size ) {
  ------------------
  |  Branch (98:9): [True: 0, False: 0]
  ------------------
   99|      0|	    x = *s1_ptr++;
  100|      0|	    *res_ptr++ = x - 1;
  101|      0|	    if( x )
  ------------------
  |  Branch (101:10): [True: 0, False: 0]
  ------------------
  102|      0|		goto leave;
  103|      0|	}
  104|      0|	return 1;
  105|      0|    }
  106|       |
  107|  17.5k|  leave:
  108|  17.5k|    if( res_ptr != s1_ptr ) {
  ------------------
  |  Branch (108:9): [True: 12.2k, False: 5.27k]
  ------------------
  109|  12.2k|	mpi_size_t i;
  110|  27.2k|	for( i=0; i < s1_size-1; i++ )
  ------------------
  |  Branch (110:12): [True: 14.9k, False: 12.2k]
  ------------------
  111|  14.9k|	    res_ptr[i] = s1_ptr[i];
  112|  12.2k|    }
  113|  17.5k|    return 0;
  114|  17.5k|}
_gcry_mpih_sub:
  121|  11.0k|{
  122|  11.0k|    mpi_limb_t cy = 0;
  123|       |
  124|  11.0k|    if( s2_size )
  ------------------
  |  Branch (124:9): [True: 11.0k, False: 0]
  ------------------
  125|  11.0k|	cy = _gcry_mpih_sub_n(res_ptr, s1_ptr, s2_ptr, s2_size);
  126|       |
  127|  11.0k|    if( s1_size - s2_size )
  ------------------
  |  Branch (127:9): [True: 10.9k, False: 60]
  ------------------
  128|  10.9k|	cy = _gcry_mpih_sub_1(res_ptr + s2_size, s1_ptr + s2_size,
  129|  10.9k|				      s1_size - s2_size, cy);
  130|  11.0k|    return cy;
  131|  11.0k|}
_gcry_mpih_cmp:
  141|  13.3M|{
  142|  13.3M|    mpi_size_t i;
  143|  13.3M|    mpi_limb_t op1_word, op2_word;
  144|       |
  145|  13.4M|    for( i = size - 1; i >= 0 ; i--) {
  ------------------
  |  Branch (145:24): [True: 13.4M, False: 14.4k]
  ------------------
  146|  13.4M|	op1_word = op1_ptr[i];
  147|  13.4M|	op2_word = op2_ptr[i];
  148|  13.4M|	if( op1_word != op2_word )
  ------------------
  |  Branch (148:6): [True: 13.2M, False: 140k]
  ------------------
  149|  13.2M|	    goto diff;
  150|  13.4M|    }
  151|  14.4k|    return 0;
  152|       |
  153|  13.2M|  diff:
  154|       |    /* This can *not* be simplified to
  155|       |     *	 op2_word - op2_word
  156|       |     * since that expression might give signed overflow.  */
  157|  13.2M|    return (op1_word > op2_word) ? 1 : -1;
  ------------------
  |  Branch (157:12): [True: 4.26M, False: 9.03M]
  ------------------
  158|  13.3M|}

_gcry_mpi_invm:
  438|  13.0k|{
  439|  13.0k|  mpi_ptr_t ap, xp;
  440|       |
  441|  13.0k|  if (!mpi_cmp_ui (a, 0))
  ------------------
  |  |  512|  13.0k|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
  |  Branch (441:7): [True: 21, False: 13.0k]
  ------------------
  442|     21|    return 0; /* Inverse does not exists.  */
  443|  13.0k|  if (!mpi_cmp_ui (n, 1))
  ------------------
  |  |  512|  13.0k|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
  |  Branch (443:7): [True: 0, False: 13.0k]
  ------------------
  444|      0|    return 0; /* Inverse does not exists.  */
  445|       |
  446|  13.0k|  if (mpi_test_bit (n, 0))
  ------------------
  |  |  553|  13.0k|#define mpi_test_bit(a,b)      _gcry_mpi_test_bit ((a),(b))
  |  |  ------------------
  |  |  |  Branch (553:32): [True: 11.8k, False: 1.19k]
  |  |  ------------------
  ------------------
  447|  11.8k|    {
  448|  11.8k|      if (a->nlimbs <= n->nlimbs)
  ------------------
  |  Branch (448:11): [True: 11.8k, False: 19]
  ------------------
  449|  11.8k|        {
  450|  11.8k|          ap = mpi_alloc_limb_space (n->nlimbs, _gcry_is_secure (a->d));
  ------------------
  |  |  178|  11.8k|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  451|  11.8k|          MPN_ZERO (ap, n->nlimbs);
  ------------------
  |  |  112|  11.8k|    do {				  \
  |  |  113|  11.8k|	int  _i;			  \
  |  |  114|  65.2k|	for( _i = 0; _i < (n); _i++ )  \
  |  |  ------------------
  |  |  |  Branch (114:15): [True: 53.4k, False: 11.8k]
  |  |  ------------------
  |  |  115|  53.4k|	    (d)[_i] = 0;		    \
  |  |  116|  11.8k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (116:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  452|  11.8k|          MPN_COPY (ap, a->d, a->nlimbs);
  ------------------
  |  |   90|  11.8k|    do {				\
  |  |   91|  11.8k|	mpi_size_t _i;			\
  |  |   92|  49.2k|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 37.4k, False: 11.8k]
  |  |  ------------------
  |  |   93|  37.4k|	    (d)[_i] = (s)[_i];		\
  |  |   94|  11.8k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  453|  11.8k|        }
  454|     19|      else
  455|     19|        ap = _gcry_mpih_mod (a->d, a->nlimbs, n->d, n->nlimbs);
  456|       |
  457|  11.8k|      xp = mpih_invm_odd (ap, n->d, n->nlimbs);
  458|  11.8k|      _gcry_mpi_free_limb_space (ap, n->nlimbs);
  459|       |
  460|  11.8k|      if (xp)
  ------------------
  |  Branch (460:11): [True: 11.7k, False: 101]
  ------------------
  461|  11.7k|        {
  462|  11.7k|          _gcry_mpi_assign_limb_space (x, xp, n->nlimbs);
  463|  11.7k|          x->nlimbs = n->nlimbs;
  464|  11.7k|          return 1;
  465|  11.7k|        }
  466|    101|      else
  467|    101|        return 0; /* Inverse does not exists.  */
  468|  11.8k|    }
  469|  1.19k|  else if (!a->sign && !n->sign)
  ------------------
  |  Branch (469:12): [True: 1.19k, False: 0]
  |  Branch (469:24): [True: 1.19k, False: 0]
  ------------------
  470|  1.19k|    {
  471|  1.19k|      unsigned int k = mpi_trailing_zeros (n);
  ------------------
  |  |  217|  1.19k|#define mpi_trailing_zeros(a) _gcry_mpi_trailing_zeros ((a))
  ------------------
  472|  1.19k|      mpi_size_t x1size = ((k + BITS_PER_MPI_LIMB - 1) / BITS_PER_MPI_LIMB);
  ------------------
  |  |   49|  1.19k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  1.19k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  1.19k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                    mpi_size_t x1size = ((k + BITS_PER_MPI_LIMB - 1) / BITS_PER_MPI_LIMB);
  ------------------
  |  |   49|  1.19k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  1.19k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  1.19k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  473|  1.19k|      mpi_size_t hsize;
  474|  1.19k|      gcry_mpi_t q;
  475|  1.19k|      mpi_ptr_t x1p, x2p, q_invp, hp, diffp;
  476|  1.19k|      mpi_size_t i;
  477|       |
  478|  1.19k|      if (k == _gcry_mpi_get_nbits (n) - 1)
  ------------------
  |  Branch (478:11): [True: 0, False: 1.19k]
  ------------------
  479|      0|        {
  480|      0|          x1p = mpih_invm_pow2 (a->d, a->nlimbs, k);
  481|       |
  482|      0|          if (x1p)
  ------------------
  |  Branch (482:15): [True: 0, False: 0]
  ------------------
  483|      0|            {
  484|      0|              _gcry_mpi_assign_limb_space (x, x1p, x1size);
  485|      0|              x->nlimbs = x1size;
  486|      0|              return 1;
  487|      0|            }
  488|      0|          else
  489|      0|            return 0; /* Inverse does not exists.  */
  490|      0|        }
  491|       |
  492|       |      /* N can be expressed as P * Q, where P = 2^K.  P and Q are coprime.  */
  493|       |      /*
  494|       |       * Compute X1 = invm (A, P) and X2 = invm (A, Q), and combine
  495|       |       * them by Garner's formula, to get X = invm (A, P*Q).
  496|       |       * A special case of Chinese Remainder Theorem.
  497|       |       */
  498|       |
  499|       |      /* X1 = invm (A, P) */
  500|  1.19k|      x1p = mpih_invm_pow2 (a->d, a->nlimbs, k);
  501|  1.19k|      if (!x1p)
  ------------------
  |  Branch (501:11): [True: 113, False: 1.08k]
  ------------------
  502|    113|        return 0;               /* Inverse does not exists.  */
  503|       |
  504|       |      /* Q = N / P          */
  505|  1.08k|      q = mpi_new (0);
  ------------------
  |  |  491|  1.08k|#define mpi_new(n)             _gcry_mpi_new ((n))
  ------------------
  506|  1.08k|      mpi_rshift (q, n, k);
  ------------------
  |  |  558|  1.08k|#define mpi_rshift(a,b,c)      _gcry_mpi_rshift ((a),(b),(c))
  ------------------
  507|       |
  508|       |      /* X2 = invm (A%Q, Q) */
  509|  1.08k|      ap = _gcry_mpih_mod (a->d, a->nlimbs, q->d, q->nlimbs);
  510|  1.08k|      x2p = mpih_invm_odd (ap, q->d, q->nlimbs);
  511|  1.08k|      _gcry_mpi_free_limb_space (ap, q->nlimbs);
  512|  1.08k|      if (!x2p)
  ------------------
  |  Branch (512:11): [True: 33, False: 1.04k]
  ------------------
  513|     33|        {
  514|     33|          _gcry_mpi_free_limb_space (x1p, x1size);
  515|     33|          mpi_free (q);
  ------------------
  |  |   99|     33|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  516|     33|          return 0;             /* Inverse does not exists.  */
  517|     33|        }
  518|       |
  519|       |      /* Q_inv = Q^(-1) = invm (Q, P) */
  520|  1.04k|      q_invp = mpih_invm_pow2 (q->d, q->nlimbs, k);
  521|       |
  522|       |      /* H = (X1 - X2) * Q_inv % P */
  523|  1.04k|      diffp = mpi_alloc_limb_space (x1size, _gcry_is_secure (a->d));
  ------------------
  |  |  178|  1.04k|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  524|  1.04k|      if (x1size >= q->nlimbs)
  ------------------
  |  Branch (524:11): [True: 753, False: 296]
  ------------------
  525|    753|        _gcry_mpih_sub (diffp, x1p, x1size, x2p, q->nlimbs);
  526|    296|      else
  527|    296|	_gcry_mpih_sub_n (diffp, x1p, x2p, x1size);
  528|  1.04k|      _gcry_mpi_free_limb_space (x1p, x1size);
  529|  1.04k|      if ((k % BITS_PER_MPI_LIMB))
  ------------------
  |  |   49|  1.04k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  1.04k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  1.04k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (529:11): [True: 1.02k, False: 23]
  ------------------
  530|  52.2k|        for (i = k % BITS_PER_MPI_LIMB; i < BITS_PER_MPI_LIMB; i++)
  ------------------
  |  |   49|  1.02k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  1.02k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  1.02k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                      for (i = k % BITS_PER_MPI_LIMB; i < BITS_PER_MPI_LIMB; i++)
  ------------------
  |  |   49|  52.2k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  52.2k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  52.2k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (530:41): [True: 51.2k, False: 1.02k]
  ------------------
  531|  51.2k|          diffp[k/BITS_PER_MPI_LIMB] &= ~(((mpi_limb_t)1) << i);
  ------------------
  |  |   49|  51.2k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  51.2k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  51.2k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  532|       |
  533|  1.04k|      hsize = x1size * 2;
  534|  1.04k|      hp = mpi_alloc_limb_space (hsize, _gcry_is_secure (a->d));
  ------------------
  |  |  178|  1.04k|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  535|  1.04k|      _gcry_mpih_mul_n (hp, diffp, q_invp, x1size);
  536|  1.04k|      _gcry_mpi_free_limb_space (diffp, x1size);
  537|  1.04k|      _gcry_mpi_free_limb_space (q_invp, x1size);
  538|       |
  539|  3.53k|      for (i = x1size; i < hsize; i++)
  ------------------
  |  Branch (539:24): [True: 2.48k, False: 1.04k]
  ------------------
  540|  2.48k|        hp[i] = 0;
  541|  1.04k|      if ((k % BITS_PER_MPI_LIMB))
  ------------------
  |  |   49|  1.04k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  1.04k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  1.04k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (541:11): [True: 1.02k, False: 23]
  ------------------
  542|  52.2k|        for (i = k % BITS_PER_MPI_LIMB; i < BITS_PER_MPI_LIMB; i++)
  ------------------
  |  |   49|  1.02k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  1.02k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  1.02k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                      for (i = k % BITS_PER_MPI_LIMB; i < BITS_PER_MPI_LIMB; i++)
  ------------------
  |  |   49|  52.2k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  52.2k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  52.2k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (542:41): [True: 51.2k, False: 1.02k]
  ------------------
  543|  51.2k|          hp[k/BITS_PER_MPI_LIMB] &= ~(((mpi_limb_t)1) << i);
  ------------------
  |  |   49|  51.2k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  51.2k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  51.2k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  544|       |
  545|  1.04k|      xp = mpi_alloc_limb_space (x1size + q->nlimbs, _gcry_is_secure (a->d));
  ------------------
  |  |  178|  1.04k|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  546|  1.04k|      if (x1size >= q->nlimbs)
  ------------------
  |  Branch (546:11): [True: 753, False: 296]
  ------------------
  547|    753|        _gcry_mpih_mul (xp, hp, x1size, q->d, q->nlimbs);
  548|    296|      else
  549|    296|        _gcry_mpih_mul (xp, q->d, q->nlimbs, hp, x1size);
  550|       |
  551|  1.04k|      _gcry_mpi_free_limb_space (hp, hsize);
  552|       |
  553|  1.04k|      _gcry_mpih_add (xp, xp, x1size + q->nlimbs, x2p, q->nlimbs);
  554|  1.04k|      _gcry_mpi_free_limb_space (x2p, q->nlimbs);
  555|       |
  556|  1.04k|      _gcry_mpi_assign_limb_space (x, xp, x1size + q->nlimbs);
  557|  1.04k|      x->nlimbs = x1size + q->nlimbs;
  558|       |
  559|  1.04k|      mpi_free (q);
  ------------------
  |  |   99|  1.04k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  560|       |
  561|  1.04k|      return 1;
  562|  1.08k|    }
  563|      0|  else
  564|      0|    return mpi_invm_generic (x, a, n);
  565|  13.0k|}
mpi-inv.c:mpih_invm_odd:
   42|  12.9k|{
   43|  12.9k|  int secure;
   44|  12.9k|  unsigned int iterations;
   45|  12.9k|  mpi_ptr_t n1hp;
   46|  12.9k|  mpi_ptr_t bp;
   47|  12.9k|  mpi_ptr_t up, vp;
   48|       |
   49|  12.9k|  secure = _gcry_is_secure (ap);
   50|  12.9k|  up = mpi_alloc_limb_space (nsize, secure);
  ------------------
  |  |  178|  12.9k|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
   51|  12.9k|  MPN_ZERO (up, nsize);
  ------------------
  |  |  112|  12.9k|    do {				  \
  |  |  113|  12.9k|	int  _i;			  \
  |  |  114|  72.5k|	for( _i = 0; _i < (n); _i++ )  \
  |  |  ------------------
  |  |  |  Branch (114:15): [True: 59.6k, False: 12.9k]
  |  |  ------------------
  |  |  115|  59.6k|	    (d)[_i] = 0;		    \
  |  |  116|  12.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (116:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
   52|  12.9k|  up[0] = 1;
   53|       |
   54|  12.9k|  vp = mpi_alloc_limb_space (nsize, secure);
  ------------------
  |  |  178|  12.9k|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
   55|  12.9k|  MPN_ZERO (vp, nsize);
  ------------------
  |  |  112|  12.9k|    do {				  \
  |  |  113|  12.9k|	int  _i;			  \
  |  |  114|  72.5k|	for( _i = 0; _i < (n); _i++ )  \
  |  |  ------------------
  |  |  |  Branch (114:15): [True: 59.6k, False: 12.9k]
  |  |  ------------------
  |  |  115|  59.6k|	    (d)[_i] = 0;		    \
  |  |  116|  12.9k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (116:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
   56|       |
   57|  12.9k|  secure = _gcry_is_secure (np);
   58|  12.9k|  bp = mpi_alloc_limb_space (nsize, secure);
  ------------------
  |  |  178|  12.9k|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
   59|  12.9k|  MPN_COPY (bp, np, nsize);
  ------------------
  |  |   90|  12.9k|    do {				\
  |  |   91|  12.9k|	mpi_size_t _i;			\
  |  |   92|  72.5k|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 59.6k, False: 12.9k]
  |  |  ------------------
  |  |   93|  59.6k|	    (d)[_i] = (s)[_i];		\
  |  |   94|  12.9k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
   60|       |
   61|  12.9k|  n1hp = mpi_alloc_limb_space (nsize, secure);
  ------------------
  |  |  178|  12.9k|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
   62|  12.9k|  MPN_COPY (n1hp, np, nsize);
  ------------------
  |  |   90|  12.9k|    do {				\
  |  |   91|  12.9k|	mpi_size_t _i;			\
  |  |   92|  72.5k|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 59.6k, False: 12.9k]
  |  |  ------------------
  |  |   93|  59.6k|	    (d)[_i] = (s)[_i];		\
  |  |   94|  12.9k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
   63|  12.9k|  _gcry_mpih_rshift (n1hp, n1hp, nsize, 1);
   64|  12.9k|  _gcry_mpih_add_1 (n1hp, n1hp, nsize, 1);
   65|       |
   66|  12.9k|  iterations = 2 * nsize * BITS_PER_MPI_LIMB;
  ------------------
  |  |   49|  12.9k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  12.9k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  12.9k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   67|       |
   68|  7.64M|  while (iterations-- > 0)
  ------------------
  |  Branch (68:10): [True: 7.63M, False: 12.9k]
  ------------------
   69|  7.63M|    {
   70|  7.63M|      mpi_limb_t odd_a, odd_u, underflow, borrow;
   71|       |
   72|  7.63M|      odd_a = ap[0] & 1;
   73|       |
   74|  7.63M|      underflow = mpih_sub_n_cond (ap, ap, bp, nsize, odd_a);
  ------------------
  |  |  265|  7.63M|#define mpih_sub_n_cond(w,u,v,s,o) _gcry_mpih_sub_n_cond ((w),(u),(v),(s),(o))
  ------------------
   75|  7.63M|      mpih_add_n_cond (bp, bp, ap, nsize, underflow);
  ------------------
  |  |  264|  7.63M|#define mpih_add_n_cond(w,u,v,s,o) _gcry_mpih_add_n_cond ((w),(u),(v),(s),(o))
  ------------------
   76|  7.63M|      mpih_abs_cond (ap, ap, nsize, underflow);
  ------------------
  |  |  267|  7.63M|#define mpih_abs_cond(w,u,s,o) _gcry_mpih_abs_cond ((w),(u),(s),(o))
  ------------------
   77|  7.63M|      mpih_swap_cond (up, vp, nsize, underflow);
  ------------------
  |  |  266|  7.63M|#define mpih_swap_cond(u,v,s,o) _gcry_mpih_swap_cond ((u),(v),(s),(o))
  ------------------
   78|       |
   79|  7.63M|      _gcry_mpih_rshift (ap, ap, nsize, 1);
   80|       |
   81|  7.63M|      borrow = mpih_sub_n_cond (up, up, vp, nsize, odd_a);
  ------------------
  |  |  265|  7.63M|#define mpih_sub_n_cond(w,u,v,s,o) _gcry_mpih_sub_n_cond ((w),(u),(v),(s),(o))
  ------------------
   82|  7.63M|      mpih_add_n_cond (up, up, np, nsize, borrow);
  ------------------
  |  |  264|  7.63M|#define mpih_add_n_cond(w,u,v,s,o) _gcry_mpih_add_n_cond ((w),(u),(v),(s),(o))
  ------------------
   83|       |
   84|  7.63M|      odd_u = _gcry_mpih_rshift (up, up, nsize, 1) != 0;
   85|  7.63M|      mpih_add_n_cond (up, up, n1hp, nsize, odd_u);
  ------------------
  |  |  264|  7.63M|#define mpih_add_n_cond(w,u,v,s,o) _gcry_mpih_add_n_cond ((w),(u),(v),(s),(o))
  ------------------
   86|  7.63M|    }
   87|       |
   88|  12.9k|  _gcry_mpi_free_limb_space (n1hp, nsize);
   89|  12.9k|  _gcry_mpi_free_limb_space (up, nsize);
   90|       |
   91|  12.9k|  if (_gcry_mpih_cmp_ui (bp, nsize, 1) == 0)
  ------------------
  |  Branch (91:7): [True: 12.8k, False: 134]
  ------------------
   92|  12.8k|    {
   93|       |      /* Inverse exists.  */
   94|  12.8k|      _gcry_mpi_free_limb_space (bp, nsize);
   95|  12.8k|      return vp;
   96|  12.8k|    }
   97|    134|  else
   98|    134|    {
   99|    134|      _gcry_mpi_free_limb_space (bp, nsize);
  100|    134|      _gcry_mpi_free_limb_space (vp, nsize);
  101|    134|      return NULL;
  102|    134|    }
  103|  12.9k|}
mpi-inv.c:mpih_invm_pow2:
  115|  2.24k|{
  116|  2.24k|  int secure = _gcry_is_secure (ap);
  117|  2.24k|  mpi_size_t i;
  118|  2.24k|  unsigned int iterations;
  119|  2.24k|  mpi_ptr_t xp, wp, up, vp;
  120|  2.24k|  mpi_size_t usize;
  121|       |
  122|  2.24k|  if (!(ap[0] & 1))
  ------------------
  |  Branch (122:7): [True: 113, False: 2.13k]
  ------------------
  123|    113|    return NULL;
  124|       |
  125|  2.13k|  iterations = ((k + BITS_PER_MPI_LIMB - 1) / BITS_PER_MPI_LIMB)
  ------------------
  |  |   49|  2.13k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  2.13k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  2.13k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                iterations = ((k + BITS_PER_MPI_LIMB - 1) / BITS_PER_MPI_LIMB)
  ------------------
  |  |   49|  2.13k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  2.13k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  2.13k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  126|  2.13k|    * BITS_PER_MPI_LIMB;
  ------------------
  |  |   49|  2.13k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  2.13k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  2.13k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  127|  2.13k|  usize = iterations / BITS_PER_MPI_LIMB;
  ------------------
  |  |   49|  2.13k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  2.13k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  2.13k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  128|       |
  129|  2.13k|  up = mpi_alloc_limb_space (usize, secure);
  ------------------
  |  |  178|  2.13k|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  130|  2.13k|  MPN_ZERO (up, usize);
  ------------------
  |  |  112|  2.13k|    do {				  \
  |  |  113|  2.13k|	int  _i;			  \
  |  |  114|  7.13k|	for( _i = 0; _i < (n); _i++ )  \
  |  |  ------------------
  |  |  |  Branch (114:15): [True: 5.00k, False: 2.13k]
  |  |  ------------------
  |  |  115|  5.00k|	    (d)[_i] = 0;		    \
  |  |  116|  2.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (116:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  131|  2.13k|  up[0] = 1;
  132|       |
  133|  2.13k|  vp = mpi_alloc_limb_space (usize, secure);
  ------------------
  |  |  178|  2.13k|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  134|  5.78k|  for (i = 0; i < (usize < asize ? usize : asize); i++)
  ------------------
  |  Branch (134:15): [True: 3.65k, False: 2.13k]
  |  Branch (134:20): [True: 1.57k, False: 4.21k]
  ------------------
  135|  3.65k|    vp[i] = ap[i];
  136|  3.47k|  for (; i < usize; i++)
  ------------------
  |  Branch (136:10): [True: 1.34k, False: 2.13k]
  ------------------
  137|  1.34k|    vp[i] = 0;
  138|  2.13k|  if ((k % BITS_PER_MPI_LIMB))
  ------------------
  |  |   49|  2.13k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  2.13k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  2.13k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (138:7): [True: 2.08k, False: 51]
  ------------------
  139|   106k|    for (i = k % BITS_PER_MPI_LIMB; i < BITS_PER_MPI_LIMB; i++)
  ------------------
  |  |   49|  2.08k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  2.08k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  2.08k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  for (i = k % BITS_PER_MPI_LIMB; i < BITS_PER_MPI_LIMB; i++)
  ------------------
  |  |   49|   106k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|   106k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|   106k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (139:37): [True: 104k, False: 2.08k]
  ------------------
  140|   104k|      vp[k/BITS_PER_MPI_LIMB] &= ~(((mpi_limb_t)1) << i);
  ------------------
  |  |   49|   104k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|   104k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|   104k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  141|       |
  142|  2.13k|  wp = mpi_alloc_limb_space (usize, secure);
  ------------------
  |  |  178|  2.13k|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  143|  2.13k|  MPN_COPY (wp, up, usize);
  ------------------
  |  |   90|  2.13k|    do {				\
  |  |   91|  2.13k|	mpi_size_t _i;			\
  |  |   92|  7.13k|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 5.00k, False: 2.13k]
  |  |  ------------------
  |  |   93|  5.00k|	    (d)[_i] = (s)[_i];		\
  |  |   94|  2.13k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  144|       |
  145|  2.13k|  xp = mpi_alloc_limb_space (usize, secure);
  ------------------
  |  |  178|  2.13k|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  146|  2.13k|  MPN_ZERO (xp, usize);
  ------------------
  |  |  112|  2.13k|    do {				  \
  |  |  113|  2.13k|	int  _i;			  \
  |  |  114|  7.13k|	for( _i = 0; _i < (n); _i++ )  \
  |  |  ------------------
  |  |  |  Branch (114:15): [True: 5.00k, False: 2.13k]
  |  |  ------------------
  |  |  115|  5.00k|	    (d)[_i] = 0;		    \
  |  |  116|  2.13k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (116:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  147|       |
  148|       |  /*
  149|       |   * It can be considered that overflow at _gcry_mpih_sub_n results
  150|       |   * adding 2^(USIZE*BITS_PER_MPI_LIMB), which is no problem in modulo
  151|       |   * 2^K computation.
  152|       |   */
  153|   322k|  for (i = 0; i < iterations; i++)
  ------------------
  |  Branch (153:15): [True: 320k, False: 2.13k]
  ------------------
  154|   320k|    {
  155|   320k|      int b0 = (up[0] & 1);
  156|       |
  157|   320k|      xp[i/BITS_PER_MPI_LIMB] |= ((mpi_limb_t)b0<<(i%BITS_PER_MPI_LIMB));
  ------------------
  |  |   49|   320k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|   320k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|   320k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                    xp[i/BITS_PER_MPI_LIMB] |= ((mpi_limb_t)b0<<(i%BITS_PER_MPI_LIMB));
  ------------------
  |  |   49|   320k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|   320k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|   320k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  158|   320k|      _gcry_mpih_sub_n (wp, up, vp, usize);
  159|   320k|      mpih_set_cond (up, wp, usize, b0);
  ------------------
  |  |  263|   320k|#define mpih_set_cond(w,u,s,o) _gcry_mpih_set_cond ((w),(u),(s),(o))
  ------------------
  160|   320k|      _gcry_mpih_rshift (up, up, usize, 1);
  161|   320k|    }
  162|       |
  163|  2.13k|  if ((k % BITS_PER_MPI_LIMB))
  ------------------
  |  |   49|  2.13k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  2.13k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  2.13k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (163:7): [True: 2.08k, False: 51]
  ------------------
  164|   106k|    for (i = k % BITS_PER_MPI_LIMB; i < BITS_PER_MPI_LIMB; i++)
  ------------------
  |  |   49|  2.08k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  2.08k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  2.08k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  for (i = k % BITS_PER_MPI_LIMB; i < BITS_PER_MPI_LIMB; i++)
  ------------------
  |  |   49|   106k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|   106k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|   106k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (164:37): [True: 104k, False: 2.08k]
  ------------------
  165|   104k|      xp[k/BITS_PER_MPI_LIMB] &= ~(((mpi_limb_t)1) << i);
  ------------------
  |  |   49|   104k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|   104k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|   104k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  166|       |
  167|  2.13k|  _gcry_mpi_free_limb_space (up, usize);
  168|  2.13k|  _gcry_mpi_free_limb_space (vp, usize);
  169|  2.13k|  _gcry_mpi_free_limb_space (wp, usize);
  170|       |
  171|  2.13k|  return xp;
  172|  2.24k|}

_gcry_mpi_mod:
   48|   166k|{
   49|   166k|  _gcry_mpi_fdiv_r (rem, dividend, divisor);
   50|   166k|}
_gcry_mpi_barrett_free:
   92|  7.29k|{
   93|  7.29k|  if (ctx)
  ------------------
  |  Branch (93:7): [True: 0, False: 7.29k]
  ------------------
   94|      0|    {
   95|      0|      mpi_free (ctx->y);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
   96|      0|      mpi_free (ctx->r1);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
   97|      0|      mpi_free (ctx->r2);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
   98|      0|      if (ctx->r3)
  ------------------
  |  Branch (98:11): [True: 0, False: 0]
  ------------------
   99|      0|        mpi_free (ctx->r3);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  100|      0|      if (ctx->m_copied)
  ------------------
  |  Branch (100:11): [True: 0, False: 0]
  ------------------
  101|      0|        mpi_free (ctx->m);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  102|      0|      xfree (ctx);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  103|      0|    }
  104|  7.29k|}

_gcry_mpi_mulpowm:
   67|  2.69k|{
   68|  2.69k|    int k;	/* number of elements */
   69|  2.69k|    int t;	/* bit size of largest exponent */
   70|  2.69k|    int i, j, idx;
   71|  2.69k|    gcry_mpi_t *G;	/* table with precomputed values of size 2^k */
   72|  2.69k|    gcry_mpi_t tmp;
   73|       |#ifdef USE_BARRETT
   74|       |    gcry_mpi_t barrett_y, barrett_r1, barrett_r2;
   75|       |    int barrett_k;
   76|       |#endif
   77|       |
   78|  8.73k|    for(k=0; basearray[k]; k++ )
  ------------------
  |  Branch (78:14): [True: 6.03k, False: 2.69k]
  ------------------
   79|  6.03k|	;
   80|  2.69k|    gcry_assert(k);
  ------------------
  |  |  188|  2.69k|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|  2.69k|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 2.69k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|  2.69k|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
   81|  8.73k|    for(t=0, i=0; (tmp=exparray[i]); i++ ) {
  ------------------
  |  Branch (81:19): [True: 6.03k, False: 2.69k]
  ------------------
   82|       |	/*log_mpidump("exp: ", tmp );*/
   83|  6.03k|	j = mpi_get_nbits(tmp);
  ------------------
  |  |  552|  6.03k|#define mpi_get_nbits(a)       _gcry_mpi_get_nbits ((a))
  ------------------
   84|  6.03k|	if( j > t )
  ------------------
  |  Branch (84:6): [True: 3.18k, False: 2.84k]
  ------------------
   85|  3.18k|	    t = j;
   86|  6.03k|    }
   87|       |    /*log_mpidump("mod: ", m );*/
   88|  2.69k|    gcry_assert (i==k);
  ------------------
  |  |  188|  2.69k|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|  2.69k|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 2.69k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|  2.69k|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
   89|  2.69k|    gcry_assert (t);
  ------------------
  |  |  188|  2.69k|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|  2.69k|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 2.69k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|  2.69k|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
   90|  2.69k|    gcry_assert (k < 10);
  ------------------
  |  |  188|  2.69k|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|  2.69k|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 2.69k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|  2.69k|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
   91|       |
   92|  2.69k|    G = xcalloc( (1<<k) , sizeof *G );
  ------------------
  |  |  145|  2.69k|#define xcalloc(a,b)     _gcry_xcalloc ((a),(b))
  ------------------
   93|       |#ifdef USE_BARRETT
   94|       |    barrett_y = init_barrett( m, &barrett_k, &barrett_r1, &barrett_r2 );
   95|       |#endif
   96|       |    /* and calculate */
   97|  2.69k|    tmp =  mpi_alloc( mpi_get_nlimbs(m)+1 );
  ------------------
  |  |   97|  2.69k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
   98|  2.69k|    mpi_set_ui( res, 1 );
  ------------------
  |  |  505|  2.69k|#define mpi_set_ui( w, u)      _gcry_mpi_set_ui( (w), (u) )
  ------------------
   99|  1.07M|    for(i = 1; i <= t; i++ ) {
  ------------------
  |  Branch (99:16): [True: 1.07M, False: 2.69k]
  ------------------
  100|  1.07M|	barrett_mulm(tmp, res, res, m, barrett_y, barrett_k,
  ------------------
  |  |   42|  1.07M|#define barrett_mulm( w, u, v, m, y, k, r1, r2 ) _gcry_mpi_mulm( (w), (u), (v), (m) )
  ------------------
  101|  1.07M|				       barrett_r1, barrett_r2 );
  102|  1.07M|	idx = build_index( exparray, k, i, t );
  103|  1.07M|	gcry_assert (idx >= 0 && idx < (1<<k));
  ------------------
  |  |  188|  1.07M|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|  2.14M|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 1.07M, False: 0]
  |  |  |  |  |  Branch (85:48): [True: 1.07M, False: 0]
  |  |  |  |  |  Branch (85:48): [True: 1.07M, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|  1.07M|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  104|  1.07M|	if( !G[idx] ) {
  ------------------
  |  Branch (104:6): [True: 12.2k, False: 1.05M]
  ------------------
  105|  12.2k|	    if( !idx )
  ------------------
  |  Branch (105:10): [True: 2.69k, False: 9.56k]
  ------------------
  106|  2.69k|		 G[0] = mpi_alloc_set_ui( 1 );
  ------------------
  |  |  119|  2.69k|#define mpi_alloc_set_ui(a)   _gcry_mpi_alloc_set_ui ((a))
  ------------------
  107|  9.56k|	    else {
  108|  32.7k|		for(j=0; j < k; j++ ) {
  ------------------
  |  Branch (108:12): [True: 23.1k, False: 9.56k]
  ------------------
  109|  23.1k|		    if( (idx & (1<<j) ) ) {
  ------------------
  |  Branch (109:11): [True: 14.1k, False: 8.97k]
  ------------------
  110|  14.1k|			if( !G[idx] )
  ------------------
  |  Branch (110:8): [True: 9.56k, False: 4.59k]
  ------------------
  111|  9.56k|			    G[idx] = mpi_copy( basearray[j] );
  ------------------
  |  |  101|  9.56k|# define mpi_copy(a)	       _gcry_mpi_copy((a))
  ------------------
  112|  4.59k|			else
  113|  4.59k|			    barrett_mulm( G[idx], G[idx], basearray[j],
  ------------------
  |  |   42|  4.59k|#define barrett_mulm( w, u, v, m, y, k, r1, r2 ) _gcry_mpi_mulm( (w), (u), (v), (m) )
  ------------------
  114|  14.1k|					       m, barrett_y, barrett_k, barrett_r1, barrett_r2	);
  115|  14.1k|		    }
  116|  23.1k|		}
  117|  9.56k|		if( !G[idx] )
  ------------------
  |  Branch (117:7): [True: 0, False: 9.56k]
  ------------------
  118|      0|		    G[idx] = mpi_alloc(0);
  ------------------
  |  |   97|      0|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  119|  9.56k|	    }
  120|  12.2k|	}
  121|  1.07M|	barrett_mulm(res, tmp, G[idx], m, barrett_y, barrett_k, barrett_r1, barrett_r2	);
  ------------------
  |  |   42|  1.07M|#define barrett_mulm( w, u, v, m, y, k, r1, r2 ) _gcry_mpi_mulm( (w), (u), (v), (m) )
  ------------------
  122|  1.07M|    }
  123|       |
  124|       |    /* cleanup */
  125|  2.69k|    mpi_free(tmp);
  ------------------
  |  |   99|  2.69k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  126|       |#ifdef USE_BARRETT
  127|       |    mpi_free(barrett_y);
  128|       |    mpi_free(barrett_r1);
  129|       |    mpi_free(barrett_r2);
  130|       |#endif
  131|  16.0k|    for(i=0; i < (1<<k); i++ )
  ------------------
  |  Branch (131:14): [True: 13.3k, False: 2.69k]
  ------------------
  132|  13.3k|	mpi_free(G[i]);
  ------------------
  |  |   99|  13.3k|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  133|  2.69k|    xfree(G);
  ------------------
  |  |  150|  2.69k|#define xfree(a)         _gcry_free ((a))
  ------------------
  134|  2.69k|}
mpi-mpow.c:build_index:
   48|  1.07M|{
   49|  1.07M|    int j, bitno;
   50|  1.07M|    int idx = 0;
   51|       |
   52|  1.07M|    bitno = t-i;
   53|  3.95M|    for(j=k-1; j >= 0; j-- ) {
  ------------------
  |  Branch (53:16): [True: 2.88M, False: 1.07M]
  ------------------
   54|  2.88M|	idx <<= 1;
   55|  2.88M|	if( mpi_test_bit( exparray[j], bitno ) )
  ------------------
  |  |  553|  2.88M|#define mpi_test_bit(a,b)      _gcry_mpi_test_bit ((a),(b))
  |  |  ------------------
  |  |  |  Branch (553:32): [True: 971k, False: 1.91M]
  |  |  ------------------
  ------------------
   56|   971k|	    idx |= 1;
   57|  2.88M|    }
   58|       |    /*log_debug("t=%d i=%d idx=%d\n", t, i, idx );*/
   59|  1.07M|    return idx;
   60|  1.07M|}

_gcry_mpi_mul:
  111|  17.8M|{
  112|  17.8M|    mpi_size_t usize, vsize, wsize;
  113|  17.8M|    mpi_ptr_t up, vp, wp;
  114|  17.8M|    mpi_limb_t cy;
  115|  17.8M|    int usign, vsign, usecure, vsecure, sign_product;
  116|  17.8M|    int assign_wp=0;
  117|  17.8M|    mpi_ptr_t tmp_limb=NULL;
  118|  17.8M|    unsigned int tmp_limb_nlimbs = 0;
  119|       |
  120|  17.8M|    if( u->nlimbs < v->nlimbs ) { /* Swap U and V. */
  ------------------
  |  Branch (120:9): [True: 688k, False: 17.1M]
  ------------------
  121|   688k|	usize = v->nlimbs;
  122|   688k|	usign = v->sign;
  123|   688k|	usecure = mpi_is_secure(v);
  ------------------
  |  |  115|   688k|#define mpi_is_secure(a)      ((a) && ((a)->flags&1))
  |  |  ------------------
  |  |  |  Branch (115:32): [True: 688k, False: 0]
  |  |  |  Branch (115:39): [True: 0, False: 688k]
  |  |  ------------------
  ------------------
  124|   688k|	up    = v->d;
  125|   688k|	vsize = u->nlimbs;
  126|   688k|	vsign = u->sign;
  127|   688k|	vsecure = mpi_is_secure(u);
  ------------------
  |  |  115|   688k|#define mpi_is_secure(a)      ((a) && ((a)->flags&1))
  |  |  ------------------
  |  |  |  Branch (115:32): [True: 688k, False: 0]
  |  |  |  Branch (115:39): [True: 0, False: 688k]
  |  |  ------------------
  ------------------
  128|   688k|	vp    = u->d;
  129|   688k|    }
  130|  17.1M|    else {
  131|  17.1M|	usize = u->nlimbs;
  132|  17.1M|	usign = u->sign;
  133|  17.1M|	usecure = mpi_is_secure(u);
  ------------------
  |  |  115|  17.1M|#define mpi_is_secure(a)      ((a) && ((a)->flags&1))
  |  |  ------------------
  |  |  |  Branch (115:32): [True: 17.1M, False: 0]
  |  |  |  Branch (115:39): [True: 0, False: 17.1M]
  |  |  ------------------
  ------------------
  134|  17.1M|	up    = u->d;
  135|  17.1M|	vsize = v->nlimbs;
  136|  17.1M|	vsign = v->sign;
  137|  17.1M|	vsecure = mpi_is_secure(v);
  ------------------
  |  |  115|  17.1M|#define mpi_is_secure(a)      ((a) && ((a)->flags&1))
  |  |  ------------------
  |  |  |  Branch (115:32): [True: 17.1M, False: 0]
  |  |  |  Branch (115:39): [True: 0, False: 17.1M]
  |  |  ------------------
  ------------------
  138|  17.1M|	vp    = v->d;
  139|  17.1M|    }
  140|  17.8M|    sign_product = usign ^ vsign;
  141|  17.8M|    wp = w->d;
  142|       |
  143|       |    /* Ensure W has space enough to store the result.  */
  144|  17.8M|    wsize = usize + vsize;
  145|  17.8M|    if ( !mpi_is_secure (w) && (mpi_is_secure (u) || mpi_is_secure (v)) ) {
  ------------------
  |  |  115|  35.6M|#define mpi_is_secure(a)      ((a) && ((a)->flags&1))
  |  |  ------------------
  |  |  |  Branch (115:32): [True: 17.8M, False: 0]
  |  |  |  Branch (115:39): [True: 0, False: 17.8M]
  |  |  ------------------
  ------------------
                  if ( !mpi_is_secure (w) && (mpi_is_secure (u) || mpi_is_secure (v)) ) {
  ------------------
  |  |  115|  35.6M|#define mpi_is_secure(a)      ((a) && ((a)->flags&1))
  |  |  ------------------
  |  |  |  Branch (115:32): [True: 17.8M, False: 0]
  |  |  |  Branch (115:39): [True: 0, False: 17.8M]
  |  |  ------------------
  ------------------
                  if ( !mpi_is_secure (w) && (mpi_is_secure (u) || mpi_is_secure (v)) ) {
  ------------------
  |  |  115|  17.8M|#define mpi_is_secure(a)      ((a) && ((a)->flags&1))
  |  |  ------------------
  |  |  |  Branch (115:32): [True: 17.8M, False: 0]
  |  |  |  Branch (115:39): [True: 0, False: 17.8M]
  |  |  ------------------
  ------------------
  146|       |        /* w is not allocated in secure space but u or v is.  To make sure
  147|       |         * that no temporray results are stored in w, we temporary use
  148|       |         * a newly allocated limb space for w */
  149|      0|        wp = mpi_alloc_limb_space( wsize, 1 );
  ------------------
  |  |  178|      0|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  150|      0|        assign_wp = 2; /* mark it as 2 so that we can later copy it back to
  151|       |                        * mormal memory */
  152|      0|    }
  153|  17.8M|    else if( w->alloced < wsize ) {
  ------------------
  |  Branch (153:14): [True: 69.8k, False: 17.7M]
  ------------------
  154|  69.8k|	if( wp == up || wp == vp ) {
  ------------------
  |  Branch (154:6): [True: 12.0k, False: 57.7k]
  |  Branch (154:18): [True: 5.74k, False: 52.0k]
  ------------------
  155|  17.7k|	    wp = mpi_alloc_limb_space( wsize, mpi_is_secure(w) );
  ------------------
  |  |  178|  35.5k|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  |  |  ------------------
  |  |  |  Branch (178:68): [True: 17.7k, False: 0]
  |  |  |  Branch (178:68): [True: 0, False: 17.7k]
  |  |  ------------------
  ------------------
  156|  17.7k|	    assign_wp = 1;
  157|  17.7k|	}
  158|  52.0k|	else {
  159|  52.0k|	    mpi_resize(w, wsize );
  ------------------
  |  |  100|  52.0k|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
  160|  52.0k|	    wp = w->d;
  161|  52.0k|	}
  162|  69.8k|    }
  163|  17.7M|    else { /* Make U and V not overlap with W.	*/
  164|  17.7M|	if( wp == up ) {
  ------------------
  |  Branch (164:6): [True: 7.65M, False: 10.1M]
  ------------------
  165|       |	    /* W and U are identical.  Allocate temporary space for U.	*/
  166|  7.65M|            tmp_limb_nlimbs = usize;
  167|  7.65M|	    up = tmp_limb = mpi_alloc_limb_space( usize, usecure  );
  ------------------
  |  |  178|  7.65M|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  168|       |	    /* Is V identical too?  Keep it identical with U.  */
  169|  7.65M|	    if( wp == vp )
  ------------------
  |  Branch (169:10): [True: 1.04M, False: 6.60M]
  ------------------
  170|  1.04M|		vp = up;
  171|       |	    /* Copy to the temporary space.  */
  172|  7.65M|	    MPN_COPY( up, wp, usize );
  ------------------
  |  |   90|  7.65M|    do {				\
  |  |   91|  7.65M|	mpi_size_t _i;			\
  |  |   92|  47.0M|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 39.4M, False: 7.65M]
  |  |  ------------------
  |  |   93|  39.4M|	    (d)[_i] = (s)[_i];		\
  |  |   94|  7.65M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  173|  7.65M|	}
  174|  10.1M|	else if( wp == vp ) {
  ------------------
  |  Branch (174:11): [True: 1.38M, False: 8.73M]
  ------------------
  175|       |	    /* W and V are identical.  Allocate temporary space for V.	*/
  176|  1.38M|            tmp_limb_nlimbs = vsize;
  177|  1.38M|	    vp = tmp_limb = mpi_alloc_limb_space( vsize, vsecure );
  ------------------
  |  |  178|  1.38M|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  178|       |	    /* Copy to the temporary space.  */
  179|  1.38M|	    MPN_COPY( vp, wp, vsize );
  ------------------
  |  |   90|  1.38M|    do {				\
  |  |   91|  1.38M|	mpi_size_t _i;			\
  |  |   92|  7.10M|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 5.71M, False: 1.38M]
  |  |  ------------------
  |  |   93|  5.71M|	    (d)[_i] = (s)[_i];		\
  |  |   94|  1.38M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  180|  1.38M|	}
  181|  17.7M|    }
  182|       |
  183|  17.8M|    if( !vsize )
  ------------------
  |  Branch (183:9): [True: 1.10M, False: 16.7M]
  ------------------
  184|  1.10M|	wsize = 0;
  185|  16.7M|    else {
  186|  16.7M|	cy = _gcry_mpih_mul( wp, up, usize, vp, vsize );
  187|  16.7M|	wsize -= cy? 0:1;
  ------------------
  |  Branch (187:11): [True: 11.7M, False: 5.01M]
  ------------------
  188|  16.7M|    }
  189|       |
  190|  17.8M|    if( assign_wp ) {
  ------------------
  |  Branch (190:9): [True: 17.7k, False: 17.8M]
  ------------------
  191|  17.7k|        if (assign_wp == 2) {
  ------------------
  |  Branch (191:13): [True: 0, False: 17.7k]
  ------------------
  192|       |            /* copy the temp wp from secure memory back to normal memory */
  193|      0|	    mpi_ptr_t tmp_wp = mpi_alloc_limb_space (wsize, 0);
  ------------------
  |  |  178|      0|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  194|      0|	    MPN_COPY (tmp_wp, wp, wsize);
  ------------------
  |  |   90|      0|    do {				\
  |  |   91|      0|	mpi_size_t _i;			\
  |  |   92|      0|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 0, False: 0]
  |  |  ------------------
  |  |   93|      0|	    (d)[_i] = (s)[_i];		\
  |  |   94|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  195|      0|            _gcry_mpi_free_limb_space (wp, 0);
  196|      0|            wp = tmp_wp;
  197|      0|        }
  198|  17.7k|	_gcry_mpi_assign_limb_space( w, wp, wsize );
  199|  17.7k|    }
  200|  17.8M|    w->nlimbs = wsize;
  201|  17.8M|    w->sign = sign_product;
  202|  17.8M|    if( tmp_limb )
  ------------------
  |  Branch (202:9): [True: 9.03M, False: 8.80M]
  ------------------
  203|  9.03M|	_gcry_mpi_free_limb_space (tmp_limb, tmp_limb_nlimbs);
  204|  17.8M|}
_gcry_mpi_mulm:
  209|  2.18M|{
  210|  2.18M|  mpi_mul (w, u, v);
  ------------------
  |  |  523|  2.18M|#define mpi_mul(w,u,v)         _gcry_mpi_mul ((w),(u),(v))
  ------------------
  211|  2.18M|  _gcry_mpi_tdiv_r (w, w, m);
  212|  2.18M|}

_gcry_mpi_powm:
  407|  1.36M|{
  408|       |  /* Pointer to the limbs of the arguments, their size and signs. */
  409|  1.36M|  mpi_ptr_t  rp, ep, mp, bp;
  410|  1.36M|  mpi_size_t esize, msize, bsize, rsize;
  411|  1.36M|  int               msign, bsign, rsign;
  412|       |  /* Flags telling the secure allocation status of the arguments.  */
  413|  1.36M|  int        esec,  msec,  bsec;
  414|       |  /* Size of the result including space for temporary values.  */
  415|  1.36M|  mpi_size_t size;
  416|       |  /* Helper.  */
  417|  1.36M|  int mod_shift_cnt;
  418|  1.36M|  int negative_result;
  419|  1.36M|  mpi_ptr_t mp_marker = NULL;
  420|  1.36M|  mpi_ptr_t bp_marker = NULL;
  421|  1.36M|  mpi_ptr_t ep_marker = NULL;
  422|  1.36M|  mpi_ptr_t xp_marker = NULL;
  423|  1.36M|  unsigned int mp_nlimbs = 0;
  424|  1.36M|  unsigned int bp_nlimbs = 0;
  425|  1.36M|  unsigned int ep_nlimbs = 0;
  426|  1.36M|  unsigned int xp_nlimbs = 0;
  427|  1.36M|  mpi_ptr_t precomp[SIZE_PRECOMP]; /* Pre-computed array: BASE^1, ^3, ^5, ... */
  428|  1.36M|  mpi_size_t precomp_size[SIZE_PRECOMP];
  429|  1.36M|  mpi_size_t W;
  430|  1.36M|  mpi_ptr_t base_u;
  431|  1.36M|  mpi_size_t base_u_size;
  432|  1.36M|  mpi_size_t max_u_size;
  433|       |
  434|  1.36M|  esize = expo->nlimbs;
  435|  1.36M|  msize = mod->nlimbs;
  436|  1.36M|  size = 2 * msize;
  437|  1.36M|  msign = mod->sign;
  438|       |
  439|  1.36M|  ep = expo->d;
  440|  1.36M|  MPN_NORMALIZE(ep, esize);
  ------------------
  |  |  119|  1.36M|    do {		       \
  |  |  120|  1.36M|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 1.36M, False: 7]
  |  |  ------------------
  |  |  121|  1.36M|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 1.36M, False: 0]
  |  |  ------------------
  |  |  122|  1.36M|		break;	       \
  |  |  123|  1.36M|	    (n)--;	       \
  |  |  124|      0|	}		       \
  |  |  125|  1.36M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  441|       |
  442|  1.36M|  if (esize * BITS_PER_MPI_LIMB > 512)
  ------------------
  |  |   49|  1.36M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  1.36M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  1.36M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (442:7): [True: 176, False: 1.36M]
  ------------------
  443|    176|    W = 5;
  444|  1.36M|  else if (esize * BITS_PER_MPI_LIMB > 256)
  ------------------
  |  |   49|  1.36M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  1.36M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  1.36M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (444:12): [True: 18, False: 1.36M]
  ------------------
  445|     18|    W = 4;
  446|  1.36M|  else if (esize * BITS_PER_MPI_LIMB > 128)
  ------------------
  |  |   49|  1.36M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  1.36M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  1.36M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (446:12): [True: 4.60k, False: 1.36M]
  ------------------
  447|  4.60k|    W = 3;
  448|  1.36M|  else if (esize * BITS_PER_MPI_LIMB > 64)
  ------------------
  |  |   49|  1.36M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  1.36M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  1.36M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (448:12): [True: 10, False: 1.36M]
  ------------------
  449|     10|    W = 2;
  450|  1.36M|  else
  451|  1.36M|    W = 1;
  452|       |
  453|  1.36M|  esec = mpi_is_secure(expo);
  ------------------
  |  |  115|  1.36M|#define mpi_is_secure(a)      ((a) && ((a)->flags&1))
  |  |  ------------------
  |  |  |  Branch (115:32): [True: 1.36M, False: 0]
  |  |  |  Branch (115:39): [True: 0, False: 1.36M]
  |  |  ------------------
  ------------------
  454|  1.36M|  msec = mpi_is_secure(mod);
  ------------------
  |  |  115|  1.36M|#define mpi_is_secure(a)      ((a) && ((a)->flags&1))
  |  |  ------------------
  |  |  |  Branch (115:32): [True: 1.36M, False: 0]
  |  |  |  Branch (115:39): [True: 0, False: 1.36M]
  |  |  ------------------
  ------------------
  455|  1.36M|  bsec = mpi_is_secure(base);
  ------------------
  |  |  115|  1.36M|#define mpi_is_secure(a)      ((a) && ((a)->flags&1))
  |  |  ------------------
  |  |  |  Branch (115:32): [True: 1.36M, False: 0]
  |  |  |  Branch (115:39): [True: 0, False: 1.36M]
  |  |  ------------------
  ------------------
  456|       |
  457|  1.36M|  rp = res->d;
  458|       |
  459|  1.36M|  if (!msize)
  ------------------
  |  Branch (459:7): [True: 0, False: 1.36M]
  ------------------
  460|      0|    _gcry_divide_by_zero();
  461|       |
  462|  1.36M|  if (!esize)
  ------------------
  |  Branch (462:7): [True: 7, False: 1.36M]
  ------------------
  463|      7|    {
  464|       |      /* Exponent is zero, result is 1 mod MOD, i.e., 1 or 0 depending
  465|       |         on if MOD equals 1.  */
  466|      7|      res->nlimbs = (msize == 1 && mod->d[0] == 1) ? 0 : 1;
  ------------------
  |  Branch (466:22): [True: 0, False: 7]
  |  Branch (466:36): [True: 0, False: 0]
  ------------------
  467|      7|      if (res->nlimbs)
  ------------------
  |  Branch (467:11): [True: 7, False: 0]
  ------------------
  468|      7|        {
  469|      7|          RESIZE_IF_NEEDED (res, 1);
  ------------------
  |  |   78|      7|    do {			   \
  |  |   79|      7|	if( (a)->alloced < (b) )   \
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 7, False: 0]
  |  |  ------------------
  |  |   80|      7|	    mpi_resize((a), (b));  \
  |  |  ------------------
  |  |  |  |  100|      7|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  |  |  ------------------
  |  |   81|      7|    } while(0)
  |  |  ------------------
  |  |  |  Branch (81:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  470|      7|          rp = res->d;
  471|      7|          rp[0] = 1;
  472|      7|        }
  473|      7|      res->sign = 0;
  474|      7|      goto leave;
  475|      7|    }
  476|       |
  477|       |  /* Normalize MOD (i.e. make its most significant bit set) as
  478|       |     required by mpn_divrem.  This will make the intermediate values
  479|       |     in the calculation slightly larger, but the correct result is
  480|       |     obtained after a final reduction using the original MOD value. */
  481|  1.36M|  mp_nlimbs = msec? msize:0;
  ------------------
  |  Branch (481:15): [True: 0, False: 1.36M]
  ------------------
  482|  1.36M|  mp = mp_marker = mpi_alloc_limb_space(msize, msec);
  ------------------
  |  |  178|  1.36M|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  483|  1.36M|  count_leading_zeros (mod_shift_cnt, mod->d[msize-1]);
  ------------------
  |  |  617|  1.36M|  do {                                                                  \
  |  |  618|  1.36M|    UDItype __cbtmp;                                                    \
  |  |  619|  1.36M|    __asm__ ("bsrq %1,%0"                                               \
  |  |  620|  1.36M|             : "=r" (__cbtmp) : "rm" ((UDItype)(x))                     \
  |  |  621|  1.36M|             __CLOBBER_CC);                                             \
  |  |  622|  1.36M|    (count) = __cbtmp ^ 63;                                             \
  |  |  623|  1.36M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (623:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  484|  1.36M|  if (mod_shift_cnt)
  ------------------
  |  Branch (484:7): [True: 248k, False: 1.12M]
  ------------------
  485|   248k|    _gcry_mpih_lshift (mp, mod->d, msize, mod_shift_cnt);
  486|  1.12M|  else
  487|  1.12M|    MPN_COPY( mp, mod->d, msize );
  ------------------
  |  |   90|  1.12M|    do {				\
  |  |   91|  1.12M|	mpi_size_t _i;			\
  |  |   92|  5.67M|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 4.55M, False: 1.12M]
  |  |  ------------------
  |  |   93|  4.55M|	    (d)[_i] = (s)[_i];		\
  |  |   94|  1.12M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  488|       |
  489|  1.36M|  bsize = base->nlimbs;
  490|  1.36M|  bsign = base->sign;
  491|  1.36M|  if (bsize > msize)
  ------------------
  |  Branch (491:7): [True: 306, False: 1.36M]
  ------------------
  492|    306|    {
  493|       |      /* The base is larger than the module.  Reduce it.
  494|       |
  495|       |         Allocate (BSIZE + 1) with space for remainder and quotient.
  496|       |         (The quotient is (bsize - msize + 1) limbs.)  */
  497|    306|      bp_nlimbs = bsec ? (bsize + 1):0;
  ------------------
  |  Branch (497:19): [True: 0, False: 306]
  ------------------
  498|    306|      bp = bp_marker = mpi_alloc_limb_space( bsize + 1, bsec );
  ------------------
  |  |  178|    306|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  499|    306|      MPN_COPY ( bp, base->d, bsize );
  ------------------
  |  |   90|    306|    do {				\
  |  |   91|    306|	mpi_size_t _i;			\
  |  |   92|  11.1k|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 10.8k, False: 306]
  |  |  ------------------
  |  |   93|  10.8k|	    (d)[_i] = (s)[_i];		\
  |  |   94|    306|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  500|       |      /* We don't care about the quotient, store it above the
  501|       |       * remainder, at BP + MSIZE.  */
  502|    306|      _gcry_mpih_divrem( bp + msize, 0, bp, bsize, mp, msize );
  503|    306|      bsize = msize;
  504|       |      /* Canonicalize the base, since we are going to multiply with it
  505|       |         quite a few times.  */
  506|    306|      MPN_NORMALIZE( bp, bsize );
  ------------------
  |  |  119|    306|    do {		       \
  |  |  120|  3.95k|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 3.95k, False: 0]
  |  |  ------------------
  |  |  121|  3.95k|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 306, False: 3.65k]
  |  |  ------------------
  |  |  122|  3.95k|		break;	       \
  |  |  123|  3.95k|	    (n)--;	       \
  |  |  124|  3.65k|	}		       \
  |  |  125|    306|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  507|    306|    }
  508|  1.36M|  else
  509|  1.36M|    bp = base->d;
  510|       |
  511|  1.36M|  if (!bsize)
  ------------------
  |  Branch (511:7): [True: 189, False: 1.36M]
  ------------------
  512|    189|    {
  513|    189|      res->nlimbs = 0;
  514|    189|      res->sign = 0;
  515|    189|      goto leave;
  516|    189|    }
  517|       |
  518|       |
  519|       |  /* Make BASE, EXPO not overlap with RES.  We don't need to check MOD
  520|       |     because that has already been copied to the MP var.  */
  521|  1.36M|  if ( rp == bp )
  ------------------
  |  Branch (521:8): [True: 4.59k, False: 1.36M]
  ------------------
  522|  4.59k|    {
  523|       |      /* RES and BASE are identical.  Allocate temp. space for BASE.  */
  524|  4.59k|      gcry_assert (!bp_marker);
  ------------------
  |  |  188|  4.59k|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|  4.59k|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 4.59k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|  4.59k|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  525|  4.59k|      bp_nlimbs = bsec? bsize:0;
  ------------------
  |  Branch (525:19): [True: 0, False: 4.59k]
  ------------------
  526|  4.59k|      bp = bp_marker = mpi_alloc_limb_space( bsize, bsec );
  ------------------
  |  |  178|  4.59k|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  527|  4.59k|      MPN_COPY(bp, rp, bsize);
  ------------------
  |  |   90|  4.59k|    do {				\
  |  |   91|  4.59k|	mpi_size_t _i;			\
  |  |   92|  22.9k|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 18.3k, False: 4.59k]
  |  |  ------------------
  |  |   93|  18.3k|	    (d)[_i] = (s)[_i];		\
  |  |   94|  4.59k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  528|  4.59k|    }
  529|  1.36M|  if ( rp == ep )
  ------------------
  |  Branch (529:8): [True: 0, False: 1.36M]
  ------------------
  530|      0|    {
  531|       |      /* RES and EXPO are identical.  Allocate temp. space for EXPO.  */
  532|      0|      ep_nlimbs = esec? esize:0;
  ------------------
  |  Branch (532:19): [True: 0, False: 0]
  ------------------
  533|      0|      ep = ep_marker = mpi_alloc_limb_space( esize, esec );
  ------------------
  |  |  178|      0|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  534|      0|      MPN_COPY(ep, rp, esize);
  ------------------
  |  |   90|      0|    do {				\
  |  |   91|      0|	mpi_size_t _i;			\
  |  |   92|      0|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 0, False: 0]
  |  |  ------------------
  |  |   93|      0|	    (d)[_i] = (s)[_i];		\
  |  |   94|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  535|      0|    }
  536|       |
  537|       |  /* Copy base to the result.  */
  538|  1.36M|  if (res->alloced < size)
  ------------------
  |  Branch (538:7): [True: 13.8k, False: 1.35M]
  ------------------
  539|  13.8k|    {
  540|  13.8k|      mpi_resize (res, size);
  ------------------
  |  |  100|  13.8k|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
  541|  13.8k|      rp = res->d;
  542|  13.8k|    }
  543|       |
  544|       |  /* Main processing.  */
  545|  1.36M|  {
  546|  1.36M|    mpi_size_t i, j, k;
  547|  1.36M|    mpi_ptr_t xp;
  548|  1.36M|    mpi_size_t xsize = 0;
  549|  1.36M|    int c;
  550|  1.36M|    mpi_limb_t e;
  551|  1.36M|    mpi_limb_t carry_limb;
  552|  1.36M|    struct karatsuba_ctx karactx;
  553|  1.36M|    mpi_ptr_t tp;
  554|       |
  555|  1.36M|    xp_nlimbs = msec? size:0;
  ------------------
  |  Branch (555:17): [True: 0, False: 1.36M]
  ------------------
  556|  1.36M|    xp = xp_marker = mpi_alloc_limb_space( size, msec );
  ------------------
  |  |  178|  1.36M|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  557|       |
  558|  1.36M|    memset( &karactx, 0, sizeof karactx );
  559|  1.36M|    negative_result = (ep[0] & 1) && bsign;
  ------------------
  |  Branch (559:23): [True: 1.05M, False: 313k]
  |  Branch (559:38): [True: 0, False: 1.05M]
  ------------------
  560|       |
  561|       |    /* Precompute PRECOMP[], BASE^(2 * i + 1), BASE^1, ^3, ^5, ... */
  562|  1.36M|    if (W > 1)                  /* X := BASE^2 */
  ------------------
  |  Branch (562:9): [True: 4.80k, False: 1.36M]
  ------------------
  563|  4.80k|      mul_mod (xp, &xsize, bp, bsize, bp, bsize, mp, msize, &karactx);
  564|  1.36M|    base_u = precomp[0] = mpi_alloc_limb_space (bsize, esec);
  ------------------
  |  |  178|  1.36M|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  565|  1.36M|    base_u_size = max_u_size = precomp_size[0] = bsize;
  566|  1.36M|    MPN_COPY (precomp[0], bp, bsize);
  ------------------
  |  |   90|  1.36M|    do {				\
  |  |   91|  1.36M|	mpi_size_t _i;			\
  |  |   92|  6.63M|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 5.26M, False: 1.36M]
  |  |  ------------------
  |  |   93|  5.26M|	    (d)[_i] = (s)[_i];		\
  |  |   94|  1.36M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  567|  1.38M|    for (i = 1; i < (1 << (W - 1)); i++)
  ------------------
  |  Branch (567:17): [True: 16.5k, False: 1.36M]
  ------------------
  568|  16.5k|      {                         /* PRECOMP[i] = BASE^(2 * i + 1) */
  569|  16.5k|        if (xsize >= base_u_size)
  ------------------
  |  Branch (569:13): [True: 13.9k, False: 2.59k]
  ------------------
  570|  13.9k|          mul_mod (rp, &rsize, xp, xsize, base_u, base_u_size,
  571|  13.9k|                   mp, msize, &karactx);
  572|  2.59k|        else
  573|  2.59k|          mul_mod (rp, &rsize, base_u, base_u_size, xp, xsize,
  574|  2.59k|                   mp, msize, &karactx);
  575|  16.5k|        base_u = precomp[i] = mpi_alloc_limb_space (rsize, esec);
  ------------------
  |  |  178|  16.5k|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  576|  16.5k|        base_u_size = precomp_size[i] = rsize;
  577|  16.5k|        if (max_u_size < base_u_size)
  ------------------
  |  Branch (577:13): [True: 1.14k, False: 15.4k]
  ------------------
  578|  1.14k|          max_u_size = base_u_size;
  579|  16.5k|        MPN_COPY (precomp[i], rp, rsize);
  ------------------
  |  |   90|  16.5k|    do {				\
  |  |   91|  16.5k|	mpi_size_t _i;			\
  |  |   92|   112k|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 96.2k, False: 16.5k]
  |  |  ------------------
  |  |   93|  96.2k|	    (d)[_i] = (s)[_i];		\
  |  |   94|  16.5k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  580|  16.5k|      }
  581|       |
  582|  1.36M|    if (msize > max_u_size)
  ------------------
  |  Branch (582:9): [True: 346k, False: 1.02M]
  ------------------
  583|   346k|      max_u_size = msize;
  584|  1.36M|    base_u = mpi_alloc_limb_space (max_u_size, esec);
  ------------------
  |  |  178|  1.36M|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  585|  1.36M|    MPN_ZERO (base_u, max_u_size);
  ------------------
  |  |  112|  1.36M|    do {				  \
  |  |  113|  1.36M|	int  _i;			  \
  |  |  114|  8.08M|	for( _i = 0; _i < (n); _i++ )  \
  |  |  ------------------
  |  |  |  Branch (114:15): [True: 6.71M, False: 1.36M]
  |  |  ------------------
  |  |  115|  6.71M|	    (d)[_i] = 0;		    \
  |  |  116|  1.36M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (116:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  586|       |
  587|  1.36M|    i = esize - 1;
  588|       |
  589|       |    /* Main loop.
  590|       |
  591|       |       Make the result be pointed to alternately by XP and RP.  This
  592|       |       helps us avoid block copying, which would otherwise be
  593|       |       necessary with the overlap restrictions of
  594|       |       _gcry_mpih_divmod. With 50% probability the result after this
  595|       |       loop will be in the area originally pointed by RP (==RES->d),
  596|       |       and with 50% probability in the area originally pointed to by XP. */
  597|  1.36M|    rsign = 0;
  598|  1.36M|    if (W == 1)
  ------------------
  |  Branch (598:9): [True: 1.36M, False: 4.80k]
  ------------------
  599|  1.36M|      {
  600|  1.36M|        rsize = bsize;
  601|  1.36M|      }
  602|  4.80k|    else
  603|  4.80k|      {
  604|  4.80k|        rsize = msize;
  605|  4.80k|        MPN_ZERO (rp, rsize);
  ------------------
  |  |  112|  4.80k|    do {				  \
  |  |  113|  4.80k|	int  _i;			  \
  |  |  114|  27.2k|	for( _i = 0; _i < (n); _i++ )  \
  |  |  ------------------
  |  |  |  Branch (114:15): [True: 22.4k, False: 4.80k]
  |  |  ------------------
  |  |  115|  22.4k|	    (d)[_i] = 0;		    \
  |  |  116|  4.80k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (116:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  606|  4.80k|      }
  607|  1.36M|    MPN_COPY ( rp, bp, bsize );
  ------------------
  |  |   90|  1.36M|    do {				\
  |  |   91|  1.36M|	mpi_size_t _i;			\
  |  |   92|  6.63M|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 5.26M, False: 1.36M]
  |  |  ------------------
  |  |   93|  5.26M|	    (d)[_i] = (s)[_i];		\
  |  |   94|  1.36M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  608|       |
  609|  1.36M|    e = ep[i];
  610|  1.36M|    count_leading_zeros (c, e);
  ------------------
  |  |  617|  1.36M|  do {                                                                  \
  |  |  618|  1.36M|    UDItype __cbtmp;                                                    \
  |  |  619|  1.36M|    __asm__ ("bsrq %1,%0"                                               \
  |  |  620|  1.36M|             : "=r" (__cbtmp) : "rm" ((UDItype)(x))                     \
  |  |  621|  1.36M|             __CLOBBER_CC);                                             \
  |  |  622|  1.36M|    (count) = __cbtmp ^ 63;                                             \
  |  |  623|  1.36M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (623:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  611|  1.36M|    e = (e << c) << 1;
  612|  1.36M|    c = BITS_PER_MPI_LIMB - 1 - c;
  ------------------
  |  |   49|  1.36M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  1.36M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  1.36M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  613|       |
  614|  1.36M|    j = 0;
  615|       |
  616|  1.36M|    for (;;)
  617|  2.84M|      if (e == 0)
  ------------------
  |  Branch (617:11): [True: 1.37M, False: 1.47M]
  ------------------
  618|  1.37M|        {
  619|  1.37M|          j += c;
  620|  1.37M|          if ( --i < 0 )
  ------------------
  |  Branch (620:16): [True: 1.36M, False: 6.59k]
  ------------------
  621|  1.36M|            break;
  622|       |
  623|  6.59k|          e = ep[i];
  624|  6.59k|          c = BITS_PER_MPI_LIMB;
  ------------------
  |  |   49|  6.59k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  6.59k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  6.59k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  625|  6.59k|        }
  626|  1.47M|      else
  627|  1.47M|        {
  628|  1.47M|          int c0;
  629|  1.47M|          mpi_limb_t e0;
  630|  1.47M|          struct gcry_mpi w, u;
  631|  1.47M|          w.sign = u.sign = 0;
  632|  1.47M|          w.flags = u.flags = 0;
  633|  1.47M|          w.d = base_u;
  634|       |
  635|  1.47M|          count_leading_zeros (c0, e);
  ------------------
  |  |  617|  1.47M|  do {                                                                  \
  |  |  618|  1.47M|    UDItype __cbtmp;                                                    \
  |  |  619|  1.47M|    __asm__ ("bsrq %1,%0"                                               \
  |  |  620|  1.47M|             : "=r" (__cbtmp) : "rm" ((UDItype)(x))                     \
  |  |  621|  1.47M|             __CLOBBER_CC);                                             \
  |  |  622|  1.47M|    (count) = __cbtmp ^ 63;                                             \
  |  |  623|  1.47M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (623:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  636|  1.47M|          e = (e << c0);
  637|  1.47M|          c -= c0;
  638|  1.47M|          j += c0;
  639|       |
  640|  1.47M|          e0 = (e >> (BITS_PER_MPI_LIMB - W));
  ------------------
  |  |   49|  1.47M|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  1.47M|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  1.47M|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  641|  1.47M|          if (c >= W)
  ------------------
  |  Branch (641:15): [True: 1.45M, False: 15.5k]
  ------------------
  642|  1.45M|            c0 = 0;
  643|  15.5k|          else
  644|  15.5k|            {
  645|  15.5k|              if ( --i < 0 )
  ------------------
  |  Branch (645:20): [True: 4.64k, False: 10.9k]
  ------------------
  646|  4.64k|                {
  647|  4.64k|                  e0 = (e >> (BITS_PER_MPI_LIMB - c));
  ------------------
  |  |   49|  4.64k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  4.64k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  4.64k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  648|  4.64k|                  j += c - W;
  649|  4.64k|                  goto last_step;
  650|  4.64k|                }
  651|  10.9k|              else
  652|  10.9k|                {
  653|  10.9k|                  c0 = c;
  654|  10.9k|                  e = ep[i];
  655|  10.9k|                  c = BITS_PER_MPI_LIMB;
  ------------------
  |  |   49|  10.9k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  10.9k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  10.9k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  656|  10.9k|                  e0 |= (e >> (BITS_PER_MPI_LIMB - (W - c0)));
  ------------------
  |  |   49|  10.9k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  10.9k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  10.9k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  657|  10.9k|                }
  658|  15.5k|            }
  659|       |
  660|  1.46M|          e = e << (W - c0);
  661|  1.46M|          c -= (W - c0);
  662|       |
  663|  1.47M|        last_step:
  664|  1.47M|          count_trailing_zeros (c0, e0);
  ------------------
  |  |  625|  1.47M|  do {                                                                  \
  |  |  626|  1.47M|    UDItype __cbtmp;                                                    \
  |  |  627|  1.47M|    __asm__ ("rep;bsfq %1,%0"                                           \
  |  |  628|  1.47M|             : "=r" (__cbtmp) : "rm" ((UDItype)(x))                     \
  |  |  629|  1.47M|             __CLOBBER_CC);                                             \
  |  |  630|  1.47M|    (count) = __cbtmp;                                                  \
  |  |  631|  1.47M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (631:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  665|  1.47M|          e0 = (e0 >> c0) >> 1;
  666|       |
  667|  5.40M|          for (j += W - c0; j >= 0; j--)
  ------------------
  |  Branch (667:29): [True: 3.93M, False: 1.47M]
  ------------------
  668|  3.93M|            {
  669|       |
  670|       |              /*
  671|       |               *  base_u <= precomp[e0]
  672|       |               *  base_u_size <= precomp_size[e0]
  673|       |               */
  674|  3.93M|              base_u_size = 0;
  675|  16.4M|              for (k = 0; k < (1<< (W - 1)); k++)
  ------------------
  |  Branch (675:27): [True: 12.5M, False: 3.93M]
  ------------------
  676|  12.5M|                {
  677|  12.5M|                  w.alloced = w.nlimbs = precomp_size[k];
  678|  12.5M|                  u.alloced = u.nlimbs = precomp_size[k];
  679|  12.5M|                  u.d = precomp[k];
  680|       |
  681|  12.5M|                  mpi_set_cond (&w, &u, k == e0);
  ------------------
  |  |  122|  12.5M|#define mpi_set_cond(w,u,set)  _gcry_mpi_set_cond ((w),(u),(set))
  ------------------
  682|  12.5M|                  base_u_size |= ( precomp_size[k] & (0UL - (k == e0)) );
  683|  12.5M|                }
  684|       |
  685|  3.93M|              w.alloced = w.nlimbs = rsize;
  686|  3.93M|              u.alloced = u.nlimbs = rsize;
  687|  3.93M|              u.d = rp;
  688|  3.93M|              mpi_set_cond (&w, &u, j != 0);
  ------------------
  |  |  122|  3.93M|#define mpi_set_cond(w,u,set)  _gcry_mpi_set_cond ((w),(u),(set))
  ------------------
  689|  3.93M|              base_u_size ^= ((base_u_size ^ rsize)  & (0UL - (j != 0)));
  690|       |
  691|  3.93M|              mul_mod (xp, &xsize, rp, rsize, base_u, base_u_size,
  692|  3.93M|                       mp, msize, &karactx);
  693|  3.93M|              tp = rp; rp = xp; xp = tp;
  694|  3.93M|              rsize = xsize;
  695|  3.93M|            }
  696|       |
  697|  1.47M|          j = c0;
  698|  1.47M|          if ( i < 0 )
  ------------------
  |  Branch (698:16): [True: 4.64k, False: 1.46M]
  ------------------
  699|  4.64k|            break;
  700|  1.47M|        }
  701|       |
  702|  1.99M|    while (j--)
  ------------------
  |  Branch (702:12): [True: 629k, False: 1.36M]
  ------------------
  703|   629k|      {
  704|   629k|        mul_mod (xp, &xsize, rp, rsize, rp, rsize, mp, msize, &karactx);
  705|   629k|        tp = rp; rp = xp; xp = tp;
  706|   629k|        rsize = xsize;
  707|   629k|      }
  708|       |
  709|       |    /* We shifted MOD, the modulo reduction argument, left
  710|       |       MOD_SHIFT_CNT steps.  Adjust the result by reducing it with the
  711|       |       original MOD.
  712|       |
  713|       |       Also make sure the result is put in RES->d (where it already
  714|       |       might be, see above).  */
  715|  1.36M|    if ( mod_shift_cnt )
  ------------------
  |  Branch (715:10): [True: 248k, False: 1.12M]
  ------------------
  716|   248k|      {
  717|   248k|        carry_limb = _gcry_mpih_lshift( res->d, rp, rsize, mod_shift_cnt);
  718|   248k|        rp = res->d;
  719|   248k|        if ( carry_limb )
  ------------------
  |  Branch (719:14): [True: 166k, False: 81.8k]
  ------------------
  720|   166k|          {
  721|   166k|            rp[rsize] = carry_limb;
  722|   166k|            rsize++;
  723|   166k|          }
  724|   248k|      }
  725|  1.12M|    else if (res->d != rp)
  ------------------
  |  Branch (725:14): [True: 1.14k, False: 1.12M]
  ------------------
  726|  1.14k|      {
  727|  1.14k|        MPN_COPY (res->d, rp, rsize);
  ------------------
  |  |   90|  1.14k|    do {				\
  |  |   91|  1.14k|	mpi_size_t _i;			\
  |  |   92|  27.7k|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 26.5k, False: 1.14k]
  |  |  ------------------
  |  |   93|  26.5k|	    (d)[_i] = (s)[_i];		\
  |  |   94|  1.14k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  728|  1.14k|        rp = res->d;
  729|  1.14k|      }
  730|       |
  731|  1.36M|    if ( rsize >= msize )
  ------------------
  |  Branch (731:10): [True: 1.02M, False: 344k]
  ------------------
  732|  1.02M|      {
  733|  1.02M|        _gcry_mpih_divrem(rp + msize, 0, rp, rsize, mp, msize);
  734|  1.02M|        rsize = msize;
  735|  1.02M|      }
  736|       |
  737|       |    /* Remove any leading zero words from the result.  */
  738|  1.36M|    if ( mod_shift_cnt )
  ------------------
  |  Branch (738:10): [True: 248k, False: 1.12M]
  ------------------
  739|   248k|      _gcry_mpih_rshift( rp, rp, rsize, mod_shift_cnt);
  740|  1.36M|    MPN_NORMALIZE (rp, rsize);
  ------------------
  |  |  119|  1.36M|    do {		       \
  |  |  120|  2.06M|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 2.06M, False: 1]
  |  |  ------------------
  |  |  121|  2.06M|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 1.36M, False: 692k]
  |  |  ------------------
  |  |  122|  2.06M|		break;	       \
  |  |  123|  2.06M|	    (n)--;	       \
  |  |  124|   692k|	}		       \
  |  |  125|  1.36M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  741|       |
  742|  1.36M|    _gcry_mpih_release_karatsuba_ctx (&karactx );
  743|  2.75M|    for (i = 0; i < (1 << (W - 1)); i++)
  ------------------
  |  Branch (743:17): [True: 1.38M, False: 1.36M]
  ------------------
  744|  1.38M|      _gcry_mpi_free_limb_space( precomp[i], esec ? precomp_size[i] : 0 );
  ------------------
  |  Branch (744:46): [True: 0, False: 1.38M]
  ------------------
  745|  1.36M|    _gcry_mpi_free_limb_space (base_u, esec ? max_u_size : 0);
  ------------------
  |  Branch (745:40): [True: 0, False: 1.36M]
  ------------------
  746|  1.36M|  }
  747|       |
  748|       |  /* Fixup for negative results.  */
  749|  1.36M|  if ( negative_result && rsize )
  ------------------
  |  Branch (749:8): [True: 0, False: 1.36M]
  |  Branch (749:27): [True: 0, False: 0]
  ------------------
  750|      0|    {
  751|      0|      if ( mod_shift_cnt )
  ------------------
  |  Branch (751:12): [True: 0, False: 0]
  ------------------
  752|      0|        _gcry_mpih_rshift( mp, mp, msize, mod_shift_cnt);
  753|      0|      _gcry_mpih_sub( rp, mp, msize, rp, rsize);
  754|      0|      rsize = msize;
  755|      0|      rsign = msign;
  756|      0|      MPN_NORMALIZE(rp, rsize);
  ------------------
  |  |  119|      0|    do {		       \
  |  |  120|      0|	while( (n) > 0 ) {     \
  |  |  ------------------
  |  |  |  Branch (120:9): [True: 0, False: 0]
  |  |  ------------------
  |  |  121|      0|	    if( (d)[(n)-1] ) \
  |  |  ------------------
  |  |  |  Branch (121:10): [True: 0, False: 0]
  |  |  ------------------
  |  |  122|      0|		break;	       \
  |  |  123|      0|	    (n)--;	       \
  |  |  124|      0|	}		       \
  |  |  125|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (125:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  757|      0|    }
  758|  1.36M|  gcry_assert (res->d == rp);
  ------------------
  |  |  188|  1.36M|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|  1.36M|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 1.36M, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|  1.36M|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  759|      0|  res->nlimbs = rsize;
  760|  1.36M|  res->sign = rsign;
  761|       |
  762|  1.36M| leave:
  763|  1.36M|  if (mp_marker)
  ------------------
  |  Branch (763:7): [True: 1.36M, False: 7]
  ------------------
  764|  1.36M|    _gcry_mpi_free_limb_space( mp_marker, mp_nlimbs );
  765|  1.36M|  if (bp_marker)
  ------------------
  |  Branch (765:7): [True: 4.89k, False: 1.36M]
  ------------------
  766|  4.89k|    _gcry_mpi_free_limb_space( bp_marker, bp_nlimbs );
  767|  1.36M|  if (ep_marker)
  ------------------
  |  Branch (767:7): [True: 0, False: 1.36M]
  ------------------
  768|      0|    _gcry_mpi_free_limb_space( ep_marker, ep_nlimbs );
  769|  1.36M|  if (xp_marker)
  ------------------
  |  Branch (769:7): [True: 1.36M, False: 196]
  ------------------
  770|  1.36M|    _gcry_mpi_free_limb_space( xp_marker, xp_nlimbs );
  771|  1.36M|}
mpi-pow.c:mul_mod:
  376|  4.58M|{
  377|  4.58M|  if( ssize < KARATSUBA_THRESHOLD )
  ------------------
  |  |   61|  4.58M|#define KARATSUBA_THRESHOLD 16
  ------------------
  |  Branch (377:7): [True: 4.30M, False: 280k]
  ------------------
  378|  4.30M|    _gcry_mpih_mul ( xp, rp, rsize, sp, ssize );
  379|   280k|  else
  380|   280k|    _gcry_mpih_mul_karatsuba_case (xp, rp, rsize, sp, ssize, karactx_p);
  381|       |
  382|  4.58M|   if (rsize + ssize > msize)
  ------------------
  |  Branch (382:8): [True: 3.89M, False: 694k]
  ------------------
  383|  3.89M|    {
  384|  3.89M|      _gcry_mpih_divrem (xp + msize, 0, xp, rsize + ssize, mp, msize);
  385|  3.89M|      *xsize_p = msize;
  386|  3.89M|    }
  387|   694k|   else
  388|   694k|     *xsize_p = rsize + ssize;
  389|  4.58M|}

_gcry_mpi_trailing_zeros:
  114|  1.19k|{
  115|  1.19k|    unsigned n, count = 0;
  116|       |
  117|  2.66k|    for(n=0; n < a->nlimbs; n++ ) {
  ------------------
  |  Branch (117:14): [True: 2.66k, False: 0]
  ------------------
  118|  2.66k|	if( a->d[n] ) {
  ------------------
  |  Branch (118:6): [True: 1.19k, False: 1.46k]
  ------------------
  119|  1.19k|	    unsigned nn;
  120|  1.19k|	    mpi_limb_t alimb = a->d[n];
  121|       |
  122|  1.19k|	    count_trailing_zeros( nn, alimb );
  ------------------
  |  |  625|  1.19k|  do {                                                                  \
  |  |  626|  1.19k|    UDItype __cbtmp;                                                    \
  |  |  627|  1.19k|    __asm__ ("rep;bsfq %1,%0"                                           \
  |  |  628|  1.19k|             : "=r" (__cbtmp) : "rm" ((UDItype)(x))                     \
  |  |  629|  1.19k|             __CLOBBER_CC);                                             \
  |  |  630|  1.19k|    (count) = __cbtmp;                                                  \
  |  |  631|  1.19k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (631:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  123|  1.19k|	    count += nn;
  124|  1.19k|	    break;
  125|  1.19k|	}
  126|  1.46k|	count += BITS_PER_MPI_LIMB;
  ------------------
  |  |   49|  1.46k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|  1.46k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|  1.46k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  127|  1.46k|    }
  128|  1.19k|    return count;
  129|       |
  130|  1.19k|}

_gcry_mpi_get_buffer:
  383|   127k|{
  384|   127k|  if (mpi_get_flag (a, GCRYMPI_FLAG_OPAQUE))
  ------------------
  |  |  566|   127k|#define mpi_get_flag(a,f)      _gcry_mpi_get_flag ((a), (f))
  |  |  ------------------
  |  |  |  Branch (566:32): [True: 0, False: 127k]
  |  |  ------------------
  ------------------
  385|      0|    {
  386|      0|      unsigned int nbits;
  387|      0|      byte *p = _gcry_mpi_get_opaque_copy (a, &nbits);
  388|       |
  389|      0|      if (r_nbytes)
  ------------------
  |  Branch (389:11): [True: 0, False: 0]
  ------------------
  390|      0|        *r_nbytes = (nbits+7)/8;
  391|       |
  392|      0|      return p;
  393|      0|    }
  394|   127k|  else
  395|   127k|    return do_get_buffer (a, fill_le, 0, r_nbytes, sign, 0);
  396|   127k|}
_gcry_mpi_get_buffer_extra:
  401|  9.18k|{
  402|  9.18k|  return do_get_buffer (a, fill_le, extraalloc, r_nbytes, sign, 0);
  403|  9.18k|}
_gcry_mpi_set_buffer:
  420|  67.9k|{
  421|  67.9k|  const unsigned char *buffer = (const unsigned char*)buffer_arg;
  422|  67.9k|  const unsigned char *p;
  423|  67.9k|  mpi_limb_t alimb;
  424|  67.9k|  int nlimbs;
  425|  67.9k|  int i;
  426|       |
  427|  67.9k|  if (mpi_is_immutable (a))
  ------------------
  |  |  113|  67.9k|#define mpi_is_immutable(a)   ((a)->flags&16)
  |  |  ------------------
  |  |  |  Branch (113:31): [True: 0, False: 67.9k]
  |  |  ------------------
  ------------------
  428|      0|    {
  429|      0|      mpi_immutable_failed ();
  ------------------
  |  |  110|      0|#define mpi_immutable_failed() _gcry_mpi_immutable_failed ()
  ------------------
  430|      0|      return;
  431|      0|    }
  432|       |
  433|  67.9k|  nlimbs = (nbytes + BYTES_PER_MPI_LIMB - 1) / BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|  67.9k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  67.9k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
                nlimbs = (nbytes + BYTES_PER_MPI_LIMB - 1) / BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|  67.9k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  67.9k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
  434|  67.9k|  RESIZE_IF_NEEDED(a, nlimbs);
  ------------------
  |  |   78|  67.9k|    do {			   \
  |  |   79|  67.9k|	if( (a)->alloced < (b) )   \
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 13.7k, False: 54.1k]
  |  |  ------------------
  |  |   80|  67.9k|	    mpi_resize((a), (b));  \
  |  |  ------------------
  |  |  |  |  100|  13.7k|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  |  |  ------------------
  |  |   81|  67.9k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (81:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  435|  67.9k|  a->sign = sign;
  436|       |
  437|   589k|  for (i=0, p = buffer+nbytes-1; p >= buffer+BYTES_PER_MPI_LIMB; )
  ------------------
  |  |    4|   589k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|   589k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
  |  Branch (437:34): [True: 521k, False: 67.9k]
  ------------------
  438|   521k|    {
  439|       |#if BYTES_PER_MPI_LIMB == 4
  440|       |      alimb = buf_get_be32(p - 4 + 1);
  441|       |      p -= 4;
  442|       |#elif BYTES_PER_MPI_LIMB == 8
  443|   521k|      alimb = buf_get_be64(p - 8 + 1);
  444|   521k|      p -= 8;
  445|       |#else
  446|       |#     error please implement for this limb size.
  447|       |#endif
  448|   521k|      a->d[i++] = alimb;
  449|   521k|    }
  450|  67.9k|  if ( p >= buffer )
  ------------------
  |  Branch (450:8): [True: 67.9k, False: 0]
  ------------------
  451|  67.9k|    {
  452|  67.9k|      byte last[BYTES_PER_MPI_LIMB] = { 0 };
  453|  67.9k|      unsigned int n = (p - buffer) + 1;
  454|       |
  455|  67.9k|      n = n > BYTES_PER_MPI_LIMB ? BYTES_PER_MPI_LIMB : n;
  ------------------
  |  |    4|  67.9k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  67.9k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
                    n = n > BYTES_PER_MPI_LIMB ? BYTES_PER_MPI_LIMB : n;
  ------------------
  |  |    4|      0|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|      0|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
  |  Branch (455:11): [True: 0, False: 67.9k]
  ------------------
  456|  67.9k|      memcpy (last + BYTES_PER_MPI_LIMB - n, p - n + 1, n);
  ------------------
  |  |    4|  67.9k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  67.9k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
  457|  67.9k|      p -= n;
  458|       |
  459|       |#if BYTES_PER_MPI_LIMB == 4
  460|       |      alimb = buf_get_be32(last);
  461|       |#elif BYTES_PER_MPI_LIMB == 8
  462|  67.9k|      alimb = buf_get_be64(last);
  463|       |#else
  464|       |#     error please implement for this limb size.
  465|       |#endif
  466|       |
  467|  67.9k|      a->d[i++] = alimb;
  468|  67.9k|    }
  469|  67.9k|  a->nlimbs = i;
  470|  67.9k|  gcry_assert (i == nlimbs);
  ------------------
  |  |  188|  67.9k|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|  67.9k|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 67.9k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|  67.9k|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
  471|  67.9k|}
_gcry_mpi_scan:
  541|   165k|{
  542|   165k|  const unsigned char *buffer = (const unsigned char*)buffer_arg;
  543|   165k|  struct gcry_mpi *a = NULL;
  544|   165k|  unsigned int len;
  545|   165k|  int secure = (buffer && _gcry_is_secure (buffer));
  ------------------
  |  Branch (545:17): [True: 165k, False: 0]
  |  Branch (545:27): [True: 0, False: 165k]
  ------------------
  546|       |
  547|   165k|  if (buflen > MAX_EXTERN_SCAN_BYTES)
  ------------------
  |  |   37|   165k|#define MAX_EXTERN_SCAN_BYTES (16*1024*1024)
  ------------------
  |  Branch (547:7): [True: 0, False: 165k]
  ------------------
  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|   165k|  if (format == GCRYMPI_FMT_SSH)
  ------------------
  |  Branch (554:7): [True: 0, False: 165k]
  ------------------
  555|      0|    len = 0;
  556|   165k|  else
  557|   165k|    len = buflen;
  558|       |
  559|   165k|  if (format == GCRYMPI_FMT_STD)
  ------------------
  |  Branch (559:7): [True: 7.21k, False: 158k]
  ------------------
  560|  7.21k|    {
  561|  7.21k|      const unsigned char *s = buffer;
  562|       |
  563|  7.21k|      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: 7.21k]
  ------------------
  564|  7.21k|                                    /BYTES_PER_MPI_LIMB)
  565|  7.21k|                : mpi_alloc ((len+BYTES_PER_MPI_LIMB-1)/BYTES_PER_MPI_LIMB);
  ------------------
  |  |   97|  14.4k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  566|  7.21k|      if (len)
  ------------------
  |  Branch (566:11): [True: 7.21k, False: 0]
  ------------------
  567|  7.21k|        {
  568|  7.21k|          _gcry_mpi_set_buffer (a, s, len, 0);
  569|  7.21k|          a->sign = !!(*s & 0x80);
  570|  7.21k|          if (a->sign)
  ------------------
  |  Branch (570:15): [True: 0, False: 7.21k]
  ------------------
  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|  7.21k|	}
  577|  7.21k|      if (ret_mpi)
  ------------------
  |  Branch (577:11): [True: 7.21k, False: 0]
  ------------------
  578|  7.21k|        {
  579|  7.21k|          mpi_normalize ( a );
  ------------------
  |  |  223|  7.21k|#define mpi_normalize(a)       _gcry_mpi_normalize ((a))
  ------------------
  580|  7.21k|          *ret_mpi = a;
  581|  7.21k|	}
  582|      0|      else
  583|      0|        mpi_free(a);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  584|  7.21k|      if (nscanned)
  ------------------
  |  Branch (584:11): [True: 0, False: 7.21k]
  ------------------
  585|      0|        *nscanned = len;
  586|  7.21k|      return 0;
  587|  7.21k|    }
  588|   158k|  else if (format == GCRYMPI_FMT_USG)
  ------------------
  |  Branch (588:12): [True: 49.9k, False: 108k]
  ------------------
  589|  49.9k|    {
  590|  49.9k|      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: 49.9k]
  ------------------
  591|  49.9k|                                    /BYTES_PER_MPI_LIMB)
  592|  49.9k|                : mpi_alloc ((len+BYTES_PER_MPI_LIMB-1)/BYTES_PER_MPI_LIMB);
  ------------------
  |  |   97|  99.9k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  593|       |
  594|  49.9k|      if (len)
  ------------------
  |  Branch (594:11): [True: 46.9k, False: 3.03k]
  ------------------
  595|  46.9k|        _gcry_mpi_set_buffer (a, buffer, len, 0);
  596|  49.9k|      if (ret_mpi)
  ------------------
  |  Branch (596:11): [True: 49.9k, False: 0]
  ------------------
  597|  49.9k|        {
  598|  49.9k|          mpi_normalize ( a );
  ------------------
  |  |  223|  49.9k|#define mpi_normalize(a)       _gcry_mpi_normalize ((a))
  ------------------
  599|  49.9k|          *ret_mpi = a;
  600|  49.9k|	}
  601|      0|      else
  602|      0|        mpi_free(a);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  603|  49.9k|      if (nscanned)
  ------------------
  |  Branch (603:11): [True: 2.22k, False: 47.7k]
  ------------------
  604|  2.22k|        *nscanned = len;
  605|  49.9k|      return 0;
  606|  49.9k|    }
  607|   108k|  else if (format == GCRYMPI_FMT_PGP)
  ------------------
  |  Branch (607:12): [True: 64.4k, False: 43.7k]
  ------------------
  608|  64.4k|    {
  609|  64.4k|      a = mpi_read_from_buffer (buffer, &len, secure);
  610|  64.4k|      if (nscanned)
  ------------------
  |  Branch (610:11): [True: 64.4k, False: 0]
  ------------------
  611|  64.4k|        *nscanned = len;
  612|  64.4k|      if (ret_mpi && a)
  ------------------
  |  Branch (612:11): [True: 64.4k, False: 0]
  |  Branch (612:22): [True: 64.4k, False: 0]
  ------------------
  613|  64.4k|        {
  614|  64.4k|          mpi_normalize (a);
  ------------------
  |  |  223|  64.4k|#define mpi_normalize(a)       _gcry_mpi_normalize ((a))
  ------------------
  615|  64.4k|          *ret_mpi = a;
  616|  64.4k|	}
  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|  64.4k|      return a? 0 : GPG_ERR_INV_OBJ;
  ------------------
  |  Branch (622:14): [True: 64.4k, False: 0]
  ------------------
  623|  64.4k|    }
  624|  43.7k|  else if (format == GCRYMPI_FMT_SSH)
  ------------------
  |  Branch (624:12): [True: 0, False: 43.7k]
  ------------------
  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|  43.7k|  else if (format == GCRYMPI_FMT_HEX)
  ------------------
  |  Branch (668:12): [True: 43.7k, False: 0]
  ------------------
  669|  43.7k|    {
  670|  43.7k|      size_t slen;
  671|       |      /* We can only handle C strings for now.  */
  672|  43.7k|      if (buflen)
  ------------------
  |  Branch (672:11): [True: 0, False: 43.7k]
  ------------------
  673|      0|        return GPG_ERR_INV_ARG;
  674|       |
  675|  43.7k|      slen = strlen ((const char *)buffer);
  676|  43.7k|      if (slen > MAX_EXTERN_SCAN_BYTES)
  ------------------
  |  |   37|  43.7k|#define MAX_EXTERN_SCAN_BYTES (16*1024*1024)
  ------------------
  |  Branch (676:11): [True: 0, False: 43.7k]
  ------------------
  677|      0|	return GPG_ERR_INV_OBJ;
  678|  43.7k|      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: 43.7k]
  ------------------
  679|  43.7k|				    /BYTES_PER_MPI_LIMB)
  680|  43.7k|		: mpi_alloc((((slen+1)/2)+BYTES_PER_MPI_LIMB-1)
  ------------------
  |  |   97|  87.5k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  681|  43.7k|			    /BYTES_PER_MPI_LIMB);
  682|  43.7k|      if (mpi_fromstr (a, (const char *)buffer, slen))
  ------------------
  |  Branch (682:11): [True: 0, False: 43.7k]
  ------------------
  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|  43.7k|      if (ret_mpi)
  ------------------
  |  Branch (687:11): [True: 43.7k, False: 0]
  ------------------
  688|  43.7k|        {
  689|  43.7k|          mpi_normalize ( a );
  ------------------
  |  |  223|  43.7k|#define mpi_normalize(a)       _gcry_mpi_normalize ((a))
  ------------------
  690|  43.7k|          *ret_mpi = a;
  691|  43.7k|	}
  692|      0|      else
  693|      0|        mpi_free(a);
  ------------------
  |  |   99|      0|# define mpi_free(a)	       _gcry_mpi_free((a) )
  ------------------
  694|  43.7k|      if (nscanned)
  ------------------
  |  Branch (694:11): [True: 0, False: 43.7k]
  ------------------
  695|      0|        *nscanned = strlen ((const char*)buffer);
  696|  43.7k|      return 0;
  697|  43.7k|    }
  698|      0|  else
  699|      0|    return GPG_ERR_INV_ARG;
  700|   165k|}
_gcry_mpi_print:
  713|   162k|{
  714|   162k|  unsigned int nbits = mpi_get_nbits (a);
  ------------------
  |  |  552|   162k|#define mpi_get_nbits(a)       _gcry_mpi_get_nbits ((a))
  ------------------
  715|   162k|  size_t len;
  716|   162k|  size_t dummy_nwritten;
  717|   162k|  int negative;
  718|       |
  719|   162k|  if (!nwritten)
  ------------------
  |  Branch (719:7): [True: 0, False: 162k]
  ------------------
  720|      0|    nwritten = &dummy_nwritten;
  721|       |
  722|       |  /* Libgcrypt does no always care to set clear the sign if the value
  723|       |     is 0.  For printing this is a bit of a surprise, in particular
  724|       |     because if some of the formats don't support negative numbers but
  725|       |     should be able to print a zero.  Thus we need this extra test
  726|       |     for a negative number.  */
  727|   162k|  if (a->sign && _gcry_mpi_cmp_ui (a, 0))
  ------------------
  |  Branch (727:7): [True: 0, False: 162k]
  |  Branch (727:18): [True: 0, False: 0]
  ------------------
  728|      0|    negative = 1;
  729|   162k|  else
  730|   162k|    negative = 0;
  731|       |
  732|   162k|  len = buflen;
  733|   162k|  *nwritten = 0;
  734|   162k|  if (format == GCRYMPI_FMT_STD)
  ------------------
  |  Branch (734:7): [True: 88.7k, False: 73.7k]
  ------------------
  735|  88.7k|    {
  736|  88.7k|      unsigned char *tmp;
  737|  88.7k|      int extra = 0;
  738|  88.7k|      unsigned int n;
  739|       |
  740|  88.7k|      tmp = _gcry_mpi_get_buffer (a, 0, &n, NULL);
  741|  88.7k|      if (!tmp)
  ------------------
  |  Branch (741:11): [True: 0, False: 88.7k]
  ------------------
  742|      0|        return gpg_err_code_from_syserror ();
  743|       |
  744|  88.7k|      if (negative)
  ------------------
  |  Branch (744:11): [True: 0, False: 88.7k]
  ------------------
  745|      0|        {
  746|      0|          twocompl (tmp, n);
  747|      0|          if (!(*tmp & 0x80))
  ------------------
  |  Branch (747:15): [True: 0, False: 0]
  ------------------
  748|      0|            {
  749|       |              /* Need to extend the sign.  */
  750|      0|              n++;
  751|      0|              extra = 2;
  752|      0|            }
  753|      0|        }
  754|  88.7k|      else if (n && (*tmp & 0x80))
  ------------------
  |  Branch (754:16): [True: 74.0k, False: 14.7k]
  |  Branch (754:21): [True: 38.3k, False: 35.7k]
  ------------------
  755|  38.3k|        {
  756|       |          /* Positive but the high bit of the returned buffer is set.
  757|       |             Thus we need to print an extra leading 0x00 so that the
  758|       |             output is interpreted as a positive number.  */
  759|  38.3k|          n++;
  760|  38.3k|          extra = 1;
  761|  38.3k|	}
  762|       |
  763|  88.7k|      if (buffer && n > len)
  ------------------
  |  Branch (763:11): [True: 44.3k, False: 44.3k]
  |  Branch (763:21): [True: 0, False: 44.3k]
  ------------------
  764|      0|        {
  765|       |          /* The provided buffer is too short. */
  766|      0|          xfree (tmp);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  767|      0|          return GPG_ERR_TOO_SHORT;
  768|      0|	}
  769|  88.7k|      if (buffer)
  ------------------
  |  Branch (769:11): [True: 44.3k, False: 44.3k]
  ------------------
  770|  44.3k|        {
  771|  44.3k|          unsigned char *s = buffer;
  772|       |
  773|  44.3k|          if (extra == 1)
  ------------------
  |  Branch (773:15): [True: 19.1k, False: 25.2k]
  ------------------
  774|  19.1k|            *s++ = 0;
  775|  25.2k|          else if (extra)
  ------------------
  |  Branch (775:20): [True: 0, False: 25.2k]
  ------------------
  776|      0|            *s++ = 0xff;
  777|  44.3k|          memcpy (s, tmp, n-!!extra);
  778|  44.3k|	}
  779|  88.7k|      xfree (tmp);
  ------------------
  |  |  150|  88.7k|#define xfree(a)         _gcry_free ((a))
  ------------------
  780|  88.7k|      *nwritten = n;
  781|  88.7k|      return 0;
  782|  88.7k|    }
  783|  73.7k|  else if (format == GCRYMPI_FMT_USG)
  ------------------
  |  Branch (783:12): [True: 5.38k, False: 68.3k]
  ------------------
  784|  5.38k|    {
  785|  5.38k|      unsigned int n = (nbits + 7)/8;
  786|       |
  787|       |      /* Note:  We ignore the sign for this format.  */
  788|       |      /* FIXME: for performance reasons we should put this into
  789|       |	 mpi_aprint because we can then use the buffer directly.  */
  790|       |
  791|  5.38k|      if (buffer && n > len)
  ------------------
  |  Branch (791:11): [True: 4.81k, False: 564]
  |  Branch (791:21): [True: 0, False: 4.81k]
  ------------------
  792|      0|        return GPG_ERR_TOO_SHORT;
  793|  5.38k|      if (buffer)
  ------------------
  |  Branch (793:11): [True: 4.81k, False: 564]
  ------------------
  794|  4.81k|        {
  795|  4.81k|          unsigned char *tmp;
  796|       |
  797|  4.81k|          tmp = _gcry_mpi_get_buffer (a, 0, &n, NULL);
  798|  4.81k|          if (!tmp)
  ------------------
  |  Branch (798:15): [True: 0, False: 4.81k]
  ------------------
  799|      0|            return gpg_err_code_from_syserror ();
  800|  4.81k|          memcpy (buffer, tmp, n);
  801|  4.81k|          xfree (tmp);
  ------------------
  |  |  150|  4.81k|#define xfree(a)         _gcry_free ((a))
  ------------------
  802|  4.81k|	}
  803|  5.38k|      *nwritten = n;
  804|  5.38k|      return 0;
  805|  5.38k|    }
  806|  68.3k|  else if (format == GCRYMPI_FMT_PGP)
  ------------------
  |  Branch (806:12): [True: 68.3k, False: 0]
  ------------------
  807|  68.3k|    {
  808|  68.3k|      unsigned int n = (nbits + 7)/8;
  809|       |
  810|       |      /* The PGP format can only handle unsigned integers.  */
  811|  68.3k|      if (negative)
  ------------------
  |  Branch (811:11): [True: 0, False: 68.3k]
  ------------------
  812|      0|        return GPG_ERR_INV_ARG;
  813|       |
  814|  68.3k|      if (buffer && n+2 > len)
  ------------------
  |  Branch (814:11): [True: 34.1k, False: 34.1k]
  |  Branch (814:21): [True: 0, False: 34.1k]
  ------------------
  815|      0|        return GPG_ERR_TOO_SHORT;
  816|       |
  817|  68.3k|      if (buffer)
  ------------------
  |  Branch (817:11): [True: 34.1k, False: 34.1k]
  ------------------
  818|  34.1k|        {
  819|  34.1k|          unsigned char *tmp;
  820|  34.1k|          unsigned char *s = buffer;
  821|       |
  822|  34.1k|          s[0] = nbits >> 8;
  823|  34.1k|          s[1] = nbits;
  824|       |
  825|  34.1k|          tmp = _gcry_mpi_get_buffer (a, 0, &n, NULL);
  826|  34.1k|          if (!tmp)
  ------------------
  |  Branch (826:15): [True: 0, False: 34.1k]
  ------------------
  827|      0|            return gpg_err_code_from_syserror ();
  828|  34.1k|          memcpy (s+2, tmp, n);
  829|  34.1k|          xfree (tmp);
  ------------------
  |  |  150|  34.1k|#define xfree(a)         _gcry_free ((a))
  ------------------
  830|  34.1k|	}
  831|  68.3k|      *nwritten = n+2;
  832|  68.3k|      return 0;
  833|  68.3k|    }
  834|      0|  else if (format == GCRYMPI_FMT_SSH)
  ------------------
  |  Branch (834:12): [True: 0, False: 0]
  ------------------
  835|      0|    {
  836|      0|      unsigned char *tmp;
  837|      0|      int extra = 0;
  838|      0|      unsigned int n;
  839|       |
  840|      0|      tmp = _gcry_mpi_get_buffer (a, 0, &n, NULL);
  841|      0|      if (!tmp)
  ------------------
  |  Branch (841:11): [True: 0, False: 0]
  ------------------
  842|      0|        return gpg_err_code_from_syserror ();
  843|       |
  844|      0|      if (negative)
  ------------------
  |  Branch (844:11): [True: 0, False: 0]
  ------------------
  845|      0|        {
  846|      0|          twocompl (tmp, n);
  847|      0|          if (!(*tmp & 0x80))
  ------------------
  |  Branch (847:15): [True: 0, False: 0]
  ------------------
  848|      0|            {
  849|       |              /* Need to extend the sign.  */
  850|      0|              n++;
  851|      0|              extra = 2;
  852|      0|            }
  853|      0|        }
  854|      0|      else if (n && (*tmp & 0x80))
  ------------------
  |  Branch (854:16): [True: 0, False: 0]
  |  Branch (854:21): [True: 0, False: 0]
  ------------------
  855|      0|        {
  856|      0|          n++;
  857|      0|          extra=1;
  858|      0|	}
  859|       |
  860|      0|      if (buffer && n+4 > len)
  ------------------
  |  Branch (860:11): [True: 0, False: 0]
  |  Branch (860:21): [True: 0, False: 0]
  ------------------
  861|      0|        {
  862|      0|          xfree(tmp);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  863|      0|          return GPG_ERR_TOO_SHORT;
  864|      0|	}
  865|       |
  866|      0|      if (buffer)
  ------------------
  |  Branch (866:11): [True: 0, False: 0]
  ------------------
  867|      0|        {
  868|      0|          unsigned char *s = buffer;
  869|       |
  870|      0|	  buf_put_be32 (s, n);
  871|      0|	  s += 4;
  872|      0|          if (extra == 1)
  ------------------
  |  Branch (872:15): [True: 0, False: 0]
  ------------------
  873|      0|            *s++ = 0;
  874|      0|          else if (extra)
  ------------------
  |  Branch (874:20): [True: 0, False: 0]
  ------------------
  875|      0|            *s++ = 0xff;
  876|      0|          memcpy (s, tmp, n-!!extra);
  877|      0|	}
  878|      0|      xfree (tmp);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  879|      0|      *nwritten = 4+n;
  880|      0|      return 0;
  881|      0|    }
  882|      0|  else if (format == GCRYMPI_FMT_HEX)
  ------------------
  |  Branch (882:12): [True: 0, False: 0]
  ------------------
  883|      0|    {
  884|      0|      unsigned char *tmp;
  885|      0|      int i;
  886|      0|      int extra = 0;
  887|      0|      unsigned int n = 0;
  888|       |
  889|      0|      tmp = _gcry_mpi_get_buffer (a, 0, &n, NULL);
  890|      0|      if (!tmp)
  ------------------
  |  Branch (890:11): [True: 0, False: 0]
  ------------------
  891|      0|        return gpg_err_code_from_syserror ();
  892|      0|      if (!n || (*tmp & 0x80))
  ------------------
  |  Branch (892:11): [True: 0, False: 0]
  |  Branch (892:17): [True: 0, False: 0]
  ------------------
  893|      0|        extra = 2;
  894|       |
  895|      0|      if (buffer && 2*n + extra + negative + 1 > len)
  ------------------
  |  Branch (895:11): [True: 0, False: 0]
  |  Branch (895:21): [True: 0, False: 0]
  ------------------
  896|      0|        {
  897|      0|          xfree(tmp);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  898|      0|          return GPG_ERR_TOO_SHORT;
  899|      0|	}
  900|      0|      if (buffer)
  ------------------
  |  Branch (900:11): [True: 0, False: 0]
  ------------------
  901|      0|        {
  902|      0|	  static const u32 nibble2hex[] =
  903|      0|	  {
  904|      0|	    '0', '1', '2', '3', '4', '5', '6', '7',
  905|      0|	    '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
  906|      0|	  };
  907|      0|          unsigned char *s = buffer;
  908|       |
  909|      0|          if (negative)
  ------------------
  |  Branch (909:15): [True: 0, False: 0]
  ------------------
  910|      0|            *s++ = '-';
  911|      0|          if (extra)
  ------------------
  |  Branch (911:15): [True: 0, False: 0]
  ------------------
  912|      0|            {
  913|      0|              *s++ = '0';
  914|      0|              *s++ = '0';
  915|      0|	    }
  916|       |
  917|      0|	  for (i = 0; i + 4 < n; i += 4)
  ------------------
  |  Branch (917:16): [True: 0, False: 0]
  ------------------
  918|      0|	    {
  919|      0|	      u32 c = buf_get_be32(tmp + i);
  920|      0|	      u32 o1, o2;
  921|       |
  922|      0|	      o1 = nibble2hex[(c >> 28) & 0xF];
  923|      0|	      o1 <<= 8;
  924|      0|	      o1 |= nibble2hex[(c >> 24) & 0xF];
  925|      0|	      o1 <<= 8;
  926|      0|	      o1 |= nibble2hex[(c >> 20) & 0xF];
  927|      0|	      o1 <<= 8;
  928|      0|	      o1 |= nibble2hex[(c >> 16) & 0xF];
  929|       |
  930|      0|	      o2 = nibble2hex[(c >> 12) & 0xF];
  931|      0|	      o2 <<= 8;
  932|      0|	      o2 |= (u64)nibble2hex[(c >> 8) & 0xF];
  933|      0|	      o2 <<= 8;
  934|      0|	      o2 |= (u64)nibble2hex[(c >> 4) & 0xF];
  935|      0|	      o2 <<= 8;
  936|      0|	      o2 |= (u64)nibble2hex[(c >> 0) & 0xF];
  937|       |
  938|      0|	      buf_put_be32 (s + 0, o1);
  939|      0|	      buf_put_be32 (s + 4, o2);
  940|      0|	      s += 8;
  941|      0|	    }
  942|      0|          for (; i < n; i++)
  ------------------
  |  Branch (942:18): [True: 0, False: 0]
  ------------------
  943|      0|            {
  944|      0|              unsigned int c = tmp[i];
  945|       |
  946|      0|              *s++ = nibble2hex[c >> 4];
  947|      0|              *s++ = nibble2hex[c & 0xF];
  948|      0|	    }
  949|      0|          *s++ = 0;
  950|      0|          *nwritten = s - buffer;
  951|      0|	}
  952|      0|      else
  953|      0|        {
  954|      0|          *nwritten = 2*n + extra + negative + 1;
  955|      0|	}
  956|      0|      xfree (tmp);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  957|      0|      return 0;
  958|      0|    }
  959|      0|  else
  960|      0|    return GPG_ERR_INV_ARG;
  961|   162k|}
mpicoder.c:do_get_buffer:
  294|   136k|{
  295|   136k|  unsigned char *p, *buffer, *retbuffer;
  296|   136k|  unsigned int length, tmp;
  297|   136k|  mpi_limb_t alimb;
  298|   136k|  int i;
  299|   136k|  size_t n, n2;
  300|       |
  301|   136k|  if (sign)
  ------------------
  |  Branch (301:7): [True: 0, False: 136k]
  ------------------
  302|      0|    *sign = a->sign;
  303|       |
  304|   136k|  *nbytes = a->nlimbs * BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|   136k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|   136k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
  305|   136k|  n = *nbytes? *nbytes:1; /* Allocate at least one byte.  */
  ------------------
  |  Branch (305:7): [True: 115k, False: 21.6k]
  ------------------
  306|   136k|  if (n < fill_le)
  ------------------
  |  Branch (306:7): [True: 0, False: 136k]
  ------------------
  307|      0|    n = fill_le;
  308|   136k|  if (extraalloc < 0)
  ------------------
  |  Branch (308:7): [True: 0, False: 136k]
  ------------------
  309|      0|    n2 = n + -extraalloc;
  310|   136k|  else
  311|   136k|    n2 = n + extraalloc;
  312|       |
  313|   136k|  retbuffer = (force_secure || mpi_is_secure(a))? xtrymalloc_secure (n2)
  ------------------
  |  |  115|   136k|#define mpi_is_secure(a)      ((a) && ((a)->flags&1))
  |  |  ------------------
  |  |  |  Branch (115:32): [True: 136k, False: 0]
  |  |  |  Branch (115:39): [True: 0, False: 136k]
  |  |  ------------------
  ------------------
                retbuffer = (force_secure || mpi_is_secure(a))? xtrymalloc_secure (n2)
  ------------------
  |  |  140|      0|#define xtrymalloc_secure(a)   _gcry_malloc_secure ((a))
  ------------------
  |  Branch (313:16): [True: 0, False: 136k]
  ------------------
  314|   136k|                                                : xtrymalloc (n2);
  ------------------
  |  |  138|   273k|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  315|   136k|  if (!retbuffer)
  ------------------
  |  Branch (315:7): [True: 0, False: 136k]
  ------------------
  316|      0|    return NULL;
  317|   136k|  if (extraalloc < 0)
  ------------------
  |  Branch (317:7): [True: 0, False: 136k]
  ------------------
  318|      0|    buffer = retbuffer + -extraalloc;
  319|   136k|  else
  320|   136k|    buffer = retbuffer;
  321|   136k|  p = buffer;
  322|       |
  323|  1.17M|  for (i=a->nlimbs-1; i >= 0; i--)
  ------------------
  |  Branch (323:23): [True: 1.03M, False: 136k]
  ------------------
  324|  1.03M|    {
  325|  1.03M|      alimb = a->d[i];
  326|       |#if BYTES_PER_MPI_LIMB == 4
  327|       |      buf_put_be32 (p, alimb);
  328|       |      p += 4;
  329|       |#elif BYTES_PER_MPI_LIMB == 8
  330|  1.03M|      buf_put_be64 (p, alimb);
  331|  1.03M|      p += 8;
  332|       |#else
  333|       |#     error please implement for this limb size.
  334|       |#endif
  335|  1.03M|    }
  336|       |
  337|   136k|  if (fill_le)
  ------------------
  |  Branch (337:7): [True: 9.18k, False: 127k]
  ------------------
  338|  9.18k|    {
  339|  9.18k|      length = *nbytes;
  340|       |      /* Reverse buffer and pad with zeroes.  */
  341|  18.3k|      for (i = 0; i + 8 < length / 2; i += 8)
  ------------------
  |  Branch (341:19): [True: 9.18k, False: 9.18k]
  ------------------
  342|  9.18k|	{
  343|  9.18k|	  u64 head = buf_get_be64 (buffer + i);
  344|  9.18k|	  u64 tail = buf_get_be64 (buffer + length - 8 - i);
  345|  9.18k|	  buf_put_le64 (buffer + length - 8 - i, head);
  346|  9.18k|	  buf_put_le64 (buffer + i, tail);
  347|  9.18k|	}
  348|  9.18k|      if (i + 4 < length / 2)
  ------------------
  |  Branch (348:11): [True: 9.18k, False: 0]
  ------------------
  349|  9.18k|	{
  350|  9.18k|	  u32 head = buf_get_be32 (buffer + i);
  351|  9.18k|	  u32 tail = buf_get_be32 (buffer + length - 4 - i);
  352|  9.18k|	  buf_put_le32 (buffer + length - 4 - i, head);
  353|  9.18k|	  buf_put_le32 (buffer + i, tail);
  354|  9.18k|	  i += 4;
  355|  9.18k|	}
  356|  45.9k|      for (; i < length/2; i++)
  ------------------
  |  Branch (356:14): [True: 36.7k, False: 9.18k]
  ------------------
  357|  36.7k|        {
  358|  36.7k|          tmp = buffer[i];
  359|  36.7k|          buffer[i] = buffer[length-1-i];
  360|  36.7k|          buffer[length-1-i] = tmp;
  361|  36.7k|        }
  362|       |      /* Pad with zeroes.  */
  363|  9.18k|      for (p = buffer + length; length < fill_le; length++)
  ------------------
  |  Branch (363:33): [True: 0, False: 9.18k]
  ------------------
  364|      0|        *p++ = 0;
  365|  9.18k|      *nbytes = length;
  366|       |
  367|  9.18k|      return retbuffer;
  368|  9.18k|    }
  369|       |
  370|       |  /* This is sub-optimal but we need to do the shift operation because
  371|       |     the caller has to free the returned buffer.  */
  372|   409k|  for (p=buffer; *nbytes && !*p; p++, --*nbytes)
  ------------------
  |  Branch (372:18): [True: 388k, False: 21.6k]
  |  Branch (372:29): [True: 281k, False: 106k]
  ------------------
  373|   281k|    ;
  374|   127k|  if (p != buffer)
  ------------------
  |  Branch (374:7): [True: 71.9k, False: 55.8k]
  ------------------
  375|  71.9k|    memmove (buffer, p, *nbytes);
  376|   127k|  return retbuffer;
  377|   136k|}
mpicoder.c:mpi_read_from_buffer:
   50|  64.4k|{
   51|  64.4k|  int i, j;
   52|  64.4k|  unsigned int nbits, nbytes, nlimbs, nread=0;
   53|  64.4k|  mpi_limb_t a;
   54|  64.4k|  gcry_mpi_t val = MPI_NULL;
  ------------------
  |  |   78|  64.4k|#define MPI_NULL NULL
  ------------------
   55|  64.4k|  unsigned int max_nread = *ret_nread;
   56|       |
   57|  64.4k|  if ( max_nread < 2 )
  ------------------
  |  Branch (57:8): [True: 0, False: 64.4k]
  ------------------
   58|      0|    goto leave;
   59|  64.4k|  nbits = buffer[0] << 8 | buffer[1];
   60|  64.4k|  if ( nbits > MAX_EXTERN_MPI_BITS )
  ------------------
  |  |   43|  64.4k|#define MAX_EXTERN_MPI_BITS 16384
  ------------------
  |  Branch (60:8): [True: 0, False: 64.4k]
  ------------------
   61|      0|    {
   62|       |/*       log_debug ("mpi too large (%u bits)\n", nbits); */
   63|      0|      goto leave;
   64|      0|    }
   65|  64.4k|  buffer += 2;
   66|  64.4k|  nread = 2;
   67|       |
   68|  64.4k|  nbytes = (nbits+7) / 8;
   69|  64.4k|  nlimbs = (nbytes+BYTES_PER_MPI_LIMB-1) / BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|  64.4k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  64.4k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
                nlimbs = (nbytes+BYTES_PER_MPI_LIMB-1) / BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|  64.4k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  64.4k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
   70|  64.4k|  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|   128k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  |  Branch (70:9): [True: 0, False: 64.4k]
  ------------------
   71|  64.4k|  i = BYTES_PER_MPI_LIMB - nbytes % BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|  64.4k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  64.4k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
                i = BYTES_PER_MPI_LIMB - nbytes % BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|  64.4k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  64.4k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
   72|  64.4k|  i %= BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|  64.4k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  64.4k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
   73|  64.4k|  j= val->nlimbs = nlimbs;
   74|  64.4k|  val->sign = 0;
   75|   258k|  for ( ; j > 0; j-- )
  ------------------
  |  Branch (75:11): [True: 194k, False: 64.4k]
  ------------------
   76|   194k|    {
   77|   194k|      a = 0;
   78|   194k|      if (i == 0 && nread + BYTES_PER_MPI_LIMB <= max_nread)
  ------------------
  |  |    4|   169k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|   169k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
  |  Branch (78:11): [True: 169k, False: 24.8k]
  |  Branch (78:21): [True: 169k, False: 0]
  ------------------
   79|   169k|	{
   80|       |#if BYTES_PER_MPI_LIMB == 4
   81|       |	  a = buf_get_be32 (buffer);
   82|       |#elif BYTES_PER_MPI_LIMB == 8
   83|   169k|	  a = buf_get_be64 (buffer);
   84|       |#else
   85|       |#     error please implement for this limb size.
   86|       |#endif
   87|   169k|	  buffer += BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|   169k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|   169k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
   88|   169k|	  nread += BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|   169k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|   169k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
   89|   169k|	  i += BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|   169k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|   169k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
   90|   169k|	}
   91|   252k|      for (; i < BYTES_PER_MPI_LIMB; i++ )
  ------------------
  |  |    4|   252k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|   252k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
  |  Branch (91:14): [True: 58.3k, False: 194k]
  ------------------
   92|  58.3k|        {
   93|  58.3k|          if ( ++nread > max_nread )
  ------------------
  |  Branch (93:16): [True: 0, False: 58.3k]
  ------------------
   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|  58.3k|          a <<= 8;
  101|  58.3k|          a |= *buffer++;
  102|  58.3k|	}
  103|   194k|      i = 0;
  104|   194k|      val->d[j-1] = a;
  105|   194k|    }
  106|       |
  107|  64.4k| leave:
  108|  64.4k|  *ret_nread = nread;
  109|  64.4k|  return val;
  110|  64.4k|}
mpicoder.c:mpi_fromstr:
  118|  43.7k|{
  119|  43.7k|  static const int hex2int[2][256] =
  120|  43.7k|  {
  121|  43.7k|    {
  122|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  123|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  124|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0x00, 0x10, 0x20, 0x30,
  125|  43.7k|      0x40, 0x50, 0x60, 0x70, 0x80, 0x90, -1, -1, -1, -1, -1, -1, -1, 0xa0,
  126|  43.7k|      0xb0, 0xc0, 0xd0, 0xe0, 0xf0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  127|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0xa0,
  128|  43.7k|      0xb0, 0xc0, 0xd0, 0xe0, 0xf0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  129|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  130|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  131|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  132|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  133|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  134|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  135|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  136|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
  137|  43.7k|    },
  138|  43.7k|    {
  139|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  140|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  141|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0x00, 0x01, 0x02, 0x03,
  142|  43.7k|      0x04, 0x05, 0x06, 0x07, 0x08, 0x09, -1, -1, -1, -1, -1, -1, -1, 0x0a,
  143|  43.7k|      0x0b, 0x0c, 0x0d, 0x0e, 0x0f, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  144|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0x0a,
  145|  43.7k|      0x0b, 0x0c, 0x0d, 0x0e, 0x0f, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  146|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  147|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  148|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  149|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  150|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  151|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  152|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
  153|  43.7k|      -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
  154|  43.7k|    }
  155|  43.7k|  };
  156|  43.7k|  int sign = 0;
  157|  43.7k|  int prepend_zero = 0;
  158|  43.7k|  int i, j, c, c1, c2;
  159|  43.7k|  unsigned int nbits, nbytes, nlimbs;
  160|  43.7k|  mpi_limb_t a;
  161|       |
  162|  43.7k|  if ( *str == '-' )
  ------------------
  |  Branch (162:8): [True: 9.18k, False: 34.6k]
  ------------------
  163|  9.18k|    {
  164|  9.18k|      sign = 1;
  165|  9.18k|      str++;
  166|  9.18k|      slen--;
  167|  9.18k|    }
  168|       |
  169|       |  /* Skip optional hex prefix.  */
  170|  43.7k|  if ( *str == '0' && str[1] == 'x' )
  ------------------
  |  Branch (170:8): [True: 43.7k, False: 1]
  |  Branch (170:23): [True: 43.7k, False: 1]
  ------------------
  171|  43.7k|    {
  172|  43.7k|      str += 2;
  173|  43.7k|      slen -= 2;
  174|  43.7k|    }
  175|       |
  176|  43.7k|  nbits = slen * 4;
  177|  43.7k|  if ((nbits % 8))
  ------------------
  |  Branch (177:7): [True: 502, False: 43.2k]
  ------------------
  178|    502|    prepend_zero = 1;
  179|       |
  180|  43.7k|  nbytes = (nbits+7) / 8;
  181|  43.7k|  nlimbs = (nbytes+BYTES_PER_MPI_LIMB-1) / BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|  43.7k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  43.7k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
                nlimbs = (nbytes+BYTES_PER_MPI_LIMB-1) / BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|  43.7k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  43.7k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
  182|       |
  183|  43.7k|  if ( val->alloced < nlimbs )
  ------------------
  |  Branch (183:8): [True: 0, False: 43.7k]
  ------------------
  184|      0|    mpi_resize (val, nlimbs);
  ------------------
  |  |  100|      0|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  ------------------
  185|       |
  186|  43.7k|  i = BYTES_PER_MPI_LIMB - (nbytes % BYTES_PER_MPI_LIMB);
  ------------------
  |  |    4|  43.7k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  43.7k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
                i = BYTES_PER_MPI_LIMB - (nbytes % BYTES_PER_MPI_LIMB);
  ------------------
  |  |    4|  43.7k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  43.7k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
  187|  43.7k|  i %= BYTES_PER_MPI_LIMB;
  ------------------
  |  |    4|  43.7k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|  43.7k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
  188|  43.7k|  j = val->nlimbs = nlimbs;
  189|  43.7k|  val->sign = sign;
  190|   220k|  for (; j > 0; j--)
  ------------------
  |  Branch (190:10): [True: 176k, False: 43.7k]
  ------------------
  191|   176k|    {
  192|   176k|      a = 0;
  193|       |
  194|   176k|      if (prepend_zero == 0 && (i & 31) == 0)
  ------------------
  |  Branch (194:11): [True: 176k, False: 502]
  |  Branch (194:32): [True: 169k, False: 7.10k]
  ------------------
  195|   169k|	{
  196|   338k|	  while (slen >= sizeof(u32) * 2)
  ------------------
  |  Branch (196:11): [True: 338k, False: 0]
  ------------------
  197|   338k|	    {
  198|   338k|	      u32 n, m;
  199|   338k|	      u32 x, y;
  200|       |
  201|   338k|	      x = buf_get_le32(str);
  202|   338k|	      y = buf_get_le32(str + 4);
  203|   338k|	      str += 8;
  204|   338k|	      slen -= 8;
  205|       |
  206|   338k|	      a <<= 31; /* Two step to avoid compiler warning on 32-bit. */
  207|   338k|	      a <<= 1;
  208|       |
  209|   338k|	      n = (hex2int[0][(x >> 0) & 0xff]
  210|   338k|		   | hex2int[1][(x >> 8) & 0xff]) << 8;
  211|   338k|	      m = (hex2int[0][(y >> 0) & 0xff]
  212|   338k|		   | hex2int[1][(y >> 8) & 0xff]) << 8;
  213|   338k|	      n |= hex2int[0][(x >> 16) & 0xff];
  214|   338k|	      n |= hex2int[1][(x >> 24) & 0xff];
  215|   338k|	      m |= hex2int[0][(y >> 16) & 0xff];
  216|   338k|	      m |= hex2int[1][(y >> 24) & 0xff];
  217|       |
  218|   338k|	      a |= (n << 16) | m;
  219|   338k|	      i += 32;
  220|   338k|	      if ((int)(n | m) < 0)
  ------------------
  |  Branch (220:12): [True: 0, False: 338k]
  ------------------
  221|      0|		{
  222|       |		  /* Invalid character. */
  223|      0|		  mpi_clear (val);
  ------------------
  |  |  116|      0|#define mpi_clear(a)          _gcry_mpi_clear ((a))
  ------------------
  224|      0|		  return 1;  /* Error.  */
  225|      0|		}
  226|   338k|	      if (i == BITS_PER_MPI_LIMB)
  ------------------
  |  |   49|   338k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|   338k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|   338k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (226:12): [True: 169k, False: 169k]
  ------------------
  227|   169k|		break;
  228|   338k|	    }
  229|   169k|	}
  230|       |
  231|   187k|      for (; i < BYTES_PER_MPI_LIMB; i++)
  ------------------
  |  |    4|   187k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  ------------------
  |  |  |  |  524|   187k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  ------------------
  ------------------
  |  Branch (231:14): [True: 10.6k, False: 176k]
  ------------------
  232|  10.6k|        {
  233|  10.6k|          if (prepend_zero)
  ------------------
  |  Branch (233:15): [True: 502, False: 10.1k]
  ------------------
  234|    502|            {
  235|    502|              c1 = '0';
  236|    502|              prepend_zero = 0;
  237|    502|	    }
  238|  10.1k|          else
  239|  10.1k|	    {
  240|  10.1k|	      c1 = *str++;
  241|  10.1k|	      slen--;
  242|  10.1k|	    }
  243|       |
  244|  10.6k|          if (!c1)
  ------------------
  |  Branch (244:15): [True: 0, False: 10.6k]
  ------------------
  245|      0|            {
  246|      0|              mpi_clear (val);
  ------------------
  |  |  116|      0|#define mpi_clear(a)          _gcry_mpi_clear ((a))
  ------------------
  247|      0|              return 1;  /* Error.  */
  248|      0|	    }
  249|  10.6k|          c2 = *str++;
  250|  10.6k|	  slen--;
  251|  10.6k|          if (!c2)
  ------------------
  |  Branch (251:15): [True: 0, False: 10.6k]
  ------------------
  252|      0|            {
  253|      0|              mpi_clear (val);
  ------------------
  |  |  116|      0|#define mpi_clear(a)          _gcry_mpi_clear ((a))
  ------------------
  254|      0|              return 1;  /* Error.  */
  255|      0|	    }
  256|  10.6k|	  c = hex2int[0][c1 & 0xff];
  257|  10.6k|	  c |= hex2int[1][c2 & 0xff];
  258|  10.6k|          if (c < 0)
  ------------------
  |  Branch (258:15): [True: 0, False: 10.6k]
  ------------------
  259|      0|            {
  260|      0|              mpi_clear(val);
  ------------------
  |  |  116|      0|#define mpi_clear(a)          _gcry_mpi_clear ((a))
  ------------------
  261|      0|              return 1;  /* Error. */
  262|      0|	    }
  263|  10.6k|          a <<= 8;
  264|  10.6k|          a |= c;
  265|  10.6k|	}
  266|   176k|      i = 0;
  267|   176k|      val->d[j-1] = a;
  268|   176k|    }
  269|       |
  270|  43.7k|  return 0;  /* Okay.  */
  271|  43.7k|}

_gcry_mpih_set_cond:
   41|  90.2M|{
   42|  90.2M|  mpi_size_t i;
   43|  90.2M|  mpi_limb_t mask1 = vzero - op_enable;
   44|  90.2M|  mpi_limb_t mask2 = op_enable - vone;
   45|       |
   46|   473M|  for (i = 0; i < usize; i++)
  ------------------
  |  Branch (46:15): [True: 382M, False: 90.2M]
  ------------------
   47|   382M|    {
   48|   382M|      wp[i] = (wp[i] & mask2) | (up[i] & mask1);
   49|   382M|    }
   50|  90.2M|}
_gcry_mpih_add_n_cond:
   60|  23.1M|{
   61|  23.1M|  mpi_size_t i;
   62|  23.1M|  mpi_limb_t cy;
   63|  23.1M|  mpi_limb_t mask1 = vzero - op_enable;
   64|  23.1M|  mpi_limb_t mask2 = op_enable - vone;
   65|       |
   66|  23.1M|  cy = 0;
   67|   197M|  for (i = 0; i < usize; i++)
  ------------------
  |  Branch (67:15): [True: 173M, False: 23.1M]
  ------------------
   68|   173M|    {
   69|   173M|      mpi_limb_t u = up[i];
   70|   173M|      mpi_limb_t x = u + vp[i];
   71|   173M|      mpi_limb_t cy1 = x < u;
   72|   173M|      mpi_limb_t cy2;
   73|       |
   74|   173M|      x = x + cy;
   75|   173M|      cy2 = x < cy;
   76|   173M|      cy = cy1 | cy2;
   77|   173M|      wp[i] = (u & mask2) | (x & mask1);
   78|   173M|    }
   79|       |
   80|  23.1M|  return cy & mask1;
   81|  23.1M|}
_gcry_mpih_sub_n_cond:
   91|  15.2M|{
   92|  15.2M|  mpi_size_t i;
   93|  15.2M|  mpi_limb_t cy;
   94|  15.2M|  mpi_limb_t mask1 = vzero - op_enable;
   95|  15.2M|  mpi_limb_t mask2 = op_enable - vone;
   96|       |
   97|  15.2M|  cy = 0;
   98|   130M|  for (i = 0; i < usize; i++)
  ------------------
  |  Branch (98:15): [True: 114M, False: 15.2M]
  ------------------
   99|   114M|    {
  100|   114M|      mpi_limb_t u = up[i];
  101|   114M|      mpi_limb_t x = u - vp[i];
  102|   114M|      mpi_limb_t cy1 = x > u;
  103|   114M|      mpi_limb_t cy2;
  104|       |
  105|   114M|      cy2 = x < cy;
  106|   114M|      x = x - cy;
  107|   114M|      cy = cy1 | cy2;
  108|   114M|      wp[i] = (u & mask2) | (x & mask1);
  109|   114M|    }
  110|       |
  111|  15.2M|  return cy & mask1;
  112|  15.2M|}
_gcry_mpih_swap_cond:
  122|  7.63M|{
  123|  7.63M|  mpi_size_t i;
  124|  7.63M|  mpi_limb_t mask1 = vzero - op_enable;
  125|  7.63M|  mpi_limb_t mask2 = op_enable - vone;
  126|       |
  127|  65.0M|  for (i = 0; i < usize; i++)
  ------------------
  |  Branch (127:15): [True: 57.4M, False: 7.63M]
  ------------------
  128|  57.4M|    {
  129|  57.4M|      mpi_limb_t u = up[i];
  130|  57.4M|      mpi_limb_t v = vp[i];
  131|  57.4M|      up[i] = (u & mask2) | (v & mask1);
  132|  57.4M|      vp[i] = (u & mask1) | (v & mask2);
  133|  57.4M|    }
  134|  7.63M|}
_gcry_mpih_abs_cond:
  144|  7.63M|{
  145|  7.63M|  mpi_size_t i;
  146|  7.63M|  mpi_limb_t mask1 = vzero - op_enable;
  147|  7.63M|  mpi_limb_t mask2 = op_enable - vone;
  148|  7.63M|  mpi_limb_t cy = op_enable;
  149|       |
  150|  65.0M|  for (i = 0; i < usize; i++)
  ------------------
  |  Branch (150:15): [True: 57.4M, False: 7.63M]
  ------------------
  151|  57.4M|    {
  152|  57.4M|      mpi_limb_t u = up[i];
  153|  57.4M|      mpi_limb_t x = ~u + cy;
  154|       |
  155|  57.4M|      cy = (x < ~u);
  156|  57.4M|      wp[i] = (u & mask2) | (x & mask1);
  157|  57.4M|    }
  158|  7.63M|}
_gcry_mpih_mod:
  168|  1.10k|{
  169|  1.10k|  int secure;
  170|  1.10k|  mpi_ptr_t rp;
  171|  1.10k|  mpi_size_t i;
  172|       |
  173|  1.10k|  secure = _gcry_is_secure (vp);
  174|  1.10k|  rp = mpi_alloc_limb_space (usize, secure);
  ------------------
  |  |  178|  1.10k|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  175|  1.10k|  MPN_ZERO (rp, usize);
  ------------------
  |  |  112|  1.10k|    do {				  \
  |  |  113|  1.10k|	int  _i;			  \
  |  |  114|  7.28k|	for( _i = 0; _i < (n); _i++ )  \
  |  |  ------------------
  |  |  |  Branch (114:15): [True: 6.18k, False: 1.10k]
  |  |  ------------------
  |  |  115|  6.18k|	    (d)[_i] = 0;		    \
  |  |  116|  1.10k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (116:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  176|       |
  177|   234k|  for (i = 0; i < vsize * BITS_PER_MPI_LIMB; i++)
  ------------------
  |  |   49|   234k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|   234k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|   234k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (177:15): [True: 233k, False: 1.10k]
  ------------------
  178|   233k|    {
  179|   233k|      unsigned int j = vsize * BITS_PER_MPI_LIMB - 1 - i;
  ------------------
  |  |   49|   233k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|   233k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|   233k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  180|   233k|      unsigned int limbno = j / BITS_PER_MPI_LIMB;
  ------------------
  |  |   49|   233k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|   233k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|   233k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  181|   233k|      unsigned int bitno = j % BITS_PER_MPI_LIMB;
  ------------------
  |  |   49|   233k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|   233k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|   233k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  182|   233k|      mpi_limb_t limb = vp[limbno];
  183|   233k|      unsigned int the_bit = ((limb & (A_LIMB_1 << bitno)) ? 1 : 0);
  ------------------
  |  |   26|   233k|#define A_LIMB_1 ((mpi_limb_t)1)
  ------------------
  |  Branch (183:31): [True: 73.0k, False: 160k]
  ------------------
  184|   233k|      mpi_limb_t underflow;
  185|   233k|      mpi_limb_t overflow;
  186|       |
  187|   233k|      overflow = _gcry_mpih_lshift (rp, rp, usize, 1);
  188|   233k|      rp[0] |= the_bit;
  189|       |
  190|   233k|      underflow = _gcry_mpih_sub_n (rp, rp, up, usize);
  191|   233k|      mpih_add_n_cond (rp, rp, up, usize, overflow ^ underflow);
  ------------------
  |  |  264|   233k|#define mpih_add_n_cond(w,u,v,s,o) _gcry_mpih_add_n_cond ((w),(u),(v),(s),(o))
  ------------------
  192|   233k|    }
  193|       |
  194|  1.10k|  return rp;
  195|  1.10k|}
_gcry_mpih_cmp_ui:
  199|  12.9k|{
  200|  12.9k|  int is_all_zero = 1;
  201|  12.9k|  mpi_size_t i;
  202|       |
  203|  59.6k|  for (i = 1; i < usize; i++)
  ------------------
  |  Branch (203:15): [True: 46.6k, False: 12.9k]
  ------------------
  204|  46.6k|    is_all_zero &= (up[i] == 0);
  205|       |
  206|  12.9k|  if (is_all_zero)
  ------------------
  |  Branch (206:7): [True: 12.9k, False: 0]
  ------------------
  207|  12.9k|    {
  208|  12.9k|      if (up[0] < v)
  ------------------
  |  Branch (208:11): [True: 0, False: 12.9k]
  ------------------
  209|      0|        return -1;
  210|  12.9k|      else if (up[0] > v)
  ------------------
  |  Branch (210:16): [True: 134, False: 12.8k]
  ------------------
  211|    134|        return 1;
  212|  12.8k|      else
  213|  12.8k|        return 0;
  214|  12.9k|    }
  215|      0|  return 1;
  216|  12.9k|}

_gcry_mpih_divrem:
  210|  6.46M|{
  211|  6.46M|    mpi_limb_t most_significant_q_limb = 0;
  212|       |
  213|  6.46M|    switch(dsize) {
  214|      0|      case 0:
  ------------------
  |  Branch (214:7): [True: 0, False: 6.46M]
  ------------------
  215|      0|	_gcry_divide_by_zero();
  216|      0|	break;
  217|       |
  218|      0|      case 1:
  ------------------
  |  Branch (218:7): [True: 0, False: 6.46M]
  ------------------
  219|      0|	{
  220|      0|	    mpi_size_t i;
  221|      0|	    mpi_limb_t n1;
  222|      0|	    mpi_limb_t d;
  223|       |
  224|      0|	    d = dp[0];
  225|      0|	    n1 = np[nsize - 1];
  226|       |
  227|      0|	    if( n1 >= d ) {
  ------------------
  |  Branch (227:10): [True: 0, False: 0]
  ------------------
  228|      0|		n1 -= d;
  229|      0|		most_significant_q_limb = 1;
  230|      0|	    }
  231|       |
  232|      0|	    qp += qextra_limbs;
  233|      0|	    for( i = nsize - 2; i >= 0; i--)
  ------------------
  |  Branch (233:26): [True: 0, False: 0]
  ------------------
  234|      0|		udiv_qrnnd( qp[i], n1, n1, np[i], d );
  ------------------
  |  |  609|      0|  __asm__ ("divq %4"                                                    \
  |  |  610|      0|	   : "=a" ((q)),                                                \
  |  |  611|      0|	     "=d" ((r))                                                 \
  |  |  612|      0|	   : "0" ((UDItype)(n0)),                                       \
  |  |  613|      0|	     "1" ((UDItype)(n1)),                                       \
  |  |  614|      0|	     "rm" ((UDItype)(d))                                        \
  |  |  615|      0|	   __CLOBBER_CC)
  ------------------
  235|      0|	    qp -= qextra_limbs;
  236|       |
  237|      0|	    for( i = qextra_limbs - 1; i >= 0; i-- )
  ------------------
  |  Branch (237:33): [True: 0, False: 0]
  ------------------
  238|      0|		udiv_qrnnd (qp[i], n1, n1, 0, d);
  ------------------
  |  |  609|      0|  __asm__ ("divq %4"                                                    \
  |  |  610|      0|	   : "=a" ((q)),                                                \
  |  |  611|      0|	     "=d" ((r))                                                 \
  |  |  612|      0|	   : "0" ((UDItype)(n0)),                                       \
  |  |  613|      0|	     "1" ((UDItype)(n1)),                                       \
  |  |  614|      0|	     "rm" ((UDItype)(d))                                        \
  |  |  615|      0|	   __CLOBBER_CC)
  ------------------
  239|       |
  240|      0|	    np[0] = n1;
  241|      0|	}
  242|      0|	break;
  243|       |
  244|      0|      case 2:
  ------------------
  |  Branch (244:7): [True: 0, False: 6.46M]
  ------------------
  245|      0|	{
  246|      0|	    mpi_size_t i;
  247|      0|	    mpi_limb_t n1, n0, n2;
  248|      0|	    mpi_limb_t d1, d0;
  249|       |
  250|      0|	    np += nsize - 2;
  251|      0|	    d1 = dp[1];
  252|      0|	    d0 = dp[0];
  253|      0|	    n1 = np[1];
  254|      0|	    n0 = np[0];
  255|       |
  256|      0|	    if( n1 >= d1 && (n1 > d1 || n0 >= d0) ) {
  ------------------
  |  Branch (256:10): [True: 0, False: 0]
  |  Branch (256:23): [True: 0, False: 0]
  |  Branch (256:34): [True: 0, False: 0]
  ------------------
  257|      0|		sub_ddmmss (n1, n0, n1, n0, d1, d0);
  ------------------
  |  |  592|      0|  __asm__ ("subq %5,%1\n"                                               \
  |  |  593|      0|	   "sbbq %3,%0"                                                 \
  |  |  594|      0|	   : "=r" ((sh)),                                               \
  |  |  595|      0|	     "=&r" ((sl))                                               \
  |  |  596|      0|	   : "0" ((UDItype)(ah)),                                       \
  |  |  597|      0|	     "g" ((UDItype)(bh)),                                       \
  |  |  598|      0|	     "1" ((UDItype)(al)),                                       \
  |  |  599|      0|	     "g" ((UDItype)(bl))                                        \
  |  |  600|      0|	   __CLOBBER_CC)
  ------------------
  258|      0|		most_significant_q_limb = 1;
  259|      0|	    }
  260|       |
  261|      0|	    for( i = qextra_limbs + nsize - 2 - 1; i >= 0; i-- ) {
  ------------------
  |  Branch (261:45): [True: 0, False: 0]
  ------------------
  262|      0|		mpi_limb_t q;
  263|      0|		mpi_limb_t r;
  264|       |
  265|      0|		if( i >= qextra_limbs )
  ------------------
  |  Branch (265:7): [True: 0, False: 0]
  ------------------
  266|      0|		    np--;
  267|      0|		else
  268|      0|		    np[0] = 0;
  269|       |
  270|      0|		if( n1 == d1 ) {
  ------------------
  |  Branch (270:7): [True: 0, False: 0]
  ------------------
  271|       |		    /* Q should be either 111..111 or 111..110.  Need special
  272|       |		     * treatment of this rare case as normal division would
  273|       |		     * give overflow.  */
  274|      0|		    q = ~(mpi_limb_t)0;
  275|       |
  276|      0|		    r = n0 + d1;
  277|      0|		    if( r < d1 ) {   /* Carry in the addition? */
  ------------------
  |  Branch (277:11): [True: 0, False: 0]
  ------------------
  278|      0|			add_ssaaaa( n1, n0, r - d0, np[0], 0, d0 );
  ------------------
  |  |  582|      0|  __asm__ ("addq %5,%1\n"                                               \
  |  |  583|      0|	   "adcq %3,%0"                                                 \
  |  |  584|      0|	   : "=r" ((sh)),                                               \
  |  |  585|      0|	     "=&r" ((sl))                                               \
  |  |  586|      0|	   : "0" ((UDItype)(ah)),                                       \
  |  |  587|      0|	     "g"  ((UDItype)(bh)),                                      \
  |  |  588|      0|	     "1" ((UDItype)(al)),                                       \
  |  |  589|      0|	     "g"  ((UDItype)(bl))                                       \
  |  |  590|      0|	   __CLOBBER_CC)
  ------------------
  279|      0|			qp[i] = q;
  280|      0|			continue;
  281|      0|		    }
  282|      0|		    n1 = d0 - (d0 != 0?1:0);
  ------------------
  |  Branch (282:18): [True: 0, False: 0]
  ------------------
  283|      0|		    n0 = -d0;
  284|      0|		}
  285|      0|		else {
  286|      0|		    udiv_qrnnd (q, r, n1, n0, d1);
  ------------------
  |  |  609|      0|  __asm__ ("divq %4"                                                    \
  |  |  610|      0|	   : "=a" ((q)),                                                \
  |  |  611|      0|	     "=d" ((r))                                                 \
  |  |  612|      0|	   : "0" ((UDItype)(n0)),                                       \
  |  |  613|      0|	     "1" ((UDItype)(n1)),                                       \
  |  |  614|      0|	     "rm" ((UDItype)(d))                                        \
  |  |  615|      0|	   __CLOBBER_CC)
  ------------------
  287|      0|		    umul_ppmm (n1, n0, d0, q);
  ------------------
  |  |  602|      0|  __asm__ ("mulq %3"                                                    \
  |  |  603|      0|	   : "=a" ((w0)),                                               \
  |  |  604|      0|	     "=d" ((w1))                                                \
  |  |  605|      0|	   : "0" ((UDItype)(u)),                                        \
  |  |  606|      0|	     "rm" ((UDItype)(v))                                        \
  |  |  607|      0|	   __CLOBBER_CC)
  ------------------
  288|      0|		}
  289|       |
  290|      0|		n2 = np[0];
  291|      0|	      q_test:
  292|      0|		if( n1 > r || (n1 == r && n0 > n2) ) {
  ------------------
  |  Branch (292:7): [True: 0, False: 0]
  |  Branch (292:18): [True: 0, False: 0]
  |  Branch (292:29): [True: 0, False: 0]
  ------------------
  293|       |		    /* The estimated Q was too large.  */
  294|      0|		    q--;
  295|      0|		    sub_ddmmss (n1, n0, n1, n0, 0, d0);
  ------------------
  |  |  592|      0|  __asm__ ("subq %5,%1\n"                                               \
  |  |  593|      0|	   "sbbq %3,%0"                                                 \
  |  |  594|      0|	   : "=r" ((sh)),                                               \
  |  |  595|      0|	     "=&r" ((sl))                                               \
  |  |  596|      0|	   : "0" ((UDItype)(ah)),                                       \
  |  |  597|      0|	     "g" ((UDItype)(bh)),                                       \
  |  |  598|      0|	     "1" ((UDItype)(al)),                                       \
  |  |  599|      0|	     "g" ((UDItype)(bl))                                        \
  |  |  600|      0|	   __CLOBBER_CC)
  ------------------
  296|      0|		    r += d1;
  297|      0|		    if( r >= d1 )    /* If not carry, test Q again.  */
  ------------------
  |  Branch (297:11): [True: 0, False: 0]
  ------------------
  298|      0|			goto q_test;
  299|      0|		}
  300|       |
  301|      0|		qp[i] = q;
  302|      0|		sub_ddmmss (n1, n0, r, n2, n1, n0);
  ------------------
  |  |  592|      0|  __asm__ ("subq %5,%1\n"                                               \
  |  |  593|      0|	   "sbbq %3,%0"                                                 \
  |  |  594|      0|	   : "=r" ((sh)),                                               \
  |  |  595|      0|	     "=&r" ((sl))                                               \
  |  |  596|      0|	   : "0" ((UDItype)(ah)),                                       \
  |  |  597|      0|	     "g" ((UDItype)(bh)),                                       \
  |  |  598|      0|	     "1" ((UDItype)(al)),                                       \
  |  |  599|      0|	     "g" ((UDItype)(bl))                                        \
  |  |  600|      0|	   __CLOBBER_CC)
  ------------------
  303|      0|	    }
  304|      0|	    np[1] = n1;
  305|      0|	    np[0] = n0;
  306|      0|	}
  307|      0|	break;
  308|       |
  309|  6.46M|      default:
  ------------------
  |  Branch (309:7): [True: 6.46M, False: 0]
  ------------------
  310|  6.46M|	{
  311|  6.46M|	    mpi_size_t i;
  312|  6.46M|	    mpi_limb_t dX, d1, n0;
  313|       |
  314|  6.46M|	    np += nsize - dsize;
  315|  6.46M|	    dX = dp[dsize - 1];
  316|  6.46M|	    d1 = dp[dsize - 2];
  317|  6.46M|	    n0 = np[dsize - 1];
  318|       |
  319|  6.46M|	    if( n0 >= dX ) {
  ------------------
  |  Branch (319:10): [True: 19.6k, False: 6.44M]
  ------------------
  320|  19.6k|		if(n0 > dX || _gcry_mpih_cmp(np, dp, dsize - 1) >= 0 ) {
  ------------------
  |  Branch (320:6): [True: 18.8k, False: 809]
  |  Branch (320:17): [True: 788, False: 21]
  ------------------
  321|  19.6k|		    _gcry_mpih_sub_n(np, np, dp, dsize);
  322|  19.6k|		    n0 = np[dsize - 1];
  323|  19.6k|		    most_significant_q_limb = 1;
  324|  19.6k|		}
  325|  19.6k|	    }
  326|       |
  327|  56.0M|	    for( i = qextra_limbs + nsize - dsize - 1; i >= 0; i--) {
  ------------------
  |  Branch (327:49): [True: 49.6M, False: 6.46M]
  ------------------
  328|  49.6M|		mpi_limb_t q;
  329|  49.6M|		mpi_limb_t n1, n2;
  330|  49.6M|		mpi_limb_t cy_limb;
  331|       |
  332|  49.6M|		if( i >= qextra_limbs ) {
  ------------------
  |  Branch (332:7): [True: 49.6M, False: 0]
  ------------------
  333|  49.6M|		    np--;
  334|  49.6M|		    n2 = np[dsize];
  335|  49.6M|		}
  336|      0|		else {
  337|      0|		    n2 = np[dsize - 1];
  338|      0|		    MPN_COPY_DECR (np + 1, np, dsize - 1);
  ------------------
  |  |  104|      0|    do {				\
  |  |  105|      0|	mpi_size_t _i;			\
  |  |  106|      0|	for( _i = (n)-1; _i >= 0; _i--) \
  |  |  ------------------
  |  |  |  Branch (106:19): [True: 0, False: 0]
  |  |  ------------------
  |  |  107|      0|	   (d)[_i] = (s)[_i];		\
  |  |  108|      0|    } while(0)
  |  |  ------------------
  |  |  |  Branch (108:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  339|      0|		    np[0] = 0;
  340|      0|		}
  341|       |
  342|  49.6M|		if( n0 == dX ) {
  ------------------
  |  Branch (342:7): [True: 986, False: 49.6M]
  ------------------
  343|       |		    /* This might over-estimate q, but it's probably not worth
  344|       |		     * the extra code here to find out.  */
  345|    986|		    q = ~(mpi_limb_t)0;
  346|    986|		}
  347|  49.6M|		else {
  348|  49.6M|		    mpi_limb_t r;
  349|       |
  350|  49.6M|		    udiv_qrnnd(q, r, n0, np[dsize - 1], dX);
  ------------------
  |  |  609|  49.6M|  __asm__ ("divq %4"                                                    \
  |  |  610|  49.6M|	   : "=a" ((q)),                                                \
  |  |  611|  49.6M|	     "=d" ((r))                                                 \
  |  |  612|  49.6M|	   : "0" ((UDItype)(n0)),                                       \
  |  |  613|  49.6M|	     "1" ((UDItype)(n1)),                                       \
  |  |  614|  49.6M|	     "rm" ((UDItype)(d))                                        \
  |  |  615|  49.6M|	   __CLOBBER_CC)
  ------------------
  351|  49.6M|		    umul_ppmm(n1, n0, d1, q);
  ------------------
  |  |  602|  49.6M|  __asm__ ("mulq %3"                                                    \
  |  |  603|  49.6M|	   : "=a" ((w0)),                                               \
  |  |  604|  49.6M|	     "=d" ((w1))                                                \
  |  |  605|  49.6M|	   : "0" ((UDItype)(u)),                                        \
  |  |  606|  49.6M|	     "rm" ((UDItype)(v))                                        \
  |  |  607|  49.6M|	   __CLOBBER_CC)
  ------------------
  352|       |
  353|  58.9M|		    while( n1 > r || (n1 == r && n0 > np[dsize - 2])) {
  ------------------
  |  Branch (353:14): [True: 21.2M, False: 37.6M]
  |  Branch (353:25): [True: 123k, False: 37.5M]
  |  Branch (353:36): [True: 18, False: 123k]
  ------------------
  354|  21.2M|			q--;
  355|  21.2M|			r += dX;
  356|  21.2M|			if( r < dX ) /* I.e. "carry in previous addition?" */
  ------------------
  |  Branch (356:8): [True: 11.9M, False: 9.28M]
  ------------------
  357|  11.9M|			    break;
  358|  9.28M|			n1 -= n0 < d1;
  359|  9.28M|			n0 -= d1;
  360|  9.28M|		    }
  361|  49.6M|		}
  362|       |
  363|       |		/* Possible optimization: We already have (q * n0) and (1 * n1)
  364|       |		 * after the calculation of q.	Taking advantage of that, we
  365|       |		 * could make this loop make two iterations less.  */
  366|  49.6M|		cy_limb = _gcry_mpih_submul_1(np, dp, dsize, q);
  367|       |
  368|  49.6M|		if( n2 != cy_limb ) {
  ------------------
  |  Branch (368:7): [True: 327, False: 49.6M]
  ------------------
  369|    327|		    _gcry_mpih_add_n(np, np, dp, dsize);
  370|    327|		    q--;
  371|    327|		}
  372|       |
  373|  49.6M|		qp[i] = q;
  374|  49.6M|		n0 = np[dsize - 1];
  375|  49.6M|	    }
  376|  6.46M|	}
  377|  6.46M|    }
  378|       |
  379|  6.46M|    return most_significant_q_limb;
  380|  6.46M|}

_gcry_mpih_sqr_n_basecase:
  227|  15.4M|{
  228|  15.4M|    mpi_size_t i;
  229|  15.4M|    mpi_limb_t cy_limb;
  230|  15.4M|    mpi_limb_t v_limb;
  231|       |
  232|       |    /* Multiply by the first limb in V separately, as the result can be
  233|       |     * stored (not added) to PROD.  We also avoid a loop for zeroing.  */
  234|  15.4M|    v_limb = up[0];
  235|  15.4M|    if( v_limb <= 1 ) {
  ------------------
  |  Branch (235:9): [True: 136k, False: 15.3M]
  ------------------
  236|   136k|	if( v_limb == 1 )
  ------------------
  |  Branch (236:6): [True: 36.3k, False: 99.6k]
  ------------------
  237|  36.3k|	    MPN_COPY( prodp, up, size );
  ------------------
  |  |   90|  36.3k|    do {				\
  |  |   91|  36.3k|	mpi_size_t _i;			\
  |  |   92|   181k|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 145k, False: 36.3k]
  |  |  ------------------
  |  |   93|   145k|	    (d)[_i] = (s)[_i];		\
  |  |   94|  36.3k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  238|  99.6k|	else
  239|  99.6k|	    MPN_ZERO(prodp, size);
  ------------------
  |  |  112|  99.6k|    do {				  \
  |  |  113|  99.6k|	int  _i;			  \
  |  |  114|   498k|	for( _i = 0; _i < (n); _i++ )  \
  |  |  ------------------
  |  |  |  Branch (114:15): [True: 398k, False: 99.6k]
  |  |  ------------------
  |  |  115|   398k|	    (d)[_i] = 0;		    \
  |  |  116|  99.6k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (116:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  240|   136k|	cy_limb = 0;
  241|   136k|    }
  242|  15.3M|    else
  243|  15.3M|	cy_limb = _gcry_mpih_mul_1( prodp, up, size, v_limb );
  244|       |
  245|  15.4M|    prodp[size] = cy_limb;
  246|  15.4M|    prodp++;
  247|       |
  248|       |    /* For each iteration in the outer loop, multiply one limb from
  249|       |     * U with one limb from V, and add it to PROD.  */
  250|  61.9M|    for( i=1; i < size; i++) {
  ------------------
  |  Branch (250:15): [True: 46.4M, False: 15.4M]
  ------------------
  251|  46.4M|	v_limb = up[i];
  252|  46.4M|	if( v_limb <= 1 ) {
  ------------------
  |  Branch (252:6): [True: 408k, False: 46.0M]
  ------------------
  253|   408k|	    cy_limb = 0;
  254|   408k|	    if( v_limb == 1 )
  ------------------
  |  Branch (254:10): [True: 0, False: 408k]
  ------------------
  255|      0|		cy_limb = _gcry_mpih_add_n(prodp, prodp, up, size);
  256|   408k|	}
  257|  46.0M|	else
  258|  46.0M|	    cy_limb = _gcry_mpih_addmul_1(prodp, up, size, v_limb);
  259|       |
  260|  46.4M|	prodp[size] = cy_limb;
  261|  46.4M|	prodp++;
  262|  46.4M|    }
  263|  15.4M|}
_gcry_mpih_mul_n:
  348|  41.6M|{
  349|  41.6M|    int secure;
  350|       |
  351|  41.6M|    if( up == vp ) {
  ------------------
  |  Branch (351:9): [True: 15.4M, False: 26.1M]
  ------------------
  352|  15.4M|	if( size < KARATSUBA_THRESHOLD )
  ------------------
  |  |   61|  15.4M|#define KARATSUBA_THRESHOLD 16
  ------------------
  |  Branch (352:6): [True: 15.4M, False: 0]
  ------------------
  353|  15.4M|	    _gcry_mpih_sqr_n_basecase( prodp, up, size );
  354|      0|	else {
  355|      0|	    mpi_ptr_t tspace;
  356|      0|	    secure = _gcry_is_secure( up );
  357|      0|	    tspace = mpi_alloc_limb_space( 2 * size, secure );
  ------------------
  |  |  178|      0|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  358|      0|	    _gcry_mpih_sqr_n( prodp, up, size, tspace );
  359|      0|	    _gcry_mpi_free_limb_space (tspace, 2 * size );
  360|      0|	}
  361|  15.4M|    }
  362|  26.1M|    else {
  363|  26.1M|	if( size < KARATSUBA_THRESHOLD )
  ------------------
  |  |   61|  26.1M|#define KARATSUBA_THRESHOLD 16
  ------------------
  |  Branch (363:6): [True: 26.1M, False: 0]
  ------------------
  364|  26.1M|	    mul_n_basecase( prodp, up, vp, size );
  365|      0|	else {
  366|      0|	    mpi_ptr_t tspace;
  367|      0|	    secure = _gcry_is_secure( up ) || _gcry_is_secure( vp );
  ------------------
  |  Branch (367:15): [True: 0, False: 0]
  |  Branch (367:40): [True: 0, False: 0]
  ------------------
  368|      0|	    tspace = mpi_alloc_limb_space( 2 * size, secure );
  ------------------
  |  |  178|      0|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  369|      0|	    mul_n (prodp, up, vp, size, tspace);
  370|      0|	    _gcry_mpi_free_limb_space (tspace, 2 * size );
  371|      0|	}
  372|  26.1M|    }
  373|  41.6M|}
_gcry_mpih_mul_karatsuba_case:
  382|  1.45M|{
  383|  1.45M|    mpi_limb_t cy;
  384|       |
  385|  1.45M|    if( !ctx->tspace || ctx->tspace_size < vsize ) {
  ------------------
  |  Branch (385:9): [True: 1.18M, False: 278k]
  |  Branch (385:25): [True: 387, False: 278k]
  ------------------
  386|  1.18M|	if( ctx->tspace )
  ------------------
  |  Branch (386:6): [True: 387, False: 1.18M]
  ------------------
  387|    387|	    _gcry_mpi_free_limb_space( ctx->tspace, ctx->tspace_nlimbs );
  388|  1.18M|        ctx->tspace_nlimbs = 2 * vsize;
  389|  1.18M|	ctx->tspace = mpi_alloc_limb_space (2 * vsize,
  ------------------
  |  |  178|  2.36M|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  |  |  ------------------
  |  |  |  Branch (178:68): [True: 0, False: 1.18M]
  |  |  |  Branch (178:68): [True: 0, False: 1.18M]
  |  |  ------------------
  ------------------
  390|  1.18M|				            (_gcry_is_secure (up)
  391|  1.18M|                                             || _gcry_is_secure (vp)));
  392|  1.18M|	ctx->tspace_size = vsize;
  393|  1.18M|    }
  394|       |
  395|  1.45M|    MPN_MUL_N_RECURSE( prodp, up, vp, vsize, ctx->tspace );
  ------------------
  |  |   37|  1.45M|    do {						\
  |  |   38|  1.45M|	if( (size) < KARATSUBA_THRESHOLD )		\
  |  |  ------------------
  |  |  |  |   61|  1.45M|#define KARATSUBA_THRESHOLD 16
  |  |  ------------------
  |  |  |  Branch (38:6): [True: 0, False: 1.45M]
  |  |  ------------------
  |  |   39|  1.45M|	    mul_n_basecase (prodp, up, vp, size);	\
  |  |   40|  1.45M|	else						\
  |  |   41|  1.45M|	    mul_n (prodp, up, vp, size, tspace);	\
  |  |   42|  1.45M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (42:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  396|       |
  397|  1.45M|    prodp += vsize;
  398|  1.45M|    up += vsize;
  399|  1.45M|    usize -= vsize;
  400|  1.45M|    if( usize >= vsize ) {
  ------------------
  |  Branch (400:9): [True: 8.16k, False: 1.45M]
  ------------------
  401|  8.16k|	if( !ctx->tp || ctx->tp_size < vsize ) {
  ------------------
  |  Branch (401:6): [True: 7.91k, False: 248]
  |  Branch (401:18): [True: 0, False: 248]
  ------------------
  402|  7.91k|	    if( ctx->tp )
  ------------------
  |  Branch (402:10): [True: 0, False: 7.91k]
  ------------------
  403|      0|		_gcry_mpi_free_limb_space( ctx->tp, ctx->tp_nlimbs );
  404|  7.91k|            ctx->tp_nlimbs = 2 * vsize;
  405|  7.91k|	    ctx->tp = mpi_alloc_limb_space (2 * vsize,
  ------------------
  |  |  178|  15.8k|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  |  |  ------------------
  |  |  |  Branch (178:68): [True: 0, False: 7.91k]
  |  |  |  Branch (178:68): [True: 0, False: 7.91k]
  |  |  ------------------
  ------------------
  406|  7.91k|                                            (_gcry_is_secure (up)
  407|  7.91k|                                             || _gcry_is_secure (vp)));
  408|  7.91k|	    ctx->tp_size = vsize;
  409|  7.91k|	}
  410|       |
  411|  8.19k|	do {
  412|  8.19k|	    MPN_MUL_N_RECURSE( ctx->tp, up, vp, vsize, ctx->tspace );
  ------------------
  |  |   37|  8.19k|    do {						\
  |  |   38|  8.19k|	if( (size) < KARATSUBA_THRESHOLD )		\
  |  |  ------------------
  |  |  |  |   61|  8.19k|#define KARATSUBA_THRESHOLD 16
  |  |  ------------------
  |  |  |  Branch (38:6): [True: 0, False: 8.19k]
  |  |  ------------------
  |  |   39|  8.19k|	    mul_n_basecase (prodp, up, vp, size);	\
  |  |   40|  8.19k|	else						\
  |  |   41|  8.19k|	    mul_n (prodp, up, vp, size, tspace);	\
  |  |   42|  8.19k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (42:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  413|  8.19k|	    cy = _gcry_mpih_add_n( prodp, prodp, ctx->tp, vsize );
  414|  8.19k|	    _gcry_mpih_add_1( prodp + vsize, ctx->tp + vsize, vsize, cy );
  415|  8.19k|	    prodp += vsize;
  416|  8.19k|	    up += vsize;
  417|  8.19k|	    usize -= vsize;
  418|  8.19k|	} while( usize >= vsize );
  ------------------
  |  Branch (418:11): [True: 35, False: 8.16k]
  ------------------
  419|  8.16k|    }
  420|       |
  421|  1.45M|    if( usize ) {
  ------------------
  |  Branch (421:9): [True: 208k, False: 1.25M]
  ------------------
  422|   208k|	if( usize < KARATSUBA_THRESHOLD ) {
  ------------------
  |  |   61|   208k|#define KARATSUBA_THRESHOLD 16
  ------------------
  |  Branch (422:6): [True: 208k, False: 175]
  ------------------
  423|   208k|	    _gcry_mpih_mul( ctx->tspace, vp, vsize, up, usize );
  424|   208k|	}
  425|    175|	else {
  426|    175|	    if( !ctx->next ) {
  ------------------
  |  Branch (426:10): [True: 61, False: 114]
  ------------------
  427|     61|		ctx->next = xcalloc( 1, sizeof *ctx );
  ------------------
  |  |  145|     61|#define xcalloc(a,b)     _gcry_xcalloc ((a),(b))
  ------------------
  428|     61|	    }
  429|    175|	    _gcry_mpih_mul_karatsuba_case( ctx->tspace,
  430|    175|					vp, vsize,
  431|    175|					up, usize,
  432|    175|					ctx->next );
  433|    175|	}
  434|       |
  435|   208k|	cy = _gcry_mpih_add_n( prodp, prodp, ctx->tspace, vsize);
  436|   208k|	_gcry_mpih_add_1( prodp + vsize, ctx->tspace + vsize, usize, cy );
  437|   208k|    }
  438|  1.45M|}
_gcry_mpih_release_karatsuba_ctx:
  443|  2.54M|{
  444|  2.54M|    struct karatsuba_ctx *ctx2;
  445|       |
  446|  2.54M|    if( ctx->tp )
  ------------------
  |  Branch (446:9): [True: 7.90k, False: 2.54M]
  ------------------
  447|  7.90k|	_gcry_mpi_free_limb_space( ctx->tp, ctx->tp_nlimbs );
  448|  2.54M|    if( ctx->tspace )
  ------------------
  |  Branch (448:9): [True: 1.18M, False: 1.36M]
  ------------------
  449|  1.18M|	_gcry_mpi_free_limb_space( ctx->tspace, ctx->tspace_nlimbs );
  450|  2.54M|    for( ctx=ctx->next; ctx; ctx = ctx2 ) {
  ------------------
  |  Branch (450:25): [True: 61, False: 2.54M]
  ------------------
  451|     61|	ctx2 = ctx->next;
  452|     61|	if( ctx->tp )
  ------------------
  |  Branch (452:6): [True: 7, False: 54]
  ------------------
  453|      7|            _gcry_mpi_free_limb_space( ctx->tp, ctx->tp_nlimbs );
  454|     61|	if( ctx->tspace )
  ------------------
  |  Branch (454:6): [True: 61, False: 0]
  ------------------
  455|     61|	    _gcry_mpi_free_limb_space( ctx->tspace, ctx->tspace_nlimbs );
  456|     61|	xfree( ctx );
  ------------------
  |  |  150|     61|#define xfree(a)         _gcry_free ((a))
  ------------------
  457|     61|    }
  458|  2.54M|}
_gcry_mpih_mul:
  478|  21.2M|{
  479|  21.2M|    mpi_ptr_t prod_endp = prodp + usize + vsize - 1;
  480|  21.2M|    mpi_limb_t cy;
  481|  21.2M|    struct karatsuba_ctx ctx;
  482|       |
  483|  21.2M|    if( vsize < KARATSUBA_THRESHOLD ) {
  ------------------
  |  |   61|  21.2M|#define KARATSUBA_THRESHOLD 16
  ------------------
  |  Branch (483:9): [True: 20.0M, False: 1.17M]
  ------------------
  484|  20.0M|	mpi_size_t i;
  485|  20.0M|	mpi_limb_t v_limb;
  486|       |
  487|  20.0M|	if( !vsize )
  ------------------
  |  Branch (487:6): [True: 0, False: 20.0M]
  ------------------
  488|      0|	    return 0;
  489|       |
  490|       |	/* Multiply by the first limb in V separately, as the result can be
  491|       |	 * stored (not added) to PROD.	We also avoid a loop for zeroing.  */
  492|  20.0M|	v_limb = vp[0];
  493|  20.0M|	if( v_limb <= 1 ) {
  ------------------
  |  Branch (493:6): [True: 1.96M, False: 18.1M]
  ------------------
  494|  1.96M|	    if( v_limb == 1 )
  ------------------
  |  Branch (494:10): [True: 1.51M, False: 445k]
  ------------------
  495|  1.51M|		MPN_COPY( prodp, up, usize );
  ------------------
  |  |   90|  1.51M|    do {				\
  |  |   91|  1.51M|	mpi_size_t _i;			\
  |  |   92|  8.36M|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 6.84M, False: 1.51M]
  |  |  ------------------
  |  |   93|  6.84M|	    (d)[_i] = (s)[_i];		\
  |  |   94|  1.51M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  496|   445k|	    else
  497|   445k|		MPN_ZERO( prodp, usize );
  ------------------
  |  |  112|   445k|    do {				  \
  |  |  113|   445k|	int  _i;			  \
  |  |  114|  5.08M|	for( _i = 0; _i < (n); _i++ )  \
  |  |  ------------------
  |  |  |  Branch (114:15): [True: 4.64M, False: 445k]
  |  |  ------------------
  |  |  115|  4.64M|	    (d)[_i] = 0;		    \
  |  |  116|   445k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (116:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  498|  1.96M|	    cy = 0;
  499|  1.96M|	}
  500|  18.1M|	else
  501|  18.1M|	    cy = _gcry_mpih_mul_1( prodp, up, usize, v_limb );
  502|       |
  503|  20.0M|	prodp[usize] = cy;
  504|  20.0M|	prodp++;
  505|       |
  506|       |	/* For each iteration in the outer loop, multiply one limb from
  507|       |	 * U with one limb from V, and add it to PROD.	*/
  508|  81.2M|	for( i = 1; i < vsize; i++ ) {
  ------------------
  |  Branch (508:14): [True: 61.2M, False: 20.0M]
  ------------------
  509|  61.2M|	    v_limb = vp[i];
  510|  61.2M|	    if( v_limb <= 1 ) {
  ------------------
  |  Branch (510:10): [True: 583k, False: 60.6M]
  ------------------
  511|   583k|		cy = 0;
  512|   583k|		if( v_limb == 1 )
  ------------------
  |  Branch (512:7): [True: 5.02k, False: 578k]
  ------------------
  513|  5.02k|		   cy = _gcry_mpih_add_n(prodp, prodp, up, usize);
  514|   583k|	    }
  515|  60.6M|	    else
  516|  60.6M|		cy = _gcry_mpih_addmul_1(prodp, up, usize, v_limb);
  517|       |
  518|  61.2M|	    prodp[usize] = cy;
  519|  61.2M|	    prodp++;
  520|  61.2M|	}
  521|       |
  522|  20.0M|	return cy;
  523|  20.0M|    }
  524|       |
  525|  1.17M|    memset( &ctx, 0, sizeof ctx );
  526|  1.17M|    _gcry_mpih_mul_karatsuba_case( prodp, up, usize, vp, vsize, &ctx );
  527|  1.17M|    _gcry_mpih_release_karatsuba_ctx( &ctx );
  528|  1.17M|    return *prod_endp;
  529|  21.2M|}
mpih-mul.c:mul_n_basecase:
   75|  32.1M|{
   76|  32.1M|    mpi_size_t i;
   77|  32.1M|    mpi_limb_t cy;
   78|  32.1M|    mpi_limb_t v_limb;
   79|       |
   80|       |    /* Multiply by the first limb in V separately, as the result can be
   81|       |     * stored (not added) to PROD.  We also avoid a loop for zeroing.  */
   82|  32.1M|    v_limb = vp[0];
   83|  32.1M|    if( v_limb <= 1 ) {
  ------------------
  |  Branch (83:9): [True: 1.57M, False: 30.5M]
  ------------------
   84|  1.57M|	if( v_limb == 1 )
  ------------------
  |  Branch (84:6): [True: 1.54M, False: 36.7k]
  ------------------
   85|  1.54M|	    MPN_COPY( prodp, up, size );
  ------------------
  |  |   90|  1.54M|    do {				\
  |  |   91|  1.54M|	mpi_size_t _i;			\
  |  |   92|  7.72M|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 6.18M, False: 1.54M]
  |  |  ------------------
  |  |   93|  6.18M|	    (d)[_i] = (s)[_i];		\
  |  |   94|  1.54M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
   86|  36.7k|	else
   87|  36.7k|	    MPN_ZERO( prodp, size );
  ------------------
  |  |  112|  36.7k|    do {				  \
  |  |  113|  36.7k|	int  _i;			  \
  |  |  114|   321k|	for( _i = 0; _i < (n); _i++ )  \
  |  |  ------------------
  |  |  |  Branch (114:15): [True: 285k, False: 36.7k]
  |  |  ------------------
  |  |  115|   285k|	    (d)[_i] = 0;		    \
  |  |  116|  36.7k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (116:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
   88|  1.57M|	cy = 0;
   89|  1.57M|    }
   90|  30.5M|    else
   91|  30.5M|	cy = _gcry_mpih_mul_1( prodp, up, size, v_limb );
   92|       |
   93|  32.1M|    prodp[size] = cy;
   94|  32.1M|    prodp++;
   95|       |
   96|       |    /* For each iteration in the outer loop, multiply one limb from
   97|       |     * U with one limb from V, and add it to PROD.  */
   98|   161M|    for( i = 1; i < size; i++ ) {
  ------------------
  |  Branch (98:17): [True: 129M, False: 32.1M]
  ------------------
   99|   129M|	v_limb = vp[i];
  100|   129M|	if( v_limb <= 1 ) {
  ------------------
  |  Branch (100:6): [True: 5.00M, False: 124M]
  ------------------
  101|  5.00M|	    cy = 0;
  102|  5.00M|	    if( v_limb == 1 )
  ------------------
  |  Branch (102:10): [True: 12.9k, False: 4.99M]
  ------------------
  103|  12.9k|	       cy = _gcry_mpih_add_n(prodp, prodp, up, size);
  104|  5.00M|	}
  105|   124M|	else
  106|   124M|	    cy = _gcry_mpih_addmul_1(prodp, up, size, v_limb);
  107|       |
  108|   129M|	prodp[size] = cy;
  109|   129M|	prodp++;
  110|   129M|    }
  111|       |
  112|  32.1M|    return cy;
  113|  32.1M|}
mpih-mul.c:mul_n:
  119|  2.51M|{
  120|  2.51M|    if( size & 1 ) {
  ------------------
  |  Branch (120:9): [True: 248k, False: 2.26M]
  ------------------
  121|       |      /* The size is odd, and the code below doesn't handle that.
  122|       |       * Multiply the least significant (size - 1) limbs with a recursive
  123|       |       * call, and handle the most significant limb of S1 and S2
  124|       |       * separately.
  125|       |       * A slightly faster way to do this would be to make the Karatsuba
  126|       |       * code below behave as if the size were even, and let it check for
  127|       |       * odd size in the end.  I.e., in essence move this code to the end.
  128|       |       * Doing so would save us a recursive call, and potentially make the
  129|       |       * stack grow a lot less.
  130|       |       */
  131|   248k|      mpi_size_t esize = size - 1;	 /* even size */
  132|   248k|      mpi_limb_t cy_limb;
  133|       |
  134|   248k|      MPN_MUL_N_RECURSE( prodp, up, vp, esize, tspace );
  ------------------
  |  |   37|   248k|    do {						\
  |  |   38|   248k|	if( (size) < KARATSUBA_THRESHOLD )		\
  |  |  ------------------
  |  |  |  |   61|   248k|#define KARATSUBA_THRESHOLD 16
  |  |  ------------------
  |  |  |  Branch (38:6): [True: 0, False: 248k]
  |  |  ------------------
  |  |   39|   248k|	    mul_n_basecase (prodp, up, vp, size);	\
  |  |   40|   248k|	else						\
  |  |   41|   248k|	    mul_n (prodp, up, vp, size, tspace);	\
  |  |   42|   248k|    } while (0)
  |  |  ------------------
  |  |  |  Branch (42:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  135|   248k|      cy_limb = _gcry_mpih_addmul_1( prodp + esize, up, esize, vp[esize] );
  136|   248k|      prodp[esize + esize] = cy_limb;
  137|   248k|      cy_limb = _gcry_mpih_addmul_1( prodp + esize, vp, size, up[esize] );
  138|   248k|      prodp[esize + size] = cy_limb;
  139|   248k|    }
  140|  2.26M|    else {
  141|       |	/* Anatolij Alekseevich Karatsuba's divide-and-conquer algorithm.
  142|       |	 *
  143|       |	 * Split U in two pieces, U1 and U0, such that
  144|       |	 * U = U0 + U1*(B**n),
  145|       |	 * and V in V1 and V0, such that
  146|       |	 * V = V0 + V1*(B**n).
  147|       |	 *
  148|       |	 * UV is then computed recursively using the identity
  149|       |	 *
  150|       |	 *	  2n   n	  n			n
  151|       |	 * UV = (B  + B )U V  +  B (U -U )(V -V )  +  (B + 1)U V
  152|       |	 *		  1 1	     1	0   0  1	      0 0
  153|       |	 *
  154|       |	 * Where B = 2**BITS_PER_MP_LIMB.
  155|       |	 */
  156|  2.26M|	mpi_size_t hsize = size >> 1;
  157|  2.26M|	mpi_limb_t cy;
  158|  2.26M|	int negflg;
  159|       |
  160|       |	/* Product H.	   ________________  ________________
  161|       |	 *		  |_____U1 x V1____||____U0 x V0_____|
  162|       |	 * Put result in upper part of PROD and pass low part of TSPACE
  163|       |	 * as new TSPACE.
  164|       |	 */
  165|  2.26M|	MPN_MUL_N_RECURSE(prodp + size, up + hsize, vp + hsize, hsize, tspace);
  ------------------
  |  |   37|  2.26M|    do {						\
  |  |   38|  2.26M|	if( (size) < KARATSUBA_THRESHOLD )		\
  |  |  ------------------
  |  |  |  |   61|  2.26M|#define KARATSUBA_THRESHOLD 16
  |  |  ------------------
  |  |  |  Branch (38:6): [True: 1.99M, False: 265k]
  |  |  ------------------
  |  |   39|  2.26M|	    mul_n_basecase (prodp, up, vp, size);	\
  |  |   40|  2.26M|	else						\
  |  |   41|  2.26M|	    mul_n (prodp, up, vp, size, tspace);	\
  |  |   42|  2.26M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (42:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  166|       |
  167|       |	/* Product M.	   ________________
  168|       |	 *		  |_(U1-U0)(V0-V1)_|
  169|       |	 */
  170|  2.26M|	if( _gcry_mpih_cmp(up + hsize, up, hsize) >= 0 ) {
  ------------------
  |  Branch (170:6): [True: 614k, False: 1.65M]
  ------------------
  171|   614k|	    _gcry_mpih_sub_n(prodp, up + hsize, up, hsize);
  172|   614k|	    negflg = 0;
  173|   614k|	}
  174|  1.65M|	else {
  175|  1.65M|	    _gcry_mpih_sub_n(prodp, up, up + hsize, hsize);
  176|  1.65M|	    negflg = 1;
  177|  1.65M|	}
  178|  2.26M|	if( _gcry_mpih_cmp(vp + hsize, vp, hsize) >= 0 ) {
  ------------------
  |  Branch (178:6): [True: 604k, False: 1.65M]
  ------------------
  179|   604k|	    _gcry_mpih_sub_n(prodp + hsize, vp + hsize, vp, hsize);
  180|   604k|	    negflg ^= 1;
  181|   604k|	}
  182|  1.65M|	else {
  183|  1.65M|	    _gcry_mpih_sub_n(prodp + hsize, vp, vp + hsize, hsize);
  184|       |	    /* No change of NEGFLG.  */
  185|  1.65M|	}
  186|       |	/* Read temporary operands from low part of PROD.
  187|       |	 * Put result in low part of TSPACE using upper part of TSPACE
  188|       |	 * as new TSPACE.
  189|       |	 */
  190|  2.26M|	MPN_MUL_N_RECURSE(tspace, prodp, prodp + hsize, hsize, tspace + size);
  ------------------
  |  |   37|  2.26M|    do {						\
  |  |   38|  2.26M|	if( (size) < KARATSUBA_THRESHOLD )		\
  |  |  ------------------
  |  |  |  |   61|  2.26M|#define KARATSUBA_THRESHOLD 16
  |  |  ------------------
  |  |  |  Branch (38:6): [True: 1.99M, False: 265k]
  |  |  ------------------
  |  |   39|  2.26M|	    mul_n_basecase (prodp, up, vp, size);	\
  |  |   40|  2.26M|	else						\
  |  |   41|  2.26M|	    mul_n (prodp, up, vp, size, tspace);	\
  |  |   42|  2.26M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (42:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  191|       |
  192|       |	/* Add/copy product H. */
  193|  2.26M|	MPN_COPY (prodp + hsize, prodp + size, hsize);
  ------------------
  |  |   90|  2.26M|    do {				\
  |  |   91|  2.26M|	mpi_size_t _i;			\
  |  |   92|  27.6M|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 25.4M, False: 2.26M]
  |  |  ------------------
  |  |   93|  25.4M|	    (d)[_i] = (s)[_i];		\
  |  |   94|  2.26M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  194|  2.26M|	cy = _gcry_mpih_add_n( prodp + size, prodp + size,
  195|  2.26M|			    prodp + size + hsize, hsize);
  196|       |
  197|       |	/* Add product M (if NEGFLG M is a negative number) */
  198|  2.26M|	if(negflg)
  ------------------
  |  Branch (198:5): [True: 1.98M, False: 277k]
  ------------------
  199|  1.98M|	    cy -= _gcry_mpih_sub_n(prodp + hsize, prodp + hsize, tspace, size);
  200|   277k|	else
  201|   277k|	    cy += _gcry_mpih_add_n(prodp + hsize, prodp + hsize, tspace, size);
  202|       |
  203|       |	/* Product L.	   ________________  ________________
  204|       |	 *		  |________________||____U0 x V0_____|
  205|       |	 * Read temporary operands from low part of PROD.
  206|       |	 * Put result in low part of TSPACE using upper part of TSPACE
  207|       |	 * as new TSPACE.
  208|       |	 */
  209|  2.26M|	MPN_MUL_N_RECURSE(tspace, up, vp, hsize, tspace + size);
  ------------------
  |  |   37|  2.26M|    do {						\
  |  |   38|  2.26M|	if( (size) < KARATSUBA_THRESHOLD )		\
  |  |  ------------------
  |  |  |  |   61|  2.26M|#define KARATSUBA_THRESHOLD 16
  |  |  ------------------
  |  |  |  Branch (38:6): [True: 1.99M, False: 265k]
  |  |  ------------------
  |  |   39|  2.26M|	    mul_n_basecase (prodp, up, vp, size);	\
  |  |   40|  2.26M|	else						\
  |  |   41|  2.26M|	    mul_n (prodp, up, vp, size, tspace);	\
  |  |   42|  2.26M|    } while (0)
  |  |  ------------------
  |  |  |  Branch (42:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  210|       |
  211|       |	/* Add/copy Product L (twice) */
  212|       |
  213|  2.26M|	cy += _gcry_mpih_add_n(prodp + hsize, prodp + hsize, tspace, size);
  214|  2.26M|	if( cy )
  ------------------
  |  Branch (214:6): [True: 628k, False: 1.63M]
  ------------------
  215|   628k|	  _gcry_mpih_add_1(prodp + hsize + size, prodp + hsize + size, hsize, cy);
  216|       |
  217|  2.26M|	MPN_COPY(prodp, tspace, hsize);
  ------------------
  |  |   90|  2.26M|    do {				\
  |  |   91|  2.26M|	mpi_size_t _i;			\
  |  |   92|  27.6M|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 25.4M, False: 2.26M]
  |  |  ------------------
  |  |   93|  25.4M|	    (d)[_i] = (s)[_i];		\
  |  |   94|  2.26M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  218|  2.26M|	cy = _gcry_mpih_add_n(prodp + hsize, prodp + hsize, tspace + hsize, hsize);
  219|  2.26M|	if( cy )
  ------------------
  |  Branch (219:6): [True: 718k, False: 1.54M]
  ------------------
  220|   718k|	    _gcry_mpih_add_1(prodp + size, prodp + size, size, 1);
  221|  2.26M|    }
  222|  2.51M|}

_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|  6.23M|{
  102|  6.23M|    gcry_mpi_t a;
  103|       |
  104|  6.23M|    a = xmalloc( sizeof *a );
  ------------------
  |  |  144|  6.23M|#define xmalloc(a)       _gcry_xmalloc ((a))
  ------------------
  105|  6.23M|    a->d = nlimbs? mpi_alloc_limb_space( nlimbs, 0 ) : NULL;
  ------------------
  |  |  178|  5.89M|#define mpi_alloc_limb_space(n,f)  _gcry_mpi_alloc_limb_space((n),(f))
  ------------------
  |  Branch (105:12): [True: 5.89M, False: 343k]
  ------------------
  106|  6.23M|    a->alloced = nlimbs;
  107|  6.23M|    a->nlimbs = 0;
  108|  6.23M|    a->sign = 0;
  109|  6.23M|    a->flags = 0;
  110|  6.23M|    return a;
  111|  6.23M|}
_gcry_mpi_alloc_limb_space:
  131|  22.7M|{
  132|  22.7M|    mpi_ptr_t p;
  133|  22.7M|    size_t len;
  134|       |
  135|  22.7M|    len = (nlimbs ? nlimbs : 1) * sizeof (mpi_limb_t);
  ------------------
  |  Branch (135:12): [True: 22.7M, False: 489]
  ------------------
  136|  22.7M|    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|  45.4M|#define xmalloc(a)       _gcry_xmalloc ((a))
  ------------------
  |  Branch (136:9): [True: 0, False: 22.7M]
  ------------------
  137|  22.7M|    if (! nlimbs)
  ------------------
  |  Branch (137:9): [True: 489, False: 22.7M]
  ------------------
  138|    489|      *p = 0;
  139|       |
  140|  22.7M|    return p;
  141|  22.7M|}
_gcry_mpi_free_limb_space:
  145|  23.1M|{
  146|  23.1M|  if (a)
  ------------------
  |  Branch (146:7): [True: 22.9M, False: 203k]
  ------------------
  147|  22.9M|    {
  148|  22.9M|      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|  22.9M|      if (len)
  ------------------
  |  Branch (154:11): [True: 17.4M, False: 5.50M]
  ------------------
  155|  22.9M|        wipememory (a, len);
  ------------------
  |  |  398|  17.4M|#define wipememory(_ptr,_len) wipememory2((_ptr),0,(_len))
  |  |  ------------------
  |  |  |  |  388|  17.4M|#define wipememory2(_ptr,_set,_len) do { \
  |  |  |  |  389|  17.4M|	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  34.8M|#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: 17.4M, False: 0]
  |  |  |  |  |  Branch (389:33): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  390|  17.4M|		if (CONSTANT_P(_set) && (_set) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  34.8M|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (87:27): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:27): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  391|  17.4M|		  _gcry_fast_wipememory((void *)(_ptr), (_len)); \
  |  |  |  |  392|  17.4M|		else \
  |  |  |  |  393|  17.4M|		  _gcry_fast_wipememory2((void *)(_ptr), (_set), (_len)); \
  |  |  |  |  394|  17.4M|	      } 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|  17.4M|	    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (397:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  156|  22.9M|      xfree(a);
  ------------------
  |  |  150|  22.9M|#define xfree(a)         _gcry_free ((a))
  ------------------
  157|  22.9M|    }
  158|  23.1M|}
_gcry_mpi_assign_limb_space:
  163|  52.4k|{
  164|  52.4k|  _gcry_mpi_free_limb_space (a->d, a->alloced);
  165|  52.4k|  a->d = ap;
  166|  52.4k|  a->alloced = nlimbs;
  167|  52.4k|}
_gcry_mpi_resize:
  177|  17.8M|{
  178|  17.8M|  size_t i;
  179|       |
  180|  17.8M|  if (nlimbs <= a->alloced)
  ------------------
  |  Branch (180:7): [True: 17.5M, False: 299k]
  ------------------
  181|  17.5M|    {
  182|       |      /* We only need to clear the new space (this is a nop if the
  183|       |         limb space is already of the correct size. */
  184|  75.9M|      for (i=a->nlimbs; i < a->alloced; i++)
  ------------------
  |  Branch (184:25): [True: 58.4M, False: 17.5M]
  ------------------
  185|  58.4M|        a->d[i] = 0;
  186|  17.5M|      return;
  187|  17.5M|    }
  188|       |
  189|       |  /* Actually resize the limb space.  */
  190|   299k|  if (a->d)
  ------------------
  |  Branch (190:7): [True: 137k, False: 161k]
  ------------------
  191|   137k|    {
  192|   137k|      a->d = xrealloc (a->d, nlimbs * sizeof (mpi_limb_t));
  ------------------
  |  |  148|   137k|#define xrealloc(a,b)    _gcry_xrealloc ((a),(b))
  ------------------
  193|   623k|      for (i=a->nlimbs; i < nlimbs; i++)
  ------------------
  |  Branch (193:25): [True: 486k, False: 137k]
  ------------------
  194|   486k|        a->d[i] = 0;
  195|   137k|    }
  196|   161k|  else
  197|   161k|    {
  198|   161k|      if (a->flags & 1)
  ------------------
  |  Branch (198:11): [True: 0, False: 161k]
  ------------------
  199|       |	/* Secure memory is wanted.  */
  200|      0|	a->d = xcalloc_secure (nlimbs , sizeof (mpi_limb_t));
  ------------------
  |  |  147|      0|#define xcalloc_secure(a,b) _gcry_xcalloc_secure ((a),(b))
  ------------------
  201|   161k|      else
  202|       |	/* Standard memory.  */
  203|   161k|	a->d = xcalloc (nlimbs , sizeof (mpi_limb_t));
  ------------------
  |  |  145|   161k|#define xcalloc(a,b)     _gcry_xcalloc ((a),(b))
  ------------------
  204|   161k|    }
  205|   299k|  a->alloced = nlimbs;
  206|   299k|}
_gcry_mpi_free:
  223|  6.45M|{
  224|  6.45M|  if (!a )
  ------------------
  |  Branch (224:7): [True: 214k, False: 6.23M]
  ------------------
  225|   214k|    return;
  226|  6.23M|  if ((a->flags & 32))
  ------------------
  |  Branch (226:7): [True: 0, False: 6.23M]
  ------------------
  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|  6.23M|  if ((a->flags & 4))
  ------------------
  |  Branch (233:7): [True: 112k, False: 6.12M]
  ------------------
  234|   112k|    xfree( a->d );
  ------------------
  |  |  150|   112k|#define xfree(a)         _gcry_free ((a))
  ------------------
  235|  6.12M|  else
  236|  6.12M|    {
  237|  6.12M|      _gcry_mpi_free_limb_space(a->d, a->alloced);
  238|  6.12M|    }
  239|       |  /* Check that the flags makes sense.  We better allow for bit 1
  240|       |     (value 2) for backward ABI compatibility.  */
  241|  6.23M|  if ((a->flags & ~(1|2|4|16
  ------------------
  |  Branch (241:7): [True: 0, False: 6.23M]
  ------------------
  242|  6.23M|                    |GCRYMPI_FLAG_USER1
  243|  6.23M|                    |GCRYMPI_FLAG_USER2
  244|  6.23M|                    |GCRYMPI_FLAG_USER3
  245|  6.23M|                    |GCRYMPI_FLAG_USER4)))
  246|      0|    log_bug("invalid flag value in mpi_free\n");
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  247|  6.23M|  xfree (a);
  ------------------
  |  |  150|  6.23M|#define xfree(a)         _gcry_free ((a))
  ------------------
  248|  6.23M|}
_gcry_mpi_set_opaque:
  281|   113k|{
  282|   113k|  if (!a)
  ------------------
  |  Branch (282:7): [True: 96.2k, False: 17.4k]
  ------------------
  283|  96.2k|    a = mpi_alloc(0);
  ------------------
  |  |   97|  96.2k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  284|       |
  285|   113k|  if (mpi_is_immutable (a))
  ------------------
  |  |  113|   113k|#define mpi_is_immutable(a)   ((a)->flags&16)
  |  |  ------------------
  |  |  |  Branch (113:31): [True: 0, False: 113k]
  |  |  ------------------
  ------------------
  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|   113k|  if( a->flags & 4 )
  ------------------
  |  Branch (291:7): [True: 944, False: 112k]
  ------------------
  292|    944|    xfree (a->d);
  ------------------
  |  |  150|    944|#define xfree(a)         _gcry_free ((a))
  ------------------
  293|   112k|  else
  294|   112k|    _gcry_mpi_free_limb_space (a->d, a->alloced);
  295|       |
  296|   113k|  a->d = p;
  297|   113k|  a->alloced = 0;
  298|   113k|  a->nlimbs = 0;
  299|   113k|  a->sign  = nbits;
  300|   113k|  a->flags = 4 | (a->flags & (GCRYMPI_FLAG_USER1|GCRYMPI_FLAG_USER2
  301|   113k|                              |GCRYMPI_FLAG_USER3|GCRYMPI_FLAG_USER4));
  302|   113k|  if (_gcry_is_secure (a->d))
  ------------------
  |  Branch (302:7): [True: 0, False: 113k]
  ------------------
  303|      0|    a->flags |= 1;
  304|   113k|  return a;
  305|   113k|}
_gcry_mpi_set_opaque_copy:
  310|  9.94k|{
  311|  9.94k|  void *d;
  312|  9.94k|  unsigned int n;
  313|       |
  314|  9.94k|  n = (nbits+7)/8;
  315|  9.94k|  d = _gcry_is_secure (p)? xtrymalloc_secure (n) : xtrymalloc (n);
  ------------------
  |  |  140|      0|#define xtrymalloc_secure(a)   _gcry_malloc_secure ((a))
  ------------------
                d = _gcry_is_secure (p)? xtrymalloc_secure (n) : xtrymalloc (n);
  ------------------
  |  |  138|  19.8k|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  |  Branch (315:7): [True: 0, False: 9.94k]
  ------------------
  316|  9.94k|  if (!d)
  ------------------
  |  Branch (316:7): [True: 0, False: 9.94k]
  ------------------
  317|      0|    return NULL;
  318|  9.94k|  memcpy (d, p, n);
  319|  9.94k|  return mpi_set_opaque (a, d, nbits);
  ------------------
  |  |  561|  9.94k|#define mpi_set_opaque(a,b,c)  _gcry_mpi_set_opaque ((a), (b), (c))
  ------------------
  320|  9.94k|}
_gcry_mpi_get_opaque:
  325|   117k|{
  326|   117k|    if( !(a->flags & 4) )
  ------------------
  |  Branch (326:9): [True: 0, False: 117k]
  ------------------
  327|      0|	log_bug("mpi_get_opaque on normal mpi\n");
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  328|   117k|    if( nbits )
  ------------------
  |  Branch (328:9): [True: 117k, False: 0]
  ------------------
  329|   117k|	*nbits = a->sign;
  330|   117k|    return a->d;
  331|   117k|}
_gcry_mpi_get_opaque_copy:
  336|  4.59k|{
  337|  4.59k|  const void *s;
  338|  4.59k|  void *d;
  339|  4.59k|  unsigned int n;
  340|       |
  341|  4.59k|  s = mpi_get_opaque (a, nbits);
  ------------------
  |  |  562|  4.59k|#define mpi_get_opaque(a,b)    _gcry_mpi_get_opaque ((a), (b))
  ------------------
  342|  4.59k|  if (!s && nbits)
  ------------------
  |  Branch (342:7): [True: 0, False: 4.59k]
  |  Branch (342:13): [True: 0, False: 0]
  ------------------
  343|      0|    return NULL;
  344|  4.59k|  n = (*nbits+7)/8;
  345|  4.59k|  d = _gcry_is_secure (s)? xtrymalloc_secure (n) : xtrymalloc (n);
  ------------------
  |  |  140|      0|#define xtrymalloc_secure(a)   _gcry_malloc_secure ((a))
  ------------------
                d = _gcry_is_secure (s)? xtrymalloc_secure (n) : xtrymalloc (n);
  ------------------
  |  |  138|  9.18k|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  |  Branch (345:7): [True: 0, False: 4.59k]
  ------------------
  346|  4.59k|  if (d)
  ------------------
  |  Branch (346:7): [True: 4.59k, False: 0]
  ------------------
  347|  4.59k|    memcpy (d, s, n);
  348|  4.59k|  return d;
  349|  4.59k|}
_gcry_mpi_copy:
  357|  5.65M|{
  358|  5.65M|    int i;
  359|  5.65M|    gcry_mpi_t b;
  360|       |
  361|  5.65M|    if( a && (a->flags & 4) ) {
  ------------------
  |  Branch (361:9): [True: 5.65M, False: 60]
  |  Branch (361:14): [True: 154, False: 5.65M]
  ------------------
  362|    154|        void *p = NULL;
  363|    154|        if (a->sign) {
  ------------------
  |  Branch (363:13): [True: 154, False: 0]
  ------------------
  364|    154|            p = _gcry_is_secure(a->d)? xmalloc_secure ((a->sign+7)/8)
  ------------------
  |  |  146|      0|#define xmalloc_secure(a)   _gcry_xmalloc_secure ((a))
  ------------------
  |  Branch (364:17): [True: 0, False: 154]
  ------------------
  365|    154|                                     : xmalloc ((a->sign+7)/8);
  ------------------
  |  |  144|    308|#define xmalloc(a)       _gcry_xmalloc ((a))
  ------------------
  366|    154|            if (a->d)
  ------------------
  |  Branch (366:17): [True: 154, False: 0]
  ------------------
  367|    154|                memcpy( p, a->d, (a->sign+7)/8 );
  368|    154|        }
  369|    154|        b = mpi_set_opaque( NULL, p, a->sign );
  ------------------
  |  |  561|    154|#define mpi_set_opaque(a,b,c)  _gcry_mpi_set_opaque ((a), (b), (c))
  ------------------
  370|    154|        b->flags = a->flags;
  371|    154|        b->flags &= ~(16|32); /* Reset the immutable and constant flags.  */
  372|    154|    }
  373|  5.65M|    else if( a ) {
  ------------------
  |  Branch (373:14): [True: 5.65M, False: 60]
  ------------------
  374|  5.65M|	b = mpi_is_secure(a)? mpi_alloc_secure( a->nlimbs )
  ------------------
  |  |  115|  5.65M|#define mpi_is_secure(a)      ((a) && ((a)->flags&1))
  |  |  ------------------
  |  |  |  Branch (115:32): [True: 5.65M, False: 0]
  |  |  |  Branch (115:39): [True: 0, False: 5.65M]
  |  |  ------------------
  ------------------
              	b = mpi_is_secure(a)? mpi_alloc_secure( a->nlimbs )
  ------------------
  |  |   98|      0|# define mpi_alloc_secure(n)  _gcry_mpi_alloc_secure((n) )
  ------------------
  375|  5.65M|			    : mpi_alloc( a->nlimbs );
  ------------------
  |  |   97|  11.3M|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  376|  5.65M|	b->nlimbs = a->nlimbs;
  377|  5.65M|	b->sign = a->sign;
  378|  5.65M|	b->flags  = a->flags;
  379|  5.65M|        b->flags &= ~(16|32); /* Reset the immutable and constant flags.  */
  380|  35.1M|	for(i=0; i < b->nlimbs; i++ )
  ------------------
  |  Branch (380:11): [True: 29.4M, False: 5.65M]
  ------------------
  381|  29.4M|	    b->d[i] = a->d[i];
  382|  5.65M|    }
  383|     60|    else
  384|     60|	b = NULL;
  385|  5.65M|    return b;
  386|  5.65M|}
_gcry_mpi_alloc_like:
  437|  93.7k|{
  438|  93.7k|    gcry_mpi_t b;
  439|       |
  440|  93.7k|    if( a && (a->flags & 4) ) {
  ------------------
  |  Branch (440:9): [True: 93.7k, False: 0]
  |  Branch (440:14): [True: 0, False: 93.7k]
  ------------------
  441|      0|	int n = (a->sign+7)/8;
  442|      0|	void *p = _gcry_is_secure(a->d)? xtrymalloc_secure (n)
  ------------------
  |  |  140|      0|#define xtrymalloc_secure(a)   _gcry_malloc_secure ((a))
  ------------------
  |  Branch (442:12): [True: 0, False: 0]
  ------------------
  443|      0|                                       : xtrymalloc (n);
  ------------------
  |  |  138|      0|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  444|      0|	memcpy( p, a->d, n );
  445|      0|	b = mpi_set_opaque( NULL, p, a->sign );
  ------------------
  |  |  561|      0|#define mpi_set_opaque(a,b,c)  _gcry_mpi_set_opaque ((a), (b), (c))
  ------------------
  446|      0|    }
  447|  93.7k|    else if( a ) {
  ------------------
  |  Branch (447:14): [True: 93.7k, False: 0]
  ------------------
  448|  93.7k|	b = mpi_is_secure(a)? mpi_alloc_secure( a->nlimbs )
  ------------------
  |  |  115|  93.7k|#define mpi_is_secure(a)      ((a) && ((a)->flags&1))
  |  |  ------------------
  |  |  |  Branch (115:32): [True: 93.7k, False: 0]
  |  |  |  Branch (115:39): [True: 0, False: 93.7k]
  |  |  ------------------
  ------------------
              	b = mpi_is_secure(a)? mpi_alloc_secure( a->nlimbs )
  ------------------
  |  |   98|      0|# define mpi_alloc_secure(n)  _gcry_mpi_alloc_secure((n) )
  ------------------
  449|  93.7k|			    : mpi_alloc( a->nlimbs );
  ------------------
  |  |   97|   187k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  450|  93.7k|	b->nlimbs = 0;
  451|  93.7k|	b->sign = 0;
  452|  93.7k|	b->flags = a->flags;
  453|  93.7k|    }
  454|      0|    else
  455|      0|	b = NULL;
  456|  93.7k|    return b;
  457|  93.7k|}
_gcry_mpi_snatch:
  463|  21.8k|{
  464|  21.8k|  if (w)
  ------------------
  |  Branch (464:7): [True: 21.8k, False: 0]
  ------------------
  465|  21.8k|    {
  466|  21.8k|      if (mpi_is_immutable (w))
  ------------------
  |  |  113|  21.8k|#define mpi_is_immutable(a)   ((a)->flags&16)
  |  |  ------------------
  |  |  |  Branch (113:31): [True: 0, False: 21.8k]
  |  |  ------------------
  ------------------
  467|      0|        {
  468|      0|          mpi_immutable_failed ();
  ------------------
  |  |  110|      0|#define mpi_immutable_failed() _gcry_mpi_immutable_failed ()
  ------------------
  469|      0|          return;
  470|      0|        }
  471|  21.8k|      _gcry_mpi_assign_limb_space (w, u->d, u->alloced);
  472|  21.8k|      w->nlimbs = u->nlimbs;
  473|  21.8k|      w->sign   = u->sign;
  474|  21.8k|      w->flags  = u->flags;
  475|  21.8k|      u->alloced = 0;
  476|  21.8k|      u->nlimbs = 0;
  477|  21.8k|      u->d = NULL;
  478|  21.8k|    }
  479|  21.8k|  _gcry_mpi_free (u);
  480|  21.8k|}
_gcry_mpi_set:
  485|  1.43M|{
  486|  1.43M|  mpi_ptr_t wp, up;
  487|  1.43M|  mpi_size_t usize = u->nlimbs;
  488|  1.43M|  int usign = u->sign;
  489|       |
  490|  1.43M|  if (!w)
  ------------------
  |  Branch (490:7): [True: 0, False: 1.43M]
  ------------------
  491|      0|    w = _gcry_mpi_alloc( mpi_get_nlimbs(u) );
  ------------------
  |  |   80|      0|#define mpi_get_nlimbs(a)     ((a)->nlimbs)
  ------------------
  492|  1.43M|  if (mpi_is_immutable (w))
  ------------------
  |  |  113|  1.43M|#define mpi_is_immutable(a)   ((a)->flags&16)
  |  |  ------------------
  |  |  |  Branch (113:31): [True: 0, False: 1.43M]
  |  |  ------------------
  ------------------
  493|      0|    {
  494|      0|      mpi_immutable_failed ();
  ------------------
  |  |  110|      0|#define mpi_immutable_failed() _gcry_mpi_immutable_failed ()
  ------------------
  495|      0|      return w;
  496|      0|    }
  497|  1.43M|  RESIZE_IF_NEEDED(w, usize);
  ------------------
  |  |   78|  1.43M|    do {			   \
  |  |   79|  1.43M|	if( (a)->alloced < (b) )   \
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 63.4k, False: 1.37M]
  |  |  ------------------
  |  |   80|  1.43M|	    mpi_resize((a), (b));  \
  |  |  ------------------
  |  |  |  |  100|  63.4k|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  |  |  ------------------
  |  |   81|  1.43M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (81:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  498|  1.43M|  wp = w->d;
  499|  1.43M|  up = u->d;
  500|  1.43M|  MPN_COPY( wp, up, usize );
  ------------------
  |  |   90|  1.43M|    do {				\
  |  |   91|  1.43M|	mpi_size_t _i;			\
  |  |   92|  8.78M|	for( _i = 0; _i < (n); _i++ )	\
  |  |  ------------------
  |  |  |  Branch (92:15): [True: 7.34M, False: 1.43M]
  |  |  ------------------
  |  |   93|  7.34M|	    (d)[_i] = (s)[_i];		\
  |  |   94|  1.43M|    } while(0)
  |  |  ------------------
  |  |  |  Branch (94:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  501|  1.43M|  w->nlimbs = usize;
  502|  1.43M|  w->flags = u->flags;
  503|  1.43M|  w->flags &= ~(16|32); /* Reset the immutable and constant flags.  */
  504|  1.43M|  w->sign = usign;
  505|  1.43M|  return w;
  506|  1.43M|}
_gcry_mpi_set_cond:
  515|  16.4M|{
  516|  16.4M|  mpi_size_t i;
  517|  16.4M|  mpi_size_t nlimbs = u->alloced;
  518|  16.4M|  mpi_limb_t mask1 = vzero - set;
  519|  16.4M|  mpi_limb_t mask2 = set - vone;
  520|  16.4M|  mpi_limb_t xu;
  521|  16.4M|  mpi_limb_t xw;
  522|  16.4M|  mpi_limb_t *uu = u->d;
  523|  16.4M|  mpi_limb_t *uw = w->d;
  524|       |
  525|  16.4M|  if (w->alloced != u->alloced)
  ------------------
  |  Branch (525:7): [True: 0, False: 16.4M]
  ------------------
  526|      0|    log_bug ("mpi_set_cond: different sizes\n");
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  527|       |
  528|   126M|  for (i = 0; i < nlimbs; i++)
  ------------------
  |  Branch (528:15): [True: 110M, False: 16.4M]
  ------------------
  529|   110M|    {
  530|   110M|      xu = uu[i];
  531|   110M|      xw = uw[i];
  532|   110M|      uw[i] = (xw & mask2) | (xu & mask1);
  533|   110M|    }
  534|       |
  535|  16.4M|  xu = u->nlimbs;
  536|  16.4M|  xw = w->nlimbs;
  537|  16.4M|  w->nlimbs = (xw & mask2) | (xu & mask1);
  538|       |
  539|  16.4M|  xu = u->sign;
  540|  16.4M|  xw = w->sign;
  541|  16.4M|  w->sign = (xw & mask2) | (xu & mask1);
  542|  16.4M|  return w;
  543|  16.4M|}
_gcry_mpi_set_ui:
  548|  37.5k|{
  549|  37.5k|  if (!w)
  ------------------
  |  Branch (549:7): [True: 1, False: 37.5k]
  ------------------
  550|      1|    w = _gcry_mpi_alloc (1);
  551|       |  /* FIXME: If U is 0 we have no need to resize and thus possible
  552|       |     allocating the the limbs. */
  553|  37.5k|  if (mpi_is_immutable (w))
  ------------------
  |  |  113|  37.5k|#define mpi_is_immutable(a)   ((a)->flags&16)
  |  |  ------------------
  |  |  |  Branch (113:31): [True: 0, False: 37.5k]
  |  |  ------------------
  ------------------
  554|      0|    {
  555|      0|      mpi_immutable_failed ();
  ------------------
  |  |  110|      0|#define mpi_immutable_failed() _gcry_mpi_immutable_failed ()
  ------------------
  556|      0|      return w;
  557|      0|    }
  558|  37.5k|  RESIZE_IF_NEEDED(w, 1);
  ------------------
  |  |   78|  37.5k|    do {			   \
  |  |   79|  37.5k|	if( (a)->alloced < (b) )   \
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 34.8k, False: 2.69k]
  |  |  ------------------
  |  |   80|  37.5k|	    mpi_resize((a), (b));  \
  |  |  ------------------
  |  |  |  |  100|  34.8k|# define mpi_resize(a,b)      _gcry_mpi_resize((a),(b))
  |  |  ------------------
  |  |   81|  37.5k|    } while(0)
  |  |  ------------------
  |  |  |  Branch (81:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
  559|  37.5k|  w->d[0] = u;
  560|  37.5k|  w->nlimbs = u? 1:0;
  ------------------
  |  Branch (560:15): [True: 28.3k, False: 9.18k]
  ------------------
  561|  37.5k|  w->sign = 0;
  562|  37.5k|  w->flags = 0;
  563|  37.5k|  return w;
  564|  37.5k|}
_gcry_mpi_alloc_set_ui:
  592|  9.99k|{
  593|  9.99k|    gcry_mpi_t w = mpi_alloc(1);
  ------------------
  |  |   97|  9.99k|# define mpi_alloc(n)	       _gcry_mpi_alloc((n) )
  ------------------
  594|  9.99k|    w->d[0] = u;
  595|  9.99k|    w->nlimbs = u? 1:0;
  ------------------
  |  Branch (595:17): [True: 9.99k, False: 1]
  ------------------
  596|  9.99k|    w->sign = 0;
  597|  9.99k|    return w;
  598|  9.99k|}
_gcry_mpi_new:
  672|   200k|{
  673|   200k|    return _gcry_mpi_alloc ( (nbits+BITS_PER_MPI_LIMB-1)
  ------------------
  |  |   49|   200k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|   200k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|   200k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  674|   200k|                             / BITS_PER_MPI_LIMB );
  ------------------
  |  |   49|   200k|#define BITS_PER_MPI_LIMB    (8*BYTES_PER_MPI_LIMB)
  |  |  ------------------
  |  |  |  |    4|   200k|#define BYTES_PER_MPI_LIMB  (SIZEOF_UNSIGNED_LONG_LONG)
  |  |  |  |  ------------------
  |  |  |  |  |  |  524|   200k|#define SIZEOF_UNSIGNED_LONG_LONG 8
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  675|   200k|}
_gcry_mpi_release:
  687|   429k|{
  688|   429k|    _gcry_mpi_free( a );
  689|   429k|}
_gcry_mpi_set_flag:
  721|  22.3k|{
  722|  22.3k|  switch (flag)
  723|  22.3k|    {
  724|      0|    case GCRYMPI_FLAG_SECURE:     mpi_set_secure(a); break;
  ------------------
  |  Branch (724:5): [True: 0, False: 22.3k]
  ------------------
  725|      0|    case GCRYMPI_FLAG_CONST:      a->flags |= (16|32); break;
  ------------------
  |  Branch (725:5): [True: 0, False: 22.3k]
  ------------------
  726|      0|    case GCRYMPI_FLAG_IMMUTABLE:  a->flags |= 16; break;
  ------------------
  |  Branch (726:5): [True: 0, False: 22.3k]
  ------------------
  727|       |
  728|  1.86k|    case GCRYMPI_FLAG_USER1:
  ------------------
  |  Branch (728:5): [True: 1.86k, False: 20.4k]
  ------------------
  729|  22.3k|    case GCRYMPI_FLAG_USER2:
  ------------------
  |  Branch (729:5): [True: 20.4k, False: 1.86k]
  ------------------
  730|  22.3k|    case GCRYMPI_FLAG_USER3:
  ------------------
  |  Branch (730:5): [True: 0, False: 22.3k]
  ------------------
  731|  22.3k|    case GCRYMPI_FLAG_USER4:      a->flags |= flag; break;
  ------------------
  |  Branch (731:5): [True: 0, False: 22.3k]
  ------------------
  732|       |
  733|      0|    case GCRYMPI_FLAG_OPAQUE:
  ------------------
  |  Branch (733:5): [True: 0, False: 22.3k]
  ------------------
  734|      0|    default: log_bug("invalid flag value\n");
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  |  Branch (734:5): [True: 0, False: 22.3k]
  ------------------
  735|  22.3k|    }
  736|  22.3k|}
_gcry_mpi_get_flag:
  766|   421k|{
  767|   421k|  switch (flag)
  768|   421k|    {
  769|  72.0k|    case GCRYMPI_FLAG_SECURE:    return !!(a->flags & 1);
  ------------------
  |  Branch (769:5): [True: 72.0k, False: 349k]
  ------------------
  770|   322k|    case GCRYMPI_FLAG_OPAQUE:    return !!(a->flags & 4);
  ------------------
  |  Branch (770:5): [True: 322k, False: 98.6k]
  ------------------
  771|      0|    case GCRYMPI_FLAG_IMMUTABLE: return !!(a->flags & 16);
  ------------------
  |  Branch (771:5): [True: 0, False: 421k]
  ------------------
  772|      0|    case GCRYMPI_FLAG_CONST:     return !!(a->flags & 32);
  ------------------
  |  Branch (772:5): [True: 0, False: 421k]
  ------------------
  773|      0|    case GCRYMPI_FLAG_USER1:
  ------------------
  |  Branch (773:5): [True: 0, False: 421k]
  ------------------
  774|  26.5k|    case GCRYMPI_FLAG_USER2:
  ------------------
  |  Branch (774:5): [True: 26.5k, False: 394k]
  ------------------
  775|  26.5k|    case GCRYMPI_FLAG_USER3:
  ------------------
  |  Branch (775:5): [True: 0, False: 421k]
  ------------------
  776|  26.5k|    case GCRYMPI_FLAG_USER4:     return !!(a->flags & flag);
  ------------------
  |  Branch (776:5): [True: 0, False: 421k]
  ------------------
  777|      0|    default: log_bug("invalid flag value\n");
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  |  Branch (777:5): [True: 0, False: 421k]
  ------------------
  778|   421k|    }
  779|       |  /*NOTREACHED*/
  780|      0|  return 0;
  781|   421k|}
_gcry_mpi_const:
  789|  4.49M|{
  790|  4.49M|  if ((int)no < 0 || no > MPI_NUMBER_OF_CONSTANTS)
  ------------------
  |  |  144|  4.49M|#define MPI_NUMBER_OF_CONSTANTS 6
  ------------------
  |  Branch (790:7): [True: 0, False: 4.49M]
  |  Branch (790:22): [True: 0, False: 4.49M]
  ------------------
  791|      0|    log_bug("invalid mpi_const selector %d\n", no);
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  792|  4.49M|  if (!constants[no])
  ------------------
  |  Branch (792:7): [True: 0, False: 4.49M]
  ------------------
  793|      0|    log_bug("MPI subsystem not initialized\n");
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  794|  4.49M|  return constants[no];
  795|  4.49M|}

_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|   132k|{
 1297|   132k|  initialize_basics ();
 1298|       |
 1299|   132k|  lock_pool ();
 1300|   132k|  if (rndpool)
  ------------------
  |  Branch (1300:7): [True: 132k, False: 4]
  ------------------
 1301|   132k|    {
 1302|       |      /* Yes, we are fully initialized. */
 1303|   132k|      do_fast_random_poll ();
 1304|   132k|    }
 1305|   132k|  unlock_pool ();
 1306|   132k|}
random-csprng.c:initialize_basics:
  234|   132k|{
  235|   132k|  static int initialized;
  236|       |
  237|   132k|  if (!initialized)
  ------------------
  |  Branch (237:7): [True: 1, False: 132k]
  ------------------
  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|   132k|}
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|   132k|{
  253|   132k|  int err;
  254|       |
  255|   132k|  err = gpgrt_lock_lock (&pool_lock);
  256|   132k|  if (err)
  ------------------
  |  Branch (256:7): [True: 0, False: 132k]
  ------------------
  257|      0|    log_fatal ("failed to acquire the pool lock: %s\n", gpg_strerror (err));
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
  258|   132k|  pool_is_locked = 1;
  259|   132k|}
random-csprng.c:unlock_pool:
  264|   132k|{
  265|   132k|  int err;
  266|       |
  267|   132k|  pool_is_locked = 0;
  268|   132k|  err = gpgrt_lock_unlock (&pool_lock);
  269|   132k|  if (err)
  ------------------
  |  Branch (269:7): [True: 0, False: 132k]
  ------------------
  270|      0|    log_fatal ("failed to release the pool lock: %s\n", gpg_strerror (err));
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
  271|   132k|}
random-csprng.c:mix_pool:
  540|  53.1k|{
  541|  53.1k|  static unsigned char failsafe_digest[DIGESTLEN];
  542|  53.1k|  static int failsafe_digest_valid;
  543|       |
  544|  53.1k|  unsigned char *hashbuf = pool + POOLSIZE;
  ------------------
  |  |   95|  53.1k|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|  53.1k|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|  53.1k|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
  545|  53.1k|  unsigned char *p, *pend;
  546|  53.1k|  int i, n;
  547|  53.1k|  SHA1_CONTEXT md;
  548|  53.1k|  unsigned int nburn;
  549|       |
  550|       |#if DIGESTLEN != 20
  551|       |#error must have a digest length of 20 for SHA-1
  552|       |#endif
  553|       |
  554|  53.1k|  gcry_assert (pool_is_locked);
  ------------------
  |  |  188|  53.1k|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|  53.1k|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 53.1k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|  53.1k|         : _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|  53.1k|  pend = pool + POOLSIZE;
  ------------------
  |  |   95|  53.1k|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|  53.1k|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|  53.1k|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
  559|  53.1k|  memcpy (hashbuf, pend - DIGESTLEN, DIGESTLEN);
  ------------------
  |  |   89|  53.1k|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  ------------------
                memcpy (hashbuf, pend - DIGESTLEN, DIGESTLEN);
  ------------------
  |  |   89|  53.1k|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  ------------------
  560|  53.1k|  memcpy (hashbuf+DIGESTLEN, pool, BLOCKLEN-DIGESTLEN);
  ------------------
  |  |   89|  53.1k|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  ------------------
                memcpy (hashbuf+DIGESTLEN, pool, BLOCKLEN-DIGESTLEN);
  ------------------
  |  |   88|  53.1k|#define BLOCKLEN  64   /* Hash this amount of bytes... */
  ------------------
                memcpy (hashbuf+DIGESTLEN, pool, BLOCKLEN-DIGESTLEN);
  ------------------
  |  |   89|  53.1k|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  ------------------
  561|  53.1k|  nburn = _gcry_sha1_mixblock (&md, hashbuf);
  562|  53.1k|  memcpy (pool, hashbuf, DIGESTLEN);
  ------------------
  |  |   89|  53.1k|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  ------------------
  563|       |
  564|  53.1k|  if (failsafe_digest_valid && pool == rndpool)
  ------------------
  |  Branch (564:7): [True: 53.1k, False: 1]
  |  Branch (564:32): [True: 53.1k, False: 1]
  ------------------
  565|  53.1k|    {
  566|  1.11M|      for (i=0; i < DIGESTLEN; i++)
  ------------------
  |  |   89|  1.11M|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  ------------------
  |  Branch (566:17): [True: 1.06M, False: 53.1k]
  ------------------
  567|  1.06M|        pool[i] ^= failsafe_digest[i];
  568|  53.1k|    }
  569|       |
  570|       |  /* Loop for the remaining iterations.  */
  571|  53.1k|  p = pool;
  572|  1.59M|  for (n=1; n < POOLBLOCKS; n++)
  ------------------
  |  |   91|  1.59M|#define POOLBLOCKS 30
  ------------------
  |  Branch (572:13): [True: 1.53M, False: 53.1k]
  ------------------
  573|  1.53M|    {
  574|  1.53M|      if (p + BLOCKLEN < pend)
  ------------------
  |  |   88|  1.53M|#define BLOCKLEN  64   /* Hash this amount of bytes... */
  ------------------
  |  Branch (574:11): [True: 1.43M, False: 106k]
  ------------------
  575|  1.43M|        memcpy (hashbuf, p, BLOCKLEN);
  ------------------
  |  |   88|  1.43M|#define BLOCKLEN  64   /* Hash this amount of bytes... */
  ------------------
  576|   106k|      else
  577|   106k|        {
  578|   106k|          unsigned char *pp = p;
  579|       |
  580|  6.90M|          for (i=0; i < BLOCKLEN; i++ )
  ------------------
  |  |   88|  6.90M|#define BLOCKLEN  64   /* Hash this amount of bytes... */
  ------------------
  |  Branch (580:21): [True: 6.79M, False: 106k]
  ------------------
  581|  6.79M|            {
  582|  6.79M|              if ( pp >= pend )
  ------------------
  |  Branch (582:20): [True: 106k, False: 6.69M]
  ------------------
  583|   106k|                pp = pool;
  584|  6.79M|              hashbuf[i] = *pp++;
  585|  6.79M|	    }
  586|   106k|	}
  587|       |
  588|  1.53M|      _gcry_sha1_mixblock (&md, hashbuf);
  589|  1.53M|      p += DIGESTLEN;
  ------------------
  |  |   89|  1.53M|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  ------------------
  590|  1.53M|      memcpy (p, hashbuf, DIGESTLEN);
  ------------------
  |  |   89|  1.53M|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  ------------------
  591|  1.53M|    }
  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|  53.1k|  if ( pool == rndpool)
  ------------------
  |  Branch (597:8): [True: 53.1k, False: 1]
  ------------------
  598|  53.1k|    {
  599|  53.1k|      _gcry_sha1_hash_buffer (failsafe_digest, pool, POOLSIZE);
  ------------------
  |  |   95|  53.1k|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|  53.1k|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|  53.1k|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
  600|  53.1k|      failsafe_digest_valid = 1;
  601|  53.1k|    }
  602|       |
  603|  53.1k|  _gcry_burn_stack (nburn);
  ------------------
  |  |  371|  53.1k|	do { __gcry_burn_stack (bytes); \
  |  |  372|  53.1k|	     __gcry_burn_stack_dummy (); } while(0)
  |  |  ------------------
  |  |  |  |  364|  53.1k|#define  __gcry_burn_stack_dummy() asm volatile ("":::"memory")
  |  |  ------------------
  |  |  |  Branch (372:43): [Folded - Ignored]
  |  |  ------------------
  ------------------
  604|  53.1k|}
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|   796k|{
 1099|   796k|  const unsigned char *p = buffer;
 1100|   796k|  size_t count = 0;
 1101|       |
 1102|   796k|  gcry_assert (pool_is_locked);
  ------------------
  |  |  188|   796k|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|   796k|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 796k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|   796k|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
 1103|       |
 1104|      0|  rndstats.addbytes += length;
 1105|   796k|  rndstats.naddbytes++;
 1106|  32.6M|  while (length-- )
  ------------------
  |  Branch (1106:10): [True: 31.8M, False: 796k]
  ------------------
 1107|  31.8M|    {
 1108|  31.8M|      rndpool[pool_writepos++] ^= *p++;
 1109|  31.8M|      count++;
 1110|  31.8M|      if (pool_writepos >= POOLSIZE )
  ------------------
  |  |   95|  31.8M|#define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   91|  31.8M|#define POOLBLOCKS 30
  |  |  ------------------
  |  |               #define POOLSIZE (POOLBLOCKS*DIGESTLEN)
  |  |  ------------------
  |  |  |  |   89|  31.8M|#define DIGESTLEN 20   /* ... into a digest of this length (sha-1). */
  |  |  ------------------
  ------------------
  |  Branch (1110:11): [True: 53.1k, False: 31.8M]
  ------------------
 1111|  53.1k|        {
 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|  53.1k|          if (origin >= RANDOM_ORIGIN_SLOWPOLL && !pool_filled)
  ------------------
  |  Branch (1117:15): [True: 5, False: 53.0k]
  |  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|  53.1k|          pool_writepos = 0;
 1125|  53.1k|          mix_pool(rndpool); rndstats.mixrnd++;
 1126|  53.1k|          just_mixed = !length;
 1127|  53.1k|	}
 1128|  31.8M|    }
 1129|   796k|}
random-csprng.c:do_fast_random_poll:
 1212|   132k|{
 1213|   132k|  gcry_assert (pool_is_locked);
  ------------------
  |  |  188|   132k|#define gcry_assert(expr) (LIKELY(expr)? (void)0 \
  |  |  ------------------
  |  |  |  |   85|   132k|#define LIKELY(expr)      __builtin_expect( !!(expr), 1 )
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (85:27): [True: 132k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  189|   132k|         : _gcry_assert_failed (STR(expr), __FILE__, __LINE__, __FUNCTION__))
  |  |  ------------------
  |  |  |  |  101|      0|#define STR(v) #v
  |  |  ------------------
  ------------------
 1214|       |
 1215|      0|  rndstats.fastpolls++;
 1216|       |
 1217|   132k|  if (fast_gather_fnc)
  ------------------
  |  Branch (1217:7): [True: 0, False: 132k]
  ------------------
 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|   132k|  {
 1229|   132k|    struct timeval tv;
 1230|   132k|    if( gettimeofday( &tv, NULL ) )
  ------------------
  |  Branch (1230:9): [True: 0, False: 132k]
  ------------------
 1231|      0|      BUG();
  ------------------
  |  |  187|      0|#define BUG() _gcry_bug( __FILE__ , __LINE__, __FUNCTION__ )
  ------------------
 1232|   132k|    add_randomness( &tv.tv_sec, sizeof(tv.tv_sec), RANDOM_ORIGIN_FASTPOLL );
 1233|   132k|    add_randomness( &tv.tv_usec, sizeof(tv.tv_usec), RANDOM_ORIGIN_FASTPOLL );
 1234|   132k|  }
 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|   132k|    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|   132k|    getrusage (RUSAGE_SELF, &buf );
 1260|   132k|    add_randomness( &buf, sizeof buf, RANDOM_ORIGIN_FASTPOLL );
 1261|   132k|    memset( &buf, 0, sizeof buf );
 1262|   132k|  }
 1263|       |# else /*!RUSAGE_SELF*/
 1264|       |#  ifdef __GCC__
 1265|       |#   warning There is no RUSAGE_SELF on this system
 1266|       |#  endif
 1267|       |# endif /*!RUSAGE_SELF*/
 1268|   132k|#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|   132k|  {
 1273|   132k|    time_t x = time(NULL);
 1274|   132k|    add_randomness( &x, sizeof(x), RANDOM_ORIGIN_FASTPOLL );
 1275|   132k|  }
 1276|   132k|  {
 1277|   132k|    clock_t x = clock();
 1278|   132k|    add_randomness( &x, sizeof(x), RANDOM_ORIGIN_FASTPOLL );
 1279|   132k|  }
 1280|       |
 1281|       |  /* If the system features a fast hardware RNG, read some bytes from
 1282|       |     there.  */
 1283|   132k|  _gcry_rndhw_poll_fast (add_randomness, RANDOM_ORIGIN_FASTPOLL);
 1284|   132k|}

_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|   132k|{
  448|   132k|  if (fips_mode ())
  ------------------
  |  |  449|   132k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 132k]
  |  |  ------------------
  ------------------
  449|      0|    ; /* No need for this in fips mode.  */
  450|   132k|  else if (rng_types.standard)
  ------------------
  |  Branch (450:12): [True: 0, False: 132k]
  ------------------
  451|      0|    _gcry_rngcsprng_fast_poll ();
  452|   132k|  else if (rng_types.fips)
  ------------------
  |  Branch (452:12): [True: 0, False: 132k]
  ------------------
  453|      0|    ;
  454|   132k|  else if (rng_types.system)
  ------------------
  |  Branch (454:12): [True: 0, False: 132k]
  ------------------
  455|      0|    ;
  456|   132k|  else /* default */
  457|   132k|    _gcry_rngcsprng_fast_poll ();
  458|   132k|}
_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|   132k|{
  186|   132k|  (void)add;
  187|   132k|  (void)origin;
  188|       |
  189|   132k|#ifdef USE_DRNG
  190|   132k|  if ((_gcry_get_hw_features () & HWF_INTEL_RDRAND))
  ------------------
  |  |  233|   132k|#define HWF_INTEL_RDRAND        (1 << 11)
  ------------------
  |  Branch (190:7): [True: 132k, False: 0]
  ------------------
  191|   132k|    poll_drng (add, origin, 1);
  192|   132k|#endif
  193|   132k|#ifdef USE_PADLOCK
  194|   132k|  if ((_gcry_get_hw_features () & HWF_PADLOCK_RNG))
  ------------------
  |  |  221|   132k|#define HWF_PADLOCK_RNG         (1 << 0)
  ------------------
  |  Branch (194:7): [True: 0, False: 132k]
  ------------------
  195|      0|    poll_padlock (add, origin, 1);
  196|   132k|#endif
  197|   132k|}
rndhw.c:poll_drng:
  159|   132k|{
  160|   132k|  volatile unsigned long buffer[8] __attribute__ ((aligned (8)));
  161|   132k|  unsigned int nbytes = sizeof (buffer);
  162|       |
  163|   132k|  (void)fast;
  164|       |
  165|   132k|  if (!rdrand_nlong (buffer, DIM(buffer)))
  ------------------
  |  |  104|   132k|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (165:7): [True: 0, False: 132k]
  ------------------
  166|      0|    return 0;
  167|   132k|  (*add)((void *)buffer, nbytes, origin);
  168|   132k|  return nbytes;
  169|   132k|}
rndhw.c:rdrand_nlong:
  149|   132k|{
  150|  1.19M|  while (count--)
  ------------------
  |  Branch (150:10): [True: 1.06M, False: 132k]
  ------------------
  151|  1.06M|    if (!rdrand_long(v++))
  ------------------
  |  Branch (151:9): [True: 0, False: 1.06M]
  ------------------
  152|      0|      return 0;
  153|   132k|  return 1;
  154|   132k|}
rndhw.c:rdrand_long:
  133|  1.06M|{
  134|  1.06M|  int ok;
  135|  1.06M|  asm volatile ("1: " RDRAND_LONG "\n\t"
  136|  1.06M|                "jc 2f\n\t"
  137|  1.06M|                "decl %0\n\t"
  138|  1.06M|                "jnz 1b\n\t"
  139|  1.06M|                "2:"
  140|  1.06M|                : "=r" (ok), "=a" (*v)
  141|  1.06M|                : "0" (RDRAND_RETRY_LOOPS)
  ------------------
  |  |  124|  1.06M|# define RDRAND_RETRY_LOOPS	10
  ------------------
  142|  1.06M|                : "cc", "memory");
  143|  1.06M|  return ok;
  144|  1.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|  31.9M|{
 1010|  31.9M|  void *mem = NULL;
 1011|       |
 1012|  31.9M|  do_malloc (n, 0, &mem);
 1013|       |
 1014|  31.9M|  return mem;
 1015|  31.9M|}
_gcry_is_secure:
 1036|  3.24M|{
 1037|  3.24M|  if (no_secure_memory)
  ------------------
  |  Branch (1037:7): [True: 0, False: 3.24M]
  ------------------
 1038|      0|    return 0;
 1039|  3.24M|  if (is_secure_func)
  ------------------
  |  Branch (1039:7): [True: 0, False: 3.24M]
  ------------------
 1040|      0|    return is_secure_func (a) ;
 1041|  3.24M|  return _gcry_private_is_secure (a);
 1042|  3.24M|}
_gcry_realloc:
 1071|  79.5k|{
 1072|  79.5k|  return _gcry_realloc_core (a, n, 0);
 1073|  79.5k|}
_gcry_free:
 1078|  33.7M|{
 1079|  33.7M|  int save_errno;
 1080|       |
 1081|  33.7M|  if (!p)
  ------------------
  |  Branch (1081:7): [True: 1.87M, False: 31.9M]
  ------------------
 1082|  1.87M|    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|  31.9M|  save_errno = errno;
 1088|  31.9M|  if (free_func)
  ------------------
  |  Branch (1088:7): [True: 0, False: 31.9M]
  ------------------
 1089|      0|    free_func (p);
 1090|  31.9M|  else
 1091|  31.9M|    _gcry_private_free (p);
 1092|       |
 1093|  31.9M|  if (save_errno && save_errno != errno)
  ------------------
  |  Branch (1093:7): [True: 31.9M, False: 7]
  |  Branch (1093:21): [True: 0, False: 31.9M]
  ------------------
 1094|      0|    gpg_err_set_errno (save_errno);
 1095|  31.9M|}
_gcry_calloc:
 1099|  40.5k|{
 1100|  40.5k|  size_t bytes;
 1101|  40.5k|  void *p;
 1102|       |
 1103|  40.5k|  bytes = n * m; /* size_t is unsigned so the behavior on overflow is
 1104|       |                    defined. */
 1105|  40.5k|  if (m && bytes / m != n)
  ------------------
  |  Branch (1105:7): [True: 40.5k, False: 0]
  |  Branch (1105:12): [True: 0, False: 40.5k]
  ------------------
 1106|      0|    {
 1107|      0|      gpg_err_set_errno (ENOMEM);
 1108|      0|      return NULL;
 1109|      0|    }
 1110|       |
 1111|  40.5k|  p = _gcry_malloc (bytes);
 1112|  40.5k|  if (p)
  ------------------
  |  Branch (1112:7): [True: 40.5k, False: 0]
  ------------------
 1113|  40.5k|    memset (p, 0, bytes);
 1114|  40.5k|  return p;
 1115|  40.5k|}
_gcry_strdup:
 1163|  2.30k|{
 1164|  2.30k|  return _gcry_strdup_core (string, 0);
 1165|  2.30k|}
_gcry_xmalloc:
 1169|  30.7M|{
 1170|  30.7M|  void *p;
 1171|       |
 1172|  30.7M|  while ( !(p = _gcry_malloc( n )) )
  ------------------
  |  Branch (1172:11): [True: 0, False: 30.7M]
  ------------------
 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|  30.7M|    return p;
 1182|  30.7M|}
_gcry_xrealloc:
 1186|   153k|{
 1187|   153k|  void *p;
 1188|       |
 1189|   153k|  while (!(p = _gcry_realloc_core (a, n, 1)))
  ------------------
  |  Branch (1189:10): [True: 0, False: 153k]
  ------------------
 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|   153k|    return p;
 1200|   153k|}
_gcry_xmalloc_secure:
 1204|  3.53k|{
 1205|  3.53k|  void *p;
 1206|       |
 1207|  3.53k|  while (!(p = _gcry_malloc_secure_core (n, 1)))
  ------------------
  |  Branch (1207:10): [True: 0, False: 3.53k]
  ------------------
 1208|      0|    {
 1209|      0|      if ( fips_mode ()
  ------------------
  |  |  449|      0|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1210|      0|           || !outofcore_handler
  ------------------
  |  Branch (1210:15): [True: 0, False: 0]
  ------------------
 1211|      0|           || !outofcore_handler (outofcore_handler_value, n, 1) )
  ------------------
  |  Branch (1211:15): [True: 0, False: 0]
  ------------------
 1212|      0|        {
 1213|      0|          _gcry_fatal_error (gpg_err_code_from_errno (errno),
 1214|      0|                             _("out of core in secure memory"));
  ------------------
  |  |   96|      0|#define _(a)  _gcry_gettext(a)
  ------------------
 1215|      0|	}
 1216|      0|    }
 1217|  3.53k|  return p;
 1218|  3.53k|}
_gcry_xcalloc:
 1223|   680k|{
 1224|   680k|  size_t nbytes;
 1225|   680k|  void *p;
 1226|       |
 1227|   680k|  nbytes = n * m;
 1228|   680k|  if (m && nbytes / m != n)
  ------------------
  |  Branch (1228:7): [True: 680k, False: 0]
  |  Branch (1228:12): [True: 0, False: 680k]
  ------------------
 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|   680k|  p = _gcry_xmalloc ( nbytes );
 1235|   680k|  memset ( p, 0, nbytes );
 1236|   680k|  return p;
 1237|   680k|}
_gcry_xcalloc_secure:
 1241|  3.53k|{
 1242|  3.53k|  size_t nbytes;
 1243|  3.53k|  void *p;
 1244|       |
 1245|  3.53k|  nbytes = n * m;
 1246|  3.53k|  if (m && nbytes / m != n)
  ------------------
  |  Branch (1246:7): [True: 3.53k, False: 0]
  |  Branch (1246:12): [True: 0, False: 3.53k]
  ------------------
 1247|      0|    {
 1248|      0|      gpg_err_set_errno (ENOMEM);
 1249|      0|      _gcry_fatal_error(gpg_err_code_from_errno (errno), NULL );
 1250|      0|    }
 1251|       |
 1252|  3.53k|  p = _gcry_xmalloc_secure ( nbytes );
 1253|  3.53k|  memset ( p, 0, nbytes );
 1254|  3.53k|  return p;
 1255|  3.53k|}
_gcry_xstrdup:
 1259|   188k|{
 1260|   188k|  char *p;
 1261|       |
 1262|   188k|  while ( !(p = _gcry_strdup_core (string, 1)) )
  ------------------
  |  Branch (1262:11): [True: 0, False: 188k]
  ------------------
 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|   188k|  return p;
 1277|   188k|}
_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|}
_gcry_get_debug_flag:
 1300|  75.5k|{
 1301|  75.5k|  if ( fips_mode () )
  ------------------
  |  |  449|  75.5k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 75.5k]
  |  |  ------------------
  ------------------
 1302|      0|    return 0;
 1303|  75.5k|  return (debug_flags & mask);
 1304|  75.5k|}
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|  31.9M|{
  975|  31.9M|  gcry_err_code_t err = 0;
  976|  31.9M|  void *m;
  977|       |
  978|  31.9M|  if ((flags & GCRY_ALLOC_FLAG_SECURE) && !no_secure_memory)
  ------------------
  |  |  423|  31.9M|#define GCRY_ALLOC_FLAG_SECURE (1 << 0)
  ------------------
  |  Branch (978:7): [True: 3.53k, False: 31.9M]
  |  Branch (978:43): [True: 3.53k, False: 0]
  ------------------
  979|  3.53k|    {
  980|  3.53k|      if (alloc_secure_func)
  ------------------
  |  Branch (980:11): [True: 0, False: 3.53k]
  ------------------
  981|      0|	m = (*alloc_secure_func) (n);
  982|  3.53k|      else
  983|  3.53k|	m = _gcry_private_malloc_secure (n, !!(flags & GCRY_ALLOC_FLAG_XHINT));
  ------------------
  |  |  424|  3.53k|#define GCRY_ALLOC_FLAG_XHINT  (1 << 1)  /* Called from xmalloc.  */
  ------------------
  984|  3.53k|    }
  985|  31.9M|  else
  986|  31.9M|    {
  987|  31.9M|      if (alloc_func)
  ------------------
  |  Branch (987:11): [True: 0, False: 31.9M]
  ------------------
  988|      0|	m = (*alloc_func) (n);
  989|  31.9M|      else
  990|  31.9M|	m = _gcry_private_malloc (n);
  991|  31.9M|    }
  992|       |
  993|  31.9M|  if (!m)
  ------------------
  |  Branch (993:7): [True: 8.43k, False: 31.9M]
  ------------------
  994|  8.43k|    {
  995|       |      /* Make sure that ERRNO has been set in case a user supplied
  996|       |         memory handler didn't it correctly. */
  997|  8.43k|      if (!errno)
  ------------------
  |  Branch (997:11): [True: 0, False: 8.43k]
  ------------------
  998|      0|        gpg_err_set_errno (ENOMEM);
  999|  8.43k|      err = gpg_err_code_from_errno (errno);
 1000|  8.43k|    }
 1001|  31.9M|  else
 1002|  31.9M|    *mem = m;
 1003|       |
 1004|  31.9M|  return err;
 1005|  31.9M|}
global.c:_gcry_malloc_secure_core:
 1019|  3.53k|{
 1020|  3.53k|  void *mem = NULL;
 1021|       |
 1022|  3.53k|  do_malloc (n, (GCRY_ALLOC_FLAG_SECURE | (xhint? GCRY_ALLOC_FLAG_XHINT:0)),
  ------------------
  |  |  423|  3.53k|#define GCRY_ALLOC_FLAG_SECURE (1 << 0)
  ------------------
                do_malloc (n, (GCRY_ALLOC_FLAG_SECURE | (xhint? GCRY_ALLOC_FLAG_XHINT:0)),
  ------------------
  |  |  424|  3.53k|#define GCRY_ALLOC_FLAG_XHINT  (1 << 1)  /* Called from xmalloc.  */
  ------------------
  |  Branch (1022:44): [True: 3.53k, False: 0]
  ------------------
 1023|  3.53k|             &mem);
 1024|       |
 1025|  3.53k|  return mem;
 1026|  3.53k|}
global.c:_gcry_realloc_core:
 1046|   232k|{
 1047|   232k|  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|   232k|  if (!a)
  ------------------
  |  Branch (1051:7): [True: 10.7k, False: 222k]
  ------------------
 1052|  10.7k|    return _gcry_malloc (n);
 1053|   222k|  if (!n)
  ------------------
  |  Branch (1053:7): [True: 0, False: 222k]
  ------------------
 1054|      0|    {
 1055|      0|      xfree (a);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1056|      0|      return NULL;
 1057|      0|    }
 1058|       |
 1059|   222k|  if (realloc_func)
  ------------------
  |  Branch (1059:7): [True: 0, False: 222k]
  ------------------
 1060|      0|    p = realloc_func (a, n);
 1061|   222k|  else
 1062|   222k|    p =  _gcry_private_realloc (a, n, xhint);
 1063|   222k|  if (!p && !errno)
  ------------------
  |  Branch (1063:7): [True: 0, False: 222k]
  |  Branch (1063:13): [True: 0, False: 0]
  ------------------
 1064|      0|    gpg_err_set_errno (ENOMEM);
 1065|   222k|  return p;
 1066|   222k|}
global.c:_gcry_strdup_core:
 1140|   190k|{
 1141|   190k|  char *string_cp = NULL;
 1142|   190k|  size_t string_n = 0;
 1143|       |
 1144|   190k|  string_n = strlen (string);
 1145|       |
 1146|   190k|  if (_gcry_is_secure (string))
  ------------------
  |  Branch (1146:7): [True: 0, False: 190k]
  ------------------
 1147|      0|    string_cp = _gcry_malloc_secure_core (string_n + 1, xhint);
 1148|   190k|  else
 1149|   190k|    string_cp = _gcry_malloc (string_n + 1);
 1150|       |
 1151|   190k|  if (string_cp)
  ------------------
  |  Branch (1151:7): [True: 190k, False: 0]
  ------------------
 1152|   190k|    strcpy (string_cp, string);
 1153|       |
 1154|   190k|  return string_cp;
 1155|   190k|}

_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|   453k|{
  149|   453k|  return hw_features;
  150|   453k|}
_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|  43.3k|{
  126|  43.3k|  if (log_handler)
  ------------------
  |  Branch (126:7): [True: 43.3k, False: 0]
  ------------------
  127|  43.3k|    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|  43.3k|  if ( level == GCRY_LOG_FATAL || level == GCRY_LOG_BUG )
  ------------------
  |  Branch (144:8): [True: 0, False: 43.3k]
  |  Branch (144:35): [True: 0, False: 43.3k]
  ------------------
  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|  43.3k|}
_gcry_log_debug:
  242|  43.3k|{
  243|  43.3k|    va_list arg_ptr ;
  244|       |
  245|  43.3k|    va_start( arg_ptr, fmt ) ;
  246|  43.3k|    _gcry_logv( GCRY_LOG_DEBUG, fmt, arg_ptr );
  247|  43.3k|    va_end(arg_ptr);
  248|  43.3k|}
_gcry_fast_wipememory:
  508|  17.7M|{
  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|  17.7M|#ifdef HAVE_EXPLICIT_BZERO
  520|  17.7M|  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|  17.7M|}
_gcry_fast_wipememory2:
  531|  10.6k|{
  532|       |#ifdef HAVE_EXPLICIT_MEMSET
  533|       |  explicit_memset (ptr, set, len);
  534|       |#else
  535|  10.6k|#ifdef HAVE_EXPLICIT_BZERO
  536|  10.6k|  if (set == 0)
  ------------------
  |  Branch (536:7): [True: 0, False: 10.6k]
  ------------------
  537|      0|    {
  538|      0|      explicit_bzero (ptr, len);
  539|      0|      return;
  540|      0|    }
  541|  10.6k|#endif
  542|       |
  543|  10.6k|  memset_ptr (ptr, set, len);
  544|  10.6k|#endif
  545|  10.6k|}
__gcry_burn_stack:
  550|   160k|{
  551|   160k|#ifdef HAVE_VLA
  552|       |  /* (bytes == 0 ? 1 : bytes) == (!bytes + bytes) */
  553|   160k|  unsigned int buflen = ((!bytes + bytes) + 63) & ~63;
  554|   160k|  char buf[buflen];
  555|       |
  556|   160k|  _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|   160k|}

_gcry_secmem_module_init:
  568|      1|{
  569|       |  /* Not anymore needed.  */
  570|      1|  return 0;
  571|      1|}
_gcry_secmem_malloc:
  689|  3.53k|{
  690|  3.53k|  void *p;
  691|       |
  692|  3.53k|  SECMEM_LOCK;
  ------------------
  |  |  109|  3.53k|#define SECMEM_LOCK   gpgrt_lock_lock   (&secmem_lock)
  ------------------
  693|  3.53k|  p = _gcry_secmem_malloc_internal (size, xhint);
  694|  3.53k|  SECMEM_UNLOCK;
  ------------------
  |  |  110|  3.53k|#define SECMEM_UNLOCK gpgrt_lock_unlock (&secmem_lock)
  ------------------
  695|       |
  696|  3.53k|  return p;
  697|  3.53k|}
_gcry_secmem_free:
  740|  3.53k|{
  741|  3.53k|  int mine;
  742|       |
  743|  3.53k|  if (!a)
  ------------------
  |  Branch (743:7): [True: 0, False: 3.53k]
  ------------------
  744|      0|    return 1; /* Tell caller that we handled it.  */
  745|       |
  746|  3.53k|  SECMEM_LOCK;
  ------------------
  |  |  109|  3.53k|#define SECMEM_LOCK   gpgrt_lock_lock   (&secmem_lock)
  ------------------
  747|  3.53k|  mine = _gcry_secmem_free_internal (a);
  748|  3.53k|  SECMEM_UNLOCK;
  ------------------
  |  |  110|  3.53k|#define SECMEM_UNLOCK gpgrt_lock_unlock (&secmem_lock)
  ------------------
  749|  3.53k|  return mine;
  750|  3.53k|}
_gcry_private_is_secure:
  801|  35.3M|{
  802|  35.3M|  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|  70.7M|  for (pool = &mainpool; pool; pool = pool->next)
  ------------------
  |  Branch (811:26): [True: 35.3M, False: 35.3M]
  ------------------
  812|  35.3M|    if (pool->okay && ptr_into_pool_p (pool, p))
  ------------------
  |  Branch (812:9): [True: 35.3M, False: 43.9k]
  |  Branch (812:23): [True: 3.53k, False: 35.3M]
  ------------------
  813|  3.53k|      return 1;
  814|       |
  815|  35.3M|  return 0;
  816|  35.3M|}
secmem.c:_gcry_secmem_init_internal:
  506|      1|{
  507|      1|  pooldesc_t *pool;
  508|       |
  509|      1|  pool = &mainpool;
  510|      1|  if (!n)
  ------------------
  |  Branch (510:7): [True: 0, False: 1]
  ------------------
  511|      0|    {
  512|       |#ifdef USE_CAPABILITIES
  513|       |      /* drop all capabilities */
  514|       |      if (!no_priv_drop)
  515|       |        {
  516|       |          cap_t cap;
  517|       |
  518|       |          cap = cap_from_text ("all-eip");
  519|       |          cap_set_proc (cap);
  520|       |          cap_free (cap);
  521|       |        }
  522|       |
  523|       |#elif !defined(HAVE_DOSISH_SYSTEM)
  524|      0|      uid_t uid;
  525|       |
  526|      0|      disable_secmem = 1;
  527|      0|      uid = getuid ();
  528|      0|      if (uid != geteuid ())
  ------------------
  |  Branch (528:11): [True: 0, False: 0]
  ------------------
  529|      0|	{
  530|      0|	  if (setuid (uid) || getuid () != geteuid () || !setuid (0))
  ------------------
  |  Branch (530:8): [True: 0, False: 0]
  |  Branch (530:24): [True: 0, False: 0]
  |  Branch (530:51): [True: 0, False: 0]
  ------------------
  531|      0|	    log_fatal ("failed to drop setuid\n");
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
  532|      0|	}
  533|      0|#endif
  534|      0|    }
  535|      1|  else
  536|      1|    {
  537|      1|      if (n < MINIMUM_POOL_SIZE)
  ------------------
  |  |   47|      1|#define MINIMUM_POOL_SIZE 16384
  ------------------
  |  Branch (537:11): [True: 0, False: 1]
  ------------------
  538|      0|	n = MINIMUM_POOL_SIZE;
  ------------------
  |  |   47|      0|#define MINIMUM_POOL_SIZE 16384
  ------------------
  539|      1|      if (! pool->okay)
  ------------------
  |  Branch (539:11): [True: 1, False: 0]
  ------------------
  540|      1|	{
  541|      1|	  init_pool (pool, n);
  542|      1|	  lock_pool_pages (pool->mem, n);
  543|      1|	}
  544|      0|      else
  545|      0|	log_error ("Oops, secure memory pool already initialized\n");
  ------------------
  |  |  203|      0|#define log_error   _gcry_log_error
  ------------------
  546|      1|    }
  547|      1|}
secmem.c:init_pool:
  370|      1|{
  371|      1|  memblock_t *mb;
  372|       |
  373|      1|  pool->size = n;
  374|       |
  375|      1|  if (disable_secmem)
  ------------------
  |  Branch (375:7): [True: 0, False: 1]
  ------------------
  376|      0|    log_bug ("secure memory is disabled");
  ------------------
  |  |  201|      0|#define log_bug     _gcry_log_bug
  ------------------
  377|       |
  378|       |
  379|      1|#if HAVE_MMAP
  380|      1|  {
  381|      1|    size_t pgsize;
  382|      1|    long int pgsize_val;
  383|       |
  384|      1|# if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
  385|      1|    pgsize_val = sysconf (_SC_PAGESIZE);
  386|       |# elif defined(HAVE_GETPAGESIZE)
  387|       |    pgsize_val = getpagesize ();
  388|       |# else
  389|       |    pgsize_val = -1;
  390|       |# endif
  391|      1|    pgsize = (pgsize_val > 0)? pgsize_val:DEFAULT_PAGE_SIZE;
  ------------------
  |  |   49|      1|#define DEFAULT_PAGE_SIZE 4096
  ------------------
  |  Branch (391:14): [True: 1, False: 0]
  ------------------
  392|       |
  393|      1|    pool->size = (pool->size + pgsize - 1) & ~(pgsize - 1);
  394|      1|# ifdef MAP_ANONYMOUS
  395|      1|    pool->mem = mmap (0, pool->size, PROT_READ | PROT_WRITE,
  396|      1|                     MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
  397|       |# else /* map /dev/zero instead */
  398|       |    {
  399|       |      int fd;
  400|       |
  401|       |      fd = open ("/dev/zero", O_RDWR);
  402|       |      if (fd == -1)
  403|       |        {
  404|       |          log_error ("can't open /dev/zero: %s\n", strerror (errno));
  405|       |          pool->mem = (void *) -1;
  406|       |        }
  407|       |      else
  408|       |        {
  409|       |          pool->mem = mmap (0, pool->size,
  410|       |                           (PROT_READ | PROT_WRITE), MAP_PRIVATE, fd, 0);
  411|       |          close (fd);
  412|       |        }
  413|       |    }
  414|       |# endif
  415|      1|    if (pool->mem == (void *) -1)
  ------------------
  |  Branch (415:9): [True: 0, False: 1]
  ------------------
  416|      0|      log_info ("can't mmap pool of %u bytes: %s - using malloc\n",
  ------------------
  |  |  204|      0|#define log_info    _gcry_log_info
  ------------------
  417|      0|                (unsigned) pool->size, strerror (errno));
  418|      1|    else
  419|      1|      {
  420|      1|        pool->is_mmapped = 1;
  421|      1|        pool->okay = 1;
  422|      1|      }
  423|      1|  }
  424|      1|#endif /*HAVE_MMAP*/
  425|       |
  426|      1|  if (!pool->okay)
  ------------------
  |  Branch (426:7): [True: 0, False: 1]
  ------------------
  427|      0|    {
  428|      0|      pool->mem = malloc (pool->size);
  429|      0|      if (!pool->mem)
  ------------------
  |  Branch (429:11): [True: 0, False: 0]
  ------------------
  430|      0|	log_fatal ("can't allocate memory pool of %u bytes\n",
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
  431|      0|		   (unsigned) pool->size);
  432|      0|      else
  433|      0|	pool->okay = 1;
  434|      0|    }
  435|       |
  436|       |  /* Initialize first memory block.  */
  437|      1|  mb = (memblock_t *) pool->mem;
  438|      1|  mb->size = pool->size - BLOCK_HEAD_SIZE;
  ------------------
  |  |  115|      1|  offsetof (memblock_t, aligned)
  ------------------
  439|      1|  mb->flags = 0;
  440|      1|}
secmem.c:lock_pool_pages:
  291|      1|{
  292|      1|#if defined(HAVE_MLOCK)
  293|      1|  uid_t uid;
  294|      1|  int err;
  295|       |
  296|      1|  uid = getuid ();
  297|       |
  298|       |#ifdef HAVE_BROKEN_MLOCK
  299|       |  /* Under HP/UX mlock segfaults if called by non-root.  Note, we have
  300|       |     noch checked whether mlock does really work under AIX where we
  301|       |     also detected a broken nlock.  Note further, that using plock ()
  302|       |     is not a good idea under AIX. */
  303|       |  if (uid)
  304|       |    {
  305|       |      errno = EPERM;
  306|       |      err = -1;
  307|       |    }
  308|       |  else
  309|       |    {
  310|       |      err = no_mlock? 0 : mlock (p, n);
  311|       |    }
  312|       |#else /* !HAVE_BROKEN_MLOCK */
  313|      1|  err = no_mlock? 0 : mlock (p, n);
  ------------------
  |  Branch (313:9): [True: 0, False: 1]
  ------------------
  314|      1|#endif /* !HAVE_BROKEN_MLOCK */
  315|       |
  316|       |  /* Test whether we are running setuid(0).  */
  317|      1|  if (uid && ! geteuid ())
  ------------------
  |  Branch (317:7): [True: 0, False: 1]
  |  Branch (317:14): [True: 0, False: 0]
  ------------------
  318|      0|    {
  319|       |      /* Yes, we are.  */
  320|      0|      if (!no_priv_drop)
  ------------------
  |  Branch (320:11): [True: 0, False: 0]
  ------------------
  321|      0|        {
  322|       |          /* Check that we really dropped the privs.
  323|       |           * Note: setuid(0) should always fail */
  324|      0|          if (setuid (uid) || getuid () != geteuid () || !setuid (0))
  ------------------
  |  Branch (324:15): [True: 0, False: 0]
  |  Branch (324:31): [True: 0, False: 0]
  |  Branch (324:58): [True: 0, False: 0]
  ------------------
  325|      0|            log_fatal ("failed to reset uid: %s\n", strerror (errno));
  ------------------
  |  |  202|      0|#define log_fatal   _gcry_log_fatal
  ------------------
  326|      0|        }
  327|      0|    }
  328|       |
  329|      1|  if (err)
  ------------------
  |  Branch (329:7): [True: 0, False: 1]
  ------------------
  330|      0|    {
  331|      0|      if (errno != EPERM
  ------------------
  |  Branch (331:11): [True: 0, False: 0]
  ------------------
  332|      0|#ifdef EAGAIN	/* BSD and also Linux may return this. */
  333|      0|	  && errno != EAGAIN
  ------------------
  |  Branch (333:7): [True: 0, False: 0]
  ------------------
  334|      0|#endif
  335|      0|#ifdef ENOSYS	/* Some SCOs return this (function not implemented). */
  336|      0|	  && errno != ENOSYS
  ------------------
  |  Branch (336:7): [True: 0, False: 0]
  ------------------
  337|      0|#endif
  338|      0|#ifdef ENOMEM  /* Linux might return this. */
  339|      0|            && errno != ENOMEM
  ------------------
  |  Branch (339:16): [True: 0, False: 0]
  ------------------
  340|      0|#endif
  341|      0|	  )
  342|      0|	log_error ("can't lock memory: %s\n", strerror (errno));
  ------------------
  |  |  203|      0|#define log_error   _gcry_log_error
  ------------------
  343|      0|      show_warning = 1;
  344|      0|      not_locked = 1;
  345|      0|    }
  346|       |
  347|       |#elif defined ( __QNX__ )
  348|       |  /* QNX does not page at all, so the whole secure memory stuff does
  349|       |   * not make much sense.  However it is still of use because it
  350|       |   * wipes out the memory on a free().
  351|       |   * Therefore it is sufficient to suppress the warning.  */
  352|       |  (void)p;
  353|       |  (void)n;
  354|       |#elif defined (HAVE_DOSISH_SYSTEM) || defined (__CYGWIN__)
  355|       |    /* It does not make sense to print such a warning, given the fact that
  356|       |     * this whole Windows !@#$% and their user base are inherently insecure. */
  357|       |  (void)p;
  358|       |  (void)n;
  359|       |#else
  360|       |  (void)p;
  361|       |  (void)n;
  362|       |  if (!no_mlock)
  363|       |    log_info ("Please note that you don't have secure memory on this system\n");
  364|       |#endif
  365|      1|}
secmem.c:_gcry_secmem_malloc_internal:
  576|  3.53k|{
  577|  3.53k|  pooldesc_t *pool;
  578|  3.53k|  memblock_t *mb;
  579|       |
  580|  3.53k|  pool = &mainpool;
  581|       |
  582|  3.53k|  if (!pool->okay)
  ------------------
  |  Branch (582:7): [True: 1, False: 3.53k]
  ------------------
  583|      1|    {
  584|       |      /* Try to initialize the pool if the user forgot about it.  */
  585|      1|      _gcry_secmem_init_internal (STANDARD_POOL_SIZE);
  ------------------
  |  |   48|      1|#define STANDARD_POOL_SIZE 32768
  ------------------
  586|      1|      if (!pool->okay)
  ------------------
  |  Branch (586:11): [True: 0, False: 1]
  ------------------
  587|      0|        {
  588|      0|          log_info (_("operation is not possible without "
  ------------------
  |  |  204|      0|#define log_info    _gcry_log_info
  ------------------
                        log_info (_("operation is not possible without "
  ------------------
  |  |   96|      0|#define _(a)  _gcry_gettext(a)
  ------------------
  589|      0|                      "initialized secure memory\n"));
  590|      0|          gpg_err_set_errno (ENOMEM);
  591|      0|          return NULL;
  592|      0|        }
  593|      1|    }
  594|  3.53k|  if (not_locked && fips_mode ())
  ------------------
  |  |  449|      0|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (449:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (594:7): [True: 0, False: 3.53k]
  ------------------
  595|      0|    {
  596|      0|      log_info (_("secure memory pool is not locked while in FIPS mode\n"));
  ------------------
  |  |  204|      0|#define log_info    _gcry_log_info
  ------------------
                    log_info (_("secure memory pool is not locked while in FIPS mode\n"));
  ------------------
  |  |   96|      0|#define _(a)  _gcry_gettext(a)
  ------------------
  597|      0|      gpg_err_set_errno (ENOMEM);
  598|      0|      return NULL;
  599|      0|    }
  600|  3.53k|  if (show_warning && !suspend_warning)
  ------------------
  |  Branch (600:7): [True: 0, False: 3.53k]
  |  Branch (600:23): [True: 0, False: 0]
  ------------------
  601|      0|    {
  602|      0|      show_warning = 0;
  603|      0|      print_warn ();
  604|      0|    }
  605|       |
  606|       |  /* Blocks are always a multiple of 32. */
  607|  3.53k|  size = ((size + 31) / 32) * 32;
  608|       |
  609|  3.53k|  mb = mb_get_new (pool, (memblock_t *) pool->mem, size);
  610|  3.53k|  if (mb)
  ------------------
  |  Branch (610:7): [True: 3.53k, False: 0]
  ------------------
  611|  3.53k|    {
  612|  3.53k|      stats_update (pool, mb->size, 0);
  613|  3.53k|      return &mb->aligned.c;
  614|  3.53k|    }
  615|       |
  616|       |  /* If we are called from xmalloc style functions resort to the
  617|       |   * overflow pools to return memory.  We don't do this in FIPS mode,
  618|       |   * though.  If the auto-expand option is active we do the expanding
  619|       |   * also for the standard malloc functions.
  620|       |   *
  621|       |   * The idea of using them by default only for the xmalloc function
  622|       |   * is so that a user can control whether memory will be allocated in
  623|       |   * the initial created mlock protected secmem area or may also be
  624|       |   * allocated from the overflow pools.  */
  625|      0|  if ((xhint || auto_expand) && !fips_mode ())
  ------------------
  |  |  449|      0|#define fips_mode() (!_gcry_no_fips_mode_required)
  ------------------
  |  Branch (625:8): [True: 0, False: 0]
  |  Branch (625:17): [True: 0, False: 0]
  |  Branch (625:33): [True: 0, False: 0]
  ------------------
  626|      0|    {
  627|       |      /* Check whether we can allocate from the overflow pools.  */
  628|      0|      for (pool = pool->next; pool; pool = pool->next)
  ------------------
  |  Branch (628:31): [True: 0, False: 0]
  ------------------
  629|      0|        {
  630|      0|          mb = mb_get_new (pool, (memblock_t *) pool->mem, size);
  631|      0|          if (mb)
  ------------------
  |  Branch (631:15): [True: 0, False: 0]
  ------------------
  632|      0|            {
  633|      0|              stats_update (pool, mb->size, 0);
  634|      0|              return &mb->aligned.c;
  635|      0|            }
  636|      0|        }
  637|       |      /* Allocate a new overflow pool.  We put a new pool right after
  638|       |       * the mainpool so that the next allocation will happen in that
  639|       |       * pool and not in one of the older pools.  When this new pool
  640|       |       * gets full we will try to find space in the older pools.  */
  641|      0|      pool = calloc (1, sizeof *pool);
  642|      0|      if (!pool)
  ------------------
  |  Branch (642:11): [True: 0, False: 0]
  ------------------
  643|      0|        return NULL;  /* Not enough memory for a new pool descriptor.  */
  644|      0|      pool->size = auto_expand? auto_expand : STANDARD_POOL_SIZE;
  ------------------
  |  |   48|      0|#define STANDARD_POOL_SIZE 32768
  ------------------
  |  Branch (644:20): [True: 0, False: 0]
  ------------------
  645|      0|      pool->mem = malloc (pool->size);
  646|      0|      if (!pool->mem)
  ------------------
  |  Branch (646:11): [True: 0, False: 0]
  ------------------
  647|      0|        {
  648|      0|          free (pool);
  649|      0|          return NULL; /* Not enough memory available for a new pool.  */
  650|      0|        }
  651|       |      /* Initialize first memory block.  */
  652|      0|      mb = (memblock_t *) pool->mem;
  653|      0|      mb->size = pool->size - BLOCK_HEAD_SIZE;
  ------------------
  |  |  115|      0|  offsetof (memblock_t, aligned)
  ------------------
  654|      0|      mb->flags = 0;
  655|       |
  656|      0|      pool->okay = 1;
  657|       |
  658|       |      /* Take care: in _gcry_private_is_secure we do not lock and thus
  659|       |       * we assume that the second assignment below is atomic.  Memory
  660|       |       * barrier prevents reordering of stores to new pool structure after
  661|       |       * MAINPOOL.NEXT assigment and prevents _gcry_private_is_secure seeing
  662|       |       * non-initialized POOL->NEXT pointers.  */
  663|      0|      pool->next = mainpool.next;
  664|      0|      memory_barrier();
  665|      0|      mainpool.next = pool;
  666|       |
  667|       |      /* After the first time we allocated an overflow pool, print a
  668|       |       * warning.  */
  669|      0|      if (!pool->next)
  ------------------
  |  Branch (669:11): [True: 0, False: 0]
  ------------------
  670|      0|        print_warn ();
  671|       |
  672|       |      /* Allocate.  */
  673|      0|      mb = mb_get_new (pool, (memblock_t *) pool->mem, size);
  674|      0|      if (mb)
  ------------------
  |  Branch (674:11): [True: 0, False: 0]
  ------------------
  675|      0|        {
  676|      0|          stats_update (pool, mb->size, 0);
  677|      0|          return &mb->aligned.c;
  678|      0|        }
  679|      0|    }
  680|       |
  681|      0|  return NULL;
  682|      0|}
secmem.c:mb_get_new:
  242|  3.53k|{
  243|  3.53k|  memblock_t *mb, *mb_split;
  244|       |
  245|  3.53k|  for (mb = block; ptr_into_pool_p (pool, mb); mb = mb_get_next (pool, mb))
  ------------------
  |  Branch (245:20): [True: 3.53k, False: 0]
  ------------------
  246|  3.53k|    if (! (mb->flags & MB_FLAG_ACTIVE) && mb->size >= size)
  ------------------
  |  |   60|  3.53k|#define MB_FLAG_ACTIVE (1 << 0)
  ------------------
  |  Branch (246:9): [True: 3.53k, False: 0]
  |  Branch (246:43): [True: 3.53k, False: 0]
  ------------------
  247|  3.53k|      {
  248|       |	/* Found a free block.  */
  249|  3.53k|	mb->flags |= MB_FLAG_ACTIVE;
  ------------------
  |  |   60|  3.53k|#define MB_FLAG_ACTIVE (1 << 0)
  ------------------
  250|       |
  251|  3.53k|	if (mb->size - size > BLOCK_HEAD_SIZE)
  ------------------
  |  |  115|  3.53k|  offsetof (memblock_t, aligned)
  ------------------
  |  Branch (251:6): [True: 3.53k, False: 0]
  ------------------
  252|  3.53k|	  {
  253|       |	    /* Split block.  */
  254|       |
  255|  3.53k|	    mb_split = (memblock_t *) (void *) (((char *) mb) + BLOCK_HEAD_SIZE
  ------------------
  |  |  115|  3.53k|  offsetof (memblock_t, aligned)
  ------------------
  256|  3.53k|						+ size);
  257|  3.53k|	    mb_split->size = mb->size - size - BLOCK_HEAD_SIZE;
  ------------------
  |  |  115|  3.53k|  offsetof (memblock_t, aligned)
  ------------------
  258|  3.53k|	    mb_split->flags = 0;
  259|       |
  260|  3.53k|	    mb->size = size;
  261|       |
  262|  3.53k|	    mb_merge (pool, mb_split);
  263|       |
  264|  3.53k|	  }
  265|       |
  266|  3.53k|	break;
  267|  3.53k|      }
  268|       |
  269|  3.53k|  if (! ptr_into_pool_p (pool, mb))
  ------------------
  |  Branch (269:7): [True: 0, False: 3.53k]
  ------------------
  270|      0|    {
  271|      0|      gpg_err_set_errno (ENOMEM);
  272|      0|      mb = NULL;
  273|      0|    }
  274|       |
  275|  3.53k|  return mb;
  276|  3.53k|}
secmem.c:mb_merge:
  224|  7.07k|{
  225|  7.07k|  memblock_t *mb_prev, *mb_next;
  226|       |
  227|  7.07k|  mb_prev = mb_get_prev (pool, mb);
  228|  7.07k|  mb_next = mb_get_next (pool, mb);
  229|       |
  230|  7.07k|  if (mb_prev && (! (mb_prev->flags & MB_FLAG_ACTIVE)))
  ------------------
  |  |   60|  3.53k|#define MB_FLAG_ACTIVE (1 << 0)
  ------------------
  |  Branch (230:7): [True: 3.53k, False: 3.53k]
  |  Branch (230:18): [True: 0, False: 3.53k]
  ------------------
  231|      0|    {
  232|      0|      mb_prev->size += BLOCK_HEAD_SIZE + mb->size;
  ------------------
  |  |  115|      0|  offsetof (memblock_t, aligned)
  ------------------
  233|      0|      mb = mb_prev;
  234|      0|    }
  235|  7.07k|  if (mb_next && (! (mb_next->flags & MB_FLAG_ACTIVE)))
  ------------------
  |  |   60|  3.53k|#define MB_FLAG_ACTIVE (1 << 0)
  ------------------
  |  Branch (235:7): [True: 3.53k, False: 3.53k]
  |  Branch (235:18): [True: 3.53k, False: 0]
  ------------------
  236|  3.53k|    mb->size += BLOCK_HEAD_SIZE + mb_next->size;
  ------------------
  |  |  115|  3.53k|  offsetof (memblock_t, aligned)
  ------------------
  237|  7.07k|}
secmem.c:mb_get_prev:
  199|  7.07k|{
  200|  7.07k|  memblock_t *mb_prev, *mb_next;
  201|       |
  202|  7.07k|  if (mb == pool->mem)
  ------------------
  |  Branch (202:7): [True: 3.53k, False: 3.53k]
  ------------------
  203|  3.53k|    mb_prev = NULL;
  204|  3.53k|  else
  205|  3.53k|    {
  206|  3.53k|      mb_prev = (memblock_t *) pool->mem;
  207|  3.53k|      while (1)
  ------------------
  |  Branch (207:14): [Folded - Ignored]
  ------------------
  208|  3.53k|	{
  209|  3.53k|	  mb_next = mb_get_next (pool, mb_prev);
  210|  3.53k|	  if (mb_next == mb)
  ------------------
  |  Branch (210:8): [True: 3.53k, False: 0]
  ------------------
  211|  3.53k|	    break;
  212|      0|	  else
  213|      0|	    mb_prev = mb_next;
  214|  3.53k|	}
  215|  3.53k|    }
  216|       |
  217|  7.07k|  return mb_prev;
  218|  7.07k|}
secmem.c:mb_get_next:
  184|  10.6k|{
  185|  10.6k|  memblock_t *mb_next;
  186|       |
  187|  10.6k|  mb_next = (memblock_t *) (void *) ((char *) mb + BLOCK_HEAD_SIZE + mb->size);
  ------------------
  |  |  115|  10.6k|  offsetof (memblock_t, aligned)
  ------------------
  188|       |
  189|  10.6k|  if (! ptr_into_pool_p (pool, mb_next))
  ------------------
  |  Branch (189:7): [True: 3.53k, False: 7.07k]
  ------------------
  190|  3.53k|    mb_next = NULL;
  191|       |
  192|  10.6k|  return mb_next;
  193|  10.6k|}
secmem.c:stats_update:
  168|  7.07k|{
  169|  7.07k|  if (add)
  ------------------
  |  Branch (169:7): [True: 3.53k, False: 3.53k]
  ------------------
  170|  3.53k|    {
  171|  3.53k|      pool->cur_alloced += add;
  172|  3.53k|      pool->cur_blocks++;
  173|  3.53k|    }
  174|  7.07k|  if (sub)
  ------------------
  |  Branch (174:7): [True: 3.53k, False: 3.53k]
  ------------------
  175|  3.53k|    {
  176|  3.53k|      pool->cur_alloced -= sub;
  177|  3.53k|      pool->cur_blocks--;
  178|  3.53k|    }
  179|  7.07k|}
secmem.c:_gcry_secmem_free_internal:
  701|  3.53k|{
  702|  3.53k|  pooldesc_t *pool;
  703|  3.53k|  memblock_t *mb;
  704|  3.53k|  int size;
  705|       |
  706|  3.53k|  for (pool = &mainpool; pool; pool = pool->next)
  ------------------
  |  Branch (706:26): [True: 3.53k, False: 0]
  ------------------
  707|  3.53k|    if (pool->okay && ptr_into_pool_p (pool, a))
  ------------------
  |  Branch (707:9): [True: 3.53k, False: 0]
  |  Branch (707:23): [True: 3.53k, False: 0]
  ------------------
  708|  3.53k|      break;
  709|  3.53k|  if (!pool)
  ------------------
  |  Branch (709:7): [True: 0, False: 3.53k]
  ------------------
  710|      0|    return 0; /* A does not belong to use.  */
  711|       |
  712|  3.53k|  mb = ADDR_TO_BLOCK (a);
  ------------------
  |  |  119|  3.53k|  (memblock_t *) (void *) ((char *) addr - BLOCK_HEAD_SIZE)
  |  |  ------------------
  |  |  |  |  115|  3.53k|  offsetof (memblock_t, aligned)
  |  |  ------------------
  ------------------
  713|  3.53k|  size = mb->size;
  714|       |
  715|       |  /* This does not make much sense: probably this memory is held in the
  716|       |   * cache. We do it anyway: */
  717|  3.53k|#define MB_WIPE_OUT(byte) \
  718|  3.53k|  wipememory2 (((char *) mb + BLOCK_HEAD_SIZE), (byte), size)
  719|       |
  720|  3.53k|  MB_WIPE_OUT (0xff);
  ------------------
  |  |  718|  3.53k|  wipememory2 (((char *) mb + BLOCK_HEAD_SIZE), (byte), size)
  |  |  ------------------
  |  |  |  |  388|  3.53k|#define wipememory2(_ptr,_set,_len) do { \
  |  |  |  |  389|  3.53k|	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  7.07k|#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: 3.53k, False: 0]
  |  |  |  |  |  Branch (389:33): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  390|  3.53k|		if (CONSTANT_P(_set) && (_set) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  7.07k|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (87:27): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:27): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  391|  3.53k|		  _gcry_fast_wipememory((void *)(_ptr), (_len)); \
  |  |  |  |  392|  3.53k|		else \
  |  |  |  |  393|  3.53k|		  _gcry_fast_wipememory2((void *)(_ptr), (_set), (_len)); \
  |  |  |  |  394|  3.53k|	      } 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|  3.53k|	    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (397:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  721|  3.53k|  MB_WIPE_OUT (0xaa);
  ------------------
  |  |  718|  3.53k|  wipememory2 (((char *) mb + BLOCK_HEAD_SIZE), (byte), size)
  |  |  ------------------
  |  |  |  |  388|  3.53k|#define wipememory2(_ptr,_set,_len) do { \
  |  |  |  |  389|  3.53k|	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  7.07k|#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: 3.53k, False: 0]
  |  |  |  |  |  Branch (389:33): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  390|  3.53k|		if (CONSTANT_P(_set) && (_set) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  7.07k|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (87:27): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:27): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  391|  3.53k|		  _gcry_fast_wipememory((void *)(_ptr), (_len)); \
  |  |  |  |  392|  3.53k|		else \
  |  |  |  |  393|  3.53k|		  _gcry_fast_wipememory2((void *)(_ptr), (_set), (_len)); \
  |  |  |  |  394|  3.53k|	      } 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|  3.53k|	    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (397:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  722|  3.53k|  MB_WIPE_OUT (0x55);
  ------------------
  |  |  718|  3.53k|  wipememory2 (((char *) mb + BLOCK_HEAD_SIZE), (byte), size)
  |  |  ------------------
  |  |  |  |  388|  3.53k|#define wipememory2(_ptr,_set,_len) do { \
  |  |  |  |  389|  3.53k|	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  7.07k|#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: 3.53k, False: 0]
  |  |  |  |  |  Branch (389:33): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  390|  3.53k|		if (CONSTANT_P(_set) && (_set) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  7.07k|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (87:27): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:27): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  391|  3.53k|		  _gcry_fast_wipememory((void *)(_ptr), (_len)); \
  |  |  |  |  392|  3.53k|		else \
  |  |  |  |  393|  3.53k|		  _gcry_fast_wipememory2((void *)(_ptr), (_set), (_len)); \
  |  |  |  |  394|  3.53k|	      } 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|  3.53k|	    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (397:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  723|  3.53k|  MB_WIPE_OUT (0x00);
  ------------------
  |  |  718|  3.53k|  wipememory2 (((char *) mb + BLOCK_HEAD_SIZE), (byte), size)
  |  |  ------------------
  |  |  |  |  388|  3.53k|#define wipememory2(_ptr,_set,_len) do { \
  |  |  |  |  389|  3.53k|	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  7.07k|#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: 3.53k, False: 0]
  |  |  |  |  |  Branch (389:33): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  390|  3.53k|		if (CONSTANT_P(_set) && (_set) == 0) \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|  7.07k|#define CONSTANT_P(expr)  __builtin_constant_p( expr )
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (87:27): [Folded - Ignored]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (390:27): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  |  |  391|  3.53k|		  _gcry_fast_wipememory((void *)(_ptr), (_len)); \
  |  |  |  |  392|  3.53k|		else \
  |  |  |  |  393|  3.53k|		  _gcry_fast_wipememory2((void *)(_ptr), (_set), (_len)); \
  |  |  |  |  394|  3.53k|	      } 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|  3.53k|	    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (397:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  724|       |
  725|       |  /* Update stats.  */
  726|  3.53k|  stats_update (pool, 0, size);
  727|       |
  728|  3.53k|  mb->flags &= ~MB_FLAG_ACTIVE;
  ------------------
  |  |   60|  3.53k|#define MB_FLAG_ACTIVE (1 << 0)
  ------------------
  729|       |
  730|  3.53k|  mb_merge (pool, mb);
  731|       |
  732|  3.53k|  return 1; /* Freed.  */
  733|  3.53k|}
secmem.c:ptr_into_pool_p:
  154|  35.3M|{
  155|       |  /* We need to convert pointers to addresses.  This is required by
  156|       |     C-99 6.5.8 to avoid undefined behaviour.  See also
  157|       |     http://lists.gnupg.org/pipermail/gcrypt-devel/2007-February/001102.html
  158|       |  */
  159|  35.3M|  uintptr_t p_addr    = (uintptr_t)p;
  160|  35.3M|  uintptr_t pool_addr = (uintptr_t)pool->mem;
  161|       |
  162|  35.3M|  return p_addr >= pool_addr && p_addr <  pool_addr + pool->size;
  ------------------
  |  Branch (162:10): [True: 29.9k, False: 35.3M]
  |  Branch (162:33): [True: 21.2k, False: 8.73k]
  ------------------
  163|  35.3M|}

_gcry_sexp_release:
  318|   241k|{
  319|   241k|  if (sexp)
  ------------------
  |  Branch (319:7): [True: 208k, False: 33.0k]
  ------------------
  320|   208k|    {
  321|   208k|      if (_gcry_is_secure (sexp))
  ------------------
  |  Branch (321:11): [True: 0, False: 208k]
  ------------------
  322|      0|        {
  323|       |          /* Extra paranoid wiping. */
  324|      0|          const byte *p = sexp->d;
  325|      0|          int type;
  326|       |
  327|      0|          while ( (type = *p) != ST_STOP )
  ------------------
  |  |   91|      0|#define ST_STOP  0
  ------------------
  |  Branch (327:19): [True: 0, False: 0]
  ------------------
  328|      0|            {
  329|      0|              p++;
  330|      0|              switch ( type )
  331|      0|                {
  332|      0|                case ST_OPEN:
  ------------------
  |  |   94|      0|#define ST_OPEN  3
  ------------------
  |  Branch (332:17): [True: 0, False: 0]
  ------------------
  333|      0|                  break;
  334|      0|                case ST_CLOSE:
  ------------------
  |  |   95|      0|#define ST_CLOSE 4
  ------------------
  |  Branch (334:17): [True: 0, False: 0]
  ------------------
  335|      0|                  break;
  336|      0|                case ST_DATA:
  ------------------
  |  |   92|      0|#define ST_DATA  1  /* datalen follows */
  ------------------
  |  Branch (336:17): [True: 0, False: 0]
  ------------------
  337|      0|                  {
  338|      0|                    DATALEN n;
  339|      0|                    memcpy ( &n, p, sizeof n );
  340|      0|                    p += sizeof n;
  341|      0|                    p += n;
  342|      0|                  }
  343|      0|                  break;
  344|      0|                default:
  ------------------
  |  Branch (344:17): [True: 0, False: 0]
  ------------------
  345|      0|                  break;
  346|      0|                }
  347|      0|            }
  348|      0|          wipememory (sexp->d, p - sexp->d);
  ------------------
  |  |  398|      0|#define wipememory(_ptr,_len) wipememory2((_ptr),0,(_len))
  |  |  ------------------
  |  |  |  |  388|      0|#define wipememory2(_ptr,_set,_len) do { \
  |  |  |  |  389|      0|	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|      0|#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: 0, False: 0]
  |  |  |  |  |  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|      0|	      } 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|      0|	    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (397:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  349|      0|        }
  350|   208k|      xfree ( sexp );
  ------------------
  |  |  150|   208k|#define xfree(a)         _gcry_free ((a))
  ------------------
  351|   208k|    }
  352|   241k|}
_gcry_sexp_find_token:
  436|   168k|{
  437|   168k|  const byte *p;
  438|   168k|  DATALEN n;
  439|       |
  440|   168k|  if ( !list )
  ------------------
  |  Branch (440:8): [True: 0, False: 168k]
  ------------------
  441|      0|    return NULL;
  442|       |
  443|   168k|  if ( !toklen )
  ------------------
  |  Branch (443:8): [True: 100k, False: 68.3k]
  ------------------
  444|   100k|    toklen = strlen(tok);
  445|       |
  446|   168k|  p = list->d;
  447|   848k|  while ( *p != ST_STOP )
  ------------------
  |  |   91|   848k|#define ST_STOP  0
  ------------------
  |  Branch (447:11): [True: 799k, False: 48.3k]
  ------------------
  448|   799k|    {
  449|   799k|      if ( *p == ST_OPEN && p[1] == ST_DATA )
  ------------------
  |  |   94|  1.59M|#define ST_OPEN  3
  ------------------
                    if ( *p == ST_OPEN && p[1] == ST_DATA )
  ------------------
  |  |   92|   415k|#define ST_DATA  1  /* datalen follows */
  ------------------
  |  Branch (449:12): [True: 415k, False: 383k]
  |  Branch (449:29): [True: 415k, False: 0]
  ------------------
  450|   415k|        {
  451|   415k|          const byte *head = p;
  452|       |
  453|   415k|          p += 2;
  454|   415k|          memcpy ( &n, p, sizeof n );
  455|   415k|          p += sizeof n;
  456|   415k|          if ( n == toklen && !memcmp( p, tok, toklen ) )
  ------------------
  |  Branch (456:16): [True: 211k, False: 204k]
  |  Branch (456:31): [True: 120k, False: 90.5k]
  ------------------
  457|   120k|            { /* found it */
  458|   120k|              gcry_sexp_t newlist;
  459|   120k|              byte *d;
  460|   120k|              int level = 1;
  461|       |
  462|       |              /* Look for the end of the list.  */
  463|   753k|              for ( p += n; level; p++ )
  ------------------
  |  Branch (463:29): [True: 633k, False: 120k]
  ------------------
  464|   633k|                {
  465|   633k|                  if ( *p == ST_DATA )
  ------------------
  |  |   92|   633k|#define ST_DATA  1  /* datalen follows */
  ------------------
  |  Branch (465:24): [True: 285k, False: 348k]
  ------------------
  466|   285k|                    {
  467|   285k|			memcpy ( &n, ++p, sizeof n );
  468|   285k|			p += sizeof n + n;
  469|   285k|			p--; /* Compensate for later increment. */
  470|   285k|		    }
  471|   348k|                  else if ( *p == ST_OPEN )
  ------------------
  |  |   94|   348k|#define ST_OPEN  3
  ------------------
  |  Branch (471:29): [True: 113k, False: 234k]
  ------------------
  472|   113k|                    {
  473|   113k|                      level++;
  474|   113k|		    }
  475|   234k|                  else if ( *p == ST_CLOSE )
  ------------------
  |  |   95|   234k|#define ST_CLOSE 4
  ------------------
  |  Branch (475:29): [True: 234k, False: 0]
  ------------------
  476|   234k|                    {
  477|   234k|                      level--;
  478|   234k|		    }
  479|      0|                  else if ( *p == ST_STOP )
  ------------------
  |  |   91|      0|#define ST_STOP  0
  ------------------
  |  Branch (479:29): [True: 0, False: 0]
  ------------------
  480|      0|                    {
  481|      0|                      BUG ();
  ------------------
  |  |  187|      0|#define BUG() _gcry_bug( __FILE__ , __LINE__, __FUNCTION__ )
  ------------------
  482|      0|		    }
  483|   633k|		}
  484|   120k|              n = p - head;
  485|       |
  486|   120k|              newlist = xtrymalloc ( sizeof *newlist + n );
  ------------------
  |  |  138|   120k|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  487|   120k|              if (!newlist)
  ------------------
  |  Branch (487:19): [True: 0, False: 120k]
  ------------------
  488|      0|                {
  489|       |                  /* No way to return an error code, so we can only
  490|       |                     return Not Found. */
  491|      0|                  return NULL;
  492|      0|                }
  493|   120k|              d = newlist->d;
  494|   120k|              memcpy ( d, head, n ); d += n;
  495|   120k|              *d++ = ST_STOP;
  ------------------
  |  |   91|   120k|#define ST_STOP  0
  ------------------
  496|   120k|              return normalize ( newlist );
  497|   120k|	    }
  498|   295k|          p += n;
  499|   295k|	}
  500|   383k|      else if ( *p == ST_DATA )
  ------------------
  |  |   92|   383k|#define ST_DATA  1  /* datalen follows */
  ------------------
  |  Branch (500:17): [True: 174k, False: 208k]
  ------------------
  501|   174k|        {
  502|   174k|          memcpy ( &n, ++p, sizeof n ); p += sizeof n;
  503|   174k|          p += n;
  504|   174k|	}
  505|   208k|      else
  506|   208k|        p++;
  507|   799k|    }
  508|  48.3k|  return NULL;
  509|   168k|}
_gcry_sexp_length:
  516|  9.18k|{
  517|  9.18k|  const byte *p;
  518|  9.18k|  DATALEN n;
  519|  9.18k|  int type;
  520|  9.18k|  int length = 0;
  521|  9.18k|  int level = 0;
  522|       |
  523|  9.18k|  if (!list)
  ------------------
  |  Branch (523:7): [True: 0, False: 9.18k]
  ------------------
  524|      0|    return 0;
  525|       |
  526|  9.18k|  p = list->d;
  527|  45.9k|  while ((type=*p) != ST_STOP)
  ------------------
  |  |   91|  45.9k|#define ST_STOP  0
  ------------------
  |  Branch (527:10): [True: 36.7k, False: 9.18k]
  ------------------
  528|  36.7k|    {
  529|  36.7k|      p++;
  530|  36.7k|      if (type == ST_DATA)
  ------------------
  |  |   92|  36.7k|#define ST_DATA  1  /* datalen follows */
  ------------------
  |  Branch (530:11): [True: 18.3k, False: 18.3k]
  ------------------
  531|  18.3k|        {
  532|  18.3k|          memcpy (&n, p, sizeof n);
  533|  18.3k|          p += sizeof n + n;
  534|  18.3k|          if (level == 1)
  ------------------
  |  Branch (534:15): [True: 18.3k, False: 0]
  ------------------
  535|  18.3k|            length++;
  536|  18.3k|	}
  537|  18.3k|      else if (type == ST_OPEN)
  ------------------
  |  |   94|  18.3k|#define ST_OPEN  3
  ------------------
  |  Branch (537:16): [True: 9.18k, False: 9.18k]
  ------------------
  538|  9.18k|        {
  539|  9.18k|          if (level == 1)
  ------------------
  |  Branch (539:15): [True: 0, False: 9.18k]
  ------------------
  540|      0|            length++;
  541|  9.18k|          level++;
  542|  9.18k|	}
  543|  9.18k|      else if (type == ST_CLOSE)
  ------------------
  |  |   95|  9.18k|#define ST_CLOSE 4
  ------------------
  |  Branch (543:16): [True: 9.18k, False: 0]
  ------------------
  544|  9.18k|        {
  545|  9.18k|          level--;
  546|  9.18k|	}
  547|  36.7k|    }
  548|  9.18k|  return length;
  549|  9.18k|}
_gcry_sexp_nth:
  598|  29.1k|{
  599|  29.1k|  const byte *p;
  600|  29.1k|  DATALEN n;
  601|  29.1k|  gcry_sexp_t newlist;
  602|  29.1k|  byte *d;
  603|  29.1k|  int level = 0;
  604|       |
  605|  29.1k|  if (!list || list->d[0] != ST_OPEN)
  ------------------
  |  |   94|  29.1k|#define ST_OPEN  3
  ------------------
  |  Branch (605:7): [True: 0, False: 29.1k]
  |  Branch (605:16): [True: 0, False: 29.1k]
  ------------------
  606|      0|    return NULL;
  607|  29.1k|  p = list->d;
  608|       |
  609|  40.9k|  while (number > 0)
  ------------------
  |  Branch (609:10): [True: 11.8k, False: 29.1k]
  ------------------
  610|  11.8k|    {
  611|  11.8k|      p++;
  612|  11.8k|      if (*p == ST_DATA)
  ------------------
  |  |   92|  11.8k|#define ST_DATA  1  /* datalen follows */
  ------------------
  |  Branch (612:11): [True: 11.8k, False: 0]
  ------------------
  613|  11.8k|        {
  614|  11.8k|          memcpy (&n, ++p, sizeof n);
  615|  11.8k|          p += sizeof n + n;
  616|  11.8k|          p--;
  617|  11.8k|          if (!level)
  ------------------
  |  Branch (617:15): [True: 11.8k, False: 0]
  ------------------
  618|  11.8k|            number--;
  619|  11.8k|	}
  620|      0|      else if (*p == ST_OPEN)
  ------------------
  |  |   94|      0|#define ST_OPEN  3
  ------------------
  |  Branch (620:16): [True: 0, False: 0]
  ------------------
  621|      0|        {
  622|      0|          level++;
  623|      0|	}
  624|      0|      else if (*p == ST_CLOSE)
  ------------------
  |  |   95|      0|#define ST_CLOSE 4
  ------------------
  |  Branch (624:16): [True: 0, False: 0]
  ------------------
  625|      0|        {
  626|      0|          level--;
  627|      0|          if ( !level )
  ------------------
  |  Branch (627:16): [True: 0, False: 0]
  ------------------
  628|      0|            number--;
  629|      0|	}
  630|      0|      else if (*p == ST_STOP)
  ------------------
  |  |   91|      0|#define ST_STOP  0
  ------------------
  |  Branch (630:16): [True: 0, False: 0]
  ------------------
  631|      0|        {
  632|      0|          return NULL;
  633|      0|	}
  634|  11.8k|    }
  635|  29.1k|  p++;
  636|       |
  637|  29.1k|  if (*p == ST_DATA)
  ------------------
  |  |   92|  29.1k|#define ST_DATA  1  /* datalen follows */
  ------------------
  |  Branch (637:7): [True: 0, False: 29.1k]
  ------------------
  638|      0|    {
  639|      0|      memcpy (&n, p+1, sizeof n);
  640|      0|      newlist = xtrymalloc (sizeof *newlist + 1 + 1 + sizeof n + n + 1);
  ------------------
  |  |  138|      0|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  641|      0|      if (!newlist)
  ------------------
  |  Branch (641:11): [True: 0, False: 0]
  ------------------
  642|      0|        return NULL;
  643|      0|      d = newlist->d;
  644|      0|      *d++ = ST_OPEN;
  ------------------
  |  |   94|      0|#define ST_OPEN  3
  ------------------
  645|      0|      memcpy (d, p, 1 + sizeof n + n);
  646|      0|      d += 1 + sizeof n + n;
  647|      0|      *d++ = ST_CLOSE;
  ------------------
  |  |   95|      0|#define ST_CLOSE 4
  ------------------
  648|      0|      *d = ST_STOP;
  ------------------
  |  |   91|      0|#define ST_STOP  0
  ------------------
  649|      0|    }
  650|  29.1k|  else if (*p == ST_OPEN)
  ------------------
  |  |   94|  29.1k|#define ST_OPEN  3
  ------------------
  |  Branch (650:12): [True: 29.1k, False: 0]
  ------------------
  651|  29.1k|    {
  652|  29.1k|      const byte *head = p;
  653|       |
  654|  29.1k|      level = 1;
  655|   341k|      do {
  656|   341k|        p++;
  657|   341k|        if (*p == ST_DATA)
  ------------------
  |  |   92|   341k|#define ST_DATA  1  /* datalen follows */
  ------------------
  |  Branch (657:13): [True: 170k, False: 170k]
  ------------------
  658|   170k|          {
  659|   170k|            memcpy (&n, ++p, sizeof n);
  660|   170k|            p += sizeof n + n;
  661|   170k|            p--;
  662|   170k|          }
  663|   170k|        else if (*p == ST_OPEN)
  ------------------
  |  |   94|   170k|#define ST_OPEN  3
  ------------------
  |  Branch (663:18): [True: 70.8k, False: 100k]
  ------------------
  664|  70.8k|          {
  665|  70.8k|            level++;
  666|  70.8k|          }
  667|   100k|        else if (*p == ST_CLOSE)
  ------------------
  |  |   95|   100k|#define ST_CLOSE 4
  ------------------
  |  Branch (667:18): [True: 100k, False: 0]
  ------------------
  668|   100k|          {
  669|   100k|            level--;
  670|   100k|          }
  671|      0|        else if (*p == ST_STOP)
  ------------------
  |  |   91|      0|#define ST_STOP  0
  ------------------
  |  Branch (671:18): [True: 0, False: 0]
  ------------------
  672|      0|          {
  673|      0|            BUG ();
  ------------------
  |  |  187|      0|#define BUG() _gcry_bug( __FILE__ , __LINE__, __FUNCTION__ )
  ------------------
  674|      0|          }
  675|   341k|      } while (level);
  ------------------
  |  Branch (675:16): [True: 312k, False: 29.1k]
  ------------------
  676|  29.1k|      n = p + 1 - head;
  677|       |
  678|  29.1k|      newlist = xtrymalloc (sizeof *newlist + n);
  ------------------
  |  |  138|  29.1k|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  679|  29.1k|      if (!newlist)
  ------------------
  |  Branch (679:11): [True: 0, False: 29.1k]
  ------------------
  680|      0|        return NULL;
  681|  29.1k|      d = newlist->d;
  682|  29.1k|      memcpy (d, head, n);
  683|  29.1k|      d += n;
  684|  29.1k|      *d++ = ST_STOP;
  ------------------
  |  |   91|  29.1k|#define ST_STOP  0
  ------------------
  685|  29.1k|    }
  686|      0|  else
  687|      0|    newlist = NULL;
  688|       |
  689|  29.1k|  return normalize (newlist);
  690|  29.1k|}
_gcry_sexp_car:
  695|  17.3k|{
  696|  17.3k|  return _gcry_sexp_nth (list, 0);
  697|  17.3k|}
_gcry_sexp_nth_data:
  763|  13.7k|{
  764|  13.7k|  return do_sexp_nth_data (list, number, datalen);
  765|  13.7k|}
_gcry_sexp_nth_buffer:
  774|  21.0k|{
  775|  21.0k|  const char *s;
  776|  21.0k|  size_t n;
  777|  21.0k|  char *buf;
  778|       |
  779|  21.0k|  *rlength = 0;
  780|  21.0k|  s = do_sexp_nth_data (list, number, &n);
  781|  21.0k|  if (!s || !n)
  ------------------
  |  Branch (781:7): [True: 0, False: 21.0k]
  |  Branch (781:13): [True: 0, False: 21.0k]
  ------------------
  782|      0|    return NULL;
  783|  21.0k|  buf = xtrymalloc (n);
  ------------------
  |  |  138|  21.0k|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  784|  21.0k|  if (!buf)
  ------------------
  |  Branch (784:7): [True: 0, False: 21.0k]
  ------------------
  785|      0|    return NULL;
  786|  21.0k|  memcpy (buf, s, n);
  787|  21.0k|  *rlength = n;
  788|  21.0k|  return buf;
  789|  21.0k|}
_gcry_sexp_nth_string:
  796|  43.8k|{
  797|  43.8k|  const char *s;
  798|  43.8k|  size_t n;
  799|  43.8k|  char *buf;
  800|       |
  801|  43.8k|  s = do_sexp_nth_data (list, number, &n);
  802|  43.8k|  if (!s || n < 1 || (n+1) < 1)
  ------------------
  |  Branch (802:7): [True: 0, False: 43.8k]
  |  Branch (802:13): [True: 0, False: 43.8k]
  |  Branch (802:22): [True: 0, False: 43.8k]
  ------------------
  803|      0|    return NULL;
  804|  43.8k|  buf = xtrymalloc (n+1);
  ------------------
  |  |  138|  43.8k|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  805|  43.8k|  if (!buf)
  ------------------
  |  Branch (805:7): [True: 0, False: 43.8k]
  ------------------
  806|      0|    return NULL;
  807|  43.8k|  memcpy (buf, s, n);
  808|  43.8k|  buf[n] = 0;
  809|  43.8k|  return buf;
  810|  43.8k|}
_gcry_sexp_nth_mpi:
  818|  60.8k|{
  819|  60.8k|  size_t n;
  820|  60.8k|  gcry_mpi_t a;
  821|       |
  822|  60.8k|  if (mpifmt == GCRYMPI_FMT_OPAQUE)
  ------------------
  |  Branch (822:7): [True: 16.4k, False: 44.3k]
  ------------------
  823|  16.4k|    {
  824|  16.4k|      char *p;
  825|       |
  826|  16.4k|      p = _gcry_sexp_nth_buffer (list, number, &n);
  827|  16.4k|      if (!p)
  ------------------
  |  Branch (827:11): [True: 0, False: 16.4k]
  ------------------
  828|      0|        return NULL;
  829|       |
  830|  16.4k|      a = _gcry_is_secure (list)? _gcry_mpi_snew (0) : _gcry_mpi_new (0);
  ------------------
  |  Branch (830:11): [True: 0, False: 16.4k]
  ------------------
  831|  16.4k|      if (a)
  ------------------
  |  Branch (831:11): [True: 16.4k, False: 0]
  ------------------
  832|  16.4k|        mpi_set_opaque (a, p, n*8);
  ------------------
  |  |  561|  16.4k|#define mpi_set_opaque(a,b,c)  _gcry_mpi_set_opaque ((a), (b), (c))
  ------------------
  833|      0|      else
  834|      0|        xfree (p);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
  835|  16.4k|    }
  836|  44.3k|  else
  837|  44.3k|    {
  838|  44.3k|      const char *s;
  839|       |
  840|  44.3k|      if (!mpifmt)
  ------------------
  |  Branch (840:11): [True: 0, False: 44.3k]
  ------------------
  841|      0|        mpifmt = GCRYMPI_FMT_STD;
  842|       |
  843|  44.3k|      s = do_sexp_nth_data (list, number, &n);
  844|  44.3k|      if (!s)
  ------------------
  |  Branch (844:11): [True: 5, False: 44.3k]
  ------------------
  845|      5|        return NULL;
  846|       |
  847|  44.3k|      if (_gcry_mpi_scan (&a, mpifmt, s, n, NULL))
  ------------------
  |  Branch (847:11): [True: 0, False: 44.3k]
  ------------------
  848|      0|        return NULL;
  849|  44.3k|    }
  850|       |
  851|  60.8k|  return a;
  852|  60.8k|}
_gcry_sexp_cdr:
  860|  17.3k|{
  861|  17.3k|  const byte *p;
  862|  17.3k|  const byte *head;
  863|  17.3k|  DATALEN n;
  864|  17.3k|  gcry_sexp_t newlist;
  865|  17.3k|  byte *d;
  866|  17.3k|  int level = 0;
  867|  17.3k|  int skip = 1;
  868|       |
  869|  17.3k|  if (!list || list->d[0] != ST_OPEN)
  ------------------
  |  |   94|  17.3k|#define ST_OPEN  3
  ------------------
  |  Branch (869:7): [True: 0, False: 17.3k]
  |  Branch (869:16): [True: 0, False: 17.3k]
  ------------------
  870|      0|    return NULL;
  871|  17.3k|  p = list->d;
  872|       |
  873|  34.7k|  while (skip > 0)
  ------------------
  |  Branch (873:10): [True: 17.3k, False: 17.3k]
  ------------------
  874|  17.3k|    {
  875|  17.3k|      p++;
  876|  17.3k|      if (*p == ST_DATA)
  ------------------
  |  |   92|  17.3k|#define ST_DATA  1  /* datalen follows */
  ------------------
  |  Branch (876:11): [True: 17.3k, False: 0]
  ------------------
  877|  17.3k|        {
  878|  17.3k|          memcpy ( &n, ++p, sizeof n );
  879|  17.3k|          p += sizeof n + n;
  880|  17.3k|          p--;
  881|  17.3k|          if ( !level )
  ------------------
  |  Branch (881:16): [True: 17.3k, False: 0]
  ------------------
  882|  17.3k|            skip--;
  883|  17.3k|	}
  884|      0|      else if (*p == ST_OPEN)
  ------------------
  |  |   94|      0|#define ST_OPEN  3
  ------------------
  |  Branch (884:16): [True: 0, False: 0]
  ------------------
  885|      0|        {
  886|      0|          level++;
  887|      0|	}
  888|      0|      else if (*p == ST_CLOSE)
  ------------------
  |  |   95|      0|#define ST_CLOSE 4
  ------------------
  |  Branch (888:16): [True: 0, False: 0]
  ------------------
  889|      0|        {
  890|      0|          level--;
  891|      0|          if ( !level )
  ------------------
  |  Branch (891:16): [True: 0, False: 0]
  ------------------
  892|      0|            skip--;
  893|      0|	}
  894|      0|      else if (*p == ST_STOP)
  ------------------
  |  |   91|      0|#define ST_STOP  0
  ------------------
  |  Branch (894:16): [True: 0, False: 0]
  ------------------
  895|      0|        {
  896|      0|          return NULL;
  897|      0|	}
  898|  17.3k|    }
  899|  17.3k|  p++;
  900|       |
  901|  17.3k|  head = p;
  902|  17.3k|  level = 0;
  903|   247k|  do {
  904|   247k|    if (*p == ST_DATA)
  ------------------
  |  |   92|   247k|#define ST_DATA  1  /* datalen follows */
  ------------------
  |  Branch (904:9): [True: 115k, False: 132k]
  ------------------
  905|   115k|      {
  906|   115k|        memcpy ( &n, ++p, sizeof n );
  907|   115k|        p += sizeof n + n;
  908|   115k|        p--;
  909|   115k|      }
  910|   132k|    else if (*p == ST_OPEN)
  ------------------
  |  |   94|   132k|#define ST_OPEN  3
  ------------------
  |  Branch (910:14): [True: 66.2k, False: 66.2k]
  ------------------
  911|  66.2k|      {
  912|  66.2k|        level++;
  913|  66.2k|      }
  914|  66.2k|    else if (*p == ST_CLOSE)
  ------------------
  |  |   95|  66.2k|#define ST_CLOSE 4
  ------------------
  |  Branch (914:14): [True: 66.2k, False: 0]
  ------------------
  915|  66.2k|      {
  916|  66.2k|        level--;
  917|  66.2k|      }
  918|      0|    else if (*p == ST_STOP)
  ------------------
  |  |   91|      0|#define ST_STOP  0
  ------------------
  |  Branch (918:14): [True: 0, False: 0]
  ------------------
  919|      0|      {
  920|      0|        return NULL;
  921|      0|      }
  922|   247k|    p++;
  923|   247k|  } while (level);
  ------------------
  |  Branch (923:12): [True: 230k, False: 17.3k]
  ------------------
  924|  17.3k|  n = p - head;
  925|       |
  926|  17.3k|  newlist = xtrymalloc (sizeof *newlist + n + 2);
  ------------------
  |  |  138|  17.3k|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  927|  17.3k|  if (!newlist)
  ------------------
  |  Branch (927:7): [True: 0, False: 17.3k]
  ------------------
  928|      0|    return NULL;
  929|  17.3k|  d = newlist->d;
  930|  17.3k|  *d++ = ST_OPEN;
  ------------------
  |  |   94|  17.3k|#define ST_OPEN  3
  ------------------
  931|  17.3k|  memcpy (d, head, n);
  932|  17.3k|  d += n;
  933|  17.3k|  *d++ = ST_CLOSE;
  ------------------
  |  |   95|  17.3k|#define ST_CLOSE 4
  ------------------
  934|  17.3k|  *d++ = ST_STOP;
  ------------------
  |  |   91|  17.3k|#define ST_STOP  0
  ------------------
  935|       |
  936|  17.3k|  return normalize (newlist);
  937|  17.3k|}
_gcry_sexp_cadr:
  942|  17.3k|{
  943|  17.3k|  gcry_sexp_t a, b;
  944|       |
  945|  17.3k|  a = _gcry_sexp_cdr (list);
  946|  17.3k|  b = _gcry_sexp_car (a);
  947|  17.3k|  sexp_release (a);
  ------------------
  |  |  372|  17.3k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  948|  17.3k|  return b;
  949|  17.3k|}
_gcry_sexp_vbuild:
 1816|  41.7k|{
 1817|  41.7k|  return do_vsexp_sscan (retsexp, erroff, format, strlen(format), 1,
 1818|  41.7k|                         NULL, arg_ptr);
 1819|  41.7k|}
_gcry_sexp_vextract_param:
 2309|  16.3k|{
 2310|  16.3k|  gpg_err_code_t rc;
 2311|  16.3k|  const char *s, *s2;
 2312|  16.3k|  void **array[20];
 2313|  16.3k|  char arrayisdesc[20];
 2314|  16.3k|  int idx, i;
 2315|  16.3k|  gcry_sexp_t l1 = NULL;
 2316|  16.3k|  int mode = '+'; /* Default to GCRYMPI_FMT_USG.  */
 2317|  16.3k|  int submode = 0;
 2318|  16.3k|  gcry_sexp_t freethis = NULL;
 2319|  16.3k|  char *tmpstr = NULL;
 2320|       |
 2321|       |  /* Values in ARRAYISDESC describing what the ARRAY holds.
 2322|       |   *  0  - MPI
 2323|       |   *  1  - gcry_buffer_t provided by caller.
 2324|       |   *  2  - gcry_buffer_t allocated by us.
 2325|       |   * 's' - String allocated by us.
 2326|       |   * 'x' - Ignore
 2327|       |   */
 2328|  16.3k|  memset (arrayisdesc, 0, sizeof arrayisdesc);
 2329|       |
 2330|       |  /* First copy all the args into an array.  This is required so that
 2331|       |     we are able to release already allocated MPIs if later an error
 2332|       |     was found.  */
 2333|  57.1k|  for (s=list, idx=0; *s && idx < DIM (array); s++)
  ------------------
  |  |  104|  40.8k|#define DIM(v) (sizeof(v)/sizeof((v)[0]))
  ------------------
  |  Branch (2333:23): [True: 40.8k, False: 16.3k]
  |  Branch (2333:29): [True: 40.8k, False: 0]
  ------------------
 2334|  40.8k|    {
 2335|  40.8k|      if (*s == '&' || *s == '+' || *s == '-' || *s == '/' || *s == '?')
  ------------------
  |  Branch (2335:11): [True: 0, False: 40.8k]
  |  Branch (2335:24): [True: 0, False: 40.8k]
  |  Branch (2335:37): [True: 0, False: 40.8k]
  |  Branch (2335:50): [True: 4.59k, False: 36.2k]
  |  Branch (2335:63): [True: 0, False: 36.2k]
  ------------------
 2336|  4.59k|        ;
 2337|  36.2k|      else if (*s == '%')
  ------------------
  |  Branch (2337:16): [True: 0, False: 36.2k]
  ------------------
 2338|      0|        {
 2339|      0|          s++;
 2340|      0|          if (*s == 'l' && (s[1] == 'u' || s[1] == 'd'))
  ------------------
  |  Branch (2340:15): [True: 0, False: 0]
  |  Branch (2340:29): [True: 0, False: 0]
  |  Branch (2340:44): [True: 0, False: 0]
  ------------------
 2341|      0|            s++;
 2342|      0|          else if (*s == 'z' && s[1] == 'u')
  ------------------
  |  Branch (2342:20): [True: 0, False: 0]
  |  Branch (2342:33): [True: 0, False: 0]
  ------------------
 2343|      0|            s++;
 2344|      0|          else if (*s == '#' && s[1] == 's')
  ------------------
  |  Branch (2344:20): [True: 0, False: 0]
  |  Branch (2344:33): [True: 0, False: 0]
  ------------------
 2345|      0|            s++;
 2346|      0|          continue;
 2347|      0|        }
 2348|  36.2k|      else if (whitespacep (s))
  ------------------
  |  Branch (2348:16): [True: 0, False: 36.2k]
  ------------------
 2349|      0|        ;
 2350|  36.2k|      else
 2351|  36.2k|        {
 2352|  36.2k|          if (*s == '\'')
  ------------------
  |  Branch (2352:15): [True: 0, False: 36.2k]
  ------------------
 2353|      0|            {
 2354|      0|              s++;
 2355|      0|              s2 = strchr (s, '\'');
 2356|      0|              if (!s2 || s2 == s)
  ------------------
  |  Branch (2356:19): [True: 0, False: 0]
  |  Branch (2356:26): [True: 0, False: 0]
  ------------------
 2357|      0|                {
 2358|       |                  /* Closing quote not found or empty string.  */
 2359|      0|                  return GPG_ERR_SYNTAX;
 2360|      0|                }
 2361|      0|              s = s2;
 2362|      0|            }
 2363|  36.2k|          array[idx] = va_arg (arg_ptr, void *);
 2364|  36.2k|          if (!array[idx])
  ------------------
  |  Branch (2364:15): [True: 0, False: 36.2k]
  ------------------
 2365|      0|            return GPG_ERR_MISSING_VALUE; /* NULL pointer given.  */
 2366|  36.2k|          idx++;
 2367|  36.2k|        }
 2368|  40.8k|    }
 2369|  16.3k|  if (*s)
  ------------------
  |  Branch (2369:7): [True: 0, False: 16.3k]
  ------------------
 2370|      0|    return GPG_ERR_LIMIT_REACHED;  /* Too many list elements.  */
 2371|  16.3k|  if (va_arg (arg_ptr, gcry_mpi_t *))
 2372|      0|    return GPG_ERR_INV_ARG;  /* Not enough list elemends.  */
 2373|       |
 2374|       |  /* Drill down.  */
 2375|  16.3k|  while (path && *path)
  ------------------
  |  Branch (2375:10): [True: 0, False: 16.3k]
  |  Branch (2375:18): [True: 0, False: 0]
  ------------------
 2376|      0|    {
 2377|      0|      size_t n;
 2378|       |
 2379|      0|      s = strchr (path, '!');
 2380|      0|      if (s == path)
  ------------------
  |  Branch (2380:11): [True: 0, False: 0]
  ------------------
 2381|      0|        {
 2382|      0|          rc = GPG_ERR_NOT_FOUND;
 2383|      0|          goto cleanup;
 2384|      0|        }
 2385|      0|      n = s? s - path : 0;
  ------------------
  |  Branch (2385:11): [True: 0, False: 0]
  ------------------
 2386|      0|      l1 = _gcry_sexp_find_token (sexp, path, n);
 2387|      0|      if (!l1)
  ------------------
  |  Branch (2387:11): [True: 0, False: 0]
  ------------------
 2388|      0|        {
 2389|      0|          rc = GPG_ERR_NOT_FOUND;
 2390|      0|          goto cleanup;
 2391|      0|        }
 2392|      0|      sexp = l1; l1 = NULL;
 2393|      0|      sexp_release (freethis);
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 2394|      0|      freethis = sexp;
 2395|      0|      if (n)
  ------------------
  |  Branch (2395:11): [True: 0, False: 0]
  ------------------
 2396|      0|        path += n + 1;
 2397|      0|      else
 2398|      0|        path = NULL;
 2399|      0|    }
 2400|       |
 2401|       |
 2402|       |  /* Now extract all parameters.  */
 2403|  57.1k|  for (s=list, idx=0; *s; s++)
  ------------------
  |  Branch (2403:23): [True: 40.8k, False: 16.2k]
  ------------------
 2404|  40.8k|    {
 2405|  40.8k|      if (*s == '&' || *s == '+' || *s == '-' || *s == '/')
  ------------------
  |  Branch (2405:11): [True: 0, False: 40.8k]
  |  Branch (2405:24): [True: 0, False: 40.8k]
  |  Branch (2405:37): [True: 0, False: 40.8k]
  |  Branch (2405:50): [True: 4.59k, False: 36.2k]
  ------------------
 2406|  4.59k|        mode = *s;
 2407|  36.2k|      else if (*s == '%')
  ------------------
  |  Branch (2407:16): [True: 0, False: 36.2k]
  ------------------
 2408|      0|        {
 2409|      0|          s++;
 2410|      0|          if (!*s)
  ------------------
  |  Branch (2410:15): [True: 0, False: 0]
  ------------------
 2411|      0|            continue;  /* Ignore at end of format.  */
 2412|      0|          if (*s == 's' || *s == 'd' || *s == 'u')
  ------------------
  |  Branch (2412:15): [True: 0, False: 0]
  |  Branch (2412:28): [True: 0, False: 0]
  |  Branch (2412:41): [True: 0, False: 0]
  ------------------
 2413|      0|            {
 2414|      0|              mode = *s;
 2415|      0|              submode = 0;
 2416|      0|            }
 2417|      0|          else if (*s == 'l' && (s[1] == 'u' || s[1] == 'd'))
  ------------------
  |  Branch (2417:20): [True: 0, False: 0]
  |  Branch (2417:34): [True: 0, False: 0]
  |  Branch (2417:49): [True: 0, False: 0]
  ------------------
 2418|      0|            {
 2419|      0|              mode = s[1];
 2420|      0|              submode = 'l';
 2421|      0|              s++;
 2422|      0|            }
 2423|      0|          else if (*s == 'z' && s[1] == 'u')
  ------------------
  |  Branch (2423:20): [True: 0, False: 0]
  |  Branch (2423:33): [True: 0, False: 0]
  ------------------
 2424|      0|            {
 2425|      0|              mode = s[1];
 2426|      0|              submode = 'z';
 2427|      0|              s++;
 2428|      0|            }
 2429|      0|          else if (*s == '#' && s[1] == 's')
  ------------------
  |  Branch (2429:20): [True: 0, False: 0]
  |  Branch (2429:33): [True: 0, False: 0]
  ------------------
 2430|      0|            {
 2431|      0|              mode = s[1];
 2432|      0|              submode = '#';
 2433|      0|              s++;
 2434|      0|            }
 2435|      0|          continue;
 2436|      0|        }
 2437|  36.2k|      else if (whitespacep (s))
  ------------------
  |  Branch (2437:16): [True: 0, False: 36.2k]
  ------------------
 2438|      0|        ;
 2439|  36.2k|      else if (*s == '?')
  ------------------
  |  Branch (2439:16): [True: 0, False: 36.2k]
  ------------------
 2440|      0|        ; /* Only used via lookahead.  */
 2441|  36.2k|      else
 2442|  36.2k|        {
 2443|  36.2k|          if (*s == '\'')
  ------------------
  |  Branch (2443:15): [True: 0, False: 36.2k]
  ------------------
 2444|      0|            {
 2445|       |              /* Find closing quote, find token, set S to closing quote.  */
 2446|      0|              s++;
 2447|      0|              s2 = strchr (s, '\'');
 2448|      0|              if (!s2 || s2 == s)
  ------------------
  |  Branch (2448:19): [True: 0, False: 0]
  |  Branch (2448:26): [True: 0, False: 0]
  ------------------
 2449|      0|                {
 2450|       |                  /* Closing quote not found or empty string.  */
 2451|      0|                  rc = GPG_ERR_SYNTAX;
 2452|      0|                  goto cleanup;
 2453|      0|                }
 2454|      0|              l1 = _gcry_sexp_find_token (sexp, s, s2 - s);
 2455|      0|              s = s2;
 2456|      0|            }
 2457|  36.2k|          else
 2458|  36.2k|            l1 = _gcry_sexp_find_token (sexp, s, 1);
 2459|       |
 2460|  36.2k|          if (!l1 && s[1] == '?')
  ------------------
  |  Branch (2460:15): [True: 0, False: 36.2k]
  |  Branch (2460:22): [True: 0, False: 0]
  ------------------
 2461|      0|            {
 2462|       |              /* Optional element not found.  */
 2463|      0|              if (mode == '&')
  ------------------
  |  Branch (2463:19): [True: 0, False: 0]
  ------------------
 2464|      0|                {
 2465|      0|                  gcry_buffer_t *spec = (gcry_buffer_t*)array[idx];
 2466|      0|                  if (!spec->data)
  ------------------
  |  Branch (2466:23): [True: 0, False: 0]
  ------------------
 2467|      0|                    {
 2468|      0|                      spec->size = 0;
 2469|      0|                      spec->off = 0;
 2470|      0|                    }
 2471|      0|                  spec->len = 0;
 2472|      0|                }
 2473|      0|              else if (mode == 's')
  ------------------
  |  Branch (2473:24): [True: 0, False: 0]
  ------------------
 2474|      0|                {
 2475|      0|                  *array[idx] = NULL;
 2476|      0|                  arrayisdesc[idx] = 's';
 2477|      0|                }
 2478|      0|              else if (mode == 'd')
  ------------------
  |  Branch (2478:24): [True: 0, False: 0]
  ------------------
 2479|      0|                {
 2480|      0|                  if (submode == 'l')
  ------------------
  |  Branch (2480:23): [True: 0, False: 0]
  ------------------
 2481|      0|                    *(long *)array[idx] = 0;
 2482|      0|                  else
 2483|      0|                    *(int *)array[idx] = 0;
 2484|      0|                  arrayisdesc[idx] = 'x';
 2485|      0|                }
 2486|      0|              else if (mode == 'u')
  ------------------
  |  Branch (2486:24): [True: 0, False: 0]
  ------------------
 2487|      0|                {
 2488|      0|                  if (submode == 'l')
  ------------------
  |  Branch (2488:23): [True: 0, False: 0]
  ------------------
 2489|      0|                    *(unsigned long *)array[idx] = 0;
 2490|      0|                  else if (submode == 'z')
  ------------------
  |  Branch (2490:28): [True: 0, False: 0]
  ------------------
 2491|      0|                    *(size_t *)array[idx] = 0;
 2492|      0|                  else
 2493|      0|                    *(unsigned int *)array[idx] = 0;
 2494|      0|                  arrayisdesc[idx] = 'x';
 2495|      0|                }
 2496|      0|              else
 2497|      0|                *array[idx] = NULL;
 2498|      0|            }
 2499|  36.2k|          else if (!l1)
  ------------------
  |  Branch (2499:20): [True: 0, False: 36.2k]
  ------------------
 2500|      0|            {
 2501|      0|              rc = GPG_ERR_NO_OBJ;  /* List element not found.  */
 2502|      0|              goto cleanup;
 2503|      0|            }
 2504|  36.2k|           else
 2505|  36.2k|            {
 2506|  36.2k|              if (mode == '&')
  ------------------
  |  Branch (2506:19): [True: 0, False: 36.2k]
  ------------------
 2507|      0|                {
 2508|      0|                  gcry_buffer_t *spec = (gcry_buffer_t*)array[idx];
 2509|       |
 2510|      0|                  if (spec->data)
  ------------------
  |  Branch (2510:23): [True: 0, False: 0]
  ------------------
 2511|      0|                    {
 2512|      0|                      const char *pbuf;
 2513|      0|                      size_t nbuf;
 2514|       |
 2515|      0|                      pbuf = _gcry_sexp_nth_data (l1, 1, &nbuf);
 2516|      0|                      if (!pbuf || !nbuf)
  ------------------
  |  Branch (2516:27): [True: 0, False: 0]
  |  Branch (2516:36): [True: 0, False: 0]
  ------------------
 2517|      0|                        {
 2518|      0|                          rc = GPG_ERR_INV_OBJ;
 2519|      0|                          goto cleanup;
 2520|      0|                        }
 2521|      0|                      if (spec->off + nbuf > spec->size)
  ------------------
  |  Branch (2521:27): [True: 0, False: 0]
  ------------------
 2522|      0|                        {
 2523|      0|                          rc = GPG_ERR_BUFFER_TOO_SHORT;
 2524|      0|                          goto cleanup;
 2525|      0|                        }
 2526|      0|                      memcpy ((char*)spec->data + spec->off, pbuf, nbuf);
 2527|      0|                      spec->len = nbuf;
 2528|      0|                      arrayisdesc[idx] = 1;
 2529|      0|                    }
 2530|      0|                  else
 2531|      0|                    {
 2532|      0|                      spec->data = _gcry_sexp_nth_buffer (l1, 1, &spec->size);
 2533|      0|                      if (!spec->data)
  ------------------
  |  Branch (2533:27): [True: 0, False: 0]
  ------------------
 2534|      0|                        {
 2535|      0|                          rc = GPG_ERR_INV_OBJ; /* Or out of core.  */
 2536|      0|                          goto cleanup;
 2537|      0|                        }
 2538|      0|                      spec->len = spec->size;
 2539|      0|                      spec->off = 0;
 2540|      0|                      arrayisdesc[idx] = 2;
 2541|      0|                    }
 2542|      0|                }
 2543|  36.2k|              else if (mode == 's')
  ------------------
  |  Branch (2543:24): [True: 0, False: 36.2k]
  ------------------
 2544|      0|                {
 2545|      0|                  if (submode == '#')
  ------------------
  |  Branch (2545:23): [True: 0, False: 0]
  ------------------
 2546|      0|                    {
 2547|      0|                      size_t needed = 0;
 2548|      0|                      size_t n;
 2549|      0|                      int l1len;
 2550|      0|                      char *p;
 2551|       |
 2552|      0|                      l1len = l1? sexp_length (l1) : 0;
  ------------------
  |  |  382|      0|#define sexp_length(a)               _gcry_sexp_length ((a))
  ------------------
  |  Branch (2552:31): [True: 0, False: 0]
  ------------------
 2553|      0|                      for (i = 1; i < l1len; i++)
  ------------------
  |  Branch (2553:35): [True: 0, False: 0]
  ------------------
 2554|      0|                        {
 2555|      0|                          s2 = sexp_nth_data (l1, i, &n);
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
 2556|      0|                          if (!s2)
  ------------------
  |  Branch (2556:31): [True: 0, False: 0]
  ------------------
 2557|      0|                            n = 2; /* Not a data element; we use "()". */
 2558|      0|                          needed += n + 1;
 2559|      0|                        }
 2560|      0|                      if (!needed)
  ------------------
  |  Branch (2560:27): [True: 0, False: 0]
  ------------------
 2561|      0|                        {
 2562|      0|                          *array[idx] = p = xtrymalloc (1);
  ------------------
  |  |  138|      0|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
 2563|      0|                          if (p)
  ------------------
  |  Branch (2563:31): [True: 0, False: 0]
  ------------------
 2564|      0|                            *p = 0;
 2565|      0|                        }
 2566|      0|                      else if ((*array[idx] = p = xtrymalloc (needed)))
  ------------------
  |  |  138|      0|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
  |  Branch (2566:32): [True: 0, False: 0]
  ------------------
 2567|      0|                        {
 2568|      0|                          for (i = 1; i < l1len; i++)
  ------------------
  |  Branch (2568:39): [True: 0, False: 0]
  ------------------
 2569|      0|                            {
 2570|      0|                              s2 = sexp_nth_data (l1, i, &n);
  ------------------
  |  |  387|      0|#define sexp_nth_data(a, b, c)       _gcry_sexp_nth_data ((a), (b), (c))
  ------------------
 2571|      0|                              if (!s2)
  ------------------
  |  Branch (2571:35): [True: 0, False: 0]
  ------------------
 2572|      0|                                memcpy (p, "()", (n=2));
 2573|      0|                              else
 2574|      0|                                memcpy (p, s2, n);
 2575|      0|                              p[n] = ' ';
 2576|      0|                              p += n + 1;
 2577|      0|                            }
 2578|      0|                          if (p != *array[idx])
  ------------------
  |  Branch (2578:31): [True: 0, False: 0]
  ------------------
 2579|      0|                            p[-1] = 0;
 2580|      0|                        }
 2581|      0|                    }
 2582|      0|                  else
 2583|      0|                    *array[idx] = _gcry_sexp_nth_string (l1, 1);
 2584|      0|                  if (!*array[idx])
  ------------------
  |  Branch (2584:23): [True: 0, False: 0]
  ------------------
 2585|      0|                    {
 2586|      0|                      rc = gpg_err_code_from_syserror ();
 2587|      0|                      goto cleanup;
 2588|      0|                    }
 2589|      0|                  arrayisdesc[idx] = 's';
 2590|      0|                }
 2591|  36.2k|              else if (mode == 'd')
  ------------------
  |  Branch (2591:24): [True: 0, False: 36.2k]
  ------------------
 2592|      0|                {
 2593|      0|                  long along;
 2594|       |
 2595|      0|                  xfree (tmpstr);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 2596|      0|                  tmpstr = _gcry_sexp_nth_string (l1, 1);
 2597|      0|                  if (!tmpstr)
  ------------------
  |  Branch (2597:23): [True: 0, False: 0]
  ------------------
 2598|      0|                    {
 2599|      0|                      rc = gpg_err_code_from_syserror ();
 2600|      0|                      goto cleanup;
 2601|      0|                    }
 2602|      0|                  along = strtol (tmpstr, NULL, 10);
 2603|      0|                  if (submode == 'l')
  ------------------
  |  Branch (2603:23): [True: 0, False: 0]
  ------------------
 2604|      0|                    *(long *)array[idx] = along;
 2605|      0|                  else
 2606|      0|                    *(int *)array[idx] = along;
 2607|      0|                  arrayisdesc[idx] = 'x';
 2608|      0|                }
 2609|  36.2k|              else if (mode == 'u')
  ------------------
  |  Branch (2609:24): [True: 0, False: 36.2k]
  ------------------
 2610|      0|                {
 2611|      0|                  long aulong;
 2612|       |
 2613|      0|                  xfree (tmpstr);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 2614|      0|                  tmpstr = _gcry_sexp_nth_string (l1, 1);
 2615|      0|                  if (!tmpstr)
  ------------------
  |  Branch (2615:23): [True: 0, False: 0]
  ------------------
 2616|      0|                    {
 2617|      0|                      rc = gpg_err_code_from_syserror ();
 2618|      0|                      goto cleanup;
 2619|      0|                    }
 2620|      0|                  aulong = strtoul (tmpstr, NULL, 10);
 2621|      0|                  if (submode == 'l')
  ------------------
  |  Branch (2621:23): [True: 0, False: 0]
  ------------------
 2622|      0|                    *(unsigned long *)array[idx] = aulong;
 2623|      0|                  else if (submode == 'z')
  ------------------
  |  Branch (2623:28): [True: 0, False: 0]
  ------------------
 2624|      0|                    *(size_t *)array[idx] = aulong;
 2625|      0|                  else
 2626|      0|                    *(unsigned int *)array[idx] = aulong;
 2627|      0|                  arrayisdesc[idx] = 'x';
 2628|      0|                }
 2629|  36.2k|              else
 2630|  36.2k|                {
 2631|  36.2k|                  if (mode == '/')
  ------------------
  |  Branch (2631:23): [True: 9.18k, False: 27.1k]
  ------------------
 2632|  9.18k|                    *array[idx] = _gcry_sexp_nth_mpi (l1,1,GCRYMPI_FMT_OPAQUE);
 2633|  27.1k|                  else if (mode == '-')
  ------------------
  |  Branch (2633:28): [True: 0, False: 27.1k]
  ------------------
 2634|      0|                    *array[idx] = _gcry_sexp_nth_mpi (l1,1,GCRYMPI_FMT_STD);
 2635|  27.1k|                  else
 2636|  27.1k|                    *array[idx] = _gcry_sexp_nth_mpi (l1,1,GCRYMPI_FMT_USG);
 2637|  36.2k|                  if (!*array[idx])
  ------------------
  |  Branch (2637:23): [True: 5, False: 36.2k]
  ------------------
 2638|      5|                    {
 2639|      5|                      rc = GPG_ERR_INV_OBJ;  /* Conversion failed.  */
 2640|      5|                      goto cleanup;
 2641|      5|                    }
 2642|  36.2k|                }
 2643|  36.2k|              sexp_release (l1); l1 = NULL;
  ------------------
  |  |  372|  36.2k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 2644|  36.2k|            }
 2645|  36.2k|          idx++;
 2646|  36.2k|        }
 2647|  40.8k|    }
 2648|       |
 2649|  16.2k|  xfree (tmpstr);
  ------------------
  |  |  150|  16.2k|#define xfree(a)         _gcry_free ((a))
  ------------------
 2650|  16.2k|  sexp_release (freethis);
  ------------------
  |  |  372|  16.2k|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 2651|  16.2k|  return 0;
 2652|       |
 2653|      5| cleanup:
 2654|      5|  xfree (tmpstr);
  ------------------
  |  |  150|      5|#define xfree(a)         _gcry_free ((a))
  ------------------
 2655|      5|  sexp_release (freethis);
  ------------------
  |  |  372|      5|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 2656|      5|  sexp_release (l1);
  ------------------
  |  |  372|      5|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
 2657|      5|  while (idx--)
  ------------------
  |  Branch (2657:10): [True: 0, False: 5]
  ------------------
 2658|      0|    {
 2659|      0|      if (!arrayisdesc[idx])
  ------------------
  |  Branch (2659:11): [True: 0, False: 0]
  ------------------
 2660|      0|        {
 2661|      0|          _gcry_mpi_release (*array[idx]);
 2662|      0|          *array[idx] = NULL;
 2663|      0|        }
 2664|      0|      else if (arrayisdesc[idx] == 1)
  ------------------
  |  Branch (2664:16): [True: 0, False: 0]
  ------------------
 2665|      0|        {
 2666|       |          /* Caller provided buffer.  */
 2667|      0|          gcry_buffer_t *spec = (gcry_buffer_t*)array[idx];
 2668|      0|          spec->len = 0;
 2669|      0|        }
 2670|      0|      else if (arrayisdesc[idx] == 2)
  ------------------
  |  Branch (2670:16): [True: 0, False: 0]
  ------------------
 2671|      0|        {
 2672|       |          /* We might have allocated a buffer.  */
 2673|      0|          gcry_buffer_t *spec = (gcry_buffer_t*)array[idx];
 2674|      0|          xfree (spec->data);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 2675|      0|          spec->data = NULL;
 2676|      0|          spec->size = spec->off = spec->len = 0;
 2677|      0|        }
 2678|      0|      else if (arrayisdesc[idx] == 's')
  ------------------
  |  Branch (2678:16): [True: 0, False: 0]
  ------------------
 2679|      0|        {
 2680|       |          /* We might have allocated a buffer.  */
 2681|      0|          xfree (*array[idx]);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 2682|      0|          *array[idx] = NULL;
 2683|      0|        }
 2684|      0|     }
 2685|      5|  return rc;
 2686|  16.3k|}
_gcry_sexp_extract_param:
 2691|  16.3k|{
 2692|  16.3k|  gcry_err_code_t rc;
 2693|  16.3k|  va_list arg_ptr;
 2694|       |
 2695|  16.3k|  va_start (arg_ptr, list);
 2696|  16.3k|  rc = _gcry_sexp_vextract_param (sexp, path, list, arg_ptr);
 2697|  16.3k|  va_end (arg_ptr);
 2698|  16.3k|  return rc;
 2699|  16.3k|}
sexp.c:normalize:
  225|   208k|{
  226|   208k|  unsigned char *p;
  227|       |
  228|   208k|  if ( !list )
  ------------------
  |  Branch (228:8): [True: 0, False: 208k]
  ------------------
  229|      0|    return NULL;
  230|   208k|  p = list->d;
  231|   208k|  if ( *p == ST_STOP )
  ------------------
  |  |   91|   208k|#define ST_STOP  0
  ------------------
  |  Branch (231:8): [True: 0, False: 208k]
  ------------------
  232|      0|    {
  233|       |      /* this is "" */
  234|      0|      sexp_release ( list );
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  235|      0|      return NULL;
  236|      0|    }
  237|   208k|  if ( *p == ST_OPEN && p[1] == ST_CLOSE )
  ------------------
  |  |   94|   417k|#define ST_OPEN  3
  ------------------
                if ( *p == ST_OPEN && p[1] == ST_CLOSE )
  ------------------
  |  |   95|   201k|#define ST_CLOSE 4
  ------------------
  |  Branch (237:8): [True: 201k, False: 7.41k]
  |  Branch (237:25): [True: 0, False: 201k]
  ------------------
  238|      0|    {
  239|       |      /* this is "()" */
  240|      0|      sexp_release ( list );
  ------------------
  |  |  372|      0|#define sexp_release(a)              _gcry_sexp_release ((a))
  ------------------
  241|      0|      return NULL;
  242|      0|    }
  243|       |
  244|   208k|  return list;
  245|   208k|}
sexp.c:do_sexp_nth_data:
  704|   123k|{
  705|   123k|  const byte *p;
  706|   123k|  DATALEN n;
  707|   123k|  int level = 0;
  708|       |
  709|   123k|  *datalen = 0;
  710|   123k|  if ( !list )
  ------------------
  |  Branch (710:8): [True: 0, False: 123k]
  ------------------
  711|      0|    return NULL;
  712|       |
  713|   123k|  p = list->d;
  714|   123k|  if ( *p == ST_OPEN )
  ------------------
  |  |   94|   123k|#define ST_OPEN  3
  ------------------
  |  Branch (714:8): [True: 115k, False: 7.21k]
  ------------------
  715|   115k|    p++;	     /* Yep, a list. */
  716|  7.21k|  else if (number)
  ------------------
  |  Branch (716:12): [True: 0, False: 7.21k]
  ------------------
  717|      0|    return NULL;     /* Not a list but N > 0 requested. */
  718|       |
  719|       |  /* Skip over N elements. */
  720|   209k|  while (number > 0)
  ------------------
  |  Branch (720:10): [True: 86.6k, False: 123k]
  ------------------
  721|  86.6k|    {
  722|  86.6k|      if (*p == ST_DATA)
  ------------------
  |  |   92|  86.6k|#define ST_DATA  1  /* datalen follows */
  ------------------
  |  Branch (722:11): [True: 86.6k, False: 0]
  ------------------
  723|  86.6k|        {
  724|  86.6k|          memcpy ( &n, ++p, sizeof n );
  725|  86.6k|          p += sizeof n + n;
  726|  86.6k|          p--;
  727|  86.6k|          if ( !level )
  ------------------
  |  Branch (727:16): [True: 86.6k, False: 0]
  ------------------
  728|  86.6k|            number--;
  729|  86.6k|	}
  730|      0|      else if (*p == ST_OPEN)
  ------------------
  |  |   94|      0|#define ST_OPEN  3
  ------------------
  |  Branch (730:16): [True: 0, False: 0]
  ------------------
  731|      0|        {
  732|      0|          level++;
  733|      0|	}
  734|      0|      else if (*p == ST_CLOSE)
  ------------------
  |  |   95|      0|#define ST_CLOSE 4
  ------------------
  |  Branch (734:16): [True: 0, False: 0]
  ------------------
  735|      0|        {
  736|      0|          level--;
  737|      0|          if ( !level )
  ------------------
  |  Branch (737:16): [True: 0, False: 0]
  ------------------
  738|      0|            number--;
  739|      0|	}
  740|      0|      else if (*p == ST_STOP)
  ------------------
  |  |   91|      0|#define ST_STOP  0
  ------------------
  |  Branch (740:16): [True: 0, False: 0]
  ------------------
  741|      0|        {
  742|      0|          return NULL;
  743|      0|	}
  744|  86.6k|      p++;
  745|  86.6k|    }
  746|       |
  747|       |  /* If this is data, return it.  */
  748|   123k|  if (*p == ST_DATA)
  ------------------
  |  |   92|   123k|#define ST_DATA  1  /* datalen follows */
  ------------------
  |  Branch (748:7): [True: 123k, False: 5]
  ------------------
  749|   123k|    {
  750|   123k|      memcpy ( &n, ++p, sizeof n );
  751|   123k|      *datalen = n;
  752|   123k|      return (const char*)p + sizeof n;
  753|   123k|    }
  754|       |
  755|      5|  return NULL;
  756|   123k|}
sexp.c:do_vsexp_sscan:
 1099|  41.7k|{
 1100|  41.7k|  gcry_err_code_t err = 0;
 1101|  41.7k|  static const char tokenchars[] =
 1102|  41.7k|    "abcdefghijklmnopqrstuvwxyz"
 1103|  41.7k|    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
 1104|  41.7k|    "0123456789-./_:*+=";
 1105|  41.7k|  const char *p;
 1106|  41.7k|  size_t n;
 1107|  41.7k|  const char *digptr = NULL;
 1108|  41.7k|  const char *quoted = NULL;
 1109|  41.7k|  const char *tokenp = NULL;
 1110|  41.7k|  const char *hexfmt = NULL;
 1111|  41.7k|  const char *base64 = NULL;
 1112|  41.7k|  const char *disphint = NULL;
 1113|  41.7k|  const char *percent = NULL;
 1114|  41.7k|  int hexcount = 0;
 1115|  41.7k|  int b64count = 0;
 1116|  41.7k|  int quoted_esc = 0;
 1117|  41.7k|  size_t datalen = 0;
 1118|  41.7k|  size_t dummy_erroff;
 1119|  41.7k|  struct make_space_ctx c;
 1120|  41.7k|  int arg_counter = 0;
 1121|  41.7k|  int level = 0;
 1122|       |
 1123|  41.7k|  if (!retsexp)
  ------------------
  |  Branch (1123:7): [True: 0, False: 41.7k]
  ------------------
 1124|      0|    return GPG_ERR_INV_ARG;
 1125|  41.7k|  *retsexp = NULL;
 1126|       |
 1127|  41.7k|  if (!buffer)
  ------------------
  |  Branch (1127:7): [True: 0, False: 41.7k]
  ------------------
 1128|      0|    return GPG_ERR_INV_ARG;
 1129|       |
 1130|  41.7k|  if (!erroff)
  ------------------
  |  Branch (1130:7): [True: 41.7k, False: 0]
  ------------------
 1131|  41.7k|    erroff = &dummy_erroff;
 1132|       |
 1133|       |  /* Depending on whether ARG_LIST is non-zero or not, this macro gives
 1134|       |     us the next argument, either from the variable argument list as
 1135|       |     specified by ARG_PTR or from the argument array ARG_LIST.  */
 1136|  41.7k|#define ARG_NEXT(storage, type)                          \
 1137|  41.7k|  do                                                     \
 1138|  41.7k|    {                                                    \
 1139|  41.7k|      if (!arg_list)                                     \
 1140|  41.7k|	storage = va_arg (arg_ptr, type);                \
 1141|  41.7k|      else                                               \
 1142|  41.7k|	storage = *((type *) (arg_list[arg_counter++])); \
 1143|  41.7k|    }                                                    \
 1144|  41.7k|  while (0)
 1145|       |
 1146|       |  /* The MAKE_SPACE macro is used before each store operation to
 1147|       |     ensure that the buffer is large enough.  It requires a global
 1148|       |     context named C and jumps out to the label LEAVE on error! It
 1149|       |     also sets ERROFF using the variables BUFFER and P.  */
 1150|  41.7k|#define MAKE_SPACE(n)  do {                                                \
 1151|  41.7k|                            gpg_err_code_t _ms_err = make_space (&c, (n)); \
 1152|  41.7k|                            if (_ms_err)                                   \
 1153|  41.7k|                              {                                            \
 1154|  41.7k|                                err = _ms_err;                             \
 1155|  41.7k|                                *erroff = p - buffer;                      \
 1156|  41.7k|                                goto leave;                                \
 1157|  41.7k|                              }                                            \
 1158|  41.7k|                       } while (0)
 1159|       |
 1160|       |  /* The STORE_LEN macro is used to store the length N at buffer P. */
 1161|  41.7k|#define STORE_LEN(p,n) do {						   \
 1162|  41.7k|			    DATALEN ashort = (n);			   \
 1163|  41.7k|			    memcpy ( (p), &ashort, sizeof(ashort) );	   \
 1164|  41.7k|			    (p) += sizeof (ashort);			   \
 1165|  41.7k|			} while (0)
 1166|       |
 1167|       |  /* We assume that the internal representation takes less memory than
 1168|       |     the provided one.  However, we add space for one extra datalen so
 1169|       |     that the code which does the ST_CLOSE can use MAKE_SPACE */
 1170|  41.7k|  c.allocated = length + sizeof(DATALEN);
 1171|  41.7k|  if (length && _gcry_is_secure (buffer))
  ------------------
  |  Branch (1171:7): [True: 41.7k, False: 0]
  |  Branch (1171:17): [True: 0, False: 41.7k]
  ------------------
 1172|      0|    c.sexp = xtrymalloc_secure (sizeof *c.sexp + c.allocated - 1);
  ------------------
  |  |  140|      0|#define xtrymalloc_secure(a)   _gcry_malloc_secure ((a))
  ------------------
 1173|  41.7k|  else
 1174|  41.7k|    c.sexp = xtrymalloc (sizeof *c.sexp + c.allocated - 1);
  ------------------
  |  |  138|  41.7k|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
 1175|  41.7k|  if (!c.sexp)
  ------------------
  |  Branch (1175:7): [True: 0, False: 41.7k]
  ------------------
 1176|      0|    {
 1177|      0|      err = gpg_err_code_from_errno (errno);
 1178|      0|      *erroff = 0;
 1179|      0|      goto leave;
 1180|      0|    }
 1181|  41.7k|  c.pos = c.sexp->d;
 1182|       |
 1183|  1.20M|  for (p = buffer, n = length; n; p++, n--)
  ------------------
  |  Branch (1183:32): [True: 1.15M, False: 41.7k]
  ------------------
 1184|  1.15M|    {
 1185|  1.15M|      if (tokenp && !hexfmt)
  ------------------
  |  Branch (1185:11): [True: 673k, False: 485k]
  |  Branch (1185:21): [True: 673k, False: 0]
  ------------------
 1186|   673k|	{
 1187|   673k|	  if (strchr (tokenchars, *p))
  ------------------
  |  Branch (1187:8): [True: 509k, False: 164k]
  ------------------
 1188|   509k|	    continue;
 1189|   164k|	  else
 1190|   164k|	    {
 1191|   164k|	      datalen = p - tokenp;
 1192|   164k|	      MAKE_SPACE (datalen);
  ------------------
  |  | 1150|   164k|#define MAKE_SPACE(n)  do {                                                \
  |  | 1151|   164k|                            gpg_err_code_t _ms_err = make_space (&c, (n)); \
  |  | 1152|   164k|                            if (_ms_err)                                   \
  |  |  ------------------
  |  |  |  Branch (1152:33): [True: 0, False: 164k]
  |  |  ------------------
  |  | 1153|   164k|                              {                                            \
  |  | 1154|      0|                                err = _ms_err;                             \
  |  | 1155|      0|                                *erroff = p - buffer;                      \
  |  | 1156|      0|                                goto leave;                                \
  |  | 1157|      0|                              }                                            \
  |  | 1158|   164k|                       } while (0)
  |  |  ------------------
  |  |  |  Branch (1158:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1193|   164k|	      *c.pos++ = ST_DATA;
  ------------------
  |  |   92|   164k|#define ST_DATA  1  /* datalen follows */
  ------------------
 1194|   164k|	      STORE_LEN (c.pos, datalen);
  ------------------
  |  | 1161|   164k|#define STORE_LEN(p,n) do {						   \
  |  | 1162|   164k|			    DATALEN ashort = (n);			   \
  |  | 1163|   164k|			    memcpy ( (p), &ashort, sizeof(ashort) );	   \
  |  | 1164|   164k|			    (p) += sizeof (ashort);			   \
  |  | 1165|   164k|			} while (0)
  |  |  ------------------
  |  |  |  Branch (1165:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1195|   164k|	      memcpy (c.pos, tokenp, datalen);
 1196|   164k|	      c.pos += datalen;
 1197|   164k|	      tokenp = NULL;
 1198|   164k|	    }
 1199|   673k|	}
 1200|       |
 1201|   649k|      if (quoted)
  ------------------
  |  Branch (1201:11): [True: 0, False: 649k]
  ------------------
 1202|      0|	{
 1203|      0|	  if (quoted_esc)
  ------------------
  |  Branch (1203:8): [True: 0, False: 0]
  ------------------
 1204|      0|	    {
 1205|      0|	      switch (*p)
 1206|      0|		{
 1207|      0|		case 'b': case 't': case 'v': case 'n': case 'f':
  ------------------
  |  Branch (1207:3): [True: 0, False: 0]
  |  Branch (1207:13): [True: 0, False: 0]
  |  Branch (1207:23): [True: 0, False: 0]
  |  Branch (1207:33): [True: 0, False: 0]
  |  Branch (1207:43): [True: 0, False: 0]
  ------------------
 1208|      0|		case 'r': case '"': case '\'': case '\\':
  ------------------
  |  Branch (1208:3): [True: 0, False: 0]
  |  Branch (1208:13): [True: 0, False: 0]
  |  Branch (1208:23): [True: 0, False: 0]
  |  Branch (1208:34): [True: 0, False: 0]
  ------------------
 1209|      0|		  quoted_esc = 0;
 1210|      0|		  break;
 1211|       |
 1212|      0|		case '0': case '1': case '2': case '3': case '4':
  ------------------
  |  Branch (1212:3): [True: 0, False: 0]
  |  Branch (1212:13): [True: 0, False: 0]
  |  Branch (1212:23): [True: 0, False: 0]
  |  Branch (1212:33): [True: 0, False: 0]
  |  Branch (1212:43): [True: 0, False: 0]
  ------------------
 1213|      0|		case '5': case '6': case '7':
  ------------------
  |  Branch (1213:3): [True: 0, False: 0]
  |  Branch (1213:13): [True: 0, False: 0]
  |  Branch (1213:23): [True: 0, False: 0]
  ------------------
 1214|      0|		  if (!((n > 2)
  ------------------
  |  Branch (1214:11): [True: 0, False: 0]
  ------------------
 1215|      0|                        && (p[1] >= '0') && (p[1] <= '7')
  ------------------
  |  Branch (1215:28): [True: 0, False: 0]
  |  Branch (1215:45): [True: 0, False: 0]
  ------------------
 1216|      0|                        && (p[2] >= '0') && (p[2] <= '7')))
  ------------------
  |  Branch (1216:28): [True: 0, False: 0]
  |  Branch (1216:45): [True: 0, False: 0]
  ------------------
 1217|      0|		    {
 1218|      0|		      *erroff = p - buffer;
 1219|       |		      /* Invalid octal value.  */
 1220|      0|		      err = GPG_ERR_SEXP_BAD_QUOTATION;
 1221|      0|                      goto leave;
 1222|      0|		    }
 1223|      0|		  p += 2;
 1224|      0|		  n -= 2;
 1225|      0|		  quoted_esc = 0;
 1226|      0|		  break;
 1227|       |
 1228|      0|		case 'x':
  ------------------
  |  Branch (1228:3): [True: 0, False: 0]
  ------------------
 1229|      0|		  if (!((n > 2) && hexdigitp (p+1) && hexdigitp (p+2)))
  ------------------
  |  |  409|      0|#define hexdigitp(a) (digitp (a)                     \
  |  |  ------------------
  |  |  |  |  405|      0|#define digitp(p)   (*(p) >= '0' && *(p) <= '9')
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (405:22): [True: 0, False: 0]
  |  |  |  |  |  Branch (405:37): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  410|      0|                      || (*(a) >= 'A' && *(a) <= 'F')  \
  |  |  ------------------
  |  |  |  Branch (410:27): [True: 0, False: 0]
  |  |  |  Branch (410:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  411|      0|                      || (*(a) >= 'a' && *(a) <= 'f'))
  |  |  ------------------
  |  |  |  Branch (411:27): [True: 0, False: 0]
  |  |  |  Branch (411:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
              		  if (!((n > 2) && hexdigitp (p+1) && hexdigitp (p+2)))
  ------------------
  |  |  409|      0|#define hexdigitp(a) (digitp (a)                     \
  |  |  ------------------
  |  |  |  |  405|      0|#define digitp(p)   (*(p) >= '0' && *(p) <= '9')
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (405:22): [True: 0, False: 0]
  |  |  |  |  |  Branch (405:37): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  410|      0|                      || (*(a) >= 'A' && *(a) <= 'F')  \
  |  |  ------------------
  |  |  |  Branch (410:27): [True: 0, False: 0]
  |  |  |  Branch (410:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  411|      0|                      || (*(a) >= 'a' && *(a) <= 'f'))
  |  |  ------------------
  |  |  |  Branch (411:27): [True: 0, False: 0]
  |  |  |  Branch (411:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1229:11): [True: 0, False: 0]
  ------------------
 1230|      0|		    {
 1231|      0|		      *erroff = p - buffer;
 1232|       |		      /* Invalid hex value.  */
 1233|      0|		      err = GPG_ERR_SEXP_BAD_QUOTATION;
 1234|      0|                      goto leave;
 1235|      0|		    }
 1236|      0|		  p += 2;
 1237|      0|		  n -= 2;
 1238|      0|		  quoted_esc = 0;
 1239|      0|		  break;
 1240|       |
 1241|      0|		case '\r':
  ------------------
  |  Branch (1241:3): [True: 0, False: 0]
  ------------------
 1242|       |		  /* ignore CR[,LF] */
 1243|      0|		  if (n && (p[1] == '\n'))
  ------------------
  |  Branch (1243:9): [True: 0, False: 0]
  |  Branch (1243:14): [True: 0, False: 0]
  ------------------
 1244|      0|		    {
 1245|      0|		      p++;
 1246|      0|		      n--;
 1247|      0|		    }
 1248|      0|		  quoted_esc = 0;
 1249|      0|		  break;
 1250|       |
 1251|      0|		case '\n':
  ------------------
  |  Branch (1251:3): [True: 0, False: 0]
  ------------------
 1252|       |		  /* ignore LF[,CR] */
 1253|      0|		  if (n && (p[1] == '\r'))
  ------------------
  |  Branch (1253:9): [True: 0, False: 0]
  |  Branch (1253:14): [True: 0, False: 0]
  ------------------
 1254|      0|		    {
 1255|      0|		      p++;
 1256|      0|		      n--;
 1257|      0|		    }
 1258|      0|		  quoted_esc = 0;
 1259|      0|		  break;
 1260|       |
 1261|      0|		default:
  ------------------
  |  Branch (1261:3): [True: 0, False: 0]
  ------------------
 1262|      0|		  *erroff = p - buffer;
 1263|       |		  /* Invalid quoted string escape.  */
 1264|      0|		  err = GPG_ERR_SEXP_BAD_QUOTATION;
 1265|      0|                  goto leave;
 1266|      0|		}
 1267|      0|	    }
 1268|      0|	  else if (*p == '\\')
  ------------------
  |  Branch (1268:13): [True: 0, False: 0]
  ------------------
 1269|      0|	    quoted_esc = 1;
 1270|      0|	  else if (*p == '\"')
  ------------------
  |  Branch (1270:13): [True: 0, False: 0]
  ------------------
 1271|      0|	    {
 1272|       |	      /* Keep it easy - we know that the unquoted string will
 1273|       |		 never be larger. */
 1274|      0|	      unsigned char *save;
 1275|      0|	      size_t len;
 1276|       |
 1277|      0|	      quoted++; /* Skip leading quote.  */
 1278|      0|	      MAKE_SPACE (p - quoted);
  ------------------
  |  | 1150|      0|#define MAKE_SPACE(n)  do {                                                \
  |  | 1151|      0|                            gpg_err_code_t _ms_err = make_space (&c, (n)); \
  |  | 1152|      0|                            if (_ms_err)                                   \
  |  |  ------------------
  |  |  |  Branch (1152:33): [True: 0, False: 0]
  |  |  ------------------
  |  | 1153|      0|                              {                                            \
  |  | 1154|      0|                                err = _ms_err;                             \
  |  | 1155|      0|                                *erroff = p - buffer;                      \
  |  | 1156|      0|                                goto leave;                                \
  |  | 1157|      0|                              }                                            \
  |  | 1158|      0|                       } while (0)
  |  |  ------------------
  |  |  |  Branch (1158:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1279|      0|	      *c.pos++ = ST_DATA;
  ------------------
  |  |   92|      0|#define ST_DATA  1  /* datalen follows */
  ------------------
 1280|      0|	      save = c.pos;
 1281|      0|	      STORE_LEN (c.pos, 0); /* Will be fixed up later.  */
  ------------------
  |  | 1161|      0|#define STORE_LEN(p,n) do {						   \
  |  | 1162|      0|			    DATALEN ashort = (n);			   \
  |  | 1163|      0|			    memcpy ( (p), &ashort, sizeof(ashort) );	   \
  |  | 1164|      0|			    (p) += sizeof (ashort);			   \
  |  | 1165|      0|			} while (0)
  |  |  ------------------
  |  |  |  Branch (1165:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1282|      0|	      len = unquote_string (quoted, p - quoted, c.pos);
 1283|      0|	      c.pos += len;
 1284|      0|	      STORE_LEN (save, len);
  ------------------
  |  | 1161|      0|#define STORE_LEN(p,n) do {						   \
  |  | 1162|      0|			    DATALEN ashort = (n);			   \
  |  | 1163|      0|			    memcpy ( (p), &ashort, sizeof(ashort) );	   \
  |  | 1164|      0|			    (p) += sizeof (ashort);			   \
  |  | 1165|      0|			} while (0)
  |  |  ------------------
  |  |  |  Branch (1165:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1285|      0|	      quoted = NULL;
 1286|      0|	    }
 1287|      0|	}
 1288|   649k|      else if (hexfmt)
  ------------------
  |  Branch (1288:16): [True: 0, False: 649k]
  ------------------
 1289|      0|	{
 1290|      0|	  if (isxdigit (*p))
 1291|      0|	    hexcount++;
 1292|      0|	  else if (*p == '#')
  ------------------
  |  Branch (1292:13): [True: 0, False: 0]
  ------------------
 1293|      0|	    {
 1294|      0|	      if ((hexcount & 1))
  ------------------
  |  Branch (1294:12): [True: 0, False: 0]
  ------------------
 1295|      0|		{
 1296|      0|		  *erroff = p - buffer;
 1297|      0|		  err = GPG_ERR_SEXP_ODD_HEX_NUMBERS;
 1298|      0|                  goto leave;
 1299|      0|		}
 1300|       |
 1301|      0|	      datalen = hexcount / 2;
 1302|      0|	      MAKE_SPACE (datalen);
  ------------------
  |  | 1150|      0|#define MAKE_SPACE(n)  do {                                                \
  |  | 1151|      0|                            gpg_err_code_t _ms_err = make_space (&c, (n)); \
  |  | 1152|      0|                            if (_ms_err)                                   \
  |  |  ------------------
  |  |  |  Branch (1152:33): [True: 0, False: 0]
  |  |  ------------------
  |  | 1153|      0|                              {                                            \
  |  | 1154|      0|                                err = _ms_err;                             \
  |  | 1155|      0|                                *erroff = p - buffer;                      \
  |  | 1156|      0|                                goto leave;                                \
  |  | 1157|      0|                              }                                            \
  |  | 1158|      0|                       } while (0)
  |  |  ------------------
  |  |  |  Branch (1158:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1303|      0|	      *c.pos++ = ST_DATA;
  ------------------
  |  |   92|      0|#define ST_DATA  1  /* datalen follows */
  ------------------
 1304|      0|	      STORE_LEN (c.pos, datalen);
  ------------------
  |  | 1161|      0|#define STORE_LEN(p,n) do {						   \
  |  | 1162|      0|			    DATALEN ashort = (n);			   \
  |  | 1163|      0|			    memcpy ( (p), &ashort, sizeof(ashort) );	   \
  |  | 1164|      0|			    (p) += sizeof (ashort);			   \
  |  | 1165|      0|			} while (0)
  |  |  ------------------
  |  |  |  Branch (1165:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1305|      0|	      for (hexfmt++; hexfmt < p; hexfmt++)
  ------------------
  |  Branch (1305:23): [True: 0, False: 0]
  ------------------
 1306|      0|		{
 1307|      0|                  int tmpc;
 1308|       |
 1309|      0|		  if (whitespacep (hexfmt))
  ------------------
  |  Branch (1309:9): [True: 0, False: 0]
  ------------------
 1310|      0|		    continue;
 1311|      0|		  tmpc = hextonibble (*(const unsigned char*)hexfmt);
 1312|      0|                  for (hexfmt++; hexfmt < p && whitespacep (hexfmt); hexfmt++)
  ------------------
  |  Branch (1312:34): [True: 0, False: 0]
  |  Branch (1312:48): [True: 0, False: 0]
  ------------------
 1313|      0|		    ;
 1314|      0|                  if (hexfmt < p)
  ------------------
  |  Branch (1314:23): [True: 0, False: 0]
  ------------------
 1315|      0|                    {
 1316|      0|                      tmpc *= 16;
 1317|      0|                      tmpc += hextonibble (*(const unsigned char*)hexfmt);
 1318|      0|                    }
 1319|      0|                  *c.pos++ = tmpc;
 1320|      0|		}
 1321|      0|	      hexfmt = NULL;
 1322|      0|	    }
 1323|      0|	  else if (!whitespacep (p))
  ------------------
  |  Branch (1323:13): [True: 0, False: 0]
  ------------------
 1324|      0|	    {
 1325|      0|	      *erroff = p - buffer;
 1326|      0|	      err = GPG_ERR_SEXP_BAD_HEX_CHAR;
 1327|      0|              goto leave;
 1328|      0|	    }
 1329|      0|	}
 1330|   649k|      else if (base64)
  ------------------
  |  Branch (1330:16): [True: 0, False: 649k]
  ------------------
 1331|      0|        {
 1332|      0|          if (digitp (p) || alphap (p) || *p == '+' || *p == '/' || *p == '=')
  ------------------
  |  |  405|      0|#define digitp(p)   (*(p) >= '0' && *(p) <= '9')
  |  |  ------------------
  |  |  |  Branch (405:22): [True: 0, False: 0]
  |  |  |  Branch (405:37): [True: 0, False: 0]
  |  |  ------------------
  ------------------
                        if (digitp (p) || alphap (p) || *p == '+' || *p == '/' || *p == '=')
  ------------------
  |  |  407|      0|#define alphap(a)    (   (*(a) >= 'A' && *(a) <= 'Z')  \
  |  |  ------------------
  |  |  |  Branch (407:27): [True: 0, False: 0]
  |  |  |  Branch (407:42): [True: 0, False: 0]
  |  |  ------------------
  |  |  408|      0|                      || (*(a) >= 'a' && *(a) <= 'z'))
  |  |  ------------------
  |  |  |  Branch (408:27): [True: 0, False: 0]
  |  |  |  Branch (408:42): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1332:43): [True: 0, False: 0]
  |  Branch (1332:56): [True: 0, False: 0]
  |  Branch (1332:69): [True: 0, False: 0]
  ------------------
 1333|      0|            b64count++;
 1334|      0|          else if (*p == '|')
  ------------------
  |  Branch (1334:20): [True: 0, False: 0]
  ------------------
 1335|      0|            {
 1336|      0|              gpgrt_b64state_t b64state;
 1337|      0|              char *b64buf;
 1338|      0|              int i;
 1339|       |
 1340|      0|              base64++;         /* Skip beginning '|' */
 1341|      0|              b64buf = xtrymalloc (b64count);
  ------------------
  |  |  138|      0|#define xtrymalloc(a)    _gcry_malloc ((a))
  ------------------
 1342|      0|              if (!b64buf)
  ------------------
  |  Branch (1342:19): [True: 0, False: 0]
  ------------------
 1343|      0|                {
 1344|      0|                  err = gpg_err_code_from_syserror ();
 1345|      0|                  goto leave;
 1346|      0|                }
 1347|      0|              memcpy (b64buf, base64, b64count);
 1348|       |
 1349|      0|              b64state = gpgrt_b64dec_start (NULL);
 1350|      0|              if (!b64state)
  ------------------
  |  Branch (1350:19): [True: 0, False: 0]
  ------------------
 1351|      0|                {
 1352|      0|                  err = gpg_err_code_from_syserror ();
 1353|      0|                  xfree (b64buf);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1354|      0|                  goto leave;
 1355|      0|                }
 1356|      0|              err = gpgrt_b64dec_proc (b64state, b64buf, b64count,
 1357|      0|                                       &datalen);
 1358|      0|              if (err && gpg_err_code (err) != GPG_ERR_EOF)
  ------------------
  |  Branch (1358:19): [True: 0, False: 0]
  |  Branch (1358:26): [True: 0, False: 0]
  ------------------
 1359|      0|                {
 1360|      0|                  xfree (b64state);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1361|      0|                  xfree (b64buf);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1362|      0|                  goto leave;
 1363|      0|                }
 1364|      0|              err = gpgrt_b64dec_finish (b64state);
 1365|      0|              if (err)
  ------------------
  |  Branch (1365:19): [True: 0, False: 0]
  ------------------
 1366|      0|                {
 1367|      0|                  xfree (b64buf);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1368|      0|                  goto leave;
 1369|      0|                }
 1370|       |
 1371|      0|              MAKE_SPACE (datalen);
  ------------------
  |  | 1150|      0|#define MAKE_SPACE(n)  do {                                                \
  |  | 1151|      0|                            gpg_err_code_t _ms_err = make_space (&c, (n)); \
  |  | 1152|      0|                            if (_ms_err)                                   \
  |  |  ------------------
  |  |  |  Branch (1152:33): [True: 0, False: 0]
  |  |  ------------------
  |  | 1153|      0|                              {                                            \
  |  | 1154|      0|                                err = _ms_err;                             \
  |  | 1155|      0|                                *erroff = p - buffer;                      \
  |  | 1156|      0|                                goto leave;                                \
  |  | 1157|      0|                              }                                            \
  |  | 1158|      0|                       } while (0)
  |  |  ------------------
  |  |  |  Branch (1158:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1372|      0|              *c.pos++ = ST_DATA;
  ------------------
  |  |   92|      0|#define ST_DATA  1  /* datalen follows */
  ------------------
 1373|      0|              STORE_LEN (c.pos, datalen);
  ------------------
  |  | 1161|      0|#define STORE_LEN(p,n) do {						   \
  |  | 1162|      0|			    DATALEN ashort = (n);			   \
  |  | 1163|      0|			    memcpy ( (p), &ashort, sizeof(ashort) );	   \
  |  | 1164|      0|			    (p) += sizeof (ashort);			   \
  |  | 1165|      0|			} while (0)
  |  |  ------------------
  |  |  |  Branch (1165:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1374|      0|              for (i = 0; i < datalen; i++)
  ------------------
  |  Branch (1374:27): [True: 0, False: 0]
  ------------------
 1375|      0|                *c.pos++ = b64buf[i];
 1376|       |
 1377|      0|              xfree (b64buf);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1378|      0|              base64 = NULL;
 1379|      0|            }
 1380|      0|          else
 1381|      0|            {
 1382|      0|              *erroff = p - buffer;
 1383|      0|              err = GPG_ERR_SEXP_BAD_CHARACTER;
 1384|      0|              goto leave;
 1385|      0|            }
 1386|      0|	}
 1387|   649k|      else if (digptr)
  ------------------
  |  Branch (1387:16): [True: 0, False: 649k]
  ------------------
 1388|      0|	{
 1389|      0|	  if (digitp (p))
  ------------------
  |  |  405|      0|#define digitp(p)   (*(p) >= '0' && *(p) <= '9')
  |  |  ------------------
  |  |  |  Branch (405:22): [True: 0, False: 0]
  |  |  |  Branch (405:37): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1390|      0|	    ;
 1391|      0|	  else if (*p == ':')
  ------------------
  |  Branch (1391:13): [True: 0, False: 0]
  ------------------
 1392|      0|	    {
 1393|      0|	      datalen = atoi (digptr); /* FIXME: check for overflow.  */
 1394|      0|	      digptr = NULL;
 1395|      0|	      if (datalen > n - 1)
  ------------------
  |  Branch (1395:12): [True: 0, False: 0]
  ------------------
 1396|      0|		{
 1397|      0|		  *erroff = p - buffer;
 1398|       |		  /* Buffer too short.  */
 1399|      0|		  err = GPG_ERR_SEXP_STRING_TOO_LONG;
 1400|      0|                  goto leave;
 1401|      0|		}
 1402|       |	      /* Make a new list entry.  */
 1403|      0|	      MAKE_SPACE (datalen);
  ------------------
  |  | 1150|      0|#define MAKE_SPACE(n)  do {                                                \
  |  | 1151|      0|                            gpg_err_code_t _ms_err = make_space (&c, (n)); \
  |  | 1152|      0|                            if (_ms_err)                                   \
  |  |  ------------------
  |  |  |  Branch (1152:33): [True: 0, False: 0]
  |  |  ------------------
  |  | 1153|      0|                              {                                            \
  |  | 1154|      0|                                err = _ms_err;                             \
  |  | 1155|      0|                                *erroff = p - buffer;                      \
  |  | 1156|      0|                                goto leave;                                \
  |  | 1157|      0|                              }                                            \
  |  | 1158|      0|                       } while (0)
  |  |  ------------------
  |  |  |  Branch (1158:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1404|      0|	      *c.pos++ = ST_DATA;
  ------------------
  |  |   92|      0|#define ST_DATA  1  /* datalen follows */
  ------------------
 1405|      0|	      STORE_LEN (c.pos, datalen);
  ------------------
  |  | 1161|      0|#define STORE_LEN(p,n) do {						   \
  |  | 1162|      0|			    DATALEN ashort = (n);			   \
  |  | 1163|      0|			    memcpy ( (p), &ashort, sizeof(ashort) );	   \
  |  | 1164|      0|			    (p) += sizeof (ashort);			   \
  |  | 1165|      0|			} while (0)
  |  |  ------------------
  |  |  |  Branch (1165:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1406|      0|	      memcpy (c.pos, p + 1, datalen);
 1407|      0|	      c.pos += datalen;
 1408|      0|	      n -= datalen;
 1409|      0|	      p += datalen;
 1410|      0|	    }
 1411|      0|	  else if (*p == '\"')
  ------------------
  |  Branch (1411:13): [True: 0, False: 0]
  ------------------
 1412|      0|	    {
 1413|      0|	      digptr = NULL; /* We ignore the optional length.  */
 1414|      0|	      quoted = p;
 1415|      0|	      quoted_esc = 0;
 1416|      0|	    }
 1417|      0|	  else if (*p == '#')
  ------------------
  |  Branch (1417:13): [True: 0, False: 0]
  ------------------
 1418|      0|	    {
 1419|      0|	      digptr = NULL; /* We ignore the optional length.  */
 1420|      0|	      hexfmt = p;
 1421|      0|	      hexcount = 0;
 1422|      0|	    }
 1423|      0|          else if (*p == '|')
  ------------------
  |  Branch (1423:20): [True: 0, False: 0]
  ------------------
 1424|      0|            {
 1425|      0|              digptr = NULL; /* We ignore the optional length.  */
 1426|      0|              base64 = p;
 1427|      0|              b64count = 0;
 1428|      0|            }
 1429|      0|	  else
 1430|      0|	    {
 1431|      0|	      *erroff = p - buffer;
 1432|      0|	      err = GPG_ERR_SEXP_INV_LEN_SPEC;
 1433|      0|              goto leave;
 1434|      0|	    }
 1435|      0|	}
 1436|   649k|      else if (percent)
  ------------------
  |  Branch (1436:16): [True: 79.5k, False: 570k]
  ------------------
 1437|  79.5k|	{
 1438|  79.5k|	  if (*p == 'm' || *p == 'M')
  ------------------
  |  Branch (1438:8): [True: 62.8k, False: 16.7k]
  |  Branch (1438:21): [True: 9.23k, False: 7.46k]
  ------------------
 1439|  72.0k|	    {
 1440|       |	      /* Insert an MPI.  */
 1441|  72.0k|	      gcry_mpi_t m;
 1442|  72.0k|	      size_t nm = 0;
 1443|  72.0k|              int mpifmt = *p == 'm'? GCRYMPI_FMT_STD: GCRYMPI_FMT_USG;
  ------------------
  |  Branch (1443:28): [True: 62.8k, False: 9.23k]
  ------------------
 1444|       |
 1445|  72.0k|	      ARG_NEXT (m, gcry_mpi_t);
  ------------------
  |  | 1137|  72.0k|  do                                                     \
  |  | 1138|  72.0k|    {                                                    \
  |  | 1139|  72.0k|      if (!arg_list)                                     \
  |  |  ------------------
  |  |  |  Branch (1139:11): [True: 72.0k, False: 0]
  |  |  ------------------
  |  | 1140|  72.0k|	storage = va_arg (arg_ptr, type);                \
  |  | 1141|  72.0k|      else                                               \
  |  | 1142|  72.0k|	storage = *((type *) (arg_list[arg_counter++])); \
  |  | 1143|  72.0k|    }                                                    \
  |  | 1144|  72.0k|  while (0)
  |  |  ------------------
  |  |  |  Branch (1144:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1446|       |
 1447|  72.0k|              if (mpi_get_flag (m, GCRYMPI_FLAG_OPAQUE))
  ------------------
  |  |  566|  72.0k|#define mpi_get_flag(a,f)      _gcry_mpi_get_flag ((a), (f))
  |  |  ------------------
  |  |  |  Branch (566:32): [True: 27.0k, False: 44.9k]
  |  |  ------------------
  ------------------
 1448|  27.0k|                {
 1449|  27.0k|                  void *mp;
 1450|  27.0k|                  unsigned int nbits;
 1451|       |
 1452|  27.0k|                  mp = mpi_get_opaque (m, &nbits);
  ------------------
  |  |  562|  27.0k|#define mpi_get_opaque(a,b)    _gcry_mpi_get_opaque ((a), (b))
  ------------------
 1453|  27.0k|                  nm = (nbits+7)/8;
 1454|  27.0k|                  if (mp && nm)
  ------------------
  |  Branch (1454:23): [True: 27.0k, False: 5]
  |  Branch (1454:29): [True: 27.0k, False: 0]
  ------------------
 1455|  27.0k|                    {
 1456|  27.0k|                      MAKE_SPACE (nm);
  ------------------
  |  | 1150|  27.0k|#define MAKE_SPACE(n)  do {                                                \
  |  | 1151|  27.0k|                            gpg_err_code_t _ms_err = make_space (&c, (n)); \
  |  | 1152|  27.0k|                            if (_ms_err)                                   \
  |  |  ------------------
  |  |  |  Branch (1152:33): [True: 0, False: 27.0k]
  |  |  ------------------
  |  | 1153|  27.0k|                              {                                            \
  |  | 1154|      0|                                err = _ms_err;                             \
  |  | 1155|      0|                                *erroff = p - buffer;                      \
  |  | 1156|      0|                                goto leave;                                \
  |  | 1157|      0|                              }                                            \
  |  | 1158|  27.0k|                       } while (0)
  |  |  ------------------
  |  |  |  Branch (1158:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1457|  27.0k|                      if (!_gcry_is_secure (c.sexp->d)
  ------------------
  |  Branch (1457:27): [True: 27.0k, False: 0]
  ------------------
 1458|  27.0k|                          && mpi_get_flag (m, GCRYMPI_FLAG_SECURE))
  ------------------
  |  |  566|  27.0k|#define mpi_get_flag(a,f)      _gcry_mpi_get_flag ((a), (f))
  |  |  ------------------
  |  |  |  Branch (566:32): [True: 0, False: 27.0k]
  |  |  ------------------
  ------------------
 1459|      0|                        {
 1460|       |                          /* We have to switch to secure allocation.  */
 1461|      0|                          gcry_sexp_t newsexp;
 1462|      0|                          byte *newhead;
 1463|       |
 1464|      0|                          newsexp = xtrymalloc_secure (sizeof *newsexp
  ------------------
  |  |  140|      0|#define xtrymalloc_secure(a)   _gcry_malloc_secure ((a))
  ------------------
 1465|      0|                                                       + c.allocated - 1);
 1466|      0|                          if (!newsexp)
  ------------------
  |  Branch (1466:31): [True: 0, False: 0]
  ------------------
 1467|      0|                            {
 1468|      0|                              err = gpg_err_code_from_errno (errno);
 1469|      0|                              goto leave;
 1470|      0|                            }
 1471|      0|                          newhead = newsexp->d;
 1472|      0|                          memcpy (newhead, c.sexp->d, (c.pos - c.sexp->d));
 1473|      0|                          c.pos = newhead + (c.pos - c.sexp->d);
 1474|      0|                          xfree (c.sexp);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1475|      0|                          c.sexp = newsexp;
 1476|      0|                        }
 1477|       |
 1478|  27.0k|                      *c.pos++ = ST_DATA;
  ------------------
  |  |   92|  27.0k|#define ST_DATA  1  /* datalen follows */
  ------------------
 1479|  27.0k|                      STORE_LEN (c.pos, nm);
  ------------------
  |  | 1161|  27.0k|#define STORE_LEN(p,n) do {						   \
  |  | 1162|  27.0k|			    DATALEN ashort = (n);			   \
  |  | 1163|  27.0k|			    memcpy ( (p), &ashort, sizeof(ashort) );	   \
  |  | 1164|  27.0k|			    (p) += sizeof (ashort);			   \
  |  | 1165|  27.0k|			} while (0)
  |  |  ------------------
  |  |  |  Branch (1165:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1480|  27.0k|                      memcpy (c.pos, mp, nm);
 1481|  27.0k|                      c.pos += nm;
 1482|  27.0k|                    }
 1483|  27.0k|                }
 1484|  44.9k|              else
 1485|  44.9k|                {
 1486|  44.9k|                  if (mpifmt == GCRYMPI_FMT_USG && mpi_cmp_ui (m, 0) < 0)
  ------------------
  |  |  512|    564|#define mpi_cmp_ui( u, v )     _gcry_mpi_cmp_ui( (u), (v) )
  ------------------
  |  Branch (1486:23): [True: 564, False: 44.3k]
  |  Branch (1486:52): [True: 0, False: 564]
  ------------------
 1487|      0|                    {
 1488|      0|                      err = GPG_ERR_INV_ARG;
 1489|      0|                      goto leave;
 1490|      0|                    }
 1491|       |
 1492|  44.9k|                  err = _gcry_mpi_print (mpifmt, NULL, 0, &nm, m);
 1493|  44.9k|                  if (err)
  ------------------
  |  Branch (1493:23): [True: 0, False: 44.9k]
  ------------------
 1494|      0|                    goto leave;
 1495|       |
 1496|  44.9k|                  MAKE_SPACE (nm);
  ------------------
  |  | 1150|  44.9k|#define MAKE_SPACE(n)  do {                                                \
  |  | 1151|  44.9k|                            gpg_err_code_t _ms_err = make_space (&c, (n)); \
  |  | 1152|  44.9k|                            if (_ms_err)                                   \
  |  |  ------------------
  |  |  |  Branch (1152:33): [True: 0, False: 44.9k]
  |  |  ------------------
  |  | 1153|  44.9k|                              {                                            \
  |  | 1154|      0|                                err = _ms_err;                             \
  |  | 1155|      0|                                *erroff = p - buffer;                      \
  |  | 1156|      0|                                goto leave;                                \
  |  | 1157|      0|                              }                                            \
  |  | 1158|  44.9k|                       } while (0)
  |  |  ------------------
  |  |  |  Branch (1158:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1497|  44.9k|                  if (!_gcry_is_secure (c.sexp->d)
  ------------------
  |  Branch (1497:23): [True: 44.9k, False: 0]
  ------------------
 1498|  44.9k|                      && mpi_get_flag ( m, GCRYMPI_FLAG_SECURE))
  ------------------
  |  |  566|  44.9k|#define mpi_get_flag(a,f)      _gcry_mpi_get_flag ((a), (f))
  |  |  ------------------
  |  |  |  Branch (566:32): [True: 0, False: 44.9k]
  |  |  ------------------
  ------------------
 1499|      0|                    {
 1500|       |                      /* We have to switch to secure allocation.  */
 1501|      0|                      gcry_sexp_t newsexp;
 1502|      0|                      byte *newhead;
 1503|       |
 1504|      0|                      newsexp = xtrymalloc_secure (sizeof *newsexp
  ------------------
  |  |  140|      0|#define xtrymalloc_secure(a)   _gcry_malloc_secure ((a))
  ------------------
 1505|      0|                                                   + c.allocated - 1);
 1506|      0|                      if (!newsexp)
  ------------------
  |  Branch (1506:27): [True: 0, False: 0]
  ------------------
 1507|      0|                        {
 1508|      0|                          err = gpg_err_code_from_errno (errno);
 1509|      0|                          goto leave;
 1510|      0|                        }
 1511|      0|                      newhead = newsexp->d;
 1512|      0|                      memcpy (newhead, c.sexp->d, (c.pos - c.sexp->d));
 1513|      0|                      c.pos = newhead + (c.pos - c.sexp->d);
 1514|      0|                      xfree (c.sexp);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1515|      0|                      c.sexp = newsexp;
 1516|      0|                    }
 1517|       |
 1518|  44.9k|                  *c.pos++ = ST_DATA;
  ------------------
  |  |   92|  44.9k|#define ST_DATA  1  /* datalen follows */
  ------------------
 1519|  44.9k|                  STORE_LEN (c.pos, nm);
  ------------------
  |  | 1161|  44.9k|#define STORE_LEN(p,n) do {						   \
  |  | 1162|  44.9k|			    DATALEN ashort = (n);			   \
  |  | 1163|  44.9k|			    memcpy ( (p), &ashort, sizeof(ashort) );	   \
  |  | 1164|  44.9k|			    (p) += sizeof (ashort);			   \
  |  | 1165|  44.9k|			} while (0)
  |  |  ------------------
  |  |  |  Branch (1165:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1520|  44.9k|                  err = _gcry_mpi_print (mpifmt, c.pos, nm, &nm, m);
 1521|  44.9k|                  if (err)
  ------------------
  |  Branch (1521:23): [True: 0, False: 44.9k]
  ------------------
 1522|      0|                    goto leave;
 1523|  44.9k|                  c.pos += nm;
 1524|  44.9k|                }
 1525|  72.0k|	    }
 1526|  7.46k|	  else if (*p == 's')
  ------------------
  |  Branch (1526:13): [True: 7.46k, False: 0]
  ------------------
 1527|  7.46k|	    {
 1528|       |	      /* Insert an string.  */
 1529|  7.46k|	      const char *astr;
 1530|  7.46k|	      size_t alen;
 1531|       |
 1532|  7.46k|	      ARG_NEXT (astr, const char *);
  ------------------
  |  | 1137|  7.46k|  do                                                     \
  |  | 1138|  7.46k|    {                                                    \
  |  | 1139|  7.46k|      if (!arg_list)                                     \
  |  |  ------------------
  |  |  |  Branch (1139:11): [True: 7.46k, False: 0]
  |  |  ------------------
  |  | 1140|  7.46k|	storage = va_arg (arg_ptr, type);                \
  |  | 1141|  7.46k|      else                                               \
  |  | 1142|  7.46k|	storage = *((type *) (arg_list[arg_counter++])); \
  |  | 1143|  7.46k|    }                                                    \
  |  | 1144|  7.46k|  while (0)
  |  |  ------------------
  |  |  |  Branch (1144:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1533|  7.46k|	      alen = strlen (astr);
 1534|       |
 1535|  7.46k|	      MAKE_SPACE (alen);
  ------------------
  |  | 1150|  7.46k|#define MAKE_SPACE(n)  do {                                                \
  |  | 1151|  7.46k|                            gpg_err_code_t _ms_err = make_space (&c, (n)); \
  |  | 1152|  7.46k|                            if (_ms_err)                                   \
  |  |  ------------------
  |  |  |  Branch (1152:33): [True: 0, False: 7.46k]
  |  |  ------------------
  |  | 1153|  7.46k|                              {                                            \
  |  | 1154|      0|                                err = _ms_err;                             \
  |  | 1155|      0|                                *erroff = p - buffer;                      \
  |  | 1156|      0|                                goto leave;                                \
  |  | 1157|      0|                              }                                            \
  |  | 1158|  7.46k|                       } while (0)
  |  |  ------------------
  |  |  |  Branch (1158:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1536|  7.46k|	      *c.pos++ = ST_DATA;
  ------------------
  |  |   92|  7.46k|#define ST_DATA  1  /* datalen follows */
  ------------------
 1537|  7.46k|	      STORE_LEN (c.pos, alen);
  ------------------
  |  | 1161|  7.46k|#define STORE_LEN(p,n) do {						   \
  |  | 1162|  7.46k|			    DATALEN ashort = (n);			   \
  |  | 1163|  7.46k|			    memcpy ( (p), &ashort, sizeof(ashort) );	   \
  |  | 1164|  7.46k|			    (p) += sizeof (ashort);			   \
  |  | 1165|  7.46k|			} while (0)
  |  |  ------------------
  |  |  |  Branch (1165:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1538|  7.46k|	      memcpy (c.pos, astr, alen);
 1539|  7.46k|	      c.pos += alen;
 1540|  7.46k|	    }
 1541|      0|	  else if (*p == 'b')
  ------------------
  |  Branch (1541:13): [True: 0, False: 0]
  ------------------
 1542|      0|	    {
 1543|       |	      /* Insert a memory buffer.  */
 1544|      0|	      const char *astr;
 1545|      0|	      int alen;
 1546|       |
 1547|      0|	      ARG_NEXT (alen, int);
  ------------------
  |  | 1137|      0|  do                                                     \
  |  | 1138|      0|    {                                                    \
  |  | 1139|      0|      if (!arg_list)                                     \
  |  |  ------------------
  |  |  |  Branch (1139:11): [True: 0, False: 0]
  |  |  ------------------
  |  | 1140|      0|	storage = va_arg (arg_ptr, type);                \
  |  | 1141|      0|      else                                               \
  |  | 1142|      0|	storage = *((type *) (arg_list[arg_counter++])); \
  |  | 1143|      0|    }                                                    \
  |  | 1144|      0|  while (0)
  |  |  ------------------
  |  |  |  Branch (1144:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1548|      0|	      ARG_NEXT (astr, const char *);
  ------------------
  |  | 1137|      0|  do                                                     \
  |  | 1138|      0|    {                                                    \
  |  | 1139|      0|      if (!arg_list)                                     \
  |  |  ------------------
  |  |  |  Branch (1139:11): [True: 0, False: 0]
  |  |  ------------------
  |  | 1140|      0|	storage = va_arg (arg_ptr, type);                \
  |  | 1141|      0|      else                                               \
  |  | 1142|      0|	storage = *((type *) (arg_list[arg_counter++])); \
  |  | 1143|      0|    }                                                    \
  |  | 1144|      0|  while (0)
  |  |  ------------------
  |  |  |  Branch (1144:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1549|       |
 1550|      0|              if (alen < 0)
  ------------------
  |  Branch (1550:19): [True: 0, False: 0]
  ------------------
 1551|      0|                {
 1552|      0|                  *erroff = p - buffer;
 1553|      0|		  err = GPG_ERR_INV_ARG;
 1554|      0|                  goto leave;
 1555|      0|                }
 1556|       |
 1557|      0|	      MAKE_SPACE (alen);
  ------------------
  |  | 1150|      0|#define MAKE_SPACE(n)  do {                                                \
  |  | 1151|      0|                            gpg_err_code_t _ms_err = make_space (&c, (n)); \
  |  | 1152|      0|                            if (_ms_err)                                   \
  |  |  ------------------
  |  |  |  Branch (1152:33): [True: 0, False: 0]
  |  |  ------------------
  |  | 1153|      0|                              {                                            \
  |  | 1154|      0|                                err = _ms_err;                             \
  |  | 1155|      0|                                *erroff = p - buffer;                      \
  |  | 1156|      0|                                goto leave;                                \
  |  | 1157|      0|                              }                                            \
  |  | 1158|      0|                       } while (0)
  |  |  ------------------
  |  |  |  Branch (1158:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1558|      0|	      if (alen
  ------------------
  |  Branch (1558:12): [True: 0, False: 0]
  ------------------
 1559|      0|                  && !_gcry_is_secure (c.sexp->d)
  ------------------
  |  Branch (1559:22): [True: 0, False: 0]
  ------------------
 1560|      0|		  && _gcry_is_secure (astr))
  ------------------
  |  Branch (1560:8): [True: 0, False: 0]
  ------------------
 1561|      0|              {
 1562|       |		  /* We have to switch to secure allocation.  */
 1563|      0|		  gcry_sexp_t newsexp;
 1564|      0|		  byte *newhead;
 1565|       |
 1566|      0|		  newsexp = xtrymalloc_secure (sizeof *newsexp
  ------------------
  |  |  140|      0|#define xtrymalloc_secure(a)   _gcry_malloc_secure ((a))
  ------------------
 1567|      0|                                               + c.allocated - 1);
 1568|      0|                  if (!newsexp)
  ------------------
  |  Branch (1568:23): [True: 0, False: 0]
  ------------------
 1569|      0|                    {
 1570|      0|                      err = gpg_err_code_from_errno (errno);
 1571|      0|                      goto leave;
 1572|      0|                    }
 1573|      0|		  newhead = newsexp->d;
 1574|      0|		  memcpy (newhead, c.sexp->d, (c.pos - c.sexp->d));
 1575|      0|		  c.pos = newhead + (c.pos - c.sexp->d);
 1576|      0|		  xfree (c.sexp);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1577|      0|		  c.sexp = newsexp;
 1578|      0|		}
 1579|       |
 1580|      0|	      *c.pos++ = ST_DATA;
  ------------------
  |  |   92|      0|#define ST_DATA  1  /* datalen follows */
  ------------------
 1581|      0|	      STORE_LEN (c.pos, alen);
  ------------------
  |  | 1161|      0|#define STORE_LEN(p,n) do {						   \
  |  | 1162|      0|			    DATALEN ashort = (n);			   \
  |  | 1163|      0|			    memcpy ( (p), &ashort, sizeof(ashort) );	   \
  |  | 1164|      0|			    (p) += sizeof (ashort);			   \
  |  | 1165|      0|			} while (0)
  |  |  ------------------
  |  |  |  Branch (1165:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1582|      0|	      memcpy (c.pos, astr, alen);
 1583|      0|	      c.pos += alen;
 1584|      0|	    }
 1585|      0|	  else if (*p == 'd')
  ------------------
  |  Branch (1585:13): [True: 0, False: 0]
  ------------------
 1586|      0|	    {
 1587|       |	      /* Insert an integer as string.  */
 1588|      0|	      int aint;
 1589|      0|	      size_t alen;
 1590|      0|	      char buf[35];
 1591|       |
 1592|      0|	      ARG_NEXT (aint, int);
  ------------------
  |  | 1137|      0|  do                                                     \
  |  | 1138|      0|    {                                                    \
  |  | 1139|      0|      if (!arg_list)                                     \
  |  |  ------------------
  |  |  |  Branch (1139:11): [True: 0, False: 0]
  |  |  ------------------
  |  | 1140|      0|	storage = va_arg (arg_ptr, type);                \
  |  | 1141|      0|      else                                               \
  |  | 1142|      0|	storage = *((type *) (arg_list[arg_counter++])); \
  |  | 1143|      0|    }                                                    \
  |  | 1144|      0|  while (0)
  |  |  ------------------
  |  |  |  Branch (1144:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1593|      0|	      snprintf (buf, sizeof buf, "%d", aint);
 1594|      0|	      alen = strlen (buf);
 1595|      0|	      MAKE_SPACE (alen);
  ------------------
  |  | 1150|      0|#define MAKE_SPACE(n)  do {                                                \
  |  | 1151|      0|                            gpg_err_code_t _ms_err = make_space (&c, (n)); \
  |  | 1152|      0|                            if (_ms_err)                                   \
  |  |  ------------------
  |  |  |  Branch (1152:33): [True: 0, False: 0]
  |  |  ------------------
  |  | 1153|      0|                              {                                            \
  |  | 1154|      0|                                err = _ms_err;                             \
  |  | 1155|      0|                                *erroff = p - buffer;                      \
  |  | 1156|      0|                                goto leave;                                \
  |  | 1157|      0|                              }                                            \
  |  | 1158|      0|                       } while (0)
  |  |  ------------------
  |  |  |  Branch (1158:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1596|      0|	      *c.pos++ = ST_DATA;
  ------------------
  |  |   92|      0|#define ST_DATA  1  /* datalen follows */
  ------------------
 1597|      0|	      STORE_LEN (c.pos, alen);
  ------------------
  |  | 1161|      0|#define STORE_LEN(p,n) do {						   \
  |  | 1162|      0|			    DATALEN ashort = (n);			   \
  |  | 1163|      0|			    memcpy ( (p), &ashort, sizeof(ashort) );	   \
  |  | 1164|      0|			    (p) += sizeof (ashort);			   \
  |  | 1165|      0|			} while (0)
  |  |  ------------------
  |  |  |  Branch (1165:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1598|      0|	      memcpy (c.pos, buf, alen);
 1599|      0|	      c.pos += alen;
 1600|      0|	    }
 1601|      0|	  else if (*p == 'u')
  ------------------
  |  Branch (1601:13): [True: 0, False: 0]
  ------------------
 1602|      0|	    {
 1603|       |	      /* Insert an unsigned integer as string.  */
 1604|      0|	      unsigned int aint;
 1605|      0|	      size_t alen;
 1606|      0|	      char buf[35];
 1607|       |
 1608|      0|	      ARG_NEXT (aint, unsigned int);
  ------------------
  |  | 1137|      0|  do                                                     \
  |  | 1138|      0|    {                                                    \
  |  | 1139|      0|      if (!arg_list)                                     \
  |  |  ------------------
  |  |  |  Branch (1139:11): [True: 0, False: 0]
  |  |  ------------------
  |  | 1140|      0|	storage = va_arg (arg_ptr, type);                \
  |  | 1141|      0|      else                                               \
  |  | 1142|      0|	storage = *((type *) (arg_list[arg_counter++])); \
  |  | 1143|      0|    }                                                    \
  |  | 1144|      0|  while (0)
  |  |  ------------------
  |  |  |  Branch (1144:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1609|      0|	      snprintf (buf, sizeof buf, "%u", aint);
 1610|      0|	      alen = strlen (buf);
 1611|      0|	      MAKE_SPACE (alen);
  ------------------
  |  | 1150|      0|#define MAKE_SPACE(n)  do {                                                \
  |  | 1151|      0|                            gpg_err_code_t _ms_err = make_space (&c, (n)); \
  |  | 1152|      0|                            if (_ms_err)                                   \
  |  |  ------------------
  |  |  |  Branch (1152:33): [True: 0, False: 0]
  |  |  ------------------
  |  | 1153|      0|                              {                                            \
  |  | 1154|      0|                                err = _ms_err;                             \
  |  | 1155|      0|                                *erroff = p - buffer;                      \
  |  | 1156|      0|                                goto leave;                                \
  |  | 1157|      0|                              }                                            \
  |  | 1158|      0|                       } while (0)
  |  |  ------------------
  |  |  |  Branch (1158:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1612|      0|	      *c.pos++ = ST_DATA;
  ------------------
  |  |   92|      0|#define ST_DATA  1  /* datalen follows */
  ------------------
 1613|      0|	      STORE_LEN (c.pos, alen);
  ------------------
  |  | 1161|      0|#define STORE_LEN(p,n) do {						   \
  |  | 1162|      0|			    DATALEN ashort = (n);			   \
  |  | 1163|      0|			    memcpy ( (p), &ashort, sizeof(ashort) );	   \
  |  | 1164|      0|			    (p) += sizeof (ashort);			   \
  |  | 1165|      0|			} while (0)
  |  |  ------------------
  |  |  |  Branch (1165:13): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1614|      0|	      memcpy (c.pos, buf, alen);
 1615|      0|	      c.pos += alen;
 1616|      0|	    }
 1617|      0|	  else if (*p == 'S')
  ------------------
  |  Branch (1617:13): [True: 0, False: 0]
  ------------------
 1618|      0|	    {
 1619|       |	      /* Insert a gcry_sexp_t.  */
 1620|      0|	      gcry_sexp_t asexp;
 1621|      0|	      size_t alen, aoff;
 1622|       |
 1623|      0|	      ARG_NEXT (asexp, gcry_sexp_t);
  ------------------
  |  | 1137|      0|  do                                                     \
  |  | 1138|      0|    {                                                    \
  |  | 1139|      0|      if (!arg_list)                                     \
  |  |  ------------------
  |  |  |  Branch (1139:11): [True: 0, False: 0]
  |  |  ------------------
  |  | 1140|      0|	storage = va_arg (arg_ptr, type);                \
  |  | 1141|      0|      else                                               \
  |  | 1142|      0|	storage = *((type *) (arg_list[arg_counter++])); \
  |  | 1143|      0|    }                                                    \
  |  | 1144|      0|  while (0)
  |  |  ------------------
  |  |  |  Branch (1144:10): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1624|      0|              alen = get_internal_buffer (asexp, &aoff);
 1625|      0|              if (alen)
  ------------------
  |  Branch (1625:19): [True: 0, False: 0]
  ------------------
 1626|      0|                {
 1627|      0|                  MAKE_SPACE (alen);
  ------------------
  |  | 1150|      0|#define MAKE_SPACE(n)  do {                                                \
  |  | 1151|      0|                            gpg_err_code_t _ms_err = make_space (&c, (n)); \
  |  | 1152|      0|                            if (_ms_err)                                   \
  |  |  ------------------
  |  |  |  Branch (1152:33): [True: 0, False: 0]
  |  |  ------------------
  |  | 1153|      0|                              {                                            \
  |  | 1154|      0|                                err = _ms_err;                             \
  |  | 1155|      0|                                *erroff = p - buffer;                      \
  |  | 1156|      0|                                goto leave;                                \
  |  | 1157|      0|                              }                                            \
  |  | 1158|      0|                       } while (0)
  |  |  ------------------
  |  |  |  Branch (1158:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1628|      0|                  memcpy (c.pos, asexp->d + aoff, alen);
 1629|      0|                  c.pos += alen;
 1630|      0|                }
 1631|      0|	    }
 1632|      0|	  else
 1633|      0|	    {
 1634|      0|	      *erroff = p - buffer;
 1635|       |	      /* Invalid format specifier.  */
 1636|      0|	      err = GPG_ERR_SEXP_INV_LEN_SPEC;
 1637|      0|              goto leave;
 1638|      0|	    }
 1639|  79.5k|	  percent = NULL;
 1640|  79.5k|	}
 1641|   570k|      else if (*p == '(')
  ------------------
  |  Branch (1641:16): [True: 150k, False: 420k]
  ------------------
 1642|   150k|	{
 1643|   150k|	  if (disphint)
  ------------------
  |  Branch (1643:8): [True: 0, False: 150k]
  ------------------
 1644|      0|	    {
 1645|      0|	      *erroff = p - buffer;
 1646|       |	      /* Open display hint.  */
 1647|      0|	      err = GPG_ERR_SEXP_UNMATCHED_DH;
 1648|      0|              goto leave;
 1649|      0|	    }
 1650|   150k|	  MAKE_SPACE (0);
  ------------------
  |  | 1150|   150k|#define MAKE_SPACE(n)  do {                                                \
  |  | 1151|   150k|                            gpg_err_code_t _ms_err = make_space (&c, (n)); \
  |  | 1152|   150k|                            if (_ms_err)                                   \
  |  |  ------------------
  |  |  |  Branch (1152:33): [True: 0, False: 150k]
  |  |  ------------------
  |  | 1153|   150k|                              {                                            \
  |  | 1154|      0|                                err = _ms_err;                             \
  |  | 1155|      0|                                *erroff = p - buffer;                      \
  |  | 1156|      0|                                goto leave;                                \
  |  | 1157|      0|                              }                                            \
  |  | 1158|   150k|                       } while (0)
  |  |  ------------------
  |  |  |  Branch (1158:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1651|   150k|	  *c.pos++ = ST_OPEN;
  ------------------
  |  |   94|   150k|#define ST_OPEN  3
  ------------------
 1652|   150k|	  level++;
 1653|   150k|	}
 1654|   420k|      else if (*p == ')')
  ------------------
  |  Branch (1654:16): [True: 150k, False: 270k]
  ------------------
 1655|   150k|	{
 1656|       |	  /* Walk up.  */
 1657|   150k|	  if (disphint)
  ------------------
  |  Branch (1657:8): [True: 0, False: 150k]
  ------------------
 1658|      0|	    {
 1659|      0|	      *erroff = p - buffer;
 1660|       |	      /* Open display hint.  */
 1661|      0|	      err = GPG_ERR_SEXP_UNMATCHED_DH;
 1662|      0|              goto leave;
 1663|      0|	    }
 1664|       |
 1665|   150k|	  if (level == 0)
  ------------------
  |  Branch (1665:8): [True: 0, False: 150k]
  ------------------
 1666|      0|	    {
 1667|      0|	      *erroff = p - buffer;
 1668|      0|	      err = GPG_ERR_SEXP_UNMATCHED_PAREN;
 1669|      0|	      goto leave;
 1670|      0|	    }
 1671|   150k|	  MAKE_SPACE (0);
  ------------------
  |  | 1150|   150k|#define MAKE_SPACE(n)  do {                                                \
  |  | 1151|   150k|                            gpg_err_code_t _ms_err = make_space (&c, (n)); \
  |  | 1152|   150k|                            if (_ms_err)                                   \
  |  |  ------------------
  |  |  |  Branch (1152:33): [True: 0, False: 150k]
  |  |  ------------------
  |  | 1153|   150k|                              {                                            \
  |  | 1154|      0|                                err = _ms_err;                             \
  |  | 1155|      0|                                *erroff = p - buffer;                      \
  |  | 1156|      0|                                goto leave;                                \
  |  | 1157|      0|                              }                                            \
  |  | 1158|   150k|                       } while (0)
  |  |  ------------------
  |  |  |  Branch (1158:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1672|   150k|	  *c.pos++ = ST_CLOSE;
  ------------------
  |  |   95|   150k|#define ST_CLOSE 4
  ------------------
 1673|   150k|	  level--;
 1674|   150k|	}
 1675|   270k|      else if (*p == '\"')
  ------------------
  |  Branch (1675:16): [True: 0, False: 270k]
  ------------------
 1676|      0|	{
 1677|      0|	  quoted = p;
 1678|      0|	  quoted_esc = 0;
 1679|      0|	}
 1680|   270k|      else if (*p == '#')
  ------------------
  |  Branch (1680:16): [True: 0, False: 270k]
  ------------------
 1681|      0|	{
 1682|      0|	  hexfmt = p;
 1683|      0|	  hexcount = 0;
 1684|      0|	}
 1685|   270k|      else if (*p == '|')
  ------------------
  |  Branch (1685:16): [True: 0, False: 270k]
  ------------------
 1686|      0|        {
 1687|      0|          base64 = p;
 1688|      0|          b64count = 0;
 1689|      0|        }
 1690|   270k|      else if (*p == '[')
  ------------------
  |  Branch (1690:16): [True: 0, False: 270k]
  ------------------
 1691|      0|	{
 1692|      0|	  if (disphint)
  ------------------
  |  Branch (1692:8): [True: 0, False: 0]
  ------------------
 1693|      0|	    {
 1694|      0|	      *erroff = p - buffer;
 1695|       |	      /* Open display hint.  */
 1696|      0|	      err = GPG_ERR_SEXP_NESTED_DH;
 1697|      0|              goto leave;
 1698|      0|	    }
 1699|      0|	  disphint = p;
 1700|      0|	}
 1701|   270k|      else if (*p == ']')
  ------------------
  |  Branch (1701:16): [True: 0, False: 270k]
  ------------------
 1702|      0|	{
 1703|      0|	  if (!disphint)
  ------------------
  |  Branch (1703:8): [True: 0, False: 0]
  ------------------
 1704|      0|	    {
 1705|      0|	      *erroff = p - buffer;
 1706|       |	      /* Open display hint.  */
 1707|      0|	      err = GPG_ERR_SEXP_UNMATCHED_DH;
 1708|      0|              goto leave;
 1709|      0|	    }
 1710|      0|	  disphint = NULL;
 1711|      0|	}
 1712|   270k|      else if (digitp (p))
  ------------------
  |  |  405|   270k|#define digitp(p)   (*(p) >= '0' && *(p) <= '9')
  |  |  ------------------
  |  |  |  Branch (405:22): [True: 164k, False: 105k]
  |  |  |  Branch (405:37): [True: 0, False: 164k]
  |  |  ------------------
  ------------------
 1713|      0|	{
 1714|      0|	  if (*p == '0')
  ------------------
  |  Branch (1714:8): [True: 0, False: 0]
  ------------------
 1715|      0|	    {
 1716|       |	      /* A length may not begin with zero.  */
 1717|      0|	      *erroff = p - buffer;
 1718|      0|	      err = GPG_ERR_SEXP_ZERO_PREFIX;
 1719|      0|              goto leave;
 1720|      0|	    }
 1721|      0|	  digptr = p;
 1722|      0|	}
 1723|   270k|      else if (strchr (tokenchars, *p))
  ------------------
  |  Branch (1723:16): [True: 164k, False: 105k]
  ------------------
 1724|   164k|	tokenp = p;
 1725|   105k|      else if (whitespacep (p))
  ------------------
  |  Branch (1725:16): [True: 26.3k, False: 79.5k]
  ------------------
 1726|  26.3k|	;
 1727|  79.5k|      else if (*p == '{')
  ------------------
  |  Branch (1727:16): [True: 0, False: 79.5k]
  ------------------
 1728|      0|	{
 1729|       |	  /* fixme: handle rescanning: we can do this by saving our
 1730|       |	     current state and start over at p+1 -- Hmmm. At this
 1731|       |	     point here we are in a well defined state, so we don't
 1732|       |	     need to save it.  Great.  */
 1733|      0|	  *erroff = p - buffer;
 1734|      0|	  err = GPG_ERR_SEXP_UNEXPECTED_PUNC;
 1735|      0|          goto leave;
 1736|      0|	}
 1737|  79.5k|      else if (strchr ("&\\", *p))
  ------------------
  |  Branch (1737:16): [True: 0, False: 79.5k]
  ------------------
 1738|      0|	{
 1739|       |	  /* Reserved punctuation.  */
 1740|      0|	  *erroff = p - buffer;
 1741|      0|	  err = GPG_ERR_SEXP_UNEXPECTED_PUNC;
 1742|      0|          goto leave;
 1743|      0|	}
 1744|  79.5k|      else if (argflag && (*p == '%'))
  ------------------
  |  Branch (1744:16): [True: 79.5k, False: 0]
  |  Branch (1744:27): [True: 79.5k, False: 0]
  ------------------
 1745|  79.5k|	percent = p;
 1746|      0|      else
 1747|      0|	{
 1748|       |	  /* Bad or unavailable.  */
 1749|      0|	  *erroff = p - buffer;
 1750|      0|	  err = GPG_ERR_SEXP_BAD_CHARACTER;
 1751|      0|          goto leave;
 1752|      0|	}
 1753|   649k|    }
 1754|  41.7k|  MAKE_SPACE (0);
  ------------------
  |  | 1150|  41.7k|#define MAKE_SPACE(n)  do {                                                \
  |  | 1151|  41.7k|                            gpg_err_code_t _ms_err = make_space (&c, (n)); \
  |  | 1152|  41.7k|                            if (_ms_err)                                   \
  |  |  ------------------
  |  |  |  Branch (1152:33): [True: 0, False: 41.7k]
  |  |  ------------------
  |  | 1153|  41.7k|                              {                                            \
  |  | 1154|      0|                                err = _ms_err;                             \
  |  | 1155|      0|                                *erroff = p - buffer;                      \
  |  | 1156|      0|                                goto leave;                                \
  |  | 1157|      0|                              }                                            \
  |  | 1158|  41.7k|                       } while (0)
  |  |  ------------------
  |  |  |  Branch (1158:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1755|  41.7k|  *c.pos++ = ST_STOP;
  ------------------
  |  |   91|  41.7k|#define ST_STOP  0
  ------------------
 1756|       |
 1757|  41.7k|  if (level && !err)
  ------------------
  |  Branch (1757:7): [True: 0, False: 41.7k]
  |  Branch (1757:16): [True: 0, False: 0]
  ------------------
 1758|      0|    err = GPG_ERR_SEXP_UNMATCHED_PAREN;
 1759|       |
 1760|  41.7k| leave:
 1761|  41.7k|  if (err)
  ------------------
  |  Branch (1761:7): [True: 0, False: 41.7k]
  ------------------
 1762|      0|    {
 1763|       |      /* Error -> deallocate.  */
 1764|      0|      if (c.sexp)
  ------------------
  |  Branch (1764:11): [True: 0, False: 0]
  ------------------
 1765|      0|        {
 1766|       |          /* Extra paranoid wipe on error. */
 1767|      0|          if (_gcry_is_secure (c.sexp))
  ------------------
  |  Branch (1767:15): [True: 0, False: 0]
  ------------------
 1768|      0|            wipememory (c.sexp, sizeof (struct gcry_sexp) + c.allocated - 1);
  ------------------
  |  |  398|      0|#define wipememory(_ptr,_len) wipememory2((_ptr),0,(_len))
  |  |  ------------------
  |  |  |  |  388|      0|#define wipememory2(_ptr,_set,_len) do { \
  |  |  |  |  389|      0|	      if (!CONSTANT_P(_len) || !CONSTANT_P(_set)) { \
  |  |  |  |  ------------------
  |  |  |  |  |  |   87|      0|#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: 0, False: 0]
  |  |  |  |  |  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|      0|	      } 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|      0|	    } while(0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (397:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1769|      0|          xfree (c.sexp);
  ------------------
  |  |  150|      0|#define xfree(a)         _gcry_free ((a))
  ------------------
 1770|      0|        }
 1771|      0|    }
 1772|  41.7k|  else
 1773|  41.7k|    *retsexp = normalize (c.sexp);
 1774|       |
 1775|  41.7k|  return err;
 1776|  41.7k|#undef MAKE_SPACE
 1777|  41.7k|#undef STORE_LEN
 1778|  41.7k|}
sexp.c:make_space:
  976|   585k|{
  977|   585k|  size_t used = c->pos - c->sexp->d;
  978|       |
  979|   585k|  if ( used + n + sizeof(DATALEN) + 1 >= c->allocated )
  ------------------
  |  Branch (979:8): [True: 79.5k, False: 506k]
  ------------------
  980|  79.5k|    {
  981|  79.5k|      gcry_sexp_t newsexp;
  982|  79.5k|      byte *newhead;
  983|  79.5k|      size_t newsize;
  984|       |
  985|  79.5k|      newsize = c->allocated + 2*(n+sizeof(DATALEN)+1);
  986|  79.5k|      if (newsize <= c->allocated)
  ------------------
  |  Branch (986:11): [True: 0, False: 79.5k]
  ------------------
  987|      0|        return GPG_ERR_TOO_LARGE;
  988|  79.5k|      newsexp = xtryrealloc ( c->sexp, sizeof *newsexp + newsize - 1);
  ------------------
  |  |  142|  79.5k|#define xtryrealloc(a,b) _gcry_realloc ((a),(b))
  ------------------
  989|  79.5k|      if (!newsexp)
  ------------------
  |  Branch (989:11): [True: 0, False: 79.5k]
  ------------------
  990|      0|        return gpg_err_code_from_errno (errno);
  991|  79.5k|      c->allocated = newsize;
  992|  79.5k|      newhead = newsexp->d;
  993|  79.5k|      c->pos = newhead + used;
  994|  79.5k|      c->sexp = newsexp;
  995|  79.5k|    }
  996|   585k|  return 0;
  997|   585k|}
sexp.c:whitespacep:
  120|   178k|{
  121|   178k|  switch (*p)
  122|   178k|    {
  123|  26.3k|    case ' ': case '\t': case '\v': case '\f': case '\r': case '\n': return 1;
  ------------------
  |  Branch (123:5): [True: 26.3k, False: 152k]
  |  Branch (123:15): [True: 0, False: 178k]
  |  Branch (123:26): [True: 0, False: 178k]
  |  Branch (123:37): [True: 0, False: 178k]
  |  Branch (123:48): [True: 0, False: 178k]
  |  Branch (123:59): [True: 0, False: 178k]
  ------------------
  124|   152k|    default: return 0;
  ------------------
  |  Branch (124:5): [True: 152k, False: 26.3k]
  ------------------
  125|   178k|    }
  126|   178k|}

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

gcry_sexp_build:
  112|  41.7k|{
  113|  41.7k|  gcry_err_code_t rc;
  114|  41.7k|  va_list arg_ptr;
  115|       |
  116|  41.7k|  va_start (arg_ptr, format);
  117|  41.7k|  rc = _gcry_sexp_vbuild (retsexp, erroff, format, arg_ptr);
  118|  41.7k|  va_end (arg_ptr);
  119|  41.7k|  return gpg_error (rc);
  120|  41.7k|}
gcry_sexp_release:
  131|  42.0k|{
  132|  42.0k|  _gcry_sexp_release (sexp);
  133|  42.0k|}
gcry_mpi_release:
  283|   331k|{
  284|   331k|  _gcry_mpi_release (a);
  285|   331k|}
gcry_mpi_copy:
  289|    866|{
  290|    866|  return _gcry_mpi_copy (a);
  291|    866|}
gcry_mpi_scan:
  357|  71.8k|{
  358|  71.8k|  return gpg_error (_gcry_mpi_scan (ret_mpi, format, buffer, buflen, nscanned));
  359|  71.8k|}
gcry_mpi_print:
  366|  72.6k|{
  367|  72.6k|  return gpg_error (_gcry_mpi_print (format, buffer, buflen, nwritten, a));
  368|  72.6k|}
gcry_mpi_get_nbits:
  634|  19.6k|{
  635|  19.6k|  return _gcry_mpi_get_nbits (a);
  636|  19.6k|}
gcry_mpi_set_opaque:
  682|  82.5k|{
  683|  82.5k|  return _gcry_mpi_set_opaque (a, p, nbits);
  684|  82.5k|}
gcry_mpi_set_opaque_copy:
  688|  9.94k|{
  689|  9.94k|  return _gcry_mpi_set_opaque_copy (a, p, nbits);
  690|  9.94k|}
gcry_mpi_get_opaque:
  694|  68.8k|{
  695|  68.8k|  return _gcry_mpi_get_opaque (a, nbits);
  696|  68.8k|}
gcry_mpi_set_flag:
  700|  22.3k|{
  701|  22.3k|  _gcry_mpi_set_flag (a, flag);
  702|  22.3k|}
gcry_mpi_get_flag:
  712|   149k|{
  713|   149k|  return _gcry_mpi_get_flag (a, flag);
  714|   149k|}
gcry_cipher_algo_info:
  837|   128k|{
  838|   128k|  if (!fips_is_operational ())
  ------------------
  |  |  477|   128k|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 1, False: 128k]
  |  |  ------------------
  |  |  478|   128k|                _gcry_global_is_operational() : \
  |  |  479|   128k|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|   256k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 128k, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (838:7): [True: 0, False: 128k]
  ------------------
  839|      0|    return gpg_error (fips_not_operational ());
  ------------------
  |  |  481|      0|#define fips_not_operational()  (GPG_ERR_NOT_OPERATIONAL)
  ------------------
  840|       |
  841|   128k|  return gpg_error (_gcry_cipher_algo_info (algo, what, buffer, nbytes));
  842|   128k|}
gcry_pk_verify:
 1058|  11.8k|{
 1059|  11.8k|  if (!fips_is_operational ())
  ------------------
  |  |  477|  11.8k|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 0, False: 11.8k]
  |  |  ------------------
  |  |  478|  11.8k|                _gcry_global_is_operational() : \
  |  |  479|  11.8k|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|  23.6k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 11.8k, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1059:7): [True: 0, False: 11.8k]
  ------------------
 1060|      0|    return gpg_error (fips_not_operational ());
  ------------------
  |  |  481|      0|#define fips_not_operational()  (GPG_ERR_NOT_OPERATIONAL)
  ------------------
 1061|  11.8k|  return gpg_error (_gcry_pk_verify (sigval, data, pkey));
 1062|  11.8k|}
gcry_pk_algo_info:
 1104|  34.6k|{
 1105|  34.6k|  if (!fips_is_operational ())
  ------------------
  |  |  477|  34.6k|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 0, False: 34.6k]
  |  |  ------------------
  |  |  478|  34.6k|                _gcry_global_is_operational() : \
  |  |  479|  34.6k|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|  69.2k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 34.6k, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1105:7): [True: 0, False: 34.6k]
  ------------------
 1106|      0|    return gpg_error (fips_not_operational ());
  ------------------
  |  |  481|      0|#define fips_not_operational()  (GPG_ERR_NOT_OPERATIONAL)
  ------------------
 1107|       |
 1108|  34.6k|  return gpg_error (_gcry_pk_algo_info (algo, what, buffer, nbytes));
 1109|  34.6k|}
gcry_pk_get_nbits:
 1125|  5.55k|{
 1126|  5.55k|  if (!fips_is_operational ())
  ------------------
  |  |  477|  5.55k|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 0, False: 5.55k]
  |  |  ------------------
  |  |  478|  5.55k|                _gcry_global_is_operational() : \
  |  |  479|  5.55k|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|  11.1k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 5.55k, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1126:7): [True: 0, False: 5.55k]
  ------------------
 1127|      0|    {
 1128|      0|      (void)fips_not_operational ();
  ------------------
  |  |  481|      0|#define fips_not_operational()  (GPG_ERR_NOT_OPERATIONAL)
  ------------------
 1129|      0|      return 0;
 1130|      0|    }
 1131|       |
 1132|  5.55k|  return _gcry_pk_get_nbits (key);
 1133|  5.55k|}
gcry_md_open:
 1194|   132k|{
 1195|   132k|  if (!fips_is_operational ())
  ------------------
  |  |  477|   132k|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 0, False: 132k]
  |  |  ------------------
  |  |  478|   132k|                _gcry_global_is_operational() : \
  |  |  479|   132k|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|   265k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 132k, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1195:7): [True: 0, False: 132k]
  ------------------
 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|   132k|  return gpg_error (_gcry_md_open (h, algo, flags));
 1202|   132k|}
gcry_md_close:
 1206|   540k|{
 1207|   540k|  _gcry_md_close (hd);
 1208|   540k|}
gcry_md_enable:
 1212|  84.4k|{
 1213|  84.4k|  if (!fips_is_operational ())
  ------------------
  |  |  477|  84.4k|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 0, False: 84.4k]
  |  |  ------------------
  |  |  478|  84.4k|                _gcry_global_is_operational() : \
  |  |  479|  84.4k|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|   168k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 84.4k, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1213:7): [True: 0, False: 84.4k]
  ------------------
 1214|      0|    return gpg_error (fips_not_operational ());
  ------------------
  |  |  481|      0|#define fips_not_operational()  (GPG_ERR_NOT_OPERATIONAL)
  ------------------
 1215|  84.4k|  return gpg_error (_gcry_md_enable (hd, algo));
 1216|  84.4k|}
gcry_md_copy:
 1220|  3.12k|{
 1221|  3.12k|  if (!fips_is_operational ())
  ------------------
  |  |  477|  3.12k|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 0, False: 3.12k]
  |  |  ------------------
  |  |  478|  3.12k|                _gcry_global_is_operational() : \
  |  |  479|  3.12k|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|  6.25k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 3.12k, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1221:7): [True: 0, False: 3.12k]
  ------------------
 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|  3.12k|  return gpg_error (_gcry_md_copy (bhd, ahd));
 1227|  3.12k|}
gcry_md_reset:
 1231|  17.6k|{
 1232|  17.6k|  _gcry_md_reset (hd);
 1233|  17.6k|}
gcry_md_ctl:
 1237|  60.5k|{
 1238|  60.5k|  if (!fips_is_operational ())
  ------------------
  |  |  477|  60.5k|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 0, False: 60.5k]
  |  |  ------------------
  |  |  478|  60.5k|                _gcry_global_is_operational() : \
  |  |  479|  60.5k|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|   121k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 60.5k, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1238:7): [True: 0, False: 60.5k]
  ------------------
 1239|      0|    return gpg_error (fips_not_operational ());
  ------------------
  |  |  481|      0|#define fips_not_operational()  (GPG_ERR_NOT_OPERATIONAL)
  ------------------
 1240|  60.5k|  return gpg_error (_gcry_md_ctl (hd, cmd, buffer, buflen));
 1241|  60.5k|}
gcry_md_write:
 1245|   125k|{
 1246|   125k|  if (!fips_is_operational ())
  ------------------
  |  |  477|   125k|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 0, False: 125k]
  |  |  ------------------
  |  |  478|   125k|                _gcry_global_is_operational() : \
  |  |  479|   125k|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|   250k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 125k, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1246:7): [True: 0, False: 125k]
  ------------------
 1247|      0|    {
 1248|      0|      (void)fips_not_operational ();
  ------------------
  |  |  481|      0|#define fips_not_operational()  (GPG_ERR_NOT_OPERATIONAL)
  ------------------
 1249|      0|      return;
 1250|      0|    }
 1251|   125k|  _gcry_md_write (hd, buffer, length);
 1252|   125k|}
gcry_md_read:
 1256|  42.4k|{
 1257|  42.4k|  return _gcry_md_read (hd, algo);
 1258|  42.4k|}
gcry_md_get_algo:
 1294|  29.7k|{
 1295|  29.7k|  if (!fips_is_operational ())
  ------------------
  |  |  477|  29.7k|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 0, False: 29.7k]
  |  |  ------------------
  |  |  478|  29.7k|                _gcry_global_is_operational() : \
  |  |  479|  29.7k|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|  59.4k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 29.7k, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1295:7): [True: 0, False: 29.7k]
  ------------------
 1296|      0|    {
 1297|      0|      (void)fips_not_operational ();
  ------------------
  |  |  481|      0|#define fips_not_operational()  (GPG_ERR_NOT_OPERATIONAL)
  ------------------
 1298|      0|      fips_signal_error ("used in non-operational state");
  ------------------
  |  |  459|      0|           _gcry_fips_signal_error (__FILE__, __LINE__, __FUNCTION__, 0, (a))
  ------------------
 1299|      0|      return 0;
 1300|      0|    }
 1301|  29.7k|  return _gcry_md_get_algo (hd);
 1302|  29.7k|}
gcry_md_get_algo_dlen:
 1306|  44.7k|{
 1307|  44.7k|  return _gcry_md_get_algo_dlen (algo);
 1308|  44.7k|}
gcry_md_is_enabled:
 1312|  3.04k|{
 1313|  3.04k|  if (!fips_is_operational ())
  ------------------
  |  |  477|  3.04k|        (!_gcry_global_any_init_done ? \
  |  |  ------------------
  |  |  |  Branch (477:10): [True: 0, False: 3.04k]
  |  |  ------------------
  |  |  478|  3.04k|                _gcry_global_is_operational() : \
  |  |  479|  3.04k|                (!fips_mode () || _gcry_global_is_operational ()))
  |  |  ------------------
  |  |  |  |  449|  6.08k|#define fips_mode() (!_gcry_no_fips_mode_required)
  |  |  ------------------
  |  |  |  Branch (479:18): [True: 3.04k, False: 0]
  |  |  |  Branch (479:35): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (1313:7): [True: 0, False: 3.04k]
  ------------------
 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|  3.04k|  return _gcry_md_is_enabled (a, algo);
 1320|  3.04k|}
gcry_md_is_secure:
 1324|  2.22k|{
 1325|  2.22k|  return _gcry_md_is_secure (a);
 1326|  2.22k|}
gcry_md_algo_info:
 1339|  54.0k|{
 1340|  54.0k|  return gpg_error (_gcry_md_algo_info (algo, what, buffer, nbytes));
 1341|  54.0k|}
gcry_md_algo_name:
 1345|     72|{
 1346|     72|  return _gcry_md_algo_name (algo);
 1347|     72|}
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|   242k|{
 1627|   242k|  return _gcry_malloc (n);
 1628|   242k|}
gcry_calloc:
 1632|  40.5k|{
 1633|  40.5k|  return _gcry_calloc (n, m);
 1634|  40.5k|}
gcry_strdup:
 1656|  2.30k|{
 1657|  2.30k|  return _gcry_strdup (string);
 1658|  2.30k|}
gcry_xmalloc:
 1662|  1.11M|{
 1663|  1.11M|  return _gcry_xmalloc (n);
 1664|  1.11M|}
gcry_xcalloc:
 1668|   508k|{
 1669|   508k|  return _gcry_xcalloc (n, m);
 1670|   508k|}
gcry_xcalloc_secure:
 1680|  3.53k|{
 1681|  3.53k|  return _gcry_xcalloc_secure (n, m);
 1682|  3.53k|}
gcry_xrealloc:
 1686|  16.0k|{
 1687|  16.0k|  return _gcry_xrealloc (a, n);
 1688|  16.0k|}
gcry_xstrdup:
 1692|   188k|{
 1693|   188k|  return _gcry_xstrdup (a);
 1694|   188k|}
gcry_free:
 1698|  3.86M|{
 1699|  3.86M|  _gcry_free (a);
 1700|  3.86M|}

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

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

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

strsource.c:msgidxof:
   83|   130k|{
   84|   130k|  return (0 ? 0
  ------------------
  |  Branch (84:11): [Folded - Ignored]
  ------------------
   85|   130k|  : ((code >= 0) && (code <= 17)) ? (code - 0)
  ------------------
  |  Branch (85:6): [True: 130k, False: 0]
  |  Branch (85:21): [True: 130k, False: 0]
  ------------------
   86|   130k|  : ((code >= 31) && (code <= 35)) ? (code - 13)
  ------------------
  |  Branch (86:6): [True: 0, False: 0]
  |  Branch (86:22): [True: 0, False: 0]
  ------------------
   87|      0|  : 36 - 13);
   88|   130k|}

_gpgrt_estream_format:
 1492|  1.62M|{
 1493|       |  /* Buffer to hold the argspecs and a pointer to it.*/
 1494|  1.62M|  struct argspec_s argspecs_buffer[DEFAULT_MAX_ARGSPECS];
 1495|  1.62M|  argspec_t argspecs = argspecs_buffer;
 1496|  1.62M|  size_t argspecs_len;  /* Number of specifications in ARGSPECS.  */
 1497|       |
 1498|       |  /* Buffer to hold the description for the values.  */
 1499|  1.62M|  struct valueitem_s valuetable_buffer[DEFAULT_MAX_VALUES];
 1500|  1.62M|  valueitem_t valuetable = valuetable_buffer;
 1501|       |
 1502|  1.62M|  int rc;        /* Return code. */
 1503|  1.62M|  size_t argidx; /* Used to index the argspecs array.  */
 1504|  1.62M|  size_t validx; /* Used to index the valuetable.  */
 1505|  1.62M|  int max_pos;   /* Highest argument position.  */
 1506|       |
 1507|  1.62M|  size_t nbytes = 0; /* Keep track of the number of bytes passed to
 1508|       |                        the output function.  */
 1509|       |
 1510|  1.62M|  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|  1.62M|  rc = parse_format (format, &argspecs, DIM(argspecs_buffer), &argspecs_len);
  ------------------
  |  |   93|  1.62M|# define DIM(array) (sizeof (array) / sizeof (*array))
  ------------------
 1517|  1.62M|  if (rc)
  ------------------
  |  Branch (1517:7): [True: 0, False: 1.62M]
  ------------------
 1518|      0|    goto leave;
 1519|       |
 1520|       |  /* Check that all ARG_POS fields are set.  */
 1521|  3.26M|  for (argidx=0,max_pos=0; argidx < argspecs_len; argidx++)
  ------------------
  |  Branch (1521:28): [True: 1.64M, False: 1.62M]
  ------------------
 1522|  1.64M|    {
 1523|  1.64M|      if (argspecs[argidx].arg_pos != -1
  ------------------
  |  Branch (1523:11): [True: 1.64M, False: 0]
  ------------------
 1524|  1.64M|          && argspecs[argidx].arg_pos > max_pos)
  ------------------
  |  Branch (1524:14): [True: 0, False: 1.64M]
  ------------------
 1525|      0|        max_pos = argspecs[argidx].arg_pos;
 1526|  1.64M|      if (argspecs[argidx].width_pos > max_pos)
  ------------------
  |  Branch (1526:11): [True: 0, False: 1.64M]
  ------------------
 1527|      0|        max_pos = argspecs[argidx].width_pos;
 1528|  1.64M|      if (argspecs[argidx].precision_pos > max_pos)
  ------------------
  |  Branch (1528:11): [True: 0, False: 1.64M]
  ------------------
 1529|      0|        max_pos = argspecs[argidx].precision_pos;
 1530|  1.64M|    }
 1531|  1.62M|  if (!max_pos)
  ------------------
  |  Branch (1531:7): [True: 1.62M, False: 0]
  ------------------
 1532|  1.62M|    {
 1533|       |      /* Fill in all the positions.  */
 1534|  3.26M|      for (argidx=0; argidx < argspecs_len; argidx++)
  ------------------
  |  Branch (1534:22): [True: 1.64M, False: 1.62M]
  ------------------
 1535|  1.64M|        {
 1536|  1.64M|          if (argspecs[argidx].width == STAR_FIELD_VALUE)
  ------------------
  |  |  133|  1.64M|#define STAR_FIELD_VALUE (-2)
  ------------------
  |  Branch (1536:15): [True: 58.2k, False: 1.58M]
  ------------------
 1537|  58.2k|            argspecs[argidx].width_pos = ++max_pos;
 1538|  1.64M|          if (argspecs[argidx].precision == STAR_FIELD_VALUE)
  ------------------
  |  |  133|  1.64M|#define STAR_FIELD_VALUE (-2)
  ------------------
  |  Branch (1538:15): [True: 3, False: 1.64M]
  ------------------
 1539|      3|            argspecs[argidx].precision_pos = ++max_pos;
 1540|  1.64M|          if (argspecs[argidx].arg_pos != -1 )
  ------------------
  |  Branch (1540:15): [True: 1.64M, False: 0]
  ------------------
 1541|  1.64M|            argspecs[argidx].arg_pos = ++max_pos;
 1542|  1.64M|        }
 1543|  1.62M|    }
 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|  1.62M|  if (max_pos < 0 || max_pos >= strlen (format))
  ------------------
  |  Branch (1560:7): [True: 0, False: 1.62M]
  |  Branch (1560:22): [True: 0, False: 1.62M]
  ------------------
 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|  1.62M|  if (max_pos > DIM(valuetable_buffer))
  ------------------
  |  |   93|  1.62M|# define DIM(array) (sizeof (array) / sizeof (*array))
  ------------------
  |  Branch (1569:7): [True: 0, False: 1.62M]
  ------------------
 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|  1.62M|  else
 1576|  1.62M|    {
 1577|  14.5M|      for (validx=0; validx < DIM(valuetable_buffer); validx++)
  ------------------
  |  |   93|  14.5M|# define DIM(array) (sizeof (array) / sizeof (*array))
  ------------------
  |  Branch (1577:22): [True: 12.9M, False: 1.62M]
  ------------------
 1578|  12.9M|        {
 1579|  12.9M|          valuetable[validx].vt = VALTYPE_UNSUPPORTED;
 1580|  12.9M|          memset (&valuetable[validx].value, 0,
 1581|  12.9M|                  sizeof valuetable[validx].value);
 1582|  12.9M|        }
 1583|  1.62M|    }
 1584|  3.26M|  for (argidx=0; argidx < argspecs_len; argidx++)
  ------------------
  |  Branch (1584:18): [True: 1.64M, False: 1.62M]
  ------------------
 1585|  1.64M|    {
 1586|  1.64M|      if (argspecs[argidx].arg_pos != - 1)
  ------------------
  |  Branch (1586:11): [True: 1.64M, False: 0]
  ------------------
 1587|  1.64M|        {
 1588|  1.64M|          validx = argspecs[argidx].arg_pos - 1;
 1589|  1.64M|          if (valuetable[validx].vt)
  ------------------
  |  Branch (1589:15): [True: 0, False: 1.64M]
  ------------------
 1590|      0|            goto leave_einval; /* Already defined. */
 1591|  1.64M|          valuetable[validx].vt = argspecs[argidx].vt;
 1592|  1.64M|        }
 1593|  1.64M|      if (argspecs[argidx].width == STAR_FIELD_VALUE)
  ------------------
  |  |  133|  1.64M|#define STAR_FIELD_VALUE (-2)
  ------------------
  |  Branch (1593:11): [True: 58.2k, False: 1.58M]
  ------------------
 1594|  58.2k|        {
 1595|  58.2k|          validx = argspecs[argidx].width_pos - 1;
 1596|  58.2k|          if (valuetable[validx].vt)
  ------------------
  |  Branch (1596:15): [True: 0, False: 58.2k]
  ------------------
 1597|      0|            goto leave_einval; /* Already defined.  */
 1598|  58.2k|          valuetable[validx].vt = VALTYPE_INT;
 1599|  58.2k|        }
 1600|  1.64M|      if (argspecs[argidx].precision == STAR_FIELD_VALUE)
  ------------------
  |  |  133|  1.64M|#define STAR_FIELD_VALUE (-2)
  ------------------
  |  Branch (1600:11): [True: 3, False: 1.64M]
  ------------------
 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|  1.64M|    }
 1608|       |
 1609|       |  /* Read all the arguments.  This will error out for unsupported
 1610|       |     types and for not given positional arguments. */
 1611|  1.62M|  rc = read_values (valuetable, max_pos, vaargs);
 1612|  1.62M|  if (rc)
  ------------------
  |  Branch (1612:7): [True: 0, False: 1.62M]
  ------------------
 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|  1.62M|  rc = do_format (outfnc, outfncarg, sf, sfvalue, format,
 1620|  1.62M|                  argspecs, argspecs_len, valuetable, myerrno, &nbytes);
 1621|       |
 1622|  1.62M|  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|  1.62M| leave:
 1629|  1.62M|  if (valuetable != valuetable_buffer)
  ------------------
  |  Branch (1629:7): [True: 0, False: 1.62M]
  ------------------
 1630|      0|    free (valuetable);
 1631|  1.62M|  if (argspecs != argspecs_buffer)
  ------------------
  |  Branch (1631:7): [True: 1.48k, False: 1.61M]
  ------------------
 1632|  1.48k|    free (argspecs);
 1633|  1.62M|  return rc;
 1634|      0|}
_gpgrt_estream_vsnprintf:
 1733|   107k|{
 1734|   107k|  struct fixed_buffer_parm_s parm;
 1735|   107k|  int rc;
 1736|       |
 1737|   107k|  parm.size = bufsize;
 1738|   107k|  parm.count = 0;
 1739|   107k|  parm.used = 0;
 1740|   107k|  parm.buffer = bufsize?buf:NULL;
  ------------------
  |  Branch (1740:17): [True: 107k, False: 0]
  ------------------
 1741|   107k|  rc = _gpgrt_estream_format (fixed_buffer_out, &parm, NULL, NULL,
 1742|   107k|                              format, arg_ptr);
 1743|   107k|  if (!rc)
  ------------------
  |  Branch (1743:7): [True: 107k, False: 0]
  ------------------
 1744|   107k|    rc = fixed_buffer_out (&parm, "", 1); /* Print terminating Nul.  */
 1745|   107k|  if (rc == -1)
  ------------------
  |  Branch (1745:7): [True: 0, False: 107k]
  ------------------
 1746|      0|    return -1;
 1747|   107k|  if (bufsize && buf && parm.size && parm.count >= parm.size)
  ------------------
  |  Branch (1747:7): [True: 107k, False: 0]
  |  Branch (1747:18): [True: 107k, False: 0]
  |  Branch (1747:25): [True: 107k, False: 0]
  |  Branch (1747:38): [True: 33.8k, False: 73.8k]
  ------------------
 1748|  33.8k|    buf[parm.size-1] = 0;
 1749|       |
 1750|   107k|  parm.count--; /* Do not count the trailing nul.  */
 1751|   107k|  return (int)parm.count; /* Return number of bytes which would have
 1752|       |                             been written.  */
 1753|   107k|}
estream-printf.c:parse_format:
  445|  1.62M|{
  446|  1.62M|  const char *s;
  447|  1.62M|  argspec_t argspecs = *argspecs_addr;
  448|  1.62M|  argspec_t arg;
  449|  1.62M|  size_t argcount = 0;
  450|       |
  451|  1.62M|  if (!format)
  ------------------
  |  Branch (451:7): [True: 0, False: 1.62M]
  ------------------
  452|      0|    goto leave_einval;
  453|       |
  454|  36.7M|  for (; *format; format++)
  ------------------
  |  Branch (454:10): [True: 35.1M, False: 1.62M]
  ------------------
  455|  35.1M|    {
  456|  35.1M|      unsigned int flags;
  457|  35.1M|      int width, precision;
  458|  35.1M|      lenmod_t lenmod;
  459|  35.1M|      conspec_t conspec;
  460|  35.1M|      int arg_pos, width_pos, precision_pos;
  461|       |
  462|  35.1M|      if (*format != '%')
  ------------------
  |  Branch (462:11): [True: 33.4M, False: 1.64M]
  ------------------
  463|  33.4M|        continue;
  464|  1.64M|      s = ++format;
  465|  1.64M|      if (!*s)
  ------------------
  |  Branch (465:11): [True: 0, False: 1.64M]
  ------------------
  466|      0|        goto leave_einval;
  467|  1.64M|      if (*s == '%')
  ------------------
  |  Branch (467:11): [True: 0, False: 1.64M]
  ------------------
  468|      0|        continue; /* Just a quoted percent.  */
  469|       |
  470|       |      /* First check whether there is a positional argument.  */
  471|  1.64M|      arg_pos = 0; /* No positional argument given.  */
  472|  1.64M|      if (*s >= '1' && *s <= '9')
  ------------------
  |  Branch (472:11): [True: 996k, False: 649k]
  |  Branch (472:24): [True: 3, False: 996k]
  ------------------
  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|  1.64M|      flags = 0;
  492|  2.23M|      for ( ; *s; s++)
  ------------------
  |  Branch (492:15): [True: 2.23M, False: 0]
  ------------------
  493|  2.23M|        {
  494|  2.23M|          switch (*s)
  495|  2.23M|            {
  496|      0|            case '\'': flags |= FLAG_GROUPING; break;
  ------------------
  |  |  136|      0|#define FLAG_GROUPING   1
  ------------------
  |  Branch (496:13): [True: 0, False: 2.23M]
  ------------------
  497|      0|            case '-': flags |= FLAG_LEFT_JUST; break;
  ------------------
  |  |  137|      0|#define FLAG_LEFT_JUST  2
  ------------------
  |  Branch (497:13): [True: 0, False: 2.23M]
  ------------------
  498|      0|            case '+': flags |= FLAG_PLUS_SIGN; break;
  ------------------
  |  |  138|      0|#define FLAG_PLUS_SIGN  4
  ------------------
  |  Branch (498:13): [True: 0, False: 2.23M]
  ------------------
  499|      0|            case ' ': flags |= FLAG_SPACE_PLUS; break;
  ------------------
  |  |  139|      0|#define FLAG_SPACE_PLUS 8
  ------------------
  |  Branch (499:13): [True: 0, False: 2.23M]
  ------------------
  500|      0|            case '#': flags |= FLAG_ALT_CONV; break;
  ------------------
  |  |  140|      0|#define FLAG_ALT_CONV   16
  ------------------
  |  Branch (500:13): [True: 0, False: 2.23M]
  ------------------
  501|   591k|            case '0': flags |= FLAG_ZERO_PAD; break;
  ------------------
  |  |  141|   591k|#define FLAG_ZERO_PAD   32
  ------------------
  |  Branch (501:13): [True: 591k, False: 1.64M]
  ------------------
  502|  1.64M|            default:
  ------------------
  |  Branch (502:13): [True: 1.64M, False: 591k]
  ------------------
  503|  1.64M|              goto flags_parsed;
  504|  2.23M|            }
  505|  2.23M|        }
  506|  1.64M|    flags_parsed:
  507|       |
  508|       |      /* Parse the field width.  */
  509|  1.64M|      width_pos = 0;
  510|  1.64M|      if (*s == '*')
  ------------------
  |  Branch (510:11): [True: 58.2k, False: 1.58M]
  ------------------
  511|  58.2k|        {
  512|  58.2k|          width = STAR_FIELD_VALUE;
  ------------------
  |  |  133|  58.2k|#define STAR_FIELD_VALUE (-2)
  ------------------
  513|  58.2k|          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|  58.2k|          if (arg_pos && *s >= '1' && *s <= '9')
  ------------------
  |  Branch (516:15): [True: 0, False: 58.2k]
  |  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|  58.2k|        }
  528|  1.58M|      else if ( *s >= '0' && *s <= '9')
  ------------------
  |  Branch (528:17): [True: 1.58M, False: 3]
  |  Branch (528:30): [True: 591k, False: 996k]
  ------------------
  529|   591k|        {
  530|   591k|          width = (*s++ - '0');
  531|   591k|          for (; *s >= '0' && *s <= '9'; s++)
  ------------------
  |  Branch (531:18): [True: 591k, False: 0]
  |  Branch (531:31): [True: 3, False: 591k]
  ------------------
  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|   591k|          if (width < 0)
  ------------------
  |  Branch (539:15): [True: 0, False: 591k]
  ------------------
  540|      0|            goto leave_einval; /* Overflow during conversion.  */
  541|   591k|        }
  542|   996k|      else
  543|   996k|        width = NO_FIELD_VALUE;
  ------------------
  |  |  132|   996k|#define NO_FIELD_VALUE   (-1)
  ------------------
  544|       |
  545|       |      /* Parse the precision.  */
  546|  1.64M|      precision_pos = 0;
  547|  1.64M|      precision = NO_FIELD_VALUE;
  ------------------
  |  |  132|  1.64M|#define NO_FIELD_VALUE   (-1)
  ------------------
  548|  1.64M|      if (*s == '.')
  ------------------
  |  Branch (548:11): [True: 3, False: 1.64M]
  ------------------
  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|  1.64M|      switch (*s)
  593|  1.64M|        {
  594|      0|        case 'h':
  ------------------
  |  Branch (594:9): [True: 0, False: 1.64M]
  ------------------
  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.6k|        case 'l':
  ------------------
  |  Branch (604:9): [True: 97.6k, False: 1.54M]
  ------------------
  605|  97.6k|          if (s[1] == 'l')
  ------------------
  |  Branch (605:15): [True: 0, False: 97.6k]
  ------------------
  606|      0|            {
  607|      0|              lenmod = LENMOD_LONGLONG;
  608|      0|              s++;
  609|      0|            }
  610|  97.6k|          else
  611|  97.6k|            lenmod = LENMOD_LONG;
  612|  97.6k|          s++;
  613|  97.6k|          break;
  614|      0|        case 'j': lenmod = LENMOD_INTMAX; s++; break;
  ------------------
  |  Branch (614:9): [True: 0, False: 1.64M]
  ------------------
  615|    145|        case 'z': lenmod = LENMOD_SIZET; s++; break;
  ------------------
  |  Branch (615:9): [True: 145, False: 1.64M]
  ------------------
  616|      0|        case 't': lenmod = LENMOD_PTRDIFF; s++; break;
  ------------------
  |  Branch (616:9): [True: 0, False: 1.64M]
  ------------------
  617|      0|        case 'L': lenmod = LENMOD_LONGDBL; s++; break;
  ------------------
  |  Branch (617:9): [True: 0, False: 1.64M]
  ------------------
  618|  1.54M|        default:  lenmod = LENMOD_NONE; break;
  ------------------
  |  Branch (618:9): [True: 1.54M, False: 97.7k]
  ------------------
  619|  1.64M|        }
  620|       |
  621|       |      /* Parse the conversion specifier.  */
  622|  1.64M|      switch (*s)
  623|  1.64M|        {
  624|   233k|        case 'd':
  ------------------
  |  Branch (624:9): [True: 233k, False: 1.41M]
  ------------------
  625|   233k|        case 'i': conspec = CONSPEC_DECIMAL; break;
  ------------------
  |  Branch (625:9): [True: 0, False: 1.64M]
  ------------------
  626|      0|        case 'o': conspec = CONSPEC_OCTAL; break;
  ------------------
  |  Branch (626:9): [True: 0, False: 1.64M]
  ------------------
  627|  33.7k|        case 'u': conspec = CONSPEC_UNSIGNED; break;
  ------------------
  |  Branch (627:9): [True: 33.7k, False: 1.61M]
  ------------------
  628|   181k|        case 'x': conspec = CONSPEC_HEX; break;
  ------------------
  |  Branch (628:9): [True: 181k, False: 1.46M]
  ------------------
  629|   314k|        case 'X': conspec = CONSPEC_HEX_UP; break;
  ------------------
  |  Branch (629:9): [True: 314k, False: 1.33M]
  ------------------
  630|      0|        case 'f': conspec = CONSPEC_FLOAT; break;
  ------------------
  |  Branch (630:9): [True: 0, False: 1.64M]
  ------------------
  631|      0|        case 'F': conspec = CONSPEC_FLOAT_UP; break;
  ------------------
  |  Branch (631:9): [True: 0, False: 1.64M]
  ------------------
  632|      0|        case 'e': conspec = CONSPEC_EXP; break;
  ------------------
  |  Branch (632:9): [True: 0, False: 1.64M]
  ------------------
  633|      0|        case 'E': conspec = CONSPEC_EXP_UP; break;
  ------------------
  |  Branch (633:9): [True: 0, False: 1.64M]
  ------------------
  634|      0|        case 'g': conspec = CONSPEC_F_OR_G; break;
  ------------------
  |  Branch (634:9): [True: 0, False: 1.64M]
  ------------------
  635|      0|        case 'G': conspec = CONSPEC_F_OR_G_UP; break;
  ------------------
  |  Branch (635:9): [True: 0, False: 1.64M]
  ------------------
  636|      0|        case 'a': conspec = CONSPEC_HEX_EXP; break;
  ------------------
  |  Branch (636:9): [True: 0, False: 1.64M]
  ------------------
  637|      0|        case 'A': conspec = CONSPEC_HEX_EXP_UP; break;
  ------------------
  |  Branch (637:9): [True: 0, False: 1.64M]
  ------------------
  638|  39.6k|        case 'c': conspec = CONSPEC_CHAR; break;
  ------------------
  |  Branch (638:9): [True: 39.6k, False: 1.60M]
  ------------------
  639|   838k|        case 's': conspec = CONSPEC_STRING; break;
  ------------------
  |  Branch (639:9): [True: 838k, False: 807k]
  ------------------
  640|  4.80k|        case 'p': conspec = CONSPEC_POINTER; break;
  ------------------
  |  Branch (640:9): [True: 4.80k, False: 1.64M]
  ------------------
  641|      0|        case 'n': conspec = CONSPEC_BYTES_SO_FAR; break;
  ------------------
  |  Branch (641:9): [True: 0, False: 1.64M]
  ------------------
  642|      0|        case 'C': conspec = CONSPEC_CHAR; lenmod = LENMOD_LONG; break;
  ------------------
  |  Branch (642:9): [True: 0, False: 1.64M]
  ------------------
  643|      0|        case 'S': conspec = CONSPEC_STRING; lenmod = LENMOD_LONG; break;
  ------------------
  |  Branch (643:9): [True: 0, False: 1.64M]
  ------------------
  644|      0|        case 'm': conspec = CONSPEC_STRERROR; arg_pos = -1; break;
  ------------------
  |  Branch (644:9): [True: 0, False: 1.64M]
  ------------------
  645|      0|        default: conspec = CONSPEC_UNKNOWN;
  ------------------
  |  Branch (645:9): [True: 0, False: 1.64M]
  ------------------
  646|  1.64M|        }
  647|       |
  648|       |      /* Save the args. */
  649|  1.64M|      if (argcount >= max_argspecs)
  ------------------
  |  Branch (649:11): [True: 1.48k, False: 1.64M]
  ------------------
  650|  1.48k|        {
  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|  1.48k|          size_t n, newmax;
  656|  1.48k|          argspec_t newarg;
  657|       |
  658|  1.48k|          newmax = max_argspecs + ARGSPECS_BUMP_VALUE;
  ------------------
  |  |  129|  1.48k|#define ARGSPECS_BUMP_VALUE   10
  ------------------
  659|  1.48k|          if (newmax <= max_argspecs)
  ------------------
  |  Branch (659:15): [True: 0, False: 1.48k]
  ------------------
  660|      0|            goto leave_einval;  /* Too many arguments. */
  661|  1.48k|          newarg = calloc (newmax, sizeof *newarg);
  662|  1.48k|          if (!newarg)
  ------------------
  |  Branch (662:15): [True: 0, False: 1.48k]
  ------------------
  663|      0|            goto leave;
  664|  8.90k|          for (n=0; n < argcount; n++)
  ------------------
  |  Branch (664:21): [True: 7.42k, False: 1.48k]
  ------------------
  665|  7.42k|            newarg[n] = argspecs[n];
  666|  1.48k|          if (argspecs != *argspecs_addr)
  ------------------
  |  Branch (666:15): [True: 0, False: 1.48k]
  ------------------
  667|      0|            free (argspecs);
  668|  1.48k|          argspecs = newarg;
  669|  1.48k|          max_argspecs = newmax;
  670|  1.48k|        }
  671|       |
  672|  1.64M|      arg = argspecs + argcount;
  673|  1.64M|      arg->length = s - format + 2;
  674|  1.64M|      arg->flags = flags;
  675|  1.64M|      arg->width = width;
  676|  1.64M|      arg->precision = precision;
  677|  1.64M|      arg->lenmod = lenmod;
  678|  1.64M|      arg->conspec = conspec;
  679|  1.64M|      arg->arg_pos = arg_pos;
  680|  1.64M|      arg->width_pos = width_pos;
  681|  1.64M|      arg->precision_pos = precision_pos;
  682|  1.64M|      compute_type (arg);
  683|  1.64M|      argcount++;
  684|  1.64M|      format = s;
  685|  1.64M|    }
  686|       |
  687|  1.62M|  *argspecs_addr = argspecs;
  688|  1.62M|  *r_argspecs_count = argcount;
  689|  1.62M|  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|  1.64M|{
  346|  1.64M|  switch (arg->conspec)
  ------------------
  |  Branch (346:11): [True: 0, False: 1.64M]
  ------------------
  347|  1.64M|    {
  348|      0|    case CONSPEC_UNKNOWN:
  ------------------
  |  Branch (348:5): [True: 0, False: 1.64M]
  ------------------
  349|      0|      arg->vt = VALTYPE_UNSUPPORTED;
  350|      0|      break;
  351|       |
  352|   233k|    case CONSPEC_DECIMAL:
  ------------------
  |  Branch (352:5): [True: 233k, False: 1.41M]
  ------------------
  353|   233k|      switch (arg->lenmod)
  354|   233k|        {
  355|      0|        case LENMOD_CHAR: arg->vt = VALTYPE_SCHAR; break;
  ------------------
  |  Branch (355:9): [True: 0, False: 233k]
  ------------------
  356|      0|        case LENMOD_SHORT: arg->vt = VALTYPE_SHORT; break;
  ------------------
  |  Branch (356:9): [True: 0, False: 233k]
  ------------------
  357|      0|        case LENMOD_LONG: arg->vt = VALTYPE_LONG; break;
  ------------------
  |  Branch (357:9): [True: 0, False: 233k]
  ------------------
  358|      0|        case LENMOD_LONGLONG: arg->vt = VALTYPE_LONGLONG; break;
  ------------------
  |  Branch (358:9): [True: 0, False: 233k]
  ------------------
  359|      0|        case LENMOD_INTMAX: arg->vt = VALTYPE_INTMAX; break;
  ------------------
  |  Branch (359:9): [True: 0, False: 233k]
  ------------------
  360|      0|        case LENMOD_SIZET: arg->vt = VALTYPE_SIZE; break;
  ------------------
  |  Branch (360:9): [True: 0, False: 233k]
  ------------------
  361|      0|        case LENMOD_PTRDIFF: arg->vt = VALTYPE_PTRDIFF; break;
  ------------------
  |  Branch (361:9): [True: 0, False: 233k]
  ------------------
  362|   233k|        default: arg->vt = VALTYPE_INT; break;
  ------------------
  |  Branch (362:9): [True: 233k, False: 0]
  ------------------
  363|   233k|        }
  364|   233k|      break;
  365|       |
  366|   233k|    case CONSPEC_OCTAL:
  ------------------
  |  Branch (366:5): [True: 0, False: 1.64M]
  ------------------
  367|  33.7k|    case CONSPEC_UNSIGNED:
  ------------------
  |  Branch (367:5): [True: 33.7k, False: 1.61M]
  ------------------
  368|   215k|    case CONSPEC_HEX:
  ------------------
  |  Branch (368:5): [True: 181k, False: 1.46M]
  ------------------
  369|   529k|    case CONSPEC_HEX_UP:
  ------------------
  |  Branch (369:5): [True: 314k, False: 1.33M]
  ------------------
  370|   529k|      switch (arg->lenmod)
  371|   529k|        {
  372|      0|        case LENMOD_CHAR: arg->vt = VALTYPE_UCHAR; break;
  ------------------
  |  Branch (372:9): [True: 0, False: 529k]
  ------------------
  373|      0|        case LENMOD_SHORT: arg->vt = VALTYPE_USHORT; break;
  ------------------
  |  Branch (373:9): [True: 0, False: 529k]
  ------------------
  374|  97.6k|        case LENMOD_LONG: arg->vt = VALTYPE_ULONG; break;
  ------------------
  |  Branch (374:9): [True: 97.6k, False: 432k]
  ------------------
  375|      0|        case LENMOD_LONGLONG: arg->vt = VALTYPE_ULONGLONG; break;
  ------------------
  |  Branch (375:9): [True: 0, False: 529k]
  ------------------
  376|      0|        case LENMOD_INTMAX: arg->vt = VALTYPE_UINTMAX; break;
  ------------------
  |  Branch (376:9): [True: 0, False: 529k]
  ------------------
  377|    145|        case LENMOD_SIZET: arg->vt = VALTYPE_SIZE; break;
  ------------------
  |  Branch (377:9): [True: 145, False: 529k]
  ------------------
  378|      0|        case LENMOD_PTRDIFF: arg->vt = VALTYPE_PTRDIFF; break;
  ------------------
  |  Branch (378:9): [True: 0, False: 529k]
  ------------------
  379|   431k|        default: arg->vt = VALTYPE_UINT; break;
  ------------------
  |  Branch (379:9): [True: 431k, False: 97.7k]
  ------------------
  380|   529k|        }
  381|   529k|      break;
  382|       |
  383|   529k|    case CONSPEC_FLOAT:
  ------------------
  |  Branch (383:5): [True: 0, False: 1.64M]
  ------------------
  384|      0|    case CONSPEC_FLOAT_UP:
  ------------------
  |  Branch (384:5): [True: 0, False: 1.64M]
  ------------------
  385|      0|    case CONSPEC_EXP:
  ------------------
  |  Branch (385:5): [True: 0, False: 1.64M]
  ------------------
  386|      0|    case CONSPEC_EXP_UP:
  ------------------
  |  Branch (386:5): [True: 0, False: 1.64M]
  ------------------
  387|      0|    case CONSPEC_F_OR_G:
  ------------------
  |  Branch (387:5): [True: 0, False: 1.64M]
  ------------------
  388|      0|    case CONSPEC_F_OR_G_UP:
  ------------------
  |  Branch (388:5): [True: 0, False: 1.64M]
  ------------------
  389|      0|    case CONSPEC_HEX_EXP:
  ------------------
  |  Branch (389:5): [True: 0, False: 1.64M]
  ------------------
  390|      0|    case CONSPEC_HEX_EXP_UP:
  ------------------
  |  Branch (390:5): [True: 0, False: 1.64M]
  ------------------
  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|  39.6k|    case CONSPEC_CHAR:
  ------------------
  |  Branch (399:5): [True: 39.6k, False: 1.60M]
  ------------------
  400|  39.6k|      arg->vt = VALTYPE_INT;
  401|  39.6k|      break;
  402|       |
  403|   838k|    case CONSPEC_STRING:
  ------------------
  |  Branch (403:5): [True: 838k, False: 807k]
  ------------------
  404|   838k|      arg->vt = VALTYPE_STRING;
  405|   838k|      break;
  406|       |
  407|  4.80k|    case CONSPEC_POINTER:
  ------------------
  |  Branch (407:5): [True: 4.80k, False: 1.64M]
  ------------------
  408|  4.80k|      arg->vt = VALTYPE_POINTER;
  409|  4.80k|      break;
  410|       |
  411|      0|    case CONSPEC_STRERROR:
  ------------------
  |  Branch (411:5): [True: 0, False: 1.64M]
  ------------------
  412|      0|      arg->vt = VALTYPE_STRING;
  413|      0|      break;
  414|       |
  415|      0|    case CONSPEC_BYTES_SO_FAR:
  ------------------
  |  Branch (415:5): [True: 0, False: 1.64M]
  ------------------
  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|  1.64M|    }
  430|  1.64M|}
estream-printf.c:read_values:
  706|  1.62M|{
  707|  1.62M|  int validx;
  708|       |
  709|  3.32M|  for (validx=0; validx < valuetable_len; validx++)
  ------------------
  |  Branch (709:18): [True: 1.70M, False: 1.62M]
  ------------------
  710|  1.70M|    {
  711|  1.70M|      value_t *value = &valuetable[validx].value;
  712|  1.70M|      valtype_t vt = valuetable[validx].vt;
  713|       |
  714|  1.70M|      switch (vt)
  715|  1.70M|        {
  716|      0|        case VALTYPE_CHAR: value->a_char = va_arg (vaargs, int); break;
  ------------------
  |  Branch (716:9): [True: 0, False: 1.70M]
  ------------------
  717|      0|        case VALTYPE_CHAR_PTR:
  ------------------
  |  Branch (717:9): [True: 0, False: 1.70M]
  ------------------
  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: 1.70M]
  ------------------
  721|      0|        case VALTYPE_SCHAR_PTR:
  ------------------
  |  Branch (721:9): [True: 0, False: 1.70M]
  ------------------
  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: 1.70M]
  ------------------
  725|      0|        case VALTYPE_SHORT: value->a_short = va_arg (vaargs, int); break;
  ------------------
  |  Branch (725:9): [True: 0, False: 1.70M]
  ------------------
  726|      0|        case VALTYPE_USHORT: value->a_ushort = va_arg (vaargs, int); break;
  ------------------
  |  Branch (726:9): [True: 0, False: 1.70M]
  ------------------
  727|      0|        case VALTYPE_SHORT_PTR:
  ------------------
  |  Branch (727:9): [True: 0, False: 1.70M]
  ------------------
  728|      0|          value->a_short_ptr = va_arg (vaargs, short *);
  729|      0|          break;
  730|   331k|        case VALTYPE_INT:
  ------------------
  |  Branch (730:9): [True: 331k, False: 1.37M]
  ------------------
  731|   331k|          value->a_int = va_arg (vaargs, int);
  732|   331k|          break;
  733|      0|        case VALTYPE_INT_PTR:
  ------------------
  |  Branch (733:9): [True: 0, False: 1.70M]
  ------------------
  734|      0|          value->a_int_ptr = va_arg (vaargs, int *);
  735|      0|          break;
  736|   431k|        case VALTYPE_UINT:
  ------------------
  |  Branch (736:9): [True: 431k, False: 1.27M]
  ------------------
  737|   431k|          value->a_uint = va_arg (vaargs, unsigned int);
  738|   431k|          break;
  739|      0|        case VALTYPE_LONG:
  ------------------
  |  Branch (739:9): [True: 0, False: 1.70M]
  ------------------
  740|      0|          value->a_long = va_arg (vaargs, long);
  741|      0|          break;
  742|  97.6k|        case VALTYPE_ULONG:
  ------------------
  |  Branch (742:9): [True: 97.6k, False: 1.60M]
  ------------------
  743|  97.6k|          value->a_ulong = va_arg (vaargs, unsigned long);
  744|  97.6k|          break;
  745|      0|        case VALTYPE_LONG_PTR:
  ------------------
  |  Branch (745:9): [True: 0, False: 1.70M]
  ------------------
  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: 1.70M]
  ------------------
  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: 1.70M]
  ------------------
  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: 1.70M]
  ------------------
  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: 1.70M]
  ------------------
  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: 1.70M]
  ------------------
  764|      0|          value->a_longdouble = va_arg (vaargs, long double);
  765|      0|          break;
  766|      0|#endif
  767|   838k|        case VALTYPE_STRING:
  ------------------
  |  Branch (767:9): [True: 838k, False: 865k]
  ------------------
  768|   838k|          value->a_string = va_arg (vaargs, const char *);
  769|   838k|          break;
  770|  4.80k|        case VALTYPE_POINTER:
  ------------------
  |  Branch (770:9): [True: 4.80k, False: 1.69M]
  ------------------
  771|  4.80k|          value->a_void_ptr = va_arg (vaargs, void *);
  772|  4.80k|          break;
  773|      0|#ifdef HAVE_INTMAX_T
  774|      0|        case VALTYPE_INTMAX:
  ------------------
  |  Branch (774:9): [True: 0, False: 1.70M]
  ------------------
  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: 1.70M]
  ------------------
  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: 1.70M]
  ------------------
  783|      0|          value->a_uintmax = va_arg (vaargs, uintmax_t);
  784|      0|          break;
  785|      0|#endif
  786|    145|        case VALTYPE_SIZE:
  ------------------
  |  Branch (786:9): [True: 145, False: 1.70M]
  ------------------
  787|    145|          value->a_size = va_arg (vaargs, size_t);
  788|    145|          break;
  789|      0|        case VALTYPE_SIZE_PTR:
  ------------------
  |  Branch (789:9): [True: 0, False: 1.70M]
  ------------------
  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: 1.70M]
  ------------------
  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: 1.70M]
  ------------------
  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: 1.70M]
  ------------------
  801|      0|          return -1;
  802|  1.70M|        }
  803|  1.70M|    }
  804|  1.62M|  return 0;
  805|  1.62M|}
estream-printf.c:do_format:
 1354|  1.62M|{
 1355|  1.62M|  int rc = 0;
 1356|  1.62M|  const char *s;
 1357|  1.62M|  argspec_t arg = argspecs;
 1358|  1.62M|  int argidx = 0; /* Only used for assertion.  */
 1359|  1.62M|  size_t n;
 1360|  1.62M|  value_t value;
 1361|  1.62M|  int string_no = 0;  /* Number of processed "%s" args.  */
 1362|       |
 1363|  1.62M|  s = format;
 1364|  36.7M|  while ( *s )
  ------------------
  |  Branch (1364:11): [True: 35.1M, False: 1.62M]
  ------------------
 1365|  35.1M|    {
 1366|  35.1M|      if (*s != '%')
  ------------------
  |  Branch (1366:11): [True: 33.4M, False: 1.64M]
  ------------------
 1367|  33.4M|        {
 1368|  33.4M|          s++;
 1369|  33.4M|          continue;
 1370|  33.4M|        }
 1371|  1.64M|      if (s != format)
  ------------------
  |  Branch (1371:11): [True: 1.31M, False: 331k]
  ------------------
 1372|  1.31M|        {
 1373|  1.31M|          rc = outfnc (outfncarg, format, (n=s-format));
 1374|  1.31M|          if (rc)
  ------------------
  |  Branch (1374:15): [True: 0, False: 1.31M]
  ------------------
 1375|      0|            return rc;
 1376|  1.31M|          *nbytes += n;
 1377|  1.31M|        }
 1378|  1.64M|      if (s[1] == '%')
  ------------------
  |  Branch (1378:11): [True: 0, False: 1.64M]
  ------------------
 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|  1.64M|      s += arg->length;
 1394|  1.64M|      format = s;
 1395|       |
 1396|  1.64M|      gpgrt_assert (argidx < argspecs_len);
  ------------------
  |  |  577|  1.64M|  ((expr)                                                       \
  |  |  ------------------
  |  |  |  Branch (577:4): [True: 1.64M, False: 0]
  |  |  ------------------
  |  |  578|  1.64M|   ? (void) 0                                                   \
  |  |  579|  1.64M|   : _gpgrt__log_assert (#expr, __FILE__, __LINE__, __FUNCTION__))
  ------------------
 1397|      0|      argidx++;
 1398|       |
 1399|       |      /* Apply indirect field width and precision values.  */
 1400|  1.64M|      if (arg->width == STAR_FIELD_VALUE)
  ------------------
  |  |  133|  1.64M|#define STAR_FIELD_VALUE (-2)
  ------------------
  |  Branch (1400:11): [True: 58.2k, False: 1.58M]
  ------------------
 1401|  58.2k|        {
 1402|  58.2k|          gpgrt_assert (valuetable[arg->width_pos-1].vt == VALTYPE_INT);
  ------------------
  |  |  577|  58.2k|  ((expr)                                                       \
  |  |  ------------------
  |  |  |  Branch (577:4): [True: 58.2k, False: 0]
  |  |  ------------------
  |  |  578|  58.2k|   ? (void) 0                                                   \
  |  |  579|  58.2k|   : _gpgrt__log_assert (#expr, __FILE__, __LINE__, __FUNCTION__))
  ------------------
 1403|      0|          arg->width = valuetable[arg->width_pos-1].value.a_int;
 1404|  58.2k|          if (arg->width < 0)
  ------------------
  |  Branch (1404:15): [True: 0, False: 58.2k]
  ------------------
 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|  58.2k|        }
 1410|  1.64M|      if (arg->precision == STAR_FIELD_VALUE)
  ------------------
  |  |  133|  1.64M|#define STAR_FIELD_VALUE (-2)
  ------------------
  |  Branch (1410:11): [True: 3, False: 1.64M]
  ------------------
 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|  1.64M|      if (arg->arg_pos == -1 && arg->conspec == CONSPEC_STRERROR)
  ------------------
  |  Branch (1418:11): [True: 0, False: 1.64M]
  |  Branch (1418:33): [True: 0, False: 0]
  ------------------
 1419|      0|        value.a_string = strerror (myerrno);
 1420|  1.64M|      else
 1421|  1.64M|        {
 1422|  1.64M|          gpgrt_assert (arg->vt == valuetable[arg->arg_pos-1].vt);
  ------------------
  |  |  577|  1.64M|  ((expr)                                                       \
  |  |  ------------------
  |  |  |  Branch (577:4): [True: 1.64M, False: 0]
  |  |  ------------------
  |  |  578|  1.64M|   ? (void) 0                                                   \
  |  |  579|  1.64M|   : _gpgrt__log_assert (#expr, __FILE__, __LINE__, __FUNCTION__))
  ------------------
 1423|      0|          value = valuetable[arg->arg_pos-1].value;
 1424|  1.64M|        }
 1425|       |
 1426|      0|      switch (arg->conspec)
  ------------------
  |  Branch (1426:15): [True: 0, False: 1.64M]
  ------------------
 1427|  1.64M|        {
 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: 1.64M]
  ------------------
 1429|       |
 1430|   233k|        case CONSPEC_DECIMAL:
  ------------------
  |  Branch (1430:9): [True: 233k, False: 1.41M]
  ------------------
 1431|   267k|        case CONSPEC_UNSIGNED:
  ------------------
  |  Branch (1431:9): [True: 33.7k, False: 1.61M]
  ------------------
 1432|   267k|        case CONSPEC_OCTAL:
  ------------------
  |  Branch (1432:9): [True: 0, False: 1.64M]
  ------------------
 1433|   448k|        case CONSPEC_HEX:
  ------------------
  |  Branch (1433:9): [True: 181k, False: 1.46M]
  ------------------
 1434|   763k|        case CONSPEC_HEX_UP:
  ------------------
  |  Branch (1434:9): [True: 314k, False: 1.33M]
  ------------------
 1435|   763k|          rc = pr_integer (outfnc, outfncarg, arg, value, nbytes);
 1436|   763k|          break;
 1437|      0|        case CONSPEC_FLOAT:
  ------------------
  |  Branch (1437:9): [True: 0, False: 1.64M]
  ------------------
 1438|      0|        case CONSPEC_FLOAT_UP:
  ------------------
  |  Branch (1438:9): [True: 0, False: 1.64M]
  ------------------
 1439|      0|        case CONSPEC_EXP:
  ------------------
  |  Branch (1439:9): [True: 0, False: 1.64M]
  ------------------
 1440|      0|        case CONSPEC_EXP_UP:
  ------------------
  |  Branch (1440:9): [True: 0, False: 1.64M]
  ------------------
 1441|      0|        case CONSPEC_F_OR_G:
  ------------------
  |  Branch (1441:9): [True: 0, False: 1.64M]
  ------------------
 1442|      0|        case CONSPEC_F_OR_G_UP:
  ------------------
  |  Branch (1442:9): [True: 0, False: 1.64M]
  ------------------
 1443|      0|        case CONSPEC_HEX_EXP:
  ------------------
  |  Branch (1443:9): [True: 0, False: 1.64M]
  ------------------
 1444|      0|        case CONSPEC_HEX_EXP_UP:
  ------------------
  |  Branch (1444:9): [True: 0, False: 1.64M]
  ------------------
 1445|      0|          rc = pr_float (outfnc, outfncarg, arg, value, nbytes);
 1446|      0|          break;
 1447|  39.6k|        case CONSPEC_CHAR:
  ------------------
  |  Branch (1447:9): [True: 39.6k, False: 1.60M]
  ------------------
 1448|  39.6k|          rc = pr_char (outfnc, outfncarg, arg, value, nbytes);
 1449|  39.6k|          break;
 1450|   838k|        case CONSPEC_STRING:
  ------------------
  |  Branch (1450:9): [True: 838k, False: 807k]
  ------------------
 1451|   838k|          rc = pr_string (outfnc, outfncarg, arg, value, nbytes,
 1452|   838k|                          sf, sfvalue, string_no++);
 1453|   838k|          break;
 1454|      0|        case CONSPEC_STRERROR:
  ------------------
  |  Branch (1454:9): [True: 0, False: 1.64M]
  ------------------
 1455|      0|          rc = pr_string (outfnc, outfncarg, arg, value, nbytes,
 1456|      0|                          NULL, NULL, 0);
 1457|      0|          break;
 1458|  4.80k|        case CONSPEC_POINTER:
  ------------------
  |  Branch (1458:9): [True: 4.80k, False: 1.64M]
  ------------------
 1459|  4.80k|          rc = pr_pointer (outfnc, outfncarg, arg, value, nbytes);
 1460|  4.80k|          break;
 1461|      0|        case CONSPEC_BYTES_SO_FAR:
  ------------------
  |  Branch (1461:9): [True: 0, False: 1.64M]
  ------------------
 1462|      0|          rc = pr_bytes_so_far (outfnc, outfncarg, arg, value, nbytes);
 1463|      0|          break;
 1464|  1.64M|        }
 1465|  1.64M|      if (rc)
  ------------------
  |  Branch (1465:11): [True: 0, False: 1.64M]
  ------------------
 1466|      0|        return rc;
 1467|  1.64M|      arg++;
 1468|  1.64M|    }
 1469|       |
 1470|       |  /* Print out any trailing stuff. */
 1471|  1.62M|  n = s - format;
 1472|  1.62M|  rc = n? outfnc (outfncarg, format, n) : 0;
  ------------------
  |  Branch (1472:8): [True: 1.27M, False: 345k]
  ------------------
 1473|  1.62M|  if (!rc)
  ------------------
  |  Branch (1473:7): [True: 1.62M, False: 0]
  ------------------
 1474|  1.62M|    *nbytes += n;
 1475|       |
 1476|  1.62M|  return rc;
 1477|  1.62M|}
estream-printf.c:pr_integer:
  840|   763k|{
  841|   763k|  int rc;
  842|   763k|#ifdef HAVE_LONG_LONG_INT
  843|   763k|  unsigned long long aulong;
  844|       |#else
  845|       |  unsigned long aulong;
  846|       |#endif
  847|   763k|  char numbuf[100];
  848|   763k|  char *p, *pend;
  849|   763k|  size_t n;
  850|   763k|  char signchar = 0;
  851|   763k|  int n_prec;  /* Number of extra precision digits required.  */
  852|   763k|  int n_extra; /* Extra number of prefix or sign characters.  */
  853|       |
  854|   763k|  if (arg->conspec == CONSPEC_DECIMAL)
  ------------------
  |  Branch (854:7): [True: 233k, False: 529k]
  ------------------
  855|   233k|    {
  856|   233k|#ifdef HAVE_LONG_LONG_INT
  857|   233k|      long long along;
  858|       |#else
  859|       |      long along;
  860|       |#endif
  861|       |
  862|   233k|      switch (arg->vt)
  863|   233k|        {
  864|      0|        case VALTYPE_SHORT: along = value.a_short; break;
  ------------------
  |  Branch (864:9): [True: 0, False: 233k]
  ------------------
  865|   233k|        case VALTYPE_INT: along = value.a_int; break;
  ------------------
  |  Branch (865:9): [True: 233k, False: 0]
  ------------------
  866|      0|        case VALTYPE_LONG: along = value.a_long; break;
  ------------------
  |  Branch (866:9): [True: 0, False: 233k]
  ------------------
  867|      0|#ifdef HAVE_LONG_LONG_INT
  868|      0|        case VALTYPE_LONGLONG: along = value.a_longlong; break;
  ------------------
  |  Branch (868:9): [True: 0, False: 233k]
  ------------------
  869|      0|        case VALTYPE_SIZE: along = value.a_size; break;
  ------------------
  |  Branch (869:9): [True: 0, False: 233k]
  ------------------
  870|      0|# ifdef HAVE_INTMAX_T
  871|      0|        case VALTYPE_INTMAX: along = value.a_intmax; break;
  ------------------
  |  Branch (871:9): [True: 0, False: 233k]
  ------------------
  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: 233k]
  ------------------
  875|      0|# endif
  876|      0|#endif /*HAVE_LONG_LONG_INT*/
  877|      0|        default:
  ------------------
  |  Branch (877:9): [True: 0, False: 233k]
  ------------------
  878|      0|          return -1;
  879|   233k|        }
  880|   233k|      if (along < 0)
  ------------------
  |  Branch (880:11): [True: 0, False: 233k]
  ------------------
  881|      0|        {
  882|      0|          aulong = -along;
  883|      0|          signchar = '-';
  884|      0|        }
  885|   233k|      else
  886|   233k|        aulong = along;
  887|   233k|    }
  888|   529k|  else
  889|   529k|    {
  890|   529k|      switch (arg->vt)
  891|   529k|        {
  892|      0|        case VALTYPE_USHORT: aulong = value.a_ushort; break;
  ------------------
  |  Branch (892:9): [True: 0, False: 529k]
  ------------------
  893|   431k|        case VALTYPE_UINT: aulong = value.a_uint; break;
  ------------------
  |  Branch (893:9): [True: 431k, False: 97.7k]
  ------------------
  894|  97.6k|        case VALTYPE_ULONG: aulong = value.a_ulong; break;
  ------------------
  |  Branch (894:9): [True: 97.6k, False: 432k]
  ------------------
  895|      0|#ifdef HAVE_LONG_LONG_INT
  896|      0|        case VALTYPE_ULONGLONG: aulong = value.a_ulonglong; break;
  ------------------
  |  Branch (896:9): [True: 0, False: 529k]
  ------------------
  897|    145|        case VALTYPE_SIZE: aulong = value.a_size; break;
  ------------------
  |  Branch (897:9): [True: 145, False: 529k]
  ------------------
  898|      0|# ifdef HAVE_UINTMAX_T
  899|      0|        case VALTYPE_UINTMAX: aulong = value.a_uintmax; break;
  ------------------
  |  Branch (899:9): [True: 0, False: 529k]
  ------------------
  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: 529k]
  ------------------
  903|      0|# endif
  904|      0|#endif /*HAVE_LONG_LONG_INT*/
  905|      0|        default:
  ------------------
  |  Branch (905:9): [True: 0, False: 529k]
  ------------------
  906|      0|          return -1;
  907|   529k|        }
  908|   529k|    }
  909|       |
  910|   763k|  if (signchar == '-')
  ------------------
  |  Branch (910:7): [True: 0, False: 763k]
  ------------------
  911|      0|    ;
  912|   763k|  else if ((arg->flags & FLAG_PLUS_SIGN))
  ------------------
  |  |  138|   763k|#define FLAG_PLUS_SIGN  4
  ------------------
  |  Branch (912:12): [True: 0, False: 763k]
  ------------------
  913|      0|    signchar = '+';
  914|   763k|  else if ((arg->flags & FLAG_SPACE_PLUS))
  ------------------
  |  |  139|   763k|#define FLAG_SPACE_PLUS 8
  ------------------
  |  Branch (914:12): [True: 0, False: 763k]
  ------------------
  915|      0|    signchar = ' ';
  916|       |
  917|   763k|  n_extra = !!signchar;
  918|       |
  919|       |  /* We build the string up backwards.  */
  920|   763k|  p = pend = numbuf + DIM(numbuf);
  ------------------
  |  |   93|   763k|# define DIM(array) (sizeof (array) / sizeof (*array))
  ------------------
  921|   763k|  if ((!aulong && !arg->precision))
  ------------------
  |  Branch (921:8): [True: 152k, False: 611k]
  |  Branch (921:19): [True: 0, False: 152k]
  ------------------
  922|      0|    ;
  923|   763k|  else if (arg->conspec == CONSPEC_DECIMAL
  ------------------
  |  Branch (923:12): [True: 233k, False: 529k]
  ------------------
  924|   763k|           || arg->conspec == CONSPEC_UNSIGNED)
  ------------------
  |  Branch (924:15): [True: 33.7k, False: 495k]
  ------------------
  925|   267k|    {
  926|   267k|      int grouping = -1;
  927|   267k|      const char * grouping_string =
  928|   267k|#ifdef HAVE_LANGINFO_THOUSEP
  929|   267k|        nl_langinfo(THOUSEP);
  930|       |#else
  931|       |        "'";
  932|       |#endif
  933|       |
  934|   267k|      do
  935|   499k|        {
  936|   499k|          if ((arg->flags & FLAG_GROUPING)
  ------------------
  |  |  136|   499k|#define FLAG_GROUPING   1
  ------------------
  |  Branch (936:15): [True: 0, False: 499k]
  ------------------
  937|   499k|              && (++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|   499k|          *--p = '0' + (aulong % 10);
  943|   499k|          aulong /= 10;
  944|   499k|        }
  945|   499k|      while (aulong);
  ------------------
  |  Branch (945:14): [True: 232k, False: 267k]
  ------------------
  946|   267k|    }
  947|   495k|  else if (arg->conspec == CONSPEC_OCTAL)
  ------------------
  |  Branch (947:12): [True: 0, False: 495k]
  ------------------
  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|   495k|  else /* HEX or HEXUP */
  959|   495k|    {
  960|   495k|      const char *digits = ((arg->conspec == CONSPEC_HEX)
  ------------------
  |  Branch (960:29): [True: 181k, False: 314k]
  ------------------
  961|   495k|                            ? "0123456789abcdef" : "0123456789ABCDEF");
  962|   495k|      do
  963|  1.20M|        {
  964|  1.20M|          *--p = digits[(aulong % 16)];
  965|  1.20M|          aulong /= 16;
  966|  1.20M|        }
  967|  1.20M|      while (aulong);
  ------------------
  |  Branch (967:14): [True: 705k, False: 495k]
  ------------------
  968|   495k|      if ((arg->flags & FLAG_ALT_CONV))
  ------------------
  |  |  140|   495k|#define FLAG_ALT_CONV   16
  ------------------
  |  Branch (968:11): [True: 0, False: 495k]
  ------------------
  969|      0|        n_extra += 2;
  970|   495k|    }
  971|       |
  972|   763k|  n = pend - p;
  973|       |
  974|   763k|  if ((arg->flags & FLAG_ZERO_PAD)
  ------------------
  |  |  141|   763k|#define FLAG_ZERO_PAD   32
  ------------------
  |  Branch (974:7): [True: 591k, False: 172k]
  ------------------
  975|   763k|      && arg->precision == NO_FIELD_VALUE && !(arg->flags & FLAG_LEFT_JUST)
  ------------------
  |  |  132|  1.35M|#define NO_FIELD_VALUE   (-1)
  ------------------
                    && arg->precision == NO_FIELD_VALUE && !(arg->flags & FLAG_LEFT_JUST)
  ------------------
  |  |  137|   591k|#define FLAG_LEFT_JUST  2
  ------------------
  |  Branch (975:10): [True: 591k, False: 0]
  |  Branch (975:46): [True: 591k, False: 0]
  ------------------
  976|   763k|      && n && arg->width - n_extra > n )
  ------------------
  |  Branch (976:10): [True: 591k, False: 0]
  |  Branch (976:15): [True: 287k, False: 303k]
  ------------------
  977|   287k|    n_prec = arg->width - n_extra - n;
  978|   475k|  else if (arg->precision > 0 && arg->precision > n)
  ------------------
  |  Branch (978:12): [True: 0, False: 475k]
  |  Branch (978:34): [True: 0, False: 0]
  ------------------
  979|      0|    n_prec = arg->precision - n;
  980|   475k|  else
  981|   475k|    n_prec = 0;
  982|       |
  983|   763k|  if (!(arg->flags & FLAG_LEFT_JUST)
  ------------------
  |  |  137|   763k|#define FLAG_LEFT_JUST  2
  ------------------
  |  Branch (983:7): [True: 763k, False: 0]
  ------------------
  984|   763k|      && arg->width >= 0 && arg->width - n_extra > n
  ------------------
  |  Branch (984:10): [True: 591k, False: 172k]
  |  Branch (984:29): [True: 287k, False: 303k]
  ------------------
  985|   763k|      && arg->width - n_extra - n >= n_prec )
  ------------------
  |  Branch (985:10): [True: 287k, False: 0]
  ------------------
  986|   287k|    {
  987|   287k|      rc = pad_out (outfnc, outfncarg, ' ',
  988|   287k|                    arg->width - n_extra - n - n_prec, nbytes);
  989|   287k|      if (rc)
  ------------------
  |  Branch (989:11): [True: 0, False: 287k]
  ------------------
  990|      0|        return rc;
  991|   287k|    }
  992|       |
  993|   763k|  if (signchar)
  ------------------
  |  Branch (993:7): [True: 0, False: 763k]
  ------------------
  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|   763k|  if ((arg->flags & FLAG_ALT_CONV)
  ------------------
  |  |  140|   763k|#define FLAG_ALT_CONV   16
  ------------------
  |  Branch (1001:7): [True: 0, False: 763k]
  ------------------
 1002|   763k|      && (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|   763k|  if (n_prec)
  ------------------
  |  Branch (1010:7): [True: 287k, False: 475k]
  ------------------
 1011|   287k|    {
 1012|   287k|      rc = pad_out (outfnc, outfncarg, '0', n_prec, nbytes);
 1013|   287k|      if (rc)
  ------------------
  |  Branch (1013:11): [True: 0, False: 287k]
  ------------------
 1014|      0|        return rc;
 1015|   287k|    }
 1016|       |
 1017|   763k|  rc = outfnc (outfncarg, p, pend - p);
 1018|   763k|  if (rc)
  ------------------
  |  Branch (1018:7): [True: 0, False: 763k]
  ------------------
 1019|      0|    return rc;
 1020|   763k|  *nbytes += pend - p;
 1021|       |
 1022|   763k|  if ((arg->flags & FLAG_LEFT_JUST)
  ------------------
  |  |  137|   763k|#define FLAG_LEFT_JUST  2
  ------------------
  |  Branch (1022:7): [True: 0, False: 763k]
  ------------------
 1023|   763k|      && 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|   763k|  return 0;
 1032|   763k|}
estream-printf.c:pad_out:
  814|   633k|{
  815|   633k|  char buf[32];
  816|   633k|  size_t n;
  817|   633k|  int rc;
  818|       |
  819|   979k|  while (count > 0)
  ------------------
  |  Branch (819:10): [True: 345k, False: 633k]
  ------------------
  820|   345k|    {
  821|   345k|      n = (count <= sizeof buf)? count : sizeof buf;
  ------------------
  |  Branch (821:11): [True: 345k, False: 0]
  ------------------
  822|   345k|      memset (buf, padchar, n);
  823|   345k|      rc = outfnc (outfncarg, buf, n);
  824|   345k|      if (rc)
  ------------------
  |  Branch (824:11): [True: 0, False: 345k]
  ------------------
  825|      0|        return rc;
  826|   345k|      *nbytes += n;
  827|   345k|      count -= n;
  828|   345k|    }
  829|       |
  830|   633k|  return 0;
  831|   633k|}
estream-printf.c:pr_char:
 1169|  39.6k|{
 1170|  39.6k|  int rc;
 1171|  39.6k|  char buf[1];
 1172|       |
 1173|  39.6k|  if (arg->vt != VALTYPE_INT)
  ------------------
  |  Branch (1173:7): [True: 0, False: 39.6k]
  ------------------
 1174|      0|    return -1;
 1175|  39.6k|  buf[0] = (unsigned int)value.a_int;
 1176|  39.6k|  rc = outfnc (outfncarg, buf, 1);
 1177|  39.6k|  if(rc)
  ------------------
  |  Branch (1177:6): [True: 0, False: 39.6k]
  ------------------
 1178|      0|    return rc;
 1179|  39.6k|  *nbytes += 1;
 1180|       |
 1181|  39.6k|  return 0;
 1182|  39.6k|}
estream-printf.c:pr_string:
 1190|   838k|{
 1191|   838k|  int rc;
 1192|   838k|  size_t n;
 1193|   838k|  const char *string, *s;
 1194|       |
 1195|   838k|  if (arg->vt != VALTYPE_STRING)
  ------------------
  |  Branch (1195:7): [True: 0, False: 838k]
  ------------------
 1196|      0|    return -1;
 1197|   838k|  if (sf)
  ------------------
  |  Branch (1197:7): [True: 631k, False: 206k]
  ------------------
 1198|   631k|    string = sf (value.a_string, string_no, sfvalue);
 1199|   206k|  else
 1200|   206k|    string = value.a_string;
 1201|       |
 1202|   838k|  if (!string)
  ------------------
  |  Branch (1202:7): [True: 0, False: 838k]
  ------------------
 1203|      0|    string = "(null)";
 1204|   838k|  if (arg->precision >= 0)
  ------------------
  |  Branch (1204:7): [True: 3, False: 838k]
  ------------------
 1205|      3|    {
 1206|       |      /* Test for nul after N so that we can pass a non-nul terminated
 1207|       |         string.  */
 1208|     60|      for (n=0,s=string; n < arg->precision && *s; s++)
  ------------------
  |  Branch (1208:26): [True: 57, False: 3]
  |  Branch (1208:48): [True: 57, False: 0]
  ------------------
 1209|     57|        n++;
 1210|      3|    }
 1211|   838k|  else
 1212|   838k|    n = strlen (string);
 1213|       |
 1214|   838k|  if (!(arg->flags & FLAG_LEFT_JUST)
  ------------------
  |  |  137|   838k|#define FLAG_LEFT_JUST  2
  ------------------
  |  Branch (1214:7): [True: 838k, False: 0]
  ------------------
 1215|   838k|      && arg->width >= 0 && arg->width > n )
  ------------------
  |  Branch (1215:10): [True: 58.2k, False: 779k]
  |  Branch (1215:29): [True: 58.2k, False: 0]
  ------------------
 1216|  58.2k|    {
 1217|  58.2k|      rc = pad_out (outfnc, outfncarg, ' ', arg->width - n, nbytes);
 1218|  58.2k|      if (rc)
  ------------------
  |  Branch (1218:11): [True: 0, False: 58.2k]
  ------------------
 1219|      0|        goto leave;
 1220|  58.2k|    }
 1221|       |
 1222|   838k|  rc = outfnc (outfncarg, string, n);
 1223|   838k|  if (rc)
  ------------------
  |  Branch (1223:7): [True: 0, False: 838k]
  ------------------
 1224|      0|    goto leave;
 1225|   838k|  *nbytes += n;
 1226|       |
 1227|   838k|  if ((arg->flags & FLAG_LEFT_JUST)
  ------------------
  |  |  137|   838k|#define FLAG_LEFT_JUST  2
  ------------------
  |  Branch (1227:7): [True: 0, False: 838k]
  ------------------
 1228|   838k|      && 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|   838k|  rc = 0;
 1236|       |
 1237|   838k| leave:
 1238|   838k|  if (sf) /* Tell the filter to release resources.  */
  ------------------
  |  Branch (1238:7): [True: 631k, False: 206k]
  ------------------
 1239|   631k|    sf (value.a_string, -1, sfvalue);
 1240|       |
 1241|   838k|  return rc;
 1242|   838k|}
estream-printf.c:pr_pointer:
 1249|  4.80k|{
 1250|  4.80k|  int rc;
 1251|       |#if defined(HAVE_LONG_LONG_INT) && (SIZEOF_UNSIGNED_LONG < SIZEOF_VOID_P)
 1252|       |  unsigned long long aulong;
 1253|       |#else
 1254|  4.80k|  unsigned long aulong;
 1255|  4.80k|#endif
 1256|  4.80k|  char numbuf[100];
 1257|  4.80k|  char *p, *pend;
 1258|       |
 1259|  4.80k|  if (arg->vt != VALTYPE_POINTER)
  ------------------
  |  Branch (1259:7): [True: 0, False: 4.80k]
  ------------------
 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.80k|  aulong = (unsigned long)value.a_void_ptr;
 1268|  4.80k|#endif
 1269|       |
 1270|  4.80k|  p = pend = numbuf + DIM(numbuf);
  ------------------
  |  |   93|  4.80k|# define DIM(array) (sizeof (array) / sizeof (*array))
  ------------------
 1271|  4.80k|  do
 1272|  33.6k|    {
 1273|  33.6k|      *--p = "0123456789abcdefx"[(aulong % 16)];
 1274|  33.6k|      aulong /= 16;
 1275|  33.6k|    }
 1276|  33.6k|  while (aulong);
  ------------------
  |  Branch (1276:10): [True: 28.8k, False: 4.80k]
  ------------------
 1277|  48.0k|  while ((pend-p) < 2*sizeof (aulong))
  ------------------
  |  Branch (1277:10): [True: 43.2k, False: 4.80k]
  ------------------
 1278|  43.2k|    *--p = '0';
 1279|  4.80k|  *--p = 'x';
 1280|  4.80k|  *--p = '0';
 1281|       |
 1282|  4.80k|  rc = outfnc (outfncarg, p, pend - p);
 1283|  4.80k|  if (rc)
  ------------------
  |  Branch (1283:7): [True: 0, False: 4.80k]
  ------------------
 1284|      0|    return rc;
 1285|  4.80k|  *nbytes += pend - p;
 1286|       |
 1287|  4.80k|  return 0;
 1288|  4.80k|}
estream-printf.c:fixed_buffer_out:
 1704|   482k|{
 1705|   482k|  struct fixed_buffer_parm_s *parm = outfncarg;
 1706|       |
 1707|   482k|  parm->count += buflen;
 1708|       |
 1709|   482k|  if (!parm->buffer)
  ------------------
  |  Branch (1709:7): [True: 0, False: 482k]
  ------------------
 1710|      0|    ;
 1711|   482k|  else if (parm->used + buflen < parm->size)
  ------------------
  |  Branch (1711:12): [True: 447k, False: 34.8k]
  ------------------
 1712|   447k|    {
 1713|       |      /* Handle the common case that everything fits into the buffer
 1714|       |         separately.  */
 1715|   447k|      memcpy (parm->buffer + parm->used, buf, buflen);
 1716|   447k|      parm->used += buflen;
 1717|   447k|    }
 1718|  34.8k|  else
 1719|  34.8k|    {
 1720|       |      /* The slow version of above.  */
 1721|  96.2k|      for ( ;buflen && parm->used < parm->size; buflen--)
  ------------------
  |  Branch (1721:14): [True: 62.3k, False: 33.8k]
  |  Branch (1721:24): [True: 61.3k, False: 981]
  ------------------
 1722|  61.3k|        parm->buffer[parm->used++] = *buf++;
 1723|  34.8k|    }
 1724|       |
 1725|   482k|  return 0;
 1726|   482k|}

_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|  5.72k|{
 3510|  5.72k|  unsigned int modeflags, cmode, xmode;
 3511|  5.72k|  int create_called = 0;
 3512|  5.72k|  estream_t stream = NULL;
 3513|  5.72k|  void *cookie = NULL;
 3514|  5.72k|  int err;
 3515|  5.72k|  struct cookie_io_functions_s *functions;
 3516|  5.72k|  es_syshd_t syshd;
 3517|  5.72k|  int kind;
 3518|       |
 3519|  5.72k|  err = parse_mode (mode, &modeflags, &xmode, &cmode);
 3520|  5.72k|  if (err)
  ------------------
  |  Branch (3520:7): [True: 0, False: 5.72k]
  ------------------
 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|  5.72k|    {
 3541|  5.72k|      kind = BACKEND_FD;
 3542|  5.72k|      functions = &estream_functions_fd;
 3543|  5.72k|      syshd.type = ES_SYSHD_FD;
  ------------------
  |  | 1255|  5.72k|#define ES_SYSHD_FD     GPGRT_SYSHD_FD
  ------------------
 3544|  5.72k|      err = func_file_create (&cookie, &syshd.u.fd,
 3545|  5.72k|                              path, modeflags, cmode);
 3546|  5.72k|    }
 3547|  5.72k|  if (err)
  ------------------
  |  Branch (3547:7): [True: 2, False: 5.72k]
  ------------------
 3548|      2|    goto leave;
 3549|       |
 3550|  5.72k|  create_called = 1;
 3551|  5.72k|  err = create_stream (&stream, cookie, &syshd, kind,
 3552|  5.72k|                       *functions, modeflags, xmode, 0);
 3553|  5.72k|  if (err)
  ------------------
  |  Branch (3553:7): [True: 0, False: 5.72k]
  ------------------
 3554|      0|    goto leave;
 3555|       |
 3556|  5.72k|  if (stream && path)
  ------------------
  |  Branch (3556:7): [True: 5.72k, False: 0]
  |  Branch (3556:17): [True: 5.72k, False: 0]
  ------------------
 3557|  5.72k|    fname_set_internal (stream, path, 1);
 3558|       |
 3559|  5.72k| leave:
 3560|  5.72k|  if (err && create_called)
  ------------------
  |  Branch (3560:7): [True: 2, False: 5.72k]
  |  Branch (3560:14): [True: 0, False: 2]
  ------------------
 3561|      0|    functions->public.func_close (cookie);
 3562|       |
 3563|  5.72k|  return stream;
 3564|  5.72k|}
_gpgrt__get_std_stream:
 4001|   151k|{
 4002|   151k|  estream_list_t list_obj;
 4003|   151k|  estream_t stream = NULL;
 4004|       |
 4005|   151k|  fd %= 3; /* We only allow 0, 1 or 2 but we don't want to return an error. */
 4006|       |
 4007|   151k|  lock_list ();
 4008|       |
 4009|   153k|  for (list_obj = estream_list; list_obj; list_obj = list_obj->next)
  ------------------
  |  Branch (4009:33): [True: 153k, False: 2]
  ------------------
 4010|   153k|    if (list_obj->stream && list_obj->stream->intern->is_stdstream
  ------------------
  |  Branch (4010:9): [True: 153k, False: 0]
  |  Branch (4010:29): [True: 151k, False: 1.29k]
  ------------------
 4011|   153k|        && list_obj->stream->intern->stdstream_fd == fd)
  ------------------
  |  Branch (4011:12): [True: 151k, False: 2]
  ------------------
 4012|   151k|      {
 4013|   151k|	stream = list_obj->stream;
 4014|   151k|	break;
 4015|   151k|      }
 4016|   151k|  if (!stream)
  ------------------
  |  Branch (4016:7): [True: 2, False: 151k]
  ------------------
 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|   151k|  unlock_list ();
 4060|   151k|  return stream;
 4061|   151k|}
_gpgrt_fclose:
 4144|  5.72k|{
 4145|  5.72k|  int err;
 4146|       |
 4147|  5.72k|  err = do_close (stream, 0, 0);
 4148|       |
 4149|  5.72k|  return err;
 4150|  5.72k|}
_gpgrt_flockfile:
 4302|  1.20M|{
 4303|  1.20M|  lock_stream (stream);
 4304|  1.20M|}
_gpgrt_funlockfile:
 4316|  1.20M|{
 4317|  1.20M|  unlock_stream (stream);
 4318|  1.20M|}
_gpgrt_ferror_unlocked:
 4401|  63.5k|{
 4402|  63.5k|  return stream->intern->indicators.err;
 4403|  63.5k|}
_gpgrt_ferror:
 4408|  4.81k|{
 4409|  4.81k|  int ret;
 4410|       |
 4411|  4.81k|  lock_stream (stream);
 4412|  4.81k|  ret = _gpgrt_ferror_unlocked (stream);
 4413|  4.81k|  unlock_stream (stream);
 4414|       |
 4415|  4.81k|  return ret;
 4416|  4.81k|}
_gpgrt_fflush:
 4457|  2.37k|{
 4458|  2.37k|  int err;
 4459|       |
 4460|  2.37k|  if (stream)
  ------------------
  |  Branch (4460:7): [True: 2.37k, False: 0]
  ------------------
 4461|  2.37k|    {
 4462|  2.37k|      lock_stream (stream);
 4463|  2.37k|      err = do_fflush (stream);
 4464|  2.37k|      unlock_stream (stream);
 4465|  2.37k|    }
 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|  2.37k|  return err ? EOF : 0;
  ------------------
  |  Branch (4481:10): [True: 0, False: 2.37k]
  ------------------
 4482|  2.37k|}
_gpgrt_fseeko:
 4500|  1.72k|{
 4501|  1.72k|  int err;
 4502|       |
 4503|  1.72k|  lock_stream (stream);
 4504|  1.72k|  err = es_seek (stream, offset, whence, NULL);
 4505|  1.72k|  unlock_stream (stream);
 4506|       |
 4507|  1.72k|  return err;
 4508|  1.72k|}
_gpgrt_ftello:
 4526|  9.63k|{
 4527|  9.63k|  gpgrt_off_t ret = -1;
 4528|       |
 4529|  9.63k|  lock_stream (stream);
 4530|  9.63k|  ret = es_offset_calculate (stream);
 4531|  9.63k|  unlock_stream (stream);
 4532|       |
 4533|  9.63k|  return ret;
 4534|  9.63k|}
_gpgrt__getc_underflow:
 4573|  9.63k|{
 4574|  9.63k|  int err;
 4575|  9.63k|  unsigned char c;
 4576|  9.63k|  size_t bytes_read;
 4577|       |
 4578|  9.63k|  err = es_readn (stream, &c, 1, &bytes_read);
 4579|       |
 4580|  9.63k|  return (err || (! bytes_read)) ? EOF : c;
  ------------------
  |  Branch (4580:11): [True: 0, False: 9.63k]
  |  Branch (4580:18): [True: 4.81k, False: 4.81k]
  ------------------
 4581|  9.63k|}
_gpgrt__putc_overflow:
 4586|   872k|{
 4587|   872k|  unsigned char d = c;
 4588|   872k|  int err;
 4589|       |
 4590|   872k|  err = es_writen (stream, &d, 1, NULL);
 4591|       |
 4592|   872k|  return err ? EOF : c;
  ------------------
  |  Branch (4592:10): [True: 0, False: 872k]
  ------------------
 4593|   872k|}
_gpgrt_fgetc:
 4598|  28.9k|{
 4599|  28.9k|  int ret;
 4600|       |
 4601|  28.9k|  lock_stream (stream);
 4602|  28.9k|  ret = _gpgrt_getc_unlocked (stream);
  ------------------
  |  |  395|  28.9k|  (((!(stream)->flags.writing)					\
  |  |  ------------------
  |  |  |  Branch (395:5): [True: 28.9k, False: 0]
  |  |  ------------------
  |  |  396|  28.9k|    && ((stream)->data_offset < (stream)->data_len)		\
  |  |  ------------------
  |  |  |  Branch (396:8): [True: 19.2k, False: 9.63k]
  |  |  ------------------
  |  |  397|  28.9k|    && (! (stream)->unread_data_len))				\
  |  |  ------------------
  |  |  |  Branch (397:8): [True: 19.2k, False: 0]
  |  |  ------------------
  |  |  398|  28.9k|  ? ((int) (stream)->buffer[((stream)->data_offset)++])		\
  |  |  399|  28.9k|  : _gpgrt__getc_underflow ((stream)))
  ------------------
 4603|  28.9k|  unlock_stream (stream);
 4604|       |
 4605|  28.9k|  return ret;
 4606|  28.9k|}
_gpgrt_fputc:
 4611|  1.16M|{
 4612|  1.16M|  int ret;
 4613|       |
 4614|  1.16M|  lock_stream (stream);
 4615|  1.16M|  ret = _gpgrt_putc_unlocked (c, stream);
  ------------------
  |  |  402|  1.16M|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 1.16M, False: 0]
  |  |  ------------------
  |  |  403|  1.16M|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 384k, False: 776k]
  |  |  ------------------
  |  |  404|  1.16M|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [True: 333k, False: 50.3k]
  |  |  ------------------
  |  |  405|  1.16M|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|  1.16M|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
 4616|  1.16M|  unlock_stream (stream);
 4617|       |
 4618|  1.16M|  return ret;
 4619|  1.16M|}
_gpgrt_fread:
 4679|  4.81k|{
 4680|  4.81k|  size_t ret, bytes;
 4681|       |
 4682|  4.81k|  if (size && nitems)
  ------------------
  |  Branch (4682:7): [True: 4.81k, False: 0]
  |  Branch (4682:15): [True: 4.81k, False: 0]
  ------------------
 4683|  4.81k|    {
 4684|  4.81k|      lock_stream (stream);
 4685|  4.81k|      es_readn (stream, ptr, size * nitems, &bytes);
 4686|  4.81k|      unlock_stream (stream);
 4687|       |
 4688|  4.81k|      ret = bytes / size;
 4689|  4.81k|    }
 4690|      0|  else
 4691|      0|    ret = 0;
 4692|       |
 4693|  4.81k|  return ret;
 4694|  4.81k|}
_gpgrt_fwrite:
 4700|    986|{
 4701|    986|  size_t ret, bytes;
 4702|       |
 4703|    986|  if (size && nitems)
  ------------------
  |  Branch (4703:7): [True: 986, False: 0]
  |  Branch (4703:15): [True: 986, False: 0]
  ------------------
 4704|    986|    {
 4705|    986|      lock_stream (stream);
 4706|    986|      es_writen (stream, ptr, size * nitems, &bytes);
 4707|    986|      unlock_stream (stream);
 4708|       |
 4709|    986|      ret = bytes / size;
 4710|    986|    }
 4711|      0|  else
 4712|      0|    ret = 0;
 4713|       |
 4714|    986|  return ret;
 4715|    986|}
_gpgrt_fputs_unlocked:
 4751|  5.47k|{
 4752|  5.47k|  size_t length;
 4753|  5.47k|  int err;
 4754|       |
 4755|  5.47k|  length = strlen (s);
 4756|  5.47k|  err = es_writen (stream, s, length, NULL);
 4757|  5.47k|  return err ? EOF : 0;
  ------------------
  |  Branch (4757:10): [True: 0, False: 5.47k]
  ------------------
 4758|  5.47k|}
_gpgrt_fputs:
 4762|  6.95k|{
 4763|  6.95k|  size_t length;
 4764|  6.95k|  int err;
 4765|       |
 4766|  6.95k|  length = strlen (s);
 4767|  6.95k|  lock_stream (stream);
 4768|  6.95k|  err = es_writen (stream, s, length, NULL);
 4769|  6.95k|  unlock_stream (stream);
 4770|       |
 4771|  6.95k|  return err ? EOF : 0;
  ------------------
  |  Branch (4771:10): [True: 0, False: 6.95k]
  ------------------
 4772|  6.95k|}
_gpgrt_vfprintf_unlocked:
 4961|  1.20M|{
 4962|  1.20M|  return do_print_stream (stream, sf, sfvalue, format, ap);
 4963|  1.20M|}
_gpgrt_vfprintf:
 4971|   224k|{
 4972|   224k|  int ret;
 4973|       |
 4974|   224k|  lock_stream (stream);
 4975|   224k|  ret = do_print_stream (stream, sf, sfvalue, format, ap);
 4976|   224k|  unlock_stream (stream);
 4977|       |
 4978|   224k|  return ret;
 4979|   224k|}
_gpgrt_fprintf_unlocked:
 4985|  85.3k|{
 4986|  85.3k|  int ret;
 4987|       |
 4988|  85.3k|  va_list ap;
 4989|  85.3k|  va_start (ap, format);
 4990|  85.3k|  ret = do_print_stream (stream, NULL, NULL, format, ap);
 4991|  85.3k|  va_end (ap);
 4992|       |
 4993|  85.3k|  return ret;
 4994|  85.3k|}
_gpgrt_setvbuf:
 5145|  1.43k|{
 5146|  1.43k|  int err;
 5147|       |
 5148|  1.43k|  if ((type == _IOFBF || type == _IOLBF || type == _IONBF)
  ------------------
  |  Branch (5148:8): [True: 0, False: 1.43k]
  |  Branch (5148:26): [True: 2, False: 1.43k]
  |  Branch (5148:44): [True: 1.43k, False: 0]
  ------------------
 5149|  1.43k|      && (!buf || size || type == _IONBF))
  ------------------
  |  Branch (5149:11): [True: 1.43k, False: 0]
  |  Branch (5149:19): [True: 0, False: 0]
  |  Branch (5149:27): [True: 0, False: 0]
  ------------------
 5150|  1.43k|    {
 5151|  1.43k|      lock_stream (stream);
 5152|  1.43k|      err = es_set_buffering (stream, buf, type, size);
 5153|  1.43k|      unlock_stream (stream);
 5154|  1.43k|    }
 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|  1.43k|  return err;
 5162|  1.43k|}
_gpgrt_set_binary:
 5171|  1.34k|{
 5172|  1.34k|  lock_stream (stream);
 5173|  1.34k|  if (!(stream->intern->modeflags & O_BINARY))
  ------------------
  |  |  106|  1.34k|# define O_BINARY 0
  ------------------
  |  Branch (5173:7): [True: 1.34k, False: 0]
  ------------------
 5174|  1.34k|    {
 5175|  1.34k|      stream->intern->modeflags |= O_BINARY;
  ------------------
  |  |  106|  1.34k|# define O_BINARY 0
  ------------------
 5176|       |#ifdef HAVE_DOSISH_SYSTEM
 5177|       |      if (stream->intern->func_read == func_fd_read)
 5178|       |        {
 5179|       |          estream_cookie_fd_t fd_cookie = stream->intern->cookie;
 5180|       |
 5181|       |          if (!IS_INVALID_FD (fd_cookie->fd))
 5182|       |            setmode (fd_cookie->fd, O_BINARY);
 5183|       |        }
 5184|       |      else if (stream->intern->func_read == func_fp_read)
 5185|       |        {
 5186|       |          estream_cookie_fp_t fp_cookie = stream->intern->cookie;
 5187|       |
 5188|       |          if (fp_cookie->fp)
 5189|       |            setmode (fileno (fp_cookie->fp), O_BINARY);
 5190|       |        }
 5191|       |#endif
 5192|  1.34k|    }
 5193|  1.34k|  unlock_stream (stream);
 5194|  1.34k|}
_gpgrt_write_sanitized:
 5665|  58.6k|{
 5666|  58.6k|  const unsigned char *p = buffer;
 5667|  58.6k|  size_t count = 0;
 5668|  58.6k|  int ret;
 5669|       |
 5670|  58.6k|  lock_stream (stream);
 5671|  1.69M|  for (; length; length--, p++, count++)
  ------------------
  |  Branch (5671:10): [True: 1.63M, False: 58.6k]
  ------------------
 5672|  1.63M|    {
 5673|  1.63M|      if (*p < 0x20
  ------------------
  |  Branch (5673:11): [True: 296k, False: 1.33M]
  ------------------
 5674|  1.63M|          || *p == 0x7f
  ------------------
  |  Branch (5674:14): [True: 2.54k, False: 1.33M]
  ------------------
 5675|  1.63M|          || (delimiters
  ------------------
  |  Branch (5675:15): [True: 0, False: 1.33M]
  ------------------
 5676|  1.33M|              && (strchr (delimiters, *p) || *p == '\\')))
  ------------------
  |  Branch (5676:19): [True: 0, False: 0]
  |  Branch (5676:46): [True: 0, False: 0]
  ------------------
 5677|   298k|        {
 5678|   298k|          _gpgrt_putc_unlocked ('\\', stream);
  ------------------
  |  |  402|   298k|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 298k, False: 0]
  |  |  ------------------
  |  |  403|   298k|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 297k, False: 1.87k]
  |  |  ------------------
  |  |  404|   298k|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|   298k|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|   298k|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
 5679|   298k|          count++;
 5680|   298k|          if (*p == '\n')
  ------------------
  |  Branch (5680:15): [True: 23.2k, False: 275k]
  ------------------
 5681|  23.2k|            {
 5682|  23.2k|              _gpgrt_putc_unlocked ('n', stream);
  ------------------
  |  |  402|  23.2k|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 23.2k, False: 0]
  |  |  ------------------
  |  |  403|  23.2k|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 23.0k, False: 143]
  |  |  ------------------
  |  |  404|  23.2k|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|  23.2k|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|  23.2k|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
 5683|  23.2k|              count++;
 5684|  23.2k|            }
 5685|   275k|          else if (*p == '\r')
  ------------------
  |  Branch (5685:20): [True: 11.0k, False: 264k]
  ------------------
 5686|  11.0k|            {
 5687|  11.0k|              _gpgrt_putc_unlocked ('r', stream);
  ------------------
  |  |  402|  11.0k|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 11.0k, False: 0]
  |  |  ------------------
  |  |  403|  11.0k|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 10.9k, False: 84]
  |  |  ------------------
  |  |  404|  11.0k|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|  11.0k|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|  11.0k|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
 5688|  11.0k|              count++;
 5689|  11.0k|            }
 5690|   264k|          else if (*p == '\f')
  ------------------
  |  Branch (5690:20): [True: 1.25k, False: 263k]
  ------------------
 5691|  1.25k|            {
 5692|  1.25k|              _gpgrt_putc_unlocked ('f', stream);
  ------------------
  |  |  402|  1.25k|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 1.25k, False: 0]
  |  |  ------------------
  |  |  403|  1.25k|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 1.06k, False: 192]
  |  |  ------------------
  |  |  404|  1.25k|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|  1.25k|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|  1.25k|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
 5693|  1.25k|              count++;
 5694|  1.25k|            }
 5695|   263k|          else if (*p == '\v')
  ------------------
  |  Branch (5695:20): [True: 9.65k, False: 253k]
  ------------------
 5696|  9.65k|            {
 5697|  9.65k|              _gpgrt_putc_unlocked ('v', stream);
  ------------------
  |  |  402|  9.65k|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 9.65k, False: 0]
  |  |  ------------------
  |  |  403|  9.65k|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 9.45k, False: 196]
  |  |  ------------------
  |  |  404|  9.65k|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|  9.65k|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|  9.65k|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
 5698|  9.65k|              count++;
 5699|  9.65k|            }
 5700|   253k|          else if (*p == '\b')
  ------------------
  |  Branch (5700:20): [True: 2.54k, False: 251k]
  ------------------
 5701|  2.54k|            {
 5702|  2.54k|              _gpgrt_putc_unlocked ('b', stream);
  ------------------
  |  |  402|  2.54k|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 2.54k, False: 0]
  |  |  ------------------
  |  |  403|  2.54k|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 2.29k, False: 251]
  |  |  ------------------
  |  |  404|  2.54k|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|  2.54k|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|  2.54k|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
 5703|  2.54k|              count++;
 5704|  2.54k|            }
 5705|   251k|          else if (!*p)
  ------------------
  |  Branch (5705:20): [True: 165k, False: 85.3k]
  ------------------
 5706|   165k|            {
 5707|   165k|              _gpgrt_putc_unlocked('0', stream);
  ------------------
  |  |  402|   165k|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 165k, False: 0]
  |  |  ------------------
  |  |  403|   165k|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 165k, False: 732]
  |  |  ------------------
  |  |  404|   165k|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [Folded - Ignored]
  |  |  ------------------
  |  |  405|   165k|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|   165k|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
 5708|   165k|              count++;
 5709|   165k|            }
 5710|  85.3k|          else
 5711|  85.3k|            {
 5712|  85.3k|              _gpgrt_fprintf_unlocked (stream, "x%02x", *p);
 5713|  85.3k|              count += 3;
 5714|  85.3k|            }
 5715|   298k|	}
 5716|  1.33M|      else
 5717|  1.33M|        {
 5718|  1.33M|          _gpgrt_putc_unlocked (*p, stream);
  ------------------
  |  |  402|  1.33M|  (((stream)->flags.writing					\
  |  |  ------------------
  |  |  |  Branch (402:5): [True: 1.33M, False: 0]
  |  |  ------------------
  |  |  403|  1.33M|    && ((stream)->data_offset < (stream)->buffer_size)		\
  |  |  ------------------
  |  |  |  Branch (403:8): [True: 1.29M, False: 42.4k]
  |  |  ------------------
  |  |  404|  1.33M|    && (c != '\n'))						\
  |  |  ------------------
  |  |  |  Branch (404:8): [True: 1.29M, False: 0]
  |  |  ------------------
  |  |  405|  1.33M|  ? ((int) ((stream)->buffer[((stream)->data_offset)++] = (c)))	\
  |  |  406|  1.33M|  : _gpgrt__putc_overflow ((c), (stream)))
  ------------------
 5719|  1.33M|          count++;
 5720|  1.33M|        }
 5721|  1.63M|    }
 5722|       |
 5723|  58.6k|  if (bytes_written)
  ------------------
  |  Branch (5723:7): [True: 0, False: 58.6k]
  ------------------
 5724|      0|    *bytes_written = count;
 5725|  58.6k|  ret =  _gpgrt_ferror_unlocked (stream)? -1 : 0;
  ------------------
  |  Branch (5725:10): [True: 0, False: 58.6k]
  ------------------
 5726|  58.6k|  unlock_stream (stream);
 5727|       |
 5728|  58.6k|  return ret;
 5729|  58.6k|}
estream.c:parse_mode:
 2101|  5.72k|{
 2102|  5.72k|  unsigned int omode, oflags, cmode;
 2103|  5.72k|  int got_cmode = 0;
 2104|       |
 2105|  5.72k|  *r_xmode = 0;
 2106|       |
 2107|  5.72k|  switch (*modestr)
 2108|  5.72k|    {
 2109|  4.70k|    case 'r':
  ------------------
  |  Branch (2109:5): [True: 4.70k, False: 1.01k]
  ------------------
 2110|  4.70k|      omode = O_RDONLY;
 2111|  4.70k|      oflags = 0;
 2112|  4.70k|      break;
 2113|  1.01k|    case 'w':
  ------------------
  |  Branch (2113:5): [True: 1.01k, False: 4.71k]
  ------------------
 2114|  1.01k|      omode = O_WRONLY;
 2115|  1.01k|      oflags = O_TRUNC | O_CREAT;
 2116|  1.01k|      break;
 2117|      3|    case 'a':
  ------------------
  |  Branch (2117:5): [True: 3, False: 5.72k]
  ------------------
 2118|      3|      omode = O_WRONLY;
 2119|      3|      oflags = O_APPEND | O_CREAT;
 2120|      3|      break;
 2121|      0|    default:
  ------------------
  |  Branch (2121:5): [True: 0, False: 5.72k]
  ------------------
 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|  5.72k|    }
 2125|  11.4k|  for (modestr++; *modestr; modestr++)
  ------------------
  |  Branch (2125:19): [True: 5.72k, False: 5.72k]
  ------------------
 2126|  5.72k|    {
 2127|  5.72k|      switch (*modestr)
 2128|  5.72k|        {
 2129|      0|        case '+':
  ------------------
  |  Branch (2129:9): [True: 0, False: 5.72k]
  ------------------
 2130|      0|          omode = O_RDWR;
 2131|      0|          break;
 2132|  5.72k|        case 'b':
  ------------------
  |  Branch (2132:9): [True: 5.72k, False: 0]
  ------------------
 2133|  5.72k|          oflags |= O_BINARY;
  ------------------
  |  |  106|  5.72k|# define O_BINARY 0
  ------------------
 2134|  5.72k|          break;
 2135|      0|        case 'x':
  ------------------
  |  Branch (2135:9): [True: 0, False: 5.72k]
  ------------------
 2136|      0|          oflags |= O_EXCL;
 2137|      0|          break;
 2138|      0|        case ',':
  ------------------
  |  Branch (2138:9): [True: 0, False: 5.72k]
  ------------------
 2139|      0|          goto keyvalue;
 2140|      0|        default: /* Ignore unknown flags.  */
  ------------------
  |  Branch (2140:9): [True: 0, False: 5.72k]
  ------------------
 2141|      0|          break;
 2142|  5.72k|        }
 2143|  5.72k|    }
 2144|       |
 2145|  5.72k| keyvalue:
 2146|       |  /* Parse key/value pairs (similar to fopen on mainframes).  */
 2147|  5.72k|  for (cmode=0; *modestr == ','; modestr += strcspn (modestr, ","))
  ------------------
  |  Branch (2147:17): [True: 0, False: 5.72k]
  ------------------
 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|  5.72k|  if (!got_cmode)
  ------------------
  |  Branch (2224:7): [True: 5.72k, False: 0]
  ------------------
 2225|  5.72k|    cmode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
 2226|       |
 2227|  5.72k|  *modeflags = (omode | oflags);
 2228|  5.72k|  if (r_cmode)
  ------------------
  |  Branch (2228:7): [True: 5.72k, False: 0]
  ------------------
 2229|  5.72k|    *r_cmode = cmode;
 2230|  5.72k|  return 0;
 2231|  5.72k|}
estream.c:func_fd_read:
 1008|  9.63k|{
 1009|  9.63k|  estream_cookie_fd_t file_cookie = cookie;
 1010|  9.63k|  gpgrt_ssize_t bytes_read;
 1011|       |
 1012|  9.63k|  trace (("enter: cookie=%p buffer=%p size=%d", cookie, buffer, (int)size));
  ------------------
  |  |  189|  9.63k|# define trace(X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (189:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1013|       |
 1014|  9.63k|  if (!size)
  ------------------
  |  Branch (1014:7): [True: 0, False: 9.63k]
  ------------------
 1015|      0|    bytes_read = -1; /* We don't know whether anything is pending.  */
 1016|  9.63k|  else if (IS_INVALID_FD (file_cookie->fd))
  ------------------
  |  |  148|  9.63k|#define IS_INVALID_FD(a)    ((a) == -1)
  |  |  ------------------
  |  |  |  Branch (148:29): [True: 0, False: 9.63k]
  |  |  ------------------
  ------------------
 1017|      0|    {
 1018|      0|      _gpgrt_yield ();
 1019|      0|      bytes_read = 0;
 1020|      0|    }
 1021|  9.63k|  else
 1022|  9.63k|    {
 1023|  9.63k|      _gpgrt_pre_syscall ();
 1024|  9.63k|      do
 1025|  9.63k|        {
 1026|  9.63k|          bytes_read = read (file_cookie->fd, buffer, size);
 1027|  9.63k|        }
 1028|  9.63k|      while (bytes_read == -1 && errno == EINTR);
  ------------------
  |  Branch (1028:14): [True: 0, False: 9.63k]
  |  Branch (1028:34): [True: 0, False: 0]
  ------------------
 1029|  9.63k|      _gpgrt_post_syscall ();
 1030|  9.63k|    }
 1031|       |
 1032|  9.63k|  trace_errno (bytes_read == -1, ("leave: bytes_read=%d", (int)bytes_read));
  ------------------
  |  |  190|  9.63k|# define trace_errno(C,X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (190:41): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1033|  9.63k|  return bytes_read;
 1034|  9.63k|}
estream.c:func_fd_write:
 1042|  3.32M|{
 1043|  3.32M|  estream_cookie_fd_t file_cookie = cookie;
 1044|  3.32M|  gpgrt_ssize_t bytes_written;
 1045|       |
 1046|  3.32M|  trace (("enter: cookie=%p buffer=%p size=%d", cookie, buffer, (int)size));
  ------------------
  |  |  189|  3.32M|# define trace(X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (189:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1047|       |
 1048|  3.32M|  if (IS_INVALID_FD (file_cookie->fd))
  ------------------
  |  |  148|  3.32M|#define IS_INVALID_FD(a)    ((a) == -1)
  |  |  ------------------
  |  |  |  Branch (148:29): [True: 0, False: 3.32M]
  |  |  ------------------
  ------------------
 1049|      0|    {
 1050|      0|      _gpgrt_yield ();
 1051|      0|      bytes_written = size; /* Yeah:  Success writing to the bit bucket.  */
 1052|      0|    }
 1053|  3.32M|  else if (buffer)
  ------------------
  |  Branch (1053:12): [True: 2.15M, False: 1.17M]
  ------------------
 1054|  2.15M|    {
 1055|  2.15M|      _gpgrt_pre_syscall ();
 1056|  2.15M|      do
 1057|  2.15M|        {
 1058|  2.15M|          bytes_written = write (file_cookie->fd, buffer, size);
 1059|  2.15M|        }
 1060|  2.15M|      while (bytes_written == -1 && errno == EINTR);
  ------------------
  |  Branch (1060:14): [True: 0, False: 2.15M]
  |  Branch (1060:37): [True: 0, False: 0]
  ------------------
 1061|  2.15M|      _gpgrt_post_syscall ();
 1062|  2.15M|    }
 1063|  1.17M|  else
 1064|  1.17M|    bytes_written = size; /* Note that for a flush SIZE should be 0.  */
 1065|       |
 1066|  3.32M|  trace_errno (bytes_written == -1,
  ------------------
  |  |  190|  3.32M|# define trace_errno(C,X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (190:41): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1067|  3.32M|               ("leave: bytes_written=%d", (int)bytes_written));
 1068|  3.32M|  return bytes_written;
 1069|  3.32M|}
estream.c:func_fd_seek:
 1077|  1.72k|{
 1078|  1.72k|  estream_cookie_fd_t file_cookie = cookie;
 1079|  1.72k|  gpgrt_off_t offset_new;
 1080|  1.72k|  int err;
 1081|       |
 1082|  1.72k|  if (IS_INVALID_FD (file_cookie->fd))
  ------------------
  |  |  148|  1.72k|#define IS_INVALID_FD(a)    ((a) == -1)
  |  |  ------------------
  |  |  |  Branch (148:29): [True: 0, False: 1.72k]
  |  |  ------------------
  ------------------
 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|  1.72k|  else
 1088|  1.72k|    {
 1089|  1.72k|      _gpgrt_pre_syscall ();
 1090|  1.72k|      offset_new = lseek (file_cookie->fd, *offset, whence);
 1091|  1.72k|      _gpgrt_post_syscall ();
 1092|  1.72k|      if (offset_new == -1)
  ------------------
  |  Branch (1092:11): [True: 0, False: 1.72k]
  ------------------
 1093|      0|        err = -1;
 1094|  1.72k|      else
 1095|  1.72k|        {
 1096|  1.72k|          *offset = offset_new;
 1097|  1.72k|          err = 0;
 1098|  1.72k|        }
 1099|  1.72k|    }
 1100|       |
 1101|  1.72k|  return err;
 1102|  1.72k|}
estream.c:func_file_create:
 1890|  5.72k|{
 1891|  5.72k|  estream_cookie_fd_t file_cookie;
 1892|  5.72k|  int err;
 1893|  5.72k|  int fd;
 1894|       |
 1895|  5.72k|  err = 0;
 1896|       |
 1897|  5.72k|  file_cookie = mem_alloc (sizeof (*file_cookie));
 1898|  5.72k|  if (! file_cookie)
  ------------------
  |  Branch (1898:7): [True: 0, False: 5.72k]
  ------------------
 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|  5.72k|  fd = open (path, modeflags, cmode);
 1922|  5.72k|#endif
 1923|  5.72k|  if (fd == -1)
  ------------------
  |  Branch (1923:7): [True: 2, False: 5.72k]
  ------------------
 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|  5.72k|  file_cookie->fd = fd;
 1935|  5.72k|  file_cookie->no_close = 0;
 1936|  5.72k|  *cookie = file_cookie;
 1937|  5.72k|  *filedes = fd;
 1938|       |
 1939|  5.72k| out:
 1940|       |
 1941|  5.72k|  if (err)
  ------------------
  |  Branch (1941:7): [True: 2, False: 5.72k]
  ------------------
 1942|      2|    mem_free (file_cookie);
 1943|       |
 1944|  5.72k|  return err;
 1945|  5.72k|}
estream.c:create_stream:
 2490|  5.72k|{
 2491|  5.72k|  estream_internal_t stream_internal_new;
 2492|  5.72k|  estream_t stream_new;
 2493|  5.72k|  int err;
 2494|       |#if HAVE_W32_SYSTEM
 2495|       |  void *old_cookie = NULL;
 2496|       |#endif
 2497|       |
 2498|  5.72k|  stream_new = NULL;
 2499|  5.72k|  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|  5.72k|  stream_new = mem_alloc (sizeof (*stream_new));
 2515|  5.72k|  if (! stream_new)
  ------------------
  |  Branch (2515:7): [True: 0, False: 5.72k]
  ------------------
 2516|      0|    {
 2517|      0|      err = -1;
 2518|      0|      goto out;
 2519|      0|    }
 2520|       |
 2521|  5.72k|  stream_internal_new = mem_alloc (sizeof (*stream_internal_new));
 2522|  5.72k|  if (! stream_internal_new)
  ------------------
  |  Branch (2522:7): [True: 0, False: 5.72k]
  ------------------
 2523|      0|    {
 2524|      0|      err = -1;
 2525|      0|      goto out;
 2526|      0|    }
 2527|       |
 2528|  5.72k|  stream_new->buffer = stream_internal_new->buffer;
 2529|  5.72k|  stream_new->buffer_size = sizeof (stream_internal_new->buffer);
 2530|  5.72k|  stream_new->unread_buffer = stream_internal_new->unread_buffer;
 2531|  5.72k|  stream_new->unread_buffer_size = sizeof (stream_internal_new->unread_buffer);
 2532|  5.72k|  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|  5.72k|  init_stream_obj (stream_new, cookie, syshd, kind, functions, modeflags,
 2553|  5.72k|                   xmode);
 2554|  5.72k|  init_stream_lock (stream_new);
 2555|       |
 2556|  5.72k|  err = do_list_add (stream_new, with_locked_list);
 2557|  5.72k|  if (err)
  ------------------
  |  Branch (2557:7): [True: 0, False: 5.72k]
  ------------------
 2558|      0|    goto out;
 2559|       |
 2560|  5.72k|  *r_stream = stream_new;
 2561|       |
 2562|  5.72k| out:
 2563|       |
 2564|  5.72k|  if (err)
  ------------------
  |  Branch (2564:7): [True: 0, False: 5.72k]
  ------------------
 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|  5.72k|  else
 2581|  5.72k|    trace (("leave: success stream=%p cookie=%p", *r_stream, cookie));
  ------------------
  |  |  189|  5.72k|# define trace(X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (189:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2582|       |
 2583|  5.72k|  return err;
 2584|  5.72k|}
estream.c:init_stream_lock:
  399|  5.72k|{
  400|  5.72k|  int rc;
  401|       |
  402|  5.72k|  if (!stream->intern->samethread)
  ------------------
  |  Branch (402:7): [True: 5.72k, False: 0]
  ------------------
  403|  5.72k|    {
  404|  5.72k|      dbg_lock_1 ("enter init_stream_lock for %p\n", stream);
  405|  5.72k|      memset (&stream->intern->lock, 0 , sizeof stream->intern->lock);
  406|  5.72k|      rc = _gpgrt_lock_init (&stream->intern->lock);
  407|  5.72k|      dbg_lock_2 ("leave init_stream_lock for %p: rc=%d\n", stream, rc);
  408|  5.72k|    }
  409|      0|  else
  410|      0|    rc = 0;
  411|  5.72k|  return rc;
  412|  5.72k|}
estream.c:do_list_add:
  510|  5.72k|{
  511|  5.72k|  estream_list_t item;
  512|       |
  513|  5.72k|  if (!with_locked_list)
  ------------------
  |  Branch (513:7): [True: 5.72k, False: 2]
  ------------------
  514|  5.72k|    lock_list ();
  515|       |
  516|  24.1k|  for (item = estream_list; item && item->stream; item = item->next)
  ------------------
  |  Branch (516:29): [True: 18.3k, False: 5.72k]
  |  Branch (516:37): [True: 18.3k, False: 0]
  ------------------
  517|  18.3k|    ;
  518|  5.72k|  if (!item)
  ------------------
  |  Branch (518:7): [True: 5.72k, False: 0]
  ------------------
  519|  5.72k|    {
  520|  5.72k|      item = mem_alloc (sizeof *item);
  521|  5.72k|      if (item)
  ------------------
  |  Branch (521:11): [True: 5.72k, False: 0]
  ------------------
  522|  5.72k|        {
  523|  5.72k|          item->next = estream_list;
  524|  5.72k|          estream_list = item;
  525|  5.72k|        }
  526|  5.72k|    }
  527|  5.72k|  if (item)
  ------------------
  |  Branch (527:7): [True: 5.72k, False: 0]
  ------------------
  528|  5.72k|    item->stream = stream;
  529|       |
  530|  5.72k|  if (!with_locked_list)
  ------------------
  |  Branch (530:7): [True: 5.72k, False: 2]
  ------------------
  531|  5.72k|    unlock_list ();
  532|       |
  533|  5.72k|  return item? 0 : -1;
  ------------------
  |  Branch (533:10): [True: 5.72k, False: 0]
  ------------------
  534|  5.72k|}
estream.c:destroy_stream_lock:
  417|  5.72k|{
  418|  5.72k|  if (!stream->intern->samethread)
  ------------------
  |  Branch (418:7): [True: 5.72k, False: 0]
  ------------------
  419|  5.72k|    {
  420|  5.72k|      dbg_lock_1 ("enter destroy_stream_lock for %p\n", stream);
  421|  5.72k|      _gpgrt_lock_destroy (&stream->intern->lock);
  422|  5.72k|      dbg_lock_1 ("leave destroy_stream_lock for %p\n", stream);
  423|  5.72k|    }
  424|  5.72k|}
estream.c:mem_free:
  224|  28.6k|{
  225|  28.6k|  if (p)
  ------------------
  |  Branch (225:7): [True: 28.6k, False: 0]
  ------------------
  226|  28.6k|    _gpgrt_free (p);
  227|  28.6k|}
estream.c:es_writen:
 3145|  5.09M|{
 3146|  5.09M|  size_t data_written;
 3147|  5.09M|  int err;
 3148|       |
 3149|  5.09M|  data_written = 0;
 3150|  5.09M|  err = 0;
 3151|       |
 3152|  5.09M|  if (!stream->flags.writing)
  ------------------
  |  Branch (3152:7): [True: 0, False: 5.09M]
  ------------------
 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|  5.09M|  switch (stream->intern->strategy)
  ------------------
  |  Branch (3171:11): [True: 0, False: 5.09M]
  ------------------
 3172|  5.09M|    {
 3173|  1.33M|    case _IONBF:
  ------------------
  |  Branch (3173:5): [True: 1.33M, False: 3.75M]
  ------------------
 3174|  1.33M|      err = es_write_nbf (stream, buffer, bytes_to_write, &data_written);
 3175|  1.33M|      break;
 3176|       |
 3177|  3.70M|    case _IOLBF:
  ------------------
  |  Branch (3177:5): [True: 3.70M, False: 1.39M]
  ------------------
 3178|  3.70M|      err = es_write_lbf (stream, buffer, bytes_to_write, &data_written);
 3179|  3.70M|      break;
 3180|       |
 3181|  50.3k|    case _IOFBF:
  ------------------
  |  Branch (3181:5): [True: 50.3k, False: 5.04M]
  ------------------
 3182|  50.3k|      err = es_write_fbf (stream, buffer, bytes_to_write, &data_written);
 3183|  50.3k|      break;
 3184|  5.09M|    }
 3185|       |
 3186|  5.09M| out:
 3187|       |
 3188|  5.09M|  if (bytes_written)
  ------------------
  |  Branch (3188:7): [True: 4.20M, False: 885k]
  ------------------
 3189|  4.20M|    *bytes_written = data_written;
 3190|       |
 3191|  5.09M|  return err;
 3192|  5.09M|}
estream.c:es_write_nbf:
 3015|  2.51M|{
 3016|  2.51M|  gpgrt_cookie_write_function_t func_write = stream->intern->func_write;
 3017|  2.51M|  size_t data_written;
 3018|  2.51M|  gpgrt_ssize_t ret;
 3019|  2.51M|  int err;
 3020|       |
 3021|  2.51M|  if (bytes_to_write && (! func_write))
  ------------------
  |  Branch (3021:7): [True: 2.45M, False: 58.5k]
  |  Branch (3021:25): [True: 0, False: 2.45M]
  ------------------
 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|  2.51M|  data_written = 0;
 3029|  2.51M|  err = 0;
 3030|       |
 3031|  4.96M|  while (bytes_to_write - data_written)
  ------------------
  |  Branch (3031:10): [True: 2.45M, False: 2.51M]
  ------------------
 3032|  2.45M|    {
 3033|  2.45M|      ret = (*func_write) (stream->intern->cookie,
 3034|  2.45M|			   buffer + data_written,
 3035|  2.45M|			   bytes_to_write - data_written);
 3036|  2.45M|      if (ret == -1)
  ------------------
  |  Branch (3036:11): [True: 0, False: 2.45M]
  ------------------
 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|  2.45M|      else
 3046|  2.45M|	data_written += ret;
 3047|  2.45M|    }
 3048|       |
 3049|  2.51M|  stream->intern->offset += data_written;
 3050|  2.51M|  *bytes_written = data_written;
 3051|       |
 3052|  2.51M| out:
 3053|       |
 3054|  2.51M|  return err;
 3055|  2.51M|}
estream.c:es_write_lbf:
 3111|  3.70M|{
 3112|  3.70M|  size_t data_flushed = 0;
 3113|  3.70M|  size_t data_buffered = 0;
 3114|  3.70M|  unsigned char *nlp;
 3115|  3.70M|  int err = 0;
 3116|       |
 3117|  3.70M|  nlp = memrchr (buffer, '\n', bytes_to_write);
 3118|  3.70M|  if (nlp)
  ------------------
  |  Branch (3118:7): [True: 1.17M, False: 2.53M]
  ------------------
 3119|  1.17M|    {
 3120|       |      /* Found a newline, directly write up to (including) this
 3121|       |	 character.  */
 3122|  1.17M|      err = flush_stream (stream);
 3123|  1.17M|      if (!err)
  ------------------
  |  Branch (3123:11): [True: 1.17M, False: 0]
  ------------------
 3124|  1.17M|	err = es_write_nbf (stream, buffer, nlp - buffer + 1, &data_flushed);
 3125|  1.17M|    }
 3126|       |
 3127|  3.70M|  if (!err)
  ------------------
  |  Branch (3127:7): [True: 3.70M, False: 0]
  ------------------
 3128|  3.70M|    {
 3129|       |      /* Write remaining data fully buffered.  */
 3130|  3.70M|      err = es_write_fbf (stream, buffer + data_flushed,
 3131|  3.70M|			  bytes_to_write - data_flushed, &data_buffered);
 3132|  3.70M|    }
 3133|       |
 3134|  3.70M|  *bytes_written = data_flushed + data_buffered;
 3135|  3.70M|  return err;
 3136|  3.70M|}
estream.c:es_write_fbf:
 3067|  3.75M|{
 3068|  3.75M|  size_t space_available;
 3069|  3.75M|  size_t data_to_write;
 3070|  3.75M|  size_t data_written;
 3071|  3.75M|  int err;
 3072|       |
 3073|  3.75M|  data_written = 0;
 3074|  3.75M|  err = 0;
 3075|       |
 3076|  6.33M|  while ((bytes_to_write - data_written) && (! err))
  ------------------
  |  Branch (3076:10): [True: 2.58M, False: 3.75M]
  |  Branch (3076:45): [True: 2.58M, False: 0]
  ------------------
 3077|  2.58M|    {
 3078|  2.58M|      if (stream->data_offset == stream->buffer_size)
  ------------------
  |  Branch (3078:11): [True: 147, False: 2.58M]
  ------------------
 3079|       |	/* Container full, flush buffer.  */
 3080|    147|	err = flush_stream (stream);
 3081|       |
 3082|  2.58M|      if (! err)
  ------------------
  |  Branch (3082:11): [True: 2.58M, False: 0]
  ------------------
 3083|  2.58M|	{
 3084|       |	  /* Flushing resulted in empty container.  */
 3085|       |
 3086|  2.58M|	  data_to_write = bytes_to_write - data_written;
 3087|  2.58M|	  space_available = stream->buffer_size - stream->data_offset;
 3088|  2.58M|	  if (data_to_write > space_available)
  ------------------
  |  Branch (3088:8): [True: 8, False: 2.58M]
  ------------------
 3089|      8|	    data_to_write = space_available;
 3090|       |
 3091|  2.58M|	  memcpy (stream->buffer + stream->data_offset,
 3092|  2.58M|		  buffer + data_written, data_to_write);
 3093|  2.58M|	  stream->data_offset += data_to_write;
 3094|  2.58M|	  data_written += data_to_write;
 3095|  2.58M|	}
 3096|  2.58M|    }
 3097|       |
 3098|  3.75M|  *bytes_written = data_written;
 3099|       |
 3100|  3.75M|  return err;
 3101|  3.75M|}
estream.c:es_seek:
 2944|  1.72k|{
 2945|  1.72k|  gpgrt_cookie_seek_function_t func_seek = stream->intern->func_seek;
 2946|  1.72k|  int err, ret;
 2947|  1.72k|  gpgrt_off_t off;
 2948|       |
 2949|  1.72k|  if (! func_seek)
  ------------------
  |  Branch (2949:7): [True: 0, False: 1.72k]
  ------------------
 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|  1.72k|  if (stream->flags.writing)
  ------------------
  |  Branch (2956:7): [True: 0, False: 1.72k]
  ------------------
 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|  1.72k|  off = offset;
 2967|  1.72k|  if (whence == SEEK_CUR)
  ------------------
  |  Branch (2967:7): [True: 0, False: 1.72k]
  ------------------
 2968|      0|    {
 2969|      0|      off = off - stream->data_len + stream->data_offset;
 2970|      0|      off -= stream->unread_data_len;
 2971|      0|    }
 2972|       |
 2973|  1.72k|  ret = (*func_seek) (stream->intern->cookie, &off, whence);
 2974|  1.72k|  if (ret == -1)
  ------------------
  |  Branch (2974:7): [True: 0, False: 1.72k]
  ------------------
 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|  1.72k|  err = 0;
 2985|  1.72k|  es_empty (stream);
 2986|       |
 2987|  1.72k|  if (offset_new)
  ------------------
  |  Branch (2987:7): [True: 0, False: 1.72k]
  ------------------
 2988|      0|    *offset_new = off;
 2989|       |
 2990|  1.72k|  stream->intern->indicators.eof = 0;
 2991|  1.72k|  stream->intern->offset = off;
 2992|       |
 2993|  1.72k| out:
 2994|       |
 2995|  1.72k|  if (err)
  ------------------
  |  Branch (2995:7): [True: 0, False: 1.72k]
  ------------------
 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|  1.72k|  return err;
 3003|  1.72k|}
estream.c:es_empty:
 2380|  1.72k|{
 2381|  1.72k|  gpgrt_assert (!stream->flags.writing);
  ------------------
  |  |  577|  1.72k|  ((expr)                                                       \
  |  |  ------------------
  |  |  |  Branch (577:4): [True: 1.72k, False: 0]
  |  |  ------------------
  |  |  578|  1.72k|   ? (void) 0                                                   \
  |  |  579|  1.72k|   : _gpgrt__log_assert (#expr, __FILE__, __LINE__, __FUNCTION__))
  ------------------
 2382|      0|  stream->data_len = 0;
 2383|  1.72k|  stream->data_offset = 0;
 2384|  1.72k|  stream->unread_data_len = 0;
 2385|  1.72k|}
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|  1.28M|{
 1740|  1.28M|  estream_cookie_fp_t file_cookie = cookie;
 1741|  1.28M|  size_t bytes_written;
 1742|       |
 1743|  1.28M|  if (file_cookie->fp)
  ------------------
  |  Branch (1743:7): [True: 1.28M, False: 0]
  ------------------
 1744|  1.28M|    {
 1745|  1.28M|      _gpgrt_pre_syscall ();
 1746|  1.28M|      if (buffer)
  ------------------
  |  Branch (1746:11): [True: 1.28M, False: 3.18k]
  ------------------
 1747|  1.28M|        {
 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|  1.28M|          bytes_written = fwrite (buffer, 1, size, file_cookie->fp);
 1767|  1.28M|#endif
 1768|  1.28M|        }
 1769|  3.18k|      else /* Only flush requested.  */
 1770|  3.18k|        bytes_written = size;
 1771|       |
 1772|  1.28M|      fflush (file_cookie->fp);
 1773|  1.28M|      _gpgrt_post_syscall ();
 1774|  1.28M|    }
 1775|      0|  else
 1776|      0|    bytes_written = size; /* Successfully written to the bit bucket.  */
 1777|       |
 1778|  1.28M|  if (bytes_written != size)
  ------------------
  |  Branch (1778:7): [True: 0, False: 1.28M]
  ------------------
 1779|      0|    return -1;
 1780|  1.28M|  return bytes_written;
 1781|  1.28M|}
estream.c:lock_list:
  470|   163k|{
  471|   163k|  dbg_lock_0 ("enter lock_list\n");
  472|   163k|  _gpgrt_lock_lock (&estream_list_lock);
  473|   163k|  dbg_lock_0 ("leave lock_list\n");
  474|   163k|}
estream.c:unlock_list:
  479|   163k|{
  480|   163k|  dbg_lock_0 ("enter unlock_list\n");
  481|   163k|  _gpgrt_lock_unlock (&estream_list_lock);
  482|   163k|  dbg_lock_0 ("leave unlock_list\n");
  483|   163k|}
estream.c:es_set_buffering:
 3419|  1.43k|{
 3420|  1.43k|  int err;
 3421|       |
 3422|       |  /* Flush or empty buffer depending on mode.  */
 3423|  1.43k|  if (stream->flags.writing)
  ------------------
  |  Branch (3423:7): [True: 1.43k, False: 0]
  ------------------
 3424|  1.43k|    {
 3425|  1.43k|      err = flush_stream (stream);
 3426|  1.43k|      if (err)
  ------------------
  |  Branch (3426:11): [True: 0, False: 1.43k]
  ------------------
 3427|      0|	goto out;
 3428|  1.43k|    }
 3429|      0|  else
 3430|      0|    es_empty (stream);
 3431|       |
 3432|  1.43k|  stream->intern->indicators.eof = 0;
 3433|       |
 3434|       |  /* Free old buffer in case that was allocated by this function.  */
 3435|  1.43k|  if (stream->intern->deallocate_buffer)
  ------------------
  |  Branch (3435:7): [True: 1, False: 1.43k]
  ------------------
 3436|      1|    {
 3437|      1|      stream->intern->deallocate_buffer = 0;
 3438|      1|      mem_free (stream->buffer);
 3439|      1|      stream->buffer = NULL;
 3440|      1|    }
 3441|       |
 3442|  1.43k|  if (mode == _IONBF)
  ------------------
  |  Branch (3442:7): [True: 1.43k, False: 3]
  ------------------
 3443|  1.43k|    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|  1.43k|  stream->intern->strategy = mode;
 3468|  1.43k|  err = 0;
 3469|       |
 3470|  1.43k| out:
 3471|       |
 3472|  1.43k|  return err;
 3473|  1.43k|}
estream.c:lock_stream:
  429|  2.71M|{
  430|  2.71M|  if (!stream->intern->samethread)
  ------------------
  |  Branch (430:7): [True: 2.71M, False: 0]
  ------------------
  431|  2.71M|    {
  432|  2.71M|      dbg_lock_1 ("enter lock_stream for %p\n", stream);
  433|  2.71M|      _gpgrt_lock_lock (&stream->intern->lock);
  434|  2.71M|      dbg_lock_1 ("leave lock_stream for %p\n", stream);
  435|  2.71M|    }
  436|  2.71M|}
estream.c:deinit_stream_obj:
 2443|  5.72k|{
 2444|  5.72k|  gpgrt_cookie_close_function_t func_close;
 2445|  5.72k|  int err, tmp_err;
 2446|       |
 2447|  5.72k|  trace (("enter: stream %p", stream));
  ------------------
  |  |  189|  5.72k|# define trace(X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (189:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2448|  5.72k|  func_close = stream->intern->func_close;
 2449|       |
 2450|  5.72k|  err = 0;
 2451|  5.72k|  if (stream->flags.writing)
  ------------------
  |  Branch (2451:7): [True: 1.01k, False: 4.70k]
  ------------------
 2452|  1.01k|    {
 2453|  1.01k|      tmp_err = flush_stream (stream);
 2454|  1.01k|      if (!err)
  ------------------
  |  Branch (2454:11): [True: 1.01k, False: 0]
  ------------------
 2455|  1.01k|        err = tmp_err;
 2456|  1.01k|    }
 2457|  5.72k|  if (func_close)
  ------------------
  |  Branch (2457:7): [True: 5.72k, False: 0]
  ------------------
 2458|  5.72k|    {
 2459|  5.72k|      trace (("stream %p calling func_close", stream));
  ------------------
  |  |  189|  5.72k|# define trace(X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (189:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2460|  5.72k|      tmp_err = func_close (stream->intern->cookie);
 2461|  5.72k|      if (!err)
  ------------------
  |  Branch (2461:11): [True: 5.72k, False: 0]
  ------------------
 2462|  5.72k|        err = tmp_err;
 2463|  5.72k|    }
 2464|       |
 2465|  5.72k|  mem_free (stream->intern->printable_fname);
 2466|  5.72k|  stream->intern->printable_fname = NULL;
 2467|  5.72k|  stream->intern->printable_fname_inuse = 0;
 2468|  5.72k|  while (stream->intern->onclose)
  ------------------
  |  Branch (2468:10): [True: 0, False: 5.72k]
  ------------------
 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|  5.72k|  trace_errno (err, ("leave: stream %p err=%d", stream, err));
  ------------------
  |  |  190|  5.72k|# define trace_errno(C,X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (190:41): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2476|  5.72k|  return err;
 2477|  5.72k|}
estream.c:init_stream_obj:
 2397|  5.72k|{
 2398|  5.72k|  stream->intern->kind = kind;
 2399|  5.72k|  stream->intern->cookie = cookie;
 2400|  5.72k|  stream->intern->opaque = NULL;
 2401|  5.72k|  stream->intern->offset = 0;
 2402|  5.72k|  stream->intern->func_read = functions.public.func_read;
 2403|  5.72k|  stream->intern->func_write = functions.public.func_write;
 2404|  5.72k|  stream->intern->func_seek = functions.public.func_seek;
 2405|  5.72k|  stream->intern->func_ioctl = functions.func_ioctl;
 2406|  5.72k|  stream->intern->func_close = functions.public.func_close;
 2407|  5.72k|  stream->intern->strategy = _IOFBF;
 2408|  5.72k|  stream->intern->syshd = *syshd;
 2409|  5.72k|  stream->intern->print_ntotal = 0;
 2410|  5.72k|  stream->intern->indicators.err = 0;
 2411|  5.72k|  stream->intern->indicators.eof = 0;
 2412|  5.72k|  stream->intern->indicators.hup = 0;
 2413|  5.72k|  stream->intern->is_stdstream = 0;
 2414|  5.72k|  stream->intern->stdstream_fd = 0;
 2415|  5.72k|  stream->intern->deallocate_buffer = 0;
 2416|  5.72k|  stream->intern->printable_fname = NULL;
 2417|  5.72k|  stream->intern->printable_fname_inuse = 0;
 2418|  5.72k|  stream->intern->samethread = !! (xmode & X_SAMETHREAD);
  ------------------
  |  | 2044|  5.72k|#define X_SAMETHREAD	(1 << 0)
  ------------------
 2419|  5.72k|  stream->intern->onclose = NULL;
 2420|       |
 2421|  5.72k|  stream->data_len = 0;
 2422|  5.72k|  stream->data_offset = 0;
 2423|  5.72k|  stream->data_flushed = 0;
 2424|  5.72k|  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|  5.72k|  if ((modeflags & O_WRONLY) || (modeflags & O_RDWR) )
  ------------------
  |  Branch (2430:7): [True: 1.01k, False: 4.70k]
  |  Branch (2430:33): [True: 0, False: 4.70k]
  ------------------
 2431|  1.01k|    stream->flags.writing = 1;
 2432|  4.70k|  else
 2433|  4.70k|    stream->flags.writing = 0;
 2434|  5.72k|}
estream.c:func_fd_destroy:
 1153|  5.72k|{
 1154|  5.72k|  estream_cookie_fd_t fd_cookie = cookie;
 1155|  5.72k|  int err;
 1156|       |
 1157|  5.72k|  trace (("enter: cookie=%p", cookie));
  ------------------
  |  |  189|  5.72k|# define trace(X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (189:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1158|       |
 1159|  5.72k|  if (fd_cookie)
  ------------------
  |  Branch (1159:7): [True: 5.72k, False: 0]
  ------------------
 1160|  5.72k|    {
 1161|  5.72k|      if (IS_INVALID_FD (fd_cookie->fd))
  ------------------
  |  |  148|  5.72k|#define IS_INVALID_FD(a)    ((a) == -1)
  |  |  ------------------
  |  |  |  Branch (148:29): [True: 0, False: 5.72k]
  |  |  ------------------
  ------------------
 1162|      0|        err = 0;
 1163|  5.72k|      else
 1164|  5.72k|        err = fd_cookie->no_close? 0 : close (fd_cookie->fd);
  ------------------
  |  Branch (1164:15): [True: 0, False: 5.72k]
  ------------------
 1165|  5.72k|      mem_free (fd_cookie);
 1166|  5.72k|    }
 1167|      0|  else
 1168|      0|    err = 0;
 1169|       |
 1170|  5.72k|  trace_errno (err,("leave: err=%d", err));
  ------------------
  |  |  190|  5.72k|# define trace_errno(C,X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (190:41): [Folded - Ignored]
  |  |  ------------------
  ------------------
 1171|  5.72k|  return err;
 1172|  5.72k|}
estream.c:do_close:
 2593|  5.72k|{
 2594|  5.72k|  int err;
 2595|       |
 2596|  5.72k|  trace (("stream %p %s", stream, with_locked_list? "(with locked list)":""));
  ------------------
  |  |  189|  5.72k|# define trace(X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (189:33): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2597|       |
 2598|  5.72k|  if (stream)
  ------------------
  |  Branch (2598:7): [True: 5.72k, False: 0]
  ------------------
 2599|  5.72k|    {
 2600|  5.72k|      do_list_remove (stream, with_locked_list);
 2601|  5.72k|      if (cancel_mode)
  ------------------
  |  Branch (2601:11): [True: 0, False: 5.72k]
  ------------------
 2602|      0|        {
 2603|      0|          stream->flags.writing = 0;
 2604|      0|          es_empty (stream);
 2605|      0|        }
 2606|  5.72k|      while (stream->intern->onclose)
  ------------------
  |  Branch (2606:14): [True: 0, False: 5.72k]
  ------------------
 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|  5.72k|      err = deinit_stream_obj (stream);
 2617|  5.72k|      destroy_stream_lock (stream);
 2618|  5.72k|      if (stream->intern->deallocate_buffer)
  ------------------
  |  Branch (2618:11): [True: 0, False: 5.72k]
  ------------------
 2619|      0|        mem_free (stream->buffer);
 2620|  5.72k|      mem_free (stream->intern);
 2621|  5.72k|      mem_free (stream);
 2622|  5.72k|    }
 2623|      0|  else
 2624|      0|    err = 0;
 2625|       |
 2626|  5.72k|  trace_errno (err, ("stream %p err=%d", stream, err));
  ------------------
  |  |  190|  5.72k|# define trace_errno(C,X) do { } while (0)
  |  |  ------------------
  |  |  |  Branch (190:41): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2627|  5.72k|  return err;
 2628|  5.72k|}
estream.c:do_list_remove:
  541|  5.72k|{
  542|  5.72k|  estream_list_t item, item_prev = NULL;
  543|       |
  544|  5.72k|  if (!with_locked_list)
  ------------------
  |  Branch (544:7): [True: 5.72k, False: 0]
  ------------------
  545|  5.72k|    lock_list ();
  546|       |
  547|  5.72k|  for (item = estream_list; item; item = item->next)
  ------------------
  |  Branch (547:29): [True: 5.72k, False: 0]
  ------------------
  548|  5.72k|    if (item->stream == stream)
  ------------------
  |  Branch (548:9): [True: 5.72k, False: 1]
  ------------------
  549|  5.72k|      break;
  550|      1|    else
  551|      1|      item_prev = item;
  552|       |
  553|  5.72k|  if (item)
  ------------------
  |  Branch (553:7): [True: 5.72k, False: 0]
  ------------------
  554|  5.72k|    {
  555|  5.72k|      if (item_prev)
  ------------------
  |  Branch (555:11): [True: 1, False: 5.72k]
  ------------------
  556|      1|        item_prev->next = item->next;
  557|  5.72k|      else
  558|  5.72k|        estream_list = item->next;
  559|  5.72k|      mem_free (item);
  560|  5.72k|    }
  561|       |
  562|  5.72k|  if (!with_locked_list)
  ------------------
  |  Branch (562:7): [True: 5.72k, False: 0]
  ------------------
  563|  5.72k|    unlock_list ();
  564|  5.72k|}
estream.c:unlock_stream:
  458|  2.71M|{
  459|  2.71M|  if (!stream->intern->samethread)
  ------------------
  |  Branch (459:7): [True: 2.71M, False: 0]
  ------------------
  460|  2.71M|    {
  461|  2.71M|      dbg_lock_1 ("enter unlock_stream for %p\n", stream);
  462|  2.71M|      _gpgrt_lock_unlock (&stream->intern->lock);
  463|  2.71M|      dbg_lock_1 ("leave unlock_stream for %p\n", stream);
  464|  2.71M|    }
  465|  2.71M|}
estream.c:flush_stream:
 2296|  1.17M|{
 2297|  1.17M|  gpgrt_cookie_write_function_t func_write = stream->intern->func_write;
 2298|  1.17M|  int err;
 2299|       |
 2300|  1.17M|  gpgrt_assert (stream->flags.writing);
  ------------------
  |  |  577|  1.17M|  ((expr)                                                       \
  |  |  ------------------
  |  |  |  Branch (577:4): [True: 1.17M, False: 0]
  |  |  ------------------
  |  |  578|  1.17M|   ? (void) 0                                                   \
  |  |  579|  1.17M|   : _gpgrt__log_assert (#expr, __FILE__, __LINE__, __FUNCTION__))
  ------------------
 2301|       |
 2302|  1.17M|  if (stream->data_offset)
  ------------------
  |  Branch (2302:7): [True: 979k, False: 197k]
  ------------------
 2303|   979k|    {
 2304|   979k|      size_t bytes_written;
 2305|   979k|      size_t data_flushed;
 2306|   979k|      gpgrt_ssize_t ret;
 2307|       |
 2308|   979k|      if (! func_write)
  ------------------
  |  Branch (2308:11): [True: 0, False: 979k]
  ------------------
 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|   979k|      data_flushed = 0;
 2322|   979k|      err = 0;
 2323|       |
 2324|  1.95M|      while ((((gpgrt_ssize_t) (stream->data_offset - data_flushed)) > 0)
  ------------------
  |  Branch (2324:14): [True: 979k, False: 979k]
  ------------------
 2325|  1.95M|             && !err)
  ------------------
  |  Branch (2325:17): [True: 979k, False: 0]
  ------------------
 2326|   979k|	{
 2327|   979k|	  ret = (*func_write) (stream->intern->cookie,
 2328|   979k|			       stream->buffer + data_flushed,
 2329|   979k|			       stream->data_offset - data_flushed);
 2330|   979k|	  if (ret == -1)
  ------------------
  |  Branch (2330:8): [True: 0, False: 979k]
  ------------------
 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|   979k|	  else
 2340|   979k|	    bytes_written = ret;
 2341|       |
 2342|   979k|	  data_flushed += bytes_written;
 2343|   979k|	  if (err)
  ------------------
  |  Branch (2343:8): [True: 0, False: 979k]
  ------------------
 2344|      0|	    break;
 2345|   979k|	}
 2346|       |
 2347|   979k|      stream->data_flushed += data_flushed;
 2348|   979k|      if (stream->data_offset == data_flushed)
  ------------------
  |  Branch (2348:11): [True: 979k, False: 0]
  ------------------
 2349|   979k|	{
 2350|   979k|	  stream->intern->offset += stream->data_offset;
 2351|   979k|	  stream->data_offset = 0;
 2352|   979k|	  stream->data_flushed = 0;
 2353|   979k|	}
 2354|   979k|    }
 2355|   197k|  else
 2356|   197k|    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|  1.17M|  (*func_write) (stream->intern->cookie, NULL, 0);
 2361|       |
 2362|  1.17M| out:
 2363|       |
 2364|  1.17M|  if (err && errno != EAGAIN)
  ------------------
  |  Branch (2364:7): [True: 0, False: 1.17M]
  |  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|  1.17M|  return err;
 2372|  1.17M|}
estream.c:do_fflush:
 4440|  2.37k|{
 4441|  2.37k|  int err;
 4442|       |
 4443|  2.37k|  if (stream->flags.writing)
  ------------------
  |  Branch (4443:7): [True: 2.37k, False: 0]
  ------------------
 4444|  2.37k|    err = flush_stream (stream);
 4445|      0|  else
 4446|      0|    {
 4447|      0|      es_empty (stream);
 4448|      0|      err = 0;
 4449|      0|    }
 4450|       |
 4451|  2.37k|  return err;
 4452|  2.37k|}
estream.c:es_offset_calculate:
 3478|  9.63k|{
 3479|  9.63k|  gpgrt_off_t offset;
 3480|       |
 3481|  9.63k|  offset = stream->intern->offset + stream->data_offset;
 3482|  9.63k|  if (offset < stream->unread_data_len)
  ------------------
  |  Branch (3482:7): [True: 0, False: 9.63k]
  ------------------
 3483|       |    /* Offset undefined.  */
 3484|      0|    offset = 0;
 3485|  9.63k|  else
 3486|  9.63k|    offset -= stream->unread_data_len;
 3487|       |
 3488|  9.63k|  return offset;
 3489|  9.63k|}
estream.c:es_readn:
 2819|  14.4k|{
 2820|  14.4k|  unsigned char *buffer = (unsigned char *)buffer_arg;
 2821|  14.4k|  size_t data_read_unread, data_read;
 2822|  14.4k|  int err;
 2823|       |
 2824|  14.4k|  data_read_unread = 0;
 2825|  14.4k|  data_read = 0;
 2826|  14.4k|  err = 0;
 2827|       |
 2828|  14.4k|  if (stream->flags.writing)
  ------------------
  |  Branch (2828:7): [True: 0, False: 14.4k]
  ------------------
 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|  14.4k|  while ((bytes_to_read - data_read_unread) && stream->unread_data_len)
  ------------------
  |  Branch (2838:10): [True: 14.4k, False: 0]
  |  Branch (2838:48): [True: 0, False: 14.4k]
  ------------------
 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|  14.4k|  switch (stream->intern->strategy)
  ------------------
  |  Branch (2846:11): [True: 0, False: 14.4k]
  ------------------
 2847|  14.4k|    {
 2848|      0|    case _IONBF:
  ------------------
  |  Branch (2848:5): [True: 0, False: 14.4k]
  ------------------
 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: 14.4k]
  ------------------
 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|  14.4k|    case _IOFBF:
  ------------------
  |  Branch (2858:5): [True: 14.4k, False: 0]
  ------------------
 2859|  14.4k|      err = do_read_fbf (stream,
 2860|  14.4k|			 buffer + data_read_unread,
 2861|  14.4k|			 bytes_to_read - data_read_unread, &data_read);
 2862|  14.4k|      break;
 2863|  14.4k|    }
 2864|       |
 2865|  14.4k| out:
 2866|       |
 2867|  14.4k|  if (bytes_read)
  ------------------
  |  Branch (2867:7): [True: 14.4k, False: 0]
  ------------------
 2868|  14.4k|    *bytes_read = data_read_unread + data_read;
 2869|       |
 2870|  14.4k|  return err;
 2871|  14.4k|}
estream.c:do_read_fbf:
 2728|  14.4k|{
 2729|  14.4k|  size_t data_available;
 2730|  14.4k|  size_t data_to_read;
 2731|  14.4k|  size_t data_read;
 2732|  14.4k|  int err;
 2733|       |
 2734|  14.4k|  data_read = 0;
 2735|  14.4k|  err = 0;
 2736|       |
 2737|  24.0k|  while ((bytes_to_read - data_read) && (! err))
  ------------------
  |  Branch (2737:10): [True: 14.4k, False: 9.63k]
  |  Branch (2737:41): [True: 14.4k, False: 0]
  ------------------
 2738|  14.4k|    {
 2739|  14.4k|      if (stream->data_offset == stream->data_len)
  ------------------
  |  Branch (2739:11): [True: 9.63k, False: 4.81k]
  ------------------
 2740|  9.63k|	{
 2741|       |	  /* Nothing more to read in current container, try to
 2742|       |	     fill container with new data.  */
 2743|  9.63k|	  err = fill_stream (stream);
 2744|  9.63k|	  if (! err)
  ------------------
  |  Branch (2744:8): [True: 9.63k, False: 0]
  ------------------
 2745|  9.63k|	    if (! stream->data_len)
  ------------------
  |  Branch (2745:10): [True: 4.81k, False: 4.81k]
  ------------------
 2746|       |	      /* Filling did not result in any data read.  */
 2747|  4.81k|	      break;
 2748|  9.63k|	}
 2749|       |
 2750|  9.63k|      if (! err)
  ------------------
  |  Branch (2750:11): [True: 9.63k, False: 0]
  ------------------
 2751|  9.63k|	{
 2752|       |	  /* Filling resulted in some new data.  */
 2753|       |
 2754|  9.63k|	  data_to_read = bytes_to_read - data_read;
 2755|  9.63k|	  data_available = stream->data_len - stream->data_offset;
 2756|  9.63k|	  if (data_to_read > data_available)
  ------------------
  |  Branch (2756:8): [True: 0, False: 9.63k]
  ------------------
 2757|      0|	    data_to_read = data_available;
 2758|       |
 2759|  9.63k|	  memcpy (buffer + data_read,
 2760|  9.63k|		  stream->buffer + stream->data_offset, data_to_read);
 2761|  9.63k|	  stream->data_offset += data_to_read;
 2762|  9.63k|	  data_read += data_to_read;
 2763|  9.63k|	}
 2764|  9.63k|    }
 2765|       |
 2766|  14.4k|  *bytes_read = data_read;
 2767|       |
 2768|  14.4k|  return err;
 2769|  14.4k|}
estream.c:fill_stream:
 2241|  9.63k|{
 2242|  9.63k|  size_t bytes_read = 0;
 2243|  9.63k|  int err;
 2244|       |
 2245|  9.63k|  if (!stream->intern->func_read)
  ------------------
  |  Branch (2245:7): [True: 0, False: 9.63k]
  ------------------
 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|  9.63k|  else if (!stream->buffer_size)
  ------------------
  |  Branch (2250:12): [True: 0, False: 9.63k]
  ------------------
 2251|      0|    err = 0;
 2252|  9.63k|  else
 2253|  9.63k|    {
 2254|  9.63k|      gpgrt_cookie_read_function_t func_read = stream->intern->func_read;
 2255|  9.63k|      gpgrt_ssize_t ret;
 2256|       |
 2257|  9.63k|      ret = (*func_read) (stream->intern->cookie,
 2258|  9.63k|			  stream->buffer, stream->buffer_size);
 2259|  9.63k|      if (ret == -1)
  ------------------
  |  Branch (2259:11): [True: 0, False: 9.63k]
  ------------------
 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|  9.63k|      else
 2269|  9.63k|	{
 2270|  9.63k|	  bytes_read = ret;
 2271|  9.63k|	  err = 0;
 2272|  9.63k|	}
 2273|  9.63k|    }
 2274|       |
 2275|  9.63k|  if (err)
  ------------------
  |  Branch (2275:7): [True: 0, False: 9.63k]
  ------------------
 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|  9.63k|  else if (!bytes_read)
  ------------------
  |  Branch (2284:12): [True: 4.81k, False: 4.81k]
  ------------------
 2285|  4.81k|    stream->intern->indicators.eof = 1;
 2286|       |
 2287|  9.63k|  stream->intern->offset += stream->data_len;
 2288|  9.63k|  stream->data_len = bytes_read;
 2289|  9.63k|  stream->data_offset = 0;
 2290|       |
 2291|  9.63k|  return err;
 2292|  9.63k|}
estream.c:mem_alloc:
  212|  28.6k|{
  213|  28.6k|  return _gpgrt_malloc (n);
  214|  28.6k|}
estream.c:do_print_stream:
 3405|  1.51M|{
 3406|  1.51M|  int rc;
 3407|       |
 3408|  1.51M|  stream->intern->print_ntotal = 0;
 3409|  1.51M|  rc = _gpgrt_estream_format (print_writer, stream, sf, sfvalue, format, ap);
 3410|  1.51M|  if (rc)
  ------------------
  |  Branch (3410:7): [True: 0, False: 1.51M]
  ------------------
 3411|      0|    return -1;
 3412|  1.51M|  return (int)stream->intern->print_ntotal;
 3413|  1.51M|}
estream.c:print_writer:
 3388|  4.20M|{
 3389|  4.20M|  estream_t stream = outfncarg;
 3390|  4.20M|  size_t nwritten;
 3391|  4.20M|  int rc;
 3392|       |
 3393|  4.20M|  nwritten = 0;
 3394|  4.20M|  rc = es_writen (stream, buf, buflen, &nwritten);
 3395|  4.20M|  stream->intern->print_ntotal += nwritten;
 3396|  4.20M|  return rc;
 3397|  4.20M|}
estream.c:fname_set_internal:
 5598|  5.72k|{
 5599|  5.72k|  if (stream->intern->printable_fname
  ------------------
  |  Branch (5599:7): [True: 0, False: 5.72k]
  ------------------
 5600|  5.72k|      && !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|  5.72k|  if (stream->intern->printable_fname)
  ------------------
  |  Branch (5605:7): [True: 0, False: 5.72k]
  ------------------
 5606|      0|    return; /* Can't change because it is in use.  */
 5607|       |
 5608|  5.72k|  if (*fname != '[')
  ------------------
  |  Branch (5608:7): [True: 5.72k, False: 2]
  ------------------
 5609|  5.72k|    quote = 0;
 5610|      2|  else
 5611|      2|    quote = !!quote;
 5612|       |
 5613|  5.72k|  stream->intern->printable_fname = mem_alloc (strlen (fname) + quote + 1);
 5614|  5.72k|  if (quote)
  ------------------
  |  Branch (5614:7): [True: 0, False: 5.72k]
  ------------------
 5615|      0|    stream->intern->printable_fname[0] = '\\';
 5616|  5.72k|  strcpy (stream->intern->printable_fname+quote, fname);
 5617|  5.72k|}

strsource.c:gpg_err_source:
  977|   130k|{
  978|   130k|  return (gpg_err_source_t) ((err >> GPG_ERR_SOURCE_SHIFT)
  ------------------
  |  |  748|   130k|#define GPG_ERR_SOURCE_SHIFT	24
  ------------------
  979|   130k|			     & GPG_ERR_SOURCE_MASK);
  ------------------
  |  |  747|   130k|#define GPG_ERR_SOURCE_MASK	(GPG_ERR_SOURCE_DIM - 1)
  ------------------
  980|   130k|}
strerror.c:gpg_err_code:
  969|   362k|{
  970|   362k|  return (gpg_err_code_t) (err & GPG_ERR_CODE_MASK);
  ------------------
  |  |  742|   362k|#define GPG_ERR_CODE_MASK	(GPG_ERR_CODE_DIM - 1)
  ------------------
  971|   362k|}

_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|  59.3k|{
  235|  59.3k|  if (custom_realloc)
  ------------------
  |  Branch (235:7): [True: 0, False: 59.3k]
  ------------------
  236|      0|    return custom_realloc (a, n);
  237|       |
  238|  59.3k|  if (!n)
  ------------------
  |  Branch (238:7): [True: 29.6k, False: 29.6k]
  ------------------
  239|  29.6k|    {
  240|  29.6k|      free (a);
  241|  29.6k|      return NULL;
  242|  29.6k|    }
  243|       |
  244|  29.6k|  if (!a)
  ------------------
  |  Branch (244:7): [True: 29.6k, False: 0]
  ------------------
  245|  29.6k|    return malloc (n);
  246|       |
  247|      0|  return realloc (a, n);
  248|  29.6k|}
_gpgrt_malloc:
  303|  29.6k|{
  304|  29.6k|  if (!n)
  ------------------
  |  Branch (304:7): [True: 0, False: 29.6k]
  ------------------
  305|      0|    n++;
  306|  29.6k|  return _gpgrt_realloc (NULL, n);
  307|  29.6k|}
_gpgrt_free:
  398|  30.7k|{
  399|  30.7k|  int save_errno;
  400|       |
  401|  30.7k|  if (!a)
  ------------------
  |  Branch (401:7): [True: 1.05k, False: 29.6k]
  ------------------
  402|  1.05k|    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|  29.6k|  save_errno = errno;
  409|  29.6k|  _gpgrt_realloc (a, 0);
  410|  29.6k|  if (save_errno && save_errno != errno)
  ------------------
  |  Branch (410:7): [True: 29.6k, False: 5]
  |  Branch (410:21): [True: 0, False: 29.6k]
  ------------------
  411|      0|    _gpg_err_set_errno (save_errno);
  412|  29.6k|}
_gpg_err_set_errno:
  417|  8.43k|{
  418|  8.43k|  errno = err;
  419|  8.43k|}
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|   852k|{
  129|       |  /* Protect against counter overflow.  */
  130|   852k|  if (errorcount < 30000)
  ------------------
  |  Branch (130:7): [True: 30.0k, False: 822k]
  ------------------
  131|  30.0k|    errorcount++;
  132|   852k|}
_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|  26.7k|{
  644|  26.7k|  if (!logstream)
  ------------------
  |  Branch (644:7): [True: 0, False: 26.7k]
  ------------------
  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|  26.7k|  return logstream;
  655|  26.7k|}
_gpgrt_logv_internal:
  844|  1.20M|{
  845|  1.20M|  int leading_backspace = (fmt && *fmt == '\b');
  ------------------
  |  Branch (845:28): [True: 1.20M, False: 4.28k]
  |  Branch (845:35): [True: 0, False: 1.20M]
  ------------------
  846|  1.20M|  int length;
  847|  1.20M|  int rc;
  848|       |
  849|  1.20M|  if (!logstream)
  ------------------
  |  Branch (849:7): [True: 1, False: 1.20M]
  ------------------
  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|  1.20M|  _gpgrt_flockfile (logstream);
  872|  1.20M|  if (missing_lf && level != GPGRT_LOGLVL_CONT)
  ------------------
  |  Branch (872:7): [True: 31.0k, False: 1.17M]
  |  Branch (872:21): [True: 0, False: 31.0k]
  ------------------
  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|  1.20M|  missing_lf = 0;
  875|       |
  876|  1.20M|  length = print_prefix (level, leading_backspace);
  877|  1.20M|  if (leading_backspace)
  ------------------
  |  Branch (877:7): [True: 0, False: 1.20M]
  ------------------
  878|      0|    fmt++;
  879|       |
  880|  1.20M|  if (fmt)
  ------------------
  |  Branch (880:7): [True: 1.20M, False: 4.28k]
  ------------------
  881|  1.20M|    {
  882|  1.20M|      if (prefmt)
  ------------------
  |  Branch (882:11): [True: 0, False: 1.20M]
  ------------------
  883|      0|        {
  884|      0|          _gpgrt_fputs_unlocked (prefmt, logstream);
  885|      0|          length += strlen (prefmt);
  886|      0|        }
  887|       |
  888|  1.20M|      if (ignore_arg_ptr)
  ------------------
  |  Branch (888:11): [True: 0, False: 1.20M]
  ------------------
  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|  1.20M|      else
  910|  1.20M|        {
  911|  1.20M|          struct fmt_string_filter_s sf = {NULL};
  912|       |
  913|  1.20M|          rc = _gpgrt_vfprintf_unlocked (logstream, fmt_string_filter, &sf,
  914|  1.20M|                                         fmt, arg_ptr);
  915|  1.20M|          if (rc > 0)
  ------------------
  |  Branch (915:15): [True: 1.20M, False: 0]
  ------------------
  916|  1.20M|            length += rc;
  917|  1.20M|        }
  918|       |
  919|  1.20M|      if (*fmt && fmt[strlen(fmt)-1] != '\n')
  ------------------
  |  Branch (919:11): [True: 1.20M, False: 0]
  |  Branch (919:19): [True: 31.0k, False: 1.17M]
  ------------------
  920|  31.0k|        missing_lf = 1;
  921|  1.20M|    }
  922|       |
  923|       |  /* If we have an EXTRASTRING print it now while we still hold the
  924|       |   * lock on the logstream.  */
  925|  1.20M|  if (extrastring)
  ------------------
  |  Branch (925:7): [True: 0, False: 1.20M]
  ------------------
  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|  1.20M|  if (level == GPGRT_LOGLVL_FATAL)
  ------------------
  |  Branch (979:7): [True: 0, False: 1.20M]
  ------------------
  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|  1.20M|  else if (level == GPGRT_LOGLVL_BUG)
  ------------------
  |  Branch (986:12): [True: 0, False: 1.20M]
  ------------------
  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|  1.20M|  else
 1007|  1.20M|    _gpgrt_funlockfile (logstream);
 1008|       |
 1009|       |  /* Bumb the error counter for log_error.  */
 1010|  1.20M|  if (level == GPGRT_LOGLVL_ERROR)
  ------------------
  |  Branch (1010:7): [True: 825k, False: 381k]
  ------------------
 1011|   825k|    _gpgrt_inc_errorcount ();
 1012|       |
 1013|  1.20M|  return length;
 1014|  1.20M|}
_gpgrt_logv:
 1030|  1.20M|{
 1031|  1.20M|  _gpgrt_logv_internal (level, 0, NULL, NULL, fmt, arg_ptr);
 1032|  1.20M|}
_gpgrt_log_flush:
 1155|  4.28k|{
 1156|  4.28k|  do_log_ignore_arg (GPGRT_LOGLVL_CONT, NULL);
 1157|  4.28k|}
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|  1.20M|{
  753|  1.20M|  int rc;
  754|  1.20M|  int length = 0;
  755|       |
  756|  1.20M|  if (level != GPGRT_LOGLVL_CONT)
  ------------------
  |  Branch (756:7): [True: 1.17M, False: 35.2k]
  ------------------
  757|  1.17M|    { /* Note this does not work for multiple line logging as we would
  758|       |       * need to print to a buffer first */
  759|  1.17M|      if (with_time && !force_prefixes)
  ------------------
  |  Branch (759:11): [True: 0, False: 1.17M]
  |  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|  1.17M|      if (with_prefix || force_prefixes)
  ------------------
  |  Branch (772:11): [True: 0, False: 1.17M]
  |  Branch (772:26): [True: 0, False: 1.17M]
  ------------------
  773|      0|        {
  774|      0|          _gpgrt_fputs_unlocked (prefix_buffer, logstream);
  775|      0|          length += strlen (prefix_buffer);
  776|      0|        }
  777|  1.17M|      if (with_pid || force_prefixes)
  ------------------
  |  Branch (777:11): [True: 0, False: 1.17M]
  |  Branch (777:23): [True: 0, False: 1.17M]
  ------------------
  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|  1.17M|      if ((!with_time && (with_prefix || with_pid)) || force_prefixes)
  ------------------
  |  Branch (792:12): [True: 1.17M, False: 0]
  |  Branch (792:27): [True: 0, False: 1.17M]
  |  Branch (792:42): [True: 0, False: 1.17M]
  |  Branch (792:56): [True: 0, False: 1.17M]
  ------------------
  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|  1.17M|      if (!leading_backspace
  ------------------
  |  Branch (799:11): [True: 1.17M, False: 0]
  ------------------
  800|  1.17M|          && (with_time || with_prefix || with_pid || force_prefixes))
  ------------------
  |  Branch (800:15): [True: 0, False: 1.17M]
  |  Branch (800:28): [True: 0, False: 1.17M]
  |  Branch (800:43): [True: 0, False: 1.17M]
  |  Branch (800:55): [True: 0, False: 1.17M]
  ------------------
  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|  1.17M|    }
  806|       |
  807|  1.20M|  switch (level)
  808|  1.20M|    {
  809|      0|    case GPGRT_LOGLVL_BEGIN: break;
  ------------------
  |  Branch (809:5): [True: 0, False: 1.20M]
  ------------------
  810|  35.2k|    case GPGRT_LOGLVL_CONT: break;
  ------------------
  |  Branch (810:5): [True: 35.2k, False: 1.17M]
  ------------------
  811|   340k|    case GPGRT_LOGLVL_INFO: break;
  ------------------
  |  Branch (811:5): [True: 340k, False: 866k]
  ------------------
  812|      0|    case GPGRT_LOGLVL_WARN: break;
  ------------------
  |  Branch (812:5): [True: 0, False: 1.20M]
  ------------------
  813|   825k|    case GPGRT_LOGLVL_ERROR: break;
  ------------------
  |  Branch (813:5): [True: 825k, False: 381k]
  ------------------
  814|      0|    case GPGRT_LOGLVL_FATAL:
  ------------------
  |  Branch (814:5): [True: 0, False: 1.20M]
  ------------------
  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: 1.20M]
  ------------------
  819|      0|      _gpgrt_fputs_unlocked ("Ohhhh jeeee: ", logstream);
  820|      0|      length += 13;
  821|      0|      break;
  822|  5.47k|    case GPGRT_LOGLVL_DEBUG:
  ------------------
  |  Branch (822:5): [True: 5.47k, False: 1.20M]
  ------------------
  823|  5.47k|      _gpgrt_fputs_unlocked ("DBG: ", logstream);
  824|  5.47k|      length += 5;
  825|  5.47k|      break;
  826|      0|    default:
  ------------------
  |  Branch (826:5): [True: 0, False: 1.20M]
  ------------------
  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|  1.20M|    }
  833|       |
  834|  1.20M|  return length;
  835|  1.20M|}
logging.c:fmt_string_filter:
  662|  1.26M|{
  663|  1.26M|  struct fmt_string_filter_s *state = opaque;
  664|  1.26M|  const unsigned char *p;
  665|  1.26M|  size_t buflen;
  666|  1.26M|  char *d;
  667|  1.26M|  int any;
  668|       |
  669|  1.26M|  if (no == -1)
  ------------------
  |  Branch (669:7): [True: 631k, False: 631k]
  ------------------
  670|   631k|    {
  671|       |      /* The printf engine asked us to release resources.  */
  672|   631k|      if (state->last_result)
  ------------------
  |  Branch (672:11): [True: 1.05k, False: 630k]
  ------------------
  673|  1.05k|        {
  674|  1.05k|          _gpgrt_free (state->last_result);
  675|  1.05k|          state->last_result = NULL;
  676|  1.05k|        }
  677|   631k|      return NULL;
  678|   631k|    }
  679|       |
  680|   631k|  if (!string)
  ------------------
  |  Branch (680:7): [True: 0, False: 631k]
  ------------------
  681|      0|    return NULL; /* Nothing to filter - printf handles NULL nicely.  */
  682|       |
  683|       |  /* Check whether escaping is needed and count needed length. */
  684|   631k|  any = 0;
  685|   631k|  buflen = 1;
  686|  9.73M|  for (p = (const unsigned char *)string; *p; p++)
  ------------------
  |  Branch (686:43): [True: 9.10M, False: 631k]
  ------------------
  687|  9.10M|    {
  688|  9.10M|      switch (*p)
  689|  9.10M|        {
  690|      0|        case '\n':
  ------------------
  |  Branch (690:9): [True: 0, False: 9.10M]
  ------------------
  691|      0|        case '\r':
  ------------------
  |  Branch (691:9): [True: 0, False: 9.10M]
  ------------------
  692|      0|        case '\f':
  ------------------
  |  Branch (692:9): [True: 0, False: 9.10M]
  ------------------
  693|      0|        case '\v':
  ------------------
  |  Branch (693:9): [True: 0, False: 9.10M]
  ------------------
  694|      0|        case '\b':
  ------------------
  |  Branch (694:9): [True: 0, False: 9.10M]
  ------------------
  695|      0|        case '\t':
  ------------------
  |  Branch (695:9): [True: 0, False: 9.10M]
  ------------------
  696|      0|        case '\a':
  ------------------
  |  Branch (696:9): [True: 0, False: 9.10M]
  ------------------
  697|  23.5k|        case '\\':
  ------------------
  |  Branch (697:9): [True: 23.5k, False: 9.07M]
  ------------------
  698|  23.5k|          buflen += 2;
  699|  23.5k|          any = 1;
  700|  23.5k|          break;
  701|  9.07M|        default:
  ------------------
  |  Branch (701:9): [True: 9.07M, False: 23.5k]
  ------------------
  702|  9.07M|          if (*p < 0x20 || *p == 0x7f)
  ------------------
  |  Branch (702:15): [True: 0, False: 9.07M]
  |  Branch (702:28): [True: 0, False: 9.07M]
  ------------------
  703|      0|            {
  704|      0|              buflen += 5;
  705|      0|              any = 1;
  706|      0|            }
  707|  9.07M|          else
  708|  9.07M|            buflen++;
  709|  9.10M|        }
  710|  9.10M|    }
  711|   631k|  if (!any)
  ------------------
  |  Branch (711:7): [True: 630k, False: 1.05k]
  ------------------
  712|   630k|    return (char*)string;  /* Nothing to escape.  */
  713|       |
  714|       |  /* Create a buffer and escape the input.  */
  715|  1.05k|  _gpgrt_free (state->last_result);
  716|  1.05k|  state->last_result = _gpgrt_malloc (buflen);
  717|  1.05k|  if (!state->last_result)
  ------------------
  |  Branch (717:7): [True: 0, False: 1.05k]
  ------------------
  718|      0|    return "[out_of_core_in_format_string_filter]";
  719|       |
  720|  1.05k|  d = state->last_result;
  721|   102k|  for (p = (const unsigned char *)string; *p; p++)
  ------------------
  |  Branch (721:43): [True: 100k, False: 1.05k]
  ------------------
  722|   100k|    {
  723|   100k|      switch (*p)
  724|   100k|        {
  725|      0|        case '\n': *d++ = '\\'; *d++ = 'n'; break;
  ------------------
  |  Branch (725:9): [True: 0, False: 100k]
  ------------------
  726|      0|        case '\r': *d++ = '\\'; *d++ = 'r'; break;
  ------------------
  |  Branch (726:9): [True: 0, False: 100k]
  ------------------
  727|      0|        case '\f': *d++ = '\\'; *d++ = 'f'; break;
  ------------------
  |  Branch (727:9): [True: 0, False: 100k]
  ------------------
  728|      0|        case '\v': *d++ = '\\'; *d++ = 'v'; break;
  ------------------
  |  Branch (728:9): [True: 0, False: 100k]
  ------------------
  729|      0|        case '\b': *d++ = '\\'; *d++ = 'b'; break;
  ------------------
  |  Branch (729:9): [True: 0, False: 100k]
  ------------------
  730|      0|        case '\t': *d++ = '\\'; *d++ = 't'; break;
  ------------------
  |  Branch (730:9): [True: 0, False: 100k]
  ------------------
  731|      0|        case '\a': *d++ = '\\'; *d++ = 'a'; break;
  ------------------
  |  Branch (731:9): [True: 0, False: 100k]
  ------------------
  732|  23.5k|        case '\\': *d++ = '\\'; *d++ = '\\'; break;
  ------------------
  |  Branch (732:9): [True: 23.5k, False: 77.4k]
  ------------------
  733|       |
  734|  77.4k|        default:
  ------------------
  |  Branch (734:9): [True: 77.4k, False: 23.5k]
  ------------------
  735|  77.4k|          if (*p < 0x20 || *p == 0x7f)
  ------------------
  |  Branch (735:15): [True: 0, False: 77.4k]
  |  Branch (735:28): [True: 0, False: 77.4k]
  ------------------
  736|      0|            {
  737|      0|              snprintf (d, 5, "\\x%02x", *p);
  ------------------
  |  |  483|      0|#define snprintf _gpgrt_estream_snprintf
  ------------------
  738|      0|              d += 4;
  739|      0|            }
  740|  77.4k|          else
  741|  77.4k|            *d++ = *p;
  742|   100k|        }
  743|   100k|    }
  744|  1.05k|  *d = 0;
  745|  1.05k|  return state->last_result;
  746|  1.05k|}
logging.c:do_log_ignore_arg:
 1048|  4.28k|{
 1049|  4.28k|  va_list arg_ptr;
 1050|  4.28k|  va_start (arg_ptr, str);
 1051|  4.28k|  _gpgrt_logv_internal (level, 1, NULL, NULL, str, arg_ptr);
 1052|  4.28k|  va_end (arg_ptr);
 1053|  4.28k|}

_gpgrt_lock_init:
  165|  5.72k|{
  166|  5.72k|  _gpgrt_lock_t *lock = (_gpgrt_lock_t*)lockhd;
  167|  5.72k|  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|  5.72k|  if (!lock->vers)
  ------------------
  |  Branch (172:7): [True: 5.72k, False: 0]
  ------------------
  173|  5.72k|    {
  174|  5.72k|      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|  5.72k|      lock->vers = LOCK_ABI_VERSION;
  ------------------
  |  |   25|  5.72k|# define LOCK_ABI_VERSION 1
  ------------------
  180|  5.72k|    }
  181|      0|  else /* Run the usual check.  */
  182|      0|    lock = get_lock_object (lockhd);
  183|       |
  184|  5.72k|#if USE_POSIX_THREADS
  185|  5.72k|  if (use_pthread_p())
  ------------------
  |  |   62|  5.72k|#   define use_pthread_p() (!!pthread_cancel)
  |  |  ------------------
  |  |  |  Branch (62:28): [True: 5.72k, False: 0]
  |  |  ------------------
  ------------------
  186|  5.72k|    {
  187|  5.72k|      rc = pthread_mutex_init (&lock->u.mtx, NULL);
  188|  5.72k|      if (rc)
  ------------------
  |  Branch (188:11): [True: 0, False: 5.72k]
  ------------------
  189|      0|        rc = _gpg_err_code_from_errno (rc);
  190|  5.72k|    }
  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|  5.72k|  return rc;
  198|  5.72k|}
_gpgrt_lock_lock:
  203|  3.01M|{
  204|  3.01M|  _gpgrt_lock_t *lock = get_lock_object (lockhd);
  205|  3.01M|  int rc;
  206|       |
  207|  3.01M|#if USE_POSIX_THREADS
  208|  3.01M|  if (use_pthread_p())
  ------------------
  |  |   62|  3.01M|#   define use_pthread_p() (!!pthread_cancel)
  |  |  ------------------
  |  |  |  Branch (62:28): [True: 3.01M, False: 0]
  |  |  ------------------
  ------------------
  209|  3.01M|    {
  210|  3.01M|      _gpgrt_pre_syscall ();
  211|  3.01M|      rc = pthread_mutex_lock (&lock->u.mtx);
  212|  3.01M|      if (rc)
  ------------------
  |  Branch (212:11): [True: 0, False: 3.01M]
  ------------------
  213|      0|        rc = _gpg_err_code_from_errno (rc);
  214|  3.01M|      _gpgrt_post_syscall ();
  215|  3.01M|    }
  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|  3.01M|  return rc;
  223|  3.01M|}
_gpgrt_lock_unlock:
  251|  3.01M|{
  252|  3.01M|  _gpgrt_lock_t *lock = get_lock_object (lockhd);
  253|  3.01M|  int rc;
  254|       |
  255|  3.01M|#if USE_POSIX_THREADS
  256|  3.01M|  if (use_pthread_p())
  ------------------
  |  |   62|  3.01M|#   define use_pthread_p() (!!pthread_cancel)
  |  |  ------------------
  |  |  |  Branch (62:28): [True: 3.01M, False: 0]
  |  |  ------------------
  ------------------
  257|  3.01M|    {
  258|  3.01M|      rc = pthread_mutex_unlock (&lock->u.mtx);
  259|  3.01M|      if (rc)
  ------------------
  |  Branch (259:11): [True: 0, False: 3.01M]
  ------------------
  260|      0|        rc = _gpg_err_code_from_errno (rc);
  261|  3.01M|    }
  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|  3.01M|  return rc;
  269|  3.01M|}
_gpgrt_lock_destroy:
  276|  5.72k|{
  277|  5.72k|  _gpgrt_lock_t *lock = get_lock_object (lockhd);
  278|  5.72k|  int rc;
  279|       |
  280|  5.72k|#if USE_POSIX_THREADS
  281|  5.72k|  if (use_pthread_p())
  ------------------
  |  |   62|  5.72k|#   define use_pthread_p() (!!pthread_cancel)
  |  |  ------------------
  |  |  |  Branch (62:28): [True: 5.72k, False: 0]
  |  |  ------------------
  ------------------
  282|  5.72k|    {
  283|  5.72k|      rc = pthread_mutex_destroy (&lock->u.mtx);
  284|  5.72k|      if (rc)
  ------------------
  |  Branch (284:11): [True: 0, False: 5.72k]
  ------------------
  285|      0|        rc = _gpg_err_code_from_errno (rc);
  286|  5.72k|      else
  287|  5.72k|        {
  288|       |          /* Re-init the mutex so that it can be re-used.  */
  289|  5.72k|          gpgrt_lock_t tmp = GPGRT_LOCK_INITIALIZER;
  ------------------
  |  | 1126|  5.72k|#define GPGRT_LOCK_INITIALIZER {1,{{0,0,0,0,0,0,0,0, \
  |  | 1127|  5.72k|                                    0,0,0,0,0,0,0,0, \
  |  | 1128|  5.72k|                                    0,0,0,0,0,0,0,0, \
  |  | 1129|  5.72k|                                    0,0,0,0,0,0,0,0, \
  |  | 1130|  5.72k|                                    0,0,0,0,0,0,0,0}}}
  ------------------
  290|  5.72k|          memcpy (lockhd, &tmp, sizeof tmp);
  291|  5.72k|        }
  292|  5.72k|    }
  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|  5.72k|  return rc;
  300|  5.72k|}
posix-lock.c:get_lock_object:
  145|  6.04M|{
  146|  6.04M|  _gpgrt_lock_t *lock = (_gpgrt_lock_t*)lockhd;
  147|       |
  148|  6.04M|  if (lock->vers != LOCK_ABI_VERSION)
  ------------------
  |  |   25|  6.04M|# define LOCK_ABI_VERSION 1
  ------------------
  |  Branch (148:7): [True: 0, False: 6.04M]
  ------------------
  149|      0|    {
  150|      0|      fputs ("gpgrt fatal: lock ABI version mismatch\n", stderr);
  151|      0|      _gpgrt_abort ();
  152|      0|    }
  153|  6.04M|  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|  6.04M|  return lock;
  160|  6.04M|}

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

_gpg_strsource:
   34|   130k|{
   35|   130k|  gpg_err_source_t source = gpg_err_source (err);
   36|   130k|  return dgettext (PACKAGE, msgstr + msgidx[msgidxof (source)]);
   37|   130k|}

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

_gpgrt_access:
  492|  1.02k|{
  493|  1.02k|  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|  1.02k|  ec = access (fname, mode)? _gpg_err_code_from_syserror () : 0;
  ------------------
  |  Branch (518:8): [True: 5, False: 1.01k]
  ------------------
  519|  1.02k|#endif /* Unix */
  520|       |
  521|  1.02k|  return ec;
  522|  1.02k|}

gpg_strerror:
   30|   362k|{
   31|   362k|  return _gpg_strerror (err);
   32|   362k|}
gpg_strsource:
   42|   130k|{
   43|   130k|  return _gpg_strsource (err);
   44|   130k|}
gpg_err_code_from_errno:
   48|  8.43k|{
   49|  8.43k|  return _gpg_err_code_from_errno (err);
   50|  8.43k|}
gpg_err_code_to_errno:
   54|  64.4k|{
   55|  64.4k|  return _gpg_err_code_to_errno (code);
   56|  64.4k|}
gpg_err_code_from_syserror:
   60|  63.7k|{
   61|  63.7k|  return _gpg_err_code_from_syserror ();
   62|  63.7k|}
gpg_err_set_errno:
   66|  8.43k|{
   67|  8.43k|  _gpg_err_set_errno (err);
   68|  8.43k|}
gpg_err_init:
   73|      2|{
   74|      2|  return _gpg_err_init ();
   75|      2|}
gpgrt_get_syscall_clamp:
  115|      2|{
  116|      2|  _gpgrt_get_syscall_clamp (r_pre, r_post);
  117|      2|}
gpgrt_lock_lock:
  134|   139k|{
  135|   139k|  return _gpgrt_lock_lock (lockhd);
  136|   139k|}
gpgrt_lock_unlock:
  146|   139k|{
  147|   139k|  return _gpgrt_lock_unlock (lockhd);
  148|   139k|}
gpgrt_fopen:
  167|  5.72k|{
  168|  5.72k|  return _gpgrt_fopen (path, mode);
  169|  5.72k|}
gpgrt_fclose:
  249|  5.72k|{
  250|  5.72k|  return _gpgrt_fclose (stream);
  251|  5.72k|}
_gpgrt_get_std_stream:
  304|   112k|{
  305|   112k|  return _gpgrt__get_std_stream (fd);  /* (double dash in name) */
  306|   112k|}
gpgrt_ferror:
  352|  4.81k|{
  353|  4.81k|  return _gpgrt_ferror (stream);
  354|  4.81k|}
gpgrt_fflush:
  376|  2.37k|{
  377|  2.37k|  return _gpgrt_fflush (stream);
  378|  2.37k|}
gpgrt_fseeko:
  388|  1.72k|{
  389|  1.72k|  return _gpgrt_fseeko (stream, offset, whence);
  390|  1.72k|}
gpgrt_ftello:
  400|  9.63k|{
  401|  9.63k|  return _gpgrt_ftello (stream);
  402|  9.63k|}
gpgrt_fgetc:
  418|  28.9k|{
  419|  28.9k|  return _gpgrt_fgetc (stream);
  420|  28.9k|}
gpgrt_fputc:
  430|  1.16M|{
  431|  1.16M|  return _gpgrt_fputc (c, stream);
  432|  1.16M|}
gpgrt_write_sanitized:
  467|  58.6k|{
  468|  58.6k|  return _gpgrt_write_sanitized (stream, buffer, length, delimiters,
  469|  58.6k|                                 bytes_written);
  470|  58.6k|}
gpgrt_fread:
  484|  4.81k|{
  485|  4.81k|  return _gpgrt_fread (ptr, size, nitems, stream);
  486|  4.81k|}
gpgrt_fwrite:
  491|    986|{
  492|    986|  return _gpgrt_fwrite (ptr, size, nitems, stream);
  493|    986|}
gpgrt_fputs:
  504|  6.95k|{
  505|  6.95k|  return _gpgrt_fputs (s, stream);
  506|  6.95k|}
gpgrt_vfprintf:
  535|   185k|{
  536|   185k|  return _gpgrt_vfprintf (stream, NULL, NULL, format, ap);
  537|   185k|}
gpgrt_printf:
  549|  38.9k|{
  550|  38.9k|  va_list ap;
  551|  38.9k|  int rc;
  552|       |
  553|  38.9k|  va_start (ap, format);
  554|  38.9k|  rc = _gpgrt_vfprintf (es_stdout, NULL, NULL, format, ap);
  ------------------
  |  |  361|  38.9k|#define es_stdout _gpgrt__get_std_stream (1)
  ------------------
  555|  38.9k|  va_end (ap);
  556|       |
  557|  38.9k|  return rc;
  558|  38.9k|}
gpgrt_setbuf:
  640|  1.43k|{
  641|  1.43k|  _gpgrt_setvbuf (stream, buf, buf? _IOFBF : _IONBF, BUFSIZ);
  ------------------
  |  Branch (641:32): [True: 0, False: 1.43k]
  ------------------
  642|  1.43k|}
gpgrt_set_binary:
  646|  1.34k|{
  647|  1.34k|  _gpgrt_set_binary (stream);
  648|  1.34k|}
gpgrt_snprintf:
  746|   107k|{
  747|   107k|  int rc;
  748|   107k|  va_list arg_ptr;
  749|       |
  750|   107k|  va_start (arg_ptr, format);
  751|   107k|  rc = _gpgrt_estream_vsnprintf (buf, bufsize, format, arg_ptr);
  752|   107k|  va_end (arg_ptr);
  753|       |
  754|   107k|  return rc;
  755|   107k|}
gpgrt_access:
  852|  1.02k|{
  853|  1.02k|  return _gpgrt_access (fname, mode);
  854|  1.02k|}
gpgrt_inc_errorcount:
  905|  26.8k|{
  906|  26.8k|  _gpgrt_inc_errorcount ();
  907|  26.8k|}
gpgrt_log_set_sink:
  911|      1|{
  912|      1|  _gpgrt_log_set_sink (name, stream, fd);
  913|      1|}
gpgrt_log_get_stream:
  953|  26.7k|{
  954|  26.7k|  return _gpgrt_log_get_stream ();
  955|  26.7k|}
gpgrt_log_info:
  988|   340k|{
  989|   340k|  va_list arg_ptr;
  990|       |
  991|   340k|  va_start (arg_ptr, fmt);
  992|   340k|  _gpgrt_logv (GPGRT_LOGLVL_INFO, fmt, arg_ptr);
  993|   340k|  va_end (arg_ptr);
  994|   340k|}
gpgrt_log_error:
  998|   825k|{
  999|   825k|  va_list arg_ptr;
 1000|       |
 1001|   825k|  va_start (arg_ptr, fmt);
 1002|   825k|  _gpgrt_logv (GPGRT_LOGLVL_ERROR, fmt, arg_ptr);
 1003|   825k|  va_end (arg_ptr);
 1004|   825k|}
gpgrt_log_debug:
 1030|  5.47k|{
 1031|  5.47k|  va_list arg_ptr ;
 1032|       |
 1033|  5.47k|  va_start (arg_ptr, fmt);
 1034|  5.47k|  _gpgrt_logv (GPGRT_LOGLVL_DEBUG, fmt, arg_ptr);
 1035|  5.47k|  va_end (arg_ptr);
 1036|  5.47k|}
gpgrt_log_printf:
 1050|  31.0k|{
 1051|  31.0k|  va_list arg_ptr;
 1052|       |
 1053|  31.0k|  va_start (arg_ptr, fmt);
 1054|  31.0k|  _gpgrt_logv (fmt ? GPGRT_LOGLVL_CONT : GPGRT_LOGLVL_BEGIN, fmt, arg_ptr);
  ------------------
  |  Branch (1054:16): [True: 31.0k, False: 0]
  ------------------
 1055|  31.0k|  va_end (arg_ptr);
 1056|  31.0k|}
gpgrt_log_flush:
 1060|  4.28k|{
 1061|  4.28k|  _gpgrt_log_flush ();
 1062|  4.28k|}

