Hello, I'm trying to integrgate BIO_s_mem with BIO_base64. If I do a BIO_push(), then write to the returned value, the data is base64 encoded ok and I can retreive it using the ctrl supplied pointer. However, when I try the reverse, (read, thereby invoking a decode) I get no output. Specifically, I create a new BIO_s_mem. Write to it with either BIO_puts or BIO_write. Then do a BIO_push(b64bio, mbio). Then BIO_read(b64bio, mybuf, len). It returns -1. When I ask if I should retry it says yes, but there is no output on the second call either. After I set debugging on, I noticed it was doing two internal reads, the first one returned the correct number of bytes from the memory buffer, then it did another one. This second read returned -1. This doesn't seem to happen on write(encode). Here is the debug output: puts BIO[08049CC8]:puts() - memory buffer BIO[08049CC8]:puts return 12 push BIO[08049D20]:ctrl(6) - base64 encoding BIO[08049CC8]:ctrl(6) - memory buffer BIO[08049CC8]:ctrl return 0 BIO[08049D20]:ctrl return 0 read BIO[08049D20]:read(0,12) - base64 encoding BIO[08049CC8]:read(-1,1024) - memory buffer BIO[08049CC8]:read return 12 BIO[08049CC8]:read(-1,1024) - memory buffer // Notice this second read (still in the mem BIO.) BIO[08049CC8]:read return -1 BIO[08049D20]:read return -1 retry BIO[08049D20]:read(0,12) - base64 encoding BIO[08049CC8]:read(-1,1024) - memory buffer BIO[08049CC8]:read return -1 BIO[08049D20]:read return -1 prints ilen -1 Here is the relevant code. mbuf = (unsigned char*)malloc(len); mbio = BIO_new(BIO_s_mem()); b64bio = BIO_new(BIO_f_base64()); BIO_set_callback(mbio, BIO_debug_callback); BIO_set_callback(b64bio, BIO_debug_callback); fprintf(stderr, "puts\n"); BIO_puts(mbio, buf); fprintf(stderr, "push\n"); bio = BIO_push(b64bio, mbio); fprintf(stderr, "read\n"); ilen = BIO_read(bio, mbuf, len); if (ilen == -1) { if (BIO_should_retry(bio)) { fprintf(stderr, "retry\n"); ilen = BIO_read(bio, mbuf, len); } else fprintf(stderr,"should not retry\n"); } fprintf(stderr, "prints ilen %d\n", ilen); I'm running Mandrake 7.1 with gcc 2.95/ Does anybody know why this is happening? Thanks Ed. P.s. here is th debug from the write operation. BIO[08049D58]:ctrl(6) - base64 encoding BIO[08049D00]:ctrl(6) - memory buffer BIO[08049D00]:ctrl return 0 BIO[08049D58]:ctrl return 0 BIO[08049D58]:write(0,8) - base64 encoding BIO[08049D58]:write return 8 BIO[08049D58]:ctrl(11) - base64 encoding BIO[08049D00]:write(-1,13) - memory buffer BIO[08049D00]:write return 13 BIO[08049D00]:ctrl(11) - memory buffer BIO[08049D00]:ctrl return 1 BIO[08049D58]:ctrl return 1 BIO[08049D00]:ctrl(3) - memory buffer BIO[08049D00]:ctrl return 13 Ed Howland Director, Unix Development StreamSearch.com (314) 746-1827 (314) 406-6836 (mobile) ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]