Lines Matching full:if

10 #if defined(MBEDTLS_PEM_PARSE_C) || defined(MBEDTLS_PEM_WRITE_C)
25 #if defined(MBEDTLS_USE_PSA_CRYPTO)
29 #if defined(MBEDTLS_MD_CAN_MD5) && \
37 #if defined(MBEDTLS_PEM_PARSE_C)
43 #if defined(PEM_RFC1421)
55 if (*s >= '0' && *s <= '9') { in pem_get_iv()
58 if (*s >= 'A' && *s <= 'F') { in pem_get_iv()
61 if (*s >= 'a' && *s <= 'f') { in pem_get_iv()
89 if ((ret = mbedtls_md_setup(&md5_ctx, md5_info, 0)) != 0) { in pem_pbkdf1()
96 if ((ret = mbedtls_md_starts(&md5_ctx)) != 0) { in pem_pbkdf1()
99 if ((ret = mbedtls_md_update(&md5_ctx, pwd, pwdlen)) != 0) { in pem_pbkdf1()
102 if ((ret = mbedtls_md_update(&md5_ctx, iv, 8)) != 0) { in pem_pbkdf1()
105 if ((ret = mbedtls_md_finish(&md5_ctx, md5sum)) != 0) { in pem_pbkdf1()
109 if (keylen <= 16) { in pem_pbkdf1()
119 if ((ret = mbedtls_md_starts(&md5_ctx)) != 0) { in pem_pbkdf1()
122 if ((ret = mbedtls_md_update(&md5_ctx, md5sum, 16)) != 0) { in pem_pbkdf1()
125 if ((ret = mbedtls_md_update(&md5_ctx, pwd, pwdlen)) != 0) { in pem_pbkdf1()
128 if ((ret = mbedtls_md_update(&md5_ctx, iv, 8)) != 0) { in pem_pbkdf1()
131 if ((ret = mbedtls_md_finish(&md5_ctx, md5sum)) != 0) { in pem_pbkdf1()
136 if (keylen < 32) { in pem_pbkdf1()
149 #if defined(MBEDTLS_DES_C)
163 if ((ret = pem_pbkdf1(des_key, 8, des_iv, pwd, pwdlen)) != 0) { in pem_des_decrypt()
167 if ((ret = mbedtls_des_setkey_dec(&des_ctx, des_key)) != 0) { in pem_des_decrypt()
193 if ((ret = pem_pbkdf1(des3_key, 24, des3_iv, pwd, pwdlen)) != 0) { in pem_des3_decrypt()
197 if ((ret = mbedtls_des3_set3key_dec(&des3_ctx, des3_key)) != 0) { in pem_des3_decrypt()
211 #if defined(MBEDTLS_AES_C)
225 if ((ret = pem_pbkdf1(aes_key, keylen, aes_iv, pwd, pwdlen)) != 0) { in pem_aes_decrypt()
229 if ((ret = mbedtls_aes_setkey_dec(&aes_ctx, aes_key, keylen * 8)) != 0) { in pem_aes_decrypt()
253 #if defined(PEM_RFC1421) in mbedtls_pem_read_buffer()
261 if (ctx == NULL) { in mbedtls_pem_read_buffer()
267 if (s1 == NULL) { in mbedtls_pem_read_buffer()
273 if (s2 == NULL || s2 <= s1) { in mbedtls_pem_read_buffer()
278 if (*s1 == ' ') { in mbedtls_pem_read_buffer()
281 if (*s1 == '\r') { in mbedtls_pem_read_buffer()
284 if (*s1 == '\n') { in mbedtls_pem_read_buffer()
292 if (*end == ' ') { in mbedtls_pem_read_buffer()
295 if (*end == '\r') { in mbedtls_pem_read_buffer()
298 if (*end == '\n') { in mbedtls_pem_read_buffer()
305 if (s2 - s1 >= 22 && memcmp(s1, "Proc-Type: 4,ENCRYPTED", 22) == 0) { in mbedtls_pem_read_buffer()
306 #if defined(PEM_RFC1421) in mbedtls_pem_read_buffer()
310 if (*s1 == '\r') { in mbedtls_pem_read_buffer()
313 if (*s1 == '\n') { in mbedtls_pem_read_buffer()
320 #if defined(MBEDTLS_DES_C) in mbedtls_pem_read_buffer()
321 if (s2 - s1 >= 23 && memcmp(s1, "DEK-Info: DES-EDE3-CBC,", 23) == 0) { in mbedtls_pem_read_buffer()
325 if (s2 - s1 < 16 || pem_get_iv(s1, pem_iv, 8) != 0) { in mbedtls_pem_read_buffer()
330 } else if (s2 - s1 >= 18 && memcmp(s1, "DEK-Info: DES-CBC,", 18) == 0) { in mbedtls_pem_read_buffer()
334 if (s2 - s1 < 16 || pem_get_iv(s1, pem_iv, 8) != 0) { in mbedtls_pem_read_buffer()
342 #if defined(MBEDTLS_AES_C) in mbedtls_pem_read_buffer()
343 if (s2 - s1 >= 14 && memcmp(s1, "DEK-Info: AES-", 14) == 0) { in mbedtls_pem_read_buffer()
344 if (s2 - s1 < 22) { in mbedtls_pem_read_buffer()
346 } else if (memcmp(s1, "DEK-Info: AES-128-CBC,", 22) == 0) { in mbedtls_pem_read_buffer()
348 } else if (memcmp(s1, "DEK-Info: AES-192-CBC,", 22) == 0) { in mbedtls_pem_read_buffer()
350 } else if (memcmp(s1, "DEK-Info: AES-256-CBC,", 22) == 0) { in mbedtls_pem_read_buffer()
357 if (s2 - s1 < 32 || pem_get_iv(s1, pem_iv, 16) != 0) { in mbedtls_pem_read_buffer()
365 if (enc_alg == MBEDTLS_CIPHER_NONE) { in mbedtls_pem_read_buffer()
369 if (*s1 == '\r') { in mbedtls_pem_read_buffer()
372 if (*s1 == '\n') { in mbedtls_pem_read_buffer()
382 if (s1 >= s2) { in mbedtls_pem_read_buffer()
388 if (ret == MBEDTLS_ERR_BASE64_INVALID_CHARACTER) { in mbedtls_pem_read_buffer()
392 if ((buf = mbedtls_calloc(1, len)) == NULL) { in mbedtls_pem_read_buffer()
396 if ((ret = mbedtls_base64_decode(buf, len, &len, s1, s2 - s1)) != 0) { in mbedtls_pem_read_buffer()
401 if (enc != 0) { in mbedtls_pem_read_buffer()
402 #if defined(PEM_RFC1421) in mbedtls_pem_read_buffer()
403 if (pwd == NULL) { in mbedtls_pem_read_buffer()
410 #if defined(MBEDTLS_DES_C) in mbedtls_pem_read_buffer()
411 if (enc_alg == MBEDTLS_CIPHER_DES_EDE3_CBC) { in mbedtls_pem_read_buffer()
413 } else if (enc_alg == MBEDTLS_CIPHER_DES_CBC) { in mbedtls_pem_read_buffer()
418 #if defined(MBEDTLS_AES_C) in mbedtls_pem_read_buffer()
419 if (enc_alg == MBEDTLS_CIPHER_AES_128_CBC) { in mbedtls_pem_read_buffer()
421 } else if (enc_alg == MBEDTLS_CIPHER_AES_192_CBC) { in mbedtls_pem_read_buffer()
423 } else if (enc_alg == MBEDTLS_CIPHER_AES_256_CBC) { in mbedtls_pem_read_buffer()
428 if (ret != 0) { in mbedtls_pem_read_buffer()
439 if (len <= 2 || buf[0] != 0x30 || buf[1] > 0x83) { in mbedtls_pem_read_buffer()
457 if (ctx->buf != NULL) { in mbedtls_pem_free()
466 #if defined(MBEDTLS_PEM_WRITE_C)
478 if (use_len + add_len > buf_len) { in mbedtls_pem_write_buffer()
483 if (use_len != 0 && in mbedtls_pem_write_buffer()
488 if ((ret = mbedtls_base64_encode(encode_buf, use_len, &use_len, der_data, in mbedtls_pem_write_buffer()