<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    On 10.06.2016 21:17, Donald Stufft wrote:<br>
    <blockquote
      cite="mid:B50734BC-E2DC-4F7C-B607-A7D624A3C0C9@stufft.io"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <br class="">
      <div>
        <blockquote type="cite" class="">
          <div class="">On Jun 10, 2016, at 3:05 PM, David Mertz <<a
              moz-do-not-send="true" href="mailto:mertz@gnosis.cx"
              class=""><a class="moz-txt-link-abbreviated" href="mailto:mertz@gnosis.cx">mertz@gnosis.cx</a></a>> wrote:</div>
          <br class="Apple-interchange-newline">
          <div class=""><span style="font-family: Helvetica; font-size:
              12px; font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; orphans:
              auto; text-align: start; text-indent: 0px; text-transform:
              none; white-space: normal; widows: auto; word-spacing:
              0px; -webkit-text-stroke-width: 0px; float: none; display:
              inline !important;" class="">OK.  My understanding is that
              Guido ruled out introducing an os.getrandom() API in
              3.5.2.  But would you be happy if that interface is added
              to 3.6? </span>
            <div style="font-family: Helvetica; font-size: 12px;
              font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; orphans:
              auto; text-align: start; text-indent: 0px; text-transform:
              none; white-space: normal; widows: auto; word-spacing:
              0px; -webkit-text-stroke-width: 0px;" class=""><br
                class="">
            </div>
            <div style="font-family: Helvetica; font-size: 12px;
              font-style: normal; font-variant-caps: normal;
              font-weight: normal; letter-spacing: normal; orphans:
              auto; text-align: start; text-indent: 0px; text-transform:
              none; white-space: normal; widows: auto; word-spacing:
              0px; -webkit-text-stroke-width: 0px;" class="">It feels to
              me like the correct spelling in 3.6 should probably be
              secrets.getrandom() or something related to that.</div>
          </div>
        </blockquote>
      </div>
      <br class="">
    </blockquote>
    <br>
    I am not a security expert but your reply makes it clear to me. So,
    for me this makes:<br>
    <br>
    os -> os-dependent and because of this varies from os to os (also
    quality-wise)<br>
    random -> pseudo-random, but it works for most non-critical
    use-cases<br>
    secret -> that's for crypto<br>
    <br>
    <br>
    If don't need crypto, secret would be a waste of resources, but if
    you need crypto, then os and random are unsafe. I think that's
    simple enough. At least, I would understand it.<br>
    <br>
    <br>
    Just my 2 cents: if I need crypto, I would pay the price of blocking
    rather then to get an exception (what are my alternatives? I need
    those bits! ) or get unsecure bits.<br>
    <br>
    <br>
    Sven<br>
    <br>
    <br>
    <blockquote
      cite="mid:B50734BC-E2DC-4F7C-B607-A7D624A3C0C9@stufft.io"
      type="cite">
      <div class="">Well we have <a moz-do-not-send="true"
href="https://docs.python.org/dev/library/secrets.html#secrets.token_bytes"
          class="">https://docs.python.org/dev/library/secrets.html#secrets.token_bytes</a> so
        adding a getrandom() function to secrets would largely be the
        same as that function.</div>
      <div class=""><br class="">
      </div>
      <div class="">The problem of course is that the secrets library in
        3.6 uses os.urandom under the covers, so it’s security rests on
        the security of os.urandom. To ensure that the secrets library
        is actually safe even in early boot it’ll need to stop using
        os.urandom on Linux and use the getrandom() function.</div>
      <div class=""><br class="">
      </div>
      <div class="">That same library exposes random.SystemRandom as
        secrets.SystemRandom [1], and of course SystemRandom uses
        os.urandom too. So if we want people to treat
        secrets.SystemRandom as “always secure” then it would need to
        stop using os.urandom and start using the get random() function
        on Linux as well.</div>
      <div class=""><br class="">
      </div>
      <div class=""><br class="">
      </div>
      <div class="">[1] This is actually documented as "using the
        highest-quality sources provided by the operating system” in the
        secrets documentation, and I’d argue that it is not using the
        highest-quality source if it’s reading from /dev/urandom or
        getrandom(GRD_NONBLOCK) on Linux systems where getrandom() is
        available. Of course, it’s just an alias for
        random.SystemRandom, and that is documented as using os.urandom.</div>
      <div class="">
        <div style="color: rgb(0, 0, 0); font-family: Helvetica;
          font-style: normal; font-variant-ligatures: normal;
          font-variant-position: normal; font-variant-caps: normal;
          font-variant-numeric: normal; font-variant-alternates: normal;
          font-variant-east-asian: normal; font-weight: normal;
          letter-spacing: normal; line-height: normal; orphans: 2;
          text-align: -webkit-auto; text-indent: 0px; text-transform:
          none; white-space: normal; widows: 2; word-spacing: 0px;
          -webkit-text-stroke-width: 0px; word-wrap: break-word;
          -webkit-nbsp-mode: space; -webkit-line-break:
          after-white-space;" class=""><br class="">
          —<br class="">
          Donald Stufft<br class="">
        </div>
        <div style="color: rgb(0, 0, 0); font-family: Helvetica;
          font-style: normal; font-variant-ligatures: normal;
          font-variant-position: normal; font-variant-caps: normal;
          font-variant-numeric: normal; font-variant-alternates: normal;
          font-variant-east-asian: normal; font-weight: normal;
          letter-spacing: normal; line-height: normal; orphans: 2;
          text-align: -webkit-auto; text-indent: 0px; text-transform:
          none; white-space: normal; widows: 2; word-spacing: 0px;
          -webkit-text-stroke-width: 0px; word-wrap: break-word;
          -webkit-nbsp-mode: space; -webkit-line-break:
          after-white-space;" class=""><br class="">
        </div>
        <br class="Apple-interchange-newline">
      </div>
      <br class="">
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Python-Dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Python-Dev@python.org">Python-Dev@python.org</a>
<a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/listinfo/python-dev">https://mail.python.org/mailman/listinfo/python-dev</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/options/python-dev/srkunze%40mail.de">https://mail.python.org/mailman/options/python-dev/srkunze%40mail.de</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>