code: func (csp *CSP) KeyDeriv(k bccsp.Key, opts bccsp.KeyDerivOpts) (dk bccsp.Key, err error) {
  	// Validate arguments
  	if k == nil {
  		return nil, errors.New("Invalid Key. It must not be nil.")
  	}
  	if opts == nil {
  		return nil, errors.New("Invalid opts. It must not be nil.")
  	}
  
  	keyDeriver, found := csp.KeyDerivers[reflect.TypeOf(k)]
  	if !found {
  		return nil, errors.Errorf("Unsupported 'Key' provided [%v]", k)
  	}
  
  	k, err = keyDeriver.KeyDeriv(k, opts)
  	if err != nil {
  		return nil, errors.Wrapf(err, "Failed deriving key with opts [%v]", opts)
  	}
  
  	// If the key is not Ephemeral, store it.
  	if !opts.Ephemeral() {
  		// Store the key
  		err = csp.ks.StoreKey(k)
  		if err != nil {
  			return nil, errors.Wrapf(err, "Failed storing key [%s]", opts.Algorithm())
  		}
  	}
  
  	return k, nil
  }
docs: // KeyDeriv derives a key from k using opts.
  // The opts argument should be appropriate for the primitive used.