comparison keyimport.c @ 1400:238a439670f5 coverity

merge
author Matt Johnston <matt@ucc.asn.au>
date Sat, 03 Jun 2017 00:10:58 +0800
parents 77c0d57a4410
children 06d52bcb8094
comparison
equal deleted inserted replaced
1344:b90da477ab63 1400:238a439670f5
692 /* privateKey OCTET STRING, */ 692 /* privateKey OCTET STRING, */
693 ret = ber_read_id_len(p, key->keyblob+key->keyblob_len-p, 693 ret = ber_read_id_len(p, key->keyblob+key->keyblob_len-p,
694 &id, &len, &flags); 694 &id, &len, &flags);
695 p += ret; 695 p += ret;
696 /* id==4 for octet string */ 696 /* id==4 for octet string */
697 if (ret < 0 || id != 4 || len < 0 || 697 if (ret < 0 || id != 4 || len < 0 ||
698 key->keyblob+key->keyblob_len-p < len) { 698 key->keyblob+key->keyblob_len-p < len) {
699 errmsg = "ASN.1 decoding failure"; 699 errmsg = "ASN.1 decoding failure";
700 goto error; 700 goto error;
701 } 701 }
702 private_key_bytes = p; 702 private_key_bytes = p;
706 /* parameters [0] ECDomainParameters {{ SECGCurveNames }} OPTIONAL, */ 706 /* parameters [0] ECDomainParameters {{ SECGCurveNames }} OPTIONAL, */
707 ret = ber_read_id_len(p, key->keyblob+key->keyblob_len-p, 707 ret = ber_read_id_len(p, key->keyblob+key->keyblob_len-p,
708 &id, &len, &flags); 708 &id, &len, &flags);
709 p += ret; 709 p += ret;
710 /* id==0 */ 710 /* id==0 */
711 if (ret < 0 || id != 0 || len < 0) { 711 if (ret < 0 || id != 0 || len < 0) {
712 errmsg = "ASN.1 decoding failure"; 712 errmsg = "ASN.1 decoding failure";
713 goto error; 713 goto error;
714 } 714 }
715 715
716 ret = ber_read_id_len(p, key->keyblob+key->keyblob_len-p, 716 ret = ber_read_id_len(p, key->keyblob+key->keyblob_len-p,
717 &id, &len, &flags); 717 &id, &len, &flags);
718 p += ret; 718 p += ret;
719 /* id==6 for object */ 719 /* id==6 for object */
720 if (ret < 0 || id != 6 || len < 0 || 720 if (ret < 0 || id != 6 || len < 0 ||
721 key->keyblob+key->keyblob_len-p < len) { 721 key->keyblob+key->keyblob_len-p < len) {
722 errmsg = "ASN.1 decoding failure"; 722 errmsg = "ASN.1 decoding failure";
723 goto error; 723 goto error;
724 } 724 }
725 725
754 /* publicKey [1] BIT STRING OPTIONAL */ 754 /* publicKey [1] BIT STRING OPTIONAL */
755 ret = ber_read_id_len(p, key->keyblob+key->keyblob_len-p, 755 ret = ber_read_id_len(p, key->keyblob+key->keyblob_len-p,
756 &id, &len, &flags); 756 &id, &len, &flags);
757 p += ret; 757 p += ret;
758 /* id==1 */ 758 /* id==1 */
759 if (ret < 0 || id != 1 || len < 0) { 759 if (ret < 0 || id != 1 || len < 0) {
760 errmsg = "ASN.1 decoding failure"; 760 errmsg = "ASN.1 decoding failure";
761 goto error; 761 goto error;
762 } 762 }
763 763
764 ret = ber_read_id_len(p, key->keyblob+key->keyblob_len-p, 764 ret = ber_read_id_len(p, key->keyblob+key->keyblob_len-p,
765 &id, &len, &flags); 765 &id, &len, &flags);
766 p += ret; 766 p += ret;
767 /* id==3 for bit string */ 767 /* id==3 for bit string */
768 if (ret < 0 || id != 3 || len < 0 || 768 if (ret < 0 || id != 3 || len < 0 ||
769 key->keyblob+key->keyblob_len-p < len) { 769 key->keyblob+key->keyblob_len-p < len) {
770 errmsg = "ASN.1 decoding failure"; 770 errmsg = "ASN.1 decoding failure";
771 goto error; 771 goto error;
772 } 772 }
773 public_key_bytes = p+1; 773 public_key_bytes = p+1;