'Set the serial number of a revoked Revoked structure
:param hex_str: The new serial number.
:type hex_str: :py:data:`str`
:return: None'

def set_serial(self, hex_str):

    bignum_serial = _ffi.gc(_lib.BN_new(), _lib.BN_free)
    bignum_ptr = _ffi.new('BIGNUM**')
    bignum_ptr[0] = bignum_serial
    bn_result = _lib.BN_hex2bn(bignum_ptr, hex_str)
    if (not bn_result):
        raise ValueError('bad    hex    string')
    asn1_serial = _ffi.gc(_lib.BN_to_ASN1_INTEGER(bignum_serial, _ffi.NULL), _lib.ASN1_INTEGER_free)
    _lib.X509_REVOKED_set_serialNumber(self._revoked, asn1_serial)
