2018-03-12 19:24


  • c
  • cgo

I am creating a project which uses cryptography that I coded in C due to existing libraries and speed. When attempting to interface with Cgo, I am having some trouble with typedefs I created in C. One example is below:

typedef unsigned char ec_scalar[32];

I am able to successfully create ec_point variables, and use functions that take in ec_point*. However, whenever I attempt to use functions that are passed with a normal ec_point, I get the error:

cannot use pk2 (type C.ec_scalar) as type *C.uchar in argument to _Cfunc_secret_to_public

I can't seem to find a way where I can easily convert this too. I also don't want to have to refactor my code to take in ec_point*, as ec_point is already a pointer (since it is an array of 32 char)

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享