Subversion Repositories Kolibri OS

Rev

Rev 9126 | Rev 9990 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9126 Rev 9216
Line 132... Line 132...
132
 
132
 
Line 133... Line 133...
133
endl
133
endl
Line 134... Line 134...
134
 
134
 
135
        DEBUGF  3, "SSH: Performing RSA verification\n"
135
        DEBUGF  3, "SSH: Performing RSA verification\n"
136
 
136
 
137
        mcall   68, 12, sizeof.crash_ctx + 5*(MAX_BITS/8+4)
137
        mcall   68, 12, LIBCRASH_CTX_LEN + 5*(MAX_BITS/8+4)
138
        test    eax, eax
138
        test    eax, eax
139
        jz      .err_nomem
139
        jz      .err_nomem
140
        mov     [h_ctx], eax
140
        mov     [h_ctx], eax
141
        add     eax, sizeof.crash_ctx
141
        add     eax, LIBCRASH_CTX_LEN
142
        mov     [mpint_e], eax
142
        mov     [mpint_e], eax
143
        add     eax, MAX_BITS/8+4
143
        add     eax, MAX_BITS/8+4
Line 209... Line 209...
209
        push    esi
209
        push    esi
Line 210... Line 210...
210
 
210
 
211
; EMSA-PKCS1-v1_5
211
; EMSA-PKCS1-v1_5
212
        invoke  sha1_init, [h_ctx]
212
        invoke  sha1_init, [h_ctx]
213
        invoke  sha1_update, [h_ctx], [M], [message_len]
213
        invoke  sha1_update, [h_ctx], [M], [message_len]
Line 214... Line 214...
214
        invoke  sha1_final, [h_ctx]
214
        invoke  sha1_finish, [h_ctx]
215
 
215
 
216
        mov     edi, [EM_accent]
216
        mov     edi, [EM_accent]
217
        mov     al, 0x00
217
        mov     al, 0x00
218
        stosb
218
        stosb
219
        mov     al, 0x01
219
        mov     al, 0x01
220
        stosb
220
        stosb
221
        mov     ecx, [k]
221
        mov     ecx, [k]
222
        sub     ecx, (rsa_sha1_T.len + 3 + SHA1_HASH_SIZE)
222
        sub     ecx, (rsa_sha1_T.len + 3 + SHA1_LEN)
223
        jl      .err_key
223
        jl      .err_key
224
        jz      @f
224
        jz      @f
225
        mov     al, 0xff
225
        mov     al, 0xff
Line 229... Line 229...
229
        stosb
229
        stosb
230
        mov     esi, rsa_sha1_T
230
        mov     esi, rsa_sha1_T
231
        mov     ecx, rsa_sha1_T.len
231
        mov     ecx, rsa_sha1_T.len
232
        rep movsb
232
        rep movsb
233
        mov     esi, [h_ctx]
233
        mov     esi, [h_ctx]
234
        mov     ecx, SHA1_HASH_SIZE
234
        mov     ecx, SHA1_LEN
235
        rep movsb
235
        rep movsb
Line 236... Line 236...
236
 
236
 
237
        pop     esi
237
        pop     esi
Line 241... Line 241...
241
        DEBUGF  3, "SSH: Using RSA with SHA2-256 hash\n"
241
        DEBUGF  3, "SSH: Using RSA with SHA2-256 hash\n"
242
        add     esi, 4+4+12
242
        add     esi, 4+4+12
243
        push    esi
243
        push    esi
Line 244... Line 244...
244
 
244
 
245
; EMSA-PKCS1-v1_5
245
; EMSA-PKCS1-v1_5
246
        invoke  sha256_init, [h_ctx]
246
        invoke  sha2_256_init, [h_ctx]
247
        invoke  sha256_update, [h_ctx], [M], [message_len]
247
        invoke  sha2_256_update, [h_ctx], [M], [message_len]
Line 248... Line 248...
248
        invoke  sha256_final, [h_ctx]
248
        invoke  sha2_256_finish, [h_ctx]
249
 
249
 
250
        mov     edi, [EM_accent]
250
        mov     edi, [EM_accent]
251
        mov     al, 0x00
251
        mov     al, 0x00
252
        stosb
252
        stosb
253
        mov     al, 0x01
253
        mov     al, 0x01
254
        stosb
254
        stosb
255
        mov     ecx, [k]
255
        mov     ecx, [k]
256
        sub     ecx, (rsa_sha256_T.len + 3 + SHA256_HASH_SIZE)
256
        sub     ecx, (rsa_sha256_T.len + 3 + SHA2_256_LEN)
257
        jl      .err_key
257
        jl      .err_key
258
        jz      @f
258
        jz      @f
259
        mov     al, 0xff
259
        mov     al, 0xff
Line 263... Line 263...
263
        stosb
263
        stosb
264
        mov     esi, rsa_sha256_T
264
        mov     esi, rsa_sha256_T
265
        mov     ecx, rsa_sha256_T.len
265
        mov     ecx, rsa_sha256_T.len
266
        rep movsb
266
        rep movsb
267
        mov     esi, [h_ctx]
267
        mov     esi, [h_ctx]
268
        mov     ecx, SHA256_HASH_SIZE
268
        mov     ecx, SHA2_256_LEN
269
        rep movsb
269
        rep movsb
Line 270... Line 270...
270
 
270
 
271
        pop     esi
271
        pop     esi
Line 275... Line 275...
275
        DEBUGF  3, "SSH: Using RSA with SHA2-512 hash\n"
275
        DEBUGF  3, "SSH: Using RSA with SHA2-512 hash\n"
276
        add     esi, 4+4+12
276
        add     esi, 4+4+12
277
        push    esi
277
        push    esi
Line 278... Line 278...
278
 
278
 
279
; EMSA-PKCS1-v1_5
279
; EMSA-PKCS1-v1_5
280
        invoke  sha512_init, [h_ctx]
280
        invoke  sha2_512_init, [h_ctx]
281
        invoke  sha512_update, [h_ctx], [M], [message_len]
281
        invoke  sha2_512_update, [h_ctx], [M], [message_len]
Line 282... Line 282...
282
        invoke  sha512_final, [h_ctx]
282
        invoke  sha2_512_finish, [h_ctx]
283
 
283
 
284
        mov     edi, [EM_accent]
284
        mov     edi, [EM_accent]
285
        mov     al, 0x00
285
        mov     al, 0x00
286
        stosb
286
        stosb
287
        mov     al, 0x01
287
        mov     al, 0x01
288
        stosb
288
        stosb
289
        mov     ecx, [k]
289
        mov     ecx, [k]
290
        sub     ecx, (rsa_sha512_T.len + 3 + SHA512_HASH_SIZE)
290
        sub     ecx, (rsa_sha512_T.len + 3 + SHA2_512_LEN)
291
        jl      .err_key
291
        jl      .err_key
292
        jz      @f
292
        jz      @f
293
        mov     al, 0xff
293
        mov     al, 0xff
Line 297... Line 297...
297
        stosb
297
        stosb
298
        mov     esi, rsa_sha512_T
298
        mov     esi, rsa_sha512_T
299
        mov     ecx, rsa_sha512_T.len
299
        mov     ecx, rsa_sha512_T.len
300
        rep movsb
300
        rep movsb
301
        mov     esi, [h_ctx]
301
        mov     esi, [h_ctx]
302
        mov     ecx, SHA512_HASH_SIZE
302
        mov     ecx, SHA2_512_LEN
303
        rep movsb
303
        rep movsb
Line 304... Line 304...
304
 
304
 
305
        pop     esi
305
        pop     esi