Commit 00864af0 authored by ASN.1 Documenter's avatar ASN.1 Documenter
Browse files

remove commented out code

parent cd319b09
Loading
Loading
Loading
Loading
+0 −120
Original line number Original line Diff line number Diff line
@@ -56,41 +56,7 @@ static ecc_curve_id _pk_type_to_curveid[] = {
	ecies_brainpoolp256r, //Signature_PR_ecdsaBrainpoolP256r1Signature,
	ecies_brainpoolp256r, //Signature_PR_ecdsaBrainpoolP256r1Signature,
	ecies_brainpoolp384r  //Signature_PR_ecdsaBrainpoolP384r1Signature
	ecies_brainpoolp384r  //Signature_PR_ecdsaBrainpoolP384r1Signature
};
};
/*
static const char * _pk_curve_names[] = {
	"nistp256",
	"brainpoolp256r",
	"brainpoolp384r",
	"unsupported"
};

static ecc_curve_id _pk_type_to_hashid[] = {
	0,
	sha_256,       //Signature_PR_ecdsaNistP256Signature,
	sha_256, //Signature_PR_ecdsaBrainpoolP256r1Signature,
	sha_384  //Signature_PR_ecdsaBrainpoolP384r1Signature
};


static size_t _pk_type_to_hashsize[] = {
	0,
	sha256_hash_size,       //Signature_PR_ecdsaNistP256Signature,
	sha256_hash_size, //Signature_PR_ecdsaBrainpoolP256r1Signature,
	sha384_hash_size  //Signature_PR_ecdsaBrainpoolP384r1Signature
};

static asn_dec_rval_t Signature_oer_decoder(const struct asn_codec_ctx_s *opt_codec_ctx,
	const struct asn_TYPE_descriptor_s *td, const asn_oer_constraints_t *constraints,
	void **struct_ptr, const void *buf_ptr, size_t size);
static asn_dec_rval_t EcdsaSignature_oer_decoder(const struct asn_codec_ctx_s *opt_codec_ctx,
	const struct asn_TYPE_descriptor_s *td, const asn_oer_constraints_t *constraints,
	void **struct_ptr, const void *buf_ptr, size_t size);
static asn_dec_rval_t EccCurvePoint_oer_decoder(const struct asn_codec_ctx_s *opt_codec_ctx,
	const struct asn_TYPE_descriptor_s *td, const asn_oer_constraints_t *constraints,
	void **struct_ptr, const void *buf_ptr, size_t size);
static asn_dec_rval_t PublicKey_oer_decoder(const struct asn_codec_ctx_s* opt_codec_ctx,
    const struct asn_TYPE_descriptor_s* td, const asn_oer_constraints_t* constraints,
    void** struct_ptr, const void* buf_ptr, size_t size);
*/
int main(int argc, char ** argv)
int main(int argc, char ** argv)
{
{
	//parse options
	//parse options
@@ -119,31 +85,6 @@ int main(int argc, char ** argv)
    }else{
    }else{
        _out = stdout;
        _out = stdout;
    }
    }
    /*
    static asn_TYPE_operation_t signatureOps, ecdsaSignatureOps, eccCurvePointOps,
                                verificationKeyOps, encryptionKeyOps;
    signatureOps = *asn_DEF_Signature.op;
    asn_DEF_Signature.op = &signatureOps;
 	signatureOps.oer_decoder = Signature_oer_decoder;

    ecdsaSignatureOps = *asn_DEF_EcdsaP256Signature.op;
    asn_DEF_EcdsaP256Signature.op = &ecdsaSignatureOps;
    asn_DEF_EcdsaP384Signature.op = &ecdsaSignatureOps;
	ecdsaSignatureOps.oer_decoder = EcdsaSignature_oer_decoder;

    eccCurvePointOps = *asn_DEF_EccP256CurvePoint.op;
    asn_DEF_EccP256CurvePoint.op = &eccCurvePointOps;
    asn_DEF_EccP384CurvePoint.op = &eccCurvePointOps;
    eccCurvePointOps.oer_decoder = EccCurvePoint_oer_decoder;

    verificationKeyOps = *asn_DEF_PublicVerificationKey.op;
    asn_DEF_PublicVerificationKey.op = &verificationKeyOps;
    verificationKeyOps.oer_decoder = PublicKey_oer_decoder;

    encryptionKeyOps = *asn_DEF_BasePublicEncryptionKey.op;
    asn_DEF_BasePublicEncryptionKey.op = &encryptionKeyOps;
    encryptionKeyOps.oer_decoder = PublicKey_oer_decoder;
    */


	char * buf = malloc(CERT_MAX_SIZE);
	char * buf = malloc(CERT_MAX_SIZE);
	char * ebuf;
	char * ebuf;
@@ -290,64 +231,3 @@ int process_cert(const pchar_t * name, uint8_t * buf, const uint8_t * ebuf)
    fprintf(_out, "%s %s\n", hex, name);
    fprintf(_out, "%s %s\n", hex, name);
    return 0;
    return 0;
}
}
/*
static asn_dec_rval_t Signature_oer_decoder(const struct asn_codec_ctx_s *opt_codec_ctx,
	const struct asn_TYPE_descriptor_s *td, const asn_oer_constraints_t *constraints,
	void **struct_ptr, const void *buf_ptr, size_t size)
{
    its_asn_codec_ctx_t * ctx = (its_asn_codec_ctx_t *)opt_codec_ctx;
    ctx->curve = (*((uint8_t*) buf_ptr)) - 0x80;
    return asn_OP_CHOICE.oer_decoder(opt_codec_ctx, td, constraints, struct_ptr, buf_ptr, size);
}

static asn_dec_rval_t PublicKey_oer_decoder(const struct asn_codec_ctx_s* opt_codec_ctx,
    const struct asn_TYPE_descriptor_s* td, const asn_oer_constraints_t* constraints,
    void** struct_ptr, const void* buf_ptr, size_t size)
{
    its_asn_codec_ctx_t* ctx = (its_asn_codec_ctx_t*)opt_codec_ctx;
    ctx->curve = (*((uint8_t*)buf_ptr)) - 0x80;
    return asn_OP_CHOICE.oer_decoder(opt_codec_ctx, td, constraints, struct_ptr, buf_ptr, size);
}

static asn_dec_rval_t EcdsaSignature_oer_decoder(const struct asn_codec_ctx_s *opt_codec_ctx,
	const struct asn_TYPE_descriptor_s *td, const asn_oer_constraints_t *constraints,
	void **struct_ptr, const void *buf_ptr, size_t size)
{
    uint8_t * b = (uint8_t*) buf_ptr;
    asn_dec_rval_t rc = asn_OP_SEQUENCE.oer_decoder(opt_codec_ctx, td, constraints, struct_ptr, buf_ptr, size);
    // set to x_only
    *b = 0x80;
    return rc;
}

static asn_dec_rval_t EccCurvePoint_oer_decoder(const struct asn_codec_ctx_s *opt_codec_ctx,
	const struct asn_TYPE_descriptor_s *td, const asn_oer_constraints_t *constraints,
	void **struct_ptr, const void *buf_ptr, size_t size)
{
    uint8_t * b = (uint8_t*) buf_ptr;
    asn_dec_rval_t rc = asn_OP_CHOICE.oer_decoder(opt_codec_ctx, td, constraints, struct_ptr, buf_ptr, size);
    EccP256CurvePoint_t * p = (EccP256CurvePoint_t*)*struct_ptr;
    its_asn_codec_ctx_t * ctx = (its_asn_codec_ctx_t *)opt_codec_ctx;
    size_t psize = (td == &asn_DEF_EccP256CurvePoint) ? 32 : 48;

    if(p->present == EccP256CurvePoint_PR_uncompressedP256 || p->present == EccP256CurvePoint_PR_x_only){
        void * key = ecc_key_public_set(ctx->curve, p->present-1, p->choice.uncompressedP256.x.buf, p->choice.uncompressedP256.y.buf);
        if(!key){
            rc.code = RC_FAIL;
        }else{
            int sign;
            char x[48], y[48];
            ecc_key_public(key, &x[0], &y[0], &sign);
            *b = 0x81 + (sign?1:0);
            ecc_key_free(key); 
            if(p->present == EccP256CurvePoint_PR_uncompressedP256){
                // move the rest of the buffer
                ctx->move[ctx->mcount].ptr = b + rc.consumed;
                ctx->move[ctx->mcount].shift = psize;
                ctx->mcount++;
            }
        }
    }
    return rc;
}
*/
 No newline at end of file