#[repr(C)]
#[derive(Default)]
pub struct __IncompleteArrayField<T>(::core::marker::PhantomData<T>, [T; 0]);
impl<T> __IncompleteArrayField<T> {
#[inline]
pub const fn new() -> Self {
__IncompleteArrayField(::core::marker::PhantomData, [])
}
#[inline]
pub fn as_ptr(&self) -> *const T {
self as *const _ as *const T
}
#[inline]
pub fn as_mut_ptr(&mut self) -> *mut T {
self as *mut _ as *mut T
}
#[inline]
pub unsafe fn as_slice(&self, len: usize) -> &[T] {
::core::slice::from_raw_parts(self.as_ptr(), len)
}
#[inline]
pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
::core::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
}
}
impl<T> ::core::fmt::Debug for __IncompleteArrayField<T> {
fn fmt(&self, fmt: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
fmt.write_str("__IncompleteArrayField")
}
}
pub const NRF_MODEM_MAX_SHMEM_SIZE: u32 = 131072;
pub const NRF_MODEM_DFU_RESULT_OK: u32 = 89128961;
pub const NRF_MODEM_DFU_RESULT_INTERNAL_ERROR: u32 = 71303169;
pub const NRF_MODEM_DFU_RESULT_HARDWARE_ERROR: u32 = 71303170;
pub const NRF_MODEM_DFU_RESULT_AUTH_ERROR: u32 = 71303171;
pub const NRF_MODEM_DFU_RESULT_UUID_ERROR: u32 = 71303172;
pub const NRF_MODEM_DFU_RESULT_VOLTAGE_LOW: u32 = 71303173;
pub const NRF_MODEM_SHMEM_CTRL_SIZE: u32 = 1256;
pub const NRF_MODEM_SHMEM_BOOTLOADER_SIZE: u32 = 8220;
pub const NRF_MODEM_FAULT_UNDEFINED: u32 = 1;
pub const NRF_MODEM_FAULT_HW_WD_RESET: u32 = 2;
pub const NRF_MODEM_FAULT_HARDFAULT: u32 = 3;
pub const NRF_MODEM_FAULT_MEM_MANAGE: u32 = 4;
pub const NRF_MODEM_FAULT_BUS: u32 = 5;
pub const NRF_MODEM_FAULT_USAGE: u32 = 6;
pub const NRF_MODEM_FAULT_SECURE_RESET: u32 = 7;
pub const NRF_MODEM_FAULT_PANIC_DOUBLE: u32 = 8;
pub const NRF_MODEM_FAULT_PANIC_RESET_LOOP: u32 = 9;
pub const NRF_MODEM_FAULT_ASSERT: u32 = 16;
pub const NRF_MODEM_FAULT_PANIC: u32 = 17;
pub const NRF_MODEM_FAULT_FLASH_ERASE: u32 = 18;
pub const NRF_MODEM_FAULT_FLASH_WRITE: u32 = 19;
pub const NRF_MODEM_FAULT_POFWARN: u32 = 20;
pub const NRF_MODEM_FAULT_THWARN: u32 = 21;
pub const NRF_MODEM_OS_NO_WAIT: u32 = 0;
pub const NRF_MODEM_OS_FOREVER: i32 = -1;
pub const NRF_MODEM_OS_NUM_SEM_REQUIRED: u32 = 7;
pub const NRF_EPERM: u32 = 1;
pub const NRF_ENOENT: u32 = 2;
pub const NRF_ESRCH: u32 = 3;
pub const NRF_EINTR: u32 = 4;
pub const NRF_EIO: u32 = 5;
pub const NRF_ENXIO: u32 = 6;
pub const NRF_E2BIG: u32 = 7;
pub const NRF_ENOEXEC: u32 = 8;
pub const NRF_EBADF: u32 = 9;
pub const NRF_ECHILD: u32 = 10;
pub const NRF_EAGAIN: u32 = 11;
pub const NRF_ENOMEM: u32 = 12;
pub const NRF_EACCES: u32 = 13;
pub const NRF_EFAULT: u32 = 14;
pub const NRF_EBUSY: u32 = 16;
pub const NRF_EEXIST: u32 = 17;
pub const NRF_EXDEV: u32 = 18;
pub const NRF_ENODEV: u32 = 19;
pub const NRF_ENOTDIR: u32 = 20;
pub const NRF_EISDIR: u32 = 21;
pub const NRF_EINVAL: u32 = 22;
pub const NRF_ENFILE: u32 = 23;
pub const NRF_EMFILE: u32 = 24;
pub const NRF_ENOTTY: u32 = 25;
pub const NRF_ETXTBSY: u32 = 26;
pub const NRF_EFBIG: u32 = 27;
pub const NRF_ENOSPC: u32 = 28;
pub const NRF_ESPIPE: u32 = 29;
pub const NRF_EROFS: u32 = 30;
pub const NRF_EMLINK: u32 = 31;
pub const NRF_EPIPE: u32 = 32;
pub const NRF_EDOM: u32 = 33;
pub const NRF_ERANGE: u32 = 34;
pub const NRF_ENOMSG: u32 = 35;
pub const NRF_EDEADLK: u32 = 45;
pub const NRF_ENOLCK: u32 = 46;
pub const NRF_ENOSTR: u32 = 60;
pub const NRF_ENODATA: u32 = 61;
pub const NRF_ETIME: u32 = 62;
pub const NRF_ENOSR: u32 = 63;
pub const NRF_EPROTO: u32 = 71;
pub const NRF_EBADMSG: u32 = 77;
pub const NRF_ENOSYS: u32 = 88;
pub const NRF_ENOTEMPTY: u32 = 90;
pub const NRF_ENAMETOOLONG: u32 = 91;
pub const NRF_ELOOP: u32 = 92;
pub const NRF_EOPNOTSUPP: u32 = 95;
pub const NRF_ECONNRESET: u32 = 104;
pub const NRF_ENOBUFS: u32 = 105;
pub const NRF_EAFNOSUPPORT: u32 = 106;
pub const NRF_EPROTOTYPE: u32 = 107;
pub const NRF_ENOTSOCK: u32 = 108;
pub const NRF_ENOPROTOOPT: u32 = 109;
pub const NRF_ECONNREFUSED: u32 = 111;
pub const NRF_EADDRINUSE: u32 = 112;
pub const NRF_ECONNABORTED: u32 = 113;
pub const NRF_ENETUNREACH: u32 = 114;
pub const NRF_ENETDOWN: u32 = 115;
pub const NRF_ETIMEDOUT: u32 = 116;
pub const NRF_EHOSTUNREACH: u32 = 118;
pub const NRF_EINPROGRESS: u32 = 119;
pub const NRF_EALREADY: u32 = 120;
pub const NRF_EDESTADDRREQ: u32 = 121;
pub const NRF_EMSGSIZE: u32 = 122;
pub const NRF_EPROTONOSUPPORT: u32 = 123;
pub const NRF_EADDRNOTAVAIL: u32 = 125;
pub const NRF_ENETRESET: u32 = 126;
pub const NRF_EISCONN: u32 = 127;
pub const NRF_ENOTCONN: u32 = 128;
pub const NRF_ENOTSUP: u32 = 134;
pub const NRF_EILSEQ: u32 = 138;
pub const NRF_EOVERFLOW: u32 = 139;
pub const NRF_ECANCELED: u32 = 140;
pub const NRF_EWOULDBLOCK: u32 = 11;
pub const NRF_ENOTBLK: u32 = 15;
pub const NRF_EPFNOSUPPORT: u32 = 96;
pub const NRF_ESHUTDOWN: u32 = 110;
pub const NRF_EHOSTDOWN: u32 = 117;
pub const NRF_ESOCKTNOSUPPORT: u32 = 124;
pub const NRF_ETOOMANYREFS: u32 = 129;
pub const NRF_MODEM_MAX_SOCKET_COUNT: u32 = 8;
pub const NRF_INET_ADDRSTRLEN: u32 = 16;
pub const NRF_INET6_ADDRSTRLEN: u32 = 46;
pub const NRF_AF_UNSPEC: u32 = 0;
pub const NRF_AF_INET: u32 = 1;
pub const NRF_AF_INET6: u32 = 2;
pub const NRF_AF_PACKET: u32 = 3;
pub const NRF_SOCK_STREAM: u32 = 1;
pub const NRF_SOCK_DGRAM: u32 = 2;
pub const NRF_SOCK_RAW: u32 = 3;
pub const NRF_IPPROTO_IP: u32 = 0;
pub const NRF_IPPROTO_TCP: u32 = 6;
pub const NRF_IPPROTO_UDP: u32 = 17;
pub const NRF_IPPROTO_IPV6: u32 = 41;
pub const NRF_IPPROTO_RAW: u32 = 255;
pub const NRF_IPPROTO_ALL: u32 = 512;
pub const NRF_SPROTO_TLS1v2: u32 = 258;
pub const NRF_SPROTO_DTLS1v2: u32 = 273;
pub const NRF_SOCKET_TLS_MAX_MESSAGE_SIZE: u32 = 2048;
pub const NRF_SOCKET_TLS_MAX_SEC_TAG_LIST_SIZE: u32 = 7;
pub const NRF_SO_SEC_TAG_LIST: u32 = 1;
pub const NRF_SO_SEC_HOSTNAME: u32 = 2;
pub const NRF_SO_SEC_CIPHERSUITE_LIST: u32 = 3;
pub const NRF_SO_SEC_CIPHERSUITE_USED: u32 = 4;
pub const NRF_SO_SEC_PEER_VERIFY: u32 = 5;
pub const NRF_SO_SEC_ROLE: u32 = 6;
pub const NRF_SO_SEC_SESSION_CACHE: u32 = 12;
pub const NRF_SO_SEC_SESSION_CACHE_PURGE: u32 = 13;
pub const NRF_SO_SEC_DTLS_HANDSHAKE_TIMEO: u32 = 14;
pub const NRF_SO_SEC_DTLS_CID: u32 = 15;
pub const NRF_SO_SEC_DTLS_CID_STATUS: u32 = 16;
pub const NRF_SO_SEC_DTLS_CONN_SAVE: u32 = 17;
pub const NRF_SO_SEC_DTLS_CONN_LOAD: u32 = 18;
pub const NRF_SO_SEC_HANDSHAKE_STATUS: u32 = 19;
pub const NRF_SO_REUSEADDR: u32 = 2;
pub const NRF_SO_ERROR: u32 = 4;
pub const NRF_SO_RCVTIMEO: u32 = 20;
pub const NRF_SO_SNDTIMEO: u32 = 21;
pub const NRF_SO_BINDTODEVICE: u32 = 25;
pub const NRF_SO_SILENCE_ALL: u32 = 30;
pub const NRF_SO_IP_ECHO_REPLY: u32 = 31;
pub const NRF_SO_IPV6_ECHO_REPLY: u32 = 32;
pub const NRF_SO_TCP_SRV_SESSTIMEO: u32 = 55;
pub const NRF_SO_POLLCB: u32 = 60;
pub const NRF_SO_RAI_NO_DATA: u32 = 50;
pub const NRF_SO_RAI_LAST: u32 = 51;
pub const NRF_SO_RAI_ONE_RESP: u32 = 52;
pub const NRF_SO_RAI_ONGOING: u32 = 53;
pub const NRF_SO_RAI_WAIT_MORE: u32 = 54;
pub const NRF_SOL_SOCKET: u32 = 1;
pub const NRF_SOL_SECURE: u32 = 282;
pub const NRF_MSG_PEEK: u32 = 2;
pub const NRF_MSG_DONTWAIT: u32 = 64;
pub const NRF_MSG_WAITALL: u32 = 256;
pub const NRF_F_GETFL: u32 = 3;
pub const NRF_F_SETFL: u32 = 4;
pub const NRF_O_NONBLOCK: u32 = 1;
pub const NRF_SO_SEC_PEER_VERIFY_NONE: u32 = 0;
pub const NRF_SO_SEC_PEER_VERIFY_OPTIONAL: u32 = 1;
pub const NRF_SO_SEC_PEER_VERIFY_REQUIRED: u32 = 2;
pub const NRF_SO_SEC_ROLE_CLIENT: u32 = 0;
pub const NRF_SO_SEC_ROLE_SERVER: u32 = 1;
pub const NRF_SO_SEC_SESSION_CACHE_DISABLED: u32 = 0;
pub const NRF_SO_SEC_SESSION_CACHE_ENABLED: u32 = 1;
pub const NRF_SO_SEC_DTLS_HANDSHAKE_TIMEOUT_NONE: u32 = 0;
pub const NRF_SO_SEC_DTLS_HANDSHAKE_TIMEOUT_1S: u32 = 1;
pub const NRF_SO_SEC_DTLS_HANDSHAKE_TIMEOUT_3S: u32 = 3;
pub const NRF_SO_SEC_DTLS_HANDSHAKE_TIMEOUT_7S: u32 = 7;
pub const NRF_SO_SEC_DTLS_HANDSHAKE_TIMEOUT_15S: u32 = 15;
pub const NRF_SO_SEC_DTLS_HANDSHAKE_TIMEOUT_31S: u32 = 31;
pub const NRF_SO_SEC_DTLS_HANDSHAKE_TIMEOUT_63S: u32 = 63;
pub const NRF_SO_SEC_DTLS_HANDSHAKE_TIMEOUT_123S: u32 = 123;
pub const NRF_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384: u32 = 49188;
pub const NRF_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA: u32 = 49162;
pub const NRF_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256: u32 = 49187;
pub const NRF_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA: u32 = 49161;
pub const NRF_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA: u32 = 49172;
pub const NRF_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256: u32 = 49191;
pub const NRF_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA: u32 = 49171;
pub const NRF_TLS_PSK_WITH_AES_256_CBC_SHA: u32 = 141;
pub const NRF_TLS_PSK_WITH_AES_128_CBC_SHA256: u32 = 174;
pub const NRF_TLS_PSK_WITH_AES_128_CBC_SHA: u32 = 140;
pub const NRF_TLS_PSK_WITH_AES_128_CCM_8: u32 = 49320;
pub const NRF_TLS_EMPTY_RENEGOTIATIONINFO_SCSV: u32 = 255;
pub const NRF_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256: u32 = 49195;
pub const NRF_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384: u32 = 49200;
pub const NRF_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256: u32 = 49199;
pub const NRF_SO_SEC_DTLS_CID_DISABLED: u32 = 0;
pub const NRF_SO_SEC_DTLS_CID_SUPPORTED: u32 = 1;
pub const NRF_SO_SEC_DTLS_CID_ENABLED: u32 = 2;
pub const NRF_SO_SEC_DTLS_CID_STATUS_DISABLED: u32 = 0;
pub const NRF_SO_SEC_DTLS_CID_STATUS_DOWNLINK: u32 = 1;
pub const NRF_SO_SEC_DTLS_CID_STATUS_UPLINK: u32 = 2;
pub const NRF_SO_SEC_DTLS_CID_STATUS_BIDIRECTIONAL: u32 = 3;
pub const NRF_SO_SEC_HANDSHAKE_STATUS_FULL: u32 = 0;
pub const NRF_SO_SEC_HANDSHAKE_STATUS_CACHED: u32 = 1;
pub const NRF_AI_CANONNAME: u32 = 2;
pub const NRF_AI_NUMERICSERV: u32 = 1024;
pub const NRF_AI_PDNSERV: u32 = 4096;
pub const NRF_IFNAMSIZ: u32 = 64;
pub const NRF_POLLIN: u32 = 1;
pub const NRF_POLLOUT: u32 = 4;
pub const NRF_POLLERR: u32 = 8;
pub const NRF_POLLHUP: u32 = 16;
pub const NRF_POLLNVAL: u32 = 32;
pub const NRF_MODEM_GNSS_SYSTEM_GPS_MASK: u32 = 1;
pub const NRF_MODEM_GNSS_SYSTEM_QZSS_MASK: u32 = 4;
pub const NRF_MODEM_GNSS_NMEA_GGA_MASK: u32 = 1;
pub const NRF_MODEM_GNSS_NMEA_GLL_MASK: u32 = 2;
pub const NRF_MODEM_GNSS_NMEA_GSA_MASK: u32 = 4;
pub const NRF_MODEM_GNSS_NMEA_GSV_MASK: u32 = 8;
pub const NRF_MODEM_GNSS_NMEA_RMC_MASK: u32 = 16;
pub const NRF_MODEM_GNSS_PSM_DISABLED: u32 = 0;
pub const NRF_MODEM_GNSS_PSM_DUTY_CYCLING_PERFORMANCE: u32 = 1;
pub const NRF_MODEM_GNSS_PSM_DUTY_CYCLING_POWER: u32 = 2;
pub const NRF_MODEM_GNSS_USE_CASE_MULTIPLE_HOT_START: u32 = 1;
pub const NRF_MODEM_GNSS_USE_CASE_LOW_ACCURACY: u32 = 2;
pub const NRF_MODEM_GNSS_USE_CASE_SCHED_DOWNLOAD_DISABLE: u32 = 4;
pub const NRF_MODEM_GNSS_PVT_FLAG_FIX_VALID: u32 = 1;
pub const NRF_MODEM_GNSS_PVT_FLAG_LEAP_SECOND_VALID: u32 = 2;
pub const NRF_MODEM_GNSS_PVT_FLAG_SLEEP_BETWEEN_PVT: u32 = 4;
pub const NRF_MODEM_GNSS_PVT_FLAG_DEADLINE_MISSED: u32 = 8;
pub const NRF_MODEM_GNSS_PVT_FLAG_NOT_ENOUGH_WINDOW_TIME: u32 = 16;
pub const NRF_MODEM_GNSS_PVT_FLAG_VELOCITY_VALID: u32 = 32;
pub const NRF_MODEM_GNSS_SV_FLAG_USED_IN_FIX: u32 = 2;
pub const NRF_MODEM_GNSS_SV_FLAG_UNHEALTHY: u32 = 8;
pub const NRF_MODEM_GNSS_AGPS_UTC_PARAMETERS: u32 = 1;
pub const NRF_MODEM_GNSS_AGPS_EPHEMERIDES: u32 = 2;
pub const NRF_MODEM_GNSS_AGPS_ALMANAC: u32 = 3;
pub const NRF_MODEM_GNSS_AGPS_KLOBUCHAR_IONOSPHERIC_CORRECTION: u32 = 4;
pub const NRF_MODEM_GNSS_AGPS_NEQUICK_IONOSPHERIC_CORRECTION: u32 = 5;
pub const NRF_MODEM_GNSS_AGPS_GPS_SYSTEM_CLOCK_AND_TOWS: u32 = 6;
pub const NRF_MODEM_GNSS_AGPS_LOCATION: u32 = 7;
pub const NRF_MODEM_GNSS_AGPS_INTEGRITY: u32 = 8;
pub const NRF_MODEM_GNSS_EVT_PVT: u32 = 1;
pub const NRF_MODEM_GNSS_EVT_FIX: u32 = 2;
pub const NRF_MODEM_GNSS_EVT_NMEA: u32 = 3;
pub const NRF_MODEM_GNSS_EVT_AGPS_REQ: u32 = 4;
pub const NRF_MODEM_GNSS_EVT_BLOCKED: u32 = 5;
pub const NRF_MODEM_GNSS_EVT_UNBLOCKED: u32 = 6;
pub const NRF_MODEM_GNSS_EVT_PERIODIC_WAKEUP: u32 = 7;
pub const NRF_MODEM_GNSS_EVT_SLEEP_AFTER_TIMEOUT: u32 = 8;
pub const NRF_MODEM_GNSS_EVT_SLEEP_AFTER_FIX: u32 = 9;
pub const NRF_MODEM_GNSS_EVT_REF_ALT_EXPIRED: u32 = 10;
pub const NRF_MODEM_GNSS_DATA_PVT: u32 = 1;
pub const NRF_MODEM_GNSS_DATA_NMEA: u32 = 2;
pub const NRF_MODEM_GNSS_DATA_AGPS_REQ: u32 = 3;
pub const NRF_MODEM_GNSS_TIMING_SOURCE_RTC: u32 = 0;
pub const NRF_MODEM_GNSS_TIMING_SOURCE_TCXO: u32 = 1;
pub const NRF_MODEM_GNSS_QZSS_NMEA_MODE_STANDARD: u32 = 0;
pub const NRF_MODEM_GNSS_QZSS_NMEA_MODE_CUSTOM: u32 = 1;
pub const NRF_MODEM_GNSS_MAX_SATELLITES: u32 = 12;
pub const NRF_MODEM_GNSS_NMEA_MAX_LEN: u32 = 83;
pub const NRF_MODEM_GNSS_AGPS_GPS_UTC_REQUEST: u32 = 1;
pub const NRF_MODEM_GNSS_AGPS_KLOBUCHAR_REQUEST: u32 = 2;
pub const NRF_MODEM_GNSS_AGPS_NEQUICK_REQUEST: u32 = 4;
pub const NRF_MODEM_GNSS_AGPS_SYS_TIME_AND_SV_TOW_REQUEST: u32 = 8;
pub const NRF_MODEM_GNSS_AGPS_POSITION_REQUEST: u32 = 16;
pub const NRF_MODEM_GNSS_AGPS_INTEGRITY_REQUEST: u32 = 32;
pub const NRF_MODEM_GNSS_NUM_GPS_SATELLITES: u32 = 32;
pub const NRF_MODEM_GNSS_AGPS_MAX_SV_TOW: u32 = 32;
pub const NRF_MODEM_GNSS_DELETE_EPHEMERIDES: u32 = 1;
pub const NRF_MODEM_GNSS_DELETE_ALMANACS: u32 = 2;
pub const NRF_MODEM_GNSS_DELETE_IONO_CORRECTION_DATA: u32 = 4;
pub const NRF_MODEM_GNSS_DELETE_LAST_GOOD_FIX: u32 = 8;
pub const NRF_MODEM_GNSS_DELETE_GPS_TOW: u32 = 16;
pub const NRF_MODEM_GNSS_DELETE_GPS_WEEK: u32 = 32;
pub const NRF_MODEM_GNSS_DELETE_UTC_DATA: u32 = 64;
pub const NRF_MODEM_GNSS_DELETE_TCXO_OFFSET: u32 = 128;
pub const NRF_MODEM_GNSS_DELETE_GPS_TOW_PRECISION: u32 = 256;
pub const NRF_MODEM_GNSS_DYNAMICS_GENERAL_PURPOSE: u32 = 0;
pub const NRF_MODEM_GNSS_DYNAMICS_STATIONARY: u32 = 1;
pub const NRF_MODEM_GNSS_DYNAMICS_PEDESTRIAN: u32 = 2;
pub const NRF_MODEM_GNSS_DYNAMICS_AUTOMOTIVE: u32 = 3;
pub const NRF_MODEM_DELTA_DFU_NO_ERROR: u32 = 0;
pub const NRF_MODEM_DELTA_DFU_RECEIVER_OUT_OF_MEMORY: u32 = 1;
pub const NRF_MODEM_DELTA_DFU_RECEIVER_BLOCK_TOO_LARGE: u32 = 2;
pub const NRF_MODEM_DELTA_DFU_INVALID_HEADER_DATA: u32 = 3;
pub const NRF_MODEM_DELTA_DFU_ERROR_INTERNAL_00: u32 = 4;
pub const NRF_MODEM_DELTA_DFU_INVALID_DATA: u32 = 5;
pub const NRF_MODEM_DELTA_DFU_ERROR_INTERNAL_01: u32 = 6;
pub const NRF_MODEM_DELTA_DFU_ERROR_INTERNAL_02: u32 = 7;
pub const NRF_MODEM_DELTA_DFU_ERROR_INTERNAL_03: u32 = 8;
pub const NRF_MODEM_DELTA_DFU_INVALID_UUID: u32 = 9;
pub const NRF_MODEM_DELTA_DFU_INVALID_ADDRESS: u32 = 10;
pub const NRF_MODEM_DELTA_DFU_AREA_NOT_BLANK: u32 = 11;
pub const NRF_MODEM_DELTA_DFU_WRITE_ERROR: u32 = 12;
pub const NRF_MODEM_DELTA_DFU_ERASE_ERROR: u32 = 13;
pub const NRF_MODEM_DELTA_DFU_INVALID_FILE_OFFSET: u32 = 14;
pub const NRF_MODEM_DELTA_DFU_PROGRESS_LOG_INVALID: u32 = 15;
pub const NRF_MODEM_DELTA_DFU_INVALID_RESUME_ATTEMPT: u32 = 16;
pub const NRF_MODEM_DELTA_DFU_ERASE_PENDING: u32 = 17;
pub const NRF_MODEM_DELTA_DFU_OPERATION_NOT_ALLOWED: u32 = 18;
pub const NRF_MODEM_DELTA_DFU_INCOMPLETE_DATA: u32 = 19;
pub const NRF_MODEM_DELTA_DFU_INTERRUPTED_WRITE: u32 = 20;
pub const NRF_MODEM_DELTA_DFU_INVALID_OPERATION: u32 = 21;
pub const NRF_MODEM_DELTA_DFU_ERROR_INTERNAL_04: u32 = 22;
pub const NRF_MODEM_DELTA_DFU_NOT_ALLOWED_POFWARN_ON: u32 = 23;
pub const NRF_MODEM_DELTA_DFU_UUID_LEN: u32 = 36;
pub const NRF_MODEM_DELTA_DFU_OFFSET_DIRTY: u32 = 2621440;
pub const NRF_MODEM_AT_ERROR: u32 = 1;
pub const NRF_MODEM_AT_CME_ERROR: u32 = 2;
pub const NRF_MODEM_AT_CMS_ERROR: u32 = 3;
pub const NRF_MODEM_BOOTLOADER_DIGEST_LEN: u32 = 32;
pub const NRF_MODEM_BOOTLOADER_UUID_LEN: u32 = 36;
pub const NRF_EAI_BADFLAGS: i32 = -1;
pub const NRF_EAI_NONAME: i32 = -2;
pub const NRF_EAI_AGAIN: i32 = -3;
pub const NRF_EAI_FAIL: i32 = -4;
pub const NRF_EAI_NODATA: i32 = -5;
pub const NRF_EAI_FAMILY: i32 = -6;
pub const NRF_EAI_SOCKTYPE: i32 = -7;
pub const NRF_EAI_SERVICE: i32 = -8;
pub const NRF_EAI_ADDRFAMILY: i32 = -9;
pub const NRF_EAI_MEMORY: i32 = -10;
pub const NRF_EAI_SYSTEM: i32 = -11;
pub const NRF_EAI_INPROGRESS: i32 = -100;
pub const NRF_CC3XX_PLATFORM_ENTROPY_MAX_GATHER: u32 = 144;
pub const NRF_CC3XX_PLATFORM_EITS_NONCE_SIZE: u32 = 8;
pub const NRF_CC3XX_PLATFORM_TFM_BOOT_SEED_SIZE: u32 = 32;
pub const NRF_CC3XX_PLATFORM_USE_COUNT_MAX: u32 = 10;
pub const NRF_CC3XX_PLATFORM_SUCCESS: u32 = 0;
pub const NRF_CC3XX_PLATFORM_TRUE: u32 = 1;
pub const NRF_CC3XX_PLATFORM_FALSE: u32 = 0;
pub const NRF_CC3XX_PLATFORM_ERROR_PARAM_NULL: i32 = -28673;
pub const NRF_CC3XX_PLATFORM_ERROR_INTERNAL: i32 = -28674;
pub const NRF_CC3XX_PLATFORM_ERROR_RNG_TEST_FAILED: i32 = -28675;
pub const NRF_CC3XX_PLATFORM_ERROR_HW_VERSION_FAILED: i32 = -28676;
pub const NRF_CC3XX_PLATFORM_ERROR_PARAM_WRITE_FAILED: i32 = -28677;
pub const NRF_CC3XX_PLATFORM_ERROR_MUTEX_NOT_INITIALIZED: i32 = -28694;
pub const NRF_CC3XX_PLATFORM_ERROR_MUTEX_FAILED: i32 = -28695;
pub const NRF_CC3XX_PLATFORM_ERROR_ENTROPY_NOT_INITIALIZED: i32 = -28696;
pub const NRF_CC3XX_PLATFORM_ERROR_ENTROPY_TRNG_TOO_LONG: i32 = -28697;
pub const NRF_CC3XX_PLATFORM_ERROR_KMU_INVALID_SLOT: i32 = -28698;
pub const NRF_CC3XX_PLATFORM_ERROR_KMU_ALREADY_FILLED: i32 = -28699;
pub const NRF_CC3XX_PLATFORM_ERROR_KMU_WRONG_ADDRESS: i32 = -28700;
pub const NRF_CC3XX_PLATFORM_ERROR_KMU_WRITE_KEY_FAILED: i32 = -28701;
pub const NRF_CC3XX_PLATFORM_ERROR_KMU_WRITE_INVALID_PERM: i32 = -28702;
pub const NRF_CC3XX_PLATFORM_ERROR_KDR_INVALID_WRITE: i32 = -28703;
pub const NRF_CC3XX_PLATFORM_ERROR_KDR_INVALID_PUSH: i32 = -28704;
pub const NRF_CC3XX_PLATFORM_ERROR_KMU_INVALID_KEY_TYPE: i32 = -28705;
pub const NRF_CC3XX_PLATFORM_ERROR_INVALID_PARAM: i32 = -28706;
pub const NRF_CC3XX_PLATFORM_ERROR_DERIVED_KEY_CTX_INVALID_STATE: i32 = -28707;
pub const NRF_CC3XX_PLATFORM_ERROR_IDENTITY_KEY_INVALID_SLOT: i32 = -28708;
pub const NRF_CC3XX_PLATFORM_ERROR_KIDENT_ALREADY_FILLED: i32 = -28709;
pub const NRF_CC3XX_PLATFORM_ERROR_KIDENT_WRITE_KEY_FAILED: i32 = -28710;
pub const NRF_CC3XX_PLATFORM_ERROR_KIDENT_READ_KEY_FAILED: i32 = -28711;
pub const NRF_CC3XX_PLATFORM_ERROR_KIDENT_MKEK_MISSING: i32 = -28712;
pub const NRF_CC3XX_PLATFORM_ERROR_KIDENT_INVALID_STATE: i32 = -28713;
pub const NRF_CC3XX_PLATFORM_DERIVED_KEY_CTX_INITIALIZED: u32 = 16;
pub const NRF_CC3XX_PLATFORM_DERIVED_KEY_DERIV_INFO_SET: u32 = 32;
pub const NRF_CC3XX_PLATFORM_DERIVED_KEY_CIPH_INFO_SET: u32 = 64;
pub const NRF_CC3XX_PLATFORM_DERIVED_KEY_AUTH_INFO_SET: u32 = 128;
pub const NRF_KMU_FIRST_SLOT: u32 = 0;
pub const NRF_KMU_SECOND_SLOT: u32 = 1;
pub const NRF_KMU_LAST_SLOT: u32 = 127;
pub const NRF_KMU_LAST_IDENTTY_KEY_SLOT: u32 = 126;
pub const NRF_KMU_SLOT_KDR: u32 = 0;
pub const NRF_KMU_SLOT_KDR_RESERVED: u32 = 1;
pub const NRF_KMU_SLOT_MKEK: u32 = 2;
pub const NRF_KMU_SLOT_MKEK_RESERVED: u32 = 3;
pub const NRF_KMU_SLOT_MEXT: u32 = 4;
pub const NRF_KMU_SLOT_MEXT_RESERVED: u32 = 5;
pub const NRF_KMU_SLOT_KIDENT: u32 = 6;
pub const NRF_KMU_SLOT_KIDENT_RESERVED: u32 = 7;
pub const NRF_CC3XX_PLATFORM_MUTEX_MASK_INVALID: u32 = 2841403180;
pub const NRF_CC3XX_PLATFORM_MUTEX_MASK_IS_VALID: u32 = 58;
pub const NRF_CC3XX_PLATFORM_MUTEX_MASK_IS_ALLOCATED: u32 = 3712;
pub const NRF_CC3XX_PLATFORM_MUTEX_MASK_IS_ATOMIC: u32 = 237568;
pub const NRF_CC3XX_PLATFORM_MUTEX_MASK_IS_HW_MUTEX: u32 = 15204352;
pub const NRF_CC3XX_PLATFORM_MUTEX_MASK_IS_INTERNAL_MUTEX: u32 = 973078528;
pub type bool_ = bool;
#[doc = " Shared memory configuration in normal operation mode."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_shmem_cfg {
pub ctrl: nrf_modem_shmem_cfg__bindgen_ty_1,
pub tx: nrf_modem_shmem_cfg__bindgen_ty_2,
pub rx: nrf_modem_shmem_cfg__bindgen_ty_3,
pub trace: nrf_modem_shmem_cfg__bindgen_ty_4,
}
#[doc = " Control memory, used for control structures.\n The size of this area is build constant, and must be equal to\n * `NRF_MODEM_SHMEM_CTRL_SIZE` - ."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_shmem_cfg__bindgen_ty_1 {
pub base: u32,
pub size: u32,
}
#[test]
fn bindgen_test_layout_nrf_modem_shmem_cfg__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_shmem_cfg__bindgen_ty_1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_shmem_cfg__bindgen_ty_1>(),
8usize,
concat!("Size of: ", stringify!(nrf_modem_shmem_cfg__bindgen_ty_1))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_shmem_cfg__bindgen_ty_1>(),
4usize,
concat!(
"Alignment of ",
stringify!(nrf_modem_shmem_cfg__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).base) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_shmem_cfg__bindgen_ty_1),
"::",
stringify!(base)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_shmem_cfg__bindgen_ty_1),
"::",
stringify!(size)
)
);
}
#[doc = " TX memory, used to send data to the modem.\n The base address must be word-aligned (4 bytes)."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_shmem_cfg__bindgen_ty_2 {
pub base: u32,
pub size: u32,
}
#[test]
fn bindgen_test_layout_nrf_modem_shmem_cfg__bindgen_ty_2() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_shmem_cfg__bindgen_ty_2> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_shmem_cfg__bindgen_ty_2>(),
8usize,
concat!("Size of: ", stringify!(nrf_modem_shmem_cfg__bindgen_ty_2))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_shmem_cfg__bindgen_ty_2>(),
4usize,
concat!(
"Alignment of ",
stringify!(nrf_modem_shmem_cfg__bindgen_ty_2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).base) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_shmem_cfg__bindgen_ty_2),
"::",
stringify!(base)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_shmem_cfg__bindgen_ty_2),
"::",
stringify!(size)
)
);
}
#[doc = " RX memory, used to receive data from the modem.\n The base address must be word-aligned (4 bytes)."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_shmem_cfg__bindgen_ty_3 {
pub base: u32,
pub size: u32,
}
#[test]
fn bindgen_test_layout_nrf_modem_shmem_cfg__bindgen_ty_3() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_shmem_cfg__bindgen_ty_3> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_shmem_cfg__bindgen_ty_3>(),
8usize,
concat!("Size of: ", stringify!(nrf_modem_shmem_cfg__bindgen_ty_3))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_shmem_cfg__bindgen_ty_3>(),
4usize,
concat!(
"Alignment of ",
stringify!(nrf_modem_shmem_cfg__bindgen_ty_3)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).base) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_shmem_cfg__bindgen_ty_3),
"::",
stringify!(base)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_shmem_cfg__bindgen_ty_3),
"::",
stringify!(size)
)
);
}
#[doc = " Trace memory, used to receive traces from the modem.\n The base address must be word-aligned (4 bytes)."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_shmem_cfg__bindgen_ty_4 {
pub base: u32,
pub size: u32,
}
#[test]
fn bindgen_test_layout_nrf_modem_shmem_cfg__bindgen_ty_4() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_shmem_cfg__bindgen_ty_4> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_shmem_cfg__bindgen_ty_4>(),
8usize,
concat!("Size of: ", stringify!(nrf_modem_shmem_cfg__bindgen_ty_4))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_shmem_cfg__bindgen_ty_4>(),
4usize,
concat!(
"Alignment of ",
stringify!(nrf_modem_shmem_cfg__bindgen_ty_4)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).base) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_shmem_cfg__bindgen_ty_4),
"::",
stringify!(base)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_shmem_cfg__bindgen_ty_4),
"::",
stringify!(size)
)
);
}
#[test]
fn bindgen_test_layout_nrf_modem_shmem_cfg() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_shmem_cfg> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_shmem_cfg>(),
32usize,
concat!("Size of: ", stringify!(nrf_modem_shmem_cfg))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_shmem_cfg>(),
4usize,
concat!("Alignment of ", stringify!(nrf_modem_shmem_cfg))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ctrl) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_shmem_cfg),
"::",
stringify!(ctrl)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).tx) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_shmem_cfg),
"::",
stringify!(tx)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).rx) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_shmem_cfg),
"::",
stringify!(rx)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).trace) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_shmem_cfg),
"::",
stringify!(trace)
)
);
}
#[doc = " Shared memory configuration in bootloader mode.\n The base address must be word-aligned (4 bytes)."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_bootloader_shmem_cfg {
pub base: u32,
pub size: u32,
}
#[test]
fn bindgen_test_layout_nrf_modem_bootloader_shmem_cfg() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_bootloader_shmem_cfg> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_bootloader_shmem_cfg>(),
8usize,
concat!("Size of: ", stringify!(nrf_modem_bootloader_shmem_cfg))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_bootloader_shmem_cfg>(),
4usize,
concat!("Alignment of ", stringify!(nrf_modem_bootloader_shmem_cfg))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).base) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_bootloader_shmem_cfg),
"::",
stringify!(base)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_bootloader_shmem_cfg),
"::",
stringify!(size)
)
);
}
#[doc = " Modem fault info struct."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_fault_info {
pub reason: u32,
pub program_counter: u32,
}
#[test]
fn bindgen_test_layout_nrf_modem_fault_info() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_fault_info> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_fault_info>(),
8usize,
concat!("Size of: ", stringify!(nrf_modem_fault_info))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_fault_info>(),
4usize,
concat!("Alignment of ", stringify!(nrf_modem_fault_info))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).reason) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_fault_info),
"::",
stringify!(reason)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).program_counter) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_fault_info),
"::",
stringify!(program_counter)
)
);
}
#[doc = " Modem fault handler."]
pub type nrf_modem_fault_handler_t =
::core::option::Option<unsafe extern "C" fn(fault_info: *mut nrf_modem_fault_info)>;
#[doc = " Modem library initialization parameters."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_init_params {
#[doc = " Shared memory configuration"]
pub shmem: nrf_modem_shmem_cfg,
#[doc = " IPC IRQ priority"]
pub ipc_irq_prio: u32,
#[doc = " Modem fault handler"]
pub fault_handler: nrf_modem_fault_handler_t,
}
#[test]
fn bindgen_test_layout_nrf_modem_init_params() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_init_params> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_init_params>(),
40usize,
concat!("Size of: ", stringify!(nrf_modem_init_params))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_init_params>(),
4usize,
concat!("Alignment of ", stringify!(nrf_modem_init_params))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).shmem) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_init_params),
"::",
stringify!(shmem)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ipc_irq_prio) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_init_params),
"::",
stringify!(ipc_irq_prio)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).fault_handler) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_init_params),
"::",
stringify!(fault_handler)
)
);
}
#[doc = " Modem library bootloader initialization parameters."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_bootloader_init_params {
#[doc = " Shared memory configuration"]
pub shmem: nrf_modem_bootloader_shmem_cfg,
#[doc = " IPC IRQ priority"]
pub ipc_irq_prio: u32,
#[doc = " Modem fault handler"]
pub fault_handler: nrf_modem_fault_handler_t,
}
#[test]
fn bindgen_test_layout_nrf_modem_bootloader_init_params() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_bootloader_init_params> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_bootloader_init_params>(),
16usize,
concat!("Size of: ", stringify!(nrf_modem_bootloader_init_params))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_bootloader_init_params>(),
4usize,
concat!(
"Alignment of ",
stringify!(nrf_modem_bootloader_init_params)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).shmem) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_bootloader_init_params),
"::",
stringify!(shmem)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ipc_irq_prio) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_bootloader_init_params),
"::",
stringify!(ipc_irq_prio)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).fault_handler) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_bootloader_init_params),
"::",
stringify!(fault_handler)
)
);
}
extern "C" {
#[doc = " Return a statically allocated string identifying the Modem library build.\n\n Returns Version string if defined.\n Returns Empty string if version string is not defined."]
pub fn nrf_modem_build_version() -> *mut ::core::ffi::c_char;
}
extern "C" {
#[doc = " Initialize the Modem library and turn on the modem.\n\n @note\n To switch between bootloader and normal modes, * `nrf_modem_shutdown` - must be\n called in between.\n\n * `init_params` - Initialization parameters.\n\n Returns Zero on success.\n Returns A positive value from @ref nrf_modem_dfu when executing\n Modem firmware updates.\n Returns -NRF_EPERM The Modem library is already initialized.\n Returns -NRF_EFAULT * `init_params` - is * `NULL` - .\n Returns -NRF_ENOLCK Not enough semaphores.\n Returns -NRF_ENOMEM Not enough shared memory.\n Returns -NRF_EINVAL Control region size is incorrect.\n Returns -NRF_ENOTSUPP RPC version mismatch.\n Returns -NRF_ETIMEDOUT Operation timed out.\n Returns -NRF_ACCESS Modem firmware authentication failure."]
pub fn nrf_modem_init(init_params: *const nrf_modem_init_params) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Initialize the Modem library and turn on the modem in bootloader mode.\n\n @note\n To switch between bootloader and normal modes, * `nrf_modem_shutdown` - must be\n called in between.\n\n * `init_params` - Bootloader initialization parameters.\n\n Returns Zero on success.\n Returns A positive value from @ref nrf_modem_dfu when executing\n Modem firmware updates.\n\n Returns -NRF_EPERM The Modem library is already initialized.\n Returns -NRF_EFAULT * `init_params` - is * `NULL` - .\n Returns -NRF_ENOLCK Not enough semaphores.\n Returns -NRF_ENOMEM Not enough shared memory.\n Returns -NRF_EACCES Bad root digest.\n Returns -NRF_ETIMEDOUT Operation timed out.\n Returns -NRF_EIO Bootloader fault."]
pub fn nrf_modem_bootloader_init(
init_params: *const nrf_modem_bootloader_init_params,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Check whether the modem is initialized.\n\n Returns true If the modem is initialized.\n Returns false If the modem is uninitialized or in a fault state."]
pub fn nrf_modem_is_initialized() -> bool_;
}
extern "C" {
#[doc = " De-initialize the Modem library and turn off the modem.\n\n @note\n If the modem is initialized in normal mode, it must be put into offline mode (CFUN=0)\n before shutting it down.\n\n Resources reserved by the library are freed when the library is shutdown.\n\n Returns Zero on success.\n Returns -NRF_EPERM The Modem library is not initialized."]
pub fn nrf_modem_shutdown() -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Initialize the glue layer."]
pub fn nrf_modem_os_init();
}
extern "C" {
#[doc = " Deinitialize the glue layer.\n\n When shutdown is called, all pending calls to * `nrf_modem_os_timedwait` - shall exit\n and return -NRF_ESHUTDOWN."]
pub fn nrf_modem_os_shutdown();
}
extern "C" {
#[doc = " Allocate a buffer on the TX area of shared memory.\n\n * `bytes` - Buffer size.\n @returns A pointer to the allocated memory buffer or * `NULL` - if allocation failed."]
pub fn nrf_modem_os_shm_tx_alloc(bytes: usize) -> *mut ::core::ffi::c_void;
}
extern "C" {
#[doc = " Free a shared memory buffer in the TX area.\n\n * `mem` - Buffer to free."]
pub fn nrf_modem_os_shm_tx_free(mem: *mut ::core::ffi::c_void);
}
extern "C" {
#[doc = " Allocate a buffer on the library heap.\n\n * `bytes` - Buffer size.\n @returns A pointer to the allocated memory buffer or * `NULL` - if allocation failed."]
pub fn nrf_modem_os_alloc(bytes: usize) -> *mut ::core::ffi::c_void;
}
extern "C" {
#[doc = " Free a memory buffer in the library heap.\n\n * `mem` - Buffer to free."]
pub fn nrf_modem_os_free(mem: *mut ::core::ffi::c_void);
}
extern "C" {
#[doc = " Busy wait.\n\n * `usec` - Microseconds to busy wait for."]
pub fn nrf_modem_os_busywait(usec: i32);
}
extern "C" {
#[doc = " Put a thread to sleep for a specific time or until an event occurs.\n\n The thread is woken by a * `nrf_modem_event_notify` - call with the same * `context` - parameter,\n or after the * `timeout` - has expired, whichever happens first. If the timeout has not expired,\n the * `timeout` - parameter is updated to contain the amount of time left to sleep.\n\n * `context` - Library context.\n @param[in, out] timeout Timeout in milliseconds, or * `NRF_MODEM_OS_FOREVER` - for no timeout.\n\t\t\t Specifies the timeout value on input and the remaining\n\t\t\t time to sleep on output.\n\n Returns 0 The thread is woken before the timeout expired.\n Returns -NRF_EAGAIN The timeout expired.\n Returns -NRF_ESHUTDOWN Modem is not initialized, or was shut down."]
pub fn nrf_modem_os_timedwait(context: u32, timeout: *mut i32) -> i32;
}
extern "C" {
#[doc = " Notify the application that an event has occurred.\n\n This function wakes up all threads sleeping in * `nrf_modem_os_timedwait` - \n that have the same * `context` - , or all sleeping threads if * `context` - is zero.\n\n * `context` - Library context."]
pub fn nrf_modem_os_event_notify(context: u32);
}
extern "C" {
#[doc = " Put a thread to sleep for a specific amount of time.\n\n * `timeout` - Timeout in millisec.\n @returns 0 on success, a negative errno otherwise."]
pub fn nrf_modem_os_sleep(timeout: u32) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Set errno.\n\n * `errno_val` - errno to set."]
pub fn nrf_modem_os_errno_set(errno_val: ::core::ffi::c_int);
}
extern "C" {
#[doc = " Check if executing in interrupt context.\n\n Returns true If in interrupt context.\n Returns false If not in interrupt context."]
pub fn nrf_modem_os_is_in_isr() -> bool_;
}
extern "C" {
#[doc = " Initialize a semaphore.\n\n The function shall allocate and initialize a semaphore and return its address\n as an output. If an address of an already allocated semaphore is provided as\n an input, the allocation part is skipped and the semaphore is only reinitialized.\n\n @param[in, out] sem The address of the semaphore.\n * `initial_count` - Initial semaphore count.\n * `limit` - Maximum semaphore count.\n\n @returns 0 on success, a negative errno otherwise."]
pub fn nrf_modem_os_sem_init(
sem: *mut *mut ::core::ffi::c_void,
initial_count: ::core::ffi::c_uint,
limit: ::core::ffi::c_uint,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Give a semaphore.\n\n * `sem` - The semaphore.\n\n @note Can be called from an ISR."]
pub fn nrf_modem_os_sem_give(sem: *mut ::core::ffi::c_void);
}
extern "C" {
#[doc = " Take a semaphore.\n\n * `sem` - The semaphore.\n * `timeout` - Timeout in milliseconds.\n\t\t * `NRF_MODEM_OS_FOREVER` - indicates infinite timeout.\n\t\t * `NRF_MODEM_OS_NO_WAIT` - indicates no timeout.\n\n @note @a timeout shall be set to NRF_MODEM_OS_NO_WAIT if called from ISR.\n\n Returns 0 on success.\n Returns -NRF_EAGAIN If the semaphore could not be taken."]
pub fn nrf_modem_os_sem_take(
sem: *mut ::core::ffi::c_void,
timeout: ::core::ffi::c_int,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Get a semaphore's count.\n\n * `sem` - The semaphore.\n @returns Current semaphore count."]
pub fn nrf_modem_os_sem_count_get(sem: *mut ::core::ffi::c_void) -> ::core::ffi::c_uint;
}
extern "C" {
#[doc = " Generic logging procedure.\n\n * `level` - Log level.\n * `fmt` - Format string.\n @param ... Varargs."]
pub fn nrf_modem_os_log(level: ::core::ffi::c_int, fmt: *const ::core::ffi::c_char, ...);
}
extern "C" {
#[doc = " Logging procedure for dumping hex representation of object.\n\n * `level` - Log level.\n * `str` - String to print in the log.\n * `data` - Data whose hex representation we want to log.\n * `len` - Length of the data to hex dump."]
pub fn nrf_modem_os_logdump(
level: ::core::ffi::c_int,
str_: *const ::core::ffi::c_char,
data: *const ::core::ffi::c_void,
len: usize,
);
}
#[doc = " Structure specifying time interval."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_timeval {
#[doc = " Time interval seconds."]
pub tv_sec: u32,
#[doc = " Time interval microseconds."]
pub tv_usec: u32,
}
#[test]
fn bindgen_test_layout_nrf_timeval() {
const UNINIT: ::core::mem::MaybeUninit<nrf_timeval> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_timeval>(),
8usize,
concat!("Size of: ", stringify!(nrf_timeval))
);
assert_eq!(
::core::mem::align_of::<nrf_timeval>(),
4usize,
concat!("Alignment of ", stringify!(nrf_timeval))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).tv_sec) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_timeval),
"::",
stringify!(tv_sec)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).tv_usec) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_timeval),
"::",
stringify!(tv_usec)
)
);
}
#[doc = " Socket port type."]
pub type nrf_in_port_t = u16;
#[doc = " Socket families.\n\n @details For a list of valid values, refer to nrf_socket_families."]
pub type nrf_sa_family_t = ::core::ffi::c_uint;
#[doc = " IPv6 address."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_in6_addr {
pub s6_addr: [u8; 16usize],
}
#[test]
fn bindgen_test_layout_nrf_in6_addr() {
const UNINIT: ::core::mem::MaybeUninit<nrf_in6_addr> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_in6_addr>(),
16usize,
concat!("Size of: ", stringify!(nrf_in6_addr))
);
assert_eq!(
::core::mem::align_of::<nrf_in6_addr>(),
1usize,
concat!("Alignment of ", stringify!(nrf_in6_addr))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).s6_addr) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_in6_addr),
"::",
stringify!(s6_addr)
)
);
}
#[doc = " IPv4 address."]
pub type nrf_in_addr_t = u32;
#[doc = " IPv4 address structure."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_in_addr {
pub s_addr: nrf_in_addr_t,
}
#[test]
fn bindgen_test_layout_nrf_in_addr() {
const UNINIT: ::core::mem::MaybeUninit<nrf_in_addr> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_in_addr>(),
4usize,
concat!("Size of: ", stringify!(nrf_in_addr))
);
assert_eq!(
::core::mem::align_of::<nrf_in_addr>(),
4usize,
concat!("Alignment of ", stringify!(nrf_in_addr))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).s_addr) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_in_addr),
"::",
stringify!(s_addr)
)
);
}
#[doc = " Address record for IPv6 addresses.\n\n Contains the address and port of the host."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_sockaddr_in6 {
#[doc = " Length of this data structure."]
pub sin6_len: u8,
#[doc = " Socket family."]
pub sin6_family: nrf_sa_family_t,
#[doc = " Port, in network byte order."]
pub sin6_port: nrf_in_port_t,
#[doc = " IPv6 flow info parameters. Not used."]
pub sin6_flowinfo: u32,
#[doc = " IPv6 address."]
pub sin6_addr: nrf_in6_addr,
#[doc = " IPv6 scope ID. Not used."]
pub sin6_scope_id: u32,
}
#[test]
fn bindgen_test_layout_nrf_sockaddr_in6() {
const UNINIT: ::core::mem::MaybeUninit<nrf_sockaddr_in6> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_sockaddr_in6>(),
36usize,
concat!("Size of: ", stringify!(nrf_sockaddr_in6))
);
assert_eq!(
::core::mem::align_of::<nrf_sockaddr_in6>(),
4usize,
concat!("Alignment of ", stringify!(nrf_sockaddr_in6))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sin6_len) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_sockaddr_in6),
"::",
stringify!(sin6_len)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sin6_family) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_sockaddr_in6),
"::",
stringify!(sin6_family)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sin6_port) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_sockaddr_in6),
"::",
stringify!(sin6_port)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sin6_flowinfo) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(nrf_sockaddr_in6),
"::",
stringify!(sin6_flowinfo)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sin6_addr) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(nrf_sockaddr_in6),
"::",
stringify!(sin6_addr)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sin6_scope_id) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(nrf_sockaddr_in6),
"::",
stringify!(sin6_scope_id)
)
);
}
#[doc = " Address record for IPv4 addresses.\n\n Contains the address and port of the host."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_sockaddr_in {
#[doc = " Length of this data structure."]
pub sin_len: u8,
#[doc = " Socket family."]
pub sin_family: nrf_sa_family_t,
#[doc = " Port, in network byte order."]
pub sin_port: nrf_in_port_t,
#[doc = " IPv4 address."]
pub sin_addr: nrf_in_addr,
}
#[test]
fn bindgen_test_layout_nrf_sockaddr_in() {
const UNINIT: ::core::mem::MaybeUninit<nrf_sockaddr_in> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_sockaddr_in>(),
16usize,
concat!("Size of: ", stringify!(nrf_sockaddr_in))
);
assert_eq!(
::core::mem::align_of::<nrf_sockaddr_in>(),
4usize,
concat!("Alignment of ", stringify!(nrf_sockaddr_in))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sin_len) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_sockaddr_in),
"::",
stringify!(sin_len)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sin_family) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_sockaddr_in),
"::",
stringify!(sin_family)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sin_port) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_sockaddr_in),
"::",
stringify!(sin_port)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sin_addr) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(nrf_sockaddr_in),
"::",
stringify!(sin_addr)
)
);
}
pub type nrf_socklen_t = u32;
pub type nrf_nfds_t = u32;
#[doc = " Generic socket address.\n\n @details Only provided for API compatibility."]
#[repr(C)]
#[derive(Debug)]
pub struct nrf_sockaddr {
#[doc = " Socket address length"]
pub sa_len: u8,
#[doc = " Socket address family"]
pub sa_family: ::core::ffi::c_int,
#[doc = " Socket address"]
pub sa_data: __IncompleteArrayField<::core::ffi::c_char>,
}
#[test]
fn bindgen_test_layout_nrf_sockaddr() {
const UNINIT: ::core::mem::MaybeUninit<nrf_sockaddr> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_sockaddr>(),
8usize,
concat!("Size of: ", stringify!(nrf_sockaddr))
);
assert_eq!(
::core::mem::align_of::<nrf_sockaddr>(),
4usize,
concat!("Alignment of ", stringify!(nrf_sockaddr))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sa_len) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_sockaddr),
"::",
stringify!(sa_len)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sa_family) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_sockaddr),
"::",
stringify!(sa_family)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sa_data) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_sockaddr),
"::",
stringify!(sa_data)
)
);
}
#[doc = " Address information."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_addrinfo {
#[doc = " Input flags."]
pub ai_flags: ::core::ffi::c_int,
#[doc = " Address family of the socket."]
pub ai_family: ::core::ffi::c_int,
#[doc = " Socket type."]
pub ai_socktype: ::core::ffi::c_int,
#[doc = " Protocol of the socket."]
pub ai_protocol: ::core::ffi::c_int,
#[doc = " Length of the socket address."]
pub ai_addrlen: nrf_socklen_t,
#[doc = " Address of the socket."]
pub ai_addr: *mut nrf_sockaddr,
#[doc = " Canonical name of service location."]
pub ai_canonname: *mut ::core::ffi::c_char,
#[doc = " Pointer to next in list."]
pub ai_next: *mut nrf_addrinfo,
}
#[test]
fn bindgen_test_layout_nrf_addrinfo() {
const UNINIT: ::core::mem::MaybeUninit<nrf_addrinfo> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_addrinfo>(),
32usize,
concat!("Size of: ", stringify!(nrf_addrinfo))
);
assert_eq!(
::core::mem::align_of::<nrf_addrinfo>(),
4usize,
concat!("Alignment of ", stringify!(nrf_addrinfo))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ai_flags) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_addrinfo),
"::",
stringify!(ai_flags)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ai_family) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_addrinfo),
"::",
stringify!(ai_family)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ai_socktype) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_addrinfo),
"::",
stringify!(ai_socktype)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ai_protocol) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(nrf_addrinfo),
"::",
stringify!(ai_protocol)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ai_addrlen) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(nrf_addrinfo),
"::",
stringify!(ai_addrlen)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ai_addr) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(nrf_addrinfo),
"::",
stringify!(ai_addr)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ai_canonname) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(nrf_addrinfo),
"::",
stringify!(ai_canonname)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ai_next) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(nrf_addrinfo),
"::",
stringify!(ai_next)
)
);
}
#[doc = " Interface address information."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_ifaddrs {
pub ifa_next: *mut nrf_ifaddrs,
#[doc = " Interface name."]
pub ifa_name: *mut ::core::ffi::c_char,
#[doc = " Interface flags."]
pub ifa_flags: u32,
#[doc = " Interface address."]
pub ifa_addr: *mut nrf_sockaddr,
#[doc = " Interface netmask. Not supported by the modem."]
pub ifa_netmask: *mut nrf_sockaddr,
#[doc = " Interface broadcast address. Not supported by the modem."]
pub ifa_broadaddr: *mut nrf_sockaddr,
#[doc = " Interface destination address. Not supported by the modem."]
pub ifa_dstaddr: *mut nrf_sockaddr,
#[doc = " Address specific data."]
pub ifa_data: *mut ::core::ffi::c_void,
}
#[test]
fn bindgen_test_layout_nrf_ifaddrs() {
const UNINIT: ::core::mem::MaybeUninit<nrf_ifaddrs> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_ifaddrs>(),
32usize,
concat!("Size of: ", stringify!(nrf_ifaddrs))
);
assert_eq!(
::core::mem::align_of::<nrf_ifaddrs>(),
4usize,
concat!("Alignment of ", stringify!(nrf_ifaddrs))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ifa_next) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_ifaddrs),
"::",
stringify!(ifa_next)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ifa_name) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_ifaddrs),
"::",
stringify!(ifa_name)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ifa_flags) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_ifaddrs),
"::",
stringify!(ifa_flags)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ifa_addr) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(nrf_ifaddrs),
"::",
stringify!(ifa_addr)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ifa_netmask) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(nrf_ifaddrs),
"::",
stringify!(ifa_netmask)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ifa_broadaddr) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(nrf_ifaddrs),
"::",
stringify!(ifa_broadaddr)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ifa_dstaddr) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(nrf_ifaddrs),
"::",
stringify!(ifa_dstaddr)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ifa_data) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(nrf_ifaddrs),
"::",
stringify!(ifa_data)
)
);
}
#[doc = " \n TLS role for the connection.\n - 0 - TLS client role.\n - 1 - TLS server role."]
pub type nrf_sec_role_t = u32;
#[doc = " \n Security tags used on the TLS socket.\n\n More than one security tags may be used on a socket.\n If more than one tag is used on the socket, pass an array of security tags.\n\n A maximum of 8 tags can be set per socket."]
pub type nrf_sec_tag_t = u32;
#[doc = " \n Session cache configuration for the TLS connection.\n - 0 - Disabled.\n - 1 - Enabled.\n\n By default, the session cache is enabled.\n @note Session cache, may not be used if the peer does not support it."]
pub type nrf_sec_session_cache_t = u32;
#[doc = " \n Peer verification level for the TLS connection.\n - 0 - None.\n - 1 - Optional.\n - 2 - Required.\n\n By default, peer verification is optional."]
pub type nrf_sec_peer_verify_t = u32;
#[doc = " \n An IANA cipher suite identifier."]
pub type nrf_sec_cipher_t = u32;
#[doc = " Data type for network interface.\n @deprecated since v1.1.0."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_ifreq {
pub ifr_name: [::core::ffi::c_char; 64usize],
}
#[test]
fn bindgen_test_layout_nrf_ifreq() {
const UNINIT: ::core::mem::MaybeUninit<nrf_ifreq> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_ifreq>(),
64usize,
concat!("Size of: ", stringify!(nrf_ifreq))
);
assert_eq!(
::core::mem::align_of::<nrf_ifreq>(),
1usize,
concat!("Alignment of ", stringify!(nrf_ifreq))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ifr_name) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_ifreq),
"::",
stringify!(ifr_name)
)
);
}
extern "C" {
#[doc = " Create a network socket.\n\n @details\n See <a href=\"https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html\">\n POSIX.1-2017 article</a> for normative description.\n\n In addition, the function shall return -1 and set the following errno:\n - [NRF_ESHUTDOWN] Modem was shut down."]
pub fn nrf_socket(
family: ::core::ffi::c_int,
type_: ::core::ffi::c_int,
protocol: ::core::ffi::c_int,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Close a network socket.\n\n @details\n See <a href=\"https://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html\">\n POSIX.1-2017 article</a> for normative description.\n\n In addition, the function shall return -1 and set the following errno:\n - [NRF_ESHUTDOWN] Modem was shut down."]
pub fn nrf_close(fildes: ::core::ffi::c_int) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Function for controlling file descriptor options.\n\n @details\n Set or get file descriptor options or flags.\n For a list of supported commands, refer to @ref nrf_fcnt_commands.\n For a list of supported flags, refer to @ref nrf_fcnt_flags.\n\n * `fd` - The descriptor to set options on.\n * `cmd` - The command class for options.\n * `flags` - The flags to set.\n\n Returns Value dependent on command class:\n NRF_F_GETFL - Value of file status flags.\n -1 on error, and errno indicates the reason for failure.\n 0 otherwise."]
pub fn nrf_fcntl(
fd: ::core::ffi::c_int,
cmd: ::core::ffi::c_int,
flags: ::core::ffi::c_int,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Connect a socket.\n\n @details\n See <a href=\"https://pubs.opengroup.org/onlinepubs/9699919799/functions/connect.html\">\n POSIX.1-2017 article</a> for normative description.\n\n In addition, the function shall return -1 and set the following errno:\n - [NRF_ESHUTDOWN] Modem was shut down.\n\n In addition, an asynchronous connection attempt shall fail and set NRF_SO_ERROR if:\n - [NRF_EBUSY] Another TLS handshake was ongoing."]
pub fn nrf_connect(
socket: ::core::ffi::c_int,
address: *const nrf_sockaddr,
address_len: nrf_socklen_t,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Send a message on a connected socket.\n\n @details\n See <a href=\"https://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html\">\n POSIX.1-2017 article</a> for normative description.\n\n In addition, the function shall return -1 and set the following errno:\n - [NRF_ESHUTDOWN] Modem was shut down.\n - [NRF_ECANCELED] Operation canceled because of APN rate control.\n - [NRF_ENOMEM] TCP stream interrupted because of no heap memory.\n - [NRF_EPROTO] Request failed because DTLS context was serialized."]
pub fn nrf_send(
socket: ::core::ffi::c_int,
buffer: *const ::core::ffi::c_void,
length: usize,
flags: ::core::ffi::c_int,
) -> isize;
}
extern "C" {
#[doc = " Send a message on a socket.\n\n @details\n See <a href=\"https://pubs.opengroup.org/onlinepubs/9699919799/functions/sendto.html\">\n POSIX.1-2017 article</a> for normative description.\n\n In addition, the function shall return -1 and set the following errno:\n - [NRF_ESHUTDOWN] Modem was shut down.\n - [NRF_ECANCELED] Operation canceled because of APN rate control.\n - [NRF_ENOMEM] TCP stream interrupted because of no heap memory.\n - [NRF_EPROTO] Request failed because DTLS context was serialized."]
pub fn nrf_sendto(
socket: ::core::ffi::c_int,
message: *const ::core::ffi::c_void,
length: usize,
flags: ::core::ffi::c_int,
dest_addr: *const nrf_sockaddr,
dest_len: nrf_socklen_t,
) -> isize;
}
extern "C" {
#[doc = " Receive a message from a connected socket.\n\n @details\n See <a href=\"https://pubs.opengroup.org/onlinepubs/9699919799/functions/recv.html\">\n POSIX.1-2017 article</a> for normative description.\n\n In addition, the function shall return -1 and set the following errno:\n - [NRF_ESHUTDOWN] Modem was shut down.\n - [NRF_ENOMEM] TCP stream interrupted because of no heap memory."]
pub fn nrf_recv(
socket: ::core::ffi::c_int,
buffer: *mut ::core::ffi::c_void,
length: usize,
flags: ::core::ffi::c_int,
) -> isize;
}
extern "C" {
#[doc = " Receive a message from a socket.\n\n @details\n See <a href=\"https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvfrom.html\">\n POSIX.1-2017 article</a> for normative description.\n\n In addition, the function shall return -1 and set the following errno:\n - [NRF_ESHUTDOWN] Modem was shut down.\n - [NRF_ENOMEM] TCP stream interrupted because of no heap memory."]
pub fn nrf_recvfrom(
socket: ::core::ffi::c_int,
buffer: *mut ::core::ffi::c_void,
length: usize,
flags: ::core::ffi::c_int,
address: *mut nrf_sockaddr,
address_len: *mut nrf_socklen_t,
) -> isize;
}
#[doc = " This structure is used to describe which events to poll for a given socket."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_pollfd {
#[doc = " Socket handle"]
pub fd: ::core::ffi::c_int,
#[doc = " The input event flags"]
pub events: ::core::ffi::c_short,
#[doc = " The output event flags"]
pub revents: ::core::ffi::c_short,
}
#[test]
fn bindgen_test_layout_nrf_pollfd() {
const UNINIT: ::core::mem::MaybeUninit<nrf_pollfd> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_pollfd>(),
8usize,
concat!("Size of: ", stringify!(nrf_pollfd))
);
assert_eq!(
::core::mem::align_of::<nrf_pollfd>(),
4usize,
concat!("Alignment of ", stringify!(nrf_pollfd))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).fd) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_pollfd),
"::",
stringify!(fd)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).events) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_pollfd),
"::",
stringify!(events)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).revents) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(nrf_pollfd),
"::",
stringify!(revents)
)
);
}
#[doc = " Callback for poll events"]
pub type nrf_modem_pollcb_t = ::core::option::Option<unsafe extern "C" fn(pollfd: *mut nrf_pollfd)>;
#[doc = " * `nrf_poll()` - callback"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_pollcb {
#[doc = " Callback function"]
pub callback: nrf_modem_pollcb_t,
#[doc = " Events mask"]
pub events: ::core::ffi::c_short,
#[doc = " Oneshot callback.\n If * `true` - , unset the callback after invoking it."]
pub oneshot: bool_,
}
#[test]
fn bindgen_test_layout_nrf_modem_pollcb() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_pollcb> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_pollcb>(),
8usize,
concat!("Size of: ", stringify!(nrf_modem_pollcb))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_pollcb>(),
4usize,
concat!("Alignment of ", stringify!(nrf_modem_pollcb))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).callback) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_pollcb),
"::",
stringify!(callback)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).events) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_pollcb),
"::",
stringify!(events)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).oneshot) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_pollcb),
"::",
stringify!(oneshot)
)
);
}
extern "C" {
#[doc = " Poll multiple sockets for events.\n\n @details\n See <a href=\"https://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html\">\n POSIX.1-2017 article</a> for normative description.\n\n @note In Modem library, this function works only with Modem library sockets,\n not arbitrary file descriptors."]
pub fn nrf_poll(
fds: *mut nrf_pollfd,
nfds: nrf_nfds_t,
timeout: ::core::ffi::c_int,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Set the socket options.\n\n @details\n See <a href=\"https://pubs.opengroup.org/onlinepubs/9699919799/functions/setsockopt.html\">\n POSIX.1-2017 article</a> for normative description.\n\n @note In Modem library this function supports a subset\n of socket options described by POSIX, but also some additional options.\n\n In addition, the function shall return -1 and set the following errno:\n - [NRF_EAGAIN] The option could not be set when requested, try again.\n - [NRF_EOPNOTSUPP] The option is not supported with the current socket configuration.\n - [NRF_ESHUTDOWN] Modem was shut down."]
pub fn nrf_setsockopt(
socket: ::core::ffi::c_int,
level: ::core::ffi::c_int,
option_name: ::core::ffi::c_int,
option_value: *const ::core::ffi::c_void,
option_len: nrf_socklen_t,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Get the socket options.\n\n @details\n See <a href=\"https://pubs.opengroup.org/onlinepubs/9699919799/functions/getsockopt.html\">\n POSIX.1-2017 article</a> for normative description.\n\n In Modem library this function supports a subset\n of socket options described by POSIX, but also some additional options."]
pub fn nrf_getsockopt(
socket: ::core::ffi::c_int,
level: ::core::ffi::c_int,
option_name: ::core::ffi::c_int,
option_value: *mut ::core::ffi::c_void,
option_len: *mut nrf_socklen_t,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Bind a name to a socket.\n\n @details\n See <a href=\"https://pubs.opengroup.org/onlinepubs/9699919799/functions/bind.html\">\n POSIX.1-2017 article</a> for normative description.\n\n In addition, the function shall return -1 and set the following errno:\n - [NRF_ESHUTDOWN] Modem was shut down."]
pub fn nrf_bind(
socket: ::core::ffi::c_int,
address: *const nrf_sockaddr,
address_len: nrf_socklen_t,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Listen for socket connections and limit the queue of incoming connections.\n\n @details\n See <a href=\"https://pubs.opengroup.org/onlinepubs/9699919799/functions/listen.html\">\n POSIX.1-2017 article</a> for normative description.\n\n In addition, the function shall return -1 and set the following errno:\n - [NRF_ESHUTDOWN] Modem was shut down."]
pub fn nrf_listen(sock: ::core::ffi::c_int, backlog: ::core::ffi::c_int) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Accept a new connection a socket.\n\n @details\n See <a href=\"https://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html\">\n POSIX.1-2017 article</a> for normative description.\n\n In addition, the function shall return -1 and set the following errno:\n - [NRF_ESHUTDOWN] Modem was shut down."]
pub fn nrf_accept(
socket: ::core::ffi::c_int,
address: *mut nrf_sockaddr,
address_len: *mut nrf_socklen_t,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Convert IPv4 and IPv6 addresses between binary and text form.\n\n @details\n See <a href=\"https://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_pton.html\">\n POSIX.1-2017 article</a> for normative description."]
pub fn nrf_inet_pton(
af: ::core::ffi::c_int,
src: *const ::core::ffi::c_char,
dst: *mut ::core::ffi::c_void,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Convert IPv4 and IPv6 addresses between binary and text form.\n\n @details\n See <a href=\"https://pubs.opengroup.org/onlinepubs/9699919799/functions/inet_ntop.html\">\n POSIX.1-2017 article</a> for normative description."]
pub fn nrf_inet_ntop(
af: ::core::ffi::c_int,
src: *const ::core::ffi::c_void,
dst: *mut ::core::ffi::c_char,
size: nrf_socklen_t,
) -> *const ::core::ffi::c_char;
}
extern "C" {
#[doc = " Get address information.\n\n @details\n See <a href=\"http://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html\">\n POSIX.1-2017 article</a> for normative description.\n\n In addition, the function shall return -1 and set the following errno:\n - [NRF_ESHUTDOWN] Modem was shut down."]
pub fn nrf_getaddrinfo(
nodename: *const ::core::ffi::c_char,
servname: *const ::core::ffi::c_char,
hints: *const nrf_addrinfo,
res: *mut *mut nrf_addrinfo,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Free address information returned by @ref nrf_getaddrinfo().\n\n @details\n See <a href=\"http://pubs.opengroup.org/onlinepubs/9699919799/functions/freeaddrinfo.html\">\n POSIX.1-2017 article</a> for normative description."]
pub fn nrf_freeaddrinfo(ai: *mut nrf_addrinfo);
}
extern "C" {
#[doc = " Get interface address information.\n\n @details\n Create a linked list of nrf_ifaddrs structures describing the network interfaces\n and store the address of the first item of the list in @p *ifa.\n\n The data returned by this function is dynamically allocated and\n must be freed using @ref nrf_freeifaddrs() when no longer needed.\n\n @param[in, out] ifa First item in the linked list of interface addresses.\n\n Returns 0 on success.\n Returns -1 on error, and set * `errno` - to indicate the reason."]
pub fn nrf_getifaddrs(ifa: *mut *mut nrf_ifaddrs) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Free address information returned by @ref nrf_getifaddrs().\n\n @details\n Free a linked list of nrf_ifaddrs structures.\n\n * `ifa` - First item in the linked list of interface addresses."]
pub fn nrf_freeifaddrs(ifa: *mut nrf_ifaddrs);
}
extern "C" {
#[doc = " Set a secondary DNS address.\n\n @details\n The secondary DNS address is only used in case the primary DNS address is unreachable,\n or if no DNS address is provided by the operator. The secondary DNS address does not\n override the primary DNS address.\n\n @note\n It is not possible to unset a secondary DNS address set using this function.\n\n * `family` - Address family.\n * `in_addr` - An IPv4 or IPv6 address encoded in a nrf_in_addr or\n nrf_in6_addr structure, respectively.\n * `in_size` - Size of the structure pointed to by in_addr.\n\n Returns 0 On success\n Returns -1 On error, and set * `errno` - to indicate the reason.\n\n The function shall return -1 and set the following errno:\n - [NRF_EPERM] The Modem library is not initialized.\n - [NRF_EAFNOSUPPORT] The implementation does not support the specified address family.\n - [NRF_EINVAL] Invalid parameters.\n - [NRF_ENOBUFS] Not enough shared memory for this request.\n - [NRF_ESHUTDOWN] Modem was shut down."]
pub fn nrf_setdnsaddr(
family: ::core::ffi::c_int,
in_addr: *const ::core::ffi::c_void,
in_size: nrf_socklen_t,
) -> ::core::ffi::c_int;
}
#[doc = " Configuration for the #nrf_modem_gnss_1pps_enable function."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_gnss_1pps_config {
#[doc = " Pulse interval in seconds. Range 0...1800s. Value 0 denotes one-time pulse mode."]
pub pulse_interval: u16,
#[doc = " Pulse width in milliseconds. Range 1...500ms."]
pub pulse_width: u16,
#[doc = " If true, pulses are started at given start time. If false, the date and time\n fields are ignored."]
pub apply_start_time: bool_,
#[doc = " Gregorian year. Range 0...4000."]
pub year: u16,
#[doc = " Month of the year. Range 1...12."]
pub month: u8,
#[doc = " Day of the month. Range 1...31."]
pub day: u8,
#[doc = " Hour of the day. Range 0...23."]
pub hour: u8,
#[doc = " Minute of the hour. Range 0...59."]
pub minute: u8,
#[doc = " Second of the minute. Range 0...59."]
pub second: u8,
}
#[test]
fn bindgen_test_layout_nrf_modem_gnss_1pps_config() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_gnss_1pps_config> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_gnss_1pps_config>(),
14usize,
concat!("Size of: ", stringify!(nrf_modem_gnss_1pps_config))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_gnss_1pps_config>(),
2usize,
concat!("Alignment of ", stringify!(nrf_modem_gnss_1pps_config))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pulse_interval) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_1pps_config),
"::",
stringify!(pulse_interval)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pulse_width) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_1pps_config),
"::",
stringify!(pulse_width)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).apply_start_time) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_1pps_config),
"::",
stringify!(apply_start_time)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).year) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_1pps_config),
"::",
stringify!(year)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).month) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_1pps_config),
"::",
stringify!(month)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).day) as usize - ptr as usize },
9usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_1pps_config),
"::",
stringify!(day)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hour) as usize - ptr as usize },
10usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_1pps_config),
"::",
stringify!(hour)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).minute) as usize - ptr as usize },
11usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_1pps_config),
"::",
stringify!(minute)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).second) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_1pps_config),
"::",
stringify!(second)
)
);
}
#[doc = " Date and time."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_gnss_datetime {
#[doc = " 4-digit representation (Gregorian calendar)."]
pub year: u16,
#[doc = " 1...12"]
pub month: u8,
#[doc = " 1...31"]
pub day: u8,
#[doc = " 0...23"]
pub hour: u8,
#[doc = " 0...59"]
pub minute: u8,
#[doc = " 0...59"]
pub seconds: u8,
#[doc = " 0...999"]
pub ms: u16,
}
#[test]
fn bindgen_test_layout_nrf_modem_gnss_datetime() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_gnss_datetime> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_gnss_datetime>(),
10usize,
concat!("Size of: ", stringify!(nrf_modem_gnss_datetime))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_gnss_datetime>(),
2usize,
concat!("Alignment of ", stringify!(nrf_modem_gnss_datetime))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).year) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_datetime),
"::",
stringify!(year)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).month) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_datetime),
"::",
stringify!(month)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).day) as usize - ptr as usize },
3usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_datetime),
"::",
stringify!(day)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hour) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_datetime),
"::",
stringify!(hour)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).minute) as usize - ptr as usize },
5usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_datetime),
"::",
stringify!(minute)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).seconds) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_datetime),
"::",
stringify!(seconds)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ms) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_datetime),
"::",
stringify!(ms)
)
);
}
#[doc = " Space Vehicle (SV) information."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_gnss_sv {
#[doc = " SV number 1...32 for GPS, 193...202 for QZSS."]
pub sv: u16,
#[doc = " Signal type. 0: invalid, 1: GPS L1C/A, 3: QZSS L1C/A, other values are reserved for\n other GNSSes or signals."]
pub signal: u8,
#[doc = " 0.1 dB/Hz."]
pub cn0: u16,
#[doc = " SV elevation angle in degrees."]
pub elevation: i16,
#[doc = " SV azimuth angle in degrees."]
pub azimuth: i16,
#[doc = " See @ref nrf_modem_gnss_sv_flag_bitmask."]
pub flags: u8,
}
#[test]
fn bindgen_test_layout_nrf_modem_gnss_sv() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_gnss_sv> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_gnss_sv>(),
12usize,
concat!("Size of: ", stringify!(nrf_modem_gnss_sv))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_gnss_sv>(),
2usize,
concat!("Alignment of ", stringify!(nrf_modem_gnss_sv))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sv) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_sv),
"::",
stringify!(sv)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).signal) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_sv),
"::",
stringify!(signal)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).cn0) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_sv),
"::",
stringify!(cn0)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).elevation) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_sv),
"::",
stringify!(elevation)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).azimuth) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_sv),
"::",
stringify!(azimuth)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).flags) as usize - ptr as usize },
10usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_sv),
"::",
stringify!(flags)
)
);
}
#[doc = " Position, Velocity and Time (PVT) data frame."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_gnss_pvt_data_frame {
#[doc = " Latitude in degrees."]
pub latitude: f64,
#[doc = " Longitude in degrees."]
pub longitude: f64,
#[doc = " Altitude above WGS-84 ellipsoid in meters."]
pub altitude: f32,
#[doc = " Position accuracy (2D 1-sigma) in meters."]
pub accuracy: f32,
#[doc = " Altitude accuracy (1-sigma) in meters.\n\n @note Only valid with modem firmware v1.3.2 or later."]
pub altitude_accuracy: f32,
#[doc = " Horizontal speed in m/s."]
pub speed: f32,
#[doc = " Speed accuracy (1-sigma) in m/s.\n\n @note Only valid with modem firmware v1.3.0 or later."]
pub speed_accuracy: f32,
#[doc = " Vertical speed in m/s. Positive is up.\n\n @note Only valid with modem firmware v1.3.2 or later."]
pub vertical_speed: f32,
#[doc = " Vertical speed accuracy (1-sigma) in m/s.\n\n @note Only valid with modem firmware v1.3.2 or later."]
pub vertical_speed_accuracy: f32,
#[doc = " Heading of user movement in degrees."]
pub heading: f32,
#[doc = " Heading accuracy (1-sigma) in degrees.\n\n @note Only valid with modem firmware v1.3.2 or later."]
pub heading_accuracy: f32,
#[doc = " Date and time."]
pub datetime: nrf_modem_gnss_datetime,
#[doc = " Position dilution of precision."]
pub pdop: f32,
#[doc = " Horizontal dilution of precision."]
pub hdop: f32,
#[doc = " Vertical dilution of precision."]
pub vdop: f32,
#[doc = " Time dilution of precision."]
pub tdop: f32,
#[doc = " See @ref nrf_modem_gnss_pvt_flag_bitmask."]
pub flags: u8,
#[doc = " Describes up to 12 of the space vehicles used for the measurement."]
pub sv: [nrf_modem_gnss_sv; 12usize],
#[doc = " Cumulative GNSS execution time since last start in milliseconds.\n\n @note Only valid with modem firmware v1.3.2 or later."]
pub execution_time: u32,
}
#[test]
fn bindgen_test_layout_nrf_modem_gnss_pvt_data_frame() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_gnss_pvt_data_frame> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_gnss_pvt_data_frame>(),
232usize,
concat!("Size of: ", stringify!(nrf_modem_gnss_pvt_data_frame))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_gnss_pvt_data_frame>(),
8usize,
concat!("Alignment of ", stringify!(nrf_modem_gnss_pvt_data_frame))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).latitude) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(latitude)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).longitude) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(longitude)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).altitude) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(altitude)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).accuracy) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(accuracy)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).altitude_accuracy) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(altitude_accuracy)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).speed) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(speed)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).speed_accuracy) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(speed_accuracy)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).vertical_speed) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(vertical_speed)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).vertical_speed_accuracy) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(vertical_speed_accuracy)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).heading) as usize - ptr as usize },
44usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(heading)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).heading_accuracy) as usize - ptr as usize },
48usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(heading_accuracy)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).datetime) as usize - ptr as usize },
52usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(datetime)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pdop) as usize - ptr as usize },
64usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(pdop)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).hdop) as usize - ptr as usize },
68usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(hdop)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).vdop) as usize - ptr as usize },
72usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(vdop)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).tdop) as usize - ptr as usize },
76usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(tdop)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).flags) as usize - ptr as usize },
80usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(flags)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sv) as usize - ptr as usize },
82usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(sv)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).execution_time) as usize - ptr as usize },
228usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_pvt_data_frame),
"::",
stringify!(execution_time)
)
);
}
#[doc = " Single null-terminated NMEA sentence."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_gnss_nmea_data_frame {
#[doc = " Null-terminated NMEA sentence."]
pub nmea_str: [::core::ffi::c_char; 83usize],
}
#[test]
fn bindgen_test_layout_nrf_modem_gnss_nmea_data_frame() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_gnss_nmea_data_frame> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_gnss_nmea_data_frame>(),
83usize,
concat!("Size of: ", stringify!(nrf_modem_gnss_nmea_data_frame))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_gnss_nmea_data_frame>(),
1usize,
concat!("Alignment of ", stringify!(nrf_modem_gnss_nmea_data_frame))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).nmea_str) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_nmea_data_frame),
"::",
stringify!(nmea_str)
)
);
}
#[doc = " A-GPS notification data frame used by GNSS to let the application know it needs new A-GPS\n data."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_gnss_agps_data_frame {
#[doc = " Bit mask indicating the satellite PRNs for which the assistance GPS ephemeris\n data is needed."]
pub sv_mask_ephe: u32,
#[doc = " Bit mask indicating the satellite PRNs for which the assistance GPS almanac\n data is needed."]
pub sv_mask_alm: u32,
#[doc = " Indicating what kind of A-GPS data is needed by GNSS.\n\n @details See @ref nrf_modem_gnss_agps_data_bitmask."]
pub data_flags: u32,
}
#[test]
fn bindgen_test_layout_nrf_modem_gnss_agps_data_frame() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_gnss_agps_data_frame> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_gnss_agps_data_frame>(),
12usize,
concat!("Size of: ", stringify!(nrf_modem_gnss_agps_data_frame))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_gnss_agps_data_frame>(),
4usize,
concat!("Alignment of ", stringify!(nrf_modem_gnss_agps_data_frame))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sv_mask_ephe) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_frame),
"::",
stringify!(sv_mask_ephe)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sv_mask_alm) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_frame),
"::",
stringify!(sv_mask_alm)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data_flags) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_frame),
"::",
stringify!(data_flags)
)
);
}
#[doc = " A-GPS data expiry.\n\n @details Expiry times are given in seconds. 0 indicates that data is needed immediately.\n 0xffffffff indicates that data is not used by GNSS.\n\n @note Only supported by modem firmware v1.3.2 or later."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_gnss_agps_expiry {
#[doc = " Flags indicating the A-GPS data types needed by GNSS.\n\n @details See @ref nrf_modem_gnss_agps_data_bitmask. If bit\n @ref NRF_MODEM_GNSS_AGPS_SYS_TIME_AND_SV_TOW_REQUEST is set,\n GNSS doesn't have the GPS system time and all expiry time fields\n for ephemerides and almanacs are set to zero."]
pub data_flags: u32,
#[doc = " Ephemeris expiry time for each GPS satellite."]
pub ephe_expiry: [u32; 32usize],
#[doc = " Almamac expiry time for each GPS satellite."]
pub alm_expiry: [u32; 32usize],
#[doc = " UTC parameters expiry time."]
pub utc_expiry: u32,
#[doc = " Klobuchar ionospheric correction parameters expiry time."]
pub klob_expiry: u32,
#[doc = " NeQuick ionospheric correction parameters expiry time."]
pub neq_expiry: u32,
#[doc = " Integrity assistance parameters expiry time."]
pub integrity_expiry: u32,
#[doc = " Position assistance expiry time."]
pub position_expiry: u32,
}
#[test]
fn bindgen_test_layout_nrf_modem_gnss_agps_expiry() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_gnss_agps_expiry> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_gnss_agps_expiry>(),
280usize,
concat!("Size of: ", stringify!(nrf_modem_gnss_agps_expiry))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_gnss_agps_expiry>(),
4usize,
concat!("Alignment of ", stringify!(nrf_modem_gnss_agps_expiry))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data_flags) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_expiry),
"::",
stringify!(data_flags)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ephe_expiry) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_expiry),
"::",
stringify!(ephe_expiry)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).alm_expiry) as usize - ptr as usize },
132usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_expiry),
"::",
stringify!(alm_expiry)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).utc_expiry) as usize - ptr as usize },
260usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_expiry),
"::",
stringify!(utc_expiry)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).klob_expiry) as usize - ptr as usize },
264usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_expiry),
"::",
stringify!(klob_expiry)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).neq_expiry) as usize - ptr as usize },
268usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_expiry),
"::",
stringify!(neq_expiry)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).integrity_expiry) as usize - ptr as usize },
272usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_expiry),
"::",
stringify!(integrity_expiry)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).position_expiry) as usize - ptr as usize },
276usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_expiry),
"::",
stringify!(position_expiry)
)
);
}
#[doc = " A-GPS UTC parameters."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_gnss_agps_data_utc {
#[doc = " First order term of polynomial (sec/sec). Scale factor 2^-50.\n Range -8388608...8388607 (25 bits)."]
pub a1: i32,
#[doc = " Constant term of polynomial (sec). Scale factor 2^-30."]
pub a0: i32,
#[doc = " UTC reference GPS time-of-week (sec). Scale factor 2^12. Range 0..147."]
pub tot: u8,
#[doc = " UTC reference GPS week number modulo 256."]
pub wn_t: u8,
#[doc = " Current or past leap second count (sec)."]
pub delta_tls: i8,
#[doc = " Leap second reference GPS week number modulo 256."]
pub wn_lsf: u8,
#[doc = " Leap second reference GPS day-of-week (day). Range 1...7."]
pub dn: i8,
#[doc = " Current or future leap second count (sec) (total size\n of the type-specific assistance data)."]
pub delta_tlsf: i8,
}
#[test]
fn bindgen_test_layout_nrf_modem_gnss_agps_data_utc() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_gnss_agps_data_utc> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_gnss_agps_data_utc>(),
16usize,
concat!("Size of: ", stringify!(nrf_modem_gnss_agps_data_utc))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_gnss_agps_data_utc>(),
4usize,
concat!("Alignment of ", stringify!(nrf_modem_gnss_agps_data_utc))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).a1) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_utc),
"::",
stringify!(a1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).a0) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_utc),
"::",
stringify!(a0)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).tot) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_utc),
"::",
stringify!(tot)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).wn_t) as usize - ptr as usize },
9usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_utc),
"::",
stringify!(wn_t)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).delta_tls) as usize - ptr as usize },
10usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_utc),
"::",
stringify!(delta_tls)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).wn_lsf) as usize - ptr as usize },
11usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_utc),
"::",
stringify!(wn_lsf)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).dn) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_utc),
"::",
stringify!(dn)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).delta_tlsf) as usize - ptr as usize },
13usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_utc),
"::",
stringify!(delta_tlsf)
)
);
}
#[doc = " A-GPS ephemeris data."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_gnss_agps_data_ephemeris {
#[doc = " Satellite ID (dimensionless). Range 1...32."]
pub sv_id: u8,
#[doc = " Satellite health (dimensionless)."]
pub health: u8,
#[doc = " Issue of data, clock parameters (dimensionless). Range 0...2047 (11 bits)."]
pub iodc: u16,
#[doc = " Clock parameters reference GPS time-of-week (sec). Scale factor 2^4. Range 0...37799."]
pub toc: u16,
#[doc = " Clock drift rate (sec/sec2). Scale factor 2^-55."]
pub af2: i8,
#[doc = " Clock drift (sec/sec). Scale factor 2^-43."]
pub af1: i16,
#[doc = " Clock bias (sec). Scale factor 2^-31. Range -2097152...2097151 (22 bit)"]
pub af0: i32,
#[doc = " Group delay (sec). Scale factor 2^-31."]
pub tgd: i8,
#[doc = " URA index (dimensionless). Range 0...15."]
pub ura: u8,
#[doc = " Curve fit interval indication. Range 0...1."]
pub fit_int: u8,
#[doc = " Ephemeris parameters reference GPS time-of-week (sec).\n Scale factor 2^4. Range 0...37799."]
pub toe: u16,
#[doc = " Argument of perigee (semi-circle). Scale factor 2^-31."]
pub w: i32,
#[doc = " Mean motion difference (semi-circle/sec). Scale factor 2^-43."]
pub delta_n: i16,
#[doc = " Mean anomaly at reference time (semi-circle). Scale factor 2^-31."]
pub m0: i32,
#[doc = " Rate of right ascension (semi-circle/sec). Scale factor 2^-43.\n Range -8388608...8388607 (24 bits)."]
pub omega_dot: i32,
#[doc = " Eccentricity (dimensionless). Scale factor 2^-33."]
pub e: u32,
#[doc = " Rate of inclination angle (semi-circle/sec). Scale factor 2-43.\n Range -8192...8191 (14 bits)."]
pub idot: i16,
#[doc = " Square root of semi-major axis (m). Scale factor 2^-19."]
pub sqrt_a: u32,
#[doc = " Inclination angle at reference time (semi-circle). Scale factor 2^-31."]
pub i0: i32,
#[doc = " Longitude of ascending node at weekly epoch (semi-circle). Scale factor 2^-31."]
pub omega0: i32,
#[doc = " Orbit radius, sine harmonic amplitude (m). Scale factor 2^-5."]
pub crs: i16,
#[doc = " Inclination angle, sine harmonic amplitude (rad). Scale factor 2^-29."]
pub cis: i16,
#[doc = " Argument of latitude, sine harmonic amplitude (rad). Scale factor 2^-29."]
pub cus: i16,
#[doc = " Orbit radius, cosine harmonic amplitude (m). Scale factor 2^-5."]
pub crc: i16,
#[doc = " Inclination angle, cosine harmonic amplitude (rad). Scale factor 2^-29."]
pub cic: i16,
#[doc = " Argument of latitude, cosine harmonic amplitude (rad). Scale factor 2^-29."]
pub cuc: i16,
}
#[test]
fn bindgen_test_layout_nrf_modem_gnss_agps_data_ephemeris() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_gnss_agps_data_ephemeris> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_gnss_agps_data_ephemeris>(),
72usize,
concat!("Size of: ", stringify!(nrf_modem_gnss_agps_data_ephemeris))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_gnss_agps_data_ephemeris>(),
4usize,
concat!(
"Alignment of ",
stringify!(nrf_modem_gnss_agps_data_ephemeris)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sv_id) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(sv_id)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).health) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(health)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).iodc) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(iodc)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).toc) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(toc)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).af2) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(af2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).af1) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(af1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).af0) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(af0)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).tgd) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(tgd)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ura) as usize - ptr as usize },
17usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(ura)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).fit_int) as usize - ptr as usize },
18usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(fit_int)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).toe) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(toe)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).w) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(w)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).delta_n) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(delta_n)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).m0) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(m0)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).omega_dot) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(omega_dot)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).e) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(e)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).idot) as usize - ptr as usize },
44usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(idot)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sqrt_a) as usize - ptr as usize },
48usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(sqrt_a)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).i0) as usize - ptr as usize },
52usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(i0)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).omega0) as usize - ptr as usize },
56usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(omega0)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).crs) as usize - ptr as usize },
60usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(crs)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).cis) as usize - ptr as usize },
62usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(cis)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).cus) as usize - ptr as usize },
64usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(cus)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).crc) as usize - ptr as usize },
66usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(crc)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).cic) as usize - ptr as usize },
68usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(cic)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).cuc) as usize - ptr as usize },
70usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_ephemeris),
"::",
stringify!(cuc)
)
);
}
#[doc = " A-GPS almanac data."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_gnss_agps_data_almanac {
#[doc = " Satellite ID (dimensionless). Range 1...32."]
pub sv_id: u8,
#[doc = " Almanac reference GPS week number modulo 256."]
pub wn: u8,
#[doc = " Almanac reference GPS time-of-week (sec). Scale factor 2^12. Range 0...147."]
pub toa: u8,
#[doc = " Issue of data, almanac (dimensionless). Range 0...3 (2 bits)."]
pub ioda: u8,
#[doc = " Eccentricity (dimensionless). Scale factor 2^-21."]
pub e: u16,
#[doc = " Correction to inclination (semi-circle). Scale factor 2^-19."]
pub delta_i: i16,
#[doc = " Rate of right ascension (semi-circle/sec). Scale factor 2^-38."]
pub omega_dot: i16,
#[doc = " Satellite health (dimensionless)"]
pub sv_health: u8,
#[doc = " Square root of semi-major axis (m^(1/2)).\n Scale factor 2^-11. Range 0...16777215 (24 bit)."]
pub sqrt_a: u32,
#[doc = " Longitude of ascending node at weekly epoch (semi-circle).\n Scale factor 2^-23. Range -8388608...8388607 (24 bits)."]
pub omega0: i32,
#[doc = " Argument of perigee (semi-circle). Scale factor 2^-23."]
pub w: i32,
#[doc = " Mean anomaly at reference time (semi-circle).\n Scale factor 2^-23. Range -8388608...8388608 (24 bits)."]
pub m0: i32,
#[doc = " Clock bias (sec). Scale factor 2^-20. Range -1024...1023 (11 bits)."]
pub af0: i16,
#[doc = " Clock drift (sec/sec). Scale factor 2^-38. Range -1024...1023 (11 bits)."]
pub af1: i16,
}
#[test]
fn bindgen_test_layout_nrf_modem_gnss_agps_data_almanac() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_gnss_agps_data_almanac> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_gnss_agps_data_almanac>(),
32usize,
concat!("Size of: ", stringify!(nrf_modem_gnss_agps_data_almanac))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_gnss_agps_data_almanac>(),
4usize,
concat!(
"Alignment of ",
stringify!(nrf_modem_gnss_agps_data_almanac)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sv_id) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_almanac),
"::",
stringify!(sv_id)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).wn) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_almanac),
"::",
stringify!(wn)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).toa) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_almanac),
"::",
stringify!(toa)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ioda) as usize - ptr as usize },
3usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_almanac),
"::",
stringify!(ioda)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).e) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_almanac),
"::",
stringify!(e)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).delta_i) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_almanac),
"::",
stringify!(delta_i)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).omega_dot) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_almanac),
"::",
stringify!(omega_dot)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sv_health) as usize - ptr as usize },
10usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_almanac),
"::",
stringify!(sv_health)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sqrt_a) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_almanac),
"::",
stringify!(sqrt_a)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).omega0) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_almanac),
"::",
stringify!(omega0)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).w) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_almanac),
"::",
stringify!(w)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).m0) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_almanac),
"::",
stringify!(m0)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).af0) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_almanac),
"::",
stringify!(af0)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).af1) as usize - ptr as usize },
30usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_almanac),
"::",
stringify!(af1)
)
);
}
#[doc = " A-GPS Klobuchar ionospheric correction data."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_gnss_agps_data_klobuchar {
#[doc = " Constant term (sec). Scale factor 2^-30."]
pub alpha0: i8,
#[doc = " First-order coefficient (sec/semi-circle). Scale factor 2^-27."]
pub alpha1: i8,
#[doc = " Second-order coefficient (sec/semi-circle^2). Scale factor 2^-24."]
pub alpha2: i8,
#[doc = " Third-order coefficient (sec/semi-circle^3). Scale factor 2^-24."]
pub alpha3: i8,
#[doc = " Constant term (sec). Scale factor 2^11."]
pub beta0: i8,
#[doc = " First-order coefficient (sec/semi-circle). Scale factor 2^14."]
pub beta1: i8,
#[doc = " Second-order coefficient (sec/semi-circle^2). Scale factor 2^16."]
pub beta2: i8,
#[doc = " Third-order coefficient (sec/semi-circle^3). Scale factor 2^16."]
pub beta3: i8,
}
#[test]
fn bindgen_test_layout_nrf_modem_gnss_agps_data_klobuchar() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_gnss_agps_data_klobuchar> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_gnss_agps_data_klobuchar>(),
8usize,
concat!("Size of: ", stringify!(nrf_modem_gnss_agps_data_klobuchar))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_gnss_agps_data_klobuchar>(),
1usize,
concat!(
"Alignment of ",
stringify!(nrf_modem_gnss_agps_data_klobuchar)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).alpha0) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_klobuchar),
"::",
stringify!(alpha0)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).alpha1) as usize - ptr as usize },
1usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_klobuchar),
"::",
stringify!(alpha1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).alpha2) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_klobuchar),
"::",
stringify!(alpha2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).alpha3) as usize - ptr as usize },
3usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_klobuchar),
"::",
stringify!(alpha3)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).beta0) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_klobuchar),
"::",
stringify!(beta0)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).beta1) as usize - ptr as usize },
5usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_klobuchar),
"::",
stringify!(beta1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).beta2) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_klobuchar),
"::",
stringify!(beta2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).beta3) as usize - ptr as usize },
7usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_klobuchar),
"::",
stringify!(beta3)
)
);
}
#[doc = " A-GPS NeQuick ionospheric correction data."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_gnss_agps_data_nequick {
#[doc = " Effective ionisation level 1st order parameter (SFU).\n Scale factor 2^-2. Range 0...2047 (11 bits)."]
pub ai0: i16,
#[doc = " Effective ionisation level 2nd order parameter (SFU/deg). Scale factor 2^-8.\n Range -1024...1023 (11 bits)."]
pub ai1: i16,
#[doc = " Effective ionisation level 3rd order parameter (SFU/deg^2). Scale factor 2^-15.\n Range -8192...8191 (14 bits)."]
pub ai2: i16,
#[doc = " Storm condition bit mask indicating the ionospheric\n storm condition for different regions."]
pub storm_cond: u8,
#[doc = " Storm validity bit mask indicating for which regions\n the ionospheric storm condition bit is valid."]
pub storm_valid: u8,
}
#[test]
fn bindgen_test_layout_nrf_modem_gnss_agps_data_nequick() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_gnss_agps_data_nequick> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_gnss_agps_data_nequick>(),
8usize,
concat!("Size of: ", stringify!(nrf_modem_gnss_agps_data_nequick))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_gnss_agps_data_nequick>(),
2usize,
concat!(
"Alignment of ",
stringify!(nrf_modem_gnss_agps_data_nequick)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ai0) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_nequick),
"::",
stringify!(ai0)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ai1) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_nequick),
"::",
stringify!(ai1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ai2) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_nequick),
"::",
stringify!(ai2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).storm_cond) as usize - ptr as usize },
6usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_nequick),
"::",
stringify!(storm_cond)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).storm_valid) as usize - ptr as usize },
7usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_nequick),
"::",
stringify!(storm_valid)
)
);
}
#[doc = " A-GPS TOW assistance data for a SV."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_gnss_agps_data_tow_element {
#[doc = " First two bits (MSB) represent the reserved bit and integrity status flag\n in the telemetry message (TLM) word. The following 14 bits represent the TLM\n being broadcast by the satellite."]
pub tlm: u16,
#[doc = " Bit 0 (LSB): anti-spoof flag. Bit 1: alert flag."]
pub flags: u8,
}
#[test]
fn bindgen_test_layout_nrf_modem_gnss_agps_data_tow_element() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_gnss_agps_data_tow_element> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_gnss_agps_data_tow_element>(),
4usize,
concat!(
"Size of: ",
stringify!(nrf_modem_gnss_agps_data_tow_element)
)
);
assert_eq!(
::core::mem::align_of::<nrf_modem_gnss_agps_data_tow_element>(),
2usize,
concat!(
"Alignment of ",
stringify!(nrf_modem_gnss_agps_data_tow_element)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).tlm) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_tow_element),
"::",
stringify!(tlm)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).flags) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_tow_element),
"::",
stringify!(flags)
)
);
}
#[doc = " A-GPS system time and SV TOW data."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_gnss_agps_data_system_time_and_sv_tow {
#[doc = " Day number since Jan 6th, 1980 00:00:00 UTC (USNO)."]
pub date_day: u16,
#[doc = " Full seconds part of time-of-day (s). Range 0...86399."]
pub time_full_s: u32,
#[doc = " Fraction of a second part of time-of-day (ms). Range 0...999."]
pub time_frac_ms: u16,
#[doc = " Bit mask indicating the satellite PRNs for which the satellite-specific TOW\n assistance data is valid."]
pub sv_mask: u32,
#[doc = " TOW assistance data for SVs."]
pub sv_tow: [nrf_modem_gnss_agps_data_tow_element; 32usize],
}
#[test]
fn bindgen_test_layout_nrf_modem_gnss_agps_data_system_time_and_sv_tow() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_gnss_agps_data_system_time_and_sv_tow> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_gnss_agps_data_system_time_and_sv_tow>(),
144usize,
concat!(
"Size of: ",
stringify!(nrf_modem_gnss_agps_data_system_time_and_sv_tow)
)
);
assert_eq!(
::core::mem::align_of::<nrf_modem_gnss_agps_data_system_time_and_sv_tow>(),
4usize,
concat!(
"Alignment of ",
stringify!(nrf_modem_gnss_agps_data_system_time_and_sv_tow)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).date_day) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_system_time_and_sv_tow),
"::",
stringify!(date_day)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).time_full_s) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_system_time_and_sv_tow),
"::",
stringify!(time_full_s)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).time_frac_ms) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_system_time_and_sv_tow),
"::",
stringify!(time_frac_ms)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sv_mask) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_system_time_and_sv_tow),
"::",
stringify!(sv_mask)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sv_tow) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_system_time_and_sv_tow),
"::",
stringify!(sv_tow)
)
);
}
#[doc = " A-GPS location data."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_gnss_agps_data_location {
#[doc = " Geodetic latitude in WGS-84. Range -8388607...8388607.\n The relation between the coded number N and the latitude\n range X (in degrees) is as follows: N <= (2^23/90) * X < N + 1.\n For N = 2^23 - 1, the range is extended to include N+1.\n Range of X (in degrees) -90...90."]
pub latitude: i32,
#[doc = " Geodetic longitude in WGS-84. Range -8388607..8388607.\n The relation between the coded number N and the longitude range\n X (in degrees) is as follows: N <= (2^24/360) * X < N + 1.\n Range of X (in degrees) -180...180."]
pub longitude: i32,
#[doc = " Altitude. Above (positive value) or below (negative value) WGS-84\n ellipsoid surface. Range -32767...32767.\n The relation between the coded number N and the altitude range a\n (in meters) is as follows: N <= a < N + 1.\n For N = 2^15 - 1 the range is extended to include all greater values of a."]
pub altitude: i16,
#[doc = " Uncertainty, semi-major. Range 0...127 or 255 for missing latitude and longitude.\n The uncertainty (in meters) is mapped from the coded number K with following formula:\n r = C * ((1 + x)^K - 1), where C = 10 and x = 0,1. Range of r (in kilometers) 0...1800.\n\n @note Value 255 is only supported by modem firmware v1.3.0 or later."]
pub unc_semimajor: u8,
#[doc = " Uncertainty, semi-minor. Range 0...127 or 255 for missing latitude and longitude.\n The uncertainty (in meters) is mapped from the coded number K with following formula:\n r = C * ((1 + x)^K - 1), where C = 10 and x = 0,1. Range of r (in kilometers) 0...1800.\n\n @note Value 255 is only supported by modem firmware v1.3.0 or later."]
pub unc_semiminor: u8,
#[doc = " Orientation angle between the major axis and north. Range in degrees 0...179."]
pub orientation_major: u8,
#[doc = " Uncertainty, altitude. Range 0...127 or 255 for missing altitude. The uncertainty in\n altitude h (in meters) is mapped from the coded number K with following formula:\n h = C * ((1 + x)^K - 1), where C = 45 and x = 0,025. Range of h (in meters) 0...990,5.\n\n @note Value 255 is only supported by modem firmware v1.3.0 or later."]
pub unc_altitude: u8,
#[doc = " The confidence level (expressed as a percentage) with which\n the position of a target entity is included within the uncertainty ellipsoid.\n Range 0...128. '0' indicates 'no information'.\n Values 101..128 should be treated as '0'."]
pub confidence: u8,
}
#[test]
fn bindgen_test_layout_nrf_modem_gnss_agps_data_location() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_gnss_agps_data_location> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_gnss_agps_data_location>(),
16usize,
concat!("Size of: ", stringify!(nrf_modem_gnss_agps_data_location))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_gnss_agps_data_location>(),
4usize,
concat!(
"Alignment of ",
stringify!(nrf_modem_gnss_agps_data_location)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).latitude) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_location),
"::",
stringify!(latitude)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).longitude) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_location),
"::",
stringify!(longitude)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).altitude) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_location),
"::",
stringify!(altitude)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).unc_semimajor) as usize - ptr as usize },
10usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_location),
"::",
stringify!(unc_semimajor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).unc_semiminor) as usize - ptr as usize },
11usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_location),
"::",
stringify!(unc_semiminor)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).orientation_major) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_location),
"::",
stringify!(orientation_major)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).unc_altitude) as usize - ptr as usize },
13usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_location),
"::",
stringify!(unc_altitude)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).confidence) as usize - ptr as usize },
14usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_location),
"::",
stringify!(confidence)
)
);
}
#[doc = " A-GPS satellite integrity data."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_gnss_agps_data_integrity {
#[doc = " Bit mask indicating the unhealthy GPS satellite PRNs. When a mask bit is set,\n the corresponding GPS satellite PRN is unhealthy."]
pub integrity_mask: u32,
}
#[test]
fn bindgen_test_layout_nrf_modem_gnss_agps_data_integrity() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_gnss_agps_data_integrity> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_gnss_agps_data_integrity>(),
4usize,
concat!("Size of: ", stringify!(nrf_modem_gnss_agps_data_integrity))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_gnss_agps_data_integrity>(),
4usize,
concat!(
"Alignment of ",
stringify!(nrf_modem_gnss_agps_data_integrity)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).integrity_mask) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_gnss_agps_data_integrity),
"::",
stringify!(integrity_mask)
)
);
}
#[doc = " Event handler prototype.\n\n * `event` - Event ID, see @ref nrf_modem_gnss_event_type."]
pub type nrf_modem_gnss_event_handler_type_t =
::core::option::Option<unsafe extern "C" fn(event: ::core::ffi::c_int)>;
extern "C" {
#[doc = " Sets the GNSS event handler.\n\n @details This function is used to set the function that handles events from GNSS.\n\n @note The event handler is executed in interrupt context so a lot of processing inside the\n handler may have performance implications and side effects. It's recommended to use the\n handler only for signaling or re-scheduling processing to a separate thread. Data can be\n read at any time while GNSS is running, the events are only signaling that the data has\n been updated.\n\n * `handler` - Pointer to the event handler function or NULL.\n\n Returns 0 on success."]
pub fn nrf_modem_gnss_event_handler_set(handler: nrf_modem_gnss_event_handler_type_t) -> i32;
}
extern "C" {
#[doc = " Sets the supported GNSS systems. Systems which have the corresponding bit set are\n enabled.\n\n Default value: All systems supported by the modem firmware are enabled\n\n @note GPS can't be disabled and remains enabled even if the corresponding bit is not set.\n\n * `system_mask` - System bitmask, see @ref nrf_modem_gnss_system_bitmask.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The GNSS stack returned an error or\n the operation cannot be executed while GNSS is running.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_system_mask_set(system_mask: u8) -> i32;
}
extern "C" {
#[doc = " Set below which elevation angle GNSS should stop tracking a satellite.\n\n @details Satellites with elevation angle less than the threshold are excluded from the\n estimation.\n\n Default value: 5 deg\n\n * `angle` - Value between 0 and 90 (degrees above the horizon).\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The GNSS stack returned an error or\n the operation cannot be executed while GNSS is running.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_elevation_threshold_set(angle: u8) -> i32;
}
extern "C" {
#[doc = " Sets targeted start and runtime performance.\n\n @details Default value: #NRF_MODEM_GNSS_USE_CASE_MULTIPLE_HOT_START\n\n * `use_case` - Bit mask, see @ref nrf_modem_gnss_use_case_bitmask.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The GNSS stack returned an error or\n the operation cannot be executed while GNSS is running.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_use_case_set(use_case: u8) -> i32;
}
extern "C" {
#[doc = " Sets the GNSS fix interval in seconds.\n\n @details Single fix navigation mode is engaged by setting the fix interval to 0.\n\n Continuous navigation mode is engaged by setting fix interval to 1.\n\n Periodic navigation mode is engaged by setting the fix interval to value 10...65535. The unit is\n seconds.\n\n Default value: 1 (continuous navigation)\n\n @note Fix interval values over 1800 seconds are only supported by modem firmware v1.3.0 or later.\n\n @note In periodic navigation mode, when GNSS determines it needs to download ephemerides or\n almanacs from the broadcast, the fix interval and fix retry parameters are temporarily\n ignored. GNSS will perform scheduled downloads until it has downloaded the data it needs,\n after which normal operation is resumed.\n\n * `fix_interval` - 0 for single fix, 1 for continuous navigation or fix interval in seconds.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The GNSS stack returned an error or\n the operation cannot be executed while GNSS is running.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_fix_interval_set(fix_interval: u16) -> i32;
}
extern "C" {
#[doc = " Sets the GNSS fix retry period in seconds.\n\n @details Fix retry parameter controls the maximum time the GNSS receiver is allowed to run while\n trying to produce a valid PVT estimate. If the fix retry time is non-zero, the GNSS\n receiver is turned off after the fix retry time is up regardless of whether a valid PVT\n estimate was produced or not. If fix retry parameter is set to zero, the GNSS receiver\n is allowed to run indefinitely until a valid PVT estimate is produced.\n\n Default value: 60s\n\n @note For the first fix in periodic navigation mode the GNSS receiver is allowed to run for 60\n seconds even if the retry interval is set shorter.\n\n @note Fix retry has no effect in continuous navigation mode.\n\n * `fix_retry` - Fix retry period in seconds.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The GNSS stack returned an error or\n the operation cannot be executed while GNSS is running.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_fix_retry_set(fix_retry: u16) -> i32;
}
extern "C" {
#[doc = " Sets which NMEA strings are enabled.\n\n @details Default value: 0\n\n * `nmea_mask` - Bit mask, see @ref nrf_modem_gnss_nmea_string_bitmask.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The GNSS stack returned an error or\n the operation cannot be executed while GNSS is running.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_nmea_mask_set(nmea_mask: u16) -> i32;
}
extern "C" {
#[doc = " Sets the used power saving mode.\n\n @details Valid only in continuous navigation mode.\n\n Default value: #NRF_MODEM_GNSS_PSM_DISABLED\n\n * `power_mode` - See @ref nrf_modem_gnss_power_save_modes.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The GNSS stack returned an error or\n the operation cannot be executed while GNSS is running.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_power_mode_set(power_mode: u8) -> i32;
}
extern "C" {
#[doc = " Sets the used timing source during GNSS sleep.\n\n @details Using TCXO instead of RTC during GNSS sleep periods might be beneficial when used with\n 1PPS. When GNSS is not running all the time (periodic navigation or duty cycling is\n used), 1PPS accuracy can be improved by using TCXO. It may also improve sensitivity for\n periodic navigation when the fix interval is short.\n\n Default value: #NRF_MODEM_GNSS_TIMING_SOURCE_RTC\n\n @note Use of TCXO significantly raises the idle current consumption.\n\n @note This feature is only supported by modem firmware v1.3.0 or later.\n\n * `timing_source` - See @ref nrf_modem_gnss_timing_source.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The GNSS stack returned an error or\n the operation cannot be executed while GNSS is running.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_timing_source_set(timing_source: u8) -> i32;
}
extern "C" {
#[doc = " Sets the used QZSS NMEA mode.\n\n @details NMEA 4.10 standard does not support QZSS satellites, so in standard NMEA mode QZSS\n satellites are not reported in GPGSA and GPGSV sentences. In custom NMEA mode satellite\n IDs 193...202 are used for QZSS satellites.\n\n Default value: #NRF_MODEM_GNSS_QZSS_NMEA_MODE_STANDARD\n\n @note This feature is only supported by modem firmware v1.3.0 or later.\n\n * `nmea_mode` - See @ref nrf_modem_gnss_qzss_nmea_mode.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The GNSS stack returned an error or\n the operation cannot be executed while GNSS is running.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_qzss_nmea_mode_set(nmea_mode: u8) -> i32;
}
extern "C" {
#[doc = " Sets which QZSS PRNs are enabled.\n\n @details QZSS satellite acquisition and tracking can be configured per satellite using QZSS PRN\n mask. Bits 0...9 correspond to QZSS PRNs 193...202, respectively. When a bit is set,\n usage of the corresponding QZSS satellite is enabled. Bits 10...15 are reserved and\n their value is ignored.\n\n Default value: All QZSS PRNs (193...202) are enabled.\n\n @note This feature is only supported by modem firmware v1.3.0 or later.\n\n * `prn_mask` - QZSS PRN mask.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The GNSS stack returned an error or\n the operation cannot be executed while GNSS is running.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_qzss_prn_mask_set(prn_mask: u16) -> i32;
}
extern "C" {
#[doc = " Starts GNSS.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The GNSS stack returned an error.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_start() -> i32;
}
extern "C" {
#[doc = " Stops GNSS.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The GNSS stack returned an error.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_stop() -> i32;
}
extern "C" {
#[doc = " Deletes GNSS data from non-volatile memory.\n\n @details This function is used to delete downloaded data objects stored in non-volatile memory.\n The GNSS module stores this between sessions to get a fix faster on the next startup.\n This can for instance be used to trigger cold or warm starts.\n\n @note This is considered a debug feature, and is not supposed to be used in production code.\n\n * `delete_mask` - Objects to be deleted as a bitmask, see\n @ref nrf_modem_gnss_delete_bitmask.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The GNSS stack returned an error or\n the operation cannot be executed while GNSS is running.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_nv_data_delete(delete_mask: u32) -> i32;
}
extern "C" {
#[doc = " Enables GNSS priority over LTE idle mode procedures.\n\n @details GNSS can produce a cold start fix when there are long enough gaps in LTE idle mode\n operations. LTE idle eDRX cycles approximately 1 min and above will usually guarantee\n the ability to produce a fix. Shorter DRX cycles will be enough after GNSS has got\n ephemerides. GNSS priority can be enabled to help getting GNSS into that state, if there\n are not long enough gaps in LTE idle mode functionality. Priority for GNSS should be\n used only when fix has been blocked by LTE idle mode operations, which can be detected\n by #NRF_MODEM_GNSS_PVT_FLAG_NOT_ENOUGH_WINDOW_TIME bit being set in the PVT data frame\n flags member. The application should not make the decision based on a single PVT event,\n but should enable priority only in case this flag has been set in several consecutive\n PVT events. Priority will be disabled automatically after producing the first fix.\n\n @note GNSS priority may interfere with LTE operations, if possible it would be good to time the\n use of priority to moments where data transfer is not anticipated. In general, long enough\n eDRX cycles, or PSM, will ensure better functionality for both GNSS and LTE.\n\n @note Priority will not stop LTE connections.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The GNSS stack returned an error or\n the operation cannot be executed while GNSS is stopped.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_prio_mode_enable() -> i32;
}
extern "C" {
#[doc = " Disables GNSS priority over LTE idle mode procedures.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The GNSS stack returned an error or\n the operation cannot be executed while GNSS is stopped.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_prio_mode_disable() -> i32;
}
extern "C" {
#[doc = " Changes GNSS dynamics mode.\n\n @details Dynamics mode can be used to tune GNSS performance for a specific use case. Use of a\n matching dynamics mode improves the positioning performance. Dynamics mode can be\n changed without disruption in positioning. The selected dynamics mode is stored into\n non-volatile memory.\n\n Default value: #NRF_MODEM_GNSS_DYNAMICS_GENERAL_PURPOSE\n\n @note This feature is only supported by modem firmware v1.3.0 or later.\n\n * `mode` - Selected dynamics mode, see @ref nrf_modem_gnss_dynamics_mode.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The GNSS stack returned an error or\n the operation cannot be executed while GNSS is stopped.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_dyn_mode_change(mode: u32) -> i32;
}
extern "C" {
#[doc = " Enables 1PPS functionality.\n\n @details #nrf_modem_gnss_1pps_config contains the used 1PPS configuration. GNSS only starts\n giving pulses after it has got at least one fix. After this, the pulses will continue\n also when GNSS is no longer running, but the precision will start degrading.\n\n @note This feature is only supported by modem firmware v1.3.0 or later.\n\n @note 1PPS accuracy is not guaranteed when LTE is active.\n\n * `config` - Pointer to the configuration struct.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The config pointer is NULL, GNSS returned an error or\n the operation cannot be executed while GNSS is running.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_1pps_enable(config: *const nrf_modem_gnss_1pps_config) -> i32;
}
extern "C" {
#[doc = " Disables 1PPS functionality.\n\n @note This feature is only supported by modem firmware v1.3.0 or later.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The GNSS stack returned an error or\n the operation cannot be executed while GNSS is running.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_1pps_disable() -> i32;
}
extern "C" {
#[doc = " Reads data from GNSS.\n\n @details This function is used to read any data from GNSS. The data type is specified using the\n type argument to this function.\n\n * `buf` - Pointer to a buffer that can hold the selected data type.\n * `buf_len` - Length of the buffer.\n * `type` - The data type to read, see @ref nrf_modem_gnss_data_type.\n\n Returns 0 on success.\n Returns -NRF_EINVAL The selected data type don't exist or supplied buffer is NULL.\n Returns -NRF_EMSGSIZE The buffer supplied by the application is too small for the selected\n data type.\n Returns -NRF_ENOMSG There is no data to read for the selected data type."]
pub fn nrf_modem_gnss_read(
buf: *mut ::core::ffi::c_void,
buf_len: i32,
type_: ::core::ffi::c_int,
) -> i32;
}
extern "C" {
#[doc = " Writes A-GPS data to GNSS.\n\n @details This function is used to write A-GPS data to GNSS to decrease the time to first fix.\n\n * `buf` - Pointer to a buffer that contain A-GPS data.\n * `buf_len` - Length of the buffer.\n * `type` - A-GPS data type identifier, see @ref nrf_modem_gnss_agps_data_type.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The buffer supplied by the application is NULL, buffer length is 0,\n the A-GPS data type doesn't exist or the A-GPS data was not accepted by GNSS.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_agps_write(
buf: *mut ::core::ffi::c_void,
buf_len: i32,
type_: u16,
) -> i32;
}
extern "C" {
#[doc = " Reads the current A-GPS data need and expiry times from GNSS.\n\n @details Returns detailed information about the current GNSS A-GPS data need. The data\n structure contains expiry times in seconds for different types of assistance data.\n This function can be called at any time. If GNSS doesn't know the current GPS\n system time, the expiry times can not be calculated\n\n @note When A-GPS data has been injected but GNSS has not yet been started, ephemerides and\n almanacs are in some cases reported as expired. This happens when ephemerides and almanacs\n are injected before GPS system time. This can be prevented by either injecting GPS system\n time before ephemerides and almanacs or briefly starting and stopping GNSS before calling\n the function.\n\n @note Only supported by modem firmware v1.3.2 or later.\n\n * `agps_expiry` - Pointer to a buffer where the data is stored to.\n\n Returns 0 on success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EACCES GNSS is not enabled in system or functional mode.\n Returns -NRF_EINVAL The buffer supplied by the application is NULL or\n The GNSS stack returned an error.\n Returns -NRF_ENOMEM There is not enough shared memory for this request.\n Returns -NRF_EOPNOTSUPP The operation is not supported by the modem firmware.\n Returns -NRF_ESHUTDOWN The modem was shut down."]
pub fn nrf_modem_gnss_agps_expiry_get(agps_expiry: *mut nrf_modem_gnss_agps_expiry) -> i32;
}
#[doc = " Modem UUID."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_delta_dfu_uuid {
pub data: [u8; 36usize],
}
#[test]
fn bindgen_test_layout_nrf_modem_delta_dfu_uuid() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_delta_dfu_uuid> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_delta_dfu_uuid>(),
36usize,
concat!("Size of: ", stringify!(nrf_modem_delta_dfu_uuid))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_delta_dfu_uuid>(),
1usize,
concat!("Alignment of ", stringify!(nrf_modem_delta_dfu_uuid))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_delta_dfu_uuid),
"::",
stringify!(data)
)
);
}
extern "C" {
#[doc = " Retrieve the modem firmware UUID.\n\n * `modem_uuid` - Modem firmware UUID.\n\n Returns 0 On success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_ENOMEM Not enough shared memory for this request.\n Returns -NRF_EFAULT If * `modem_uuid` - is NULL.\n Returns -NRF_ESHUTDOWN Modem was shut down.\n @returns A positive error code from @ref nrf_modem_delta_dfu_errors,\n\t if the modem refused the operation."]
pub fn nrf_modem_delta_dfu_uuid(
modem_uuid: *mut nrf_modem_delta_dfu_uuid,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Retrieve the offset of the firmware image in the modem DFU area.\n\n The offset will be zero if no image is in modem DFU area.\n The offset will be * `NRF_MODEM_DELTA_DFU_OFFSET_DIRTY` - if the modem DFU area needs\n to be erased before a new firmware update can be received.\n\n * `off` - Offset of the firmware image.\n\n Returns 0 On success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_ENOMEM Not enough shared memory for this request.\n Returns -NRF_EFAULT If * `off` - is NULL.\n Returns -NRF_ESHUTDOWN Modem was shut down.\n @returns A positive error code from @ref nrf_modem_delta_dfu_errors,\n\t if the modem refused the operation."]
pub fn nrf_modem_delta_dfu_offset(off: *mut usize) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Retrieve the size of the modem DFU area.\n\n The size of the modem DFU area is the size of the FLASH area\n that the modem can use to receive an incoming firmware update.\n\n * `size` - Size of the modem DFU area.\n\n Returns 0 On success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_ENOMEM Not enough shared memory for this request.\n Returns -NRF_EFAULT If * `size` - is NULL.\n Returns -NRF_ESHUTDOWN Modem was shut down.\n @returns A positive error code from @ref nrf_modem_delta_dfu_errors,\n\t if the modem refused the operation."]
pub fn nrf_modem_delta_dfu_area(size: *mut usize) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Ready the modem to receive a firmware update.\n\n Ready the modem to receive a firmware update, acquiring the necessary resources.\n When a firmware update is not in progress, call * `nrf_modem_delta_dfu_write_done` - \n to release all resources.\n\n @note All functions of this interface, except * `nrf_modem_delta_dfu_write` - ,\n\t are available regardless of the initialization status.\n\n Returns 0 On success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EALREADY Write already initialized.\n Returns -NRF_ENOMEM Not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN Modem was shut down.\n @returns A positive error code from @ref nrf_modem_delta_dfu_errors,\n\t if the modem refused the operation."]
pub fn nrf_modem_delta_dfu_write_init() -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Write bytes from a delta patch to the modem DFU area.\n\n * `src` - Firmware update bytes.\n * `len` - Length of data being written.\n\n Returns 0 On success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EFAULT If * `src` - is NULL.\n Returns -NRF_EINVAL If * `len` - is zero.\n Returns -NRF_ENOMEM Not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN Modem was shut down.\n @returns A positive error code from @ref nrf_modem_delta_dfu_errors,\n\t if the modem refused the operation."]
pub fn nrf_modem_delta_dfu_write(
src: *const ::core::ffi::c_void,
len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Pause receiving a modem firmware update and release resources.\n\n Returns 0 On success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_ENOMEM Not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN Modem was shut down.\n @returns A positive error code from @ref nrf_modem_delta_dfu_errors,\n\t if the modem refused the operation."]
pub fn nrf_modem_delta_dfu_write_done() -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Erase the modem DFU area.\n\n The modem DFU area must be erased before receiving a new firmware update.\n This function will return after commencing the erase operation, but it will\n not wait for its completion. Further calls to the delta DFU APIs will\n return * `MODEM_DELTA_DFU_ERASE_PENDING` - as long as the erase operation is\n pending or ongoing.\n\n The application may poll the offset until it returns zero, to determine\n if the operation has completed.\n\n @note The erase operation may take longer when registered to the network\n\t than when not registered, i.e. in airplane mode.\n\n Returns 0 On success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_ENOMEM Not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN Modem was shut down.\n @returns A positive error code from @ref nrf_modem_delta_dfu_errors,\n\t if the modem refused the operation."]
pub fn nrf_modem_delta_dfu_erase() -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Schedule execution of firmware update.\n\n The modem needs to reboot to run the new firmware.\n To reboot the modem, uninitialize the Modem library and reinitialize it\n using the * `nrf_modem_deinit` - and * `nrf_modem_init` - respectively.\n\n @note The final result of the update operation is reported via\n\t * `nrf_modem_init` - .\n\n Returns 0 On success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_ENOMEM Not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN Modem was shut down.\n @returns A positive error code from @ref nrf_modem_delta_dfu_errors,\n\t if the modem refused the operation."]
pub fn nrf_modem_delta_dfu_update() -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Schedule a rollback to the previous firmware.\n\n The modem needs to reboot to run the previous firmware.\n To reboot the modem, uninitialize the Modem library and reinitialize it\n using the * `nrf_modem_deinit` - and * `nrf_modem_init` - respectively.\n\n @note The final result of the rollback operation is reported via\n\t * `nrf_modem_init` - .\n\n Returns 0 On success.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_ENOMEM Not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN Modem was shut down.\n @returns A positive error code from @ref nrf_modem_delta_dfu_errors,\n\t if the modem refused the operation."]
pub fn nrf_modem_delta_dfu_rollback() -> ::core::ffi::c_int;
}
#[doc = " AT Notification handler prototype.\n\n @note This handler is executed in an interrupt service routine.\n Offload any intensive operation as necessary.\n\n * `notif` - The AT notification."]
pub type nrf_modem_at_notif_handler_t =
::core::option::Option<unsafe extern "C" fn(notif: *const ::core::ffi::c_char)>;
#[doc = " AT response handler prototype.\n\n @note This handler is executed in an interrupt service routine.\n Offload any intensive operations as necessary.\n\n * `resp` - The AT command response."]
pub type nrf_modem_at_resp_handler_t =
::core::option::Option<unsafe extern "C" fn(resp: *const ::core::ffi::c_char)>;
#[doc = " AT filter callback function format\n\n @note This declaration is used for the callback functions\n of AT commands in the nRF SDK.\n\n * `buf` - Buffer to receive the response into.\n * `len` - Buffer length.\n * `at_cmd` - AT command.\n\n Returns 0 On \"OK\" responses.\n @returns A positive value On \"ERROR\", \"+CME ERROR\", and \"+CMS ERROR\" responses.\n\t The type of error can be distinguished using * `nrf_modem_at_err_type` - .\n\t The error value can be retrieved using * `nrf_modem_at_err` - .\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EFAULT * `buf` - or * `fmt` - are * `NULL` - .\n Returns -NRF_ENOMEM Not enough shared memory for this request.\n Returns -NRF_E2BIG The response is larger than the supplied buffer * `buf` - ."]
pub type nrf_modem_at_cmd_custom_handler_t = ::core::option::Option<
unsafe extern "C" fn(
buf: *mut ::core::ffi::c_char,
len: usize,
at_cmd: *mut ::core::ffi::c_char,
) -> ::core::ffi::c_int,
>;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_at_cmd_custom {
pub cmd: *const ::core::ffi::c_char,
pub callback: nrf_modem_at_cmd_custom_handler_t,
}
#[test]
fn bindgen_test_layout_nrf_modem_at_cmd_custom() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_at_cmd_custom> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_at_cmd_custom>(),
8usize,
concat!("Size of: ", stringify!(nrf_modem_at_cmd_custom))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_at_cmd_custom>(),
4usize,
concat!("Alignment of ", stringify!(nrf_modem_at_cmd_custom))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).cmd) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_at_cmd_custom),
"::",
stringify!(cmd)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).callback) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_at_cmd_custom),
"::",
stringify!(callback)
)
);
}
extern "C" {
#[doc = " Set a handler function for AT notifications.\n\n @note The callback is executed in an interrupt service routine.\n\t Take care to offload any processing as appropriate.\n\n * `callback` - The AT notification callback. Use * `NULL` - to unset handler.\n\n Returns 0 On success."]
pub fn nrf_modem_at_notif_handler_set(
callback: nrf_modem_at_notif_handler_t,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Send a formatted AT command to the modem.\n\n Supports all format specifiers of printf() as implemented by the selected C library.\n This function can return a negative value, zero or a positive value.\n\n * `fmt` - Command format.\n @param ... Format arguments.\n\n Returns 0 On \"OK\" responses.\n @returns A positive value On \"ERROR\", \"+CME ERROR\", and \"+CMS ERROR\" responses.\n\t The type of error can be distinguished using * `nrf_modem_at_err_type` - .\n\t The error value can be retrieved using * `nrf_modem_at_err` - .\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EFAULT * `fmt` - is * `NULL` - .\n Returns -NRF_EINVAL Bad format * `fmt` - .\n Returns -NRF_ENOMEM Not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN If modem was shut down."]
pub fn nrf_modem_at_printf(fmt: *const ::core::ffi::c_char, ...) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Send an AT command to the modem and read the formatted response\n\t into the supplied argument list.\n\n Supports all the format specifiers of scanf() as implemented by the selected C library.\n This function does not support retrieving the modem response beyond reading\n the formatted response into the argument list.\n\n * `cmd` - AT command.\n * `fmt` - Response format.\n @param ... Variable argument list.\n\n @returns The number of arguments matched.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EFAULT * `cmd` - or * `fmt` - are * `NULL` - .\n Returns -NRF_EBADMSG No arguments were matched.\n Returns -NRF_ENOMEM Not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN If the modem was shut down."]
pub fn nrf_modem_at_scanf(
cmd: *const ::core::ffi::c_char,
fmt: *const ::core::ffi::c_char,
...
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Send a formatted AT command to the modem\n\t and receive the response into the supplied buffer.\n\n * `buf` - Buffer to receive the response into.\n * `len` - Buffer length.\n * `fmt` - Command format.\n @param ... Format arguments.\n\n Returns 0 On \"OK\" responses.\n @returns A positive value On \"ERROR\", \"+CME ERROR\", and \"+CMS ERROR\" responses.\n\t The type of error can be distinguished using * `nrf_modem_at_err_type` - .\n\t The error value can be retrieved using * `nrf_modem_at_err` - .\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EFAULT * `buf` - or * `fmt` - are * `NULL` - .\n Returns -NRF_EINVAL Bad format * `fmt` - , or * `len` - is zero.\n Returns -NRF_ENOMEM Not enough shared memory for this request.\n Returns -NRF_E2BIG The response is larger than the supplied buffer * `buf` - .\n Returns -NRF_ESHUTDOWN If the modem was shut down."]
pub fn nrf_modem_at_cmd(
buf: *mut ::core::ffi::c_void,
len: usize,
fmt: *const ::core::ffi::c_char,
...
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Send a formatted AT command to the modem\n\t and receive the response asynchronously via a callback.\n\n This function waits for the Modem to acknowledge the AT command\n but will return without waiting for the command execution.\n\n @note The callback is executed in an interrupt context.\n\t Take care to offload any processing as appropriate.\n\n * `callback` - Callback to receive the response.\n * `fmt` - Command format.\n @param ... Format arguments.\n\n Returns 0 On \"OK\" responses.\n Returns -NRF_EPERM The Modem library is not initialized.\n Returns -NRF_EFAULT * `callback` - or * `fmt` - are * `NULL` - .\n Returns -NRF_EINVAL Bad format * `fmt` - .\n Returns -NRF_EINPROGRESS An asynchrounous request is already in progress.\n Returns -NRF_ENOMEM Not enough shared memory for this request.\n Returns -NRF_ESHUTDOWN If the modem was shut down."]
pub fn nrf_modem_at_cmd_async(
callback: nrf_modem_at_resp_handler_t,
fmt: *const ::core::ffi::c_char,
...
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Set a list of custom AT commands that are implemented in the application.\n\n When a custom AT command list is set, AT commands sent via * `nrf_modem_at_cmd` - that match any\n AT command in the list, will be redirected to the custom callback function instead\n of being sent to the modem.\n\n @note The custom commands are disabled by passing NULL to the * `custom_commands` - and\n 0 to the * `len` - .\n\n * `custom_commands` - List of custom AT commands.\n * `len` - Custom AT command list size.\n\n Returns 0 On success.\n Returns -NRF_EINVAL On invalid parameters."]
pub fn nrf_modem_at_cmd_custom_set(
custom_commands: *mut nrf_modem_at_cmd_custom,
len: usize,
) -> ::core::ffi::c_int;
}
#[doc = " Storage for 256-bit digest/hash replies.\n Endianness not converted."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_bootloader_digest {
pub data: [u8; 32usize],
}
#[test]
fn bindgen_test_layout_nrf_modem_bootloader_digest() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_bootloader_digest> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_bootloader_digest>(),
32usize,
concat!("Size of: ", stringify!(nrf_modem_bootloader_digest))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_bootloader_digest>(),
1usize,
concat!("Alignment of ", stringify!(nrf_modem_bootloader_digest))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_bootloader_digest),
"::",
stringify!(data)
)
);
}
#[doc = " Modem UUID response."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_bootloader_uuid {
pub data: [u8; 36usize],
}
#[test]
fn bindgen_test_layout_nrf_modem_bootloader_uuid() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_bootloader_uuid> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_bootloader_uuid>(),
36usize,
concat!("Size of: ", stringify!(nrf_modem_bootloader_uuid))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_bootloader_uuid>(),
1usize,
concat!("Alignment of ", stringify!(nrf_modem_bootloader_uuid))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_bootloader_uuid),
"::",
stringify!(data)
)
);
}
extern "C" {
#[doc = " Write a segment of the bootloader to the modem.\n\n Call after nrf_modem_bootloader_init() to upload the modem bootloader segments.\n Bootloader segments are appended together, so the bootloader\n may be uploaded with one or more call to this function.\n Once the entire bootloader is uploaded, call nrf_modem_bootloader_update().\n\n Firmware segments can be uploaded after successful bootloader upload.\n\n * `src` - Pointer to the buffer where chunk data is stored.\n * `len` - Length of data to be written.\n\n Returns 0 on success.\n Returns -NRF_EINVAL When src pointer is NULL or user tries to upload too big bootloader.\n Returns -NRF_EOPNOTSUPP If the modem is not in a state to receive."]
pub fn nrf_modem_bootloader_bl_write(
src: *mut ::core::ffi::c_void,
len: u32,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Write a segment of the firmware to the modem.\n\n Call after the modem bootloader have been written and updated\n to upload the modem firmware segments.\n Firmware segments are appended together, so the firmware\n may be uploaded with one or more call to this function.\n Once the entire firmware is uploaded, call nrf_modem_bootloader_update().\n\n * `addr` - Address to write the data to.\n * `src` - Pointer to the start of the buffer where the data to write is stored.\n * `len` - Length of the data to be written.\n\n Returns 0 on success.\n Returns -NRF_EINVAL When src pointer is NULL, or user tries to upload too big\n bootloader, or addr parameter is zero after a bootloader\n upload.\n Returns -NRF_EOPNOTSUPP If the modem is not in a state to receive.\n Returns -NRF_EPERM When modem did not accept the flash programming request.\n Returns -NRF_ENOEXEC When flash programming failed.\n Returns -NRF_ETIMEDOUT When modem did not respond.\n Returns -NRF_EIO When incorrect response received from modem."]
pub fn nrf_modem_bootloader_fw_write(
addr: u32,
src: *mut ::core::ffi::c_void,
len: u32,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Complete bootloader or firmware update.\n\n This call ensures that all parts from internal update buffers have been written\n to the modem. Call after the final bootloader segment or the final firmware segment\n has been written.\n\n Returns 0 on success.\n Returns -NRF_EOPNOTSUPP If the modem is not in a state to receive.\n Returns -NRF_EPERM When modem did not accept the flash programming request.\n Returns -NRF_ENOEXEC When flash programming failed.\n Returns -NRF_ETIMEDOUT When modem did not respond.\n Returns -NRF_EIO When incorrect response received from modem."]
pub fn nrf_modem_bootloader_update() -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Read a digest hash data from the modem.\n\n * `addr` - Start address.\n * `size` - Size of hash data.\n * `digest_buffer` - Pointer to the buffer to store digest hash data.\n\n Returns 0 on success.\n Returns -NRF_EINVAL When digest_buffer pointer is NULL.\n Returns -NRF_EOPNOTSUPP If bootloader is not programmed.\n Returns -NRF_EPERM When modem did not accept RPC command.\n Returns -NRF_ENOEXEC When RPC command failed.\n Returns -NRF_ETIMEDOUT When modem did not respond.\n Returns -NRF_EIO When incorrect response received from modem."]
pub fn nrf_modem_bootloader_digest(
addr: u32,
size: u32,
digest_buffer: *mut nrf_modem_bootloader_digest,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Read modem UUID data.\n\n * `modem_uuid` - Pointer to the buffer to store uuid data.\n\n Returns 0 on success.\n Returns -NRF_EINVAL When modem_uuid pointer is NULL.\n Returns -NRF_EOPNOTSUPP If bootloader is not programmed.\n Returns -NRF_EPERM When modem did not accept RPC command.\n Returns -NRF_ENOEXEC When RPC command failed.\n Returns -NRF_ETIMEDOUT When modem did not respond.\n Returns -NRF_EIO When incorrect response received from modem."]
pub fn nrf_modem_bootloader_uuid(
modem_uuid: *mut nrf_modem_bootloader_uuid,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Verify the modem' firmware signature.\n\n * `data` - Pointer to the buffer where the signature is stored.\n * `len` - Size of the signature.\n\n Returns 0 on success.\n Returns -NRF_EINVAL When data pointer is NULL.\n Returns -NRF_EPERM When modem did not accept RPC command.\n Returns -NRF_ENOEXEC When RPC command failed.\n Returns -NRF_ETIMEDOUT When modem did not respond.\n Returns -NRF_EIO When incorrect response received from modem."]
pub fn nrf_modem_bootloader_verify(
data: *const ::core::ffi::c_void,
len: u32,
) -> ::core::ffi::c_int;
}
#[doc = " Trace data\n Structure to store trace data pointers and their respective sizes."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_modem_trace_data {
pub data: *const ::core::ffi::c_void,
pub len: usize,
}
#[test]
fn bindgen_test_layout_nrf_modem_trace_data() {
const UNINIT: ::core::mem::MaybeUninit<nrf_modem_trace_data> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_modem_trace_data>(),
8usize,
concat!("Size of: ", stringify!(nrf_modem_trace_data))
);
assert_eq!(
::core::mem::align_of::<nrf_modem_trace_data>(),
4usize,
concat!("Alignment of ", stringify!(nrf_modem_trace_data))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).data) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_trace_data),
"::",
stringify!(data)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).len) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_modem_trace_data),
"::",
stringify!(len)
)
);
}
extern "C" {
#[doc = " Get trace data\n\n The application shall call this function to receive trace data from the modem.\n The trace fragments must be processed in order from the start of the array.\n Processed data must be freed by calling * `nrf_modem_trace_processed` - .\n\n * `frags` - On success, @c *frags is an array of trace data fragments.\n * `n_frags` - On success, @c *n_frags is the number of fragments in the @c *frags array.\n * `timeout` - Time to wait in milliseconds for trace data to become available or one of the\n special values NRF_MODEM_OS_FOREVER or NRF_MODEM_OS_NO_WAIT.\n\n Returns 0 on success.\n Returns -NRF_FAULT If * `frags` - or * `nfrags` - is NULL.\n Returns -NRF_EINPROGRESS Trace is already being processed by the application.\n Returns -NRF_ENODATA No more trace data is available until the modem is restarted.\n Returns -NRF_ESHUTDOWN Modem was shut down.\n Returns -NRF_EAGAIN If the request timed out.\n Returns -NRF_ENOTSUP Traces are disabled because trace region size is zero."]
pub fn nrf_modem_trace_get(
frags: *mut *mut nrf_modem_trace_data,
n_frags: *mut usize,
timeout: ::core::ffi::c_int,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Notify the Modem library that the application has completed processing of trace data.\n\n The application shall call this function to let the Modem library free the trace memory.\n It is the application's responsibility to call this function with the total size of all trace\n fragments received. If the data is processed in chunks, the function can be called with the size\n that is processed since last call.\n\n * `len` - Length of trace data that is processed.\n Returns Zero on success.\n Returns -NRF_EINVAL * `len` - is too large to be a valid trace length."]
pub fn nrf_modem_trace_processed(len: usize) -> ::core::ffi::c_int;
}
#[doc = " Type definition of handle used for abort\n\n This handle could point to the thread or task to abort or any other\n static memory required for aborting the on-going cryptographic routine(s)."]
pub type nrf_cc3xx_platform_abort_handle_t = *mut ::core::ffi::c_void;
#[doc = " Type definition of platform abort function\n\n @note This function pointer will be used when the nrf_cc3xx_platform\n and/or dependent libraries raises an error that can't be recovered."]
pub type nrf_cc3xx_platform_abort_fn_t =
::core::option::Option<unsafe extern "C" fn(reason: *const ::core::ffi::c_char)>;
#[doc = " Type definition of structure holding platform abort APIs"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_cc3xx_platform_abort_apis_t {
#[doc = "!< Handle to use when crypto operations are aborted."]
pub abort_handle: nrf_cc3xx_platform_abort_handle_t,
#[doc = "!< Function to use when crypto operations are aborted."]
pub abort_fn: nrf_cc3xx_platform_abort_fn_t,
}
#[test]
fn bindgen_test_layout_nrf_cc3xx_platform_abort_apis_t() {
const UNINIT: ::core::mem::MaybeUninit<nrf_cc3xx_platform_abort_apis_t> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_cc3xx_platform_abort_apis_t>(),
8usize,
concat!("Size of: ", stringify!(nrf_cc3xx_platform_abort_apis_t))
);
assert_eq!(
::core::mem::align_of::<nrf_cc3xx_platform_abort_apis_t>(),
4usize,
concat!("Alignment of ", stringify!(nrf_cc3xx_platform_abort_apis_t))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).abort_handle) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_cc3xx_platform_abort_apis_t),
"::",
stringify!(abort_handle)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).abort_fn) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_cc3xx_platform_abort_apis_t),
"::",
stringify!(abort_fn)
)
);
}
extern "C" {
#[doc = " Function to set platform abort APIs\n\n * `apis` - Pointer to platform APIs."]
pub fn nrf_cc3xx_platform_set_abort(apis: *const nrf_cc3xx_platform_abort_apis_t);
}
extern "C" {
#[doc = " Function to initialize platform abort APIs\n\n @note This function must be called once before calling\n @ref nrf_cc3xx_platform_init or @ref nrf_cc3xx_platform_init_no_rng.\n\n @note This function is not expected to be thread-safe."]
pub fn nrf_cc3xx_platform_abort_init();
}
#[doc = " Type definition of architecture neutral mutex type"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_cc3xx_platform_mutex {
pub mutex: *mut ::core::ffi::c_void,
pub flags: u32,
}
#[test]
fn bindgen_test_layout_nrf_cc3xx_platform_mutex() {
const UNINIT: ::core::mem::MaybeUninit<nrf_cc3xx_platform_mutex> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_cc3xx_platform_mutex>(),
8usize,
concat!("Size of: ", stringify!(nrf_cc3xx_platform_mutex))
);
assert_eq!(
::core::mem::align_of::<nrf_cc3xx_platform_mutex>(),
4usize,
concat!("Alignment of ", stringify!(nrf_cc3xx_platform_mutex))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).mutex) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_cc3xx_platform_mutex),
"::",
stringify!(mutex)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).flags) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_cc3xx_platform_mutex),
"::",
stringify!(flags)
)
);
}
#[doc = " Type definition of architecture neutral mutex type"]
pub type nrf_cc3xx_platform_mutex_t = nrf_cc3xx_platform_mutex;
#[doc = " Type definition of function pointer to initialize a mutex\n\n Calling this function pointer should initialize a previously uninitialized\n mutex or do nothing if the mutex is already initialized.\n\n @note Initialization may not imply memory allocation, as this can be done\n using static allocation through other APIs in the RTOS.\n\n * `mutex` - Pointer to a mutex to initialize."]
pub type nrf_cc3xx_platform_mutex_init_fn_t =
::core::option::Option<unsafe extern "C" fn(mutex: *mut nrf_cc3xx_platform_mutex_t)>;
#[doc = " Type definition of function pointer to free a mutex\n\n Calling this function pointer should free a mutex.\n\n @note If the RTOS does not provide an API to free the mutex it is advised\n to reset the mutex to an initialized state with no owner.\n\n * `mutex` - Pointer to a mutex to free."]
pub type nrf_cc3xx_platform_mutex_free_fn_t =
::core::option::Option<unsafe extern "C" fn(mutex: *mut nrf_cc3xx_platform_mutex_t)>;
#[doc = " Type definition of function pointer to lock a mutex\n\n Calling this function pointer should lock a mutex.\n\n * `mutex` - Pointer to a mutex to lock."]
pub type nrf_cc3xx_platform_mutex_lock_fn_t = ::core::option::Option<
unsafe extern "C" fn(mutex: *mut nrf_cc3xx_platform_mutex_t) -> ::core::ffi::c_int,
>;
#[doc = " Type definition of function pointer to unlock a mutex\n\n Calling this function pointer should unlock a mutex.\n\n * `mutex` - Pointer to a mutex to unlock."]
pub type nrf_cc3xx_platform_mutex_unlock_fn_t = ::core::option::Option<
unsafe extern "C" fn(mutex: *mut nrf_cc3xx_platform_mutex_t) -> ::core::ffi::c_int,
>;
#[doc = " Type definition of structure holding platform mutex APIs"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_cc3xx_platform_mutex_apis_t {
pub mutex_init_fn: nrf_cc3xx_platform_mutex_init_fn_t,
pub mutex_free_fn: nrf_cc3xx_platform_mutex_free_fn_t,
pub mutex_lock_fn: nrf_cc3xx_platform_mutex_lock_fn_t,
pub mutex_unlock_fn: nrf_cc3xx_platform_mutex_unlock_fn_t,
}
#[test]
fn bindgen_test_layout_nrf_cc3xx_platform_mutex_apis_t() {
const UNINIT: ::core::mem::MaybeUninit<nrf_cc3xx_platform_mutex_apis_t> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_cc3xx_platform_mutex_apis_t>(),
16usize,
concat!("Size of: ", stringify!(nrf_cc3xx_platform_mutex_apis_t))
);
assert_eq!(
::core::mem::align_of::<nrf_cc3xx_platform_mutex_apis_t>(),
4usize,
concat!("Alignment of ", stringify!(nrf_cc3xx_platform_mutex_apis_t))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).mutex_init_fn) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_cc3xx_platform_mutex_apis_t),
"::",
stringify!(mutex_init_fn)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).mutex_free_fn) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_cc3xx_platform_mutex_apis_t),
"::",
stringify!(mutex_free_fn)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).mutex_lock_fn) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_cc3xx_platform_mutex_apis_t),
"::",
stringify!(mutex_lock_fn)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).mutex_unlock_fn) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(nrf_cc3xx_platform_mutex_apis_t),
"::",
stringify!(mutex_unlock_fn)
)
);
}
#[doc = " Type definition of structure to platform hw mutexes"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nrf_cc3xx_platform_mutexes_t {
pub sym_mutex: *mut ::core::ffi::c_void,
pub asym_mutex: *mut ::core::ffi::c_void,
pub rng_mutex: *mut ::core::ffi::c_void,
pub reserved: *mut ::core::ffi::c_void,
pub power_mutex: *mut ::core::ffi::c_void,
}
#[test]
fn bindgen_test_layout_nrf_cc3xx_platform_mutexes_t() {
const UNINIT: ::core::mem::MaybeUninit<nrf_cc3xx_platform_mutexes_t> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<nrf_cc3xx_platform_mutexes_t>(),
20usize,
concat!("Size of: ", stringify!(nrf_cc3xx_platform_mutexes_t))
);
assert_eq!(
::core::mem::align_of::<nrf_cc3xx_platform_mutexes_t>(),
4usize,
concat!("Alignment of ", stringify!(nrf_cc3xx_platform_mutexes_t))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sym_mutex) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(nrf_cc3xx_platform_mutexes_t),
"::",
stringify!(sym_mutex)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).asym_mutex) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(nrf_cc3xx_platform_mutexes_t),
"::",
stringify!(asym_mutex)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).rng_mutex) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(nrf_cc3xx_platform_mutexes_t),
"::",
stringify!(rng_mutex)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(nrf_cc3xx_platform_mutexes_t),
"::",
stringify!(reserved)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).power_mutex) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(nrf_cc3xx_platform_mutexes_t),
"::",
stringify!(power_mutex)
)
);
}
extern "C" {
#[doc = " Function to set platform mutex APIs and mutexes\n\n * `apis` - Structure holding the mutex APIs.\n * `mutexes` - Structure holding the mutexes."]
pub fn nrf_cc3xx_platform_set_mutexes(
apis: *const nrf_cc3xx_platform_mutex_apis_t,
mutexes: *const nrf_cc3xx_platform_mutexes_t,
);
}
extern "C" {
#[doc = " Function to initialize RTOS thread-safe mutexes\n\n This function must be implemented to set the platform mutex APIS,\n and platform mutexes.\n\n @note This function must be called once before calling\n @ref nrf_cc3xx_platform_init or @ref nrf_cc3xx_platform_init_no_rng.\n\n @note This function is not expected to be thread-safe."]
pub fn nrf_cc3xx_platform_mutex_init();
}
extern "C" {
#[doc = " Function to initialize the nrf_cc3xx_platform with rng support.\n The function is using CTR_DRBG to generate a random seed.\n\n Returns Zero on success, otherwise a non-zero error code."]
pub fn nrf_cc3xx_platform_init() -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Function to initialize the nrf_cc3xx_platform with rng.\n The function is using HMAC_DRBG to generate a random seed.\n\n @note If this is called after nrf_cc3xx_platform_init it will\n create a new random seed using HMAC_DRBG.\n\n Returns Zero on success, otherwise a non-zero error code."]
pub fn nrf_cc3xx_platform_init_hmac_drbg() -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Function to initialize the nrf_cc3xx_platform without rng support\n\n Returns Zero on success, otherwise a non-zero error code."]
pub fn nrf_cc3xx_platform_init_no_rng() -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Function to deinitialize the nrf_cc3xx_platform\n\n Returns Zero on success, otherwise a non-zero error code."]
pub fn nrf_cc3xx_platform_deinit() -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Function to check if the nrf_cc3xx_platform is initialized\n\n Returns True if initialized, otherwise false."]
pub fn nrf_cc3xx_platform_is_initialized() -> bool_;
}
extern "C" {
#[doc = " Function to check if the nrf_cc3xx_platform is initialized\n with RNG support\n\n Returns True if RNG is initialized, otherwise false."]
pub fn nrf_cc3xx_platform_rng_is_initialized() -> bool_;
}
extern "C" {
#[doc = " Function to get the nonce seed used for encrypted ITS usage\n\n * `buffer` - \tBuffer to fill the nonce seed generated during boot.\n\n Returns Zero on success, otherwise a non-zero error code."]
pub fn nrf_cc3xx_platform_get_nonce_seed(buffer: *mut u8) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Function to get the boot seed used by TF-M attestation\n\n * `buffer` - \tBuffer to fill the boot seed generated during boot.\n\n Returns Zero on success, otherwise a non-zero error code."]
pub fn nrf_cc3xx_platform_get_boot_seed(buffer: *mut u8) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Function to generate entropy using Arm CryptoCell cc3xx\n\n This API corresponds to mbedtls_hardware_poll. It provides TRNG using\n the Arm CryptoCell cc3xx hardware accelerator.\n\n @note This API is only usable if @ref nrf_cc3xx_platform_init was run\n prior to calling it.\n\n * `buffer` - Pointer to buffer to hold the entropy data.\n * `length` - Length of the buffer to fill with entropy data.\n * `olen` - Pointer to variable that will hold the length of\n generated entropy.\n\n Returns 0 on success\n Returns Any other error code returned from mbedtls_hardware_poll"]
pub fn nrf_cc3xx_platform_entropy_get(
buffer: *mut u8,
length: usize,
olen: *mut usize,
) -> ::core::ffi::c_int;
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_aes_cbc_pkcs_ctx {
pub xkey: [u32; 60usize],
pub iv: [u8; 16usize],
pub buffer: [u8; 16usize],
pub length: u8,
pub key_size: u8,
pub decrypt: u8,
pub iv_set: u8,
}
#[test]
fn bindgen_test_layout_ocrypto_aes_cbc_pkcs_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_aes_cbc_pkcs_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_aes_cbc_pkcs_ctx>(),
276usize,
concat!("Size of: ", stringify!(ocrypto_aes_cbc_pkcs_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_aes_cbc_pkcs_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_aes_cbc_pkcs_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).xkey) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_cbc_pkcs_ctx),
"::",
stringify!(xkey)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).iv) as usize - ptr as usize },
240usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_cbc_pkcs_ctx),
"::",
stringify!(iv)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).buffer) as usize - ptr as usize },
256usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_cbc_pkcs_ctx),
"::",
stringify!(buffer)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).length) as usize - ptr as usize },
272usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_cbc_pkcs_ctx),
"::",
stringify!(length)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key_size) as usize - ptr as usize },
273usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_cbc_pkcs_ctx),
"::",
stringify!(key_size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).decrypt) as usize - ptr as usize },
274usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_cbc_pkcs_ctx),
"::",
stringify!(decrypt)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).iv_set) as usize - ptr as usize },
275usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_cbc_pkcs_ctx),
"::",
stringify!(iv_set)
)
);
}
extern "C" {
#[doc = " AES-CBC initialization.\n\n The context * `ctx` - is initialized using the given key * `key` - and initial vector * `iv` - .\n\n * `ctx` - Context.\n * `key` - AES key. May be NULL.\n * `size` - Key size (16, 24, or 32 bytes).\n * `iv` - Initial vector. May be NULL.\n * `decrypt` - If 0, initialize for encryption;\n If 1, initialize for decryption.\n\n @remark If * `key` - is NULL only * `iv` - is set. If * `iv` - is NULL only * `key` - is set.\n If not set by the same call, * `key` - must be set before * `iv` - ."]
pub fn ocrypto_aes_cbc_pkcs_init(
ctx: *mut ocrypto_aes_cbc_pkcs_ctx,
key: *const u8,
size: usize,
iv: *const u8,
decrypt: ::core::ffi::c_int,
);
}
extern "C" {
#[doc = " AES-CBC output size calculation.\n\n Calculates the length of the output written to * `out` - in a call to * `ocrypto_aes_cbc_pkcs_update` - .\n\n * `ctx` - Context.\n * `pt_len` - Length of data to be added.\n\n @returns The length of the output.\n\n @remark * `ocrypto_aes_cbc_pkcs_output_size` - must be called before * `ocrypto_aes_cbc_pkcs_update` - .\n @remark Initialization of the context * `ctx` - through\n * `ocrypto_aes_ctr_init` - is required before this function can be called."]
pub fn ocrypto_aes_cbc_pkcs_output_size(
ctx: *mut ocrypto_aes_cbc_pkcs_ctx,
pt_len: usize,
) -> usize;
}
extern "C" {
#[doc = " AES-CBC incremental encryption/decryption.\n\n The input * `in` - is encrypted or decrypted to the output * `out` - using the context * `ctx` - .\n\n This function can be called repeatedly until the whole message is processed.\n\n * `ctx` - Context.\n * `out` - Output, ciphertext for encryption, plaintext for decryption.\n * `in` - Input, plaintext for encryption, ciphertext for decryption.\n * `in_len` - Length of * `in` - .\n\n @remark * `in` - may be same as * `out` - .\n @remark A single common buffer may be used for the whole plaintext and ciphertext\nif * `in` - and * `out` - of the first call are equal and incremented individually\nby the input and output size for each further call (meaning the plaintext\nand ciphertext are stored contiguously in the common buffer).\n @remark Initialization of the context * `ctx` - through\n * `ocrypto_aes_ctr_init` - is required before this function can be called.\n @remark The maximum length of * `out` - is * `in_len` - + 15.\n @remark The exact length of * `out` - is returned by * `ocrypto_aes_cbc_pkcs_output_size` - ."]
pub fn ocrypto_aes_cbc_pkcs_update(
ctx: *mut ocrypto_aes_cbc_pkcs_ctx,
out: *mut u8,
in_: *const u8,
in_len: usize,
);
}
extern "C" {
#[doc = " AES-CBC-PKCS7 final encryption output.\n\n * `ctx` - Context.\n * `ct` - Last ciphertext block."]
pub fn ocrypto_aes_cbc_pkcs_final_enc(ctx: *mut ocrypto_aes_cbc_pkcs_ctx, ct: *mut u8);
}
extern "C" {
#[doc = " AES-CBC-PKCS7 final decryption output.\n\n * `ctx` - Context.\n * `pt` - Last part of the plaintext.\n * `pt_len` - Length of * `pt` - .\n\n Returns 0 If the ciphertext input is properly padded.\n Returns -1 Otherwise.\n\n @remark The total length of the ciphertext added before a call to this function\nmust be non-zero and a multiple of 16.\n @remark The maximum length of * `pt` - is 15."]
pub fn ocrypto_aes_cbc_pkcs_final_dec(
ctx: *mut ocrypto_aes_cbc_pkcs_ctx,
pt: *mut u8,
pt_len: *mut usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " AES-CBC-PKCS7 encryption.\n\n * `ct` - Ciphertext.\n * `pt` - Plaintext.\n * `pt_len` - Plaintext length.\n * `key` - AES key.\n * `size` - Key size (16, 24, or 32).\n * `iv` - Initial vector.\n\n @remark * `ct` - may be same as * `pt` - .\n @remark The length of * `ct` - is * `pt_len` - + 1 rounded up to the next multiple of 16."]
pub fn ocrypto_aes_cbc_pkcs_encrypt(
ct: *mut u8,
pt: *const u8,
pt_len: usize,
key: *const u8,
size: usize,
iv: *const u8,
);
}
extern "C" {
#[doc = " AES-CBC-PKCS7 decryption.\n\n * `pt` - Plaintext.\n * `pt_len` - Plaintext length.\n * `ct` - Ciphertext.\n * `ct_len` - Ciphertext length. Must be a multiple of 16.\n * `key` - AES key.\n * `size` - Key size (16, 24, or 32).\n * `iv` - Initial vector.\n\n Returns 0 If the input is properly padded.\n Returns -1 Otherwise.\n\n @remark * `pt` - may be same as * `ct` - .\n @remark The maximum length of * `pt` - is * `ct_len` - - 1."]
pub fn ocrypto_aes_cbc_pkcs_decrypt(
pt: *mut u8,
pt_len: *mut usize,
ct: *const u8,
ct_len: usize,
key: *const u8,
size: usize,
iv: *const u8,
) -> ::core::ffi::c_int;
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_aes_cbc_ctx {
pub xkey: [u32; 60usize],
pub iv: [u8; 16usize],
pub key_size: u8,
}
#[test]
fn bindgen_test_layout_ocrypto_aes_cbc_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_aes_cbc_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_aes_cbc_ctx>(),
260usize,
concat!("Size of: ", stringify!(ocrypto_aes_cbc_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_aes_cbc_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_aes_cbc_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).xkey) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_cbc_ctx),
"::",
stringify!(xkey)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).iv) as usize - ptr as usize },
240usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_cbc_ctx),
"::",
stringify!(iv)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key_size) as usize - ptr as usize },
256usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_cbc_ctx),
"::",
stringify!(key_size)
)
);
}
extern "C" {
#[doc = " AES-CBC encrypt initialization.\n\n The context * `ctx` - is initialized using the given key * `key` - and initial vector * `iv` - .\n\n * `ctx` - Context.\n * `key` - AES key. May be NULL.\n * `size` - Key size (16, 24, or 32 bytes).\n * `iv` - Initial vector. May be NULL.\n\n @remark If * `key` - is NULL only * `iv` - is set. If * `iv` - is NULL only * `key` - is set.\nBoth * `key` - and * `iv` - must be set before update is called."]
pub fn ocrypto_aes_cbc_init_enc(
ctx: *mut ocrypto_aes_cbc_ctx,
key: *const u8,
size: usize,
iv: *const u8,
);
}
extern "C" {
#[doc = " AES-CBC decrypt initialization.\n\n The context * `ctx` - is initialized using the given key * `key` - and initial vector * `iv` - .\n\n * `ctx` - Context.\n * `key` - AES key. May be NULL.\n * `size` - Key size (16, 24, or 32 bytes).\n * `iv` - Initial vector. May be NULL.\n\n @remark If * `key` - is NULL only * `iv` - is set. If * `iv` - is NULL only * `key` - is set.\nBoth * `key` - and * `iv` - must be set before update is called."]
pub fn ocrypto_aes_cbc_init_dec(
ctx: *mut ocrypto_aes_cbc_ctx,
key: *const u8,
size: usize,
iv: *const u8,
);
}
extern "C" {
#[doc = " AES-CBC incremental encryption.\n\n The plaintext * `pt` - is encrypted to the ciphertext * `ct` - using the context * `ctx` - .\n\n This function can be called repeatedly until the whole message is processed.\n\n * `ctx` - Context.\n * `ct` - Ciphertext.\n * `pt` - Plaintext.\n * `pt_len` - Length of * `pt` - and * `ct` - . Must be a multiple of the block size.\n\n @remark * `ct` - may be same as * `pt` - .\n @remark Initialization of the context * `ctx` - through\n * `ocrypto_aes_ctr_init` - is required before this function can be called."]
pub fn ocrypto_aes_cbc_update_enc(
ctx: *mut ocrypto_aes_cbc_ctx,
ct: *mut u8,
pt: *const u8,
pt_len: usize,
);
}
extern "C" {
#[doc = " AES-CBC incremental decryption.\n\n The ciphertext * `ct` - is decrypted to the plaintext * `pt` - using the context * `ctx` - .\n\n This function can be called repeatedly until the whole message is processed.\n\n * `ctx` - Context.\n * `pt` - Plaintext.\n * `ct` - Ciphertext.\n * `ct_len` - Length of * `ct` - and * `pt` - . Must be a multiple of the block size.\n\n @remark * `ct` - may be same as * `pt` - .\n @remark Initialization of the context * `ctx` - through\n * `ocrypto_aes_ctr_init` - is required before this function can be called."]
pub fn ocrypto_aes_cbc_update_dec(
ctx: *mut ocrypto_aes_cbc_ctx,
pt: *mut u8,
ct: *const u8,
ct_len: usize,
);
}
extern "C" {
#[doc = " AES-CBC encryption.\n\n * `ct` - Ciphertext.\n * `pt` - Plaintext.\n * `pt_len` - Plaintext length.\n * `key` - AES key.\n * `size` - Key size (16, 24, or 32).\n * `iv` - Initial vector.\n\n @remark * `ct` - may be same as * `pt` - ."]
pub fn ocrypto_aes_cbc_encrypt(
ct: *mut u8,
pt: *const u8,
pt_len: usize,
key: *const u8,
size: usize,
iv: *const u8,
);
}
extern "C" {
#[doc = " AES-CBC decryption.\n\n * `pt` - Plaintext.\n * `ct` - Ciphertext.\n * `ct_len` - Ciphertext length.\n * `key` - AES key.\n * `size` - Key size (16, 24, or 32).\n * `iv` - Initial vector.\n\n @remark * `ct` - may be same as * `pt` - ."]
pub fn ocrypto_aes_cbc_decrypt(
pt: *mut u8,
ct: *const u8,
ct_len: usize,
key: *const u8,
size: usize,
iv: *const u8,
);
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_aes_ccm_ctx {
pub xkey: [u32; 60usize],
pub counter: [u8; 16usize],
pub cipher: [u8; 16usize],
pub x: [u8; 16usize],
pub position: u8,
pub length: u8,
pub cnt_pos: u8,
pub key_size: u8,
pub pt_len: usize,
pub aa_len: usize,
}
#[test]
fn bindgen_test_layout_ocrypto_aes_ccm_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_aes_ccm_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_aes_ccm_ctx>(),
300usize,
concat!("Size of: ", stringify!(ocrypto_aes_ccm_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_aes_ccm_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_aes_ccm_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).xkey) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_ccm_ctx),
"::",
stringify!(xkey)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).counter) as usize - ptr as usize },
240usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_ccm_ctx),
"::",
stringify!(counter)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).cipher) as usize - ptr as usize },
256usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_ccm_ctx),
"::",
stringify!(cipher)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).x) as usize - ptr as usize },
272usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_ccm_ctx),
"::",
stringify!(x)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).position) as usize - ptr as usize },
288usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_ccm_ctx),
"::",
stringify!(position)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).length) as usize - ptr as usize },
289usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_ccm_ctx),
"::",
stringify!(length)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).cnt_pos) as usize - ptr as usize },
290usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_ccm_ctx),
"::",
stringify!(cnt_pos)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key_size) as usize - ptr as usize },
291usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_ccm_ctx),
"::",
stringify!(key_size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pt_len) as usize - ptr as usize },
292usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_ccm_ctx),
"::",
stringify!(pt_len)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).aa_len) as usize - ptr as usize },
296usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_ccm_ctx),
"::",
stringify!(aa_len)
)
);
}
extern "C" {
#[doc = " AES-CCM initialization.\n\n The context * `ctx` - is initialized using the given key * `key` - and nonce * `nonce` - .\n\n * `ctx` - Context.\n * `key` - AES key. May be NULL.\n * `size` - Key size (16, 24, or 32 bytes).\n * `nonce` - Nonce. May be NULL.\n * `n_len` - Nonce length, 7 <= * `n_len` - <= 13.\n * `tag_len` - Tag length (4, 6, 8, 10, 12, 14, or 16).\n * `pt_len` - Plaintext length, 0 <= * `pt_len` - < 2^(8*(15-n_len)).\n * `aa_len` - Additional authentication data length.\n\n @remark If * `key` - is NULL only * `nonce` - and lengths are set. If * `nonce` - is NULL only * `key` - is set.\nBoth * `key` - and * `nonce` - must be set before update is called."]
pub fn ocrypto_aes_ccm_init(
ctx: *mut ocrypto_aes_ccm_ctx,
key: *const u8,
size: usize,
nonce: *const u8,
n_len: usize,
tag_len: usize,
pt_len: usize,
aa_len: usize,
);
}
extern "C" {
#[doc = " AES-CCM incremental aad input.\n\n The generator state * `ctx` - is updated to include a data chunk * `aa` - .\n\n This function can be called repeatedly until the whole data is processed.\n\n * `ctx` - Generator state.\n * `aa` - Additional authenticated data.\n * `aa_len` - Length of * `a` - .\n\n @remark Initialization of the context * `ctx` - through\n * `ocrypto_aes_ccm_init` - is required before this function can be called.\n @remark * `ocrypto_aes_ccm_update_aad` - must be called before any call to\n * `ocrypto_aes_ccm_update_enc` - or * `ocrypto_aes_ccm_update_dec` - ."]
pub fn ocrypto_aes_ccm_update_aad(ctx: *mut ocrypto_aes_ccm_ctx, aa: *const u8, aa_len: usize);
}
extern "C" {
#[doc = " AES-CCM incremental encryption.\n\n The plaintext * `pt` - is encrypted to the ciphertext * `ct` - using the context * `ctx` - .\n\n This function can be called repeatedly until the whole message is processed.\n\n * `ctx` - Context.\n * `ct` - Ciphertext.\n * `pt` - Plaintext.\n * `pt_len` - Length of * `pt` - and * `ct` - .\n\n @remark * `ct` - may be same as * `pt` - .\n @remark Initialization of the context * `ctx` - through\n * `ocrypto_aes_ccm_init` - is required before this function can be called."]
pub fn ocrypto_aes_ccm_update_enc(
ctx: *mut ocrypto_aes_ccm_ctx,
ct: *mut u8,
pt: *const u8,
pt_len: usize,
);
}
extern "C" {
#[doc = " AES-CCM incremental decryption.\n\n The ciphertext * `ct` - is decrypted to the plaintext * `pt` - using the context * `ctx` - .\n\n This function can be called repeatedly until the whole message is processed.\n\n * `ctx` - Context.\n * `pt` - Plaintext.\n * `ct` - Ciphertext.\n * `ct_len` - Length of * `ct` - and * `pt` - .\n\n @remark * `ct` - may be same as * `pt` - .\n @remark Initialization of the context * `ctx` - through\n * `ocrypto_aes_ccm_init` - is required before this function can be called."]
pub fn ocrypto_aes_ccm_update_dec(
ctx: *mut ocrypto_aes_ccm_ctx,
pt: *mut u8,
ct: *const u8,
ct_len: usize,
);
}
extern "C" {
#[doc = " AES-CCM final encoder step.\n\n The generator state * `ctx` - is used to finalize the encryption and generate the tag.\n\n * `ctx` - Generator state.\n * `tag` - Generated authentication tag.\n * `tag_len` - Length of * `tag` - ."]
pub fn ocrypto_aes_ccm_final_enc(ctx: *mut ocrypto_aes_ccm_ctx, tag: *mut u8, tag_len: usize);
}
extern "C" {
#[doc = " AES-CCM final decoder step.\n\n The generator state * `ctx` - is used to finalize the decryption and check the tag.\n\n * `ctx` - Generator state.\n * `tag` - Received authentication tag.\n * `tag_len` - Length of * `tag` - .\n\n Returns 0 If * `tag` - is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_aes_ccm_final_dec(
ctx: *mut ocrypto_aes_ccm_ctx,
tag: *const u8,
tag_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " AES-CCM encryption.\n\n * `ct` - Ciphertext.\n * `tag` - Authentication tag.\n * `tag_len` - Tag length (4, 6, 8, 10, 12, 14, or 16).\n * `pt` - Plaintext.\n * `pt_len` - Plaintext length, 0 <= * `pt_len` - < 2^(8*(15-n_len)).\n * `key` - AES key.\n * `size` - Key size (16, 24, or 32).\n * `nonce` - Nonce.\n * `n_len` - Nonce length, 7 <= * `n_len` - <= 13.\n * `aa` - Additional authentication data.\n * `aa_len` - Additional authentication data length.\n\n @remark * `ct` - may be same as * `pt` - ."]
pub fn ocrypto_aes_ccm_encrypt(
ct: *mut u8,
tag: *mut u8,
tag_len: usize,
pt: *const u8,
pt_len: usize,
key: *const u8,
size: usize,
nonce: *const u8,
n_len: usize,
aa: *const u8,
aa_len: usize,
);
}
extern "C" {
#[doc = " AES-CCM decryption.\n\n * `pt` - Plaintext.\n * `tag` - Authentication tag.\n * `tag_len` - Tag length (4, 6, 8, 10, 12, 14, or 16).\n * `ct` - Ciphertext.\n * `ct_len` - Ciphertext length, 0 <= * `ct_len` - < 2^(8*(15-n_len)).\n * `key` - AES key.\n * `size` - Key size (16, 24, or 32).\n * `nonce` - Nonce.\n * `n_len` - Nonce length, 7 <= * `n_len` - <= 13.\n * `aa` - Additional authentication data.\n * `aa_len` - Additional authentication data length.\n\n Returns 0 If * `tag` - is valid.\n Returns -1 Otherwise.\n\n @remark * `ct` - may be same as * `pt` - ."]
pub fn ocrypto_aes_ccm_decrypt(
pt: *mut u8,
tag: *const u8,
tag_len: usize,
ct: *const u8,
ct_len: usize,
key: *const u8,
size: usize,
nonce: *const u8,
n_len: usize,
aa: *const u8,
aa_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " AES-CMAC authentication algorithm.\n\n * `tag` - Resulting tag.\n * `tag_len` - Tag length, 0 < * `tag_len` - <= 16.\n * `msg` - Message to authenticate.\n * `msg_len` - Message length.\n * `key` - AES key.\n * `size` - Key size (16, 24, or 32)."]
pub fn ocrypto_aes_cmac_authenticate(
tag: *mut u8,
tag_len: usize,
msg: *const u8,
msg_len: usize,
key: *const u8,
size: usize,
);
}
extern "C" {
#[doc = " AES-CMAC-PRF-128 pseudo random function algorithm.\n\n * `prf` - 16 byte PRF output.\n * `msg` - Message input.\n * `msg_len` - Message length.\n * `key` - Key.\n * `key_len` - Key length."]
pub fn ocrypto_aes_cmac_prf128(
prf: *mut u8,
msg: *const u8,
msg_len: usize,
key: *const u8,
key_len: usize,
);
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_aes_ctr_ctx {
pub xkey: [u32; 60usize],
pub counter: [u8; 16usize],
pub cipher: [u8; 16usize],
pub position: u32,
pub key_size: u8,
}
#[test]
fn bindgen_test_layout_ocrypto_aes_ctr_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_aes_ctr_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_aes_ctr_ctx>(),
280usize,
concat!("Size of: ", stringify!(ocrypto_aes_ctr_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_aes_ctr_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_aes_ctr_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).xkey) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_ctr_ctx),
"::",
stringify!(xkey)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).counter) as usize - ptr as usize },
240usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_ctr_ctx),
"::",
stringify!(counter)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).cipher) as usize - ptr as usize },
256usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_ctr_ctx),
"::",
stringify!(cipher)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).position) as usize - ptr as usize },
272usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_ctr_ctx),
"::",
stringify!(position)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key_size) as usize - ptr as usize },
276usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_ctr_ctx),
"::",
stringify!(key_size)
)
);
}
extern "C" {
#[doc = " AES-CTR initialization.\n\n The context * `ctx` - is initialized using the given key * `key` - and initial vector * `iv` - .\n\n * `ctx` - Context.\n * `key` - AES key. May be NULL.\n * `size` - Key size (16, 24, or 32 bytes).\n * `iv` - Initial vector. May be NULL.\n\n @remark If * `key` - is NULL only * `iv` - is set. If * `iv` - is NULL only * `key` - is set.\nBoth * `key` - and * `iv` - must be set before update is called."]
pub fn ocrypto_aes_ctr_init(
ctx: *mut ocrypto_aes_ctr_ctx,
key: *const u8,
size: usize,
iv: *const u8,
);
}
extern "C" {
#[doc = " AES-CTR incremental encryption/decryption.\n\n The plaintext * `pt` - is encrypted to the ciphertext * `ct` - using the context * `ctx` - .\n\n This function can be called repeatedly until the whole message is processed.\n\n * `ctx` - Context.\n * `ct` - Ciphertext.\n * `pt` - Plaintext.\n * `pt_len` - Length of * `pt` - and * `ct` - .\n\n @remark * `ct` - may be same as * `pt` - .\n @remark Initialization of the context * `ctx` - through\n * `ocrypto_aes_ctr_init` - is required before this function can be called."]
pub fn ocrypto_aes_ctr_update(
ctx: *mut ocrypto_aes_ctr_ctx,
ct: *mut u8,
pt: *const u8,
pt_len: usize,
);
}
extern "C" {
#[doc = " AES-CTR encryption.\n\n * `ct` - Ciphertext.\n * `pt` - Plaintext.\n * `pt_len` - Length of * `pt` - and * `ct` - .\n * `key` - AES key.\n * `size` - Key size (16, 24, or 32).\n * `iv` - Initial vector.\n\n @remark * `ct` - may be same as * `pt` - ."]
pub fn ocrypto_aes_ctr_encrypt(
ct: *mut u8,
pt: *const u8,
pt_len: usize,
key: *const u8,
size: usize,
iv: *const u8,
);
}
extern "C" {
#[doc = " AES-CTR decryption.\n\n * `pt` - Plaintext.\n * `ct` - Ciphertext.\n * `ct_len` - Length of * `pt` - and * `ct` - .\n * `key` - AES key.\n * `size` - Key size (16, 24, or 32).\n * `iv` - Initial vector.\n\n @remark * `ct` - may be same as * `pt` - ."]
pub fn ocrypto_aes_ctr_decrypt(
pt: *mut u8,
ct: *const u8,
ct_len: usize,
key: *const u8,
size: usize,
iv: *const u8,
);
}
extern "C" {
#[doc = " AES-EAX encryption.\n\n * `ct` - Ciphertext.\n * `tag` - Authentication tag.\n * `pt` - Plaintext.\n * `pt_len` - Length of * `pt` - and * `ct` - .\n * `key` - AES key.\n * `size` - Key size (16, 24, or 32 bytes).\n * `iv` - Initial vector.\n * `iv_len` - Initial vector length.\n * `aa` - Additional authentication data.\n * `aa_len` - Additional authentication data length.\n\n @remark * `ct` - may be same as * `pt` - ."]
pub fn ocrypto_aes_eax_encrypt(
ct: *mut u8,
tag: *mut u8,
pt: *const u8,
pt_len: usize,
key: *const u8,
size: usize,
iv: *const u8,
iv_len: usize,
aa: *const u8,
aa_len: usize,
);
}
extern "C" {
#[doc = " AES-EAX decryption.\n\n * `pt` - Plaintext.\n * `tag` - Authentication tag.\n * `ct` - Ciphertext.\n * `ct_len` - Length of * `pt` - and * `ct` - .\n * `key` - AES key.\n * `size` - Key size (16, 24, or 32 bytes).\n * `iv` - Initial vector.\n * `iv_len` - Initial vector length.\n * `aa` - Additional authentication data.\n * `aa_len` - Additional authentication data length.\n\n @remark * `ct` - may be same as * `pt` - .\n\n Returns 0 If * `tag` - is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_aes_eax_decrypt(
pt: *mut u8,
tag: *const u8,
ct: *const u8,
ct_len: usize,
key: *const u8,
size: usize,
iv: *const u8,
iv_len: usize,
aa: *const u8,
aa_len: usize,
) -> ::core::ffi::c_int;
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_aes_ecb_ctx {
pub xkey: [u32; 60usize],
pub key_size: u8,
}
#[test]
fn bindgen_test_layout_ocrypto_aes_ecb_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_aes_ecb_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_aes_ecb_ctx>(),
244usize,
concat!("Size of: ", stringify!(ocrypto_aes_ecb_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_aes_ecb_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_aes_ecb_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).xkey) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_ecb_ctx),
"::",
stringify!(xkey)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key_size) as usize - ptr as usize },
240usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_ecb_ctx),
"::",
stringify!(key_size)
)
);
}
extern "C" {
#[doc = " AES-ECB encrypt initialization.\n\n The context * `ctx` - is initialized using the given key * `key` - .\n\n * `ctx` - Context.\n * `key` - AES key.\n * `size` - Key size (16, 24, or 32 bytes)."]
pub fn ocrypto_aes_ecb_init_enc(ctx: *mut ocrypto_aes_ecb_ctx, key: *const u8, size: usize);
}
extern "C" {
#[doc = " AES-ECB decrypt initialization.\n\n The context * `ctx` - is initialized using the given key * `key` - .\n\n * `ctx` - Context.\n * `key` - AES key.\n * `size` - Key size (16, 24, or 32 bytes)."]
pub fn ocrypto_aes_ecb_init_dec(ctx: *mut ocrypto_aes_ecb_ctx, key: *const u8, size: usize);
}
extern "C" {
#[doc = " AES-ECB incremental encryption.\n\n The plaintext * `pt` - is encrypted to the ciphertext * `ct` - using the context * `ctx` - .\n\n This function can be called repeatedly until the whole message is processed.\n\n * `ctx` - Context.\n * `ct` - Ciphertext.\n * `pt` - Plaintext.\n * `pt_len` - Length of * `pt` - and * `ct` - . Must be a multiple of the block size.\n\n @remark * `ct` - may be same as * `pt` - .\n @remark Initialization of the context * `ctx` - through\n * `ocrypto_aes_ctr_init` - is required before this function can be called."]
pub fn ocrypto_aes_ecb_update_enc(
ctx: *mut ocrypto_aes_ecb_ctx,
ct: *mut u8,
pt: *const u8,
pt_len: usize,
);
}
extern "C" {
#[doc = " AES-ECB incremental decryption.\n\n The ciphertext * `ct` - is decrypted to the plaintext * `pt` - using the context * `ctx` - .\n\n This function can be called repeatedly until the whole message is processed.\n\n * `ctx` - Context.\n * `pt` - Plaintext.\n * `ct` - Ciphertext.\n * `ct_len` - Length of * `ct` - and * `pt` - . Must be a multiple of the block size.\n\n @remark * `ct` - may be same as * `pt` - .\n @remark Initialization of the context * `ctx` - through\n * `ocrypto_aes_ctr_init` - is required before this function can be called."]
pub fn ocrypto_aes_ecb_update_dec(
ctx: *mut ocrypto_aes_ecb_ctx,
pt: *mut u8,
ct: *const u8,
ct_len: usize,
);
}
extern "C" {
#[doc = " AES-ECB encryption.\n\n * `ct` - Ciphertext.\n * `pt` - Plaintext.\n * `pt_len` - Length of * `ct` - and * `pt` - .\n * `key` - AES key.\n * `size` - Key size (16, 24, or 32).\n\n @remark * `ct` - may be same as * `pt` - ."]
pub fn ocrypto_aes_ecb_encrypt(
ct: *mut u8,
pt: *const u8,
pt_len: usize,
key: *const u8,
size: usize,
);
}
extern "C" {
#[doc = " AES-ECB decryption.\n\n * `pt` - Plaintext.\n * `ct` - Ciphertext.\n * `ct_len` - Length of * `ct` - and * `pt` - .\n * `key` - AES key.\n * `size` - Key size (16, 24, or 32).\n\n @remark * `ct` - may be same as * `pt` - ."]
pub fn ocrypto_aes_ecb_decrypt(
pt: *mut u8,
ct: *const u8,
ct_len: usize,
key: *const u8,
size: usize,
);
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_aes_gcm_ctx {
pub xkey: [u32; 60usize],
pub counter: [u8; 16usize],
pub cipher: [u8; 16usize],
pub x: [u8; 16usize],
pub m: [u8; 16usize],
pub position: u8,
pub length: u8,
pub key_size: u8,
pub ct_len: usize,
pub aa_len: usize,
}
#[test]
fn bindgen_test_layout_ocrypto_aes_gcm_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_aes_gcm_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_aes_gcm_ctx>(),
316usize,
concat!("Size of: ", stringify!(ocrypto_aes_gcm_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_aes_gcm_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_aes_gcm_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).xkey) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_gcm_ctx),
"::",
stringify!(xkey)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).counter) as usize - ptr as usize },
240usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_gcm_ctx),
"::",
stringify!(counter)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).cipher) as usize - ptr as usize },
256usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_gcm_ctx),
"::",
stringify!(cipher)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).x) as usize - ptr as usize },
272usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_gcm_ctx),
"::",
stringify!(x)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).m) as usize - ptr as usize },
288usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_gcm_ctx),
"::",
stringify!(m)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).position) as usize - ptr as usize },
304usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_gcm_ctx),
"::",
stringify!(position)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).length) as usize - ptr as usize },
305usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_gcm_ctx),
"::",
stringify!(length)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key_size) as usize - ptr as usize },
306usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_gcm_ctx),
"::",
stringify!(key_size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ct_len) as usize - ptr as usize },
308usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_gcm_ctx),
"::",
stringify!(ct_len)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).aa_len) as usize - ptr as usize },
312usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_aes_gcm_ctx),
"::",
stringify!(aa_len)
)
);
}
extern "C" {
#[doc = " AES-GCM initialization.\n\n The context * `ctx` - is initialized using the given key * `key` - and initial vector * `iv` - .\n\n * `ctx` - Context.\n * `key` - AES key. May be NULL.\n * `size` - Key size (16, 24, or 32 bytes).\n * `iv` - Initial vector. May be NULL.\n\n @remark If * `key` - is NULL only * `iv` - is set. If * `iv` - is NULL only * `key` - is set.\nBoth * `key` - and * `iv` - must be set before update is called."]
pub fn ocrypto_aes_gcm_init(
ctx: *mut ocrypto_aes_gcm_ctx,
key: *const u8,
size: usize,
iv: *const u8,
);
}
extern "C" {
#[doc = " AES-GCM iv initialization.\n\n The context * `ctx` - is initialized using the given initial vector * `iv` - .\n\n * `ctx` - Context.\n * `iv` - Initial vector.\n * `iv_len` - Length of * `iv` - ."]
pub fn ocrypto_aes_gcm_init_iv(ctx: *mut ocrypto_aes_gcm_ctx, iv: *const u8, iv_len: usize);
}
extern "C" {
#[doc = " AES-GCM incremental aad input.\n\n The generator state * `ctx` - is updated to include a data chunk * `aa` - .\n\n This function can be called repeatedly until the whole data is processed.\n\n * `ctx` - Generator state.\n * `aa` - Additional authenticated data.\n * `aa_len` - Length of * `aa` - .\n\n @remark Initialization of the context * `ctx` - through\n * `ocrypto_aes_gcm_init` - is required before this function can be called.\n @remark * `ocrypto_aes_gcm_update_aad` - must be called before any call to\n * `ocrypto_aes_gcm_update_enc` - or * `ocrypto_aes_gcm_update_dec` - ."]
pub fn ocrypto_aes_gcm_update_aad(ctx: *mut ocrypto_aes_gcm_ctx, aa: *const u8, aa_len: usize);
}
extern "C" {
#[doc = " AES-GCM incremental encryption.\n\n The plaintext * `pt` - is encrypted to the ciphertext * `ct` - using the context * `ctx` - .\n\n This function can be called repeatedly until the whole message is processed.\n\n * `ctx` - Context.\n * `ct` - Ciphertext.\n * `pt` - Plaintext.\n * `pt_len` - Length of * `pt` - and * `ct` - .\n\n @remark * `ct` - may be same as * `pt` - .\n @remark Initialization of the context * `ctx` - through\n * `ocrypto_aes_gcm_init` - is required before this function can be called."]
pub fn ocrypto_aes_gcm_update_enc(
ctx: *mut ocrypto_aes_gcm_ctx,
ct: *mut u8,
pt: *const u8,
pt_len: usize,
);
}
extern "C" {
#[doc = " AES-GCM incremental decryption.\n\n The ciphertext * `ct` - is decrypted to the plaintext * `pt` - using the context * `ctx` - .\n\n This function can be called repeatedly until the whole message is processed.\n\n * `ctx` - Context.\n * `pt` - Plaintext.\n * `ct` - Ciphertext.\n * `ct_len` - Length of * `ct` - and * `pt` - .\n\n @remark * `ct` - may be same as * `pt` - .\n @remark Initialization of the context * `ctx` - through\n * `ocrypto_aes_gcm_init` - is required before this function can be called."]
pub fn ocrypto_aes_gcm_update_dec(
ctx: *mut ocrypto_aes_gcm_ctx,
pt: *mut u8,
ct: *const u8,
ct_len: usize,
);
}
extern "C" {
#[doc = " AES-GCM final encoder step.\n\n The generator state * `ctx` - is used to finalize the encryption and generate the tag.\n\n * `ctx` - Generator state.\n * `tag` - Generated authentication tag.\n * `tag_len` - Authentication tag length, 0 < * `tag_len` - <= 16."]
pub fn ocrypto_aes_gcm_final_enc(ctx: *mut ocrypto_aes_gcm_ctx, tag: *mut u8, tag_len: usize);
}
extern "C" {
#[doc = " AES-GCM final decoder step.\n\n The generator state * `ctx` - is used to finalize the decryption and check the tag.\n\n * `ctx` - Generator state.\n * `tag` - Received authentication tag.\n * `tag_len` - Authentication tag length.\n\n Returns 0 If * `tag` - is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_aes_gcm_final_dec(
ctx: *mut ocrypto_aes_gcm_ctx,
tag: *const u8,
tag_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " AES-GCM encryption.\n\n * `ct` - Ciphertext.\n * `tag` - Authentication tag.\n * `tag_len` - Authentication tag length, 0 < * `tag_len` - <= 16.\n * `pt` - Plaintext.\n * `pt_len` - Plaintext length, 0 < * `ct_len` - < 2^36-32 bytes.\n * `key` - AES key.\n * `size` - Key size (16, 24, or 32 bytes).\n * `iv` - Initial vector.\n * `aa` - Additional authentication data.\n * `aa_len` - Additional authentication data length, 0 < * `aa_len` - < 2^61 bytes.\n\n @remark * `ct` - may be same as * `pt` - ."]
pub fn ocrypto_aes_gcm_encrypt(
ct: *mut u8,
tag: *mut u8,
tag_len: usize,
pt: *const u8,
pt_len: usize,
key: *const u8,
size: usize,
iv: *const u8,
aa: *const u8,
aa_len: usize,
);
}
extern "C" {
#[doc = " AES-GCM decryption.\n\n * `pt` - Plaintext.\n * `tag` - Authentication tag.\n * `tag_len` - Authentication tag length, 0 < * `tag_len` - <= 16.\n * `ct` - Ciphertext.\n * `ct_len` - Ciphertext length, 0 < * `ct_len` - < 2^36-32 bytes.\n * `key` - AES key.\n * `size` - Key size (16, 24, or 32 bytes).\n * `iv` - Initial vector.\n * `aa` - Additional authentication data.\n * `aa_len` - Additional authentication data length, 0 < * `aa_len` - < 2^61 bytes.\n\n @remark * `ct` - may be same as * `pt` - .\n\n Returns 0 If * `tag` - is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_aes_gcm_decrypt(
pt: *mut u8,
tag: *const u8,
tag_len: usize,
ct: *const u8,
ct_len: usize,
key: *const u8,
size: usize,
iv: *const u8,
aa: *const u8,
aa_len: usize,
) -> ::core::ffi::c_int;
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_chacha20_ctx {
pub x: [u32; 16usize],
pub cipher: [u8; 64usize],
pub position: u8,
}
#[test]
fn bindgen_test_layout_ocrypto_chacha20_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_chacha20_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_chacha20_ctx>(),
132usize,
concat!("Size of: ", stringify!(ocrypto_chacha20_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_chacha20_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_chacha20_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).x) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_chacha20_ctx),
"::",
stringify!(x)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).cipher) as usize - ptr as usize },
64usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_chacha20_ctx),
"::",
stringify!(cipher)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).position) as usize - ptr as usize },
128usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_chacha20_ctx),
"::",
stringify!(position)
)
);
}
extern "C" {
#[doc = "# Incremental ChaCha20 Encoder.\n\n This group of functions can be used to incrementally compute the ChaCha20 encryption\n for a given message and key, by segmenting a message into smaller chunks.\n\n Use pattern:\n\n Encoding/Decoding:\n @code\n ocrypto_chacha20_init(ctx, n, n_len, key, count);\n ocrypto_chacha20_update(ctx, c, m, m_len);\n ...\n ocrypto_chacha20_update(ctx, c, m, m_len);\n @endcode\n/\n/**@{*/\n/**\n ChaCha20 encoder initialization.\n\n The generator state * `ctx` - is initialized by this function.\n\n * `ctx` - Encoder state.\n * `n` - Nonce. May be NULL.\n * `n_len` - Nonce length. 0 <= * `n_len` - <= * `ocrypto_chacha20_NONCE_BYTES_MAX` - .\n * `key` - Authentication key. May be NULL.\n * `count` - Initial block counter, usually 0 or 1.\n\n @remark If * `key` - is NULL only * `n` - and * `count` - are set. If * `n` - is NULL only * `key` - is set.\nBoth * `key` - and * `n` - must be set before update is called.\n @remark When reusing an encryption key * `key` - for a different message, a\n different nonce * `n` - or initial block counter * `count` - must be used."]
pub fn ocrypto_chacha20_init(
ctx: *mut ocrypto_chacha20_ctx,
n: *const u8,
n_len: usize,
key: *const u8,
count: u32,
);
}
extern "C" {
#[doc = " ChaCha20 encoder.\n\n The message * `m` - is ChaCha20 encrypted and the resulting cipher stream\n is writen to * `c` - .\n\n This function can be called repeatedly on arbitrarily small chunks of a larger\n message until the whole message has been processed.\n\n * `ctx` - Encoder state.\n * `c` - Generated ciphertext. Same length as input message.\n * `m` - Input message.\n * `m_len` - Length of * `c` - and * `m` - ; * `m_len` - < 2^38 bytes.\n\n @remark Initialization of the encoder state * `ctx` - through\n * `ocrypto_chacha20_init` - is required before this function can be called."]
pub fn ocrypto_chacha20_update(
ctx: *mut ocrypto_chacha20_ctx,
c: *mut u8,
m: *const u8,
m_len: usize,
);
}
extern "C" {
#[doc = " ChaCha20 cipher stream encoder.\n\n The message * `m` - is encrypted by applying the XOR operation with a pseudo\n random cipher stream derived from the encryption key * `key` - , the nonce * `n` - , and\n the initial block counter * `count` - .\n\n Calling the function a second time with the generated ciphertext as input\n message * `m` - decrypts it back to the original message.\n\n * `c` - Generated ciphertext. Same length as input message.\n * `m` - Input message.\n * `m_len` - Length of * `c` - and * `m` - .\n * `n` - Nonce.\n * `n_len` - Nonce length. 0 <= * `n_len` - <= * `ocrypto_chacha20_NONCE_BYTES_MAX` - .\n * `key` - Encryption key.\n * `count` - Initial block counter.\n\n @remark * `c` - may be same as * `m` - .\n\n @remark When reusing an encryption key * `key` - for a different message * `m` - , a\n different nonce * `n` - or initial block counter * `count` - must be used."]
pub fn ocrypto_chacha20_encode(
c: *mut u8,
m: *const u8,
m_len: usize,
n: *const u8,
n_len: usize,
key: *const u8,
count: u32,
);
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_poly1305_ctx {
pub h: [u32; 5usize],
pub r: [u32; 4usize],
pub c: [u32; 4usize],
pub buffer: [u8; 16usize],
pub length: u8,
}
#[test]
fn bindgen_test_layout_ocrypto_poly1305_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_poly1305_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_poly1305_ctx>(),
72usize,
concat!("Size of: ", stringify!(ocrypto_poly1305_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_poly1305_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_poly1305_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).h) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_poly1305_ctx),
"::",
stringify!(h)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).r) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_poly1305_ctx),
"::",
stringify!(r)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).c) as usize - ptr as usize },
36usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_poly1305_ctx),
"::",
stringify!(c)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).buffer) as usize - ptr as usize },
52usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_poly1305_ctx),
"::",
stringify!(buffer)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).length) as usize - ptr as usize },
68usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_poly1305_ctx),
"::",
stringify!(length)
)
);
}
extern "C" {
#[doc = "# Incremental Poly1305 generator.\n\n This group of functions can be used to incrementally compute\n the Poly1305 authenticator on a message.\n\n Use pattern:\n\n @code\n ocrypto_poly1305_init(ctx, key);\n ocrypto_poly1305_update(ctx, m, m_len);\n ...\n ocrypto_chacha20_update(ctx, m, m_len);\n ocrypto_poly1305_final(ctx, tag);\n @endcode\n/\n/**@{*/\n/**\n Poly1305 generator initialization.\n\n The generator state * `ctx` - is initialized by this function.\n\n * `ctx` - Generator state.\n * `key` - Authentication key."]
pub fn ocrypto_poly1305_init(ctx: *mut ocrypto_poly1305_ctx, key: *const u8);
}
extern "C" {
#[doc = " Poly1305 generator.\n\n The generator state * `ctx` - is updated to authenticate a message chunk * `in` - .\n\n This function can be called repeatedly on arbitrarily small chunks of the\n message until the whole message has been processed.\n\n * `ctx` - Generator state.\n * `in` - Input data.\n * `in_len` - Length of * `in` - .\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_poly1305_init` - is required before this function can be called."]
pub fn ocrypto_poly1305_update(ctx: *mut ocrypto_poly1305_ctx, in_: *const u8, in_len: usize);
}
extern "C" {
#[doc = " Poly1305 generator padding.\n\n The generator state * `ctx` - is updated to authenticate a zero padding of the last block.\n\n * `ctx` - Generator state.\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_poly1305_init` - is required before this function can be called."]
pub fn ocrypto_poly1305_pad(ctx: *mut ocrypto_poly1305_ctx);
}
extern "C" {
#[doc = " Poly1305 generator output.\n\n The generator state * `ctx` - is updated to finalize the authenticator for the\n previously processed message chunks. The authentication tag is put into * `r` - .\n\n * `ctx` - Generator state.\n * `r` - Generated authentication tag.\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_poly1305_init` - is required before this function can be called.\n\n @remark After return, the generator state * `ctx` - must no longer be used with\n * `ocrypto_poly1305_update` - and * `ocrypto_poly1305_final` - unless it is\n reinitialized using * `ocrypto_poly1305_init` - ."]
pub fn ocrypto_poly1305_final(ctx: *mut ocrypto_poly1305_ctx, r: *mut u8);
}
extern "C" {
#[doc = " Poly1305 message authentication tag.\n\n The Poly1305 authentication of a given input message * `in` - is computed using\n key * `k` - and put into * `r` - .\n\n * `r` - Generated authentication tag.\n * `in` - Input data.\n * `in_len` - Length of * `in` - .\n * `k` - Authentication key."]
pub fn ocrypto_poly1305(r: *mut u8, in_: *const u8, in_len: usize, k: *const u8);
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_chacha20_poly1305_ctx {
pub enc_ctx: ocrypto_chacha20_ctx,
pub auth_ctx: ocrypto_poly1305_ctx,
pub msg_len: usize,
pub aad_len: usize,
}
#[test]
fn bindgen_test_layout_ocrypto_chacha20_poly1305_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_chacha20_poly1305_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_chacha20_poly1305_ctx>(),
212usize,
concat!("Size of: ", stringify!(ocrypto_chacha20_poly1305_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_chacha20_poly1305_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_chacha20_poly1305_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).enc_ctx) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_chacha20_poly1305_ctx),
"::",
stringify!(enc_ctx)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).auth_ctx) as usize - ptr as usize },
132usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_chacha20_poly1305_ctx),
"::",
stringify!(auth_ctx)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).msg_len) as usize - ptr as usize },
204usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_chacha20_poly1305_ctx),
"::",
stringify!(msg_len)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).aad_len) as usize - ptr as usize },
208usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_chacha20_poly1305_ctx),
"::",
stringify!(aad_len)
)
);
}
extern "C" {
#[doc = " ChaCha20-Poly1305 initialization.\n\n The generator state * `ctx` - is initialized by this function.\n\n * `ctx` - Generator state.\n * `n` - Nonce.\n * `n_len` - Length of * `n` - . 0 <= * `n_len` - <= * `ocrypto_chacha20_poly1305_NONCE_BYTES_MAX` - .\n * `k` - Encryption key."]
pub fn ocrypto_chacha20_poly1305_init(
ctx: *mut ocrypto_chacha20_poly1305_ctx,
n: *const u8,
n_len: usize,
k: *const u8,
);
}
extern "C" {
#[doc = " ChaCha20-Poly1305 incremental aad input.\n\n The generator state * `ctx` - is updated to include an additional authenticated data chunk * `a` - .\n\n This function can be called repeatedly until the whole data is processed.\n\n * `ctx` - Generator state.\n * `a` - Additional authenticated data.\n * `a_len` - Length of * `a` - .\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_chacha20_poly1305_init` - is required before this function can be called.\n\n @remark * `ocrypto_chacha20_poly1305_update_aad` - must be called before any call to\n * `ocrypto_chacha20_poly1305_update_enc` - or * `ocrypto_chacha20_poly1305_update_dec` - ."]
pub fn ocrypto_chacha20_poly1305_update_aad(
ctx: *mut ocrypto_chacha20_poly1305_ctx,
a: *const u8,
a_len: usize,
);
}
extern "C" {
#[doc = " ChaCha20-Poly1305 incremental encoder input.\n\n The generator state * `ctx` - is updated to include a message chunk * `m` - .\n\n This function can be called repeatedly on arbitrarily small chunks of the\n message until the whole message has been processed.\n\n * `ctx` - Generator state.\n * `c` - Generated ciphertext. Same length as input message.\n * `m` - Message chunk.\n * `m_len` - Length of * `m` - .\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_chacha20_poly1305_init` - is required before this function can be called.\n\n @remark * `ocrypto_chacha20_poly1305_update_enc` - must be called after any call to\n * `ocrypto_chacha20_poly1305_update_aad` - .\n\n @remark * `c` - may be same as * `m` - ."]
pub fn ocrypto_chacha20_poly1305_update_enc(
ctx: *mut ocrypto_chacha20_poly1305_ctx,
c: *mut u8,
m: *const u8,
m_len: usize,
);
}
extern "C" {
#[doc = " ChaCha20-Poly1305 incremental decoder input.\n\n The generator state * `ctx` - is updated to include a ciphertext chunk * `c` - .\n\n This function can be called repeatedly on arbitrarily small chunks of the\n ciphertext until the whole ciphertext has been processed.\n\n * `ctx` - Generator state.\n * `m` - Decoded message. Same length as received ciphertext.\n * `c` - Ciphertext chunk.\n * `c_len` - Length of * `c` - .\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_chacha20_poly1305_init` - is required before this function can be called.\n\n @remark * `ocrypto_chacha20_poly1305_update_dec` - must be called after any call to\n * `ocrypto_chacha20_poly1305_update_aad` - .\n\n @remark * `m` - may be same as * `c` - ."]
pub fn ocrypto_chacha20_poly1305_update_dec(
ctx: *mut ocrypto_chacha20_poly1305_ctx,
m: *mut u8,
c: *const u8,
c_len: usize,
);
}
extern "C" {
#[doc = " ChaCha20-Poly1305 final encoder step.\n\n The generator state * `ctx` - is used to finalize the encryption and generate the tag.\n\n * `ctx` - Generator state.\n * `tag` - Generated authentication tag."]
pub fn ocrypto_chacha20_poly1305_final_enc(
ctx: *mut ocrypto_chacha20_poly1305_ctx,
tag: *mut u8,
);
}
extern "C" {
#[doc = " ChaCha20-Poly1305 final decoder step.\n\n The generator state * `ctx` - is used to finalize the decryption and check the tag.\n\n * `ctx` - Generator state.\n * `tag` - Received authentication tag.\n\n Returns 0 If * `tag` - is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_chacha20_poly1305_final_dec(
ctx: *mut ocrypto_chacha20_poly1305_ctx,
tag: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " AEAD ChaCha20-Poly1305 encrypt.\n\n The message * `m` - is encrypted using a ChaCha20 cipher stream derived from the\n encryption key * `k` - and the nonce * `n` - . The resulting ciphertext has the same\n length * `m_len` - as the input message * `m` - and is put into * `c` - .\n\n Additionally, the ciphertext * `c` - , as well as the additional authenticated\n data * `a` - , is authenticated with a tag that is generated with Poly1305 using a\n unique subkey derived from * `k` - and * `n` - , and then put into * `tag` - .\n\n * `tag` - Generated authentication tag.\n * `c` - Generated ciphertext. Same length as input message.\n * `m` - Input message.\n * `m_len` - Length of * `m` - and * `c` - .\n * `a` - Additional authenticated data.\n * `a_len` - Length of * `a` - . May be 0.\n * `n` - Nonce.\n * `n_len` - Length of * `n` - . 0 <= * `n_len` - <= * `ocrypto_chacha20_poly1305_NONCE_BYTES_MAX` - .\n * `k` - Encryption key.\n\n @remark * `c` - may be same as * `m` - .\n\n @remark When reusing an encryption key * `k` - for a different message * `m` - or\n different additional authenticated data * `a` - , a different nonce * `n` - \n must be used."]
pub fn ocrypto_chacha20_poly1305_encrypt(
tag: *mut u8,
c: *mut u8,
m: *const u8,
m_len: usize,
a: *const u8,
a_len: usize,
n: *const u8,
n_len: usize,
k: *const u8,
);
}
extern "C" {
#[doc = " AEAD ChaCha20-Poly1305 decrypt.\n\n If the authentication tag * `tag` - is valid for the ciphertext * `c` - , the\n additional authenticated data * `a` - , the encryption key * `k` - and the nonce\n * `n` - , the ciphertext is decrypted and put into * `m` - . The decrypted message\n * `m` - has the same length * `c_len` - as the original ciphertext.\n\n * `tag` - Received authentication tag.\n * `m` - Decoded message. Same length as received ciphertext.\n * `c` - Received ciphertext.\n * `c_len` - Length of * `c` - and * `m` - .\n * `a` - Received additional authenticated data.\n * `a_len` - Length of * `a` - . May be 0.\n * `n` - Nonce.\n * `n_len` - Length of * `n` - . 0 <= * `n_len` - <= * `ocrypto_chacha20_poly1305_NONCE_BYTES_MAX` - .\n * `k` - Encryption key.\n\n Returns 0 If * `tag` - is valid.\n Returns -1 Otherwise.\n\n @remark * `m` - may be same as * `c` - ."]
pub fn ocrypto_chacha20_poly1305_decrypt(
tag: *const u8,
m: *mut u8,
c: *const u8,
c_len: usize,
a: *const u8,
a_len: usize,
n: *const u8,
n_len: usize,
k: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Variable length comparison.\n\n * `x` - Memory region to compare with * `y` - .\n * `y` - Memory region to compare with * `x` - .\n * `length` - Number of bytes to compare, * `length` - > 0.\n\n Returns 1 If * `x` - and * `y` - point to equal memory regions.\n Returns 0 Otherwise."]
pub fn ocrypto_constant_time_equal(
x: *const ::core::ffi::c_void,
y: *const ::core::ffi::c_void,
length: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Variable length compare to zero.\n\n * `x` - Memory region that will be compared.\n * `length` - Number of bytes to compare, * `length` - > 0.\n\n Returns 1 If * `x` - is equal to a zero memory region.\n Returns 0 Otherwise."]
pub fn ocrypto_constant_time_is_zero(
x: *const ::core::ffi::c_void,
length: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Variable length bitwise xor.\n\n * `r` - Memory region to store the result.\n * `x` - Memory region containing the first argument.\n * `y` - Memory region containing the second argument.\n * `length` - Number of bytes in both arguments, * `length` - > 0.\n\n @remark * `r` - may be same as * `x` - or * `y` - ."]
pub fn ocrypto_constant_time_xor(
r: *mut ::core::ffi::c_void,
x: *const ::core::ffi::c_void,
y: *const ::core::ffi::c_void,
length: usize,
);
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_sc_p224 {
pub w: [u32; 7usize],
}
#[test]
fn bindgen_test_layout_ocrypto_sc_p224() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_sc_p224> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_sc_p224>(),
28usize,
concat!("Size of: ", stringify!(ocrypto_sc_p224))
);
assert_eq!(
::core::mem::align_of::<ocrypto_sc_p224>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_sc_p224))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).w) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sc_p224),
"::",
stringify!(w)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_mod_p224 {
pub w: [u32; 7usize],
}
#[test]
fn bindgen_test_layout_ocrypto_mod_p224() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_mod_p224> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_mod_p224>(),
28usize,
concat!("Size of: ", stringify!(ocrypto_mod_p224))
);
assert_eq!(
::core::mem::align_of::<ocrypto_mod_p224>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_mod_p224))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).w) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_mod_p224),
"::",
stringify!(w)
)
);
}
extern "C" {
#[doc = "@endcond"]
pub fn ocrypto_sc_p224_to28bytes(r: *mut u8, x: *const ocrypto_sc_p224);
}
extern "C" {
pub fn ocrypto_sc_p224_from28bytes(r: *mut ocrypto_sc_p224, x: *const u8)
-> ::core::ffi::c_int;
}
extern "C" {
pub fn ocrypto_sc_p224_from36bytes(r: *mut ocrypto_sc_p224, x: *const u8);
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_cp_p224 {
pub x: ocrypto_mod_p224,
pub y: ocrypto_mod_p224,
}
#[test]
fn bindgen_test_layout_ocrypto_cp_p224() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_cp_p224> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_cp_p224>(),
56usize,
concat!("Size of: ", stringify!(ocrypto_cp_p224))
);
assert_eq!(
::core::mem::align_of::<ocrypto_cp_p224>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_cp_p224))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).x) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_cp_p224),
"::",
stringify!(x)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).y) as usize - ptr as usize },
28usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_cp_p224),
"::",
stringify!(y)
)
);
}
extern "C" {
#[doc = " Load r.x from bytes, keep r.y.\n\n * `r` - Point with r.x loaded, r.y kept.\n * `p` - x as as array of bytes.\n\n Returns 0 If * `r` - is a valid curve point.\n Returns -1 Otherwise."]
pub fn ocrypto_curve_p224_from28bytes(
r: *mut ocrypto_cp_p224,
p: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Load point from bytes.\n\n * `r` - Loaded point.\n * `p` - Point as array of bytes.\n\n Returns 0 If * `r` - is a valid curve point.\n Returns -1 Otherwise."]
pub fn ocrypto_curve_p224_from56bytes(
r: *mut ocrypto_cp_p224,
p: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Store p.x to bytes.\n\n * `r` - x stored as array.\n * `p` - Point with x to be stored."]
pub fn ocrypto_curve_p224_to28bytes(r: *mut u8, p: *mut ocrypto_cp_p224);
}
extern "C" {
#[doc = " Store p.x to bytes.\n\n * `r` - Point stored as array.\n * `p` - Point to be stored."]
pub fn ocrypto_curve_p224_to56bytes(r: *mut u8, p: *mut ocrypto_cp_p224);
}
extern "C" {
#[doc = " P224 scalar multiplication.\n\n r = p * s\n r = [0,0] if p = [0,0] or s mod q = 0\n\n * `r` - Output point.\n * `p` - Input point.\n * `s` - Scalar.\n\n Returns -1 If r = [0,0].\n Returns 0 If 0 < s < q.\n Returns 1 If s > q."]
pub fn ocrypto_curve_p224_scalarmult(
r: *mut ocrypto_cp_p224,
p: *const ocrypto_cp_p224,
s: *const ocrypto_sc_p224,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " P224 scalar base multiplication.\n\n r = basePoint * s\n r = [0,0] if s mod q = 0\n\n * `r` - Output point.\n * `s` - Scalar.\n\n Returns -1 If r = [0,0].\n Returns 0 If 0 < s < q.\n Returns 1 If s > q."]
pub fn ocrypto_curve_p224_scalarmult_base(
r: *mut ocrypto_cp_p224,
s: *const ocrypto_sc_p224,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " P224 add and double\n\n r = p + q\n p == [0,0] -> r = q\n q == [0,0] -> r = p\n p == -q -> r = [0,0]\n\n * `r` - Resulting point\n * `p` - Input point.\n * `q` - input point.\n\n Returns -1 if r = [0,0].\n Returns 0 if successfull."]
pub fn ocrypto_curve_p224_add(
r: *mut ocrypto_cp_p224,
p: *const ocrypto_cp_p224,
q: *const ocrypto_cp_p224,
) -> ::core::ffi::c_int;
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_sha512_ctx {
pub h: [u64; 8usize],
pub v: [u64; 8usize],
pub w: [u64; 16usize],
pub buffer: [u8; 128usize],
pub length: u32,
pub in_length: usize,
}
#[test]
fn bindgen_test_layout_ocrypto_sha512_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_sha512_ctx> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_sha512_ctx>(),
392usize,
concat!("Size of: ", stringify!(ocrypto_sha512_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_sha512_ctx>(),
8usize,
concat!("Alignment of ", stringify!(ocrypto_sha512_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).h) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sha512_ctx),
"::",
stringify!(h)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).v) as usize - ptr as usize },
64usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sha512_ctx),
"::",
stringify!(v)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).w) as usize - ptr as usize },
128usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sha512_ctx),
"::",
stringify!(w)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).buffer) as usize - ptr as usize },
256usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sha512_ctx),
"::",
stringify!(buffer)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).length) as usize - ptr as usize },
384usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sha512_ctx),
"::",
stringify!(length)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).in_length) as usize - ptr as usize },
388usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sha512_ctx),
"::",
stringify!(in_length)
)
);
}
extern "C" {
#[doc = "# Incremental SHA-512 generator.\n\n This group of functions can be used to incrementally compute the SHA-512\n hash for a given message.\n/\n/**@{*/\n/**\n SHA-512 initialization.\n\n The generator state * `ctx` - is initialized by this function.\n\n * `ctx` - Generator state."]
pub fn ocrypto_sha512_init(ctx: *mut ocrypto_sha512_ctx);
}
extern "C" {
#[doc = " SHA-512 incremental data input.\n\n The generator state * `ctx` - is updated to hash a message chunk * `in` - .\n\n This function can be called repeatedly until the whole message is processed.\n\n * `ctx` - Generator state.\n * `in` - Input data.\n * `in_len` - Length of * `in` - .\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_sha512_init` - is required before this function can be called."]
pub fn ocrypto_sha512_update(ctx: *mut ocrypto_sha512_ctx, in_: *const u8, in_len: usize);
}
extern "C" {
#[doc = " SHA-512 output.\n\n The generator state * `ctx` - is updated to finalize the hash for the previously\n processed message chunks. The hash is put into * `r` - .\n\n * `ctx` - Generator state.\n * `r` - Generated hash value.\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_sha512_init` - is required before this function can be called.\n\n @remark After return, the generator state * `ctx` - must no longer be used with\n * `ocrypto_sha512_update` - and * `ocrypto_sha512_final` - unless it is\n reinitialized using * `ocrypto_sha512_init` - ."]
pub fn ocrypto_sha512_final(ctx: *mut ocrypto_sha512_ctx, r: *mut u8);
}
extern "C" {
#[doc = " SHA-512 hash.\n\n The SHA-512 hash of a given input message * `in` - is computed and put into * `r` - .\n\n * `r` - Generated hash.\n * `in` - Input data.\n * `in_len` - Length of * `in` - ."]
pub fn ocrypto_sha512(r: *mut u8, in_: *const u8, in_len: usize);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_mod25519 {
#[doc = "@cond"]
pub w: [u32; 8usize],
}
#[test]
fn bindgen_test_layout_ocrypto_mod25519() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_mod25519> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_mod25519>(),
32usize,
concat!("Size of: ", stringify!(ocrypto_mod25519))
);
assert_eq!(
::core::mem::align_of::<ocrypto_mod25519>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_mod25519))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).w) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_mod25519),
"::",
stringify!(w)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_sc25519 {
#[doc = "@cond"]
pub w: [u32; 8usize],
}
#[test]
fn bindgen_test_layout_ocrypto_sc25519() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_sc25519> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_sc25519>(),
32usize,
concat!("Size of: ", stringify!(ocrypto_sc25519))
);
assert_eq!(
::core::mem::align_of::<ocrypto_sc25519>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_sc25519))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).w) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sc25519),
"::",
stringify!(w)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_ge25519 {
#[doc = "@cond"]
pub x: ocrypto_mod25519,
pub y: ocrypto_mod25519,
pub z: ocrypto_mod25519,
}
#[test]
fn bindgen_test_layout_ocrypto_ge25519() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_ge25519> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_ge25519>(),
96usize,
concat!("Size of: ", stringify!(ocrypto_ge25519))
);
assert_eq!(
::core::mem::align_of::<ocrypto_ge25519>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_ge25519))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).x) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ge25519),
"::",
stringify!(x)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).y) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ge25519),
"::",
stringify!(y)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).z) as usize - ptr as usize },
64usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ge25519),
"::",
stringify!(z)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_ge25519_ext {
#[doc = "@cond"]
pub x: ocrypto_mod25519,
pub y: ocrypto_mod25519,
pub z: ocrypto_mod25519,
pub t: ocrypto_mod25519,
}
#[test]
fn bindgen_test_layout_ocrypto_ge25519_ext() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_ge25519_ext> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_ge25519_ext>(),
128usize,
concat!("Size of: ", stringify!(ocrypto_ge25519_ext))
);
assert_eq!(
::core::mem::align_of::<ocrypto_ge25519_ext>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_ge25519_ext))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).x) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ge25519_ext),
"::",
stringify!(x)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).y) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ge25519_ext),
"::",
stringify!(y)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).z) as usize - ptr as usize },
64usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ge25519_ext),
"::",
stringify!(z)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).t) as usize - ptr as usize },
96usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ge25519_ext),
"::",
stringify!(t)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_ge25519_comp {
#[doc = "@cond"]
pub e: ocrypto_mod25519,
pub f: ocrypto_mod25519,
pub g: ocrypto_mod25519,
pub h: ocrypto_mod25519,
}
#[test]
fn bindgen_test_layout_ocrypto_ge25519_comp() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_ge25519_comp> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_ge25519_comp>(),
128usize,
concat!("Size of: ", stringify!(ocrypto_ge25519_comp))
);
assert_eq!(
::core::mem::align_of::<ocrypto_ge25519_comp>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_ge25519_comp))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).e) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ge25519_comp),
"::",
stringify!(e)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).f) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ge25519_comp),
"::",
stringify!(f)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).g) as usize - ptr as usize },
64usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ge25519_comp),
"::",
stringify!(g)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).h) as usize - ptr as usize },
96usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ge25519_comp),
"::",
stringify!(h)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_ge25519_ctx {
#[doc = "@cond"]
pub comp: ocrypto_ge25519_comp,
pub ext: ocrypto_ge25519_ext,
pub pre: [ocrypto_ge25519_ext; 3usize],
}
#[test]
fn bindgen_test_layout_ocrypto_ge25519_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_ge25519_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_ge25519_ctx>(),
640usize,
concat!("Size of: ", stringify!(ocrypto_ge25519_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_ge25519_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_ge25519_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).comp) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ge25519_ctx),
"::",
stringify!(comp)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ext) as usize - ptr as usize },
128usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ge25519_ctx),
"::",
stringify!(ext)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pre) as usize - ptr as usize },
256usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ge25519_ctx),
"::",
stringify!(pre)
)
);
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct ocrypto_ed25519_ctx {
pub c: ocrypto_ed25519_ctx__bindgen_ty_1,
pub r: ocrypto_sc25519,
pub k: ocrypto_sc25519,
pub s: ocrypto_sc25519,
pub R: ocrypto_ge25519,
pub ext: [u8; 64usize],
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Copy, Clone)]
pub union ocrypto_ed25519_ctx__bindgen_ty_1 {
pub sha: ocrypto_sha512_ctx,
pub ge: ocrypto_ge25519_ctx,
}
#[test]
fn bindgen_test_layout_ocrypto_ed25519_ctx__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_ed25519_ctx__bindgen_ty_1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_ed25519_ctx__bindgen_ty_1>(),
640usize,
concat!("Size of: ", stringify!(ocrypto_ed25519_ctx__bindgen_ty_1))
);
assert_eq!(
::core::mem::align_of::<ocrypto_ed25519_ctx__bindgen_ty_1>(),
8usize,
concat!(
"Alignment of ",
stringify!(ocrypto_ed25519_ctx__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sha) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ed25519_ctx__bindgen_ty_1),
"::",
stringify!(sha)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ge) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ed25519_ctx__bindgen_ty_1),
"::",
stringify!(ge)
)
);
}
#[test]
fn bindgen_test_layout_ocrypto_ed25519_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_ed25519_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_ed25519_ctx>(),
896usize,
concat!("Size of: ", stringify!(ocrypto_ed25519_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_ed25519_ctx>(),
8usize,
concat!("Alignment of ", stringify!(ocrypto_ed25519_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).c) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ed25519_ctx),
"::",
stringify!(c)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).r) as usize - ptr as usize },
640usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ed25519_ctx),
"::",
stringify!(r)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).k) as usize - ptr as usize },
672usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ed25519_ctx),
"::",
stringify!(k)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).s) as usize - ptr as usize },
704usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ed25519_ctx),
"::",
stringify!(s)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).R) as usize - ptr as usize },
736usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ed25519_ctx),
"::",
stringify!(R)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ext) as usize - ptr as usize },
832usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ed25519_ctx),
"::",
stringify!(ext)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_curve25519_ctx {
#[doc = "@cond"]
pub x0: ocrypto_mod25519,
#[doc = "@cond"]
pub xn: ocrypto_mod25519,
#[doc = "@cond"]
pub zn: ocrypto_mod25519,
#[doc = "@cond"]
pub xm: ocrypto_mod25519,
#[doc = "@cond"]
pub zm: ocrypto_mod25519,
#[doc = "@cond"]
pub a: ocrypto_mod25519,
#[doc = "@cond"]
pub c: ocrypto_mod25519,
}
#[test]
fn bindgen_test_layout_ocrypto_curve25519_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_curve25519_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_curve25519_ctx>(),
224usize,
concat!("Size of: ", stringify!(ocrypto_curve25519_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_curve25519_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_curve25519_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).x0) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_curve25519_ctx),
"::",
stringify!(x0)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).xn) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_curve25519_ctx),
"::",
stringify!(xn)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).zn) as usize - ptr as usize },
64usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_curve25519_ctx),
"::",
stringify!(zn)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).xm) as usize - ptr as usize },
96usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_curve25519_ctx),
"::",
stringify!(xm)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).zm) as usize - ptr as usize },
128usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_curve25519_ctx),
"::",
stringify!(zm)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).a) as usize - ptr as usize },
160usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_curve25519_ctx),
"::",
stringify!(a)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).c) as usize - ptr as usize },
192usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_curve25519_ctx),
"::",
stringify!(c)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_mod_p256 {
#[doc = "@cond"]
pub w: [u32; 8usize],
}
#[test]
fn bindgen_test_layout_ocrypto_mod_p256() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_mod_p256> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_mod_p256>(),
32usize,
concat!("Size of: ", stringify!(ocrypto_mod_p256))
);
assert_eq!(
::core::mem::align_of::<ocrypto_mod_p256>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_mod_p256))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).w) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_mod_p256),
"::",
stringify!(w)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_sc_p256 {
#[doc = "@cond"]
pub w: [u32; 8usize],
}
#[test]
fn bindgen_test_layout_ocrypto_sc_p256() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_sc_p256> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_sc_p256>(),
32usize,
concat!("Size of: ", stringify!(ocrypto_sc_p256))
);
assert_eq!(
::core::mem::align_of::<ocrypto_sc_p256>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_sc_p256))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).w) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sc_p256),
"::",
stringify!(w)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_p256_inv_ctx {
#[doc = "@cond"]
pub x: ocrypto_mod_p256,
#[doc = "@cond"]
pub x3: ocrypto_mod_p256,
#[doc = "@cond"]
pub xn: ocrypto_mod_p256,
#[doc = "@cond"]
pub t: ocrypto_mod_p256,
pub step: ::core::ffi::c_int,
}
#[test]
fn bindgen_test_layout_ocrypto_p256_inv_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_p256_inv_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_p256_inv_ctx>(),
132usize,
concat!("Size of: ", stringify!(ocrypto_p256_inv_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_p256_inv_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_p256_inv_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).x) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_p256_inv_ctx),
"::",
stringify!(x)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).x3) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_p256_inv_ctx),
"::",
stringify!(x3)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).xn) as usize - ptr as usize },
64usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_p256_inv_ctx),
"::",
stringify!(xn)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).t) as usize - ptr as usize },
96usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_p256_inv_ctx),
"::",
stringify!(t)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).step) as usize - ptr as usize },
128usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_p256_inv_ctx),
"::",
stringify!(step)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_cp_p256 {
#[doc = "@cond"]
pub x: ocrypto_mod_p256,
pub y: ocrypto_mod_p256,
}
#[test]
fn bindgen_test_layout_ocrypto_cp_p256() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_cp_p256> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_cp_p256>(),
64usize,
concat!("Size of: ", stringify!(ocrypto_cp_p256))
);
assert_eq!(
::core::mem::align_of::<ocrypto_cp_p256>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_cp_p256))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).x) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_cp_p256),
"::",
stringify!(x)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).y) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_cp_p256),
"::",
stringify!(y)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_p256_mult_ctx {
#[doc = "@cond"]
pub p: ocrypto_cp_p256,
#[doc = "@cond"]
pub q0: ocrypto_cp_p256,
#[doc = "@cond"]
pub q1: ocrypto_cp_p256,
pub e: [u32; 8usize],
pub inv: ocrypto_p256_inv_ctx,
pub ret: ::core::ffi::c_int,
pub prev: ::core::ffi::c_int,
pub dec: ::core::ffi::c_int,
pub step: ::core::ffi::c_int,
}
#[test]
fn bindgen_test_layout_ocrypto_p256_mult_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_p256_mult_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_p256_mult_ctx>(),
372usize,
concat!("Size of: ", stringify!(ocrypto_p256_mult_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_p256_mult_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_p256_mult_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).p) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_p256_mult_ctx),
"::",
stringify!(p)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).q0) as usize - ptr as usize },
64usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_p256_mult_ctx),
"::",
stringify!(q0)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).q1) as usize - ptr as usize },
128usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_p256_mult_ctx),
"::",
stringify!(q1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).e) as usize - ptr as usize },
192usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_p256_mult_ctx),
"::",
stringify!(e)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).inv) as usize - ptr as usize },
224usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_p256_mult_ctx),
"::",
stringify!(inv)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ret) as usize - ptr as usize },
356usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_p256_mult_ctx),
"::",
stringify!(ret)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).prev) as usize - ptr as usize },
360usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_p256_mult_ctx),
"::",
stringify!(prev)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).dec) as usize - ptr as usize },
364usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_p256_mult_ctx),
"::",
stringify!(dec)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).step) as usize - ptr as usize },
368usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_p256_mult_ctx),
"::",
stringify!(step)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_srp_mg {
#[doc = "@cond"]
pub w: [u32; 96usize],
}
#[test]
fn bindgen_test_layout_ocrypto_srp_mg() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_srp_mg> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_srp_mg>(),
384usize,
concat!("Size of: ", stringify!(ocrypto_srp_mg))
);
assert_eq!(
::core::mem::align_of::<ocrypto_srp_mg>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_srp_mg))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).w) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_srp_mg),
"::",
stringify!(w)
)
);
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_srp_math_ctx {
#[doc = "@cond"]
pub mem: [u32; 96usize],
pub m: [u32; 192usize],
pub x: [u32; 96usize],
pub a2: ocrypto_srp_mg,
pub a3: ocrypto_srp_mg,
pub ax: ocrypto_srp_mg,
}
#[test]
fn bindgen_test_layout_ocrypto_srp_math_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_srp_math_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_srp_math_ctx>(),
2688usize,
concat!("Size of: ", stringify!(ocrypto_srp_math_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_srp_math_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_srp_math_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).mem) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_srp_math_ctx),
"::",
stringify!(mem)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).m) as usize - ptr as usize },
384usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_srp_math_ctx),
"::",
stringify!(m)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).x) as usize - ptr as usize },
1152usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_srp_math_ctx),
"::",
stringify!(x)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).a2) as usize - ptr as usize },
1536usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_srp_math_ctx),
"::",
stringify!(a2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).a3) as usize - ptr as usize },
1920usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_srp_math_ctx),
"::",
stringify!(a3)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ax) as usize - ptr as usize },
2304usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_srp_math_ctx),
"::",
stringify!(ax)
)
);
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct ocrypto_srp_ctx {
pub c: ocrypto_srp_ctx__bindgen_ty_1,
pub x: ocrypto_srp_mg,
pub y: ocrypto_srp_mg,
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Copy, Clone)]
pub union ocrypto_srp_ctx__bindgen_ty_1 {
pub sha: ocrypto_sha512_ctx,
pub mul: ocrypto_srp_math_ctx,
}
#[test]
fn bindgen_test_layout_ocrypto_srp_ctx__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_srp_ctx__bindgen_ty_1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_srp_ctx__bindgen_ty_1>(),
2688usize,
concat!("Size of: ", stringify!(ocrypto_srp_ctx__bindgen_ty_1))
);
assert_eq!(
::core::mem::align_of::<ocrypto_srp_ctx__bindgen_ty_1>(),
8usize,
concat!("Alignment of ", stringify!(ocrypto_srp_ctx__bindgen_ty_1))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sha) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_srp_ctx__bindgen_ty_1),
"::",
stringify!(sha)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).mul) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_srp_ctx__bindgen_ty_1),
"::",
stringify!(mul)
)
);
}
#[test]
fn bindgen_test_layout_ocrypto_srp_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_srp_ctx> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_srp_ctx>(),
3456usize,
concat!("Size of: ", stringify!(ocrypto_srp_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_srp_ctx>(),
8usize,
concat!("Alignment of ", stringify!(ocrypto_srp_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).c) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_srp_ctx),
"::",
stringify!(c)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).x) as usize - ptr as usize },
2688usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_srp_ctx),
"::",
stringify!(x)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).y) as usize - ptr as usize },
3072usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_srp_ctx),
"::",
stringify!(y)
)
);
}
extern "C" {
#[doc = " Load r.x from bytes, keep r.y.\n\n * `r` - Point with r.x loaded, r.y kept.\n * `p` - x as as array of bytes.\n\n Returns 0 If * `r` - is a valid curve point.\n Returns -1 Otherwise."]
pub fn ocrypto_curve_p256_from32bytes(
r: *mut ocrypto_cp_p256,
p: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Load point from bytes.\n\n * `r` - Loaded point.\n * `p` - Point as array of bytes.\n\n Returns 0 If * `r` - is a valid curve point.\n Returns -1 Otherwise."]
pub fn ocrypto_curve_p256_from64bytes(
r: *mut ocrypto_cp_p256,
p: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Store p.x to bytes.\n\n * `r` - x stored as array.\n * `p` - Point with x to be stored."]
pub fn ocrypto_curve_p256_to32bytes(r: *mut u8, p: *mut ocrypto_cp_p256);
}
extern "C" {
#[doc = " Store p.x to bytes.\n\n * `r` - Point stored as array.\n * `p` - Point to be stored."]
pub fn ocrypto_curve_p256_to64bytes(r: *mut u8, p: *mut ocrypto_cp_p256);
}
extern "C" {
#[doc = " P256 scalar multiplication.\n\n r = p * s\n r = [0,0] if p = [0,0] or s mod q = 0\n\n * `r` - Output point.\n * `p` - Input point.\n * `s` - Scalar.\n\n Returns -1 If r = [0,0].\n Returns 0 If 0 < s < q.\n Returns 1 If s > q."]
pub fn ocrypto_curve_p256_scalarmult(
r: *mut ocrypto_cp_p256,
p: *const ocrypto_cp_p256,
s: *const ocrypto_sc_p256,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " P256 scalar base multiplication.\n\n r = basePoint * s\n r = [0,0] if s mod q = 0\n\n * `r` - Output point.\n * `s` - Scalar.\n\n Returns -1 If r = [0,0].\n Returns 0 If 0 < s < q.\n Returns 1 If s > q."]
pub fn ocrypto_curve_p256_scalarmult_base(
r: *mut ocrypto_cp_p256,
s: *const ocrypto_sc_p256,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Curve25519 scalar multiplication `r = n * basePoint`.\n\n Given a secret key * `n` - , the corresponding Curve25519 public key is computed\n and put into * `r` - .\n\n * `r` - Resulting curve point.\n * `n` - Scalar factor.\n\n @remark * `r` - may be same as * `n` - ."]
pub fn ocrypto_curve25519_scalarmult_base(r: *mut u8, n: *const u8);
}
extern "C" {
#[doc = " Curve25519 scalar multiplication `r = n * p`.\n\n A shared secret is computed from the local secret key * `n` - and another\n party's public key * `p` - and put into * `r` - . The same shared secret is\n generated when the other party combines its private key with the local public\n key.\n\n * `r` - Resulting curve point.\n * `n` - Scalar factor.\n * `p` - Point factor.\n\n @remark * `r` - may be same as * `n` - ."]
pub fn ocrypto_curve25519_scalarmult(r: *mut u8, n: *const u8, p: *const u8);
}
extern "C" {
#[doc = " Curve25519 scalar multiplication `r = n * basePoint` with context.\n\n Given a secret key * `n` - , the corresponding Curve25519 public key is computed\n and put into * `r` - .\n\n * `ctx` - Context.\n * `r` - Resulting curve point.\n * `n` - Scalar factor.\n\n @remark * `r` - may be same as * `n` - ."]
pub fn ocrypto_curve25519_scalarmult_base_ctx(
ctx: *mut ocrypto_curve25519_ctx,
r: *mut u8,
n: *const u8,
);
}
extern "C" {
#[doc = " Curve25519 scalar multiplication `r = n * p` with context.\n\n A shared secret is computed from the local secret key * `n` - and another\n party's public key * `p` - and put into * `r` - . The same shared secret is\n generated when the other party combines its private key with the local public\n key.\n\n * `ctx` - Context.\n * `r` - Resulting curve point.\n * `n` - Scalar factor.\n * `p` - Point factor.\n\n @remark * `r` - may be same as * `n` - ."]
pub fn ocrypto_curve25519_scalarmult_ctx(
ctx: *mut ocrypto_curve25519_ctx,
r: *mut u8,
n: *const u8,
p: *const u8,
);
}
extern "C" {
#[doc = " ECDH P-224 secret key check.\n\n * `sk` - Secret key to check.\n\n Returns 0 If * `sk` - is a valid secret key.\n Returns -1 Otherwise.\n\n @remark To generate a valid secret key use the following code pattern:\n @code{.c}\n do get_random(sk); while (ocrypto_ecdh_p224_secret_key_check(sk));\n @endcode"]
pub fn ocrypto_ecdh_p224_secret_key_check(sk: *const u8) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " ECDH P-224 public key check.\n\n * `pk` - Public key to check.\n\n Returns 0 If * `pk` - is a valid public key.\n Returns -1 Otherwise."]
pub fn ocrypto_ecdh_p224_public_key_check(pk: *const u8) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " ECDH P-224 public key generation.\n\n Given a secret key * `sk` - the corresponding public key is computed and put\n into * `pk` - .\n\n * `pk` - Generated public key.\n * `sk` - Secret key. Must be pre-filled with random data.\n\n Returns 0 If * `sk` - is a valid secret key.\n Returns -1 Otherwise.\n\n @remark * `pk` - may be same as * `sk` - .\n @remark To generate a valid key pair use the following code pattern:\n @code{.c}\n do get_random(sk); while (ocrypto_ecdh_p224_public_key(pk, sk));\n @endcode"]
pub fn ocrypto_ecdh_p224_public_key(pk: *mut u8, sk: *const u8) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " ECDH P-224 common secret.\n\n The common secret is computed from both the client's public key * `pk` - \n and the server's secret key * `sk` - and put into * `r` - .\n\n * `r` - Generated common secret.\n * `sk` - Server private key.\n * `pk` - Client public key.\n\n Returns 0 If * `sk` - is a valid secret key and * `pk` - is a valid public key.\n Returns -1 Otherwise.\n\n @remark * `r` - may be same as * `sk` - or * `pk` - ."]
pub fn ocrypto_ecdh_p224_common_secret(
r: *mut u8,
sk: *const u8,
pk: *const u8,
) -> ::core::ffi::c_int;
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_ecdh_p256_ctx {
pub mul: ocrypto_p256_mult_ctx,
pub ret: ::core::ffi::c_int,
}
#[test]
fn bindgen_test_layout_ocrypto_ecdh_p256_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_ecdh_p256_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_ecdh_p256_ctx>(),
376usize,
concat!("Size of: ", stringify!(ocrypto_ecdh_p256_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_ecdh_p256_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_ecdh_p256_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).mul) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ecdh_p256_ctx),
"::",
stringify!(mul)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).ret) as usize - ptr as usize },
372usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_ecdh_p256_ctx),
"::",
stringify!(ret)
)
);
}
extern "C" {
#[doc = " ECDH P-256 secret key check.\n\n * `sk` - Secret key to check.\n\n Returns 0 If * `sk` - is a valid secret key.\n Returns -1 Otherwise.\n\n @remark To generate a valid secret key use the following code pattern:\n @code{.c}\n do get_random(sk); while (ocrypto_ecdh_p256_secret_key_check(sk));\n @endcode"]
pub fn ocrypto_ecdh_p256_secret_key_check(sk: *const u8) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " ECDH P-256 public key check.\n\n * `pk` - Public key to check.\n\n Returns 0 If * `pk` - is a valid public key.\n Returns -1 Otherwise."]
pub fn ocrypto_ecdh_p256_public_key_check(pk: *const u8) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " ECDH P-256 public key generation.\n\n Given a secret key * `sk` - the corresponding public key is computed and put\n into * `pk` - .\n\n * `pk` - Generated public key.\n * `sk` - Secret key. Must be pre-filled with random data.\n\n Returns 0 If * `sk` - is a valid secret key.\n Returns -1 Otherwise.\n\n @remark * `pk` - may be same as * `sk` - .\n @remark To generate a valid key pair use the following code pattern:\n @code{.c}\n do get_random(sk); while (ocrypto_ecdh_p256_public_key(pk, sk));\n @endcode"]
pub fn ocrypto_ecdh_p256_public_key(pk: *mut u8, sk: *const u8) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " ECDH P-256 common secret.\n\n The common secret is computed from both the client's public key * `pk` - \n and the server's secret key * `sk` - and put into * `r` - .\n\n * `r` - Generated common secret.\n * `sk` - Server private key.\n * `pk` - Client public key.\n\n Returns 0 If * `sk` - is a valid secret key and * `pk` - is a valid public key.\n Returns -1 Otherwise.\n\n @remark * `r` - may be same as * `sk` - or * `pk` - ."]
pub fn ocrypto_ecdh_p256_common_secret(
r: *mut u8,
sk: *const u8,
pk: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Incremental ECDH P-256 public key generation start.\n\n Key generation is started and the context * `ctx` - is initialized by this function.\n\n * `ctx` - Context.\n * `sk` - Secret key. Must be pre-filled with random data."]
pub fn ocrypto_ecdh_p256_public_key_init(ctx: *mut ocrypto_ecdh_p256_ctx, sk: *const u8);
}
extern "C" {
#[doc = " Incremental ECDH P-256 public key generation step.\n\n The key calculation is advanced and the context * `ctx` - is updated by this function.\n\n * `ctx` - Context.\n\n Returns 1 If another call to * `ocrypto_ecdh_p256_public_key_init` - is needed.\n Returns 0 If key generation should be completed by a call to * `ocrypto_ecdh_p256_public_key_final` - ."]
pub fn ocrypto_ecdh_p256_public_key_iterate(
ctx: *mut ocrypto_ecdh_p256_ctx,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Incremental ECDH P-256 public key generation final step.\n\n Key generation is finalized and the context * `ctx` - is used to generate the key.\n\n * `ctx` - Context.\n * `pk` - Generated public key.\n\n Returns 0 If * `sk` - is a valid secret key.\n Returns -1 Otherwise."]
pub fn ocrypto_ecdh_p256_public_key_final(
ctx: *mut ocrypto_ecdh_p256_ctx,
pk: *mut u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Incremental ECDH P-256 common secret generation start.\n\n Common secret calculation is started and the context * `ctx` - is initialized by this function.\n\n * `ctx` - Context.\n * `sk` - Server private key.\n * `pk` - Client public key."]
pub fn ocrypto_ecdh_p256_common_secret_init(
ctx: *mut ocrypto_ecdh_p256_ctx,
sk: *const u8,
pk: *const u8,
);
}
extern "C" {
#[doc = " Incremental ECDH P-256 common secret generation step.\n\n Common secret calculation is advanced and the context * `ctx` - is updated by this function.\n\n * `ctx` - Context.\n\n Returns 1 If another call to * `ocrypto_ecdh_p256_common_secret_iterate` - is needed.\n Returns 0 If key generation should be completed by a call to * `ocrypto_ecdh_p256_common_secret_final` - ."]
pub fn ocrypto_ecdh_p256_common_secret_iterate(
ctx: *mut ocrypto_ecdh_p256_ctx,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Incremental ECDH P-256 common secret generation final step.\n\n Common secret calculation is finalized and the context * `ctx` - is used to generate the secret.\n\n * `ctx` - Context.\n * `r` - Generated common secret.\n\n Returns 0 If * `sk` - is a valid secret key and * `pk` - is a valid public key.\n Returns -1 Otherwise."]
pub fn ocrypto_ecdh_p256_common_secret_final(
ctx: *mut ocrypto_ecdh_p256_ctx,
r: *mut u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " ECDSA P-224 public key generation.\n\n Given a secret key * `sk` - the corresponding public key is computed and put\n into * `pk` - .\n\n * `pk` - Generated public key.\n * `sk` - Secret key. Must be pre-filled with random data.\n\n Returns 0 If * `sk` - is a valid secret key.\n Returns -1 Otherwise.\n\n @remark To generate a valid key pair use the following code pattern:\n @code{.c}\n do get_random(sk); while (ocrypto_ecdsa_p224_public_key(pk, sk));\n @endcode"]
pub fn ocrypto_ecdsa_p224_public_key(pk: *mut u8, sk: *const u8) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " ECDSA P-224 signature generation.\n\n The message * `m` - is signed using the secret key * `sk` - and the ephemeral\n session key * `ek` - . The signature is put into * `sig` - .\n\n * `sig` - Generated signature.\n * `m` - Input message.\n * `mlen` - Length of * `m` - .\n * `sk` - Secret key.\n * `ek` - Session key.\n\n Returns 0 If * `ek` - is a valid session key.\n Returns -1 Otherwise."]
pub fn ocrypto_ecdsa_p224_sign(
sig: *mut u8,
m: *const u8,
mlen: usize,
sk: *const u8,
ek: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " ECDSA P-224 signature generation from SHA224 hash.\n\n The message hash * `hash` - is signed using the secret key * `sk` - and the ephemeral\n session key * `ek` - . The signature is put into * `sig` - .\n\n * `sig` - Generated signature.\n * `hash` - Input hash.\n * `sk` - Secret key.\n * `ek` - Session key.\n\n Returns 0 If * `ek` - is a valid session key.\n Returns -1 Otherwise."]
pub fn ocrypto_ecdsa_p224_sign_hash(
sig: *mut u8,
hash: *const u8,
sk: *const u8,
ek: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " ECDSA P-224 signature verification.\n\n The signature * `sig` - of the input message * `m` - is verified using the signer's\n public key * `pk` - .\n\n * `sig` - Input signature.\n * `m` - Input message.\n * `mlen` - Length of * `m` - .\n * `pk` - Signer's public key.\n\n Returns 0 If the signature is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_ecdsa_p224_verify(
sig: *const u8,
m: *const u8,
mlen: usize,
pk: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " ECDSA P-224 signature verification from SHA224 hash.\n\n The signature * `sig` - of the message hash * `hash` - is verified using the signer's\n public key * `pk` - .\n\n * `sig` - Input signature.\n * `hash` - Input hash.\n * `pk` - Signer's public key.\n\n Returns 0 If the signature is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_ecdsa_p224_verify_hash(
sig: *const u8,
hash: *const u8,
pk: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " ECDSA P-256 public key generation.\n\n Given a secret key * `sk` - the corresponding public key is computed and put\n into * `pk` - .\n\n * `pk` - Generated public key.\n * `sk` - Secret key. Must be pre-filled with random data.\n\n Returns 0 If * `sk` - is a valid secret key.\n Returns -1 Otherwise.\n\n @remark To generate a valid key pair use the following code pattern:\n @code{.c}\n do get_random(sk); while (ocrypto_ecdsa_p256_public_key(pk, sk));\n @endcode"]
pub fn ocrypto_ecdsa_p256_public_key(pk: *mut u8, sk: *const u8) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " ECDSA P-256 signature generation.\n\n The message * `m` - is signed using the secret key * `sk` - and the ephemeral\n session key * `ek` - . The signature is put into * `sig` - .\n\n * `sig` - Generated signature.\n * `m` - Input message.\n * `mlen` - Length of * `m` - .\n * `sk` - Secret key.\n * `ek` - Session key.\n\n Returns 0 If * `ek` - is a valid session key.\n Returns -1 Otherwise."]
pub fn ocrypto_ecdsa_p256_sign(
sig: *mut u8,
m: *const u8,
mlen: usize,
sk: *const u8,
ek: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " ECDSA P-256 signature generation from SHA256 hash.\n\n The message hash * `hash` - is signed using the secret key * `sk` - and the ephemeral\n session key * `ek` - . The signature is put into * `sig` - .\n\n * `sig` - Generated signature.\n * `hash` - Input hash.\n * `sk` - Secret key.\n * `ek` - Session key.\n\n Returns 0 If * `ek` - is a valid session key.\n Returns -1 Otherwise."]
pub fn ocrypto_ecdsa_p256_sign_hash(
sig: *mut u8,
hash: *const u8,
sk: *const u8,
ek: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " ECDSA P-256 signature verification.\n\n The signature * `sig` - of the input message * `m` - is verified using the signer's\n public key * `pk` - .\n\n * `sig` - Input signature.\n * `m` - Input message.\n * `mlen` - Length of * `m` - .\n * `pk` - Signer's public key.\n\n Returns 0 If the signature is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_ecdsa_p256_verify(
sig: *const u8,
m: *const u8,
mlen: usize,
pk: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " ECDSA P-256 signature verification from SHA256 hash.\n\n The signature * `sig` - of the message hash * `hash` - is verified using the signer's\n public key * `pk` - .\n\n * `sig` - Input signature.\n * `hash` - Input hash.\n * `pk` - Signer's public key.\n\n Returns 0 If the signature is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_ecdsa_p256_verify_hash(
sig: *const u8,
hash: *const u8,
pk: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " EC-JPAKE-P256 public key.\n\n * `X` - Public key.\n * `G` - Generator. May be NULL to use the default generator.\n * `x` - Secret key. 0 < x < group order\n\n Returns 0 If inputs are valid.\n Returns -1 Otherwise."]
pub fn ocrypto_ecjpake_get_public_key(
X: *mut u8,
G: *const u8,
x: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " EC-JPAKE-P256 zero knowledge proof hash.\n\n * `hash` - Generated hash.\n * `X` - Public key.\n * `V` - ZKP ephemeral public key.\n * `G` - Generator. May be NULL to use the default generator.\n * `id` - Identity of originator.\n * `id_len` - Identity length."]
pub fn ocrypto_ecjpake_get_zkp_hash(
hash: *mut u8,
X: *const u8,
V: *const u8,
G: *const u8,
id: *const ::core::ffi::c_char,
id_len: usize,
);
}
extern "C" {
#[doc = " EC-JPAKE-P256 zero knowledge proof generation.\n\n * `r` - ZKP signature.\n * `x` - Secret key. 0 < x < group order\n * `v` - ZKP ephemeral secret key. 0 < v < group order\n * `hash` - Identity of originator.\n * `hash_len` - Identity length.\n\n Returns 0 If inputs are valid.\n Returns -1 Otherwise."]
pub fn ocrypto_ecjpake_zkp_sign(
r: *mut u8,
x: *const u8,
v: *const u8,
hash: *const u8,
hash_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " EC-JPAKE-P256 zero knowledge proof verification.\n\n * `G` - Generator. May be NULL to use the default generator.\n * `X` - Public key.\n * `V` - ZKP ephemeral public key.\n * `r` - ZKP signature.\n * `hash` - Identity of originator.\n * `hash_len` - Identity length.\n\n Returns 0 If the proof is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_ecjpake_zkp_verify(
G: *const u8,
X: *const u8,
V: *const u8,
r: *const u8,
hash: *const u8,
hash_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " EC-JPAKE-P256 public key and zero knowledge proof generation.\n\n * `X` - Public key.\n * `V` - ZKP ephemeral public key.\n * `r` - ZKP signature.\n * `G` - Generator. May be NULL to use the default generator.\n * `x` - Secret key. 0 < x < group order\n * `v` - ZKP ephemeral secret key. 0 < v < group order\n * `id` - Identity of originator.\n * `id_len` - Identity length.\n\n Returns 0 If inputs are valid.\n Returns -1 Otherwise."]
pub fn ocrypto_ecjpake_get_key(
X: *mut u8,
V: *mut u8,
r: *mut u8,
G: *const u8,
x: *const u8,
v: *const u8,
id: *const ::core::ffi::c_char,
id_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " EC-JPAKE-P256 zero knowledge proof verification.\n\n * `G` - Generator. May be NULL to use the default generator.\n * `X` - Public key.\n * `V` - ZKP ephemeral public key.\n * `r` - ZKP signature.\n * `id` - Identity of originator.\n * `id_len` - Identity length.\n\n Returns 0 If proof is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_ecjpake_verify_key(
G: *const u8,
X: *const u8,
V: *const u8,
r: *const u8,
id: *const ::core::ffi::c_char,
id_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " EC-JPAKE-P256 generator derivation.\n\n * `G` - Generator.\n * `X1` - Public key 1.\n * `X2` - Public key 2.\n * `X3` - Public key 3.\n\n Returns 0 If the generator is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_ecjpake_get_generator(
G: *mut u8,
X1: *const u8,
X2: *const u8,
X3: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " EC-JPAKE-P256 read shared secret.\n\n * `rs` - Reduced shared secret.\n * `secret` - Shared secret.\n * `secret_len` - Secret length."]
pub fn ocrypto_ecjpake_read_shared_secret(rs: *mut u8, secret: *const u8, secret_len: usize);
}
extern "C" {
#[doc = " EC-JPAKE-P256 shared secret handling.\n\n * `xs` - Client/server secret key.\n * `x2` - Secret key 2.\n * `rs` - Reduced shared secret.\n\n Returns 0 If the derived secret key is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_ecjpake_process_shared_secret(
xs: *mut u8,
x2: *const u8,
rs: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " EC-JPAKE-P256 premaster secret key generation.\n\n * `secret` - Resulting premaster secret key (curve point).\n * `Xr` - Remote client/server public key.\n * `X2` - Remote public key 2.\n * `xs` - Client/server secret key.\n * `x2` - Secret key 2.\n\n Returns 0 If the premaster secret key is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_ecjpake_get_premaster_secret_key(
secret: *mut u8,
Xr: *const u8,
X2: *const u8,
xs: *const u8,
x2: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " EC-JPAKE-P256 premaster secret generation.\n\n * `secret` - Resulting premaster secret.\n * `Xr` - Remote client/server public key.\n * `X2` - Remote public key 2.\n * `xs` - Client/server secret key.\n * `x2` - Secret key 2.\n\n Returns 0 If the secret is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_ecjpake_get_premaster_secret(
secret: *mut u8,
Xr: *const u8,
X2: *const u8,
xs: *const u8,
x2: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Ed25519 signature key pair generation.\n\n Given a secret key * `sk` - , the corresponding public key is computed and put\n into * `pk` - . The key pair can then be used to sign and verify message signatures.\n\n * `pk` - Generated public key.\n * `sk` - Secret key. Must be pre-filled with random data."]
pub fn ocrypto_ed25519_public_key(pk: *mut u8, sk: *const u8);
}
extern "C" {
#[doc = " Ed25519 signature generate.\n\n The message * `m` - is signed using the secret key * `sk` - and the corresponding\n public key * `pk` - . The signature is put into * `sig` - .\n\n * `sig` - Generated signature.\n * `m` - Input message.\n * `m_len` - Length of * `m` - .\n * `sk` - Secret key.\n * `pk` - Public key."]
pub fn ocrypto_ed25519_sign(
sig: *mut u8,
m: *const u8,
m_len: usize,
sk: *const u8,
pk: *const u8,
);
}
extern "C" {
#[doc = " Ed25519 signature verification.\n\n The signature * `sig` - of the input message * `m` - is verified using the signer's\n public key * `pk` - .\n\n * `sig` - Input signature.\n * `m` - Input message.\n * `m_len` - Length of * `m` - .\n * `pk` - Signer's public key.\n\n Returns 0 If the signature is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_ed25519_verify(
sig: *const u8,
m: *const u8,
m_len: usize,
pk: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " Ed25519 signature key pair generation with context.\n\n Given a secret key * `sk` - , the corresponding public key is computed and put\n into * `pk` - . The key pair can then be used to sign and verify message signatures.\n\n * `ctx` - Context.\n * `pk` - Generated public key.\n * `sk` - Secret key. Must be pre-filled with random data."]
pub fn ocrypto_ed25519_public_key_ctx(
ctx: *mut ocrypto_ed25519_ctx,
pk: *mut u8,
sk: *const u8,
);
}
extern "C" {
#[doc = " Ed25519 signature generate with context.\n\n The message * `m` - is signed using the secret key * `sk` - and the corresponding\n public key * `pk` - . The signature is put into * `sig` - .\n\n * `ctx` - Context.\n * `sig` - Generated signature.\n * `m` - Input message.\n * `m_len` - Length of * `m` - .\n * `sk` - Secret key.\n * `pk` - Public key."]
pub fn ocrypto_ed25519_sign_ctx(
ctx: *mut ocrypto_ed25519_ctx,
sig: *mut u8,
m: *const u8,
m_len: usize,
sk: *const u8,
pk: *const u8,
);
}
extern "C" {
#[doc = " Ed25519 signature verification with context.\n\n The signature * `sig` - of the input message * `m` - is verified using the signer's\n public key * `pk` - .\n\n * `ctx` - Context.\n * `sig` - Input signature.\n * `m` - Input message.\n * `m_len` - Length of * `m` - .\n * `pk` - Signer's public key.\n\n Returns 0 If the signature is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_ed25519_verify_ctx(
ctx: *mut ocrypto_ed25519_ctx,
sig: *const u8,
m: *const u8,
m_len: usize,
pk: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " HKDF-SHA1 algorithm.\n\n A new pseudo-random key of length * `r_len` - is derived from an input key\n * `key` - , a salt * `salt` - and additional information * `info` - . The new key is put\n into * `r` - .\n\n * `r` - Output key.\n * `r_len` - Length of * `r` - .\n * `key` - Input key.\n * `key_len` - Length of * `key` - .\n * `salt` - Salt.\n * `salt_len` - Length of salt * `salt` - .\n * `info` - Additional information.\n * `info_len` - Length of * `info` - ."]
pub fn ocrypto_hkdf_sha1(
r: *mut u8,
r_len: usize,
key: *const u8,
key_len: usize,
salt: *const u8,
salt_len: usize,
info: *const u8,
info_len: usize,
);
}
extern "C" {
#[doc = " HKDF-SHA256 algorithm.\n\n A new pseudo-random key of length * `r_len` - is derived from an input key\n * `key` - , a salt * `salt` - and additional information * `info` - . The new key is put\n into * `r` - .\n\n * `r` - Output key.\n * `r_len` - Length of * `r` - .\n * `key` - Input key.\n * `key_len` - Length of * `key` - .\n * `salt` - Salt.\n * `salt_len` - Length of salt * `salt` - .\n * `info` - Additional information.\n * `info_len` - Length of * `info` - ."]
pub fn ocrypto_hkdf_sha256(
r: *mut u8,
r_len: usize,
key: *const u8,
key_len: usize,
salt: *const u8,
salt_len: usize,
info: *const u8,
info_len: usize,
);
}
extern "C" {
#[doc = " HKDF-SHA512 algorithm.\n\n A new pseudo-random key of length * `r_len` - is derived from an input key\n * `key` - , a salt * `salt` - and additional information * `info` - . The new key is put\n into * `r` - .\n\n * `r` - Output key.\n * `r_len` - Length of * `r` - .\n * `key` - Input key.\n * `key_len` - Length of * `key` - .\n * `salt` - Salt.\n * `salt_len` - Length of salt * `salt` - .\n * `info` - Additional information.\n * `info_len` - Length of * `info` - ."]
pub fn ocrypto_hkdf_sha512(
r: *mut u8,
r_len: usize,
key: *const u8,
key_len: usize,
salt: *const u8,
salt_len: usize,
info: *const u8,
info_len: usize,
);
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_sha1_ctx {
pub h: [u32; 5usize],
pub buffer: [u8; 320usize],
pub length: u32,
pub in_length: usize,
}
#[test]
fn bindgen_test_layout_ocrypto_sha1_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_sha1_ctx> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_sha1_ctx>(),
348usize,
concat!("Size of: ", stringify!(ocrypto_sha1_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_sha1_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_sha1_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).h) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sha1_ctx),
"::",
stringify!(h)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).buffer) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sha1_ctx),
"::",
stringify!(buffer)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).length) as usize - ptr as usize },
340usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sha1_ctx),
"::",
stringify!(length)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).in_length) as usize - ptr as usize },
344usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sha1_ctx),
"::",
stringify!(in_length)
)
);
}
extern "C" {
#[doc = "# Incremental SHA-1 generator.\n\n This group of functions can be used to incrementally compute the SHA-1\n hash for a given message.\n/\n/**@{*/\n/**\n SHA-1 initialization.\n\n The generator state * `ctx` - is initialized by this function.\n\n * `ctx` - Generator state."]
pub fn ocrypto_sha1_init(ctx: *mut ocrypto_sha1_ctx);
}
extern "C" {
#[doc = " SHA-1 incremental data input.\n\n The generator state * `ctx` - is updated to hash a message chunk * `in` - .\n\n This function can be called repeatedly until the whole message is processed.\n\n * `ctx` - Generator state.\n * `in` - Input data.\n * `in_len` - Length of * `in` - .\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_sha1_init` - is required before this function can be called."]
pub fn ocrypto_sha1_update(ctx: *mut ocrypto_sha1_ctx, in_: *const u8, in_len: usize);
}
extern "C" {
#[doc = " SHA-1 output.\n\n The generator state * `ctx` - is updated to finalize the hash for the previously\n processed message chunks. The hash is put into * `r` - .\n\n * `ctx` - Generator state.\n * `r` - Generated hash value.\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_sha1_init` - is required before this function can be called.\n\n @remark After return, the generator state * `ctx` - must no longer be used with\n * `ocrypto_sha1_update` - and * `ocrypto_sha1_final` - unless it is\n reinitialized using * `ocrypto_sha1_init` - ."]
pub fn ocrypto_sha1_final(ctx: *mut ocrypto_sha1_ctx, r: *mut u8);
}
extern "C" {
#[doc = " SHA-1 hash.\n\n The SHA-1 hash of a given input message * `in` - is computed and put into * `r` - .\n\n * `r` - Generated hash.\n * `in` - Input data.\n * `in_len` - Length of * `in` - ."]
pub fn ocrypto_sha1(r: *mut u8, in_: *const u8, in_len: usize);
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_hmac_sha1_ctx {
pub sha: ocrypto_sha1_ctx,
pub k: [u8; 64usize],
}
#[test]
fn bindgen_test_layout_ocrypto_hmac_sha1_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_hmac_sha1_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_hmac_sha1_ctx>(),
412usize,
concat!("Size of: ", stringify!(ocrypto_hmac_sha1_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_hmac_sha1_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_hmac_sha1_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sha) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_hmac_sha1_ctx),
"::",
stringify!(sha)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).k) as usize - ptr as usize },
348usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_hmac_sha1_ctx),
"::",
stringify!(k)
)
);
}
extern "C" {
#[doc = " HMAC-SHA-1 initialization.\n\n The generator state * `ctx` - is initialized by this function.\n\n * `ctx` - Generator state.\n * `key` - HMAC key.\n * `key_len` - Length of * `key` - ."]
pub fn ocrypto_hmac_sha1_init(ctx: *mut ocrypto_hmac_sha1_ctx, key: *const u8, key_len: usize);
}
extern "C" {
#[doc = " HMAC-SHA-1 incremental data input.\n\n The generator state * `ctx` - is updated to authenticate a message chunk * `in` - .\n\n This function can be called repeatedly until the whole message is processed.\n\n * `ctx` - Generator state.\n * `in` - Input data.\n * `in_len` - Length of * `in` - .\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_hmac_sha1_init` - is required before this function can be called."]
pub fn ocrypto_hmac_sha1_update(ctx: *mut ocrypto_hmac_sha1_ctx, in_: *const u8, in_len: usize);
}
extern "C" {
#[doc = " HMAC-SHA-1 output.\n\n The generator state * `ctx` - is updated to finalize the HMAC for the previously\n processed message chunks. The authenticator is put into * `r` - .\n\n * `ctx` - Generator state.\n * `r` - Generated HMAC value.\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_hmac_sha1_init` - is required before this function can be called.\n\n @remark After return, the generator state * `ctx` - must no longer be used with\n * `ocrypto_hmac_sha1_update` - and * `ocrypto_hmac_sha1_final` - unless it is\n reinitialized using * `ocrypto_hmac_sha1_init` - ."]
pub fn ocrypto_hmac_sha1_final(ctx: *mut ocrypto_hmac_sha1_ctx, r: *mut u8);
}
extern "C" {
#[doc = " HMAC-SHA1 algorithm.\n\n The input message * `in` - is authenticated using the key * `key` - . The computed\n authenticator is put into * `r` - . To verify the authenticator, the recipient\n needs to recompute the HMAC authenticator and can then compare it with the\n received authenticator.\n\n * `r` - HMAC output.\n * `key` - HMAC key.\n * `key_len` - Length of * `key` - .\n * `in` - Input data.\n * `in_len` - Length of * `in` - ."]
pub fn ocrypto_hmac_sha1(
r: *mut u8,
key: *const u8,
key_len: usize,
in_: *const u8,
in_len: usize,
);
}
extern "C" {
#[doc = " HMAC-SHA1 algorithm with AAD.\n\n * `r` - HMAC output\n * `key` - HMAC key.\n * `key_len` - Length of * `key` - .\n * `in` - Input data.\n * `in_len` - Length of * `in` - .\n * `aad` - Additional authentication data. May be NULL.\n * `aad_len` - Length of * `aad` - ."]
pub fn ocrypto_hmac_sha1_aad(
r: *mut u8,
key: *const u8,
key_len: usize,
in_: *const u8,
in_len: usize,
aad: *const u8,
aad_len: usize,
);
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_sha256_ctx {
pub h: [u32; 8usize],
pub v: [u32; 8usize],
pub w: [u32; 16usize],
pub buffer: [u8; 64usize],
pub length: u32,
pub in_length: usize,
}
#[test]
fn bindgen_test_layout_ocrypto_sha256_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_sha256_ctx> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_sha256_ctx>(),
200usize,
concat!("Size of: ", stringify!(ocrypto_sha256_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_sha256_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_sha256_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).h) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sha256_ctx),
"::",
stringify!(h)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).v) as usize - ptr as usize },
32usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sha256_ctx),
"::",
stringify!(v)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).w) as usize - ptr as usize },
64usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sha256_ctx),
"::",
stringify!(w)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).buffer) as usize - ptr as usize },
128usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sha256_ctx),
"::",
stringify!(buffer)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).length) as usize - ptr as usize },
192usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sha256_ctx),
"::",
stringify!(length)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).in_length) as usize - ptr as usize },
196usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_sha256_ctx),
"::",
stringify!(in_length)
)
);
}
extern "C" {
#[doc = "# Incremental SHA-256 generator.\n\n This group of functions can be used to incrementally compute the SHA-256\n hash for a given message.\n/\n/**@{*/\n/**\n SHA-256 initialization.\n\n The generator state * `ctx` - is initialized by this function.\n\n * `ctx` - Generator state."]
pub fn ocrypto_sha256_init(ctx: *mut ocrypto_sha256_ctx);
}
extern "C" {
#[doc = " SHA-256 incremental data input.\n\n The generator state * `ctx` - is updated to hash a message chunk * `in` - .\n\n This function can be called repeatedly until the whole message is processed.\n\n * `ctx` - Generator state.\n * `in` - Input data.\n * `in_len` - Length of * `in` - .\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_sha256_init` - is required before this function can be called."]
pub fn ocrypto_sha256_update(ctx: *mut ocrypto_sha256_ctx, in_: *const u8, in_len: usize);
}
extern "C" {
#[doc = " SHA-256 output.\n\n The generator state * `ctx` - is updated to finalize the hash for the previously\n processed message chunks. The hash is put into * `r` - .\n\n * `ctx` - Generator state.\n * `r` - Generated hash value.\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_sha256_init` - is required before this function can be called.\n\n @remark After return, the generator state * `ctx` - must no longer be used with\n * `ocrypto_sha256_update` - and * `ocrypto_sha256_final` - unless it is\n reinitialized using * `ocrypto_sha256_init` - ."]
pub fn ocrypto_sha256_final(ctx: *mut ocrypto_sha256_ctx, r: *mut u8);
}
extern "C" {
#[doc = " SHA-256 hash.\n\n The SHA-256 hash of a given input message * `in` - is computed and put into * `r` - .\n\n * `r` - Generated hash.\n * `in` - Input data.\n * `in_len` - Length of * `in` - ."]
pub fn ocrypto_sha256(r: *mut u8, in_: *const u8, in_len: usize);
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_hmac_sha256_ctx {
pub sha: ocrypto_sha256_ctx,
pub k: [u8; 64usize],
}
#[test]
fn bindgen_test_layout_ocrypto_hmac_sha256_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_hmac_sha256_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_hmac_sha256_ctx>(),
264usize,
concat!("Size of: ", stringify!(ocrypto_hmac_sha256_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_hmac_sha256_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_hmac_sha256_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sha) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_hmac_sha256_ctx),
"::",
stringify!(sha)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).k) as usize - ptr as usize },
200usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_hmac_sha256_ctx),
"::",
stringify!(k)
)
);
}
extern "C" {
#[doc = " HMAC-SHA-256 initialization.\n\n The generator state * `ctx` - is initialized by this function.\n\n * `ctx` - Generator state.\n * `key` - HMAC key.\n * `key_len` - Length of * `key` - ."]
pub fn ocrypto_hmac_sha256_init(
ctx: *mut ocrypto_hmac_sha256_ctx,
key: *const u8,
key_len: usize,
);
}
extern "C" {
#[doc = " HMAC-SHA-256 incremental data input.\n\n The generator state * `ctx` - is updated to authenticate a message chunk * `in` - .\n\n This function can be called repeatedly until the whole message is processed.\n\n * `ctx` - Generator state.\n * `in` - Input data.\n * `in_len` - Length of * `in` - .\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_hmac_sha256_init` - is required before this function can be called."]
pub fn ocrypto_hmac_sha256_update(
ctx: *mut ocrypto_hmac_sha256_ctx,
in_: *const u8,
in_len: usize,
);
}
extern "C" {
#[doc = " HMAC-SHA-256 output.\n\n The generator state * `ctx` - is updated to finalize the HMAC for the previously\n processed message chunks. The authenticator is put into * `r` - .\n\n * `ctx` - Generator state.\n * `r` - Generated HMAC value.\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_hmac_sha256_init` - is required before this function can be called.\n\n @remark After return, the generator state * `ctx` - must no longer be used with\n * `ocrypto_hmac_sha256_update` - and * `ocrypto_hmac_sha256_final` - unless it is\n reinitialized using * `ocrypto_hmac_sha256_init` - ."]
pub fn ocrypto_hmac_sha256_final(ctx: *mut ocrypto_hmac_sha256_ctx, r: *mut u8);
}
extern "C" {
#[doc = " HMAC-SHA256 algorithm.\n\n The input message * `in` - is authenticated using the key * `key` - . The computed\n authenticator is put into * `r` - . To verify the authenticator, the recipient\n needs to recompute the HMAC authenticator and can then compare it with the\n received authenticator.\n\n * `r` - HMAC output.\n * `key` - HMAC key.\n * `key_len` - Length of * `key` - .\n * `in` - Input data.\n * `in_len` - Length of * `in` - ."]
pub fn ocrypto_hmac_sha256(
r: *mut u8,
key: *const u8,
key_len: usize,
in_: *const u8,
in_len: usize,
);
}
extern "C" {
#[doc = " HMAC-SHA256 algorithm with AAD.\n\n * `r` - HMAC output\n * `key` - HMAC key.\n * `key_len` - Length of * `key` - .\n * `in` - Input data.\n * `in_len` - Length of * `in` - .\n * `aad` - Additional authentication data. May be NULL.\n * `aad_len` - Length of * `aad` - ."]
pub fn ocrypto_hmac_sha256_aad(
r: *mut u8,
key: *const u8,
key_len: usize,
in_: *const u8,
in_len: usize,
aad: *const u8,
aad_len: usize,
);
}
#[doc = "@cond"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_hmac_sha512_ctx {
pub sha: ocrypto_sha512_ctx,
pub k: [u8; 128usize],
}
#[test]
fn bindgen_test_layout_ocrypto_hmac_sha512_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_hmac_sha512_ctx> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_hmac_sha512_ctx>(),
520usize,
concat!("Size of: ", stringify!(ocrypto_hmac_sha512_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_hmac_sha512_ctx>(),
8usize,
concat!("Alignment of ", stringify!(ocrypto_hmac_sha512_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).sha) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_hmac_sha512_ctx),
"::",
stringify!(sha)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).k) as usize - ptr as usize },
392usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_hmac_sha512_ctx),
"::",
stringify!(k)
)
);
}
extern "C" {
#[doc = " HMAC-SHA-512 initialization.\n\n The generator state * `ctx` - is initialized by this function.\n\n * `ctx` - Generator state.\n * `key` - HMAC key.\n * `key_len` - Length of * `key` - ."]
pub fn ocrypto_hmac_sha512_init(
ctx: *mut ocrypto_hmac_sha512_ctx,
key: *const u8,
key_len: usize,
);
}
extern "C" {
#[doc = " HMAC-SHA-512 incremental data input.\n\n The generator state * `ctx` - is updated to authenticate a message chunk * `in` - .\n\n This function can be called repeatedly until the whole message is processed.\n\n * `ctx` - Generator state.\n * `in` - Input data.\n * `in_len` - Length of * `in` - .\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_hmac_sha512_init` - is required before this function can be called."]
pub fn ocrypto_hmac_sha512_update(
ctx: *mut ocrypto_hmac_sha512_ctx,
in_: *const u8,
in_len: usize,
);
}
extern "C" {
#[doc = " HMAC-SHA-512 output.\n\n The generator state * `ctx` - is updated to finalize the HMAC for the previously\n processed message chunks. The authenticator is put into * `r` - .\n\n * `ctx` - Generator state.\n * `r` - Generated HMAC value.\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_hmac_sha512_init` - is required before this function can be called.\n\n @remark After return, the generator state * `ctx` - must no longer be used with\n * `ocrypto_hmac_sha512_update` - and * `ocrypto_hmac_sha512_final` - unless it is\n reinitialized using * `ocrypto_hmac_sha512_init` - ."]
pub fn ocrypto_hmac_sha512_final(ctx: *mut ocrypto_hmac_sha512_ctx, r: *mut u8);
}
extern "C" {
#[doc = " HMAC-SHA512 algorithm.\n\n The input message * `in` - is authenticated using the key * `key` - . The computed\n authenticator is put into * `r` - . To verify the authenticator, the recipient\n needs to recompute the HMAC authenticator and can then compare it with the\n received authenticator.\n\n * `r` - HMAC output.\n * `key` - HMAC key.\n * `key_len` - Length of * `key` - .\n * `in` - Input data.\n * `in_len` - Length of * `in` - ."]
pub fn ocrypto_hmac_sha512(
r: *mut u8,
key: *const u8,
key_len: usize,
in_: *const u8,
in_len: usize,
);
}
extern "C" {
#[doc = " HMAC-SHA512 algorithm with AAD.\n\n * `r` - HMAC output\n * `key` - HMAC key.\n * `key_len` - Length of * `key` - .\n * `in` - Input data.\n * `in_len` - Length of * `in` - .\n * `aad` - Additional authentication data. May be NULL.\n * `aad_len` - Length of * `aad` - ."]
pub fn ocrypto_hmac_sha512_aad(
r: *mut u8,
key: *const u8,
key_len: usize,
in_: *const u8,
in_len: usize,
aad: *const u8,
aad_len: usize,
);
}
extern "C" {
#[doc = " Computes the PBKDF2-AES-CMAC-PRF-128 key from password, salt, and iteration count.\n\n * `key` - PBKDF2 key to generate.\n * `key_len` - Length of key.\n * `password` - Password to use.\n * `password_len` - Length of password.\n * `salt` - Salt to use.\n * `salt_len` - Length of salt. 0 < salt_len <= 32.\n * `count` - Iteration count."]
pub fn ocrypto_pbkdf2_aes_cmac_prf128(
key: *mut u8,
key_len: usize,
password: *const u8,
password_len: usize,
salt: *const u8,
salt_len: usize,
count: u32,
);
}
extern "C" {
#[doc = " Computes the PBKDF2-HMAC-SHA1 key from password, salt, and iteration count.\n\n * `key` - PBKDF2 key to generate.\n * `key_len` - Length of key.\n * `password` - Password to use.\n * `password_len` - Length of password.\n * `salt` - Salt to use.\n * `salt_len` - Length of salt.\n * `count` - Iteration count."]
pub fn ocrypto_pbkdf2_hmac_sha1(
key: *mut u8,
key_len: usize,
password: *const u8,
password_len: usize,
salt: *const u8,
salt_len: usize,
count: u32,
);
}
extern "C" {
#[doc = " Computes the PBKDF2-HMAC-SHA256 key from password, salt, and iteration count.\n\n * `key` - PBKDF2 key to generate.\n * `key_len` - Length of key.\n * `password` - Password to use.\n * `password_len` - Length of password.\n * `salt` - Salt to use.\n * `salt_len` - Length of salt.\n * `count` - Iteration count."]
pub fn ocrypto_pbkdf2_hmac_sha256(
key: *mut u8,
key_len: usize,
password: *const u8,
password_len: usize,
salt: *const u8,
salt_len: usize,
count: u32,
);
}
#[doc = "# 1024-bit RSA Keys\n\n This group of keys is used for 1024-bit RSA.\n/\n/**@{*/\n/**\n 1024-bit RSA public key."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_rsa1024_pub_key {
#[doc = "@cond"]
pub n: [u32; 32usize],
}
#[test]
fn bindgen_test_layout_ocrypto_rsa1024_pub_key() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_rsa1024_pub_key> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_rsa1024_pub_key>(),
128usize,
concat!("Size of: ", stringify!(ocrypto_rsa1024_pub_key))
);
assert_eq!(
::core::mem::align_of::<ocrypto_rsa1024_pub_key>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_rsa1024_pub_key))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).n) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa1024_pub_key),
"::",
stringify!(n)
)
);
}
#[doc = " 1024 bit RSA secret key."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_rsa1024_key {
#[doc = "@cond"]
pub n: [u32; 32usize],
pub d: [u32; 32usize],
}
#[test]
fn bindgen_test_layout_ocrypto_rsa1024_key() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_rsa1024_key> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_rsa1024_key>(),
256usize,
concat!("Size of: ", stringify!(ocrypto_rsa1024_key))
);
assert_eq!(
::core::mem::align_of::<ocrypto_rsa1024_key>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_rsa1024_key))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).n) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa1024_key),
"::",
stringify!(n)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).d) as usize - ptr as usize },
128usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa1024_key),
"::",
stringify!(d)
)
);
}
#[doc = " 1024-bit RSA secret key with CRT coefficients."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_rsa1024_crt_key {
#[doc = "@cond"]
pub n: [u32; 32usize],
pub p: [u32; 16usize],
pub q: [u32; 16usize],
pub dp: [u32; 16usize],
pub dq: [u32; 16usize],
pub qinv: [u32; 16usize],
}
#[test]
fn bindgen_test_layout_ocrypto_rsa1024_crt_key() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_rsa1024_crt_key> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_rsa1024_crt_key>(),
448usize,
concat!("Size of: ", stringify!(ocrypto_rsa1024_crt_key))
);
assert_eq!(
::core::mem::align_of::<ocrypto_rsa1024_crt_key>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_rsa1024_crt_key))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).n) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa1024_crt_key),
"::",
stringify!(n)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).p) as usize - ptr as usize },
128usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa1024_crt_key),
"::",
stringify!(p)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).q) as usize - ptr as usize },
192usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa1024_crt_key),
"::",
stringify!(q)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).dp) as usize - ptr as usize },
256usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa1024_crt_key),
"::",
stringify!(dp)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).dq) as usize - ptr as usize },
320usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa1024_crt_key),
"::",
stringify!(dq)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).qinv) as usize - ptr as usize },
384usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa1024_crt_key),
"::",
stringify!(qinv)
)
);
}
#[doc = "# 2048-bit RSA Keys.\n\n This group of keys is used for 2048-bit RSA.\n/\n/**@{*/\n/**\n 2048-bit RSA public key."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_rsa2048_pub_key {
#[doc = "@cond"]
pub n: [u32; 64usize],
}
#[test]
fn bindgen_test_layout_ocrypto_rsa2048_pub_key() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_rsa2048_pub_key> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_rsa2048_pub_key>(),
256usize,
concat!("Size of: ", stringify!(ocrypto_rsa2048_pub_key))
);
assert_eq!(
::core::mem::align_of::<ocrypto_rsa2048_pub_key>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_rsa2048_pub_key))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).n) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa2048_pub_key),
"::",
stringify!(n)
)
);
}
#[doc = " 2048-bit RSA secret key."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_rsa2048_key {
#[doc = "@cond"]
pub n: [u32; 64usize],
pub d: [u32; 64usize],
}
#[test]
fn bindgen_test_layout_ocrypto_rsa2048_key() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_rsa2048_key> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_rsa2048_key>(),
512usize,
concat!("Size of: ", stringify!(ocrypto_rsa2048_key))
);
assert_eq!(
::core::mem::align_of::<ocrypto_rsa2048_key>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_rsa2048_key))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).n) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa2048_key),
"::",
stringify!(n)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).d) as usize - ptr as usize },
256usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa2048_key),
"::",
stringify!(d)
)
);
}
#[doc = " 2048-bit RSA secret key with CRT coefficients."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_rsa2048_crt_key {
#[doc = "@cond"]
pub n: [u32; 64usize],
pub p: [u32; 32usize],
pub q: [u32; 32usize],
pub dp: [u32; 32usize],
pub dq: [u32; 32usize],
pub qinv: [u32; 32usize],
}
#[test]
fn bindgen_test_layout_ocrypto_rsa2048_crt_key() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_rsa2048_crt_key> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_rsa2048_crt_key>(),
896usize,
concat!("Size of: ", stringify!(ocrypto_rsa2048_crt_key))
);
assert_eq!(
::core::mem::align_of::<ocrypto_rsa2048_crt_key>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_rsa2048_crt_key))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).n) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa2048_crt_key),
"::",
stringify!(n)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).p) as usize - ptr as usize },
256usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa2048_crt_key),
"::",
stringify!(p)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).q) as usize - ptr as usize },
384usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa2048_crt_key),
"::",
stringify!(q)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).dp) as usize - ptr as usize },
512usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa2048_crt_key),
"::",
stringify!(dp)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).dq) as usize - ptr as usize },
640usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa2048_crt_key),
"::",
stringify!(dq)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).qinv) as usize - ptr as usize },
768usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa2048_crt_key),
"::",
stringify!(qinv)
)
);
}
extern "C" {
#[doc = "# 1024-bit RSA key setup.\n\n This group of functions is used for 1024-bit RSA key setup.\n/\n/**@{*/\n/**\n 1024-bit RSA public key setup.\n\n * `pk` - The initialized public key.\n * `n` - The RSA modulus. Must be exactly 1024 bits.\n * `n_len` - Length of * `n` - .\n\n Returns -1 If the input length is invalid.\n Returns 0 On success.\n\n @remark The public exponent is fixed at 65537."]
pub fn ocrypto_rsa1024_init_pub_key(
pk: *mut ocrypto_rsa1024_pub_key,
n: *const u8,
n_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 1024-bit RSA secret key setup.\n\n * `pk` - The initialized public key.\n * `n` - The RSA modulus. Must be exactly 1024 bits.\n * `n_len` - Length of * `n` - .\n * `d` - The secret exponent. Must be <= 1024 bits.\n * `d_len` - Length of * `d` - .\n\n Returns -1 If the input length is invalid.\n Returns 0 On success."]
pub fn ocrypto_rsa1024_init_key(
pk: *mut ocrypto_rsa1024_key,
n: *const u8,
n_len: usize,
d: *const u8,
d_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 1024-bit RSA secret key setup with CRT coefficients.\n\n * `sk` - The initialized secret key.\n * `p` - The 1. RSA prime. Must be exactly 512 bits.\n * `p_len` - Length of * `p` - .\n * `q` - The 2. RSA prime. Must be exactly 512 bits.\n * `q_len` - Length of * `q` - .\n * `dp` - The 1. CRT exponent. dp = d mod (p-1).\n * `dp_len` - Length of * `dp` - .\n * `dq` - The 2. CRT exponent. dq = d mod (q-1).\n * `dq_len` - Length of * `dq` - .\n * `qinv` - The CRT coefficient. qinv = 1/q mod p.\n * `qi_len` - Length of * `qinv` - .\n\n Returns -1 If the input length is invalid.\n Returns 0 On success."]
pub fn ocrypto_rsa1024_init_crt_key(
sk: *mut ocrypto_rsa1024_crt_key,
p: *const u8,
p_len: usize,
q: *const u8,
q_len: usize,
dp: *const u8,
dp_len: usize,
dq: *const u8,
dq_len: usize,
qinv: *const u8,
qi_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = "# 2048-bit RSA key setup.\n\n This group of functions is used for 2048-bit RSA key setup.\n/\n/**@{*/\n/**\n 2048-bit RSA public key setup.\n\n * `pk` - The initialized public key.\n * `n` - The RSA modulus. Must be exactly 2048 bits.\n * `n_len` - Length of * `n` - .\n\n Returns -1 If the input length is invalid.\n Returns 0 On success.\n\n @remark The public exponent is fixed at 65537."]
pub fn ocrypto_rsa2048_init_pub_key(
pk: *mut ocrypto_rsa2048_pub_key,
n: *const u8,
n_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 2048-bit RSA secret key setup.\n\n * `sk` - The initialized public key.\n * `n` - The RSA modulus. Must be exactly 2048 bits.\n * `n_len` - Length of * `n` - .\n * `d` - The secret exponent. Must be <= 2048 bits.\n * `d_len` - Length of * `d` - .\n\n Returns -1 If the input length is invalid.\n Returns 0 On success."]
pub fn ocrypto_rsa2048_init_key(
sk: *mut ocrypto_rsa2048_key,
n: *const u8,
n_len: usize,
d: *const u8,
d_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 2048-bit RSA secret key setup with CRT coefficients.\n\n * `sk` - The initialized secret key.\n * `p` - The 1. RSA prime. Must be exactly 1024 bits.\n * `p_len` - Length of * `p` - .\n * `q` - The 2. RSA prime. Must be exactly 1024 bits.\n * `q_len` - Length of * `q` - .\n * `dp` - The 1. CRT exponent. dp = d mod (p-1).\n * `dp_len` - Length of * `dp` - .\n * `dq` - The 2. CRT exponent. dq = d mod (q-1).\n * `dq_len` - Length of * `dq` - .\n * `qinv` - The CRT coefficient. qinv = 1/q mod p.\n * `qi_len` - Length of * `qinv` - .\n\n Returns -1 If the input length is invalid.\n Returns 0 On success."]
pub fn ocrypto_rsa2048_init_crt_key(
sk: *mut ocrypto_rsa2048_crt_key,
p: *const u8,
p_len: usize,
q: *const u8,
q_len: usize,
dp: *const u8,
dp_len: usize,
dq: *const u8,
dq_len: usize,
qinv: *const u8,
qi_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = "# 1024-bit RSA Functions.\n\n This group of functions is used for 1024-bit RSA.\n/\n/**@{*/\n/**\n 1024 bit RSA PKCS1 V1.5 encryption.\n\n The message * `m` - is encrypted to a ciphertext returned in * `c` - .\n\n * `c` - The generated 128-byte ciphertext.\n * `m` - The message to be encrypted.\n * `m_len` - Length of * `m` - . 0 <= m_len <= 117.\n * `seed` - The random seed to be used for the padding.\n * `s_len` - Length of * `seed` - . * `s_len` - >= 125 - * `m_len` - \n * `pk` - A valid 1024-bit RSA public key.\n\n Returns -1 If the message is too long (m_len > 117).\n Returns -2 If the seed is too short (s_len < 125 - m_len).\n Returns 0 On success.\n\n @remark The key * `pk` - should be initialized with * `ocrypto_rsa1024_init_pub_key` - .\n @remark The * `seed` - should consist of non-zero random bytes.\n @remark * `c` - may be same as * `m` - ."]
pub fn ocrypto_rsa1024_pkcs1_v15_encrypt(
c: *mut u8,
m: *const u8,
m_len: usize,
seed: *const u8,
s_len: usize,
pk: *const ocrypto_rsa1024_pub_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 1024-bit RSA PKCS1 V1.5 decryption.\n\n The ciphertext * `c` - is decrypted to the message returned in * `m` - .\n\n * `m` - The decrypted message. The buffer must be long enough to hold the message.\n * `m_len` - Length of * `m` - .\n * `c` - The 128-byte ciphertext to decrypt.\n * `sk` - A valid 1024-bit RSA secret key.\n\n Returns -1 If decryption failed.\n Returns -2 If the output buffer is too short (m_len < length of message).\n Returns n If a message of length n was successfully decrypted.\n\n @remark The key * `sk` - should be initialized with * `ocrypto_rsa1024_init_key` - .\n @remark * `m` - may be same as * `c` - ."]
pub fn ocrypto_rsa1024_pkcs1_v15_decrypt(
m: *mut u8,
m_len: usize,
c: *const u8,
sk: *const ocrypto_rsa1024_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 1024-bit RSA PKCS1 V1.5 decryption with CRT acceleration.\n\n The ciphertext * `c` - is decrypted to the message returned in * `m` - .\n\n * `m` - The decrypted message. The buffer must be long enough to hold the message.\n * `m_len` - Length of * `m` - .\n * `c` - The 128-byte ciphertext to decrypt.\n * `sk` - A valid 1024-bit RSA secret key with CRT coefficients.\n\n Returns -1 If decryption failed.\n Returns -2 If the output buffer is too short (m_len < length of message).\n Returns n If a message of length n was successfully decrypted.\n\n @remark The key * `sk` - should be initialized with * `ocrypto_rsa1024_init_crt_key` - .\n @remark * `m` - may be same as * `c` - ."]
pub fn ocrypto_rsa1024_pkcs1_v15_crt_decrypt(
m: *mut u8,
m_len: usize,
c: *const u8,
sk: *const ocrypto_rsa1024_crt_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 1024-bit RSA OAEP SHA256 encryption.\n\n The message * `m` - is encrypted to a ciphertext returned in * `c` - .\n\n * `c` - The generated 128-byte ciphertext.\n * `m` - The message to be encrypted.\n * `m_len` - Length of * `m` - . 0 <= m_len <= 62.\n * `label` - The label associated with the message.\n * `l_len` - Length of * `label` - . May be 0.\n * `seed` - 32-byte random seed.\n * `pk` - A valid 1024-bit RSA public key.\n\n Returns -1 If the message is too long (m_len > 62).\n Returns 0 On success.\n\n @remark The key * `pk` - should be initialized with * `ocrypto_rsa1024_init_pub_key` - .\n @remark * `c` - may be same as * `m` - ."]
pub fn ocrypto_rsa1024_oaep_sha256_encrypt(
c: *mut u8,
m: *const u8,
m_len: usize,
label: *const u8,
l_len: usize,
seed: *const u8,
pk: *const ocrypto_rsa1024_pub_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 1024 bit RSA OAEP SHA256 decryption.\n\n The ciphertext * `c` - is decrypted to the message returned in * `m` - .\n\n * `m` - The decrypted message. The buffer must be long enough to hold the message.\n * `m_len` - Length of * `m` - .\n * `c` - The 128 byte ciphertext to decrypt.\n * `label` - The label associated with the message.\n * `l_len` - Length of * `label` - . May be 0.\n * `sk` - A valid 1024 bit RSA secret key.\n\n Returns -1 If decryption failed.\n Returns -2 If the output buffer is too short (m_len < length of message).\n Returns n If a message of length n was successfully decrypted.\n\n @remark The key * `sk` - should be initialized with * `ocrypto_rsa1024_init_key` - .\n @remark * `m` - may be same as * `c` - ."]
pub fn ocrypto_rsa1024_oaep_sha256_decrypt(
m: *mut u8,
m_len: usize,
c: *const u8,
label: *const u8,
l_len: usize,
sk: *const ocrypto_rsa1024_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 1024-bit RSA OAEP SHA256 decryption with CRT acceleration.\n\n The ciphertext * `c` - is decrypted to the message returned in * `m` - .\n\n * `m` - The decrypted message. The buffer must be long enough to hold the message.\n * `m_len` - Length of * `m` - .\n * `c` - The 128-byte ciphertext to decrypt.\n * `label` - The label associated with the message.\n * `l_len` - Length of * `label` - . May be 0.\n * `sk` - A valid 1024-bit RSA secret key with CRT coefficients.\n\n Returns -1 If decryption failed.\n Returns -2 If the output buffer is too short (m_len < length of message).\n Returns n If a message of length n was successfully decrypted.\n\n @remark The key * `sk` - should be initialized with * `ocrypto_rsa1024_init_crt_key` - .\n @remark * `m` - may be same as * `c` - ."]
pub fn ocrypto_rsa1024_oaep_sha256_crt_decrypt(
m: *mut u8,
m_len: usize,
c: *const u8,
label: *const u8,
l_len: usize,
sk: *const ocrypto_rsa1024_crt_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 1024-bit RSA PKCS1 V1.5 SHA-256 sign.\n\n The message * `m` - is signed and the signature returned in * `s` - .\n\n * `s` - The generated 128-byte signature.\n * `m` - The message to be signed.\n * `m_len` - Length of * `m` - .\n * `sk` - A valid 1024-bit RSA secret key.\n\n Returns 0\n\n @remark The key * `sk` - should be initialized with * `ocrypto_rsa1024_init_key` - .\n @remark * `s` - may be same as * `m` - ."]
pub fn ocrypto_rsa1024_pkcs1_v15_sha256_sign(
s: *mut u8,
m: *const u8,
m_len: usize,
sk: *const ocrypto_rsa1024_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 1024-bit RSA PKCS1 V1.5 SHA-256 sign with CRT acceleration.\n\n The message * `m` - is signed and the signature returned in * `s` - .\n\n * `s` - The generated 128-byte signature.\n * `m` - The message to be signed.\n * `m_len` - Length of * `m` - .\n * `sk` - A valid 1024-bit RSA secret key with CRT coefficients.\n\n Returns 0\n\n @remark The key * `sk` - should be initialized with * `ocrypto_rsa1024_init_crt_key` - .\n @remark * `s` - may be same as * `m` - ."]
pub fn ocrypto_rsa1024_pkcs1_v15_sha256_crt_sign(
s: *mut u8,
m: *const u8,
m_len: usize,
sk: *const ocrypto_rsa1024_crt_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 1024-bit RSA PKCS1 V1.5 SHA-256 signature verify.\n\n The signature * `s` - of the input message * `m` - is verified.\n\n * `s` - The 128-byte signature.\n * `m` - The signed message.\n * `m_len` - Length of * `m` - .\n * `pk` - A valid 1024-bit RSA public key.\n\n Returns 0 If the signature is valid.\n Returns -1 If verification failed.\n\n @remark The key * `pk` - should be initialized with * `ocrypto_rsa1024_init_pub_key` - ."]
pub fn ocrypto_rsa1024_pkcs1_v15_sha256_verify(
s: *const u8,
m: *const u8,
m_len: usize,
pk: *const ocrypto_rsa1024_pub_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 1024-bit RSA PSS SHA-256 sign.\n\n The message * `m` - is signed and the signature returned in * `s` - .\n\n * `s` - The generated 128-byte signature.\n * `m` - The message to be signed.\n * `m_len` - Length of * `m` - .\n * `salt` - The salt to be used.\n * `s_len` - Length of * `salt` - .\n * `sk` - A valid 1024-bit RSA secret key.\n\n Returns -2 If the salt is too long.\n Returns 0 On success.\n\n @remark The key * `sk` - should be initialized with * `ocrypto_rsa1024_init_key` - .\n @remark * `s` - may be same as * `m` - ."]
pub fn ocrypto_rsa1024_pss_sha256_sign(
s: *mut u8,
m: *const u8,
m_len: usize,
salt: *const u8,
s_len: usize,
sk: *const ocrypto_rsa1024_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 1024-bit RSA PSS SHA-256 sign with CRT acceleration.\n\n The message * `m` - is signed and the signature returned in * `s` - .\n\n * `s` - The generated 128-byte signature.\n * `m` - The message to be signed.\n * `m_len` - Length of * `m` - .\n * `salt` - The salt to be used.\n * `s_len` - Length of * `salt` - .\n * `sk` - A valid 1024-bit RSA secret key with CRT coefficients.\n\n Returns -2 If the salt is too long.\n Returns 0 On success.\n\n @remark The key * `sk` - should be initialized with * `ocrypto_rsa1024_init_crt_key` - .\n @remark * `s` - may be same as * `m` - ."]
pub fn ocrypto_rsa1024_pss_sha256_crt_sign(
s: *mut u8,
m: *const u8,
m_len: usize,
salt: *const u8,
s_len: usize,
sk: *const ocrypto_rsa1024_crt_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 1024-bit RSA PSS SHA-256 signature verify.\n\n The signature * `s` - of the input message * `m` - is verified.\n\n * `s` - The 128-byte signature.\n * `m` - The signed message.\n * `m_len` - Length of * `m` - .\n * `s_len` - The length of the salt.\n * `pk` - A valid 1024-bit RSA public key.\n\n Returns 0 If the signature is valid.\n Returns -1 If verification failed.\n Returns -2 If the salt is too long.\n\n @remark The key * `pk` - should be initialized with * `ocrypto_rsa1024_init_pub_key` - ."]
pub fn ocrypto_rsa1024_pss_sha256_verify(
s: *const u8,
m: *const u8,
m_len: usize,
s_len: usize,
pk: *const ocrypto_rsa1024_pub_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = "# 2048-bit RSA Functions.\n\n This group of functions is used for 2048-bit RSA.\n/\n/**@{*/\n/**\n 2048-bit RSA PKCS1 V1.5 encryption.\n\n The message * `m` - is encrypted to a ciphertext returned in * `c` - .\n\n * `c` - The generated 256-byte ciphertext.\n * `m` - The message to be encrypted.\n * `mlen` - Length of * `m` - . 0 <= * `mlen` - <= 245.\n * `seed` - The random seed to be used for the padding.\n * `slen` - Length of * `seed` - . * `slen` - >= 253 - * `mlen` - .\n * `pk` - A valid 2048-bit RSA public key.\n\n Returns -1 If the message is too long (mlen > 245).\n Returns -2 If the seed is too short (slen < 253 - mlen).\n Returns 0 On success.\n\n @remark The key * `pk` - should be initialized with * `ocrypto_rsa2048_init_pub_key` - .\n @remark The * `seed` - should consist of non-zero random bytes.\n @remark * `c` - may be same as * `m` - ."]
pub fn ocrypto_rsa2048_pkcs1_v15_encrypt(
c: *mut u8,
m: *const u8,
mlen: usize,
seed: *const u8,
slen: usize,
pk: *const ocrypto_rsa2048_pub_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 2048-bit RSA PKCS1 V1.5 decryption.\n\n The ciphertext * `c` - is decrypted to the message returned in * `m` - .\n\n * `m` - The decrypted message. The buffer must be long enough to hold the message.\n * `mlen` - Length of * `m` - .\n * `c` - The 256-byte ciphertext to decrypt.\n * `sk` - A valid 2048-bit RSA secret key.\n\n Returns -1 If decryption failed.\n Returns -2 If the output buffer is too short (mlen < length of message).\n Returns n If a message of length n was successfully decrypted.\n\n @remark The key * `sk` - should be initialized with * `ocrypto_rsa2048_init_key` - .\n @remark * `m` - may be same as * `c` - ."]
pub fn ocrypto_rsa2048_pkcs1_v15_decrypt(
m: *mut u8,
mlen: usize,
c: *const u8,
sk: *const ocrypto_rsa2048_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 2048-bit RSA PKCS1 V1.5 decryption with CRT acceleration.\n\n The ciphertext * `c` - is decrypted to the message returned in * `m` - .\n\n * `m` - The decrypted message. The buffer must be long enough to hold the message.\n * `mlen` - Length of * `m` - .\n * `c` - The 256-byte ciphertext to decrypt.\n * `sk` - A valid 2048-bit RSA secret key with CRT coefficients.\n\n Returns -1 If decryption failed.\n Returns -2 If the output buffer is too short (mlen < length of message).\n Returns n If a message of length n was successfully decrypted.\n\n @remark The key * `sk` - should be initialized with * `ocrypto_rsa2048_init_crt_key` - .\n @remark * `m` - may be same as * `c` - ."]
pub fn ocrypto_rsa2048_pkcs1_v15_crt_decrypt(
m: *mut u8,
mlen: usize,
c: *const u8,
sk: *const ocrypto_rsa2048_crt_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 2048-bit RSA OAEP SHA256 encryption.\n\n The message * `m` - is encrypted to a ciphertext returned in * `c` - .\n\n * `c` - The generated 256-byte ciphertext.\n * `m` - The message to be encrypted.\n * `mlen` - Length of * `m` - . 0 <= mlen <= 190.\n * `label` - The label associated with the message.\n * `llen` - Length of * `label` - . May be 0.\n * `seed` - 32-byte random seed.\n * `pk` - A valid 2048-bit RSA public key.\n\n Returns -1 If the message is too long (mlen > 190).\n Returns 0 On success.\n\n @remark The key * `pk` - should be initialized with * `ocrypto_rsa2048_init_pub_key` - .\n @remark * `c` - may be same as * `m` - ."]
pub fn ocrypto_rsa2048_oaep_sha256_encrypt(
c: *mut u8,
m: *const u8,
mlen: usize,
label: *const u8,
llen: usize,
seed: *const u8,
pk: *const ocrypto_rsa2048_pub_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 2048-bit RSA OAEP SHA256 decryption.\n\n The ciphertext * `c` - is decrypted to the message returned in * `m` - .\n\n * `m` - The decrypted message. The buffer must be long enough to hold the message.\n * `mlen` - Length of * `m` - .\n * `c` - The 256-byte ciphertext to decrypt.\n * `label` - The label associated with the message.\n * `llen` - Length of * `label` - . May be 0.\n * `sk` - A valid 2048-bit RSA secret key.\n\n Returns -1 If decryption failed.\n Returns -2 If the output buffer is too short (mlen < length of message).\n Returns n If a message of length n was successfully decrypted.\n\n @remark The key * `sk` - should be initialized with * `ocrypto_rsa2048_init_key` - .\n @remark * `m` - may be same as * `c` - ."]
pub fn ocrypto_rsa2048_oaep_sha256_decrypt(
m: *mut u8,
mlen: usize,
c: *const u8,
label: *const u8,
llen: usize,
sk: *const ocrypto_rsa2048_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 2048-bit RSA OAEP SHA256 decryption with CRT acceleration.\n\n The ciphertext * `c` - is decrypted to the message returned in * `m` - .\n\n * `m` - The decrypted message. The buffer must be long enough to hold the message.\n * `mlen` - Length of * `m` - .\n * `c` - The 256-byte ciphertext to decrypt.\n * `label` - The label associated with the message.\n * `llen` - Length of * `label` - . May be 0.\n * `sk` - A valid 2048-bit RSA secret key with CRT coefficients.\n\n Returns -1 If decryption failed.\n Returns -2 If the output buffer is too short (mlen < length of message).\n Returns n If a message of length n was successfully decrypted.\n\n @remark The key * `sk` - should be initialized with * `ocrypto_rsa2048_init_crt_key` - .\n @remark * `m` - may be same as * `c` - ."]
pub fn ocrypto_rsa2048_oaep_sha256_crt_decrypt(
m: *mut u8,
mlen: usize,
c: *const u8,
label: *const u8,
llen: usize,
sk: *const ocrypto_rsa2048_crt_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 2048-bit RSA PKCS1 V1.5 SHA-256 sign.\n\n The message * `m` - is signed and the signature returned in * `s` - .\n\n * `s` - The generated 256-byte signature.\n * `m` - The message to be signed.\n * `mlen` - Length of * `m` - .\n * `sk` - A valid 2048-bit RSA secret key.\n\n Returns 0\n\n @remark The key * `sk` - should be initialized with * `ocrypto_rsa2048_init_key` - .\n @remark * `s` - may be same as * `m` - ."]
pub fn ocrypto_rsa2048_pkcs1_v15_sha256_sign(
s: *mut u8,
m: *const u8,
mlen: usize,
sk: *const ocrypto_rsa2048_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 2048-bit RSA PKCS1 V1.5 SHA-256 sign with CRT acceleration.\n\n The message * `m` - is signed and the signature returned in * `s` - .\n\n * `s` - The generated 256-byte signature.\n * `m` - The message to be signed.\n * `mlen` - Length of * `m` - .\n * `sk` - A valid 2048-bit RSA secret key with CRT coefficients.\n\n Returns 0\n\n @remark The key * `sk` - should be initialized with * `ocrypto_rsa2048_init_crt_key` - .\n @remark * `s` - may be same as * `m` - ."]
pub fn ocrypto_rsa2048_pkcs1_v15_sha256_crt_sign(
s: *mut u8,
m: *const u8,
mlen: usize,
sk: *const ocrypto_rsa2048_crt_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 2048-bit RSA PKCS1 V1.5 SHA-256 signature verify.\n\n The signature * `s` - of the input message * `m` - is verified.\n\n * `s` - The 256-byte signature.\n * `m` - The signed message.\n * `mlen` - Length of * `m` - .\n * `pk` - A valid 2048-bit RSA public key.\n\n Returns 0 If the signature is valid.\n Returns -1 If verification failed.\n\n @remark The key * `pk` - should be initialized with * `ocrypto_rsa2048_init_pub_key` - ."]
pub fn ocrypto_rsa2048_pkcs1_v15_sha256_verify(
s: *const u8,
m: *const u8,
mlen: usize,
pk: *const ocrypto_rsa2048_pub_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 2048-bit RSA PSS SHA-256 sign.\n\n The message * `m` - is signed and the signature returned in * `s` - .\n\n * `s` - The generated 256-byte signature.\n * `m` - The message to be signed.\n * `mlen` - Length of * `m` - .\n * `salt` - The salt to be used.\n * `slen` - Length of * `salt` - .\n * `sk` - A valid 2048-bit RSA secret key.\n\n Returns -2 If the salt is too long.\n Returns 0 On success.\n\n @remark The key * `sk` - should be initialized with * `ocrypto_rsa2048_init_key` - .\n @remark * `s` - may be same as * `m` - ."]
pub fn ocrypto_rsa2048_pss_sha256_sign(
s: *mut u8,
m: *const u8,
mlen: usize,
salt: *const u8,
slen: usize,
sk: *const ocrypto_rsa2048_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 2048-bit RSA PSS SHA-256 sign with CRT acceleration.\n\n The message * `m` - is signed and the signature returned in * `s` - .\n\n * `s` - The generated 256-byte signature.\n * `m` - The message to be signed.\n * `mlen` - Length of * `m` - .\n * `salt` - The salt to be used.\n * `slen` - Length of * `salt` - .\n * `sk` - A valid 2048-bit RSA secret key with CRT coefficients.\n\n Returns -2 If the salt is too long.\n Returns 0 On success.\n\n @remark The key * `sk` - should be initialized with * `ocrypto_rsa2048_init_crt_key` - .\n @remark * `s` - may be same as * `m` - ."]
pub fn ocrypto_rsa2048_pss_sha256_crt_sign(
s: *mut u8,
m: *const u8,
mlen: usize,
salt: *const u8,
slen: usize,
sk: *const ocrypto_rsa2048_crt_key,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " 2048-bit RSA PSS SHA-256 signature verify.\n\n The signature * `s` - of the input message * `m` - is verified.\n\n * `s` - The 256-byte signature.\n * `m` - The signed message.\n * `mlen` - Length of * `m` - .\n * `slen` - The length of the salt.\n * `pk` - A valid 2048-bit RSA public key.\n\n Returns 0 If the signature is valid.\n Returns -1 If verification failed.\n Returns -2 If the salt is too long.\n\n @remark The key * `pk` - should be initialized with * `ocrypto_rsa2048_init_pub_key` - ."]
pub fn ocrypto_rsa2048_pss_sha256_verify(
s: *const u8,
m: *const u8,
mlen: usize,
slen: usize,
pk: *const ocrypto_rsa2048_pub_key,
) -> ::core::ffi::c_int;
}
#[doc = "@{*/\n/**\n RSA public key."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_rsa_pub_key {
#[doc = "@cond"]
pub n: *mut u32,
pub e: u32,
pub blocks: ::core::ffi::c_int,
}
#[test]
fn bindgen_test_layout_ocrypto_rsa_pub_key() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_rsa_pub_key> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_rsa_pub_key>(),
12usize,
concat!("Size of: ", stringify!(ocrypto_rsa_pub_key))
);
assert_eq!(
::core::mem::align_of::<ocrypto_rsa_pub_key>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_rsa_pub_key))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).n) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa_pub_key),
"::",
stringify!(n)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).e) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa_pub_key),
"::",
stringify!(e)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).blocks) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa_pub_key),
"::",
stringify!(blocks)
)
);
}
#[doc = " RSA secret key."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_rsa_key {
#[doc = "@cond"]
pub n: *mut u32,
pub d: *mut u32,
pub blocks: ::core::ffi::c_int,
}
#[test]
fn bindgen_test_layout_ocrypto_rsa_key() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_rsa_key> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_rsa_key>(),
12usize,
concat!("Size of: ", stringify!(ocrypto_rsa_key))
);
assert_eq!(
::core::mem::align_of::<ocrypto_rsa_key>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_rsa_key))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).n) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa_key),
"::",
stringify!(n)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).d) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa_key),
"::",
stringify!(d)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).blocks) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa_key),
"::",
stringify!(blocks)
)
);
}
#[doc = " RSA secret key with CRT coefficients."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_rsa_crt_key {
#[doc = "@cond"]
pub n: *mut u32,
pub p: *mut u32,
pub q: *mut u32,
pub dp: *mut u32,
pub dq: *mut u32,
pub qinv: *mut u32,
pub blocks: ::core::ffi::c_int,
}
#[test]
fn bindgen_test_layout_ocrypto_rsa_crt_key() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_rsa_crt_key> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_rsa_crt_key>(),
28usize,
concat!("Size of: ", stringify!(ocrypto_rsa_crt_key))
);
assert_eq!(
::core::mem::align_of::<ocrypto_rsa_crt_key>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_rsa_crt_key))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).n) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa_crt_key),
"::",
stringify!(n)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).p) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa_crt_key),
"::",
stringify!(p)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).q) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa_crt_key),
"::",
stringify!(q)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).dp) as usize - ptr as usize },
12usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa_crt_key),
"::",
stringify!(dp)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).dq) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa_crt_key),
"::",
stringify!(dq)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).qinv) as usize - ptr as usize },
20usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa_crt_key),
"::",
stringify!(qinv)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).blocks) as usize - ptr as usize },
24usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_rsa_crt_key),
"::",
stringify!(blocks)
)
);
}
extern "C" {
#[doc = "# variable-bit RSA key setup.\n\n This group of functions is used for generic RSA key setup.\n/\n/**@{*/\n/**\n RSA public key setup.\n\n * `key` - The initialized public key.\n * `key_mem` - Key memory. Length OCRYPTO_RSA_KEY_SIZE(bits).\n Must have same lifetime as * `key` - .\n * `n` - The RSA modulus, unsigned big-endian.\n * `n_len` - Length of * `n` - .\n * `e` - Public exponent.\n\n Returns -1 If the input length is invalid.\n Returns 0 On success.\n\n @remark The n value can be read directly from a DER encoded RSAPublicKey or RSAPrivateKey."]
pub fn ocrypto_rsa_init_pub_key(
key: *mut ocrypto_rsa_pub_key,
key_mem: *mut u32,
n: *const u8,
n_len: usize,
e: u32,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA secret key setup.\n\n * `key` - The initialized secret key.\n * `key_mem` - Key memory. Length OCRYPTO_RSA_PUB_KEY_SIZE(bits).\n Must have same lifetime as * `key` - .\n * `n` - The RSA modulus, unsigned big-endian.\n * `n_len` - Length of * `n` - .\n * `d` - The secret exponent, unsigned big-endian.\n * `d_len` - Length of * `d` - . Must be <= * `n_len` - .\n\n Returns -1 If the input length is invalid.\n Returns 0 On success.\n\n @remark The n and d values can be read directly from a DER encoded RSAPrivateKey."]
pub fn ocrypto_rsa_init_key(
key: *mut ocrypto_rsa_key,
key_mem: *mut u32,
n: *const u8,
n_len: usize,
d: *const u8,
d_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA secret key setup with CRT coefficients.\n\n * `key` - The initialized secret key.\n * `key_mem` - Key memory. Length OCRYPTO_RSA_CRT_KEY_SIZE(bits).\n Must have same lifetime as * `key` - .\n * `p` - The 1. RSA prime, unsigned big-endian.\n * `p_len` - Length of * `p` - .\n * `q` - The 2. RSA prime, unsigned big-endian.\n * `q_len` - Length of * `q` - . Must be same as * `p_len` - .\n * `dp` - The 1. CRT exponent, dp = d mod (p-1), unsigned big-endian.\n * `dp_len` - Length of * `dp` - .\n * `dq` - The 2. CRT exponent, dq = d mod (q-1), unsigned big-endian.\n * `dq_len` - Length of * `dq` - .\n * `qinv` - The CRT coefficient, qinv = 1/q mod p, unsigned big-endian.\n * `qi_len` - Length of * `qinv` - .\n\n Returns -1 If the input length is invalid.\n Returns 0 On success.\n\n @remark The p, q, dp, dq, and qinv values can be read directly from a DER encoded RSAPrivateKey."]
pub fn ocrypto_rsa_init_crt_key(
key: *mut ocrypto_rsa_crt_key,
key_mem: *mut u32,
p: *const u8,
p_len: usize,
q: *const u8,
q_len: usize,
dp: *const u8,
dp_len: usize,
dq: *const u8,
dq_len: usize,
qinv: *const u8,
qi_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = "# RSA primitives.\n\n This group of functions is used for basic RSA arithmetic.\n/\n/**@{*/\n/**\n RSA public key exponentiation.\n c = m^e mod n\n\n * `c` - The generated ciphertext.\n * `c_len` - Length of * `c` - .\n * `m` - The message to be encrypted.\n * `m_len` - Length of * `m` - .\n * `pk` - A valid RSA public key.\n * `mem` - The working memory. Length OCRYPTO_RSA_PUB_MEM_SIZE(bits).\n\n Returns -1 If the input is too large (m >= n).\n Returns 0 On success.\n\n @remark The key * `pk` - should be initialized with * `ocrypto_rsa_init_pub_key` - .\n @remark * `c` - , * `m` - , and * `mem` - may be same."]
pub fn ocrypto_rsa_pub_exp(
c: *mut u8,
c_len: usize,
m: *const u8,
m_len: usize,
pk: *const ocrypto_rsa_pub_key,
mem: *mut u32,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA secret key exponentiation.\n m = c^d mod n\n\n * `m` - The generated message.\n * `m_len` - Length of * `m` - .\n * `c` - The ciphertext to be decrypted.\n * `c_len` - Length of * `c` - .\n * `key` - A valid RSA secret key.\n * `mem` - The working memory. Length OCRYPTO_RSA_MEM_SIZE(bits).\n\n Returns -1 If the input is too large (c >= n).\n Returns 0 On success.\n\n @remark The key * `key` - should be initialized with * `ocrypto_rsa_init_key` - .\n @remark * `c` - , * `m` - , and * `mem` - may be same."]
pub fn ocrypto_rsa_exp(
m: *mut u8,
m_len: usize,
c: *const u8,
c_len: usize,
key: *const ocrypto_rsa_key,
mem: *mut u32,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA CRT key exponentiation.\n m = (c^dp mod p - c^dq mod q) * qinv mod p * q + c^dq mod q\n\n * `m` - The generated message.\n * `m_len` - Length of * `m` - .\n * `c` - The ciphertext to be decrypted.\n * `c_len` - Length of * `c` - .\n * `key` - A valid RSA secret key with CRT coefficients.\n * `mem` - The working memory. Length OCRYPTO_RSA_CRT_MEM_SIZE(bits).\n\n Returns -1 If the input is too large (c >= n).\n Returns 0 On success.\n\n @remark The key * `key` - should be initialized with * `ocrypto_rsa_init_crt_key` - .\n @remark * `c` - , * `m` - , and * `mem` - may be same."]
pub fn ocrypto_rsa_crt_exp(
m: *mut u8,
m_len: usize,
c: *const u8,
c_len: usize,
key: *const ocrypto_rsa_crt_key,
mem: *mut u32,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = "# RSA operations.\n\n This group of functions is used for RSA with padding.\n/\n/**@{*/\n/**\n RSA PKCS1 V1.5 encryption.\n\n The message * `m` - is encrypted to a ciphertext returned in * `c` - .\n\n * `c` - The generated ciphertext.\n * `c_len` - Length of * `c` - .\n * `m` - The message to be encrypted.\n * `m_len` - Length of * `m` - . 0 <= m_len <= key-size - 11.\n * `seed` - The random seed to be used for the padding.\n * `s_len` - Length of * `seed` - . * `s_len` - >= key-size - 3 - * `m_len` - \n * `pk` - A valid RSA public key.\n * `mem` - The working memory. Length OCRYPTO_RSA_PUB_MEM_SIZE(bits).\n\n Returns -1 If the message is too long (m_len > key-size - 11).\n Returns -2 If the seed is too short (s_len < key-size - 3 - m_len).\n Returns 0 On success.\n\n @remark The key * `pk` - should be initialized with * `ocrypto_rsa_init_pub_key` - .\n @remark The * `seed` - should consist of non-zero random bytes.\n @remark * `c` - may be same as * `m` - or * `mem` - ."]
pub fn ocrypto_rsa_pkcs1_v15_encrypt(
c: *mut u8,
c_len: usize,
m: *const u8,
m_len: usize,
seed: *const u8,
s_len: usize,
pk: *const ocrypto_rsa_pub_key,
mem: *mut u32,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA PKCS1 V1.5 decryption.\n\n The ciphertext * `c` - is decrypted to the message returned in * `m` - .\n\n * `m` - The decrypted message. The buffer must be long enough to hold the message.\n * `m_len` - Length of * `m` - .\n * `c` - The ciphertext to decrypt.\n * `c_len` - Length of * `c` - .\n * `key` - A valid RSA secret key.\n * `mem` - The working memory. Length OCRYPTO_RSA_MEM_SIZE(bits).\n\n Returns -1 If decryption failed.\n Returns -2 If the output buffer is too short (m_len < length of message).\n Returns n If a message of length n was successfully decrypted.\n\n @remark The key * `key` - should be initialized with * `ocrypto_rsa_init_key` - .\n @remark * `c` - , * `m` - , and * `mem` - may be same."]
pub fn ocrypto_rsa_pkcs1_v15_decrypt(
m: *mut u8,
m_len: usize,
c: *const u8,
c_len: usize,
key: *const ocrypto_rsa_key,
mem: *mut u32,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA PKCS1 V1.5 decryption with CRT acceleration.\n\n The ciphertext * `c` - is decrypted to the message returned in * `m` - .\n\n * `m` - The decrypted message. The buffer must be long enough to hold the message.\n * `m_len` - Length of * `m` - .\n * `c` - The ciphertext to decrypt.\n * `c_len` - Length of * `c` - .\n * `key` - A valid RSA secret key with CRT coefficients.\n * `mem` - The working memory. Length OCRYPTO_RSA_CRT_MEM_SIZE(bits).\n\n Returns -1 If decryption failed.\n Returns -2 If the output buffer is too short (m_len < length of message).\n Returns n If a message of length n was successfully decrypted.\n\n @remark The key * `key` - should be initialized with * `ocrypto_rsa_init_crt_key` - .\n @remark * `c` - , * `m` - , and * `mem` - may be same."]
pub fn ocrypto_rsa_pkcs1_v15_crt_decrypt(
m: *mut u8,
m_len: usize,
c: *const u8,
c_len: usize,
key: *const ocrypto_rsa_crt_key,
mem: *mut u32,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA OAEP SHA256 encryption.\n\n The message * `m` - is encrypted to a ciphertext returned in * `c` - .\n\n * `c` - The generated 128-byte ciphertext.\n * `c_len` - Length of * `c` - .\n * `m` - The message to be encrypted.\n * `m_len` - Length of * `m` - . 0 <= m_len <= key-size - 66.\n * `label` - The label associated with the message.\n * `l_len` - Length of * `label` - . May be 0.\n * `seed` - 32-byte random seed.\n * `pk` - A valid RSA public key.\n * `mem` - The working memory. Length OCRYPTO_RSA_PUB_MEM_SIZE(bits).\n\n Returns -1 If the message is too long (m_len > key-size - 66).\n Returns 0 On success.\n\n @remark The key * `pk` - should be initialized with * `ocrypto_rsa_init_pub_key` - .\n @remark * `c` - , * `m` - , and * `mem` - may be same."]
pub fn ocrypto_rsa_oaep_sha256_encrypt(
c: *mut u8,
c_len: usize,
m: *const u8,
m_len: usize,
label: *const u8,
l_len: usize,
seed: *const u8,
pk: *const ocrypto_rsa_pub_key,
mem: *mut u32,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA OAEP SHA256 decryption.\n\n The ciphertext * `c` - is decrypted to the message returned in * `m` - .\n\n * `m` - The decrypted message. The buffer must be long enough to hold the message.\n * `m_len` - Length of * `m` - .\n * `c` - The ciphertext to decrypt.\n * `c_len` - Length of * `c` - .\n * `label` - The label associated with the message.\n * `l_len` - Length of * `label` - . May be 0.\n * `key` - A valid RSA secret key.\n * `mem` - The working memory. Length OCRYPTO_RSA_MEM_SIZE(bits).\n\n Returns -1 If decryption failed.\n Returns -2 If the output buffer is too short (m_len < length of message).\n Returns n If a message of length n was successfully decrypted.\n\n @remark The key * `key` - should be initialized with * `ocrypto_rsa_init_key` - .\n @remark * `c` - , * `m` - , and * `mem` - may be same."]
pub fn ocrypto_rsa_oaep_sha256_decrypt(
m: *mut u8,
m_len: usize,
c: *const u8,
c_len: usize,
label: *const u8,
l_len: usize,
key: *const ocrypto_rsa_key,
mem: *mut u32,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA OAEP SHA256 decryption with CRT acceleration.\n\n The ciphertext * `c` - is decrypted to the message returned in * `m` - .\n\n * `m` - The decrypted message. The buffer must be long enough to hold the message.\n * `m_len` - Length of * `m` - .\n * `c` - The ciphertext to decrypt.\n * `c_len` - Length of * `c` - .\n * `label` - The label associated with the message.\n * `l_len` - Length of * `label` - . May be 0.\n * `key` - A valid RSA secret key with CRT coefficients.\n * `mem` - The working memory. Length OCRYPTO_RSA_CRT_MEM_SIZE(bits).\n\n Returns -1 If decryption failed.\n Returns -2 If the output buffer is too short (m_len < length of message).\n Returns n If a message of length n was successfully decrypted.\n\n @remark The key * `key` - should be initialized with * `ocrypto_rsa_init_crt_key` - .\n @remark * `c` - , * `m` - , and * `mem` - may be same."]
pub fn ocrypto_rsa_oaep_sha256_crt_decrypt(
m: *mut u8,
m_len: usize,
c: *const u8,
c_len: usize,
label: *const u8,
l_len: usize,
key: *const ocrypto_rsa_crt_key,
mem: *mut u32,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA PKCS1 V1.5 SHA-256 sign.\n\n The message * `m` - is signed and the signature returned in * `s` - .\n\n * `s` - The generated signature.\n * `s_len` - Length of * `s` - .\n * `m` - The message to be signed.\n * `m_len` - Length of * `m` - .\n * `key` - A valid RSA secret key.\n * `mem` - The working memory. Length OCRYPTO_RSA_MEM_SIZE(bits).\n\n Returns 0\n\n @remark The key * `key` - should be initialized with * `ocrypto_rsa_init_key` - .\n @remark * `s` - , * `m` - , and * `mem` - may be same."]
pub fn ocrypto_rsa_pkcs1_v15_sha256_sign(
s: *mut u8,
s_len: usize,
m: *const u8,
m_len: usize,
key: *const ocrypto_rsa_key,
mem: *mut u32,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA PKCS1 V1.5 SHA-256 sign with CRT acceleration.\n\n The message * `m` - is signed and the signature returned in * `s` - .\n\n * `s` - The generated signature.\n * `s_len` - Length of * `s` - .\n * `m` - The message to be signed.\n * `m_len` - Length of * `m` - .\n * `key` - A valid RSA secret key with CRT coefficients.\n * `mem` - The working memory. Length OCRYPTO_RSA_CRT_MEM_SIZE(bits).\n\n Returns 0\n\n @remark The key * `key` - should be initialized with * `ocrypto_rsa_init_crt_key` - .\n @remark * `s` - , * `m` - , and * `mem` - may be same."]
pub fn ocrypto_rsa_pkcs1_v15_sha256_crt_sign(
s: *mut u8,
s_len: usize,
m: *const u8,
m_len: usize,
key: *const ocrypto_rsa_crt_key,
mem: *mut u32,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA PKCS1 V1.5 SHA-256 signature verify.\n\n The signature * `s` - of the input message * `m` - is verified.\n\n * `s` - The signature.\n * `s_len` - Length of * `s` - .\n * `m` - The signed message.\n * `m_len` - Length of * `m` - .\n * `pk` - A valid RSA public key.\n * `mem` - The working memory. Length OCRYPTO_RSA_PUB_MEM_SIZE(bits).\n\n Returns 0 If the signature is valid.\n Returns -1 If verification failed.\n\n @remark The key * `pk` - should be initialized with * `ocrypto_rsa_init_pub_key` - .\n @remark * `mem` - may be same as * `s` - or * `m` - ."]
pub fn ocrypto_rsa_pkcs1_v15_sha256_verify(
s: *const u8,
s_len: usize,
m: *const u8,
m_len: usize,
pk: *const ocrypto_rsa_pub_key,
mem: *mut u32,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA PSS SHA-256 sign.\n\n The message * `m` - is signed and the signature returned in * `s` - .\n\n * `s` - The generated signature.\n * `s_len` - Length of * `s` - .\n * `m` - The message to be signed.\n * `m_len` - Length of * `m` - .\n * `salt` - The salt to be used.\n * `salt_len` - Length of * `salt` - .\n * `key` - A valid RSA secret key.\n * `mem` - The working memory. Length OCRYPTO_RSA_MEM_SIZE(bits).\n\n Returns -2 If the salt is too long.\n Returns 0 On success.\n\n @remark The key * `key` - should be initialized with * `ocrypto_rsa_init_key` - .\n @remark * `s` - , * `m` - , and * `mem` - may be same."]
pub fn ocrypto_rsa_pss_sha256_sign(
s: *mut u8,
s_len: usize,
m: *const u8,
m_len: usize,
salt: *const u8,
salt_len: usize,
key: *const ocrypto_rsa_key,
mem: *mut u32,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA PSS SHA-256 sign with CRT acceleration.\n\n The message * `m` - is signed and the signature returned in * `s` - .\n\n * `s` - The generated signature.\n * `s_len` - Length of * `m` - .\n * `m` - The message to be signed.\n * `m_len` - Length of * `m` - .\n * `salt` - The salt to be used.\n * `salt_len` - Length of * `salt` - .\n * `key` - A valid RSA secret key with CRT coefficients.\n * `mem` - The working memory. Length OCRYPTO_RSA_CRT_MEM_SIZE(bits).\n\n Returns -2 If the salt is too long.\n Returns 0 On success.\n\n @remark The key * `key` - should be initialized with * `ocrypto_rsa_init_crt_key` - .\n @remark * `s` - , * `m` - , and * `mem` - may be same."]
pub fn ocrypto_rsa_pss_sha256_crt_sign(
s: *mut u8,
s_len: usize,
m: *const u8,
m_len: usize,
salt: *const u8,
salt_len: usize,
key: *const ocrypto_rsa_crt_key,
mem: *mut u32,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA PSS SHA-256 signature verify.\n\n The signature * `s` - of the input message * `m` - is verified.\n\n * `s` - The signature.\n * `s_len` - Length of * `s` - .\n * `m` - The signed message.\n * `m_len` - Length of * `m` - .\n * `salt_len` - The length of the salt.\n * `pk` - A valid RSA public key.\n * `mem` - The working memory. Length OCRYPTO_RSA_PUB_MEM_SIZE(bits).\n\n Returns 0 If the signature is valid.\n Returns -1 If verification failed.\n Returns -2 If the salt is too long.\n\n @remark The key * `pk` - should be initialized with * `ocrypto_rsa_init_pub_key` - .\n @remark * `mem` - may be same as * `s` - or * `m` - ."]
pub fn ocrypto_rsa_pss_sha256_verify(
s: *const u8,
s_len: usize,
m: *const u8,
m_len: usize,
salt_len: usize,
pk: *const ocrypto_rsa_pub_key,
mem: *mut u32,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA PKCS1 V1.5 padding.\n\n * `em` - The padded message.\n * `em_len` - Length of * `em` - .\n * `m` - The message to be padded.\n * `m_len` - Length of * `m` - . 0 <= * `m_len` - <= * `em_len` - - 11.\n * `seed` - The random seed to be used for the padding.\n * `s_len` - Length of * `seed` - . * `s_len` - >= * `em_len` - - 3 - * `m_len` - \n\n Returns -1 If the message is too long ( * `m_len` - > * `em_len` - - 11).\n Returns -2 If the seed is too short ( * `s_len` - < * `em_len` - - 3 - * `m_len)` - .\n Returns 0 On success.\n\n @remark The * `seed` - should consist of non-zero random bytes."]
pub fn ocrypto_rsa_pkcs1_v15_padding(
em: *mut u8,
em_len: usize,
m: *const u8,
m_len: usize,
seed: *const u8,
s_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA PKCS1 V1.5 unpadding.\n\n * `m` - The unpadded message. The buffer must be long enough to hold the message.\n * `m_len` - Length of * `m` - .\n * `em` - The padded message.\n * `em_len` - Length of * `em` - .\n\n Returns -1 If decryption failed.\n Returns -2 If the output buffer is too short ( * `m_len` - < length of message).\n Returns n If a message of length n was successfully decrypted."]
pub fn ocrypto_rsa_pkcs1_v15_check_padding(
m: *mut u8,
m_len: usize,
em: *const u8,
em_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA OAEP SHA256 padding.\n\n * `em` - The padded message.\n * `em_len` - Length of * `em` - .\n * `m` - The message to be encrypted.\n * `m_len` - Length of * `m` - . 0 <= * `m_len` - <= * `em_len` - - 66.\n * `label` - The label associated with the message.\n * `l_len` - Length of * `label` - . May be 0.\n * `seed` - 32-byte random seed.\n\n Returns -1 If the message is too long ( * `m_len` - > * `em_len` - - 66).\n Returns 0 On success."]
pub fn ocrypto_rsa_oaep_sha256_padding(
em: *mut u8,
em_len: usize,
m: *const u8,
m_len: usize,
label: *const u8,
l_len: usize,
seed: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA OAEP SHA256 unpadding.\n\n * `m` - The unpadded message. The buffer must be long enough to hold the message.\n * `m_len` - Length of * `m` - .\n * `em` - The padded message.\n * `em_len` - Length of * `em` - .\n * `label` - The label associated with the message.\n * `l_len` - Length of * `label` - . May be 0.\n\n Returns -1 If decryption failed.\n Returns -2 If the output buffer is too short ( * `m_len` - < length of message).\n Returns n If a message of length n was successfully decrypted."]
pub fn ocrypto_rsa_oaep_sha256_check_padding(
m: *mut u8,
m_len: usize,
em: *mut u8,
em_len: usize,
label: *const u8,
l_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA PKCS1 V1.5 SHA-256 signature encoding.\n\n * `em` - The encoded message.\n * `em_len` - Length of * `em` - .\n * `m` - The message to be encoded.\n * `m_len` - Length of * `m` - .\n\n Returns -2 If the length of the encoded message is too short ( * `em_len` - < 62).\n Returns 0 On success."]
pub fn ocrypto_rsa_pkcs1_v15_sha256_encode(
em: *mut u8,
em_len: usize,
m: *const u8,
m_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA PSS SHA-256 signature encoding.\n\n * `em` - The encoded message.\n * `em_len` - Length of * `em` - .\n * `m` - The message to be encoded.\n * `m_len` - Length of * `m` - .\n * `salt` - The salt to be used.\n * `s_len` - Length of * `salt` - .\n\n Returns -2 If the salt is too long ( * `s_len` - > * `em_len` - - 34).\n Returns 0 On success."]
pub fn ocrypto_rsa_pss_sha256_encode(
em: *mut u8,
em_len: usize,
m: *const u8,
m_len: usize,
salt: *const u8,
s_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " RSA PSS SHA-256 signature decoding.\n\n * `em` - The encoded message.\n * `em_len` - Length of * `em` - .\n * `m` - The signed message.\n * `m_len` - Length of * `m` - .\n * `salt_len` - The length of the salt.\n\n Returns 0 If the encoding is valid.\n Returns -1 If decoding failed.\n Returns -2 If the salt is too long ( * `salt_len` - > * `em_len` - - 34)."]
pub fn ocrypto_rsa_pss_sha256_decode(
em: *mut u8,
em_len: usize,
m: *const u8,
m_len: usize,
salt_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
pub fn ocrypto_sc_p256_from32bytes(r: *mut ocrypto_sc_p256, x: *const u8)
-> ::core::ffi::c_int;
}
extern "C" {
#[doc = " ECDH secp160r1 scalar multiplication `r = (1 + s mod (n-1)) * G`.\n\n * `r` - Resulting curve point in the form (x,y).\n * `s` - Scalar value. 256 bit big endian.\n\n @remark * `r` - may be same as * `s` - ."]
pub fn ocrypto_p160_scalar_mult(r: *mut u8, s: *const u8);
}
extern "C" {
#[doc = " ECDH secp160r1 scalar multiplication `r = (s mod n) * G`.\n\n * `r` - Resulting curve point in the form (x,y).\n * `s` - Scalar value. 256 bit big endian.\n\n @remark * `r` - may be same as * `s` - ."]
pub fn ocrypto_p160_scalar_mult_alt(r: *mut u8, s: *const u8);
}
#[doc = "@cond"]
pub type ocrypto_sha224_ctx = ocrypto_sha256_ctx;
extern "C" {
#[doc = "# Incremental SHA-224 generator.\n\n This group of functions can be used to incrementally compute the SHA-224\n hash for a given message.\n/\n/**@{*/\n/**\n SHA-224 initialization.\n\n The generator state * `ctx` - is initialized by this function.\n\n * `ctx` - Generator state."]
pub fn ocrypto_sha224_init(ctx: *mut ocrypto_sha224_ctx);
}
extern "C" {
#[doc = " SHA-224 incremental data input.\n\n The generator state * `ctx` - is updated to hash a message chunk * `in` - .\n\n This function can be called repeatedly until the whole message is processed.\n\n * `ctx` - Generator state.\n * `in` - Input data.\n * `in_len` - Length of * `in` - .\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_sha224_init` - is required before this function can be called."]
pub fn ocrypto_sha224_update(ctx: *mut ocrypto_sha224_ctx, in_: *const u8, in_len: usize);
}
extern "C" {
#[doc = " SHA-224 output.\n\n The generator state * `ctx` - is updated to finalize the hash for the previously\n processed message chunks. The hash is put into * `r` - .\n\n * `ctx` - Generator state.\n * `r` - Generated hash value.\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_sha224_init` - is required before this function can be called.\n\n @remark After return, the generator state * `ctx` - must no longer be used with\n * `ocrypto_sha224_update` - and * `ocrypto_sha224_final` - unless it is\n reinitialized using * `ocrypto_sha224_init` - ."]
pub fn ocrypto_sha224_final(ctx: *mut ocrypto_sha224_ctx, r: *mut u8);
}
extern "C" {
#[doc = " SHA-224 hash.\n\n The SHA-224 hash of a given input message * `in` - is computed and put into * `r` - .\n\n * `r` - Generated hash.\n * `in` - Input data.\n * `in_len` - Length of * `in` - ."]
pub fn ocrypto_sha224(r: *mut u8, in_: *const u8, in_len: usize);
}
#[doc = "@cond"]
pub type ocrypto_sha384_ctx = ocrypto_sha512_ctx;
extern "C" {
#[doc = "# Incremental SHA-384 generator.\n\n This group of functions can be used to incrementally compute the SHA-384\n hash for a given message.\n/\n/**@{*/\n/**\n SHA-384 initialization.\n\n The generator state * `ctx` - is initialized by this function.\n\n * `ctx` - Generator state."]
pub fn ocrypto_sha384_init(ctx: *mut ocrypto_sha384_ctx);
}
extern "C" {
#[doc = " SHA-384 incremental data input.\n\n The generator state * `ctx` - is updated to hash a message chunk * `in` - .\n\n This function can be called repeatedly until the whole message is processed.\n\n * `ctx` - Generator state.\n * `in` - Input data.\n * `in_len` - Length of * `in` - .\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_sha384_init` - is required before this function can be called."]
pub fn ocrypto_sha384_update(ctx: *mut ocrypto_sha384_ctx, in_: *const u8, in_len: usize);
}
extern "C" {
#[doc = " SHA-384 output.\n\n The generator state * `ctx` - is updated to finalize the hash for the previously\n processed message chunks. The hash is put into * `r` - .\n\n * `ctx` - Generator state.\n * `r` - Generated hash value.\n\n @remark Initialization of the generator state * `ctx` - through\n * `ocrypto_sha384_init` - is required before this function can be called.\n\n @remark After return, the generator state * `ctx` - must no longer be used with\n * `ocrypto_sha384_update` - and * `ocrypto_sha384_final` - unless it is\n reinitialized using * `ocrypto_sha384_init` - ."]
pub fn ocrypto_sha384_final(ctx: *mut ocrypto_sha384_ctx, r: *mut u8);
}
extern "C" {
#[doc = " SHA-384 hash.\n\n The SHA-384 hash of a given input message * `in` - is computed and put into * `r` - .\n\n * `r` - Generated hash.\n * `in` - Input data.\n * `in_len` - Length of * `in` - ."]
pub fn ocrypto_sha384(r: *mut u8, in_: *const u8, in_len: usize);
}
extern "C" {
#[doc = " SPAKE2+ P256 secret key reduction.\n\n * `x` - Reduced secret key.\n * `xs` - Extended secret key.\n * `xs_len` - Extended secret key length."]
pub fn ocrypto_spake2p_p256_reduce(x: *mut u8, xs: *const u8, xs_len: usize);
}
extern "C" {
#[doc = " SPAKE2+ P256 public key validation check.\n\n * `K` - Public key.\n\n Returns 0 If the key is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_spake2p_p256_check_key(K: *const u8) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " SPAKE2+ P256 key share calculation.\n\n * `XY` - Public key share.\n * `w0` - First password hash.\n * `xy` - Secret key.\n * `MN` - Random element.\n\n Returns 0 If the key share is valid.\n Returns -1 Otherwise."]
pub fn ocrypto_spake2p_p256_get_key_share(
XY: *mut u8,
w0: *const u8,
xy: *const u8,
MN: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " SPAKE2+ P256 common value calculation.\n\n * `Z` - Common value Z.\n * `V` - Common value V.\n * `w0` - First password hash.\n * `w1` - Second password hash. NULL on server side.\n * `xy` - Secret key.\n * `YX` - Peer key share.\n * `NM` - Peer random element.\n * `L` - Password registration. NULL on client side."]
pub fn ocrypto_spake2p_p256_get_ZV(
Z: *mut u8,
V: *mut u8,
w0: *const u8,
w1: *const u8,
xy: *const u8,
YX: *const u8,
NM: *const u8,
L: *const u8,
);
}
extern "C" {
#[doc = "# SRP-6 password verifier generation.\n\n A password verifier is generated from a user name and a password. The\n password * `pass` - may be discarded, as only the verifier is used during later\n computations.\n/\n/**@{*/\n/**\n SRP-6 password verifier.\n\n The verifier is generated for a given user name * `user` - , a password * `pass` - \n and salt * `salt` - .\n\n * `v` - Generated password verifier, must be 32-bit aligned.\n * `salt` - Salt.\n * `user` - User name.\n * `user_len` - Length of * `user` - .\n * `pass` - Password.\n * `pass_len` - Length of * `pass` - ."]
pub fn ocrypto_srp_verifier(
v: *mut u8,
salt: *const u8,
user: *const u8,
user_len: usize,
pass: *const u8,
pass_len: usize,
);
}
extern "C" {
#[doc = "# SRP-6 public key generation.\n\n An ephemeral keypair can be generated based on the password verifier to be\n used when opening a new session.\n/\n/**@{*/\n/**\n SRP-6 public Key.\n\n The public key for a given private key * `priv_b` - is generated using the\n password verifier * `v` - and put into * `pub_b` - .\n\n * `pub_b` - Generated public key, must be 32-bit aligned.\n * `priv_b` - Private key.\n * `v` - Password verifier."]
pub fn ocrypto_srp_public_key(pub_b: *mut u8, priv_b: *const u8, v: *const u8);
}
extern "C" {
#[doc = " SRP-6 Server Public Key.\n\n * `pub_b` - Generated public key, must be 32 bit aligned.\n * `priv_b` - Private key.\n * `k` - Multiplier.\n * `v` - Password verifier."]
pub fn ocrypto_srp_server_public_key(
pub_b: *mut u8,
priv_b: *const u8,
k: *const u8,
v: *const u8,
);
}
extern "C" {
#[doc = " SRP - 6 Client Public Key.\n\n * `pub_a` - Generated public key.\n * `priv_a` - Private key.\n * `a_len` - Length of * `priv_a` - ."]
pub fn ocrypto_srp_client_public_key(
pub_a: *mut ::core::ffi::c_uchar,
priv_a: *const ::core::ffi::c_uchar,
a_len: usize,
);
}
extern "C" {
#[doc = "# SRP-6 session key generation.\n\n A premaster secret can be derived from both the client's and server's public\n keys, the server's private key and the password verifier. A shared session\n key can be generated from this premaster secret.\n/\n/**@{*/\n/**\n SRP-6 scrambling parameter.\n\n The scrambling parameter is computed from both the client's public key\n * `pub_a` - and the server's public key * `pub_b` - . The scrambling parameter\n is required to compute the premaster secret.\n\n * `u` - Generated scrambling parameter.\n * `pub_a` - Client public key.\n * `pub_b` - Server public key."]
pub fn ocrypto_srp_scrambling_parameter(u: *mut u8, pub_a: *const u8, pub_b: *const u8);
}
extern "C" {
#[doc = " SRP-6 premaster secret.\n\n The premaster secret between the client and the server is computed using the\n client public key * `pub_a` - , the server private key * `priv_b` - , the scrambling\n parameter * `u` - and the password verifier * `v` - . If the client public key\n * `pub_a` - is valid, the premaster secret is then put into * `s` - . The premaster\n secret can be used to generate encryption keys.\n\n * `s` - Generated premaster secret, must be 32-bit aligned.\n * `pub_a` - Client public key.\n * `priv_b` - Server private key.\n * `u` - Scrambling parameter; generated with * `ocrypto_srp_scrambling_parameter` - .\n * `v` - Password verifier.\n\n Returns 0 If * `pub_a` - is a valid public key.\n Returns 1 Otherwise."]
pub fn ocrypto_srp_premaster_secret(
s: *mut u8,
pub_a: *const u8,
priv_b: *const u8,
u: *const u8,
v: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " SRP-6 server premaster secret.\n\n The premaster secret between the client and the server is computed using the\n client public key * `pub_a` - , the server private key * `priv_b` - , the scrambling\n parameter * `u` - and the password verifier * `v` - . If the client public key\n * `pub_a` - is valid, the premaster secret is then put into * `s` - . The premaster\n secret can be used to generate encryption keys.\n\n * `s` - Generated premaster secret, must be 32-bit aligned.\n * `pub_a` - Client public key.\n * `priv_b` - Server private key.\n * `u` - Scrambling parameter; generated with * `ocrypto_srp_scrambling_parameter` - .\n * `u_len` - Length of * `u` - .\n * `v` - Password verifier.\n\n Returns 0 If * `pub_a` - is a valid public key.\n Returns 1 Otherwise."]
pub fn ocrypto_srp_server_premaster_secret(
s: *mut u8,
pub_a: *const u8,
priv_b: *const u8,
u: *const u8,
u_len: usize,
v: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " SRP-6 client premaster secret.\n\n * `s` - Generated premaster secret, must be 32 bit aligned.\n * `priv_a` - Client private key.\n * `pub_b` - Server public key.\n * `k` - Multiplier.\n * `u` - Scrambling parameter; generated with * `srp_scrambling_parameter` - .\n * `h` - Password hash.\n * `h_len` - Length of * `h` - and * `u` - .\n\n Returns 0 If * `pub_a` - is a valid public key.\n Returns 1 Otherwise."]
pub fn ocrypto_srp_client_premaster_secret(
s: *mut u8,
priv_a: *const u8,
pub_b: *const u8,
k: *const u8,
u: *const u8,
h: *const u8,
h_len: usize,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " SRP-6 SRP session key.\n\n Generates the shared SRP session key from the premaster secret * `s` - and puts\n it into * `k` - .\n\n * `k` - Generated SRP session key.\n * `s` - Premaster secret."]
pub fn ocrypto_srp_session_key(k: *mut u8, s: *const u8);
}
extern "C" {
#[doc = "# SRP-6 proof exchange.\n\n Proofs are exchanged from client to server and vice versa to ensure that both\n parties computed the same shared session key. The proofs only match if the\n correct password is used by the client.\n/\n/**@{*/\n/**\n SRP-6 proof M1 (client to server).\n\n A proof is generated by the client and sent to the server to assert that the\n client is in possession of the shared session key * `k` - . The server also\n generates the proof. Only if the proofs match, the process can continue.\n The proof is based on the salt * `salt` - , the client public key * `pub_a` - ,\n the server public key * `pub_b` - and the shared session key * `k` - .\n\n * `m1` - Generated proof.\n * `user` - User name.\n * `user_len` - Length of * `user` - .\n * `salt` - Salt.\n * `pub_a` - Client public key.\n * `pub_b` - Server public key.\n * `k` - Session key."]
pub fn ocrypto_srp_proof_m1(
m1: *mut u8,
user: *const u8,
user_len: usize,
salt: *const u8,
pub_a: *const u8,
pub_b: *const u8,
k: *const u8,
);
}
extern "C" {
#[doc = " SRP-6 proof M2 (server to client).\n\n A second proof is generated by the server and sent back to the client to\n assert that the server is in possession of the shared session key * `k` - . The\n client also generates the proof. If the proofs match, both parties can assume\n that they share the same session key * `k` - . The second proof is based on the\n client public key * `pub_a` - , the first proof * `m1` - and the session key * `k` - .\n\n * `m2` - Generated proof.\n * `pub_a` - Client public key.\n * `m1` - First proof; generated with * `ocrypto_srp_proof_m1` - .\n * `k` - Session key."]
pub fn ocrypto_srp_proof_m2(m2: *mut u8, pub_a: *const u8, m1: *const u8, k: *const u8);
}
extern "C" {
#[doc = "# SRP-6 password verifier generation with context.\n\n A password verifier is generated from a user name and a password. The\n password * `pass` - may be discarded, as only the verifier is used in subsequent\n computations.\n/\n/**@{*/\n/**\n SRP-6 password verifier.\n\n The verifier is generated for a given user name * `user` - , a password * `pass` - \n and salt * `salt` - .\n\n * `ctx` - Context.\n * `v` - Generated password verifier, must be 32-bit aligned.\n * `salt` - Salt.\n * `user` - User name.\n * `user_len` - Length of * `user` - .\n * `pass` - Password.\n * `pass_len` - Length of * `pass` - ."]
pub fn ocrypto_srp_verifier_ctx(
ctx: *mut ocrypto_srp_ctx,
v: *mut u8,
salt: *const u8,
user: *const u8,
user_len: usize,
pass: *const u8,
pass_len: usize,
);
}
extern "C" {
#[doc = "# SRP-6 public key generation with context.\n\n An ephemeral keypair can be generated based on the password verifier to be\n used when opening a new session.\n/\n/**@{*/\n/**\n SRP-6 public Key.\n\n The public key for a given private key * `priv_b` - is generated using the\n password verifier * `v` - and put into * `pub_b` - .\n\n * `ctx` - Context.\n * `pub_b` - Generated public key, must be 32-bit aligned.\n * `priv_b` - Private key.\n * `v` - Password verifier."]
pub fn ocrypto_srp_public_key_ctx(
ctx: *mut ocrypto_srp_ctx,
pub_b: *mut u8,
priv_b: *const u8,
v: *const u8,
);
}
extern "C" {
#[doc = "# SRP-6 session key generation with context.\n\n A premaster secret can be derived from both the client's and server's public\n keys, the server's private key and the password verifier. A shared session\n key can be generated from this premaster secret.\n/\n/**@{*/\n/**\n SRP-6 scrambling parameter.\n\n The scrambling parameter is computed from both the client's public key\n * `pub_a` - and the server's public key * `pub_b` - . The scrambling parameter\n is required to compute the premaster secret.\n\n * `ctx` - Context.\n * `u` - Generated scrambling parameter.\n * `pub_a` - Client public key.\n * `pub_b` - Server public key."]
pub fn ocrypto_srp_scrambling_parameter_ctx(
ctx: *mut ocrypto_srp_ctx,
u: *mut u8,
pub_a: *const u8,
pub_b: *const u8,
);
}
extern "C" {
#[doc = " SRP-6 premaster secret with context.\n\n The premaster secret between the client and the server is computed using the\n client public key * `pub_a` - , the server private key * `priv_b` - , the scrambling\n parameter * `u` - and the password verifier * `v` - . If the client public key\n * `pub_a` - is valid, the premaster secret is then put into * `s` - . The premaster\n secret can be used to generate encryption keys.\n\n * `ctx` - Context.\n * `s` - Generated premaster secret, must be 32-bit aligned.\n * `pub_a` - Client public key.\n * `priv_b` - Server private key.\n * `u` - Scrambling parameter; generated with * `ocrypto_srp_scrambling_parameter` - .\n * `v` - Password verifier.\n\n Returns 0 If * `pub_a` - is a valid public key.\n Returns 1 Otherwise."]
pub fn ocrypto_srp_premaster_secret_ctx(
ctx: *mut ocrypto_srp_ctx,
s: *mut u8,
pub_a: *const u8,
priv_b: *const u8,
u: *const u8,
v: *const u8,
) -> ::core::ffi::c_int;
}
extern "C" {
#[doc = " SRP-6 SRP session Key with context.\n\n Generates the shared SRP session key from the premaster secret * `s` - and puts\n it into * `k` - .\n\n * `ctx` - Context.\n * `k` - Generated SRP session key.\n * `s` - Premaster secret."]
pub fn ocrypto_srp_session_key_ctx(ctx: *mut ocrypto_srp_ctx, k: *mut u8, s: *const u8);
}
extern "C" {
#[doc = "# SRP-6 proof exchange with context.\n\n Proofs are exchanged from client to server and vice versa to ensure that both\n parties computed the same shared session key. The proofs only match if the\n correct password is used by the client.\n/\n/**@{*/\n/**\n SRP-6 proof M1 (client to server) with context.\n\n A proof is generated by the client and sent to the server to assert that the\n client is in possession of the shared session key * `k` - . The server also\n generates the proof. Only if the proofs match, the process can continue.\n The proof is based on the salt * `salt` - , the client public key * `pub_a` - ,\n the server public key * `pub_b` - and the shared session key * `k` - .\n\n * `ctx` - Context.\n * `m1` - Generated proof.\n * `user` - User name.\n * `user_len` - Length of * `user` - .\n * `salt` - Salt.\n * `pub_a` - Client public key.\n * `pub_b` - Server public key.\n * `k` - Session key."]
pub fn ocrypto_srp_proof_m1_ctx(
ctx: *mut ocrypto_srp_ctx,
m1: *mut u8,
user: *const u8,
user_len: usize,
salt: *const u8,
pub_a: *const u8,
pub_b: *const u8,
k: *const u8,
);
}
extern "C" {
#[doc = " SRP-6 proof M2 (server to client) with context.\n\n A second proof is generated by the server and sent back to the client to\n assert that the server is in possession of the shared session key * `k` - . The\n client also generates the proof. If the proofs match, both parties can assume\n that they share the same session key * `k` - . The second proof is based on the\n client public key * `pub_a` - , the first proof * `m1` - and the session key * `k` - .\n\n * `ctx` - Context.\n * `m2` - Generated proof.\n * `pub_a` - Client public key.\n * `m1` - First proof; generated with * `ocrypto_srp_proof_m1` - .\n * `k` - Session key."]
pub fn ocrypto_srp_proof_m2_ctx(
ctx: *mut ocrypto_srp_ctx,
m2: *mut u8,
pub_a: *const u8,
m1: *const u8,
k: *const u8,
);
}
#[doc = " SRTP Context."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct ocrypto_srtp_ctx {
#[doc = " Key size [bytes]."]
pub key_size: u32,
#[doc = " Tag size [bytes]."]
pub tag_size: u32,
#[doc = " Session encryption key (max 256 bits)."]
pub encr_key: [u8; 32usize],
#[doc = " Session authentication key\n 160 bits."]
pub auth_key: [u8; 20usize],
#[doc = " Session salt\n 112 bits."]
pub salt_key: [u8; 14usize],
}
#[test]
fn bindgen_test_layout_ocrypto_srtp_ctx() {
const UNINIT: ::core::mem::MaybeUninit<ocrypto_srtp_ctx> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<ocrypto_srtp_ctx>(),
76usize,
concat!("Size of: ", stringify!(ocrypto_srtp_ctx))
);
assert_eq!(
::core::mem::align_of::<ocrypto_srtp_ctx>(),
4usize,
concat!("Alignment of ", stringify!(ocrypto_srtp_ctx))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).key_size) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_srtp_ctx),
"::",
stringify!(key_size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).tag_size) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_srtp_ctx),
"::",
stringify!(tag_size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).encr_key) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_srtp_ctx),
"::",
stringify!(encr_key)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).auth_key) as usize - ptr as usize },
40usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_srtp_ctx),
"::",
stringify!(auth_key)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).salt_key) as usize - ptr as usize },
60usize,
concat!(
"Offset of field: ",
stringify!(ocrypto_srtp_ctx),
"::",
stringify!(salt_key)
)
);
}
extern "C" {
#[doc = " Setup SRTP contexts.\n\n * `srtp_ctx` - SRTP context to be setup.\n * `srtcp_ctx` - SRTCP context to be setup.\n * `key` - Master key.\n * `key_size` - Size of the master key (16, 24, or 32 bytes).\n * `salt` - Master salt ( * `ocrypto_srtp_SALT_SIZE` - bytes).\n * `tag_size` - Size of the authentication tag.\n * `ssrc` - Synchronization source."]
pub fn ocrypto_srtp_setup_ctx(
srtp_ctx: *mut ocrypto_srtp_ctx,
srtcp_ctx: *mut ocrypto_srtp_ctx,
key: *const u8,
key_size: u32,
salt: *const u8,
tag_size: u32,
ssrc: u32,
);
}
extern "C" {
#[doc = " Encrypt SRTP packet.\n\n The final packet consists of * `num_header_bytes` - encrypted in place, followed\n by * `num_data_bytes` - copied from * `data_bytes` - during encryption.\n\n * `srtp_ctx` - SRTP context.\n * `packet` - Encrypted packet.\n * `data_bytes` - Data bytes to be encrypted.\n * `num_header_bytes` - Number of header bytes.\n * `num_data_bytes` - Number of data bytes.\n * `index` - Packet index."]
pub fn ocrypto_srtp_encrypt(
srtp_ctx: *const ocrypto_srtp_ctx,
packet: *mut u8,
data_bytes: *const u8,
num_header_bytes: usize,
num_data_bytes: usize,
index: u32,
);
}
extern "C" {
#[doc = " Decrypt SRTP packet.\n\n * `srtp_ctx` - SRTP context.\n * `data` - Decrypted data.\n * `packet_bytes` - Packet bytes.\n * `num_packet_bytes` - Number of packet bytes.\n * `index` - Packet index."]
pub fn ocrypto_srtp_decrypt(
srtp_ctx: *const ocrypto_srtp_ctx,
data: *mut u8,
packet_bytes: *const u8,
num_packet_bytes: usize,
index: u32,
);
}
extern "C" {
#[doc = " Generate SRTP authentication tag from bytes and index.\n\n * `srtp_ctx` - SRTP context.\n * `tag` - Authentication tag generated.\n * `bytes` - Byte buffer.\n * `num_bytes` - Number of bytes in buffer.\n * `index` - Index."]
pub fn ocrypto_srtp_authenticate(
srtp_ctx: *const ocrypto_srtp_ctx,
tag: *mut u8,
bytes: *const u8,
num_bytes: usize,
index: u32,
);
}
extern "C" {
#[doc = " Check SRTP authentication tag against bytes and index.\n\n * `srtp_ctx` - SRTP context.\n * `tag` - Tag.\n * `bytes` - Byte buffer.\n * `num_bytes` - Number of bytes in buffer.\n * `index` - Index.\n\n Returns 1 If the tag is valid.\n Returns 0 Otherwise."]
pub fn ocrypto_srtp_verify_authentication(
srtp_ctx: *const ocrypto_srtp_ctx,
tag: *const u8,
bytes: *const u8,
num_bytes: usize,
index: u32,
) -> ::core::ffi::c_int;
}