pk_algos, pk_algos_length,
cred->cert_list[i][0].subject_pk_algorithm)==0)
&& (cred->cert_list[i][0].cert_type ==
- _gnutls_state_cert_type_get( state))) {
+ gnutls_cert_type_get( state))) {
indx = i;
break;
}
/* put the requested DNs to req_dn, only in case
* of X509 certificates.
*/
- if ( _gnutls_state_cert_type_get(state) == GNUTLS_CRT_X509) {
+ if ( gnutls_cert_type_get(state) == GNUTLS_CRT_X509) {
data = _data;
data_size = _data_size;
count = 0; /* holds the number of given CA's DN */
*/
for (j = i = 0; i < cred->ncerts; i++) {
if ( (cred->cert_list[i][0].cert_type ==
- _gnutls_state_cert_type_get( state)) &&
+ gnutls_cert_type_get( state)) &&
(_gnutls_check_pk_algo_in_list( pk_algos,
pk_algos_length,
cred->cert_list[i][0].subject_pk_algorithm)==0)) {
return GNUTLS_E_INSUFICIENT_CRED;
}
- size = CERTTYPE_SIZE + 2; /* 2 for CertType + 2 for size of rdn_seq
+ size = CERTTYPE_SIZE + 2; /* 2 for CertificateType + 2 for size of rdn_seq
*/
size += cred->x509_rdn_sequence.size;
requested_algo==cred->cert_list[i][0].subject_pk_algorithm) {
/* if cert type matches */
- if ( _gnutls_state_cert_type_get( state) ==
+ if ( gnutls_cert_type_get( state) ==
cred->cert_list[i][0].cert_type) {
index = i;
requested_algo==cred->cert_list[i][0].subject_pk_algorithm) {
/* if cert type matches */
- if ( _gnutls_state_cert_type_get( state) ==
+ if ( gnutls_cert_type_get( state) ==
cred->cert_list[i][0].cert_type) {
ij_map[j] = i;
typedef enum GNUTLS_Version { GNUTLS_SSL3=1, GNUTLS_TLS1 } GNUTLS_Version;
+typedef enum GNUTLS_CertificateType { GNUTLS_CRT_X509=1, GNUTLS_CRT_OPENPGP
+} GNUTLS_CertificateType;
+
+
/* If you want to change this, then also change the
* define in gnutls_int.h, and recompile.
*/
int gnutls_alert_send_appropriate( GNUTLS_STATE state, int err);
/* get information on the current state */
-GNUTLS_BulkCipherAlgorithm gnutls_cipher_get( GNUTLS_STATE state);
-GNUTLS_KXAlgorithm gnutls_kx_get( GNUTLS_STATE state);
-GNUTLS_MACAlgorithm gnutls_mac_get( GNUTLS_STATE state);
-GNUTLS_CompressionMethod gnutls_compression_get( GNUTLS_STATE state);
+GNUTLS_BulkCipherAlgorithm gnutls_cipher_get( GNUTLS_STATE state);
+GNUTLS_KXAlgorithm gnutls_kx_get( GNUTLS_STATE state);
+GNUTLS_MACAlgorithm gnutls_mac_get( GNUTLS_STATE state);
+GNUTLS_CompressionMethod gnutls_compression_get( GNUTLS_STATE state);
+GNUTLS_CertificateType gnutls_cert_type_get( GNUTLS_STATE state);
/* the name of the specified algorithms */
const char *gnutls_cipher_get_name( GNUTLS_BulkCipherAlgorithm);
/* holds the type (PGP, X509)
*/
- CertType cert_type;
+ CertificateType cert_type;
gnutls_datum raw; /* the raw certificate */
} gnutls_cert;
} KXAlgorithm;
#define GNUTLS_KXAlgorithm KXAlgorithm
-typedef enum CertType { GNUTLS_CRT_X509=1, GNUTLS_CRT_OPENPGP
-} CertType;
-#define GNUTLS_CertType CertType
+typedef enum CertificateType { GNUTLS_CRT_X509=1, GNUTLS_CRT_OPENPGP
+} CertificateType;
+#define GNUTLS_CertificateType CertificateType
typedef enum CredType { GNUTLS_CRD_CERTIFICATE=1, GNUTLS_CRD_ANON, GNUTLS_CRD_SRP
} CredType;
TLSExtensions extensions;
uint16 max_record_size;
/* holds the negotiated certificate type */
- CertType cert_type;
+ CertificateType cert_type;
GNUTLS_Version version; /* moved here */
} SecurityParameters;
return ret;
}
-/**
- * gnutls_cipher_get - Returns the currently used cipher.
- * @state: is a &GNUTLS_STATE structure.
- *
- * Returns the currently used cipher.
- **/
-GNUTLS_BulkCipherAlgorithm gnutls_cipher_get( GNUTLS_STATE state) {
- return state->security_parameters.read_bulk_cipher_algorithm;
-}
-
-/**
- * gnutls_kx_get - Returns the key exchange algorithm.
- * @state: is a &GNUTLS_STATE structure.
- *
- * Returns the key exchange algorithm used in the last handshake.
- **/
-GNUTLS_KXAlgorithm gnutls_kx_get( GNUTLS_STATE state) {
- return state->security_parameters.kx_algorithm;
-}
-
-/**
- * gnutls_mac_get - Returns the currently used mac algorithm.
- * @state: is a &GNUTLS_STATE structure.
- *
- * Returns the currently used mac algorithm.
- **/
-GNUTLS_MACAlgorithm gnutls_mac_get( GNUTLS_STATE state) {
- return state->security_parameters.read_mac_algorithm;
-}
-
-/**
- * gnutls_compression_get - Returns the currently used compression algorithm.
- * @state: is a &GNUTLS_STATE structure.
- *
- * Returns the currently used compression method.
- **/
-GNUTLS_CompressionMethod gnutls_compression_get( GNUTLS_STATE state) {
- return state->security_parameters.read_compression_algorithm;
-}
/* Taken from libgcrypt */
-KXAlgorithm gnutls_kx_get( GNUTLS_STATE state);
ssize_t gnutls_send_int( GNUTLS_STATE state, ContentType type, HandshakeType htype, const void* data, size_t sizeofdata);
ssize_t gnutls_recv_int( GNUTLS_STATE state, ContentType type, HandshakeType, char* data, size_t sizeofdata);
ssize_t _gnutls_send_change_cipher_spec( GNUTLS_STATE state, int again);
*/
#include <gnutls_int.h>
+#include <gnutls_errors.h>
+#include <gnutls_auth_int.h>
-CertType _gnutls_state_cert_type_get( GNUTLS_STATE state) {
+#define CHECK_AUTH(auth, ret) if (gnutls_auth_get_type(state) != auth) { \
+ gnutls_assert(); \
+ return ret; \
+ }
+
+void _gnutls_state_cert_type_set( GNUTLS_STATE state, CertificateType ct) {
+ state->security_parameters.cert_type = ct;
+}
+
+/**
+ * gnutls_cipher_get - Returns the currently used cipher.
+ * @state: is a &GNUTLS_STATE structure.
+ *
+ * Returns the currently used cipher.
+ **/
+GNUTLS_BulkCipherAlgorithm gnutls_cipher_get( GNUTLS_STATE state) {
+ return state->security_parameters.read_bulk_cipher_algorithm;
+}
+
+/**
+ * gnutls_cert_type_get - Returns the currently used certificate type.
+ * @state: is a &GNUTLS_STATE structure.
+ *
+ * Returns the currently used certificate type. The certificate type
+ * is by default X.509, unless it is negotiated as a TLS extension.
+ *
+ **/
+GNUTLS_CertificateType gnutls_cert_type_get( GNUTLS_STATE state) {
return state->security_parameters.cert_type;
}
-void _gnutls_state_cert_type_set( GNUTLS_STATE state, CertType ct) {
- state->security_parameters.cert_type = ct;
+/**
+ * gnutls_kx_get - Returns the key exchange algorithm.
+ * @state: is a &GNUTLS_STATE structure.
+ *
+ * Returns the key exchange algorithm used in the last handshake.
+ **/
+GNUTLS_KXAlgorithm gnutls_kx_get( GNUTLS_STATE state) {
+ return state->security_parameters.kx_algorithm;
+}
+
+/**
+ * gnutls_mac_get - Returns the currently used mac algorithm.
+ * @state: is a &GNUTLS_STATE structure.
+ *
+ * Returns the currently used mac algorithm.
+ **/
+GNUTLS_MACAlgorithm gnutls_mac_get( GNUTLS_STATE state) {
+ return state->security_parameters.read_mac_algorithm;
+}
+
+/**
+ * gnutls_compression_get - Returns the currently used compression algorithm.
+ * @state: is a &GNUTLS_STATE structure.
+ *
+ * Returns the currently used compression method.
+ **/
+GNUTLS_CompressionMethod gnutls_compression_get( GNUTLS_STATE state) {
+ return state->security_parameters.read_compression_algorithm;
}
#include <gnutls_int.h>
-CertType _gnutls_state_cert_type_get( GNUTLS_STATE state);
-void _gnutls_state_cert_type_set( GNUTLS_STATE state, CertType);
+void _gnutls_state_cert_type_set( GNUTLS_STATE state, CertificateType);
+KXAlgorithm gnutls_kx_get( GNUTLS_STATE state);
+CertificateType gnutls_cert_type_get( GNUTLS_STATE state);
#endif