import std.stdio;
import deimos.openssl.bn;
import deimos.openssl.rsa;
const KEY_SIZE = 1024;
void main(string[] args) {
if (args.length < 1) {
writeln("too few arguments");
}
RSA* rsa = RSA_new();
rsa = RSA_generate_key(KEY_SIZE, RSA_F4, null, null);
if(rsa==null) {
writeln("failure");
}
else {
writeln("success");
// error generated by the line below
if(!BN_generate_prime(rsa.p, (KEY_SIZE/2), 1, null, null, null, null)) {
writeln("prime_failure");
}
else {
writeln("prime success");
}
RSA_free(rsa);
}
}
This leads to the following error:
rsa.d(21): Error: struct rsa_st is forward referenced
The error occurs anytime I try to access an element in the rsa struct. Any ideas?
I was able to get in contact with one of the people who frequently updates the OpenSSL Deimos on github and was able to get a response from him.
Basically the OpenSSL C API forward-declares structs in some places where the exact definitions are not required and these have stuck around in some of the D modules.
He requested a pull to the repository and the changes he made will fix your current problem. Here is the link: