RangeNetworks / openbts

GSM+GPRS Radio Access Network Node
GNU Affero General Public License v3.0
864 stars 326 forks source link

Problem with encryption #18

Open shaaati opened 8 years ago

shaaati commented 8 years ago

When trying to set up encryption I end up with the following log output:

Jan  8 10:58:25 openBTS openbts: DEBUG 1785:2042 2016-01-08T10:58:25.8 TMSITable.cpp:161:runQuery:  query=UPDATE TMSI_TABLE SET IMEI='359710049084380',A5_SUPPORT=5,POWER_CLASS=4,kc='96E743AD6398DC00',ASSOCIATED_URI='<tel:017694923917>',ASSERTED_IDENTITY='',ACCESSED=1452247105 WHERE IMSI='262071234567891' checkChanges=1
Jan  8 10:58:25 openBTS openbts: ERR 1785:2042 2016-01-08T10:58:25.8 TMSITable.cpp:165:runQuery: TMSI table query failed: query=UPDATE TMSI_TABLE SET IMEI='359710049084380',A5_SUPPORT=5,POWER_CLASS=4,kc='96E743AD6398DC00',ASSOCIATED_URI='<tel:017694923917>',ASSERTED_IDENTITY='',ACCESSED=1452247105 WHERE IMSI='262071234567891' resultCode=101 changes=0 error:not an error
Jan  8 10:58:25 openBTS openbts: ERR 1785:2042 2016-01-08T10:58:25.8 TMSITable.cpp:999:getKc: sqlite3_single_lookup failed to find kc for 262071234567891
Jan  8 10:58:25 openBTS openbts: DEBUG 1785:2042 2016-01-08T10:58:25.8 L3MobilityManagement.cpp:829:machineRunState: no ki: NOT sending Ciphering Mode Command on C0T0 SDCCH/4-0 state=Established for IMSI262071234567891
Jan  8 10:58:25 openBTS openbts: DEBUG 1785:2042 2016-01-08T10:58:25.8 TMSITable.cpp:161:runQuery:  query=INSERT INTO TMSI_TABLE (IMSI,CREATED,ACCESSED,TMSI,AUTH,REJECT_CODE,OLD_MCC,OLD_MNC,OLD_LAC,OLD_TMSI) VALUES ('262071234567891',1452247105,1452247105,1073741827,1,0,262,7,1000,0) checkChanges=1

Apparently, a key kc is created as expected but then the update query fails. I am a bit irritated by the sqlite error message (error:not an error), however if this code path is executed the runQuery() method will inevitably return false. As a result no encryption is set up.

(When looking at the database file in /var/run/TMSITable.db I can indeed not see the key kc, but I don't yet fully understand if the database I see is up-to-date or if there is a more recent version in memory that still needs to be flushed to disk.)