| 1 |
|
|---|
| 2 | ; Disclaimer:
|
|---|
| 3 | ;=============
|
|---|
| 4 | ; The sourcecode is released via www.netlabs.org CVS *ONLY*.
|
|---|
| 5 | ; You MUST NOT upload it to other servers nor republish it in any way.
|
|---|
| 6 | ; The sourcecode is still COPYRIGHTED and NOT RELEASED UNDER GPL.
|
|---|
| 7 | ; It's (c) Copyright 1998-2003 by Martin Kiewitz.
|
|---|
| 8 | ; You may recompile the source and do *PRIVATE* modifications, but please keep
|
|---|
| 9 | ; in mind that modifying this code needs at least *some* assembly skill. If
|
|---|
| 10 | ; you mess up your system, because you needed to hack your way through, don't
|
|---|
| 11 | ; blame me. Releasing a customized version of AiR-BOOT, selling it in any form
|
|---|
| 12 | ; or reusing parts of this source is *PROHIBITED*. Ask me, if you have some
|
|---|
| 13 | ; idea about new functionality *before* developing the code, otherwise I will
|
|---|
| 14 | ; definitely reject it. Also please accept, that I have some basic design
|
|---|
| 15 | ; rules on AiR-BOOT and I will maintain them at all costs, so this won't get
|
|---|
| 16 | ; another GRUB.
|
|---|
| 17 |
|
|---|
| 18 | ;---------------------------------------------------------------------------
|
|---|
| 19 | ; AiR-BOOT / PASSWORD
|
|---|
| 20 | ;---------------------------------------------------------------------------
|
|---|
| 21 |
|
|---|
| 22 | ; Don't ask me, what I'm doing in here to encode the passwords. I don't even
|
|---|
| 23 | ; know by myself anymore. It's some kind of hash and I hope that it isn't weak
|
|---|
| 24 | ; and some mad uber-hacker-god will laugh about it.
|
|---|
| 25 |
|
|---|
| 26 | PASSWORD_AskSystemPwd Proc Near Uses ax bx si di
|
|---|
| 27 | ; Asks System Password, if set...
|
|---|
| 28 | test CFG_PasswordSystem, 1
|
|---|
| 29 | jz PASP_NoPassword
|
|---|
| 30 | mov ax, 0ABABh
|
|---|
| 31 | mov si, offset TXT_ProtectedSystem
|
|---|
| 32 | xor di, di ; May Access With ANY correct password
|
|---|
| 33 | call PASSWORD_AskSpecifiedPassword
|
|---|
| 34 | PASP_NoPassword:
|
|---|
| 35 | ret
|
|---|
| 36 | PASSWORD_AskSystemPwd EndP
|
|---|
| 37 |
|
|---|
| 38 | PASSWORD_AskChangeBootPwd Proc Near Uses ax bx si di
|
|---|
| 39 | ; Asks System Password, if set...
|
|---|
| 40 | test CFG_PasswordChangeBoot, 1
|
|---|
| 41 | jz PACBP_NoPassword
|
|---|
| 42 | test TimedBootUsed, 1
|
|---|
| 43 | jnz PACBP_NoPassword
|
|---|
| 44 | mov ax, 0ABABh
|
|---|
| 45 | mov si, offset TXT_ProtectedBootUp
|
|---|
| 46 | xor di, di ; May Access With ANY correct password
|
|---|
| 47 | call PASSWORD_AskSpecifiedPassword
|
|---|
| 48 | PACBP_NoPassword:
|
|---|
| 49 | ret
|
|---|
| 50 | PASSWORD_AskChangeBootPwd EndP
|
|---|
| 51 |
|
|---|
| 52 | ; In: ax - Magic for AskPassword Subroutine
|
|---|
| 53 | ; si - Text to show, when asking for password
|
|---|
| 54 | ; di - which password to check, use 0 to check any of both
|
|---|
| 55 | ; Destroyed: None
|
|---|
| 56 | PASSWORD_AskSpecifiedPassword Proc Near Uses cx dx ds si es di bp
|
|---|
| 57 | local AskPasswordMiss:byte, AskPasswordText:word, AskPasswordMagic:word, AskPasswordWhich:word
|
|---|
| 58 | mov AskPasswordMagic, ax
|
|---|
| 59 | mov AskPasswordText, si
|
|---|
| 60 | mov AskPasswordWhich, di
|
|---|
| 61 | mov ax, cs
|
|---|
| 62 | mov ds, ax
|
|---|
| 63 | mov es, ax
|
|---|
| 64 | mov di, offset TempPasswordEntry
|
|---|
| 65 | mov al, 32
|
|---|
| 66 | mov cx, 8
|
|---|
| 67 | rep stosb ; Generates empty password
|
|---|
| 68 | mov AskPasswordMiss, 0
|
|---|
| 69 | mov ax, AskPasswordWhich
|
|---|
| 70 | or ax, ax
|
|---|
| 71 | jnz PASP_BadBoyRetry ; Only check one
|
|---|
| 72 | ; Encode empty Password...
|
|---|
| 73 | mov si, offset TempPasswordEntry
|
|---|
| 74 | call PASSWORD_Encode
|
|---|
| 75 | mov di, offset CFG_MasterPassword
|
|---|
| 76 | mov si, offset PasswordSpace ; Check Thiz Out
|
|---|
| 77 | mov cx, 8
|
|---|
| 78 | repe cmpsb
|
|---|
| 79 | je PASP_DualCorrect1
|
|---|
| 80 | jmp PASP_LetUserGuessPassword
|
|---|
| 81 | PASP_DualCorrect1:
|
|---|
| 82 | mov si, offset PasswordSpace ; Check Thiz Out
|
|---|
| 83 | mov cx, 8
|
|---|
| 84 | repe cmpsb
|
|---|
| 85 | je PASP_CorrectPass
|
|---|
| 86 | jmp PASP_LetUserGuessPassword
|
|---|
| 87 |
|
|---|
| 88 | PASP_BadBoyRetry:
|
|---|
| 89 | ; Encode given Password...
|
|---|
| 90 | mov si, offset TempPasswordEntry
|
|---|
| 91 | call PASSWORD_Encode
|
|---|
| 92 |
|
|---|
| 93 | ; ...and compare it to the specified on-board one
|
|---|
| 94 | mov di, AskPasswordWhich
|
|---|
| 95 | or di, di
|
|---|
| 96 | jnz PASP_OnlyCheckSpecified
|
|---|
| 97 | mov di, offset CFG_MasterPassword
|
|---|
| 98 | mov si, offset PasswordSpace ; Check Thiz Out
|
|---|
| 99 | mov cx, 8
|
|---|
| 100 | repe cmpsb
|
|---|
| 101 | je PASP_CorrectPass
|
|---|
| 102 | mov di, offset CFG_BootPassword
|
|---|
| 103 | PASP_OnlyCheckSpecified:
|
|---|
| 104 | mov si, offset PasswordSpace ; Check Thiz Other Thingie Out
|
|---|
| 105 | mov cx, 8
|
|---|
| 106 | repe cmpsb
|
|---|
| 107 | je PASP_CorrectPass
|
|---|
| 108 |
|
|---|
| 109 | PASP_LetUserGuessPassword: ; ;-)))
|
|---|
| 110 | mov ax, AskPasswordMagic
|
|---|
| 111 | mov si, AskPasswordText
|
|---|
| 112 | mov di, offset TempPasswordEntry
|
|---|
| 113 | call SETUP_LetEnterPassword
|
|---|
| 114 | inc AskPasswordMiss
|
|---|
| 115 | cmp AskPasswordMiss, 10
|
|---|
| 116 | jae PASP_BadBoyAlert
|
|---|
| 117 | jmp PASP_BadBoyRetry
|
|---|
| 118 |
|
|---|
| 119 | PASP_BadBoyAlert: ; Whaddayawant ;)
|
|---|
| 120 | mov ax, 0ABABh
|
|---|
| 121 | mov cx, 0B03h
|
|---|
| 122 | mov si, offset TXT_TooManyTries
|
|---|
| 123 | call SETUP_ShowErrorBox
|
|---|
| 124 | jmp MBR_HaltSystem
|
|---|
| 125 |
|
|---|
| 126 | PASP_CorrectPass:
|
|---|
| 127 | ret
|
|---|
| 128 | PASSWORD_AskSpecifiedPassword EndP
|
|---|
| 129 |
|
|---|
| 130 | PasswordSpace: db 16 dup (0) ; Space for Password-Encoding...
|
|---|
| 131 | dw 0BABEh ; All of these 8 bytes are insider
|
|---|
| 132 | dw 0FC77h ; jokes. I bet no one will solve
|
|---|
| 133 | dw 0632Fh ; all of them =) they are used by
|
|---|
| 134 | dw 0CD09h ; the algo, so don't remove them.
|
|---|
| 135 |
|
|---|
| 136 | ; In: SI - Pointer to Password, fixed len (8 bytes)
|
|---|
| 137 | ; Out: Password-Space filled with encoded password
|
|---|
| 138 | ; Destroyed: None
|
|---|
| 139 | PASSWORD_Encode Proc Near Uses ax cx ds si es di
|
|---|
| 140 | mov ax, cs
|
|---|
| 141 | mov es, ax
|
|---|
| 142 | mov di, offset PasswordSpace
|
|---|
| 143 | mov cx, 8
|
|---|
| 144 | PE_HashLoop:
|
|---|
| 145 | lodsb
|
|---|
| 146 | mov es:[di], al
|
|---|
| 147 | xor al, 0ABh
|
|---|
| 148 | and al, 7
|
|---|
| 149 | mov es:[di+8], al ; Init Hash Table
|
|---|
| 150 | inc di
|
|---|
| 151 | loop PE_HashLoop
|
|---|
| 152 |
|
|---|
| 153 | mov si, offset PasswordSpace
|
|---|
| 154 | mov cx, 8
|
|---|
| 155 | PE_ContinueLoop:
|
|---|
| 156 | mov al, ds:[si]
|
|---|
| 157 | movzx bx, ds:[si+8]
|
|---|
| 158 | add bl, 16
|
|---|
| 159 | mov ah, ds:[si+bx]
|
|---|
| 160 |
|
|---|
| 161 | xor al, ds:[si-1]
|
|---|
| 162 | xor al, ah
|
|---|
| 163 | mov ds:[si], al
|
|---|
| 164 |
|
|---|
| 165 | inc si
|
|---|
| 166 | loop PE_ContinueLoop
|
|---|
| 167 | ret
|
|---|
| 168 | PASSWORD_Encode EndP
|
|---|