public void setup(Map attributes) {
      // do we have a SecureRandom, or should we use our own?
      rnd = (SecureRandom) attributes.get(SOURCE_OF_RANDOMNESS);

      // are we given a set of Diffie-Hellman generation parameters or we shall
      // use our own?
      DHGenParameterSpec params =
            (DHGenParameterSpec) attributes.get(DH_PARAMETERS);

      // find out the desired sizes
      if (params != null) {
         l = params.getPrimeSize();
         m = params.getExponentSize();
      } else {
         Integer bi = (Integer) attributes.get(PRIME_SIZE);
         l = (bi == null ? DEFAULT_PRIME_SIZE : bi.intValue());
         bi = (Integer) attributes.get(EXPONENT_SIZE);
         m = (bi == null ? DEFAULT_EXPONENT_SIZE : bi.intValue());
      }

//      if ((L % 256) != 0 || L < 1024) {
      if ((l % 256) != 0 || l < DEFAULT_PRIME_SIZE) {
         throw new IllegalArgumentException("invalid modulus size");
      }
      if ((m % 8) != 0 || m < DEFAULT_EXPONENT_SIZE) {
         throw new IllegalArgumentException("invalid exponent size");
      }
      if (m > l) {
         throw new IllegalArgumentException("exponent size > modulus size");
      }
   }