1
/* Copyright (c) 1999-2002 Ng Pheng Siong. All rights reserved. */
2
/* $Id: _util.i 522 2007-05-08 22:21:51Z heikki $ */
5
#include <openssl/x509v3.h>
9
static PyObject *_util_err;
11
void util_init(PyObject *util_err) {
16
PyObject *util_hex_to_string(PyObject *blob) {
22
if (PyObject_AsReadBuffer(blob, &buf, &len) == -1)
25
ret = hex_to_string((unsigned char *)buf, len);
27
PyErr_SetString(_util_err, ERR_reason_error_string(ERR_get_error()));
30
obj = PyString_FromString(ret);
35
PyObject *util_string_to_hex(PyObject *blob) {
42
if (PyObject_AsReadBuffer(blob, &buf, &len0) == -1)
46
ret = string_to_hex((char *)buf, &len);
48
PyErr_SetString(_util_err, ERR_reason_error_string(ERR_get_error()));
51
obj = PyString_FromStringAndSize(ret, len);