Opened 7 months ago

Closed 6 months ago

#29594 closed defect (implemented)

Remove OpenSSL.rand.bytes from code

Reported by: dgoulet Owned by: dgoulet
Priority: Medium Milestone:
Component: Circumvention/BridgeDB Version:
Severity: Normal Keywords: bridgedb
Cc: cohosh, catalyst Actual Points:
Parent ID: #29276 Points:
Reviewer: sysrqb Sponsor:

Description

It is now deprecated in favor of os.urandom():

OpenSSL.rand is deprecated - you should use os.urandom instead

This is needed if we want to upgrade the requirements.txt.

Child Tickets

Change History (5)

comment:1 Changed 7 months ago by dgoulet

Status: assignedneeds_review

Branch: ticket29594_01

comment:2 Changed 7 months ago by catalyst

Cc: catalyst added

comment:3 Changed 7 months ago by catalyst

Parent ID: #29276

comment:4 Changed 7 months ago by sysrqb

Status: needs_reviewmerge_ready

lgtm - but I didn't test it, but it should be a safe substitution:

    
    urandom(...)
        urandom(n) -> str
        
        Return n random bytes suitable for cryptographic use.

https://github.com/pyca/pyopenssl/blob/16.2.0/src/OpenSSL/rand.py#L41

def bytes(num_bytes):
    """
    Get some random bytes from the PRNG as a string.
    This is a wrapper for the C function ``RAND_bytes``.
    :param num_bytes: The number of bytes to fetch.
    :return: A string of random bytes.
    """

comment:5 Changed 6 months ago by sysrqb

Resolution: implemented
Status: merge_readyclosed

Merged.

Note: See TracTickets for help on using tickets.