@@ -25,27 +25,6 @@ enum public_key_type {
25
25
26
26
int rand_prime (void * N , long len , prng_state * prng , int wprng );
27
27
28
- #ifdef LTC_SOURCE
29
- /* internal helper functions */
30
- int rand_bn_bits (void * N , int bits , prng_state * prng , int wprng );
31
- int rand_bn_upto (void * N , void * limit , prng_state * prng , int wprng );
32
-
33
- enum public_key_algorithms {
34
- PKA_RSA ,
35
- PKA_DSA
36
- };
37
-
38
- typedef struct Oid {
39
- unsigned long OID [16 ];
40
- /** Number of OID digits in use */
41
- unsigned long OIDlen ;
42
- } oid_st ;
43
-
44
- int pk_get_oid (int pk , oid_st * st );
45
- int pk_oid_str_to_num (const char * OID , unsigned long * oid , unsigned long * oidlen );
46
- int pk_oid_num_to_str (const unsigned long * oid , unsigned long oidlen , char * OID , unsigned long * outlen );
47
- #endif /* LTC_SOURCE */
48
-
49
28
/* ---- RSA ---- */
50
29
#ifdef LTC_MRSA
51
30
@@ -233,19 +212,6 @@ int dh_shared_secret(const dh_key *private_key, const dh_key *public_key,
233
212
void dh_free (dh_key * key );
234
213
235
214
int dh_export_key (void * out , unsigned long * outlen , int type , const dh_key * key );
236
-
237
- #ifdef LTC_SOURCE
238
- typedef struct {
239
- int size ;
240
- const char * name , * base , * prime ;
241
- } ltc_dh_set_type ;
242
-
243
- extern const ltc_dh_set_type ltc_dh_sets [];
244
-
245
- /* internal helper functions */
246
- int dh_check_pubkey (const dh_key * key );
247
- #endif
248
-
249
215
#endif /* LTC_MDH */
250
216
251
217
@@ -387,76 +353,6 @@ int ecc_verify_hash(const unsigned char *sig, unsigned long siglen,
387
353
const unsigned char * hash , unsigned long hashlen ,
388
354
int * stat , const ecc_key * key );
389
355
390
-
391
- #ifdef LTC_SOURCE
392
- /* INTERNAL ONLY - it should be later moved to src/headers/tomcrypt_internal.h */
393
-
394
- int ecc_set_dp_from_mpis (void * a , void * b , void * prime , void * order , void * gx , void * gy , unsigned long cofactor , ecc_key * key );
395
- int ecc_copy_dp (const ecc_key * srckey , ecc_key * key );
396
- int ecc_set_dp_by_size (int size , ecc_key * key );
397
-
398
- /* low level functions */
399
- ecc_point * ltc_ecc_new_point (void );
400
- void ltc_ecc_del_point (ecc_point * p );
401
- int ltc_ecc_set_point_xyz (ltc_mp_digit x , ltc_mp_digit y , ltc_mp_digit z , ecc_point * p );
402
- int ltc_ecc_copy_point (const ecc_point * src , ecc_point * dst );
403
- int ltc_ecc_is_point (const ltc_ecc_dp * dp , void * x , void * y );
404
- int ltc_ecc_is_point_at_infinity (const ecc_point * P , void * modulus , int * retval );
405
- int ltc_ecc_import_point (const unsigned char * in , unsigned long inlen , void * prime , void * a , void * b , void * x , void * y );
406
- int ltc_ecc_export_point (unsigned char * out , unsigned long * outlen , void * x , void * y , unsigned long size , int compressed );
407
- int ltc_ecc_verify_key (const ecc_key * key );
408
-
409
- /* point ops (mp == montgomery digit) */
410
- #if !defined(LTC_MECC_ACCEL ) || defined(LTM_DESC ) || defined(GMP_DESC )
411
- /* R = 2P */
412
- int ltc_ecc_projective_dbl_point (const ecc_point * P , ecc_point * R , void * ma , void * modulus , void * mp );
413
-
414
- /* R = P + Q */
415
- int ltc_ecc_projective_add_point (const ecc_point * P , const ecc_point * Q , ecc_point * R , void * ma , void * modulus , void * mp );
416
- #endif
417
-
418
- #if defined(LTC_MECC_FP )
419
- /* optimized point multiplication using fixed point cache (HAC algorithm 14.117) */
420
- int ltc_ecc_fp_mulmod (void * k , ecc_point * G , ecc_point * R , void * a , void * modulus , int map );
421
-
422
- /* functions for saving/loading/freeing/adding to fixed point cache */
423
- int ltc_ecc_fp_save_state (unsigned char * * out , unsigned long * outlen );
424
- int ltc_ecc_fp_restore_state (unsigned char * in , unsigned long inlen );
425
- void ltc_ecc_fp_free (void );
426
- int ltc_ecc_fp_add_point (ecc_point * g , void * modulus , int lock );
427
-
428
- /* lock/unlock all points currently in fixed point cache */
429
- void ltc_ecc_fp_tablelock (int lock );
430
- #endif
431
-
432
- /* R = kG */
433
- int ltc_ecc_mulmod (void * k , const ecc_point * G , ecc_point * R , void * a , void * modulus , int map );
434
-
435
- #ifdef LTC_ECC_SHAMIR
436
- /* kA*A + kB*B = C */
437
- int ltc_ecc_mul2add (const ecc_point * A , void * kA ,
438
- const ecc_point * B , void * kB ,
439
- ecc_point * C ,
440
- void * ma ,
441
- void * modulus );
442
-
443
- #ifdef LTC_MECC_FP
444
- /* Shamir's trick with optimized point multiplication using fixed point cache */
445
- int ltc_ecc_fp_mul2add (const ecc_point * A , void * kA ,
446
- const ecc_point * B , void * kB ,
447
- ecc_point * C ,
448
- void * ma ,
449
- void * modulus );
450
- #endif
451
-
452
- #endif
453
-
454
-
455
- /* map P to affine from projective */
456
- int ltc_ecc_map (ecc_point * P , void * modulus , void * mp );
457
-
458
- #endif /* LTC_SOURCE */
459
-
460
356
#endif
461
357
462
358
#ifdef LTC_MDSA
@@ -533,16 +429,10 @@ int dsa_decrypt_key(const unsigned char *in, unsigned long inlen,
533
429
int dsa_import (const unsigned char * in , unsigned long inlen , dsa_key * key );
534
430
int dsa_export (unsigned char * out , unsigned long * outlen , int type , const dsa_key * key );
535
431
int dsa_verify_key (const dsa_key * key , int * stat );
536
- #ifdef LTC_SOURCE
537
- /* internal helper functions */
538
- int dsa_int_validate_xy (const dsa_key * key , int * stat );
539
- int dsa_int_validate_pqg (const dsa_key * key , int * stat );
540
- int dsa_int_validate_primes (const dsa_key * key , int * stat );
541
- #endif
542
432
int dsa_shared_secret (void * private_key , void * base ,
543
433
const dsa_key * public_key ,
544
434
unsigned char * out , unsigned long * outlen );
545
- #endif
435
+ #endif /* LTC_MDSA */
546
436
547
437
#ifdef LTC_DER
548
438
/* DER handling */
@@ -705,30 +595,6 @@ int der_length_custom_type(const ltc_asn1_list *root,
705
595
unsigned long * outlen ,
706
596
unsigned long * payloadlen );
707
597
708
- #ifdef LTC_SOURCE
709
- /* internal helper functions */
710
- int der_decode_custom_type_ex (const unsigned char * in , unsigned long inlen ,
711
- ltc_asn1_list * root ,
712
- ltc_asn1_list * list , unsigned long outlen , unsigned int flags );
713
-
714
- int der_encode_asn1_identifier (const ltc_asn1_list * id , unsigned char * out , unsigned long * outlen );
715
- int der_decode_asn1_identifier (const unsigned char * in , unsigned long * inlen , ltc_asn1_list * id );
716
- int der_length_asn1_identifier (const ltc_asn1_list * id , unsigned long * idlen );
717
-
718
- int der_encode_asn1_length (unsigned long len , unsigned char * out , unsigned long * outlen );
719
- int der_decode_asn1_length (const unsigned char * len , unsigned long * lenlen , unsigned long * outlen );
720
- int der_length_asn1_length (unsigned long len , unsigned long * outlen );
721
-
722
- int der_length_sequence_ex (const ltc_asn1_list * list , unsigned long inlen ,
723
- unsigned long * outlen , unsigned long * payloadlen );
724
-
725
- extern const ltc_asn1_type der_asn1_tag_to_type_map [];
726
- extern const unsigned long der_asn1_tag_to_type_map_sz ;
727
-
728
- extern const int der_asn1_type_to_identifier_map [];
729
- extern const unsigned long der_asn1_type_to_identifier_map_sz ;
730
- #endif /* LTC_SOURCE */
731
-
732
598
/* SET */
733
599
#define der_decode_set (in , inlen , list , outlen ) der_decode_sequence_ex(in, inlen, list, outlen, LTC_DER_SEQ_SET)
734
600
#define der_length_set der_length_sequence
@@ -741,10 +607,6 @@ int der_encode_setof(const ltc_asn1_list *list, unsigned long inlen,
741
607
/* VA list handy helpers with triplets of <type, size, data> */
742
608
int der_encode_sequence_multi (unsigned char * out , unsigned long * outlen , ...);
743
609
int der_decode_sequence_multi (const unsigned char * in , unsigned long inlen , ...);
744
- #ifdef LTC_SOURCE
745
- /* internal helper functions */
746
- int der_decode_sequence_multi_ex (const unsigned char * in , unsigned long inlen , unsigned int flags , ...);
747
- #endif /* LTC_SOURCE */
748
610
749
611
/* FLEXI DECODER handle unknown list decoder */
750
612
int der_decode_sequence_flexi (const unsigned char * in , unsigned long * inlen , ltc_asn1_list * * out );
@@ -809,13 +671,6 @@ int der_decode_teletex_string(const unsigned char *in, unsigned long inlen,
809
671
unsigned char * out , unsigned long * outlen );
810
672
int der_length_teletex_string (const unsigned char * octets , unsigned long noctets , unsigned long * outlen );
811
673
812
- #ifdef LTC_SOURCE
813
- /* internal helper functions */
814
- int der_teletex_char_encode (int c );
815
- int der_teletex_value_decode (int v );
816
- #endif /* LTC_SOURCE */
817
-
818
-
819
674
/* PRINTABLE STRING */
820
675
int der_encode_printable_string (const unsigned char * in , unsigned long inlen ,
821
676
unsigned char * out , unsigned long * outlen );
@@ -846,10 +701,6 @@ int der_encode_utf8_string(const wchar_t *in, unsigned long inlen,
846
701
int der_decode_utf8_string (const unsigned char * in , unsigned long inlen ,
847
702
wchar_t * out , unsigned long * outlen );
848
703
unsigned long der_utf8_charsize (const wchar_t c );
849
- #ifdef LTC_SOURCE
850
- /* internal helper functions */
851
- int der_utf8_valid_char (const wchar_t c );
852
- #endif /* LTC_SOURCE */
853
704
int der_length_utf8_string (const wchar_t * in , unsigned long noctets , unsigned long * outlen );
854
705
855
706
@@ -900,18 +751,6 @@ int der_decode_generalizedtime(const unsigned char *in, unsigned long *inlen,
900
751
901
752
int der_length_generalizedtime (const ltc_generalizedtime * gtime , unsigned long * outlen );
902
753
903
- #ifdef LTC_SOURCE
904
- /* internal helper functions */
905
- /* SUBJECT PUBLIC KEY INFO */
906
- int x509_encode_subject_public_key_info (unsigned char * out , unsigned long * outlen ,
907
- unsigned int algorithm , const void * public_key , unsigned long public_key_len ,
908
- ltc_asn1_type parameters_type , ltc_asn1_list * parameters , unsigned long parameters_len );
909
-
910
- int x509_decode_subject_public_key_info (const unsigned char * in , unsigned long inlen ,
911
- unsigned int algorithm , void * public_key , unsigned long * public_key_len ,
912
- ltc_asn1_type parameters_type , ltc_asn1_list * parameters , unsigned long * parameters_len );
913
- #endif /* LTC_SOURCE */
914
-
915
754
#endif
916
755
917
756
/* ref: $Format:%D$ */
0 commit comments