Advertisement
Guest User

mpi_add

a guest
Feb 14th, 2021
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <stdio.h>
  2. #include "mbedtls/bignum.h"
  3. #include "mbedtls/config.h"
  4.  
  5. int main(int argc,char* argv[]) {
  6. int ret=1;
  7. mbedtls_mpi x, a, b;
  8.  
  9. mbedtls_mpi_init(&x);
  10. mbedtls_mpi_init(&a);
  11. mbedtls_mpi_init(&b);
  12.  
  13. // is this how to initialize two numbers to add?
  14. a.n=1;
  15. b.n=2;
  16.  
  17.  
  18. MBEDTLS_MPI_CHK(mbedtls_mpi_add_int(&x,&a,&b));
  19.  
  20. printf("Add is: %d\n", x.n);
  21.  
  22. cleanup:
  23. mbedtls_mpi_free( &x ); mbedtls_mpi_free( &a ); mbedtls_mpi_free( &b );
  24.  
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement