Made changes in the malloc function in openssl, removed unrequired loggers and prints

This commit is contained in:
jai.s 2020-09-19 19:07:52 +05:30
parent fbc33b1df6
commit e4ba5a8926
No known key found for this signature in database
GPG Key ID: 360CFA25EFC67D12
6 changed files with 15 additions and 173 deletions

View File

@ -1058,7 +1058,6 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
"""Handle a request to send a broadcast message""" """Handle a request to send a broadcast message"""
if not params: if not params:
raise APIError(0, 'I need parameters!') raise APIError(0, 'I need parameters!')
logger.error('HandleSendBroadcast 1085')
if len(params) == 3: if len(params) == 3:
fromAddress, subject, message = params fromAddress, subject, message = params
encodingType = 2 encodingType = 2
@ -1074,9 +1073,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
raise APIError(6, 'The encoding type must be 2 or 3.') raise APIError(6, 'The encoding type must be 2 or 3.')
subject = self._decode(subject.data, "base64").decode() subject = self._decode(subject.data, "base64").decode()
message = self._decode(message.data, "base64").decode() message = self._decode(message.data, "base64").decode()
logger.error('HandleSendBroadcast 1106')
if len(subject + message) > (2 ** 18 - 500): if len(subject + message) > (2 ** 18 - 500):
logger.error('HandleSendBroadcast 1108')
raise APIError(27, 'Message is too long.') raise APIError(27, 'Message is too long.')
if TTL < 60 * 60: if TTL < 60 * 60:
TTL = 60 * 60 TTL = 60 * 60

View File

@ -54,43 +54,18 @@ class addressGenerator(StoppableThread):
Process the requests for addresses generation Process the requests for addresses generation
from `.queues.addressGeneratorQueue` from `.queues.addressGeneratorQueue`
""" """
logger.error('addressGenerator addressGenerator')
logger.error('state.shutdown-{}'.format(state.shutdown))
logger.error('--------self----{}'.format(self))
while state.shutdown == 0: while state.shutdown == 0:
logger.error( queueValue = queues.addressGeneratorQueue.get()
'qqqqqqqqq1111111111111111111111111111111')
try:
queueValue = queues.addressGeneratorQueue.get()
logger.error('SuccessFully Loaded')
except Exception as e:
import traceback
logger.error('Traceback-{} \n'.format(
str(traceback.format_stack())))
logger.error('Address Genertor excepation 7777')
logger.error(e)
nonceTrialsPerByte = 0 nonceTrialsPerByte = 0
# logger.error('$$$$$$$$$$$$ queueValue @@@@@@@@@@@-{}'.format(queueValue))
payloadLengthExtraBytes = 0 payloadLengthExtraBytes = 0
live = True live = True
logger.error(
'qqqqqqqqq3333333333333333333333333333333')
logger.error(
'qqqqqqqqq33333333333333-{}'.format(queueValue[0] ))
if queueValue[0] == 'createChan': if queueValue[0] == 'createChan':
logger.error(
'OOOOOOOOOOOOOOOOOOOOOOOOOOOOO')
command, addressVersionNumber, streamNumber, label, \ command, addressVersionNumber, streamNumber, label, \
deterministicPassphrase, live = queueValue deterministicPassphrase, live = queueValue
logger.error('++++++++++++100++++++++++++')
eighteenByteRipe = False eighteenByteRipe = False
logger.error('++++++++++++102++++++++++++')
numberOfAddressesToMake = 1 numberOfAddressesToMake = 1
logger.error('++++++++++++104++++++++++++')
numberOfNullBytesDemandedOnFrontOfRipeHash = 1 numberOfNullBytesDemandedOnFrontOfRipeHash = 1
elif queueValue[0] == 'joinChan': elif queueValue[0] == 'joinChan':
logger.info(
'111111111111111111111111111111111111111')
command, chanAddress, label, deterministicPassphrase, \ command, chanAddress, label, deterministicPassphrase, \
live = queueValue live = queueValue
eighteenByteRipe = False eighteenByteRipe = False
@ -99,8 +74,6 @@ class addressGenerator(StoppableThread):
numberOfAddressesToMake = 1 numberOfAddressesToMake = 1
numberOfNullBytesDemandedOnFrontOfRipeHash = 1 numberOfNullBytesDemandedOnFrontOfRipeHash = 1
elif len(queueValue) == 7: elif len(queueValue) == 7:
logger.info(
'22222222222222222222222222222222222222')
command, addressVersionNumber, streamNumber, label, \ command, addressVersionNumber, streamNumber, label, \
numberOfAddressesToMake, deterministicPassphrase, \ numberOfAddressesToMake, deterministicPassphrase, \
eighteenByteRipe = queueValue eighteenByteRipe = queueValue
@ -117,101 +90,65 @@ class addressGenerator(StoppableThread):
# the default # the default
numberOfNullBytesDemandedOnFrontOfRipeHash = 1 numberOfNullBytesDemandedOnFrontOfRipeHash = 1
elif len(queueValue) == 9: elif len(queueValue) == 9:
logger.error('createRandomAddress 122')
command, addressVersionNumber, streamNumber, label, \ command, addressVersionNumber, streamNumber, label, \
numberOfAddressesToMake, deterministicPassphrase, \ numberOfAddressesToMake, deterministicPassphrase, \
eighteenByteRipe, nonceTrialsPerByte, \ eighteenByteRipe, nonceTrialsPerByte, \
payloadLengthExtraBytes = queueValue payloadLengthExtraBytes = queueValue
logger.error('createRandomAddress 126')
try: try:
logger.error('createRandomAddress 128')
numberOfNullBytesDemandedOnFrontOfRipeHash = \ numberOfNullBytesDemandedOnFrontOfRipeHash = \
BMConfigParser().getint( BMConfigParser().getint(
'bitmessagesettings', 'bitmessagesettings',
'numberofnullbytesonaddress' 'numberofnullbytesonaddress'
) )
logger.error('createRandomAddress 134')
except: except:
logger.error('createRandomAddress 136')
if eighteenByteRipe: if eighteenByteRipe:
logger.error('createRandomAddress 138')
numberOfNullBytesDemandedOnFrontOfRipeHash = 2 numberOfNullBytesDemandedOnFrontOfRipeHash = 2
else: else:
logger.error('createRandomAddress 141')
# the default # the default
numberOfNullBytesDemandedOnFrontOfRipeHash = 1 numberOfNullBytesDemandedOnFrontOfRipeHash = 1
elif queueValue[0] == 'stopThread': elif queueValue[0] == 'stopThread':
logger.info(
'444444444444444444444444444444444444444444')
break break
else: else:
logger.info( logger.info(
'Programming error: A structure with the wrong number' 'Programming error: A structure with the wrong number'
' of values was passed into the addressGeneratorQueue.' ' of values was passed into the addressGeneratorQueue.'
' Here is the queueValue: %r\n', queueValue) ' Here is the queueValue: %r\n', queueValue)
logger.error('createRandomAddress 153')
if addressVersionNumber < 3 or addressVersionNumber > 4: if addressVersionNumber < 3 or addressVersionNumber > 4:
self.logger.error( self.logger.error(
'Program error: For some reason the address generator' 'Program error: For some reason the address generator'
' queue has been given a request to create at least' ' queue has been given a request to create at least'
' one version %s address which it cannot do.\n', ' one version %s address which it cannot do.\n',
addressVersionNumber) addressVersionNumber)
logger.error('createRandomAddress 160')
if nonceTrialsPerByte == 0: if nonceTrialsPerByte == 0:
logger.error('++++++++++++170++++++++++++')
nonceTrialsPerByte = BMConfigParser().getint( nonceTrialsPerByte = BMConfigParser().getint(
'bitmessagesettings', 'defaultnoncetrialsperbyte') 'bitmessagesettings', 'defaultnoncetrialsperbyte')
logger.error('createRandomAddress 165') if nonceTrialsPerByte < \
try: defaults.networkDefaultProofOfWorkNonceTrialsPerByte:
if nonceTrialsPerByte < \ nonceTrialsPerByte = \
defaults.networkDefaultProofOfWorkNonceTrialsPerByte: defaults.networkDefaultProofOfWorkNonceTrialsPerByte
logger.error('++++++++++++175++++++++++++')
nonceTrialsPerByte = \
defaults.networkDefaultProofOfWorkNonceTrialsPerByte
except Exception as e:
logger.error('type(nonceTrialsPerByte) -{}'.format(
type(nonceTrialsPerByte)))
logger.error('type(defaults.networkDefaultProofOfWorkNonceTrialsPerByte) -{}'.format(
type(defaults.networkDefaultProofOfWorkNonceTrialsPerByte)))
logger.error('createRandomAddress except')
logger.error(str(e))
logger.error('createRandomAddress 171')
if payloadLengthExtraBytes == 0: if payloadLengthExtraBytes == 0:
logger.error('++++++++++++179++++++++++++')
payloadLengthExtraBytes = BMConfigParser().getint( payloadLengthExtraBytes = BMConfigParser().getint(
'bitmessagesettings', 'defaultpayloadlengthextrabytes') 'bitmessagesettings', 'defaultpayloadlengthextrabytes')
logger.error('createRandomAddress 176') logger.error('createRandomAddress 176')
if payloadLengthExtraBytes < \ if payloadLengthExtraBytes < \
defaults.networkDefaultPayloadLengthExtraBytes: defaults.networkDefaultPayloadLengthExtraBytes:
logger.error('++++++++++++184++++++++++++')
payloadLengthExtraBytes = \ payloadLengthExtraBytes = \
defaults.networkDefaultPayloadLengthExtraBytes defaults.networkDefaultPayloadLengthExtraBytes
logger.error('createRandomAddress 181') logger.error('createRandomAddress 181')
if command == 'createRandomAddress': if command == 'createRandomAddress':
logger.error('++++++++++++188++++++++++++')
queues.UISignalQueue.put(( queues.UISignalQueue.put((
'updateStatusBar', "" 'updateStatusBar', ""
)) ))
logger.error('&&&&&&&&&&&&&&&&&&&&&&&')
logger.error('---------144--------------')
logger.error('&&&&&&&&&&&&&&&&&&&&&&&')
# This next section is a little bit strange. We're going # This next section is a little bit strange. We're going
# to generate keys over and over until we find one # to generate keys over and over until we find one
# that starts with either \x00 or \x00\x00. Then when # that starts with either \x00 or \x00\x00. Then when
# we pack them into a Bitmessage address, we won't store # we pack them into a Bitmessage address, we won't store
# the \x00 or \x00\x00 bytes thus making the address shorter. # the \x00 or \x00\x00 bytes thus making the address shorter.
logger.error('createRandomAddress 190')
startTime = time.time() startTime = time.time()
numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix = 0 numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix = 0
logger.error('createRandomAddress 193')
potentialPrivSigningKey = OpenSSL.rand(32) potentialPrivSigningKey = OpenSSL.rand(32)
logger.error('createRandomAddress 194')
potentialPubSigningKey = highlevelcrypto.pointMult( potentialPubSigningKey = highlevelcrypto.pointMult(
potentialPrivSigningKey) potentialPrivSigningKey)
logger.error('&&&&&&&&&&&&&&&&&&&&&&&')
logger.error('---------157--------------')
logger.error('&&&&&&&&&&&&&&&&&&&&&&&\n')
while True: while True:
numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix += 1 numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix += 1
potentialPrivEncryptionKey = OpenSSL.rand(32) potentialPrivEncryptionKey = OpenSSL.rand(32)
@ -226,9 +163,6 @@ class addressGenerator(StoppableThread):
'\x00'.encode('utf-8') * numberOfNullBytesDemandedOnFrontOfRipeHash '\x00'.encode('utf-8') * numberOfNullBytesDemandedOnFrontOfRipeHash
): ):
break break
logger.error('&&&&&&&&&&&&&&&&&&&&&&&')
logger.error('---------174--------------')
logger.error('&&&&&&&&&&&&&&&&&&&&&&&\n')
self.logger.error( self.logger.error(
'Generated address with ripe digest: %s', hexlify(ripe)) 'Generated address with ripe digest: %s', hexlify(ripe))
try: try:
@ -243,9 +177,6 @@ class addressGenerator(StoppableThread):
# The user must have a pretty fast computer. # The user must have a pretty fast computer.
# time.time() - startTime equaled zero. # time.time() - startTime equaled zero.
pass pass
logger.error('&&&&&&&&&&&&&&&&&&&&&&&')
logger.error('---------191--------------')
logger.error('&&&&&&&&&&&&&&&&&&&&&&&\n')
address = encodeAddress( address = encodeAddress(
addressVersionNumber, streamNumber, ripe) addressVersionNumber, streamNumber, ripe)
@ -390,7 +321,6 @@ class addressGenerator(StoppableThread):
'getDeterministicAddress', 'getDeterministicAddress',
'createChan', 'createChan',
'joinChan'): 'joinChan'):
logger.error('++++++++++++++387+++++++++++')
if not deterministicPassphrase: if not deterministicPassphrase:
self.logger.warning( self.logger.warning(
'You are creating deterministic' 'You are creating deterministic'
@ -404,14 +334,11 @@ class addressGenerator(StoppableThread):
"Generating %1 new addresses." "Generating %1 new addresses."
).arg(str(numberOfAddressesToMake)) ).arg(str(numberOfAddressesToMake))
)) ))
logger.error('++++++++++401++++++++++++++')
signingKeyNonce = 0 signingKeyNonce = 0
encryptionKeyNonce = 1 encryptionKeyNonce = 1
# We fill out this list no matter what although we only # We fill out this list no matter what although we only
# need it if we end up passing the info to the API. # need it if we end up passing the info to the API.
logger.error('++++++++++406++++++++++++++')
listOfNewAddressesToSendOutThroughTheAPI = [] listOfNewAddressesToSendOutThroughTheAPI = []
logger.error('++++++++++409++++++++++++++')
for _ in range(numberOfAddressesToMake): for _ in range(numberOfAddressesToMake):
# This next section is a little bit strange. We're # This next section is a little bit strange. We're
# going to generate keys over and over until we find # going to generate keys over and over until we find
@ -419,63 +346,36 @@ class addressGenerator(StoppableThread):
# \x00 or \x00\x00. Then when we pack them into a # \x00 or \x00\x00. Then when we pack them into a
# Bitmessage address, we won't store the \x00 or # Bitmessage address, we won't store the \x00 or
# \x00\x00 bytes thus making the address shorter. # \x00\x00 bytes thus making the address shorter.
logger.error('++++++++++416++++++++++++++')
startTime = time.time() startTime = time.time()
logger.error('++++++++++418++++++++++++++')
numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix = 0 numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix = 0
while True: while True:
logger.error('++++++++++421++++++++++++++')
numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix += 1 numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix += 1
logger.error('++++++++++423++++++++++++++')
logger.error('signingKeyNonce 424 -{}+++++++'.format(
signingKeyNonce
))
logger.error('encodeVarint(signingKeyNonce) 427 -{}+'.format(
encodeVarint(signingKeyNonce)
))
logger.error('deterministicPassphrase 427 -{}+'.format(
deterministicPassphrase
))
potentialPrivSigningKey = hashlib.sha512( potentialPrivSigningKey = hashlib.sha512(
deterministicPassphrase.encode('raw_unicode_escape') + deterministicPassphrase.encode('raw_unicode_escape') +
encodeVarint(signingKeyNonce) encodeVarint(signingKeyNonce)
).digest()[:32] ).digest()[:32]
logger.error('++++++++++428++++++++++++++')
logger.error('++++++++++++429-{}+++++++++'.format(
encryptionKeyNonce
))
potentialPrivEncryptionKey = hashlib.sha512( potentialPrivEncryptionKey = hashlib.sha512(
deterministicPassphrase.encode('raw_unicode_escape') + deterministicPassphrase.encode('raw_unicode_escape') +
encodeVarint(encryptionKeyNonce) encodeVarint(encryptionKeyNonce)
).digest()[:32] ).digest()[:32]
logger.error('++++++++++433++++++++++++++')
potentialPubSigningKey = highlevelcrypto.pointMult( potentialPubSigningKey = highlevelcrypto.pointMult(
potentialPrivSigningKey) potentialPrivSigningKey)
logger.error('++++++++++437++++++++++++++')
potentialPubEncryptionKey = highlevelcrypto.pointMult( potentialPubEncryptionKey = highlevelcrypto.pointMult(
potentialPrivEncryptionKey) potentialPrivEncryptionKey)
logger.error('++++++++++439++++++++++++++')
signingKeyNonce += 2 signingKeyNonce += 2
logger.error('++++++++++441++++++++++++++')
encryptionKeyNonce += 2 encryptionKeyNonce += 2
logger.error('++++++++++443++++++++++++++')
sha = hashlib.new('sha512') sha = hashlib.new('sha512')
sha.update( sha.update(
potentialPubSigningKey + potentialPubEncryptionKey) potentialPubSigningKey + potentialPubEncryptionKey)
logger.error('++++++++++447++++++++++++++')
ripe = RIPEMD160Hash(sha.digest()).digest() ripe = RIPEMD160Hash(sha.digest()).digest()
logger.error('++++++++++449++++++++++++++')
if ( if (
ripe[:numberOfNullBytesDemandedOnFrontOfRipeHash] == ripe[:numberOfNullBytesDemandedOnFrontOfRipeHash] ==
'\x00'.encode() * numberOfNullBytesDemandedOnFrontOfRipeHash '\x00'.encode() * numberOfNullBytesDemandedOnFrontOfRipeHash
): ):
logger.error('++++++++++454++++++++++++++')
break break
logger.error('++++++++++418++++++++++++++')
self.logger.info( self.logger.info(
'Generated address with ripe digest: %s', hexlify(ripe)) 'Generated address with ripe digest: %s', hexlify(ripe))
try: try:
logger.error('++++++++++460++++++++++++++')
self.logger.info( self.logger.info(
'Address generator calculated %s addresses' 'Address generator calculated %s addresses'
' at %s addresses per second before finding' ' at %s addresses per second before finding'
@ -485,76 +385,51 @@ class addressGenerator(StoppableThread):
(time.time() - startTime) (time.time() - startTime)
) )
except ZeroDivisionError: except ZeroDivisionError:
logger.error('++++++++++470++++++++++++++')
# The user must have a pretty fast computer. # The user must have a pretty fast computer.
# time.time() - startTime equaled zero. # time.time() - startTime equaled zero.
pass pass
logger.error('++++++++++475++++++++++++++')
address = encodeAddress( address = encodeAddress(
addressVersionNumber, streamNumber, ripe) addressVersionNumber, streamNumber, ripe)
logger.error('++++++++++479++++++++++++++')
saveAddressToDisk = True saveAddressToDisk = True
# If we are joining an existing chan, let us check # If we are joining an existing chan, let us check
# to make sure it matches the provided Bitmessage address # to make sure it matches the provided Bitmessage address
logger.error('++++++++++484++++++++++++++')
if command == 'joinChan': if command == 'joinChan':
logger.error('++++++++++487++++++++++++++')
if address != chanAddress: if address != chanAddress:
logger.error('++++++++++490++++++++++++++')
listOfNewAddressesToSendOutThroughTheAPI.append( listOfNewAddressesToSendOutThroughTheAPI.append(
'chan name does not match address') 'chan name does not match address')
logger.error('++++++++++494++++++++++++++')
saveAddressToDisk = False saveAddressToDisk = False
if command == 'getDeterministicAddress': if command == 'getDeterministicAddress':
saveAddressToDisk = False saveAddressToDisk = False
logger.error('++++++++++498++++++++++++++')
if saveAddressToDisk and live: if saveAddressToDisk and live:
logger.error('++++++++++501++++++++++++++')
# An excellent way for us to store our keys is # An excellent way for us to store our keys is
# in Wallet Import Format. Let us convert now. # in Wallet Import Format. Let us convert now.
# https://en.bitcoin.it/wiki/Wallet_import_format # https://en.bitcoin.it/wiki/Wallet_import_format
privSigningKey = '\x80'.encode('raw_unicode_escape') + potentialPrivSigningKey privSigningKey = '\x80'.encode('raw_unicode_escape') + potentialPrivSigningKey
logger.error('++++++++++508++++++++++++++')
checksum = hashlib.sha256(hashlib.sha256( checksum = hashlib.sha256(hashlib.sha256(
privSigningKey).digest()).digest()[0:4] privSigningKey).digest()).digest()[0:4]
logger.error('++++++++++512++++++++++++++')
privSigningKeyWIF = arithmetic.changebase( privSigningKeyWIF = arithmetic.changebase(
privSigningKey + checksum, 256, 58) privSigningKey + checksum, 256, 58)
logger.error('++++++++++515++++++++++++++')
privEncryptionKey = '\x80'.encode('raw_unicode_escape') + \ privEncryptionKey = '\x80'.encode('raw_unicode_escape') + \
potentialPrivEncryptionKey potentialPrivEncryptionKey
logger.error('++++++++++518++++++++++++++')
checksum = hashlib.sha256(hashlib.sha256( checksum = hashlib.sha256(hashlib.sha256(
privEncryptionKey).digest()).digest()[0:4] privEncryptionKey).digest()).digest()[0:4]
logger.error('++++++++++521++++++++++++++')
privEncryptionKeyWIF = arithmetic.changebase( privEncryptionKeyWIF = arithmetic.changebase(
privEncryptionKey + checksum, 256, 58) privEncryptionKey + checksum, 256, 58)
logger.error('++++++++++524++++++++++++++')
try: try:
logger.error('++++++++++526++++++++++++++')
BMConfigParser().add_section(address) BMConfigParser().add_section(address)
addressAlreadyExists = False addressAlreadyExists = False
except: except:
logger.error('++++++++++530++++++++++++++')
addressAlreadyExists = True addressAlreadyExists = True
if addressAlreadyExists: if addressAlreadyExists:
logger.error('++++++++++534++++++++++++++')
self.logger.info( self.logger.info(
'%s already exists. Not adding it again.', '%s already exists. Not adding it again.',
address address
) )
logger.error('++++++++++539++++++++++++++')
queues.UISignalQueue.put(( queues.UISignalQueue.put((
'updateStatusBar', 'updateStatusBar',
tr._translate( tr._translate(
@ -564,55 +439,43 @@ class addressGenerator(StoppableThread):
).arg(address) ).arg(address)
)) ))
else: else:
logger.error('++++++++++549++++++++++++++')
self.logger.debug('label: %s', label) self.logger.debug('label: %s', label)
BMConfigParser().set(address, 'label', label) BMConfigParser().set(address, 'label', label)
BMConfigParser().set(address, 'enabled', 'true') BMConfigParser().set(address, 'enabled', 'true')
BMConfigParser().set(address, 'decoy', 'false') BMConfigParser().set(address, 'decoy', 'false')
logger.error('++++++++++554++++++++++++++')
# if command == 'joinChan' or command == 'createChan': # if command == 'joinChan' or command == 'createChan':
if command in ('joinChan', 'createChan'): if command in ('joinChan', 'createChan'):
BMConfigParser().set(address, 'chan', 'true') BMConfigParser().set(address, 'chan', 'true')
logger.error('++++++++++558++++++++++++++')
BMConfigParser().set( BMConfigParser().set(
address, 'noncetrialsperbyte', address, 'noncetrialsperbyte',
str(nonceTrialsPerByte)) str(nonceTrialsPerByte))
logger.error('++++++++++562++++++++++++++')
BMConfigParser().set( BMConfigParser().set(
address, 'payloadlengthextrabytes', address, 'payloadlengthextrabytes',
str(payloadLengthExtraBytes)) str(payloadLengthExtraBytes))
logger.error('++++++++++566++++++++++++++')
BMConfigParser().set( BMConfigParser().set(
address, 'privSigningKey', address, 'privSigningKey',
privSigningKeyWIF) privSigningKeyWIF)
logger.error('++++++++++570++++++++++++++')
BMConfigParser().set( BMConfigParser().set(
address, 'privEncryptionKey', address, 'privEncryptionKey',
privEncryptionKeyWIF) privEncryptionKeyWIF)
BMConfigParser().save() BMConfigParser().save()
logger.error('++++++++++575++++++++++++++')
queues.UISignalQueue.put(( queues.UISignalQueue.put((
'writeNewAddressToTable', 'writeNewAddressToTable',
(label, address, str(streamNumber)) (label, address, str(streamNumber))
)) ))
logger.error('++++++++++581++++++++++++++')
listOfNewAddressesToSendOutThroughTheAPI.append( listOfNewAddressesToSendOutThroughTheAPI.append(
address) address)
logger.error('++++++++++584++++++++++++++')
shared.myECCryptorObjects[ripe] = \ shared.myECCryptorObjects[ripe] = \
highlevelcrypto.makeCryptor( highlevelcrypto.makeCryptor(
hexlify(potentialPrivEncryptionKey)) hexlify(potentialPrivEncryptionKey))
logger.error('++++++++++588++++++++++++++')
shared.myAddressesByHash[ripe] = address shared.myAddressesByHash[ripe] = address
tag = hashlib.sha512(hashlib.sha512( tag = hashlib.sha512(hashlib.sha512(
encodeVarint(addressVersionNumber) + encodeVarint(addressVersionNumber) +
encodeVarint(streamNumber) + ripe encodeVarint(streamNumber) + ripe
).digest()).digest()[32:] ).digest()).digest()[32:]
logger.error('++++++++++594++++++++++++++')
shared.myAddressesByTag[tag] = address shared.myAddressesByTag[tag] = address
if addressVersionNumber == 3: if addressVersionNumber == 3:
logger.error('++++++++++597++++++++++++++')
# If this is a chan address, # If this is a chan address,
# the worker thread won't send out # the worker thread won't send out
@ -620,7 +483,6 @@ class addressGenerator(StoppableThread):
queues.workerQueue.put(( queues.workerQueue.put((
'sendOutOrStoreMyV3Pubkey', ripe)) 'sendOutOrStoreMyV3Pubkey', ripe))
elif addressVersionNumber == 4: elif addressVersionNumber == 4:
logger.error('++++++++++605++++++++++++++')
queues.workerQueue.put(( queues.workerQueue.put((
'sendOutOrStoreMyV4Pubkey', address)) 'sendOutOrStoreMyV4Pubkey', address))
queues.UISignalQueue.put(( queues.UISignalQueue.put((
@ -636,12 +498,10 @@ class addressGenerator(StoppableThread):
# Done generating addresses. # Done generating addresses.
# if command == 'createDeterministicAddresses' \ # if command == 'createDeterministicAddresses' \
# or command == 'joinChan' or command == 'createChan': # or command == 'joinChan' or command == 'createChan':
logger.error('++++++++++621++++++++++++++')
if command in ( if command in (
'createDeterministicAddresses', 'createDeterministicAddresses',
'joinChan', 'joinChan',
'createChan'): 'createChan'):
logger.error('++++++++++++++626+++++++++++')
queues.apiAddressGeneratorReturnQueue.put( queues.apiAddressGeneratorReturnQueue.put(
listOfNewAddressesToSendOutThroughTheAPI) listOfNewAddressesToSendOutThroughTheAPI)
elif command == 'getDeterministicAddress': elif command == 'getDeterministicAddress':

View File

@ -88,8 +88,6 @@ class singleWorker(StoppableThread):
def run(self): def run(self):
# pylint: disable=attribute-defined-outside-init # pylint: disable=attribute-defined-outside-init
logger.error
while not state.sqlReady and state.shutdown == 0: while not state.sqlReady and state.shutdown == 0:
self.stop.wait(2) self.stop.wait(2)
if state.shutdown > 0: if state.shutdown > 0:

View File

@ -149,7 +149,7 @@ class ECCBlind(object): # pylint: disable=too-many-instance-attributes
try: try:
bx = OpenSSL.malloc(0, l_) bx = OpenSSL.malloc(0, l_)
OpenSSL.BN_bn2binpad(x, bx, l_) OpenSSL.BN_bn2binpad(x, bx, l_)
out = bx.raw out = bx.raw[:l_]
except AttributeError: except AttributeError:
# padding manually # padding manually
bx = OpenSSL.malloc(0, OpenSSL.BN_num_bytes(x)) bx = OpenSSL.malloc(0, OpenSSL.BN_num_bytes(x))
@ -180,7 +180,7 @@ class ECCBlind(object): # pylint: disable=too-many-instance-attributes
try: try:
o = OpenSSL.malloc(0, l_) o = OpenSSL.malloc(0, l_)
OpenSSL.BN_bn2binpad(bn, o, l_) OpenSSL.BN_bn2binpad(bn, o, l_)
return o.raw return o.raw[:l_]
except AttributeError: except AttributeError:
o = OpenSSL.malloc(0, OpenSSL.BN_num_bytes(bn)) o = OpenSSL.malloc(0, OpenSSL.BN_num_bytes(bn))
OpenSSL.BN_bn2bin(bn, o) OpenSSL.BN_bn2bin(bn, o)

View File

@ -721,27 +721,16 @@ class _OpenSSL(object):
""" """
returns a create_string_buffer (ctypes) returns a create_string_buffer (ctypes)
""" """
return self.create_string_buffer_with_bytes(data, size)
def create_string_buffer_with_bytes(self, data, size):
buffer_ = None buffer_ = None
try: if data != 0:
if data != 0: if sys.version_info.major == 3 and isinstance(data, type('')):
if sys.version_info.major == 3 and isinstance(data, type('')): data = data.encode()
data = data.encode() buffer_ = self.create_string_buffer(data, size)
buffer_ = self.create_string_buffer(data, size) else:
else: buffer_ = self.create_string_buffer(size)
buffer_ = self.create_string_buffer(size)
except:
if data != 0:
if sys.version_info.major == 3 and isinstance(data, type('')):
data = data.encode()
buffer_ = self.create_string_buffer(bytes(data), size)
else:
buffer_ = self.create_string_buffer(bytes(size))
return buffer_ return buffer_
def loadOpenSSL(): def loadOpenSSL():
"""Method find and load the OpenSSL library""" """Method find and load the OpenSSL library"""
# pylint: disable=global-statement, protected-access, too-many-branches # pylint: disable=global-statement, protected-access, too-many-branches

View File

@ -45,8 +45,6 @@ class TestProcessConfig(TestProcessProto):
"""Test settings in the generated config""" """Test settings in the generated config"""
self._stop_process() self._stop_process()
config = BMConfigParser() config = BMConfigParser()
print('the value of the self.home')
print(self.home)
config.read(os.path.join(self.home, 'keys.dat')) config.read(os.path.join(self.home, 'keys.dat'))
self.assertEqual(config.safeGetInt( self.assertEqual(config.safeGetInt(
'bitmessagesettings', 'settingsversion'), 10) 'bitmessagesettings', 'settingsversion'), 10)