Also add some secret key encryption types to the supported list.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@20750 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
		| @@ -1424,6 +1424,11 @@ const AlgorithmIdentifier _hx509_des_rsdi_ede3_cbc_oid = { | |||||||
|     { 6, rk_UNCONST(des_rsdi_ede3_cbc_oid) }, NULL |     { 6, rk_UNCONST(des_rsdi_ede3_cbc_oid) }, NULL | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | static const unsigned aes128_cbc_oid[] ={ 2, 16, 840, 1, 101, 3, 4, 1, 2 }; | ||||||
|  | const AlgorithmIdentifier _hx509_crypto_aes128_cbc_data = { | ||||||
|  |     { 9, rk_UNCONST(aes128_cbc_oid) }, NULL | ||||||
|  | }; | ||||||
|  |  | ||||||
| static const unsigned aes256_cbc_oid[] ={ 2, 16, 840, 1, 101, 3, 4, 1, 42 }; | static const unsigned aes256_cbc_oid[] ={ 2, 16, 840, 1, 101, 3, 4, 1, 42 }; | ||||||
| const AlgorithmIdentifier _hx509_crypto_aes256_cbc_data = { | const AlgorithmIdentifier _hx509_crypto_aes256_cbc_data = { | ||||||
|     { 9, rk_UNCONST(aes256_cbc_oid) }, NULL |     { 9, rk_UNCONST(aes256_cbc_oid) }, NULL | ||||||
| @@ -1485,6 +1490,10 @@ const AlgorithmIdentifier * | |||||||
| hx509_crypto_des_rsdi_ede3_cbc(void) | hx509_crypto_des_rsdi_ede3_cbc(void) | ||||||
| { return &_hx509_des_rsdi_ede3_cbc_oid; } | { return &_hx509_des_rsdi_ede3_cbc_oid; } | ||||||
|  |  | ||||||
|  | const AlgorithmIdentifier * | ||||||
|  | hx509_crypto_aes128_cbc(void) | ||||||
|  | { return &_hx509_crypto_aes128_cbc_data; } | ||||||
|  |  | ||||||
| const AlgorithmIdentifier * | const AlgorithmIdentifier * | ||||||
| hx509_crypto_aes256_cbc(void) | hx509_crypto_aes256_cbc(void) | ||||||
| { return &_hx509_crypto_aes256_cbc_data; } | { return &_hx509_crypto_aes256_cbc_data; } | ||||||
| @@ -1796,7 +1805,7 @@ static const struct hx509cipher ciphers[] = { | |||||||
|     { |     { | ||||||
| 	"aes-128-cbc", | 	"aes-128-cbc", | ||||||
| 	oid_id_aes_128_cbc, | 	oid_id_aes_128_cbc, | ||||||
| 	NULL, | 	hx509_crypto_aes128_cbc, | ||||||
| 	EVP_aes_128_cbc, | 	EVP_aes_128_cbc, | ||||||
| 	CMSCBCParam_get, | 	CMSCBCParam_get, | ||||||
| 	CMSCBCParam_set | 	CMSCBCParam_set | ||||||
| @@ -2506,7 +2515,7 @@ hx509_crypto_available(hx509_context context, | |||||||
|     *val = NULL; |     *val = NULL; | ||||||
|  |  | ||||||
|     if (type == HX509_SELECT_ALL) { |     if (type == HX509_SELECT_ALL) { | ||||||
| 	bits = SIG_DIGEST | SIG_PUBLIC_SIG; | 	bits = SIG_DIGEST | SIG_PUBLIC_SIG | SIG_SECRET; | ||||||
|     } else if (type == HX509_SELECT_DIGEST) { |     } else if (type == HX509_SELECT_DIGEST) { | ||||||
| 	bits = SIG_DIGEST; | 	bits = SIG_DIGEST; | ||||||
|     } else if (type == HX509_SELECT_PUBLIC_SIG) { |     } else if (type == HX509_SELECT_PUBLIC_SIG) { | ||||||
| @@ -2542,6 +2551,26 @@ hx509_crypto_available(hx509_context context, | |||||||
| 	len++; | 	len++; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /* Add AES */ | ||||||
|  |     if (bits & SIG_SECRET) { | ||||||
|  |  | ||||||
|  | 	for (i = 0; i < sizeof(ciphers)/sizeof(ciphers[0]); i++) { | ||||||
|  | 	 | ||||||
|  | 	    if (ciphers[i].ai_func == NULL) | ||||||
|  | 		continue; | ||||||
|  |  | ||||||
|  | 	    ptr = realloc(*val, sizeof(**val) * (len + 1)); | ||||||
|  | 	    if (ptr == NULL) | ||||||
|  | 		goto out; | ||||||
|  | 	    *val = ptr; | ||||||
|  | 	     | ||||||
|  | 	    ret = copy_AlgorithmIdentifier((ciphers[i].ai_func)(), &(*val)[len]); | ||||||
|  | 	    if (ret) | ||||||
|  | 		goto out; | ||||||
|  | 	    len++; | ||||||
|  | 	} | ||||||
|  |     } | ||||||
|  |  | ||||||
|     *plen = len; |     *plen = len; | ||||||
|     return 0; |     return 0; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Love Hörnquist Åstrand
					Love Hörnquist Åstrand