mod_exp_sw.c 821 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2014 Freescale Semiconductor, Inc.
  4. * Author: Ruchika Gupta <ruchika.gupta@freescale.com>
  5. */
  6. #include <config.h>
  7. #include <common.h>
  8. #include <dm.h>
  9. #include <log.h>
  10. #include <u-boot/rsa-mod-exp.h>
  11. static int mod_exp_sw(struct udevice *dev, const uint8_t *sig, uint32_t sig_len,
  12. struct key_prop *prop, uint8_t *out)
  13. {
  14. int ret = 0;
  15. ret = rsa_mod_exp_sw(sig, sig_len, prop, out);
  16. if (ret) {
  17. debug("%s: RSA failed to verify: %d\n", __func__, ret);
  18. return ret;
  19. }
  20. return 0;
  21. }
  22. static const struct mod_exp_ops mod_exp_ops_sw = {
  23. .mod_exp = mod_exp_sw,
  24. };
  25. U_BOOT_DRIVER(mod_exp_sw) = {
  26. .name = "mod_exp_sw",
  27. .id = UCLASS_MOD_EXP,
  28. .ops = &mod_exp_ops_sw,
  29. .flags = DM_FLAG_PRE_RELOC,
  30. };
  31. U_BOOT_DRVINFO(mod_exp_sw) = {
  32. .name = "mod_exp_sw",
  33. };