Lines Matching refs:p

175     if( !ctx->N.p || !ctx->E.p )  in mbedtls_rsa_check_pubkey()
178 if( ( ctx->N.p[0] & 1 ) == 0 || in mbedtls_rsa_check_pubkey()
179 ( ctx->E.p[0] & 1 ) == 0 ) in mbedtls_rsa_check_pubkey()
204 if( !ctx->P.p || !ctx->Q.p || !ctx->D.p ) in mbedtls_rsa_check_privkey()
330 if( ctx->Vf.p != NULL ) in rsa_prepare_blinding()
373 if( ctx->P.p == NULL || ctx->Q.p == NULL || ctx->D.p == NULL ) in mbedtls_rsa_private()
469 unsigned char *p; in mgf_mask() local
479 p = dst; in mgf_mask()
493 *p++ ^= mask[i]; in mgf_mask()
517 unsigned char *p = output; in mbedtls_rsa_rsaes_oaep_encrypt() local
541 *p++ = 0; in mbedtls_rsa_rsaes_oaep_encrypt()
544 if( ( ret = f_rng( p_rng, p, hlen ) ) != 0 ) in mbedtls_rsa_rsaes_oaep_encrypt()
547 p += hlen; in mbedtls_rsa_rsaes_oaep_encrypt()
550 mbedtls_md( md_info, label, label_len, p ); in mbedtls_rsa_rsaes_oaep_encrypt()
551 p += hlen; in mbedtls_rsa_rsaes_oaep_encrypt()
552 p += olen - 2 * hlen - 2 - ilen; in mbedtls_rsa_rsaes_oaep_encrypt()
553 *p++ = 1; in mbedtls_rsa_rsaes_oaep_encrypt()
554 memcpy( p, input, ilen ); in mbedtls_rsa_rsaes_oaep_encrypt()
592 unsigned char *p = output; in mbedtls_rsa_rsaes_pkcs1_v15_encrypt() local
609 *p++ = 0; in mbedtls_rsa_rsaes_pkcs1_v15_encrypt()
612 *p++ = MBEDTLS_RSA_CRYPT; in mbedtls_rsa_rsaes_pkcs1_v15_encrypt()
619 ret = f_rng( p_rng, p, 1 ); in mbedtls_rsa_rsaes_pkcs1_v15_encrypt()
620 } while( *p == 0 && --rng_dl && ret == 0 ); in mbedtls_rsa_rsaes_pkcs1_v15_encrypt()
626 p++; in mbedtls_rsa_rsaes_pkcs1_v15_encrypt()
631 *p++ = MBEDTLS_RSA_SIGN; in mbedtls_rsa_rsaes_pkcs1_v15_encrypt()
634 *p++ = 0xFF; in mbedtls_rsa_rsaes_pkcs1_v15_encrypt()
637 *p++ = 0; in mbedtls_rsa_rsaes_pkcs1_v15_encrypt()
638 memcpy( p, input, ilen ); in mbedtls_rsa_rsaes_pkcs1_v15_encrypt()
691 unsigned char *p, bad, pad_done; in mbedtls_rsa_rsaes_oaep_decrypt() local
756 p = buf; in mbedtls_rsa_rsaes_oaep_decrypt()
759 bad |= *p++; /* First byte must be 0 */ in mbedtls_rsa_rsaes_oaep_decrypt()
761 p += hlen; /* Skip seed */ in mbedtls_rsa_rsaes_oaep_decrypt()
765 bad |= lhash[i] ^ *p++; in mbedtls_rsa_rsaes_oaep_decrypt()
773 pad_done |= p[i]; in mbedtls_rsa_rsaes_oaep_decrypt()
777 p += pad_len; in mbedtls_rsa_rsaes_oaep_decrypt()
778 bad |= *p++ ^ 0x01; in mbedtls_rsa_rsaes_oaep_decrypt()
789 if( ilen - ( p - buf ) > output_max_len ) in mbedtls_rsa_rsaes_oaep_decrypt()
792 *olen = ilen - (p - buf); in mbedtls_rsa_rsaes_oaep_decrypt()
793 memcpy( output, p, *olen ); in mbedtls_rsa_rsaes_oaep_decrypt()
813 unsigned char *p, bad, pad_done = 0; in mbedtls_rsa_rsaes_pkcs1_v15_decrypt() local
831 p = buf; in mbedtls_rsa_rsaes_pkcs1_v15_decrypt()
837 bad |= *p++; /* First byte must be 0 */ in mbedtls_rsa_rsaes_pkcs1_v15_decrypt()
842 bad |= *p++ ^ MBEDTLS_RSA_CRYPT; in mbedtls_rsa_rsaes_pkcs1_v15_decrypt()
848 pad_done |= ((p[i] | (unsigned char)-p[i]) >> 7) ^ 1; in mbedtls_rsa_rsaes_pkcs1_v15_decrypt()
852 p += pad_count; in mbedtls_rsa_rsaes_pkcs1_v15_decrypt()
853 bad |= *p++; /* Must be zero */ in mbedtls_rsa_rsaes_pkcs1_v15_decrypt()
857 bad |= *p++ ^ MBEDTLS_RSA_SIGN; in mbedtls_rsa_rsaes_pkcs1_v15_decrypt()
863 pad_done |= ( p[i] != 0xFF ); in mbedtls_rsa_rsaes_pkcs1_v15_decrypt()
867 p += pad_count; in mbedtls_rsa_rsaes_pkcs1_v15_decrypt()
868 bad |= *p++; /* Must be zero */ in mbedtls_rsa_rsaes_pkcs1_v15_decrypt()
876 if( ilen - ( p - buf ) > output_max_len ) in mbedtls_rsa_rsaes_pkcs1_v15_decrypt()
879 *olen = ilen - (p - buf); in mbedtls_rsa_rsaes_pkcs1_v15_decrypt()
880 memcpy( output, p, *olen ); in mbedtls_rsa_rsaes_pkcs1_v15_decrypt()
931 unsigned char *p = sig; in mbedtls_rsa_rsassa_pss_sign() local
975 p += olen - hlen * 2 - 2; in mbedtls_rsa_rsassa_pss_sign()
976 *p++ = 0x01; in mbedtls_rsa_rsassa_pss_sign()
977 memcpy( p, salt, slen ); in mbedtls_rsa_rsassa_pss_sign()
978 p += slen; in mbedtls_rsa_rsassa_pss_sign()
989 mbedtls_md_update( &md_ctx, p, 8 ); in mbedtls_rsa_rsassa_pss_sign()
992 mbedtls_md_finish( &md_ctx, p ); in mbedtls_rsa_rsassa_pss_sign()
999 mgf_mask( sig + offset, olen - hlen - 1 - offset, p, hlen, &md_ctx ); in mbedtls_rsa_rsassa_pss_sign()
1006 p += hlen; in mbedtls_rsa_rsassa_pss_sign()
1007 *p++ = 0xBC; in mbedtls_rsa_rsassa_pss_sign()
1032 unsigned char *p = sig; in mbedtls_rsa_rsassa_pkcs1_v15_sign() local
1065 *p++ = 0; in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1066 *p++ = MBEDTLS_RSA_SIGN; in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1067 memset( p, 0xFF, nb_pad ); in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1068 p += nb_pad; in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1069 *p++ = 0; in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1073 memcpy( p, hash, hashlen ); in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1086 *p++ = MBEDTLS_ASN1_SEQUENCE | MBEDTLS_ASN1_CONSTRUCTED; in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1087 *p++ = (unsigned char) ( 0x08 + oid_size + hashlen ); in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1088 *p++ = MBEDTLS_ASN1_SEQUENCE | MBEDTLS_ASN1_CONSTRUCTED; in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1089 *p++ = (unsigned char) ( 0x04 + oid_size ); in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1090 *p++ = MBEDTLS_ASN1_OID; in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1091 *p++ = oid_size & 0xFF; in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1092 memcpy( p, oid, oid_size ); in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1093 p += oid_size; in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1094 *p++ = MBEDTLS_ASN1_NULL; in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1095 *p++ = 0x00; in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1096 *p++ = MBEDTLS_ASN1_OCTET_STRING; in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1097 *p++ = hashlen; in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1098 memcpy( p, hash, hashlen ); in mbedtls_rsa_rsassa_pkcs1_v15_sign()
1191 unsigned char *p; in mbedtls_rsa_rsassa_pss_verify_ext() local
1215 p = buf; in mbedtls_rsa_rsassa_pss_verify_ext()
1247 p++; in mbedtls_rsa_rsassa_pss_verify_ext()
1260 mgf_mask( p, siglen - hlen - 1, p + siglen - hlen - 1, hlen, &md_ctx ); in mbedtls_rsa_rsassa_pss_verify_ext()
1264 while( p < buf + siglen && *p == 0 ) in mbedtls_rsa_rsassa_pss_verify_ext()
1265 p++; in mbedtls_rsa_rsassa_pss_verify_ext()
1267 if( p == buf + siglen || in mbedtls_rsa_rsassa_pss_verify_ext()
1268 *p++ != 0x01 ) in mbedtls_rsa_rsassa_pss_verify_ext()
1275 slen -= p - buf; in mbedtls_rsa_rsassa_pss_verify_ext()
1290 mbedtls_md_update( &md_ctx, p, slen ); in mbedtls_rsa_rsassa_pss_verify_ext()
1295 if( memcmp( p + slen, result, hlen ) == 0 ) in mbedtls_rsa_rsassa_pss_verify_ext()
1340 unsigned char *p, *end; in mbedtls_rsa_rsassa_pkcs1_v15_verify() local
1361 p = buf; in mbedtls_rsa_rsassa_pkcs1_v15_verify()
1363 if( *p++ != 0 || *p++ != MBEDTLS_RSA_SIGN ) in mbedtls_rsa_rsassa_pkcs1_v15_verify()
1366 while( *p != 0 ) in mbedtls_rsa_rsassa_pkcs1_v15_verify()
1368 if( p >= buf + siglen - 1 || *p != 0xFF ) in mbedtls_rsa_rsassa_pkcs1_v15_verify()
1370 p++; in mbedtls_rsa_rsassa_pkcs1_v15_verify()
1372 p++; in mbedtls_rsa_rsassa_pkcs1_v15_verify()
1374 len = siglen - ( p - buf ); in mbedtls_rsa_rsassa_pkcs1_v15_verify()
1378 if( memcmp( p, hash, hashlen ) == 0 ) in mbedtls_rsa_rsassa_pkcs1_v15_verify()
1389 end = p + len; in mbedtls_rsa_rsassa_pkcs1_v15_verify()
1394 if( ( ret = mbedtls_asn1_get_tag( &p, end, &asn1_len, in mbedtls_rsa_rsassa_pkcs1_v15_verify()
1401 if( ( ret = mbedtls_asn1_get_tag( &p, end, &asn1_len, in mbedtls_rsa_rsassa_pkcs1_v15_verify()
1408 if( ( ret = mbedtls_asn1_get_tag( &p, end, &oid.len, MBEDTLS_ASN1_OID ) ) != 0 ) in mbedtls_rsa_rsassa_pkcs1_v15_verify()
1411 oid.p = p; in mbedtls_rsa_rsassa_pkcs1_v15_verify()
1412 p += oid.len; in mbedtls_rsa_rsassa_pkcs1_v15_verify()
1423 if( ( ret = mbedtls_asn1_get_tag( &p, end, &asn1_len, MBEDTLS_ASN1_NULL ) ) != 0 ) in mbedtls_rsa_rsassa_pkcs1_v15_verify()
1426 if( ( ret = mbedtls_asn1_get_tag( &p, end, &asn1_len, MBEDTLS_ASN1_OCTET_STRING ) ) != 0 ) in mbedtls_rsa_rsassa_pkcs1_v15_verify()
1432 if( memcmp( p, hash, hashlen ) != 0 ) in mbedtls_rsa_rsassa_pkcs1_v15_verify()
1435 p += hashlen; in mbedtls_rsa_rsassa_pkcs1_v15_verify()
1437 if( p != end ) in mbedtls_rsa_rsassa_pkcs1_v15_verify()