I'm trying to use the BN\_\* functions in OpenSSL. Specifically, I have the following code:

```
#import <openssl/bn.h>
BIGNUM * num = BN_new();
BN_set_word(num, 42);
char * buffer = malloc((BN_num_bytes(num)+1) * sizeof(char));
buffer[BN_num_bytes(num)] = '\0';
int len = BN_bn2bin(num, buffer);
printf("42 in binary is %s\n", buffer);

```

However, when I do this, I don't get a string of ones and zeros. Instead it prints `"42 in binary is *"`. As far as I can tell, and from the *very* limited number of examples available on the web that I've compared this to, I've implemented this correctly.

Any ideas why it isn't working?