Uploaded image for project: 'Erlang/OTP'
  1. Erlang/OTP
  2. ERL-974

Wrong spec in one of the two crypto_one_time/[4,5] functions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 22.0
    • Fix Version/s: 22.1
    • Component/s: crypto
    • Labels:
      None

      Description

      The specs and code of the two crypto_one_time functions in the crypto module look as follows:

      -spec crypto_one_time(Cipher, Key, Data, EncryptFlag) ->
                                   Result | descriptive_error()
                                       when Cipher :: cipher_no_iv(),
                                            ....
      
      crypto_one_time(Cipher, Key, Data, EncryptFlag) ->
          crypto_one_time(Cipher, Key, <<>>, Data, EncryptFlag).
      
      -spec crypto_one_time(Cipher, Key, IV, Data, EncryptFlag) ->
                                   Result | descriptive_error()
                                       when Cipher :: cipher_iv(),
                                            ...
      crypto_one_time(Cipher, Key, IV, Data0, EncryptFlag) ->
          ....
      

      One of the two specs (or the code) cannot be right.

      It cannot possibly be that the 4-arity function calls the 5-arity one with first argument that is cipher_no_iv() which is passed to a cipher_iv().

        Attachments

          Activity

            People

            Assignee:
            hans Hans Nilsson
            Reporter:
            kostis kostis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: