1. 31 7月, 2020 1 次提交
  2. 25 6月, 2020 2 次提交
  3. 19 6月, 2020 2 次提交
  4. 17 6月, 2020 1 次提交
    • S
      Add ACVP fips module tests · 4f2271d5
      Shane Lontis 提交于
      For FIPS validation purposes - Automated Cryptographic Validation Protocol (ACVP) tests need to be
      performed. (See https://github.com/usnistgov/ACVP). These tests are very similiar to the old CAVS tests.
      
      This PR uses a hardwired subset of these test vectors to perform similiar operations,
      to show the usage and prove that the API's are able to perform the required operations.
      It may also help with communication with the lab (i.e- The lab could add a test here to show
      a unworking use case - which we can then address).
      
      The EVP layer performs these tests instead of calling lower level API's
      as was done in the old FOM.
      Some of these tests require access to internals that are not normally allowed/required.
      
      The config option 'acvp_tests' (enabled by default) has been added so that this
      access may be removed.
      
      The mechanism has been implemented as additional OSSL_PARAM values that can be set and get.
      A callback mechanism did not seem to add any additional benefit.
      These params will not be added to the gettables lists.
      Reviewed-by: NMatt Caswell <matt@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/11572)
      4f2271d5
  5. 05 6月, 2020 1 次提交
  6. 26 5月, 2020 1 次提交
    • S
      Update core_names.h fields and document most fields. · b8086652
      Shane Lontis 提交于
      Renamed some values in core_names i.e Some DH specific names were changed to use DH instead of FFC.
      Added some strings values related to RSA keys.
      Moved set_params related docs out of EVP_PKEY_CTX_ctrl.pod into its own file.
      Updated Keyexchange and signature code and docs.
      Moved some common DSA/DH docs into a shared EVP_PKEY-FFC.pod.
      Moved Ed25519.pod into EVP_SIGNATURE-ED25519.pod and reworked it.
      
      Added some usage examples. As a result of the usage examples the following change was also made:
      ec allows OSSL_PKEY_PARAM_USE_COFACTOR_ECDH as a settable gen parameter.
      Reviewed-by: NRichard Levitte <levitte@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/11610)
      b8086652
  7. 07 5月, 2020 1 次提交
    • S
      Remove gen_get_params & gen_gettable_params from keygen operation · 5e77b79a
      Shane Lontis 提交于
      EVP_PKEY_CTX_gettable_params() was missing code for the keygen operation.
      After adding it it was noticed that it is probably not required for this type, so instead
      the gen_get_params and gen_gettable_params have been remnoved from the provider interface.
      gen_get_params was only implemented for ec to get the curve name. This seems redundant
      since normally you would set parameters into the keygen_init() and then generate a key.
      Normally you would expect to extract data from the key - not the object that we just set up
      to do the keygen.
      
      Added a simple settable and gettable test into a test that does keygen.
      Reviewed-by: NRichard Levitte <levitte@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/11683)
      5e77b79a
  8. 23 4月, 2020 1 次提交
  9. 15 4月, 2020 2 次提交
  10. 08 4月, 2020 1 次提交
  11. 01 4月, 2020 1 次提交
    • S
      Add EVP_PKEY_gettable_params support for accessing EVP_PKEY key data fields · 96ebe52e
      Shane Lontis 提交于
      Currently only RSA, EC and ECX are supported (DH and DSA need to be added to the keygen
      PR's seperately because the fields supported have changed significantly).
      
      The API's require the keys to be provider based.
      
      Made the keymanagement export and get_params functions share the same code by supplying
      support functions that work for both a OSSL_PARAM_BLD as well as a OSSL_PARAM[].
      This approach means that complex code is not required to build an
      empty OSSL_PARAM[] with the correct sized fields before then doing a second
      pass to populate the array.
      
      The RSA factor arrays have been changed to use unique key names to simplify the interface
      needed by the user.
      Reviewed-by: NRichard Levitte <levitte@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/11365)
      96ebe52e
  12. 28 3月, 2020 2 次提交
  13. 27 3月, 2020 1 次提交
  14. 26 3月, 2020 2 次提交
    • R
      EVP: Implement support for key downgrading in backends · 0abae163
      Richard Levitte 提交于
      Downgrading EVP_PKEYs from containing provider side internal keys to
      containing legacy keys demands support in the EVP_PKEY_ASN1_METHOD.
      
      This became a bit elaborate because the code would be almost exactly
      the same as the import functions int EVP_KEYMGMT.  Therefore, we end
      up moving most of the code to common backend support files that can be
      used both by legacy backend code and by our providers.
      Reviewed-by: NMatt Caswell <matt@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/11375)
      0abae163
    • R
      EVP: Clarify the states of an EVP_PKEY · adc9f731
      Richard Levitte 提交于
      EVP_PKEY is rather complex, even before provider side keys entered the
      stage.
      You could have untyped / unassigned keys (pk->type == EVP_PKEY_NONE),
      keys that had been assigned a type but no data (pk->pkey.ptr == NULL),
      and fully assigned keys (pk->type != EVP_PKEY_NONE && pk->pkey.ptr != NULL).
      
      For provider side keys, the corresponding states weren't well defined,
      and the code didn't quite account for all the possibilities.
      
      We also guard most of the legacy fields in EVP_PKEY with FIPS_MODE, so
      they don't exist at all in the FIPS module.
      
      Most of all, code needs to adapt to the case where an EVP_PKEY's
      |keymgmt| is non-NULL, but its |keydata| is NULL.
      Reviewed-by: NMatt Caswell <matt@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/11375)
      adc9f731
  15. 15 3月, 2020 1 次提交
  16. 12 3月, 2020 2 次提交
  17. 04 3月, 2020 1 次提交
    • S
      Add Serializers for EC · f552d900
      Shane Lontis 提交于
      Provide EC serializers for text, pem and der.
      
      EC parameters use ANS1 'CHOICE' - which means they are more embedded than other parameters used by
      other KEY types (which normally have a SEQUENCE at the top level).
      For this reason the ANS1_STRING type that was being passed around has been changed to a void so that the
      code can still be shared with EC.
      
      The EC serializer only supports named curves currently.
      
      NOTE the serializer code assumes PKCS8 format - if the older encode methods are needed they will need to be
      added in another PR. (Probably when deserialization is considered).
      
      EVP_PKEY_key_fromdata_init was changed from using a keypair selection to all bits of a key. A side effect of this was
      that the very restrictive checks in the ecx code needed to be relaxed as it was assuming all selection flags were non
      optional. As this is not the case for any other key the code has been modified.
      
      Fixed a bug in legacy_ctrl_str_to_params() - "ecdh_cofactor_mode" was being incorrectly converted to the wrong keyname.
      Reviewed-by: NRichard Levitte <levitte@openssl.org>
      (Merged from https://github.com/openssl/openssl/pull/11107)
      f552d900
  18. 02 3月, 2020 1 次提交
  19. 19 2月, 2020 2 次提交
    • N
      [PROV][KEYMGMT][EC] Import/export of priv_key as padded const time BN · a377871d
      Nicola Tuveri 提交于
      For EC keys it is particularly important to avoid leaking the bit length
      of the secret scalar.
      
      Key import/export should never leak the bit length of the secret
      scalar in the key.
      
      For this reason, on export we use padded BIGNUMs with fixed length,
      using the new `ossl_param_bld_push_BN_pad()`.
      
      When importing we also should make sure that, even if short lived,
      the newly created BIGNUM is marked with the BN_FLG_CONSTTIME flag as
      soon as possible, so that any processing of this BIGNUM might opt for
      constant time implementations in the backend.
      
      Setting the BN_FLG_CONSTTIME flag alone is never enough, we also have
      to preallocate the BIGNUM internal buffer to a fixed size big enough
      that operations performed during the processing never trigger a
      realloc which would leak the size of the scalar through memory
      accesses.
      
      Fixed length
      ------------
      
      The order of the large prime subgroup of the curve is our choice for
      a fixed public size, as that is generally the upper bound for
      generating a private key in EC cryptosystems and should fit all valid
      secret scalars.
      
      For padding on export we just use the bit length of the order
      converted to bytes (rounding up).
      
      For preallocating the BIGNUM storage we look at the number of "words"
      required for the internal representation of the order, and we
      preallocate 2 extra "words" in case any of the subsequent processing
      might temporarily overflow the order length.
      
      Future work
      -----------
      
      To ensure the flag and fixed size preallocation persists upon
      `EC_KEY_set_private_key()`, we need to further harden
      `EC_KEY_set_private_key()` and `BN_copy()`.
      This is done in separate commits.
      Reviewed-by: NMatt Caswell <matt@openssl.org>
      Reviewed-by: NRichard Levitte <levitte@openssl.org>
      Reviewed-by: NShane Lontis <shane.lontis@oracle.com>
      (Merged from https://github.com/openssl/openssl/pull/10631)
      a377871d
    • N