Lines Matching +full:minimum +full:- +full:bulk
2 * Copyright 1995-2023 The OpenSSL Project Authors. All Rights Reserved.
55 * We assume that for encryption, we want a minimum length, while for in PEM_def_callback()
56 * decryption, we cannot know any minimum length, so we assume zero. in PEM_def_callback()
64 return -1; in PEM_def_callback()
77 str = "MIC-CLEAR"; in PEM_proc_type()
79 str = "MIC-ONLY"; in PEM_proc_type()
81 str = "BAD-TYPE"; in PEM_proc_type()
83 BIO_snprintf(p, PEM_BUFSIZE - (size_t)(p - buf), "Proc-Type: 4,%s\n", str); in PEM_proc_type()
90 int j = PEM_BUFSIZE - (size_t)(p - buf), n; in PEM_dek_info()
92 n = BIO_snprintf(p, j, "DEK-Info: %s,", type); in PEM_dek_info()
94 j -= n; in PEM_dek_info()
100 j -= n; in PEM_dek_info()
148 if (ameth && ameth->old_priv_decode) in check_pem()
163 if (ameth->param_decode) in check_pem()
330 * Check "Proc-Type: 4,Encrypted\nDEK-Info: objstr,hex-iv\n" in PEM_ASN1_write_bio()
433 if (cipher->cipher == NULL) in PEM_do_header()
448 if (!EVP_BytesToKey(cipher->cipher, EVP_md5(), &(cipher->iv[0]), in PEM_do_header()
456 ok = EVP_DecryptInit_ex(ctx, cipher->cipher, NULL, key, &(cipher->iv[0])); in PEM_do_header()
483 * headers we care about. This is overkill for just this limited use-case, but
484 * presumably we also parse rfc822-style headers for S/MIME, so a common
489 static const char ProcType[] = "Proc-Type:"; in PEM_get_EVP_CIPHER_INFO()
491 static const char DEKInfo[] = "DEK-Info:"; in PEM_get_EVP_CIPHER_INFO()
496 cipher->cipher = NULL; in PEM_get_EVP_CIPHER_INFO()
497 memset(cipher->iv, 0, sizeof(cipher->iv)); in PEM_get_EVP_CIPHER_INFO()
501 if (strncmp(header, ProcType, sizeof(ProcType)-1) != 0) { in PEM_get_EVP_CIPHER_INFO()
505 header += sizeof(ProcType)-1; in PEM_get_EVP_CIPHER_INFO()
512 /* We expect "ENCRYPTED" followed by optional white-space + line break */ in PEM_get_EVP_CIPHER_INFO()
513 if (strncmp(header, ENCRYPTED, sizeof(ENCRYPTED)-1) != 0 || in PEM_get_EVP_CIPHER_INFO()
514 strspn(header+sizeof(ENCRYPTED)-1, " \t\r\n") == 0) { in PEM_get_EVP_CIPHER_INFO()
518 header += sizeof(ENCRYPTED)-1; in PEM_get_EVP_CIPHER_INFO()
525 /*- in PEM_get_EVP_CIPHER_INFO()
526 * https://tools.ietf.org/html/rfc1421#section-4.6.1.3 in PEM_get_EVP_CIPHER_INFO()
527 * We expect "DEK-Info: algo[,hex-parameters]" in PEM_get_EVP_CIPHER_INFO()
529 if (strncmp(header, DEKInfo, sizeof(DEKInfo)-1) != 0) { in PEM_get_EVP_CIPHER_INFO()
533 header += sizeof(DEKInfo)-1; in PEM_get_EVP_CIPHER_INFO()
537 * DEK-INFO is a comma-separated combination of algorithm name and optional in PEM_get_EVP_CIPHER_INFO()
544 cipher->cipher = enc = EVP_get_cipherbyname(dekinfostart); in PEM_get_EVP_CIPHER_INFO()
561 if (!load_iv(&header, cipher->iv, EVP_CIPHER_get_iv_length(enc))) in PEM_get_EVP_CIPHER_INFO()
625 if ((BIO_write(bp, "-----BEGIN ", 11) != 11) || in PEM_write_bio()
627 (BIO_write(bp, "-----\n", 6) != 6)) in PEM_write_bio()
650 len -= n; in PEM_write_bio()
656 if ((BIO_write(bp, "-----END ", 9) != 9) || in PEM_write_bio()
658 (BIO_write(bp, "-----\n", 6) != 6)) in PEM_write_bio()
698 memmove(linebuf, linebuf + 3, len - 3); in sanitize_line()
699 linebuf[len - 3] = 0; in sanitize_line()
700 len -= 3; in sanitize_line()
707 len--; in sanitize_line()
719 * control characters in-place and let everything through. */ in sanitize_line()
736 static const char beginstr[] = "-----BEGIN ";
737 static const char endstr[] = "-----END ";
738 static const char tailstr[] = "-----\n";
739 #define BEGINLEN ((int)(sizeof(beginstr) - 1))
740 #define ENDLEN ((int)(sizeof(endstr) - 1))
741 #define TAILLEN ((int)(sizeof(tailstr) - 1))
771 /* Allow leading empty or non-matching lines. */ in get_name()
774 || strncmp(linebuf + len - TAILLEN, tailstr, TAILLEN) != 0); in get_name()
775 linebuf[len - TAILLEN] = '\0'; in get_name()
776 len = len - BEGINLEN - TAILLEN + 1; in get_name()
799 * any encryption used on the contents, and the bulk of the data from the bio.
800 * The end of the header is marked by a blank line; if the end-of-input marker
806 * We need the name of the PEM-encoded type to verify the end string.
841 partial_line_read = len == LINESIZE-1 && linebuf[LINESIZE-2] != '\n'; in get_header_and_data()
889 * Else, a line of text -- could be header or data; we don't in get_header_and_data()
913 * Read in PEM-formatted data from the given BIO.
951 len = buf_mem->length; in PEM_read_bio_ex()
964 if (EVP_DecodeUpdate(ctx, (unsigned char*)buf_mem->data, &len, in PEM_read_bio_ex()
965 (unsigned char*)buf_mem->data, len) < 0 in PEM_read_bio_ex()
966 || EVP_DecodeFinal(ctx, (unsigned char*)&(buf_mem->data[len]), in PEM_read_bio_ex()
972 buf_mem->length = len; in PEM_read_bio_ex()
1022 p = pem_str + pem_len - suffix_len; in ossl_pem_check_suffix()
1025 p--; in ossl_pem_check_suffix()
1028 return p - pem_str; in ossl_pem_check_suffix()