Changeset e1c68d22


Ignore:
Timestamp:
Jun 6, 2013 3:24:01 PM (7 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
081b692
Parents:
b7dc8f42
Message:
  • Correct errors in the specification of the BuildResponseRecord?. The first 32 bytes are not random; they are the hash of the following 496 bytes.
  • Don't waste entropy on bytes we are going to overwrite in the BRR
File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/data/i2np/BuildResponseRecord.java

    rb7dc8f42 re1c68d22  
    1111 *
    1212 * The reply record is the same size as the request record (528 bytes).
    13  * Bytes 0-526 contain random data.
     13 * Bytes 0-31 contain the hash of bytes 32-527
     14 * Bytes 32-526 contain random data.
    1415 * Byte 527 contains the reply.
    1516 */
     
    1920     * Create a new encrypted response
    2021     *
    21      * @param status the response
     22     * @param status the response 0-255
    2223     * @param responseMessageId unused except for debugging
    2324     * @return a 528-byte response record
     
    2627        //Log log = ctx.logManager().getLog(BuildResponseRecord.class);
    2728        byte rv[] = new byte[TunnelBuildReplyMessage.RECORD_SIZE];
    28         ctx.random().nextBytes(rv);
     29        ctx.random().nextBytes(rv, Hash.HASH_LENGTH, TunnelBuildReplyMessage.RECORD_SIZE - Hash.HASH_LENGTH - 1);
    2930        DataHelper.toLong(rv, TunnelBuildMessage.RECORD_SIZE-1, 1, status);
    3031        // rv = AES(SHA256(padding+status) + padding + status, replyKey, replyIV)
Note: See TracChangeset for help on using the changeset viewer.