X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;ds=sidebyside;f=src%2FsimpleOpensslSigner.cpp;h=eb7d8b9e720232989b8a60c5b0bfc792a50d2fe0;hb=ba8f20d49b7c8142babdbe783ebd9c937405ba13;hp=8bed9c27553cc6c33e48b41777568c245f091720;hpb=d3a789d21ce0a742fed4fe94b7634ae920fc4776;p=cassiopeia.git 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.";