Sha256: fa0160c718572b4d947efb199e18d6e1fa001974ade2eebeb90ffca2746a66ea

Contents?: true

Size: 796 Bytes

Versions: 22

Compression:

Stored size: 796 Bytes

Contents

/*
 * 'OpenSSL for Ruby' team members
 * Copyright (C) 2003
 * All rights reserved.
 */
/*
 * This program is licensed under the same licence as Ruby.
 * (See the file 'LICENCE'.)
 */
#include "ossl.h"

BIO *
ossl_obj2bio(volatile VALUE *pobj)
{
    VALUE obj = *pobj;
    BIO *bio;

    if (RB_TYPE_P(obj, T_FILE))
	obj = rb_funcallv(obj, rb_intern("read"), 0, NULL);
    StringValue(obj);
    bio = BIO_new_mem_buf(RSTRING_PTR(obj), RSTRING_LENINT(obj));
    if (!bio)
	ossl_raise(eOSSLError, "BIO_new_mem_buf");
    *pobj = obj;
    return bio;
}

VALUE
ossl_membio2str(BIO *bio)
{
    VALUE ret;
    int state;
    BUF_MEM *buf;

    BIO_get_mem_ptr(bio, &buf);
    ret = ossl_str_new(buf->data, buf->length, &state);
    BIO_free(bio);
    if (state)
	rb_jump_tag(state);

    return ret;
}

Version data entries

22 entries across 22 versions & 3 rubygems

Version Path
openssl-3.0.3 ext/openssl/ossl_bio.c
openssl-3.1.1 ext/openssl/ossl_bio.c
openssl-3.2.1 ext/openssl/ossl_bio.c
openssl-3.2.0 ext/openssl/ossl_bio.c
zig_example-0.3.2 ext/openssl/ossl_bio.c
zig_example-0.3.1 ext/openssl/ossl_bio.c
openssl-3.1.0 ext/openssl/ossl_bio.c
openssl-3.0.2 ext/openssl/ossl_bio.c
openssl-2.2.3 ext/openssl/ossl_bio.c
openssl-custom-2.2.2 ext/openssl/ossl_bio.c
openssl-3.0.1 ext/openssl/ossl_bio.c
openssl-2.2.2 ext/openssl/ossl_bio.c
openssl-2.1.4 ext/openssl/ossl_bio.c
openssl-3.0.0 ext/openssl/ossl_bio.c
openssl-2.2.1 ext/openssl/ossl_bio.c
openssl-2.1.3 ext/openssl/ossl_bio.c
openssl-2.2.0 ext/openssl/ossl_bio.c
openssl-2.1.2 ext/openssl/ossl_bio.c
openssl-2.1.1 ext/openssl/ossl_bio.c
openssl-2.1.0 ext/openssl/ossl_bio.c