• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:without +full:- +full:libssh2

19  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
22 * SPDX-License-Identifier: curl
63 /* When OpenSSL or wolfSSL is available we use their SHA256-functions. */
89 /* Please keep the SSL backend-specific #if branches in this order:
110 ctx->openssl_ctx = EVP_MD_CTX_create(); in my_sha256_init()
111 if(!ctx->openssl_ctx) in my_sha256_init()
114 if(!EVP_DigestInit_ex(ctx->openssl_ctx, EVP_sha256(), NULL)) { in my_sha256_init()
115 EVP_MD_CTX_destroy(ctx->openssl_ctx); in my_sha256_init()
125 EVP_DigestUpdate(ctx->openssl_ctx, data, length); in my_sha256_update()
130 EVP_DigestFinal_ex(ctx->openssl_ctx, digest, NULL); in my_sha256_final()
131 EVP_MD_CTX_destroy(ctx->openssl_ctx); in my_sha256_final()
225 if(!CryptAcquireContext(&ctx->hCryptProv, NULL, NULL, PROV_RSA_AES, in my_sha256_init()
229 if(!CryptCreateHash(ctx->hCryptProv, CALG_SHA_256, 0, 0, &ctx->hHash)) { in my_sha256_init()
230 CryptReleaseContext(ctx->hCryptProv, 0); in my_sha256_init()
231 ctx->hCryptProv = 0; in my_sha256_init()
242 CryptHashData(ctx->hHash, (unsigned char *) data, length, 0); in my_sha256_update()
249 CryptGetHashParam(ctx->hHash, HP_HASHVAL, NULL, &length, 0); in my_sha256_final()
251 CryptGetHashParam(ctx->hHash, HP_HASHVAL, digest, &length, 0); in my_sha256_final()
253 if(ctx->hHash) in my_sha256_final()
254 CryptDestroyHash(ctx->hHash); in my_sha256_final()
256 if(ctx->hCryptProv) in my_sha256_final()
257 CryptReleaseContext(ctx->hCryptProv, 0); in my_sha256_final()
336 ((unsigned long)(x) << (unsigned long)(32 - ((y) & 31)))) & 0xFFFFFFFFUL)
346 /* Compress 512-bits */
355 S[i] = md->state[i]; in sha256_compress()
357 /* copy the state into 512-bits into W[0..15] */ in sha256_compress()
362 W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + in sha256_compress()
363 W[i - 16]; in sha256_compress()
384 md->state[i] = md->state[i] + S[i]; in sha256_compress()
393 md->curlen = 0; in my_sha256_init()
394 md->length = 0; in my_sha256_init()
395 md->state[0] = 0x6A09E667UL; in my_sha256_init()
396 md->state[1] = 0xBB67AE85UL; in my_sha256_init()
397 md->state[2] = 0x3C6EF372UL; in my_sha256_init()
398 md->state[3] = 0xA54FF53AUL; in my_sha256_init()
399 md->state[4] = 0x510E527FUL; in my_sha256_init()
400 md->state[5] = 0x9B05688CUL; in my_sha256_init()
401 md->state[6] = 0x1F83D9ABUL; in my_sha256_init()
402 md->state[7] = 0x5BE0CD19UL; in my_sha256_init()
421 if(md->curlen > sizeof(md->buf)) in my_sha256_update()
422 return -1; in my_sha256_update()
424 if(md->curlen == 0 && inlen >= block_size) { in my_sha256_update()
426 return -1; in my_sha256_update()
427 md->length += block_size * 8; in my_sha256_update()
429 inlen -= block_size; in my_sha256_update()
432 n = CURLMIN(inlen, (block_size - md->curlen)); in my_sha256_update()
433 memcpy(md->buf + md->curlen, in, n); in my_sha256_update()
434 md->curlen += n; in my_sha256_update()
436 inlen -= n; in my_sha256_update()
437 if(md->curlen == block_size) { in my_sha256_update()
438 if(sha256_compress(md, md->buf) < 0) in my_sha256_update()
439 return -1; in my_sha256_update()
440 md->length += 8 * block_size; in my_sha256_update()
441 md->curlen = 0; in my_sha256_update()
460 if(md->curlen >= sizeof(md->buf)) in my_sha256_final()
461 return -1; in my_sha256_final()
464 md->length += md->curlen * 8; in my_sha256_final()
467 md->buf[md->curlen++] = (unsigned char)0x80; in my_sha256_final()
473 if(md->curlen > 56) { in my_sha256_final()
474 while(md->curlen < 64) { in my_sha256_final()
475 md->buf[md->curlen++] = (unsigned char)0; in my_sha256_final()
477 sha256_compress(md, md->buf); in my_sha256_final()
478 md->curlen = 0; in my_sha256_final()
482 while(md->curlen < 56) { in my_sha256_final()
483 md->buf[md->curlen++] = (unsigned char)0; in my_sha256_final()
487 WPA_PUT_BE64(md->buf + 56, md->length); in my_sha256_final()
488 sha256_compress(md, md->buf); in my_sha256_final()
492 WPA_PUT_BE32(out + (4 * i), md->state[i]); in my_sha256_final()
506 * output [in/out] - The output buffer.
507 * input [in] - The input data.
508 * length [in] - The input length.
545 #endif /* AWS, DIGEST, or libSSH2 */