equal
deleted
inserted
replaced
803 const TUint bytes = BitsToBytes(aBits); |
803 const TUint bytes = BitsToBytes(aBits); |
804 const TUint words = BitsToWords(aBits); |
804 const TUint words = BitsToWords(aBits); |
805 CleanGrowL(words); |
805 CleanGrowL(words); |
806 TPtr8 buf((TUint8*)(Ptr()), bytes, WordsToBytes(Size())); |
806 TPtr8 buf((TUint8*)(Ptr()), bytes, WordsToBytes(Size())); |
807 TUint bitpos = aBits % BYTE_BITS; |
807 TUint bitpos = aBits % BYTE_BITS; |
808 GenerateRandomBytesL(buf); |
808 TRAPD(err, GenerateRandomBytesL(buf)); |
|
809 if((err != KErrNone) && (err != KErrNotSecure)) |
|
810 User::Leave(err); |
809 //mask with 0 all bits above the num requested in the most significant byte |
811 //mask with 0 all bits above the num requested in the most significant byte |
810 if(bitpos) |
812 if(bitpos) |
811 { |
813 { |
812 buf[bytes-1] = TUint8( buf[bytes-1] & ((1L << bitpos) - 1) ); |
814 buf[bytes-1] = TUint8( buf[bytes-1] & ((1L << bitpos) - 1) ); |
813 } |
815 } |