From: Felix Dörre Date: Wed, 5 Nov 2014 21:10:27 +0000 (+0100) Subject: chg: Move the profile ID in the serial to the back X-Git-Url: http://www.controwiki.de/?a=commitdiff_plain;h=b9093a80fe9374f5750ebe40b3c6490f62561da6;p=cassiopeia.git chg: Move the profile ID in the serial to the back This yields (MSB->LSB): --- diff --git a/src/simpleOpensslSigner.cpp b/src/simpleOpensslSigner.cpp index 8bed9c2..eb7d8b9 100644 --- a/src/simpleOpensslSigner.cpp +++ b/src/simpleOpensslSigner.cpp @@ -97,10 +97,12 @@ std::shared_ptr SimpleOpensslSigner::nextSerial( uint16_t profile ) { std::shared_ptr data = std::shared_ptr( ( unsigned char* ) malloc( BN_num_bytes( serial.get() ) + 20 ), free ); int len = BN_bn2bin( serial.get(), data.get() ); - data.get()[len] = profile >> 8; - data.get()[len + 1] = profile & 0xFF; // profile id - data.get()[len + 2] = 0x0; - data.get()[len + 3] = 0x0; // signer id + + data.get()[len] = 0x0; + data.get()[len + 1] = 0x0; // signer id + + data.get()[len + 2] = profile >> 8; + data.get()[len + 3] = profile & 0xFF; // profile id if( !RAND_bytes( data.get() + len + 4, 16 ) || !BN_add_word( serial.get(), 1 ) ) { throw "Big number math failed while calcing serials.";